vendor.c45496ecc850f4852679.js 2.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. webpackJsonp([0],{"++K3":function(t,e){var n,i,r,o,s,a,l,u,c,h,p,d,f,g,m,v=!1;function _(){if(!v){v=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),_=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(d=/\b(iPhone|iP[ao]d)/.exec(t),f=/\b(iP[ao]d)/.exec(t),h=/Android/i.exec(t),g=/FBAN\/\w+;/i.exec(t),m=/Mobile/i.exec(t),p=!!/Win64/.exec(t),e){(n=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(n=document.documentMode);var y=/(?:Trident\/(\d+.\d+))/.exec(t);a=y?parseFloat(y[1])+4:n,i=e[2]?parseFloat(e[2]):NaN,r=e[3]?parseFloat(e[3]):NaN,(o=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),s=e&&e[1]?parseFloat(e[1]):NaN):s=NaN}else n=i=r=s=o=NaN;if(_){if(_[1]){var b=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);l=!b||parseFloat(b[1].replace("_","."))}else l=!1;u=!!_[2],c=!!_[3]}else l=u=c=!1}}var y={ie:function(){return _()||n},ieCompatibilityMode:function(){return _()||a>n},ie64:function(){return y.ie()&&p},firefox:function(){return _()||i},opera:function(){return _()||r},webkit:function(){return _()||o},safari:function(){return y.webkit()},chrome:function(){return _()||s},windows:function(){return _()||u},osx:function(){return _()||l},linux:function(){return _()||c},iphone:function(){return _()||d},mobile:function(){return _()||d||f||h||m},nativeApp:function(){return _()||g},android:function(){return _()||h},ipad:function(){return _()||f}};t.exports=y},"+E39":function(t,e,n){t.exports=!n("S82l")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"+ZMJ":function(t,e,n){var i=n("lOnJ");t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},"+tPU":function(t,e,n){n("xGkn");for(var i=n("7KvD"),r=n("hJx8"),o=n("/bQp"),s=n("dSzd")("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;l<a.length;l++){var u=a[l],c=i[u],h=c&&c.prototype;h&&!h[s]&&r(h,s,u),o[u]=o.Array}},"//Fk":function(t,e,n){t.exports={default:n("U5ju"),__esModule:!0}},"/bQp":function(t,e){t.exports={}},"/dHd":function(t,e,n){var i,r,o,s;s=function(t){
  2. /**
  3. * @license
  4. * Copyright 2020 Google LLC
  5. * SPDX-License-Identifier: Apache-2.0
  6. */
  7. "use strict";return t},r=[n("GEkh")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},"/n6Q":function(t,e,n){n("zQR9"),n("+tPU"),t.exports=n("Kh4W").f("iterator")},"/ocq":function(t,e,n){"use strict";
  8. /*!
  9. * vue-router v3.5.2
  10. * (c) 2021 Evan You
  11. * @license MIT
  12. */function i(t,e){0}function r(t,e){for(var n in e)t[n]=e[n];return t}var o=/[!'()*]/g,s=function(t){return"%"+t.charCodeAt(0).toString(16)},a=/%2C/g,l=function(t){return encodeURIComponent(t).replace(o,s).replace(a,",")};function u(t){try{return decodeURIComponent(t)}catch(t){0}return t}var c=function(t){return null==t||"object"==typeof t?t:String(t)};function h(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),i=u(n.shift()),r=n.length>0?u(n.join("=")):null;void 0===e[i]?e[i]=r:Array.isArray(e[i])?e[i].push(r):e[i]=[e[i],r]}),e):e}function p(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return l(e);if(Array.isArray(n)){var i=[];return n.forEach(function(t){void 0!==t&&(null===t?i.push(l(e)):i.push(l(e)+"="+l(t)))}),i.join("&")}return l(e)+"="+l(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}var d=/\/?$/;function f(t,e,n,i){var r=i&&i.options.stringifyQuery,o=e.query||{};try{o=g(o)}catch(t){}var s={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:o,params:e.params||{},fullPath:v(e,r),matched:t?function(t){var e=[];for(;t;)e.unshift(t),t=t.parent;return e}(t):[]};return n&&(s.redirectedFrom=v(n,r)),Object.freeze(s)}function g(t){if(Array.isArray(t))return t.map(g);if(t&&"object"==typeof t){var e={};for(var n in t)e[n]=g(t[n]);return e}return t}var m=f(null,{path:"/"});function v(t,e){var n=t.path,i=t.query;void 0===i&&(i={});var r=t.hash;return void 0===r&&(r=""),(n||"/")+(e||p)(i)+r}function _(t,e,n){return e===m?t===e:!!e&&(t.path&&e.path?t.path.replace(d,"")===e.path.replace(d,"")&&(n||t.hash===e.hash&&y(t.query,e.query)):!(!t.name||!e.name)&&(t.name===e.name&&(n||t.hash===e.hash&&y(t.query,e.query)&&y(t.params,e.params))))}function y(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t).sort(),i=Object.keys(e).sort();return n.length===i.length&&n.every(function(n,r){var o=t[n];if(i[r]!==n)return!1;var s=e[n];return null==o||null==s?o===s:"object"==typeof o&&"object"==typeof s?y(o,s):String(o)===String(s)})}function b(t){for(var e=0;e<t.matched.length;e++){var n=t.matched[e];for(var i in n.instances){var r=n.instances[i],o=n.enteredCbs[i];if(r&&o){delete n.enteredCbs[i];for(var s=0;s<o.length;s++)r._isBeingDestroyed||o[s](r)}}}}var T={name:"RouterView",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,i=e.children,o=e.parent,s=e.data;s.routerView=!0;for(var a=o.$createElement,l=n.name,u=o.$route,c=o._routerViewCache||(o._routerViewCache={}),h=0,p=!1;o&&o._routerRoot!==o;){var d=o.$vnode?o.$vnode.data:{};d.routerView&&h++,d.keepAlive&&o._directInactive&&o._inactive&&(p=!0),o=o.$parent}if(s.routerViewDepth=h,p){var f=c[l],g=f&&f.component;return g?(f.configProps&&E(g,s,f.route,f.configProps),a(g,s,i)):a()}var m=u.matched[h],v=m&&m.components[l];if(!m||!v)return c[l]=null,a();c[l]={component:v},s.registerRouteInstance=function(t,e){var n=m.instances[l];(e&&n!==t||!e&&n===t)&&(m.instances[l]=e)},(s.hook||(s.hook={})).prepatch=function(t,e){m.instances[l]=e.componentInstance},s.hook.init=function(t){t.data.keepAlive&&t.componentInstance&&t.componentInstance!==m.instances[l]&&(m.instances[l]=t.componentInstance),b(u)};var _=m.props&&m.props[l];return _&&(r(c[l],{route:u,configProps:_}),E(v,s,u,_)),a(v,s,i)}};function E(t,e,n,i){var o=e.props=function(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0;default:0}}(n,i);if(o){o=e.props=r({},o);var s=e.attrs=e.attrs||{};for(var a in o)t.props&&a in t.props||(s[a]=o[a],delete o[a])}}function C(t,e,n){var i=t.charAt(0);if("/"===i)return t;if("?"===i||"#"===i)return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var o=t.replace(/^\//,"").split("/"),s=0;s<o.length;s++){var a=o[s];".."===a?r.pop():"."!==a&&r.push(a)}return""!==r[0]&&r.unshift(""),r.join("/")}function S(t){return t.replace(/\/\//g,"/")}var w=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},k=V,x=A,I=function(t,e){return N(A(t,e),e)},R=N,O=U,D=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function A(t,e){for(var n,i=[],r=0,o=0,s="",a=e&&e.delimiter||"/";null!=(n=D.exec(t));){var l=n[0],u=n[1],c=n.index;if(s+=t.slice(o,c),o=c+l.length,u)s+=u[1];else{var h=t[o],p=n[2],d=n[3],f=n[4],g=n[5],m=n[6],v=n[7];s&&(i.push(s),s="");var _=null!=p&&null!=h&&h!==p,y="+"===m||"*"===m,b="?"===m||"*"===m,T=n[2]||a,E=f||g;i.push({name:d||r++,prefix:p||"",delimiter:T,optional:b,repeat:y,partial:_,asterisk:!!v,pattern:E?P(E):v?".*":"[^"+L(T)+"]+?"})}}return o<t.length&&(s+=t.substr(o)),s&&i.push(s),i}function M(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function N(t,e){for(var n=new Array(t.length),i=0;i<t.length;i++)"object"==typeof t[i]&&(n[i]=new RegExp("^(?:"+t[i].pattern+")$",F(e)));return function(e,i){for(var r="",o=e||{},s=(i||{}).pretty?M:encodeURIComponent,a=0;a<t.length;a++){var l=t[a];if("string"!=typeof l){var u,c=o[l.name];if(null==c){if(l.optional){l.partial&&(r+=l.prefix);continue}throw new TypeError('Expected "'+l.name+'" to be defined')}if(w(c)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but received `'+JSON.stringify(c)+"`");if(0===c.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var h=0;h<c.length;h++){if(u=s(c[h]),!n[a].test(u))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but received `'+JSON.stringify(u)+"`");r+=(0===h?l.prefix:l.delimiter)+u}}else{if(u=l.asterisk?encodeURI(c).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):s(c),!n[a].test(u))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but received "'+u+'"');r+=l.prefix+u}}else r+=l}return r}}function L(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function P(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function B(t,e){return t.keys=e,t}function F(t){return t&&t.sensitive?"":"i"}function U(t,e,n){w(e)||(n=e||n,e=[]);for(var i=(n=n||{}).strict,r=!1!==n.end,o="",s=0;s<t.length;s++){var a=t[s];if("string"==typeof a)o+=L(a);else{var l=L(a.prefix),u="(?:"+a.pattern+")";e.push(a),a.repeat&&(u+="(?:"+l+u+")*"),o+=u=a.optional?a.partial?l+"("+u+")?":"(?:"+l+"("+u+"))?":l+"("+u+")"}}var c=L(n.delimiter||"/"),h=o.slice(-c.length)===c;return i||(o=(h?o.slice(0,-c.length):o)+"(?:"+c+"(?=$))?"),o+=r?"$":i&&h?"":"(?="+c+"|$)",B(new RegExp("^"+o,F(n)),e)}function V(t,e,n){return w(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var i=0;i<n.length;i++)e.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return B(t,e)}(t,e):w(t)?function(t,e,n){for(var i=[],r=0;r<t.length;r++)i.push(V(t[r],e,n).source);return B(new RegExp("(?:"+i.join("|")+")",F(n)),e)}(t,e,n):function(t,e,n){return U(A(t,n),e,n)}(t,e,n)}k.parse=x,k.compile=I,k.tokensToFunction=R,k.tokensToRegExp=O;var H=Object.create(null);function W(t,e,n){e=e||{};try{var i=H[t]||(H[t]=k.compile(t));return"string"==typeof e.pathMatch&&(e[0]=e.pathMatch),i(e,{pretty:!0})}catch(t){return""}finally{delete e[0]}}function G(t,e,n,i){var o="string"==typeof t?{path:t}:t;if(o._normalized)return o;if(o.name){var s=(o=r({},t)).params;return s&&"object"==typeof s&&(o.params=r({},s)),o}if(!o.path&&o.params&&e){(o=r({},o))._normalized=!0;var a=r(r({},e.params),o.params);if(e.name)o.name=e.name,o.params=a;else if(e.matched.length){var l=e.matched[e.matched.length-1].path;o.path=W(l,a,e.path)}else 0;return o}var u=function(t){var e="",n="",i=t.indexOf("#");i>=0&&(e=t.slice(i),t=t.slice(0,i));var r=t.indexOf("?");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{path:t,query:n,hash:e}}(o.path||""),p=e&&e.path||"/",d=u.path?C(u.path,p,n||o.append):p,f=function(t,e,n){void 0===e&&(e={});var i,r=n||h;try{i=r(t||"")}catch(t){i={}}for(var o in e){var s=e[o];i[o]=Array.isArray(s)?s.map(c):c(s)}return i}(u.query,o.query,i&&i.options.parseQuery),g=o.hash||u.hash;return g&&"#"!==g.charAt(0)&&(g="#"+g),{_normalized:!0,path:d,query:f,hash:g}}var j,z=[String,Object],$=[String,Array],X=function(){},Y={name:"RouterLink",props:{to:{type:z,required:!0},tag:{type:String,default:"a"},custom:Boolean,exact:Boolean,exactPath:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:$,default:"click"}},render:function(t){var e=this,n=this.$router,i=this.$route,o=n.resolve(this.to,i,this.append),s=o.location,a=o.route,l=o.href,u={},c=n.options.linkActiveClass,h=n.options.linkExactActiveClass,p=null==c?"router-link-active":c,g=null==h?"router-link-exact-active":h,m=null==this.activeClass?p:this.activeClass,v=null==this.exactActiveClass?g:this.exactActiveClass,y=a.redirectedFrom?f(null,G(a.redirectedFrom),null,n):a;u[v]=_(i,y,this.exactPath),u[m]=this.exact||this.exactPath?u[v]:function(t,e){return 0===t.path.replace(d,"/").indexOf(e.path.replace(d,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(i,y);var b=u[v]?this.ariaCurrentValue:null,T=function(t){K(t)&&(e.replace?n.replace(s,X):n.push(s,X))},E={click:K};Array.isArray(this.event)?this.event.forEach(function(t){E[t]=T}):E[this.event]=T;var C={class:u},S=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:l,route:a,navigate:T,isActive:u[m],isExactActive:u[v]});if(S){if(1===S.length)return S[0];if(S.length>1||!S.length)return 0===S.length?t():t("span",{},S)}if("a"===this.tag)C.on=E,C.attrs={href:l,"aria-current":b};else{var w=function t(e){if(e)for(var n,i=0;i<e.length;i++){if("a"===(n=e[i]).tag)return n;if(n.children&&(n=t(n.children)))return n}}(this.$slots.default);if(w){w.isStatic=!1;var k=w.data=r({},w.data);for(var x in k.on=k.on||{},k.on){var I=k.on[x];x in E&&(k.on[x]=Array.isArray(I)?I:[I])}for(var R in E)R in k.on?k.on[R].push(E[R]):k.on[R]=T;var O=w.data.attrs=r({},w.data.attrs);O.href=l,O["aria-current"]=b}else C.on=E}return t(this.tag,C,this.$slots.default)}};function K(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function J(t){if(!J.installed||j!==t){J.installed=!0,j=t;var e=function(t){return void 0!==t},n=function(t,n){var i=t.$options._parentVnode;e(i)&&e(i=i.data)&&e(i=i.registerRouteInstance)&&i(t,n)};t.mixin({beforeCreate:function(){e(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,n(this,this)},destroyed:function(){n(this)}}),Object.defineProperty(t.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this._routerRoot._route}}),t.component("RouterView",T),t.component("RouterLink",Y);var i=t.config.optionMergeStrategies;i.beforeRouteEnter=i.beforeRouteLeave=i.beforeRouteUpdate=i.created}}var q="undefined"!=typeof window;function Z(t,e,n,i,r){var o=e||[],s=n||Object.create(null),a=i||Object.create(null);t.forEach(function(t){!function t(e,n,i,r,o,s){var a=r.path;var l=r.name;0;var u=r.pathToRegexpOptions||{};var c=function(t,e,n){n||(t=t.replace(/\/$/,""));if("/"===t[0])return t;if(null==e)return t;return S(e.path+"/"+t)}(a,o,u.strict);"boolean"==typeof r.caseSensitive&&(u.sensitive=r.caseSensitive);var h={path:c,regex:function(t,e){var n=k(t,[],e);return n}(c,u),components:r.components||{default:r.component},alias:r.alias?"string"==typeof r.alias?[r.alias]:r.alias:[],instances:{},enteredCbs:{},name:l,parent:o,matchAs:s,redirect:r.redirect,beforeEnter:r.beforeEnter,meta:r.meta||{},props:null==r.props?{}:r.components?r.props:{default:r.props}};r.children&&r.children.forEach(function(r){var o=s?S(s+"/"+r.path):void 0;t(e,n,i,r,h,o)});n[h.path]||(e.push(h.path),n[h.path]=h);if(void 0!==r.alias)for(var p=Array.isArray(r.alias)?r.alias:[r.alias],d=0;d<p.length;++d){var f=p[d];0;var g={path:f,children:r.children};t(e,n,i,g,o,h.path||"/")}l&&(i[l]||(i[l]=h))}(o,s,a,t,r)});for(var l=0,u=o.length;l<u;l++)"*"===o[l]&&(o.push(o.splice(l,1)[0]),u--,l--);return{pathList:o,pathMap:s,nameMap:a}}function Q(t,e){var n=Z(t),i=n.pathList,r=n.pathMap,o=n.nameMap;function s(t,n,s){var a=G(t,n,!1,e),u=a.name;if(u){var c=o[u];if(!c)return l(null,a);var h=c.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof a.params&&(a.params={}),n&&"object"==typeof n.params)for(var p in n.params)!(p in a.params)&&h.indexOf(p)>-1&&(a.params[p]=n.params[p]);return a.path=W(c.path,a.params),l(c,a,s)}if(a.path){a.params={};for(var d=0;d<i.length;d++){var f=i[d],g=r[f];if(tt(g.regex,a.path,a.params))return l(g,a,s)}}return l(null,a)}function a(t,n){var i=t.redirect,r="function"==typeof i?i(f(t,n,null,e)):i;if("string"==typeof r&&(r={path:r}),!r||"object"!=typeof r)return l(null,n);var a=r,u=a.name,c=a.path,h=n.query,p=n.hash,d=n.params;if(h=a.hasOwnProperty("query")?a.query:h,p=a.hasOwnProperty("hash")?a.hash:p,d=a.hasOwnProperty("params")?a.params:d,u){o[u];return s({_normalized:!0,name:u,query:h,hash:p,params:d},void 0,n)}if(c){var g=function(t,e){return C(t,e.parent?e.parent.path:"/",!0)}(c,t);return s({_normalized:!0,path:W(g,d),query:h,hash:p},void 0,n)}return l(null,n)}function l(t,n,i){return t&&t.redirect?a(t,i||n):t&&t.matchAs?function(t,e,n){var i=s({_normalized:!0,path:W(n,e.params)});if(i){var r=i.matched,o=r[r.length-1];return e.params=i.params,l(o,e)}return l(null,e)}(0,n,t.matchAs):f(t,n,i,e)}return{match:s,addRoute:function(t,e){var n="object"!=typeof t?o[t]:void 0;Z([e||t],i,r,o,n),n&&n.alias.length&&Z(n.alias.map(function(t){return{path:t,children:[e]}}),i,r,o,n)},getRoutes:function(){return i.map(function(t){return r[t]})},addRoutes:function(t){Z(t,i,r,o)}}}function tt(t,e,n){var i=e.match(t);if(!i)return!1;if(!n)return!0;for(var r=1,o=i.length;r<o;++r){var s=t.keys[r-1];s&&(n[s.name||"pathMatch"]="string"==typeof i[r]?u(i[r]):i[r])}return!0}var et=q&&window.performance&&window.performance.now?window.performance:Date;function nt(){return et.now().toFixed(3)}var it=nt();function rt(){return it}function ot(t){return it=t}var st=Object.create(null);function at(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual");var t=window.location.protocol+"//"+window.location.host,e=window.location.href.replace(t,""),n=r({},window.history.state);return n.key=rt(),window.history.replaceState(n,"",e),window.addEventListener("popstate",ct),function(){window.removeEventListener("popstate",ct)}}function lt(t,e,n,i){if(t.app){var r=t.options.scrollBehavior;r&&t.app.$nextTick(function(){var o=function(){var t=rt();if(t)return st[t]}(),s=r.call(t,e,n,i?o:null);s&&("function"==typeof s.then?s.then(function(t){gt(t,o)}).catch(function(t){0}):gt(s,o))})}}function ut(){var t=rt();t&&(st[t]={x:window.pageXOffset,y:window.pageYOffset})}function ct(t){ut(),t.state&&t.state.key&&ot(t.state.key)}function ht(t){return dt(t.x)||dt(t.y)}function pt(t){return{x:dt(t.x)?t.x:window.pageXOffset,y:dt(t.y)?t.y:window.pageYOffset}}function dt(t){return"number"==typeof t}var ft=/^#\d/;function gt(t,e){var n,i="object"==typeof t;if(i&&"string"==typeof t.selector){var r=ft.test(t.selector)?document.getElementById(t.selector.slice(1)):document.querySelector(t.selector);if(r){var o=t.offset&&"object"==typeof t.offset?t.offset:{};e=function(t,e){var n=document.documentElement.getBoundingClientRect(),i=t.getBoundingClientRect();return{x:i.left-n.left-e.x,y:i.top-n.top-e.y}}(r,o={x:dt((n=o).x)?n.x:0,y:dt(n.y)?n.y:0})}else ht(t)&&(e=pt(t))}else i&&ht(t)&&(e=pt(t));e&&("scrollBehavior"in document.documentElement.style?window.scrollTo({left:e.x,top:e.y,behavior:t.behavior}):window.scrollTo(e.x,e.y))}var mt,vt=q&&((-1===(mt=window.navigator.userAgent).indexOf("Android 2.")&&-1===mt.indexOf("Android 4.0")||-1===mt.indexOf("Mobile Safari")||-1!==mt.indexOf("Chrome")||-1!==mt.indexOf("Windows Phone"))&&window.history&&"function"==typeof window.history.pushState);function _t(t,e){ut();var n=window.history;try{if(e){var i=r({},n.state);i.key=rt(),n.replaceState(i,"",t)}else n.pushState({key:ot(nt())},"",t)}catch(n){window.location[e?"replace":"assign"](t)}}function yt(t){_t(t,!0)}function bt(t,e,n){var i=function(r){r>=t.length?n():t[r]?e(t[r],function(){i(r+1)}):i(r+1)};i(0)}var Tt={redirected:2,aborted:4,cancelled:8,duplicated:16};function Et(t,e){return St(t,e,Tt.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return wt.forEach(function(n){n in t&&(e[n]=t[n])}),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function Ct(t,e){return St(t,e,Tt.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function St(t,e,n,i){var r=new Error(i);return r._isRouter=!0,r.from=t,r.to=e,r.type=n,r}var wt=["params","query","hash"];function kt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function xt(t,e){return kt(t)&&t._isRouter&&(null==e||t.type===e)}function It(t){return function(e,n,i){var r=!1,o=0,s=null;Rt(t,function(t,e,n,a){if("function"==typeof t&&void 0===t.cid){r=!0,o++;var l,u=At(function(e){var r;((r=e).__esModule||Dt&&"Module"===r[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:j.extend(e),n.components[a]=e,--o<=0&&i()}),c=At(function(t){var e="Failed to resolve async component "+a+": "+t;s||(s=kt(t)?t:new Error(e),i(s))});try{l=t(u,c)}catch(t){c(t)}if(l)if("function"==typeof l.then)l.then(u,c);else{var h=l.component;h&&"function"==typeof h.then&&h.then(u,c)}}}),r||i()}}function Rt(t,e){return Ot(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function Ot(t){return Array.prototype.concat.apply([],t)}var Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function At(t){var e=!1;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];if(!e)return e=!0,t.apply(this,n)}}var Mt=function(t,e){this.router=t,this.base=function(t){if(!t)if(q){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=m,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function Nt(t,e,n,i){var r=Rt(t,function(t,i,r,o){var s=function(t,e){"function"!=typeof t&&(t=j.extend(t));return t.options[e]}(t,e);if(s)return Array.isArray(s)?s.map(function(t){return n(t,i,r,o)}):n(s,i,r,o)});return Ot(i?r.reverse():r)}function Lt(t,e){if(e)return function(){return t.apply(e,arguments)}}Mt.prototype.listen=function(t){this.cb=t},Mt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Mt.prototype.onError=function(t){this.errorCbs.push(t)},Mt.prototype.transitionTo=function(t,e,n){var i,r=this;try{i=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(function(e){e(t)}),t}var o=this.current;this.confirmTransition(i,function(){r.updateRoute(i),e&&e(i),r.ensureURL(),r.router.afterHooks.forEach(function(t){t&&t(i,o)}),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(i)}))},function(t){n&&n(t),t&&!r.ready&&(xt(t,Tt.redirected)&&o===m||(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)})))})},Mt.prototype.confirmTransition=function(t,e,n){var r=this,o=this.current;this.pending=t;var s,a,l=function(t){!xt(t)&&kt(t)&&(r.errorCbs.length?r.errorCbs.forEach(function(e){e(t)}):(i(),console.error(t))),n&&n(t)},u=t.matched.length-1,c=o.matched.length-1;if(_(t,o)&&u===c&&t.matched[u]===o.matched[c])return this.ensureURL(),l(((a=St(s=o,t,Tt.duplicated,'Avoided redundant navigation to current location: "'+s.fullPath+'".')).name="NavigationDuplicated",a));var h=function(t,e){var n,i=Math.max(t.length,e.length);for(n=0;n<i&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}(this.current.matched,t.matched),p=h.updated,d=h.deactivated,f=h.activated,g=function(e,n){if(r.pending!==t)return l(Ct(o,t));try{e(t,o,function(e){!1===e?(r.ensureURL(!0),l(function(t,e){return St(t,e,Tt.aborted,'Navigation aborted from "'+t.fullPath+'" to "'+e.fullPath+'" via a navigation guard.')}(o,t))):kt(e)?(r.ensureURL(!0),l(e)):"string"==typeof e||"object"==typeof e&&("string"==typeof e.path||"string"==typeof e.name)?(l(Et(o,t)),"object"==typeof e&&e.replace?r.replace(e):r.push(e)):n(e)})}catch(t){l(t)}};bt([].concat(function(t){return Nt(t,"beforeRouteLeave",Lt,!0)}(d),this.router.beforeHooks,function(t){return Nt(t,"beforeRouteUpdate",Lt)}(p),f.map(function(t){return t.beforeEnter}),It(f)),g,function(){bt(function(t){return Nt(t,"beforeRouteEnter",function(t,e,n,i){return function(t,e,n){return function(i,r,o){return t(i,r,function(t){"function"==typeof t&&(e.enteredCbs[n]||(e.enteredCbs[n]=[]),e.enteredCbs[n].push(t)),o(t)})}}(t,n,i)})}(f).concat(r.router.resolveHooks),g,function(){if(r.pending!==t)return l(Ct(o,t));r.pending=null,e(t),r.router.app&&r.router.app.$nextTick(function(){b(t)})})})},Mt.prototype.updateRoute=function(t){this.current=t,this.cb&&this.cb(t)},Mt.prototype.setupListeners=function(){},Mt.prototype.teardown=function(){this.listeners.forEach(function(t){t()}),this.listeners=[],this.current=m,this.pending=null};var Pt=function(t){function e(e,n){t.call(this,e,n),this._startLocation=Bt(this.base)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router,n=e.options.scrollBehavior,i=vt&&n;i&&this.listeners.push(at());var r=function(){var n=t.current,r=Bt(t.base);t.current===m&&r===t._startLocation||t.transitionTo(r,function(t){i&&lt(e,t,n,!0)})};window.addEventListener("popstate",r),this.listeners.push(function(){window.removeEventListener("popstate",r)})}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,function(t){_t(S(i.base+t.fullPath)),lt(i.router,t,r,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,function(t){yt(S(i.base+t.fullPath)),lt(i.router,t,r,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(Bt(this.base)!==this.current.fullPath){var e=S(this.base+this.current.fullPath);t?_t(e):yt(e)}},e.prototype.getCurrentLocation=function(){return Bt(this.base)},e}(Mt);function Bt(t){var e=window.location.pathname,n=e.toLowerCase(),i=t.toLowerCase();return!t||n!==i&&0!==n.indexOf(S(i+"/"))||(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Ft=function(t){function e(e,n,i){t.call(this,e,n),i&&function(t){var e=Bt(t);if(!/^\/#/.test(e))return window.location.replace(S(t+"/#"+e)),!0}(this.base)||Ut()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,n=vt&&e;n&&this.listeners.push(at());var i=function(){var e=t.current;Ut()&&t.transitionTo(Vt(),function(i){n&&lt(t.router,i,e,!0),vt||Gt(i.fullPath)})},r=vt?"popstate":"hashchange";window.addEventListener(r,i),this.listeners.push(function(){window.removeEventListener(r,i)})}},e.prototype.push=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,function(t){Wt(t.fullPath),lt(i.router,t,r,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var i=this,r=this.current;this.transitionTo(t,function(t){Gt(t.fullPath),lt(i.router,t,r,!1),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;Vt()!==e&&(t?Wt(e):Gt(e))},e.prototype.getCurrentLocation=function(){return Vt()},e}(Mt);function Ut(){var t=Vt();return"/"===t.charAt(0)||(Gt("/"+t),!1)}function Vt(){var t=window.location.href,e=t.indexOf("#");return e<0?"":t=t.slice(e+1)}function Ht(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function Wt(t){vt?_t(Ht(t)):window.location.hash=t}function Gt(t){vt?yt(Ht(t)):window.location.replace(Ht(t))}var jt=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var i=this;this.transitionTo(t,function(t){i.stack=i.stack.slice(0,i.index+1).concat(t),i.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var i=this;this.transitionTo(t,function(t){i.stack=i.stack.slice(0,i.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var i=this.stack[n];this.confirmTransition(i,function(){var t=e.current;e.index=n,e.updateRoute(i),e.router.afterHooks.forEach(function(e){e&&e(i,t)})},function(t){xt(t,Tt.duplicated)&&(e.index=n)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Mt),zt=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Q(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!vt&&!1!==t.fallback,this.fallback&&(e="hash"),q||(e="abstract"),this.mode=e,e){case"history":this.history=new Pt(this,t.base);break;case"hash":this.history=new Ft(this,t.base,this.fallback);break;case"abstract":this.history=new jt(this,t.base);break;default:0}},$t={currentRoute:{configurable:!0}};function Xt(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}zt.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},$t.currentRoute.get=function(){return this.history&&this.history.current},zt.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null),e.app||e.history.teardown()}),!this.app){this.app=t;var n=this.history;if(n instanceof Pt||n instanceof Ft){var i=function(t){n.setupListeners(),function(t){var i=n.current,r=e.options.scrollBehavior;vt&&r&&"fullPath"in t&&lt(e,t,i,!1)}(t)};n.transitionTo(n.getCurrentLocation(),i,i)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},zt.prototype.beforeEach=function(t){return Xt(this.beforeHooks,t)},zt.prototype.beforeResolve=function(t){return Xt(this.resolveHooks,t)},zt.prototype.afterEach=function(t){return Xt(this.afterHooks,t)},zt.prototype.onReady=function(t,e){this.history.onReady(t,e)},zt.prototype.onError=function(t){this.history.onError(t)},zt.prototype.push=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise(function(e,n){i.history.push(t,e,n)});this.history.push(t,e,n)},zt.prototype.replace=function(t,e,n){var i=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise(function(e,n){i.history.replace(t,e,n)});this.history.replace(t,e,n)},zt.prototype.go=function(t){this.history.go(t)},zt.prototype.back=function(){this.go(-1)},zt.prototype.forward=function(){this.go(1)},zt.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},zt.prototype.resolve=function(t,e,n){var i=G(t,e=e||this.history.current,n,this),r=this.match(i,e),o=r.redirectedFrom||r.fullPath;return{location:i,route:r,href:function(t,e,n){var i="hash"===n?"#"+e:e;return t?S(t+"/"+i):i}(this.history.base,o,this.mode),normalizedTo:i,resolved:r}},zt.prototype.getRoutes=function(){return this.matcher.getRoutes()},zt.prototype.addRoute=function(t,e){this.matcher.addRoute(t,e),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},zt.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(zt.prototype,$t),zt.install=J,zt.version="3.5.2",zt.isNavigationFailure=xt,zt.NavigationFailureType=Tt,zt.START_LOCATION=m,q&&window.Vue&&window.Vue.use(zt),e.a=zt},"02w1":function(t,e,n){"use strict";e.__esModule=!0,e.removeResizeListener=e.addResizeListener=void 0;var i,r=n("z+gd"),o=(i=r)&&i.__esModule?i:{default:i};var s="undefined"==typeof window,a=function(t){var e=t,n=Array.isArray(e),i=0;for(e=n?e:e[Symbol.iterator]();;){var r;if(n){if(i>=e.length)break;r=e[i++]}else{if((i=e.next()).done)break;r=i.value}var o=r.target.__resizeListeners__||[];o.length&&o.forEach(function(t){t()})}};e.addResizeListener=function(t,e){s||(t.__resizeListeners__||(t.__resizeListeners__=[],t.__ro__=new o.default(a),t.__ro__.observe(t)),t.__resizeListeners__.push(e))},e.removeResizeListener=function(t,e){t&&t.__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(e),1),t.__resizeListeners__.length||t.__ro__.disconnect())}},"06OY":function(t,e,n){var i=n("3Eo+")("meta"),r=n("EqjI"),o=n("D2L2"),s=n("evD5").f,a=0,l=Object.isExtensible||function(){return!0},u=!n("S82l")(function(){return l(Object.preventExtensions({}))}),c=function(t){s(t,i,{value:{i:"O"+ ++a,w:{}}})},h=t.exports={KEY:i,NEED:!1,fastKey:function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,i)){if(!l(t))return"F";if(!e)return"E";c(t)}return t[i].i},getWeak:function(t,e){if(!o(t,i)){if(!l(t))return!0;if(!e)return!1;c(t)}return t[i].w},onFreeze:function(t){return u&&h.NEED&&l(t)&&!o(t,i)&&c(t),t}}},"0kY3":function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=102)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},10:function(t,e){t.exports=n("HJMx")},102:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["el-input-number",t.inputNumberSize?"el-input-number--"+t.inputNumberSize:"",{"is-disabled":t.inputNumberDisabled},{"is-without-controls":!t.controls},{"is-controls-right":t.controlsAtRight}],on:{dragstart:function(t){t.preventDefault()}}},[t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-input-number__decrease",class:{"is-disabled":t.minDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.decrease(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-down":"minus")})]):t._e(),t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-input-number__increase",class:{"is-disabled":t.maxDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.increase(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-up":"plus")})]):t._e(),n("el-input",{ref:"input",attrs:{value:t.displayValue,placeholder:t.placeholder,disabled:t.inputNumberDisabled,size:t.inputNumberSize,max:t.max,min:t.min,name:t.name,label:t.label},on:{blur:t.handleBlur,focus:t.handleFocus,input:t.handleInput,change:t.handleInputChange},nativeOn:{keydown:[function(e){return"button"in e||!t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?(e.preventDefault(),t.increase(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?(e.preventDefault(),t.decrease(e)):null}]}})],1)};i._withStripped=!0;var r=n(10),o=n.n(r),s=n(22),a=n.n(s),l=n(30),u={name:"ElInputNumber",mixins:[a()("input")],inject:{elForm:{default:""},elFormItem:{default:""}},directives:{repeatClick:l.a},components:{ElInput:o.a},props:{step:{type:Number,default:1},stepStrictly:{type:Boolean,default:!1},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},value:{},disabled:Boolean,size:String,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:""},name:String,label:String,placeholder:String,precision:{type:Number,validator:function(t){return t>=0&&t===parseInt(t,10)}}},data:function(){return{currentValue:0,userInput:null}},watch:{value:{immediate:!0,handler:function(t){var e=void 0===t?t:Number(t);if(void 0!==e){if(isNaN(e))return;if(this.stepStrictly){var n=this.getPrecision(this.step),i=Math.pow(10,n);e=Math.round(e/this.step)*i*this.step/i}void 0!==this.precision&&(e=this.toPrecision(e,this.precision))}e>=this.max&&(e=this.max),e<=this.min&&(e=this.min),this.currentValue=e,this.userInput=null,this.$emit("input",e)}}},computed:{minDisabled:function(){return this._decrease(this.value,this.step)<this.min},maxDisabled:function(){return this._increase(this.value,this.step)>this.max},numPrecision:function(){var t=this.value,e=this.step,n=this.getPrecision,i=this.precision,r=n(e);return void 0!==i?(r>i&&console.warn("[Element Warn][InputNumber]precision should not be less than the decimal places of step"),i):Math.max(n(t),r)},controlsAtRight:function(){return this.controls&&"right"===this.controlsPosition},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},inputNumberSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputNumberDisabled:function(){return this.disabled||!!(this.elForm||{}).disabled},displayValue:function(){if(null!==this.userInput)return this.userInput;var t=this.currentValue;if("number"==typeof t){if(this.stepStrictly){var e=this.getPrecision(this.step),n=Math.pow(10,e);t=Math.round(t/this.step)*n*this.step/n}void 0!==this.precision&&(t=t.toFixed(this.precision))}return t}},methods:{toPrecision:function(t,e){return void 0===e&&(e=this.numPrecision),parseFloat(Math.round(t*Math.pow(10,e))/Math.pow(10,e))},getPrecision:function(t){if(void 0===t)return 0;var e=t.toString(),n=e.indexOf("."),i=0;return-1!==n&&(i=e.length-n-1),i},_increase:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t+n*e)/n)},_decrease:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t-n*e)/n)},increase:function(){if(!this.inputNumberDisabled&&!this.maxDisabled){var t=this.value||0,e=this._increase(t,this.step);this.setCurrentValue(e)}},decrease:function(){if(!this.inputNumberDisabled&&!this.minDisabled){var t=this.value||0,e=this._decrease(t,this.step);this.setCurrentValue(e)}},handleBlur:function(t){this.$emit("blur",t)},handleFocus:function(t){this.$emit("focus",t)},setCurrentValue:function(t){var e=this.currentValue;"number"==typeof t&&void 0!==this.precision&&(t=this.toPrecision(t,this.precision)),t>=this.max&&(t=this.max),t<=this.min&&(t=this.min),e!==t&&(this.userInput=null,this.$emit("input",t),this.$emit("change",t,e),this.currentValue=t)},handleInput:function(t){this.userInput=t},handleInputChange:function(t){var e=""===t?void 0:Number(t);isNaN(e)&&""!==t||this.setCurrentValue(e),this.userInput=null},select:function(){this.$refs.input.select()}},mounted:function(){var t=this.$refs.input.$refs.input;t.setAttribute("role","spinbutton"),t.setAttribute("aria-valuemax",this.max),t.setAttribute("aria-valuemin",this.min),t.setAttribute("aria-valuenow",this.currentValue),t.setAttribute("aria-disabled",this.inputNumberDisabled)},updated:function(){this.$refs&&this.$refs.input&&this.$refs.input.$refs.input.setAttribute("aria-valuenow",this.currentValue)}},c=n(0),h=Object(c.a)(u,i,[],!1,null,null,null);h.options.__file="packages/input-number/src/input-number.vue";var p=h.exports;p.install=function(t){t.component(p.name,p)};e.default=p},2:function(t,e){t.exports=n("2kvA")},22:function(t,e){t.exports=n("1oZe")},30:function(t,e,n){"use strict";var i=n(2);e.a={bind:function(t,e,n){var r=null,o=void 0,s=function(){return n.context[e.expression].apply()},a=function(){Date.now()-o<100&&s(),clearInterval(r),r=null};Object(i.on)(t,"mousedown",function(t){0===t.button&&(o=Date.now(),Object(i.once)(document,"mouseup",a),clearInterval(r),r=setInterval(s,100))})}}}})},"1kS7":function(t,e){e.f=Object.getOwnPropertySymbols},"1oZe":function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t){return{methods:{focus:function(){this.$refs[t].focus()}}}}},"21It":function(t,e,n){"use strict";var i=n("FtD3");t.exports=function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(i("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}},"2KxR":function(t,e){t.exports=function(t,e,n,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(n+": incorrect invocation!");return t}},"2kvA":function(t,e,n){"use strict";e.__esModule=!0,e.isInContainer=e.getScrollContainer=e.isScroll=e.getStyle=e.once=e.off=e.on=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.hasClass=f,e.addClass=function(t,e){if(!t)return;for(var n=t.className,i=(e||"").split(" "),r=0,o=i.length;r<o;r++){var s=i[r];s&&(t.classList?t.classList.add(s):f(t,s)||(n+=" "+s))}t.classList||t.setAttribute("class",n)},e.removeClass=function(t,e){if(!t||!e)return;for(var n=e.split(" "),i=" "+t.className+" ",r=0,o=n.length;r<o;r++){var s=n[r];s&&(t.classList?t.classList.remove(s):f(t,s)&&(i=i.replace(" "+s+" "," ")))}t.classList||t.setAttribute("class",c(i))},e.setStyle=function t(e,n,r){if(!e||!n)return;if("object"===(void 0===n?"undefined":i(n)))for(var o in n)n.hasOwnProperty(o)&&t(e,o,n[o]);else"opacity"===(n=h(n))&&u<9?e.style.filter=isNaN(r)?"":"alpha(opacity="+100*r+")":e.style[n]=r};var r,o=n("7+uW");var s=((r=o)&&r.__esModule?r:{default:r}).default.prototype.$isServer,a=/([\:\-\_]+(.))/g,l=/^moz([A-Z])/,u=s?0:Number(document.documentMode),c=function(t){return(t||"").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")},h=function(t){return t.replace(a,function(t,e,n,i){return i?n.toUpperCase():n}).replace(l,"Moz$1")},p=e.on=!s&&document.addEventListener?function(t,e,n){t&&e&&n&&t.addEventListener(e,n,!1)}:function(t,e,n){t&&e&&n&&t.attachEvent("on"+e,n)},d=e.off=!s&&document.removeEventListener?function(t,e,n){t&&e&&t.removeEventListener(e,n,!1)}:function(t,e,n){t&&e&&t.detachEvent("on"+e,n)};e.once=function(t,e,n){p(t,e,function i(){n&&n.apply(this,arguments),d(t,e,i)})};function f(t,e){if(!t||!e)return!1;if(-1!==e.indexOf(" "))throw new Error("className should not contain space.");return t.classList?t.classList.contains(e):(" "+t.className+" ").indexOf(" "+e+" ")>-1}var g=e.getStyle=u<9?function(t,e){if(!s){if(!t||!e)return null;"float"===(e=h(e))&&(e="styleFloat");try{switch(e){case"opacity":try{return t.filters.item("alpha").opacity/100}catch(t){return 1}default:return t.style[e]||t.currentStyle?t.currentStyle[e]:null}}catch(n){return t.style[e]}}}:function(t,e){if(!s){if(!t||!e)return null;"float"===(e=h(e))&&(e="cssFloat");try{var n=document.defaultView.getComputedStyle(t,"");return t.style[e]||n?n[e]:null}catch(n){return t.style[e]}}};var m=e.isScroll=function(t,e){if(!s)return g(t,null!==e&&void 0!==e?e?"overflow-y":"overflow-x":"overflow").match(/(scroll|auto)/)};e.getScrollContainer=function(t,e){if(!s){for(var n=t;n;){if([window,document,document.documentElement].includes(n))return window;if(m(n,e))return n;n=n.parentNode}return n}},e.isInContainer=function(t,e){if(s||!t||!e)return!1;var n=t.getBoundingClientRect(),i=void 0;return i=[window,document,document.documentElement,null,void 0].includes(e)?{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:e.getBoundingClientRect(),n.top<i.bottom&&n.bottom>i.top&&n.right>i.left&&n.left<i.right}},"2qEw":function(t,e,n){"use strict";(function(t,i,r){n.d(e,"a",function(){return bt}),n.d(e,"b",function(){return kt}),n.d(e,"c",function(){return oa}),n.d(e,"d",function(){return dl}),n.d(e,"e",function(){return Ks}),n.d(e,"f",function(){return Zc}),n.d(e,"g",function(){return ds}),n.d(e,"h",function(){return wn}),n.d(e,"i",function(){return $a}),n.d(e,"j",function(){return Ja}),n.d(e,"k",function(){return ua}),n.d(e,"l",function(){return vs}),n.d(e,"m",function(){return Jn}),n.d(e,"n",function(){return Tn}),n.d(e,"o",function(){return Au}),n.d(e,"p",function(){return Kc}),n.d(e,"q",function(){return nl}),n.d(e,"r",function(){return Il}),n.d(e,"s",function(){return pl}),n.d(e,"t",function(){return ya}),n.d(e,"u",function(){return Cs}),n.d(e,"v",function(){return ti}),n.d(e,"w",function(){return Bl}),n.d(e,"x",function(){return ui}),n.d(e,"y",function(){return fn}),n.d(e,"z",function(){return Qa}),n.d(e,"A",function(){return xs}),n.d(e,"B",function(){return vl}),n.d(e,"C",function(){return bl}),n.d(e,"D",function(){return Li}),n.d(e,"E",function(){return pi}),n.d(e,"F",function(){return Sa}),n.d(e,"G",function(){return pn}),n.d(e,"H",function(){return gn}),n.d(e,"I",function(){return mn}),n.d(e,"J",function(){return vn}),n.d(e,"K",function(){return _n}),n.d(e,"L",function(){return je}),n.d(e,"M",function(){return di}),n.d(e,"N",function(){return Vl}),n.d(e,"O",function(){return gi}),n.d(e,"P",function(){return bn});
  13. /**
  14. * @license
  15. * Copyright 2020 Google LLC. All Rights Reserved.
  16. * Licensed under the Apache License, Version 2.0 (the "License");
  17. * you may not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * http://www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an "AS IS" BASIS,
  24. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. * =============================================================================
  28. */
  29. var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function a(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(s,a)}l((i=i.apply(t,e||[])).next())})}function l(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var u=function(){function t(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return t.prototype.setPlatform=function(t,e){null!=this.platform&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=t,this.platform=e},t.prototype.registerFlag=function(t,e,n){if(this.flagRegistry[t]={evaluationFn:e,setHook:n},null!=this.urlFlags[t]){var i=this.urlFlags[t];console.warn("Setting feature override from URL "+t+": "+i+"."),this.set(t,i)}},t.prototype.get=function(t){return t in this.flags?this.flags[t]:(this.flags[t]=this.evaluateFlag(t),this.flags[t])},t.prototype.getNumber=function(t){return this.get(t)},t.prototype.getBool=function(t){return this.get(t)},t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){if(null==this.flagRegistry[t])throw new Error("Cannot set flag "+t+" as it has not been registered.");this.flags[t]=e,null!=this.flagRegistry[t].setHook&&this.flagRegistry[t].setHook(e)},t.prototype.evaluateFlag=function(t){if(null==this.flagRegistry[t])throw new Error("Cannot evaluate flag '"+t+"': no evaluation function found.");return this.flagRegistry[t].evaluationFn()},t.prototype.setFlags=function(t){this.flags=Object.assign({},t)},t.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},t.prototype.populateURLFlags=function(){var t=this;if(void 0!==this.global&&void 0!==this.global.location&&void 0!==this.global.location.search){var e,n,i=(e=this.global.location.search,n={},e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return function(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}(n,e[0],e[1]),e.join("=")}),n);"tfjsflags"in i&&i.tfjsflags.split(",").forEach(function(e){var n=e.split(":"),i=n[0],r=n[1];t.urlFlags[i]=function(t,e){if("true"===(e=e.toLowerCase())||"false"===e)return"true"===e;if(""+ +e===e)return+e;throw new Error("Could not parse value flag value "+e+" for flag "+t+".")}(i,r)})}},t}();function c(){return h}var h=null,p=new Map,d=new Map;function f(t,e){var n=_(t,e);return p.get(n)}function g(t){for(var e=p.entries(),n=[];;){var i=e.next(),r=i.done,o=i.value;if(r)break;var s=o[0],a=o[1];s.split("_")[0]===t&&n.push(a)}return n}function m(t){var e=t.kernelName,n=t.backendName,i=_(e,n);if(p.has(i))throw new Error("The kernel '"+e+"' for backend '"+n+"' is already registered");p.set(i,t)}function v(t){var e=t.kernelName;d.has(e)&&console.warn("Overriding the gradient for '"+e+"'"),d.set(e,t)}function _(t,e){return e+"_"+t}function y(t){for(var e=t.length,n=0,i=0;e>0;)i=Math.random()*e|0,n=t[--e],t[e]=t[i],t[i]=n}function b(t,e,n){return Math.max(t,Math.min(e,n))}function T(t){return t%2==0?t:t+1}function E(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e}function C(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function S(t,e,n){void 0===n&&(n=""),C(I(t,e),function(){return n+" Shapes "+t+" and "+e+" must match"})}function w(t){C(null!=t,function(){return"The input to the tensor constructor must be a non-null value."})}function k(t,e,n){if(void 0===e&&(e=[]),void 0===n&&(n=!1),null==e&&(e=[]),Array.isArray(t)||W(t)&&!n)for(var i=0;i<t.length;++i)k(t[i],e,n);else e.push(t);return e}function x(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e}function I(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function R(t){return t%1==0}function O(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)}function D(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function A(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function M(t,e,n){return void 0===e&&(e=function(t){return 0}),new Promise(function(i,r){var o=0,s=function(){if(t())i();else{var a=e(++o);null!=n&&o>=n?r():setTimeout(s,a)}};s()})}function N(t,e){for(var n=1,i=-1,r=0;r<t.length;++r)if(t[r]>=0)n*=t[r];else if(-1===t[r]){if(-1!==i)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+i+" and dim "+r);i=r}else if(t[r]<0)throw Error("Shapes can not be < 0. Found "+t[r]+" at dim "+r);if(-1===i){if(e>0&&e!==n)throw Error("Size("+e+") must match the product of shape "+t);return t}if(0===n)throw Error("Cannot infer the missing size in ["+t+"] when there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. Got "+e+" / "+n);var o=t.slice();return o[i]=e/n,o}function L(t,e){var n=e.length;return C((t=null==t?e.map(function(t,e){return e}):[].concat(t)).every(function(t){return t>=-n&&t<n}),function(){return"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t}),C(t.every(function(t){return R(t)}),function(){return"All values in axis param must be integers but got axis "+t}),t.map(function(t){return t<0?n+t:t})}function P(t,e){for(var n=[],i=[],r=null!=e&&Array.isArray(e)&&0===e.length,o=null==e||r?null:L(e,t).sort(),s=0,a=0;a<t.length;++a){if(null!=o){if(o[s]===a&&1!==t[a])throw new Error("Can't squeeze axis "+a+" since its dim '"+t[a]+"' is not 1");(null==o[s]||o[s]>a)&&1===t[a]&&(n.push(t[a]),i.push(a)),o[s]<=a&&s++}1!==t[a]&&(n.push(t[a]),i.push(a))}return{newShape:n,keptDims:i}}function B(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error("Unknown data type "+t);n=new Uint8Array(e)}return n}function F(t,e){var n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error("Unknown data type "+t);n=new Array(e)}return n}function U(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(isNaN(i)||!isFinite(i))throw Error("A tensor of type "+e+" being uploaded contains "+i+".")}}function V(t){return"bool"===t||"complex64"===t||"float32"===t||"int32"===t||"string"===t}function H(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)}function W(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function G(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)}function j(t){if(null==t)return 0;var e=0;return t.forEach(function(t){return e+=t.length}),e}function z(t){return"string"==typeof t||t instanceof String}function $(t){return"boolean"==typeof t}function X(t){return"number"==typeof t}function Y(t){return Array.isArray(t)?Y(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array?"int32":X(t)?"float32":z(t)?"string":$(t)?"bool":"float32"}function K(t){return!!(t&&t.constructor&&t.call&&t.apply)}function J(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t}function q(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var i=e-3;i>=0;--i)n[i]=n[i+1]*t[i+1];return n}function Z(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=k(t)),n&&U(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e){for(var i=new Uint8Array(t.length),r=0;r<i.length;++r)0!==Math.round(t[r])&&(i[r]=1);return i}throw new Error("Unknown data type "+e)}function Q(t,e){if(0===t.length)return e[0];var n=t.reduce(function(t,e){return t*e});if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,i){var r=new Array;if(1===n.length)for(var o=n[0],s=0;s<o;s++)r[s]=i[e+s];else{o=n[0];var a=n.slice(1),l=a.reduce(function(t,e){return t*e});for(s=0;s<o;s++)r[s]=t(e+s*l,a,i)}return r}(0,t,e)}function tt(t,e){for(var n=et(t,e),i=0;i<n.length;i++)n[i]=1;return n}function et(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}function nt(){return c().platform.now()}function it(t){t.forEach(function(e){C(Number.isInteger(e)&&e>=0,function(){return"Tensor must have a shape comprised of positive integers but got shape ["+t+"]."})})}function rt(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",c().platform.encode(t,e)}function ot(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",c().platform.decode(t,e)}function st(t,e,n){if(0===e)return 0;if(1===e)return t[0];for(var i=t[t.length-1],r=0;r<t.length-1;++r)i+=n[r]*t[r];return i}function at(t,e,n){if(0===e)return[];if(1===e)return[t];for(var i=new Array(e),r=0;r<i.length-1;++r)i[r]=Math.floor(t/n[r]),t-=i[r]*n[r];return i[i.length-1]=t,i}Object.freeze({shuffle:y,clamp:b,nearestLargerEven:T,sum:E,randUniform:function(t,e){var n=Math.random();return e*n+(1-n)*t},distSquared:function(t,e){for(var n=0,i=0;i<t.length;i++){var r=Number(t[i])-Number(e[i]);n+=r*r}return n},assert:C,assertShapesMatch:S,assertNonNull:w,flatten:k,sizeFromShape:x,isScalarShape:function(t){return 0===t.length},arraysEqual:I,isInt:R,tanh:O,sizeToSquarishShape:D,createShuffledIndices:function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return y(e),e},rightPad:A,repeatedTry:M,inferFromImplicitShape:N,parseAxisParam:L,squeezeShape:P,getTypedArrayFromDType:B,getArrayFromDType:F,checkConversionForErrors:U,isValidDtype:V,hasEncodingLoss:H,isTypedArray:W,bytesPerElement:G,bytesFromStringArray:j,isString:z,isBoolean:$,isNumber:X,inferDtype:Y,isFunction:K,nearestDivisor:J,computeStrides:q,toTypedArray:Z,toNestedArray:Q,makeOnesTypedArray:tt,makeZerosTypedArray:et,now:nt,assertNonNegativeIntegerDimensions:it,fetch:function(t,e){return c().platform.fetch(t,e)},encodeString:rt,decodeString:ot,locToIndex:st,indexToLoc:at});var lt=function(){function t(t,e){this.backendTimer=t,this.logger=e,null==e&&(this.logger=new ut)}return t.prototype.profileKernel=function(t,e,n){var i,r=this,o=this.backendTimer.time(function(){i=n()});return i.forEach(function(n){n.data().then(function(i){!function(t,e,n){if("float32"!==e)return!1;for(var i=0;i<t.length;i++){var r=t[i];if(isNaN(r)||!isFinite(r))return console.warn("Found "+r+" in the result of '"+n+"'"),!0}}(i,n.dtype,t),o.then(function(o){var s="";null!=o.getExtraProfileInfo&&(s=o.getExtraProfileInfo()),r.logger.logKernelProfile(t,n,i,o.kernelMs,e,s)})})}),i},t}(),ut=function(){function t(){}return t.prototype.logKernelProfile=function(t,e,n,i,r,o){var s="number"==typeof i?A(i+"ms",9):i.error,a=A(t,25),l=e.rank,u=e.size,c=A(e.shape.toString(),14),h="";for(var p in r){var d=r[p].shape||e.shape,f=d.length;h+=p+": "+f+"D "+(f>0?d:"")+" "}console.log("%c"+a+"\t%c"+s+"\t%c"+l+"D "+c+"\t%c"+u+"\t%c"+h+"\t%c"+o,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},t}(),ct=20,ht=3,pt=7;function dt(t,e,n){return A(Array.isArray(t)?parseFloat(t[0].toFixed(pt))+" + "+parseFloat(t[1].toFixed(pt))+"j":z(t)?"'"+t+"'":"bool"===n?ft(t):parseFloat(t.toFixed(pt)).toString(),e)}function ft(t){return 0===t?"false":"true"}function gt(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var mt=function(){function t(t,e,n){var i=this;if(this.dtype=e,this.shape=t.slice(),this.size=x(t),null!=n){var r=n.length;C(r===this.size,function(){return"Length of values '"+r+"' does not match the size inferred by the shape '"+i.size+"'."})}if("complex64"===e)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||F(e,this.size),this.strides=q(t)}return t.prototype.set=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];0===n.length&&(n=[0]),C(n.length===this.rank,function(){return"The number of provided coordinates ("+n.length+") must match the rank ("+e.rank+")"});var r=this.locToIndex(n);this.values[r]=t},t.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=0,i=0,r=t;i<r.length;i++){var o=r[i];if(o<0||o>=this.shape[n]){var s="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(s)}n++}for(var a=t[t.length-1],l=0;l<t.length-1;++l)a+=this.strides[l]*t[l];return this.values[a]},t.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},t.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.toTensor=function(){return vt().makeTensor(this.values,this.shape,this.dtype)},t}(),vt=null,_t=null,yt=null,bt=function(){function t(t,e,n,i){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=x(t),this.strides=q(t),this.dataId=n,this.id=i,this.rankType=this.rank<5?this.rank.toString():"higher"}return t.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},t.prototype.asScalar=function(){return this.throwIfDisposed(),C(1===this.size,function(){return"The array must have only 1 element."}),this.reshape([])},t.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},t.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},t.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},t.prototype.as4D=function(t,e,n,i){return this.throwIfDisposed(),this.reshape([t,e,n,i])},t.prototype.as5D=function(t,e,n,i,r){return this.throwIfDisposed(),this.reshape([t,e,n,i,r])},t.prototype.asType=function(t){return this.throwIfDisposed(),_t.cast(this,t)},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.buffer=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,_t.buffer(this.shape,this.dtype,t)]}})})},t.prototype.bufferSync=function(){return _t.buffer(this.shape,this.dtype,this.dataSync())},t.prototype.array=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,Q(this.shape,t)]}})})},t.prototype.arraySync=function(){return Q(this.shape,this.dataSync())},t.prototype.data=function(){return a(this,void 0,void 0,function(){var t,e;return l(this,function(n){switch(n.label){case 0:return this.throwIfDisposed(),t=vt().read(this.dataId),"string"!==this.dtype?[3,2]:[4,t];case 1:e=n.sent();try{return[2,e.map(function(t){return ot(t)})]}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}n.label=2;case 2:return[2,t]}})})},t.prototype.dataSync=function(){this.throwIfDisposed();var t=vt().readSync(this.dataId);if("string"===this.dtype)try{return t.map(function(t){return ot(t)})}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t},t.prototype.bytes=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,vt().read(this.dataId)];case 1:return t=e.sent(),"string"===this.dtype?[2,t]:[2,new Uint8Array(t.buffer)]}})})},t.prototype.dispose=function(){this.isDisposed||(vt().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),t.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},t.prototype.toFloat=function(){return this.asType("float32")},t.prototype.toInt=function(){return this.asType("int32")},t.prototype.toBool=function(){return this.asType("bool")},t.prototype.print=function(t){return void 0===t&&(t=!1),_t.print(this,t)},t.prototype.reshape=function(t){return this.throwIfDisposed(),_t.reshape(this,t)},t.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},t.prototype.expandDims=function(t){return void 0===t&&(t=0),_t.expandDims(this,t)},t.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),_t.cumsum(this,t,e,n)},t.prototype.squeeze=function(t){return this.throwIfDisposed(),_t.squeeze(this,t)},t.prototype.clone=function(){return this.throwIfDisposed(),_t.clone(this)},t.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),_t.oneHot(this,t,e,n)},t.prototype.toString=function(t){return void 0===t&&(t=!1),function(t,e,n,i){var r=q(e),o=function(t,e,n,i){var r=x(e),o=i[i.length-1],s=new Array(o).fill(0),a=e.length,l="complex64"===n?gt(t):t;if(a>1)for(var u=0;u<r/o;u++)for(var c=u*o,h=0;h<o;h++)s[h]=Math.max(s[h],dt(l[c+h],0,n).length);return s}(t,e,n,r),s=e.length,a=function t(e,n,i,r,o,s){void 0===s&&(s=!0);var a="complex64"===i?2:1,l=n[0],u=n.length;if(0===u)return"complex64"===i?[dt(gt(e)[0],0,i)]:"bool"===i?[ft(e[0])]:[e[0].toString()];if(1===u){if(l>ct){var c=ht*a,h=Array.from(e.slice(0,c)),p=Array.from(e.slice((l-ht)*a,l*a));return"complex64"===i&&(h=gt(h),p=gt(p)),["["+h.map(function(t,e){return dt(t,o[e],i)}).join(", ")+", ..., "+p.map(function(t,e){return dt(t,o[l-ht+e],i)}).join(", ")+"]"]}return["["+("complex64"===i?gt(e):Array.from(e)).map(function(t,e){return dt(t,o[e],i)}).join(", ")+"]"]}var d=n.slice(1),f=r.slice(1),g=r[0]*a,m=[];if(l>ct){for(var v=0;v<ht;v++){var _=(y=v*g)+g;m.push.apply(m,t(e.slice(y,_),d,i,f,o,!1))}for(m.push("..."),v=l-ht;v<l;v++)_=(y=v*g)+g,m.push.apply(m,t(e.slice(y,_),d,i,f,o,v===l-1))}else for(v=0;v<l;v++){var y;_=(y=v*g)+g,m.push.apply(m,t(e.slice(y,_),d,i,f,o,v===l-1))}var b=2===u?",":"";for(m[0]="["+m[0]+b,v=1;v<m.length-1;v++)m[v]=" "+m[v]+b;var T=",\n";for(v=2;v<u;v++)T+="\n";return m[m.length-1]=" "+m[m.length-1]+"]"+(s?"":T),m}(t,e,n,r,o),l=["Tensor"];return i&&(l.push(" dtype: "+n),l.push(" rank: "+s),l.push(" shape: ["+e+"]"),l.push(" values:")),l.push(a.map(function(t){return" "+t}).join("\n")),l.join("\n")}(this.dataSync(),this.shape,this.dtype,t)},t.prototype.tile=function(t){return this.throwIfDisposed(),_t.tile(this,t)},t.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),_t.gather(this,t,e)},t.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),_t.matMul(this,t,e,n)},t.prototype.dot=function(t){return this.throwIfDisposed(),_t.dot(this,t)},t.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),_t.norm(this,t,e,n)},t.prototype.slice=function(t,e){return this.throwIfDisposed(),_t.slice(this,t,e)},t.prototype.reverse=function(t){return this.throwIfDisposed(),_t.reverse(this,t)},t.prototype.concat=function(e,n){return void 0===n&&(n=0),this.throwIfDisposed(),e instanceof t&&(e=[e]),_t.concat([this].concat(e),n)},t.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),_t.split(this,t,e)},t.prototype.stack=function(t,e){return void 0===e&&(e=0),_t.stack([this,t],e)},t.prototype.unstack=function(t){return void 0===t&&(t=0),_t.unstack(this,t)},t.prototype.pad=function(t,e){return void 0===e&&(e=0),_t.pad(this,t,e)},t.prototype.batchNormalization=function(t,e,n,i,r){return void 0===n&&(n=.001),yt("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,r,i,n)},t.prototype.batchNorm=function(t,e,n,i,r){return void 0===r&&(r=.001),this.throwIfDisposed(),_t.batchNorm(this,t,e,n,i,r)},t.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.all(this,t,e)},t.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.any(this,t,e)},t.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.logSumExp(this,t,e)},t.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.sum(this,t,e)},t.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.prod(this,t,e)},t.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.mean(this,t,e)},t.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.min(this,t,e)},t.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),_t.max(this,t,e)},t.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),_t.argMin(this,t)},t.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),_t.argMax(this,t)},t.prototype.cast=function(t){return this.throwIfDisposed(),_t.cast(this,t)},t.prototype.add=function(t){return this.throwIfDisposed(),_t.add(this,t)},t.prototype.addStrict=function(t){return this.throwIfDisposed(),_t.addStrict(this,t)},t.prototype.atan2=function(t){return this.throwIfDisposed(),_t.atan2(this,t)},t.prototype.sub=function(t){return this.throwIfDisposed(),_t.sub(this,t)},t.prototype.subStrict=function(t){return this.throwIfDisposed(),_t.subStrict(this,t)},t.prototype.pow=function(t){return this.throwIfDisposed(),_t.pow(this,t)},t.prototype.powStrict=function(t){return this.throwIfDisposed(),_t.powStrict(this,t)},t.prototype.mul=function(t){return this.throwIfDisposed(),_t.mul(this,t)},t.prototype.mulStrict=function(t){return this.throwIfDisposed(),_t.mulStrict(this,t)},t.prototype.div=function(t){return this.throwIfDisposed(),_t.div(this,t)},t.prototype.divNoNan=function(t){return this.throwIfDisposed(),_t.divNoNan(this,t)},t.prototype.floorDiv=function(t){return this.throwIfDisposed(),_t.floorDiv(this,t)},t.prototype.divStrict=function(t){return this.throwIfDisposed(),_t.divStrict(this,t)},t.prototype.minimum=function(t){return this.throwIfDisposed(),_t.minimum(this,t)},t.prototype.minimumStrict=function(t){return this.throwIfDisposed(),_t.minimumStrict(this,t)},t.prototype.maximum=function(t){return this.throwIfDisposed(),_t.maximum(this,t)},t.prototype.maximumStrict=function(t){return this.throwIfDisposed(),_t.maximumStrict(this,t)},t.prototype.mod=function(t){return this.throwIfDisposed(),_t.mod(this,t)},t.prototype.modStrict=function(t){return this.throwIfDisposed(),_t.modStrict(this,t)},t.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),_t.squaredDifferenceStrict(this,t)},t.prototype.transpose=function(t){return this.throwIfDisposed(),_t.transpose(this,t)},t.prototype.notEqual=function(t){return this.throwIfDisposed(),_t.notEqual(this,t)},t.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),_t.notEqualStrict(this,t)},t.prototype.less=function(t){return this.throwIfDisposed(),_t.less(this,t)},t.prototype.lessStrict=function(t){return this.throwIfDisposed(),_t.lessStrict(this,t)},t.prototype.equal=function(t){return this.throwIfDisposed(),_t.equal(this,t)},t.prototype.equalStrict=function(t){return this.throwIfDisposed(),_t.equalStrict(this,t)},t.prototype.lessEqual=function(t){return this.throwIfDisposed(),_t.lessEqual(this,t)},t.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),_t.lessEqualStrict(this,t)},t.prototype.greater=function(t){return this.throwIfDisposed(),_t.greater(this,t)},t.prototype.greaterStrict=function(t){return this.throwIfDisposed(),_t.greaterStrict(this,t)},t.prototype.greaterEqual=function(t){return this.throwIfDisposed(),_t.greaterEqual(this,t)},t.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),_t.greaterEqualStrict(this,t)},t.prototype.logicalAnd=function(t){return this.throwIfDisposed(),_t.logicalAnd(this,t)},t.prototype.logicalOr=function(t){return this.throwIfDisposed(),_t.logicalOr(this,t)},t.prototype.logicalNot=function(){return this.throwIfDisposed(),_t.logicalNot(this)},t.prototype.logicalXor=function(t){return this.throwIfDisposed(),_t.logicalXor(this,t)},t.prototype.where=function(t,e){return this.throwIfDisposed(),_t.where(t,this,e)},t.prototype.neg=function(){return this.throwIfDisposed(),_t.neg(this)},t.prototype.ceil=function(){return this.throwIfDisposed(),_t.ceil(this)},t.prototype.floor=function(){return this.throwIfDisposed(),_t.floor(this)},t.prototype.sign=function(){return this.throwIfDisposed(),_t.sign(this)},t.prototype.isNaN=function(){return this.throwIfDisposed(),_t.isNaN(this)},t.prototype.isInf=function(){return this.throwIfDisposed(),_t.isInf(this)},t.prototype.isFinite=function(){return this.throwIfDisposed(),_t.isFinite(this)},t.prototype.exp=function(){return this.throwIfDisposed(),_t.exp(this)},t.prototype.expm1=function(){return this.throwIfDisposed(),_t.expm1(this)},t.prototype.log=function(){return this.throwIfDisposed(),_t.log(this)},t.prototype.log1p=function(){return this.throwIfDisposed(),_t.log1p(this)},t.prototype.sqrt=function(){return this.throwIfDisposed(),_t.sqrt(this)},t.prototype.rsqrt=function(){return this.throwIfDisposed(),_t.rsqrt(this)},t.prototype.square=function(){return this.throwIfDisposed(),_t.square(this)},t.prototype.reciprocal=function(){return this.throwIfDisposed(),_t.reciprocal(this)},t.prototype.abs=function(){return this.throwIfDisposed(),_t.abs(this)},t.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),_t.clipByValue(this,t,e)},t.prototype.relu=function(){return this.throwIfDisposed(),_t.relu(this)},t.prototype.relu6=function(){return this.throwIfDisposed(),_t.relu6(this)},t.prototype.elu=function(){return this.throwIfDisposed(),_t.elu(this)},t.prototype.selu=function(){return this.throwIfDisposed(),_t.selu(this)},t.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),_t.leakyRelu(this,t)},t.prototype.prelu=function(t){return this.throwIfDisposed(),_t.prelu(this,t)},t.prototype.sigmoid=function(){return this.throwIfDisposed(),_t.sigmoid(this)},t.prototype.logSigmoid=function(){return this.throwIfDisposed(),_t.logSigmoid(this)},t.prototype.softplus=function(){return this.throwIfDisposed(),_t.softplus(this)},t.prototype.zerosLike=function(){return this.throwIfDisposed(),_t.zerosLike(this)},t.prototype.onesLike=function(){return this.throwIfDisposed(),_t.onesLike(this)},t.prototype.sin=function(){return this.throwIfDisposed(),_t.sin(this)},t.prototype.cos=function(){return this.throwIfDisposed(),_t.cos(this)},t.prototype.tan=function(){return this.throwIfDisposed(),_t.tan(this)},t.prototype.asin=function(){return this.throwIfDisposed(),_t.asin(this)},t.prototype.acos=function(){return this.throwIfDisposed(),_t.acos(this)},t.prototype.atan=function(){return this.throwIfDisposed(),_t.atan(this)},t.prototype.sinh=function(){return this.throwIfDisposed(),_t.sinh(this)},t.prototype.cosh=function(){return this.throwIfDisposed(),_t.cosh(this)},t.prototype.tanh=function(){return this.throwIfDisposed(),_t.tanh(this)},t.prototype.asinh=function(){return this.throwIfDisposed(),_t.asinh(this)},t.prototype.acosh=function(){return this.throwIfDisposed(),_t.acosh(this)},t.prototype.atanh=function(){return this.throwIfDisposed(),_t.atanh(this)},t.prototype.erf=function(){return this.throwIfDisposed(),_t.erf(this)},t.prototype.round=function(){return this.throwIfDisposed(),_t.round(this)},t.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),_t.step(this,t)},t.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),_t.softmax(this,t)},t.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),_t.logSoftmax(this,t)},t.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),_t.image.resizeBilinear(this,t,e)},t.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),_t.image.resizeNearestNeighbor(this,t,e)},t.prototype.conv1d=function(t,e,n,i,r,o){return void 0===i&&(i="NWC"),void 0===r&&(r=1),this.throwIfDisposed(),_t.conv1d(this,t,e,n,i,r,o)},t.prototype.conv2d=function(t,e,n,i,r,o){return void 0===i&&(i="NHWC"),void 0===r&&(r=[1,1]),this.throwIfDisposed(),_t.conv2d(this,t,e,n,i,r,o)},t.prototype.conv2dTranspose=function(t,e,n,i,r){return this.throwIfDisposed(),_t.conv2dTranspose(this,t,e,n,i,r)},t.prototype.depthwiseConv2D=function(t,e,n,i,r,o){return void 0===i&&(i="NHWC"),void 0===r&&(r=[1,1]),this.throwIfDisposed(),_t.depthwiseConv2d(this,t,e,n,i,r,o)},t.prototype.separableConv2d=function(t,e,n,i,r,o){return void 0===r&&(r=[1,1]),void 0===o&&(o="NHWC"),this.throwIfDisposed(),_t.separableConv2d(this,t,e,n,i,r,o)},t.prototype.avgPool=function(t,e,n,i){return this.throwIfDisposed(),_t.avgPool(this,t,e,n,i)},t.prototype.maxPool=function(t,e,n,i){return this.throwIfDisposed(),_t.maxPool(this,t,e,n,i)},t.prototype.localResponseNormalization=function(t,e,n,i){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=.5),_t.localResponseNormalization(this,t,e,n,i)},t.prototype.pool=function(t,e,n,i,r){return this.throwIfDisposed(),_t.pool(this,t,e,n,i,r)},t.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),vt().makeVariable(this,t,e,n)},t.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),_t.unsortedSegmentSum(this,t,e)},t.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),_t.batchToSpaceND(this,t,e)},t.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),_t.spaceToBatchND(this,t,e)},t.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),_t.topk(this,t,e)},t.prototype.stridedSlice=function(t,e,n,i,r,o,s,a){return void 0===i&&(i=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),this.throwIfDisposed(),_t.stridedSlice(this,t,e,n,i,r,o,s,a)},t.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),_t.depthToSpace(this,t,e)},t.prototype.fft=function(){return this.throwIfDisposed(),_t.spectral.fft(this)},t.prototype.ifft=function(){return this.throwIfDisposed(),_t.spectral.ifft(this)},t.prototype.rfft=function(){return this.throwIfDisposed(),_t.spectral.rfft(this)},t.prototype.irfft=function(){return this.throwIfDisposed(),_t.spectral.irfft(this)},t}();Object.defineProperty(bt,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var Tt,Et,Ct,St,wt,kt=function(t){function e(e,n,i,r){var o=t.call(this,e.shape,e.dtype,e.dataId,r)||this;return o.trainable=n,o.name=i,o}return s(e,t),e.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!I(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");vt().disposeTensor(this),this.dataId=t.dataId,vt().incRef(this,null)},e.prototype.dispose=function(){vt().disposeVariable(this),this.isDisposedInternal=!0},e}(bt);Object.defineProperty(kt,Symbol.hasInstance,{value:function(t){return t instanceof bt&&null!=t.assign&&t.assign instanceof Function}}),function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"}(Tt||(Tt={})),function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"}(Et||(Et={})),function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"}(Ct||(Ct={})),function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"}(St||(St={})),function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"}(wt||(wt={}));var xt={float32:St,int32:Et,bool:Ct,complex64:wt};function It(t,e){if("string"===t||"string"===e){if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}return xt[t][e]}function Rt(t){return It(t,"int32")}function Ot(t,e){if(t.dtype===e.dtype)return[t,e];var n=It(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function Dt(t,e){C(t.dtype===e.dtype,function(){return"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match"})}function At(t){var e=[];return function t(e,n,i){if(null!=e)if(e instanceof bt)n.push(e);else if(r=e,Array.isArray(r)||"object"==typeof r){var r,o=e;for(var s in o){var a=o[s];i.has(a)||(i.add(a),t(a,n,i))}}}(t,e,new Set),e}Object.freeze({makeTypesMatch:Ot,assertTypesMatch:Dt,isTensorInList:function(t,e){return e.some(function(e){return e.id===t.id})},getTensorsInContainer:At});var Mt,Nt=function(){function t(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null}}return t.prototype.dispose=function(){for(var t in this.registeredVariables)this.registeredVariables[t].dispose()},t}(),Lt=function(){function t(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Nt}return t.prototype.ready=function(){return a(this,void 0,void 0,function(){var t,e,n;return l(this,function(i){switch(i.label){case 0:if(null!=this.pendingBackendInit)return[2,this.pendingBackendInit.then(function(){})];if(null!=this.backendInstance)return[2];t=this.getSortedBackends(),e=0,i.label=1;case 1:return e<t.length?(n=t[e],[4,this.initializeBackend(n).success]):[3,5];case 2:return i.sent()?[4,this.setBackend(n)]:[3,4];case 3:return i.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}})})},Object.defineProperty(t.prototype,"backend",{get:function(){if(null!=this.pendingBackendInit)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(null==this.backendInstance){var t=this.initializeBackendsAndReturnBest(),e=t.name;if(t.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),t.prototype.backendNames=function(){return Object.keys(this.registryFactory)},t.prototype.findBackend=function(t){if(!(t in this.registry)){if(!(t in this.registryFactory))return null;if(this.initializeBackend(t).asyncInit)return null}return this.registry[t]},t.prototype.findBackendFactory=function(t){return t in this.registryFactory?this.registryFactory[t].factory:null},t.prototype.registerBackend=function(t,e,n){return void 0===n&&(n=1),t in this.registryFactory?(console.warn(t+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[t]={factory:e,priority:n},!0)},t.prototype.setBackend=function(t){return a(this,void 0,void 0,function(){var e,n,i;return l(this,function(r){switch(r.label){case 0:if(null==this.registryFactory[t])throw new Error("Backend name '"+t+"' not found in registry");return this.backendName=t,null!=this.registry[t]?[3,4]:(this.backendInstance=null,e=this.initializeBackend(t),n=e.success,e.asyncInit?[4,n]:[3,2]);case 1:return i=r.sent(),[3,3];case 2:i=n,r.label=3;case 3:if(!i)return[2,!1];r.label=4;case 4:return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new lt(this.backendInstance),[2,!0]}})})},t.prototype.setupRegisteredKernels=function(){var t=this;g(this.backendName).forEach(function(e){null!=e.setupFunc&&e.setupFunc(t.backendInstance)})},t.prototype.disposeRegisteredKernels=function(t){var e=this;g(t).forEach(function(n){null!=n.disposeFunc&&n.disposeFunc(e.registry[t])})},t.prototype.initializeBackend=function(t){var e=this,n=this.registryFactory[t];if(null==n)throw new Error("Cannot initialize backend "+t+", no registration found.");try{var i=n.factory();if(Promise.resolve(i)===i){var r=++this.pendingBackendInitId,o=i.then(function(n){return!(r<e.pendingBackendInitId||(e.registry[t]=n,e.pendingBackendInit=null,0))}).catch(function(n){return!(r<e.pendingBackendInitId||(e.pendingBackendInit=null,console.warn("Initialization of backend "+t+" failed"),console.warn(n.stack||n.message),1))});return this.pendingBackendInit=o,{success:o,asyncInit:!0}}return this.registry[t]=i,{success:!0,asyncInit:!1}}catch(e){return console.warn("Initialization of backend "+t+" failed"),console.warn(e.stack||e.message),{success:!1,asyncInit:!1}}},t.prototype.removeBackend=function(t){if(!(t in this.registryFactory))throw new Error(t+" backend not found in registry");this.backendName===t&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,t in this.registry&&(this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},t.prototype.getSortedBackends=function(){var t=this;if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort(function(e,n){return t.registryFactory[n].priority-t.registryFactory[e].priority})},t.prototype.initializeBackendsAndReturnBest=function(){for(var t=this.getSortedBackends(),e=0;e<t.length;e++){var n=t[e],i=this.initializeBackend(n),r=i.success,o=i.asyncInit;if(o||r)return{name:n,asyncInit:o}}throw new Error("Could not initialize any backends, all backend initializations failed.")},t.prototype.moveData=function(t,e){var n=this.state.tensorInfo.get(e),i=n.backend,r=this.readSync(e);i.disposeData(e),n.backend=t,t.move(e,r,n.shape,n.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},t.prototype.tidy=function(t,e){var n,i=this,r=null;if(null==e){if("function"!=typeof t)throw new Error("Please provide a function to tidy()");e=t}else{if("string"!=typeof t&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof e)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");r=t}return this.scopedRun(function(){return i.startScope(r)},function(){return i.endScope(n)},function(){return(n=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n})},t.prototype.scopedRun=function(t,e,n){t();try{var i=n();return e(),i}catch(t){throw e(),t}},t.prototype.nextTensorId=function(){return t.nextTensorId++},t.prototype.nextVariableId=function(){return t.nextVariableId++},t.prototype.clone=function(t){var e=this.makeTensorFromDataId(t.dataId,t.shape,t.dtype),n={x:t};return this.addTapeNode(this.state.activeScope.name,n,[e],function(t){return{x:function(){return t.toFloat()}}},[]),e},t.prototype.runKernel=function(t,e,n,i,r){return this.runKernelFunc(null,e,null,t,n,i,r)},t.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},t.prototype.checkKernelForMemLeak=function(t,e,n){var i=this.backend.numDataIds(),r=0;n.forEach(function(t){r+="complex64"===t.dtype?3:1});var o=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=i-e-r-o;if(s>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+s+" data ids) after running '"+t+"'")},t.prototype.runKernelFunc=function(t,e,n,i,r,o,s){var a,l=this;void 0===o&&(o=[]),void 0===s&&(s=[]);var u=[],c=this.isTapeOn();null==i&&(i=null!=this.state.activeScope?this.state.activeScope.name:"");var h,p=function(t){c&&(u=t.map(function(t){return l.keep(l.clone(t))}))},d=this.state.numBytes,g=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var m,v=f(i,this.backendName);return h=null!=v?function(){var t=l.backend.numDataIds();m=v.kernelFunc({inputs:e,attrs:r,backend:l.backend});var n=Array.isArray(m)?m:[m];l.shouldCheckForMemLeaks()&&l.checkKernelForMemLeak(i,t,n);var a=n.map(function(t){var e=t.dataId,n=t.shape,i=t.dtype;return l.makeTensorFromDataId(e,n,i)}),u=a.filter(function(t,e){return s[e]});return p((o||[]).slice().concat(u)),a}:function(){var e=l.backend.numDataIds();m=l.tidy(function(){return t(l.backend,p)});var n=Array.isArray(m)?m:[m];return l.shouldCheckForMemLeaks()&&l.checkKernelForMemLeak(i,e,n),n},this.scopedRun(function(){return l.state.kernelDepth++},function(){return l.state.kernelDepth--},function(){a=l.ENV.getBool("DEBUG")?l.profiler.profileKernel(i,e,function(){return h()}):h()}),c&&this.addTapeNode(i,e,a,n,u),this.state.profiling&&this.state.activeProfile.kernels.push({name:i,bytesAdded:this.state.numBytes-d,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-g,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map(function(t){return e[t].shape}),outputShapes:a.map(function(t){return t.shape})}),Array.isArray(m)?a:a[0]},t.prototype.makeTensor=function(t,e,n,i){if(null==t)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",i=i||this.backend;var r=t;"string"===n&&z(t[0])&&(r=t.map(function(t){return rt(t)}));var o=i.write(r,e,n),s=new bt(e,n,o,this.nextTensorId());if(this.incRef(s,i),"string"===n){var a=this.state.tensorInfo.get(o),l=j(r);this.state.numBytes+=l-a.bytes,a.bytes=l}return s},t.prototype.makeTensorFromDataId=function(t,e,n,i){var r=new bt(e,n=n||"float32",t,this.nextTensorId());return this.incRef(r,i),r},t.prototype.makeVariable=function(t,e,n,i){void 0===e&&(e=!0),n=n||this.nextVariableId().toString(),null!=i&&i!==t.dtype&&(t=t.asType(i));var r=new kt(t,e,n,this.nextTensorId());if(null!=this.state.registeredVariables[r.name])throw new Error("Variable with name "+r.name+" was already registered");return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r},t.prototype.incRef=function(t,e){var n=this.state.tensorInfo.has(t.dataId)?this.state.tensorInfo.get(t.dataId).refCount:0;if(this.state.numTensors++,"string"===t.dtype&&this.state.numStringTensors++,0===n){this.state.numDataBuffers++;var i=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(i=t.size*G(t.dtype)),this.state.tensorInfo.set(t.dataId,{backend:e||this.backend,dtype:t.dtype,shape:t.shape,bytes:i,refCount:0}),this.state.numBytes+=i}this.state.tensorInfo.get(t.dataId).refCount++,t instanceof kt||this.track(t)},t.prototype.disposeTensor=function(t){if(this.state.tensorInfo.has(t.dataId)){this.state.numTensors--,"string"===t.dtype&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(t.dataId);e.refCount<=1?("complex64"!==t.dtype&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(t.dataId),this.state.tensorInfo.delete(t.dataId)):this.state.tensorInfo.get(t.dataId).refCount--}},t.prototype.disposeVariables=function(){for(var t in this.state.registeredVariables){var e=this.state.registeredVariables[t];this.disposeVariable(e)}},t.prototype.disposeVariable=function(t){this.disposeTensor(t),null!=this.state.registeredVariables[t.name]&&delete this.state.registeredVariables[t.name]},t.prototype.memory=function(){var t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,null==t.reasons&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t},t.prototype.profile=function(t){return a(this,void 0,void 0,function(){var e,n;return l(this,function(i){return this.state.profiling=!0,e=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map(function(t){return t.totalBytesSnapshot})),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n,[2,this.state.activeProfile]})})},t.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth},t.prototype.addTapeNode=function(t,e,n,i,r){var o=this,s={id:this.state.nextTapeNodeId++,kernelName:t,inputs:e,outputs:n,saved:r},a=function(t){return d.get(t)}(t);null!=a&&(i=a.gradFunc),null!=i&&(s.gradient=function(t){return t=t.map(function(t,e){if(null==t){var i=n[e],r=et(i.size,i.dtype);return o.makeTensor(r,i.shape,i.dtype)}return t}),i(t.length>1?t:t[0],r)}),this.state.activeTape.push(s)},t.prototype.keep=function(t){return t.kept=!0,t},t.prototype.startTape=function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++},t.prototype.endTape=function(){this.state.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=At(t),i=new Set(n.map(function(t){return t.id})),r=0;r<this.state.activeScope.track.length;r++){var o=this.state.activeScope.track[r];o.kept||i.has(o.id)||o.dispose()}var s=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach(function(t){t.kept||t.scopeId!==s.id||e.track(t)})},t.prototype.gradients=function(t,e,n,i){var r=this;if(void 0===i&&(i=!1),C(e.length>0,function(){return"gradients() received an empty list of xs."}),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '"+n.dtype+"'");var o=this.scopedRun(function(){return r.startTape()},function(){return r.endTape()},function(){return r.tidy("forward",t)});C(o instanceof bt,function(){return"The result y returned by f() must be a tensor."});var s=function(t,e,n){for(var i={},r={},o=0;o<e.length;o++)i[e[o].id]=!0;for(o=0;o<t.length;o++){var s=(f=t[o]).inputs;for(var a in s){for(var l=s[a],u=!1,c=0;c<e.length;c++)if(i[l.id]){f.outputs.forEach(function(t){return i[t.id]=!0}),u=!0,r[f.id]=!0;break}if(u)break}}var h={};h[n.id]=!0;var p={};for(o=t.length-1;o>=0;o--)for(s=(f=t[o]).inputs,c=0;c<f.outputs.length;c++)if(h[f.outputs[c].id]){for(var a in s)h[s[a].id]=!0,p[f.id]=!0;break}var d=[];for(o=0;o<t.length;o++){var f;if(r[(f=t[o]).id]&&p[f.id]){var g={};for(var a in f.inputs){var m=f.inputs[a];i[m.id]&&(g[a]=m)}var v=Object.assign({},f);v.inputs=g,v.outputs=f.outputs,d.push(v)}}return d}(this.state.activeTape,e,o);if(!i&&0===s.length&&e.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",function(){var t,i,a={};a[o.id]=null==n?(i=tt(x(t=o.shape),"float32"),Pt.makeTensor(i,t,"float32")):n,function(t,e,n){for(var i=function(i){var r=e[i],o=[];if(r.outputs.forEach(function(e){var n=t[e.id];null!=n?o.push(n):o.push(null)}),null==r.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+r.kernelName+".");var s=r.gradient(o),a=function(e){if(!(e in s))throw new Error("Cannot backprop through input "+e+". Available gradients found: "+Object.keys(s)+".");var i=n(function(){return s[e]()});if("float32"!==i.dtype)throw new Error("Error in gradient for op "+r.kernelName+". The gradient of input "+e+" must have 'float32' dtype, but has '"+i.dtype+"'");var o=r.inputs[e];if(!I(i.shape,o.shape))throw new Error("Error in gradient for op "+r.kernelName+". The gradient of input '"+e+"' has shape '"+i.shape+"', which does not match the shape of the input '"+o.shape+"'");if(null==t[o.id])t[o.id]=i;else{var a=t[o.id];t[o.id]=a.add(i),a.dispose()}};for(var l in r.inputs)a(l)},r=e.length-1;r>=0;r--)i(r)}(a,s,function(t){return r.tidy(t)});var l=e.map(function(t){return a[t.id]});return 0===r.state.gradientDepth&&(r.state.activeTape.forEach(function(t){for(var e=0,n=t.saved;e<n.length;e++)n[e].dispose()}),r.state.activeTape=null),{value:o,grads:l}})},t.prototype.customGrad=function(t){var e=this;return C(K(t),function(){return"The f passed in customGrad(f) must be a function."}),function(){for(var n,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];C(i.every(function(t){return t instanceof bt}),function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"});var o={};return i.forEach(function(t,e){o[e]=t}),e.runKernelFunc(function(e,r){return C((n=t.apply(void 0,i.concat([r]))).value instanceof bt,function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"}),C(K(n.gradFunc),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."}),n.value},o,function(t,e){var r=n.gradFunc(t,e),o=Array.isArray(r)?r:[r];C(o.length===i.length,function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."}),C(o.every(function(t){return t instanceof bt}),function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."});var s={};return o.forEach(function(t,e){s[e]=function(){return t}}),s})}},t.prototype.readSync=function(t){return this.state.tensorInfo.get(t).backend.readSync(t)},t.prototype.read=function(t){return this.state.tensorInfo.get(t).backend.read(t)},t.prototype.time=function(t){return a(this,void 0,void 0,function(){var e,n;return l(this,function(i){switch(i.label){case 0:return e=nt(),[4,this.backend.time(t)];case 1:return(n=i.sent()).wallMs=nt()-e,[2,n]}})})},t.prototype.track=function(t){return null!=this.state.activeScope&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t},Object.defineProperty(t.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),t.prototype.reset=function(){for(var t in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Nt,this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},t.nextTensorId=0,t.nextVariableId=0,t}(),Pt=function(){var e=function(){if(null==Mt){var e=void 0;if("undefined"!=typeof window)e=window;else if(void 0!==t)e=t;else if(void 0!==i)e=i;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}Mt=e}return Mt}();if(null==e._tfengine){var n=new u(e);e._tfengine=new Lt(n)}return function(t){h=t}(e._tfengine.ENV),vt=function(){return e._tfengine},e._tfengine}();function Bt(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}var Ft=c();Ft.registerFlag("DEBUG",function(){return!1},function(t){t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),Ft.registerFlag("IS_BROWSER",function(){return Bt()}),Ft.registerFlag("IS_NODE",function(){return void 0!==i&&void 0!==i.versions&&void 0!==i.versions.node}),Ft.registerFlag("IS_CHROME",function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}),Ft.registerFlag("PROD",function(){return!1}),Ft.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",function(){return Ft.getBool("DEBUG")}),Ft.registerFlag("DEPRECATION_WARNINGS_ENABLED",function(){return!0}),Ft.registerFlag("IS_TEST",function(){return!1});var Ut,Vt,Ht,Wt={},Gt={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function jt(t,e){Wt[t]=e}function zt(t){t in Wt||(Wt[t]=function(t){if(1!==t&&2!==t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var e=function(t){if("undefined"!=typeof OffscreenCanvas&&2===t)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(t);return e.addEventListener("webglcontextlost",function(e){e.preventDefault(),delete Wt[t]},!1),1===t?e.getContext("webgl",Gt)||e.getContext("experimental-webgl",Gt):e.getContext("webgl2",Gt)}(t));var e=Wt[t];return e.isContextLost()?(delete Wt[t],zt(t)):(e.disable(e.DEPTH_TEST),e.disable(e.STENCIL_TEST),e.disable(e.BLEND),e.disable(e.DITHER),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SAMPLE_COVERAGE),e.enable(e.SCISSOR_TEST),e.enable(e.CULL_FACE),e.cullFace(e.BACK),Wt[t])}function $t(t,e){return[e,t]}function Xt(t){var e=x(t);return D(Math.ceil(e/4))}function Yt(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}function Kt(t,e){var n,i,r,o,s,a,l,u,h,p=t;return 2===c().getNumber("WEBGL_VERSION")?(n=p.R32F,i=p.R16F,r=p.RGBA16F,o=p.RGBA32F,s=p.RED,a=4,l=1,u=p.HALF_FLOAT,h=p.FLOAT):(n=t.RGBA,i=t.RGBA,r=t.RGBA,o=p.RGBA,s=t.RGBA,a=4,l=4,u=null!=e?e.HALF_FLOAT_OES:null,h=t.FLOAT),{internalFormatFloat:n,internalFormatHalfFloat:i,internalFormatPackedHalfFloat:r,internalFormatPackedFloat:o,textureFormatFloat:s,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:a,defaultNumChannels:l,textureTypeHalfFloat:u,textureTypeFloat:h}}function Jt(t,e,n){var i=n();return e&&function(t){var e=t.getError();if(e!==t.NO_ERROR)throw new Error("WebGL Error: "+te(t,e))}(t),i}!function(t){t[t.DENSE=0]="DENSE",t[t.SHARED_BATCH=1]="SHARED_BATCH"}(Ut||(Ut={})),function(t){t[t.RENDER=0]="RENDER",t[t.UPLOAD=1]="UPLOAD",t[t.PIXELS=2]="PIXELS",t[t.DOWNLOAD=3]="DOWNLOAD"}(Vt||(Vt={})),function(t){t[t.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",t[t.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",t[t.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",t[t.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",t[t.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Ht||(Ht={}));var qt=5.96e-8,Zt=65504;function Qt(t){return!!(c().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===t||qt<Math.abs(t)&&Math.abs(t)<Zt)}function te(t,e){switch(e){case t.NO_ERROR:return"NO_ERROR";case t.INVALID_ENUM:return"INVALID_ENUM";case t.INVALID_VALUE:return"INVALID_VALUE";case t.INVALID_OPERATION:return"INVALID_OPERATION";case t.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case t.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case t.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+e}}function ee(t,e,n){return Se(t,e,function(){return t.getExtension(n)},'Extension "'+n+'" not supported on this browser.')}function ne(t,e,n){var i=Se(t,e,function(){return t.createShader(t.VERTEX_SHADER)},"Unable to create vertex WebGLShader.");if(Jt(t,e,function(){return t.shaderSource(i,n)}),Jt(t,e,function(){return t.compileShader(i)}),!1===t.getShaderParameter(i,t.COMPILE_STATUS))throw console.log(t.getShaderInfoLog(i)),new Error("Failed to compile vertex shader.");return i}function ie(t,e,n){var i=Se(t,e,function(){return t.createShader(t.FRAGMENT_SHADER)},"Unable to create fragment WebGLShader.");if(Jt(t,e,function(){return t.shaderSource(i,n)}),Jt(t,e,function(){return t.compileShader(i)}),!1===t.getShaderParameter(i,t.COMPILE_STATUS))throw function(t,e){var n=se.exec(e);if(null==n)return console.log("Couldn't parse line number in error: "+e),void console.log(t);for(var i=+n[1],r=t.split("\n"),o=r.length.toString().length+2,s=r.map(function(t,e){return A((e+1).toString(),o)+t}),a=0,l=0;l<s.length;l++)a=Math.max(s[l].length,a);var u=s.slice(0,i-1),c=s.slice(i-1,i),h=s.slice(i);console.log(u.join("\n")),console.log(e.split("\n")[0]),console.log("%c "+A(c[0],a),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(h.join("\n"))}(n,t.getShaderInfoLog(i)),new Error("Failed to compile fragment shader.");return i}var re,oe,se=/ERROR: [0-9]+:([0-9]+):/g;function ae(t,e){return Se(t,e,function(){return t.createProgram()},"Unable to create WebGLProgram.")}function le(t,e,n){if(Jt(t,e,function(){return t.linkProgram(n)}),!1===t.getProgramParameter(n,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Failed to link vertex and fragment shaders.")}function ue(t,e,n){if(Jt(t,e,function(){return t.validateProgram(n)}),!1===t.getProgramParameter(n,t.VALIDATE_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Shader program validation failed.")}function ce(t,e,n){var i=Se(t,e,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return Jt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,i)}),Jt(t,e,function(){return t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)}),i}function he(t,e,n){var i=Se(t,e,function(){return t.createBuffer()},"Unable to create WebGLBuffer");return Jt(t,e,function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i)}),Jt(t,e,function(){return t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW)}),i}function pe(t,e){return Se(t,e,function(){return t.createTexture()},"Unable to create WebGLTexture.")}function de(t,e){var n=c().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(t<=0||e<=0){var i="["+t+"x"+e+"]";throw new Error("Requested texture size "+i+" is invalid.")}if(t>n||e>n)throw i="["+t+"x"+e+"]",new Error("Requested texture size "+i+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function fe(t,e){return Se(t,e,function(){return t.createFramebuffer()},"Unable to create WebGLFramebuffer.")}function ge(t,e,n,i,r,o,s,a){var l=t.getAttribLocation(n,i);return-1!==l&&(Jt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,r)}),Jt(t,e,function(){return t.vertexAttribPointer(l,o,t.FLOAT,!1,s,a)}),Jt(t,e,function(){return t.enableVertexAttribArray(l)}),!0)}function me(t,e,n,i){we(t,i),Jt(t,e,function(){return t.activeTexture(t.TEXTURE0+i)}),Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)})}function ve(t,e,n,i){return Se(t,e,function(){return t.getUniformLocation(n,i)},'uniform "'+i+'" not present in program.')}function _e(t,e,n){return t.getUniformLocation(e,n)}function ye(t,e,n,i,r,o){Jt(t,e,function(){return me(t,e,i,o)}),Jt(t,e,function(){return t.uniform1i(r,o)})}function be(t,e,n,i){Jt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,i)}),Jt(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)})}function Te(t,e,n){Jt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)}),Jt(t,e,function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)})}function Ee(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+Ce(t,e))}function Ce(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case t.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+e}}function Se(t,e,n,i){var r=Jt(t,e,function(){return n()});if(null==r)throw new Error(i);return r}function we(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,i=e+t.TEXTURE0;if(i<t.TEXTURE0||i>n)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function ke(t,e){return void 0===e&&(e=2),x(t.slice(0,t.length-e))}function xe(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]}function Ie(t){var e=[1,1,1];return 0===t.length||1===t.length&&1===t[0]||(e=[ke(t)].concat(xe(t))),e}function Re(t,e){var n;void 0===e&&(e=!1);var i=c().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e&&(i*=2,1===(t=t.map(function(e,n){return n>=t.length-2?T(t[n]):t[n]})).length&&(t=[2,t[0]])),2!==t.length){var r=P(t);t=r.newShape}var o=x(t);if(t.length<=1&&o<=i)return[1,o];if(2===t.length&&t[0]<=i&&t[1]<=i)return t;if(3===t.length&&t[0]*t[1]<=i&&t[2]<=i)return[t[0]*t[1],t[2]];if(3===t.length&&t[0]<=i&&t[1]*t[2]<=i)return[t[0],t[1]*t[2]];if(4===t.length&&t[0]*t[1]*t[2]<=i&&t[3]<=i)return[t[0]*t[1]*t[2],t[3]];if(4===t.length&&t[0]<=i&&t[1]*t[2]*t[3]<=i)return[t[0],t[1]*t[2]*t[3]];if(e){var s=ke(t),a=2,l=2;return t.length&&(a=(n=xe(t))[0],l=n[1]),D(o=s*(a/2)*(l/2)).map(function(t){return 2*t})}return D(o)}function Oe(t){return t%2==0}function De(t,e){if(I(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],i=e.slice(-1)[0];if(n===i)return!0;if(Oe(n)&&Oe(i)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&Oe(t[0])&&Oe(e[0])}function Ae(t){if(null==re){var e=zt(t);re=e.getParameter(e.MAX_TEXTURE_SIZE)}return re}function Me(t){if(null==oe){var e=zt(t);oe=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,oe)}function Ne(t){if(0===t)return 0;var e=zt(t);return Le(e,"EXT_disjoint_timer_query_webgl2")&&2===t?2:Le(e,"EXT_disjoint_timer_query")?1:0}function Le(t,e){return null!=t.getExtension(e)}function Pe(t){try{if(null!=zt(t))return!0}catch(t){return!1}return!1}function Be(t){if(0===t)return!1;var e=zt(t);if(1===t){if(!Le(e,"OES_texture_float"))return!1}else if(!Le(e,"EXT_color_buffer_float"))return!1;return Ue(e)}function Fe(t){if(0===t)return!1;var e=zt(t);return 1!==t?Le(e,"EXT_color_buffer_float")?Ue(e):!!Le(e,"EXT_color_buffer_half_float")&&function(t,e){var n=Kt(t,e),i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,n.internalFormatHalfFloat,1,1,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(i),t.deleteFramebuffer(r),o}(e,e.getExtension("EXT_color_buffer_half_float")):!!Le(e,"OES_texture_float")&&!!Le(e,"WEBGL_color_buffer_float")&&Ue(e)}function Ue(t){var e=Kt(t),n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,e.internalFormatFloat,1,1,0,e.textureFormatFloat,e.textureTypeFloat,null);var i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var r=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(n),t.deleteFramebuffer(i),r}function Ve(t){return 2===t&&null!=zt(t).fenceSync}var He=Object.freeze({callAndCheck:Jt,canBeRepresented:Qt,getWebGLErrorMessage:te,getExtensionOrThrow:ee,createVertexShader:ne,createFragmentShader:ie,createProgram:ae,linkProgram:le,validateProgram:ue,createStaticVertexBuffer:ce,createStaticIndexBuffer:he,getNumChannels:function(){return 2===c().getNumber("WEBGL_VERSION")?1:4},createTexture:pe,validateTextureSize:de,createFramebuffer:fe,bindVertexBufferToProgramAttribute:ge,bindTextureUnit:me,unbindTextureUnit:function(t,e,n){we(t,n),Jt(t,e,function(){return t.activeTexture(t.TEXTURE0+n)}),Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})},getProgramUniformLocationOrThrow:ve,getProgramUniformLocation:_e,bindTextureToProgramUniformSampler:ye,bindCanvasToFramebuffer:function(t,e){Jt(t,e,function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)}),Jt(t,e,function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)}),Jt(t,e,function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)})},bindColorTextureToFramebuffer:be,unbindColorTextureFromFramebuffer:Te,validateFramebuffer:Ee,getFramebufferErrorMessage:Ce,getBatchDim:ke,getRowsCols:xe,getShapeAs3D:Ie,getTextureShapeFromLogicalShape:Re,isReshapeFree:De,getWebGLMaxTextureSize:Ae,resetMaxTextureSize:function(){re=null},resetMaxTexturesInShader:function(){oe=null},getMaxTexturesInShader:Me,getWebGLDisjointQueryTimerVersion:Ne,hasExtension:Le,isWebGLVersionEnabled:Pe,isCapableOfRenderingToFloatTexture:Be,isDownloadFloatTextureEnabled:Fe,isWebGLFenceEnabled:Ve}),We=c();function Ge(t){c().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function je(t,e){return Pt.tidy(t,e)}function ze(t){At(t).forEach(function(t){return t.dispose()})}function $e(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];c().getBool("IS_TEST")||console.warn.apply(console,t)}function Xe(t,e){var n=t;if(W(t))return"string"===e?[]:[t.length];if(!Array.isArray(t))return[];for(var i=[];Array.isArray(n)||W(n)&&"string"!==e;)i.push(n.length),n=n[0];return Array.isArray(t)&&c().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function t(e,n,i){if(i=i||[],Array.isArray(e)||W(e)){C(n.length>0,function(){return"Element arr["+i.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"}),C(e.length===n[0],function(){return"Element arr["+i.join("][")+"] should have "+n[0]+" elements, but has "+e.length+" elements"});for(var r=n.slice(1),o=0;o<e.length;++o)t(e[o],r,i.concat(o))}else C(0===n.length,function(){return"Element arr["+i.join("][")+"] is a primitive, but should be an array/TypedArray of "+n[0]+" elements"})}(t,i,[]),i}function Ye(t,e,n,i){if(null!=t&&("numeric"!==t&&t!==e||"numeric"===t&&"string"===e))throw new Error("Argument '"+n+"' passed to '"+i+"' must be "+t+" tensor, but got "+e+" tensor")}function Ke(t,e,n,i){if(void 0===i&&(i="numeric"),t instanceof bt)return Ye(i,t.dtype,e,n),t;var r=Y(t);if("string"!==r&&["bool","int32","float32"].indexOf(i)>=0&&(r=i),Ye(i,r,e,n),null==t||!W(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t){var o=null==t?"null":t.constructor.name;throw new Error("Argument '"+e+"' passed to '"+n+"' must be a Tensor or TensorLike, but got '"+o+"'")}var s=Xe(t,r);W(t)||Array.isArray(t)||(t=[t]);var a="string"!==r?Z(t,r,c().getBool("DEBUG")):k(t,[],!0);return Pt.makeTensor(a,s,r)}function Je(t,e,n,i){if(void 0===i&&(i="numeric"),!Array.isArray(t))throw new Error("Argument "+e+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return t.map(function(t,i){return Ke(t,e+"["+i+"]",n)},i)}function qe(t,e){for(var n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function Ze(t,e,n){for(var i=t.length+e.length,r=[],o=0,s=0,a=0;a<i;a++)-1===n.indexOf(a)?r.push(t[o++]):r.push(e[s++]);return r}function Qe(t,e){for(var n=[],i=t.length,r=0;r<i;r++)-1===e.indexOf(r)&&n.push(t[r]);return[n,e.map(function(e){return t[e]})]}function tn(t,e){return Ze(t,e.map(function(t){return 1}),e)}function en(t,e,n){C(qe(e,n),function(){return t+" supports only inner-most axes for now. Got axes "+e+" and rank-"+n+" input."})}function nn(t,e){if(qe(t,e))return null;for(var n=[],i=0;i<e;++i)-1===t.indexOf(i)&&n.push(i);return t.forEach(function(t){return n.push(t)}),n}function rn(t){return t.map(function(t,e){return[e,t]}).sort(function(t,e){return t[1]-e[1]}).map(function(t){return t[0]})}function on(t,e){for(var n=[],i=e-t;i<e;++i)n.push(i);return n}function sn(t,e){var n=t[0].length;t.forEach(function(t,e){C(t.length===n,function(){return"Error in concat"+n+"D: rank of tensors["+e+"] must be the same as the rank of the rest ("+n+")"})}),C(e>=0&&e<n,function(){return"Error in concat"+n+"D: axis must be between 0 and "+(n-1)+"."});var i=t[0];t.forEach(function(t,r){for(var o=0;o<n;o++)C(o===e||t[o]===i[o],function(){return"Error in concat"+n+"D: Shape of tensors["+r+"] ("+t+") does not match the shape of the rest ("+i+") along the non-concatenated axis "+r+"."})})}function an(t,e){for(var n=t[0].slice(),i=1;i<t.length;i++)n[e]+=t[i][e];return n}function ln(t){var e=Object.keys(t);if(1!==e.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+e.length+" keys.");var n=e[0],i=t[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Pt.startScope(n);try{var r=i.apply(void 0,t);return r instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),Pt.endScope(r),r}catch(t){throw Pt.endScope(null),t}};return Object.defineProperty(r,"name",{value:n,configurable:!0}),r}We.registerFlag("HAS_WEBGL",function(){return We.getNumber("WEBGL_VERSION")>0}),We.registerFlag("WEBGL_VERSION",function(){return Pe(2)?2:Pe(1)?1:0}),We.registerFlag("WEBGL_BUFFER_SUPPORTED",function(){return 2===We.get("WEBGL_VERSION")}),We.registerFlag("WEBGL_CPU_FORWARD",function(){return!0}),We.registerFlag("WEBGL_FORCE_F16_TEXTURES",function(){return!1}),We.registerFlag("WEBGL_PACK",function(){return We.getBool("HAS_WEBGL")}),We.registerFlag("WEBGL_PACK_NORMALIZATION",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_CLIP",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_DEPTHWISECONV",function(){return!1}),We.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_PACK_REDUCE",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_LAZILY_UNPACK",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_CONV_IM2COL",function(){return We.getBool("WEBGL_PACK")}),We.registerFlag("WEBGL_MAX_TEXTURE_SIZE",function(){return Ae(We.getNumber("WEBGL_VERSION"))}),We.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",function(){return Me(We.getNumber("WEBGL_VERSION"))}),We.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",function(){var t=We.getNumber("WEBGL_VERSION");return 0===t?0:Ne(t)}),We.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",function(){return We.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(t=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))));var t}),We.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",function(){return Be(We.getNumber("WEBGL_VERSION"))}),We.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",function(){return!We.getBool("WEBGL_FORCE_F16_TEXTURES")&&We.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")}),We.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",function(){return Fe(We.getNumber("WEBGL_VERSION"))}),We.registerFlag("WEBGL_FENCE_API_ENABLED",function(){return Ve(We.getNumber("WEBGL_VERSION"))}),We.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",function(){return We.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0}),yt=Ge;var un=ln({complex_:function(t,e){var n=Ke(t,"real","complex"),i=Ke(e,"imag","complex");return S(n.shape,i.shape,"real and imag shapes, "+n.shape+" and "+i.shape+", must match in call to tf.complex()."),Pt.runKernelFunc(function(t){return t.complex(n,i)},{$real:n,$imag:i})}}),cn=ln({real_:function(t){var e=Ke(t,"input","real");return Pt.runKernelFunc(function(t){return t.real(e)},{$input:e})}}),hn=ln({imag_:function(t){var e=Ke(t,"input","imag");return Pt.runKernelFunc(function(t){return t.imag(e)},{$input:e})}});function pn(t,e,n){return dn(t,e,Xe(t,n),n)}function dn(t,e,n,i){if(null==i&&(i=Y(t)),"complex64"===i)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!W(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=e){it(e);var r=x(e),o=x(n);C(r===o,function(){return"Based on the provided shape, ["+e+"], the tensor should have "+r+" values but has "+o});for(var s=0;s<n.length;++s){var a=n[s],l=s!==n.length-1||a!==x(e.slice(s));C(n[s]===e[s]||!l,function(){return"Error creating a new Tensor. Inferred shape ("+n+") does not match the provided shape ("+e+"). "})}}return W(t)||Array.isArray(t)||(t=[t]),e=e||n,t="string"!==i?Z(t,i,c().getBool("DEBUG")):k(t,[],!0),Pt.makeTensor(t,e,i)}function fn(t,e){if((W(t)&&"string"!==e||Array.isArray(t))&&"complex64"!==e)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===e&&W(t)&&!(t instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return dn(t,[],[],e)}function gn(t,e){w(t);var n=Xe(t,e);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return dn(t,null,n,e)}function mn(t,e,n){if(w(t),null!=e&&2!==e.length)throw new Error("tensor2d() requires shape to have two numbers");var i=Xe(t,n);if(2!==i.length&&1!==i.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===i.length&&null==e)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return dn(t,e,i,n)}function vn(t,e,n){if(w(t),null!=e&&3!==e.length)throw new Error("tensor3d() requires shape to have three numbers");var i=Xe(t,n);if(3!==i.length&&1!==i.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===i.length&&null==e)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return dn(t,e,i,n)}function _n(t,e,n){if(w(t),null!=e&&4!==e.length)throw new Error("tensor4d() requires shape to have four numbers");var i=Xe(t,n);if(4!==i.length&&1!==i.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===i.length&&null==e)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return dn(t,e,i,n)}function yn(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=yn(t,"float32"),i=bn(t,"float32");return un(n,i)}var r=tt(x(t),e);return Pt.makeTensor(r,t,e)}function bn(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=bn(t,"float32"),i=bn(t,"float32");return un(n,i)}var r=et(x(t),e);return Pt.makeTensor(r,t,e)}function Tn(t,e,n){return Pt.runKernelFunc(function(i){return i.fill(t,e,n)},{})}function En(t,e,n,i){if(void 0===n&&(n=1),void 0===i&&(i="float32"),0===n)throw new Error("Cannot have a step of zero");if(t===e||t<e&&n<0||e<t&&n>1)return bn([0],i);var r=et(Math.abs(Math.ceil((e-t)/n)),i);e<t&&1===n&&(n=-1),r[0]=t;for(var o=1;o<r.length;o++)r[o]=r[o-1]+n;return gn(r,i)}var Cn=ln({onesLike_:function(t){var e=Ke(t,"x","onesLike");if("complex64"===e.dtype){var n=Cn(cn(e)),i=Sn(hn(e));return un(n,i)}return Pt.runKernelFunc(function(t){return t.onesLike(e)},{$x:e},function(t,e){return{$x:function(){return Sn(t)}}})}}),Sn=ln({zerosLike_:function(t){var e=Ke(t,"x","zerosLike");return Pt.runKernelFunc(function(t){return t.zerosLike(e)},{$x:e},function(t,e){return{$x:function(){return Sn(t)}}})}}),wn=ln({concat_:function(t,e){void 0===e&&(e=0),C(t.length>=1,function(){return"Pass at least one tensor to concat"});var n=Je(t,"tensors","concat");"complex64"===n[0].dtype&&n.forEach(function(t){if("complex64"!==t.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype "+t.dtype+". ")}),e=L(e,n[0].shape)[0];var i=an(n.map(function(t){return t.shape}),e);if(0===x(i))return pn([],i);if(1===(n=n.filter(function(t){return t.size>0})).length)return n[0];var r=n.map(function(t){return t.shape});sn(r,e);var o=n,s={axis:e};return Pt.runKernelFunc(function(t){return t.concat(n,e)},o,function(t){var n=r.map(function(t){return t[e]});return On(t,n,e).map(function(t){return function(){return t}})},"Concat",s)}}),kn=ln({concat1d_:function(t){return wn(t,0)}}),xn=ln({concat2d_:function(t,e){return wn(t,e)}}),In=ln({concat3d_:function(t,e){return wn(t,e)}}),Rn=ln({concat4d_:function(t,e){return wn(t,e)}}),On=ln({split_:function(t,e,n){void 0===n&&(n=0);var i,r=Ke(t,"x","split");return n=L(n,r.shape)[0],"number"==typeof e?(C(r.shape[n]%e==0,function(){return"Number of splits must evenly divide the axis."}),i=new Array(e).fill(r.shape[n]/e)):(C(r.shape[n]===e.reduce(function(t,e){return t+e}),function(){return"The sum of sizes must match the size of the axis dimension."}),i=e),Pt.runKernelFunc(function(t){return t.split(r,i,n)},{$x:r},function(t){return{$x:function(){return wn(t,n)}}})}});function Dn(t,e){return t(e={exports:{}},e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self;var An=Dn(function(t){!function(t,e,n){function i(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function r(t,e){var n=new function(t){var e,n=this,i=(e=4022871197,function(t){t=t.toString();for(var n=0;n<t.length;n++){var i=.02519603282416938*(e+=t.charCodeAt(n));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=i(" "),n.s1=i(" "),n.s2=i(" "),n.s0-=i(t),n.s0<0&&(n.s0+=1),n.s1-=i(t),n.s1<0&&(n.s1+=1),n.s2-=i(t),n.s2<0&&(n.s2+=1),i=null}(t),r=e&&e.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o.double=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.alea=r}(0,t)}),Mn=Dn(function(t){!function(t,e,n){function i(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function r(t,e){var n=new function(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var i=0;i<n.length+64;i++)e.x^=0|n.charCodeAt(i),e.next()}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xor128=r}(0,t)}),Nn=Dn(function(t){!function(t,e,n){function i(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function r(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var i=0;i<n.length+64;i++)e.x^=0|n.charCodeAt(i),i==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xorwow=r}(0,t)}),Ln=Dn(function(t){!function(t,e,n){function i(t,e){return e.x=t.x.slice(),e.i=t.i,e}function r(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,i=e.x,r=e.i;return t=i[r],n=(t^=t>>>7)^t<<24,n^=(t=i[r+1&7])^t>>>10,n^=(t=i[r+3&7])^t>>>3,n^=(t=i[r+4&7])^t<<7,t=i[r+7&7],n^=(t^=t<<13)^t<<9,i[r]=n,e.i=r+1&7,n},function(t,e){var n,i=[];if(e===(0|e))i[0]=e;else for(e=""+e,n=0;n<e.length;++n)i[7&n]=i[7&n]<<15^e.charCodeAt(n)+i[n+1&7]<<13;for(;i.length<8;)i.push(0);for(n=0;n<8&&0===i[n];++n);for(8==n?i[7]=-1:i[n],t.x=i,t.i=0,n=256;n>0;--n)t.next()}(e,t)}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&(r.x&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xorshift7=r}(0,t)}),Pn=Dn(function(t){!function(t,e,n){function i(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function r(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,i=e.w,r=e.X,o=e.i;return e.w=i=i+1640531527|0,n=r[o+34&127],t=r[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=r[o]=n^t,e.i=o,n+(i^i>>>16)|0},function(t,e){var n,i,r,o,s,a=[],l=128;for(e===(0|e)?(i=e,e=null):(e+="\0",i=0,l=Math.max(l,e.length)),r=0,o=-32;o<l;++o)e&&(i^=e.charCodeAt((o+32)%e.length)),0===o&&(s=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,o>=0&&(s=s+1640531527|0,r=0==(n=a[127&o]^=i+s)?r+1:0);for(r>=128&&(a[127&(e&&e.length||0)]=-1),r=127,o=512;o>0;--o)i=a[r+34&127],n=a[r=r+1&127],i^=i<<13,n^=n<<17,i^=i>>>15,n^=n>>>12,a[r]=i^n;t.w=s,t.X=a,t.i=r}(e,t)}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&(r.X&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.xor4096=r}(0,t)}),Bn=Dn(function(t){!function(t,e,n){function i(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function r(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,i=e.d,r=e.a;return t=t<<25^t>>>7^n,n=n-i|0,i=i<<24^i>>>8^r,r=r-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-i|0,e.d=i<<16^n>>>16^r,e.a=r-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var i=0;i<n.length+20;i++)e.b^=0|n.charCodeAt(i),e.next()}(t),r=e&&e.state,o=function(){return(n.next()>>>0)/4294967296};return o.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},o.int32=n.next,o.quick=o,r&&("object"==typeof r&&i(r,n),o.state=function(){return i(n,{})}),o}e&&e.exports?e.exports=r:this.tychei=r}(0,t)}),Fn=Dn(function(t){!function(e,i){var r,o=this,s=256,a=6,l="random",u=i.pow(s,a),c=i.pow(2,52),h=2*c,p=s-1;function d(t,n,p){var d=[],_=m(function t(e,n){var i,r=[],o=typeof e;if(n&&"object"==o)for(i in e)try{r.push(t(e[i],n-1))}catch(t){}return r.length?r:"string"==o?e:e+"\0"}((n=1==n?{entropy:!0}:n||{}).entropy?[t,v(e)]:null==t?function(){try{var t;return r&&(t=r.randomBytes)?t=t(s):(t=new Uint8Array(s),(o.crypto||o.msCrypto).getRandomValues(t)),v(t)}catch(t){var n=o.navigator,i=n&&n.plugins;return[+new Date,o,i,o.screen,v(e)]}}():t,3),d),y=new f(d),b=function(){for(var t=y.g(a),e=u,n=0;t<c;)t=(t+n)*s,e*=s,n=y.g(1);for(;t>=h;)t/=2,e/=2,n>>>=1;return(t+n)/e};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/4294967296},b.double=b,m(v(y.S),e),(n.pass||p||function(t,e,n,r){return r&&(r.S&&g(r,y),t.state=function(){return g(y,{})}),n?(i[l]=t,e):t})(b,_,"global"in n?n.global:this==i,n.state)}function f(t){var e,n=t.length,i=this,r=0,o=i.i=i.j=0,a=i.S=[];for(n||(t=[n++]);r<s;)a[r]=r++;for(r=0;r<s;r++)a[r]=a[o=p&o+t[r%n]+(e=a[r])],a[o]=e;(i.g=function(t){for(var e,n=0,r=i.i,o=i.j,a=i.S;t--;)e=a[r=p&r+1],n=n*s+a[p&(a[r]=a[o=p&o+e])+(a[o]=e)];return i.i=r,i.j=o,n})(s)}function g(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function m(t,e){for(var n,i=t+"",r=0;r<i.length;)e[p&r]=p&(n^=19*e[p&r])+i.charCodeAt(r++);return v(e)}function v(t){return String.fromCharCode.apply(0,t)}if(i["seed"+l]=d,m(i.random(),e),t.exports){t.exports=d;try{r=n(0)}catch(t){}}}([],Math)});Fn.alea=An,Fn.xor128=Mn,Fn.xorwow=Nn,Fn.xorshift7=Ln,Fn.xor4096=Pn,Fn.tychei=Bn;var Un=Fn.alea,Vn=function(){function t(t,e,n,i,r){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=i,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var o=r||Math.random();this.random=Un(o.toString())}return t.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,i=!1;!i;){var r=void 0,o=void 0,s=void 0;do{s=(r=2*this.random()-1)*r+(o=2*this.random()-1)*o}while(s>=1||0===s);var a=Math.sqrt(-2*Math.log(s)/s);e=this.mean+this.stdDev*r*a,n=this.mean+this.stdDev*o*a,this.truncated&&!this.isValidTruncated(e)||(i=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},t.prototype.convertValue=function(t){return null==this.dtype||"float32"===this.dtype?t:Math.round(t)},t.prototype.isValidTruncated=function(t){return t<=this.upper&&t>=this.lower},t}(),Hn=function(){function t(t,e,n,i){this.alpha=t,this.beta=1/e,this.dtype=n;var r=i||Math.random();this.randu=Un(r.toString()),this.randn=new Vn(0,1,n,!1,this.randu()),this.d=t<1?t+2/3:t-1/3,this.c=1/Math.sqrt(9*this.d)}return t.prototype.nextValue=function(){for(var t,e,n,i,r,o;;){do{i=this.randn.nextValue(),o=1+this.c*i}while(o<=0);if(o*=o*o,e=1-.331*(t=i*i)*t,n=.5*t+this.d*(1-o+Math.log(o)),(r=this.randu())<e||Math.log(r)<n)break}return o=1/this.beta*this.d*o,this.alpha<1&&(o*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(o)},t.prototype.convertValue=function(t){return"float32"===this.dtype?t:Math.round(t)},t}(),Wn=function(){function t(t,e,n,i){var r=this;if(void 0===t&&(t=0),void 0===e&&(e=1),this.canReturnFloat=function(){return null==r.dtype||"float32"===r.dtype},this.min=t,this.range=e-t,this.dtype=n,null==i&&(i=Math.random()),"number"==typeof i&&(i=i.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+t+" - "+e+" <= 1 and dtype is not float");this.random=Un(i)}return t.prototype.convertValue=function(t){return this.canReturnFloat()?t:Math.round(t)},t.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},t}();function Gn(t,e,n){return void 0===e&&(e="float32"),e=e||"float32",it(t),new mt(t,e,n)}var jn=ln({batchToSpaceND_:function(t,e,n){var i=Ke(t,"x","batchToSpaceND"),r=e.reduce(function(t,e){return t*e});return C(i.rank>=1+e.length,function(){return"input rank is "+i.rank+" but should be > than blockShape.length "+e.length}),C(n.length===e.length,function(){return"crops.length is "+n.length+" but should be equal to blockShape.length "+e.length}),C(i.shape[0]%r==0,function(){return"input tensor batch is "+i.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+r}),Pt.runKernelFunc(function(t){return t.batchToSpaceND(i,e,n)},{$x:i},function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}})}}),zn=ln({broadcastTo_:function(t,e){var n=Ke(t,"broadcastTo","x"),i=n.shape;if(e.some(function(t){return!(t>0)||t%1!=0}))throw new Error("broadcastTo(): Invalid broadcast shape ["+e+"].");if(e.length<n.rank)throw new Error("broadcastTo(): shape.length="+e.length+" < input.rank="+n.rank+".");if(e.length>n.rank){for(var r=n.shape.slice();r.length<e.length;)r.unshift(1);n=n.reshape(r)}for(var o=Array.from(e),s=e.length-1;s>=0;s--)if(n.shape[s]===e[s])o[s]=1;else if(1!==n.shape[s])throw new Error("broadcastTo(): ["+i+"] cannot be broadcast to ["+e+"].");var a=o.map(function(t,e){return t>1?e:-1}).filter(function(t){return t>=0});return 0===a.length?n.clone():Pt.runKernelFunc(function(t){return t.tile(n,o)},{input:n},function(t){return{input:function(){return t.sum(a,!0)}}})}}),$n=ln({cast_:function(t,e){var n=Ke(t,"x","cast");if(!V(e))throw new Error("Failed to cast to unknown dtype "+e);if("string"===e&&"string"!==n.dtype||"string"!==e&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");var i={dtype:e};return Pt.runKernelFunc(function(t){return t.cast(n,e)},{x:n},function(t){return{x:function(){return t.clone()}}},"Cast",i)}}),Xn=ln({clone_:function(t){var e=Ke(t,"x","clone",null);return Pt.runKernelFunc(function(){return Pt.makeTensorFromDataId(e.dataId,e.shape,e.dtype)},{$x:e},function(t){return{$x:function(){return t.toFloat()}}})}}),Yn=ln({cumsum_:function(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===i&&(i=!1);var r=Ke(t,"x","cumsum"),o=nn([e|=0],r.rank),s=r;null!=o&&(s=r.transpose(o));var a=on(1,r.rank)[0],l=Pt.runKernelFunc(function(t){return t.cumsum(s,a,n,i)},{permutedX:s},function(t){return{permutedX:function(){return t.cumsum(e,n,!i)}}});return null!=o&&(l=l.transpose(o)),l}}),Kn=ln({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var i=Ke(t,"x","depthToSpace"),r="NHWC"===n?i.shape[1]:i.shape[2],o="NHWC"===n?i.shape[2]:i.shape[3],s="NHWC"===n?i.shape[3]:i.shape[1];return C(r*e>=0,function(){return"Negative dimension size caused by overflow when multiplying\n "+r+" and "+e+" for depthToSpace with input shape\n "+i.shape}),C(o*e>=0,function(){return"Negative dimension size caused by overflow when multiplying\n "+o+" and "+e+" for depthToSpace with input shape\n "+i.shape}),C(s%(e*e)==0,function(){return"Dimension size must be evenly divisible by "+e*e+" but is "+s+" for depthToSpace with input shape "+i.shape}),Pt.runKernelFunc(function(t){return t.depthToSpace(i,e,n)},{$x:i})}}),Jn=ln({expandDims_:function(t,e){void 0===e&&(e=0);var n=Ke(t,"x","expandDims",null);C(e<=n.rank,function(){return"Axis must be <= rank of the tensor"});var i=n.shape.slice();return e<0&&(C(-(n.rank+1)<=e,function(){return"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"}),e=n.rank+e+1),i.splice(e,0,1),ui(n,i)}}),qn=ln({eye_:function(t,e,n,i){void 0===i&&(i="float32"),null==e&&(e=t);for(var r=Gn([t,e],i),o=t<=e?t:e,s=0;s<o;++s)r.set(1,s,s);var a=r.toTensor().as2D(t,e);if(null==n)return a;if(1===n.length)return di(Jn(a,0),[n[0],1,1]);if(2===n.length)return di(Jn(Jn(a,0),0),[n[0],n[1],1,1]);if(3===n.length)return di(Jn(Jn(Jn(a,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+n.length+"D.")}}),Zn=ln({multinomial_:function(t,e,n,i){void 0===i&&(i=!1);var r=Ke(t,"logits","multinomial"),o=r.size,s=r.rank;if(o<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+o+".");if(s>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+s);n=n||Math.random();var a=1===s?r.as2D(1,-1):r,l=Pt.runKernelFunc(function(t){return t.multinomial(a,i,e,n)},{logits2D:a});return 1===s?l.as1D():l}}),Qn=ln({oneHot_:function(t,e,n,i){if(void 0===n&&(n=1),void 0===i&&(i=0),e<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+e);var r=Ke(t,"indices","oneHot","int32"),o=r.shape.concat([e]);return r=r.flatten(),Pt.runKernelFunc(function(t){return t.oneHot(r,e,n,i)},{$indices:r},function(t){return{$indices:function(){return bn(r.shape,"float32")}}}).reshape(o)}}),ti=ln({pad_:function(t,e,n){void 0===n&&(n=0);var i=Ke(t,"x","pad");if(0===i.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var r={paddings:e,constantValue:n};return Pt.runKernelFunc(function(t){return t.pad(i,e,n)},{x:i},function(t){var n=e.map(function(t){return t[0]});return{x:function(){return t.slice(n,i.shape)}}},"PadV2",r)}}),ei=ln({pad1d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length,function(){return"Invalid number of paddings. Must be length of 2."}),ti(t,[e],n)}}),ni=ln({pad2d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length&&2===e[0].length&&2===e[1].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ti(t,e,n)}}),ii=ln({pad3d_:function(t,e,n){return void 0===n&&(n=0),C(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ti(t,e,n)}}),ri=ln({pad4d_:function(t,e,n){return void 0===n&&(n=0),C(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,function(){return"Invalid number of paddings. Must be length of 2 each."}),ti(t,e,n)}}),oi=ln({rand_:function(t,e,n){var i=x(t),r=null;if(null==n||"float32"===n)r=new Float32Array(i);else if("int32"===n)r=new Int32Array(i);else{if("bool"!==n)throw new Error("Unknown data type "+n);r=new Uint8Array(i)}for(var o=0;o<i;o++)r[o]=e();return Pt.makeTensor(r,t,n)}}),si=ln({randomNormal_:function(t,e,n,i,r){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=i&&"bool"===i)throw new Error("Unsupported data type "+i);for(var o=new Vn(e,n,i,!1,r),s=Gn(t,i),a=0;a<s.values.length;a++)s.values[a]=o.nextValue();return s.toTensor()}}),ai=ln({randomGamma_:function(t,e,n,i,r){if(void 0===n&&(n=1),void 0===i&&(i="float32"),null==n&&(n=1),null==i&&(i="float32"),"float32"!==i&&"int32"!==i)throw new Error("Unsupported data type "+i);for(var o=new Hn(e,n,i,r),s=Gn(t,i),a=0;a<s.values.length;a++)s.values[a]=o.nextValue();return s.toTensor()}}),li=ln({randomUniform_:function(t,e,n,i,r){void 0===e&&(e=0),void 0===n&&(n=1),void 0===i&&(i="float32");for(var o=Gn(t,i),s=new Wn(e,n,null,r),a=0;a<o.values.length;a++)o.values[a]=s.nextValue();return o.toTensor()}}),ui=ln({reshape_:function(t,e){var n=Ke(t,"x","reshape",null);e=N(e,n.size),C(n.size===x(e),function(){return"new shape and old shape must have the same number of elements."});var i={shape:e};return Pt.runKernelFunc(function(t){return t.reshape(n,e)},{x:n},function(t){return{x:function(){return t.reshape(n.shape)}}},"Reshape",i)}}),ci=ln({spaceToBatchND_:function(t,e,n){var i=Ke(t,"x","spaceToBatchND");return C(i.rank>=1+e.length,function(){return"input rank "+i.rank+" should be > than [blockShape] "+e.length}),C(n.length===e.length,function(){return"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+e.length}),C(i.shape.reduce(function(t,i,r){return r>0&&r<=e.length?t&&(i+n[r-1][0]+n[r-1][1])%e[r-1]==0:t},!0),function(){return"input spatial dimensions "+i.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+e.toString()}),Pt.runKernelFunc(function(t){return t.spaceToBatchND(i,e,n)},{$x:i},function(t){return{$x:function(){return t.batchToSpaceND(e,n)}}})}}),hi=ln({squeeze_:function(t,e){var n=Ke(t,"x","squeeze");return ui(n,P(n.shape,e).newShape)}}),pi=ln({stack_:function(t,e){void 0===e&&(e=0);var n=Je(t,"tensors","stack");if(C(n.length>=1,function(){return"Pass at least one tensor to tf.stack"}),1===n.length)return n[0].expandDims(e);var i=n[0].rank,r=n[0].shape,o=n[0].dtype;C(e<=i,function(){return"Axis must be <= rank of the tensor"}),n.forEach(function(t){S(r,t.shape,"All tensors passed to stack must have matching shapes")}),n.forEach(function(t){C(o===t.dtype,function(){return"All tensors passed to stack must have matching dtypes"})});var s=n.map(function(t){return t.expandDims(e)});return wn(s,e)}}),di=ln({tile_:function(t,e){var n=Ke(t,"x","tile",null);C(n.rank===e.length,function(){return"Error in transpose: rank of input "+n.rank+" must match length of reps "+e+"."});var i=[n],r={reps:e};return Pt.runKernelFunc(function(t,i){var r=t.tile(n,e);return i([n]),r},{x:n},function(t,n){var i=n[0];return{x:function(){var n=Sn(i);if(1===i.rank)for(var r=0;r<e[0];++r)n=n.add(t.slice([r*i.shape[0]],[i.shape[0]]));else if(2===i.rank)for(r=0;r<e[0];++r)for(var o=0;o<e[1];++o)n=n.add(t.slice([r*i.shape[0],o*i.shape[1]],[i.shape[0],i.shape[1]]));else if(3===i.rank)for(r=0;r<e[0];++r)for(o=0;o<e[1];++o)for(var s=0;s<e[2];++s)n=n.add(t.slice([r*i.shape[0],o*i.shape[1],s*i.shape[2]],[i.shape[0],i.shape[1],i.shape[2]]));else{if(4!==i.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+i.rank+" tensors yet.");for(r=0;r<e[0];++r)for(o=0;o<e[1];++o)for(s=0;s<e[2];++s)for(var a=0;a<e[3];++a)n=n.add(t.slice([r*i.shape[0],o*i.shape[1],s*i.shape[2],a*i.shape[3]],[i.shape[0],i.shape[1],i.shape[2],i.shape[3]]))}return n}}},"Tile",r,i)}}),fi=ln({truncatedNormal_:function(t,e,n,i,r){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=i&&"bool"===i)throw new Error("Unsupported data type "+i);for(var o=new Vn(e,n,i,!0,r),s=Gn(t,i),a=0;a<s.values.length;a++)s.values[a]=o.nextValue();return s.toTensor()}}),gi=ln({unstack_:function(t,e){void 0===e&&(e=0),e=e||0;var n=Ke(t,"x","unstack");C(e>=-n.shape.length&&e<n.shape.length,function(){return"Axis = "+e+" is not in [-"+n.shape.length+", "+n.shape.length+")"}),e<0&&(e+=n.shape.length);var i={axis:e};return Pt.runKernelFunc(function(t){return t.unstack(n,e)},{x:n},function(t){return{x:function(){return pi(t,e)}}},"Unpack",i)}});function mi(t,e,n,i){void 0===i&&(i=!0);var r=[];if(i)(r=r.concat(e.slice(0))).push(t[0]/n),r=r.concat(t.slice(1));else{r=r.concat(t[0]);for(var o=e.length,s=0;s<o;++s)r=r.concat([t[s+1]/e[s],e[s]]);r=r.concat(t.slice(o+1))}return r}function vi(t,e,n){void 0===n&&(n=!0);var i=[];if(n){i.push(e);for(var r=e+1;r<t;++r)r<=2*e?(i.push(r),i.push(r-(e+1))):i.push(r)}else{var o=[],s=[];for(r=1;r<t;++r)r>=2*e+1||r%2==1?s.push(r):o.push(r);i.push.apply(i,o),i.push(0),i.push.apply(i,s)}return i}function _i(t,e,n,i){void 0===i&&(i=!0);var r=[];i?r.push(t[0]/n):r.push(t[0]*n);for(var o=1;o<t.length;++o)o<=e.length?i?r.push(e[o-1]*t[o]):r.push(t[o]/e[o-1]):r.push(t[o]);return r}function yi(t,e){for(var n=[0],i=0;i<e;++i)n.push(t[i][0]);return n}function bi(t,e,n){for(var i=t.slice(0,1),r=0;r<n;++r)i.push(t[r+1]-e[r][0]-e[r][1]);return i}function Ti(t,e){if(t.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+t.rank+".");if(e.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if("int32"!==e.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type, but the dtype was "+e.dtype+".");if(e.shape[e.rank-1]>t.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,i=n[n.length-1],r=1,o=0;o<n.length-1;++o)r*=n[o];var s=t.shape,a=n.slice();a.pop();var l=1;for(o=i;o<t.rank;++o)l*=s[o],a.push(s[o]);var u=q(t.shape).map(function(t){return t/l}).concat([1]).slice(0,i);return[a,r,l,u]}Object.freeze({prepareAndValidate:Ti});var Ei=30;function Ci(t){return t<=Ei?t:J(t,Math.floor(Math.sqrt(t)))}function Si(t,e,n){var i=e.rank>1?e.shape[e.rank-1]:1,r=e.rank>1?e.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+n.shape+", indices.shape: "+e.shape+", shape: "+t+", sliceDim: "+i+", and batchDim: "+r+".";if(n.rank<r)throw new Error(o+" update.rank < "+r+". ");if(t.length<i+(n.rank-r))throw new Error(o+" Output shape length < "+(i+(n.rank-r)));if(n.rank!==r+t.length-i)throw new Error(o+" update.rank != "+(r+t.length-i));for(var s=0;s<r;++s)if(n.shape[s]!==e.shape[s])throw new Error(o+" updates.shape["+s+"] ("+n.shape[s]+") != indices.shape["+s+"] ("+e.shape[s]+").");for(s=0;s<n.rank-r;++s)if(n.shape[s+r]!==t[s+i])throw new Error(o+" updates.shape["+(s+r)+"] ("+n.shape[s+r]+") != shape["+(s+r)+"] ("+t[s+r]+")")}function wi(t,e,n){if(e.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");if(t.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher, but the rank was "+t.rank+".");if("int32"!==e.dtype)throw new Error("The dtype of 'indices' should be int32, but got dtype: "+e.dtype);if(n.length<1)throw new Error("Output rank must be greater or equal to 1, but got shape: "+n);if(0===n.length){if(0===e.size)throw new Error("Indices specified for empty output. indices shape: "+e.shape);if(0===t.size)throw new Error("Updates specified for empty output. updates shape: "+t.shape)}Si(n,e,t)}function ki(t,e,n){for(var i=e.shape.length,r=i>1?e.shape[i-1]:1,o=n.length,s=1,a=r;a<o;++a)s*=n[a];var l=r<1?1:r;return{sliceRank:r,numUpdates:x(e.shape)/l,sliceSize:s,strides:q(n.slice(0,r)).concat([1]),outputSize:x(n)}}Object.freeze({validateUpdateShape:Si,validateInput:wi,calculateShapes:ki});function xi(t,e,n){C(t.rank===e.length,function(){return"Error in slice"+t.rank+"D: Length of begin "+e+" must match the rank of the array ("+t.rank+")."}),C(t.rank===n.length,function(){return"Error in slice"+t.rank+"D: Length of size "+n+" must match the rank of the array ("+t.rank+")."});for(var i=function(i){C(e[i]+n[i]<=t.shape[i],function(){return"Error in slice"+t.rank+"D: begin["+i+"] + size["+i+"] ("+(e[i]+n[i])+") would overflow input.shape["+i+"] ("+t.shape[i]+")"})},r=0;r<t.rank;++r)i(r)}function Ii(t){for(var e=[],n=0;t>0;)1&t&&e.push(n),t/=2,n++;return e}function Ri(t,e,n){for(var i=[],r=0;r<t.length;r++)i[r]=Math.ceil((e[r]-t[r])/n[r]);return i}function Oi(t,e,n,i,r){var o=e[r],s=n[r]||1;(t&1<<r||null==o)&&(o=s>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var a=i[r];return o<0&&(o+=a),b(0,o,a-1)}function Di(t,e,n,i,r){var o=e[r],s=n[r]||1;(t&1<<r||null==o)&&(o=s>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var a=i[r];return o<0&&(o+=a),s>0?b(0,o,a):b(-1,o,a-1)}function Ai(t,e,n){for(var i=n.length,r=0;r<n.length;r++)if(n[r]>1){i=r;break}for(r=i+1;r<n.length;r++)if(e[r]>0||n[r]!==t[r])return!1;return!0}function Mi(t,e){for(var n=t.length>0?t[t.length-1]:1,i=0;i<t.length-1;i++)n+=t[i]*e[i];return n}Object.freeze({assertParamsValid:xi,maskToAxes:Ii,computeOutShape:Ri,startForAxis:Oi,stopForAxis:Di,isSliceContinous:Ai,computeFlatOffset:Mi});function Ni(t){return Pt.customGrad(t)}var Li=ln({softmax_:function(t,e){void 0===e&&(e=-1);var n=Ke(t,"logits","softmax","float32");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and dim was "+e);return Pt.runKernelFunc(function(t,i){var r=t.softmax(n,e);return i([r]),r},{logits:n},function(t,n){var i=n[0],r=t.mul(i);return{logits:function(){return r.sub(r.sum([e],!0).mul(i))}}},"Softmax",{dim:e},[],[!0])}}),Pi=ln({logSoftmax_:function(t,e){void 0===e&&(e=-1);var n=Ke(t,"logits","logSoftmax");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and axis was "+e);return Ni(function(t,n){var i=t.max(e,!0),r=t.sub(i),o=r.toFloat().sub(r.exp().sum(e,!0).log());return n([o]),{value:o,gradFunc:function(t,n){var i=n[0].exp();return t.sub(t.sum(e,!0).mul(i))}}})(n)}}),Bi=function(){function t(t,e){this.backend=t,this.dataMover=e,this.data=new WeakMap,this.dataIdsCount=0}return t.prototype.get=function(t){return this.data.has(t)||this.dataMover.moveData(this.backend,t),this.data.get(t)},t.prototype.set=function(t,e){this.dataIdsCount++,this.data.set(t,e)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.delete=function(t){return this.dataIdsCount--,this.data.delete(t)},t.prototype.numDataIds=function(){return this.dataIdsCount},t}(),Fi=function(){function t(){}return t.prototype.time=function(t){return Ui("time")},t.prototype.read=function(t){return Ui("read")},t.prototype.readSync=function(t){return Ui("readSync")},t.prototype.numDataIds=function(){return Ui("numDataIds")},t.prototype.disposeData=function(t){return Ui("disposeData")},t.prototype.write=function(t,e,n){return Ui("write")},t.prototype.move=function(t,e,n,i){return Ui("move")},t.prototype.memory=function(){return Ui("memory")},t.prototype.floatPrecision=function(){return Ui("floatPrecision")},t.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},t.prototype.batchMatMul=function(t,e,n,i){return Ui("batchMatMul")},t.prototype.fusedBatchMatMul=function(t){return t.a,t.b,t.transposeA,t.transposeB,t.bias,t.activation,t.preluActivationWeights,Ui("fusedBatchMatMul")},t.prototype.slice=function(t,e,n){return Ui("slice")},t.prototype.stridedSlice=function(t,e,n,i){return Ui("stridedSlice")},t.prototype.unstack=function(t,e){return Ui("unstack")},t.prototype.reverse=function(t,e){return Ui("reverse")},t.prototype.concat=function(t,e){return Ui("concat")},t.prototype.neg=function(t){return Ui("neg")},t.prototype.add=function(t,e){return Ui("add")},t.prototype.addN=function(t){return Ui("addN")},t.prototype.subtract=function(t,e){return Ui("subtract")},t.prototype.multiply=function(t,e){return Ui("multiply")},t.prototype.realDivide=function(t,e){return Ui("realDivide")},t.prototype.floorDiv=function(t,e){return Ui("floorDiv")},t.prototype.sum=function(t,e){return Ui("sum")},t.prototype.prod=function(t,e){return Ui("prod")},t.prototype.unsortedSegmentSum=function(t,e,n){return Ui("unsortedSegmentSum")},t.prototype.argMin=function(t,e){return Ui("argMin")},t.prototype.argMax=function(t,e){return Ui("argMax")},t.prototype.equal=function(t,e){return Ui("equal")},t.prototype.notEqual=function(t,e){return Ui("notEqual")},t.prototype.less=function(t,e){return Ui("less")},t.prototype.lessEqual=function(t,e){return Ui("lessEqual")},t.prototype.greater=function(t,e){return Ui("greater")},t.prototype.greaterEqual=function(t,e){return Ui("greaterEqual")},t.prototype.logicalNot=function(t){return Ui("logicalNot")},t.prototype.logicalAnd=function(t,e){return Ui("logicalAnd")},t.prototype.logicalOr=function(t,e){return Ui("logicalOr")},t.prototype.where=function(t){return Ui("where")},t.prototype.select=function(t,e,n){return Ui("select")},t.prototype.topk=function(t,e,n){return Ui("topk")},t.prototype.min=function(t,e){return Ui("min")},t.prototype.minimum=function(t,e){return Ui("minimum")},t.prototype.mod=function(t,e){return Ui("mod")},t.prototype.max=function(t,e){return Ui("max")},t.prototype.maximum=function(t,e){return Ui("maximum")},t.prototype.all=function(t,e){return Ui("all")},t.prototype.any=function(t,e){return Ui("any")},t.prototype.squaredDifference=function(t,e){return Ui("squaredDifference")},t.prototype.ceil=function(t){return Ui("ceil")},t.prototype.floor=function(t){return Ui("floor")},t.prototype.round=function(t){return Ui("round")},t.prototype.sign=function(t){return Ui("sign")},t.prototype.isNaN=function(t){return Ui("isNaN")},t.prototype.isInf=function(t){return Ui("isInf")},t.prototype.isFinite=function(t){return Ui("isFinite")},t.prototype.pow=function(t,e){return Ui("pow")},t.prototype.exp=function(t){return Ui("exp")},t.prototype.expm1=function(t){return Ui("expm1")},t.prototype.softmax=function(t,e){return Ui("softmax")},t.prototype.log=function(t){return Ui("log")},t.prototype.log1p=function(t){return Ui("log1p")},t.prototype.sqrt=function(t){return Ui("sqrt")},t.prototype.rsqrt=function(t){return Ui("rsqrt")},t.prototype.square=function(t){return Ui("square")},t.prototype.reciprocal=function(t){return Ui("reciprocal")},t.prototype.relu=function(t){return Ui("relu")},t.prototype.relu6=function(t){return Ui("relu6")},t.prototype.prelu=function(t,e){return Ui("prelu")},t.prototype.elu=function(t){return Ui("elu")},t.prototype.eluDer=function(t,e){return Ui("eluDer")},t.prototype.selu=function(t){return Ui("selu")},t.prototype.int=function(t){return Ui("int")},t.prototype.clip=function(t,e,n){return Ui("clip")},t.prototype.abs=function(t){return Ui("abs")},t.prototype.complexAbs=function(t){return Ui("complexAbs")},t.prototype.sigmoid=function(t){return Ui("sigmoid")},t.prototype.softplus=function(t){return Ui("softplus")},t.prototype.sin=function(t){return Ui("sin")},t.prototype.cos=function(t){return Ui("cos")},t.prototype.tan=function(t){return Ui("tan")},t.prototype.asin=function(t){return Ui("asin")},t.prototype.acos=function(t){return Ui("acos")},t.prototype.atan=function(t){return Ui("atan")},t.prototype.atan2=function(t,e){return Ui("atan2")},t.prototype.sinh=function(t){return Ui("sinh")},t.prototype.cosh=function(t){return Ui("cosh")},t.prototype.tanh=function(t){return Ui("tanh")},t.prototype.asinh=function(t){return Ui("asinh")},t.prototype.acosh=function(t){return Ui("acosh")},t.prototype.atanh=function(t){return Ui("atanh")},t.prototype.erf=function(t){return Ui("erf")},t.prototype.step=function(t,e){return Ui("step")},t.prototype.fusedConv2d=function(t){return t.input,t.filter,t.convInfo,t.bias,t.activation,t.preluActivationWeights,Ui("fusedConv2d")},t.prototype.conv2d=function(t,e,n){return Ui("conv2d")},t.prototype.conv2dDerInput=function(t,e,n){return Ui("conv2dDerInput")},t.prototype.conv2dDerFilter=function(t,e,n){return Ui("conv2dDerFilter")},t.prototype.fusedDepthwiseConv2D=function(t){return t.input,t.filter,t.convInfo,t.bias,t.activation,t.preluActivationWeights,Ui("fusedDepthwiseConv2D")},t.prototype.depthwiseConv2D=function(t,e,n){return Ui("depthwiseConv2D")},t.prototype.depthwiseConv2DDerInput=function(t,e,n){return Ui("depthwiseConv2DDerInput")},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){return Ui("depthwiseConv2DDerFilter")},t.prototype.conv3d=function(t,e,n){return Ui("conv3d")},t.prototype.conv3dDerInput=function(t,e,n){return Ui("conv3dDerInput")},t.prototype.conv3dDerFilter=function(t,e,n){return Ui("conv3dDerFilter")},t.prototype.maxPool=function(t,e){return Ui("maxPool")},t.prototype.maxPoolBackprop=function(t,e,n,i){return Ui("maxPoolBackprop")},t.prototype.avgPool=function(t,e){return Ui("avgPool")},t.prototype.avgPoolBackprop=function(t,e,n){return Ui("avgPoolBackprop")},t.prototype.avgPool3d=function(t,e){return Ui("avgPool3d")},t.prototype.avgPool3dBackprop=function(t,e,n){return Ui("avgPool3dBackprop")},t.prototype.maxPool3d=function(t,e){return Ui("maxPool3d")},t.prototype.maxPool3dBackprop=function(t,e,n,i){return Ui("maxPool3dBackprop")},t.prototype.reshape=function(t,e){return Ui("reshape")},t.prototype.cast=function(t,e){return Ui("cast")},t.prototype.tile=function(t,e){return Ui("tile")},t.prototype.pad=function(t,e,n){return Ui("pad")},t.prototype.transpose=function(t,e){return Ui("transpose")},t.prototype.gather=function(t,e,n){return Ui("gather")},t.prototype.gatherND=function(t,e){return Ui("gatherND")},t.prototype.scatterND=function(t,e,n){return Ui("scatterND")},t.prototype.batchToSpaceND=function(t,e,n){return Ui("batchToSpaceND")},t.prototype.spaceToBatchND=function(t,e,n){return Ui("spaceToBatchND")},t.prototype.resizeBilinear=function(t,e,n,i){return Ui("resizeBilinear")},t.prototype.resizeBilinearBackprop=function(t,e,n){return Ui("resizeBilinearBackprop")},t.prototype.resizeNearestNeighbor=function(t,e,n,i){return Ui("resizeNearestNeighbor")},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){return Ui("resizeNearestNeighborBackprop")},t.prototype.batchNormalization=function(t,e,n,i,r,o){return Ui("batchNormalization")},t.prototype.localResponseNormalization4D=function(t,e,n,i,r){return Ui("localResponseNormalization4D")},t.prototype.LRNGrad=function(t,e,n,i,r,o,s){return Ui("LRNGrad")},t.prototype.multinomial=function(t,e,n,i){return Ui("multinomial")},t.prototype.oneHot=function(t,e,n,i){return Ui("oneHot")},t.prototype.cumsum=function(t,e,n,i){return Ui("cumsum")},t.prototype.nonMaxSuppression=function(t,e,n,i,r){return Ui("nonMaxSuppression")},t.prototype.fft=function(t){return Ui("fft")},t.prototype.ifft=function(t){return Ui("ifft")},t.prototype.complex=function(t,e){return Ui("complex")},t.prototype.real=function(t){return Ui("real")},t.prototype.imag=function(t){return Ui("imag")},t.prototype.cropAndResize=function(t,e,n,i,r,o){return Ui("cropAndResize")},t.prototype.depthToSpace=function(t,e,n){return Ui("depthToSpace")},t.prototype.split=function(t,e,n){return Ui("split")},t.prototype.sparseToDense=function(t,e,n,i){return Ui("sparseToDense")},t.prototype.diag=function(t){return Ui("diag")},t.prototype.fill=function(t,e,n){return Ui("fill")},t.prototype.onesLike=function(t){return Ui("onesLike")},t.prototype.zerosLike=function(t){return Ui("zerosLike")},t.prototype.linspace=function(t,e,n){return Ui("linspace")},t.prototype.dispose=function(){return Ui("dispose")},t}();function Ui(t){throw new Error("'"+t+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function Vi(t,e){for(var n=t.length,i=[],r=0;r<n;r++){var o=n-1-r,s=t[o]||1;(e[e.length-1-r]||1)>1&&1===s&&i.unshift(o)}return i}function Hi(t,e){for(var n=[],i=0;i<e.length;i++){var r=t[t.length-i-1],o=e.length-i-1,s=e[o];(null==r||1===r&&s>1)&&n.unshift(o)}return n}function Wi(t,e){for(var n=[],i=Math.max(t.length,e.length),r=0;r<i;r++){var o=t[t.length-r-1];null==o&&(o=1);var s=e[e.length-r-1];if(null==s&&(s=1),1===o)n.unshift(s);else if(1===s)n.unshift(o);else{if(o!==s)throw Error("Operands could not be broadcast together with shapes "+t+" and "+e+".");n.unshift(o)}}return n}function Gi(t,e,n,i,r,o,s){void 0===s&&(s="channelsLast");var a,l=Yi(e),u=l[0],c=l[1];if("channelsLast"===s)a=[u,c,t[3],t[3]];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);a=[u,c,t[1],t[1]]}return zi(t,a,n,i,r,o,!1,s)}function ji(t,e,n,i,r,o,s){void 0===s&&(s="NDHWC");var a,l,u=Ki(e),c=u[0],h=u[1],p=u[2];if("NDHWC"===s)l="channelsLast",a=[c,h,p,t[4],t[4]];else{if("NCDHW"!==s)throw new Error("Unknown dataFormat "+s);l="channelsFirst",a=[c,h,p,t[1],t[1]]}return $i(t,a,n,i,r,!1,l,o)}function zi(t,e,n,i,r,o,s,a){void 0===s&&(s=!1),void 0===a&&(a="channelsLast");var l=[-1,-1,-1,-1],u=l[0],c=l[1],h=l[2],p=l[3];if("channelsLast"===a)u=t[0],c=t[1],h=t[2],p=t[3];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);u=t[0],p=t[1],c=t[2],h=t[3]}var d,f=e[0],g=e[1],m=e[3],v=Yi(n),_=v[0],y=v[1],b=Yi(i),T=b[0],E=b[1],S=Ji(f,T),w=Ji(g,E),k=function(t,e,n,i,r,o,s,a){var l,u,c;if("number"==typeof t){l={top:t,bottom:t,left:t,right:t,type:0===t?"VALID":"NUMBER"};var h=function(t,e,n,i,r){null==i&&(i=Xi(t,e,n));var o=t[1],s=qi((t[0]-e+2*i)/n+1,r);C(R(s),function(){return"The output # of rows ("+s+") must be an integer. Change the stride and/or zero pad parameters"});var a=qi((o-e+2*i)/n+1,r);return C(R(a),function(){return"The output # of columns ("+a+") must be an integer. Change the stride and/or zero pad parameters"}),[s,a]}([e,n],o,i,t,a);u=h[0],c=h[1]}else if("same"===t){u=Math.ceil(e/i),c=Math.ceil(n/r);var p=Math.max(0,(u-1)*i+o-e),d=Math.max(0,(c-1)*r+s-n),f=Math.floor(p/2),g=p-f,m=Math.floor(d/2);l={top:f,bottom:g,left:m,right:d-m,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);l={top:0,bottom:0,left:0,right:0,type:"VALID"},u=Math.ceil((e-o+1)/i),c=Math.ceil((n-s+1)/r)}return{padInfo:l,outHeight:u,outWidth:c}}(r,c,h,_,y,S,w,o),x=k.padInfo,I=k.outHeight,O=k.outWidth,D=s?m*p:m;return"channelsFirst"===a?d=[u,D,I,O]:"channelsLast"===a&&(d=[u,I,O,D]),{batchSize:u,dataFormat:a,inHeight:c,inWidth:h,inChannels:p,outHeight:I,outWidth:O,outChannels:D,padInfo:x,strideHeight:_,strideWidth:y,filterHeight:f,filterWidth:g,effectiveFilterHeight:S,effectiveFilterWidth:w,dilationHeight:T,dilationWidth:E,inShape:t,outShape:d,filterShape:e}}function $i(t,e,n,i,r,o,s,a){void 0===o&&(o=!1),void 0===s&&(s="channelsLast");var l=[-1,-1,-1,-1,-1],u=l[0],c=l[1],h=l[2],p=l[3],d=l[4];if("channelsLast"===s)u=t[0],c=t[1],h=t[2],p=t[3],d=t[4];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);u=t[0],d=t[1],c=t[2],h=t[3],p=t[4]}var f,g=e[0],m=e[1],v=e[2],_=e[4],y=Ki(n),b=y[0],T=y[1],E=y[2],S=Ki(i),w=S[0],k=S[1],x=S[2],I=Ji(g,w),O=Ji(m,k),D=Ji(v,x),A=function(t,e,n,i,r,o,s,a,l,u,c){var h,p,d,f;if("number"==typeof t){h={top:t,bottom:t,left:t,right:t,front:t,back:t,type:0===t?"VALID":"NUMBER"};var g=function(t,e,n,i,r,o){null==r&&(r=Xi(t,e,i));var s=t[1],a=t[2],l=qi((t[0]-e+2*r)/i+1,o);C(R(l),function(){return"The output # of depths ("+l+") must be an integer. Change the stride and/or zero pad parameters"});var u=qi((s-e+2*r)/i+1,o);C(R(u),function(){return"The output # of rows ("+u+") must be an integer. Change the stride and/or zero pad parameters"});var c=qi((a-e+2*r)/i+1,o);return C(R(c),function(){return"The output # of columns ("+c+") must be an integer. Change the stride and/or zero pad parameters"}),[l,u,c,1]}([e,n,i,1],a,0,r,t,c);p=g[0],d=g[1],f=g[2]}else if("same"===t){var m=((p=Math.ceil(e/r))-1)*r+a-e,v=((d=Math.ceil(n/o))-1)*o+l-n,_=((f=Math.ceil(i/s))-1)*s+u-i,y=Math.floor(m/2),b=m-y,T=Math.floor(v/2),E=v-T,S=Math.floor(_/2);h={top:T,bottom:E,left:S,right:_-S,front:y,back:b,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);h={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},p=Math.ceil((e-a+1)/r),d=Math.ceil((n-l+1)/o),f=Math.ceil((i-u+1)/s)}return{padInfo:h,outDepth:p,outHeight:d,outWidth:f}}(r,c,h,p,b,T,E,I,O,D,a),M=A.padInfo,N=A.outDepth,L=A.outHeight,P=A.outWidth,B=o?_*d:_;return"channelsFirst"===s?f=[u,B,N,L,P]:"channelsLast"===s&&(f=[u,N,L,P,B]),{batchSize:u,dataFormat:s,inDepth:c,inHeight:h,inWidth:p,inChannels:d,outDepth:N,outHeight:L,outWidth:P,outChannels:B,padInfo:M,strideDepth:b,strideHeight:T,strideWidth:E,filterDepth:g,filterHeight:m,filterWidth:v,effectiveFilterDepth:I,effectiveFilterHeight:O,effectiveFilterWidth:D,dilationDepth:w,dilationHeight:k,dilationWidth:x,inShape:t,outShape:f,filterShape:e}}function Xi(t,e,n,i){void 0===i&&(i=1);var r=Ji(e,i);return Math.floor((t[0]*(n-1)-n+r)/2)}function Yi(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}function Ki(t){return"number"==typeof t?[t,t,t]:t}function Ji(t,e){return e<=1?t:t+(t-1)*(e-1)}function qi(t,e){if(!e)return t;switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error("Unknown roundingMode "+e)}}function Zi(t){var e=Yi(t),n=e[0],i=e[1],r=e[2];return 1===n&&1===i&&1===r}function Qi(t,e){return Zi(t)||Zi(e)}function tr(t){if("NHWC"===t)return"channelsLast";if("NCHW"===t)return"channelsFirst";throw new Error("Unknown dataFormat "+t)}function er(t,e,n){if("complex64"===e){if("complex64"===t.dtype)return t.clone();var i=bn(t.shape),r=t.toFloat(),o=n.complex(r,i);return i.dispose(),r.dispose(),o}if(!H(t.dtype,e))return Pt.makeTensorFromDataId(t.dataId,t.shape,e);if("complex64"===t.dtype){var s=n.real(t);return o=s.cast(e),s.dispose(),o}if("int32"===e)return n.int(t);if("bool"===e){var a=fn(0,t.dtype);return o=n.notEqual(t,a),a.dispose(),o}throw new Error("Error in Cast: failed to cast "+t.dtype+" to "+e)}function nr(t,e){return Pt.makeTensorFromDataId(t.dataId,e,t.dtype)}function ir(t,e,n){var i=(e-t)/(n-1),r=et(n,"float32");r[0]=t;for(var o=1;o<r.length;o++)r[o]=r[o-1]+i;return gn(r,"float32")}Object.freeze({castTensor:er,reshapeTensor:nr,linspaceImpl:ir,upcastType:It,axesAreInnerMostDims:qe,combineLocations:Ze,computeOutAndReduceShapes:Qe,expandShapeToKeepDim:tn,assertAxesAreInnerMostDims:en,getAxesPermutation:nn,getUndoAxesPermutation:rn,getInnerMostAxes:on,getBroadcastDims:Vi,getReductionAxes:Hi,assertAndGetBroadcastShape:Wi,assertParamsConsistent:sn,computeOutShape:an,computePool2DInfo:Gi,computePool3DInfo:ji,computeConv2DInfo:zi,computeConv3DInfo:$i,computeDefaultPad:Xi,tupleValuesAreOne:Zi,eitherStridesOrDilationsAreOne:Qi,convertConv2DDataFormat:tr,PARALLELIZE_THRESHOLD:Ei,computeOptimalWindowSize:Ci});function rr(t,e){if(t.length!==e.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+t.length+", imag: "+e.length+".");for(var n=new Float32Array(2*t.length),i=0;i<n.length;i+=2)n[i]=t[i/2],n[i+1]=e[i/2];return n}function or(t,e){return{real:t[2*e],imag:t[2*e+1]}}function sr(t,e,n,i){t[2*i]=e,t[2*i+1]=n}function ar(t,e,n){var i=(n?2:-2)*Math.PI*(t/e);return{real:Math.cos(i),imag:Math.sin(i)}}function lr(t,e,n){var i=function(t,e,n){return function(t,e,n){for(var i=0,r=t.length,o=0,s=!1;i<r;){var a=n(e,t[o=i+(r-i>>>1)]);a>0?i=o+1:(r=o,s=!a)}return s?i:-i-1}(t,e,n||ur)}(t,e,n),r=i<0?-(i+1):i;t.splice(r,0,e)}function ur(t,e){return t>e?1:t<e?-1:0}function cr(t,e,n,i,r){return pr(t,e,n,i,r,0).selectedIndices}function hr(t,e,n,i,r,o){var s=pr(t,e,n,i,r,o,!0);return s.numValidOutputs.dispose(),{selectedIndices:s.selectedIndices,selectedScores:s.selectedScores}}function pr(t,e,n,i,r,o,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1);for(var l=Array.from(e).map(function(t,e){return{score:t,boxIndex:e,suppressBeginIndex:0}}).filter(function(t){return t.score>r}).sort(gr),u=o>0?-.5/o:0,c=[],h=[];c.length<n&&l.length>0;){var p=l.pop(),d=p.score,f=p.boxIndex,g=p.suppressBeginIndex;if(d<r)break;for(var m=!1,v=c.length-1;v>=g;--v){var _=dr(t,f,c[v]);if(_>=i){m=!0;break}if(p.score=p.score*fr(i,u,_),p.score<=r)break}p.suppressBeginIndex=c.length,m||(p.score===d?(c.push(f),h.push(p.score)):p.score>r&&lr(l,p,gr))}var y=c.length;return a&&(c.fill(0,y),h.fill(0,y)),{selectedIndices:gn(c,"int32"),selectedScores:gn(h,"float32"),numValidOutputs:fn(y,"int32")}}function dr(t,e,n){var i=t.subarray(4*e,4*e+4),r=t.subarray(4*n,4*n+4),o=Math.min(i[0],i[2]),s=Math.min(i[1],i[3]),a=Math.max(i[0],i[2]),l=Math.max(i[1],i[3]),u=Math.min(r[0],r[2]),c=Math.min(r[1],r[3]),h=Math.max(r[0],r[2]),p=Math.max(r[1],r[3]),d=(a-o)*(l-s),f=(h-u)*(p-c);if(d<=0||f<=0)return 0;var g=Math.max(o,u),m=Math.max(s,c),v=Math.min(a,h),_=Math.min(l,p),y=Math.max(v-g,0)*Math.max(_-m,0);return y/(d+f-y)}function fr(t,e,n){var i=Math.exp(e*n*n);return n<=t?i:0}function gr(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}function mr(t,e,n){var i=new Array(t.rank).fill(0),r=t.shape.slice();return e.map(function(e){r[n]=e;var o=t.slice(i,r);return i[n]+=e,o})}function vr(t,e){for(var n=new Array(t.rank),i=0;i<n.length;i++)n[i]=t.shape[i]*e[i];var r=Gn(n,t.dtype);for(i=0;i<r.values.length;++i){for(var o=r.indexToLoc(i),s=new Array(t.rank),a=0;a<s.length;a++)s[a]=o[a]%t.shape[a];var l=t.locToIndex(s);r.values[i]=t.values[l]}return r.toTensor()}function _r(t,e,n,i,r){for(var o=e[e.length-1],s=[t.length/o,o],a=s[0],l=s[1],u=B(n,a*i),c=B("int32",a*i),h=0;h<a;h++){for(var p=h*l,d=t.subarray(p,p+l),f=[],g=0;g<d.length;g++)f.push({value:d[g],index:g});f.sort(function(t,e){return e.value-t.value});var m=h*i,v=u.subarray(m,m+i),_=c.subarray(m,m+i);for(g=0;g<i;g++)v[g]=f[g].value,_[g]=f[g].index}var y=e.slice();return y[y.length-1]=i,[pn(u,y,n),pn(c,y,"int32")]}function yr(t,e){for(var n=[],i=0;i<e.length;i++)e[i]&&n.push(i);var r=Gn(t,"int32"),o=Gn([n.length,t.length],"int32");for(i=0;i<n.length;i++){var s=r.indexToLoc(n[i]),a=i*t.length;o.values.set(s,a)}return o.toTensor()}function br(t,e){return["x","y","z","w","u","v"].slice(0,e).map(function(e){return t+"."+e})}function Tr(t,e){return 1===e?[t]:br(t,e)}function Er(){var t,e,n,i,r,o,s,a,l,u;return 2===c().getNumber("WEBGL_VERSION")?(t="#version 300 es",e="in",n="out",i="in",r="texture",o="outputColor",s="out vec4 outputColor;",a="\n bool isnan_custom(float val) {\n return (val > 0.0 || val < 0.0) ? false : val != 0.0;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ",l="",u="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(t="",e="attribute",n="varying",i="varying",r="texture2D",o="gl_FragColor",s="",a="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",l="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",u="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "),{version:t,attribute:e,varyingVs:n,varyingFs:i,texture2D:r,output:o,defineOutput:s,defineSpecialNaN:a,defineSpecialInf:l,defineRound:u}}function Cr(t,e,n){void 0===n&&(n="index");var i=q(e);return i.map(function(e,r){return"int "+t[r]+" = "+n+" / "+e+"; "+(r===i.length-1?"int "+t[r+1]+" = "+n+" - "+t[r]+" * "+e:"index -= "+t[r]+" * "+e)+";"}).join("")}function Sr(t){var e=q(t).map(function(t){return t.toString()});return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * "+e[0]+" + coords.y * "+e[1]+" + coords.z;\n }\n"}var wr="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n";function kr(t,e,n,i){var r=[];t.forEach(function(t){var e=x(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?r.push("uniform float "+t.name+(e>1?"["+e+"]":"")+";"):(r.push("uniform sampler2D "+t.name+";"),r.push("uniform int offset"+t.name+";"))});var o,s,a=r.join("\n"),l=t.map(function(t){return function(t,e,n){void 0===n&&(n=!1);var i="";i+=n?function t(e){var n,i,r;switch(e.shapeInfo.logicalShape.length){case 0:return n=e.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),r=Er(),"\n vec4 "+i+"() {\n return "+r.texture2D+"("+n+", halfCR);\n }\n ";case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1),i=t.shapeInfo.texShape,r=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],o=Er();return"\n vec4 "+n+"(int index) {\n vec2 uv = packedUVfrom1D(\n "+r[0]+", "+r[1]+", index);\n return "+o.texture2D+"("+e+", uv);\n }\n "}(e);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,i="get"+n.charAt(0).toUpperCase()+n.slice(1),r=t.shapeInfo.texShape,o=r[0],s=r[1],a=Er();if(null!=r&&I(e,r))return"\n vec4 "+i+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+s+".0, "+o+".0);\n\n return "+a.texture2D+"("+n+", uv);\n }\n ";var l=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],u=Math.ceil(e[1]/2);return"\n vec4 "+i+"(int row, int col) {\n vec2 uv = packedUVfrom2D("+u+", "+l[0]+", "+l[1]+", row, col);\n return "+a.texture2D+"("+n+", uv);\n }\n "}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=e.shapeInfo.texShape,s=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)];if(1===n[0]){var a=n.slice(1),l=Nr(e,a);return"\n "+t(l)+"\n vec4 "+r+"(int b, int row, int col) {\n return "+r+"("+Lr(["b","row","col"],[1,2])+");\n }\n "}var u=s[0],c=s[1],h=Math.ceil(n[2]/2),p=h*Math.ceil(n[1]/2),d=Er();return"\n vec4 "+r+"(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n "+u+", "+c+", "+p+", "+h+", b, row, col);\n return "+d.texture2D+"("+i+", uv);\n }\n "}(e);default:return function(t){for(var e=t.shapeInfo.logicalShape,n=e.length,i=t.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=t.shapeInfo.texShape,s=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)],a=s[0],l=s[1],u=Math.ceil(e[n-1]/2),c=u*Math.ceil(e[n-2]/2),h="int b, int row, int col",p="b * "+c+" + (row / 2) * "+u+" + (col / 2)",d=2;d<n-1;d++)h="int b"+d+", "+h,c*=e[n-d-1],p="b"+d+" * "+c+" + "+p;var f=Er();return"\n vec4 "+r+"("+h+") {\n int index = "+p+";\n int texR = index / "+l+";\n int texC = index - texR * "+l+";\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+l+", "+a+");\n return "+f.texture2D+"("+i+", uv);\n }\n "}(e)}}(t):function t(e){var n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"float "+n+"() {return "+e+";}";var i=t.shapeInfo.texShape,r=i[0],o=i[1];if(1===r&&1===o)return"\n float "+n+"() {\n return sampleTexture("+e+", halfCR);\n }\n ";var s=t.shapeInfo.texShape,a=s[0],l=s[1],u=Dr(e);return"\n float "+n+"() {\n vec2 uv = uvFromFlat("+a+", "+l+", "+u+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"\n float "+n+"(int index) {\n "+Ar(t)+"\n }\n ";var i=t.shapeInfo.texShape,r=i[0],o=i[1];if(1===o&&1===r)return"\n float "+n+"(int index) {\n return sampleTexture("+e+", halfCR);\n }\n ";var s=Dr(e);return 1===o?"\n float "+n+"(int index) {\n vec2 uv = vec2(0.5, (float(index + "+s+") + 0.5) / "+r+".0);\n return sampleTexture("+e+", uv);\n }\n ":1===r?"\n float "+n+"(int index) {\n vec2 uv = vec2((float(index + "+s+") + 0.5) / "+o+".0, 0.5);\n return sampleTexture("+e+", uv);\n }\n ":"\n float "+n+"(int index) {\n vec2 uv = uvFromFlat("+r+", "+o+", index + "+s+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 2:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=e.shapeInfo.texShape;if(null!=o&&I(n,o)){var s=o[0],a=o[1];return"\n float "+r+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+a+".0, "+s+".0);\n return sampleTexture("+i+", uv);\n }\n "}var l=P(n),u=l.newShape,c=l.keptDims,h=u;if(h.length<n.length){var p=Nr(e,h);return"\n "+t(p)+"\n float "+r+"(int row, int col) {\n return "+r+"("+Lr(["row","col"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+r+"(int row, int col) {\n int index = round(dot(vec2(row, col), vec2("+n[1]+", 1)));\n "+Ar(e)+"\n }\n ";var d=o[0],f=o[1],g=Dr(i);return 1===f?"\n float "+r+"(int row, int col) {\n float index = dot(vec3(row, col, "+g+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / "+d+".0);\n return sampleTexture("+i+", uv);\n }\n ":1===d?"\n float "+r+"(int row, int col) {\n float index = dot(vec3(row, col, "+g+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2((index + 0.5) / "+f+".0, 0.5);\n return sampleTexture("+i+", uv);\n }\n ":"\n float "+r+"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+n[1]+" + col + "+g+";\n vec2 uv = uvFromFlat("+d+", "+f+", index);\n return sampleTexture("+i+", uv);\n }\n"}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=n[1]*n[2],s=n[2],a=P(n),l=a.newShape,u=a.keptDims,c=l;if(c.length<n.length){var h=Nr(e,c);return"\n "+t(h)+"\n float "+r+"(int row, int col, int depth) {\n return "+r+"("+Lr(["row","col","depth"],u)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+r+"(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3("+o+", "+s+", 1)));\n "+Ar(e)+"\n }\n ";var p=e.shapeInfo.texShape,d=p[0],f=p[1],g=e.shapeInfo.flatOffset;if(f===o&&null==g)return"\n float "+r+"(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2("+s+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+f+".0, "+d+".0);\n return sampleTexture("+i+", uv);\n }\n ";if(f===s&&null==g)return"\n float "+r+"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2("+n[1]+", 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+f+".0, "+d+".0);\n return sampleTexture("+i+", uv);\n }\n ";var m=Dr(i);return"\n float "+r+"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+o+" + col * "+s+" + depth + "+m+";\n vec2 uv = uvFromFlat("+d+", "+f+", index);\n return sampleTexture("+i+", uv);\n }\n "}(e);case 4:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=n[3],s=n[2]*o,a=n[1]*s,l=P(n),u=l.newShape,c=l.keptDims;if(u.length<n.length){var h=Nr(e,u);return"\n "+t(h)+"\n float "+r+"(int row, int col, int depth, int depth2) {\n return "+r+"("+Lr(["row","col","depth","depth2"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+r+"(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4("+a+", "+s+", "+o+", 1)));\n "+Ar(e)+"\n }\n ";var p=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,f=d[0],g=d[1];if(g===a&&null==p)return"\n float "+r+"(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3("+s+", "+o+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+f+".0);\n return sampleTexture("+i+", uv);\n }\n ";if(g===o&&null==p)return"\n float "+r+"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3("+n[1]*n[2]+", "+n[2]+", 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+f+".0);\n return sampleTexture("+i+", uv);\n }\n ";var m=Dr(i);return"\n float "+r+"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+a+" + col * "+s+" +\n depth * "+o+" + depth2;\n vec2 uv = uvFromFlat("+f+", "+g+", index + "+m+");\n return sampleTexture("+i+", uv);\n }\n "}(e);case 5:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=n[4],s=n[3]*o,a=n[2]*s,l=n[1]*a,u=P(n),c=u.newShape,h=u.keptDims;if(c.length<n.length){var p=Nr(e,c);return"\n "+t(p)+"\n float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n return "+r+"("+Lr(["row","col","depth","depth2","depth3"],h)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4("+l+", "+a+", "+s+", "+o+")) +\n depth3;\n "+Ar(e)+"\n }\n ";var d=e.shapeInfo.flatOffset,f=e.shapeInfo.texShape,g=f[0],m=f[1];if(m===l&&null==d)return"\n float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+a+", "+s+", "+o+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+g+".0);\n return sampleTexture("+i+", uv);\n }\n ";if(m===o&&null==d)return"\n float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]+",\n "+n[2]*n[3]+", "+n[3]+", 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+g+".0);\n return sampleTexture("+i+", uv);\n }\n ";var v=Dr(i);return"\n float "+r+"(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+l+" + col * "+a+" + depth * "+s+" +\n depth2 * "+o+" + depth3 + "+v+";\n vec2 uv = uvFromFlat("+g+", "+m+", index);\n return sampleTexture("+i+", uv);\n }\n "}(e);case 6:return function(e){var n=e.shapeInfo.logicalShape,i=e.name,r="get"+i.charAt(0).toUpperCase()+i.slice(1),o=P(n),s=o.newShape,a=o.keptDims;if(s.length<n.length){var l=Nr(e,s);return"\n "+t(l)+"\n float "+r+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return "+r+"("+Lr(["row","col","depth","depth2","depth3","depth4"],a)+");\n }\n "}var u=n[5],c=n[4]*u,h=n[3]*c,p=n[2]*h,d=n[1]*p;if(e.shapeInfo.isUniform)return"\n float "+r+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4("+d+", "+p+", "+h+", "+c+")) +\n dot(\n vec2(depth3, depth4),\n vec2("+u+", 1)));\n "+Ar(e)+"\n }\n ";var f=e.shapeInfo.flatOffset,g=e.shapeInfo.texShape,m=g[0],v=g[1];if(v===d&&null==f)return"\n float "+r+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+p+", "+h+", "+c+", "+u+")) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+m+".0);\n return sampleTexture("+i+", uv);\n }\n ";if(v===u&&null==f)return"\n float "+r+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]*n[4]+",\n "+n[2]*n[3]*n[4]+",\n "+n[3]*n[4]+",\n "+n[4]+")) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+m+".0);\n return sampleTexture("+i+", uv);\n }\n ";var _=Dr(i);return"\n float "+r+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+d+" + col * "+p+" + depth * "+h+" +\n depth2 * "+c+" + depth3 * "+u+" + depth4 + "+_+";\n vec2 uv = uvFromFlat("+m+", "+v+", index);\n return sampleTexture("+i+", uv);\n }\n "}(e);default:throw new Error(n.length+"-D input sampling is not yet supported")}}(t);var r=t.shapeInfo.logicalShape,o=e.logicalShape;return r.length<=o.length&&(i+=n?function(t,e){var n,i=t.name,r=i.charAt(0).toUpperCase()+i.slice(1),o="get"+r+"AtOutCoords",s=t.shapeInfo.logicalShape.length,a=e.logicalShape.length,l=Vi(t.shapeInfo.logicalShape,e.logicalShape),u=Mr(a),c=a-s,h=["x","y","z","w","u","v"];n=0===s?"":a<2&&l.length>=1?"coords = 0;":l.map(function(t){return"coords."+h[t+c]+" = 0;"}).join("\n");var p;p=a<2&&s>0?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+h[e+c]}).join(", ");var d="return outputValue;",f=1===x(t.shapeInfo.logicalShape),g=1===x(e.logicalShape);if(1!==s||f||g){if(f&&!g)d=1===a?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(l.length){var m=s-2,v=s-1;l.indexOf(m)>-1&&l.indexOf(v)>-1?d="return vec4(outputValue.x);":l.indexOf(m)>-1?d="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":l.indexOf(v)>-1&&(d="return vec4(outputValue.xx, outputValue.zz);")}}else d="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 "+o+"() {\n "+u+" coords = getOutputCoords();\n "+n+"\n vec4 outputValue = get"+r+"("+p+");\n "+d+"\n }\n "}(t,e):function(t,e){var n=t.name,i=n.charAt(0).toUpperCase()+n.slice(1),r="get"+i+"AtOutCoords",o=e.texShape,s=t.shapeInfo.texShape,a=t.shapeInfo.logicalShape.length,l=e.logicalShape.length;if(!t.shapeInfo.isUniform&&a===l&&null==t.shapeInfo.flatOffset&&I(s,o))return"\n float "+r+"() {\n return sampleTexture("+n+", resultUV);\n }\n ";var u=Mr(l),c=Vi(t.shapeInfo.logicalShape,e.logicalShape),h=l-a,p=["x","y","z","w","u","v"];return"\n float "+r+"() {\n "+u+" coords = getOutputCoords();\n "+(0===a?"":l<2&&c.length>=1?"coords = 0;":c.map(function(t){return"coords."+p[t+h]+" = 0;"}).join("\n"))+"\n return get"+i+"("+(l<2&&a>0?"coords":t.shapeInfo.logicalShape.map(function(t,e){return"coords."+p[e+h]}).join(", "))+");\n }\n "}(t,e)),i}(t,e,i)}).join("\n"),u=e.texShape,c=Er(),h="\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return "+c.texture2D+"(textureSampler, uv).r;\n }\n ",p=function(t){return t.version+"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n "+t.varyingFs+" vec2 resultUV;\n "+t.defineOutput+"\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n "+t.defineSpecialNaN+"\n "+t.defineSpecialInf+"\n "+t.defineRound+"\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n "+xr+"\n "+Ir+"\n "+Rr+"\n "}(c);return e.isPacked?(o=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * "+n[1]+".0);\n }\n ":1===n[1]?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * "+n[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n return 2 * (resTexRC.x * "+n[1]+" + resTexRC.y);\n }\n "}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(I(t,e))return"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2("+n[0]+", "+n[1]+"));\n }\n ";var i=Math.ceil(t[1]/2);return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n int r = 2 * (index / "+i+");\n int c = imod(index, "+i+") * 2;\n\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=t,i=e,r=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],s=(o=Math.ceil(n[2]/2))*Math.ceil(n[1]/2),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+r[0]+", "+r[1]+"));\n int index = resTexRC.x * "+r[1]+" + resTexRC.y;\n\n int b = index / "+s+";\n index -= b * "+s+";\n\n int r = 2 * (index / "+o+");\n int c = imod(index, "+o+") * 2;\n\n return ivec3(b, r, c);\n }\n ";default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],i=Math.ceil(t[t.length-1]/2),r=i*Math.ceil(t[t.length-2]/2),o=r,s="",a="b, r, c",l=2;l<t.length-1;l++)s="\n int b"+l+" = index / "+(o*=t[t.length-l-1])+";\n index -= b"+l+" * "+o+";\n "+s,a="b"+l+", "+a;return"\n ivec"+t.length+" getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n\n "+s+"\n\n int b = index / "+r+";\n index -= b * "+r+";\n\n int r = 2 * (index / "+i+");\n int c = imod(index, "+i+") * 2;\n\n return ivec"+t.length+"("+a+");\n }\n "}(t,e)}var n,i,r,o,s}(e.logicalShape,u),s="\n void setOutput(vec4 val) {\n "+c.output+" = val;\n }\n "):(o=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){return 1===e[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+e[1]+".0);\n }\n ":1===e[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+e[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n return resTexRC.x * "+e[1]+" + resTexRC.y;\n }\n "}(0,e);case 2:return function(t,e){return I(t,e)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+e[0]+", "+e[1]+"));\n }\n ":1===t[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===t[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n int r = index / "+t[1]+";\n int c = index - r * "+t[1]+";\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=e,i=Cr(["r","c","d"],t),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n "+i+"\n return ivec3(r, c, d);\n }\n ";case 4:return function(t,e){var n=Cr(["r","c","d","d2"],t);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n "+n+"\n return ivec4(r, c, d, d2);\n }\n "}(t,e);case 5:return function(t,e){var n=Cr(["r","c","d","d2","d3"],t);return"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2("+e[0]+",\n "+e[1]+"));\n\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n "}(t,e);case 6:return function(t,e){var n=Cr(["r","c","d","d2","d3","d4"],t);return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n "}(t,e);default:throw new Error(t.length+"-D output sampling is not yet supported")}var n,i}(e.logicalShape,u),s="\n void setOutput(float val) {\n "+c.output+" = vec4(val, 0, 0, 0);\n }\n "),i&&(p+=Or),[p,h,s,a,o,l,n].join("\n")}var xr="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Ir="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Rr="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Or="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function Dr(t){return"offset"+t}function Ar(t){var e=t.name,n=x(t.shapeInfo.logicalShape);return n<2?"return "+e+";":"\n for (int i = 0; i < "+n+"; i++) {\n if (i == index) {\n return "+e+"[i];\n }\n }\n "}function Mr(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error("GPU for rank "+t+" is not yet supported")}function Nr(t,e){var n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function Lr(t,e){return e.map(function(e){return t[e]}).join(", ")}var Pr=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Wi(e,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n "+t+"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n "},Br="return a + b;",Fr="return a - b;",Ur="return a * b;",Vr="return (a < 0.) ? b * a : a;",Hr=function(t,e,n){this.variableNames=["A","B"],this.outputShape=Wi(e,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+t+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},Wr="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n",Gr=function(t,e,n,i){void 0===i&&(i=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Wi(e,n);var r=this.outputShape.length,o="";if(i)if(0===r||1===x(this.outputShape))o="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else if(o="\n "+Mr(r)+" coords = getOutputCoords();\n ",1===r)o+="\n result.y = (coords + 1) >= "+this.outputShape[0]+" ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ";else{var s=Tr("coords",r);o+="\n bool nextRowOutOfBounds =\n ("+s[r-2]+" + 1) >= "+this.outputShape[r-2]+";\n bool nextColOutOfBounds =\n ("+s[r-1]+" + 1) >= "+this.outputShape[r-1]+";\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n "}this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n "+t+"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n "+o+"\n\n setOutput(result);\n }\n "},jr=function(){function t(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(i,r){null==n.minLoc&&(n.minLoc=i.getUniformLocationNoThrow(r,"minVal"),n.maxLoc=i.getUniformLocationNoThrow(r,"maxVal")),i.gl.uniform1f(n.minLoc,t),i.gl.uniform1f(n.maxLoc,e)}},t}(),zr=function(){function t(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\n\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(i,r){null==n.minLoc&&(n.minLoc=i.getUniformLocationNoThrow(r,"minVal"),n.maxLoc=i.getUniformLocationNoThrow(r,"maxVal")),i.gl.uniform1f(n.minLoc,t),i.gl.uniform1f(n.maxLoc,e)}},t}();function $r(t,e,n){var i=t.indexOf(e);return t.map(function(t,e){return e===i?t+" - "+n:t}).join()}var Xr=function(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===i&&(i=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var r=t.padInfo.top,o=t.padInfo.left,s=t.strideHeight,a=t.strideWidth,l=t.dilationHeight,u=t.dilationWidth,c=t.filterHeight,h=t.filterWidth,p=4*Math.floor(t.inChannels/4),d=t.inChannels%4,f="channelsLast"===t.dataFormat,g=f?1:2,m=f?2:3,v=f?3:1,_="",y="";n&&(_=i?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",y="result = activation(result);");var b=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+_+"\n\n const ivec2 strides = ivec2("+s+", "+a+");\n const ivec2 pads = ivec2("+r+", "+o+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords["+v+"];\n\n ivec2 xRCCorner =\n ivec2(coords["+g+"], coords["+m+"]) * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+c+"; wR++) {\n int xR = xRCorner + wR * "+l+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+h+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+p+"; d1 += 4) {\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n if ("+f+") {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if ("+(1===d)+") {\n\n if ("+f+") {\n dotProd +=\n getX(batch, xR, xC, "+p+") *\n getW(wR, wC, "+p+", d2);\n } else {\n dotProd +=\n getX(batch, "+p+", xR, xC) *\n getW(wR, wC, "+p+", d2);\n }\n\n } else if ("+(2===d)+") {\n vec2 wValues = vec2(\n getW(wR, wC, "+p+", d2),\n getW(wR, wC, "+p+" + 1, d2)\n );\n\n if ("+f+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+p+"),\n getX(batch, xR, xC, "+p+" + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, "+p+", xR, xC),\n getX(batch, "+p+" + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if ("+(3===d)+") {\n vec3 wValues = vec3(\n getW(wR, wC, "+p+", d2),\n getW(wR, wC, "+p+" + 1, d2),\n getW(wR, wC, "+p+" + 2, d2)\n );\n\n if ("+f+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+p+"),\n getX(batch, xR, xC, "+p+" + 1),\n getX(batch, xR, xC, "+p+" + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, "+p+", xR, xC),\n getX(batch, "+p+" + 1, xR, xC),\n getX(batch, "+p+" + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n "+b+"\n "+y+"\n setOutput(result);\n }\n "},Yr=function(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===i&&(i=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var r=t.inHeight,o=t.inWidth,s=t.padInfo.top,a=t.padInfo.left,l=t.strideHeight,u=t.strideWidth,c=t.dilationHeight,h=t.dilationWidth,p=t.filterHeight,d=t.filterWidth,f=t.outChannels/t.inChannels,g="",m="";n&&(g=i?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",m="result = activation(result);");var v=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+g+"\n\n const ivec2 strides = ivec2("+l+", "+u+");\n const ivec2 pads = ivec2("+s+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+f+";\n int q = d2 - d1 * "+f+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+p+"; wR++) {\n int xR = xRCorner + wR * "+c+";\n\n if (xR < 0 || xR >= "+r+") {\n continue;\n }\n\n for (int wC = 0; wC < "+d+"; wC++) {\n int xC = xCCorner + wC * "+h+";\n\n if (xC < 0 || xC >= "+o+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n\n float result = dotProd;\n "+v+"\n "+m+"\n setOutput(result);\n }\n "},Kr=function(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===i&&(i=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.outShape;for(var r=t.inHeight,o=t.inWidth,s=t.padInfo.top,a=t.padInfo.left,l=t.strideHeight,u=t.strideWidth,c=t.dilationHeight,h=t.dilationWidth,p=t.filterHeight,d=t.filterWidth,f=d,g="int xR; int xC; int xCOffset;",m=0;m<p;m++)for(var v=0;v<d;v++)g+="\n vec4 xTexelR"+m+"C"+2*v+" = vec4(0.);\n vec4 wR"+m+"C"+v+" = vec4(0.);\n vec4 xR"+m+"C"+v+" = vec4(0.);";for(m=0;m<p;m++)for(var _=0;_<f;_++){if(g+="\n xR = xRCorner + "+m*c+";\n xC = xCCorner + "+(v=2*_)*h+";\n ",1===u){if(v<d&&(g+=a%2==1?"\n xCOffset = xC + 1;\n if(xR >= 0 && xR < "+r+" && xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+v+" = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if(xCOffset + 1 >= "+o+") {\n xTexelR"+m+"C"+v+".zw = vec2(0.);\n }\n } else {\n xTexelR"+m+"C"+v+" = vec4(0.);\n }\n\n xCOffset = xC + 1 - 2;\n if(xR >= 0 && xR < "+r+" && xCOffset >= 0 && xCOffset < "+o+") {\n vec4 previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if(xCOffset + 1 >= "+o+") {\n previous.zw = vec2(0.);\n }\n\n xR"+m+"C"+v+" = vec4(previous.zw, xTexelR"+m+"C"+v+".xy);\n } else {\n xR"+m+"C"+v+" = vec4(0, 0, xTexelR"+m+"C"+v+".xy);\n }\n ":"\n if(xR >= 0 && xR < "+r+" && xC >= 0 && xC < "+o+") {\n xTexelR"+m+"C"+v+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+m+"C"+v+" = vec4(0.);\n }\n\n xR"+m+"C"+v+" = xTexelR"+m+"C"+v+";\n ",v+1<d)){var y=a%2==0?T(h):h;h%2==0&&a%2==1||h%2!=0&&a%2!=1?(g+="\n xCOffset = xC + "+a%2+" + "+y+";\n\n if(xR >= 0 && xR < "+r+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n }\n ",h>1&&(g+="\n xCOffset -= 2;\n if(xR >= 0 && xR < "+r+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+v+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+m+"C"+v+" = vec4(0.);\n }\n "),g+="\n xR"+m+"C"+(v+1)+" = vec4(\n xTexelR"+m+"C"+v+".zw, xTexelR"+m+"C"+(v+2)+".xy);\n "):g+="\n xCOffset = xC + "+y+";\n\n if(xR >= 0 && xR < "+r+" &&\n xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n }\n\n xR"+m+"C"+(v+1)+" = xTexelR"+m+"C"+(v+2)+";\n "}}else v<d&&(g+="\n if(xR >= 0 && xR < "+r+") {\n ",a%2==1?(g+="\n xCOffset = xC + 1 - "+u+";\n if(xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+v+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+m+"C"+v+" = vec4(0.);\n }\n\n if(xC + 1 >= 0 && xC + 1 < "+o+") {\n xTexelR"+m+"C"+(v+2)+" = getX(batch, xR, xC + 1, d1);\n } else {\n xTexelR"+m+"C"+(v+2)+" = vec4(0.);\n }\n\n xR"+m+"C"+v+" = vec4(\n xTexelR"+m+"C"+v+".zw, xTexelR"+m+"C"+(v+2)+".zw);\n ",v+1<d&&(g+="\n vec4 final = vec4(0.);\n xCOffset = xC + 1 + "+u+";\n if(xCOffset >= 0 && xCOffset < "+o+") {\n final = getX(batch, xR, xCOffset, d1);\n }\n xR"+m+"C"+(v+1)+" = vec4(xTexelR"+m+"C"+(v+2)+".xy, final.xy);\n ")):(g+="\n if(xC >= 0 && xC < "+o+") {\n xTexelR"+m+"C"+v+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+m+"C"+v+" = vec4(0.);\n }\n\n xCOffset = xC + "+u+";\n if(xCOffset >= 0 && xCOffset < "+o+") {\n xTexelR"+m+"C"+(v+2)+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+m+"C"+(v+2)+" = vec4(0.);\n }\n\n xR"+m+"C"+v+" = vec4(\n xTexelR"+m+"C"+v+".xy, xTexelR"+m+"C"+(v+2)+".xy);\n ",v+1<d&&(g+="\n xR"+m+"C"+(v+1)+" = vec4(\n xTexelR"+m+"C"+v+".zw, xTexelR"+m+"C"+(v+2)+".zw);\n ")),g+="}");v<d&&(g+="\n vec4 wTexelR"+m+"C"+v+" = getW("+m+", "+v+", d1, q);\n wR"+m+"C"+v+" = vec4(wTexelR"+m+"C"+v+".xz, wTexelR"+m+"C"+v+".xz);\n ",v+1<d&&(g+="\n vec4 wTexelR"+m+"C"+(v+1)+" = getW("+m+", "+(v+1)+", d1, q);\n wR"+m+"C"+(v+1)+" =\n vec4(wTexelR"+m+"C"+(v+1)+".xz, wTexelR"+m+"C"+(v+1)+".xz);"))}for(m=0;m<p;m++)for(v=0;v<d;v++)g+="dotProd += xR"+m+"C"+v+" * wR"+m+"C"+v+";";var b="",E="";n&&(b=i?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"vec4 activation(vec4 x) {\n "+n+"\n }",E="result = activation(result);");var C=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),i&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+b+"\n\n const ivec2 strides = ivec2("+l+", "+u+");\n const ivec2 pads = ivec2("+s+", "+a+");\n\n void main() {\n\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2;\n int q = 0;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n vec4 dotProd = vec4(0.);\n\n "+g+"\n\n vec4 result = dotProd;\n "+C+"\n "+E+"\n setOutput(result);\n }\n "};function Jr(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var qr=function(){function t(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+e+";\n int offset_h = imod(h, "+e+");\n int in_w = w / "+e+";\n int offset_w = imod(w, "+e+");\n int offset_d = (offset_h * "+e+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n "}return t.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},t.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},t.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},t.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},t}(),Zr=function(t,e,n){this.variableNames=["real","imag"];var i=e[1];this.outputShape=e;var r=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,o=n?i+".0":"1.0";this.userCode="\n const float exponentMultiplier = "+r+";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n "+t+"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float("+i+");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < "+i+"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / "+o+";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n "},Qr=function(){function t(t,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=t,this.userCode="\n uniform float value;\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,i){null==e.valueLoc&&(e.valueLoc=n.getUniformLocationNoThrow(i,"value")),n.gl.uniform1f(e.valueLoc,t)}},t}();function to(t,e){var n=Er();return ne(t,e,n.version+"\n precision highp float;\n "+n.attribute+" vec3 clipSpacePos;\n "+n.attribute+" vec2 uv;\n "+n.varyingVs+" vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function eo(t,e){return ce(t,e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function no(t,e){return he(t,e,new Uint16Array([0,1,2,2,1,3]))}function io(t,e,n,i,r,o,s){de(n,i);var a=pe(t,e),l=t.TEXTURE_2D;return Jt(t,e,function(){return t.bindTexture(l,a)}),Jt(t,e,function(){return t.texParameteri(l,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)}),Jt(t,e,function(){return t.texParameteri(l,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}),Jt(t,e,function(){return t.texParameteri(l,t.TEXTURE_MIN_FILTER,t.NEAREST)}),Jt(t,e,function(){return t.texParameteri(l,t.TEXTURE_MAG_FILTER,t.NEAREST)}),Jt(t,e,function(){return t.texImage2D(l,0,r,n,i,0,o,s,null)}),Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)}),a}function ro(t,e,n,i,r){var o=$t(n,i);return io(t,e,o[0],o[1],r.internalFormatFloat,r.textureFormatFloat,t.FLOAT)}function oo(t,e,n,i,r){var o=$t(n,i);return io(t,e,o[0],o[1],r.internalFormatHalfFloat,r.textureFormatFloat,r.textureTypeHalfFloat)}function so(t,e,n,i,r){var o=$t(n,i);return io(t,e,o[0],o[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function ao(t,e,n,i,r){var o=Yt(n,i);return io(t,e,o[0],o[1],r.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function lo(t,e,n,i,r){var o=Yt(n,i);return io(t,e,o[0],o[1],r.internalFormatPackedHalfFloat,t.RGBA,r.textureTypeHalfFloat)}function uo(t,e,n,i){return Jt(t,e,function(){return t.bindBuffer(t.ARRAY_BUFFER,i)}),ge(t,e,n,"clipSpacePos",i,3,20,0)&&ge(t,e,n,"uv",i,2,20,12)}function co(t,e,n,i,r,o,s){var a,l,u;Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),o instanceof Uint8Array?(a=new Uint8Array(i*r*4),l=t.UNSIGNED_BYTE,u=t.RGBA):(a=new Float32Array(i*r*4),l=t.FLOAT,u=s.internalFormatPackedFloat),a.set(o),Jt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,u,i,r,0,t.RGBA,l,a)}),Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function ho(t,e,n,i){Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,n)}),i.data instanceof Uint8Array?Jt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,i.width,i.height,0,t.RGBA,t.UNSIGNED_BYTE,i.data)}):Jt(t,e,function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}),Jt(t,e,function(){return t.bindTexture(t.TEXTURE_2D,null)})}function po(t,e,n,i,r){var o=t.createBuffer();Jt(t,e,function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,o)});var s=16*n*i;return Jt(t,e,function(){return t.bufferData(t.PIXEL_PACK_BUFFER,s,t.STREAM_READ)}),Jt(t,e,function(){return t.readPixels(0,0,i,n,t.RGBA,t.FLOAT,0)}),Jt(t,e,function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}),o}function fo(t,e,n){var i=t,r=new Float32Array(n);return i.bindBuffer(i.PIXEL_PACK_BUFFER,e),i.getBufferSubData(i.PIXEL_PACK_BUFFER,0,r),i.bindBuffer(i.PIXEL_PACK_BUFFER,null),r}function go(t,e,n,i,r){var o=$t(n,i),s=o[0],a=o[1],l=new Uint8Array(n*i*4);return Jt(t,e,function(){return t.readPixels(0,0,s,a,r.downloadTextureFormat,t.UNSIGNED_BYTE,l)}),new Float32Array(l.buffer)}function mo(t,e,n,i,r,o,s,a){var l=t,u=new Float32Array(function(t,e){var n=Yt(o,s);return n[0]*n[1]*4}());return l.bindBuffer(l.PIXEL_PACK_BUFFER,e),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,u),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),u}function vo(t,e,n,i){var r=new Float32Array(n*i*4);return Jt(t,e,function(){return t.readPixels(0,0,i,n,t.RGBA,t.FLOAT,r)}),r}var _o=Object.freeze({createVertexShader:to,createVertexBuffer:eo,createIndexBuffer:no,createFloat32MatrixTexture:ro,createFloat16MatrixTexture:oo,createUnsignedBytesMatrixTexture:so,createPackedMatrixTexture:ao,createFloat16PackedMatrixTexture:lo,bindVertexProgramAttributeStreams:uo,uploadDenseMatrixToTexture:co,uploadPixelDataToTexture:ho,createBufferFromOutputTexture:po,downloadFloat32MatrixFromBuffer:fo,downloadByteEncodedFloatMatrixFromOutputTexture:go,downloadPackedMatrixFromBuffer:mo,downloadMatrixFromPackedOutputTexture:vo}),yo=function(){function t(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=c().getNumber("WEBGL_VERSION");null!=t?(this.gl=t,jt(e,t)):this.gl=zt(e);var n="WEBGL_color_buffer_float";if(1===c().getNumber("WEBGL_VERSION")){if(this.textureFloatExtension=ee(this.gl,this.debug,"OES_texture_float"),Le(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=ee(this.gl,this.debug,"OES_texture_half_float");else if(c().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),Le(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=ee(this.gl,this.debug,"EXT_color_buffer_half_float");else if(c().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",Le(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!Le(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=eo(this.gl,this.debug),this.indexBuffer=no(this.gl,this.debug),this.framebuffer=fe(this.gl,this.debug),this.textureConfig=Kt(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(t.prototype,"debug",{get:function(){return c().getBool("DEBUG")},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;Jt(e,this.debug,function(){return e.finish()}),Jt(e,this.debug,function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)}),Jt(e,this.debug,function(){return e.deleteFramebuffer(t.framebuffer)}),Jt(e,this.debug,function(){return e.bindBuffer(e.ARRAY_BUFFER,null)}),Jt(e,this.debug,function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)}),Jt(e,this.debug,function(){return e.deleteBuffer(t.indexBuffer)}),this.disposed=!0}},t.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),ro(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),oo(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),so(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),ho(this.gl,this.debug,t,e)},t.prototype.uploadDenseMatrixToTexture=function(t,e,n,i){this.throwIfDisposed(),co(this.gl,this.debug,t,e,n,i,this.textureConfig)},t.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),lo(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),ao(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&&(Te(this.gl,this.debug,this.framebuffer),this.outputTexture=null),Jt(this.gl,this.debug,function(){return e.gl.deleteTexture(t)})},t.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var i=this;return this.downloadMatrixDriver(t,function(){return go(i.gl,i.debug,e,n,i.textureConfig)})},t.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,i,r,o){return mo(this.gl,t,0,0,0,r,o,this.textureConfig)},t.prototype.downloadFloat32MatrixFromBuffer=function(t,e){return fo(this.gl,t,e)},t.prototype.createBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var i=po(this.gl,this.debug,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),i},t.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},t.prototype.createFence=function(t){var e,n,i=this;if(c().getBool("WEBGL_FENCE_API_ENABLED")){var r=t,o=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=r.clientWaitSync(o,0,0);return t===r.ALREADY_SIGNALED||t===r.CONDITION_SATISFIED},e=o}else c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),n=function(){return i.isQueryAvailable(e,c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:e,isFencePassed:n}},t.prototype.downloadMatrixFromPackedTexture=function(t,e,n){var i=this;return this.downloadMatrixDriver(t,function(){return vo(i.gl,i.debug,e,n)})},t.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=ie(e,this.debug,t),i=to(e,this.debug),r=ae(e,this.debug);return Jt(e,this.debug,function(){return e.attachShader(r,i)}),Jt(e,this.debug,function(){return e.attachShader(r,n)}),le(e,this.debug,r),this.debug&&ue(e,this.debug,r),this.vertexAttrsAreBound||(this.setProgram(r),this.vertexAttrsAreBound=uo(e,this.debug,this.program,this.vertexBuffer)),r},t.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&&(this.program=null),null!=t&&Jt(this.gl,this.debug,function(){return e.gl.deleteProgram(t)})},t.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&&this.debug&&ue(this.gl,this.debug,this.program),Jt(this.gl,this.debug,function(){return e.gl.useProgram(t)})},t.prototype.getUniformLocation=function(t,e,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?ve(this.gl,this.debug,t,e):_e(this.gl,t,e)},t.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),Jt(this.gl,this.debug,function(){return n.gl.getAttribLocation(t,e)})},t.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},t.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),ye(this.gl,this.debug,this.program,t,e,n)},t.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},t.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var i=Yt(e,n),r=i[0],o=i[1];this.setOutputMatrixTextureDriver(t,r,o)},t.prototype.setOutputMatrixWriteRegion=function(t,e,n,i){this.setOutputMatrixWriteRegionDriver(n,t,i,e)},t.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,i){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},t.prototype.debugValidate=function(){null!=this.program&&ue(this.gl,this.debug,this.program),Ee(this.gl)},t.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.debug&&this.debugValidate(),Jt(t,this.debug,function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)})},t.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),Jt(this.gl,this.debug,function(){return t.gl.finish()})},t.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=ee(this.gl,this.debug,2===c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},t.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},t.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},t.prototype.beginQuery=function(){if(2===c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var i=this.getQueryTimerExtensionWebGL1(),r=i.createQueryEXT();return i.beginQueryEXT(i.TIME_ELAPSED_EXT,r),r},t.prototype.endQuery=function(){if(2!==c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},t.prototype.waitForQueryAndGetTime=function(t){return a(this,void 0,void 0,function(){var e=this;return l(this,function(n){switch(n.label){case 0:return[4,M(function(){return e.disposed||e.isQueryAvailable(t,c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))})];case 1:return n.sent(),[2,this.getQueryTime(t,c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}})})},t.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var i=this.getQueryTimerExtensionWebGL1();return i.getQueryObjectEXT(t,i.QUERY_RESULT_EXT)/1e6},t.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2===e){var n=this.gl,i=this.getQueryTimerExtensionWebGL2(),r=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(i.GPU_DISJOINT_EXT)),r&&!this.disjoint}return r=(i=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,i.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(i.GPU_DISJOINT_EXT)),r&&!this.disjoint},t.prototype.pollFence=function(t){var e=this;return new Promise(function(n){e.addItemToPoll(function(){return t.isFencePassed()},function(){return n()})})},t.prototype.pollItems=function(){for(var t=function(t){for(var e=0;e<t.length&&t[e]();++e);return e-1}(this.itemsToPoll.map(function(t){return t.isDoneFn})),e=0;e<=t;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(t+1)},t.prototype.addItemToPoll=function(t,e){var n=this;this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||M(function(){return n.pollItems(),0===n.itemsToPoll.length})},t.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),be(this.gl,this.debug,t,this.framebuffer),this.debug&&Ee(this.gl)},t.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(be(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&Ee(this.gl)):Te(this.gl,this.debug,this.framebuffer)},t.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},t.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var i=this.gl;be(i,this.debug,t,this.framebuffer),this.debug&&Ee(i),this.outputTexture=t,Jt(i,this.debug,function(){return i.viewport(0,0,e,n)}),Jt(i,this.debug,function(){return i.scissor(0,0,e,n)})},t.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,i){var r=this;this.throwIfDisposed(),Jt(this.gl,this.debug,function(){return r.gl.scissor(t,e,n,i)})},t.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},t.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},t}();function bo(t,e){if(t.length!==e.length)throw Error("Binary was compiled with "+t.length+" inputs, but was executed with "+e.length+" inputs");t.forEach(function(t,n){var i=t.logicalShape,r=e[n],o=r.shape;if(!I(i,o))throw Error("Binary was compiled with different shapes than the current args. Shapes "+i+" and "+o+" must match");if(!t.isUniform||!r.isUniform){var s=t.texShape,a=r.isUniform?null:r.texData.texShape;if(!I(s,a))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+s+" and "+a+" must match")}})}var To=function(t,e,n,i,r,o,s){void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===s&&(s=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;var a=n?t[1]:t[2],l=Math.ceil(a/2),u=n?"i * 2, rc.y":"rc.y, i * 2",c=i?"rc.z, i * 2":"i * 2, rc.z",h=n?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],p=i?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],d="",f="";o&&(d=s?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n "+o+"\n }":"vec4 activation(vec4 x) {\n "+o+"\n }",f="result = activation(result);");var g=r?"result += getBiasAtOutCoords();":"";r&&this.variableNames.push("bias"),s&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+d+"\n\n const float sharedDimension = "+l+".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < "+l+"; i++) {\n vec4 a = getMatrixA(rc.x, "+u+");\n vec4 b = getMatrixB(rc.x, "+c+");\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += ("+h[0]+" * "+p[0]+");\n result += ("+h[1]+" * "+p[1]+");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n "+g+"\n\n "+f+"\n\n setOutput(result);\n }\n "},Eo=function(){function t(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(e-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(e-1)+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,i){null==e.seedLoc&&(e.seedLoc=n.getUniformLocation(i,"seed")),n.gl.uniform1f(e.seedLoc,t)}},t}(),Co=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var i=t.filterWidth,r=t.strideHeight,o=t.strideWidth,s=t.dilationHeight,a=t.dilationWidth,l=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=t.padInfo.top,h=t.padInfo.left;this.outputShape=t.outShape;var p="avg"===e,d="0.0";if(p||(d="-1.0 / 1e-20"),n)this.userCode="\n const ivec2 strides = ivec2("+r+", "+o+");\n const ivec2 pads = ivec2("+c+", "+h+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < "+l+";\n wR += "+s+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+u+";\n wC += "+a+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+u+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var f=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(f="avgValue / count");var g=4*Math.floor(i/4),m=i%4,v="\n if ("+p+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+r+", "+o+");\n const ivec2 pads = ivec2("+c+", "+h+");\n const float initializationValue = "+d+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+d+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+l+";\n wR += "+s+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+g+"; wC += 4) {\n int xC = xCCorner + wC * "+a+";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+a+", d),\n getValue(batch, xR, xC + 2 * "+a+", d),\n getValue(batch, xR, xC + 3 * "+a+", d)\n );\n\n "+v+"\n }\n\n int xC = xCCorner + "+g+";\n if ("+(1===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+v+"\n } else if ("+(2===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+a+", d),\n initializationValue,\n initializationValue\n );\n\n "+v+"\n } else if ("+(3===m)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+a+", d),\n getValue(batch, xR, xC + 2 * "+a+", d),\n initializationValue\n );\n\n "+v+"\n }\n }\n setOutput("+f+");\n }\n "}},So=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var i=t.filterWidth,r=t.strideDepth,o=t.strideHeight,s=t.strideWidth,a=t.dilationDepth,l=t.dilationHeight,u=t.dilationWidth,c=t.effectiveFilterDepth,h=t.effectiveFilterHeight,p=t.effectiveFilterWidth,d=t.padInfo.front,f=t.padInfo.top,g=t.padInfo.left;this.outputShape=t.outShape;var m="avg"===e,v="0.0";if(m||(v="-1.0 / 1e-20"),n)this.userCode="\n const ivec3 strides =\n ivec3("+r+", "+o+", "+s+");\n const ivec3 pads = ivec3("+d+", "+f+", "+g+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < "+c+";\n wD += "+a+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+h+";\n wR += "+l+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+";\n wC += "+u+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition =\n wD * "+h+" * "+p+" +\n wR * "+p+" + wC;;\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var _=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(_="avgValue / count");var y=4*Math.floor(i/4),b=i%4,T="\n if ("+m+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec3 strides =\n ivec3("+r+", "+o+", "+s+");\n const ivec3 pads = ivec3("+d+", "+f+", "+g+");\n const float initializationValue = "+v+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4("+v+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < "+c+";\n wD += "+a+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+h+";\n wR += "+l+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+y+"; wC += 4) {\n int xC = xCCorner + wC * "+u+";\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+u+", ch),\n getValue(batch, xD, xR, xC + 2 * "+u+", ch),\n getValue(batch, xD, xR, xC + 3 * "+u+", ch)\n );\n\n "+T+"\n }\n\n int xC = xCCorner + "+y+";\n if ("+(1===b)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+T+"\n } else if ("+(2===b)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+u+", ch),\n initializationValue,\n initializationValue\n );\n\n "+T+"\n } else if ("+(3===b)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+u+", ch),\n getValue(batch, xD, xR, xC + 2 * "+u+", ch),\n initializationValue\n );\n\n "+T+"\n }\n }\n setOutput("+_+");\n }\n }\n "}},wo=function(t,e,n,i,r,o,s){void 0===s&&(s=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=o;var a=Mr(r.length),l=Mr(o.length),u="";1===n?u="i":2===n&&(u="i, j");var c="getIndices("+u+")",h="";1===i?h="i":2===i&&(h="i, coords[1]");var p="getUpdates("+h+")",d=e>1?"strides[j]":"strides";this.userCode="\n "+a+" strides = "+a+"("+r+");\n\n void main() {\n "+l+" coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < "+t+"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < "+e+"; j++) {\n int index = round("+c+");\n flattenedIndex += index * "+d+";\n }\n if (flattenedIndex == coords[0]) {\n sum += "+p+";\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n "},ko=function(){function t(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=Mr(this.rank),i="uniform int start["+this.rank+"];",r=function(t){if(1===t)return"sourceLoc";if(t<=6)return xo.slice(0,t).map(function(t){return"sourceLoc."+t}).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n "+n+" sourceLoc;\n "+n+" coords = getOutputCoords();\n "+t.map(function(t,e){return"sourceLoc."+xo[e]+" = start["+e+"] + coords."+xo[e]+";"}).join("\n")+"\n ",this.userCode="\n "+i+"\n void main() {\n "+e+"\n setOutput(getSource("+r+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,i){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(i,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),xo=["x","y","z","w","u","v"],Io=function(){function t(t){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.rank=t.length;var e=Mr(this.rank),n=Tr("coords",this.rank),i=Tr("sourceLoc",this.rank),r=1===this.rank?"sourceLoc":"vec2("+i.slice(-2).join()+")",o="getChannel(getSource("+i.join()+"), "+r+")",s="\n result.x = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+i[this.rank-1]+";\n result.y = "+o+";\n --"+i[this.rank-1]+";\n }\n ",a=1===this.rank?"":"\n --"+n[this.rank-1]+";\n if (++"+n[this.rank-2]+" < "+t[this.rank-2]+") {\n ++"+i[this.rank-2]+";\n result.z = "+o+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+i[this.rank-1]+";\n result.w = "+o+";\n }\n }\n ",l=this.rank<=4?"sourceLoc = coords +\n "+e+"("+t.map(function(t,e){return"start["+e+"]"}).join()+");":t.map(function(t,e){return i[e]+" = "+n[e]+" + start["+e+"];"}).join("\n");this.userCode="\n uniform int start["+this.rank+"];\n void main() {\n "+e+" coords = getOutputCoords();\n "+e+" sourceLoc;\n "+l+"\n vec4 result = vec4(0.);\n "+s+"\n "+a+"\n setOutput(result);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,i){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(i,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),Ro=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var i,r=Oo(e,n),o=Do(t,r,n);if(o in this.freeTextures||(this.freeTextures[o]=[]),o in this.usedTextures||(this.usedTextures[o]=[]),this.freeTextures[o].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var s=this.freeTextures[o].shift();return this.usedTextures[o].push(s),s}return this.numUsedTextures++,this.log(),r===Ht.PACKED_2X2_FLOAT32?i=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):r===Ht.PACKED_2X2_FLOAT16?i=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):r===Ht.UNPACKED_FLOAT32?i=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):r===Ht.UNPACKED_FLOAT16?i=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):r===Ht.PACKED_4X1_UNSIGNED_BYTE&&(i=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[o].push(i),i},t.prototype.releaseTexture=function(t,e,n,i){if(null!=this.freeTextures){var r=Do(e,Oo(n,i),i);r in this.freeTextures||(this.freeTextures[r]=[]),this.freeTextures[r].push(t),this.numFreeTextures++,this.numUsedTextures--;var o=this.usedTextures[r],s=o.indexOf(t);if(s<0)throw new Error("Cannot release a texture that was never provided by this texture manager");o.splice(s,1),this.log()}},t.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+t+")")}},t.prototype.getNumUsedTextures=function(){return this.numUsedTextures},t.prototype.getNumFreeTextures=function(){return this.numFreeTextures},t.prototype.dispose=function(){var t=this;if(null!=this.freeTextures){for(var e in this.freeTextures)this.freeTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});for(var e in this.usedTextures)this.usedTextures[e].forEach(function(e){t.gpgpu.deleteMatrixTexture(e)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},t}();function Oo(t,e){if(t===Vt.UPLOAD)return Ht.PACKED_2X2_FLOAT32;if(t===Vt.RENDER||null==t)return function(t){return c().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?t?Ht.PACKED_2X2_FLOAT32:Ht.UNPACKED_FLOAT32:t?Ht.PACKED_2X2_FLOAT16:Ht.UNPACKED_FLOAT16}(e);if(t===Vt.DOWNLOAD||t===Vt.PIXELS)return Ht.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+t)}function Do(t,e,n){return t[0]+"_"+t[1]+"_"+e+"_"+n}var Ao=1.7580993408473768,Mo=1.0507009873554805,No=function(t,e){this.variableNames=["A"],this.outputShape=t,this.userCode="\n float unaryOperation(float x) {\n "+e+"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Lo="if (isnan(x)) return x;",Po="return x;",Bo="return abs(x);",Fo=Lo+"\n return (x < 0.0) ? 0.0 : x;\n",Uo=Lo+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",Vo="return (x >= 0.0) ? x : (exp(x) - 1.0);",Ho="return -x;",Wo="return ceil(x);",Go="return floor(x);",jo="return exp(x);",zo="return exp(x) - 1.0;",$o="return x;",Xo="return x;",Yo="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",Ko="\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",Jo="\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n",qo=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n vec4 unaryOperation(vec4 x) {\n "+e+"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Zo={};function Qo(t,e){if(void 0===e&&(e=!1),"linear"===t)return e?Xo:Po;if("relu"===t)return e?Yo:Fo;if("elu"===t)return e?Jo:Vo;if("relu6"===t)return e?Ko:Uo;if("prelu"===t)return e?Wr:Vr;throw new Error("Activation "+t+" has not been implemented for the WebGL backend.")}var ts=600,es=function(t){function e(e){var n,i=t.call(this)||this;if(i.pendingRead=new WeakMap,i.pendingDisposal=new WeakSet,i.dataRefCount=new WeakMap,i.numBytesInGPU=0,i.uploadWaitMs=0,i.downloadWaitMs=0,i.warnedAboutMemory=!1,i.pendingDeletes=0,i.disposed=!1,!c().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(null==e){var r=zt(c().getNumber("WEBGL_VERSION"));i.binaryCache=(n=c().getNumber("WEBGL_VERSION"))in Zo?Zo[n]:(Zo[n]={},Zo[n]),i.gpgpu=new yo(r),i.canvas=r.canvas,i.gpgpuCreatedLocally=!0}else i.gpgpu=e,i.binaryCache={},i.gpgpuCreatedLocally=!1,i.canvas=e.gl.canvas;return i.textureManager=new Ro(i.gpgpu),i.numMBBeforeWarning=null==c().global.screen?1024:c().global.screen.height*c().global.screen.width*window.devicePixelRatio*ts/1024/1024,i.texData=new Bi(i,Pt),i}return s(e,t),e.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},e.prototype.write=function(t,e,n){if(c().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===n&&null!=t)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var i={};return this.texData.set(i,{shape:e,dtype:n,values:t,usage:Vt.UPLOAD}),i},e.prototype.move=function(t,e,n,i){if(c().getBool("DEBUG")&&this.checkNumericalProblems(e),"complex64"===i)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(t,{shape:n,dtype:i,values:e,usage:Vt.UPLOAD})},e.prototype.readSync=function(t){var e=this.texData.get(t),n=e.values,i=e.dtype,r=e.complexTensors,o=e.slice,s=e.shape,a=e.isPacked;if(null!=o){var l;l=a?new qo(s,$o):new No(s,$o);var u=this.runWebGLProgram(l,[{dataId:t,shape:s,dtype:i}],i),c=this.readSync(u.dataId);return this.disposeData(u.dataId),c}if(null!=n)return this.convertAndCacheOnCPU(t);if("string"===i)return n;var h,p,d=null!=this.activeTimers;return d&&(h=nt()),p="complex64"===i?rr(r.real.dataSync(),r.imag.dataSync()):this.getValuesFromTexture(t),d&&(this.downloadWaitMs+=nt()-h),this.convertAndCacheOnCPU(t,p)},e.prototype.read=function(t){return a(this,void 0,void 0,function(){var e,n,i,r,o,s,a,u,h,p,d,f,g,m,v,_,y,b,T,E,C,S;return l(this,function(l){switch(l.label){case 0:if(this.pendingRead.has(t))return e=this.pendingRead.get(t),[2,new Promise(function(t){return e.push(t)})];if(n=this.texData.get(t),i=n.values,r=n.shape,o=n.slice,s=n.dtype,a=n.complexTensors,u=n.isPacked,null!=o)return h=void 0,h=u?new qo(r,$o):new No(r,$o),p=this.runWebGLProgram(h,[{dataId:t,shape:r,dtype:s}],s),d=this.read(p.dataId),this.disposeData(p.dataId),[2,d];if(null!=i)return[2,this.convertAndCacheOnCPU(t)];if(!c().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===c().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return f=null,"complex64"!==s&&c().get("WEBGL_BUFFER_SUPPORTED")&&(g=this.decode(t),m=this.texData.get(g.dataId),f=(S=this.gpgpu).createBufferFromTexture.apply(S,[m.texture].concat(Xt(r)))),this.pendingRead.set(t,[]),"complex64"===s?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:l.sent(),l.label=2;case 2:return"complex64"!==s?[3,4]:[4,Promise.all([a.real.data(),a.imag.data()])];case 3:return _=l.sent(),y=_[0],b=_[1],v=rr(y,b),[3,5];case 4:null==f?v=this.getValuesFromTexture(t):(T=x(r),v=this.gpgpu.downloadFloat32MatrixFromBuffer(f,T)),l.label=5;case 5:return null!=g&&this.disposeData(g.dataId),E=this.convertAndCacheOnCPU(t,v),C=this.pendingRead.get(t),this.pendingRead.delete(t),C.forEach(function(t){return t(E)}),this.pendingDisposal.has(t)&&(this.pendingDisposal.delete(t),this.disposeData(t),this.pendingDeletes--),[2,E]}})})},e.prototype.checkNumericalProblems=function(t){if(null!=t)for(var e=0;e<t.length;e++){var n=t[e];if(!Qt(n)){if(c().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error("The value "+n+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'");throw Error("The value "+n+" cannot be represented on this device.")}}},e.prototype.getValuesFromTexture=function(t){var e,n=this.texData.get(t),i=n.shape,r=n.dtype,o=n.isPacked,s=x(i);if(c().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var a=this.decode(t),l=this.texData.get(a.dataId),u=(e=this.gpgpu).downloadMatrixFromPackedTexture.apply(e,[l.texture].concat(Xt(i))).subarray(0,s);return this.disposeData(a.dataId),u}var h=c().getBool("WEBGL_PACK")&&!0===o,p=h?Ie(i):i,d=h?new function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Vt.DOWNLOAD;var e=Er();this.outputShape=t,this.userCode="\n "+wr+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n "+e.output+" = encode_float(x);\n }\n "}(p):new function(t){this.variableNames=["A"],this.outTexUsage=Vt.DOWNLOAD;var e=Er();this.outputShape=t,this.userCode="\n "+wr+"\n\n void main() {\n float x = getAAtOutCoords();\n "+e.output+" = encode_float(x);\n }\n "}(p),f=this.runWebGLProgram(d,[{shape:p,dtype:r,dataId:t}],"float32"),g=this.texData.get(f.dataId),m=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(g.texture,g.texShape[0],g.texShape[1]).subarray(0,s);return this.disposeData(f.dataId),m},e.prototype.time=function(t){return a(this,void 0,void 0,function(){var e,n,i,r,o,s,a;return l(this,function(l){switch(l.label){case 0:return e=this.activeTimers,n=[],i=!1,null==this.programTimersStack?(this.programTimersStack=n,i=!0):this.activeTimers.push(n),this.activeTimers=n,t(),r=k(this.activeTimers.map(function(t){return t.query})).filter(function(t){return null!=t}),o=k(this.activeTimers.map(function(t){return t.name})).filter(function(t){return null!=t}),this.activeTimers=e,i&&(this.programTimersStack=null),s={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(r)]:[3,2];case 1:return a=l.sent(),s.kernelMs=E(a),s.getExtraProfileInfo=function(){return a.map(function(t,e){return{name:o[e],ms:t}}).map(function(t){return t.name+": "+t.ms}).join(", ")},[3,3];case 2:s.kernelMs={error:"WebGL query timers are not supported in this environment."},l.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,s]}})})},e.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},e.prototype.startTimer=function(){return c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:nt(),endMs:null}},e.prototype.endTimer=function(t){return c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),t):(t.endMs=nt(),t)},e.prototype.getQueryTime=function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){return c().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(t)]:[2,(e=t).endMs-e.startMs]})})},e.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t)){if(this.pendingRead.has(t))return this.pendingDisposal.add(t),void this.pendingDeletes++;if(this.texData.has(t)){this.releaseGPUData(t);var e=this.texData.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.texData.delete(t)}}},e.prototype.releaseGPUData=function(t){var e=this.texData.get(t),n=e.texture,i=e.dtype,r=e.texShape,o=e.usage,s=e.isPacked,a=e.slice,l=a&&a.origDataId||t,u=this.dataRefCount.get(l);u>1?this.dataRefCount.set(l,u-1):(this.dataRefCount.delete(l),null!=n&&(this.numBytesInGPU-=this.computeBytes(r,i),this.textureManager.releaseTexture(n,r,o,s)));var c=this.texData.get(t);c.texture=null,c.texShape=null,c.isPacked=!1,c.slice=null},e.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},e.prototype.getDataInfo=function(t){return this.texData.get(t)},e.prototype.getCPUBackend=function(){return c().getBool("WEBGL_CPU_FORWARD")?(null==this.cpuBackend&&(this.cpuBackend=Pt.findBackend("cpu")),this.cpuBackend):null},e.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&&(e=128),null!=this.getCPUBackend()&&t.every(function(t){return null==n.texData.get(t.dataId).texture&&t.size<e})},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.complex=function(t,e){var n=this.makeOutput(t.shape,"complex64");return this.texData.get(n.dataId).complexTensors={real:Pt.keep(t.clone()),imag:Pt.keep(e.clone())},n},e.prototype.real=function(t){return this.texData.get(t.dataId).complexTensors.real.clone()},e.prototype.imag=function(t){return this.texData.get(t.dataId).complexTensors.imag.clone()},e.prototype.slice=function(t,e,n){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.slice(t,e,n);if(0===x(n))return pn([],n,t.dtype);var i=this.texData.get(t.dataId).isPacked,r=Ai(t.shape,e,n);if(i||!r){var o=c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new Io(n):new ko(n),s=o.getCustomSetupFunc(e);return this.compileAndRun(o,[t],null,s)}return this.uploadToGPU(t.dataId),this.shallowSlice(t,e,n)},e.prototype.shallowSlice=function(t,e,n){var i=this.texData.get(t.dataId),r=this.makeOutput(n,t.dtype),o=this.texData.get(r.dataId);Object.assign(o,i),o.shape=n,o.dtype=t.dtype;var s=Mi(e,t.strides);i.slice&&(s+=i.slice.flatOffset),o.slice={flatOffset:s,origDataId:i.slice&&i.slice.origDataId||t.dataId};var a=this.dataRefCount.get(o.slice.origDataId)||1;return this.dataRefCount.set(o.slice.origDataId,a+1),r},e.prototype.stridedSlice=function(t,e,n,i){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.stridedSlice(t,e,n,i);var r=Ri(e,n,i);if(r.some(function(t){return 0===t}))return pn([],r);var o=new function(t,e,n){this.variableNames=["x"],this.outputShape=n;var i=n.length,r=Mr(n.length),o=Mr(n.length),s="";if(1===i)s="coords * strides + begin";else{var a=0;s=n.map(function(t,e){return a++,1===n.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(a-1)+"] * strides["+e+"] + begin["+e+"]"}).join(",")}this.userCode="\n "+r+" begin = "+r+"("+t+");\n "+r+" strides = "+r+"("+e+");\n\n void main() {\n "+o+" coords = getOutputCoords();\n setOutput(getX("+s+"));\n }\n "}(e,i,r);return this.compileAndRun(o,[t])},e.prototype.reverse=function(t,e){var n=c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");this.outputShape=t;var i=Tr("rc",n),r=i[n-1]+" + 1 < "+this.outputShape[n-1],o=i[n-2]+" + 1 < "+this.outputShape[n-2],s=Mr(n);function a(n){var i=t.map(function(i,r){return function(n,i){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - "+i[n]+" - 1":""+i[n]}(r,n)});return"getChannel(getX("+i.join(",")+"), vec2("+i.slice(-2).join(",")+"))"}this.userCode=1===n?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX("+t[0]+" - rc - 1),\n "+t[0]+" - rc - 1);\n if("+r+"){\n result.g = getChannel(getX("+t[0]+" - (rc + 1) - 1),\n "+t[0]+" - (rc + 1) - 1);\n }\n setOutput(result);\n }\n ":"\n void main() {\n "+s+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = "+a(i.slice())+";\n if("+r+"){\n result.g = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",a(t)}(i.slice())+";\n }\n if("+o+") {\n result.b = "+function(t){return t[n-2]="("+t[n-2]+" + 1)",a(t)}(i.slice())+";\n if("+r+") {\n result.a = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",t[n-2]="("+t[n-2]+" + 1)",a(t)}(i.slice())+";\n }\n }\n setOutput(result);\n }\n "}(t.shape,e):new function(t,e){this.variableNames=["x"];var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=t,1!==n){var i=t.map(function(n,i){return function(n){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(i)}).join(","),r=Mr(n);this.userCode="\n void main() {\n "+r+" coords = getOutputCoords();\n setOutput(getX("+i+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+t[0]+" - coord - 1));\n }\n "}(t.shape,e);return this.compileAndRun(n,[t])},e.prototype.concat=function(t,e){if("complex64"===t[0].dtype){var n=t.map(function(t){return cn(t)}),i=t.map(function(t){return hn(t)});return un(this.concat(n,e),this.concat(i,e))}if(this.shouldExecuteOnCPU(t))return this.cpuBackend.concat(t,e);if(1===t.length)return t[0];if(t.length>c().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var r=Math.floor(t.length/2),o=this.concat(t.slice(0,r),e),s=this.concat(t.slice(r),e);return this.concat([o,s],e)}if(c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&t[0].rank>1){var a=new function(t,e){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=an(t,e);var n=this.outputShape,i=n.length,r=Mr(i),o=Tr("coords",i),s=["x","y","z","w","u","v"].slice(0,i);this.variableNames=t.map(function(t,e){return"T"+e});var a=new Array(t.length-1);a[0]=t[0][e];for(var l=1;l<a.length;l++)a[l]=a[l-1]+t[l][e];var u=s[e],c=s.slice(-2),h=s.join(),p="if ("+u+" < "+a[0]+") {\n return getChannel(\n getT0("+h+"), vec2("+c.join()+"));\n }";for(l=1;l<a.length;l++){var d=a[l-1];p+="\n if ("+u+" < "+a[l]+" && "+u+" >= "+a[l-1]+") {\n return getChannel(\n getT"+l+"("+$r(s,u,d)+"),\n vec2("+$r(c,u,d)+"));\n }"}var f=a.length,g=a[a.length-1];p+="\n return getChannel(\n getT"+f+"("+$r(s,u,g)+"),\n vec2("+$r(c,u,g)+"));",this.userCode="\n float getValue("+s.map(function(t){return"int "+t})+") {\n "+p+"\n }\n\n void main() {\n "+r+" coords = getOutputCoords();\n vec4 result = vec4(getValue("+o+"), 0., 0., 0.);\n\n "+o[i-1]+" = "+o[i-1]+" + 1;\n if ("+o[i-1]+" < "+n[i-1]+") {\n result.g = getValue("+o+");\n }\n\n "+o[i-2]+" = "+o[i-2]+" + 1;\n if ("+o[i-2]+" < "+n[i-2]+") {\n result.a = getValue("+o+");\n }\n\n "+o[i-1]+" = "+o[i-1]+" - 1;\n if ("+o[i-2]+" < "+n[i-2]+" &&\n "+o[i-1]+" < "+n[i-1]+") {\n result.b = getValue("+o+");\n }\n setOutput(result);\n }\n "}(t.map(function(t){return t.shape}),e);return this.compileAndRun(a,t)}var l=an(t.map(function(t){return t.shape}),e),u=t.map(function(t){return t.as2D(-1,x(t.shape.slice(e)))}),h=new function(t){this.outputShape=[],this.outputShape=an(t,1),this.variableNames=t.map(function(t,e){return"T"+e});var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n<e.length;n++)e[n]=e[n-1]+t[n][1];var i=["if (yC < "+e[0]+") setOutput(getT0(yR, yC));"];for(n=1;n<e.length;n++){var r=e[n-1];i.push("else if (yC < "+e[n]+") setOutput(getT"+n+"(yR, yC-"+r+"));")}var o=e.length,s=e[e.length-1];i.push("else setOutput(getT"+o+"(yR, yC-"+s+"));"),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n "+i.join("\n ")+"\n }\n "}(u.map(function(t){return t.shape}));return this.compileAndRun(h,u).reshape(l)},e.prototype.neg=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.neg(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Ho,t.dtype);var e=new No(t.shape,Ho);return this.compileAndRun(e,[t])},e.prototype.batchMatMul=function(t,e,n,i){var r=n?t.shape[2]:t.shape[1],o=i?e.shape[1]:e.shape[2],s=n?t.shape[1]:t.shape[2],a=t.shape[0];if((1===r||1===o)&&s>1e3){n&&(t=t.transpose([0,2,1])),i&&(e=e.transpose([0,2,1]));var l=1===o?t:t.as3D(a,s,1),u=1===o?2:1,c=1===o?e.as3D(a,1,s):e;return this.multiply(l,c).sum(u,!0)}var h=It(t.dtype,e.dtype),p=new To(t.shape,[a,r,o],n,i);return this.compileAndRun(p,[t,e],h)},e.prototype.fusedBatchMatMul=function(t){var e=t.a,n=t.b,i=t.transposeA,r=t.transposeB,o=t.bias,s=t.activation,a=t.preluActivationWeights,l=i?e.shape[2]:e.shape[1],u=r?n.shape[1]:n.shape[2],c=e.shape[0],h=It(e.dtype,n.dtype),p=null!=o,d=null!=a,f=s?Qo(s,!0):null,g=new To(e.shape,[c,l,u],i,r,p,f,d),m=[e,n];return o&&m.push(o),a&&m.push(a),this.compileAndRun(g,m,h)},e.prototype.multiply=function(t,e){if("complex64"===t.dtype){var n=this.texData.get(t.dataId),i=this.texData.get(e.dataId),r=new Pr("return areal * breal - aimag * bimag;",t.shape,e.shape),o=new Pr("return areal * bimag + aimag * breal;",t.shape,e.shape),s=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag),this.makeComplexComponentTensorInfo(e,i.complexTensors.real),this.makeComplexComponentTensorInfo(e,i.complexTensors.imag)],a=this.compileAndRun(r,s),l=this.compileAndRun(o,s),u=this.complex(a,l);return a.dispose(),l.dispose(),u}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Ur,t.dtype);var h=new Hr(Ur,t.shape,e.shape);return this.compileAndRun(h,[t,e],t.dtype)},e.prototype.batchNormalization=function(t,e,n,i,r,o){var s=[t,e,n],a=null;null!=o&&(a=o.shape,s.push(o));var l=null;if(null!=r&&(l=r.shape,s.push(r)),c().getBool("WEBGL_PACK_NORMALIZATION")){var u=new function(t,e,n,i,r,o){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Wi(t,e),Wi(t,n);var s="vec4(0.0)";null!=i&&(Wi(t,i),this.variableNames.push("offset"),s="getOffsetAtOutCoords()");var a="vec4(1.0)";null!=r&&(Wi(t,r),this.variableNames.push("scale"),a="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = "+s+";\n vec4 scale = "+a+";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4("+o+"));\n\n setOutput((x - mean) * inv + offset);\n }\n "}(t.shape,e.shape,n.shape,a,l,i);return this.compileAndRun(u,s)}var h=new function(t,e,n,i,r,o){this.outputShape=[],this.variableNames=["x","mean","variance"],Wi(t,e),Wi(t,n);var s="0.0";null!=i&&(Wi(t,i),this.variableNames.push("offset"),s="getOffsetAtOutCoords()");var a="1.0";null!=r&&(Wi(t,r),this.variableNames.push("scale"),a="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+s+";\n float scale = "+a+";\n float inv = scale * inversesqrt(variance + float("+o+"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n "}(t.shape,e.shape,n.shape,a,l,i);return this.compileAndRun(h,s)},e.prototype.localResponseNormalization4D=function(t,e,n,i,r){var o=c().getBool("WEBGL_PACK_NORMALIZATION")?new function(t,e,n,i,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var o,s=e,a=t[3]-1;this.outputShape=t;var l="float("+n+") + float("+i+") * sum";o=.5===r?"inversesqrt("+l+")":1===r?"1.0/("+l+")":"exp(log("+l+") * float(-"+r+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < "+this.outputShape[3]+";\n bool hasNextRow = c < "+this.outputShape[2]+";\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - "+s+";\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - "+s+"; j <= "+s+"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2("+a+"));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * "+o+";\n setOutput(result);\n }\n "}(t.shape,e,n,i,r):new function(t,e,n,i,r){this.variableNames=["x"],this.outputShape=[];var o,s=e,a=t[3]-1;this.outputShape=t;var l="float("+n+") + float("+i+") * sum";o=.5===r?"inversesqrt("+l+")":1===r?"1.0/("+l+")":"exp(log("+l+") * float(-"+r+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+s+"; j <= "+s+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+a+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+o+";\n setOutput(val);\n }\n "}(t.shape,e,n,i,r);return this.compileAndRun(o,[t])},e.prototype.LRNGrad=function(t,e,n,i,r,o,s){var a=new function(t,e,n,i,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=i,this.beta=r,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+e+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+e+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+i+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+i+")\n * float("+r+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+r+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n "}(e.shape,i,r,o,s);return this.compileAndRun(a,[e,n,t])},e.prototype.tile=function(t,e){if("string"===t.dtype){var n=this.readSync(t.dataId).map(function(t){return ot(t)});return vr(Gn(t.shape,t.dtype,n),e)}var i=new function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),i=0;i<n.length;i++)n[i]=t[i]*e[i];this.outputShape=n,this.rank=n.length;var r=Mr(this.rank),o=function(t){var e=t.length;if(e>5)throw Error("Tile for rank "+e+" is not yet supported");if(1===e)return"imod(resRC, "+t[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],i=[],r=0;r<t.length;r++)i.push("imod("+n[r]+", "+t[r]+")");return i.join()}(t);this.userCode="\n void main() {\n "+r+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e);return this.compileAndRun(i,[t])},e.prototype.pad=function(t,e,n){var i=c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});for(var i=t.length,r=Mr(i),o=e.map(function(t){return t[0]}).join(","),s=e.map(function(e,n){return e[0]+t[n]}).join(","),a=Tr("rc",i),l=Tr("source",i),u=a[i-1]+" < "+this.outputShape[i-1],c=1===i?"source":"vec2("+l.slice(-2).join()+")",h=[r+" rc = outputLoc;",a[i-1]+" += 1;\n if("+u+") {\n ",1===i?"":"}\n rc = outputLoc;\n "+a[i-2]+" += 1;\n if("+a[i-2]+" < "+this.outputShape[i-2]+") {",1===i?"":" "+a[i-1]+" += 1;\n if("+u+") {"],p=1===i?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",d="",f=0,g=1===i?2:4;f<g;f++)d+="\n "+h[f]+"\n if ("+p+") {\n result["+f+"] = float("+n+");\n } else {\n "+r+" source = rc - start;\n result["+f+"] = getChannel(getX("+l.join()+"), "+c+");\n }\n ";d+=1===i?"} ":"}}",this.userCode="\n const "+r+" start = "+r+"("+o+");\n const "+r+" end = "+r+"("+s+");\n\n void main() {\n "+r+" outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n "+d+"\n setOutput(result);\n }\n "}(t.shape,e,n):new function(t,e,n){this.variableNames=["x"],this.outputShape=e.map(function(e,n){return e[0]+t[n]+e[1]});var i=t.length,r=Mr(i),o=e.map(function(t){return t[0]}).join(","),s=e.map(function(e,n){return e[0]+t[n]}).join(","),a=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,i);this.userCode=1!==i?"\n "+r+" start = "+r+"("+o+");\n "+r+" end = "+r+"("+s+");\n\n void main() {\n "+r+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+r+" coords = outC - start;\n setOutput(getX("+a+"));\n }\n }\n ":"\n int start = "+o+";\n int end = "+s+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+n+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "}(t.shape,e,n);return this.compileAndRun(i,[t])},e.prototype.transpose=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.transpose(t,e);var n=c().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var n=new Array(t.length),i=0;i<n.length;i++)n[i]=t[e[i]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var r=Mr(this.rank),o=br("rc",this.rank),s=new Array(this.rank);for(i=0;i<e.length;i++)s[e[i]]=o[i];var a="vec2("+s.slice(-2).join()+")",l="++"+o[this.rank-1]+" < "+n[this.rank-1],u="getChannel(getA("+s.join()+"), "+a+")";this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = "+u+";\n if("+l+") {\n result[1] = "+u+";\n }\n --"+o[this.rank-1]+";\n if(++"+o[this.rank-2]+" < "+n[this.rank-2]+") {\n result[2] = "+u+";\n if("+l+") {\n result[3] = "+u+";\n }\n }\n setOutput(result);\n }\n "}(t.shape,e):new function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),i=0;i<n.length;i++)n[i]=t[e[i]];this.outputShape=n,this.rank=n.length;var r=Mr(this.rank),o=function(t){var e=t.length;if(e>6)throw Error("Transpose for rank "+e+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],i=new Array(e),r=0;r<t.length;r++)i[t[r]]=n[r];return i.join()}(e);this.userCode="\n void main() {\n "+r+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e);return this.compileAndRun(n,[t])},e.prototype.gather=function(t,e,n){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.gather(t,e,n);var i=new function(t,e,n){this.variableNames=["A","indices"];var i=t.slice();i[n]=e,this.outputShape=i,this.rank=i.length;var r=Mr(this.rank),o=function(t,e){var n=t.length;if(n>4)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return"int(getIndices(resRC))";for(var i=["resRC.x","resRC.y","resRC.z","resRC.w"],r=[],o=0;o<t.length;o++)o===e?r.push("int(getIndices("+i[o]+"))"):r.push(""+i[o]);return r.join()}(t,n);this.userCode="\n void main() {\n "+r+" resRC = getOutputCoords();\n setOutput(getA("+o+"));\n }\n "}(t.shape,e.size,n);return this.compileAndRun(i,[t,e])},e.prototype.batchToSpaceND=function(t,e,n){C(t.rank<=4,function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"});var i=e.reduce(function(t,e){return t*e}),r=mi(t.shape,e,i),o=vi(r.length,e.length),s=_i(t.shape,e,i),a=yi(n,e.length),l=bi(s,n,e.length);return t.reshape(r).transpose(o).reshape(s).slice(a,l)},e.prototype.spaceToBatchND=function(t,e,n){C(t.rank<=4,function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"});var i=e.reduce(function(t,e){return t*e}),r=[[0,0]];r.push.apply(r,n);for(var o=1+e.length;o<t.shape.length;++o)r.push([0,0]);var s=t.pad(r),a=mi(s.shape,e,i,!1),l=vi(a.length,e.length,!1),u=_i(s.shape,e,i,!1);return s.reshape(a).transpose(l).reshape(u)},e.prototype.reduce=function(t,e,n){var i=t.shape[0],r=t.shape[1],o=new function(t,e){this.variableNames=["x"];var n=t.windowSize,i=t.batchSize,r=t.inSize,o=Math.ceil(r/n);this.outputShape=[i,o];var s="0.0",a="";"prod"===e?s="1.0":"min"===e?(s="1.0 / 1e-20",a="min"):"max"===e&&(s="-1.0 / 1e-20",a="max");var l=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?l="sumValue":"prod"===e?l="prodValue":"all"===e?l="allValue":"any"===e&&(l="anyValue");var u=4*Math.floor(n/4),c=n%4,h="\n if ("+("sum"===e)+") {\n sumValue += dot(values, ones);\n } else if ("+("prod"===e)+") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = "+a+"(values, minMaxValue);\n }\n ",p="vec4";"all"===e?(s="1.0",h="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",p="bvec4"):"any"===e&&(s="0.0",h="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",p="bvec4");var d="";r%n>0&&(d="\n if (inIdx < 0 || inIdx >= "+r+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+s+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+d+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+s+");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+u+"; i += 4) {\n int inIdx = inOffset + i;\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+h+"\n }\n\n int inIdx = inOffset + "+u+";\n if ("+(1===c)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+h+"\n } else if ("+(2===c)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+h+"\n } else if ("+(3===c)+") {\n "+p+" values = "+p+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+h+"\n }\n setOutput("+l+");\n }\n "}({windowSize:Ci(r),inSize:r,batchSize:i},e),s=this.compileAndRun(o,[t],n);return 1===s.shape[1]?s:this.reduce(s,e,n)},e.prototype.argReduce=function(t,e,n){void 0===n&&(n=null);var i=t.shape[0],r=t.shape[1];null!=n&&(i=n.shape[0],r=n.shape[1]);var o=new function(t,e,n){this.variableNames=["A"];var i=t.windowSize,r=t.batchSize,o=t.inSize,s=Math.ceil(o/i);n||this.variableNames.push("bestIndicesA"),this.outputShape=[r,s];var a="max"===e?">":"<",l=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+i+";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < "+i+"; i++) {\n int inIdx = "+l+";\n float candidate = getA(batch, inIdx);\n if (candidate "+a+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "}({windowSize:Ci(r),inSize:r,batchSize:i},e,null==n),s=[t];null!=n&&s.push(n);var a=this.compileAndRun(o,s,"int32");return 1===a.shape[1]?a:this.argReduce(t,e,a)},e.prototype.argReducePacked=function(t,e,n){void 0===n&&(n=null);var i=null!=n?n.shape:t.shape,r=new function(t,e,n,i){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,C(t.length>2,function(){return"Packed arg"+(n.charAt(0).toUpperCase()+n.slice(1))+" supports only inputs with rank above 2."});var r=t[t.length-1],o=Math.ceil(r/e);this.outputShape=t.slice(0,-1),o>1&&this.outputShape.push(o),i||this.variableNames.push("bestIndicesA");var s,a,l=this.outputShape,u=l.length,c=Mr(u),h=Tr("coords",u);if(1===o){var p=Mr(a=u+1);s="\n "+p+" sourceLocR = "+p+"("+h.join()+", 0);\n ++"+h[u-1]+";\n "+p+" sourceLocG = "+p+"("+h.join()+", 0);\n ++"+h[u-2]+";\n "+p+" sourceLocA = "+p+"("+h.join()+", 0);\n --"+h[u-1]+";\n "+p+" sourceLocB = "+p+"("+h.join()+", 0);\n --"+h[u-2]+";"}else a=u,s="\n "+c+" sourceLocR = coords;\n ++"+h[u-1]+";\n "+c+" sourceLocG = coords;\n ++"+h[u-2]+";\n "+c+" sourceLocA = coords;\n --"+h[u-1]+";\n "+c+" sourceLocB = coords;\n --"+h[u-2]+";";var d=["x","y","z","w","u","v"].slice(0,a),f="."+d[a-1],g=d.map(function(t){return"int "+t}),m=Tr("sourceLocR",a-1).concat("inIdx.r"),v=Tr("sourceLocG",a-1).concat("inIdx.g"),_=Tr("sourceLocB",a-1).concat("inIdx.b"),y=Tr("sourceLocA",a-1).concat("inIdx.a"),b="max"===n?"greaterThan":"lessThan",T=i?"":"\n inIdx = round(vec4(getBestIndicesAChannel("+m.join()+"),\n getBestIndicesAChannel("+v.join()+"),\n getBestIndicesAChannel("+_.join()+"),\n getBestIndicesAChannel("+y.join()+")));",E="vec4(\n getAChannel("+m.join()+"),\n hasNextCol ? getAChannel("+v.join()+") : 0.,\n hasNextRow ? getAChannel("+_.join()+") : 0.,\n hasNextRow && hasNextCol ? getAChannel("+y.join()+") : 0.)",S=i?"":"\n float getBestIndicesAChannel("+g.join()+") {\n return getChannel(getBestIndicesA("+d.join()+"),\n vec2("+d.slice(-2).join()+"));\n }";this.userCode="\n float getAChannel("+g.join()+") {\n return getChannel(getA("+d.join()+"),\n vec2("+d.slice(-2).join()+"));\n }\n "+S+"\n void main() {\n "+c+" coords = getOutputCoords();\n bool hasNextCol = "+h[u-1]+" < "+(l[u-1]-1)+";\n bool hasNextRow = "+h[u-2]+" < "+(l[u-2]-1)+";\n "+s+"\n ivec4 srcIdx = ivec4(sourceLocR"+f+", sourceLocG"+f+",\n sourceLocB"+f+", sourceLocA"+f+") * "+e+";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = "+E+";\n\n for (int i = 0; i < "+e+"; i++) {\n inIdx = srcIdx;\n "+T+"\n vec4 candidate = "+E+";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4("+b+"(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n "}(i,Ci(i[i.length-1]),e,null==n),o=null==n?[t]:[t,n],s=this.compileAndRun(r,o,"int32");return s.rank===t.rank?this.argReducePacked(t,e,s):s},e.prototype.sum=function(t,e){en("sum",e,t.rank);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r),s=Rt(t.dtype);return this.reduce(o,"sum",s).reshape(i)},e.prototype.prod=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.prod(t,e);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r),s=Rt(t.dtype);return this.reduce(o,"prod",s).reshape(i)},e.prototype.unsortedSegmentSum=function(t,e,n){var i=0,r=nn([i],t.rank),o=t;null!=r&&(o=t.transpose(r),i=on(1,t.rank)[0]);var s=function(t,e,n){for(var i=[],r=t.length,o=0;o<r;o++)o!==e?i.push(t[o]):i.push(n);return i}(o.shape,i,n),a=x([o.shape[i]]),l=o.as2D(-1,a),u=Rt(t.dtype),c=this.segOpCompute(l,"unsortedSegmentSum",e,u,n).reshape(s);return null!=r&&(c=c.transpose(rn(r))),c},e.prototype.segOpCompute=function(t,e,n,i,r){var o=t.shape[0],s=t.shape[1],a=function(t,e){var n,i=!1;for(t<=Ei?(n=t,i=!0):n=J(t,Math.floor(Math.sqrt(t)));!i;)n>e||n===t?i=!0:n=J(t,n+1);return n}(s,r),l=new function(t,e){this.variableNames=["x","segmentIds"];var n=t.windowSize,i=t.batchSize,r=t.inSize,o=t.numSegments,s=o*Math.ceil(r/n);this.outputShape=[i,s];var a=4*Math.floor(n/4),l=n%4,u="\n sumValue += dot(values, segFilter);\n ",c="";r%n>0&&(c="\n if (inIdx < 0 || inIdx >= "+r+") {\n return initializationValue;\n }\n ");var h="";r%n>0&&(h="\n if (inIdx < 0 || inIdx >= "+r+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+c+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+h+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+o+")) * float("+n+"));\n int currentSeg = int(mod(float(outIdx), float("+o+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+a+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+u+"\n }\n\n int inIdx = inOffset + "+a+";\n if ("+(1===l)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+u+"\n } else if ("+(2===l)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+u+"\n } else if ("+(3===l)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+u+"\n }\n setOutput(sumValue);\n }\n "}({windowSize:a,inSize:s,batchSize:o,numSegments:r},e),u=this.compileAndRun(l,[t,n],i);return u.shape[1]===r?u:(n=En(0,r).tile([s/a]),this.segOpCompute(u,e,n,i,r))},e.prototype.argMinMaxReduce=function(t,e,n){var i=[e];if(en("arg"+n.charAt(0).toUpperCase()+n.slice(1),i,t.rank),!c().getBool("WEBGL_PACK_REDUCE")||t.rank<=2){var r=Qe(t.shape,i),o=r[0],s=x(r[1]),a=t.as2D(-1,s);return this.argReduce(a,n).reshape(o)}return this.argReducePacked(t,n)},e.prototype.argMin=function(t,e){return this.argMinMaxReduce(t,e,"min")},e.prototype.argMax=function(t,e){return this.argMinMaxReduce(t,e,"max")},e.prototype.cumsum=function(t,e,n,i){if(e!==t.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(t.rank-1)+" but got axis="+e);var r=new function(t,e,n){this.variableNames=["x"],this.outputShape=t;var i=t.length,r=t[t.length-1],o=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+r+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+Mr(i)+" coords = getOutputCoords();\n int end = "+Jr(i,"coords")+";\n float val = 0.0;\n for (int i = "+r+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+o+" end) {\n continue;\n }\n if (idx == end && "+e+") {\n continue;\n }\n "+Jr(i,"coords")+" = idx;\n val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(i,"coords")+");\n }\n setOutput(val);\n }\n "}(t.shape,n,i);return this.compileAndRun(r,[t])},e.prototype.equal=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(equal(a, b));\n","bool");var n=new Hr("return float(a == b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.notEqual=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(notEqual(a, b));\n","bool");var n=new Hr("return float(a != b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThan(a, b));\n","bool");var n=new Hr("return float(a < b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.lessEqual=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThanEqual(a, b));\n","bool");var n=new Hr("return float(a <= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThan(a, b));\n","bool");var n=new Hr("return float(a > b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greaterEqual=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThanEqual(a, b));\n","bool");var n=new Hr("return float(a >= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalNot=function(t){var e=new No(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},e.prototype.logicalAnd=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n","bool");var n=new Hr("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalOr=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n","bool");var n=new Hr("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.select=function(t,e,n){var i=new function(t,e,n){var i,r;if(this.variableNames=["c","a","b"],this.outputShape=e,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)r="resRC",i="resRC";else{for(var o=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[],a=[],l=0;l<e.length;l++)a.push(""+o[l]),l<t&&s.push(""+o[l]);i=s.join(),r=a.join()}var u=Mr(n);this.userCode="\n void main() {\n "+u+" resRC = getOutputCoords();\n float cVal = getC("+i+");\n if (cVal >= 1.0) {\n setOutput(getA("+r+"));\n } else {\n setOutput(getB("+r+"));\n }\n }\n "}(t.rank,e.shape,e.rank);return this.compileAndRun(i,[t,e,n],It(e.dtype,n.dtype))},e.prototype.where=function(t){$e("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return yr(t.shape,e)},e.prototype.topk=function(t,e,n){return _r(t.dataSync(),t.shape,t.dtype,e)},e.prototype.min=function(t,e){en("min",e,t.rank);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r);return this.reduce(o,"min",o.dtype).reshape(i)},e.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Hr("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.mod=function(t,e){var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Hr("if (b == 0.0) return NAN;\n return mod(a, b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);en("max",e,t.rank);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r);return this.reduce(o,"max",o.dtype).reshape(i)},e.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Hr("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.all=function(t,e){en("all",e,t.rank);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r);return this.reduce(o,"all",o.dtype).reshape(i)},e.prototype.any=function(t,e){en("any",e,t.rank);var n=Qe(t.shape,e),i=n[0],r=x(n[1]),o=t.as2D(-1,r);return this.reduce(o,"any",o.dtype).reshape(i)},e.prototype.realDivide=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n","float32",!0);var n=new Hr("\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",t.shape,e.shape);return this.compileAndRun(n,[t,e],"float32")},e.prototype.floorDiv=function(t,e){if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n","int32");var n=new Hr("\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",t.shape,e.shape);return this.compileAndRun(n,[t,e],"int32")},e.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Br);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=It(t.dtype,e.dtype);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Br,n);var i=new Hr(Br,t.shape,e.shape);return this.compileAndRun(i,[t,e],n)},e.prototype.packedUnaryOp=function(t,e,n){var i=new qo(t.shape,e);return this.compileAndRun(i,[t],n)},e.prototype.packedBinaryOp=function(t,e,n,i,r){void 0===r&&(r=!1);var o=new Gr(n,t.shape,e.shape,r);return this.compileAndRun(o,[t,e],i)},e.prototype.complexSeparableBinaryOp=function(t,e,n){var i=this,r=this.texData.get(t.dataId),o=this.texData.get(e.dataId),s=[[r.complexTensors.real,o.complexTensors.real],[r.complexTensors.imag,o.complexTensors.imag]].map(function(r){var o=r[0],s=r[1],a=i.makeComplexComponentTensorInfo(t,o),l=i.makeComplexComponentTensorInfo(e,s),u=new Hr(n,t.shape,e.shape);return i.compileAndRun(u,[a,l],It(o.dtype,s.dtype))}),a=s[0],l=s[1],u=this.complex(a,l);return a.dispose(),l.dispose(),u},e.prototype.makeComplexComponentTensorInfo=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},e.prototype.addN=function(t){if(1===t.length)return t[0];if(t.length>c().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var e=Math.floor(t.length/2),n=this.addN(t.slice(0,e)),i=this.addN(t.slice(e));return this.addN([n,i])}var r=t.map(function(t){return t.dtype}).reduce(function(t,e){return It(t,e)}),o=t.map(function(t){return t.shape}),s=c().getBool("WEBGL_PACK")?new function(t,e){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.variableNames=e.map(function(t,e){return"T"+e});var n=[];this.variableNames.forEach(function(t){n.push("vec4 v"+t+" = get"+t+"AtOutCoords();")});var i=this.variableNames.map(function(t){return"v"+t}).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n vec4 result = "+i+";\n setOutput(result);\n }\n "}(t[0].shape,o):new function(t,e){this.outputShape=[],this.outputShape=t,this.variableNames=e.map(function(t,e){return"T"+e});var n=[];this.variableNames.forEach(function(t){n.push("float v"+t+" = get"+t+"AtOutCoords();")});var i=this.variableNames.map(function(t){return"v"+t}).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n float result = "+i+";\n setOutput(result);\n }\n "}(t[0].shape,o);return this.compileAndRun(s,t,r)},e.prototype.subtract=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Fr);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=It(t.dtype,e.dtype);if(c().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Fr,t.dtype);var i=new Hr(Fr,t.shape,e.shape);return this.compileAndRun(i,[t,e],n)},e.prototype.pow=function(t,e){var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Hr("\nif(a < 0.0 && floor(b) < b){\n return NAN;\n}\nif (b == 0.0) {\n return 1.0;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),i=It(t.dtype,e.dtype);return this.compileAndRun(n,[t,e],i)},e.prototype.ceil=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.ceil(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Wo,t.dtype);var e=new No(t.shape,Wo);return this.compileAndRun(e,[t])},e.prototype.floor=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.floor(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Go,t.dtype);var e=new No(t.shape,Go);return this.compileAndRun(e,[t])},e.prototype.sign=function(t){var e=new No(t.shape,"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(e,[t])},e.prototype.isNaN=function(t){var e=new No(t.shape,"return float(isnan(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isInf=function(t){var e=new No(t.shape,"return float(isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isFinite=function(t){var e=new No(t.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.round=function(t){var e=new No(t.shape,"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n");return this.compileAndRun(e,[t])},e.prototype.exp=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.exp(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,jo,t.dtype);var e=new No(t.shape,jo);return this.compileAndRun(e,[t])},e.prototype.expm1=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.expm1(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,zo,t.dtype);var e=new No(t.shape,zo);return this.compileAndRun(e,[t])},e.prototype.softmax=function(t,e){var n=L([e],t.shape),i=this.max(t,n),r=tn(i.shape,n),o=this.subtract(t,i.reshape(r)),s=this.exp(o),a=this.sum(s,n).reshape(r);return this.realDivide(s,a)},e.prototype.log=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.log(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,"\n vec4 result = log(x);\n vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n result.r = isNaN.r == 1.0 ? NAN : result.r;\n result.g = isNaN.g == 1.0 ? NAN : result.g;\n result.b = isNaN.b == 1.0 ? NAN : result.b;\n result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n return result;\n",t.dtype);var e=new No(t.shape,"if (x < 0.0) return NAN;\n return log(x);");return this.compileAndRun(e,[t])},e.prototype.log1p=function(t){var e=new No(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},e.prototype.sqrt=function(t){var e=new No(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},e.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new No(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},e.prototype.reciprocal=function(t){var e=new No(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},e.prototype.relu=function(t){var e;return e=c().getBool("WEBGL_PACK")?new qo(t.shape,Yo):new No(t.shape,Fo),this.compileAndRun(e,[t])},e.prototype.relu6=function(t){var e;return e=c().getBool("WEBGL_PACK")?new qo(t.shape,Ko):new No(t.shape,Uo),this.compileAndRun(e,[t])},e.prototype.prelu=function(t,e){var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr(Wr,t.shape,e.shape):new Hr(Vr,t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.elu=function(t){if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Jo,t.dtype);var e=new No(t.shape,Vo);return this.compileAndRun(e,[t])},e.prototype.eluDer=function(t,e){var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.shape,e.shape):new Hr("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.selu=function(t){var e=new No(t.shape,"\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = 1.7580993408473768;\n float scale = 1.0507009873554805;\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n");return this.compileAndRun(e,[t])},e.prototype.int=function(t){var e=new No(t.shape,"return float(int(x));");return this.compileAndRun(e,[t],"int32")},e.prototype.clip=function(t,e,n){var i,r=(i=c().getBool("WEBGL_PACK_CLIP")?new zr(t.shape):new jr(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(i,[t],null,r)},e.prototype.abs=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.abs(t);if(c().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Bo,t.dtype);var e=new No(t.shape,Bo);return this.compileAndRun(e,[t])},e.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "}(t.shape),i=[this.makeComplexComponentTensorInfo(t,e.complexTensors.real),this.makeComplexComponentTensorInfo(t,e.complexTensors.imag)];return this.compileAndRun(n,i)},e.prototype.sigmoid=function(t){var e=new No(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},e.prototype.softplus=function(t){var e=new No(t.shape,"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n");return this.compileAndRun(e,[t])},e.prototype.sin=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return sin(x);\n");return this.compileAndRun(e,[t])},e.prototype.cos=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return cos(x);\n");return this.compileAndRun(e,[t])},e.prototype.tan=function(t){var e=new No(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},e.prototype.asin=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n");return this.compileAndRun(e,[t])},e.prototype.acos=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n");return this.compileAndRun(e,[t])},e.prototype.atan=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n return atan(x);\n");return this.compileAndRun(e,[t])},e.prototype.atan2=function(t,e){var n=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Hr("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.sinh=function(t){var e=new No(t.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.cosh=function(t){var e=new No(t.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.tanh=function(t){var e=new No(t.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},e.prototype.asinh=function(t){var e=new No(t.shape,"if (isnan(x)) return x;return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(e,[t])},e.prototype.acosh=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));");return this.compileAndRun(e,[t])},e.prototype.atanh=function(t){var e=new No(t.shape,"if (isnan(x)) return x;\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;");return this.compileAndRun(e,[t])},e.prototype.erf=function(t){var e=new No(t.shape,'\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = 0.3275911;\n float a1 = 0.254829592;\n float a2 = -0.284496736;\n float a3 = 1.421413741;\n float a4 = -1.453152027;\n float a5 = 1.061405429;\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n');return this.compileAndRun(e,[t])},e.prototype.step=function(t,e){var n=new No(t.shape,function(t){return void 0===t&&(t=0),Lo+"\n return x > 0.0 ? 1.0 : float("+t+");\n "}(e));return this.compileAndRun(n,[t])},e.prototype.conv2dByMatMul=function(t,e,n,i,r,o){var s=t.shape,a=this.texData.get(t.dataId),l=n.inChannels,u=s[0]*s[1]*s[2],h=n.outChannels,p="channelsLast"===n.dataFormat,d=(1===u||1===h)&&l>1e3,f=s[2]%2!=0&&!!a.isPacked;if(d||!c().getBool("WEBGL_LAZILY_UNPACK")||!c().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!f){var g=p?s[0]*s[1]*s[2]:s[0]*s[2]*s[3],m=this.reshape(t,[1,g,n.inChannels]),v=this.reshape(e,[1,n.inChannels,n.outChannels]);return this.reshape(this.fusedBatchMatMul({a:m,b:v,transposeA:!1,transposeB:!1,bias:i,activation:r,preluActivationWeights:o}),n.outShape)}var _=p?s[0]*s[1]*(s[2]+1):s[0]*s[2]*(s[3]+1),y={dataId:t.dataId,shape:[1,_,n.inChannels],dtype:t.dtype},b=a.shape;a.shape=a.shape.slice(),a.shape[a.shape.length-2]++,C(De(a.shape,y.shape),function(){return"packed reshape "+a.shape+" to "+y.shape+" isn't free"});var T=this.reshape(e,[1,n.inChannels,n.outChannels]),E=this.fusedBatchMatMul({a:y,b:T,transposeA:!1,transposeB:!1,bias:i,activation:r,preluActivationWeights:o}),S=this.texData.get(E.dataId);return C(S.isPacked,function(){return"batchMatMul result is expected to be packed"}),a.shape=b,S.shape=n.outShape,Pt.makeTensorFromDataId(E.dataId,n.outShape,E.dtype)},e.prototype.conv2dWithIm2Row=function(t,e,n,i,r,o){var s=n.filterWidth,a=n.filterHeight,l=n.inChannels,u=n.outWidth,c=n.outHeight,h="channelsLast"===n.dataFormat,p=s*a*l,d=c*u,f=[p,d],g=t.squeeze([0]),m=e.reshape([1,p,-1]),v=new function(t,e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var i=n.filterWidth,r=n.inChannels,o=n.strideWidth,s=n.strideHeight,a=n.padInfo,l=n.outWidth,u=n.dilationWidth,c=n.dilationHeight,h=n.dataFormat,p=a.left,d=a.top,f=r*i,g=Er(),m="channelsLast"===h,v=m?0:1,_=m?1:2,y="",b=0;b<=1;b++)for(var T=0;T<=1;T++)y+="\n blockIndex = rc.y + "+T+";\n pos = rc.x + "+b+";\n\n if(blockIndex < "+t[1]+" && pos < "+t[0]+") {\n offsetY = int(blockIndex / ("+l+")) * "+s+" - "+d+";\n d0 = offsetY + "+c+" * (pos / "+f+");\n\n if(d0 < "+e[v]+" && d0 >= 0) {\n\n offsetX = int(mod(float(blockIndex), "+l+".) * "+o+". - "+p+".);\n d1 = offsetX + "+u+" * (int(mod(float(pos), "+f+".) / "+r+".));\n\n if(d1 < "+e[_]+" && d1 >= 0) {\n\n ch = int(mod(float(pos), "+r+".));\n\n if ("+m+") {\n innerDims = vec2(d1, ch);\n result["+(2*b+T)+"] = getChannel(\n getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result["+(2*b+T)+"] = getChannel(\n getA(ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n ";this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n "+y+"\n\n "+g.output+" = result;\n }\n "}(f,g.shape,n),_=this.compileAndRun(v,[g]).reshape([1,f[0],f[1]]),y=null!=i,b=null!=o,T=r?Qo(r,!0):null,E=new To(_.shape,[1,d,n.outChannels],!0,!1,y,T,b),C=[_,m];i&&C.push(i),b&&C.push(o);var S=this.compileAndRun(E,C);return h?S.reshape([1,c,u,n.outChannels]):S.reshape([1,n.outChannels,c,u])},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,i=t.convInfo,r=t.bias,o=t.activation,s=t.preluActivationWeights;if(1===i.filterHeight&&1===i.filterWidth&&1===i.dilationHeight&&1===i.dilationWidth&&1===i.strideHeight&&1===i.strideWidth&&("SAME"===i.padInfo.type||"VALID"===i.padInfo.type))return this.conv2dByMatMul(e,n,i,r,o,s);if(c().getBool("WEBGL_CONV_IM2COL")&&1===e.shape[0])return this.conv2dWithIm2Row(e,n,i,r,o,s);var a=null!=r,l=null!=s,u=o?Qo(o,!1):null,h=new Xr(i,a,u,l),p=[e,n];return r&&p.push(r),s&&p.push(s),this.compileAndRun(h,p)},e.prototype.conv2d=function(t,e,n){if(1===n.filterHeight&&1===n.filterWidth&&1===n.dilationHeight&&1===n.dilationWidth&&1===n.strideHeight&&1===n.strideWidth&&("SAME"===n.padInfo.type||"VALID"===n.padInfo.type))return this.conv2dByMatMul(t,e,n);if(c().getBool("WEBGL_CONV_IM2COL")&&1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var i=new Xr(n);return this.compileAndRun(i,[t,e])},e.prototype.conv2dDerInput=function(t,e,n){var i=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,i=t.strideHeight,r=t.strideWidth,o="channelsLast"===t.dataFormat,s=e-1-t.padInfo.top,a=n-1-t.padInfo.left,l=o?1:2,u=o?2:3,c=o?3:1;this.userCode="\n const ivec2 pads = ivec2("+s+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords["+c+"];\n\n ivec2 dyCorner = ivec2(coords["+l+"], coords["+u+"]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+r+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n\n if ("+o+") {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.conv2dDerFilter=function(t,e,n){var i=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,i=t.padInfo.top,r=t.padInfo.left,o="channelsLast"===t.dataFormat;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+i+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+r+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n if ("+o+") {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.fusedDepthwiseConv2D=function(t){var e,n=t.input,i=t.filter,r=t.convInfo,o=t.bias,s=t.activation,a=t.preluActivationWeights,l=c().getBool("WEBGL_PACK_DEPTHWISECONV")&&r.strideWidth<=2&&r.outChannels/r.inChannels==1,u=s?Qo(s,l):null,h=[n,i],p=null!=o,d=null!=a;return p&&h.push(o),d&&h.push(a),l?(e=new Kr(r,p,u,d),this.compileAndRun(e,h)):(e=new Yr(r,p,u,d),this.compileAndRun(e,h))},e.prototype.depthwiseConv2D=function(t,e,n){var i;return c().getBool("WEBGL_PACK_DEPTHWISECONV")&&n.strideWidth<=2&&n.outChannels/n.inChannels==1?(i=new Kr(n),this.compileAndRun(i,[t,e])):(i=new Yr(n),this.compileAndRun(i,[t,e]))},e.prototype.depthwiseConv2DDerInput=function(t,e,n){var i=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,i=t.strideHeight,r=t.strideWidth,o=e-1-t.padInfo.top,s=n-1-t.padInfo.left,a=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2("+o+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+r+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < "+a+"; dm++) {\n int d2 = d1 * "+a+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.depthwiseConv2DDerFilter=function(t,e,n){var i=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,i=t.padInfo.top,r=t.padInfo.left,o=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+o+" + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+i+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+r+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.conv3d=function(t,e,n){var i=new function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,i=t.padInfo.left,r=t.strideDepth,o=t.strideHeight,s=t.strideWidth,a=t.dilationDepth,l=t.dilationHeight,u=t.dilationWidth,c=t.filterDepth,h=t.filterHeight,p=t.filterWidth,d=4*Math.floor(t.inChannels/4),f=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3("+r+", "+o+", "+s+");\n const ivec3 pads = ivec3("+e+", "+n+", "+i+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < "+c+"; wF++) {\n int xF = xFCorner + wF * "+a+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+h+"; wR++) {\n int xR = xRCorner + wR * "+l+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+"; wC++) {\n int xC = xCCorner + wC * "+u+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+d+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===f)+") {\n dotProd +=\n getX(batch, xF, xR, xC, "+d+") *\n getW(wF, wR, wC, "+d+", d2);\n } else if ("+(2===f)+") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, "+d+"),\n getX(batch, xF, xR, xC, "+d+" + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, "+d+", d2),\n getW(wF, wR, wC, "+d+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===f)+") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, "+d+"),\n getX(batch, xF, xR, xC, "+d+" + 1),\n getX(batch, xF, xR, xC, "+d+" + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, "+d+", d2),\n getW(wF, wR, wC, "+d+" + 1, d2),\n getW(wF, wR, wC, "+d+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.conv3dDerInput=function(t,e,n){var i=new function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,i=t.filterWidth,r=t.strideDepth,o=t.strideHeight,s=t.strideWidth,a=e-1-t.padInfo.front,l=n-1-t.padInfo.top,u=i-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3("+a+", "+l+", "+u+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < "+e+"; wF++) {\n float dyF = float(dyFCorner + wF) / "+r+".0;\n\n if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = "+e+" - 1 - wF;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+o+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+n+" - 1 - wR;\n\n for (int wC = 0; wC < "+i+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+s+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+i+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.conv3dDerFilter=function(t,e,n){var i=new function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,i=t.strideWidth,r=t.padInfo.front,o=t.padInfo.top,s=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n int xF = wF + yF * "+e+" - "+r+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+n+" - "+o+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+i+" - "+s+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t,e])},e.prototype.maxPool=function(t,e){var n=new Co(e,"max",!1);return this.compileAndRun(n,[t])},e.prototype.avgPool=function(t,e){var n=new Co(e,"avg",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.maxPoolBackprop=function(t,e,n,i){var r=new Co(i,"max",!0),o=this.compileAndRun(r,[e]),s=new function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,i=t.dilationHeight,r=t.effectiveFilterHeight,o=t.effectiveFilterWidth,s=r-1-t.padInfo.top,a=o-1-t.padInfo.left,l=r*o-1;this.userCode="\n const ivec2 pads = ivec2("+s+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+r+";\n wR += "+i+") {\n float dyR = float(dyRCorner + wR) / "+e+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+o+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+n+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+l+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+o+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "}(i),a=this.compileAndRun(s,[t,o],e.dtype);return o.dispose(),a},e.prototype.avgPoolBackprop=function(t,e,n){var i=new function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,i=t.strideHeight,r=t.strideWidth,o=t.dilationHeight,s=t.dilationWidth,a=t.effectiveFilterHeight,l=t.effectiveFilterWidth,u=a-1-t.padInfo.top,c=l-1-t.padInfo.left,h=1/(e*n);this.userCode="\n const ivec2 pads = ivec2("+u+", "+c+");\n const float avgMultiplier = float("+h+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+a+";\n wR += "+o+") {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+l+";\n wC+= "+s+") {\n float dyC = float(dyCCorner + wC) / "+r+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t],e.dtype)},e.prototype.cast=function(t,e){return er(t,e,this)},e.prototype.unstack=function(t,e){for(var n=t.shape[e],i=new Array(t.rank-1),r=0,o=0;o<t.rank;o++)o!==e&&(i[r++]=t.shape[o]);var s=new Array(t.rank).fill(0),a=t.shape.slice();a[e]=1;var l=new Array(n);for(o=0;o<l.length;o++)s[e]=o,l[o]=this.slice(t,s,a).reshape(i);return l},e.prototype.avgPool3d=function(t,e){var n=new So(e,"avg",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.avgPool3dBackprop=function(t,e,n){var i=new function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,i=t.filterWidth,r=t.strideDepth,o=t.strideHeight,s=t.strideWidth,a=t.dilationDepth,l=t.dilationHeight,u=t.dilationWidth,c=t.effectiveFilterDepth,h=t.effectiveFilterHeight,p=t.effectiveFilterWidth,d=c-1-t.padInfo.front,f=h-1-t.padInfo.top,g=p-1-t.padInfo.left,m=1/(e*n*i);this.userCode="\n const ivec3 pads = ivec3("+d+", "+f+", "+g+");\n const float avgMultiplier = float("+m+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < "+c+";\n wD += "+a+") {\n float dyD = float(dyDCorner + wD) / "+r+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+h+";\n wR += "+l+") {\n float dyR = float(dyRCorner + wR) / "+o+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+p+";\n wC += "+u+") {\n float dyC = float(dyCCorner + wC) / "+s+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n "}(n);return this.compileAndRun(i,[t],e.dtype)},e.prototype.maxPool3d=function(t,e){var n=new So(e,"max",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.maxPool3dBackprop=function(t,e,n,i){var r=new So(i,"max",!0),o=this.compileAndRun(r,[e]),s=new function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideDepth,n=t.strideHeight,i=t.strideWidth,r=t.dilationDepth,o=t.dilationHeight,s=t.dilationWidth,a=t.effectiveFilterDepth,l=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=a-1-t.padInfo.front,h=l-1-t.padInfo.top,p=u-1-t.padInfo.left,d=a*l*u-1;this.userCode="\n const ivec3 pads = ivec3("+c+", "+h+", "+p+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < "+a+";\n wD += "+r+") {\n float dyD = float(dyDCorner + wD) / "+e+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+l+";\n wR += "+o+") {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+u+";\n wC += "+s+") {\n float dyC = float(dyCCorner + wC) / "+i+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = "+d+" -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * "+l+" * "+u+" +\n wR * "+u+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n "}(i),a=this.compileAndRun(s,[t,o],e.dtype);return o.dispose(),a},e.prototype.reshape=function(t,e){var n=this.texData.get(t.dataId);if(n.isPacked&&!De(t.shape,e)&&(null===n.texture||!De(n.shape,e))){var i=this.packedReshape(t,e);return Pt.makeTensorFromDataId(i.dataId,i.shape,i.dtype)}return nr(t,e)},e.prototype.resizeBilinear=function(t,e,n,i){var r=c().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new function(t,e,n,i){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var r=t[0],o=t[1],s=t[2],a=t[3];this.outputShape=[r,e,n,a];var l=[i&&e>1?o-1:o,i&&n>1?s-1:s],u=[i&&e>1?e-1:e,i&&n>1?n-1:n];this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n "+l[0]/u[0]+",\n "+l[1]/u[1]+",\n "+l[1]/u[1]+");\n const vec3 inputShapeRC = vec3("+o+".0, "+s+".0,\n "+s+".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < "+(a-1)+";\n bool hasNextRow = coords.z < "+(n-1)+";\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,i):new function(t,e,n,i){this.variableNames=["A"],this.outputShape=[];var r=t[0],o=t[1],s=t[2],a=t[3];this.outputShape=[r,e,n,a];var l=[i&&e>1?o-1:o,i&&n>1?s-1:s],u=[i&&e>1?e-1:e,i&&n>1?n-1:n];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+l[0]/u[0]+",\n "+l[1]/u[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+s+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,i);return this.compileAndRun(r,[t],"float32")},e.prototype.resizeBilinearBackprop=function(t,e,n){var i=new function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var i=e.shape,r=i[1],o=i[2],s=t.shape,a=s[1],l=s[2],u=[n&&a>1?r-1:r,n&&l>1?o-1:o],c=[n&&a>1?a-1:a,n&&l>1?l-1:l],h=u[0]/c[0],p=u[1]/c[1],d=1/h,f=1/p,g=2*Math.ceil(d)+2,m=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+h+");\n const float widthScale = float("+p+");\n\n const float invHeightScale = float("+d+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+g+");\n const int winWidth = int("+m+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+a+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+l+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(r-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(o-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "}(t,e,n);return this.compileAndRun(i,[t])},e.prototype.resizeNearestNeighbor=function(t,e,n,i){var r=new function(t,e,n,i){this.variableNames=["A"],this.outputShape=[];var r=t[0],o=t[1],s=t[2],a=t[3];this.outputShape=[r,e,n,a];var l=[i&&e>1?o-1:o,i&&n>1?s-1:s],u=[i&&e>1?e-1:e,i&&n>1?n-1:n],c=i?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+l[0]/u[0]+",\n "+l[1]/u[1]+");\n const vec2 inputShapeRC = vec2("+o+".0, "+s+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+c+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n "}(t.shape,e,n,i);return this.compileAndRun(r,[t])},e.prototype.resizeNearestNeighborBackprop=function(t,e,n){var i=new function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var i=e.shape,r=i[1],o=i[2],s=t.shape,a=s[1],l=s[2],u=[n&&a>1?r-1:r,n&&l>1?o-1:o],c=[n&&a>1?a-1:a,n&&l>1?l-1:l],h=u[0]/c[0],p=u[1]/c[1],d=1/h,f=1/p,g=2*Math.ceil(d)+2,m=2*Math.ceil(f)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+h+");\n const float widthScale = float("+p+");\n\n const float invHeightScale = float("+d+");\n const float invWidthScale = float("+f+");\n\n const int winHeight = int("+g+");\n const int winWidth = int("+m+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+a+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+l+") {\n continue;\n }\n\n float sourceFracRow =\n float("+u[0]+") *\n (float(dyR) / float("+c[0]+"));\n\n float sourceFracCol =\n float("+u[1]+") *\n (float(dyC) / float("+c[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+r+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "}(t,e,n);return this.compileAndRun(i,[t])},e.prototype.multinomial=function(t,e,n,i){var r=e?t:Li(t),o=r.shape[0],s=r.shape[1],a=new Eo(o,s,n),l=a.getCustomSetupFunc(i);return this.compileAndRun(a,[r],"int32",l)},e.prototype.oneHot=function(t,e,n,i){var r=new function(t,e,n,i){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+i+"), float("+n+"),\n float(index == coords.y)));\n }\n "}(t.size,e,n,i);return this.compileAndRun(r,[t])},e.prototype.diag=function(t){var e=new function(t){this.variableNames=["X"],this.outputShape=[t,t],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "}(t.size);return this.compileAndRun(e,[t])},e.prototype.nonMaxSuppression=function(t,e,n,i,r){return $e("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),cr(t.dataSync(),e.dataSync(),n,i,r)},e.prototype.cropAndResize=function(t,e,n,i,r,o){var s=new function(t,e,n,i,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var o=t[0],s=t[1],a=t[2],l=t[3],u=e[0],c=n[0],h=n[1];this.outputShape=[u,c,h,l];var p="bilinear"===i?1:0,d=[s-1+".0",a-1+".0"],f=d[0],g=d[1],m=c>1?[""+(s-1)/(c-1),"(y2-y1) * height_ratio","y1*"+f+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+f],v=m[0],_=m[1],y=m[2],b=h>1?[""+(a-1)/(h-1),"(x2-x1) * width_ratio","x1*"+g+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+g],T=b[0],E=b[1],C=b[2];this.userCode="\n const float height_ratio = float("+v+");\n const float width_ratio = float("+T+");\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= "+o+") {\n return;\n }\n\n float height_scale = "+_+";\n float width_scale = "+E+";\n\n float in_y = "+y+";\n if( in_y < 0.0 || in_y > "+f+" ) {\n setOutput(float("+r+"));\n return;\n }\n float in_x = "+C+";\n if( in_x < 0.0 || in_x > "+g+" ) {\n setOutput(float("+r+"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if("+p+" == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n "}(t.shape,e.shape,i,r,o);return this.compileAndRun(s,[t,e,n],"float32")},e.prototype.depthToSpace=function(t,e,n){C(e>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+e});var i=t.shape[0],r="NHWC"===n?t.shape[1]:t.shape[2],o="NHWC"===n?t.shape[2]:t.shape[3],s="NHWC"===n?t.shape[3]:t.shape[1],a=r*e,l=o*e,u=s/(e*e),c=new qr("NHWC"===n?[i,a,l,u]:[i,u,a,l],e,n);return this.compileAndRun(c,[t])},e.prototype.split=function(t,e,n){return mr(t,e,n)},e.prototype.scatterND=function(t,e,n){var i=ki(0,t,n),r=i.sliceRank,o=i.numUpdates,s=i.sliceSize,a=i.strides,l=i.outputSize,u=[l/s,s],c=t.reshape([o,r]),h=e.reshape([o,s]);if(0===l)return nr(pn([]),n);var p=fn(0),d=new wo(o,r,c.rank,h.rank,a,u);return this.compileAndRun(d,[h,c,p]).reshape(n)},e.prototype.sparseToDense=function(t,e,n,i){var r=ki(0,t,n),o=r.sliceRank,s=r.numUpdates,a=r.strides,l=r.outputSize,u=new wo(s,o,t.rank,e.rank,a,[l,1],!1);return this.compileAndRun(u,[e,t,i]).reshape(n)},e.prototype.fft=function(t){return this.fftImpl(t,!1)},e.prototype.ifft=function(t){return this.fftImpl(t,!0)},e.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),i=new Zr("return real * expR - imag * expI;",t.shape,e),r=new Zr("return real * expI + imag * expR;",t.shape,e),o=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag)],s=this.compileAndRun(i,o),a=this.compileAndRun(r,o),l=this.complex(s,a).as2D(t.shape[0],t.shape[1]);return s.dispose(),a.dispose(),l},e.prototype.gatherND=function(t,e){var n=e.shape,i=n[n.length-1],r=Ti(t,e),o=r[0],s=r[1],a=r[2],l=r[3],u=e.reshape([s,i]),c=t.reshape([t.size/a,a]),h=new function(t,e,n){this.sliceDim=t,this.strides=e,this.variableNames=["x","indices"],this.outputShape=n;var i=Mr(e.length),r=Mr(n.length),o=this.sliceDim>1?"strides[j]":"strides";this.userCode="\n "+i+" strides = "+i+"("+this.strides+");\n void main() {\n "+r+" coords = getOutputCoords();\n int flattenIndex = 0;\n for (int j = 0; j < "+this.sliceDim+"; j++) {\n int index = round(getIndices(coords[0], j));\n flattenIndex += index * "+o+";\n }\n setOutput(getX(flattenIndex, coords[1]));\n }\n "}(i,l,[s,a]);return this.compileAndRun(h,[c,u]).reshape(o)},e.prototype.fill=function(t,e,n){if("string"===(n=n||Y(e))){var i=F(n,x(t));return i.fill(e),Pt.makeTensor(i,t,n,this)}var r=new Qr(t,e),o=r.getCustomSetupFunc(e);return this.compileAndRun(r,[],n,o)},e.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported under string dtype");return this.fill(t.shape,1,t.dtype)},e.prototype.zerosLike=function(t){return this.fill(t.shape,"string"===t.dtype?"":0,t.dtype)},e.prototype.linspace=function(t,e,n){return ir(t,e,n)},e.prototype.makeTensorInfo=function(t,e){var n=this.write(null,t,e);return this.texData.get(n).usage=null,{dataId:n,shape:t,dtype:e}},e.prototype.makeOutput=function(t,e){var n=this.makeTensorInfo(t,e).dataId;return Pt.makeTensorFromDataId(n,t,e,this)},e.prototype.unpackTensor=function(t){var e=new function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=t;var e=t.length,n=Tr("rc",e),i=Mr(e),r=function(t,e){if(1===t)return"rc";for(var n="",i=0;i<t;i++)n+=e[i],i<t-1&&(n+=",");return n}(e,n),o=n.slice(-2),s=e<=1?"rc":"vec2("+o.join(",")+")";this.userCode="\n void main() {\n "+i+" rc = getOutputCoords();\n vec4 packedInput = getA("+r+");\n\n setOutput(getChannel(packedInput, "+s+"));\n }\n "}(t.shape);return this.runWebGLProgram(e,[t],t.dtype)},e.prototype.packTensor=function(t){var e=new function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=t;var e=t.length;if(0===e)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var n=Tr("rc",e),i=Mr(e),r=function(t,e,n){if(1===t)return"rc > "+e[0];for(var i="",r=t-2;r<t;r++)i+=n[r]+" >= "+e[r],r<t-1&&(i+="||");return i}(e,t,n),o=function(t,e,n,i){if(1===t)return"";var r=i.slice(-2);return"\n int r = "+r[0]+";\n int c = "+r[1]+";\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= "+e+";\n bool rEdge = rp1 >= "+n+";\n "}(e,t[t.length-1],t[t.length-2],n),s=function(t,e){var n=t.length,i=function(t,e){for(var n=[],i=0;i<=1;i++)for(var r=0;r<=1;r++){for(var o=(0===i?"r":"rp1")+", "+(0===r?"c":"cp1"),s=2;s<t;s++)o=e[e.length-1-s]+","+o;n.push(o)}return n}(n,e);return 1===n?"getA(rc),\n rc + 1 >= "+t[0]+" ? 0. : getA(rc + 1),\n 0, 0":"getA("+i[0]+"),\n cEdge ? 0. : getA("+i[1]+"),\n rEdge ? 0. : getA("+i[2]+"),\n rEdge || cEdge ? 0. : getA("+i[3]+")"}(t,n);this.userCode="\n void main() {\n "+i+" rc = getOutputCoords();\n\n if("+r+") {\n setOutput(vec4(0));\n } else {\n "+o+"\n\n setOutput(vec4("+s+"));\n }\n }\n "}}(t.shape);return this.runWebGLProgram(e,[t],t.dtype,null,!0)},e.prototype.packedReshape=function(t,e){var n=[ke(t.shape)].concat(xe(t.shape)),i={dtype:t.dtype,shape:n,dataId:t.dataId},r=new function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var n="",i=0;i<4;i++){var r="thisRC = rc;";i%2==1&&(r+="thisRC.z += 1;"),i>1&&(r+="thisRC.y += 1;"),n+="\n "+r+"\n "+(i>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+"\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result["+i+"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n "+(i>0?"}":"")+"\n "}this.userCode="\n \n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n "+Cr(["r","c","d"],e)+"\n return ivec3(r, c, d);\n }\n \n "+Sr(t)+"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = "+t[1]+";\n int cols = "+t[2]+";\n\n "+n+"\n\n setOutput(result);\n }\n "}([ke(e)].concat(xe(e)),n),o=this.runWebGLProgram(r,[i],t.dtype,null,!0);return{dataId:o.dataId,shape:e,dtype:o.dtype}},e.prototype.decode=function(t){var e,n=this.texData.get(t),i=n.isPacked,r=n.shape,o=n.dtype,s=Ie(r);return e=i?new function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Ut.DENSE;var e=Xt(t),n=Er();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+Cr(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n "+n.output+" = result;\n }\n "}(s):new function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Ut.DENSE;var e=Xt(t),n=Er();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+Cr(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n "+n.output+" = result;\n }\n "}(s),{dtype:o,shape:r,dataId:this.runWebGLProgram(e,[{shape:s,dtype:o,dataId:t}],o,null,!0).dataId}},e.prototype.runWebGLProgram=function(t,e,n,i,r){var o=this;void 0===r&&(r=!1);var s=this.makeTensorInfo(t.outputShape,n),a=this.texData.get(s.dataId);if(t.packedOutput&&(a.isPacked=!0),t.outPackingScheme===Ut.DENSE){var l=Xt(t.outputShape);a.texShape=l.map(function(t){return 2*t})}if(null!=t.outTexUsage&&(a.usage=t.outTexUsage),0===x(s.shape))return a.values=B(s.dtype,0),s;var u=[],h=e.map(function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var n=o.texData.get(e.dataId);if(null==n.texture){if(!t.packedInputs&&x(e.shape)<=c().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:e.shape,texData:null,isUniform:!0,uniformValues:n.values};t.packedInputs&&(n.isPacked=!0,n.shape=e.shape)}else if(!!n.isPacked!=!!t.packedInputs)e=n.isPacked?o.unpackTensor(e):o.packTensor(e),u.push(e),n=o.texData.get(e.dataId);else if(n.isPacked&&!De(n.shape,e.shape)){var i=e,r=e.shape;e.shape=n.shape,e=o.packedReshape(e,r),u.push(e),n=o.texData.get(e.dataId),i.shape=r}return o.uploadToGPU(e.dataId),{shape:e.shape,texData:n,isUniform:!1}});this.uploadToGPU(s.dataId);var p,d={shape:s.shape,texData:a,isUniform:!1},f=function(t,e,n){var i="";h.concat(n).forEach(function(t){var e=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0,n=t.isUniform?"uniform":t.texData.texShape;i+=t.shape+"_"+n+"_"+e});var r=t.userCode;return t.constructor.name+"_"+i+"_"+r}(t,0,d),g=this.getAndSaveBinary(f,function(){return function(t,e,n,i){var r=e.userCode,o=n.map(function(t,n){var i={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&&t.texData.isPacked,flatOffset:null};return null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0&&(i.flatOffset=t.texData.slice.flatOffset),{name:e.variableNames[n],shapeInfo:i}}),s=o.map(function(t){return t.shapeInfo}),a={logicalShape:i.shape,texShape:i.texData.texShape,isUniform:!1,isPacked:i.texData.isPacked,flatOffset:null},l=kr(o,a,r,e.packedInputs),u=t.createProgram(l),h=null,p=t.getUniformLocation(u,"NAN",!1);1===c().getNumber("WEBGL_VERSION")&&(h=t.getUniformLocation(u,"INFINITY",!1));for(var d={},f=0;f<e.variableNames.length;f++){var g=e.variableNames[f];d[g]=t.getUniformLocation(u,g,!1),d["offset"+g]=t.getUniformLocation(u,"offset"+g,!1)}return{program:e,source:l,webGLProgram:u,uniformLocations:d,inShapeInfos:s,outShapeInfo:a,infLoc:h,nanLoc:p}}(o.gpgpu,t,h,d)}),m=null!=this.activeTimers;if(m&&(p=this.startTimer()),function(t,e,n,i,r){bo(e.inShapeInfos,n),bo([e.outShapeInfo],[i]);var o=i.texData.texture,s=i.texData.texShape;i.texData.isPacked?t.setOutputPackedMatrixTexture(o,s[0],s[1]):t.setOutputMatrixTexture(o,s[0],s[1]),t.setProgram(e.webGLProgram),1===c().getNumber("WEBGL_VERSION")&&null!==e.infLoc&&t.gl.uniform1f(e.infLoc,1/0),null!==e.nanLoc&&t.gl.uniform1f(e.nanLoc,NaN),n.forEach(function(n,i){var r=e.program.variableNames[i],o=e.uniformLocations[r],s=e.uniformLocations["offset"+r];if(null!=o)if(n.isUniform)if(x(n.shape)<2)t.gl.uniform1f(o,n.uniformValues[0]);else{var a=n.uniformValues;a instanceof Float32Array||(a=new Float32Array(a)),t.gl.uniform1fv(o,a)}else null!=n.texData.slice&&null!=s&&t.gl.uniform1i(s,n.texData.slice.flatOffset),t.setInputMatrixTexture(n.texData.texture,o,i)}),null!=r&&r(t,e.webGLProgram),t.executeProgram()}(this.gpgpu,g,h,d,i),u.forEach(function(t){return o.disposeData(t.dataId)}),m&&(p=this.endTimer(p),this.activeTimers.push({name:t.constructor.name,query:this.getQueryTime(p)})),!c().getBool("WEBGL_LAZILY_UNPACK")&&a.isPacked&&!1===r){var v=this.unpackTensor(s);return this.disposeData(s.dataId),v}return s},e.prototype.compileAndRun=function(t,e,n,i,r){void 0===r&&(r=!1),n=n||e[0].dtype;var o=this.runWebGLProgram(t,e,n,i,r);return Pt.makeTensorFromDataId(o.dataId,o.shape,o.dtype)},e.prototype.getAndSaveBinary=function(t,e){return t in this.binaryCache||(this.binaryCache[t]=e()),this.binaryCache[t]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){var t=this;this.disposed||(c().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(function(e){t.gpgpu.deleteProgram(t.binaryCache[e].webGLProgram),delete t.binaryCache[e]}),this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},e.prototype.floatPrecision=function(){var t=this;return null==this.floatPrecisionValue&&(this.floatPrecisionValue=je(function(){if(!c().get("WEBGL_RENDER_FLOAT32_ENABLED")){var e=c().getBool("DEBUG");c().set("DEBUG",!1);var n=t.abs(fn(1e-8)).dataSync()[0];if(c().set("DEBUG",e),n>0)return 32}return 16})),this.floatPrecisionValue},e.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},e.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),i=n.shape,r=n.dtype,o=n.values,s=n.texture,a=n.usage,l=n.isPacked;if(null==s){var u,c=null!=this.activeTimers;c&&(u=nt());var h=n.texShape;if(null==h&&(h=Re(i,l),n.texShape=h),null!=o){var p=Ie(i),d=void 0,f=h[1],g=h[0],m=o instanceof Uint8Array;l?(f=(e=Yt(h[0],h[1]))[0],d=new function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var i=Er(),r=e[0],o=e[1];this.outputShape=t;var s="",a="result";n&&(a="floor(result * 255. + 0.5)");for(var l=0;l<=1;l++)for(var u=0;u<=1;u++){var c=2*l+u;s+="\n localCoords = coords;\n if(localCoords[2] + "+u+" < "+t[2]+") {\n localCoords[2] += "+u+";\n if(localCoords[1] + "+l+" < "+t[1]+") {\n localCoords[1] += "+l+";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n r = flatIndex / "+o+";\n c = imod(flatIndex, "+o+");\n uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+r+".0);\n values = "+i.texture2D+"(A, uv);\n\n if(offset == 0) {\n result["+c+"] = values[0];\n } else if(offset == 1) {\n result["+c+"] = values[1];\n } else if(offset == 2) {\n result["+c+"] = values[2];\n } else {\n result["+c+"] = values[3];\n }\n }\n }\n "}this.userCode="\n "+Sr(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n "+s+"\n\n "+i.output+" = "+a+";\n }\n "}(p,[g=e[1],f],m)):d=new function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"];var i=Er(),r=e[0],o=e[1];this.outputShape=t;var s="result";n&&(s="floor(result * 255. + 0.5)"),this.userCode="\n "+Sr(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n \n int r = flatIndex / "+o+";\n int c = imod(flatIndex, "+o+");\n vec2 uv = (vec2(c, r) + halfCR) / vec2("+o+".0, "+r+".0);\n vec4 values = "+i.texture2D+"(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n "+i.output+" = vec4("+s+", 0., 0., 0.);\n }\n "}(p,[g,f],m);var v=this.makeTensorInfo([g,f],r);this.texData.get(v.dataId).usage=m?Vt.PIXELS:Vt.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(v.dataId),f,g,o);var _=this.runWebGLProgram(d,[v],r,null,!0),y=this.texData.get(_.dataId);n.texture=y.texture,n.texShape=y.texShape,n.isPacked=y.isPacked,n.usage=y.usage,this.disposeData(v.dataId),this.texData.delete(_.dataId),n.values=null,c&&(this.uploadWaitMs+=nt()-u)}else{var b=this.acquireTexture(h,a,r,l);n.texture=b}}},e.prototype.convertAndCacheOnCPU=function(t,e){var n=this.texData.get(t),i=n.dtype;return this.releaseGPUData(t),null!=e&&(n.values=function(t,e){if("float32"===e||"complex64"===e)return t;if("int32"===e||"bool"===e){for(var n="int32"===e?new Int32Array(t.length):new Uint8Array(t.length),i=0;i<n.length;++i)n[i]=Math.round(t[i]);return n}throw new Error("Unknown dtype "+e)}(e,i)),n.values},e.prototype.acquireTexture=function(t,e,n,i){if(this.numBytesInGPU+=this.computeBytes(t,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+r+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(t,e,i)},e.prototype.computeBytes=function(t,e){return t[0]*t[1]*G(e)},e}(Fi);Bt()&&Pt.registerBackend("webgl",function(){return new es},2);var ns=ln({square_:function(t){var e=Ke(t,"x","square"),n=[e];return Pt.runKernelFunc(function(t,n){return n([e]),t.square(e)},{x:e},null,"Square",{},n,[])}}),is="SquaredDifference",rs=ln({squaredDifference_:function(t,e){var n,i=Ke(t,"a","squaredDifference"),r=Ke(e,"b","squaredDifference");n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape);var o={a:i,b:r},s=[i,r];return Pt.runKernelFunc(function(t,e){var n=t.squaredDifference(i,r);return e([i,r]),n},o,function(t,e){var n=e[0],i=e[1],r=fn(2);return{a:function(){return t.mul(n.sub(i).mul(r))},b:function(){return t.mul(i.sub(n).mul(r))}}},is,{},s,[])}}),os=ln({abs_:function(t){var e=Ke(t,"x","abs");return"complex64"===e.dtype?Pt.runKernelFunc(function(t){return t.complexAbs(e)},{$x:e}):Pt.runKernelFunc(function(t,n){var i=t.abs(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return t.mul(n.toFloat().step(-1))}}},"Abs")}}),ss=ln({acos_:function(t){var e=Ke(t,"x","acos");return Pt.runKernelFunc(function(t,n){var i=t.acos(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(fn(1).sub(n.toFloat().square()).sqrt()).neg()}}})}}),as=ln({acosh_:function(t){var e=Ke(t,"x","acosh");return Pt.runKernelFunc(function(t,n){var i=t.acosh(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(n.toFloat().square().sub(1).sqrt())}}})}}),ls=ln({asin_:function(t){var e=Ke(t,"x","asin");return Pt.runKernelFunc(function(t,n){var i=t.asin(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(fn(1).sub(n.toFloat().square()).sqrt())}}})}}),us=ln({asinh_:function(t){var e=Ke(t,"x","asinh");return Pt.runKernelFunc(function(t,n){var i=t.asinh(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.divStrict(fn(1).add(n.toFloat().square()).sqrt())}}})}}),cs=ln({atan_:function(t){var e=Ke(t,"x","atan");return Pt.runKernelFunc(function(t,n){var i=t.atan(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().square().add(1))}}})}}),hs=ln({atanh_:function(t){var e=Ke(t,"x","atanh");return Pt.runKernelFunc(function(t,n){var i=t.atanh(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(fn(1).sub(n.toFloat().square()))}}})}}),ps=ln({ceil_:function(t){var e=Ke(t,"x","ceil");return Pt.runKernelFunc(function(t){return t.ceil(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),ds=ln({clipByValue_:function(t,e,n){var i=Ke(t,"x","clipByValue");C(e<=n,function(){return"Error in clip: min ("+e+") must be less than or equal to max ("+n+")."});var r=[i],o={min:e,max:n};return Pt.runKernelFunc(function(t,r){var o=t.clip(i,e,n);return r([i]),o},{x:i},function(t,i){var r=i[0];return{x:function(){return t.where(r.greaterEqual(e).logicalAnd(r.lessEqual(n)),Sn(t))}}},"ClipByValue",o,r)}}),fs=ln({cos_:function(t){var e=Ke(t,"x","cos"),n=[e];return Pt.runKernelFunc(function(t,n){var i=t.cos(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return n.toFloat().sin().neg().mul(t)}}},"Cos",{},n)}}),gs=ln({cosh_:function(t){var e=Ke(t,"x","cosh");return Pt.runKernelFunc(function(t,n){var i=t.cosh(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sinh().mulStrict(t)}}})}}),ms=ln({erf_:function(t){var e=Ke(t,"x","erf");return C("int32"===e.dtype||"float32"===e.dtype,function(){return"Input dtype must be `int32` or `float32`."}),"int32"===e.dtype&&(e=e.toFloat()),Pt.runKernelFunc(function(t,n){var i=t.erf(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}})}}),vs=ln({exp_:function(t){var e=Ke(t,"x","exp");return Pt.runKernelFunc(function(t,n){var i=t.exp(e);return n([i]),i},{x:e},function(t,e){return{x:function(){return t.mulStrict(e[0])}}},"Exp",{},[],[!0])}}),_s=ln({expm1_:function(t){var e=Ke(t,"x","expm1");return Pt.runKernelFunc(function(t,n){var i=t.expm1(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.exp())}}})}}),ys=ln({floor_:function(t){var e=Ke(t,"x","floor");return Pt.runKernelFunc(function(t){return t.floor(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),bs=ln({log_:function(t){var e=Ke(t,"x","log"),n=[e];return Pt.runKernelFunc(function(t,n){var i=t.log(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return t.div(n.toFloat())}}},"Log",{},n)}}),Ts=ln({log1p_:function(t){var e=Ke(t,"x","log1p");return Pt.runKernelFunc(function(t,n){var i=t.log1p(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.add(1))}}})}}),Es=ln({logSigmoid_:function(t){var e=Ke(t,"x","logSigmoid");return Pt.runKernelFunc(function(t,n){var i=t.softplus(e.neg()).neg();return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.neg().sigmoid())}}})}}),Cs=ln({neg_:function(t){var e=Ke(t,"x","neg"),n=[e];return Pt.runKernelFunc(function(t){return t.neg(e)},{x:e},function(t){return{x:function(){return t.neg()}}},"Neg",{},n)}}),Ss=ln({reciprocal_:function(t){var e=Ke(t,"x","reciprocal");return Pt.runKernelFunc(function(t,n){var i=t.reciprocal(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.square().neg())}}})}}),ws=ln({round_:function(t){var e=Ke(t,"x","round");return Pt.runKernelFunc(function(t){return t.round(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),ks=ln({rsqrt_:function(t){var e=Ke(t,"x","rsqrt"),n=[e];return Pt.runKernelFunc(function(t,n){var i=t.rsqrt(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return t.div(n.pow(1.5).mul(2)).neg()}}},"Rsqrt",{},n)}}),xs=ln({sigmoid_:function(t){var e=Ke(t,"x","sigmoid");return Pt.runKernelFunc(function(t,n){var i=t.sigmoid(e);return n([i]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return t.mul(n.mul(fn(1).sub(n)))}}},"Sigmoid")}}),Is=ln({sign_:function(t){var e=Ke(t,"x","sign");return Pt.runKernelFunc(function(t){return t.sign(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),Rs=ln({isNaN_:function(t){var e=Ke(t,"x","isNaN");return Pt.runKernelFunc(function(t){return t.isNaN(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),Os=ln({isInf_:function(t){var e=Ke(t,"x","isInf");return Pt.runKernelFunc(function(t){return t.isInf(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),Ds=ln({isFinite_:function(t){var e=Ke(t,"x","isFinite");return Pt.runKernelFunc(function(t){return t.isFinite(e)},{$x:e},function(t){return{$x:function(){return Sn(t)}}})}}),As=ln({sin_:function(t){var e=Ke(t,"x","sin"),n=[e];return Pt.runKernelFunc(function(t,n){var i=t.sin(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return n.toFloat().cos().mul(t)}}},"Sin",{},n)}}),Ms=ln({sinh_:function(t){var e=Ke(t,"x","sinh");return Pt.runKernelFunc(function(t,n){var i=t.sinh(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cosh().mulStrict(t)}}})}}),Ns=ln({softplus_:function(t){var e=Ke(t,"x","softplus");return Pt.runKernelFunc(function(t,n){var i=t.softplus(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.mul(n.sigmoid())}}})}}),Ls=ln({sqrt_:function(t){var e=Ke(t,"x","sqrt");return Pt.runKernelFunc(function(t,n){var i=t.sqrt(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().sqrt().mul(2))}}})}}),Ps=ln({step_:function(t,e){void 0===e&&(e=0);var n=Ke(t,"x","step");return Pt.runKernelFunc(function(t){return t.step(n,e)},{$x:n},function(t){return{$x:function(){return Sn(t)}}})}}),Bs=ln({tan_:function(t){var e=Ke(t,"x","tan");return Pt.runKernelFunc(function(t,n){var i=t.tan(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return t.div(n.cos().square())}}})}}),Fs=ln({tanh_:function(t){var e=Ke(t,"x","tanh");return Pt.runKernelFunc(function(t,n){var i=t.tanh(e);return n([i]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return fn(1).sub(n.square()).mulStrict(t)}}},"Tanh",{},null,[!0])}});function Us(t,e,n,i,r,o){var s,a,l=Ke(t,"x","batchNorm"),u=Ke(e,"mean","batchNorm"),c=Ke(n,"variance","batchNorm");return null!=r&&(s=Ke(r,"scale","batchNorm")),null!=i&&(a=Ke(i,"offset","batchNorm")),C(2===l.rank,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+l.rank+"."}),C(2===u.rank||1===u.rank,function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+u.rank+"."}),C(2===c.rank||1===c.rank,function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+c.rank+"."}),null!=s&&C(2===s.rank||1===s.rank,function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+s.rank+"."}),null!=a&&C(2===a.rank||1===a.rank,function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+a.rank+"."}),Ws(l,u,c,a,s,o)}function Vs(t,e,n,i,r,o){var s,a,l=Ke(t,"x","batchNorm"),u=Ke(e,"mean","batchNorm"),c=Ke(n,"variance","batchNorm");return null!=r&&(s=Ke(r,"scale","batchNorm")),null!=i&&(a=Ke(i,"offset","batchNorm")),C(3===l.rank,function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+l.rank+"."}),C(3===u.rank||1===u.rank,function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+u.rank+"."}),C(3===c.rank||1===c.rank,function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+c.rank+"."}),null!=s&&C(3===s.rank||1===s.rank,function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+s.rank+"."}),null!=a&&C(3===a.rank||1===a.rank,function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+a.rank+"."}),Ws(l,u,c,a,s,o)}function Hs(t,e,n,i,r,o){var s,a,l=Ke(t,"x","batchNorm"),u=Ke(e,"mean","batchNorm"),c=Ke(n,"variance","batchNorm");return null!=r&&(s=Ke(r,"scale","batchNorm")),null!=i&&(a=Ke(i,"offset","batchNorm")),C(4===l.rank,function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+l.rank+"."}),C(4===u.rank||1===u.rank,function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+u.rank+"."}),C(4===c.rank||1===c.rank,function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+c.rank+"."}),null!=s&&C(4===s.rank||1===s.rank,function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+s.rank+"."}),null!=a&&C(4===a.rank||1===a.rank,function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+a.rank+"."}),Ws(l,u,c,a,s,o)}function Ws(t,e,n,i,r,o){null==o&&(o=.001);var s,a,l,u=Ke(t,"x","batchNorm"),c=Ke(e,"mean","batchNorm"),h=Ke(n,"variance","batchNorm");null!=r&&(s=Ke(r,"scale","batchNorm")),null!=i&&(a=Ke(i,"offset","batchNorm")),C(c.rank===h.rank,function(){return"Batch normalization gradient requires mean and variance to have equal ranks."}),C(null==a||c.rank===a.rank,function(){return"Batch normalization gradient requires mean and offset to have equal ranks."}),C(null==s||c.rank===s.rank,function(){return"Batch normalization gradient requires mean and scale to have equal ranks."}),l=0===u.rank||1===u.rank?u.as4D(1,1,1,u.size):2===u.rank?u.as4D(1,1,u.shape[0],u.shape[1]):3===u.rank?u.as4D(1,u.shape[0],u.shape[1],u.shape[2]):u;var p=[u,c,h,s];return Pt.runKernelFunc(function(t,e){var n=t.batchNormalization(l,Gs(c),Gs(h),o,Gs(s),Gs(a));return e([u,c,h,s]),n},{x:u,mean:c,variance:h,scale:s,offset:a},function(t,e){var n=e,i=n[0],r=n[1],s=n[2],a=n[3],u=null==a?fn(1):a,c=Hi(r.shape,l.shape),h=[];if(1===r.rank){for(var p=0;p<l.shape.length-1;++p)h.push(l.shape[p]);h.push(1)}var d=i.sub(r),f=t.mul(u),g=ks(s.add(fn(o))),m=g.mul(g).mul(g).mul(fn(-.5));return{x:function(){return 1===r.rank?t.mul(di(g.as4D(1,1,1,r.shape[0]),h)).mul(u).reshape(i.shape):t.mul(g).mul(u).reshape(i.shape)},mean:function(){var t=g.mul(fn(-1)).mul(f);return 1===r.rank&&(t=t.sum(c)),t.reshape(r.shape)},variance:function(){var t=m.mul(d).mul(f);return 1===r.rank&&(t=t.sum(c)),t.reshape(r.shape)},scale:function(){var e=d.mul(g),n=t.mul(e);return 1===r.rank&&(n=n.sum(c)),n.reshape(r.shape)},offset:function(){var e=t;return 1===r.rank&&(e=e.sum(c)),e.reshape(r.shape)}}},"BatchNormalization",{varianceEpsilon:o},p).reshape(u.shape)}function Gs(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function js(){Ge("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var zs=ln({batchNormalization2d_:function(t,e,n,i,r,o){return void 0===i&&(i=.001),js(),Us(t,e,n,o,r,i)}}),$s=ln({batchNormalization3d_:function(t,e,n,i,r,o){return void 0===i&&(i=.001),js(),Vs(t,e,n,o,r,i)}}),Xs=ln({batchNormalization4d_:function(t,e,n,i,r,o){return void 0===i&&(i=.001),js(),Hs(t,e,n,o,r,i)}}),Ys=ln({batchNormalization_:function(t,e,n,i,r,o){return void 0===i&&(i=.001),js(),Ws(t,e,n,o,r,i)}}),Ks=ln({batchNorm_:Ws}),Js=ln({batchNorm2d_:Us}),qs=ln({batchNorm3d_:Vs}),Zs=ln({batchNorm4d_:Hs}),Qs=ln({logicalAnd_:function(t,e){var n=Ke(t,"a","logicalAnd","bool"),i=Ke(e,"b","logicalAnd","bool");return Wi(n.shape,i.shape),Pt.runKernelFunc(function(t){return t.logicalAnd(n,i)},{a:n,b:i},null,"LogicalAnd")}}),ta=ln({logicalNot_:function(t){var e=Ke(t,"x","logicalNot","bool");return Pt.runKernelFunc(function(t){return t.logicalNot(e)},{$x:e})}}),ea=ln({logicalOr_:function(t,e){var n=Ke(t,"a","logicalOr","bool"),i=Ke(e,"b","logicalOr","bool");return Wi(n.shape,i.shape),Pt.runKernelFunc(function(t){return t.logicalOr(n,i)},{$a:n,$b:i})}}),na=ln({logicalXor_:function(t,e){var n=Ke(t,"a","logicalXor","bool"),i=Ke(e,"b","logicalXor","bool");return Wi(n.shape,i.shape),ea(t,e).logicalAnd(Qs(t,e).logicalNot())}}),ia=ln({where_:function(t,e,n){var i=Ke(e,"a","where"),r=Ke(n,"b","where"),o=Ke(t,"condition","where","bool");return S(i.shape,r.shape,"Error in where: "),1===o.rank?C(o.shape[0]===i.shape[0],function(){return"The first dimension of `a` must match the size of `condition`."}):S(o.shape,r.shape,"Error in where: "),Pt.runKernelFunc(function(t,e){var n=t.select(o,i,r);return e([o]),n},{$condition:o,$a:i,$b:r},function(t,e){var n=e[0];return{$condition:function(){return Sn(n).toFloat()},$a:function(){return t.mul(n.cast(t.dtype))},$b:function(){return t.mul(n.logicalNot().cast(t.dtype))}}})}}),ra=function(t){return a(this,void 0,void 0,function(){var e,n,i;return l(this,function(r){switch(r.label){case 0:return[4,(e=Ke(t,"condition","whereAsync","bool")).data()];case 1:return n=r.sent(),i=yr(e.shape,n),t!==e&&e.dispose(),[2,i]}})})},oa=ln({add_:function(t,e){var n,i=Ke(t,"a","add"),r=Ke(e,"b","add");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t){return t.add(i,r)},{a:i,b:r},function(t){return{a:function(){var e=t,n=Hi(i.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(i.shape)},b:function(){var e=t,n=Hi(r.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)}}},"Add")}}),sa=ln({addN_:function(t){C(Array.isArray(t),function(){return"The argument passed to tf.addN() must be a list of tensors"}),C(t.length>=1,function(){return"Must pass at least one tensor to tf.addN(), but got "+t.length});var e=t.map(function(t,e){return Ke(t,"tensors"+e,"addN")}),n=e[0];e.forEach(function(t){if(t.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")}),e.forEach(function(t){if(!I(t.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")});var i=e;return Pt.runKernelFunc(function(t){return t.addN(e)},i,function(t){var n={};return e.forEach(function(e,i){n[i]=function(){return t.clone()}}),n},"AddN")}}),aa=ln({addStrict_:function(t,e){var n=Ke(t,"a","addStrict"),i=Ke(e,"b","addStrict");return S(n.shape,i.shape,"Error in addStrict: "),n.add(i)}}),la=ln({atan2_:function(t,e){var n,i=Ke(t,"a","atan2"),r=Ke(e,"b","atan2");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t,e){var n=t.atan2(i,r);return e([i,r]),n},{$a:i,$b:r},function(t,e){var n=e[0],i=e[1];return{$a:function(){var e=oa(n.square(),i.square()),r=t.mul(i.div(e)),s=Hi(n.shape,o);return s.length>0&&(r=r.sum(s)),r.reshape(n.shape)},$b:function(){var e=oa(n.square(),i.square()),r=Cs(t.mul(n.div(e))),s=Hi(i.shape,o);return s.length>0&&(r=r.sum(s)),r.reshape(i.shape)}}})}}),ua=ln({div_:function(t,e){var n,i=Ke(t,"a","div"),r=Ke(e,"b","div");if(n=Ot(i,r),i=n[0],r=n[1],"int32"===i.dtype&&"int32"===r.dtype)return pa(i,r);var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t,e){var n=t.realDivide(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){var e=t.div(i.toFloat()),r=Hi(n.shape,o);return r.length>0?e.sum(r).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),r=Hi(i.shape,o);r.length>0&&(e=e.sum(r).reshape(i.shape));var s=i.square();return e.div(s.toFloat()).neg()}}},"Div")}}),ca=ln({divNoNan_:function(t,e){var n,i=Ke(t,"a","div"),r=Ke(e,"b","div");i=(n=Ot(i,r))[0],r=n[1];var o=ua(i,r),s=Sn(o),a=r.equal(s);return ia(a,s,o)}}),ha=ln({divStrict_:function(t,e){var n=Ke(t,"a","div"),i=Ke(e,"b","div");return S(n.shape,i.shape,"Error in divideStrict: "),n.div(i)}}),pa=ln({floorDiv_:function(t,e){var n,i=Ke(t,"a","floorDiv"),r=Ke(e,"b","floorDiv");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t,e){var n=t.floorDiv(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){var e=t.div(i.toFloat()),r=Hi(n.shape,o);return r.length>0?e.sum(r).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),r=Hi(i.shape,o);r.length>0&&(e=e.sum(r).reshape(i.shape));var s=i.square();return e.div(s.toFloat()).neg()}}},"FloorDiv")}}),da=ln({maximum_:function(t,e){var n,i=Ke(t,"a","maximum"),r=Ke(e,"b","maximum");return n=Ot(i,r),i=n[0],r=n[1],"bool"===i.dtype&&(i=i.toInt(),r=r.toInt()),Wi(i.shape,r.shape),Pt.runKernelFunc(function(t,e){var n=t.maximum(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){return t.mul(n.greaterEqual(i).toFloat())},b:function(){return t.mul(n.less(i).toFloat())}}},"Maximum")}}),fa=ln({maximumStrict_:function(t,e){var n=Ke(t,"a","maximumStrict"),i=Ke(e,"b","maximumStrict");return S(n.shape,i.shape,"Error in maximumStrict: "),n.maximum(i)}}),ga=ln({minimum_:function(t,e){var n,i=Ke(t,"a","minimum"),r=Ke(e,"b","minimum");return n=Ot(i,r),i=n[0],r=n[1],"bool"===i.dtype&&(i=i.toInt(),r=r.toInt()),Wi(i.shape,r.shape),Pt.runKernelFunc(function(t,e){var n=t.minimum(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){return t.mul(n.lessEqual(i).toFloat())},b:function(){return t.mul(n.greater(i).toFloat())}}},"Minimum")}}),ma=ln({minimumStrict_:function(t,e){var n=Ke(t,"a","minimumStrict"),i=Ke(e,"b","minimumStrict");return S(n.shape,i.shape,"Error in minimumStrict: "),n.minimum(i)}}),va=ln({mod_:function(t,e){var n,i=Ke(t,"a","mod"),r=Ke(e,"b","mod");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t,e){var n=t.mod(i,r);return e([i,r]),n},{$a:i,$b:r},function(t,e){var n=e[0],i=e[1];return{$a:function(){var e=Hi(n.shape,o);return e.length>0?t.sum(e).reshape(n.shape):t},$b:function(){var e=t.mul(n.div(i).floor().neg()),r=Hi(i.shape,o);return r.length>0?e.sum(r).reshape(i.shape):e}}})}}),_a=ln({modStrict_:function(t,e){var n=Ke(t,"a","modStrict"),i=Ke(e,"b","modStrict");return S(n.shape,i.shape,"Error in modStrict: "),n.mod(i)}}),ya=ln({mul_:function(t,e){var n,i=Ke(t,"a","mul"),r=Ke(e,"b","mul");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t,e){var n=t.multiply(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){var e=t.mul(i.toFloat()),r=Hi(n.shape,o);return r.length>0?e.sum(r).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),r=Hi(i.shape,o);return r.length>0?e.sum(r).reshape(i.shape):e}}},"Mul")}}),ba=ln({mulStrict_:function(t,e){var n=Ke(t,"a","mul"),i=Ke(e,"b","mul");return S(n.shape,i.shape,"Error in multiplyStrict: "),n.mul(i)}}),Ta=ln({pow_:function(t,e){var n,i=Ke(t,"base","pow"),r=Ke(e,"exp","pow");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape),s=[i,r];return Pt.runKernelFunc(function(t,e){var n=t.pow(i,r);return e([i,r,n]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1],r=e[2];return{a:function(){var e=i.toFloat(),r=t.mul(e.mul(n.pow(e.sub(fn(1))))),s=Hi(n.shape,o);return s.length>0&&(r=r.sum(s)),r.reshape(n.shape)},b:function(){var e=n.greater(0),s=n.log().where(e,Sn(n)),a=t.mul(r.mul(s)),l=Hi(i.shape,o);return l.length>0&&(a=a.sum(l)),a.reshape(i.shape)}}},"Pow",{},s,[!0])}}),Ea=ln({powStrict_:function(t,e){return S(t.shape,e.shape,"Error in powStrict: "),t.pow(e)}}),Ca=ln({squaredDifferenceStrict_:function(t,e){var n=Ke(t,"a","squaredDifferenceStrict"),i=Ke(e,"b","squaredDifferenceStrict");return S(n.shape,i.shape,"Error in squaredDifferenceStrict: "),n.squaredDifference(i)}}),Sa=ln({sub_:function(t,e){var n,i=Ke(t,"a","sub"),r=Ke(e,"b","sub");n=Ot(i,r),i=n[0],r=n[1];var o=Wi(i.shape,r.shape);return Pt.runKernelFunc(function(t){return t.subtract(i,r)},{a:i,b:r},function(t){return{a:function(){var e=t,n=Hi(i.shape,o);return n.length>0&&(e=e.sum(n)),e.reshape(i.shape)},b:function(){var e=t,n=Hi(r.shape,o);return n.length>0&&(e=e.sum(n)),e.neg().reshape(r.shape)}}},"Sub")}}),wa=ln({subStrict_:function(t,e){var n=Ke(t,"a","subStrict"),i=Ke(e,"b","subStrict");return S(n.shape,i.shape,"Error in subStrict: "),n.sub(i)}}),ka=ln({equal_:function(t,e){var n,i=Ke(t,"a","equal"),r=Ke(e,"b","equal");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t){return t.equal(i,r)},{$a:i,$b:r})}}),xa=ln({equalStrict_:function(t,e){var n=Ke(t,"a","equalStrict"),i=Ke(e,"b","equalStrict");return S(n.shape,i.shape,"Error in equalStrict: "),n.equal(i)}}),Ia=ln({greater_:function(t,e){var n,i=Ke(t,"a","greater"),r=Ke(e,"b","greater");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t){return t.greater(i,r)},{a:i,b:r},null,"Greater")}}),Ra=ln({greaterEqual_:function(t,e){var n,i=Ke(t,"a","greaterEqual"),r=Ke(e,"b","greaterEqual");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t,e){var n=t.greaterEqual(i,r);return e([i,r]),n},{a:i,b:r},function(t,e){var n=e[0],i=e[1];return{a:function(){return Sn(n)},b:function(){return Sn(i)}}},"GreaterEqual")}}),Oa=ln({greaterEqualStrict_:function(t,e){var n=Ke(t,"a","greaterEqualStrict"),i=Ke(e,"b","greaterEqualStrict");return S(n.shape,i.shape,"Error in greaterEqualStrict: "),n.greaterEqual(i)}}),Da=ln({greaterStrict_:function(t,e){var n=Ke(t,"a","greaterStrict"),i=Ke(e,"b","greaterStrict");return S(n.shape,i.shape,"Error in greaterStrict: "),n.greater(i)}}),Aa=ln({less_:function(t,e){var n,i=Ke(t,"a","less"),r=Ke(e,"b","less");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t){return t.less(i,r)},{a:i,b:r},null,"Less")}}),Ma=ln({lessEqual_:function(t,e){var n,i=Ke(t,"a","lessEqual"),r=Ke(e,"b","lessEqual");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t,e){var n=t.lessEqual(i,r);return e([i,r]),n},{a:i,b:r},null,"LessEqual")}}),Na=ln({lessEqualStrict_:function(t,e){var n=Ke(t,"a","lessEqualStrict"),i=Ke(e,"b","lessEqualStrict");return S(n.shape,i.shape,"Error in lessEqualStrict: "),n.lessEqual(i)}}),La=ln({lessStrict_:function(t,e){var n=Ke(t,"a","lessStrict"),i=Ke(e,"b","lessStrict");return S(n.shape,i.shape,"Error in lessStrict: "),n.less(i)}}),Pa=ln({notEqual_:function(t,e){var n,i=Ke(t,"a","notEqual"),r=Ke(e,"b","notEqual");return n=Ot(i,r),i=n[0],r=n[1],Wi(i.shape,r.shape),Pt.runKernelFunc(function(t){return t.notEqual(i,r)},{a:i,b:r},null,"NotEqual")}}),Ba=ln({notEqualStrict_:function(t,e){var n=Ke(t,"a","notEqualStrict"),i=Ke(e,"b","notEqualStrict");return S(n.shape,i.shape,"Error in notEqualStrict: "),n.notEqual(i)}});function Fa(t,e){for(var n=[],i=t;i<e;++i)n.push(i);return n}function Ua(t){for(var e=[],n=0;n<t.length;++n)for(var i=0;i<t[n].length;++i)e.push(t[n][i]);return e}var Va=ln({gather_:function(t,e,n){void 0===n&&(n=0);var i=Ke(t,"x","gather"),r=Ke(e,"indices","gather","int32");n=L(n,i.shape)[0];var o=function(t,e,n){for(var i=t.shape[n],r=[],o=1,s=1,a=0;a<n;a++)r.push(t.shape[a]),o*=t.shape[a];for(a=0;a<e.rank;a++)r.push(e.shape[a]);for(a=n+1;a<t.rank;a++)r.push(t.shape[a]),s*=t.shape[a];return{batchSize:o,sliceSize:s,dimSize:i,outputShape:r}}(i,r,n);return Pt.runKernelFunc(function(t,e){var o=t.gather(i,r.flatten(),n);return e([r]),o},{x:i,indices:r},function(t,e){var r=e[0];return{x:function(){var e=i.shape,o=r.size,s=e.slice(0,n),a=s.length,l=e.slice(n,e.length).slice(1),u=l.length,c=Fa(0,a),h=Fa(a+1,a+1+u),p=Ua([s,[o],l]),d=t.reshape(p),f=r.reshape([o]),g=Ua([[a],c,h]),m=d.transpose(g),v=Ha(m,f,i.shape[n]),_=rn(g);return v.transpose(_)},indices:function(){return r}}},"Gather",{axis:n}).reshape(o.outputShape)}}),Ha=ln({unsortedSegmentSum_:function(t,e,n){var i=Ke(t,"x","unsortedSegmentSum"),r=Ke(e,"segmentIds","unsortedSegmentSum","int32");return C(R(n),function(){return"numSegments must be of dtype int"}),Pt.runKernelFunc(function(t,e){var o=t.unsortedSegmentSum(i,r,n);return e([r]),o},{$x:i},function(t,e){var n=e[0];return{$x:function(){return function(t,e){for(var n=da(e,Sn(e)),i=Va(t,n),r=Ra(e,fn(0,"int32")),o=i.rank-r.rank,s=0;s<o;++s)r=Jn(r,s+1);r=Qs(r,yn(i.shape,"bool"));var a=Sn(i);return ia(r,i,a)}(t,n)}}})}});function Wa(t,e,n,i,r,o,s){void 0===o&&(o="NHWC"),C(t.length===e.rank,function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"});var a=t,l=e,u=!1;3===e.rank&&(u=!0,l=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]),a=[1,t[0],t[1],t[2]]),C(4===a.length,function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+a.length+"."}),C(4===l.rank,function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+l.rank}),C(4===n.rank,function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank});var c="NHWC"===o?a[3]:a[1],h="NHWC"===o?l.shape[3]:l.shape[1];C(c===n.shape[2],function(){return"Error in conv2dDerInput: depth of input ("+c+") must match input depth for filter "+n.shape[2]+"."}),C(h===n.shape[3],function(){return"Error in conv2dDerInput: depth of output ("+h+") must match output depth for filter "+n.shape[3]+"."}),null!=s&&C(R(r),function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+r+"."});var p=tr(o),d=zi(a,n.shape,i,1,r,s,!1,p),f=Pt.runKernelFunc(function(t,e){var i=t.conv2dDerInput(l,n,d);return e([n,l]),i},{dy4D:l,filter:n},function(t,e){var n=e[0],a=e[1];return{dy4D:function(){return $a(t,n,i,r,o,1,s)},filter:function(){return Ya(t,a,n.shape,i,r,o,s)}}});return u?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}function Ga(t){var e=function(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}(t),n=e[0],i=e[1],r=e[2];return 1===n&&1===i&&1===r}function ja(t,e,n,i,r){C(t.length===e.rank,function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"});var o=t,s=e,a=!1;4===e.rank&&(a=!0,s=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]),o=[1,t[0],t[1],t[2],t[3]]);var l=o[4],u=s.shape[4];C(5===o.length,function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+o.length+"."}),C(5===s.rank,function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+s.rank}),C(5===n.rank,function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+n.rank}),C(l===n.shape[3],function(){return"Error in conv3dDerInput: depth of input ("+l+") must match input depth for filter "+n.shape[3]+"."}),C(u===n.shape[4],function(){return"Error in conv3dDerInput: depth of output ("+u+") must match output depth for filter "+n.shape[4]+"."});var c=$i(o,n.shape,i,1,r),h=Pt.runKernelFunc(function(t){return t.conv3dDerInput(s,n,c)},{dy5D:s});return a?h.as4D(h.shape[1],h.shape[2],h.shape[3],h.shape[4]):h}var za=ln({conv1d_:function(t,e,n,i,r,o,s){void 0===r&&(r="NWC"),void 0===o&&(o=1);var a=Ke(t,"x","conv1d"),l=Ke(e,"filter","conv1d"),u=a,c=!1;2===a.rank&&(c=!0,u=a.as3D(1,a.shape[0],a.shape[1])),C(3===u.rank,function(){return"Error in conv1d: input must be rank 3, but got rank "+u.rank+"."}),C(3===l.rank,function(){return"Error in conv1d: filter must be rank 3, but got rank "+l.rank+"."}),null!=s&&C(R(i),function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+i+"."}),C(u.shape[2]===l.shape[1],function(){return"Error in conv1d: depth of input ("+u.shape[2]+") must match input depth for filter "+l.shape[1]+"."}),C(Qi(n,o),function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+o+"'"}),C("NWC"===r,function(){return"Error in conv1d: got dataFormat of "+r+" but only NWC is currently supported."});var h=l.as4D(1,l.shape[0],l.shape[1],l.shape[2]),p=u.as4D(u.shape[0],1,u.shape[1],u.shape[2]),d=$a(p,h,[1,n],i,"NHWC",[1,o],s);return c?d.as2D(d.shape[2],d.shape[3]):d.as3D(d.shape[0],d.shape[2],d.shape[3])}}),$a=ln({conv2d_:function(t,e,n,i,r,o,s){void 0===r&&(r="NHWC"),void 0===o&&(o=[1,1]);var a=Ke(t,"x","conv2d"),l=Ke(e,"filter","conv2d"),u=a,c=!1;3===a.rank&&(c=!0,u=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===u.rank,function(){return"Error in conv2d: input must be rank 4, but got rank "+u.rank+"."}),C(4===l.rank,function(){return"Error in conv2d: filter must be rank 4, but got rank "+l.rank+"."}),null!=s&&C(R(i),function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+i+"."});var h="NHWC"===r?u.shape[3]:u.shape[1];C(h===l.shape[2],function(){return"Error in conv2d: depth of input ("+h+") must match input depth for filter "+l.shape[2]+"."}),C(Qi(n,o),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"});var p=tr(r),d=zi(u.shape,l.shape,n,o,i,s,!1,p),f=[l,u],g=Pt.runKernelFunc(function(t,e){var n=t.conv2d(u,l,d);return e([l,u]),n},{x:u,filter:l},function(t,e){var s=e,a=s[0],l=s[1];return C(Zi(o),function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+o+"'"}),{x:function(){return Ka(l.shape,t,a,n,i,r)},filter:function(){return Ya(l,t,a.shape,n,i,r)}}},"Conv2D",d,f);return c?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}}),Xa=ln({conv3d_:function(t,e,n,i,r,o){void 0===r&&(r="NDHWC"),void 0===o&&(o=[1,1,1]);var s=Ke(t,"x","conv3d"),a=Ke(e,"filter","conv3d"),l=s,u=!1;4===s.rank&&(u=!0,l=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),C(5===l.rank,function(){return"Error in conv3d: input must be rank 5, but got rank "+l.rank+"."}),C(5===a.rank,function(){return"Error in conv3d: filter must be rank 5, but got rank "+a.rank+"."}),C(l.shape[4]===a.shape[3],function(){return"Error in conv3d: depth of input ("+l.shape[4]+") must match input depth for filter "+a.shape[3]+"."}),C(function(t,e){return Ga(n)||Ga(e)}(0,o),function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"}),C("NDHWC"===r,function(){return"Error in conv3d: got dataFormat of "+r+" but only NDHWC is currently supported."});var c=$i(l.shape,a.shape,n,o,i),h=Pt.runKernelFunc(function(t,e){var n=t.conv3d(l,a,c);return e([l,a]),n},{x:l,$filter:a},function(t,e){C(Ga(o),function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+o+"'"});var r=e[0],s=e[1];return{x:function(){return ja(r.shape,t,s,n,i)},$filter:function(){return function(t,e,n,i,r){var o=t;4===t.rank&&(o=t.as5D(1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]));var s=e;4===s.rank&&(s=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3])),C(5===o.rank,function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+o.shape+"."}),C(5===s.rank,function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+s.shape+"."}),C(5===n.length,function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+n+"."}),C(o.shape[4]===n[3],function(){return"Error in conv3dDerFilter: depth of input "+o.shape[4]+") must match input depth in filter ("+n[3]+"."}),C(s.shape[4]===n[4],function(){return"Error in conv3dDerFilter: depth of dy ("+s.shape[4]+") must match output depth for filter ("+n[4]+")."});var a=$i(o.shape,n,i,1,r);return Pt.runKernelFunc(function(t){return t.conv3dDerFilter(o,s,a)},{x5D:o,dy5D:s})}(r,t,s.shape,n,i)}}});return u?h.as4D(h.shape[1],h.shape[2],h.shape[3],h.shape[4]):h}}),Ya=ln({conv2dDerFilter_:function(t,e,n,i,r,o,s){void 0===o&&(o="NHWC");var a=t;3===t.rank&&(a=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var l=e;3===l.rank&&(l=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),C(4===a.rank,function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+a.shape+"."}),C(4===l.rank,function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+l.shape+"."}),C(4===n.length,function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."});var u="NHWC"===o?a.shape[3]:a.shape[1],c="NHWC"===o?l.shape[3]:l.shape[1];C(u===n[2],function(){return"Error in conv2dDerFilter: depth of input "+u+") must match input depth in filter ("+n[2]+"."}),C(c===n[3],function(){return"Error in conv2dDerFilter: depth of dy ("+c+") must match output depth for filter ("+n[3]+")."}),null!=s&&C(R(r),function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+r+"."});var h=tr(o),p=zi(a.shape,n,i,1,r,s,!1,h);return Pt.runKernelFunc(function(t){return t.conv2dDerFilter(a,l,p)},{x4D:a,dy4D:l})}}),Ka=ln({conv2dDerInput_:Wa}),Ja=ln({depthwiseConv2d_:function(t,e,n,i,r,o,s){void 0===r&&(r="NHWC"),void 0===o&&(o=[1,1]);var a=Ke(t,"x","depthwiseConv2d"),l=Ke(e,"filter","depthwiseConv2d"),u=a,c=!1;3===a.rank&&(c=!0,u=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===u.rank,function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+u.rank+"."}),C(4===l.rank,function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+l.rank+"."}),C(u.shape[3]===l.shape[2],function(){return"Error in depthwiseConv2d: number of input channels ("+u.shape[3]+") must match the inChannels dimension in filter "+l.shape[2]+"."}),null==o&&(o=[1,1]),C(Qi(n,o),function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+o+"'"}),null!=s&&C(R(i),function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+i+"."});var h=zi(u.shape,l.shape,n,o,i,s,!0),p=[u,l],d=Pt.runKernelFunc(function(t,e){var n=t.depthwiseConv2D(u,l,h);return e([u,l]),n},{x:u,filter:l},function(t,e){C(Zi(o),function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+o+"'"});var n=e[0],i=e[1];return{x:function(){return qa(n.shape,t,i,h)},filter:function(){return Za(n,t,i.shape,h)}}},"DepthwiseConv2dNative",h,p);return c?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}}),qa=ln({depthwiseConv2dDerInput_:function(t,e,n,i){var r=e,o=!1;3===e.rank&&(o=!0,r=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var s=Pt.runKernelFunc(function(t){return t.depthwiseConv2DDerInput(r,n,i)},{dy4D:r});return o?s.as3D(s.shape[1],s.shape[2],s.shape[3]):s}}),Za=ln({depthwiseConv2dDerFilter_:function(t,e,n,i){var r=t;3===t.rank&&(r=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var o=e;return 3===o.rank&&(o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),Pt.runKernelFunc(function(t){return t.depthwiseConv2DDerFilter(r,o,i)},{x4D:r,dy4D:o})}}),Qa=ln({separableConv2d_:function(t,e,n,i,r,o,s){void 0===o&&(o=[1,1]),void 0===s&&(s="NHWC");var a=Ke(t,"x","separableConv2d"),l=Ke(e,"depthwiseFilter","separableConv2d"),u=Ke(n,"pointwiseFilter","separableConv2d"),c=a,h=!1;if(3===a.rank&&(h=!0,c=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),"NCHW"===s)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");C(4===c.rank,function(){return"Error in separableConv2d: input must be rank 4, but got rank "+c.rank+"."}),C(4===l.rank,function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+l.rank+"."}),C(4===u.rank,function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+l.rank+"."}),C(1===u.shape[0],function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+u.shape[0]+"."}),C(1===u.shape[1],function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+u.shape[1]+"."});var p=l.shape[2],d=l.shape[3];C(u.shape[2]===p*d,function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+p*d+", but got "+u.shape[2]+"."});var f=Ja(c,l,i,r,s,o),g=$a(f,u,1,"valid",s);return h?g.as3D(g.shape[1],g.shape[2],g.shape[3]):g}}),tl=ln({conv2dTranspose_:function(t,e,n,i,r,o){return Wa(n,Ke(t,"x","conv2dTranspose"),Ke(e,"filter","conv2dTranspose"),i,r,"NHWC",o)}}),el=ln({conv3dTranspose_:function(t,e,n,i,r){return ja(n,Ke(t,"x","conv3dTranspose"),Ke(e,"filter","conv3dTranspose"),i,r)}}),nl=ln({matMul_:function(t,e,n,i){var r;void 0===n&&(n=!1),void 0===i&&(i=!1);var o=Ke(t,"a","matMul"),s=Ke(e,"b","matMul");r=Ot(o,s),o=r[0],s=r[1];var a=n?o.shape[o.rank-2]:o.shape[o.rank-1],l=i?s.shape[s.rank-1]:s.shape[s.rank-2],u=n?o.shape[o.rank-1]:o.shape[o.rank-2],c=i?s.shape[s.rank-2]:s.shape[s.rank-1],h=o.shape.slice(0,-2),p=s.shape.slice(0,-2),d=x(h),f=x(p);C(o.rank>=2&&s.rank>=2&&o.rank===s.rank,function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+o.rank+" and "+s.rank+"."}),C(I(h,p),function(){return"Error in matMul: outer dimensions ("+h+") and ("+p+") of Tensors with shapes "+o.shape+" and "+s.shape+" must match."}),C(a===l,function(){return"Error in matMul: inner shapes ("+a+") and ("+l+") of Tensors with shapes "+o.shape+" and "+s.shape+" and transposeA="+n+" and transposeB="+i+" must match."});var g=o.shape.slice(0,-2).concat([u,c]),m=n?o.as3D(d,a,u):o.as3D(d,u,a),v=i?s.as3D(f,c,l):s.as3D(f,l,c),_={transposeA:n,transposeB:i};return Pt.runKernelFunc(function(t,e){var r=t.batchMatMul(m,v,n,i);return e([m,v]),r},{a:m,b:v},function(t,e){var r=e,o=r[0],s=r[1];return n||i?!n&&i?{a:function(){return t.matMul(s,!1,!1)},b:function(){return t.matMul(o,!0,!1)}}:n&&!i?{a:function(){return s.matMul(t,!1,!0)},b:function(){return o.matMul(t,!1,!1)}}:{a:function(){return s.matMul(t,!0,!0)},b:function(){return t.matMul(o,!0,!0)}}:{a:function(){return t.matMul(s,!1,!0)},b:function(){return o.matMul(t,!0,!1)}}},"BatchMatMul",_).reshape(g)}}),il=ln({dot_:function(t,e){var n=Ke(t,"t1","dot"),i=Ke(e,"t2","dot");C(!(1!==n.rank&&2!==n.rank||1!==i.rank&&2!==i.rank),function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+n.rank+" and "+i.rank+"."});var r=1===n.rank?n.size:n.shape[1],o=1===i.rank?i.size:i.shape[0];return C(r===o,function(){return"Error in dot: inner dimensions of inputs must match, but got "+r+" and "+o+"."}),1===n.rank&&1===i.rank?n.as2D(1,-1).matMul(i.as2D(-1,1)).asScalar():1===n.rank&&2===i.rank?n.as2D(1,-1).matMul(i.as2D(i.shape[0],i.shape[1])).as1D():2===n.rank&&1===i.rank?n.matMul(i.as2D(-1,1)).as1D():n.matMul(i.as2D(i.shape[0],i.shape[1]))}}),rl=ln({outerProduct_:function(t,e){var n=Ke(t,"v1","outerProduct"),i=Ke(e,"v2","outerProduct");return C(1===n.rank&&1===i.rank,function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+i.rank+"."}),n.as2D(-1,1).matMul(i.as2D(1,-1))}}),ol=ln({reverse_:function(t,e){var n=Ke(t,"x","reverse");if(0===n.rank)return n.clone();var i=L(e,n.shape);return Pt.runKernelFunc(function(t){return t.reverse(n,i)},{$x:n},function(t){return{$x:function(){return t.reverse(i)}}}).reshapeAs(n)}}),sl=ln({reverse1d_:function(t){var e=Ke(t,"x","reverse");return C(1===e.rank,function(){return"Error in reverse1D: x must be rank 1 but got rank "+e.rank+"."}),ol(e,0)}}),al=ln({reverse2d_:function(t,e){var n=Ke(t,"x","reverse");return C(2===n.rank,function(){return"Error in reverse2D: x must be rank 2 but got rank "+n.rank+"."}),ol(n,e)}}),ll=ln({reverse3d_:function(t,e){var n=Ke(t,"x","reverse");return C(3===n.rank,function(){return"Error in reverse3D: x must be rank 3 but got rank "+n.rank+"."}),ol(n,e)}}),ul=ln({reverse4d_:function(t,e){var n=Ke(t,"x","reverse");return C(4===n.rank,function(){return"Error in reverse4D: x must be rank 4 but got rank "+n.rank+"."}),ol(n,e)}});function cl(t,e,n,i,r,o){var s=Ke(t,"x","maxPool"),a=s,l=!1;3===s.rank&&(l=!0,a=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),null==i&&(i=[1,1]),C(4===a.rank,function(){return"Error in maxPool: input must be rank 4 but got rank "+a.rank+"."}),C(Qi(n,i),function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"}),null!=o&&C(R(r),function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+"."});var u=Gi(a.shape,e,n,i,r,o);if(1===u.filterWidth&&1===u.filterHeight&&I(u.inShape,u.outShape))return s.clone();var c=[a],h=Pt.runKernelFunc(function(t,e){var n=t.maxPool(a,u);return e([a,n]),n},{x:a},function(t,o){var s=o[0],a=o[1];return{x:function(){return function(t,e,n,i,r,o,s,a){var l=Ke(t,"dy","maxPoolBackprop"),u=Ke(e,"input","maxPoolBackprop"),c=Ke(n,"output","maxPoolBackprop");C(u.rank===l.rank,function(){return"Rank of input ("+u.rank+") does not match rank of dy ("+l.rank+")"}),null==o&&(o=[1,1]),C(Qi(r,o),function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+o+"'"}),C(4===l.rank,function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+l.rank+"."}),C(4===u.rank,function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+u.rank+"."});var h=Gi(u.shape,i,r,o,s,a);return Pt.runKernelFunc(function(t){return t.maxPoolBackprop(l,u,c,h)},{$dy:l,$input:u})}(t,s,a,e,n,i,r)}}},"MaxPool",u,c);return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}function hl(t,e,n,i,r,o){var s=Ke(t,"x","avgPool","float32");null==i&&(i=[1,1]),C(Qi(n,i),function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"});var a=s,l=!1;3===s.rank&&(l=!0,a=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===a.rank,function(){return"Error in avgPool: x must be rank 4 but got rank "+a.rank+"."}),null!=o&&C(R(r),function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+"."});var u=Gi(a.shape,e,n,i,r,o);if(1===u.filterWidth&&1===u.filterHeight&&I(u.inShape,u.outShape))return s.clone();var c=Pt.runKernelFunc(function(t){return t.avgPool(a,u)},{x:a},function(t){return{x:function(){return function(t,e,n,i,r,o){var s=Ke(t,"dy","avgPoolBackprop"),a=Ke(e,"input","avgPoolBackprop");C(a.rank===s.rank,function(){return"Rank of input ("+a.rank+") does not match rank of dy ("+s.rank+")"}),null==r&&(r=[1,1]),C(Qi(i,r),function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+r+"'"});var l=a,u=s,c=!1;3===a.rank&&(c=!0,l=a.as4D(1,a.shape[0],a.shape[1],a.shape[2]),u=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===u.rank,function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."}),C(4===l.rank,function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+l.rank+"."});var h=Gi(l.shape,n,i,r,o),p=Pt.runKernelFunc(function(t){return t.avgPoolBackprop(u,l,h)},{dy4D:u,input4D:l});return c?p.as3D(p.shape[1],p.shape[2],p.shape[3]):p}(t,a,e,n,i,r)}}},"AvgPool",u);return c=c.cast(s.dtype),l?c.as3D(c.shape[1],c.shape[2],c.shape[3]):c}var pl=ln({maxPool_:function(t,e,n,i,r){return cl(t,e,n,1,i,r)}}),dl=ln({avgPool_:function(t,e,n,i,r){return hl(t,e,n,1,i,r)}}),fl=ln({pool_:function(t,e,n,i,r,o){null==r&&(r=[1,1]),null==o&&(o=1),0===i&&(i="valid");var s=Ke(t,"x","maxPool"),a=s,l=!1;3===s.rank&&(l=!0,a=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(Qi(o,r),function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+r+"'"});var u,c=Gi(a.shape,e,o,r,i),h=[c.dilationHeight,c.dilationWidth];u="same"===i?function(t,e){var n=t.map(function(t,n){return t+(t-1)*(e[n]-1)}).map(function(t){return t-1}),i=n.map(function(t){return Math.floor(t/2)}),r=n.map(function(t,e){return t-i[e]});return n.map(function(t,e){return[i[e],r[e]]})}([c.filterHeight,c.filterWidth],h):[[0,0],[0,0]];var p=1===h[0]&&1===h[1],d=function(t,e,n){var i=n.map(function(t){return t[0]}),r=n.map(function(t){return t[1]}),o=t.concat(i,r),s=e.map(function(t,e){return(t-o[e]%t)%t}),a=r.map(function(t,e){return t+s[e]});return[e.map(function(t,e){return[i[e],a[e]]}),e.map(function(t,e){return[0,s[e]]})]}([c.inHeight,c.inWidth],h,u),f=d[0],g=d[1],m=p?i:"valid",v=p?a:ci(a,h,f),_=("avg"===n?function(){return hl(v,e,o,1,m)}:function(){return cl(v,e,o,1,m)})(),y=p?_:jn(_,h,g);return l?y.as3D(y.shape[1],y.shape[2],y.shape[3]):y}}),gl=ln({maxPool3d_:function(t,e,n,i,r,o,s){void 0===o&&(o="NDHWC");var a=Ke(t,"x","maxPool3d"),l=a,u=!1;4===a.rank&&(u=!0,l=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3])),null==s&&(s=[1,1,1]),C(5===l.rank,function(){return"Error in maxPool3d: x must be rank 5 but got rank "+l.rank+"."}),C("NDHWC"===o,function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+o}),C(Qi(n,s),function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+s+"'"}),null!=r&&C(R(i),function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+r+" but got pad "+i+"."});var c=ji(l.shape,e,n,s,i,r,o),h=Pt.runKernelFunc(function(t,e){var n=t.maxPool3d(l,c);return e([l,n]),n},{x:l},function(t,o){var a=o[0],l=o[1];return{x:function(){return function(t,e,n,i,r,o,s,a){var l=Ke(t,"dy","maxPool3dBackprop"),u=Ke(e,"input","maxPool3dBackprop"),c=Ke(n,"output","maxPool3dBackprop"),h=l,p=u,d=c,f=!1;4===u.rank&&(f=!0,h=l.as5D(1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]),p=u.as5D(1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]),d=c.as5D(1,c.shape[0],c.shape[1],c.shape[2],c.shape[3])),C(5===h.rank,function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+h.rank+"."}),C(5===p.rank,function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+p.rank+"."}),C(5===d.rank,function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+d.rank+"."}),null==o&&(o=[1,1,1]),C(Qi(r,o),function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+o+"'"}),null!=a&&C(R(s),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+s+"."});var g=ji(p.shape,i,r,o,s,a),m=Pt.runKernelFunc(function(t){return t.maxPool3dBackprop(h,p,d,g)},{dy5D:h,input5D:p});return f?m.as4D(m.shape[1],m.shape[2],m.shape[3],m.shape[4]):m}(t,a,l,e,n,s,i,r)}}});return u?h.as4D(h.shape[1],h.shape[2],h.shape[3],h.shape[4]):h}}),ml=ln({avgPool3d_:function(t,e,n,i,r,o,s){void 0===o&&(o="NDHWC");var a=Ke(t,"x","avgPool3d","float32"),l=a,u=!1;4===a.rank&&(u=!0,l=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3])),null==s&&(s=[1,1,1]),C(5===l.rank,function(){return"Error in avgPool3d: x must be rank 5 but got rank "+l.rank+"."}),C("NDHWC"===o,function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+o}),C(Qi(n,s),function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+s+"'"}),null!=r&&C(R(i),function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+r+" but got pad "+i+"."});var c=ji(l.shape,e,n,s,i,r,o),h=Pt.runKernelFunc(function(t){return t.avgPool3d(l,c)},{x:l},function(t){return{x:function(){return function(t,e,n,i,r,o,s){var a=Ke(t,"dy","avgPool3dBackprop"),l=Ke(e,"input","avgPool3dBackprop"),u=a,c=l,h=!1;4===l.rank&&(h=!0,u=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]),c=l.as5D(1,l.shape[0],l.shape[1],l.shape[2],l.shape[3])),C(5===u.rank,function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+u.rank+"."}),C(5===c.rank,function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+c.rank+"."}),null==r&&(r=[1,1,1]),C(Qi(i,r),function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+r+"'"}),null!=s&&C(R(o),function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+o+"."});var p=ji(c.shape,n,i,r,o,s),d=Pt.runKernelFunc(function(t){return t.avgPool3dBackprop(u,c,p)},{dy5D:u,input5D:c});return h?d.as4D(d.shape[1],d.shape[2],d.shape[3],d.shape[4]):d}(t,l,e,n,s,i,r)}}});return h=h.cast(l.dtype),u?h.as4D(h.shape[1],h.shape[2],h.shape[3],h.shape[4]):h}}),vl=ln({slice_:function(t,e,n){var i,r,o=Ke(t,"x","slice");if(0===o.rank)throw new Error("Slicing scalar is not possible");(i="number"==typeof e?[e].concat(new Array(o.rank-1).fill(0)):e.length<o.rank?e.concat(new Array(o.rank-e.length).fill(0)):e.slice()).forEach(function(t){C(-1!==t,function(){return"slice() does not support negative begin indexing."})}),r=(r=null==n?new Array(o.rank).fill(-1):"number"==typeof n?[n].concat(new Array(o.rank-1).fill(-1)):n.length<o.rank?n.concat(new Array(o.rank-n.length).fill(-1)):n).map(function(t,e){return t>=0?t:(C(-1===t,function(){return"Negative size values should be exactly -1 but got "+t+" for the slice() size at index "+e+"."}),o.shape[e]-i[e])}),xi(o,i,r);var s=o.shape,a={begin:i,size:r};return Pt.runKernelFunc(function(t){return t.slice(o,i,r)},{x:o},function(t){for(var e=[],n=0;n<t.rank;n++)e.push([i[n],s[n]-i[n]-r[n]]);return{x:function(){return t.pad(e)}}},"Slice",a)}}),_l=ln({slice1d_:function(t,e,n){var i=Ke(t,"x","slice1d");return C(1===i.rank,function(){return"slice1d expects a rank-1 tensor, but got a rank-"+i.rank+" tensor"}),vl(i,[e],[n])}}),yl=ln({slice2d_:function(t,e,n){var i=Ke(t,"x","slice2d");return C(2===i.rank,function(){return"slice2d expects a rank-2 tensor, but got a rank-"+i.rank+" tensor"}),vl(i,e,n)}}),bl=ln({slice3d_:function(t,e,n){var i=Ke(t,"x","slice3d");return C(3===i.rank,function(){return"slice3d expects a rank-3 tensor, but got a rank-"+i.rank+" tensor"}),vl(i,e,n)}}),Tl=ln({slice4d_:function(t,e,n){var i=Ke(t,"x","slice4d");return C(4===i.rank,function(){return"slice4d expects a rank-4 tensor, but got a rank-"+i.rank+" tensor"}),vl(i,e,n)}});function El(t,e,n,i,r){return e.rank<n.rank&&(e=e.reshape(tn(e.shape,i))),t.rank<n.rank&&(t=t.reshape(tn(t.shape,i))),{x:function(){var i=t.mul(n.equal(e).cast(t.dtype));return null==r?i:i.transpose(r)}}}var Cl=ln({all_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","all","bool"),r=L(e,i.shape),o=r,s=nn(o,i.rank);null!=s&&(i=i.transpose(s),o=on(o.length,i.rank));var a=Pt.runKernelFunc(function(t){return t.all(i,o)},{$x:i});if(n){var l=tn(a.shape,r);return a.reshape(l)}return a}}),Sl=ln({any_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","any","bool"),r=L(e,i.shape),o=r,s=nn(o,i.rank);null!=s&&(i=i.transpose(s),o=on(o.length,i.rank));var a=Pt.runKernelFunc(function(t){return t.any(i,o)},{$x:i});if(n){var l=tn(a.shape,r);return a.reshape(l)}return a}}),wl=ln({argMax_:function(t,e){void 0===e&&(e=0);var n=Ke(t,"x","argMax");null==e&&(e=0);var i=L(e,n.shape),r=nn(i,n.rank);null!=r&&(n=n.transpose(r),i=on(i.length,n.rank));var o={axis:i[0]},s=[n];return Pt.runKernelFunc(function(t,e){var r=t.argMax(n,i[0]);return e([n]),r},{x:n},function(t,e){var n=e[0];return{x:function(){return Sn(n)}}},"ArgMax",o,s)}}),kl=ln({argMin_:function(t,e){void 0===e&&(e=0);var n=Ke(t,"x","argMin");null==e&&(e=0);var i=L(e,n.shape),r=nn(i,n.rank);return null!=r&&(n=n.transpose(r),i=on(i.length,n.rank)),Pt.runKernelFunc(function(t,e){var r=t.argMin(n,i[0]);return e([n]),r},{$x:n},function(t,e){var n=e[0];return{$x:function(){return Sn(n)}}})}}),xl=ln({logSumExp_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","logSumExp"),r=L(e,i.shape),o=i.max(r,!0),s=i.sub(o).exp().sum(r).log(),a=o.reshape(s.shape).add(s);if(n){var l=tn(a.shape,r);return a.reshape(l)}return a}}),Il=ln({max_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","max"),r=i,o=L(e,i.shape),s=o,a=nn(s,i.rank);null!=a&&(i=i.transpose(a),s=on(s.length,i.rank));var l=[i],u=Pt.runKernelFunc(function(t,e){var n=t.max(i,s);return e([r,n]),n},{x:i},function(t,e){return El(t,e[1],e[0],o,a)},"Max",{axes:s},l,[!0]);if(n){var c=tn(u.shape,o);u=u.reshape(c)}return u}}),Rl=ln({mean_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","mean"),r=L(e,i.shape),o=x(Qe(i.shape,r)[1]);return Ni(function(t){var i=fn(o);return{value:(i.dtype===t.dtype?t:t.cast(i.dtype)).div(i).sum(e,n),gradFunc:function(e){var n=t.shape.slice();return r.forEach(function(t){n[t]=1}),e.reshape(n).mul(yn(t.shape,"float32")).div(o)}}})(i)}}),Ol=ln({min_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","min"),r=i,o=L(e,i.shape),s=o,a=nn(s,i.rank);null!=a&&(i=i.transpose(a),s=on(s.length,i.rank));var l=[i],u=Pt.runKernelFunc(function(t,e){var n=t.min(i,s);return e([r,n]),n},{x:i},function(t,e){return El(t,e[1],e[0],o,a)},"Min",{axes:s},l,[!0]);if(n){var c=tn(u.shape,o);u=u.reshape(c)}return u}}),Dl=ln({moments_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=L(e,(t=Ke(t,"x","moments")).shape),r=t.mean(i,n),o=r.shape;return n||(o=tn(r.shape,i)),{mean:r,variance:t.toFloat().sub(r.reshape(o)).square().mean(i,n)}}}),Al=ln({sum_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","sum");"bool"===i.dtype&&(i=i.toInt());var r=L(e,i.shape);return Ni(function(t){var e=nn(r,t.rank),i=r,o=t;null!=e&&(o=t.transpose(e),i=on(i.length,t.rank));var s=function(e){var n=t.shape.slice();return r.forEach(function(t){n[t]=1}),e.reshape(n).mul(yn(t.shape,"float32"))},a={axes:i},l=Pt.runKernelFunc(function(t){return t.sum(o,i)},{x:o},function(t){return{x:function(){return s(t)}}},"Sum",a);if(n){var u=tn(l.shape,r);l=l.reshape(u)}return{value:l,gradFunc:s}})(i)}}),Ml=ln({prod_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=Ke(t,"x","prod");"bool"===i.dtype&&(i=i.toInt());var r=L(e,i.shape),o=nn(r,i.rank),s=r,a=i;null!=o&&(a=i.transpose(o),s=on(s.length,i.rank));var l=Pt.runKernelFunc(function(t){return t.prod(a,s)},{permutedX:a});if(n){var u=tn(l.shape,r);l=l.reshape(u)}return l}}),Nl=ln({elu_:function(t){var e=Ke(t,"x","elu");return Pt.runKernelFunc(function(t,n){var i=t.elu(e);return n([i]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){return Pt.runKernelFunc(function(e){return e.eluDer(t,n)},{dy:t,y:n})}}})}}),Ll=ln({leakyRelu_:function(t,e){void 0===e&&(e=.2);var n=Ke(t,"x","leakyRelu");return da(fn(e).mul(n),n)}}),Pl=ln({prelu_:function(t,e){var n=Ke(t,"x","prelu"),i=Ke(e,"alpha","prelu");return Pt.runKernelFunc(function(t,e){var r=t.prelu(n,i);return e([n,i]),r},{x:n,alpha:i},function(t,e){var n=e[0],i=e[1],r=n.greater(0);return{x:function(){return ia(r,t,t.mul(i))},alpha:function(){var e=ia(r,Sn(t),t.mul(n)),o=Hi(i.shape,t.shape);return o.length>0&&(e=e.sum(o)),e.reshape(i.shape)}}},"Prelu")}}),Bl=ln({relu_:function(t){var e=Ke(t,"x","relu");return"bool"===e.dtype?e.toInt():Pt.runKernelFunc(function(t,n){var i=t.relu(e);return n([e]),i},{x:e},function(t,e){var n=e[0];return{x:function(){return t.mulStrict(n.step().toFloat())}}},"Relu")}}),Fl=ln({relu6_:function(t){var e=Ke(t,"x","relu6");return"bool"===e.dtype?e.toInt():Pt.runKernelFunc(function(t,n){var i=t.relu6(e);return n([e]),i},{x:e},function(t,e){var n=e[0],i=n.lessEqual(6).mul(n.step());return{x:function(){return t.mulStrict(i.toFloat())}}},"Relu6")}}),Ul=ln({selu_:function(t){var e=Ke(t,"x","selu");return Pt.runKernelFunc(function(t,n){var i=t.selu(e);return n([e]),i},{$x:e},function(t,e){var n=e[0];return{$x:function(){var e=n.greater(fn(0)),i=fn(Ao),r=fn(Mo),o=t.mul(r),s=t.mul(i).mul(n.toFloat().exp());return ia(e,o,s)}}})}}),Vl=ln({transpose_:function(t,e){var n=Ke(t,"x","transpose");if(null==e&&(e=n.shape.map(function(t,e){return e}).reverse()),C(n.rank===e.length,function(){return"Error in transpose: rank of input "+n.rank+" must match length of perm "+e+"."}),e.forEach(function(t){C(t>=0&&t<n.rank,function(){return"All entries in 'perm' must be between 0 and "+(n.rank-1)+" but got "+e})}),n.rank<=1)return n.clone();var i={perm:e};return Pt.runKernelFunc(function(t){return t.transpose(n,e)},{x:n},function(t){var n=rn(e);return{x:function(){return t.transpose(n)}}},"Transpose",i)}}),Hl=ln({localResponseNormalization_:function(t,e,n,i,r){void 0===e&&(e=5),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=.5);var o=Ke(t,"x","localResponseNormalization");C(4===o.rank||3===o.rank,function(){return"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+o.rank+"."}),C(R(e),function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+e+"."});var s=o,a=!1;3===o.rank&&(a=!0,s=o.as4D(1,o.shape[0],o.shape[1],o.shape[2]));var l=Pt.runKernelFunc(function(t,o){var a=t.localResponseNormalization4D(s,e,n,i,r);return o([s,a]),a},{x4D:s},function(t,o){var s=o[0],a=o[1];return{x4D:function(){return Pt.runKernelFunc(function(o){return o.LRNGrad(t,s,a,e,n,i,r)},{})}}});return a?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}}),Wl=ln({norm_:function(t,e,n,i){void 0===e&&(e="euclidean"),void 0===n&&(n=null),void 0===i&&(i=!1);var r=function t(e,n,i){if(void 0===i&&(i=null),0===e.rank)return e.abs();if(1!==e.rank&&null===i)return t(e.reshape([-1]),n,i);if(1===e.rank||"number"==typeof i||Array.isArray(i)&&1===i.length){if(1===n)return e.abs().sum(i);if(n===1/0)return e.abs().max(i);if(n===-1/0)return e.abs().min(i);if("euclidean"===n||2===n)return e.abs().pow(fn(2,"int32")).sum(i).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(Array.isArray(i)&&2===i.length){if(1===n)return e.abs().sum(i[0]).max(i[1]-1);if(n===1/0)return e.abs().sum(i[1]).max(i[0]);if(n===-1/0)return e.abs().sum(i[1]).min(i[0]);if("fro"===n||"euclidean"===n)return e.square().sum(i).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+i)}(t=Ke(t,"x","norm"),e,n),o=r.shape;if(i){var s=L(n,t.shape);o=tn(r.shape,s)}return r.reshape(o)}}),Gl=ln({basicLSTMCell_:function(t,e,n,i,r,o){var s=Ke(t,"forgetBias","basicLSTMCell"),a=Ke(e,"lstmKernel","basicLSTMCell"),l=Ke(n,"lstmBias","basicLSTMCell"),u=Ke(i,"data","basicLSTMCell"),c=Ke(r,"c","basicLSTMCell"),h=Ke(o,"h","basicLSTMCell"),p=u.concat(h,1).matMul(a).add(l),d=p.shape[0],f=p.shape[1]/4,g=[d,f],m=p.slice([0,0],g),v=p.slice([0,f],g),_=p.slice([0,2*f],g),y=p.slice([0,3*f],g),b=m.sigmoid().mulStrict(v.tanh()).addStrict(c.mulStrict(s.add(_).sigmoid()));return[b,b.tanh().mulStrict(y.sigmoid())]}}),jl=ln({multiRNNCell_:function(t,e,n,i){for(var r=Ke(e,"data","multiRNNCell"),o=Je(n,"c","multiRNNCell"),s=Je(i,"h","multiRNNCell"),a=r,l=[],u=0;u<t.length;u++){var c=t[u](a,o[u],s[u]);l.push(c[0]),l.push(c[1]),a=c[1]}var h=[],p=[];for(u=0;u<l.length;u+=2)h.push(l[u]),p.push(l[u+1]);return[h,p]}}),zl=ln({movingAverage_:function(t,e,n,i,r){void 0===r&&(r=!0);var o=Ke(t,"v","movingAverage"),s=Ke(e,"x","movingAverage"),a=Ke(n,"decay","movingAverage");Dt(o,s),C(I(o.shape,s.shape),function(){return"Shape mismatch in v and x"});var l=fn(1),u=l.sub(a),c=s.sub(o).mul(u);if(r){C(null!=i,function(){return"When using zeroDebias: true, step is required."});var h=Ke(i,"step","movingAverage");c=c.div(l.sub(Ta(a,h)))}return o.add(c)}}),$l=ln({stridedSlice_:function(t,e,n,i,r,o,s,a,l){if(void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===l&&(l=0),null==i&&(i=new Array(e.length)),0!==s)throw new Error("ellipsis mask is not yet supported");var u=Ke(t,"x","stridedSlice"),c=Ii(a),h=u.shape.slice();c.forEach(function(t){e[t]=0,n[t]=1,h.splice(t,0,1)}),u=u.reshape(h);for(var p=0;p<u.rank;p++)e[p]=Oi(r,e,i,u.shape,p),n[p]=Di(o,n,i,u.shape,p),i[p]=i[p]||1;var d=Ii(l);d.forEach(function(t){n[t]=e[t]+1,i[t]=1});var f=Ri(e,n,i),g=f.filter(function(t,e){return-1===d.indexOf(e)});return i.every(function(t){return 1===t})?vl(u,e,f).reshape(g):Pt.runKernelFunc(function(t){return t.stridedSlice(u,e,n,i)},{$x:u}).reshape(g)}}),Xl=ln({topk_:function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!0);var i=Ke(t,"x","topk");if(0===i.rank)throw new Error("topk() expects the input to be of rank 1 or higher");var r=i.shape[i.shape.length-1];if(e>r)throw new Error("'k' passed to topk() must be <= the last dimension ("+r+") but got "+e);var o=Pt.runKernelFunc(function(t){return t.topk(i,e,n)},{$x:i});return{values:o[0],indices:o[1]}}}),Yl=ln({scatterND_:function(t,e,n){var i=Ke(t,"indices","scatterND","int32"),r=Ke(e,"updates","scatterND");return wi(r,i,n),Pt.runKernelFunc(function(t){return t.scatterND(i,r,n)},{indices:i,updates:r},null,"ScatterNd",{shape:n})}}),Kl=ln({fft_:function(t){C("complex64"===t.dtype,function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+t.dtype+"."});var e=t.shape[t.shape.length-1],n=t.size/e,i=t.as2D(n,e);return Pt.runKernelFunc(function(t){return t.fft(i)},{input:t}).reshape(t.shape)}}),Jl=ln({ifft_:function(t){C("complex64"===t.dtype,function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+t.dtype+"."});var e=t.shape[t.shape.length-1],n=t.size/e,i=t.as2D(n,e);return Pt.runKernelFunc(function(t){return t.ifft(i)},{input:t}).reshape(t.shape)}}),ql=ln({rfft_:function(t,e){C("float32"===t.dtype,function(){return"The dtype for rfft() must be real value but got "+t.dtype});var n,i=t.shape[t.shape.length-1],r=t.size/i;if(null!=e&&e<i){var o=t.shape.map(function(t){return 0}),s=t.shape.map(function(t){return t});s[t.shape.length-1]=e,n=t.slice(o,s),i=e}else if(null!=e&&e>i){var a=t.shape.map(function(t){return t});a[t.shape.length-1]=e-i,n=t.concat(bn(a),t.shape.length-1),i=e}else n=t;var l=n.zerosLike(),u=un(n,l).as2D(r,i),c=Kl(u),h=Math.floor(i/2)+1,p=cn(c),d=hn(c),f=p.split([h,i-h],p.shape.length-1),g=d.split([h,i-h],d.shape.length-1),m=n.shape.slice();return m[n.shape.length-1]=h,un(f[0],g[0]).reshape(m)}}),Zl=ln({irfft_:function(t){var e=t.shape[t.shape.length-1],n=t.size/e;if(e<=2){var i=t.as2D(n,e),r=Jl(i);return cn(r)}var o=[n,2*(e-1)],s=cn(t).as2D(n,e),a=hn(t).as2D(n,e),l=s.slice([0,1],[n,e-2]).reverse(1),u=a.slice([0,1],[n,e-2]).reverse(1).mul(fn(-1)),c=s.concat(l,1),h=a.concat(u,1);return i=un(c,h).as2D(o[0],o[1]),r=Jl(i),cn(r)}}),Ql=Object.freeze({fft:Kl,ifft:Jl,rfft:ql,irfft:Zl}),tu=ln({sparseToDense_:function(t,e,n,i){void 0===i&&(i=0);var r=Ke(t,"sparseIndices","sparseToDense","int32"),o=Ke(e,"sparseValues","sparseToDense"),s=Ke(i,"defaultValue","sparseToDense",o.dtype);return function(t,e,n,i){if("int32"!==t.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+t.dtype+".");if(t.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+t.shape+".");var r=t.rank>0?t.shape[0]:1,o=t.rank>1?t.shape[1]:1;if(n.length!==o)throw new Error("outputShape has incorrect number of elements:, "+n.length+", should be: "+o+".");var s=e.size;if(0!==e.rank&&(1!==e.rank||s!==r))throw new Error("sparseValues has incorrect shape "+e.shape+", should be [] or ["+r+"]");if(e.dtype!==i.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(r,o,n,s),Pt.runKernelFunc(function(t){return t.sparseToDense(r,o,n,s)},{$sparseIndices:r,$sparseValues:o,$defaultValue:s})}}),eu=ln({gatherND_:function(t,e){var n=Ke(e,"indices","gatherND","int32"),i=Ke(t,"x","gatherND");return Pt.runKernelFunc(function(t){return t.gatherND(i,n)},{x:i,indices:n},null,"GatherNd")}}),nu=ln({diag_:function(t){var e=Ke(t,"x","diag").flatten(),n=t.shape.concat(t.shape);return Pt.runKernelFunc(function(t){return t.diag(e)},{$x:e}).reshape(n)}}),iu=ln({dropout_:function(t,e,n,i){var r=Ke(t,"x","dropout");if(C("float32"===r.dtype,function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+r.dtype+" tensor instead."}),C(e>=0&&e<1,function(){return"rate must be a float in the range [0, 1), but got "+e+"."}),0===e)return t instanceof bt?r.clone():r;var o=function(t,e){if(null==e)return t.shape.slice();if(I(t.shape,e))return e;if(t.shape.length===e.length){for(var n=[],i=0;i<t.shape.length;i++)null==e[i]&&null!=t.shape[i]?n.push(t.shape[i]):n.push(e[i]);return n}return e}(r,n),s=1-e,a=li(o,0,1,"float32",i).add(s).floor().div(s);return r.mul(a)}});function ru(t,e,n){for(var i=1-t%2,r=new Float32Array(t),o=0;o<t;++o){var s=2*Math.PI*o/(t+i-1);r[o]=e-n*Math.cos(s)}return gn(r,"float32")}var ou,su=ln({hannWindow_:function(t){return ru(t,.5,.5)}}),au=ln({hammingWindow_:function(t){return ru(t,.54,.46)}}),lu=ln({frame_:function(t,e,n,i,r){void 0===i&&(i=!1),void 0===r&&(r=0);for(var o=0,s=[];o+e<=t.size;)s.push(vl(t,o,e)),o+=n;if(i)for(;o<t.size;){var a=o+e-t.size,l=wn([vl(t,o,e-a),Tn([a],r)]);s.push(l),o+=n}return 0===s.length?mn([],[0,e]):wn(s).as2D(s.length,e)}}),uu=ln({stft_:function(t,e,n,i,r){var o;void 0===r&&(r=su),null==i&&(o=e,i=Math.floor(Math.pow(2,Math.ceil(Math.log(o)/Math.log(2)))));for(var s=lu(t,e,n),a=ya(s,r(e)),l=[],u=0;u<s.shape[0];u++)l.push(ql(a.slice([u,0],[1,e]),i));return wn(l)}}),cu=Object.freeze({hannWindow:su,hammingWindow:au,frame:lu,stft:uu});!function(t){t[t.NONE=0]="NONE",t[t.MEAN=1]="MEAN",t[t.SUM=2]="SUM",t[t.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(ou||(ou={}));var hu=ln({absoluteDifference_:function(t,e,n,i){void 0===i&&(i=ou.SUM_BY_NONZERO_WEIGHTS);var r=Ke(t,"labels","absoluteDifference"),o=Ke(e,"predictions","absoluteDifference"),s=null;null!=n&&(s=Ke(n,"weights","absoluteDifference")),S(r.shape,o.shape,"Error in absoluteDifference: ");var a=r.sub(o).abs();return pu(a,s,i)}}),pu=ln({computeWeightedLoss_:function(t,e,n){void 0===n&&(n=ou.SUM_BY_NONZERO_WEIGHTS);var i=Ke(t,"losses","computeWeightedLoss"),r=null;null!=e&&(r=Ke(e,"weights","computeWeightedLoss"));var o=null==r?i:i.mul(r);if(n===ou.NONE)return o;if(n===ou.SUM)return o.sum();if(n===ou.MEAN){if(null==r)return o.mean();var s=i.size/r.size,a=o.sum().div(r.sum());return s>1?a.div(fn(s)):a}if(n===ou.SUM_BY_NONZERO_WEIGHTS){if(null==r)return o.sum().div(fn(i.size));var l=r.mul(yn(i.shape)).notEqual(fn(0)).sum().toFloat();return o.sum().div(l)}throw Error("Unknown reduction: "+n)}}),du=ln({cosineDistance_:function(t,e,n,i,r){void 0===r&&(r=ou.SUM_BY_NONZERO_WEIGHTS);var o=Ke(t,"labels","cosineDistance"),s=Ke(e,"predictions","cosineDistance"),a=null;null!=i&&(a=Ke(i,"weights","cosineDistance")),S(o.shape,s.shape,"Error in cosineDistance: ");var l=fn(1).sub(o.mul(s).sum(n,!0));return pu(l,a,r)}}),fu=ln({hingeLoss_:function(t,e,n,i){void 0===i&&(i=ou.SUM_BY_NONZERO_WEIGHTS);var r=Ke(t,"labels","hingeLoss"),o=Ke(e,"predictions","hingeLoss"),s=null;null!=n&&(s=Ke(n,"weights","hingeLoss")),S(r.shape,o.shape,"Error in hingeLoss: ");var a=fn(1);r=fn(2).mul(r).sub(a);var l=a.sub(r.mul(o)).relu();return pu(l,s,i)}}),gu=ln({huberLoss_:function(t,e,n,i,r){void 0===i&&(i=1),void 0===r&&(r=ou.SUM_BY_NONZERO_WEIGHTS);var o=Ke(t,"labels","huberLoss"),s=Ke(e,"predictions","huberLoss"),a=null;null!=n&&(a=Ke(n,"weights","huberLoss")),S(o.shape,s.shape,"Error in huberLoss: ");var l=fn(i),u=s.sub(o).abs(),c=ga(u,l),h=u.sub(c),p=fn(.5).mul(c.square()).add(l.mul(h));return pu(p,a,r)}}),mu=ln({logLoss_:function(t,e,n,i,r){void 0===i&&(i=1e-7),void 0===r&&(r=ou.SUM_BY_NONZERO_WEIGHTS);var o=Ke(t,"labels","logLoss"),s=Ke(e,"predictions","logLoss"),a=null;null!=n&&(a=Ke(n,"weights","logLoss")),S(o.shape,s.shape,"Error in logLoss: ");var l=fn(1),u=fn(i),c=o.mul(s.add(u).log()).neg().sub(l.sub(o).mul(l.sub(s).add(u).log()));return pu(c,a,r)}}),vu=ln({meanSquaredError_:function(t,e,n,i){void 0===i&&(i=ou.SUM_BY_NONZERO_WEIGHTS);var r=Ke(t,"labels","meanSquaredError"),o=Ke(e,"predictions","meanSquaredError"),s=null;null!=n&&(s=Ke(n,"weights","meanSquaredError")),S(r.shape,o.shape,"Error in meanSquaredError: ");var a=r.squaredDifference(o);return pu(a,s,i)}}),_u=ln({sigmoidCrossEntropy_:function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=ou.SUM_BY_NONZERO_WEIGHTS);var o=Ke(t,"multiClassLabels","sigmoidCrossEntropy"),s=Ke(e,"logits","sigmoidCrossEntropy"),a=null;if(null!=n&&(a=Ke(n,"weights","sigmoidCrossEntropy")),S(o.shape,s.shape,"Error in sigmoidCrossEntropy: "),i>0){var l=fn(i),u=fn(1),c=fn(.5);o=o.mul(u.sub(l)).add(c.mul(l))}var h=function(t,e){var n=Ke(t,"labels","sigmoidCrossEntropyWithLogits"),i=Ke(e,"logits","sigmoidCrossEntropyWithLogits");S(n.shape,i.shape,"Error in sigmoidCrossEntropyWithLogits: ");var r=i.relu(),o=i.mul(n),s=i.abs().neg().exp().log1p();return r.sub(o).add(s)}(o,s);return pu(h,a,r)}}),yu=ln({softmaxCrossEntropy_:function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=ou.SUM_BY_NONZERO_WEIGHTS);var o=Ke(t,"onehotLabels","softmaxCrossEntropy"),s=Ke(e,"logits","softmaxCrossEntropy"),a=null;if(null!=n&&(a=Ke(n,"weights","softmaxCrossEntropy")),S(o.shape,s.shape,"Error in softmaxCrossEntropy: "),i>0){var l=fn(i),u=fn(1),c=fn(o.shape[1]);o=o.mul(u.sub(l)).add(l.div(c))}var h=function(t,e,n){if(void 0===n&&(n=-1),-1===n&&(n=e.rank-1),n!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+e.rank+" and dim was "+n);return Ni(function(t,e,i){var r=e.logSumExp([n],!0),o=e.toFloat().sub(r);return i([t,o]),{value:o.mul(t).neg().sum([n]),gradFunc:function(t,e){var i=e[0],r=e[1],o=tn(t.shape,[n]);return[t.reshape(o).mul(i.toFloat().sub(r.exp())),t.reshape(o).mul(r.exp().sub(i.toFloat()))]}}})(t,e)}(o,s);return pu(h,a,r)}}),bu=Object.freeze({get Reduction(){return ou},absoluteDifference:hu,computeWeightedLoss:pu,cosineDistance:du,hingeLoss:fu,huberLoss:gu,logLoss:mu,meanSquaredError:vu,sigmoidCrossEntropy:_u,softmaxCrossEntropy:yu});function Tu(t,e){return void 0===e&&(e=!1),Pt.tidy(function(){if(2!==t.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+t.shape.length+"D Tensor.");for(var n=t.shape[0],i=t.shape[1],r=qn(n),o=t.clone(),s=mn([[1]],[1,1]),a=s.clone(),l=n>=i?i:n,u=function(t){var e,l=o,u=a,c=r;e=Pt.tidy(function(){var e=o.slice([t,t],[n-t,1]),l=e.norm(),u=o.slice([t,t],[1,1]),c=mn([[-1]]).where(u.greater(0),mn([[1]])),h=u.sub(c.mul(l)),p=e.div(h);a=1===p.shape[0]?s.clone():s.concat(p.slice([1,0],[p.shape[0]-1,p.shape[1]]),0);var d=c.matMul(h).div(l).neg(),f=o.slice([t,0],[n-t,i]),g=d.mul(a);if(0===t)o=f.sub(g.matMul(a.transpose().matMul(f)));else{var m=f.sub(g.matMul(a.transpose().matMul(f)));o=o.slice([0,0],[t,i]).concat(m,0)}var v=r.slice([0,t],[n,r.shape[1]-t]);if(0===t)r=v.sub(v.matMul(a).matMul(g.transpose()));else{var _=v.sub(v.matMul(a).matMul(g.transpose()));r=r.slice([0,0],[n,t]).concat(_,1)}return[a,o,r]}),a=e[0],o=e[1],r=e[2],ze([l,u,c])},c=0;c<l;++c)u(c);return!e&&n>i&&(r=r.slice([0,0],[n,i]),o=o.slice([0,0],[i,i])),[r,o]})}var Eu=ln({bandPart_:function(t,e,n){if(e%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+e+".");if(n%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+n+".");var i=Ke(t,"a","bandPart");if(i.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+i.rank+".");var r=i.shape,o=i.shape.slice(-2),s=o[0],a=o[1];if(!(e<=s))throw new Error("bandPart(): numLower ("+e+") must not be greater than the number of rows ("+s+").");if(!(n<=a))throw new Error("bandPart(): numUpper ("+n+") must not be greater than the number of columns ("+a+").");e<0&&(e=s),n<0&&(n=a);var l=En(0,s,1,"int32").reshape([-1,1]),u=En(0,a,1,"int32"),c=Sa(l,u),h=Qs(c.lessEqual(fn(+e,"int32")),c.greaterEqual(fn(-n,"int32"))),p=bn([s,a],i.dtype);return pi(gi(i.reshape([-1,s,a])).map(function(t){return ia(h,t,p)})).reshape(r)}}),Cu=ln({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,C(null!=t&&t.length>0,function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"});for(var n=t[0].shape[0],i=function(e){C(t[e].shape[0]===n,function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+t[e].shape[0]+" vs. "+n+")"})},r=1;r<t.length;++r)i(r)}else e=!0,t=On(t,t.shape[0],0).map(function(t){return hi(t,[0])});C(t.length<=t[0].shape[0],function(){return"Gram-Schmidt: Number of vectors ("+t.length+") exceeds number of dimensions ("+t[0].shape[0]+")."});var o=[],s=t,a=function(t){o.push(Pt.tidy(function(){var e=s[t];if(t>0)for(var n=0;n<t;++n){var i=Al(o[n].mulStrict(e)).mul(o[n]);e=e.sub(i)}return e.div(Wl(e,"euclidean"))}))};for(r=0;r<t.length;++r)a(r);return e?pi(o,0):o}}),Su=ln({qr_:function(t,e){if(void 0===e&&(e=!1),t.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+t.rank);if(2===t.rank)return Tu(t,e);var n=t.shape.slice(0,t.shape.length-2).reduce(function(t,e){return t*e}),i=[],r=[];return gi(t.reshape([n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0).forEach(function(t){var n=Tu(t,e),o=n[0],s=n[1];i.push(o),r.push(s)}),[pi(i,0).reshape(t.shape),pi(r,0).reshape(t.shape)]}}),wu=Object.freeze({bandPart:Eu,gramSchmidt:Cu,qr:Su});function ku(t,e,n,i,r,o){null==i&&(i=.5),null==r&&(r=Number.NEGATIVE_INFINITY),null==o&&(o=0);var s=t.shape[0];return n=Math.min(n,s),C(0<=i&&i<=1,function(){return"iouThreshold must be in [0, 1], but was '"+i+"'"}),C(2===t.rank,function(){return"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"}),C(4===t.shape[1],function(){return"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]}),C(1===e.rank,function(){return"scores must be a 1D tensor"}),C(e.shape[0]===s,function(){return"scores has incompatible shape with boxes. Expected "+s+", but was "+e.shape[0]}),C(0<=o&&o<=1,function(){return"softNmsSigma must be in [0, 1], but was '"+o+"'"}),{maxOutputSize:n,iouThreshold:i,scoreThreshold:r,softNmsSigma:o}}var xu=ln({resizeBilinear_:function(t,e,n){void 0===n&&(n=!1);var i=Ke(t,"images","resizeBilinear");C(3===i.rank||4===i.rank,function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+i.rank+"."}),C(2===e.length,function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+e+"."});var r=i,o=!1;3===i.rank&&(o=!0,r=i.as4D(1,i.shape[0],i.shape[1],i.shape[2]));var s=e[0],a=e[1],l=Pt.runKernelFunc(function(t,e){return e([r]),t.resizeBilinear(r,s,a,n)},{x:r},function(t,e){return{x:function(){return Pt.runKernelFunc(function(i){return i.resizeBilinearBackprop(t,e[0],n)},{})}}},"ResizeBilinear",{alignCorners:n,newHeight:s,newWidth:a});return o?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}}),Iu=ln({resizeNearestNeighbor_:function(t,e,n){void 0===n&&(n=!1);var i=Ke(t,"images","resizeNearestNeighbor");C(3===i.rank||4===i.rank,function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+i.rank+"."}),C(2===e.length,function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."}),C("float32"===i.dtype||"int32"===i.dtype,function(){return"`images` must have `int32` or `float32` as dtype"});var r=i,o=!1;3===i.rank&&(o=!0,r=i.as4D(1,i.shape[0],i.shape[1],i.shape[2]));var s=e[0],a=e[1],l=Pt.runKernelFunc(function(t,e){return e([r]),t.resizeNearestNeighbor(r,s,a,n)},{batchImages:r},function(t,e){return{batchImages:function(){return Pt.runKernelFunc(function(i){return i.resizeNearestNeighborBackprop(t,e[0],n)},{})}}});return o?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}}),Ru=ln({nonMaxSuppression_:function(t,e,n,i,r){void 0===i&&(i=.5),void 0===r&&(r=Number.NEGATIVE_INFINITY);var o=Ke(t,"boxes","nonMaxSuppression"),s=Ke(e,"scores","nonMaxSuppression"),a=ku(o,s,n,i,r);n=a.maxOutputSize,i=a.iouThreshold,r=a.scoreThreshold;var l={maxOutputSize:n,iouThreshold:i,scoreThreshold:r};return Pt.runKernelFunc(function(t){return t.nonMaxSuppression(o,s,n,i,r)},{boxes:o,scores:s},null,"NonMaxSuppressionV3",l)}}),Ou=ln({nonMaxSuppressionWithScore_:function(t,e,n,i,r,o){void 0===i&&(i=.5),void 0===r&&(r=Number.NEGATIVE_INFINITY),void 0===o&&(o=0);var s=Ke(t,"boxes","nonMaxSuppression"),a=Ke(e,"scores","nonMaxSuppression"),l=ku(s,a,n,i,r,o),u={maxOutputSize:n=l.maxOutputSize,iouThreshold:i=l.iouThreshold,scoreThreshold:r=l.scoreThreshold,softNmsSigma:o=l.softNmsSigma},c=Pt.runKernel("NonMaxSuppressionV5",{boxes:s,scores:a},u);return{selectedIndices:c[0],selectedScores:c[1]}}}),Du=ln({cropAndResize_:function(t,e,n,i,r,o){var s=Ke(t,"image","cropAndResize"),a=Ke(e,"boxes","cropAndResize","float32"),l=Ke(n,"boxInd","cropAndResize","int32");r=r||"bilinear",o=o||0;var u=a.shape[0];return C(4===s.rank,function(){return"Error in cropAndResize: image must be rank 4,but got rank "+s.rank+"."}),C(2===a.rank&&4===a.shape[1],function(){return"Error in cropAndResize: boxes must be have size ["+u+",4] but had shape "+a.shape+"."}),C(1===l.rank&&l.shape[0]===u,function(){return"Error in cropAndResize: boxInd must be have size ["+u+"] but had shape "+a.shape+"."}),C(2===i.length,function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+i.length+"."}),C(i[0]>=1&&i[1]>=1,function(){return"cropSize must be atleast [1,1], but was "+i}),C("bilinear"===r||"nearest"===r,function(){return"method must be bilinear or nearest, but was "+r}),Pt.runKernelFunc(function(t,e){return t.cropAndResize(s,a,l,i,r,o)},{images:s,boxes:a,boxInd:l},null,"CropAndResize",{method:r,extrapolationValue:o,cropSize:i})}}),Au=Object.freeze({resizeBilinear:xu,resizeNearestNeighbor:Iu,nonMaxSuppression:Ru,nonMaxSuppressionAsync:function(t,e,n,i,r){return void 0===i&&(i=.5),void 0===r&&(r=Number.NEGATIVE_INFINITY),a(this,void 0,void 0,function(){var o,s,a,u,c,h,p;return l(this,function(l){switch(l.label){case 0:return o=Ke(t,"boxes","nonMaxSuppressionAsync"),s=Ke(e,"scores","nonMaxSuppressionAsync"),a=ku(o,s,n,i,r),n=a.maxOutputSize,i=a.iouThreshold,r=a.scoreThreshold,[4,Promise.all([o.data(),s.data()])];case 1:return u=l.sent(),c=u[0],h=u[1],p=cr(c,h,n,i,r),o!==t&&o.dispose(),s!==e&&s.dispose(),[2,p]}})})},nonMaxSuppressionWithScore:Ou,nonMaxSuppressionWithScoreAsync:function(t,e,n,i,r,o){return void 0===i&&(i=.5),void 0===r&&(r=Number.NEGATIVE_INFINITY),void 0===o&&(o=0),a(this,void 0,void 0,function(){var s,a,u,c,h,p,d;return l(this,function(l){switch(l.label){case 0:return s=Ke(t,"boxes","nonMaxSuppressionAsync"),a=Ke(e,"scores","nonMaxSuppressionAsync"),u=ku(s,a,n,i,r,o),n=u.maxOutputSize,i=u.iouThreshold,r=u.scoreThreshold,o=u.softNmsSigma,[4,Promise.all([s.data(),a.data()])];case 1:return c=l.sent(),h=c[0],p=c[1],d=hr(h,p,n,i,r,o),s!==t&&s.dispose(),a!==e&&a.dispose(),[2,d]}})})},cropAndResize:Du}),Mu=function(t,e){return!(t>0)||"linear"===e},Nu=function(t,e,n){if(null==n||"linear"===n)return t;if("relu"===n)return t.mul(e.step());throw new Error("Gradient for activation "+n+" has not been implemented yet.")},Lu=function(t,e){var n=e,i=Hi(t.shape,e.shape);return i.length>0&&(n=n.sum(i)),n.reshape(t.shape)},Pu=function(t,e,n){if("linear"===e)return t;if("relu"===e)return Bl(t);if("elu"===e)return Nl(t);if("relu6"===e)return Fl(t);if("prelu"===e)return Pl(t,n);throw new Error("Unknown fused activation "+e+".")},Bu=ln({fusedMatMul_:function(t){var e,n=t.a,i=t.b,r=t.transposeA,o=void 0!==r&&r,s=t.transposeB,a=void 0!==s&&s,l=t.bias,u=t.activation,c=void 0===u?"linear":u,h=t.preluActivationWeights;if(!1===Mu(Pt.state.gradientDepth,c)){var p=nl(n,i,o,a);return null!=l&&(p=oa(p,l)),Pu(p,c,h)}var d=Ke(n,"a","fused matMul"),f=Ke(i,"b","fused matMul");e=Ot(d,f),d=e[0],f=e[1];var g=o?d.shape[d.rank-2]:d.shape[d.rank-1],m=a?f.shape[f.rank-1]:f.shape[f.rank-2],v=o?d.shape[d.rank-1]:d.shape[d.rank-2],_=a?f.shape[f.rank-2]:f.shape[f.rank-1],y=d.shape.slice(0,-2),b=f.shape.slice(0,-2),T=x(y),E=x(b);C(d.rank>=2&&f.rank>=2&&d.rank===f.rank,function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+d.rank+" and "+f.rank+"."}),C(I(y,b),function(){return"Error in fused matMul: outer dimensions ("+y+") and ("+b+") of Tensors with shapes "+d.shape+" and "+f.shape+" must match."}),C(g===m,function(){return"Error in fused matMul: inner shapes ("+g+") and ("+m+") of Tensors with shapes "+d.shape+" and "+f.shape+" and transposeA="+o+" and transposeB="+a+" must match."});var S,w,k=d.shape.slice(0,-2).concat([v,_]),R=o?d.as3D(T,g,v):d.as3D(T,v,g),O=a?f.as3D(E,_,m):f.as3D(E,m,_);null!=l&&Wi(k,(S=Ot(S=Ke(l,"bias","fused matMul"),d)[0]).shape),null!=h&&(w=Ke(h,"prelu weights","fused matMul"));var D={a:R,b:O};null!=l&&(D.bias=S),null!=h&&(D.preluActivationWeights=w);var A=[R,O];return Pt.runKernelFunc(function(t,e){var n=t.fusedBatchMatMul({a:R,b:O,transposeA:o,transposeB:a,bias:S,activation:c,preluActivationWeights:w});return e([R,O,n]),n},D,function(t,e){var n=e[0],i=e[1],r=e[2],s=Nu(t,r,c),u={};return null!=l&&(u={bias:function(){return Lu(S,s)}}),o||a?!o&&a?Object.assign({a:function(){return s.matMul(i,!1,!1)},b:function(){return s.matMul(n,!0,!1)}},u):o&&!a?Object.assign({a:function(){return i.matMul(s,!1,!0)},b:function(){return n.matMul(s,!1,!1)}},u):Object.assign({a:function(){return i.matMul(s,!0,!0)},b:function(){return s.matMul(n,!0,!0)}},u):Object.assign({a:function(){return s.matMul(i,!1,!0)},b:function(){return n.matMul(s,!0,!1)}},u)},"_FusedMatMul",{transposeA:o,transposeB:a,activation:c},A,[!0]).reshape(k)}}),Fu=ln({fusedConv2d_:function(t){var e=t.x,n=t.filter,i=t.strides,r=t.pad,o=t.dataFormat,s=void 0===o?"NHWC":o,a=t.dilations,l=void 0===a?[1,1]:a,u=t.dimRoundingMode,c=t.bias,h=t.activation,p=void 0===h?"linear":h,d=t.preluActivationWeights;if(p=p||"linear",!1===Mu(Pt.state.gradientDepth,p)){var f=$a(e,n,i,r,s,l,u);return null!=c&&(f=oa(f,c)),Pu(f,p,d)}var g=Ke(e,"x","conv2d"),m=Ke(n,"filter","conv2d"),v=g,_=!1;3===g.rank&&(_=!0,v=g.as4D(1,g.shape[0],g.shape[1],g.shape[2])),C(4===v.rank,function(){return"Error in fused conv2d: input must be rank 4, but got rank "+v.rank+"."}),C(4===m.rank,function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+m.rank+"."}),null!=u&&C(R(r),function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+u+" but got pad "+r+"."}),C(v.shape[3]===m.shape[2],function(){return"Error in conv2d: depth of input ("+v.shape[3]+") must match input depth for filter "+m.shape[2]+"."}),C(Qi(i,l),function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+l+"'"}),C("NHWC"===s,function(){return"Error in conv2d: got dataFormat of "+s+" but only NHWC is currently supported."});var y,b,T=zi(v.shape,m.shape,i,l,r,u);null!=c&&(y=Ot(y=Ke(c,"bias","fused conv2d"),g)[0],Wi(T.outShape,y.shape)),null!=d&&(b=Ke(d,"prelu weights","fused conv2d"));var E={x:v,filter:m};null!=c&&(E.bias=y),null!=d&&(E.preluActivationWeights=b);var S=[m,v],w=Pt.runKernelFunc(function(t,e){var n=t.fusedConv2d({input:v,filter:m,convInfo:T,bias:y,activation:p,preluActivationWeights:b});return e([m,v,n]),n},E,function(t,e){var n=e,o=n[0],s=n[1],a=n[2],u=Nu(t,a,p);C(Zi(l),function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+l+"'"});var h={};return null!=c&&(h={bias:function(){return Lu(y,u)}}),Object.assign({x:function(){return Ka(s.shape,u,o,i,r)},filter:function(){return Ya(s,u,o.shape,i,r)}},h)},"FusedConv2D",{convInfo:T,activation:p},S,[!0]);return _?w.as3D(w.shape[1],w.shape[2],w.shape[3]):w}}),Uu=ln({fusedDepthwiseConv2d_:function(t){var e=t.x,n=t.filter,i=t.strides,r=t.pad,o=t.dataFormat,s=void 0===o?"NHWC":o,a=t.dilations,l=void 0===a?[1,1]:a,u=t.dimRoundingMode,c=t.bias,h=t.activation,p=void 0===h?"linear":h,d=t.preluActivationWeights;if(!1===Mu(Pt.state.gradientDepth,p)){var f=Ja(e,n,i,r,s,l,u);return null!=c&&(f=oa(f,c)),Pu(f,p,d)}var g=Ke(e,"x","depthwiseConv2d"),m=Ke(n,"filter","depthwiseConv2d"),v=g,_=!1;3===g.rank&&(_=!0,v=g.as4D(1,g.shape[0],g.shape[1],g.shape[2])),C(4===v.rank,function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+v.rank+"."}),C(4===m.rank,function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+m.rank+"."}),C(v.shape[3]===m.shape[2],function(){return"Error in fused depthwiseConv2d: number of input channels ("+v.shape[3]+") must match the inChannels dimension in filter "+m.shape[2]+"."}),null==l&&(l=[1,1]),C(Qi(i,l),function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+l+"'"}),null!=u&&C(R(r),function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+u+" but got pad "+r+"."});var y,b,T=zi(v.shape,m.shape,i,l,r,u,!0);null!=c&&(y=Ot(y=Ke(c,"bias","fused conv2d"),g)[0],Wi(T.outShape,y.shape)),null!=d&&(b=Ke(d,"prelu weights","fused depthwiseConv2d"));var E={x:v,filter:m};null!=c&&(E.bias=y),null!=d&&(E.preluActivationWeights=b);var S=[m,v],w=Pt.runKernelFunc(function(t,e){var n=t.fusedDepthwiseConv2D({input:v,filter:m,convInfo:T,bias:y,activation:p,preluActivationWeights:b});return e([m,v,n]),n},E,function(t,e){C(Zi(l),function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+l+"'"});var n=e[0],i=e[1],r=e[2],o=Nu(t,r,p),s={};return null!=c&&(s={bias:function(){return Lu(y,o)}}),Object.assign({x:function(){return qa(i.shape,o,n,T)},filter:function(){return Za(i,o,n.shape,T)}},s)},"FusedDepthwiseConv2D",{convInfo:T,activation:p},S,[!0]);return _?w.as3D(w.shape[1],w.shape[2],w.shape[3]):w}}),Vu=Object.freeze({matMul:Bu,conv2d:Fu,depthwiseConv2d:Uu}),Hu=Object.freeze({image:Au,linalg:wu,losses:bu,spectral:Ql,fused:Vu,signal:cu,square:ns,squaredDifference:rs,conv1d:za,conv2d:$a,conv3d:Xa,depthwiseConv2d:Ja,separableConv2d:Qa,conv2dTranspose:tl,conv3dTranspose:el,op:ln,batchNormalization2d:zs,batchNormalization3d:$s,batchNormalization4d:Xs,batchNormalization:Ys,batchNorm:Ks,batchNorm2d:Js,batchNorm3d:qs,batchNorm4d:Zs,booleanMaskAsync:function(t,e,n){return a(this,void 0,void 0,function(){var i,r,o,s,a,u,c,h,p,d,f,g,m;return l(this,function(l){switch(l.label){case 0:for(i=Ke(t,"tensor","boolMask"),r=Ke(e,"mask","boolMask","bool"),o=null==n?0:n,s=r.rank,a=i.shape,C(s>0,function(){return"mask cannot be scalar"}),S(a.slice(o,o+s),r.shape,"mask's shape must match the first K dimensions of tensor's shape,"),u=1,c=o;c<o+s;c++)u*=a[c];return h=a.slice(0,o).concat([u],a.slice(o+s)),p=i.reshape(h),d=r.reshape([-1]),[4,ra(d)];case 1:return f=l.sent(),g=f.squeeze([1]),m=Va(p,g,o),t!==i&&i.dispose(),e!==r&&r.dispose(),g.dispose(),p.dispose(),d.dispose(),f.dispose(),[2,m]}})})},complex:un,real:cn,imag:hn,concat:wn,concat1d:kn,concat2d:xn,concat3d:In,concat4d:Rn,split:On,matMul:nl,dot:il,outerProduct:rl,reverse:ol,reverse1d:sl,reverse2d:al,reverse3d:ll,reverse4d:ul,maxPool:pl,avgPool:dl,pool:fl,maxPool3d:gl,avgPool3d:ml,slice:vl,slice1d:_l,slice2d:yl,slice3d:bl,slice4d:Tl,abs:os,acos:ss,acosh:as,asin:ls,asinh:us,atan:cs,atanh:hs,ceil:ps,clipByValue:ds,cos:fs,cosh:gs,erf:ms,exp:vs,expm1:_s,floor:ys,log:bs,log1p:Ts,logSigmoid:Es,neg:Cs,reciprocal:Ss,round:ws,rsqrt:ks,sigmoid:xs,sign:Is,isNaN:Rs,isInf:Os,isFinite:Ds,sin:As,sinh:Ms,softplus:Ns,sqrt:Ls,step:Ps,tan:Bs,tanh:Fs,all:Cl,any:Sl,argMax:wl,argMin:kl,logSumExp:xl,max:Il,mean:Rl,min:Ol,moments:Dl,sum:Al,prod:Ml,equal:ka,equalStrict:xa,greater:Ia,greaterEqual:Ra,greaterEqualStrict:Oa,greaterStrict:Da,less:Aa,lessEqual:Ma,lessEqualStrict:Na,lessStrict:La,notEqual:Pa,notEqualStrict:Ba,add:oa,addN:sa,addStrict:aa,atan2:la,div:ua,divNoNan:ca,divStrict:ha,floorDiv:pa,maximum:da,maximumStrict:fa,minimum:ga,minimumStrict:ma,mod:va,modStrict:_a,mul:ya,mulStrict:ba,pow:Ta,powStrict:Ea,squaredDifferenceStrict:Ca,sub:Sa,subStrict:wa,elu:Nl,leakyRelu:Ll,prelu:Pl,relu:Bl,relu6:Fl,selu:Ul,logicalAnd:Qs,logicalNot:ta,logicalOr:ea,logicalXor:na,where:ia,whereAsync:ra,buffer:Gn,print:function(t,e){void 0===e&&(e=!1),console.log(t.toString(e))},batchToSpaceND:jn,broadcastTo:zn,cast:$n,clone:Xn,cumsum:Yn,depthToSpace:Kn,expandDims:Jn,eye:qn,multinomial:Zn,oneHot:Qn,pad:ti,pad1d:ei,pad2d:ni,pad3d:ii,pad4d:ri,rand:oi,randomNormal:si,randomGamma:ai,randomUniform:li,reshape:ui,spaceToBatchND:ci,squeeze:hi,stack:pi,tile:di,truncatedNormal:fi,unstack:gi,setdiff1dAsync:function(t,e){return a(this,void 0,void 0,function(){var n,i,r,o,s,a,u,c,h,p;return l(this,function(l){switch(l.label){case 0:return n=Ke(t,"x","setdiff1d"),i=Ke(e,"y","setdiff1d"),C(n.dtype===i.dtype,function(){return"x and y should have the same dtype, but got x ("+n.dtype+") and y ("+i.dtype+")."}),C(1===n.rank,function(){return"x should be 1D tensor, but got x ("+n.shape+")."}),C(1===i.rank,function(){return"y should be 1D tensor, but got y ("+i.shape+")."}),[4,n.data()];case 1:return r=l.sent(),[4,i.data()];case 2:for(o=l.sent(),s=new Set(o),a=0,h=0;h<r.length;h++)s.has(r[h])||a++;for(u=new mt([a],n.dtype),c=new mt([a],"int32"),h=0,p=0;h<r.length;h++)s.has(r[h])||(u.values[p]=r[h],c.values[p]=h,p++);return[2,[u.toTensor(),c.toTensor()]]}})})},fill:Tn,linspace:function(t,e,n){if(n<=0)throw new Error("The number of values should be positive.");return Pt.runKernelFunc(function(i){return i.linspace(t,e,n)},{})},ones:yn,range:En,scalar:fn,tensor:pn,tensor1d:gn,tensor2d:mn,tensor3d:vn,tensor4d:_n,tensor5d:function(t,e,n){if(w(t),null!=e&&5!==e.length)throw new Error("tensor5d() requires shape to have five numbers");var i=Xe(t,n);if(5!==i.length&&1!==i.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===i.length&&null==e)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return dn(t,e,i,n)},tensor6d:function(t,e,n){if(w(t),null!=e&&6!==e.length)throw new Error("tensor6d() requires shape to have six numbers");var i=Xe(t,n);if(6!==i.length&&1!==i.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===i.length&&null==e)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return dn(t,e=e||i,i,n)},variable:function(t,e,n,i){return void 0===e&&(e=!0),Pt.makeVariable(t,e,n,i)},zeros:bn,onesLike:Cn,zerosLike:Sn,transpose:Vl,softmax:Li,logSoftmax:Pi,localResponseNormalization:Hl,norm:Wl,gather:Va,unsortedSegmentSum:Ha,basicLSTMCell:Gl,multiRNNCell:jl,movingAverage:zl,stridedSlice:$l,topk:Xl,scatterND:Yl,fft:Kl,ifft:Jl,rfft:ql,irfft:Zl,sparseToDense:tu,gatherND:eu,diag:nu,dropout:iu,hannWindow:su,hammingWindow:au,frame:lu,stft:uu,inTopKAsync:function(t,e,n){return void 0===n&&(n=1),a(this,void 0,void 0,function(){var i,r,o,s,a,u,c,h,p,d,f,g,m,v;return l(this,function(l){switch(l.label){case 0:return i=Ke(t,"predictions","inTopK"),r=Ke(e,"targets","inTopK"),C(i.rank>1,function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+i.rank}),C(i.rank-1===r.rank,function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+i.rank+" and targets rank "+r.rank}),S(i.shape.slice(0,i.shape.length-1),r.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),o=i.shape[i.shape.length-1],C(n>0&&n<=o,function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+o+"), but got "+n}),[4,i.data()];case 1:return s=l.sent(),[4,r.data()];case 2:for(a=l.sent(),u=[s.length/o,o],h=u[1],p=B("bool",c=u[0]),d=0;d<c;d++){for(f=d*h,g=s.subarray(f,f+h),m=[],v=0;v<g.length;v++)m.push({value:g[v],index:v});for(m.sort(function(t,e){return e.value-t.value}),p[d]=0,v=0;v<n;v++)if(m[v].index===a[d]){p[d]=1;break}}return t!==i&&i.dispose(),e!==r&&r.dispose(),[2,pn(p,r.shape,"bool")]}})})}});function Wu(t,e){Array.isArray(t)||(t=[t]),t.forEach(function(t){null!=t&&C("complex64"!==t.dtype,function(){return e+" does not support complex64 tensors."})})}function Gu(t,e,n,i){if("linear"===n)return t.linear(e);if("relu"===n)return t.relu(e);if("elu"===n)return t.elu(e);if("relu6"===n)return t.relu6(e);if("prelu"===n)return t.prelu(e,i);throw new Error("Activation "+n+" has not been implemented for the CPU backend.")}var ju=function(t){function e(){var e=t.call(this)||this;return e.blockSize=48,e.firstUse=!0,e.data=new Bi(e,Pt),e}return s(e,t),e.prototype.write=function(t,e,n){this.firstUse&&(this.firstUse=!1,c().get("IS_NODE")&&$e("\n============================\nHi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.\n============================"));var i={};return this.data.set(i,{values:t,dtype:n}),i},e.prototype.move=function(t,e,n,i){this.data.set(t,{values:e,dtype:i})},e.prototype.numDataIds=function(){return this.data.numDataIds()},e.prototype.read=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){return[2,this.readSync(t)]})})},e.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,i=e.complexTensors;return"complex64"===n?rr(this.readSync(i.real.dataId),this.readSync(i.imag.dataId)):this.data.get(t).values},e.prototype.bufferSync=function(t){var e=this.readSync(t.dataId),n=e;if("string"===t.dtype)try{n=e.map(function(t){return ot(t)})}catch(t){throw new Error("Failed to decode encoded string bytes into utf-8")}return Gn(t.shape,t.dtype,n)},e.prototype.makeOutput=function(t,e,n){var i=this.write(t,e,n);return Pt.makeTensorFromDataId(i,e,n,this)},e.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},e.prototype.time=function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){return e=nt(),t(),[2,{kernelMs:nt()-e}]})})},e.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},e.prototype.complex=function(t,e){var n=this.makeOutput(null,t.shape,"complex64");return this.data.get(n.dataId).complexTensors={real:Pt.keep(t.clone()),imag:Pt.keep(e.clone())},n},e.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},e.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},e.prototype.slice=function(t,e,n){if(Wu(t,"slice"),Ai(t.shape,e,n)){var i=Mi(e,t.strides),r=x(n);return pn(this.readSync(t.dataId).subarray(i,i+r),n,t.dtype)}for(var o=Gn(n,t.dtype),s=this.bufferSync(t),a=0;a<o.size;++a){var l=o.indexToLoc(a).map(function(t,n){return t+e[n]});o.values[a]=s.get.apply(s,l)}return o.toTensor()},e.prototype.stridedSlice=function(t,e,n,i){Wu(t,"stridedSlice");var r=Ri(e,n,i);if(r.some(function(t){return 0===t}))return pn([],r);for(var o=Gn(r,t.dtype),s=this.bufferSync(t),a=0;a<o.size;a++){for(var l=o.indexToLoc(a),u=new Array(l.length),c=0;c<u.length;c++)u[c]=l[c]*i[c]+e[c];o.set.apply(o,[s.get.apply(s,u)].concat(l))}return o.toTensor()},e.prototype.diag=function(t){for(var e=this.readSync(t.dataId),n=Gn([t.size,t.size],t.dtype),i=n.values,r=0;r<e.length;r++)i[r*t.size+r]=e[r];return n.toTensor()},e.prototype.unstack=function(t,e){for(var n=t.shape[e],i=new Array(t.rank-1),r=0,o=0;o<t.rank;o++)o!==e&&(i[r++]=t.shape[o]);var s=new Array(t.rank).fill(0),a=t.shape.slice();a[e]=1;var l=new Array(n);for(o=0;o<l.length;o++)s[e]=o,l[o]=this.slice(t,s,a).reshape(i);return l},e.prototype.reverse=function(t,e){Wu(t,"reverse");for(var n=Gn(t.shape,t.dtype),i=this.bufferSync(t),r=function(r){var o=n.indexToLoc(r),s=o.slice();e.forEach(function(e){return s[e]=t.shape[e]-1-s[e]}),n.set.apply(n,[i.get.apply(i,s)].concat(o))},o=0;o<n.size;o++)r(o);return n.toTensor()},e.prototype.concat=function(t,e){var n=this;if("complex64"===t[0].dtype){var i=t.map(function(t){return cn(t)}),r=t.map(function(t){return hn(t)});return un(this.concat(i,e),this.concat(r,e))}var o=t.map(function(t){var n=x(t.shape.slice(e));return t.as2D(-1,n)}),s=an(o.map(function(t){return t.shape}),1),a=Gn(s,t[0].dtype).values;if(1===o[0].shape[0]){var l=0;o.forEach(function(t){a.set(n.readSync(t.dataId),l),l+=t.size})}else{var u=0;o.forEach(function(t){for(var e=n.readSync(t.dataId),i=0,r=0;r<t.shape[0];++r)for(var o=r*s[1]+u,l=0;l<t.shape[1];++l)a[o+l]=e[i++];u+=t.shape[1]})}var c=an(t.map(function(t){return t.shape}),e);return pn(a,c,t[0].dtype)},e.prototype.neg=function(t){return Wu(t,"neg"),this.multiply(fn(-1),t)},e.prototype.add=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,i){return{real:t+n,imag:e+i}}):this.broadcastedBinaryOp(t,e,It(t.dtype,e.dtype),function(t,e){return t+e})},e.prototype.addN=function(t){var e=this;Wu(t,"addN");for(var n=t.map(function(t){return e.readSync(t.dataId)}),i=Gn(t[0].shape,t[0].dtype),r=i.values,o=0;o<t.length;o++)for(var s=n[o],a=0;a<r.length;a++)r[a]+=s[a];return i.toTensor()},e.prototype.softmax=function(t,e){var n=L([e],t.shape),i=this.max(t,n),r=tn(i.shape,n),o=this.subtract(t,i.reshape(r)),s=this.exp(o),a=this.sum(s,n).reshape(r);return this.realDivide(s,a)},e.prototype.subtract=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,i){return{real:t-n,imag:e-i}}):this.broadcastedBinaryOp(t,e,It(t.dtype,e.dtype),function(t,e){return t-e})},e.prototype.pow=function(t,e){return Wu([t,e],"pow"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.pow(t,e)})},e.prototype.batchMatMul=function(t,e,n,i){Wu([t,e],"matMul");for(var r=n?t.shape[1]:t.shape[2],o=n?t.shape[2]:t.shape[1],s=i?e.shape[1]:e.shape[2],a=t.shape[0],l=this.readSync(t.dataId),u=this.readSync(e.dataId),c=n?[t.strides[0],1,t.strides[1]]:[t.strides[0],t.strides[1],1],h=c[0],p=c[1],d=c[2],f=i?[1,e.strides[1],e.strides[0]]:[e.strides[1],1,e.strides[0]],g=f[0],m=f[1],v=f[2],_=o*s,y=Gn([a,o,s],t.dtype),b=y.values,T=this.blockSize,E=0;E<a;E++)for(var C=0;C<o;C+=T)for(var S=0;S<s;S+=T)for(var w=0;w<r;w+=T)for(var k=Math.min(C+T,o),x=Math.min(S+T,s),I=Math.min(w+T,r),R=C;R<k;R++)for(var O=S;O<x;O++){for(var D=0,A=w;A<I;A++)D+=l[E*h+R*p+A*d]*u[A*g+O*m+E*v];b[E*_+(R*s+O)]+=D}return y.toTensor()},e.prototype.fusedBatchMatMul=function(t){var e=t.a,n=t.b,i=t.transposeA,r=t.transposeB,o=t.bias,s=t.activation,a=t.preluActivationWeights,l=this.batchMatMul(e,n,i,r);return o&&(l=this.add(l,o)),s&&(l=Gu(this,l,s,a)),l},e.prototype.multiply=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),function(t,e,n,i){return{real:t*n-e*i,imag:t*i+e*n}}):this.broadcastedBinaryOp(t,e,It(t.dtype,e.dtype),function(t,e){return t*e})},e.prototype.realDivide=function(t,e){return Wu([t,e],"realDivide"),this.broadcastedBinaryOp(t,e,"float32",function(t,e){return t/e})},e.prototype.floorDiv=function(t,e){return Wu([t,e],"floorDiv"),this.broadcastedBinaryOp(t,e,"int32",function(t,e){return Math.floor(t/e)})},e.prototype.sum=function(t,e){Wu(t,"sum"),en("sum",e,t.rank);for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,It(t.dtype,"int32")),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=0,p=0;p<s;++p)h+=l[c+p];a[u]=h}return o},e.prototype.prod=function(t,e){Wu(t,"sum");for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,It(t.dtype,"int32")),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=1,p=0;p<s;++p)h*=l[c+p];a[u]=h}return o},e.prototype.unsortedSegmentSum=function(t,e,n){Wu(t,"unsortedSegmentSum");for(var i=[],r=t.rank-e.rank,o=0;o<r;++o)e=e.expandDims(o+1);for(o=0;o<n;++o){var s=fn(o,"int32"),a=ka(s,e).asType("float32").mul(t).sum(0);i.push(a)}return pi(i)},e.prototype.argMin=function(t,e){Wu(t,"argMin");var n=[e];en("argMin",n,t.rank);for(var i=Qe(t.shape,n),r=i[0],o=i[1],s=bn(r,"int32"),a=x(o),l=this.readSync(s.dataId),u=this.readSync(t.dataId),c=0;c<l.length;++c){for(var h=c*a,p=u[h],d=0,f=0;f<a;++f){var g=u[h+f];g<p&&(p=g,d=f)}l[c]=d}return s},e.prototype.argMax=function(t,e){Wu(t,"argMax");var n=[e];en("argMax",n,t.rank);for(var i=Qe(t.shape,n),r=i[0],o=i[1],s=bn(r,"int32"),a=x(o),l=this.readSync(s.dataId),u=this.readSync(t.dataId),c=0;c<l.length;++c){for(var h=c*a,p=u[h],d=0,f=0;f<a;++f){var g=u[h+f];g>p&&(p=g,d=f)}l[c]=d}return s},e.prototype.cumsum=function(t,e,n,i){if(Wu(t,"cumsum"),e!==t.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(t.rank-1)+" but got axis="+e);for(var r=It(t.dtype,"int32"),o=bn(t.shape,r),s=this.readSync(o.dataId),a=this.readSync(t.dataId),l=t.shape[t.rank-1],u=i?function(t,e){return t+l-e-1}:function(t,e){return t+e},c=0;c<a.length;c+=l)for(var h=0;h<l;h++){var p=u(c,h);if(0===h)s[p]=n?0:a[p];else{var d=u(c,h-1);s[p]=n?a[d]+s[d]:a[p]+s[d]}}return o},e.prototype.equal=function(t,e){return Wu([t,e],"equal"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t===e?1:0})},e.prototype.notEqual=function(t,e){return Wu([t,e],"notEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t!==e?1:0})},e.prototype.less=function(t,e){return Wu([t,e],"less"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<e?1:0})},e.prototype.lessEqual=function(t,e){return Wu([t,e],"lessEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t<=e?1:0})},e.prototype.greater=function(t,e){return Wu([t,e],"greater"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t>e?1:0})},e.prototype.greaterEqual=function(t,e){return Wu([t,e],"greaterEqual"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t>=e?1:0})},e.prototype.logicalNot=function(t){Wu(t,"logicalNot");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),i=0;i<e.length;++i)n[i]=e[i]?0:1;return this.makeOutput(n,t.shape,"bool")},e.prototype.logicalAnd=function(t,e){return Wu([t,e],"logicalAnd"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t&&e})},e.prototype.logicalOr=function(t,e){return Wu([t,e],"logicalOr"),this.broadcastedBinaryOp(t,e,"bool",function(t,e){return t||e})},e.prototype.select=function(t,e,n){Wu([t,e,n],"select");for(var i=this.readSync(t.dataId),r=this.readSync(e.dataId),o=this.readSync(n.dataId),s=bn(e.shape,It(e.dtype,n.dtype)),a=this.readSync(s.dataId),l=0,u=0===t.rank||t.rank>1||1===e.rank?1:x(e.shape.slice(1)),c=0;c<i.length;c++)for(var h=0;h<u;h++)1===i[c]?a[l++]=r[c]:a[l++]=o[c];return s},e.prototype.where=function(t){Wu([t],"where");var e=this.readSync(t.dataId);return yr(t.shape,e)},e.prototype.topk=function(t,e,n){return Wu(t,"topk"),_r(this.readSync(t.dataId),t.shape,t.dtype,e)},e.prototype.min=function(t,e){Wu(t,"min"),en("min",e,t.rank);for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,t.dtype),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=l[c],p=0;p<s;++p){var d=l[c+p];d<h&&(h=d)}a[u]=h}return o},e.prototype.minimum=function(t,e){return Wu([t,e],"minimum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.min(t,e)})},e.prototype.mod=function(t,e){return Wu([t,e],"mod"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t%e;return t<0&&e<0||t>=0&&e>=0?n:(n+e)%e})},e.prototype.max=function(t,e){Wu(t,"max"),en("max",e,t.rank);for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,t.dtype),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=l[c],p=0;p<s;++p){var d=l[c+p];d>h&&(h=d)}a[u]=h}return o},e.prototype.maximum=function(t,e){return Wu([t,e],"maximum"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.max(t,e)})},e.prototype.all=function(t,e){Wu(t,"all"),en("all",e,t.rank);for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,t.dtype),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=l[c],p=0;p<s;++p){var d=l[c+p];h=h&&d}a[u]=h}return o},e.prototype.any=function(t,e){Wu(t,"any"),en("any",e,t.rank);for(var n=Qe(t.shape,e),i=n[0],r=n[1],o=bn(i,t.dtype),s=x(r),a=this.readSync(o.dataId),l=this.readSync(t.dataId),u=0;u<a.length;++u){for(var c=u*s,h=l[c],p=0;p<s;++p){var d=l[c+p];h=h||d}a[u]=h}return o},e.prototype.squaredDifference=function(t,e){return Wu([t,e],"squaredDifference"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){var n=t-e;return n*n})},e.prototype.ceil=function(t){Wu(t,"ceil");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)n[i]=Math.ceil(e[i]);return this.makeOutput(n,t.shape,"float32")},e.prototype.floor=function(t){Wu(t,"floor");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)n[i]=Math.floor(e[i]);return this.makeOutput(n,t.shape,"float32")},e.prototype.sign=function(t){Wu(t,"x");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)e[i]<0?n[i]=-1:e[i]>0?n[i]=1:n[i]=0;return this.makeOutput(n,t.shape,"float32")},e.prototype.isNaN=function(t){Wu(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),i=0;i<e.length;++i)Number.isNaN(e[i])&&(n[i]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.isInf=function(t){Wu(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),i=0;i<e.length;++i)Math.abs(e[i])===1/0&&(n[i]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.isFinite=function(t){Wu(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),i=0;i<e.length;++i)Number.isFinite(e[i])&&(n[i]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.round=function(t){Wu(t,"round");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i){var r=Math.floor(e[i]);e[i]-r<.5?n[i]=Math.floor(e[i]):e[i]-r>.5?n[i]=Math.ceil(e[i]):n[i]=r%2==0?r:r+1}return this.makeOutput(n,t.shape,"float32")},e.prototype.exp=function(t){Wu(t,"exp");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)n[i]=Math.exp(e[i]);return this.makeOutput(n,t.shape,"float32")},e.prototype.expm1=function(t){Wu(t,"expm1");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)n[i]=Math.expm1(e[i]);return this.makeOutput(n,t.shape,"float32")},e.prototype.log=function(t){Wu(t,"log");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i){var r=e[i];n[i]=Math.log(r)}return this.makeOutput(n,t.shape,"float32")},e.prototype.log1p=function(t){Wu(t,"log1p");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i){var r=e[i];n[i]=Math.log1p(r)}return this.makeOutput(n,t.shape,"float32")},e.prototype.sqrt=function(t){Wu(t,"sqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i){var r=e[i];n[i]=Math.sqrt(r)}return this.makeOutput(n,t.shape,"float32")},e.prototype.rsqrt=function(t){Wu(t,"rsqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i){var r=e[i];n[i]=1/Math.sqrt(r)}return this.makeOutput(n,t.shape,"float32")},e.prototype.reciprocal=function(t){Wu(t,"reciprocal");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),i=0;i<e.length;++i)n[i]=1/e[i];return this.makeOutput(n,t.shape,"float32")},e.prototype.linear=function(t){return t},e.prototype.relu=function(t){Wu(t,"relu");for(var e=bn(t.shape,t.dtype),n=this.readSync(e.dataId),i=this.readSync(t.dataId),r=0;r<i.length;++r)n[r]=Math.max(0,i[r]);return e},e.prototype.relu6=function(t){Wu(t,"relu");for(var e=bn(t.shape,t.dtype),n=this.readSync(e.dataId),i=this.readSync(t.dataId),r=0;r<i.length;++r)n[r]=Math.min(Math.max(0,i[r]),6);return e},e.prototype.prelu=function(t,e){return Wu([t,e],"prelu"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return t<0?e*t:t})},e.prototype.elu=function(t){Wu(t,"elu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i){var r=n[i];e[i]=r>=0?r:Math.exp(r)-1}return this.makeOutput(e,t.shape,"float32")},e.prototype.eluDer=function(t,e){Wu([t,e],"eluDer");for(var n=new Float32Array(e.size),i=this.readSync(e.dataId),r=this.readSync(t.dataId),o=0;o<i.length;++o){var s=i[o];n[o]=s>=1?r[o]:r[o]*(s+1)}return this.makeOutput(n,e.shape,"float32")},e.prototype.selu=function(t){Wu(t,"selu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i){var r=n[i];e[i]=r>=0?1.0507009873554805*r:1.7580993408473768*(Math.exp(r)-1)}return this.makeOutput(e,t.shape,"float32")},e.prototype.clip=function(t,e,n){Wu(t,"clip");for(var i=new Float32Array(t.size),r=this.readSync(t.dataId),o=0;o<r.length;++o){var s=r[o];i[o]=s>n?n:s<e?e:s}return this.makeOutput(i,t.shape,"float32")},e.prototype.abs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.abs(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.complexAbs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<t.size;++i){var r=n[2*i],o=n[2*i+1];e[i]=Math.hypot(r,o)}return this.makeOutput(e,t.shape,"float32")},e.prototype.int=function(t){Wu(t,"int");for(var e=new Int32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=n[i];return this.makeOutput(e,t.shape,"int32")},e.prototype.sigmoid=function(t){Wu(t,"sigmoid");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=1/(1+Math.exp(-n[i]));return this.makeOutput(e,t.shape,"float32")},e.prototype.softplus=function(t){Wu(t,"softplus");for(var e=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(t.size),i=this.readSync(t.dataId),r=0;r<i.length;++r){var o,s=i[r]>-e,a=i[r]<e,l=Math.exp(i[r]);o=a?l:s?i[r]:Math.log(1+l),n[r]=o}return this.makeOutput(n,t.shape,"float32")},e.prototype.sin=function(t){Wu(t,"sin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.sin(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.cos=function(t){Wu(t,"cos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.cos(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.tan=function(t){Wu(t,"tan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.tan(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.asin=function(t){Wu(t,"asin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.asin(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.acos=function(t){Wu(t,"acos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.acos(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atan=function(t){Wu(t,"atan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.atan(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atan2=function(t,e){return Wu([t,e],"atan2"),this.broadcastedBinaryOp(t,e,t.dtype,function(t,e){return Math.atan2(t,e)})},e.prototype.sinh=function(t){Wu(t,"sinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.sinh(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.cosh=function(t){Wu(t,"cosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.cosh(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.tanh=function(t){Wu(t,"tanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=O(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.asinh=function(t){Wu(t,"asinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.asinh(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.acosh=function(t){Wu(t,"acosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.acosh(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atanh=function(t){Wu(t,"atanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i)e[i]=Math.atanh(n[i]);return this.makeOutput(e,t.shape,"float32")},e.prototype.erf=function(t){Wu(t,"erf");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),i=0;i<n.length;++i){var r=Math.sign(n[i]),o=Math.abs(n[i]),s=1/(1+.3275911*o);e[i]=r*(1-((((1.061405429*s-1.453152027)*s+1.421413741)*s-.284496736)*s+.254829592)*s*Math.exp(-o*o))}return this.makeOutput(e,t.shape,"float32")},e.prototype.step=function(t,e){void 0===e&&(e=0),Wu(t,"step");for(var n=new Float32Array(t.size),i=this.readSync(t.dataId),r=0;r<i.length;++r){var o=i[r];isNaN(o)?n[r]=NaN:n[r]=o>0?1:e}return this.makeOutput(n,t.shape,"float32")},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,i=t.convInfo,r=t.bias,o=t.activation,s=t.preluActivationWeights,a=this.conv2d(e,n,i);return r&&(a=this.add(a,r)),o&&(a=Gu(this,a,o,s)),a},e.prototype.conv2d=function(t,e,n){Wu([t,e],"conv2d");for(var i=n.filterHeight,r=n.filterWidth,o=n.dilationHeight,s=n.dilationWidth,a=n.padInfo.left,l=n.padInfo.top,u="channelsLast"===n.dataFormat,c=Gn(n.outShape,t.dtype),h=t.strides[0],p=u?t.strides[1]:t.strides[2],d=u?t.strides[2]:1,f=u?1:t.strides[1],g=c.strides[0],m=u?c.strides[1]:c.strides[2],v=u?c.strides[2]:1,_=u?1:c.strides[1],y=this.readSync(t.dataId),b=this.readSync(e.dataId),T=c.values,E=0;E<n.batchSize;++E)for(var C=E*h,S=E*g,w=0;w<n.outHeight;++w)for(var k=S+w*m,x=w*n.strideHeight-l,I=0;I<i;I++){var R=x+I*o;if(!(R<0||R>=n.inHeight))for(var O=I*e.strides[0],D=C+R*p,A=0;A<n.outWidth;++A)for(var M=k+A*v,N=A*n.strideWidth-a,L=0;L<r;L++){var P=N+L*s;if(!(P<0||P>=n.inWidth))for(var B=D+P*d,F=O+L*e.strides[1],U=0;U<n.inChannels;++U){for(var V=y[B+U*f],H=0;H<n.outChannels;++H)T[M+H*_]+=V*b[F+H];F+=n.outChannels}}}return c.toTensor()},e.prototype.conv3d=function(t,e,n){for(var i=n.filterDepth,r=n.filterHeight,o=n.filterWidth,s=n.dilationDepth,a=n.dilationHeight,l=n.dilationWidth,u=n.padInfo.front,c=n.padInfo.left,h=n.padInfo.top,p=Gn(n.outShape,t.dtype),d=this.readSync(t.dataId),f=this.readSync(e.dataId),g=p.values,m=0;m<n.batchSize;++m)for(var v=m*t.strides[0],_=m*p.strides[0],y=0;y<n.outDepth;++y)for(var b=_+y*p.strides[1],T=y*n.strideDepth-u,E=0;E<i;E++){var C=T+E*s;if(!(C<0||C>=n.inDepth))for(var S=E*e.strides[0],w=v+C*t.strides[1],k=0;k<n.outHeight;++k)for(var x=b+k*p.strides[2],I=k*n.strideHeight-h,R=0;R<r;R++){var O=I+R*a;if(!(O<0||O>=n.inHeight))for(var D=S+R*e.strides[1],A=w+O*t.strides[2],M=0;M<n.outWidth;++M)for(var N=x+M*n.outChannels,L=M*n.strideWidth-c,P=0;P<o;P++){var B=L+P*l;if(!(B<0||B>=n.inWidth))for(var F=D+P*e.strides[2],U=A+B*n.inChannels,V=F,H=0;H<n.inChannels;++H){for(var W=d[U+H],G=0;G<n.outChannels;++G)g[N+G]+=W*f[V+G];V+=n.outChannels}}}}return p.toTensor()},e.prototype.conv2dDerInput=function(t,e,n){Wu([t,e],"conv2dDerInput");for(var i=Gn(n.inShape,"float32"),r=i.values,o=this.readSync(t.dataId),s=this.readSync(e.dataId),a=e.strides,l=a[0],u=a[1],c=a[2],h=n.batchSize,p=n.filterHeight,d=n.filterWidth,f=n.inChannels,g=n.inHeight,m=n.inWidth,v=n.outChannels,_=n.outHeight,y=n.outWidth,b=n.strideHeight,T=n.strideWidth,E=n.dataFormat,C=p-1-n.padInfo.top,S=d-1-n.padInfo.left,w="channelsLast"===E,k=i.strides[0],x=w?i.strides[1]:i.strides[2],I=w?i.strides[2]:1,R=w?1:i.strides[1],O=t.strides[0],D=w?t.strides[1]:t.strides[2],A=w?t.strides[2]:1,M=w?1:t.strides[1],N=0;N<h;++N)for(var L=0;L<f;++L)for(var P=0;P<g;++P)for(var B=P-C,F=Math.max(0,Math.ceil(B/b)),U=Math.min(_,(p+B)/b),V=0;V<m;++V){for(var H=V-S,W=Math.max(0,Math.ceil(H/T)),G=Math.min(y,(d+H)/T),j=0,z=F;z<U;++z)for(var $=z*b-B,X=W;X<G;++X)for(var Y=O*N+D*z+A*X,K=l*(p-1-$)+u*(d-1-(X*T-H))+c*L,J=0;J<v;++J)j+=o[Y+M*J]*s[K+J];r[k*N+x*P+I*V+R*L]=j}return i.toTensor()},e.prototype.conv3dDerInput=function(t,e,n){for(var i=Gn(n.inShape,"float32"),r=i.values,o=i.strides,s=o[0],a=o[1],l=o[2],u=o[3],c=this.readSync(t.dataId),h=t.strides,p=h[0],d=h[1],f=h[2],g=h[3],m=this.readSync(e.dataId),v=e.strides,_=v[0],y=v[1],b=v[2],T=v[3],E=n.batchSize,C=n.filterDepth,S=n.filterHeight,w=n.filterWidth,k=n.inChannels,x=n.inDepth,I=n.inHeight,R=n.inWidth,O=n.outChannels,D=n.outDepth,A=n.outHeight,M=n.outWidth,N=n.strideDepth,L=n.strideHeight,P=n.strideWidth,B=C-1-n.padInfo.front,F=S-1-n.padInfo.top,U=w-1-n.padInfo.left,V=0;V<E;++V)for(var H=0;H<k;++H)for(var W=0;W<x;++W)for(var G=W-B,j=Math.max(0,Math.ceil(G/N)),z=Math.min(D,(C+G)/N),$=0;$<I;++$)for(var X=$-F,Y=Math.max(0,Math.ceil(X/L)),K=Math.min(A,(S+X)/L),J=0;J<R;++J){for(var q=J-U,Z=Math.max(0,Math.ceil(q/P)),Q=Math.min(M,(w+q)/P),tt=0,et=j;et<z;++et)for(var nt=et*N-G,it=Y;it<K;++it)for(var rt=it*L-X,ot=Z;ot<Q;++ot)for(var st=p*V+d*et+f*it+g*ot,at=_*(C-1-nt)+y*(S-1-rt)+b*(w-1-(ot*P-q))+T*H,lt=0;lt<O;++lt)tt+=c[st+lt]*m[at+lt];r[s*V+a*W+l*$+u*J+H]=tt}return i.toTensor()},e.prototype.conv2dDerFilter=function(t,e,n){Wu([t,e],"conv2dDerFilter");for(var i=n.strideHeight,r=n.strideWidth,o=n.filterHeight,s=n.filterWidth,a="channelsLast"===n.dataFormat,l=Gn(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,h=this.bufferSync(t),p=this.bufferSync(e),d=0;d<o;++d)for(var f=Math.max(0,Math.ceil((c-d)/i)),g=Math.min(n.outHeight,(n.inHeight+c-d)/i),m=0;m<s;++m)for(var v=Math.max(0,Math.ceil((u-m)/r)),_=Math.min(n.outWidth,(n.inWidth+u-m)/r),y=0;y<n.inChannels;++y)for(var b=0;b<n.outChannels;++b){for(var T=0,E=0;E<n.batchSize;++E)for(var C=f;C<g;++C)for(var S=d+C*i-c,w=v;w<_;++w){var k=m+w*r-u;T+=a?h.get(E,S,k,y)*p.get(E,C,w,b):h.get(E,y,S,k)*p.get(E,b,C,w)}l.set(T,d,m,y,b)}return l.toTensor()},e.prototype.conv3dDerFilter=function(t,e,n){for(var i=n.strideDepth,r=n.strideHeight,o=n.strideWidth,s=n.filterDepth,a=n.filterHeight,l=n.filterWidth,u=Gn(n.filterShape,"float32"),c=u.values,h=u.strides,p=h[0],d=h[1],f=h[2],g=h[3],m=this.readSync(e.dataId),v=e.strides,_=v[0],y=v[1],b=v[2],T=v[3],E=this.readSync(t.dataId),C=t.strides,S=C[0],w=C[1],k=C[2],x=C[3],I=n.padInfo.front,R=n.padInfo.left,O=n.padInfo.top,D=0;D<s;++D)for(var A=Math.max(0,Math.ceil((I-D)/i)),M=Math.min(n.outDepth,(n.inDepth+I-D)/i),N=D*p,L=0;L<a;++L)for(var P=Math.max(0,Math.ceil((O-L)/r)),B=Math.min(n.outHeight,(n.inHeight+O-L)/r),F=L*d+N,U=0;U<l;++U)for(var V=Math.max(0,Math.ceil((R-U)/o)),H=Math.min(n.outWidth,(n.inWidth+R-U)/o),W=U*f+F,G=0;G<n.inChannels;++G)for(var j=G*g+W,z=0;z<n.outChannels;++z){for(var $=0,X=0;X<n.batchSize;++X)for(var Y=X*S,K=X*_,J=A;J<M;++J)for(var q=(D+J*i-I)*w+Y,Z=J*y+K,Q=P;Q<B;++Q)for(var tt=(L+Q*r-O)*k+q,et=Q*b+Z,nt=V;nt<H;++nt){var it=nt*T+et;$+=E[(U+nt*o-R)*x+tt+G]*m[it+z]}c[j+z]=$}return u.toTensor()},e.prototype.fusedDepthwiseConv2D=function(t){var e=t.input,n=t.filter,i=t.convInfo,r=t.bias,o=t.activation,s=t.preluActivationWeights,a=this.depthwiseConv2D(e,n,i);return r&&(a=this.add(a,r)),o&&(a=Gu(this,a,o,s)),a},e.prototype.depthwiseConv2D=function(t,e,n){Wu([t,e],"depthwiseConv2D");for(var i=n.filterHeight,r=n.filterWidth,o=n.dilationHeight,s=n.dilationWidth,a=n.padInfo.left,l=n.padInfo.top,u=n.outChannels/n.inChannels,c=Gn(n.outShape,t.dtype),h=this.readSync(t.dataId),p=this.readSync(e.dataId),d=c.values,f=0;f<n.batchSize;++f)for(var g=f*t.strides[0],m=f*c.strides[0],v=0;v<n.outHeight;++v)for(var _=m+v*c.strides[1],y=v*n.strideHeight-a,b=0;b<i;++b){var T=y+b*o;if(!(T<0||T>=n.inHeight))for(var E=b*e.strides[0],C=g+T*t.strides[1],S=0;S<n.outWidth;++S)for(var w=_+S*c.strides[2],k=S*n.strideWidth-l,x=0;x<r;++x){var I=k+x*s;if(!(I<0||I>=n.inWidth))for(var R=E+x*e.strides[1],O=C+I*n.inChannels,D=w,A=R,M=0;M<n.inChannels;++M){for(var N=h[O+M],L=0;L<u;++L)d[D+L]+=N*p[A+L];D+=u,A+=u}}}return c.toTensor()},e.prototype.depthwiseConv2DDerInput=function(t,e,n){Wu([t,e],"depthwiseConv2DDerInput");for(var i=Gn(n.inShape,"float32"),r=i.values,o=i.strides,s=o[0],a=o[1],l=o[2],u=this.readSync(t.dataId),c=t.strides,h=c[0],p=c[1],d=c[2],f=this.readSync(e.dataId),g=e.strides,m=g[0],v=g[1],_=g[2],y=n.batchSize,b=n.filterHeight,T=n.filterWidth,E=n.inChannels,C=n.inHeight,S=n.inWidth,w=n.outChannels,k=n.outHeight,x=n.outWidth,I=n.strideHeight,R=n.strideWidth,O=b-1-n.padInfo.top,D=T-1-n.padInfo.left,A=w/E,M=0;M<y;++M)for(var N=0;N<E;++N)for(var L=0;L<C;++L)for(var P=L-O,B=Math.max(0,Math.ceil(P/I)),F=Math.min(k,(b+P)/I),U=0;U<S;++U){for(var V=U-D,H=Math.max(0,Math.ceil(V/R)),W=Math.min(x,(T+V)/R),G=0,j=B;j<F;++j)for(var z=j*I-P,$=H;$<W;++$)for(var X=h*M+p*j+d*$,Y=m*(b-1-z)+v*(T-1-($*R-V))+_*N,K=0;K<A;++K)G+=u[X+(N*A+K)]*f[Y+K];r[s*M+a*L+l*U+N]=G}return i.toTensor()},e.prototype.depthwiseConv2DDerFilter=function(t,e,n){Wu([t,e],"depthwiseConv2DDerFilter");for(var i=n.strideHeight,r=n.strideWidth,o=n.filterHeight,s=n.filterWidth,a=Gn(n.filterShape,"float32"),l=n.padInfo.left,u=n.padInfo.top,c=n.outChannels/n.inChannels,h=this.bufferSync(t),p=this.bufferSync(e),d=0;d<o;++d)for(var f=Math.max(0,Math.ceil((u-d)/i)),g=Math.min(n.outHeight,(n.inHeight+u-d)/i),m=0;m<s;++m)for(var v=Math.max(0,Math.ceil((l-m)/r)),_=Math.min(n.outWidth,(n.inWidth+l-m)/r),y=0;y<n.outChannels;++y){for(var b=Math.trunc(y/c),T=y%c,E=0,C=0;C<n.batchSize;++C)for(var S=f;S<g;++S)for(var w=d+S*i-u,k=v;k<_;++k){var x=m+k*r-l;E+=h.get(C,w,x,b)*p.get(C,S,k,y)}a.set(E,d,m,b,T)}return a.toTensor()},e.prototype.tile=function(t,e){return Wu(t,"tile"),vr(this.bufferSync(t),e)},e.prototype.pad=function(t,e,n){Wu(t,"pad");var i=e.map(function(e,n){return e[0]+t.shape[n]+e[1]}),r=e.map(function(t){return t[0]}),o=this.bufferSync(t),s=Gn(i,t.dtype);0!==n&&s.values.fill(n);for(var a=0;a<t.size;a++){var l=o.indexToLoc(a),u=l.map(function(t,e){return t+r[e]});s.set.apply(s,[o.get.apply(o,l)].concat(u))}return s.toTensor()},e.prototype.transpose=function(t,e){Wu(t,"transpose");for(var n=new Array(t.rank),i=0;i<n.length;i++)n[i]=t.shape[e[i]];var r=this.readSync(t.dataId),o=Gn(n,t.dtype),s=this.bufferSync(t);for(i=0;i<t.size;++i){for(var a=s.indexToLoc(i),l=new Array(a.length),u=0;u<l.length;u++)l[u]=a[e[u]];var c=o.locToIndex(l);o.values[c]=r[i]}return o.toTensor()},e.prototype.gather=function(t,e,n){Wu([t,e],"gather");var i=t.shape.slice(),r=this.readSync(e.dataId);i[n]=r.length;for(var o=Gn(i,t.dtype),s=this.bufferSync(t),a=0;a<o.size;++a){var l=o.indexToLoc(a),u=l.slice();u[n]=r[l[n]];var c=s.locToIndex(u);o.values[a]=s.values[c]}return o.toTensor()},e.prototype.batchToSpaceND=function(t,e,n){Wu([t],"batchToSpaceND");var i=e.reduce(function(t,e){return t*e}),r=mi(t.shape,e,i),o=vi(r.length,e.length),s=_i(t.shape,e,i),a=yi(n,e.length),l=bi(s,n,e.length);return t.reshape(r).transpose(o).reshape(s).slice(a,l)},e.prototype.spaceToBatchND=function(t,e,n){Wu([t],"spaceToBatchND");var i=e.reduce(function(t,e){return t*e}),r=[[0,0]];r.push.apply(r,n);for(var o=1+e.length;o<t.shape.length;++o)r.push([0,0]);var s=t.pad(r),a=mi(s.shape,e,i,!1),l=vi(a.length,e.length,!1),u=_i(s.shape,e,i,!1);return s.reshape(a).transpose(l).reshape(u)},e.prototype.pool=function(t,e,n){Wu(t,"pool");for(var i=e.strideHeight,r=e.strideWidth,o=e.dilationHeight,s=e.dilationWidth,a=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=e.padInfo.top,c=e.padInfo.left,h="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,p=this.readSync(t.dataId),d=Gn(e.outShape,t.dtype),f=d.values,g=e.outShape[1]*e.outShape[2]*e.outShape[3],m=e.outShape[2]*e.outShape[3],v=e.outShape[3],_=0;_<e.batchSize;++_)for(var y=_*g,b=_*t.strides[0],T=0;T<e.inChannels;++T)for(var E=0;E<e.outHeight;++E)for(var C=E*i-u,S=Math.max(0,C),w=Math.min(e.inHeight,a+C),k=y+E*m,x=0;x<e.outWidth;++x){for(var I=x*r-c,R=Math.max(0,I),O=Math.min(e.inWidth,l+I),D=h,A=0,M=0,N=S;N<w;N+=o){for(var L=b+N*t.strides[1],P=R;P<O;P+=s){var B=p[L+P*t.strides[2]+T];"max"===n&&B>D?D=B:"avg"===n&&(A+=B,M++)}if(isNaN(D))break}f[k+x*v+T]="avg"===n?A/M:D}return d.toTensor()},e.prototype.maxPool=function(t,e){return this.pool(t,e,"max")},e.prototype.maxPoolPositions=function(t,e){for(var n=Gn(e.outShape,"int32"),i=e.strideHeight,r=e.strideWidth,o=e.dilationHeight,s=e.dilationWidth,a=e.effectiveFilterHeight,l=e.effectiveFilterWidth,u=e.padInfo.top,c=e.padInfo.left,h=this.bufferSync(t),p=0;p<e.batchSize;++p)for(var d=0;d<e.inChannels;++d)for(var f=0;f<e.outHeight;++f){for(var g=f*i-u,m=g;m<0;)m+=o;for(var v=Math.min(e.inHeight,a+g),_=0;_<e.outWidth;++_){for(var y=_*r-c,b=y;b<0;)b+=s;for(var T=Math.min(e.inWidth,l+y),E=Number.NEGATIVE_INFINITY,C=-1,S=m;S<v;S+=o)for(var w=S-g,k=b;k<T;k+=s){var x=k-y,I=h.get(p,S,k,d);I>E&&(E=I,C=w*l+x)}n.set(C,p,f,_,d)}}return n.toTensor()},e.prototype.maxPoolBackprop=function(t,e,n,i){Wu([e,n],"maxPoolBackprop");for(var r=this.maxPoolPositions(e,i),o=i.strideHeight,s=i.strideWidth,a=i.dilationHeight,l=i.dilationWidth,u=i.effectiveFilterHeight,c=i.effectiveFilterWidth,h=c-1-i.padInfo.left,p=u-1-i.padInfo.top,d=Gn(e.shape,"float32"),f=this.bufferSync(r),g=this.bufferSync(t),m=0;m<i.batchSize;++m)for(var v=0;v<i.inChannels;++v)for(var _=0;_<i.inHeight;++_)for(var y=0;y<i.inWidth;++y){for(var b=_-p,T=y-h,E=0,C=0;C<u;C+=a){var S=(b+C)/o;if(!(S<0||S>=i.outHeight||Math.floor(S)!==S))for(var w=0;w<c;w+=l){var k=(T+w)/s;if(!(k<0||k>=i.outWidth||Math.floor(k)!==k)){var x=u*c-1-f.get(m,S,k,v)===C*c+w?1:0;0!==x&&(E+=g.get(m,S,k,v)*x)}}}d.set(E,m,_,y,v)}return d.toTensor()},e.prototype.avgPoolBackprop=function(t,e,n){Wu([t,e],"avgPoolBackprop");for(var i=n.strideHeight,r=n.strideWidth,o=n.filterHeight,s=n.filterWidth,a=n.dilationHeight,l=n.dilationWidth,u=n.effectiveFilterHeight,c=n.effectiveFilterWidth,h=c-1-n.padInfo.left,p=u-1-n.padInfo.top,d=Gn(e.shape,"float32"),f=1/(o*s),g=this.bufferSync(t),m=0;m<n.batchSize;++m)for(var v=0;v<n.inChannels;++v)for(var _=0;_<n.inHeight;++_)for(var y=0;y<n.inWidth;++y){for(var b=_-p,T=y-h,E=0,C=0;C<u;C+=a){var S=(b+C)/i;if(!(S<0||S>=n.outHeight||Math.floor(S)!==S))for(var w=0;w<c;w+=l){var k=(T+w)/r;k<0||k>=n.outWidth||Math.floor(k)!==k||(E+=g.get(m,S,k,v))}}d.set(E*f,m,_,y,v)}return d.toTensor()},e.prototype.pool3d=function(t,e,n){Wu(t,"pool3d");for(var i=e.strideDepth,r=e.strideHeight,o=e.strideWidth,s=e.dilationDepth,a=e.dilationHeight,l=e.dilationWidth,u=e.effectiveFilterDepth,c=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=e.padInfo.front,d=e.padInfo.top,f=e.padInfo.left,g="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=this.readSync(t.dataId),v=Gn(e.outShape,t.dtype),_=v.values,y=e.outShape[1]*e.outShape[2]*e.outShape[3]*e.outShape[4],b=e.outShape[2]*e.outShape[3]*e.outShape[4],T=e.outShape[3]*e.outShape[4],E=e.outShape[4],C=0;C<e.batchSize;++C)for(var S=C*y,w=C*t.strides[0],k=0;k<e.inChannels;++k)for(var x=0;x<e.outDepth;++x){for(var I=x*i-p,R=I;R<0;)R+=s;for(var O=Math.min(e.inDepth,u+I),D=S+x*b,A=0;A<e.outHeight;++A){for(var M=A*r-d,N=M;N<0;)N+=a;for(var L=Math.min(e.inHeight,c+M),P=D+A*T,B=0;B<e.outWidth;++B){for(var F=B*o-f,U=F;U<0;)U+=l;for(var V=Math.min(e.inWidth,h+F),H=P+B*E,W=g,G=0,j=0,z=R;z<O;z+=s){for(var $=w+z*t.strides[1],X=N;X<L;X+=a){for(var Y=$+X*t.strides[2],K=U;K<V;K+=l){var J=m[Y+K*t.strides[3]+k];if("max"===n&&J>W?W=J:"avg"===n&&(G+=J,j++),isNaN(W))break}if(isNaN(W))break}if(isNaN(W))break}_[H+k]="avg"===n?G/j:W}}}return v.toTensor()},e.prototype.avgPool3d=function(t,e){return Wu(t,"avgPool3d"),this.pool3d(t,e,"avg").toFloat()},e.prototype.avgPool3dBackprop=function(t,e,n){Wu([t,e],"avgPool3dBackprop");for(var i=n.strideDepth,r=n.strideHeight,o=n.strideWidth,s=n.filterDepth,a=n.filterHeight,l=n.filterWidth,u=n.dilationDepth,c=n.dilationHeight,h=n.dilationWidth,p=n.effectiveFilterDepth,d=n.effectiveFilterHeight,f=n.effectiveFilterWidth,g=p-1-n.padInfo.front,m=f-1-n.padInfo.left,v=d-1-n.padInfo.top,_=Gn(e.shape,"float32"),y=1/(s*a*l),b=this.bufferSync(t),T=0;T<n.batchSize;++T)for(var E=0;E<n.inChannels;++E)for(var C=0;C<n.inDepth;++C)for(var S=0;S<n.inHeight;++S)for(var w=0;w<n.inWidth;++w){for(var k=C-g,x=S-v,I=w-m,R=0,O=0;O<p;O+=u){var D=(k+O)/i;if(!(D<0||D>=n.outDepth||Math.floor(D)!==D))for(var A=0;A<d;A+=c){var M=(x+A)/r;if(!(M<0||M>=n.outHeight||Math.floor(M)!==M))for(var N=0;N<f;N+=h){var L=(I+N)/o;L<0||L>=n.outWidth||Math.floor(L)!==L||(R+=b.get(T,D,M,L,E))}}}_.set(R*y,T,C,S,w,E)}return _.toTensor()},e.prototype.maxPool3d=function(t,e){return Wu(t,"maxPool3d"),this.pool3d(t,e,"max").toFloat()},e.prototype.maxPool3dPositions=function(t,e){for(var n=Gn(e.outShape,"int32"),i=e.strideDepth,r=e.strideHeight,o=e.strideWidth,s=e.dilationDepth,a=e.dilationHeight,l=e.dilationWidth,u=e.effectiveFilterDepth,c=e.effectiveFilterHeight,h=e.effectiveFilterWidth,p=e.padInfo.front,d=e.padInfo.top,f=e.padInfo.left,g=this.bufferSync(t),m=0;m<e.batchSize;++m)for(var v=0;v<e.inChannels;++v)for(var _=0;_<e.outDepth;++_){for(var y=_*i-p,b=y;b<0;)b+=s;for(var T=Math.min(e.inDepth,u+y),E=0;E<e.outHeight;++E){for(var C=E*r-d,S=C;S<0;)S+=a;for(var w=Math.min(e.inHeight,c+C),k=0;k<e.outWidth;++k){for(var x=k*o-f,I=x;I<0;)I+=l;for(var R=Math.min(e.inWidth,h+x),O=Number.NEGATIVE_INFINITY,D=-1,A=b;A<T;A+=s)for(var M=A-y,N=S;N<w;N+=a)for(var L=N-C,P=I;P<R;P+=l){var B=P-x,F=g.get(m,A,N,P,v);F>=O&&(O=F,D=M*c*h+L*c+B)}n.set(D,m,_,E,k,v)}}}return n.toTensor()},e.prototype.maxPool3dBackprop=function(t,e,n,i){Wu([e,n],"maxPool3dBackprop");for(var r=this.maxPool3dPositions(e,i),o=i.strideDepth,s=i.strideHeight,a=i.strideWidth,l=i.dilationDepth,u=i.dilationHeight,c=i.dilationWidth,h=i.effectiveFilterDepth,p=i.effectiveFilterHeight,d=i.effectiveFilterWidth,f=h-1-i.padInfo.front,g=d-1-i.padInfo.left,m=p-1-i.padInfo.top,v=Gn(e.shape,"float32"),_=this.bufferSync(r),y=this.bufferSync(t),b=0;b<i.batchSize;++b)for(var T=0;T<i.inChannels;++T)for(var E=0;E<i.inDepth;++E)for(var C=0;C<i.inHeight;++C)for(var S=0;S<i.inWidth;++S){for(var w=E-f,k=C-m,x=S-g,I=0,R=0;R<h;R+=l){var O=(w+R)/o;if(!(O<0||O>=i.outDepth||Math.floor(O)!==O))for(var D=0;D<p;D+=u){var A=(k+D)/s;if(!(A<0||A>=i.outHeight||Math.floor(A)!==A))for(var M=0;M<d;M+=c){var N=(x+M)/a;if(!(N<0||N>=i.outWidth||Math.floor(N)!==N)){var L=h*p*d-1-_.get(b,O,A,N,T)===R*p*d+D*d+M?1:0;0!==L&&(I+=y.get(b,O,A,N,T)*L)}}}}v.set(I,b,E,C,S,T)}return v.toTensor()},e.prototype.cast=function(t,e){return er(t,e,this)},e.prototype.reshape=function(t,e){return nr(t,e)},e.prototype.avgPool=function(t,e){return Wu(t,"avgPool"),this.pool(t,e,"avg").toFloat()},e.prototype.resizeBilinear=function(t,e,n,i){Wu(t,"resizeBilinear");for(var r=t.shape,o=r[0],s=r[1],a=r[2],l=r[3],u=this.readSync(t.dataId),c=new Float32Array(x([o,e,n,l])),h=[i&&e>1?s-1:s,i&&n>1?a-1:a],p=[i&&e>1?e-1:e,i&&n>1?n-1:n],d=0,f=h[0]/p[0],g=h[1]/p[1],m=0;m<o;m++)for(var v=0;v<e;v++)for(var _=f*v,y=Math.floor(_),b=_-y,T=Math.min(s-1,Math.ceil(_)),E=m*t.strides[0]+y*t.strides[1],C=m*t.strides[0]+T*t.strides[1],S=0;S<n;S++)for(var w=g*S,k=Math.floor(w),I=w-k,R=Math.min(a-1,Math.ceil(w)),O=E+k*t.strides[2],D=C+k*t.strides[2],A=E+R*t.strides[2],M=C+R*t.strides[2],N=0;N<l;N++){var L=u[O+N],P=u[D+N],B=L+(u[A+N]-L)*I,F=B+(P+(u[M+N]-P)*I-B)*b;c[d++]=F}return pn(c,[o,e,n,l])},e.prototype.resizeBilinearBackprop=function(t,e,n){Wu([t,e],"resizeBilinearBackprop");for(var i=e.shape,r=i[0],o=i[1],s=i[2],a=i[3],l=t.shape,u=l[1],c=l[2],h=new Float32Array(r*o*s*a),p=[n&&u>1?o-1:o,n&&c>1?s-1:s],d=[n&&u>1?u-1:u,n&&c>1?c-1:c],f=p[0]/d[0],g=p[1]/d[1],m=this.readSync(t.dataId),v=0,_=0;_<r;_++)for(var y=_*e.strides[0],b=0;b<u;b++)for(var T=b*f,E=Math.floor(T),C=Math.min(Math.ceil(T),o-1),S=y+E*e.strides[1],w=y+C*e.strides[1],k=T-E,x=1-k,I=0;I<c;I++)for(var R=I*g,O=Math.floor(R),D=Math.min(Math.ceil(R),s-1),A=R-O,M=1-A,N=S+O*e.strides[2],L=S+D*e.strides[2],P=w+O*e.strides[2],B=w+D*e.strides[2],F=x*M,U=x*A,V=k*M,H=k*A,W=0;W<a;W++){var G=m[v++];h[N+W]+=G*F,h[L+W]+=G*U,h[P+W]+=G*V,h[B+W]+=G*H}return _n(h,[r,s,o,a],e.dtype)},e.prototype.resizeNearestNeighbor=function(t,e,n,i){Wu(t,"resizeNearestNeighbor");for(var r=t.shape,o=r[0],s=r[1],a=r[2],l=r[3],u=this.readSync(t.dataId),c=new Float32Array(o*e*n*l),h=[i&&e>1?s-1:s,i&&n>1?a-1:a],p=[i&&e>1?e-1:e,i&&n>1?n-1:n],d=h[0]/p[0],f=h[1]/p[1],g=0,m=0;m<o;m++)for(var v=m*t.strides[0],_=0;_<e;_++)for(var y=d*_,b=v+Math.min(s-1,i?Math.round(y):Math.floor(y))*t.strides[1],T=0;T<n;T++)for(var E=f*T,C=b+Math.min(a-1,i?Math.round(E):Math.floor(E))*t.strides[2],S=0;S<l;S++){var w=u[C+S];c[g++]=w}return pn(c,[o,e,n,l],t.dtype)},e.prototype.resizeNearestNeighborBackprop=function(t,e,n){Wu([t,e],"resizeNearestNeighborBackprop");for(var i=e.shape,r=i[0],o=i[1],s=i[2],a=i[3],l=t.shape,u=l[1],c=l[2],h=new Float32Array(r*o*s*a),p=this.readSync(t.dataId),d=[n&&u>1?o-1:o,n&&c>1?s-1:s],f=[n&&u>1?u-1:u,n&&c>1?c-1:c],g=d[0]/f[0],m=d[1]/f[1],v=1/g,_=1/m,y=2*Math.ceil(v)+2,b=2*Math.ceil(_)+2,T=0;T<r;T++)for(var E=T*e.strides[0],C=0;C<o;C++)for(var S=E+C*e.strides[1],w=Math.floor(C*v),k=Math.floor(w-y/2),x=0;x<s;x++)for(var I=S+x*e.strides[2],R=Math.floor(x*_),O=Math.floor(R-b/2),D=0;D<a;D++){for(var A=0,M=0;M<y;M++){var N=M+k;if(!(N<0||N>=u)){var L=E+N*t.strides[1],P=N*g;if(C===Math.min(o-1,n?Math.round(P):Math.floor(P)))for(var B=0;B<b;B++){var F=B+O;if(!(F<0||F>=c)){var U=L+F*t.strides[2],V=F*m;x===Math.min(s-1,n?Math.round(V):Math.floor(V))&&(A+=p[U+D])}}}}h[I+D]=A}return _n(h,e.shape,e.dtype)},e.prototype.batchNormalization=function(t,e,n,i,r,o){Wu([t,e,n,r,o],"batchNorm");for(var s=this.readSync(t.dataId),a=this.readSync(e.dataId),l=this.readSync(n.dataId),u=r?this.readSync(r.dataId):new Float32Array([1]),c=o?this.readSync(o.dataId):new Float32Array([0]),h=new Float32Array(s.length),p=c.length,d=u.length,f=l.length,g=a.length,m=0,v=0,_=0,y=0,b=0;b<s.length;++b)h[b]=c[m++]+(s[b]-a[v++])*u[_++]/Math.sqrt(l[y++]+i),m>=p&&(m=0),v>=g&&(v=0),_>=d&&(_=0),y>=f&&(y=0);return _n(h,t.shape)},e.prototype.localResponseNormalization4D=function(t,e,n,i,r){Wu(t,"localResponseNormalization4D");var o=t.shape[3],s=o-1,a=this.readSync(t.dataId),l=t.size,u=new Float32Array(l);function c(t){for(var n=t%o,i=t-n+Math.max(0,n-e),r=t-n+Math.min(n+e,s),l=0;i<=r;i++){var u=a[i];l+=u*u}return l}for(var h=0;h<l;h++){var p=c(h),d=a[h]*Math.pow(n+i*p,-r);u[h]=d}return _n(u,t.shape)},e.prototype.LRNGrad=function(t,e,n,i,r,o,s){Wu(t,"LRNGrad");for(var a=t.shape[3],l=this.readSync(t.dataId),u=this.readSync(e.dataId),c=this.readSync(n.dataId),h=new Float32Array(t.size),p=t.size,d=0;d<p;d++){for(var f=d%a,g=d-f+Math.max(0,f-i),m=d-f+Math.min(a,f+i+1),v=0,_=g;_<m;_++)v+=Math.pow(u[_],2);for(v=o*v+r,_=g;_<m;_++){var y=-2*o*s*u[_]*c[d]/v;d===_&&(y+=Math.pow(v,-s)),y*=l[d],h[_]+=y}}return _n(h,t.shape)},e.prototype.multinomial=function(t,e,n,i){Wu(t,"multinomial");for(var r=e?t:Li(t),o=r.shape[0],s=r.shape[1],a=bn([o,n],"int32"),l=this.readSync(a.dataId),u=this.readSync(r.dataId),c=0;c<o;++c){var h=c*s,p=new Float32Array(s-1);p[0]=u[h];for(var d=1;d<p.length;++d)p[d]=p[d-1]+u[h+d];for(var f=Un(i.toString()),g=c*n,m=0;m<n;++m){var v=f();l[g+m]=p.length;for(var _=0;_<p.length;_++)if(v<p[_]){l[g+m]=_;break}}}return a},e.prototype.oneHot=function(t,e,n,i){Wu(t,"oneHot");var r=new Float32Array(t.size*e);r.fill(i);for(var o=this.readSync(t.dataId),s=0;s<t.size;++s)o[s]>=0&&o[s]<e&&(r[s*e+o[s]]=n);return mn(r,[t.size,e],"int32")},e.prototype.nonMaxSuppression=function(t,e,n,i,r){return Wu(t,"nonMaxSuppression"),cr(this.readSync(t.dataId),this.readSync(e.dataId),n,i,r)},e.prototype.fft=function(t){return this.fftBatch(t,!1)},e.prototype.ifft=function(t){return this.fftBatch(t,!0)},e.prototype.fftBatch=function(t,e){for(var n=t.shape[0],i=t.shape[1],r=Gn(t.shape,"float32"),o=Gn(t.shape,"float32"),s=cn(t).as2D(n,i),a=hn(t).as2D(n,i),l=0;l<n;l++)for(var u=s.slice([l,0],[1,i]),c=a.slice([l,0],[1,i]),h=un(u,c),p=this.readSync(this.fftImpl(h,e).dataId),d=0;d<i;d++){var f=or(p,d);r.values[l*i+d]=f.real,o.values[l*i+d]=f.imag}return un(r.toTensor(),o.toTensor()).as2D(n,i)},e.prototype.fftImpl=function(t,e){var n=t.as1D(),i=n.size;if(this.isExponentOf2(i)){var r=this.fftRadix2(n,i,e).as2D(t.shape[0],t.shape[1]);return e&&(r=un(cn(r).div(fn(i)),hn(r).div(fn(i)))),r}var o=this.readSync(t.dataId),s=function(t){for(var e=new Float32Array(t.length/2),n=new Float32Array(t.length/2),i=0;i<t.length;i+=2)e[i/2]=t[i],n[i/2]=t[i+1];return{real:e,imag:n}}(this.fourierTransformByMatmul(o,i,e));return un(s.real,s.imag).as2D(t.shape[0],t.shape[1])},e.prototype.isExponentOf2=function(t){return 0==(t&t-1)},e.prototype.fftRadix2=function(t,e,n){if(1===e)return t;var i=this.readSync(t.dataId),r=e/2,o=function(t){for(var e=Math.ceil(t.length/4),n=new Float32Array(e),i=new Float32Array(e),r=0;r<t.length;r+=4)n[Math.floor(r/4)]=t[r],i[Math.floor(r/4)]=t[r+1];return{real:n,imag:i}}(i),s=un(o.real,o.imag).as1D(),a=function(t){for(var e=Math.floor(t.length/4),n=new Float32Array(e),i=new Float32Array(e),r=2;r<t.length;r+=4)n[Math.floor(r/4)]=t[r],i[Math.floor(r/4)]=t[r+1];return{real:n,imag:i}}(i),l=un(a.real,a.imag).as1D();s=this.fftRadix2(s,r,n),l=this.fftRadix2(l,r,n);var u=function(t,e){for(var n=new Float32Array(t/2),i=new Float32Array(t/2),r=0;r<Math.ceil(t/2);r++){var o=(e?2:-2)*Math.PI*(r/t);n[r]=Math.cos(o),i[r]=Math.sin(o)}return{real:n,imag:i}}(e,n),c=un(u.real,u.imag).mul(l),h=s.add(c),p=s.sub(c),d=cn(h).concat(cn(p)),f=hn(h).concat(hn(p));return un(d,f).as1D()},e.prototype.fourierTransformByMatmul=function(t,e,n){for(var i=new Float32Array(2*e),r=0;r<e;r++){for(var o=0,s=0,a=0;a<e;a++){var l=ar(r*a,e,n),u=or(t,a);o+=u.real*l.real-u.imag*l.imag,s+=u.real*l.imag+u.imag*l.real}n&&(o/=e,s/=e),sr(i,o,s,r)}return i},e.prototype.depthToSpace=function(t,e,n){C("NHWC"===n,function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+n}),C(e>1,function(){return"blockSize should be > 1 for depthToSpace, but was: "+e});for(var i=t.shape[0],r=t.shape[1],o=t.shape[2],s=t.shape[3],a=r*e,l=o*e,u=s/(e*e),c=this.readSync(t.dataId),h=new Float32Array(i*a*l*u),p=0,d=0;d<i;++d)for(var f=0;f<a;++f)for(var g=Math.floor(f/e),m=f%e,v=0;v<l;++v)for(var _=Math.floor(v/e),y=(m*e+v%e)*u,b=0;b<u;++b){var T=b+y+s*(_+o*(g+r*d));h[p++]=c[T]}return _n(h,[i,a,l,u])},e.prototype.broadcastedBinaryOp=function(t,e,n,i){var r=Wi(t.shape,e.shape),o=Gn(r,n),s=this.readSync(t.dataId),a=this.readSync(e.dataId),l=Vi(t.shape,r),u=Vi(e.shape,r),c=o.values;if(l.length+u.length===0)for(var h=0;h<c.length;++h)c[h]=i(s[h%s.length],a[h%a.length]);else{var p=this.bufferSync(t),d=this.bufferSync(e),f=function(n){var r=o.indexToLoc(n),h=r.slice(-t.rank);l.forEach(function(t){return h[t]=0});var f=p.locToIndex(h),g=r.slice(-e.rank);u.forEach(function(t){return g[t]=0});var m=d.locToIndex(g);c[n]=i(s[f],a[m])};for(h=0;h<c.length;++h)f(h)}return o.toTensor()},e.prototype.broadcastedBinaryComplexOp=function(t,e,n){var i=Wi(t.shape,e.shape),r=Gn(i,"float32"),o=Gn(i,"float32"),s=this.readSync(t.dataId),a=this.readSync(e.dataId),l=Vi(t.shape,i),u=Vi(e.shape,i),c=r.values,h=o.values;if(l.length+u.length===0)for(var p=0;p<c.length;p++){var d=p%s.length,f=p%a.length,g=n(s[2*d],s[2*d+1],a[2*f],a[2*f+1]);c[p]=g.real,h[p]=g.imag}else{var m=this.bufferSync(this.data.get(t.dataId).complexTensors.real),v=this.bufferSync(this.data.get(e.dataId).complexTensors.real),_=function(i){var o=r.indexToLoc(i),p=o.slice(-t.rank);l.forEach(function(t){return p[t]=0});var d=m.locToIndex(p),f=o.slice(-e.rank);u.forEach(function(t){return f[t]=0});var g=v.locToIndex(f),_=n(s[2*d],s[2*d+1],a[2*g],a[2*g+1]);c[i]=_.real,h[i]=_.imag};for(p=0;p<c.length;p++)_(p)}return this.complex(r.toTensor(),o.toTensor())},e.prototype.split=function(t,e,n){return mr(t,e,n)},e.prototype.dispose=function(){},e.prototype.floatPrecision=function(){return 32},e.prototype.epsilon=function(){return 1e-7},e.prototype.cropAndResize=function(t,e,n,i,r,o){for(var s=t.shape,a=s[0],l=s[1],u=s[2],c=s[3],h=e.shape[0],p=i[0],d=i[1],f=Gn([h,p,d,c],"float32"),g=this.readSync(e.dataId),m=this.readSync(n.dataId),v=this.readSync(t.dataId),_=t.strides,y=f.strides,b=0;b<h;b++){var T=4*b,E=g[T],C=g[T+1],S=g[T+2],w=g[T+3],k=m[b];if(!(k>=a))for(var x=p>1?(S-E)*(l-1)/(p-1):0,I=d>1?(w-C)*(u-1)/(d-1):0,R=0;R<p;R++){var O=p>1?E*(l-1)+R*x:.5*(E+S)*(l-1);if(O<0||O>l-1)for(var D=0;D<d;D++)for(var A=0;A<c;A++){var M=A+D*y[2]+R*y[1]+b*y[0];f.values[M]=o}else if("bilinear"===r){var N=Math.floor(O),L=Math.ceil(O),P=O-N;for(D=0;D<d;D++)if((z=d>1?C*(u-1)+D*I:.5*(C+w)*(u-1))<0||z>u-1)for(A=0;A<c;A++)M=A+D*y[2]+R*y[1]+b*y[0],f.values[M]=o;else{var B=Math.floor(z),F=Math.ceil(z),U=z-B;for(A=0;A<c;A++){var V=v[M=A+B*_[2]+N*_[1]+k*_[0]],H=v[M=A+F*_[2]+N*_[1]+k*_[0]],W=v[M=A+B*_[2]+L*_[1]+k*_[0]],G=V+(H-V)*U,j=W+(v[M=A+F*_[2]+L*_[1]+k*_[0]]-W)*U;M=A+D*y[2]+R*y[1]+b*y[0],f.values[M]=G+(j-G)*P}}}else for(D=0;D<d;++D){var z;if((z=d>1?C*(u-1)+D*I:.5*(C+w)*(u-1))<0||z>u-1)for(A=0;A<c;A++)M=A+D*y[2]+R*y[1]+b*y[0],f.values[M]=o;else{var $=Math.round(z),X=Math.round(O);for(A=0;A<c;A++){var Y=A+$*_[2]+X*_[1]+k*_[0],K=A+D*y[2]+R*y[1]+b*y[0];f.values[K]=v[Y]}}}}}return f.toTensor()},e.prototype.sparseToDense=function(t,e,n,i){var r=ki(0,t,n),o=r.sliceRank,s=r.numUpdates,a=r.sliceSize,l=r.strides,u=r.outputSize;return this.scatter(t,e,n,u,a,s,o,l,i,!1)},e.prototype.gatherND=function(t,e){var n=e.shape,i=n[n.length-1],r=Ti(t,e),o=r[0],s=r[1],a=r[2],l=r[3];if(0===s)return pn([],o,t.dtype);for(var u=new mt([s,a],t.dtype),c=this.readSync(e.dataId),h=this.readSync(t.dataId),p=0;p<s;p++){for(var d=[],f=0,g=0;g<i;g++){var m=c[p*i+g];f+=m*l[g],d.push(m)}if(f<0||f>=t.size/a)throw new Error("Invalid indices: "+d+" does not index into "+t.shape);for(var v=0;v<a;v++)u.values[p*a+v]=h[f*a+v]}return u.toTensor().reshape(o)},e.prototype.scatterND=function(t,e,n){var i=ki(0,t,n),r=i.sliceRank,o=i.numUpdates,s=i.sliceSize,a=i.strides,l=i.outputSize,u=fn(0);return this.scatter(t,e,n,l,s,o,r,a,u,!0)},e.prototype.fill=function(t,e,n){var i=F(n=n||Y(e),x(t));return i.fill(e),Pt.makeTensor(i,t,n,this)},e.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported for string tensors");return this.fill(t.shape,1,t.dtype)},e.prototype.zerosLike=function(t){var e=F(t.dtype,x(t.shape));return this.makeOutput(e,t.shape,t.dtype)},e.prototype.linspace=function(t,e,n){return ir(t,e,n)},e.prototype.scatter=function(t,e,n,i,r,o,s,a,l,u){var c=[i/r,r],h=this.readSync(t.dataId),p=this.readSync(e.dataId);if(0===i)return pn([],n,e.dtype);var d=new mt(c,e.dtype);d.values.fill(this.readSync(l.dataId)[0]);for(var f=0;f<o;f++){for(var g=[],m=0,v=0;v<s;v++){var _=h[f*s+v];g.push(_),m+=_*a[v]}if(m<0||m>=i/r)throw new Error("Invalid indices: "+g+" does not index into "+n);for(var y=0;y<r;y++)u?d.values[m*r+y]+=p[f*r+y]:d.values[m*r+y]=0===e.rank?p[0]:p[f*r+y]}return d.toTensor().reshape(n)},e}(Fi);Pt.registerBackend("cpu",function(){return new ju},1);for(var zu=0,$u=[{kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=t.attrs,r=e,o=r.boxes,s=r.scores,a=i,l=a.maxOutputSize,u=a.iouThreshold,c=a.scoreThreshold,h=a.softNmsSigma,p=n;Wu(o,"NonMaxSuppressionWithScore");var d=hr(p.data.get(o.dataId).values,p.data.get(s.dataId).values,l,u,c,h);return[d.selectedIndices,d.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=e.x,r=n;Wu(i,"square");for(var o=r.data.get(i.dataId).values,s=new Float32Array(o.length),a=0;a<o.length;++a){var l=o[a];s[a]=l*l}return{dataId:r.write(s,i.shape,i.dtype),shape:i.shape,dtype:i.dtype}}},{kernelName:is,backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=e,r=i.a,o=i.b,s=n;Wu([r,o],is);var a=s.data.get(r.dataId).values,l=s.data.get(o.dataId).values,u=function(t,e,n,i,r,o){var s=Wi(t,e),a=s.length,l=q(s),u=B(r,x(s)),c=t.length,h=e.length,p=q(t),d=q(e),f=Vi(t,s),g=Vi(e,s);if(f.length+g.length===0)for(var m=0;m<u.length;++m)u[m]=o(n[m%n.length],i[m%i.length]);else{var v=function(t){var e=at(t,a,l),r=e.slice(-c);f.forEach(function(t){return r[t]=0});var s=st(r,c,p),m=e.slice(-h);g.forEach(function(t){return m[t]=0});var v=st(m,h,d);u[t]=o(n[s],i[v])};for(m=0;m<u.length;++m)v(m)}return[u,s]}(r.shape,o.shape,a,l,r.dtype,function(t,e){var n=t-e;return n*n}),c=u[0],h=u[1];return{dataId:s.write(c,h,r.dtype),shape:h,dtype:r.dtype}}}];zu<$u.length;zu++)m($u[zu]);for(var Xu,Yu=0,Ku=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=t.attrs,r=e.pixels,o=i.numChannels,s="undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement,a="undefined"!=typeof HTMLImageElement&&r instanceof HTMLImageElement,l=s?[r.videoWidth,r.videoHeight]:[r.width,r.height],u=l[0],h=l[1],p=[h,u],d=[h,u,o];(a||s)&&(null==Xu&&(Xu=document.createElement("canvas").getContext("2d")),Xu.canvas.width=u,Xu.canvas.height=h,Xu.drawImage(r,0,0,u,h),r=Xu.canvas);var f=n.makeTensorInfo(p,"int32");n.texData.get(f.dataId).usage=Vt.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(f.dataId),r);var g=c().getBool("WEBGL_PACK")?new function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var e=Er(),n=t[0],i=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+i+".0, "+n+".0);\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n "+e.output+" = result;\n }\n "}(d):new function(t){this.variableNames=["A"];var e=Er(),n=t[0],i=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+i+".0, "+n+".0);\n\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n "}(d),m=n.runWebGLProgram(g,[f],"int32");return n.disposeData(f.dataId),m}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=t.attrs;$e("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var r=e,o=r.boxes,s=r.scores,a=i,l=a.maxOutputSize,u=a.iouThreshold,c=a.scoreThreshold,h=a.softNmsSigma,p=n,d=hr(p.readSync(o.dataId),p.readSync(s.dataId),l,u,c,h);return[d.selectedIndices,d.selectedScores]}},{kernelName:"Square",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=e.x,r=n,o=new No(i.shape,"return x * x;");return r.runWebGLProgram(o,[i],i.dtype)}},{kernelName:is,backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,i=e,r=i.a,o=i.b,s=n,a=c().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Gr("return (a - b) * (a - b);",r.shape,o.shape):new Hr("return (a - b) * (a - b);",r.shape,o.shape);return s.compileAndRun(a,[r,o])}}];Yu<Ku.length;Yu++)m(Ku[Yu]);for(var Ju=0,qu=[{kernelName:"Square",gradFunc:function(t,e){var n=e[0];return{x:function(){return t.mul(n.toFloat().mul(2))}}}},{kernelName:is,gradFunc:function(t,e){var n=e[0],i=e[1],r=fn(2);return{a:function(){return ya(t,ya(r,Sa(n,i)))},b:function(){return ya(t,ya(r,Sa(i,n)))}}}}];Ju<qu.length;Ju++)v(qu[Ju]);var Zu=function(){function t(){}return t.prototype.fetch=function(t,e){return fetch(t,e)},t.prototype.now=function(){return performance.now()},t.prototype.encode=function(t,e){if("utf-8"!==e&&"utf8"!==e)throw new Error("Browser's encoder only supports utf-8, but got "+e);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(t)},t.prototype.decode=function(t,e){return new TextDecoder(e).decode(t)},t}();c().get("IS_BROWSER")&&c().setPlatform("browser",new Zu);var Qu,tc=function(){function t(){this.util=n(2),this.textEncoder=new this.util.TextEncoder}return t.prototype.fetch=function(t,e){return null!=c().global.fetch?c().global.fetch(t,e):(null==Qu&&(Qu=n(1)),Qu(t,e))},t.prototype.now=function(){var t=i.hrtime();return 1e3*t[0]+t[1]/1e6},t.prototype.encode=function(t,e){if("utf-8"!==e&&"utf8"!==e)throw new Error("Node built-in encoder only supports utf-8, but got "+e);return this.textEncoder.encode(t)},t.prototype.decode=function(t,e){return 0===t.length?"":new this.util.TextDecoder(e).decode(t)},t}();c().get("IS_NODE")&&c().setPlatform("node",new tc);var ec={float32:4,int32:4,uint16:2,uint8:1,bool:1},nc=4;function ic(t,e){for(var n={},i=0,r=function(e){var r=e.name,o=e.dtype,s=e.shape,a=x(s),l=void 0;if("quantization"in e){var u=e.quantization;if("uint8"!==u.dtype&&"uint16"!==u.dtype)throw new Error("Weight "+e.name+" has unknown quantization dtype "+u.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var c=ec[u.dtype],h=t.slice(i,i+a*c),p="uint8"===u.dtype?new Uint8Array(h):new Uint16Array(h);if("float32"===o)l=Float32Array.from(p,function(t){return t*u.scale+u.min});else{if("int32"!==o)throw new Error("Unsupported dtype in weight '"+r+"': "+o);l=Int32Array.from(p,function(t){return Math.round(t*u.scale+u.min)})}i+=a*c}else if("string"===o){var d=x(e.shape);l=[];for(var f=0;f<d;f++){var g=new Uint32Array(t.slice(i,i+nc))[0];i+=nc;var m=new Uint8Array(t.slice(i,i+g));l.push(m),i+=g}}else{var v=ec[o];if(h=t.slice(i,i+a*v),"float32"===o)l=new Float32Array(h);else if("int32"===o)l=new Int32Array(h);else{if("bool"!==o)throw new Error("Unsupported dtype in weight '"+r+"': "+o);l=new Uint8Array(h)}i+=a*v}n[r]=pn(l,s,o)},o=0,s=e;o<s.length;o++)r(s[o]);return n}var rc=void 0!==r&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function oc(t){return rc?r.byteLength(t):new Blob([t]).size}function sc(t){var e=0;t.forEach(function(t){e+=t.byteLength});var n=new Uint8Array(e),i=0;return t.forEach(function(t){n.set(new Uint8Array(t),i),i+=t.byteLength}),n.buffer}function ac(t){for(t=t.trim();t.endsWith("/");)t=t.slice(0,t.length-1);var e=t.split("/");return e[e.length-1]}function lc(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==t.modelTopology?0:oc(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:oc(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}var uc=function(){function t(){this.saveRouters=[],this.loadRouters=[]}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerSaveRouter=function(e){t.getInstance().saveRouters.push(e)},t.registerLoadRouter=function(e){t.getInstance().loadRouters.push(e)},t.getSaveHandlers=function(e){return t.getHandlers(e,"save")},t.getLoadHandlers=function(e,n){return t.getHandlers(e,"load",n)},t.getHandlers=function(e,n,i){var r=[];return("load"===n?t.getInstance().loadRouters:t.getInstance().saveRouters).forEach(function(t){var n=t(e,i);null!==n&&r.push(n)}),r},t}(),cc="://",hc=function(){function t(){this.managers={}}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerManager=function(e,n){C(null!=e,function(){return"scheme must not be undefined or null."}),e.endsWith(cc)&&(e=e.slice(0,e.indexOf(cc))),C(e.length>0,function(){return"scheme must not be an empty string."});var i=t.getInstance();C(null==i.managers[e],function(){return"A model store manager is already registered for scheme '"+e+"'."}),i.managers[e]=n},t.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error("Cannot find model manager for scheme '"+t+"'");return e},t.getSchemes=function(){return Object.keys(this.getInstance().managers)},t}();function pc(t){if(-1===t.indexOf(cc))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+hc.getSchemes().join(","));return{scheme:t.split(cc)[0],path:t.split(cc)[1]}}function dc(t,e,n){return void 0===n&&(n=!1),a(this,void 0,void 0,function(){var i,r,o,s,a,u,c,h,p;return l(this,function(l){switch(l.label){case 0:return C(t!==e,function(){return"Old path and new path are the same: '"+t+"'"}),C((i=uc.getLoadHandlers(t)).length>0,function(){return"Copying failed because no load handler is found for source URL "+t+"."}),C(i.length<2,function(){return"Copying failed because more than one ("+i.length+") load handlers for source URL "+t+"."}),r=i[0],C((o=uc.getSaveHandlers(e)).length>0,function(){return"Copying failed because no save handler is found for destination URL "+e+"."}),C(o.length<2,function(){return"Copying failed because more than one ("+i.length+") save handlers for destination URL "+e+"."}),s=o[0],a=pc(t).scheme,u=pc(t).path,c=a===pc(t).scheme,[4,r.load()];case 1:return h=l.sent(),n&&c?[4,hc.getManager(a).removeModel(u)]:[3,3];case 2:l.sent(),l.label=3;case 3:return[4,s.save(h)];case 4:return p=l.sent(),!n||c?[3,6]:[4,hc.getManager(a).removeModel(u)];case 5:l.sent(),l.label=6;case 6:return[2,p.modelArtifactsInfo]}})})}var fc="models_store",gc="model_info_store";function mc(){if(!c().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var t=window||self,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function vc(t){var e=t.result;e.createObjectStore(fc,{keyPath:"modelPath"}),e.createObjectStore(gc,{keyPath:"modelPath"})}var _c=function(){function t(t){if(this.indexedDB=mc(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}return t.prototype.save=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,t)]})})},t.prototype.load=function(){return a(this,void 0,void 0,function(){return l(this,function(t){return[2,this.databaseAction(this.modelPath)]})})},t.prototype.databaseAction=function(t,e){var n=this;return new Promise(function(t,i){var r=n.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return vc(r)},r.onsuccess=function(){var o=r.result;if(null==e){var s=o.transaction(fc,"readonly"),a=s.objectStore(fc).get(n.modelPath);a.onsuccess=function(){if(null==a.result)return o.close(),i(new Error("Cannot find model with path '"+n.modelPath+"' in IndexedDB."));t(a.result.modelArtifacts)},a.onerror=function(t){return o.close(),i(a.error)},s.oncomplete=function(){return o.close()}}else{var l,u=lc(e),c=o.transaction(gc,"readwrite"),h=c.objectStore(gc),p=h.put({modelPath:n.modelPath,modelArtifactsInfo:u});p.onsuccess=function(){var r=(l=o.transaction(fc,"readwrite")).objectStore(fc).put({modelPath:n.modelPath,modelArtifacts:e,modelArtifactsInfo:u});r.onsuccess=function(){return t({modelArtifactsInfo:u})},r.onerror=function(t){var e=(h=c.objectStore(gc)).delete(n.modelPath);e.onsuccess=function(){return o.close(),i(r.error)},e.onerror=function(t){return o.close(),i(r.error)}}},p.onerror=function(t){return o.close(),i(p.error)},c.oncomplete=function(){null==l?o.close():l.oncomplete=function(){return o.close()}}}},r.onerror=function(t){return i(r.error)}})},t.URL_SCHEME="indexeddb://",t}(),yc=function(t){return c().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(_c.URL_SCHEME)?(e=t.slice(_c.URL_SCHEME.length),new _c(e)):null;var e};uc.registerSaveRouter(yc),uc.registerLoadRouter(yc);var bc=function(){function t(){this.indexedDB=mc()}return t.prototype.listModels=function(){return a(this,void 0,void 0,function(){var t=this;return l(this,function(e){return[2,new Promise(function(e,n){var i=t.indexedDB.open("tensorflowjs",1);i.onupgradeneeded=function(){return vc(i)},i.onsuccess=function(){var t=i.result,r=t.transaction(gc,"readonly"),o=r.objectStore(gc).getAll();o.onsuccess=function(){for(var t={},n=0,i=o.result;n<i.length;n++){var r=i[n];t[r.modelPath]=r.modelArtifactsInfo}e(t)},o.onerror=function(e){return t.close(),n(o.error)},r.oncomplete=function(){return t.close()}},i.onerror=function(t){return n(i.error)}})]})})},t.prototype.removeModel=function(t){return a(this,void 0,void 0,function(){var e=this;return l(this,function(n){var i;return t=(i=t).startsWith(_c.URL_SCHEME)?i.slice(_c.URL_SCHEME.length):i,[2,new Promise(function(n,i){var r=e.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return vc(r)},r.onsuccess=function(){var e,o=r.result,s=o.transaction(gc,"readwrite"),a=s.objectStore(gc),l=a.get(t);l.onsuccess=function(){if(null==l.result)return o.close(),i(new Error("Cannot find model with path '"+t+"' in IndexedDB."));var r=a.delete(t),s=function(){var r=(e=o.transaction(fc,"readwrite")).objectStore(fc).delete(t);r.onsuccess=function(){return n(l.result.modelArtifactsInfo)},r.onerror=function(t){return i(l.error)}};r.onsuccess=s,r.onerror=function(t){return s(),o.close(),i(l.error)}},l.onerror=function(t){return o.close(),i(l.error)},s.oncomplete=function(){null==e?o.close():e.oncomplete=function(){return o.close()}}},r.onerror=function(t){return i(r.error)}})]})})},t}();if(c().getBool("IS_BROWSER"))try{hc.registerManager(_c.URL_SCHEME,new bc)}catch(o){}var Tc="/",Ec="tensorflowjs_models",Cc="info",Sc="model_topology",wc="weight_specs",kc="weight_data",xc="model_metadata";function Ic(t){return{info:[Ec,t,Cc].join(Tc),topology:[Ec,t,Sc].join(Tc),weightSpecs:[Ec,t,wc].join(Tc),weightData:[Ec,t,kc].join(Tc),modelMetadata:[Ec,t,xc].join(Tc)}}function Rc(t){var e=t.split(Tc);if(e.length<3)throw new Error("Invalid key format: "+t);return e.slice(1,e.length-1).join(Tc)}var Oc=function(){function t(t){if(!c().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=Ic(this.modelPath)}return t.prototype.save=function(t){return a(this,void 0,void 0,function(){var e,n,i;return l(this,function(o){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),i=lc(t);try{return this.LS.setItem(this.keys.info,JSON.stringify(i)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,function(t){if(rc)return r.from(t).toString("base64");for(var e=new Uint8Array(t),n="",i=0,o=e.length;i<o;i++)n+=String.fromCharCode(e[i]);return btoa(n)}(t.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata})),[2,{modelArtifactsInfo:i}]}catch(t){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),new Error("Failed to save model '"+this.modelPath+"' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes="+i.modelTopologyBytes+", weightSpecsBytes="+i.weightSpecsBytes+", weightDataBytes="+i.weightDataBytes+".")}return[2]})})},t.prototype.load=function(){return a(this,void 0,void 0,function(){var t,e,n,i,o,s,a;return l(this,function(l){if(null==(t=JSON.parse(this.LS.getItem(this.keys.info))))throw new Error("In local storage, there is no model with name '"+this.modelPath+"'");if("JSON"!==t.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");if(e={},null==(n=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(e.modelTopology=n,null==(i=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(e.weightSpecs=i,null!=(o=this.LS.getItem(this.keys.modelMetadata))&&(s=JSON.parse(o),e.format=s.format,e.generatedBy=s.generatedBy,e.convertedBy=s.convertedBy,e.userDefinedMetadata=s.userDefinedMetadata),null==(a=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return e.weightData=function(t){if(rc){var e=r.from(t,"base64");return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}for(var n=atob(t),i=new Uint8Array(n.length),o=0;o<n.length;++o)i.set([n.charCodeAt(o)],o);return i.buffer}(a),[2,e]})})},t.URL_SCHEME="localstorage://",t}(),Dc=function(t){return c().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Oc.URL_SCHEME)?(e=t.slice(Oc.URL_SCHEME.length),new Oc(e)):null;var e};uc.registerSaveRouter(Dc),uc.registerLoadRouter(Dc);var Ac=function(){function t(){C(c().getBool("IS_BROWSER"),function(){return"Current environment is not a web browser"}),C("undefined"==typeof window||void 0!==window.localStorage,function(){return"Current browser does not appear to support localStorage"}),this.LS=window.localStorage}return t.prototype.listModels=function(){return a(this,void 0,void 0,function(){var t,e,n,i,r,o;return l(this,function(s){for(t={},e=Ec+Tc,n=Tc+Cc,i=0;i<this.LS.length;++i)(r=this.LS.key(i)).startsWith(e)&&r.endsWith(n)&&(o=Rc(r),t[o]=JSON.parse(this.LS.getItem(r)));return[2,t]})})},t.prototype.removeModel=function(t){return a(this,void 0,void 0,function(){var e,n;return l(this,function(i){var r;if(t=(r=t).startsWith(Oc.URL_SCHEME)?r.slice(Oc.URL_SCHEME.length):r,e=Ic(t),null==this.LS.getItem(e.info))throw new Error("Cannot find model at path '"+t+"'");return n=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,n]})})},t}();if(c().getBool("IS_BROWSER"))try{hc.registerManager(Oc.URL_SCHEME,new Ac)}catch(o){}var Mc="model",Nc=".json",Lc=".weights.bin";function Pc(t){return new Promise(function(t){return setTimeout(t)}).then(t)}var Bc=function(){function t(e){if(!c().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(t.URL_SCHEME)&&(e=e.slice(t.URL_SCHEME.length)),null!=e&&0!==e.length||(e=Mc),this.modelTopologyFileName=e+Nc,this.weightDataFileName=e+Lc}return t.prototype.save=function(t){return a(this,void 0,void 0,function(){var e,n,i,r,o,s;return l(this,function(a){switch(a.label){case 0:if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(e=window.URL.createObjectURL(new Blob([t.weightData],{type:"application/octet-stream"})),!(t.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],i={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},r=window.URL.createObjectURL(new Blob([JSON.stringify(i)],{type:"application/json"})),(o=null==this.jsonAnchor?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,o.href=r,[4,Pc(function(){return o.dispatchEvent(new MouseEvent("click"))})];case 2:return a.sent(),null==t.weightData?[3,4]:((s=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,s.href=e,[4,Pc(function(){return s.dispatchEvent(new MouseEvent("click"))})]);case 3:a.sent(),a.label=4;case 4:return[2,{modelArtifactsInfo:lc(t)}]}})})},t.URL_SCHEME="downloads://",t}(),Fc=function(){function t(t){if(null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+t);this.files=t}return t.prototype.load=function(){return a(this,void 0,void 0,function(){var t,e,n=this;return l(this,function(i){return t=this.files[0],e=this.files.slice(1),[2,new Promise(function(i,r){var o=new FileReader;o.onload=function(o){var s=JSON.parse(o.target.result),a=s.modelTopology;if(null!=a){0===e.length&&i({modelTopology:a});var l=s.weightsManifest;if(null!=l){var u;try{u=n.checkManifestAndWeightFiles(l,e)}catch(t){return void r(t)}var c=[],h=[],p=[];l.forEach(function(t){t.paths.forEach(function(t){h.push(t),p.push(null)}),c.push.apply(c,t.weights)}),l.forEach(function(t){t.paths.forEach(function(t){var e=new FileReader;e.onload=function(e){var n=e.target.result,r=h.indexOf(t);p[r]=n,-1===p.indexOf(null)&&i({modelTopology:a,weightSpecs:c,weightData:sc(p),format:s.format,generatedBy:s.generatedBy,convertedBy:s.convertedBy,userDefinedMetadata:s.userDefinedMetadata})},e.onerror=function(e){return r("Failed to weights data from file of path '"+t+"'.")},e.readAsArrayBuffer(u[t])})})}else r(new Error("weightManifest field is missing from file "+t.name))}else r(new Error("modelTopology field is missing from file "+t.name))},o.onerror=function(e){return r("Failed to read model topology and weights manifest JSON from file '"+t.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},o.readAsText(t)})]})})},t.prototype.checkManifestAndWeightFiles=function(t,e){for(var n=[],i=e.map(function(t){return ac(t.name)}),r={},o=0,s=t;o<s.length;o++)s[o].paths.forEach(function(t){var o=ac(t);if(-1!==n.indexOf(o))throw new Error("Duplicate file basename found in weights manifest: '"+o+"'");if(n.push(o),-1===i.indexOf(o))throw new Error("Weight file with basename '"+o+"' is not provided.");r[t]=e[i.indexOf(o)]});if(n.length!==e.length)throw new Error("Mismatch in the number of files in weights manifest ("+n.length+") and the number of weight files provided ("+e.length+").");return r},t}();function Uc(t,e,n,i){!function(t){C(null!=t&&Array.isArray(t)&&t.length>0,function(){return"promises must be a none empty array"})}(t),function(t,e){C(t>=0&&t<=1,function(){return"Progress fraction must be in range [0, 1], but got startFraction "+t}),C(e>=0&&e<=1,function(){return"Progress fraction must be in range [0, 1], but got endFraction "+e}),C(e>=t,function(){return"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e})}(n=null==n?0:n,i=null==i?1:i);var r=0;return Promise.all(t.map(function(o){return o.then(function(o){var s=n+ ++r/t.length*(i-n);return e(s),o}),o}))}function Vc(t,e){return a(this,void 0,void 0,function(){var n,i,r,o,s,a,u,h,p;return l(this,function(l){switch(l.label){case 0:return null==e&&(e={}),n=null==e.fetchFunc?c().platform.fetch:e.fetchFunc,i=t.map(function(t){return n(t,e.requestInit,{isBinary:!0})}),r=0,o=.5,null!=e.onProgress?[3,2]:[4,Promise.all(i)];case 1:return s=l.sent(),[3,4];case 2:return[4,Uc(i,e.onProgress,r,o)];case 3:s=l.sent(),l.label=4;case 4:return a=s.map(function(t){return t.arrayBuffer()}),u=.5,h=1,null!=e.onProgress?[3,6]:[4,Promise.all(a)];case 5:return p=l.sent(),[3,8];case 6:return[4,Uc(a,e.onProgress,u,h)];case 7:p=l.sent(),l.label=8;case 8:return[2,p]}})})}function Hc(t){var e=this;return function(n,i,r){return void 0===i&&(i=""),a(e,void 0,void 0,function(){var e,o,s,a,u,c,h,p,d,f;return l(this,function(l){switch(l.label){case 0:if(e=n.map(function(){return!1}),o={},s=null!=r?r.map(function(){return!1}):[],a=[],n.forEach(function(t,n){var i=0;t.weights.forEach(function(t){var l="quantization"in t?t.quantization.dtype:t.dtype,u=ec[l]*x(t.shape),c=function(){e[n]=!0,null==o[n]&&(o[n]=[]),o[n].push({manifestEntry:t,groupOffset:i,sizeBytes:u})};null!=r?r.forEach(function(e,n){e===t.name&&(c(),s[n]=!0)}):c(),a.push(t.name),i+=u})}),!s.every(function(t){return t}))throw u=r.filter(function(t,e){return!s[e]}),new Error("Could not find weights in manifest with names: "+u.join(", ")+". \nManifest JSON has weights with names: "+a.join(", ")+".");return c=e.reduce(function(t,e,n){return e&&t.push(n),t},[]),h=[],c.forEach(function(t){n[t].paths.forEach(function(t){var e=i+(i.endsWith("/")?"":"/")+t;h.push(e)})}),[4,t(h)];case 1:return p=l.sent(),d={},f=0,c.forEach(function(t){for(var e=n[t].paths.length,i=0,r=0;r<e;r++)i+=p[f+r].byteLength;for(var s=new ArrayBuffer(i),a=new Uint8Array(s),l=0,u=0;u<e;u++){var c=new Uint8Array(p[f+u]);a.set(c,l),l+=c.byteLength}o[t].forEach(function(t){var e=ic(s.slice(t.groupOffset,t.groupOffset+t.sizeBytes),[t.manifestEntry]);for(var n in e)d[n]=e[n]}),f+=e}),[2,d]}})})}}uc.registerSaveRouter(function(t){return c().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Bc.URL_SCHEME)?function(t){return void 0===t&&(t="model"),new Bc(t)}(t.slice(Bc.URL_SCHEME.length)):null});var Wc=function(){function t(t,e){if(this.DEFAULT_METHOD="POST",null==e&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,null!=e.fetchFunc?(C("function"==typeof e.fetchFunc,function(){return"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"}),this.fetch=e.fetchFunc):this.fetch=c().platform.fetch,C(null!=t&&t.length>0,function(){return"URL path for http must not be null, undefined or empty."}),Array.isArray(t)&&C(2===t.length,function(){return"URL paths for http must have a length of 2, (actual length is "+t.length+")."}),this.path=t,null!=e.requestInit&&null!=e.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}return t.prototype.save=function(t){return a(this,void 0,void 0,function(){var e,n,i,r;return l(this,function(o){switch(o.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],i={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata,weightsManifest:n},e.body.append("model.json",new Blob([JSON.stringify(i)],{type:"application/json"}),"model.json"),null!=t.weightData&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((r=o.sent()).ok)return[2,{modelArtifactsInfo:lc(t),responses:[r]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+r.status+".")}})})},t.prototype.load=function(){return a(this,void 0,void 0,function(){var t,e,n,i,r,o,s,a,u,c,h,p;return l(this,function(l){switch(l.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(t=l.sent()).ok)throw new Error("Request to "+this.path+" failed with status code "+t.status+". Please verify this URL points to the model JSON of the model to load.");l.label=2;case 2:return l.trys.push([2,4,,5]),[4,t.json()];case 3:return e=l.sent(),[3,5];case 4:throw l.sent(),n="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?n+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":n+=" Please make sure the server is serving valid JSON for this request.",new Error(n);case 5:if(i=e.modelTopology,r=e.weightsManifest,o=e.generatedBy,s=e.convertedBy,a=e.format,u=e.userDefinedMetadata,null==i&&null==r)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==r?[3,7]:[4,this.loadWeights(r)];case 6:p=l.sent(),c=p[0],h=p[1],l.label=7;case 7:return[2,{modelTopology:i,weightSpecs:c,weightData:h,userDefinedMetadata:u,generatedBy:o,convertedBy:s,format:a}]}})})},t.prototype.loadWeights=function(t){return a(this,void 0,void 0,function(){var e,n,i,r,o,s,a,u,c,h,p;return l(this,function(l){switch(l.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=function(t){var e=t.lastIndexOf("/"),n=t.lastIndexOf("?");return[t.substring(0,e)+"/",n>e?t.substring(n):""]}(e),i=n[0],r=n[1],o=this.weightPathPrefix||i,s=[],a=0,u=t;a<u.length;a++)c=u[a],s.push.apply(s,c.weights);return h=[],t.forEach(function(t){t.paths.forEach(function(t){h.push(o+t+r)})}),[4,Vc(h,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return p=l.sent(),[2,[s,sc(p)]]}})})},t.URL_SCHEME_REGEX=/^https?:\/\//,t}();function Gc(t){return null!=t.match(Wc.URL_SCHEME_REGEX)}var jc=function(t,e){return"undefined"==typeof fetch?null:(Array.isArray(t)?t.every(function(t){return Gc(t)}):Gc(t))?zc(t,{onProgress:e}):null};function zc(t,e){return new Wc(t,e)}uc.registerSaveRouter(jc),uc.registerLoadRouter(jc);var $c,Xc=function(){function t(t){this.modelArtifacts=t}return t.prototype.load=function(){return a(this,void 0,void 0,function(){return l(this,function(t){return[2,this.modelArtifacts]})})},t}(),Yc=function(){function t(t){this.saveHandler=t}return t.prototype.save=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){return[2,this.saveHandler(t)]})})},t}(),Kc=Object.freeze({browserFiles:function(t){return new Fc(t)},browserHTTPRequest:function(t,e){return zc(t,e)},concatenateArrayBuffers:sc,decodeWeights:ic,encodeWeights:function(t,e){return a(this,void 0,void 0,function(){var n,i,r,o,s,u=this;return l(this,function(c){switch(c.label){case 0:for(n=[],i=[],r=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t),o=function(o){var s=r[o],c=Array.isArray(t)?t[o].tensor:t[s];if("float32"!==c.dtype&&"int32"!==c.dtype&&"bool"!==c.dtype&&"string"!==c.dtype)throw new Error("Unsupported dtype in weight '"+s+"': "+c.dtype);var h={name:s,shape:c.shape,dtype:c.dtype};if("string"===c.dtype){var p=new Promise(function(t){return a(u,void 0,void 0,function(){var e,n,i,r,o,s,a;return l(this,function(l){switch(l.label){case 0:return[4,c.bytes()];case 1:for(e=l.sent(),n=e.reduce(function(t,e){return t+e.length},0)+nc*e.length,i=new Uint8Array(n),r=0,o=0;o<e.length;o++)s=e[o],a=new Uint8Array(new Uint32Array([s.length]).buffer),i.set(a,r),r+=nc,i.set(s,r),r+=s.length;return t(i),[2]}})})});i.push(p)}else i.push(c.data());null!=e&&(h.group=e),n.push(h)},s=0;s<r.length;++s)o(s);return[4,Promise.all(i)];case 1:return[2,{data:function(t){if(null===t)throw new Error("Invalid input value: "+JSON.stringify(t));var e=0,n=[];t.forEach(function(t){if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error("Unsupported TypedArray subtype: "+t.constructor.name)});var i=new Uint8Array(e),r=0;return n.forEach(function(t){i.set(new Uint8Array(t.buffer),r),r+=t.byteLength}),i.buffer}(c.sent()),specs:n}]}})})},fromMemory:function(t,e,n,i){return 1===arguments.length?null!=t.modelTopology||null!=t.weightSpecs?new Xc(t):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Xc({modelTopology:t})):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Xc({modelTopology:t,weightSpecs:e,weightData:n,trainingConfig:i}))},getLoadHandlers:function(t,e){return uc.getLoadHandlers(t,e)},getModelArtifactsInfoForJSON:lc,getSaveHandlers:function(t){return uc.getSaveHandlers(t)},http:zc,isHTTPScheme:Gc,loadWeights:function(t,e,n,i){return void 0===e&&(e=""),a(this,void 0,void 0,function(){return l(this,function(r){return[2,Hc(function(t){return Vc(t,{requestInit:i})})(t,e,n)]})})},registerLoadRouter:function(t){return uc.registerLoadRouter(t)},registerSaveRouter:function(t){return uc.registerSaveRouter(t)},weightsLoaderFactory:Hc,withSaveHandler:function(t){return new Yc(t)},copyModel:function(t,e){return a(this,void 0,void 0,function(){return l(this,function(n){return[2,dc(t,e,!1)]})})},listModels:function(){return a(this,void 0,void 0,function(){var t,e,n,i,r,o,s;return l(this,function(a){switch(a.label){case 0:t=hc.getSchemes(),e={},n=0,i=t,a.label=1;case 1:return n<i.length?(r=i[n],[4,hc.getManager(r).listModels()]):[3,4];case 2:for(s in o=a.sent())e[r+cc+s]=o[s];a.label=3;case 3:return n++,[3,1];case 4:return[2,e]}})})},moveModel:function(t,e){return a(this,void 0,void 0,function(){return l(this,function(n){return[2,dc(t,e,!0)]})})},removeModel:function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){return e=pc(t),[2,hc.getManager(e.scheme).removeModel(e.path)]})})}}),Jc=ln({confusionMatrix_:function(t,e,n){var i=Ke(t,"labels","confusionMatrix"),r=Ke(e,"predictions","confusionMatrix");C(null==n||n>0&&Number.isInteger(n),function(){return"If provided, numClasses must be a positive integer, but got "+n}),C(1===i.rank,function(){return"Expected the rank of labels to be 1, but got "+i.rank}),C(1===r.rank,function(){return"Expected the rank of predictions to be 1, but got "+r.rank}),C(i.shape[0]===r.shape[0],function(){return"Mismatch in the number of examples: "+i.shape[0]+" vs. "+r.shape[0]+". Labels and predictions should have the same number of elements."}),C(n>0&&Number.isInteger(n),function(){return"numClasses is required to be a positive integer, but got "+n});var o=Qn(i.asType("int32"),n),s=Qn(r.asType("int32"),n);return o.transpose().matMul(s).asType("int32")}}),qc=(Object.freeze({confusionMatrix:Jc}),ln({fromPixels_:function(t,e){if(void 0===e&&(e=3),e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");var n=!1,i=!1,r=!1,o=!1,s=!1;if(t.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&t instanceof ImageData)i=!0;else if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)r=!0;else if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)o=!0;else{if(null==t.getContext)throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, but was "+t.constructor.name);s=!0}if(r&&r&&t.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(null!=f("FromPixels",Pt.backendName))return Pt.runKernel("FromPixels",{pixels:t},{numChannels:e});var a,l,u=r?[t.videoWidth,t.videoHeight]:[t.width,t.height],c=u[0],h=u[1];if(s?a=t.getContext("2d").getImageData(0,0,c,h).data:i||n?a=t.data:(o||r)&&(null==$c&&($c=document.createElement("canvas").getContext("2d")),$c.canvas.width=c,$c.canvas.height=h,$c.drawImage(t,0,0,c,h),a=$c.getImageData(0,0,c,h).data),4===e)l=new Int32Array(a);else{var p=c*h;l=new Int32Array(p*e);for(var d=0;d<p;d++)for(var g=0;g<e;++g)l[d*e+g]=a[4*d+g]}return vn(l,[h,c,e],"int32")}})),Zc=Object.freeze({toPixels:function(t,e){return a(this,void 0,void 0,function(){var n,i,r,o,s,a,u,c,h,p,d,f,g,m,v,_,y,b,T,E,C,S,w;return l(this,function(l){switch(l.label){case 0:if(n=Ke(t,"img","toPixels"),t instanceof bt||(n=n.toInt()),2!==n.rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+n.rank+".");if(i=n.shape.slice(0,2),r=i[0],o=i[1],(s=2===n.rank?1:n.shape[2])>4||2===s)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+s);return[4,n.data()];case 1:return a=l.sent(),u=n.min(),c=n.max(),[4,Promise.all([u.data(),c.data()])];case 2:if(h=l.sent(),p=h[0],d=h[1],f=p[0],g=d[0],u.dispose(),c.dispose(),"float32"===n.dtype){if(f<0||g>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+f+" - "+g+"].")}else{if("int32"!==n.dtype)throw new Error("Unsupported type for toPixels: "+n.dtype+". Please use float32 or int32 tensors.");if(f<0||g>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+f+" - "+g+"].")}for(m="float32"===n.dtype?255:1,v=new Uint8ClampedArray(o*r*4),_=0;_<r*o;++_)y=void 0,b=void 0,T=void 0,E=void 0,1===s?(y=a[_]*m,b=a[_]*m,T=a[_]*m,E=255):3===s?(y=a[3*_]*m,b=a[3*_+1]*m,T=a[3*_+2]*m,E=255):4===s&&(y=a[4*_]*m,b=a[4*_+1]*m,T=a[4*_+2]*m,E=a[4*_+3]*m),v[0+(C=4*_)]=Math.round(y),v[C+1]=Math.round(b),v[C+2]=Math.round(T),v[C+3]=Math.round(E);return null!=e&&(e.width=o,e.height=r,S=e.getContext("2d"),w=new ImageData(v,o,r),S.putImageData(w,0,0)),n!==t&&n.dispose(),[2,v]}})})},fromPixels:qc}),Qc=function(){function t(){}return t.prototype.getClassName=function(){return this.constructor.className},t.fromConfig=function(t,e){return new t(e)},t}(),th=function(){function t(){this.classNameMap={}}return t.getMap=function(){return null==t.instance&&(t.instance=new t),t.instance},t.register=function(e){t.getMap().classNameMap[e.className]=[e,e.fromConfig]},t}();function eh(t){C(null!=t.className,function(){return"Class being registered does not have the static className property defined."}),C("string"==typeof t.className,function(){return"className is required to be a string, but got type "+typeof t.className}),C(t.className.length>0,function(){return"Class being registered has an empty-string as its className, which is disallowed."}),th.register(t)}Object.freeze({Serializable:Qc,SerializationMap:th,registerClass:eh});var nh=.001,ih=.1;function rh(){return 32===Pt.backend.floatPrecision()?nh:ih}function oh(t,e,n){var i=!0;if((W(t)||W(e))&&(i=!1),W(t)&&W(e)&&(i=!0),i){var r=t.constructor.name,o=e.constructor.name;if(r!==o)throw new Error("Arrays are of different type. Actual: "+r+". Expected: "+o)}if(Array.isArray(t)&&Array.isArray(e)){var s=Xe(t),a=Xe(e);if(!I(s,a))throw new Error("Arrays have different shapes. Actual: ["+s+"]. Expected: ["+a+"]")}var l=W(t)?t:k(t),u=W(e)?e:k(e);if(l.length!==u.length)throw new Error("Arrays have different lengths actual: "+l.length+" vs expected: "+u.length+".\nActual: "+l+".\nExpected: "+u+".");for(var c=0;c<u.length;++c){var h=l[c],p=u[c];if(!n(h,p))throw new Error("Arrays differ: actual["+c+"] = "+h+", expected["+c+"] = "+p+".\nActual: "+l+".\nExpected: "+u+".")}}function sh(t,e,n){return!isFinite(t)&&!isFinite(e)||!(isNaN(t)||isNaN(e)||Math.abs(t-e)>n)}Object.freeze({TEST_EPSILON_FLOAT16:ih,expectArraysClose:function(t,e,n){return null==n&&(n=rh()),oh(t,e,function(t,e){return sh(t,e,n)})},testEpsilon:rh,expectPromiseToFail:function(t,e){t().then(function(){return e.fail()},function(){return e()})},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return z(t)||z(t[0])||z(e)||z(e[0])?oh(t,n,function(t,e){return t==e}):oh(t,e,function(t,e){return sh(t,e,0)})},expectNumbersClose:function(t,e,n){if(null==n&&(n=rh()),!sh(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){for(var i=0;i<t.length;i++)if(t[i]<e||t[i]>n)throw new Error("Value out of range:"+t[i]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}}),Object.freeze({gpgpu_util:_o,webgl_util:He,forceHalfFloat:function(){c().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:es,setWebGLContext:jt,GPGPUContext:yo});var ah=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.minimize=function(t,e,n){void 0===e&&(e=!1);var i=this.computeGradients(t,n),r=i.value,o=i.grads;if(null!=n){var s=n.map(function(t){return{name:t.name,tensor:o[t.name]}});this.applyGradients(s)}else this.applyGradients(o);return ze(o),e?r:(r.dispose(),null)},Object.defineProperty(e.prototype,"iterations",{get:function(){return null==this.iterations_&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),e.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},e.prototype.computeGradients=function(t,e){return function(t,e){C(K(t),function(){return"The f passed in variableGrads(f) must be a function"}),C(null==e||Array.isArray(e)&&e.every(function(t){return t instanceof kt}),function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"});var n=null!=e;if(!n)for(var i in e=[],Pt.registeredVariables)e.push(Pt.registeredVariables[i]);var r=n?e.filter(function(t){return!t.trainable}):null,o=e.length;C((e=e.filter(function(t){return t.trainable})).length>0,function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+o+" variables is trainable."});var s=Pt.gradients(t,e,null,!0),a=s.value,l=s.grads;C(l.some(function(t){return null!=t}),function(){return"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."}),C(0===a.rank,function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+a.rank+" tensor"});var u={};return e.forEach(function(t,e){null!=l[e]&&(u[t.name]=l[e])}),null!=r&&r.forEach(function(t){return u[t.name]=null}),{value:a,grads:u}}(t,e)},e.prototype.dispose=function(){null!=this.iterations_&&ze(this.iterations_)},e.prototype.saveIterations=function(){return a(this,void 0,void 0,function(){return l(this,function(t){return null==this.iterations_&&(this.iterations_=0),[2,{name:"iter",tensor:fn(this.iterations_,"int32")}]})})},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){return l(this,function(t){throw new Error("getWeights() is not implemented for this optimizer yet.")})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){return l(this,function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())})})},e.prototype.extractIterations=function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return e=this,[4,t[0].tensor.data()];case 1:return e.iterations_=n.sent()[0],[2,t.slice(1)]}})})},e}(Qc);Object.defineProperty(ah,Symbol.hasInstance,{value:function(t){return null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}});var lh=function(t){function e(e,n,i){void 0===i&&(i=null);var r=t.call(this)||this;return r.learningRate=e,r.rho=n,r.epsilon=i,r.accumulatedGrads=[],r.accumulatedUpdates=[],null==i&&(r.epsilon=Pt.backend.epsilon()),r}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,i){var r=Pt.registeredVariables[n];null==e.accumulatedGrads[i]&&(e.accumulatedGrads[i]={originalName:n+"/accum_grad",variable:je(function(){return Sn(r).variable(!1)})}),null==e.accumulatedUpdates[i]&&(e.accumulatedUpdates[i]={originalName:n+"/accum_var",variable:je(function(){return Sn(r).variable(!1)})});var o=Array.isArray(t)?t[i].tensor:t[n];if(null!=o){var s=e.accumulatedGrads[i].variable,a=e.accumulatedUpdates[i].variable;je(function(){var t=s.mul(e.rho).add(o.square().mul(1-e.rho)),n=a.add(e.epsilon).sqrt().div(s.add(e.epsilon).sqrt()).mul(o),i=a.mul(e.rho).add(n.square().mul(1-e.rho));s.assign(t),a.assign(i);var l=n.mul(-e.learningRate).add(r);r.assign(l)})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedUpdates&&(ze(this.accumulatedGrads.map(function(t){return t.variable})),ze(this.accumulatedUpdates.map(function(t){return t.variable})))},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=t.length/2,this.accumulatedGrads=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedUpdates=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},e.className="Adadelta",e}(ah);eh(lh);var uh=function(t){function e(e,n){void 0===n&&(n=.1);var i=t.call(this)||this;return i.learningRate=e,i.initialAccumulatorValue=n,i.accumulatedGrads=[],i}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,i){var r=Pt.registeredVariables[n];null==e.accumulatedGrads[i]&&(e.accumulatedGrads[i]={originalName:n+"/accumulator",variable:je(function(){return Tn(r.shape,e.initialAccumulatorValue).variable(!1)})});var o=Array.isArray(t)?t[i].tensor:t[n];if(null!=o){var s=e.accumulatedGrads[i].variable;je(function(){var t=s.add(o.square());s.assign(t);var n=o.div(t.add(Pt.backend.epsilon()).sqrt()).mul(-e.learningRate).add(r);r.assign(n)})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedGrads&&ze(this.accumulatedGrads.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulatedGrads.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulatedGrads=t.map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},e.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},e.className="Adagrad",e}(ah);eh(uh);var ch=function(t){function e(e,n,i,r){void 0===r&&(r=null);var o=t.call(this)||this;return o.learningRate=e,o.beta1=n,o.beta2=i,o.epsilon=r,o.accumulatedFirstMoment=[],o.accumulatedSecondMoment=[],je(function(){o.accBeta1=fn(n).variable(),o.accBeta2=fn(i).variable()}),null==r&&(o.epsilon=Pt.backend.epsilon()),o}return s(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t);je(function(){var i=Sa(1,e.accBeta1),r=Sa(1,e.accBeta2);n.forEach(function(n,o){var s=Pt.registeredVariables[n];null==e.accumulatedFirstMoment[o]&&(e.accumulatedFirstMoment[o]={originalName:n+"/m",variable:je(function(){return Sn(s).variable(!1)})}),null==e.accumulatedSecondMoment[o]&&(e.accumulatedSecondMoment[o]={originalName:n+"/v",variable:je(function(){return Sn(s).variable(!1)})});var a=Array.isArray(t)?t[o].tensor:t[n];if(null!=a){var l=e.accumulatedFirstMoment[o].variable,u=e.accumulatedSecondMoment[o].variable,c=l.mul(e.beta1).add(a.mul(1-e.beta1)),h=u.mul(e.beta2).add(a.square().mul(1-e.beta2)),p=c.div(i),d=h.div(r);l.assign(c),u.assign(h);var f=p.div(d.sqrt().add(e.epsilon)).mul(-e.learningRate).add(s);s.assign(f)}}),e.accBeta1.assign(e.accBeta1.mul(e.beta1)),e.accBeta2.assign(e.accBeta2.mul(e.beta2))}),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&ze(this.accumulatedFirstMoment.map(function(t){return t.variable})),null!=this.accumulatedSecondMoment&&ze(this.accumulatedSecondMoment.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){var e,n=this;return l(this,function(i){switch(i.label){case 0:return[4,this.extractIterations(t)];case 1:return t=i.sent(),je(function(){n.accBeta1.assign(Ta(n.beta1,n.iterations_+1)),n.accBeta2.assign(Ta(n.beta2,n.iterations_+1))}),e=t.length/2,this.accumulatedFirstMoment=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedSecondMoment=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},e.className="Adam",e}(ah);eh(ch);var hh=function(t){function e(e,n,i,r,o){void 0===r&&(r=null),void 0===o&&(o=0);var s=t.call(this)||this;return s.learningRate=e,s.beta1=n,s.beta2=i,s.epsilon=r,s.decay=o,s.accumulatedFirstMoment=[],s.accumulatedWeightedInfNorm=[],je(function(){s.iteration=fn(0).variable(),s.accBeta1=fn(n).variable()}),null==r&&(s.epsilon=Pt.backend.epsilon()),s}return s(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t);je(function(){var i=Sa(1,e.accBeta1),r=ua(-e.learningRate,e.iteration.mul(e.decay).add(1));n.forEach(function(n,o){var s=Pt.registeredVariables[n];null==e.accumulatedFirstMoment[o]&&(e.accumulatedFirstMoment[o]={originalName:n+"/m",variable:Sn(s).variable(!1)}),null==e.accumulatedWeightedInfNorm[o]&&(e.accumulatedWeightedInfNorm[o]={originalName:n+"/v",variable:Sn(s).variable(!1)});var a=Array.isArray(t)?t[o].tensor:t[n];if(null!=a){var l=e.accumulatedFirstMoment[o].variable,u=e.accumulatedWeightedInfNorm[o].variable,c=l.mul(e.beta1).add(a.mul(1-e.beta1)),h=u.mul(e.beta2),p=a.abs(),d=h.maximum(p);l.assign(c),u.assign(d);var f=r.div(i).mul(c.div(d.add(e.epsilon))).add(s);s.assign(f)}}),e.iteration.assign(e.iteration.add(1)),e.accBeta1.assign(e.accBeta1.mul(e.beta1))}),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&ze(this.accumulatedFirstMoment.map(function(t){return t.variable})),null!=this.accumulatedWeightedInfNorm&&ze(this.accumulatedWeightedInfNorm.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){return l(this,function(t){throw new Error("getWeights() is not implemented for Adamax yet.")})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){return l(this,function(t){throw new Error("setWeights() is not implemented for Adamax yet.")})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},e.className="Adamax",e}(ah);eh(hh);var ph=function(t){function e(e){var n=t.call(this)||this;return n.learningRate=e,n.setLearningRate(e),n}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,i){var r=Array.isArray(t)?t[i].tensor:t[n];if(null!=r){var o=Pt.registeredVariables[n];je(function(){var t=e.c.mul(r).add(o);o.assign(t)})}}),this.incrementIterations()},e.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=function(t){return Pt.keep(t)}(fn(-t))},e.prototype.dispose=function(){this.c.dispose()},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()]]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:if(0!==(t=e.sent()).length)throw new Error("SGD optimizer does not have settable weights.");return[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate}},e.fromConfig=function(t,e){return new t(e.learningRate)},e.className="SGD",e}(ah);eh(ph);var dh=function(t){function e(e,n,i){void 0===i&&(i=!1);var r=t.call(this,e)||this;return r.learningRate=e,r.momentum=n,r.useNesterov=i,r.accumulations=[],r.m=fn(r.momentum),r}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,i){var r=Pt.registeredVariables[n];null==e.accumulations[i]&&(e.accumulations[i]={originalName:n+"/momentum",variable:je(function(){return Sn(r).variable(!1)})});var o=e.accumulations[i].variable,s=Array.isArray(t)?t[i].tensor:t[n];null!=s&&je(function(){var t,n=e.m.mul(o).add(s);t=e.useNesterov?e.c.mul(s.add(n.mul(e.m))).add(r):e.c.mul(n).add(r),o.assign(n),r.assign(t)})}),this.incrementIterations()},e.prototype.dispose=function(){this.m.dispose(),null!=this.accumulations&&ze(this.accumulations.map(function(t){return t.variable}))},e.prototype.setMomentum=function(t){this.momentum=t},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){return l(this,function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulations.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulations=t.map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},e.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},e.className="Momentum",e}(ph);eh(dh);var fh=function(t){function e(e,n,i,r,o){void 0===n&&(n=.9),void 0===i&&(i=0),void 0===r&&(r=null),void 0===o&&(o=!1);var s=t.call(this)||this;if(s.learningRate=e,s.decay=n,s.momentum=i,s.epsilon=r,s.accumulatedMeanSquares=[],s.accumulatedMoments=[],s.accumulatedMeanGrads=[],s.centered=o,null==r&&(s.epsilon=Pt.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.");return s}return s(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map(function(t){return t.name}):Object.keys(t)).forEach(function(n,i){var r=Pt.registeredVariables[n];null==e.accumulatedMeanSquares[i]&&(e.accumulatedMeanSquares[i]={originalName:n+"/rms",variable:je(function(){return Sn(r).variable(!1)})}),null==e.accumulatedMoments[i]&&(e.accumulatedMoments[i]={originalName:n+"/momentum",variable:je(function(){return Sn(r).variable(!1)})}),null==e.accumulatedMeanGrads[i]&&e.centered&&(e.accumulatedMeanGrads[i]={originalName:n+"/mg",variable:je(function(){return Sn(r).variable(!1)})});var o=Array.isArray(t)?t[i].tensor:t[n];if(null!=o){var s=e.accumulatedMeanSquares[i].variable,a=e.accumulatedMoments[i].variable;je(function(){var t=s.mul(e.decay).add(o.square().mul(1-e.decay));if(e.centered){var n=e.accumulatedMeanGrads[i].variable,l=n.mul(e.decay).add(o.mul(1-e.decay)),u=a.mul(e.momentum).add(o.mul(e.learningRate).div(t.sub(l.square().add(e.epsilon)).sqrt()));s.assign(t),n.assign(l),a.assign(u);var c=r.sub(u);r.assign(c)}else{var h=s.mul(e.decay).add(o.square().mul(1-e.decay));u=a.mul(e.momentum).add(o.mul(e.learningRate).div(h.add(e.epsilon).sqrt())),s.assign(h),a.assign(u),c=r.sub(u),r.assign(c)}})}}),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedMeanSquares&&ze(this.accumulatedMeanSquares.map(function(t){return t.variable})),null!=this.accumulatedMeanGrads&&this.centered&&ze(this.accumulatedMeanGrads.map(function(t){return t.variable})),null!=this.accumulatedMoments&&ze(this.accumulatedMoments.map(function(t){return t.variable}))},e.prototype.getWeights=function(){return a(this,void 0,void 0,function(){var t;return l(this,function(e){switch(e.label){case 0:return t=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&t.push.apply(t,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map(function(t){return{name:t.originalName,tensor:t.variable}}))]}})})},e.prototype.setWeights=function(t){return a(this,void 0,void 0,function(){var e;return l(this,function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=this.centered?t.length/3:t.length/2,this.accumulatedMeanSquares=t.slice(0,e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.accumulatedMoments=t.slice(e,2*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}),this.centered&&(this.accumulatedMeanGrads=t.slice(2*e,3*e).map(function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}})})},e.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},e.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},e.className="RMSProp",e}(ah);eh(fh);var gh=function(){function t(){}return t.sgd=function(t){return new ph(t)},t.momentum=function(t,e,n){return void 0===n&&(n=!1),new dh(t,e,n)},t.rmsprop=function(t,e,n,i,r){return void 0===e&&(e=.9),void 0===n&&(n=0),void 0===i&&(i=null),void 0===r&&(r=!1),new fh(t,e,n,i,r)},t.adam=function(t,e,n,i){return void 0===t&&(t=.001),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===i&&(i=null),new ch(t,e,n,i)},t.adadelta=function(t,e,n){return void 0===t&&(t=.001),void 0===e&&(e=.95),void 0===n&&(n=null),new lh(t,e,n)},t.adamax=function(t,e,n,i,r){return void 0===t&&(t=.002),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===i&&(i=null),void 0===r&&(r=0),new hh(t,e,n,i,r)},t.adagrad=function(t,e){return void 0===e&&(e=.1),new uh(t,e)},t}();gh.sgd,gh.momentum,gh.adadelta,gh.adagrad,gh.rmsprop,gh.adamax,gh.adam,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate&&setImmediate;bt.prototype.squaredDifference=function(t){return rs(this,t)},_t=Hu}).call(e,n("DuR2"),n("W2nU"),n("EuP9").Buffer)},"3Eo+":function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},"3fo+":function(t,e,n){t.exports=n("YAhB")},"3fs2":function(t,e,n){var i=n("RY/4"),r=n("dSzd")("iterator"),o=n("/bQp");t.exports=n("FeBl").getIteratorMethod=function(t){if(void 0!=t)return t[r]||t["@@iterator"]||o[i(t)]}},"4mcu":function(t,e){t.exports=function(){}},"52gC":function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},"5PlU":function(t,e,n){var i=n("RY/4"),r=n("dSzd")("iterator"),o=n("/bQp");t.exports=n("FeBl").isIterable=function(t){var e=Object(t);return void 0!==e[r]||"@@iterator"in e||o.hasOwnProperty(i(e))}},"5QVw":function(t,e,n){t.exports={default:n("BwfY"),__esModule:!0}},"5VQ+":function(t,e,n){"use strict";var i=n("cGG2");t.exports=function(t,e){i.forEach(t,function(n,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[i])})}},"6Twh":function(t,e,n){"use strict";e.__esModule=!0,e.default=function(){if(o.default.prototype.$isServer)return 0;if(void 0!==s)return s;var t=document.createElement("div");t.className="el-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);var e=t.offsetWidth;t.style.overflow="scroll";var n=document.createElement("div");n.style.width="100%",t.appendChild(n);var i=n.offsetWidth;return t.parentNode.removeChild(t),s=e-i};var i,r=n("7+uW"),o=(i=r)&&i.__esModule?i:{default:i};var s=void 0},"7+uW":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){
  30. /*!
  31. * Vue.js v2.6.14
  32. * (c) 2014-2021 Evan You
  33. * Released under the MIT License.
  34. */
  35. var n=Object.freeze({});function i(t){return void 0===t||null===t}function r(t){return void 0!==t&&null!==t}function o(t){return!0===t}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function a(t){return null!==t&&"object"==typeof t}var l=Object.prototype.toString;function u(t){return"[object Object]"===l.call(t)}function c(t){return"[object RegExp]"===l.call(t)}function h(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function p(t){return r(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function d(t){return null==t?"":Array.isArray(t)||u(t)&&t.toString===l?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function g(t,e){for(var n=Object.create(null),i=t.split(","),r=0;r<i.length;r++)n[i[r]]=!0;return e?function(t){return n[t.toLowerCase()]}:function(t){return n[t]}}var m=g("slot,component",!0),v=g("key,ref,slot,slot-scope,is");function _(t,e){if(t.length){var n=t.indexOf(e);if(n>-1)return t.splice(n,1)}}var y=Object.prototype.hasOwnProperty;function b(t,e){return y.call(t,e)}function T(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var E=/-(\w)/g,C=T(function(t){return t.replace(E,function(t,e){return e?e.toUpperCase():""})}),S=T(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),w=/\B([A-Z])/g,k=T(function(t){return t.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function I(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function R(t,e){for(var n in e)t[n]=e[n];return t}function O(t){for(var e={},n=0;n<t.length;n++)t[n]&&R(e,t[n]);return e}function D(t,e,n){}var A=function(t,e,n){return!1},M=function(t){return t};function N(t,e){if(t===e)return!0;var n=a(t),i=a(e);if(!n||!i)return!n&&!i&&String(t)===String(e);try{var r=Array.isArray(t),o=Array.isArray(e);if(r&&o)return t.length===e.length&&t.every(function(t,n){return N(t,e[n])});if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(r||o)return!1;var s=Object.keys(t),l=Object.keys(e);return s.length===l.length&&s.every(function(n){return N(t[n],e[n])})}catch(t){return!1}}function L(t,e){for(var n=0;n<t.length;n++)if(N(t[n],e))return n;return-1}function P(t){var e=!1;return function(){e||(e=!0,t.apply(this,arguments))}}var B="data-server-rendered",F=["component","directive","filter"],U=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],V={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:A,isReservedAttr:A,isUnknownElement:A,getTagNamespace:D,parsePlatformTagName:M,mustUseProp:A,async:!0,_lifecycleHooks:U},H=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function W(t){var e=(t+"").charCodeAt(0);return 36===e||95===e}function G(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}var j=new RegExp("[^"+H.source+".$_\\d]");var z,$="__proto__"in{},X="undefined"!=typeof window,Y="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=Y&&WXEnvironment.platform.toLowerCase(),J=X&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),Z=J&&J.indexOf("msie 9.0")>0,Q=J&&J.indexOf("edge/")>0,tt=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),et=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),nt={}.watch,it=!1;if(X)try{var rt={};Object.defineProperty(rt,"passive",{get:function(){it=!0}}),window.addEventListener("test-passive",null,rt)}catch(t){}var ot=function(){return void 0===z&&(z=!X&&!Y&&void 0!==t&&(t.process&&"server"===t.process.env.VUE_ENV)),z},st=X&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function at(t){return"function"==typeof t&&/native code/.test(t.toString())}var lt,ut="undefined"!=typeof Symbol&&at(Symbol)&&"undefined"!=typeof Reflect&&at(Reflect.ownKeys);lt="undefined"!=typeof Set&&at(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ct=D,ht=0,pt=function(){this.id=ht++,this.subs=[]};pt.prototype.addSub=function(t){this.subs.push(t)},pt.prototype.removeSub=function(t){_(this.subs,t)},pt.prototype.depend=function(){pt.target&&pt.target.addDep(this)},pt.prototype.notify=function(){var t=this.subs.slice();for(var e=0,n=t.length;e<n;e++)t[e].update()},pt.target=null;var dt=[];function ft(t){dt.push(t),pt.target=t}function gt(){dt.pop(),pt.target=dt[dt.length-1]}var mt=function(t,e,n,i,r,o,s,a){this.tag=t,this.data=e,this.children=n,this.text=i,this.elm=r,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=s,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=a,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},vt={child:{configurable:!0}};vt.child.get=function(){return this.componentInstance},Object.defineProperties(mt.prototype,vt);var _t=function(t){void 0===t&&(t="");var e=new mt;return e.text=t,e.isComment=!0,e};function yt(t){return new mt(void 0,void 0,void 0,String(t))}function bt(t){var e=new mt(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}var Tt=Array.prototype,Et=Object.create(Tt);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(t){var e=Tt[t];G(Et,t,function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];var r,o=e.apply(this,n),s=this.__ob__;switch(t){case"push":case"unshift":r=n;break;case"splice":r=n.slice(2)}return r&&s.observeArray(r),s.dep.notify(),o})});var Ct=Object.getOwnPropertyNames(Et),St=!0;function wt(t){St=t}var kt=function(t){var e;this.value=t,this.dep=new pt,this.vmCount=0,G(t,"__ob__",this),Array.isArray(t)?($?(e=Et,t.__proto__=e):function(t,e,n){for(var i=0,r=n.length;i<r;i++){var o=n[i];G(t,o,e[o])}}(t,Et,Ct),this.observeArray(t)):this.walk(t)};function xt(t,e){var n;if(a(t)&&!(t instanceof mt))return b(t,"__ob__")&&t.__ob__ instanceof kt?n=t.__ob__:St&&!ot()&&(Array.isArray(t)||u(t))&&Object.isExtensible(t)&&!t._isVue&&(n=new kt(t)),e&&n&&n.vmCount++,n}function It(t,e,n,i,r){var o=new pt,s=Object.getOwnPropertyDescriptor(t,e);if(!s||!1!==s.configurable){var a=s&&s.get,l=s&&s.set;a&&!l||2!==arguments.length||(n=t[e]);var u=!r&&xt(n);Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){var e=a?a.call(t):n;return pt.target&&(o.depend(),u&&(u.dep.depend(),Array.isArray(e)&&function t(e){for(var n=void 0,i=0,r=e.length;i<r;i++)(n=e[i])&&n.__ob__&&n.__ob__.dep.depend(),Array.isArray(n)&&t(n)}(e))),e},set:function(e){var i=a?a.call(t):n;e===i||e!=e&&i!=i||a&&!l||(l?l.call(t,e):n=e,u=!r&&xt(e),o.notify())}})}}function Rt(t,e,n){if(Array.isArray(t)&&h(e))return t.length=Math.max(t.length,e),t.splice(e,1,n),n;if(e in t&&!(e in Object.prototype))return t[e]=n,n;var i=t.__ob__;return t._isVue||i&&i.vmCount?n:i?(It(i.value,e,n),i.dep.notify(),n):(t[e]=n,n)}function Ot(t,e){if(Array.isArray(t)&&h(e))t.splice(e,1);else{var n=t.__ob__;t._isVue||n&&n.vmCount||b(t,e)&&(delete t[e],n&&n.dep.notify())}}kt.prototype.walk=function(t){for(var e=Object.keys(t),n=0;n<e.length;n++)It(t,e[n])},kt.prototype.observeArray=function(t){for(var e=0,n=t.length;e<n;e++)xt(t[e])};var Dt=V.optionMergeStrategies;function At(t,e){if(!e)return t;for(var n,i,r,o=ut?Reflect.ownKeys(e):Object.keys(e),s=0;s<o.length;s++)"__ob__"!==(n=o[s])&&(i=t[n],r=e[n],b(t,n)?i!==r&&u(i)&&u(r)&&At(i,r):Rt(t,n,r));return t}function Mt(t,e,n){return n?function(){var i="function"==typeof e?e.call(n,n):e,r="function"==typeof t?t.call(n,n):t;return i?At(i,r):r}:e?t?function(){return At("function"==typeof e?e.call(this,this):e,"function"==typeof t?t.call(this,this):t)}:e:t}function Nt(t,e){var n=e?t?t.concat(e):Array.isArray(e)?e:[e]:t;return n?function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(n):n}function Lt(t,e,n,i){var r=Object.create(t||null);return e?R(r,e):r}Dt.data=function(t,e,n){return n?Mt(t,e,n):e&&"function"!=typeof e?t:Mt(t,e)},U.forEach(function(t){Dt[t]=Nt}),F.forEach(function(t){Dt[t+"s"]=Lt}),Dt.watch=function(t,e,n,i){if(t===nt&&(t=void 0),e===nt&&(e=void 0),!e)return Object.create(t||null);if(!t)return e;var r={};for(var o in R(r,t),e){var s=r[o],a=e[o];s&&!Array.isArray(s)&&(s=[s]),r[o]=s?s.concat(a):Array.isArray(a)?a:[a]}return r},Dt.props=Dt.methods=Dt.inject=Dt.computed=function(t,e,n,i){if(!t)return e;var r=Object.create(null);return R(r,t),e&&R(r,e),r},Dt.provide=Mt;var Pt=function(t,e){return void 0===e?t:e};function Bt(t,e,n){if("function"==typeof e&&(e=e.options),function(t,e){var n=t.props;if(n){var i,r,o={};if(Array.isArray(n))for(i=n.length;i--;)"string"==typeof(r=n[i])&&(o[C(r)]={type:null});else if(u(n))for(var s in n)r=n[s],o[C(s)]=u(r)?r:{type:r};t.props=o}}(e),function(t,e){var n=t.inject;if(n){var i=t.inject={};if(Array.isArray(n))for(var r=0;r<n.length;r++)i[n[r]]={from:n[r]};else if(u(n))for(var o in n){var s=n[o];i[o]=u(s)?R({from:o},s):{from:s}}}}(e),function(t){var e=t.directives;if(e)for(var n in e){var i=e[n];"function"==typeof i&&(e[n]={bind:i,update:i})}}(e),!e._base&&(e.extends&&(t=Bt(t,e.extends,n)),e.mixins))for(var i=0,r=e.mixins.length;i<r;i++)t=Bt(t,e.mixins[i],n);var o,s={};for(o in t)a(o);for(o in e)b(t,o)||a(o);function a(i){var r=Dt[i]||Pt;s[i]=r(t[i],e[i],n,i)}return s}function Ft(t,e,n,i){if("string"==typeof n){var r=t[e];if(b(r,n))return r[n];var o=C(n);if(b(r,o))return r[o];var s=S(o);return b(r,s)?r[s]:r[n]||r[o]||r[s]}}function Ut(t,e,n,i){var r=e[t],o=!b(n,t),s=n[t],a=Gt(Boolean,r.type);if(a>-1)if(o&&!b(r,"default"))s=!1;else if(""===s||s===k(t)){var l=Gt(String,r.type);(l<0||a<l)&&(s=!0)}if(void 0===s){s=function(t,e,n){if(!b(e,"default"))return;var i=e.default;0;if(t&&t.$options.propsData&&void 0===t.$options.propsData[n]&&void 0!==t._props[n])return t._props[n];return"function"==typeof i&&"Function"!==Ht(e.type)?i.call(t):i}(i,r,t);var u=St;wt(!0),xt(s),wt(u)}return s}var Vt=/^\s*function (\w+)/;function Ht(t){var e=t&&t.toString().match(Vt);return e?e[1]:""}function Wt(t,e){return Ht(t)===Ht(e)}function Gt(t,e){if(!Array.isArray(e))return Wt(e,t)?0:-1;for(var n=0,i=e.length;n<i;n++)if(Wt(e[n],t))return n;return-1}function jt(t,e,n){ft();try{if(e)for(var i=e;i=i.$parent;){var r=i.$options.errorCaptured;if(r)for(var o=0;o<r.length;o++)try{if(!1===r[o].call(i,t,e,n))return}catch(t){$t(t,i,"errorCaptured hook")}}$t(t,e,n)}finally{gt()}}function zt(t,e,n,i,r){var o;try{(o=n?t.apply(e,n):t.call(e))&&!o._isVue&&p(o)&&!o._handled&&(o.catch(function(t){return jt(t,i,r+" (Promise/async)")}),o._handled=!0)}catch(t){jt(t,i,r)}return o}function $t(t,e,n){if(V.errorHandler)try{return V.errorHandler.call(null,t,e,n)}catch(e){e!==t&&Xt(e,null,"config.errorHandler")}Xt(t,e,n)}function Xt(t,e,n){if(!X&&!Y||"undefined"==typeof console)throw t;console.error(t)}var Yt,Kt=!1,Jt=[],qt=!1;function Zt(){qt=!1;var t=Jt.slice(0);Jt.length=0;for(var e=0;e<t.length;e++)t[e]()}if("undefined"!=typeof Promise&&at(Promise)){var Qt=Promise.resolve();Yt=function(){Qt.then(Zt),tt&&setTimeout(D)},Kt=!0}else if(q||"undefined"==typeof MutationObserver||!at(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())Yt="undefined"!=typeof setImmediate&&at(setImmediate)?function(){setImmediate(Zt)}:function(){setTimeout(Zt,0)};else{var te=1,ee=new MutationObserver(Zt),ne=document.createTextNode(String(te));ee.observe(ne,{characterData:!0}),Yt=function(){te=(te+1)%2,ne.data=String(te)},Kt=!0}function ie(t,e){var n;if(Jt.push(function(){if(t)try{t.call(e)}catch(t){jt(t,e,"nextTick")}else n&&n(e)}),qt||(qt=!0,Yt()),!t&&"undefined"!=typeof Promise)return new Promise(function(t){n=t})}var re=new lt;function oe(t){!function t(e,n){var i,r;var o=Array.isArray(e);if(!o&&!a(e)||Object.isFrozen(e)||e instanceof mt)return;if(e.__ob__){var s=e.__ob__.dep.id;if(n.has(s))return;n.add(s)}if(o)for(i=e.length;i--;)t(e[i],n);else for(r=Object.keys(e),i=r.length;i--;)t(e[r[i]],n)}(t,re),re.clear()}var se=T(function(t){var e="&"===t.charAt(0),n="~"===(t=e?t.slice(1):t).charAt(0),i="!"===(t=n?t.slice(1):t).charAt(0);return{name:t=i?t.slice(1):t,once:n,capture:i,passive:e}});function ae(t,e){function n(){var t=arguments,i=n.fns;if(!Array.isArray(i))return zt(i,null,arguments,e,"v-on handler");for(var r=i.slice(),o=0;o<r.length;o++)zt(r[o],null,t,e,"v-on handler")}return n.fns=t,n}function le(t,e,n,r,s,a){var l,u,c,h;for(l in t)u=t[l],c=e[l],h=se(l),i(u)||(i(c)?(i(u.fns)&&(u=t[l]=ae(u,a)),o(h.once)&&(u=t[l]=s(h.name,u,h.capture)),n(h.name,u,h.capture,h.passive,h.params)):u!==c&&(c.fns=u,t[l]=c));for(l in e)i(t[l])&&r((h=se(l)).name,e[l],h.capture)}function ue(t,e,n){var s;t instanceof mt&&(t=t.data.hook||(t.data.hook={}));var a=t[e];function l(){n.apply(this,arguments),_(s.fns,l)}i(a)?s=ae([l]):r(a.fns)&&o(a.merged)?(s=a).fns.push(l):s=ae([a,l]),s.merged=!0,t[e]=s}function ce(t,e,n,i,o){if(r(e)){if(b(e,n))return t[n]=e[n],o||delete e[n],!0;if(b(e,i))return t[n]=e[i],o||delete e[i],!0}return!1}function he(t){return s(t)?[yt(t)]:Array.isArray(t)?function t(e,n){var a=[];var l,u,c,h;for(l=0;l<e.length;l++)i(u=e[l])||"boolean"==typeof u||(c=a.length-1,h=a[c],Array.isArray(u)?u.length>0&&(pe((u=t(u,(n||"")+"_"+l))[0])&&pe(h)&&(a[c]=yt(h.text+u[0].text),u.shift()),a.push.apply(a,u)):s(u)?pe(h)?a[c]=yt(h.text+u):""!==u&&a.push(yt(u)):pe(u)&&pe(h)?a[c]=yt(h.text+u.text):(o(e._isVList)&&r(u.tag)&&i(u.key)&&r(n)&&(u.key="__vlist"+n+"_"+l+"__"),a.push(u)));return a}(t):void 0}function pe(t){return r(t)&&r(t.text)&&!1===t.isComment}function de(t,e){if(t){for(var n=Object.create(null),i=ut?Reflect.ownKeys(t):Object.keys(t),r=0;r<i.length;r++){var o=i[r];if("__ob__"!==o){for(var s=t[o].from,a=e;a;){if(a._provided&&b(a._provided,s)){n[o]=a._provided[s];break}a=a.$parent}if(!a)if("default"in t[o]){var l=t[o].default;n[o]="function"==typeof l?l.call(e):l}else 0}}return n}}function fe(t,e){if(!t||!t.length)return{};for(var n={},i=0,r=t.length;i<r;i++){var o=t[i],s=o.data;if(s&&s.attrs&&s.attrs.slot&&delete s.attrs.slot,o.context!==e&&o.fnContext!==e||!s||null==s.slot)(n.default||(n.default=[])).push(o);else{var a=s.slot,l=n[a]||(n[a]=[]);"template"===o.tag?l.push.apply(l,o.children||[]):l.push(o)}}for(var u in n)n[u].every(ge)&&delete n[u];return n}function ge(t){return t.isComment&&!t.asyncFactory||" "===t.text}function me(t){return t.isComment&&t.asyncFactory}function ve(t,e,i){var r,o=Object.keys(e).length>0,s=t?!!t.$stable:!o,a=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(s&&i&&i!==n&&a===i.$key&&!o&&!i.$hasNormal)return i;for(var l in r={},t)t[l]&&"$"!==l[0]&&(r[l]=_e(e,l,t[l]))}else r={};for(var u in e)u in r||(r[u]=ye(e,u));return t&&Object.isExtensible(t)&&(t._normalized=r),G(r,"$stable",s),G(r,"$key",a),G(r,"$hasNormal",o),r}function _e(t,e,n){var i=function(){var t=arguments.length?n.apply(null,arguments):n({}),e=(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:he(t))&&t[0];return t&&(!e||1===t.length&&e.isComment&&!me(e))?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:i,enumerable:!0,configurable:!0}),i}function ye(t,e){return function(){return t[e]}}function be(t,e){var n,i,o,s,l;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),i=0,o=t.length;i<o;i++)n[i]=e(t[i],i);else if("number"==typeof t)for(n=new Array(t),i=0;i<t;i++)n[i]=e(i+1,i);else if(a(t))if(ut&&t[Symbol.iterator]){n=[];for(var u=t[Symbol.iterator](),c=u.next();!c.done;)n.push(e(c.value,n.length)),c=u.next()}else for(s=Object.keys(t),n=new Array(s.length),i=0,o=s.length;i<o;i++)l=s[i],n[i]=e(t[l],l,i);return r(n)||(n=[]),n._isVList=!0,n}function Te(t,e,n,i){var r,o=this.$scopedSlots[t];o?(n=n||{},i&&(n=R(R({},i),n)),r=o(n)||("function"==typeof e?e():e)):r=this.$slots[t]||("function"==typeof e?e():e);var s=n&&n.slot;return s?this.$createElement("template",{slot:s},r):r}function Ee(t){return Ft(this.$options,"filters",t)||M}function Ce(t,e){return Array.isArray(t)?-1===t.indexOf(e):t!==e}function Se(t,e,n,i,r){var o=V.keyCodes[e]||n;return r&&i&&!V.keyCodes[e]?Ce(r,i):o?Ce(o,t):i?k(i)!==e:void 0===t}function we(t,e,n,i,r){if(n)if(a(n)){var o;Array.isArray(n)&&(n=O(n));var s=function(s){if("class"===s||"style"===s||v(s))o=t;else{var a=t.attrs&&t.attrs.type;o=i||V.mustUseProp(e,a,s)?t.domProps||(t.domProps={}):t.attrs||(t.attrs={})}var l=C(s),u=k(s);l in o||u in o||(o[s]=n[s],r&&((t.on||(t.on={}))["update:"+s]=function(t){n[s]=t}))};for(var l in n)s(l)}else;return t}function ke(t,e){var n=this._staticTrees||(this._staticTrees=[]),i=n[t];return i&&!e?i:(Ie(i=n[t]=this.$options.staticRenderFns[t].call(this._renderProxy,null,this),"__static__"+t,!1),i)}function xe(t,e,n){return Ie(t,"__once__"+e+(n?"_"+n:""),!0),t}function Ie(t,e,n){if(Array.isArray(t))for(var i=0;i<t.length;i++)t[i]&&"string"!=typeof t[i]&&Re(t[i],e+"_"+i,n);else Re(t,e,n)}function Re(t,e,n){t.isStatic=!0,t.key=e,t.isOnce=n}function Oe(t,e){if(e)if(u(e)){var n=t.on=t.on?R({},t.on):{};for(var i in e){var r=n[i],o=e[i];n[i]=r?[].concat(r,o):o}}else;return t}function De(t,e,n,i){e=e||{$stable:!n};for(var r=0;r<t.length;r++){var o=t[r];Array.isArray(o)?De(o,e,n):o&&(o.proxy&&(o.fn.proxy=!0),e[o.key]=o.fn)}return i&&(e.$key=i),e}function Ae(t,e){for(var n=0;n<e.length;n+=2){var i=e[n];"string"==typeof i&&i&&(t[e[n]]=e[n+1])}return t}function Me(t,e){return"string"==typeof t?e+t:t}function Ne(t){t._o=xe,t._n=f,t._s=d,t._l=be,t._t=Te,t._q=N,t._i=L,t._m=ke,t._f=Ee,t._k=Se,t._b=we,t._v=yt,t._e=_t,t._u=De,t._g=Oe,t._d=Ae,t._p=Me}function Le(t,e,i,r,s){var a,l=this,u=s.options;b(r,"_uid")?(a=Object.create(r))._original=r:(a=r,r=r._original);var c=o(u._compiled),h=!c;this.data=t,this.props=e,this.children=i,this.parent=r,this.listeners=t.on||n,this.injections=de(u.inject,r),this.slots=function(){return l.$slots||ve(t.scopedSlots,l.$slots=fe(i,r)),l.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return ve(t.scopedSlots,this.slots())}}),c&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=ve(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(t,e,n,i){var o=je(a,t,e,n,i,h);return o&&!Array.isArray(o)&&(o.fnScopeId=u._scopeId,o.fnContext=r),o}:this._c=function(t,e,n,i){return je(a,t,e,n,i,h)}}function Pe(t,e,n,i,r){var o=bt(t);return o.fnContext=n,o.fnOptions=i,e.slot&&((o.data||(o.data={})).slot=e.slot),o}function Be(t,e){for(var n in e)t[C(n)]=e[n]}Ne(Le.prototype);var Fe={init:function(t,e){if(t.componentInstance&&!t.componentInstance._isDestroyed&&t.data.keepAlive){var n=t;Fe.prepatch(n,n)}else{(t.componentInstance=function(t,e){var n={_isComponent:!0,_parentVnode:t,parent:e},i=t.data.inlineTemplate;r(i)&&(n.render=i.render,n.staticRenderFns=i.staticRenderFns);return new t.componentOptions.Ctor(n)}(t,Qe)).$mount(e?t.elm:void 0,e)}},prepatch:function(t,e){var i=e.componentOptions;!function(t,e,i,r,o){0;var s=r.data.scopedSlots,a=t.$scopedSlots,l=!!(s&&!s.$stable||a!==n&&!a.$stable||s&&t.$scopedSlots.$key!==s.$key||!s&&t.$scopedSlots.$key),u=!!(o||t.$options._renderChildren||l);t.$options._parentVnode=r,t.$vnode=r,t._vnode&&(t._vnode.parent=r);if(t.$options._renderChildren=o,t.$attrs=r.data.attrs||n,t.$listeners=i||n,e&&t.$options.props){wt(!1);for(var c=t._props,h=t.$options._propKeys||[],p=0;p<h.length;p++){var d=h[p],f=t.$options.props;c[d]=Ut(d,f,e,t)}wt(!0),t.$options.propsData=e}i=i||n;var g=t.$options._parentListeners;t.$options._parentListeners=i,Ze(t,i,g),u&&(t.$slots=fe(o,r.context),t.$forceUpdate());0}(e.componentInstance=t.componentInstance,i.propsData,i.listeners,e,i.children)},insert:function(t){var e,n=t.context,i=t.componentInstance;i._isMounted||(i._isMounted=!0,rn(i,"mounted")),t.data.keepAlive&&(n._isMounted?((e=i)._inactive=!1,sn.push(e)):nn(i,!0))},destroy:function(t){var e=t.componentInstance;e._isDestroyed||(t.data.keepAlive?function t(e,n){if(n&&(e._directInactive=!0,en(e)))return;if(!e._inactive){e._inactive=!0;for(var i=0;i<e.$children.length;i++)t(e.$children[i]);rn(e,"deactivated")}}(e,!0):e.$destroy())}},Ue=Object.keys(Fe);function Ve(t,e,s,l,u){if(!i(t)){var c=s.$options._base;if(a(t)&&(t=c.extend(t)),"function"==typeof t){var h;if(i(t.cid)&&void 0===(t=function(t,e){if(o(t.error)&&r(t.errorComp))return t.errorComp;if(r(t.resolved))return t.resolved;var n=$e;n&&r(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n);if(o(t.loading)&&r(t.loadingComp))return t.loadingComp;if(n&&!r(t.owners)){var s=t.owners=[n],l=!0,u=null,c=null;n.$on("hook:destroyed",function(){return _(s,n)});var h=function(t){for(var e=0,n=s.length;e<n;e++)s[e].$forceUpdate();t&&(s.length=0,null!==u&&(clearTimeout(u),u=null),null!==c&&(clearTimeout(c),c=null))},d=P(function(n){t.resolved=Xe(n,e),l?s.length=0:h(!0)}),f=P(function(e){r(t.errorComp)&&(t.error=!0,h(!0))}),g=t(d,f);return a(g)&&(p(g)?i(t.resolved)&&g.then(d,f):p(g.component)&&(g.component.then(d,f),r(g.error)&&(t.errorComp=Xe(g.error,e)),r(g.loading)&&(t.loadingComp=Xe(g.loading,e),0===g.delay?t.loading=!0:u=setTimeout(function(){u=null,i(t.resolved)&&i(t.error)&&(t.loading=!0,h(!1))},g.delay||200)),r(g.timeout)&&(c=setTimeout(function(){c=null,i(t.resolved)&&f(null)},g.timeout)))),l=!1,t.loading?t.loadingComp:t.resolved}}(h=t,c)))return function(t,e,n,i,r){var o=_t();return o.asyncFactory=t,o.asyncMeta={data:e,context:n,children:i,tag:r},o}(h,e,s,l,u);e=e||{},kn(t),r(e.model)&&function(t,e){var n=t.model&&t.model.prop||"value",i=t.model&&t.model.event||"input";(e.attrs||(e.attrs={}))[n]=e.model.value;var o=e.on||(e.on={}),s=o[i],a=e.model.callback;r(s)?(Array.isArray(s)?-1===s.indexOf(a):s!==a)&&(o[i]=[a].concat(s)):o[i]=a}(t.options,e);var d=function(t,e,n){var o=e.options.props;if(!i(o)){var s={},a=t.attrs,l=t.props;if(r(a)||r(l))for(var u in o){var c=k(u);ce(s,l,u,c,!0)||ce(s,a,u,c,!1)}return s}}(e,t);if(o(t.options.functional))return function(t,e,i,o,s){var a=t.options,l={},u=a.props;if(r(u))for(var c in u)l[c]=Ut(c,u,e||n);else r(i.attrs)&&Be(l,i.attrs),r(i.props)&&Be(l,i.props);var h=new Le(i,l,s,o,t),p=a.render.call(null,h._c,h);if(p instanceof mt)return Pe(p,i,h.parent,a);if(Array.isArray(p)){for(var d=he(p)||[],f=new Array(d.length),g=0;g<d.length;g++)f[g]=Pe(d[g],i,h.parent,a);return f}}(t,d,e,s,l);var f=e.on;if(e.on=e.nativeOn,o(t.options.abstract)){var g=e.slot;e={},g&&(e.slot=g)}!function(t){for(var e=t.hook||(t.hook={}),n=0;n<Ue.length;n++){var i=Ue[n],r=e[i],o=Fe[i];r===o||r&&r._merged||(e[i]=r?He(o,r):o)}}(e);var m=t.options.name||u;return new mt("vue-component-"+t.cid+(m?"-"+m:""),e,void 0,void 0,void 0,s,{Ctor:t,propsData:d,listeners:f,tag:u,children:l},h)}}}function He(t,e){var n=function(n,i){t(n,i),e(n,i)};return n._merged=!0,n}var We=1,Ge=2;function je(t,e,n,l,u,c){return(Array.isArray(n)||s(n))&&(u=l,l=n,n=void 0),o(c)&&(u=Ge),function(t,e,n,s,l){if(r(n)&&r(n.__ob__))return _t();r(n)&&r(n.is)&&(e=n.is);if(!e)return _t();0;Array.isArray(s)&&"function"==typeof s[0]&&((n=n||{}).scopedSlots={default:s[0]},s.length=0);l===Ge?s=he(s):l===We&&(s=function(t){for(var e=0;e<t.length;e++)if(Array.isArray(t[e]))return Array.prototype.concat.apply([],t);return t}(s));var u,c;if("string"==typeof e){var h;c=t.$vnode&&t.$vnode.ns||V.getTagNamespace(e),u=V.isReservedTag(e)?new mt(V.parsePlatformTagName(e),n,s,void 0,void 0,t):n&&n.pre||!r(h=Ft(t.$options,"components",e))?new mt(e,n,s,void 0,void 0,t):Ve(h,n,t,s,e)}else u=Ve(e,n,t,s);return Array.isArray(u)?u:r(u)?(r(c)&&function t(e,n,s){e.ns=n;"foreignObject"===e.tag&&(n=void 0,s=!0);if(r(e.children))for(var a=0,l=e.children.length;a<l;a++){var u=e.children[a];r(u.tag)&&(i(u.ns)||o(s)&&"svg"!==u.tag)&&t(u,n,s)}}(u,c),r(n)&&function(t){a(t.style)&&oe(t.style);a(t.class)&&oe(t.class)}(n),u):_t()}(t,e,n,l,u)}var ze,$e=null;function Xe(t,e){return(t.__esModule||ut&&"Module"===t[Symbol.toStringTag])&&(t=t.default),a(t)?e.extend(t):t}function Ye(t){if(Array.isArray(t))for(var e=0;e<t.length;e++){var n=t[e];if(r(n)&&(r(n.componentOptions)||me(n)))return n}}function Ke(t,e){ze.$on(t,e)}function Je(t,e){ze.$off(t,e)}function qe(t,e){var n=ze;return function i(){null!==e.apply(null,arguments)&&n.$off(t,i)}}function Ze(t,e,n){ze=t,le(e,n||{},Ke,Je,qe,t),ze=void 0}var Qe=null;function tn(t){var e=Qe;return Qe=t,function(){Qe=e}}function en(t){for(;t&&(t=t.$parent);)if(t._inactive)return!0;return!1}function nn(t,e){if(e){if(t._directInactive=!1,en(t))return}else if(t._directInactive)return;if(t._inactive||null===t._inactive){t._inactive=!1;for(var n=0;n<t.$children.length;n++)nn(t.$children[n]);rn(t,"activated")}}function rn(t,e){ft();var n=t.$options[e],i=e+" hook";if(n)for(var r=0,o=n.length;r<o;r++)zt(n[r],t,null,t,i);t._hasHookEvent&&t.$emit("hook:"+e),gt()}var on=[],sn=[],an={},ln=!1,un=!1,cn=0;var hn=0,pn=Date.now;if(X&&!q){var dn=window.performance;dn&&"function"==typeof dn.now&&pn()>document.createEvent("Event").timeStamp&&(pn=function(){return dn.now()})}function fn(){var t,e;for(hn=pn(),un=!0,on.sort(function(t,e){return t.id-e.id}),cn=0;cn<on.length;cn++)(t=on[cn]).before&&t.before(),e=t.id,an[e]=null,t.run();var n=sn.slice(),i=on.slice();cn=on.length=sn.length=0,an={},ln=un=!1,function(t){for(var e=0;e<t.length;e++)t[e]._inactive=!0,nn(t[e],!0)}(n),function(t){var e=t.length;for(;e--;){var n=t[e],i=n.vm;i._watcher===n&&i._isMounted&&!i._isDestroyed&&rn(i,"updated")}}(i),st&&V.devtools&&st.emit("flush")}var gn=0,mn=function(t,e,n,i,r){this.vm=t,r&&(t._watcher=this),t._watchers.push(this),i?(this.deep=!!i.deep,this.user=!!i.user,this.lazy=!!i.lazy,this.sync=!!i.sync,this.before=i.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++gn,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new lt,this.newDepIds=new lt,this.expression="","function"==typeof e?this.getter=e:(this.getter=function(t){if(!j.test(t)){var e=t.split(".");return function(t){for(var n=0;n<e.length;n++){if(!t)return;t=t[e[n]]}return t}}}(e),this.getter||(this.getter=D)),this.value=this.lazy?void 0:this.get()};mn.prototype.get=function(){var t;ft(this);var e=this.vm;try{t=this.getter.call(e,e)}catch(t){if(!this.user)throw t;jt(t,e,'getter for watcher "'+this.expression+'"')}finally{this.deep&&oe(t),gt(),this.cleanupDeps()}return t},mn.prototype.addDep=function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))},mn.prototype.cleanupDeps=function(){for(var t=this.deps.length;t--;){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},mn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(t){var e=t.id;if(null==an[e]){if(an[e]=!0,un){for(var n=on.length-1;n>cn&&on[n].id>t.id;)n--;on.splice(n+1,0,t)}else on.push(t);ln||(ln=!0,ie(fn))}}(this)},mn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||a(t)||this.deep){var e=this.value;if(this.value=t,this.user){var n='callback for watcher "'+this.expression+'"';zt(this.cb,this.vm,[t,e],this.vm,n)}else this.cb.call(this.vm,t,e)}}},mn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},mn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},mn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||_(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var vn={enumerable:!0,configurable:!0,get:D,set:D};function _n(t,e,n){vn.get=function(){return this[e][n]},vn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,vn)}function yn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},i=t._props={},r=t.$options._propKeys=[],o=!t.$parent;o||wt(!1);var s=function(o){r.push(o);var s=Ut(o,e,n,t);It(i,o,s),o in t||_n(t,"_props",o)};for(var a in e)s(a);wt(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?D:x(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;u(e=t._data="function"==typeof e?function(t,e){ft();try{return t.call(e,e)}catch(t){return jt(t,e,"data()"),{}}finally{gt()}}(e,t):e||{})||(e={});var n=Object.keys(e),i=t.$options.props,r=(t.$options.methods,n.length);for(;r--;){var o=n[r];0,i&&b(i,o)||W(o)||_n(t,"_data",o)}xt(e,!0)}(t):xt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),i=ot();for(var r in e){var o=e[r],s="function"==typeof o?o:o.get;0,i||(n[r]=new mn(t,s||D,D,bn)),r in t||Tn(t,r,o)}}(t,e.computed),e.watch&&e.watch!==nt&&function(t,e){for(var n in e){var i=e[n];if(Array.isArray(i))for(var r=0;r<i.length;r++)Sn(t,n,i[r]);else Sn(t,n,i)}}(t,e.watch)}var bn={lazy:!0};function Tn(t,e,n){var i=!ot();"function"==typeof n?(vn.get=i?En(e):Cn(n),vn.set=D):(vn.get=n.get?i&&!1!==n.cache?En(e):Cn(n.get):D,vn.set=n.set||D),Object.defineProperty(t,e,vn)}function En(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),pt.target&&e.depend(),e.value}}function Cn(t){return function(){return t.call(this,this)}}function Sn(t,e,n,i){return u(n)&&(i=n,n=n.handler),"string"==typeof n&&(n=t[n]),t.$watch(e,n,i)}var wn=0;function kn(t){var e=t.options;if(t.super){var n=kn(t.super);if(n!==t.superOptions){t.superOptions=n;var i=function(t){var e,n=t.options,i=t.sealedOptions;for(var r in n)n[r]!==i[r]&&(e||(e={}),e[r]=n[r]);return e}(t);i&&R(t.extendOptions,i),(e=t.options=Bt(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function xn(t){this._init(t)}function In(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,i=n.cid,r=t._Ctor||(t._Ctor={});if(r[i])return r[i];var o=t.name||n.options.name;var s=function(t){this._init(t)};return(s.prototype=Object.create(n.prototype)).constructor=s,s.cid=e++,s.options=Bt(n.options,t),s.super=n,s.options.props&&function(t){var e=t.options.props;for(var n in e)_n(t.prototype,"_props",n)}(s),s.options.computed&&function(t){var e=t.options.computed;for(var n in e)Tn(t.prototype,n,e[n])}(s),s.extend=n.extend,s.mixin=n.mixin,s.use=n.use,F.forEach(function(t){s[t]=n[t]}),o&&(s.options.components[o]=s),s.superOptions=n.options,s.extendOptions=t,s.sealedOptions=R({},s.options),r[i]=s,s}}function Rn(t){return t&&(t.Ctor.options.name||t.tag)}function On(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!c(t)&&t.test(e)}function Dn(t,e){var n=t.cache,i=t.keys,r=t._vnode;for(var o in n){var s=n[o];if(s){var a=s.name;a&&!e(a)&&An(n,o,i,r)}}}function An(t,e,n,i){var r=t[e];!r||i&&r.tag===i.tag||r.componentInstance.$destroy(),t[e]=null,_(n,e)}!function(t){t.prototype._init=function(t){var e=this;e._uid=wn++,e._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),i=e._parentVnode;n.parent=e.parent,n._parentVnode=i;var r=i.componentOptions;n.propsData=r.propsData,n._parentListeners=r.listeners,n._renderChildren=r.children,n._componentTag=r.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(e,t):e.$options=Bt(kn(e.constructor),t||{},e),e._renderProxy=e,e._self=e,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(e),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Ze(t,e)}(e),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,i=t.$vnode=e._parentVnode,r=i&&i.context;t.$slots=fe(e._renderChildren,r),t.$scopedSlots=n,t._c=function(e,n,i,r){return je(t,e,n,i,r,!1)},t.$createElement=function(e,n,i,r){return je(t,e,n,i,r,!0)};var o=i&&i.data;It(t,"$attrs",o&&o.attrs||n,null,!0),It(t,"$listeners",e._parentListeners||n,null,!0)}(e),rn(e,"beforeCreate"),function(t){var e=de(t.$options.inject,t);e&&(wt(!1),Object.keys(e).forEach(function(n){It(t,n,e[n])}),wt(!0))}(e),yn(e),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(e),rn(e,"created"),e.$options.el&&e.$mount(e.$options.el)}}(xn),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=Rt,t.prototype.$delete=Ot,t.prototype.$watch=function(t,e,n){if(u(e))return Sn(this,t,e,n);(n=n||{}).user=!0;var i=new mn(this,t,e,n);if(n.immediate){var r='callback for immediate watcher "'+i.expression+'"';ft(),zt(e,this,[i.value],this,r),gt()}return function(){i.teardown()}}}(xn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var i=this;if(Array.isArray(t))for(var r=0,o=t.length;r<o;r++)i.$on(t[r],n);else(i._events[t]||(i._events[t]=[])).push(n),e.test(t)&&(i._hasHookEvent=!0);return i},t.prototype.$once=function(t,e){var n=this;function i(){n.$off(t,i),e.apply(n,arguments)}return i.fn=e,n.$on(t,i),n},t.prototype.$off=function(t,e){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(t)){for(var i=0,r=t.length;i<r;i++)n.$off(t[i],e);return n}var o,s=n._events[t];if(!s)return n;if(!e)return n._events[t]=null,n;for(var a=s.length;a--;)if((o=s[a])===e||o.fn===e){s.splice(a,1);break}return n},t.prototype.$emit=function(t){var e=this,n=e._events[t];if(n){n=n.length>1?I(n):n;for(var i=I(arguments,1),r='event handler for "'+t+'"',o=0,s=n.length;o<s;o++)zt(n[o],e,i,e,r)}return e}}(xn),function(t){t.prototype._update=function(t,e){var n=this,i=n.$el,r=n._vnode,o=tn(n);n._vnode=t,n.$el=r?n.__patch__(r,t):n.__patch__(n.$el,t,e,!1),o(),i&&(i.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},t.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},t.prototype.$destroy=function(){var t=this;if(!t._isBeingDestroyed){rn(t,"beforeDestroy"),t._isBeingDestroyed=!0;var e=t.$parent;!e||e._isBeingDestroyed||t.$options.abstract||_(e.$children,t),t._watcher&&t._watcher.teardown();for(var n=t._watchers.length;n--;)t._watchers[n].teardown();t._data.__ob__&&t._data.__ob__.vmCount--,t._isDestroyed=!0,t.__patch__(t._vnode,null),rn(t,"destroyed"),t.$off(),t.$el&&(t.$el.__vue__=null),t.$vnode&&(t.$vnode.parent=null)}}}(xn),function(t){Ne(t.prototype),t.prototype.$nextTick=function(t){return ie(t,this)},t.prototype._render=function(){var t,e=this,n=e.$options,i=n.render,r=n._parentVnode;r&&(e.$scopedSlots=ve(r.data.scopedSlots,e.$slots,e.$scopedSlots)),e.$vnode=r;try{$e=e,t=i.call(e._renderProxy,e.$createElement)}catch(n){jt(n,e,"render"),t=e._vnode}finally{$e=null}return Array.isArray(t)&&1===t.length&&(t=t[0]),t instanceof mt||(t=_t()),t.parent=r,t}}(xn);var Mn=[String,RegExp,Array],Nn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Mn,exclude:Mn,max:[String,Number]},methods:{cacheVNode:function(){var t=this.cache,e=this.keys,n=this.vnodeToCache,i=this.keyToCache;if(n){var r=n.tag,o=n.componentInstance,s=n.componentOptions;t[i]={name:Rn(s),tag:r,componentInstance:o},e.push(i),this.max&&e.length>parseInt(this.max)&&An(t,e[0],e,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)An(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",function(e){Dn(t,function(t){return On(e,t)})}),this.$watch("exclude",function(e){Dn(t,function(t){return!On(e,t)})})},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=Ye(t),n=e&&e.componentOptions;if(n){var i=Rn(n),r=this.include,o=this.exclude;if(r&&(!i||!On(r,i))||o&&i&&On(o,i))return e;var s=this.cache,a=this.keys,l=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;s[l]?(e.componentInstance=s[l].componentInstance,_(a,l),a.push(l)):(this.vnodeToCache=e,this.keyToCache=l),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return V}};Object.defineProperty(t,"config",e),t.util={warn:ct,extend:R,mergeOptions:Bt,defineReactive:It},t.set=Rt,t.delete=Ot,t.nextTick=ie,t.observable=function(t){return xt(t),t},t.options=Object.create(null),F.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,R(t.options.components,Nn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=I(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Bt(this.options,t),this}}(t),In(t),function(t){F.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&u(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(xn),Object.defineProperty(xn.prototype,"$isServer",{get:ot}),Object.defineProperty(xn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(xn,"FunctionalRenderContext",{value:Le}),xn.version="2.6.14";var Ln=g("style,class"),Pn=g("input,textarea,option,select,progress"),Bn=function(t,e,n){return"value"===n&&Pn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},Fn=g("contenteditable,draggable,spellcheck"),Un=g("events,caret,typing,plaintext-only"),Vn=function(t,e){return zn(e)||"false"===e?"false":"contenteditable"===t&&Un(e)?e:"true"},Hn=g("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),Wn="http://www.w3.org/1999/xlink",Gn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},jn=function(t){return Gn(t)?t.slice(6,t.length):""},zn=function(t){return null==t||!1===t};function $n(t){for(var e=t.data,n=t,i=t;r(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(e=Xn(i.data,e));for(;r(n=n.parent);)n&&n.data&&(e=Xn(e,n.data));return function(t,e){if(r(t)||r(e))return Yn(t,Kn(e));return""}(e.staticClass,e.class)}function Xn(t,e){return{staticClass:Yn(t.staticClass,e.staticClass),class:r(t.class)?[t.class,e.class]:e.class}}function Yn(t,e){return t?e?t+" "+e:t:e||""}function Kn(t){return Array.isArray(t)?function(t){for(var e,n="",i=0,o=t.length;i<o;i++)r(e=Kn(t[i]))&&""!==e&&(n&&(n+=" "),n+=e);return n}(t):a(t)?function(t){var e="";for(var n in t)t[n]&&(e&&(e+=" "),e+=n);return e}(t):"string"==typeof t?t:""}var Jn={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},qn=g("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),Zn=g("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Qn=function(t){return qn(t)||Zn(t)};function ti(t){return Zn(t)?"svg":"math"===t?"math":void 0}var ei=Object.create(null);var ni=g("text,number,password,search,email,tel,url");function ii(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}var ri=Object.freeze({createElement:function(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(t,e){return document.createElementNS(Jn[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setStyleScope:function(t,e){t.setAttribute(e,"")}}),oi={create:function(t,e){si(e)},update:function(t,e){t.data.ref!==e.data.ref&&(si(t,!0),si(e))},destroy:function(t){si(t,!0)}};function si(t,e){var n=t.data.ref;if(r(n)){var i=t.context,o=t.componentInstance||t.elm,s=i.$refs;e?Array.isArray(s[n])?_(s[n],o):s[n]===o&&(s[n]=void 0):t.data.refInFor?Array.isArray(s[n])?s[n].indexOf(o)<0&&s[n].push(o):s[n]=[o]:s[n]=o}}var ai=new mt("",{},[]),li=["create","activate","update","remove","destroy"];function ui(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&(t.tag===e.tag&&t.isComment===e.isComment&&r(t.data)===r(e.data)&&function(t,e){if("input"!==t.tag)return!0;var n,i=r(n=t.data)&&r(n=n.attrs)&&n.type,o=r(n=e.data)&&r(n=n.attrs)&&n.type;return i===o||ni(i)&&ni(o)}(t,e)||o(t.isAsyncPlaceholder)&&i(e.asyncFactory.error))}function ci(t,e,n){var i,o,s={};for(i=e;i<=n;++i)r(o=t[i].key)&&(s[o]=i);return s}var hi={create:pi,update:pi,destroy:function(t){pi(t,ai)}};function pi(t,e){(t.data.directives||e.data.directives)&&function(t,e){var n,i,r,o=t===ai,s=e===ai,a=fi(t.data.directives,t.context),l=fi(e.data.directives,e.context),u=[],c=[];for(n in l)i=a[n],r=l[n],i?(r.oldValue=i.value,r.oldArg=i.arg,mi(r,"update",e,t),r.def&&r.def.componentUpdated&&c.push(r)):(mi(r,"bind",e,t),r.def&&r.def.inserted&&u.push(r));if(u.length){var h=function(){for(var n=0;n<u.length;n++)mi(u[n],"inserted",e,t)};o?ue(e,"insert",h):h()}c.length&&ue(e,"postpatch",function(){for(var n=0;n<c.length;n++)mi(c[n],"componentUpdated",e,t)});if(!o)for(n in a)l[n]||mi(a[n],"unbind",t,t,s)}(t,e)}var di=Object.create(null);function fi(t,e){var n,i,r=Object.create(null);if(!t)return r;for(n=0;n<t.length;n++)(i=t[n]).modifiers||(i.modifiers=di),r[gi(i)]=i,i.def=Ft(e.$options,"directives",i.name);return r}function gi(t){return t.rawName||t.name+"."+Object.keys(t.modifiers||{}).join(".")}function mi(t,e,n,i,r){var o=t.def&&t.def[e];if(o)try{o(n.elm,t,n,i,r)}catch(i){jt(i,n.context,"directive "+t.name+" "+e+" hook")}}var vi=[oi,hi];function _i(t,e){var n=e.componentOptions;if(!(r(n)&&!1===n.Ctor.options.inheritAttrs||i(t.data.attrs)&&i(e.data.attrs))){var o,s,a=e.elm,l=t.data.attrs||{},u=e.data.attrs||{};for(o in r(u.__ob__)&&(u=e.data.attrs=R({},u)),u)s=u[o],l[o]!==s&&yi(a,o,s,e.data.pre);for(o in(q||Q)&&u.value!==l.value&&yi(a,"value",u.value),l)i(u[o])&&(Gn(o)?a.removeAttributeNS(Wn,jn(o)):Fn(o)||a.removeAttribute(o))}}function yi(t,e,n,i){i||t.tagName.indexOf("-")>-1?bi(t,e,n):Hn(e)?zn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):Fn(e)?t.setAttribute(e,Vn(e,n)):Gn(e)?zn(n)?t.removeAttributeNS(Wn,jn(e)):t.setAttributeNS(Wn,e,n):bi(t,e,n)}function bi(t,e,n){if(zn(n))t.removeAttribute(e);else{if(q&&!Z&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var i=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",i)};t.addEventListener("input",i),t.__ieph=!0}t.setAttribute(e,n)}}var Ti={create:_i,update:_i};function Ei(t,e){var n=e.elm,o=e.data,s=t.data;if(!(i(o.staticClass)&&i(o.class)&&(i(s)||i(s.staticClass)&&i(s.class)))){var a=$n(e),l=n._transitionClasses;r(l)&&(a=Yn(a,Kn(l))),a!==n._prevClass&&(n.setAttribute("class",a),n._prevClass=a)}}var Ci,Si,wi,ki,xi,Ii,Ri={create:Ei,update:Ei},Oi=/[\w).+\-_$\]]/;function Di(t){var e,n,i,r,o,s=!1,a=!1,l=!1,u=!1,c=0,h=0,p=0,d=0;for(i=0;i<t.length;i++)if(n=e,e=t.charCodeAt(i),s)39===e&&92!==n&&(s=!1);else if(a)34===e&&92!==n&&(a=!1);else if(l)96===e&&92!==n&&(l=!1);else if(u)47===e&&92!==n&&(u=!1);else if(124!==e||124===t.charCodeAt(i+1)||124===t.charCodeAt(i-1)||c||h||p){switch(e){case 34:a=!0;break;case 39:s=!0;break;case 96:l=!0;break;case 40:p++;break;case 41:p--;break;case 91:h++;break;case 93:h--;break;case 123:c++;break;case 125:c--}if(47===e){for(var f=i-1,g=void 0;f>=0&&" "===(g=t.charAt(f));f--);g&&Oi.test(g)||(u=!0)}}else void 0===r?(d=i+1,r=t.slice(0,i).trim()):m();function m(){(o||(o=[])).push(t.slice(d,i).trim()),d=i+1}if(void 0===r?r=t.slice(0,i).trim():0!==d&&m(),o)for(i=0;i<o.length;i++)r=Ai(r,o[i]);return r}function Ai(t,e){var n=e.indexOf("(");if(n<0)return'_f("'+e+'")('+t+")";var i=e.slice(0,n),r=e.slice(n+1);return'_f("'+i+'")('+t+(")"!==r?","+r:r)}function Mi(t,e){console.error("[Vue compiler]: "+t)}function Ni(t,e){return t?t.map(function(t){return t[e]}).filter(function(t){return t}):[]}function Li(t,e,n,i,r){(t.props||(t.props=[])).push(zi({name:e,value:n,dynamic:r},i)),t.plain=!1}function Pi(t,e,n,i,r){(r?t.dynamicAttrs||(t.dynamicAttrs=[]):t.attrs||(t.attrs=[])).push(zi({name:e,value:n,dynamic:r},i)),t.plain=!1}function Bi(t,e,n,i){t.attrsMap[e]=n,t.attrsList.push(zi({name:e,value:n},i))}function Fi(t,e,n,i,r,o,s,a){(t.directives||(t.directives=[])).push(zi({name:e,rawName:n,value:i,arg:r,isDynamicArg:o,modifiers:s},a)),t.plain=!1}function Ui(t,e,n){return n?"_p("+e+',"'+t+'")':t+e}function Vi(t,e,i,r,o,s,a,l){var u;(r=r||n).right?l?e="("+e+")==='click'?'contextmenu':("+e+")":"click"===e&&(e="contextmenu",delete r.right):r.middle&&(l?e="("+e+")==='click'?'mouseup':("+e+")":"click"===e&&(e="mouseup")),r.capture&&(delete r.capture,e=Ui("!",e,l)),r.once&&(delete r.once,e=Ui("~",e,l)),r.passive&&(delete r.passive,e=Ui("&",e,l)),r.native?(delete r.native,u=t.nativeEvents||(t.nativeEvents={})):u=t.events||(t.events={});var c=zi({value:i.trim(),dynamic:l},a);r!==n&&(c.modifiers=r);var h=u[e];Array.isArray(h)?o?h.unshift(c):h.push(c):u[e]=h?o?[c,h]:[h,c]:c,t.plain=!1}function Hi(t,e){return t.rawAttrsMap[":"+e]||t.rawAttrsMap["v-bind:"+e]||t.rawAttrsMap[e]}function Wi(t,e,n){var i=Gi(t,":"+e)||Gi(t,"v-bind:"+e);if(null!=i)return Di(i);if(!1!==n){var r=Gi(t,e);if(null!=r)return JSON.stringify(r)}}function Gi(t,e,n){var i;if(null!=(i=t.attrsMap[e]))for(var r=t.attrsList,o=0,s=r.length;o<s;o++)if(r[o].name===e){r.splice(o,1);break}return n&&delete t.attrsMap[e],i}function ji(t,e){for(var n=t.attrsList,i=0,r=n.length;i<r;i++){var o=n[i];if(e.test(o.name))return n.splice(i,1),o}}function zi(t,e){return e&&(null!=e.start&&(t.start=e.start),null!=e.end&&(t.end=e.end)),t}function $i(t,e,n){var i=n||{},r=i.number,o="$$v";i.trim&&(o="(typeof $$v === 'string'? $$v.trim(): $$v)"),r&&(o="_n("+o+")");var s=Xi(e,o);t.model={value:"("+e+")",expression:JSON.stringify(e),callback:"function ($$v) {"+s+"}"}}function Xi(t,e){var n=function(t){if(t=t.trim(),Ci=t.length,t.indexOf("[")<0||t.lastIndexOf("]")<Ci-1)return(ki=t.lastIndexOf("."))>-1?{exp:t.slice(0,ki),key:'"'+t.slice(ki+1)+'"'}:{exp:t,key:null};Si=t,ki=xi=Ii=0;for(;!Ki();)Ji(wi=Yi())?Zi(wi):91===wi&&qi(wi);return{exp:t.slice(0,xi),key:t.slice(xi+1,Ii)}}(t);return null===n.key?t+"="+e:"$set("+n.exp+", "+n.key+", "+e+")"}function Yi(){return Si.charCodeAt(++ki)}function Ki(){return ki>=Ci}function Ji(t){return 34===t||39===t}function qi(t){var e=1;for(xi=ki;!Ki();)if(Ji(t=Yi()))Zi(t);else if(91===t&&e++,93===t&&e--,0===e){Ii=ki;break}}function Zi(t){for(var e=t;!Ki()&&(t=Yi())!==e;);}var Qi,tr="__r",er="__c";function nr(t,e,n){var i=Qi;return function r(){null!==e.apply(null,arguments)&&or(t,r,n,i)}}var ir=Kt&&!(et&&Number(et[1])<=53);function rr(t,e,n,i){if(ir){var r=hn,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=r||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Qi.addEventListener(t,e,it?{capture:n,passive:i}:n)}function or(t,e,n,i){(i||Qi).removeEventListener(t,e._wrapper||e,n)}function sr(t,e){if(!i(t.data.on)||!i(e.data.on)){var n=e.data.on||{},o=t.data.on||{};Qi=e.elm,function(t){if(r(t[tr])){var e=q?"change":"input";t[e]=[].concat(t[tr],t[e]||[]),delete t[tr]}r(t[er])&&(t.change=[].concat(t[er],t.change||[]),delete t[er])}(n),le(n,o,rr,or,nr,e.context),Qi=void 0}}var ar,lr={create:sr,update:sr};function ur(t,e){if(!i(t.data.domProps)||!i(e.data.domProps)){var n,o,s=e.elm,a=t.data.domProps||{},l=e.data.domProps||{};for(n in r(l.__ob__)&&(l=e.data.domProps=R({},l)),a)n in l||(s[n]="");for(n in l){if(o=l[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),o===a[n])continue;1===s.childNodes.length&&s.removeChild(s.childNodes[0])}if("value"===n&&"PROGRESS"!==s.tagName){s._value=o;var u=i(o)?"":String(o);cr(s,u)&&(s.value=u)}else if("innerHTML"===n&&Zn(s.tagName)&&i(s.innerHTML)){(ar=ar||document.createElement("div")).innerHTML="<svg>"+o+"</svg>";for(var c=ar.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}else if(o!==a[n])try{s[n]=o}catch(t){}}}}function cr(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,i=t._vModifiers;if(r(i)){if(i.number)return f(n)!==f(e);if(i.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var hr={create:ur,update:ur},pr=T(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var i=t.split(n);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e});function dr(t){var e=fr(t.style);return t.staticStyle?R(t.staticStyle,e):e}function fr(t){return Array.isArray(t)?O(t):"string"==typeof t?pr(t):t}var gr,mr=/^--/,vr=/\s*!important$/,_r=function(t,e,n){if(mr.test(e))t.style.setProperty(e,n);else if(vr.test(n))t.style.setProperty(k(e),n.replace(vr,""),"important");else{var i=br(e);if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++)t.style[i]=n[r];else t.style[i]=n}},yr=["Webkit","Moz","ms"],br=T(function(t){if(gr=gr||document.createElement("div").style,"filter"!==(t=C(t))&&t in gr)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n<yr.length;n++){var i=yr[n]+e;if(i in gr)return i}});function Tr(t,e){var n=e.data,o=t.data;if(!(i(n.staticStyle)&&i(n.style)&&i(o.staticStyle)&&i(o.style))){var s,a,l=e.elm,u=o.staticStyle,c=o.normalizedStyle||o.style||{},h=u||c,p=fr(e.data.style)||{};e.data.normalizedStyle=r(p.__ob__)?R({},p):p;var d=function(t,e){var n,i={};if(e)for(var r=t;r.componentInstance;)(r=r.componentInstance._vnode)&&r.data&&(n=dr(r.data))&&R(i,n);(n=dr(t.data))&&R(i,n);for(var o=t;o=o.parent;)o.data&&(n=dr(o.data))&&R(i,n);return i}(e,!0);for(a in h)i(d[a])&&_r(l,a,"");for(a in d)(s=d[a])!==h[a]&&_r(l,a,null==s?"":s)}}var Er={create:Tr,update:Tr},Cr=/\s+/;function Sr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Cr).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function wr(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(Cr).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function kr(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&R(e,xr(t.name||"v")),R(e,t),e}return"string"==typeof t?xr(t):void 0}}var xr=T(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Ir=X&&!Z,Rr="transition",Or="animation",Dr="transition",Ar="transitionend",Mr="animation",Nr="animationend";Ir&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Dr="WebkitTransition",Ar="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Mr="WebkitAnimation",Nr="webkitAnimationEnd"));var Lr=X?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Pr(t){Lr(function(){Lr(t)})}function Br(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Sr(t,e))}function Fr(t,e){t._transitionClasses&&_(t._transitionClasses,e),wr(t,e)}function Ur(t,e,n){var i=Hr(t,e),r=i.type,o=i.timeout,s=i.propCount;if(!r)return n();var a=r===Rr?Ar:Nr,l=0,u=function(){t.removeEventListener(a,c),n()},c=function(e){e.target===t&&++l>=s&&u()};setTimeout(function(){l<s&&u()},o+1),t.addEventListener(a,c)}var Vr=/\b(transform|all)(,|$)/;function Hr(t,e){var n,i=window.getComputedStyle(t),r=(i[Dr+"Delay"]||"").split(", "),o=(i[Dr+"Duration"]||"").split(", "),s=Wr(r,o),a=(i[Mr+"Delay"]||"").split(", "),l=(i[Mr+"Duration"]||"").split(", "),u=Wr(a,l),c=0,h=0;return e===Rr?s>0&&(n=Rr,c=s,h=o.length):e===Or?u>0&&(n=Or,c=u,h=l.length):h=(n=(c=Math.max(s,u))>0?s>u?Rr:Or:null)?n===Rr?o.length:l.length:0,{type:n,timeout:c,propCount:h,hasTransform:n===Rr&&Vr.test(i[Dr+"Property"])}}function Wr(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max.apply(null,e.map(function(e,n){return Gr(e)+Gr(t[n])}))}function Gr(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}function jr(t,e){var n=t.elm;r(n._leaveCb)&&(n._leaveCb.cancelled=!0,n._leaveCb());var o=kr(t.data.transition);if(!i(o)&&!r(n._enterCb)&&1===n.nodeType){for(var s=o.css,l=o.type,u=o.enterClass,c=o.enterToClass,h=o.enterActiveClass,p=o.appearClass,d=o.appearToClass,g=o.appearActiveClass,m=o.beforeEnter,v=o.enter,_=o.afterEnter,y=o.enterCancelled,b=o.beforeAppear,T=o.appear,E=o.afterAppear,C=o.appearCancelled,S=o.duration,w=Qe,k=Qe.$vnode;k&&k.parent;)w=k.context,k=k.parent;var x=!w._isMounted||!t.isRootInsert;if(!x||T||""===T){var I=x&&p?p:u,R=x&&g?g:h,O=x&&d?d:c,D=x&&b||m,A=x&&"function"==typeof T?T:v,M=x&&E||_,N=x&&C||y,L=f(a(S)?S.enter:S);0;var B=!1!==s&&!Z,F=Xr(A),U=n._enterCb=P(function(){B&&(Fr(n,O),Fr(n,R)),U.cancelled?(B&&Fr(n,I),N&&N(n)):M&&M(n),n._enterCb=null});t.data.show||ue(t,"insert",function(){var e=n.parentNode,i=e&&e._pending&&e._pending[t.key];i&&i.tag===t.tag&&i.elm._leaveCb&&i.elm._leaveCb(),A&&A(n,U)}),D&&D(n),B&&(Br(n,I),Br(n,R),Pr(function(){Fr(n,I),U.cancelled||(Br(n,O),F||($r(L)?setTimeout(U,L):Ur(n,l,U)))})),t.data.show&&(e&&e(),A&&A(n,U)),B||F||U()}}}function zr(t,e){var n=t.elm;r(n._enterCb)&&(n._enterCb.cancelled=!0,n._enterCb());var o=kr(t.data.transition);if(i(o)||1!==n.nodeType)return e();if(!r(n._leaveCb)){var s=o.css,l=o.type,u=o.leaveClass,c=o.leaveToClass,h=o.leaveActiveClass,p=o.beforeLeave,d=o.leave,g=o.afterLeave,m=o.leaveCancelled,v=o.delayLeave,_=o.duration,y=!1!==s&&!Z,b=Xr(d),T=f(a(_)?_.leave:_);0;var E=n._leaveCb=P(function(){n.parentNode&&n.parentNode._pending&&(n.parentNode._pending[t.key]=null),y&&(Fr(n,c),Fr(n,h)),E.cancelled?(y&&Fr(n,u),m&&m(n)):(e(),g&&g(n)),n._leaveCb=null});v?v(C):C()}function C(){E.cancelled||(!t.data.show&&n.parentNode&&((n.parentNode._pending||(n.parentNode._pending={}))[t.key]=t),p&&p(n),y&&(Br(n,u),Br(n,h),Pr(function(){Fr(n,u),E.cancelled||(Br(n,c),b||($r(T)?setTimeout(E,T):Ur(n,l,E)))})),d&&d(n,E),y||b||E())}}function $r(t){return"number"==typeof t&&!isNaN(t)}function Xr(t){if(i(t))return!1;var e=t.fns;return r(e)?Xr(Array.isArray(e)?e[0]:e):(t._length||t.length)>1}function Yr(t,e){!0!==e.data.show&&jr(e)}var Kr=function(t){var e,n,a={},l=t.modules,u=t.nodeOps;for(e=0;e<li.length;++e)for(a[li[e]]=[],n=0;n<l.length;++n)r(l[n][li[e]])&&a[li[e]].push(l[n][li[e]]);function c(t){var e=u.parentNode(t);r(e)&&u.removeChild(e,t)}function h(t,e,n,i,s,l,c){if(r(t.elm)&&r(l)&&(t=l[c]=bt(t)),t.isRootInsert=!s,!function(t,e,n,i){var s=t.data;if(r(s)){var l=r(t.componentInstance)&&s.keepAlive;if(r(s=s.hook)&&r(s=s.init)&&s(t,!1),r(t.componentInstance))return p(t,e),d(n,t.elm,i),o(l)&&function(t,e,n,i){for(var o,s=t;s.componentInstance;)if(s=s.componentInstance._vnode,r(o=s.data)&&r(o=o.transition)){for(o=0;o<a.activate.length;++o)a.activate[o](ai,s);e.push(s);break}d(n,t.elm,i)}(t,e,n,i),!0}}(t,e,n,i)){var h=t.data,g=t.children,m=t.tag;r(m)?(t.elm=t.ns?u.createElementNS(t.ns,m):u.createElement(m,t),_(t),f(t,g,e),r(h)&&v(t,e),d(n,t.elm,i)):o(t.isComment)?(t.elm=u.createComment(t.text),d(n,t.elm,i)):(t.elm=u.createTextNode(t.text),d(n,t.elm,i))}}function p(t,e){r(t.data.pendingInsert)&&(e.push.apply(e,t.data.pendingInsert),t.data.pendingInsert=null),t.elm=t.componentInstance.$el,m(t)?(v(t,e),_(t)):(si(t),e.push(t))}function d(t,e,n){r(t)&&(r(n)?u.parentNode(n)===t&&u.insertBefore(t,e,n):u.appendChild(t,e))}function f(t,e,n){if(Array.isArray(e))for(var i=0;i<e.length;++i)h(e[i],n,t.elm,null,!0,e,i);else s(t.text)&&u.appendChild(t.elm,u.createTextNode(String(t.text)))}function m(t){for(;t.componentInstance;)t=t.componentInstance._vnode;return r(t.tag)}function v(t,n){for(var i=0;i<a.create.length;++i)a.create[i](ai,t);r(e=t.data.hook)&&(r(e.create)&&e.create(ai,t),r(e.insert)&&n.push(t))}function _(t){var e;if(r(e=t.fnScopeId))u.setStyleScope(t.elm,e);else for(var n=t;n;)r(e=n.context)&&r(e=e.$options._scopeId)&&u.setStyleScope(t.elm,e),n=n.parent;r(e=Qe)&&e!==t.context&&e!==t.fnContext&&r(e=e.$options._scopeId)&&u.setStyleScope(t.elm,e)}function y(t,e,n,i,r,o){for(;i<=r;++i)h(n[i],o,t,e,!1,n,i)}function b(t){var e,n,i=t.data;if(r(i))for(r(e=i.hook)&&r(e=e.destroy)&&e(t),e=0;e<a.destroy.length;++e)a.destroy[e](t);if(r(e=t.children))for(n=0;n<t.children.length;++n)b(t.children[n])}function T(t,e,n){for(;e<=n;++e){var i=t[e];r(i)&&(r(i.tag)?(E(i),b(i)):c(i.elm))}}function E(t,e){if(r(e)||r(t.data)){var n,i=a.remove.length+1;for(r(e)?e.listeners+=i:e=function(t,e){function n(){0==--n.listeners&&c(t)}return n.listeners=e,n}(t.elm,i),r(n=t.componentInstance)&&r(n=n._vnode)&&r(n.data)&&E(n,e),n=0;n<a.remove.length;++n)a.remove[n](t,e);r(n=t.data.hook)&&r(n=n.remove)?n(t,e):e()}else c(t.elm)}function C(t,e,n,i){for(var o=n;o<i;o++){var s=e[o];if(r(s)&&ui(t,s))return o}}function S(t,e,n,s,l,c){if(t!==e){r(e.elm)&&r(s)&&(e=s[l]=bt(e));var p=e.elm=t.elm;if(o(t.isAsyncPlaceholder))r(e.asyncFactory.resolved)?x(t.elm,e,n):e.isAsyncPlaceholder=!0;else if(o(e.isStatic)&&o(t.isStatic)&&e.key===t.key&&(o(e.isCloned)||o(e.isOnce)))e.componentInstance=t.componentInstance;else{var d,f=e.data;r(f)&&r(d=f.hook)&&r(d=d.prepatch)&&d(t,e);var g=t.children,v=e.children;if(r(f)&&m(e)){for(d=0;d<a.update.length;++d)a.update[d](t,e);r(d=f.hook)&&r(d=d.update)&&d(t,e)}i(e.text)?r(g)&&r(v)?g!==v&&function(t,e,n,o,s){for(var a,l,c,p=0,d=0,f=e.length-1,g=e[0],m=e[f],v=n.length-1,_=n[0],b=n[v],E=!s;p<=f&&d<=v;)i(g)?g=e[++p]:i(m)?m=e[--f]:ui(g,_)?(S(g,_,o,n,d),g=e[++p],_=n[++d]):ui(m,b)?(S(m,b,o,n,v),m=e[--f],b=n[--v]):ui(g,b)?(S(g,b,o,n,v),E&&u.insertBefore(t,g.elm,u.nextSibling(m.elm)),g=e[++p],b=n[--v]):ui(m,_)?(S(m,_,o,n,d),E&&u.insertBefore(t,m.elm,g.elm),m=e[--f],_=n[++d]):(i(a)&&(a=ci(e,p,f)),i(l=r(_.key)?a[_.key]:C(_,e,p,f))?h(_,o,t,g.elm,!1,n,d):ui(c=e[l],_)?(S(c,_,o,n,d),e[l]=void 0,E&&u.insertBefore(t,c.elm,g.elm)):h(_,o,t,g.elm,!1,n,d),_=n[++d]);p>f?y(t,i(n[v+1])?null:n[v+1].elm,n,d,v,o):d>v&&T(e,p,f)}(p,g,v,n,c):r(v)?(r(t.text)&&u.setTextContent(p,""),y(p,null,v,0,v.length-1,n)):r(g)?T(g,0,g.length-1):r(t.text)&&u.setTextContent(p,""):t.text!==e.text&&u.setTextContent(p,e.text),r(f)&&r(d=f.hook)&&r(d=d.postpatch)&&d(t,e)}}}function w(t,e,n){if(o(n)&&r(t.parent))t.parent.data.pendingInsert=e;else for(var i=0;i<e.length;++i)e[i].data.hook.insert(e[i])}var k=g("attrs,class,staticClass,staticStyle,key");function x(t,e,n,i){var s,a=e.tag,l=e.data,u=e.children;if(i=i||l&&l.pre,e.elm=t,o(e.isComment)&&r(e.asyncFactory))return e.isAsyncPlaceholder=!0,!0;if(r(l)&&(r(s=l.hook)&&r(s=s.init)&&s(e,!0),r(s=e.componentInstance)))return p(e,n),!0;if(r(a)){if(r(u))if(t.hasChildNodes())if(r(s=l)&&r(s=s.domProps)&&r(s=s.innerHTML)){if(s!==t.innerHTML)return!1}else{for(var c=!0,h=t.firstChild,d=0;d<u.length;d++){if(!h||!x(h,u[d],n,i)){c=!1;break}h=h.nextSibling}if(!c||h)return!1}else f(e,u,n);if(r(l)){var g=!1;for(var m in l)if(!k(m)){g=!0,v(e,n);break}!g&&l.class&&oe(l.class)}}else t.data!==e.text&&(t.data=e.text);return!0}return function(t,e,n,s){if(!i(e)){var l,c=!1,p=[];if(i(t))c=!0,h(e,p);else{var d=r(t.nodeType);if(!d&&ui(t,e))S(t,e,p,null,null,s);else{if(d){if(1===t.nodeType&&t.hasAttribute(B)&&(t.removeAttribute(B),n=!0),o(n)&&x(t,e,p))return w(e,p,!0),t;l=t,t=new mt(u.tagName(l).toLowerCase(),{},[],void 0,l)}var f=t.elm,g=u.parentNode(f);if(h(e,p,f._leaveCb?null:g,u.nextSibling(f)),r(e.parent))for(var v=e.parent,_=m(e);v;){for(var y=0;y<a.destroy.length;++y)a.destroy[y](v);if(v.elm=e.elm,_){for(var E=0;E<a.create.length;++E)a.create[E](ai,v);var C=v.data.hook.insert;if(C.merged)for(var k=1;k<C.fns.length;k++)C.fns[k]()}else si(v);v=v.parent}r(g)?T([t],0,0):r(t.tag)&&b(t)}}return w(e,p,c),e.elm}r(t)&&b(t)}}({nodeOps:ri,modules:[Ti,Ri,lr,hr,Er,X?{create:Yr,activate:Yr,remove:function(t,e){!0!==t.data.show?zr(t,e):e()}}:{}].concat(vi)});Z&&document.addEventListener("selectionchange",function(){var t=document.activeElement;t&&t.vmodel&&io(t,"input")});var Jr={inserted:function(t,e,n,i){"select"===n.tag?(i.elm&&!i.elm._vOptions?ue(n,"postpatch",function(){Jr.componentUpdated(t,e,n)}):qr(t,e,n.context),t._vOptions=[].map.call(t.options,to)):("textarea"===n.tag||ni(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",eo),t.addEventListener("compositionend",no),t.addEventListener("change",no),Z&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){qr(t,e,n.context);var i=t._vOptions,r=t._vOptions=[].map.call(t.options,to);if(r.some(function(t,e){return!N(t,i[e])}))(t.multiple?e.value.some(function(t){return Qr(t,r)}):e.value!==e.oldValue&&Qr(e.value,r))&&io(t,"change")}}};function qr(t,e,n){Zr(t,e,n),(q||Q)&&setTimeout(function(){Zr(t,e,n)},0)}function Zr(t,e,n){var i=e.value,r=t.multiple;if(!r||Array.isArray(i)){for(var o,s,a=0,l=t.options.length;a<l;a++)if(s=t.options[a],r)o=L(i,to(s))>-1,s.selected!==o&&(s.selected=o);else if(N(to(s),i))return void(t.selectedIndex!==a&&(t.selectedIndex=a));r||(t.selectedIndex=-1)}}function Qr(t,e){return e.every(function(e){return!N(e,t)})}function to(t){return"_value"in t?t._value:t.value}function eo(t){t.target.composing=!0}function no(t){t.target.composing&&(t.target.composing=!1,io(t.target,"input"))}function io(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function ro(t){return!t.componentInstance||t.data&&t.data.transition?t:ro(t.componentInstance._vnode)}var oo={model:Jr,show:{bind:function(t,e,n){var i=e.value,r=(n=ro(n)).data&&n.data.transition,o=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;i&&r?(n.data.show=!0,jr(n,function(){t.style.display=o})):t.style.display=i?o:"none"},update:function(t,e,n){var i=e.value;!i!=!e.oldValue&&((n=ro(n)).data&&n.data.transition?(n.data.show=!0,i?jr(n,function(){t.style.display=t.__vOriginalDisplay}):zr(n,function(){t.style.display="none"})):t.style.display=i?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,i,r){r||(t.style.display=t.__vOriginalDisplay)}}},so={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ao(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?ao(Ye(e.children)):t}function lo(t){var e={},n=t.$options;for(var i in n.propsData)e[i]=t[i];var r=n._parentListeners;for(var o in r)e[C(o)]=r[o];return e}function uo(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var co=function(t){return t.tag||me(t)},ho=function(t){return"show"===t.name},po={name:"transition",props:so,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(co)).length){0;var i=this.mode;0;var r=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return r;var o=ao(r);if(!o)return r;if(this._leaving)return uo(t,r);var a="__transition-"+this._uid+"-";o.key=null==o.key?o.isComment?a+"comment":a+o.tag:s(o.key)?0===String(o.key).indexOf(a)?o.key:a+o.key:o.key;var l=(o.data||(o.data={})).transition=lo(this),u=this._vnode,c=ao(u);if(o.data.directives&&o.data.directives.some(ho)&&(o.data.show=!0),c&&c.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(o,c)&&!me(c)&&(!c.componentInstance||!c.componentInstance._vnode.isComment)){var h=c.data.transition=R({},l);if("out-in"===i)return this._leaving=!0,ue(h,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),uo(t,r);if("in-out"===i){if(me(o))return u;var p,d=function(){p()};ue(l,"afterEnter",d),ue(l,"enterCancelled",d),ue(h,"delayLeave",function(t){p=t})}}return r}}},fo=R({tag:String,moveClass:String},so);function go(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function mo(t){t.data.newPos=t.elm.getBoundingClientRect()}function vo(t){var e=t.data.pos,n=t.data.newPos,i=e.left-n.left,r=e.top-n.top;if(i||r){t.data.moved=!0;var o=t.elm.style;o.transform=o.WebkitTransform="translate("+i+"px,"+r+"px)",o.transitionDuration="0s"}}delete fo.mode;var _o={Transition:po,TransitionGroup:{props:fo,beforeMount:function(){var t=this,e=this._update;this._update=function(n,i){var r=tn(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,r(),e.call(t,n,i)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),i=this.prevChildren=this.children,r=this.$slots.default||[],o=this.children=[],s=lo(this),a=0;a<r.length;a++){var l=r[a];if(l.tag)if(null!=l.key&&0!==String(l.key).indexOf("__vlist"))o.push(l),n[l.key]=l,(l.data||(l.data={})).transition=s;else;}if(i){for(var u=[],c=[],h=0;h<i.length;h++){var p=i[h];p.data.transition=s,p.data.pos=p.elm.getBoundingClientRect(),n[p.key]?u.push(p):c.push(p)}this.kept=t(e,null,u),this.removed=c}return t(e,null,o)},updated:function(){var t=this.prevChildren,e=this.moveClass||(this.name||"v")+"-move";t.length&&this.hasMove(t[0].elm,e)&&(t.forEach(go),t.forEach(mo),t.forEach(vo),this._reflow=document.body.offsetHeight,t.forEach(function(t){if(t.data.moved){var n=t.elm,i=n.style;Br(n,e),i.transform=i.WebkitTransform=i.transitionDuration="",n.addEventListener(Ar,n._moveCb=function t(i){i&&i.target!==n||i&&!/transform$/.test(i.propertyName)||(n.removeEventListener(Ar,t),n._moveCb=null,Fr(n,e))})}}))},methods:{hasMove:function(t,e){if(!Ir)return!1;if(this._hasMove)return this._hasMove;var n=t.cloneNode();t._transitionClasses&&t._transitionClasses.forEach(function(t){wr(n,t)}),Sr(n,e),n.style.display="none",this.$el.appendChild(n);var i=Hr(n);return this.$el.removeChild(n),this._hasMove=i.hasTransform}}}};xn.config.mustUseProp=Bn,xn.config.isReservedTag=Qn,xn.config.isReservedAttr=Ln,xn.config.getTagNamespace=ti,xn.config.isUnknownElement=function(t){if(!X)return!0;if(Qn(t))return!1;if(t=t.toLowerCase(),null!=ei[t])return ei[t];var e=document.createElement(t);return t.indexOf("-")>-1?ei[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:ei[t]=/HTMLUnknownElement/.test(e.toString())},R(xn.options.directives,oo),R(xn.options.components,_o),xn.prototype.__patch__=X?Kr:D,xn.prototype.$mount=function(t,e){return function(t,e,n){return t.$el=e,t.$options.render||(t.$options.render=_t),rn(t,"beforeMount"),new mn(t,function(){t._update(t._render(),n)},D,{before:function(){t._isMounted&&!t._isDestroyed&&rn(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,rn(t,"mounted")),t}(this,t=t&&X?ii(t):void 0,e)},X&&setTimeout(function(){V.devtools&&st&&st.emit("init",xn)},0);var yo=/\{\{((?:.|\r?\n)+?)\}\}/g,bo=/[-.*+?^${}()|[\]\/\\]/g,To=T(function(t){var e=t[0].replace(bo,"\\$&"),n=t[1].replace(bo,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")});function Eo(t,e){var n=e?To(e):yo;if(n.test(t)){for(var i,r,o,s=[],a=[],l=n.lastIndex=0;i=n.exec(t);){(r=i.index)>l&&(a.push(o=t.slice(l,r)),s.push(JSON.stringify(o)));var u=Di(i[1].trim());s.push("_s("+u+")"),a.push({"@binding":u}),l=r+i[0].length}return l<t.length&&(a.push(o=t.slice(l)),s.push(JSON.stringify(o))),{expression:s.join("+"),tokens:a}}}var Co={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;var n=Gi(t,"class");n&&(t.staticClass=JSON.stringify(n));var i=Wi(t,"class",!1);i&&(t.classBinding=i)},genData:function(t){var e="";return t.staticClass&&(e+="staticClass:"+t.staticClass+","),t.classBinding&&(e+="class:"+t.classBinding+","),e}};var So,wo={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;var n=Gi(t,"style");n&&(t.staticStyle=JSON.stringify(pr(n)));var i=Wi(t,"style",!1);i&&(t.styleBinding=i)},genData:function(t){var e="";return t.staticStyle&&(e+="staticStyle:"+t.staticStyle+","),t.styleBinding&&(e+="style:("+t.styleBinding+"),"),e}},ko=function(t){return(So=So||document.createElement("div")).innerHTML=t,So.textContent},xo=g("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),Io=g("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),Ro=g("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),Oo=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Do=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ao="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+H.source+"]*",Mo="((?:"+Ao+"\\:)?"+Ao+")",No=new RegExp("^<"+Mo),Lo=/^\s*(\/?)>/,Po=new RegExp("^<\\/"+Mo+"[^>]*>"),Bo=/^<!DOCTYPE [^>]+>/i,Fo=/^<!\--/,Uo=/^<!\[/,Vo=g("script,style,textarea",!0),Ho={},Wo={"&lt;":"<","&gt;":">","&quot;":'"',"&amp;":"&","&#10;":"\n","&#9;":"\t","&#39;":"'"},Go=/&(?:lt|gt|quot|amp|#39);/g,jo=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,zo=g("pre,textarea",!0),$o=function(t,e){return t&&zo(t)&&"\n"===e[0]};function Xo(t,e){var n=e?jo:Go;return t.replace(n,function(t){return Wo[t]})}var Yo,Ko,Jo,qo,Zo,Qo,ts,es,ns=/^@|^v-on:/,is=/^v-|^@|^:|^#/,rs=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,os=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ss=/^\(|\)$/g,as=/^\[.*\]$/,ls=/:(.*)$/,us=/^:|^\.|^v-bind:/,cs=/\.[^.\]]+(?=[^\]]*$)/g,hs=/^v-slot(:|$)|^#/,ps=/[\r\n]/,ds=/[ \f\t\r\n]+/g,fs=T(ko),gs="_empty_";function ms(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:function(t){for(var e={},n=0,i=t.length;n<i;n++)e[t[n].name]=t[n].value;return e}(e),rawAttrsMap:{},parent:n,children:[]}}function vs(t,e){Yo=e.warn||Mi,Qo=e.isPreTag||A,ts=e.mustUseProp||A,es=e.getTagNamespace||A;var n=e.isReservedTag||A;(function(t){return!(!(t.component||t.attrsMap[":is"]||t.attrsMap["v-bind:is"])&&(t.attrsMap.is?n(t.attrsMap.is):n(t.tag)))}),Jo=Ni(e.modules,"transformNode"),qo=Ni(e.modules,"preTransformNode"),Zo=Ni(e.modules,"postTransformNode"),Ko=e.delimiters;var i,r,o=[],s=!1!==e.preserveWhitespace,a=e.whitespace,l=!1,u=!1;function c(t){if(h(t),l||t.processed||(t=_s(t,e)),o.length||t===i||i.if&&(t.elseif||t.else)&&bs(i,{exp:t.elseif,block:t}),r&&!t.forbidden)if(t.elseif||t.else)s=t,(a=function(t){var e=t.length;for(;e--;){if(1===t[e].type)return t[e];t.pop()}}(r.children))&&a.if&&bs(a,{exp:s.elseif,block:s});else{if(t.slotScope){var n=t.slotTarget||'"default"';(r.scopedSlots||(r.scopedSlots={}))[n]=t}r.children.push(t),t.parent=r}var s,a;t.children=t.children.filter(function(t){return!t.slotScope}),h(t),t.pre&&(l=!1),Qo(t.tag)&&(u=!1);for(var c=0;c<Zo.length;c++)Zo[c](t,e)}function h(t){if(!u)for(var e;(e=t.children[t.children.length-1])&&3===e.type&&" "===e.text;)t.children.pop()}return function(t,e){for(var n,i,r=[],o=e.expectHTML,s=e.isUnaryTag||A,a=e.canBeLeftOpenTag||A,l=0;t;){if(n=t,i&&Vo(i)){var u=0,c=i.toLowerCase(),h=Ho[c]||(Ho[c]=new RegExp("([\\s\\S]*?)(</"+c+"[^>]*>)","i")),p=t.replace(h,function(t,n,i){return u=i.length,Vo(c)||"noscript"===c||(n=n.replace(/<!\--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),$o(c,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""});l+=t.length-p.length,t=p,k(c,l-u,l)}else{var d=t.indexOf("<");if(0===d){if(Fo.test(t)){var f=t.indexOf("--\x3e");if(f>=0){e.shouldKeepComment&&e.comment(t.substring(4,f),l,l+f+3),C(f+3);continue}}if(Uo.test(t)){var g=t.indexOf("]>");if(g>=0){C(g+2);continue}}var m=t.match(Bo);if(m){C(m[0].length);continue}var v=t.match(Po);if(v){var _=l;C(v[0].length),k(v[1],_,l);continue}var y=S();if(y){w(y),$o(y.tagName,t)&&C(1);continue}}var b=void 0,T=void 0,E=void 0;if(d>=0){for(T=t.slice(d);!(Po.test(T)||No.test(T)||Fo.test(T)||Uo.test(T)||(E=T.indexOf("<",1))<0);)d+=E,T=t.slice(d);b=t.substring(0,d)}d<0&&(b=t),b&&C(b.length),e.chars&&b&&e.chars(b,l-b.length,l)}if(t===n){e.chars&&e.chars(t);break}}function C(e){l+=e,t=t.substring(e)}function S(){var e=t.match(No);if(e){var n,i,r={tagName:e[1],attrs:[],start:l};for(C(e[0].length);!(n=t.match(Lo))&&(i=t.match(Do)||t.match(Oo));)i.start=l,C(i[0].length),i.end=l,r.attrs.push(i);if(n)return r.unarySlash=n[1],C(n[0].length),r.end=l,r}}function w(t){var n=t.tagName,l=t.unarySlash;o&&("p"===i&&Ro(n)&&k(i),a(n)&&i===n&&k(n));for(var u=s(n)||!!l,c=t.attrs.length,h=new Array(c),p=0;p<c;p++){var d=t.attrs[p],f=d[3]||d[4]||d[5]||"",g="a"===n&&"href"===d[1]?e.shouldDecodeNewlinesForHref:e.shouldDecodeNewlines;h[p]={name:d[1],value:Xo(f,g)}}u||(r.push({tag:n,lowerCasedTag:n.toLowerCase(),attrs:h,start:t.start,end:t.end}),i=n),e.start&&e.start(n,h,u,t.start,t.end)}function k(t,n,o){var s,a;if(null==n&&(n=l),null==o&&(o=l),t)for(a=t.toLowerCase(),s=r.length-1;s>=0&&r[s].lowerCasedTag!==a;s--);else s=0;if(s>=0){for(var u=r.length-1;u>=s;u--)e.end&&e.end(r[u].tag,n,o);r.length=s,i=s&&r[s-1].tag}else"br"===a?e.start&&e.start(t,[],!0,n,o):"p"===a&&(e.start&&e.start(t,[],!1,n,o),e.end&&e.end(t,n,o))}k()}(t,{warn:Yo,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start:function(t,n,s,a,h){var p=r&&r.ns||es(t);q&&"svg"===p&&(n=function(t){for(var e=[],n=0;n<t.length;n++){var i=t[n];Cs.test(i.name)||(i.name=i.name.replace(Ss,""),e.push(i))}return e}(n));var d,f=ms(t,n,r);p&&(f.ns=p),"style"!==(d=f).tag&&("script"!==d.tag||d.attrsMap.type&&"text/javascript"!==d.attrsMap.type)||ot()||(f.forbidden=!0);for(var g=0;g<qo.length;g++)f=qo[g](f,e)||f;l||(!function(t){null!=Gi(t,"v-pre")&&(t.pre=!0)}(f),f.pre&&(l=!0)),Qo(f.tag)&&(u=!0),l?function(t){var e=t.attrsList,n=e.length;if(n)for(var i=t.attrs=new Array(n),r=0;r<n;r++)i[r]={name:e[r].name,value:JSON.stringify(e[r].value)},null!=e[r].start&&(i[r].start=e[r].start,i[r].end=e[r].end);else t.pre||(t.plain=!0)}(f):f.processed||(ys(f),function(t){var e=Gi(t,"v-if");if(e)t.if=e,bs(t,{exp:e,block:t});else{null!=Gi(t,"v-else")&&(t.else=!0);var n=Gi(t,"v-else-if");n&&(t.elseif=n)}}(f),function(t){null!=Gi(t,"v-once")&&(t.once=!0)}(f)),i||(i=f),s?c(f):(r=f,o.push(f))},end:function(t,e,n){var i=o[o.length-1];o.length-=1,r=o[o.length-1],c(i)},chars:function(t,e,n){if(r&&(!q||"textarea"!==r.tag||r.attrsMap.placeholder!==t)){var i,o,c,h=r.children;if(t=u||t.trim()?"script"===(i=r).tag||"style"===i.tag?t:fs(t):h.length?a?"condense"===a&&ps.test(t)?"":" ":s?" ":"":"")u||"condense"!==a||(t=t.replace(ds," ")),!l&&" "!==t&&(o=Eo(t,Ko))?c={type:2,expression:o.expression,tokens:o.tokens,text:t}:" "===t&&h.length&&" "===h[h.length-1].text||(c={type:3,text:t}),c&&h.push(c)}},comment:function(t,e,n){if(r){var i={type:3,text:t,isComment:!0};0,r.children.push(i)}}}),i}function _s(t,e){var n,i;!function(t){var e=Wi(t,"key");if(e){t.key=e}}(t),t.plain=!t.key&&!t.scopedSlots&&!t.attrsList.length,(i=Wi(n=t,"ref"))&&(n.ref=i,n.refInFor=function(t){for(var e=t;e;){if(void 0!==e.for)return!0;e=e.parent}return!1}(n)),function(t){var e;"template"===t.tag?(e=Gi(t,"scope"),t.slotScope=e||Gi(t,"slot-scope")):(e=Gi(t,"slot-scope"))&&(t.slotScope=e);var n=Wi(t,"slot");n&&(t.slotTarget='""'===n?'"default"':n,t.slotTargetDynamic=!(!t.attrsMap[":slot"]&&!t.attrsMap["v-bind:slot"]),"template"===t.tag||t.slotScope||Pi(t,"slot",n,Hi(t,"slot")));if("template"===t.tag){var i=ji(t,hs);if(i){0;var r=Ts(i),o=r.name,s=r.dynamic;t.slotTarget=o,t.slotTargetDynamic=s,t.slotScope=i.value||gs}}else{var a=ji(t,hs);if(a){0;var l=t.scopedSlots||(t.scopedSlots={}),u=Ts(a),c=u.name,h=u.dynamic,p=l[c]=ms("template",[],t);p.slotTarget=c,p.slotTargetDynamic=h,p.children=t.children.filter(function(t){if(!t.slotScope)return t.parent=p,!0}),p.slotScope=a.value||gs,t.children=[],t.plain=!1}}}(t),function(t){"slot"===t.tag&&(t.slotName=Wi(t,"name"))}(t),function(t){var e;(e=Wi(t,"is"))&&(t.component=e);null!=Gi(t,"inline-template")&&(t.inlineTemplate=!0)}(t);for(var r=0;r<Jo.length;r++)t=Jo[r](t,e)||t;return function(t){var e,n,i,r,o,s,a,l,u=t.attrsList;for(e=0,n=u.length;e<n;e++){if(i=r=u[e].name,o=u[e].value,is.test(i))if(t.hasBindings=!0,(s=Es(i.replace(is,"")))&&(i=i.replace(cs,"")),us.test(i))i=i.replace(us,""),o=Di(o),(l=as.test(i))&&(i=i.slice(1,-1)),s&&(s.prop&&!l&&"innerHtml"===(i=C(i))&&(i="innerHTML"),s.camel&&!l&&(i=C(i)),s.sync&&(a=Xi(o,"$event"),l?Vi(t,'"update:"+('+i+")",a,null,!1,0,u[e],!0):(Vi(t,"update:"+C(i),a,null,!1,0,u[e]),k(i)!==C(i)&&Vi(t,"update:"+k(i),a,null,!1,0,u[e])))),s&&s.prop||!t.component&&ts(t.tag,t.attrsMap.type,i)?Li(t,i,o,u[e],l):Pi(t,i,o,u[e],l);else if(ns.test(i))i=i.replace(ns,""),(l=as.test(i))&&(i=i.slice(1,-1)),Vi(t,i,o,s,!1,0,u[e],l);else{var c=(i=i.replace(is,"")).match(ls),h=c&&c[1];l=!1,h&&(i=i.slice(0,-(h.length+1)),as.test(h)&&(h=h.slice(1,-1),l=!0)),Fi(t,i,r,o,h,l,s,u[e])}else Pi(t,i,JSON.stringify(o),u[e]),!t.component&&"muted"===i&&ts(t.tag,t.attrsMap.type,i)&&Li(t,i,"true",u[e])}}(t),t}function ys(t){var e;if(e=Gi(t,"v-for")){var n=function(t){var e=t.match(rs);if(!e)return;var n={};n.for=e[2].trim();var i=e[1].trim().replace(ss,""),r=i.match(os);r?(n.alias=i.replace(os,"").trim(),n.iterator1=r[1].trim(),r[2]&&(n.iterator2=r[2].trim())):n.alias=i;return n}(e);n&&R(t,n)}}function bs(t,e){t.ifConditions||(t.ifConditions=[]),t.ifConditions.push(e)}function Ts(t){var e=t.name.replace(hs,"");return e||"#"!==t.name[0]&&(e="default"),as.test(e)?{name:e.slice(1,-1),dynamic:!0}:{name:'"'+e+'"',dynamic:!1}}function Es(t){var e=t.match(cs);if(e){var n={};return e.forEach(function(t){n[t.slice(1)]=!0}),n}}var Cs=/^xmlns:NS\d+/,Ss=/^NS\d+:/;function ws(t){return ms(t.tag,t.attrsList.slice(),t.parent)}var ks=[Co,wo,{preTransformNode:function(t,e){if("input"===t.tag){var n,i=t.attrsMap;if(!i["v-model"])return;if((i[":type"]||i["v-bind:type"])&&(n=Wi(t,"type")),i.type||n||!i["v-bind"]||(n="("+i["v-bind"]+").type"),n){var r=Gi(t,"v-if",!0),o=r?"&&("+r+")":"",s=null!=Gi(t,"v-else",!0),a=Gi(t,"v-else-if",!0),l=ws(t);ys(l),Bi(l,"type","checkbox"),_s(l,e),l.processed=!0,l.if="("+n+")==='checkbox'"+o,bs(l,{exp:l.if,block:l});var u=ws(t);Gi(u,"v-for",!0),Bi(u,"type","radio"),_s(u,e),bs(l,{exp:"("+n+")==='radio'"+o,block:u});var c=ws(t);return Gi(c,"v-for",!0),Bi(c,":type",n),_s(c,e),bs(l,{exp:r,block:c}),s?l.else=!0:a&&(l.elseif=a),l}}}}];var xs,Is,Rs={expectHTML:!0,modules:ks,directives:{model:function(t,e,n){n;var i=e.value,r=e.modifiers,o=t.tag,s=t.attrsMap.type;if(t.component)return $i(t,i,r),!1;if("select"===o)!function(t,e,n){var i='var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(n&&n.number?"_n(val)":"val")+"});";i=i+" "+Xi(e,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),Vi(t,"change",i,null,!0)}(t,i,r);else if("input"===o&&"checkbox"===s)!function(t,e,n){var i=n&&n.number,r=Wi(t,"value")||"null",o=Wi(t,"true-value")||"true",s=Wi(t,"false-value")||"false";Li(t,"checked","Array.isArray("+e+")?_i("+e+","+r+")>-1"+("true"===o?":("+e+")":":_q("+e+","+o+")")),Vi(t,"change","var $$a="+e+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+s+");if(Array.isArray($$a)){var $$v="+(i?"_n("+r+")":r)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Xi(e,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Xi(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Xi(e,"$$c")+"}",null,!0)}(t,i,r);else if("input"===o&&"radio"===s)!function(t,e,n){var i=n&&n.number,r=Wi(t,"value")||"null";Li(t,"checked","_q("+e+","+(r=i?"_n("+r+")":r)+")"),Vi(t,"change",Xi(e,r),null,!0)}(t,i,r);else if("input"===o||"textarea"===o)!function(t,e,n){var i=t.attrsMap.type,r=n||{},o=r.lazy,s=r.number,a=r.trim,l=!o&&"range"!==i,u=o?"change":"range"===i?tr:"input",c="$event.target.value";a&&(c="$event.target.value.trim()"),s&&(c="_n("+c+")");var h=Xi(e,c);l&&(h="if($event.target.composing)return;"+h),Li(t,"value","("+e+")"),Vi(t,u,h,null,!0),(a||s)&&Vi(t,"blur","$forceUpdate()")}(t,i,r);else if(!V.isReservedTag(o))return $i(t,i,r),!1;return!0},text:function(t,e){e.value&&Li(t,"textContent","_s("+e.value+")",e)},html:function(t,e){e.value&&Li(t,"innerHTML","_s("+e.value+")",e)}},isPreTag:function(t){return"pre"===t},isUnaryTag:xo,mustUseProp:Bn,canBeLeftOpenTag:Io,isReservedTag:Qn,getTagNamespace:ti,staticKeys:function(t){return t.reduce(function(t,e){return t.concat(e.staticKeys||[])},[]).join(",")}(ks)},Os=T(function(t){return g("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))});function Ds(t,e){t&&(xs=Os(e.staticKeys||""),Is=e.isReservedTag||A,function t(e){e.static=function(t){if(2===t.type)return!1;if(3===t.type)return!0;return!(!t.pre&&(t.hasBindings||t.if||t.for||m(t.tag)||!Is(t.tag)||function(t){for(;t.parent;){if("template"!==(t=t.parent).tag)return!1;if(t.for)return!0}return!1}(t)||!Object.keys(t).every(xs)))}(e);if(1===e.type){if(!Is(e.tag)&&"slot"!==e.tag&&null==e.attrsMap["inline-template"])return;for(var n=0,i=e.children.length;n<i;n++){var r=e.children[n];t(r),r.static||(e.static=!1)}if(e.ifConditions)for(var o=1,s=e.ifConditions.length;o<s;o++){var a=e.ifConditions[o].block;t(a),a.static||(e.static=!1)}}}(t),function t(e,n){if(1===e.type){if((e.static||e.once)&&(e.staticInFor=n),e.static&&e.children.length&&(1!==e.children.length||3!==e.children[0].type))return void(e.staticRoot=!0);if(e.staticRoot=!1,e.children)for(var i=0,r=e.children.length;i<r;i++)t(e.children[i],n||!!e.for);if(e.ifConditions)for(var o=1,s=e.ifConditions.length;o<s;o++)t(e.ifConditions[o].block,n)}}(t,!1))}var As=/^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/,Ms=/\([^)]*?\);*$/,Ns=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ls={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ps={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Bs=function(t){return"if("+t+")return null;"},Fs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Bs("$event.target !== $event.currentTarget"),ctrl:Bs("!$event.ctrlKey"),shift:Bs("!$event.shiftKey"),alt:Bs("!$event.altKey"),meta:Bs("!$event.metaKey"),left:Bs("'button' in $event && $event.button !== 0"),middle:Bs("'button' in $event && $event.button !== 1"),right:Bs("'button' in $event && $event.button !== 2")};function Us(t,e){var n=e?"nativeOn:":"on:",i="",r="";for(var o in t){var s=Vs(t[o]);t[o]&&t[o].dynamic?r+=o+","+s+",":i+='"'+o+'":'+s+","}return i="{"+i.slice(0,-1)+"}",r?n+"_d("+i+",["+r.slice(0,-1)+"])":n+i}function Vs(t){if(!t)return"function(){}";if(Array.isArray(t))return"["+t.map(function(t){return Vs(t)}).join(",")+"]";var e=Ns.test(t.value),n=As.test(t.value),i=Ns.test(t.value.replace(Ms,""));if(t.modifiers){var r="",o="",s=[];for(var a in t.modifiers)if(Fs[a])o+=Fs[a],Ls[a]&&s.push(a);else if("exact"===a){var l=t.modifiers;o+=Bs(["ctrl","shift","alt","meta"].filter(function(t){return!l[t]}).map(function(t){return"$event."+t+"Key"}).join("||"))}else s.push(a);return s.length&&(r+=function(t){return"if(!$event.type.indexOf('key')&&"+t.map(Hs).join("&&")+")return null;"}(s)),o&&(r+=o),"function($event){"+r+(e?"return "+t.value+".apply(null, arguments)":n?"return ("+t.value+").apply(null, arguments)":i?"return "+t.value:t.value)+"}"}return e||n?t.value:"function($event){"+(i?"return "+t.value:t.value)+"}"}function Hs(t){var e=parseInt(t,10);if(e)return"$event.keyCode!=="+e;var n=Ls[t],i=Ps[t];return"_k($event.keyCode,"+JSON.stringify(t)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(i)+")"}var Ws={on:function(t,e){t.wrapListeners=function(t){return"_g("+t+","+e.value+")"}},bind:function(t,e){t.wrapData=function(n){return"_b("+n+",'"+t.tag+"',"+e.value+","+(e.modifiers&&e.modifiers.prop?"true":"false")+(e.modifiers&&e.modifiers.sync?",true":"")+")"}},cloak:D},Gs=function(t){this.options=t,this.warn=t.warn||Mi,this.transforms=Ni(t.modules,"transformCode"),this.dataGenFns=Ni(t.modules,"genData"),this.directives=R(R({},Ws),t.directives);var e=t.isReservedTag||A;this.maybeComponent=function(t){return!!t.component||!e(t.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function js(t,e){var n=new Gs(e);return{render:"with(this){return "+(t?"script"===t.tag?"null":zs(t,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function zs(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return $s(t,e);if(t.once&&!t.onceProcessed)return Xs(t,e);if(t.for&&!t.forProcessed)return Ks(t,e);if(t.if&&!t.ifProcessed)return Ys(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){var n=t.slotName||'"default"',i=Qs(t,e),r="_t("+n+(i?",function(){return "+i+"}":""),o=t.attrs||t.dynamicAttrs?na((t.attrs||[]).concat(t.dynamicAttrs||[]).map(function(t){return{name:C(t.name),value:t.value,dynamic:t.dynamic}})):null,s=t.attrsMap["v-bind"];!o&&!s||i||(r+=",null");o&&(r+=","+o);s&&(r+=(o?"":",null")+","+s);return r+")"}(t,e);var n;if(t.component)n=function(t,e,n){var i=e.inlineTemplate?null:Qs(e,n,!0);return"_c("+t+","+Js(e,n)+(i?","+i:"")+")"}(t.component,t,e);else{var i;(!t.plain||t.pre&&e.maybeComponent(t))&&(i=Js(t,e));var r=t.inlineTemplate?null:Qs(t,e,!0);n="_c('"+t.tag+"'"+(i?","+i:"")+(r?","+r:"")+")"}for(var o=0;o<e.transforms.length;o++)n=e.transforms[o](t,n);return n}return Qs(t,e)||"void 0"}function $s(t,e){t.staticProcessed=!0;var n=e.pre;return t.pre&&(e.pre=t.pre),e.staticRenderFns.push("with(this){return "+zs(t,e)+"}"),e.pre=n,"_m("+(e.staticRenderFns.length-1)+(t.staticInFor?",true":"")+")"}function Xs(t,e){if(t.onceProcessed=!0,t.if&&!t.ifProcessed)return Ys(t,e);if(t.staticInFor){for(var n="",i=t.parent;i;){if(i.for){n=i.key;break}i=i.parent}return n?"_o("+zs(t,e)+","+e.onceId+++","+n+")":zs(t,e)}return $s(t,e)}function Ys(t,e,n,i){return t.ifProcessed=!0,function t(e,n,i,r){if(!e.length)return r||"_e()";var o=e.shift();return o.exp?"("+o.exp+")?"+s(o.block)+":"+t(e,n,i,r):""+s(o.block);function s(t){return i?i(t,n):t.once?Xs(t,n):zs(t,n)}}(t.ifConditions.slice(),e,n,i)}function Ks(t,e,n,i){var r=t.for,o=t.alias,s=t.iterator1?","+t.iterator1:"",a=t.iterator2?","+t.iterator2:"";return t.forProcessed=!0,(i||"_l")+"(("+r+"),function("+o+s+a+"){return "+(n||zs)(t,e)+"})"}function Js(t,e){var n="{",i=function(t,e){var n=t.directives;if(!n)return;var i,r,o,s,a="directives:[",l=!1;for(i=0,r=n.length;i<r;i++){o=n[i],s=!0;var u=e.directives[o.name];u&&(s=!!u(t,o,e.warn)),s&&(l=!0,a+='{name:"'+o.name+'",rawName:"'+o.rawName+'"'+(o.value?",value:("+o.value+"),expression:"+JSON.stringify(o.value):"")+(o.arg?",arg:"+(o.isDynamicArg?o.arg:'"'+o.arg+'"'):"")+(o.modifiers?",modifiers:"+JSON.stringify(o.modifiers):"")+"},")}if(l)return a.slice(0,-1)+"]"}(t,e);i&&(n+=i+","),t.key&&(n+="key:"+t.key+","),t.ref&&(n+="ref:"+t.ref+","),t.refInFor&&(n+="refInFor:true,"),t.pre&&(n+="pre:true,"),t.component&&(n+='tag:"'+t.tag+'",');for(var r=0;r<e.dataGenFns.length;r++)n+=e.dataGenFns[r](t);if(t.attrs&&(n+="attrs:"+na(t.attrs)+","),t.props&&(n+="domProps:"+na(t.props)+","),t.events&&(n+=Us(t.events,!1)+","),t.nativeEvents&&(n+=Us(t.nativeEvents,!0)+","),t.slotTarget&&!t.slotScope&&(n+="slot:"+t.slotTarget+","),t.scopedSlots&&(n+=function(t,e,n){var i=t.for||Object.keys(e).some(function(t){var n=e[t];return n.slotTargetDynamic||n.if||n.for||qs(n)}),r=!!t.if;if(!i)for(var o=t.parent;o;){if(o.slotScope&&o.slotScope!==gs||o.for){i=!0;break}o.if&&(r=!0),o=o.parent}var s=Object.keys(e).map(function(t){return Zs(e[t],n)}).join(",");return"scopedSlots:_u(["+s+"]"+(i?",null,true":"")+(!i&&r?",null,false,"+function(t){var e=5381,n=t.length;for(;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(s):"")+")"}(t,t.scopedSlots,e)+","),t.model&&(n+="model:{value:"+t.model.value+",callback:"+t.model.callback+",expression:"+t.model.expression+"},"),t.inlineTemplate){var o=function(t,e){var n=t.children[0];0;if(n&&1===n.type){var i=js(n,e.options);return"inlineTemplate:{render:function(){"+i.render+"},staticRenderFns:["+i.staticRenderFns.map(function(t){return"function(){"+t+"}"}).join(",")+"]}"}}(t,e);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n="_b("+n+',"'+t.tag+'",'+na(t.dynamicAttrs)+")"),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function qs(t){return 1===t.type&&("slot"===t.tag||t.children.some(qs))}function Zs(t,e){var n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return Ys(t,e,Zs,"null");if(t.for&&!t.forProcessed)return Ks(t,e,Zs);var i=t.slotScope===gs?"":String(t.slotScope),r="function("+i+"){return "+("template"===t.tag?t.if&&n?"("+t.if+")?"+(Qs(t,e)||"undefined")+":undefined":Qs(t,e)||"undefined":zs(t,e))+"}",o=i?"":",proxy:true";return"{key:"+(t.slotTarget||'"default"')+",fn:"+r+o+"}"}function Qs(t,e,n,i,r){var o=t.children;if(o.length){var s=o[0];if(1===o.length&&s.for&&"template"!==s.tag&&"slot"!==s.tag){var a=n?e.maybeComponent(s)?",1":",0":"";return""+(i||zs)(s,e)+a}var l=n?function(t,e){for(var n=0,i=0;i<t.length;i++){var r=t[i];if(1===r.type){if(ta(r)||r.ifConditions&&r.ifConditions.some(function(t){return ta(t.block)})){n=2;break}(e(r)||r.ifConditions&&r.ifConditions.some(function(t){return e(t.block)}))&&(n=1)}}return n}(o,e.maybeComponent):0,u=r||ea;return"["+o.map(function(t){return u(t,e)}).join(",")+"]"+(l?","+l:"")}}function ta(t){return void 0!==t.for||"template"===t.tag||"slot"===t.tag}function ea(t,e){return 1===t.type?zs(t,e):3===t.type&&t.isComment?(i=t,"_e("+JSON.stringify(i.text)+")"):"_v("+(2===(n=t).type?n.expression:ia(JSON.stringify(n.text)))+")";var n,i}function na(t){for(var e="",n="",i=0;i<t.length;i++){var r=t[i],o=ia(r.value);r.dynamic?n+=r.name+","+o+",":e+='"'+r.name+'":'+o+","}return e="{"+e.slice(0,-1)+"}",n?"_d("+e+",["+n.slice(0,-1)+"])":e}function ia(t){return t.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b"),new RegExp("\\b"+"delete,typeof,void".split(",").join("\\s*\\([^\\)]*\\)|\\b")+"\\s*\\([^\\)]*\\)");function ra(t,e){try{return new Function(t)}catch(n){return e.push({err:n,code:t}),D}}function oa(t){var e=Object.create(null);return function(n,i,r){(i=R({},i)).warn;delete i.warn;var o=i.delimiters?String(i.delimiters)+n:n;if(e[o])return e[o];var s=t(n,i);var a={},l=[];return a.render=ra(s.render,l),a.staticRenderFns=s.staticRenderFns.map(function(t){return ra(t,l)}),e[o]=a}}var sa,aa,la=(sa=function(t,e){var n=vs(t.trim(),e);!1!==e.optimize&&Ds(n,e);var i=js(n,e);return{ast:n,render:i.render,staticRenderFns:i.staticRenderFns}},function(t){function e(e,n){var i=Object.create(t),r=[],o=[],s=function(t,e,n){(n?o:r).push(t)};if(n)for(var a in n.modules&&(i.modules=(t.modules||[]).concat(n.modules)),n.directives&&(i.directives=R(Object.create(t.directives||null),n.directives)),n)"modules"!==a&&"directives"!==a&&(i[a]=n[a]);i.warn=s;var l=sa(e.trim(),i);return l.errors=r,l.tips=o,l}return{compile:e,compileToFunctions:oa(e)}})(Rs),ua=(la.compile,la.compileToFunctions);function ca(t){return(aa=aa||document.createElement("div")).innerHTML=t?'<a href="\n"/>':'<div a="\n"/>',aa.innerHTML.indexOf("&#10;")>0}var ha=!!X&&ca(!1),pa=!!X&&ca(!0),da=T(function(t){var e=ii(t);return e&&e.innerHTML}),fa=xn.prototype.$mount;xn.prototype.$mount=function(t,e){if((t=t&&ii(t))===document.body||t===document.documentElement)return this;var n=this.$options;if(!n.render){var i=n.template;if(i)if("string"==typeof i)"#"===i.charAt(0)&&(i=da(i));else{if(!i.nodeType)return this;i=i.innerHTML}else t&&(i=function(t){if(t.outerHTML)return t.outerHTML;var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}(t));if(i){0;var r=ua(i,{outputSourceRange:!1,shouldDecodeNewlines:ha,shouldDecodeNewlinesForHref:pa,delimiters:n.delimiters,comments:n.comments},this),o=r.render,s=r.staticRenderFns;n.render=o,n.staticRenderFns=s}}return fa.call(this,t,e)},xn.compile=ua,e.default=xn}.call(e,n("DuR2"))},"77Pl":function(t,e,n){var i=n("EqjI");t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},"7GwW":function(t,e,n){"use strict";var i=n("cGG2"),r=n("21It"),o=n("p1b6"),s=n("DQCr"),a=n("Oi+a"),l=n("oJlt"),u=n("GHBc"),c=n("FtD3");t.exports=function(t){return new Promise(function(e,n){var h=t.data,p=t.headers;i.isFormData(h)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(t.auth){var f=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";p.Authorization="Basic "+btoa(f+":"+g)}var m=a(t.baseURL,t.url);if(d.open(t.method.toUpperCase(),s(m,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in d?l(d.getAllResponseHeaders()):null,o={data:t.responseType&&"text"!==t.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:i,config:t,request:d};r(e,n,o),d=null}},d.onabort=function(){d&&(n(c("Request aborted",t,"ECONNABORTED",d)),d=null)},d.onerror=function(){n(c("Network Error",t,null,d)),d=null},d.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(c(e,t,"ECONNABORTED",d)),d=null},i.isStandardBrowserEnv()){var v=(t.withCredentials||u(m))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;v&&(p[t.xsrfHeaderName]=v)}if("setRequestHeader"in d&&i.forEach(p,function(t,e){void 0===h&&"content-type"===e.toLowerCase()?delete p[e]:d.setRequestHeader(e,t)}),i.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),t.responseType)try{d.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){d&&(d.abort(),n(t),d=null)}),h||(h=null),d.send(h)})}},"7J9s":function(t,e,n){"use strict";e.__esModule=!0,e.PopupManager=void 0;var i=l(n("7+uW")),r=l(n("jmaC")),o=l(n("OAzY")),s=l(n("6Twh")),a=n("2kvA");function l(t){return t&&t.__esModule?t:{default:t}}var u=1,c=void 0;e.default={props:{visible:{type:Boolean,default:!1},openDelay:{},closeDelay:{},zIndex:{},modal:{type:Boolean,default:!1},modalFade:{type:Boolean,default:!0},modalClass:{},modalAppendToBody:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!1}},beforeMount:function(){this._popupId="popup-"+u++,o.default.register(this._popupId,this)},beforeDestroy:function(){o.default.deregister(this._popupId),o.default.closeModal(this._popupId),this.restoreBodyStyle()},data:function(){return{opened:!1,bodyPaddingRight:null,computedBodyPaddingRight:0,withoutHiddenClass:!0,rendered:!1}},watch:{visible:function(t){var e=this;if(t){if(this._opening)return;this.rendered?this.open():(this.rendered=!0,i.default.nextTick(function(){e.open()}))}else this.close()}},methods:{open:function(t){var e=this;this.rendered||(this.rendered=!0);var n=(0,r.default)({},this.$props||this,t);this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),clearTimeout(this._openTimer);var i=Number(n.openDelay);i>0?this._openTimer=setTimeout(function(){e._openTimer=null,e.doOpen(n)},i):this.doOpen(n)},doOpen:function(t){if(!this.$isServer&&(!this.willOpen||this.willOpen())&&!this.opened){this._opening=!0;var e=this.$el,n=t.modal,i=t.zIndex;if(i&&(o.default.zIndex=i),n&&(this._closing&&(o.default.closeModal(this._popupId),this._closing=!1),o.default.openModal(this._popupId,o.default.nextZIndex(),this.modalAppendToBody?void 0:e,t.modalClass,t.modalFade),t.lockScroll)){this.withoutHiddenClass=!(0,a.hasClass)(document.body,"el-popup-parent--hidden"),this.withoutHiddenClass&&(this.bodyPaddingRight=document.body.style.paddingRight,this.computedBodyPaddingRight=parseInt((0,a.getStyle)(document.body,"paddingRight"),10)),c=(0,s.default)();var r=document.documentElement.clientHeight<document.body.scrollHeight,l=(0,a.getStyle)(document.body,"overflowY");c>0&&(r||"scroll"===l)&&this.withoutHiddenClass&&(document.body.style.paddingRight=this.computedBodyPaddingRight+c+"px"),(0,a.addClass)(document.body,"el-popup-parent--hidden")}"static"===getComputedStyle(e).position&&(e.style.position="absolute"),e.style.zIndex=o.default.nextZIndex(),this.opened=!0,this.onOpen&&this.onOpen(),this.doAfterOpen()}},doAfterOpen:function(){this._opening=!1},close:function(){var t=this;if(!this.willClose||this.willClose()){null!==this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=null),clearTimeout(this._closeTimer);var e=Number(this.closeDelay);e>0?this._closeTimer=setTimeout(function(){t._closeTimer=null,t.doClose()},e):this.doClose()}},doClose:function(){this._closing=!0,this.onClose&&this.onClose(),this.lockScroll&&setTimeout(this.restoreBodyStyle,200),this.opened=!1,this.doAfterClose()},doAfterClose:function(){o.default.closeModal(this._popupId),this._closing=!1},restoreBodyStyle:function(){this.modal&&this.withoutHiddenClass&&(document.body.style.paddingRight=this.bodyPaddingRight,(0,a.removeClass)(document.body,"el-popup-parent--hidden")),this.withoutHiddenClass=!0}}},e.PopupManager=o.default},"7KvD":function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"7UMu":function(t,e,n){var i=n("R9M2");t.exports=Array.isArray||function(t){return"Array"==i(t)}},"82Mu":function(t,e,n){var i=n("7KvD"),r=n("L42u").set,o=i.MutationObserver||i.WebKitMutationObserver,s=i.process,a=i.Promise,l="process"==n("R9M2")(s);t.exports=function(){var t,e,n,u=function(){var i,r;for(l&&(i=s.domain)&&i.exit();t;){r=t.fn,t=t.next;try{r()}catch(i){throw t?n():e=void 0,i}}e=void 0,i&&i.enter()};if(l)n=function(){s.nextTick(u)};else if(!o||i.navigator&&i.navigator.standalone)if(a&&a.resolve){var c=a.resolve(void 0);n=function(){c.then(u)}}else n=function(){r.call(i,u)};else{var h=!0,p=document.createTextNode("");new o(u).observe(p,{characterData:!0}),n=function(){p.data=h=!h}}return function(i){var r={fn:i,next:void 0};e&&(e.next=r),t||(t=r,n()),e=r}}},"835U":function(t,e,n){"use strict";e.__esModule=!0,e.isDefined=e.isUndefined=e.isFunction=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},e.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isHtmlElement=function(t){return t&&t.nodeType===Node.ELEMENT_NODE};var r,o=n("7+uW"),s=(r=o)&&r.__esModule?r:{default:r};var a=function(t){return t&&"[object Function]"==={}.toString.call(t)};"function"==typeof/./||"object"===("undefined"==typeof Int8Array?"undefined":i(Int8Array))||!s.default.prototype.$isServer&&"function"==typeof document.childNodes||(e.isFunction=a=function(t){return"function"==typeof t||!1}),e.isFunction=a;e.isUndefined=function(t){return void 0===t},e.isDefined=function(t){return void 0!==t&&null!==t}},"880/":function(t,e,n){t.exports=n("hJx8")},"94VQ":function(t,e,n){"use strict";var i=n("Yobk"),r=n("X8DO"),o=n("e6n0"),s={};n("hJx8")(s,n("dSzd")("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(s,{next:r(1,n)}),o(t,e+" Iterator")}},AMCD:function(t,e,n){"use strict";e.__esModule=!0,e.validateRangeInOneMonth=e.extractTimeFormat=e.extractDateFormat=e.nextYear=e.prevYear=e.nextMonth=e.prevMonth=e.changeYearMonthAndClampDate=e.timeWithinRange=e.limitTimeRange=e.clearMilliseconds=e.clearTime=e.modifyWithTimeString=e.modifyTime=e.modifyDate=e.range=e.getRangeMinutes=e.getMonthDays=e.getPrevMonthLastDays=e.getRangeHours=e.getWeekNumber=e.getStartDateOfMonth=e.nextDate=e.prevDate=e.getFirstDayOfMonth=e.getDayCountOfYear=e.getDayCountOfMonth=e.parseDate=e.formatDate=e.isDateObject=e.isDate=e.toDate=e.getI18nSettings=void 0;var i,r=n("eNfa"),o=(i=r)&&i.__esModule?i:{default:i},s=n("urW8");var a=["sun","mon","tue","wed","thu","fri","sat"],l=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],u=e.getI18nSettings=function(){return{dayNamesShort:a.map(function(t){return(0,s.t)("el.datepicker.weeks."+t)}),dayNames:a.map(function(t){return(0,s.t)("el.datepicker.weeks."+t)}),monthNamesShort:l.map(function(t){return(0,s.t)("el.datepicker.months."+t)}),monthNames:l.map(function(t,e){return(0,s.t)("el.datepicker.month"+(e+1))}),amPm:["am","pm"]}},c=e.toDate=function(t){return h(t)?new Date(t):null},h=e.isDate=function(t){return null!==t&&void 0!==t&&(!isNaN(new Date(t).getTime())&&!Array.isArray(t))},p=(e.isDateObject=function(t){return t instanceof Date},e.formatDate=function(t,e){return(t=c(t))?o.default.format(t,e||"yyyy-MM-dd",u()):""},e.parseDate=function(t,e){return o.default.parse(t,e||"yyyy-MM-dd",u())}),d=e.getDayCountOfMonth=function(t,e){return 3===e||5===e||8===e||10===e?30:1===e?t%4==0&&t%100!=0||t%400==0?29:28:31},f=(e.getDayCountOfYear=function(t){return t%400==0||t%100!=0&&t%4==0?366:365},e.getFirstDayOfMonth=function(t){var e=new Date(t.getTime());return e.setDate(1),e.getDay()},e.prevDate=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)});e.nextDate=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)},e.getStartDateOfMonth=function(t,e){var n=new Date(t,e,1),i=n.getDay();return f(n,0===i?7:i)},e.getWeekNumber=function(t){if(!h(t))return null;var e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var n=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},e.getRangeHours=function(t){var e=[],n=[];if((t||[]).forEach(function(t){var e=t.map(function(t){return t.getHours()});n=n.concat(function(t,e){for(var n=[],i=t;i<=e;i++)n.push(i);return n}(e[0],e[1]))}),n.length)for(var i=0;i<24;i++)e[i]=-1===n.indexOf(i);else for(var r=0;r<24;r++)e[r]=!1;return e},e.getPrevMonthLastDays=function(t,e){if(e<=0)return[];var n=new Date(t.getTime());n.setDate(0);var i=n.getDate();return m(e).map(function(t,n){return i-(e-n-1)})},e.getMonthDays=function(t){var e=new Date(t.getFullYear(),t.getMonth()+1,0).getDate();return m(e).map(function(t,e){return e+1})};function g(t,e,n,i){for(var r=e;r<n;r++)t[r]=i}e.getRangeMinutes=function(t,e){var n=new Array(60);return t.length>0?t.forEach(function(t){var i=t[0],r=t[1],o=i.getHours(),s=i.getMinutes(),a=r.getHours(),l=r.getMinutes();o===e&&a!==e?g(n,s,60,!0):o===e&&a===e?g(n,s,l+1,!0):o!==e&&a===e?g(n,0,l+1,!0):o<e&&a>e&&g(n,0,60,!0)}):g(n,0,60,!0),n};var m=e.range=function(t){return Array.apply(null,{length:t}).map(function(t,e){return e})},v=e.modifyDate=function(t,e,n,i){return new Date(e,n,i,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())},_=e.modifyTime=function(t,e,n,i){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),e,n,i,t.getMilliseconds())},y=(e.modifyWithTimeString=function(t,e){return null!=t&&e?(e=p(e,"HH:mm:ss"),_(t,e.getHours(),e.getMinutes(),e.getSeconds())):t},e.clearTime=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())},e.clearMilliseconds=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)},e.limitTimeRange=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"HH:mm:ss";if(0===e.length)return t;var i=function(t){return o.default.parse(o.default.format(t,n),n)},r=i(t),s=e.map(function(t){return t.map(i)});if(s.some(function(t){return r>=t[0]&&r<=t[1]}))return t;var a=s[0][0],l=s[0][0];return s.forEach(function(t){a=new Date(Math.min(t[0],a)),l=new Date(Math.max(t[1],a))}),v(r<a?a:l,t.getFullYear(),t.getMonth(),t.getDate())}),b=(e.timeWithinRange=function(t,e,n){return y(t,e,n).getTime()===t.getTime()},e.changeYearMonthAndClampDate=function(t,e,n){var i=Math.min(t.getDate(),d(e,n));return v(t,e,n,i)});e.prevMonth=function(t){var e=t.getFullYear(),n=t.getMonth();return 0===n?b(t,e-1,11):b(t,e,n-1)},e.nextMonth=function(t){var e=t.getFullYear(),n=t.getMonth();return 11===n?b(t,e+1,0):b(t,e,n+1)},e.prevYear=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t.getFullYear(),i=t.getMonth();return b(t,n-e,i)},e.nextYear=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t.getFullYear(),i=t.getMonth();return b(t,n+e,i)},e.extractDateFormat=function(t){return t.replace(/\W?m{1,2}|\W?ZZ/g,"").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi,"").trim()},e.extractTimeFormat=function(t){return t.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g,"").trim()},e.validateRangeInOneMonth=function(t,e){return t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}},BO1k:function(t,e,n){t.exports={default:n("fxRn"),__esModule:!0}},BwfY:function(t,e,n){n("fWfb"),n("M6a0"),n("OYls"),n("QWe/"),t.exports=n("FeBl").Symbol},CXw9:function(t,e,n){"use strict";var i,r,o,s,a=n("O4g8"),l=n("7KvD"),u=n("+ZMJ"),c=n("RY/4"),h=n("kM2E"),p=n("EqjI"),d=n("lOnJ"),f=n("2KxR"),g=n("NWt+"),m=n("t8x9"),v=n("L42u").set,_=n("82Mu")(),y=n("qARP"),b=n("dNDb"),T=n("iUbK"),E=n("fJUb"),C=l.TypeError,S=l.process,w=S&&S.versions,k=w&&w.v8||"",x=l.Promise,I="process"==c(S),R=function(){},O=r=y.f,D=!!function(){try{var t=x.resolve(1),e=(t.constructor={})[n("dSzd")("species")]=function(t){t(R,R)};return(I||"function"==typeof PromiseRejectionEvent)&&t.then(R)instanceof e&&0!==k.indexOf("6.6")&&-1===T.indexOf("Chrome/66")}catch(t){}}(),A=function(t){var e;return!(!p(t)||"function"!=typeof(e=t.then))&&e},M=function(t,e){if(!t._n){t._n=!0;var n=t._c;_(function(){for(var i=t._v,r=1==t._s,o=0,s=function(e){var n,o,s,a=r?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{a?(r||(2==t._h&&P(t),t._h=1),!0===a?n=i:(c&&c.enter(),n=a(i),c&&(c.exit(),s=!0)),n===e.promise?u(C("Promise-chain cycle")):(o=A(n))?o.call(n,l,u):l(n)):u(i)}catch(t){c&&!s&&c.exit(),u(t)}};n.length>o;)s(n[o++]);t._c=[],t._n=!1,e&&!t._h&&N(t)})}},N=function(t){v.call(l,function(){var e,n,i,r=t._v,o=L(t);if(o&&(e=b(function(){I?S.emit("unhandledRejection",r,t):(n=l.onunhandledrejection)?n({promise:t,reason:r}):(i=l.console)&&i.error&&i.error("Unhandled promise rejection",r)}),t._h=I||L(t)?2:1),t._a=void 0,o&&e.e)throw e.v})},L=function(t){return 1!==t._h&&0===(t._a||t._c).length},P=function(t){v.call(l,function(){var e;I?S.emit("rejectionHandled",t):(e=l.onrejectionhandled)&&e({promise:t,reason:t._v})})},B=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),M(e,!0))},F=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw C("Promise can't be resolved itself");(e=A(t))?_(function(){var i={_w:n,_d:!1};try{e.call(t,u(F,i,1),u(B,i,1))}catch(t){B.call(i,t)}}):(n._v=t,n._s=1,M(n,!1))}catch(t){B.call({_w:n,_d:!1},t)}}};D||(x=function(t){f(this,x,"Promise","_h"),d(t),i.call(this);try{t(u(F,this,1),u(B,this,1))}catch(t){B.call(this,t)}},(i=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n("xH/j")(x.prototype,{then:function(t,e){var n=O(m(this,x));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=I?S.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&M(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new i;this.promise=t,this.resolve=u(F,t,1),this.reject=u(B,t,1)},y.f=O=function(t){return t===x||t===s?new o(t):r(t)}),h(h.G+h.W+h.F*!D,{Promise:x}),n("e6n0")(x,"Promise"),n("bRrM")("Promise"),s=n("FeBl").Promise,h(h.S+h.F*!D,"Promise",{reject:function(t){var e=O(this);return(0,e.reject)(t),e.promise}}),h(h.S+h.F*(a||!D),"Promise",{resolve:function(t){return E(a&&this===s?x:this,t)}}),h(h.S+h.F*!(D&&n("dY0y")(function(t){x.all(t).catch(R)})),"Promise",{all:function(t){var e=this,n=O(e),i=n.resolve,r=n.reject,o=b(function(){var n=[],o=0,s=1;g(t,!1,function(t){var a=o++,l=!1;n.push(void 0),s++,e.resolve(t).then(function(t){l||(l=!0,n[a]=t,--s||i(n))},r)}),--s||i(n)});return o.e&&r(o.v),n.promise},race:function(t){var e=this,n=O(e),i=n.reject,r=b(function(){g(t,!1,function(t){e.resolve(t).then(n.resolve,i)})});return r.e&&i(r.v),n.promise}})},Cdx3:function(t,e,n){var i=n("sB3e"),r=n("lktj");n("uqUo")("keys",function(){return function(t){return r(i(t))}})},Cr6W:function(t,e,n){var i,r,o,s;s=function(t,e){
  36. /**
  37. * @license
  38. * Copyright 2020 Google LLC
  39. * SPDX-License-Identifier: Apache-2.0
  40. */
  41. "use strict";return t.JavaScript=e,e},r=[n("xnUL"),n("JMbB")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},CwSZ:function(t,e,n){"use strict";var i=n("p8xL"),r=n("XgCd"),o=Object.prototype.hasOwnProperty,s={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},a=Array.isArray,l=Array.prototype.push,u=function(t,e){l.apply(t,a(e)?e:[e])},c=Date.prototype.toISOString,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:i.encode,encodeValuesOnly:!1,formatter:r.formatters[r.default],indices:!1,serializeDate:function(t){return c.call(t)},skipNulls:!1,strictNullHandling:!1},p=function t(e,n,r,o,s,l,c,p,d,f,g,m,v){var _=e;if("function"==typeof c?_=c(n,_):_ instanceof Date?_=f(_):"comma"===r&&a(_)&&(_=_.join(",")),null===_){if(o)return l&&!m?l(n,h.encoder,v):n;_=""}if("string"==typeof _||"number"==typeof _||"boolean"==typeof _||i.isBuffer(_))return l?[g(m?n:l(n,h.encoder,v))+"="+g(l(_,h.encoder,v))]:[g(n)+"="+g(String(_))];var y,b=[];if(void 0===_)return b;if(a(c))y=c;else{var T=Object.keys(_);y=p?T.sort(p):T}for(var E=0;E<y.length;++E){var C=y[E];s&&null===_[C]||(a(_)?u(b,t(_[C],"function"==typeof r?r(n,C):n,r,o,s,l,c,p,d,f,g,m,v)):u(b,t(_[C],n+(d?"."+C:"["+C+"]"),r,o,s,l,c,p,d,f,g,m,v)))}return b};t.exports=function(t,e){var n,i=t,l=function(t){if(!t)return h;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||h.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=r.default;if(void 0!==t.format){if(!o.call(r.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var i=r.formatters[n],s=h.filter;return("function"==typeof t.filter||a(t.filter))&&(s=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===t.allowDots?h.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:h.charsetSentinel,delimiter:void 0===t.delimiter?h.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:h.encode,encoder:"function"==typeof t.encoder?t.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:h.encodeValuesOnly,filter:s,formatter:i,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:h.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:h.strictNullHandling}}(e);"function"==typeof l.filter?i=(0,l.filter)("",i):a(l.filter)&&(n=l.filter);var c,d=[];if("object"!=typeof i||null===i)return"";c=e&&e.arrayFormat in s?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var f=s[c];n||(n=Object.keys(i)),l.sort&&n.sort(l.sort);for(var g=0;g<n.length;++g){var m=n[g];l.skipNulls&&null===i[m]||u(d,p(i[m],m,f,l.strictNullHandling,l.skipNulls,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.formatter,l.encodeValuesOnly,l.charset))}var v=d.join(l.delimiter),_=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),v.length>0?_+v:""}},D2L2:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},DDCP:function(t,e,n){"use strict";var i=n("p8xL"),r=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:i.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},a=function(t,e,n){if(t){var i=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(i),a=s?i.slice(0,s.index):i,l=[];if(a){if(!n.plainObjects&&r.call(Object.prototype,a)&&!n.allowPrototypes)return;l.push(a)}for(var u=0;null!==(s=o.exec(i))&&u<n.depth;){if(u+=1,!n.plainObjects&&r.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(s[1])}return s&&l.push("["+i.slice(s.index)+"]"),function(t,e,n){for(var i=e,r=t.length-1;r>=0;--r){var o,s=t[r];if("[]"===s&&n.parseArrays)o=[].concat(i);else{o=n.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(a,10);n.parseArrays||""!==a?!isNaN(l)&&s!==a&&String(l)===a&&l>=0&&n.parseArrays&&l<=n.arrayLimit?(o=[])[l]=i:o[a]=i:o={0:i}}i=o}return i}(l,e,n)}};t.exports=function(t,e){var n=function(t){if(!t)return o;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?o.charset:t.charset;return{allowDots:void 0===t.allowDots?o.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:o.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:o.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:o.comma,decoder:"function"==typeof t.decoder?t.decoder:o.decoder,delimiter:"string"==typeof t.delimiter||i.isRegExp(t.delimiter)?t.delimiter:o.delimiter,depth:"number"==typeof t.depth?t.depth:o.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:o.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:o.strictNullHandling}}(e);if(""===t||null===t||void 0===t)return n.plainObjects?Object.create(null):{};for(var l="string"==typeof t?function(t,e){var n,a={},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,u=e.parameterLimit===1/0?void 0:e.parameterLimit,c=l.split(e.delimiter,u),h=-1,p=e.charset;if(e.charsetSentinel)for(n=0;n<c.length;++n)0===c[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===c[n]?p="utf-8":"utf8=%26%2310003%3B"===c[n]&&(p="iso-8859-1"),h=n,n=c.length);for(n=0;n<c.length;++n)if(n!==h){var d,f,g=c[n],m=g.indexOf("]="),v=-1===m?g.indexOf("="):m+1;-1===v?(d=e.decoder(g,o.decoder,p),f=e.strictNullHandling?null:""):(d=e.decoder(g.slice(0,v),o.decoder,p),f=e.decoder(g.slice(v+1),o.decoder,p)),f&&e.interpretNumericEntities&&"iso-8859-1"===p&&(f=s(f)),f&&e.comma&&f.indexOf(",")>-1&&(f=f.split(",")),r.call(a,d)?a[d]=i.combine(a[d],f):a[d]=f}return a}(t,n):t,u=n.plainObjects?Object.create(null):{},c=Object.keys(l),h=0;h<c.length;++h){var p=c[h],d=a(p,l[p],n);u=i.merge(u,d,n)}return i.compact(u)}},DQCr:function(t,e,n){"use strict";var i=n("cGG2");function r(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(i.isURLSearchParams(e))o=e.toString();else{var s=[];i.forEach(e,function(t,e){null!==t&&void 0!==t&&(i.isArray(t)?e+="[]":t=[t],i.forEach(t,function(t){i.isDate(t)?t=t.toISOString():i.isObject(t)&&(t=JSON.stringify(t)),s.push(r(e)+"="+r(t))}))}),o=s.join("&")}if(o){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}},DQJY:function(t,e,n){"use strict";e.__esModule=!0;var i,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n("hyEB"),s=(i=o)&&i.__esModule?i:{default:i};var a,l=l||{};l.Dialog=function(t,e,n){var i=this;if(this.dialogNode=t,null===this.dialogNode||"dialog"!==this.dialogNode.getAttribute("role"))throw new Error("Dialog() requires a DOM element with ARIA role of dialog.");"string"==typeof e?this.focusAfterClosed=document.getElementById(e):"object"===(void 0===e?"undefined":r(e))?this.focusAfterClosed=e:this.focusAfterClosed=null,"string"==typeof n?this.focusFirst=document.getElementById(n):"object"===(void 0===n?"undefined":r(n))?this.focusFirst=n:this.focusFirst=null,this.focusFirst?this.focusFirst.focus():s.default.focusFirstDescendant(this.dialogNode),this.lastFocus=document.activeElement,a=function(t){i.trapFocus(t)},this.addListeners()},l.Dialog.prototype.addListeners=function(){document.addEventListener("focus",a,!0)},l.Dialog.prototype.removeListeners=function(){document.removeEventListener("focus",a,!0)},l.Dialog.prototype.closeDialog=function(){var t=this;this.removeListeners(),this.focusAfterClosed&&setTimeout(function(){t.focusAfterClosed.focus()})},l.Dialog.prototype.trapFocus=function(t){s.default.IgnoreUtilFocusChanges||(this.dialogNode.contains(t.target)?this.lastFocus=t.target:(s.default.focusFirstDescendant(this.dialogNode),this.lastFocus===document.activeElement&&s.default.focusLastDescendant(this.dialogNode),this.lastFocus=document.activeElement))},e.default=l.Dialog},DUeU:function(t,e,n){"use strict";var i=n("cGG2");t.exports=function(t,e){e=e||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function l(t,e){return i.isPlainObject(t)&&i.isPlainObject(e)?i.merge(t,e):i.isPlainObject(e)?i.merge({},e):i.isArray(e)?e.slice():e}function u(r){i.isUndefined(e[r])?i.isUndefined(t[r])||(n[r]=l(void 0,t[r])):n[r]=l(t[r],e[r])}i.forEach(r,function(t){i.isUndefined(e[t])||(n[t]=l(void 0,e[t]))}),i.forEach(o,u),i.forEach(s,function(r){i.isUndefined(e[r])?i.isUndefined(t[r])||(n[r]=l(void 0,t[r])):n[r]=l(void 0,e[r])}),i.forEach(a,function(i){i in e?n[i]=l(t[i],e[i]):i in t&&(n[i]=l(void 0,t[i]))});var c=r.concat(o).concat(s).concat(a),h=Object.keys(t).concat(Object.keys(e)).filter(function(t){return-1===c.indexOf(t)});return i.forEach(h,u),n}},Dd8w:function(t,e,n){"use strict";e.__esModule=!0;var i,r=n("woOf"),o=(i=r)&&i.__esModule?i:{default:i};e.default=o.default||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}},DuR2:function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"E/in":function(t,e,n){"use strict";e.__esModule=!0,e.isDef=function(t){return void 0!==t&&null!==t},e.isKorean=function(t){return/([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(t)}},EGZi:function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},EKTV:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=119)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},119:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-checkbox",class:[t.border&&t.checkboxSize?"el-checkbox--"+t.checkboxSize:"",{"is-disabled":t.isDisabled},{"is-bordered":t.border},{"is-checked":t.isChecked}],attrs:{id:t.id}},[n("span",{staticClass:"el-checkbox__input",class:{"is-disabled":t.isDisabled,"is-checked":t.isChecked,"is-indeterminate":t.indeterminate,"is-focus":t.focus},attrs:{tabindex:!!t.indeterminate&&0,role:!!t.indeterminate&&"checkbox","aria-checked":!!t.indeterminate&&"mixed"}},[n("span",{staticClass:"el-checkbox__inner"}),t.trueLabel||t.falseLabel?n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox__original",attrs:{type:"checkbox","aria-hidden":t.indeterminate?"true":"false",name:t.name,disabled:t.isDisabled,"true-value":t.trueLabel,"false-value":t.falseLabel},domProps:{checked:Array.isArray(t.model)?t._i(t.model,null)>-1:t._q(t.model,t.trueLabel)},on:{change:[function(e){var n=t.model,i=e.target,r=i.checked?t.trueLabel:t.falseLabel;if(Array.isArray(n)){var o=t._i(n,null);i.checked?o<0&&(t.model=n.concat([null])):o>-1&&(t.model=n.slice(0,o).concat(n.slice(o+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}):n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox__original",attrs:{type:"checkbox","aria-hidden":t.indeterminate?"true":"false",disabled:t.isDisabled,name:t.name},domProps:{value:t.label,checked:Array.isArray(t.model)?t._i(t.model,t.label)>-1:t.model},on:{change:[function(e){var n=t.model,i=e.target,r=!!i.checked;if(Array.isArray(n)){var o=t.label,s=t._i(n,o);i.checked?s<0&&(t.model=n.concat([o])):s>-1&&(t.model=n.slice(0,s).concat(n.slice(s+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}})]),t.$slots.default||t.label?n("span",{staticClass:"el-checkbox__label"},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2):t._e()])};i._withStripped=!0;var r=n(4),o={name:"ElCheckbox",mixins:[n.n(r).a],inject:{elForm:{default:""},elFormItem:{default:""}},componentName:"ElCheckbox",data:function(){return{selfModel:!1,focus:!1,isLimitExceeded:!1}},computed:{model:{get:function(){return this.isGroup?this.store:void 0!==this.value?this.value:this.selfModel},set:function(t){this.isGroup?(this.isLimitExceeded=!1,void 0!==this._checkboxGroup.min&&t.length<this._checkboxGroup.min&&(this.isLimitExceeded=!0),void 0!==this._checkboxGroup.max&&t.length>this._checkboxGroup.max&&(this.isLimitExceeded=!0),!1===this.isLimitExceeded&&this.dispatch("ElCheckboxGroup","input",[t])):(this.$emit("input",t),this.selfModel=t)}},isChecked:function(){return"[object Boolean]"==={}.toString.call(this.model)?this.model:Array.isArray(this.model)?this.model.indexOf(this.label)>-1:null!==this.model&&void 0!==this.model?this.model===this.trueLabel:void 0},isGroup:function(){for(var t=this.$parent;t;){if("ElCheckboxGroup"===t.$options.componentName)return this._checkboxGroup=t,!0;t=t.$parent}return!1},store:function(){return this._checkboxGroup?this._checkboxGroup.value:this.value},isLimitDisabled:function(){var t=this._checkboxGroup,e=t.max,n=t.min;return!(!e&&!n)&&this.model.length>=e&&!this.isChecked||this.model.length<=n&&this.isChecked},isDisabled:function(){return this.isGroup?this._checkboxGroup.disabled||this.disabled||(this.elForm||{}).disabled||this.isLimitDisabled:this.disabled||(this.elForm||{}).disabled},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},checkboxSize:function(){var t=this.size||this._elFormItemSize||(this.$ELEMENT||{}).size;return this.isGroup&&this._checkboxGroup.checkboxGroupSize||t}},props:{value:{},label:{},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:String,trueLabel:[String,Number],falseLabel:[String,Number],id:String,controls:String,border:Boolean,size:String},methods:{addToStore:function(){Array.isArray(this.model)&&-1===this.model.indexOf(this.label)?this.model.push(this.label):this.model=this.trueLabel||!0},handleChange:function(t){var e=this;if(!this.isLimitExceeded){var n=void 0;n=t.target.checked?void 0===this.trueLabel||this.trueLabel:void 0!==this.falseLabel&&this.falseLabel,this.$emit("change",n,t),this.$nextTick(function(){e.isGroup&&e.dispatch("ElCheckboxGroup","change",[e._checkboxGroup.value])})}}},created:function(){this.checked&&this.addToStore()},mounted:function(){this.indeterminate&&this.$el.setAttribute("aria-controls",this.controls)},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",t)}}},s=n(0),a=Object(s.a)(o,i,[],!1,null,null,null);a.options.__file="packages/checkbox/src/checkbox.vue";var l=a.exports;l.install=function(t){t.component(l.name,l)};e.default=l},4:function(t,e){t.exports=n("fPll")}})},EKta:function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,i=u(t),s=i[0],a=i[1],l=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),c=0,h=a>0?s-4:s;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],l[c++]=e>>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===a&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,l[c++]=255&e);1===a&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,n=t.length,r=n%3,o=[],s=0,a=n-r;s<a;s+=16383)o.push(c(t,s,s+16383>a?a:s+16383));1===r?(e=t[n-1],o.push(i[e>>2]+i[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return o.join("")};for(var i=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a<l;++a)i[a]=s[a],r[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var r,o,s=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(i[(o=r)>>18&63]+i[o>>12&63]+i[o>>6&63]+i[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},EqBC:function(t,e,n){"use strict";var i=n("kM2E"),r=n("FeBl"),o=n("7KvD"),s=n("t8x9"),a=n("fJUb");i(i.P+i.R,"Promise",{finally:function(t){var e=s(this,r.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return a(e,t()).then(function(){return n})}:t,n?function(n){return a(e,t()).then(function(){throw n})}:t)}})},EqjI:function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},EuP9:function(t,e,n){"use strict";(function(t){
  42. /*!
  43. * The buffer module from node.js, for the browser.
  44. *
  45. * @author Feross Aboukhadijeh <http://feross.org>
  46. * @license MIT
  47. */
  48. var i=n("EKta"),r=n("ujcs"),o=n("sOR5");function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=l.prototype:(null===t&&(t=new l(e)),t.length=e),t}function l(t,e,n){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,n)}function u(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,i){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i);l.TYPED_ARRAY_SUPPORT?(t=e).__proto__=l.prototype:t=p(t,e);return t}(t,e,n,i):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!l.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|f(e,n),r=(t=a(t,i)).write(e,n);r!==i&&(t=t.slice(0,r));return t}(t,e,n):function(t,e){if(l.isBuffer(e)){var n=0|d(e.length);return 0===(t=a(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?a(t,0):p(t,e);if("Buffer"===e.type&&o(e.data))return p(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(c(e),t=a(t,e<0?0:0|d(e)),!l.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function p(t,e){var n=e.length<0?0:0|d(e.length);t=a(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(i)return V(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function m(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var o,s=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(r){var c=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===l)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(n+l>a&&(n=a-l),o=n;o>=0;o--){for(var h=!0,p=0;p<l;p++)if(u(t,o+p)!==u(e,p)){h=!1;break}if(h)return o}return-1}function _(t,e,n,i){n=Number(n)||0;var r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function y(t,e,n,i){return W(V(e,t.length-n),t,n,i)}function b(t,e,n,i){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function T(t,e,n,i){return b(t,e,n,i)}function E(t,e,n,i){return W(H(e),t,n,i)}function C(t,e,n,i){return W(function(t,e){for(var n,i,r,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),i=n>>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function S(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function w(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r<n;){var o,s,a,l,u=t[r],c=null,h=u>239?4:u>223?3:u>191?2:1;if(r+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[r+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),r+=h}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=k));return n}(i)}e.Buffer=l,e.SlowBuffer=function(t){+t!=t&&(t=0);return l.alloc(+t)},e.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,n){return u(null,t,e,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,n){return function(t,e,n,i){return c(e),e<=0?a(t,e):void 0!==n?"string"==typeof i?a(t,e).fill(n,i):a(t,e).fill(n):a(t,e)}(null,t,e,n)},l.allocUnsafe=function(t){return h(null,t)},l.allocUnsafeSlow=function(t){return h(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,r=0,o=Math.min(n,i);r<o;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=l.allocUnsafe(e),r=0;for(n=0;n<t.length;++n){var s=t[n];if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},l.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},l.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},l.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?w(this,0,t):function(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return w(this,e,n);case"ascii":return x(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return S(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,r>>>=0,this===t)return 0;for(var o=r-i,s=n-e,a=Math.min(o,s),u=this.slice(i,r),c=t.slice(e,n),h=0;h<a;++h)if(u[h]!==c[h]){o=u[h],s=c[h];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},l.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},l.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},l.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return b(this,t,e,n);case"latin1":case"binary":return T(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function x(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function I(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function R(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=e;o<n;++o)r+=U(t[o]);return r}function O(t,e,n){for(var i=t.slice(e,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function D(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,n,i,r,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<o)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function M(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r<o;++r)t[n+r]=(e&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function N(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r<o;++r)t[n+r]=e>>>8*(i?r:3-r)&255}function L(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,i,o){return o||L(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function B(t,e,n,i,o){return o||L(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if(t=~~t,e=void 0===e?i:~~e,t<0?(t+=i)<0&&(t=0):t>i&&(t=i),e<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),l.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=l.prototype;else{var r=e-t;n=new l(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+t]}return n},l.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i},l.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var i=this[t+--e],r=1;e>0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||D(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||A(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},l.prototype.writeUIntBE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||A(this,t,e,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);A(this,t,e,n,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);A(this,t,e,n,r-1,-r)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var r,o=i-n;if(this===t&&n<e&&e<i)for(r=o-1;r>=0;--r)t[r+e]=this[r+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)t[r+e]=this[r+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},l.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=l.isBuffer(t)?t:V(new l(t,i).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var n;e=e||1/0;for(var i=t.length,r=null,o=[],s=0;s<i;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,n,i){for(var r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(e,n("DuR2"))},Ew4t:function(t,e,n){var i,r,o,s;s=function(t,e,n,i){
  49. /**
  50. * @license
  51. * Copyright 2019 Google LLC
  52. * SPDX-License-Identifier: Apache-2.0
  53. */
  54. "use strict";return t.setLocale(e),t.Blocks=t.Blocks||{},Object.keys(n).forEach(function(e){t.Blocks[e]=n[e]}),t.JavaScript=i,t},r=[n("xnUL"),n("yUki"),n("wTUY"),n("Cr6W")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},FeBl:function(t,e){var n=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},FtD3:function(t,e,n){"use strict";var i=n("t8qj");t.exports=function(t,e,n,r,o){var s=new Error(t);return i(s,e,n,r,o)}},GEkh:function(t,e,n){(function(n){var i,r,o;r=[],void 0===(o="function"==typeof(i=function(){"use strict";var t={connectionTypes:{INPUT_VALUE:1,OUTPUT_VALUE:2,NEXT_STATEMENT:3,PREVIOUS_STATEMENT:4},constants:{},LINE_MODE_MULTIPLIER:40,PAGE_MODE_MULTIPLIER:125,DRAG_RADIUS:5,FLYOUT_DRAG_RADIUS:10,SNAP_RADIUS:28};return t.CONNECTING_SNAP_RADIUS=t.SNAP_RADIUS,t.CURRENT_CONNECTION_PREFERENCE=8,t.BUMP_DELAY=250,t.BUMP_RANDOMNESS=10,t.COLLAPSE_CHARS=30,t.LONGPRESS=750,t.SOUND_LIMIT=100,t.DRAG_STACK=!0,t.HSV_SATURATION=.45,t.HSV_VALUE=.65,t.SPRITE={width:96,height:124,url:"sprites.png"},t.constants.ALIGN={LEFT:-1,CENTRE:0,RIGHT:1},t.DRAG_NONE=0,t.DRAG_STICKY=1,t.DRAG_BEGIN=1,t.DRAG_FREE=2,t.OPPOSITE_TYPE=[],t.OPPOSITE_TYPE[t.connectionTypes.INPUT_VALUE]=t.connectionTypes.OUTPUT_VALUE,t.OPPOSITE_TYPE[t.connectionTypes.OUTPUT_VALUE]=t.connectionTypes.INPUT_VALUE,t.OPPOSITE_TYPE[t.connectionTypes.NEXT_STATEMENT]=t.connectionTypes.PREVIOUS_STATEMENT,t.OPPOSITE_TYPE[t.connectionTypes.PREVIOUS_STATEMENT]=t.connectionTypes.NEXT_STATEMENT,t.VARIABLE_CATEGORY_NAME="VARIABLE",t.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC",t.PROCEDURE_CATEGORY_NAME="PROCEDURE",t.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID",t.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID",t.constants.COLLAPSED_INPUT_NAME="_TEMP_COLLAPSED_INPUT",t.constants.COLLAPSED_FIELD_NAME="_TEMP_COLLAPSED_FIELD",t.utils={},t.utils.global=function(){return"object"==typeof self?self:"object"==typeof window?window:"object"==typeof n?n:this}(),t.Msg={},t.utils.global.Blockly||(t.utils.global.Blockly={}),t.utils.global.Blockly.Msg||(t.utils.global.Blockly.Msg=t.Msg),t.utils.colour={},t.utils.colour.parse=function(e){e=String(e).toLowerCase().trim();var n=t.utils.colour.names[e];if(n)return n;if(n="#"==(n="0x"==e.substring(0,2)?"#"+e.substring(2):e)[0]?n:"#"+n,/^#[0-9a-f]{6}$/.test(n))return n;if(/^#[0-9a-f]{3}$/.test(n))return["#",n[1],n[1],n[2],n[2],n[3],n[3]].join("");var i=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return i&&(e=Number(i[1]),n=Number(i[2]),i=Number(i[3]),0<=e&&256>e&&0<=n&&256>n&&0<=i&&256>i)?t.utils.colour.rgbToHex(e,n,i):null},t.utils.colour.rgbToHex=function(t,e,n){return e=t<<16|e<<8|n,16>t?"#"+(16777216|e).toString(16).substr(1):"#"+e.toString(16)},t.utils.colour.hexToRgb=function(e){return(e=t.utils.colour.parse(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},t.utils.colour.hsvToHex=function(e,n,i){var r=0,o=0,s=0;if(0==n)s=o=r=i;else{var a=Math.floor(e/60),l=e/60-a;e=i*(1-n);var u=i*(1-n*l);switch(n=i*(1-n*(1-l)),a){case 1:r=u,o=i,s=e;break;case 2:r=e,o=i,s=n;break;case 3:r=e,o=u,s=i;break;case 4:r=n,o=e,s=i;break;case 5:r=i,o=e,s=u;break;case 6:case 0:r=i,o=n,s=e}}return t.utils.colour.rgbToHex(Math.floor(r),Math.floor(o),Math.floor(s))},t.utils.colour.blend=function(e,n,i){return(e=t.utils.colour.parse(e))&&(n=t.utils.colour.parse(n))?(e=t.utils.colour.hexToRgb(e),n=t.utils.colour.hexToRgb(n),t.utils.colour.rgbToHex(Math.round(n[0]+i*(e[0]-n[0])),Math.round(n[1]+i*(e[1]-n[1])),Math.round(n[2]+i*(e[2]-n[2])))):null},t.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},t.utils.Coordinate=function(t,e){this.x=t,this.y=e},t.utils.Coordinate.equals=function(t,e){return t==e||!(!t||!e)&&(t.x==e.x&&t.y==e.y)},t.utils.Coordinate.distance=function(t,e){var n=t.x-e.x;return t=t.y-e.y,Math.sqrt(n*n+t*t)},t.utils.Coordinate.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.utils.Coordinate.difference=function(e,n){return new t.utils.Coordinate(e.x-n.x,e.y-n.y)},t.utils.Coordinate.sum=function(e,n){return new t.utils.Coordinate(e.x+n.x,e.y+n.y)},t.utils.Coordinate.prototype.clone=function(){return new t.utils.Coordinate(this.x,this.y)},t.utils.Coordinate.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.utils.Coordinate.prototype.translate=function(t,e){return this.x+=t,this.y+=e,this},t.utils.Rect=function(t,e,n,i){this.top=t,this.bottom=e,this.left=n,this.right=i},t.utils.Rect.prototype.contains=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t.utils.Rect.prototype.intersects=function(t){return!(this.left>t.right||this.right<t.left||this.top>t.bottom||this.bottom<t.top)},t.utils.string={},t.utils.string.startsWith=function(t,e){return 0==t.lastIndexOf(e,0)},t.utils.string.shortestStringLength=function(t){return t.length?t.reduce(function(t,e){return t.length<e.length?t:e}).length:0},t.utils.string.commonWordPrefix=function(e,n){if(!e.length)return 0;if(1==e.length)return e[0].length;var i=0;n=n||t.utils.string.shortestStringLength(e);for(var r=0;r<n;r++){for(var o=e[0][r],s=1;s<e.length;s++)if(o!=e[s][r])return i;" "==o&&(i=r+1)}for(s=1;s<e.length;s++)if((o=e[s][r])&&" "!=o)return i;return n},t.utils.string.commonWordSuffix=function(e,n){if(!e.length)return 0;if(1==e.length)return e[0].length;var i=0;n=n||t.utils.string.shortestStringLength(e);for(var r=0;r<n;r++){for(var o=e[0].substr(-r-1,1),s=1;s<e.length;s++)if(o!=e[s].substr(-r-1,1))return i;" "==o&&(i=r+1)}for(s=1;s<e.length;s++)if((o=e[s].charAt(e[s].length-r-1))&&" "!=o)return i;return n},t.utils.string.wrap=function(e,n){e=e.split("\n");for(var i=0;i<e.length;i++)e[i]=t.utils.string.wrapLine_(e[i],n);return e.join("\n")},t.utils.string.wrapLine_=function(e,n){if(e.length<=n)return e;for(var i=e.trim().split(/\s+/),r=0;r<i.length;r++)i[r].length>n&&(n=i[r].length);r=-1/0;var o=1;do{var s=r,a=e;e=[];var l=i.length/o,u=1;for(r=0;r<i.length-1;r++)u<(r+1.5)/l?(u++,e[r]=!0):e[r]=!1;e=t.utils.string.wrapMutate_(i,e,n),r=t.utils.string.wrapScore_(i,e,n),e=t.utils.string.wrapToText_(i,e),o++}while(r>s);return a},t.utils.string.wrapScore_=function(t,e,n){for(var i=[0],r=[],o=0;o<t.length;o++)i[i.length-1]+=t[o].length,!0===e[o]?(i.push(0),r.push(t[o].charAt(t[o].length-1))):!1===e[o]&&i[i.length-1]++;for(t=Math.max.apply(Math,i),o=e=0;o<i.length;o++)e-=2*Math.pow(Math.abs(n-i[o]),1.5),e-=Math.pow(t-i[o],1.5),-1!=".?!".indexOf(r[o])?e+=n/3:-1!=",;)]}".indexOf(r[o])&&(e+=n/4);return 1<i.length&&i[i.length-1]<=i[i.length-2]&&(e+=.5),e},t.utils.string.wrapMutate_=function(e,n,i){for(var r,o=t.utils.string.wrapScore_(e,n,i),s=0;s<n.length-1;s++)if(n[s]!=n[s+1]){var a=[].concat(n);a[s]=!a[s],a[s+1]=!a[s+1];var l=t.utils.string.wrapScore_(e,a,i);l>o&&(o=l,r=a)}return r?t.utils.string.wrapMutate_(e,r,i):n},t.utils.string.wrapToText_=function(t,e){for(var n=[],i=0;i<t.length;i++)n.push(t[i]),void 0!==e[i]&&n.push(e[i]?"\n":" ");return n.join("")},t.utils.Size=function(t,e){this.width=t,this.height=e},t.utils.Size.equals=function(t,e){return t==e||!(!t||!e)&&(t.width==e.width&&t.height==e.height)},t.utils.style={},t.utils.style.getSize=function(e){if("none"!=t.utils.style.getStyle_(e,"display"))return t.utils.style.getSizeWithDisplay_(e);var n=e.style,i=n.display,r=n.visibility,o=n.position;n.visibility="hidden",n.position="absolute",n.display="inline";var s=e.offsetWidth;return e=e.offsetHeight,n.display=i,n.position=o,n.visibility=r,new t.utils.Size(s,e)},t.utils.style.getSizeWithDisplay_=function(e){return new t.utils.Size(e.offsetWidth,e.offsetHeight)},t.utils.style.getStyle_=function(e,n){return t.utils.style.getComputedStyle(e,n)||t.utils.style.getCascadedStyle(e,n)||e.style&&e.style[n]},t.utils.style.getComputedStyle=function(t,e){return document.defaultView&&document.defaultView.getComputedStyle&&(t=document.defaultView.getComputedStyle(t,null))&&(t[e]||t.getPropertyValue(e))||""},t.utils.style.getCascadedStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:null},t.utils.style.getPageOffset=function(e){var n=new t.utils.Coordinate(0,0);e=e.getBoundingClientRect();var i=document.documentElement;return i=new t.utils.Coordinate(window.pageXOffset||i.scrollLeft,window.pageYOffset||i.scrollTop),n.x=e.left+i.x,n.y=e.top+i.y,n},t.utils.style.getViewportPageOffset=function(){var e=document.body,n=document.documentElement;return new t.utils.Coordinate(e.scrollLeft||n.scrollLeft,e.scrollTop||n.scrollTop)},t.utils.style.setElementShown=function(t,e){t.style.display=e?"":"none"},t.utils.style.isRightToLeft=function(e){return"rtl"==t.utils.style.getStyle_(e,"direction")},t.utils.style.getBorderBox=function(e){var n=t.utils.style.getComputedStyle(e,"borderLeftWidth"),i=t.utils.style.getComputedStyle(e,"borderRightWidth"),r=t.utils.style.getComputedStyle(e,"borderTopWidth");return e=t.utils.style.getComputedStyle(e,"borderBottomWidth"),{top:parseFloat(r),right:parseFloat(i),bottom:parseFloat(e),left:parseFloat(n)}},t.utils.style.scrollIntoContainerView=function(e,n,i){e=t.utils.style.getContainerOffsetToScrollInto(e,n,i),n.scrollLeft=e.x,n.scrollTop=e.y},t.utils.style.getContainerOffsetToScrollInto=function(e,n,i){var r=t.utils.style.getPageOffset(e),o=t.utils.style.getPageOffset(n),s=t.utils.style.getBorderBox(n),a=r.x-o.x-s.left;return r=r.y-o.y-s.top,o=t.utils.style.getSizeWithDisplay_(e),e=n.clientWidth-o.width,o=n.clientHeight-o.height,s=n.scrollLeft,n=n.scrollTop,i?(s+=a-e/2,n+=r-o/2):(s+=Math.min(a,Math.max(a-e,0)),n+=Math.min(r,Math.max(r-o,0))),new t.utils.Coordinate(s,n)},t.utils.userAgent={},function(e){function n(t){return-1!=i.indexOf(t.toUpperCase())}t.utils.userAgent.raw=e;var i=t.utils.userAgent.raw.toUpperCase();t.utils.userAgent.IE=n("Trident")||n("MSIE"),t.utils.userAgent.EDGE=n("Edge"),t.utils.userAgent.JAVA_FX=n("JavaFX"),t.utils.userAgent.CHROME=(n("Chrome")||n("CriOS"))&&!t.utils.userAgent.EDGE,t.utils.userAgent.WEBKIT=n("WebKit")&&!t.utils.userAgent.EDGE,t.utils.userAgent.GECKO=n("Gecko")&&!t.utils.userAgent.WEBKIT&&!t.utils.userAgent.IE&&!t.utils.userAgent.EDGE,t.utils.userAgent.ANDROID=n("Android"),e=t.utils.global.navigator&&t.utils.global.navigator.maxTouchPoints,t.utils.userAgent.IPAD=n("iPad")||n("Macintosh")&&0<e,t.utils.userAgent.IPOD=n("iPod"),t.utils.userAgent.IPHONE=n("iPhone")&&!t.utils.userAgent.IPAD&&!t.utils.userAgent.IPOD,t.utils.userAgent.MAC=n("Macintosh"),t.utils.userAgent.TABLET=t.utils.userAgent.IPAD||t.utils.userAgent.ANDROID&&!n("Mobile")||n("Silk"),t.utils.userAgent.MOBILE=!t.utils.userAgent.TABLET&&(t.utils.userAgent.IPOD||t.utils.userAgent.IPHONE||t.utils.userAgent.ANDROID||n("IEMobile"))}(t.utils.global.navigator&&t.utils.global.navigator.userAgent||""),t.utils.noEvent=function(t){t.preventDefault(),t.stopPropagation()},t.utils.isTargetInput=function(t){return"textarea"==t.target.type||"text"==t.target.type||"number"==t.target.type||"email"==t.target.type||"password"==t.target.type||"search"==t.target.type||"tel"==t.target.type||"url"==t.target.type||t.target.isContentEditable||t.target.dataset&&"true"==t.target.dataset.isTextInput},t.utils.getRelativeXY=function(e){var n=new t.utils.Coordinate(0,0),i=e.getAttribute("x");return i&&(n.x=parseInt(i,10)),(i=e.getAttribute("y"))&&(n.y=parseInt(i,10)),(i=(i=e.getAttribute("transform"))&&i.match(t.utils.getRelativeXY.XY_REGEX_))&&(n.x+=Number(i[1]),i[3]&&(n.y+=Number(i[3]))),(e=e.getAttribute("style"))&&-1<e.indexOf("translate")&&(e=e.match(t.utils.getRelativeXY.XY_STYLE_REGEX_))&&(n.x+=Number(e[1]),e[3]&&(n.y+=Number(e[3]))),n},t.utils.getInjectionDivXY_=function(e){for(var n=0,i=0;e;){var r=t.utils.getRelativeXY(e);if(n+=r.x,i+=r.y,-1!=(" "+(e.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;e=e.parentNode}return new t.utils.Coordinate(n,i)},t.utils.getRelativeXY.XY_REGEX_=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,t.utils.getRelativeXY.XY_STYLE_REGEX_=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,t.utils.isRightButton=function(e){return!(!e.ctrlKey||!t.utils.userAgent.MAC)||2==e.button},t.utils.mouseToSvg=function(t,e,n){var i=e.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,n||(n=e.getScreenCTM().inverse()),i.matrixTransform(n)},t.utils.getScrollDeltaPixels=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*t.LINE_MODE_MULTIPLIER,y:e.deltaY*t.LINE_MODE_MULTIPLIER};case 2:return{x:e.deltaX*t.PAGE_MODE_MULTIPLIER,y:e.deltaY*t.PAGE_MODE_MULTIPLIER}}},t.utils.tokenizeInterpolation=function(e){return t.utils.tokenizeInterpolation_(e,!0)},t.utils.replaceMessageReferences=function(e){return"string"!=typeof e?e:(e=t.utils.tokenizeInterpolation_(e,!1)).length?String(e[0]):""},t.utils.checkMessageReferences=function(e){for(var n=!0,i=t.Msg,r=e.match(/%{BKY_[A-Z]\w*}/gi),o=0;o<r.length;o++){void 0==i[r[o].toUpperCase().slice(6,-1)]&&(console.warn("No message string for "+r[o]+" in "+e),n=!1)}return n},t.utils.tokenizeInterpolation_=function(e,n){var i=[],r=e.split("");r.push("");var o=0;e=[];for(var s=null,a=0;a<r.length;a++){var l=r[a];0==o?"%"==l?((l=e.join(""))&&i.push(l),e.length=0,o=1):e.push(l):1==o?"%"==l?(e.push(l),o=0):n&&"0"<=l&&"9">=l?(o=2,s=l,(l=e.join(""))&&i.push(l),e.length=0):"{"==l?o=3:(e.push("%",l),o=0):2==o?"0"<=l&&"9">=l?s+=l:(i.push(parseInt(s,10)),a--,o=0):3==o&&(""==l?(e.splice(0,0,"%{"),a--,o=0):"}"!=l?e.push(l):(o=e.join(""),/[A-Z]\w*/i.test(o)?(l=o.toUpperCase(),(l=t.utils.string.startsWith(l,"BKY_")?l.substring(4):null)&&l in t.Msg?"string"==typeof(o=t.Msg[l])?Array.prototype.push.apply(i,t.utils.tokenizeInterpolation_(o,n)):n?i.push(String(o)):i.push(o):i.push("%{"+o+"}")):i.push("%{"+o+"}"),o=e.length=0))}for((l=e.join(""))&&i.push(l),n=[],a=e.length=0;a<i.length;++a)"string"==typeof i[a]?e.push(i[a]):((l=e.join(""))&&n.push(l),e.length=0,n.push(i[a]));return(l=e.join(""))&&n.push(l),e.length=0,n},t.utils.genUid=function(){for(var e=t.utils.genUid.soup_.length,n=[],i=0;20>i;i++)n[i]=t.utils.genUid.soup_.charAt(Math.random()*e);return n.join("")},t.utils.genUid.soup_="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t.utils.is3dSupported=function(){if(void 0!==t.utils.is3dSupported.cached_)return t.utils.is3dSupported.cached_;if(!t.utils.global.getComputedStyle)return!1;var e=document.createElement("p"),n="none",i={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var r in document.body.insertBefore(e,null),i)if(void 0!==e.style[r]){if(e.style[r]="translate3d(1px,1px,1px)",!(n=t.utils.global.getComputedStyle(e)))return document.body.removeChild(e),!1;n=n.getPropertyValue(i[r])}return document.body.removeChild(e),t.utils.is3dSupported.cached_="none"!==n,t.utils.is3dSupported.cached_},t.utils.runAfterPageLoad=function(t){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)t();else var e=setInterval(function(){"complete"==document.readyState&&(clearInterval(e),t())},10)},t.utils.getViewportBBox=function(){var e=t.utils.style.getViewportPageOffset();return new t.utils.Rect(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},t.utils.arrayRemove=function(t,e){return-1!=(e=t.indexOf(e))&&(t.splice(e,1),!0)},t.utils.getDocumentScroll=function(){var e=document.documentElement,n=window;return t.utils.userAgent.IE&&n.pageYOffset!=e.scrollTop?new t.utils.Coordinate(e.scrollLeft,e.scrollTop):new t.utils.Coordinate(n.pageXOffset||e.scrollLeft,n.pageYOffset||e.scrollTop)},t.utils.getBlockTypeCounts=function(t,e){var n=Object.create(null),i=t.getDescendants(!0);for(e&&(t=t.getNextBlock())&&(t=i.indexOf(t),i.splice(t,i.length-t)),t=0;e=i[t];t++)n[e.type]?n[e.type]++:n[e.type]=1;return n},t.utils.screenToWsCoordinates=function(e,n){var i=n.x;n=n.y;var r=e.getInjectionDiv().getBoundingClientRect();return i=new t.utils.Coordinate(i-r.left,n-r.top),n=e.getOriginOffsetInPixels(),t.utils.Coordinate.difference(i,n).scale(1/e.scale)},t.utils.parseBlockColour=function(e){var n="string"==typeof e?t.utils.replaceMessageReferences(e):e,i=Number(n);if(!isNaN(i)&&0<=i&&360>=i)return{hue:i,hex:t.utils.colour.hsvToHex(i,t.HSV_SATURATION,255*t.HSV_VALUE)};if(i=t.utils.colour.parse(n))return{hue:null,hex:i};throw i='Invalid colour: "'+n+'"',e!=n&&(i+=' (from "'+e+'")'),Error(i)},t.Touch={},t.Touch.TOUCH_ENABLED="ontouchstart"in t.utils.global||!!(t.utils.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!t.utils.global.navigator||!t.utils.global.navigator.maxTouchPoints&&!t.utils.global.navigator.msMaxTouchPoints),t.Touch.touchIdentifier_=null,t.Touch.TOUCH_MAP={},t.utils.global.PointerEvent?t.Touch.TOUCH_MAP={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:t.Touch.TOUCH_ENABLED&&(t.Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]}),t.longPid_=0,t.longStart=function(e,n){t.longStop_(),e.changedTouches&&1!=e.changedTouches.length||(t.longPid_=setTimeout(function(){e.changedTouches&&(e.button=2,e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),n&&n.handleRightClick(e)},t.LONGPRESS))},t.longStop_=function(){t.longPid_&&(clearTimeout(t.longPid_),t.longPid_=0)},t.Touch.clearTouchIdentifier=function(){t.Touch.touchIdentifier_=null},t.Touch.shouldHandleEvent=function(e){return!t.Touch.isMouseOrTouchEvent(e)||t.Touch.checkTouchIdentifier(e)},t.Touch.getTouchIdentifierFromEvent=function(t){return void 0!=t.pointerId?t.pointerId:t.changedTouches&&t.changedTouches[0]&&void 0!==t.changedTouches[0].identifier&&null!==t.changedTouches[0].identifier?t.changedTouches[0].identifier:"mouse"},t.Touch.checkTouchIdentifier=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);return void 0!==t.Touch.touchIdentifier_&&null!==t.Touch.touchIdentifier_?t.Touch.touchIdentifier_==n:("mousedown"==e.type||"touchstart"==e.type||"pointerdown"==e.type)&&(t.Touch.touchIdentifier_=n,!0)},t.Touch.setClientFromTouch=function(e){if(t.utils.string.startsWith(e.type,"touch")){var n=e.changedTouches[0];e.clientX=n.clientX,e.clientY=n.clientY}},t.Touch.isMouseOrTouchEvent=function(e){return t.utils.string.startsWith(e.type,"touch")||t.utils.string.startsWith(e.type,"mouse")||t.utils.string.startsWith(e.type,"pointer")},t.Touch.isTouchEvent=function(e){return t.utils.string.startsWith(e.type,"touch")||t.utils.string.startsWith(e.type,"pointer")},t.Touch.splitEventByTouches=function(t){var e=[];if(t.changedTouches)for(var n=0;n<t.changedTouches.length;n++)e[n]={type:t.type,changedTouches:[t.changedTouches[n]],target:t.target,stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()}};else e.push(t);return e},t.browserEvents={},t.browserEvents.conditionalBind=function(e,n,i,r,o,s){var a=!1,l=function(e){var n=!o;e=t.Touch.splitEventByTouches(e);for(var s,l=0;s=e[l];l++)n&&!t.Touch.shouldHandleEvent(s)||(t.Touch.setClientFromTouch(s),i?r.call(i,s):r(s),a=!0)},u=[];if(t.utils.global.PointerEvent&&n in t.Touch.TOUCH_MAP)for(var c,h=0;c=t.Touch.TOUCH_MAP[n][h];h++)e.addEventListener(c,l,!1),u.push([e,c,l]);else if(e.addEventListener(n,l,!1),u.push([e,n,l]),n in t.Touch.TOUCH_MAP){var p=function(t){l(t),a&&!s&&t.preventDefault()};for(h=0;c=t.Touch.TOUCH_MAP[n][h];h++)e.addEventListener(c,p,!1),u.push([e,c,p])}return u},t.browserEvents.bind=function(e,n,i,r){var o=function(t){i?r.call(i,t):r(t)},s=[];if(t.utils.global.PointerEvent&&n in t.Touch.TOUCH_MAP)for(var a,l=0;a=t.Touch.TOUCH_MAP[n][l];l++)e.addEventListener(a,o,!1),s.push([e,a,o]);else if(e.addEventListener(n,o,!1),s.push([e,n,o]),n in t.Touch.TOUCH_MAP){var u=function(t){if(t.changedTouches&&1==t.changedTouches.length){var e=t.changedTouches[0];t.clientX=e.clientX,t.clientY=e.clientY}o(t),t.preventDefault()};for(l=0;a=t.Touch.TOUCH_MAP[n][l];l++)e.addEventListener(a,u,!1),s.push([e,a,u])}return s},t.browserEvents.unbind=function(t){for(;t.length;){var e=t.pop(),n=e[2];e[0].removeEventListener(e[1],n,!1)}return n},t.ComponentManager=function(){this.componentData_=Object.create(null),this.capabilityToComponentIds_=Object.create(null)},t.ComponentManager.prototype.addComponent=function(t,e){var n=t.component.id;if(!e&&this.componentData_[n])throw Error('Plugin "'+n+'" with capabilities "'+this.componentData_[n].capabilities+'" already added.');this.componentData_[n]=t,e=[];for(var i=0;i<t.capabilities.length;i++){var r=String(t.capabilities[i]).toLowerCase();e.push(r),void 0===this.capabilityToComponentIds_[r]?this.capabilityToComponentIds_[r]=[n]:this.capabilityToComponentIds_[r].push(n)}this.componentData_[n].capabilities=e},t.ComponentManager.prototype.removeComponent=function(t){var e=this.componentData_[t];if(e){for(var n=0;n<e.capabilities.length;n++){var i=String(e.capabilities[n]).toLowerCase();this.capabilityToComponentIds_[i].splice(this.capabilityToComponentIds_[i].indexOf(t),1)}delete this.componentData_[t]}},t.ComponentManager.prototype.addCapability=function(t,e){if(!this.getComponent(t))throw Error('Cannot add capability, "'+e+'". Plugin "'+t+'" has not been added to the ComponentManager');this.hasCapability(t,e)?console.warn('Plugin "'+t+'already has capability "'+e+'"'):(e=String(e).toLowerCase(),this.componentData_[t].capabilities.push(e),this.capabilityToComponentIds_[e].push(t))},t.ComponentManager.prototype.removeCapability=function(t,e){if(!this.getComponent(t))throw Error('Cannot remove capability, "'+e+'". Plugin "'+t+'" has not been added to the ComponentManager');this.hasCapability(t,e)?(e=String(e).toLowerCase(),this.componentData_[t].capabilities.splice(this.componentData_[t].capabilities.indexOf(e),1),this.capabilityToComponentIds_[e].splice(this.capabilityToComponentIds_[e].indexOf(t),1)):console.warn('Plugin "'+t+"doesn't have capability \""+e+'" to remove')},t.ComponentManager.prototype.hasCapability=function(t,e){return e=String(e).toLowerCase(),-1!==this.componentData_[t].capabilities.indexOf(e)},t.ComponentManager.prototype.getComponent=function(t){return this.componentData_[t]&&this.componentData_[t].component},t.ComponentManager.prototype.getComponents=function(t,e){if(t=String(t).toLowerCase(),!(t=this.capabilityToComponentIds_[t]))return[];var n=[];if(e){var i=[],r=this.componentData_;t.forEach(function(t){i.push(r[t])}),i.sort(function(t,e){return t.weight-e.weight}),i.forEach(function(t){n.push(t.component)})}else r=this.componentData_,t.forEach(function(t){n.push(r[t].component)});return n},t.ComponentManager.Capability=function(t){this.name_=t},t.ComponentManager.Capability.prototype.toString=function(){return this.name_},t.ComponentManager.Capability.POSITIONABLE=new t.ComponentManager.Capability("positionable"),t.ComponentManager.Capability.DRAG_TARGET=new t.ComponentManager.Capability("drag_target"),t.ComponentManager.Capability.DELETE_AREA=new t.ComponentManager.Capability("delete_area"),t.ComponentManager.Capability.AUTOHIDEABLE=new t.ComponentManager.Capability("autohideable"),t.utils.Svg=function(t){this.tagName_=t},t.utils.Svg.prototype.toString=function(){return this.tagName_},t.utils.Svg.ANIMATE=new t.utils.Svg("animate"),t.utils.Svg.CIRCLE=new t.utils.Svg("circle"),t.utils.Svg.CLIPPATH=new t.utils.Svg("clipPath"),t.utils.Svg.DEFS=new t.utils.Svg("defs"),t.utils.Svg.FECOMPOSITE=new t.utils.Svg("feComposite"),t.utils.Svg.FECOMPONENTTRANSFER=new t.utils.Svg("feComponentTransfer"),t.utils.Svg.FEFLOOD=new t.utils.Svg("feFlood"),t.utils.Svg.FEFUNCA=new t.utils.Svg("feFuncA"),t.utils.Svg.FEGAUSSIANBLUR=new t.utils.Svg("feGaussianBlur"),t.utils.Svg.FEPOINTLIGHT=new t.utils.Svg("fePointLight"),t.utils.Svg.FESPECULARLIGHTING=new t.utils.Svg("feSpecularLighting"),t.utils.Svg.FILTER=new t.utils.Svg("filter"),t.utils.Svg.FOREIGNOBJECT=new t.utils.Svg("foreignObject"),t.utils.Svg.G=new t.utils.Svg("g"),t.utils.Svg.IMAGE=new t.utils.Svg("image"),t.utils.Svg.LINE=new t.utils.Svg("line"),t.utils.Svg.PATH=new t.utils.Svg("path"),t.utils.Svg.PATTERN=new t.utils.Svg("pattern"),t.utils.Svg.POLYGON=new t.utils.Svg("polygon"),t.utils.Svg.RECT=new t.utils.Svg("rect"),t.utils.Svg.SVG=new t.utils.Svg("svg"),t.utils.Svg.TEXT=new t.utils.Svg("text"),t.utils.Svg.TSPAN=new t.utils.Svg("tspan"),t.utils.dom={},t.utils.dom.SVG_NS="http://www.w3.org/2000/svg",t.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml",t.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink",t.utils.dom.NodeType={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16},t.utils.dom.cacheWidths_=null,t.utils.dom.cacheReference_=0,t.utils.dom.canvasContext_=null,t.utils.dom.createSvgElement=function(e,n,i){for(var r in e=document.createElementNS(t.utils.dom.SVG_NS,String(e)),n)e.setAttribute(r,n[r]);return document.body.runtimeStyle&&(e.runtimeStyle=e.currentStyle=e.style),i&&i.appendChild(e),e},t.utils.dom.addClass=function(t,e){var n=t.getAttribute("class")||"";return-1==(" "+n+" ").indexOf(" "+e+" ")&&(n&&(n+=" "),t.setAttribute("class",n+e),!0)},t.utils.dom.removeClasses=function(e,n){n=n.split(" ");for(var i=0;i<n.length;i++)t.utils.dom.removeClass(e,n[i])},t.utils.dom.removeClass=function(t,e){var n=t.getAttribute("class");if(-1==(" "+n+" ").indexOf(" "+e+" "))return!1;n=n.split(/\s+/);for(var i=0;i<n.length;i++)n[i]&&n[i]!=e||(n.splice(i,1),i--);return n.length?t.setAttribute("class",n.join(" ")):t.removeAttribute("class"),!0},t.utils.dom.hasClass=function(t,e){return-1!=(" "+t.getAttribute("class")+" ").indexOf(" "+e+" ")},t.utils.dom.removeNode=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null},t.utils.dom.insertAfter=function(t,e){var n=e.nextSibling;if(!(e=e.parentNode))throw Error("Reference node has no parent.");n?e.insertBefore(t,n):e.appendChild(t)},t.utils.dom.containsNode=function(e,n){return!!(e.compareDocumentPosition(n)&t.utils.dom.NodeType.DOCUMENT_POSITION_CONTAINED_BY)},t.utils.dom.setCssTransform=function(t,e){t.style.transform=e,t.style["-webkit-transform"]=e},t.utils.dom.startTextWidthCache=function(){t.utils.dom.cacheReference_++,t.utils.dom.cacheWidths_||(t.utils.dom.cacheWidths_=Object.create(null))},t.utils.dom.stopTextWidthCache=function(){t.utils.dom.cacheReference_--,t.utils.dom.cacheReference_||(t.utils.dom.cacheWidths_=null)},t.utils.dom.getTextWidth=function(e){var n,i=e.textContent+"\n"+e.className.baseVal;if(t.utils.dom.cacheWidths_&&(n=t.utils.dom.cacheWidths_[i]))return n;try{n=t.utils.userAgent.IE||t.utils.userAgent.EDGE?e.getBBox().width:e.getComputedTextLength()}catch(t){return 8*e.textContent.length}return t.utils.dom.cacheWidths_&&(t.utils.dom.cacheWidths_[i]=n),n},t.utils.dom.getFastTextWidth=function(e,n,i,r){return t.utils.dom.getFastTextWidthWithSizeString(e,n+"pt",i,r)},t.utils.dom.getFastTextWidthWithSizeString=function(e,n,i,r){var o,s=e.textContent;return e=s+"\n"+e.className.baseVal,t.utils.dom.cacheWidths_&&(o=t.utils.dom.cacheWidths_[e])?o:(t.utils.dom.canvasContext_||((o=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(o),t.utils.dom.canvasContext_=o.getContext("2d")),t.utils.dom.canvasContext_.font=i+" "+n+" "+r,o=t.utils.dom.canvasContext_.measureText(s).width,t.utils.dom.cacheWidths_&&(t.utils.dom.cacheWidths_[e]=o),o)},t.utils.dom.measureFontMetrics=function(t,e,n,i){var r=document.createElement("span");r.style.font=n+" "+e+" "+i,r.textContent=t,(t=document.createElement("div")).style.width="1px",t.style.height="0px",(e=document.createElement("div")).setAttribute("style","position: fixed; top: 0; left: 0; display: flex;"),e.appendChild(r),e.appendChild(t),document.body.appendChild(e);try{n={},e.style.alignItems="baseline",n.baseline=t.offsetTop-r.offsetTop,e.style.alignItems="flex-end",n.height=t.offsetTop-r.offsetTop}finally{document.body.removeChild(e)}return n},t.utils.math={},t.utils.math.toRadians=function(t){return t*Math.PI/180},t.utils.math.toDegrees=function(t){return 180*t/Math.PI},t.utils.math.clamp=function(t,e,n){if(n<t){var i=n;n=t,t=i}return Math.max(t,Math.min(e,n))},t.DropDownDiv=function(){},t.DropDownDiv.boundsElement_=null,t.DropDownDiv.owner_=null,t.DropDownDiv.positionToField_=null,t.DropDownDiv.ARROW_SIZE=16,t.DropDownDiv.BORDER_SIZE=1,t.DropDownDiv.ARROW_HORIZONTAL_PADDING=12,t.DropDownDiv.PADDING_Y=16,t.DropDownDiv.ANIMATION_TIME=.25,t.DropDownDiv.animateOutTimer_=null,t.DropDownDiv.onHide_=null,t.DropDownDiv.rendererClassName_="",t.DropDownDiv.themeClassName_="",t.DropDownDiv.createDom=function(){if(!t.DropDownDiv.DIV_){var e=document.createElement("div");e.className="blocklyDropDownDiv",(t.parentContainer||document.body).appendChild(e),t.DropDownDiv.DIV_=e;var n=document.createElement("div");n.className="blocklyDropDownContent",e.appendChild(n),t.DropDownDiv.content_=n,(n=document.createElement("div")).className="blocklyDropDownArrow",e.appendChild(n),t.DropDownDiv.arrow_=n,t.DropDownDiv.DIV_.style.opacity=0,t.DropDownDiv.DIV_.style.transition="transform "+t.DropDownDiv.ANIMATION_TIME+"s, opacity "+t.DropDownDiv.ANIMATION_TIME+"s",e.addEventListener("focusin",function(){t.utils.dom.addClass(e,"blocklyFocused")}),e.addEventListener("focusout",function(){t.utils.dom.removeClass(e,"blocklyFocused")})}},t.DropDownDiv.setBoundsElement=function(e){t.DropDownDiv.boundsElement_=e},t.DropDownDiv.getContentDiv=function(){return t.DropDownDiv.content_},t.DropDownDiv.clearContent=function(){t.DropDownDiv.content_.textContent="",t.DropDownDiv.content_.style.width=""},t.DropDownDiv.setColour=function(e,n){t.DropDownDiv.DIV_.style.backgroundColor=e,t.DropDownDiv.DIV_.style.borderColor=n},t.DropDownDiv.showPositionedByBlock=function(e,n,i,r){return t.DropDownDiv.showPositionedByRect_(t.DropDownDiv.getScaledBboxOfBlock_(n),e,i,r)},t.DropDownDiv.showPositionedByField=function(e,n,i){return t.DropDownDiv.positionToField_=!0,t.DropDownDiv.showPositionedByRect_(t.DropDownDiv.getScaledBboxOfField_(e),e,n,i)},t.DropDownDiv.getScaledBboxOfBlock_=function(e){var n=e.getSvgRoot(),i=n.getBBox(),r=e.workspace.scale;return e=i.height*r,i=i.width*r,n=t.utils.style.getPageOffset(n),new t.utils.Rect(n.y,n.y+e,n.x,n.x+i)},t.DropDownDiv.getScaledBboxOfField_=function(e){return e=e.getScaledBBox(),new t.utils.Rect(e.top,e.bottom,e.left,e.right)},t.DropDownDiv.showPositionedByRect_=function(e,n,i,r){var o=e.left+(e.right-e.left)/2,s=e.bottom;e=e.top,r&&(e+=r);for(var a=(r=n.getSourceBlock()).workspace;a.options.parentWorkspace;)a=a.options.parentWorkspace;return t.DropDownDiv.setBoundsElement(a.getParentSvg().parentNode),t.DropDownDiv.show(n,r.RTL,o,s,o,e,i)},t.DropDownDiv.show=function(e,n,i,r,o,s,a){return t.DropDownDiv.owner_=e,t.DropDownDiv.onHide_=a||null,(e=t.DropDownDiv.DIV_).style.direction=n?"rtl":"ltr",n=t.getMainWorkspace(),t.DropDownDiv.rendererClassName_=n.getRenderer().getClassName(),t.DropDownDiv.themeClassName_=n.getTheme().getClassName(),t.utils.dom.addClass(e,t.DropDownDiv.rendererClassName_),t.utils.dom.addClass(e,t.DropDownDiv.themeClassName_),t.DropDownDiv.positionInternal_(i,r,o,s)},t.DropDownDiv.getBoundsInfo_=function(){var e=t.utils.style.getPageOffset(t.DropDownDiv.boundsElement_),n=t.utils.style.getSize(t.DropDownDiv.boundsElement_);return{left:e.x,right:e.x+n.width,top:e.y,bottom:e.y+n.height,width:n.width,height:n.height}},t.DropDownDiv.getPositionMetrics_=function(e,n,i,r){var o=t.DropDownDiv.getBoundsInfo_(),s=t.utils.style.getSize(t.DropDownDiv.DIV_);return n+s.height<o.bottom?t.DropDownDiv.getPositionBelowMetrics_(e,n,o,s):r-s.height>o.top?t.DropDownDiv.getPositionAboveMetrics_(i,r,o,s):n+s.height<document.documentElement.clientHeight?t.DropDownDiv.getPositionBelowMetrics_(e,n,o,s):r-s.height>document.documentElement.clientTop?t.DropDownDiv.getPositionAboveMetrics_(i,r,o,s):t.DropDownDiv.getPositionTopOfPageMetrics_(e,o,s)},t.DropDownDiv.getPositionBelowMetrics_=function(e,n,i,r){return{initialX:(e=t.DropDownDiv.getPositionX(e,i.left,i.right,r.width)).divX,initialY:n,finalX:e.divX,finalY:n+t.DropDownDiv.PADDING_Y,arrowX:e.arrowX,arrowY:-(t.DropDownDiv.ARROW_SIZE/2+t.DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}},t.DropDownDiv.getPositionAboveMetrics_=function(e,n,i,r){return{initialX:(e=t.DropDownDiv.getPositionX(e,i.left,i.right,r.width)).divX,initialY:n-r.height,finalX:e.divX,finalY:n-r.height-t.DropDownDiv.PADDING_Y,arrowX:e.arrowX,arrowY:r.height-2*t.DropDownDiv.BORDER_SIZE-t.DropDownDiv.ARROW_SIZE/2,arrowAtTop:!1,arrowVisible:!0}},t.DropDownDiv.getPositionTopOfPageMetrics_=function(e,n,i){return{initialX:(e=t.DropDownDiv.getPositionX(e,n.left,n.right,i.width)).divX,initialY:0,finalX:e.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},t.DropDownDiv.getPositionX=function(e,n,i,r){var o=e;return e=t.utils.math.clamp(n,e-r/2,i-r),o-=t.DropDownDiv.ARROW_SIZE/2,n=t.DropDownDiv.ARROW_HORIZONTAL_PADDING,{arrowX:r=t.utils.math.clamp(n,o-e,r-n-t.DropDownDiv.ARROW_SIZE),divX:e}},t.DropDownDiv.isVisible=function(){return!!t.DropDownDiv.owner_},t.DropDownDiv.hideIfOwner=function(e,n){return t.DropDownDiv.owner_===e&&(n?t.DropDownDiv.hideWithoutAnimation():t.DropDownDiv.hide(),!0)},t.DropDownDiv.hide=function(){var e=t.DropDownDiv.DIV_;e.style.transform="translate(0, 0)",e.style.opacity=0,t.DropDownDiv.animateOutTimer_=setTimeout(function(){t.DropDownDiv.hideWithoutAnimation()},1e3*t.DropDownDiv.ANIMATION_TIME),t.DropDownDiv.onHide_&&(t.DropDownDiv.onHide_(),t.DropDownDiv.onHide_=null)},t.DropDownDiv.hideWithoutAnimation=function(){if(t.DropDownDiv.isVisible()){t.DropDownDiv.animateOutTimer_&&clearTimeout(t.DropDownDiv.animateOutTimer_);var e=t.DropDownDiv.DIV_;e.style.transform="",e.style.left="",e.style.top="",e.style.opacity=0,e.style.display="none",e.style.backgroundColor="",e.style.borderColor="",t.DropDownDiv.onHide_&&(t.DropDownDiv.onHide_(),t.DropDownDiv.onHide_=null),t.DropDownDiv.clearContent(),t.DropDownDiv.owner_=null,t.DropDownDiv.rendererClassName_&&(t.utils.dom.removeClass(e,t.DropDownDiv.rendererClassName_),t.DropDownDiv.rendererClassName_=""),t.DropDownDiv.themeClassName_&&(t.utils.dom.removeClass(e,t.DropDownDiv.themeClassName_),t.DropDownDiv.themeClassName_=""),t.getMainWorkspace().markFocused()}},t.DropDownDiv.positionInternal_=function(e,n,i,r){(e=t.DropDownDiv.getPositionMetrics_(e,n,i,r)).arrowVisible?(t.DropDownDiv.arrow_.style.display="",t.DropDownDiv.arrow_.style.transform="translate("+e.arrowX+"px,"+e.arrowY+"px) rotate(45deg)",t.DropDownDiv.arrow_.setAttribute("class",e.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):t.DropDownDiv.arrow_.style.display="none",n=Math.floor(e.initialX),i=Math.floor(e.initialY),r=Math.floor(e.finalX);var o=Math.floor(e.finalY),s=t.DropDownDiv.DIV_;return s.style.left=n+"px",s.style.top=i+"px",s.style.display="block",s.style.opacity=1,s.style.transform="translate("+(r-n)+"px,"+(o-i)+"px)",!!e.arrowAtTop},t.DropDownDiv.repositionForWindowResize=function(){if(t.DropDownDiv.owner_){var e=t.DropDownDiv.owner_,n=e.getSourceBlock();n=(e=t.DropDownDiv.positionToField_?t.DropDownDiv.getScaledBboxOfField_(e):t.DropDownDiv.getScaledBboxOfBlock_(n)).left+(e.right-e.left)/2,t.DropDownDiv.positionInternal_(n,e.bottom,n,e.top)}else t.DropDownDiv.hide()},t.registry={},t.registry.typeMap_=Object.create(null),t.registry.DEFAULT="default",t.registry.Type=function(t){this.name_=t},t.registry.Type.prototype.toString=function(){return this.name_},t.registry.Type.CONNECTION_CHECKER=new t.registry.Type("connectionChecker"),t.registry.Type.CURSOR=new t.registry.Type("cursor"),t.registry.Type.EVENT=new t.registry.Type("event"),t.registry.Type.FIELD=new t.registry.Type("field"),t.registry.Type.RENDERER=new t.registry.Type("renderer"),t.registry.Type.TOOLBOX=new t.registry.Type("toolbox"),t.registry.Type.THEME=new t.registry.Type("theme"),t.registry.Type.TOOLBOX_ITEM=new t.registry.Type("toolboxItem"),t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX=new t.registry.Type("flyoutsVerticalToolbox"),t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX=new t.registry.Type("flyoutsHorizontalToolbox"),t.registry.Type.METRICS_MANAGER=new t.registry.Type("metricsManager"),t.registry.Type.BLOCK_DRAGGER=new t.registry.Type("blockDragger"),t.registry.register=function(e,n,i,r){if(!(e instanceof t.registry.Type)&&"string"!=typeof e||""==String(e).trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=String(e).toLowerCase(),"string"!=typeof n||""==n.trim())throw Error('Invalid name "'+n+'". The name must be a non-empty string.');if(n=n.toLowerCase(),!i)throw Error("Can not register a null value");var o=t.registry.typeMap_[e];if(o||(o=t.registry.typeMap_[e]=Object.create(null)),t.registry.validate_(e,i),!r&&o[n])throw Error('Name "'+n+'" with type "'+e+'" already registered.');o[n]=i},t.registry.validate_=function(e,n){switch(e){case String(t.registry.Type.FIELD):if("function"!=typeof n.fromJson)throw Error('Type "'+e+'" must have a fromJson function')}},t.registry.unregister=function(e,n){e=String(e).toLowerCase(),n=n.toLowerCase();var i=t.registry.typeMap_[e];i&&i[n]?delete t.registry.typeMap_[e][n]:console.warn("Unable to unregister ["+n+"]["+e+"] from the registry.")},t.registry.getItem_=function(e,n,i){e=String(e).toLowerCase(),n=n.toLowerCase();var r=t.registry.typeMap_[e];if(!r||!r[n]){if(n="Unable to find ["+n+"]["+e+"] in the registry.",i)throw Error(n+" You must require or register a "+e+" plugin.");return console.warn(n),null}return r[n]},t.registry.hasItem=function(e,n){return e=String(e).toLowerCase(),n=n.toLowerCase(),!!(e=t.registry.typeMap_[e])&&!!e[n]},t.registry.getClass=function(e,n,i){return t.registry.getItem_(e,n,i)},t.registry.getObject=function(e,n,i){return t.registry.getItem_(e,n,i)},t.registry.getClassFromOptions=function(e,n,i){return"function"==typeof(n=n.plugins[e.toString()]||t.registry.DEFAULT)?n:t.registry.getClass(e,n,i)},t.Events={},t.Events.group_="",t.Events.recordUndo=!0,t.Events.disabled_=0,t.Events.CREATE="create",t.Events.BLOCK_CREATE=t.Events.CREATE,t.Events.DELETE="delete",t.Events.BLOCK_DELETE=t.Events.DELETE,t.Events.CHANGE="change",t.Events.BLOCK_CHANGE=t.Events.CHANGE,t.Events.MOVE="move",t.Events.BLOCK_MOVE=t.Events.MOVE,t.Events.VAR_CREATE="var_create",t.Events.VAR_DELETE="var_delete",t.Events.VAR_RENAME="var_rename",t.Events.UI="ui",t.Events.BLOCK_DRAG="drag",t.Events.SELECTED="selected",t.Events.CLICK="click",t.Events.MARKER_MOVE="marker_move",t.Events.BUBBLE_OPEN="bubble_open",t.Events.TRASHCAN_OPEN="trashcan_open",t.Events.TOOLBOX_ITEM_SELECT="toolbox_item_select",t.Events.THEME_CHANGE="theme_change",t.Events.VIEWPORT_CHANGE="viewport_change",t.Events.COMMENT_CREATE="comment_create",t.Events.COMMENT_DELETE="comment_delete",t.Events.COMMENT_CHANGE="comment_change",t.Events.COMMENT_MOVE="comment_move",t.Events.FINISHED_LOADING="finished_loading",t.Events.BUMP_EVENTS=[t.Events.BLOCK_CREATE,t.Events.BLOCK_MOVE,t.Events.COMMENT_CREATE,t.Events.COMMENT_MOVE],t.Events.FIRE_QUEUE_=[],t.Events.fire=function(e){t.Events.isEnabled()&&(t.Events.FIRE_QUEUE_.length||setTimeout(t.Events.fireNow_,0),t.Events.FIRE_QUEUE_.push(e))},t.Events.fireNow_=function(){for(var e,n=t.Events.filter(t.Events.FIRE_QUEUE_,!0),i=t.Events.FIRE_QUEUE_.length=0;e=n[i];i++)if(e.workspaceId){var r=t.Workspace.getById(e.workspaceId);r&&r.fireChangeListener(e)}},t.Events.filter=function(e,n){e=e.slice(),n||e.reverse();for(var i,r=[],o=Object.create(null),s=0;i=e[s];s++)if(!i.isNull()){var a=[i.isUiEvent?t.Events.UI:i.type,i.blockId,i.workspaceId].join(" "),l=o[a],u=l?l.event:null;l?i.type==t.Events.MOVE&&l.index==s-1?(u.newParentId=i.newParentId,u.newInputName=i.newInputName,u.newCoordinate=i.newCoordinate,l.index=s):i.type==t.Events.CHANGE&&i.element==u.element&&i.name==u.name?u.newValue=i.newValue:i.type==t.Events.VIEWPORT_CHANGE?(u.viewTop=i.viewTop,u.viewLeft=i.viewLeft,u.scale=i.scale,u.oldScale=i.oldScale):i.type==t.Events.CLICK&&u.type==t.Events.BUBBLE_OPEN||(o[a]={event:i,index:s},r.push(i)):(o[a]={event:i,index:s},r.push(i))}for(e=r.filter(function(t){return!t.isNull()}),n||e.reverse(),s=1;i=e[s];s++)i.type==t.Events.CHANGE&&"mutation"==i.element&&e.unshift(e.splice(s,1)[0]);return e},t.Events.clearPendingUndo=function(){for(var e,n=0;e=t.Events.FIRE_QUEUE_[n];n++)e.recordUndo=!1},t.Events.disable=function(){t.Events.disabled_++},t.Events.enable=function(){t.Events.disabled_--},t.Events.isEnabled=function(){return 0==t.Events.disabled_},t.Events.getGroup=function(){return t.Events.group_},t.Events.setGroup=function(e){t.Events.group_="boolean"==typeof e?e?t.utils.genUid():"":e},t.Events.getDescendantIds=function(t){var e=[];t=t.getDescendants(!1);for(var n,i=0;n=t[i];i++)e[i]=n.id;return e},t.Events.fromJson=function(e,n){var i=t.Events.get(e.type);if(!i)throw Error("Unknown event type.");return(i=new i).fromJson(e),i.workspaceId=n.id,i},t.Events.get=function(e){return t.registry.getClass(t.registry.Type.EVENT,e)},t.Events.disableOrphans=function(e){if((e.type==t.Events.MOVE||e.type==t.Events.CREATE)&&e.workspaceId){var n=t.Workspace.getById(e.workspaceId),i=n.getBlockById(e.blockId);if(i){e=t.Events.recordUndo;try{t.Events.recordUndo=!1;var r=i.getParent();if(r&&r.isEnabled()){var o,s=i.getDescendants(!1);for(n=0;o=s[n];n++)o.setEnabled(!0)}else if((i.outputConnection||i.previousConnection)&&!n.isDragging())do{i.setEnabled(!1),i=i.getNextBlock()}while(i)}finally{t.Events.recordUndo=e}}}},t.Events.Abstract=function(){this.isBlank=null,this.workspaceId=void 0,this.group=t.Events.getGroup(),this.recordUndo=t.Events.recordUndo},t.Events.Abstract.prototype.isUiEvent=!1,t.Events.Abstract.prototype.toJson=function(){var t={type:this.type};return this.group&&(t.group=this.group),t},t.Events.Abstract.prototype.fromJson=function(t){this.isBlank=!1,this.group=t.group},t.Events.Abstract.prototype.isNull=function(){return!1},t.Events.Abstract.prototype.run=function(t){},t.Events.Abstract.prototype.getEventWorkspace_=function(){if(this.workspaceId)var e=t.Workspace.getById(this.workspaceId);if(!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e},t.utils.object={},t.utils.object.inherits=function(t,e){t.superClass_=e.prototype,t.prototype=Object.create(e.prototype),t.prototype.constructor=t},t.utils.object.mixin=function(t,e){for(var n in e)t[n]=e[n]},t.utils.object.deepMerge=function(e,n){for(var i in n)e[i]=null!=n[i]&&"object"==typeof n[i]?t.utils.object.deepMerge(e[i]||Object.create(null),n[i]):n[i];return e},t.utils.object.values=function(t){return Object.values?Object.values(t):Object.keys(t).map(function(e){return t[e]})},t.utils.xml={},t.utils.xml.NAME_SPACE="https://developers.google.com/blockly/xml",t.utils.xml.document=function(){return document},t.utils.xml.createElement=function(e){return t.utils.xml.document().createElementNS(t.utils.xml.NAME_SPACE,e)},t.utils.xml.createTextNode=function(e){return t.utils.xml.document().createTextNode(e)},t.utils.xml.textToDomDocument=function(t){return(new DOMParser).parseFromString(t,"text/xml")},t.utils.xml.domToText=function(t){return(new XMLSerializer).serializeToString(t)},t.inputTypes={VALUE:t.connectionTypes.INPUT_VALUE,STATEMENT:t.connectionTypes.NEXT_STATEMENT,DUMMY:5},t.Xml={},t.Xml.workspaceToDom=function(e,n){var i=t.utils.xml.createElement("xml"),r=t.Xml.variablesToDom(t.Variables.allUsedVarModels(e));r.hasChildNodes()&&i.appendChild(r);var o,s=e.getTopComments(!0);for(r=0;o=s[r];r++)i.appendChild(o.toXmlWithXY(n));for(e=e.getTopBlocks(!0),r=0;s=e[r];r++)i.appendChild(t.Xml.blockToDomWithXY(s,n));return i},t.Xml.variablesToDom=function(e){for(var n,i=t.utils.xml.createElement("variables"),r=0;n=e[r];r++){var o=t.utils.xml.createElement("variable");o.appendChild(t.utils.xml.createTextNode(n.name)),n.type&&o.setAttribute("type",n.type),o.id=n.getId(),i.appendChild(o)}return i},t.Xml.blockToDomWithXY=function(e,n){if(e.isInsertionMarker()&&!(e=e.getChildren(!1)[0]))return new DocumentFragment;var i;e.workspace.RTL&&(i=e.workspace.getWidth()),n=t.Xml.blockToDom(e,n);var r=e.getRelativeToSurfaceXY();return n.setAttribute("x",Math.round(e.workspace.RTL?i-r.x:r.x)),n.setAttribute("y",Math.round(r.y)),n},t.Xml.fieldToDom_=function(e){if(e.isSerializable()){var n=t.utils.xml.createElement("field");return n.setAttribute("name",e.name||""),e.toXml(n)}return null},t.Xml.allFieldsToDom_=function(e,n){for(var i,r=0;i=e.inputList[r];r++)for(var o,s=0;o=i.fieldRow[s];s++)(o=t.Xml.fieldToDom_(o))&&n.appendChild(o)},t.Xml.blockToDom=function(e,n){if(e.isInsertionMarker())return(e=e.getChildren(!1)[0])?t.Xml.blockToDom(e):new DocumentFragment;var i=t.utils.xml.createElement(e.isShadow()?"shadow":"block");if(i.setAttribute("type",e.type),n||i.setAttribute("id",e.id),e.mutationToDom){var r=e.mutationToDom();r&&(r.hasChildNodes()||r.hasAttributes())&&i.appendChild(r)}if(t.Xml.allFieldsToDom_(e,i),r=e.getCommentText()){var o=e.commentModel.size,s=e.commentModel.pinned,a=t.utils.xml.createElement("comment");a.appendChild(t.utils.xml.createTextNode(r)),a.setAttribute("pinned",s),a.setAttribute("h",o.height),a.setAttribute("w",o.width),i.appendChild(a)}for(e.data&&((r=t.utils.xml.createElement("data")).appendChild(t.utils.xml.createTextNode(e.data)),i.appendChild(r)),r=0;o=e.inputList[r];r++){var l;if(s=!0,o.type!=t.inputTypes.DUMMY){var u=o.connection.targetBlock();o.type==t.inputTypes.VALUE?l=t.utils.xml.createElement("value"):o.type==t.inputTypes.STATEMENT&&(l=t.utils.xml.createElement("statement")),!(a=o.connection.getShadowDom())||u&&u.isShadow()||l.appendChild(t.Xml.cloneShadow_(a,n)),u&&((a=t.Xml.blockToDom(u,n)).nodeType==t.utils.dom.NodeType.ELEMENT_NODE&&(l.appendChild(a),s=!1)),l.setAttribute("name",o.name),s||i.appendChild(l)}}return void 0!=e.inputsInline&&e.inputsInline!=e.inputsInlineDefault&&i.setAttribute("inline",e.inputsInline),e.isCollapsed()&&i.setAttribute("collapsed",!0),e.isEnabled()||i.setAttribute("disabled",!0),e.isDeletable()||e.isShadow()||i.setAttribute("deletable",!1),e.isMovable()||e.isShadow()||i.setAttribute("movable",!1),e.isEditable()||i.setAttribute("editable",!1),(r=e.getNextBlock())&&((a=t.Xml.blockToDom(r,n)).nodeType==t.utils.dom.NodeType.ELEMENT_NODE&&((l=t.utils.xml.createElement("next")).appendChild(a),i.appendChild(l))),!(a=e.nextConnection&&e.nextConnection.getShadowDom())||r&&r.isShadow()||l.appendChild(t.Xml.cloneShadow_(a,n)),i},t.Xml.cloneShadow_=function(e,n){for(var i,r=e=e.cloneNode(!0);r;)if(n&&"shadow"==r.nodeName&&r.removeAttribute("id"),r.firstChild)r=r.firstChild;else{for(;r&&!r.nextSibling;)i=r,r=r.parentNode,i.nodeType==t.utils.dom.NodeType.TEXT_NODE&&""==i.data.trim()&&r.firstChild!=i&&t.utils.dom.removeNode(i);r&&(i=r,r=r.nextSibling,i.nodeType==t.utils.dom.NodeType.TEXT_NODE&&""==i.data.trim()&&t.utils.dom.removeNode(i))}return e},t.Xml.domToText=function(e){return t.utils.xml.domToText(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},t.Xml.domToPrettyText=function(e){e=t.Xml.domToText(e).split("<");for(var n="",i=1;i<e.length;i++){var r=e[i];"/"==r[0]&&(n=n.substring(2)),e[i]=n+"<"+r,"/"!=r[0]&&"/>"!=r.slice(-2)&&(n+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>")).replace(/^\n/,"")},t.Xml.textToDom=function(e){var n=t.utils.xml.textToDomDocument(e);if(!n||!n.documentElement||n.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+e);return n.documentElement},t.Xml.clearWorkspaceAndLoadFromXml=function(e,n){return n.setResizesEnabled(!1),n.clear(),e=t.Xml.domToWorkspace(e,n),n.setResizesEnabled(!0),e},t.Xml.domToWorkspace=function(e,n){if(e instanceof t.Workspace){var i=e;e=n,n=i,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var r;n.RTL&&(r=n.getWidth()),i=[],t.utils.dom.startTextWidthCache();var o=t.Events.getGroup();o||t.Events.setGroup(!0),n.setResizesEnabled&&n.setResizesEnabled(!1);var s=!0;try{for(var a,l=0;a=e.childNodes[l];l++){var u=a.nodeName.toLowerCase(),c=a;if("block"==u||"shadow"==u&&!t.Events.recordUndo){var h=t.Xml.domToBlock(c,n);i.push(h.id);var p=c.hasAttribute("x")?parseInt(c.getAttribute("x"),10):10,d=c.hasAttribute("y")?parseInt(c.getAttribute("y"),10):10;isNaN(p)||isNaN(d)||h.moveBy(n.RTL?r-p:p,d),s=!1}else{if("shadow"==u)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==u)n.rendered?t.WorkspaceCommentSvg?t.WorkspaceCommentSvg.fromXml(c,n,r):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):t.WorkspaceComment?t.WorkspaceComment.fromXml(c,n):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==u){if(!s)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");t.Xml.domToVariables(c,n),s=!1}}}}finally{o||t.Events.setGroup(!1),t.utils.dom.stopTextWidthCache()}return n.setResizesEnabled&&n.setResizesEnabled(!0),t.Events.fire(new(t.Events.get(t.Events.FINISHED_LOADING))(n)),i},t.Xml.appendDomToWorkspace=function(e,n){var i;if(Object.prototype.hasOwnProperty.call(n,"scale")&&(i=n.getBlocksBoundingBox()),e=t.Xml.domToWorkspace(e,n),i&&i.top!=i.bottom){var r=i.bottom,o=n.RTL?i.right:i.left,s=1/0,a=-1/0,l=1/0;for(i=0;i<e.length;i++){var u=n.getBlockById(e[i]).getRelativeToSurfaceXY();u.y<l&&(l=u.y),u.x<s&&(s=u.x),u.x>a&&(a=u.x)}for(r=r-l+10,o=n.RTL?o-a:o-s,i=0;i<e.length;i++)n.getBlockById(e[i]).moveBy(o,r)}return e},t.Xml.domToBlock=function(e,n){if(e instanceof t.Workspace){var i=e;e=n,n=i,console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}t.Events.disable(),i=n.getAllVariables();try{var r=t.Xml.domToBlockHeadless_(e,n),o=r.getDescendants(!1);if(n.rendered){r.setConnectionTracking(!1);for(var s=o.length-1;0<=s;s--)o[s].initSvg();for(s=o.length-1;0<=s;s--)o[s].render(!1);setTimeout(function(){r.disposed||r.setConnectionTracking(!0)},1),r.updateDisabled(),n.resizeContents()}else for(s=o.length-1;0<=s;s--)o[s].initModel()}finally{t.Events.enable()}if(t.Events.isEnabled()){for(e=t.Variables.getAddedVariables(n,i),s=0;s<e.length;s++)n=e[s],t.Events.fire(new(t.Events.get(t.Events.VAR_CREATE))(n));t.Events.fire(new(t.Events.get(t.Events.CREATE))(r))}return r},t.Xml.domToVariables=function(e,n){for(var i,r=0;i=e.childNodes[r];r++)if(i.nodeType==t.utils.dom.NodeType.ELEMENT_NODE){var o=i.getAttribute("type"),s=i.getAttribute("id");n.createVariable(i.textContent,o,s)}},t.Xml.mapSupportedXmlTags_=function(e){for(var n,i={mutation:[],comment:[],data:[],field:[],input:[],next:[]},r=0;n=e.childNodes[r];r++)if(n.nodeType!=t.utils.dom.NodeType.TEXT_NODE)switch(n.nodeName.toLowerCase()){case"mutation":i.mutation.push(n);break;case"comment":if(!t.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}i.comment.push(n);break;case"data":i.data.push(n);break;case"title":case"field":i.field.push(n);break;case"value":case"statement":i.input.push(n);break;case"next":i.next.push(n);break;default:console.warn("Ignoring unknown tag: "+n.nodeName)}return i},t.Xml.applyMutationTagNodes_=function(t,e){for(var n,i=!1,r=0;n=t[r];r++)e.domToMutation&&(e.domToMutation(n),e.initSvg&&(i=!0));return i},t.Xml.applyCommentTagNodes_=function(e,n){for(var i,r=0;i=e[r];r++){var o=i.textContent,s="true"==i.getAttribute("pinned"),a=parseInt(i.getAttribute("w"),10);i=parseInt(i.getAttribute("h"),10),n.setCommentText(o),n.commentModel.pinned=s,isNaN(a)||isNaN(i)||(n.commentModel.size=new t.utils.Size(a,i)),s&&n.getCommentIcon&&!n.isInFlyout&&setTimeout(function(){n.getCommentIcon().setVisible(!0)},1)}},t.Xml.applyDataTagNodes_=function(t,e){for(var n,i=0;n=t[i];i++)e.data=n.textContent},t.Xml.applyFieldTagNodes_=function(e,n){for(var i,r=0;i=e[r];r++){var o=i.getAttribute("name");t.Xml.domToField_(n,o,i)}},t.Xml.findChildBlocks_=function(e){for(var n,i={childBlockElement:null,childShadowElement:null},r=0;n=e.childNodes[r];r++)n.nodeType==t.utils.dom.NodeType.ELEMENT_NODE&&("block"==n.nodeName.toLowerCase()?i.childBlockElement=n:"shadow"==n.nodeName.toLowerCase()&&(i.childShadowElement=n));return i},t.Xml.applyInputTagNodes_=function(e,n,i,r){for(var o,s=0;o=e[s];s++){var a=o.getAttribute("name"),l=i.getInput(a);if(!l){console.warn("Ignoring non-existent input "+a+" in block "+r);break}if((o=t.Xml.findChildBlocks_(o)).childBlockElement){if(!l.connection)throw TypeError("Input connection does not exist.");t.Xml.domToBlockHeadless_(o.childBlockElement,n,l.connection,!1)}o.childShadowElement&&l.connection.setShadowDom(o.childShadowElement)}},t.Xml.applyNextTagNodes_=function(e,n,i){for(var r,o=0;r=e[o];o++){if((r=t.Xml.findChildBlocks_(r)).childBlockElement){if(!i.nextConnection)throw TypeError("Next statement does not exist.");if(i.nextConnection.isConnected())throw TypeError("Next statement is already connected.");t.Xml.domToBlockHeadless_(r.childBlockElement,n,i.nextConnection,!0)}r.childShadowElement&&i.nextConnection&&i.nextConnection.setShadowDom(r.childShadowElement)}},t.Xml.domToBlockHeadless_=function(e,n,i,r){var o=e.getAttribute("type");if(!o)throw TypeError("Block type unspecified: "+e.outerHTML);var s=e.getAttribute("id");s=n.newBlock(o,s);var a=t.Xml.mapSupportedXmlTags_(e),l=t.Xml.applyMutationTagNodes_(a.mutation,s);if(t.Xml.applyCommentTagNodes_(a.comment,s),t.Xml.applyDataTagNodes_(a.data,s),i)if(r){if(!s.previousConnection)throw TypeError("Next block does not have previous statement.");i.connect(s.previousConnection)}else if(s.outputConnection)i.connect(s.outputConnection);else{if(!s.previousConnection)throw TypeError("Child block does not have output or previous statement.");i.connect(s.previousConnection)}if(t.Xml.applyFieldTagNodes_(a.field,s),t.Xml.applyInputTagNodes_(a.input,n,s,o),t.Xml.applyNextTagNodes_(a.next,n,s),l&&s.initSvg(),(n=e.getAttribute("inline"))&&s.setInputsInline("true"==n),(n=e.getAttribute("disabled"))&&s.setEnabled("true"!=n&&"disabled"!=n),(n=e.getAttribute("deletable"))&&s.setDeletable("true"==n),(n=e.getAttribute("movable"))&&s.setMovable("true"==n),(n=e.getAttribute("editable"))&&s.setEditable("true"==n),(n=e.getAttribute("collapsed"))&&s.setCollapsed("true"==n),"shadow"==e.nodeName.toLowerCase()){for(e=s.getChildren(!1),n=0;i=e[n];n++)if(!i.isShadow())throw TypeError("Shadow block not allowed non-shadow child.");if(s.getVarModels().length)throw TypeError("Shadow blocks cannot have variable references.");s.setShadow(!0)}return s},t.Xml.domToField_=function(t,e,n){var i=t.getField(e);i?i.fromXml(n):console.warn("Ignoring non-existent field "+e+" in block "+t.type)},t.Xml.deleteNext=function(t){for(var e,n=0;e=t.childNodes[n];n++)if("next"==e.nodeName.toLowerCase()){t.removeChild(e);break}},t.Events.BlockBase=function(e){t.Events.BlockBase.superClass_.constructor.call(this),this.blockId=(this.isBlank=void 0===e)?"":e.id,this.workspaceId=this.isBlank?"":e.workspace.id},t.utils.object.inherits(t.Events.BlockBase,t.Events.Abstract),t.Events.BlockBase.prototype.toJson=function(){var e=t.Events.BlockBase.superClass_.toJson.call(this);return e.blockId=this.blockId,e},t.Events.BlockBase.prototype.fromJson=function(e){t.Events.BlockBase.superClass_.fromJson.call(this,e),this.blockId=e.blockId},t.Events.BlockChange=function(e,n,i,r,o){t.Events.Change.superClass_.constructor.call(this,e),e&&(this.element=void 0===n?"":n,this.name=void 0===i?"":i,this.oldValue=void 0===r?"":r,this.newValue=void 0===o?"":o)},t.utils.object.inherits(t.Events.BlockChange,t.Events.BlockBase),t.Events.Change=t.Events.BlockChange,t.Events.BlockChange.prototype.type=t.Events.CHANGE,t.Events.BlockChange.prototype.toJson=function(){var e=t.Events.BlockChange.superClass_.toJson.call(this);return e.element=this.element,this.name&&(e.name=this.name),e.oldValue=this.oldValue,e.newValue=this.newValue,e},t.Events.BlockChange.prototype.fromJson=function(e){t.Events.BlockChange.superClass_.fromJson.call(this,e),this.element=e.element,this.name=e.name,this.oldValue=e.oldValue,this.newValue=e.newValue},t.Events.BlockChange.prototype.isNull=function(){return this.oldValue==this.newValue},t.Events.BlockChange.prototype.run=function(e){var n=this.getEventWorkspace_().getBlockById(this.blockId);if(n)switch(n.mutator&&n.mutator.setVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(n=n.getField(this.name))?n.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":n.setCommentText(e||null);break;case"collapsed":n.setCollapsed(!!e);break;case"disabled":n.setEnabled(!e);break;case"inline":n.setInputsInline(!!e);break;case"mutation":var i="";if(n.mutationToDom&&(i=(i=n.mutationToDom())&&t.Xml.domToText(i)),n.domToMutation){var r=t.Xml.textToDom(e||"<mutation/>");n.domToMutation(r)}t.Events.fire(new t.Events.BlockChange(n,"mutation",null,i,e));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)},t.Events.Create=function(e){t.Events.Create.superClass_.constructor.call(this,e),e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=e.workspace.rendered?t.Xml.blockToDomWithXY(e):t.Xml.blockToDom(e),this.ids=t.Events.getDescendantIds(e))},t.utils.object.inherits(t.Events.Create,t.Events.BlockBase),t.Events.BlockCreate=t.Events.Create,t.Events.Create.prototype.type=t.Events.CREATE,t.Events.Create.prototype.toJson=function(){var e=t.Events.Create.superClass_.toJson.call(this);return e.xml=t.Xml.domToText(this.xml),e.ids=this.ids,this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Create.prototype.fromJson=function(e){t.Events.Create.superClass_.fromJson.call(this,e),this.xml=t.Xml.textToDom(e.xml),this.ids=e.ids,void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Create.prototype.run=function(e){var n=this.getEventWorkspace_();if(e)(e=t.utils.xml.createElement("xml")).appendChild(this.xml),t.Xml.domToWorkspace(e,n);else{e=0;for(var i;i=this.ids[e];e++){var r=n.getBlockById(i);r?r.dispose(!1):i==this.blockId&&console.warn("Can't uncreate non-existent block: "+i)}}},t.Events.Delete=function(e){if(t.Events.Delete.superClass_.constructor.call(this,e),e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=e.workspace.rendered?t.Xml.blockToDomWithXY(e):t.Xml.blockToDom(e),this.ids=t.Events.getDescendantIds(e)}},t.utils.object.inherits(t.Events.Delete,t.Events.BlockBase),t.Events.BlockDelete=t.Events.Delete,t.Events.Delete.prototype.type=t.Events.DELETE,t.Events.Delete.prototype.toJson=function(){var e=t.Events.Delete.superClass_.toJson.call(this);return e.oldXml=t.Xml.domToText(this.oldXml),e.ids=this.ids,this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Delete.prototype.fromJson=function(e){t.Events.Delete.superClass_.fromJson.call(this,e),this.oldXml=t.Xml.textToDom(e.oldXml),this.ids=e.ids,void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Delete.prototype.run=function(e){var n=this.getEventWorkspace_();if(e){e=0;for(var i;i=this.ids[e];e++){var r=n.getBlockById(i);r?r.dispose(!1):i==this.blockId&&console.warn("Can't delete non-existent block: "+i)}}else(e=t.utils.xml.createElement("xml")).appendChild(this.oldXml),t.Xml.domToWorkspace(e,n)},t.Events.Move=function(e){t.Events.Move.superClass_.constructor.call(this,e),e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation_(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)},t.utils.object.inherits(t.Events.Move,t.Events.BlockBase),t.Events.BlockMove=t.Events.Move,t.Events.Move.prototype.type=t.Events.MOVE,t.Events.Move.prototype.toJson=function(){var e=t.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(e.newParentId=this.newParentId),this.newInputName&&(e.newInputName=this.newInputName),this.newCoordinate&&(e.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Move.prototype.fromJson=function(e){if(t.Events.Move.superClass_.fromJson.call(this,e),this.newParentId=e.newParentId,this.newInputName=e.newInputName,e.newCoordinate){var n=e.newCoordinate.split(",");this.newCoordinate=new t.utils.Coordinate(Number(n[0]),Number(n[1]))}void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Move.prototype.recordNew=function(){var t=this.currentLocation_();this.newParentId=t.parentId,this.newInputName=t.inputName,this.newCoordinate=t.coordinate},t.Events.Move.prototype.currentLocation_=function(){var t=this.getEventWorkspace_().getBlockById(this.blockId),e={},n=t.getParent();return n?(e.parentId=n.id,(t=n.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e},t.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&t.utils.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},t.Events.Move.prototype.run=function(e){var n=this.getEventWorkspace_(),i=n.getBlockById(this.blockId);if(i){var r=e?this.newParentId:this.oldParentId,o=e?this.newInputName:this.oldInputName,s=e?this.newCoordinate:this.oldCoordinate;if(e=null,r&&!(e=n.getBlockById(r)))return void console.warn("Can't connect to non-existent block: "+r);if(i.getParent()&&i.unplug(),s)o=i.getRelativeToSurfaceXY(),i.moveBy(s.x-o.x,s.y-o.y);else{if(n=(i=i.outputConnection||i.previousConnection).type,o){if(e=e.getInput(o))var a=e.connection}else n==t.connectionTypes.PREVIOUS_STATEMENT&&(a=e.nextConnection);a?i.connect(a):console.warn("Can't connect to non-existent input: "+o)}}else console.warn("Can't move non-existent block: "+this.blockId)},t.registry.register(t.registry.Type.EVENT,t.Events.CREATE,t.Events.Create),t.registry.register(t.registry.Type.EVENT,t.Events.DELETE,t.Events.Delete),t.registry.register(t.registry.Type.EVENT,t.Events.CHANGE,t.Events.BlockChange),t.registry.register(t.registry.Type.EVENT,t.Events.MOVE,t.Events.Move),t.Events.FinishedLoading=function(e){this.isBlank=void 0===e,this.workspaceId=e?e.id:"",this.group=t.Events.getGroup(),this.recordUndo=!1},t.utils.object.inherits(t.Events.FinishedLoading,t.Events.Abstract),t.Events.FinishedLoading.prototype.type=t.Events.FINISHED_LOADING,t.Events.FinishedLoading.prototype.toJson=function(){var t={type:this.type};return this.group&&(t.group=this.group),this.workspaceId&&(t.workspaceId=this.workspaceId),t},t.Events.FinishedLoading.prototype.fromJson=function(t){this.isBlank=!1,this.workspaceId=t.workspaceId,this.group=t.group},t.registry.register(t.registry.Type.EVENT,t.Events.FINISHED_LOADING,t.Events.FinishedLoading),t.Events.UiBase=function(e){t.Events.UiBase.superClass_.constructor.call(this),this.isBlank=void 0===e,this.workspaceId=e||"",this.recordUndo=!1},t.utils.object.inherits(t.Events.UiBase,t.Events.Abstract),t.Events.UiBase.prototype.isUiEvent=!0,t.Events.Ui=function(e,n,i,r){t.Events.Ui.superClass_.constructor.call(this,e?e.workspace.id:void 0),this.blockId=e?e.id:null,this.element=void 0===n?"":n,this.oldValue=void 0===i?"":i,this.newValue=void 0===r?"":r},t.utils.object.inherits(t.Events.Ui,t.Events.UiBase),t.Events.Ui.prototype.type=t.Events.UI,t.Events.Ui.prototype.toJson=function(){var e=t.Events.Ui.superClass_.toJson.call(this);return e.element=this.element,void 0!==this.newValue&&(e.newValue=this.newValue),this.blockId&&(e.blockId=this.blockId),e},t.Events.Ui.prototype.fromJson=function(e){t.Events.Ui.superClass_.fromJson.call(this,e),this.element=e.element,this.newValue=e.newValue,this.blockId=e.blockId},t.registry.register(t.registry.Type.EVENT,t.Events.UI,t.Events.Ui),t.Events.VarBase=function(e){t.Events.VarBase.superClass_.constructor.call(this),this.varId=(this.isBlank=void 0===e)?"":e.getId(),this.workspaceId=this.isBlank?"":e.workspace.id},t.utils.object.inherits(t.Events.VarBase,t.Events.Abstract),t.Events.VarBase.prototype.toJson=function(){var e=t.Events.VarBase.superClass_.toJson.call(this);return e.varId=this.varId,e},t.Events.VarBase.prototype.fromJson=function(e){t.Events.VarBase.superClass_.toJson.call(this),this.varId=e.varId},t.Events.VarCreate=function(e){t.Events.VarCreate.superClass_.constructor.call(this,e),e&&(this.varType=e.type,this.varName=e.name)},t.utils.object.inherits(t.Events.VarCreate,t.Events.VarBase),t.Events.VarCreate.prototype.type=t.Events.VAR_CREATE,t.Events.VarCreate.prototype.toJson=function(){var e=t.Events.VarCreate.superClass_.toJson.call(this);return e.varType=this.varType,e.varName=this.varName,e},t.Events.VarCreate.prototype.fromJson=function(e){t.Events.VarCreate.superClass_.fromJson.call(this,e),this.varType=e.varType,this.varName=e.varName},t.Events.VarCreate.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.createVariable(this.varName,this.varType,this.varId):e.deleteVariableById(this.varId)},t.Events.VarDelete=function(e){t.Events.VarDelete.superClass_.constructor.call(this,e),e&&(this.varType=e.type,this.varName=e.name)},t.utils.object.inherits(t.Events.VarDelete,t.Events.VarBase),t.Events.VarDelete.prototype.type=t.Events.VAR_DELETE,t.Events.VarDelete.prototype.toJson=function(){var e=t.Events.VarDelete.superClass_.toJson.call(this);return e.varType=this.varType,e.varName=this.varName,e},t.Events.VarDelete.prototype.fromJson=function(e){t.Events.VarDelete.superClass_.fromJson.call(this,e),this.varType=e.varType,this.varName=e.varName},t.Events.VarDelete.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.deleteVariableById(this.varId):e.createVariable(this.varName,this.varType,this.varId)},t.Events.VarRename=function(e,n){t.Events.VarRename.superClass_.constructor.call(this,e),e&&(this.oldName=e.name,this.newName=void 0===n?"":n)},t.utils.object.inherits(t.Events.VarRename,t.Events.VarBase),t.Events.VarRename.prototype.type=t.Events.VAR_RENAME,t.Events.VarRename.prototype.toJson=function(){var e=t.Events.VarRename.superClass_.toJson.call(this);return e.oldName=this.oldName,e.newName=this.newName,e},t.Events.VarRename.prototype.fromJson=function(e){t.Events.VarRename.superClass_.fromJson.call(this,e),this.oldName=e.oldName,this.newName=e.newName},t.Events.VarRename.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.renameVariableById(this.varId,this.newName):e.renameVariableById(this.varId,this.oldName)},t.registry.register(t.registry.Type.EVENT,t.Events.VAR_CREATE,t.Events.VarCreate),t.registry.register(t.registry.Type.EVENT,t.Events.VAR_DELETE,t.Events.VarDelete),t.registry.register(t.registry.Type.EVENT,t.Events.VAR_RENAME,t.Events.VarRename),t.BlockDragSurfaceSvg=function(t){this.container_=t,this.createDom()},t.BlockDragSurfaceSvg.prototype.SVG_=null,t.BlockDragSurfaceSvg.prototype.dragGroup_=null,t.BlockDragSurfaceSvg.prototype.container_=null,t.BlockDragSurfaceSvg.prototype.scale_=1,t.BlockDragSurfaceSvg.prototype.surfaceXY_=null,t.BlockDragSurfaceSvg.prototype.childSurfaceXY_=new t.utils.Coordinate(0,0),t.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",class:"blocklyBlockDragSurface"},this.container_),this.dragGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},this.SVG_))},t.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(e){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(e),this.SVG_.style.display="block",this.surfaceXY_=new t.utils.Coordinate(0,0)},t.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(t,e,n){this.scale_=n,t=t.toFixed(0),e=e.toFixed(0),this.childSurfaceXY_.x=parseInt(t,10),this.childSurfaceXY_.y=parseInt(e,10),this.dragGroup_.setAttribute("transform","translate("+t+","+e+") scale("+n+")")},t.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var e=this.surfaceXY_.x,n=this.surfaceXY_.y;e=e.toFixed(0),n=n.toFixed(0),this.SVG_.style.display="block",t.utils.dom.setCssTransform(this.SVG_,"translate3d("+e+"px, "+n+"px, 0px)")},t.BlockDragSurfaceSvg.prototype.translateBy=function(e,n){this.surfaceXY_=new t.utils.Coordinate(this.surfaceXY_.x+e,this.surfaceXY_.y+n),this.translateSurfaceInternal_()},t.BlockDragSurfaceSvg.prototype.translateSurface=function(e,n){this.surfaceXY_=new t.utils.Coordinate(e*this.scale_,n*this.scale_),this.translateSurfaceInternal_()},t.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var e=t.utils.getRelativeXY(this.SVG_);return new t.utils.Coordinate(e.x/this.scale_,e.y/this.scale_)},t.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_},t.BlockDragSurfaceSvg.prototype.getSvgRoot=function(){return this.SVG_},t.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild},t.BlockDragSurfaceSvg.prototype.getWsTranslation=function(){return this.childSurfaceXY_.clone()},t.BlockDragSurfaceSvg.prototype.clearAndHide=function(t){if(t?t.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock()),this.SVG_.style.display="none",this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null},t.Css={},t.Css.injected_=!1,t.Css.register=function(e){if(t.Css.injected_)throw Error("CSS already injected");Array.prototype.push.apply(t.Css.CONTENT,e),e.length=0},t.Css.inject=function(e,n){if(!t.Css.injected_){t.Css.injected_=!0;var i=t.Css.CONTENT.join("\n");t.Css.CONTENT.length=0,e&&(e=n.replace(/[\\/]$/,""),i=i.replace(/<<<PATH>>>/g,e),(e=document.createElement("style")).id="blockly-common-style",i=document.createTextNode(i),e.appendChild(i),document.head.insertBefore(e,document.head.firstChild))}},t.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font: 9pt sans-serif;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: absolute;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-color: #dadce0;","background-color: #fff;","border-radius: 2px;","padding: 4px;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;","overflow-x: hidden;","position: relative;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".blocklyArrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;","border-color: inherit;","}",".blocklyArrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<<PATH>>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text,",".blocklyBlockDragSurface text {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal,",".blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","pointer-events: none;","}",".blocklyComputeCanvas {","position: absolute;","width: 0;","height: 0;","}",".blocklyNoPointerEvents {","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyDropdownMenu .blocklyMenuItem {","padding-left: 28px;","}",".blocklyDropdownMenu .blocklyMenuItemRtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyWidgetDiv .blocklyMenu {","background: #fff;","border: 1px solid transparent;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","}",".blocklyWidgetDiv .blocklyMenu.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .blocklyMenu {","background: inherit;","border: inherit;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","position: relative;","z-index: 20000;","}",".blocklyMenuItem {","border: none;","color: #000;","cursor: pointer;","list-style: none;","margin: 0;","min-width: 7em;","padding: 6px 15px;","white-space: nowrap;","}",".blocklyMenuItemDisabled {","color: #ccc;","cursor: inherit;","}",".blocklyMenuItemHighlight {","background-color: rgba(0,0,0,.1);","}",".blocklyMenuItemCheckbox {","height: 16px;","position: absolute;","width: 16px;","}",".blocklyMenuItemSelected .blocklyMenuItemCheckbox {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","float: left;","margin-left: -24px;","position: static;","}",".blocklyMenuItemRtl .blocklyMenuItemCheckbox {","float: right;","margin-right: -24px;","}"],t.Grid=function(t,e){this.gridPattern_=t,this.spacing_=e.spacing,this.length_=e.length,this.line2_=(this.line1_=t.firstChild)&&this.line1_.nextSibling,this.snapToGrid_=e.snap},t.Grid.prototype.scale_=1,t.Grid.prototype.dispose=function(){this.gridPattern_=null},t.Grid.prototype.shouldSnap=function(){return this.snapToGrid_},t.Grid.prototype.getSpacing=function(){return this.spacing_},t.Grid.prototype.getPatternId=function(){return this.gridPattern_.id},t.Grid.prototype.update=function(t){this.scale_=t;var e=this.spacing_*t||100;this.gridPattern_.setAttribute("width",e),this.gridPattern_.setAttribute("height",e);var n=(e=Math.floor(this.spacing_/2)+.5)-this.length_/2,i=e+this.length_/2;e*=t,n*=t,i*=t,this.setLineAttributes_(this.line1_,t,n,i,e,e),this.setLineAttributes_(this.line2_,t,e,e,n,i)},t.Grid.prototype.setLineAttributes_=function(t,e,n,i,r,o){t&&(t.setAttribute("stroke-width",e),t.setAttribute("x1",n),t.setAttribute("y1",r),t.setAttribute("x2",i),t.setAttribute("y2",o))},t.Grid.prototype.moveTo=function(e,n){this.gridPattern_.setAttribute("x",e),this.gridPattern_.setAttribute("y",n),(t.utils.userAgent.IE||t.utils.userAgent.EDGE)&&this.update(this.scale_)},t.Grid.createDom=function(e,n,i){return e=t.utils.dom.createSvgElement(t.utils.Svg.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},i),0<n.length&&0<n.spacing?(t.utils.dom.createSvgElement(t.utils.Svg.LINE,{stroke:n.colour},e),1<n.length&&t.utils.dom.createSvgElement(t.utils.Svg.LINE,{stroke:n.colour},e)):t.utils.dom.createSvgElement(t.utils.Svg.LINE,{},e),e},t.Theme=function(e,n,i,r){this.name=e,this.blockStyles=n||Object.create(null),this.categoryStyles=i||Object.create(null),this.componentStyles=r||Object.create(null),this.fontStyle=Object.create(null),this.startHats=null,t.registry.register(t.registry.Type.THEME,e,this)},t.Theme.prototype.getClassName=function(){return this.name+"-theme"},t.Theme.prototype.setBlockStyle=function(t,e){this.blockStyles[t]=e},t.Theme.prototype.setCategoryStyle=function(t,e){this.categoryStyles[t]=e},t.Theme.prototype.getComponentStyle=function(t){return(t=this.componentStyles[t])&&"string"==typeof t&&this.getComponentStyle(t)?this.getComponentStyle(t):t?String(t):null},t.Theme.prototype.setComponentStyle=function(t,e){this.componentStyles[t]=e},t.Theme.prototype.setFontStyle=function(t){this.fontStyle=t},t.Theme.prototype.setStartHats=function(t){this.startHats=t},t.Theme.defineTheme=function(e,n){var i=new t.Theme(e),r=n.base;return r&&("string"==typeof r&&(r=t.registry.getObject(t.registry.Type.THEME,r)),r instanceof t.Theme&&(t.utils.object.deepMerge(i,r),i.name=e)),t.utils.object.deepMerge(i.blockStyles,n.blockStyles),t.utils.object.deepMerge(i.categoryStyles,n.categoryStyles),t.utils.object.deepMerge(i.componentStyles,n.componentStyles),t.utils.object.deepMerge(i.fontStyle,n.fontStyle),null!=n.startHats&&(i.startHats=n.startHats),i},t.Themes={},t.Themes.Classic={},t.Themes.Classic.defaultBlockStyles={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}},t.Themes.Classic.categoryStyles={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}},t.Themes.Classic=new t.Theme("classic",t.Themes.Classic.defaultBlockStyles,t.Themes.Classic.categoryStyles),t.utils.IdGenerator={},t.utils.IdGenerator.nextId_=0,t.utils.IdGenerator.getNextUniqueId=function(){return"blockly-"+(t.utils.IdGenerator.nextId_++).toString(36)},t.utils.Metrics=function(){},t.utils.toolbox={},t.utils.toolbox.CATEGORY_TOOLBOX_KIND="categoryToolbox",t.utils.toolbox.FLYOUT_TOOLBOX_KIND="flyoutToolbox",t.utils.toolbox.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3},t.utils.toolbox.convertToolboxDefToJson=function(e){return e?((e instanceof Element||"string"==typeof e)&&(e=t.utils.toolbox.parseToolboxTree(e),e=t.utils.toolbox.convertToToolboxJson_(e)),t.utils.toolbox.validateToolbox_(e),e):null},t.utils.toolbox.validateToolbox_=function(e){var n=e.kind;if(e=e.contents,n&&n!=t.utils.toolbox.FLYOUT_TOOLBOX_KIND&&n!=t.utils.toolbox.CATEGORY_TOOLBOX_KIND)throw Error("Invalid toolbox kind "+n+". Please supply either "+t.utils.toolbox.FLYOUT_TOOLBOX_KIND+" or "+t.utils.toolbox.CATEGORY_TOOLBOX_KIND);if(!e)throw Error("Toolbox must have a contents attribute.")},t.utils.toolbox.convertFlyoutDefToJsonArray=function(e){return e?e.contents?e.contents:Array.isArray(e)&&0<e.length&&!e[0].nodeType?e:t.utils.toolbox.xmlToJsonArray_(e):[]},t.utils.toolbox.hasCategories=function(e){if(!e)return!1;var n=e.kind;return n?n==t.utils.toolbox.CATEGORY_TOOLBOX_KIND:!!e.contents.filter(function(t){return"CATEGORY"==t.kind.toUpperCase()}).length},t.utils.toolbox.isCategoryCollapsible=function(t){return!(!t||!t.contents)&&!!t.contents.filter(function(t){return"CATEGORY"==t.kind.toUpperCase()}).length},t.utils.toolbox.convertToToolboxJson_=function(e){var n={contents:t.utils.toolbox.xmlToJsonArray_(e)};return e instanceof Node&&t.utils.toolbox.addAttributes_(e,n),n},t.utils.toolbox.xmlToJsonArray_=function(e){var n,i=[],r=e.childNodes;for(r||(r=e),e=0;n=r[e];e++)if(n.tagName){var o={},s=n.tagName.toUpperCase();o.kind=s,"BLOCK"==s?o.blockxml=n:n.childNodes&&0<n.childNodes.length&&(o.contents=t.utils.toolbox.xmlToJsonArray_(n)),t.utils.toolbox.addAttributes_(n,o),i.push(o)}return i},t.utils.toolbox.addAttributes_=function(t,e){for(var n=0;n<t.attributes.length;n++){var i=t.attributes[n];-1<i.nodeName.indexOf("css-")?(e.cssconfig=e.cssconfig||{},e.cssconfig[i.nodeName.replace("css-","")]=i.value):e[i.nodeName]=i.value}},t.utils.toolbox.parseToolboxTree=function(e){if(e){if("string"!=typeof e&&(t.utils.userAgent.IE&&e.outerHTML?e=e.outerHTML:e instanceof Element||(e=null)),"string"==typeof e&&"xml"!=(e=t.Xml.textToDom(e)).nodeName.toLowerCase())throw TypeError("Toolbox should be an <xml> document.")}else e=null;return e},t.Options=function(e){var n=!!e.readOnly;if(n)var i=null,r=!1,o=!1,s=!1,a=!1,l=!1,u=!1;else{i=t.utils.toolbox.convertToolboxDefToJson(e.toolbox),r=t.utils.toolbox.hasCategories(i),void 0===(o=e.trashcan)&&(o=r);var c=e.maxTrashcanContents;o?void 0===c&&(c=32):c=0,void 0===(s=e.collapse)&&(s=r),void 0===(a=e.comments)&&(a=r),void 0===(l=e.disable)&&(l=r),void 0===(u=e.sounds)&&(u=!0)}var h=!!e.rtl,p=e.horizontalLayout;void 0===p&&(p=!1);var d=e.toolboxPosition;d="end"!==d,d=p?d?t.utils.toolbox.Position.TOP:t.utils.toolbox.Position.BOTTOM:d==h?t.utils.toolbox.Position.RIGHT:t.utils.toolbox.Position.LEFT;var f=e.css;void 0===f&&(f=!0);var g="https://blockly-demo.appspot.com/static/media/";e.media?g=e.media:e.path&&(g=e.path+"media/");var m=void 0===e.oneBasedIndex||!!e.oneBasedIndex,v=e.renderer||"geras",_=e.plugins||{};this.RTL=h,this.oneBasedIndex=m,this.collapse=s,this.comments=a,this.disable=l,this.readOnly=n,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=e.maxInstances,this.pathToMedia=g,this.hasCategories=r,this.moveOptions=t.Options.parseMoveOptions_(e,r),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=o,this.maxTrashcanContents=c,this.hasSounds=u,this.hasCss=f,this.horizontalLayout=p,this.languageTree=i,this.gridOptions=t.Options.parseGridOptions_(e),this.zoomOptions=t.Options.parseZoomOptions_(e),this.toolboxPosition=d,this.theme=t.Options.parseThemeOptions_(e),this.renderer=v,this.rendererOverrides=e.rendererOverrides,this.gridPattern=null,this.parentWorkspace=e.parentWorkspace,this.plugins=_},t.BlocklyOptions=function(){},t.Options.parseMoveOptions_=function(t,e){var n=t.move||{},i={};return void 0===n.scrollbars&&void 0===t.scrollbars?i.scrollbars=e:"object"==typeof n.scrollbars?(i.scrollbars={},i.scrollbars.horizontal=!!n.scrollbars.horizontal,i.scrollbars.vertical=!!n.scrollbars.vertical,i.scrollbars.horizontal&&i.scrollbars.vertical?i.scrollbars=!0:i.scrollbars.horizontal||i.scrollbars.vertical||(i.scrollbars=!1)):i.scrollbars=!!n.scrollbars||!!t.scrollbars,i.wheel=i.scrollbars&&void 0!==n.wheel?!!n.wheel:"object"==typeof i.scrollbars,i.drag=!!i.scrollbars&&(void 0===n.drag||!!n.drag),i},t.Options.parseZoomOptions_=function(t){t=t.zoom||{};var e={};return e.controls=void 0!==t.controls&&!!t.controls,e.wheel=void 0!==t.wheel&&!!t.wheel,e.startScale=void 0===t.startScale?1:Number(t.startScale),e.maxScale=void 0===t.maxScale?3:Number(t.maxScale),e.minScale=void 0===t.minScale?.3:Number(t.minScale),e.scaleSpeed=void 0===t.scaleSpeed?1.2:Number(t.scaleSpeed),e.pinch=void 0===t.pinch?e.wheel||e.controls:!!t.pinch,e},t.Options.parseGridOptions_=function(t){t=t.grid||{};var e={};return e.spacing=Number(t.spacing)||0,e.colour=t.colour||"#888",e.length=void 0===t.length?1:Number(t.length),e.snap=0<e.spacing&&!!t.snap,e},t.Options.parseThemeOptions_=function(e){return"string"==typeof(e=e.theme||t.Themes.Classic)?t.registry.getObject(t.registry.Type.THEME,e):e instanceof t.Theme?e:t.Theme.defineTheme(e.name||"builtin"+t.utils.IdGenerator.getNextUniqueId(),e)},t.Options.parseToolboxTree=function(e){return t.utils.deprecation.warn("Blockly.Options.parseToolboxTree","September 2020","September 2021","Blockly.utils.toolbox.parseToolboxTree"),t.utils.toolbox.parseToolboxTree(e)},t.ScrollbarPair=function(e,n,i,r,o){this.workspace_=e,n=void 0===n||n,i=void 0===i||i;var s=n&&i;n&&(this.hScroll=new t.Scrollbar(e,!0,s,r,o)),i&&(this.vScroll=new t.Scrollbar(e,!1,s,r,o)),s&&(this.corner_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{height:t.Scrollbar.scrollbarThickness,width:t.Scrollbar.scrollbarThickness,class:"blocklyScrollbarBackground"},null),t.utils.dom.insertAfter(this.corner_,e.getBubbleCanvas())),this.oldHostMetrics_=null},t.ScrollbarPair.prototype.dispose=function(){t.utils.dom.removeNode(this.corner_),this.oldHostMetrics_=this.workspace_=this.corner_=null,this.hScroll&&(this.hScroll.dispose(),this.hScroll=null),this.vScroll&&(this.vScroll.dispose(),this.vScroll=null)},t.ScrollbarPair.prototype.resize=function(){var e=this.workspace_.getMetrics();if(e){var n=!1,i=!1;if(this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft?(this.oldHostMetrics_&&this.oldHostMetrics_.scrollWidth==e.scrollWidth&&this.oldHostMetrics_.viewLeft==e.viewLeft&&this.oldHostMetrics_.scrollLeft==e.scrollLeft||(n=!0),this.oldHostMetrics_&&this.oldHostMetrics_.scrollHeight==e.scrollHeight&&this.oldHostMetrics_.viewTop==e.viewTop&&this.oldHostMetrics_.scrollTop==e.scrollTop||(i=!0)):i=n=!0,n||i){try{t.Events.disable(),this.hScroll&&n&&this.hScroll.resize(e),this.vScroll&&i&&this.vScroll.resize(e)}finally{t.Events.enable()}this.workspace_.maybeFireViewportChangeEvent()}this.hScroll&&this.vScroll&&(this.oldHostMetrics_&&this.oldHostMetrics_.viewWidth==e.viewWidth&&this.oldHostMetrics_.absoluteLeft==e.absoluteLeft||this.corner_.setAttribute("x",this.vScroll.position.x),this.oldHostMetrics_&&this.oldHostMetrics_.viewHeight==e.viewHeight&&this.oldHostMetrics_.absoluteTop==e.absoluteTop||this.corner_.setAttribute("y",this.hScroll.position.y)),this.oldHostMetrics_=e}},t.ScrollbarPair.prototype.canScrollHorizontally=function(){return!!this.hScroll},t.ScrollbarPair.prototype.canScrollVertically=function(){return!!this.vScroll},t.ScrollbarPair.prototype.setOrigin=function(t,e){this.hScroll&&this.hScroll.setOrigin(t,e),this.vScroll&&this.vScroll.setOrigin(t,e)},t.ScrollbarPair.prototype.set=function(t,e,n){this.hScroll&&this.hScroll.set(t,!1),this.vScroll&&this.vScroll.set(e,!1),(n||void 0===n)&&(t={},this.hScroll&&(t.x=this.hScroll.getRatio_()),this.vScroll&&(t.y=this.vScroll.getRatio_()),this.workspace_.setMetrics(t))},t.ScrollbarPair.prototype.setX=function(t){this.hScroll&&this.hScroll.set(t,!0)},t.ScrollbarPair.prototype.setY=function(t){this.vScroll&&this.vScroll.set(t,!0)},t.ScrollbarPair.prototype.setContainerVisible=function(t){this.hScroll&&this.hScroll.setContainerVisible(t),this.vScroll&&this.vScroll.setContainerVisible(t)},t.ScrollbarPair.prototype.isVisible=function(){var t=!1;return this.hScroll&&(t=this.hScroll.isVisible()),this.vScroll&&(t=t||this.vScroll.isVisible()),t},t.ScrollbarPair.prototype.resizeContent=function(t){this.hScroll&&this.hScroll.resizeContentHorizontal(t),this.vScroll&&this.vScroll.resizeContentVertical(t)},t.ScrollbarPair.prototype.resizeView=function(t){this.hScroll&&this.hScroll.resizeViewHorizontal(t),this.vScroll&&this.vScroll.resizeViewVertical(t)},t.Scrollbar=function(e,n,i,r,o){this.workspace_=e,this.pair_=i||!1,this.horizontal_=n,this.margin_=void 0!==o?o:t.Scrollbar.DEFAULT_SCROLLBAR_MARGIN,this.ratio=this.oldHostMetrics_=null,this.createDom_(r),this.position=new t.utils.Coordinate(0,0),e=t.Scrollbar.scrollbarThickness,n?(this.svgBackground_.setAttribute("height",e),this.outerSvg_.setAttribute("height",e),this.svgHandle_.setAttribute("height",e-5),this.svgHandle_.setAttribute("y",2.5),this.lengthAttribute_="width",this.positionAttribute_="x"):(this.svgBackground_.setAttribute("width",e),this.outerSvg_.setAttribute("width",e),this.svgHandle_.setAttribute("width",e-5),this.svgHandle_.setAttribute("x",2.5),this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=t.browserEvents.conditionalBind(this.svgBackground_,"mousedown",this,this.onMouseDownBar_),this.onMouseDownHandleWrapper_=t.browserEvents.conditionalBind(this.svgHandle_,"mousedown",this,this.onMouseDownHandle_)},t.Scrollbar.prototype.origin_=new t.utils.Coordinate(0,0),t.Scrollbar.prototype.startDragMouse_=0,t.Scrollbar.prototype.scrollbarLength_=0,t.Scrollbar.prototype.handleLength_=0,t.Scrollbar.prototype.handlePosition_=0,t.Scrollbar.prototype.isVisible_=!0,t.Scrollbar.prototype.containerVisible_=!0,t.Scrollbar.scrollbarThickness=15,t.Touch.TOUCH_ENABLED&&(t.Scrollbar.scrollbarThickness=25),t.Scrollbar.DEFAULT_SCROLLBAR_MARGIN=.5,t.Scrollbar.metricsAreEquivalent_=function(t,e){return t.viewWidth==e.viewWidth&&t.viewHeight==e.viewHeight&&t.viewLeft==e.viewLeft&&t.viewTop==e.viewTop&&t.absoluteTop==e.absoluteTop&&t.absoluteLeft==e.absoluteLeft&&t.scrollWidth==e.scrollWidth&&t.scrollHeight==e.scrollHeight&&t.scrollLeft==e.scrollLeft&&t.scrollTop==e.scrollTop},t.Scrollbar.prototype.dispose=function(){this.cleanUp_(),t.browserEvents.unbind(this.onMouseDownBarWrapper_),this.onMouseDownBarWrapper_=null,t.browserEvents.unbind(this.onMouseDownHandleWrapper_),this.onMouseDownHandleWrapper_=null,t.utils.dom.removeNode(this.outerSvg_),this.svgBackground_=this.svgGroup_=this.outerSvg_=null,this.svgHandle_&&(this.workspace_.getThemeManager().unsubscribe(this.svgHandle_),this.svgHandle_=null),this.workspace_=null},t.Scrollbar.prototype.constrainHandleLength_=function(t){return 0>=t||isNaN(t)?0:Math.min(t,this.scrollbarLength_)},t.Scrollbar.prototype.setHandleLength_=function(t){this.handleLength_=t,this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)},t.Scrollbar.prototype.constrainHandlePosition_=function(t){return 0>=t||isNaN(t)?0:Math.min(t,this.scrollbarLength_-this.handleLength_)},t.Scrollbar.prototype.setHandlePosition=function(t){this.handlePosition_=t,this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)},t.Scrollbar.prototype.setScrollbarLength_=function(t){this.scrollbarLength_=t,this.outerSvg_.setAttribute(this.lengthAttribute_,this.scrollbarLength_),this.svgBackground_.setAttribute(this.lengthAttribute_,this.scrollbarLength_)},t.Scrollbar.prototype.setPosition=function(e,n){this.position.x=e,this.position.y=n,t.utils.dom.setCssTransform(this.outerSvg_,"translate("+(this.position.x+this.origin_.x)+"px,"+(this.position.y+this.origin_.y)+"px)")},t.Scrollbar.prototype.resize=function(e){(e||(e=this.workspace_.getMetrics()))&&(this.oldHostMetrics_&&t.Scrollbar.metricsAreEquivalent_(e,this.oldHostMetrics_)||(this.horizontal_?this.resizeHorizontal_(e):this.resizeVertical_(e),this.oldHostMetrics_=e,this.updateMetrics_()))},t.Scrollbar.prototype.requiresViewResize_=function(t){return!this.oldHostMetrics_||(this.oldHostMetrics_.viewWidth!==t.viewWidth||this.oldHostMetrics_.viewHeight!==t.viewHeight||this.oldHostMetrics_.absoluteLeft!==t.absoluteLeft||this.oldHostMetrics_.absoluteTop!==t.absoluteTop)},t.Scrollbar.prototype.resizeHorizontal_=function(t){this.requiresViewResize_(t)?this.resizeViewHorizontal(t):this.resizeContentHorizontal(t)},t.Scrollbar.prototype.resizeViewHorizontal=function(e){var n=e.viewWidth-2*this.margin_;this.pair_&&(n-=t.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,n)),n=e.absoluteLeft+this.margin_,this.pair_&&this.workspace_.RTL&&(n+=t.Scrollbar.scrollbarThickness),this.setPosition(n,e.absoluteTop+e.viewHeight-t.Scrollbar.scrollbarThickness-this.margin_),this.resizeContentHorizontal(e)},t.Scrollbar.prototype.resizeContentHorizontal=function(t){if(t.viewWidth>=t.scrollWidth)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var e=this.scrollbarLength_*t.viewWidth/t.scrollWidth;e=this.constrainHandleLength_(e),this.setHandleLength_(e),e=t.scrollWidth-t.viewWidth;var n=this.scrollbarLength_-this.handleLength_;t=(t.viewLeft-t.scrollLeft)/e*n,t=this.constrainHandlePosition_(t),this.setHandlePosition(t),this.ratio=n/e}},t.Scrollbar.prototype.resizeVertical_=function(t){this.requiresViewResize_(t)?this.resizeViewVertical(t):this.resizeContentVertical(t)},t.Scrollbar.prototype.resizeViewVertical=function(e){var n=e.viewHeight-2*this.margin_;this.pair_&&(n-=t.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,n)),this.setPosition(this.workspace_.RTL?e.absoluteLeft+this.margin_:e.absoluteLeft+e.viewWidth-t.Scrollbar.scrollbarThickness-this.margin_,e.absoluteTop+this.margin_),this.resizeContentVertical(e)},t.Scrollbar.prototype.resizeContentVertical=function(t){if(t.viewHeight>=t.scrollHeight)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var e=this.scrollbarLength_*t.viewHeight/t.scrollHeight;e=this.constrainHandleLength_(e),this.setHandleLength_(e),e=t.scrollHeight-t.viewHeight;var n=this.scrollbarLength_-this.handleLength_;t=(t.viewTop-t.scrollTop)/e*n,t=this.constrainHandlePosition_(t),this.setHandlePosition(t),this.ratio=n/e}},t.Scrollbar.prototype.createDom_=function(e){var n="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");e&&(n+=" "+e),this.outerSvg_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{class:n},null),this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},this.outerSvg_),this.svgBackground_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyScrollbarBackground"},this.svgGroup_),e=Math.floor((t.Scrollbar.scrollbarThickness-5)/2),this.svgHandle_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},this.svgGroup_),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity"),t.utils.dom.insertAfter(this.outerSvg_,this.workspace_.getParentSvg())},t.Scrollbar.prototype.isVisible=function(){return this.isVisible_},t.Scrollbar.prototype.setContainerVisible=function(t){var e=t!=this.containerVisible_;this.containerVisible_=t,e&&this.updateDisplay_()},t.Scrollbar.prototype.setVisible=function(t){var e=t!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=t,e&&this.updateDisplay_()},t.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")},t.Scrollbar.prototype.onMouseDownBar_=function(e){if(this.workspace_.markFocused(),t.Touch.clearTouchIdentifier(),this.cleanUp_(),t.utils.isRightButton(e))e.stopPropagation();else{var n=t.utils.mouseToSvg(e,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM());n=this.horizontal_?n.x:n.y;var i=t.utils.getInjectionDivXY_(this.svgHandle_);i=this.horizontal_?i.x:i.y;var r=this.handlePosition_,o=.95*this.handleLength_;n<=i?r-=o:n>=i+this.handleLength_&&(r+=o),this.setHandlePosition(this.constrainHandlePosition_(r)),this.updateMetrics_(),e.stopPropagation(),e.preventDefault()}},t.Scrollbar.prototype.onMouseDownHandle_=function(e){this.workspace_.markFocused(),this.cleanUp_(),t.utils.isRightButton(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?e.clientX:e.clientY,t.Scrollbar.onMouseUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",this,this.onMouseUpHandle_),t.Scrollbar.onMouseMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",this,this.onMouseMoveHandle_),e.stopPropagation(),e.preventDefault())},t.Scrollbar.prototype.onMouseMoveHandle_=function(t){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+((this.horizontal_?t.clientX:t.clientY)-this.startDragMouse_))),this.updateMetrics_()},t.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface(),t.Touch.clearTouchIdentifier(),this.cleanUp_()},t.Scrollbar.prototype.cleanUp_=function(){t.hideChaff(!0),t.Scrollbar.onMouseUpWrapper_&&(t.browserEvents.unbind(t.Scrollbar.onMouseUpWrapper_),t.Scrollbar.onMouseUpWrapper_=null),t.Scrollbar.onMouseMoveWrapper_&&(t.browserEvents.unbind(t.Scrollbar.onMouseMoveWrapper_),t.Scrollbar.onMouseMoveWrapper_=null)},t.Scrollbar.prototype.getRatio_=function(){var t=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);return isNaN(t)&&(t=0),t},t.Scrollbar.prototype.updateMetrics_=function(){var t=this.getRatio_(),e={};this.horizontal_?e.x=t:e.y=t,this.workspace_.setMetrics(e)},t.Scrollbar.prototype.set=function(t,e){this.setHandlePosition(this.constrainHandlePosition_(t*this.ratio)),(e||void 0===e)&&this.updateMetrics_()},t.Scrollbar.prototype.setOrigin=function(e,n){this.origin_=new t.utils.Coordinate(e,n)},t.Tooltip={},t.Tooltip.visible=!1,t.Tooltip.blocked_=!1,t.Tooltip.LIMIT=50,t.Tooltip.mouseOutPid_=0,t.Tooltip.showPid_=0,t.Tooltip.lastX_=0,t.Tooltip.lastY_=0,t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.OFFSET_X=0,t.Tooltip.OFFSET_Y=10,t.Tooltip.RADIUS_OK=10,t.Tooltip.HOVER_MS=750,t.Tooltip.MARGINS=5,t.Tooltip.DIV=null,t.Tooltip.getTooltipOfObject=function(e){if(e=t.Tooltip.getTargetObject_(e)){for(e=e.tooltip;"function"==typeof e;)e=e();if("string"!=typeof e)throw Error("Tooltip function must return a string.");return e}return""},t.Tooltip.getTargetObject_=function(t){for(;t&&t.tooltip;){if("string"==typeof t.tooltip||"function"==typeof t.tooltip)return t;t=t.tooltip}return null},t.Tooltip.createDom=function(){t.Tooltip.DIV||(t.Tooltip.DIV=document.createElement("div"),t.Tooltip.DIV.className="blocklyTooltipDiv",(t.parentContainer||document.body).appendChild(t.Tooltip.DIV))},t.Tooltip.bindMouseEvents=function(e){e.mouseOverWrapper_=t.browserEvents.bind(e,"mouseover",null,t.Tooltip.onMouseOver_),e.mouseOutWrapper_=t.browserEvents.bind(e,"mouseout",null,t.Tooltip.onMouseOut_),e.addEventListener("mousemove",t.Tooltip.onMouseMove_,!1)},t.Tooltip.unbindMouseEvents=function(e){e&&(t.browserEvents.unbind(e.mouseOverWrapper_),t.browserEvents.unbind(e.mouseOutWrapper_),e.removeEventListener("mousemove",t.Tooltip.onMouseMove_))},t.Tooltip.onMouseOver_=function(e){t.Tooltip.blocked_||(e=t.Tooltip.getTargetObject_(e.currentTarget),t.Tooltip.element_!=e&&(t.Tooltip.hide(),t.Tooltip.poisonedElement_=null,t.Tooltip.element_=e),clearTimeout(t.Tooltip.mouseOutPid_))},t.Tooltip.onMouseOut_=function(e){t.Tooltip.blocked_||(t.Tooltip.mouseOutPid_=setTimeout(function(){t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.hide()},1),clearTimeout(t.Tooltip.showPid_))},t.Tooltip.onMouseMove_=function(e){if(t.Tooltip.element_&&t.Tooltip.element_.tooltip&&!t.Tooltip.blocked_)if(t.Tooltip.visible){var n=t.Tooltip.lastX_-e.pageX;e=t.Tooltip.lastY_-e.pageY,Math.sqrt(n*n+e*e)>t.Tooltip.RADIUS_OK&&t.Tooltip.hide()}else t.Tooltip.poisonedElement_!=t.Tooltip.element_&&(clearTimeout(t.Tooltip.showPid_),t.Tooltip.lastX_=e.pageX,t.Tooltip.lastY_=e.pageY,t.Tooltip.showPid_=setTimeout(t.Tooltip.show_,t.Tooltip.HOVER_MS))},t.Tooltip.dispose=function(){t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.hide()},t.Tooltip.hide=function(){t.Tooltip.visible&&(t.Tooltip.visible=!1,t.Tooltip.DIV&&(t.Tooltip.DIV.style.display="none")),t.Tooltip.showPid_&&clearTimeout(t.Tooltip.showPid_)},t.Tooltip.block=function(){t.Tooltip.hide(),t.Tooltip.blocked_=!0},t.Tooltip.unblock=function(){t.Tooltip.blocked_=!1},t.Tooltip.show_=function(){if(!t.Tooltip.blocked_&&(t.Tooltip.poisonedElement_=t.Tooltip.element_,t.Tooltip.DIV)){t.Tooltip.DIV.textContent="";var e=t.Tooltip.getTooltipOfObject(t.Tooltip.element_);e=(e=t.utils.string.wrap(e,t.Tooltip.LIMIT)).split("\n");for(var n=0;n<e.length;n++){var i=document.createElement("div");i.appendChild(document.createTextNode(e[n])),t.Tooltip.DIV.appendChild(i)}e=t.Tooltip.element_.RTL,n=document.documentElement.clientWidth,i=document.documentElement.clientHeight,t.Tooltip.DIV.style.direction=e?"rtl":"ltr",t.Tooltip.DIV.style.display="block",t.Tooltip.visible=!0;var r=t.Tooltip.lastX_;r=e?r-(t.Tooltip.OFFSET_X+t.Tooltip.DIV.offsetWidth):r+t.Tooltip.OFFSET_X;var o=t.Tooltip.lastY_+t.Tooltip.OFFSET_Y;o+t.Tooltip.DIV.offsetHeight>i+window.scrollY&&(o-=t.Tooltip.DIV.offsetHeight+2*t.Tooltip.OFFSET_Y),e?r=Math.max(t.Tooltip.MARGINS-window.scrollX,r):r+t.Tooltip.DIV.offsetWidth>n+window.scrollX-2*t.Tooltip.MARGINS&&(r=n-t.Tooltip.DIV.offsetWidth-2*t.Tooltip.MARGINS),t.Tooltip.DIV.style.top=o+"px",t.Tooltip.DIV.style.left=r+"px"}},t.utils.aria={},t.utils.aria.ARIA_PREFIX_="aria-",t.utils.aria.ROLE_ATTRIBUTE_="role",t.utils.aria.Role={GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",LISTBOX:"listbox",MENU:"menu",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",OPTION:"option",PRESENTATION:"presentation",ROW:"row",TREE:"tree",TREEITEM:"treeitem"},t.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",COLCOUNT:"colcount",DISABLED:"disabled",EXPANDED:"expanded",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",ORIENTATION:"orientation",POSINSET:"posinset",ROWCOUNT:"rowcount",SELECTED:"selected",SETSIZE:"setsize",VALUEMAX:"valuemax",VALUEMIN:"valuemin"},t.utils.aria.setRole=function(e,n){e.setAttribute(t.utils.aria.ROLE_ATTRIBUTE_,n)},t.utils.aria.setState=function(e,n,i){Array.isArray(i)&&(i=i.join(" ")),e.setAttribute(t.utils.aria.ARIA_PREFIX_+n,i)},t.IASTNodeLocation=function(){},t.IASTNodeLocationSvg=function(){},t.IASTNodeLocationWithBlock=function(){},t.IKeyboardAccessible=function(){},t.utils.deprecation={},t.utils.deprecation.warn=function(t,e,n,i){t=t+" was deprecated on "+e+" and will be deleted on "+n+".",i&&(t+="\nUse "+i+" instead."),console.warn(t)},t.Connection=function(t,e){this.sourceBlock_=t,this.type=e},t.Connection.CAN_CONNECT=0,t.Connection.REASON_SELF_CONNECTION=1,t.Connection.REASON_WRONG_TYPE=2,t.Connection.REASON_TARGET_NULL=3,t.Connection.REASON_CHECKS_FAILED=4,t.Connection.REASON_DIFFERENT_WORKSPACES=5,t.Connection.REASON_SHADOW_PARENT=6,t.Connection.REASON_DRAG_CHECKS_FAILED=7,t.Connection.prototype.targetConnection=null,t.Connection.prototype.disposed=!1,t.Connection.prototype.check_=null,t.Connection.prototype.shadowDom_=null,t.Connection.prototype.x=0,t.Connection.prototype.y=0,t.Connection.prototype.connect_=function(e){var n,i=t.connectionTypes.INPUT_VALUE,r=this.getSourceBlock(),o=e.getSourceBlock();if(e.isConnected()&&e.disconnect(),this.isConnected()){var s=this.getShadowDom(!0);this.shadowDom_=null;var a=this.targetBlock();if(a.isShadow())a.dispose(!1);else{this.disconnect();var l=a}this.shadowDom_=s}t.Events.isEnabled()&&(n=new(t.Events.get(t.Events.BLOCK_MOVE))(o)),t.Connection.connectReciprocally_(this,e),o.setParent(r),n&&(n.recordNew(),t.Events.fire(n)),l&&(e=this.type===i?l.outputConnection:l.previousConnection,(o=t.Connection.getConnectionForOrphanedConnection(o,e))?e.connect(o):e.onFailedConnect(this))},t.Connection.prototype.dispose=function(){if(this.isConnected()){this.setShadowDom(null);var t=this.targetBlock();t&&t.unplug()}this.disposed=!0},t.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_},t.Connection.prototype.isSuperior=function(){return this.type==t.connectionTypes.INPUT_VALUE||this.type==t.connectionTypes.NEXT_STATEMENT},t.Connection.prototype.isConnected=function(){return!!this.targetConnection},t.Connection.prototype.canConnectWithReason=function(e){return t.utils.deprecation.warn("Connection.prototype.canConnectWithReason","July 2020","July 2021","the workspace's connection checker"),this.getConnectionChecker().canConnectWithReason(this,e,!1)},t.Connection.prototype.checkConnection=function(e){t.utils.deprecation.warn("Connection.prototype.checkConnection","July 2020","July 2021","the workspace's connection checker");var n=this.getConnectionChecker(),i=n.canConnectWithReason(this,e,!1);if(i!=t.Connection.CAN_CONNECT)throw Error(n.getErrorMessage(i,this,e))},t.Connection.prototype.getConnectionChecker=function(){return this.sourceBlock_.workspace.connectionChecker},t.Connection.prototype.isConnectionAllowed=function(e){return t.utils.deprecation.warn("Connection.prototype.isConnectionAllowed","July 2020","July 2021","the workspace's connection checker"),this.getConnectionChecker().canConnect(this,e,!0)},t.Connection.prototype.onFailedConnect=function(t){},t.Connection.prototype.connect=function(e){if(this.targetConnection!=e&&this.getConnectionChecker().canConnect(this,e,!1)){var n=t.Events.getGroup();n||t.Events.setGroup(!0),this.isSuperior()?this.connect_(e):e.connect_(this),n||t.Events.setGroup(!1)}},t.Connection.connectReciprocally_=function(t,e){if(!t||!e)throw Error("Cannot connect null connections.");t.targetConnection=e,e.targetConnection=t},t.Connection.getSingleConnection_=function(t,e){for(var n,i=null,r=(e=e.outputConnection).getConnectionChecker(),o=0;n=t.inputList[o];o++)if((n=n.connection)&&r.canConnect(e,n,!1)){if(i)return null;i=n}return i},t.Connection.getConnectionForOrphanedOutput_=function(e,n){for(var i;i=t.Connection.getSingleConnection_(e,n);)if(!(e=i.targetBlock())||e.isShadow())return i;return null},t.Connection.getConnectionForOrphanedConnection=function(e,n){if(n.type===t.connectionTypes.OUTPUT_VALUE)return t.Connection.getConnectionForOrphanedOutput_(e,n.getSourceBlock());e=e.lastConnectionInStack(!0);var i=n.getConnectionChecker();return e&&i.canConnect(n,e,!1)?e:null},t.Connection.prototype.disconnect=function(){var e=this.targetConnection;if(!e)throw Error("Source connection not connected.");if(e.targetConnection!=this)throw Error("Target connection not connected to source connection.");if(this.isSuperior()){var n=this.sourceBlock_,i=e.getSourceBlock();e=this}else n=e.getSourceBlock(),i=this.sourceBlock_;var r=t.Events.getGroup();r||t.Events.setGroup(!0),this.disconnectInternal_(n,i),i.isShadow()||e.respawnShadow_(),r||t.Events.setGroup(!1)},t.Connection.prototype.disconnectInternal_=function(e,n){var i;t.Events.isEnabled()&&(i=new(t.Events.get(t.Events.BLOCK_MOVE))(n)),this.targetConnection=this.targetConnection.targetConnection=null,n.setParent(null),i&&(i.recordNew(),t.Events.fire(i))},t.Connection.prototype.respawnShadow_=function(){var e=this.getSourceBlock(),n=this.getShadowDom();if(e.workspace&&n)if((e=t.Xml.domToBlock(n,e.workspace)).outputConnection)this.connect(e.outputConnection);else{if(!e.previousConnection)throw Error("Child block does not have output or previous statement.");this.connect(e.previousConnection)}},t.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null},t.Connection.prototype.checkType=function(e){return t.utils.deprecation.warn("Connection.prototype.checkType","October 2019","January 2021","the workspace's connection checker"),this.getConnectionChecker().canConnect(this,e,!1)},t.Connection.prototype.checkType_=function(e){return t.utils.deprecation.warn("Connection.prototype.checkType_","October 2019","January 2021","the workspace's connection checker"),this.checkType(e)},t.Connection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()},t.Connection.prototype.setCheck=function(t){return t?(Array.isArray(t)||(t=[t]),this.check_=t,this.onCheckChanged_()):this.check_=null,this},t.Connection.prototype.getCheck=function(){return this.check_},t.Connection.prototype.setShadowDom=function(t){this.shadowDom_=t,(t=this.targetBlock())?t.isShadow()&&(t.dispose(!1),this.respawnShadow_()):this.respawnShadow_()},t.Connection.prototype.getShadowDom=function(e){return e&&this.targetBlock().isShadow()?t.Xml.blockToDom(this.targetBlock()):this.shadowDom_},t.Connection.prototype.neighbours=function(t){return[]},t.Connection.prototype.getParentInput=function(){for(var t=null,e=this.sourceBlock_.inputList,n=0;n<e.length;n++)if(e[n].connection===this){t=e[n];break}return t},t.Connection.prototype.toString=function(){var t=this.sourceBlock_;if(!t)return"Orphan Connection";if(t.outputConnection==this)var e="Output Connection of ";else if(t.previousConnection==this)e="Previous Connection of ";else if(t.nextConnection==this)e="Next Connection of ";else{e=null;for(var n,i=0;n=t.inputList[i];i++)if(n.connection==this){e=n;break}if(!e)return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection";e='Input "'+e.name+'" connection on '}return e+t.toDevString()},t.IConnectionChecker=function(){},t.ConnectionChecker=function(){},t.ConnectionChecker.prototype.canConnect=function(e,n,i,r){return this.canConnectWithReason(e,n,i,r)==t.Connection.CAN_CONNECT},t.ConnectionChecker.prototype.canConnectWithReason=function(e,n,i,r){var o=this.doSafetyChecks(e,n);return o!=t.Connection.CAN_CONNECT?o:this.doTypeChecks(e,n)?i&&!this.doDragChecks(e,n,r||0)?t.Connection.REASON_DRAG_CHECKS_FAILED:t.Connection.CAN_CONNECT:t.Connection.REASON_CHECKS_FAILED},t.ConnectionChecker.prototype.getErrorMessage=function(e,n,i){switch(e){case t.Connection.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case t.Connection.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case t.Connection.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case t.Connection.REASON_TARGET_NULL:return"Target connection is null.";case t.Connection.REASON_CHECKS_FAILED:return"Connection checks failed. "+n+" expected "+n.getCheck()+", found "+i.getCheck();case t.Connection.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case t.Connection.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";default:return"Unknown connection failure: this should never happen!"}},t.ConnectionChecker.prototype.doSafetyChecks=function(e,n){if(!e||!n)return t.Connection.REASON_TARGET_NULL;if(e.isSuperior())var i=e.getSourceBlock(),r=n.getSourceBlock();else r=e.getSourceBlock(),i=n.getSourceBlock();return i==r?t.Connection.REASON_SELF_CONNECTION:n.type!=t.OPPOSITE_TYPE[e.type]?t.Connection.REASON_WRONG_TYPE:i.workspace!==r.workspace?t.Connection.REASON_DIFFERENT_WORKSPACES:i.isShadow()&&!r.isShadow()?t.Connection.REASON_SHADOW_PARENT:t.Connection.CAN_CONNECT},t.ConnectionChecker.prototype.doTypeChecks=function(t,e){if(t=t.getCheck(),e=e.getCheck(),!t||!e)return!0;for(var n=0;n<t.length;n++)if(-1!=e.indexOf(t[n]))return!0;return!1},t.ConnectionChecker.prototype.doDragChecks=function(e,n,i){if(e.distanceFrom(n)>i||n.getSourceBlock().isInsertionMarker())return!1;switch(n.type){case t.connectionTypes.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,n);case t.connectionTypes.OUTPUT_VALUE:if(n.isConnected()&&!n.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case t.connectionTypes.INPUT_VALUE:if(n.isConnected()&&!n.targetBlock().isMovable()&&!n.targetBlock().isShadow())return!1;break;case t.connectionTypes.NEXT_STATEMENT:if(n.isConnected()&&!e.getSourceBlock().nextConnection&&!n.targetBlock().isShadow()&&n.targetBlock().nextConnection)return!1;break;default:return!1}return-1==t.draggingConnections.indexOf(n)},t.ConnectionChecker.prototype.canConnectToPrevious_=function(e,n){return!e.targetConnection&&-1==t.draggingConnections.indexOf(n)&&(!n.targetConnection||!!(e=n.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())},t.registry.register(t.registry.Type.CONNECTION_CHECKER,t.registry.DEFAULT,t.ConnectionChecker),t.VariableMap=function(t){this.variableMap_=Object.create(null),this.workspace=t},t.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)},t.VariableMap.prototype.renameVariable=function(e,n){var i=this.getVariable(n,e.type),r=this.workspace.getAllBlocks(!1);t.Events.setGroup(!0);try{i&&i.getId()!=e.getId()?this.renameVariableWithConflict_(e,n,i,r):this.renameVariableAndUses_(e,n,r)}finally{t.Events.setGroup(!1)}},t.VariableMap.prototype.renameVariableById=function(t,e){var n=this.getVariableById(t);if(!n)throw Error("Tried to rename a variable that didn't exist. ID: "+t);this.renameVariable(n,e)},t.VariableMap.prototype.renameVariableAndUses_=function(e,n,i){for(t.Events.fire(new(t.Events.get(t.Events.VAR_RENAME))(e,n)),e.name=n,n=0;n<i.length;n++)i[n].updateVarName(e)},t.VariableMap.prototype.renameVariableWithConflict_=function(e,n,i,r){var o=e.type;for(n!=i.name&&this.renameVariableAndUses_(i,n,r),n=0;n<r.length;n++)r[n].renameVarById(e.getId(),i.getId());t.Events.fire(new(t.Events.get(t.Events.VAR_DELETE))(e)),e=this.getVariablesOfType(o).indexOf(e),this.variableMap_[o].splice(e,1)},t.VariableMap.prototype.createVariable=function(e,n,i){var r=this.getVariable(e,n);if(r){if(i&&r.getId()!=i)throw Error('Variable "'+e+'" is already in use and its id is "'+r.getId()+'" which conflicts with the passed in id, "'+i+'".');return r}if(i&&this.getVariableById(i))throw Error('Variable id, "'+i+'", is already in use.');return r=i||t.utils.genUid(),n=n||"",r=new t.VariableModel(this.workspace,e,n,r),(e=this.variableMap_[n]||[]).push(r),delete this.variableMap_[n],this.variableMap_[n]=e,r},t.VariableMap.prototype.deleteVariable=function(e){for(var n,i=this.variableMap_[e.type],r=0;n=i[r];r++)if(n.getId()==e.getId()){i.splice(r,1),t.Events.fire(new(t.Events.get(t.Events.VAR_DELETE))(e));break}},t.VariableMap.prototype.deleteVariableById=function(e){var n=this.getVariableById(e);if(n){var i,r=n.name,o=this.getVariableUsesById(e);for(e=0;i=o[e];e++)if("procedures_defnoreturn"==i.type||"procedures_defreturn"==i.type)return e=i.getFieldValue("NAME"),r=t.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",r).replace("%2",e),void t.alert(r);var s=this;1<o.length?(r=t.Msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(o.length)).replace("%2",r),t.confirm(r,function(t){t&&n&&s.deleteVariableInternal(n,o)})):s.deleteVariableInternal(n,o)}else console.warn("Can't delete non-existent variable: "+e)},t.VariableMap.prototype.deleteVariableInternal=function(e,n){var i=t.Events.getGroup();i||t.Events.setGroup(!0);try{for(var r=0;r<n.length;r++)n[r].dispose(!0);this.deleteVariable(e)}finally{i||t.Events.setGroup(!1)}},t.VariableMap.prototype.getVariable=function(e,n){if(n=this.variableMap_[n||""])for(var i,r=0;i=n[r];r++)if(t.Names.equals(i.name,e))return i;return null},t.VariableMap.prototype.getVariableById=function(t){for(var e=Object.keys(this.variableMap_),n=0;n<e.length;n++)for(var i,r=e[n],o=0;i=this.variableMap_[r][o];o++)if(i.getId()==t)return i;return null},t.VariableMap.prototype.getVariablesOfType=function(t){return(t=this.variableMap_[t||""])?t.slice():[]},t.VariableMap.prototype.getVariableTypes=function(e){var n={};t.utils.object.mixin(n,this.variableMap_),e&&e.getPotentialVariableMap()&&t.utils.object.mixin(n,e.getPotentialVariableMap().variableMap_),e=Object.keys(n),n=!1;for(var i=0;i<e.length;i++)""==e[i]&&(n=!0);return n||e.push(""),e},t.VariableMap.prototype.getAllVariables=function(){var t,e=[];for(t in this.variableMap_)e=e.concat(this.variableMap_[t]);return e},t.VariableMap.prototype.getAllVariableNames=function(){var t,e=[];for(t in this.variableMap_)for(var n,i=this.variableMap_[t],r=0;n=i[r];r++)e.push(n.name);return e},t.VariableMap.prototype.getVariableUsesById=function(t){for(var e=[],n=this.workspace.getAllBlocks(!1),i=0;i<n.length;i++){var r=n[i].getVarModels();if(r)for(var o=0;o<r.length;o++)r[o].getId()==t&&e.push(n[i])}return e},t.Workspace=function(e){this.id=t.utils.genUid(),t.Workspace.WorkspaceDB_[this.id]=this,this.options=e||new t.Options({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(t.registry.getClassFromOptions(t.registry.Type.CONNECTION_CHECKER,this.options,!0))(this),this.topBlocks_=[],this.topComments_=[],this.commentDB_=Object.create(null),this.listeners_=[],this.undoStack_=[],this.redoStack_=[],this.blockDB_=Object.create(null),this.typedBlocksDB_=Object.create(null),this.variableMap_=new t.VariableMap(this),this.potentialVariableMap_=null},t.Workspace.prototype.rendered=!1,t.Workspace.prototype.isClearing=!1,t.Workspace.prototype.MAX_UNDO=1024,t.Workspace.prototype.connectionDBList=null,t.Workspace.prototype.dispose=function(){this.listeners_.length=0,this.clear(),delete t.Workspace.WorkspaceDB_[this.id]},t.Workspace.SCAN_ANGLE=3,t.Workspace.prototype.sortObjects_=function(e,n){return e=e.getRelativeToSurfaceXY(),n=n.getRelativeToSurfaceXY(),e.y+t.Workspace.prototype.sortObjects_.offset*e.x-(n.y+t.Workspace.prototype.sortObjects_.offset*n.x)},t.Workspace.prototype.addTopBlock=function(t){this.topBlocks_.push(t)},t.Workspace.prototype.removeTopBlock=function(e){if(!t.utils.arrayRemove(this.topBlocks_,e))throw Error("Block not present in workspace's list of top-most blocks.")},t.Workspace.prototype.getTopBlocks=function(e){var n=[].concat(this.topBlocks_);return e&&1<n.length&&(this.sortObjects_.offset=Math.sin(t.utils.math.toRadians(t.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),n.sort(this.sortObjects_)),n},t.Workspace.prototype.addTypedBlock=function(t){this.typedBlocksDB_[t.type]||(this.typedBlocksDB_[t.type]=[]),this.typedBlocksDB_[t.type].push(t)},t.Workspace.prototype.removeTypedBlock=function(t){this.typedBlocksDB_[t.type].splice(this.typedBlocksDB_[t.type].indexOf(t),1),this.typedBlocksDB_[t.type].length||delete this.typedBlocksDB_[t.type]},t.Workspace.prototype.getBlocksByType=function(e,n){return this.typedBlocksDB_[e]?(e=this.typedBlocksDB_[e].slice(0),n&&1<e.length&&(this.sortObjects_.offset=Math.sin(t.utils.math.toRadians(t.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),e.sort(this.sortObjects_)),e):[]},t.Workspace.prototype.addTopComment=function(t){this.topComments_.push(t),this.commentDB_[t.id]&&console.warn('Overriding an existing comment on this workspace, with id "'+t.id+'"'),this.commentDB_[t.id]=t},t.Workspace.prototype.removeTopComment=function(e){if(!t.utils.arrayRemove(this.topComments_,e))throw Error("Comment not present in workspace's list of top-most comments.");delete this.commentDB_[e.id]},t.Workspace.prototype.getTopComments=function(e){var n=[].concat(this.topComments_);return e&&1<n.length&&(this.sortObjects_.offset=Math.sin(t.utils.math.toRadians(t.Workspace.SCAN_ANGLE)),this.RTL&&(this.sortObjects_.offset*=-1),n.sort(this.sortObjects_)),n},t.Workspace.prototype.getAllBlocks=function(t){if(t){t=this.getTopBlocks(!0);for(var e=[],n=0;n<t.length;n++)e.push.apply(e,t[n].getDescendants(!0))}else for(e=this.getTopBlocks(!1),n=0;n<e.length;n++)e.push.apply(e,e[n].getChildren(!1));return e.filter(function(t){return!t.isInsertionMarker()})},t.Workspace.prototype.clear=function(){this.isClearing=!0;try{var e=t.Events.getGroup();for(e||t.Events.setGroup(!0);this.topBlocks_.length;)this.topBlocks_[0].dispose(!1);for(;this.topComments_.length;)this.topComments_[this.topComments_.length-1].dispose(!1);e||t.Events.setGroup(!1),this.variableMap_.clear(),this.potentialVariableMap_&&this.potentialVariableMap_.clear()}finally{this.isClearing=!1}},t.Workspace.prototype.renameVariableById=function(t,e){this.variableMap_.renameVariableById(t,e)},t.Workspace.prototype.createVariable=function(t,e,n){return this.variableMap_.createVariable(t,e,n)},t.Workspace.prototype.getVariableUsesById=function(t){return this.variableMap_.getVariableUsesById(t)},t.Workspace.prototype.deleteVariableById=function(t){this.variableMap_.deleteVariableById(t)},t.Workspace.prototype.getVariable=function(t,e){return this.variableMap_.getVariable(t,e)},t.Workspace.prototype.getVariableById=function(t){return this.variableMap_.getVariableById(t)},t.Workspace.prototype.getVariablesOfType=function(t){return this.variableMap_.getVariablesOfType(t)},t.Workspace.prototype.getVariableTypes=function(){return this.variableMap_.getVariableTypes(this)},t.Workspace.prototype.getAllVariables=function(){return this.variableMap_.getAllVariables()},t.Workspace.prototype.getAllVariableNames=function(){return this.variableMap_.getAllVariableNames()},t.Workspace.prototype.getWidth=function(){return 0},t.Workspace.prototype.newBlock=function(e,n){return new t.Block(this,e,n)},t.Workspace.prototype.remainingCapacity=function(){return isNaN(this.options.maxBlocks)?1/0:this.options.maxBlocks-this.getAllBlocks(!1).length},t.Workspace.prototype.remainingCapacityOfType=function(t){return this.options.maxInstances?(void 0!==this.options.maxInstances[t]?this.options.maxInstances[t]:1/0)-this.getBlocksByType(t,!1).length:1/0},t.Workspace.prototype.isCapacityAvailable=function(t){if(!this.hasBlockLimits())return!0;var e,n=0;for(e in t){if(t[e]>this.remainingCapacityOfType(e))return!1;n+=t[e]}return!(n>this.remainingCapacity())},t.Workspace.prototype.hasBlockLimits=function(){return 1/0!=this.options.maxBlocks||!!this.options.maxInstances},t.Workspace.prototype.getUndoStack=function(){return this.undoStack_},t.Workspace.prototype.getRedoStack=function(){return this.redoStack_},t.Workspace.prototype.undo=function(e){var n=e?this.redoStack_:this.undoStack_,i=e?this.undoStack_:this.redoStack_,r=n.pop();if(r){for(var o=[r];n.length&&r.group&&r.group==n[n.length-1].group;)o.push(n.pop());for(n=0;r=o[n];n++)i.push(r);o=t.Events.filter(o,e),t.Events.recordUndo=!1;try{for(n=0;r=o[n];n++)r.run(e)}finally{t.Events.recordUndo=!0}}},t.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0,this.redoStack_.length=0,t.Events.clearPendingUndo()},t.Workspace.prototype.addChangeListener=function(t){return this.listeners_.push(t),t},t.Workspace.prototype.removeChangeListener=function(e){t.utils.arrayRemove(this.listeners_,e)},t.Workspace.prototype.fireChangeListener=function(t){if(t.recordUndo)for(this.undoStack_.push(t),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var e,n=0;e=this.listeners_[n];n++)e(t)},t.Workspace.prototype.getBlockById=function(t){return this.blockDB_[t]||null},t.Workspace.prototype.setBlockById=function(t,e){this.blockDB_[t]=e},t.Workspace.prototype.removeBlockById=function(t){delete this.blockDB_[t]},t.Workspace.prototype.getCommentById=function(t){return this.commentDB_[t]||null},t.Workspace.prototype.allInputsFilled=function(t){for(var e,n=this.getTopBlocks(!1),i=0;e=n[i];i++)if(!e.allInputsFilled(t))return!1;return!0},t.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_},t.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new t.VariableMap(this)},t.Workspace.prototype.getVariableMap=function(){return this.variableMap_},t.Workspace.prototype.setVariableMap=function(t){this.variableMap_=t},t.Workspace.WorkspaceDB_=Object.create(null),t.Workspace.getById=function(e){return t.Workspace.WorkspaceDB_[e]||null},t.Workspace.getAll=function(){var e,n=[];for(e in t.Workspace.WorkspaceDB_)n.push(t.Workspace.WorkspaceDB_[e]);return n},t.WorkspaceDragSurfaceSvg=function(t){this.container_=t,this.createDom()},t.WorkspaceDragSurfaceSvg.prototype.SVG_=null,t.WorkspaceDragSurfaceSvg.prototype.container_=null,t.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",class:"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))},t.WorkspaceDragSurfaceSvg.prototype.translateSurface=function(e,n){e=e.toFixed(0),n=n.toFixed(0),this.SVG_.style.display="block",t.utils.dom.setCssTransform(this.SVG_,"translate3d("+e+"px, "+n+"px, 0px)")},t.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return t.utils.getRelativeXY(this.SVG_)},t.WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(e){if(!e)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var n=this.SVG_.childNodes[0],i=this.SVG_.childNodes[1];if(!(n&&i&&t.utils.dom.hasClass(n,"blocklyBlockCanvas")&&t.utils.dom.hasClass(i,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");if(null!=this.previousSibling_?t.utils.dom.insertAfter(n,this.previousSibling_):e.insertBefore(n,e.firstChild),t.utils.dom.insertAfter(i,n),this.SVG_.style.display="none",this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");t.utils.dom.setCssTransform(this.SVG_,""),this.previousSibling_=null},t.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(t,e,n,i,r,o){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=n,t.setAttribute("transform","translate(0, 0) scale("+o+")"),e.setAttribute("transform","translate(0, 0) scale("+o+")"),this.SVG_.setAttribute("width",i),this.SVG_.setAttribute("height",r),this.SVG_.appendChild(t),this.SVG_.appendChild(e),this.SVG_.style.display="block"},t.blockRendering={},t.blockRendering.useDebugger=!1,t.blockRendering.register=function(e,n){t.registry.register(t.registry.Type.RENDERER,e,n)},t.blockRendering.unregister=function(e){t.registry.unregister(t.registry.Type.RENDERER,e)},t.blockRendering.startDebugger=function(){t.blockRendering.useDebugger=!0},t.blockRendering.stopDebugger=function(){t.blockRendering.useDebugger=!1},t.blockRendering.init=function(e,n,i){return(e=new(t.registry.getClass(t.registry.Type.RENDERER,e))(e)).init(n,i),e},t.ASTNode=function(e,n,i){if(!n)throw Error("Cannot create a node without a location.");this.type_=e,this.isConnection_=t.ASTNode.isConnectionType_(e),this.location_=n,this.wsCoordinate_=null,this.processParams_(i||null)},t.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"},t.ASTNode.NAVIGATE_ALL_FIELDS=!1,t.ASTNode.DEFAULT_OFFSET_Y=-20,t.ASTNode.isConnectionType_=function(e){switch(e){case t.ASTNode.types.PREVIOUS:case t.ASTNode.types.NEXT:case t.ASTNode.types.INPUT:case t.ASTNode.types.OUTPUT:return!0}return!1},t.ASTNode.createFieldNode=function(e){return e?new t.ASTNode(t.ASTNode.types.FIELD,e):null},t.ASTNode.createConnectionNode=function(e){if(!e)return null;var n=e.type;return n==t.connectionTypes.INPUT_VALUE||n==t.connectionTypes.NEXT_STATEMENT&&e.getParentInput()?t.ASTNode.createInputNode(e.getParentInput()):n==t.connectionTypes.NEXT_STATEMENT?new t.ASTNode(t.ASTNode.types.NEXT,e):n==t.connectionTypes.OUTPUT_VALUE?new t.ASTNode(t.ASTNode.types.OUTPUT,e):n==t.connectionTypes.PREVIOUS_STATEMENT?new t.ASTNode(t.ASTNode.types.PREVIOUS,e):null},t.ASTNode.createInputNode=function(e){return e&&e.connection?new t.ASTNode(t.ASTNode.types.INPUT,e.connection):null},t.ASTNode.createBlockNode=function(e){return e?new t.ASTNode(t.ASTNode.types.BLOCK,e):null},t.ASTNode.createStackNode=function(e){return e?new t.ASTNode(t.ASTNode.types.STACK,e):null},t.ASTNode.createWorkspaceNode=function(e,n){return n&&e?new t.ASTNode(t.ASTNode.types.WORKSPACE,e,{wsCoordinate:n}):null},t.ASTNode.createTopNode=function(e){var n=e.previousConnection||e.outputConnection;return n?t.ASTNode.createConnectionNode(n):t.ASTNode.createBlockNode(e)},t.ASTNode.prototype.processParams_=function(t){t&&t.wsCoordinate&&(this.wsCoordinate_=t.wsCoordinate)},t.ASTNode.prototype.getLocation=function(){return this.location_},t.ASTNode.prototype.getType=function(){return this.type_},t.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_},t.ASTNode.prototype.isConnection=function(){return this.isConnection_},t.ASTNode.prototype.findNextForInput_=function(){var e,n=this.location_.getParentInput(),i=n.getSourceBlock();for(n=i.inputList.indexOf(n)+1;e=i.inputList[n];n++){for(var r,o=e.fieldRow,s=0;r=o[s];s++)if(r.isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(r);if(e.connection)return t.ASTNode.createInputNode(e)}return null},t.ASTNode.prototype.findNextForField_=function(){var e=this.location_,n=e.getParentInput(),i=e.getSourceBlock(),r=i.inputList.indexOf(n);for(e=n.fieldRow.indexOf(e)+1;n=i.inputList[r];r++){for(var o=n.fieldRow;e<o.length;){if(o[e].isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(o[e]);e++}if(e=0,n.connection)return t.ASTNode.createInputNode(n)}return null},t.ASTNode.prototype.findPrevForInput_=function(){for(var e,n=this.location_.getParentInput(),i=n.getSourceBlock(),r=i.inputList.indexOf(n);e=i.inputList[r];r--){if(e.connection&&e!==n)return t.ASTNode.createInputNode(e);for(var o,s=(e=e.fieldRow).length-1;o=e[s];s--)if(o.isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(o)}return null},t.ASTNode.prototype.findPrevForField_=function(){var e,n=this.location_,i=n.getParentInput(),r=n.getSourceBlock(),o=r.inputList.indexOf(i);for(n=i.fieldRow.indexOf(n)-1;e=r.inputList[o];o--){if(e.connection&&e!==i)return t.ASTNode.createInputNode(e);for(e=e.fieldRow;-1<n;){if(e[n].isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(e[n]);n--}0<=o-1&&(n=r.inputList[o-1].fieldRow.length-1)}return null},t.ASTNode.prototype.navigateBetweenStacks_=function(e){var n=this.getLocation();if(n instanceof t.Block||(n=n.getSourceBlock()),!n||!n.workspace)return null;var i=n.getRootBlock();n=i.workspace.getTopBlocks(!0);for(var r,o=0;r=n[o];o++)if(i.id==r.id)return-1==(e=o+(e?1:-1))||e==n.length?null:t.ASTNode.createStackNode(n[e]);throw Error("Couldn't find "+(e?"next":"previous")+" stack?!")},t.ASTNode.prototype.findTopASTNodeForBlock_=function(e){var n=e.previousConnection||e.outputConnection;return n?t.ASTNode.createConnectionNode(n):t.ASTNode.createBlockNode(e)},t.ASTNode.prototype.getOutAstNodeForBlock_=function(e){if(!e)return null;var n=(e=e.getTopStackBlock()).previousConnection||e.outputConnection;return n&&n.targetConnection&&n.targetConnection.getParentInput()?t.ASTNode.createInputNode(n.targetConnection.getParentInput()):t.ASTNode.createStackNode(e)},t.ASTNode.prototype.findFirstFieldOrInput_=function(e){e=e.inputList;for(var n,i=0;n=e[i];i++){for(var r,o=n.fieldRow,s=0;r=o[s];s++)if(r.isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(r);if(n.connection)return t.ASTNode.createInputNode(n)}return null},t.ASTNode.prototype.getSourceBlock=function(){return this.getType()===t.ASTNode.types.BLOCK?this.getLocation():this.getType()===t.ASTNode.types.STACK?this.getLocation():this.getType()===t.ASTNode.types.WORKSPACE?null:this.getLocation().getSourceBlock()},t.ASTNode.prototype.next=function(){switch(this.type_){case t.ASTNode.types.STACK:return this.navigateBetweenStacks_(!0);case t.ASTNode.types.OUTPUT:var e=this.location_;return t.ASTNode.createBlockNode(e.getSourceBlock());case t.ASTNode.types.FIELD:return this.findNextForField_();case t.ASTNode.types.INPUT:return this.findNextForInput_();case t.ASTNode.types.BLOCK:return t.ASTNode.createConnectionNode(this.location_.nextConnection);case t.ASTNode.types.PREVIOUS:return e=this.location_,t.ASTNode.createBlockNode(e.getSourceBlock());case t.ASTNode.types.NEXT:return e=this.location_,t.ASTNode.createConnectionNode(e.targetConnection)}return null},t.ASTNode.prototype.in=function(){switch(this.type_){case t.ASTNode.types.WORKSPACE:var e=this.location_.getTopBlocks(!0);if(0<e.length)return t.ASTNode.createStackNode(e[0]);break;case t.ASTNode.types.STACK:return e=this.location_,this.findTopASTNodeForBlock_(e);case t.ASTNode.types.BLOCK:return e=this.location_,this.findFirstFieldOrInput_(e);case t.ASTNode.types.INPUT:return t.ASTNode.createConnectionNode(this.location_.targetConnection)}return null},t.ASTNode.prototype.prev=function(){switch(this.type_){case t.ASTNode.types.STACK:return this.navigateBetweenStacks_(!1);case t.ASTNode.types.FIELD:return this.findPrevForField_();case t.ASTNode.types.INPUT:return this.findPrevForInput_();case t.ASTNode.types.BLOCK:var e=this.location_;return t.ASTNode.createConnectionNode(e.previousConnection||e.outputConnection);case t.ASTNode.types.PREVIOUS:if((e=(e=this.location_).targetConnection)&&!e.getParentInput())return t.ASTNode.createConnectionNode(e);break;case t.ASTNode.types.NEXT:return e=this.location_,t.ASTNode.createBlockNode(e.getSourceBlock())}return null},t.ASTNode.prototype.out=function(){switch(this.type_){case t.ASTNode.types.STACK:var e=this.location_,n=e.getRelativeToSurfaceXY();return n=new t.utils.Coordinate(n.x,n.y+t.ASTNode.DEFAULT_OFFSET_Y),t.ASTNode.createWorkspaceNode(e.workspace,n);case t.ASTNode.types.OUTPUT:return(n=(e=this.location_).targetConnection)?t.ASTNode.createConnectionNode(n):t.ASTNode.createStackNode(e.getSourceBlock());case t.ASTNode.types.FIELD:return t.ASTNode.createBlockNode(this.location_.getSourceBlock());case t.ASTNode.types.INPUT:return e=this.location_,t.ASTNode.createBlockNode(e.getSourceBlock());case t.ASTNode.types.BLOCK:return e=this.location_,this.getOutAstNodeForBlock_(e);case t.ASTNode.types.PREVIOUS:case t.ASTNode.types.NEXT:return e=this.location_,this.getOutAstNodeForBlock_(e.getSourceBlock())}return null},t.Blocks=Object.create(null),t.Extensions={},t.Extensions.ALL_=Object.create(null),t.Extensions.register=function(e,n){if("string"!=typeof e||""==e.trim())throw Error('Error: Invalid extension name "'+e+'"');if(t.Extensions.ALL_[e])throw Error('Error: Extension "'+e+'" is already registered.');if("function"!=typeof n)throw Error('Error: Extension "'+e+'" must be a function');t.Extensions.ALL_[e]=n},t.Extensions.registerMixin=function(e,n){if(!n||"object"!=typeof n)throw Error('Error: Mixin "'+e+'" must be a object');t.Extensions.register(e,function(){this.mixin(n)})},t.Extensions.registerMutator=function(e,n,i,r){var o='Error when registering mutator "'+e+'": ';t.Extensions.checkHasFunction_(o,n.domToMutation,"domToMutation"),t.Extensions.checkHasFunction_(o,n.mutationToDom,"mutationToDom");var s=t.Extensions.checkMutatorDialog_(n,o);if(i&&"function"!=typeof i)throw Error('Extension "'+e+'" is not a function');t.Extensions.register(e,function(){if(s){if(!t.Mutator)throw Error(o+"Missing require for Blockly.Mutator");this.setMutator(new t.Mutator(r||[]))}this.mixin(n),i&&i.apply(this)})},t.Extensions.unregister=function(e){t.Extensions.ALL_[e]?delete t.Extensions.ALL_[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},t.Extensions.apply=function(e,n,i){var r=t.Extensions.ALL_[e];if("function"!=typeof r)throw Error('Error: Extension "'+e+'" not found.');if(i)t.Extensions.checkNoMutatorProperties_(e,n);else var o=t.Extensions.getMutatorProperties_(n);if(r.apply(n),i)t.Extensions.checkBlockHasMutatorProperties_('Error after applying mutator "'+e+'": ',n);else if(!t.Extensions.mutatorPropertiesMatch_(o,n))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},t.Extensions.checkHasFunction_=function(t,e,n){if(!e)throw Error(t+'missing required property "'+n+'"');if("function"!=typeof e)throw Error(t+'" required property "'+n+'" must be a function')},t.Extensions.checkNoMutatorProperties_=function(e,n){if(t.Extensions.getMutatorProperties_(n).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+n.id)},t.Extensions.checkMutatorDialog_=function(t,e){var n=void 0!==t.compose,i=void 0!==t.decompose;if(n&&i){if("function"!=typeof t.compose)throw Error(e+"compose must be a function.");if("function"!=typeof t.decompose)throw Error(e+"decompose must be a function.");return!0}if(!n&&!i)return!1;throw Error(e+'Must have both or neither of "compose" and "decompose"')},t.Extensions.checkBlockHasMutatorProperties_=function(e,n){if("function"!=typeof n.domToMutation)throw Error(e+'Applying a mutator didn\'t add "domToMutation"');if("function"!=typeof n.mutationToDom)throw Error(e+'Applying a mutator didn\'t add "mutationToDom"');t.Extensions.checkMutatorDialog_(n,e)},t.Extensions.getMutatorProperties_=function(t){var e=[];return void 0!==t.domToMutation&&e.push(t.domToMutation),void 0!==t.mutationToDom&&e.push(t.mutationToDom),void 0!==t.compose&&e.push(t.compose),void 0!==t.decompose&&e.push(t.decompose),e},t.Extensions.mutatorPropertiesMatch_=function(e,n){if((n=t.Extensions.getMutatorProperties_(n)).length!=e.length)return!1;for(var i=0;i<n.length;i++)if(e[i]!=n[i])return!1;return!0},t.Extensions.buildTooltipForDropdown=function(e,n){var i=[];return"object"==typeof document&&t.utils.runAfterPageLoad(function(){for(var e in n)t.utils.checkMessageReferences(n[e])}),function(){this.type&&-1==i.indexOf(this.type)&&(t.Extensions.checkDropdownOptionsInTable_(this,e,n),i.push(this.type)),this.setTooltip(function(){var r=String(this.getFieldValue(e)),o=n[r];return null==o?-1==i.indexOf(this.type)&&(r="No tooltip mapping for value "+r+" of field "+e,null!=this.type&&(r+=" of block type "+this.type),console.warn(r+".")):o=t.utils.replaceMessageReferences(o),o}.bind(this))}},t.Extensions.checkDropdownOptionsInTable_=function(t,e,n){var i=t.getField(e);if(!i.isOptionListDynamic()){i=i.getOptions();for(var r=0;r<i.length;++r){var o=i[r][1];null==n[o]&&console.warn("No tooltip mapping for value "+o+" of field "+e+" of block type "+t.type)}}},t.Extensions.buildTooltipWithFieldText=function(e,n){return"object"==typeof document&&t.utils.runAfterPageLoad(function(){t.utils.checkMessageReferences(e)}),function(){this.setTooltip(function(){var i=this.getField(n);return t.utils.replaceMessageReferences(e).replace("%1",i?i.getText():"")}.bind(this))}},t.Extensions.extensionParentTooltip_=function(){this.tooltipWhenNotConnected_=this.tooltip,this.setTooltip(function(){var t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||this.tooltipWhenNotConnected_}.bind(this))},t.Extensions.register("parent_tooltip_when_inline",t.Extensions.extensionParentTooltip_),t.fieldRegistry={},t.fieldRegistry.register=function(e,n){t.registry.register(t.registry.Type.FIELD,e,n)},t.fieldRegistry.unregister=function(e){t.registry.unregister(t.registry.Type.FIELD,e)},t.fieldRegistry.fromJson=function(e){var n=t.registry.getObject(t.registry.Type.FIELD,e.type);return n?n.fromJson(e):(console.warn("Blockly could not create a field of type "+e.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)},t.IDeletable=function(){},t.blockAnimations={},t.blockAnimations.disconnectPid_=0,t.blockAnimations.disconnectGroup_=null,t.blockAnimations.disposeUiEffect=function(e){var n=e.workspace,i=e.getSvgRoot();n.getAudioManager().play("delete"),e=n.getSvgXY(i),(i=i.cloneNode(!0)).translateX_=e.x,i.translateY_=e.y,i.setAttribute("transform","translate("+e.x+","+e.y+")"),n.getParentSvg().appendChild(i),i.bBox_=i.getBBox(),t.blockAnimations.disposeUiStep_(i,n.RTL,new Date,n.scale)},t.blockAnimations.disposeUiStep_=function(e,n,i,r){var o=(new Date-i)/150;1<o?t.utils.dom.removeNode(e):(e.setAttribute("transform","translate("+(e.translateX_+(n?-1:1)*e.bBox_.width*r/2*o)+","+(e.translateY_+e.bBox_.height*r*o)+") scale("+(1-o)*r+")"),setTimeout(t.blockAnimations.disposeUiStep_,10,e,n,i,r))},t.blockAnimations.connectionUiEffect=function(e){var n=e.workspace,i=n.scale;if(n.getAudioManager().play("click"),!(1>i)){var r=n.getSvgXY(e.getSvgRoot());e.outputConnection?(r.x+=(e.RTL?3:-3)*i,r.y+=13*i):e.previousConnection&&(r.x+=(e.RTL?-23:23)*i,r.y+=3*i),e=t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{cx:r.x,cy:r.y,r:0,fill:"none",stroke:"#888","stroke-width":10},n.getParentSvg()),t.blockAnimations.connectionUiStep_(e,new Date,i)}},t.blockAnimations.connectionUiStep_=function(e,n,i){var r=(new Date-n)/150;1<r?t.utils.dom.removeNode(e):(e.setAttribute("r",25*r*i),e.style.opacity=1-r,t.blockAnimations.disconnectPid_=setTimeout(t.blockAnimations.connectionUiStep_,10,e,n,i))},t.blockAnimations.disconnectUiEffect=function(e){if(e.workspace.getAudioManager().play("disconnect"),!(1>e.workspace.scale)){var n=e.getHeightWidth().height;n=Math.atan(10/n)/Math.PI*180,e.RTL||(n*=-1),t.blockAnimations.disconnectUiStep_(e.getSvgRoot(),n,new Date)}},t.blockAnimations.disconnectUiStep_=function(e,n,i){var r=(new Date-i)/200;1<r?e.skew_="":(e.skew_="skewX("+Math.round(Math.sin(r*Math.PI*3)*(1-r)*n)+")",t.blockAnimations.disconnectGroup_=e,t.blockAnimations.disconnectPid_=setTimeout(t.blockAnimations.disconnectUiStep_,10,e,n,i)),e.setAttribute("transform",e.translate_+e.skew_)},t.blockAnimations.disconnectUiStop=function(){if(t.blockAnimations.disconnectGroup_){clearTimeout(t.blockAnimations.disconnectPid_);var e=t.blockAnimations.disconnectGroup_;e.skew_="",e.setAttribute("transform",e.translate_),t.blockAnimations.disconnectGroup_=null}},t.Events.BlockDrag=function(e,n,i){t.Events.BlockDrag.superClass_.constructor.call(this,e?e.workspace.id:void 0),this.blockId=e?e.id:null,this.isStart=n,this.blocks=i},t.utils.object.inherits(t.Events.BlockDrag,t.Events.UiBase),t.Events.BlockDrag.prototype.type=t.Events.BLOCK_DRAG,t.Events.BlockDrag.prototype.toJson=function(){var e=t.Events.BlockDrag.superClass_.toJson.call(this);return e.isStart=this.isStart,e.blockId=this.blockId,e.blocks=this.blocks,e},t.Events.BlockDrag.prototype.fromJson=function(e){t.Events.BlockDrag.superClass_.fromJson.call(this,e),this.isStart=e.isStart,this.blockId=e.blockId,this.blocks=e.blocks},t.registry.register(t.registry.Type.EVENT,t.Events.BLOCK_DRAG,t.Events.BlockDrag),t.IBlockDragger=function(){},t.InsertionMarkerManager=function(e){this.topBlock_=t.selected=e,this.workspace_=e.workspace,this.lastMarker_=this.lastOnStack_=null,this.firstMarker_=this.createMarkerBlock_(this.topBlock_),this.localConnection_=this.closestConnection_=null,this.wouldDeleteBlock_=!1,this.fadedBlock_=this.highlightedBlock_=this.markerConnection_=null,this.availableConnections_=this.initAvailableConnections_()},t.InsertionMarkerManager.PREVIEW_TYPE={INSERTION_MARKER:0,INPUT_OUTLINE:1,REPLACEMENT_FADE:2},t.InsertionMarkerManager.DUPLICATE_BLOCK_ERROR="The insertion marker manager tried to create a marker but the result is missing %1. If you are using a mutator, make sure your domToMutation method is properly defined.",t.InsertionMarkerManager.prototype.dispose=function(){this.availableConnections_.length=0,t.Events.disable();try{this.firstMarker_&&this.firstMarker_.dispose(),this.lastMarker_&&this.lastMarker_.dispose()}finally{t.Events.enable()}},t.InsertionMarkerManager.prototype.updateAvailableConnections=function(){this.availableConnections_=this.initAvailableConnections_()},t.InsertionMarkerManager.prototype.wouldDeleteBlock=function(){return this.wouldDeleteBlock_},t.InsertionMarkerManager.prototype.wouldConnectBlock=function(){return!!this.closestConnection_},t.InsertionMarkerManager.prototype.applyConnections=function(){if(this.closestConnection_&&(t.Events.disable(),this.hidePreview_(),t.Events.enable(),this.localConnection_.connect(this.closestConnection_),this.topBlock_.rendered)){var e=this.localConnection_.isSuperior()?this.closestConnection_:this.localConnection_;t.blockAnimations.connectionUiEffect(e.getSourceBlock()),this.topBlock_.getRootBlock().bringToFront()}},t.InsertionMarkerManager.prototype.update=function(e,n){var i=this.getCandidate_(e);((this.wouldDeleteBlock_=this.shouldDelete_(i,n))||this.shouldUpdatePreviews_(i,e))&&(t.Events.disable(),this.maybeHidePreview_(i),this.maybeShowPreview_(i),t.Events.enable())},t.InsertionMarkerManager.prototype.createMarkerBlock_=function(e){var n=e.type;t.Events.disable();try{var i=this.workspace_.newBlock(n);if(i.setInsertionMarker(!0),e.mutationToDom){var r=e.mutationToDom();r&&i.domToMutation(r)}for(n=0;n<e.inputList.length;n++){var o=e.inputList[n];if(o.name!=t.constants.COLLAPSED_INPUT_NAME){var s=i.inputList[n];if(!s)throw Error(t.InsertionMarkerManager.DUPLICATE_BLOCK_ERROR.replace("%1","an input"));for(r=0;r<o.fieldRow.length;r++){var a=o.fieldRow[r],l=s.fieldRow[r];if(!l)throw Error(t.InsertionMarkerManager.DUPLICATE_BLOCK_ERROR.replace("%1","a field"));l.setValue(a.getValue())}}}i.setCollapsed(e.isCollapsed()),i.setInputsInline(e.getInputsInline()),i.initSvg(),i.getSvgRoot().setAttribute("visibility","hidden")}finally{t.Events.enable()}return i},t.InsertionMarkerManager.prototype.initAvailableConnections_=function(){var e=this.topBlock_.getConnections_(!1),n=this.topBlock_.lastConnectionInStack(!0);if(n&&n!=this.topBlock_.nextConnection){if(e.push(n),this.lastOnStack_=n,this.lastMarker_){t.Events.disable();try{this.lastMarker_.dispose()}finally{t.Events.enable()}}this.lastMarker_=this.createMarkerBlock_(n.getSourceBlock())}return e},t.InsertionMarkerManager.prototype.shouldUpdatePreviews_=function(e,n){var i=e.local,r=e.closest;return e=e.radius,i&&r?this.localConnection_&&this.closestConnection_?(this.closestConnection_!=r||this.localConnection_!=i)&&(i=this.localConnection_.x+n.x-this.closestConnection_.x,n=this.localConnection_.y+n.y-this.closestConnection_.y,n=Math.sqrt(i*i+n*n),!(r&&e>n-t.CURRENT_CONNECTION_PREFERENCE)):!this.localConnection_&&!this.closestConnection_||(console.error("Only one of localConnection_ and closestConnection_ was set."),console.error("Returning true from shouldUpdatePreviews, but it's not clear why."),!0):!(!this.localConnection_||!this.closestConnection_)},t.InsertionMarkerManager.prototype.getCandidate_=function(t){for(var e=this.getStartRadius_(),n=null,i=null,r=0;r<this.availableConnections_.length;r++){var o=this.availableConnections_[r],s=o.closest(e,t);s.connection&&(n=s.connection,i=o,e=s.radius)}return{closest:n,local:i,radius:e}},t.InsertionMarkerManager.prototype.getStartRadius_=function(){return this.closestConnection_&&this.localConnection_?t.CONNECTING_SNAP_RADIUS:t.SNAP_RADIUS},t.InsertionMarkerManager.prototype.shouldDelete_=function(e,n){return!(!n||!this.workspace_.getComponentManager().hasCapability(n.id,t.ComponentManager.Capability.DELETE_AREA))&&n.wouldDelete(this.topBlock_,e&&!!e.closest)},t.InsertionMarkerManager.prototype.maybeShowPreview_=function(t){if(!this.wouldDeleteBlock_){var e=t.closest;t=t.local,e&&(e==this.closestConnection_||e.getSourceBlock().isInsertionMarker()?console.log("Trying to connect to an insertion marker"):(this.closestConnection_=e,this.localConnection_=t,this.showPreview_()))}},t.InsertionMarkerManager.prototype.showPreview_=function(){var e=this.closestConnection_,n=this.workspace_.getRenderer();switch(n.getConnectionPreviewMethod(e,this.localConnection_,this.topBlock_)){case t.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE:this.showInsertionInputOutline_();break;case t.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER:this.showInsertionMarker_();break;case t.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:this.showReplacementFade_()}e&&n.shouldHighlightConnection(e)&&e.highlight()},t.InsertionMarkerManager.prototype.maybeHidePreview_=function(t){if(t.closest){var e=this.closestConnection_!=t.closest;t=this.localConnection_!=t.local,this.closestConnection_&&this.localConnection_&&(e||t||this.wouldDeleteBlock_)&&this.hidePreview_()}else this.hidePreview_();this.localConnection_=this.closestConnection_=this.markerConnection_=null},t.InsertionMarkerManager.prototype.hidePreview_=function(){this.closestConnection_&&this.closestConnection_.targetBlock()&&this.workspace_.getRenderer().shouldHighlightConnection(this.closestConnection_)&&this.closestConnection_.unhighlight(),this.fadedBlock_?this.hideReplacementFade_():this.highlightedBlock_?this.hideInsertionInputOutline_():this.markerConnection_&&this.hideInsertionMarker_()},t.InsertionMarkerManager.prototype.showInsertionMarker_=function(){var t=this.localConnection_,e=this.closestConnection_,n=this.lastOnStack_&&t==this.lastOnStack_?this.lastMarker_:this.firstMarker_;if((t=n.getMatchingConnection(t.getSourceBlock(),t))==this.markerConnection_)throw Error("Made it to showInsertionMarker_ even though the marker isn't changing");n.render(),n.rendered=!0,n.getSvgRoot().setAttribute("visibility","visible"),t&&e&&n.positionNearConnection(t,e),e&&t.connect(e),this.markerConnection_=t},t.InsertionMarkerManager.prototype.hideInsertionMarker_=function(){if(this.markerConnection_){var e=this.markerConnection_,n=e.getSourceBlock(),i=n.nextConnection,r=n.previousConnection,o=n.outputConnection;if(o=e.type==t.connectionTypes.INPUT_VALUE&&!(o&&o.targetConnection),!(e!=i||r&&r.targetConnection)||o?e.targetBlock().unplug(!1):e.type==t.connectionTypes.NEXT_STATEMENT&&e!=i?((i=e.targetConnection).getSourceBlock().unplug(!1),r=r?r.targetConnection:null,n.unplug(!0),r&&r.connect(i)):n.unplug(!0),e.targetConnection)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");this.markerConnection_=null,(e=n.getSvgRoot())&&e.setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")},t.InsertionMarkerManager.prototype.showInsertionInputOutline_=function(){var t=this.closestConnection_;this.highlightedBlock_=t.getSourceBlock(),this.highlightedBlock_.highlightShapeForInput(t,!0)},t.InsertionMarkerManager.prototype.hideInsertionInputOutline_=function(){this.highlightedBlock_.highlightShapeForInput(this.closestConnection_,!1),this.highlightedBlock_=null},t.InsertionMarkerManager.prototype.showReplacementFade_=function(){this.fadedBlock_=this.closestConnection_.targetBlock(),this.fadedBlock_.fadeForReplacement(!0)},t.InsertionMarkerManager.prototype.hideReplacementFade_=function(){this.fadedBlock_.fadeForReplacement(!1),this.fadedBlock_=null},t.InsertionMarkerManager.prototype.getInsertionMarkers=function(){var t=[];return this.firstMarker_&&t.push(this.firstMarker_),this.lastMarker_&&t.push(this.lastMarker_),t},t.BlockDragger=function(e,n){this.draggingBlock_=e,this.workspace_=n,this.draggedConnectionManager_=new t.InsertionMarkerManager(this.draggingBlock_),this.dragTarget_=null,this.wouldDeleteBlock_=!1,this.startXY_=this.draggingBlock_.getRelativeToSurfaceXY(),this.dragIconData_=t.BlockDragger.initIconData_(e)},t.BlockDragger.prototype.dispose=function(){this.dragIconData_.length=0,this.draggedConnectionManager_&&this.draggedConnectionManager_.dispose()},t.BlockDragger.initIconData_=function(t){var e=[];t=t.getDescendants(!1);for(var n,i=0;n=t[i];i++){n=n.getIcons();for(var r=0;r<n.length;r++){var o={location:n[r].getIconLocation(),icon:n[r]};e.push(o)}}return e},t.BlockDragger.prototype.startDrag=function(e,n){t.Events.getGroup()||t.Events.setGroup(!0),this.fireDragStartEvent_(),this.workspace_.isMutator&&this.draggingBlock_.bringToFront(),t.utils.dom.startTextWidthCache(),this.workspace_.setResizesEnabled(!1),t.blockAnimations.disconnectUiStop(),this.shouldDisconnect_(n)&&this.disconnectBlock_(n,e),this.draggingBlock_.setDragging(!0),this.draggingBlock_.moveToDragSurface()},t.BlockDragger.prototype.shouldDisconnect_=function(t){return!!(this.draggingBlock_.getParent()||t&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())},t.BlockDragger.prototype.disconnectBlock_=function(e,n){this.draggingBlock_.unplug(e),e=this.pixelsToWorkspaceUnits_(n),e=t.utils.Coordinate.sum(this.startXY_,e),this.draggingBlock_.translate(e.x,e.y),t.blockAnimations.disconnectUiEffect(this.draggingBlock_),this.draggedConnectionManager_.updateAvailableConnections()},t.BlockDragger.prototype.fireDragStartEvent_=function(){var e=new(t.Events.get(t.Events.BLOCK_DRAG))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));t.Events.fire(e)},t.BlockDragger.prototype.drag=function(e,n){n=this.pixelsToWorkspaceUnits_(n);var i=t.utils.Coordinate.sum(this.startXY_,n);this.draggingBlock_.moveDuringDrag(i),this.dragIcons_(n),i=this.dragTarget_,this.dragTarget_=this.workspace_.getDragTarget(e),this.draggedConnectionManager_.update(n,this.dragTarget_),e=this.wouldDeleteBlock_,this.wouldDeleteBlock_=this.draggedConnectionManager_.wouldDeleteBlock(),e!=this.wouldDeleteBlock_&&this.updateCursorDuringBlockDrag_(),this.dragTarget_!==i&&(i&&i.onDragExit(this.draggingBlock_),this.dragTarget_&&this.dragTarget_.onDragEnter(this.draggingBlock_)),this.dragTarget_&&this.dragTarget_.onDragOver(this.draggingBlock_)},t.BlockDragger.prototype.endDrag=function(e,n){if(this.drag(e,n),this.dragIconData_=[],this.fireDragEndEvent_(),t.utils.dom.stopTextWidthCache(),t.blockAnimations.disconnectUiStop(),this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_))e=this.startXY_;else{var i=(e=this.getNewLocationAfterDrag_(n)).delta;e=e.newLocation}this.draggingBlock_.moveOffDragSurface(e),this.dragTarget_&&this.dragTarget_.onDrop(this.draggingBlock_),this.maybeDeleteBlock_()||(this.draggingBlock_.setDragging(!1),i?this.updateBlockAfterMove_(i):t.bumpObjectIntoBounds_(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)),this.workspace_.setResizesEnabled(!0),t.Events.setGroup(!1)},t.BlockDragger.prototype.getNewLocationAfterDrag_=function(e){var n={};return n.delta=this.pixelsToWorkspaceUnits_(e),n.newLocation=t.utils.Coordinate.sum(this.startXY_,n.delta),n},t.BlockDragger.prototype.maybeDeleteBlock_=function(){return!!this.wouldDeleteBlock_&&(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),t.draggingConnections=[],!0)},t.BlockDragger.prototype.updateBlockAfterMove_=function(t){this.draggingBlock_.moveConnections(t.x,t.y),this.fireMoveEvent_(),this.draggedConnectionManager_.wouldConnectBlock()?this.draggedConnectionManager_.applyConnections():this.draggingBlock_.render(),this.draggingBlock_.scheduleSnapAndBump()},t.BlockDragger.prototype.fireDragEndEvent_=function(){var e=new(t.Events.get(t.Events.BLOCK_DRAG))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));t.Events.fire(e)},t.BlockDragger.prototype.updateToolboxStyle_=function(t){var e=this.workspace_.getToolbox();if(e){var n=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";t&&"function"==typeof e.removeStyle?e.removeStyle(n):t||"function"!=typeof e.addStyle||e.addStyle(n)}},t.BlockDragger.prototype.fireMoveEvent_=function(){var e=new(t.Events.get(t.Events.BLOCK_MOVE))(this.draggingBlock_);e.oldCoordinate=this.startXY_,e.recordNew(),t.Events.fire(e)},t.BlockDragger.prototype.updateCursorDuringBlockDrag_=function(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)},t.BlockDragger.prototype.pixelsToWorkspaceUnits_=function(e){return e=new t.utils.Coordinate(e.x/this.workspace_.scale,e.y/this.workspace_.scale),this.workspace_.isMutator&&e.scale(1/this.workspace_.options.parentWorkspace.scale),e},t.BlockDragger.prototype.dragIcons_=function(e){for(var n=0;n<this.dragIconData_.length;n++){var i=this.dragIconData_[n];i.icon.setIconLocation(t.utils.Coordinate.sum(i.location,e))}},t.BlockDragger.prototype.getInsertionMarkers=function(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]},t.registry.register(t.registry.Type.BLOCK_DRAGGER,t.registry.DEFAULT,t.BlockDragger),t.IContextMenu=function(){},t.IDraggable=function(){},t.IBubble=function(){},t.Bubble=function(e,n,i,r,o,s){this.workspace_=e,this.content_=n,this.shape_=i,this.onMouseDownResizeWrapper_=this.onMouseDownBubbleWrapper_=this.moveCallback_=this.resizeCallback_=null,this.disposed=!1,i=t.Bubble.ARROW_ANGLE,this.workspace_.RTL&&(i=-i),this.arrow_radians_=t.utils.math.toRadians(i),e.getBubbleCanvas().appendChild(this.createDom_(n,!(!o||!s))),this.setAnchorLocation(r),o&&s||(o=(e=this.content_.getBBox()).width+2*t.Bubble.BORDER_WIDTH,s=e.height+2*t.Bubble.BORDER_WIDTH),this.setBubbleSize(o,s),this.positionBubble_(),this.renderArrow_(),this.rendered_=!0},t.Bubble.BORDER_WIDTH=6,t.Bubble.ARROW_THICKNESS=5,t.Bubble.ARROW_ANGLE=20,t.Bubble.ARROW_BEND=4,t.Bubble.ANCHOR_RADIUS=8,t.Bubble.onMouseUpWrapper_=null,t.Bubble.onMouseMoveWrapper_=null,t.Bubble.unbindDragEvents_=function(){t.Bubble.onMouseUpWrapper_&&(t.browserEvents.unbind(t.Bubble.onMouseUpWrapper_),t.Bubble.onMouseUpWrapper_=null),t.Bubble.onMouseMoveWrapper_&&(t.browserEvents.unbind(t.Bubble.onMouseMoveWrapper_),t.Bubble.onMouseMoveWrapper_=null)},t.Bubble.bubbleMouseUp_=function(e){t.Touch.clearTouchIdentifier(),t.Bubble.unbindDragEvents_()},t.Bubble.prototype.rendered_=!1,t.Bubble.prototype.anchorXY_=null,t.Bubble.prototype.relativeLeft_=0,t.Bubble.prototype.relativeTop_=0,t.Bubble.prototype.width_=0,t.Bubble.prototype.height_=0,t.Bubble.prototype.autoLayout_=!0,t.Bubble.prototype.createDom_=function(e,n){this.bubbleGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null);var i={filter:"url(#"+this.workspace_.getRenderer().getConstants().embossFilterId+")"};return t.utils.userAgent.JAVA_FX&&(i={}),i=t.utils.dom.createSvgElement(t.utils.Svg.G,i,this.bubbleGroup_),this.bubbleArrow_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{},i),this.bubbleBack_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyDraggable",x:0,y:0,rx:t.Bubble.BORDER_WIDTH,ry:t.Bubble.BORDER_WIDTH},i),n?(this.resizeGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:this.workspace_.RTL?"blocklyResizeSW":"blocklyResizeSE"},this.bubbleGroup_),n=2*t.Bubble.BORDER_WIDTH,t.utils.dom.createSvgElement(t.utils.Svg.POLYGON,{points:"0,x x,x x,0".replace(/x/g,n.toString())},this.resizeGroup_),t.utils.dom.createSvgElement(t.utils.Svg.LINE,{class:"blocklyResizeLine",x1:n/3,y1:n-1,x2:n-1,y2:n/3},this.resizeGroup_),t.utils.dom.createSvgElement(t.utils.Svg.LINE,{class:"blocklyResizeLine",x1:2*n/3,y1:n-1,x2:n-1,y2:2*n/3},this.resizeGroup_)):this.resizeGroup_=null,this.workspace_.options.readOnly||(this.onMouseDownBubbleWrapper_=t.browserEvents.conditionalBind(this.bubbleBack_,"mousedown",this,this.bubbleMouseDown_),this.resizeGroup_&&(this.onMouseDownResizeWrapper_=t.browserEvents.conditionalBind(this.resizeGroup_,"mousedown",this,this.resizeMouseDown_))),this.bubbleGroup_.appendChild(e),this.bubbleGroup_},t.Bubble.prototype.getSvgRoot=function(){return this.bubbleGroup_},t.Bubble.prototype.setSvgId=function(t){this.bubbleGroup_.dataset&&(this.bubbleGroup_.dataset.blockId=t)},t.Bubble.prototype.bubbleMouseDown_=function(t){var e=this.workspace_.getGesture(t);e&&e.handleBubbleStart(t,this)},t.Bubble.prototype.showContextMenu=function(t){},t.Bubble.prototype.isDeletable=function(){return!1},t.Bubble.prototype.setDeleteStyle=function(t){},t.Bubble.prototype.resizeMouseDown_=function(e){this.promote(),t.Bubble.unbindDragEvents_(),t.utils.isRightButton(e)||(this.workspace_.startDrag(e,new t.utils.Coordinate(this.workspace_.RTL?-this.width_:this.width_,this.height_)),t.Bubble.onMouseUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",this,t.Bubble.bubbleMouseUp_),t.Bubble.onMouseMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",this,this.resizeMouseMove_),t.hideChaff()),e.stopPropagation()},t.Bubble.prototype.resizeMouseMove_=function(t){this.autoLayout_=!1,t=this.workspace_.moveDrag(t),this.setBubbleSize(this.workspace_.RTL?-t.x:t.x,t.y),this.workspace_.RTL&&this.positionBubble_()},t.Bubble.prototype.registerResizeEvent=function(t){this.resizeCallback_=t},t.Bubble.prototype.registerMoveEvent=function(t){this.moveCallback_=t},t.Bubble.prototype.promote=function(){var t=this.bubbleGroup_.parentNode;return t.lastChild!==this.bubbleGroup_&&(t.appendChild(this.bubbleGroup_),!0)},t.Bubble.prototype.setAnchorLocation=function(t){this.anchorXY_=t,this.rendered_&&this.positionBubble_()},t.Bubble.prototype.layoutBubble_=function(){var t=this.workspace_.getMetricsManager().getViewMetrics(!0),e=this.getOptimalRelativeLeft_(t),n=this.getOptimalRelativeTop_(t),i=this.shape_.getBBox(),r={x:e,y:-this.height_-this.workspace_.getRenderer().getConstants().MIN_BLOCK_HEIGHT},o={x:-this.width_-30,y:n};n={x:i.width,y:n};var s={x:e,y:i.height};e=i.width<i.height?n:s,i=i.width<i.height?s:n,n=this.getOverlap_(r,t),s=this.getOverlap_(o,t);var a=this.getOverlap_(e,t);t=this.getOverlap_(i,t),n==(t=Math.max(n,s,a,t))?(this.relativeLeft_=r.x,this.relativeTop_=r.y):s==t?(this.relativeLeft_=o.x,this.relativeTop_=o.y):a==t?(this.relativeLeft_=e.x,this.relativeTop_=e.y):(this.relativeLeft_=i.x,this.relativeTop_=i.y)},t.Bubble.prototype.getOverlap_=function(t,e){var n=this.workspace_.RTL?this.anchorXY_.x-t.x-this.width_:t.x+this.anchorXY_.x;return t=t.y+this.anchorXY_.y,Math.max(0,Math.min(1,(Math.min(n+this.width_,e.left+e.width)-Math.max(n,e.left))*(Math.min(t+this.height_,e.top+e.height)-Math.max(t,e.top))/(this.width_*this.height_)))},t.Bubble.prototype.getOptimalRelativeLeft_=function(e){var n=-this.width_/4;if(this.width_>e.width)return n;if(this.workspace_.RTL)var i=this.anchorXY_.x-n,r=i-this.width_,o=e.left+e.width,s=e.left+t.Scrollbar.scrollbarThickness/this.workspace_.scale;else i=(r=n+this.anchorXY_.x)+this.width_,s=e.left,o=e.left+e.width-t.Scrollbar.scrollbarThickness/this.workspace_.scale;return this.workspace_.RTL?r<s?n=-(s-this.anchorXY_.x+this.width_):i>o&&(n=-(o-this.anchorXY_.x)):r<s?n=s-this.anchorXY_.x:i>o&&(n=o-this.anchorXY_.x-this.width_),n},t.Bubble.prototype.getOptimalRelativeTop_=function(e){var n=-this.height_/4;if(this.height_>e.height)return n;var i=this.anchorXY_.y+n,r=i+this.height_,o=e.top;e=e.top+e.height-t.Scrollbar.scrollbarThickness/this.workspace_.scale;var s=this.anchorXY_.y;return i<o?n=o-s:r>e&&(n=e-s-this.height_),n},t.Bubble.prototype.positionBubble_=function(){var t=this.anchorXY_.x;t=this.workspace_.RTL?t-(this.relativeLeft_+this.width_):t+this.relativeLeft_,this.moveTo(t,this.relativeTop_+this.anchorXY_.y)},t.Bubble.prototype.moveTo=function(t,e){this.bubbleGroup_.setAttribute("transform","translate("+t+","+e+")")},t.Bubble.prototype.setDragging=function(t){!t&&this.moveCallback_&&this.moveCallback_()},t.Bubble.prototype.getBubbleSize=function(){return new t.utils.Size(this.width_,this.height_)},t.Bubble.prototype.setBubbleSize=function(e,n){var i=2*t.Bubble.BORDER_WIDTH;e=Math.max(e,i+45),n=Math.max(n,i+20),this.width_=e,this.height_=n,this.bubbleBack_.setAttribute("width",e),this.bubbleBack_.setAttribute("height",n),this.resizeGroup_&&(this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*t.Bubble.BORDER_WIDTH+","+(n-i)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(e-i)+","+(n-i)+")")),this.autoLayout_&&this.layoutBubble_(),this.positionBubble_(),this.renderArrow_(),this.resizeCallback_&&this.resizeCallback_()},t.Bubble.prototype.renderArrow_=function(){var e=[],n=this.width_/2,i=this.height_/2,r=-this.relativeLeft_,o=-this.relativeTop_;if(n==r&&i==o)e.push("M "+n+","+i);else{o-=i,r-=n,this.workspace_.RTL&&(r*=-1);var s=Math.sqrt(o*o+r*r),a=Math.acos(r/s);0>o&&(a=2*Math.PI-a);var l=a+Math.PI/2;l>2*Math.PI&&(l-=2*Math.PI);var u=Math.sin(l),c=Math.cos(l),h=this.getBubbleSize();l=(h.width+h.height)/t.Bubble.ARROW_THICKNESS,l=Math.min(l,h.width,h.height)/4,r=n+(h=1-t.Bubble.ANCHOR_RADIUS/s)*r,o=i+h*o,h=n+l*c;var p=i+l*u;n-=l*c,i-=l*u,(u=a+this.arrow_radians_)>2*Math.PI&&(u-=2*Math.PI),a=Math.sin(u)*s/t.Bubble.ARROW_BEND,s=Math.cos(u)*s/t.Bubble.ARROW_BEND,e.push("M"+h+","+p),e.push("C"+(h+s)+","+(p+a)+" "+r+","+o+" "+r+","+o),e.push("C"+r+","+o+" "+(n+s)+","+(i+a)+" "+n+","+i)}e.push("z"),this.bubbleArrow_.setAttribute("d",e.join(" "))},t.Bubble.prototype.setColour=function(t){this.bubbleBack_.setAttribute("fill",t),this.bubbleArrow_.setAttribute("fill",t)},t.Bubble.prototype.dispose=function(){this.onMouseDownBubbleWrapper_&&t.browserEvents.unbind(this.onMouseDownBubbleWrapper_),this.onMouseDownResizeWrapper_&&t.browserEvents.unbind(this.onMouseDownResizeWrapper_),t.Bubble.unbindDragEvents_(),t.utils.dom.removeNode(this.bubbleGroup_),this.disposed=!0},t.Bubble.prototype.moveDuringDrag=function(t,e){t?t.translateSurface(e.x,e.y):this.moveTo(e.x,e.y),this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-e.x-this.width_:e.x-this.anchorXY_.x,this.relativeTop_=e.y-this.anchorXY_.y,this.renderArrow_()},t.Bubble.prototype.getRelativeToSurfaceXY=function(){return new t.utils.Coordinate(this.workspace_.RTL?-this.relativeLeft_+this.anchorXY_.x-this.width_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)},t.Bubble.prototype.setAutoLayout=function(t){this.autoLayout_=t},t.Bubble.textToDom=function(e){var n=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:t.Bubble.BORDER_WIDTH},null);e=e.split("\n");for(var i=0;i<e.length;i++){var r=t.utils.dom.createSvgElement(t.utils.Svg.TSPAN,{dy:"1em",x:t.Bubble.BORDER_WIDTH},n),o=document.createTextNode(e[i]);r.appendChild(o)}return n},t.Bubble.createNonEditableBubble=function(e,n,i){if((i=new t.Bubble(n.workspace,e,n.pathObject.svgPath,i,null,null)).setSvgId(n.id),n.RTL){n=e.getBBox().width;for(var r,o=0;r=e.childNodes[o];o++)r.setAttribute("text-anchor","end"),r.setAttribute("x",n+t.Bubble.BORDER_WIDTH)}return i},t.Events.CommentBase=function(e){this.commentId=(this.isBlank=void 0===e)?"":e.id,this.workspaceId=this.isBlank?"":e.workspace.id,this.group=t.Events.getGroup(),this.recordUndo=t.Events.recordUndo},t.utils.object.inherits(t.Events.CommentBase,t.Events.Abstract),t.Events.CommentBase.prototype.toJson=function(){var e=t.Events.CommentBase.superClass_.toJson.call(this);return this.commentId&&(e.commentId=this.commentId),e},t.Events.CommentBase.prototype.fromJson=function(e){t.Events.CommentBase.superClass_.fromJson.call(this,e),this.commentId=e.commentId},t.Events.CommentChange=function(e,n,i){t.Events.CommentChange.superClass_.constructor.call(this,e),e&&(this.oldContents_=void 0===n?"":n,this.newContents_=void 0===i?"":i)},t.utils.object.inherits(t.Events.CommentChange,t.Events.CommentBase),t.Events.CommentChange.prototype.type=t.Events.COMMENT_CHANGE,t.Events.CommentChange.prototype.toJson=function(){var e=t.Events.CommentChange.superClass_.toJson.call(this);return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e},t.Events.CommentChange.prototype.fromJson=function(e){t.Events.CommentChange.superClass_.fromJson.call(this,e),this.oldContents_=e.oldContents,this.newContents_=e.newContents},t.Events.CommentChange.prototype.isNull=function(){return this.oldContents_==this.newContents_},t.Events.CommentChange.prototype.run=function(t){var e=this.getEventWorkspace_().getCommentById(this.commentId);e?e.setContent(t?this.newContents_:this.oldContents_):console.warn("Can't change non-existent comment: "+this.commentId)},t.Events.CommentCreate=function(e){t.Events.CommentCreate.superClass_.constructor.call(this,e),e&&(this.xml=e.toXmlWithXY())},t.utils.object.inherits(t.Events.CommentCreate,t.Events.CommentBase),t.Events.CommentCreate.prototype.type=t.Events.COMMENT_CREATE,t.Events.CommentCreate.prototype.toJson=function(){var e=t.Events.CommentCreate.superClass_.toJson.call(this);return e.xml=t.Xml.domToText(this.xml),e},t.Events.CommentCreate.prototype.fromJson=function(e){t.Events.CommentCreate.superClass_.fromJson.call(this,e),this.xml=t.Xml.textToDom(e.xml)},t.Events.CommentCreate.prototype.run=function(e){t.Events.CommentCreateDeleteHelper(this,e)},t.Events.CommentCreateDeleteHelper=function(e,n){var i=e.getEventWorkspace_();n?((n=t.utils.xml.createElement("xml")).appendChild(e.xml),t.Xml.domToWorkspace(n,i)):(i=i.getCommentById(e.commentId))?i.dispose(!1,!1):console.warn("Can't uncreate non-existent comment: "+e.commentId)},t.Events.CommentDelete=function(e){t.Events.CommentDelete.superClass_.constructor.call(this,e),e&&(this.xml=e.toXmlWithXY())},t.utils.object.inherits(t.Events.CommentDelete,t.Events.CommentBase),t.Events.CommentDelete.prototype.type=t.Events.COMMENT_DELETE,t.Events.CommentDelete.prototype.toJson=function(){return t.Events.CommentDelete.superClass_.toJson.call(this)},t.Events.CommentDelete.prototype.fromJson=function(e){t.Events.CommentDelete.superClass_.fromJson.call(this,e)},t.Events.CommentDelete.prototype.run=function(e){t.Events.CommentCreateDeleteHelper(this,!e)},t.Events.CommentMove=function(e){t.Events.CommentMove.superClass_.constructor.call(this,e),e&&(this.comment_=e,this.oldCoordinate_=e.getXY(),this.newCoordinate_=null)},t.utils.object.inherits(t.Events.CommentMove,t.Events.CommentBase),t.Events.CommentMove.prototype.recordNew=function(){if(!this.comment_)throw Error("Tried to record the new position of a comment on the same event twice.");this.newCoordinate_=this.comment_.getXY(),this.comment_=null},t.Events.CommentMove.prototype.type=t.Events.COMMENT_MOVE,t.Events.CommentMove.prototype.setOldCoordinate=function(t){this.oldCoordinate_=t},t.Events.CommentMove.prototype.toJson=function(){var e=t.Events.CommentMove.superClass_.toJson.call(this);return this.oldCoordinate_&&(e.oldCoordinate=Math.round(this.oldCoordinate_.x)+","+Math.round(this.oldCoordinate_.y)),this.newCoordinate_&&(e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y)),e},t.Events.CommentMove.prototype.fromJson=function(e){if(t.Events.CommentMove.superClass_.fromJson.call(this,e),e.oldCoordinate){var n=e.oldCoordinate.split(",");this.oldCoordinate_=new t.utils.Coordinate(Number(n[0]),Number(n[1]))}e.newCoordinate&&(n=e.newCoordinate.split(","),this.newCoordinate_=new t.utils.Coordinate(Number(n[0]),Number(n[1])))},t.Events.CommentMove.prototype.isNull=function(){return t.utils.Coordinate.equals(this.oldCoordinate_,this.newCoordinate_)},t.Events.CommentMove.prototype.run=function(t){var e=this.getEventWorkspace_().getCommentById(this.commentId);if(e){t=t?this.newCoordinate_:this.oldCoordinate_;var n=e.getXY();e.moveBy(t.x-n.x,t.y-n.y)}else console.warn("Can't move non-existent comment: "+this.commentId)},t.registry.register(t.registry.Type.EVENT,t.Events.COMMENT_CREATE,t.Events.CommentCreate),t.registry.register(t.registry.Type.EVENT,t.Events.COMMENT_CHANGE,t.Events.CommentChange),t.registry.register(t.registry.Type.EVENT,t.Events.COMMENT_MOVE,t.Events.CommentMove),t.registry.register(t.registry.Type.EVENT,t.Events.COMMENT_DELETE,t.Events.CommentDelete),t.BubbleDragger=function(e,n){this.draggingBubble_=e,this.workspace_=n,this.dragTarget_=null,this.wouldDeleteBubble_=!1,this.startXY_=this.draggingBubble_.getRelativeToSurfaceXY(),this.dragSurface_=t.utils.is3dSupported()&&n.getBlockDragSurface()?n.getBlockDragSurface():null},t.BubbleDragger.prototype.dispose=function(){this.dragSurface_=this.workspace_=this.draggingBubble_=null},t.BubbleDragger.prototype.startBubbleDrag=function(){t.Events.getGroup()||t.Events.setGroup(!0),this.workspace_.setResizesEnabled(!1),this.draggingBubble_.setAutoLayout(!1),this.dragSurface_&&this.moveToDragSurface_(),this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!0)},t.BubbleDragger.prototype.dragBubble=function(e,n){n=this.pixelsToWorkspaceUnits_(n),n=t.utils.Coordinate.sum(this.startXY_,n),this.draggingBubble_.moveDuringDrag(this.dragSurface_,n),n=this.dragTarget_,this.dragTarget_=this.workspace_.getDragTarget(e),e=this.wouldDeleteBubble_,this.wouldDeleteBubble_=this.shouldDelete_(this.dragTarget_),e!=this.wouldDeleteBubble_&&this.updateCursorDuringBubbleDrag_(),this.dragTarget_!==n&&(n&&n.onDragExit(this.draggingBubble_),this.dragTarget_&&this.dragTarget_.onDragEnter(this.draggingBubble_)),this.dragTarget_&&this.dragTarget_.onDragOver(this.draggingBubble_)},t.BubbleDragger.prototype.shouldDelete_=function(e){return!(!e||!this.workspace_.getComponentManager().hasCapability(e.id,t.ComponentManager.Capability.DELETE_AREA))&&e.wouldDelete(this.draggingBubble_,!1)},t.BubbleDragger.prototype.updateCursorDuringBubbleDrag_=function(){this.draggingBubble_.setDeleteStyle(this.wouldDeleteBubble_)},t.BubbleDragger.prototype.endBubbleDrag=function(e,n){this.dragBubble(e,n),this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBubble_)?e=this.startXY_:(e=this.pixelsToWorkspaceUnits_(n),e=t.utils.Coordinate.sum(this.startXY_,e)),this.draggingBubble_.moveTo(e.x,e.y),this.dragTarget_&&this.dragTarget_.onDrop(this.draggingBubble_),this.wouldDeleteBubble_?(this.fireMoveEvent_(),this.draggingBubble_.dispose(!1,!0)):(this.dragSurface_&&this.dragSurface_.clearAndHide(this.workspace_.getBubbleCanvas()),this.draggingBubble_.setDragging&&this.draggingBubble_.setDragging(!1),this.fireMoveEvent_()),this.workspace_.setResizesEnabled(!0),t.Events.setGroup(!1)},t.BubbleDragger.prototype.fireMoveEvent_=function(){if(this.draggingBubble_.isComment){var e=new(t.Events.get(t.Events.COMMENT_MOVE))(this.draggingBubble_);e.setOldCoordinate(this.startXY_),e.recordNew(),t.Events.fire(e)}},t.BubbleDragger.prototype.pixelsToWorkspaceUnits_=function(e){return e=new t.utils.Coordinate(e.x/this.workspace_.scale,e.y/this.workspace_.scale),this.workspace_.isMutator&&e.scale(1/this.workspace_.options.parentWorkspace.scale),e},t.BubbleDragger.prototype.moveToDragSurface_=function(){this.draggingBubble_.moveTo(0,0),this.dragSurface_.translateSurface(this.startXY_.x,this.startXY_.y),this.dragSurface_.setBlocksAndShow(this.draggingBubble_.getSvgRoot())},t.Events.Click=function(e,n,i){t.Events.Click.superClass_.constructor.call(this,e?e.workspace.id:n),this.blockId=e?e.id:null,this.targetType=i},t.utils.object.inherits(t.Events.Click,t.Events.UiBase),t.Events.Click.prototype.type=t.Events.CLICK,t.Events.Click.prototype.toJson=function(){var e=t.Events.Click.superClass_.toJson.call(this);return e.targetType=this.targetType,this.blockId&&(e.blockId=this.blockId),e},t.Events.Click.prototype.fromJson=function(e){t.Events.Click.superClass_.fromJson.call(this,e),this.targetType=e.targetType,this.blockId=e.blockId},t.registry.register(t.registry.Type.EVENT,t.Events.CLICK,t.Events.Click),t.WorkspaceDragger=function(e){this.workspace_=e,this.horizontalScrollEnabled_=this.workspace_.isMovableHorizontally(),this.verticalScrollEnabled_=this.workspace_.isMovableVertically(),this.startScrollXY_=new t.utils.Coordinate(e.scrollX,e.scrollY)},t.WorkspaceDragger.prototype.dispose=function(){this.workspace_=null},t.WorkspaceDragger.prototype.startDrag=function(){t.selected&&t.selected.unselect(),this.workspace_.setupDragSurface()},t.WorkspaceDragger.prototype.endDrag=function(t){this.drag(t),this.workspace_.resetDragSurface()},t.WorkspaceDragger.prototype.drag=function(e){if(e=t.utils.Coordinate.sum(this.startScrollXY_,e),this.horizontalScrollEnabled_&&this.verticalScrollEnabled_)this.workspace_.scroll(e.x,e.y);else if(this.horizontalScrollEnabled_)this.workspace_.scroll(e.x,this.workspace_.scrollY);else{if(!this.verticalScrollEnabled_)throw new TypeError("Invalid state.");this.workspace_.scroll(this.workspace_.scrollX,e.y)}},t.Gesture=function(e,n){this.mouseDownXY_=null,this.currentDragDeltaXY_=new t.utils.Coordinate(0,0),this.startWorkspace_=this.targetBlock_=this.startBlock_=this.startField_=this.startBubble_=null,this.creatorWorkspace_=n,this.isDraggingBubble_=this.isDraggingBlock_=this.isDraggingWorkspace_=this.hasExceededDragRadius_=!1,this.mostRecentEvent_=e,this.flyout_=this.workspaceDragger_=this.blockDragger_=this.bubbleDragger_=this.onUpWrapper_=this.onMoveWrapper_=null,this.isEnding_=this.hasStarted_=this.calledUpdateIsDragging_=!1,this.healStack_=!t.DRAG_STACK},t.Gesture.prototype.dispose=function(){t.Touch.clearTouchIdentifier(),t.Tooltip.unblock(),this.creatorWorkspace_.clearGesture(),this.onMoveWrapper_&&t.browserEvents.unbind(this.onMoveWrapper_),this.onUpWrapper_&&t.browserEvents.unbind(this.onUpWrapper_),this.blockDragger_&&this.blockDragger_.dispose(),this.workspaceDragger_&&this.workspaceDragger_.dispose(),this.bubbleDragger_&&this.bubbleDragger_.dispose()},t.Gesture.prototype.updateFromEvent_=function(e){var n=new t.utils.Coordinate(e.clientX,e.clientY);this.updateDragDelta_(n)&&(this.updateIsDragging_(),t.longStop_()),this.mostRecentEvent_=e},t.Gesture.prototype.updateDragDelta_=function(e){return this.currentDragDeltaXY_=t.utils.Coordinate.difference(e,this.mouseDownXY_),!this.hasExceededDragRadius_&&(this.hasExceededDragRadius_=t.utils.Coordinate.magnitude(this.currentDragDeltaXY_)>(this.flyout_?t.FLYOUT_DRAG_RADIUS:t.DRAG_RADIUS))},t.Gesture.prototype.updateIsDraggingFromFlyout_=function(){return!(!this.targetBlock_||!this.flyout_.isBlockCreatable_(this.targetBlock_))&&(!(this.flyout_.isScrollable()&&!this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_))&&(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),t.Events.getGroup()||t.Events.setGroup(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0))},t.Gesture.prototype.updateIsDraggingBubble_=function(){return!!this.startBubble_&&(this.isDraggingBubble_=!0,this.startDraggingBubble_(),!0)},t.Gesture.prototype.updateIsDraggingBlock_=function(){return!!this.targetBlock_&&(this.flyout_?this.isDraggingBlock_=this.updateIsDraggingFromFlyout_():this.targetBlock_.isMovable()&&(this.isDraggingBlock_=!0),!!this.isDraggingBlock_&&(this.startDraggingBlock_(),!0))},t.Gesture.prototype.updateIsDraggingWorkspace_=function(){(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger_=new t.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag())},t.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0,this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()},t.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new(t.registry.getClassFromOptions(t.registry.Type.BLOCK_DRAGGER,this.creatorWorkspace_.options,!0))(this.targetBlock_,this.startWorkspace_),this.blockDragger_.startDrag(this.currentDragDeltaXY_,this.healStack_),this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_)},t.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new t.BubbleDragger(this.startBubble_,this.startWorkspace_),this.bubbleDragger_.startBubbleDrag(),this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)},t.Gesture.prototype.doStart=function(e){t.utils.isTargetInput(e)?this.cancel():(this.hasStarted_=!0,t.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),t.hideChaff(!!this.flyout_),this.startWorkspace_.markFocused(),this.mostRecentEvent_=e,t.Tooltip.block(),this.targetBlock_&&this.targetBlock_.select(),t.utils.isRightButton(e)?this.handleRightClick(e):("touchstart"!=e.type.toLowerCase()&&"pointerdown"!=e.type.toLowerCase()||"mouse"==e.pointerType||t.longStart(e,this),this.mouseDownXY_=new t.utils.Coordinate(e.clientX,e.clientY),this.healStack_=e.altKey||e.ctrlKey||e.metaKey,this.bindMouseEvents(e)))},t.Gesture.prototype.bindMouseEvents=function(e){this.onMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this)),this.onUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this)),e.preventDefault(),e.stopPropagation()},t.Gesture.prototype.handleMove=function(t){this.updateFromEvent_(t),this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_),t.preventDefault(),t.stopPropagation()},t.Gesture.prototype.handleUp=function(e){this.updateFromEvent_(e),t.longStop_(),this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(e,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(e,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(e),e.preventDefault(),e.stopPropagation(),this.dispose())},t.Gesture.prototype.cancel=function(){this.isEnding_||(t.longStop_(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())},t.Gesture.prototype.handleRightClick=function(e){this.targetBlock_?(this.bringBlockToFront_(),t.hideChaff(!!this.flyout_),this.targetBlock_.showContextMenu(e)):this.startBubble_?this.startBubble_.showContextMenu(e):this.startWorkspace_&&!this.flyout_&&(t.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()},t.Gesture.prototype.handleWsStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(e),this.mostRecentEvent_=t,this.doStart(t)},t.Gesture.prototype.fireWorkspaceClick_=function(e){t.Events.fire(new(t.Events.get(t.Events.CLICK))(null,e.id,"workspace"))},t.Gesture.prototype.handleFlyoutStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(e),this.handleWsStart(t,e.getWorkspace())},t.Gesture.prototype.handleBlockStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(e),this.mostRecentEvent_=t},t.Gesture.prototype.handleBubbleStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(e),this.mostRecentEvent_=t},t.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus(),this.startBubble_.select&&this.startBubble_.select()},t.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_),this.bringBlockToFront_()},t.Gesture.prototype.doBlockClick_=function(){if(this.flyout_&&this.flyout_.autoClose)this.targetBlock_.isEnabled()&&(t.Events.getGroup()||t.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump());else{var e=new(t.Events.get(t.Events.CLICK))(this.startBlock_,this.startWorkspace_.id,"block");t.Events.fire(e)}this.bringBlockToFront_(),t.Events.setGroup(!1)},t.Gesture.prototype.doWorkspaceClick_=function(e){e=this.creatorWorkspace_,t.selected&&t.selected.unselect(),this.fireWorkspaceClick_(this.startWorkspace_||e)},t.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()},t.Gesture.prototype.setStartField=function(t){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=t)},t.Gesture.prototype.setStartBubble=function(t){this.startBubble_||(this.startBubble_=t)},t.Gesture.prototype.setStartBlock=function(t){this.startBlock_||this.startBubble_||(this.startBlock_=t,t.isInFlyout&&t!=t.getRootBlock()?this.setTargetBlock_(t.getRootBlock()):this.setTargetBlock_(t))},t.Gesture.prototype.setTargetBlock_=function(t){t.isShadow()?this.setTargetBlock_(t.getParent()):this.targetBlock_=t},t.Gesture.prototype.setStartWorkspace_=function(t){this.startWorkspace_||(this.startWorkspace_=t)},t.Gesture.prototype.setStartFlyout_=function(t){this.flyout_||(this.flyout_=t)},t.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_},t.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()},t.Gesture.prototype.isFieldClick_=function(){return!!this.startField_&&this.startField_.isClickable()&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)},t.Gesture.prototype.isWorkspaceClick_=function(){return!(this.startBlock_||this.startBubble_||this.startField_||this.hasExceededDragRadius_)},t.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_},t.Gesture.prototype.hasStarted=function(){return this.hasStarted_},t.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]},t.Gesture.prototype.getCurrentDragger=function(){return this.isDraggingBlock_?this.blockDragger_:this.isDraggingWorkspace_?this.workspaceDragger_:this.isDraggingBubble_?this.bubbleDragger_:null},t.Gesture.inProgress=function(){for(var e,n=t.Workspace.getAll(),i=0;e=n[i];i++)if(e.currentGesture_)return!0;return!1},t.IRegistrable=function(){},t.Marker=function(){this.drawer_=this.curNode_=this.colour=null,this.type="marker"},t.Marker.prototype.setDrawer=function(t){this.drawer_=t},t.Marker.prototype.getDrawer=function(){return this.drawer_},t.Marker.prototype.getCurNode=function(){return this.curNode_},t.Marker.prototype.setCurNode=function(t){var e=this.curNode_;this.curNode_=t,this.drawer_&&this.drawer_.draw(e,this.curNode_)},t.Marker.prototype.draw=function(){this.drawer_&&this.drawer_.draw(this.curNode_,this.curNode_)},t.Marker.prototype.hide=function(){this.drawer_&&this.drawer_.hide()},t.Marker.prototype.dispose=function(){this.getDrawer()&&this.getDrawer().dispose()},t.Cursor=function(){t.Cursor.superClass_.constructor.call(this),this.type="cursor"},t.utils.object.inherits(t.Cursor,t.Marker),t.Cursor.prototype.next=function(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()==t.ASTNode.types.NEXT||e.getType()==t.ASTNode.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e},t.Cursor.prototype.in=function(){var e=this.getCurNode();return e?(e.getType()!=t.ASTNode.types.PREVIOUS&&e.getType()!=t.ASTNode.types.OUTPUT||(e=e.next()),(e=e.in())&&this.setCurNode(e),e):null},t.Cursor.prototype.prev=function(){var e=this.getCurNode();if(!e)return null;for(e=e.prev();e&&e.prev()&&(e.getType()==t.ASTNode.types.NEXT||e.getType()==t.ASTNode.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e},t.Cursor.prototype.out=function(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()==t.ASTNode.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null},t.registry.register(t.registry.Type.CURSOR,t.registry.DEFAULT,t.Cursor),t.MarkerManager=function(t){this.cursorSvg_=this.cursor_=null,this.markers_=Object.create(null),this.workspace_=t},t.MarkerManager.LOCAL_MARKER="local_marker_1",t.MarkerManager.prototype.registerMarker=function(t,e){this.markers_[t]&&this.unregisterMarker(t),e.setDrawer(this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,e)),this.setMarkerSvg(e.getDrawer().createDom()),this.markers_[t]=e},t.MarkerManager.prototype.unregisterMarker=function(t){var e=this.markers_[t];if(!e)throw Error("Marker with ID "+t+" does not exist. Can only unregister markers that exist.");e.dispose(),delete this.markers_[t]},t.MarkerManager.prototype.getCursor=function(){return this.cursor_},t.MarkerManager.prototype.getMarker=function(t){return this.markers_[t]||null},t.MarkerManager.prototype.setCursor=function(t){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose(),(this.cursor_=t)&&(t=this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,this.cursor_),this.cursor_.setDrawer(t),this.setCursorSvg(this.cursor_.getDrawer().createDom()))},t.MarkerManager.prototype.setCursorSvg=function(t){t?(this.workspace_.getBlockCanvas().appendChild(t),this.cursorSvg_=t):this.cursorSvg_=null},t.MarkerManager.prototype.setMarkerSvg=function(t){t?this.workspace_.getBlockCanvas()&&(this.cursorSvg_?this.workspace_.getBlockCanvas().insertBefore(t,this.cursorSvg_):this.workspace_.getBlockCanvas().appendChild(t)):this.markerSvg_=null},t.MarkerManager.prototype.updateMarkers=function(){this.workspace_.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace_.getCursor().draw()},t.MarkerManager.prototype.dispose=function(){for(var t,e=Object.keys(this.markers_),n=0;t=e[n];n++)this.unregisterMarker(t);this.markers_=null,this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)},t.WidgetDiv={},t.WidgetDiv.owner_=null,t.WidgetDiv.dispose_=null,t.WidgetDiv.rendererClassName_="",t.WidgetDiv.themeClassName_="",t.WidgetDiv.createDom=function(){t.WidgetDiv.DIV||(t.WidgetDiv.DIV=document.createElement("div"),t.WidgetDiv.DIV.className="blocklyWidgetDiv",(t.parentContainer||document.body).appendChild(t.WidgetDiv.DIV))},t.WidgetDiv.show=function(e,n,i){t.WidgetDiv.hide(),t.WidgetDiv.owner_=e,t.WidgetDiv.dispose_=i,(e=t.WidgetDiv.DIV).style.direction=n?"rtl":"ltr",e.style.display="block",n=t.getMainWorkspace(),t.WidgetDiv.rendererClassName_=n.getRenderer().getClassName(),t.WidgetDiv.themeClassName_=n.getTheme().getClassName(),t.utils.dom.addClass(e,t.WidgetDiv.rendererClassName_),t.utils.dom.addClass(e,t.WidgetDiv.themeClassName_)},t.WidgetDiv.hide=function(){if(t.WidgetDiv.isVisible()){t.WidgetDiv.owner_=null;var e=t.WidgetDiv.DIV;e.style.display="none",e.style.left="",e.style.top="",t.WidgetDiv.dispose_&&t.WidgetDiv.dispose_(),t.WidgetDiv.dispose_=null,e.textContent="",t.WidgetDiv.rendererClassName_&&(t.utils.dom.removeClass(e,t.WidgetDiv.rendererClassName_),t.WidgetDiv.rendererClassName_=""),t.WidgetDiv.themeClassName_&&(t.utils.dom.removeClass(e,t.WidgetDiv.themeClassName_),t.WidgetDiv.themeClassName_=""),t.getMainWorkspace().markFocused()}},t.WidgetDiv.isVisible=function(){return!!t.WidgetDiv.owner_},t.WidgetDiv.hideIfOwner=function(e){t.WidgetDiv.owner_==e&&t.WidgetDiv.hide()},t.WidgetDiv.positionInternal_=function(e,n,i){t.WidgetDiv.DIV.style.left=e+"px",t.WidgetDiv.DIV.style.top=n+"px",t.WidgetDiv.DIV.style.height=i+"px"},t.WidgetDiv.positionWithAnchor=function(e,n,i,r){var o=t.WidgetDiv.calculateY_(e,n,i);e=t.WidgetDiv.calculateX_(e,n,i,r),0>o?t.WidgetDiv.positionInternal_(e,0,i.height+o):t.WidgetDiv.positionInternal_(e,o,i.height)},t.WidgetDiv.calculateX_=function(t,e,n,i){return i?(e=Math.max(e.right-n.width,t.left),Math.min(e,t.right-n.width)):(e=Math.min(e.left,t.right-n.width),Math.max(e,t.left))},t.WidgetDiv.calculateY_=function(t,e,n){return e.bottom+n.height>=t.bottom?e.top-n.height:e.bottom},t.Field=function(e,n,i){this.value_=this.DEFAULT_VALUE,this.tooltip_=this.validator_=null,this.size_=new t.utils.Size(0,0),this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null,i&&this.configure_(i),this.setValue(e),n&&this.setValidator(n)},t.Field.prototype.DEFAULT_VALUE=null,t.Field.prototype.name=void 0,t.Field.prototype.disposed=!1,t.Field.prototype.maxDisplayLength=50,t.Field.prototype.sourceBlock_=null,t.Field.prototype.isDirty_=!0,t.Field.prototype.visible_=!0,t.Field.prototype.clickTarget_=null,t.Field.NBSP=" ",t.Field.prototype.EDITABLE=!0,t.Field.prototype.SERIALIZABLE=!1,t.Field.prototype.configure_=function(e){var n=e.tooltip;"string"==typeof n&&(n=t.utils.replaceMessageReferences(e.tooltip)),n&&this.setTooltip(n)},t.Field.prototype.setSourceBlock=function(t){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=t},t.Field.prototype.getConstants=function(){return!this.constants_&&this.sourceBlock_&&this.sourceBlock_.workspace&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_},t.Field.prototype.getSourceBlock=function(){return this.sourceBlock_},t.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())},t.Field.prototype.initView=function(){this.createBorderRect_(),this.createTextElement_()},t.Field.prototype.initModel=function(){},t.Field.prototype.createBorderRect_=function(){this.borderRect_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)},t.Field.prototype.createTextElement_=function(){this.textElement_=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)},t.Field.prototype.bindEvents_=function(){t.Tooltip.bindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_=t.browserEvents.conditionalBind(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)},t.Field.prototype.fromXml=function(t){this.setValue(t.textContent)},t.Field.prototype.toXml=function(t){return t.textContent=this.getValue(),t},t.Field.prototype.dispose=function(){t.DropDownDiv.hideIfOwner(this),t.WidgetDiv.hideIfOwner(this),t.Tooltip.unbindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_&&t.browserEvents.unbind(this.mouseDownWrapper_),t.utils.dom.removeNode(this.fieldGroup_),this.disposed=!0},t.Field.prototype.updateEditable=function(){var e=this.fieldGroup_;this.EDITABLE&&e&&(this.sourceBlock_.isEditable()?(t.utils.dom.addClass(e,"blocklyEditableText"),t.utils.dom.removeClass(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(t.utils.dom.addClass(e,"blocklyNonEditableText"),t.utils.dom.removeClass(e,"blocklyEditableText"),e.style.cursor=""))},t.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"==typeof this.showEditor_},t.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()},t.Field.prototype.isSerializable=function(){var t=!1;return this.name&&(this.SERIALIZABLE?t=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),t=!0)),t},t.Field.prototype.isVisible=function(){return this.visible_},t.Field.prototype.setVisible=function(t){if(this.visible_!=t){this.visible_=t;var e=this.getSvgRoot();e&&(e.style.display=t?"block":"none")}},t.Field.prototype.setValidator=function(t){this.validator_=t},t.Field.prototype.getValidator=function(){return this.validator_},t.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},t.Field.prototype.applyColour=function(){},t.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()},t.Field.prototype.showEditor=function(t){this.isClickable()&&this.showEditor_(t)},t.Field.prototype.updateSize_=function(e){var n=this.getConstants(),i=2*(e=void 0!=e?e:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0),r=n.FIELD_TEXT_HEIGHT,o=0;this.textElement_&&(i+=o=t.utils.dom.getFastTextWidth(this.textElement_,n.FIELD_TEXT_FONTSIZE,n.FIELD_TEXT_FONTWEIGHT,n.FIELD_TEXT_FONTFAMILY)),this.borderRect_&&(r=Math.max(r,n.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=r,this.size_.width=i,this.positionTextElement_(e,o),this.positionBorderRect_()},t.Field.prototype.positionTextElement_=function(t,e){if(this.textElement_){var n=this.getConstants(),i=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-e-t:t),this.textElement_.setAttribute("y",n.FIELD_TEXT_BASELINE_CENTER?i:i-n.FIELD_TEXT_HEIGHT/2+n.FIELD_TEXT_BASELINE)}},t.Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))},t.Field.prototype.getSize=function(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_()),this.size_):new t.utils.Size(0,0)},t.Field.prototype.getScaledBBox=function(){if(this.borderRect_)e=this.borderRect_.getBoundingClientRect(),i=t.utils.style.getPageOffset(this.borderRect_),r=e.width,e=e.height;else{var e=this.sourceBlock_.getHeightWidth(),n=this.sourceBlock_.workspace.scale,i=this.getAbsoluteXY_(),r=e.width*n;e=e.height*n,t.utils.userAgent.GECKO?(i.x+=1.5*n,i.y+=1.5*n):t.utils.userAgent.EDGE||t.utils.userAgent.IE||(i.x-=.5*n,i.y-=.5*n),r+=1*n,e+=1*n}return new t.utils.Rect(i.y,i.y+e,i.x,i.x+r)},t.Field.prototype.getDisplayText_=function(){var e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,t.Field.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="‏"),e):t.Field.NBSP},t.Field.prototype.getText=function(){if(this.getText_){var t=this.getText_.call(this);if(null!==t)return String(t)}return String(this.getValue())},t.Field.prototype.markDirty=function(){this.isDirty_=!0,this.constants_=null},t.Field.prototype.forceRerender=function(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())},t.Field.prototype.setValue=function(e){if(null!==e){var n=this.doClassValidation_(e);if(!((e=this.processValidation_(e,n))instanceof Error)){if((n=this.getValidator())&&(n=n.call(this,e),(e=this.processValidation_(e,n))instanceof Error))return;if(!(n=this.sourceBlock_)||!n.disposed){var i=this.getValue();i===e?this.doValueUpdate_(e):(n&&t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(n,"field",this.name||null,i,e)),this.doValueUpdate_(e),this.isDirty_&&this.forceRerender())}}}},t.Field.prototype.processValidation_=function(t,e){return null===e?(this.doValueInvalid_(t),this.isDirty_&&this.forceRerender(),Error()):(void 0!==e&&(t=e),t)},t.Field.prototype.getValue=function(){return this.value_},t.Field.prototype.doClassValidation_=function(t){return null===t||void 0===t?null:t},t.Field.prototype.doValueUpdate_=function(t){this.value_=t,this.isDirty_=!0},t.Field.prototype.doValueInvalid_=function(t){},t.Field.prototype.onMouseDown_=function(t){this.sourceBlock_&&this.sourceBlock_.workspace&&(t=this.sourceBlock_.workspace.getGesture(t))&&t.setStartField(this)},t.Field.prototype.setTooltip=function(t){t||""===t||(t=this.sourceBlock_);var e=this.getClickTarget_();e?e.tooltip=t:this.tooltip_=t},t.Field.prototype.getTooltip=function(){var e=this.getClickTarget_();return e?t.Tooltip.getTooltipOfObject(e):t.Tooltip.getTooltipOfObject({tooltip:this.tooltip_})},t.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()},t.Field.prototype.getAbsoluteXY_=function(){return t.utils.style.getPageOffset(this.getClickTarget_())},t.Field.prototype.referencesVariables=function(){return!1},t.Field.prototype.getParentInput=function(){for(var t=null,e=this.sourceBlock_,n=e.inputList,i=0;i<e.inputList.length;i++)for(var r=n[i],o=r.fieldRow,s=0;s<o.length;s++)if(o[s]===this){t=r;break}return t},t.Field.prototype.getFlipRtl=function(){return!1},t.Field.prototype.isTabNavigable=function(){return!1},t.Field.prototype.onShortcut=function(t){return!1},t.Field.prototype.setCursorSvg=function(t){t?(this.fieldGroup_.appendChild(t),this.cursorSvg_=t):this.cursorSvg_=null},t.Field.prototype.setMarkerSvg=function(t){t?(this.fieldGroup_.appendChild(t),this.markerSvg_=t):this.markerSvg_=null},t.Field.prototype.updateMarkers_=function(){var e=this.sourceBlock_.workspace;e.keyboardAccessibilityMode&&this.cursorSvg_&&e.getCursor().draw(),e.keyboardAccessibilityMode&&this.markerSvg_&&e.getMarker(t.MarkerManager.LOCAL_MARKER).draw()},t.FieldLabel=function(e,n,i){this.class_=null,t.FieldLabel.superClass_.constructor.call(this,e,null,i),i||(this.class_=n||null)},t.utils.object.inherits(t.FieldLabel,t.Field),t.FieldLabel.prototype.DEFAULT_VALUE="",t.FieldLabel.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldLabel(n,void 0,e)},t.FieldLabel.prototype.EDITABLE=!1,t.FieldLabel.prototype.configure_=function(e){t.FieldLabel.superClass_.configure_.call(this,e),this.class_=e.class},t.FieldLabel.prototype.initView=function(){this.createTextElement_(),this.class_&&t.utils.dom.addClass(this.textElement_,this.class_)},t.FieldLabel.prototype.doClassValidation_=function(t){return null===t||void 0===t?null:String(t)},t.FieldLabel.prototype.setClass=function(e){this.textElement_&&(this.class_&&t.utils.dom.removeClass(this.textElement_,this.class_),e&&t.utils.dom.addClass(this.textElement_,e)),this.class_=e},t.fieldRegistry.register("field_label",t.FieldLabel),t.Input=function(e,n,i,r){if(e!=t.inputTypes.DUMMY&&!n)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=e,this.name=n,this.sourceBlock_=i,this.connection=r,this.fieldRow=[]},t.Input.prototype.align=t.constants.ALIGN.LEFT,t.Input.prototype.visible_=!0,t.Input.prototype.getSourceBlock=function(){return this.sourceBlock_},t.Input.prototype.appendField=function(t,e){return this.insertFieldAt(this.fieldRow.length,t,e),this},t.Input.prototype.insertFieldAt=function(e,n,i){if(0>e||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return n||""==n&&i?("string"==typeof n&&(n=t.fieldRegistry.fromJson({type:"field_label",text:n})),n.setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&(n.init(),n.applyColour()),n.name=i,n.setVisible(this.isVisible()),n.prefixField&&(e=this.insertFieldAt(e,n.prefixField)),this.fieldRow.splice(e,0,n),++e,n.suffixField&&(e=this.insertFieldAt(e,n.suffixField)),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),e):e},t.Input.prototype.removeField=function(t,e){for(var n,i=0;n=this.fieldRow[i];i++)if(n.name===t)return n.dispose(),this.fieldRow.splice(i,1),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),!0;if(e)return!1;throw Error('Field "'+t+'" not found.')},t.Input.prototype.isVisible=function(){return this.visible_},t.Input.prototype.setVisible=function(t){var e=[];if(this.visible_==t)return e;this.visible_=t;for(var n,i=0;n=this.fieldRow[i];i++)n.setVisible(t);return this.connection&&(this.connection=this.connection,t?e=this.connection.startTrackingAll():this.connection.stopTrackingAll(),i=this.connection.targetBlock())&&(i.getSvgRoot().style.display=t?"block":"none"),e},t.Input.prototype.markDirty=function(){for(var t,e=0;t=this.fieldRow[e];e++)t.markDirty()},t.Input.prototype.setCheck=function(t){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(t),this},t.Input.prototype.setAlign=function(t){return this.align=t,this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render()),this},t.Input.prototype.setShadowDom=function(t){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(t),this},t.Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()},t.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var t=0;t<this.fieldRow.length;t++)this.fieldRow[t].init()},t.Input.prototype.dispose=function(){for(var t,e=0;t=this.fieldRow[e];e++)t.dispose();this.connection&&this.connection.dispose(),this.sourceBlock_=null},t.Block=function(e,n,i){if(t.Generator&&void 0!==t.Generator.prototype[n])throw Error('Block prototypeName "'+n+'" conflicts with Blockly.Generator members.');if(this.id=i&&!e.getBlockById(i)?i:t.utils.genUid(),e.setBlockById(this.id,this),this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.inputsInline=void 0,this.disabled=!1,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable_=this.movable_=this.deletable_=!0,this.collapsed_=this.isShadow_=!1,this.comment=this.outputShape_=null,this.commentModel={text:null,pinned:!1,size:new t.utils.Size(160,80)},this.xy_=new t.utils.Coordinate(0,0),this.workspace=e,this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,this.isInsertionMarker_=!1,this.hat=void 0,this.rendered=null,this.statementInputCount=0,n){if(this.type=n,!(i=t.Blocks[n])||"object"!=typeof i)throw TypeError("Unknown block type: "+n);t.utils.object.mixin(this,i)}e.addTopBlock(this),e.addTypedBlock(this),(e=t.Events.getGroup())||t.Events.setGroup(!0),n=t.Events.recordUndo;try{"function"==typeof this.init&&(t.Events.recordUndo=!1,this.init(),t.Events.recordUndo=n),t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(this))}finally{e||t.Events.setGroup(!1),t.Events.recordUndo=n}this.inputsInlineDefault=this.inputsInline,"function"==typeof this.onchange&&this.setOnChange(this.onchange)},t.Block.COLLAPSED_INPUT_NAME=t.constants.COLLAPSED_INPUT_NAME,t.Block.COLLAPSED_FIELD_NAME=t.constants.COLLAPSED_FIELD_NAME,t.Block.prototype.data=null,t.Block.prototype.disposed=!1,t.Block.prototype.hue_=null,t.Block.prototype.colour_="#000000",t.Block.prototype.styleName_="",t.Block.prototype.dispose=function(e){if(this.workspace){this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_),this.unplug(e),t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_DELETE))(this)),t.Events.disable();try{this.workspace&&(this.workspace.removeTopBlock(this),this.workspace.removeTypedBlock(this),this.workspace.removeBlockById(this.id),this.workspace=null),t.selected==this&&(t.selected=null);for(var n=this.childBlocks_.length-1;0<=n;n--)this.childBlocks_[n].dispose(!1);n=0;for(var i;i=this.inputList[n];n++)i.dispose();this.inputList.length=0;var r,o=this.getConnections_(!0);for(n=0;r=o[n];n++)r.dispose()}finally{t.Events.enable(),this.disposed=!0}}},t.Block.prototype.initModel=function(){for(var t,e=0;t=this.inputList[e];e++)for(var n,i=0;n=t.fieldRow[i];i++)n.initModel&&n.initModel()},t.Block.prototype.unplug=function(t){this.outputConnection?this.unplugFromRow_(t):this.previousConnection&&this.unplugFromStack_(t)},t.Block.prototype.unplugFromRow_=function(t){var e=null;this.outputConnection.isConnected()&&(e=this.outputConnection.targetConnection,this.outputConnection.disconnect()),e&&t&&(t=this.getOnlyValueConnection_())&&t.isConnected()&&!t.targetBlock().isShadow()&&((t=t.targetConnection).disconnect(),this.workspace.connectionChecker.canConnect(t,e,!1)?e.connect(t):t.onFailedConnect(e))},t.Block.prototype.getOnlyValueConnection_=function(){for(var e=null,n=0;n<this.inputList.length;n++){var i=this.inputList[n].connection;if(i&&i.type==t.connectionTypes.INPUT_VALUE&&i.targetConnection){if(e)return null;e=i}}return e},t.Block.prototype.unplugFromStack_=function(t){var e=null;this.previousConnection.isConnected()&&(e=this.previousConnection.targetConnection,this.previousConnection.disconnect());var n=this.getNextBlock();t&&n&&!n.isShadow()&&((t=this.nextConnection.targetConnection).disconnect(),e&&this.workspace.connectionChecker.canConnect(e,t,!1)&&e.connect(t))},t.Block.prototype.getConnections_=function(t){t=[],this.outputConnection&&t.push(this.outputConnection),this.previousConnection&&t.push(this.previousConnection),this.nextConnection&&t.push(this.nextConnection);for(var e,n=0;e=this.inputList[n];n++)e.connection&&t.push(e.connection);return t},t.Block.prototype.lastConnectionInStack=function(t){for(var e=this.nextConnection;e;){var n=e.targetBlock();if(!n||t&&n.isShadow())return e;e=n.nextConnection}return null},t.Block.prototype.bumpNeighbours=function(){},t.Block.prototype.getParent=function(){return this.parentBlock_},t.Block.prototype.getInputWithBlock=function(t){for(var e,n=0;e=this.inputList[n];n++)if(e.connection&&e.connection.targetBlock()==t)return e;return null},t.Block.prototype.getSurroundParent=function(){var t=this;do{var e=t;if(!(t=t.getParent()))return null}while(t.getNextBlock()==e);return t},t.Block.prototype.getNextBlock=function(){return this.nextConnection&&this.nextConnection.targetBlock()},t.Block.prototype.getPreviousBlock=function(){return this.previousConnection&&this.previousConnection.targetBlock()},t.Block.prototype.getFirstStatementConnection=function(){for(var e,n=0;e=this.inputList[n];n++)if(e.connection&&e.connection.type==t.connectionTypes.NEXT_STATEMENT)return e.connection;return null},t.Block.prototype.getRootBlock=function(){var t=this;do{var e=t;t=e.parentBlock_}while(t);return e},t.Block.prototype.getTopStackBlock=function(){var t=this;do{var e=t.getPreviousBlock()}while(e&&e.getNextBlock()==t&&(t=e));return t},t.Block.prototype.getChildren=function(t){if(!t)return this.childBlocks_;t=[];for(var e,n=0;e=this.inputList[n];n++)e.connection&&(e=e.connection.targetBlock())&&t.push(e);return(n=this.getNextBlock())&&t.push(n),t},t.Block.prototype.setParent=function(e){if(e!=this.parentBlock_){if(this.parentBlock_){if(t.utils.arrayRemove(this.parentBlock_.childBlocks_,this),this.previousConnection&&this.previousConnection.isConnected())throw Error("Still connected to previous block.");if(this.outputConnection&&this.outputConnection.isConnected())throw Error("Still connected to parent block.");this.parentBlock_=null}else this.workspace.removeTopBlock(this);(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}},t.Block.prototype.getDescendants=function(t){for(var e,n=[this],i=this.getChildren(t),r=0;e=i[r];r++)n.push.apply(n,e.getDescendants(t));return n},t.Block.prototype.isDeletable=function(){return this.deletable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)},t.Block.prototype.setDeletable=function(t){this.deletable_=t},t.Block.prototype.isMovable=function(){return this.movable_&&!this.isShadow_&&!(this.workspace&&this.workspace.options.readOnly)},t.Block.prototype.setMovable=function(t){this.movable_=t},t.Block.prototype.isDuplicatable=function(){return!this.workspace.hasBlockLimits()||this.workspace.isCapacityAvailable(t.utils.getBlockTypeCounts(this,!0))},t.Block.prototype.isShadow=function(){return this.isShadow_},t.Block.prototype.setShadow=function(t){this.isShadow_=t},t.Block.prototype.isInsertionMarker=function(){return this.isInsertionMarker_},t.Block.prototype.setInsertionMarker=function(t){this.isInsertionMarker_=t},t.Block.prototype.isEditable=function(){return this.editable_&&!(this.workspace&&this.workspace.options.readOnly)},t.Block.prototype.setEditable=function(t){this.editable_=t,t=0;for(var e;e=this.inputList[t];t++)for(var n,i=0;n=e.fieldRow[i];i++)n.updateEditable()},t.Block.prototype.isDisposed=function(){return this.disposed},t.Block.prototype.getMatchingConnection=function(t,e){var n=this.getConnections_(!0);if(t=t.getConnections_(!0),n.length!=t.length)throw Error("Connection lists did not match in length.");for(var i=0;i<t.length;i++)if(t[i]==e)return n[i];return null},t.Block.prototype.setHelpUrl=function(t){this.helpUrl=t},t.Block.prototype.setTooltip=function(t){this.tooltip=t},t.Block.prototype.getTooltip=function(){return t.Tooltip.getTooltipOfObject(this)},t.Block.prototype.getColour=function(){return this.colour_},t.Block.prototype.getStyleName=function(){return this.styleName_},t.Block.prototype.getHue=function(){return this.hue_},t.Block.prototype.setColour=function(e){e=t.utils.parseBlockColour(e),this.hue_=e.hue,this.colour_=e.hex},t.Block.prototype.setStyle=function(t){this.styleName_=t},t.Block.prototype.setOnChange=function(t){if(t&&"function"!=typeof t)throw Error("onchange must be a function.");this.onchangeWrapper_&&this.workspace.removeChangeListener(this.onchangeWrapper_),(this.onchange=t)&&(this.onchangeWrapper_=t.bind(this),this.workspace.addChangeListener(this.onchangeWrapper_))},t.Block.prototype.getField=function(t){if("string"!=typeof t)throw TypeError("Blockly.Block.prototype.getField expects a string with the field name but received "+(void 0===t?"nothing":t+" of type "+typeof t)+" instead");for(var e,n=0;e=this.inputList[n];n++)for(var i,r=0;i=e.fieldRow[r];r++)if(i.name===t)return i;return null},t.Block.prototype.getVars=function(){for(var t,e=[],n=0;t=this.inputList[n];n++)for(var i,r=0;i=t.fieldRow[r];r++)i.referencesVariables()&&e.push(i.getValue());return e},t.Block.prototype.getVarModels=function(){for(var t,e=[],n=0;t=this.inputList[n];n++)for(var i,r=0;i=t.fieldRow[r];r++)i.referencesVariables()&&(i=this.workspace.getVariableById(i.getValue()))&&e.push(i);return e},t.Block.prototype.updateVarName=function(t){for(var e,n=0;e=this.inputList[n];n++)for(var i,r=0;i=e.fieldRow[r];r++)i.referencesVariables()&&t.getId()==i.getValue()&&i.refreshVariableName()},t.Block.prototype.renameVarById=function(t,e){for(var n,i=0;n=this.inputList[i];i++)for(var r,o=0;r=n.fieldRow[o];o++)r.referencesVariables()&&t==r.getValue()&&r.setValue(e)},t.Block.prototype.getFieldValue=function(t){return(t=this.getField(t))?t.getValue():null},t.Block.prototype.setFieldValue=function(t,e){var n=this.getField(e);if(!n)throw Error('Field "'+e+'" not found.');n.setValue(t)},t.Block.prototype.setPreviousStatement=function(e,n){if(e){if(void 0===n&&(n=null),!this.previousConnection){if(this.outputConnection)throw Error("Remove output connection prior to adding previous connection.");this.previousConnection=this.makeConnection_(t.connectionTypes.PREVIOUS_STATEMENT)}this.previousConnection.setCheck(n)}else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose(),this.previousConnection=null}},t.Block.prototype.setNextStatement=function(e,n){if(e)void 0===n&&(n=null),this.nextConnection||(this.nextConnection=this.makeConnection_(t.connectionTypes.NEXT_STATEMENT)),this.nextConnection.setCheck(n);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose(),this.nextConnection=null}},t.Block.prototype.setOutput=function(e,n){if(e){if(void 0===n&&(n=null),!this.outputConnection){if(this.previousConnection)throw Error("Remove previous connection prior to adding output connection.");this.outputConnection=this.makeConnection_(t.connectionTypes.OUTPUT_VALUE)}this.outputConnection.setCheck(n)}else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose(),this.outputConnection=null}},t.Block.prototype.setInputsInline=function(e){this.inputsInline!=e&&(t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)},t.Block.prototype.getInputsInline=function(){if(void 0!=this.inputsInline)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1].type==t.inputTypes.DUMMY&&this.inputList[e].type==t.inputTypes.DUMMY)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1].type==t.inputTypes.VALUE&&this.inputList[e].type==t.inputTypes.DUMMY)return!0;return!1},t.Block.prototype.setOutputShape=function(t){this.outputShape_=t},t.Block.prototype.getOutputShape=function(){return this.outputShape_},t.Block.prototype.isEnabled=function(){return!this.disabled},t.Block.prototype.setEnabled=function(e){this.isEnabled()!=e&&(t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this,"disabled",null,this.disabled,!e)),this.disabled=!e)},t.Block.prototype.getInheritedDisabled=function(){for(var t=this.getSurroundParent();t;){if(t.disabled)return!0;t=t.getSurroundParent()}return!1},t.Block.prototype.isCollapsed=function(){return this.collapsed_},t.Block.prototype.setCollapsed=function(e){this.collapsed_!=e&&(t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)},t.Block.prototype.toString=function(e,n){function i(t){var e=t.getCheck();return!e&&t.targetConnection&&(e=t.targetConnection.getCheck()),!!e&&(-1!=e.indexOf("Boolean")||-1!=e.indexOf("Number"))}function r(){a&&a.getType()==l.getType()&&a.getLocation()==l.getLocation()&&(a=null)}var o=[];n=n||"?";var s=t.ASTNode.NAVIGATE_ALL_FIELDS;t.ASTNode.NAVIGATE_ALL_FIELDS=!0;for(var a=t.ASTNode.createBlockNode(this),l=a;a;){switch(a.getType()){case t.ASTNode.types.INPUT:var u=a.getLocation();a.in()?i(u)&&o.push("("):o.push(n);break;case t.ASTNode.types.FIELD:(u=a.getLocation()).name!=t.constants.COLLAPSED_FIELD_NAME&&o.push(u.getText())}if(!(a=(u=a).in()||u.next())){for(a=u.out(),r();a&&!a.next();)a=a.out(),r(),a&&a.getType()==t.ASTNode.types.INPUT&&i(a.getLocation())&&o.push(")");a&&(a=a.next())}}for(t.ASTNode.NAVIGATE_ALL_FIELDS=s,n=2;n<o.length;n++)"("==o[n-2]&&")"==o[n]&&(o[n-2]=o[n-1],o.splice(n-1,2));return o=(o=o.reduce(function(t,e){return t+("("==t.substr(-1)||")"==e?"":" ")+e},"")).trim()||"???",e&&o.length>e&&(o=o.substring(0,e-3)+"..."),o},t.Block.prototype.appendValueInput=function(e){return this.appendInput_(t.inputTypes.VALUE,e)},t.Block.prototype.appendStatementInput=function(e){return this.appendInput_(t.inputTypes.STATEMENT,e)},t.Block.prototype.appendDummyInput=function(e){return this.appendInput_(t.inputTypes.DUMMY,e||"")},t.Block.prototype.jsonInit=function(e){var n=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(n+"Must not have both an output and a previousStatement.");if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(n+"Must not have both a colour and a style.");e.style?this.jsonInitStyle_(e,n):this.jsonInitColour_(e,n);for(var i=0;void 0!==e["message"+i];)this.interpolate_(e["message"+i],e["args"+i]||[],e["lastDummyAlign"+i],n),i++;if(void 0!==e.inputsInline&&this.setInputsInline(e.inputsInline),void 0!==e.output&&this.setOutput(!0,e.output),void 0!==e.outputShape&&this.setOutputShape(e.outputShape),void 0!==e.previousStatement&&this.setPreviousStatement(!0,e.previousStatement),void 0!==e.nextStatement&&this.setNextStatement(!0,e.nextStatement),void 0!==e.tooltip&&(i=e.tooltip,i=t.utils.replaceMessageReferences(i),this.setTooltip(i)),void 0!==e.enableContextMenu&&(i=e.enableContextMenu,this.contextMenu=!!i),void 0!==e.helpUrl&&(i=e.helpUrl,i=t.utils.replaceMessageReferences(i),this.setHelpUrl(i)),"string"==typeof e.extensions&&(console.warn(n+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+e.type+"' block."),e.extensions=[e.extensions]),void 0!==e.mutator&&t.Extensions.apply(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(n=0;n<e.length;++n)t.Extensions.apply(e[n],this,!1)},t.Block.prototype.jsonInitColour_=function(t,e){if("colour"in t)if(void 0===t.colour)console.warn(e+"Undefined colour value.");else{t=t.colour;try{this.setColour(t)}catch(n){console.warn(e+"Illegal colour value: ",t)}}},t.Block.prototype.jsonInitStyle_=function(t,e){t=t.style;try{this.setStyle(t)}catch(n){console.warn(e+"Style does not exist: ",t)}},t.Block.prototype.mixin=function(e,n){if(void 0!==n&&"boolean"!=typeof n)throw Error("opt_disableCheck must be a boolean if provided");if(!n){for(var i in n=[],e)void 0!==this[i]&&n.push(i);if(n.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(n))}t.utils.object.mixin(this,e)},t.Block.prototype.interpolate_=function(e,n,i,r){e=t.utils.tokenizeInterpolation(e),this.validateTokens_(e,n.length),n=this.interpolateArguments_(e,n,i),i=[],e=0;for(var o;o=n[e];e++)if(this.isInputKeyword_(o.type)){if(o=this.inputFromJson_(o,r)){for(var s,a=0;s=i[a];a++)o.appendField(s[0],s[1]);i.length=0}}else(a=this.fieldFromJson_(o))&&i.push([a,o.name])},t.Block.prototype.validateTokens_=function(t,e){for(var n=[],i=0,r=0;r<t.length;r++){var o=t[r];if("number"==typeof o){if(1>o||o>e)throw Error('Block "'+this.type+'": Message index %'+o+" out of range.");if(n[o])throw Error('Block "'+this.type+'": Message index %'+o+" duplicated.");n[o]=!0,i++}}if(i!=e)throw Error('Block "'+this.type+'": Message does not reference all '+e+" arg(s).")},t.Block.prototype.interpolateArguments_=function(t,e,n){for(var i=[],r=0;r<t.length;r++){var o=t[r];"number"==typeof o&&(o=e[o-1]),("string"!=typeof o||(o=this.stringToFieldJson_(o)))&&i.push(o)}return(t=i.length)&&!this.isInputKeyword_(i[t-1].type)&&(t={type:"input_dummy"},n&&(t.align=n),i.push(t)),i},t.Block.prototype.fieldFromJson_=function(e){var n=t.fieldRegistry.fromJson(e);return!n&&e.alt?"string"==typeof e.alt?(e=this.stringToFieldJson_(e.alt))?this.fieldFromJson_(e):null:this.fieldFromJson_(e.alt):n},t.Block.prototype.inputFromJson_=function(e,n){var i={LEFT:t.constants.ALIGN.LEFT,RIGHT:t.constants.ALIGN.RIGHT,CENTRE:t.constants.ALIGN.CENTRE,CENTER:t.constants.ALIGN.CENTRE},r=null;switch(e.type){case"input_value":r=this.appendValueInput(e.name);break;case"input_statement":r=this.appendStatementInput(e.name);break;case"input_dummy":r=this.appendDummyInput(e.name)}return r?(e.check&&r.setCheck(e.check),e.align&&(void 0===(i=i[e.align.toUpperCase()])?console.warn(n+"Illegal align value: ",e.align):r.setAlign(i)),r):null},t.Block.prototype.isInputKeyword_=function(t){return"input_value"==t||"input_statement"==t||"input_dummy"==t},t.Block.prototype.stringToFieldJson_=function(t){return(t=t.trim())?{type:"field_label",text:t}:null},t.Block.prototype.appendInput_=function(e,n){var i=null;return e!=t.inputTypes.VALUE&&e!=t.inputTypes.STATEMENT||(i=this.makeConnection_(e)),e==t.inputTypes.STATEMENT&&this.statementInputCount++,e=new t.Input(e,n,this,i),this.inputList.push(e),e},t.Block.prototype.moveInputBefore=function(t,e){if(t!=e){for(var n,i=-1,r=e?-1:this.inputList.length,o=0;n=this.inputList[o];o++)if(n.name==t){if(i=o,-1!=r)break}else if(e&&n.name==e&&(r=o,-1!=i))break;if(-1==i)throw Error('Named input "'+t+'" not found.');if(-1==r)throw Error('Reference input "'+e+'" not found.');this.moveNumberedInputBefore(i,r)}},t.Block.prototype.moveNumberedInputBefore=function(t,e){if(t==e)throw Error("Can't move input to itself.");if(t>=this.inputList.length)throw RangeError("Input index "+t+" out of bounds.");if(e>this.inputList.length)throw RangeError("Reference input "+e+" out of bounds.");var n=this.inputList[t];this.inputList.splice(t,1),t<e&&e--,this.inputList.splice(e,0,n)},t.Block.prototype.removeInput=function(e,n){for(var i,r=0;i=this.inputList[r];r++)if(i.name==e)return i.type==t.inputTypes.STATEMENT&&this.statementInputCount--,i.dispose(),this.inputList.splice(r,1),!0;if(n)return!1;throw Error("Input not found: "+e)},t.Block.prototype.getInput=function(t){for(var e,n=0;e=this.inputList[n];n++)if(e.name==t)return e;return null},t.Block.prototype.getInputTargetBlock=function(t){return(t=this.getInput(t))&&t.connection&&t.connection.targetBlock()},t.Block.prototype.getCommentText=function(){return this.commentModel.text},t.Block.prototype.setCommentText=function(e){this.commentModel.text!=e&&(t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this,"comment",null,this.commentModel.text,e)),this.comment=this.commentModel.text=e)},t.Block.prototype.setWarningText=function(t,e){},t.Block.prototype.setMutator=function(t){},t.Block.prototype.getRelativeToSurfaceXY=function(){return this.xy_},t.Block.prototype.moveBy=function(e,n){if(this.parentBlock_)throw Error("Block has parent.");var i=new(t.Events.get(t.Events.BLOCK_MOVE))(this);this.xy_.translate(e,n),i.recordNew(),t.Events.fire(i)},t.Block.prototype.makeConnection_=function(e){return new t.Connection(this,e)},t.Block.prototype.allInputsFilled=function(t){if(void 0===t&&(t=!0),!t&&this.isShadow())return!1;for(var e,n=0;e=this.inputList[n];n++)if(e.connection&&(!(e=e.connection.targetBlock())||!e.allInputsFilled(t)))return!1;return!(n=this.getNextBlock())||n.allInputsFilled(t)},t.Block.prototype.toDevString=function(){var t=this.type?'"'+this.type+'" block':"Block";return this.id&&(t+=' (id="'+this.id+'")'),t},t.blockRendering.IPathObject=function(t,e){},t.utils.KeyCodes={WIN_KEY_FF_LINUX:0,MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS_SIGN:43,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,FF_SEMICOLON:59,FF_EQUALS:61,FF_DASH:173,FF_HASH:163,QUESTION_MARK:63,AT_SIGN:64,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLL_LOCK:145,FIRST_MEDIA_KEY:166,LAST_MEDIA_KEY:183,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,TILDE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,MAC_WK_CMD_LEFT:91,MAC_WK_CMD_RIGHT:93,WIN_IME:229,VK_NONAME:252,PHANTOM:255},t.Menu=function(){this.menuItems_=[],this.roleName_=this.element_=this.onKeyDownHandler_=this.mouseLeaveHandler_=this.mouseEnterHandler_=this.clickHandler_=this.mouseOverHandler_=this.highlightedItem_=this.openingCoords=null},t.Menu.prototype.addChild=function(t){this.menuItems_.push(t)},t.Menu.prototype.render=function(e){var n=document.createElement("div");n.className="blocklyMenu goog-menu blocklyNonSelectable",n.tabIndex=0,this.roleName_&&t.utils.aria.setRole(n,this.roleName_),this.element_=n;for(var i,r=0;i=this.menuItems_[r];r++)n.appendChild(i.createDom());this.mouseOverHandler_=t.browserEvents.conditionalBind(n,"mouseover",this,this.handleMouseOver_,!0),this.clickHandler_=t.browserEvents.conditionalBind(n,"click",this,this.handleClick_,!0),this.mouseEnterHandler_=t.browserEvents.conditionalBind(n,"mouseenter",this,this.handleMouseEnter_,!0),this.mouseLeaveHandler_=t.browserEvents.conditionalBind(n,"mouseleave",this,this.handleMouseLeave_,!0),this.onKeyDownHandler_=t.browserEvents.conditionalBind(n,"keydown",this,this.handleKeyEvent_),e.appendChild(n)},t.Menu.prototype.getElement=function(){return this.element_},t.Menu.prototype.focus=function(){var e=this.getElement();e&&(e.focus({preventScroll:!0}),t.utils.dom.addClass(e,"blocklyFocused"))},t.Menu.prototype.blur_=function(){var e=this.getElement();e&&(e.blur(),t.utils.dom.removeClass(e,"blocklyFocused"))},t.Menu.prototype.setRole=function(t){this.roleName_=t},t.Menu.prototype.dispose=function(){this.mouseOverHandler_&&(t.browserEvents.unbind(this.mouseOverHandler_),this.mouseOverHandler_=null),this.clickHandler_&&(t.browserEvents.unbind(this.clickHandler_),this.clickHandler_=null),this.mouseEnterHandler_&&(t.browserEvents.unbind(this.mouseEnterHandler_),this.mouseEnterHandler_=null),this.mouseLeaveHandler_&&(t.browserEvents.unbind(this.mouseLeaveHandler_),this.mouseLeaveHandler_=null),this.onKeyDownHandler_&&(t.browserEvents.unbind(this.onKeyDownHandler_),this.onKeyDownHandler_=null);for(var e,n=0;e=this.menuItems_[n];n++)e.dispose();this.element_=null},t.Menu.prototype.getMenuItem_=function(e){for(var n=this.getElement();e&&e!=n;){if(t.utils.dom.hasClass(e,"blocklyMenuItem"))for(var i,r=0;i=this.menuItems_[r];r++)if(i.getElement()==e)return i;e=e.parentElement}return null},t.Menu.prototype.setHighlighted=function(e){var n=this.highlightedItem_;n&&(n.setHighlighted(!1),this.highlightedItem_=null),e&&(e.setHighlighted(!0),this.highlightedItem_=e,n=this.getElement(),t.utils.style.scrollIntoContainerView(e.getElement(),n),t.utils.aria.setState(n,t.utils.aria.State.ACTIVEDESCENDANT,e.getId()))},t.Menu.prototype.highlightNext=function(){var t=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(t,1)},t.Menu.prototype.highlightPrevious=function(){var t=this.menuItems_.indexOf(this.highlightedItem_);this.highlightHelper_(0>t?this.menuItems_.length:t,-1)},t.Menu.prototype.highlightFirst_=function(){this.highlightHelper_(-1,1)},t.Menu.prototype.highlightLast_=function(){this.highlightHelper_(this.menuItems_.length,-1)},t.Menu.prototype.highlightHelper_=function(t,e){t+=e;for(var n;n=this.menuItems_[t];){if(n.isEnabled()){this.setHighlighted(n);break}t+=e}},t.Menu.prototype.handleMouseOver_=function(t){(t=this.getMenuItem_(t.target))&&(t.isEnabled()?this.highlightedItem_!=t&&this.setHighlighted(t):this.setHighlighted(null))},t.Menu.prototype.handleClick_=function(e){var n=this.openingCoords;if(this.openingCoords=null,n&&"number"==typeof e.clientX){var i=new t.utils.Coordinate(e.clientX,e.clientY);if(1>t.utils.Coordinate.distance(n,i))return}(e=this.getMenuItem_(e.target))&&e.performAction()},t.Menu.prototype.handleMouseEnter_=function(t){this.focus()},t.Menu.prototype.handleMouseLeave_=function(t){this.getElement()&&(this.blur_(),this.setHighlighted(null))},t.Menu.prototype.handleKeyEvent_=function(e){if(this.menuItems_.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var n=this.highlightedItem_;switch(e.keyCode){case t.utils.KeyCodes.ENTER:case t.utils.KeyCodes.SPACE:n&&n.performAction();break;case t.utils.KeyCodes.UP:this.highlightPrevious();break;case t.utils.KeyCodes.DOWN:this.highlightNext();break;case t.utils.KeyCodes.PAGE_UP:case t.utils.KeyCodes.HOME:this.highlightFirst_();break;case t.utils.KeyCodes.PAGE_DOWN:case t.utils.KeyCodes.END:this.highlightLast_();break;default:return}e.preventDefault(),e.stopPropagation()}},t.Menu.prototype.getSize=function(){var e=this.getElement(),n=t.utils.style.getSize(e);return n.height=e.scrollHeight,n},t.MenuItem=function(t,e){this.content_=t,this.value_=e,this.enabled_=!0,this.element_=null,this.rightToLeft_=!1,this.roleName_=null,this.highlight_=this.checked_=this.checkable_=!1,this.actionHandler_=null},t.MenuItem.prototype.createDom=function(){var e=document.createElement("div");e.id=t.utils.IdGenerator.getNextUniqueId(),this.element_=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled_?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked_?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight_?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft_?"blocklyMenuItemRtl goog-menuitem-rtl ":"");var n=document.createElement("div");if(n.className="blocklyMenuItemContent goog-menuitem-content",this.checkable_){var i=document.createElement("div");i.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",n.appendChild(i)}return i=this.content_,"string"==typeof this.content_&&(i=document.createTextNode(this.content_)),n.appendChild(i),e.appendChild(n),this.roleName_&&t.utils.aria.setRole(e,this.roleName_),t.utils.aria.setState(e,t.utils.aria.State.SELECTED,this.checkable_&&this.checked_||!1),t.utils.aria.setState(e,t.utils.aria.State.DISABLED,!this.enabled_),e},t.MenuItem.prototype.dispose=function(){this.element_=null},t.MenuItem.prototype.getElement=function(){return this.element_},t.MenuItem.prototype.getId=function(){return this.element_.id},t.MenuItem.prototype.getValue=function(){return this.value_},t.MenuItem.prototype.setRightToLeft=function(t){this.rightToLeft_=t},t.MenuItem.prototype.setRole=function(t){this.roleName_=t},t.MenuItem.prototype.setCheckable=function(t){this.checkable_=t},t.MenuItem.prototype.setChecked=function(t){this.checked_=t},t.MenuItem.prototype.setHighlighted=function(e){this.highlight_=e;var n=this.getElement();n&&this.isEnabled()&&(e?(t.utils.dom.addClass(n,"blocklyMenuItemHighlight"),t.utils.dom.addClass(n,"goog-menuitem-highlight")):(t.utils.dom.removeClass(n,"blocklyMenuItemHighlight"),t.utils.dom.removeClass(n,"goog-menuitem-highlight")))},t.MenuItem.prototype.isEnabled=function(){return this.enabled_},t.MenuItem.prototype.setEnabled=function(t){this.enabled_=t},t.MenuItem.prototype.performAction=function(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)},t.MenuItem.prototype.onAction=function(t,e){this.actionHandler_=t.bind(e)},t.ContextMenu={},t.ContextMenu.currentBlock=null,t.ContextMenu.menu_=null,t.ContextMenu.show=function(e,n,i){if(t.WidgetDiv.show(t.ContextMenu,i,t.ContextMenu.dispose),n.length){var r=t.ContextMenu.populate_(n,i);t.ContextMenu.menu_=r,t.ContextMenu.position_(r,e,i),setTimeout(function(){r.focus()},1),t.ContextMenu.currentBlock=null}else t.ContextMenu.hide()},t.ContextMenu.populate_=function(e,n){var i=new t.Menu;i.setRole(t.utils.aria.Role.MENU);for(var r,o=0;r=e[o];o++){var s=new t.MenuItem(r.text);s.setRightToLeft(n),s.setRole(t.utils.aria.Role.MENUITEM),i.addChild(s),s.setEnabled(r.enabled),r.enabled&&s.onAction(function(e){t.ContextMenu.hide(),this.callback(this.scope)},r)}return i},t.ContextMenu.position_=function(e,n,i){var r=t.utils.getViewportBBox();n=new t.utils.Rect(n.clientY+r.top,n.clientY+r.top,n.clientX+r.left,n.clientX+r.left),t.ContextMenu.createWidget_(e);var o=e.getSize();i&&(n.left+=o.width,n.right+=o.width,r.left+=o.width,r.right+=o.width),t.WidgetDiv.positionWithAnchor(r,n,o,i),e.focus()},t.ContextMenu.createWidget_=function(e){e.render(t.WidgetDiv.DIV);var n=e.getElement();t.utils.dom.addClass(n,"blocklyContextMenu"),t.browserEvents.conditionalBind(n,"contextmenu",null,t.utils.noEvent),e.focus()},t.ContextMenu.hide=function(){t.WidgetDiv.hideIfOwner(t.ContextMenu),t.ContextMenu.currentBlock=null},t.ContextMenu.dispose=function(){t.ContextMenu.menu_&&(t.ContextMenu.menu_.dispose(),t.ContextMenu.menu_=null)},t.ContextMenu.callbackFactory=function(e,n){return function(){t.Events.disable();try{var i=t.Xml.domToBlock(n,e.workspace),r=e.getRelativeToSurfaceXY();r.x=e.RTL?r.x-t.SNAP_RADIUS:r.x+t.SNAP_RADIUS,r.y+=2*t.SNAP_RADIUS,i.moveBy(r.x,r.y)}finally{t.Events.enable()}t.Events.isEnabled()&&!i.isShadow()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(i)),i.select()}},t.ContextMenu.commentDeleteOption=function(e){return{text:t.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){t.Events.setGroup(!0),e.dispose(!0,!0),t.Events.setGroup(!1)}}},t.ContextMenu.commentDuplicateOption=function(e){return{text:t.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){t.duplicate(e)}}},t.ContextMenu.workspaceCommentOption=function(e,n){if(!t.WorkspaceCommentSvg)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var i={enabled:!t.utils.userAgent.IE};return i.text=t.Msg.ADD_COMMENT,i.callback=function(){var i=new t.WorkspaceCommentSvg(e,t.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,t.WorkspaceCommentSvg.DEFAULT_SIZE,t.WorkspaceCommentSvg.DEFAULT_SIZE),r=e.getInjectionDiv().getBoundingClientRect();r=new t.utils.Coordinate(n.clientX-r.left,n.clientY-r.top);var o=e.getOriginOffsetInPixels();(r=t.utils.Coordinate.difference(r,o)).scale(1/e.scale),i.moveBy(r.x,r.y),e.rendered&&(i.initSvg(),i.render(),i.select())},i},t.ContextMenuRegistry=function(){t.ContextMenuRegistry.registry=this,this.registry_=Object.create(null)},t.ContextMenuRegistry.ScopeType={BLOCK:"block",WORKSPACE:"workspace"},t.ContextMenuRegistry.registry=null,t.ContextMenuRegistry.prototype.register=function(t){if(this.registry_[t.id])throw Error('Menu item with ID "'+t.id+'" is already registered.');this.registry_[t.id]=t},t.ContextMenuRegistry.prototype.unregister=function(t){if(!this.registry_[t])throw Error('Menu item with ID "'+t+'" not found.');delete this.registry_[t]},t.ContextMenuRegistry.prototype.getItem=function(t){return this.registry_[t]||null},t.ContextMenuRegistry.prototype.getContextMenuOptions=function(t,e){var n=[],i=this.registry_;return Object.keys(i).forEach(function(r){if(r=i[r],t==r.scopeType){var o=r.preconditionFn(e);"hidden"!=o&&(r={text:"function"==typeof r.displayText?r.displayText(e):r.displayText,enabled:"enabled"==o,callback:r.callback,scope:e,weight:r.weight},n.push(r))}}),n.sort(function(t,e){return t.weight-e.weight}),n},new t.ContextMenuRegistry,t.Events.Selected=function(e,n,i){t.Events.Selected.superClass_.constructor.call(this,i),this.oldElementId=e,this.newElementId=n},t.utils.object.inherits(t.Events.Selected,t.Events.UiBase),t.Events.Selected.prototype.type=t.Events.SELECTED,t.Events.Selected.prototype.toJson=function(){var e=t.Events.Selected.superClass_.toJson.call(this);return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e},t.Events.Selected.prototype.fromJson=function(e){t.Events.Selected.superClass_.fromJson.call(this,e),this.oldElementId=e.oldElementId,this.newElementId=e.newElementId},t.registry.register(t.registry.Type.EVENT,t.Events.SELECTED,t.Events.Selected),t.IBoundedElement=function(){},t.ICopyable=function(){},t.RenderedConnection=function(e,n){t.RenderedConnection.superClass_.constructor.call(this,e,n),this.db_=e.workspace.connectionDBList[n],this.dbOpposite_=e.workspace.connectionDBList[t.OPPOSITE_TYPE[n]],this.offsetInBlock_=new t.utils.Coordinate(0,0),this.trackedState_=t.RenderedConnection.TrackedState.WILL_TRACK,this.targetConnection=null},t.utils.object.inherits(t.RenderedConnection,t.Connection),t.RenderedConnection.TrackedState={WILL_TRACK:-1,UNTRACKED:0,TRACKED:1},t.RenderedConnection.prototype.dispose=function(){t.RenderedConnection.superClass_.dispose.call(this),this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)},t.RenderedConnection.prototype.getSourceBlock=function(){return t.RenderedConnection.superClass_.getSourceBlock.call(this)},t.RenderedConnection.prototype.targetBlock=function(){return t.RenderedConnection.superClass_.targetBlock.call(this)},t.RenderedConnection.prototype.distanceFrom=function(t){var e=this.x-t.x;return t=this.y-t.y,Math.sqrt(e*e+t*t)},t.RenderedConnection.prototype.bumpAwayFrom=function(e){if(!this.sourceBlock_.workspace.isDragging()){var n=this.sourceBlock_.getRootBlock();if(!n.isInFlyout){var i=!1;if(!n.isMovable()){if(!(n=e.getSourceBlock().getRootBlock()).isMovable())return;e=this,i=!0}var r=t.selected==n;r||n.addSelect();var o=e.x+t.SNAP_RADIUS+Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.x,s=e.y+t.SNAP_RADIUS+Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.y;i&&(s=-s),n.RTL&&(o=e.x-t.SNAP_RADIUS-Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.x),n.moveBy(o,s),r||n.removeSelect()}}},t.RenderedConnection.prototype.moveTo=function(e,n){this.trackedState_==t.RenderedConnection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,n),this.trackedState_=t.RenderedConnection.TrackedState.TRACKED):this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,n)),this.x=e,this.y=n},t.RenderedConnection.prototype.moveBy=function(t,e){this.moveTo(this.x+t,this.y+e)},t.RenderedConnection.prototype.moveToOffset=function(t){this.moveTo(t.x+this.offsetInBlock_.x,t.y+this.offsetInBlock_.y)},t.RenderedConnection.prototype.setOffsetInBlock=function(t,e){this.offsetInBlock_.x=t,this.offsetInBlock_.y=e},t.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_},t.RenderedConnection.prototype.tighten=function(){var e=this.targetConnection.x-this.x,n=this.targetConnection.y-this.y;if(0!=e||0!=n){var i=this.targetBlock(),r=i.getSvgRoot();if(!r)throw Error("block is not rendered.");r=t.utils.getRelativeXY(r),i.getSvgRoot().setAttribute("transform","translate("+(r.x-e)+","+(r.y-n)+")"),i.moveConnections(-e,-n)}},t.RenderedConnection.prototype.closest=function(t,e){return this.dbOpposite_.searchForClosest(this,t,e)},t.RenderedConnection.prototype.highlight=function(){var e=this.sourceBlock_.workspace.getRenderer().getConstants(),n=e.shapeFor(this);this.type==t.connectionTypes.INPUT_VALUE||this.type==t.connectionTypes.OUTPUT_VALUE?(e=e.TAB_OFFSET_FROM_TOP,n=t.utils.svgPaths.moveBy(0,-e)+t.utils.svgPaths.lineOnAxis("v",e)+n.pathDown+t.utils.svgPaths.lineOnAxis("v",e)):(e=e.NOTCH_OFFSET_LEFT-e.CORNER_RADIUS,n=t.utils.svgPaths.moveBy(-e,0)+t.utils.svgPaths.lineOnAxis("h",e)+n.pathLeft+t.utils.svgPaths.lineOnAxis("h",e)),e=this.sourceBlock_.getRelativeToSurfaceXY(),t.Connection.highlightedPath_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyHighlightedConnectionPath",d:n,transform:"translate("+(this.x-e.x)+","+(this.y-e.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())},t.RenderedConnection.prototype.unhighlight=function(){t.utils.dom.removeNode(t.Connection.highlightedPath_),delete t.Connection.highlightedPath_},t.RenderedConnection.prototype.setTracking=function(e){e&&this.trackedState_==t.RenderedConnection.TrackedState.TRACKED||!e&&this.trackedState_==t.RenderedConnection.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db_.addConnection(this,this.y),this.trackedState_=t.RenderedConnection.TrackedState.TRACKED):(this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=t.RenderedConnection.TrackedState.UNTRACKED))},t.RenderedConnection.prototype.stopTrackingAll=function(){if(this.setTracking(!1),this.targetConnection)for(var t=this.targetBlock().getDescendants(!1),e=0;e<t.length;e++){for(var n=t[e],i=n.getConnections_(!0),r=0;r<i.length;r++)i[r].setTracking(!1);for(n=n.getIcons(),r=0;r<n.length;r++)n[r].setVisible(!1)}},t.RenderedConnection.prototype.startTrackingAll=function(){this.setTracking(!0);var e=[];if(this.type!=t.connectionTypes.INPUT_VALUE&&this.type!=t.connectionTypes.NEXT_STATEMENT)return e;var n=this.targetBlock();if(n){if(n.isCollapsed()){var i=[];n.outputConnection&&i.push(n.outputConnection),n.nextConnection&&i.push(n.nextConnection),n.previousConnection&&i.push(n.previousConnection)}else i=n.getConnections_(!0);for(var r=0;r<i.length;r++)e.push.apply(e,i[r].startTrackingAll());e.length||(e[0]=n)}return e},t.RenderedConnection.prototype.isConnectionAllowed=function(e,n){return t.utils.deprecation.warn("RenderedConnection.prototype.isConnectionAllowed","July 2020","July 2021","Blockly.Workspace.prototype.getConnectionChecker().canConnect"),!(this.distanceFrom(e)>n)&&t.RenderedConnection.superClass_.isConnectionAllowed.call(this,e)},t.RenderedConnection.prototype.onFailedConnect=function(e){var n=this.getSourceBlock();if(t.Events.recordUndo){var i=t.Events.getGroup();setTimeout(function(){n.isDisposed()||n.getParent()||(t.Events.setGroup(i),this.bumpAwayFrom(e),t.Events.setGroup(!1))}.bind(this),t.BUMP_DELAY)}},t.RenderedConnection.prototype.disconnectInternal_=function(e,n){t.RenderedConnection.superClass_.disconnectInternal_.call(this,e,n),e.rendered&&e.render(),n.rendered&&(n.updateDisabled(),n.render(),n.getSvgRoot().style.display="block")},t.RenderedConnection.prototype.respawnShadow_=function(){t.RenderedConnection.superClass_.respawnShadow_.call(this);var e=this.targetBlock();e&&(e.initSvg(),e.render(!1),(e=this.getSourceBlock()).rendered&&e.render())},t.RenderedConnection.prototype.neighbours=function(t){return this.dbOpposite_.getNeighbours(this,t)},t.RenderedConnection.prototype.connect_=function(e){t.RenderedConnection.superClass_.connect_.call(this,e);var n=this.getSourceBlock();e=e.getSourceBlock();var i=n.rendered,r=e.rendered;i&&n.updateDisabled(),r&&e.updateDisabled(),i&&r&&(this.type==t.connectionTypes.NEXT_STATEMENT||this.type==t.connectionTypes.PREVIOUS_STATEMENT?e.render():n.render()),(n=n.getInputWithBlock(e))&&(n=n.isVisible(),e.getSvgRoot().style.display=n?"block":"none")},t.RenderedConnection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())},t.BasicCursor=function(){t.BasicCursor.superClass_.constructor.call(this)},t.utils.object.inherits(t.BasicCursor,t.Cursor),t.BasicCursor.registrationName="basicCursor",t.BasicCursor.prototype.next=function(){var t=this.getCurNode();return t?((t=this.getNextNode_(t,this.validNode_))&&this.setCurNode(t),t):null},t.BasicCursor.prototype.in=function(){return this.next()},t.BasicCursor.prototype.prev=function(){var t=this.getCurNode();return t?((t=this.getPreviousNode_(t,this.validNode_))&&this.setCurNode(t),t):null},t.BasicCursor.prototype.out=function(){return this.prev()},t.BasicCursor.prototype.getNextNode_=function(t,e){if(!t)return null;var n=t.in()||t.next();return e(n)?n:n?this.getNextNode_(n,e):e(t=this.findSiblingOrParent_(t.out()))?t:t?this.getNextNode_(t,e):null},t.BasicCursor.prototype.getPreviousNode_=function(t,e){if(!t)return null;var n=t.prev();return e(n=n?this.getRightMostChild_(n):t.out())?n:n?this.getPreviousNode_(n,e):null},t.BasicCursor.prototype.validNode_=function(e){var n=!1;return(e=e&&e.getType())!=t.ASTNode.types.OUTPUT&&e!=t.ASTNode.types.INPUT&&e!=t.ASTNode.types.FIELD&&e!=t.ASTNode.types.NEXT&&e!=t.ASTNode.types.PREVIOUS&&e!=t.ASTNode.types.WORKSPACE||(n=!0),n},t.BasicCursor.prototype.findSiblingOrParent_=function(t){if(!t)return null;var e=t.next();return e||this.findSiblingOrParent_(t.out())},t.BasicCursor.prototype.getRightMostChild_=function(t){if(!t.in())return t;for(t=t.in();t.next();)t=t.next();return this.getRightMostChild_(t)},t.registry.register(t.registry.Type.CURSOR,t.BasicCursor.registrationName,t.BasicCursor),t.TabNavigateCursor=function(){t.TabNavigateCursor.superClass_.constructor.call(this)},t.utils.object.inherits(t.TabNavigateCursor,t.BasicCursor),t.TabNavigateCursor.prototype.validNode_=function(e){var n=!1,i=e&&e.getType();return e&&(e=e.getLocation(),i==t.ASTNode.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(n=!0)),n},t.BlockSvg=function(e,n,i){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null),this.svgGroup_.translate_="",this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup_,this.style),this.renderIsInProgress_=this.rendered=!1,this.workspace=e,this.previousConnection=this.nextConnection=this.outputConnection=null,this.useDragSurface_=t.utils.is3dSupported()&&!!e.getBlockDragSurface();var r=this.pathObject.svgPath;r.tooltip=this,t.Tooltip.bindMouseEvents(r),t.BlockSvg.superClass_.constructor.call(this,e,n,i),this.svgGroup_.dataset?this.svgGroup_.dataset.id=this.id:t.utils.userAgent.IE&&this.svgGroup_.setAttribute("data-id",this.id)},t.utils.object.inherits(t.BlockSvg,t.Block),t.BlockSvg.prototype.height=0,t.BlockSvg.prototype.width=0,t.BlockSvg.prototype.warningTextDb_=null,t.BlockSvg.INLINE=-1,t.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_",t.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var e,n=0;e=this.inputList[n];n++)e.init();for(e=this.getIcons(),n=0;n<e.length;n++)e[n].createIcon();this.applyColour(),this.pathObject.updateMovable(this.isMovable()),n=this.getSvgRoot(),this.workspace.options.readOnly||this.eventsInit_||!n||t.browserEvents.conditionalBind(n,"mousedown",this,this.onMouseDown_),this.eventsInit_=!0,n.parentNode||this.workspace.getCanvas().appendChild(n)},t.BlockSvg.prototype.getColourSecondary=function(){return this.style.colourSecondary},t.BlockSvg.prototype.getColourTertiary=function(){return this.style.colourTertiary},t.BlockSvg.prototype.getColourShadow=function(){return t.utils.deprecation.warn("BlockSvg.prototype.getColourShadow","January 2020","January 2021","style.colourSecondary"),this.getColourSecondary()},t.BlockSvg.prototype.getColourBorder=function(){return t.utils.deprecation.warn("BlockSvg.prototype.getColourBorder","January 2020","January 2021","style.colourTertiary"),{colourBorder:this.getColourTertiary(),colourLight:null,colourDark:null}},t.BlockSvg.prototype.select=function(){if(this.isShadow()&&this.getParent())this.getParent().select();else if(t.selected!=this){var e=null;if(t.selected){e=t.selected.id,t.Events.disable();try{t.selected.unselect()}finally{t.Events.enable()}}e=new(t.Events.get(t.Events.SELECTED))(e,this.id,this.workspace.id),t.Events.fire(e),t.selected=this,this.addSelect()}},t.BlockSvg.prototype.unselect=function(){if(t.selected==this){var e=new(t.Events.get(t.Events.SELECTED))(this.id,null,this.workspace.id);e.workspaceId=this.workspace.id,t.Events.fire(e),t.selected=null,this.removeSelect()}},t.BlockSvg.prototype.mutator=null,t.BlockSvg.prototype.comment=null,t.BlockSvg.prototype.commentIcon_=null,t.BlockSvg.prototype.warning=null,t.BlockSvg.prototype.getIcons=function(){var t=[];return this.mutator&&t.push(this.mutator),this.commentIcon_&&t.push(this.commentIcon_),this.warning&&t.push(this.warning),t},t.BlockSvg.prototype.setParent=function(e){var n=this.parentBlock_;if(e!=n){t.utils.dom.startTextWidthCache(),t.BlockSvg.superClass_.setParent.call(this,e),t.utils.dom.stopTextWidthCache();var i=this.getSvgRoot();if(!this.workspace.isClearing&&i){var r=this.getRelativeToSurfaceXY();e?(e.getSvgRoot().appendChild(i),e=this.getRelativeToSurfaceXY(),this.moveConnections(e.x-r.x,e.y-r.y)):n&&(this.workspace.getCanvas().appendChild(i),this.translate(r.x,r.y)),this.applyColour()}}},t.BlockSvg.prototype.getRelativeToSurfaceXY=function(){var e=0,n=0,i=this.useDragSurface_?this.workspace.getBlockDragSurface().getGroup():null,r=this.getSvgRoot();if(r)do{var o=t.utils.getRelativeXY(r);e+=o.x,n+=o.y,this.useDragSurface_&&this.workspace.getBlockDragSurface().getCurrentBlock()==r&&(e+=(o=this.workspace.getBlockDragSurface().getSurfaceTranslation()).x,n+=o.y),r=r.parentNode}while(r&&r!=this.workspace.getCanvas()&&r!=i);return new t.utils.Coordinate(e,n)},t.BlockSvg.prototype.moveBy=function(e,n){if(this.parentBlock_)throw Error("Block has parent.");var i=t.Events.isEnabled();if(i)var r=new(t.Events.get(t.Events.BLOCK_MOVE))(this);var o=this.getRelativeToSurfaceXY();this.translate(o.x+e,o.y+n),this.moveConnections(e,n),i&&(r.recordNew(),t.Events.fire(r)),this.workspace.resizeContents()},t.BlockSvg.prototype.translate=function(t,e){this.getSvgRoot().setAttribute("transform","translate("+t+","+e+")")},t.BlockSvg.prototype.moveToDragSurface=function(){if(this.useDragSurface_){var t=this.getRelativeToSurfaceXY();this.clearTransformAttributes_(),this.workspace.getBlockDragSurface().translateSurface(t.x,t.y),(t=this.getSvgRoot())&&this.workspace.getBlockDragSurface().setBlocksAndShow(t)}},t.BlockSvg.prototype.moveTo=function(t){var e=this.getRelativeToSurfaceXY();this.moveBy(t.x-e.x,t.y-e.y)},t.BlockSvg.prototype.moveOffDragSurface=function(t){this.useDragSurface_&&(this.translate(t.x,t.y),this.workspace.getBlockDragSurface().clearAndHide(this.workspace.getCanvas()))},t.BlockSvg.prototype.moveDuringDrag=function(t){this.useDragSurface_?this.workspace.getBlockDragSurface().translateSurface(t.x,t.y):(this.svgGroup_.translate_="translate("+t.x+","+t.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))},t.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")},t.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&!this.workspace.isDragging()&&!this.getParent()&&!this.isInFlyout){var t=this.workspace.getGrid();if(t&&t.shouldSnap()){var e=t.getSpacing(),n=e/2,i=this.getRelativeToSurfaceXY();t=Math.round((i.x-n)/e)*e+n-i.x,e=Math.round((i.y-n)/e)*e+n-i.y,t=Math.round(t),e=Math.round(e),0==t&&0==e||this.moveBy(t,e)}}},t.BlockSvg.prototype.getBoundingRectangle=function(){var e=this.getRelativeToSurfaceXY(),n=this.getHeightWidth();if(this.RTL)var i=e.x-n.width,r=e.x;else i=e.x,r=e.x+n.width;return new t.utils.Rect(e.y,e.y+n.height,i,r)},t.BlockSvg.prototype.markDirty=function(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(var t,e=0;t=this.inputList[e];e++)t.markDirty()},t.BlockSvg.prototype.setCollapsed=function(e){this.collapsed_!=e&&(t.BlockSvg.superClass_.setCollapsed.call(this,e),e?this.rendered&&this.render():this.updateCollapsed_())},t.BlockSvg.prototype.updateCollapsed_=function(){for(var e,n=this.isCollapsed(),i=t.constants.COLLAPSED_INPUT_NAME,r=t.constants.COLLAPSED_FIELD_NAME,o=0;e=this.inputList[o];o++)e.name!=i&&e.setVisible(!n);if(n){for(e=this.getIcons(),o=0;n=e[o];o++)n.setVisible(!1);o=this.toString(t.COLLAPSE_CHARS),(e=this.getField(r))?e.setValue(o):(e=this.getInput(i)||this.appendDummyInput(i)).appendField(new t.FieldLabel(o),r)}else this.updateDisabled(),this.removeInput(i)},t.BlockSvg.prototype.tab=function(e,n){var i=new t.TabNavigateCursor;i.setCurNode(t.ASTNode.createFieldNode(e)),e=i.getCurNode(),n?i.next():i.prev(),(n=i.getCurNode())&&n!==e&&(n.getLocation().showEditor(),this.workspace.keyboardAccessibilityMode&&this.workspace.getCursor().setCurNode(n))},t.BlockSvg.prototype.onMouseDown_=function(t){var e=this.workspace&&this.workspace.getGesture(t);e&&e.handleBlockStart(t,this)},t.BlockSvg.prototype.showHelp=function(){var t="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;t&&window.open(t)},t.BlockSvg.prototype.generateContextMenu=function(){if(this.workspace.options.readOnly||!this.contextMenu)return null;var e=t.ContextMenuRegistry.registry.getContextMenuOptions(t.ContextMenuRegistry.ScopeType.BLOCK,{block:this});return this.customContextMenu&&this.customContextMenu(e),e},t.BlockSvg.prototype.showContextMenu=function(e){var n=this.generateContextMenu();n&&n.length&&(t.ContextMenu.show(e,n,this.RTL),t.ContextMenu.currentBlock=this)},t.BlockSvg.prototype.moveConnections=function(t,e){if(this.rendered){for(var n=this.getConnections_(!1),i=0;i<n.length;i++)n[i].moveBy(t,e);for(n=this.getIcons(),i=0;i<n.length;i++)n[i].computeIconLocation();for(i=0;i<this.childBlocks_.length;i++)this.childBlocks_[i].moveConnections(t,e)}},t.BlockSvg.prototype.setDragging=function(e){if(e){var n=this.getSvgRoot();n.translate_="",n.skew_="",t.draggingConnections=t.draggingConnections.concat(this.getConnections_(!0)),t.utils.dom.addClass(this.svgGroup_,"blocklyDragging")}else t.draggingConnections=[],t.utils.dom.removeClass(this.svgGroup_,"blocklyDragging");for(n=0;n<this.childBlocks_.length;n++)this.childBlocks_[n].setDragging(e)},t.BlockSvg.prototype.setMovable=function(e){t.BlockSvg.superClass_.setMovable.call(this,e),this.pathObject.updateMovable(e)},t.BlockSvg.prototype.setEditable=function(e){t.BlockSvg.superClass_.setEditable.call(this,e),e=this.getIcons();for(var n=0;n<e.length;n++)e[n].updateEditable()},t.BlockSvg.prototype.setShadow=function(e){t.BlockSvg.superClass_.setShadow.call(this,e),this.applyColour()},t.BlockSvg.prototype.setInsertionMarker=function(t){this.isInsertionMarker_!=t&&(this.isInsertionMarker_=t)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))},t.BlockSvg.prototype.getSvgRoot=function(){return this.svgGroup_},t.BlockSvg.prototype.dispose=function(e,n){if(this.workspace){t.Tooltip.dispose(),t.Tooltip.unbindMouseEvents(this.pathObject.svgPath),t.utils.dom.startTextWidthCache();var i=this.workspace;if(t.selected==this&&(this.unselect(),this.workspace.cancelCurrentGesture()),t.ContextMenu.currentBlock==this&&t.ContextMenu.hide(),n&&this.rendered&&(this.unplug(e),t.blockAnimations.disposeUiEffect(this)),this.rendered=!1,this.warningTextDb_){for(var r in this.warningTextDb_)clearTimeout(this.warningTextDb_[r]);this.warningTextDb_=null}for(n=this.getIcons(),r=0;r<n.length;r++)n[r].dispose();t.BlockSvg.superClass_.dispose.call(this,!!e),t.utils.dom.removeNode(this.svgGroup_),i.resizeContents(),this.svgGroup_=null,t.utils.dom.stopTextWidthCache()}},t.BlockSvg.prototype.toCopyData=function(){if(this.isInsertionMarker_)return null;var e=t.Xml.blockToDom(this,!0);t.Xml.deleteNext(e);var n=this.getRelativeToSurfaceXY();return e.setAttribute("x",this.RTL?-n.x:n.x),e.setAttribute("y",n.y),{xml:e,source:this.workspace,typeCounts:t.utils.getBlockTypeCounts(this,!0)}},t.BlockSvg.prototype.applyColour=function(){this.pathObject.applyColour(this);for(var t=this.getIcons(),e=0;e<t.length;e++)t[e].applyColour();for(t=0;e=this.inputList[t];t++)for(var n,i=0;n=e.fieldRow[i];i++)n.applyColour()},t.BlockSvg.prototype.updateDisabled=function(){var t=this.getChildren(!1);if(this.applyColour(),!this.isCollapsed())for(var e,n=0;e=t[n];n++)e.rendered&&e.updateDisabled()},t.BlockSvg.prototype.getCommentIcon=function(){return this.commentIcon_},t.BlockSvg.prototype.setCommentText=function(e){if(!t.Comment)throw Error("Missing require for Blockly.Comment");this.commentModel.text!=e&&(t.BlockSvg.superClass_.setCommentText.call(this,e),e=null!=e,!!this.commentIcon_==e?this.commentIcon_.updateText():(e?this.comment=this.commentIcon_=new t.Comment(this):(this.commentIcon_.dispose(),this.comment=this.commentIcon_=null),this.rendered&&(this.render(),this.bumpNeighbours())))},t.BlockSvg.prototype.setWarningText=function(e,n){if(!t.Warning)throw Error("Missing require for Blockly.Warning");this.warningTextDb_||(this.warningTextDb_=Object.create(null));var i=n||"";if(i)this.warningTextDb_[i]&&(clearTimeout(this.warningTextDb_[i]),delete this.warningTextDb_[i]);else for(var r in this.warningTextDb_)clearTimeout(this.warningTextDb_[r]),delete this.warningTextDb_[r];if(this.workspace.isDragging()){var o=this;this.warningTextDb_[i]=setTimeout(function(){o.workspace&&(delete o.warningTextDb_[i],o.setWarningText(e,i))},100)}else{if(this.isInFlyout&&(e=null),n=!1,"string"==typeof e){r=this.getSurroundParent();for(var s=null;r;)r.isCollapsed()&&(s=r),r=r.getSurroundParent();s&&s.setWarningText(t.Msg.COLLAPSED_WARNINGS_WARNING,t.BlockSvg.COLLAPSED_WARNING_ID),this.warning||(this.warning=new t.Warning(this),n=!0),this.warning.setText(e,i)}else this.warning&&!i?(this.warning.dispose(),n=!0):this.warning&&(n=this.warning.getText(),this.warning.setText("",i),(r=this.warning.getText())||this.warning.dispose(),n=n!=r);n&&this.rendered&&(this.render(),this.bumpNeighbours())}},t.BlockSvg.prototype.setMutator=function(t){this.mutator&&this.mutator!==t&&this.mutator.dispose(),t&&(t.setBlock(this),this.mutator=t,t.createIcon()),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.setEnabled=function(e){this.isEnabled()!=e&&(t.BlockSvg.superClass_.setEnabled.call(this,e),this.rendered&&!this.getInheritedDisabled()&&this.updateDisabled())},t.BlockSvg.prototype.setHighlighted=function(t){this.rendered&&this.pathObject.updateHighlighted(t)},t.BlockSvg.prototype.addSelect=function(){this.pathObject.updateSelected(!0)},t.BlockSvg.prototype.removeSelect=function(){this.pathObject.updateSelected(!1)},t.BlockSvg.prototype.setDeleteStyle=function(t){this.pathObject.updateDraggingDelete(t)},t.BlockSvg.prototype.getColour=function(){return this.style.colourPrimary},t.BlockSvg.prototype.setColour=function(e){t.BlockSvg.superClass_.setColour.call(this,e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),this.pathObject.setStyle(e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()},t.BlockSvg.prototype.setStyle=function(t){var e=this.workspace.getRenderer().getConstants().getBlockStyle(t);if(this.styleName_=t,!e)throw Error("Invalid style name: "+t);this.hat=e.hat,this.pathObject.setStyle(e),this.colour_=e.colourPrimary,this.style=e,this.applyColour()},t.BlockSvg.prototype.bringToFront=function(){var t=this;do{var e=t.getSvgRoot(),n=e.parentNode,i=n.childNodes;i[i.length-1]!==e&&n.appendChild(e),t=t.getParent()}while(t)},t.BlockSvg.prototype.setPreviousStatement=function(e,n){t.BlockSvg.superClass_.setPreviousStatement.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.setNextStatement=function(e,n){t.BlockSvg.superClass_.setNextStatement.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.setOutput=function(e,n){t.BlockSvg.superClass_.setOutput.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.setInputsInline=function(e){t.BlockSvg.superClass_.setInputsInline.call(this,e),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.removeInput=function(e,n){return e=t.BlockSvg.superClass_.removeInput.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours()),e},t.BlockSvg.prototype.moveNumberedInputBefore=function(e,n){t.BlockSvg.superClass_.moveNumberedInputBefore.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours())},t.BlockSvg.prototype.appendInput_=function(e,n){return e=t.BlockSvg.superClass_.appendInput_.call(this,e,n),this.rendered&&(this.render(),this.bumpNeighbours()),e},t.BlockSvg.prototype.setConnectionTracking=function(t){if(this.previousConnection&&this.previousConnection.setTracking(t),this.outputConnection&&this.outputConnection.setTracking(t),this.nextConnection){this.nextConnection.setTracking(t);var e=this.nextConnection.targetBlock();e&&e.setConnectionTracking(t)}if(!this.collapsed_)for(e=0;e<this.inputList.length;e++){var n=this.inputList[e].connection;n&&(n.setTracking(t),(n=n.targetBlock())&&n.setConnectionTracking(t))}},t.BlockSvg.prototype.getConnections_=function(t){var e=[];if((t||this.rendered)&&(this.outputConnection&&e.push(this.outputConnection),this.previousConnection&&e.push(this.previousConnection),this.nextConnection&&e.push(this.nextConnection),t||!this.collapsed_)){t=0;for(var n;n=this.inputList[t];t++)n.connection&&e.push(n.connection)}return e},t.BlockSvg.prototype.lastConnectionInStack=function(e){return t.BlockSvg.superClass_.lastConnectionInStack.call(this,e)},t.BlockSvg.prototype.getMatchingConnection=function(e,n){return t.BlockSvg.superClass_.getMatchingConnection.call(this,e,n)},t.BlockSvg.prototype.makeConnection_=function(e){return new t.RenderedConnection(this,e)},t.BlockSvg.prototype.bumpNeighbours=function(){if(this.workspace&&!this.workspace.isDragging()){var e=this.getRootBlock();if(!e.isInFlyout)for(var n,i=this.getConnections_(!1),r=0;n=i[r];r++){n.isConnected()&&n.isSuperior()&&n.targetBlock().bumpNeighbours();for(var o,s=n.neighbours(t.SNAP_RADIUS),a=0;o=s[a];a++)n.isConnected()&&o.isConnected()||o.getSourceBlock().getRootBlock()!=e&&(n.isSuperior()?o.bumpAwayFrom(n):n.bumpAwayFrom(o))}}},t.BlockSvg.prototype.scheduleSnapAndBump=function(){var e=this,n=t.Events.getGroup();setTimeout(function(){t.Events.setGroup(n),e.snapToGrid(),t.Events.setGroup(!1)},t.BUMP_DELAY/2),setTimeout(function(){t.Events.setGroup(n),e.bumpNeighbours(),t.Events.setGroup(!1)},t.BUMP_DELAY)},t.BlockSvg.prototype.positionNearConnection=function(e,n){e.type!=t.connectionTypes.NEXT_STATEMENT&&e.type!=t.connectionTypes.INPUT_VALUE||this.moveBy(n.x-e.x,n.y-e.y)},t.BlockSvg.prototype.getParent=function(){return t.BlockSvg.superClass_.getParent.call(this)},t.BlockSvg.prototype.getRootBlock=function(){return t.BlockSvg.superClass_.getRootBlock.call(this)},t.BlockSvg.prototype.render=function(e){if(!this.renderIsInProgress_){this.renderIsInProgress_=!0;try{if(this.rendered=!0,t.utils.dom.startTextWidthCache(),this.isCollapsed()&&this.updateCollapsed_(),this.workspace.getRenderer().render(this),this.updateConnectionLocations_(),!1!==e){var n=this.getParent();n?n.render(!0):this.workspace.resizeContents()}t.utils.dom.stopTextWidthCache(),this.updateMarkers_()}finally{this.renderIsInProgress_=!1}}},t.BlockSvg.prototype.updateMarkers_=function(){this.workspace.keyboardAccessibilityMode&&this.pathObject.cursorSvg&&this.workspace.getCursor().draw(),this.workspace.keyboardAccessibilityMode&&this.pathObject.markerSvg&&this.workspace.getMarker(t.MarkerManager.LOCAL_MARKER).draw()},t.BlockSvg.prototype.updateConnectionLocations_=function(){var t=this.getRelativeToSurfaceXY();this.previousConnection&&this.previousConnection.moveToOffset(t),this.outputConnection&&this.outputConnection.moveToOffset(t);for(var e=0;e<this.inputList.length;e++){var n=this.inputList[e].connection;n&&(n.moveToOffset(t),n.isConnected()&&n.tighten())}this.nextConnection&&(this.nextConnection.moveToOffset(t),this.nextConnection.isConnected()&&this.nextConnection.tighten())},t.BlockSvg.prototype.setCursorSvg=function(t){this.pathObject.setCursorSvg(t)},t.BlockSvg.prototype.setMarkerSvg=function(t){this.pathObject.setMarkerSvg(t)},t.BlockSvg.prototype.getHeightWidth=function(){var t=this.height,e=this.width,n=this.getNextBlock();if(n){n=n.getHeightWidth();var i=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;t+=n.height-i,e=Math.max(e,n.width)}return{height:t,width:e}},t.BlockSvg.prototype.fadeForReplacement=function(t){this.pathObject.updateReplacementFade(t)},t.BlockSvg.prototype.highlightShapeForInput=function(t,e){this.pathObject.updateShapeForInputHighlight(t,e)},t.ConnectionDB=function(t){this.connections_=[],this.connectionChecker_=t},t.ConnectionDB.prototype.addConnection=function(t,e){e=this.calculateIndexForYPos_(e),this.connections_.splice(e,0,t)},t.ConnectionDB.prototype.findIndexOfConnection_=function(t,e){if(!this.connections_.length)return-1;var n=this.calculateIndexForYPos_(e);if(n>=this.connections_.length)return-1;e=t.y;for(var i=n;0<=i&&this.connections_[i].y==e;){if(this.connections_[i]==t)return i;i--}for(i=n;i<this.connections_.length&&this.connections_[i].y==e;){if(this.connections_[i]==t)return i;i++}return-1},t.ConnectionDB.prototype.calculateIndexForYPos_=function(t){if(!this.connections_.length)return 0;for(var e=0,n=this.connections_.length;e<n;){var i=Math.floor((e+n)/2);if(this.connections_[i].y<t)e=i+1;else{if(!(this.connections_[i].y>t)){e=i;break}n=i}}return e},t.ConnectionDB.prototype.removeConnection=function(t,e){if(-1==(t=this.findIndexOfConnection_(t,e)))throw Error("Unable to find connection in connectionDB.");this.connections_.splice(t,1)},t.ConnectionDB.prototype.getNeighbours=function(t,e){function n(t){var n=r-i[t].x,s=o-i[t].y;return Math.sqrt(n*n+s*s)<=e&&l.push(i[t]),s<e}var i=this.connections_,r=t.x,o=t.y;t=0;for(var s=i.length-2,a=s;t<a;)i[a].y<o?t=a:s=a,a=Math.floor((t+s)/2);var l=[];if(s=t=a,i.length){for(;0<=t&&n(t);)t--;do{s++}while(s<i.length&&n(s))}return l},t.ConnectionDB.prototype.isInYRange_=function(t,e,n){return Math.abs(this.connections_[t].y-e)<=n},t.ConnectionDB.prototype.searchForClosest=function(t,e,n){if(!this.connections_.length)return{connection:null,radius:e};var i=t.y,r=t.x;t.x=r+n.x,t.y=i+n.y;var o=this.calculateIndexForYPos_(t.y);n=null;for(var s,a=e,l=o-1;0<=l&&this.isInYRange_(l,t.y,e);)s=this.connections_[l],this.connectionChecker_.canConnect(t,s,!0,a)&&(n=s,a=s.distanceFrom(t)),l--;for(;o<this.connections_.length&&this.isInYRange_(o,t.y,e);)s=this.connections_[o],this.connectionChecker_.canConnect(t,s,!0,a)&&(n=s,a=s.distanceFrom(t)),o++;return t.x=r,t.y=i,{connection:n,radius:a}},t.ConnectionDB.init=function(e){var n=[];return n[t.connectionTypes.INPUT_VALUE]=new t.ConnectionDB(e),n[t.connectionTypes.OUTPUT_VALUE]=new t.ConnectionDB(e),n[t.connectionTypes.NEXT_STATEMENT]=new t.ConnectionDB(e),n[t.connectionTypes.PREVIOUS_STATEMENT]=new t.ConnectionDB(e),n},t.Events.ThemeChange=function(e,n){t.Events.ThemeChange.superClass_.constructor.call(this,n),this.themeName=e},t.utils.object.inherits(t.Events.ThemeChange,t.Events.UiBase),t.Events.ThemeChange.prototype.type=t.Events.THEME_CHANGE,t.Events.ThemeChange.prototype.toJson=function(){var e=t.Events.ThemeChange.superClass_.toJson.call(this);return e.themeName=this.themeName,e},t.Events.ThemeChange.prototype.fromJson=function(e){t.Events.ThemeChange.superClass_.fromJson.call(this,e),this.themeName=e.themeName},t.registry.register(t.registry.Type.EVENT,t.Events.THEME_CHANGE,t.Events.ThemeChange),t.Events.ViewportChange=function(e,n,i,r,o){t.Events.ViewportChange.superClass_.constructor.call(this,r),this.viewTop=e,this.viewLeft=n,this.scale=i,this.oldScale=o},t.utils.object.inherits(t.Events.ViewportChange,t.Events.UiBase),t.Events.ViewportChange.prototype.type=t.Events.VIEWPORT_CHANGE,t.Events.ViewportChange.prototype.toJson=function(){var e=t.Events.ViewportChange.superClass_.toJson.call(this);return e.viewTop=this.viewTop,e.viewLeft=this.viewLeft,e.scale=this.scale,e.oldScale=this.oldScale,e},t.Events.ViewportChange.prototype.fromJson=function(e){t.Events.ViewportChange.superClass_.fromJson.call(this,e),this.viewTop=e.viewTop,this.viewLeft=e.viewLeft,this.scale=e.scale,this.oldScale=e.oldScale},t.registry.register(t.registry.Type.EVENT,t.Events.VIEWPORT_CHANGE,t.Events.ViewportChange),t.IMetricsManager=function(){},t.MetricsManager=function(t){this.workspace_=t},t.MetricsManager.prototype.getDimensionsPx_=function(e){var n=0,i=0;return e&&(n=e.getWidth(),i=e.getHeight()),new t.utils.Size(n,i)},t.MetricsManager.prototype.getFlyoutMetrics=function(t){return{width:(t=this.getDimensionsPx_(this.workspace_.getFlyout(t))).width,height:t.height,position:this.workspace_.toolboxPosition}},t.MetricsManager.prototype.getToolboxMetrics=function(){var t=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:t.width,height:t.height,position:this.workspace_.toolboxPosition}},t.MetricsManager.prototype.getSvgMetrics=function(){return this.workspace_.getCachedParentSvgSize()},t.MetricsManager.prototype.getAbsoluteMetrics=function(){var e=0,n=this.getToolboxMetrics(),i=this.getFlyoutMetrics(!0),r=!!this.workspace_.getToolbox(),o=!!this.workspace_.getFlyout(!0),s=r?n.position:i.position,a=s==t.utils.toolbox.Position.LEFT;return s=s==t.utils.toolbox.Position.TOP,r&&a?e=n.width:o&&a&&(e=i.width),a=0,r&&s?a=n.height:o&&s&&(a=i.height),{top:a,left:e}},t.MetricsManager.prototype.getViewMetrics=function(e){e=e?this.workspace_.scale:1;var n=this.getSvgMetrics(),i=this.getToolboxMetrics(),r=this.getFlyoutMetrics(!0),o=this.workspace_.getToolbox()?i.position:r.position;return this.workspace_.getToolbox()?o==t.utils.toolbox.Position.TOP||o==t.utils.toolbox.Position.BOTTOM?n.height-=i.height:o!=t.utils.toolbox.Position.LEFT&&o!=t.utils.toolbox.Position.RIGHT||(n.width-=i.width):this.workspace_.getFlyout(!0)&&(o==t.utils.toolbox.Position.TOP||o==t.utils.toolbox.Position.BOTTOM?n.height-=r.height:o!=t.utils.toolbox.Position.LEFT&&o!=t.utils.toolbox.Position.RIGHT||(n.width-=r.width)),{height:n.height/e,width:n.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}},t.MetricsManager.prototype.getContentMetrics=function(t){t=t?1:this.workspace_.scale;var e=this.workspace_.getBlocksBoundingBox();return{height:(e.bottom-e.top)*t,width:(e.right-e.left)*t,top:e.top*t,left:e.left*t}},t.MetricsManager.prototype.hasFixedEdges=function(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()},t.MetricsManager.prototype.getComputedFixedEdges_=function(t){if(!this.hasFixedEdges())return{};var e=this.workspace_.isMovableHorizontally(),n=this.workspace_.isMovableVertically();t=t||this.getViewMetrics(!1);var i={};return n||(i.top=t.top,i.bottom=t.top+t.height),e||(i.left=t.left,i.right=t.left+t.width),i},t.MetricsManager.prototype.getPaddedContent_=function(t,e){var n=e.top+e.height,i=e.left+e.width,r=t.width,o=r/2,s=(t=t.height)/2;return{top:Math.min(e.top-s,n-t),bottom:Math.max(n+s,e.top+t),left:Math.min(e.left-o,i-r),right:Math.max(i+o,e.left+r)}},t.MetricsManager.prototype.getScrollMetrics=function(t,e,n){t=t?this.workspace_.scale:1,e=e||this.getViewMetrics(!1);var i=n||this.getContentMetrics();n=this.getComputedFixedEdges_(e),e=this.getPaddedContent_(e,i),i=void 0!==n.top?n.top:e.top;var r=void 0!==n.left?n.left:e.left;return{top:i/t,left:r/t,width:((void 0!==n.right?n.right:e.right)-r)/t,height:((void 0!==n.bottom?n.bottom:e.bottom)-i)/t}},t.MetricsManager.prototype.getUiMetrics=function(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}},t.MetricsManager.prototype.getMetrics=function(){var t=this.getToolboxMetrics(),e=this.getFlyoutMetrics(!0),n=this.getSvgMetrics(),i=this.getAbsoluteMetrics(),r=this.getViewMetrics(),o=this.getContentMetrics(),s=this.getScrollMetrics(!1,r,o);return{contentHeight:o.height,contentWidth:o.width,contentTop:o.top,contentLeft:o.left,scrollHeight:s.height,scrollWidth:s.width,scrollTop:s.top,scrollLeft:s.left,viewHeight:r.height,viewWidth:r.width,viewTop:r.top,viewLeft:r.left,absoluteTop:i.top,absoluteLeft:i.left,svgHeight:n.height,svgWidth:n.width,toolboxWidth:t.width,toolboxHeight:t.height,toolboxPosition:t.position,flyoutWidth:e.width,flyoutHeight:e.height}},t.registry.register(t.registry.Type.METRICS_MANAGER,t.registry.DEFAULT,t.MetricsManager),t.FlyoutMetricsManager=function(e,n){this.flyout_=n,t.FlyoutMetricsManager.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.FlyoutMetricsManager,t.MetricsManager),t.FlyoutMetricsManager.prototype.getBoundingBox_=function(){try{var t=this.workspace_.getCanvas().getBBox()}catch(e){t={height:0,y:0,width:0,x:0}}return t},t.FlyoutMetricsManager.prototype.getContentMetrics=function(t){var e=this.getBoundingBox_();return t=t?1:this.workspace_.scale,{height:e.height*t,width:e.width*t,top:e.y*t,left:e.x*t}},t.FlyoutMetricsManager.prototype.getScrollMetrics=function(t,e,n){return e=n||this.getContentMetrics(),n=this.flyout_.MARGIN*this.workspace_.scale,t=t?this.workspace_.scale:1,{height:(e.height+2*n)/t,width:(e.width+e.left+n)/t,top:0,left:0}},t.ThemeManager=function(t,e){this.workspace_=t,this.theme_=e,this.subscribedWorkspaces_=[],this.componentDB_=Object.create(null)},t.ThemeManager.prototype.getTheme=function(){return this.theme_},t.ThemeManager.prototype.setTheme=function(e){var n,i=this.theme_;for(this.theme_=e,(e=this.workspace_.getInjectionDiv())&&(i&&t.utils.dom.removeClass(e,i.getClassName()),t.utils.dom.addClass(e,this.theme_.getClassName())),i=0;e=this.subscribedWorkspaces_[i];i++)e.refreshTheme();for(i=0,e=Object.keys(this.componentDB_);n=e[i];i++)for(var r,o=0;r=this.componentDB_[n][o];o++){var s=r.element;r=r.propertyName;var a=this.theme_&&this.theme_.getComponentStyle(n);s.style[r]=a||""}t.hideChaff()},t.ThemeManager.prototype.subscribeWorkspace=function(t){this.subscribedWorkspaces_.push(t)},t.ThemeManager.prototype.unsubscribeWorkspace=function(t){if(0>(t=this.subscribedWorkspaces_.indexOf(t)))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");this.subscribedWorkspaces_.splice(t,1)},t.ThemeManager.prototype.subscribe=function(t,e,n){this.componentDB_[e]||(this.componentDB_[e]=[]),this.componentDB_[e].push({element:t,propertyName:n}),e=this.theme_&&this.theme_.getComponentStyle(e),t.style[n]=e||""},t.ThemeManager.prototype.unsubscribe=function(t){if(t)for(var e,n=Object.keys(this.componentDB_),i=0;e=n[i];i++){for(var r=this.componentDB_[e],o=r.length-1;0<=o;o--)r[o].element===t&&r.splice(o,1);this.componentDB_[e].length||delete this.componentDB_[e]}},t.ThemeManager.prototype.dispose=function(){this.componentDB_=this.subscribedWorkspaces_=this.theme_=this.owner_=null},t.TouchGesture=function(e,n){t.TouchGesture.superClass_.constructor.call(this,e,n),this.isMultiTouch_=!1,this.cachedPoints_=Object.create(null),this.startDistance_=this.previousScale_=0,this.isPinchZoomEnabled_=this.onStartWrapper_=null},t.utils.object.inherits(t.TouchGesture,t.Gesture),t.TouchGesture.ZOOM_IN_MULTIPLIER=5,t.TouchGesture.ZOOM_OUT_MULTIPLIER=6,t.TouchGesture.prototype.doStart=function(e){this.isPinchZoomEnabled_=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,t.TouchGesture.superClass_.doStart.call(this,e),!this.isEnding_&&t.Touch.isTouchEvent(e)&&this.handleTouchStart(e)},t.TouchGesture.prototype.bindMouseEvents=function(e){this.onStartWrapper_=t.browserEvents.conditionalBind(document,"mousedown",null,this.handleStart.bind(this),!0),this.onMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this),!0),this.onUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this),!0),e.preventDefault(),e.stopPropagation()},t.TouchGesture.prototype.handleStart=function(e){!this.isDragging()&&t.Touch.isTouchEvent(e)&&(this.handleTouchStart(e),this.isMultiTouch()&&t.longStop_())},t.TouchGesture.prototype.handleMove=function(e){this.isDragging()?t.Touch.shouldHandleEvent(e)&&t.TouchGesture.superClass_.handleMove.call(this,e):this.isMultiTouch()?(t.Touch.isTouchEvent(e)&&this.handleTouchMove(e),t.longStop_()):t.TouchGesture.superClass_.handleMove.call(this,e)},t.TouchGesture.prototype.handleUp=function(e){t.Touch.isTouchEvent(e)&&!this.isDragging()&&this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()?t.Touch.shouldHandleEvent(e)&&t.TouchGesture.superClass_.handleUp.call(this,e):(e.preventDefault(),e.stopPropagation(),this.dispose())},t.TouchGesture.prototype.isMultiTouch=function(){return this.isMultiTouch_},t.TouchGesture.prototype.dispose=function(){t.TouchGesture.superClass_.dispose.call(this),this.onStartWrapper_&&t.browserEvents.unbind(this.onStartWrapper_)},t.TouchGesture.prototype.handleTouchStart=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);this.cachedPoints_[n]=this.getTouchPoint(e),2==(n=Object.keys(this.cachedPoints_)).length&&(this.startDistance_=t.utils.Coordinate.distance(this.cachedPoints_[n[0]],this.cachedPoints_[n[1]]),this.isMultiTouch_=!0,e.preventDefault())},t.TouchGesture.prototype.handleTouchMove=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);this.cachedPoints_[n]=this.getTouchPoint(e),n=Object.keys(this.cachedPoints_),this.isPinchZoomEnabled_&&2===n.length?this.handlePinch_(e):t.TouchGesture.superClass_.handleMove.call(this,e)},t.TouchGesture.prototype.handlePinch_=function(e){var n=Object.keys(this.cachedPoints_);if(n=t.utils.Coordinate.distance(this.cachedPoints_[n[0]],this.cachedPoints_[n[1]])/this.startDistance_,0<this.previousScale_&&1/0>this.previousScale_){var i=n-this.previousScale_;i=0<i?i*t.TouchGesture.ZOOM_IN_MULTIPLIER:i*t.TouchGesture.ZOOM_OUT_MULTIPLIER;var r=this.startWorkspace_,o=t.utils.mouseToSvg(e,r.getParentSvg(),r.getInverseScreenCTM());r.zoom(o.x,o.y,i)}this.previousScale_=n,e.preventDefault()},t.TouchGesture.prototype.handleTouchEnd=function(e){e=t.Touch.getTouchIdentifierFromEvent(e),this.cachedPoints_[e]&&delete this.cachedPoints_[e],2>Object.keys(this.cachedPoints_).length&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)},t.TouchGesture.prototype.getTouchPoint=function(e){return this.startWorkspace_?new t.utils.Coordinate(e.pageX?e.pageX:e.changedTouches[0].pageX,e.pageY?e.pageY:e.changedTouches[0].pageY):null},t.WorkspaceAudio=function(t){this.parentWorkspace_=t,this.SOUNDS_=Object.create(null)},t.WorkspaceAudio.prototype.lastSound_=null,t.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null},t.WorkspaceAudio.prototype.load=function(e,n){if(e.length){try{var i=new t.utils.global.Audio}catch(t){return}for(var r,o=0;o<e.length;o++){var s=e[o],a=s.match(/\.(\w+)$/);if(a&&i.canPlayType("audio/"+a[1])){r=new t.utils.global.Audio(s);break}}r&&r.play&&(this.SOUNDS_[n]=r)}},t.WorkspaceAudio.prototype.preload=function(){for(var e in this.SOUNDS_){var n=this.SOUNDS_[e];n.volume=.01;var i=n.play();if(void 0!==i?i.then(n.pause).catch(function(){}):n.pause(),t.utils.userAgent.IPAD||t.utils.userAgent.IPHONE)break}},t.WorkspaceAudio.prototype.play=function(e,n){var i=this.SOUNDS_[e];i?(e=new Date,null!=this.lastSound_&&e-this.lastSound_<t.SOUND_LIMIT||(this.lastSound_=e,(i=t.utils.userAgent.IPAD||t.utils.userAgent.ANDROID?i:i.cloneNode()).volume=void 0===n?1:n,i.play())):this.parentWorkspace_&&this.parentWorkspace_.getAudioManager().play(e,n)},t.WorkspaceSvg=function(e,n,i){t.WorkspaceSvg.superClass_.constructor.call(this,e),this.metricsManager_=new(t.registry.getClassFromOptions(t.registry.Type.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager_.getMetrics.bind(this.metricsManager_),this.setMetrics=e.setMetrics||t.WorkspaceSvg.setTopLevelWorkspaceMetrics_,this.componentManager_=new t.ComponentManager,this.connectionDBList=t.ConnectionDB.init(this.connectionChecker),n&&(this.blockDragSurface_=n),i&&(this.workspaceDragSurface_=i),this.useWorkspaceDragSurface_=!!this.workspaceDragSurface_&&t.utils.is3dSupported(),this.highlightedBlocks_=[],this.audioManager_=new t.WorkspaceAudio(e.parentWorkspace),this.grid_=this.options.gridPattern?new t.Grid(this.options.gridPattern,e.gridOptions):null,this.markerManager_=new t.MarkerManager(this),this.toolboxCategoryCallbacks_=Object.create(null),this.flyoutButtonCallbacks_=Object.create(null),t.Variables&&t.Variables.flyoutCategory&&this.registerToolboxCategoryCallback(t.VARIABLE_CATEGORY_NAME,t.Variables.flyoutCategory),t.VariablesDynamic&&t.VariablesDynamic.flyoutCategory&&this.registerToolboxCategoryCallback(t.VARIABLE_DYNAMIC_CATEGORY_NAME,t.VariablesDynamic.flyoutCategory),t.Procedures&&t.Procedures.flyoutCategory&&(this.registerToolboxCategoryCallback(t.PROCEDURE_CATEGORY_NAME,t.Procedures.flyoutCategory),this.addChangeListener(t.Procedures.mutatorOpenListener)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new t.ThemeManager(this,this.options.theme||t.Themes.Classic),this.themeManager_.subscribeWorkspace(this),this.renderer_=t.blockRendering.init(this.options.renderer||"geras",this.getTheme(),this.options.rendererOverrides),this.cachedParentSvg_=null,this.keyboardAccessibilityMode=!1,this.topBoundedElements_=[],this.dragTargetAreas_=[],this.cachedParentSvgSize_=new t.utils.Size(0,0)},t.utils.object.inherits(t.WorkspaceSvg,t.Workspace),t.WorkspaceSvg.prototype.resizeHandlerWrapper_=null,t.WorkspaceSvg.prototype.rendered=!0,t.WorkspaceSvg.prototype.isVisible_=!0,t.WorkspaceSvg.prototype.isFlyout=!1,t.WorkspaceSvg.prototype.isMutator=!1,t.WorkspaceSvg.prototype.resizesEnabled_=!0,t.WorkspaceSvg.prototype.scrollX=0,t.WorkspaceSvg.prototype.scrollY=0,t.WorkspaceSvg.prototype.startScrollX=0,t.WorkspaceSvg.prototype.startScrollY=0,t.WorkspaceSvg.prototype.dragDeltaXY_=null,t.WorkspaceSvg.prototype.scale=1,t.WorkspaceSvg.prototype.oldScale_=1,t.WorkspaceSvg.prototype.oldTop_=0,t.WorkspaceSvg.prototype.oldLeft_=0,t.WorkspaceSvg.prototype.trashcan=null,t.WorkspaceSvg.prototype.scrollbar=null,t.WorkspaceSvg.prototype.flyout_=null,t.WorkspaceSvg.prototype.toolbox_=null,t.WorkspaceSvg.prototype.currentGesture_=null,t.WorkspaceSvg.prototype.blockDragSurface_=null,t.WorkspaceSvg.prototype.workspaceDragSurface_=null,t.WorkspaceSvg.prototype.useWorkspaceDragSurface_=!1,t.WorkspaceSvg.prototype.isDragSurfaceActive_=!1,t.WorkspaceSvg.prototype.injectionDiv_=null,t.WorkspaceSvg.prototype.lastRecordedPageScroll_=null,t.WorkspaceSvg.prototype.targetWorkspace=null,t.WorkspaceSvg.prototype.inverseScreenCTM_=null,t.WorkspaceSvg.prototype.inverseScreenCTMDirty_=!0,t.WorkspaceSvg.prototype.getMarkerManager=function(){return this.markerManager_},t.WorkspaceSvg.prototype.getMetricsManager=function(){return this.metricsManager_},t.WorkspaceSvg.prototype.setMetricsManager=function(t){this.metricsManager_=t,this.getMetrics=this.metricsManager_.getMetrics.bind(this.metricsManager_)},t.WorkspaceSvg.prototype.getComponentManager=function(){return this.componentManager_},t.WorkspaceSvg.prototype.setCursorSvg=function(t){this.markerManager_.setCursorSvg(t)},t.WorkspaceSvg.prototype.setMarkerSvg=function(t){this.markerManager_.setMarkerSvg(t)},t.WorkspaceSvg.prototype.getMarker=function(t){return this.markerManager_?this.markerManager_.getMarker(t):null},t.WorkspaceSvg.prototype.getCursor=function(){return this.markerManager_?this.markerManager_.getCursor():null},t.WorkspaceSvg.prototype.getRenderer=function(){return this.renderer_},t.WorkspaceSvg.prototype.getThemeManager=function(){return this.themeManager_},t.WorkspaceSvg.prototype.getTheme=function(){return this.themeManager_.getTheme()},t.WorkspaceSvg.prototype.setTheme=function(e){e||(e=t.Themes.Classic),this.themeManager_.setTheme(e)},t.WorkspaceSvg.prototype.refreshTheme=function(){this.svgGroup_&&this.renderer_.refreshDom(this.svgGroup_,this.getTheme()),this.updateBlockStyles_(this.getAllBlocks(!1).filter(function(t){return!!t.getStyleName()})),this.refreshToolboxSelection(),this.toolbox_&&this.toolbox_.refreshTheme(),this.isVisible()&&this.setVisible(!0);var e=new(t.Events.get(t.Events.THEME_CHANGE))(this.getTheme().name,this.id);t.Events.fire(e)},t.WorkspaceSvg.prototype.updateBlockStyles_=function(t){for(var e,n=0;e=t[n];n++){var i=e.getStyleName();i&&(e.setStyle(i),e.mutator&&e.mutator.updateBlockStyle())}},t.WorkspaceSvg.prototype.getInverseScreenCTM=function(){if(this.inverseScreenCTMDirty_){var t=this.getParentSvg().getScreenCTM();t&&(this.inverseScreenCTM_=t.inverse(),this.inverseScreenCTMDirty_=!1)}return this.inverseScreenCTM_},t.WorkspaceSvg.prototype.updateInverseScreenCTM=function(){this.inverseScreenCTMDirty_=!0},t.WorkspaceSvg.prototype.isVisible=function(){return this.isVisible_},t.WorkspaceSvg.prototype.getSvgXY=function(e){var n=0,i=0,r=1;(t.utils.dom.containsNode(this.getCanvas(),e)||t.utils.dom.containsNode(this.getBubbleCanvas(),e))&&(r=this.scale);do{var o=t.utils.getRelativeXY(e);e!=this.getCanvas()&&e!=this.getBubbleCanvas()||(r=1),n+=o.x*r,i+=o.y*r,e=e.parentNode}while(e&&e!=this.getParentSvg());return new t.utils.Coordinate(n,i)},t.WorkspaceSvg.prototype.getCachedParentSvgSize=function(){var e=this.cachedParentSvgSize_;return new t.utils.Size(e.width,e.height)},t.WorkspaceSvg.prototype.getOriginOffsetInPixels=function(){return t.utils.getInjectionDivXY_(this.getCanvas())},t.WorkspaceSvg.prototype.getInjectionDiv=function(){if(!this.injectionDiv_)for(var t=this.svgGroup_;t;){if(-1!=(" "+(t.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){this.injectionDiv_=t;break}t=t.parentNode}return this.injectionDiv_},t.WorkspaceSvg.prototype.getBlockCanvas=function(){return this.svgBlockCanvas_},t.WorkspaceSvg.prototype.setResizeHandlerWrapper=function(t){this.resizeHandlerWrapper_=t},t.WorkspaceSvg.prototype.createDom=function(e){return this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyWorkspace"},null),e&&(this.svgBackground_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),"blocklyMainBackground"==e&&this.grid_?this.svgBackground_.style.fill="url(#"+this.grid_.getPatternId()+")":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.svgBlockCanvas_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyBlockCanvas"},this.svgGroup_),this.svgBubbleCanvas_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyBubbleCanvas"},this.svgGroup_),this.isFlyout||(t.browserEvents.conditionalBind(this.svgGroup_,"mousedown",this,this.onMouseDown_,!1,!0),t.browserEvents.conditionalBind(this.svgGroup_,"wheel",this,this.onMouseWheel_)),this.options.hasCategories&&(this.toolbox_=new(t.registry.getClassFromOptions(t.registry.Type.TOOLBOX,this.options,!0))(this)),this.grid_&&this.grid_.update(this.scale),this.recordDragTargets(),(e=t.registry.getClassFromOptions(t.registry.Type.CURSOR,this.options))&&this.markerManager_.setCursor(new e),this.renderer_.createDom(this.svgGroup_,this.getTheme()),this.svgGroup_},t.WorkspaceSvg.prototype.dispose=function(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&(t.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.svgBubbleCanvas_=this.svgBlockCanvas_=null,this.toolbox_&&(this.toolbox_.dispose(),this.toolbox_=null),this.flyout_&&(this.flyout_.dispose(),this.flyout_=null),this.trashcan&&(this.trashcan.dispose(),this.trashcan=null),this.scrollbar&&(this.scrollbar.dispose(),this.scrollbar=null),this.zoomControls_&&(this.zoomControls_.dispose(),this.zoomControls_=null),this.audioManager_&&(this.audioManager_.dispose(),this.audioManager_=null),this.grid_&&(this.grid_.dispose(),this.grid_=null),this.renderer_.dispose(),this.markerManager_&&(this.markerManager_.dispose(),this.markerManager_=null),t.WorkspaceSvg.superClass_.dispose.call(this),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||(this.themeManager_.dispose(),this.themeManager_=null)),this.flyoutButtonCallbacks_=this.toolboxCategoryCallbacks_=this.connectionDBList=null,!this.options.parentWorkspace){var e=this.getParentSvg();e&&e.parentNode&&t.utils.dom.removeNode(e.parentNode)}this.resizeHandlerWrapper_&&(t.browserEvents.unbind(this.resizeHandlerWrapper_),this.resizeHandlerWrapper_=null)},t.WorkspaceSvg.prototype.newBlock=function(e,n){return new t.BlockSvg(this,e,n)},t.WorkspaceSvg.prototype.addTrashcan=function(){if(!t.Trashcan)throw Error("Missing require for Blockly.Trashcan");this.trashcan=new t.Trashcan(this);var e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.svgBlockCanvas_)},t.WorkspaceSvg.prototype.addZoomControls=function(){if(!t.ZoomControls)throw Error("Missing require for Blockly.ZoomControls");this.zoomControls_=new t.ZoomControls(this);var e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)},t.WorkspaceSvg.prototype.addFlyout=function(e){var n=new t.Options({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,move:{scrollbars:!0}});return n.toolboxPosition=this.options.toolboxPosition,this.flyout_=this.horizontalLayout?new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(n):new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(n),this.flyout_.autoClose=!1,this.flyout_.getWorkspace().setVisible(!0),this.flyout_.createDom(e)},t.WorkspaceSvg.prototype.getFlyout=function(t){return this.flyout_||t?this.flyout_:this.toolbox_?this.toolbox_.getFlyout():null},t.WorkspaceSvg.prototype.getToolbox=function(){return this.toolbox_},t.WorkspaceSvg.prototype.updateScreenCalculations_=function(){this.updateInverseScreenCTM(),this.recordDragTargets()},t.WorkspaceSvg.prototype.resizeContents=function(){this.resizesEnabled_&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())},t.WorkspaceSvg.prototype.resize=function(){this.toolbox_&&this.toolbox_.position(),this.flyout_&&this.flyout_.position();for(var e,n=this.componentManager_.getComponents(t.ComponentManager.Capability.POSITIONABLE,!0),i=this.getMetricsManager().getUiMetrics(),r=[],o=0;e=n[o];o++)e.position(i,r),(e=e.getBoundingRectangle())&&r.push(e);this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations_()},t.WorkspaceSvg.prototype.updateScreenCalculationsIfScrolled=function(){var e=t.utils.getDocumentScroll();t.utils.Coordinate.equals(this.lastRecordedPageScroll_,e)||(this.lastRecordedPageScroll_=e,this.updateScreenCalculations_())},t.WorkspaceSvg.prototype.getCanvas=function(){return this.svgBlockCanvas_},t.WorkspaceSvg.prototype.setCachedParentSvgSize=function(t,e){var n=this.getParentSvg();t&&(this.cachedParentSvgSize_.width=t,n.cachedWidth_=t),e&&(this.cachedParentSvgSize_.height=e,n.cachedHeight_=e)},t.WorkspaceSvg.prototype.getBubbleCanvas=function(){return this.svgBubbleCanvas_},t.WorkspaceSvg.prototype.getParentSvg=function(){if(!this.cachedParentSvg_)for(var t=this.svgGroup_;t;){if("svg"==t.tagName){this.cachedParentSvg_=t;break}t=t.parentNode}return this.cachedParentSvg_},t.WorkspaceSvg.prototype.maybeFireViewportChangeEvent=function(){if(t.Events.isEnabled()){var e=this.scale,n=-this.scrollY,i=-this.scrollX;if(!(e==this.oldScale_&&1>Math.abs(n-this.oldTop_)&&1>Math.abs(i-this.oldLeft_))){var r=new(t.Events.get(t.Events.VIEWPORT_CHANGE))(n,i,e,this.id,this.oldScale_);this.oldScale_=e,this.oldTop_=n,this.oldLeft_=i,t.Events.fire(r)}}},t.WorkspaceSvg.prototype.translate=function(t,e){if(this.useWorkspaceDragSurface_&&this.isDragSurfaceActive_)this.workspaceDragSurface_.translateSurface(t,e);else{var n="translate("+t+","+e+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",n),this.svgBubbleCanvas_.setAttribute("transform",n)}this.blockDragSurface_&&this.blockDragSurface_.translateAndScaleGroup(t,e,this.scale),this.grid_&&this.grid_.moveTo(t,e),this.maybeFireViewportChangeEvent()},t.WorkspaceSvg.prototype.resetDragSurface=function(){if(this.useWorkspaceDragSurface_){this.isDragSurfaceActive_=!1;var t=this.workspaceDragSurface_.getSurfaceTranslation();this.workspaceDragSurface_.clearAndHide(this.svgGroup_),t="translate("+t.x+","+t.y+") scale("+this.scale+")",this.svgBlockCanvas_.setAttribute("transform",t),this.svgBubbleCanvas_.setAttribute("transform",t)}},t.WorkspaceSvg.prototype.setupDragSurface=function(){if(this.useWorkspaceDragSurface_&&!this.isDragSurfaceActive_){this.isDragSurfaceActive_=!0;var e=this.svgBlockCanvas_.previousSibling,n=parseInt(this.getParentSvg().getAttribute("width"),10),i=parseInt(this.getParentSvg().getAttribute("height"),10),r=t.utils.getRelativeXY(this.getCanvas());this.workspaceDragSurface_.setContentsAndShow(this.getCanvas(),this.getBubbleCanvas(),e,n,i,this.scale),this.workspaceDragSurface_.translateSurface(r.x,r.y)}},t.WorkspaceSvg.prototype.getBlockDragSurface=function(){return this.blockDragSurface_},t.WorkspaceSvg.prototype.getWidth=function(){var t=this.getMetrics();return t?t.viewWidth/this.scale:0},t.WorkspaceSvg.prototype.setVisible=function(e){if(this.isVisible_=e,this.svgGroup_)if(this.scrollbar&&this.scrollbar.setContainerVisible(e),this.getFlyout()&&this.getFlyout().setContainerVisible(e),this.getParentSvg().style.display=e?"block":"none",this.toolbox_&&this.toolbox_.setVisible(e),e){for(var n=(e=this.getAllBlocks(!1)).length-1;0<=n;n--)e[n].markDirty();this.render(),this.toolbox_&&this.toolbox_.position()}else t.hideChaff(!0)},t.WorkspaceSvg.prototype.render=function(){for(var t=this.getAllBlocks(!1),e=t.length-1;0<=e;e--)t[e].render(!1);if(this.currentGesture_)for(t=this.currentGesture_.getInsertionMarkers(),e=0;e<t.length;e++)t[e].render(!1);this.markerManager_.updateMarkers()},t.WorkspaceSvg.prototype.highlightBlock=function(e,n){if(void 0===n){for(var i,r=0;i=this.highlightedBlocks_[r];r++)i.setHighlighted(!1);this.highlightedBlocks_.length=0}(i=e?this.getBlockById(e):null)&&((e=void 0===n||n)?-1==this.highlightedBlocks_.indexOf(i)&&this.highlightedBlocks_.push(i):t.utils.arrayRemove(this.highlightedBlocks_,i),i.setHighlighted(e))},t.WorkspaceSvg.prototype.paste=function(t){!this.rendered||!t.tagName||t.getElementsByTagName("block").length>=this.remainingCapacity()||(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==t.tagName.toLowerCase()?this.pasteWorkspaceComment_(t):this.pasteBlock_(t))},t.WorkspaceSvg.prototype.pasteBlock_=function(e){t.Events.disable();try{var n=t.Xml.domToBlock(e,this),i=parseInt(e.getAttribute("x"),10),r=parseInt(e.getAttribute("y"),10);if(!isNaN(i)&&!isNaN(r)){this.RTL&&(i=-i);do{e=!1;for(var o,s=this.getAllBlocks(!1),a=0;o=s[a];a++){var l=o.getRelativeToSurfaceXY();if(1>=Math.abs(i-l.x)&&1>=Math.abs(r-l.y)){e=!0;break}}if(!e){var u,c=n.getConnections_(!1);for(a=0;u=c[a];a++)if(u.closest(t.SNAP_RADIUS,new t.utils.Coordinate(i,r)).connection){e=!0;break}}e&&(i=this.RTL?i-t.SNAP_RADIUS:i+t.SNAP_RADIUS,r+=2*t.SNAP_RADIUS)}while(e);n.moveBy(i,r)}}finally{t.Events.enable()}t.Events.isEnabled()&&!n.isShadow()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(n)),n.select()},t.WorkspaceSvg.prototype.pasteWorkspaceComment_=function(e){t.Events.disable();try{var n=t.WorkspaceCommentSvg.fromXml(e,this),i=parseInt(e.getAttribute("x"),10),r=parseInt(e.getAttribute("y"),10);isNaN(i)||isNaN(r)||(this.RTL&&(i=-i),n.moveBy(i+50,r+50))}finally{t.Events.enable()}t.Events.isEnabled()&&t.WorkspaceComment.fireCreateEvent(n),n.select()},t.WorkspaceSvg.prototype.refreshToolboxSelection=function(){var t=this.isFlyout?this.targetWorkspace:this;t&&!t.currentGesture_&&t.toolbox_&&t.toolbox_.getFlyout()&&t.toolbox_.refreshSelection()},t.WorkspaceSvg.prototype.renameVariableById=function(e,n){t.WorkspaceSvg.superClass_.renameVariableById.call(this,e,n),this.refreshToolboxSelection()},t.WorkspaceSvg.prototype.deleteVariableById=function(e){t.WorkspaceSvg.superClass_.deleteVariableById.call(this,e),this.refreshToolboxSelection()},t.WorkspaceSvg.prototype.createVariable=function(e,n,i){return e=t.WorkspaceSvg.superClass_.createVariable.call(this,e,n,i),this.refreshToolboxSelection(),e},t.WorkspaceSvg.prototype.recordDeleteAreas=function(){t.utils.deprecation.warn("WorkspaceSvg.prototype.recordDeleteAreas","June 2021","June 2022","WorkspaceSvg.prototype.recordDragTargets"),this.recordDragTargets()},t.WorkspaceSvg.prototype.recordDragTargets=function(){var e=this.componentManager_.getComponents(t.ComponentManager.Capability.DRAG_TARGET,!0);this.dragTargetAreas_=[];for(var n,i=0;n=e[i];i++){var r=n.getClientRect();r&&this.dragTargetAreas_.push({component:n,clientRect:r})}},t.WorkspaceSvg.prototype.getDragTarget=function(t){for(var e,n=0;e=this.dragTargetAreas_[n];n++)if(e.clientRect.contains(t.clientX,t.clientY))return e.component;return null},t.WorkspaceSvg.prototype.onMouseDown_=function(t){var e=this.getGesture(t);e&&e.handleWsStart(t,this)},t.WorkspaceSvg.prototype.startDrag=function(e,n){(e=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,this.dragDeltaXY_=t.utils.Coordinate.difference(n,e)},t.WorkspaceSvg.prototype.moveDrag=function(e){return(e=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,t.utils.Coordinate.sum(this.dragDeltaXY_,e)},t.WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()},t.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag},t.WorkspaceSvg.prototype.isMovable=function(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch},t.WorkspaceSvg.prototype.isMovableHorizontally=function(){var t=!!this.scrollbar;return this.isMovable()&&(!t||t&&this.scrollbar.canScrollHorizontally())},t.WorkspaceSvg.prototype.isMovableVertically=function(){var t=!!this.scrollbar;return this.isMovable()&&(!t||t&&this.scrollbar.canScrollVertically())},t.WorkspaceSvg.prototype.onMouseWheel_=function(e){if(t.Gesture.inProgress())e.preventDefault(),e.stopPropagation();else{var n=this.options.zoomOptions&&this.options.zoomOptions.wheel,i=this.options.moveOptions&&this.options.moveOptions.wheel;if(n||i){var r=t.utils.getScrollDeltaPixels(e);!n||!e.ctrlKey&&i?(n=this.scrollX-r.x,i=this.scrollY-r.y,e.shiftKey&&!r.x&&(n=this.scrollX-r.y,i=this.scrollY),this.scroll(n,i)):(r=-r.y/50,n=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(n.x,n.y,r)),e.preventDefault()}}},t.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var e=this.getTopBoundedElements();if(!e.length)return new t.utils.Rect(0,0,0,0);for(var n=e[0].getBoundingRectangle(),i=1;i<e.length;i++){var r=e[i];r.isInsertionMarker&&r.isInsertionMarker()||((r=r.getBoundingRectangle()).top<n.top&&(n.top=r.top),r.bottom>n.bottom&&(n.bottom=r.bottom),r.left<n.left&&(n.left=r.left),r.right>n.right&&(n.right=r.right))}return n},t.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1),t.Events.setGroup(!0);for(var e,n=this.getTopBlocks(!0),i=0,r=0;e=n[r];r++)if(e.isMovable()){var o=e.getRelativeToSurfaceXY();e.moveBy(-o.x,i-o.y),e.snapToGrid(),i=e.getRelativeToSurfaceXY().y+e.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT}t.Events.setGroup(!1),this.setResizesEnabled(!0)},t.WorkspaceSvg.prototype.showContextMenu=function(e){if(!this.options.readOnly&&!this.isFlyout){var n=t.ContextMenuRegistry.registry.getContextMenuOptions(t.ContextMenuRegistry.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(n,e),t.ContextMenu.show(e,n,this.RTL)}},t.WorkspaceSvg.prototype.updateToolbox=function(e){if(e=t.utils.toolbox.convertToolboxDefToJson(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(t.utils.toolbox.hasCategories(e)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=e,this.toolbox_.render(e)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=e,this.flyout_.show(e)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")},t.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(t.mainWorkspace=this,this.setBrowserFocus())},t.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(t){try{this.getParentSvg().parentNode.setActive()}catch(t){this.getParentSvg().parentNode.focus({preventScroll:!0})}}},t.WorkspaceSvg.prototype.zoom=function(t,e,n){n=Math.pow(this.options.zoomOptions.scaleSpeed,n);var i=this.scale*n;if(this.scale!=i){i>this.options.zoomOptions.maxScale?n=this.options.zoomOptions.maxScale/this.scale:i<this.options.zoomOptions.minScale&&(n=this.options.zoomOptions.minScale/this.scale);var r=this.getCanvas().getCTM(),o=this.getParentSvg().createSVGPoint();o.x=t,o.y=e,t=(o=o.matrixTransform(r.inverse())).x,e=o.y,r=r.translate(t*(1-n),e*(1-n)).scale(n),this.scrollX=r.e,this.scrollY=r.f,this.setScale(i)}},t.WorkspaceSvg.prototype.zoomCenter=function(t){var e=this.getMetrics();if(this.flyout_){var n=e.svgWidth?e.svgWidth/2:0;e=e.svgHeight?e.svgHeight/2:0}else n=e.viewWidth/2+e.absoluteLeft,e=e.viewHeight/2+e.absoluteTop;this.zoom(n,e,t)},t.WorkspaceSvg.prototype.zoomToFit=function(){if(this.isMovable()){var e=this.getMetrics(),n=e.viewWidth;e=e.viewHeight;var i=this.getBlocksBoundingBox(),r=i.right-i.left;if(i=i.bottom-i.top,r){this.flyout_&&(this.horizontalLayout?(e+=this.flyout_.getHeight(),i+=this.flyout_.getHeight()/this.scale):(n+=this.flyout_.getWidth(),r+=this.flyout_.getWidth()/this.scale)),n/=r,e/=i,t.Events.disable();try{this.setScale(Math.min(n,e)),this.scrollCenter()}finally{t.Events.enable()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")},t.WorkspaceSvg.prototype.beginCanvasTransition=function(){t.utils.dom.addClass(this.svgBlockCanvas_,"blocklyCanvasTransitioning"),t.utils.dom.addClass(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")},t.WorkspaceSvg.prototype.endCanvasTransition=function(){t.utils.dom.removeClass(this.svgBlockCanvas_,"blocklyCanvasTransitioning"),t.utils.dom.removeClass(this.svgBubbleCanvas_,"blocklyCanvasTransitioning")},t.WorkspaceSvg.prototype.scrollCenter=function(){if(this.isMovable()){var t=this.getMetrics(),e=(t.scrollWidth-t.viewWidth)/2,n=(t.scrollHeight-t.viewHeight)/2;e=-e-t.scrollLeft,n=-n-t.scrollTop,this.scroll(e,n)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")},t.WorkspaceSvg.prototype.centerOnBlock=function(t){if(this.isMovable()){if(t=t?this.getBlockById(t):null){var e=t.getRelativeToSurfaceXY(),n=t.getHeightWidth(),i=this.scale;t=(e.x+(this.RTL?-1:1)*n.width/2)*i,e=(e.y+n.height/2)*i,n=this.getMetrics(),this.scroll(-(t-n.viewWidth/2),-(e-n.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")},t.WorkspaceSvg.prototype.setScale=function(e){this.options.zoomOptions.maxScale&&e>this.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&e<this.options.zoomOptions.minScale&&(e=this.options.zoomOptions.minScale),this.scale=e,t.hideChaff(!1),this.flyout_&&(this.flyout_.reflow(),this.recordDragTargets()),this.grid_&&this.grid_.update(this.scale),e=this.getMetrics(),this.scrollX-=e.absoluteLeft,this.scrollY-=e.absoluteTop,e.viewLeft+=e.absoluteLeft,e.viewTop+=e.absoluteTop,this.scroll(this.scrollX,this.scrollY),this.scrollbar&&(this.flyout_?this.scrollbar.resizeView(e):this.scrollbar.resizeContent(e))},t.WorkspaceSvg.prototype.getScale=function(){return this.options.parentWorkspace?this.options.parentWorkspace.getScale():this.scale},t.WorkspaceSvg.prototype.scroll=function(e,n){t.hideChaff(!0);var i=this.getMetrics();e=Math.min(e,-i.scrollLeft),n=Math.min(n,-i.scrollTop);var r=i.scrollTop+Math.max(0,i.scrollHeight-i.viewHeight);e=Math.max(e,-(i.scrollLeft+Math.max(0,i.scrollWidth-i.viewWidth))),n=Math.max(n,-r),this.scrollX=e,this.scrollY=n,this.scrollbar&&this.scrollbar.set(-(e+i.scrollLeft),-(n+i.scrollTop),!1),e+=i.absoluteLeft,n+=i.absoluteTop,this.translate(e,n)},t.WorkspaceSvg.setTopLevelWorkspaceMetrics_=function(t){var e=this.getMetrics();"number"==typeof t.x&&(this.scrollX=-(e.scrollLeft+(e.scrollWidth-e.viewWidth)*t.x)),"number"==typeof t.y&&(this.scrollY=-(e.scrollTop+(e.scrollHeight-e.viewHeight)*t.y)),this.translate(this.scrollX+e.absoluteLeft,this.scrollY+e.absoluteTop)},t.WorkspaceSvg.prototype.getBlockById=function(e){return t.WorkspaceSvg.superClass_.getBlockById.call(this,e)},t.WorkspaceSvg.prototype.getTopBlocks=function(e){return t.WorkspaceSvg.superClass_.getTopBlocks.call(this,e)},t.WorkspaceSvg.prototype.addTopBlock=function(e){this.addTopBoundedElement(e),t.WorkspaceSvg.superClass_.addTopBlock.call(this,e)},t.WorkspaceSvg.prototype.removeTopBlock=function(e){this.removeTopBoundedElement(e),t.WorkspaceSvg.superClass_.removeTopBlock.call(this,e)},t.WorkspaceSvg.prototype.addTopComment=function(e){this.addTopBoundedElement(e),t.WorkspaceSvg.superClass_.addTopComment.call(this,e)},t.WorkspaceSvg.prototype.removeTopComment=function(e){this.removeTopBoundedElement(e),t.WorkspaceSvg.superClass_.removeTopComment.call(this,e)},t.WorkspaceSvg.prototype.addTopBoundedElement=function(t){this.topBoundedElements_.push(t)},t.WorkspaceSvg.prototype.removeTopBoundedElement=function(e){t.utils.arrayRemove(this.topBoundedElements_,e)},t.WorkspaceSvg.prototype.getTopBoundedElements=function(){return[].concat(this.topBoundedElements_)},t.WorkspaceSvg.prototype.setResizesEnabled=function(t){var e=!this.resizesEnabled_&&t;this.resizesEnabled_=t,e&&this.resizeContents()},t.WorkspaceSvg.prototype.clear=function(){this.setResizesEnabled(!1),t.WorkspaceSvg.superClass_.clear.call(this),this.topBoundedElements_=[],this.setResizesEnabled(!0)},t.WorkspaceSvg.prototype.registerButtonCallback=function(t,e){if("function"!=typeof e)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks_[t]=e},t.WorkspaceSvg.prototype.getButtonCallback=function(t){return(t=this.flyoutButtonCallbacks_[t])?t:null},t.WorkspaceSvg.prototype.removeButtonCallback=function(t){this.flyoutButtonCallbacks_[t]=null},t.WorkspaceSvg.prototype.registerToolboxCategoryCallback=function(t,e){if("function"!=typeof e)throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks_[t]=e},t.WorkspaceSvg.prototype.getToolboxCategoryCallback=function(t){return this.toolboxCategoryCallbacks_[t]||null},t.WorkspaceSvg.prototype.removeToolboxCategoryCallback=function(t){this.toolboxCategoryCallbacks_[t]=null},t.WorkspaceSvg.prototype.getGesture=function(e){var n="mousedown"==e.type||"touchstart"==e.type||"pointerdown"==e.type,i=this.currentGesture_;return i?n&&i.hasStarted()?(console.warn("Tried to start the same gesture twice."),i.cancel(),null):i:n?this.currentGesture_=new t.TouchGesture(e,this):null},t.WorkspaceSvg.prototype.clearGesture=function(){this.currentGesture_=null},t.WorkspaceSvg.prototype.cancelCurrentGesture=function(){this.currentGesture_&&this.currentGesture_.cancel()},t.WorkspaceSvg.prototype.getAudioManager=function(){return this.audioManager_},t.WorkspaceSvg.prototype.getGrid=function(){return this.grid_},t.inject=function(e,n){if(t.checkBlockColourConstants(),"string"==typeof e&&(e=document.getElementById(e)||document.querySelector(e)),!e||!t.utils.dom.containsNode(document,e))throw Error("Error: container is not in current document.");n=new t.Options(n||{});var i=document.createElement("div");i.className="injectionDiv",i.tabIndex=0,t.utils.aria.setState(i,t.utils.aria.State.LABEL,t.Msg.WORKSPACE_ARIA_LABEL),e.appendChild(i),e=t.createDom_(i,n);var r=new t.BlockDragSurfaceSvg(i),o=new t.WorkspaceDragSurfaceSvg(i),s=t.createMainWorkspace_(e,n,r,o);return t.init_(s),t.mainWorkspace=s,t.svgResize(s),i.addEventListener("focusin",function(){t.mainWorkspace=s}),s},t.createDom_=function(e,n){e.setAttribute("dir","LTR"),t.Css.inject(n.hasCss,n.pathToMedia),e=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",class:"blocklySvg",tabindex:"0"},e);var i=t.utils.dom.createSvgElement(t.utils.Svg.DEFS,{},e),r=String(Math.random()).substring(2);return n.gridPattern=t.Grid.createDom(r,n.gridOptions,i),e},t.createMainWorkspace_=function(e,n,i,r){return n.parentWorkspace=null,i=(n=new t.WorkspaceSvg(n,i,r)).options,n.scale=i.zoomOptions.startScale,e.appendChild(n.createDom("blocklyMainBackground")),t.utils.dom.addClass(n.getInjectionDiv(),n.getRenderer().getClassName()),t.utils.dom.addClass(n.getInjectionDiv(),n.getTheme().getClassName()),!i.hasCategories&&i.languageTree&&(r=n.addFlyout(t.utils.Svg.SVG),t.utils.dom.insertAfter(r,e)),i.hasTrashcan&&n.addTrashcan(),i.zoomOptions&&i.zoomOptions.controls&&n.addZoomControls(),n.getThemeManager().subscribe(e,"workspaceBackgroundColour","background-color"),n.translate(0,0),n.addChangeListener(t.bumpIntoBoundsHandler_(n)),t.svgResize(n),t.WidgetDiv.createDom(),t.DropDownDiv.createDom(),t.Tooltip.createDom(),n},t.extractObjectFromEvent_=function(e,n){var i=null;switch(n.type){case t.Events.BLOCK_CREATE:case t.Events.BLOCK_MOVE:(i=e.getBlockById(n.blockId))&&(i=i.getRootBlock());break;case t.Events.COMMENT_CREATE:case t.Events.COMMENT_MOVE:i=e.getCommentById(n.commentId)}return i},t.bumpTopObjectsIntoBounds_=function(e){var n=e.getMetricsManager();if(n.hasFixedEdges()&&!e.isDragging()){n=n.getScrollMetrics(!0);for(var i,r=e.getTopBoundedElements(),o=0;i=r[o];o++)t.bumpObjectIntoBounds_(e,n,i)}},t.bumpIntoBoundsHandler_=function(e){return function(n){var i=e.getMetricsManager();if(i.hasFixedEdges()&&!e.isDragging())if(-1!==t.Events.BUMP_EVENTS.indexOf(n.type)){i=i.getScrollMetrics(!0);var r=t.extractObjectFromEvent_(e,n);if(r){var o=t.Events.getGroup();t.Events.setGroup(n.group),t.bumpObjectIntoBounds_(e,i,r)&&!n.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),null!==o&&t.Events.setGroup(o)}}else n.type===t.Events.VIEWPORT_CHANGE&&n.scale>n.oldScale&&t.bumpTopObjectsIntoBounds_(e)}},t.bumpObjectIntoBounds_=function(e,n,i){var r=i.getBoundingRectangle(),o=r.right-r.left,s=t.utils.math.clamp(n.top,r.top,n.top+n.height-(r.bottom-r.top))-r.top,a=n.left;return n=n.left+n.width-o,e.RTL?a=Math.min(n,a):n=Math.max(a,n),!(!(e=t.utils.math.clamp(a,r.left,n)-r.left)&&!s)&&(i.moveBy(e,s),!0)},t.init_=function(e){var n=e.options,i=e.getParentSvg();if(t.browserEvents.conditionalBind(i.parentNode,"contextmenu",null,function(e){t.utils.isTargetInput(e)||e.preventDefault()}),i=t.browserEvents.conditionalBind(window,"resize",null,function(){t.hideChaff(!0),t.svgResize(e),t.bumpTopObjectsIntoBounds_(e)}),e.setResizeHandlerWrapper(i),t.inject.bindDocumentEvents_(),n.languageTree){i=e.getToolbox();var r=e.getFlyout(!0);i?i.init():r&&(r.init(e),r.show(n.languageTree),"function"==typeof r.scrollToStart&&r.scrollToStart())}n.hasTrashcan&&e.trashcan.init(),n.zoomOptions&&n.zoomOptions.controls&&e.zoomControls_.init(),n.moveOptions&&n.moveOptions.scrollbars?(e.scrollbar=new t.ScrollbarPair(e,!0===n.moveOptions.scrollbars||!!n.moveOptions.scrollbars.horizontal,!0===n.moveOptions.scrollbars||!!n.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),n.hasSounds&&t.inject.loadSounds_(n.pathToMedia,e)},t.inject.bindDocumentEvents_=function(){t.documentEventsBound_||(t.browserEvents.conditionalBind(document,"scroll",null,function(){for(var e,n=t.Workspace.getAll(),i=0;e=n[i];i++)e.updateInverseScreenCTM&&e.updateInverseScreenCTM()}),t.browserEvents.conditionalBind(document,"keydown",null,t.onKeyDown),t.browserEvents.bind(document,"touchend",null,t.longStop_),t.browserEvents.bind(document,"touchcancel",null,t.longStop_),t.utils.userAgent.IPAD&&t.browserEvents.conditionalBind(window,"orientationchange",document,function(){t.svgResize(t.getMainWorkspace())})),t.documentEventsBound_=!0},t.inject.loadSounds_=function(e,n){var i=n.getAudioManager();i.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),i.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),i.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");var r=[];e=function(){for(;r.length;)t.browserEvents.unbind(r.pop());i.preload()},r.push(t.browserEvents.conditionalBind(document,"mousemove",null,e,!0)),r.push(t.browserEvents.conditionalBind(document,"touchstart",null,e,!0))},t.Names=function(t,e){if(this.variablePrefix_=e||"",this.reservedDict_=Object.create(null),t)for(t=t.split(","),e=0;e<t.length;e++)this.reservedDict_[t[e]]=!0;this.reset()},t.Names.DEVELOPER_VARIABLE_TYPE="DEVELOPER_VARIABLE",t.Names.prototype.reset=function(){this.db_=Object.create(null),this.dbReverse_=Object.create(null),this.variableMap_=null},t.Names.prototype.setVariableMap=function(t){this.variableMap_=t},t.Names.prototype.getNameForUserVariable_=function(t){return this.variableMap_?(t=this.variableMap_.getVariableById(t))?t.name:null:(console.warn("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the following code in your generator's init() function:\nBlockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());"),null)},t.Names.prototype.populateVariables=function(e){e=t.Variables.allUsedVarModels(e);for(var n=0;n<e.length;n++)this.getName(e[n].getId(),t.VARIABLE_CATEGORY_NAME)},t.Names.prototype.populateProcedures=function(e){e=(e=t.Procedures.allProcedures(e))[0].concat(e[1]);for(var n=0;n<e.length;n++)this.getName(e[n][0],t.PROCEDURE_CATEGORY_NAME)},t.Names.prototype.getName=function(e,n){var i=e;n==t.VARIABLE_CATEGORY_NAME&&(e=this.getNameForUserVariable_(e))&&(i=e),e=i.toLowerCase();var r=n==t.VARIABLE_CATEGORY_NAME||n==t.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"";n in this.db_||(this.db_[n]=Object.create(null));var o=this.db_[n];return e in o?r+o[e]:(n=this.getDistinctName(i,n),o[e]=n.substr(r.length),n)},t.Names.prototype.getUserNames=function(t){return Object.keys(this.db_[t]||{})},t.Names.prototype.getDistinctName=function(e,n){e=this.safeName_(e);for(var i="";this.dbReverse_[e+i]||e+i in this.reservedDict_;)i=i?i+1:2;return e+=i,this.dbReverse_[e]=!0,(n==t.VARIABLE_CATEGORY_NAME||n==t.Names.DEVELOPER_VARIABLE_TYPE?this.variablePrefix_:"")+e},t.Names.prototype.safeName_=function(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(e[0])&&(e="my_"+e)):e=t.Msg.UNNAMED_KEY||"unnamed",e},t.Names.equals=function(t,e){return t.toLowerCase()==e.toLowerCase()},t.Procedures={},t.Procedures.NAME_TYPE=t.PROCEDURE_CATEGORY_NAME,t.Procedures.DEFAULT_ARG="x",t.Procedures.allProcedures=function(e){var n=e.getBlocksByType("procedures_defnoreturn",!1).map(function(t){return t.getProcedureDef()});return e=e.getBlocksByType("procedures_defreturn",!1).map(function(t){return t.getProcedureDef()}),n.sort(t.Procedures.procTupleComparator_),e.sort(t.Procedures.procTupleComparator_),[n,e]},t.Procedures.procTupleComparator_=function(t,e){return t[0].localeCompare(e[0],void 0,{sensitivity:"base"})},t.Procedures.findLegalName=function(e,n){if(n.isInFlyout)return e;for(e=e||t.Msg.UNNAMED_KEY||"unnamed";!t.Procedures.isLegalName_(e,n.workspace,n);){var i=e.match(/^(.*?)(\d+)$/);e=i?i[1]+(parseInt(i[2],10)+1):e+"2"}return e},t.Procedures.isLegalName_=function(e,n,i){return!t.Procedures.isNameUsed(e,n,i)},t.Procedures.isNameUsed=function(e,n,i){n=n.getAllBlocks(!1);for(var r=0;r<n.length;r++)if(n[r]!=i&&n[r].getProcedureDef){var o=n[r].getProcedureDef();if(t.Names.equals(o[0],e))return!0}return!1},t.Procedures.rename=function(e){e=e.trim();var n=t.Procedures.findLegalName(e,this.getSourceBlock()),i=this.getValue();if(i!=e&&i!=n){e=this.getSourceBlock().workspace.getAllBlocks(!1);for(var r=0;r<e.length;r++)e[r].renameProcedure&&e[r].renameProcedure(i,n)}return n},t.Procedures.flyoutCategory=function(e){function n(e,n){for(var r=0;r<e.length;r++){var o=e[r][0],s=e[r][1],a=t.utils.xml.createElement("block");a.setAttribute("type",n),a.setAttribute("gap",16);var l=t.utils.xml.createElement("mutation");for(l.setAttribute("name",o),a.appendChild(l),o=0;o<s.length;o++){var u=t.utils.xml.createElement("arg");u.setAttribute("name",s[o]),l.appendChild(u)}i.push(a)}}var i=[];if(t.Blocks.procedures_defnoreturn){var r=t.utils.xml.createElement("block");r.setAttribute("type","procedures_defnoreturn"),r.setAttribute("gap",16);var o=t.utils.xml.createElement("field");o.setAttribute("name","NAME"),o.appendChild(t.utils.xml.createTextNode(t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE)),r.appendChild(o),i.push(r)}return t.Blocks.procedures_defreturn&&((r=t.utils.xml.createElement("block")).setAttribute("type","procedures_defreturn"),r.setAttribute("gap",16),(o=t.utils.xml.createElement("field")).setAttribute("name","NAME"),o.appendChild(t.utils.xml.createTextNode(t.Msg.PROCEDURES_DEFRETURN_PROCEDURE)),r.appendChild(o),i.push(r)),t.Blocks.procedures_ifreturn&&((r=t.utils.xml.createElement("block")).setAttribute("type","procedures_ifreturn"),r.setAttribute("gap",16),i.push(r)),i.length&&i[i.length-1].setAttribute("gap",24),n((e=t.Procedures.allProcedures(e))[0],"procedures_callnoreturn"),n(e[1],"procedures_callreturn"),i},t.Procedures.updateMutatorFlyout_=function(e){for(var n,i=[],r=e.getBlocksByType("procedures_mutatorarg",!1),o=0;n=r[o];o++)i.push(n.getFieldValue("NAME"));r=t.utils.xml.createElement("xml"),(o=t.utils.xml.createElement("block")).setAttribute("type","procedures_mutatorarg"),(n=t.utils.xml.createElement("field")).setAttribute("name","NAME"),i=t.Variables.generateUniqueNameFromOptions(t.Procedures.DEFAULT_ARG,i),i=t.utils.xml.createTextNode(i),n.appendChild(i),o.appendChild(n),r.appendChild(o),e.updateToolbox(r)},t.Procedures.mutatorOpenListener=function(e){if(e.type==t.Events.BUBBLE_OPEN&&"mutator"===e.bubbleType&&e.isOpen){var n=(e=t.Workspace.getById(e.workspaceId).getBlockById(e.blockId)).type;"procedures_defnoreturn"!=n&&"procedures_defreturn"!=n||(e=e.mutator.getWorkspace(),t.Procedures.updateMutatorFlyout_(e),e.addChangeListener(t.Procedures.mutatorChangeListener_))}},t.Procedures.mutatorChangeListener_=function(e){e.type!=t.Events.BLOCK_CREATE&&e.type!=t.Events.BLOCK_DELETE&&e.type!=t.Events.BLOCK_CHANGE||(e=t.Workspace.getById(e.workspaceId),t.Procedures.updateMutatorFlyout_(e))},t.Procedures.getCallers=function(e,n){var i=[];n=n.getAllBlocks(!1);for(var r=0;r<n.length;r++)if(n[r].getProcedureCall){var o=n[r].getProcedureCall();o&&t.Names.equals(o,e)&&i.push(n[r])}return i},t.Procedures.mutateCallers=function(e){var n,i=t.Events.recordUndo,r=e.getProcedureDef()[0],o=e.mutationToDom(!0);for(e=t.Procedures.getCallers(r,e.workspace),r=0;n=e[r];r++){var s=n.mutationToDom();s=s&&t.Xml.domToText(s),n.domToMutation(o);var a=n.mutationToDom();s!=(a=a&&t.Xml.domToText(a))&&(t.Events.recordUndo=!1,t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(n,"mutation",null,s,a)),t.Events.recordUndo=i)}},t.Procedures.getDefinition=function(e,n){n=n.getAllBlocks(!1);for(var i=0;i<n.length;i++)if(n[i].getProcedureDef){var r=n[i].getProcedureDef();if(r&&t.Names.equals(r[0],e))return n[i]}return null},t.ShortcutRegistry=function(){t.ShortcutRegistry.registry=this,this.registry_=Object.create(null),this.keyMap_=Object.create(null)},t.ShortcutRegistry.modifierKeys={Shift:t.utils.KeyCodes.SHIFT,Control:t.utils.KeyCodes.CTRL,Alt:t.utils.KeyCodes.ALT,Meta:t.utils.KeyCodes.META},t.ShortcutRegistry.prototype.register=function(t,e){if(this.registry_[t.name]&&!e)throw Error('Shortcut with name "'+t.name+'" already exists.');this.registry_[t.name]=t},t.ShortcutRegistry.prototype.unregister=function(t){return this.registry_[t]?(this.removeAllKeyMappings(t),delete this.registry_[t],!0):(console.warn('Keyboard shortcut with name "'+t+'" not found.'),!1)},t.ShortcutRegistry.prototype.addKeyMapping=function(t,e,n){t=String(t);var i=this.keyMap_[t];if(i&&!n)throw Error('Shortcut with name "'+e+'" collides with shortcuts '+i.toString());i&&n?i.unshift(e):this.keyMap_[t]=[e]},t.ShortcutRegistry.prototype.removeKeyMapping=function(t,e,n){var i=this.keyMap_[t];if(!i&&!n)return console.warn('No keyboard shortcut with name "'+e+'" registered with key code "'+t+'"'),!1;var r=i.indexOf(e);return-1<r?(i.splice(r,1),0==i.length&&delete this.keyMap_[t],!0):(n||console.warn('No keyboard shortcut with name "'+e+'" registered with key code "'+t+'"'),!1)},t.ShortcutRegistry.prototype.removeAllKeyMappings=function(t){for(var e in this.keyMap_)this.removeKeyMapping(e,t,!0)},t.ShortcutRegistry.prototype.setKeyMap=function(t){this.keyMap_=t},t.ShortcutRegistry.prototype.getKeyMap=function(){return t.utils.object.deepMerge(Object.create(null),this.keyMap_)},t.ShortcutRegistry.prototype.getRegistry=function(){return t.utils.object.deepMerge(Object.create(null),this.registry_)},t.ShortcutRegistry.prototype.onKeyDown=function(t,e){var n=this.serializeKeyEvent_(e);if(!(n=this.getShortcutNamesByKeyCode(n)))return!1;for(var i,r=0;i=n[r];r++)if((!(i=this.registry_[i]).preconditionFn||i.preconditionFn(t))&&i.callback&&i.callback(t,e,i))return!0;return!1},t.ShortcutRegistry.prototype.getShortcutNamesByKeyCode=function(t){return this.keyMap_[t]||[]},t.ShortcutRegistry.prototype.getKeyCodesByShortcutName=function(t){var e,n=[];for(e in this.keyMap_)-1<this.keyMap_[e].indexOf(t)&&n.push(e);return n},t.ShortcutRegistry.prototype.serializeKeyEvent_=function(e){var n,i="";for(n in t.ShortcutRegistry.modifierKeys)e.getModifierState(n)&&(""!=i&&(i+="+"),i+=n);return""!=i&&e.keyCode?i=i+"+"+e.keyCode:e.keyCode&&(i=e.keyCode.toString()),i},t.ShortcutRegistry.prototype.checkModifiers_=function(e){for(var n,i=t.utils.object.values(t.ShortcutRegistry.modifierKeys),r=0;n=e[r];r++)if(0>i.indexOf(n))throw Error(n+" is not a valid modifier key.")},t.ShortcutRegistry.prototype.createSerializedKey=function(e,n){var i="";if(n)for(var r in this.checkModifiers_(n),t.ShortcutRegistry.modifierKeys)-1<n.indexOf(t.ShortcutRegistry.modifierKeys[r])&&(""!=i&&(i+="+"),i+=r);return""!=i&&e?i=i+"+"+e:e&&(i=e.toString()),i},new t.ShortcutRegistry,t.VariableModel=function(e,n,i,r){this.workspace=e,this.name=n,this.type=i||"",this.id_=r||t.utils.genUid(),t.Events.fire(new(t.Events.get(t.Events.VAR_CREATE))(this))},t.VariableModel.prototype.getId=function(){return this.id_},t.VariableModel.compareByName=function(t,e){return t.name.localeCompare(e.name,void 0,{sensitivity:"base"})},t.Variables={},t.Variables.NAME_TYPE=t.VARIABLE_CATEGORY_NAME,t.Variables.allUsedVarModels=function(t){var e=t.getAllBlocks(!1);t=Object.create(null);for(var n=0;n<e.length;n++){var i=e[n].getVarModels();if(i)for(var r=0;r<i.length;r++){var o=i[r],s=o.getId();s&&(t[s]=o)}}for(s in e=[],t)e.push(t[s]);return e},t.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_={},t.Variables.allDeveloperVariables=function(e){e=e.getAllBlocks(!1);for(var n,i=Object.create(null),r=0;n=e[r];r++){var o=n.getDeveloperVariables;if(!o&&n.getDeveloperVars&&(o=n.getDeveloperVars,t.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[n.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+n.type+"')"),t.Variables.ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE_[n.type]=!0)),o)for(n=o(),o=0;o<n.length;o++)i[n[o]]=!0}return Object.keys(i)},t.Variables.flyoutCategory=function(e){var n=[],i=document.createElement("button");return i.setAttribute("text","%{BKY_NEW_VARIABLE}"),i.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace())}),n.push(i),e=t.Variables.flyoutCategoryBlocks(e),n.concat(e)},t.Variables.flyoutCategoryBlocks=function(e){var n=[];if(0<(e=e.getVariablesOfType("")).length){var i=e[e.length-1];if(t.Blocks.variables_set){var r=t.utils.xml.createElement("block");r.setAttribute("type","variables_set"),r.setAttribute("gap",t.Blocks.math_change?8:24),r.appendChild(t.Variables.generateVariableFieldDom(i)),n.push(r)}if(t.Blocks.math_change&&((r=t.utils.xml.createElement("block")).setAttribute("type","math_change"),r.setAttribute("gap",t.Blocks.variables_get?20:8),r.appendChild(t.Variables.generateVariableFieldDom(i)),i=t.Xml.textToDom('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),r.appendChild(i),n.push(r)),t.Blocks.variables_get){e.sort(t.VariableModel.compareByName),i=0;for(var o;o=e[i];i++)(r=t.utils.xml.createElement("block")).setAttribute("type","variables_get"),r.setAttribute("gap",8),r.appendChild(t.Variables.generateVariableFieldDom(o)),n.push(r)}}return n},t.Variables.VAR_LETTER_OPTIONS="ijkmnopqrstuvwxyzabcdefgh",t.Variables.generateUniqueName=function(e){return t.Variables.generateUniqueNameFromOptions(t.Variables.VAR_LETTER_OPTIONS.charAt(0),e.getAllVariableNames())},t.Variables.generateUniqueNameFromOptions=function(e,n){if(!n.length)return e;for(var i=t.Variables.VAR_LETTER_OPTIONS,r="",o=i.indexOf(e);;){for(var s=!1,a=0;a<n.length;a++)if(n[a].toLowerCase()==e){s=!0;break}if(!s)return e;++o==i.length&&(o=0,r=Number(r)+1),e=i.charAt(o)+r}},t.Variables.createVariableButtonHandler=function(e,n,i){var r=i||"",o=function(i){t.Variables.promptName(t.Msg.NEW_VARIABLE_TITLE,i,function(i){if(i){var s=t.Variables.nameUsedWithAnyType(i,e);if(s){if(s.type==r)var a=t.Msg.VARIABLE_ALREADY_EXISTS.replace("%1",s.name);else a=(a=t.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE).replace("%1",s.name).replace("%2",s.type);t.alert(a,function(){o(i)})}else e.createVariable(i,r),n&&n(i)}else n&&n(null)})};o("")},t.Variables.createVariable=t.Variables.createVariableButtonHandler,t.Variables.renameVariable=function(e,n,i){var r=function(o){var s=t.Msg.RENAME_VARIABLE_TITLE.replace("%1",n.name);t.Variables.promptName(s,o,function(o){if(o){var s=t.Variables.nameUsedWithOtherType_(o,n.type,e);s?(s=t.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",s.name).replace("%2",s.type),t.alert(s,function(){r(o)})):(e.renameVariableById(n.getId(),o),i&&i(o))}else i&&i(null)})};r("")},t.Variables.promptName=function(e,n,i){t.prompt(e,n,function(e){e&&((e=e.replace(/[\s\xa0]+/g," ").trim())==t.Msg.RENAME_VARIABLE||e==t.Msg.NEW_VARIABLE)&&(e=null),i(e)})},t.Variables.nameUsedWithOtherType_=function(t,e,n){n=n.getVariableMap().getAllVariables(),t=t.toLowerCase();for(var i,r=0;i=n[r];r++)if(i.name.toLowerCase()==t&&i.type!=e)return i;return null},t.Variables.nameUsedWithAnyType=function(t,e){e=e.getVariableMap().getAllVariables(),t=t.toLowerCase();for(var n,i=0;n=e[i];i++)if(n.name.toLowerCase()==t)return n;return null},t.Variables.generateVariableFieldDom=function(e){var n=t.utils.xml.createElement("field");return n.setAttribute("name","VAR"),n.setAttribute("id",e.getId()),n.setAttribute("variabletype",e.type),e=t.utils.xml.createTextNode(e.name),n.appendChild(e),n},t.Variables.getOrCreateVariablePackage=function(e,n,i,r){var o=t.Variables.getVariable(e,n,i,r);return o||(o=t.Variables.createVariable_(e,n,i,r)),o},t.Variables.getVariable=function(t,e,n,i){var r=t.getPotentialVariableMap(),o=null;if(e&&(!(o=t.getVariableById(e))&&r&&(o=r.getVariableById(e)),o))return o;if(n){if(void 0==i)throw Error("Tried to look up a variable by name without a type");!(o=t.getVariable(n,i))&&r&&(o=r.getVariable(n,i))}return o},t.Variables.createVariable_=function(e,n,i,r){var o=e.getPotentialVariableMap();return i||(i=t.Variables.generateUniqueName(e.isFlyout?e.targetWorkspace:e)),o?o.createVariable(i,r,n):e.createVariable(i,r,n)},t.Variables.getAddedVariables=function(t,e){t=t.getAllVariables();var n=[];if(e.length!=t.length)for(var i=0;i<t.length;i++){var r=t[i];-1==e.indexOf(r)&&n.push(r)}return n},t.VERSION="6.20210701.0",t.mainWorkspace=null,t.selected=null,t.draggingConnections=[],t.clipboardXml_=null,t.clipboardSource_=null,t.clipboardTypeCounts_=null,t.cache3dSupported_=null,t.parentContainer=null,t.svgSize=function(e){return t.utils.deprecation.warn("Blockly.svgSize","March 2021","March 2022","workspace.getCachedParentSvgSize"),new t.utils.Size(e.cachedWidth_,e.cachedHeight_)},t.resizeSvgContents=function(t){t.resizeContents()},t.svgResize=function(t){for(;t.options.parentWorkspace;)t=t.options.parentWorkspace;var e=t.getParentSvg(),n=t.getCachedParentSvgSize(),i=e.parentNode;if(i){var r=i.offsetWidth;i=i.offsetHeight,n.width!=r&&(e.setAttribute("width",r+"px"),t.setCachedParentSvgSize(r,null)),n.height!=i&&(e.setAttribute("height",i+"px"),t.setCachedParentSvgSize(null,i)),t.resize()}},t.onKeyDown=function(e){var n=t.mainWorkspace;n&&!(t.utils.isTargetInput(e)||n.rendered&&!n.isVisible())&&t.ShortcutRegistry.registry.onKeyDown(n,e)},t.deleteBlock=function(e){e.workspace.isFlyout||(t.Events.setGroup(!0),t.hideChaff(),e.outputConnection?e.dispose(!1,!0):e.dispose(!0,!0),t.Events.setGroup(!1))},t.copy=function(e){(e=e.toCopyData())&&(t.clipboardXml_=e.xml,t.clipboardSource_=e.source,t.clipboardTypeCounts_=e.typeCounts)},t.paste=function(){if(!t.clipboardXml_)return!1;var e=t.clipboardSource_;return e.isFlyout&&(e=e.targetWorkspace),!(!t.clipboardTypeCounts_||!e.isCapacityAvailable(t.clipboardTypeCounts_))&&(t.Events.setGroup(!0),e.paste(t.clipboardXml_),t.Events.setGroup(!1),!0)},t.duplicate=function(e){var n=t.clipboardXml_,i=t.clipboardSource_;t.copy(e),e.workspace.paste(t.clipboardXml_),t.clipboardXml_=n,t.clipboardSource_=i},t.onContextMenu_=function(e){t.utils.isTargetInput(e)||e.preventDefault()},t.hideChaff=function(e){t.Tooltip.hide(),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation();var n=!!e;t.getMainWorkspace().getComponentManager().getComponents(t.ComponentManager.Capability.AUTOHIDEABLE,!0).forEach(function(t){t.autoHide(n)})},t.getMainWorkspace=function(){return t.mainWorkspace},t.alert=function(t,e){alert(t),e&&e()},t.confirm=function(t,e){e(confirm(t))},t.prompt=function(t,e,n){n(prompt(t,e))},t.jsonInitFactory_=function(t){return function(){this.jsonInit(t)}},t.defineBlocksWithJsonArray=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i){var r=i.type;null==r||""===r?console.warn("Block definition #"+n+" in JSON array is missing a type attribute. Skipping."):(t.Blocks[r]&&console.warn("Block definition #"+n+' in JSON array overwrites prior definition of "'+r+'".'),t.Blocks[r]={init:t.jsonInitFactory_(i)})}else console.warn("Block definition #"+n+" in JSON array is "+i+". Skipping.")}},t.isNumber=function(t){return/^\s*-?\d+(\.\d+)?\s*$/.test(t)},t.hueToHex=function(e){return t.utils.colour.hsvToHex(e,t.HSV_SATURATION,255*t.HSV_VALUE)},t.checkBlockColourConstants=function(){t.checkBlockColourConstant_("LOGIC_HUE",["Blocks","logic","HUE"],void 0),t.checkBlockColourConstant_("LOGIC_HUE",["Constants","Logic","HUE"],210),t.checkBlockColourConstant_("LOOPS_HUE",["Blocks","loops","HUE"],void 0),t.checkBlockColourConstant_("LOOPS_HUE",["Constants","Loops","HUE"],120),t.checkBlockColourConstant_("MATH_HUE",["Blocks","math","HUE"],void 0),t.checkBlockColourConstant_("MATH_HUE",["Constants","Math","HUE"],230),t.checkBlockColourConstant_("TEXTS_HUE",["Blocks","texts","HUE"],void 0),t.checkBlockColourConstant_("TEXTS_HUE",["Constants","Text","HUE"],160),t.checkBlockColourConstant_("LISTS_HUE",["Blocks","lists","HUE"],void 0),t.checkBlockColourConstant_("LISTS_HUE",["Constants","Lists","HUE"],260),t.checkBlockColourConstant_("COLOUR_HUE",["Blocks","colour","HUE"],void 0),t.checkBlockColourConstant_("COLOUR_HUE",["Constants","Colour","HUE"],20),t.checkBlockColourConstant_("VARIABLES_HUE",["Blocks","variables","HUE"],void 0),t.checkBlockColourConstant_("VARIABLES_HUE",["Constants","Variables","HUE"],330),t.checkBlockColourConstant_("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310),t.checkBlockColourConstant_("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)},t.checkBlockColourConstant_=function(e,n,i){for(var r="Blockly",o=t,s=0;s<n.length;++s)r+="."+n[s],o&&(o=o[n[s]]);o&&o!==i&&(e=(void 0===i?'%1 has been removed. Use Blockly.Msg["%2"].':'%1 is deprecated and unused. Override Blockly.Msg["%2"].').replace("%1",r).replace("%2",e),console.warn(e))},t.setParentContainer=function(e){t.parentContainer=e},t.bindEvent_=t.browserEvents.bind,t.unbindEvent_=t.browserEvents.unbind,t.bindEventWithChecks_=t.browserEvents.conditionalBind,t.ALIGN_LEFT=t.constants.ALIGN.LEFT,t.ALIGN_CENTRE=t.constants.ALIGN.CENTRE,t.ALIGN_RIGHT=t.constants.ALIGN.RIGHT,t.INPUT_VALUE=t.connectionTypes.INPUT_VALUE,t.OUTPUT_VALUE=t.connectionTypes.OUTPUT_VALUE,t.NEXT_STATEMENT=t.connectionTypes.NEXT_STATEMENT,t.PREVIOUS_STATEMENT=t.connectionTypes.PREVIOUS_STATEMENT,t.DUMMY_INPUT=t.inputTypes.DUMMY,t.TOOLBOX_AT_TOP=t.utils.toolbox.Position.TOP,t.TOOLBOX_AT_BOTTOM=t.utils.toolbox.Position.BOTTOM,t.TOOLBOX_AT_LEFT=t.utils.toolbox.Position.LEFT,t.TOOLBOX_AT_RIGHT=t.utils.toolbox.Position.RIGHT,t.Events.BubbleOpen=function(e,n,i){t.Events.BubbleOpen.superClass_.constructor.call(this,e?e.workspace.id:void 0),this.blockId=e?e.id:null,this.isOpen=n,this.bubbleType=i},t.utils.object.inherits(t.Events.BubbleOpen,t.Events.UiBase),t.Events.BubbleOpen.prototype.type=t.Events.BUBBLE_OPEN,t.Events.BubbleOpen.prototype.toJson=function(){var e=t.Events.BubbleOpen.superClass_.toJson.call(this);return e.isOpen=this.isOpen,e.bubbleType=this.bubbleType,e.blockId=this.blockId,e},t.Events.BubbleOpen.prototype.fromJson=function(e){t.Events.BubbleOpen.superClass_.fromJson.call(this,e),this.isOpen=e.isOpen,this.bubbleType=e.bubbleType,this.blockId=e.blockId},t.registry.register(t.registry.Type.EVENT,t.Events.BUBBLE_OPEN,t.Events.BubbleOpen),t.Icon=function(t){this.block_=t,this.iconGroup_=null},t.Icon.prototype.collapseHidden=!0,t.Icon.prototype.SIZE=17,t.Icon.prototype.bubble_=null,t.Icon.prototype.iconXY_=null,t.Icon.prototype.createIcon=function(){this.iconGroup_||(this.iconGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyIconGroup"},null),this.block_.isInFlyout&&t.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly"),this.drawIcon_(this.iconGroup_),this.block_.getSvgRoot().appendChild(this.iconGroup_),t.browserEvents.conditionalBind(this.iconGroup_,"mouseup",this,this.iconClick_),this.updateEditable())},t.Icon.prototype.dispose=function(){t.utils.dom.removeNode(this.iconGroup_),this.iconGroup_=null,this.setVisible(!1),this.block_=null},t.Icon.prototype.updateEditable=function(){},t.Icon.prototype.isVisible=function(){return!!this.bubble_},t.Icon.prototype.iconClick_=function(e){this.block_.workspace.isDragging()||this.block_.isInFlyout||t.utils.isRightButton(e)||this.setVisible(!this.isVisible())},t.Icon.prototype.applyColour=function(){this.isVisible()&&this.bubble_.setColour(this.block_.style.colourPrimary)},t.Icon.prototype.setIconLocation=function(t){this.iconXY_=t,this.isVisible()&&this.bubble_.setAnchorLocation(t)},t.Icon.prototype.computeIconLocation=function(){var e=this.block_.getRelativeToSurfaceXY(),n=t.utils.getRelativeXY(this.iconGroup_);e=new t.utils.Coordinate(e.x+n.x+this.SIZE/2,e.y+n.y+this.SIZE/2),t.utils.Coordinate.equals(this.getIconLocation(),e)||this.setIconLocation(e)},t.Icon.prototype.getIconLocation=function(){return this.iconXY_},t.Icon.prototype.getCorrectedSize=function(){return new t.utils.Size(t.Icon.prototype.SIZE,t.Icon.prototype.SIZE-2)},t.Warning=function(e){t.Warning.superClass_.constructor.call(this,e),this.createIcon(),this.text_=Object.create(null)},t.utils.object.inherits(t.Warning,t.Icon),t.Warning.prototype.collapseHidden=!1,t.Warning.prototype.drawIcon_=function(e){t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},e),t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},e),t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},e)},t.Warning.prototype.setVisible=function(e){e!=this.isVisible()&&(t.Events.fire(new(t.Events.get(t.Events.BUBBLE_OPEN))(this.block_,e,"warning")),e?this.createBubble_():this.disposeBubble_())},t.Warning.prototype.createBubble_=function(){this.paragraphElement_=t.Bubble.textToDom(this.getText()),this.bubble_=t.Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_),this.applyColour()},t.Warning.prototype.disposeBubble_=function(){this.bubble_.dispose(),this.paragraphElement_=this.bubble_=null},t.Warning.prototype.setText=function(t,e){this.text_[e]!=t&&(t?this.text_[e]=t:delete this.text_[e],this.isVisible()&&(this.setVisible(!1),this.setVisible(!0)))},t.Warning.prototype.getText=function(){var t,e=[];for(t in this.text_)e.push(this.text_[t]);return e.join("\n")},t.Warning.prototype.dispose=function(){this.block_.warning=null,t.Icon.prototype.dispose.call(this)},t.Comment=function(e){t.Comment.superClass_.constructor.call(this,e),this.model_=e.commentModel,this.model_.text=this.model_.text||"",this.cachedText_="",this.onInputWrapper_=this.onChangeWrapper_=this.onWheelWrapper_=this.onMouseUpWrapper_=null,this.createIcon()},t.utils.object.inherits(t.Comment,t.Icon),t.Comment.prototype.drawIcon_=function(e){t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},e),t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},e),t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},e)},t.Comment.prototype.createEditor_=function(){this.foreignObject_=t.utils.dom.createSvgElement(t.utils.Svg.FOREIGNOBJECT,{x:t.Bubble.BORDER_WIDTH,y:t.Bubble.BORDER_WIDTH},null);var e=document.createElementNS(t.utils.dom.HTML_NS,"body");e.setAttribute("xmlns",t.utils.dom.HTML_NS),e.className="blocklyMinimalBody";var n=this.textarea_=document.createElementNS(t.utils.dom.HTML_NS,"textarea");return n.className="blocklyCommentTextarea",n.setAttribute("dir",this.block_.RTL?"RTL":"LTR"),n.value=this.model_.text,this.resizeTextarea_(),e.appendChild(n),this.foreignObject_.appendChild(e),this.onMouseUpWrapper_=t.browserEvents.conditionalBind(n,"mouseup",this,this.startEdit_,!0,!0),this.onWheelWrapper_=t.browserEvents.conditionalBind(n,"wheel",this,function(t){t.stopPropagation()}),this.onChangeWrapper_=t.browserEvents.conditionalBind(n,"change",this,function(e){this.cachedText_!=this.model_.text&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this.block_,"comment",null,this.cachedText_,this.model_.text))}),this.onInputWrapper_=t.browserEvents.conditionalBind(n,"input",this,function(t){this.model_.text=n.value}),setTimeout(n.focus.bind(n),0),this.foreignObject_},t.Comment.prototype.updateEditable=function(){t.Comment.superClass_.updateEditable.call(this),this.isVisible()&&(this.disposeBubble_(),this.createBubble_())},t.Comment.prototype.onBubbleResize_=function(){this.isVisible()&&(this.model_.size=this.bubble_.getBubbleSize(),this.resizeTextarea_())},t.Comment.prototype.resizeTextarea_=function(){var e=this.model_.size,n=2*t.Bubble.BORDER_WIDTH,i=e.width-n;e=e.height-n,this.foreignObject_.setAttribute("width",i),this.foreignObject_.setAttribute("height",e),this.textarea_.style.width=i-4+"px",this.textarea_.style.height=e-4+"px"},t.Comment.prototype.setVisible=function(e){e!=this.isVisible()&&(t.Events.fire(new(t.Events.get(t.Events.BUBBLE_OPEN))(this.block_,e,"comment")),(this.model_.pinned=e)?this.createBubble_():this.disposeBubble_())},t.Comment.prototype.createBubble_=function(){!this.block_.isEditable()||t.utils.userAgent.IE?this.createNonEditableBubble_():this.createEditableBubble_()},t.Comment.prototype.createEditableBubble_=function(){this.bubble_=new t.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,this.model_.size.width,this.model_.size.height),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerResizeEvent(this.onBubbleResize_.bind(this)),this.applyColour()},t.Comment.prototype.createNonEditableBubble_=function(){this.paragraphElement_=t.Bubble.textToDom(this.block_.getCommentText()),this.bubble_=t.Bubble.createNonEditableBubble(this.paragraphElement_,this.block_,this.iconXY_),this.applyColour()},t.Comment.prototype.disposeBubble_=function(){this.onMouseUpWrapper_&&(t.browserEvents.unbind(this.onMouseUpWrapper_),this.onMouseUpWrapper_=null),this.onWheelWrapper_&&(t.browserEvents.unbind(this.onWheelWrapper_),this.onWheelWrapper_=null),this.onChangeWrapper_&&(t.browserEvents.unbind(this.onChangeWrapper_),this.onChangeWrapper_=null),this.onInputWrapper_&&(t.browserEvents.unbind(this.onInputWrapper_),this.onInputWrapper_=null),this.bubble_.dispose(),this.paragraphElement_=this.foreignObject_=this.textarea_=this.bubble_=null},t.Comment.prototype.startEdit_=function(t){this.bubble_.promote()&&this.textarea_.focus(),this.cachedText_=this.model_.text},t.Comment.prototype.getBubbleSize=function(){return this.model_.size},t.Comment.prototype.setBubbleSize=function(t,e){this.bubble_?this.bubble_.setBubbleSize(t,e):(this.model_.size.width=t,this.model_.size.height=e)},t.Comment.prototype.updateText=function(){this.textarea_?this.textarea_.value=this.model_.text:this.paragraphElement_&&(this.paragraphElement_.firstChild.textContent=this.model_.text)},t.Comment.prototype.dispose=function(){this.block_.comment=null,t.Icon.prototype.dispose.call(this)},t.Css.register(".blocklyCommentTextarea {,background-color: #fef49c;,border: 0;,outline: 0;,margin: 0;,padding: 3px;,resize: none;,display: block;,text-overflow: hidden;,}".split(",")),t.IComponent=function(){},t.IDragTarget=function(){},t.DragTarget=function(){},t.DragTarget.prototype.onDragEnter=function(t){},t.DragTarget.prototype.onDragOver=function(t){},t.DragTarget.prototype.onDragExit=function(t){},t.DragTarget.prototype.onDrop=function(t){},t.DragTarget.prototype.shouldPreventMove=function(t){return!1},t.IDeleteArea=function(){},t.DeleteArea=function(){t.DeleteArea.superClass_.constructor.call(this),this.wouldDelete_=!1},t.utils.object.inherits(t.DeleteArea,t.DragTarget),t.DeleteArea.prototype.wouldDelete=function(e,n){return e instanceof t.BlockSvg?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e&&!n)):this.updateWouldDelete_(e.isDeletable()),this.wouldDelete_},t.DeleteArea.prototype.updateWouldDelete_=function(t){this.wouldDelete_=t},t.IFlyout=function(){},t.Flyout=function(e){t.Flyout.superClass_.constructor.call(this),e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new t.WorkspaceSvg(e),this.workspace_.setMetricsManager(new t.FlyoutMetricsManager(this.workspace_,this)),this.workspace_.isFlyout=!0,this.workspace_.setVisible(this.isVisible_),this.id=t.utils.genUid(),this.RTL=!!e.RTL,this.horizontalLayout=!1,this.toolboxPosition_=e.toolboxPosition,this.eventWrappers_=[],this.mats_=[],this.buttons_=[],this.listeners_=[],this.permanentlyDisabled_=[],this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.targetWorkspace=null},t.utils.object.inherits(t.Flyout,t.DeleteArea),t.Flyout.prototype.autoClose=!0,t.Flyout.prototype.isVisible_=!1,t.Flyout.prototype.containerVisible_=!0,t.Flyout.prototype.CORNER_RADIUS=8,t.Flyout.prototype.MARGIN=t.Flyout.prototype.CORNER_RADIUS,t.Flyout.prototype.GAP_X=3*t.Flyout.prototype.MARGIN,t.Flyout.prototype.GAP_Y=3*t.Flyout.prototype.MARGIN,t.Flyout.prototype.SCROLLBAR_MARGIN=2.5,t.Flyout.prototype.width_=0,t.Flyout.prototype.height_=0,t.Flyout.prototype.dragAngleRange_=70,t.Flyout.prototype.createDom=function(e){return this.svgGroup_=t.utils.dom.createSvgElement(e,{class:"blocklyFlyout",style:"display: none"},null),this.svgBackground_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyFlyoutBackground"},this.svgGroup_),this.svgGroup_.appendChild(this.workspace_.createDom()),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutBackgroundColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgBackground_,"flyoutOpacity","fill-opacity"),this.svgGroup_},t.Flyout.prototype.init=function(e){this.targetWorkspace=e,this.workspace_.targetWorkspace=e,this.workspace_.scrollbar=new t.ScrollbarPair(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),Array.prototype.push.apply(this.eventWrappers_,t.browserEvents.conditionalBind(this.svgGroup_,"wheel",this,this.wheel_)),this.autoClose||(this.filterWrapper_=this.filterForCapacity_.bind(this),this.targetWorkspace.addChangeListener(this.filterWrapper_)),Array.prototype.push.apply(this.eventWrappers_,t.browserEvents.conditionalBind(this.svgBackground_,"mousedown",this,this.onMouseDown_)),this.workspace_.getGesture=this.targetWorkspace.getGesture.bind(this.targetWorkspace),this.workspace_.setVariableMap(this.targetWorkspace.getVariableMap()),this.workspace_.createPotentialVariableMap(),e.getComponentManager().addComponent({component:this,weight:1,capabilities:[t.ComponentManager.Capability.DELETE_AREA,t.ComponentManager.Capability.DRAG_TARGET]})},t.Flyout.prototype.dispose=function(){this.hide(),this.workspace_.getComponentManager().removeComponent(this.id),t.browserEvents.unbind(this.eventWrappers_),this.filterWrapper_&&(this.targetWorkspace.removeChangeListener(this.filterWrapper_),this.filterWrapper_=null),this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.targetWorkspace=null,this.workspace_.dispose(),this.workspace_=null),this.svgGroup_&&(t.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.targetWorkspace=this.svgBackground_=null},t.Flyout.prototype.getWidth=function(){return this.width_},t.Flyout.prototype.getHeight=function(){return this.height_},t.Flyout.prototype.getFlyoutScale=function(){return this.targetWorkspace.scale},t.Flyout.prototype.getWorkspace=function(){return this.workspace_},t.Flyout.prototype.isVisible=function(){return this.isVisible_},t.Flyout.prototype.setVisible=function(t){var e=t!=this.isVisible();this.isVisible_=t,e&&(this.autoClose||this.workspace_.recordDragTargets(),this.updateDisplay_())},t.Flyout.prototype.setContainerVisible=function(t){var e=t!=this.containerVisible_;this.containerVisible_=t,e&&this.updateDisplay_()},t.Flyout.prototype.updateDisplay_=function(){var t=!!this.containerVisible_&&this.isVisible();this.svgGroup_.style.display=t?"block":"none",this.workspace_.scrollbar.setContainerVisible(t)},t.Flyout.prototype.positionAt_=function(e,n,i,r){this.svgGroup_.setAttribute("width",e),this.svgGroup_.setAttribute("height",n),this.workspace_.setCachedParentSvgSize(e,n),"svg"==this.svgGroup_.tagName?t.utils.dom.setCssTransform(this.svgGroup_,"translate("+i+"px,"+r+"px)"):this.svgGroup_.setAttribute("transform","translate("+i+","+r+")"),(e=this.workspace_.scrollbar)&&(e.setOrigin(i,r),e.resize(),e.hScroll&&e.hScroll.setPosition(e.hScroll.position.x,e.hScroll.position.y),e.vScroll&&e.vScroll.setPosition(e.vScroll.position.x,e.vScroll.position.y))},t.Flyout.prototype.hide=function(){if(this.isVisible()){this.setVisible(!1);for(var e,n=0;e=this.listeners_[n];n++)t.browserEvents.unbind(e);this.listeners_.length=0,this.reflowWrapper_&&(this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowWrapper_=null)}},t.Flyout.prototype.show=function(e){this.workspace_.setResizesEnabled(!1),this.hide(),this.clearOldBlocks_(),"string"==typeof e&&(e=this.getDynamicCategoryContents_(e)),this.setVisible(!0),e=t.utils.toolbox.convertFlyoutDefToJsonArray(e),e=this.createFlyoutInfo_(e),this.layout_(e.contents,e.gaps),this.listeners_.push(t.browserEvents.conditionalBind(this.svgBackground_,"mouseover",this,function(){for(var t,e=this.workspace_.getTopBlocks(!1),n=0;t=e[n];n++)t.removeSelect()})),this.horizontalLayout?this.height_=0:this.width_=0,this.workspace_.setResizesEnabled(!0),this.reflow(),this.filterForCapacity_(),this.position(),this.reflowWrapper_=this.reflow.bind(this),this.workspace_.addChangeListener(this.reflowWrapper_)},t.Flyout.prototype.createFlyoutInfo_=function(e){var n=[],i=[];this.permanentlyDisabled_.length=0;for(var r,o=this.horizontalLayout?this.GAP_X:this.GAP_Y,s=0;r=e[s];s++)switch(r.custom&&(r=this.getDynamicCategoryContents_(r.custom),r=t.utils.toolbox.convertFlyoutDefToJsonArray(r),e.splice.apply(e,[s,1].concat(r)),r=e[s]),r.kind.toUpperCase()){case"BLOCK":var a=r,l=this.getBlockXml_(a);r=this.createBlock_(l),a=parseInt(a.gap||l.getAttribute("gap"),10),i.push(isNaN(a)?o:a),n.push({type:"block",block:r});break;case"SEP":this.addSeparatorGap_(r,i,o);break;case"LABEL":r=this.createButton_(r,!0),n.push({type:"button",button:r}),i.push(o);break;case"BUTTON":r=this.createButton_(r,!1),n.push({type:"button",button:r}),i.push(o)}return{contents:n,gaps:i}},t.Flyout.prototype.getDynamicCategoryContents_=function(t){if("function"!=typeof(t=this.workspace_.targetWorkspace.getToolboxCategoryCallback(t)))throw TypeError("Couldn't find a callback function when opening a toolbox category.");if(t=t(this.workspace_.targetWorkspace),!Array.isArray(t))throw new TypeError("Result of toolbox category callback must be an array.");return t},t.Flyout.prototype.createButton_=function(e,n){if(!t.FlyoutButton)throw Error("Missing require for Blockly.FlyoutButton");return new t.FlyoutButton(this.workspace_,this.targetWorkspace,e,n)},t.Flyout.prototype.createBlock_=function(e){return(e=t.Xml.domToBlock(e,this.workspace_)).isEnabled()||this.permanentlyDisabled_.push(e),e},t.Flyout.prototype.getBlockXml_=function(e){var n=null,i=e.blockxml;if(i&&"string"!=typeof i?n=i:i&&"string"==typeof i?(n=t.Xml.textToDom(i),e.blockxml=n):e.type&&((n=t.utils.xml.createElement("xml")).setAttribute("type",e.type),n.setAttribute("disabled",e.disabled),e.blockxml=n),!n)throw Error("Error: Invalid block definition. Block definition must have blockxml or type.");return n},t.Flyout.prototype.addSeparatorGap_=function(t,e,n){t=parseInt(t.gap,10),!isNaN(t)&&0<e.length?e[e.length-1]=t:e.push(n)},t.Flyout.prototype.clearOldBlocks_=function(){for(var e,n=this.workspace_.getTopBlocks(!1),i=0;e=n[i];i++)e.workspace==this.workspace_&&e.dispose(!1,!1);for(i=0;i<this.mats_.length;i++)(n=this.mats_[i])&&(t.Tooltip.unbindMouseEvents(n),t.utils.dom.removeNode(n));for(i=this.mats_.length=0;n=this.buttons_[i];i++)n.dispose();this.buttons_.length=0,this.workspace_.getPotentialVariableMap().clear()},t.Flyout.prototype.addBlockListeners_=function(e,n,i){this.listeners_.push(t.browserEvents.conditionalBind(e,"mousedown",null,this.blockMouseDown_(n))),this.listeners_.push(t.browserEvents.conditionalBind(i,"mousedown",null,this.blockMouseDown_(n))),this.listeners_.push(t.browserEvents.bind(e,"mouseenter",n,n.addSelect)),this.listeners_.push(t.browserEvents.bind(e,"mouseleave",n,n.removeSelect)),this.listeners_.push(t.browserEvents.bind(i,"mouseenter",n,n.addSelect)),this.listeners_.push(t.browserEvents.bind(i,"mouseleave",n,n.removeSelect))},t.Flyout.prototype.blockMouseDown_=function(t){var e=this;return function(n){var i=e.targetWorkspace.getGesture(n);i&&(i.setStartBlock(t),i.handleFlyoutStart(n,e))}},t.Flyout.prototype.onMouseDown_=function(t){var e=this.targetWorkspace.getGesture(t);e&&e.handleFlyoutStart(t,this)},t.Flyout.prototype.isBlockCreatable_=function(t){return t.isEnabled()},t.Flyout.prototype.createBlock=function(e){var n=null;t.Events.disable();var i=this.targetWorkspace.getAllVariables();this.targetWorkspace.setResizesEnabled(!1);try{n=this.placeNewBlock_(e)}finally{t.Events.enable()}if(t.hideChaff(),e=t.Variables.getAddedVariables(this.targetWorkspace,i),t.Events.isEnabled()){for(t.Events.setGroup(!0),i=0;i<e.length;i++){var r=e[i];t.Events.fire(new(t.Events.get(t.Events.VAR_CREATE))(r))}t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(n))}return this.autoClose?this.hide():this.filterForCapacity_(),n},t.Flyout.prototype.initFlyoutButton_=function(e,n,i){var r=e.createDom();e.moveTo(n,i),e.show(),this.listeners_.push(t.browserEvents.conditionalBind(r,"mousedown",this,this.onMouseDown_)),this.buttons_.push(e)},t.Flyout.prototype.createRect_=function(e,n,i,r,o){return(n=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{"fill-opacity":0,x:n,y:i,height:r.height,width:r.width},null)).tooltip=e,t.Tooltip.bindMouseEvents(n),this.workspace_.getCanvas().insertBefore(n,e.getSvgRoot()),e.flyoutRect_=n,this.mats_[o]=n},t.Flyout.prototype.moveRectToBlock_=function(t,e){var n=e.getHeightWidth();t.setAttribute("width",n.width),t.setAttribute("height",n.height),e=e.getRelativeToSurfaceXY(),t.setAttribute("y",e.y),t.setAttribute("x",this.RTL?e.x-n.width:e.x)},t.Flyout.prototype.filterForCapacity_=function(){for(var e,n=this.workspace_.getTopBlocks(!1),i=0;e=n[i];i++)if(-1==this.permanentlyDisabled_.indexOf(e))for(var r=this.targetWorkspace.isCapacityAvailable(t.utils.getBlockTypeCounts(e));e;)e.setEnabled(r),e=e.getNextBlock()},t.Flyout.prototype.reflow=function(){this.reflowWrapper_&&this.workspace_.removeChangeListener(this.reflowWrapper_),this.reflowInternal_(),this.reflowWrapper_&&this.workspace_.addChangeListener(this.reflowWrapper_)},t.Flyout.prototype.isScrollable=function(){return!!this.workspace_.scrollbar&&this.workspace_.scrollbar.isVisible()},t.Flyout.prototype.placeNewBlock_=function(e){var n=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered.");var i=t.Xml.blockToDom(e,!0);if(n.setResizesEnabled(!1),!(i=t.Xml.domToBlock(i,n)).getSvgRoot())throw Error("block is not rendered.");var r=n.getOriginOffsetInPixels(),o=this.workspace_.getOriginOffsetInPixels();return(e=e.getRelativeToSurfaceXY()).scale(this.workspace_.scale),e=t.utils.Coordinate.sum(o,e),(r=t.utils.Coordinate.difference(e,r)).scale(1/n.scale),i.moveBy(r.x,r.y),i},t.HorizontalFlyout=function(e){t.HorizontalFlyout.superClass_.constructor.call(this,e),this.horizontalLayout=!0},t.utils.object.inherits(t.HorizontalFlyout,t.Flyout),t.HorizontalFlyout.prototype.setMetrics_=function(t){if(this.isVisible()){var e=this.workspace_.getMetricsManager(),n=e.getScrollMetrics(),i=e.getViewMetrics();e=e.getAbsoluteMetrics(),"number"==typeof t.x&&(this.workspace_.scrollX=-(n.left+(n.width-i.width)*t.x)),this.workspace_.translate(this.workspace_.scrollX+e.left,this.workspace_.scrollY+e.top)}},t.HorizontalFlyout.prototype.getX=function(){return 0},t.HorizontalFlyout.prototype.getY=function(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager(),n=e.getAbsoluteMetrics(),i=e.getViewMetrics();e=e.getToolboxMetrics();var r=this.toolboxPosition_==t.utils.toolbox.Position.TOP;return this.targetWorkspace.toolboxPosition==this.toolboxPosition_?this.targetWorkspace.getToolbox()?r?e.height:i.height-this.height_:r?0:i.height:r?0:i.height+n.top-this.height_},t.HorizontalFlyout.prototype.position=function(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var t=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=t.width,this.setBackgroundPath_(t.width-2*this.CORNER_RADIUS,this.height_-this.CORNER_RADIUS),t=this.getX();var e=this.getY();this.positionAt_(this.width_,this.height_,t,e)}},t.HorizontalFlyout.prototype.setBackgroundPath_=function(e,n){var i=this.toolboxPosition_==t.utils.toolbox.Position.TOP,r=["M 0,"+(i?0:this.CORNER_RADIUS)];i?(r.push("h",e+2*this.CORNER_RADIUS),r.push("v",n),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("h",-e),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),r.push("h",e),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("v",n),r.push("h",-e-2*this.CORNER_RADIUS)),r.push("z"),this.svgBackground_.setAttribute("d",r.join(" "))},t.HorizontalFlyout.prototype.scrollToStart=function(){this.workspace_.scrollbar.setX(this.RTL?1/0:0)},t.HorizontalFlyout.prototype.wheel_=function(e){var n=t.utils.getScrollDeltaPixels(e);if(n=n.x||n.y){var i=this.workspace_.getMetricsManager(),r=i.getScrollMetrics();n=i.getViewMetrics().left-r.left+n,this.workspace_.scrollbar.setX(n),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()}e.preventDefault(),e.stopPropagation()},t.HorizontalFlyout.prototype.layout_=function(t,e){this.workspace_.scale=this.targetWorkspace.scale;var n=this.MARGIN,i=n+this.tabWidth_;this.RTL&&(t=t.reverse());for(var r,o=0;r=t[o];o++)if("block"==r.type){for(var s,a=(r=r.block).getDescendants(!1),l=0;s=a[l];l++)s.isInFlyout=!0;r.render(),a=r.getSvgRoot(),l=r.getHeightWidth(),s=r.outputConnection?this.tabWidth_:0,s=this.RTL?i+l.width:i-s,r.moveBy(s,n),s=this.createRect_(r,s,n,l,o),i+=l.width+e[o],this.addBlockListeners_(a,r,s)}else"button"==r.type&&(this.initFlyoutButton_(r.button,i,n),i+=r.button.width+e[o])},t.HorizontalFlyout.prototype.isDragTowardWorkspace=function(t){t=Math.atan2(t.y,t.x)/Math.PI*180;var e=this.dragAngleRange_;return t<90+e&&t>90-e||t>-90-e&&t<-90+e},t.HorizontalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var e=this.svgGroup_.getBoundingClientRect(),n=e.top;return this.toolboxPosition_==t.utils.toolbox.Position.TOP?new t.utils.Rect(-1e9,n+e.height,-1e9,1e9):new t.utils.Rect(n,1e9,-1e9,1e9)},t.HorizontalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var e,n=0,i=this.workspace_.getTopBlocks(!1),r=0;e=i[r];r++)n=Math.max(n,e.getHeightWidth().height);if(n+=1.5*this.MARGIN,n*=this.workspace_.scale,n+=t.Scrollbar.scrollbarThickness,this.height_!=n){for(r=0;e=i[r];r++)e.flyoutRect_&&this.moveRectToBlock_(e.flyoutRect_,e);this.targetWorkspace.toolboxPosition!=this.toolboxPosition_||this.toolboxPosition_!=t.utils.toolbox.Position.TOP||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+n),this.height_=n,this.position(),this.targetWorkspace.recordDragTargets()}},t.registry.register(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,t.registry.DEFAULT,t.HorizontalFlyout),t.VerticalFlyout=function(e){t.VerticalFlyout.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.VerticalFlyout,t.Flyout),t.VerticalFlyout.registryName="verticalFlyout",t.VerticalFlyout.prototype.setMetrics_=function(t){if(this.isVisible()){var e=this.workspace_.getMetricsManager(),n=e.getScrollMetrics(),i=e.getViewMetrics();e=e.getAbsoluteMetrics(),"number"==typeof t.y&&(this.workspace_.scrollY=-(n.top+(n.height-i.height)*t.y)),this.workspace_.translate(this.workspace_.scrollX+e.left,this.workspace_.scrollY+e.top)}},t.VerticalFlyout.prototype.getX=function(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager(),n=e.getAbsoluteMetrics(),i=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition==this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_==t.utils.toolbox.Position.LEFT?e.width:i.width-this.width_:this.toolboxPosition_==t.utils.toolbox.Position.LEFT?0:i.width:this.toolboxPosition_==t.utils.toolbox.Position.LEFT?0:i.width+n.left-this.width_},t.VerticalFlyout.prototype.getY=function(){return 0},t.VerticalFlyout.prototype.position=function(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var t=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=t.height,this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,t.height-2*this.CORNER_RADIUS),t=this.getX();var e=this.getY();this.positionAt_(this.width_,this.height_,t,e)}},t.VerticalFlyout.prototype.setBackgroundPath_=function(e,n){var i=this.toolboxPosition_==t.utils.toolbox.Position.RIGHT,r=e+this.CORNER_RADIUS;(r=["M "+(i?r:0)+",0"]).push("h",i?-e:e),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,i?0:1,i?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("v",Math.max(0,n)),r.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,i?0:1,i?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),r.push("h",i?e:-e),r.push("z"),this.svgBackground_.setAttribute("d",r.join(" "))},t.VerticalFlyout.prototype.scrollToStart=function(){this.workspace_.scrollbar.setY(0)},t.VerticalFlyout.prototype.wheel_=function(e){var n=t.utils.getScrollDeltaPixels(e);if(n.y){var i=this.workspace_.getMetricsManager(),r=i.getScrollMetrics();n=i.getViewMetrics().top-r.top+n.y,this.workspace_.scrollbar.setY(n),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()}e.preventDefault(),e.stopPropagation()},t.VerticalFlyout.prototype.layout_=function(t,e){this.workspace_.scale=this.targetWorkspace.scale;for(var n,i=this.MARGIN,r=this.RTL?i:i+this.tabWidth_,o=0;n=t[o];o++)if("block"==n.type){for(var s,a=(n=n.block).getDescendants(!1),l=0;s=a[l];l++)s.isInFlyout=!0;n.render(),a=n.getSvgRoot(),l=n.getHeightWidth(),s=n.outputConnection?r-this.tabWidth_:r,n.moveBy(s,i),s=this.createRect_(n,this.RTL?s-l.width:s,i,l,o),this.addBlockListeners_(a,n,s),i+=l.height+e[o]}else"button"==n.type&&(this.initFlyoutButton_(n.button,r,i),i+=n.button.height+e[o])},t.VerticalFlyout.prototype.isDragTowardWorkspace=function(t){t=Math.atan2(t.y,t.x)/Math.PI*180;var e=this.dragAngleRange_;return t<e&&t>-e||t<-180+e||t>180-e},t.VerticalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var e=this.svgGroup_.getBoundingClientRect(),n=e.left;return this.toolboxPosition_==t.utils.toolbox.Position.LEFT?new t.utils.Rect(-1e9,1e9,-1e9,n+e.width):new t.utils.Rect(-1e9,1e9,n,1e9)},t.VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var e,n=0,i=this.workspace_.getTopBlocks(!1),r=0;e=i[r];r++){var o=e.getHeightWidth().width;e.outputConnection&&(o-=this.tabWidth_),n=Math.max(n,o)}for(r=0;e=this.buttons_[r];r++)n=Math.max(n,e.width);if(n+=1.5*this.MARGIN+this.tabWidth_,n*=this.workspace_.scale,n+=t.Scrollbar.scrollbarThickness,this.width_!=n){for(r=0;e=i[r];r++){if(this.RTL){o=e.getRelativeToSurfaceXY().x;var s=n/this.workspace_.scale-this.MARGIN;e.outputConnection||(s-=this.tabWidth_),e.moveBy(s-o,0)}e.flyoutRect_&&this.moveRectToBlock_(e.flyoutRect_,e)}if(this.RTL)for(r=0;e=this.buttons_[r];r++)i=e.getPosition().y,e.moveTo(n/this.workspace_.scale-e.width-this.MARGIN-this.tabWidth_,i);this.targetWorkspace.toolboxPosition!=this.toolboxPosition_||this.toolboxPosition_!=t.utils.toolbox.Position.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+n,this.targetWorkspace.scrollY),this.width_=n,this.position(),this.targetWorkspace.recordDragTargets()}},t.registry.register(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,t.registry.DEFAULT,t.VerticalFlyout),t.FlyoutButton=function(e,n,i,r){this.workspace_=e,this.targetWorkspace_=n,this.text_=i.text,this.position_=new t.utils.Coordinate(0,0),this.isLabel_=r,this.callbackKey_=i.callbackKey||i.callbackkey,this.cssClass_=i["web-class"]||null,this.onMouseUpWrapper_=null,this.info=i},t.FlyoutButton.MARGIN_X=5,t.FlyoutButton.MARGIN_Y=2,t.FlyoutButton.prototype.width=0,t.FlyoutButton.prototype.height=0,t.FlyoutButton.prototype.createDom=function(){var e=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";if(this.cssClass_&&(e+=" "+this.cssClass_),this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:e},this.workspace_.getCanvas()),!this.isLabel_)var n=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);e=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_);var i=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_),r=t.utils.replaceMessageReferences(this.text_);this.workspace_.RTL&&(r+="‏"),i.textContent=r,this.isLabel_&&(this.svgText_=i,this.workspace_.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour","fill"));var o=t.utils.style.getComputedStyle(i,"fontSize"),s=t.utils.style.getComputedStyle(i,"fontWeight"),a=t.utils.style.getComputedStyle(i,"fontFamily");return this.width=t.utils.dom.getFastTextWidthWithSizeString(i,o,s,a),r=t.utils.dom.measureFontMetrics(r,o,s,a),this.height=r.height,this.isLabel_||(this.width+=2*t.FlyoutButton.MARGIN_X,this.height+=2*t.FlyoutButton.MARGIN_Y,n.setAttribute("width",this.width),n.setAttribute("height",this.height)),e.setAttribute("width",this.width),e.setAttribute("height",this.height),i.setAttribute("x",this.width/2),i.setAttribute("y",this.height/2-r.height/2+r.baseline),this.updateTransform_(),this.onMouseUpWrapper_=t.browserEvents.conditionalBind(this.svgGroup_,"mouseup",this,this.onMouseUp_),this.svgGroup_},t.FlyoutButton.prototype.show=function(){this.updateTransform_(),this.svgGroup_.setAttribute("display","block")},t.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")},t.FlyoutButton.prototype.moveTo=function(t,e){this.position_.x=t,this.position_.y=e,this.updateTransform_()},t.FlyoutButton.prototype.isLabel=function(){return this.isLabel_},t.FlyoutButton.prototype.getPosition=function(){return this.position_},t.FlyoutButton.prototype.getButtonText=function(){return this.text_},t.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_},t.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&t.browserEvents.unbind(this.onMouseUpWrapper_),this.svgGroup_&&t.utils.dom.removeNode(this.svgGroup_),this.svgText_&&this.workspace_.getThemeManager().unsubscribe(this.svgText_)},t.FlyoutButton.prototype.onMouseUp_=function(t){(t=this.targetWorkspace_.getGesture(t))&&t.cancel(),this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)},t.Css.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,}".split(",")),t.Generator=function(t){this.name_=t,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")},t.Generator.prototype.INFINITE_LOOP_TRAP=null,t.Generator.prototype.STATEMENT_PREFIX=null,t.Generator.prototype.STATEMENT_SUFFIX=null,t.Generator.prototype.INDENT=" ",t.Generator.prototype.COMMENT_WRAP=60,t.Generator.prototype.ORDER_OVERRIDES=[],t.Generator.prototype.isInitialized=null,t.Generator.prototype.workspaceToCode=function(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=t.getMainWorkspace());var n=[];this.init(e),e=e.getTopBlocks(!0);for(var i,r=0;i=e[r];r++){var o=this.blockToCode(i);Array.isArray(o)&&(o=o[0]),o&&(i.outputConnection&&(o=this.scrubNakedValue(o),this.STATEMENT_PREFIX&&!i.suppressPrefixSuffix&&(o=this.injectId(this.STATEMENT_PREFIX,i)+o),this.STATEMENT_SUFFIX&&!i.suppressPrefixSuffix&&(o+=this.injectId(this.STATEMENT_SUFFIX,i))),n.push(o))}return n=n.join("\n"),(n=(n=(n=this.finish(n)).replace(/^\s+\n/,"")).replace(/\n\s+$/,"\n")).replace(/[ \t]+\n/g,"\n")},t.Generator.prototype.prefixLines=function(t,e){return e+t.replace(/(?!\n$)\n/g,"\n"+e)},t.Generator.prototype.allNestedComments=function(t){var e=[];t=t.getDescendants(!0);for(var n=0;n<t.length;n++){var i=t[n].getCommentText();i&&e.push(i)}return e.length&&e.push(""),e.join("\n")},t.Generator.prototype.blockToCode=function(t,e){if(!1===this.isInitialized&&console.warn("Generator init was not called before blockToCode was called."),!t)return"";if(!t.isEnabled())return e?"":this.blockToCode(t.getNextBlock());if(t.isInsertionMarker())return e?"":this.blockToCode(t.getChildren(!1)[0]);var n=this[t.type];if("function"!=typeof n)throw Error('Language "'+this.name_+'" does not know how to generate code for block type "'+t.type+'".');if(n=n.call(t,t),Array.isArray(n)){if(!t.outputConnection)throw TypeError("Expecting string from statement block: "+t.type);return[this.scrub_(t,n[0],e),n[1]]}if("string"==typeof n)return this.STATEMENT_PREFIX&&!t.suppressPrefixSuffix&&(n=this.injectId(this.STATEMENT_PREFIX,t)+n),this.STATEMENT_SUFFIX&&!t.suppressPrefixSuffix&&(n+=this.injectId(this.STATEMENT_SUFFIX,t)),this.scrub_(t,n,e);if(null===n)return"";throw SyntaxError("Invalid code generated: "+n)},t.Generator.prototype.valueToCode=function(t,e,n){if(isNaN(n))throw TypeError("Expecting valid order from block: "+t.type);var i=t.getInputTargetBlock(e);if(!i)return"";if(""===(e=this.blockToCode(i)))return"";if(!Array.isArray(e))throw TypeError("Expecting tuple from value block: "+i.type);if(t=e[0],e=e[1],isNaN(e))throw TypeError("Expecting valid order from value block: "+i.type);if(!t)return"";i=!1;var r=Math.floor(n),o=Math.floor(e);if(r<=o&&(r!=o||0!=r&&99!=r))for(i=!0,r=0;r<this.ORDER_OVERRIDES.length;r++)if(this.ORDER_OVERRIDES[r][0]==n&&this.ORDER_OVERRIDES[r][1]==e){i=!1;break}return i&&(t="("+t+")"),t},t.Generator.prototype.statementToCode=function(t,e){if(t=t.getInputTargetBlock(e),"string"!=typeof(e=this.blockToCode(t)))throw TypeError("Expecting code from statement block: "+(t&&t.type));return e&&(e=this.prefixLines(e,this.INDENT)),e},t.Generator.prototype.addLoopTrap=function(t,e){return this.INFINITE_LOOP_TRAP&&(t=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,e),this.INDENT)+t),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(t=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,e),this.INDENT)+t),this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(t+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,e),this.INDENT)),t},t.Generator.prototype.injectId=function(t,e){return e=e.id.replace(/\$/g,"$$$$"),t.replace(/%1/g,"'"+e+"'")},t.Generator.prototype.RESERVED_WORDS_="",t.Generator.prototype.addReservedWords=function(t){this.RESERVED_WORDS_+=t+","},t.Generator.prototype.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",Object.defineProperty(t.Generator.prototype,"variableDB_",{get:function(){return t.utils.deprecation.warn("variableDB_","May 2021","May 2026","nameDB_"),this.nameDB_},set:function(e){t.utils.deprecation.warn("variableDB_","May 2021","May 2026","nameDB_"),this.nameDB_=e}}),t.Generator.prototype.provideFunction_=function(e,n){if(!this.definitions_[e]){var i,r=this.nameDB_.getDistinctName(e,t.PROCEDURE_CATEGORY_NAME);for(this.functionNames_[e]=r,n=n.join("\n").replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,r);i!=n;)i=n,n=n.replace(/^(( {2})*) {2}/gm,"$1\0");n=n.replace(/\0/g,this.INDENT),this.definitions_[e]=n}return this.functionNames_[e]},t.Generator.prototype.init=function(t){this.definitions_=Object.create(null),this.functionNames_=Object.create(null)},t.Generator.prototype.scrub_=function(t,e,n){return e},t.Generator.prototype.finish=function(t){return delete this.definitions_,delete this.functionNames_,t},t.Generator.prototype.scrubNakedValue=function(t){return t},t.IToolboxItem=function(){},t.ISelectableToolboxItem=function(){},t.ICollapsibleToolboxItem=function(){},t.ToolboxItem=function(e,n,i){this.id_=e.toolboxitemid||t.utils.IdGenerator.getNextUniqueId(),this.level_=(this.parent_=i||null)?this.parent_.getLevel()+1:0,this.toolboxItemDef_=e,this.parentToolbox_=n,this.workspace_=this.parentToolbox_.getWorkspace()},t.ToolboxItem.prototype.init=function(){},t.ToolboxItem.prototype.getDiv=function(){return null},t.ToolboxItem.prototype.getId=function(){return this.id_},t.ToolboxItem.prototype.getParent=function(){return null},t.ToolboxItem.prototype.getLevel=function(){return this.level_},t.ToolboxItem.prototype.isSelectable=function(){return!1},t.ToolboxItem.prototype.isCollapsible=function(){return!1},t.ToolboxItem.prototype.dispose=function(){},t.ToolboxCategory=function(e,n,i){t.ToolboxCategory.superClass_.constructor.call(this,e,n,i),this.name_=t.utils.replaceMessageReferences(e.name),this.colour_=this.getColour_(e),this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null,this.cssConfig_=this.makeDefaultCssConfig_(),t.utils.object.mixin(this.cssConfig_,e.cssconfig||e.cssConfig),this.isDisabled_=this.isHidden_=!1,this.flyoutItems_=[],this.parseContents_(e)},t.utils.object.inherits(t.ToolboxCategory,t.ToolboxItem),t.ToolboxCategory.registrationName="category",t.ToolboxCategory.nestedPadding=19,t.ToolboxCategory.borderWidth=8,t.ToolboxCategory.defaultBackgroundColour="#57e",t.ToolboxCategory.prototype.makeDefaultCssConfig_=function(){return{container:"blocklyToolboxCategory",row:"blocklyTreeRow",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyTreeIcon",label:"blocklyTreeLabel",contents:"blocklyToolboxContents",selected:"blocklyTreeSelected",openicon:"blocklyTreeIconOpen",closedicon:"blocklyTreeIconClosed"}},t.ToolboxCategory.prototype.parseContents_=function(t){var e=t.contents;if(t.custom)this.flyoutItems_=t.custom;else if(e){t=0;for(var n;n=e[t];t++)this.flyoutItems_.push(n)}},t.ToolboxCategory.prototype.init=function(){this.createDom_(),"true"==this.toolboxItemDef_.hidden&&this.hide()},t.ToolboxCategory.prototype.createDom_=function(){return this.htmlDiv_=this.createContainer_(),t.utils.aria.setRole(this.htmlDiv_,t.utils.aria.Role.TREEITEM),t.utils.aria.setState(this.htmlDiv_,t.utils.aria.State.SELECTED,!1),t.utils.aria.setState(this.htmlDiv_,t.utils.aria.State.LEVEL,this.level_),this.rowDiv_=this.createRowContainer_(),this.rowDiv_.style.pointerEvents="auto",this.htmlDiv_.appendChild(this.rowDiv_),this.rowContents_=this.createRowContentsContainer_(),this.rowContents_.style.pointerEvents="none",this.rowDiv_.appendChild(this.rowContents_),this.iconDom_=this.createIconDom_(),t.utils.aria.setRole(this.iconDom_,t.utils.aria.Role.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_),t.utils.aria.setState(this.htmlDiv_,t.utils.aria.State.LABELLEDBY,this.labelDom_.getAttribute("id")),this.addColourBorder_(this.colour_),this.htmlDiv_},t.ToolboxCategory.prototype.createContainer_=function(){var e=document.createElement("div");return t.utils.dom.addClass(e,this.cssConfig_.container),e},t.ToolboxCategory.prototype.createRowContainer_=function(){var e=document.createElement("div");t.utils.dom.addClass(e,this.cssConfig_.row);var n=t.ToolboxCategory.nestedPadding*this.getLevel();return n=n.toString()+"px",this.workspace_.RTL?e.style.paddingRight=n:e.style.paddingLeft=n,e},t.ToolboxCategory.prototype.createRowContentsContainer_=function(){var e=document.createElement("div");return t.utils.dom.addClass(e,this.cssConfig_.rowcontentcontainer),e},t.ToolboxCategory.prototype.createIconDom_=function(){var e=document.createElement("span");return this.parentToolbox_.isHorizontal()||t.utils.dom.addClass(e,this.cssConfig_.icon),e.style.display="inline-block",e},t.ToolboxCategory.prototype.createLabelDom_=function(e){var n=document.createElement("span");return n.setAttribute("id",this.getId()+".label"),n.textContent=e,t.utils.dom.addClass(n,this.cssConfig_.label),n},t.ToolboxCategory.prototype.refreshTheme=function(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)},t.ToolboxCategory.prototype.addColourBorder_=function(e){e&&(e=t.ToolboxCategory.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)},t.ToolboxCategory.prototype.getColour_=function(t){var e=t.categorystyle||t.categoryStyle;return(t=t.colour)&&e?(console.warn('Toolbox category "'+this.name_+'" must not have both a style and a colour'),""):e?this.getColourfromStyle_(e):this.parseColour_(t)},t.ToolboxCategory.prototype.getColourfromStyle_=function(t){var e=this.workspace_.getTheme();if(t&&e){if((e=e.categoryStyles[t])&&e.colour)return this.parseColour_(e.colour);console.warn('Style "'+t+'" must exist and contain a colour value')}return""},t.ToolboxCategory.prototype.getClickTarget=function(){return this.rowDiv_},t.ToolboxCategory.prototype.parseColour_=function(e){if(null==(e=t.utils.replaceMessageReferences(e))||""===e)return"";var n=Number(e);return isNaN(n)?(n=t.utils.colour.parse(e))?n:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):t.hueToHex(n)},t.ToolboxCategory.prototype.openIcon_=function(e){e&&(t.utils.dom.removeClasses(e,this.cssConfig_.closedicon),t.utils.dom.addClass(e,this.cssConfig_.openicon))},t.ToolboxCategory.prototype.closeIcon_=function(e){e&&(t.utils.dom.removeClasses(e,this.cssConfig_.openicon),t.utils.dom.addClass(e,this.cssConfig_.closedicon))},t.ToolboxCategory.prototype.setVisible_=function(t){this.htmlDiv_.style.display=t?"block":"none",this.isHidden_=!t,this.parentToolbox_.getSelectedItem()==this&&this.parentToolbox_.clearSelection()},t.ToolboxCategory.prototype.hide=function(){this.setVisible_(!1)},t.ToolboxCategory.prototype.show=function(){this.setVisible_(!0)},t.ToolboxCategory.prototype.isVisible=function(){return!this.isHidden_&&this.allAncestorsExpanded_()},t.ToolboxCategory.prototype.allAncestorsExpanded_=function(){for(var t=this;t.getParent();)if(!(t=t.getParent()).isExpanded())return!1;return!0},t.ToolboxCategory.prototype.isSelectable=function(){return this.isVisible()&&!this.isDisabled_},t.ToolboxCategory.prototype.onClick=function(t){},t.ToolboxCategory.prototype.setSelected=function(e){if(e){var n=this.parseColour_(t.ToolboxCategory.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||n,t.utils.dom.addClass(this.rowDiv_,this.cssConfig_.selected)}else this.rowDiv_.style.backgroundColor="",t.utils.dom.removeClass(this.rowDiv_,this.cssConfig_.selected);t.utils.aria.setState(this.htmlDiv_,t.utils.aria.State.SELECTED,e)},t.ToolboxCategory.prototype.setDisabled=function(t){this.isDisabled_=t,this.getDiv().setAttribute("disabled",t),t?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")},t.ToolboxCategory.prototype.getName=function(){return this.name_},t.ToolboxCategory.prototype.getParent=function(){return this.parent_},t.ToolboxCategory.prototype.getDiv=function(){return this.htmlDiv_},t.ToolboxCategory.prototype.getContents=function(){return this.flyoutItems_},t.ToolboxCategory.prototype.updateFlyoutContents=function(e){this.flyoutItems_=[],"string"==typeof e?this.toolboxItemDef_.custom=e:(delete this.toolboxItemDef_.custom,this.toolboxItemDef_.contents=t.utils.toolbox.convertFlyoutDefToJsonArray(e)),this.parseContents_(this.toolboxItemDef_)},t.ToolboxCategory.prototype.dispose=function(){t.utils.dom.removeNode(this.htmlDiv_)},t.Css.register([".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: rgba(255, 255, 255, 0.2);","}",'.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {',"margin: 1px 5px 1px 0;","}",'.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {',"margin: 1px 0 1px 5px;","}",".blocklyTreeRow {","height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","padding-right: 0px","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","visibility: hidden;","width: 16px;","}",".blocklyTreeIconClosed {","background-position: -32px -1px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {',"background-position: 0 -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosed {","background-position: -32px -17px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {',"background-position: 0 -17px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeLabel {","cursor: default;","font: 16px sans-serif;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]),t.registry.register(t.registry.Type.TOOLBOX_ITEM,t.ToolboxCategory.registrationName,t.ToolboxCategory),t.ToolboxSeparator=function(e,n){t.ToolboxSeparator.superClass_.constructor.call(this,e,n),this.cssConfig_={container:"blocklyTreeSeparator"},t.utils.object.mixin(this.cssConfig_,e.cssconfig||e.cssConfig)},t.utils.object.inherits(t.ToolboxSeparator,t.ToolboxItem),t.ToolboxSeparator.registrationName="sep",t.ToolboxSeparator.prototype.init=function(){this.createDom_()},t.ToolboxSeparator.prototype.createDom_=function(){var e=document.createElement("div");return t.utils.dom.addClass(e,this.cssConfig_.container),this.htmlDiv_=e},t.ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_},t.ToolboxSeparator.prototype.dispose=function(){t.utils.dom.removeNode(this.htmlDiv_)},t.Css.register('.blocklyTreeSeparator {,border-bottom: solid #e5e5e5 1px;,height: 0;,margin: 5px 0;,},.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {,border-right: solid #e5e5e5 1px;,border-bottom: none;,height: auto;,margin: 0 5px 0 5px;,padding: 5px 0;,width: 0;,}'.split(",")),t.registry.register(t.registry.Type.TOOLBOX_ITEM,t.ToolboxSeparator.registrationName,t.ToolboxSeparator),t.CollapsibleToolboxCategory=function(e,n,i){this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[],t.CollapsibleToolboxCategory.superClass_.constructor.call(this,e,n,i)},t.utils.object.inherits(t.CollapsibleToolboxCategory,t.ToolboxCategory),t.CollapsibleToolboxCategory.registrationName="collapsibleCategory",t.CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var e=t.CollapsibleToolboxCategory.superClass_.makeDefaultCssConfig_.call(this);return e.contents="blocklyToolboxContents",e},t.CollapsibleToolboxCategory.prototype.parseContents_=function(e){var n=e.contents,i=!0;if(e.custom)this.flyoutItems_=e.custom;else if(n){e=0;for(var r;r=n[e];e++)!t.registry.hasItem(t.registry.Type.TOOLBOX_ITEM,r.kind)||r.kind.toLowerCase()==t.ToolboxSeparator.registrationName&&i?(this.flyoutItems_.push(r),i=!0):(this.createToolboxItem_(r),i=!1)}},t.CollapsibleToolboxCategory.prototype.createToolboxItem_=function(e){var n=e.kind;"CATEGORY"==n.toUpperCase()&&t.utils.toolbox.isCategoryCollapsible(e)&&(n=t.CollapsibleToolboxCategory.registrationName),e=new(t.registry.getClass(t.registry.Type.TOOLBOX_ITEM,n))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)},t.CollapsibleToolboxCategory.prototype.init=function(){t.CollapsibleToolboxCategory.superClass_.init.call(this),this.setExpanded("true"==this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)},t.CollapsibleToolboxCategory.prototype.createDom_=function(){t.CollapsibleToolboxCategory.superClass_.createDom_.call(this);var e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),t.utils.aria.setRole(this.subcategoriesDiv_,t.utils.aria.Role.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.htmlDiv_},t.CollapsibleToolboxCategory.prototype.createIconDom_=function(){var e=document.createElement("span");return this.parentToolbox_.isHorizontal()||(t.utils.dom.addClass(e,this.cssConfig_.icon),e.style.visibility="visible"),e.style.display="inline-block",e},t.CollapsibleToolboxCategory.prototype.createSubCategoriesDom_=function(e){var n=document.createElement("div");t.utils.dom.addClass(n,this.cssConfig_.contents);for(var i=0;i<e.length;i++){var r=e[i];r.init();var o=r.getDiv();n.appendChild(o),r.getClickTarget&&r.getClickTarget().setAttribute("id",r.getId())}return n},t.CollapsibleToolboxCategory.prototype.setExpanded=function(e){this.expanded_!=e&&((this.expanded_=e)?(this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_)):(this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)),t.utils.aria.setState(this.htmlDiv_,t.utils.aria.State.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize())},t.CollapsibleToolboxCategory.prototype.setVisible_=function(t){this.htmlDiv_.style.display=t?"block":"none";for(var e,n=0;e=this.getChildToolboxItems()[n];n++)e.setVisible_(t);this.isHidden_=!t,this.parentToolbox_.getSelectedItem()==this&&this.parentToolbox_.clearSelection()},t.CollapsibleToolboxCategory.prototype.isExpanded=function(){return this.expanded_},t.CollapsibleToolboxCategory.prototype.isCollapsible=function(){return!0},t.CollapsibleToolboxCategory.prototype.onClick=function(t){this.toggleExpanded()},t.CollapsibleToolboxCategory.prototype.toggleExpanded=function(){this.setExpanded(!this.expanded_)},t.CollapsibleToolboxCategory.prototype.getDiv=function(){return this.htmlDiv_},t.CollapsibleToolboxCategory.prototype.getChildToolboxItems=function(){return this.toolboxItems_},t.registry.register(t.registry.Type.TOOLBOX_ITEM,t.CollapsibleToolboxCategory.registrationName,t.CollapsibleToolboxCategory),t.Events.ToolboxItemSelect=function(e,n,i){t.Events.ToolboxItemSelect.superClass_.constructor.call(this,i),this.oldItem=e,this.newItem=n},t.utils.object.inherits(t.Events.ToolboxItemSelect,t.Events.UiBase),t.Events.ToolboxItemSelect.prototype.type=t.Events.TOOLBOX_ITEM_SELECT,t.Events.ToolboxItemSelect.prototype.toJson=function(){var e=t.Events.ToolboxItemSelect.superClass_.toJson.call(this);return e.oldItem=this.oldItem,e.newItem=this.newItem,e},t.Events.ToolboxItemSelect.prototype.fromJson=function(e){t.Events.ToolboxItemSelect.superClass_.fromJson.call(this,e),this.oldItem=e.oldItem,this.newItem=e.newItem},t.registry.register(t.registry.Type.EVENT,t.Events.TOOLBOX_ITEM_SELECT,t.Events.ToolboxItemSelect),t.IAutoHideable=function(){},t.IStyleable=function(){},t.IToolbox=function(){},t.Toolbox=function(e){t.Toolbox.superClass_.constructor.call(this),this.workspace_=e,this.id="toolbox",this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout_=e.options.horizontalLayout,this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.contents_=[],this.height_=this.width_=0,this.RTL=e.options.RTL,this.flyout_=null,this.contentMap_=Object.create(null),this.toolboxPosition=e.options.toolboxPosition,this.previouslySelectedItem_=this.selectedItem_=null,this.boundEvents_=[]},t.utils.object.inherits(t.Toolbox,t.DeleteArea),t.Toolbox.prototype.onShortcut=function(t){return!1},t.Toolbox.prototype.init=function(){var e=this.workspace_,n=e.getParentSvg();this.flyout_=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_),t.utils.dom.insertAfter(this.flyout_.createDom("svg"),n),this.setVisible(!0),this.flyout_.init(e),this.render(this.toolboxDef_),(e=e.getThemeManager()).subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color"),e.subscribe(this.HtmlDiv,"toolboxForegroundColour","color"),this.workspace_.getComponentManager().addComponent({component:this,weight:1,capabilities:[t.ComponentManager.Capability.AUTOHIDEABLE,t.ComponentManager.Capability.DELETE_AREA,t.ComponentManager.Capability.DRAG_TARGET]})},t.Toolbox.prototype.createDom_=function(e){e=e.getParentSvg();var n=this.createContainer_();return this.contentsDiv_=this.createContentsContainer_(),this.contentsDiv_.tabIndex=0,t.utils.aria.setRole(this.contentsDiv_,t.utils.aria.Role.TREE),n.appendChild(this.contentsDiv_),e.parentNode.insertBefore(n,e),this.attachEvents_(n,this.contentsDiv_),n},t.Toolbox.prototype.createContainer_=function(){var e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),t.utils.dom.addClass(e,"blocklyToolboxDiv"),t.utils.dom.addClass(e,"blocklyNonSelectable"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e},t.Toolbox.prototype.createContentsContainer_=function(){var e=document.createElement("div");return t.utils.dom.addClass(e,"blocklyToolboxContents"),this.isHorizontal()&&(e.style.flexDirection="row"),e},t.Toolbox.prototype.attachEvents_=function(e,n){e=t.browserEvents.conditionalBind(e,"click",this,this.onClick_,!1,!0),this.boundEvents_.push(e),n=t.browserEvents.conditionalBind(n,"keydown",this,this.onKeyDown_,!1,!0),this.boundEvents_.push(n)},t.Toolbox.prototype.onClick_=function(e){if(t.utils.isRightButton(e)||e.target==this.HtmlDiv)t.hideChaff(!1);else{var n=e.target.getAttribute("id");n&&((n=this.getToolboxItemById(n)).isSelectable()&&(this.setSelectedItem(n),n.onClick(e))),t.hideChaff(!0)}t.Touch.clearTouchIdentifier()},t.Toolbox.prototype.onKeyDown_=function(e){var n=!1;switch(e.keyCode){case t.utils.KeyCodes.DOWN:n=this.selectNext_();break;case t.utils.KeyCodes.UP:n=this.selectPrevious_();break;case t.utils.KeyCodes.LEFT:n=this.selectParent_();break;case t.utils.KeyCodes.RIGHT:n=this.selectChild_();break;case t.utils.KeyCodes.ENTER:case t.utils.KeyCodes.SPACE:this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),n=!0);break;default:n=!1}!n&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(n=this.selectedItem_.onKeyDown(e)),n&&e.preventDefault()},t.Toolbox.prototype.createFlyout_=function(){var e=this.workspace_,n=new t.Options({parentWorkspace:e,rtl:e.RTL,oneBasedIndex:e.options.oneBasedIndex,horizontalLayout:e.horizontalLayout,renderer:e.options.renderer,rendererOverrides:e.options.rendererOverrides,move:{scrollbars:!0}});return n.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(n)},t.Toolbox.prototype.render=function(t){this.toolboxDef_=t;for(var e=0;e<this.contents_.length;e++){var n=this.contents_[e];n&&n.dispose()}this.contents_=[],this.contentMap_=Object.create(null),this.renderContents_(t.contents),this.position(),this.handleToolboxItemResize()},t.Toolbox.prototype.renderContents_=function(t){for(var e,n=document.createDocumentFragment(),i=0;e=t[i];i++)this.createToolboxItem_(e,n);this.contentsDiv_.appendChild(n)},t.Toolbox.prototype.createToolboxItem_=function(e,n){var i=e.kind;"CATEGORY"==i.toUpperCase()&&t.utils.toolbox.isCategoryCollapsible(e)&&(i=t.CollapsibleToolboxCategory.registrationName),(i=t.registry.getClass(t.registry.Type.TOOLBOX_ITEM,i.toLowerCase()))&&(e=new i(e,this),this.addToolboxItem_(e),e.init(),(i=e.getDiv())&&n.appendChild(i),e.getClickTarget&&e.getClickTarget().setAttribute("id",e.getId()))},t.Toolbox.prototype.addToolboxItem_=function(t){if(this.contents_.push(t),this.contentMap_[t.getId()]=t,t.isCollapsible())for(var e,n=0;e=t.getChildToolboxItems()[n];n++)this.addToolboxItem_(e)},t.Toolbox.prototype.getToolboxItems=function(){return this.contents_},t.Toolbox.prototype.addStyle=function(e){t.utils.dom.addClass(this.HtmlDiv,e)},t.Toolbox.prototype.removeStyle=function(e){t.utils.dom.removeClass(this.HtmlDiv,e)},t.Toolbox.prototype.getClientRect=function(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect(),n=e.top,i=n+e.height,r=e.left;return e=r+e.width,this.toolboxPosition==t.utils.toolbox.Position.TOP?new t.utils.Rect(-1e7,i,-1e7,1e7):this.toolboxPosition==t.utils.toolbox.Position.BOTTOM?new t.utils.Rect(n,1e7,-1e7,1e7):this.toolboxPosition==t.utils.toolbox.Position.LEFT?new t.utils.Rect(-1e7,1e7,-1e7,e):new t.utils.Rect(-1e7,1e7,r,1e7)},t.Toolbox.prototype.wouldDelete=function(e,n){return e instanceof t.BlockSvg?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(e.isDeletable()),this.wouldDelete_},t.Toolbox.prototype.onDragEnter=function(t){this.updateCursorDeleteStyle_(!0)},t.Toolbox.prototype.onDragExit=function(t){this.updateCursorDeleteStyle_(!1)},t.Toolbox.prototype.onDrop=function(t){this.updateCursorDeleteStyle_(!1)},t.Toolbox.prototype.updateWouldDelete_=function(t){t!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=t,this.updateCursorDeleteStyle_(!0))},t.Toolbox.prototype.updateCursorDeleteStyle_=function(t){var e=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";t?this.addStyle(e):this.removeStyle(e)},t.Toolbox.prototype.getToolboxItemById=function(t){return this.contentMap_[t]||null},t.Toolbox.prototype.getWidth=function(){return this.width_},t.Toolbox.prototype.getHeight=function(){return this.height_},t.Toolbox.prototype.getFlyout=function(){return this.flyout_},t.Toolbox.prototype.getWorkspace=function(){return this.workspace_},t.Toolbox.prototype.getSelectedItem=function(){return this.selectedItem_},t.Toolbox.prototype.getPreviouslySelectedItem=function(){return this.previouslySelectedItem_},t.Toolbox.prototype.isHorizontal=function(){return this.horizontalLayout_},t.Toolbox.prototype.position=function(){var e=this.workspace_.getMetrics(),n=this.HtmlDiv;n&&(this.horizontalLayout_?(n.style.left="0",n.style.height="auto",n.style.width="100%",this.height_=n.offsetHeight,this.width_=e.viewWidth,this.toolboxPosition==t.utils.toolbox.Position.TOP?n.style.top="0":n.style.bottom="0"):(this.toolboxPosition==t.utils.toolbox.Position.RIGHT?n.style.right="0":n.style.left="0",n.style.height="100%",this.width_=n.offsetWidth,this.height_=e.viewHeight),this.flyout_.position())},t.Toolbox.prototype.handleToolboxItemResize=function(){var e=this.workspace_,n=this.HtmlDiv.getBoundingClientRect();e.translate(this.toolboxPosition==t.utils.toolbox.Position.LEFT?e.scrollX+n.width:e.scrollX,this.toolboxPosition==t.utils.toolbox.Position.TOP?e.scrollY+n.height:e.scrollY),t.svgResize(e)},t.Toolbox.prototype.clearSelection=function(){this.setSelectedItem(null)},t.Toolbox.prototype.refreshTheme=function(){for(var t=0;t<this.contents_.length;t++){var e=this.contents_[t];e.refreshTheme&&e.refreshTheme()}},t.Toolbox.prototype.refreshSelection=function(){this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length&&this.flyout_.show(this.selectedItem_.getContents())},t.Toolbox.prototype.setVisible=function(t){this.isVisible_!==t&&(this.HtmlDiv.style.display=t?"block":"none",this.isVisible_=t,this.workspace_.recordDragTargets())},t.Toolbox.prototype.autoHide=function(t){!t&&this.flyout_&&this.flyout_.autoClose&&this.clearSelection()},t.Toolbox.prototype.setSelectedItem=function(t){var e=this.selectedItem_;!t&&!e||t&&!t.isSelectable()||(this.shouldDeselectItem_(e,t)&&null!=e&&this.deselectItem_(e),this.shouldSelectItem_(e,t)&&null!=t&&this.selectItem_(e,t),this.updateFlyout_(e,t),this.fireSelectEvent_(e,t))},t.Toolbox.prototype.shouldDeselectItem_=function(t,e){return null!=t&&(!t.isCollapsible()||t!=e)},t.Toolbox.prototype.shouldSelectItem_=function(t,e){return null!=e&&e!=t},t.Toolbox.prototype.deselectItem_=function(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),t.utils.aria.setState(this.contentsDiv_,t.utils.aria.State.ACTIVEDESCENDANT,"")},t.Toolbox.prototype.selectItem_=function(e,n){this.selectedItem_=n,this.previouslySelectedItem_=e,n.setSelected(!0),t.utils.aria.setState(this.contentsDiv_,t.utils.aria.State.ACTIVEDESCENDANT,n.getId())},t.Toolbox.prototype.selectItemByPosition=function(t){-1<t&&t<this.contents_.length&&((t=this.contents_[t]).isSelectable()&&this.setSelectedItem(t))},t.Toolbox.prototype.updateFlyout_=function(t,e){(t!=e||e.isCollapsible())&&e&&e.getContents().length?(this.flyout_.show(e.getContents()),this.flyout_.scrollToStart()):this.flyout_.hide()},t.Toolbox.prototype.fireSelectEvent_=function(e,n){var i=e&&e.getName(),r=n&&n.getName();e==n&&(r=null),e=new(t.Events.get(t.Events.TOOLBOX_ITEM_SELECT))(i,r,this.workspace_.id),t.Events.fire(e)},t.Toolbox.prototype.selectParent_=function(){return!!this.selectedItem_&&(this.selectedItem_.isCollapsible()&&this.selectedItem_.isExpanded()?(this.selectedItem_.setExpanded(!1),!0):!(!this.selectedItem_.getParent()||!this.selectedItem_.getParent().isSelectable())&&(this.setSelectedItem(this.selectedItem_.getParent()),!0))},t.Toolbox.prototype.selectChild_=function(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;var t=this.selectedItem_;return t.isExpanded()?this.selectNext_():t.setExpanded(!0),!0},t.Toolbox.prototype.selectNext_=function(){if(!this.selectedItem_)return!1;var t=this.contents_.indexOf(this.selectedItem_)+1;if(-1<t&&t<this.contents_.length){for(var e=this.contents_[t];e&&!e.isSelectable();)e=this.contents_[++t];if(e&&e.isSelectable())return this.setSelectedItem(e),!0}return!1},t.Toolbox.prototype.selectPrevious_=function(){if(!this.selectedItem_)return!1;var t=this.contents_.indexOf(this.selectedItem_)-1;if(-1<t&&t<this.contents_.length){for(var e=this.contents_[t];e&&!e.isSelectable();)e=this.contents_[--t];if(e&&e.isSelectable())return this.setSelectedItem(e),!0}return!1},t.Toolbox.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("toolbox"),this.flyout_.dispose();for(var e=0;e<this.contents_.length;e++)this.contents_[e].dispose();for(e=0;e<this.boundEvents_.length;e++)t.browserEvents.unbind(this.boundEvents_[e]);this.boundEvents_=[],this.contents_=[],this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),t.utils.dom.removeNode(this.HtmlDiv)},t.Css.register([".blocklyToolboxDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","padding: 4px 0 4px 0;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyToolboxContents {","display: flex;","flex-wrap: wrap;","flex-direction: column;","}",".blocklyToolboxContents:focus {","outline: none;","}"]),t.registry.register(t.registry.Type.TOOLBOX,t.registry.DEFAULT,t.Toolbox),t.Events.TrashcanOpen=function(e,n){t.Events.TrashcanOpen.superClass_.constructor.call(this,n),this.isOpen=e},t.utils.object.inherits(t.Events.TrashcanOpen,t.Events.UiBase),t.Events.TrashcanOpen.prototype.type=t.Events.TRASHCAN_OPEN,t.Events.TrashcanOpen.prototype.toJson=function(){var e=t.Events.TrashcanOpen.superClass_.toJson.call(this);return e.isOpen=this.isOpen,e},t.Events.TrashcanOpen.prototype.fromJson=function(e){t.Events.TrashcanOpen.superClass_.fromJson.call(this,e),this.isOpen=e.isOpen},t.registry.register(t.registry.Type.EVENT,t.Events.TRASHCAN_OPEN,t.Events.TrashcanOpen),t.IPositionable=function(){},t.uiPosition={},t.uiPosition.verticalPosition={TOP:0,BOTTOM:1},t.uiPosition.horizontalPosition={LEFT:0,RIGHT:1},t.uiPosition.bumpDirection={UP:0,DOWN:1},t.uiPosition.getStartPositionRect=function(e,n,i,r,o,s){var a=s.scrollbar&&s.scrollbar.canScrollVertically();return e.horizontal===t.uiPosition.horizontalPosition.LEFT?(i=o.absoluteMetrics.left+i,a&&s.RTL&&(i+=t.Scrollbar.scrollbarThickness)):(i=o.absoluteMetrics.left+o.viewMetrics.width-n.width-i,a&&!s.RTL&&(i-=t.Scrollbar.scrollbarThickness)),e.vertical===t.uiPosition.verticalPosition.TOP?e=o.absoluteMetrics.top+r:(e=o.absoluteMetrics.top+o.viewMetrics.height-n.height-r,s.scrollbar&&s.scrollbar.canScrollHorizontally()&&(e-=t.Scrollbar.scrollbarThickness)),new t.utils.Rect(e,e+n.height,i,i+n.width)},t.uiPosition.getCornerOppositeToolbox=function(e,n){return{horizontal:n.toolboxMetrics.position===t.utils.toolbox.Position.LEFT||e.horizontalLayout&&!e.RTL?t.uiPosition.horizontalPosition.RIGHT:t.uiPosition.horizontalPosition.LEFT,vertical:n.toolboxMetrics.position===t.utils.toolbox.Position.BOTTOM?t.uiPosition.verticalPosition.TOP:t.uiPosition.verticalPosition.BOTTOM}},t.uiPosition.bumpPositionRect=function(e,n,i,r){for(var o,s=e.left,a=e.right-e.left,l=e.bottom-e.top,u=0;o=r[u];u++)e.intersects(o)&&(e=i===t.uiPosition.bumpDirection.UP?o.top-l-n:o.bottom+n,e=new t.utils.Rect(e,e+l,s,s+a),u=-1);return e},t.Trashcan=function(e){t.Trashcan.superClass_.constructor.call(this),this.workspace_=e,this.id="trashcan",this.contents_=[],this.flyout=null,0>=this.workspace_.options.maxTrashcanContents||(e=new t.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace_.horizontalLayout?(e.toolboxPosition=this.workspace_.toolboxPosition==t.utils.toolbox.Position.TOP?t.utils.toolbox.Position.BOTTOM:t.utils.toolbox.Position.TOP,this.flyout=new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0))(e)):(e.toolboxPosition=this.workspace_.toolboxPosition==t.utils.toolbox.Position.RIGHT?t.utils.toolbox.Position.LEFT:t.utils.toolbox.Position.RIGHT,this.flyout=new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0))(e)),this.workspace_.addChangeListener(this.onDelete_.bind(this)))},t.utils.object.inherits(t.Trashcan,t.DeleteArea),t.Trashcan.prototype.WIDTH_=47,t.Trashcan.prototype.BODY_HEIGHT_=44,t.Trashcan.prototype.LID_HEIGHT_=16,t.Trashcan.prototype.MARGIN_VERTICAL_=20,t.Trashcan.prototype.MARGIN_HORIZONTAL_=20,t.Trashcan.prototype.MARGIN_HOTSPOT_=10,t.Trashcan.prototype.SPRITE_LEFT_=0,t.Trashcan.prototype.SPRITE_TOP_=32,t.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_=.1,t.Trashcan.ANIMATION_LENGTH_=80,t.Trashcan.ANIMATION_FRAMES_=4,t.Trashcan.OPACITY_MIN_=.4,t.Trashcan.OPACITY_MAX_=.8,t.Trashcan.MAX_LID_ANGLE_=45,t.Trashcan.prototype.isLidOpen=!1,t.Trashcan.prototype.minOpenness_=0,t.Trashcan.prototype.svgGroup_=null,t.Trashcan.prototype.svgLid_=null,t.Trashcan.prototype.lidTask_=0,t.Trashcan.prototype.lidOpen_=0,t.Trashcan.prototype.left_=0,t.Trashcan.prototype.top_=0,t.Trashcan.prototype.initialized_=!1,t.Trashcan.prototype.createDom=function(){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyTrash"},null);var e=String(Math.random()).substring(2),n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+e},this.svgGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},n);var i=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,x:-this.SPRITE_LEFT_,height:t.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+e+")"},this.svgGroup_);return i.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+e},this.svgGroup_),t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:this.WIDTH_,height:this.LID_HEIGHT_},n),this.svgLid_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,x:-this.SPRITE_LEFT_,height:t.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+e+")"},this.svgGroup_),this.svgLid_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),t.browserEvents.bind(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable_),t.browserEvents.bind(this.svgGroup_,"mouseup",this,this.click),t.browserEvents.bind(i,"mouseover",this,this.mouseOver_),t.browserEvents.bind(i,"mouseout",this,this.mouseOut_),this.animateLid_(),this.svgGroup_},t.Trashcan.prototype.init=function(){0<this.workspace_.options.maxTrashcanContents&&(t.utils.dom.insertAfter(this.flyout.createDom(t.utils.Svg.SVG),this.workspace_.getParentSvg()),this.flyout.init(this.workspace_)),this.workspace_.getComponentManager().addComponent({component:this,weight:1,capabilities:[t.ComponentManager.Capability.AUTOHIDEABLE,t.ComponentManager.Capability.DELETE_AREA,t.ComponentManager.Capability.DRAG_TARGET,t.ComponentManager.Capability.POSITIONABLE]}),this.initialized_=!0,this.setLidOpen(!1)},t.Trashcan.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("trashcan"),this.svgGroup_&&(t.utils.dom.removeNode(this.svgGroup_),this.svgGroup_=null),this.workspace_=this.svgLid_=null,clearTimeout(this.lidTask_)},t.Trashcan.prototype.hasContents_=function(){return!!this.contents_.length},t.Trashcan.prototype.contentsIsOpen=function(){return this.flyout.isVisible()},t.Trashcan.prototype.openFlyout=function(){if(!this.contentsIsOpen()){var e=this.contents_.map(t.Xml.textToDom);this.flyout.show(e),this.fireUiEvent_(!0)}},t.Trashcan.prototype.closeFlyout=function(){this.contentsIsOpen()&&(this.flyout.hide(),this.fireUiEvent_(!1))},t.Trashcan.prototype.autoHide=function(t){!t&&this.flyout&&this.closeFlyout()},t.Trashcan.prototype.emptyContents=function(){this.hasContents_()&&(this.contents_.length=0,this.setMinOpenness_(0),this.closeFlyout())},t.Trashcan.prototype.position=function(e,n){if(this.initialized_){var i=t.uiPosition.getCornerOppositeToolbox(this.workspace_,e);e=t.uiPosition.getStartPositionRect(i,new t.utils.Size(this.WIDTH_,this.BODY_HEIGHT_+this.LID_HEIGHT_),this.MARGIN_HORIZONTAL_,this.MARGIN_VERTICAL_,e,this.workspace_),n=t.uiPosition.bumpPositionRect(e,this.MARGIN_VERTICAL_,i.vertical===t.uiPosition.verticalPosition.TOP?t.uiPosition.bumpDirection.DOWN:t.uiPosition.bumpDirection.UP,n),this.top_=n.top,this.left_=n.left,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}},t.Trashcan.prototype.getBoundingRectangle=function(){return new t.utils.Rect(this.top_,this.top_+this.BODY_HEIGHT_+this.LID_HEIGHT_,this.left_,this.left_+this.WIDTH_)},t.Trashcan.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var e=this.svgGroup_.getBoundingClientRect(),n=e.top+this.SPRITE_TOP_-this.MARGIN_HOTSPOT_;return e=e.left+this.SPRITE_LEFT_-this.MARGIN_HOTSPOT_,new t.utils.Rect(n,n+this.LID_HEIGHT_+this.BODY_HEIGHT_+2*this.MARGIN_HOTSPOT_,e,e+this.WIDTH_+2*this.MARGIN_HOTSPOT_)},t.Trashcan.prototype.onDragOver=function(t){this.setLidOpen(this.wouldDelete_)},t.Trashcan.prototype.onDragExit=function(t){this.setLidOpen(!1)},t.Trashcan.prototype.onDrop=function(t){setTimeout(this.setLidOpen.bind(this,!1),100)},t.Trashcan.prototype.setLidOpen=function(t){this.isLidOpen!=t&&(clearTimeout(this.lidTask_),this.isLidOpen=t,this.animateLid_())},t.Trashcan.prototype.animateLid_=function(){var e=t.Trashcan.ANIMATION_FRAMES_,n=1/(e+1);this.lidOpen_+=this.isLidOpen?n:-n,this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1),this.setLidAngle_(this.lidOpen_*t.Trashcan.MAX_LID_ANGLE_),n=t.Trashcan.OPACITY_MIN_,this.svgGroup_.style.opacity=n+this.lidOpen_*(t.Trashcan.OPACITY_MAX_-n),this.lidOpen_>this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),t.Trashcan.ANIMATION_LENGTH_/e))},t.Trashcan.prototype.setLidAngle_=function(e){var n=this.workspace_.toolboxPosition==t.utils.toolbox.Position.RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(n?-e:e)+","+(n?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")},t.Trashcan.prototype.setMinOpenness_=function(e){this.minOpenness_=e,this.isLidOpen||this.setLidAngle_(e*t.Trashcan.MAX_LID_ANGLE_)},t.Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)},t.Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()},t.Trashcan.prototype.fireUiEvent_=function(e){e=new(t.Events.get(t.Events.TRASHCAN_OPEN))(e,this.workspace_.id),t.Events.fire(e)},t.Trashcan.prototype.blockMouseDownWhenOpenable_=function(t){!this.contentsIsOpen()&&this.hasContents_()&&t.stopPropagation()},t.Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)},t.Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)},t.Trashcan.prototype.onDelete_=function(e){if(!(0>=this.workspace_.options.maxTrashcanContents)&&e.type==t.Events.BLOCK_DELETE&&e.oldXml.tagName&&"shadow"!=e.oldXml.tagName.toLowerCase()&&(e=this.cleanBlockXML_(e.oldXml),-1==this.contents_.indexOf(e))){for(this.contents_.unshift(e);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_)}},t.Trashcan.prototype.cleanBlockXML_=function(e){for(var n=e=e.cloneNode(!0);n;){n.removeAttribute&&(n.removeAttribute("x"),n.removeAttribute("y"),n.removeAttribute("id"),n.removeAttribute("disabled"),"comment"==n.nodeName&&(n.removeAttribute("h"),n.removeAttribute("w"),n.removeAttribute("pinned")));var i=n.firstChild||n.nextSibling;if(!i)for(i=n.parentNode;i;){if(i.nextSibling){i=i.nextSibling;break}i=i.parentNode}n=i}return t.Xml.domToText(e)},t.VariablesDynamic={},t.VariablesDynamic.onCreateVariableButtonClick_String=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"String")},t.VariablesDynamic.onCreateVariableButtonClick_Number=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"Number")},t.VariablesDynamic.onCreateVariableButtonClick_Colour=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"Colour")},t.VariablesDynamic.flyoutCategory=function(e){var n=[],i=document.createElement("button");return i.setAttribute("text",t.Msg.NEW_STRING_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),n.push(i),(i=document.createElement("button")).setAttribute("text",t.Msg.NEW_NUMBER_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),n.push(i),(i=document.createElement("button")).setAttribute("text",t.Msg.NEW_COLOUR_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),n.push(i),e.registerButtonCallback("CREATE_VARIABLE_STRING",t.VariablesDynamic.onCreateVariableButtonClick_String),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",t.VariablesDynamic.onCreateVariableButtonClick_Number),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",t.VariablesDynamic.onCreateVariableButtonClick_Colour),e=t.VariablesDynamic.flyoutCategoryBlocks(e),n.concat(e)},t.VariablesDynamic.flyoutCategoryBlocks=function(e){var n=[];if(0<(e=e.getAllVariables()).length){if(t.Blocks.variables_set_dynamic){var i=e[e.length-1],r=t.utils.xml.createElement("block");r.setAttribute("type","variables_set_dynamic"),r.setAttribute("gap",24),r.appendChild(t.Variables.generateVariableFieldDom(i)),n.push(r)}if(t.Blocks.variables_get_dynamic){e.sort(t.VariableModel.compareByName),i=0;for(var o;o=e[i];i++)(r=t.utils.xml.createElement("block")).setAttribute("type","variables_get_dynamic"),r.setAttribute("gap",8),r.appendChild(t.Variables.generateVariableFieldDom(o)),n.push(r)}}return n},t.ZoomControls=function(t){this.workspace_=t,this.id="zoomControls",this.zoomResetGroup_=this.zoomOutGroup_=this.zoomInGroup_=this.onZoomOutWrapper_=this.onZoomInWrapper_=this.onZoomResetWrapper_=null},t.ZoomControls.prototype.WIDTH_=32,t.ZoomControls.prototype.HEIGHT_=32,t.ZoomControls.prototype.SMALL_SPACING_=2,t.ZoomControls.prototype.LARGE_SPACING_=11,t.ZoomControls.prototype.MARGIN_VERTICAL_=20,t.ZoomControls.prototype.MARGIN_HORIZONTAL_=20,t.ZoomControls.prototype.svgGroup_=null,t.ZoomControls.prototype.left_=0,t.ZoomControls.prototype.top_=0,t.ZoomControls.prototype.initialized_=!1,t.ZoomControls.prototype.createDom=function(){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null);var e=String(Math.random()).substring(2);return this.createZoomOutSvg_(e),this.createZoomInSvg_(e),this.workspace_.isMovable()&&this.createZoomResetSvg_(e),this.svgGroup_},t.ZoomControls.prototype.init=function(){this.workspace_.getComponentManager().addComponent({component:this,weight:2,capabilities:[t.ComponentManager.Capability.POSITIONABLE]}),this.initialized_=!0},t.ZoomControls.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("zoomControls"),this.svgGroup_&&t.utils.dom.removeNode(this.svgGroup_),this.onZoomResetWrapper_&&t.browserEvents.unbind(this.onZoomResetWrapper_),this.onZoomInWrapper_&&t.browserEvents.unbind(this.onZoomInWrapper_),this.onZoomOutWrapper_&&t.browserEvents.unbind(this.onZoomOutWrapper_)},t.ZoomControls.prototype.getBoundingRectangle=function(){var e=this.SMALL_SPACING_+2*this.HEIGHT_;return this.zoomResetGroup_&&(e+=this.LARGE_SPACING_+this.HEIGHT_),new t.utils.Rect(this.top_,this.top_+e,this.left_,this.left_+this.WIDTH_)},t.ZoomControls.prototype.position=function(e,n){if(this.initialized_){var i=t.uiPosition.getCornerOppositeToolbox(this.workspace_,e),r=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup_&&(r+=this.LARGE_SPACING_+this.HEIGHT_),e=t.uiPosition.getStartPositionRect(i,new t.utils.Size(this.WIDTH_,r),this.MARGIN_HORIZONTAL_,this.MARGIN_VERTICAL_,e,this.workspace_),i=i.vertical,n=t.uiPosition.bumpPositionRect(e,this.MARGIN_VERTICAL_,i===t.uiPosition.verticalPosition.TOP?t.uiPosition.bumpDirection.DOWN:t.uiPosition.bumpDirection.UP,n),i===t.uiPosition.verticalPosition.TOP?(i=this.SMALL_SPACING_+this.HEIGHT_,this.zoomInGroup_.setAttribute("transform","translate(0, "+i+")"),this.zoomResetGroup_&&this.zoomResetGroup_.setAttribute("transform","translate(0, "+(i+this.LARGE_SPACING_+this.HEIGHT_)+")")):(i=this.zoomResetGroup_?this.LARGE_SPACING_+this.HEIGHT_:0,this.zoomInGroup_.setAttribute("transform","translate(0, "+i+")"),this.zoomOutGroup_.setAttribute("transform","translate(0, "+(i+this.SMALL_SPACING_+this.HEIGHT_)+")")),this.top_=n.top,this.left_=n.left,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}},t.ZoomControls.prototype.createZoomOutSvg_=function(e){this.zoomOutGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomOutWrapper_=t.browserEvents.conditionalBind(this.zoomOutGroup_,"mousedown",null,this.zoom_.bind(this,-1))},t.ZoomControls.prototype.createZoomInSvg_=function(e){this.zoomInGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomInWrapper_=t.browserEvents.conditionalBind(this.zoomInGroup_,"mousedown",null,this.zoom_.bind(this,1))},t.ZoomControls.prototype.zoom_=function(e,n){this.workspace_.markFocused(),this.workspace_.zoomCenter(e),this.fireZoomEvent_(),t.Touch.clearTouchIdentifier(),n.stopPropagation(),n.preventDefault()},t.ZoomControls.prototype.createZoomResetSvg_=function(e){this.zoomResetGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomResetWrapper_=t.browserEvents.conditionalBind(this.zoomResetGroup_,"mousedown",null,this.resetZoom_.bind(this))},t.ZoomControls.prototype.resetZoom_=function(e){this.workspace_.markFocused();var n=Math.log(this.workspace_.options.zoomOptions.startScale/this.workspace_.scale)/Math.log(this.workspace_.options.zoomOptions.scaleSpeed);this.workspace_.beginCanvasTransition(),this.workspace_.zoomCenter(n),this.workspace_.scrollCenter(),setTimeout(this.workspace_.endCanvasTransition.bind(this.workspace_),500),this.fireZoomEvent_(),t.Touch.clearTouchIdentifier(),e.stopPropagation(),e.preventDefault()},t.ZoomControls.prototype.fireZoomEvent_=function(){var e=new(t.Events.get(t.Events.CLICK))(null,this.workspace_.id,"zoom_controls");t.Events.fire(e)},t.Css.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]),t.ShortcutItems={},t.ShortcutItems.names={ESCAPE:"escape",DELETE:"delete",COPY:"copy",CUT:"cut",PASTE:"paste",UNDO:"undo",REDO:"redo"},t.ShortcutItems.registerEscape=function(){var e={name:t.ShortcutItems.names.ESCAPE,preconditionFn:function(t){return!t.options.readOnly},callback:function(){return t.hideChaff(),!0}};t.ShortcutRegistry.registry.register(e),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.ESC,e.name)},t.ShortcutItems.registerDelete=function(){var e={name:t.ShortcutItems.names.DELETE,preconditionFn:function(e){return!e.options.readOnly&&t.selected&&t.selected.isDeletable()},callback:function(e,n){return n.preventDefault(),!t.Gesture.inProgress()&&(t.deleteBlock(t.selected),!0)}};t.ShortcutRegistry.registry.register(e),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.DELETE,e.name),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.BACKSPACE,e.name)},t.ShortcutItems.registerCopy=function(){var e={name:t.ShortcutItems.names.COPY,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()&&t.selected&&t.selected.isDeletable()&&t.selected.isMovable()},callback:function(e,n){return n.preventDefault(),t.hideChaff(),t.copy(t.selected),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerCut=function(){var e={name:t.ShortcutItems.names.CUT,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()&&t.selected&&t.selected.isDeletable()&&t.selected.isMovable()&&!t.selected.workspace.isFlyout},callback:function(){return t.copy(t.selected),t.deleteBlock(t.selected),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerPaste=function(){var e={name:t.ShortcutItems.names.PASTE,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()},callback:function(){return t.paste()}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerUndo=function(){var e={name:t.ShortcutItems.names.UNDO,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()},callback:function(e){return t.hideChaff(),e.undo(!1),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerRedo=function(){var e={name:t.ShortcutItems.names.REDO,preconditionFn:function(e){return!t.Gesture.inProgress()&&!e.options.readOnly},callback:function(e){return t.hideChaff(),e.undo(!0),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Y,[t.utils.KeyCodes.CTRL]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerDefaultShortcuts=function(){t.ShortcutItems.registerEscape(),t.ShortcutItems.registerDelete(),t.ShortcutItems.registerCopy(),t.ShortcutItems.registerCut(),t.ShortcutItems.registerPaste(),t.ShortcutItems.registerUndo(),t.ShortcutItems.registerRedo()},t.ShortcutItems.registerDefaultShortcuts(),t.ContextMenuItems={},t.ContextMenuItems.registerUndo=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.UNDO},preconditionFn:function(t){return 0<t.workspace.getUndoStack().length?"enabled":"disabled"},callback:function(t){t.workspace.undo(!1)},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},t.ContextMenuItems.registerRedo=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.REDO},preconditionFn:function(t){return 0<t.workspace.getRedoStack().length?"enabled":"disabled"},callback:function(t){t.workspace.undo(!0)},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},t.ContextMenuItems.registerCleanup=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.CLEAN_UP},preconditionFn:function(t){return t.workspace.isMovable()?1<t.workspace.getTopBlocks(!1).length?"enabled":"disabled":"hidden"},callback:function(t){t.workspace.cleanUp()},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},t.ContextMenuItems.toggleOption_=function(t,e){for(var n=0,i=0;i<e.length;i++)for(var r=e[i];r;)setTimeout(r.setCollapsed.bind(r,t),n),r=r.getNextBlock(),n+=10},t.ContextMenuItems.registerCollapse=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.COLLAPSE_ALL},preconditionFn:function(t){if(t.workspace.options.collapse){t=t.workspace.getTopBlocks(!1);for(var e=0;e<t.length;e++)for(var n=t[e];n;){if(!n.isCollapsed())return"enabled";n=n.getNextBlock()}return"disabled"}return"hidden"},callback:function(e){t.ContextMenuItems.toggleOption_(!0,e.workspace.getTopBlocks(!0))},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},t.ContextMenuItems.registerExpand=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.EXPAND_ALL},preconditionFn:function(t){if(t.workspace.options.collapse){t=t.workspace.getTopBlocks(!1);for(var e=0;e<t.length;e++)for(var n=t[e];n;){if(n.isCollapsed())return"enabled";n=n.getNextBlock()}return"disabled"}return"hidden"},callback:function(e){t.ContextMenuItems.toggleOption_(!1,e.workspace.getTopBlocks(!0))},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},t.ContextMenuItems.addDeletableBlocks_=function(e,n){if(e.isDeletable())Array.prototype.push.apply(n,e.getDescendants(!1));else{e=e.getChildren(!1);for(var i=0;i<e.length;i++)t.ContextMenuItems.addDeletableBlocks_(e[i],n)}},t.ContextMenuItems.getDeletableBlocks_=function(e){var n=[];e=e.getTopBlocks(!0);for(var i=0;i<e.length;i++)t.ContextMenuItems.addDeletableBlocks_(e[i],n);return n},t.ContextMenuItems.deleteNext_=function(e,n){t.Events.setGroup(n);var i=e.shift();i&&(i.workspace?(i.dispose(!1,!0),setTimeout(t.ContextMenuItems.deleteNext_,10,e,n)):t.ContextMenuItems.deleteNext_(e,n)),t.Events.setGroup(!1)},t.ContextMenuItems.registerDeleteAll=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){if(e.workspace)return 1==(e=t.ContextMenuItems.getDeletableBlocks_(e.workspace).length)?t.Msg.DELETE_BLOCK:t.Msg.DELETE_X_BLOCKS.replace("%1",String(e))},preconditionFn:function(e){if(e.workspace)return 0<t.ContextMenuItems.getDeletableBlocks_(e.workspace).length?"enabled":"disabled"},callback:function(e){if(e.workspace){e.workspace.cancelCurrentGesture();var n=t.ContextMenuItems.getDeletableBlocks_(e.workspace),i=t.utils.genUid();2>n.length?t.ContextMenuItems.deleteNext_(n,i):t.confirm(t.Msg.DELETE_ALL_BLOCKS.replace("%1",n.length),function(e){e&&t.ContextMenuItems.deleteNext_(n,i)})}},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},t.ContextMenuItems.registerWorkspaceOptions_=function(){t.ContextMenuItems.registerUndo(),t.ContextMenuItems.registerRedo(),t.ContextMenuItems.registerCleanup(),t.ContextMenuItems.registerCollapse(),t.ContextMenuItems.registerExpand(),t.ContextMenuItems.registerDeleteAll()},t.ContextMenuItems.registerDuplicate=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.DUPLICATE_BLOCK},preconditionFn:function(t){return!(t=t.block).isInFlyout&&t.isDeletable()&&t.isMovable()?t.isDuplicatable()?"enabled":"disabled":"hidden"},callback:function(e){e.block&&t.duplicate(e.block)},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},t.ContextMenuItems.registerComment=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.getCommentIcon()?t.Msg.REMOVE_COMMENT:t.Msg.ADD_COMMENT},preconditionFn:function(e){return e=e.block,t.utils.userAgent.IE||e.isInFlyout||!e.workspace.options.comments||e.isCollapsed()||!e.isEditable()?"hidden":"enabled"},callback:function(t){(t=t.block).getCommentIcon()?t.setCommentText(null):t.setCommentText("")},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockComment",weight:2})},t.ContextMenuItems.registerInline=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.getInputsInline()?t.Msg.EXTERNAL_INPUTS:t.Msg.INLINE_INPUTS},preconditionFn:function(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed())for(var n=1;n<e.inputList.length;n++)if(e.inputList[n-1].type!=t.inputTypes.STATEMENT&&e.inputList[n].type!=t.inputTypes.STATEMENT)return"enabled";return"hidden"},callback:function(t){t.block.setInputsInline(!t.block.getInputsInline())},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockInline",weight:3})},t.ContextMenuItems.registerCollapseExpandBlock=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.isCollapsed()?t.Msg.EXPAND_BLOCK:t.Msg.COLLAPSE_BLOCK},preconditionFn:function(t){return!(t=t.block).isInFlyout&&t.isMovable()&&t.workspace.options.collapse?"enabled":"hidden"},callback:function(t){t.block.setCollapsed(!t.block.isCollapsed())},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},t.ContextMenuItems.registerDisable=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.isEnabled()?t.Msg.DISABLE_BLOCK:t.Msg.ENABLE_BLOCK},preconditionFn:function(t){return!(t=t.block).isInFlyout&&t.workspace.options.disable&&t.isEditable()?t.getInheritedDisabled()?"disabled":"enabled":"hidden"},callback:function(e){e=e.block;var n=t.Events.getGroup();n||t.Events.setGroup(!0),e.setEnabled(!e.isEnabled()),n||t.Events.setGroup(!1)},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDisable",weight:5})},t.ContextMenuItems.registerDelete=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){var n=e.block;return e=n.getDescendants(!1).length,(n=n.getNextBlock())&&(e-=n.getDescendants(!1).length),1==e?t.Msg.DELETE_BLOCK:t.Msg.DELETE_X_BLOCKS.replace("%1",String(e))},preconditionFn:function(t){return!t.block.isInFlyout&&t.block.isDeletable()?"enabled":"hidden"},callback:function(e){t.Events.setGroup(!0),e.block&&t.deleteBlock(e.block),t.Events.setGroup(!1)},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDelete",weight:6})},t.ContextMenuItems.registerHelp=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.HELP},preconditionFn:function(t){return("function"==typeof(t=t.block).helpUrl?t.helpUrl():t.helpUrl)?"enabled":"hidden"},callback:function(t){t.block.showHelp()},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockHelp",weight:7})},t.ContextMenuItems.registerBlockOptions_=function(){t.ContextMenuItems.registerDuplicate(),t.ContextMenuItems.registerComment(),t.ContextMenuItems.registerInline(),t.ContextMenuItems.registerCollapseExpandBlock(),t.ContextMenuItems.registerDisable(),t.ContextMenuItems.registerDelete(),t.ContextMenuItems.registerHelp()},t.ContextMenuItems.registerDefaultOptions=function(){t.ContextMenuItems.registerWorkspaceOptions_(),t.ContextMenuItems.registerBlockOptions_()},t.ContextMenuItems.registerDefaultOptions(),t.Mutator=function(e){t.Mutator.superClass_.constructor.call(this,null),this.quarkNames_=e},t.utils.object.inherits(t.Mutator,t.Icon),t.Mutator.prototype.workspace_=null,t.Mutator.prototype.workspaceWidth_=0,t.Mutator.prototype.workspaceHeight_=0,t.Mutator.prototype.setBlock=function(t){this.block_=t},t.Mutator.prototype.getWorkspace=function(){return this.workspace_},t.Mutator.prototype.drawIcon_=function(e){t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},e),t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},e),t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},e)},t.Mutator.prototype.iconClick_=function(e){this.block_.isEditable()&&t.Icon.prototype.iconClick_.call(this,e)},t.Mutator.prototype.createEditor_=function(){if(this.svgDialog_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{x:t.Bubble.BORDER_WIDTH,y:t.Bubble.BORDER_WIDTH},null),this.quarkNames_.length)for(var e,n=t.utils.xml.createElement("xml"),i=0;e=this.quarkNames_[i];i++){var r=t.utils.xml.createElement("block");r.setAttribute("type",e),n.appendChild(r)}else n=null;return(i=new t.Options({disable:!1,parentWorkspace:this.block_.workspace,media:this.block_.workspace.options.pathToMedia,rtl:this.block_.RTL,horizontalLayout:!1,renderer:this.block_.workspace.options.renderer,rendererOverrides:this.block_.workspace.options.rendererOverrides})).toolboxPosition=this.block_.RTL?t.utils.toolbox.Position.RIGHT:t.utils.toolbox.Position.LEFT,(e=!!n)&&(i.languageTree=t.utils.toolbox.convertToolboxDefToJson(n)),this.workspace_=new t.WorkspaceSvg(i),this.workspace_.isMutator=!0,this.workspace_.addChangeListener(t.Events.disableOrphans),n=e?this.workspace_.addFlyout(t.utils.Svg.G):null,i=this.workspace_.createDom("blocklyMutatorBackground"),n&&i.insertBefore(n,this.workspace_.svgBlockCanvas_),this.svgDialog_.appendChild(i),this.svgDialog_},t.Mutator.prototype.updateEditable=function(){t.Mutator.superClass_.updateEditable.call(this),this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&t.utils.dom.removeClass(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&t.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly")))},t.Mutator.prototype.resizeBubble_=function(){var e=2*t.Bubble.BORDER_WIDTH,n=this.workspace_.getCanvas().getBBox(),i=n.width+n.x,r=n.height+3*e,o=this.workspace_.getFlyout();if(o){var s=o.getWorkspace().getMetricsManager().getScrollMetrics();r=Math.max(r,s.height+20),i+=o.getWidth()}this.block_.RTL&&(i=-n.x),i+=3*e,(Math.abs(this.workspaceWidth_-i)>e||Math.abs(this.workspaceHeight_-r)>e)&&(this.workspaceWidth_=i,this.workspaceHeight_=r,this.bubble_.setBubbleSize(i+e,r+e),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_)),this.block_.RTL&&(e="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",e)),this.workspace_.resize()},t.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDragTargets()},t.Mutator.prototype.setVisible=function(e){if(e!=this.isVisible())if(t.Events.fire(new(t.Events.get(t.Events.BUBBLE_OPEN))(this.block_,e,"mutator")),e){this.bubble_=new t.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var n=this.workspace_.options.languageTree;e=this.workspace_.getFlyout(),n&&(e.init(this.workspace_),e.show(n)),this.rootBlock_=this.block_.decompose(this.workspace_),n=this.rootBlock_.getDescendants(!1);for(var i,r=0;i=n[r];r++)i.render();if(this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),e?(n=2*e.CORNER_RADIUS,e=this.rootBlock_.RTL?e.getWidth()+n:n):e=n=16,this.block_.RTL&&(e=-e),this.rootBlock_.moveBy(e,n),this.block_.saveConnections){var o=this,s=this.block_;s.saveConnections(this.rootBlock_),this.sourceListener_=function(){s.saveConnections(o.rootBlock_)},this.block_.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_(),this.workspace_.addChangeListener(this.workspaceChanged_.bind(this)),this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)},t.Mutator.prototype.workspaceChanged_=function(e){if(!(e.isUiEvent||e.type==t.Events.CHANGE&&"disabled"==e.element)){if(!this.workspace_.isDragging()){e=this.workspace_.getTopBlocks(!1);for(var n,i=0;n=e[i];i++){var r=n.getRelativeToSurfaceXY();if(20>r.y&&n.moveBy(0,20-r.y),n.RTL){var o=-20,s=this.workspace_.getFlyout();s&&(o-=s.getWidth()),r.x>o&&n.moveBy(o-r.x,0)}else 20>r.x&&n.moveBy(20-r.x,0)}}if(this.rootBlock_.workspace==this.workspace_){if(t.Events.setGroup(!0),e=(e=(n=this.block_).mutationToDom())&&t.Xml.domToText(e),i=n.rendered,n.rendered=!1,n.compose(this.rootBlock_),n.rendered=i,n.initSvg(),n.rendered&&n.render(),e!=(i=(i=n.mutationToDom())&&t.Xml.domToText(i))){t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(n,"mutation",null,e,i));var a=t.Events.getGroup();setTimeout(function(){t.Events.setGroup(a),n.bumpNeighbours(),t.Events.setGroup(!1)},t.BUMP_DELAY)}this.workspace_.isDragging()||this.resizeBubble_(),t.Events.setGroup(!1)}}},t.Mutator.prototype.dispose=function(){this.block_.mutator=null,t.Icon.prototype.dispose.call(this)},t.Mutator.prototype.updateBlockStyle=function(){var t=this.workspace_;if(t&&t.getAllBlocks(!1)){for(var e,n=t.getAllBlocks(!1),i=0;e=n[i];i++)e.setStyle(e.getStyleName());if(i=t.getFlyout())for(t=i.workspace_.getAllBlocks(!1),i=0;e=t[i];i++)e.setStyle(e.getStyleName())}},t.Mutator.reconnect=function(t,e,n){if(!t||!t.getSourceBlock().workspace)return!1;n=e.getInput(n).connection;var i=t.targetBlock();return!(i&&i!=e||n.targetConnection==t)&&(n.isConnected()&&n.disconnect(),n.connect(t),!0)},t.Mutator.findParentWs=function(t){var e=null;if(t&&t.options){var n=t.options.parentWorkspace;t.isFlyout?n&&n.options&&(e=n.options.parentWorkspace):n&&(e=n)}return e},t.FieldTextInput=function(e,n,i){this.spellcheck_=!0,t.FieldTextInput.superClass_.constructor.call(this,e,n,i),this.onKeyInputWrapper_=this.onKeyDownWrapper_=this.htmlInput_=null,this.fullBlockClickTarget_=!1,this.workspace_=null},t.utils.object.inherits(t.FieldTextInput,t.Field),t.FieldTextInput.prototype.DEFAULT_VALUE="",t.FieldTextInput.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldTextInput(n,void 0,e)},t.FieldTextInput.prototype.SERIALIZABLE=!0,t.FieldTextInput.BORDERRADIUS=4,t.FieldTextInput.prototype.CURSOR="text",t.FieldTextInput.prototype.configure_=function(e){t.FieldTextInput.superClass_.configure_.call(this,e),"boolean"==typeof e.spellcheck&&(this.spellcheck_=e.spellcheck)},t.FieldTextInput.prototype.initView=function(){if(this.getConstants().FULL_BLOCK_FIELDS){for(var t,e=0,n=0,i=0;t=this.sourceBlock_.inputList[i];i++){for(var r=0;t.fieldRow[r];r++)e++;t.connection&&n++}this.fullBlockClickTarget_=1>=e&&this.sourceBlock_.outputConnection&&!n}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_(),this.createTextElement_()},t.FieldTextInput.prototype.doClassValidation_=function(t){return null===t||void 0===t?null:String(t)},t.FieldTextInput.prototype.doValueInvalid_=function(e){this.isBeingEdited_&&(this.isTextValid_=!1,e=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))},t.FieldTextInput.prototype.doValueUpdate_=function(t){this.isTextValid_=!0,this.value_=t,this.isBeingEdited_||(this.isDirty_=!0)},t.FieldTextInput.prototype.applyColour=function(){this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS&&(this.borderRect_?this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary):this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR))},t.FieldTextInput.prototype.render_=function(){if(t.FieldTextInput.superClass_.render_.call(this),this.isBeingEdited_){this.resizeEditor_();var e=this.htmlInput_;this.isTextValid_?(t.utils.dom.removeClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!1)):(t.utils.dom.addClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!0))}},t.FieldTextInput.prototype.setSpellcheck=function(t){t!=this.spellcheck_&&(this.spellcheck_=t,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))},t.FieldTextInput.prototype.showEditor_=function(e,n){this.workspace_=this.sourceBlock_.workspace,!(e=n||!1)&&(t.utils.userAgent.MOBILE||t.utils.userAgent.ANDROID||t.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(e)},t.FieldTextInput.prototype.showPromptEditor_=function(){t.prompt(t.Msg.CHANGE_VALUE_TITLE,this.getText(),function(t){this.setValue(this.getValueFromEditorText_(t))}.bind(this))},t.FieldTextInput.prototype.showInlineEditor_=function(e){t.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this)),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())},t.FieldTextInput.prototype.widgetCreate_=function(){var e=t.WidgetDiv.DIV;t.utils.dom.addClass(this.getClickTarget_(),"editing");var n=document.createElement("input");n.className="blocklyHtmlInput",n.setAttribute("spellcheck",this.spellcheck_);var i=this.workspace_.getScale(),r=this.getConstants().FIELD_TEXT_FONTSIZE*i+"pt";if(e.style.fontSize=r,n.style.fontSize=r,r=t.FieldTextInput.BORDERRADIUS*i+"px",this.fullBlockClickTarget_){r=((r=this.getScaledBBox()).bottom-r.top)/2+"px";var o=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;n.style.border=1*i+"px solid "+o,e.style.borderRadius=r,e.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(e.style.boxShadow="rgba(255, 255, 255, 0.3) 0px 0px 0px "+4*i+"px")}return n.style.borderRadius=r,e.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.untypedDefaultValue_=this.value_,n.oldValue_=null,this.resizeEditor_(),this.bindInputEvents_(n),n},t.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_&&this.onFinishEditing_(this.value_),this.unbindInputEvents_();var e=t.WidgetDiv.DIV.style;e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,t.utils.dom.removeClass(this.getClickTarget_(),"editing")},t.FieldTextInput.prototype.bindInputEvents_=function(e){this.onKeyDownWrapper_=t.browserEvents.conditionalBind(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=t.browserEvents.conditionalBind(e,"input",this,this.onHtmlInputChange_)},t.FieldTextInput.prototype.unbindInputEvents_=function(){this.onKeyDownWrapper_&&(t.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(t.browserEvents.unbind(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)},t.FieldTextInput.prototype.onHtmlInputKeyDown_=function(e){e.keyCode==t.utils.KeyCodes.ENTER?(t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()):e.keyCode==t.utils.KeyCodes.ESC?(this.setValue(this.htmlInput_.untypedDefaultValue_),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()):e.keyCode==t.utils.KeyCodes.TAB&&(t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())},t.FieldTextInput.prototype.onHtmlInputChange_=function(e){(e=this.htmlInput_.value)!==this.htmlInput_.oldValue_&&(this.htmlInput_.oldValue_=e,t.Events.setGroup(!0),e=this.getValueFromEditorText_(e),this.setValue(e),this.forceRerender(),this.resizeEditor_(),t.Events.setGroup(!1))},t.FieldTextInput.prototype.setEditorValue_=function(t){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(t)),this.setValue(t)},t.FieldTextInput.prototype.resizeEditor_=function(){var e=t.WidgetDiv.DIV,n=this.getScaledBBox();e.style.width=n.right-n.left+"px",e.style.height=n.bottom-n.top+"px",n=new t.utils.Coordinate(this.sourceBlock_.RTL?n.right-e.offsetWidth:n.left,n.top),e.style.left=n.x+"px",e.style.top=n.y+"px"},t.FieldTextInput.prototype.isTabNavigable=function(){return!0},t.FieldTextInput.prototype.getText_=function(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null},t.FieldTextInput.prototype.getEditorText_=function(t){return String(t)},t.FieldTextInput.prototype.getValueFromEditorText_=function(t){return t},t.fieldRegistry.register("field_input",t.FieldTextInput),t.FieldAngle=function(e,n,i){this.clockwise_=t.FieldAngle.CLOCKWISE,this.offset_=t.FieldAngle.OFFSET,this.wrap_=t.FieldAngle.WRAP,this.round_=t.FieldAngle.ROUND,t.FieldAngle.superClass_.constructor.call(this,e,n,i),this.moveSurfaceWrapper_=this.clickSurfaceWrapper_=this.clickWrapper_=this.line_=this.gauge_=this.editor_=null},t.utils.object.inherits(t.FieldAngle,t.FieldTextInput),t.FieldAngle.prototype.DEFAULT_VALUE=0,t.FieldAngle.fromJson=function(e){return new t.FieldAngle(e.angle,void 0,e)},t.FieldAngle.prototype.SERIALIZABLE=!0,t.FieldAngle.ROUND=15,t.FieldAngle.HALF=50,t.FieldAngle.CLOCKWISE=!1,t.FieldAngle.OFFSET=0,t.FieldAngle.WRAP=360,t.FieldAngle.RADIUS=t.FieldAngle.HALF-1,t.FieldAngle.prototype.configure_=function(e){switch(t.FieldAngle.superClass_.configure_.call(this,e),e.mode){case"compass":this.clockwise_=!0,this.offset_=90;break;case"protractor":this.clockwise_=!1,this.offset_=0}var n=e.clockwise;"boolean"==typeof n&&(this.clockwise_=n),null!=(n=e.offset)&&(n=Number(n),isNaN(n)||(this.offset_=n)),null!=(n=e.wrap)&&(n=Number(n),isNaN(n)||(this.wrap_=n)),null!=(e=e.round)&&(e=Number(e),isNaN(e)||(this.round_=e))},t.FieldAngle.prototype.initView=function(){t.FieldAngle.superClass_.initView.call(this),this.symbol_=t.utils.dom.createSvgElement(t.utils.Svg.TSPAN,{},null),this.symbol_.appendChild(document.createTextNode("°")),this.textElement_.appendChild(this.symbol_)},t.FieldAngle.prototype.render_=function(){t.FieldAngle.superClass_.render_.call(this),this.updateGraph_()},t.FieldAngle.prototype.showEditor_=function(e){t.FieldAngle.superClass_.showEditor_.call(this,e,t.utils.userAgent.MOBILE||t.utils.userAgent.ANDROID||t.utils.userAgent.IPAD),this.dropdownCreate_(),t.DropDownDiv.getContentDiv().appendChild(this.editor_),t.DropDownDiv.setColour(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary),t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.updateGraph_()},t.FieldAngle.prototype.dropdownCreate_=function(){var e=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",height:2*t.FieldAngle.HALF+"px",width:2*t.FieldAngle.HALF+"px",style:"touch-action: none"},null),n=t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{cx:t.FieldAngle.HALF,cy:t.FieldAngle.HALF,r:t.FieldAngle.RADIUS,class:"blocklyAngleCircle"},e);this.gauge_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyAngleGauge"},e),this.line_=t.utils.dom.createSvgElement(t.utils.Svg.LINE,{x1:t.FieldAngle.HALF,y1:t.FieldAngle.HALF,class:"blocklyAngleLine"},e);for(var i=0;360>i;i+=15)t.utils.dom.createSvgElement(t.utils.Svg.LINE,{x1:t.FieldAngle.HALF+t.FieldAngle.RADIUS,y1:t.FieldAngle.HALF,x2:t.FieldAngle.HALF+t.FieldAngle.RADIUS-(0==i%45?10:5),y2:t.FieldAngle.HALF,class:"blocklyAngleMarks",transform:"rotate("+i+","+t.FieldAngle.HALF+","+t.FieldAngle.HALF+")"},e);this.clickWrapper_=t.browserEvents.conditionalBind(e,"click",this,this.hide_),this.clickSurfaceWrapper_=t.browserEvents.conditionalBind(n,"click",this,this.onMouseMove_,!0,!0),this.moveSurfaceWrapper_=t.browserEvents.conditionalBind(n,"mousemove",this,this.onMouseMove_,!0,!0),this.editor_=e},t.FieldAngle.prototype.dropdownDispose_=function(){this.clickWrapper_&&(t.browserEvents.unbind(this.clickWrapper_),this.clickWrapper_=null),this.clickSurfaceWrapper_&&(t.browserEvents.unbind(this.clickSurfaceWrapper_),this.clickSurfaceWrapper_=null),this.moveSurfaceWrapper_&&(t.browserEvents.unbind(this.moveSurfaceWrapper_),this.moveSurfaceWrapper_=null),this.line_=this.gauge_=null},t.FieldAngle.prototype.hide_=function(){t.DropDownDiv.hideIfOwner(this),t.WidgetDiv.hide()},t.FieldAngle.prototype.onMouseMove_=function(e){var n=this.gauge_.ownerSVGElement.getBoundingClientRect(),i=e.clientX-n.left-t.FieldAngle.HALF;e=e.clientY-n.top-t.FieldAngle.HALF,n=Math.atan(-e/i),isNaN(n)||(n=t.utils.math.toDegrees(n),0>i?n+=180:0<e&&(n+=360),n=this.clockwise_?this.offset_+360-n:360-(this.offset_-n),this.displayMouseOrKeyboardValue_(n))},t.FieldAngle.prototype.displayMouseOrKeyboardValue_=function(t){this.round_&&(t=Math.round(t/this.round_)*this.round_),(t=this.wrapValue_(t))!=this.value_&&this.setEditorValue_(t)},t.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var e=Number(this.getText())+this.offset_,n=t.utils.math.toRadians(e%360);e=["M ",t.FieldAngle.HALF,",",t.FieldAngle.HALF];var i=t.FieldAngle.HALF,r=t.FieldAngle.HALF;if(!isNaN(n)){var o=Number(this.clockwise_),s=t.utils.math.toRadians(this.offset_),a=Math.cos(s)*t.FieldAngle.RADIUS,l=Math.sin(s)*-t.FieldAngle.RADIUS;o&&(n=2*s-n),i+=Math.cos(n)*t.FieldAngle.RADIUS,r-=Math.sin(n)*t.FieldAngle.RADIUS,n=Math.abs(Math.floor((n-s)/Math.PI)%2),o&&(n=1-n),e.push(" l ",a,",",l," A ",t.FieldAngle.RADIUS,",",t.FieldAngle.RADIUS," 0 ",n," ",o," ",i,",",r," z")}this.gauge_.setAttribute("d",e.join("")),this.line_.setAttribute("x2",i),this.line_.setAttribute("y2",r)}},t.FieldAngle.prototype.onHtmlInputKeyDown_=function(e){var n;if(t.FieldAngle.superClass_.onHtmlInputKeyDown_.call(this,e),e.keyCode===t.utils.KeyCodes.LEFT?n=this.sourceBlock_.RTL?1:-1:e.keyCode===t.utils.KeyCodes.RIGHT?n=this.sourceBlock_.RTL?-1:1:e.keyCode===t.utils.KeyCodes.DOWN?n=-1:e.keyCode===t.utils.KeyCodes.UP&&(n=1),n){var i=this.getValue();this.displayMouseOrKeyboardValue_(i+n*this.round_),e.preventDefault(),e.stopPropagation()}},t.FieldAngle.prototype.doClassValidation_=function(t){return t=Number(t),isNaN(t)||!isFinite(t)?null:this.wrapValue_(t)},t.FieldAngle.prototype.wrapValue_=function(t){return 0>(t%=360)&&(t+=360),t>this.wrap_&&(t-=360),t},t.Css.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")),t.fieldRegistry.register("field_angle",t.FieldAngle),t.FieldCheckbox=function(e,n,i){this.checkChar_=null,t.FieldCheckbox.superClass_.constructor.call(this,e,n,i)},t.utils.object.inherits(t.FieldCheckbox,t.Field),t.FieldCheckbox.prototype.DEFAULT_VALUE=!1,t.FieldCheckbox.fromJson=function(e){return new t.FieldCheckbox(e.checked,void 0,e)},t.FieldCheckbox.CHECK_CHAR="✓",t.FieldCheckbox.prototype.SERIALIZABLE=!0,t.FieldCheckbox.prototype.CURSOR="default",t.FieldCheckbox.prototype.configure_=function(e){t.FieldCheckbox.superClass_.configure_.call(this,e),e.checkCharacter&&(this.checkChar_=e.checkCharacter)},t.FieldCheckbox.prototype.initView=function(){t.FieldCheckbox.superClass_.initView.call(this),t.utils.dom.addClass(this.textElement_,"blocklyCheckbox"),this.textElement_.style.display=this.value_?"block":"none"},t.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)},t.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||t.FieldCheckbox.CHECK_CHAR},t.FieldCheckbox.prototype.setCheckCharacter=function(t){this.checkChar_=t,this.forceRerender()},t.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)},t.FieldCheckbox.prototype.doClassValidation_=function(t){return!0===t||"TRUE"===t?"TRUE":!1===t||"FALSE"===t?"FALSE":null},t.FieldCheckbox.prototype.doValueUpdate_=function(t){this.value_=this.convertValueToBool_(t),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")},t.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"},t.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_},t.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))},t.FieldCheckbox.prototype.convertValueToBool_=function(t){return"string"==typeof t?"TRUE"==t:!!t},t.fieldRegistry.register("field_checkbox",t.FieldCheckbox),t.FieldColour=function(e,n,i){t.FieldColour.superClass_.constructor.call(this,e,n,i),this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null},t.utils.object.inherits(t.FieldColour,t.Field),t.FieldColour.fromJson=function(e){return new t.FieldColour(e.colour,void 0,e)},t.FieldColour.prototype.SERIALIZABLE=!0,t.FieldColour.prototype.CURSOR="default",t.FieldColour.prototype.isDirty_=!1,t.FieldColour.prototype.colours_=null,t.FieldColour.prototype.titles_=null,t.FieldColour.prototype.columns_=0,t.FieldColour.prototype.configure_=function(e){t.FieldColour.superClass_.configure_.call(this,e),e.colourOptions&&(this.colours_=e.colourOptions,this.titles_=e.colourTitles),e.columns&&(this.columns_=e.columns)},t.FieldColour.prototype.initView=function(){this.size_=new t.utils.Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")},t.FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())},t.FieldColour.prototype.doClassValidation_=function(e){return"string"!=typeof e?null:t.utils.colour.parse(e)},t.FieldColour.prototype.doValueUpdate_=function(t){this.value_=t,this.borderRect_?this.borderRect_.style.fill=t:this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",t),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))},t.FieldColour.prototype.getText=function(){var t=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(t)&&(t="#"+t[1]+t[3]+t[5]),t},t.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "),t.FieldColour.prototype.DEFAULT_VALUE=t.FieldColour.COLOURS[0],t.FieldColour.TITLES=[],t.FieldColour.COLUMNS=7,t.FieldColour.prototype.setColours=function(t,e){return this.colours_=t,e&&(this.titles_=e),this},t.FieldColour.prototype.setColumns=function(t){return this.columns_=t,this},t.FieldColour.prototype.showEditor_=function(){this.dropdownCreate_(),t.DropDownDiv.getContentDiv().appendChild(this.picker_),t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.picker_.focus({preventScroll:!0})},t.FieldColour.prototype.onClick_=function(e){null!==(e=(e=e.target)&&e.label)&&(this.setValue(e),t.DropDownDiv.hideIfOwner(this))},t.FieldColour.prototype.onKeyDown_=function(e){var n=!1;e.keyCode===t.utils.KeyCodes.UP?(this.moveHighlightBy_(0,-1),n=!0):e.keyCode===t.utils.KeyCodes.DOWN?(this.moveHighlightBy_(0,1),n=!0):e.keyCode===t.utils.KeyCodes.LEFT?(this.moveHighlightBy_(-1,0),n=!0):e.keyCode===t.utils.KeyCodes.RIGHT?(this.moveHighlightBy_(1,0),n=!0):e.keyCode===t.utils.KeyCodes.ENTER&&((n=this.getHighlighted_())&&(null!==(n=n&&n.label)&&this.setValue(n)),t.DropDownDiv.hideWithoutAnimation(),n=!0),n&&e.stopPropagation()},t.FieldColour.prototype.moveHighlightBy_=function(e,n){var i=this.colours_||t.FieldColour.COLOURS,r=this.columns_||t.FieldColour.COLUMNS,o=this.highlightedIndex_%r,s=Math.floor(this.highlightedIndex_/r);o+=e,s+=n,0>e?0>o&&0<s?(o=r-1,s--):0>o&&(o=0):0<e?o>r-1&&s<Math.floor(i.length/r)-1?(o=0,s++):o>r-1&&o--:0>n?0>s&&(s=0):0<n&&s>Math.floor(i.length/r)-1&&(s=Math.floor(i.length/r)-1),this.setHighlightedCell_(this.picker_.childNodes[s].childNodes[o],s*r+o)},t.FieldColour.prototype.onMouseMove_=function(t){var e=(t=t.target)&&Number(t.getAttribute("data-index"));null!==e&&e!==this.highlightedIndex_&&this.setHighlightedCell_(t,e)},t.FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})},t.FieldColour.prototype.onMouseLeave_=function(){this.picker_.blur();var e=this.getHighlighted_();e&&t.utils.dom.removeClass(e,"blocklyColourHighlighted")},t.FieldColour.prototype.getHighlighted_=function(){var e=this.columns_||t.FieldColour.COLUMNS,n=this.picker_.childNodes[Math.floor(this.highlightedIndex_/e)];return n?n.childNodes[this.highlightedIndex_%e]:null},t.FieldColour.prototype.setHighlightedCell_=function(e,n){var i=this.getHighlighted_();i&&t.utils.dom.removeClass(i,"blocklyColourHighlighted"),t.utils.dom.addClass(e,"blocklyColourHighlighted"),this.highlightedIndex_=n,t.utils.aria.setState(this.picker_,t.utils.aria.State.ACTIVEDESCENDANT,e.getAttribute("id"))},t.FieldColour.prototype.dropdownCreate_=function(){var e=this.columns_||t.FieldColour.COLUMNS,n=this.colours_||t.FieldColour.COLOURS,i=this.titles_||t.FieldColour.TITLES,r=this.getValue(),o=document.createElement("table");o.className="blocklyColourTable",o.tabIndex=0,o.dir="ltr",t.utils.aria.setRole(o,t.utils.aria.Role.GRID),t.utils.aria.setState(o,t.utils.aria.State.EXPANDED,!0),t.utils.aria.setState(o,t.utils.aria.State.ROWCOUNT,Math.floor(n.length/e)),t.utils.aria.setState(o,t.utils.aria.State.COLCOUNT,e);for(var s,a=0;a<n.length;a++){0==a%e&&(s=document.createElement("tr"),t.utils.aria.setRole(s,t.utils.aria.Role.ROW),o.appendChild(s));var l=document.createElement("td");s.appendChild(l),l.label=n[a],l.title=i[a]||n[a],l.id=t.utils.IdGenerator.getNextUniqueId(),l.setAttribute("data-index",a),t.utils.aria.setRole(l,t.utils.aria.Role.GRIDCELL),t.utils.aria.setState(l,t.utils.aria.State.LABEL,n[a]),t.utils.aria.setState(l,t.utils.aria.State.SELECTED,n[a]==r),l.style.backgroundColor=n[a],n[a]==r&&(l.className="blocklyColourSelected",this.highlightedIndex_=a)}this.onClickWrapper_=t.browserEvents.conditionalBind(o,"click",this,this.onClick_,!0),this.onMouseMoveWrapper_=t.browserEvents.conditionalBind(o,"mousemove",this,this.onMouseMove_,!0),this.onMouseEnterWrapper_=t.browserEvents.conditionalBind(o,"mouseenter",this,this.onMouseEnter_,!0),this.onMouseLeaveWrapper_=t.browserEvents.conditionalBind(o,"mouseleave",this,this.onMouseLeave_,!0),this.onKeyDownWrapper_=t.browserEvents.conditionalBind(o,"keydown",this,this.onKeyDown_),this.picker_=o},t.FieldColour.prototype.dropdownDispose_=function(){this.onClickWrapper_&&(t.browserEvents.unbind(this.onClickWrapper_),this.onClickWrapper_=null),this.onMouseMoveWrapper_&&(t.browserEvents.unbind(this.onMouseMoveWrapper_),this.onMouseMoveWrapper_=null),this.onMouseEnterWrapper_&&(t.browserEvents.unbind(this.onMouseEnterWrapper_),this.onMouseEnterWrapper_=null),this.onMouseLeaveWrapper_&&(t.browserEvents.unbind(this.onMouseLeaveWrapper_),this.onMouseLeaveWrapper_=null),this.onKeyDownWrapper_&&(t.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.highlightedIndex_=this.picker_=null},t.Css.register([".blocklyColourTable {","border-collapse: collapse;","display: block;","outline: none;","padding: 1px;","}",".blocklyColourTable>tr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]),t.fieldRegistry.register("field_colour",t.FieldColour),t.FieldDropdown=function(e,n,i){"function"!=typeof e&&t.FieldDropdown.validateOptions_(e),this.menuGenerator_=e,this.suffixField=this.prefixField=this.generatedOptions_=null,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],t.FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],n,i),this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null},t.utils.object.inherits(t.FieldDropdown,t.Field),t.FieldDropdown.fromJson=function(e){return new t.FieldDropdown(e.options,void 0,e)},t.FieldDropdown.prototype.fromXml=function(t){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(t.textContent)},t.FieldDropdown.prototype.SERIALIZABLE=!0,t.FieldDropdown.CHECKMARK_OVERHANG=25,t.FieldDropdown.MAX_MENU_HEIGHT_VH=.45,t.FieldDropdown.IMAGE_Y_OFFSET=5,t.FieldDropdown.IMAGE_Y_PADDING=2*t.FieldDropdown.IMAGE_Y_OFFSET,t.FieldDropdown.ARROW_CHAR=t.utils.userAgent.ANDROID?"▼":"▾",t.FieldDropdown.prototype.CURSOR="default",t.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&t.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")},t.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()},t.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=t.utils.dom.createSvgElement(t.utils.Svg.TSPAN,{},this.textElement_),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?t.FieldDropdown.ARROW_CHAR+" ":" "+t.FieldDropdown.ARROW_CHAR)),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)},t.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)},t.FieldDropdown.prototype.showEditor_=function(e){if(this.dropdownCreate_(),this.menu_.openingCoords=e&&"number"==typeof e.clientX?new t.utils.Coordinate(e.clientX,e.clientY):null,this.menu_.render(t.DropDownDiv.getContentDiv()),e=this.menu_.getElement(),t.utils.dom.addClass(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){e=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();var n=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;t.DropDownDiv.setColour(e,n)}t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_),this.applyColour()},t.FieldDropdown.prototype.dropdownCreate_=function(){var e=new t.Menu;e.setRole(t.utils.aria.Role.LISTBOX),this.menu_=e;var n=this.getOptions(!1);this.selectedMenuItem_=null;for(var i=0;i<n.length;i++){var r=n[i][0],o=n[i][1];if("object"==typeof r){var s=new Image(r.width,r.height);s.src=r.src,s.alt=r.alt||"",r=s}(r=new t.MenuItem(r,o)).setRole(t.utils.aria.Role.OPTION),r.setRightToLeft(this.sourceBlock_.RTL),r.setCheckable(!0),e.addChild(r),r.setChecked(o==this.value_),o==this.value_&&(this.selectedMenuItem_=r),r.onAction(this.handleMenuActionEvent_,this)}},t.FieldDropdown.prototype.dropdownDispose_=function(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem_=this.menu_=null,this.applyColour()},t.FieldDropdown.prototype.handleMenuActionEvent_=function(e){t.DropDownDiv.hideIfOwner(this,!0),this.onItemSelected_(this.menu_,e)},t.FieldDropdown.prototype.onItemSelected_=function(t,e){this.setValue(e.getValue())},t.FieldDropdown.prototype.trimOptions_=function(){var e=this.menuGenerator_;if(Array.isArray(e)){for(var n=!1,i=0;i<e.length;i++){var r=e[i][0];"string"==typeof r?e[i][0]=t.utils.replaceMessageReferences(r):(null!=r.alt&&(e[i][0].alt=t.utils.replaceMessageReferences(r.alt)),n=!0)}if(!(n||2>e.length)){for(n=[],i=0;i<e.length;i++)n.push(e[i][0]);i=t.utils.string.shortestStringLength(n),r=t.utils.string.commonWordPrefix(n,i);var o=t.utils.string.commonWordSuffix(n,i);!r&&!o||i<=r+o||(r&&(this.prefixField=n[0].substring(0,r-1)),o&&(this.suffixField=n[0].substr(1-o)),this.menuGenerator_=t.FieldDropdown.applyTrim_(e,r,o))}}},t.FieldDropdown.applyTrim_=function(t,e,n){for(var i=[],r=0;r<t.length;r++){var o=t[r][0],s=t[r][1];o=o.substring(e,o.length-n),i[r]=[o,s]}return i},t.FieldDropdown.prototype.isOptionListDynamic=function(){return"function"==typeof this.menuGenerator_},t.FieldDropdown.prototype.getOptions=function(e){return this.isOptionListDynamic()?(this.generatedOptions_&&e||(this.generatedOptions_=this.menuGenerator_.call(this),t.FieldDropdown.validateOptions_(this.generatedOptions_)),this.generatedOptions_):this.menuGenerator_},t.FieldDropdown.prototype.doClassValidation_=function(t){for(var e,n=!1,i=this.getOptions(!0),r=0;e=i[r];r++)if(e[1]==t){n=!0;break}return n?t:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+t),null)},t.FieldDropdown.prototype.doValueUpdate_=function(e){t.FieldDropdown.superClass_.doValueUpdate_.call(this,e),e=this.getOptions(!0);for(var n,i=0;n=e[i];i++)n[1]==this.value_&&(this.selectedOption_=n)},t.FieldDropdown.prototype.applyColour=function(){this.borderRect_&&(this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary),this.menu_?this.borderRect_.setAttribute("fill",this.sourceBlock_.style.colourTertiary):this.borderRect_.setAttribute("fill","transparent")),this.sourceBlock_&&this.arrow_&&(this.sourceBlock_.isShadow()?this.arrow_.style.fill=this.sourceBlock_.style.colourSecondary:this.arrow_.style.fill=this.sourceBlock_.style.colourPrimary)},t.FieldDropdown.prototype.render_=function(){this.textContent_.nodeValue="",this.imageElement_.style.display="none";var t=this.selectedOption_&&this.selectedOption_[0];t&&"object"==typeof t?this.renderSelectedImage_(t):this.renderSelectedText_(),this.positionBorderRect_()},t.FieldDropdown.prototype.renderSelectedImage_=function(e){this.imageElement_.style.display="",this.imageElement_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",e.src),this.imageElement_.setAttribute("height",e.height),this.imageElement_.setAttribute("width",e.width);var n=Number(e.height);e=Number(e.width);var i=!!this.borderRect_,r=Math.max(i?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,n+t.FieldDropdown.IMAGE_Y_PADDING);i=i?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var o=this.svgArrow_?this.positionSVGArrow_(e+i,r/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):t.utils.dom.getFastTextWidth(this.arrow_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);this.size_.width=e+o+2*i,this.size_.height=r;var s=0;this.sourceBlock_.RTL?this.imageElement_.setAttribute("x",i+o):(s=e+o,this.textElement_.setAttribute("text-anchor","end"),this.imageElement_.setAttribute("x",i)),this.imageElement_.setAttribute("y",r/2-n/2),this.positionTextElement_(s+i,e+o)},t.FieldDropdown.prototype.renderSelectedText_=function(){this.textContent_.nodeValue=this.getDisplayText_(),t.utils.dom.addClass(this.textElement_,"blocklyDropdownText"),this.textElement_.setAttribute("text-anchor","start");var e=!!this.borderRect_,n=Math.max(e?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT),i=t.utils.dom.getFastTextWidth(this.textElement_,this.getConstants().FIELD_TEXT_FONTSIZE,this.getConstants().FIELD_TEXT_FONTWEIGHT,this.getConstants().FIELD_TEXT_FONTFAMILY);e=e?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var r=0;this.svgArrow_&&(r=this.positionSVGArrow_(i+e,n/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_.width=i+r+2*e,this.size_.height=n,this.positionTextElement_(e,i)},t.FieldDropdown.prototype.positionSVGArrow_=function(t,e){if(!this.svgArrow_)return 0;var n=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,i=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,r=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow_.setAttribute("transform","translate("+(this.sourceBlock_.RTL?n:t+i)+","+e+")"),r+i},t.FieldDropdown.prototype.getText_=function(){if(!this.selectedOption_)return null;var t=this.selectedOption_[0];return"object"==typeof t?t.alt:t},t.FieldDropdown.validateOptions_=function(t){if(!Array.isArray(t))throw TypeError("FieldDropdown options must be an array.");if(!t.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var e=!1,n=0;n<t.length;++n){var i=t[n];Array.isArray(i)?"string"!=typeof i[1]?(e=!0,console.error("Invalid option["+n+"]: Each FieldDropdown option id must be a string. Found "+i[1]+" in: ",i)):i[0]&&"string"!=typeof i[0]&&"string"!=typeof i[0].src&&(e=!0,console.error("Invalid option["+n+"]: Each FieldDropdown option must have a string label or image description. Found"+i[0]+" in: ",i)):(e=!0,console.error("Invalid option["+n+"]: Each FieldDropdown option must be an array. Found: ",i))}if(e)throw TypeError("Found invalid FieldDropdown options.")},t.fieldRegistry.register("field_dropdown",t.FieldDropdown),t.FieldLabelSerializable=function(e,n,i){t.FieldLabelSerializable.superClass_.constructor.call(this,e,n,i)},t.utils.object.inherits(t.FieldLabelSerializable,t.FieldLabel),t.FieldLabelSerializable.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldLabelSerializable(n,void 0,e)},t.FieldLabelSerializable.prototype.EDITABLE=!1,t.FieldLabelSerializable.prototype.SERIALIZABLE=!0,t.fieldRegistry.register("field_label_serializable",t.FieldLabelSerializable),t.FieldImage=function(e,n,i,r,o,s,a){if(!e)throw Error("Src value of an image field is required");if(e=t.utils.replaceMessageReferences(e),i=Number(t.utils.replaceMessageReferences(i)),n=Number(t.utils.replaceMessageReferences(n)),isNaN(i)||isNaN(n))throw Error("Height and width values of an image field must cast to numbers.");if(0>=i||0>=n)throw Error("Height and width values of an image field must be greater than 0.");this.flipRtl_=!1,this.altText_="",t.FieldImage.superClass_.constructor.call(this,e,null,a),a||(this.flipRtl_=!!s,this.altText_=t.utils.replaceMessageReferences(r)||""),this.size_=new t.utils.Size(n,i+t.FieldImage.Y_PADDING),this.imageHeight_=i,this.clickHandler_=null,"function"==typeof o&&(this.clickHandler_=o),this.imageElement_=null},t.utils.object.inherits(t.FieldImage,t.Field),t.FieldImage.prototype.DEFAULT_VALUE="",t.FieldImage.fromJson=function(e){return new t.FieldImage(e.src,e.width,e.height,void 0,void 0,void 0,e)},t.FieldImage.Y_PADDING=1,t.FieldImage.prototype.EDITABLE=!1,t.FieldImage.prototype.isDirty_=!1,t.FieldImage.prototype.configure_=function(e){t.FieldImage.superClass_.configure_.call(this,e),this.flipRtl_=!!e.flipRtl,this.altText_=t.utils.replaceMessageReferences(e.alt)||""},t.FieldImage.prototype.initView=function(){this.imageElement_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_),this.imageElement_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.value_),this.clickHandler_&&(this.imageElement_.style.cursor="pointer")},t.FieldImage.prototype.updateSize_=function(){},t.FieldImage.prototype.doClassValidation_=function(t){return"string"!=typeof t?null:t},t.FieldImage.prototype.doValueUpdate_=function(e){this.value_=e,this.imageElement_&&this.imageElement_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",String(this.value_))},t.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_},t.FieldImage.prototype.setAlt=function(t){t!=this.altText_&&(this.altText_=t||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))},t.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)},t.FieldImage.prototype.setOnClickHandler=function(t){this.clickHandler_=t},t.FieldImage.prototype.getText_=function(){return this.altText_},t.fieldRegistry.register("field_image",t.FieldImage),t.FieldMultilineInput=function(e,n,i){t.FieldMultilineInput.superClass_.constructor.call(this,e,n,i),this.textGroup_=null,this.maxLines_=1/0,this.isOverflowedY_=!1},t.utils.object.inherits(t.FieldMultilineInput,t.FieldTextInput),t.FieldMultilineInput.prototype.configure_=function(e){t.FieldMultilineInput.superClass_.configure_.call(this,e),e.maxLines&&this.setMaxLines(e.maxLines)},t.FieldMultilineInput.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldMultilineInput(n,void 0,e)},t.FieldMultilineInput.prototype.toXml=function(t){return t.textContent=this.getValue().replace(/\n/g,"&#10;"),t},t.FieldMultilineInput.prototype.fromXml=function(t){this.setValue(t.textContent.replace(/&#10;/g,"\n"))},t.FieldMultilineInput.prototype.initView=function(){this.createBorderRect_(),this.textGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyEditableText"},this.fieldGroup_)},t.FieldMultilineInput.prototype.getDisplayText_=function(){var e=this.getText();if(!e)return t.Field.NBSP;var n=e.split("\n");e="";for(var i=this.isOverflowedY_?this.maxLines_:n.length,r=0;r<i;r++){var o=n[r];o.length>this.maxDisplayLength?o=o.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&r===i-1&&(o=o.substring(0,o.length-3)+"..."),e+=o=o.replace(/\s/g,t.Field.NBSP),r!==i-1&&(e+="\n")}return this.sourceBlock_.RTL&&(e+="‏"),e},t.FieldMultilineInput.prototype.doValueUpdate_=function(e){t.FieldMultilineInput.superClass_.doValueUpdate_.call(this,e),this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_},t.FieldMultilineInput.prototype.render_=function(){for(var e;e=this.textGroup_.firstChild;)this.textGroup_.removeChild(e);e=this.getDisplayText_().split("\n");for(var n=0,i=0;i<e.length;i++){var r=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING;t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText",x:this.getConstants().FIELD_BORDER_RECT_X_PADDING,y:n+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,dy:this.getConstants().FIELD_TEXT_BASELINE},this.textGroup_).appendChild(document.createTextNode(e[i])),n+=r}this.isBeingEdited_&&(e=this.htmlInput_,this.isOverflowedY_?t.utils.dom.addClass(e,"blocklyHtmlTextAreaInputOverflowedY"):t.utils.dom.removeClass(e,"blocklyHtmlTextAreaInputOverflowedY")),this.updateSize_(),this.isBeingEdited_&&(this.sourceBlock_.RTL?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),e=this.htmlInput_,this.isTextValid_?(t.utils.dom.removeClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!1)):(t.utils.dom.addClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!0)))},t.FieldMultilineInput.prototype.updateSize_=function(){for(var e=this.textGroup_.childNodes,n=0,i=0,r=0;r<e.length;r++){var o=t.utils.dom.getTextWidth(e[r]);o>n&&(n=o),i+=this.getConstants().FIELD_TEXT_HEIGHT+(0<r?this.getConstants().FIELD_BORDER_RECT_Y_PADDING:0)}if(this.isBeingEdited_){e=this.value_.split("\n"),o=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText blocklyMultilineText"});var s=this.getConstants().FIELD_TEXT_FONTSIZE,a=this.getConstants().FIELD_TEXT_FONTWEIGHT,l=this.getConstants().FIELD_TEXT_FONTFAMILY;for(r=0;r<e.length;r++){e[r].length>this.maxDisplayLength&&(e[r]=e[r].substring(0,this.maxDisplayLength)),o.textContent=e[r];var u=t.utils.dom.getFastTextWidth(o,s,a,l);u>n&&(n=u)}n+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(i+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,n+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",n),this.borderRect_.setAttribute("height",i)),this.size_.width=n,this.size_.height=i,this.positionBorderRect_()},t.FieldMultilineInput.prototype.showEditor_=function(e,n){t.FieldMultilineInput.superClass_.showEditor_.call(this,e,n),this.forceRerender()},t.FieldMultilineInput.prototype.widgetCreate_=function(){var e=t.WidgetDiv.DIV,n=this.workspace_.getScale(),i=document.createElement("textarea");i.className="blocklyHtmlInput blocklyHtmlTextAreaInput",i.setAttribute("spellcheck",this.spellcheck_);var r=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";e.style.fontSize=r,i.style.fontSize=r,i.style.borderRadius=t.FieldTextInput.BORDERRADIUS*n+"px",r=this.getConstants().FIELD_BORDER_RECT_X_PADDING*n;var o=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*n/2;return i.style.padding=o+"px "+r+"px "+o+"px "+r+"px",r=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,i.style.lineHeight=r*n+"px",e.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.untypedDefaultValue_=this.value_,i.oldValue_=null,t.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(i),i},t.FieldMultilineInput.prototype.setMaxLines=function(t){"number"==typeof t&&0<t&&t!==this.maxLines_&&(this.maxLines_=t,this.forceRerender())},t.FieldMultilineInput.prototype.getMaxLines=function(){return this.maxLines_},t.FieldMultilineInput.prototype.onHtmlInputKeyDown_=function(e){e.keyCode!==t.utils.KeyCodes.ENTER&&t.FieldMultilineInput.superClass_.onHtmlInputKeyDown_.call(this,e)},t.Css.register(".blocklyHtmlTextAreaInput {,font-family: monospace;,resize: none;,overflow: hidden;,height: 100%;,text-align: left;,},.blocklyHtmlTextAreaInputOverflowedY {,overflow-y: scroll;,}".split(",")),t.fieldRegistry.register("field_multilinetext",t.FieldMultilineInput),t.FieldNumber=function(e,n,i,r,o,s){this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces_=null,t.FieldNumber.superClass_.constructor.call(this,e,o,s),s||this.setConstraints(n,i,r)},t.utils.object.inherits(t.FieldNumber,t.FieldTextInput),t.FieldNumber.prototype.DEFAULT_VALUE=0,t.FieldNumber.fromJson=function(e){return new t.FieldNumber(e.value,void 0,void 0,void 0,void 0,e)},t.FieldNumber.prototype.SERIALIZABLE=!0,t.FieldNumber.prototype.configure_=function(e){t.FieldNumber.superClass_.configure_.call(this,e),this.setMinInternal_(e.min),this.setMaxInternal_(e.max),this.setPrecisionInternal_(e.precision)},t.FieldNumber.prototype.setConstraints=function(t,e,n){this.setMinInternal_(t),this.setMaxInternal_(e),this.setPrecisionInternal_(n),this.setValue(this.getValue())},t.FieldNumber.prototype.setMin=function(t){this.setMinInternal_(t),this.setValue(this.getValue())},t.FieldNumber.prototype.setMinInternal_=function(t){null==t?this.min_=-1/0:(t=Number(t),isNaN(t)||(this.min_=t))},t.FieldNumber.prototype.getMin=function(){return this.min_},t.FieldNumber.prototype.setMax=function(t){this.setMaxInternal_(t),this.setValue(this.getValue())},t.FieldNumber.prototype.setMaxInternal_=function(t){null==t?this.max_=1/0:(t=Number(t),isNaN(t)||(this.max_=t))},t.FieldNumber.prototype.getMax=function(){return this.max_},t.FieldNumber.prototype.setPrecision=function(t){this.setPrecisionInternal_(t),this.setValue(this.getValue())},t.FieldNumber.prototype.setPrecisionInternal_=function(t){this.precision_=Number(t)||0;var e=String(this.precision_);-1!=e.indexOf("e")&&(e=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));var n=e.indexOf(".");this.decimalPlaces_=-1==n?t?0:null:e.length-n-1},t.FieldNumber.prototype.getPrecision=function(){return this.precision_},t.FieldNumber.prototype.doClassValidation_=function(t){return null===t?null:(t=(t=(t=(t=String(t)).replace(/O/gi,"0")).replace(/,/g,"")).replace(/infinity/i,"Infinity"),t=Number(t||0),isNaN(t)?null:(t=Math.min(Math.max(t,this.min_),this.max_),this.precision_&&isFinite(t)&&(t=Math.round(t/this.precision_)*this.precision_),null!=this.decimalPlaces_&&(t=Number(t.toFixed(this.decimalPlaces_))),t))},t.FieldNumber.prototype.widgetCreate_=function(){var e=t.FieldNumber.superClass_.widgetCreate_.call(this);return-1/0<this.min_&&t.utils.aria.setState(e,t.utils.aria.State.VALUEMIN,this.min_),1/0>this.max_&&t.utils.aria.setState(e,t.utils.aria.State.VALUEMAX,this.max_),e},t.fieldRegistry.register("field_number",t.FieldNumber),t.FieldVariable=function(e,n,i,r,o){this.menuGenerator_=t.FieldVariable.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new t.utils.Size(0,0),o&&this.configure_(o),n&&this.setValidator(n),o||this.setTypes_(i,r)},t.utils.object.inherits(t.FieldVariable,t.FieldDropdown),t.FieldVariable.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.variable);return new t.FieldVariable(n,void 0,void 0,void 0,e)},t.FieldVariable.prototype.SERIALIZABLE=!0,t.FieldVariable.prototype.configure_=function(e){t.FieldVariable.superClass_.configure_.call(this,e),this.setTypes_(e.variableTypes,e.defaultType)},t.FieldVariable.prototype.initModel=function(){if(!this.variable_){var e=t.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(e.getId())}},t.FieldVariable.prototype.shouldAddBorderRect_=function(){return t.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)},t.FieldVariable.prototype.fromXml=function(e){var n=e.getAttribute("id"),i=e.textContent,r=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(n=t.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,n,i,r),null!=r&&r!==n.type)throw Error("Serialized variable type with id '"+n.getId()+"' had type "+n.type+", and does not match variable field that references it: "+t.Xml.domToText(e)+".");this.setValue(n.getId())},t.FieldVariable.prototype.toXml=function(t){return this.initModel(),t.id=this.variable_.getId(),t.textContent=this.variable_.name,this.variable_.type&&t.setAttribute("variabletype",this.variable_.type),t},t.FieldVariable.prototype.setSourceBlock=function(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");t.FieldVariable.superClass_.setSourceBlock.call(this,e)},t.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null},t.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""},t.FieldVariable.prototype.getVariable=function(){return this.variable_},t.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null},t.FieldVariable.prototype.doClassValidation_=function(e){if(null===e)return null;var n=t.Variables.getVariable(this.sourceBlock_.workspace,e);return n?(n=n.type,this.typeIsAllowed_(n)?e:(console.warn("Variable type doesn't match this field! Type was "+n),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)},t.FieldVariable.prototype.doValueUpdate_=function(e){this.variable_=t.Variables.getVariable(this.sourceBlock_.workspace,e),t.FieldVariable.superClass_.doValueUpdate_.call(this,e)},t.FieldVariable.prototype.typeIsAllowed_=function(t){var e=this.getVariableTypes_();if(!e)return!0;for(var n=0;n<e.length;n++)if(t==e[n])return!0;return!1},t.FieldVariable.prototype.getVariableTypes_=function(){var t=this.variableTypes;if(null===t&&this.sourceBlock_&&this.sourceBlock_.workspace)return this.sourceBlock_.workspace.getVariableTypes();if(0==(t=t||[""]).length)throw t=this.getText(),Error("'variableTypes' of field variable "+t+" was an empty list");return t},t.FieldVariable.prototype.setTypes_=function(t,e){if(e=e||"",null==t||void 0==t)t=null;else{if(!Array.isArray(t))throw Error("'variableTypes' was not an array in the definition of a FieldVariable");for(var n=!1,i=0;i<t.length;i++)t[i]==e&&(n=!0);if(!n)throw Error("Invalid default type '"+e+"' in the definition of a FieldVariable")}this.defaultType_=e,this.variableTypes=t},t.FieldVariable.prototype.refreshVariableName=function(){this.forceRerender()},t.FieldVariable.dropdownCreate=function(){if(!this.variable_)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var e=this.getText(),n=[];if(this.sourceBlock_&&this.sourceBlock_.workspace)for(var i=this.getVariableTypes_(),r=0;r<i.length;r++){var o=this.sourceBlock_.workspace.getVariablesOfType(i[r]);n=n.concat(o)}for(n.sort(t.VariableModel.compareByName),i=[],r=0;r<n.length;r++)i[r]=[n[r].name,n[r].getId()];return i.push([t.Msg.RENAME_VARIABLE,t.RENAME_VARIABLE_ID]),t.Msg.DELETE_VARIABLE&&i.push([t.Msg.DELETE_VARIABLE.replace("%1",e),t.DELETE_VARIABLE_ID]),i},t.FieldVariable.prototype.onItemSelected_=function(e,n){if(e=n.getValue(),this.sourceBlock_&&this.sourceBlock_.workspace){if(e==t.RENAME_VARIABLE_ID)return void t.Variables.renameVariable(this.sourceBlock_.workspace,this.variable_);if(e==t.DELETE_VARIABLE_ID)return void this.sourceBlock_.workspace.deleteVariableById(this.variable_.getId())}this.setValue(e)},t.FieldVariable.prototype.referencesVariables=function(){return!0},t.fieldRegistry.register("field_variable",t.FieldVariable),t.utils.svgPaths={},t.utils.svgPaths.point=function(t,e){return" "+t+","+e+" "},t.utils.svgPaths.curve=function(t,e){return" "+t+e.join("")},t.utils.svgPaths.moveTo=function(t,e){return" M "+t+","+e+" "},t.utils.svgPaths.moveBy=function(t,e){return" m "+t+","+e+" "},t.utils.svgPaths.lineTo=function(t,e){return" l "+t+","+e+" "},t.utils.svgPaths.line=function(t){return" l"+t.join("")},t.utils.svgPaths.lineOnAxis=function(t,e){return" "+t+" "+e+" "},t.utils.svgPaths.arc=function(t,e,n,i){return t+" "+n+" "+n+" "+e+i},t.blockRendering.ConstantProvider=function(){this.NO_PADDING=0,this.SMALL_PADDING=3,this.MEDIUM_PADDING=5,this.MEDIUM_LARGE_PADDING=8,this.LARGE_PADDING=10,this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING,this.TAB_HEIGHT=15,this.TAB_OFFSET_FROM_TOP=5,this.TAB_VERTICAL_OVERLAP=2.5,this.TAB_WIDTH=8,this.NOTCH_WIDTH=15,this.NOTCH_HEIGHT=4,this.MIN_BLOCK_WIDTH=12,this.EMPTY_BLOCK_SPACER_HEIGHT=16,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT,this.CORNER_RADIUS=8,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=15,this.STATEMENT_BOTTOM_SPACER=0,this.STATEMENT_INPUT_PADDING_LEFT=20,this.BETWEEN_STATEMENT_PADDING_Y=4,this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.ADD_START_HATS=!1,this.START_HAT_HEIGHT=15,this.START_HAT_WIDTH=100,this.SPACER_DEFAULT_HEIGHT=15,this.MIN_BLOCK_HEIGHT=24,this.EMPTY_INLINE_INPUT_PADDING=14.5,this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11,this.EXTERNAL_VALUE_INPUT_PADDING=2,this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT,this.START_POINT=t.utils.svgPaths.moveBy(0,0),this.JAGGED_TEETH_HEIGHT=12,this.JAGGED_TEETH_WIDTH=6,this.FIELD_TEXT_FONTSIZE=11,this.FIELD_TEXT_FONTWEIGHT="normal",this.FIELD_TEXT_FONTFAMILY="sans-serif",this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1,this.FIELD_BORDER_RECT_RADIUS=4,this.FIELD_BORDER_RECT_HEIGHT=16,this.FIELD_BORDER_RECT_X_PADDING=5,this.FIELD_BORDER_RECT_Y_PADDING=3,this.FIELD_BORDER_RECT_COLOUR="#fff",this.FIELD_TEXT_BASELINE_CENTER=!t.utils.userAgent.IE&&!t.utils.userAgent.EDGE,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12,this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1,this.FIELD_COLOUR_DEFAULT_WIDTH=26,this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3,this.randomIdentifier=String(Math.random()).substring(2),this.embossFilterId="",this.embossFilter_=null,this.disabledPatternId="",this.disabledPattern_=null,this.debugFilterId="",this.cssNode_=this.debugFilter_=null,this.CURSOR_COLOUR="#cc0a0a",this.MARKER_COLOUR="#4286f4",this.CURSOR_WS_WIDTH=100,this.WS_CURSOR_HEIGHT=5,this.CURSOR_STACK_PADDING=10,this.CURSOR_BLOCK_PADDING=2,this.CURSOR_STROKE_WIDTH=4,this.FULL_BLOCK_FIELDS=!1,this.INSERTION_MARKER_COLOUR="#000000",this.INSERTION_MARKER_OPACITY=.2,this.SHAPES={PUZZLE:1,NOTCH:2}},t.blockRendering.ConstantProvider.prototype.init=function(){this.JAGGED_TEETH=this.makeJaggedTeeth(),this.NOTCH=this.makeNotch(),this.START_HAT=this.makeStartHat(),this.PUZZLE_TAB=this.makePuzzleTab(),this.INSIDE_CORNERS=this.makeInsideCorners(),this.OUTSIDE_CORNERS=this.makeOutsideCorners()},t.blockRendering.ConstantProvider.prototype.setTheme=function(t){this.blockStyles=Object.create(null);var e,n=t.blockStyles;for(e in n)this.blockStyles[e]=this.validatedBlockStyle_(n[e]);this.setDynamicProperties_(t)},t.blockRendering.ConstantProvider.prototype.setDynamicProperties_=function(t){this.setFontConstants_(t),this.setComponentConstants_(t),this.ADD_START_HATS=null!=t.startHats?t.startHats:this.ADD_START_HATS},t.blockRendering.ConstantProvider.prototype.setFontConstants_=function(e){this.FIELD_TEXT_FONTFAMILY=e.fontStyle&&void 0!=e.fontStyle.family?e.fontStyle.family:this.FIELD_TEXT_FONTFAMILY,this.FIELD_TEXT_FONTWEIGHT=e.fontStyle&&void 0!=e.fontStyle.weight?e.fontStyle.weight:this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTSIZE=e.fontStyle&&void 0!=e.fontStyle.size?e.fontStyle.size:this.FIELD_TEXT_FONTSIZE,e=t.utils.dom.measureFontMetrics("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT,this.FIELD_TEXT_FONTFAMILY),this.FIELD_TEXT_HEIGHT=e.height,this.FIELD_TEXT_BASELINE=e.baseline},t.blockRendering.ConstantProvider.prototype.setComponentConstants_=function(t){this.CURSOR_COLOUR=t.getComponentStyle("cursorColour")||this.CURSOR_COLOUR,this.MARKER_COLOUR=t.getComponentStyle("markerColour")||this.MARKER_COLOUR,this.INSERTION_MARKER_COLOUR=t.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR,this.INSERTION_MARKER_OPACITY=Number(t.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY},t.blockRendering.ConstantProvider.prototype.getBlockStyleForColour=function(t){var e="auto_"+t;return this.blockStyles[e]||(this.blockStyles[e]=this.createBlockStyle_(t)),{style:this.blockStyles[e],name:e}},t.blockRendering.ConstantProvider.prototype.getBlockStyle=function(t){return this.blockStyles[t||""]||(t&&0==t.indexOf("auto_")?this.getBlockStyleForColour(t.substring(5)).style:this.createBlockStyle_("#000000"))},t.blockRendering.ConstantProvider.prototype.createBlockStyle_=function(t){return this.validatedBlockStyle_({colourPrimary:t})},t.blockRendering.ConstantProvider.prototype.validatedBlockStyle_=function(e){var n={};return e&&t.utils.object.mixin(n,e),e=t.utils.parseBlockColour(n.colourPrimary||"#000"),n.colourPrimary=e.hex,n.colourSecondary=n.colourSecondary?t.utils.parseBlockColour(n.colourSecondary).hex:this.generateSecondaryColour_(n.colourPrimary),n.colourTertiary=n.colourTertiary?t.utils.parseBlockColour(n.colourTertiary).hex:this.generateTertiaryColour_(n.colourPrimary),n.hat=n.hat||"",n},t.blockRendering.ConstantProvider.prototype.generateSecondaryColour_=function(e){return t.utils.colour.blend("#fff",e,.6)||e},t.blockRendering.ConstantProvider.prototype.generateTertiaryColour_=function(e){return t.utils.colour.blend("#fff",e,.3)||e},t.blockRendering.ConstantProvider.prototype.dispose=function(){this.embossFilter_&&t.utils.dom.removeNode(this.embossFilter_),this.disabledPattern_&&t.utils.dom.removeNode(this.disabledPattern_),this.debugFilter_&&t.utils.dom.removeNode(this.debugFilter_),this.cssNode_=null},t.blockRendering.ConstantProvider.prototype.makeJaggedTeeth=function(){var e=this.JAGGED_TEETH_HEIGHT,n=this.JAGGED_TEETH_WIDTH;return{height:e,width:n,path:t.utils.svgPaths.line([t.utils.svgPaths.point(n,e/4),t.utils.svgPaths.point(2*-n,e/2),t.utils.svgPaths.point(n,e/4)])}},t.blockRendering.ConstantProvider.prototype.makeStartHat=function(){var e=this.START_HAT_HEIGHT,n=this.START_HAT_WIDTH;return{height:e,width:n,path:t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(30,-e),t.utils.svgPaths.point(70,-e),t.utils.svgPaths.point(n,0)])}},t.blockRendering.ConstantProvider.prototype.makePuzzleTab=function(){function e(e){var r=-(e=e?-1:1),o=i/2,s=o+2.5,a=o+.5,l=t.utils.svgPaths.point(-n,e*o);return o=t.utils.svgPaths.point(n,e*o),t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(0,e*s),t.utils.svgPaths.point(-n,r*a),l])+t.utils.svgPaths.curve("s",[t.utils.svgPaths.point(n,2.5*r),o])}var n=this.TAB_WIDTH,i=this.TAB_HEIGHT,r=e(!0),o=e(!1);return{type:this.SHAPES.PUZZLE,width:n,height:i,pathDown:o,pathUp:r}},t.blockRendering.ConstantProvider.prototype.makeNotch=function(){function e(e){return t.utils.svgPaths.line([t.utils.svgPaths.point(e*r,i),t.utils.svgPaths.point(3*e,0),t.utils.svgPaths.point(e*r,-i)])}var n=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,r=(n-3)/2,o=e(1),s=e(-1);return{type:this.SHAPES.NOTCH,width:n,height:i,pathLeft:o,pathRight:s}},t.blockRendering.ConstantProvider.prototype.makeInsideCorners=function(){var e=this.CORNER_RADIUS;return{width:e,height:e,pathTop:t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(-e,e)),pathBottom:t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(e,e))}},t.blockRendering.ConstantProvider.prototype.makeOutsideCorners=function(){var e=this.CORNER_RADIUS,n=t.utils.svgPaths.moveBy(0,e)+t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(e,-e)),i=t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(e,e)),r=t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(-e,-e));return{topLeft:n,topRight:i,bottomRight:t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(-e,e)),bottomLeft:r,rightHeight:e}},t.blockRendering.ConstantProvider.prototype.shapeFor=function(e){switch(e.type){case t.connectionTypes.INPUT_VALUE:case t.connectionTypes.OUTPUT_VALUE:return this.PUZZLE_TAB;case t.connectionTypes.PREVIOUS_STATEMENT:case t.connectionTypes.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}},t.blockRendering.ConstantProvider.prototype.createDom=function(e,n,i){this.injectCSS_(n,i),e=t.utils.dom.createSvgElement(t.utils.Svg.DEFS,{},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},e),t.utils.dom.createSvgElement(t.utils.Svg.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},n),i=t.utils.dom.createSvgElement(t.utils.Svg.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},i),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},n),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},n),this.embossFilterId=n.id,this.embossFilter_=n,n=t.utils.dom.createSvgElement(t.utils.Svg.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},e),t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:10,height:10,fill:"#aaa"},n),t.utils.dom.createSvgElement(t.utils.Svg.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},n),this.disabledPatternId=n.id,this.disabledPattern_=n,t.blockRendering.Debug&&(e=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),this.debugFilterId=e.id,this.debugFilter_=e)},t.blockRendering.ConstantProvider.prototype.injectCSS_=function(t,e){e=this.getCSS_(e),t="blockly-renderer-style-"+t,this.cssNode_=document.getElementById(t);var n=e.join("\n");this.cssNode_?this.cssNode_.firstChild.textContent=n:((e=document.createElement("style")).id=t,t=document.createTextNode(n),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild),this.cssNode_=e)},t.blockRendering.ConstantProvider.prototype.getCSS_=function(t){return[t+" .blocklyText, ",t+" .blocklyFlyoutLabelText {","font: "+this.FIELD_TEXT_FONTWEIGHT+" "+this.FIELD_TEXT_FONTSIZE+"pt "+this.FIELD_TEXT_FONTFAMILY+";","}",t+" .blocklyText {","fill: #fff;","}",t+" .blocklyNonEditableText>rect,",t+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",t+" .blocklyNonEditableText>text,",t+" .blocklyEditableText>text {","fill: #000;","}",t+" .blocklyFlyoutLabelText {","fill: #000;","}",t+" .blocklyText.blocklyBubbleText {","fill: #000;","}",t+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",t+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",t+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",t+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",t+" .blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",t+" .blocklyReplaceable .blocklyPathLight,",t+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",t+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},t.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608},t.blockRendering.Types.LEFT_CORNER=t.blockRendering.Types.LEFT_SQUARE_CORNER|t.blockRendering.Types.LEFT_ROUND_CORNER,t.blockRendering.Types.RIGHT_CORNER=t.blockRendering.Types.RIGHT_SQUARE_CORNER|t.blockRendering.Types.RIGHT_ROUND_CORNER,t.blockRendering.Types.nextTypeValue_=16777216,t.blockRendering.Types.getType=function(e){return Object.prototype.hasOwnProperty.call(t.blockRendering.Types,e)||(t.blockRendering.Types[e]=t.blockRendering.Types.nextTypeValue_,t.blockRendering.Types.nextTypeValue_<<=1),t.blockRendering.Types[e]},t.blockRendering.Types.isField=function(e){return e.type&t.blockRendering.Types.FIELD},t.blockRendering.Types.isHat=function(e){return e.type&t.blockRendering.Types.HAT},t.blockRendering.Types.isIcon=function(e){return e.type&t.blockRendering.Types.ICON},t.blockRendering.Types.isSpacer=function(e){return e.type&t.blockRendering.Types.SPACER},t.blockRendering.Types.isInRowSpacer=function(e){return e.type&t.blockRendering.Types.IN_ROW_SPACER},t.blockRendering.Types.isInput=function(e){return e.type&t.blockRendering.Types.INPUT},t.blockRendering.Types.isExternalInput=function(e){return e.type&t.blockRendering.Types.EXTERNAL_VALUE_INPUT},t.blockRendering.Types.isInlineInput=function(e){return e.type&t.blockRendering.Types.INLINE_INPUT},t.blockRendering.Types.isStatementInput=function(e){return e.type&t.blockRendering.Types.STATEMENT_INPUT},t.blockRendering.Types.isPreviousConnection=function(e){return e.type&t.blockRendering.Types.PREVIOUS_CONNECTION},t.blockRendering.Types.isNextConnection=function(e){return e.type&t.blockRendering.Types.NEXT_CONNECTION},t.blockRendering.Types.isPreviousOrNextConnection=function(e){return e.type&(t.blockRendering.Types.PREVIOUS_CONNECTION|t.blockRendering.Types.NEXT_CONNECTION)},t.blockRendering.Types.isLeftRoundedCorner=function(e){return e.type&t.blockRendering.Types.LEFT_ROUND_CORNER},t.blockRendering.Types.isRightRoundedCorner=function(e){return e.type&t.blockRendering.Types.RIGHT_ROUND_CORNER},t.blockRendering.Types.isLeftSquareCorner=function(e){return e.type&t.blockRendering.Types.LEFT_SQUARE_CORNER},t.blockRendering.Types.isRightSquareCorner=function(e){return e.type&t.blockRendering.Types.RIGHT_SQUARE_CORNER},t.blockRendering.Types.isCorner=function(e){return e.type&t.blockRendering.Types.CORNER},t.blockRendering.Types.isJaggedEdge=function(e){return e.type&t.blockRendering.Types.JAGGED_EDGE},t.blockRendering.Types.isRow=function(e){return e.type&t.blockRendering.Types.ROW},t.blockRendering.Types.isBetweenRowSpacer=function(e){return e.type&t.blockRendering.Types.BETWEEN_ROW_SPACER},t.blockRendering.Types.isTopRow=function(e){return e.type&t.blockRendering.Types.TOP_ROW},t.blockRendering.Types.isBottomRow=function(e){return e.type&t.blockRendering.Types.BOTTOM_ROW},t.blockRendering.Types.isTopOrBottomRow=function(e){return e.type&(t.blockRendering.Types.TOP_ROW|t.blockRendering.Types.BOTTOM_ROW)},t.blockRendering.Types.isInputRow=function(e){return e.type&t.blockRendering.Types.INPUT_ROW},t.blockRendering.Measurable=function(e){this.height=this.width=0,this.type=t.blockRendering.Types.NONE,this.centerline=this.xPos=0,this.constants_=e,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT},t.blockRendering.Connection=function(e,n){t.blockRendering.Connection.superClass_.constructor.call(this,e),this.connectionModel=n,this.shape=this.constants_.shapeFor(n),this.isDynamicShape=!!this.shape.isDynamic,this.type|=t.blockRendering.Types.CONNECTION},t.utils.object.inherits(t.blockRendering.Connection,t.blockRendering.Measurable),t.blockRendering.OutputConnection=function(e,n){t.blockRendering.OutputConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=0},t.utils.object.inherits(t.blockRendering.OutputConnection,t.blockRendering.Connection),t.blockRendering.PreviousConnection=function(e,n){t.blockRendering.PreviousConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},t.utils.object.inherits(t.blockRendering.PreviousConnection,t.blockRendering.Connection),t.blockRendering.NextConnection=function(e,n){t.blockRendering.NextConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},t.utils.object.inherits(t.blockRendering.NextConnection,t.blockRendering.Connection),t.blockRendering.InputConnection=function(e,n){t.blockRendering.InputConnection.superClass_.constructor.call(this,e,n.connection),this.type|=t.blockRendering.Types.INPUT,this.input=n,this.align=n.align,(this.connectedBlock=n.connection&&n.connection.targetBlock()?n.connection.targetBlock():null)?(e=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=e.width,this.connectedBlockHeight=e.height):this.connectedBlockHeight=this.connectedBlockWidth=0,this.connectionOffsetY=this.connectionOffsetX=0},t.utils.object.inherits(t.blockRendering.InputConnection,t.blockRendering.Connection),t.blockRendering.InlineInput=function(e,n){t.blockRendering.InlineInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY=this.isDynamicShape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=this.isDynamicShape?this.shape.connectionOffsetX(this.connectionWidth):0},t.utils.object.inherits(t.blockRendering.InlineInput,t.blockRendering.InputConnection),t.blockRendering.StatementInput=function(e,n){t.blockRendering.StatementInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width},t.utils.object.inherits(t.blockRendering.StatementInput,t.blockRendering.InputConnection),t.blockRendering.ExternalValueInput=function(e,n){t.blockRendering.ExternalValueInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width},t.utils.object.inherits(t.blockRendering.ExternalValueInput,t.blockRendering.InputConnection),t.blockRendering.Icon=function(e,n){t.blockRendering.Icon.superClass_.constructor.call(this,e),this.icon=n,this.isVisible=n.isVisible(),this.type|=t.blockRendering.Types.ICON,e=n.getCorrectedSize(),this.height=e.height,this.width=e.width},t.utils.object.inherits(t.blockRendering.Icon,t.blockRendering.Measurable),t.blockRendering.JaggedEdge=function(e){t.blockRendering.JaggedEdge.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width},t.utils.object.inherits(t.blockRendering.JaggedEdge,t.blockRendering.Measurable),t.blockRendering.Field=function(e,n,i){t.blockRendering.Field.superClass_.constructor.call(this,e),this.field=n,this.isEditable=n.EDITABLE,this.flipRtl=n.getFlipRtl(),this.type|=t.blockRendering.Types.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width,this.parentInput=i},t.utils.object.inherits(t.blockRendering.Field,t.blockRendering.Measurable),t.blockRendering.Hat=function(e){t.blockRendering.Hat.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height},t.utils.object.inherits(t.blockRendering.Hat,t.blockRendering.Measurable),t.blockRendering.SquareCorner=function(e,n){t.blockRendering.SquareCorner.superClass_.constructor.call(this,e),this.type=(n&&"left"!=n?t.blockRendering.Types.RIGHT_SQUARE_CORNER:t.blockRendering.Types.LEFT_SQUARE_CORNER)|t.blockRendering.Types.CORNER,this.width=this.height=this.constants_.NO_PADDING},t.utils.object.inherits(t.blockRendering.SquareCorner,t.blockRendering.Measurable),t.blockRendering.RoundCorner=function(e,n){t.blockRendering.RoundCorner.superClass_.constructor.call(this,e),this.type=(n&&"left"!=n?t.blockRendering.Types.RIGHT_ROUND_CORNER:t.blockRendering.Types.LEFT_ROUND_CORNER)|t.blockRendering.Types.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2},t.utils.object.inherits(t.blockRendering.RoundCorner,t.blockRendering.Measurable),t.blockRendering.InRowSpacer=function(e,n){t.blockRendering.InRowSpacer.superClass_.constructor.call(this,e),this.type=this.type|t.blockRendering.Types.SPACER|t.blockRendering.Types.IN_ROW_SPACER,this.width=n,this.height=this.constants_.SPACER_DEFAULT_HEIGHT},t.utils.object.inherits(t.blockRendering.InRowSpacer,t.blockRendering.Measurable),t.blockRendering.Row=function(e){this.type=t.blockRendering.Types.ROW,this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1,this.constants_=e,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT,this.align=null},t.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.")},t.blockRendering.Row.prototype.getLastInput=function(){for(var e,n=this.elements.length-1;e=this.elements[n];n--)if(t.blockRendering.Types.isInput(e))return e;return null},t.blockRendering.Row.prototype.startsWithElemSpacer=function(){return!0},t.blockRendering.Row.prototype.endsWithElemSpacer=function(){return!0},t.blockRendering.Row.prototype.getFirstSpacer=function(){for(var e,n=0;e=this.elements[n];n++)if(t.blockRendering.Types.isSpacer(e))return e;return null},t.blockRendering.Row.prototype.getLastSpacer=function(){for(var e,n=this.elements.length-1;e=this.elements[n];n--)if(t.blockRendering.Types.isSpacer(e))return e;return null},t.blockRendering.TopRow=function(e){t.blockRendering.TopRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.TOP_ROW,this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null},t.utils.object.inherits(t.blockRendering.TopRow,t.blockRendering.Row),t.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(t){var e=(t.hat?"cap"===t.hat:this.constants_.ADD_START_HATS)&&!t.outputConnection&&!t.previousConnection,n=t.getPreviousBlock();return!!t.outputConnection||e||!!n&&n.getNextBlock()==t},t.blockRendering.TopRow.prototype.hasRightSquareCorner=function(t){return!0},t.blockRendering.TopRow.prototype.measure=function(){for(var e,n=0,i=0,r=0,o=0;e=this.elements[o];o++)i+=e.width,t.blockRendering.Types.isSpacer(e)||(t.blockRendering.Types.isHat(e)?r=Math.max(r,e.ascenderHeight):n=Math.max(n,e.height));this.width=Math.max(this.minWidth,i),this.height=Math.max(this.minHeight,n)+r,this.capline=this.ascenderHeight=r,this.widthWithConnectedBlocks=this.width},t.blockRendering.TopRow.prototype.startsWithElemSpacer=function(){return!1},t.blockRendering.TopRow.prototype.endsWithElemSpacer=function(){return!1},t.blockRendering.BottomRow=function(e){t.blockRendering.BottomRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.BOTTOM_ROW,this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0},t.utils.object.inherits(t.blockRendering.BottomRow,t.blockRendering.Row),t.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(t){return!!t.outputConnection||!!t.getNextBlock()},t.blockRendering.BottomRow.prototype.hasRightSquareCorner=function(t){return!0},t.blockRendering.BottomRow.prototype.measure=function(){for(var e,n=0,i=0,r=0,o=0;e=this.elements[o];o++)i+=e.width,t.blockRendering.Types.isSpacer(e)||(t.blockRendering.Types.isNextConnection(e)?r=Math.max(r,e.height):n=Math.max(n,e.height));this.width=Math.max(this.minWidth,i),this.height=Math.max(this.minHeight,n)+r,this.descenderHeight=r,this.widthWithConnectedBlocks=this.width},t.blockRendering.BottomRow.prototype.startsWithElemSpacer=function(){return!1},t.blockRendering.BottomRow.prototype.endsWithElemSpacer=function(){return!1},t.blockRendering.SpacerRow=function(e,n,i){t.blockRendering.SpacerRow.superClass_.constructor.call(this,e),this.type=this.type|t.blockRendering.Types.SPACER|t.blockRendering.Types.BETWEEN_ROW_SPACER,this.width=i,this.height=n,this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.elements=[new t.blockRendering.InRowSpacer(this.constants_,i)]},t.utils.object.inherits(t.blockRendering.SpacerRow,t.blockRendering.Row),t.blockRendering.SpacerRow.prototype.measure=function(){},t.blockRendering.InputRow=function(e){t.blockRendering.InputRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.INPUT_ROW,this.connectedBlockWidths=0},t.utils.object.inherits(t.blockRendering.InputRow,t.blockRendering.Row),t.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth,this.height=this.minHeight;for(var e,n=0,i=0;e=this.elements[i];i++)this.width+=e.width,t.blockRendering.Types.isInput(e)&&(t.blockRendering.Types.isStatementInput(e)?n+=e.connectedBlockWidth:t.blockRendering.Types.isExternalInput(e)&&0!=e.connectedBlockWidth&&(n+=e.connectedBlockWidth-e.connectionWidth)),t.blockRendering.Types.isSpacer(e)||(this.height=Math.max(this.height,e.height));this.connectedBlockWidths=n,this.widthWithConnectedBlocks=this.width+n},t.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement},t.blockRendering.RenderInfo=function(e,n){this.block_=n,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.outputConnection=n.outputConnection?new t.blockRendering.OutputConnection(this.constants_,n.outputConnection):null,this.isInline=n.getInputsInline()&&!n.isCollapsed(),this.isCollapsed=n.isCollapsed(),this.isInsertionMarker=n.isInsertionMarker(),this.RTL=n.RTL,this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.hiddenIcons=[],this.topRow=new t.blockRendering.TopRow(this.constants_),this.bottomRow=new t.blockRendering.BottomRow(this.constants_),this.startY=this.startX=0},t.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()},t.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_(),this.rows.push(this.topRow);var e=new t.blockRendering.InputRow(this.constants_);this.inputRows.push(e);for(var n,i=this.block_.getIcons(),r=0;n=i[r];r++){var o=new t.blockRendering.Icon(this.constants_,n);this.isCollapsed&&n.collapseHidden?this.hiddenIcons.push(o):e.elements.push(o)}for(n=null,r=0;i=this.block_.inputList[r];r++)if(i.isVisible()){for(this.shouldStartNewRow_(i,n)&&(this.rows.push(e),e=new t.blockRendering.InputRow(this.constants_),this.inputRows.push(e)),n=0;o=i.fieldRow[n];n++)e.elements.push(new t.blockRendering.Field(this.constants_,o,i));this.addInput_(i,e),n=i}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new t.blockRendering.JaggedEdge(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)},t.blockRendering.RenderInfo.prototype.populateTopRow_=function(){var e=!!this.block_.previousConnection,n=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e,i=this.topRow.hasLeftSquareCorner(this.block_)?t.blockRendering.SquareCorner:t.blockRendering.RoundCorner;this.topRow.elements.push(new i(this.constants_)),n?(e=new t.blockRendering.Hat(this.constants_),this.topRow.elements.push(e),this.topRow.capline=e.ascenderHeight):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new t.blockRendering.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0].type==t.inputTypes.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,i=this.topRow.hasRightSquareCorner(this.block_)?t.blockRendering.SquareCorner:t.blockRendering.RoundCorner,this.topRow.elements.push(new i(this.constants_,"right"))},t.blockRendering.RenderInfo.prototype.populateBottomRow_=function(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==t.inputTypes.STATEMENT?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new t.blockRendering.SquareCorner(this.constants_)):this.bottomRow.elements.push(new t.blockRendering.RoundCorner(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new t.blockRendering.NextConnection(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new t.blockRendering.SquareCorner(this.constants_,"right")):this.bottomRow.elements.push(new t.blockRendering.RoundCorner(this.constants_,"right"))},t.blockRendering.RenderInfo.prototype.addInput_=function(e,n){this.isInline&&e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.InlineInput(this.constants_,e)),n.hasInlineInput=!0):e.type==t.inputTypes.STATEMENT?(n.elements.push(new t.blockRendering.StatementInput(this.constants_,e)),n.hasStatement=!0):e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.ExternalValueInput(this.constants_,e)),n.hasExternalInput=!0):e.type==t.inputTypes.DUMMY&&(n.minHeight=Math.max(n.minHeight,e.getSourceBlock()&&e.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),n.hasDummyInput=!0),null==n.align&&(n.align=e.align)},t.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(e,n){return!!n&&(e.type==t.inputTypes.STATEMENT||n.type==t.inputTypes.STATEMENT||(e.type==t.inputTypes.VALUE||e.type==t.inputTypes.DUMMY)&&!this.isInline)},t.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var e,n=0;e=this.rows[n];n++){var i=e.elements;if(e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,i[0]))),i.length){for(var r=0;r<i.length-1;r++){e.elements.push(i[r]);var o=this.getInRowSpacing_(i[r],i[r+1]);e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,o))}e.elements.push(i[i.length-1]),e.endsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(i[i.length-1],null)))}}},t.blockRendering.RenderInfo.prototype.getInRowSpacing_=function(e,n){if(!e&&n&&t.blockRendering.Types.isStatementInput(n))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&t.blockRendering.Types.isInput(e)&&!n){if(t.blockRendering.Types.isExternalInput(e))return this.constants_.NO_PADDING;if(t.blockRendering.Types.isInlineInput(e))return this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isStatementInput(e))return this.constants_.NO_PADDING}return e&&t.blockRendering.Types.isLeftSquareCorner(e)&&n&&(t.blockRendering.Types.isPreviousConnection(n)||t.blockRendering.Types.isNextConnection(n))?n.notchOffset:e&&t.blockRendering.Types.isLeftRoundedCorner(e)&&n&&(t.blockRendering.Types.isPreviousConnection(n)||t.blockRendering.Types.isNextConnection(n))?n.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING},t.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var t,e=0,n=0,i=0,r=0;t=this.rows[r];r++){if(t.measure(),n=Math.max(n,t.width),t.hasStatement){var o=t.getLastInput();e=Math.max(e,t.width-o.width)}i=Math.max(i,t.widthWithConnectedBlocks)}for(this.statementEdge=e,this.width=n,r=0;t=this.rows[r];r++)t.hasStatement&&(t.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(n,i),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)},t.blockRendering.RenderInfo.prototype.alignRowElements_=function(){for(var e,n=0;e=this.rows[n];n++)if(e.hasStatement)this.alignStatementRow_(e);else{var i=e.width;0<(i=this.getDesiredRowWidth_(e)-i)&&this.addAlignmentPadding_(e,i),t.blockRendering.Types.isTopOrBottomRow(e)&&(e.widthWithConnectedBlocks=e.width)}},t.blockRendering.RenderInfo.prototype.getDesiredRowWidth_=function(t){return this.width-this.startX},t.blockRendering.RenderInfo.prototype.addAlignmentPadding_=function(e,n){var i=e.getFirstSpacer(),r=e.getLastSpacer();(e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=n),e.align==t.constants.ALIGN.LEFT?r.width+=n:e.align==t.constants.ALIGN.CENTRE?(i.width+=n/2,r.width+=n/2):e.align==t.constants.ALIGN.RIGHT?i.width+=n:r.width+=n,e.width+=n},t.blockRendering.RenderInfo.prototype.alignStatementRow_=function(t){var e=t.getLastInput(),n=t.width-e.width,i=this.statementEdge;0<(n=i-n)&&this.addAlignmentPadding_(t,n),n=t.width,i=this.getDesiredRowWidth_(t),e.width+=i-n,e.height=Math.max(e.height,t.height),t.width+=i-n,t.widthWithConnectedBlocks=Math.max(t.width,this.statementEdge+t.connectedBlockWidths)},t.blockRendering.RenderInfo.prototype.addRowSpacing_=function(){var t=this.rows;this.rows=[];for(var e=0;e<t.length;e++)this.rows.push(t[e]),e!=t.length-1&&this.rows.push(this.makeSpacerRow_(t[e],t[e+1]))},t.blockRendering.RenderInfo.prototype.makeSpacerRow_=function(e,n){var i=this.getSpacerRowHeight_(e,n),r=this.getSpacerRowWidth_(e,n);return i=new t.blockRendering.SpacerRow(this.constants_,i,r),e.hasStatement&&(i.followsStatement=!0),n.hasStatement&&(i.precedesStatement=!0),i},t.blockRendering.RenderInfo.prototype.getSpacerRowWidth_=function(t,e){return this.width-this.startX},t.blockRendering.RenderInfo.prototype.getSpacerRowHeight_=function(t,e){return this.constants_.MEDIUM_PADDING},t.blockRendering.RenderInfo.prototype.getElemCenterline_=function(e,n){return t.blockRendering.Types.isSpacer(n)?e.yPos+n.height/2:t.blockRendering.Types.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,t.blockRendering.Types.isNextConnection(n)?e+n.height/2:e-n.height/2):t.blockRendering.Types.isTopRow(e)?t.blockRendering.Types.isHat(n)?e.capline-n.height/2:e.capline+n.height/2:e.yPos+e.height/2},t.blockRendering.RenderInfo.prototype.recordElemPositions_=function(e){for(var n,i=e.xPos,r=0;n=e.elements[r];r++)t.blockRendering.Types.isSpacer(n)&&(n.height=e.height),n.xPos=i,n.centerline=this.getElemCenterline_(e,n),i+=n.width},t.blockRendering.RenderInfo.prototype.finalize_=function(){for(var t,e=0,n=0,i=0;t=this.rows[i];i++)t.yPos=n,t.xPos=this.startX,n+=t.height,e=Math.max(e,t.widthWithConnectedBlocks),this.recordElemPositions_(t);this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(e=Math.max(e,this.block_.nextConnection.targetBlock().getHeightWidth().width)),this.widthWithChildren=e+this.startX,this.height=n,this.startY=this.topRow.capline,this.bottomRow.baseline=n-this.bottomRow.descenderHeight},t.blockRendering.Debug=function(t){this.debugElements_=[],this.svgRoot_=null,this.constants_=t},t.blockRendering.Debug.config={rowSpacers:!0,elemSpacers:!0,rows:!0,elems:!0,connections:!0,blockBounds:!0,connectedBlockBounds:!0,render:!0},t.blockRendering.Debug.prototype.clearElems=function(){for(var e,n=0;e=this.debugElements_[n];n++)t.utils.dom.removeNode(e);this.debugElements_=[]},t.blockRendering.Debug.prototype.drawSpacerRow=function(e,n,i){if(t.blockRendering.Debug.config.rowSpacers){var r=Math.abs(e.height),o=0>e.height;o&&(n-=r),this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowSpacerRect blockRenderDebug",x:i?-(e.xPos+e.width):e.xPos,y:n,width:e.width,height:r,stroke:o?"black":"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawSpacerElem=function(e,n,i){if(t.blockRendering.Debug.config.elemSpacers){n=Math.abs(e.width);var r=0>e.width,o=r?e.xPos-n:e.xPos;i&&(o=-(o+n)),this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"elemSpacerRect blockRenderDebug",x:o,y:e.centerline-e.height/2,width:n,height:e.height,stroke:"pink",fill:r?"black":"pink","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawRenderedElem=function(e,n){if(t.blockRendering.Debug.config.elems){var i=e.xPos;n&&(i=-(i+e.width)),n=e.centerline-e.height/2,this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowRenderingRect blockRenderDebug",x:i,y:n,width:e.width,height:e.height,stroke:"black",fill:"none","stroke-width":"1px"},this.svgRoot_)),t.blockRendering.Types.isField(e)&&e.field instanceof t.FieldLabel&&this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowRenderingRect blockRenderDebug",x:i,y:n+this.constants_.FIELD_TEXT_BASELINE,width:e.width,height:"0.1px",stroke:"red",fill:"none","stroke-width":"0.5px"},this.svgRoot_))}t.blockRendering.Types.isInput(e)&&t.blockRendering.Debug.config.connections&&this.drawConnection(e.connectionModel)},t.blockRendering.Debug.prototype.drawConnection=function(e){if(t.blockRendering.Debug.config.connections){if(e.type==t.connectionTypes.INPUT_VALUE)var n=4,i="magenta",r="none";else e.type==t.connectionTypes.OUTPUT_VALUE?(n=2,r=i="magenta"):e.type==t.connectionTypes.NEXT_STATEMENT?(n=4,i="goldenrod",r="none"):e.type==t.connectionTypes.PREVIOUS_STATEMENT&&(n=2,r=i="goldenrod");this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{class:"blockRenderDebug",cx:e.offsetInBlock_.x,cy:e.offsetInBlock_.y,r:n,fill:r,stroke:i},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawRenderedRow=function(e,n,i){t.blockRendering.Debug.config.rows&&(this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"elemRenderingRect blockRenderDebug",x:i?-(e.xPos+e.width):e.xPos,y:e.yPos,width:e.width,height:e.height,stroke:"red",fill:"none","stroke-width":"1px"},this.svgRoot_)),t.blockRendering.Types.isTopOrBottomRow(e)||t.blockRendering.Debug.config.connectedBlockBounds&&this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"connectedBlockWidth blockRenderDebug",x:i?-(e.xPos+e.widthWithConnectedBlocks):e.xPos,y:e.yPos,width:e.widthWithConnectedBlocks,height:e.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))},t.blockRendering.Debug.prototype.drawRowWithElements=function(e,n,i){for(var r=0,o=e.elements.length;r<o;r++){var s=e.elements[r];s?t.blockRendering.Types.isSpacer(s)?this.drawSpacerElem(s,e.height,i):this.drawRenderedElem(s,i):console.warn("A row has an undefined or null element.",e,s)}this.drawRenderedRow(e,n,i)},t.blockRendering.Debug.prototype.drawBoundingBox=function(e){if(t.blockRendering.Debug.config.blockBounds){var n=e.RTL?-e.width:0;this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blockBoundingBox blockRenderDebug",x:n,y:0,width:e.width,height:e.height,stroke:"black",fill:"none","stroke-width":"1px","stroke-dasharray":"5,5"},this.svgRoot_)),t.blockRendering.Debug.config.connectedBlockBounds&&(n=e.RTL?-e.widthWithChildren:0,this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blockRenderDebug",x:n,y:0,width:e.widthWithChildren,height:e.height,stroke:"#DF57BC",fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))}},t.blockRendering.Debug.prototype.drawDebug=function(e,n){this.clearElems(),this.svgRoot_=e.getSvgRoot(),this.randomColour_="#"+Math.floor(16777215*Math.random()).toString(16);for(var i,r=0,o=0;i=n.rows[o];o++)t.blockRendering.Types.isBetweenRowSpacer(i)?this.drawSpacerRow(i,r,n.RTL):this.drawRowWithElements(i,r,n.RTL),r+=i.height;e.previousConnection&&this.drawConnection(e.previousConnection),e.nextConnection&&this.drawConnection(e.nextConnection),e.outputConnection&&this.drawConnection(e.outputConnection),n.rightSide&&this.drawRenderedElem(n.rightSide,n.RTL),this.drawBoundingBox(n),this.drawRender(e.pathObject.svgPath)},t.blockRendering.Debug.prototype.drawRender=function(e){t.blockRendering.Debug.config.render&&(e.setAttribute("filter","url(#"+this.constants_.debugFilterId+")"),setTimeout(function(){e.setAttribute("filter","")},100))},t.blockRendering.Drawer=function(t,e){this.block_=t,this.info_=e,this.topLeft_=t.getRelativeToSurfaceXY(),this.inlinePath_=this.outlinePath_="",this.constants_=e.getRenderer().getConstants()},t.blockRendering.Drawer.prototype.draw=function(){this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_(),this.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),t.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_()},t.blockRendering.Drawer.prototype.recordSizeOnBlock_=function(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren},t.blockRendering.Drawer.prototype.hideHiddenIcons_=function(){for(var t,e=0;t=this.info_.hiddenIcons[e];e++)t.icon.iconGroup_.setAttribute("display","none")},t.blockRendering.Drawer.prototype.drawOutline_=function(){this.drawTop_();for(var t=1;t<this.info_.rows.length-1;t++){var e=this.info_.rows[t];e.hasJaggedEdge?this.drawJaggedEdge_(e):e.hasStatement?this.drawStatementInput_(e):e.hasExternalInput?this.drawValueInput_(e):this.drawRightSideRow_(e)}this.drawBottom_(),this.drawLeft_()},t.blockRendering.Drawer.prototype.drawTop_=function(){var e=this.info_.topRow,n=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=t.utils.svgPaths.moveBy(e.xPos,this.info_.startY);for(var i,r=0;i=n[r];r++)t.blockRendering.Types.isLeftRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:t.blockRendering.Types.isRightRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:t.blockRendering.Types.isPreviousConnection(i)?this.outlinePath_+=i.shape.pathLeft:t.blockRendering.Types.isHat(i)?this.outlinePath_+=this.constants_.START_HAT.path:t.blockRendering.Types.isSpacer(i)&&(this.outlinePath_+=t.utils.svgPaths.lineOnAxis("h",i.width));this.outlinePath_+=t.utils.svgPaths.lineOnAxis("v",e.height)},t.blockRendering.Drawer.prototype.drawJaggedEdge_=function(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+t.utils.svgPaths.lineOnAxis("v",e.height-this.constants_.JAGGED_TEETH.height)},t.blockRendering.Drawer.prototype.drawValueInput_=function(e){var n=e.getLastInput();this.positionExternalValueConnection_(e);var i="function"==typeof n.shape.pathDown?n.shape.pathDown(n.height):n.shape.pathDown;this.outlinePath_+=t.utils.svgPaths.lineOnAxis("H",n.xPos+n.width)+i+t.utils.svgPaths.lineOnAxis("v",e.height-n.connectionHeight)},t.blockRendering.Drawer.prototype.drawStatementInput_=function(e){var n=e.getLastInput(),i=n.xPos+n.notchOffset+n.shape.width;n=n.shape.pathRight+t.utils.svgPaths.lineOnAxis("h",-(n.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var r=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=t.utils.svgPaths.lineOnAxis("H",i)+n+t.utils.svgPaths.lineOnAxis("v",r)+this.constants_.INSIDE_CORNERS.pathBottom+t.utils.svgPaths.lineOnAxis("H",e.xPos+e.width),this.positionStatementInputConnection_(e)},t.blockRendering.Drawer.prototype.drawRightSideRow_=function(e){this.outlinePath_+=t.utils.svgPaths.lineOnAxis("V",e.yPos+e.height)},t.blockRendering.Drawer.prototype.drawBottom_=function(){var e=this.info_.bottomRow,n=e.elements;this.positionNextConnection_();for(var i,r=0,o="",s=n.length-1;i=n[s];s--)t.blockRendering.Types.isNextConnection(i)?o+=i.shape.pathRight:t.blockRendering.Types.isLeftSquareCorner(i)?o+=t.utils.svgPaths.lineOnAxis("H",e.xPos):t.blockRendering.Types.isLeftRoundedCorner(i)?o+=this.constants_.OUTSIDE_CORNERS.bottomLeft:t.blockRendering.Types.isRightRoundedCorner(i)?(o+=this.constants_.OUTSIDE_CORNERS.bottomRight,r=this.constants_.OUTSIDE_CORNERS.rightHeight):t.blockRendering.Types.isSpacer(i)&&(o+=t.utils.svgPaths.lineOnAxis("h",-1*i.width));this.outlinePath_+=t.utils.svgPaths.lineOnAxis("V",e.baseline-r),this.outlinePath_+=o},t.blockRendering.Drawer.prototype.drawLeft_=function(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){var n=e.connectionOffsetY+e.height;e="function"==typeof e.shape.pathUp?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=t.utils.svgPaths.lineOnAxis("V",n)+e}this.outlinePath_+="z"},t.blockRendering.Drawer.prototype.drawInternals_=function(){for(var e,n=0;e=this.info_.rows[n];n++)for(var i,r=0;i=e.elements[r];r++)t.blockRendering.Types.isInlineInput(i)?this.drawInlineInput_(i):(t.blockRendering.Types.isIcon(i)||t.blockRendering.Types.isField(i))&&this.layoutField_(i)},t.blockRendering.Drawer.prototype.layoutField_=function(e){if(t.blockRendering.Types.isField(e))var n=e.field.getSvgRoot();else t.blockRendering.Types.isIcon(e)&&(n=e.icon.iconGroup_);var i=e.centerline-e.height/2,r=e.xPos,o="";this.info_.RTL&&(r=-(r+e.width),e.flipRtl&&(r+=e.width,o="scale(-1 1)")),t.blockRendering.Types.isIcon(e)?(n.setAttribute("display","block"),n.setAttribute("transform","translate("+r+","+i+")"),e.icon.computeIconLocation()):n.setAttribute("transform","translate("+r+","+i+")"+o),this.info_.isInsertionMarker&&n.setAttribute("display","none")},t.blockRendering.Drawer.prototype.drawInlineInput_=function(e){var n=e.width,i=e.height,r=e.connectionOffsetY,o=e.connectionHeight+r;this.inlinePath_+=t.utils.svgPaths.moveTo(e.xPos+e.connectionWidth,e.centerline-i/2)+t.utils.svgPaths.lineOnAxis("v",r)+e.shape.pathDown+t.utils.svgPaths.lineOnAxis("v",i-o)+t.utils.svgPaths.lineOnAxis("h",n-e.connectionWidth)+t.utils.svgPaths.lineOnAxis("v",-i)+"z",this.positionInlineInputConnection_(e)},t.blockRendering.Drawer.prototype.positionInlineInputConnection_=function(t){var e=t.centerline-t.height/2;if(t.connectionModel){var n=t.xPos+t.connectionWidth+t.connectionOffsetX;this.info_.RTL&&(n*=-1),t.connectionModel.setOffsetInBlock(n,e+t.connectionOffsetY)}},t.blockRendering.Drawer.prototype.positionStatementInputConnection_=function(t){var e=t.getLastInput();if(e.connectionModel){var n=t.xPos+t.statementEdge+e.notchOffset;this.info_.RTL&&(n*=-1),e.connectionModel.setOffsetInBlock(n,t.yPos)}},t.blockRendering.Drawer.prototype.positionExternalValueConnection_=function(t){var e=t.getLastInput();if(e.connectionModel){var n=t.xPos+t.width;this.info_.RTL&&(n*=-1),e.connectionModel.setOffsetInBlock(n,t.yPos)}},t.blockRendering.Drawer.prototype.positionPreviousConnection_=function(){var t=this.info_.topRow;if(t.connection){var e=t.xPos+t.notchOffset;t.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-e:e,0)}},t.blockRendering.Drawer.prototype.positionNextConnection_=function(){var t=this.info_.bottomRow;if(t.connection){var e=t.connection,n=e.xPos;e.connectionModel.setOffsetInBlock(this.info_.RTL?-n:n,t.baseline)}},t.blockRendering.Drawer.prototype.positionOutputConnection_=function(){if(this.info_.outputConnection){var t=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-t:t,this.info_.outputConnection.connectionOffsetY)}},t.Events.MarkerMove=function(e,n,i,r){var o=e?e.workspace.id:void 0;r&&r.getType()==t.ASTNode.types.WORKSPACE&&(o=r.getLocation().id),t.Events.MarkerMove.superClass_.constructor.call(this,o),this.blockId=e?e.id:null,this.oldNode=i,this.newNode=r,this.isCursor=n},t.utils.object.inherits(t.Events.MarkerMove,t.Events.UiBase),t.Events.MarkerMove.prototype.type=t.Events.MARKER_MOVE,t.Events.MarkerMove.prototype.toJson=function(){var e=t.Events.MarkerMove.superClass_.toJson.call(this);return e.isCursor=this.isCursor,e.blockId=this.blockId,e.oldNode=this.oldNode,e.newNode=this.newNode,e},t.Events.MarkerMove.prototype.fromJson=function(e){t.Events.MarkerMove.superClass_.fromJson.call(this,e),this.isCursor=e.isCursor,this.blockId=e.blockId,this.oldNode=e.oldNode,this.newNode=e.newNode},t.registry.register(t.registry.Type.EVENT,t.Events.MARKER_MOVE,t.Events.MarkerMove),t.blockRendering.MarkerSvg=function(t,e,n){this.workspace_=t,this.marker_=n,this.parent_=null,this.constants_=e,this.currentMarkerSvg=null,t=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR,this.colour_=n.colour||t},t.blockRendering.MarkerSvg.CURSOR_CLASS="blocklyCursor",t.blockRendering.MarkerSvg.MARKER_CLASS="blocklyMarker",t.blockRendering.MarkerSvg.HEIGHT_MULTIPLIER=.75,t.blockRendering.MarkerSvg.prototype.getSvgRoot=function(){return this.svgGroup_},t.blockRendering.MarkerSvg.prototype.getMarker=function(){return this.marker_},t.blockRendering.MarkerSvg.prototype.isCursor=function(){return"cursor"==this.marker_.type},t.blockRendering.MarkerSvg.prototype.createDom=function(){var e=this.isCursor()?t.blockRendering.MarkerSvg.CURSOR_CLASS:t.blockRendering.MarkerSvg.MARKER_CLASS;return this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:e},null),this.createDomInternal_(),this.svgGroup_},t.blockRendering.MarkerSvg.prototype.setParent_=function(t){this.isCursor()?(this.parent_&&this.parent_.setCursorSvg(null),t.setCursorSvg(this.getSvgRoot())):(this.parent_&&this.parent_.setMarkerSvg(null),t.setMarkerSvg(this.getSvgRoot())),this.parent_=t},t.blockRendering.MarkerSvg.prototype.draw=function(t,e){if(e){this.constants_=this.workspace_.getRenderer().getConstants();var n=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker_.colour||n,this.applyColour_(e),this.showAtLocation_(e),this.fireMarkerEvent_(t,e),void 0!==(t=this.currentMarkerSvg.childNodes[0])&&t.beginElement&&t.beginElement()}else this.hide()},t.blockRendering.MarkerSvg.prototype.showAtLocation_=function(e){var n=e.getLocation().type;e.getType()==t.ASTNode.types.BLOCK?this.showWithBlock_(e):e.getType()==t.ASTNode.types.OUTPUT?this.showWithOutput_(e):n==t.connectionTypes.INPUT_VALUE?this.showWithInput_(e):n==t.connectionTypes.NEXT_STATEMENT?this.showWithNext_(e):e.getType()==t.ASTNode.types.PREVIOUS?this.showWithPrevious_(e):e.getType()==t.ASTNode.types.FIELD?this.showWithField_(e):e.getType()==t.ASTNode.types.WORKSPACE?this.showWithCoordinates_(e):e.getType()==t.ASTNode.types.STACK&&this.showWithStack_(e)},t.blockRendering.MarkerSvg.prototype.showWithBlockPrevOutput_=function(e){var n=(e=e.getSourceBlock()).width,i=e.height,r=i*t.blockRendering.MarkerSvg.HEIGHT_MULTIPLIER,o=this.constants_.CURSOR_BLOCK_PADDING;if(e.previousConnection){var s=this.constants_.shapeFor(e.previousConnection);this.positionPrevious_(n,o,r,s)}else e.outputConnection?(s=this.constants_.shapeFor(e.outputConnection),this.positionOutput_(n,i,s)):this.positionBlock_(n,o,r);this.setParent_(e),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showWithBlock_=function(t){this.showWithBlockPrevOutput_(t)},t.blockRendering.MarkerSvg.prototype.showWithPrevious_=function(t){this.showWithBlockPrevOutput_(t)},t.blockRendering.MarkerSvg.prototype.showWithOutput_=function(t){this.showWithBlockPrevOutput_(t)},t.blockRendering.MarkerSvg.prototype.showWithCoordinates_=function(t){var e=t.getWsCoordinate();t=e.x,e=e.y,this.workspace_.RTL&&(t-=this.constants_.CURSOR_WS_WIDTH),this.positionLine_(t,e,this.constants_.CURSOR_WS_WIDTH),this.setParent_(this.workspace_),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showWithField_=function(t){var e=(t=t.getLocation()).getSize().width,n=t.getSize().height;this.positionRect_(0,0,e,n),this.setParent_(t),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showWithInput_=function(t){var e=(t=t.getLocation()).getSourceBlock();this.positionInput_(t),this.setParent_(e),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showWithNext_=function(t){var e=t.getLocation();t=e.getSourceBlock();var n=0;e=e.getOffsetInBlock().y;var i=t.getHeightWidth().width;this.workspace_.RTL&&(n=-i),this.positionLine_(n,e,i),this.setParent_(t),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showWithStack_=function(t){var e=(t=t.getLocation()).getHeightWidth(),n=e.width+this.constants_.CURSOR_STACK_PADDING;e=e.height+this.constants_.CURSOR_STACK_PADDING;var i=-this.constants_.CURSOR_STACK_PADDING/2,r=-this.constants_.CURSOR_STACK_PADDING/2,o=i;this.workspace_.RTL&&(o=-(n+i)),this.positionRect_(o,r,n,e),this.setParent_(t),this.showCurrent_()},t.blockRendering.MarkerSvg.prototype.showCurrent_=function(){this.hide(),this.currentMarkerSvg.style.display=""},t.blockRendering.MarkerSvg.prototype.positionBlock_=function(e,n,i){e=t.utils.svgPaths.moveBy(-n,i)+t.utils.svgPaths.lineOnAxis("V",-n)+t.utils.svgPaths.lineOnAxis("H",e+2*n)+t.utils.svgPaths.lineOnAxis("V",i),this.markerBlock_.setAttribute("d",e),this.workspace_.RTL&&this.flipRtl_(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_},t.blockRendering.MarkerSvg.prototype.positionInput_=function(e){var n=e.getOffsetInBlock().x,i=e.getOffsetInBlock().y;e=t.utils.svgPaths.moveTo(0,0)+this.constants_.shapeFor(e).pathDown,this.markerInput_.setAttribute("d",e),this.markerInput_.setAttribute("transform","translate("+n+","+i+")"+(this.workspace_.RTL?" scale(-1 1)":"")),this.currentMarkerSvg=this.markerInput_},t.blockRendering.MarkerSvg.prototype.positionLine_=function(t,e,n){this.markerSvgLine_.setAttribute("x",t),this.markerSvgLine_.setAttribute("y",e),this.markerSvgLine_.setAttribute("width",n),this.currentMarkerSvg=this.markerSvgLine_},t.blockRendering.MarkerSvg.prototype.positionOutput_=function(e,n,i){e=t.utils.svgPaths.moveBy(e,0)+t.utils.svgPaths.lineOnAxis("h",-(e-i.width))+t.utils.svgPaths.lineOnAxis("v",this.constants_.TAB_OFFSET_FROM_TOP)+i.pathDown+t.utils.svgPaths.lineOnAxis("V",n)+t.utils.svgPaths.lineOnAxis("H",e),this.markerBlock_.setAttribute("d",e),this.workspace_.RTL&&this.flipRtl_(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_},t.blockRendering.MarkerSvg.prototype.positionPrevious_=function(e,n,i,r){e=t.utils.svgPaths.moveBy(-n,i)+t.utils.svgPaths.lineOnAxis("V",-n)+t.utils.svgPaths.lineOnAxis("H",this.constants_.NOTCH_OFFSET_LEFT)+r.pathLeft+t.utils.svgPaths.lineOnAxis("H",e+2*n)+t.utils.svgPaths.lineOnAxis("V",i),this.markerBlock_.setAttribute("d",e),this.workspace_.RTL&&this.flipRtl_(this.markerBlock_),this.currentMarkerSvg=this.markerBlock_},t.blockRendering.MarkerSvg.prototype.positionRect_=function(t,e,n,i){this.markerSvgRect_.setAttribute("x",t),this.markerSvgRect_.setAttribute("y",e),this.markerSvgRect_.setAttribute("width",n),this.markerSvgRect_.setAttribute("height",i),this.currentMarkerSvg=this.markerSvgRect_},t.blockRendering.MarkerSvg.prototype.flipRtl_=function(t){t.setAttribute("transform","scale(-1 1)")},t.blockRendering.MarkerSvg.prototype.hide=function(){this.markerSvgLine_.style.display="none",this.markerSvgRect_.style.display="none",this.markerInput_.style.display="none",this.markerBlock_.style.display="none"},t.blockRendering.MarkerSvg.prototype.fireMarkerEvent_=function(e,n){var i=n.getSourceBlock();e=new(t.Events.get(t.Events.MARKER_MOVE))(i,this.isCursor(),e,n),t.Events.fire(e)},t.blockRendering.MarkerSvg.prototype.getBlinkProperties_=function(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}},t.blockRendering.MarkerSvg.prototype.createDomInternal_=function(){if(this.markerSvg_=t.utils.dom.createSvgElement(t.utils.Svg.G,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_),this.markerSvgLine_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},this.markerSvg_),this.markerSvgRect_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyVerticalMarker",rx:10,ry:10,style:"display: none"},this.markerSvg_),this.markerInput_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{transform:"",style:"display: none"},this.markerSvg_),this.markerBlock_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{transform:"",style:"display: none",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.isCursor()){var e=this.getBlinkProperties_();t.utils.dom.createSvgElement(t.utils.Svg.ANIMATE,e,this.markerSvgLine_),t.utils.dom.createSvgElement(t.utils.Svg.ANIMATE,e,this.markerInput_),e.attributeName="stroke",t.utils.dom.createSvgElement(t.utils.Svg.ANIMATE,e,this.markerBlock_)}return this.markerSvg_},t.blockRendering.MarkerSvg.prototype.applyColour_=function(t){this.markerSvgLine_.setAttribute("fill",this.colour_),this.markerSvgRect_.setAttribute("stroke",this.colour_),this.markerInput_.setAttribute("fill",this.colour_),this.markerBlock_.setAttribute("stroke",this.colour_),this.isCursor()&&(t=this.colour_+";transparent;transparent;",this.markerSvgLine_.firstChild.setAttribute("values",t),this.markerInput_.firstChild.setAttribute("values",t),this.markerBlock_.firstChild.setAttribute("values",t))},t.blockRendering.MarkerSvg.prototype.dispose=function(){this.svgGroup_&&t.utils.dom.removeNode(this.svgGroup_)},t.blockRendering.PathObject=function(e,n,i){this.constants=i,this.svgRoot=e,this.svgPath=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyPath"},this.svgRoot),this.style=n,this.markerSvg=this.cursorSvg=null},t.blockRendering.PathObject.prototype.setPath=function(t){this.svgPath.setAttribute("d",t)},t.blockRendering.PathObject.prototype.flipRTL=function(){this.svgPath.setAttribute("transform","scale(-1 1)")},t.blockRendering.PathObject.prototype.setCursorSvg=function(t){t?(this.svgRoot.appendChild(t),this.cursorSvg=t):this.cursorSvg=null},t.blockRendering.PathObject.prototype.setMarkerSvg=function(t){t?(this.cursorSvg?this.svgRoot.insertBefore(t,this.cursorSvg):this.svgRoot.appendChild(t),this.markerSvg=t):this.markerSvg=null},t.blockRendering.PathObject.prototype.applyColour=function(t){this.svgPath.setAttribute("stroke",this.style.colourTertiary),this.svgPath.setAttribute("fill",this.style.colourPrimary),this.updateShadow_(t.isShadow()),this.updateDisabled_(!t.isEnabled()||t.getInheritedDisabled())},t.blockRendering.PathObject.prototype.setStyle=function(t){this.style=t},t.blockRendering.PathObject.prototype.setClass_=function(e,n){n?t.utils.dom.addClass(this.svgRoot,e):t.utils.dom.removeClass(this.svgRoot,e)},t.blockRendering.PathObject.prototype.updateHighlighted=function(t){t?this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"):this.svgPath.setAttribute("filter","none")},t.blockRendering.PathObject.prototype.updateShadow_=function(t){t&&(this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))},t.blockRendering.PathObject.prototype.updateDisabled_=function(t){this.setClass_("blocklyDisabled",t),t&&this.svgPath.setAttribute("fill","url(#"+this.constants.disabledPatternId+")")},t.blockRendering.PathObject.prototype.updateSelected=function(t){this.setClass_("blocklySelected",t)},t.blockRendering.PathObject.prototype.updateDraggingDelete=function(t){this.setClass_("blocklyDraggingDelete",t)},t.blockRendering.PathObject.prototype.updateInsertionMarker=function(t){this.setClass_("blocklyInsertionMarker",t)},t.blockRendering.PathObject.prototype.updateMovable=function(t){this.setClass_("blocklyDraggable",t)},t.blockRendering.PathObject.prototype.updateReplacementFade=function(t){this.setClass_("blocklyReplaceable",t)},t.blockRendering.PathObject.prototype.updateShapeForInputHighlight=function(t,e){},t.blockRendering.Renderer=function(t){this.name=t,this.overrides=this.constants_=null},t.blockRendering.Renderer.prototype.getClassName=function(){return this.name+"-renderer"},t.blockRendering.Renderer.prototype.init=function(e,n){this.constants_=this.makeConstants_(),n&&(this.overrides=n,t.utils.object.mixin(this.constants_,n)),this.constants_.setTheme(e),this.constants_.init()},t.blockRendering.Renderer.prototype.createDom=function(t,e){this.constants_.createDom(t,this.name+"-"+e.name,"."+this.getClassName()+"."+e.getClassName())},t.blockRendering.Renderer.prototype.refreshDom=function(e,n){var i=this.getConstants();i.dispose(),this.constants_=this.makeConstants_(),this.overrides&&t.utils.object.mixin(this.constants_,this.overrides),this.constants_.randomIdentifier=i.randomIdentifier,this.constants_.setTheme(n),this.constants_.init(),this.createDom(e,n)},t.blockRendering.Renderer.prototype.dispose=function(){this.constants_&&this.constants_.dispose()},t.blockRendering.Renderer.prototype.makeConstants_=function(){return new t.blockRendering.ConstantProvider},t.blockRendering.Renderer.prototype.makeRenderInfo_=function(e){return new t.blockRendering.RenderInfo(this,e)},t.blockRendering.Renderer.prototype.makeDrawer_=function(e,n){return new t.blockRendering.Drawer(e,n)},t.blockRendering.Renderer.prototype.makeDebugger_=function(){if(!t.blockRendering.Debug)throw Error("Missing require for Blockly.blockRendering.Debug");return new t.blockRendering.Debug(this.getConstants())},t.blockRendering.Renderer.prototype.makeMarkerDrawer=function(e,n){return new t.blockRendering.MarkerSvg(e,this.getConstants(),n)},t.blockRendering.Renderer.prototype.makePathObject=function(e,n){return new t.blockRendering.PathObject(e,n,this.constants_)},t.blockRendering.Renderer.prototype.getConstants=function(){return this.constants_},t.blockRendering.Renderer.prototype.shouldHighlightConnection=function(t){return!0},t.blockRendering.Renderer.prototype.orphanCanConnectAtEnd=function(e,n,i){return!!t.Connection.getConnectionForOrphanedConnection(e,i===t.connectionTypes.OUTPUT_VALUE?n.outputConnection:n.previousConnection)},t.blockRendering.Renderer.prototype.getConnectionPreviewMethod=function(e,n,i){return n.type==t.connectionTypes.OUTPUT_VALUE||n.type==t.connectionTypes.PREVIOUS_STATEMENT?!e.isConnected()||this.orphanCanConnectAtEnd(i,e.targetBlock(),n.type)?t.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER:t.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:t.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER},t.blockRendering.Renderer.prototype.render=function(e){t.blockRendering.useDebugger&&!e.renderingDebugger&&(e.renderingDebugger=this.makeDebugger_());var n=this.makeRenderInfo_(e);n.measure(),this.makeDrawer_(e,n).draw()},t.geras={},t.geras.ConstantProvider=function(){t.geras.ConstantProvider.superClass_.constructor.call(this),this.FIELD_TEXT_BASELINE_CENTER=!1,this.DARK_PATH_OFFSET=1,this.MAX_BOTTOM_WIDTH=30,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2},t.utils.object.inherits(t.geras.ConstantProvider,t.blockRendering.ConstantProvider),t.geras.ConstantProvider.prototype.getCSS_=function(e){return t.geras.ConstantProvider.superClass_.getCSS_.call(this,e).concat([e+" .blocklyInsertionMarker>.blocklyPathLight,",e+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])},t.geras.Highlighter=function(t){this.info_=t,this.inlineSteps_=this.steps_="",this.RTL_=this.info_.RTL,t=t.getRenderer(),this.constants_=t.getConstants(),this.highlightConstants_=t.getHighlightConstants(),this.highlightOffset_=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH},t.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_},t.geras.Highlighter.prototype.drawTopCorner=function(e){this.steps_+=t.utils.svgPaths.moveBy(e.xPos,this.info_.startY);for(var n,i=0;n=e.elements[i];i++)t.blockRendering.Types.isLeftSquareCorner(n)?this.steps_+=this.highlightConstants_.START_POINT:t.blockRendering.Types.isLeftRoundedCorner(n)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):t.blockRendering.Types.isPreviousConnection(n)?this.steps_+=this.notchPaths_.pathLeft:t.blockRendering.Types.isHat(n)?this.steps_+=this.startPaths_.path(this.RTL_):t.blockRendering.Types.isSpacer(n)&&0!=n.width&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n.xPos+n.width-this.highlightOffset_));this.steps_+=t.utils.svgPaths.lineOnAxis("H",e.xPos+e.width-this.highlightOffset_)},t.geras.Highlighter.prototype.drawJaggedEdge_=function(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+t.utils.svgPaths.lineOnAxis("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset_))},t.geras.Highlighter.prototype.drawValueInput=function(e){var n=e.getLastInput();if(this.RTL_){var i=e.height-n.connectionHeight;this.steps_+=t.utils.svgPaths.moveTo(n.xPos+n.width-this.highlightOffset_,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",i)}else this.steps_+=t.utils.svgPaths.moveTo(n.xPos+n.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)},t.geras.Highlighter.prototype.drawStatementInput=function(e){var n=e.getLastInput();if(this.RTL_){var i=e.height-2*this.insideCornerPaths_.height;this.steps_+=t.utils.svgPaths.moveTo(n.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",i)+this.insideCornerPaths_.pathBottom(this.RTL_)+t.utils.svgPaths.lineTo(e.width-n.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=t.utils.svgPaths.moveTo(n.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+t.utils.svgPaths.lineTo(e.width-n.xPos-this.insideCornerPaths_.width,0)},t.geras.Highlighter.prototype.drawRightSideRow=function(e){var n=e.xPos+e.width-this.highlightOffset_;e.followsStatement&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n)),this.RTL_&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n),e.height>this.highlightOffset_&&(this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.yPos+e.height-this.highlightOffset_)))},t.geras.Highlighter.prototype.drawBottomRow=function(e){if(this.RTL_)this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.baseline-this.highlightOffset_);else{var n=this.info_.bottomRow.elements[0];t.blockRendering.Types.isLeftSquareCorner(n)?this.steps_+=t.utils.svgPaths.moveTo(e.xPos+this.highlightOffset_,e.baseline-this.highlightOffset_):t.blockRendering.Types.isLeftRoundedCorner(n)&&(this.steps_+=t.utils.svgPaths.moveTo(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}},t.geras.Highlighter.prototype.drawLeft=function(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=t.utils.svgPaths.moveTo(this.info_.startX,e):(this.steps_+=t.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=t.utils.svgPaths.lineOnAxis("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,t.blockRendering.Types.isLeftRoundedCorner(e.elements[0])?this.steps_+=t.utils.svgPaths.lineOnAxis("V",this.outsideCornerPaths_.height):this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.capline+this.highlightOffset_))},t.geras.Highlighter.prototype.drawInlineInput=function(e){var n=this.highlightOffset_,i=e.xPos+e.connectionWidth,r=e.centerline-e.height/2,o=e.width-e.connectionWidth,s=r+n;this.RTL_?(r=e.connectionOffsetY-n,e=e.height-(e.connectionOffsetY+e.connectionHeight)+n,this.inlineSteps_+=t.utils.svgPaths.moveTo(i-n,s)+t.utils.svgPaths.lineOnAxis("v",r)+this.puzzleTabPaths_.pathDown(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",e)+t.utils.svgPaths.lineOnAxis("h",o)):this.inlineSteps_+=t.utils.svgPaths.moveTo(e.xPos+e.width+n,s)+t.utils.svgPaths.lineOnAxis("v",e.height)+t.utils.svgPaths.lineOnAxis("h",-o)+t.utils.svgPaths.moveTo(i,r+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)},t.geras.InlineInput=function(e,n){t.geras.InlineInput.superClass_.constructor.call(this,e,n),this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)},t.utils.object.inherits(t.geras.InlineInput,t.blockRendering.InlineInput),t.geras.StatementInput=function(e,n){t.geras.StatementInput.superClass_.constructor.call(this,e,n),this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)},t.utils.object.inherits(t.geras.StatementInput,t.blockRendering.StatementInput),t.geras.RenderInfo=function(e,n){t.geras.RenderInfo.superClass_.constructor.call(this,e,n)},t.utils.object.inherits(t.geras.RenderInfo,t.blockRendering.RenderInfo),t.geras.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.geras.RenderInfo.prototype.populateBottomRow_=function(){t.geras.RenderInfo.superClass_.populateBottomRow_.call(this),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==t.inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)},t.geras.RenderInfo.prototype.addInput_=function(e,n){this.isInline&&e.type==t.inputTypes.VALUE?(n.elements.push(new t.geras.InlineInput(this.constants_,e)),n.hasInlineInput=!0):e.type==t.inputTypes.STATEMENT?(n.elements.push(new t.geras.StatementInput(this.constants_,e)),n.hasStatement=!0):e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.ExternalValueInput(this.constants_,e)),n.hasExternalInput=!0):e.type==t.inputTypes.DUMMY&&(n.minHeight=Math.max(n.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),n.hasDummyInput=!0),this.isInline||null!=n.align||(n.align=e.align)},t.geras.RenderInfo.prototype.addElemSpacing_=function(){for(var e,n=!1,i=0;e=this.rows[i];i++)e.hasExternalInput&&(n=!0);for(i=0;e=this.rows[i];i++){var r=e.elements;if(e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,r[0]))),r.length){for(var o=0;o<r.length-1;o++){e.elements.push(r[o]);var s=this.getInRowSpacing_(r[o],r[o+1]);e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,s))}e.elements.push(r[r.length-1]),e.endsWithElemSpacer()&&(s=this.getInRowSpacing_(r[r.length-1],null),n&&e.hasDummyInput&&(s+=this.constants_.TAB_WIDTH),e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,s)))}}},t.geras.RenderInfo.prototype.getInRowSpacing_=function(e,n){if(!e)return n&&t.blockRendering.Types.isField(n)&&n.isEditable?this.constants_.MEDIUM_PADDING:n&&t.blockRendering.Types.isInlineInput(n)?this.constants_.MEDIUM_LARGE_PADDING:n&&t.blockRendering.Types.isStatementInput(n)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!t.blockRendering.Types.isInput(e)&&(!n||t.blockRendering.Types.isStatementInput(n)))return t.blockRendering.Types.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:t.blockRendering.Types.isIcon(e)?2*this.constants_.LARGE_PADDING+1:t.blockRendering.Types.isHat(e)?this.constants_.NO_PADDING:t.blockRendering.Types.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:t.blockRendering.Types.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:t.blockRendering.Types.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isInput(e)&&!n){if(t.blockRendering.Types.isExternalInput(e))return this.constants_.NO_PADDING;if(t.blockRendering.Types.isInlineInput(e))return this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isStatementInput(e))return this.constants_.NO_PADDING}if(!t.blockRendering.Types.isInput(e)&&n&&t.blockRendering.Types.isInput(n)){if(t.blockRendering.Types.isField(e)&&e.isEditable){if(t.blockRendering.Types.isInlineInput(n)||t.blockRendering.Types.isExternalInput(n))return this.constants_.SMALL_PADDING}else{if(t.blockRendering.Types.isInlineInput(n)||t.blockRendering.Types.isExternalInput(n))return this.constants_.MEDIUM_LARGE_PADDING;if(t.blockRendering.Types.isStatementInput(n))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(t.blockRendering.Types.isIcon(e)&&n&&!t.blockRendering.Types.isInput(n))return this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isInlineInput(e)&&n&&t.blockRendering.Types.isField(n))return n.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isLeftSquareCorner(e)&&n){if(t.blockRendering.Types.isHat(n))return this.constants_.NO_PADDING;if(t.blockRendering.Types.isPreviousConnection(n))return n.notchOffset;if(t.blockRendering.Types.isNextConnection(n))return e=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,n.notchOffset+e}if(t.blockRendering.Types.isLeftRoundedCorner(e)&&n){if(t.blockRendering.Types.isPreviousConnection(n))return n.notchOffset-this.constants_.CORNER_RADIUS;if(t.blockRendering.Types.isNextConnection(n))return e=(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2,n.notchOffset-this.constants_.CORNER_RADIUS+e}return t.blockRendering.Types.isField(e)&&n&&t.blockRendering.Types.isField(n)&&e.isEditable==n.isEditable||n&&t.blockRendering.Types.isJaggedEdge(n)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING},t.geras.RenderInfo.prototype.getSpacerRowHeight_=function(e,n){return t.blockRendering.Types.isTopRow(e)&&t.blockRendering.Types.isBottomRow(n)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:t.blockRendering.Types.isTopRow(e)||t.blockRendering.Types.isBottomRow(n)?this.constants_.NO_PADDING:e.hasExternalInput&&n.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&n.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&n.hasStatement||!e.hasStatement&&n.hasDummyInput||e.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING},t.geras.RenderInfo.prototype.getElemCenterline_=function(e,n){if(t.blockRendering.Types.isSpacer(n))return e.yPos+n.height/2;if(t.blockRendering.Types.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,t.blockRendering.Types.isNextConnection(n)?e+n.height/2:e-n.height/2;if(t.blockRendering.Types.isTopRow(e))return t.blockRendering.Types.isHat(n)?e.capline-n.height/2:e.capline+n.height/2;var i=e.yPos;return t.blockRendering.Types.isField(n)||t.blockRendering.Types.isIcon(n)?(i+=n.height/2,(e.hasInlineInput||e.hasStatement)&&n.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(i+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):i=t.blockRendering.Types.isInlineInput(n)?i+n.height/2:i+e.height/2,i},t.geras.RenderInfo.prototype.alignRowElements_=function(){if(this.isInline){for(var e,n=0,i=null,r=this.rows.length-1;e=this.rows[r];r--)e.nextRightEdge=n,t.blockRendering.Types.isInputRow(e)&&(e.hasStatement&&this.alignStatementRow_(e),i&&i.hasStatement&&e.width<i.width?e.nextRightEdge=i.width:n=e.width,i=e);for(r=n=0;e=this.rows[r];r++)e.hasStatement?n=this.getDesiredRowWidth_(e):t.blockRendering.Types.isSpacer(e)?e.width=Math.max(n,e.nextRightEdge):(0<(n=Math.max(n,e.nextRightEdge)-e.width)&&this.addAlignmentPadding_(e,n),n=e.width)}else t.geras.RenderInfo.superClass_.alignRowElements_.call(this)},t.geras.RenderInfo.prototype.getDesiredRowWidth_=function(e){return this.isInline&&e.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:t.geras.RenderInfo.superClass_.getDesiredRowWidth_.call(this,e)},t.geras.RenderInfo.prototype.finalize_=function(){for(var t,e=0,n=0,i=0;t=this.rows[i];i++){t.yPos=n,t.xPos=this.startX,n+=t.height,e=Math.max(e,t.widthWithConnectedBlocks);var r=n-this.topRow.ascenderHeight;t==this.bottomRow&&r<this.constants_.MIN_BLOCK_HEIGHT&&(r=this.constants_.MIN_BLOCK_HEIGHT-r,this.bottomRow.height+=r,n+=r),this.recordElemPositions_(t)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(e=Math.max(e,this.block_.nextConnection.targetBlock().getHeightWidth().width-this.constants_.DARK_PATH_OFFSET)),this.bottomRow.baseline=n-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX+this.constants_.DARK_PATH_OFFSET,this.width+=this.constants_.DARK_PATH_OFFSET,this.height=n+this.constants_.DARK_PATH_OFFSET,this.startY=this.topRow.capline},t.geras.Drawer=function(e,n){t.geras.Drawer.superClass_.constructor.call(this,e,n),this.highlighter_=new t.geras.Highlighter(n)},t.utils.object.inherits(t.geras.Drawer,t.blockRendering.Drawer),t.geras.Drawer.prototype.draw=function(){this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_();var e=this.block_.pathObject;e.setPath(this.outlinePath_+"\n"+this.inlinePath_),e.setHighlightPath(this.highlighter_.getPath()),this.info_.RTL&&e.flipRTL(),t.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_()},t.geras.Drawer.prototype.drawTop_=function(){this.highlighter_.drawTopCorner(this.info_.topRow),this.highlighter_.drawRightSideRow(this.info_.topRow),t.geras.Drawer.superClass_.drawTop_.call(this)},t.geras.Drawer.prototype.drawJaggedEdge_=function(e){this.highlighter_.drawJaggedEdge_(e),t.geras.Drawer.superClass_.drawJaggedEdge_.call(this,e)},t.geras.Drawer.prototype.drawValueInput_=function(e){this.highlighter_.drawValueInput(e),t.geras.Drawer.superClass_.drawValueInput_.call(this,e)},t.geras.Drawer.prototype.drawStatementInput_=function(e){this.highlighter_.drawStatementInput(e),t.geras.Drawer.superClass_.drawStatementInput_.call(this,e)},t.geras.Drawer.prototype.drawRightSideRow_=function(e){this.highlighter_.drawRightSideRow(e),this.outlinePath_+=t.utils.svgPaths.lineOnAxis("H",e.xPos+e.width)+t.utils.svgPaths.lineOnAxis("V",e.yPos+e.height)},t.geras.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow),t.geras.Drawer.superClass_.drawBottom_.call(this)},t.geras.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft(),t.geras.Drawer.superClass_.drawLeft_.call(this)},t.geras.Drawer.prototype.drawInlineInput_=function(e){this.highlighter_.drawInlineInput(e),t.geras.Drawer.superClass_.drawInlineInput_.call(this,e)},t.geras.Drawer.prototype.positionInlineInputConnection_=function(t){var e=t.centerline-t.height/2;if(t.connectionModel){var n=t.xPos+t.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),t.connectionModel.setOffsetInBlock(n,e+t.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}},t.geras.Drawer.prototype.positionStatementInputConnection_=function(t){var e=t.getLastInput();if(e.connectionModel){var n=t.xPos+t.statementEdge+e.notchOffset;n=this.info_.RTL?-1*n:n+this.constants_.DARK_PATH_OFFSET,e.connectionModel.setOffsetInBlock(n,t.yPos+this.constants_.DARK_PATH_OFFSET)}},t.geras.Drawer.prototype.positionExternalValueConnection_=function(t){var e=t.getLastInput();if(e.connectionModel){var n=t.xPos+t.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(n*=-1),e.connectionModel.setOffsetInBlock(n,t.yPos)}},t.geras.Drawer.prototype.positionNextConnection_=function(){var t=this.info_.bottomRow;if(t.connection){var e=t.connection,n=e.xPos;e.connectionModel.setOffsetInBlock((this.info_.RTL?-n:n)+this.constants_.DARK_PATH_OFFSET/2,t.baseline+this.constants_.DARK_PATH_OFFSET)}},t.geras.HighlightConstantProvider=function(e){this.constantProvider=e,this.OFFSET=.5,this.START_POINT=t.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET)},t.geras.HighlightConstantProvider.prototype.init=function(){this.INSIDE_CORNER=this.makeInsideCorner(),this.OUTSIDE_CORNER=this.makeOutsideCorner(),this.PUZZLE_TAB=this.makePuzzleTab(),this.NOTCH=this.makeNotch(),this.JAGGED_TEETH=this.makeJaggedTeeth(),this.START_HAT=this.makeStartHat()},t.geras.HighlightConstantProvider.prototype.makeInsideCorner=function(){var e=this.constantProvider.CORNER_RADIUS,n=this.OFFSET,i=(1-Math.SQRT1_2)*(e+n)-n,r=t.utils.svgPaths.moveBy(i,i)+t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(-i-n,e-i)),o=t.utils.svgPaths.arc("a","0 0,0",e+n,t.utils.svgPaths.point(e+n,e+n)),s=t.utils.svgPaths.moveBy(i,-i)+t.utils.svgPaths.arc("a","0 0,0",e+n,t.utils.svgPaths.point(e-i,i+n));return{width:e+n,height:e,pathTop:function(t){return t?r:""},pathBottom:function(t){return t?o:s}}},t.geras.HighlightConstantProvider.prototype.makeOutsideCorner=function(){var e=this.constantProvider.CORNER_RADIUS,n=this.OFFSET,i=(1-Math.SQRT1_2)*(e-n)+n,r=t.utils.svgPaths.moveBy(i,i)+t.utils.svgPaths.arc("a","0 0,1",e-n,t.utils.svgPaths.point(e-i,-i+n)),o=t.utils.svgPaths.moveBy(n,e)+t.utils.svgPaths.arc("a","0 0,1",e-n,t.utils.svgPaths.point(e,-e+n)),s=-i,a=t.utils.svgPaths.moveBy(i,s)+t.utils.svgPaths.arc("a","0 0,1",e-n,t.utils.svgPaths.point(-i+n,-s-e));return{height:e,topLeft:function(t){return t?r:o},bottomLeft:function(){return a}}},t.geras.HighlightConstantProvider.prototype.makePuzzleTab=function(){var e=this.constantProvider.TAB_WIDTH,n=this.constantProvider.TAB_HEIGHT,i=t.utils.svgPaths.moveBy(-2,3.4-n)+t.utils.svgPaths.lineTo(-.45*e,-2.1),r=t.utils.svgPaths.lineOnAxis("v",2.5)+t.utils.svgPaths.moveBy(.97*-e,2.5)+t.utils.svgPaths.curve("q",[t.utils.svgPaths.point(.05*-e,10),t.utils.svgPaths.point(.3*e,9.5)])+t.utils.svgPaths.moveBy(.67*e,-1.9)+t.utils.svgPaths.lineOnAxis("v",2.5),o=t.utils.svgPaths.lineOnAxis("v",-1.5)+t.utils.svgPaths.moveBy(-.92*e,-.5)+t.utils.svgPaths.curve("q",[t.utils.svgPaths.point(-.19*e,-5.5),t.utils.svgPaths.point(0,-11)])+t.utils.svgPaths.moveBy(.92*e,1),s=t.utils.svgPaths.moveBy(-5,n-.7)+t.utils.svgPaths.lineTo(.46*e,-2.1);return{width:e,height:n,pathUp:function(t){return t?i:o},pathDown:function(t){return t?r:s}}},t.geras.HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:t.utils.svgPaths.lineOnAxis("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}},t.geras.HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:t.utils.svgPaths.lineTo(5.1,2.6)+t.utils.svgPaths.moveBy(-10.2,6.8)+t.utils.svgPaths.lineTo(5.1,2.6),height:12,width:10.2}},t.geras.HighlightConstantProvider.prototype.makeStartHat=function(){var e=this.constantProvider.START_HAT.height,n=t.utils.svgPaths.moveBy(25,-8.7)+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(29.7,-6.2),t.utils.svgPaths.point(57.2,-.5),t.utils.svgPaths.point(75,8.7)]),i=t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(17.8,-9.2),t.utils.svgPaths.point(45.3,-14.9),t.utils.svgPaths.point(75,-8.7)])+t.utils.svgPaths.moveTo(100.5,e+.5);return{path:function(t){return t?n:i}}},t.geras.PathObject=function(e,n,i){this.constants=i,this.svgRoot=e,this.svgPathDark=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot),this.svgPath=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyPath"},this.svgRoot),this.svgPathLight=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyPathLight"},this.svgRoot),this.colourDark="#000000",this.style=n},t.utils.object.inherits(t.geras.PathObject,t.blockRendering.PathObject),t.geras.PathObject.prototype.setPath=function(t){this.svgPath.setAttribute("d",t),this.svgPathDark.setAttribute("d",t)},t.geras.PathObject.prototype.setHighlightPath=function(t){this.svgPathLight.setAttribute("d",t)},t.geras.PathObject.prototype.flipRTL=function(){this.svgPath.setAttribute("transform","scale(-1 1)"),this.svgPathLight.setAttribute("transform","scale(-1 1)"),this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")},t.geras.PathObject.prototype.applyColour=function(e){this.svgPathLight.style.display="",this.svgPathDark.style.display="",this.svgPathLight.setAttribute("stroke",this.style.colourTertiary),this.svgPathDark.setAttribute("fill",this.colourDark),t.geras.PathObject.superClass_.applyColour.call(this,e),this.svgPath.setAttribute("stroke","none")},t.geras.PathObject.prototype.setStyle=function(e){this.style=e,this.colourDark=t.utils.colour.blend("#000",this.style.colourPrimary,.2)||this.colourDark},t.geras.PathObject.prototype.updateHighlighted=function(t){t?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")},t.geras.PathObject.prototype.updateShadow_=function(t){t&&(this.svgPathLight.style.display="none",this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))},t.geras.PathObject.prototype.updateDisabled_=function(e){t.geras.PathObject.superClass_.updateDisabled_.call(this,e),e&&this.svgPath.setAttribute("stroke","none")},t.geras.Renderer=function(e){t.geras.Renderer.superClass_.constructor.call(this,e),this.highlightConstants_=null},t.utils.object.inherits(t.geras.Renderer,t.blockRendering.Renderer),t.geras.Renderer.prototype.init=function(e,n){t.geras.Renderer.superClass_.init.call(this,e,n),this.highlightConstants_=this.makeHighlightConstants_(),this.highlightConstants_.init()},t.geras.Renderer.prototype.refreshDom=function(e,n){t.geras.Renderer.superClass_.refreshDom.call(this,e,n),this.getHighlightConstants().init()},t.geras.Renderer.prototype.makeConstants_=function(){return new t.geras.ConstantProvider},t.geras.Renderer.prototype.makeRenderInfo_=function(e){return new t.geras.RenderInfo(this,e)},t.geras.Renderer.prototype.makeDrawer_=function(e,n){return new t.geras.Drawer(e,n)},t.geras.Renderer.prototype.makePathObject=function(e,n){return new t.geras.PathObject(e,n,this.getConstants())},t.geras.Renderer.prototype.makeHighlightConstants_=function(){return new t.geras.HighlightConstantProvider(this.getConstants())},t.geras.Renderer.prototype.getHighlightConstants=function(){return this.highlightConstants_},t.blockRendering.register("geras",t.geras.Renderer),t.thrasos={},t.thrasos.RenderInfo=function(e,n){t.thrasos.RenderInfo.superClass_.constructor.call(this,e,n)},t.utils.object.inherits(t.thrasos.RenderInfo,t.blockRendering.RenderInfo),t.thrasos.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.thrasos.RenderInfo.prototype.addElemSpacing_=function(){for(var e,n=!1,i=0;e=this.rows[i];i++)e.hasExternalInput&&(n=!0);for(i=0;e=this.rows[i];i++){var r=e.elements;e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,r[0])));for(var o=0;o<r.length-1;o++){e.elements.push(r[o]);var s=this.getInRowSpacing_(r[o],r[o+1]);e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,s))}e.elements.push(r[r.length-1]),e.endsWithElemSpacer()&&(s=this.getInRowSpacing_(r[r.length-1],null),n&&e.hasDummyInput&&(s+=this.constants_.TAB_WIDTH),e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,s)))}},t.thrasos.RenderInfo.prototype.getInRowSpacing_=function(e,n){if(!e)return n&&t.blockRendering.Types.isField(n)&&n.isEditable?this.constants_.MEDIUM_PADDING:n&&t.blockRendering.Types.isInlineInput(n)?this.constants_.MEDIUM_LARGE_PADDING:n&&t.blockRendering.Types.isStatementInput(n)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!t.blockRendering.Types.isInput(e)&&!n)return t.blockRendering.Types.isField(e)&&e.isEditable?this.constants_.MEDIUM_PADDING:t.blockRendering.Types.isIcon(e)?2*this.constants_.LARGE_PADDING+1:t.blockRendering.Types.isHat(e)?this.constants_.NO_PADDING:t.blockRendering.Types.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:t.blockRendering.Types.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:t.blockRendering.Types.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isInput(e)&&!n){if(t.blockRendering.Types.isExternalInput(e))return this.constants_.NO_PADDING;if(t.blockRendering.Types.isInlineInput(e))return this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isStatementInput(e))return this.constants_.NO_PADDING}if(!t.blockRendering.Types.isInput(e)&&n&&t.blockRendering.Types.isInput(n)){if(t.blockRendering.Types.isField(e)&&e.isEditable){if(t.blockRendering.Types.isInlineInput(n)||t.blockRendering.Types.isExternalInput(n))return this.constants_.SMALL_PADDING}else{if(t.blockRendering.Types.isInlineInput(n)||t.blockRendering.Types.isExternalInput(n))return this.constants_.MEDIUM_LARGE_PADDING;if(t.blockRendering.Types.isStatementInput(n))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(t.blockRendering.Types.isIcon(e)&&n&&!t.blockRendering.Types.isInput(n))return this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isInlineInput(e)&&n&&t.blockRendering.Types.isField(n))return n.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(t.blockRendering.Types.isLeftSquareCorner(e)&&n){if(t.blockRendering.Types.isHat(n))return this.constants_.NO_PADDING;if(t.blockRendering.Types.isPreviousConnection(n)||t.blockRendering.Types.isNextConnection(n))return n.notchOffset}return t.blockRendering.Types.isLeftRoundedCorner(e)&&n?n.notchOffset-this.constants_.CORNER_RADIUS:t.blockRendering.Types.isField(e)&&n&&t.blockRendering.Types.isField(n)&&e.isEditable==n.isEditable||n&&t.blockRendering.Types.isJaggedEdge(n)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING},t.thrasos.RenderInfo.prototype.getSpacerRowHeight_=function(e,n){return t.blockRendering.Types.isTopRow(e)&&t.blockRendering.Types.isBottomRow(n)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:t.blockRendering.Types.isTopRow(e)||t.blockRendering.Types.isBottomRow(n)?this.constants_.NO_PADDING:e.hasExternalInput&&n.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&n.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&n.hasStatement||e.hasDummyInput||n.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING},t.thrasos.RenderInfo.prototype.getElemCenterline_=function(e,n){if(t.blockRendering.Types.isSpacer(n))return e.yPos+n.height/2;if(t.blockRendering.Types.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,t.blockRendering.Types.isNextConnection(n)?e+n.height/2:e-n.height/2;if(t.blockRendering.Types.isTopRow(e))return t.blockRendering.Types.isHat(n)?e.capline-n.height/2:e.capline+n.height/2;var i=e.yPos;return t.blockRendering.Types.isField(n)&&e.hasStatement?i+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+n.height/2):i+e.height/2},t.thrasos.RenderInfo.prototype.finalize_=function(){for(var t,e=0,n=0,i=0;t=this.rows[i];i++){t.yPos=n,t.xPos=this.startX,n+=t.height,e=Math.max(e,t.widthWithConnectedBlocks);var r=n-this.topRow.ascenderHeight;t==this.bottomRow&&r<this.constants_.MIN_BLOCK_HEIGHT&&(r=this.constants_.MIN_BLOCK_HEIGHT-r,this.bottomRow.height+=r,n+=r),this.recordElemPositions_(t)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(e=Math.max(e,this.block_.nextConnection.targetBlock().getHeightWidth().width)),this.bottomRow.baseline=n-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=n,this.startY=this.topRow.capline},t.thrasos.Renderer=function(e){t.thrasos.Renderer.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.thrasos.Renderer,t.blockRendering.Renderer),t.thrasos.Renderer.prototype.makeRenderInfo_=function(e){return new t.thrasos.RenderInfo(this,e)},t.blockRendering.register("thrasos",t.thrasos.Renderer),t.zelos={},t.zelos.ConstantProvider=function(){t.zelos.ConstantProvider.superClass_.constructor.call(this),this.SMALL_PADDING=this.GRID_UNIT=4,this.MEDIUM_PADDING=2*this.GRID_UNIT,this.MEDIUM_LARGE_PADDING=3*this.GRID_UNIT,this.LARGE_PADDING=4*this.GRID_UNIT,this.CORNER_RADIUS=1*this.GRID_UNIT,this.NOTCH_WIDTH=9*this.GRID_UNIT,this.NOTCH_HEIGHT=2*this.GRID_UNIT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=3*this.GRID_UNIT,this.MIN_BLOCK_WIDTH=2*this.GRID_UNIT,this.MIN_BLOCK_HEIGHT=12*this.GRID_UNIT,this.EMPTY_STATEMENT_INPUT_HEIGHT=6*this.GRID_UNIT,this.TAB_OFFSET_FROM_TOP=0,this.TOP_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING,this.BOTTOM_ROW_MIN_HEIGHT=this.CORNER_RADIUS,this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=6*this.GRID_UNIT,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT,this.STATEMENT_INPUT_SPACER_MIN_WIDTH=40*this.GRID_UNIT,this.STATEMENT_INPUT_PADDING_LEFT=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_PADDING=4*this.GRID_UNIT,this.EMPTY_INLINE_INPUT_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_MIN_HEIGHT=8*this.GRID_UNIT,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=6*this.GRID_UNIT,this.CURSOR_WS_WIDTH=20*this.GRID_UNIT,this.CURSOR_COLOUR="#ffa200",this.CURSOR_RADIUS=5,this.JAGGED_TEETH_WIDTH=this.JAGGED_TEETH_HEIGHT=0,this.START_HAT_HEIGHT=22,this.START_HAT_WIDTH=96,this.SHAPES={HEXAGONAL:1,ROUND:2,SQUARE:3,PUZZLE:4,NOTCH:5},this.SHAPE_IN_SHAPE_PADDING={1:{0:5*this.GRID_UNIT,1:2*this.GRID_UNIT,2:5*this.GRID_UNIT,3:5*this.GRID_UNIT},2:{0:3*this.GRID_UNIT,1:3*this.GRID_UNIT,2:1*this.GRID_UNIT,3:2*this.GRID_UNIT},3:{0:2*this.GRID_UNIT,1:2*this.GRID_UNIT,2:2*this.GRID_UNIT,3:2*this.GRID_UNIT}},this.FULL_BLOCK_FIELDS=!0,this.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,this.FIELD_TEXT_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_BORDER_RECT_RADIUS=this.CORNER_RADIUS,this.FIELD_BORDER_RECT_X_PADDING=2*this.GRID_UNIT,this.FIELD_BORDER_RECT_Y_PADDING=1.625*this.GRID_UNIT,this.FIELD_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=8*this.GRID_UNIT,this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!0,this.FIELD_COLOUR_DEFAULT_WIDTH=2*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=4*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT,this.SELECTED_GLOW_COLOUR="#fff200",this.SELECTED_GLOW_SIZE=.5,this.REPLACEMENT_GLOW_COLOUR="#fff200",this.REPLACEMENT_GLOW_SIZE=2,this.selectedGlowFilterId="",this.selectedGlowFilter_=null,this.replacementGlowFilterId="",this.replacementGlowFilter_=null},t.utils.object.inherits(t.zelos.ConstantProvider,t.blockRendering.ConstantProvider),t.zelos.ConstantProvider.prototype.setFontConstants_=function(e){t.zelos.ConstantProvider.superClass_.setFontConstants_.call(this,e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING},t.zelos.ConstantProvider.prototype.init=function(){t.zelos.ConstantProvider.superClass_.init.call(this),this.HEXAGONAL=this.makeHexagonal(),this.ROUNDED=this.makeRounded(),this.SQUARED=this.makeSquared(),this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT+this.INSIDE_CORNERS.rightWidth},t.zelos.ConstantProvider.prototype.setDynamicProperties_=function(e){t.zelos.ConstantProvider.superClass_.setDynamicProperties_.call(this,e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;var n=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=n&&!isNaN(n)?n:this.SELECTED_GLOW_SIZE,this.REPLACEMENT_GLOW_COLOUR=e.getComponentStyle("replacementGlowColour")||this.REPLACEMENT_GLOW_COLOUR,this.REPLACEMENT_GLOW_SIZE=(e=Number(e.getComponentStyle("replacementGlowSize")))&&!isNaN(e)?e:this.REPLACEMENT_GLOW_SIZE},t.zelos.ConstantProvider.prototype.dispose=function(){t.zelos.ConstantProvider.superClass_.dispose.call(this),this.selectedGlowFilter_&&t.utils.dom.removeNode(this.selectedGlowFilter_),this.replacementGlowFilter_&&t.utils.dom.removeNode(this.replacementGlowFilter_)},t.zelos.ConstantProvider.prototype.makeStartHat=function(){var e=this.START_HAT_HEIGHT,n=this.START_HAT_WIDTH;return{height:e,width:n,path:t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(25,-e),t.utils.svgPaths.point(71,-e),t.utils.svgPaths.point(n,0)])}},t.zelos.ConstantProvider.prototype.makeHexagonal=function(){function e(e,i,r){var o=e/2;return o=o>n?n:o,r=r?-1:1,e=(i?-1:1)*e/2,t.utils.svgPaths.lineTo(-r*o,e)+t.utils.svgPaths.lineTo(r*o,e)}var n=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:function(t){return(t/=2)>n?n:t},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.makeRounded=function(){function e(e,n,r){var o=e>i?e-i:0;return e=(e>i?i:e)/2,t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point((n?-1:1)*e,(n?-1:1)*e))+t.utils.svgPaths.lineOnAxis("v",(r?1:-1)*o)+t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point((n?1:-1)*e,(n?-1:1)*e))}var n=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,i=2*n;return{type:this.SHAPES.ROUND,isDynamic:!0,width:function(t){return(t/=2)>n?n:t},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.makeSquared=function(){function e(e,i,r){return e-=2*n,t.utils.svgPaths.arc("a","0 0,1",n,t.utils.svgPaths.point((i?-1:1)*n,(i?-1:1)*n))+t.utils.svgPaths.lineOnAxis("v",(r?1:-1)*e)+t.utils.svgPaths.arc("a","0 0,1",n,t.utils.svgPaths.point((i?1:-1)*n,(i?-1:1)*n))}var n=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:function(t){return n},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.shapeFor=function(e){var n=e.getCheck();switch(!n&&e.targetConnection&&(n=e.targetConnection.getCheck()),e.type){case t.connectionTypes.INPUT_VALUE:case t.connectionTypes.OUTPUT_VALUE:if(null!=(e=e.getSourceBlock().getOutputShape()))switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}return n&&-1!=n.indexOf("Boolean")?this.HEXAGONAL:n&&-1!=n.indexOf("Number")?this.ROUNDED:(n&&n.indexOf("String"),this.ROUNDED);case t.connectionTypes.PREVIOUS_STATEMENT:case t.connectionTypes.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}},t.zelos.ConstantProvider.prototype.makeNotch=function(){function e(e){return t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/2,0),t.utils.svgPaths.point(e*o*3/4,a/2),t.utils.svgPaths.point(e*o,a)])+t.utils.svgPaths.line([t.utils.svgPaths.point(e*o,s)])+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/4,a/2),t.utils.svgPaths.point(e*o/2,a),t.utils.svgPaths.point(e*o,a)])+t.utils.svgPaths.lineOnAxis("h",e*r)+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/2,0),t.utils.svgPaths.point(e*o*3/4,-a/2),t.utils.svgPaths.point(e*o,-a)])+t.utils.svgPaths.line([t.utils.svgPaths.point(e*o,-s)])+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/4,-a/2),t.utils.svgPaths.point(e*o/2,-a),t.utils.svgPaths.point(e*o,-a)])}var n=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,r=n/3,o=r/3,s=i/2,a=s/2,l=e(1),u=e(-1);return{type:this.SHAPES.NOTCH,width:n,height:i,pathLeft:l,pathRight:u}},t.zelos.ConstantProvider.prototype.makeInsideCorners=function(){var e=this.CORNER_RADIUS,n=t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(-e,e)),i=t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(-e,e));return{width:e,height:e,pathTop:n,pathBottom:t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(e,e)),rightWidth:e,rightHeight:e,pathTopRight:i,pathBottomRight:t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(e,e))}},t.zelos.ConstantProvider.prototype.generateSecondaryColour_=function(e){return t.utils.colour.blend("#000",e,.15)||e},t.zelos.ConstantProvider.prototype.generateTertiaryColour_=function(e){return t.utils.colour.blend("#000",e,.25)||e},t.zelos.ConstantProvider.prototype.createDom=function(e,n,i){t.zelos.ConstantProvider.superClass_.createDom.call(this,e,n,i),e=t.utils.dom.createSvgElement(t.utils.Svg.DEFS,{},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},n),i=t.utils.dom.createSvgElement(t.utils.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},i),t.utils.dom.createSvgElement(t.utils.Svg.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},n),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},n),this.selectedGlowFilterId=n.id,this.selectedGlowFilter_=n,e=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter_=e},t.zelos.ConstantProvider.prototype.getCSS_=function(t){return[t+" .blocklyText,",t+" .blocklyFlyoutLabelText {","font: "+this.FIELD_TEXT_FONTWEIGHT+" "+this.FIELD_TEXT_FONTSIZE+"pt "+this.FIELD_TEXT_FONTFAMILY+";","}",t+" .blocklyText {","fill: #fff;","}",t+" .blocklyNonEditableText>rect:not(.blocklyDropdownRect),",t+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",t+" .blocklyNonEditableText>text,",t+" .blocklyEditableText>text,",t+" .blocklyNonEditableText>g>text,",t+" .blocklyEditableText>g>text {","fill: #575E75;","}",t+" .blocklyFlyoutLabelText {","fill: #575E75;","}",t+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",t+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect,",t+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",t+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",t+" .blocklyDropdownText {","fill: #fff !important;","}",t+".blocklyWidgetDiv .goog-menuitem,",t+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",t+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",t+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",t+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier+")","}",t+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},t.zelos.TopRow=function(e){t.zelos.TopRow.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.zelos.TopRow,t.blockRendering.TopRow),t.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1},t.zelos.TopRow.prototype.hasLeftSquareCorner=function(t){var e=(t.hat?"cap"===t.hat:this.constants_.ADD_START_HATS)&&!t.outputConnection&&!t.previousConnection;return!!t.outputConnection||e},t.zelos.TopRow.prototype.hasRightSquareCorner=function(t){return!!t.outputConnection&&!t.statementInputCount&&!t.nextConnection},t.zelos.BottomRow=function(e){t.zelos.BottomRow.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.zelos.BottomRow,t.blockRendering.BottomRow),t.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1},t.zelos.BottomRow.prototype.hasLeftSquareCorner=function(t){return!!t.outputConnection},t.zelos.BottomRow.prototype.hasRightSquareCorner=function(t){return!!t.outputConnection&&!t.statementInputCount&&!t.nextConnection},t.zelos.RightConnectionShape=function(e){t.zelos.RightConnectionShape.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.getType("RIGHT_CONNECTION"),this.width=this.height=0},t.utils.object.inherits(t.zelos.RightConnectionShape,t.blockRendering.Measurable),t.zelos.RenderInfo=function(e,n){t.zelos.RenderInfo.superClass_.constructor.call(this,e,n),this.topRow=new t.zelos.TopRow(this.constants_),this.bottomRow=new t.zelos.BottomRow(this.constants_),this.isInline=!0,this.isMultiRow=!n.getInputsInline()||n.isCollapsed(),this.hasStatementInput=0<n.statementInputCount,this.rightSide=this.outputConnection?new t.zelos.RightConnectionShape(this.constants_):null},t.utils.object.inherits(t.zelos.RenderInfo,t.blockRendering.RenderInfo),t.zelos.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.zelos.RenderInfo.prototype.measure=function(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.adjustXPosition_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()},t.zelos.RenderInfo.prototype.shouldStartNewRow_=function(e,n){return!!n&&(e.type==t.inputTypes.STATEMENT||n.type==t.inputTypes.STATEMENT||(e.type==t.inputTypes.VALUE||e.type==t.inputTypes.DUMMY)&&(!this.isInline||this.isMultiRow))},t.zelos.RenderInfo.prototype.getDesiredRowWidth_=function(e){return e.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):t.zelos.RenderInfo.superClass_.getDesiredRowWidth_.call(this,e)},t.zelos.RenderInfo.prototype.getInRowSpacing_=function(e,n){return e&&n||!this.outputConnection||!this.outputConnection.isDynamicShape||this.hasStatementInput||this.bottomRow.hasNextConnection?!e&&n&&t.blockRendering.Types.isStatementInput(n)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&t.blockRendering.Types.isLeftRoundedCorner(e)&&n&&(t.blockRendering.Types.isPreviousConnection(n)||t.blockRendering.Types.isNextConnection(n))?n.notchOffset-this.constants_.CORNER_RADIUS:e&&t.blockRendering.Types.isLeftSquareCorner(e)&&n&&t.blockRendering.Types.isHat(n)?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING},t.zelos.RenderInfo.prototype.getSpacerRowHeight_=function(e,n){if(t.blockRendering.Types.isTopRow(e)&&t.blockRendering.Types.isBottomRow(n))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;var i=t.blockRendering.Types.isInputRow(e)&&e.hasStatement,r=t.blockRendering.Types.isInputRow(n)&&n.hasStatement;return r||i?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),r&&i?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):t.blockRendering.Types.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):t.blockRendering.Types.isBottomRow(n)?this.outputConnection?!n.hasNextConnection&&this.hasStatementInput?Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):this.constants_.NO_PADDING:Math.max(this.topRow.minHeight,Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.CORNER_RADIUS))-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING},t.zelos.RenderInfo.prototype.getSpacerRowWidth_=function(e,n){var i=this.width-this.startX;return t.blockRendering.Types.isInputRow(e)&&e.hasStatement||t.blockRendering.Types.isInputRow(n)&&n.hasStatement?Math.max(i,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):i},t.zelos.RenderInfo.prototype.getElemCenterline_=function(e,n){if(e.hasStatement&&!t.blockRendering.Types.isSpacer(n)&&!t.blockRendering.Types.isStatementInput(n))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(t.blockRendering.Types.isInlineInput(n)){var i=n.connectedBlock;if(i&&i.outputConnection&&i.nextConnection)return e.yPos+i.height/2}return t.zelos.RenderInfo.superClass_.getElemCenterline_.call(this,e,n)},t.zelos.RenderInfo.prototype.addInput_=function(e,n){e.type==t.inputTypes.DUMMY&&n.hasDummyInput&&n.align==t.constants.ALIGN.LEFT&&e.align==t.constants.ALIGN.RIGHT&&(n.rightAlignedDummyInput=e),t.zelos.RenderInfo.superClass_.addInput_.call(this,e,n)},t.zelos.RenderInfo.prototype.addAlignmentPadding_=function(e,n){if(e.rightAlignedDummyInput){for(var i,r,o=0;(r=e.elements[o])&&(t.blockRendering.Types.isSpacer(r)&&(i=r),!t.blockRendering.Types.isField(r)||r.parentInput!=e.rightAlignedDummyInput);o++);if(i)return i.width+=n,void(e.width+=n)}t.zelos.RenderInfo.superClass_.addAlignmentPadding_.call(this,e,n)},t.zelos.RenderInfo.prototype.adjustXPosition_=function(){for(var e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH,n=e,i=2;i<this.rows.length-1;i+=2){var r=this.rows[i-1],o=this.rows[i],s=this.rows[i+1];if(r=2==i?!!this.topRow.hasPreviousConnection:!!r.followsStatement,s=i+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!s.precedesStatement,t.blockRendering.Types.isInputRow(o)&&o.hasStatement)o.measure(),n=o.width-o.getLastInput().width+e;else if(r&&(2==i||s)&&t.blockRendering.Types.isInputRow(o)&&!o.hasStatement){s=o.xPos,r=null;for(var a,l=0;a=o.elements[l];l++)t.blockRendering.Types.isSpacer(a)&&(r=a),!(r&&(t.blockRendering.Types.isField(a)||t.blockRendering.Types.isInput(a))&&s<n)||t.blockRendering.Types.isField(a)&&(a.field instanceof t.FieldLabel||a.field instanceof t.FieldImage)||(r.width+=n-s),s+=a.width}}},t.zelos.RenderInfo.prototype.finalizeOutputConnection_=function(){if(this.outputConnection&&this.outputConnection.isDynamicShape){for(var t,e=0,n=0;t=this.rows[n];n++)t.yPos=e,e+=t.height;this.height=e,n=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,e=this.outputConnection.shape.height(n),n=this.outputConnection.shape.width(n),this.outputConnection.height=e,this.outputConnection.width=n,this.outputConnection.startX=n,this.outputConnection.connectionOffsetY=this.outputConnection.shape.connectionOffsetY(e),this.outputConnection.connectionOffsetX=this.outputConnection.shape.connectionOffsetX(n),t=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(t=n,this.rightSide.height=e,this.rightSide.width=t,this.rightSide.centerline=e/2,this.rightSide.xPos=this.width+t),this.startX=n,this.width+=n+t,this.widthWithChildren+=n+t}},t.zelos.RenderInfo.prototype.finalizeHorizontalAlignment_=function(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e,n=0,i=0;e=this.rows[i];i++)if(t.blockRendering.Types.isInputRow(e)){n=e.elements[e.elements.length-2];var r=this.getNegativeSpacing_(e.elements[1]),o=this.getNegativeSpacing_(n);n=r+o;var s=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-n<s&&(r=(n=this.width-s)/2,o=n/2),e.elements.unshift(new t.blockRendering.InRowSpacer(this.constants_,-r)),e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,-o))}if(n)for(this.width-=n,this.widthWithChildren-=n,this.rightSide.xPos-=n,i=0;e=this.rows[i];i++)t.blockRendering.Types.isTopOrBottomRow(e)&&(e.elements[1].width-=n,e.elements[1].widthWithConnectedBlocks-=n),e.width-=n,e.widthWithConnectedBlocks-=n}},t.zelos.RenderInfo.prototype.getNegativeSpacing_=function(e){if(!e)return 0;var n=this.outputConnection.width,i=this.outputConnection.shape.type,r=this.constants_;if(this.isMultiRow&&1<this.inputRows.length)switch(i){case r.SHAPES.ROUND:return i=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,n-(i=this.height/2>i?i:this.height/2)*(1-Math.sin(Math.acos((i-this.constants_.SMALL_PADDING)/i)));default:return 0}if(t.blockRendering.Types.isInlineInput(e)){var o=e.connectedBlock;return e=o?o.pathObject.outputShapeType:e.shape.type,o&&o.outputConnection&&(o.statementInputCount||o.nextConnection)||i==r.SHAPES.HEXAGONAL&&i!=e?0:n-this.constants_.SHAPE_IN_SHAPE_PADDING[i][e]}return t.blockRendering.Types.isField(e)?i==r.SHAPES.ROUND&&e.field instanceof t.FieldTextInput?n-2.75*r.GRID_UNIT:n-this.constants_.SHAPE_IN_SHAPE_PADDING[i][0]:t.blockRendering.Types.isIcon(e)?this.constants_.SMALL_PADDING:0},t.zelos.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var e=2;e<this.rows.length-1;e+=2){var n=this.rows[e-1],i=this.rows[e],r=this.rows[e+1],o=2==e,s=e+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!r.precedesStatement;if(o?this.topRow.hasPreviousConnection:n.followsStatement){var a=3==i.elements.length&&(i.elements[1].field instanceof t.FieldLabel||i.elements[1].field instanceof t.FieldImage);if(!o&&a)n.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING,i.height-=this.constants_.MEDIUM_PADDING;else if(o||s){if(s){for(o=!1,s=0;a=i.elements[s];s++)if(t.blockRendering.Types.isInlineInput(a)&&a.connectedBlock&&!a.connectedBlock.isShadow()&&40<=a.connectedBlock.getHeightWidth().height){o=!0;break}o&&(n.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.SMALL_PADDING)}}else n.height+=this.constants_.SMALL_PADDING}}},t.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),t.zelos.RenderInfo.superClass_.finalize_.call(this),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)},t.zelos.Drawer=function(e,n){t.zelos.Drawer.superClass_.constructor.call(this,e,n)},t.utils.object.inherits(t.zelos.Drawer,t.blockRendering.Drawer),t.zelos.Drawer.prototype.draw=function(){var e=this.block_.pathObject;e.beginDrawing(),this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_(),e.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&e.flipRTL(),t.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_(),this.info_.outputConnection&&(e.outputShapeType=this.info_.outputConnection.shape.type),e.endDrawing()},t.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):t.zelos.Drawer.superClass_.drawOutline_.call(this)},t.zelos.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():t.zelos.Drawer.superClass_.drawLeft_.call(this)},t.zelos.Drawer.prototype.drawRightSideRow_=function(e){if(!(0>=e.height))if(e.precedesStatement||e.followsStatement){var n=this.constants_.INSIDE_CORNERS.rightHeight;n=e.height-(e.precedesStatement?n:0),this.outlinePath_+=(e.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0<n?t.utils.svgPaths.lineOnAxis("V",e.yPos+n):"")+(e.precedesStatement?this.constants_.INSIDE_CORNERS.pathTopRight:"")}else this.outlinePath_+=t.utils.svgPaths.lineOnAxis("V",e.yPos+e.height)},t.zelos.Drawer.prototype.drawRightDynamicConnection_=function(){this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)},t.zelos.Drawer.prototype.drawLeftDynamicConnection_=function(){this.positionOutputConnection_(),this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height),this.outlinePath_+="z"},t.zelos.Drawer.prototype.drawFlatTop_=function(){var e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=t.utils.svgPaths.moveBy(e.xPos,this.info_.startY),this.outlinePath_+=t.utils.svgPaths.lineOnAxis("h",e.width)},t.zelos.Drawer.prototype.drawFlatBottom_=function(){var e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=t.utils.svgPaths.lineOnAxis("V",e.baseline),this.outlinePath_+=t.utils.svgPaths.lineOnAxis("h",-e.width)},t.zelos.Drawer.prototype.drawInlineInput_=function(e){this.positionInlineInputConnection_(e);var n=e.input.name;if(!e.connectedBlock&&!this.info_.isInsertionMarker){var i=e.width-2*e.connectionWidth;e=t.utils.svgPaths.moveTo(e.xPos+e.connectionWidth,e.centerline-e.height/2)+t.utils.svgPaths.lineOnAxis("h",i)+e.shape.pathRightDown(e.height)+t.utils.svgPaths.lineOnAxis("h",-i)+e.shape.pathUp(e.height)+"z",this.block_.pathObject.setOutlinePath(n,e)}},t.zelos.Drawer.prototype.drawStatementInput_=function(e){var n=e.getLastInput(),i=n.xPos+n.notchOffset+n.shape.width,r=n.shape.pathRight+t.utils.svgPaths.lineOnAxis("h",-(n.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop,o=e.height-2*this.constants_.INSIDE_CORNERS.height;n=this.constants_.INSIDE_CORNERS.pathBottom+t.utils.svgPaths.lineOnAxis("h",n.notchOffset-this.constants_.INSIDE_CORNERS.width)+(n.connectedBottomNextConnection?"":n.shape.pathLeft),this.outlinePath_+=t.utils.svgPaths.lineOnAxis("H",i)+r+t.utils.svgPaths.lineOnAxis("v",o)+n+t.utils.svgPaths.lineOnAxis("H",e.xPos+e.width),this.positionStatementInputConnection_(e)},t.zelos.MarkerSvg=function(e,n,i){t.zelos.MarkerSvg.superClass_.constructor.call(this,e,n,i)},t.utils.object.inherits(t.zelos.MarkerSvg,t.blockRendering.MarkerSvg),t.zelos.MarkerSvg.prototype.showWithInputOutput_=function(t){var e=t.getSourceBlock();t=t.getLocation().getOffsetInBlock(),this.positionCircle_(t.x,t.y),this.setParent_(e),this.showCurrent_()},t.zelos.MarkerSvg.prototype.showWithOutput_=function(t){this.showWithInputOutput_(t)},t.zelos.MarkerSvg.prototype.showWithInput_=function(t){this.showWithInputOutput_(t)},t.zelos.MarkerSvg.prototype.showWithBlock_=function(t){var e=(t=t.getLocation()).getHeightWidth();this.positionRect_(0,0,e.width,e.height),this.setParent_(t),this.showCurrent_()},t.zelos.MarkerSvg.prototype.positionCircle_=function(t,e){this.markerCircle_.setAttribute("cx",t),this.markerCircle_.setAttribute("cy",e),this.currentMarkerSvg=this.markerCircle_},t.zelos.MarkerSvg.prototype.hide=function(){t.zelos.MarkerSvg.superClass_.hide.call(this),this.markerCircle_.style.display="none"},t.zelos.MarkerSvg.prototype.createDomInternal_=function(){if(t.zelos.MarkerSvg.superClass_.createDomInternal_.call(this),this.markerCircle_=t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{r:this.constants_.CURSOR_RADIUS,style:"display: none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_),this.isCursor()){var e=this.getBlinkProperties_();t.utils.dom.createSvgElement(t.utils.Svg.ANIMATE,e,this.markerCircle_)}return this.markerSvg_},t.zelos.MarkerSvg.prototype.applyColour_=function(e){t.zelos.MarkerSvg.superClass_.applyColour_.call(this,e),this.markerCircle_.setAttribute("fill",this.colour_),this.markerCircle_.setAttribute("stroke",this.colour_),this.isCursor()&&this.markerCircle_.firstChild.setAttribute("values",this.colour_+";transparent;transparent;")},t.zelos.PathObject=function(e,n,i){t.zelos.PathObject.superClass_.constructor.call(this,e,n,i),this.constants=i,this.svgPathSelected_=null,this.outlines_=Object.create(null),this.outputShapeType=this.remainingOutlines_=null},t.utils.object.inherits(t.zelos.PathObject,t.blockRendering.PathObject),t.zelos.PathObject.prototype.setPath=function(e){t.zelos.PathObject.superClass_.setPath.call(this,e),this.svgPathSelected_&&this.svgPathSelected_.setAttribute("d",e)},t.zelos.PathObject.prototype.applyColour=function(e){for(var n in t.zelos.PathObject.superClass_.applyColour.call(this,e),e.isShadow()&&e.getParent()&&this.svgPath.setAttribute("stroke",e.getParent().style.colourTertiary),this.outlines_)this.outlines_[n].setAttribute("fill",this.style.colourTertiary)},t.zelos.PathObject.prototype.flipRTL=function(){for(var e in t.zelos.PathObject.superClass_.flipRTL.call(this),this.outlines_)this.outlines_[e].setAttribute("transform","scale(-1 1)")},t.zelos.PathObject.prototype.updateSelected=function(t){this.setClass_("blocklySelected",t),t?this.svgPathSelected_||(this.svgPathSelected_=this.svgPath.cloneNode(!0),this.svgPathSelected_.setAttribute("fill","none"),this.svgPathSelected_.setAttribute("filter","url(#"+this.constants.selectedGlowFilterId+")"),this.svgRoot.appendChild(this.svgPathSelected_)):this.svgPathSelected_&&(this.svgRoot.removeChild(this.svgPathSelected_),this.svgPathSelected_=null)},t.zelos.PathObject.prototype.updateReplacementFade=function(t){this.setClass_("blocklyReplaceable",t),t?this.svgPath.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):this.svgPath.removeAttribute("filter")},t.zelos.PathObject.prototype.updateShapeForInputHighlight=function(t,e){t=t.getParentInput().name,(t=this.getOutlinePath_(t))&&(e?t.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):t.removeAttribute("filter"))},t.zelos.PathObject.prototype.beginDrawing=function(){for(var t in this.remainingOutlines_=Object.create(null),this.outlines_)this.remainingOutlines_[t]=1},t.zelos.PathObject.prototype.endDrawing=function(){if(this.remainingOutlines_)for(var t in this.remainingOutlines_)this.removeOutlinePath_(t);this.remainingOutlines_=null},t.zelos.PathObject.prototype.setOutlinePath=function(t,e){(t=this.getOutlinePath_(t)).setAttribute("d",e),t.setAttribute("fill",this.style.colourTertiary)},t.zelos.PathObject.prototype.getOutlinePath_=function(e){return this.outlines_[e]||(this.outlines_[e]=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines_&&delete this.remainingOutlines_[e],this.outlines_[e]},t.zelos.PathObject.prototype.removeOutlinePath_=function(t){this.outlines_[t].parentNode.removeChild(this.outlines_[t]),delete this.outlines_[t]},t.zelos.Renderer=function(e){t.zelos.Renderer.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.zelos.Renderer,t.blockRendering.Renderer),t.zelos.Renderer.prototype.makeConstants_=function(){return new t.zelos.ConstantProvider},t.zelos.Renderer.prototype.makeRenderInfo_=function(e){return new t.zelos.RenderInfo(this,e)},t.zelos.Renderer.prototype.makeDrawer_=function(e,n){return new t.zelos.Drawer(e,n)},t.zelos.Renderer.prototype.makeMarkerDrawer=function(e,n){return new t.zelos.MarkerSvg(e,this.getConstants(),n)},t.zelos.Renderer.prototype.makePathObject=function(e,n){return new t.zelos.PathObject(e,n,this.getConstants())},t.zelos.Renderer.prototype.shouldHighlightConnection=function(e){return e.type!=t.connectionTypes.INPUT_VALUE&&e.type!==t.connectionTypes.OUTPUT_VALUE},t.zelos.Renderer.prototype.getConnectionPreviewMethod=function(e,n,i){return n.type==t.connectionTypes.OUTPUT_VALUE?e.isConnected()?t.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE:t.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE:t.zelos.Renderer.superClass_.getConnectionPreviewMethod(e,n,i)},t.blockRendering.register("zelos",t.zelos.Renderer),t.Themes.Dark=t.Theme.defineTheme("dark",{base:t.Themes.Classic,componentStyles:{workspaceBackgroundColour:"#1e1e1e",toolboxBackgroundColour:"blackBackground",toolboxForegroundColour:"#fff",flyoutBackgroundColour:"#252526",flyoutForegroundColour:"#ccc",flyoutOpacity:1,scrollbarColour:"#797979",insertionMarkerColour:"#fff",insertionMarkerOpacity:.3,scrollbarOpacity:.4,cursorColour:"#d0d0d0",blackBackground:"#333"}}),t.Themes.Deuteranopia={},t.Themes.Deuteranopia.defaultBlockStyles={colour_blocks:{colourPrimary:"#f2a72c",colourSecondary:"#f1c172",colourTertiary:"#da921c"},list_blocks:{colourPrimary:"#7d65ab",colourSecondary:"#a88be0",colourTertiary:"#66518e"},logic_blocks:{colourPrimary:"#9fd2f1",colourSecondary:"#c0e0f4",colourTertiary:"#74bae5"},loop_blocks:{colourPrimary:"#795a07",colourSecondary:"#ac8726",colourTertiary:"#c4a03f"},math_blocks:{colourPrimary:"#e6da39",colourSecondary:"#f3ec8e",colourTertiary:"#f2eeb7"},procedure_blocks:{colourPrimary:"#590721",colourSecondary:"#8c475d",colourTertiary:"#885464"},text_blocks:{colourPrimary:"#058863",colourSecondary:"#5ecfaf",colourTertiary:"#04684c"},variable_blocks:{colourPrimary:"#47025a",colourSecondary:"#820fa1",colourTertiary:"#8e579d"},variable_dynamic_blocks:{colourPrimary:"#47025a",colourSecondary:"#820fa1",colourTertiary:"#8e579d"}},t.Themes.Deuteranopia.categoryStyles={colour_category:{colour:"#f2a72c"},list_category:{colour:"#7d65ab"},logic_category:{colour:"#9fd2f1"},loop_category:{colour:"#795a07"},math_category:{colour:"#e6da39"},procedure_category:{colour:"#590721"},text_category:{colour:"#058863"},variable_category:{colour:"#47025a"},variable_dynamic_category:{colour:"#47025a"}},t.Themes.Deuteranopia=new t.Theme("deuteranopia",t.Themes.Deuteranopia.defaultBlockStyles,t.Themes.Deuteranopia.categoryStyles),t.Themes.HighContrast={},t.Themes.HighContrast.defaultBlockStyles={colour_blocks:{colourPrimary:"#a52714",colourSecondary:"#FB9B8C",colourTertiary:"#FBE1DD"},list_blocks:{colourPrimary:"#4a148c",colourSecondary:"#AD7BE9",colourTertiary:"#CDB6E9"},logic_blocks:{colourPrimary:"#01579b",colourSecondary:"#64C7FF",colourTertiary:"#C5EAFF"},loop_blocks:{colourPrimary:"#33691e",colourSecondary:"#9AFF78",colourTertiary:"#E1FFD7"},math_blocks:{colourPrimary:"#1a237e",colourSecondary:"#8A9EFF",colourTertiary:"#DCE2FF"},procedure_blocks:{colourPrimary:"#006064",colourSecondary:"#77E6EE",colourTertiary:"#CFECEE"},text_blocks:{colourPrimary:"#004d40",colourSecondary:"#5ae27c",colourTertiary:"#D2FFDD"},variable_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB"},variable_dynamic_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB"},hat_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB",hat:"cap"}},t.Themes.HighContrast.categoryStyles={colour_category:{colour:"#a52714"},list_category:{colour:"#4a148c"},logic_category:{colour:"#01579b"},loop_category:{colour:"#33691e"},math_category:{colour:"#1a237e"},procedure_category:{colour:"#006064"},text_category:{colour:"#004d40"},variable_category:{colour:"#880e4f"},variable_dynamic_category:{colour:"#880e4f"}},t.Themes.HighContrast=new t.Theme("highcontrast",t.Themes.HighContrast.defaultBlockStyles,t.Themes.HighContrast.categoryStyles),t.Themes.HighContrast.setComponentStyle("selectedGlowColour","#000000"),t.Themes.HighContrast.setComponentStyle("selectedGlowSize",1),t.Themes.HighContrast.setComponentStyle("replacementGlowColour","#000000"),t.Themes.HighContrast.setFontStyle({family:null,weight:null,size:16}),t.Themes.Tritanopia={},t.Themes.Tritanopia.defaultBlockStyles={colour_blocks:{colourPrimary:"#05427f",colourSecondary:"#2974c0",colourTertiary:"#2d74bb"},list_blocks:{colourPrimary:"#b69ce8",colourSecondary:"#ccbaef",colourTertiary:"#9176c5"},logic_blocks:{colourPrimary:"#9fd2f1",colourSecondary:"#c0e0f4",colourTertiary:"#74bae5"},loop_blocks:{colourPrimary:"#aa1846",colourSecondary:"#d36185",colourTertiary:"#7c1636"},math_blocks:{colourPrimary:"#e6da39",colourSecondary:"#f3ec8e",colourTertiary:"#f2eeb7"},procedure_blocks:{colourPrimary:"#590721",colourSecondary:"#8c475d",colourTertiary:"#885464"},text_blocks:{colourPrimary:"#058863",colourSecondary:"#5ecfaf",colourTertiary:"#04684c"},variable_blocks:{colourPrimary:"#4b2d84",colourSecondary:"#816ea7",colourTertiary:"#83759e"},variable_dynamic_blocks:{colourPrimary:"#4b2d84",colourSecondary:"#816ea7",colourTertiary:"#83759e"}},t.Themes.Tritanopia.categoryStyles={colour_category:{colour:"#05427f"},list_category:{colour:"#b69ce8"},logic_category:{colour:"#9fd2f1"},loop_category:{colour:"#aa1846"},math_category:{colour:"#e6da39"},procedure_category:{colour:"#590721"},text_category:{colour:"#058863"},variable_category:{colour:"#4b2d84"},variable_dynamic_category:{colour:"#4b2d84"}},t.Themes.Tritanopia=new t.Theme("tritanopia",t.Themes.Tritanopia.defaultBlockStyles,t.Themes.Tritanopia.categoryStyles),t.requires={},t})?i.apply(e,r):i)||(t.exports=o)}).call(e,n("DuR2"))},GHBc:function(t,e,n){"use strict";var i=n("cGG2");t.exports=i.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var i=t;return e&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=i.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},GegP:function(t,e){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=117)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},117:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-progress",class:["el-progress--"+t.type,t.status?"is-"+t.status:"",{"el-progress--without-text":!t.showText,"el-progress--text-inside":t.textInside}],attrs:{role:"progressbar","aria-valuenow":t.percentage,"aria-valuemin":"0","aria-valuemax":"100"}},["line"===t.type?n("div",{staticClass:"el-progress-bar"},[n("div",{staticClass:"el-progress-bar__outer",style:{height:t.strokeWidth+"px"}},[n("div",{staticClass:"el-progress-bar__inner",style:t.barStyle},[t.showText&&t.textInside?n("div",{staticClass:"el-progress-bar__innerText"},[t._v(t._s(t.content))]):t._e()])])]):n("div",{staticClass:"el-progress-circle",style:{height:t.width+"px",width:t.width+"px"}},[n("svg",{attrs:{viewBox:"0 0 100 100"}},[n("path",{staticClass:"el-progress-circle__track",style:t.trailPathStyle,attrs:{d:t.trackPath,stroke:"#e5e9f2","stroke-width":t.relativeStrokeWidth,fill:"none"}}),n("path",{staticClass:"el-progress-circle__path",style:t.circlePathStyle,attrs:{d:t.trackPath,stroke:t.stroke,fill:"none","stroke-linecap":t.strokeLinecap,"stroke-width":t.percentage?t.relativeStrokeWidth:0}})])]),t.showText&&!t.textInside?n("div",{staticClass:"el-progress__text",style:{fontSize:t.progressTextSize+"px"}},[t.status?n("i",{class:t.iconClass}):[t._v(t._s(t.content))]],2):t._e()])};i._withStripped=!0;var r={name:"ElProgress",props:{type:{type:String,default:"line",validator:function(t){return["line","circle","dashboard"].indexOf(t)>-1}},percentage:{type:Number,default:0,required:!0,validator:function(t){return t>=0&&t<=100}},status:{type:String,validator:function(t){return["success","exception","warning"].indexOf(t)>-1}},strokeWidth:{type:Number,default:6},strokeLinecap:{type:String,default:"round"},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:[String,Array,Function],default:""},format:Function},computed:{barStyle:function(){var t={};return t.width=this.percentage+"%",t.backgroundColor=this.getCurrentColor(this.percentage),t},relativeStrokeWidth:function(){return(this.strokeWidth/this.width*100).toFixed(1)},radius:function(){return"circle"===this.type||"dashboard"===this.type?parseInt(50-parseFloat(this.relativeStrokeWidth)/2,10):0},trackPath:function(){var t=this.radius,e="dashboard"===this.type;return"\n M 50 50\n m 0 "+(e?"":"-")+t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"-":"")+2*t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"":"-")+2*t+"\n "},perimeter:function(){return 2*Math.PI*this.radius},rate:function(){return"dashboard"===this.type?.75:1},strokeDashoffset:function(){return-1*this.perimeter*(1-this.rate)/2+"px"},trailPathStyle:function(){return{strokeDasharray:this.perimeter*this.rate+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset}},circlePathStyle:function(){return{strokeDasharray:this.perimeter*this.rate*(this.percentage/100)+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"}},stroke:function(){var t=void 0;if(this.color)t=this.getCurrentColor(this.percentage);else switch(this.status){case"success":t="#13ce66";break;case"exception":t="#ff4949";break;case"warning":t="#e6a23c";break;default:t="#20a0ff"}return t},iconClass:function(){return"warning"===this.status?"el-icon-warning":"line"===this.type?"success"===this.status?"el-icon-circle-check":"el-icon-circle-close":"success"===this.status?"el-icon-check":"el-icon-close"},progressTextSize:function(){return"line"===this.type?12+.4*this.strokeWidth:.111111*this.width+2},content:function(){return"function"==typeof this.format?this.format(this.percentage)||"":this.percentage+"%"}},methods:{getCurrentColor:function(t){return"function"==typeof this.color?this.color(t):"string"==typeof this.color?this.color:this.getLevelColor(t)},getLevelColor:function(t){for(var e=this.getColorArray().sort(function(t,e){return t.percentage-e.percentage}),n=0;n<e.length;n++)if(e[n].percentage>t)return e[n].color;return e[e.length-1].color},getColorArray:function(){var t=this.color,e=100/t.length;return t.map(function(t,n){return"string"==typeof t?{color:t,percentage:(n+1)*e}:t})}}},o=n(0),s=Object(o.a)(r,i,[],!1,null,null,null);s.options.__file="packages/progress/src/progress.vue";var a=s.exports;a.install=function(t){t.component(a.name,a)};e.default=a}})},H8dH:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!e)throw new Error("instance & callback is required");var r=!1,o=function(){r||(r=!0,e&&e.apply(null,arguments))};i?t.$once("after-leave",o):t.$on("after-leave",o),setTimeout(function(){o()},n+100)}},H9Ud:function(t,e,n){"use strict";var i={};n.d(i,"isTensor",function(){return u}),n.d(i,"isTensor1D",function(){return c}),n.d(i,"isTensor2D",function(){return h}),n.d(i,"isTensor3D",function(){return p}),n.d(i,"isTensor4D",function(){return d}),n.d(i,"isFloat",function(){return f}),n.d(i,"isEven",function(){return g}),n.d(i,"round",function(){return m}),n.d(i,"isDimensions",function(){return v}),n.d(i,"computeReshapedDimensions",function(){return _}),n.d(i,"getCenterPoint",function(){return y}),n.d(i,"range",function(){return b}),n.d(i,"isValidNumber",function(){return T}),n.d(i,"isValidProbablitiy",function(){return E});var r={};n.d(r,"drawContour",function(){return s}),n.d(r,"drawDetections",function(){return lt}),n.d(r,"drawFaceExpressions",function(){return te}),n.d(r,"DrawBoxOptions",function(){return st}),n.d(r,"DrawBox",function(){return at}),n.d(r,"DrawFaceLandmarksOptions",function(){return ie}),n.d(r,"DrawFaceLandmarks",function(){return re}),n.d(r,"drawFaceLandmarks",function(){return oe}),n.d(r,"AnchorPosition",function(){return tt}),n.d(r,"DrawTextFieldOptions",function(){return rt}),n.d(r,"DrawTextField",function(){return ot});var o=n("2qEw");function s(t,e,n){if(void 0===n&&(n=!1),t.beginPath(),e.slice(1).forEach(function(n,i){var r=n.x,o=n.y,s=e[i];t.moveTo(s.x,s.y),t.lineTo(r,o)}),n){var i=e[e.length-1],r=e[0];if(!i||!r)return;t.moveTo(i.x,i.y),t.lineTo(r.x,r.y)}t.stroke()}var a=n("TToO"),l=function(){function t(t,e){if(!T(t)||!T(e))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:t,height:e}));this._width=t,this._height=e}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),t.prototype.reverse=function(){return new t(1/this.width,1/this.height)},t}();function u(t,e){return t instanceof o.a&&t.shape.length===e}function c(t){return u(t,1)}function h(t){return u(t,2)}function p(t){return u(t,3)}function d(t){return u(t,4)}function f(t){return t%1!=0}function g(t){return t%2==0}function m(t,e){void 0===e&&(e=2);var n=Math.pow(10,e);return Math.floor(t*n)/n}function v(t){return t&&t.width&&t.height}function _(t,e){var n=t.width,i=t.height,r=e/Math.max(i,n);return new l(Math.round(n*r),Math.round(i*r))}function y(t){return t.reduce(function(t,e){return t.add(e)},new C(0,0)).div(new C(t.length,t.length))}function b(t,e,n){return Array(t).fill(0).map(function(t,i){return e+i*n})}function T(t){return!!t&&t!==1/0&&t!==-1/0&&!isNaN(t)||0===t}function E(t){return T(t)&&0<=t&&t<=1}var C=function(){function t(t,e){this._x=t,this._y=e}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.sub=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.mul=function(e){return new t(this.x*e.x,this.y*e.y)},t.prototype.div=function(e){return new t(this.x/e.x,this.y/e.y)},t.prototype.abs=function(){return new t(Math.abs(this.x),Math.abs(this.y))},t.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},t.prototype.floor=function(){return new t(Math.floor(this.x),Math.floor(this.y))},t}(),S=function(){function t(e,n){void 0===n&&(n=!0);var i=e||{},r=[i.left,i.top,i.right,i.bottom].every(T),o=[i.x,i.y,i.width,i.height].every(T);if(!o&&!r)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(i));var s=o?[i.x,i.y,i.width,i.height]:[i.left,i.top,i.right-i.left,i.bottom-i.top],a=s[0],l=s[1],u=s[2],c=s[3];t.assertIsValidBox({x:a,y:l,width:u,height:c},"Box.constructor",n),this._x=a,this._y=l,this._width=u,this._height=c}return t.isRect=function(t){return!!t&&[t.x,t.y,t.width,t.height].every(T)},t.assertIsValidBox=function(e,n,i){if(void 0===i&&(i=!1),!t.isRect(e))throw new Error(n+" - invalid box: "+JSON.stringify(e)+", expected object with properties x, y, width, height");if(!i&&(e.width<0||e.height<0))throw new Error(n+" - width ("+e.width+") and height ("+e.height+") must be positive numbers")},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topLeft",{get:function(){return new C(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topRight",{get:function(){return new C(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomLeft",{get:function(){return new C(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomRight",{get:function(){return new C(this.right,this.bottom)},enumerable:!0,configurable:!0}),t.prototype.round=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.round(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.floor=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.floor(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.toSquare=function(){var e=this.x,n=this.y,i=this.width,r=this.height,o=Math.abs(i-r);return i<r&&(e-=o/2,i+=o),r<i&&(n-=o/2,r+=o),new t({x:e,y:n,width:i,height:r})},t.prototype.rescale=function(e){var n=v(e)?e.width:e,i=v(e)?e.height:e;return new t({x:this.x*n,y:this.y*i,width:this.width*n,height:this.height*i})},t.prototype.pad=function(e,n){var i=[this.x-e/2,this.y-n/2,this.width+e,this.height+n];return new t({x:i[0],y:i[1],width:i[2],height:i[3]})},t.prototype.clipAtImageBorders=function(e,n){var i=this.x,r=this.y,o=this.right,s=this.bottom,a=Math.max(i,0),l=Math.max(r,0),u=o-a,c=s-l;return new t({x:a,y:l,width:Math.min(u,e-a),height:Math.min(c,n-l)}).floor()},t.prototype.shift=function(e,n){var i=this.width,r=this.height;return new t({x:this.x+e,y:this.y+n,width:i,height:r})},t.prototype.padAtBorders=function(t,e){var n=this.width+1,i=this.height+1,r=n,o=i,s=this.left,a=this.top,l=this.right,u=this.bottom;return l>e&&(r=-l+e+n,l=e),u>t&&(o=-u+t+i,u=t),s<1&&(o=2-s,s=1),a<1&&(o=2-a,a=1),{dy:1,edy:o,dx:1,edx:r,y:a,ey:u,x:s,ex:l,w:n,h:i}},t.prototype.calibrate=function(e){return new t({left:this.left+e.left*this.width,top:this.top+e.top*this.height,right:this.right+e.right*this.width,bottom:this.bottom+e.bottom*this.height}).toSquare().round()},t}(),w=function(t){function e(e,n,i,r,o){return void 0===o&&(o=!1),t.call(this,{left:e,top:n,right:i,bottom:r},o)||this}return Object(a.c)(e,t),e}(S),k=function(){function t(t,e,n,i,r){this._imageDims=new l(r.width,r.height),this._score=t,this._classScore=e,this._className=n,this._box=new S(i).rescale(this._imageDims)}return Object.defineProperty(t.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativeBox",{get:function(){return new S(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),t.prototype.forSize=function(e,n){return new t(this.score,this.classScore,this.className,this.relativeBox,{width:e,height:n})},t}(),x=function(t){function e(e,n,i){return t.call(this,e,e,"",n,i)||this}return Object(a.c)(e,t),e.prototype.forSize=function(n,i){var r=t.prototype.forSize.call(this,n,i);return new e(r.score,r.relativeBox,r.imageDims)},e}(k);function I(t,e,n){void 0===n&&(n=!0);var i=Math.max(0,Math.min(t.right,e.right)-Math.max(t.left,e.left))*Math.max(0,Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top));return n?i/(t.area+e.area-i):i/Math.min(t.area,e.area)}function R(t){var e=t.map(function(t){return t.x}),n=t.map(function(t){return t.y}),i=e.reduce(function(t,e){return e<t?e:t},1/0),r=n.reduce(function(t,e){return e<t?e:t},1/0),o=e.reduce(function(t,e){return t<e?e:t},0),s=n.reduce(function(t,e){return t<e?e:t},0);return new w(i,r,o,s)}function O(t,e,n,i){void 0===i&&(i=!0);for(var r=e.map(function(t,e){return{score:t,boxIndex:e}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.boxIndex}),o=[],s=function(){var e=r.pop();o.push(e);for(var s=r,a=[],l=0;l<s.length;l++){var u=s[l],c=t[e],h=t[u];a.push(I(c,h,i))}r=r.filter(function(t,e){return a[e]<=n})};r.length>0;)s();return o}function D(t,e){return o.L(function(){var n=e[0],i=e[1],r=e[2],s=o.n(Object(a.e)(t.shape.slice(0,3),[1]),n),l=o.n(Object(a.e)(t.shape.slice(0,3),[1]),i),u=o.n(Object(a.e)(t.shape.slice(0,3),[1]),r),c=o.h([s,l,u],3);return o.F(t,c)})}function A(t,e){return void 0===e&&(e=!1),o.L(function(){var n=t.shape.slice(1),i=n[0],r=n[1];if(i===r)return t;var s=Math.abs(i-r),a=Math.round(s*(e?.5:1)),l=i>r?2:1,u=function(e){var n=t.shape.slice();return n[l]=e,o.n(n,0)},c=u(a),h=s-c.shape[l],p=[e&&h?u(h):null,t,c].filter(function(t){return!!t}).map(function(t){return t.toFloat()});return o.h(p,l)})}function M(t){for(var e=t.slice(),n=e.length-1;n>0;n--){var i=Math.floor(Math.random()*(n+1)),r=e[n];e[n]=e[i],e[i]=r}return e}function N(t){return 1/(1+Math.exp(-t))}function L(t){return Math.log(t/(1-t))}var P=function(t){function e(e,n,i,r,o){return void 0===o&&(o=!1),t.call(this,{x:e,y:n,width:i,height:r},o)||this}return Object(a.c)(e,t),e}(S),B=function(){function t(t,e,n){void 0===n&&(n=new C(0,0));var i=e.width,r=e.height;this._imgDims=new l(i,r),this._shift=n,this._positions=t.map(function(t){return t.mul(new C(i,r)).add(n)})}return Object.defineProperty(t.prototype,"shift",{get:function(){return new C(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativePositions",{get:function(){var t=this;return this._positions.map(function(e){return e.sub(t._shift).div(new C(t.imageWidth,t.imageHeight))})},enumerable:!0,configurable:!0}),t.prototype.forSize=function(t,e){return new this.constructor(this.relativePositions,{width:t,height:e})},t.prototype.shiftBy=function(t,e){return new this.constructor(this.relativePositions,this._imgDims,new C(t,e))},t.prototype.shiftByPoint=function(t){return this.shiftBy(t.x,t.y)},t.prototype.align=function(t,e){if(void 0===e&&(e={}),t){var n=t instanceof x?t.box.floor():new S(t);return this.shiftBy(n.x,n.y).align(null,e)}var i=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},e),r=i.useDlibAlignment,o=i.minBoxPadding;return r?this.alignDlib():this.alignMinBbox(o)},t.prototype.alignDlib=function(){var t=this.getRefPointsForAlignment(),e=t[0],n=t[1],i=t[2],r=function(t){return i.sub(t).magnitude()},o=(r(e)+r(n))/2,s=Math.floor(o/.45),a=y(t),l=Math.floor(Math.max(0,a.x-.5*s)),u=Math.floor(Math.max(0,a.y-.43*s));return new P(l,u,Math.min(s,this.imageWidth+l),Math.min(s,this.imageHeight+u))},t.prototype.alignMinBbox=function(t){var e=R(this.positions);return e.pad(e.width*t,e.height*t)},t.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},t}(),F=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.getRefPointsForAlignment=function(){var t=this.positions;return[t[0],t[1],y([t[3],t[4]])]},e}(B),U=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.getJawOutline=function(){return this.positions.slice(0,17)},e.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},e.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},e.prototype.getNose=function(){return this.positions.slice(27,36)},e.prototype.getLeftEye=function(){return this.positions.slice(36,42)},e.prototype.getRightEye=function(){return this.positions.slice(42,48)},e.prototype.getMouth=function(){return this.positions.slice(48,68)},e.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(y)},e}(B),V=function(){function t(t,e){this._label=t,this._distance=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){return void 0===t&&(t=!0),this.label+(t?" ("+m(this.distance)+")":"")},t}(),H=function(t){function e(e,n){var i=t.call(this,e)||this;return i._label=n,i}return Object(a.c)(e,t),e.assertIsValidLabeledBox=function(t,e){if(S.assertIsValidBox(t,e),!T(t.label))throw new Error(e+" - expected property label ("+t.label+") to be a number")},Object.defineProperty(e.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),e}(S),W=function(){function t(t,e){if("string"!=typeof t)throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(e)||e.some(function(t){return!(t instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=t,this._descriptors=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(t){return Array.from(t)})}},t.fromJSON=function(e){var n=e.descriptors.map(function(t){return new Float32Array(t)});return new t(e.label,n)},t}(),G=function(t){function e(e,n,i,r){var o=t.call(this,e,n)||this;return o._score=i,o._classScore=r,o}return Object(a.c)(e,t),e.assertIsValidPredictedBox=function(t,e){if(H.assertIsValidLabeledBox(t,e),!E(t.score)||!E(t.classScore))throw new Error(e+" - expected properties score ("+t.score+") and ("+t.classScore+") to be a number between [0, 1]")},Object.defineProperty(e.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),e}(H);function j(t){return t.detection instanceof x}function z(t,e){var n={detection:e};return Object.assign({},t,n)}function $(){var t=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D:CanvasRenderingContext2D,Image:HTMLImageElement,ImageData:ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:t,readFile:function(){throw new Error("readFile - filesystem not available for browser environment")}}}var X=n("pcbz"),Y=n("dxT3");function K(){return"object"==typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof HTMLCanvasElement&&"undefined"!=typeof HTMLVideoElement&&"undefined"!=typeof ImageData&&"undefined"!=typeof CanvasRenderingContext2D}var J,q=n("iMyp");function Z(t){J=t}function Q(){K()&&Z($()),Object(q.a)()&&Z(Object(Y.a)())}var tt,et={getEnv:function(){if(!J)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return J},setEnv:Z,initialize:Q,createBrowserEnv:$,createFileSystem:X.a,createNodejsEnv:Y.a,monkeyPatch:function(t){if(J||Q(),!J)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var e=t.Canvas,n=void 0===e?J.Canvas:e,i=t.Image,r=void 0===i?J.Image:i;J.Canvas=n,J.Image=r,J.createCanvasElement=t.createCanvasElement||function(){return new n},J.createImageElement=t.createImageElement||function(){return new r},J.ImageData=t.ImageData||J.ImageData,J.Video=t.Video||J.Video,J.fetch=t.fetch||J.fetch,J.readFile=t.readFile||J.readFile},isBrowser:K,isNodejs:q.a};function nt(t){return et.isNodejs()||"string"!=typeof t?t:document.getElementById(t)}function it(t){var e=et.getEnv(),n=e.Canvas;if(t instanceof e.CanvasRenderingContext2D)return t;var i=nt(t);if(!(i instanceof n))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var r=i.getContext("2d");if(!r)throw new Error("resolveContext2d - canvas 2d context is null");return r}Q(),function(t){t.TOP_LEFT="TOP_LEFT",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_LEFT="BOTTOM_LEFT",t.BOTTOM_RIGHT="BOTTOM_RIGHT"}(tt||(tt={}));var rt=function(){return function(t){void 0===t&&(t={});var e=t.anchorPosition,n=t.backgroundColor,i=t.fontColor,r=t.fontSize,o=t.fontStyle,s=t.padding;this.anchorPosition=e||tt.TOP_LEFT,this.backgroundColor=n||"rgba(0, 0, 0, 0.5)",this.fontColor=i||"rgba(255, 255, 255, 1)",this.fontSize=r||14,this.fontStyle=o||"Georgia",this.padding=s||4}}(),ot=function(){function t(e,n,i){void 0===i&&(i={}),this.text="string"==typeof e?[e]:e instanceof t?e.text:e,this.anchor=n,this.options=new rt(i)}return t.prototype.measureWidth=function(t){var e=this.options.padding;return this.text.map(function(e){return t.measureText(e).width}).reduce(function(t,e){return t<e?e:t},0)+2*e},t.prototype.measureHeight=function(){var t=this.options,e=t.fontSize,n=t.padding;return this.text.length*e+2*n},t.prototype.getUpperLeft=function(t,e){var n=this.options.anchorPosition,i=n===tt.BOTTOM_RIGHT||n===tt.TOP_RIGHT,r=n===tt.BOTTOM_LEFT||n===tt.BOTTOM_RIGHT,o=this.measureWidth(t),s=this.measureHeight(),a=i?this.anchor.x-o:this.anchor.x,l=r?this.anchor.y-s:this.anchor.y;if(e){var u=e.width,c=e.height;return{x:Math.max(Math.min(a,u-o),0),y:Math.max(Math.min(l,c-s),0)}}return{x:a,y:l}},t.prototype.draw=function(t){var e=nt(t),n=it(e),i=this.options,r=i.backgroundColor,o=i.fontColor,s=i.fontSize,a=i.fontStyle,l=i.padding;n.font=s+"px "+a;var u=this.measureWidth(n),c=this.measureHeight();n.fillStyle=r;var h=this.getUpperLeft(n,e);n.fillRect(h.x,h.y,u,c),n.fillStyle=o,this.text.forEach(function(t,e){var i=l+h.x,r=l+h.y+(e+1)*s;n.fillText(t,i,r)})},t}(),st=function(){return function(t){void 0===t&&(t={});var e=t.boxColor,n=t.lineWidth,i=t.label,r=t.drawLabelOptions;this.boxColor=e||"rgba(0, 0, 255, 1)",this.lineWidth=n||2,this.label=i;var o={anchorPosition:tt.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new rt(Object.assign({},o,r))}}(),at=function(){function t(t,e){void 0===e&&(e={}),this.box=new S(t),this.options=new st(e)}return t.prototype.draw=function(t){var e=it(t),n=this.options,i=n.boxColor,r=n.lineWidth,o=this.box,s=o.x,a=o.y,l=o.width,u=o.height;e.strokeStyle=i,e.lineWidth=r,e.strokeRect(s,a,l,u);var c=this.options.label;c&&new ot([c],{x:s-r/2,y:a},this.options.drawLabelOptions).draw(t)},t}();function lt(t,e){(Array.isArray(e)?e:[e]).forEach(function(e){var n=e instanceof x?e.score:j(e)?e.detection.score:void 0,i=e instanceof x?e.box:j(e)?e.detection.box:new S(e),r=n?""+m(n):void 0;new at(i,{label:r}).draw(t)})}function ut(t){var e=et.getEnv(),n=e.Image,i=e.Video;return t instanceof n&&t.complete||t instanceof i&&t.readyState>=3}function ct(t){return new Promise(function(e,n){if(t instanceof et.getEnv().Canvas||ut(t))return e();function i(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",i),t.currentTarget.removeEventListener("error",r),e(t))}function r(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",i),t.currentTarget.removeEventListener("error",r),n(t))}t.addEventListener("load",i),t.addEventListener("error",r)})}function ht(t){return new Promise(function(e,n){if(!(t instanceof Blob))return n("bufferToImage - expected buf to be of type: Blob");var i=new FileReader;i.onload=function(){if("string"!=typeof i.result)return n("bufferToImage - expected reader.result to be a string, in onload");var t=et.getEnv().createImageElement();t.onload=function(){return e(t)},t.onerror=n,t.src=i.result},i.onerror=n,i.readAsDataURL(t)})}function pt(t){var e=et.getEnv(),n=e.Image,i=e.Video;return t instanceof n?new l(t.naturalWidth,t.naturalHeight):t instanceof i?new l(t.videoWidth,t.videoHeight):new l(t.width,t.height)}function dt(t){var e=t.width,n=t.height,i=(0,et.getEnv().createCanvasElement)();return i.width=e,i.height=n,i}function ft(t,e){var n=et.getEnv().ImageData;if(!(t instanceof n||ut(t)))throw new Error("createCanvasFromMedia - media has not finished loading yet");var i=e||pt(t),r=i.width,o=i.height,s=dt({width:r,height:o});return t instanceof n?it(s).putImageData(t,0,0):it(s).drawImage(t,0,0,r,o),s}function gt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,i,r,s,l,u;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=e||et.getEnv().createCanvasElement(),i=t.shape.slice(d(t)?1:0),r=i[0],s=i[1],l=i[2],u=o.L(function(){return t.as3D(r,s,l).toInt()}),[4,o.f.toPixels(u,n)];case 1:return a.sent(),u.dispose(),[2,n]}})})}function mt(t){var e=et.getEnv(),n=e.Image,i=e.Canvas,r=e.Video;return t instanceof n||t instanceof i||t instanceof r}function vt(t,e,n){void 0===n&&(n=!1);var i=et.getEnv(),r=i.Image,o=i.Canvas;if(!(t instanceof r||t instanceof o))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var s=pt(t),a=e/Math.max(s.height,s.width),l=a*s.width,u=a*s.height,c=dt({width:e,height:e}),h=t instanceof o?t:ft(t),p=Math.abs(l-u)/2,d=n&&l<u?p:0,f=n&&u<l?p:0;return it(c).drawImage(h,d,f,l,u),c}var _t=function(){function t(t,e){var n=this;if(void 0===e&&(e=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(t))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+t);this._treatAsBatchInput=e,this._batchSize=t.length,t.forEach(function(t,e){if(p(t))return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape);if(d(t)){var i=t.shape[0];if(1!==i)throw new Error("NetInput - tf.Tensor4D with batchSize "+i+" passed, but not supported in input array");return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape.slice(1))}var r=t instanceof et.getEnv().Canvas?t:ft(t);n._canvases[e]=r,n._inputDimensions[e]=[r.height,r.width,3]})}return Object.defineProperty(t.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBatchInput",{get:function(){return this.batchSize>1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reshapedInputDimensions",{get:function(){var t=this;return b(this.batchSize,0,1).map(function(e,n){return t.getReshapedInputDimensions(n)})},enumerable:!0,configurable:!0}),t.prototype.getInput=function(t){return this.canvases[t]||this.imageTensors[t]},t.prototype.getInputDimensions=function(t){return this._inputDimensions[t]},t.prototype.getInputHeight=function(t){return this._inputDimensions[t][0]},t.prototype.getInputWidth=function(t){return this._inputDimensions[t][1]},t.prototype.getReshapedInputDimensions=function(t){if("number"!=typeof this.inputSize)throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");return _({width:this.getInputWidth(t),height:this.getInputHeight(t)},this.inputSize)},t.prototype.toBatchTensor=function(t,e){var n=this;return void 0===e&&(e=!0),this._inputSize=t,o.L(function(){var i=b(n.batchSize,0,1).map(function(i){var r=n.getInput(i);if(r instanceof o.a){var s=d(r)?r:r.expandDims();return(s=A(s,e)).shape[1]===t&&s.shape[2]===t||(s=o.o.resizeBilinear(s,[t,t])),s.as3D(t,t,3)}if(r instanceof et.getEnv().Canvas)return o.f.fromPixels(vt(r,t,e));throw new Error("toBatchTensor - at batchIdx "+i+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+r)});return o.E(i.map(function(t){return t.toFloat()})).as4D(n.batchSize,t,t,3)})},t}();function yt(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i;return Object(a.d)(this,function(r){switch(r.label){case 0:if(t instanceof _t)return[2,t];if(!(e=Array.isArray(t)?t:[t]).length)throw new Error("toNetInput - empty array passed as input");return n=function(e){return Array.isArray(t)?" at input index "+e+":":""},(i=e.map(nt)).forEach(function(t,i){if(!mt(t)&&!p(t)&&!d(t)){if("string"==typeof e[i])throw new Error("toNetInput -"+n(i)+" string passed, but could not resolve HTMLElement for element id "+e[i]);throw new Error("toNetInput -"+n(i)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id")}if(d(t)){var r=t.shape[0];if(1!==r)throw new Error("toNetInput -"+n(i)+" tf.Tensor4D with batchSize "+r+" passed, but not supported in input array")}}),[4,Promise.all(i.map(function(t){return mt(t)&&ct(t)}))];case 1:return r.sent(),[2,new _t(i,Array.isArray(t))]}})})}function bt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,i,r,o,s,l;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=et.getEnv().Canvas,i=t,t instanceof n?[3,5]:[4,yt(t)];case 1:if((r=a.sent()).batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return(o=r.getInput(0))instanceof n?(s=o,[3,4]):[3,2];case 2:return[4,gt(o)];case 3:s=a.sent(),a.label=4;case 4:i=s,a.label=5;case 5:return l=it(i),[2,e.map(function(t){return t instanceof x?t.forSize(i.width,i.height).box.floor():t}).map(function(t){return t.clipAtImageBorders(i.width,i.height)}).map(function(t){var e=t.x,n=t.y,i=t.width,r=t.height,o=dt({width:i,height:r});return it(o).putImageData(l.getImageData(e,n,i,r),0,0),o})]}})})}function Tt(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){if(!p(t)&&!d(t))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(d(t)&&t.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,o.L(function(){var n=t.shape.slice(d(t)?1:0),i=n[0],r=n[1],s=n[2];return e.map(function(t){return t instanceof x?t.forSize(r,i).box:t}).map(function(t){return t.clipAtImageBorders(r,i)}).map(function(e){var n=e.x,a=e.y,l=e.width,u=e.height;return o.C(t.as3D(i,r,s),[a,n,0],[u,l,s])})})]})})}function Et(t,e){return Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(i){switch(i.label){case 0:return[4,(0,et.getEnv().fetch)(t,e)];case 1:if(!((n=i.sent()).status<400))throw new Error("failed to fetch: ("+n.status+") "+n.statusText+", from url: "+n.url);return[2,n]}})})}function Ct(t){return Object(a.b)(this,void 0,void 0,function(){var e,n;return Object(a.d)(this,function(i){switch(i.label){case 0:return[4,Et(t)];case 1:return[4,(e=i.sent()).blob()];case 2:if(!(n=i.sent()).type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+n.type+", for url: "+e.url);return[2,ht(n)]}})})}function St(t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Et(t)];case 1:return[2,e.sent().json()]}})})}function wt(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=Float32Array.bind,[4,Et(t)];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,new(e.apply(Float32Array,[void 0,n.sent()]))]}})})}function kt(t,e){var n=e+"-weights_manifest.json";if(!t)return{modelBaseUri:"",manifestUri:n};if("/"===t)return{modelBaseUri:"/",manifestUri:"/"+n};var i=t.startsWith("http://")?"http://":t.startsWith("https://")?"https://":"",r=(t=t.replace(i,"")).split("/").filter(function(t){return t}),o=t.endsWith(".json")?r[r.length-1]:n,s=i+(t.endsWith(".json")?r.slice(0,r.length-1):r).join("/");return{modelBaseUri:s=t.startsWith("/")?"/"+s:s,manifestUri:"/"===s?"/"+o:s+"/"+o}}function xt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,i,r,s;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=kt(t,e),i=n.manifestUri,r=n.modelBaseUri,[4,St(i)];case 1:return s=a.sent(),[2,o.p.loadWeights(s,r)]}})})}function It(t,e,n){void 0===n&&(n=!1);var i=n?pt(e):e,r=i.width,o=i.height;return t.width=r,t.height=o,{width:r,height:o}}var Rt=function(){function t(t){this._name=t,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(t.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),t.prototype.getParamFromPath=function(t){var e=this.traversePropertyPath(t);return e.obj[e.objProp]},t.prototype.reassignParamFromPath=function(t,e){var n=this.traversePropertyPath(t),i=n.obj,r=n.objProp;i[r].dispose(),i[r]=e},t.prototype.getParamList=function(){var t=this;return this._paramMappings.map(function(e){var n=e.paramPath;return{path:n,tensor:t.getParamFromPath(n)}})},t.prototype.getTrainableParams=function(){return this.getParamList().filter(function(t){return t.tensor instanceof o.b})},t.prototype.getFrozenParams=function(){return this.getParamList().filter(function(t){return!(t.tensor instanceof o.b)})},t.prototype.variable=function(){var t=this;this.getFrozenParams().forEach(function(e){var n=e.path,i=e.tensor;t.reassignParamFromPath(n,i.variable())})},t.prototype.freeze=function(){var t=this;this.getTrainableParams().forEach(function(e){var n=e.path,i=e.tensor,r=o.G(i.dataSync());i.dispose(),t.reassignParamFromPath(n,r)})},t.prototype.dispose=function(t){void 0===t&&(t=!0),this.getParamList().forEach(function(e){if(t&&e.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+e.path);e.tensor.dispose()}),this._params=void 0},t.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(t){var e=t.tensor;return Array.from(e.dataSync())}).reduce(function(t,e){return t.concat(e)}))},t.prototype.load=function(t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return t instanceof Float32Array?(this.extractWeights(t),[2]):[4,this.loadFromUri(t)];case 1:return e.sent(),[2]}})})},t.prototype.loadFromUri=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromUri - expected model uri");return[4,xt(t,this.getDefaultModelName())];case 1:return e=n.sent(),this.loadFromWeightMap(e),[2]}})})},t.prototype.loadFromDisk=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i,r,s,l,u,c,h,p;return Object(a.d)(this,function(a){switch(a.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromDisk - expected model file path");return e=et.getEnv().readFile,n=kt(t,this.getDefaultModelName()),i=n.manifestUri,r=n.modelBaseUri,s=function(t){return Promise.all(t.map(function(t){return e(t).then(function(t){return t.buffer})}))},l=o.p.weightsLoaderFactory(s),h=(c=JSON).parse,[4,e(i)];case 1:return u=h.apply(c,[a.sent().toString()]),[4,l(u,r)];case 2:return p=a.sent(),this.loadFromWeightMap(p),[2]}})})},t.prototype.loadFromWeightMap=function(t){var e=this.extractParamsFromWeigthMap(t),n=e.paramMappings,i=e.params;this._paramMappings=n,this._params=i},t.prototype.extractWeights=function(t){var e=this.extractParams(t),n=e.paramMappings,i=e.params;this._paramMappings=n,this._params=i},t.prototype.traversePropertyPath=function(t){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var e=t.split("/").reduce(function(e,n){if(!e.nextObj.hasOwnProperty(n))throw new Error("traversePropertyPath - object does not have property "+n+", for path "+t);return{obj:e.nextObj,objProp:n,nextObj:e.nextObj[n]}},{nextObj:this.params}),n=e.obj,i=e.objProp;if(!(n&&i&&n[i]instanceof o.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+t);return{obj:n,objProp:i}},t}();function Ot(t,e,n){return o.L(function(){var i=o.z(t,e.depthwise_filter,e.pointwise_filter,n,"same");return i=o.c(i,e.bias)})}function Dt(t,e,n){return void 0===n&&(n=!1),o.L(function(){var i=o.w(n?o.c(o.i(t,e.conv0.filters,[2,2],"same"),e.conv0.bias):Ot(t,e.conv0,[2,2])),r=Ot(i,e.conv1,[1,1]),s=Ot(o.w(o.c(i,r)),e.conv2,[1,1]);return o.w(o.c(i,o.c(r,s)))})}function At(t,e,n,i){return void 0===n&&(n=!1),void 0===i&&(i=!0),o.L(function(){var r=o.w(n?o.c(o.i(t,e.conv0.filters,i?[2,2]:[1,1],"same"),e.conv0.bias):Ot(t,e.conv0,i?[2,2]:[1,1])),s=Ot(r,e.conv1,[1,1]),a=Ot(o.w(o.c(r,s)),e.conv2,[1,1]),l=Ot(o.w(o.c(r,o.c(s,a))),e.conv3,[1,1]);return o.w(o.c(r,o.c(s,o.c(a,l))))})}function Mt(t,e,n,i){return void 0===n&&(n="same"),void 0===i&&(i=!1),o.L(function(){var r=o.c(o.i(t,e.filters,[1,1],n),e.bias);return i?o.w(r):r})}function Nt(t,e){Object.keys(t).forEach(function(n){e.some(function(t){return t.originalPath===n})||t[n].dispose()})}function Lt(t,e){return function(n,i,r,s){var a=o.K(t(n*i*r*r),[r,r,n,i]),l=o.H(t(i));return e.push({paramPath:s+"/filters"},{paramPath:s+"/bias"}),{filters:a,bias:l}}}function Pt(t,e){return function(n,i,r){var s=o.I(t(n*i),[n,i]),a=o.H(t(i));return e.push({paramPath:r+"/weights"},{paramPath:r+"/bias"}),{weights:s,bias:a}}}var Bt=function(){return function(t,e,n){this.depthwise_filter=t,this.pointwise_filter=e,this.bias=n}}();function Ft(t,e){return function(n,i,r){var s=o.K(t(9*n),[3,3,n,1]),a=o.K(t(n*i),[1,1,n,i]),l=o.H(t(i));return e.push({paramPath:r+"/depthwise_filter"},{paramPath:r+"/pointwise_filter"},{paramPath:r+"/bias"}),new Bt(s,a,l)}}function Ut(t){return function(e){var n=t(e+"/depthwise_filter",4),i=t(e+"/pointwise_filter",4),r=t(e+"/bias",1);return new Bt(n,i,r)}}function Vt(t,e){return function(n,i,r){var o=t[n];if(!u(o,i))throw new Error("expected weightMap["+n+"] to be a Tensor"+i+"D, instead have "+o);return e.push({originalPath:n,paramPath:r||n}),o}}function Ht(t){var e=t;return{extractWeights:function(t){var n=e.slice(0,t);return e=e.slice(t),n},getRemainingWeights:function(){return e}}}function Wt(t,e){var n=Lt(t,e),i=Ft(t,e);function r(t,e,r,o){return void 0===o&&(o=!1),{conv0:o?n(t,e,3,r+"/conv0"):i(t,e,r+"/conv0"),conv1:i(e,e,r+"/conv1"),conv2:i(e,e,r+"/conv2")}}return{extractDenseBlock3Params:r,extractDenseBlock4Params:function(t,e,n,o){void 0===o&&(o=!1);var s=r(t,e,n,o);return{conv0:s.conv0,conv1:s.conv1,conv2:s.conv2,conv3:i(e,e,n+"/conv3")}}}}function Gt(t){return function(e){return{filters:t(e+"/filters",4),bias:t(e+"/bias",1)}}}function jt(t,e){var n=Vt(t,e),i=Gt(n),r=Ut(n);return{extractDenseBlock3Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?i(t+"/conv0"):r(t+"/conv0"),conv1:r(t+"/conv1"),conv2:r(t+"/conv2")}},extractDenseBlock4Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?i(t+"/conv0"):r(t+"/conv0"),conv1:r(t+"/conv1"),conv2:r(t+"/conv2"),conv3:r(t+"/conv3")}}}}var zt=function(t){function e(){return t.call(this,"FaceFeatureExtractor")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceFeatureExtractor - load model before inference");return o.L(function(){var n=At(D(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(o.y(255)),e.dense0,!0);return n=At(n=At(n=At(n,e.dense1),e.dense2),e.dense3),n=o.d(n,[7,7],[2,2],"valid")})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=jt(t,e).extractDenseBlock4Params,i={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2"),dense3:n("dense3")};return Nt(t,e),{params:i,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Ht(t),i=n.extractWeights,r=n.getRemainingWeights,o=Wt(i,e).extractDenseBlock4Params,s=o(3,32,"dense0",!0),a=o(32,64,"dense1"),l=o(64,128,"dense2"),u=o(128,256,"dense3");if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{paramMappings:e,params:{dense0:s,dense1:a,dense2:l,dense3:u}}}(t)},e}(Rt);function $t(t,e){return o.L(function(){return o.c(o.q(t,e.weights),e.bias)})}function Xt(t){var e={},n={};return Object.keys(t).forEach(function(i){(i.startsWith("fc")?n:e)[i]=t[i]}),{featureExtractorMap:e,classifierMap:n}}var Yt=function(t){function e(e,n){var i=t.call(this,e)||this;return i._faceFeatureExtractor=n,i}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return o.L(function(){var i=t instanceof _t?e.faceFeatureExtractor.forwardInput(t):t;return $t(i.as2D(i.shape[0],-1),n.fc)})},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,i=e.paramMappings;this._params=n,this._paramMappings=i},e.prototype.extractClassifierParams=function(t){return function(t,e,n){var i=[],r=Ht(t),o=r.extractWeights,s=r.getRemainingWeights,a=Pt(o,i)(e,n,"fc");if(0!==s().length)throw new Error("weights remaing after extract: "+s().length);return{paramMappings:i,params:{fc:a}}}(t,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},e.prototype.extractParamsFromWeigthMap=function(t){var e=Xt(t),n=e.featureExtractorMap,i=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e,n=[],i=Vt(t,n),r={fc:(e="fc",{weights:i(e+"/weights",2),bias:i(e+"/bias",1)})};return Nt(t,n),{params:r,paramMappings:n}}(i)},e.prototype.extractParams=function(t){var e=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),i=n*e+n,r=t.slice(0,t.length-i),o=t.slice(t.length-i);return this.faceFeatureExtractor.extractWeights(r),this.extractClassifierParams(o)},e}(Rt),Kt=["neutral","happy","sad","angry","fearful","disgusted","surprised"],Jt=function(){function t(t){var e=this;if(7!==t.length)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+t.length);Kt.forEach(function(n,i){e[n]=t[i]})}return t.prototype.asSortedArray=function(){var t=this;return Kt.map(function(e){return{expression:e,probability:t[e]}}).sort(function(t,e){return e.probability-t.probability})},t}(),qt=function(t){function e(e){return void 0===e&&(e=new zt),t.call(this,"FaceExpressionNet",e)||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this;return o.L(function(){return o.D(e.runNet(t))})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictExpressions=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i,r,s=this;return Object(a.d)(this,function(l){switch(l.label){case 0:return[4,yt(t)];case 1:return e=l.sent(),[4,this.forwardInput(e)];case 2:return n=l.sent(),[4,Promise.all(o.O(n).map(function(t){return Object(a.b)(s,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,t.data()];case 1:return e=n.sent(),t.dispose(),[2,e]}})})}))];case 3:return i=l.sent(),n.dispose(),r=i.map(function(t){return new Jt(t)}),[2,e.isBatchInput?r:r[0]]}})})},e.prototype.getDefaultModelName=function(){return"face_expression_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e.prototype.getClassifierChannelsOut=function(){return 7},e}(Yt);function Zt(t){return t.expressions instanceof Jt}function Qt(t,e){var n={expressions:e};return Object.assign({},t,n)}function te(t,e,n,i){void 0===n&&(n=.1),(Array.isArray(e)?e:[e]).forEach(function(e){var r=e instanceof Jt?e:Zt(e)?e.expressions:void 0;if(!r)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var o=r.asSortedArray().filter(function(t){return t.probability>n}),s=j(e)?e.detection.box.bottomLeft:i||new C(0,0);new ot(o.map(function(t){return t.expression+" ("+m(t.probability)+")"}),s).draw(t)})}function ee(t){return j(t)&&t.landmarks instanceof B&&t.unshiftedLandmarks instanceof B&&t.alignedRect instanceof x}function ne(t,e){var n=t.detection.box,i=e.shiftBy(n.x,n.y),r=i.align(),o=t.detection.imageDims,s={landmarks:i,unshiftedLandmarks:e,alignedRect:new x(t.detection.score,r.rescale(o.reverse()),o)};return Object.assign({},t,s)}var ie=function(){return function(t){void 0===t&&(t={});var e=t.drawLines,n=void 0===e||e,i=t.drawPoints,r=void 0===i||i,o=t.lineWidth,s=t.lineColor,a=t.pointSize,l=t.pointColor;this.drawLines=n,this.drawPoints=r,this.lineWidth=o||1,this.pointSize=a||2,this.lineColor=s||"rgba(0, 255, 255, 1)",this.pointColor=l||"rgba(255, 0, 255, 1)"}}(),re=function(){function t(t,e){void 0===e&&(e={}),this.faceLandmarks=t,this.options=new ie(e)}return t.prototype.draw=function(t){var e=it(t),n=this.options,i=n.drawLines,r=n.drawPoints,o=n.lineWidth,a=n.lineColor,l=n.pointSize,u=n.pointColor;if(i&&this.faceLandmarks instanceof U&&(e.strokeStyle=a,e.lineWidth=o,s(e,this.faceLandmarks.getJawOutline()),s(e,this.faceLandmarks.getLeftEyeBrow()),s(e,this.faceLandmarks.getRightEyeBrow()),s(e,this.faceLandmarks.getNose()),s(e,this.faceLandmarks.getLeftEye(),!0),s(e,this.faceLandmarks.getRightEye(),!0),s(e,this.faceLandmarks.getMouth(),!0)),r){e.strokeStyle=u,e.fillStyle=u;this.faceLandmarks.positions.forEach(function(t){e.beginPath(),e.arc(t.x,t.y,l,0,2*Math.PI),e.fill()})}},t}();function oe(t,e){(Array.isArray(e)?e:[e]).forEach(function(e){var n=e instanceof B?e:ee(e)?e.landmarks:void 0;if(!n)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new re(n).draw(t)})}function se(t,e){var n=[],i=Ht(t),r=i.extractWeights,o=i.getRemainingWeights,s=function(t,e){var n=Lt(t,e),i=Ft(t,e);return{extractConvParams:n,extractSeparableConvParams:i,extractReductionBlockParams:function(t,e,r){return{separable_conv0:i(t,e,r+"/separable_conv0"),separable_conv1:i(e,e,r+"/separable_conv1"),expansion_conv:n(t,e,1,r+"/expansion_conv")}},extractMainBlockParams:function(t,e){return{separable_conv0:i(t,t,e+"/separable_conv0"),separable_conv1:i(t,t,e+"/separable_conv1"),separable_conv2:i(t,t,e+"/separable_conv2")}}}}(r,n),a=s.extractConvParams,l=s.extractSeparableConvParams,u=s.extractReductionBlockParams,c=s.extractMainBlockParams,h={conv_in:a(3,32,3,"entry_flow/conv_in"),reduction_block_0:u(32,64,"entry_flow/reduction_block_0"),reduction_block_1:u(64,128,"entry_flow/reduction_block_1")},p={};b(e,0,1).forEach(function(t){p["main_block_"+t]=c(128,"middle_flow/main_block_"+t)});var d={reduction_block:u(128,256,"exit_flow/reduction_block"),separable_conv:l(256,512,"exit_flow/separable_conv")};if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:n,params:{entry_flow:h,middle_flow:p,exit_flow:d}}}function ae(t,e){var n=[],i=function(t,e){var n=Vt(t,e),i=Gt(n),r=Ut(n);return{extractConvParams:i,extractSeparableConvParams:r,extractReductionBlockParams:function(t){return{separable_conv0:r(t+"/separable_conv0"),separable_conv1:r(t+"/separable_conv1"),expansion_conv:i(t+"/expansion_conv")}},extractMainBlockParams:function(t){return{separable_conv0:r(t+"/separable_conv0"),separable_conv1:r(t+"/separable_conv1"),separable_conv2:r(t+"/separable_conv2")}}}}(t,n),r=i.extractConvParams,o=i.extractSeparableConvParams,s=i.extractReductionBlockParams,a=i.extractMainBlockParams,l={conv_in:r("entry_flow/conv_in"),reduction_block_0:s("entry_flow/reduction_block_0"),reduction_block_1:s("entry_flow/reduction_block_1")},u={};b(e,0,1).forEach(function(t){u["main_block_"+t]=a("middle_flow/main_block_"+t)});var c={reduction_block:s("exit_flow/reduction_block"),separable_conv:o("exit_flow/separable_conv")};return Nt(t,n),{params:{entry_flow:l,middle_flow:u,exit_flow:c},paramMappings:n}}function le(t,e,n){return o.c(o.i(t,e.filters,n,"same"),e.bias)}function ue(t,e,n){void 0===n&&(n=!0);var i=n?o.w(t):t;return i=Ot(i,e.separable_conv0,[1,1]),i=Ot(o.w(i),e.separable_conv1,[1,1]),i=o.s(i,[3,3],[2,2],"same"),i=o.c(i,le(t,e.expansion_conv,[2,2]))}var ce,he=function(t){function e(e){var n=t.call(this,"TinyXception")||this;return n._numMainBlocks=e,n}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this,n=this.params;if(!n)throw new Error("TinyXception - load model before inference");return o.L(function(){var i=D(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(o.y(256)),r=o.w(le(i,n.entry_flow.conv_in,[2,2]));return r=ue(r=ue(r,n.entry_flow.reduction_block_0,!1),n.entry_flow.reduction_block_1),b(e._numMainBlocks,0,1).forEach(function(t){r=function(t,e){var n=Ot(o.w(t),e.separable_conv0,[1,1]);return n=Ot(o.w(n),e.separable_conv1,[1,1]),n=Ot(o.w(n),e.separable_conv2,[1,1]),n=o.c(n,t)}(r,n.middle_flow["main_block_"+t])}),r=ue(r,n.exit_flow.reduction_block),r=o.w(Ot(r,n.exit_flow.separable_conv,[1,1]))})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"tiny_xception_model"},e.prototype.extractParamsFromWeigthMap=function(t){return ae(t,this._numMainBlocks)},e.prototype.extractParams=function(t){return se(t,this._numMainBlocks)},e}(Rt);!function(t){t.FEMALE="female",t.MALE="male"}(ce||(ce={}));var pe=function(t){function e(e){void 0===e&&(e=new he(2));var n=t.call(this,"AgeGenderNet")||this;return n._faceFeatureExtractor=e,n}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return o.L(function(){var i=t instanceof _t?e.faceFeatureExtractor.forwardInput(t):t,r=o.d(i,[7,7],[2,2],"valid").as2D(i.shape[0],-1);return{age:$t(r,n.fc.age).as1D(),gender:$t(r,n.fc.gender)}})},e.prototype.forwardInput=function(t){var e=this;return o.L(function(){var n=e.runNet(t),i=n.age,r=n.gender;return{age:i,gender:o.D(r)}})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictAgeAndGender=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i,r,s,l,u=this;return Object(a.d)(this,function(c){switch(c.label){case 0:return[4,yt(t)];case 1:return e=c.sent(),[4,this.forwardInput(e)];case 2:return n=c.sent(),i=o.O(n.age),r=o.O(n.gender),s=i.map(function(t,e){return{ageTensor:t,genderTensor:r[e]}}),[4,Promise.all(s.map(function(t){var e=t.ageTensor,n=t.genderTensor;return Object(a.b)(u,void 0,void 0,function(){var t,i,r,o,s;return Object(a.d)(this,function(a){switch(a.label){case 0:return[4,e.data()];case 1:return t=a.sent()[0],[4,n.data()];case 2:return i=a.sent()[0],o=(r=i>.5)?ce.MALE:ce.FEMALE,s=r?i:1-i,e.dispose(),n.dispose(),[2,{age:t,gender:o,genderProbability:s}]}})})}))];case 3:return l=c.sent(),n.age.dispose(),n.gender.dispose(),[2,e.isBatchInput?l:l[0]]}})})},e.prototype.getDefaultModelName=function(){return"age_gender_model"},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,i=e.paramMappings;this._params=n,this._paramMappings=i},e.prototype.extractClassifierParams=function(t){return function(t){var e=[],n=Ht(t),i=n.extractWeights,r=n.getRemainingWeights,o=Pt(i,e),s=o(512,1,"fc/age"),a=o(512,2,"fc/gender");if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{paramMappings:e,params:{fc:{age:s,gender:a}}}}(t)},e.prototype.extractParamsFromWeigthMap=function(t){var e=Xt(t),n=e.featureExtractorMap,i=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e=[],n=Vt(t,e);function i(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}var r={fc:{age:i("fc/age"),gender:i("fc/gender")}};return Nt(t,e),{params:r,paramMappings:e}}(i)},e.prototype.extractParams=function(t){var e=t.slice(0,t.length-1539),n=t.slice(t.length-1539);return this.faceFeatureExtractor.extractWeights(e),this.extractClassifierParams(n)},e}(Rt),de=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.postProcess=function(t,e,n){var i=n.map(function(t){var n=t.width,i=t.height,r=e/Math.max(i,n);return{width:n*r,height:i*r}}),r=i.length;return o.L(function(){var n=function(t,e){return o.E([o.n([68],t),o.n([68],e)],1).as2D(1,136).as1D()},s=function(t,e){var n=i[t],r=n.width,o=n.height;return e(r,o)?Math.abs(r-o)/2:0};return t.mul(o.n([r,136],e)).sub(o.E(Array.from(Array(r),function(t,e){return n(function(t){return s(t,function(t,e){return t<e})}(e),function(t){return s(t,function(t,e){return e<t})}(e))}))).div(o.E(Array.from(Array(r),function(t,e){return n(i[e].width,i[e].height)})))})},e.prototype.forwardInput=function(t){var e=this;return o.L(function(){var n=e.runNet(t);return e.postProcess(n,t.inputSize,t.inputDimensions.map(function(t){return{height:t[0],width:t[1]}}))})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.detectLandmarks=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i,r=this;return Object(a.d)(this,function(s){switch(s.label){case 0:return[4,yt(t)];case 1:return e=s.sent(),n=o.L(function(){return o.O(r.forwardInput(e))}),[4,Promise.all(n.map(function(t,n){return Object(a.b)(r,void 0,void 0,function(){var i,r,o,s,l;return Object(a.d)(this,function(a){switch(a.label){case 0:return o=(r=Array).from,[4,t.data()];case 1:return i=o.apply(r,[a.sent()]),s=i.filter(function(t,e){return g(e)}),l=i.filter(function(t,e){return!g(e)}),[2,new U(Array(68).fill(0).map(function(t,e){return new C(s[e],l[e])}),{height:e.getInputHeight(n),width:e.getInputWidth(n)})]}})})}))];case 2:return i=s.sent(),n.forEach(function(t){return t.dispose()}),[2,e.isBatchInput?i:i[0]]}})})},e.prototype.getClassifierChannelsOut=function(){return 136},e}(Yt),fe=function(t){function e(e){return void 0===e&&(e=new zt),t.call(this,"FaceLandmark68Net",e)||this}return Object(a.c)(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e}(de);var ge=function(t){function e(){return t.call(this,"TinyFaceFeatureExtractor")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("TinyFaceFeatureExtractor - load model before inference");return o.L(function(){var n=Dt(D(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(o.y(255)),e.dense0,!0);return n=Dt(n=Dt(n,e.dense1),e.dense2),n=o.d(n,[14,14],[2,2],"valid")})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=jt(t,e).extractDenseBlock3Params,i={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2")};return Nt(t,e),{params:i,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Ht(t),i=n.extractWeights,r=n.getRemainingWeights,o=Wt(i,e).extractDenseBlock3Params,s=o(3,32,"dense0",!0),a=o(32,64,"dense1"),l=o(64,128,"dense2");if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{paramMappings:e,params:{dense0:s,dense1:a,dense2:l}}}(t)},e}(Rt),me=function(t){function e(e){return void 0===e&&(e=new ge),t.call(this,"FaceLandmark68TinyNet",e)||this}return Object(a.c)(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},e.prototype.getClassifierChannelsIn=function(){return 128},e}(de),ve=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e}(fe);function _e(t,e,n,i,r){void 0===r&&(r="same");var s=e.conv,a=s.filters,l=s.bias,u=o.i(t,a,n,r);return u=function(t,e){return o.c(o.t(t,e.weights),e.biases)}(u=o.c(u,l),e.scale),i?o.w(u):u}function ye(t,e){return _e(t,e,[1,1],!1)}function be(t,e){return _e(t,e,[2,2],!0,"valid")}function Te(t,e){function n(n,i,r,s){var a=function(e,n,i){var r=t(e),s=r.length/(n*i*i);if(f(s))throw new Error("depth has to be an integer: "+s+", weights.length: "+r.length+", numFilters: "+n+", filterSize: "+i);return o.L(function(){return o.N(o.K(r,[n,s,i,i]),[2,3,1,0])})}(n,i,r),l=o.H(t(i));return e.push({paramPath:s+"/filters"},{paramPath:s+"/bias"}),{filters:a,bias:l}}function i(i,r,s,a){return{conv:n(i,r,s,a+"/conv"),scale:function(n,i){var r=o.H(t(n)),s=o.H(t(n));return e.push({paramPath:i+"/weights"},{paramPath:i+"/biases"}),{weights:r,biases:s}}(r,a+"/scale")}}return{extractConvLayerParams:i,extractResidualLayerParams:function(t,e,n,r,o){return void 0===o&&(o=!1),{conv1:i((o?.5:1)*t,e,n,r+"/conv1"),conv2:i(t,e,n,r+"/conv2")}}}}function Ee(t,e){var n=Vt(t,e);function i(t){return{conv:{filters:n(t+"/conv/filters",4),bias:n(t+"/conv/bias",1)},scale:function(t){return{weights:n(t+"/scale/weights",1),biases:n(t+"/scale/biases",1)}}(t)}}return{extractConvLayerParams:i,extractResidualLayerParams:function(t){return{conv1:i(t+"/conv1"),conv2:i(t+"/conv2")}}}}function Ce(t,e){var n=function(t,e){return _e(t,e,[1,1],!0)}(t,e.conv1);return n=ye(n,e.conv2),n=o.c(n,t),n=o.w(n)}function Se(t,e){var n=be(t,e.conv1);n=ye(n,e.conv2);var i=o.d(t,2,2,"valid"),r=o.P(i.shape),s=i.shape[3]!==n.shape[3];if(i.shape[1]!==n.shape[1]||i.shape[2]!==n.shape[2]){var l=Object(a.e)(n.shape);l[1]=1;var u=o.P(l);n=o.h([n,u],1);var c=Object(a.e)(n.shape);c[2]=1;var h=o.P(c);n=o.h([n,h],2)}return i=s?o.h([i,r],3):i,n=o.c(i,n),n=o.w(n)}var we=function(t){function e(){return t.call(this,"FaceRecognitionNet")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceRecognitionNet - load model before inference");return o.L(function(){var n=be(D(t.toBatchTensor(150,!0).toFloat(),[122.782,117.001,104.298]).div(o.y(256)),e.conv32_down),i=(n=Se(n=Ce(n=Ce(n=Se(n=Ce(n=Ce(n=Se(n=Ce(n=Ce(n=Ce(n=Se(n=Ce(n=Ce(n=Ce(n=o.s(n,3,2,"valid"),e.conv32_1),e.conv32_2),e.conv32_3),e.conv64_down),e.conv64_1),e.conv64_2),e.conv64_3),e.conv128_down),e.conv128_1),e.conv128_2),e.conv256_down),e.conv256_1),e.conv256_2),e.conv256_down_out)).mean([1,2]);return o.q(i,e.fc)})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.computeFaceDescriptor=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,i,r=this;return Object(a.d)(this,function(s){switch(s.label){case 0:return[4,yt(t)];case 1:return e=s.sent(),n=o.L(function(){return o.O(r.forwardInput(e))}),[4,Promise.all(n.map(function(t){return t.data()}))];case 2:return i=s.sent(),n.forEach(function(t){return t.dispose()}),[2,e.isBatchInput?i:i[0]]}})})},e.prototype.getDefaultModelName=function(){return"face_recognition_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=Ee(t,e),i=n.extractConvLayerParams,r=n.extractResidualLayerParams,o=i("conv32_down"),s=r("conv32_1"),a=r("conv32_2"),l=r("conv32_3"),u=r("conv64_down"),c=r("conv64_1"),p=r("conv64_2"),d=r("conv64_3"),f=r("conv128_down"),g=r("conv128_1"),m=r("conv128_2"),v=r("conv256_down"),_=r("conv256_1"),y=r("conv256_2"),b=r("conv256_down_out"),T=t.fc;if(e.push({originalPath:"fc",paramPath:"fc"}),!h(T))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+T);var E={conv32_down:o,conv32_1:s,conv32_2:a,conv32_3:l,conv64_down:u,conv64_1:c,conv64_2:p,conv64_3:d,conv128_down:f,conv128_1:g,conv128_2:m,conv256_down:v,conv256_1:_,conv256_2:y,conv256_down_out:b,fc:T};return Nt(t,e),{params:E,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=Ht(t),n=e.extractWeights,i=e.getRemainingWeights,r=[],s=Te(n,r),a=s.extractConvLayerParams,l=s.extractResidualLayerParams,u=a(4704,32,7,"conv32_down"),c=l(9216,32,3,"conv32_1"),h=l(9216,32,3,"conv32_2"),p=l(9216,32,3,"conv32_3"),d=l(36864,64,3,"conv64_down",!0),f=l(36864,64,3,"conv64_1"),g=l(36864,64,3,"conv64_2"),m=l(36864,64,3,"conv64_3"),v=l(147456,128,3,"conv128_down",!0),_=l(147456,128,3,"conv128_1"),y=l(147456,128,3,"conv128_2"),b=l(589824,256,3,"conv256_down",!0),T=l(589824,256,3,"conv256_1"),E=l(589824,256,3,"conv256_2"),C=l(589824,256,3,"conv256_down_out"),S=o.L(function(){return o.N(o.I(n(32768),[128,256]),[1,0])});if(r.push({paramPath:"fc"}),0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{params:{conv32_down:u,conv32_1:c,conv32_2:h,conv32_3:p,conv64_down:d,conv64_1:f,conv64_2:g,conv64_3:m,conv128_down:v,conv128_1:_,conv128_2:y,conv256_down:b,conv256_1:T,conv256_2:E,conv256_down_out:C,fc:S},paramMappings:r}}(t)},e}(Rt);function ke(t){var e=new we;return e.extractWeights(t),e}function xe(t,e){var n={descriptor:e};return Object.assign({},t,n)}function Ie(t){return"number"==typeof t.age}function Re(t,e){var n={age:e};return Object.assign({},t,n)}function Oe(t){return(t.gender===ce.MALE||t.gender===ce.FEMALE)&&E(t.genderProbability)}function De(t,e,n){var i={gender:e,genderProbability:n};return Object.assign({},t,i)}var Ae=function(){function t(t){var e=void 0===t?{}:t,n=e.minFaceSize,i=e.scaleFactor,r=e.maxNumScales,o=e.scoreThresholds,s=e.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=n||20,this._scaleFactor=i||.709,this._maxNumScales=r||10,this._scoreThresholds=o||[.6,.7,.7],this._scaleSteps=s,"number"!=typeof this._minFaceSize||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 0");if("number"!=typeof this._scaleFactor||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if("number"!=typeof this._maxNumScales||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||3!==this._scoreThresholds.length||this._scoreThresholds.some(function(t){return"number"!=typeof t}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(t){return"number"!=typeof t})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(t.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),t}();function Me(t,e){function n(n,i,r,s,a){var l=o.K(t(n*i*r*r),[r,r,n,i]),u=o.H(t(i));return e.push({paramPath:s+"/filters"},{paramPath:s+"/"+(a?"batch_norm_offset":"bias")}),{filters:l,bias:u}}function i(t,e,i,r){var o=n(t,e,i,r,!0);return{filters:o.filters,batch_norm_offset:o.bias}}function r(n,r,s){return{depthwise_conv:function(n,i){var r=o.K(t(9*n),[3,3,n,1]),s=o.H(t(n)),a=o.H(t(n)),l=o.H(t(n)),u=o.H(t(n));return e.push({paramPath:i+"/filters"},{paramPath:i+"/batch_norm_scale"},{paramPath:i+"/batch_norm_offset"},{paramPath:i+"/batch_norm_mean"},{paramPath:i+"/batch_norm_variance"}),{filters:r,batch_norm_scale:s,batch_norm_offset:a,batch_norm_mean:l,batch_norm_variance:u}}(n,s+"/depthwise_conv"),pointwise_conv:i(n,r,1,s+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:i(3,32,3,"mobilenetv1/conv_0"),conv_1:r(32,64,"mobilenetv1/conv_1"),conv_2:r(64,128,"mobilenetv1/conv_2"),conv_3:r(128,128,"mobilenetv1/conv_3"),conv_4:r(128,256,"mobilenetv1/conv_4"),conv_5:r(256,256,"mobilenetv1/conv_5"),conv_6:r(256,512,"mobilenetv1/conv_6"),conv_7:r(512,512,"mobilenetv1/conv_7"),conv_8:r(512,512,"mobilenetv1/conv_8"),conv_9:r(512,512,"mobilenetv1/conv_9"),conv_10:r(512,512,"mobilenetv1/conv_10"),conv_11:r(512,512,"mobilenetv1/conv_11"),conv_12:r(512,1024,"mobilenetv1/conv_12"),conv_13:r(1024,1024,"mobilenetv1/conv_13")}},extractPredictionLayerParams:function(){return{conv_0:i(1024,256,1,"prediction_layer/conv_0"),conv_1:i(256,512,3,"prediction_layer/conv_1"),conv_2:i(512,128,1,"prediction_layer/conv_2"),conv_3:i(128,256,3,"prediction_layer/conv_3"),conv_4:i(256,128,1,"prediction_layer/conv_4"),conv_5:i(128,256,3,"prediction_layer/conv_5"),conv_6:i(256,64,1,"prediction_layer/conv_6"),conv_7:i(64,128,3,"prediction_layer/conv_7"),box_predictor_0:{box_encoding_predictor:n(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),class_predictor:n(512,9,1,"prediction_layer/box_predictor_0/class_predictor")},box_predictor_1:{box_encoding_predictor:n(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),class_predictor:n(1024,18,1,"prediction_layer/box_predictor_1/class_predictor")},box_predictor_2:{box_encoding_predictor:n(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),class_predictor:n(512,18,1,"prediction_layer/box_predictor_2/class_predictor")},box_predictor_3:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_3/class_predictor")},box_predictor_4:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_4/class_predictor")},box_predictor_5:{box_encoding_predictor:n(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),class_predictor:n(128,18,1,"prediction_layer/box_predictor_5/class_predictor")}}}}}function Ne(t){var e=[],n=function(t,e){var n=Vt(t,e);function i(t,e,i){return{filters:n(t+"/Conv2d_"+e+"_pointwise/weights",4,i+"/filters"),batch_norm_offset:n(t+"/Conv2d_"+e+"_pointwise/convolution_bn_offset",1,i+"/batch_norm_offset")}}function r(t){var e="mobilenetv1/conv_"+t,r="MobilenetV1/Conv2d_"+t+"_depthwise",o=e+"/depthwise_conv",s=e+"/pointwise_conv";return{depthwise_conv:{filters:n(r+"/depthwise_weights",4,o+"/filters"),batch_norm_scale:n(r+"/BatchNorm/gamma",1,o+"/batch_norm_scale"),batch_norm_offset:n(r+"/BatchNorm/beta",1,o+"/batch_norm_offset"),batch_norm_mean:n(r+"/BatchNorm/moving_mean",1,o+"/batch_norm_mean"),batch_norm_variance:n(r+"/BatchNorm/moving_variance",1,o+"/batch_norm_variance")},pointwise_conv:i("MobilenetV1",t,s)}}function o(t,e){return{filters:n(t+"/weights",4,e+"/filters"),bias:n(t+"/biases",1,e+"/bias")}}function s(t){return{box_encoding_predictor:o("Prediction/BoxPredictor_"+t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+t+"/box_encoding_predictor"),class_predictor:o("Prediction/BoxPredictor_"+t+"/ClassPredictor","prediction_layer/box_predictor_"+t+"/class_predictor")}}return{extractMobilenetV1Params:function(){return{conv_0:i("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:r(1),conv_2:r(2),conv_3:r(3),conv_4:r(4),conv_5:r(5),conv_6:r(6),conv_7:r(7),conv_8:r(8),conv_9:r(9),conv_10:r(10),conv_11:r(11),conv_12:r(12),conv_13:r(13)}},extractPredictionLayerParams:function(){return{conv_0:i("Prediction",0,"prediction_layer/conv_0"),conv_1:i("Prediction",1,"prediction_layer/conv_1"),conv_2:i("Prediction",2,"prediction_layer/conv_2"),conv_3:i("Prediction",3,"prediction_layer/conv_3"),conv_4:i("Prediction",4,"prediction_layer/conv_4"),conv_5:i("Prediction",5,"prediction_layer/conv_5"),conv_6:i("Prediction",6,"prediction_layer/conv_6"),conv_7:i("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:s(0),box_predictor_1:s(1),box_predictor_2:s(2),box_predictor_3:s(3),box_predictor_4:s(4),box_predictor_5:s(5)}}}}(t,e),i=n.extractMobilenetV1Params,r=n.extractPredictionLayerParams,o=t["Output/extra_dim"];if(e.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!p(o))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+o);var s={mobilenetv1:i(),prediction_layer:r(),output_layer:{extra_dim:o}};return Nt(t,e),{params:s,paramMappings:e}}function Le(t,e,n){return o.L(function(){var i=o.i(t,e.filters,n,"same");return i=o.c(i,e.batch_norm_offset),o.g(i,0,6)})}var Pe=.0010000000474974513;function Be(t,e){return o.L(function(){var n=null,i=Le(t,e.conv_0,[2,2]);if([e.conv_1,e.conv_2,e.conv_3,e.conv_4,e.conv_5,e.conv_6,e.conv_7,e.conv_8,e.conv_9,e.conv_10,e.conv_11,e.conv_12,e.conv_13].forEach(function(t,e){var r,s,a,l=e+1,u=function(t){return[2,4,6,12].some(function(e){return e===t})?[2,2]:[1,1]}(l);r=i,s=t.depthwise_conv,a=u,i=Le(i=o.L(function(){var t=o.j(r,s.filters,a,"same");return t=o.e(t,s.batch_norm_mean,s.batch_norm_variance,s.batch_norm_offset,s.batch_norm_scale,Pe),o.g(t,0,6)}),t.pointwise_conv,[1,1]),11===l&&(n=i)}),null===n)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:i,conv11:n}})}function Fe(t,e,n){var i=t.arraySync(),r=Math.min(i[e][0],i[e][2]),o=Math.min(i[e][1],i[e][3]),s=Math.max(i[e][0],i[e][2]),a=Math.max(i[e][1],i[e][3]),l=Math.min(i[n][0],i[n][2]),u=Math.min(i[n][1],i[n][3]),c=Math.max(i[n][0],i[n][2]),h=Math.max(i[n][1],i[n][3]),p=(s-r)*(a-o),d=(c-l)*(h-u);if(p<=0||d<=0)return 0;var f=Math.max(r,l),g=Math.max(o,u),m=Math.min(s,c),v=Math.min(a,h),_=Math.max(m-f,0)*Math.max(v-g,0);return _/(p+d-_)}function Ue(t,e){var n=function(t){var e=o.O(o.N(t,[1,0])),n=[o.F(e[2],e[0]),o.F(e[3],e[1])];return{sizes:n,centers:[o.c(e[0],o.k(n[0],o.y(2))),o.c(e[1],o.k(n[1],o.y(2)))]}}(t),i=n.sizes,r=n.centers,s=o.O(o.N(e,[1,0])),a=o.k(o.t(o.l(o.k(s[2],o.y(5))),i[0]),o.y(2)),l=o.c(o.t(o.k(s[0],o.y(10)),i[0]),r[0]),u=o.k(o.t(o.l(o.k(s[3],o.y(5))),i[1]),o.y(2)),c=o.c(o.t(o.k(s[1],o.y(10)),i[1]),r[1]);return o.N(o.E([o.F(l,a),o.F(c,u),o.c(l,a),o.c(c,u)]),[1,0])}function Ve(t,e){return o.L(function(){var n=t.shape[0];return{boxPredictionEncoding:o.x(Mt(t,e.box_encoding_predictor),[n,-1,1,4]),classPrediction:o.x(Mt(t,e.class_predictor),[n,-1,3])}})}var He=function(){function t(t){var e=void 0===t?{}:t,n=e.minConfidence,i=e.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=n||.5,this._maxResults=i||100,"number"!=typeof this._minConfidence||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if("number"!=typeof this._maxResults)throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(t.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),t}(),We=function(t){function e(){return t.call(this,"SsdMobilenetv1")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("SsdMobilenetv1 - load model before inference");return o.L(function(){var n=t.toBatchTensor(512,!1).toFloat(),i=Be(o.F(o.t(n,o.y(.007843137718737125)),o.y(1)),e.mobilenetv1),r=function(t,e,n){return o.L(function(){var i=Le(Le(t,n.conv_0,[1,1]),n.conv_1,[2,2]),r=Le(Le(i,n.conv_2,[1,1]),n.conv_3,[2,2]),s=Le(Le(r,n.conv_4,[1,1]),n.conv_5,[2,2]),a=Le(Le(s,n.conv_6,[1,1]),n.conv_7,[2,2]),l=Ve(e,n.box_predictor_0),u=Ve(t,n.box_predictor_1),c=Ve(i,n.box_predictor_2),h=Ve(r,n.box_predictor_3),p=Ve(s,n.box_predictor_4),d=Ve(a,n.box_predictor_5);return{boxPredictions:o.h([l.boxPredictionEncoding,u.boxPredictionEncoding,c.boxPredictionEncoding,h.boxPredictionEncoding,p.boxPredictionEncoding,d.boxPredictionEncoding],1),classPredictions:o.h([l.classPrediction,u.classPrediction,c.classPrediction,h.classPrediction,p.classPrediction,d.classPrediction],1)}})}(i.out,i.conv11,e.prediction_layer);return function(t,e,n){return o.L(function(){var i=t.shape[0],r=Ue(o.x(o.M(n.extra_dim,[i,1,1]),[-1,4]),o.x(t,[-1,4]));r=o.x(r,[i,r.shape[0]/i,4]);var s=o.A(o.B(e,[0,0,1],[-1,-1,-1])),a=o.B(s,[0,0,0],[-1,-1,1]);return a=o.x(a,[i,a.shape[1]]),{boxes:o.O(r),scores:o.O(a)}})}(r.boxPredictions,r.classPredictions,e.output_layer)})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,yt(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.locateFaces=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,i,r,o,s,l,u,c,h,p,d,f,g,m,v,_,y,b,T,E;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=new He(e),i=n.maxResults,r=n.minConfidence,[4,yt(t)];case 1:for(o=a.sent(),s=this.forwardInput(o),l=s.boxes,u=s.scores,c=l[0],h=u[0],p=1;p<l.length;p++)l[p].dispose(),u[p].dispose();return g=(f=Array).from,[4,h.data()];case 2:return d=g.apply(f,[a.sent()]),m=function(t,e,n,i,r){var o=t.shape[0],s=Math.min(n,o),a=[];return e.map(function(t,e){return{score:t,boxIndex:e}}).filter(function(t){return t.score>r}).sort(function(t,e){return e.score-t.score}).forEach(function(e){if(!(a.length>=s)){for(var n=e.score,o=a.length-1;o>=0;--o){var l=Fe(t,e.boxIndex,a[o]);if(0!==l&&(e.score*=l<=i?1:0,e.score<=r))break}n===e.score&&a.push(e.boxIndex)}}),a}(c,d,i,.5,r),v=o.getReshapedInputDimensions(0),_=o.inputSize,y=_/v.width,b=_/v.height,T=c.arraySync(),E=m.map(function(t){var e=[Math.max(0,T[t][0]),Math.min(1,T[t][2])].map(function(t){return t*b}),n=e[0],i=e[1],r=[Math.max(0,T[t][1]),Math.min(1,T[t][3])].map(function(t){return t*y}),s=r[0],a=r[1];return new x(d[t],new P(s,n,a-s,i-n),{height:o.getInputHeight(0),width:o.getInputWidth(0)})}),c.dispose(),h.dispose(),[2,E]}})})},e.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},e.prototype.extractParamsFromWeigthMap=function(t){return Ne(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Ht(t),i=n.extractWeights,r=n.getRemainingWeights,s=Me(i,e),a=s.extractMobilenetV1Params,l=s.extractPredictionLayerParams,u=a(),c=l(),h={extra_dim:o.J(i(20472),[1,5118,4])};if(e.push({paramPath:"output_layer/extra_dim"}),0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{mobilenetv1:u,prediction_layer:c,output_layer:h},paramMappings:e}}(t)},e}(Rt);function Ge(t){var e=new We;return e.extractWeights(t),e}function je(t){return Ge(t)}var ze,$e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e}(We),Xe=.4,Ye=[new C(.738768,.874946),new C(2.42204,2.65704),new C(4.30971,7.04493),new C(10.246,4.59428),new C(12.6868,11.8741)],Ke=[new C(1.603231,2.094468),new C(6.041143,7.080126),new C(2.882459,3.518061),new C(4.266906,5.178857),new C(9.041765,10.66308)],Je=[117.001,114.697,97.404],qe=function(t){return"number"==typeof t};function Ze(t){if(!t)throw new Error("invalid config: "+t);if("boolean"!=typeof t.withSeparableConvs)throw new Error("config.withSeparableConvs has to be a boolean, have: "+t.withSeparableConvs);if(!qe(t.iouThreshold)||t.iouThreshold<0||t.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+t.iouThreshold);if(!Array.isArray(t.classes)||!t.classes.length||!t.classes.every(function(t){return"string"==typeof t}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(t.classes));if(!Array.isArray(t.anchors)||!t.anchors.length||!t.anchors.map(function(t){return t||{}}).every(function(t){return qe(t.x)&&qe(t.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(t.anchors));if(t.meanRgb&&(!Array.isArray(t.meanRgb)||3!==t.meanRgb.length||!t.meanRgb.every(qe)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(t.meanRgb))}function Qe(t){return o.L(function(){var e=o.t(t,o.y(.10000000149011612));return o.c(o.w(o.F(t,e)),e)})}function tn(t,e){return o.L(function(){var n=o.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=o.i(n,e.conv.filters,[1,1],"valid"),n=o.F(n,e.bn.sub),n=o.t(n,e.bn.truediv),Qe(n=o.c(n,e.conv.bias))})}function en(t,e){return o.L(function(){var n=o.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=o.z(n,e.depthwise_filter,e.pointwise_filter,[1,1],"valid"),Qe(n=o.c(n,e.bias))})}function nn(t,e){var n=Lt(t,e);var i=Ft(t,e);return{extractConvParams:n,extractConvWithBatchNormParams:function(i,r,s){return{conv:n(i,r,3,s+"/conv"),bn:function(n,i){var r=o.H(t(n)),s=o.H(t(n));return e.push({paramPath:i+"/sub"},{paramPath:i+"/truediv"}),{sub:r,truediv:s}}(r,s+"/bn")}},extractSeparableConvParams:i}}function rn(t,e){var n=Vt(t,e);function i(t){return{filters:n(t+"/filters",4),bias:n(t+"/bias",1)}}return{extractConvParams:i,extractConvWithBatchNormParams:function(t){return{conv:i(t+"/conv"),bn:function(t){return{sub:n(t+"/sub",1),truediv:n(t+"/truediv",1)}}(t+"/bn")}},extractSeparableConvParams:Ut(n)}}!function(t){t[t.XS=224]="XS",t[t.SM=320]="SM",t[t.MD=416]="MD",t[t.LG=608]="LG"}(ze||(ze={}));var on=function(){function t(t){var e=void 0===t?{}:t,n=e.inputSize,i=e.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=n||416,this._scoreThreshold=i||.5,"number"!=typeof this._inputSize||this._inputSize%32!=0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if("number"!=typeof this._scoreThreshold||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),t}(),sn=function(t){function e(e){var n=t.call(this,"TinyYolov2")||this;return Ze(e),n._config=e,n}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),e.prototype.runTinyYolov2=function(t,e){var n=tn(t,e.conv0);return n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv1),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv2),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv3),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv4),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv5),Mt(n=tn(n=tn(n=o.s(n,[2,2],[1,1],"same"),e.conv6),e.conv7),e.conv8,"valid",!1)},e.prototype.runMobilenet=function(t,e){var n=this.config.isFirstLayerConv2d?Qe(Mt(t,e.conv0,"valid",!1)):en(t,e.conv0);return n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv1),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv2),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv3),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv4),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv5),n=o.s(n,[2,2],[1,1],"same"),n=e.conv6?en(n,e.conv6):n,Mt(n=e.conv7?en(n,e.conv7):n,e.conv8,"valid",!1)},e.prototype.forwardInput=function(t,e){var n=this,i=this.params;if(!i)throw new Error("TinyYolov2 - load model before inference");return o.L(function(){var r=t.toBatchTensor(e,!1).toFloat();return r=(r=n.config.meanRgb?D(r,n.config.meanRgb):r).div(o.y(256)),n.config.withSeparableConvs?n.runMobilenet(r,i):n.runTinyYolov2(r,i)})},e.prototype.forward=function(t,e){return Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(i){switch(i.label){case 0:return n=this.forwardInput,[4,yt(t)];case 1:return[4,n.apply(this,[i.sent(),e])];case 2:return[2,i.sent()]}})})},e.prototype.detect=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,i,r,s,l,u,c,h,p,d,f,g,m,v=this;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=new on(e),i=n.inputSize,r=n.scoreThreshold,[4,yt(t)];case 1:return s=a.sent(),[4,this.forwardInput(s,i)];case 2:return l=a.sent(),u=o.L(function(){return o.O(l)[0].expandDims()}),c={width:s.getInputWidth(0),height:s.getInputHeight(0)},[4,this.extractBoxes(u,s.getReshapedInputDimensions(0),r)];case 3:return h=a.sent(),l.dispose(),u.dispose(),p=h.map(function(t){return t.box}),d=h.map(function(t){return t.score}),f=h.map(function(t){return t.classScore}),g=h.map(function(t){return v.config.classes[t.label]}),m=O(p.map(function(t){return t.rescale(i)}),d,this.config.iouThreshold,!0),[2,m.map(function(t){return new k(d[t],f[t],g[t],p[t],c)})]}})})},e.prototype.getDefaultModelName=function(){return""},e.prototype.extractParamsFromWeigthMap=function(t){return function(t,e){var n,i=[],r=rn(t,i),o=r.extractConvParams,s=r.extractConvWithBatchNormParams,a=r.extractSeparableConvParams;if(e.withSeparableConvs){var l=e.filterSizes&&e.filterSizes.length||9;n={conv0:e.isFirstLayerConv2d?o("conv0"):a("conv0"),conv1:a("conv1"),conv2:a("conv2"),conv3:a("conv3"),conv4:a("conv4"),conv5:a("conv5"),conv6:l>7?a("conv6"):void 0,conv7:l>8?a("conv7"):void 0,conv8:o("conv8")}}else n={conv0:s("conv0"),conv1:s("conv1"),conv2:s("conv2"),conv3:s("conv3"),conv4:s("conv4"),conv5:s("conv5"),conv6:s("conv6"),conv7:s("conv7"),conv8:o("conv8")};return Nt(t,i),{params:n,paramMappings:i}}(t,this.config)},e.prototype.extractParams=function(t){var n=this.config.filterSizes||e.DEFAULT_FILTER_SIZES,i=n?n.length:void 0;if(7!==i&&8!==i&&9!==i)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+i+" filterSizes in config");return function(t,e,n,i){var r,o=Ht(t),s=o.extractWeights,a=o.getRemainingWeights,l=[],u=nn(s,l),c=u.extractConvParams,h=u.extractConvWithBatchNormParams,p=u.extractSeparableConvParams;if(e.withSeparableConvs){var d=i[0],f=i[1],g=i[2],m=i[3],v=i[4],_=i[5],y=i[6],b=i[7],T=i[8];r={conv0:e.isFirstLayerConv2d?c(d,f,3,"conv0"):p(d,f,"conv0"),conv1:p(f,g,"conv1"),conv2:p(g,m,"conv2"),conv3:p(m,v,"conv3"),conv4:p(v,_,"conv4"),conv5:p(_,y,"conv5"),conv6:b?p(y,b,"conv6"):void 0,conv7:T?p(b,T,"conv7"):void 0,conv8:c(T||b||y,5*n,1,"conv8")}}else d=i[0],f=i[1],g=i[2],m=i[3],v=i[4],_=i[5],y=i[6],b=i[7],T=i[8],r={conv0:h(d,f,"conv0"),conv1:h(f,g,"conv1"),conv2:h(g,m,"conv2"),conv3:h(m,v,"conv3"),conv4:h(v,_,"conv4"),conv5:h(_,y,"conv5"),conv6:h(y,b,"conv6"),conv7:h(b,T,"conv7"),conv8:c(T,5*n,1,"conv8")};if(0!==a().length)throw new Error("weights remaing after extract: "+a().length);return{params:r,paramMappings:l}}(t,this.config,this.boxEncodingSize,n)},e.prototype.extractBoxes=function(t,e,n){return Object(a.b)(this,void 0,void 0,function(){var i,r,s,l,u,c,h,p,d,f,g,m,v,_,y,b,T,E,C,S,k,x,I,R,O,D,A,M,L,P=this;return Object(a.d)(this,function(B){switch(B.label){case 0:return i=e.width,r=e.height,s=Math.max(i,r),l=s/i,u=s/r,c=t.shape[1],h=this.config.anchors.length,p=o.L(function(){var e=t.reshape([c,c,h,P.boxEncodingSize]);return[e.slice([0,0,0,0],[c,c,h,4]),e.slice([0,0,0,4],[c,c,h,1]),P.withClassScores?o.D(e.slice([0,0,0,5],[c,c,h,P.config.classes.length]),3):o.y(0)]}),d=p[0],f=p[1],g=p[2],m=[],[4,f.array()];case 1:return v=B.sent(),[4,d.array()];case 2:_=B.sent(),y=0,B.label=3;case 3:if(!(y<c))return[3,12];b=0,B.label=4;case 4:if(!(b<c))return[3,11];T=0,B.label=5;case 5:return T<h?(E=N(v[y][b][T][0]),!n||E>n?(C=(b+N(_[y][b][T][0]))/c*l,S=(y+N(_[y][b][T][1]))/c*u,k=Math.exp(_[y][b][T][2])*this.config.anchors[T].x/c*l,x=Math.exp(_[y][b][T][3])*this.config.anchors[T].y/c*u,I=C-k/2,R=S-x/2,O={row:y,col:b,anchor:T},this.withClassScores?[4,this.extractPredictedClass(g,O)]:[3,7]):[3,9]):[3,10];case 6:return L=B.sent(),[3,8];case 7:L={classScore:1,label:0},B.label=8;case 8:A=(D=L).classScore,M=D.label,m.push(Object(a.a)({box:new w(I,R,I+k,R+x),score:E,classScore:E*A,label:M},O)),B.label=9;case 9:return T++,[3,5];case 10:return b++,[3,4];case 11:return y++,[3,3];case 12:return d.dispose(),f.dispose(),g.dispose(),[2,m]}})})},e.prototype.extractPredictedClass=function(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,i,r,o;return Object(a.d)(this,function(s){switch(s.label){case 0:return n=e.row,i=e.col,r=e.anchor,[4,t.array()];case 1:return o=s.sent(),[2,Array(this.config.classes.length).fill(0).map(function(t,e){return o[n][i][r][e]}).map(function(t,e){return{classScore:t,label:e}}).reduce(function(t,e){return t.classScore>e.classScore?t:e})]}})})},e.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],e}(Rt),an=function(t){function e(e){void 0===e&&(e=!0);var n=Object.assign({},{withSeparableConvs:e,iouThreshold:Xe,classes:["face"]},e?{anchors:Ke,meanRgb:Je}:{anchors:Ye,withClassScores:!0});return t.call(this,n)||this}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new x(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return this.withSeparableConvs?"tiny_yolov2_separable_conv_model":"tiny_yolov2_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(sn);function ln(t,e){void 0===e&&(e=!0);var n=new an(e);return n.extractWeights(t),n}var un=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._name="TinyFaceDetectorOptions",e}return Object(a.c)(e,t),e}(on),cn=function(){function t(){}return t.prototype.then=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=t,[4,this.run()];case 1:return[2,e.apply(void 0,[n.sent()])]}})})},t.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(t){throw new Error("ComposableTask - run is not implemented")})})},t}();function hn(t,e,n,i,r){return void 0===r&&(r=function(t){return t.alignedRect}),Object(a.b)(this,void 0,void 0,function(){var s,l,u,c,h;return Object(a.d)(this,function(a){switch(a.label){case 0:return s=t.map(function(t){return ee(t)?r(t):t.detection}),(u=i)?[3,5]:e instanceof o.a?[4,Tt(e,s)]:[3,2];case 1:return c=a.sent(),[3,4];case 2:return[4,bt(e,s)];case 3:c=a.sent(),a.label=4;case 4:u=c,a.label=5;case 5:return[4,n(l=u)];case 6:return h=a.sent(),l.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,h]}})})}function pn(t,e,n,i,r){return Object(a.b)(this,void 0,void 0,function(){var o=this;return Object(a.d)(this,function(s){return[2,hn([t],e,function(t){return Object(a.b)(o,void 0,void 0,function(){return Object(a.d)(this,function(e){return[2,n(t[0])]})})},i,r)]})})}var dn=2,fn=12;function gn(t){var e=Ht(t),n=e.extractWeights,i=e.getRemainingWeights,r=[],s=function(t,e){var n=Lt(t,e),i=Pt(t,e);function r(n,i){var r=o.H(t(n));return e.push({paramPath:i}),r}function s(t,e,i){return void 0===i&&(i=!1),{conv1:n(t[0],t[1],3,e+"/conv1"),prelu1_alpha:r(t[1],e+"/prelu1_alpha"),conv2:n(t[1],t[2],3,e+"/conv2"),prelu2_alpha:r(t[2],e+"/prelu2_alpha"),conv3:n(t[2],t[3],i?2:3,e+"/conv3"),prelu3_alpha:r(t[3],e+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=s([3,10,16,32],"pnet"),e=n(32,2,1,"pnet/conv4_1"),i=n(32,4,1,"pnet/conv4_2");return Object(a.a)(Object(a.a)({},t),{conv4_1:e,conv4_2:i})},extractRNetParams:function(){var t=s([3,28,48,64],"rnet",!0),e=i(576,128,"rnet/fc1"),n=r(128,"rnet/prelu4_alpha"),o=i(128,2,"rnet/fc2_1"),l=i(128,4,"rnet/fc2_2");return Object(a.a)(Object(a.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:o,fc2_2:l})},extractONetParams:function(){var t=s([3,32,64,64],"onet"),e=n(64,128,2,"onet/conv4"),o=r(128,"onet/prelu4_alpha"),l=i(1152,256,"onet/fc1"),u=r(256,"onet/prelu5_alpha"),c=i(256,2,"onet/fc2_1"),h=i(256,4,"onet/fc2_2"),p=i(256,10,"onet/fc2_3");return Object(a.a)(Object(a.a)({},t),{conv4:e,prelu4_alpha:o,fc1:l,prelu5_alpha:u,fc2_1:c,fc2_2:h,fc2_3:p})}}}(n,r),l=s.extractPNetParams,u=s.extractRNetParams,c=s.extractONetParams,h=l(),p=u(),d=c();if(0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{params:{pnet:h,rnet:p,onet:d},paramMappings:r}}function mn(t){var e=[],n=function(t,e){var n=Vt(t,e);function i(t){return{filters:n(t+"/weights",4,t+"/filters"),bias:n(t+"/bias",1)}}function r(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}function o(t){return n(t,1)}function s(t){return{conv1:i(t+"/conv1"),prelu1_alpha:o(t+"/prelu1_alpha"),conv2:i(t+"/conv2"),prelu2_alpha:o(t+"/prelu2_alpha"),conv3:i(t+"/conv3"),prelu3_alpha:o(t+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=s("pnet"),e=i("pnet/conv4_1"),n=i("pnet/conv4_2");return Object(a.a)(Object(a.a)({},t),{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=s("rnet"),e=r("rnet/fc1"),n=o("rnet/prelu4_alpha"),i=r("rnet/fc2_1"),l=r("rnet/fc2_2");return Object(a.a)(Object(a.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:i,fc2_2:l})},extractONetParams:function(){var t=s("onet"),e=i("onet/conv4"),n=o("onet/prelu4_alpha"),l=r("onet/fc1"),u=o("onet/prelu5_alpha"),c=r("onet/fc2_1"),h=r("onet/fc2_2"),p=r("onet/fc2_3");return Object(a.a)(Object(a.a)({},t),{conv4:e,prelu4_alpha:n,fc1:l,prelu5_alpha:u,fc2_1:c,fc2_2:h,fc2_3:p})}}}(t,e),i=n.extractPNetParams,r=n.extractRNetParams,o=n.extractONetParams,s=i(),l=r(),u=o();return Nt(t,e),{params:{pnet:s,rnet:l,onet:u},paramMappings:e}}function vn(t,e){var n=e[0],i=e[1];return{height:Math.floor(n*t),width:Math.floor(i*t)}}var _n=function(t){function e(e,n,i,r){return t.call(this,{left:e,top:n,right:i,bottom:r},!0)||this}return Object(a.c)(e,t),e}(S);function yn(t){return o.L(function(){return o.t(o.F(t,o.y(127.5)),o.y(.0078125))})}function bn(t,e){return o.L(function(){return o.c(o.w(t),o.t(e,o.u(o.w(o.u(t)))))})}function Tn(t,e,n){return void 0===n&&(n=!1),o.L(function(){var i=Mt(t,e.conv1,"valid");return i=bn(i,e.prelu1_alpha),i=bn(i=Mt(i=o.s(i,n?[2,2]:[3,3],[2,2],"same"),e.conv2,"valid"),e.prelu2_alpha),i=bn(i=Mt(i=n?i:o.s(i,[3,3],[2,2],"valid"),e.conv3,"valid"),e.prelu3_alpha)})}function En(t,e,n,i,r){r.stage1=[];var s=e.map(function(e){return o.L(function(){var n={scale:e},r=function(t,e){return o.L(function(){var n=vn(e,t.shape.slice(1)),i=n.height,r=n.width,s=yn(o.o.resizeBilinear(t,[i,r]));return o.N(s,[0,2,1,3])})}(t,e),s=Date.now(),a=function(t,e){return o.L(function(){var n=Tn(t,e,!0),i=Mt(n,e.conv4_1,"valid"),r=o.m(o.r(i,3),3);return{prob:o.D(o.F(i,r),3),regions:Mt(n,e.conv4_2,"valid")}})}(r,i),l=a.prob,u=a.regions;return n.pnet=Date.now()-s,{scoresTensor:o.O(o.O(l,3)[1])[0],regionsTensor:o.O(u)[0],scale:e,statsForScale:n}})}).map(function(t){var e=t.scoresTensor,i=t.regionsTensor,o=t.scale,s=t.statsForScale,a=function(t,e,n,i){for(var r=[],o=t.arraySync(),s=0;s<t.shape[0];s++)for(var a=0;a<t.shape[1];a++)o[s][a]>=i&&r.push(new C(a,s));return r.map(function(t){var i=new w(Math.round((t.y*dn+1)/n),Math.round((t.x*dn+1)/n),Math.round((t.y*dn+fn)/n),Math.round((t.x*dn+fn)/n)),r=o[t.y][t.x],s=e.arraySync();return{cell:i,score:r,region:new _n(s[t.y][t.x][0],s[t.y][t.x][1],s[t.y][t.x][2],s[t.y][t.x][3])}})}(e,i,o,n);if(e.dispose(),i.dispose(),!a.length)return r.stage1.push(s),[];var l=Date.now(),u=O(a.map(function(t){return t.cell}),a.map(function(t){return t.score}),.5);return s.nms=Date.now()-l,s.numBoxes=u.length,r.stage1.push(s),u.map(function(t){return a[t]})}).reduce(function(t,e){return t.concat(e)},[]),a=[],l=[];if(s.length>0){var u=Date.now(),c=O(s.map(function(t){return t.cell}),s.map(function(t){return t.score}),.7);r.stage1_nms=Date.now()-u,l=c.map(function(t){return s[t].score}),a=c.map(function(t){return s[t]}).map(function(t){var e=t.cell,n=t.region;return new w(e.left+n.left*e.width,e.top+n.top*e.height,e.right+n.right*e.width,e.bottom+n.bottom*e.height).toSquare().round()})}return{boxes:a,scores:l}}function Cn(t,e,n){var i=n.width,r=n.height;return Object(a.b)(this,void 0,void 0,function(){var n,s,l,u=this;return Object(a.d)(this,function(c){switch(c.label){case 0:return n=it(t),[4,Promise.all(e.map(function(e){return Object(a.b)(u,void 0,void 0,function(){var i,r,o,s,l,u,c,h;return Object(a.d)(this,function(a){return i=e.padAtBorders(t.height,t.width),r=i.y,o=i.ey,s=i.x,l=i.ex,u=s-1,c=r-1,h=n.getImageData(u,c,l-u,o-c),[2,et.isNodejs()?ft(h):createImageBitmap(h)]})})}))];case 1:return s=c.sent(),l=[],s.forEach(function(t){var e=it(dt({width:i,height:r}));e.drawImage(t,0,0,i,r);for(var n=e.getImageData(0,0,i,r).data,o=[],s=0;s<n.length;s+=4)o.push(n[s+2]),o.push(n[s+1]),o.push(n[s]);l.push(o)}),[2,l.map(function(t){return o.L(function(){return yn(o.N(o.K(t,[1,i,r,3]),[0,2,1,3]).toFloat())})})]}})})}function Sn(t,e,n,i,r){return Object(a.b)(this,void 0,void 0,function(){var s,l,u,c,h,p,d,f,g,m,v,_,y,b;return Object(a.d)(this,function(a){switch(a.label){case 0:return s=Date.now(),[4,Cn(t,e,{width:24,height:24})];case 1:return l=a.sent(),r.stage2_extractImagePatches=Date.now()-s,s=Date.now(),u=l.map(function(t){var e=function(t,e){return o.L(function(){var n=Tn(t,e),i=bn($t(o.x(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu4_alpha),r=$t(i,e.fc2_1),s=o.m(o.r(r,1),1),a=o.D(o.F(r,s),1),l=$t(i,e.fc2_2);return{scores:o.O(a,1)[1],regions:l}})}(t,i);return t.dispose(),e}),r.stage2_rnet=Date.now()-s,c=u.length>1?o.h(u.map(function(t){return t.scores})):u[0].scores,d=(p=Array).from,[4,c.data()];case 2:return h=d.apply(p,[a.sent()]),c.dispose(),f=h.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),g=f.map(function(t){return e[t]}),m=f.map(function(t){return h[t]}),v=[],_=[],g.length>0&&(s=Date.now(),y=O(g,m,.7),r.stage2_nms=Date.now()-s,b=y.map(function(t){var e=u[f[t]].regions.arraySync();return new _n(e[0][0],e[0][1],e[0][2],e[0][3])}),_=y.map(function(t){return m[t]}),v=y.map(function(t,e){return g[t].calibrate(b[e])})),u.forEach(function(t){t.regions.dispose(),t.scores.dispose()}),[2,{boxes:v,scores:_}]}})})}function wn(t,e,n,i,r){return Object(a.b)(this,void 0,void 0,function(){var s,l,u,c,h,p,d,f,g,m,v,_,y,b,T;return Object(a.d)(this,function(a){switch(a.label){case 0:return s=Date.now(),[4,Cn(t,e,{width:48,height:48})];case 1:return l=a.sent(),r.stage3_extractImagePatches=Date.now()-s,s=Date.now(),u=l.map(function(t){var e=function(t,e){return o.L(function(){var n=Tn(t,e);n=bn(n=Mt(n=o.s(n,[2,2],[2,2],"same"),e.conv4,"valid"),e.prelu4_alpha);var i=bn($t(o.x(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu5_alpha),r=$t(i,e.fc2_1),s=o.m(o.r(r,1),1),a=o.D(o.F(r,s),1),l=$t(i,e.fc2_2),u=$t(i,e.fc2_3);return{scores:o.O(a,1)[1],regions:l,points:u}})}(t,i);return t.dispose(),e}),r.stage3_onet=Date.now()-s,c=u.length>1?o.h(u.map(function(t){return t.scores})):u[0].scores,d=(p=Array).from,[4,c.data()];case 2:return h=d.apply(p,[a.sent()]),c.dispose(),f=h.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),g=f.map(function(t){var e=u[t].regions.arraySync();return new _n(e[0][0],e[0][1],e[0][2],e[0][3])}),m=f.map(function(t,n){return e[t].calibrate(g[n])}),v=f.map(function(t){return h[t]}),_=[],y=[],b=[],m.length>0&&(s=Date.now(),T=O(m,v,.7,!1),r.stage3_nms=Date.now()-s,_=T.map(function(t){return m[t]}),y=T.map(function(t){return v[t]}),b=T.map(function(t,e){return Array(5).fill(0).map(function(n,i){var r=u[t].points.arraySync();return new C(r[0][i]*(_[e].width+1)+_[e].left,r[0][i+5]*(_[e].height+1)+_[e].top)})})),u.forEach(function(t){t.regions.dispose(),t.scores.dispose(),t.points.dispose()}),[2,{boxes:_,scores:y,points:b}]}})})}var kn=function(t){function e(){return t.call(this,"Mtcnn")||this}return Object(a.c)(e,t),e.prototype.load=function(e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){return console.warn("mtcnn is deprecated and will be removed soon"),[2,t.prototype.load.call(this,e)]})})},e.prototype.loadFromDisk=function(e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){return console.warn("mtcnn is deprecated and will be removed soon"),[2,t.prototype.loadFromDisk.call(this,e)]})})},e.prototype.forwardInput=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,i,r,s,l,u,c,h,p,d,f,g,m,v,_,y,b,T,E,S,w;return Object(a.d)(this,function(a){switch(a.label){case 0:if(!(n=this.params))throw new Error("Mtcnn - load model before inference");if(!(i=t.canvases[0]))throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return r={},s=Date.now(),l=o.L(function(){return t=o.m(o.f.fromPixels(i)).toFloat(),o.L(function(){return o.E(o.O(t,3).reverse(),3)});var t}),u=function(t){return l.dispose(),r.total=Date.now()-s,t},c=l.shape.slice(1),h=c[0],p=c[1],d=new Ae(e),f=d.minFaceSize,g=d.scaleFactor,m=d.maxNumScales,v=d.scoreThresholds,_=d.scaleSteps,y=(_||function(t,e,n){for(var i=n[0],r=n[1],o=fn/t,s=[],a=Math.min(i,r)*o,l=0;a>=12;)s.push(o*Math.pow(e,l)),a*=e,l+=1;return s}(f,g,[h,p])).filter(function(t){var e=vn(t,[h,p]);return Math.min(e.width,e.height)>fn}).slice(0,m),r.scales=y,r.pyramid=y.map(function(t){return vn(t,[h,p])}),b=Date.now(),[4,En(l,y,v[0],n.pnet,r)];case 1:return T=a.sent(),r.total_stage1=Date.now()-b,T.boxes.length?(r.stage2_numInputBoxes=T.boxes.length,b=Date.now(),[4,Sn(i,T.boxes,v[1],n.rnet,r)]):[2,u({results:[],stats:r})];case 2:return E=a.sent(),r.total_stage2=Date.now()-b,E.boxes.length?(r.stage3_numInputBoxes=E.boxes.length,b=Date.now(),[4,wn(i,E.boxes,v[2],n.onet,r)]):[2,u({results:[],stats:r})];case 3:return S=a.sent(),r.total_stage3=Date.now()-b,w=S.boxes.map(function(t,e){return ne(z({},new x(S.scores[e],new P(t.left/p,t.top/h,t.width/p,t.height/h),{height:h,width:p})),new F(S.points[e].map(function(e){return e.sub(new C(t.left,t.top)).div(new C(t.width,t.height))}),{width:t.width,height:t.height}))}),[2,u({results:w,stats:r})]}})})},e.prototype.forward=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(i){switch(i.label){case 0:return n=this.forwardInput,[4,yt(t)];case 1:return[4,n.apply(this,[i.sent(),e])];case 2:return[2,i.sent().results]}})})},e.prototype.forwardWithStats=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(i){switch(i.label){case 0:return n=this.forwardInput,[4,yt(t)];case 1:return[2,n.apply(this,[i.sent(),e])]}})})},e.prototype.getDefaultModelName=function(){return"mtcnn_model"},e.prototype.extractParamsFromWeigthMap=function(t){return mn(t)},e.prototype.extractParams=function(t){return gn(t)},e}(Rt),xn=.4,In=[new C(1.603231,2.094468),new C(6.041143,7.080126),new C(2.882459,3.518061),new C(4.266906,5.178857),new C(9.041765,10.66308)],Rn=[117.001,114.697,97.404],On=function(t){function e(){var e={withSeparableConvs:!0,iouThreshold:xn,classes:["face"],anchors:In,meanRgb:Rn,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return t.call(this,e)||this}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new x(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(sn),Dn={ssdMobilenetv1:new We,tinyFaceDetector:new On,tinyYolov2:new an,mtcnn:new kn,faceLandmark68Net:new fe,faceLandmark68TinyNet:new me,faceRecognitionNet:new we,faceExpressionNet:new qt,ageGenderNet:new pe},An=function(t,e){return Dn.ssdMobilenetv1.locateFaces(t,e)},Mn=function(t,e){return Dn.tinyFaceDetector.locateFaces(t,e)},Nn=function(t,e){return Dn.tinyYolov2.locateFaces(t,e)},Ln=function(t,e){return Dn.mtcnn.forward(t,e)},Pn=function(t){return Dn.faceLandmark68Net.detectLandmarks(t)},Bn=function(t){return Dn.faceLandmark68TinyNet.detectLandmarks(t)},Fn=function(t){return Dn.faceRecognitionNet.computeFaceDescriptor(t)},Un=function(t){return Dn.faceExpressionNet.predictExpressions(t)},Vn=function(t){return Dn.ageGenderNet.predictAgeAndGender(t)},Hn=function(t){return Dn.ssdMobilenetv1.load(t)},Wn=function(t){return Dn.tinyFaceDetector.load(t)},Gn=function(t){return Dn.mtcnn.load(t)},jn=function(t){return Dn.tinyYolov2.load(t)},zn=function(t){return Dn.faceLandmark68Net.load(t)},$n=function(t){return Dn.faceLandmark68TinyNet.load(t)},Xn=function(t){return Dn.faceRecognitionNet.load(t)},Yn=function(t){return Dn.faceExpressionNet.load(t)},Kn=function(t){return Dn.ageGenderNet.load(t)},Jn=Hn,qn=An,Zn=Pn,Qn=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r.extractedFaces=i,r}return Object(a.c)(e,t),e}(cn),ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n=this;return Object(a.d)(this,function(i){switch(i.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=i.sent(),this.input,function(t){return Object(a.b)(n,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return Dn.faceExpressionNet.predictExpressions(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=i.sent(),[2,t.map(function(t,n){return Qt(t,e[n])})]}})})},e.prototype.withAgeAndGender=function(){return new oi(this,this.input)},e}(Qn),ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,pn(t,this.input,function(t){return Dn.faceExpressionNet.predictExpressions(t)},this.extractedFaces)]:[2];case 2:return e=n.sent(),[2,Qt(t,e)]}})})},e.prototype.withAgeAndGender=function(){return new si(this,this.input)},e}(Qn),ni=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withAgeAndGender=function(){return new ai(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ci(this,this.input)},e}(ti),ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withAgeAndGender=function(){return new li(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hi(this,this.input)},e}(ei),ri=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r.extractedFaces=i,r}return Object(a.c)(e,t),e}(cn),oi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n=this;return Object(a.d)(this,function(i){switch(i.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=i.sent(),this.input,function(t){return Object(a.b)(n,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return Dn.ageGenderNet.predictAgeAndGender(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=i.sent(),[2,t.map(function(t,n){var i=e[n],r=i.age;return Re(De(t,i.gender,i.genderProbability),r)})]}})})},e.prototype.withFaceExpressions=function(){return new ti(this,this.input)},e}(ri),si=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,i,r;return Object(a.d)(this,function(o){switch(o.label){case 0:return[4,this.parentTask];case 1:return(t=o.sent())?[4,pn(t,this.input,function(t){return Dn.ageGenderNet.predictAgeAndGender(t)},this.extractedFaces)]:[2];case 2:return e=o.sent(),n=e.age,i=e.gender,r=e.genderProbability,[2,Re(De(t,i,r),n)]}})})},e.prototype.withFaceExpressions=function(){return new ei(this,this.input)},e}(ri),ai=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withFaceExpressions=function(){return new ni(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ci(this,this.input)},e}(oi),li=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withFaceExpressions=function(){return new ii(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hi(this,this.input)},e}(si),ui=function(t){function e(e,n){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i}return Object(a.c)(e,t),e}(cn),ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t;return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=e.sent(),this.input,function(t){return Promise.all(t.map(function(t){return Dn.faceRecognitionNet.computeFaceDescriptor(t)}))},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return[2,e.sent().map(function(e,n){return xe(t[n],e)})]}})})},e.prototype.withFaceExpressions=function(){return new ni(this,this.input)},e.prototype.withAgeAndGender=function(){return new ai(this,this.input)},e}(ui),hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,pn(t,this.input,function(t){return Dn.faceRecognitionNet.computeFaceDescriptor(t)},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return e=n.sent(),[2,xe(t,e)]}})})},e.prototype.withFaceExpressions=function(){return new ii(this,this.input)},e.prototype.withAgeAndGender=function(){return new li(this,this.input)},e}(ui),pi=function(t){function e(e,n,i){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r.useTinyLandmarkNet=i,r}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?Dn.faceLandmark68TinyNet:Dn.faceLandmark68Net},enumerable:!0,configurable:!0}),e}(cn),di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,i,r,s=this;return Object(a.d)(this,function(a){switch(a.label){case 0:return[4,this.parentTask];case 1:return t=a.sent(),e=t.map(function(t){return t.detection}),this.input instanceof o.a?[4,Tt(this.input,e)]:[3,3];case 2:return i=a.sent(),[3,5];case 3:return[4,bt(this.input,e)];case 4:i=a.sent(),a.label=5;case 5:return n=i,[4,Promise.all(n.map(function(t){return s.landmarkNet.detectLandmarks(t)}))];case 6:return r=a.sent(),n.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,t.map(function(t,e){return ne(t,r[e])})]}})})},e.prototype.withFaceExpressions=function(){return new ni(this,this.input)},e.prototype.withAgeAndGender=function(){return new ai(this,this.input)},e.prototype.withFaceDescriptors=function(){return new ci(this,this.input)},e}(pi),fi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,i,r;return Object(a.d)(this,function(s){switch(s.label){case 0:return[4,this.parentTask];case 1:return(t=s.sent())?(e=t.detection,this.input instanceof o.a?[4,Tt(this.input,[e])]:[3,3]):[2];case 2:return i=s.sent(),[3,5];case 3:return[4,bt(this.input,[e])];case 4:i=s.sent(),s.label=5;case 5:return n=i,[4,this.landmarkNet.detectLandmarks(n[0])];case 6:return r=s.sent(),n.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,ne(t,r)]}})})},e.prototype.withFaceExpressions=function(){return new ii(this,this.input)},e.prototype.withAgeAndGender=function(){return new li(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hi(this,this.input)},e}(pi),gi=function(t){function e(e,n){void 0===n&&(n=new He);var i=t.call(this)||this;return i.input=e,i.options=n,i}return Object(a.c)(e,t),e}(cn),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,i;return Object(a.d)(this,function(r){switch(r.label){case 0:return e=(t=this).input,(n=t.options)instanceof Ae?[4,Dn.mtcnn.forward(e,n)]:[3,2];case 1:return[2,r.sent().map(function(t){return t.detection})];case 2:if(!(i=n instanceof un?function(t){return Dn.tinyFaceDetector.locateFaces(t,n)}:n instanceof He?function(t){return Dn.ssdMobilenetv1.locateFaces(t,n)}:n instanceof on?function(t){return Dn.tinyYolov2.locateFaces(t,n)}:null))throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,i(e)]}})})},e.prototype.runAndExtendWithFaceDetections=function(){var t=this;return new Promise(function(e){return Object(a.b)(t,void 0,void 0,function(){var t;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t.map(function(t){return z({},t)}))]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new di(this.runAndExtendWithFaceDetections(),this.input,t)},e.prototype.withFaceExpressions=function(){return new ti(this.runAndExtendWithFaceDetections(),this.input)},e.prototype.withAgeAndGender=function(){return new oi(this.runAndExtendWithFaceDetections(),this.input)},e}(gi),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,new mi(this.input,this.options)];case 1:return t=n.sent(),e=t[0],t.forEach(function(t){t.score>e.score&&(e=t)}),[2,e]}})})},e.prototype.runAndExtendWithFaceDetection=function(){var t=this;return new Promise(function(e){return Object(a.b)(t,void 0,void 0,function(){var t;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t?z({},t):void 0)]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new fi(this.runAndExtendWithFaceDetection(),this.input,t)},e.prototype.withFaceExpressions=function(){return new ei(this.runAndExtendWithFaceDetection(),this.input)},e.prototype.withAgeAndGender=function(){return new si(this.runAndExtendWithFaceDetection(),this.input)},e}(gi);function _i(t,e){return void 0===e&&(e=new He),new vi(t,e)}function yi(t,e){return void 0===e&&(e=new He),new mi(t,e)}function bi(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,yi(t,new He(e?{minConfidence:e}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function Ti(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,yi(t,new on(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function Ei(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,yi(t,new Ae(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}var Ci=bi;function Si(t,e){if(t.length!==e.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var n=Array.from(t),i=Array.from(e);return Math.sqrt(n.map(function(t,e){return t-i[e]}).reduce(function(t,e){return t+Math.pow(e,2)},0))}var wi=function(){function t(t,e){void 0===e&&(e=.6),this._distanceThreshold=e;var n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var i=1,r=function(){return"person "+i++};this._labeledDescriptors=n.map(function(t){if(t instanceof W)return t;if(t instanceof Float32Array)return new W(r(),[t]);if(t.descriptor&&t.descriptor instanceof Float32Array)return new W(r(),[t.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array>")})}return Object.defineProperty(t.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),t.prototype.computeMeanDistance=function(t,e){return e.map(function(e){return Si(e,t)}).reduce(function(t,e){return t+e},0)/(e.length||1)},t.prototype.matchDescriptor=function(t){var e=this;return this.labeledDescriptors.map(function(n){var i=n.descriptors,r=n.label;return new V(r,e.computeMeanDistance(t,i))}).reduce(function(t,e){return t.distance<e.distance?t:e})},t.prototype.findBestMatch=function(t){var e=this.matchDescriptor(t);return e.distance<this.distanceThreshold?e:new V("unknown",e.distance)},t.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map(function(t){return t.toJSON()})}},t.fromJSON=function(e){return new t(e.labeledDescriptors.map(function(t){return W.fromJSON(t)}),e.distanceThreshold)},t}();function ki(t){var e=new kn;return e.extractWeights(t),e}function xi(t){var e=new On;return e.extractWeights(t),e}function Ii(t,e){var n=new l(e.width,e.height),i=n.width,r=n.height;if(i<=0||r<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:i,height:r}));if(Array.isArray(t))return t.map(function(t){return Ii(t,{width:i,height:r})});if(ee(t)){var o=t.detection.forSize(i,r),s=t.unshiftedLandmarks.forSize(o.box.width,o.box.height);return ne(z(t,o),s)}return j(t)?z(t,t.detection.forSize(i,r)):t instanceof B||t instanceof x?t.forSize(i,r):t}n.d(e,!1,function(){return r}),n.d(e,!1,function(){return i}),n.d(e,!1,function(){return o}),n.d(e,!1,function(){return pe}),n.d(e,!1,function(){return ce}),n.d(e,!1,function(){return w}),n.d(e,!1,function(){return S}),n.d(e,!1,function(){return l}),n.d(e,!1,function(){return x}),n.d(e,!1,function(){return B}),n.d(e,!1,function(){return F}),n.d(e,!1,function(){return U}),n.d(e,!1,function(){return V}),n.d(e,!1,function(){return H}),n.d(e,"b",function(){return W}),n.d(e,!1,function(){return k}),n.d(e,!1,function(){return C}),n.d(e,!1,function(){return G}),n.d(e,!1,function(){return P}),n.d(e,!1,function(){return ct}),n.d(e,"c",function(){return ht}),n.d(e,!1,function(){return dt}),n.d(e,!1,function(){return ft}),n.d(e,!1,function(){return bt}),n.d(e,!1,function(){return Tt}),n.d(e,"e",function(){return Ct}),n.d(e,!1,function(){return St}),n.d(e,!1,function(){return wt}),n.d(e,!1,function(){return Et}),n.d(e,!1,function(){return it}),n.d(e,!1,function(){return pt}),n.d(e,!1,function(){return gt}),n.d(e,!1,function(){return vt}),n.d(e,!1,function(){return mt}),n.d(e,!1,function(){return ut}),n.d(e,!1,function(){return xt}),n.d(e,!1,function(){return It}),n.d(e,!1,function(){return _t}),n.d(e,!1,function(){return nt}),n.d(e,!1,function(){return yt}),n.d(e,!1,function(){return et}),n.d(e,!1,function(){return qt}),n.d(e,!1,function(){return Kt}),n.d(e,!1,function(){return Jt}),n.d(e,!1,function(){return ve}),n.d(e,!1,function(){return fe}),n.d(e,!1,function(){return me}),n.d(e,!1,function(){return ke}),n.d(e,!1,function(){return we}),n.d(e,!1,function(){return xe}),n.d(e,!1,function(){return j}),n.d(e,!1,function(){return z}),n.d(e,!1,function(){return Zt}),n.d(e,!1,function(){return Qt}),n.d(e,!1,function(){return ee}),n.d(e,!1,function(){return ne}),n.d(e,!1,function(){return Ie}),n.d(e,!1,function(){return Re}),n.d(e,!1,function(){return Oe}),n.d(e,!1,function(){return De}),n.d(e,!1,function(){return bi}),n.d(e,!1,function(){return Ti}),n.d(e,!1,function(){return Ei}),n.d(e,!1,function(){return Ci}),n.d(e,!1,function(){return cn}),n.d(e,!1,function(){return ui}),n.d(e,!1,function(){return ci}),n.d(e,!1,function(){return hi}),n.d(e,!1,function(){return _i}),n.d(e,!1,function(){return yi}),n.d(e,!1,function(){return gi}),n.d(e,!1,function(){return mi}),n.d(e,!1,function(){return vi}),n.d(e,!1,function(){return pi}),n.d(e,!1,function(){return di}),n.d(e,!1,function(){return fi}),n.d(e,"a",function(){return wi}),n.d(e,!1,function(){return Dn}),n.d(e,!1,function(){return An}),n.d(e,!1,function(){return Mn}),n.d(e,!1,function(){return Nn}),n.d(e,!1,function(){return Ln}),n.d(e,!1,function(){return Pn}),n.d(e,!1,function(){return Bn}),n.d(e,"d",function(){return Fn}),n.d(e,!1,function(){return Un}),n.d(e,!1,function(){return Vn}),n.d(e,!1,function(){return Hn}),n.d(e,!1,function(){return Wn}),n.d(e,!1,function(){return Gn}),n.d(e,!1,function(){return jn}),n.d(e,!1,function(){return zn}),n.d(e,!1,function(){return $n}),n.d(e,"f",function(){return Xn}),n.d(e,!1,function(){return Yn}),n.d(e,!1,function(){return Kn}),n.d(e,!1,function(){return Jn}),n.d(e,!1,function(){return qn}),n.d(e,!1,function(){return Zn}),n.d(e,!1,function(){return ki}),n.d(e,!1,function(){return kn}),n.d(e,!1,function(){return Ae}),n.d(e,!1,function(){return N}),n.d(e,!1,function(){return L}),n.d(e,!1,function(){return I}),n.d(e,!1,function(){return R}),n.d(e,!1,function(){return O}),n.d(e,!1,function(){return D}),n.d(e,!1,function(){return A}),n.d(e,!1,function(){return M}),n.d(e,!1,function(){return Ge}),n.d(e,!1,function(){return je}),n.d(e,!1,function(){return $e}),n.d(e,!1,function(){return We}),n.d(e,!1,function(){return He}),n.d(e,!1,function(){return xi}),n.d(e,!1,function(){return On}),n.d(e,!1,function(){return un}),n.d(e,!1,function(){return an}),n.d(e,!1,function(){return ln}),n.d(e,!1,function(){return ze}),n.d(e,!1,function(){return on}),n.d(e,!1,function(){return Ze}),n.d(e,!1,function(){return Si}),n.d(e,!1,function(){return Rt}),n.d(e,!1,function(){return Ii})},HJMx:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=79)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},11:function(t,e){t.exports=n("aW5l")},21:function(t,e){t.exports=n("E/in")},4:function(t,e){t.exports=n("fPll")},79:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["textarea"===t.type?"el-textarea":"el-input",t.inputSize?"el-input--"+t.inputSize:"",{"is-disabled":t.inputDisabled,"is-exceed":t.inputExceed,"el-input-group":t.$slots.prepend||t.$slots.append,"el-input-group--append":t.$slots.append,"el-input-group--prepend":t.$slots.prepend,"el-input--prefix":t.$slots.prefix||t.prefixIcon,"el-input--suffix":t.$slots.suffix||t.suffixIcon||t.clearable||t.showPassword}],on:{mouseenter:function(e){t.hovering=!0},mouseleave:function(e){t.hovering=!1}}},["textarea"!==t.type?[t.$slots.prepend?n("div",{staticClass:"el-input-group__prepend"},[t._t("prepend")],2):t._e(),"textarea"!==t.type?n("input",t._b({ref:"input",staticClass:"el-input__inner",attrs:{tabindex:t.tabindex,type:t.showPassword?t.passwordVisible?"text":"password":t.type,disabled:t.inputDisabled,readonly:t.readonly,autocomplete:t.autoComplete||t.autocomplete,"aria-label":t.label},on:{compositionstart:t.handleCompositionStart,compositionupdate:t.handleCompositionUpdate,compositionend:t.handleCompositionEnd,input:t.handleInput,focus:t.handleFocus,blur:t.handleBlur,change:t.handleChange}},"input",t.$attrs,!1)):t._e(),t.$slots.prefix||t.prefixIcon?n("span",{staticClass:"el-input__prefix"},[t._t("prefix"),t.prefixIcon?n("i",{staticClass:"el-input__icon",class:t.prefixIcon}):t._e()],2):t._e(),t.getSuffixVisible()?n("span",{staticClass:"el-input__suffix"},[n("span",{staticClass:"el-input__suffix-inner"},[t.showClear&&t.showPwdVisible&&t.isWordLimitVisible?t._e():[t._t("suffix"),t.suffixIcon?n("i",{staticClass:"el-input__icon",class:t.suffixIcon}):t._e()],t.showClear?n("i",{staticClass:"el-input__icon el-icon-circle-close el-input__clear",on:{mousedown:function(t){t.preventDefault()},click:t.clear}}):t._e(),t.showPwdVisible?n("i",{staticClass:"el-input__icon el-icon-view el-input__clear",on:{click:t.handlePasswordVisible}}):t._e(),t.isWordLimitVisible?n("span",{staticClass:"el-input__count"},[n("span",{staticClass:"el-input__count-inner"},[t._v("\n "+t._s(t.textLength)+"/"+t._s(t.upperLimit)+"\n ")])]):t._e()],2),t.validateState?n("i",{staticClass:"el-input__icon",class:["el-input__validateIcon",t.validateIcon]}):t._e()]):t._e(),t.$slots.append?n("div",{staticClass:"el-input-group__append"},[t._t("append")],2):t._e()]:n("textarea",t._b({ref:"textarea",staticClass:"el-textarea__inner",style:t.textareaStyle,attrs:{tabindex:t.tabindex,disabled:t.inputDisabled,readonly:t.readonly,autocomplete:t.autoComplete||t.autocomplete,"aria-label":t.label},on:{compositionstart:t.handleCompositionStart,compositionupdate:t.handleCompositionUpdate,compositionend:t.handleCompositionEnd,input:t.handleInput,focus:t.handleFocus,blur:t.handleBlur,change:t.handleChange}},"textarea",t.$attrs,!1)),t.isWordLimitVisible&&"textarea"===t.type?n("span",{staticClass:"el-input__count"},[t._v(t._s(t.textLength)+"/"+t._s(t.upperLimit))]):t._e()],2)};i._withStripped=!0;var r=n(4),o=n.n(r),s=n(11),a=n.n(s),l=void 0,u="\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",c=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;l||(l=document.createElement("textarea"),document.body.appendChild(l));var i=function(t){var e=window.getComputedStyle(t),n=e.getPropertyValue("box-sizing"),i=parseFloat(e.getPropertyValue("padding-bottom"))+parseFloat(e.getPropertyValue("padding-top")),r=parseFloat(e.getPropertyValue("border-bottom-width"))+parseFloat(e.getPropertyValue("border-top-width"));return{contextStyle:c.map(function(t){return t+":"+e.getPropertyValue(t)}).join(";"),paddingSize:i,borderSize:r,boxSizing:n}}(t),r=i.paddingSize,o=i.borderSize,s=i.boxSizing,a=i.contextStyle;l.setAttribute("style",a+";"+u),l.value=t.value||t.placeholder||"";var h=l.scrollHeight,p={};"border-box"===s?h+=o:"content-box"===s&&(h-=r),l.value="";var d=l.scrollHeight-r;if(null!==e){var f=d*e;"border-box"===s&&(f=f+r+o),h=Math.max(f,h),p.minHeight=f+"px"}if(null!==n){var g=d*n;"border-box"===s&&(g=g+r+o),h=Math.min(g,h)}return p.height=h+"px",l.parentNode&&l.parentNode.removeChild(l),l=null,p}var p=n(9),d=n.n(p),f=n(21),g={name:"ElInput",componentName:"ElInput",mixins:[o.a,a.a],inheritAttrs:!1,inject:{elForm:{default:""},elFormItem:{default:""}},data:function(){return{textareaCalcStyle:{},hovering:!1,focused:!1,isComposing:!1,passwordVisible:!1}},props:{value:[String,Number],size:String,resize:String,form:String,disabled:Boolean,readonly:Boolean,type:{type:String,default:"text"},autosize:{type:[Boolean,Object],default:!1},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:function(t){return!0}},validateEvent:{type:Boolean,default:!0},suffixIcon:String,prefixIcon:String,label:String,clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},tabindex:String},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},validateState:function(){return this.elFormItem?this.elFormItem.validateState:""},needStatusIcon:function(){return!!this.elForm&&this.elForm.statusIcon},validateIcon:function(){return{validating:"el-icon-loading",success:"el-icon-circle-check",error:"el-icon-circle-close"}[this.validateState]},textareaStyle:function(){return d()({},this.textareaCalcStyle,{resize:this.resize})},inputSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputDisabled:function(){return this.disabled||(this.elForm||{}).disabled},nativeInputValue:function(){return null===this.value||void 0===this.value?"":String(this.value)},showClear:function(){return this.clearable&&!this.inputDisabled&&!this.readonly&&this.nativeInputValue&&(this.focused||this.hovering)},showPwdVisible:function(){return this.showPassword&&!this.inputDisabled&&!this.readonly&&(!!this.nativeInputValue||this.focused)},isWordLimitVisible:function(){return this.showWordLimit&&this.$attrs.maxlength&&("text"===this.type||"textarea"===this.type)&&!this.inputDisabled&&!this.readonly&&!this.showPassword},upperLimit:function(){return this.$attrs.maxlength},textLength:function(){return"number"==typeof this.value?String(this.value).length:(this.value||"").length},inputExceed:function(){return this.isWordLimitVisible&&this.textLength>this.upperLimit}},watch:{value:function(t){this.$nextTick(this.resizeTextarea),this.validateEvent&&this.dispatch("ElFormItem","el.form.change",[t])},nativeInputValue:function(){this.setNativeInputValue()},type:function(){var t=this;this.$nextTick(function(){t.setNativeInputValue(),t.resizeTextarea(),t.updateIconOffset()})}},methods:{focus:function(){this.getInput().focus()},blur:function(){this.getInput().blur()},getMigratingConfig:function(){return{props:{icon:"icon is removed, use suffix-icon / prefix-icon instead.","on-icon-click":"on-icon-click is removed."},events:{click:"click is removed."}}},handleBlur:function(t){this.focused=!1,this.$emit("blur",t),this.validateEvent&&this.dispatch("ElFormItem","el.form.blur",[this.value])},select:function(){this.getInput().select()},resizeTextarea:function(){if(!this.$isServer){var t=this.autosize;if("textarea"===this.type)if(t){var e=t.minRows,n=t.maxRows;this.textareaCalcStyle=h(this.$refs.textarea,e,n)}else this.textareaCalcStyle={minHeight:h(this.$refs.textarea).minHeight}}},setNativeInputValue:function(){var t=this.getInput();t&&t.value!==this.nativeInputValue&&(t.value=this.nativeInputValue)},handleFocus:function(t){this.focused=!0,this.$emit("focus",t)},handleCompositionStart:function(){this.isComposing=!0},handleCompositionUpdate:function(t){var e=t.target.value,n=e[e.length-1]||"";this.isComposing=!Object(f.isKorean)(n)},handleCompositionEnd:function(t){this.isComposing&&(this.isComposing=!1,this.handleInput(t))},handleInput:function(t){this.isComposing||t.target.value!==this.nativeInputValue&&(this.$emit("input",t.target.value),this.$nextTick(this.setNativeInputValue))},handleChange:function(t){this.$emit("change",t.target.value)},calcIconOffset:function(t){var e=[].slice.call(this.$el.querySelectorAll(".el-input__"+t)||[]);if(e.length){for(var n=null,i=0;i<e.length;i++)if(e[i].parentNode===this.$el){n=e[i];break}if(n){var r={suffix:"append",prefix:"prepend"}[t];this.$slots[r]?n.style.transform="translateX("+("suffix"===t?"-":"")+this.$el.querySelector(".el-input-group__"+r).offsetWidth+"px)":n.removeAttribute("style")}}},updateIconOffset:function(){this.calcIconOffset("prefix"),this.calcIconOffset("suffix")},clear:function(){this.$emit("input",""),this.$emit("change",""),this.$emit("clear")},handlePasswordVisible:function(){var t=this;this.passwordVisible=!this.passwordVisible,this.$nextTick(function(){t.focus()})},getInput:function(){return this.$refs.input||this.$refs.textarea},getSuffixVisible:function(){return this.$slots.suffix||this.suffixIcon||this.showClear||this.showPassword||this.isWordLimitVisible||this.validateState&&this.needStatusIcon}},created:function(){this.$on("inputSelect",this.select)},mounted:function(){this.setNativeInputValue(),this.resizeTextarea(),this.updateIconOffset()},updated:function(){this.$nextTick(this.updateIconOffset)}},m=n(0),v=Object(m.a)(g,i,[],!1,null,null,null);v.options.__file="packages/input/src/input.vue";var _=v.exports;_.install=function(t){t.component(_.name,_)};e.default=_},9:function(t,e){t.exports=n("jmaC")}})},HzcN:function(t,e,n){var i=n("uY1a"),r=n("ON3O");t.exports={throttle:i,debounce:r}},IDSB:function(t,e,n){var i,r,o,s;s=function(t){return(t={Msg:{}}).Msg.ADD_COMMENT="添加注释",t.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="不能删除变量“%1”,因为它是函数“%2”定义的一部分",t.Msg.CHANGE_VALUE_TITLE="更改值:",t.Msg.CLEAN_UP="整理块",t.Msg.COLLAPSED_WARNINGS_WARNING="已收起的信息块内包含警告。",t.Msg.COLLAPSE_ALL="折叠块",t.Msg.COLLAPSE_BLOCK="折叠块",t.Msg.COLOUR_BLEND_COLOUR1="颜色1",t.Msg.COLOUR_BLEND_COLOUR2="颜色2",t.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",t.Msg.COLOUR_BLEND_RATIO="比例",t.Msg.COLOUR_BLEND_TITLE="混合",t.Msg.COLOUR_BLEND_TOOLTIP="把两种颜色以一个给定的比例(0.0-1.0)进行混合。",t.Msg.COLOUR_PICKER_HELPURL="https://zh.wikipedia.org/wiki/颜色",t.Msg.COLOUR_PICKER_TOOLTIP="从调色板中选择一种颜色。",t.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",t.Msg.COLOUR_RANDOM_TITLE="随机颜色",t.Msg.COLOUR_RANDOM_TOOLTIP="随机选择一种颜色。",t.Msg.COLOUR_RGB_BLUE="蓝色",t.Msg.COLOUR_RGB_GREEN="绿色",t.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",t.Msg.COLOUR_RGB_RED="红色",t.Msg.COLOUR_RGB_TITLE="颜色",t.Msg.COLOUR_RGB_TOOLTIP="通过指定红色、绿色和蓝色的量创建一种颜色。所有的值必须在0和100之间。",t.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="跳出循环",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="继续下一轮循环",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="跳出包含它的循环。",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="跳过本轮循环的剩余部分,并继进行续下一轮循环。",t.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="警告:这个块只能在循环内使用。",t.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each",t.Msg.CONTROLS_FOREACH_TITLE="遍历列表 %2 里的每一项 %1",t.Msg.CONTROLS_FOREACH_TOOLTIP="遍历列表中的每一项,将变量“%1”设为所选项,并执行一些语句。",t.Msg.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with",t.Msg.CONTROLS_FOR_TITLE="变量 %1 从 %2 数到 %3 每次增加 %4",t.Msg.CONTROLS_FOR_TOOLTIP="用变量%1记录从开始数值到终止数值之间的数值,数值按指定间隔增加,并执行指定的块。",t.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="在这个if语句块中增加一个条件。",t.Msg.CONTROLS_IF_ELSE_TOOLTIP="在这个if语句块中添加一个最终的,包括所有其余情况的条件。",t.Msg.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse",t.Msg.CONTROLS_IF_IF_TOOLTIP="增加、删除或重新排列各节来重新配置这个if语句块。",t.Msg.CONTROLS_IF_MSG_ELSE="否则",t.Msg.CONTROLS_IF_MSG_ELSEIF="否则如果",t.Msg.CONTROLS_IF_MSG_IF="如果",t.Msg.CONTROLS_IF_TOOLTIP_1="如果值为真,执行一些语句。",t.Msg.CONTROLS_IF_TOOLTIP_2="如果值为真,则执行第一块语句。否则,则执行第二块语句。",t.Msg.CONTROLS_IF_TOOLTIP_3="如果第一个值为真,则执行第一块的语句。否则,如果第二个值为真,则执行第二块的语句。",t.Msg.CONTROLS_IF_TOOLTIP_4="如果第一个值为真,则执行第一块对语句。否则,如果第二个值为真,则执行语句的第二块。如果没有值为真,则执行最后一块的语句。",t.Msg.CONTROLS_REPEAT_HELPURL="https://zh.wikipedia.org/wiki/For循环",t.Msg.CONTROLS_REPEAT_INPUT_DO="执行",t.Msg.CONTROLS_REPEAT_TITLE="重复 %1 次",t.Msg.CONTROLS_REPEAT_TOOLTIP="多次执行一些语句。",t.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="重复直到条件满足",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="当条件满足时重复",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="只要值为假,就一直循环执行一些语句。",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="只要值为真,就一直循环执行一些语句。",t.Msg.DELETE_ALL_BLOCKS="删除所有 %1 个块吗?",t.Msg.DELETE_BLOCK="删除块",t.Msg.DELETE_VARIABLE="删除变量“%1”",t.Msg.DELETE_VARIABLE_CONFIRMATION="要删除对变量“%2”的%1个引用吗?",t.Msg.DELETE_X_BLOCKS="删除 %1 个块",t.Msg.DISABLE_BLOCK="禁用块",t.Msg.DUPLICATE_BLOCK="复制",t.Msg.DUPLICATE_COMMENT="复制注释",t.Msg.ENABLE_BLOCK="启用块",t.Msg.EXPAND_ALL="展开块",t.Msg.EXPAND_BLOCK="展开块",t.Msg.EXTERNAL_INPUTS="外部输入",t.Msg.HELP="帮助",t.Msg.INLINE_INPUTS="单行输入",t.Msg.IOS_CANCEL="取消",t.Msg.IOS_ERROR="错误",t.Msg.IOS_OK="确定",t.Msg.IOS_PROCEDURES_ADD_INPUT="+ 添加输入",t.Msg.IOS_PROCEDURES_ALLOW_STATEMENTS="允许的语句",t.Msg.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="这个函数有多个输入。",t.Msg.IOS_PROCEDURES_INPUTS="输入",t.Msg.IOS_VARIABLES_ADD_BUTTON="添加",t.Msg.IOS_VARIABLES_ADD_VARIABLE="+ 添加变量",t.Msg.IOS_VARIABLES_DELETE_BUTTON="删除",t.Msg.IOS_VARIABLES_EMPTY_NAME_ERROR="你不能使用空白的变量名。",t.Msg.IOS_VARIABLES_RENAME_BUTTON="重命名",t.Msg.IOS_VARIABLES_VARIABLE_NAME="变量名",t.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list",t.Msg.LISTS_CREATE_EMPTY_TITLE="创建空列表",t.Msg.LISTS_CREATE_EMPTY_TOOLTIP="返回一个列表,长度为 0,不包含任何数据记录",t.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="列表",t.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="增加、删除或重新排列各部分以此重新配置这个列表块。",t.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_CREATE_WITH_INPUT_WITH="创建列表,内容:",t.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="将一个项添加到列表中。",t.Msg.LISTS_CREATE_WITH_TOOLTIP="建立一个具有任意数量项目的列表。",t.Msg.LISTS_GET_INDEX_FIRST="第一项",t.Msg.LISTS_GET_INDEX_FROM_END="倒数第#项",t.Msg.LISTS_GET_INDEX_FROM_START="#",t.Msg.LISTS_GET_INDEX_GET="取得",t.Msg.LISTS_GET_INDEX_GET_REMOVE="取得并移除",t.Msg.LISTS_GET_INDEX_LAST="最后一项",t.Msg.LISTS_GET_INDEX_RANDOM="随机的一项",t.Msg.LISTS_GET_INDEX_REMOVE="移除",t.Msg.LISTS_GET_INDEX_TAIL="-",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="返回列表中的第一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="返回在列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="返回列表中的最后一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="返回列表中的随机一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="移除并返回列表中的第一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="移除并返回列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="移除并返回列表中的最后一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="移除并返回列表中的随机一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="移除列表中的第一项",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="移除在列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="移除列表中的最后一项",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="删除列表中的随机一项。",t.Msg.LISTS_GET_SUBLIST_END_FROM_END="到倒数第#项",t.Msg.LISTS_GET_SUBLIST_END_FROM_START="到第#项",t.Msg.LISTS_GET_SUBLIST_END_LAST="到最后一项",t.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist",t.Msg.LISTS_GET_SUBLIST_START_FIRST="获取子列表,从第一项",t.Msg.LISTS_GET_SUBLIST_START_FROM_END="获取子列表,从倒数第#项",t.Msg.LISTS_GET_SUBLIST_START_FROM_START="获取子列表,从第#项",t.Msg.LISTS_GET_SUBLIST_TAIL="-",t.Msg.LISTS_GET_SUBLIST_TOOLTIP="复制列表中指定的部分。",t.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1是最后一项。",t.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1是第一项。",t.Msg.LISTS_INDEX_OF_FIRST="寻找第一次出现的项",t.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",t.Msg.LISTS_INDEX_OF_LAST="寻找最后一次出现的项",t.Msg.LISTS_INDEX_OF_TOOLTIP="返回在列表中的第一/最后一个匹配项的索引值。如果找不到项目则返回%1。",t.Msg.LISTS_INLIST="在列表中",t.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty",t.Msg.LISTS_ISEMPTY_TITLE="%1是空的",t.Msg.LISTS_ISEMPTY_TOOLTIP="如果改列表为空,则返回真。",t.Msg.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of",t.Msg.LISTS_LENGTH_TITLE="%1的长度",t.Msg.LISTS_LENGTH_TOOLTIP="返回列表的长度。",t.Msg.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_REPEAT_TITLE="建立列表使用项 %1 重复 %2 次",t.Msg.LISTS_REPEAT_TOOLTIP="建立包含指定重复次数的值的列表。",t.Msg.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Lists#reversing-a-list",t.Msg.LISTS_REVERSE_MESSAGE0="倒转%1",t.Msg.LISTS_REVERSE_TOOLTIP="倒转一个列表,返回副本。",t.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set",t.Msg.LISTS_SET_INDEX_INPUT_TO="值为",t.Msg.LISTS_SET_INDEX_INSERT="插入在",t.Msg.LISTS_SET_INDEX_SET="设置",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="在列表的起始处添加该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="在列表中指定位置插入项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="在列表的末尾处添加该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="在列表的随机位置插入该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="设置列表中的第一项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="设置在列表中指定位置的项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="设置列表中的最后一项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="设置列表中的随机一项。",t.Msg.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list",t.Msg.LISTS_SORT_ORDER_ASCENDING="升序",t.Msg.LISTS_SORT_ORDER_DESCENDING="降序",t.Msg.LISTS_SORT_TITLE="排序%1 %2 %3",t.Msg.LISTS_SORT_TOOLTIP="排序一个列表,返回副本。",t.Msg.LISTS_SORT_TYPE_IGNORECASE="按字母(忽略大小写)",t.Msg.LISTS_SORT_TYPE_NUMERIC="按数字",t.Msg.LISTS_SORT_TYPE_TEXT="按字母",t.Msg.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",t.Msg.LISTS_SPLIT_LIST_FROM_TEXT="从文本制作列表",t.Msg.LISTS_SPLIT_TEXT_FROM_LIST="将列表合并为文本",t.Msg.LISTS_SPLIT_TOOLTIP_JOIN="加入文本列表至一个文本,由分隔符分隔。",t.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="将文本按指定的分隔符拆分为文本组成的列表。",t.Msg.LISTS_SPLIT_WITH_DELIMITER="分隔符:",t.Msg.LOGIC_BOOLEAN_FALSE="假",t.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values",t.Msg.LOGIC_BOOLEAN_TOOLTIP="返回真或假。",t.Msg.LOGIC_BOOLEAN_TRUE="真",t.Msg.LOGIC_COMPARE_HELPURL="https://zh.wikipedia.org/wiki/不等",t.Msg.LOGIC_COMPARE_TOOLTIP_EQ="如果两个输入结果相等,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_GT="如果第一个输入结果比第二个大,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_GTE="如果第一个输入结果大于或等于第二个输入结果,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_LT="如果第一个输入结果比第二个小,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_LTE="如果第一个输入结果小于或等于第二个输入结果,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="如果两个输入结果不相等,则返回真。",t.Msg.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not",t.Msg.LOGIC_NEGATE_TITLE="%1不成立",t.Msg.LOGIC_NEGATE_TOOLTIP="如果输入结果为假,则返回真;如果输入结果为真,则返回假。",t.Msg.LOGIC_NULL="空",t.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",t.Msg.LOGIC_NULL_TOOLTIP="返回空值。",t.Msg.LOGIC_OPERATION_AND="并且",t.Msg.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations",t.Msg.LOGIC_OPERATION_OR="或",t.Msg.LOGIC_OPERATION_TOOLTIP_AND="如果两个输入结果都为真,则返回真。",t.Msg.LOGIC_OPERATION_TOOLTIP_OR="如果至少有一个输入结果为真,则返回真。",t.Msg.LOGIC_TERNARY_CONDITION="断言",t.Msg.LOGIC_TERNARY_HELPURL="https://zh.wikipedia.org/wiki/条件运算符",t.Msg.LOGIC_TERNARY_IF_FALSE="如果为假",t.Msg.LOGIC_TERNARY_IF_TRUE="如果为真",t.Msg.LOGIC_TERNARY_TOOLTIP="检查“断言”里的条件语句。如果条件为真,则返回“如果为真”的值,否则,则返回“如果为假”的值。",t.Msg.MATH_ADDITION_SYMBOL="+",t.Msg.MATH_ARITHMETIC_HELPURL="https://zh.wikipedia.org/wiki/算术",t.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="返回两个数值的和。",t.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="返回两个数值的商。",t.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="返回两个数值的差。",t.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="返回两个数值的乘积。",t.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="返回以第一个数值为底数,以第二个数值为幂的结果。",t.Msg.MATH_ATAN2_HELPURL="https://zh.wikipedia.org/wiki/反正切2",t.Msg.MATH_ATAN2_TITLE="点(x:%1,y:%2)的方位角",t.Msg.MATH_ATAN2_TOOLTIP="返回点(X,Y)的反正切值,范围为-180到180度。",t.Msg.MATH_CHANGE_HELPURL="https://zh.wikipedia.org/wiki/加法",t.Msg.MATH_CHANGE_TITLE="将 %1 增加 %2",t.Msg.MATH_CHANGE_TOOLTIP="为变量“%1”增加一个数值。",t.Msg.MATH_CONSTANT_HELPURL="https://zh.wikipedia.org/wiki/数学常数",t.Msg.MATH_CONSTANT_TOOLTIP="返回一个常见常量:π (3.141…)、e (2.718…)、φ (1.618…)、根号2 (1.414…)、根号二分之一 (0.707…)或∞ (无穷大)。",t.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",t.Msg.MATH_CONSTRAIN_TITLE="将 %1 限制在 最低 %2 到最高 %3 之间",t.Msg.MATH_CONSTRAIN_TOOLTIP="将一个数值限制在两个指定的数值范围(含边界)之间。",t.Msg.MATH_DIVISION_SYMBOL="÷",t.Msg.MATH_IS_DIVISIBLE_BY="可被整除",t.Msg.MATH_IS_EVEN="是偶数",t.Msg.MATH_IS_NEGATIVE="是负数",t.Msg.MATH_IS_ODD="是奇数",t.Msg.MATH_IS_POSITIVE="是正数",t.Msg.MATH_IS_PRIME="是质数",t.Msg.MATH_IS_TOOLTIP="检查一个数值是否是偶数、奇数、质数、自然数、正数、负数或者是否能被某数整除。返回真或假。",t.Msg.MATH_IS_WHOLE="是整数",t.Msg.MATH_MODULO_HELPURL="https://zh.wikipedia.org/wiki/模除",t.Msg.MATH_MODULO_TITLE="取 %1 ÷ %2 的余数",t.Msg.MATH_MODULO_TOOLTIP="返回这两个数字相除后的余数。",t.Msg.MATH_MULTIPLICATION_SYMBOL="×",t.Msg.MATH_NUMBER_HELPURL="https://zh.wikipedia.org/wiki/数",t.Msg.MATH_NUMBER_TOOLTIP="一个数值。",t.Msg.MATH_ONLIST_HELPURL="",t.Msg.MATH_ONLIST_OPERATOR_AVERAGE="列表平均值",t.Msg.MATH_ONLIST_OPERATOR_MAX="列表最大值",t.Msg.MATH_ONLIST_OPERATOR_MEDIAN="列表中位数",t.Msg.MATH_ONLIST_OPERATOR_MIN="列表最小值",t.Msg.MATH_ONLIST_OPERATOR_MODE="列表中的众数",t.Msg.MATH_ONLIST_OPERATOR_RANDOM="列表中的随机一项",t.Msg.MATH_ONLIST_OPERATOR_STD_DEV="列表的标准差",t.Msg.MATH_ONLIST_OPERATOR_SUM="列表中数值的和",t.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="返回列表中的数值的平均值。",t.Msg.MATH_ONLIST_TOOLTIP_MAX="返回列表中最大值。",t.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="返回列表中数值的中位数。",t.Msg.MATH_ONLIST_TOOLTIP_MIN="返回列表中最小值。",t.Msg.MATH_ONLIST_TOOLTIP_MODE="返回列表中的出现次数最多的项的列表。",t.Msg.MATH_ONLIST_TOOLTIP_RANDOM="从列表中返回一个随机的元素。",t.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="返回列表的标准差。",t.Msg.MATH_ONLIST_TOOLTIP_SUM="返回列表中的所有数值的和。",t.Msg.MATH_POWER_SYMBOL="^",t.Msg.MATH_RANDOM_FLOAT_HELPURL="https://zh.wikipedia.org/wiki/随机数生成器",t.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="随机小数",t.Msg.MATH_RANDOM_FLOAT_TOOLTIP="返回一个从0.0(含)到1.0(不含)之间的随机数。",t.Msg.MATH_RANDOM_INT_HELPURL="https://zh.wikipedia.org/wiki/随机数生成器",t.Msg.MATH_RANDOM_INT_TITLE="从 %1 到 %2 范围内的随机整数",t.Msg.MATH_RANDOM_INT_TOOLTIP="返回一个限制在两个指定数值的范围(含边界)之间的随机整数。",t.Msg.MATH_ROUND_HELPURL="https://zh.wikipedia.org/wiki/数值修约",t.Msg.MATH_ROUND_OPERATOR_ROUND="四舍五入",t.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="向下舍入",t.Msg.MATH_ROUND_OPERATOR_ROUNDUP="向上舍入",t.Msg.MATH_ROUND_TOOLTIP="数字向上或向下舍入。",t.Msg.MATH_SINGLE_HELPURL="https://zh.wikipedia.org/wiki/平方根",t.Msg.MATH_SINGLE_OP_ABSOLUTE="绝对值",t.Msg.MATH_SINGLE_OP_ROOT="平方根",t.Msg.MATH_SINGLE_TOOLTIP_ABS="返回一个数值的绝对值。",t.Msg.MATH_SINGLE_TOOLTIP_EXP="返回一个数值的e次幂。",t.Msg.MATH_SINGLE_TOOLTIP_LN="返回一个数值的自然对数。",t.Msg.MATH_SINGLE_TOOLTIP_LOG10="返回一个数值的以10为底的对数。",t.Msg.MATH_SINGLE_TOOLTIP_NEG="返回一个数值的相反数。",t.Msg.MATH_SINGLE_TOOLTIP_POW10="返回一个数值的10次幂。",t.Msg.MATH_SINGLE_TOOLTIP_ROOT="返回一个数的平方根。",t.Msg.MATH_SUBTRACTION_SYMBOL="-",t.Msg.MATH_TRIG_ACOS="acos",t.Msg.MATH_TRIG_ASIN="asin",t.Msg.MATH_TRIG_ATAN="atan",t.Msg.MATH_TRIG_COS="cos",t.Msg.MATH_TRIG_HELPURL="https://zh.wikipedia.org/wiki/三角函数",t.Msg.MATH_TRIG_SIN="sin",t.Msg.MATH_TRIG_TAN="tan",t.Msg.MATH_TRIG_TOOLTIP_ACOS="返回一个数值的反余弦值。",t.Msg.MATH_TRIG_TOOLTIP_ASIN="返回一个数值的反正弦值。",t.Msg.MATH_TRIG_TOOLTIP_ATAN="返回一个数值的反正切值。",t.Msg.MATH_TRIG_TOOLTIP_COS="返回指定角度的余弦值(非弧度)。",t.Msg.MATH_TRIG_TOOLTIP_SIN="返回指定角度的正弦值(非弧度)。",t.Msg.MATH_TRIG_TOOLTIP_TAN="返回指定角度的正切值(非弧度)。",t.Msg.NEW_COLOUR_VARIABLE="创建颜色变量...",t.Msg.NEW_NUMBER_VARIABLE="创建数字变量...",t.Msg.NEW_STRING_VARIABLE="创建字符串变量...",t.Msg.NEW_VARIABLE="创建变量...",t.Msg.NEW_VARIABLE_TITLE="新变量的名称:",t.Msg.NEW_VARIABLE_TYPE_TITLE="新变量的类型:",t.Msg.ORDINAL_NUMBER_SUFFIX="-",t.Msg.PROCEDURES_ALLOW_STATEMENTS="允许声明",t.Msg.PROCEDURES_BEFORE_PARAMS="与:",t.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="运行用户定义的函数“%1”。",t.Msg.PROCEDURES_CALLRETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_CALLRETURN_TOOLTIP="运行用户定义的函数“%1”,并使用它的输出值。",t.Msg.PROCEDURES_CALL_BEFORE_PARAMS="与:",t.Msg.PROCEDURES_CREATE_DO="创建“%1”",t.Msg.PROCEDURES_DEFNORETURN_COMMENT="描述该功能...",t.Msg.PROCEDURES_DEFNORETURN_DO="-",t.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="做点什么",t.Msg.PROCEDURES_DEFNORETURN_TITLE="至",t.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="创建一个不带输出值的函数。",t.Msg.PROCEDURES_DEFRETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_DEFRETURN_RETURN="返回",t.Msg.PROCEDURES_DEFRETURN_TOOLTIP="创建一个有输出值的函数。",t.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="警告:此函数具有重复参数。",t.Msg.PROCEDURES_HIGHLIGHT_DEF="突出显示函数定义",t.Msg.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause",t.Msg.PROCEDURES_IFRETURN_TOOLTIP="如果值为真,则返回第二个值。",t.Msg.PROCEDURES_IFRETURN_WARNING="警告:这个块只能在函数内部使用。",t.Msg.PROCEDURES_MUTATORARG_TITLE="输入名称:",t.Msg.PROCEDURES_MUTATORARG_TOOLTIP="添加函数输入。",t.Msg.PROCEDURES_MUTATORCONTAINER_TITLE="输入",t.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="添加、移除或重新排此函数的输入。",t.Msg.REDO="重做",t.Msg.REMOVE_COMMENT="删除注释",t.Msg.RENAME_VARIABLE="重命名变量...",t.Msg.RENAME_VARIABLE_TITLE="将所有“%1”变量重命名为:",t.Msg.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_APPEND_TITLE="在%1之后加上文本%2",t.Msg.TEXT_APPEND_TOOLTIP="将一些文本追加到变量“%1”里。",t.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case",t.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="转为小写",t.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="转为首字母大写",t.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="转为大写",t.Msg.TEXT_CHANGECASE_TOOLTIP="用不同的大小写模式复制并返回这段文字。",t.Msg.TEXT_CHARAT_FIRST="获取第一个字符",t.Msg.TEXT_CHARAT_FROM_END="获取倒数第#个字符",t.Msg.TEXT_CHARAT_FROM_START="获取第#个字符",t.Msg.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text",t.Msg.TEXT_CHARAT_LAST="获取最后一个字符",t.Msg.TEXT_CHARAT_RANDOM="获取随机一个字符",t.Msg.TEXT_CHARAT_TAIL="-",t.Msg.TEXT_CHARAT_TITLE="在文本%1 里 %2",t.Msg.TEXT_CHARAT_TOOLTIP="返回位于指定位置的字符。",t.Msg.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings",t.Msg.TEXT_COUNT_MESSAGE0="计算%1在%2里出现的次数",t.Msg.TEXT_COUNT_TOOLTIP="计算在一段文本中,某个部分文本重复出现了多少次。",t.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="将一个项添加到文本中。",t.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="拼接",t.Msg.TEXT_CREATE_JOIN_TOOLTIP="添加、移除或重新排列各节来重新配置这个文本块。",t.Msg.TEXT_GET_SUBSTRING_END_FROM_END="到倒数第#个字符",t.Msg.TEXT_GET_SUBSTRING_END_FROM_START="到第#个字符",t.Msg.TEXT_GET_SUBSTRING_END_LAST="到最后一个字符",t.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",t.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="从文本",t.Msg.TEXT_GET_SUBSTRING_START_FIRST="获取子串,从第一个字符",t.Msg.TEXT_GET_SUBSTRING_START_FROM_END="获取子串,从倒数第#个字符",t.Msg.TEXT_GET_SUBSTRING_START_FROM_START="获取子串,从第#个字符",t.Msg.TEXT_GET_SUBSTRING_TAIL="-",t.Msg.TEXT_GET_SUBSTRING_TOOLTIP="返回文本中指定的一部分。",t.Msg.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text",t.Msg.TEXT_INDEXOF_OPERATOR_FIRST="寻找第一次出现的文本",t.Msg.TEXT_INDEXOF_OPERATOR_LAST="寻找最后一次出现的文本",t.Msg.TEXT_INDEXOF_TITLE="在文本 %1 里 %2 %3",t.Msg.TEXT_INDEXOF_TOOLTIP="返回第一个文本段在第二个文本段中的第一/最后一个匹配项的起始位置。如果未找到,则返回%1。",t.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text",t.Msg.TEXT_ISEMPTY_TITLE="%1是空的",t.Msg.TEXT_ISEMPTY_TOOLTIP="如果给定的文本为空,则返回真。",t.Msg.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation",t.Msg.TEXT_JOIN_TITLE_CREATEWITH="创建文本,内容:",t.Msg.TEXT_JOIN_TOOLTIP="通过串起任意数量的项以建立一段文本。",t.Msg.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_LENGTH_TITLE="%1的长度",t.Msg.TEXT_LENGTH_TOOLTIP="返回给定文本的字母数(包括空格)。",t.Msg.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text",t.Msg.TEXT_PRINT_TITLE="输出%1",t.Msg.TEXT_PRINT_TOOLTIP="输出指定的文字、数字或其他值。",t.Msg.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",t.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="要求用户输入数字。",t.Msg.TEXT_PROMPT_TOOLTIP_TEXT="要求用户输入一些文本。",t.Msg.TEXT_PROMPT_TYPE_NUMBER="要求输入数字,并显示提示消息",t.Msg.TEXT_PROMPT_TYPE_TEXT="要求输入文本,并显示提示消息",t.Msg.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Text#replacing-substrings",t.Msg.TEXT_REPLACE_MESSAGE0="把%3中的%1替换为%2",t.Msg.TEXT_REPLACE_TOOLTIP="在一段文本中,将出现过的某部分文本都替换掉。",t.Msg.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Text#reversing-text",t.Msg.TEXT_REVERSE_MESSAGE0="倒转文本%1",t.Msg.TEXT_REVERSE_TOOLTIP="将文本中各个字符的顺序倒转。",t.Msg.TEXT_TEXT_HELPURL="https://zh.wikipedia.org/wiki/字符串",t.Msg.TEXT_TEXT_TOOLTIP="一个字、词语或一行文本。",t.Msg.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",t.Msg.TEXT_TRIM_OPERATOR_BOTH="消除其两侧的空白",t.Msg.TEXT_TRIM_OPERATOR_LEFT="消除其左侧的空白",t.Msg.TEXT_TRIM_OPERATOR_RIGHT="消除其右侧的空白",t.Msg.TEXT_TRIM_TOOLTIP="从某一端或同时从两端删除多余的空白,并返回这段文字的一个副本。",t.Msg.TODAY="今天",t.Msg.UNDO="撤销",t.Msg.UNNAMED_KEY="匿名",t.Msg.VARIABLES_DEFAULT_NAME="项目",t.Msg.VARIABLES_GET_CREATE_SET="创建“设定%1”",t.Msg.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get",t.Msg.VARIABLES_GET_TOOLTIP="返回此变量的值。",t.Msg.VARIABLES_SET="赋值 %1 为 %2",t.Msg.VARIABLES_SET_CREATE_GET="创建“获得%1”",t.Msg.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set",t.Msg.VARIABLES_SET_TOOLTIP="设置此变量,以使它和输入值相等。",t.Msg.VARIABLE_ALREADY_EXISTS="名字叫“%1”的变量已经存在了。",t.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="名字叫“%1”的变量已经有了另一个类型:“%2”。",t.Msg.WORKSPACE_ARIA_LABEL="Blockly工作区",t.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="说点什么...",t.Msg.CONTROLS_FOREACH_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_FOR_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=t.Msg.CONTROLS_IF_MSG_ELSEIF,t.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=t.Msg.CONTROLS_IF_MSG_ELSE,t.Msg.CONTROLS_IF_IF_TITLE_IF=t.Msg.CONTROLS_IF_MSG_IF,t.Msg.CONTROLS_IF_MSG_THEN=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.LISTS_CREATE_WITH_ITEM_TITLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.LISTS_GET_INDEX_HELPURL=t.Msg.LISTS_INDEX_OF_HELPURL,t.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.MATH_CHANGE_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.PROCEDURES_DEFRETURN_COMMENT=t.Msg.PROCEDURES_DEFNORETURN_COMMENT,t.Msg.PROCEDURES_DEFRETURN_DO=t.Msg.PROCEDURES_DEFNORETURN_DO,t.Msg.PROCEDURES_DEFRETURN_PROCEDURE=t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,t.Msg.PROCEDURES_DEFRETURN_TITLE=t.Msg.PROCEDURES_DEFNORETURN_TITLE,t.Msg.TEXT_APPEND_VARIABLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.MATH_HUE="230",t.Msg.LOOPS_HUE="120",t.Msg.LISTS_HUE="260",t.Msg.LOGIC_HUE="210",t.Msg.VARIABLES_HUE="330",t.Msg.TEXTS_HUE="160",t.Msg.PROCEDURES_HUE="290",t.Msg.COLOUR_HUE="20",t.Msg.VARIABLES_DYNAMIC_HUE="310",t.Msg},r=[n("xnUL")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},ISYW:function(t,e,n){"use strict";e.__esModule=!0;var i,r=n("7+uW"),o=(i=r)&&i.__esModule?i:{default:i},s=n("2kvA");var a=[],l="@@clickoutsideContext",u=void 0,c=0;function h(t,e,n){return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!(n&&n.context&&i.target&&r.target)||t.contains(i.target)||t.contains(r.target)||t===i.target||n.context.popperElm&&(n.context.popperElm.contains(i.target)||n.context.popperElm.contains(r.target))||(e.expression&&t[l].methodName&&n.context[t[l].methodName]?n.context[t[l].methodName]():t[l].bindingFn&&t[l].bindingFn())}}!o.default.prototype.$isServer&&(0,s.on)(document,"mousedown",function(t){return u=t}),!o.default.prototype.$isServer&&(0,s.on)(document,"mouseup",function(t){a.forEach(function(e){return e[l].documentHandler(t,u)})}),e.default={bind:function(t,e,n){a.push(t);var i=c++;t[l]={id:i,documentHandler:h(t,e,n),methodName:e.expression,bindingFn:e.value}},update:function(t,e,n){t[l].documentHandler=h(t,e,n),t[l].methodName=e.expression,t[l].bindingFn=e.value},unbind:function(t){for(var e=a.length,n=0;n<e;n++)if(a[n][l].id===t[l].id){a.splice(n,1);break}delete t[l]}}},Ibhu:function(t,e,n){var i=n("D2L2"),r=n("TcQ7"),o=n("vFc/")(!1),s=n("ax3d")("IE_PROTO");t.exports=function(t,e){var n,a=r(t),l=0,u=[];for(n in a)n!=s&&i(a,n)&&u.push(n);for(;e.length>l;)i(a,n=e[l++])&&(~o(u,n)||u.push(n));return u}},JMbB:function(t,e,n){var i,r,o,s;s=function(t){"use strict";return t.JavaScript=new t.Generator("JavaScript"),t.JavaScript.addReservedWords("break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,in,instanceof,new,return,super,switch,this,throw,try,typeof,var,void,while,with,yield,enum,implements,interface,let,package,private,protected,public,static,await,null,true,false,arguments,"+Object.getOwnPropertyNames(t.utils.global).join(",")),t.JavaScript.ORDER_ATOMIC=0,t.JavaScript.ORDER_NEW=1.1,t.JavaScript.ORDER_MEMBER=1.2,t.JavaScript.ORDER_FUNCTION_CALL=2,t.JavaScript.ORDER_INCREMENT=3,t.JavaScript.ORDER_DECREMENT=3,t.JavaScript.ORDER_BITWISE_NOT=4.1,t.JavaScript.ORDER_UNARY_PLUS=4.2,t.JavaScript.ORDER_UNARY_NEGATION=4.3,t.JavaScript.ORDER_LOGICAL_NOT=4.4,t.JavaScript.ORDER_TYPEOF=4.5,t.JavaScript.ORDER_VOID=4.6,t.JavaScript.ORDER_DELETE=4.7,t.JavaScript.ORDER_AWAIT=4.8,t.JavaScript.ORDER_EXPONENTIATION=5,t.JavaScript.ORDER_MULTIPLICATION=5.1,t.JavaScript.ORDER_DIVISION=5.2,t.JavaScript.ORDER_MODULUS=5.3,t.JavaScript.ORDER_SUBTRACTION=6.1,t.JavaScript.ORDER_ADDITION=6.2,t.JavaScript.ORDER_BITWISE_SHIFT=7,t.JavaScript.ORDER_RELATIONAL=8,t.JavaScript.ORDER_IN=8,t.JavaScript.ORDER_INSTANCEOF=8,t.JavaScript.ORDER_EQUALITY=9,t.JavaScript.ORDER_BITWISE_AND=10,t.JavaScript.ORDER_BITWISE_XOR=11,t.JavaScript.ORDER_BITWISE_OR=12,t.JavaScript.ORDER_LOGICAL_AND=13,t.JavaScript.ORDER_LOGICAL_OR=14,t.JavaScript.ORDER_CONDITIONAL=15,t.JavaScript.ORDER_ASSIGNMENT=16,t.JavaScript.ORDER_YIELD=17,t.JavaScript.ORDER_COMMA=18,t.JavaScript.ORDER_NONE=99,t.JavaScript.ORDER_OVERRIDES=[[t.JavaScript.ORDER_FUNCTION_CALL,t.JavaScript.ORDER_MEMBER],[t.JavaScript.ORDER_FUNCTION_CALL,t.JavaScript.ORDER_FUNCTION_CALL],[t.JavaScript.ORDER_MEMBER,t.JavaScript.ORDER_MEMBER],[t.JavaScript.ORDER_MEMBER,t.JavaScript.ORDER_FUNCTION_CALL],[t.JavaScript.ORDER_LOGICAL_NOT,t.JavaScript.ORDER_LOGICAL_NOT],[t.JavaScript.ORDER_MULTIPLICATION,t.JavaScript.ORDER_MULTIPLICATION],[t.JavaScript.ORDER_ADDITION,t.JavaScript.ORDER_ADDITION],[t.JavaScript.ORDER_LOGICAL_AND,t.JavaScript.ORDER_LOGICAL_AND],[t.JavaScript.ORDER_LOGICAL_OR,t.JavaScript.ORDER_LOGICAL_OR]],t.JavaScript.isInitialized=!1,t.JavaScript.init=function(e){Object.getPrototypeOf(this).init.call(this),this.nameDB_?this.nameDB_.reset():this.nameDB_=new t.Names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);for(var n=[],i=t.Variables.allDeveloperVariables(e),r=0;r<i.length;r++)n.push(this.nameDB_.getName(i[r],t.Names.DEVELOPER_VARIABLE_TYPE));for(e=t.Variables.allUsedVarModels(e),r=0;r<e.length;r++)n.push(this.nameDB_.getName(e[r].getId(),t.VARIABLE_CATEGORY_NAME));n.length&&(this.definitions_.variables="var "+n.join(", ")+";"),this.isInitialized=!0},t.JavaScript.finish=function(e){var n=t.utils.object.values(this.definitions_);return e=Object.getPrototypeOf(this).finish.call(this,e),this.isInitialized=!1,this.nameDB_.reset(),n.join("\n\n")+"\n\n\n"+e},t.JavaScript.scrubNakedValue=function(t){return t+";\n"},t.JavaScript.quote_=function(t){return"'"+(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'"))+"'"},t.JavaScript.multiline_quote_=function(t){return t.split(/\n/g).map(this.quote_).join(" + '\\n' +\n")},t.JavaScript.scrub_=function(e,n,i){var r="";if(!e.outputConnection||!e.outputConnection.targetConnection){var o=e.getCommentText();o&&(o=t.utils.string.wrap(o,this.COMMENT_WRAP-3),r+=this.prefixLines(o+"\n","// "));for(var s=0;s<e.inputList.length;s++)e.inputList[s].type==t.inputTypes.VALUE&&(o=e.inputList[s].connection.targetBlock())&&(o=this.allNestedComments(o))&&(r+=this.prefixLines(o,"// "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),r+n+(i=i?"":this.blockToCode(e))},t.JavaScript.getAdjusted=function(e,n,i,r,o){i=i||0,o=o||this.ORDER_NONE,e.workspace.options.oneBasedIndex&&i--;var s=e.workspace.options.oneBasedIndex?"1":"0";if(e=0<i?this.valueToCode(e,n,this.ORDER_ADDITION)||s:0>i?this.valueToCode(e,n,this.ORDER_SUBTRACTION)||s:r?this.valueToCode(e,n,this.ORDER_UNARY_NEGATION)||s:this.valueToCode(e,n,o)||s,t.isNumber(e))e=Number(e)+i,r&&(e=-e);else{if(0<i){e=e+" + "+i;var a=this.ORDER_ADDITION}else 0>i&&(e=e+" - "+-i,a=this.ORDER_SUBTRACTION);r&&(e=i?"-("+e+")":"-"+e,a=this.ORDER_UNARY_NEGATION),a=Math.floor(a),o=Math.floor(o),a&&o>=a&&(e="("+e+")")}return e},t.JavaScript.colour={},t.JavaScript.colour_picker=function(e){return[t.JavaScript.quote_(e.getFieldValue("COLOUR")),t.JavaScript.ORDER_ATOMIC]},t.JavaScript.colour_random=function(e){return[t.JavaScript.provideFunction_("colourRandom",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"() {"," var num = Math.floor(Math.random() * Math.pow(2, 24));"," return '#' + ('00000' + num.toString(16)).substr(-6);","}"])+"()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.colour_rgb=function(e){var n=t.JavaScript.valueToCode(e,"RED",t.JavaScript.ORDER_NONE)||0,i=t.JavaScript.valueToCode(e,"GREEN",t.JavaScript.ORDER_NONE)||0;return e=t.JavaScript.valueToCode(e,"BLUE",t.JavaScript.ORDER_NONE)||0,[t.JavaScript.provideFunction_("colourRgb",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b) {"," r = Math.max(Math.min(Number(r), 100), 0) * 2.55;"," g = Math.max(Math.min(Number(g), 100), 0) * 2.55;"," b = Math.max(Math.min(Number(b), 100), 0) * 2.55;"," r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);"," g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);"," b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+n+", "+i+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.colour_blend=function(e){var n=t.JavaScript.valueToCode(e,"COLOUR1",t.JavaScript.ORDER_NONE)||"'#000000'",i=t.JavaScript.valueToCode(e,"COLOUR2",t.JavaScript.ORDER_NONE)||"'#000000'";return e=t.JavaScript.valueToCode(e,"RATIO",t.JavaScript.ORDER_NONE)||.5,[t.JavaScript.provideFunction_("colourBlend",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(c1, c2, ratio) {"," ratio = Math.max(Math.min(Number(ratio), 1), 0);"," var r1 = parseInt(c1.substring(1, 3), 16);"," var g1 = parseInt(c1.substring(3, 5), 16);"," var b1 = parseInt(c1.substring(5, 7), 16);"," var r2 = parseInt(c2.substring(1, 3), 16);"," var g2 = parseInt(c2.substring(3, 5), 16);"," var b2 = parseInt(c2.substring(5, 7), 16);"," var r = Math.round(r1 * (1 - ratio) + r2 * ratio);"," var g = Math.round(g1 * (1 - ratio) + g2 * ratio);"," var b = Math.round(b1 * (1 - ratio) + b2 * ratio);"," r = ('0' + (r || 0).toString(16)).slice(-2);"," g = ('0' + (g || 0).toString(16)).slice(-2);"," b = ('0' + (b || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+n+", "+i+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists={},t.JavaScript.lists_create_empty=function(e){return["[]",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.lists_create_with=function(e){for(var n=Array(e.itemCount_),i=0;i<e.itemCount_;i++)n[i]=t.JavaScript.valueToCode(e,"ADD"+i,t.JavaScript.ORDER_NONE)||"null";return["["+n.join(", ")+"]",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.lists_repeat=function(e){return[t.JavaScript.provideFunction_("listsRepeat",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(value, n) {"," var array = [];"," for (var i = 0; i < n; i++) {"," array[i] = value;"," }"," return array;","}"])+"("+(t.JavaScript.valueToCode(e,"ITEM",t.JavaScript.ORDER_NONE)||"null")+", "+(e=t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_NONE)||"0")+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_length=function(e){return[(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"[]")+".length",t.JavaScript.ORDER_MEMBER]},t.JavaScript.lists_isEmpty=function(e){return["!"+(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"[]")+".length",t.JavaScript.ORDER_LOGICAL_NOT]},t.JavaScript.lists_indexOf=function(e){var n="FIRST"==e.getFieldValue("END")?"indexOf":"lastIndexOf",i=t.JavaScript.valueToCode(e,"FIND",t.JavaScript.ORDER_NONE)||"''";return n=(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"[]")+"."+n+"("+i+")",e.workspace.options.oneBasedIndex?[n+" + 1",t.JavaScript.ORDER_ADDITION]:[n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_getIndex=function(e){var n=e.getFieldValue("MODE")||"GET",i=e.getFieldValue("WHERE")||"FROM_START",r=t.JavaScript.valueToCode(e,"VALUE","RANDOM"==i?t.JavaScript.ORDER_NONE:t.JavaScript.ORDER_MEMBER)||"[]";switch(i){case"FIRST":if("GET"==n)return[r+"[0]",t.JavaScript.ORDER_MEMBER];if("GET_REMOVE"==n)return[r+".shift()",t.JavaScript.ORDER_MEMBER];if("REMOVE"==n)return r+".shift();\n";break;case"LAST":if("GET"==n)return[r+".slice(-1)[0]",t.JavaScript.ORDER_MEMBER];if("GET_REMOVE"==n)return[r+".pop()",t.JavaScript.ORDER_MEMBER];if("REMOVE"==n)return r+".pop();\n";break;case"FROM_START":if(e=t.JavaScript.getAdjusted(e,"AT"),"GET"==n)return[r+"["+e+"]",t.JavaScript.ORDER_MEMBER];if("GET_REMOVE"==n)return[r+".splice("+e+", 1)[0]",t.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"==n)return r+".splice("+e+", 1);\n";break;case"FROM_END":if(e=t.JavaScript.getAdjusted(e,"AT",1,!0),"GET"==n)return[r+".slice("+e+")[0]",t.JavaScript.ORDER_FUNCTION_CALL];if("GET_REMOVE"==n)return[r+".splice("+e+", 1)[0]",t.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"==n)return r+".splice("+e+", 1);";break;case"RANDOM":if(r=t.JavaScript.provideFunction_("listsGetRandomItem",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list, remove) {"," var x = Math.floor(Math.random() * list.length);"," if (remove) {"," return list.splice(x, 1)[0];"," } else {"," return list[x];"," }","}"])+"("+r+", "+("GET"!=n)+")","GET"==n||"GET_REMOVE"==n)return[r,t.JavaScript.ORDER_FUNCTION_CALL];if("REMOVE"==n)return r+";\n"}throw Error("Unhandled combination (lists_getIndex).")},t.JavaScript.lists_setIndex=function(e){function n(){if(i.match(/^\w+$/))return"";var e=t.JavaScript.nameDB_.getDistinctName("tmpList",t.VARIABLE_CATEGORY_NAME),n="var "+e+" = "+i+";\n";return i=e,n}var i=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_MEMBER)||"[]",r=e.getFieldValue("MODE")||"GET",o=e.getFieldValue("WHERE")||"FROM_START",s=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_ASSIGNMENT)||"null";switch(o){case"FIRST":if("SET"==r)return i+"[0] = "+s+";\n";if("INSERT"==r)return i+".unshift("+s+");\n";break;case"LAST":if("SET"==r)return(e=n())+(i+"[")+i+".length - 1] = "+s+";\n";if("INSERT"==r)return i+".push("+s+");\n";break;case"FROM_START":if(o=t.JavaScript.getAdjusted(e,"AT"),"SET"==r)return i+"["+o+"] = "+s+";\n";if("INSERT"==r)return i+".splice("+o+", 0, "+s+");\n";break;case"FROM_END":if(o=t.JavaScript.getAdjusted(e,"AT",1,!1,t.JavaScript.ORDER_SUBTRACTION),e=n(),"SET"==r)return e+(i+"[")+i+".length - "+o+"] = "+s+";\n";if("INSERT"==r)return e+(i+".splice(")+i+".length - "+o+", 0, "+s+");\n";break;case"RANDOM":if(e=n(),e+="var "+(o=t.JavaScript.nameDB_.getDistinctName("tmpX",t.VARIABLE_CATEGORY_NAME))+" = Math.floor(Math.random() * "+i+".length);\n","SET"==r)return e+(i+"[")+o+"] = "+s+";\n";if("INSERT"==r)return e+(i+".splice(")+o+", 0, "+s+");\n"}throw Error("Unhandled combination (lists_setIndex).")},t.JavaScript.lists.getIndex_=function(t,e,n){return"FIRST"==e?"0":"FROM_END"==e?t+".length - 1 - "+n:"LAST"==e?t+".length - 1":n},t.JavaScript.lists_getSublist=function(e){var n=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_MEMBER)||"[]",i=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");if("FIRST"==i&&"LAST"==r)n+=".slice(0)";else if(n.match(/^\w+$/)||"FROM_END"!=i&&"FROM_START"==r){switch(i){case"FROM_START":var o=t.JavaScript.getAdjusted(e,"AT1");break;case"FROM_END":o=n+".length - "+(o=t.JavaScript.getAdjusted(e,"AT1",1,!1,t.JavaScript.ORDER_SUBTRACTION));break;case"FIRST":o="0";break;default:throw Error("Unhandled option (lists_getSublist).")}switch(r){case"FROM_START":e=t.JavaScript.getAdjusted(e,"AT2",1);break;case"FROM_END":e=n+".length - "+(e=t.JavaScript.getAdjusted(e,"AT2",0,!1,t.JavaScript.ORDER_SUBTRACTION));break;case"LAST":e=n+".length";break;default:throw Error("Unhandled option (lists_getSublist).")}n=n+".slice("+o+", "+e+")"}else{o=t.JavaScript.getAdjusted(e,"AT1"),e=t.JavaScript.getAdjusted(e,"AT2");var s=t.JavaScript.lists.getIndex_,a={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};n=t.JavaScript.provideFunction_("subsequence"+a[i]+a[r],["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"==i||"FROM_START"==i?", at1":"")+("FROM_END"==r||"FROM_START"==r?", at2":"")+") {"," var start = "+s("sequence",i,"at1")+";"," var end = "+s("sequence",r,"at2")+" + 1;"," return sequence.slice(start, end);","}"])+"("+n+("FROM_END"==i||"FROM_START"==i?", "+o:"")+("FROM_END"==r||"FROM_START"==r?", "+e:"")+")"}return[n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_sort=function(e){var n=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_FUNCTION_CALL)||"[]",i="1"===e.getFieldValue("DIRECTION")?1:-1;return e=e.getFieldValue("TYPE"),[n+".slice().sort("+t.JavaScript.provideFunction_("listsGetSortCompare",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(type, direction) {"," var compareFuncs = {",' "NUMERIC": function(a, b) {'," return Number(a) - Number(b); },",' "TEXT": function(a, b) {'," return a.toString() > b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];"," return function(a, b) { return compare(a, b) * direction; }","}"])+'("'+e+'", '+i+"))",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_split=function(e){var n=t.JavaScript.valueToCode(e,"INPUT",t.JavaScript.ORDER_MEMBER),i=t.JavaScript.valueToCode(e,"DELIM",t.JavaScript.ORDER_NONE)||"''";if("SPLIT"==(e=e.getFieldValue("MODE")))n||(n="''"),e="split";else{if("JOIN"!=e)throw Error("Unknown mode: "+e);n||(n="[]"),e="join"}return[n+"."+e+"("+i+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_reverse=function(e){return[(t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.logic={},t.JavaScript.controls_if=function(e){var n=0,i="";t.JavaScript.STATEMENT_PREFIX&&(i+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e));do{var r=t.JavaScript.valueToCode(e,"IF"+n,t.JavaScript.ORDER_NONE)||"false",o=t.JavaScript.statementToCode(e,"DO"+n);t.JavaScript.STATEMENT_SUFFIX&&(o=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e),t.JavaScript.INDENT)+o),i+=(0<n?" else ":"")+"if ("+r+") {\n"+o+"}",++n}while(e.getInput("IF"+n));return(e.getInput("ELSE")||t.JavaScript.STATEMENT_SUFFIX)&&(o=t.JavaScript.statementToCode(e,"ELSE"),t.JavaScript.STATEMENT_SUFFIX&&(o=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e),t.JavaScript.INDENT)+o),i+=" else {\n"+o+"}"),i+"\n"},t.JavaScript.controls_ifelse=t.JavaScript.controls_if,t.JavaScript.logic_compare=function(e){var n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],i="=="==n||"!="==n?t.JavaScript.ORDER_EQUALITY:t.JavaScript.ORDER_RELATIONAL;return[(t.JavaScript.valueToCode(e,"A",i)||"0")+" "+n+" "+(e=t.JavaScript.valueToCode(e,"B",i)||"0"),i]},t.JavaScript.logic_operation=function(e){var n="AND"==e.getFieldValue("OP")?"&&":"||",i="&&"==n?t.JavaScript.ORDER_LOGICAL_AND:t.JavaScript.ORDER_LOGICAL_OR,r=t.JavaScript.valueToCode(e,"A",i);if(e=t.JavaScript.valueToCode(e,"B",i),r||e){var o="&&"==n?"true":"false";r||(r=o),e||(e=o)}else e=r="false";return[r+" "+n+" "+e,i]},t.JavaScript.logic_negate=function(e){var n=t.JavaScript.ORDER_LOGICAL_NOT;return["!"+(t.JavaScript.valueToCode(e,"BOOL",n)||"true"),n]},t.JavaScript.logic_boolean=function(e){return["TRUE"==e.getFieldValue("BOOL")?"true":"false",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.logic_null=function(e){return["null",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.logic_ternary=function(e){return[(t.JavaScript.valueToCode(e,"IF",t.JavaScript.ORDER_CONDITIONAL)||"false")+" ? "+(t.JavaScript.valueToCode(e,"THEN",t.JavaScript.ORDER_CONDITIONAL)||"null")+" : "+(e=t.JavaScript.valueToCode(e,"ELSE",t.JavaScript.ORDER_CONDITIONAL)||"null"),t.JavaScript.ORDER_CONDITIONAL]},t.JavaScript.loops={},t.JavaScript.controls_repeat_ext=function(e){var n=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):t.JavaScript.valueToCode(e,"TIMES",t.JavaScript.ORDER_ASSIGNMENT)||"0",i=t.JavaScript.statementToCode(e,"DO");i=t.JavaScript.addLoopTrap(i,e),e="";var r=t.JavaScript.nameDB_.getDistinctName("count",t.VARIABLE_CATEGORY_NAME),o=n;return n.match(/^\w+$/)||t.isNumber(n)||(e+="var "+(o=t.JavaScript.nameDB_.getDistinctName("repeat_end",t.VARIABLE_CATEGORY_NAME))+" = "+n+";\n"),e+"for (var "+r+" = 0; "+r+" < "+o+"; "+r+"++) {\n"+i+"}\n"},t.JavaScript.controls_repeat=t.JavaScript.controls_repeat_ext,t.JavaScript.controls_whileUntil=function(e){var n="UNTIL"==e.getFieldValue("MODE"),i=t.JavaScript.valueToCode(e,"BOOL",n?t.JavaScript.ORDER_LOGICAL_NOT:t.JavaScript.ORDER_NONE)||"false",r=t.JavaScript.statementToCode(e,"DO");return r=t.JavaScript.addLoopTrap(r,e),n&&(i="!"+i),"while ("+i+") {\n"+r+"}\n"},t.JavaScript.controls_for=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME),i=t.JavaScript.valueToCode(e,"FROM",t.JavaScript.ORDER_ASSIGNMENT)||"0",r=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_ASSIGNMENT)||"0",o=t.JavaScript.valueToCode(e,"BY",t.JavaScript.ORDER_ASSIGNMENT)||"1",s=t.JavaScript.statementToCode(e,"DO");if(s=t.JavaScript.addLoopTrap(s,e),t.isNumber(i)&&t.isNumber(r)&&t.isNumber(o)){var a=Number(i)<=Number(r);e="for ("+n+" = "+i+"; "+n+(a?" <= ":" >= ")+r+"; "+n,e=(1==(n=Math.abs(Number(o)))?e+(a?"++":"--"):e+(a?" += ":" -= ")+n)+") {\n"+s+"}\n"}else e="",a=i,i.match(/^\w+$/)||t.isNumber(i)||(e+="var "+(a=t.JavaScript.nameDB_.getDistinctName(n+"_start",t.VARIABLE_CATEGORY_NAME))+" = "+i+";\n"),i=r,r.match(/^\w+$/)||t.isNumber(r)||(e+="var "+(i=t.JavaScript.nameDB_.getDistinctName(n+"_end",t.VARIABLE_CATEGORY_NAME))+" = "+r+";\n"),e+="var "+(r=t.JavaScript.nameDB_.getDistinctName(n+"_inc",t.VARIABLE_CATEGORY_NAME))+" = ",e=(e=t.isNumber(o)?e+(Math.abs(o)+";\n"):e+"Math.abs("+o+");\n")+"if ("+a+" > "+i+") {\n"+(t.JavaScript.INDENT+r)+" = -"+r+";\n",e+="}\n",e+="for ("+n+" = "+a+"; "+r+" >= 0 ? "+n+" <= "+i+" : "+n+" >= "+i+"; "+n+" += "+r+") {\n"+s+"}\n";return e},t.JavaScript.controls_forEach=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME),i=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_ASSIGNMENT)||"[]",r=t.JavaScript.statementToCode(e,"DO");r=t.JavaScript.addLoopTrap(r,e),e="";var o=i;return i.match(/^\w+$/)||(e+="var "+(o=t.JavaScript.nameDB_.getDistinctName(n+"_list",t.VARIABLE_CATEGORY_NAME))+" = "+i+";\n"),e+"for (var "+(i=t.JavaScript.nameDB_.getDistinctName(n+"_index",t.VARIABLE_CATEGORY_NAME))+" in "+o+") {\n"+(r=t.JavaScript.INDENT+n+" = "+o+"["+i+"];\n"+r)+"}\n"},t.JavaScript.controls_flow_statements=function(e){var n="";if(t.JavaScript.STATEMENT_PREFIX&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e)),t.JavaScript.STATEMENT_SUFFIX&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e)),t.JavaScript.STATEMENT_PREFIX){var i=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(e);i&&!i.suppressPrefixSuffix&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,i))}switch(e.getFieldValue("FLOW")){case"BREAK":return n+"break;\n";case"CONTINUE":return n+"continue;\n"}throw Error("Unknown flow statement.")},t.JavaScript.math={},t.JavaScript.math_number=function(e){return[e=Number(e.getFieldValue("NUM")),0<=e?t.JavaScript.ORDER_ATOMIC:t.JavaScript.ORDER_UNARY_NEGATION]},t.JavaScript.math_arithmetic=function(e){var n={ADD:[" + ",t.JavaScript.ORDER_ADDITION],MINUS:[" - ",t.JavaScript.ORDER_SUBTRACTION],MULTIPLY:[" * ",t.JavaScript.ORDER_MULTIPLICATION],DIVIDE:[" / ",t.JavaScript.ORDER_DIVISION],POWER:[null,t.JavaScript.ORDER_NONE]}[e.getFieldValue("OP")],i=n[0];n=n[1];var r=t.JavaScript.valueToCode(e,"A",n)||"0";return e=t.JavaScript.valueToCode(e,"B",n)||"0",i?[r+i+e,n]:["Math.pow("+r+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_single=function(e){var n=e.getFieldValue("OP");if("NEG"==n)return"-"==(e=t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_UNARY_NEGATION)||"0")[0]&&(e=" "+e),["-"+e,t.JavaScript.ORDER_UNARY_NEGATION];switch(e="SIN"==n||"COS"==n||"TAN"==n?t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_DIVISION)||"0":t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_NONE)||"0",n){case"ABS":var i="Math.abs("+e+")";break;case"ROOT":i="Math.sqrt("+e+")";break;case"LN":i="Math.log("+e+")";break;case"EXP":i="Math.exp("+e+")";break;case"POW10":i="Math.pow(10,"+e+")";break;case"ROUND":i="Math.round("+e+")";break;case"ROUNDUP":i="Math.ceil("+e+")";break;case"ROUNDDOWN":i="Math.floor("+e+")";break;case"SIN":i="Math.sin("+e+" / 180 * Math.PI)";break;case"COS":i="Math.cos("+e+" / 180 * Math.PI)";break;case"TAN":i="Math.tan("+e+" / 180 * Math.PI)"}if(i)return[i,t.JavaScript.ORDER_FUNCTION_CALL];switch(n){case"LOG10":i="Math.log("+e+") / Math.log(10)";break;case"ASIN":i="Math.asin("+e+") / Math.PI * 180";break;case"ACOS":i="Math.acos("+e+") / Math.PI * 180";break;case"ATAN":i="Math.atan("+e+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+n)}return[i,t.JavaScript.ORDER_DIVISION]},t.JavaScript.math_constant=function(e){return{PI:["Math.PI",t.JavaScript.ORDER_MEMBER],E:["Math.E",t.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",t.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",t.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",t.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",t.JavaScript.ORDER_ATOMIC]}[e.getFieldValue("CONSTANT")]},t.JavaScript.math_number_property=function(e){var n=t.JavaScript.valueToCode(e,"NUMBER_TO_CHECK",t.JavaScript.ORDER_MODULUS)||"0",i=e.getFieldValue("PROPERTY");if("PRIME"==i)return[t.JavaScript.provideFunction_("mathIsPrime",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+n+")",t.JavaScript.ORDER_FUNCTION_CALL];switch(i){case"EVEN":var r=n+" % 2 == 0";break;case"ODD":r=n+" % 2 == 1";break;case"WHOLE":r=n+" % 1 == 0";break;case"POSITIVE":r=n+" > 0";break;case"NEGATIVE":r=n+" < 0";break;case"DIVISIBLE_BY":r=n+" % "+(e=t.JavaScript.valueToCode(e,"DIVISOR",t.JavaScript.ORDER_MODULUS)||"0")+" == 0"}return[r,t.JavaScript.ORDER_EQUALITY]},t.JavaScript.math_change=function(e){var n=t.JavaScript.valueToCode(e,"DELTA",t.JavaScript.ORDER_ADDITION)||"0";return(e=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME))+" = (typeof "+e+" == 'number' ? "+e+" : 0) + "+n+";\n"},t.JavaScript.math_round=t.JavaScript.math_single,t.JavaScript.math_trig=t.JavaScript.math_single,t.JavaScript.math_on_list=function(e){var n=e.getFieldValue("OP");switch(n){case"SUM":e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_MEMBER)||"[]",e+=".reduce(function(x, y) {return x + y;})";break;case"MIN":e="Math.min.apply(null, "+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MAX":e="Math.max.apply(null, "+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"AVERAGE":e=(n=t.JavaScript.provideFunction_("mathMean",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MEDIAN":e=(n=t.JavaScript.provideFunction_("mathMedian",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MODE":e=(n=t.JavaScript.provideFunction_("mathModes",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);"," }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"STD_DEV":e=(n=t.JavaScript.provideFunction_("mathStandardDeviation",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);"," }"," variance = variance / n;"," return Math.sqrt(variance);","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"RANDOM":e=(n=t.JavaScript.provideFunction_("mathRandomList",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+n)}return[e,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_modulo=function(e){return[(t.JavaScript.valueToCode(e,"DIVIDEND",t.JavaScript.ORDER_MODULUS)||"0")+" % "+(e=t.JavaScript.valueToCode(e,"DIVISOR",t.JavaScript.ORDER_MODULUS)||"0"),t.JavaScript.ORDER_MODULUS]},t.JavaScript.math_constrain=function(e){return["Math.min(Math.max("+(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_NONE)||"0")+", "+(t.JavaScript.valueToCode(e,"LOW",t.JavaScript.ORDER_NONE)||"0")+"), "+(e=t.JavaScript.valueToCode(e,"HIGH",t.JavaScript.ORDER_NONE)||"Infinity")+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_random_int=function(e){var n=t.JavaScript.valueToCode(e,"FROM",t.JavaScript.ORDER_NONE)||"0";return e=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_NONE)||"0",[t.JavaScript.provideFunction_("mathRandomInt",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+n+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_random_float=function(e){return["Math.random()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_atan2=function(e){var n=t.JavaScript.valueToCode(e,"X",t.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+(t.JavaScript.valueToCode(e,"Y",t.JavaScript.ORDER_NONE)||"0")+", "+n+") / Math.PI * 180",t.JavaScript.ORDER_DIVISION]},t.JavaScript.procedures={},t.JavaScript.procedures_defreturn=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("NAME"),t.PROCEDURE_CATEGORY_NAME),i="";t.JavaScript.STATEMENT_PREFIX&&(i+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e)),t.JavaScript.STATEMENT_SUFFIX&&(i+=t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e)),i&&(i=t.JavaScript.prefixLines(i,t.JavaScript.INDENT));var r="";t.JavaScript.INFINITE_LOOP_TRAP&&(r=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.INFINITE_LOOP_TRAP,e),t.JavaScript.INDENT));var o=t.JavaScript.statementToCode(e,"STACK"),s=t.JavaScript.valueToCode(e,"RETURN",t.JavaScript.ORDER_NONE)||"",a="";o&&s&&(a=i),s&&(s=t.JavaScript.INDENT+"return "+s+";\n");for(var l=[],u=e.getVars(),c=0;c<u.length;c++)l[c]=t.JavaScript.nameDB_.getName(u[c],t.VARIABLE_CATEGORY_NAME);return i="function "+n+"("+l.join(", ")+") {\n"+i+r+o+a+s+"}",i=t.JavaScript.scrub_(e,i),t.JavaScript.definitions_["%"+n]=i,null},t.JavaScript.procedures_defnoreturn=t.JavaScript.procedures_defreturn,t.JavaScript.procedures_callreturn=function(e){for(var n=t.JavaScript.nameDB_.getName(e.getFieldValue("NAME"),t.PROCEDURE_CATEGORY_NAME),i=[],r=e.getVars(),o=0;o<r.length;o++)i[o]=t.JavaScript.valueToCode(e,"ARG"+o,t.JavaScript.ORDER_NONE)||"null";return[n+"("+i.join(", ")+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.procedures_callnoreturn=function(e){return t.JavaScript.procedures_callreturn(e)[0]+";\n"},t.JavaScript.procedures_ifreturn=function(e){var n="if ("+(t.JavaScript.valueToCode(e,"CONDITION",t.JavaScript.ORDER_NONE)||"false")+") {\n";return t.JavaScript.STATEMENT_SUFFIX&&(n+=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e),t.JavaScript.INDENT)),e.hasReturnValue_?(e=t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_NONE)||"null",n+=t.JavaScript.INDENT+"return "+e+";\n"):n+=t.JavaScript.INDENT+"return;\n",n+"}\n"},t.JavaScript.texts={},t.JavaScript.text=function(e){return[t.JavaScript.quote_(e.getFieldValue("TEXT")),t.JavaScript.ORDER_ATOMIC]},t.JavaScript.text_multiline=function(e){return[e=t.JavaScript.multiline_quote_(e.getFieldValue("TEXT")),-1!=e.indexOf("+")?t.JavaScript.ORDER_ADDITION:t.JavaScript.ORDER_ATOMIC]},t.JavaScript.text.forceString_=function(e){return t.JavaScript.text.forceString_.strRegExp.test(e)?[e,t.JavaScript.ORDER_ATOMIC]:["String("+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text.forceString_.strRegExp=/^\s*'([^']|\\')*'\s*$/,t.JavaScript.text_join=function(e){switch(e.itemCount_){case 0:return["''",t.JavaScript.ORDER_ATOMIC];case 1:return e=t.JavaScript.valueToCode(e,"ADD0",t.JavaScript.ORDER_NONE)||"''",t.JavaScript.text.forceString_(e);case 2:var n=t.JavaScript.valueToCode(e,"ADD0",t.JavaScript.ORDER_NONE)||"''";return e=t.JavaScript.valueToCode(e,"ADD1",t.JavaScript.ORDER_NONE)||"''",[e=t.JavaScript.text.forceString_(n)[0]+" + "+t.JavaScript.text.forceString_(e)[0],t.JavaScript.ORDER_ADDITION];default:n=Array(e.itemCount_);for(var i=0;i<e.itemCount_;i++)n[i]=t.JavaScript.valueToCode(e,"ADD"+i,t.JavaScript.ORDER_NONE)||"''";return[e="["+n.join(",")+"].join('')",t.JavaScript.ORDER_FUNCTION_CALL]}},t.JavaScript.text_append=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME);return e=t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_NONE)||"''",n+" += "+t.JavaScript.text.forceString_(e)[0]+";\n"},t.JavaScript.text_length=function(e){return[(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"''")+".length",t.JavaScript.ORDER_MEMBER]},t.JavaScript.text_isEmpty=function(e){return["!"+(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"''")+".length",t.JavaScript.ORDER_LOGICAL_NOT]},t.JavaScript.text_indexOf=function(e){var n="FIRST"==e.getFieldValue("END")?"indexOf":"lastIndexOf",i=t.JavaScript.valueToCode(e,"FIND",t.JavaScript.ORDER_NONE)||"''";return n=(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_MEMBER)||"''")+"."+n+"("+i+")",e.workspace.options.oneBasedIndex?[n+" + 1",t.JavaScript.ORDER_ADDITION]:[n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_charAt=function(e){var n=e.getFieldValue("WHERE")||"FROM_START",i=t.JavaScript.valueToCode(e,"VALUE","RANDOM"==n?t.JavaScript.ORDER_NONE:t.JavaScript.ORDER_MEMBER)||"''";switch(n){case"FIRST":return[i+".charAt(0)",t.JavaScript.ORDER_FUNCTION_CALL];case"LAST":return[i+".slice(-1)",t.JavaScript.ORDER_FUNCTION_CALL];case"FROM_START":return[i+".charAt("+(e=t.JavaScript.getAdjusted(e,"AT"))+")",t.JavaScript.ORDER_FUNCTION_CALL];case"FROM_END":return[i+".slice("+(e=t.JavaScript.getAdjusted(e,"AT",1,!0))+").charAt(0)",t.JavaScript.ORDER_FUNCTION_CALL];case"RANDOM":return[t.JavaScript.provideFunction_("textRandomLetter",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(text) {"," var x = Math.floor(Math.random() * text.length);"," return text[x];","}"])+"("+i+")",t.JavaScript.ORDER_FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},t.JavaScript.text.getIndex_=function(t,e,n){return"FIRST"==e?"0":"FROM_END"==e?t+".length - 1 - "+n:"LAST"==e?t+".length - 1":n},t.JavaScript.text_getSubstring=function(e){var n=e.getFieldValue("WHERE1"),i=e.getFieldValue("WHERE2"),r="FROM_END"!=n&&"LAST"!=n&&"FROM_END"!=i&&"LAST"!=i,o=t.JavaScript.valueToCode(e,"STRING",r?t.JavaScript.ORDER_MEMBER:t.JavaScript.ORDER_NONE)||"''";if("FIRST"==n&&"LAST"==i)return[o,t.JavaScript.ORDER_NONE];if(o.match(/^'?\w+'?$/)||r){switch(n){case"FROM_START":r=t.JavaScript.getAdjusted(e,"AT1");break;case"FROM_END":r=o+".length - "+(r=t.JavaScript.getAdjusted(e,"AT1",1,!1,t.JavaScript.ORDER_SUBTRACTION));break;case"FIRST":r="0";break;default:throw Error("Unhandled option (text_getSubstring).")}switch(i){case"FROM_START":e=t.JavaScript.getAdjusted(e,"AT2",1);break;case"FROM_END":e=o+".length - "+(e=t.JavaScript.getAdjusted(e,"AT2",0,!1,t.JavaScript.ORDER_SUBTRACTION));break;case"LAST":e=o+".length";break;default:throw Error("Unhandled option (text_getSubstring).")}n=o+".slice("+r+", "+e+")"}else{r=t.JavaScript.getAdjusted(e,"AT1"),e=t.JavaScript.getAdjusted(e,"AT2");var s=t.JavaScript.text.getIndex_,a={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};n=t.JavaScript.provideFunction_("subsequence"+a[n]+a[i],["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(sequence"+("FROM_END"==n||"FROM_START"==n?", at1":"")+("FROM_END"==i||"FROM_START"==i?", at2":"")+") {"," var start = "+s("sequence",n,"at1")+";"," var end = "+s("sequence",i,"at2")+" + 1;"," return sequence.slice(start, end);","}"])+"("+o+("FROM_END"==n||"FROM_START"==n?", "+r:"")+("FROM_END"==i||"FROM_START"==i?", "+e:"")+")"}return[n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_changeCase=function(e){var n={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[e.getFieldValue("CASE")];return e=t.JavaScript.valueToCode(e,"TEXT",n?t.JavaScript.ORDER_MEMBER:t.JavaScript.ORDER_NONE)||"''",[n?e+n:t.JavaScript.provideFunction_("textToTitleCase",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(str) {"," return str.replace(/\\S+/g,"," function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});","}"])+"("+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_trim=function(e){var n={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[e.getFieldValue("MODE")];return[(t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_MEMBER)||"''")+n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_print=function(e){return"window.alert("+(t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_NONE)||"''")+");\n"},t.JavaScript.text_prompt_ext=function(e){var n="window.prompt("+(e.getField("TEXT")?t.JavaScript.quote_(e.getFieldValue("TEXT")):t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_NONE)||"''")+")";return"NUMBER"==e.getFieldValue("TYPE")&&(n="Number("+n+")"),[n,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_prompt=t.JavaScript.text_prompt_ext,t.JavaScript.text_count=function(e){var n=t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_NONE)||"''";return e=t.JavaScript.valueToCode(e,"SUB",t.JavaScript.ORDER_NONE)||"''",[t.JavaScript.provideFunction_("textCount",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle) {"," if (needle.length === 0) {"," return haystack.length + 1;"," } else {"," return haystack.split(needle).length - 1;"," }","}"])+"("+n+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_replace=function(e){var n=t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_NONE)||"''",i=t.JavaScript.valueToCode(e,"FROM",t.JavaScript.ORDER_NONE)||"''";return e=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_NONE)||"''",[t.JavaScript.provideFunction_("textReplace",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(haystack, needle, replacement) {",' needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,"\\\\$1")',' .replace(/\\x08/g,"\\\\x08");'," return haystack.replace(new RegExp(needle, 'g'), replacement);","}"])+"("+n+", "+i+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.text_reverse=function(e){return[(t.JavaScript.valueToCode(e,"TEXT",t.JavaScript.ORDER_MEMBER)||"''")+".split('').reverse().join('')",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.variables={},t.JavaScript.variables_get=function(e){return[t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME),t.JavaScript.ORDER_ATOMIC]},t.JavaScript.variables_set=function(e){var n=t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_ASSIGNMENT)||"0";return t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME)+" = "+n+";\n"},t.JavaScript.variablesDynamic={},t.JavaScript.variables_get_dynamic=t.JavaScript.variables_get,t.JavaScript.variables_set_dynamic=t.JavaScript.variables_set,t.JavaScript},r=[n("GEkh")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},"JP+z":function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return t.apply(e,n)}}},KCLY:function(t,e,n){"use strict";(function(e){var i=n("cGG2"),r=n("5VQ+"),o={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!i.isUndefined(t)&&i.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,l={adapter:("undefined"!=typeof XMLHttpRequest?a=n("7GwW"):void 0!==e&&"[object process]"===Object.prototype.toString.call(e)&&(a=n("7GwW")),a),transformRequest:[function(t,e){return r(e,"Accept"),r(e,"Content-Type"),i.isFormData(t)||i.isArrayBuffer(t)||i.isBuffer(t)||i.isStream(t)||i.isFile(t)||i.isBlob(t)?t:i.isArrayBufferView(t)?t.buffer:i.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):i.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(t){l.headers[t]={}}),i.forEach(["post","put","patch"],function(t){l.headers[t]=i.merge(o)}),t.exports=l}).call(e,n("W2nU"))},Kh4W:function(t,e,n){e.f=n("dSzd")},L42u:function(t,e,n){var i,r,o,s=n("+ZMJ"),a=n("knuC"),l=n("RPLV"),u=n("ON07"),c=n("7KvD"),h=c.process,p=c.setImmediate,d=c.clearImmediate,f=c.MessageChannel,g=c.Dispatch,m=0,v={},_=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},y=function(t){_.call(t.data)};p&&d||(p=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++m]=function(){a("function"==typeof t?t:Function(t),e)},i(m),m},d=function(t){delete v[t]},"process"==n("R9M2")(h)?i=function(t){h.nextTick(s(_,t,1))}:g&&g.now?i=function(t){g.now(s(_,t,1))}:f?(o=(r=new f).port2,r.port1.onmessage=y,i=s(o.postMessage,o,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(i=function(t){c.postMessage(t+"","*")},c.addEventListener("message",y,!1)):i="onreadystatechange"in u("script")?function(t){l.appendChild(u("script")).onreadystatechange=function(){l.removeChild(this),_.call(t)}}:function(t){setTimeout(s(_,t,1),0)}),t.exports={set:p,clear:d}},LKZe:function(t,e,n){var i=n("NpIQ"),r=n("X8DO"),o=n("TcQ7"),s=n("MmMw"),a=n("D2L2"),l=n("SfB7"),u=Object.getOwnPropertyDescriptor;e.f=n("+E39")?u:function(t,e){if(t=o(t),e=s(e,!0),l)try{return u(t,e)}catch(t){}if(a(t,e))return r(!i.f.call(t,e),t[e])}},M6a0:function(t,e){},MU5D:function(t,e,n){var i=n("R9M2");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},Mhyx:function(t,e,n){var i=n("/bQp"),r=n("dSzd")("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||o[r]===t)}},MmMw:function(t,e,n){var i=n("EqjI");t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},NMof:function(t,e,n){"use strict";var i,r;"function"==typeof Symbol&&Symbol.iterator;void 0===(r="function"==typeof(i=function(){var t=window,e={placement:"bottom",gpuAcceleration:!0,offset:0,boundariesElement:"viewport",boundariesPadding:5,preventOverflowOrder:["left","right","top","bottom"],flipBehavior:"flip",arrowElement:"[x-arrow]",arrowOffset:0,modifiers:["shift","offset","preventOverflow","keepTogether","arrow","flip","applyStyle"],modifiersIgnored:[],forceAbsolute:!1};function n(t,n,i){this._reference=t.jquery?t[0]:t,this.state={};var r=void 0===n||null===n,o=n&&"[object Object]"===Object.prototype.toString.call(n);return this._popper=r||o?this.parse(o?n:{}):n.jquery?n[0]:n,this._options=Object.assign({},e,i),this._options.modifiers=this._options.modifiers.map(function(t){if(-1===this._options.modifiersIgnored.indexOf(t))return"applyStyle"===t&&this._popper.setAttribute("x-placement",this._options.placement),this.modifiers[t]||t}.bind(this)),this.state.position=this._getPosition(this._popper,this._reference),c(this._popper,{position:this.state.position,top:0}),this.update(),this._setupEventListeners(),this}function i(e){var n=e.style.display,i=e.style.visibility;e.style.display="block",e.style.visibility="hidden";e.offsetWidth;var r=t.getComputedStyle(e),o=parseFloat(r.marginTop)+parseFloat(r.marginBottom),s=parseFloat(r.marginLeft)+parseFloat(r.marginRight),a={width:e.offsetWidth+s,height:e.offsetHeight+o};return e.style.display=n,e.style.visibility=i,a}function r(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(t){return e[t]})}function o(t){var e=Object.assign({},t);return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function s(t,e){var n,i=0;for(n in t){if(t[n]===e)return i;i++}return null}function a(e,n){return t.getComputedStyle(e,null)[n]}function l(e){var n=e.offsetParent;return n!==t.document.body&&n?n:t.document.documentElement}function u(e){var n=e.parentNode;return n?n===t.document?t.document.body.scrollTop||t.document.body.scrollLeft?t.document.body:t.document.documentElement:-1!==["scroll","auto"].indexOf(a(n,"overflow"))||-1!==["scroll","auto"].indexOf(a(n,"overflow-x"))||-1!==["scroll","auto"].indexOf(a(n,"overflow-y"))?n:u(e.parentNode):e}function c(t,e){Object.keys(e).forEach(function(n){var i,r="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&(""!==(i=e[n])&&!isNaN(parseFloat(i))&&isFinite(i))&&(r="px"),t.style[n]=e[n]+r})}function h(t){var e={width:t.offsetWidth,height:t.offsetHeight,left:t.offsetLeft,top:t.offsetTop};return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function p(t){var e=t.getBoundingClientRect(),n=-1!=navigator.userAgent.indexOf("MSIE")&&"HTML"===t.tagName?-t.scrollTop:e.top;return{left:e.left,top:n,right:e.right,bottom:e.bottom,width:e.right-e.left,height:e.bottom-n}}function d(e){for(var n=["","ms","webkit","moz","o"],i=0;i<n.length;i++){var r=n[i]?n[i]+e.charAt(0).toUpperCase()+e.slice(1):e;if(void 0!==t.document.body.style[r])return r}return null}return n.prototype.destroy=function(){return this._popper.removeAttribute("x-placement"),this._popper.style.left="",this._popper.style.position="",this._popper.style.top="",this._popper.style[d("transform")]="",this._removeEventListeners(),this._options.removeOnDestroy&&this._popper.remove(),this},n.prototype.update=function(){var t={instance:this,styles:{}};t.placement=this._options.placement,t._originalPlacement=this._options.placement,t.offsets=this._getOffsets(this._popper,this._reference,t.placement),t.boundaries=this._getBoundaries(t,this._options.boundariesPadding,this._options.boundariesElement),t=this.runModifiers(t,this._options.modifiers),"function"==typeof this.state.updateCallback&&this.state.updateCallback(t)},n.prototype.onCreate=function(t){return t(this),this},n.prototype.onUpdate=function(t){return this.state.updateCallback=t,this},n.prototype.parse=function(e){var n={tagName:"div",classNames:["popper"],attributes:[],parent:t.document.body,content:"",contentType:"text",arrowTagName:"div",arrowClassNames:["popper__arrow"],arrowAttributes:["x-arrow"]};e=Object.assign({},n,e);var i=t.document,r=i.createElement(e.tagName);if(a(r,e.classNames),l(r,e.attributes),"node"===e.contentType?r.appendChild(e.content.jquery?e.content[0]:e.content):"html"===e.contentType?r.innerHTML=e.content:r.textContent=e.content,e.arrowTagName){var o=i.createElement(e.arrowTagName);a(o,e.arrowClassNames),l(o,e.arrowAttributes),r.appendChild(o)}var s=e.parent.jquery?e.parent[0]:e.parent;if("string"==typeof s){if((s=i.querySelectorAll(e.parent)).length>1&&console.warn("WARNING: the given `parent` query("+e.parent+") matched more than one element, the first one will be used"),0===s.length)throw"ERROR: the given `parent` doesn't exists!";s=s[0]}return s.length>1&&s instanceof Element==!1&&(console.warn("WARNING: you have passed as parent a list of elements, the first one will be used"),s=s[0]),s.appendChild(r),r;function a(t,e){e.forEach(function(e){t.classList.add(e)})}function l(t,e){e.forEach(function(e){t.setAttribute(e.split(":")[0],e.split(":")[1]||"")})}},n.prototype._getPosition=function(e,n){l(n);return this._options.forceAbsolute?"absolute":function e(n){if(n===t.document.body)return!1;if("fixed"===a(n,"position"))return!0;return n.parentNode?e(n.parentNode):n}(n)?"fixed":"absolute"},n.prototype._getOffsets=function(t,e,n){n=n.split("-")[0];var r={};r.position=this.state.position;var o="fixed"===r.position,s=function(t,e,n){var i=p(t),r=p(e);if(n){var o=u(e);r.top+=o.scrollTop,r.bottom+=o.scrollTop,r.left+=o.scrollLeft,r.right+=o.scrollLeft}return{top:i.top-r.top,left:i.left-r.left,bottom:i.top-r.top+i.height,right:i.left-r.left+i.width,width:i.width,height:i.height}}(e,l(t),o),a=i(t);return-1!==["right","left"].indexOf(n)?(r.top=s.top+s.height/2-a.height/2,r.left="left"===n?s.left-a.width:s.right):(r.left=s.left+s.width/2-a.width/2,r.top="top"===n?s.top-a.height:s.bottom),r.width=a.width,r.height=a.height,{popper:r,reference:s}},n.prototype._setupEventListeners=function(){if(this.state.updateBound=this.update.bind(this),t.addEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement){var e=u(this._reference);e!==t.document.body&&e!==t.document.documentElement||(e=t),e.addEventListener("scroll",this.state.updateBound),this.state.scrollTarget=e}},n.prototype._removeEventListeners=function(){t.removeEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement&&this.state.scrollTarget&&(this.state.scrollTarget.removeEventListener("scroll",this.state.updateBound),this.state.scrollTarget=null),this.state.updateBound=null},n.prototype._getBoundaries=function(e,n,i){var r,o,s={};if("window"===i){var a=t.document.body,c=t.document.documentElement;r=Math.max(a.scrollHeight,a.offsetHeight,c.clientHeight,c.scrollHeight,c.offsetHeight),s={top:0,right:Math.max(a.scrollWidth,a.offsetWidth,c.clientWidth,c.scrollWidth,c.offsetWidth),bottom:r,left:0}}else if("viewport"===i){var p=l(this._popper),d=u(this._popper),f=h(p),g="fixed"===e.offsets.popper.position?0:(o=d)==document.body?Math.max(document.documentElement.scrollTop,document.body.scrollTop):o.scrollTop,m="fixed"===e.offsets.popper.position?0:function(t){return t==document.body?Math.max(document.documentElement.scrollLeft,document.body.scrollLeft):t.scrollLeft}(d);s={top:0-(f.top-g),right:t.document.documentElement.clientWidth-(f.left-m),bottom:t.document.documentElement.clientHeight-(f.top-g),left:0-(f.left-m)}}else s=l(this._popper)===i?{top:0,left:0,right:i.clientWidth,bottom:i.clientHeight}:h(i);return s.left+=n,s.right-=n,s.top=s.top+n,s.bottom=s.bottom-n,s},n.prototype.runModifiers=function(t,e,n){var i=e.slice();return void 0!==n&&(i=this._options.modifiers.slice(0,s(this._options.modifiers,n))),i.forEach(function(e){var n;(n=e)&&"[object Function]"==={}.toString.call(n)&&(t=e.call(this,t))}.bind(this)),t},n.prototype.isModifierRequired=function(t,e){var n=s(this._options.modifiers,t);return!!this._options.modifiers.slice(0,n).filter(function(t){return t===e}).length},n.prototype.modifiers={},n.prototype.modifiers.applyStyle=function(t){var e,n={position:t.offsets.popper.position},i=Math.round(t.offsets.popper.left),r=Math.round(t.offsets.popper.top);return this._options.gpuAcceleration&&(e=d("transform"))?(n[e]="translate3d("+i+"px, "+r+"px, 0)",n.top=0,n.left=0):(n.left=i,n.top=r),Object.assign(n,t.styles),c(this._popper,n),this._popper.setAttribute("x-placement",t.placement),this.isModifierRequired(this.modifiers.applyStyle,this.modifiers.arrow)&&t.offsets.arrow&&c(t.arrowElement,t.offsets.arrow),t},n.prototype.modifiers.shift=function(t){var e=t.placement,n=e.split("-")[0],i=e.split("-")[1];if(i){var r=t.offsets.reference,s=o(t.offsets.popper),a={y:{start:{top:r.top},end:{top:r.top+r.height-s.height}},x:{start:{left:r.left},end:{left:r.left+r.width-s.width}}},l=-1!==["bottom","top"].indexOf(n)?"x":"y";t.offsets.popper=Object.assign(s,a[l][i])}return t},n.prototype.modifiers.preventOverflow=function(t){var e=this._options.preventOverflowOrder,n=o(t.offsets.popper),i={left:function(){var e=n.left;return n.left<t.boundaries.left&&(e=Math.max(n.left,t.boundaries.left)),{left:e}},right:function(){var e=n.left;return n.right>t.boundaries.right&&(e=Math.min(n.left,t.boundaries.right-n.width)),{left:e}},top:function(){var e=n.top;return n.top<t.boundaries.top&&(e=Math.max(n.top,t.boundaries.top)),{top:e}},bottom:function(){var e=n.top;return n.bottom>t.boundaries.bottom&&(e=Math.min(n.top,t.boundaries.bottom-n.height)),{top:e}}};return e.forEach(function(e){t.offsets.popper=Object.assign(n,i[e]())}),t},n.prototype.modifiers.keepTogether=function(t){var e=o(t.offsets.popper),n=t.offsets.reference,i=Math.floor;return e.right<i(n.left)&&(t.offsets.popper.left=i(n.left)-e.width),e.left>i(n.right)&&(t.offsets.popper.left=i(n.right)),e.bottom<i(n.top)&&(t.offsets.popper.top=i(n.top)-e.height),e.top>i(n.bottom)&&(t.offsets.popper.top=i(n.bottom)),t},n.prototype.modifiers.flip=function(t){if(!this.isModifierRequired(this.modifiers.flip,this.modifiers.preventOverflow))return console.warn("WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!"),t;if(t.flipped&&t.placement===t._originalPlacement)return t;var e=t.placement.split("-")[0],n=r(e),i=t.placement.split("-")[1]||"",s=[];return(s="flip"===this._options.flipBehavior?[e,n]:this._options.flipBehavior).forEach(function(a,l){if(e===a&&s.length!==l+1){e=t.placement.split("-")[0],n=r(e);var u=o(t.offsets.popper),c=-1!==["right","bottom"].indexOf(e);(c&&Math.floor(t.offsets.reference[e])>Math.floor(u[n])||!c&&Math.floor(t.offsets.reference[e])<Math.floor(u[n]))&&(t.flipped=!0,t.placement=s[l+1],i&&(t.placement+="-"+i),t.offsets.popper=this._getOffsets(this._popper,this._reference,t.placement).popper,t=this.runModifiers(t,this._options.modifiers,this._flip))}}.bind(this)),t},n.prototype.modifiers.offset=function(t){var e=this._options.offset,n=t.offsets.popper;return-1!==t.placement.indexOf("left")?n.top-=e:-1!==t.placement.indexOf("right")?n.top+=e:-1!==t.placement.indexOf("top")?n.left-=e:-1!==t.placement.indexOf("bottom")&&(n.left+=e),t},n.prototype.modifiers.arrow=function(t){var e=this._options.arrowElement,n=this._options.arrowOffset;if("string"==typeof e&&(e=this._popper.querySelector(e)),!e)return t;if(!this._popper.contains(e))return console.warn("WARNING: `arrowElement` must be child of its popper element!"),t;if(!this.isModifierRequired(this.modifiers.arrow,this.modifiers.keepTogether))return console.warn("WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!"),t;var r={},s=t.placement.split("-")[0],a=o(t.offsets.popper),l=t.offsets.reference,u=-1!==["left","right"].indexOf(s),c=u?"height":"width",h=u?"top":"left",p=u?"left":"top",d=u?"bottom":"right",f=i(e)[c];l[d]-f<a[h]&&(t.offsets.popper[h]-=a[h]-(l[d]-f)),l[h]+f>a[d]&&(t.offsets.popper[h]+=l[h]+f-a[d]);var g=l[h]+(n||l[c]/2-f/2)-a[h];return g=Math.max(Math.min(a[c]-f-8,g),8),r[h]=g,r[p]="",t.offsets.arrow=r,t.arrowElement=e,t},Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i){i=Object(i);for(var r=Object.keys(i),o=0,s=r.length;o<s;o++){var a=r[o],l=Object.getOwnPropertyDescriptor(i,a);void 0!==l&&l.enumerable&&(e[a]=i[a])}}}return e}}),n})?i.call(e,n,e,t):i)||(t.exports=r)},"NWt+":function(t,e,n){var i=n("+ZMJ"),r=n("msXi"),o=n("Mhyx"),s=n("77Pl"),a=n("QRG4"),l=n("3fs2"),u={},c={};(e=t.exports=function(t,e,n,h,p){var d,f,g,m,v=p?function(){return t}:l(t),_=i(n,h,e?2:1),y=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(o(v)){for(d=a(t.length);d>y;y++)if((m=e?_(s(f=t[y])[0],f[1]):_(t[y]))===u||m===c)return m}else for(g=v.call(t);!(f=g.next()).done;)if((m=r(g,_,f.value,e))===u||m===c)return m}).BREAK=u,e.RETURN=c},NYxO:function(t,e,n){"use strict";(function(t){var n=("undefined"!=typeof window?window:void 0!==t?t:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function i(t,e){if(void 0===e&&(e=[]),null===t||"object"!=typeof t)return t;var n,r=(n=function(e){return e.original===t},e.filter(n)[0]);if(r)return r.copy;var o=Array.isArray(t)?[]:{};return e.push({original:t,copy:o}),Object.keys(t).forEach(function(n){o[n]=i(t[n],e)}),o}function r(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}function o(t){return null!==t&&"object"==typeof t}var s=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var n=t.state;this.state=("function"==typeof n?n():n)||{}},a={namespaced:{configurable:!0}};a.namespaced.get=function(){return!!this._rawModule.namespaced},s.prototype.addChild=function(t,e){this._children[t]=e},s.prototype.removeChild=function(t){delete this._children[t]},s.prototype.getChild=function(t){return this._children[t]},s.prototype.hasChild=function(t){return t in this._children},s.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},s.prototype.forEachChild=function(t){r(this._children,t)},s.prototype.forEachGetter=function(t){this._rawModule.getters&&r(this._rawModule.getters,t)},s.prototype.forEachAction=function(t){this._rawModule.actions&&r(this._rawModule.actions,t)},s.prototype.forEachMutation=function(t){this._rawModule.mutations&&r(this._rawModule.mutations,t)},Object.defineProperties(s.prototype,a);var l=function(t){this.register([],t,!1)};l.prototype.get=function(t){return t.reduce(function(t,e){return t.getChild(e)},this.root)},l.prototype.getNamespace=function(t){var e=this.root;return t.reduce(function(t,n){return t+((e=e.getChild(n)).namespaced?n+"/":"")},"")},l.prototype.update=function(t){!function t(e,n,i){0;n.update(i);if(i.modules)for(var r in i.modules){if(!n.getChild(r))return void 0;t(e.concat(r),n.getChild(r),i.modules[r])}}([],this.root,t)},l.prototype.register=function(t,e,n){var i=this;void 0===n&&(n=!0);var o=new s(e,n);0===t.length?this.root=o:this.get(t.slice(0,-1)).addChild(t[t.length-1],o);e.modules&&r(e.modules,function(e,r){i.register(t.concat(r),e,n)})},l.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1],i=e.getChild(n);i&&i.runtime&&e.removeChild(n)},l.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1];return!!e&&e.hasChild(n)};var u;var c=function(t){var e=this;void 0===t&&(t={}),!u&&"undefined"!=typeof window&&window.Vue&&_(window.Vue);var i=t.plugins;void 0===i&&(i=[]);var r=t.strict;void 0===r&&(r=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new l(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new u,this._makeLocalGettersCache=Object.create(null);var o=this,s=this.dispatch,a=this.commit;this.dispatch=function(t,e){return s.call(o,t,e)},this.commit=function(t,e,n){return a.call(o,t,e,n)},this.strict=r;var c=this._modules.root.state;g(this,c,[],this._modules.root),f(this,c),i.forEach(function(t){return t(e)}),(void 0!==t.devtools?t.devtools:u.config.devtools)&&function(t){n&&(t._devtoolHook=n,n.emit("vuex:init",t),n.on("vuex:travel-to-state",function(e){t.replaceState(e)}),t.subscribe(function(t,e){n.emit("vuex:mutation",t,e)},{prepend:!0}),t.subscribeAction(function(t,e){n.emit("vuex:action",t,e)},{prepend:!0}))}(this)},h={state:{configurable:!0}};function p(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function d(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;g(t,n,[],t._modules.root,!0),f(t,n,e)}function f(t,e,n){var i=t._vm;t.getters={},t._makeLocalGettersCache=Object.create(null);var o={};r(t._wrappedGetters,function(e,n){o[n]=function(t,e){return function(){return t(e)}}(e,t),Object.defineProperty(t.getters,n,{get:function(){return t._vm[n]},enumerable:!0})});var s=u.config.silent;u.config.silent=!0,t._vm=new u({data:{$$state:e},computed:o}),u.config.silent=s,t.strict&&function(t){t._vm.$watch(function(){return this._data.$$state},function(){0},{deep:!0,sync:!0})}(t),i&&(n&&t._withCommit(function(){i._data.$$state=null}),u.nextTick(function(){return i.$destroy()}))}function g(t,e,n,i,r){var o=!n.length,s=t._modules.getNamespace(n);if(i.namespaced&&(t._modulesNamespaceMap[s],t._modulesNamespaceMap[s]=i),!o&&!r){var a=m(e,n.slice(0,-1)),l=n[n.length-1];t._withCommit(function(){u.set(a,l,i.state)})}var c=i.context=function(t,e,n){var i=""===e,r={dispatch:i?t.dispatch:function(n,i,r){var o=v(n,i,r),s=o.payload,a=o.options,l=o.type;return a&&a.root||(l=e+l),t.dispatch(l,s)},commit:i?t.commit:function(n,i,r){var o=v(n,i,r),s=o.payload,a=o.options,l=o.type;a&&a.root||(l=e+l),t.commit(l,s,a)}};return Object.defineProperties(r,{getters:{get:i?function(){return t.getters}:function(){return function(t,e){if(!t._makeLocalGettersCache[e]){var n={},i=e.length;Object.keys(t.getters).forEach(function(r){if(r.slice(0,i)===e){var o=r.slice(i);Object.defineProperty(n,o,{get:function(){return t.getters[r]},enumerable:!0})}}),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}(t,e)}},state:{get:function(){return m(t.state,n)}}}),r}(t,s,n);i.forEachMutation(function(e,n){!function(t,e,n,i){(t._mutations[e]||(t._mutations[e]=[])).push(function(e){n.call(t,i.state,e)})}(t,s+n,e,c)}),i.forEachAction(function(e,n){var i=e.root?n:s+n,r=e.handler||e;!function(t,e,n,i){(t._actions[e]||(t._actions[e]=[])).push(function(e){var r,o=n.call(t,{dispatch:i.dispatch,commit:i.commit,getters:i.getters,state:i.state,rootGetters:t.getters,rootState:t.state},e);return(r=o)&&"function"==typeof r.then||(o=Promise.resolve(o)),t._devtoolHook?o.catch(function(e){throw t._devtoolHook.emit("vuex:error",e),e}):o})}(t,i,r,c)}),i.forEachGetter(function(e,n){!function(t,e,n,i){if(t._wrappedGetters[e])return void 0;t._wrappedGetters[e]=function(t){return n(i.state,i.getters,t.state,t.getters)}}(t,s+n,e,c)}),i.forEachChild(function(i,o){g(t,e,n.concat(o),i,r)})}function m(t,e){return e.reduce(function(t,e){return t[e]},t)}function v(t,e,n){return o(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}function _(t){u&&t===u||
  55. /*!
  56. * vuex v3.6.2
  57. * (c) 2021 Evan You
  58. * @license MIT
  59. */
  60. function(t){if(Number(t.version.split(".")[0])>=2)t.mixin({beforeCreate:n});else{var e=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,e.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"==typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}(u=t)}h.state.get=function(){return this._vm._data.$$state},h.state.set=function(t){0},c.prototype.commit=function(t,e,n){var i=this,r=v(t,e,n),o=r.type,s=r.payload,a=(r.options,{type:o,payload:s}),l=this._mutations[o];l&&(this._withCommit(function(){l.forEach(function(t){t(s)})}),this._subscribers.slice().forEach(function(t){return t(a,i.state)}))},c.prototype.dispatch=function(t,e){var n=this,i=v(t,e),r=i.type,o=i.payload,s={type:r,payload:o},a=this._actions[r];if(a){try{this._actionSubscribers.slice().filter(function(t){return t.before}).forEach(function(t){return t.before(s,n.state)})}catch(t){0}var l=a.length>1?Promise.all(a.map(function(t){return t(o)})):a[0](o);return new Promise(function(t,e){l.then(function(e){try{n._actionSubscribers.filter(function(t){return t.after}).forEach(function(t){return t.after(s,n.state)})}catch(t){0}t(e)},function(t){try{n._actionSubscribers.filter(function(t){return t.error}).forEach(function(e){return e.error(s,n.state,t)})}catch(t){0}e(t)})})}},c.prototype.subscribe=function(t,e){return p(t,this._subscribers,e)},c.prototype.subscribeAction=function(t,e){return p("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},c.prototype.watch=function(t,e,n){var i=this;return this._watcherVM.$watch(function(){return t(i.state,i.getters)},e,n)},c.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._vm._data.$$state=t})},c.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),"string"==typeof t&&(t=[t]),this._modules.register(t,e),g(this,this.state,t,this._modules.get(t),n.preserveState),f(this,this.state)},c.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){var n=m(e.state,t.slice(0,-1));u.delete(n,t[t.length-1])}),d(this)},c.prototype.hasModule=function(t){return"string"==typeof t&&(t=[t]),this._modules.isRegistered(t)},c.prototype.hotUpdate=function(t){this._modules.update(t),d(this,!0)},c.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(c.prototype,h);var y=S(function(t,e){var n={};return C(e).forEach(function(e){var i=e.key,r=e.val;n[i]=function(){var e=this.$store.state,n=this.$store.getters;if(t){var i=w(this.$store,"mapState",t);if(!i)return;e=i.context.state,n=i.context.getters}return"function"==typeof r?r.call(this,e,n):e[r]},n[i].vuex=!0}),n}),b=S(function(t,e){var n={};return C(e).forEach(function(e){var i=e.key,r=e.val;n[i]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var i=this.$store.commit;if(t){var o=w(this.$store,"mapMutations",t);if(!o)return;i=o.context.commit}return"function"==typeof r?r.apply(this,[i].concat(e)):i.apply(this.$store,[r].concat(e))}}),n}),T=S(function(t,e){var n={};return C(e).forEach(function(e){var i=e.key,r=e.val;r=t+r,n[i]=function(){if(!t||w(this.$store,"mapGetters",t))return this.$store.getters[r]},n[i].vuex=!0}),n}),E=S(function(t,e){var n={};return C(e).forEach(function(e){var i=e.key,r=e.val;n[i]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var i=this.$store.dispatch;if(t){var o=w(this.$store,"mapActions",t);if(!o)return;i=o.context.dispatch}return"function"==typeof r?r.apply(this,[i].concat(e)):i.apply(this.$store,[r].concat(e))}}),n});function C(t){return function(t){return Array.isArray(t)||o(t)}(t)?Array.isArray(t)?t.map(function(t){return{key:t,val:t}}):Object.keys(t).map(function(e){return{key:e,val:t[e]}}):[]}function S(t){return function(e,n){return"string"!=typeof e?(n=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,n)}}function w(t,e,n){return t._modulesNamespaceMap[n]}function k(t,e,n){var i=n?t.groupCollapsed:t.group;try{i.call(t,e)}catch(n){t.log(e)}}function x(t){try{t.groupEnd()}catch(e){t.log("—— log end ——")}}function I(){var t=new Date;return" @ "+R(t.getHours(),2)+":"+R(t.getMinutes(),2)+":"+R(t.getSeconds(),2)+"."+R(t.getMilliseconds(),3)}function R(t,e){return n="0",i=e-t.toString().length,new Array(i+1).join(n)+t;var n,i}var O={Store:c,install:_,version:"3.6.2",mapState:y,mapMutations:b,mapGetters:T,mapActions:E,createNamespacedHelpers:function(t){return{mapState:y.bind(null,t),mapGetters:T.bind(null,t),mapMutations:b.bind(null,t),mapActions:E.bind(null,t)}},createLogger:function(t){void 0===t&&(t={});var e=t.collapsed;void 0===e&&(e=!0);var n=t.filter;void 0===n&&(n=function(t,e,n){return!0});var r=t.transformer;void 0===r&&(r=function(t){return t});var o=t.mutationTransformer;void 0===o&&(o=function(t){return t});var s=t.actionFilter;void 0===s&&(s=function(t,e){return!0});var a=t.actionTransformer;void 0===a&&(a=function(t){return t});var l=t.logMutations;void 0===l&&(l=!0);var u=t.logActions;void 0===u&&(u=!0);var c=t.logger;return void 0===c&&(c=console),function(t){var h=i(t.state);void 0!==c&&(l&&t.subscribe(function(t,s){var a=i(s);if(n(t,h,a)){var l=I(),u=o(t),p="mutation "+t.type+l;k(c,p,e),c.log("%c prev state","color: #9E9E9E; font-weight: bold",r(h)),c.log("%c mutation","color: #03A9F4; font-weight: bold",u),c.log("%c next state","color: #4CAF50; font-weight: bold",r(a)),x(c)}h=a}),u&&t.subscribeAction(function(t,n){if(s(t,n)){var i=I(),r=a(t),o="action "+t.type+i;k(c,o,e),c.log("%c action","color: #03A9F4; font-weight: bold",r),x(c)}}))}}};e.a=O}).call(e,n("DuR2"))},NpIQ:function(t,e){e.f={}.propertyIsEnumerable},O4g8:function(t,e){t.exports=!0},OAzY:function(t,e,n){"use strict";e.__esModule=!0;var i,r=n("7+uW"),o=(i=r)&&i.__esModule?i:{default:i},s=n("2kvA");var a=!1,l=!1,u=void 0,c=function(){if(!o.default.prototype.$isServer){var t=p.modalDom;return t?a=!0:(a=!1,t=document.createElement("div"),p.modalDom=t,t.addEventListener("touchmove",function(t){t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",function(){p.doOnModalClick&&p.doOnModalClick()})),t}},h={},p={modalFade:!0,getInstance:function(t){return h[t]},register:function(t,e){t&&e&&(h[t]=e)},deregister:function(t){t&&(h[t]=null,delete h[t])},nextZIndex:function(){return p.zIndex++},modalStack:[],doOnModalClick:function(){var t=p.modalStack[p.modalStack.length-1];if(t){var e=p.getInstance(t.id);e&&e.closeOnClickModal&&e.close()}},openModal:function(t,e,n,i,r){if(!o.default.prototype.$isServer&&t&&void 0!==e){this.modalFade=r;for(var l=this.modalStack,u=0,h=l.length;u<h;u++){if(l[u].id===t)return}var p=c();if((0,s.addClass)(p,"v-modal"),this.modalFade&&!a&&(0,s.addClass)(p,"v-modal-enter"),i)i.trim().split(/\s+/).forEach(function(t){return(0,s.addClass)(p,t)});setTimeout(function(){(0,s.removeClass)(p,"v-modal-enter")},200),n&&n.parentNode&&11!==n.parentNode.nodeType?n.parentNode.appendChild(p):document.body.appendChild(p),e&&(p.style.zIndex=e),p.tabIndex=0,p.style.display="",this.modalStack.push({id:t,zIndex:e,modalClass:i})}},closeModal:function(t){var e=this.modalStack,n=c();if(e.length>0){var i=e[e.length-1];if(i.id===t){if(i.modalClass)i.modalClass.trim().split(/\s+/).forEach(function(t){return(0,s.removeClass)(n,t)});e.pop(),e.length>0&&(n.style.zIndex=e[e.length-1].zIndex)}else for(var r=e.length-1;r>=0;r--)if(e[r].id===t){e.splice(r,1);break}}0===e.length&&(this.modalFade&&(0,s.addClass)(n,"v-modal-leave"),setTimeout(function(){0===e.length&&(n.parentNode&&n.parentNode.removeChild(n),n.style.display="none",p.modalDom=void 0),(0,s.removeClass)(n,"v-modal-leave")},200))}};Object.defineProperty(p,"zIndex",{configurable:!0,get:function(){return l||(u=u||(o.default.prototype.$ELEMENT||{}).zIndex||2e3,l=!0),u},set:function(t){u=t}});o.default.prototype.$isServer||window.addEventListener("keydown",function(t){if(27===t.keyCode){var e=function(){if(!o.default.prototype.$isServer&&p.modalStack.length>0){var t=p.modalStack[p.modalStack.length-1];if(!t)return;return p.getInstance(t.id)}}();e&&e.closeOnPressEscape&&(e.handleClose?e.handleClose():e.handleAction?e.handleAction("cancel"):e.close())}}),e.default=p},ON07:function(t,e,n){var i=n("EqjI"),r=n("7KvD").document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},ON3O:function(t,e,n){var i=n("uY1a");t.exports=function(t,e,n){return void 0===n?i(t,e,!1):i(t,n,!1!==e)}},OYls:function(t,e,n){n("crlp")("asyncIterator")},"Oi+a":function(t,e,n){"use strict";var i=n("dIwP"),r=n("qRfI");t.exports=function(t,e){return t&&!i(e)?r(t,e):e}},PzxK:function(t,e,n){var i=n("D2L2"),r=n("sB3e"),o=n("ax3d")("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),i(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},QRG4:function(t,e,n){var i=n("UuGF"),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},QUGb:function(t,e,n){var i,r,o,s;s=function(t){"use strict";return t.Blocks.colour={},t.Constants={},t.Constants.Colour={},t.Constants.Colour.HUE=20,t.defineBlocksWithJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]),t.Constants.Lists={},t.Constants.Lists.HUE=260,t.defineBlocksWithJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]),t.Blocks.lists_create_with={init:function(){this.setHelpUrl(t.Msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new t.Mutator(["lists_create_with_item"])),this.setTooltip(t.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("lists_create_with_container");e.initSvg();for(var n=e.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=t.newBlock("lists_create_with_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return e},compose:function(e){var n=e.getInputTargetBlock("STACK");for(e=[];n&&!n.isInsertionMarker();)e.push(n.valueConnection_),n=n.nextConnection&&n.nextConnection.targetBlock();for(n=0;n<this.itemCount_;n++){var i=this.getInput("ADD"+n).connection.targetConnection;i&&-1==e.indexOf(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),n=0;n<this.itemCount_;n++)t.Mutator.reconnect(e[n],this,"ADD"+n)},saveConnections:function(t){t=t.getInputTargetBlock("STACK");for(var e=0;t;){var n=this.getInput("ADD"+e);t.valueConnection_=n&&n.connection.targetConnection,e++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(t.Msg.LISTS_CREATE_EMPTY_TITLE);for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){var n=this.appendValueInput("ADD"+e).setAlign(t.ALIGN_RIGHT);0==e&&n.appendField(t.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++}},t.Blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(t.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},t.Blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},t.Blocks.lists_indexOf={init:function(){var e=[[t.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[t.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(t.Msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg.LISTS_INDEX_OF_INPUT_IN_LIST),this.appendValueInput("FIND").appendField(new t.FieldDropdown(e),"END"),this.setInputsInline(!0);var n=this;this.setTooltip(function(){return t.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",n.workspace.options.oneBasedIndex?"0":"-1")})}},t.Blocks.lists_getIndex={init:function(){var e=[[t.Msg.LISTS_GET_INDEX_GET,"GET"],[t.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[t.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[t.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),e=new t.FieldDropdown(e,function(t){t="REMOVE"==t,this.getSourceBlock().updateStatement_(t)}),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),t.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0);var n=this;this.setTooltip(function(){var e=n.getFieldValue("MODE"),i=n.getFieldValue("WHERE"),r="";switch(e+" "+i){case"GET FROM_START":case"GET FROM_END":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":r=t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return"FROM_START"!=i&&"FROM_END"!=i||(r+=" "+("FROM_START"==i?t.Msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",n.workspace.options.oneBasedIndex?"#1":"#0")),r})},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");e.setAttribute("statement",!this.outputConnection);var n=this.getInput("AT").type==t.INPUT_VALUE;return e.setAttribute("at",n),e},domToMutation:function(t){var e="true"==t.getAttribute("statement");this.updateStatement_(e),t="false"!=t.getAttribute("at"),this.updateAt_(t)},updateStatement_:function(t){t!=!this.outputConnection&&(this.unplug(!0,!0),t?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var n=new t.FieldDropdown(this.WHERE_OPTIONS,function(t){var n="FROM_START"==t||"FROM_END"==t;if(n!=e){var i=this.getSourceBlock();return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}});this.getInput("AT").appendField(n,"WHERE"),t.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},t.Blocks.lists_setIndex={init:function(){var e=[[t.Msg.LISTS_SET_INDEX_SET,"SET"],[t.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[t.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg.LISTS_SET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(new t.FieldDropdown(e),"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(t.Msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0);var n=this;this.setTooltip(function(){var e=n.getFieldValue("MODE"),i=n.getFieldValue("WHERE"),r="";switch(e+" "+i){case"SET FROM_START":case"SET FROM_END":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":r=t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return"FROM_START"!=i&&"FROM_END"!=i||(r+=" "+t.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",n.workspace.options.oneBasedIndex?"#1":"#0")),r})},mutationToDom:function(){var e=t.utils.xml.createElement("mutation"),n=this.getInput("AT").type==t.INPUT_VALUE;return e.setAttribute("at",n),e},domToMutation:function(t){t="false"!=t.getAttribute("at"),this.updateAt_(t)},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var n=new t.FieldDropdown(this.WHERE_OPTIONS,function(t){var n="FROM_START"==t||"FROM_END"==t;if(n!=e){var i=this.getSourceBlock();return i.updateAt_(n),i.setFieldValue(t,"WHERE"),null}});this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(n,"WHERE")}},t.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[t.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[t.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[t.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[t.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[t.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(t.Msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),t.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=t.utils.xml.createElement("mutation"),n=this.getInput("AT1").type==t.INPUT_VALUE;return e.setAttribute("at1",n),n=this.getInput("AT2").type==t.INPUT_VALUE,e.setAttribute("at2",n),e},domToMutation:function(t){var e="true"==t.getAttribute("at1");t="true"==t.getAttribute("at2"),this.updateAt_(1,e),this.updateAt_(2,t)},updateAt_:function(e,n){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),n?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e);var i=new t.FieldDropdown(this["WHERE_OPTIONS_"+e],function(t){var i="FROM_START"==t||"FROM_END"==t;if(i!=n){var r=this.getSourceBlock();return r.updateAt_(e,i),r.setFieldValue(t,"WHERE"+e),null}});this.getInput("AT"+e).appendField(i,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),t.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},t.Blocks.lists_sort={init:function(){this.jsonInit({message0:t.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[t.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[t.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[t.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[t.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[t.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:t.Msg.LISTS_SORT_TOOLTIP,helpUrl:t.Msg.LISTS_SORT_HELPURL})}},t.Blocks.lists_split={init:function(){var e=this,n=new t.FieldDropdown([[t.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[t.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(t){e.updateType_(t)});this.setHelpUrl(t.Msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(n,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(t.Msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(function(){var n=e.getFieldValue("MODE");if("SPLIT"==n)return t.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==n)return t.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+n)})},updateType_:function(t){if(this.getFieldValue("MODE")!=t){var e=this.getInput("INPUT").connection;e.setShadowDom(null);var n=e.targetBlock();n&&(e.disconnect(),n.isShadow()?n.dispose():this.bumpNeighbours())}"SPLIT"==t?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("mode",this.getFieldValue("MODE")),e},domToMutation:function(t){this.updateType_(t.getAttribute("mode"))}},t.Blocks.logic={},t.Constants.Logic={},t.Constants.Logic.HUE=210,t.defineBlocksWithJsonArray([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["‏<","LT"],["‏≤","LTE"],["‏>","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]),t.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),t.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"},t.Extensions.register("logic_op_tooltip",t.Extensions.buildTooltipForDropdown("OP",t.Constants.Logic.TOOLTIPS_BY_OP)),t.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,suppressPrefixSuffix:!0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=t.utils.xml.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(t){this.elseifCount_=parseInt(t.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(t.getAttribute("else"),10)||0,this.rebuildShape_()},decompose:function(t){var e=t.newBlock("controls_if_if");e.initSvg();for(var n=e.nextConnection,i=1;i<=this.elseifCount_;i++){var r=t.newBlock("controls_if_elseif");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return this.elseCount_&&((t=t.newBlock("controls_if_else")).initSvg(),n.connect(t.previousConnection)),e},compose:function(t){t=t.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;for(var e=[null],n=[null],i=null;t&&!t.isInsertionMarker();){switch(t.type){case"controls_if_elseif":this.elseifCount_++,e.push(t.valueConnection_),n.push(t.statementConnection_);break;case"controls_if_else":this.elseCount_++,i=t.statementConnection_;break;default:throw TypeError("Unknown block type: "+t.type)}t=t.nextConnection&&t.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(e,n,i)},saveConnections:function(t){t=t.nextConnection.targetBlock();for(var e=1;t;){switch(t.type){case"controls_if_elseif":var n=this.getInput("IF"+e),i=this.getInput("DO"+e);t.valueConnection_=n&&n.connection.targetConnection,t.statementConnection_=i&&i.connection.targetConnection,e++;break;case"controls_if_else":i=this.getInput("ELSE"),t.statementConnection_=i&&i.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+t.type)}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var t=[null],e=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var i=1;this.getInput("IF"+i);){var r=this.getInput("IF"+i),o=this.getInput("DO"+i);t.push(r.connection.targetConnection),e.push(o.connection.targetConnection),i++}this.updateShape_(),this.reconnectChildBlocks_(t,e,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(t.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(t.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(t.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,n,i){for(var r=1;r<=this.elseifCount_;r++)t.Mutator.reconnect(e[r],this,"IF"+r),t.Mutator.reconnect(n[r],this,"DO"+r);t.Mutator.reconnect(i,this,"ELSE")}},t.Extensions.registerMutator("controls_if_mutator",t.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]),t.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_4:"":t.Msg.CONTROLS_IF_TOOLTIP_1}.bind(this))},t.Extensions.register("controls_if_tooltip",t.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION),t.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var n=this.getInputTargetBlock("A"),i=this.getInputTargetBlock("B");n&&i&&!this.workspace.connectionChecker.doTypeChecks(n.outputConnection,i.outputConnection)&&(t.Events.setGroup(e.group),(e=this.prevBlocks_[0])!==n&&(n.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(n=this.prevBlocks_[1])!==i&&(i.unplug(),!n||n.isDisposed()||n.isShadow()||this.getInput("B").connection.connect(n.outputConnection)),this.bumpNeighbours(),t.Events.setGroup(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},t.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(t.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)},t.Extensions.register("logic_compare",t.Constants.Logic.LOGIC_COMPARE_EXTENSION),t.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(e){var n=this.getInputTargetBlock("THEN"),i=this.getInputTargetBlock("ELSE"),r=this.outputConnection.targetConnection;if((n||i)&&r)for(var o=0;2>o;o++){var s=1==o?n:i;s&&!s.workspace.connectionChecker.doTypeChecks(s.outputConnection,r)&&(t.Events.setGroup(e.group),r===this.prevParentConnection_?(this.unplug(),r.getSourceBlock().bumpNeighbours()):(s.unplug(),s.bumpNeighbours()),t.Events.setGroup(!1))}this.prevParentConnection_=r}},t.Extensions.registerMixin("logic_ternary",t.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN),t.Blocks.loops={},t.Constants.Loops={},t.Constants.Loops.HUE=120,t.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),t.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"},t.Extensions.register("controls_whileUntil_tooltip",t.Extensions.buildTooltipForDropdown("MODE",t.Constants.Loops.WHILE_UNTIL_TOOLTIPS)),t.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"},t.Extensions.register("controls_flow_tooltip",t.Extensions.buildTooltipForDropdown("FLOW",t.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)),t.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(e){if(!this.isInFlyout){var n=this.getField("VAR").getVariable(),i=n.name;if(!this.isCollapsed()&&null!=i){var r={enabled:!0};r.text=t.Msg.VARIABLES_SET_CREATE_GET.replace("%1",i),n=t.Variables.generateVariableFieldDom(n),(i=t.utils.xml.createElement("block")).setAttribute("type","variables_get"),i.appendChild(n),r.callback=t.ContextMenu.callbackFactory(this,i),e.push(r)}}}},t.Extensions.registerMixin("contextMenu_newGetVariableBlock",t.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN),t.Extensions.register("controls_for_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),t.Extensions.register("controls_forEach_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")),t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(e){do{if(-1!=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(e.type))return e;e=e.getSurroundParent()}while(e);return null},onchange:function(e){if(this.workspace.isDragging&&!this.workspace.isDragging()&&e.type==t.Events.BLOCK_MOVE){var n=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this);if(this.setWarningText(n?null:t.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout){var i=t.Events.getGroup();t.Events.setGroup(e.group),this.setEnabled(n),t.Events.setGroup(i)}}}},t.Extensions.registerMixin("controls_flow_in_loop_check",t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN),t.Blocks.math={},t.Constants.Math={},t.Constants.Math.HUE=230,t.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),t.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"},t.Extensions.register("math_op_tooltip",t.Extensions.buildTooltipForDropdown("OP",t.Constants.Math.TOOLTIPS_BY_OP)),t.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var e=t.utils.xml.createElement("mutation"),n="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",n),e},domToMutation:function(t){t="true"==t.getAttribute("divisor_input"),this.updateShape_(t)},updateShape_:function(t){var e=this.getInput("DIVISOR");t?e||this.appendValueInput("DIVISOR").setCheck("Number"):e&&this.removeInput("DIVISOR")}},t.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(t){t="DIVISIBLE_BY"==t,this.getSourceBlock().updateShape_(t)})},t.Extensions.registerMutator("math_is_divisibleby_mutator",t.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,t.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION),t.Extensions.register("math_change_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),t.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(t){"MODE"==t?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(t){this.updateType_(t.getAttribute("op"))}},t.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(t){this.updateType_(t)}.bind(this))},t.Extensions.registerMutator("math_modes_of_list_mutator",t.Constants.Math.LIST_MODES_MUTATOR_MIXIN,t.Constants.Math.LIST_MODES_MUTATOR_EXTENSION),t.Blocks.procedures={},t.Blocks.procedures_defnoreturn={init:function(){var e=t.Procedures.findLegalName("",this);(e=new t.FieldTextInput(e,t.Procedures.rename)).setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new t.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(t.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(t.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(t.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){var e="";this.arguments_.length&&(e=t.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),t.Events.disable();try{this.setFieldValue(e,"PARAMS")}finally{t.Events.enable()}},mutationToDom:function(e){var n=t.utils.xml.createElement("mutation");e&&n.setAttribute("name",this.getFieldValue("NAME"));for(var i=0;i<this.argumentVarModels_.length;i++){var r=t.utils.xml.createElement("arg"),o=this.argumentVarModels_[i];r.setAttribute("name",o.name),r.setAttribute("varid",o.getId()),e&&this.paramIds_&&r.setAttribute("paramId",this.paramIds_[i]),n.appendChild(r)}return this.hasStatements_||n.setAttribute("statements","false"),n},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(var n,i=0;n=e.childNodes[i];i++)if("arg"==n.nodeName.toLowerCase()){var r=n.getAttribute("name");n=n.getAttribute("varid")||n.getAttribute("varId"),this.arguments_.push(r),null!=(n=t.Variables.getOrCreateVariablePackage(this.workspace,n,r,""))?this.argumentVarModels_.push(n):console.log("Failed to create a variable with name "+r+", ignoring.")}this.updateParams_(),t.Procedures.mutateCallers(this),this.setStatements_("false"!==e.getAttribute("statements"))},decompose:function(e){var n=t.utils.xml.createElement("block");n.setAttribute("type","procedures_mutatorcontainer");var i=t.utils.xml.createElement("statement");i.setAttribute("name","STACK"),n.appendChild(i);for(var r=0;r<this.arguments_.length;r++){var o=t.utils.xml.createElement("block");o.setAttribute("type","procedures_mutatorarg");var s=t.utils.xml.createElement("field");s.setAttribute("name","NAME");var a=t.utils.xml.createTextNode(this.arguments_[r]);s.appendChild(a),o.appendChild(s),s=t.utils.xml.createElement("next"),o.appendChild(s),i.appendChild(o),i=s}return e=t.Xml.domToBlock(n,e),"procedures_defreturn"==this.type?e.setFieldValue(this.hasStatements_,"STATEMENTS"):e.removeInput("STATEMENT_INPUT"),t.Procedures.mutateCallers(this),e},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];for(var n=e.getInputTargetBlock("STACK");n&&!n.isInsertionMarker();){var i=n.getFieldValue("NAME");this.arguments_.push(i),i=this.workspace.getVariable(i,""),this.argumentVarModels_.push(i),this.paramIds_.push(n.id),n=n.nextConnection&&n.nextConnection.targetBlock()}this.updateParams_(),t.Procedures.mutateCallers(this),null!==(e=e.getFieldValue("STATEMENTS"))&&(e="TRUE"==e,this.hasStatements_!=e)&&(e?(this.setStatements_(!0),t.Mutator.reconnect(this.statementConnection_,this,"STACK"),this.statementConnection_=null):(e=this.getInput("STACK").connection,(this.statementConnection_=e.targetConnection)&&((e=e.targetBlock()).unplug(),e.bumpNeighbours()),this.setStatements_(!1)))},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,n){var i=this.workspace.getVariableById(e);if(""==i.type){i=i.name,n=this.workspace.getVariableById(n);for(var r=!1,o=0;o<this.argumentVarModels_.length;o++)this.argumentVarModels_[o].getId()==e&&(this.arguments_[o]=n.name,this.argumentVarModels_[o]=n,r=!0);r&&(this.displayRenamedVar_(i,n.name),t.Procedures.mutateCallers(this))}},updateVarName:function(e){for(var n=e.name,i=!1,r=0;r<this.argumentVarModels_.length;r++)if(this.argumentVarModels_[r].getId()==e.getId()){var o=this.arguments_[r];this.arguments_[r]=n,i=!0}i&&(this.displayRenamedVar_(o,n),t.Procedures.mutateCallers(this))},displayRenamedVar_:function(e,n){if(this.updateParams_(),this.mutator&&this.mutator.isVisible())for(var i,r=this.mutator.workspace_.getAllBlocks(!1),o=0;i=r[o];o++)"procedures_mutatorarg"==i.type&&t.Names.equals(e,i.getFieldValue("NAME"))&&i.setFieldValue(n,"NAME")},customContextMenu:function(e){if(!this.isInFlyout){var n={enabled:!0},i=this.getFieldValue("NAME");n.text=t.Msg.PROCEDURES_CREATE_DO.replace("%1",i);var r=t.utils.xml.createElement("mutation");for(r.setAttribute("name",i),i=0;i<this.arguments_.length;i++){var o=t.utils.xml.createElement("arg");o.setAttribute("name",this.arguments_[i]),r.appendChild(o)}if((i=t.utils.xml.createElement("block")).setAttribute("type",this.callType_),i.appendChild(r),n.callback=t.ContextMenu.callbackFactory(this,i),e.push(n),!this.isCollapsed())for(i=0;i<this.argumentVarModels_.length;i++)n={enabled:!0},r=this.argumentVarModels_[i],n.text=t.Msg.VARIABLES_SET_CREATE_GET.replace("%1",r.name),r=t.Variables.generateVariableFieldDom(r),(o=t.utils.xml.createElement("block")).setAttribute("type","variables_get"),o.appendChild(r),n.callback=t.ContextMenu.callbackFactory(this,o),e.push(n)}},callType_:"procedures_callnoreturn"},t.Blocks.procedures_defreturn={init:function(){var e=t.Procedures.findLegalName("",this);(e=new t.FieldTextInput(e,t.Procedures.rename)).setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg.PROCEDURES_DEFRETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(t.ALIGN_RIGHT).appendField(t.Msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new t.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(t.Msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(t.Msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:t.Blocks.procedures_defnoreturn.setStatements_,updateParams_:t.Blocks.procedures_defnoreturn.updateParams_,mutationToDom:t.Blocks.procedures_defnoreturn.mutationToDom,domToMutation:t.Blocks.procedures_defnoreturn.domToMutation,decompose:t.Blocks.procedures_defnoreturn.decompose,compose:t.Blocks.procedures_defnoreturn.compose,getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},getVars:t.Blocks.procedures_defnoreturn.getVars,getVarModels:t.Blocks.procedures_defnoreturn.getVarModels,renameVarById:t.Blocks.procedures_defnoreturn.renameVarById,updateVarName:t.Blocks.procedures_defnoreturn.updateVarName,displayRenamedVar_:t.Blocks.procedures_defnoreturn.displayRenamedVar_,customContextMenu:t.Blocks.procedures_defnoreturn.customContextMenu,callType_:"procedures_callreturn"},t.Blocks.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(t.Msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(t.Msg.PROCEDURES_ALLOW_STATEMENTS).appendField(new t.FieldCheckbox("TRUE"),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}},t.Blocks.procedures_mutatorarg={init:function(){var e=new t.FieldTextInput(t.Procedures.DEFAULT_ARG,this.validator_);e.oldShowEditorFn_=e.showEditor_,e.showEditor_=function(){this.createdVariables_=[],this.oldShowEditorFn_()},this.appendDummyInput().appendField(t.Msg.PROCEDURES_MUTATORARG_TITLE).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1,e.onFinishEditing_=this.deleteIntermediateVars_,e.createdVariables_=[],e.onFinishEditing_("x")},validator_:function(e){var n=this.getSourceBlock(),i=t.Mutator.findParentWs(n.workspace);if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;for(var r=(n.workspace.targetWorkspace||n.workspace).getAllBlocks(!1),o=e.toLowerCase(),s=0;s<r.length;s++)if(r[s].id!=this.getSourceBlock().id){var a=r[s].getFieldValue("NAME");if(a&&a.toLowerCase()==o)return null}return n.isInFlyout?e:((n=i.getVariable(e,""))&&n.name!=e&&i.renameVariableById(n.getId(),e),n||(n=i.createVariable(e,""))&&this.createdVariables_&&this.createdVariables_.push(n),e)},deleteIntermediateVars_:function(e){var n=t.Mutator.findParentWs(this.getSourceBlock().workspace);if(n)for(var i=0;i<this.createdVariables_.length;i++){var r=this.createdVariables_[i];r.name!=e&&n.deleteVariableById(r.getId())}}},t.Blocks.procedures_callnoreturn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,n){t.Names.equals(e,this.getProcedureCall())&&(this.setFieldValue(n,"NAME"),this.setTooltip((this.outputConnection?t.Msg.PROCEDURES_CALLRETURN_TOOLTIP:t.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",n)))},setProcedureParameters_:function(e,n){var i=t.Procedures.getDefinition(this.getProcedureCall(),this.workspace),r=i&&i.mutator&&i.mutator.isVisible();if(r||(this.quarkConnections_={},this.quarkIds_=null),n)if(e.join("\n")==this.arguments_.join("\n"))this.quarkIds_=n;else{if(n.length!=e.length)throw RangeError("paramNames and paramIds must be the same length.");this.setCollapsed(!1),this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]),i=this.rendered,this.rendered=!1;for(var o=0;o<this.arguments_.length;o++){var s=this.getInput("ARG"+o);s&&(s=s.connection.targetConnection,this.quarkConnections_[this.quarkIds_[o]]=s,r&&s&&-1==n.indexOf(this.quarkIds_[o])&&(s.disconnect(),s.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(e),this.argumentVarModels_=[],o=0;o<this.arguments_.length;o++)e=t.Variables.getOrCreateVariablePackage(this.workspace,null,this.arguments_[o],""),this.argumentVarModels_.push(e);if(this.updateShape_(),this.quarkIds_=n)for(o=0;o<this.arguments_.length;o++)(n=this.quarkIds_[o])in this.quarkConnections_&&(s=this.quarkConnections_[n],t.Mutator.reconnect(s,this,"ARG"+o)||delete this.quarkConnections_[n]);(this.rendered=i)&&this.render()}},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var n=this.getField("ARGNAME"+e);if(n){t.Events.disable();try{n.setValue(this.arguments_[e])}finally{t.Events.enable()}}else n=new t.FieldLabel(this.arguments_[e]),this.appendValueInput("ARG"+e).setAlign(t.ALIGN_RIGHT).appendField(n,"ARGNAME"+e).init()}for(;this.getInput("ARG"+e);)this.removeInput("ARG"+e),e++;(e=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||(e.appendField(t.Msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"),e.init()):this.getField("WITH")&&e.removeField("WITH"))},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");e.setAttribute("name",this.getProcedureCall());for(var n=0;n<this.arguments_.length;n++){var i=t.utils.xml.createElement("arg");i.setAttribute("name",this.arguments_[n]),e.appendChild(i)}return e},domToMutation:function(t){var e=t.getAttribute("name");this.renameProcedure(this.getProcedureCall(),e),e=[];for(var n,i=[],r=0;n=t.childNodes[r];r++)"arg"==n.nodeName.toLowerCase()&&(e.push(n.getAttribute("name")),i.push(n.getAttribute("paramId")));this.setProcedureParameters_(e,i)},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(e){if(this.workspace&&!this.workspace.isFlyout&&e.recordUndo)if(e.type==t.Events.BLOCK_CREATE&&-1!=e.ids.indexOf(this.id)){var n=this.getProcedureCall();if(!(n=t.Procedures.getDefinition(n,this.workspace))||n.type==this.defType_&&JSON.stringify(n.getVars())==JSON.stringify(this.arguments_)||(n=null),!n){t.Events.setGroup(e.group),e=t.utils.xml.createElement("xml"),(n=t.utils.xml.createElement("block")).setAttribute("type",this.defType_);var i=this.getRelativeToSurfaceXY(),r=i.y+2*t.SNAP_RADIUS;n.setAttribute("x",i.x+t.SNAP_RADIUS*(this.RTL?-1:1)),n.setAttribute("y",r),i=this.mutationToDom(),n.appendChild(i),(i=t.utils.xml.createElement("field")).setAttribute("name","NAME"),(r=this.getProcedureCall())||(r=t.Procedures.findLegalName("",this),this.renameProcedure("",r)),i.appendChild(t.utils.xml.createTextNode(r)),n.appendChild(i),e.appendChild(n),t.Xml.domToWorkspace(e,this.workspace),t.Events.setGroup(!1)}}else e.type==t.Events.BLOCK_DELETE?(n=this.getProcedureCall(),(n=t.Procedures.getDefinition(n,this.workspace))||(t.Events.setGroup(e.group),this.dispose(!0),t.Events.setGroup(!1))):e.type==t.Events.CHANGE&&"disabled"==e.element&&(n=this.getProcedureCall(),(n=t.Procedures.getDefinition(n,this.workspace))&&n.id==e.blockId&&((n=t.Events.getGroup())&&console.log("Saw an existing group while responding to a definition change"),t.Events.setGroup(e.group),e.newValue?(this.previousEnabledState_=this.isEnabled(),this.setEnabled(!1)):this.setEnabled(this.previousEnabledState_),t.Events.setGroup(n)))},customContextMenu:function(e){if(this.workspace.isMovable()){var n={enabled:!0};n.text=t.Msg.PROCEDURES_HIGHLIGHT_DEF;var i=this.getProcedureCall(),r=this.workspace;n.callback=function(){var e=t.Procedures.getDefinition(i,r);e&&(r.centerOnBlock(e.id),e.select())},e.push(n)}},defType_:"procedures_defnoreturn"},t.Blocks.procedures_callreturn={init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null,this.previousEnabledState_=!0},getProcedureCall:t.Blocks.procedures_callnoreturn.getProcedureCall,renameProcedure:t.Blocks.procedures_callnoreturn.renameProcedure,setProcedureParameters_:t.Blocks.procedures_callnoreturn.setProcedureParameters_,updateShape_:t.Blocks.procedures_callnoreturn.updateShape_,mutationToDom:t.Blocks.procedures_callnoreturn.mutationToDom,domToMutation:t.Blocks.procedures_callnoreturn.domToMutation,getVars:t.Blocks.procedures_callnoreturn.getVars,getVarModels:t.Blocks.procedures_callnoreturn.getVarModels,onchange:t.Blocks.procedures_callnoreturn.onchange,customContextMenu:t.Blocks.procedures_callnoreturn.customContextMenu,defType_:"procedures_defreturn"},t.Blocks.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(t.Msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(t.Msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(t.Msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("value",Number(this.hasReturnValue_)),e},domToMutation:function(e){this.hasReturnValue_=1==e.getAttribute("value"),this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(e){if(this.workspace.isDragging&&!this.workspace.isDragging()){e=!1;var n=this;do{if(-1!=this.FUNCTION_TYPES.indexOf(n.type)){e=!0;break}n=n.getSurroundParent()}while(n);e?("procedures_defnoreturn"==n.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!=n.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(t.Msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(t.Msg.PROCEDURES_IFRETURN_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1))}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},t.Blocks.texts={},t.Constants.Text={},t.Constants.Text.HUE=160,t.defineBlocksWithJsonArray([{type:"text",message0:"%1",args0:[{type:"field_input",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["text_quotes","parent_tooltip_when_inline"]},{type:"text_multiline",message0:"%1 %2",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAARCAYAAADpPU2iAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAdhgAAHYYBXaITgQAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS42/U4J6AAAAP1JREFUOE+Vks0KQUEYhjmRIja4ABtZ2dm5A3t3Ia6AUm7CylYuQRaUhZSlLZJiQbFAyRnPN33y01HOW08z8873zpwzM4F3GWOCruvGIE4/rLaV+Nq1hVGMBqzhqlxgCys4wJA65xnogMHsQ5lujnYHTejBBCK2mE4abjCgMGhNxHgDFWjDSG07kdfVa2pZMf4ZyMAdWmpZMfYOsLiDMYMjlMB+K613QISRhTnITnsYg5yUd0DETmEoMlkFOeIT/A58iyK5E18BuTBfgYXfwNJv4P9/oEBerLylOnRhygmGdPpTTBZAPkde61lbQe4moWUvYUZYLfUNftIY4zwA5X2Z9AYnQrEAAAAASUVORK5CYII=",width:12,height:17,alt:"¶"},{type:"field_multilinetext",name:"TEXT",text:""}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_TEXT_HELPURL}",tooltip:"%{BKY_TEXT_TEXT_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"text_join",message0:"",output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_JOIN_HELPURL}",tooltip:"%{BKY_TEXT_JOIN_TOOLTIP}",mutator:"text_join_mutator"},{type:"text_create_join_container",message0:"%{BKY_TEXT_CREATE_JOIN_TITLE_JOIN} %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STACK"}],style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_TOOLTIP}",enableContextMenu:!1},{type:"text_create_join_item",message0:"%{BKY_TEXT_CREATE_JOIN_ITEM_TITLE_ITEM}",previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:"%{BKY_TEXT_CREATE_JOIN_ITEM_TOOLTIP}",enableContextMenu:!1},{type:"text_append",message0:"%{BKY_TEXT_APPEND_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_TEXT_APPEND_VARIABLE}"},{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",extensions:["text_append_tooltip"]},{type:"text_length",message0:"%{BKY_TEXT_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"text_blocks",tooltip:"%{BKY_TEXT_LENGTH_TOOLTIP}",helpUrl:"%{BKY_TEXT_LENGTH_HELPURL}"},{type:"text_isEmpty",message0:"%{BKY_TEXT_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"text_blocks",tooltip:"%{BKY_TEXT_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_TEXT_ISEMPTY_HELPURL}"},{type:"text_indexOf",message0:"%{BKY_TEXT_INDEXOF_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"END",options:[["%{BKY_TEXT_INDEXOF_OPERATOR_FIRST}","FIRST"],["%{BKY_TEXT_INDEXOF_OPERATOR_LAST}","LAST"]]},{type:"input_value",name:"FIND",check:"String"}],output:"Number",style:"text_blocks",helpUrl:"%{BKY_TEXT_INDEXOF_HELPURL}",inputsInline:!0,extensions:["text_indexOf_tooltip"]},{type:"text_charAt",message0:"%{BKY_TEXT_CHARAT_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"String"},{type:"field_dropdown",name:"WHERE",options:[["%{BKY_TEXT_CHARAT_FROM_START}","FROM_START"],["%{BKY_TEXT_CHARAT_FROM_END}","FROM_END"],["%{BKY_TEXT_CHARAT_FIRST}","FIRST"],["%{BKY_TEXT_CHARAT_LAST}","LAST"],["%{BKY_TEXT_CHARAT_RANDOM}","RANDOM"]]}],output:"String",style:"text_blocks",helpUrl:"%{BKY_TEXT_CHARAT_HELPURL}",inputsInline:!0,mutator:"text_charAt_mutator"}]),t.Blocks.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[t.Msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[t.Msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[t.Msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[t.Msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[t.Msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]],this.setHelpUrl(t.Msg.TEXT_GET_SUBSTRING_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("STRING").setCheck("String").appendField(t.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),t.Msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg.TEXT_GET_SUBSTRING_TAIL),this.setInputsInline(!0),this.setOutput(!0,"String"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){var e=t.utils.xml.createElement("mutation"),n=this.getInput("AT1").type==t.INPUT_VALUE;return e.setAttribute("at1",n),n=this.getInput("AT2").type==t.INPUT_VALUE,e.setAttribute("at2",n),e},domToMutation:function(t){var e="true"==t.getAttribute("at1");t="true"==t.getAttribute("at2"),this.updateAt_(1,e),this.updateAt_(2,t)},updateAt_:function(e,n){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),n?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),2==e&&t.Msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg.TEXT_GET_SUBSTRING_TAIL));var i=new t.FieldDropdown(this["WHERE_OPTIONS_"+e],function(t){var i="FROM_START"==t||"FROM_END"==t;if(i!=n){var r=this.getSourceBlock();return r.updateAt_(e,i),r.setFieldValue(t,"WHERE"+e),null}});this.getInput("AT"+e).appendField(i,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2"))}},t.Blocks.text_changeCase={init:function(){var e=[[t.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[t.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[t.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(t.Msg.TEXT_CHANGECASE_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(new t.FieldDropdown(e),"CASE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg.TEXT_CHANGECASE_TOOLTIP)}},t.Blocks.text_trim={init:function(){var e=[[t.Msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[t.Msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[t.Msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(t.Msg.TEXT_TRIM_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(new t.FieldDropdown(e),"MODE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg.TEXT_TRIM_TOOLTIP)}},t.Blocks.text_print={init:function(){this.jsonInit({message0:t.Msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:t.Msg.TEXT_PRINT_TOOLTIP,helpUrl:t.Msg.TEXT_PRINT_HELPURL})}},t.Blocks.text_prompt_ext={init:function(){var e=[[t.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks");var n=this;e=new t.FieldDropdown(e,function(t){n.updateType_(t)}),this.appendValueInput("TEXT").appendField(e,"TYPE"),this.setOutput(!0,"String"),this.setTooltip(function(){return"TEXT"==n.getFieldValue("TYPE")?t.Msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:function(t){this.outputConnection.setCheck("NUMBER"==t?"Number":"String")},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("type",this.getFieldValue("TYPE")),e},domToMutation:function(t){this.updateType_(t.getAttribute("type"))}},t.Blocks.text_prompt={init:function(){this.mixin(t.Constants.Text.QUOTE_IMAGE_MIXIN);var e=[[t.Msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]],n=this;this.setHelpUrl(t.Msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),e=new t.FieldDropdown(e,function(t){n.updateType_(t)}),this.appendDummyInput().appendField(e,"TYPE").appendField(this.newQuote_(!0)).appendField(new t.FieldTextInput(""),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,"String"),this.setTooltip(function(){return"TEXT"==n.getFieldValue("TYPE")?t.Msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg.TEXT_PROMPT_TOOLTIP_NUMBER})},updateType_:t.Blocks.text_prompt_ext.updateType_,mutationToDom:t.Blocks.text_prompt_ext.mutationToDom,domToMutation:t.Blocks.text_prompt_ext.domToMutation},t.Blocks.text_count={init:function(){this.jsonInit({message0:t.Msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:t.Msg.TEXT_COUNT_TOOLTIP,helpUrl:t.Msg.TEXT_COUNT_HELPURL})}},t.Blocks.text_replace={init:function(){this.jsonInit({message0:t.Msg.TEXT_REPLACE_MESSAGE0,args0:[{type:"input_value",name:"FROM",check:"String"},{type:"input_value",name:"TO",check:"String"},{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg.TEXT_REPLACE_TOOLTIP,helpUrl:t.Msg.TEXT_REPLACE_HELPURL})}},t.Blocks.text_reverse={init:function(){this.jsonInit({message0:t.Msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg.TEXT_REVERSE_TOOLTIP,helpUrl:t.Msg.TEXT_REVERSE_HELPURL})}},t.Constants.Text.QUOTE_IMAGE_MIXIN={QUOTE_IMAGE_LEFT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAn0lEQVQI1z3OMa5BURSF4f/cQhAKjUQhuQmFNwGJEUi0RKN5rU7FHKhpjEH3TEMtkdBSCY1EIv8r7nFX9e29V7EBAOvu7RPjwmWGH/VuF8CyN9/OAdvqIXYLvtRaNjx9mMTDyo+NjAN1HNcl9ZQ5oQMM3dgDUqDo1l8DzvwmtZN7mnD+PkmLa+4mhrxVA9fRowBWmVBhFy5gYEjKMfz9AylsaRRgGzvZAAAAAElFTkSuQmCC",QUOTE_IMAGE_RIGHT_DATAURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAKCAQAAAAqJXdxAAAAqUlEQVQI1z3KvUpCcRiA8ef9E4JNHhI0aFEacm1o0BsI0Slx8wa8gLauoDnoBhq7DcfWhggONDmJJgqCPA7neJ7p934EOOKOnM8Q7PDElo/4x4lFb2DmuUjcUzS3URnGib9qaPNbuXvBO3sGPHJDRG6fGVdMSeWDP2q99FQdFrz26Gu5Tq7dFMzUvbXy8KXeAj57cOklgA+u1B5AoslLtGIHQMaCVnwDnADZIFIrXsoXrgAAAABJRU5ErkJggg==",QUOTE_IMAGE_WIDTH:12,QUOTE_IMAGE_HEIGHT:12,quoteField_:function(t){for(var e,n=0;e=this.inputList[n];n++)for(var i,r=0;i=e.fieldRow[r];r++)if(t==i.name)return e.insertFieldAt(r,this.newQuote_(!0)),void e.insertFieldAt(r+2,this.newQuote_(!1));console.warn('field named "'+t+'" not found in '+this.toDevString())},newQuote_:function(e){return e=this.RTL?!e:e,new t.FieldImage(e?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,this.QUOTE_IMAGE_WIDTH,this.QUOTE_IMAGE_HEIGHT,e?"“":"”")}},t.Constants.Text.TEXT_QUOTES_EXTENSION=function(){this.mixin(t.Constants.Text.QUOTE_IMAGE_MIXIN),this.quoteField_("TEXT")},t.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN={mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("text_create_join_container");e.initSvg();for(var n=e.getInput("STACK").connection,i=0;i<this.itemCount_;i++){var r=t.newBlock("text_create_join_item");r.initSvg(),n.connect(r.previousConnection),n=r.nextConnection}return e},compose:function(e){var n=e.getInputTargetBlock("STACK");for(e=[];n&&!n.isInsertionMarker();)e.push(n.valueConnection_),n=n.nextConnection&&n.nextConnection.targetBlock();for(n=0;n<this.itemCount_;n++){var i=this.getInput("ADD"+n).connection.targetConnection;i&&-1==e.indexOf(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),n=0;n<this.itemCount_;n++)t.Mutator.reconnect(e[n],this,"ADD"+n)},saveConnections:function(t){t=t.getInputTargetBlock("STACK");for(var e=0;t;){var n=this.getInput("ADD"+e);t.valueConnection_=n&&n.connection.targetConnection,e++,t=t.nextConnection&&t.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(this.newQuote_(!0)).appendField(this.newQuote_(!1));for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){var n=this.appendValueInput("ADD"+e).setAlign(t.ALIGN_RIGHT);0==e&&n.appendField(t.Msg.TEXT_JOIN_TITLE_CREATEWITH)}for(;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++}},t.Constants.Text.TEXT_JOIN_EXTENSION=function(){this.mixin(t.Constants.Text.QUOTE_IMAGE_MIXIN),this.itemCount_=2,this.updateShape_(),this.setMutator(new t.Mutator(["text_create_join_item"]))},t.Extensions.register("text_append_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_TEXT_APPEND_TOOLTIP}","VAR")),t.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION=function(){var e=this;this.setTooltip(function(){return t.Msg.TEXT_INDEXOF_TOOLTIP.replace("%1",e.workspace.options.oneBasedIndex?"0":"-1")})},t.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN={mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("at",!!this.isAt_),e},domToMutation:function(t){t="false"!=t.getAttribute("at"),this.updateAt_(t)},updateAt_:function(e){this.removeInput("AT",!0),this.removeInput("ORDINAL",!0),e&&(this.appendValueInput("AT").setCheck("Number"),t.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg.ORDINAL_NUMBER_SUFFIX)),t.Msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg.TEXT_CHARAT_TAIL)),this.isAt_=e}},t.Constants.Text.TEXT_CHARAT_EXTENSION=function(){this.getField("WHERE").setValidator(function(t){(t="FROM_START"==t||"FROM_END"==t)!=this.isAt_&&this.getSourceBlock().updateAt_(t)}),this.updateAt_(!0);var e=this;this.setTooltip(function(){var n=e.getFieldValue("WHERE"),i=t.Msg.TEXT_CHARAT_TOOLTIP;return("FROM_START"==n||"FROM_END"==n)&&(n="FROM_START"==n?t.Msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(i+=" "+n.replace("%1",e.workspace.options.oneBasedIndex?"#1":"#0")),i})},t.Extensions.register("text_indexOf_tooltip",t.Constants.Text.TEXT_INDEXOF_TOOLTIP_EXTENSION),t.Extensions.register("text_quotes",t.Constants.Text.TEXT_QUOTES_EXTENSION),t.Extensions.registerMutator("text_join_mutator",t.Constants.Text.TEXT_JOIN_MUTATOR_MIXIN,t.Constants.Text.TEXT_JOIN_EXTENSION),t.Extensions.registerMutator("text_charAt_mutator",t.Constants.Text.TEXT_CHARAT_MUTATOR_MIXIN,t.Constants.Text.TEXT_CHARAT_EXTENSION),t.Blocks.variables={},t.Constants.Variables={},t.Constants.Variables.HUE=330,t.defineBlocksWithJsonArray([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]),t.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(e){if(this.isInFlyout)"variables_get"!=this.type&&"variables_get_reporter"!=this.type||(n={text:t.Msg.RENAME_VARIABLE,enabled:!0,callback:t.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY(this)},o=this.getField("VAR").getText(),r={text:t.Msg.DELETE_VARIABLE.replace("%1",o),enabled:!0,callback:t.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY(this)},e.unshift(n),e.unshift(r));else{if("variables_get"==this.type)var n="variables_set",i=t.Msg.VARIABLES_GET_CREATE_SET;else n="variables_get",i=t.Msg.VARIABLES_SET_CREATE_GET;var r={enabled:0<this.workspace.remainingCapacity()},o=this.getField("VAR").getText();r.text=i.replace("%1",o),(i=t.utils.xml.createElement("field")).setAttribute("name","VAR"),i.appendChild(t.utils.xml.createTextNode(o)),(o=t.utils.xml.createElement("block")).setAttribute("type",n),o.appendChild(i),r.callback=t.ContextMenu.callbackFactory(this,o),e.push(r)}}},t.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY=function(e){return function(){var n=e.workspace,i=e.getField("VAR").getVariable();t.Variables.renameVariable(n,i)}},t.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY=function(t){return function(){var e=t.workspace,n=t.getField("VAR").getVariable();e.deleteVariableById(n.getId()),e.refreshToolboxSelection()}},t.Extensions.registerMixin("contextMenu_variableSetterGetter",t.Constants.Variables.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN),t.Constants.VariablesDynamic={},t.Constants.VariablesDynamic.HUE=310,t.defineBlocksWithJsonArray([{type:"variables_get_dynamic",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_dynamic_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableDynamicSetterGetter"]},{type:"variables_set_dynamic",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,style:"variable_dynamic_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableDynamicSetterGetter"]}]),t.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN={customContextMenu:function(e){if(this.isInFlyout)"variables_get_dynamic"!=this.type&&"variables_get_reporter_dynamic"!=this.type||(n={text:t.Msg.RENAME_VARIABLE,enabled:!0,callback:t.Constants.Variables.RENAME_OPTION_CALLBACK_FACTORY(this)},s=this.getField("VAR").getText(),o={text:t.Msg.DELETE_VARIABLE.replace("%1",s),enabled:!0,callback:t.Constants.Variables.DELETE_OPTION_CALLBACK_FACTORY(this)},e.unshift(n),e.unshift(o));else{var n=this.getFieldValue("VAR"),i=this.workspace.getVariableById(n).type;if("variables_get_dynamic"==this.type){n="variables_set_dynamic";var r=t.Msg.VARIABLES_GET_CREATE_SET}else n="variables_get_dynamic",r=t.Msg.VARIABLES_SET_CREATE_GET;var o={enabled:0<this.workspace.remainingCapacity()},s=this.getField("VAR").getText();o.text=r.replace("%1",s),(r=t.utils.xml.createElement("field")).setAttribute("name","VAR"),r.setAttribute("variabletype",i),r.appendChild(t.utils.xml.createTextNode(s)),(s=t.utils.xml.createElement("block")).setAttribute("type",n),s.appendChild(r),o.callback=t.ContextMenu.callbackFactory(this,s),e.push(o)}},onchange:function(e){e=this.getFieldValue("VAR"),e=t.Variables.getVariable(this.workspace,e),"variables_get_dynamic"==this.type?this.outputConnection.setCheck(e.type):this.getInput("VALUE").connection.setCheck(e.type)}},t.Constants.VariablesDynamic.RENAME_OPTION_CALLBACK_FACTORY=function(e){return function(){var n=e.workspace,i=e.getField("VAR").getVariable();t.Variables.renameVariable(n,i)}},t.Constants.VariablesDynamic.DELETE_OPTION_CALLBACK_FACTORY=function(t){return function(){var e=t.workspace,n=t.getField("VAR").getVariable();e.deleteVariableById(n.getId()),e.refreshToolboxSelection()}},t.Extensions.registerMixin("contextMenu_variableDynamicSetterGetter",t.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MIXIN),t.Blocks},r=[n("GEkh")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},"QWe/":function(t,e,n){n("crlp")("observable")},R4wc:function(t,e,n){var i=n("kM2E");i(i.S+i.F,"Object",{assign:n("To3L")})},R9M2:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},RDoK:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=107)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},107:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-radio",class:[t.border&&t.radioSize?"el-radio--"+t.radioSize:"",{"is-disabled":t.isDisabled},{"is-focus":t.focus},{"is-bordered":t.border},{"is-checked":t.model===t.label}],attrs:{role:"radio","aria-checked":t.model===t.label,"aria-disabled":t.isDisabled,tabindex:t.tabIndex},on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"]))return null;e.stopPropagation(),e.preventDefault(),t.model=t.isDisabled?t.model:t.label}}},[n("span",{staticClass:"el-radio__input",class:{"is-disabled":t.isDisabled,"is-checked":t.model===t.label}},[n("span",{staticClass:"el-radio__inner"}),n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],ref:"radio",staticClass:"el-radio__original",attrs:{type:"radio","aria-hidden":"true",name:t.name,disabled:t.isDisabled,tabindex:"-1"},domProps:{value:t.label,checked:t._q(t.model,t.label)},on:{focus:function(e){t.focus=!0},blur:function(e){t.focus=!1},change:[function(e){t.model=t.label},t.handleChange]}})]),n("span",{staticClass:"el-radio__label",on:{keydown:function(t){t.stopPropagation()}}},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2)])};i._withStripped=!0;var r=n(4),o={name:"ElRadio",mixins:[n.n(r).a],inject:{elForm:{default:""},elFormItem:{default:""}},componentName:"ElRadio",props:{value:{},label:{},disabled:Boolean,name:String,border:Boolean,size:String},data:function(){return{focus:!1}},computed:{isGroup:function(){for(var t=this.$parent;t;){if("ElRadioGroup"===t.$options.componentName)return this._radioGroup=t,!0;t=t.$parent}return!1},model:{get:function(){return this.isGroup?this._radioGroup.value:this.value},set:function(t){this.isGroup?this.dispatch("ElRadioGroup","input",[t]):this.$emit("input",t),this.$refs.radio&&(this.$refs.radio.checked=this.model===this.label)}},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},radioSize:function(){var t=this.size||this._elFormItemSize||(this.$ELEMENT||{}).size;return this.isGroup&&this._radioGroup.radioGroupSize||t},isDisabled:function(){return this.isGroup?this._radioGroup.disabled||this.disabled||(this.elForm||{}).disabled:this.disabled||(this.elForm||{}).disabled},tabIndex:function(){return this.isDisabled||this.isGroup&&this.model!==this.label?-1:0}},methods:{handleChange:function(){var t=this;this.$nextTick(function(){t.$emit("change",t.model),t.isGroup&&t.dispatch("ElRadioGroup","handleChange",t.model)})}}},s=n(0),a=Object(s.a)(o,i,[],!1,null,null,null);a.options.__file="packages/radio/src/radio.vue";var l=a.exports;l.install=function(t){t.component(l.name,l)};e.default=l},4:function(t,e){t.exports=n("fPll")}})},RPLV:function(t,e,n){var i=n("7KvD").document;t.exports=i&&i.documentElement},"RY/4":function(t,e,n){var i=n("R9M2"),r=n("dSzd")("toStringTag"),o="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),r))?n:o?i(e):"Object"==(s=i(e))&&"function"==typeof e.callee?"Arguments":s}},Rrel:function(t,e,n){var i=n("TcQ7"),r=n("n0T6").f,o={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return s&&"[object Window]"==o.call(t)?function(t){try{return r(t)}catch(t){return s.slice()}}(t):r(i(t))}},S82l:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},SLDG:function(t,e,n){"use strict";t.exports=function(t){return"object"==typeof t&&!0===t.isAxiosError}},STLj:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=53)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},3:function(t,e){t.exports=n("ylDJ")},33:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-select-dropdown__item",class:{selected:t.itemSelected,"is-disabled":t.disabled||t.groupDisabled||t.limitReached,hover:t.hover},on:{mouseenter:t.hoverItem,click:function(e){return e.stopPropagation(),t.selectOptionClick(e)}}},[t._t("default",[n("span",[t._v(t._s(t.currentLabel))])])],2)};i._withStripped=!0;var r=n(4),o=n.n(r),s=n(3),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l={mixins:[o.a],name:"ElOption",componentName:"ElOption",inject:["select"],props:{value:{required:!0},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},data:function(){return{index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}},computed:{isObject:function(){return"[object object]"===Object.prototype.toString.call(this.value).toLowerCase()},currentLabel:function(){return this.label||(this.isObject?"":this.value)},currentValue:function(){return this.value||this.label||""},itemSelected:function(){return this.select.multiple?this.contains(this.select.value,this.value):this.isEqual(this.value,this.select.value)},limitReached:function(){return!!this.select.multiple&&(!this.itemSelected&&(this.select.value||[]).length>=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel:function(){this.created||this.select.remote||this.dispatch("ElSelect","setSelected")},value:function(t,e){var n=this.select,i=n.remote,r=n.valueKey;if(!this.created&&!i){if(r&&"object"===(void 0===t?"undefined":a(t))&&"object"===(void 0===e?"undefined":a(e))&&t[r]===e[r])return;this.dispatch("ElSelect","setSelected")}}},methods:{isEqual:function(t,e){if(this.isObject){var n=this.select.valueKey;return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)}return t===e},contains:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if(this.isObject){var n=this.select.valueKey;return t&&t.some(function(t){return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)})}return t&&t.indexOf(e)>-1},handleGroupDisabled:function(t){this.groupDisabled=t},hoverItem:function(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this))},selectOptionClick:function(){!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ElSelect","handleOptionClick",[this,!0])},queryChange:function(t){this.visible=new RegExp(Object(s.escapeRegexpString)(t),"i").test(this.currentLabel)||this.created,this.visible||this.select.filteredOptionsCount--}},created:function(){this.select.options.push(this),this.select.cachedOptions.push(this),this.select.optionsCount++,this.select.filteredOptionsCount++,this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled)},beforeDestroy:function(){var t=this.select,e=t.selected,n=t.multiple?e:[e],i=this.select.cachedOptions.indexOf(this),r=n.indexOf(this);i>-1&&r<0&&this.select.cachedOptions.splice(i,1),this.select.onOptionDestroy(this.select.options.indexOf(this))}},u=n(0),c=Object(u.a)(l,i,[],!1,null,null,null);c.options.__file="packages/select/src/option.vue";e.a=c.exports},4:function(t,e){t.exports=n("fPll")},53:function(t,e,n){"use strict";n.r(e);var i=n(33);i.a.install=function(t){t.component(i.a.name,i.a)},e.default=i.a}})},SXzR:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=73)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},2:function(t,e){t.exports=n("2kvA")},3:function(t,e){t.exports=n("ylDJ")},5:function(t,e){t.exports=n("fKx3")},7:function(t,e){t.exports=n("7+uW")},73:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",[n("transition",{attrs:{name:t.transition},on:{"after-enter":t.handleAfterEnter,"after-leave":t.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!t.disabled&&t.showPopper,expression:"!disabled && showPopper"}],ref:"popper",staticClass:"el-popover el-popper",class:[t.popperClass,t.content&&"el-popover--plain"],style:{width:t.width+"px"},attrs:{role:"tooltip",id:t.tooltipId,"aria-hidden":t.disabled||!t.showPopper?"true":"false"}},[t.title?n("div",{staticClass:"el-popover__title",domProps:{textContent:t._s(t.title)}}):t._e(),t._t("default",[t._v(t._s(t.content))])],2)]),n("span",{ref:"wrapper",staticClass:"el-popover__reference-wrapper"},[t._t("reference")],2)],1)};i._withStripped=!0;var r=n(5),o=n.n(r),s=n(2),a=n(3),l={name:"ElPopover",mixins:[o.a],props:{trigger:{type:String,default:"click",validator:function(t){return["click","focus","hover","manual"].indexOf(t)>-1}},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:200},title:String,disabled:Boolean,content:String,reference:{},popperClass:String,width:{},visibleArrow:{default:!0},arrowOffset:{type:Number,default:0},transition:{type:String,default:"fade-in-linear"},tabindex:{type:Number,default:0}},computed:{tooltipId:function(){return"el-popover-"+Object(a.generateId)()}},watch:{showPopper:function(t){this.disabled||(t?this.$emit("show"):this.$emit("hide"))}},mounted:function(){var t=this,e=this.referenceElm=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),e&&(Object(s.addClass)(e,"el-popover__reference"),e.setAttribute("aria-describedby",this.tooltipId),e.setAttribute("tabindex",this.tabindex),n.setAttribute("tabindex",0),"click"!==this.trigger&&(Object(s.on)(e,"focusin",function(){t.handleFocus();var n=e.__vue__;n&&"function"==typeof n.focus&&n.focus()}),Object(s.on)(n,"focusin",this.handleFocus),Object(s.on)(e,"focusout",this.handleBlur),Object(s.on)(n,"focusout",this.handleBlur)),Object(s.on)(e,"keydown",this.handleKeydown),Object(s.on)(e,"click",this.handleClick)),"click"===this.trigger?(Object(s.on)(e,"click",this.doToggle),Object(s.on)(document,"click",this.handleDocumentClick)):"hover"===this.trigger?(Object(s.on)(e,"mouseenter",this.handleMouseEnter),Object(s.on)(n,"mouseenter",this.handleMouseEnter),Object(s.on)(e,"mouseleave",this.handleMouseLeave),Object(s.on)(n,"mouseleave",this.handleMouseLeave)):"focus"===this.trigger&&(this.tabindex<0&&console.warn("[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key"),e.querySelector("input, textarea")?(Object(s.on)(e,"focusin",this.doShow),Object(s.on)(e,"focusout",this.doClose)):(Object(s.on)(e,"mousedown",this.doShow),Object(s.on)(e,"mouseup",this.doClose)))},beforeDestroy:function(){this.cleanup()},deactivated:function(){this.cleanup()},methods:{doToggle:function(){this.showPopper=!this.showPopper},doShow:function(){this.showPopper=!0},doClose:function(){this.showPopper=!1},handleFocus:function(){Object(s.addClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!0)},handleClick:function(){Object(s.removeClass)(this.referenceElm,"focusing")},handleBlur:function(){Object(s.removeClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!1)},handleMouseEnter:function(){var t=this;clearTimeout(this._timer),this.openDelay?this._timer=setTimeout(function(){t.showPopper=!0},this.openDelay):this.showPopper=!0},handleKeydown:function(t){27===t.keyCode&&"manual"!==this.trigger&&this.doClose()},handleMouseLeave:function(){var t=this;clearTimeout(this._timer),this.closeDelay?this._timer=setTimeout(function(){t.showPopper=!1},this.closeDelay):this.showPopper=!1},handleDocumentClick:function(t){var e=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),this.$el&&e&&!this.$el.contains(t.target)&&!e.contains(t.target)&&n&&!n.contains(t.target)&&(this.showPopper=!1)},handleAfterEnter:function(){this.$emit("after-enter")},handleAfterLeave:function(){this.$emit("after-leave"),this.doDestroy()},cleanup:function(){(this.openDelay||this.closeDelay)&&clearTimeout(this._timer)}},destroyed:function(){var t=this.reference;Object(s.off)(t,"click",this.doToggle),Object(s.off)(t,"mouseup",this.doClose),Object(s.off)(t,"mousedown",this.doShow),Object(s.off)(t,"focusin",this.doShow),Object(s.off)(t,"focusout",this.doClose),Object(s.off)(t,"mousedown",this.doShow),Object(s.off)(t,"mouseup",this.doClose),Object(s.off)(t,"mouseleave",this.handleMouseLeave),Object(s.off)(t,"mouseenter",this.handleMouseEnter),Object(s.off)(document,"click",this.handleDocumentClick)}},u=n(0),c=Object(u.a)(l,i,[],!1,null,null,null);c.options.__file="packages/popover/src/main.vue";var h=c.exports,p=function(t,e,n){var i=e.expression?e.value:e.arg,r=n.context.$refs[i];r&&(Array.isArray(r)?r[0].$refs.reference=t:r.$refs.reference=t)},d={bind:function(t,e,n){p(t,e,n)},inserted:function(t,e,n){p(t,e,n)}},f=n(7);n.n(f).a.directive("popover",d),h.install=function(t){t.directive("popover",d),t.component(h.name,h)},h.directive=d;e.default=h}})},SfB7:function(t,e,n){t.exports=!n("+E39")&&!n("S82l")(function(){return 7!=Object.defineProperty(n("ON07")("div"),"a",{get:function(){return 7}}).a})},SldL:function(t,e){!function(e){"use strict";var n,i=Object.prototype,r=i.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag",u="object"==typeof t,c=e.regeneratorRuntime;if(c)u&&(t.exports=c);else{(c=e.regeneratorRuntime=u?t.exports:{}).wrap=b;var h="suspendedStart",p="suspendedYield",d="executing",f="completed",g={},m={};m[s]=function(){return this};var v=Object.getPrototypeOf,_=v&&v(v(D([])));_&&_!==i&&r.call(_,s)&&(m=_);var y=S.prototype=E.prototype=Object.create(m);C.prototype=y.constructor=S,S.constructor=C,S[l]=C.displayName="GeneratorFunction",c.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===C||"GeneratorFunction"===(e.displayName||e.name))},c.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,l in t||(t[l]="GeneratorFunction")),t.prototype=Object.create(y),t},c.awrap=function(t){return{__await:t}},w(k.prototype),k.prototype[a]=function(){return this},c.AsyncIterator=k,c.async=function(t,e,n,i){var r=new k(b(t,e,n,i));return c.isGeneratorFunction(e)?r:r.next().then(function(t){return t.done?t.value:r.next()})},w(y),y[l]="Generator",y[s]=function(){return this},y.toString=function(){return"[object Generator]"},c.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},c.values=D,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(R),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function i(i,r){return a.type="throw",a.arg=t,e.next=i,r&&(e.method="next",e.arg=n),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var l=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(l&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;R(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:D(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=n),g}}}function b(t,e,n,i){var r=e&&e.prototype instanceof E?e:E,o=Object.create(r.prototype),s=new O(i||[]);return o._invoke=function(t,e,n){var i=h;return function(r,o){if(i===d)throw new Error("Generator is already running");if(i===f){if("throw"===r)throw o;return A()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=T(t,e,n);if("normal"===l.type){if(i=n.done?f:p,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=f,n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function T(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function E(){}function C(){}function S(){}function w(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function k(t){var e;this._invoke=function(n,i){function o(){return new Promise(function(e,o){!function e(n,i,o,s){var a=T(t[n],t,i);if("throw"!==a.type){var l=a.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?Promise.resolve(u.__await).then(function(t){e("next",t,o,s)},function(t){e("throw",t,o,s)}):Promise.resolve(u).then(function(t){l.value=t,o(l)},s)}s(a.arg)}(n,i,e,o)})}return e=e?e.then(o,o):o()}}function x(t,e){var i=t.iterator[e.method];if(i===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,x(t,e),"throw"===e.method))return g;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var r=T(i,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,g;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function D(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:A}}function A(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},SvnF:function(t,e,n){"use strict";e.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.default=function(t){return function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return 1===n.length&&"object"===i(n[0])&&(n=n[0]),n&&n.hasOwnProperty||(n={}),t.replace(o,function(e,i,o,s){var a=void 0;return"{"===t[s-1]&&"}"===t[s+e.length]?o:null===(a=(0,r.hasOwn)(n,o)?n[o]:null)||void 0===a?"":a})}};var r=n("ylDJ"),o=/(%|)\{([0-9a-zA-Z_]+)\}/g},TNV1:function(t,e,n){"use strict";var i=n("cGG2");t.exports=function(t,e,n){return i.forEach(n,function(n){t=n(t,e)}),t}},TToO:function(t,e,n){"use strict";e.c=function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},n.d(e,"a",function(){return r}),e.b=function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}l((i=i.apply(t,e||[])).next())})},e.d=function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},e.e=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var i=Array(t),r=0,e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i};
  61. /*! *****************************************************************************
  62. Copyright (c) Microsoft Corporation.
  63. Permission to use, copy, modify, and/or distribute this software for any
  64. purpose with or without fee is hereby granted.
  65. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  66. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  67. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  68. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  69. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  70. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  71. PERFORMANCE OF THIS SOFTWARE.
  72. ***************************************************************************** */
  73. var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var r=function(){return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)}},TcQ7:function(t,e,n){var i=n("MU5D"),r=n("52gC");t.exports=function(t){return i(r(t))}},To3L:function(t,e,n){"use strict";var i=n("+E39"),r=n("lktj"),o=n("1kS7"),s=n("NpIQ"),a=n("sB3e"),l=n("MU5D"),u=Object.assign;t.exports=!u||n("S82l")(function(){var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=i})?function(t,e){for(var n=a(t),u=arguments.length,c=1,h=o.f,p=s.f;u>c;)for(var d,f=l(arguments[c++]),g=h?r(f).concat(h(f)):r(f),m=g.length,v=0;m>v;)d=g[v++],i&&!p.call(f,d)||(n[d]=f[d]);return n}:u},U5ju:function(t,e,n){n("M6a0"),n("zQR9"),n("+tPU"),n("CXw9"),n("EqBC"),n("jKW+"),t.exports=n("FeBl").Promise},UuGF:function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},V3tA:function(t,e,n){n("R4wc"),t.exports=n("FeBl").Object.assign},"VU/8":function(t,e){t.exports=function(t,e,n,i,r,o){var s,a=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(s=t,a=t.default);var u,c="function"==typeof a?a.options:a;if(e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),r&&(c._scopeId=r),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):i&&(u=i),u){var h=c.functional,p=h?c.render:c.beforeCreate;h?(c._injectStyles=u,c.render=function(t,e){return u.call(e),p(t,e)}):c.beforeCreate=p?[].concat(p,u):[u]}return{esModule:s,exports:a,options:c}}},Vi3T:function(t,e,n){"use strict";e.__esModule=!0,e.default={el:{colorpicker:{confirm:"确定",clear:"清空"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},empty:{description:"暂无数据"}}}},W2nU:function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var l,u=[],c=!1,h=-1;function p(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&d())}function d(){if(!c){var t=a(p);c=!0;for(var e=u.length;e;){for(l=u,u=[];++h<e;)l&&l[h].run();h=-1,e=u.length}l=null,c=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function g(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new f(t,e)),1!==u.length||c||a(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},X8DO:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},Xc4G:function(t,e,n){var i=n("lktj"),r=n("1kS7"),o=n("NpIQ");t.exports=function(t){var e=i(t),n=r.f;if(n)for(var s,a=n(t),l=o.f,u=0;a.length>u;)l.call(t,s=a[u++])&&e.push(s);return e}},Xd32:function(t,e,n){n("+tPU"),n("zQR9"),t.exports=n("5PlU")},XgCd:function(t,e,n){"use strict";var i=String.prototype.replace,r=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return i.call(t,r,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},XmWM:function(t,e,n){"use strict";var i=n("cGG2"),r=n("DQCr"),o=n("fuGk"),s=n("xLtR"),a=n("DUeU");function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},l.prototype.getUri=function(t){return t=a(this.defaults,t),r(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}}),i.forEach(["post","put","patch"],function(t){l.prototype[t]=function(e,n,i){return this.request(a(i||{},{method:t,url:e,data:n}))}}),t.exports=l},Xxa5:function(t,e,n){t.exports=n("jyFz")},Y5mS:function(t,e,n){"use strict";var i,r=n("lFkc");r.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
  74. /**
  75. * Checks if an event is supported in the current execution environment.
  76. *
  77. * NOTE: This will not work correctly for non-generic events such as `change`,
  78. * `reset`, `load`, `error`, and `select`.
  79. *
  80. * Borrows from Modernizr.
  81. *
  82. * @param {string} eventNameSuffix Event name, e.g. "click".
  83. * @param {?boolean} capture Check if the capture phase is supported.
  84. * @return {boolean} True if the event is supported.
  85. * @internal
  86. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  87. */,t.exports=function(t,e){if(!r.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,o=n in document;if(!o){var s=document.createElement("div");s.setAttribute(n,"return;"),o="function"==typeof s[n]}return!o&&i&&"wheel"===t&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o}},YAhB:function(t,e,n){"use strict";var i=n("++K3"),r=n("Y5mS"),o=10,s=40,a=800;function l(t){var e=0,n=0,i=0,r=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),i=e*o,r=n*o,"deltaY"in t&&(r=t.deltaY),"deltaX"in t&&(i=t.deltaX),(i||r)&&t.deltaMode&&(1==t.deltaMode?(i*=s,r*=s):(i*=a,r*=a)),i&&!e&&(e=i<1?-1:1),r&&!n&&(n=r<1?-1:1),{spinX:e,spinY:n,pixelX:i,pixelY:r}}l.getEventType=function(){return i.firefox()?"DOMMouseScroll":r("wheel")?"wheel":"mousewheel"},t.exports=l},Ya8g:function(t,e){},Yobk:function(t,e,n){var i=n("77Pl"),r=n("qio6"),o=n("xnc9"),s=n("ax3d")("IE_PROTO"),a=function(){},l=function(){var t,e=n("ON07")("iframe"),i=o.length;for(e.style.display="none",n("RPLV").appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),l=t.F;i--;)delete l.prototype[o[i]];return l()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=i(t),n=new a,a.prototype=null,n[s]=t):n=l(),void 0===e?n:r(n,e)}},Zcwg:function(t,e,n){"use strict";e.__esModule=!0;var i=n("2kvA");var r=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.beforeEnter=function(t){(0,i.addClass)(t,"collapse-transition"),t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.style.height="0",t.style.paddingTop=0,t.style.paddingBottom=0},t.prototype.enter=function(t){t.dataset.oldOverflow=t.style.overflow,0!==t.scrollHeight?(t.style.height=t.scrollHeight+"px",t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom):(t.style.height="",t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom),t.style.overflow="hidden"},t.prototype.afterEnter=function(t){(0,i.removeClass)(t,"collapse-transition"),t.style.height="",t.style.overflow=t.dataset.oldOverflow},t.prototype.beforeLeave=function(t){t.dataset||(t.dataset={}),t.dataset.oldPaddingTop=t.style.paddingTop,t.dataset.oldPaddingBottom=t.style.paddingBottom,t.dataset.oldOverflow=t.style.overflow,t.style.height=t.scrollHeight+"px",t.style.overflow="hidden"},t.prototype.leave=function(t){0!==t.scrollHeight&&((0,i.addClass)(t,"collapse-transition"),t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0)},t.prototype.afterLeave=function(t){(0,i.removeClass)(t,"collapse-transition"),t.style.height="",t.style.overflow=t.dataset.oldOverflow,t.style.paddingTop=t.dataset.oldPaddingTop,t.style.paddingBottom=t.dataset.oldPaddingBottom},t}();e.default={name:"ElCollapseTransition",functional:!0,render:function(t,e){var n=e.children;return t("transition",{on:new r},n)}}},Zzip:function(t,e,n){t.exports={default:n("/n6Q"),__esModule:!0}},aMwW:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=135)}({135:function(t,e,n){"use strict";n.r(e);var i=n(5),r=n.n(i),o=n(17),s=n.n(o),a=n(2),l=n(3),u=n(7),c=n.n(u),h={name:"ElTooltip",mixins:[r.a],props:{openDelay:{type:Number,default:0},disabled:Boolean,manual:Boolean,effect:{type:String,default:"dark"},arrowOffset:{type:Number,default:0},popperClass:String,content:String,visibleArrow:{default:!0},transition:{type:String,default:"el-fade-in-linear"},popperOptions:{default:function(){return{boundariesPadding:10,gpuAcceleration:!1}}},enterable:{type:Boolean,default:!0},hideAfter:{type:Number,default:0},tabindex:{type:Number,default:0}},data:function(){return{tooltipId:"el-tooltip-"+Object(l.generateId)(),timeoutPending:null,focusing:!1}},beforeCreate:function(){var t=this;this.$isServer||(this.popperVM=new c.a({data:{node:""},render:function(t){return this.node}}).$mount(),this.debounceClose=s()(200,function(){return t.handleClosePopper()}))},render:function(t){var e=this;this.popperVM&&(this.popperVM.node=t("transition",{attrs:{name:this.transition},on:{afterLeave:this.doDestroy}},[t("div",{on:{mouseleave:function(){e.setExpectedState(!1),e.debounceClose()},mouseenter:function(){e.setExpectedState(!0)}},ref:"popper",attrs:{role:"tooltip",id:this.tooltipId,"aria-hidden":this.disabled||!this.showPopper?"true":"false"},directives:[{name:"show",value:!this.disabled&&this.showPopper}],class:["el-tooltip__popper","is-"+this.effect,this.popperClass]},[this.$slots.content||this.content])]));var n=this.getFirstElement();if(!n)return null;var i=n.data=n.data||{};return i.staticClass=this.addTooltipClass(i.staticClass),n},mounted:function(){var t=this;this.referenceElm=this.$el,1===this.$el.nodeType&&(this.$el.setAttribute("aria-describedby",this.tooltipId),this.$el.setAttribute("tabindex",this.tabindex),Object(a.on)(this.referenceElm,"mouseenter",this.show),Object(a.on)(this.referenceElm,"mouseleave",this.hide),Object(a.on)(this.referenceElm,"focus",function(){if(t.$slots.default&&t.$slots.default.length){var e=t.$slots.default[0].componentInstance;e&&e.focus?e.focus():t.handleFocus()}else t.handleFocus()}),Object(a.on)(this.referenceElm,"blur",this.handleBlur),Object(a.on)(this.referenceElm,"click",this.removeFocusing)),this.value&&this.popperVM&&this.popperVM.$nextTick(function(){t.value&&t.updatePopper()})},watch:{focusing:function(t){t?Object(a.addClass)(this.referenceElm,"focusing"):Object(a.removeClass)(this.referenceElm,"focusing")}},methods:{show:function(){this.setExpectedState(!0),this.handleShowPopper()},hide:function(){this.setExpectedState(!1),this.debounceClose()},handleFocus:function(){this.focusing=!0,this.show()},handleBlur:function(){this.focusing=!1,this.hide()},removeFocusing:function(){this.focusing=!1},addTooltipClass:function(t){return t?"el-tooltip "+t.replace("el-tooltip",""):"el-tooltip"},handleShowPopper:function(){var t=this;this.expectedState&&!this.manual&&(clearTimeout(this.timeout),this.timeout=setTimeout(function(){t.showPopper=!0},this.openDelay),this.hideAfter>0&&(this.timeoutPending=setTimeout(function(){t.showPopper=!1},this.hideAfter)))},handleClosePopper:function(){this.enterable&&this.expectedState||this.manual||(clearTimeout(this.timeout),this.timeoutPending&&clearTimeout(this.timeoutPending),this.showPopper=!1,this.disabled&&this.doDestroy())},setExpectedState:function(t){!1===t&&clearTimeout(this.timeoutPending),this.expectedState=t},getFirstElement:function(){var t=this.$slots.default;if(!Array.isArray(t))return null;for(var e=null,n=0;n<t.length;n++)t[n]&&t[n].tag&&(e=t[n]);return e}},beforeDestroy:function(){this.popperVM&&this.popperVM.$destroy()},destroyed:function(){var t=this.referenceElm;1===t.nodeType&&(Object(a.off)(t,"mouseenter",this.show),Object(a.off)(t,"mouseleave",this.hide),Object(a.off)(t,"focus",this.handleFocus),Object(a.off)(t,"blur",this.handleBlur),Object(a.off)(t,"click",this.removeFocusing))},install:function(t){t.component(h.name,h)}};e.default=h},17:function(t,e){t.exports=n("ON3O")},2:function(t,e){t.exports=n("2kvA")},3:function(t,e){t.exports=n("ylDJ")},5:function(t,e){t.exports=n("fKx3")},7:function(t,e){t.exports=n("7+uW")}})},aW5l:function(t,e,n){"use strict";e.__esModule=!0;n("ylDJ");e.default={mounted:function(){},methods:{getMigratingConfig:function(){return{props:{},events:{}}}}}},ax3d:function(t,e,n){var i=n("e8AB")("keys"),r=n("3Eo+");t.exports=function(t){return i[t]||(i[t]=r(t))}},bRrM:function(t,e,n){"use strict";var i=n("7KvD"),r=n("FeBl"),o=n("evD5"),s=n("+E39"),a=n("dSzd")("species");t.exports=function(t){var e="function"==typeof r[t]?r[t]:i[t];s&&e&&!e[a]&&o.f(e,a,{configurable:!0,get:function(){return this}})}},cGG2:function(t,e,n){"use strict";var i=n("JP+z"),r=Object.prototype.toString;function o(t){return"[object Array]"===r.call(t)}function s(t){return void 0===t}function a(t){return null!==t&&"object"==typeof t}function l(t){if("[object Object]"!==r.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function u(t){return"[object Function]"===r.call(t)}function c(t,e){if(null!==t&&void 0!==t)if("object"!=typeof t&&(t=[t]),o(t))for(var n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}t.exports={isArray:o,isArrayBuffer:function(t){return"[object ArrayBuffer]"===r.call(t)},isBuffer:function(t){return null!==t&&!s(t)&&null!==t.constructor&&!s(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isPlainObject:l,isUndefined:s,isDate:function(t){return"[object Date]"===r.call(t)},isFile:function(t){return"[object File]"===r.call(t)},isBlob:function(t){return"[object Blob]"===r.call(t)},isFunction:u,isStream:function(t){return a(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function t(){var e={};function n(n,i){l(e[i])&&l(n)?e[i]=t(e[i],n):l(n)?e[i]=t({},n):o(n)?e[i]=n.slice():e[i]=n}for(var i=0,r=arguments.length;i<r;i++)c(arguments[i],n);return e},extend:function(t,e,n){return c(e,function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}}},cWxy:function(t,e,n){"use strict";var i=n("dVOP");function r(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new i(t),e(n.reason))})}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var t;return{token:new r(function(e){t=e}),cancel:t}},t.exports=r},crlp:function(t,e,n){var i=n("7KvD"),r=n("FeBl"),o=n("O4g8"),s=n("Kh4W"),a=n("evD5").f;t.exports=function(t){var e=r.Symbol||(r.Symbol=o?{}:i.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},d7EF:function(t,e,n){"use strict";e.__esModule=!0;var i=o(n("us/S")),r=o(n("BO1k"));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){return function(t,e){if(Array.isArray(t))return t;if((0,i.default)(Object(t)))return function(t,e){var n=[],i=!0,o=!1,s=void 0;try{for(var a,l=(0,r.default)(t);!(i=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){o=!0,s=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw s}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},dIwP:function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},dNDb:function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},dSzd:function(t,e,n){var i=n("e8AB")("wks"),r=n("3Eo+"),o=n("7KvD").Symbol,s="function"==typeof o;(t.exports=function(t){return i[t]||(i[t]=s&&o[t]||(s?o:r)("Symbol."+t))}).store=i},dVOP:function(t,e,n){"use strict";function i(t){this.message=t}i.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},i.prototype.__CANCEL__=!0,t.exports=i},dY0y:function(t,e,n){var i=n("dSzd")("iterator"),r=!1;try{var o=[7][i]();o.return=function(){r=!0},Array.from(o,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var n=!1;try{var o=[7],s=o[i]();s.next=function(){return{done:n=!0}},o[i]=function(){return s},t(o)}catch(t){}return n}},dxT3:function(t,e,n){"use strict";(function(t){e.a=function(){var e=t.Canvas||t.HTMLCanvasElement,n=t.Image||t.HTMLImageElement,o=t.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},s=Object(r.a)();return Object(i.a)({Canvas:e||function(){return function(){}}(),CanvasRenderingContext2D:t.CanvasRenderingContext2D||function(){return function(){}}(),Image:n||function(){return function(){}}(),ImageData:t.ImageData||function(){return function(){}}(),Video:t.HTMLVideoElement||function(){return function(){}}(),createCanvasElement:function(){if(e)return new e;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},createImageElement:function(){if(n)return new n;throw new Error("createImageElement - missing Image implementation for nodejs environment")},fetch:o},s)};var i=n("TToO"),r=n("pcbz")}).call(e,n("DuR2"))},e0Bm:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=60)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},10:function(t,e){t.exports=n("HJMx")},12:function(t,e){t.exports=n("ISYW")},15:function(t,e){t.exports=n("fEB+")},16:function(t,e){t.exports=n("02w1")},17:function(t,e){t.exports=n("ON3O")},21:function(t,e){t.exports=n("E/in")},22:function(t,e){t.exports=n("1oZe")},3:function(t,e){t.exports=n("ylDJ")},31:function(t,e){t.exports=n("zTCi")},33:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-select-dropdown__item",class:{selected:t.itemSelected,"is-disabled":t.disabled||t.groupDisabled||t.limitReached,hover:t.hover},on:{mouseenter:t.hoverItem,click:function(e){return e.stopPropagation(),t.selectOptionClick(e)}}},[t._t("default",[n("span",[t._v(t._s(t.currentLabel))])])],2)};i._withStripped=!0;var r=n(4),o=n.n(r),s=n(3),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l={mixins:[o.a],name:"ElOption",componentName:"ElOption",inject:["select"],props:{value:{required:!0},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},data:function(){return{index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}},computed:{isObject:function(){return"[object object]"===Object.prototype.toString.call(this.value).toLowerCase()},currentLabel:function(){return this.label||(this.isObject?"":this.value)},currentValue:function(){return this.value||this.label||""},itemSelected:function(){return this.select.multiple?this.contains(this.select.value,this.value):this.isEqual(this.value,this.select.value)},limitReached:function(){return!!this.select.multiple&&(!this.itemSelected&&(this.select.value||[]).length>=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel:function(){this.created||this.select.remote||this.dispatch("ElSelect","setSelected")},value:function(t,e){var n=this.select,i=n.remote,r=n.valueKey;if(!this.created&&!i){if(r&&"object"===(void 0===t?"undefined":a(t))&&"object"===(void 0===e?"undefined":a(e))&&t[r]===e[r])return;this.dispatch("ElSelect","setSelected")}}},methods:{isEqual:function(t,e){if(this.isObject){var n=this.select.valueKey;return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)}return t===e},contains:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if(this.isObject){var n=this.select.valueKey;return t&&t.some(function(t){return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)})}return t&&t.indexOf(e)>-1},handleGroupDisabled:function(t){this.groupDisabled=t},hoverItem:function(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this))},selectOptionClick:function(){!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ElSelect","handleOptionClick",[this,!0])},queryChange:function(t){this.visible=new RegExp(Object(s.escapeRegexpString)(t),"i").test(this.currentLabel)||this.created,this.visible||this.select.filteredOptionsCount--}},created:function(){this.select.options.push(this),this.select.cachedOptions.push(this),this.select.optionsCount++,this.select.filteredOptionsCount++,this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled)},beforeDestroy:function(){var t=this.select,e=t.selected,n=t.multiple?e:[e],i=this.select.cachedOptions.indexOf(this),r=n.indexOf(this);i>-1&&r<0&&this.select.cachedOptions.splice(i,1),this.select.onOptionDestroy(this.select.options.indexOf(this))}},u=n(0),c=Object(u.a)(l,i,[],!1,null,null,null);c.options.__file="packages/select/src/option.vue";e.a=c.exports},37:function(t,e){t.exports=n("orbS")},4:function(t,e){t.exports=n("fPll")},5:function(t,e){t.exports=n("fKx3")},6:function(t,e){t.exports=n("y+7x")},60:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleClose,expression:"handleClose"}],staticClass:"el-select",class:[t.selectSize?"el-select--"+t.selectSize:""],on:{click:function(e){return e.stopPropagation(),t.toggleMenu(e)}}},[t.multiple?n("div",{ref:"tags",staticClass:"el-select__tags",style:{"max-width":t.inputWidth-32+"px",width:"100%"}},[t.collapseTags&&t.selected.length?n("span",[n("el-tag",{attrs:{closable:!t.selectDisabled,size:t.collapseTagSize,hit:t.selected[0].hitState,type:"info","disable-transitions":""},on:{close:function(e){t.deleteTag(e,t.selected[0])}}},[n("span",{staticClass:"el-select__tags-text"},[t._v(t._s(t.selected[0].currentLabel))])]),t.selected.length>1?n("el-tag",{attrs:{closable:!1,size:t.collapseTagSize,type:"info","disable-transitions":""}},[n("span",{staticClass:"el-select__tags-text"},[t._v("+ "+t._s(t.selected.length-1))])]):t._e()],1):t._e(),t.collapseTags?t._e():n("transition-group",{on:{"after-leave":t.resetInputHeight}},t._l(t.selected,function(e){return n("el-tag",{key:t.getValueKey(e),attrs:{closable:!t.selectDisabled,size:t.collapseTagSize,hit:e.hitState,type:"info","disable-transitions":""},on:{close:function(n){t.deleteTag(n,e)}}},[n("span",{staticClass:"el-select__tags-text"},[t._v(t._s(e.currentLabel))])])}),1),t.filterable?n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"input",staticClass:"el-select__input",class:[t.selectSize?"is-"+t.selectSize:""],style:{"flex-grow":"1",width:t.inputLength/(t.inputWidth-32)+"%","max-width":t.inputWidth-42+"px"},attrs:{type:"text",disabled:t.selectDisabled,autocomplete:t.autoComplete||t.autocomplete},domProps:{value:t.query},on:{focus:t.handleFocus,blur:function(e){t.softFocus=!1},keyup:t.managePlaceholder,keydown:[t.resetInputState,function(e){if(!("button"in e)&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"]))return null;e.preventDefault(),t.navigateOptions("next")},function(e){if(!("button"in e)&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"]))return null;e.preventDefault(),t.navigateOptions("prev")},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.preventDefault(),t.selectOption(e)):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"]))return null;e.stopPropagation(),e.preventDefault(),t.visible=!1},function(e){return"button"in e||!t._k(e.keyCode,"delete",[8,46],e.key,["Backspace","Delete","Del"])?t.deletePrevTag(e):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.visible=!1}],compositionstart:t.handleComposition,compositionupdate:t.handleComposition,compositionend:t.handleComposition,input:[function(e){e.target.composing||(t.query=e.target.value)},t.debouncedQueryChange]}}):t._e()],1):t._e(),n("el-input",{ref:"reference",class:{"is-focus":t.visible},attrs:{type:"text",placeholder:t.currentPlaceholder,name:t.name,id:t.id,autocomplete:t.autoComplete||t.autocomplete,size:t.selectSize,disabled:t.selectDisabled,readonly:t.readonly,"validate-event":!1,tabindex:t.multiple&&t.filterable?"-1":null},on:{focus:t.handleFocus,blur:t.handleBlur},nativeOn:{keyup:function(e){return t.debouncedOnInputChange(e)},keydown:[function(e){if(!("button"in e)&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"]))return null;e.stopPropagation(),e.preventDefault(),t.navigateOptions("next")},function(e){if(!("button"in e)&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"]))return null;e.stopPropagation(),e.preventDefault(),t.navigateOptions("prev")},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.preventDefault(),t.selectOption(e)):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"]))return null;e.stopPropagation(),e.preventDefault(),t.visible=!1},function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.visible=!1}],paste:function(e){return t.debouncedOnInputChange(e)},mouseenter:function(e){t.inputHovering=!0},mouseleave:function(e){t.inputHovering=!1}},model:{value:t.selectedLabel,callback:function(e){t.selectedLabel=e},expression:"selectedLabel"}},[t.$slots.prefix?n("template",{slot:"prefix"},[t._t("prefix")],2):t._e(),n("template",{slot:"suffix"},[n("i",{directives:[{name:"show",rawName:"v-show",value:!t.showClose,expression:"!showClose"}],class:["el-select__caret","el-input__icon","el-icon-"+t.iconClass]}),t.showClose?n("i",{staticClass:"el-select__caret el-input__icon el-icon-circle-close",on:{click:t.handleClearClick}}):t._e()])],2),n("transition",{attrs:{name:"el-zoom-in-top"},on:{"before-enter":t.handleMenuEnter,"after-leave":t.doDestroy}},[n("el-select-menu",{directives:[{name:"show",rawName:"v-show",value:t.visible&&!1!==t.emptyText,expression:"visible && emptyText !== false"}],ref:"popper",attrs:{"append-to-body":t.popperAppendToBody}},[n("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:t.options.length>0&&!t.loading,expression:"options.length > 0 && !loading"}],ref:"scrollbar",class:{"is-empty":!t.allowCreate&&t.query&&0===t.filteredOptionsCount},attrs:{tag:"ul","wrap-class":"el-select-dropdown__wrap","view-class":"el-select-dropdown__list"}},[t.showNewOption?n("el-option",{attrs:{value:t.query,created:""}}):t._e(),t._t("default")],2),t.emptyText&&(!t.allowCreate||t.loading||t.allowCreate&&0===t.options.length)?[t.$slots.empty?t._t("empty"):n("p",{staticClass:"el-select-dropdown__empty"},[t._v("\n "+t._s(t.emptyText)+"\n ")])]:t._e()],2)],1)],1)};i._withStripped=!0;var r=n(4),o=n.n(r),s=n(22),a=n.n(s),l=n(6),u=n.n(l),c=n(10),h=n.n(c),p=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-select-dropdown el-popper",class:[{"is-multiple":this.$parent.multiple},this.popperClass],style:{minWidth:this.minWidth}},[this._t("default")],2)};p._withStripped=!0;var d=n(5),f={name:"ElSelectDropdown",componentName:"ElSelectDropdown",mixins:[n.n(d).a],props:{placement:{default:"bottom-start"},boundariesPadding:{default:0},popperOptions:{default:function(){return{gpuAcceleration:!1}}},visibleArrow:{default:!0},appendToBody:{type:Boolean,default:!0}},data:function(){return{minWidth:""}},computed:{popperClass:function(){return this.$parent.popperClass}},watch:{"$parent.inputWidth":function(){this.minWidth=this.$parent.$el.getBoundingClientRect().width+"px"}},mounted:function(){var t=this;this.referenceElm=this.$parent.$refs.reference.$el,this.$parent.popperElm=this.popperElm=this.$el,this.$on("updatePopper",function(){t.$parent.visible&&t.updatePopper()}),this.$on("destroyPopper",this.destroyPopper)}},g=n(0),m=Object(g.a)(f,p,[],!1,null,null,null);m.options.__file="packages/select/src/select-dropdown.vue";var v=m.exports,_=n(33),y=n(37),b=n.n(y),T=n(15),E=n.n(T),C=n(17),S=n.n(C),w=n(12),k=n.n(w),x=n(16),I=n(31),R=n.n(I),O=n(3),D=n(21),A={mixins:[o.a,u.a,a()("reference"),{data:function(){return{hoverOption:-1}},computed:{optionsAllDisabled:function(){return this.options.filter(function(t){return t.visible}).every(function(t){return t.disabled})}},watch:{hoverIndex:function(t){var e=this;"number"==typeof t&&t>-1&&(this.hoverOption=this.options[t]||{}),this.options.forEach(function(t){t.hover=e.hoverOption===t})}},methods:{navigateOptions:function(t){var e=this;if(this.visible){if(0!==this.options.length&&0!==this.filteredOptionsCount&&!this.optionsAllDisabled){"next"===t?(this.hoverIndex++,this.hoverIndex===this.options.length&&(this.hoverIndex=0)):"prev"===t&&(this.hoverIndex--,this.hoverIndex<0&&(this.hoverIndex=this.options.length-1));var n=this.options[this.hoverIndex];!0!==n.disabled&&!0!==n.groupDisabled&&n.visible||this.navigateOptions(t),this.$nextTick(function(){return e.scrollToOption(e.hoverOption)})}}else this.visible=!0}}}],name:"ElSelect",componentName:"ElSelect",inject:{elForm:{default:""},elFormItem:{default:""}},provide:function(){return{select:this}},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},readonly:function(){return!this.filterable||this.multiple||!Object(O.isIE)()&&!Object(O.isEdge)()&&!this.visible},showClose:function(){var t=this.multiple?Array.isArray(this.value)&&this.value.length>0:void 0!==this.value&&null!==this.value&&""!==this.value;return this.clearable&&!this.selectDisabled&&this.inputHovering&&t},iconClass:function(){return this.remote&&this.filterable?"":this.visible?"arrow-up is-reverse":"arrow-up"},debounce:function(){return this.remote?300:0},emptyText:function(){return this.loading?this.loadingText||this.t("el.select.loading"):(!this.remote||""!==this.query||0!==this.options.length)&&(this.filterable&&this.query&&this.options.length>0&&0===this.filteredOptionsCount?this.noMatchText||this.t("el.select.noMatch"):0===this.options.length?this.noDataText||this.t("el.select.noData"):null)},showNewOption:function(){var t=this,e=this.options.filter(function(t){return!t.created}).some(function(e){return e.currentLabel===t.query});return this.filterable&&this.allowCreate&&""!==this.query&&!e},selectSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},selectDisabled:function(){return this.disabled||(this.elForm||{}).disabled},collapseTagSize:function(){return["small","mini"].indexOf(this.selectSize)>-1?"mini":"small"},propPlaceholder:function(){return void 0!==this.placeholder?this.placeholder:this.t("el.select.placeholder")}},components:{ElInput:h.a,ElSelectMenu:v,ElOption:_.a,ElTag:b.a,ElScrollbar:E.a},directives:{Clickoutside:k.a},props:{name:String,id:String,value:{required:!0},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:function(t){return!0}},automaticDropdown:Boolean,size:String,disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:String,remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String,required:!1},defaultFirstOption:Boolean,reserveKeyword:Boolean,valueKey:{type:String,default:"value"},collapseTags:Boolean,popperAppendToBody:{type:Boolean,default:!0}},data:function(){return{options:[],cachedOptions:[],createdLabel:null,createdSelected:!1,selected:this.multiple?[]:{},inputLength:20,inputWidth:0,initialInputHeight:0,cachedPlaceHolder:"",optionsCount:0,filteredOptionsCount:0,visible:!1,softFocus:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,currentPlaceholder:"",menuVisibleOnFocus:!1,isOnComposition:!1,isSilentBlur:!1}},watch:{selectDisabled:function(){var t=this;this.$nextTick(function(){t.resetInputHeight()})},propPlaceholder:function(t){this.cachedPlaceHolder=this.currentPlaceholder=t},value:function(t,e){this.multiple&&(this.resetInputHeight(),t&&t.length>0||this.$refs.input&&""!==this.query?this.currentPlaceholder="":this.currentPlaceholder=this.cachedPlaceHolder,this.filterable&&!this.reserveKeyword&&(this.query="",this.handleQueryChange(this.query))),this.setSelected(),this.filterable&&!this.multiple&&(this.inputLength=20),Object(O.valueEquals)(t,e)||this.dispatch("ElFormItem","el.form.change",t)},visible:function(t){var e=this;t?(this.broadcast("ElSelectDropdown","updatePopper"),this.filterable&&(this.query=this.remote?"":this.selectedLabel,this.handleQueryChange(this.query),this.multiple?this.$refs.input.focus():(this.remote||(this.broadcast("ElOption","queryChange",""),this.broadcast("ElOptionGroup","queryChange")),this.selectedLabel&&(this.currentPlaceholder=this.selectedLabel,this.selectedLabel="")))):(this.broadcast("ElSelectDropdown","destroyPopper"),this.$refs.input&&this.$refs.input.blur(),this.query="",this.previousQuery=null,this.selectedLabel="",this.inputLength=20,this.menuVisibleOnFocus=!1,this.resetHoverIndex(),this.$nextTick(function(){e.$refs.input&&""===e.$refs.input.value&&0===e.selected.length&&(e.currentPlaceholder=e.cachedPlaceHolder)}),this.multiple||(this.selected&&(this.filterable&&this.allowCreate&&this.createdSelected&&this.createdLabel?this.selectedLabel=this.createdLabel:this.selectedLabel=this.selected.currentLabel,this.filterable&&(this.query=this.selectedLabel)),this.filterable&&(this.currentPlaceholder=this.cachedPlaceHolder))),this.$emit("visible-change",t)},options:function(){var t=this;if(!this.$isServer){this.$nextTick(function(){t.broadcast("ElSelectDropdown","updatePopper")}),this.multiple&&this.resetInputHeight();var e=this.$el.querySelectorAll("input");-1===[].indexOf.call(e,document.activeElement)&&this.setSelected(),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()}}},methods:{handleComposition:function(t){var e=this,n=t.target.value;if("compositionend"===t.type)this.isOnComposition=!1,this.$nextTick(function(t){return e.handleQueryChange(n)});else{var i=n[n.length-1]||"";this.isOnComposition=!Object(D.isKorean)(i)}},handleQueryChange:function(t){var e=this;this.previousQuery===t||this.isOnComposition||(null!==this.previousQuery||"function"!=typeof this.filterMethod&&"function"!=typeof this.remoteMethod?(this.previousQuery=t,this.$nextTick(function(){e.visible&&e.broadcast("ElSelectDropdown","updatePopper")}),this.hoverIndex=-1,this.multiple&&this.filterable&&this.$nextTick(function(){var t=15*e.$refs.input.value.length+20;e.inputLength=e.collapseTags?Math.min(50,t):t,e.managePlaceholder(),e.resetInputHeight()}),this.remote&&"function"==typeof this.remoteMethod?(this.hoverIndex=-1,this.remoteMethod(t)):"function"==typeof this.filterMethod?(this.filterMethod(t),this.broadcast("ElOptionGroup","queryChange")):(this.filteredOptionsCount=this.optionsCount,this.broadcast("ElOption","queryChange",t),this.broadcast("ElOptionGroup","queryChange")),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()):this.previousQuery=t)},scrollToOption:function(t){var e=Array.isArray(t)&&t[0]?t[0].$el:t.$el;if(this.$refs.popper&&e){var n=this.$refs.popper.$el.querySelector(".el-select-dropdown__wrap");R()(n,e)}this.$refs.scrollbar&&this.$refs.scrollbar.handleScroll()},handleMenuEnter:function(){var t=this;this.$nextTick(function(){return t.scrollToOption(t.selected)})},emitChange:function(t){Object(O.valueEquals)(this.value,t)||this.$emit("change",t)},getOption:function(t){for(var e=void 0,n="[object object]"===Object.prototype.toString.call(t).toLowerCase(),i="[object null]"===Object.prototype.toString.call(t).toLowerCase(),r="[object undefined]"===Object.prototype.toString.call(t).toLowerCase(),o=this.cachedOptions.length-1;o>=0;o--){var s=this.cachedOptions[o];if(n?Object(O.getValueByPath)(s.value,this.valueKey)===Object(O.getValueByPath)(t,this.valueKey):s.value===t){e=s;break}}if(e)return e;var a={value:t,currentLabel:n||i||r?"":String(t)};return this.multiple&&(a.hitState=!1),a},setSelected:function(){var t=this;if(!this.multiple){var e=this.getOption(this.value);return e.created?(this.createdLabel=e.currentLabel,this.createdSelected=!0):this.createdSelected=!1,this.selectedLabel=e.currentLabel,this.selected=e,void(this.filterable&&(this.query=this.selectedLabel))}var n=[];Array.isArray(this.value)&&this.value.forEach(function(e){n.push(t.getOption(e))}),this.selected=n,this.$nextTick(function(){t.resetInputHeight()})},handleFocus:function(t){this.softFocus?this.softFocus=!1:((this.automaticDropdown||this.filterable)&&(this.visible=!0,this.filterable&&(this.menuVisibleOnFocus=!0)),this.$emit("focus",t))},blur:function(){this.visible=!1,this.$refs.reference.blur()},handleBlur:function(t){var e=this;setTimeout(function(){e.isSilentBlur?e.isSilentBlur=!1:e.$emit("blur",t)},50),this.softFocus=!1},handleClearClick:function(t){this.deleteSelected(t)},doDestroy:function(){this.$refs.popper&&this.$refs.popper.doDestroy()},handleClose:function(){this.visible=!1},toggleLastOptionHitState:function(t){if(Array.isArray(this.selected)){var e=this.selected[this.selected.length-1];if(e)return!0===t||!1===t?(e.hitState=t,t):(e.hitState=!e.hitState,e.hitState)}},deletePrevTag:function(t){if(t.target.value.length<=0&&!this.toggleLastOptionHitState()){var e=this.value.slice();e.pop(),this.$emit("input",e),this.emitChange(e)}},managePlaceholder:function(){""!==this.currentPlaceholder&&(this.currentPlaceholder=this.$refs.input.value?"":this.cachedPlaceHolder)},resetInputState:function(t){8!==t.keyCode&&this.toggleLastOptionHitState(!1),this.inputLength=15*this.$refs.input.value.length+20,this.resetInputHeight()},resetInputHeight:function(){var t=this;this.collapseTags&&!this.filterable||this.$nextTick(function(){if(t.$refs.reference){var e=t.$refs.reference.$el.childNodes,n=[].filter.call(e,function(t){return"INPUT"===t.tagName})[0],i=t.$refs.tags,r=t.initialInputHeight||40;n.style.height=0===t.selected.length?r+"px":Math.max(i?i.clientHeight+(i.clientHeight>r?6:0):0,r)+"px",t.visible&&!1!==t.emptyText&&t.broadcast("ElSelectDropdown","updatePopper")}})},resetHoverIndex:function(){var t=this;setTimeout(function(){t.multiple?t.selected.length>0?t.hoverIndex=Math.min.apply(null,t.selected.map(function(e){return t.options.indexOf(e)})):t.hoverIndex=-1:t.hoverIndex=t.options.indexOf(t.selected)},300)},handleOptionSelect:function(t,e){var n=this;if(this.multiple){var i=(this.value||[]).slice(),r=this.getValueIndex(i,t.value);r>-1?i.splice(r,1):(this.multipleLimit<=0||i.length<this.multipleLimit)&&i.push(t.value),this.$emit("input",i),this.emitChange(i),t.created&&(this.query="",this.handleQueryChange(""),this.inputLength=20),this.filterable&&this.$refs.input.focus()}else this.$emit("input",t.value),this.emitChange(t.value),this.visible=!1;this.isSilentBlur=e,this.setSoftFocus(),this.visible||this.$nextTick(function(){n.scrollToOption(t)})},setSoftFocus:function(){this.softFocus=!0;var t=this.$refs.input||this.$refs.reference;t&&t.focus()},getValueIndex:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if("[object object]"===Object.prototype.toString.call(e).toLowerCase()){var n=this.valueKey,i=-1;return t.some(function(t,r){return Object(O.getValueByPath)(t,n)===Object(O.getValueByPath)(e,n)&&(i=r,!0)}),i}return t.indexOf(e)},toggleMenu:function(){this.selectDisabled||(this.menuVisibleOnFocus?this.menuVisibleOnFocus=!1:this.visible=!this.visible,this.visible&&(this.$refs.input||this.$refs.reference).focus())},selectOption:function(){this.visible?this.options[this.hoverIndex]&&this.handleOptionSelect(this.options[this.hoverIndex]):this.toggleMenu()},deleteSelected:function(t){t.stopPropagation();var e=this.multiple?[]:"";this.$emit("input",e),this.emitChange(e),this.visible=!1,this.$emit("clear")},deleteTag:function(t,e){var n=this.selected.indexOf(e);if(n>-1&&!this.selectDisabled){var i=this.value.slice();i.splice(n,1),this.$emit("input",i),this.emitChange(i),this.$emit("remove-tag",e.value)}t.stopPropagation()},onInputChange:function(){this.filterable&&this.query!==this.selectedLabel&&(this.query=this.selectedLabel,this.handleQueryChange(this.query))},onOptionDestroy:function(t){t>-1&&(this.optionsCount--,this.filteredOptionsCount--,this.options.splice(t,1))},resetInputWidth:function(){this.inputWidth=this.$refs.reference.$el.getBoundingClientRect().width},handleResize:function(){this.resetInputWidth(),this.multiple&&this.resetInputHeight()},checkDefaultFirstOption:function(){this.hoverIndex=-1;for(var t=!1,e=this.options.length-1;e>=0;e--)if(this.options[e].created){t=!0,this.hoverIndex=e;break}if(!t)for(var n=0;n!==this.options.length;++n){var i=this.options[n];if(this.query){if(!i.disabled&&!i.groupDisabled&&i.visible){this.hoverIndex=n;break}}else if(i.itemSelected){this.hoverIndex=n;break}}},getValueKey:function(t){return"[object object]"!==Object.prototype.toString.call(t.value).toLowerCase()?t.value:Object(O.getValueByPath)(t.value,this.valueKey)}},created:function(){var t=this;this.cachedPlaceHolder=this.currentPlaceholder=this.propPlaceholder,this.multiple&&!Array.isArray(this.value)&&this.$emit("input",[]),!this.multiple&&Array.isArray(this.value)&&this.$emit("input",""),this.debouncedOnInputChange=S()(this.debounce,function(){t.onInputChange()}),this.debouncedQueryChange=S()(this.debounce,function(e){t.handleQueryChange(e.target.value)}),this.$on("handleOptionClick",this.handleOptionSelect),this.$on("setSelected",this.setSelected)},mounted:function(){var t=this;this.multiple&&Array.isArray(this.value)&&this.value.length>0&&(this.currentPlaceholder=""),Object(x.addResizeListener)(this.$el,this.handleResize);var e=this.$refs.reference;if(e&&e.$el){var n=e.$el.querySelector("input");this.initialInputHeight=n.getBoundingClientRect().height||{medium:36,small:32,mini:28}[this.selectSize]}this.remote&&this.multiple&&this.resetInputHeight(),this.$nextTick(function(){e&&e.$el&&(t.inputWidth=e.$el.getBoundingClientRect().width)}),this.setSelected()},beforeDestroy:function(){this.$el&&this.handleResize&&Object(x.removeResizeListener)(this.$el,this.handleResize)}},M=Object(g.a)(A,i,[],!1,null,null,null);M.options.__file="packages/select/src/select.vue";var N=M.exports;N.install=function(t){t.component(N.name,N)};e.default=N}})},e6n0:function(t,e,n){var i=n("evD5").f,r=n("D2L2"),o=n("dSzd")("toStringTag");t.exports=function(t,e,n){t&&!r(t=n?t:t.prototype,o)&&i(t,o,{configurable:!0,value:e})}},e8AB:function(t,e,n){var i=n("FeBl"),r=n("7KvD"),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:i.version,mode:n("O4g8")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},eNfa:function(t,e,n){"use strict";var i;!function(r){var o={},s=/d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,a="[^\\s]+",l=/\[([^]*?)\]/gm,u=function(){};function c(t,e){for(var n=[],i=0,r=t.length;i<r;i++)n.push(t[i].substr(0,e));return n}function h(t){return function(e,n,i){var r=i[t].indexOf(n.charAt(0).toUpperCase()+n.substr(1).toLowerCase());~r&&(e.month=r)}}function p(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t}var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],g=c(f,3),m=c(d,3);o.i18n={dayNamesShort:m,dayNames:d,monthNamesShort:g,monthNames:f,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10)*t%10]}};var v={D:function(t){return t.getDay()},DD:function(t){return p(t.getDay())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return t.getDate()},dd:function(t){return p(t.getDate())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return t.getMonth()+1},MM:function(t){return p(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},yy:function(t){return p(String(t.getFullYear()),4).substr(2)},yyyy:function(t){return p(t.getFullYear(),4)},h:function(t){return t.getHours()%12||12},hh:function(t){return p(t.getHours()%12||12)},H:function(t){return t.getHours()},HH:function(t){return p(t.getHours())},m:function(t){return t.getMinutes()},mm:function(t){return p(t.getMinutes())},s:function(t){return t.getSeconds()},ss:function(t){return p(t.getSeconds())},S:function(t){return Math.round(t.getMilliseconds()/100)},SS:function(t){return p(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return p(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+p(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)}},_={d:["\\d\\d?",function(t,e){t.day=e}],Do:["\\d\\d?"+a,function(t,e){t.day=parseInt(e,10)}],M:["\\d\\d?",function(t,e){t.month=e-1}],yy:["\\d\\d?",function(t,e){var n=+(""+(new Date).getFullYear()).substr(0,2);t.year=""+(e>68?n-1:n)+e}],h:["\\d\\d?",function(t,e){t.hour=e}],m:["\\d\\d?",function(t,e){t.minute=e}],s:["\\d\\d?",function(t,e){t.second=e}],yyyy:["\\d{4}",function(t,e){t.year=e}],S:["\\d",function(t,e){t.millisecond=100*e}],SS:["\\d{2}",function(t,e){t.millisecond=10*e}],SSS:["\\d{3}",function(t,e){t.millisecond=e}],D:["\\d\\d?",u],ddd:[a,u],MMM:[a,h("monthNamesShort")],MMMM:[a,h("monthNames")],a:[a,function(t,e,n){var i=e.toLowerCase();i===n.amPm[0]?t.isPm=!1:i===n.amPm[1]&&(t.isPm=!0)}],ZZ:["[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z",function(t,e){var n,i=(e+"").match(/([+-]|\d\d)/gi);i&&(n=60*i[1]+parseInt(i[2],10),t.timezoneOffset="+"===i[0]?n:-n)}]};_.dd=_.d,_.dddd=_.ddd,_.DD=_.D,_.mm=_.m,_.hh=_.H=_.HH=_.h,_.MM=_.M,_.ss=_.s,_.A=_.a,o.masks={default:"ddd MMM dd yyyy HH:mm:ss",shortDate:"M/D/yy",mediumDate:"MMM d, yyyy",longDate:"MMMM d, yyyy",fullDate:"dddd, MMMM d, yyyy",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},o.format=function(t,e,n){var i=n||o.i18n;if("number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date in fecha.format");var r=[];return(e=(e=(e=o.masks[e]||e||o.masks.default).replace(l,function(t,e){return r.push(e),"@@@"})).replace(s,function(e){return e in v?v[e](t,i):e.slice(1,e.length-1)})).replace(/@@@/g,function(){return r.shift()})},o.parse=function(t,e,n){var i=n||o.i18n;if("string"!=typeof e)throw new Error("Invalid format in fecha.parse");if(e=o.masks[e]||e,t.length>1e3)return null;var r={},a=[],u=[];e=e.replace(l,function(t,e){return u.push(e),"@@@"});var c,h=(c=e,c.replace(/[|\\{()[^$+*?.-]/g,"\\$&")).replace(s,function(t){if(_[t]){var e=_[t];return a.push(e[1]),"("+e[0]+")"}return t});h=h.replace(/@@@/g,function(){return u.shift()});var p=t.match(new RegExp(h,"i"));if(!p)return null;for(var d=1;d<p.length;d++)a[d-1](r,p[d],i);var f,g=new Date;return!0===r.isPm&&null!=r.hour&&12!=+r.hour?r.hour=+r.hour+12:!1===r.isPm&&12==+r.hour&&(r.hour=0),null!=r.timezoneOffset?(r.minute=+(r.minute||0)-+r.timezoneOffset,f=new Date(Date.UTC(r.year||g.getFullYear(),r.month||0,r.day||1,r.hour||0,r.minute||0,r.second||0,r.millisecond||0))):f=new Date(r.year||g.getFullYear(),r.month||0,r.day||1,r.hour||0,r.minute||0,r.second||0,r.millisecond||0),f},void 0!==t&&t.exports?t.exports=o:void 0===(i=function(){return o}.call(e,n,e,t))||(t.exports=i)}()},evD5:function(t,e,n){var i=n("77Pl"),r=n("SfB7"),o=n("MmMw"),s=Object.defineProperty;e.f=n("+E39")?Object.defineProperty:function(t,e,n){if(i(t),e=o(e,!0),i(n),r)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},exGp:function(t,e,n){"use strict";e.__esModule=!0;var i,r=n("//Fk"),o=(i=r)&&i.__esModule?i:{default:i};e.default=function(t){return function(){var e=t.apply(this,arguments);return new o.default(function(t,n){return function i(r,s){try{var a=e[r](s),l=a.value}catch(t){return void n(t)}if(!a.done)return o.default.resolve(l).then(function(t){i("next",t)},function(t){i("throw",t)});t(l)}("next")})}}},"fEB+":function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=131)}({131:function(t,e,n){"use strict";n.r(e);var i=n(16),r=n(38),o=n.n(r),s=n(3),a=n(2),l={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}};var u={name:"Bar",props:{vertical:Boolean,size:String,move:Number},computed:{bar:function(){return l[this.vertical?"vertical":"horizontal"]},wrap:function(){return this.$parent.wrap}},render:function(t){var e=this.size,n=this.move,i=this.bar;return t("div",{class:["el-scrollbar__bar","is-"+i.key],on:{mousedown:this.clickTrackHandler}},[t("div",{ref:"thumb",class:"el-scrollbar__thumb",on:{mousedown:this.clickThumbHandler},style:function(t){var e=t.move,n=t.size,i=t.bar,r={},o="translate"+i.axis+"("+e+"%)";return r[i.size]=n,r.transform=o,r.msTransform=o,r.webkitTransform=o,r}({size:e,move:n,bar:i})})])},methods:{clickThumbHandler:function(t){t.ctrlKey||2===t.button||(this.startDrag(t),this[this.bar.axis]=t.currentTarget[this.bar.offset]-(t[this.bar.client]-t.currentTarget.getBoundingClientRect()[this.bar.direction]))},clickTrackHandler:function(t){var e=100*(Math.abs(t.target.getBoundingClientRect()[this.bar.direction]-t[this.bar.client])-this.$refs.thumb[this.bar.offset]/2)/this.$el[this.bar.offset];this.wrap[this.bar.scroll]=e*this.wrap[this.bar.scrollSize]/100},startDrag:function(t){t.stopImmediatePropagation(),this.cursorDown=!0,Object(a.on)(document,"mousemove",this.mouseMoveDocumentHandler),Object(a.on)(document,"mouseup",this.mouseUpDocumentHandler),document.onselectstart=function(){return!1}},mouseMoveDocumentHandler:function(t){if(!1!==this.cursorDown){var e=this[this.bar.axis];if(e){var n=100*(-1*(this.$el.getBoundingClientRect()[this.bar.direction]-t[this.bar.client])-(this.$refs.thumb[this.bar.offset]-e))/this.$el[this.bar.offset];this.wrap[this.bar.scroll]=n*this.wrap[this.bar.scrollSize]/100}}},mouseUpDocumentHandler:function(t){this.cursorDown=!1,this[this.bar.axis]=0,Object(a.off)(document,"mousemove",this.mouseMoveDocumentHandler),document.onselectstart=null}},destroyed:function(){Object(a.off)(document,"mouseup",this.mouseUpDocumentHandler)}},c={name:"ElScrollbar",components:{Bar:u},props:{native:Boolean,wrapStyle:{},wrapClass:{},viewClass:{},viewStyle:{},noresize:Boolean,tag:{type:String,default:"div"}},data:function(){return{sizeWidth:"0",sizeHeight:"0",moveX:0,moveY:0}},computed:{wrap:function(){return this.$refs.wrap}},render:function(t){var e=o()(),n=this.wrapStyle;if(e){var i="-"+e+"px",r="margin-bottom: "+i+"; margin-right: "+i+";";Array.isArray(this.wrapStyle)?(n=Object(s.toObject)(this.wrapStyle)).marginRight=n.marginBottom=i:"string"==typeof this.wrapStyle?n+=r:n=r}var a=t(this.tag,{class:["el-scrollbar__view",this.viewClass],style:this.viewStyle,ref:"resize"},this.$slots.default),l=t("div",{ref:"wrap",style:n,on:{scroll:this.handleScroll},class:[this.wrapClass,"el-scrollbar__wrap",e?"":"el-scrollbar__wrap--hidden-default"]},[[a]]);return t("div",{class:"el-scrollbar"},this.native?[t("div",{ref:"wrap",class:[this.wrapClass,"el-scrollbar__wrap"],style:n},[[a]])]:[l,t(u,{attrs:{move:this.moveX,size:this.sizeWidth}}),t(u,{attrs:{vertical:!0,move:this.moveY,size:this.sizeHeight}})])},methods:{handleScroll:function(){var t=this.wrap;this.moveY=100*t.scrollTop/t.clientHeight,this.moveX=100*t.scrollLeft/t.clientWidth},update:function(){var t,e,n=this.wrap;n&&(t=100*n.clientHeight/n.scrollHeight,e=100*n.clientWidth/n.scrollWidth,this.sizeHeight=t<100?t+"%":"",this.sizeWidth=e<100?e+"%":"")}},mounted:function(){this.native||(this.$nextTick(this.update),!this.noresize&&Object(i.addResizeListener)(this.$refs.resize,this.update))},beforeDestroy:function(){this.native||!this.noresize&&Object(i.removeResizeListener)(this.$refs.resize,this.update)},install:function(t){t.component(c.name,c)}};e.default=c},16:function(t,e){t.exports=n("02w1")},2:function(t,e){t.exports=n("2kvA")},3:function(t,e){t.exports=n("ylDJ")},38:function(t,e){t.exports=n("6Twh")}})},fJUb:function(t,e,n){var i=n("77Pl"),r=n("EqjI"),o=n("qARP");t.exports=function(t,e){if(i(t),r(e)&&e.constructor===t)return e;var n=o.f(t);return(0,n.resolve)(e),n.promise}},fKx3:function(t,e,n){"use strict";e.__esModule=!0;var i,r=n("7+uW"),o=(i=r)&&i.__esModule?i:{default:i},s=n("7J9s");var a=o.default.prototype.$isServer?function(){}:n("NMof"),l=function(t){return t.stopPropagation()};e.default={props:{transformOrigin:{type:[Boolean,String],default:!0},placement:{type:String,default:"bottom"},boundariesPadding:{type:Number,default:5},reference:{},popper:{},offset:{default:0},value:Boolean,visibleArrow:Boolean,arrowOffset:{type:Number,default:35},appendToBody:{type:Boolean,default:!0},popperOptions:{type:Object,default:function(){return{gpuAcceleration:!1}}}},data:function(){return{showPopper:!1,currentPlacement:""}},watch:{value:{immediate:!0,handler:function(t){this.showPopper=t,this.$emit("input",t)}},showPopper:function(t){this.disabled||(t?this.updatePopper():this.destroyPopper(),this.$emit("input",t))}},methods:{createPopper:function(){var t=this;if(!this.$isServer&&(this.currentPlacement=this.currentPlacement||this.placement,/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement))){var e=this.popperOptions,n=this.popperElm=this.popperElm||this.popper||this.$refs.popper,i=this.referenceElm=this.referenceElm||this.reference||this.$refs.reference;!i&&this.$slots.reference&&this.$slots.reference[0]&&(i=this.referenceElm=this.$slots.reference[0].elm),n&&i&&(this.visibleArrow&&this.appendArrow(n),this.appendToBody&&document.body.appendChild(this.popperElm),this.popperJS&&this.popperJS.destroy&&this.popperJS.destroy(),e.placement=this.currentPlacement,e.offset=this.offset,e.arrowOffset=this.arrowOffset,this.popperJS=new a(i,n,e),this.popperJS.onCreate(function(e){t.$emit("created",t),t.resetTransformOrigin(),t.$nextTick(t.updatePopper)}),"function"==typeof e.onUpdate&&this.popperJS.onUpdate(e.onUpdate),this.popperJS._popper.style.zIndex=s.PopupManager.nextZIndex(),this.popperElm.addEventListener("click",l))}},updatePopper:function(){var t=this.popperJS;t?(t.update(),t._popper&&(t._popper.style.zIndex=s.PopupManager.nextZIndex())):this.createPopper()},doDestroy:function(t){!this.popperJS||this.showPopper&&!t||(this.popperJS.destroy(),this.popperJS=null)},destroyPopper:function(){this.popperJS&&this.resetTransformOrigin()},resetTransformOrigin:function(){if(this.transformOrigin){var t=this.popperJS._popper.getAttribute("x-placement").split("-")[0],e={top:"bottom",bottom:"top",left:"right",right:"left"}[t];this.popperJS._popper.style.transformOrigin="string"==typeof this.transformOrigin?this.transformOrigin:["top","bottom"].indexOf(t)>-1?"center "+e:e+" center"}},appendArrow:function(t){var e=void 0;if(!this.appended){for(var n in this.appended=!0,t.attributes)if(/^_v-/.test(t.attributes[n].name)){e=t.attributes[n].name;break}var i=document.createElement("div");e&&i.setAttribute(e,""),i.setAttribute("x-arrow",""),i.className="popper__arrow",t.appendChild(i)}}},beforeDestroy:function(){this.doDestroy(!0),this.popperElm&&this.popperElm.parentNode===document.body&&(this.popperElm.removeEventListener("click",l),document.body.removeChild(this.popperElm))},deactivated:function(){this.$options.beforeDestroy[0].call(this)}}},fPll:function(t,e,n){"use strict";e.__esModule=!0,e.default={methods:{dispatch:function(t,e,n){for(var i=this.$parent||this.$root,r=i.$options.componentName;i&&(!r||r!==t);)(i=i.$parent)&&(r=i.$options.componentName);i&&i.$emit.apply(i,[e].concat(n))},broadcast:function(t,e,n){(function t(e,n,i){this.$children.forEach(function(r){r.$options.componentName===e?r.$emit.apply(r,[n].concat(i)):t.apply(r,[e,n].concat([i]))})}).call(this,t,e,n)}}}},fUqW:function(t,e,n){"use strict";e.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.isVNode=function(t){return null!==t&&"object"===(void 0===t?"undefined":i(t))&&(0,r.hasOwn)(t,"componentOptions")};var r=n("ylDJ")},fWfb:function(t,e,n){"use strict";var i=n("7KvD"),r=n("D2L2"),o=n("+E39"),s=n("kM2E"),a=n("880/"),l=n("06OY").KEY,u=n("S82l"),c=n("e8AB"),h=n("e6n0"),p=n("3Eo+"),d=n("dSzd"),f=n("Kh4W"),g=n("crlp"),m=n("Xc4G"),v=n("7UMu"),_=n("77Pl"),y=n("EqjI"),b=n("sB3e"),T=n("TcQ7"),E=n("MmMw"),C=n("X8DO"),S=n("Yobk"),w=n("Rrel"),k=n("LKZe"),x=n("1kS7"),I=n("evD5"),R=n("lktj"),O=k.f,D=I.f,A=w.f,M=i.Symbol,N=i.JSON,L=N&&N.stringify,P=d("_hidden"),B=d("toPrimitive"),F={}.propertyIsEnumerable,U=c("symbol-registry"),V=c("symbols"),H=c("op-symbols"),W=Object.prototype,G="function"==typeof M&&!!x.f,j=i.QObject,z=!j||!j.prototype||!j.prototype.findChild,$=o&&u(function(){return 7!=S(D({},"a",{get:function(){return D(this,"a",{value:7}).a}})).a})?function(t,e,n){var i=O(W,e);i&&delete W[e],D(t,e,n),i&&t!==W&&D(W,e,i)}:D,X=function(t){var e=V[t]=S(M.prototype);return e._k=t,e},Y=G&&"symbol"==typeof M.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof M},K=function(t,e,n){return t===W&&K(H,e,n),_(t),e=E(e,!0),_(n),r(V,e)?(n.enumerable?(r(t,P)&&t[P][e]&&(t[P][e]=!1),n=S(n,{enumerable:C(0,!1)})):(r(t,P)||D(t,P,C(1,{})),t[P][e]=!0),$(t,e,n)):D(t,e,n)},J=function(t,e){_(t);for(var n,i=m(e=T(e)),r=0,o=i.length;o>r;)K(t,n=i[r++],e[n]);return t},q=function(t){var e=F.call(this,t=E(t,!0));return!(this===W&&r(V,t)&&!r(H,t))&&(!(e||!r(this,t)||!r(V,t)||r(this,P)&&this[P][t])||e)},Z=function(t,e){if(t=T(t),e=E(e,!0),t!==W||!r(V,e)||r(H,e)){var n=O(t,e);return!n||!r(V,e)||r(t,P)&&t[P][e]||(n.enumerable=!0),n}},Q=function(t){for(var e,n=A(T(t)),i=[],o=0;n.length>o;)r(V,e=n[o++])||e==P||e==l||i.push(e);return i},tt=function(t){for(var e,n=t===W,i=A(n?H:T(t)),o=[],s=0;i.length>s;)!r(V,e=i[s++])||n&&!r(W,e)||o.push(V[e]);return o};G||(a((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(n){this===W&&e.call(H,n),r(this,P)&&r(this[P],t)&&(this[P][t]=!1),$(this,t,C(1,n))};return o&&z&&$(W,t,{configurable:!0,set:e}),X(t)}).prototype,"toString",function(){return this._k}),k.f=Z,I.f=K,n("n0T6").f=w.f=Q,n("NpIQ").f=q,x.f=tt,o&&!n("O4g8")&&a(W,"propertyIsEnumerable",q,!0),f.f=function(t){return X(d(t))}),s(s.G+s.W+s.F*!G,{Symbol:M});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)d(et[nt++]);for(var it=R(d.store),rt=0;it.length>rt;)g(it[rt++]);s(s.S+s.F*!G,"Symbol",{for:function(t){return r(U,t+="")?U[t]:U[t]=M(t)},keyFor:function(t){if(!Y(t))throw TypeError(t+" is not a symbol!");for(var e in U)if(U[e]===t)return e},useSetter:function(){z=!0},useSimple:function(){z=!1}}),s(s.S+s.F*!G,"Object",{create:function(t,e){return void 0===e?S(t):J(S(t),e)},defineProperty:K,defineProperties:J,getOwnPropertyDescriptor:Z,getOwnPropertyNames:Q,getOwnPropertySymbols:tt});var ot=u(function(){x.f(1)});s(s.S+s.F*ot,"Object",{getOwnPropertySymbols:function(t){return x.f(b(t))}}),N&&s(s.S+s.F*(!G||u(function(){var t=M();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))})),"JSON",{stringify:function(t){for(var e,n,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);if(n=e=i[1],(y(e)||void 0!==t)&&!Y(t))return v(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Y(e))return e}),i[1]=e,L.apply(N,i)}}),M.prototype[B]||n("hJx8")(M.prototype,B,M.prototype.valueOf),h(M,"Symbol"),h(Math,"Math",!0),h(i.JSON,"JSON",!0)},fZjL:function(t,e,n){t.exports={default:n("jFbC"),__esModule:!0}},fkB2:function(t,e,n){var i=n("UuGF"),r=Math.max,o=Math.min;t.exports=function(t,e){return(t=i(t))<0?r(t+e,0):o(t,e)}},fuGk:function(t,e,n){"use strict";var i=n("cGG2");function r(){this.handlers=[]}r.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},r.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},r.prototype.forEach=function(t){i.forEach(this.handlers,function(e){null!==e&&t(e)})},t.exports=r},fxRn:function(t,e,n){n("+tPU"),n("zQR9"),t.exports=n("g8Ux")},g8Ux:function(t,e,n){var i=n("77Pl"),r=n("3fs2");t.exports=n("FeBl").getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},h65t:function(t,e,n){var i=n("UuGF"),r=n("52gC");t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):o:t?a.slice(l,l+2):s-56320+(o-55296<<10)+65536}}},hJx8:function(t,e,n){var i=n("evD5"),r=n("X8DO");t.exports=n("+E39")?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},hyEB:function(t,e,n){"use strict";e.__esModule=!0;var i=i||{};i.Utils=i.Utils||{},i.Utils.focusFirstDescendant=function(t){for(var e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if(i.Utils.attemptFocus(n)||i.Utils.focusFirstDescendant(n))return!0}return!1},i.Utils.focusLastDescendant=function(t){for(var e=t.childNodes.length-1;e>=0;e--){var n=t.childNodes[e];if(i.Utils.attemptFocus(n)||i.Utils.focusLastDescendant(n))return!0}return!1},i.Utils.attemptFocus=function(t){if(!i.Utils.isFocusable(t))return!1;i.Utils.IgnoreUtilFocusChanges=!0;try{t.focus()}catch(t){}return i.Utils.IgnoreUtilFocusChanges=!1,document.activeElement===t},i.Utils.isFocusable=function(t){if(t.tabIndex>0||0===t.tabIndex&&null!==t.getAttribute("tabIndex"))return!0;if(t.disabled)return!1;switch(t.nodeName){case"A":return!!t.href&&"ignore"!==t.rel;case"INPUT":return"hidden"!==t.type&&"file"!==t.type;case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},i.Utils.triggerEvent=function(t,e){var n=void 0;n=/^mouse|click/.test(e)?"MouseEvents":/^key/.test(e)?"KeyboardEvent":"HTMLEvents";for(var i=document.createEvent(n),r=arguments.length,o=Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return i.initEvent.apply(i,[e].concat(o)),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent("on"+e,i),t},i.Utils.keys={tab:9,enter:13,space:32,left:37,up:38,right:39,down:40,esc:27},e.default=i.Utils},i3rX:function(t,e,n){"use strict";var i=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===r}(t)}(t)};var r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(t,e){var n;return e&&!0===e.clone&&i(t)?a((n=t,Array.isArray(n)?[]:{}),t,e):t}function s(t,e,n){var r=t.slice();return e.forEach(function(e,s){void 0===r[s]?r[s]=o(e,n):i(e)?r[s]=a(t[s],e,n):-1===t.indexOf(e)&&r.push(o(e,n))}),r}function a(t,e,n){var r=Array.isArray(e);return r===Array.isArray(t)?r?((n||{arrayMerge:s}).arrayMerge||s)(t,e,n):function(t,e,n){var r={};return i(t)&&Object.keys(t).forEach(function(e){r[e]=o(t[e],n)}),Object.keys(e).forEach(function(s){i(e[s])&&t[s]?r[s]=a(t[s],e[s],n):r[s]=o(e[s],n)}),r}(t,e,n):o(e,n)}a.all=function(t,e){if(!Array.isArray(t)||t.length<2)throw new Error("first argument should be an array with at least two elements");return t.reduce(function(t,n){return a(t,n,e)})};var l=a;t.exports=l},iMyp:function(t,e,n){"use strict";(function(n,i){e.a=function(){return"object"==typeof n&&void 0!==t&&void 0!==i&&!!i.version}}).call(e,n("DuR2"),n("W2nU"))},iUbK:function(t,e,n){var i=n("7KvD").navigator;t.exports=i&&i.userAgent||""},jFbC:function(t,e,n){n("Cdx3"),t.exports=n("FeBl").Object.keys},"jKW+":function(t,e,n){"use strict";var i=n("kM2E"),r=n("qARP"),o=n("dNDb");i(i.S,"Promise",{try:function(t){var e=r.f(this),n=o(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},jmaC:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t){for(var e=1,n=arguments.length;e<n;e++){var i=arguments[e]||{};for(var r in i)if(i.hasOwnProperty(r)){var o=i[r];void 0!==o&&(t[r]=o)}}return t}},jwfv:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n("Dd8w"),r=n.n(i),o=n("pFYg"),s=n.n(o),a=/%[sdj%]/g,l=function(){};function u(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=1,r=e[0],o=e.length;if("function"==typeof r)return r.apply(null,e.slice(1));if("string"==typeof r){for(var s=String(r).replace(a,function(t){if("%%"===t)return"%";if(i>=o)return t;switch(t){case"%s":return String(e[i++]);case"%d":return Number(e[i++]);case"%j":try{return JSON.stringify(e[i++])}catch(t){return"[Circular]"}break;default:return t}}),l=e[i];i<o;l=e[++i])s+=" "+l;return s}return r}function c(t,e){return void 0===t||null===t||(!("array"!==e||!Array.isArray(t)||t.length)||!(!function(t){return"string"===t||"url"===t||"hex"===t||"email"===t||"pattern"===t}(e)||"string"!=typeof t||t))}function h(t,e,n){var i=0,r=t.length;!function o(s){if(s&&s.length)n(s);else{var a=i;i+=1,a<r?e(t[a],o):n([])}}([])}function p(t,e,n,i){if(e.first)return h(function(t){var e=[];return Object.keys(t).forEach(function(n){e.push.apply(e,t[n])}),e}(t),n,i);var r=e.firstFields||[];!0===r&&(r=Object.keys(t));var o=Object.keys(t),s=o.length,a=0,l=[],u=function(t){l.push.apply(l,t),++a===s&&i(l)};o.forEach(function(e){var i=t[e];-1!==r.indexOf(e)?h(i,n,u):function(t,e,n){var i=[],r=0,o=t.length;function s(t){i.push.apply(i,t),++r===o&&n(i)}t.forEach(function(t){e(t,s)})}(i,n,u)})}function d(t){return function(e){return e&&e.message?(e.field=e.field||t.fullField,e):{message:e,field:e.field||t.fullField}}}function f(t,e){if(e)for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];"object"===(void 0===i?"undefined":s()(i))&&"object"===s()(t[n])?t[n]=r()({},t[n],i):t[n]=i}return t}var g=function(t,e,n,i,r,o){!t.required||n.hasOwnProperty(t.field)&&!c(e,o||t.type)||i.push(u(r.messages.required,t.fullField))};var m=function(t,e,n,i,r){(/^\s+$/.test(e)||""===e)&&i.push(u(r.messages.whitespace,t.fullField))},v={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},_={integer:function(t){return _.number(t)&&parseInt(t,10)===t},float:function(t){return _.number(t)&&!_.integer(t)},array:function(t){return Array.isArray(t)},regexp:function(t){if(t instanceof RegExp)return!0;try{return!!new RegExp(t)}catch(t){return!1}},date:function(t){return"function"==typeof t.getTime&&"function"==typeof t.getMonth&&"function"==typeof t.getYear},number:function(t){return!isNaN(t)&&"number"==typeof t},object:function(t){return"object"===(void 0===t?"undefined":s()(t))&&!_.array(t)},method:function(t){return"function"==typeof t},email:function(t){return"string"==typeof t&&!!t.match(v.email)&&t.length<255},url:function(t){return"string"==typeof t&&!!t.match(v.url)},hex:function(t){return"string"==typeof t&&!!t.match(v.hex)}};var y="enum";var b={required:g,whitespace:m,type:function(t,e,n,i,r){if(t.required&&void 0===e)g(t,e,n,i,r);else{var o=t.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(o)>-1?_[o](e)||i.push(u(r.messages.types[o],t.fullField,t.type)):o&&(void 0===e?"undefined":s()(e))!==t.type&&i.push(u(r.messages.types[o],t.fullField,t.type))}},range:function(t,e,n,i,r){var o="number"==typeof t.len,s="number"==typeof t.min,a="number"==typeof t.max,l=e,c=null,h="number"==typeof e,p="string"==typeof e,d=Array.isArray(e);if(h?c="number":p?c="string":d&&(c="array"),!c)return!1;d&&(l=e.length),p&&(l=e.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),o?l!==t.len&&i.push(u(r.messages[c].len,t.fullField,t.len)):s&&!a&&l<t.min?i.push(u(r.messages[c].min,t.fullField,t.min)):a&&!s&&l>t.max?i.push(u(r.messages[c].max,t.fullField,t.max)):s&&a&&(l<t.min||l>t.max)&&i.push(u(r.messages[c].range,t.fullField,t.min,t.max))},enum:function(t,e,n,i,r){t[y]=Array.isArray(t[y])?t[y]:[],-1===t[y].indexOf(e)&&i.push(u(r.messages[y],t.fullField,t[y].join(", ")))},pattern:function(t,e,n,i,r){t.pattern&&(t.pattern instanceof RegExp?(t.pattern.lastIndex=0,t.pattern.test(e)||i.push(u(r.messages.pattern.mismatch,t.fullField,e,t.pattern))):"string"==typeof t.pattern&&(new RegExp(t.pattern).test(e)||i.push(u(r.messages.pattern.mismatch,t.fullField,e,t.pattern))))}};var T="enum";var E=function(t,e,n,i,r){var o=t.type,s=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e,o)&&!t.required)return n();b.required(t,e,i,s,r,o),c(e,o)||b.type(t,e,i,s,r)}n(s)},C={string:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e,"string")&&!t.required)return n();b.required(t,e,i,o,r,"string"),c(e,"string")||(b.type(t,e,i,o,r),b.range(t,e,i,o,r),b.pattern(t,e,i,o,r),!0===t.whitespace&&b.whitespace(t,e,i,o,r))}n(o)},method:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&b.type(t,e,i,o,r)}n(o)},number:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&(b.type(t,e,i,o,r),b.range(t,e,i,o,r))}n(o)},boolean:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&b.type(t,e,i,o,r)}n(o)},regexp:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),c(e)||b.type(t,e,i,o,r)}n(o)},integer:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&(b.type(t,e,i,o,r),b.range(t,e,i,o,r))}n(o)},float:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&(b.type(t,e,i,o,r),b.range(t,e,i,o,r))}n(o)},array:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e,"array")&&!t.required)return n();b.required(t,e,i,o,r,"array"),c(e,"array")||(b.type(t,e,i,o,r),b.range(t,e,i,o,r))}n(o)},object:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),void 0!==e&&b.type(t,e,i,o,r)}n(o)},enum:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();b.required(t,e,i,o,r),e&&b[T](t,e,i,o,r)}n(o)},pattern:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e,"string")&&!t.required)return n();b.required(t,e,i,o,r),c(e,"string")||b.pattern(t,e,i,o,r)}n(o)},date:function(t,e,n,i,r){var o=[];if(t.required||!t.required&&i.hasOwnProperty(t.field)){if(c(e)&&!t.required)return n();if(b.required(t,e,i,o,r),!c(e)){var s=void 0;s="number"==typeof e?new Date(e):e,b.type(t,s,i,o,r),s&&b.range(t,s.getTime(),i,o,r)}}n(o)},url:E,hex:E,email:E,required:function(t,e,n,i,r){var o=[],a=Array.isArray(e)?"array":void 0===e?"undefined":s()(e);b.required(t,e,i,o,r,a),n(o)}};function S(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var t=JSON.parse(JSON.stringify(this));return t.clone=this.clone,t}}}var w=S();function k(t){this.rules=null,this._messages=w,this.define(t)}k.prototype={messages:function(t){return t&&(this._messages=f(S(),t)),this._messages},define:function(t){if(!t)throw new Error("Cannot configure a schema with no rules");if("object"!==(void 0===t?"undefined":s()(t))||Array.isArray(t))throw new Error("Rules must be an object");this.rules={};var e=void 0,n=void 0;for(e in t)t.hasOwnProperty(e)&&(n=t[e],this.rules[e]=Array.isArray(n)?n:[n])},validate:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments[2],o=t,a=n,c=i;if("function"==typeof a&&(c=a,a={}),this.rules&&0!==Object.keys(this.rules).length){if(a.messages){var h=this.messages();h===w&&(h=S()),f(h,a.messages),a.messages=h}else a.messages=this.messages();var g=void 0,m=void 0,v={};(a.keys||Object.keys(this.rules)).forEach(function(n){g=e.rules[n],m=o[n],g.forEach(function(i){var s=i;"function"==typeof s.transform&&(o===t&&(o=r()({},o)),m=o[n]=s.transform(m)),(s="function"==typeof s?{validator:s}:r()({},s)).validator=e.getValidationMethod(s),s.field=n,s.fullField=s.fullField||n,s.type=e.getType(s),s.validator&&(v[n]=v[n]||[],v[n].push({rule:s,value:m,source:o,field:n}))})});var _={};p(v,a,function(t,e){var n=t.rule,i=!("object"!==n.type&&"array"!==n.type||"object"!==s()(n.fields)&&"object"!==s()(n.defaultField));function o(t,e){return r()({},e,{fullField:n.fullField+"."+t})}function c(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Array.isArray(s)||(s=[s]),s.length&&l("async-validator:",s),s.length&&n.message&&(s=[].concat(n.message)),s=s.map(d(n)),a.first&&s.length)return _[n.field]=1,e(s);if(i){if(n.required&&!t.value)return s=n.message?[].concat(n.message).map(d(n)):a.error?[a.error(n,u(a.messages.required,n.field))]:[],e(s);var c={};if(n.defaultField)for(var h in t.value)t.value.hasOwnProperty(h)&&(c[h]=n.defaultField);for(var p in c=r()({},c,t.rule.fields))if(c.hasOwnProperty(p)){var f=Array.isArray(c[p])?c[p]:[c[p]];c[p]=f.map(o.bind(null,p))}var g=new k(c);g.messages(a.messages),t.rule.options&&(t.rule.options.messages=a.messages,t.rule.options.error=a.error),g.validate(t.value,t.rule.options||a,function(t){e(t&&t.length?s.concat(t):t)})}else e(s)}i=i&&(n.required||!n.required&&t.value),n.field=t.field;var h=n.validator(n,t.value,c,t.source,a);h&&h.then&&h.then(function(){return c()},function(t){return c(t)})},function(t){!function(t){var e,n=void 0,i=void 0,r=[],o={};for(n=0;n<t.length;n++)e=t[n],Array.isArray(e)?r=r.concat.apply(r,e):r.push(e);if(r.length)for(n=0;n<r.length;n++)o[i=r[n].field]=o[i]||[],o[i].push(r[n]);else r=null,o=null;c(r,o)}(t)})}else c&&c()},getType:function(t){if(void 0===t.type&&t.pattern instanceof RegExp&&(t.type="pattern"),"function"!=typeof t.validator&&t.type&&!C.hasOwnProperty(t.type))throw new Error(u("Unknown rule type %s",t.type));return t.type||"string"},getValidationMethod:function(t){if("function"==typeof t.validator)return t.validator;var e=Object.keys(t),n=e.indexOf("message");return-1!==n&&e.splice(n,1),1===e.length&&"required"===e[0]?C.required:C[this.getType(t)]||!1}},k.register=function(t,e){if("function"!=typeof e)throw new Error("Cannot register a validator by type, validator is not a function");C[t]=e},k.messages=w;e.default=k},jyFz:function(t,e,n){var i=function(){return this}()||Function("return this")(),r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n("SldL"),r)i.regeneratorRuntime=o;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}},kM2E:function(t,e,n){var i=n("7KvD"),r=n("FeBl"),o=n("+ZMJ"),s=n("hJx8"),a=n("D2L2"),l=function(t,e,n){var u,c,h,p=t&l.F,d=t&l.G,f=t&l.S,g=t&l.P,m=t&l.B,v=t&l.W,_=d?r:r[e]||(r[e]={}),y=_.prototype,b=d?i:f?i[e]:(i[e]||{}).prototype;for(u in d&&(n=e),n)(c=!p&&b&&void 0!==b[u])&&a(_,u)||(h=c?b[u]:n[u],_[u]=d&&"function"!=typeof b[u]?n[u]:m&&c?o(h,i):v&&b[u]==h?function(t){var e=function(e,n,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,i)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(h):g&&"function"==typeof h?o(Function.call,h):h,g&&((_.virtual||(_.virtual={}))[u]=h,t&l.R&&y&&!y[u]&&s(y,u,h)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,t.exports=l},kNJA:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=58)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},15:function(t,e){t.exports=n("fEB+")},18:function(t,e){t.exports=n("EKTV")},21:function(t,e){t.exports=n("E/in")},26:function(t,e){t.exports=n("nvbp")},3:function(t,e){t.exports=n("ylDJ")},31:function(t,e){t.exports=n("zTCi")},40:function(t,e){t.exports=n("hyEB")},51:function(t,e){t.exports=n("RDoK")},58:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:["el-cascader-panel",this.border&&"is-bordered"],on:{keydown:this.handleKeyDown}},this._l(this.menus,function(t,n){return e("cascader-menu",{key:n,ref:"menu",refInFor:!0,attrs:{index:n,nodes:t}})}),1)};i._withStripped=!0;var r=n(26),o=n.n(r),s=n(15),a=n.n(s),l=n(18),u=n.n(l),c=n(51),h=n.n(c),p=n(3),d=function(t){return t.stopPropagation()},f={inject:["panel"],components:{ElCheckbox:u.a,ElRadio:h.a},props:{node:{required:!0},nodeId:String},computed:{config:function(){return this.panel.config},isLeaf:function(){return this.node.isLeaf},isDisabled:function(){return this.node.isDisabled},checkedValue:function(){return this.panel.checkedValue},isChecked:function(){return this.node.isSameNode(this.checkedValue)},inActivePath:function(){return this.isInPath(this.panel.activePath)},inCheckedPath:function(){var t=this;return!!this.config.checkStrictly&&this.panel.checkedNodePaths.some(function(e){return t.isInPath(e)})},value:function(){return this.node.getValueByOption()}},methods:{handleExpand:function(){var t=this,e=this.panel,n=this.node,i=this.isDisabled,r=this.config,o=r.multiple;!r.checkStrictly&&i||n.loading||(r.lazy&&!n.loaded?e.lazyLoad(n,function(){var e=t.isLeaf;if(e||t.handleExpand(),o){var i=!!e&&n.checked;t.handleMultiCheckChange(i)}}):e.handleExpand(n))},handleCheckChange:function(){var t=this.panel,e=this.value,n=this.node;t.handleCheckChange(e),t.handleExpand(n)},handleMultiCheckChange:function(t){this.node.doCheck(t),this.panel.calculateMultiCheckedValue()},isInPath:function(t){var e=this.node;return(t[e.level-1]||{}).uid===e.uid},renderPrefix:function(t){var e=this.isLeaf,n=this.isChecked,i=this.config,r=i.checkStrictly;return i.multiple?this.renderCheckbox(t):r?this.renderRadio(t):e&&n?this.renderCheckIcon(t):null},renderPostfix:function(t){var e=this.node,n=this.isLeaf;return e.loading?this.renderLoadingIcon(t):n?null:this.renderExpandIcon(t)},renderCheckbox:function(t){var e=this.node,n=this.config,i=this.isDisabled,r={on:{change:this.handleMultiCheckChange},nativeOn:{}};return n.checkStrictly&&(r.nativeOn.click=d),t("el-checkbox",o()([{attrs:{value:e.checked,indeterminate:e.indeterminate,disabled:i}},r]))},renderRadio:function(t){var e=this.checkedValue,n=this.value,i=this.isDisabled;return Object(p.isEqual)(n,e)&&(n=e),t("el-radio",{attrs:{value:e,label:n,disabled:i},on:{change:this.handleCheckChange},nativeOn:{click:d}},[t("span")])},renderCheckIcon:function(t){return t("i",{class:"el-icon-check el-cascader-node__prefix"})},renderLoadingIcon:function(t){return t("i",{class:"el-icon-loading el-cascader-node__postfix"})},renderExpandIcon:function(t){return t("i",{class:"el-icon-arrow-right el-cascader-node__postfix"})},renderContent:function(t){var e=this.panel,n=this.node,i=e.renderLabelFn;return t("span",{class:"el-cascader-node__label"},[(i?i({node:n,data:n.data}):null)||n.label])}},render:function(t){var e=this,n=this.inActivePath,i=this.inCheckedPath,r=this.isChecked,s=this.isLeaf,a=this.isDisabled,l=this.config,u=this.nodeId,c=l.expandTrigger,h=l.checkStrictly,p=l.multiple,d=!h&&a,f={on:{}};return"click"===c?f.on.click=this.handleExpand:(f.on.mouseenter=function(t){e.handleExpand(),e.$emit("expand",t)},f.on.focus=function(t){e.handleExpand(),e.$emit("expand",t)}),!s||a||h||p||(f.on.click=this.handleCheckChange),t("li",o()([{attrs:{role:"menuitem",id:u,"aria-expanded":n,tabindex:d?null:-1},class:{"el-cascader-node":!0,"is-selectable":h,"in-active-path":n,"in-checked-path":i,"is-active":r,"is-disabled":d}},f]),[this.renderPrefix(t),this.renderContent(t),this.renderPostfix(t)])}},g=n(0),m=Object(g.a)(f,void 0,void 0,!1,null,null,null);m.options.__file="packages/cascader-panel/src/cascader-node.vue";var v=m.exports,_=n(6),y={name:"ElCascaderMenu",mixins:[n.n(_).a],inject:["panel"],components:{ElScrollbar:a.a,CascaderNode:v},props:{nodes:{type:Array,required:!0},index:Number},data:function(){return{activeNode:null,hoverTimer:null,id:Object(p.generateId)()}},computed:{isEmpty:function(){return!this.nodes.length},menuId:function(){return"cascader-menu-"+this.id+"-"+this.index}},methods:{handleExpand:function(t){this.activeNode=t.target},handleMouseMove:function(t){var e=this.activeNode,n=this.hoverTimer,i=this.$refs.hoverZone;if(e&&i)if(e.contains(t.target)){clearTimeout(n);var r=this.$el.getBoundingClientRect().left,o=t.clientX-r,s=this.$el,a=s.offsetWidth,l=s.offsetHeight,u=e.offsetTop,c=u+e.offsetHeight;i.innerHTML='\n <path style="pointer-events: auto;" fill="transparent" d="M'+o+" "+u+" L"+a+" 0 V"+u+' Z" />\n <path style="pointer-events: auto;" fill="transparent" d="M'+o+" "+c+" L"+a+" "+l+" V"+c+' Z" />\n '}else n||(this.hoverTimer=setTimeout(this.clearHoverZone,this.panel.config.hoverThreshold))},clearHoverZone:function(){var t=this.$refs.hoverZone;t&&(t.innerHTML="")},renderEmptyText:function(t){return t("div",{class:"el-cascader-menu__empty-text"},[this.t("el.cascader.noData")])},renderNodeList:function(t){var e=this.menuId,n=this.panel.isHoverMenu,i={on:{}};n&&(i.on.expand=this.handleExpand);var r=this.nodes.map(function(n,r){var s=n.hasChildren;return t("cascader-node",o()([{key:n.uid,attrs:{node:n,"node-id":e+"-"+r,"aria-haspopup":s,"aria-owns":s?e:null}},i]))});return[].concat(r,[n?t("svg",{ref:"hoverZone",class:"el-cascader-menu__hover-zone"}):null])}},render:function(t){var e=this.isEmpty,n=this.menuId,i={nativeOn:{}};return this.panel.isHoverMenu&&(i.nativeOn.mousemove=this.handleMouseMove),t("el-scrollbar",o()([{attrs:{tag:"ul",role:"menu",id:n,"wrap-class":"el-cascader-menu__wrap","view-class":{"el-cascader-menu__list":!0,"is-empty":e}},class:"el-cascader-menu"},i]),[e?this.renderEmptyText(t):this.renderNodeList(t)])}},b=Object(g.a)(y,void 0,void 0,!1,null,null,null);b.options.__file="packages/cascader-panel/src/cascader-menu.vue";var T=b.exports,E=n(21),C=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var S=0,w=function(){function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.config=n,this.parent=i||null,this.level=this.parent?this.parent.level+1:1,this.uid=S++,this.initState(),this.initChildren()}return t.prototype.initState=function(){var t=this.config,e=t.value,n=t.label;this.value=this.data[e],this.label=this.data[n],this.pathNodes=this.calculatePathNodes(),this.path=this.pathNodes.map(function(t){return t.value}),this.pathLabels=this.pathNodes.map(function(t){return t.label}),this.loading=!1,this.loaded=!1},t.prototype.initChildren=function(){var e=this,n=this.config,i=n.children,r=this.data[i];this.hasChildren=Array.isArray(r),this.children=(r||[]).map(function(i){return new t(i,n,e)})},t.prototype.calculatePathNodes=function(){for(var t=[this],e=this.parent;e;)t.unshift(e),e=e.parent;return t},t.prototype.getPath=function(){return this.path},t.prototype.getValue=function(){return this.value},t.prototype.getValueByOption=function(){return this.config.emitPath?this.getPath():this.getValue()},t.prototype.getText=function(t,e){return t?this.pathLabels.join(e):this.label},t.prototype.isSameNode=function(t){var e=this.getValueByOption();return this.config.multiple&&Array.isArray(t)?t.some(function(t){return Object(p.isEqual)(t,e)}):Object(p.isEqual)(t,e)},t.prototype.broadcast=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];var r="onParent"+Object(p.capitalize)(t);this.children.forEach(function(e){e&&(e.broadcast.apply(e,[t].concat(n)),e[r]&&e[r].apply(e,n))})},t.prototype.emit=function(t){var e=this.parent,n="onChild"+Object(p.capitalize)(t);if(e){for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];e[n]&&e[n].apply(e,r),e.emit.apply(e,[t].concat(r))}},t.prototype.onParentCheck=function(t){this.isDisabled||this.setCheckState(t)},t.prototype.onChildCheck=function(){var t=this.children.filter(function(t){return!t.isDisabled}),e=!!t.length&&t.every(function(t){return t.checked});this.setCheckState(e)},t.prototype.setCheckState=function(t){var e=this.children.length,n=this.children.reduce(function(t,e){return t+(e.checked?1:e.indeterminate?.5:0)},0);this.checked=t,this.indeterminate=n!==e&&n>0},t.prototype.syncCheckState=function(t){var e=this.getValueByOption(),n=this.isSameNode(t,e);this.doCheck(n)},t.prototype.doCheck=function(t){this.checked!==t&&(this.config.checkStrictly?this.checked=t:(this.broadcast("check",t),this.setCheckState(t),this.emit("check")))},C(t,[{key:"isDisabled",get:function(){var t=this.data,e=this.parent,n=this.config,i=n.disabled,r=n.checkStrictly;return t[i]||!r&&e&&e.isDisabled}},{key:"isLeaf",get:function(){var t=this.data,e=this.loaded,n=this.hasChildren,i=this.children,r=this.config,o=r.lazy,s=r.leaf;if(o){var a=Object(E.isDef)(t[s])?t[s]:!!e&&!i.length;return this.hasChildren=!a,a}return!n}}]),t}();var k=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=n,this.initNodes(e)}return t.prototype.initNodes=function(t){var e=this;t=Object(p.coerceTruthyValueToArray)(t),this.nodes=t.map(function(t){return new w(t,e.config)}),this.flattedNodes=this.getFlattedNodes(!1,!1),this.leafNodes=this.getFlattedNodes(!0,!1)},t.prototype.appendNode=function(t,e){var n=new w(t,this.config,e);(e?e.children:this.nodes).push(n)},t.prototype.appendNodes=function(t,e){var n=this;(t=Object(p.coerceTruthyValueToArray)(t)).forEach(function(t){return n.appendNode(t,e)})},t.prototype.getNodes=function(){return this.nodes},t.prototype.getFlattedNodes=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t?this.leafNodes:this.flattedNodes;return e?n:function t(e,n){return e.reduce(function(e,i){return i.isLeaf?e.push(i):(!n&&e.push(i),e=e.concat(t(i.children,n))),e},[])}(this.nodes,t)},t.prototype.getNodeByValue=function(t){if(t){var e=this.getFlattedNodes(!1,!this.config.lazy).filter(function(e){return Object(p.valueEquals)(e.path,t)||e.value===t});return e&&e.length?e[0]:null}return null},t}(),x=n(9),I=n.n(x),R=n(40),O=n.n(R),D=n(31),A=n.n(D),M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},N=O.a.keys,L={expandTrigger:"click",multiple:!1,checkStrictly:!1,emitPath:!0,lazy:!1,lazyLoad:p.noop,value:"value",label:"label",children:"children",leaf:"leaf",disabled:"disabled",hoverThreshold:500},P=function(t){return!t.getAttribute("aria-owns")},B=function(t,e){var n=t.parentNode;if(n){var i=n.querySelectorAll('.el-cascader-node[tabindex="-1"]');return i[Array.prototype.indexOf.call(i,t)+e]||null}return null},F=function(t,e){if(t){var n=t.id.split("-");return Number(n[n.length-2])}},U=function(t){t&&(t.focus(),!P(t)&&t.click())},V={name:"ElCascaderPanel",components:{CascaderMenu:T},props:{value:{},options:Array,props:Object,border:{type:Boolean,default:!0},renderLabel:Function},provide:function(){return{panel:this}},data:function(){return{checkedValue:null,checkedNodePaths:[],store:[],menus:[],activePath:[],loadCount:0}},computed:{config:function(){return I()(M({},L),this.props||{})},multiple:function(){return this.config.multiple},checkStrictly:function(){return this.config.checkStrictly},leafOnly:function(){return!this.checkStrictly},isHoverMenu:function(){return"hover"===this.config.expandTrigger},renderLabelFn:function(){return this.renderLabel||this.$scopedSlots.default}},watch:{options:{handler:function(){this.initStore()},immediate:!0,deep:!0},value:function(){this.syncCheckedValue(),this.checkStrictly&&this.calculateCheckedNodePaths()},checkedValue:function(t){Object(p.isEqual)(t,this.value)||(this.checkStrictly&&this.calculateCheckedNodePaths(),this.$emit("input",t),this.$emit("change",t))}},mounted:function(){Object(p.isEmpty)(this.value)||this.syncCheckedValue()},methods:{initStore:function(){var t=this.config,e=this.options;t.lazy&&Object(p.isEmpty)(e)?this.lazyLoad():(this.store=new k(e,t),this.menus=[this.store.getNodes()],this.syncMenuState())},syncCheckedValue:function(){var t=this.value,e=this.checkedValue;Object(p.isEqual)(t,e)||(this.activePath=[],this.checkedValue=t,this.syncMenuState())},syncMenuState:function(){var t=this.multiple,e=this.checkStrictly;this.syncActivePath(),t&&this.syncMultiCheckState(),e&&this.calculateCheckedNodePaths(),this.$nextTick(this.scrollIntoView)},syncMultiCheckState:function(){var t=this;this.getFlattedNodes(this.leafOnly).forEach(function(e){e.syncCheckState(t.checkedValue)})},syncActivePath:function(){var t=this,e=this.store,n=this.multiple,i=this.activePath,r=this.checkedValue;if(Object(p.isEmpty)(i))if(Object(p.isEmpty)(r))this.activePath=[],this.menus=[e.getNodes()];else{var o=n?r[0]:r,s=((this.getNodeByValue(o)||{}).pathNodes||[]).slice(0,-1);this.expandNodes(s)}else{var a=i.map(function(e){return t.getNodeByValue(e.getValue())});this.expandNodes(a)}},expandNodes:function(t){var e=this;t.forEach(function(t){return e.handleExpand(t,!0)})},calculateCheckedNodePaths:function(){var t=this,e=this.checkedValue,n=this.multiple?Object(p.coerceTruthyValueToArray)(e):[e];this.checkedNodePaths=n.map(function(e){var n=t.getNodeByValue(e);return n?n.pathNodes:[]})},handleKeyDown:function(t){var e=t.target;switch(t.keyCode){case N.up:var n=B(e,-1);U(n);break;case N.down:var i=B(e,1);U(i);break;case N.left:var r=this.$refs.menu[F(e)-1];if(r){var o=r.$el.querySelector('.el-cascader-node[aria-expanded="true"]');U(o)}break;case N.right:var s=this.$refs.menu[F(e)+1];if(s){var a=s.$el.querySelector('.el-cascader-node[tabindex="-1"]');U(a)}break;case N.enter:!function(t){if(t){var e=t.querySelector("input");e?e.click():P(t)&&t.click()}}(e);break;case N.esc:case N.tab:this.$emit("close");break;default:return}},handleExpand:function(t,e){var n=this.activePath,i=t.level,r=n.slice(0,i-1),o=this.menus.slice(0,i);if(t.isLeaf||(r.push(t),o.push(t.children)),this.activePath=r,this.menus=o,!e){var s=r.map(function(t){return t.getValue()}),a=n.map(function(t){return t.getValue()});Object(p.valueEquals)(s,a)||(this.$emit("active-item-change",s),this.$emit("expand-change",s))}},handleCheckChange:function(t){this.checkedValue=t},lazyLoad:function(t,e){var n=this,i=this.config;t||(t=t||{root:!0,level:0},this.store=new k([],i),this.menus=[this.store.getNodes()]),t.loading=!0;i.lazyLoad(t,function(i){var r=t.root?null:t;if(i&&i.length&&n.store.appendNodes(i,r),t.loading=!1,t.loaded=!0,Array.isArray(n.checkedValue)){var o=n.checkedValue[n.loadCount++],s=n.config.value,a=n.config.leaf;if(Array.isArray(i)&&i.filter(function(t){return t[s]===o}).length>0){var l=n.store.getNodeByValue(o);l.data[a]||n.lazyLoad(l,function(){n.handleExpand(l)}),n.loadCount===n.checkedValue.length&&n.$parent.computePresentText()}}e&&e(i)})},calculateMultiCheckedValue:function(){this.checkedValue=this.getCheckedNodes(this.leafOnly).map(function(t){return t.getValueByOption()})},scrollIntoView:function(){this.$isServer||(this.$refs.menu||[]).forEach(function(t){var e=t.$el;if(e){var n=e.querySelector(".el-scrollbar__wrap"),i=e.querySelector(".el-cascader-node.is-active")||e.querySelector(".el-cascader-node.in-active-path");A()(n,i)}})},getNodeByValue:function(t){return this.store.getNodeByValue(t)},getFlattedNodes:function(t){var e=!this.config.lazy;return this.store.getFlattedNodes(t,e)},getCheckedNodes:function(t){var e=this.checkedValue;return this.multiple?this.getFlattedNodes(t).filter(function(t){return t.checked}):Object(p.isEmpty)(e)?[]:[this.getNodeByValue(e)]},clearCheckedNodes:function(){var t=this.config,e=this.leafOnly,n=t.multiple,i=t.emitPath;n?(this.getCheckedNodes(e).filter(function(t){return!t.isDisabled}).forEach(function(t){return t.doCheck(!1)}),this.calculateMultiCheckedValue()):this.checkedValue=i?[]:null}}},H=Object(g.a)(V,i,[],!1,null,null,null);H.options.__file="packages/cascader-panel/src/cascader-panel.vue";var W=H.exports;W.install=function(t){t.component(W.name,W)};e.default=W},6:function(t,e){t.exports=n("y+7x")},9:function(t,e){t.exports=n("jmaC")}})},knuC:function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},lFkc:function(t,e,n){"use strict";var i=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:i,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:i&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:i&&!!window.screen,isInWorker:!i};t.exports=r},lOnJ:function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},lktj:function(t,e,n){var i=n("Ibhu"),r=n("xnc9");t.exports=Object.keys||function(t){return i(t,r)}},msXi:function(t,e,n){var i=n("77Pl");t.exports=function(t,e,n,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&i(o.call(t)),e}}},mtWM:function(t,e,n){t.exports=n("tIFN")},mtrD:function(t,e){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=86)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},86:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("button",{staticClass:"el-button",class:[t.type?"el-button--"+t.type:"",t.buttonSize?"el-button--"+t.buttonSize:"",{"is-disabled":t.buttonDisabled,"is-loading":t.loading,"is-plain":t.plain,"is-round":t.round,"is-circle":t.circle}],attrs:{disabled:t.buttonDisabled||t.loading,autofocus:t.autofocus,type:t.nativeType},on:{click:t.handleClick}},[t.loading?n("i",{staticClass:"el-icon-loading"}):t._e(),t.icon&&!t.loading?n("i",{class:t.icon}):t._e(),t.$slots.default?n("span",[t._t("default")],2):t._e()])};i._withStripped=!0;var r={name:"ElButton",inject:{elForm:{default:""},elFormItem:{default:""}},props:{type:{type:String,default:"default"},size:String,icon:{type:String,default:""},nativeType:{type:String,default:"button"},loading:Boolean,disabled:Boolean,plain:Boolean,autofocus:Boolean,round:Boolean,circle:Boolean},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},buttonSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},buttonDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},methods:{handleClick:function(t){this.$emit("click",t)}}},o=n(0),s=Object(o.a)(r,i,[],!1,null,null,null);s.options.__file="packages/button/src/button.vue";var a=s.exports;a.install=function(t){t.component(a.name,a)};e.default=a}})},mvHQ:function(t,e,n){t.exports={default:n("qkKv"),__esModule:!0}},mw3O:function(t,e,n){"use strict";var i=n("CwSZ"),r=n("DDCP"),o=n("XgCd");t.exports={formats:o,parse:r,stringify:i}},n0T6:function(t,e,n){var i=n("Ibhu"),r=n("xnc9").concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,r)}},nvbp:function(t,e){var n=/^(attrs|props|on|nativeOn|class|style|hook)$/;function i(t,e){return function(){t&&t.apply(this,arguments),e&&e.apply(this,arguments)}}t.exports=function(t){return t.reduce(function(t,e){var r,o,s,a,l;for(s in e)if(r=t[s],o=e[s],r&&n.test(s))if("class"===s&&("string"==typeof r&&(l=r,t[s]=r={},r[l]=!0),"string"==typeof o&&(l=o,e[s]=o={},o[l]=!0)),"on"===s||"nativeOn"===s||"hook"===s)for(a in o)r[a]=i(r[a],o[a]);else if(Array.isArray(r))t[s]=r.concat(o);else if(Array.isArray(o))t[s]=[r].concat(o);else for(a in o)r[a]=o[a];else t[s]=e[s];return t},{})}},oJlt:function(t,e,n){"use strict";var i=n("cGG2"),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,o,s={};return t?(i.forEach(t.split("\n"),function(t){if(o=t.indexOf(":"),e=i.trim(t.substr(0,o)).toLowerCase(),n=i.trim(t.substr(o+1)),e){if(s[e]&&r.indexOf(e)>=0)return;s[e]="set-cookie"===e?(s[e]?s[e]:[]).concat([n]):s[e]?s[e]+", "+n:n}}),s):s}},oPgp:function(t,e,n){var i;"undefined"!=typeof self&&self,i=function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=2)}([function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAHXCAMAAADusXjuAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAMAUExURQAAAGdtcwAAAAAAAAAAAAAAAAAAABmR+gECAgAAAAAAAAAAAAAAAAAAAAAAAPf49QAAAAAAAAAAAAAAAAAAALLS/QICAgEBAf///wAAAGS1/P///////wAAAP///xyS+gAAAN3q/pWbof///6Gqs////wAAAAAAACCV+v///zef+5LL/Xq2+woKCkVJTZWdppefqAIDAv///////////5WdpqvX/Z/R/Vyx/KDS/Zyjq5mhqpefqP///2ltcGdtczub+pafqP///0VJTY2hp5WdpgAAAGdtc////0Gk+3e//P///////yDIrvBnZ////8zQ1P////////b39P///6Kqsv///////5WdppefqP////T18pWdppWdpiDIrubw/gICAvb39P///yDIriaX+pWdpUan+5rP/R4eHr2+u////////////5Wdpv///////5WdpuHi3/Lz8Git+8nf/Wdtc/////////Dx7v///9LS0JWdpiDIrvBnZ/BnZ77Z/ZWdppWdppWdpuDh3uzt6q6vrZWdpmdtc+rr6dPU0cvLydbX1JWdpkVJTZnF/O71/vf6//BnZ2dtc////////9LT0Ovs6ru8uZWdppWdppWdpjM0M5WdppWdppWdplSl+/BnZ+bn5O7v7AMDA6Gqs2dtc////77g/v///6TT/bfc/Vau+3vA/P///////4TE/P///////////6bU/f///////7W2szIzMozI/P///2y5/P///y6b+pWdpoq+/KbM/JWdpv///////////yDIriDIrqGqs2dtc6Gqs6Gqs6Gqs////2dtc0VJTZWdpmdtc////x0dHZWdptPl/kVJTSDIriDIrmdtc6iopsDBvvX282FmaWdtc5Wdpv///yDIriDIrvBnZ2dtc6Gqs6Gqs6Gqs2dtc2dtc2dtc2dtc/BnZ35+ffBnZ0VJTWdtc2dtc2dtc35+ff///2dtc9/g3oOKkp6nsL3CyP7//v///6Gqs/f49fBnZyDIrmdtc0VJTdgAqpkAAAD5dFJOUwDMDxgGBArMAQIMDhYDB5kFEwkVHeUfHHgU2tgZEafMIvJD5Oc+GxrNk9Ll2SZF6wgeuJWKBern2ecCKBbdOcTPPfnsETIgD8XU3yDLCoH7AY4P+RVJhtUiGx3mSHm/9SmWNgfOT9XmIVgHuR9Z9EVxmtzW7LALI4uwfae3kIrpC+FncYlH1rmzamaBjD3f+fyLyk0vYYVUz/OFHZW9ntLzfssv/gqY7nvo7NffbF/hHls56G+iSybjftzp0LHc4rfO0Ty4p+7AecaT8HLUYCBJHP3vefL3o15qlC6Nx8KyeOme9lSkam2nFndNdTx4iJEzUhs/O+UL41+/HMAAAAwESURBVHja7Zl5fFNVFsdT0iSleW3SJk0oGkwCJAIJJGhcktJFm4hSa6EsrdBpq9YBFagUZBuHUqCyVMCFfZPF2fcFZoZh0xEBERFcUXFfZl/+u6TOzLn3LXlJ3r0v6EeoMz2fD/al79t7lnvOL/c9NZqEXfnMaA3brrwCPaNKXHHlFyXOT7pTbY0qNOpOFS/jJwGjEgdm1CIFRi0XzfiqIyrEJbbR58epIedRlRozriojZjTNgcxGf1HkIoLJINwMks6gdJfMyspuUUX+naXG3JKVEVNGcyCzsi+KXEQwGYSbQdIZlO4rtxeHCxfDX6Qhj97MM8NvHq5hMyyCZ9gEZl5RITSaV/7zigoxXHUVHMejTIaPlMWIuTAYqbp/ffGy7/TGKcKFezENqRjBM+4Rbg2bYRE8wyYw06BCaDQNZxpUCDesMkWFcEt50QkNkxFzYTAbxVwqOnvUt6zm7udefU+F+Nbnn7+mSnz+rirxjdvTb7z32rv8b+/+A4XQvCr8/nYqoXmOv8MghAgqGYTAvMoiBIZJMLJNqvtrz93eA/ZfOKmyzsz8SZV5ZiYn1Z5zmgUvQsyss/skJkMiHc9ihFxYzBEhUmAmUZCR4rl7fNX5y90M1U9VixcPU5D3u7vJrW93d3dTkD91EwYT1VRPmMHEY4xouok9xoxYlSBxdD+sSjAZEmk1i6nm46hmJP2UECkwT9H8iBvwl/ere4A4jDs9cfSMqrFP0B4nZo49cof47HNk7EwlRLg/iv95hxKCH5wmnh6neWjmxCq4VkZeEC9r1JGHmMgoMWI6gljITQiFE6uMUkJAfp5UKe01CF2rgtyF0Iy55Or0/hdGKTPzBaGbux+hsRS9HIjQ/n/VnAbimYcoruYCg/YjpmqOn08SHjmeFfPgATPmz+wRB5unSz/9oOz1k6W0Z6jSk68/nsXb45+dLFVC+PuPzxF+KiHw+w8+KX0avH3yOlwrI9LzZA4VeV4Km4nMESJmIFkspCwrK5xYZY4SAjdfUint37KyPlVB3oKs+WVKH3l+jjLzNkTwR/j50iNZWScpD9Jw65HSnFL48dnTFFf4z7PwP7IYZZ23ScL/YD5Qv/X3srdLL3/jThh0gWGDJgDCJIAB5MIFlg9y9+uJTBhESiAVS/gkRwbxJRBM+nSRSAaO/veqCxb46MTxQXv2DDp+4qOAIlJ/4mii146eqE9Hjn144cLxYxUl4XBJxbHjey58eCwNObrn40gihMjHe46mIZFIcpzC569jdTMY2AzG/jJYe8vmAxsXL+7c1tXSrgjUb+5cDDYCbNOmEVvr0oBA68bOzoUd0ZJQqCTaenjTpk2bAylLLOzs3Cz7w7qtm85sTFoosm3j4ZRmiHaeWRyVrXH4ne2Vqa5Ltp2RxbH9na2h9PhDmpqweN3xzkLlJMNhganfti2iXKiaUKiGXLRuo76UCgVIAIEDh+tpSE0ggJepONxF35NAO16m9UALHQm14xp3HYjQkXAlznX7gUo6UlOJby5cGGI0SAZISQn8Z+tChqMwQRq2M8IN1WPk1HbGm7r2euwiur2VEUodTjrQtbWE6qeujuz19K3T6Yvwf13S1UXZx0AkIhSkpatVsTThSEQMIdS6+VRYofh10Yj068qGzdND6WtEo7JRqm9t6EhJqz1aEU3q6MqOhtYplfJAKyqiKeMYqmhtbW2JlgTC4UBlXcUUd0VdeniV7o6OjlOnpk+f3tIyxR1pp9SyogUT7mh9+PKeqX7W7/6BN824YmS/MRTg2QGJ/4s34Fkl4lq4c33/oVffc2//65HSw9t9QxAadpVBsKuGIXTNfekPff0NMrsBmDQvtxqS7NYUX88idIMhxWCdwTJkABom3vH5dghXw9CABPEAQkKkh9ZCMmfL+ZgRekBC+qEbhb90NRYtQqiI/3Aj6pd4dSVl0wb/FiEX/6E/GikhA9FQWZyL0Gz+YigaKHuevjpBlK9FPv7qanSTIlLeiBYZ0hGZIyBmi9dyR/dL4cqJpHClpDHh8/na0pMeI5bOx3eLSyzdGPkG3EZ+u6OI2Gry4Tb5BmgGI/T71G28NXkbNUPQdanIdWhI8jtIlNhr3n6Jfp3ylP/zlI6BzvxFavNORN+VET9C6CfpE/Ad9H2J+CFC31MYkicR+qlA3PMDyguJHyN0r5jMNZRxHCtkDpM2l/blNB9dD8RvEHqCOvYzEWzE7xD6FUMa+iH0TYQmMuUDJjul7gpva357V4947/H/q3XyDlfUuiKSso+ldUVojcvlamNpXZEohXStS0KUtQ7Hsma1gaV1q10uEOeDTK3D8ozOsrSOd+ZiaJ3h0A6Db42SwEtaB07AGssZWmc4eNblOsQTvVrXq3W9WndZtY6XGANL6+DYhkSEonUGQ+MaCaGc64rQQQlR1ro2OLFJiLLWNa4pV0YkR6CpPjhy+crpWucSNtpH17o2ONQlVlHWOmyy0ilpHQmoqFfrerWuV+u+aq0r9wnTStW61TjjRUytKzpbNBuh1Sytw04axVMQ9Rm2fI34gEp5hl3kWru2iKl1WKfWqjzDGmQnsi9zrtshPekyznVrdzDPdbN7z3W9WterdZfmXFfepqJ1sxvFoae+r5PeSlG17mBbUQKhaZ0Mob2vkyG093UUJANHcq2jhJtIus03GzX6fKpaJxzsKFq3mn9h16t1vVp3CS0nyRTv9+2bl6cjlpfXt28aRwCdOTuft2yzhMmWyNNl5xfq9blger2+MD8bY5gSl4AVAMg19nFg62MEDiizxPBLAOBwFBRbLJbi4gKCFebjhXLIIjzhKLBwWmxe+MdZChy5emAwAm4wYXQUc1tWLp9cWztr+cp9tqDdyzmMwOTlEDdmTFi0K2fFBZv1pt+5axfnyC3M5hEd9mJ5+UG4tcq9b597FaAPNsXjHksffb4uBy+SXZjrKNY+GK9dYLOCxZz+BbVx+AMrLJOv68svYizgVsZrp1ntEKnXGvM3vVEL7mxaAckzwyKWLZPjC6weLcdZOG/Q2dS0IAnJhli5FfFZU+1arhhKw3liu0jQQREBP30KtMvjq6xeIIy5fRycnSC7+FhyMIKDnRx327UWqBZsg4Pz2JxOp81rceglxKKtjU/1cAWQZDYJ3hO02excgVGP65KKmHEJLFoPZGcRSic4miU6yseV5rSef05eWgyImUfk4UK74N3SelbFl5NFYRtTk4aOAcJrnxVfgbdRR5BE6ey4B3BLeD0L4pO3YLcESdkADgP2abXxdcWJjU7aRrvHY7cG8Tby+eWRpiPLODihGaYKzfAyTpn4SbQUJ2+plVAA0nNC6wqNaeG2rMCNOXn5ii0cIbJ14gDw7W2U2pv0NiHyxFFLGRI8IsZcQvRNDGPyqMEI6YUZytHQBraQXyJp7pPHPmmcmeJx8RLU8+RQpzOD6XQ0OSRlKQSDypjNunQ5hB3Ih+Iawfj65qfJobiP2BxkH/E2yeUQ9ifRDaAPMP/GxGbjfiFqiGfDGgwGbUFoYTww0N6SHGKiWGufumzJvOZzS5dM8PudMTz1uaIc6vgxti5bahJsaUtT086dHkEZAIHuhjWC60ym9dNK/f7SaetNpjd3m0wxraAv/KhpretMzRv8ICtOf9PuN86Z3jSZnJ5iIww1WQREx77M1OyGACBYZ9Pu3X9uBnd+q8VYaBa0rkA7dZ5pgzMGmq312mCZ3W8QhOtDEPDj4Lx7Tev9sSBOlfPG/DtJ0DIE+1limuYE6YKKgdLFCLITx1KIwzUX4mDnmUpjVi1US693WDwgzk1Nfpu2gM/IjEMJNpv8MTsW0Xzs1w4iTz7rZcg5EckmRYIvAqcNFtXn50mOlgqOeN2F74G35q3TykVVChfG3Yh3KxibZlqCv4+IHCYlDSlBR3itNud6017sV1LMROmw1nmsttgG07yXcSi8HCZtgNVuByDmbjYtw/oubHTSNsbAnM4N50zrPJwg3mIzWLzBFfJmWAHpCeKdaCmvvKWWWbUWqS+lxrRAY+6Fxmyet2TvVOErQyaHZqG9sSwHiYbz3/VyOTTzQ8Jx/IxgwSwUVVdp1GSCmSSH8oHV6/PJgSJNDvmxJ+OcnRhVtnhkLkH/BUTDFxXJeg2PAAAAAElFTkSuQmCC"},function(t,e,n){"use strict";function i(t,e){return t+e}function r(t){return t*t}var o=Math.PI;e.a={name:"SlideVerify",props:{l:{type:Number,default:42},r:{type:Number,default:10},w:{type:Number,default:310},h:{type:Number,default:155},sliderText:{type:String,default:"Slide filled right"},accuracy:{type:Number,default:5},show:{type:Boolean,default:!0},imgs:{type:Array,default:function(){return[]}}},data:function(){return{containerActive:!1,containerSuccess:!1,containerFail:!1,canvasCtx:null,blockCtx:null,block:null,block_x:void 0,block_y:void 0,L:this.l+2*this.r+3,img:void 0,originX:void 0,originY:void 0,isMouseDown:!1,trail:[],sliderLeft:0,sliderMaskWidth:0,success:!1,loadBlock:!0,timestamp:null}},mounted:function(){this.init()},methods:{init:function(){this.initDom(),this.initImg(),this.bindEvents()},initDom:function(){this.block=this.$refs.block,this.canvasCtx=this.$refs.canvas.getContext("2d"),this.blockCtx=this.block.getContext("2d")},initImg:function(){var t=this,e=this.createImg(function(){t.loadBlock=!1,t.drawBlock(),t.canvasCtx.drawImage(e,0,0,t.w,t.h),t.blockCtx.drawImage(e,0,0,t.w,t.h);var n=t.block_x,i=t.block_y,r=t.r,o=t.L,s=i-2*r-1,a=t.blockCtx.getImageData(n,s,o,o);t.block.width=o,t.blockCtx.putImageData(a,0,s)});this.img=e},drawBlock:function(){this.block_x=this.getRandomNumberByRange(this.L+10,this.w-(this.L+10)),this.block_y=this.getRandomNumberByRange(10+2*this.r,this.h-(this.L+10)),this.draw(this.canvasCtx,this.block_x,this.block_y,"fill"),this.draw(this.blockCtx,this.block_x,this.block_y,"clip")},draw:function(t,e,n,i){var r=this.l,s=this.r;t.beginPath(),t.moveTo(e,n),t.arc(e+r/2,n-s+2,s,.72*o,2.26*o),t.lineTo(e+r,n),t.arc(e+r+s-2,n+r/2,s,1.21*o,2.78*o),t.lineTo(e+r,n+r),t.lineTo(e,n+r),t.arc(e+s-2,n+r/2,s+.4,2.76*o,1.24*o,!0),t.lineTo(e,n),t.lineWidth=2,t.fillStyle="rgba(255, 255, 255, 0.7)",t.strokeStyle="rgba(255, 255, 255, 0.7)",t.stroke(),t[i](),t.globalCompositeOperation="destination-over"},createImg:function(t){var e=this,n=document.createElement("img");return n.crossOrigin="Anonymous",n.onload=t,n.onerror=function(){n.src=e.getRandomImg()},n.src=this.getRandomImg(),n},getRandomImg:function(){var t=this.imgs.length;return t>0?this.imgs[this.getRandomNumberByRange(0,t)]:"https://picsum.photos/300/150/?image="+this.getRandomNumberByRange(0,1084)},getRandomNumberByRange:function(t,e){return Math.round(Math.random()*(e-t)+t)},refresh:function(){this.reset(),this.$emit("refresh")},sliderDown:function(t){this.success||(this.originX=t.clientX,this.originY=t.clientY,this.isMouseDown=!0,this.timestamp=+new Date)},touchStartEvent:function(t){this.success||(this.originX=t.changedTouches[0].pageX,this.originY=t.changedTouches[0].pageY,this.isMouseDown=!0,this.timestamp=+new Date)},bindEvents:function(){var t=this;document.addEventListener("mousemove",function(e){if(!t.isMouseDown)return!1;var n=e.clientX-t.originX,i=e.clientY-t.originY;if(n<0||n+38>=t.w)return!1;t.sliderLeft=n+"px";var r=(t.w-40-20)/(t.w-40)*n;t.block.style.left=r+"px",t.containerActive=!0,t.sliderMaskWidth=n+"px",t.trail.push(i)}),document.addEventListener("mouseup",function(e){if(!t.isMouseDown)return!1;if(t.isMouseDown=!1,e.clientX===t.originX)return!1;t.containerActive=!1,t.timestamp=+new Date-t.timestamp;var n=t.verify(),i=n.spliced,r=n.TuringTest;if(i){if(-1===t.accuracy)return t.containerSuccess=!0,t.success=!0,void t.$emit("success",t.timestamp);r?(t.containerSuccess=!0,t.success=!0,t.$emit("success",t.timestamp)):(t.containerFail=!0,t.$emit("again"))}else t.containerFail=!0,t.$emit("fail"),setTimeout(function(){t.reset()},1e3)})},touchMoveEvent:function(t){if(!this.isMouseDown)return!1;var e=t.changedTouches[0].pageX-this.originX,n=t.changedTouches[0].pageY-this.originY;if(e<0||e+38>=this.w)return!1;this.sliderLeft=e+"px";var i=(this.w-40-20)/(this.w-40)*e;this.block.style.left=i+"px",this.containerActive=!0,this.sliderMaskWidth=e+"px",this.trail.push(n)},touchEndEvent:function(t){var e=this;if(!this.isMouseDown)return!1;if(this.isMouseDown=!1,t.changedTouches[0].pageX===this.originX)return!1;this.containerActive=!1,this.timestamp=+new Date-this.timestamp;var n=this.verify(),i=n.spliced,r=n.TuringTest;if(i){if(-1===this.accuracy)return this.containerSuccess=!0,this.success=!0,void this.$emit("success",this.timestamp);r?(this.containerSuccess=!0,this.success=!0,this.$emit("success",this.timestamp)):(this.containerFail=!0,this.$emit("again"))}else this.containerFail=!0,this.$emit("fail"),setTimeout(function(){e.reset()},1e3)},verify:function(){var t=this.trail,e=t.reduce(i)/t.length,n=t.map(function(t){return t-e}),o=Math.sqrt(n.map(r).reduce(i)/t.length),s=parseInt(this.block.style.left),a=this.accuracy<=1?1:this.accuracy>10?10:this.accuracy;return{spliced:Math.abs(s-this.block_x)<=a,TuringTest:e!==o}},reset:function(){this.success=!1,this.containerActive=!1,this.containerSuccess=!1,this.containerFail=!1,this.sliderLeft=0,this.block.style.left=0,this.sliderMaskWidth=0;var t=this.w,e=this.h;this.canvasCtx.clearRect(0,0,t,e),this.blockCtx.clearRect(0,0,t,e),this.block.width=t,this.img.src=this.getRandomImg(),this.$emit("fulfilled")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),r={install:function(t){t.component(i.a.name,i.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(i.a),e.default=r},function(t,e,n){"use strict";var i=n(1),r=n(11),o=function(t){n(4)},s=n(10)(i.a,r.a,!1,o,"data-v-b2d04a40",null);e.a=s.exports},function(t,e,n){var i=n(5);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals),n(8)("6b4c9876",i,!0,{})},function(t,e,n){var i=n(6);(t.exports=n(7)(!1)).push([t.i,".slide-verify[data-v-b2d04a40]{position:relative}.slider-verify-loading[data-v-b2d04a40]{position:absolute;top:0;right:0;left:0;bottom:0;background:hsla(0,0%,100%,.9);z-index:999;animation:loading-data-v-b2d04a40 1.5s infinite}@keyframes loading-data-v-b2d04a40{0%{opacity:.7}to{opacity:1}}.slide-verify-block[data-v-b2d04a40]{position:absolute;left:0;top:0}.slide-verify-refresh-icon[data-v-b2d04a40]{position:absolute;right:0;top:0;width:34px;height:34px;cursor:pointer;background:url("+i(n(0))+") 0 -437px;background-size:34px 471px}.slide-verify-slider[data-v-b2d04a40]{position:relative;text-align:center;width:100%;height:40px;line-height:40px;margin-top:15px;background:#f7f9fa;color:#45494c;border:1px solid #e4e7eb}.slide-verify-slider-mask[data-v-b2d04a40]{position:absolute;left:0;top:0;height:40px;border:0 solid #1991fa;background:#d1e9fe}.slide-verify-slider-mask-item[data-v-b2d04a40]{position:absolute;top:0;left:0;width:40px;height:40px;background:#fff;box-shadow:0 0 3px rgba(0,0,0,.3);cursor:pointer;transition:background .2s linear}.slide-verify-slider-mask-item[data-v-b2d04a40]:hover{background:#1991fa}.slide-verify-slider-mask-item:hover .slide-verify-slider-mask-item-icon[data-v-b2d04a40]{background-position:0 -13px}.slide-verify-slider-mask-item-icon[data-v-b2d04a40]{position:absolute;top:15px;left:13px;width:14px;height:12px;background:url("+i(n(0))+") 0 -26px;background-size:34px 471px}.container-active .slide-verify-slider-mask-item[data-v-b2d04a40]{height:38px;top:-1px;border:1px solid #1991fa}.container-active .slide-verify-slider-mask[data-v-b2d04a40]{height:38px;border-width:1px}.container-success .slide-verify-slider-mask-item[data-v-b2d04a40]{height:38px;top:-1px;border:1px solid #52ccba;background-color:#52ccba!important}.container-success .slide-verify-slider-mask[data-v-b2d04a40]{height:38px;border:1px solid #52ccba;background-color:#d2f4ef}.container-success .slide-verify-slider-mask-item-icon[data-v-b2d04a40]{background-position:0 0!important}.container-fail .slide-verify-slider-mask-item[data-v-b2d04a40]{height:38px;top:-1px;border:1px solid #f57a7a;background-color:#f57a7a!important}.container-fail .slide-verify-slider-mask[data-v-b2d04a40]{height:38px;border:1px solid #f57a7a;background-color:#fce1e1}.container-fail .slide-verify-slider-mask-item-icon[data-v-b2d04a40]{top:14px;background-position:0 -82px!important}.container-active .slide-verify-slider-text[data-v-b2d04a40],.container-fail .slide-verify-slider-text[data-v-b2d04a40],.container-success .slide-verify-slider-text[data-v-b2d04a40]{display:none}",""])},function(t,e){t.exports=function(t){return"string"!=typeof t?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),/["'() \t\n]/.test(t)?'"'+t.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':t)}},function(t,e){function n(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var r=function(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}(i);return[n].concat(i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"})).concat([r]).join("\n")}return[n].join("\n")}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var i=n(e,t);return e[2]?"@media "+e[2]+"{"+i+"}":i}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var s=t[r];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(t,e,n){function i(t){for(var e=0;e<t.length;e++){var n=t[e],i=u[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(o(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var s=[];for(r=0;r<n.parts.length;r++)s.push(o(n.parts[r]));u[n.id]={id:n.id,refs:1,parts:s}}}}function r(){var t=document.createElement("style");return t.type="text/css",c.appendChild(t),t}function o(t){var e,n,i=document.querySelector("style["+m+'~="'+t.id+'"]');if(i){if(d)return f;i.parentNode.removeChild(i)}if(v){var o=p++;i=h||(h=r()),e=s.bind(null,i,o,!1),n=s.bind(null,i,o,!0)}else i=r(),e=function(t,e){var n=e.css,i=e.media,r=e.sourceMap;if(i&&t.setAttribute("media",i),g.ssrId&&t.setAttribute(m,e.id),r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}function s(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=_(e,r);else{var o=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}var a="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!a)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var l=n(9),u={},c=a&&(document.head||document.getElementsByTagName("head")[0]),h=null,p=0,d=!1,f=function(){},g=null,m="data-vue-ssr-id",v="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,r){d=n,g=r||{};var o=l(t,e);return i(o),function(e){for(var n=[],r=0;r<o.length;r++){var s=o[r];(a=u[s.id]).refs--,n.push(a)}e?i(o=l(t,e)):o=[];for(r=0;r<n.length;r++){var a;if(0===(a=n[r]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete u[a.id]}}}};var _=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t,e){for(var n=[],i={},r=0;r<e.length;r++){var o=e[r],s=o[0],a={id:t+":"+r,css:o[1],media:o[2],sourceMap:o[3]};i[s]?i[s].parts.push(a):n.push(i[s]={id:s,parts:[a]})}return n}},function(t,e){t.exports=function(t,e,n,i,r,o){var s,a=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(s=t,a=t.default);var u,c="function"==typeof a?a.options:a;if(e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),r&&(c._scopeId=r),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):i&&(u=i),u){var h=c.functional,p=h?c.render:c.beforeCreate;h?(c._injectStyles=u,c.render=function(t,e){return u.call(e),p(t,e)}):c.beforeCreate=p?[].concat(p,u):[u]}return{esModule:s,exports:a,options:c}}},function(t,e,n){"use strict";var i={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"slide-verify",style:{width:t.w+"px"},attrs:{id:"slideVerify",onselectstart:"return false;"}},[n("div",{class:{"slider-verify-loading":t.loadBlock}}),t._v(" "),n("canvas",{ref:"canvas",attrs:{width:t.w,height:t.h}}),t._v(" "),t.show?n("div",{staticClass:"slide-verify-refresh-icon",on:{click:t.refresh}}):t._e(),t._v(" "),n("canvas",{ref:"block",staticClass:"slide-verify-block",attrs:{width:t.w,height:t.h}}),t._v(" "),n("div",{staticClass:"slide-verify-slider",class:{"container-active":t.containerActive,"container-success":t.containerSuccess,"container-fail":t.containerFail}},[n("div",{staticClass:"slide-verify-slider-mask",style:{width:t.sliderMaskWidth}},[n("div",{staticClass:"slide-verify-slider-mask-item",style:{left:t.sliderLeft},on:{mousedown:t.sliderDown,touchstart:t.touchStartEvent,touchmove:t.touchMoveEvent,touchend:t.touchEndEvent}},[n("div",{staticClass:"slide-verify-slider-mask-item-icon"})])]),t._v(" "),n("span",{staticClass:"slide-verify-slider-text"},[t._v(t._s(t.sliderText))])])])},staticRenderFns:[]};e.a=i}])},t.exports=i()},orbS:function(t,e){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=127)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},127:function(t,e,n){"use strict";n.r(e);var i={name:"ElTag",props:{text:String,closable:Boolean,type:String,hit:Boolean,disableTransitions:Boolean,color:String,size:String,effect:{type:String,default:"light",validator:function(t){return-1!==["dark","light","plain"].indexOf(t)}}},methods:{handleClose:function(t){t.stopPropagation(),this.$emit("close",t)},handleClick:function(t){this.$emit("click",t)}},computed:{tagSize:function(){return this.size||(this.$ELEMENT||{}).size}},render:function(t){var e=this.type,n=this.tagSize,i=this.hit,r=this.effect,o=t("span",{class:["el-tag",e?"el-tag--"+e:"",n?"el-tag--"+n:"",r?"el-tag--"+r:"",i&&"is-hit"],style:{backgroundColor:this.color},on:{click:this.handleClick}},[this.$slots.default,this.closable&&t("i",{class:"el-tag__close el-icon-close",on:{click:this.handleClose}})]);return this.disableTransitions?o:t("transition",{attrs:{name:"el-zoom-in-center"}},[o])}},r=n(0),o=Object(r.a)(i,void 0,void 0,!1,null,null,null);o.options.__file="packages/tag/src/tag.vue";var s=o.exports;s.install=function(t){t.component(s.name,s)};e.default=s}})},p1b6:function(t,e,n){"use strict";var i=n("cGG2");t.exports=i.isStandardBrowserEnv()?{write:function(t,e,n,r,o,s){var a=[];a.push(t+"="+encodeURIComponent(e)),i.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),i.isString(r)&&a.push("path="+r),i.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},p8xL:function(t,e,n){"use strict";var i=Object.prototype.hasOwnProperty,r=Array.isArray,o=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),s=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(n[i]=t[i]);return n};t.exports={arrayToObject:s,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],i=0;i<e.length;++i)for(var o=e[i],s=o.obj[o.prop],a=Object.keys(s),l=0;l<a.length;++l){var u=a[l],c=s[u];"object"==typeof c&&null!==c&&-1===n.indexOf(c)&&(e.push({obj:s,prop:u}),n.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(r(n)){for(var i=[],o=0;o<n.length;++o)void 0!==n[o]&&i.push(n[o]);e.obj[e.prop]=i}}}(e),t},decode:function(t,e,n){var i=t.replace(/\+/g," ");if("iso-8859-1"===n)return i.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(i)}catch(t){return i}},encode:function(t,e,n){if(0===t.length)return t;var i="string"==typeof t?t:String(t);if("iso-8859-1"===n)return escape(i).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var r="",s=0;s<i.length;++s){var a=i.charCodeAt(s);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=i.charAt(s):a<128?r+=o[a]:a<2048?r+=o[192|a>>6]+o[128|63&a]:a<55296||a>=57344?r+=o[224|a>>12]+o[128|a>>6&63]+o[128|63&a]:(s+=1,a=65536+((1023&a)<<10|1023&i.charCodeAt(s)),r+=o[240|a>>18]+o[128|a>>12&63]+o[128|a>>6&63]+o[128|63&a])}return r},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},merge:function t(e,n,o){if(!n)return e;if("object"!=typeof n){if(r(e))e.push(n);else{if(!e||"object"!=typeof e)return[e,n];(o&&(o.plainObjects||o.allowPrototypes)||!i.call(Object.prototype,n))&&(e[n]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(n);var a=e;return r(e)&&!r(n)&&(a=s(e,o)),r(e)&&r(n)?(n.forEach(function(n,r){if(i.call(e,r)){var s=e[r];s&&"object"==typeof s&&n&&"object"==typeof n?e[r]=t(s,n,o):e.push(n)}else e[r]=n}),e):Object.keys(n).reduce(function(e,r){var s=n[r];return i.call(e,r)?e[r]=t(e[r],s,o):e[r]=s,e},a)}}},pBtG:function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},pFYg:function(t,e,n){"use strict";e.__esModule=!0;var i=s(n("Zzip")),r=s(n("5QVw")),o="function"==typeof r.default&&"symbol"==typeof i.default?function(t){return typeof t}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":typeof t};function s(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof r.default&&"symbol"===o(i.default)?function(t){return void 0===t?"undefined":o(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":o(t)}},pcbz:function(t,e,n){"use strict";e.a=function(t){var e="";if(!t)try{t=n("Ya8g")}catch(t){e=t.toString()}return{readFile:t?function(e){return new Promise(function(n,i){t.readFile(e,function(t,e){return t?i(t):n(e)})})}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+e)}}}},pxG4:function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},qARP:function(t,e,n){"use strict";var i=n("lOnJ");t.exports.f=function(t){return new function(t){var e,n;this.promise=new t(function(t,i){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=i}),this.resolve=i(e),this.reject=i(n)}(t)}},qRfI:function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},qio6:function(t,e,n){var i=n("evD5"),r=n("77Pl"),o=n("lktj");t.exports=n("+E39")?Object.defineProperties:function(t,e){r(t);for(var n,s=o(e),a=s.length,l=0;a>l;)i.f(t,n=s[l++],e[n]);return t}},qkKv:function(t,e,n){var i=n("FeBl"),r=i.JSON||(i.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},s3ue:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=126)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},126:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-checkbox-group",attrs:{role:"group","aria-label":"checkbox-group"}},[this._t("default")],2)};i._withStripped=!0;var r=n(4),o={name:"ElCheckboxGroup",componentName:"ElCheckboxGroup",mixins:[n.n(r).a],inject:{elFormItem:{default:""}},props:{value:{},disabled:Boolean,min:Number,max:Number,size:String,fill:String,textColor:String},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},checkboxGroupSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size}},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",[t])}}},s=n(0),a=Object(s.a)(o,i,[],!1,null,null,null);a.options.__file="packages/checkbox/src/checkbox-group.vue";var l=a.exports;l.install=function(t){t.component(l.name,l)};e.default=l},4:function(t,e){t.exports=n("fPll")}})},sB3e:function(t,e,n){var i=n("52gC");t.exports=function(t){return Object(i(t))}},sOR5:function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},t8qj:function(t,e,n){"use strict";t.exports=function(t,e,n,i,r){return t.config=e,n&&(t.code=n),t.request=i,t.response=r,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}},t8x9:function(t,e,n){var i=n("77Pl"),r=n("lOnJ"),o=n("dSzd")("species");t.exports=function(t,e){var n,s=i(t).constructor;return void 0===s||void 0==(n=i(s)[o])?e:r(n)}},tIFN:function(t,e,n){"use strict";var i=n("cGG2"),r=n("JP+z"),o=n("XmWM"),s=n("DUeU");function a(t){var e=new o(t),n=r(o.prototype.request,e);return i.extend(n,o.prototype,e),i.extend(n,e),n}var l=a(n("KCLY"));l.Axios=o,l.create=function(t){return a(s(l.defaults,t))},l.Cancel=n("dVOP"),l.CancelToken=n("cWxy"),l.isCancel=n("pBtG"),l.all=function(t){return Promise.all(t)},l.spread=n("pxG4"),l.isAxiosError=n("SLDG"),t.exports=l,t.exports.default=l},tk3E:function(t,e,n){var i,r,o,s;s=function(t){
  88. /**
  89. * @license
  90. * Copyright 2019 Google LLC
  91. * SPDX-License-Identifier: Apache-2.0
  92. */
  93. "use strict";return t},r=[n("Ew4t")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},uY1a:function(t,e){t.exports=function(t,e,n,i){var r,o=0;return"boolean"!=typeof e&&(i=n,n=e,e=void 0),function(){var s=this,a=Number(new Date)-o,l=arguments;function u(){o=Number(new Date),n.apply(s,l)}i&&!r&&u(),r&&clearTimeout(r),void 0===i&&a>t?u():!0!==e&&(r=setTimeout(i?function(){r=void 0}:u,void 0===i?t-a:t))}}},ujcs:function(t,e){
  94. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  95. e.read=function(t,e,n,i,r){var o,s,a=8*r-i-1,l=(1<<a)-1,u=l>>1,c=-7,h=n?r-1:0,p=n?-1:1,d=t[e+h];for(h+=p,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+h],h+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=i;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=u}return(d?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var s,a,l,u=8*o-r-1,c=(1<<u)-1,h=c>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,f=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*l-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+d]=255&a,d+=f,a/=256,r-=8);for(s=s<<r|a,u+=r;u>0;t[n+d]=255&s,d+=f,s/=256,u-=8);t[n+d-f]|=128*g}},uqUo:function(t,e,n){var i=n("kM2E"),r=n("FeBl"),o=n("S82l");t.exports=function(t,e){var n=(r.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*o(function(){n(1)}),"Object",s)}},urW8:function(t,e,n){"use strict";e.__esModule=!0,e.i18n=e.use=e.t=void 0;var i=s(n("Vi3T")),r=s(n("7+uW")),o=s(n("i3rX"));function s(t){return t&&t.__esModule?t:{default:t}}var a=(0,s(n("SvnF")).default)(r.default),l=i.default,u=!1,c=function(){var t=Object.getPrototypeOf(this||r.default).$t;if("function"==typeof t&&r.default.locale)return u||(u=!0,r.default.locale(r.default.config.lang,(0,o.default)(l,r.default.locale(r.default.config.lang)||{},{clone:!0}))),t.apply(this,arguments)},h=e.t=function(t,e){var n=c.apply(this,arguments);if(null!==n&&void 0!==n)return n;for(var i=t.split("."),r=l,o=0,s=i.length;o<s;o++){if(n=r[i[o]],o===s-1)return a(n,e);if(!n)return"";r=n}return""},p=e.use=function(t){l=t||l},d=e.i18n=function(t){c=t||c};e.default={use:p,t:h,i18n:d}},"us/S":function(t,e,n){t.exports={default:n("Xd32"),__esModule:!0}},"vFc/":function(t,e,n){var i=n("TcQ7"),r=n("QRG4"),o=n("fkB2");t.exports=function(t){return function(e,n,s){var a,l=i(e),u=r(l.length),c=o(s,u);if(t&&n!=n){for(;u>c;)if((a=l[c++])!=a)return!0}else for(;u>c;c++)if((t||c in l)&&l[c]===n)return t||c||0;return!t&&-1}}},"vIB/":function(t,e,n){"use strict";var i=n("O4g8"),r=n("kM2E"),o=n("880/"),s=n("hJx8"),a=n("/bQp"),l=n("94VQ"),u=n("e6n0"),c=n("PzxK"),h=n("dSzd")("iterator"),p=!([].keys&&"next"in[].keys()),d=function(){return this};t.exports=function(t,e,n,f,g,m,v){l(n,e,f);var _,y,b,T=function(t){if(!p&&t in w)return w[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},E=e+" Iterator",C="values"==g,S=!1,w=t.prototype,k=w[h]||w["@@iterator"]||g&&w[g],x=k||T(g),I=g?C?T("entries"):x:void 0,R="Array"==e&&w.entries||k;if(R&&(b=c(R.call(new t)))!==Object.prototype&&b.next&&(u(b,E,!0),i||"function"==typeof b[h]||s(b,h,d)),C&&k&&"values"!==k.name&&(S=!0,x=function(){return k.call(this)}),i&&!v||!p&&!S&&w[h]||s(w,h,x),a[e]=x,a[E]=d,g)if(_={values:C?x:T("values"),keys:m?x:T("keys"),entries:I},v)for(y in _)y in w||o(w,y,_[y]);else r(r.P+r.F*(p||S),e,_);return _}},wTUY:function(t,e,n){var i,r,o,s;s=function(t){
  96. /**
  97. * @license
  98. * Copyright 2020 Google LLC
  99. * SPDX-License-Identifier: Apache-2.0
  100. */
  101. "use strict";return t.Blocks={},t.Blocks},r=[n("QUGb")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},woOf:function(t,e,n){t.exports={default:n("V3tA"),__esModule:!0}},xGkn:function(t,e,n){"use strict";var i=n("4mcu"),r=n("EGZi"),o=n("/bQp"),s=n("TcQ7");t.exports=n("vIB/")(Array,"Array",function(t,e){this._t=s(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},"xH/j":function(t,e,n){var i=n("hJx8");t.exports=function(t,e,n){for(var r in e)n&&t[r]?t[r]=e[r]:i(t,r,e[r]);return t}},xLtR:function(t,e,n){"use strict";var i=n("cGG2"),r=n("TNV1"),o=n("pBtG"),s=n("KCLY");function a(t){t.cancelToken&&t.cancelToken.throwIfRequested()}t.exports=function(t){return a(t),t.headers=t.headers||{},t.data=r(t.data,t.headers,t.transformRequest),t.headers=i.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),i.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||s.adapter)(t).then(function(e){return a(t),e.data=r(e.data,e.headers,t.transformResponse),e},function(e){return o(e)||(a(t),e&&e.response&&(e.response.data=r(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},xnUL:function(t,e,n){var i,r,o,s;s=function(t){
  102. /**
  103. * @license
  104. * Copyright 2019 Google LLC
  105. * SPDX-License-Identifier: Apache-2.0
  106. */
  107. "use strict";return t.setLocale=function(e){t.Msg=t.Msg||{},Object.keys(e).forEach(function(n){t.Msg[n]=e[n]})},t},r=[n("/dHd")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},xnc9:function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"y+7x":function(t,e,n){"use strict";e.__esModule=!0;var i=n("urW8");e.default={methods:{t:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i.t.apply(this,e)}}}},yUki:function(t,e,n){var i,r,o,s;s=function(t){return(t={Msg:{}}).Msg.ADD_COMMENT="Add Comment",t.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="Can't delete the variable '%1' because it's part of the definition of the function '%2'",t.Msg.CHANGE_VALUE_TITLE="Change value:",t.Msg.CLEAN_UP="Clean up Blocks",t.Msg.COLLAPSED_WARNINGS_WARNING="Collapsed blocks contain warnings.",t.Msg.COLLAPSE_ALL="Collapse Blocks",t.Msg.COLLAPSE_BLOCK="Collapse Block",t.Msg.COLOUR_BLEND_COLOUR1="colour 1",t.Msg.COLOUR_BLEND_COLOUR2="colour 2",t.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",t.Msg.COLOUR_BLEND_RATIO="ratio",t.Msg.COLOUR_BLEND_TITLE="blend",t.Msg.COLOUR_BLEND_TOOLTIP="Blends two colours together with a given ratio (0.0 - 1.0).",t.Msg.COLOUR_PICKER_HELPURL="https://en.wikipedia.org/wiki/Color",t.Msg.COLOUR_PICKER_TOOLTIP="Choose a colour from the palette.",t.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",t.Msg.COLOUR_RANDOM_TITLE="random colour",t.Msg.COLOUR_RANDOM_TOOLTIP="Choose a colour at random.",t.Msg.COLOUR_RGB_BLUE="blue",t.Msg.COLOUR_RGB_GREEN="green",t.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",t.Msg.COLOUR_RGB_RED="red",t.Msg.COLOUR_RGB_TITLE="colour with",t.Msg.COLOUR_RGB_TOOLTIP="Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.",t.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break out of loop",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue with next iteration of loop",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Break out of the containing loop.",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Skip the rest of this loop, and continue with the next iteration.",t.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="Warning: This block may only be used within a loop.",t.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each",t.Msg.CONTROLS_FOREACH_TITLE="for each item %1 in list %2",t.Msg.CONTROLS_FOREACH_TOOLTIP="For each item in a list, set the variable '%1' to the item, and then do some statements.",t.Msg.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with",t.Msg.CONTROLS_FOR_TITLE="count with %1 from %2 to %3 by %4",t.Msg.CONTROLS_FOR_TOOLTIP="Have the variable '%1' take on the values from the start number to the end number, counting by the specified interval, and do the specified blocks.",t.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="Add a condition to the if block.",t.Msg.CONTROLS_IF_ELSE_TOOLTIP="Add a final, catch-all condition to the if block.",t.Msg.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse",t.Msg.CONTROLS_IF_IF_TOOLTIP="Add, remove, or reorder sections to reconfigure this if block.",t.Msg.CONTROLS_IF_MSG_ELSE="else",t.Msg.CONTROLS_IF_MSG_ELSEIF="else if",t.Msg.CONTROLS_IF_MSG_IF="if",t.Msg.CONTROLS_IF_TOOLTIP_1="If a value is true, then do some statements.",t.Msg.CONTROLS_IF_TOOLTIP_2="If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",t.Msg.CONTROLS_IF_TOOLTIP_3="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements.",t.Msg.CONTROLS_IF_TOOLTIP_4="If the first value is true, then do the first block of statements. Otherwise, if the second value is true, do the second block of statements. If none of the values are true, do the last block of statements.",t.Msg.CONTROLS_REPEAT_HELPURL="https://en.wikipedia.org/wiki/For_loop",t.Msg.CONTROLS_REPEAT_INPUT_DO="do",t.Msg.CONTROLS_REPEAT_TITLE="repeat %1 times",t.Msg.CONTROLS_REPEAT_TOOLTIP="Do some statements several times.",t.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repeat until",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repeat while",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="While a value is false, then do some statements.",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="While a value is true, then do some statements.",t.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?",t.Msg.DELETE_BLOCK="Delete Block",t.Msg.DELETE_VARIABLE="Delete the '%1' variable",t.Msg.DELETE_VARIABLE_CONFIRMATION="Delete %1 uses of the '%2' variable?",t.Msg.DELETE_X_BLOCKS="Delete %1 Blocks",t.Msg.DISABLE_BLOCK="Disable Block",t.Msg.DUPLICATE_BLOCK="Duplicate",t.Msg.DUPLICATE_COMMENT="Duplicate Comment",t.Msg.ENABLE_BLOCK="Enable Block",t.Msg.EXPAND_ALL="Expand Blocks",t.Msg.EXPAND_BLOCK="Expand Block",t.Msg.EXTERNAL_INPUTS="External Inputs",t.Msg.HELP="Help",t.Msg.INLINE_INPUTS="Inline Inputs",t.Msg.IOS_CANCEL="Cancel",t.Msg.IOS_ERROR="Error",t.Msg.IOS_OK="OK",t.Msg.IOS_PROCEDURES_ADD_INPUT="+ Add Input",t.Msg.IOS_PROCEDURES_ALLOW_STATEMENTS="Allow statements",t.Msg.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="This function has duplicate inputs.",t.Msg.IOS_PROCEDURES_INPUTS="INPUTS",t.Msg.IOS_VARIABLES_ADD_BUTTON="Add",t.Msg.IOS_VARIABLES_ADD_VARIABLE="+ Add Variable",t.Msg.IOS_VARIABLES_DELETE_BUTTON="Delete",t.Msg.IOS_VARIABLES_EMPTY_NAME_ERROR="You can't use an empty variable name.",t.Msg.IOS_VARIABLES_RENAME_BUTTON="Rename",t.Msg.IOS_VARIABLES_VARIABLE_NAME="Variable name",t.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list",t.Msg.LISTS_CREATE_EMPTY_TITLE="create empty list",t.Msg.LISTS_CREATE_EMPTY_TOOLTIP="Returns a list, of length 0, containing no data records",t.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="list",t.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Add, remove, or reorder sections to reconfigure this list block.",t.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_CREATE_WITH_INPUT_WITH="create list with",t.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="Add an item to the list.",t.Msg.LISTS_CREATE_WITH_TOOLTIP="Create a list with any number of items.",t.Msg.LISTS_GET_INDEX_FIRST="first",t.Msg.LISTS_GET_INDEX_FROM_END="# from end",t.Msg.LISTS_GET_INDEX_FROM_START="#",t.Msg.LISTS_GET_INDEX_GET="get",t.Msg.LISTS_GET_INDEX_GET_REMOVE="get and remove",t.Msg.LISTS_GET_INDEX_LAST="last",t.Msg.LISTS_GET_INDEX_RANDOM="random",t.Msg.LISTS_GET_INDEX_REMOVE="remove",t.Msg.LISTS_GET_INDEX_TAIL="",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Returns the first item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Returns the item at the specified position in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Returns the last item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Returns a random item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Removes and returns the first item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Removes and returns the item at the specified position in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Removes and returns the last item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Removes and returns a random item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Removes the first item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Removes the item at the specified position in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Removes the last item in a list.",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Removes a random item in a list.",t.Msg.LISTS_GET_SUBLIST_END_FROM_END="to # from end",t.Msg.LISTS_GET_SUBLIST_END_FROM_START="to #",t.Msg.LISTS_GET_SUBLIST_END_LAST="to last",t.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist",t.Msg.LISTS_GET_SUBLIST_START_FIRST="get sub-list from first",t.Msg.LISTS_GET_SUBLIST_START_FROM_END="get sub-list from # from end",t.Msg.LISTS_GET_SUBLIST_START_FROM_START="get sub-list from #",t.Msg.LISTS_GET_SUBLIST_TAIL="",t.Msg.LISTS_GET_SUBLIST_TOOLTIP="Creates a copy of the specified portion of a list.",t.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1 is the last item.",t.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1 is the first item.",t.Msg.LISTS_INDEX_OF_FIRST="find first occurrence of item",t.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",t.Msg.LISTS_INDEX_OF_LAST="find last occurrence of item",t.Msg.LISTS_INDEX_OF_TOOLTIP="Returns the index of the first/last occurrence of the item in the list. Returns %1 if item is not found.",t.Msg.LISTS_INLIST="in list",t.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty",t.Msg.LISTS_ISEMPTY_TITLE="%1 is empty",t.Msg.LISTS_ISEMPTY_TOOLTIP="Returns true if the list is empty.",t.Msg.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of",t.Msg.LISTS_LENGTH_TITLE="length of %1",t.Msg.LISTS_LENGTH_TOOLTIP="Returns the length of a list.",t.Msg.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_REPEAT_TITLE="create list with item %1 repeated %2 times",t.Msg.LISTS_REPEAT_TOOLTIP="Creates a list consisting of the given value repeated the specified number of times.",t.Msg.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Lists#reversing-a-list",t.Msg.LISTS_REVERSE_MESSAGE0="reverse %1",t.Msg.LISTS_REVERSE_TOOLTIP="Reverse a copy of a list.",t.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set",t.Msg.LISTS_SET_INDEX_INPUT_TO="as",t.Msg.LISTS_SET_INDEX_INSERT="insert at",t.Msg.LISTS_SET_INDEX_SET="set",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Inserts the item at the start of a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Inserts the item at the specified position in a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Append the item to the end of a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Inserts the item randomly in a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Sets the first item in a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Sets the item at the specified position in a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Sets the last item in a list.",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Sets a random item in a list.",t.Msg.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list",t.Msg.LISTS_SORT_ORDER_ASCENDING="ascending",t.Msg.LISTS_SORT_ORDER_DESCENDING="descending",t.Msg.LISTS_SORT_TITLE="sort %1 %2 %3",t.Msg.LISTS_SORT_TOOLTIP="Sort a copy of a list.",t.Msg.LISTS_SORT_TYPE_IGNORECASE="alphabetic, ignore case",t.Msg.LISTS_SORT_TYPE_NUMERIC="numeric",t.Msg.LISTS_SORT_TYPE_TEXT="alphabetic",t.Msg.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",t.Msg.LISTS_SPLIT_LIST_FROM_TEXT="make list from text",t.Msg.LISTS_SPLIT_TEXT_FROM_LIST="make text from list",t.Msg.LISTS_SPLIT_TOOLTIP_JOIN="Join a list of texts into one text, separated by a delimiter.",t.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="Split text into a list of texts, breaking at each delimiter.",t.Msg.LISTS_SPLIT_WITH_DELIMITER="with delimiter",t.Msg.LOGIC_BOOLEAN_FALSE="false",t.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values",t.Msg.LOGIC_BOOLEAN_TOOLTIP="Returns either true or false.",t.Msg.LOGIC_BOOLEAN_TRUE="true",t.Msg.LOGIC_COMPARE_HELPURL="https://en.wikipedia.org/wiki/Inequality_(mathematics)",t.Msg.LOGIC_COMPARE_TOOLTIP_EQ="Return true if both inputs equal each other.",t.Msg.LOGIC_COMPARE_TOOLTIP_GT="Return true if the first input is greater than the second input.",t.Msg.LOGIC_COMPARE_TOOLTIP_GTE="Return true if the first input is greater than or equal to the second input.",t.Msg.LOGIC_COMPARE_TOOLTIP_LT="Return true if the first input is smaller than the second input.",t.Msg.LOGIC_COMPARE_TOOLTIP_LTE="Return true if the first input is smaller than or equal to the second input.",t.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="Return true if both inputs are not equal to each other.",t.Msg.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not",t.Msg.LOGIC_NEGATE_TITLE="not %1",t.Msg.LOGIC_NEGATE_TOOLTIP="Returns true if the input is false. Returns false if the input is true.",t.Msg.LOGIC_NULL="null",t.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",t.Msg.LOGIC_NULL_TOOLTIP="Returns null.",t.Msg.LOGIC_OPERATION_AND="and",t.Msg.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations",t.Msg.LOGIC_OPERATION_OR="or",t.Msg.LOGIC_OPERATION_TOOLTIP_AND="Return true if both inputs are true.",t.Msg.LOGIC_OPERATION_TOOLTIP_OR="Return true if at least one of the inputs is true.",t.Msg.LOGIC_TERNARY_CONDITION="test",t.Msg.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:",t.Msg.LOGIC_TERNARY_IF_FALSE="if false",t.Msg.LOGIC_TERNARY_IF_TRUE="if true",t.Msg.LOGIC_TERNARY_TOOLTIP="Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.",t.Msg.MATH_ADDITION_SYMBOL="+",t.Msg.MATH_ARITHMETIC_HELPURL="https://en.wikipedia.org/wiki/Arithmetic",t.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="Return the sum of the two numbers.",t.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Return the quotient of the two numbers.",t.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="Return the difference of the two numbers.",t.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Return the product of the two numbers.",t.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="Return the first number raised to the power of the second number.",t.Msg.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2",t.Msg.MATH_ATAN2_TITLE="atan2 of X:%1 Y:%2",t.Msg.MATH_ATAN2_TOOLTIP="Return the arctangent of point (X, Y) in degrees from -180 to 180.",t.Msg.MATH_CHANGE_HELPURL="https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",t.Msg.MATH_CHANGE_TITLE="change %1 by %2",t.Msg.MATH_CHANGE_TOOLTIP="Add a number to variable '%1'.",t.Msg.MATH_CONSTANT_HELPURL="https://en.wikipedia.org/wiki/Mathematical_constant",t.Msg.MATH_CONSTANT_TOOLTIP="Return one of the common constants: π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), or ∞ (infinity).",t.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",t.Msg.MATH_CONSTRAIN_TITLE="constrain %1 low %2 high %3",t.Msg.MATH_CONSTRAIN_TOOLTIP="Constrain a number to be between the specified limits (inclusive).",t.Msg.MATH_DIVISION_SYMBOL="÷",t.Msg.MATH_IS_DIVISIBLE_BY="is divisible by",t.Msg.MATH_IS_EVEN="is even",t.Msg.MATH_IS_NEGATIVE="is negative",t.Msg.MATH_IS_ODD="is odd",t.Msg.MATH_IS_POSITIVE="is positive",t.Msg.MATH_IS_PRIME="is prime",t.Msg.MATH_IS_TOOLTIP="Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain number. Returns true or false.",t.Msg.MATH_IS_WHOLE="is whole",t.Msg.MATH_MODULO_HELPURL="https://en.wikipedia.org/wiki/Modulo_operation",t.Msg.MATH_MODULO_TITLE="remainder of %1 ÷ %2",t.Msg.MATH_MODULO_TOOLTIP="Return the remainder from dividing the two numbers.",t.Msg.MATH_MULTIPLICATION_SYMBOL="×",t.Msg.MATH_NUMBER_HELPURL="https://en.wikipedia.org/wiki/Number",t.Msg.MATH_NUMBER_TOOLTIP="A number.",t.Msg.MATH_ONLIST_HELPURL="",t.Msg.MATH_ONLIST_OPERATOR_AVERAGE="average of list",t.Msg.MATH_ONLIST_OPERATOR_MAX="max of list",t.Msg.MATH_ONLIST_OPERATOR_MEDIAN="median of list",t.Msg.MATH_ONLIST_OPERATOR_MIN="min of list",t.Msg.MATH_ONLIST_OPERATOR_MODE="modes of list",t.Msg.MATH_ONLIST_OPERATOR_RANDOM="random item of list",t.Msg.MATH_ONLIST_OPERATOR_STD_DEV="standard deviation of list",t.Msg.MATH_ONLIST_OPERATOR_SUM="sum of list",t.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="Return the average (arithmetic mean) of the numeric values in the list.",t.Msg.MATH_ONLIST_TOOLTIP_MAX="Return the largest number in the list.",t.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="Return the median number in the list.",t.Msg.MATH_ONLIST_TOOLTIP_MIN="Return the smallest number in the list.",t.Msg.MATH_ONLIST_TOOLTIP_MODE="Return a list of the most common item(s) in the list.",t.Msg.MATH_ONLIST_TOOLTIP_RANDOM="Return a random element from the list.",t.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="Return the standard deviation of the list.",t.Msg.MATH_ONLIST_TOOLTIP_SUM="Return the sum of all the numbers in the list.",t.Msg.MATH_POWER_SYMBOL="^",t.Msg.MATH_RANDOM_FLOAT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",t.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="random fraction",t.Msg.MATH_RANDOM_FLOAT_TOOLTIP="Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",t.Msg.MATH_RANDOM_INT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",t.Msg.MATH_RANDOM_INT_TITLE="random integer from %1 to %2",t.Msg.MATH_RANDOM_INT_TOOLTIP="Return a random integer between the two specified limits, inclusive.",t.Msg.MATH_ROUND_HELPURL="https://en.wikipedia.org/wiki/Rounding",t.Msg.MATH_ROUND_OPERATOR_ROUND="round",t.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="round down",t.Msg.MATH_ROUND_OPERATOR_ROUNDUP="round up",t.Msg.MATH_ROUND_TOOLTIP="Round a number up or down.",t.Msg.MATH_SINGLE_HELPURL="https://en.wikipedia.org/wiki/Square_root",t.Msg.MATH_SINGLE_OP_ABSOLUTE="absolute",t.Msg.MATH_SINGLE_OP_ROOT="square root",t.Msg.MATH_SINGLE_TOOLTIP_ABS="Return the absolute value of a number.",t.Msg.MATH_SINGLE_TOOLTIP_EXP="Return e to the power of a number.",t.Msg.MATH_SINGLE_TOOLTIP_LN="Return the natural logarithm of a number.",t.Msg.MATH_SINGLE_TOOLTIP_LOG10="Return the base 10 logarithm of a number.",t.Msg.MATH_SINGLE_TOOLTIP_NEG="Return the negation of a number.",t.Msg.MATH_SINGLE_TOOLTIP_POW10="Return 10 to the power of a number.",t.Msg.MATH_SINGLE_TOOLTIP_ROOT="Return the square root of a number.",t.Msg.MATH_SUBTRACTION_SYMBOL="-",t.Msg.MATH_TRIG_ACOS="acos",t.Msg.MATH_TRIG_ASIN="asin",t.Msg.MATH_TRIG_ATAN="atan",t.Msg.MATH_TRIG_COS="cos",t.Msg.MATH_TRIG_HELPURL="https://en.wikipedia.org/wiki/Trigonometric_functions",t.Msg.MATH_TRIG_SIN="sin",t.Msg.MATH_TRIG_TAN="tan",t.Msg.MATH_TRIG_TOOLTIP_ACOS="Return the arccosine of a number.",t.Msg.MATH_TRIG_TOOLTIP_ASIN="Return the arcsine of a number.",t.Msg.MATH_TRIG_TOOLTIP_ATAN="Return the arctangent of a number.",t.Msg.MATH_TRIG_TOOLTIP_COS="Return the cosine of a degree (not radian).",t.Msg.MATH_TRIG_TOOLTIP_SIN="Return the sine of a degree (not radian).",t.Msg.MATH_TRIG_TOOLTIP_TAN="Return the tangent of a degree (not radian).",t.Msg.NEW_COLOUR_VARIABLE="Create colour variable...",t.Msg.NEW_NUMBER_VARIABLE="Create number variable...",t.Msg.NEW_STRING_VARIABLE="Create string variable...",t.Msg.NEW_VARIABLE="Create variable...",t.Msg.NEW_VARIABLE_TITLE="New variable name:",t.Msg.NEW_VARIABLE_TYPE_TITLE="New variable type:",t.Msg.ORDINAL_NUMBER_SUFFIX="",t.Msg.PROCEDURES_ALLOW_STATEMENTS="allow statements",t.Msg.PROCEDURES_BEFORE_PARAMS="with:",t.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",t.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="Run the user-defined function '%1'.",t.Msg.PROCEDURES_CALLRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",t.Msg.PROCEDURES_CALLRETURN_TOOLTIP="Run the user-defined function '%1' and use its output.",t.Msg.PROCEDURES_CALL_BEFORE_PARAMS="with:",t.Msg.PROCEDURES_CREATE_DO="Create '%1'",t.Msg.PROCEDURES_DEFNORETURN_COMMENT="Describe this function...",t.Msg.PROCEDURES_DEFNORETURN_DO="",t.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="do something",t.Msg.PROCEDURES_DEFNORETURN_TITLE="to",t.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="Creates a function with no output.",t.Msg.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",t.Msg.PROCEDURES_DEFRETURN_RETURN="return",t.Msg.PROCEDURES_DEFRETURN_TOOLTIP="Creates a function with an output.",t.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="Warning: This function has duplicate parameters.",t.Msg.PROCEDURES_HIGHLIGHT_DEF="Highlight function definition",t.Msg.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause",t.Msg.PROCEDURES_IFRETURN_TOOLTIP="If a value is true, then return a second value.",t.Msg.PROCEDURES_IFRETURN_WARNING="Warning: This block may be used only within a function definition.",t.Msg.PROCEDURES_MUTATORARG_TITLE="input name:",t.Msg.PROCEDURES_MUTATORARG_TOOLTIP="Add an input to the function.",t.Msg.PROCEDURES_MUTATORCONTAINER_TITLE="inputs",t.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Add, remove, or reorder inputs to this function.",t.Msg.REDO="Redo",t.Msg.REMOVE_COMMENT="Remove Comment",t.Msg.RENAME_VARIABLE="Rename variable...",t.Msg.RENAME_VARIABLE_TITLE="Rename all '%1' variables to:",t.Msg.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_APPEND_TITLE="to %1 append text %2",t.Msg.TEXT_APPEND_TOOLTIP="Append some text to variable '%1'.",t.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case",t.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="to lower case",t.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="to Title Case",t.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="to UPPER CASE",t.Msg.TEXT_CHANGECASE_TOOLTIP="Return a copy of the text in a different case.",t.Msg.TEXT_CHARAT_FIRST="get first letter",t.Msg.TEXT_CHARAT_FROM_END="get letter # from end",t.Msg.TEXT_CHARAT_FROM_START="get letter #",t.Msg.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text",t.Msg.TEXT_CHARAT_LAST="get last letter",t.Msg.TEXT_CHARAT_RANDOM="get random letter",t.Msg.TEXT_CHARAT_TAIL="",t.Msg.TEXT_CHARAT_TITLE="in text %1 %2",t.Msg.TEXT_CHARAT_TOOLTIP="Returns the letter at the specified position.",t.Msg.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings",t.Msg.TEXT_COUNT_MESSAGE0="count %1 in %2",t.Msg.TEXT_COUNT_TOOLTIP="Count how many times some text occurs within some other text.",t.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Add an item to the text.",t.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="join",t.Msg.TEXT_CREATE_JOIN_TOOLTIP="Add, remove, or reorder sections to reconfigure this text block.",t.Msg.TEXT_GET_SUBSTRING_END_FROM_END="to letter # from end",t.Msg.TEXT_GET_SUBSTRING_END_FROM_START="to letter #",t.Msg.TEXT_GET_SUBSTRING_END_LAST="to last letter",t.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",t.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="in text",t.Msg.TEXT_GET_SUBSTRING_START_FIRST="get substring from first letter",t.Msg.TEXT_GET_SUBSTRING_START_FROM_END="get substring from letter # from end",t.Msg.TEXT_GET_SUBSTRING_START_FROM_START="get substring from letter #",t.Msg.TEXT_GET_SUBSTRING_TAIL="",t.Msg.TEXT_GET_SUBSTRING_TOOLTIP="Returns a specified portion of the text.",t.Msg.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text",t.Msg.TEXT_INDEXOF_OPERATOR_FIRST="find first occurrence of text",t.Msg.TEXT_INDEXOF_OPERATOR_LAST="find last occurrence of text",t.Msg.TEXT_INDEXOF_TITLE="in text %1 %2 %3",t.Msg.TEXT_INDEXOF_TOOLTIP="Returns the index of the first/last occurrence of the first text in the second text. Returns %1 if text is not found.",t.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text",t.Msg.TEXT_ISEMPTY_TITLE="%1 is empty",t.Msg.TEXT_ISEMPTY_TOOLTIP="Returns true if the provided text is empty.",t.Msg.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation",t.Msg.TEXT_JOIN_TITLE_CREATEWITH="create text with",t.Msg.TEXT_JOIN_TOOLTIP="Create a piece of text by joining together any number of items.",t.Msg.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_LENGTH_TITLE="length of %1",t.Msg.TEXT_LENGTH_TOOLTIP="Returns the number of letters (including spaces) in the provided text.",t.Msg.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text",t.Msg.TEXT_PRINT_TITLE="print %1",t.Msg.TEXT_PRINT_TOOLTIP="Print the specified text, number or other value.",t.Msg.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",t.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="Prompt for user for a number.",t.Msg.TEXT_PROMPT_TOOLTIP_TEXT="Prompt for user for some text.",t.Msg.TEXT_PROMPT_TYPE_NUMBER="prompt for number with message",t.Msg.TEXT_PROMPT_TYPE_TEXT="prompt for text with message",t.Msg.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Text#replacing-substrings",t.Msg.TEXT_REPLACE_MESSAGE0="replace %1 with %2 in %3",t.Msg.TEXT_REPLACE_TOOLTIP="Replace all occurances of some text within some other text.",t.Msg.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Text#reversing-text",t.Msg.TEXT_REVERSE_MESSAGE0="reverse %1",t.Msg.TEXT_REVERSE_TOOLTIP="Reverses the order of the characters in the text.",t.Msg.TEXT_TEXT_HELPURL="https://en.wikipedia.org/wiki/String_(computer_science)",t.Msg.TEXT_TEXT_TOOLTIP="A letter, word, or line of text.",t.Msg.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",t.Msg.TEXT_TRIM_OPERATOR_BOTH="trim spaces from both sides of",t.Msg.TEXT_TRIM_OPERATOR_LEFT="trim spaces from left side of",t.Msg.TEXT_TRIM_OPERATOR_RIGHT="trim spaces from right side of",t.Msg.TEXT_TRIM_TOOLTIP="Return a copy of the text with spaces removed from one or both ends.",t.Msg.TODAY="Today",t.Msg.UNDO="Undo",t.Msg.UNNAMED_KEY="unnamed",t.Msg.VARIABLES_DEFAULT_NAME="item",t.Msg.VARIABLES_GET_CREATE_SET="Create 'set %1'",t.Msg.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get",t.Msg.VARIABLES_GET_TOOLTIP="Returns the value of this variable.",t.Msg.VARIABLES_SET="set %1 to %2",t.Msg.VARIABLES_SET_CREATE_GET="Create 'get %1'",t.Msg.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set",t.Msg.VARIABLES_SET_TOOLTIP="Sets this variable to be equal to the input.",t.Msg.VARIABLE_ALREADY_EXISTS="A variable named '%1' already exists.",t.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="A variable named '%1' already exists for another type: '%2'.",t.Msg.WORKSPACE_ARIA_LABEL="Blockly Workspace",t.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="Say something...",t.Msg.CONTROLS_FOREACH_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_FOR_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=t.Msg.CONTROLS_IF_MSG_ELSEIF,t.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=t.Msg.CONTROLS_IF_MSG_ELSE,t.Msg.CONTROLS_IF_IF_TITLE_IF=t.Msg.CONTROLS_IF_MSG_IF,t.Msg.CONTROLS_IF_MSG_THEN=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.LISTS_CREATE_WITH_ITEM_TITLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.LISTS_GET_INDEX_HELPURL=t.Msg.LISTS_INDEX_OF_HELPURL,t.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.MATH_CHANGE_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.PROCEDURES_DEFRETURN_COMMENT=t.Msg.PROCEDURES_DEFNORETURN_COMMENT,t.Msg.PROCEDURES_DEFRETURN_DO=t.Msg.PROCEDURES_DEFNORETURN_DO,t.Msg.PROCEDURES_DEFRETURN_PROCEDURE=t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,t.Msg.PROCEDURES_DEFRETURN_TITLE=t.Msg.PROCEDURES_DEFNORETURN_TITLE,t.Msg.TEXT_APPEND_VARIABLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.MATH_HUE="230",t.Msg.LOOPS_HUE="120",t.Msg.LISTS_HUE="260",t.Msg.LOGIC_HUE="210",t.Msg.VARIABLES_HUE="330",t.Msg.TEXTS_HUE="160",t.Msg.PROCEDURES_HUE="290",t.Msg.COLOUR_HUE="20",t.Msg.VARIABLES_DYNAMIC_HUE="310",t.Msg},r=[n("xnUL")],void 0===(o="function"==typeof(i=s)?i.apply(e,r):i)||(t.exports=o)},ylDJ:function(t,e,n){"use strict";e.__esModule=!0,e.isEmpty=e.isEqual=e.arrayEquals=e.looseEqual=e.capitalize=e.kebabCase=e.autoprefixer=e.isFirefox=e.isEdge=e.isIE=e.coerceTruthyValueToArray=e.arrayFind=e.arrayFindIndex=e.escapeRegexpString=e.valueEquals=e.generateId=e.getValueByPath=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.noop=function(){},e.hasOwn=function(t,e){return l.call(t,e)},e.toObject=function(t){for(var e={},n=0;n<t.length;n++)t[n]&&u(e,t[n]);return e},e.getPropByPath=function(t,e,n){for(var i=t,r=(e=(e=e.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),o=0,s=r.length;o<s-1&&(i||n);++o){var a=r[o];if(!(a in i)){if(n)throw new Error("please transfer a valid prop path to form item!");break}i=i[a]}return{o:i,k:r[o],v:i?i[r[o]]:null}},e.rafThrottle=function(t){var e=!1;return function(){for(var n=this,i=arguments.length,r=Array(i),o=0;o<i;o++)r[o]=arguments[o];e||(e=!0,window.requestAnimationFrame(function(i){t.apply(n,r),e=!1}))}},e.objToArray=function(t){if(Array.isArray(t))return t;return d(t)?[]:[t]};var r,o=n("7+uW"),s=(r=o)&&r.__esModule?r:{default:r},a=n("835U");var l=Object.prototype.hasOwnProperty;function u(t,e){for(var n in e)t[n]=e[n];return t}e.getValueByPath=function(t,e){for(var n=(e=e||"").split("."),i=t,r=null,o=0,s=n.length;o<s;o++){var a=n[o];if(!i)break;if(o===s-1){r=i[a];break}i=i[a]}return r};e.generateId=function(){return Math.floor(1e4*Math.random())},e.valueEquals=function(t,e){if(t===e)return!0;if(!(t instanceof Array))return!1;if(!(e instanceof Array))return!1;if(t.length!==e.length)return!1;for(var n=0;n!==t.length;++n)if(t[n]!==e[n])return!1;return!0},e.escapeRegexpString=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return String(t).replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")};var c=e.arrayFindIndex=function(t,e){for(var n=0;n!==t.length;++n)if(e(t[n]))return n;return-1},h=(e.arrayFind=function(t,e){var n=c(t,e);return-1!==n?t[n]:void 0},e.coerceTruthyValueToArray=function(t){return Array.isArray(t)?t:t?[t]:[]},e.isIE=function(){return!s.default.prototype.$isServer&&!isNaN(Number(document.documentMode))},e.isEdge=function(){return!s.default.prototype.$isServer&&navigator.userAgent.indexOf("Edge")>-1},e.isFirefox=function(){return!s.default.prototype.$isServer&&!!window.navigator.userAgent.match(/firefox/i)},e.autoprefixer=function(t){if("object"!==(void 0===t?"undefined":i(t)))return t;var e=["ms-","webkit-"];return["transform","transition","animation"].forEach(function(n){var i=t[n];n&&i&&e.forEach(function(e){t[e+n]=i})}),t},e.kebabCase=function(t){var e=/([^-])([A-Z])/g;return t.replace(e,"$1-$2").replace(e,"$1-$2").toLowerCase()},e.capitalize=function(t){return(0,a.isString)(t)?t.charAt(0).toUpperCase()+t.slice(1):t},e.looseEqual=function(t,e){var n=(0,a.isObject)(t),i=(0,a.isObject)(e);return n&&i?JSON.stringify(t)===JSON.stringify(e):!n&&!i&&String(t)===String(e)}),p=e.arrayEquals=function(t,e){if(t=t||[],e=e||[],t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!h(t[n],e[n]))return!1;return!0},d=(e.isEqual=function(t,e){return Array.isArray(t)&&Array.isArray(e)?p(t,e):h(t,e)},e.isEmpty=function(t){if(null==t)return!0;if("boolean"==typeof t)return!1;if("number"==typeof t)return!t;if(t instanceof Error)return""===t.message;switch(Object.prototype.toString.call(t)){case"[object String]":case"[object Array]":return!t.length;case"[object File]":case"[object Map]":case"[object Set]":return!t.size;case"[object Object]":return!Object.keys(t).length}return!1})},"z+gd":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var n=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,i){return t[0]===e&&(n=i,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),i=this.__entries__[n];return i&&i[1]},e.prototype.set=function(e,n){var i=t(this.__entries__,e);~i?this.__entries__[i][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,i=t(n,e);~i&&n.splice(i,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,i=this.__entries__;n<i.length;n++){var r=i[n];t.call(e,r[1],r[0])}},e}()}(),i="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,r=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(r):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},s=2;var a=20,l=["top","right","bottom","left","width","height","size","weight"],u="undefined"!=typeof MutationObserver,c=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,i=!1,r=0;function a(){n&&(n=!1,t()),i&&u()}function l(){o(a)}function u(){var t=Date.now();if(n){if(t-r<s)return;i=!0}else n=!0,i=!1,setTimeout(l,e);r=t}return u}(this.refresh.bind(this),a)}return t.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},t.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},t.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},t.prototype.connect_=function(){i&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),u?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){i&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;l.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),h=function(t,e){for(var n=0,i=Object.keys(e);n<i.length;n++){var r=i[n];Object.defineProperty(t,r,{value:e[r],enumerable:!1,writable:!1,configurable:!0})}return t},p=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||r},d=y(0,0,0,0);function f(t){return parseFloat(t)||0}function g(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(e,n){return e+f(t["border-"+n+"-width"])},0)}function m(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return d;var i=p(t).getComputedStyle(t),r=function(t){for(var e={},n=0,i=["top","right","bottom","left"];n<i.length;n++){var r=i[n],o=t["padding-"+r];e[r]=f(o)}return e}(i),o=r.left+r.right,s=r.top+r.bottom,a=f(i.width),l=f(i.height);if("border-box"===i.boxSizing&&(Math.round(a+o)!==e&&(a-=g(i,"left","right")+o),Math.round(l+s)!==n&&(l-=g(i,"top","bottom")+s)),!function(t){return t===p(t).document.documentElement}(t)){var u=Math.round(a+o)-e,c=Math.round(l+s)-n;1!==Math.abs(u)&&(a-=u),1!==Math.abs(c)&&(l-=c)}return y(r.left,r.top,a,l)}var v="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof p(t).SVGGraphicsElement}:function(t){return t instanceof p(t).SVGElement&&"function"==typeof t.getBBox};function _(t){return i?v(t)?function(t){var e=t.getBBox();return y(0,0,e.width,e.height)}(t):m(t):d}function y(t,e,n,i){return{x:t,y:e,width:n,height:i}}var b=function(){function t(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=y(0,0,0,0),this.target=t}return t.prototype.isActive=function(){var t=_(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},t}(),T=function(){return function(t,e){var n,i,r,o,s,a,l,u=(i=(n=e).x,r=n.y,o=n.width,s=n.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),h(l,{x:i,y:r,width:o,height:s,top:r,right:i+o,bottom:s+r,left:i}),l);h(this,{target:t,contentRect:u})}}(),E=function(){function t(t,e,i){if(this.activeObservations_=[],this.observations_=new n,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=i}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new b(t)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new T(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),C="undefined"!=typeof WeakMap?new WeakMap:new n,S=function(){return function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=c.getInstance(),i=new E(e,n,this);C.set(this,i)}}();["observe","unobserve","disconnect"].forEach(function(t){S.prototype[t]=function(){var e;return(e=C.get(this))[t].apply(e,arguments)}});var w=void 0!==r.ResizeObserver?r.ResizeObserver:S;e.default=w}.call(e,n("DuR2"))},"zAL+":function(t,e){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=95)}({0:function(t,e,n){"use strict";function i(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},95:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-button-group"},[this._t("default")],2)};i._withStripped=!0;var r={name:"ElButtonGroup"},o=n(0),s=Object(o.a)(r,i,[],!1,null,null,null);s.options.__file="packages/button/src/button-group.vue";var a=s.exports;a.install=function(t){t.component(a.name,a)};e.default=a}})},zL8q:function(t,e,n){t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=45)}([function(t,e){t.exports=n("AMCD")},function(t,e){t.exports=n("2kvA")},function(t,e){t.exports=n("ylDJ")},function(t,e){t.exports=n("fPll")},function(t,e){t.exports=n("y+7x")},function(t,e){t.exports=n("fKx3")},function(t,e){t.exports=n("7+uW")},function(t,e){t.exports=n("jmaC")},function(t,e){t.exports=n("HJMx")},function(t,e){t.exports=n("aW5l")},function(t,e){t.exports=n("ISYW")},function(t,e){t.exports=n("7J9s")},function(t,e){t.exports=n("urW8")},function(t,e){t.exports=n("mtrD")},function(t,e){t.exports=n("02w1")},function(t,e){t.exports=n("ON3O")},function(t,e){t.exports=n("EKTV")},function(t,e){t.exports=n("fEB+")},function(t,e){t.exports=n("835U")},function(t,e){t.exports=n("E/in")},function(t,e){t.exports=n("eNfa")},function(t,e){t.exports=n("Zcwg")},function(t,e){t.exports=n("1oZe")},function(t,e){t.exports=n("fUqW")},function(t,e){t.exports=n("nvbp")},function(t,e){t.exports=n("uY1a")},function(t,e){t.exports=n("aMwW")},function(t,e){t.exports=n("zTCi")},function(t,e){t.exports=n("zAL+")},function(t,e){t.exports=n("orbS")},function(t,e){t.exports=n("6Twh")},function(t,e){t.exports=n("s3ue")},function(t,e){t.exports=n("H8dH")},function(t,e){t.exports=n("GegP")},function(t,e){t.exports=n("hyEB")},function(t,e){t.exports=n("HzcN")},function(t,e){t.exports=n("e0Bm")},function(t,e){t.exports=n("STLj")},function(t,e){t.exports=n("3fo+")},function(t,e){t.exports=n("DQJY")},function(t,e){t.exports=n("jwfv")},function(t,e){t.exports=n("0kY3")},function(t,e){t.exports=n("kNJA")},function(t,e){t.exports=n("RDoK")},function(t,e){t.exports=n("SXzR")},function(t,e,n){t.exports=n(46)},function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ul",{staticClass:"el-pager",on:{click:t.onPagerClick}},[t.pageCount>0?n("li",{staticClass:"number",class:{active:1===t.currentPage,disabled:t.disabled}},[t._v("1")]):t._e(),t.showPrevMore?n("li",{staticClass:"el-icon more btn-quickprev",class:[t.quickprevIconClass,{disabled:t.disabled}],on:{mouseenter:function(e){t.onMouseenter("left")},mouseleave:function(e){t.quickprevIconClass="el-icon-more"}}}):t._e(),t._l(t.pagers,function(e){return n("li",{key:e,staticClass:"number",class:{active:t.currentPage===e,disabled:t.disabled}},[t._v(t._s(e))])}),t.showNextMore?n("li",{staticClass:"el-icon more btn-quicknext",class:[t.quicknextIconClass,{disabled:t.disabled}],on:{mouseenter:function(e){t.onMouseenter("right")},mouseleave:function(e){t.quicknextIconClass="el-icon-more"}}}):t._e(),t.pageCount>1?n("li",{staticClass:"number",class:{active:t.currentPage===t.pageCount,disabled:t.disabled}},[t._v(t._s(t.pageCount))]):t._e()],2)};function r(t,e,n,i,r,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}i._withStripped=!0;var o=r({name:"ElPager",props:{currentPage:Number,pageCount:Number,pagerCount:Number,disabled:Boolean},watch:{showPrevMore:function(t){t||(this.quickprevIconClass="el-icon-more")},showNextMore:function(t){t||(this.quicknextIconClass="el-icon-more")}},methods:{onPagerClick:function(t){var e=t.target;if("UL"!==e.tagName&&!this.disabled){var n=Number(t.target.textContent),i=this.pageCount,r=this.currentPage,o=this.pagerCount-2;-1!==e.className.indexOf("more")&&(-1!==e.className.indexOf("quickprev")?n=r-o:-1!==e.className.indexOf("quicknext")&&(n=r+o)),isNaN(n)||(n<1&&(n=1),n>i&&(n=i)),n!==r&&this.$emit("change",n)}},onMouseenter:function(t){this.disabled||("left"===t?this.quickprevIconClass="el-icon-d-arrow-left":this.quicknextIconClass="el-icon-d-arrow-right")}},computed:{pagers:function(){var t=this.pagerCount,e=(t-1)/2,n=Number(this.currentPage),i=Number(this.pageCount),r=!1,o=!1;i>t&&(n>t-e&&(r=!0),n<i-e&&(o=!0));var s=[];if(r&&!o)for(var a=i-(t-2);a<i;a++)s.push(a);else if(!r&&o)for(var l=2;l<t;l++)s.push(l);else if(r&&o)for(var u=Math.floor(t/2)-1,c=n-u;c<=n+u;c++)s.push(c);else for(var h=2;h<i;h++)s.push(h);return this.showPrevMore=r,this.showNextMore=o,s}},data:function(){return{current:null,showPrevMore:!1,showNextMore:!1,quicknextIconClass:"el-icon-more",quickprevIconClass:"el-icon-more"}}},i,[],!1,null,null,null);o.options.__file="packages/pagination/src/pager.vue";var s=o.exports,a=n(36),l=n.n(a),u=n(37),c=n.n(u),h=n(8),p=n.n(h),d=n(4),f=n.n(d),g=n(2),m={name:"ElPagination",props:{pageSize:{type:Number,default:10},small:Boolean,total:Number,pageCount:Number,pagerCount:{type:Number,validator:function(t){return(0|t)===t&&t>4&&t<22&&t%2==1},default:7},currentPage:{type:Number,default:1},layout:{default:"prev, pager, next, jumper, ->, total"},pageSizes:{type:Array,default:function(){return[10,20,30,40,50,100]}},popperClass:String,prevText:String,nextText:String,background:Boolean,disabled:Boolean,hideOnSinglePage:Boolean},data:function(){return{internalCurrentPage:1,internalPageSize:0,lastEmittedPage:-1,userChangePageSize:!1}},render:function(t){var e=this.layout;if(!e)return null;if(this.hideOnSinglePage&&(!this.internalPageCount||1===this.internalPageCount))return null;var n=t("div",{class:["el-pagination",{"is-background":this.background,"el-pagination--small":this.small}]}),i={prev:t("prev"),jumper:t("jumper"),pager:t("pager",{attrs:{currentPage:this.internalCurrentPage,pageCount:this.internalPageCount,pagerCount:this.pagerCount,disabled:this.disabled},on:{change:this.handleCurrentChange}}),next:t("next"),sizes:t("sizes",{attrs:{pageSizes:this.pageSizes}}),slot:t("slot",[this.$slots.default?this.$slots.default:""]),total:t("total")},r=e.split(",").map(function(t){return t.trim()}),o=t("div",{class:"el-pagination__rightwrapper"}),s=!1;return n.children=n.children||[],o.children=o.children||[],r.forEach(function(t){"->"!==t?s?o.children.push(i[t]):n.children.push(i[t]):s=!0}),s&&n.children.unshift(o),n},components:{Prev:{render:function(t){return t("button",{attrs:{type:"button",disabled:this.$parent.disabled||this.$parent.internalCurrentPage<=1},class:"btn-prev",on:{click:this.$parent.prev}},[this.$parent.prevText?t("span",[this.$parent.prevText]):t("i",{class:"el-icon el-icon-arrow-left"})])}},Next:{render:function(t){return t("button",{attrs:{type:"button",disabled:this.$parent.disabled||this.$parent.internalCurrentPage===this.$parent.internalPageCount||0===this.$parent.internalPageCount},class:"btn-next",on:{click:this.$parent.next}},[this.$parent.nextText?t("span",[this.$parent.nextText]):t("i",{class:"el-icon el-icon-arrow-right"})])}},Sizes:{mixins:[f.a],props:{pageSizes:Array},watch:{pageSizes:{immediate:!0,handler:function(t,e){Object(g.valueEquals)(t,e)||Array.isArray(t)&&(this.$parent.internalPageSize=t.indexOf(this.$parent.pageSize)>-1?this.$parent.pageSize:this.pageSizes[0])}}},render:function(t){var e=this;return t("span",{class:"el-pagination__sizes"},[t("el-select",{attrs:{value:this.$parent.internalPageSize,popperClass:this.$parent.popperClass||"",size:"mini",disabled:this.$parent.disabled},on:{input:this.handleChange}},[this.pageSizes.map(function(n){return t("el-option",{attrs:{value:n,label:n+e.t("el.pagination.pagesize")}})})])])},components:{ElSelect:l.a,ElOption:c.a},methods:{handleChange:function(t){t!==this.$parent.internalPageSize&&(this.$parent.internalPageSize=t=parseInt(t,10),this.$parent.userChangePageSize=!0,this.$parent.$emit("update:pageSize",t),this.$parent.$emit("size-change",t))}}},Jumper:{mixins:[f.a],components:{ElInput:p.a},data:function(){return{userInput:null}},watch:{"$parent.internalCurrentPage":function(){this.userInput=null}},methods:{handleKeyup:function(t){var e=t.keyCode,n=t.target;13===e&&this.handleChange(n.value)},handleInput:function(t){this.userInput=t},handleChange:function(t){this.$parent.internalCurrentPage=this.$parent.getValidCurrentPage(t),this.$parent.emitChange(),this.userInput=null}},render:function(t){return t("span",{class:"el-pagination__jump"},[this.t("el.pagination.goto"),t("el-input",{class:"el-pagination__editor is-in-pagination",attrs:{min:1,max:this.$parent.internalPageCount,value:null!==this.userInput?this.userInput:this.$parent.internalCurrentPage,type:"number",disabled:this.$parent.disabled},nativeOn:{keyup:this.handleKeyup},on:{input:this.handleInput,change:this.handleChange}}),this.t("el.pagination.pageClassifier")])}},Total:{mixins:[f.a],render:function(t){return"number"==typeof this.$parent.total?t("span",{class:"el-pagination__total"},[this.t("el.pagination.total",{total:this.$parent.total})]):""}},Pager:s},methods:{handleCurrentChange:function(t){this.internalCurrentPage=this.getValidCurrentPage(t),this.userChangePageSize=!0,this.emitChange()},prev:function(){if(!this.disabled){var t=this.internalCurrentPage-1;this.internalCurrentPage=this.getValidCurrentPage(t),this.$emit("prev-click",this.internalCurrentPage),this.emitChange()}},next:function(){if(!this.disabled){var t=this.internalCurrentPage+1;this.internalCurrentPage=this.getValidCurrentPage(t),this.$emit("next-click",this.internalCurrentPage),this.emitChange()}},getValidCurrentPage:function(t){t=parseInt(t,10);var e=void 0;return"number"==typeof this.internalPageCount?t<1?e=1:t>this.internalPageCount&&(e=this.internalPageCount):(isNaN(t)||t<1)&&(e=1),void 0===e&&isNaN(t)?e=1:0===e&&(e=1),void 0===e?t:e},emitChange:function(){var t=this;this.$nextTick(function(){(t.internalCurrentPage!==t.lastEmittedPage||t.userChangePageSize)&&(t.$emit("current-change",t.internalCurrentPage),t.lastEmittedPage=t.internalCurrentPage,t.userChangePageSize=!1)})}},computed:{internalPageCount:function(){return"number"==typeof this.total?Math.max(1,Math.ceil(this.total/this.internalPageSize)):"number"==typeof this.pageCount?Math.max(1,this.pageCount):null}},watch:{currentPage:{immediate:!0,handler:function(t){this.internalCurrentPage=this.getValidCurrentPage(t)}},pageSize:{immediate:!0,handler:function(t){this.internalPageSize=isNaN(t)?10:t}},internalCurrentPage:{immediate:!0,handler:function(t){this.$emit("update:currentPage",t),this.lastEmittedPage=-1}},internalPageCount:function(t){var e=this.internalCurrentPage;t>0&&0===e?this.internalCurrentPage=1:e>t&&(this.internalCurrentPage=0===t?1:t,this.userChangePageSize&&this.emitChange()),this.userChangePageSize=!1}},install:function(t){t.component(m.name,m)}},v=m,_=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"dialog-fade"},on:{"after-enter":t.afterEnter,"after-leave":t.afterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-dialog__wrapper",on:{click:function(e){return e.target!==e.currentTarget?null:t.handleWrapperClick(e)}}},[n("div",{key:t.key,ref:"dialog",class:["el-dialog",{"is-fullscreen":t.fullscreen,"el-dialog--center":t.center},t.customClass],style:t.style,attrs:{role:"dialog","aria-modal":"true","aria-label":t.title||"dialog"}},[n("div",{staticClass:"el-dialog__header"},[t._t("title",[n("span",{staticClass:"el-dialog__title"},[t._v(t._s(t.title))])]),t.showClose?n("button",{staticClass:"el-dialog__headerbtn",attrs:{type:"button","aria-label":"Close"},on:{click:t.handleClose}},[n("i",{staticClass:"el-dialog__close el-icon el-icon-close"})]):t._e()],2),t.rendered?n("div",{staticClass:"el-dialog__body"},[t._t("default")],2):t._e(),t.$slots.footer?n("div",{staticClass:"el-dialog__footer"},[t._t("footer")],2):t._e()])])])};_._withStripped=!0;var y=n(11),b=n.n(y),T=n(9),E=n.n(T),C=n(3),S=n.n(C),w=r({name:"ElDialog",mixins:[b.a,S.a,E.a],props:{title:{type:String,default:""},modal:{type:Boolean,default:!0},modalAppendToBody:{type:Boolean,default:!0},appendToBody:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},width:String,fullscreen:Boolean,customClass:{type:String,default:""},top:{type:String,default:"15vh"},beforeClose:Function,center:{type:Boolean,default:!1},destroyOnClose:Boolean},data:function(){return{closed:!1,key:0}},watch:{visible:function(t){var e=this;t?(this.closed=!1,this.$emit("open"),this.$el.addEventListener("scroll",this.updatePopper),this.$nextTick(function(){e.$refs.dialog.scrollTop=0}),this.appendToBody&&document.body.appendChild(this.$el)):(this.$el.removeEventListener("scroll",this.updatePopper),this.closed||this.$emit("close"),this.destroyOnClose&&this.$nextTick(function(){e.key++}))}},computed:{style:function(){var t={};return this.fullscreen||(t.marginTop=this.top,this.width&&(t.width=this.width)),t}},methods:{getMigratingConfig:function(){return{props:{size:"size is removed."}}},handleWrapperClick:function(){this.closeOnClickModal&&this.handleClose()},handleClose:function(){"function"==typeof this.beforeClose?this.beforeClose(this.hide):this.hide()},hide:function(t){!1!==t&&(this.$emit("update:visible",!1),this.$emit("close"),this.closed=!0)},updatePopper:function(){this.broadcast("ElSelectDropdown","updatePopper"),this.broadcast("ElDropdownMenu","updatePopper")},afterEnter:function(){this.$emit("opened")},afterLeave:function(){this.$emit("closed")}},mounted:function(){this.visible&&(this.rendered=!0,this.open(),this.appendToBody&&document.body.appendChild(this.$el))},destroyed:function(){this.appendToBody&&this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}},_,[],!1,null,null,null);w.options.__file="packages/dialog/src/component.vue";var k=w.exports;k.install=function(t){t.component(k.name,k)};var x=k,I=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.close,expression:"close"}],staticClass:"el-autocomplete",attrs:{"aria-haspopup":"listbox",role:"combobox","aria-expanded":t.suggestionVisible,"aria-owns":t.id}},[n("el-input",t._b({ref:"input",on:{input:t.handleInput,change:t.handleChange,focus:t.handleFocus,blur:t.handleBlur,clear:t.handleClear},nativeOn:{keydown:[function(e){if(!("button"in e)&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"]))return null;e.preventDefault(),t.highlight(t.highlightedIndex-1)},function(e){if(!("button"in e)&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"]))return null;e.preventDefault(),t.highlight(t.highlightedIndex+1)},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.handleKeyEnter(e):null},function(e){return"button"in e||!t._k(e.keyCode,"tab",9,e.key,"Tab")?t.close(e):null}]}},"el-input",[t.$props,t.$attrs],!1),[t.$slots.prepend?n("template",{slot:"prepend"},[t._t("prepend")],2):t._e(),t.$slots.append?n("template",{slot:"append"},[t._t("append")],2):t._e(),t.$slots.prefix?n("template",{slot:"prefix"},[t._t("prefix")],2):t._e(),t.$slots.suffix?n("template",{slot:"suffix"},[t._t("suffix")],2):t._e()],2),n("el-autocomplete-suggestions",{ref:"suggestions",class:[t.popperClass?t.popperClass:""],attrs:{"visible-arrow":"","popper-options":t.popperOptions,"append-to-body":t.popperAppendToBody,placement:t.placement,id:t.id}},t._l(t.suggestions,function(e,i){return n("li",{key:i,class:{highlighted:t.highlightedIndex===i},attrs:{id:t.id+"-item-"+i,role:"option","aria-selected":t.highlightedIndex===i},on:{click:function(n){t.select(e)}}},[t._t("default",[t._v("\n "+t._s(e[t.valueKey])+"\n ")],{item:e})],2)}),0)],1)};I._withStripped=!0;var R=n(15),O=n.n(R),D=n(10),A=n.n(D),M=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":t.doDestroy}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.showPopper,expression:"showPopper"}],staticClass:"el-autocomplete-suggestion el-popper",class:{"is-loading":!t.parent.hideLoading&&t.parent.loading},style:{width:t.dropdownWidth},attrs:{role:"region"}},[n("el-scrollbar",{attrs:{tag:"ul","wrap-class":"el-autocomplete-suggestion__wrap","view-class":"el-autocomplete-suggestion__list"}},[!t.parent.hideLoading&&t.parent.loading?n("li",[n("i",{staticClass:"el-icon-loading"})]):t._t("default")],2)],1)])};M._withStripped=!0;var N=n(5),L=n.n(N),P=n(17),B=n.n(P),F=r({components:{ElScrollbar:B.a},mixins:[L.a,S.a],componentName:"ElAutocompleteSuggestions",data:function(){return{parent:this.$parent,dropdownWidth:""}},props:{options:{default:function(){return{gpuAcceleration:!1}}},id:String},methods:{select:function(t){this.dispatch("ElAutocomplete","item-click",t)}},updated:function(){var t=this;this.$nextTick(function(e){t.popperJS&&t.updatePopper()})},mounted:function(){this.$parent.popperElm=this.popperElm=this.$el,this.referenceElm=this.$parent.$refs.input.$refs.input||this.$parent.$refs.input.$refs.textarea,this.referenceList=this.$el.querySelector(".el-autocomplete-suggestion__list"),this.referenceList.setAttribute("role","listbox"),this.referenceList.setAttribute("id",this.id)},created:function(){var t=this;this.$on("visible",function(e,n){t.dropdownWidth=n+"px",t.showPopper=e})}},M,[],!1,null,null,null);F.options.__file="packages/autocomplete/src/autocomplete-suggestions.vue";var U=F.exports,V=n(22),H=n.n(V),W=r({name:"ElAutocomplete",mixins:[S.a,H()("input"),E.a],inheritAttrs:!1,componentName:"ElAutocomplete",components:{ElInput:p.a,ElAutocompleteSuggestions:U},directives:{Clickoutside:A.a},props:{valueKey:{type:String,default:"value"},popperClass:String,popperOptions:Object,placeholder:String,clearable:{type:Boolean,default:!1},disabled:Boolean,name:String,size:String,value:String,maxlength:Number,minlength:Number,autofocus:Boolean,fetchSuggestions:Function,triggerOnFocus:{type:Boolean,default:!0},customItem:String,selectWhenUnmatched:{type:Boolean,default:!1},prefixIcon:String,suffixIcon:String,label:String,debounce:{type:Number,default:300},placement:{type:String,default:"bottom-start"},hideLoading:Boolean,popperAppendToBody:{type:Boolean,default:!0},highlightFirstItem:{type:Boolean,default:!1}},data:function(){return{activated:!1,suggestions:[],loading:!1,highlightedIndex:-1,suggestionDisabled:!1}},computed:{suggestionVisible:function(){var t=this.suggestions;return(Array.isArray(t)&&t.length>0||this.loading)&&this.activated},id:function(){return"el-autocomplete-"+Object(g.generateId)()}},watch:{suggestionVisible:function(t){var e=this.getInput();e&&this.broadcast("ElAutocompleteSuggestions","visible",[t,e.offsetWidth])}},methods:{getMigratingConfig:function(){return{props:{"custom-item":"custom-item is removed, use scoped slot instead.",props:"props is removed, use value-key instead."}}},getData:function(t){var e=this;this.suggestionDisabled||(this.loading=!0,this.fetchSuggestions(t,function(t){e.loading=!1,e.suggestionDisabled||(Array.isArray(t)?(e.suggestions=t,e.highlightedIndex=e.highlightFirstItem?0:-1):console.error("[Element Error][Autocomplete]autocomplete suggestions must be an array"))}))},handleInput:function(t){if(this.$emit("input",t),this.suggestionDisabled=!1,!this.triggerOnFocus&&!t)return this.suggestionDisabled=!0,void(this.suggestions=[]);this.debouncedGetData(t)},handleChange:function(t){this.$emit("change",t)},handleFocus:function(t){this.activated=!0,this.$emit("focus",t),this.triggerOnFocus&&this.debouncedGetData(this.value)},handleBlur:function(t){this.$emit("blur",t)},handleClear:function(){this.activated=!1,this.$emit("clear")},close:function(t){this.activated=!1},handleKeyEnter:function(t){var e=this;this.suggestionVisible&&this.highlightedIndex>=0&&this.highlightedIndex<this.suggestions.length?(t.preventDefault(),this.select(this.suggestions[this.highlightedIndex])):this.selectWhenUnmatched&&(this.$emit("select",{value:this.value}),this.$nextTick(function(t){e.suggestions=[],e.highlightedIndex=-1}))},select:function(t){var e=this;this.$emit("input",t[this.valueKey]),this.$emit("select",t),this.$nextTick(function(t){e.suggestions=[],e.highlightedIndex=-1})},highlight:function(t){if(this.suggestionVisible&&!this.loading)if(t<0)this.highlightedIndex=-1;else{t>=this.suggestions.length&&(t=this.suggestions.length-1);var e=this.$refs.suggestions.$el.querySelector(".el-autocomplete-suggestion__wrap"),n=e.querySelectorAll(".el-autocomplete-suggestion__list li")[t],i=e.scrollTop,r=n.offsetTop;r+n.scrollHeight>i+e.clientHeight&&(e.scrollTop+=n.scrollHeight),r<i&&(e.scrollTop-=n.scrollHeight),this.highlightedIndex=t,this.getInput().setAttribute("aria-activedescendant",this.id+"-item-"+this.highlightedIndex)}},getInput:function(){return this.$refs.input.getInput()}},mounted:function(){var t=this;this.debouncedGetData=O()(this.debounce,this.getData),this.$on("item-click",function(e){t.select(e)});var e=this.getInput();e.setAttribute("role","textbox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls","id"),e.setAttribute("aria-activedescendant",this.id+"-item-"+this.highlightedIndex)},beforeDestroy:function(){this.$refs.suggestions.$destroy()}},I,[],!1,null,null,null);W.options.__file="packages/autocomplete/src/autocomplete.vue";var G=W.exports;G.install=function(t){t.component(G.name,G)};var j=G,z=n(13),$=n.n(z),X=n(28),Y=n.n(X),K=r({name:"ElDropdown",componentName:"ElDropdown",mixins:[S.a,E.a],directives:{Clickoutside:A.a},components:{ElButton:$.a,ElButtonGroup:Y.a},provide:function(){return{dropdown:this}},props:{trigger:{type:String,default:"hover"},type:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},placement:{type:String,default:"bottom-end"},visibleArrow:{default:!0},showTimeout:{type:Number,default:250},hideTimeout:{type:Number,default:150},tabindex:{type:Number,default:0}},data:function(){return{timeout:null,visible:!1,triggerElm:null,menuItems:null,menuItemsArray:null,dropdownElm:null,focusing:!1,listId:"dropdown-menu-"+Object(g.generateId)()}},computed:{dropdownSize:function(){return this.size||(this.$ELEMENT||{}).size}},mounted:function(){this.$on("menu-item-click",this.handleMenuItemClick)},watch:{visible:function(t){this.broadcast("ElDropdownMenu","visible",t),this.$emit("visible-change",t)},focusing:function(t){var e=this.$el.querySelector(".el-dropdown-selfdefine");e&&(t?e.className+=" focusing":e.className=e.className.replace("focusing",""))}},methods:{getMigratingConfig:function(){return{props:{"menu-align":"menu-align is renamed to placement."}}},show:function(){var t=this;this.triggerElm.disabled||(clearTimeout(this.timeout),this.timeout=setTimeout(function(){t.visible=!0},"click"===this.trigger?0:this.showTimeout))},hide:function(){var t=this;this.triggerElm.disabled||(this.removeTabindex(),this.tabindex>=0&&this.resetTabindex(this.triggerElm),clearTimeout(this.timeout),this.timeout=setTimeout(function(){t.visible=!1},"click"===this.trigger?0:this.hideTimeout))},handleClick:function(){this.triggerElm.disabled||(this.visible?this.hide():this.show())},handleTriggerKeyDown:function(t){var e=t.keyCode;[38,40].indexOf(e)>-1?(this.removeTabindex(),this.resetTabindex(this.menuItems[0]),this.menuItems[0].focus(),t.preventDefault(),t.stopPropagation()):13===e?this.handleClick():[9,27].indexOf(e)>-1&&this.hide()},handleItemKeyDown:function(t){var e=t.keyCode,n=t.target,i=this.menuItemsArray.indexOf(n),r=this.menuItemsArray.length-1,o=void 0;[38,40].indexOf(e)>-1?(o=38===e?0!==i?i-1:0:i<r?i+1:r,this.removeTabindex(),this.resetTabindex(this.menuItems[o]),this.menuItems[o].focus(),t.preventDefault(),t.stopPropagation()):13===e?(this.triggerElmFocus(),n.click(),this.hideOnClick&&(this.visible=!1)):[9,27].indexOf(e)>-1&&(this.hide(),this.triggerElmFocus())},resetTabindex:function(t){this.removeTabindex(),t.setAttribute("tabindex","0")},removeTabindex:function(){this.triggerElm.setAttribute("tabindex","-1"),this.menuItemsArray.forEach(function(t){t.setAttribute("tabindex","-1")})},initAria:function(){this.dropdownElm.setAttribute("id",this.listId),this.triggerElm.setAttribute("aria-haspopup","list"),this.triggerElm.setAttribute("aria-controls",this.listId),this.splitButton||(this.triggerElm.setAttribute("role","button"),this.triggerElm.setAttribute("tabindex",this.tabindex),this.triggerElm.setAttribute("class",(this.triggerElm.getAttribute("class")||"")+" el-dropdown-selfdefine"))},initEvent:function(){var t=this,e=this.trigger,n=this.show,i=this.hide,r=this.handleClick,o=this.splitButton,s=this.handleTriggerKeyDown,a=this.handleItemKeyDown;this.triggerElm=o?this.$refs.trigger.$el:this.$slots.default[0].elm;var l=this.dropdownElm;this.triggerElm.addEventListener("keydown",s),l.addEventListener("keydown",a,!0),o||(this.triggerElm.addEventListener("focus",function(){t.focusing=!0}),this.triggerElm.addEventListener("blur",function(){t.focusing=!1}),this.triggerElm.addEventListener("click",function(){t.focusing=!1})),"hover"===e?(this.triggerElm.addEventListener("mouseenter",n),this.triggerElm.addEventListener("mouseleave",i),l.addEventListener("mouseenter",n),l.addEventListener("mouseleave",i)):"click"===e&&this.triggerElm.addEventListener("click",r)},handleMenuItemClick:function(t,e){this.hideOnClick&&(this.visible=!1),this.$emit("command",t,e)},triggerElmFocus:function(){this.triggerElm.focus&&this.triggerElm.focus()},initDomOperation:function(){this.dropdownElm=this.popperElm,this.menuItems=this.dropdownElm.querySelectorAll("[tabindex='-1']"),this.menuItemsArray=[].slice.call(this.menuItems),this.initEvent(),this.initAria()}},render:function(t){var e=this,n=this.hide,i=this.splitButton,r=this.type,o=this.dropdownSize,s=i?t("el-button-group",[t("el-button",{attrs:{type:r,size:o},nativeOn:{click:function(t){e.$emit("click",t),n()}}},[this.$slots.default]),t("el-button",{ref:"trigger",attrs:{type:r,size:o},class:"el-dropdown__caret-button"},[t("i",{class:"el-dropdown__icon el-icon-arrow-down"})])]):this.$slots.default;return t("div",{class:"el-dropdown",directives:[{name:"clickoutside",value:n}]},[s,this.$slots.dropdown])}},void 0,void 0,!1,null,null,null);K.options.__file="packages/dropdown/src/dropdown.vue";var J=K.exports;J.install=function(t){t.component(J.name,J)};var q=J,Z=function(){var t=this.$createElement,e=this._self._c||t;return e("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":this.doDestroy}},[e("ul",{directives:[{name:"show",rawName:"v-show",value:this.showPopper,expression:"showPopper"}],staticClass:"el-dropdown-menu el-popper",class:[this.size&&"el-dropdown-menu--"+this.size]},[this._t("default")],2)])};Z._withStripped=!0;var Q=r({name:"ElDropdownMenu",componentName:"ElDropdownMenu",mixins:[L.a],props:{visibleArrow:{type:Boolean,default:!0},arrowOffset:{type:Number,default:0}},data:function(){return{size:this.dropdown.dropdownSize}},inject:["dropdown"],created:function(){var t=this;this.$on("updatePopper",function(){t.showPopper&&t.updatePopper()}),this.$on("visible",function(e){t.showPopper=e})},mounted:function(){this.dropdown.popperElm=this.popperElm=this.$el,this.referenceElm=this.dropdown.$el,this.dropdown.initDomOperation()},watch:{"dropdown.placement":{immediate:!0,handler:function(t){this.currentPlacement=t}}}},Z,[],!1,null,null,null);Q.options.__file="packages/dropdown/src/dropdown-menu.vue";var tt=Q.exports;tt.install=function(t){t.component(tt.name,tt)};var et=tt,nt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"el-dropdown-menu__item",class:{"is-disabled":t.disabled,"el-dropdown-menu__item--divided":t.divided},attrs:{"aria-disabled":t.disabled,tabindex:t.disabled?null:-1},on:{click:t.handleClick}},[t.icon?n("i",{class:t.icon}):t._e(),t._t("default")],2)};nt._withStripped=!0;var it=r({name:"ElDropdownItem",mixins:[S.a],props:{command:{},disabled:Boolean,divided:Boolean,icon:String},methods:{handleClick:function(t){this.dispatch("ElDropdown","menu-item-click",[this.command,this])}}},nt,[],!1,null,null,null);it.options.__file="packages/dropdown/src/dropdown-item.vue";var rt=it.exports;rt.install=function(t){t.component(rt.name,rt)};var ot=rt,st=st||{};st.Utils=st.Utils||{},st.Utils.focusFirstDescendant=function(t){for(var e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if(st.Utils.attemptFocus(n)||st.Utils.focusFirstDescendant(n))return!0}return!1},st.Utils.focusLastDescendant=function(t){for(var e=t.childNodes.length-1;e>=0;e--){var n=t.childNodes[e];if(st.Utils.attemptFocus(n)||st.Utils.focusLastDescendant(n))return!0}return!1},st.Utils.attemptFocus=function(t){if(!st.Utils.isFocusable(t))return!1;st.Utils.IgnoreUtilFocusChanges=!0;try{t.focus()}catch(t){}return st.Utils.IgnoreUtilFocusChanges=!1,document.activeElement===t},st.Utils.isFocusable=function(t){if(t.tabIndex>0||0===t.tabIndex&&null!==t.getAttribute("tabIndex"))return!0;if(t.disabled)return!1;switch(t.nodeName){case"A":return!!t.href&&"ignore"!==t.rel;case"INPUT":return"hidden"!==t.type&&"file"!==t.type;case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},st.Utils.triggerEvent=function(t,e){var n=void 0;n=/^mouse|click/.test(e)?"MouseEvents":/^key/.test(e)?"KeyboardEvent":"HTMLEvents";for(var i=document.createEvent(n),r=arguments.length,o=Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return i.initEvent.apply(i,[e].concat(o)),t.dispatchEvent?t.dispatchEvent(i):t.fireEvent("on"+e,i),t},st.Utils.keys={tab:9,enter:13,space:32,left:37,up:38,right:39,down:40,esc:27};var at=st.Utils,lt=function(t,e){this.domNode=e,this.parent=t,this.subMenuItems=[],this.subIndex=0,this.init()};lt.prototype.init=function(){this.subMenuItems=this.domNode.querySelectorAll("li"),this.addListeners()},lt.prototype.gotoSubIndex=function(t){t===this.subMenuItems.length?t=0:t<0&&(t=this.subMenuItems.length-1),this.subMenuItems[t].focus(),this.subIndex=t},lt.prototype.addListeners=function(){var t=this,e=at.keys,n=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,function(i){i.addEventListener("keydown",function(i){var r=!1;switch(i.keyCode){case e.down:t.gotoSubIndex(t.subIndex+1),r=!0;break;case e.up:t.gotoSubIndex(t.subIndex-1),r=!0;break;case e.tab:at.triggerEvent(n,"mouseleave");break;case e.enter:case e.space:r=!0,i.currentTarget.click()}return r&&(i.preventDefault(),i.stopPropagation()),!1})})};var ut=lt,ct=function(t){this.domNode=t,this.submenu=null,this.init()};ct.prototype.init=function(){this.domNode.setAttribute("tabindex","0");var t=this.domNode.querySelector(".el-menu");t&&(this.submenu=new ut(this,t)),this.addListeners()},ct.prototype.addListeners=function(){var t=this,e=at.keys;this.domNode.addEventListener("keydown",function(n){var i=!1;switch(n.keyCode){case e.down:at.triggerEvent(n.currentTarget,"mouseenter"),t.submenu&&t.submenu.gotoSubIndex(0),i=!0;break;case e.up:at.triggerEvent(n.currentTarget,"mouseenter"),t.submenu&&t.submenu.gotoSubIndex(t.submenu.subMenuItems.length-1),i=!0;break;case e.tab:at.triggerEvent(n.currentTarget,"mouseleave");break;case e.enter:case e.space:i=!0,n.currentTarget.click()}i&&n.preventDefault()})};var ht=ct,pt=function(t){this.domNode=t,this.init()};pt.prototype.init=function(){var t=this.domNode.childNodes;[].filter.call(t,function(t){return 1===t.nodeType}).forEach(function(t){new ht(t)})};var dt=pt,ft=n(1),gt=r({name:"ElMenu",render:function(t){var e=t("ul",{attrs:{role:"menubar"},key:+this.collapse,style:{backgroundColor:this.backgroundColor||""},class:{"el-menu--horizontal":"horizontal"===this.mode,"el-menu--collapse":this.collapse,"el-menu":!0}},[this.$slots.default]);return this.collapseTransition?t("el-menu-collapse-transition",[e]):e},componentName:"ElMenu",mixins:[S.a,E.a],provide:function(){return{rootMenu:this}},components:{"el-menu-collapse-transition":{functional:!0,render:function(t,e){return t("transition",{props:{mode:"out-in"},on:{beforeEnter:function(t){t.style.opacity=.2},enter:function(t){Object(ft.addClass)(t,"el-opacity-transition"),t.style.opacity=1},afterEnter:function(t){Object(ft.removeClass)(t,"el-opacity-transition"),t.style.opacity=""},beforeLeave:function(t){t.dataset||(t.dataset={}),Object(ft.hasClass)(t,"el-menu--collapse")?(Object(ft.removeClass)(t,"el-menu--collapse"),t.dataset.oldOverflow=t.style.overflow,t.dataset.scrollWidth=t.clientWidth,Object(ft.addClass)(t,"el-menu--collapse")):(Object(ft.addClass)(t,"el-menu--collapse"),t.dataset.oldOverflow=t.style.overflow,t.dataset.scrollWidth=t.clientWidth,Object(ft.removeClass)(t,"el-menu--collapse")),t.style.width=t.scrollWidth+"px",t.style.overflow="hidden"},leave:function(t){Object(ft.addClass)(t,"horizontal-collapse-transition"),t.style.width=t.dataset.scrollWidth+"px"}}},e.children)}}},props:{mode:{type:String,default:"vertical"},defaultActive:{type:String,default:""},defaultOpeneds:Array,uniqueOpened:Boolean,router:Boolean,menuTrigger:{type:String,default:"hover"},collapse:Boolean,backgroundColor:String,textColor:String,activeTextColor:String,collapseTransition:{type:Boolean,default:!0}},data:function(){return{activeIndex:this.defaultActive,openedMenus:this.defaultOpeneds&&!this.collapse?this.defaultOpeneds.slice(0):[],items:{},submenus:{}}},computed:{hoverBackground:function(){return this.backgroundColor?this.mixColor(this.backgroundColor,.2):""},isMenuPopup:function(){return"horizontal"===this.mode||"vertical"===this.mode&&this.collapse}},watch:{defaultActive:function(t){this.items[t]||(this.activeIndex=null),this.updateActiveIndex(t)},defaultOpeneds:function(t){this.collapse||(this.openedMenus=t)},collapse:function(t){t&&(this.openedMenus=[]),this.broadcast("ElSubmenu","toggle-collapse",t)}},methods:{updateActiveIndex:function(t){var e=this.items[t]||this.items[this.activeIndex]||this.items[this.defaultActive];e?(this.activeIndex=e.index,this.initOpenedMenu()):this.activeIndex=null},getMigratingConfig:function(){return{props:{theme:"theme is removed."}}},getColorChannels:function(t){if(t=t.replace("#",""),/^[0-9a-fA-F]{3}$/.test(t)){t=t.split("");for(var e=2;e>=0;e--)t.splice(e,0,t[e]);t=t.join("")}return/^[0-9a-fA-F]{6}$/.test(t)?{red:parseInt(t.slice(0,2),16),green:parseInt(t.slice(2,4),16),blue:parseInt(t.slice(4,6),16)}:{red:255,green:255,blue:255}},mixColor:function(t,e){var n=this.getColorChannels(t),i=n.red,r=n.green,o=n.blue;return e>0?(i*=1-e,r*=1-e,o*=1-e):(i+=(255-i)*e,r+=(255-r)*e,o+=(255-o)*e),"rgb("+Math.round(i)+", "+Math.round(r)+", "+Math.round(o)+")"},addItem:function(t){this.$set(this.items,t.index,t)},removeItem:function(t){delete this.items[t.index]},addSubmenu:function(t){this.$set(this.submenus,t.index,t)},removeSubmenu:function(t){delete this.submenus[t.index]},openMenu:function(t,e){var n=this.openedMenus;-1===n.indexOf(t)&&(this.uniqueOpened&&(this.openedMenus=n.filter(function(t){return-1!==e.indexOf(t)})),this.openedMenus.push(t))},closeMenu:function(t){var e=this.openedMenus.indexOf(t);-1!==e&&this.openedMenus.splice(e,1)},handleSubmenuClick:function(t){var e=t.index,n=t.indexPath;-1!==this.openedMenus.indexOf(e)?(this.closeMenu(e),this.$emit("close",e,n)):(this.openMenu(e,n),this.$emit("open",e,n))},handleItemClick:function(t){var e=this,n=t.index,i=t.indexPath,r=this.activeIndex,o=null!==t.index;o&&(this.activeIndex=t.index),this.$emit("select",n,i,t),("horizontal"===this.mode||this.collapse)&&(this.openedMenus=[]),this.router&&o&&this.routeToItem(t,function(t){if(e.activeIndex=r,t){if("NavigationDuplicated"===t.name)return;console.error(t)}})},initOpenedMenu:function(){var t=this,e=this.activeIndex,n=this.items[e];n&&"horizontal"!==this.mode&&!this.collapse&&n.indexPath.forEach(function(e){var n=t.submenus[e];n&&t.openMenu(e,n.indexPath)})},routeToItem:function(t,e){var n=t.route||t.index;try{this.$router.push(n,function(){},e)}catch(t){console.error(t)}},open:function(t){var e=this,n=this.submenus[t.toString()].indexPath;n.forEach(function(t){return e.openMenu(t,n)})},close:function(t){this.closeMenu(t)}},mounted:function(){this.initOpenedMenu(),this.$on("item-click",this.handleItemClick),this.$on("submenu-click",this.handleSubmenuClick),"horizontal"===this.mode&&new dt(this.$el),this.$watch("items",this.updateActiveIndex)}},void 0,void 0,!1,null,null,null);gt.options.__file="packages/menu/src/menu.vue";var mt=gt.exports;mt.install=function(t){t.component(mt.name,mt)};var vt=mt,_t=n(21),yt=n.n(_t),bt={inject:["rootMenu"],computed:{indexPath:function(){for(var t=[this.index],e=this.$parent;"ElMenu"!==e.$options.componentName;)e.index&&t.unshift(e.index),e=e.$parent;return t},parentMenu:function(){for(var t=this.$parent;t&&-1===["ElMenu","ElSubmenu"].indexOf(t.$options.componentName);)t=t.$parent;return t},paddingStyle:function(){if("vertical"!==this.rootMenu.mode)return{};var t=20,e=this.$parent;if(this.rootMenu.collapse)t=20;else for(;e&&"ElMenu"!==e.$options.componentName;)"ElSubmenu"===e.$options.componentName&&(t+=20),e=e.$parent;return{paddingLeft:t+"px"}}}},Tt={props:{transformOrigin:{type:[Boolean,String],default:!1},offset:L.a.props.offset,boundariesPadding:L.a.props.boundariesPadding,popperOptions:L.a.props.popperOptions},data:L.a.data,methods:L.a.methods,beforeDestroy:L.a.beforeDestroy,deactivated:L.a.deactivated},Et=r({name:"ElSubmenu",componentName:"ElSubmenu",mixins:[bt,S.a,Tt],components:{ElCollapseTransition:yt.a},props:{index:{type:String,required:!0},showTimeout:{type:Number,default:300},hideTimeout:{type:Number,default:300},popperClass:String,disabled:Boolean,popperAppendToBody:{type:Boolean,default:void 0}},data:function(){return{popperJS:null,timeout:null,items:{},submenus:{},mouseInChild:!1}},watch:{opened:function(t){var e=this;this.isMenuPopup&&this.$nextTick(function(t){e.updatePopper()})}},computed:{appendToBody:function(){return void 0===this.popperAppendToBody?this.isFirstLevel:this.popperAppendToBody},menuTransitionName:function(){return this.rootMenu.collapse?"el-zoom-in-left":"el-zoom-in-top"},opened:function(){return this.rootMenu.openedMenus.indexOf(this.index)>-1},active:function(){var t=!1,e=this.submenus,n=this.items;return Object.keys(n).forEach(function(e){n[e].active&&(t=!0)}),Object.keys(e).forEach(function(n){e[n].active&&(t=!0)}),t},hoverBackground:function(){return this.rootMenu.hoverBackground},backgroundColor:function(){return this.rootMenu.backgroundColor||""},activeTextColor:function(){return this.rootMenu.activeTextColor||""},textColor:function(){return this.rootMenu.textColor||""},mode:function(){return this.rootMenu.mode},isMenuPopup:function(){return this.rootMenu.isMenuPopup},titleStyle:function(){return"horizontal"!==this.mode?{color:this.textColor}:{borderBottomColor:this.active?this.rootMenu.activeTextColor?this.activeTextColor:"":"transparent",color:this.active?this.activeTextColor:this.textColor}},isFirstLevel:function(){for(var t=!0,e=this.$parent;e&&e!==this.rootMenu;){if(["ElSubmenu","ElMenuItemGroup"].indexOf(e.$options.componentName)>-1){t=!1;break}e=e.$parent}return t}},methods:{handleCollapseToggle:function(t){t?this.initPopper():this.doDestroy()},addItem:function(t){this.$set(this.items,t.index,t)},removeItem:function(t){delete this.items[t.index]},addSubmenu:function(t){this.$set(this.submenus,t.index,t)},removeSubmenu:function(t){delete this.submenus[t.index]},handleClick:function(){var t=this.rootMenu,e=this.disabled;"hover"===t.menuTrigger&&"horizontal"===t.mode||t.collapse&&"vertical"===t.mode||e||this.dispatch("ElMenu","submenu-click",this)},handleMouseenter:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.showTimeout;if("ActiveXObject"in window||"focus"!==t.type||t.relatedTarget){var i=this.rootMenu,r=this.disabled;"click"===i.menuTrigger&&"horizontal"===i.mode||!i.collapse&&"vertical"===i.mode||r||(this.dispatch("ElSubmenu","mouse-enter-child"),clearTimeout(this.timeout),this.timeout=setTimeout(function(){e.rootMenu.openMenu(e.index,e.indexPath)},n),this.appendToBody&&this.$parent.$el.dispatchEvent(new MouseEvent("mouseenter")))}},handleMouseleave:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.rootMenu;"click"===n.menuTrigger&&"horizontal"===n.mode||!n.collapse&&"vertical"===n.mode||(this.dispatch("ElSubmenu","mouse-leave-child"),clearTimeout(this.timeout),this.timeout=setTimeout(function(){!t.mouseInChild&&t.rootMenu.closeMenu(t.index)},this.hideTimeout),this.appendToBody&&e&&"ElSubmenu"===this.$parent.$options.name&&this.$parent.handleMouseleave(!0))},handleTitleMouseenter:function(){if("horizontal"!==this.mode||this.rootMenu.backgroundColor){var t=this.$refs["submenu-title"];t&&(t.style.backgroundColor=this.rootMenu.hoverBackground)}},handleTitleMouseleave:function(){if("horizontal"!==this.mode||this.rootMenu.backgroundColor){var t=this.$refs["submenu-title"];t&&(t.style.backgroundColor=this.rootMenu.backgroundColor||"")}},updatePlacement:function(){this.currentPlacement="horizontal"===this.mode&&this.isFirstLevel?"bottom-start":"right-start"},initPopper:function(){this.referenceElm=this.$el,this.popperElm=this.$refs.menu,this.updatePlacement()}},created:function(){var t=this;this.$on("toggle-collapse",this.handleCollapseToggle),this.$on("mouse-enter-child",function(){t.mouseInChild=!0,clearTimeout(t.timeout)}),this.$on("mouse-leave-child",function(){t.mouseInChild=!1,clearTimeout(t.timeout)})},mounted:function(){this.parentMenu.addSubmenu(this),this.rootMenu.addSubmenu(this),this.initPopper()},beforeDestroy:function(){this.parentMenu.removeSubmenu(this),this.rootMenu.removeSubmenu(this)},render:function(t){var e=this,n=this.active,i=this.opened,r=this.paddingStyle,o=this.titleStyle,s=this.backgroundColor,a=this.rootMenu,l=this.currentPlacement,u=this.menuTransitionName,c=this.mode,h=this.disabled,p=this.popperClass,d=this.$slots,f=this.isFirstLevel,g=t("transition",{attrs:{name:u}},[t("div",{ref:"menu",directives:[{name:"show",value:i}],class:["el-menu--"+c,p],on:{mouseenter:function(t){return e.handleMouseenter(t,100)},mouseleave:function(){return e.handleMouseleave(!0)},focus:function(t){return e.handleMouseenter(t,100)}}},[t("ul",{attrs:{role:"menu"},class:["el-menu el-menu--popup","el-menu--popup-"+l],style:{backgroundColor:a.backgroundColor||""}},[d.default])])]),m=t("el-collapse-transition",[t("ul",{attrs:{role:"menu"},class:"el-menu el-menu--inline",directives:[{name:"show",value:i}],style:{backgroundColor:a.backgroundColor||""}},[d.default])]),v="horizontal"===a.mode&&f||"vertical"===a.mode&&!a.collapse?"el-icon-arrow-down":"el-icon-arrow-right";return t("li",{class:{"el-submenu":!0,"is-active":n,"is-opened":i,"is-disabled":h},attrs:{role:"menuitem","aria-haspopup":"true","aria-expanded":i},on:{mouseenter:this.handleMouseenter,mouseleave:function(){return e.handleMouseleave(!1)},focus:this.handleMouseenter}},[t("div",{class:"el-submenu__title",ref:"submenu-title",on:{click:this.handleClick,mouseenter:this.handleTitleMouseenter,mouseleave:this.handleTitleMouseleave},style:[r,o,{backgroundColor:s}]},[d.title,t("i",{class:["el-submenu__icon-arrow",v]})]),this.isMenuPopup?g:m])}},void 0,void 0,!1,null,null,null);Et.options.__file="packages/menu/src/submenu.vue";var Ct=Et.exports;Ct.install=function(t){t.component(Ct.name,Ct)};var St=Ct,wt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"el-menu-item",class:{"is-active":t.active,"is-disabled":t.disabled},style:[t.paddingStyle,t.itemStyle,{backgroundColor:t.backgroundColor}],attrs:{role:"menuitem",tabindex:"-1"},on:{click:t.handleClick,mouseenter:t.onMouseEnter,focus:t.onMouseEnter,blur:t.onMouseLeave,mouseleave:t.onMouseLeave}},["ElMenu"===t.parentMenu.$options.componentName&&t.rootMenu.collapse&&t.$slots.title?n("el-tooltip",{attrs:{effect:"dark",placement:"right"}},[n("div",{attrs:{slot:"content"},slot:"content"},[t._t("title")],2),n("div",{staticStyle:{position:"absolute",left:"0",top:"0",height:"100%",width:"100%",display:"inline-block","box-sizing":"border-box",padding:"0 20px"}},[t._t("default")],2)]):[t._t("default"),t._t("title")]],2)};wt._withStripped=!0;var kt=n(26),xt=n.n(kt),It=r({name:"ElMenuItem",componentName:"ElMenuItem",mixins:[bt,S.a],components:{ElTooltip:xt.a},props:{index:{default:null,validator:function(t){return"string"==typeof t||null===t}},route:[String,Object],disabled:Boolean},computed:{active:function(){return this.index===this.rootMenu.activeIndex},hoverBackground:function(){return this.rootMenu.hoverBackground},backgroundColor:function(){return this.rootMenu.backgroundColor||""},activeTextColor:function(){return this.rootMenu.activeTextColor||""},textColor:function(){return this.rootMenu.textColor||""},mode:function(){return this.rootMenu.mode},itemStyle:function(){var t={color:this.active?this.activeTextColor:this.textColor};return"horizontal"!==this.mode||this.isNested||(t.borderBottomColor=this.active?this.rootMenu.activeTextColor?this.activeTextColor:"":"transparent"),t},isNested:function(){return this.parentMenu!==this.rootMenu}},methods:{onMouseEnter:function(){("horizontal"!==this.mode||this.rootMenu.backgroundColor)&&(this.$el.style.backgroundColor=this.hoverBackground)},onMouseLeave:function(){("horizontal"!==this.mode||this.rootMenu.backgroundColor)&&(this.$el.style.backgroundColor=this.backgroundColor)},handleClick:function(){this.disabled||(this.dispatch("ElMenu","item-click",this),this.$emit("click",this))}},mounted:function(){this.parentMenu.addItem(this),this.rootMenu.addItem(this)},beforeDestroy:function(){this.parentMenu.removeItem(this),this.rootMenu.removeItem(this)}},wt,[],!1,null,null,null);It.options.__file="packages/menu/src/menu-item.vue";var Rt=It.exports;Rt.install=function(t){t.component(Rt.name,Rt)};var Ot=Rt,Dt=function(){var t=this.$createElement,e=this._self._c||t;return e("li",{staticClass:"el-menu-item-group"},[e("div",{staticClass:"el-menu-item-group__title",style:{paddingLeft:this.levelPadding+"px"}},[this.$slots.title?this._t("title"):[this._v(this._s(this.title))]],2),e("ul",[this._t("default")],2)])};Dt._withStripped=!0;var At=r({name:"ElMenuItemGroup",componentName:"ElMenuItemGroup",inject:["rootMenu"],props:{title:{type:String}},data:function(){return{paddingLeft:20}},computed:{levelPadding:function(){var t=20,e=this.$parent;if(this.rootMenu.collapse)return 20;for(;e&&"ElMenu"!==e.$options.componentName;)"ElSubmenu"===e.$options.componentName&&(t+=20),e=e.$parent;return t}}},Dt,[],!1,null,null,null);At.options.__file="packages/menu/src/menu-item-group.vue";var Mt=At.exports;Mt.install=function(t){t.component(Mt.name,Mt)};var Nt=Mt,Lt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["textarea"===t.type?"el-textarea":"el-input",t.inputSize?"el-input--"+t.inputSize:"",{"is-disabled":t.inputDisabled,"is-exceed":t.inputExceed,"el-input-group":t.$slots.prepend||t.$slots.append,"el-input-group--append":t.$slots.append,"el-input-group--prepend":t.$slots.prepend,"el-input--prefix":t.$slots.prefix||t.prefixIcon,"el-input--suffix":t.$slots.suffix||t.suffixIcon||t.clearable||t.showPassword}],on:{mouseenter:function(e){t.hovering=!0},mouseleave:function(e){t.hovering=!1}}},["textarea"!==t.type?[t.$slots.prepend?n("div",{staticClass:"el-input-group__prepend"},[t._t("prepend")],2):t._e(),"textarea"!==t.type?n("input",t._b({ref:"input",staticClass:"el-input__inner",attrs:{tabindex:t.tabindex,type:t.showPassword?t.passwordVisible?"text":"password":t.type,disabled:t.inputDisabled,readonly:t.readonly,autocomplete:t.autoComplete||t.autocomplete,"aria-label":t.label},on:{compositionstart:t.handleCompositionStart,compositionupdate:t.handleCompositionUpdate,compositionend:t.handleCompositionEnd,input:t.handleInput,focus:t.handleFocus,blur:t.handleBlur,change:t.handleChange}},"input",t.$attrs,!1)):t._e(),t.$slots.prefix||t.prefixIcon?n("span",{staticClass:"el-input__prefix"},[t._t("prefix"),t.prefixIcon?n("i",{staticClass:"el-input__icon",class:t.prefixIcon}):t._e()],2):t._e(),t.getSuffixVisible()?n("span",{staticClass:"el-input__suffix"},[n("span",{staticClass:"el-input__suffix-inner"},[t.showClear&&t.showPwdVisible&&t.isWordLimitVisible?t._e():[t._t("suffix"),t.suffixIcon?n("i",{staticClass:"el-input__icon",class:t.suffixIcon}):t._e()],t.showClear?n("i",{staticClass:"el-input__icon el-icon-circle-close el-input__clear",on:{mousedown:function(t){t.preventDefault()},click:t.clear}}):t._e(),t.showPwdVisible?n("i",{staticClass:"el-input__icon el-icon-view el-input__clear",on:{click:t.handlePasswordVisible}}):t._e(),t.isWordLimitVisible?n("span",{staticClass:"el-input__count"},[n("span",{staticClass:"el-input__count-inner"},[t._v("\n "+t._s(t.textLength)+"/"+t._s(t.upperLimit)+"\n ")])]):t._e()],2),t.validateState?n("i",{staticClass:"el-input__icon",class:["el-input__validateIcon",t.validateIcon]}):t._e()]):t._e(),t.$slots.append?n("div",{staticClass:"el-input-group__append"},[t._t("append")],2):t._e()]:n("textarea",t._b({ref:"textarea",staticClass:"el-textarea__inner",style:t.textareaStyle,attrs:{tabindex:t.tabindex,disabled:t.inputDisabled,readonly:t.readonly,autocomplete:t.autoComplete||t.autocomplete,"aria-label":t.label},on:{compositionstart:t.handleCompositionStart,compositionupdate:t.handleCompositionUpdate,compositionend:t.handleCompositionEnd,input:t.handleInput,focus:t.handleFocus,blur:t.handleBlur,change:t.handleChange}},"textarea",t.$attrs,!1)),t.isWordLimitVisible&&"textarea"===t.type?n("span",{staticClass:"el-input__count"},[t._v(t._s(t.textLength)+"/"+t._s(t.upperLimit))]):t._e()],2)};Lt._withStripped=!0;var Pt=void 0,Bt="\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n",Ft=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function Ut(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Pt||(Pt=document.createElement("textarea"),document.body.appendChild(Pt));var i=function(t){var e=window.getComputedStyle(t),n=e.getPropertyValue("box-sizing"),i=parseFloat(e.getPropertyValue("padding-bottom"))+parseFloat(e.getPropertyValue("padding-top")),r=parseFloat(e.getPropertyValue("border-bottom-width"))+parseFloat(e.getPropertyValue("border-top-width"));return{contextStyle:Ft.map(function(t){return t+":"+e.getPropertyValue(t)}).join(";"),paddingSize:i,borderSize:r,boxSizing:n}}(t),r=i.paddingSize,o=i.borderSize,s=i.boxSizing,a=i.contextStyle;Pt.setAttribute("style",a+";"+Bt),Pt.value=t.value||t.placeholder||"";var l=Pt.scrollHeight,u={};"border-box"===s?l+=o:"content-box"===s&&(l-=r),Pt.value="";var c=Pt.scrollHeight-r;if(null!==e){var h=c*e;"border-box"===s&&(h=h+r+o),l=Math.max(h,l),u.minHeight=h+"px"}if(null!==n){var p=c*n;"border-box"===s&&(p=p+r+o),l=Math.min(p,l)}return u.height=l+"px",Pt.parentNode&&Pt.parentNode.removeChild(Pt),Pt=null,u}var Vt=n(7),Ht=n.n(Vt),Wt=n(19),Gt=r({name:"ElInput",componentName:"ElInput",mixins:[S.a,E.a],inheritAttrs:!1,inject:{elForm:{default:""},elFormItem:{default:""}},data:function(){return{textareaCalcStyle:{},hovering:!1,focused:!1,isComposing:!1,passwordVisible:!1}},props:{value:[String,Number],size:String,resize:String,form:String,disabled:Boolean,readonly:Boolean,type:{type:String,default:"text"},autosize:{type:[Boolean,Object],default:!1},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:function(t){return!0}},validateEvent:{type:Boolean,default:!0},suffixIcon:String,prefixIcon:String,label:String,clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},tabindex:String},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},validateState:function(){return this.elFormItem?this.elFormItem.validateState:""},needStatusIcon:function(){return!!this.elForm&&this.elForm.statusIcon},validateIcon:function(){return{validating:"el-icon-loading",success:"el-icon-circle-check",error:"el-icon-circle-close"}[this.validateState]},textareaStyle:function(){return Ht()({},this.textareaCalcStyle,{resize:this.resize})},inputSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputDisabled:function(){return this.disabled||(this.elForm||{}).disabled},nativeInputValue:function(){return null===this.value||void 0===this.value?"":String(this.value)},showClear:function(){return this.clearable&&!this.inputDisabled&&!this.readonly&&this.nativeInputValue&&(this.focused||this.hovering)},showPwdVisible:function(){return this.showPassword&&!this.inputDisabled&&!this.readonly&&(!!this.nativeInputValue||this.focused)},isWordLimitVisible:function(){return this.showWordLimit&&this.$attrs.maxlength&&("text"===this.type||"textarea"===this.type)&&!this.inputDisabled&&!this.readonly&&!this.showPassword},upperLimit:function(){return this.$attrs.maxlength},textLength:function(){return"number"==typeof this.value?String(this.value).length:(this.value||"").length},inputExceed:function(){return this.isWordLimitVisible&&this.textLength>this.upperLimit}},watch:{value:function(t){this.$nextTick(this.resizeTextarea),this.validateEvent&&this.dispatch("ElFormItem","el.form.change",[t])},nativeInputValue:function(){this.setNativeInputValue()},type:function(){var t=this;this.$nextTick(function(){t.setNativeInputValue(),t.resizeTextarea(),t.updateIconOffset()})}},methods:{focus:function(){this.getInput().focus()},blur:function(){this.getInput().blur()},getMigratingConfig:function(){return{props:{icon:"icon is removed, use suffix-icon / prefix-icon instead.","on-icon-click":"on-icon-click is removed."},events:{click:"click is removed."}}},handleBlur:function(t){this.focused=!1,this.$emit("blur",t),this.validateEvent&&this.dispatch("ElFormItem","el.form.blur",[this.value])},select:function(){this.getInput().select()},resizeTextarea:function(){if(!this.$isServer){var t=this.autosize;if("textarea"===this.type)if(t){var e=t.minRows,n=t.maxRows;this.textareaCalcStyle=Ut(this.$refs.textarea,e,n)}else this.textareaCalcStyle={minHeight:Ut(this.$refs.textarea).minHeight}}},setNativeInputValue:function(){var t=this.getInput();t&&t.value!==this.nativeInputValue&&(t.value=this.nativeInputValue)},handleFocus:function(t){this.focused=!0,this.$emit("focus",t)},handleCompositionStart:function(){this.isComposing=!0},handleCompositionUpdate:function(t){var e=t.target.value,n=e[e.length-1]||"";this.isComposing=!Object(Wt.isKorean)(n)},handleCompositionEnd:function(t){this.isComposing&&(this.isComposing=!1,this.handleInput(t))},handleInput:function(t){this.isComposing||t.target.value!==this.nativeInputValue&&(this.$emit("input",t.target.value),this.$nextTick(this.setNativeInputValue))},handleChange:function(t){this.$emit("change",t.target.value)},calcIconOffset:function(t){var e=[].slice.call(this.$el.querySelectorAll(".el-input__"+t)||[]);if(e.length){for(var n=null,i=0;i<e.length;i++)if(e[i].parentNode===this.$el){n=e[i];break}if(n){var r={suffix:"append",prefix:"prepend"}[t];this.$slots[r]?n.style.transform="translateX("+("suffix"===t?"-":"")+this.$el.querySelector(".el-input-group__"+r).offsetWidth+"px)":n.removeAttribute("style")}}},updateIconOffset:function(){this.calcIconOffset("prefix"),this.calcIconOffset("suffix")},clear:function(){this.$emit("input",""),this.$emit("change",""),this.$emit("clear")},handlePasswordVisible:function(){var t=this;this.passwordVisible=!this.passwordVisible,this.$nextTick(function(){t.focus()})},getInput:function(){return this.$refs.input||this.$refs.textarea},getSuffixVisible:function(){return this.$slots.suffix||this.suffixIcon||this.showClear||this.showPassword||this.isWordLimitVisible||this.validateState&&this.needStatusIcon}},created:function(){this.$on("inputSelect",this.select)},mounted:function(){this.setNativeInputValue(),this.resizeTextarea(),this.updateIconOffset()},updated:function(){this.$nextTick(this.updateIconOffset)}},Lt,[],!1,null,null,null);Gt.options.__file="packages/input/src/input.vue";var jt=Gt.exports;jt.install=function(t){t.component(jt.name,jt)};var zt=jt,$t=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["el-input-number",t.inputNumberSize?"el-input-number--"+t.inputNumberSize:"",{"is-disabled":t.inputNumberDisabled},{"is-without-controls":!t.controls},{"is-controls-right":t.controlsAtRight}],on:{dragstart:function(t){t.preventDefault()}}},[t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-input-number__decrease",class:{"is-disabled":t.minDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.decrease(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-down":"minus")})]):t._e(),t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-input-number__increase",class:{"is-disabled":t.maxDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.increase(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-up":"plus")})]):t._e(),n("el-input",{ref:"input",attrs:{value:t.displayValue,placeholder:t.placeholder,disabled:t.inputNumberDisabled,size:t.inputNumberSize,max:t.max,min:t.min,name:t.name,label:t.label},on:{blur:t.handleBlur,focus:t.handleFocus,input:t.handleInput,change:t.handleInputChange},nativeOn:{keydown:[function(e){return"button"in e||!t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?(e.preventDefault(),t.increase(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?(e.preventDefault(),t.decrease(e)):null}]}})],1)};$t._withStripped=!0;var Xt={bind:function(t,e,n){var i=null,r=void 0,o=function(){return n.context[e.expression].apply()},s=function(){Date.now()-r<100&&o(),clearInterval(i),i=null};Object(ft.on)(t,"mousedown",function(t){0===t.button&&(r=Date.now(),Object(ft.once)(document,"mouseup",s),clearInterval(i),i=setInterval(o,100))})}},Yt=r({name:"ElInputNumber",mixins:[H()("input")],inject:{elForm:{default:""},elFormItem:{default:""}},directives:{repeatClick:Xt},components:{ElInput:p.a},props:{step:{type:Number,default:1},stepStrictly:{type:Boolean,default:!1},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},value:{},disabled:Boolean,size:String,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:""},name:String,label:String,placeholder:String,precision:{type:Number,validator:function(t){return t>=0&&t===parseInt(t,10)}}},data:function(){return{currentValue:0,userInput:null}},watch:{value:{immediate:!0,handler:function(t){var e=void 0===t?t:Number(t);if(void 0!==e){if(isNaN(e))return;if(this.stepStrictly){var n=this.getPrecision(this.step),i=Math.pow(10,n);e=Math.round(e/this.step)*i*this.step/i}void 0!==this.precision&&(e=this.toPrecision(e,this.precision))}e>=this.max&&(e=this.max),e<=this.min&&(e=this.min),this.currentValue=e,this.userInput=null,this.$emit("input",e)}}},computed:{minDisabled:function(){return this._decrease(this.value,this.step)<this.min},maxDisabled:function(){return this._increase(this.value,this.step)>this.max},numPrecision:function(){var t=this.value,e=this.step,n=this.getPrecision,i=this.precision,r=n(e);return void 0!==i?(r>i&&console.warn("[Element Warn][InputNumber]precision should not be less than the decimal places of step"),i):Math.max(n(t),r)},controlsAtRight:function(){return this.controls&&"right"===this.controlsPosition},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},inputNumberSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputNumberDisabled:function(){return this.disabled||!!(this.elForm||{}).disabled},displayValue:function(){if(null!==this.userInput)return this.userInput;var t=this.currentValue;if("number"==typeof t){if(this.stepStrictly){var e=this.getPrecision(this.step),n=Math.pow(10,e);t=Math.round(t/this.step)*n*this.step/n}void 0!==this.precision&&(t=t.toFixed(this.precision))}return t}},methods:{toPrecision:function(t,e){return void 0===e&&(e=this.numPrecision),parseFloat(Math.round(t*Math.pow(10,e))/Math.pow(10,e))},getPrecision:function(t){if(void 0===t)return 0;var e=t.toString(),n=e.indexOf("."),i=0;return-1!==n&&(i=e.length-n-1),i},_increase:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t+n*e)/n)},_decrease:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t-n*e)/n)},increase:function(){if(!this.inputNumberDisabled&&!this.maxDisabled){var t=this.value||0,e=this._increase(t,this.step);this.setCurrentValue(e)}},decrease:function(){if(!this.inputNumberDisabled&&!this.minDisabled){var t=this.value||0,e=this._decrease(t,this.step);this.setCurrentValue(e)}},handleBlur:function(t){this.$emit("blur",t)},handleFocus:function(t){this.$emit("focus",t)},setCurrentValue:function(t){var e=this.currentValue;"number"==typeof t&&void 0!==this.precision&&(t=this.toPrecision(t,this.precision)),t>=this.max&&(t=this.max),t<=this.min&&(t=this.min),e!==t&&(this.userInput=null,this.$emit("input",t),this.$emit("change",t,e),this.currentValue=t)},handleInput:function(t){this.userInput=t},handleInputChange:function(t){var e=""===t?void 0:Number(t);isNaN(e)&&""!==t||this.setCurrentValue(e),this.userInput=null},select:function(){this.$refs.input.select()}},mounted:function(){var t=this.$refs.input.$refs.input;t.setAttribute("role","spinbutton"),t.setAttribute("aria-valuemax",this.max),t.setAttribute("aria-valuemin",this.min),t.setAttribute("aria-valuenow",this.currentValue),t.setAttribute("aria-disabled",this.inputNumberDisabled)},updated:function(){this.$refs&&this.$refs.input&&this.$refs.input.$refs.input.setAttribute("aria-valuenow",this.currentValue)}},$t,[],!1,null,null,null);Yt.options.__file="packages/input-number/src/input-number.vue";var Kt=Yt.exports;Kt.install=function(t){t.component(Kt.name,Kt)};var Jt=Kt,qt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-radio",class:[t.border&&t.radioSize?"el-radio--"+t.radioSize:"",{"is-disabled":t.isDisabled},{"is-focus":t.focus},{"is-bordered":t.border},{"is-checked":t.model===t.label}],attrs:{role:"radio","aria-checked":t.model===t.label,"aria-disabled":t.isDisabled,tabindex:t.tabIndex},on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"]))return null;e.stopPropagation(),e.preventDefault(),t.model=t.isDisabled?t.model:t.label}}},[n("span",{staticClass:"el-radio__input",class:{"is-disabled":t.isDisabled,"is-checked":t.model===t.label}},[n("span",{staticClass:"el-radio__inner"}),n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],ref:"radio",staticClass:"el-radio__original",attrs:{type:"radio","aria-hidden":"true",name:t.name,disabled:t.isDisabled,tabindex:"-1"},domProps:{value:t.label,checked:t._q(t.model,t.label)},on:{focus:function(e){t.focus=!0},blur:function(e){t.focus=!1},change:[function(e){t.model=t.label},t.handleChange]}})]),n("span",{staticClass:"el-radio__label",on:{keydown:function(t){t.stopPropagation()}}},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2)])};qt._withStripped=!0;var Zt=r({name:"ElRadio",mixins:[S.a],inject:{elForm:{default:""},elFormItem:{default:""}},componentName:"ElRadio",props:{value:{},label:{},disabled:Boolean,name:String,border:Boolean,size:String},data:function(){return{focus:!1}},computed:{isGroup:function(){for(var t=this.$parent;t;){if("ElRadioGroup"===t.$options.componentName)return this._radioGroup=t,!0;t=t.$parent}return!1},model:{get:function(){return this.isGroup?this._radioGroup.value:this.value},set:function(t){this.isGroup?this.dispatch("ElRadioGroup","input",[t]):this.$emit("input",t),this.$refs.radio&&(this.$refs.radio.checked=this.model===this.label)}},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},radioSize:function(){var t=this.size||this._elFormItemSize||(this.$ELEMENT||{}).size;return this.isGroup&&this._radioGroup.radioGroupSize||t},isDisabled:function(){return this.isGroup?this._radioGroup.disabled||this.disabled||(this.elForm||{}).disabled:this.disabled||(this.elForm||{}).disabled},tabIndex:function(){return this.isDisabled||this.isGroup&&this.model!==this.label?-1:0}},methods:{handleChange:function(){var t=this;this.$nextTick(function(){t.$emit("change",t.model),t.isGroup&&t.dispatch("ElRadioGroup","handleChange",t.model)})}}},qt,[],!1,null,null,null);Zt.options.__file="packages/radio/src/radio.vue";var Qt=Zt.exports;Qt.install=function(t){t.component(Qt.name,Qt)};var te=Qt,ee=function(){var t=this.$createElement;return(this._self._c||t)(this._elTag,{tag:"component",staticClass:"el-radio-group",attrs:{role:"radiogroup"},on:{keydown:this.handleKeydown}},[this._t("default")],2)};ee._withStripped=!0;var ne=Object.freeze({LEFT:37,UP:38,RIGHT:39,DOWN:40}),ie=r({name:"ElRadioGroup",componentName:"ElRadioGroup",inject:{elFormItem:{default:""}},mixins:[S.a],props:{value:{},size:String,fill:String,textColor:String,disabled:Boolean},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},_elTag:function(){return(this.$vnode.data||{}).tag||"div"},radioGroupSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size}},created:function(){var t=this;this.$on("handleChange",function(e){t.$emit("change",e)})},mounted:function(){var t=this.$el.querySelectorAll("[type=radio]"),e=this.$el.querySelectorAll("[role=radio]")[0];![].some.call(t,function(t){return t.checked})&&e&&(e.tabIndex=0)},methods:{handleKeydown:function(t){var e=t.target,n="INPUT"===e.nodeName?"[type=radio]":"[role=radio]",i=this.$el.querySelectorAll(n),r=i.length,o=[].indexOf.call(i,e),s=this.$el.querySelectorAll("[role=radio]");switch(t.keyCode){case ne.LEFT:case ne.UP:t.stopPropagation(),t.preventDefault(),0===o?(s[r-1].click(),s[r-1].focus()):(s[o-1].click(),s[o-1].focus());break;case ne.RIGHT:case ne.DOWN:o===r-1?(t.stopPropagation(),t.preventDefault(),s[0].click(),s[0].focus()):(s[o+1].click(),s[o+1].focus())}}},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",[this.value])}}},ee,[],!1,null,null,null);ie.options.__file="packages/radio/src/radio-group.vue";var re=ie.exports;re.install=function(t){t.component(re.name,re)};var oe=re,se=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-radio-button",class:[t.size?"el-radio-button--"+t.size:"",{"is-active":t.value===t.label},{"is-disabled":t.isDisabled},{"is-focus":t.focus}],attrs:{role:"radio","aria-checked":t.value===t.label,"aria-disabled":t.isDisabled,tabindex:t.tabIndex},on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"]))return null;e.stopPropagation(),e.preventDefault(),t.value=t.isDisabled?t.value:t.label}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.value,expression:"value"}],staticClass:"el-radio-button__orig-radio",attrs:{type:"radio",name:t.name,disabled:t.isDisabled,tabindex:"-1"},domProps:{value:t.label,checked:t._q(t.value,t.label)},on:{change:[function(e){t.value=t.label},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}),n("span",{staticClass:"el-radio-button__inner",style:t.value===t.label?t.activeStyle:null,on:{keydown:function(t){t.stopPropagation()}}},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2)])};se._withStripped=!0;var ae=r({name:"ElRadioButton",mixins:[S.a],inject:{elForm:{default:""},elFormItem:{default:""}},props:{label:{},disabled:Boolean,name:String},data:function(){return{focus:!1}},computed:{value:{get:function(){return this._radioGroup.value},set:function(t){this._radioGroup.$emit("input",t)}},_radioGroup:function(){for(var t=this.$parent;t;){if("ElRadioGroup"===t.$options.componentName)return t;t=t.$parent}return!1},activeStyle:function(){return{backgroundColor:this._radioGroup.fill||"",borderColor:this._radioGroup.fill||"",boxShadow:this._radioGroup.fill?"-1px 0 0 0 "+this._radioGroup.fill:"",color:this._radioGroup.textColor||""}},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},size:function(){return this._radioGroup.radioGroupSize||this._elFormItemSize||(this.$ELEMENT||{}).size},isDisabled:function(){return this.disabled||this._radioGroup.disabled||(this.elForm||{}).disabled},tabIndex:function(){return this.isDisabled||this._radioGroup&&this.value!==this.label?-1:0}},methods:{handleChange:function(){var t=this;this.$nextTick(function(){t.dispatch("ElRadioGroup","handleChange",t.value)})}}},se,[],!1,null,null,null);ae.options.__file="packages/radio/src/radio-button.vue";var le=ae.exports;le.install=function(t){t.component(le.name,le)};var ue=le,ce=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-checkbox",class:[t.border&&t.checkboxSize?"el-checkbox--"+t.checkboxSize:"",{"is-disabled":t.isDisabled},{"is-bordered":t.border},{"is-checked":t.isChecked}],attrs:{id:t.id}},[n("span",{staticClass:"el-checkbox__input",class:{"is-disabled":t.isDisabled,"is-checked":t.isChecked,"is-indeterminate":t.indeterminate,"is-focus":t.focus},attrs:{tabindex:!!t.indeterminate&&0,role:!!t.indeterminate&&"checkbox","aria-checked":!!t.indeterminate&&"mixed"}},[n("span",{staticClass:"el-checkbox__inner"}),t.trueLabel||t.falseLabel?n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox__original",attrs:{type:"checkbox","aria-hidden":t.indeterminate?"true":"false",name:t.name,disabled:t.isDisabled,"true-value":t.trueLabel,"false-value":t.falseLabel},domProps:{checked:Array.isArray(t.model)?t._i(t.model,null)>-1:t._q(t.model,t.trueLabel)},on:{change:[function(e){var n=t.model,i=e.target,r=i.checked?t.trueLabel:t.falseLabel;if(Array.isArray(n)){var o=t._i(n,null);i.checked?o<0&&(t.model=n.concat([null])):o>-1&&(t.model=n.slice(0,o).concat(n.slice(o+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}):n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox__original",attrs:{type:"checkbox","aria-hidden":t.indeterminate?"true":"false",disabled:t.isDisabled,name:t.name},domProps:{value:t.label,checked:Array.isArray(t.model)?t._i(t.model,t.label)>-1:t.model},on:{change:[function(e){var n=t.model,i=e.target,r=!!i.checked;if(Array.isArray(n)){var o=t.label,s=t._i(n,o);i.checked?s<0&&(t.model=n.concat([o])):s>-1&&(t.model=n.slice(0,s).concat(n.slice(s+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}})]),t.$slots.default||t.label?n("span",{staticClass:"el-checkbox__label"},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2):t._e()])};ce._withStripped=!0;var he=r({name:"ElCheckbox",mixins:[S.a],inject:{elForm:{default:""},elFormItem:{default:""}},componentName:"ElCheckbox",data:function(){return{selfModel:!1,focus:!1,isLimitExceeded:!1}},computed:{model:{get:function(){return this.isGroup?this.store:void 0!==this.value?this.value:this.selfModel},set:function(t){this.isGroup?(this.isLimitExceeded=!1,void 0!==this._checkboxGroup.min&&t.length<this._checkboxGroup.min&&(this.isLimitExceeded=!0),void 0!==this._checkboxGroup.max&&t.length>this._checkboxGroup.max&&(this.isLimitExceeded=!0),!1===this.isLimitExceeded&&this.dispatch("ElCheckboxGroup","input",[t])):(this.$emit("input",t),this.selfModel=t)}},isChecked:function(){return"[object Boolean]"==={}.toString.call(this.model)?this.model:Array.isArray(this.model)?this.model.indexOf(this.label)>-1:null!==this.model&&void 0!==this.model?this.model===this.trueLabel:void 0},isGroup:function(){for(var t=this.$parent;t;){if("ElCheckboxGroup"===t.$options.componentName)return this._checkboxGroup=t,!0;t=t.$parent}return!1},store:function(){return this._checkboxGroup?this._checkboxGroup.value:this.value},isLimitDisabled:function(){var t=this._checkboxGroup,e=t.max,n=t.min;return!(!e&&!n)&&this.model.length>=e&&!this.isChecked||this.model.length<=n&&this.isChecked},isDisabled:function(){return this.isGroup?this._checkboxGroup.disabled||this.disabled||(this.elForm||{}).disabled||this.isLimitDisabled:this.disabled||(this.elForm||{}).disabled},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},checkboxSize:function(){var t=this.size||this._elFormItemSize||(this.$ELEMENT||{}).size;return this.isGroup&&this._checkboxGroup.checkboxGroupSize||t}},props:{value:{},label:{},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:String,trueLabel:[String,Number],falseLabel:[String,Number],id:String,controls:String,border:Boolean,size:String},methods:{addToStore:function(){Array.isArray(this.model)&&-1===this.model.indexOf(this.label)?this.model.push(this.label):this.model=this.trueLabel||!0},handleChange:function(t){var e=this;if(!this.isLimitExceeded){var n=void 0;n=t.target.checked?void 0===this.trueLabel||this.trueLabel:void 0!==this.falseLabel&&this.falseLabel,this.$emit("change",n,t),this.$nextTick(function(){e.isGroup&&e.dispatch("ElCheckboxGroup","change",[e._checkboxGroup.value])})}}},created:function(){this.checked&&this.addToStore()},mounted:function(){this.indeterminate&&this.$el.setAttribute("aria-controls",this.controls)},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",t)}}},ce,[],!1,null,null,null);he.options.__file="packages/checkbox/src/checkbox.vue";var pe=he.exports;pe.install=function(t){t.component(pe.name,pe)};var de=pe,fe=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("label",{staticClass:"el-checkbox-button",class:[t.size?"el-checkbox-button--"+t.size:"",{"is-disabled":t.isDisabled},{"is-checked":t.isChecked},{"is-focus":t.focus}],attrs:{role:"checkbox","aria-checked":t.isChecked,"aria-disabled":t.isDisabled}},[t.trueLabel||t.falseLabel?n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox-button__original",attrs:{type:"checkbox",name:t.name,disabled:t.isDisabled,"true-value":t.trueLabel,"false-value":t.falseLabel},domProps:{checked:Array.isArray(t.model)?t._i(t.model,null)>-1:t._q(t.model,t.trueLabel)},on:{change:[function(e){var n=t.model,i=e.target,r=i.checked?t.trueLabel:t.falseLabel;if(Array.isArray(n)){var o=t._i(n,null);i.checked?o<0&&(t.model=n.concat([null])):o>-1&&(t.model=n.slice(0,o).concat(n.slice(o+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}):n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox-button__original",attrs:{type:"checkbox",name:t.name,disabled:t.isDisabled},domProps:{value:t.label,checked:Array.isArray(t.model)?t._i(t.model,t.label)>-1:t.model},on:{change:[function(e){var n=t.model,i=e.target,r=!!i.checked;if(Array.isArray(n)){var o=t.label,s=t._i(n,o);i.checked?s<0&&(t.model=n.concat([o])):s>-1&&(t.model=n.slice(0,s).concat(n.slice(s+1)))}else t.model=r},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}),t.$slots.default||t.label?n("span",{staticClass:"el-checkbox-button__inner",style:t.isChecked?t.activeStyle:null},[t._t("default",[t._v(t._s(t.label))])],2):t._e()])};fe._withStripped=!0;var ge=r({name:"ElCheckboxButton",mixins:[S.a],inject:{elForm:{default:""},elFormItem:{default:""}},data:function(){return{selfModel:!1,focus:!1,isLimitExceeded:!1}},props:{value:{},label:{},disabled:Boolean,checked:Boolean,name:String,trueLabel:[String,Number],falseLabel:[String,Number]},computed:{model:{get:function(){return this._checkboxGroup?this.store:void 0!==this.value?this.value:this.selfModel},set:function(t){this._checkboxGroup?(this.isLimitExceeded=!1,void 0!==this._checkboxGroup.min&&t.length<this._checkboxGroup.min&&(this.isLimitExceeded=!0),void 0!==this._checkboxGroup.max&&t.length>this._checkboxGroup.max&&(this.isLimitExceeded=!0),!1===this.isLimitExceeded&&this.dispatch("ElCheckboxGroup","input",[t])):void 0!==this.value?this.$emit("input",t):this.selfModel=t}},isChecked:function(){return"[object Boolean]"==={}.toString.call(this.model)?this.model:Array.isArray(this.model)?this.model.indexOf(this.label)>-1:null!==this.model&&void 0!==this.model?this.model===this.trueLabel:void 0},_checkboxGroup:function(){for(var t=this.$parent;t;){if("ElCheckboxGroup"===t.$options.componentName)return t;t=t.$parent}return!1},store:function(){return this._checkboxGroup?this._checkboxGroup.value:this.value},activeStyle:function(){return{backgroundColor:this._checkboxGroup.fill||"",borderColor:this._checkboxGroup.fill||"",color:this._checkboxGroup.textColor||"","box-shadow":"-1px 0 0 0 "+this._checkboxGroup.fill}},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},size:function(){return this._checkboxGroup.checkboxGroupSize||this._elFormItemSize||(this.$ELEMENT||{}).size},isLimitDisabled:function(){var t=this._checkboxGroup,e=t.max,n=t.min;return!(!e&&!n)&&this.model.length>=e&&!this.isChecked||this.model.length<=n&&this.isChecked},isDisabled:function(){return this._checkboxGroup?this._checkboxGroup.disabled||this.disabled||(this.elForm||{}).disabled||this.isLimitDisabled:this.disabled||(this.elForm||{}).disabled}},methods:{addToStore:function(){Array.isArray(this.model)&&-1===this.model.indexOf(this.label)?this.model.push(this.label):this.model=this.trueLabel||!0},handleChange:function(t){var e=this;if(!this.isLimitExceeded){var n=void 0;n=t.target.checked?void 0===this.trueLabel||this.trueLabel:void 0!==this.falseLabel&&this.falseLabel,this.$emit("change",n,t),this.$nextTick(function(){e._checkboxGroup&&e.dispatch("ElCheckboxGroup","change",[e._checkboxGroup.value])})}}},created:function(){this.checked&&this.addToStore()}},fe,[],!1,null,null,null);ge.options.__file="packages/checkbox/src/checkbox-button.vue";var me=ge.exports;me.install=function(t){t.component(me.name,me)};var ve=me,_e=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-checkbox-group",attrs:{role:"group","aria-label":"checkbox-group"}},[this._t("default")],2)};_e._withStripped=!0;var ye=r({name:"ElCheckboxGroup",componentName:"ElCheckboxGroup",mixins:[S.a],inject:{elFormItem:{default:""}},props:{value:{},disabled:Boolean,min:Number,max:Number,size:String,fill:String,textColor:String},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},checkboxGroupSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size}},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",[t])}}},_e,[],!1,null,null,null);ye.options.__file="packages/checkbox/src/checkbox-group.vue";var be=ye.exports;be.install=function(t){t.component(be.name,be)};var Te=be,Ee=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-switch",class:{"is-disabled":t.switchDisabled,"is-checked":t.checked},attrs:{role:"switch","aria-checked":t.checked,"aria-disabled":t.switchDisabled},on:{click:function(e){return e.preventDefault(),t.switchValue(e)}}},[n("input",{ref:"input",staticClass:"el-switch__input",attrs:{type:"checkbox",id:t.id,name:t.name,"true-value":t.activeValue,"false-value":t.inactiveValue,disabled:t.switchDisabled},on:{change:t.handleChange,keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.switchValue(e):null}}}),t.inactiveIconClass||t.inactiveText?n("span",{class:["el-switch__label","el-switch__label--left",t.checked?"":"is-active"]},[t.inactiveIconClass?n("i",{class:[t.inactiveIconClass]}):t._e(),!t.inactiveIconClass&&t.inactiveText?n("span",{attrs:{"aria-hidden":t.checked}},[t._v(t._s(t.inactiveText))]):t._e()]):t._e(),n("span",{ref:"core",staticClass:"el-switch__core",style:{width:t.coreWidth+"px"}}),t.activeIconClass||t.activeText?n("span",{class:["el-switch__label","el-switch__label--right",t.checked?"is-active":""]},[t.activeIconClass?n("i",{class:[t.activeIconClass]}):t._e(),!t.activeIconClass&&t.activeText?n("span",{attrs:{"aria-hidden":!t.checked}},[t._v(t._s(t.activeText))]):t._e()]):t._e()])};Ee._withStripped=!0;var Ce=r({name:"ElSwitch",mixins:[H()("input"),E.a,S.a],inject:{elForm:{default:""}},props:{value:{type:[Boolean,String,Number],default:!1},disabled:{type:Boolean,default:!1},width:{type:Number,default:40},activeIconClass:{type:String,default:""},inactiveIconClass:{type:String,default:""},activeText:String,inactiveText:String,activeColor:{type:String,default:""},inactiveColor:{type:String,default:""},activeValue:{type:[Boolean,String,Number],default:!0},inactiveValue:{type:[Boolean,String,Number],default:!1},name:{type:String,default:""},validateEvent:{type:Boolean,default:!0},id:String},data:function(){return{coreWidth:this.width}},created:function(){~[this.activeValue,this.inactiveValue].indexOf(this.value)||this.$emit("input",this.inactiveValue)},computed:{checked:function(){return this.value===this.activeValue},switchDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},watch:{checked:function(){this.$refs.input.checked=this.checked,(this.activeColor||this.inactiveColor)&&this.setBackgroundColor(),this.validateEvent&&this.dispatch("ElFormItem","el.form.change",[this.value])}},methods:{handleChange:function(t){var e=this,n=this.checked?this.inactiveValue:this.activeValue;this.$emit("input",n),this.$emit("change",n),this.$nextTick(function(){e.$refs.input.checked=e.checked})},setBackgroundColor:function(){var t=this.checked?this.activeColor:this.inactiveColor;this.$refs.core.style.borderColor=t,this.$refs.core.style.backgroundColor=t},switchValue:function(){!this.switchDisabled&&this.handleChange()},getMigratingConfig:function(){return{props:{"on-color":"on-color is renamed to active-color.","off-color":"off-color is renamed to inactive-color.","on-text":"on-text is renamed to active-text.","off-text":"off-text is renamed to inactive-text.","on-value":"on-value is renamed to active-value.","off-value":"off-value is renamed to inactive-value.","on-icon-class":"on-icon-class is renamed to active-icon-class.","off-icon-class":"off-icon-class is renamed to inactive-icon-class."}}}},mounted:function(){this.coreWidth=this.width||40,(this.activeColor||this.inactiveColor)&&this.setBackgroundColor(),this.$refs.input.checked=this.checked}},Ee,[],!1,null,null,null);Ce.options.__file="packages/switch/src/component.vue";var Se=Ce.exports;Se.install=function(t){t.component(Se.name,Se)};var we=Se,ke=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleClose,expression:"handleClose"}],staticClass:"el-select",class:[t.selectSize?"el-select--"+t.selectSize:""],on:{click:function(e){return e.stopPropagation(),t.toggleMenu(e)}}},[t.multiple?n("div",{ref:"tags",staticClass:"el-select__tags",style:{"max-width":t.inputWidth-32+"px",width:"100%"}},[t.collapseTags&&t.selected.length?n("span",[n("el-tag",{attrs:{closable:!t.selectDisabled,size:t.collapseTagSize,hit:t.selected[0].hitState,type:"info","disable-transitions":""},on:{close:function(e){t.deleteTag(e,t.selected[0])}}},[n("span",{staticClass:"el-select__tags-text"},[t._v(t._s(t.selected[0].currentLabel))])]),t.selected.length>1?n("el-tag",{attrs:{closable:!1,size:t.collapseTagSize,type:"info","disable-transitions":""}},[n("span",{staticClass:"el-select__tags-text"},[t._v("+ "+t._s(t.selected.length-1))])]):t._e()],1):t._e(),t.collapseTags?t._e():n("transition-group",{on:{"after-leave":t.resetInputHeight}},t._l(t.selected,function(e){return n("el-tag",{key:t.getValueKey(e),attrs:{closable:!t.selectDisabled,size:t.collapseTagSize,hit:e.hitState,type:"info","disable-transitions":""},on:{close:function(n){t.deleteTag(n,e)}}},[n("span",{staticClass:"el-select__tags-text"},[t._v(t._s(e.currentLabel))])])}),1),t.filterable?n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"input",staticClass:"el-select__input",class:[t.selectSize?"is-"+t.selectSize:""],style:{"flex-grow":"1",width:t.inputLength/(t.inputWidth-32)+"%","max-width":t.inputWidth-42+"px"},attrs:{type:"text",disabled:t.selectDisabled,autocomplete:t.autoComplete||t.autocomplete},domProps:{value:t.query},on:{focus:t.handleFocus,blur:function(e){t.softFocus=!1},keyup:t.managePlaceholder,keydown:[t.resetInputState,function(e){if(!("button"in e)&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"]))return null;e.preventDefault(),t.navigateOptions("next")},function(e){if(!("button"in e)&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"]))return null;e.preventDefault(),t.navigateOptions("prev")},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.preventDefault(),t.selectOption(e)):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"]))return null;e.stopPropagation(),e.preventDefault(),t.visible=!1},function(e){return"button"in e||!t._k(e.keyCode,"delete",[8,46],e.key,["Backspace","Delete","Del"])?t.deletePrevTag(e):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.visible=!1}],compositionstart:t.handleComposition,compositionupdate:t.handleComposition,compositionend:t.handleComposition,input:[function(e){e.target.composing||(t.query=e.target.value)},t.debouncedQueryChange]}}):t._e()],1):t._e(),n("el-input",{ref:"reference",class:{"is-focus":t.visible},attrs:{type:"text",placeholder:t.currentPlaceholder,name:t.name,id:t.id,autocomplete:t.autoComplete||t.autocomplete,size:t.selectSize,disabled:t.selectDisabled,readonly:t.readonly,"validate-event":!1,tabindex:t.multiple&&t.filterable?"-1":null},on:{focus:t.handleFocus,blur:t.handleBlur},nativeOn:{keyup:function(e){return t.debouncedOnInputChange(e)},keydown:[function(e){if(!("button"in e)&&t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"]))return null;e.stopPropagation(),e.preventDefault(),t.navigateOptions("next")},function(e){if(!("button"in e)&&t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"]))return null;e.stopPropagation(),e.preventDefault(),t.navigateOptions("prev")},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.preventDefault(),t.selectOption(e)):null},function(e){if(!("button"in e)&&t._k(e.keyCode,"esc",27,e.key,["Esc","Escape"]))return null;e.stopPropagation(),e.preventDefault(),t.visible=!1},function(e){if(!("button"in e)&&t._k(e.keyCode,"tab",9,e.key,"Tab"))return null;t.visible=!1}],paste:function(e){return t.debouncedOnInputChange(e)},mouseenter:function(e){t.inputHovering=!0},mouseleave:function(e){t.inputHovering=!1}},model:{value:t.selectedLabel,callback:function(e){t.selectedLabel=e},expression:"selectedLabel"}},[t.$slots.prefix?n("template",{slot:"prefix"},[t._t("prefix")],2):t._e(),n("template",{slot:"suffix"},[n("i",{directives:[{name:"show",rawName:"v-show",value:!t.showClose,expression:"!showClose"}],class:["el-select__caret","el-input__icon","el-icon-"+t.iconClass]}),t.showClose?n("i",{staticClass:"el-select__caret el-input__icon el-icon-circle-close",on:{click:t.handleClearClick}}):t._e()])],2),n("transition",{attrs:{name:"el-zoom-in-top"},on:{"before-enter":t.handleMenuEnter,"after-leave":t.doDestroy}},[n("el-select-menu",{directives:[{name:"show",rawName:"v-show",value:t.visible&&!1!==t.emptyText,expression:"visible && emptyText !== false"}],ref:"popper",attrs:{"append-to-body":t.popperAppendToBody}},[n("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:t.options.length>0&&!t.loading,expression:"options.length > 0 && !loading"}],ref:"scrollbar",class:{"is-empty":!t.allowCreate&&t.query&&0===t.filteredOptionsCount},attrs:{tag:"ul","wrap-class":"el-select-dropdown__wrap","view-class":"el-select-dropdown__list"}},[t.showNewOption?n("el-option",{attrs:{value:t.query,created:""}}):t._e(),t._t("default")],2),t.emptyText&&(!t.allowCreate||t.loading||t.allowCreate&&0===t.options.length)?[t.$slots.empty?t._t("empty"):n("p",{staticClass:"el-select-dropdown__empty"},[t._v("\n "+t._s(t.emptyText)+"\n ")])]:t._e()],2)],1)],1)};ke._withStripped=!0;var xe=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-select-dropdown el-popper",class:[{"is-multiple":this.$parent.multiple},this.popperClass],style:{minWidth:this.minWidth}},[this._t("default")],2)};xe._withStripped=!0;var Ie=r({name:"ElSelectDropdown",componentName:"ElSelectDropdown",mixins:[L.a],props:{placement:{default:"bottom-start"},boundariesPadding:{default:0},popperOptions:{default:function(){return{gpuAcceleration:!1}}},visibleArrow:{default:!0},appendToBody:{type:Boolean,default:!0}},data:function(){return{minWidth:""}},computed:{popperClass:function(){return this.$parent.popperClass}},watch:{"$parent.inputWidth":function(){this.minWidth=this.$parent.$el.getBoundingClientRect().width+"px"}},mounted:function(){var t=this;this.referenceElm=this.$parent.$refs.reference.$el,this.$parent.popperElm=this.popperElm=this.$el,this.$on("updatePopper",function(){t.$parent.visible&&t.updatePopper()}),this.$on("destroyPopper",this.destroyPopper)}},xe,[],!1,null,null,null);Ie.options.__file="packages/select/src/select-dropdown.vue";var Re=Ie.exports,Oe=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-select-dropdown__item",class:{selected:t.itemSelected,"is-disabled":t.disabled||t.groupDisabled||t.limitReached,hover:t.hover},on:{mouseenter:t.hoverItem,click:function(e){return e.stopPropagation(),t.selectOptionClick(e)}}},[t._t("default",[n("span",[t._v(t._s(t.currentLabel))])])],2)};Oe._withStripped=!0;var De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=r({mixins:[S.a],name:"ElOption",componentName:"ElOption",inject:["select"],props:{value:{required:!0},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},data:function(){return{index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}},computed:{isObject:function(){return"[object object]"===Object.prototype.toString.call(this.value).toLowerCase()},currentLabel:function(){return this.label||(this.isObject?"":this.value)},currentValue:function(){return this.value||this.label||""},itemSelected:function(){return this.select.multiple?this.contains(this.select.value,this.value):this.isEqual(this.value,this.select.value)},limitReached:function(){return!!this.select.multiple&&(!this.itemSelected&&(this.select.value||[]).length>=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel:function(){this.created||this.select.remote||this.dispatch("ElSelect","setSelected")},value:function(t,e){var n=this.select,i=n.remote,r=n.valueKey;if(!this.created&&!i){if(r&&"object"===(void 0===t?"undefined":De(t))&&"object"===(void 0===e?"undefined":De(e))&&t[r]===e[r])return;this.dispatch("ElSelect","setSelected")}}},methods:{isEqual:function(t,e){if(this.isObject){var n=this.select.valueKey;return Object(g.getValueByPath)(t,n)===Object(g.getValueByPath)(e,n)}return t===e},contains:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if(this.isObject){var n=this.select.valueKey;return t&&t.some(function(t){return Object(g.getValueByPath)(t,n)===Object(g.getValueByPath)(e,n)})}return t&&t.indexOf(e)>-1},handleGroupDisabled:function(t){this.groupDisabled=t},hoverItem:function(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this))},selectOptionClick:function(){!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ElSelect","handleOptionClick",[this,!0])},queryChange:function(t){this.visible=new RegExp(Object(g.escapeRegexpString)(t),"i").test(this.currentLabel)||this.created,this.visible||this.select.filteredOptionsCount--}},created:function(){this.select.options.push(this),this.select.cachedOptions.push(this),this.select.optionsCount++,this.select.filteredOptionsCount++,this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled)},beforeDestroy:function(){var t=this.select,e=t.selected,n=t.multiple?e:[e],i=this.select.cachedOptions.indexOf(this),r=n.indexOf(this);i>-1&&r<0&&this.select.cachedOptions.splice(i,1),this.select.onOptionDestroy(this.select.options.indexOf(this))}},Oe,[],!1,null,null,null);Ae.options.__file="packages/select/src/option.vue";var Me=Ae.exports,Ne=n(29),Le=n.n(Ne),Pe=n(14),Be=n(27),Fe=n.n(Be),Ue=r({mixins:[S.a,f.a,H()("reference"),{data:function(){return{hoverOption:-1}},computed:{optionsAllDisabled:function(){return this.options.filter(function(t){return t.visible}).every(function(t){return t.disabled})}},watch:{hoverIndex:function(t){var e=this;"number"==typeof t&&t>-1&&(this.hoverOption=this.options[t]||{}),this.options.forEach(function(t){t.hover=e.hoverOption===t})}},methods:{navigateOptions:function(t){var e=this;if(this.visible){if(0!==this.options.length&&0!==this.filteredOptionsCount&&!this.optionsAllDisabled){"next"===t?(this.hoverIndex++,this.hoverIndex===this.options.length&&(this.hoverIndex=0)):"prev"===t&&(this.hoverIndex--,this.hoverIndex<0&&(this.hoverIndex=this.options.length-1));var n=this.options[this.hoverIndex];!0!==n.disabled&&!0!==n.groupDisabled&&n.visible||this.navigateOptions(t),this.$nextTick(function(){return e.scrollToOption(e.hoverOption)})}}else this.visible=!0}}}],name:"ElSelect",componentName:"ElSelect",inject:{elForm:{default:""},elFormItem:{default:""}},provide:function(){return{select:this}},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},readonly:function(){return!this.filterable||this.multiple||!Object(g.isIE)()&&!Object(g.isEdge)()&&!this.visible},showClose:function(){var t=this.multiple?Array.isArray(this.value)&&this.value.length>0:void 0!==this.value&&null!==this.value&&""!==this.value;return this.clearable&&!this.selectDisabled&&this.inputHovering&&t},iconClass:function(){return this.remote&&this.filterable?"":this.visible?"arrow-up is-reverse":"arrow-up"},debounce:function(){return this.remote?300:0},emptyText:function(){return this.loading?this.loadingText||this.t("el.select.loading"):(!this.remote||""!==this.query||0!==this.options.length)&&(this.filterable&&this.query&&this.options.length>0&&0===this.filteredOptionsCount?this.noMatchText||this.t("el.select.noMatch"):0===this.options.length?this.noDataText||this.t("el.select.noData"):null)},showNewOption:function(){var t=this,e=this.options.filter(function(t){return!t.created}).some(function(e){return e.currentLabel===t.query});return this.filterable&&this.allowCreate&&""!==this.query&&!e},selectSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},selectDisabled:function(){return this.disabled||(this.elForm||{}).disabled},collapseTagSize:function(){return["small","mini"].indexOf(this.selectSize)>-1?"mini":"small"},propPlaceholder:function(){return void 0!==this.placeholder?this.placeholder:this.t("el.select.placeholder")}},components:{ElInput:p.a,ElSelectMenu:Re,ElOption:Me,ElTag:Le.a,ElScrollbar:B.a},directives:{Clickoutside:A.a},props:{name:String,id:String,value:{required:!0},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:function(t){return!0}},automaticDropdown:Boolean,size:String,disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:String,remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String,required:!1},defaultFirstOption:Boolean,reserveKeyword:Boolean,valueKey:{type:String,default:"value"},collapseTags:Boolean,popperAppendToBody:{type:Boolean,default:!0}},data:function(){return{options:[],cachedOptions:[],createdLabel:null,createdSelected:!1,selected:this.multiple?[]:{},inputLength:20,inputWidth:0,initialInputHeight:0,cachedPlaceHolder:"",optionsCount:0,filteredOptionsCount:0,visible:!1,softFocus:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,currentPlaceholder:"",menuVisibleOnFocus:!1,isOnComposition:!1,isSilentBlur:!1}},watch:{selectDisabled:function(){var t=this;this.$nextTick(function(){t.resetInputHeight()})},propPlaceholder:function(t){this.cachedPlaceHolder=this.currentPlaceholder=t},value:function(t,e){this.multiple&&(this.resetInputHeight(),t&&t.length>0||this.$refs.input&&""!==this.query?this.currentPlaceholder="":this.currentPlaceholder=this.cachedPlaceHolder,this.filterable&&!this.reserveKeyword&&(this.query="",this.handleQueryChange(this.query))),this.setSelected(),this.filterable&&!this.multiple&&(this.inputLength=20),Object(g.valueEquals)(t,e)||this.dispatch("ElFormItem","el.form.change",t)},visible:function(t){var e=this;t?(this.broadcast("ElSelectDropdown","updatePopper"),this.filterable&&(this.query=this.remote?"":this.selectedLabel,this.handleQueryChange(this.query),this.multiple?this.$refs.input.focus():(this.remote||(this.broadcast("ElOption","queryChange",""),this.broadcast("ElOptionGroup","queryChange")),this.selectedLabel&&(this.currentPlaceholder=this.selectedLabel,this.selectedLabel="")))):(this.broadcast("ElSelectDropdown","destroyPopper"),this.$refs.input&&this.$refs.input.blur(),this.query="",this.previousQuery=null,this.selectedLabel="",this.inputLength=20,this.menuVisibleOnFocus=!1,this.resetHoverIndex(),this.$nextTick(function(){e.$refs.input&&""===e.$refs.input.value&&0===e.selected.length&&(e.currentPlaceholder=e.cachedPlaceHolder)}),this.multiple||(this.selected&&(this.filterable&&this.allowCreate&&this.createdSelected&&this.createdLabel?this.selectedLabel=this.createdLabel:this.selectedLabel=this.selected.currentLabel,this.filterable&&(this.query=this.selectedLabel)),this.filterable&&(this.currentPlaceholder=this.cachedPlaceHolder))),this.$emit("visible-change",t)},options:function(){var t=this;if(!this.$isServer){this.$nextTick(function(){t.broadcast("ElSelectDropdown","updatePopper")}),this.multiple&&this.resetInputHeight();var e=this.$el.querySelectorAll("input");-1===[].indexOf.call(e,document.activeElement)&&this.setSelected(),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()}}},methods:{handleComposition:function(t){var e=this,n=t.target.value;if("compositionend"===t.type)this.isOnComposition=!1,this.$nextTick(function(t){return e.handleQueryChange(n)});else{var i=n[n.length-1]||"";this.isOnComposition=!Object(Wt.isKorean)(i)}},handleQueryChange:function(t){var e=this;this.previousQuery===t||this.isOnComposition||(null!==this.previousQuery||"function"!=typeof this.filterMethod&&"function"!=typeof this.remoteMethod?(this.previousQuery=t,this.$nextTick(function(){e.visible&&e.broadcast("ElSelectDropdown","updatePopper")}),this.hoverIndex=-1,this.multiple&&this.filterable&&this.$nextTick(function(){var t=15*e.$refs.input.value.length+20;e.inputLength=e.collapseTags?Math.min(50,t):t,e.managePlaceholder(),e.resetInputHeight()}),this.remote&&"function"==typeof this.remoteMethod?(this.hoverIndex=-1,this.remoteMethod(t)):"function"==typeof this.filterMethod?(this.filterMethod(t),this.broadcast("ElOptionGroup","queryChange")):(this.filteredOptionsCount=this.optionsCount,this.broadcast("ElOption","queryChange",t),this.broadcast("ElOptionGroup","queryChange")),this.defaultFirstOption&&(this.filterable||this.remote)&&this.filteredOptionsCount&&this.checkDefaultFirstOption()):this.previousQuery=t)},scrollToOption:function(t){var e=Array.isArray(t)&&t[0]?t[0].$el:t.$el;if(this.$refs.popper&&e){var n=this.$refs.popper.$el.querySelector(".el-select-dropdown__wrap");Fe()(n,e)}this.$refs.scrollbar&&this.$refs.scrollbar.handleScroll()},handleMenuEnter:function(){var t=this;this.$nextTick(function(){return t.scrollToOption(t.selected)})},emitChange:function(t){Object(g.valueEquals)(this.value,t)||this.$emit("change",t)},getOption:function(t){for(var e=void 0,n="[object object]"===Object.prototype.toString.call(t).toLowerCase(),i="[object null]"===Object.prototype.toString.call(t).toLowerCase(),r="[object undefined]"===Object.prototype.toString.call(t).toLowerCase(),o=this.cachedOptions.length-1;o>=0;o--){var s=this.cachedOptions[o];if(n?Object(g.getValueByPath)(s.value,this.valueKey)===Object(g.getValueByPath)(t,this.valueKey):s.value===t){e=s;break}}if(e)return e;var a={value:t,currentLabel:n||i||r?"":String(t)};return this.multiple&&(a.hitState=!1),a},setSelected:function(){var t=this;if(!this.multiple){var e=this.getOption(this.value);return e.created?(this.createdLabel=e.currentLabel,this.createdSelected=!0):this.createdSelected=!1,this.selectedLabel=e.currentLabel,this.selected=e,void(this.filterable&&(this.query=this.selectedLabel))}var n=[];Array.isArray(this.value)&&this.value.forEach(function(e){n.push(t.getOption(e))}),this.selected=n,this.$nextTick(function(){t.resetInputHeight()})},handleFocus:function(t){this.softFocus?this.softFocus=!1:((this.automaticDropdown||this.filterable)&&(this.visible=!0,this.filterable&&(this.menuVisibleOnFocus=!0)),this.$emit("focus",t))},blur:function(){this.visible=!1,this.$refs.reference.blur()},handleBlur:function(t){var e=this;setTimeout(function(){e.isSilentBlur?e.isSilentBlur=!1:e.$emit("blur",t)},50),this.softFocus=!1},handleClearClick:function(t){this.deleteSelected(t)},doDestroy:function(){this.$refs.popper&&this.$refs.popper.doDestroy()},handleClose:function(){this.visible=!1},toggleLastOptionHitState:function(t){if(Array.isArray(this.selected)){var e=this.selected[this.selected.length-1];if(e)return!0===t||!1===t?(e.hitState=t,t):(e.hitState=!e.hitState,e.hitState)}},deletePrevTag:function(t){if(t.target.value.length<=0&&!this.toggleLastOptionHitState()){var e=this.value.slice();e.pop(),this.$emit("input",e),this.emitChange(e)}},managePlaceholder:function(){""!==this.currentPlaceholder&&(this.currentPlaceholder=this.$refs.input.value?"":this.cachedPlaceHolder)},resetInputState:function(t){8!==t.keyCode&&this.toggleLastOptionHitState(!1),this.inputLength=15*this.$refs.input.value.length+20,this.resetInputHeight()},resetInputHeight:function(){var t=this;this.collapseTags&&!this.filterable||this.$nextTick(function(){if(t.$refs.reference){var e=t.$refs.reference.$el.childNodes,n=[].filter.call(e,function(t){return"INPUT"===t.tagName})[0],i=t.$refs.tags,r=t.initialInputHeight||40;n.style.height=0===t.selected.length?r+"px":Math.max(i?i.clientHeight+(i.clientHeight>r?6:0):0,r)+"px",t.visible&&!1!==t.emptyText&&t.broadcast("ElSelectDropdown","updatePopper")}})},resetHoverIndex:function(){var t=this;setTimeout(function(){t.multiple?t.selected.length>0?t.hoverIndex=Math.min.apply(null,t.selected.map(function(e){return t.options.indexOf(e)})):t.hoverIndex=-1:t.hoverIndex=t.options.indexOf(t.selected)},300)},handleOptionSelect:function(t,e){var n=this;if(this.multiple){var i=(this.value||[]).slice(),r=this.getValueIndex(i,t.value);r>-1?i.splice(r,1):(this.multipleLimit<=0||i.length<this.multipleLimit)&&i.push(t.value),this.$emit("input",i),this.emitChange(i),t.created&&(this.query="",this.handleQueryChange(""),this.inputLength=20),this.filterable&&this.$refs.input.focus()}else this.$emit("input",t.value),this.emitChange(t.value),this.visible=!1;this.isSilentBlur=e,this.setSoftFocus(),this.visible||this.$nextTick(function(){n.scrollToOption(t)})},setSoftFocus:function(){this.softFocus=!0;var t=this.$refs.input||this.$refs.reference;t&&t.focus()},getValueIndex:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if("[object object]"===Object.prototype.toString.call(e).toLowerCase()){var n=this.valueKey,i=-1;return t.some(function(t,r){return Object(g.getValueByPath)(t,n)===Object(g.getValueByPath)(e,n)&&(i=r,!0)}),i}return t.indexOf(e)},toggleMenu:function(){this.selectDisabled||(this.menuVisibleOnFocus?this.menuVisibleOnFocus=!1:this.visible=!this.visible,this.visible&&(this.$refs.input||this.$refs.reference).focus())},selectOption:function(){this.visible?this.options[this.hoverIndex]&&this.handleOptionSelect(this.options[this.hoverIndex]):this.toggleMenu()},deleteSelected:function(t){t.stopPropagation();var e=this.multiple?[]:"";this.$emit("input",e),this.emitChange(e),this.visible=!1,this.$emit("clear")},deleteTag:function(t,e){var n=this.selected.indexOf(e);if(n>-1&&!this.selectDisabled){var i=this.value.slice();i.splice(n,1),this.$emit("input",i),this.emitChange(i),this.$emit("remove-tag",e.value)}t.stopPropagation()},onInputChange:function(){this.filterable&&this.query!==this.selectedLabel&&(this.query=this.selectedLabel,this.handleQueryChange(this.query))},onOptionDestroy:function(t){t>-1&&(this.optionsCount--,this.filteredOptionsCount--,this.options.splice(t,1))},resetInputWidth:function(){this.inputWidth=this.$refs.reference.$el.getBoundingClientRect().width},handleResize:function(){this.resetInputWidth(),this.multiple&&this.resetInputHeight()},checkDefaultFirstOption:function(){this.hoverIndex=-1;for(var t=!1,e=this.options.length-1;e>=0;e--)if(this.options[e].created){t=!0,this.hoverIndex=e;break}if(!t)for(var n=0;n!==this.options.length;++n){var i=this.options[n];if(this.query){if(!i.disabled&&!i.groupDisabled&&i.visible){this.hoverIndex=n;break}}else if(i.itemSelected){this.hoverIndex=n;break}}},getValueKey:function(t){return"[object object]"!==Object.prototype.toString.call(t.value).toLowerCase()?t.value:Object(g.getValueByPath)(t.value,this.valueKey)}},created:function(){var t=this;this.cachedPlaceHolder=this.currentPlaceholder=this.propPlaceholder,this.multiple&&!Array.isArray(this.value)&&this.$emit("input",[]),!this.multiple&&Array.isArray(this.value)&&this.$emit("input",""),this.debouncedOnInputChange=O()(this.debounce,function(){t.onInputChange()}),this.debouncedQueryChange=O()(this.debounce,function(e){t.handleQueryChange(e.target.value)}),this.$on("handleOptionClick",this.handleOptionSelect),this.$on("setSelected",this.setSelected)},mounted:function(){var t=this;this.multiple&&Array.isArray(this.value)&&this.value.length>0&&(this.currentPlaceholder=""),Object(Pe.addResizeListener)(this.$el,this.handleResize);var e=this.$refs.reference;if(e&&e.$el){var n=e.$el.querySelector("input");this.initialInputHeight=n.getBoundingClientRect().height||{medium:36,small:32,mini:28}[this.selectSize]}this.remote&&this.multiple&&this.resetInputHeight(),this.$nextTick(function(){e&&e.$el&&(t.inputWidth=e.$el.getBoundingClientRect().width)}),this.setSelected()},beforeDestroy:function(){this.$el&&this.handleResize&&Object(Pe.removeResizeListener)(this.$el,this.handleResize)}},ke,[],!1,null,null,null);Ue.options.__file="packages/select/src/select.vue";var Ve=Ue.exports;Ve.install=function(t){t.component(Ve.name,Ve)};var He=Ve;Me.install=function(t){t.component(Me.name,Me)};var We=Me,Ge=function(){var t=this.$createElement,e=this._self._c||t;return e("ul",{directives:[{name:"show",rawName:"v-show",value:this.visible,expression:"visible"}],staticClass:"el-select-group__wrap"},[e("li",{staticClass:"el-select-group__title"},[this._v(this._s(this.label))]),e("li",[e("ul",{staticClass:"el-select-group"},[this._t("default")],2)])])};Ge._withStripped=!0;var je=r({mixins:[S.a],name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:{type:Boolean,default:!1}},data:function(){return{visible:!0}},watch:{disabled:function(t){this.broadcast("ElOption","handleGroupDisabled",t)}},methods:{queryChange:function(){this.visible=this.$children&&Array.isArray(this.$children)&&this.$children.some(function(t){return!0===t.visible})}},created:function(){this.$on("queryChange",this.queryChange)},mounted:function(){this.disabled&&this.broadcast("ElOption","handleGroupDisabled",this.disabled)}},Ge,[],!1,null,null,null);je.options.__file="packages/select/src/option-group.vue";var ze=je.exports;ze.install=function(t){t.component(ze.name,ze)};var $e=ze,Xe=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("button",{staticClass:"el-button",class:[t.type?"el-button--"+t.type:"",t.buttonSize?"el-button--"+t.buttonSize:"",{"is-disabled":t.buttonDisabled,"is-loading":t.loading,"is-plain":t.plain,"is-round":t.round,"is-circle":t.circle}],attrs:{disabled:t.buttonDisabled||t.loading,autofocus:t.autofocus,type:t.nativeType},on:{click:t.handleClick}},[t.loading?n("i",{staticClass:"el-icon-loading"}):t._e(),t.icon&&!t.loading?n("i",{class:t.icon}):t._e(),t.$slots.default?n("span",[t._t("default")],2):t._e()])};Xe._withStripped=!0;var Ye=r({name:"ElButton",inject:{elForm:{default:""},elFormItem:{default:""}},props:{type:{type:String,default:"default"},size:String,icon:{type:String,default:""},nativeType:{type:String,default:"button"},loading:Boolean,disabled:Boolean,plain:Boolean,autofocus:Boolean,round:Boolean,circle:Boolean},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},buttonSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},buttonDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},methods:{handleClick:function(t){this.$emit("click",t)}}},Xe,[],!1,null,null,null);Ye.options.__file="packages/button/src/button.vue";var Ke=Ye.exports;Ke.install=function(t){t.component(Ke.name,Ke)};var Je=Ke,qe=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-button-group"},[this._t("default")],2)};qe._withStripped=!0;var Ze=r({name:"ElButtonGroup"},qe,[],!1,null,null,null);Ze.options.__file="packages/button/src/button-group.vue";var Qe=Ze.exports;Qe.install=function(t){t.component(Qe.name,Qe)};var tn=Qe,en=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-table",class:[{"el-table--fit":t.fit,"el-table--striped":t.stripe,"el-table--border":t.border||t.isGroup,"el-table--hidden":t.isHidden,"el-table--group":t.isGroup,"el-table--fluid-height":t.maxHeight,"el-table--scrollable-x":t.layout.scrollX,"el-table--scrollable-y":t.layout.scrollY,"el-table--enable-row-hover":!t.store.states.isComplex,"el-table--enable-row-transition":0!==(t.store.states.data||[]).length&&(t.store.states.data||[]).length<100},t.tableSize?"el-table--"+t.tableSize:""],on:{mouseleave:function(e){t.handleMouseLeave(e)}}},[n("div",{ref:"hiddenColumns",staticClass:"hidden-columns"},[t._t("default")],2),t.showHeader?n("div",{directives:[{name:"mousewheel",rawName:"v-mousewheel",value:t.handleHeaderFooterMousewheel,expression:"handleHeaderFooterMousewheel"}],ref:"headerWrapper",staticClass:"el-table__header-wrapper"},[n("table-header",{ref:"tableHeader",style:{width:t.layout.bodyWidth?t.layout.bodyWidth+"px":""},attrs:{store:t.store,border:t.border,"default-sort":t.defaultSort}})],1):t._e(),n("div",{ref:"bodyWrapper",staticClass:"el-table__body-wrapper",class:[t.layout.scrollX?"is-scrolling-"+t.scrollPosition:"is-scrolling-none"],style:[t.bodyHeight]},[n("table-body",{style:{width:t.bodyWidth},attrs:{context:t.context,store:t.store,stripe:t.stripe,"row-class-name":t.rowClassName,"row-style":t.rowStyle,highlight:t.highlightCurrentRow}}),t.data&&0!==t.data.length?t._e():n("div",{ref:"emptyBlock",staticClass:"el-table__empty-block",style:t.emptyBlockStyle},[n("span",{staticClass:"el-table__empty-text"},[t._t("empty",[t._v(t._s(t.emptyText||t.t("el.table.emptyText")))])],2)]),t.$slots.append?n("div",{ref:"appendWrapper",staticClass:"el-table__append-wrapper"},[t._t("append")],2):t._e()],1),t.showSummary?n("div",{directives:[{name:"show",rawName:"v-show",value:t.data&&t.data.length>0,expression:"data && data.length > 0"},{name:"mousewheel",rawName:"v-mousewheel",value:t.handleHeaderFooterMousewheel,expression:"handleHeaderFooterMousewheel"}],ref:"footerWrapper",staticClass:"el-table__footer-wrapper"},[n("table-footer",{style:{width:t.layout.bodyWidth?t.layout.bodyWidth+"px":""},attrs:{store:t.store,border:t.border,"sum-text":t.sumText||t.t("el.table.sumText"),"summary-method":t.summaryMethod,"default-sort":t.defaultSort}})],1):t._e(),t.fixedColumns.length>0?n("div",{directives:[{name:"mousewheel",rawName:"v-mousewheel",value:t.handleFixedMousewheel,expression:"handleFixedMousewheel"}],ref:"fixedWrapper",staticClass:"el-table__fixed",style:[{width:t.layout.fixedWidth?t.layout.fixedWidth+"px":""},t.fixedHeight]},[t.showHeader?n("div",{ref:"fixedHeaderWrapper",staticClass:"el-table__fixed-header-wrapper"},[n("table-header",{ref:"fixedTableHeader",style:{width:t.bodyWidth},attrs:{fixed:"left",border:t.border,store:t.store}})],1):t._e(),n("div",{ref:"fixedBodyWrapper",staticClass:"el-table__fixed-body-wrapper",style:[{top:t.layout.headerHeight+"px"},t.fixedBodyHeight]},[n("table-body",{style:{width:t.bodyWidth},attrs:{fixed:"left",store:t.store,stripe:t.stripe,highlight:t.highlightCurrentRow,"row-class-name":t.rowClassName,"row-style":t.rowStyle}}),t.$slots.append?n("div",{staticClass:"el-table__append-gutter",style:{height:t.layout.appendHeight+"px"}}):t._e()],1),t.showSummary?n("div",{directives:[{name:"show",rawName:"v-show",value:t.data&&t.data.length>0,expression:"data && data.length > 0"}],ref:"fixedFooterWrapper",staticClass:"el-table__fixed-footer-wrapper"},[n("table-footer",{style:{width:t.bodyWidth},attrs:{fixed:"left",border:t.border,"sum-text":t.sumText||t.t("el.table.sumText"),"summary-method":t.summaryMethod,store:t.store}})],1):t._e()]):t._e(),t.rightFixedColumns.length>0?n("div",{directives:[{name:"mousewheel",rawName:"v-mousewheel",value:t.handleFixedMousewheel,expression:"handleFixedMousewheel"}],ref:"rightFixedWrapper",staticClass:"el-table__fixed-right",style:[{width:t.layout.rightFixedWidth?t.layout.rightFixedWidth+"px":"",right:t.layout.scrollY?(t.border?t.layout.gutterWidth:t.layout.gutterWidth||0)+"px":""},t.fixedHeight]},[t.showHeader?n("div",{ref:"rightFixedHeaderWrapper",staticClass:"el-table__fixed-header-wrapper"},[n("table-header",{ref:"rightFixedTableHeader",style:{width:t.bodyWidth},attrs:{fixed:"right",border:t.border,store:t.store}})],1):t._e(),n("div",{ref:"rightFixedBodyWrapper",staticClass:"el-table__fixed-body-wrapper",style:[{top:t.layout.headerHeight+"px"},t.fixedBodyHeight]},[n("table-body",{style:{width:t.bodyWidth},attrs:{fixed:"right",store:t.store,stripe:t.stripe,"row-class-name":t.rowClassName,"row-style":t.rowStyle,highlight:t.highlightCurrentRow}}),t.$slots.append?n("div",{staticClass:"el-table__append-gutter",style:{height:t.layout.appendHeight+"px"}}):t._e()],1),t.showSummary?n("div",{directives:[{name:"show",rawName:"v-show",value:t.data&&t.data.length>0,expression:"data && data.length > 0"}],ref:"rightFixedFooterWrapper",staticClass:"el-table__fixed-footer-wrapper"},[n("table-footer",{style:{width:t.bodyWidth},attrs:{fixed:"right",border:t.border,"sum-text":t.sumText||t.t("el.table.sumText"),"summary-method":t.summaryMethod,store:t.store}})],1):t._e()]):t._e(),t.rightFixedColumns.length>0?n("div",{ref:"rightFixedPatch",staticClass:"el-table__fixed-right-patch",style:{width:t.layout.scrollY?t.layout.gutterWidth+"px":"0",height:t.layout.headerHeight+"px"}}):t._e(),n("div",{directives:[{name:"show",rawName:"v-show",value:t.resizeProxyVisible,expression:"resizeProxyVisible"}],ref:"resizeProxy",staticClass:"el-table__column-resize-proxy"})])};en._withStripped=!0;var nn=n(16),rn=n.n(nn),on=n(35),sn=n(38),an=n.n(sn),ln="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1,un={bind:function(t,e){var n,i;n=t,i=e.value,n&&n.addEventListener&&n.addEventListener(ln?"DOMMouseScroll":"mousewheel",function(t){var e=an()(t);i&&i.apply(this,[t,e])})}},cn=n(6),hn=n.n(cn),pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dn=function(t){for(var e=t.target;e&&"HTML"!==e.tagName.toUpperCase();){if("TD"===e.tagName.toUpperCase())return e;e=e.parentNode}return null},fn=function(t){return null!==t&&"object"===(void 0===t?"undefined":pn(t))},gn=function(t,e,n,i,r){if(!e&&!i&&(!r||Array.isArray(r)&&!r.length))return t;n="string"==typeof n?"descending"===n?-1:1:n&&n<0?-1:1;var o=i?null:function(n,i){return r?(Array.isArray(r)||(r=[r]),r.map(function(e){return"string"==typeof e?Object(g.getValueByPath)(n,e):e(n,i,t)})):("$key"!==e&&fn(n)&&"$value"in n&&(n=n.$value),[fn(n)?Object(g.getValueByPath)(n,e):n])};return t.map(function(t,e){return{value:t,index:e,key:o?o(t,e):null}}).sort(function(t,e){var r=function(t,e){if(i)return i(t.value,e.value);for(var n=0,r=t.key.length;n<r;n++){if(t.key[n]<e.key[n])return-1;if(t.key[n]>e.key[n])return 1}return 0}(t,e);return r||(r=t.index-e.index),r*n}).map(function(t){return t.value})},mn=function(t,e){var n=null;return t.columns.forEach(function(t){t.id===e&&(n=t)}),n},vn=function(t,e){var n=(e.className||"").match(/el-table_[^\s]+/gm);return n?mn(t,n[0]):null},_n=function(t,e){if(!t)throw new Error("row is required when get row identity");if("string"==typeof e){if(e.indexOf(".")<0)return t[e];for(var n=e.split("."),i=t,r=0;r<n.length;r++)i=i[n[r]];return i}if("function"==typeof e)return e.call(null,t)},yn=function(t,e){var n={};return(t||[]).forEach(function(t,i){n[_n(t,e)]={row:t,index:i}}),n};function bn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Tn(t){return void 0!==t&&(t=parseInt(t,10),isNaN(t)&&(t=null)),t}function En(t){return"number"==typeof t?t:"string"==typeof t?/^\d+(?:px)?$/.test(t)?parseInt(t,10):t:null}function Cn(t,e,n){var i=!1,r=t.indexOf(e),o=-1!==r,s=function(){t.push(e),i=!0},a=function(){t.splice(r,1),i=!0};return"boolean"==typeof n?n&&!o?s():!n&&o&&a():o?a():s(),i}function Sn(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"children",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"hasChildren",r=function(t){return!(Array.isArray(t)&&t.length)};t.forEach(function(t){if(t[i])e(t,null,0);else{var o=t[n];r(o)||function t(o,s,a){e(o,s,a),s.forEach(function(o){if(o[i])e(o,null,a+1);else{var s=o[n];r(s)||t(o,s,a+1)}})}(t,o,0)}})}var wn={data:function(){return{states:{defaultExpandAll:!1,expandRows:[]}}},methods:{updateExpandRows:function(){var t=this.states,e=t.data,n=void 0===e?[]:e,i=t.rowKey,r=t.defaultExpandAll,o=t.expandRows;if(r)this.states.expandRows=n.slice();else if(i){var s=yn(o,i);this.states.expandRows=n.reduce(function(t,e){var n=_n(e,i);return s[n]&&t.push(e),t},[])}else this.states.expandRows=[]},toggleRowExpansion:function(t,e){Cn(this.states.expandRows,t,e)&&(this.table.$emit("expand-change",t,this.states.expandRows.slice()),this.scheduleLayout())},setExpandRowKeys:function(t){this.assertRowKey();var e=this.states,n=e.data,i=e.rowKey,r=yn(n,i);this.states.expandRows=t.reduce(function(t,e){var n=r[e];return n&&t.push(n.row),t},[])},isRowExpanded:function(t){var e=this.states,n=e.expandRows,i=void 0===n?[]:n,r=e.rowKey;return r?!!yn(i,r)[_n(t,r)]:-1!==i.indexOf(t)}}},kn={data:function(){return{states:{_currentRowKey:null,currentRow:null}}},methods:{setCurrentRowKey:function(t){this.assertRowKey(),this.states._currentRowKey=t,this.setCurrentRowByKey(t)},restoreCurrentRowKey:function(){this.states._currentRowKey=null},setCurrentRowByKey:function(t){var e=this.states,n=e.data,i=void 0===n?[]:n,r=e.rowKey,o=null;r&&(o=Object(g.arrayFind)(i,function(e){return _n(e,r)===t})),e.currentRow=o},updateCurrentRow:function(t){var e=this.states,n=this.table,i=e.currentRow;if(t&&t!==i)return e.currentRow=t,void n.$emit("current-change",t,i);!t&&i&&(e.currentRow=null,n.$emit("current-change",null,i))},updateCurrentRowData:function(){var t=this.states,e=this.table,n=t.rowKey,i=t._currentRowKey,r=t.data||[],o=t.currentRow;if(-1===r.indexOf(o)&&o){if(n){var s=_n(o,n);this.setCurrentRowByKey(s)}else t.currentRow=null;null===t.currentRow&&e.$emit("current-change",null,o)}else i&&(this.setCurrentRowByKey(i),this.restoreCurrentRowKey())}}},xn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},In={data:function(){return{states:{expandRowKeys:[],treeData:{},indent:16,lazy:!1,lazyTreeNodeMap:{},lazyColumnIdentifier:"hasChildren",childrenColumnName:"children"}}},computed:{normalizedData:function(){if(!this.states.rowKey)return{};var t=this.states.data||[];return this.normalize(t)},normalizedLazyNode:function(){var t=this.states,e=t.rowKey,n=t.lazyTreeNodeMap,i=t.lazyColumnIdentifier,r=Object.keys(n),o={};return r.length?(r.forEach(function(t){if(n[t].length){var r={children:[]};n[t].forEach(function(t){var n=_n(t,e);r.children.push(n),t[i]&&!o[n]&&(o[n]={children:[]})}),o[t]=r}}),o):o}},watch:{normalizedData:"updateTreeData",normalizedLazyNode:"updateTreeData"},methods:{normalize:function(t){var e=this.states,n=e.childrenColumnName,i=e.lazyColumnIdentifier,r=e.rowKey,o=e.lazy,s={};return Sn(t,function(t,e,n){var i=_n(t,r);Array.isArray(e)?s[i]={children:e.map(function(t){return _n(t,r)}),level:n}:o&&(s[i]={children:[],lazy:!0,level:n})},n,i),s},updateTreeData:function(){var t=this.normalizedData,e=this.normalizedLazyNode,n=Object.keys(t),i={};if(n.length){var r=this.states,o=r.treeData,s=r.defaultExpandAll,a=r.expandRowKeys,l=r.lazy,u=[],c=function(t,e){var n=s||a&&-1!==a.indexOf(e);return!!(t&&t.expanded||n)};n.forEach(function(e){var n=o[e],r=xn({},t[e]);if(r.expanded=c(n,e),r.lazy){var s=n||{},a=s.loaded,l=void 0!==a&&a,h=s.loading,p=void 0!==h&&h;r.loaded=!!l,r.loading=!!p,u.push(e)}i[e]=r});var h=Object.keys(e);l&&h.length&&u.length&&h.forEach(function(t){var n=o[t],r=e[t].children;if(-1!==u.indexOf(t)){if(0!==i[t].children.length)throw new Error("[ElTable]children must be an empty array.");i[t].children=r}else{var s=n||{},a=s.loaded,l=void 0!==a&&a,h=s.loading,p=void 0!==h&&h;i[t]={lazy:!0,loaded:!!l,loading:!!p,expanded:c(n,t),children:r,level:""}}})}this.states.treeData=i,this.updateTableScrollY()},updateTreeExpandKeys:function(t){this.states.expandRowKeys=t,this.updateTreeData()},toggleTreeExpansion:function(t,e){this.assertRowKey();var n=this.states,i=n.rowKey,r=n.treeData,o=_n(t,i),s=o&&r[o];if(o&&s&&"expanded"in s){var a=s.expanded;e=void 0===e?!s.expanded:e,r[o].expanded=e,a!==e&&this.table.$emit("expand-change",t,e),this.updateTableScrollY()}},loadOrToggle:function(t){this.assertRowKey();var e=this.states,n=e.lazy,i=e.treeData,r=e.rowKey,o=_n(t,r),s=i[o];n&&s&&"loaded"in s&&!s.loaded?this.loadData(t,o,s):this.toggleTreeExpansion(t)},loadData:function(t,e,n){var i=this,r=this.table.load,o=this.states.treeData;r&&!o[e].loaded&&(o[e].loading=!0,r(t,n,function(n){if(!Array.isArray(n))throw new Error("[ElTable] data must be an array");var r=i.states,o=r.lazyTreeNodeMap,s=r.treeData;s[e].loading=!1,s[e].loaded=!0,s[e].expanded=!0,n.length&&i.$set(o,e,n),i.table.$emit("expand-change",t,!0)}))}}},Rn=function t(e){var n=[];return e.forEach(function(e){e.children?n.push.apply(n,t(e.children)):n.push(e)}),n},On=hn.a.extend({data:function(){return{states:{rowKey:null,data:[],isComplex:!1,_columns:[],originColumns:[],columns:[],fixedColumns:[],rightFixedColumns:[],leafColumns:[],fixedLeafColumns:[],rightFixedLeafColumns:[],leafColumnsLength:0,fixedLeafColumnsLength:0,rightFixedLeafColumnsLength:0,isAllSelected:!1,selection:[],reserveSelection:!1,selectOnIndeterminate:!1,selectable:null,filters:{},filteredData:null,sortingColumn:null,sortProp:null,sortOrder:null,hoverRow:null}}},mixins:[wn,kn,In],methods:{assertRowKey:function(){if(!this.states.rowKey)throw new Error("[ElTable] prop row-key is required")},updateColumns:function(){var t=this.states,e=t._columns||[];t.fixedColumns=e.filter(function(t){return!0===t.fixed||"left"===t.fixed}),t.rightFixedColumns=e.filter(function(t){return"right"===t.fixed}),t.fixedColumns.length>0&&e[0]&&"selection"===e[0].type&&!e[0].fixed&&(e[0].fixed=!0,t.fixedColumns.unshift(e[0]));var n=e.filter(function(t){return!t.fixed});t.originColumns=[].concat(t.fixedColumns).concat(n).concat(t.rightFixedColumns);var i=Rn(n),r=Rn(t.fixedColumns),o=Rn(t.rightFixedColumns);t.leafColumnsLength=i.length,t.fixedLeafColumnsLength=r.length,t.rightFixedLeafColumnsLength=o.length,t.columns=[].concat(r).concat(i).concat(o),t.isComplex=t.fixedColumns.length>0||t.rightFixedColumns.length>0},scheduleLayout:function(t){t&&this.updateColumns(),this.table.debouncedUpdateLayout()},isSelected:function(t){var e=this.states.selection;return(void 0===e?[]:e).indexOf(t)>-1},clearSelection:function(){var t=this.states;t.isAllSelected=!1,t.selection.length&&(t.selection=[],this.table.$emit("selection-change",[]))},cleanSelection:function(){var t=this.states,e=t.data,n=t.rowKey,i=t.selection,r=void 0;if(n){r=[];var o=yn(i,n),s=yn(e,n);for(var a in o)o.hasOwnProperty(a)&&!s[a]&&r.push(o[a].row)}else r=i.filter(function(t){return-1===e.indexOf(t)});if(r.length){var l=i.filter(function(t){return-1===r.indexOf(t)});t.selection=l,this.table.$emit("selection-change",l.slice())}},toggleRowSelection:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(Cn(this.states.selection,t,e)){var i=(this.states.selection||[]).slice();n&&this.table.$emit("select",i,t),this.table.$emit("selection-change",i)}},_toggleAllSelection:function(){var t=this.states,e=t.data,n=void 0===e?[]:e,i=t.selection,r=t.selectOnIndeterminate?!t.isAllSelected:!(t.isAllSelected||i.length);t.isAllSelected=r;var o=!1;n.forEach(function(e,n){t.selectable?t.selectable.call(null,e,n)&&Cn(i,e,r)&&(o=!0):Cn(i,e,r)&&(o=!0)}),o&&this.table.$emit("selection-change",i?i.slice():[]),this.table.$emit("select-all",i)},updateSelectionByRowKey:function(){var t=this.states,e=t.selection,n=t.rowKey,i=t.data,r=yn(e,n);i.forEach(function(t){var i=_n(t,n),o=r[i];o&&(e[o.index]=t)})},updateAllSelected:function(){var t=this.states,e=t.selection,n=t.rowKey,i=t.selectable,r=t.data||[];if(0!==r.length){var o=void 0;n&&(o=yn(e,n));for(var s,a=!0,l=0,u=0,c=r.length;u<c;u++){var h=r[u],p=i&&i.call(null,h,u);if(s=h,o?o[_n(s,n)]:-1!==e.indexOf(s))l++;else if(!i||p){a=!1;break}}0===l&&(a=!1),t.isAllSelected=a}else t.isAllSelected=!1},updateFilters:function(t,e){Array.isArray(t)||(t=[t]);var n=this.states,i={};return t.forEach(function(t){n.filters[t.id]=e,i[t.columnKey||t.id]=e}),i},updateSort:function(t,e,n){this.states.sortingColumn&&this.states.sortingColumn!==t&&(this.states.sortingColumn.order=null),this.states.sortingColumn=t,this.states.sortProp=e,this.states.sortOrder=n},execFilter:function(){var t=this,e=this.states,n=e._data,i=e.filters,r=n;Object.keys(i).forEach(function(n){var i=e.filters[n];if(i&&0!==i.length){var o=mn(t.states,n);o&&o.filterMethod&&(r=r.filter(function(t){return i.some(function(e){return o.filterMethod.call(null,e,t,o)})}))}}),e.filteredData=r},execSort:function(){var t=this.states;t.data=function(t,e){var n=e.sortingColumn;return n&&"string"!=typeof n.sortable?gn(t,e.sortProp,e.sortOrder,n.sortMethod,n.sortBy):t}(t.filteredData,t)},execQuery:function(t){t&&t.filter||this.execFilter(),this.execSort()},clearFilter:function(t){var e=this.states,n=this.table.$refs,i=n.tableHeader,r=n.fixedTableHeader,o=n.rightFixedTableHeader,s={};i&&(s=Ht()(s,i.filterPanels)),r&&(s=Ht()(s,r.filterPanels)),o&&(s=Ht()(s,o.filterPanels));var a=Object.keys(s);if(a.length)if("string"==typeof t&&(t=[t]),Array.isArray(t)){var l=t.map(function(t){return function(t,e){for(var n=null,i=0;i<t.columns.length;i++){var r=t.columns[i];if(r.columnKey===e){n=r;break}}return n}(e,t)});a.forEach(function(t){l.find(function(e){return e.id===t})&&(s[t].filteredValue=[])}),this.commit("filterChange",{column:l,values:[],silent:!0,multi:!0})}else a.forEach(function(t){s[t].filteredValue=[]}),e.filters={},this.commit("filterChange",{column:{},values:[],silent:!0})},clearSort:function(){this.states.sortingColumn&&(this.updateSort(null,null,null),this.commit("changeSortCondition",{silent:!0}))},setExpandRowKeysAdapter:function(t){this.setExpandRowKeys(t),this.updateTreeExpandKeys(t)},toggleRowExpansionAdapter:function(t,e){this.states.columns.some(function(t){return"expand"===t.type})?this.toggleRowExpansion(t,e):this.toggleTreeExpansion(t,e)}}});On.prototype.mutations={setData:function(t,e){var n=t._data!==e;t._data=e,this.execQuery(),this.updateCurrentRowData(),this.updateExpandRows(),t.reserveSelection?(this.assertRowKey(),this.updateSelectionByRowKey()):n?this.clearSelection():this.cleanSelection(),this.updateAllSelected(),this.updateTableScrollY()},insertColumn:function(t,e,n,i){var r=t._columns;i&&((r=i.children)||(r=i.children=[])),void 0!==n?r.splice(n,0,e):r.push(e),"selection"===e.type&&(t.selectable=e.selectable,t.reserveSelection=e.reserveSelection),this.table.$ready&&(this.updateColumns(),this.scheduleLayout())},removeColumn:function(t,e,n){var i=t._columns;n&&((i=n.children)||(i=n.children=[])),i&&i.splice(i.indexOf(e),1),this.table.$ready&&(this.updateColumns(),this.scheduleLayout())},sort:function(t,e){var n=e.prop,i=e.order,r=e.init;if(n){var o=Object(g.arrayFind)(t.columns,function(t){return t.property===n});o&&(o.order=i,this.updateSort(o,n,i),this.commit("changeSortCondition",{init:r}))}},changeSortCondition:function(t,e){var n=t.sortingColumn,i=t.sortProp,r=t.sortOrder;null===r&&(t.sortingColumn=null,t.sortProp=null);this.execQuery({filter:!0}),e&&(e.silent||e.init)||this.table.$emit("sort-change",{column:n,prop:i,order:r}),this.updateTableScrollY()},filterChange:function(t,e){var n=e.column,i=e.values,r=e.silent,o=this.updateFilters(n,i);this.execQuery(),r||this.table.$emit("filter-change",o),this.updateTableScrollY()},toggleAllSelection:function(){this.toggleAllSelection()},rowSelectedChanged:function(t,e){this.toggleRowSelection(e),this.updateAllSelected()},setHoverRow:function(t,e){t.hoverRow=e},setCurrentRow:function(t,e){this.updateCurrentRow(e)}},On.prototype.commit=function(t){var e=this.mutations;if(!e[t])throw new Error("Action not found: "+t);for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];e[t].apply(this,[this.states].concat(i))},On.prototype.updateTableScrollY=function(){hn.a.nextTick(this.table.updateScrollY)};var Dn=On;function An(t){var e={};return Object.keys(t).forEach(function(n){var i=t[n],r=void 0;"string"==typeof i?r=function(){return this.store.states[i]}:"function"==typeof i?r=function(){return i.call(this,this.store.states)}:console.error("invalid value type"),r&&(e[n]=r)}),e}var Mn=n(30),Nn=n.n(Mn);var Ln=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.observers=[],this.table=null,this.store=null,this.columns=null,this.fit=!0,this.showHeader=!0,this.height=null,this.scrollX=!1,this.scrollY=!1,this.bodyWidth=null,this.fixedWidth=null,this.rightFixedWidth=null,this.tableHeight=null,this.headerHeight=44,this.appendHeight=0,this.footerHeight=44,this.viewportHeight=null,this.bodyHeight=null,this.fixedBodyHeight=null,this.gutterWidth=Nn()(),e)e.hasOwnProperty(n)&&(this[n]=e[n]);if(!this.table)throw new Error("table is required for Table Layout");if(!this.store)throw new Error("store is required for Table Layout")}return t.prototype.updateScrollY=function(){if(null===this.height)return!1;var t=this.table.bodyWrapper;if(this.table.$el&&t){var e=t.querySelector(".el-table__body"),n=this.scrollY,i=e.offsetHeight>this.bodyHeight;return this.scrollY=i,n!==i}return!1},t.prototype.setHeight=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"height";if(!hn.a.prototype.$isServer){var i=this.table.$el;if(t=En(t),this.height=t,!i&&(t||0===t))return hn.a.nextTick(function(){return e.setHeight(t,n)});"number"==typeof t?(i.style[n]=t+"px",this.updateElsHeight()):"string"==typeof t&&(i.style[n]=t,this.updateElsHeight())}},t.prototype.setMaxHeight=function(t){this.setHeight(t,"max-height")},t.prototype.getFlattenColumns=function(){var t=[];return this.table.columns.forEach(function(e){e.isColumnGroup?t.push.apply(t,e.columns):t.push(e)}),t},t.prototype.updateElsHeight=function(){var t=this;if(!this.table.$ready)return hn.a.nextTick(function(){return t.updateElsHeight()});var e=this.table.$refs,n=e.headerWrapper,i=e.appendWrapper,r=e.footerWrapper;if(this.appendHeight=i?i.offsetHeight:0,!this.showHeader||n){var o=n?n.querySelector(".el-table__header tr"):null,s=this.headerDisplayNone(o),a=this.headerHeight=this.showHeader?n.offsetHeight:0;if(this.showHeader&&!s&&n.offsetWidth>0&&(this.table.columns||[]).length>0&&a<2)return hn.a.nextTick(function(){return t.updateElsHeight()});var l=this.tableHeight=this.table.$el.clientHeight,u=this.footerHeight=r?r.offsetHeight:0;null!==this.height&&(this.bodyHeight=l-a-u+(r?1:0)),this.fixedBodyHeight=this.scrollX?this.bodyHeight-this.gutterWidth:this.bodyHeight;var c=!(this.store.states.data&&this.store.states.data.length);this.viewportHeight=this.scrollX?l-(c?0:this.gutterWidth):l,this.updateScrollY(),this.notifyObservers("scrollable")}},t.prototype.headerDisplayNone=function(t){if(!t)return!0;for(var e=t;"DIV"!==e.tagName;){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1},t.prototype.updateColumnsWidth=function(){if(!hn.a.prototype.$isServer){var t=this.fit,e=this.table.$el.clientWidth,n=0,i=this.getFlattenColumns(),r=i.filter(function(t){return"number"!=typeof t.width});if(i.forEach(function(t){"number"==typeof t.width&&t.realWidth&&(t.realWidth=null)}),r.length>0&&t){i.forEach(function(t){n+=t.width||t.minWidth||80});var o=this.scrollY?this.gutterWidth:0;if(n<=e-o){this.scrollX=!1;var s=e-o-n;if(1===r.length)r[0].realWidth=(r[0].minWidth||80)+s;else{var a=s/r.reduce(function(t,e){return t+(e.minWidth||80)},0),l=0;r.forEach(function(t,e){if(0!==e){var n=Math.floor((t.minWidth||80)*a);l+=n,t.realWidth=(t.minWidth||80)+n}}),r[0].realWidth=(r[0].minWidth||80)+s-l}}else this.scrollX=!0,r.forEach(function(t){t.realWidth=t.minWidth});this.bodyWidth=Math.max(n,e),this.table.resizeState.width=this.bodyWidth}else i.forEach(function(t){t.width||t.minWidth?t.realWidth=t.width||t.minWidth:t.realWidth=80,n+=t.realWidth}),this.scrollX=n>e,this.bodyWidth=n;var u=this.store.states.fixedColumns;if(u.length>0){var c=0;u.forEach(function(t){c+=t.realWidth||t.width}),this.fixedWidth=c}var h=this.store.states.rightFixedColumns;if(h.length>0){var p=0;h.forEach(function(t){p+=t.realWidth||t.width}),this.rightFixedWidth=p}this.notifyObservers("columns")}},t.prototype.addObserver=function(t){this.observers.push(t)},t.prototype.removeObserver=function(t){var e=this.observers.indexOf(t);-1!==e&&this.observers.splice(e,1)},t.prototype.notifyObservers=function(t){var e=this;this.observers.forEach(function(n){switch(t){case"columns":n.onColumnsChange(e);break;case"scrollable":n.onScrollableChange(e);break;default:throw new Error("Table Layout don't have event "+t+".")}})},t}(),Pn={created:function(){this.tableLayout.addObserver(this)},destroyed:function(){this.tableLayout.removeObserver(this)},computed:{tableLayout:function(){var t=this.layout;if(!t&&this.table&&(t=this.table.layout),!t)throw new Error("Can not find table layout.");return t}},mounted:function(){this.onColumnsChange(this.tableLayout),this.onScrollableChange(this.tableLayout)},updated:function(){this.__updated__||(this.onColumnsChange(this.tableLayout),this.onScrollableChange(this.tableLayout),this.__updated__=!0)},methods:{onColumnsChange:function(t){var e=this.$el.querySelectorAll("colgroup > col");if(e.length){var n={};t.getFlattenColumns().forEach(function(t){n[t.id]=t});for(var i=0,r=e.length;i<r;i++){var o=e[i],s=o.getAttribute("name"),a=n[s];a&&o.setAttribute("width",a.realWidth||a.width)}}},onScrollableChange:function(t){for(var e=this.$el.querySelectorAll("colgroup > col[name=gutter]"),n=0,i=e.length;n<i;n++){e[n].setAttribute("width",t.scrollY?t.gutterWidth:"0")}for(var r=this.$el.querySelectorAll("th.gutter"),o=0,s=r.length;o<s;o++){var a=r[o];a.style.width=t.scrollY?t.gutterWidth+"px":"0",a.style.display=t.scrollY?"":"none"}}}},Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Un={name:"ElTableBody",mixins:[Pn],components:{ElCheckbox:rn.a,ElTooltip:xt.a},props:{store:{required:!0},stripe:Boolean,context:{},rowClassName:[String,Function],rowStyle:[Object,Function],fixed:String,highlight:Boolean},render:function(t){var e=this,n=this.data||[];return t("table",{class:"el-table__body",attrs:{cellspacing:"0",cellpadding:"0",border:"0"}},[t("colgroup",[this.columns.map(function(e){return t("col",{attrs:{name:e.id},key:e.id})})]),t("tbody",[n.reduce(function(t,n){return t.concat(e.wrappedRowRender(n,t.length))},[]),t("el-tooltip",{attrs:{effect:this.table.tooltipEffect,placement:"top",content:this.tooltipContent},ref:"tooltip"})])])},computed:Fn({table:function(){return this.$parent}},An({data:"data",columns:"columns",treeIndent:"indent",leftFixedLeafCount:"fixedLeafColumnsLength",rightFixedLeafCount:"rightFixedLeafColumnsLength",columnsCount:function(t){return t.columns.length},leftFixedCount:function(t){return t.fixedColumns.length},rightFixedCount:function(t){return t.rightFixedColumns.length},hasExpandColumn:function(t){return t.columns.some(function(t){return"expand"===t.type})}}),{firstDefaultColumnIndex:function(){return Object(g.arrayFindIndex)(this.columns,function(t){return"default"===t.type})}}),watch:{"store.states.hoverRow":function(t,e){var n=this;if(this.store.states.isComplex&&!this.$isServer){var i=window.requestAnimationFrame;i||(i=function(t){return setTimeout(t,16)}),i(function(){var i=n.$el.querySelectorAll(".el-table__row"),r=i[e],o=i[t];r&&Object(ft.removeClass)(r,"hover-row"),o&&Object(ft.addClass)(o,"hover-row")})}}},data:function(){return{tooltipContent:""}},created:function(){this.activateTooltip=O()(50,function(t){return t.handleShowPopper()})},methods:{getKeyOfRow:function(t,e){var n=this.table.rowKey;return n?_n(t,n):e},isColumnHidden:function(t){return!0===this.fixed||"left"===this.fixed?t>=this.leftFixedLeafCount:"right"===this.fixed?t<this.columnsCount-this.rightFixedLeafCount:t<this.leftFixedLeafCount||t>=this.columnsCount-this.rightFixedLeafCount},getSpan:function(t,e,n,i){var r=1,o=1,s=this.table.spanMethod;if("function"==typeof s){var a=s({row:t,column:e,rowIndex:n,columnIndex:i});Array.isArray(a)?(r=a[0],o=a[1]):"object"===(void 0===a?"undefined":Bn(a))&&(r=a.rowspan,o=a.colspan)}return{rowspan:r,colspan:o}},getRowStyle:function(t,e){var n=this.table.rowStyle;return"function"==typeof n?n.call(null,{row:t,rowIndex:e}):n||null},getRowClass:function(t,e){var n=["el-table__row"];this.table.highlightCurrentRow&&t===this.store.states.currentRow&&n.push("current-row"),this.stripe&&e%2==1&&n.push("el-table__row--striped");var i=this.table.rowClassName;return"string"==typeof i?n.push(i):"function"==typeof i&&n.push(i.call(null,{row:t,rowIndex:e})),this.store.states.expandRows.indexOf(t)>-1&&n.push("expanded"),n},getCellStyle:function(t,e,n,i){var r=this.table.cellStyle;return"function"==typeof r?r.call(null,{rowIndex:t,columnIndex:e,row:n,column:i}):r},getCellClass:function(t,e,n,i){var r=[i.id,i.align,i.className];this.isColumnHidden(e)&&r.push("is-hidden");var o=this.table.cellClassName;return"string"==typeof o?r.push(o):"function"==typeof o&&r.push(o.call(null,{rowIndex:t,columnIndex:e,row:n,column:i})),r.join(" ")},getColspanRealWidth:function(t,e,n){return e<1?t[n].realWidth:t.map(function(t){return t.realWidth}).slice(n,n+e).reduce(function(t,e){return t+e},-1)},handleCellMouseEnter:function(t,e){var n=this.table,i=dn(t);if(i){var r=vn(n,i),o=n.hoverState={cell:i,column:r,row:e};n.$emit("cell-mouse-enter",o.row,o.column,o.cell,t)}var s=t.target.querySelector(".cell");if(Object(ft.hasClass)(s,"el-tooltip")&&s.childNodes.length){var a=document.createRange();if(a.setStart(s,0),a.setEnd(s,s.childNodes.length),(a.getBoundingClientRect().width+((parseInt(Object(ft.getStyle)(s,"paddingLeft"),10)||0)+(parseInt(Object(ft.getStyle)(s,"paddingRight"),10)||0))>s.offsetWidth||s.scrollWidth>s.offsetWidth)&&this.$refs.tooltip){var l=this.$refs.tooltip;this.tooltipContent=i.innerText||i.textContent,l.referenceElm=i,l.$refs.popper&&(l.$refs.popper.style.display="none"),l.doDestroy(),l.setExpectedState(!0),this.activateTooltip(l)}}},handleCellMouseLeave:function(t){var e=this.$refs.tooltip;if(e&&(e.setExpectedState(!1),e.handleClosePopper()),dn(t)){var n=this.table.hoverState||{};this.table.$emit("cell-mouse-leave",n.row,n.column,n.cell,t)}},handleMouseEnter:O()(30,function(t){this.store.commit("setHoverRow",t)}),handleMouseLeave:O()(30,function(){this.store.commit("setHoverRow",null)}),handleContextMenu:function(t,e){this.handleEvent(t,e,"contextmenu")},handleDoubleClick:function(t,e){this.handleEvent(t,e,"dblclick")},handleClick:function(t,e){this.store.commit("setCurrentRow",e),this.handleEvent(t,e,"click")},handleEvent:function(t,e,n){var i=this.table,r=dn(t),o=void 0;r&&(o=vn(i,r))&&i.$emit("cell-"+n,e,o,r,t),i.$emit("row-"+n,e,o,t)},rowRender:function(t,e,n){var i=this,r=this.$createElement,o=this.treeIndent,s=this.columns,a=this.firstDefaultColumnIndex,l=s.map(function(t,e){return i.isColumnHidden(e)}),u=this.getRowClass(t,e),c=!0;return n&&(u.push("el-table__row--level-"+n.level),c=n.display),r("tr",{style:[c?null:{display:"none"},this.getRowStyle(t,e)],class:u,key:this.getKeyOfRow(t,e),on:{dblclick:function(e){return i.handleDoubleClick(e,t)},click:function(e){return i.handleClick(e,t)},contextmenu:function(e){return i.handleContextMenu(e,t)},mouseenter:function(t){return i.handleMouseEnter(e)},mouseleave:this.handleMouseLeave}},[s.map(function(u,c){var h=i.getSpan(t,u,e,c),p=h.rowspan,d=h.colspan;if(!p||!d)return null;var f=Fn({},u);f.realWidth=i.getColspanRealWidth(s,d,c);var g={store:i.store,_self:i.context||i.table.$vnode.context,column:f,row:t,$index:e};return c===a&&n&&(g.treeNode={indent:n.level*o,level:n.level},"boolean"==typeof n.expanded&&(g.treeNode.expanded=n.expanded,"loading"in n&&(g.treeNode.loading=n.loading),"noLazyChildren"in n&&(g.treeNode.noLazyChildren=n.noLazyChildren))),r("td",{style:i.getCellStyle(e,c,t,u),class:i.getCellClass(e,c,t,u),attrs:{rowspan:p,colspan:d},on:{mouseenter:function(e){return i.handleCellMouseEnter(e,t)},mouseleave:i.handleCellMouseLeave}},[u.renderCell.call(i._renderProxy,i.$createElement,g,l[c])])})])},wrappedRowRender:function(t,e){var n=this,i=this.$createElement,r=this.store,o=r.isRowExpanded,s=r.assertRowKey,a=r.states,l=a.treeData,u=a.lazyTreeNodeMap,c=a.childrenColumnName,h=a.rowKey;if(this.hasExpandColumn&&o(t)){var p=this.table.renderExpanded,d=this.rowRender(t,e);return p?[[d,i("tr",{key:"expanded-row__"+d.key},[i("td",{attrs:{colspan:this.columnsCount},class:"el-table__expanded-cell"},[p(this.$createElement,{row:t,$index:e,store:this.store})])])]]:(console.error("[Element Error]renderExpanded is required."),d)}if(Object.keys(l).length){s();var f=_n(t,h),g=l[f],m=null;g&&(m={expanded:g.expanded,level:g.level,display:!0},"boolean"==typeof g.lazy&&("boolean"==typeof g.loaded&&g.loaded&&(m.noLazyChildren=!(g.children&&g.children.length)),m.loading=g.loading));var v=[this.rowRender(t,e,m)];if(g){var _=0;g.display=!0,function t(i,r){i&&i.length&&r&&i.forEach(function(i){var o={display:r.display&&r.expanded,level:r.level+1},s=_n(i,h);if(void 0===s||null===s)throw new Error("for nested data item, row-key is required.");if((g=Fn({},l[s]))&&(o.expanded=g.expanded,g.level=g.level||o.level,g.display=!(!g.expanded||!o.display),"boolean"==typeof g.lazy&&("boolean"==typeof g.loaded&&g.loaded&&(o.noLazyChildren=!(g.children&&g.children.length)),o.loading=g.loading)),_++,v.push(n.rowRender(i,e+_,o)),g){var a=u[s]||i[c];t(a,g)}})}(u[f]||t[c],g)}return v}return this.rowRender(t,e)}}},Vn=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"}},[t.multiple?n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleOutsideClick,expression:"handleOutsideClick"},{name:"show",rawName:"v-show",value:t.showPopper,expression:"showPopper"}],staticClass:"el-table-filter"},[n("div",{staticClass:"el-table-filter__content"},[n("el-scrollbar",{attrs:{"wrap-class":"el-table-filter__wrap"}},[n("el-checkbox-group",{staticClass:"el-table-filter__checkbox-group",model:{value:t.filteredValue,callback:function(e){t.filteredValue=e},expression:"filteredValue"}},t._l(t.filters,function(e){return n("el-checkbox",{key:e.value,attrs:{label:e.value}},[t._v(t._s(e.text))])}),1)],1)],1),n("div",{staticClass:"el-table-filter__bottom"},[n("button",{class:{"is-disabled":0===t.filteredValue.length},attrs:{disabled:0===t.filteredValue.length},on:{click:t.handleConfirm}},[t._v(t._s(t.t("el.table.confirmFilter")))]),n("button",{on:{click:t.handleReset}},[t._v(t._s(t.t("el.table.resetFilter")))])])]):n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleOutsideClick,expression:"handleOutsideClick"},{name:"show",rawName:"v-show",value:t.showPopper,expression:"showPopper"}],staticClass:"el-table-filter"},[n("ul",{staticClass:"el-table-filter__list"},[n("li",{staticClass:"el-table-filter__list-item",class:{"is-active":void 0===t.filterValue||null===t.filterValue},on:{click:function(e){t.handleSelect(null)}}},[t._v(t._s(t.t("el.table.clearFilter")))]),t._l(t.filters,function(e){return n("li",{key:e.value,staticClass:"el-table-filter__list-item",class:{"is-active":t.isActive(e)},attrs:{label:e.value},on:{click:function(n){t.handleSelect(e.value)}}},[t._v(t._s(e.text))])})],2)])])};Vn._withStripped=!0;var Hn=[];!hn.a.prototype.$isServer&&document.addEventListener("click",function(t){Hn.forEach(function(e){var n=t.target;e&&e.$el&&(n===e.$el||e.$el.contains(n)||e.handleOutsideClick&&e.handleOutsideClick(t))})});var Wn=function(t){t&&Hn.push(t)},Gn=function(t){-1!==Hn.indexOf(t)&&Hn.splice(t,1)},jn=n(31),zn=n.n(jn),$n=r({name:"ElTableFilterPanel",mixins:[L.a,f.a],directives:{Clickoutside:A.a},components:{ElCheckbox:rn.a,ElCheckboxGroup:zn.a,ElScrollbar:B.a},props:{placement:{type:String,default:"bottom-end"}},methods:{isActive:function(t){return t.value===this.filterValue},handleOutsideClick:function(){var t=this;setTimeout(function(){t.showPopper=!1},16)},handleConfirm:function(){this.confirmFilter(this.filteredValue),this.handleOutsideClick()},handleReset:function(){this.filteredValue=[],this.confirmFilter(this.filteredValue),this.handleOutsideClick()},handleSelect:function(t){this.filterValue=t,void 0!==t&&null!==t?this.confirmFilter(this.filteredValue):this.confirmFilter([]),this.handleOutsideClick()},confirmFilter:function(t){this.table.store.commit("filterChange",{column:this.column,values:t}),this.table.store.updateAllSelected()}},data:function(){return{table:null,cell:null,column:null}},computed:{filters:function(){return this.column&&this.column.filters},filterValue:{get:function(){return(this.column.filteredValue||[])[0]},set:function(t){this.filteredValue&&(void 0!==t&&null!==t?this.filteredValue.splice(0,1,t):this.filteredValue.splice(0,1))}},filteredValue:{get:function(){return this.column&&this.column.filteredValue||[]},set:function(t){this.column&&(this.column.filteredValue=t)}},multiple:function(){return!this.column||this.column.filterMultiple}},mounted:function(){var t=this;this.popperElm=this.$el,this.referenceElm=this.cell,this.table.bodyWrapper.addEventListener("scroll",function(){t.updatePopper()}),this.$watch("showPopper",function(e){t.column&&(t.column.filterOpened=e),e?Wn(t):Gn(t)})},watch:{showPopper:function(t){!0===t&&parseInt(this.popperJS._popper.style.zIndex,10)<y.PopupManager.zIndex&&(this.popperJS._popper.style.zIndex=y.PopupManager.nextZIndex())}}},Vn,[],!1,null,null,null);$n.options.__file="packages/table/src/filter-panel.vue";var Xn=$n.exports,Yn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Kn=function(t){var e=1;t.forEach(function(t){t.level=1,function t(n,i){if(i&&(n.level=i.level+1,e<n.level&&(e=n.level)),n.children){var r=0;n.children.forEach(function(e){t(e,n),r+=e.colSpan}),n.colSpan=r}else n.colSpan=1}(t)});for(var n=[],i=0;i<e;i++)n.push([]);return function t(e){var n=[];return e.forEach(function(e){e.children?(n.push(e),n.push.apply(n,t(e.children))):n.push(e)}),n}(t).forEach(function(t){t.children?t.rowSpan=1:t.rowSpan=e-t.level+1,n[t.level-1].push(t)}),n},Jn={name:"ElTableHeader",mixins:[Pn],render:function(t){var e=this,n=this.store.states.originColumns,i=Kn(n,this.columns),r=i.length>1;return r&&(this.$parent.isGroup=!0),t("table",{class:"el-table__header",attrs:{cellspacing:"0",cellpadding:"0",border:"0"}},[t("colgroup",[this.columns.map(function(e){return t("col",{attrs:{name:e.id},key:e.id})}),this.hasGutter?t("col",{attrs:{name:"gutter"}}):""]),t("thead",{class:[{"is-group":r,"has-gutter":this.hasGutter}]},[this._l(i,function(n,i){return t("tr",{style:e.getHeaderRowStyle(i),class:e.getHeaderRowClass(i)},[n.map(function(r,o){return t("th",{attrs:{colspan:r.colSpan,rowspan:r.rowSpan},on:{mousemove:function(t){return e.handleMouseMove(t,r)},mouseout:e.handleMouseOut,mousedown:function(t){return e.handleMouseDown(t,r)},click:function(t){return e.handleHeaderClick(t,r)},contextmenu:function(t){return e.handleHeaderContextMenu(t,r)}},style:e.getHeaderCellStyle(i,o,n,r),class:e.getHeaderCellClass(i,o,n,r),key:r.id},[t("div",{class:["cell",r.filteredValue&&r.filteredValue.length>0?"highlight":"",r.labelClassName]},[r.renderHeader?r.renderHeader.call(e._renderProxy,t,{column:r,$index:o,store:e.store,_self:e.$parent.$vnode.context}):r.label,r.sortable?t("span",{class:"caret-wrapper",on:{click:function(t){return e.handleSortClick(t,r)}}},[t("i",{class:"sort-caret ascending",on:{click:function(t){return e.handleSortClick(t,r,"ascending")}}}),t("i",{class:"sort-caret descending",on:{click:function(t){return e.handleSortClick(t,r,"descending")}}})]):"",r.filterable?t("span",{class:"el-table__column-filter-trigger",on:{click:function(t){return e.handleFilterClick(t,r)}}},[t("i",{class:["el-icon-arrow-down",r.filterOpened?"el-icon-arrow-up":""]})]):""])])}),e.hasGutter?t("th",{class:"gutter"}):""])})])])},props:{fixed:String,store:{required:!0},border:Boolean,defaultSort:{type:Object,default:function(){return{prop:"",order:""}}}},components:{ElCheckbox:rn.a},computed:Yn({table:function(){return this.$parent},hasGutter:function(){return!this.fixed&&this.tableLayout.gutterWidth}},An({columns:"columns",isAllSelected:"isAllSelected",leftFixedLeafCount:"fixedLeafColumnsLength",rightFixedLeafCount:"rightFixedLeafColumnsLength",columnsCount:function(t){return t.columns.length},leftFixedCount:function(t){return t.fixedColumns.length},rightFixedCount:function(t){return t.rightFixedColumns.length}})),created:function(){this.filterPanels={}},mounted:function(){var t=this;this.$nextTick(function(){var e=t.defaultSort,n=e.prop,i=e.order;t.store.commit("sort",{prop:n,order:i,init:!0})})},beforeDestroy:function(){var t=this.filterPanels;for(var e in t)t.hasOwnProperty(e)&&t[e]&&t[e].$destroy(!0)},methods:{isCellHidden:function(t,e){for(var n=0,i=0;i<t;i++)n+=e[i].colSpan;var r=n+e[t].colSpan-1;return!0===this.fixed||"left"===this.fixed?r>=this.leftFixedLeafCount:"right"===this.fixed?n<this.columnsCount-this.rightFixedLeafCount:r<this.leftFixedLeafCount||n>=this.columnsCount-this.rightFixedLeafCount},getHeaderRowStyle:function(t){var e=this.table.headerRowStyle;return"function"==typeof e?e.call(null,{rowIndex:t}):e},getHeaderRowClass:function(t){var e=[],n=this.table.headerRowClassName;return"string"==typeof n?e.push(n):"function"==typeof n&&e.push(n.call(null,{rowIndex:t})),e.join(" ")},getHeaderCellStyle:function(t,e,n,i){var r=this.table.headerCellStyle;return"function"==typeof r?r.call(null,{rowIndex:t,columnIndex:e,row:n,column:i}):r},getHeaderCellClass:function(t,e,n,i){var r=[i.id,i.order,i.headerAlign,i.className,i.labelClassName];0===t&&this.isCellHidden(e,n)&&r.push("is-hidden"),i.children||r.push("is-leaf"),i.sortable&&r.push("is-sortable");var o=this.table.headerCellClassName;return"string"==typeof o?r.push(o):"function"==typeof o&&r.push(o.call(null,{rowIndex:t,columnIndex:e,row:n,column:i})),r.join(" ")},toggleAllSelection:function(t){t.stopPropagation(),this.store.commit("toggleAllSelection")},handleFilterClick:function(t,e){t.stopPropagation();var n=t.target,i="TH"===n.tagName?n:n.parentNode;if(!Object(ft.hasClass)(i,"noclick")){i=i.querySelector(".el-table__column-filter-trigger")||i;var r=this.$parent,o=this.filterPanels[e.id];o&&e.filterOpened?o.showPopper=!1:(o||(o=new hn.a(Xn),this.filterPanels[e.id]=o,e.filterPlacement&&(o.placement=e.filterPlacement),o.table=r,o.cell=i,o.column=e,!this.$isServer&&o.$mount(document.createElement("div"))),setTimeout(function(){o.showPopper=!0},16))}},handleHeaderClick:function(t,e){!e.filters&&e.sortable?this.handleSortClick(t,e):e.filterable&&!e.sortable&&this.handleFilterClick(t,e),this.$parent.$emit("header-click",e,t)},handleHeaderContextMenu:function(t,e){this.$parent.$emit("header-contextmenu",e,t)},handleMouseDown:function(t,e){var n=this;if(!this.$isServer&&!(e.children&&e.children.length>0)&&this.draggingColumn&&this.border){this.dragging=!0,this.$parent.resizeProxyVisible=!0;var i=this.$parent,r=i.$el.getBoundingClientRect().left,o=this.$el.querySelector("th."+e.id),s=o.getBoundingClientRect(),a=s.left-r+30;Object(ft.addClass)(o,"noclick"),this.dragState={startMouseLeft:t.clientX,startLeft:s.right-r,startColumnLeft:s.left-r,tableLeft:r};var l=i.$refs.resizeProxy;l.style.left=this.dragState.startLeft+"px",document.onselectstart=function(){return!1},document.ondragstart=function(){return!1};var u=function(t){var e=t.clientX-n.dragState.startMouseLeft,i=n.dragState.startLeft+e;l.style.left=Math.max(a,i)+"px"};document.addEventListener("mousemove",u),document.addEventListener("mouseup",function r(){if(n.dragging){var s=n.dragState,a=s.startColumnLeft,c=s.startLeft,h=parseInt(l.style.left,10)-a;e.width=e.realWidth=h,i.$emit("header-dragend",e.width,c-a,e,t),n.store.scheduleLayout(),document.body.style.cursor="",n.dragging=!1,n.draggingColumn=null,n.dragState={},i.resizeProxyVisible=!1}document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",r),document.onselectstart=null,document.ondragstart=null,setTimeout(function(){Object(ft.removeClass)(o,"noclick")},0)})}},handleMouseMove:function(t,e){if(!(e.children&&e.children.length>0)){for(var n=t.target;n&&"TH"!==n.tagName;)n=n.parentNode;if(e&&e.resizable&&!this.dragging&&this.border){var i=n.getBoundingClientRect(),r=document.body.style;i.width>12&&i.right-t.pageX<8?(r.cursor="col-resize",Object(ft.hasClass)(n,"is-sortable")&&(n.style.cursor="col-resize"),this.draggingColumn=e):this.dragging||(r.cursor="",Object(ft.hasClass)(n,"is-sortable")&&(n.style.cursor="pointer"),this.draggingColumn=null)}}},handleMouseOut:function(){this.$isServer||(document.body.style.cursor="")},toggleOrder:function(t){var e=t.order,n=t.sortOrders;if(""===e)return n[0];var i=n.indexOf(e||null);return n[i>n.length-2?0:i+1]},handleSortClick:function(t,e,n){t.stopPropagation();for(var i=e.order===n?null:n||this.toggleOrder(e),r=t.target;r&&"TH"!==r.tagName;)r=r.parentNode;if(r&&"TH"===r.tagName&&Object(ft.hasClass)(r,"noclick"))Object(ft.removeClass)(r,"noclick");else if(e.sortable){var o=this.store.states,s=o.sortProp,a=void 0,l=o.sortingColumn;(l!==e||l===e&&null===l.order)&&(l&&(l.order=null),o.sortingColumn=e,s=e.property),a=e.order=i||null,o.sortProp=s,o.sortOrder=a,this.store.commit("changeSortCondition")}}},data:function(){return{draggingColumn:null,dragging:!1,dragState:{}}}},qn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Zn={name:"ElTableFooter",mixins:[Pn],render:function(t){var e=this,n=[];return this.summaryMethod?n=this.summaryMethod({columns:this.columns,data:this.store.states.data}):this.columns.forEach(function(t,i){if(0!==i){var r=e.store.states.data.map(function(e){return Number(e[t.property])}),o=[],s=!0;r.forEach(function(t){if(!isNaN(t)){s=!1;var e=(""+t).split(".")[1];o.push(e?e.length:0)}});var a=Math.max.apply(null,o);n[i]=s?"":r.reduce(function(t,e){var n=Number(e);return isNaN(n)?t:parseFloat((t+e).toFixed(Math.min(a,20)))},0)}else n[i]=e.sumText}),t("table",{class:"el-table__footer",attrs:{cellspacing:"0",cellpadding:"0",border:"0"}},[t("colgroup",[this.columns.map(function(e){return t("col",{attrs:{name:e.id},key:e.id})}),this.hasGutter?t("col",{attrs:{name:"gutter"}}):""]),t("tbody",{class:[{"has-gutter":this.hasGutter}]},[t("tr",[this.columns.map(function(i,r){return t("td",{key:r,attrs:{colspan:i.colSpan,rowspan:i.rowSpan},class:e.getRowClasses(i,r)},[t("div",{class:["cell",i.labelClassName]},[n[r]])])}),this.hasGutter?t("th",{class:"gutter"}):""])])])},props:{fixed:String,store:{required:!0},summaryMethod:Function,sumText:String,border:Boolean,defaultSort:{type:Object,default:function(){return{prop:"",order:""}}}},computed:qn({table:function(){return this.$parent},hasGutter:function(){return!this.fixed&&this.tableLayout.gutterWidth}},An({columns:"columns",isAllSelected:"isAllSelected",leftFixedLeafCount:"fixedLeafColumnsLength",rightFixedLeafCount:"rightFixedLeafColumnsLength",columnsCount:function(t){return t.columns.length},leftFixedCount:function(t){return t.fixedColumns.length},rightFixedCount:function(t){return t.rightFixedColumns.length}})),methods:{isCellHidden:function(t,e,n){if(!0===this.fixed||"left"===this.fixed)return t>=this.leftFixedLeafCount;if("right"===this.fixed){for(var i=0,r=0;r<t;r++)i+=e[r].colSpan;return i<this.columnsCount-this.rightFixedLeafCount}return!(this.fixed||!n.fixed)||(t<this.leftFixedCount||t>=this.columnsCount-this.rightFixedCount)},getRowClasses:function(t,e){var n=[t.id,t.align,t.labelClassName];return t.className&&n.push(t.className),this.isCellHidden(e,this.columns,t)&&n.push("is-hidden"),t.children||n.push("is-leaf"),n}}},Qn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},ti=1,ei=r({name:"ElTable",mixins:[f.a,E.a],directives:{Mousewheel:un},props:{data:{type:Array,default:function(){return[]}},size:String,width:[String,Number],height:[String,Number],maxHeight:[String,Number],fit:{type:Boolean,default:!0},stripe:Boolean,border:Boolean,rowKey:[String,Function],context:{},showHeader:{type:Boolean,default:!0},showSummary:Boolean,sumText:String,summaryMethod:Function,rowClassName:[String,Function],rowStyle:[Object,Function],cellClassName:[String,Function],cellStyle:[Object,Function],headerRowClassName:[String,Function],headerRowStyle:[Object,Function],headerCellClassName:[String,Function],headerCellStyle:[Object,Function],highlightCurrentRow:Boolean,currentRowKey:[String,Number],emptyText:String,expandRowKeys:Array,defaultExpandAll:Boolean,defaultSort:Object,tooltipEffect:String,spanMethod:Function,selectOnIndeterminate:{type:Boolean,default:!0},indent:{type:Number,default:16},treeProps:{type:Object,default:function(){return{hasChildren:"hasChildren",children:"children"}}},lazy:Boolean,load:Function},components:{TableHeader:Jn,TableFooter:Zn,TableBody:Un,ElCheckbox:rn.a},methods:{getMigratingConfig:function(){return{events:{expand:"expand is renamed to expand-change"}}},setCurrentRow:function(t){this.store.commit("setCurrentRow",t)},toggleRowSelection:function(t,e){this.store.toggleRowSelection(t,e,!1),this.store.updateAllSelected()},toggleRowExpansion:function(t,e){this.store.toggleRowExpansionAdapter(t,e)},clearSelection:function(){this.store.clearSelection()},clearFilter:function(t){this.store.clearFilter(t)},clearSort:function(){this.store.clearSort()},handleMouseLeave:function(){this.store.commit("setHoverRow",null),this.hoverState&&(this.hoverState=null)},updateScrollY:function(){this.layout.updateScrollY()&&(this.layout.notifyObservers("scrollable"),this.layout.updateColumnsWidth())},handleFixedMousewheel:function(t,e){var n=this.bodyWrapper;if(Math.abs(e.spinY)>0){var i=n.scrollTop;e.pixelY<0&&0!==i&&t.preventDefault(),e.pixelY>0&&n.scrollHeight-n.clientHeight>i&&t.preventDefault(),n.scrollTop+=Math.ceil(e.pixelY/5)}else n.scrollLeft+=Math.ceil(e.pixelX/5)},handleHeaderFooterMousewheel:function(t,e){var n=e.pixelX,i=e.pixelY;Math.abs(n)>=Math.abs(i)&&(this.bodyWrapper.scrollLeft+=e.pixelX/5)},syncPostion:Object(on.throttle)(20,function(){var t=this.bodyWrapper,e=t.scrollLeft,n=t.scrollTop,i=t.offsetWidth,r=t.scrollWidth,o=this.$refs,s=o.headerWrapper,a=o.footerWrapper,l=o.fixedBodyWrapper,u=o.rightFixedBodyWrapper;s&&(s.scrollLeft=e),a&&(a.scrollLeft=e),l&&(l.scrollTop=n),u&&(u.scrollTop=n);var c=r-i-1;this.scrollPosition=e>=c?"right":0===e?"left":"middle"}),bindEvents:function(){this.bodyWrapper.addEventListener("scroll",this.syncPostion,{passive:!0}),this.fit&&Object(Pe.addResizeListener)(this.$el,this.resizeListener)},unbindEvents:function(){this.bodyWrapper.removeEventListener("scroll",this.syncPostion,{passive:!0}),this.fit&&Object(Pe.removeResizeListener)(this.$el,this.resizeListener)},resizeListener:function(){if(this.$ready){var t=!1,e=this.$el,n=this.resizeState,i=n.width,r=n.height,o=e.offsetWidth;i!==o&&(t=!0);var s=e.offsetHeight;(this.height||this.shouldUpdateHeight)&&r!==s&&(t=!0),t&&(this.resizeState.width=o,this.resizeState.height=s,this.doLayout())}},doLayout:function(){this.shouldUpdateHeight&&this.layout.updateElsHeight(),this.layout.updateColumnsWidth()},sort:function(t,e){this.store.commit("sort",{prop:t,order:e})},toggleAllSelection:function(){this.store.commit("toggleAllSelection")}},computed:Qn({tableSize:function(){return this.size||(this.$ELEMENT||{}).size},bodyWrapper:function(){return this.$refs.bodyWrapper},shouldUpdateHeight:function(){return this.height||this.maxHeight||this.fixedColumns.length>0||this.rightFixedColumns.length>0},bodyWidth:function(){var t=this.layout,e=t.bodyWidth,n=t.scrollY,i=t.gutterWidth;return e?e-(n?i:0)+"px":""},bodyHeight:function(){var t=this.layout,e=t.headerHeight,n=void 0===e?0:e,i=t.bodyHeight,r=t.footerHeight,o=void 0===r?0:r;if(this.height)return{height:i?i+"px":""};if(this.maxHeight){var s=En(this.maxHeight);if("number"==typeof s)return{"max-height":s-o-(this.showHeader?n:0)+"px"}}return{}},fixedBodyHeight:function(){if(this.height)return{height:this.layout.fixedBodyHeight?this.layout.fixedBodyHeight+"px":""};if(this.maxHeight){var t=En(this.maxHeight);if("number"==typeof t)return t=this.layout.scrollX?t-this.layout.gutterWidth:t,this.showHeader&&(t-=this.layout.headerHeight),{"max-height":(t-=this.layout.footerHeight)+"px"}}return{}},fixedHeight:function(){return this.maxHeight?this.showSummary?{bottom:0}:{bottom:this.layout.scrollX&&this.data.length?this.layout.gutterWidth+"px":""}:this.showSummary?{height:this.layout.tableHeight?this.layout.tableHeight+"px":""}:{height:this.layout.viewportHeight?this.layout.viewportHeight+"px":""}},emptyBlockStyle:function(){if(this.data&&this.data.length)return null;var t="100%";return this.layout.appendHeight&&(t="calc(100% - "+this.layout.appendHeight+"px)"),{width:this.bodyWidth,height:t}}},An({selection:"selection",columns:"columns",tableData:"data",fixedColumns:"fixedColumns",rightFixedColumns:"rightFixedColumns"})),watch:{height:{immediate:!0,handler:function(t){this.layout.setHeight(t)}},maxHeight:{immediate:!0,handler:function(t){this.layout.setMaxHeight(t)}},currentRowKey:{immediate:!0,handler:function(t){this.rowKey&&this.store.setCurrentRowKey(t)}},data:{immediate:!0,handler:function(t){this.store.commit("setData",t)}},expandRowKeys:{immediate:!0,handler:function(t){t&&this.store.setExpandRowKeysAdapter(t)}}},created:function(){var t=this;this.tableId="el-table_"+ti++,this.debouncedUpdateLayout=Object(on.debounce)(50,function(){return t.doLayout()})},mounted:function(){var t=this;this.bindEvents(),this.store.updateColumns(),this.doLayout(),this.resizeState={width:this.$el.offsetWidth,height:this.$el.offsetHeight},this.store.states.columns.forEach(function(e){e.filteredValue&&e.filteredValue.length&&t.store.commit("filterChange",{column:e,values:e.filteredValue,silent:!0})}),this.$ready=!0},destroyed:function(){this.unbindEvents()},data:function(){var t=this.treeProps,e=t.hasChildren,n=void 0===e?"hasChildren":e,i=t.children,r=void 0===i?"children":i;return this.store=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)throw new Error("Table is required.");var n=new Dn;return n.table=t,n.toggleAllSelection=O()(10,n._toggleAllSelection),Object.keys(e).forEach(function(t){n.states[t]=e[t]}),n}(this,{rowKey:this.rowKey,defaultExpandAll:this.defaultExpandAll,selectOnIndeterminate:this.selectOnIndeterminate,indent:this.indent,lazy:this.lazy,lazyColumnIdentifier:n,childrenColumnName:r}),{layout:new Ln({store:this.store,table:this,fit:this.fit,showHeader:this.showHeader}),isHidden:!1,renderExpanded:null,resizeProxyVisible:!1,resizeState:{width:null,height:null},isGroup:!1,scrollPosition:"left"}}},en,[],!1,null,null,null);ei.options.__file="packages/table/src/table.vue";var ni=ei.exports;ni.install=function(t){t.component(ni.name,ni)};var ii=ni,ri={default:{order:""},selection:{width:48,minWidth:48,realWidth:48,order:"",className:"el-table-column--selection"},expand:{width:48,minWidth:48,realWidth:48,order:""},index:{width:48,minWidth:48,realWidth:48,order:""}},oi={selection:{renderHeader:function(t,e){var n=e.store;return t("el-checkbox",{attrs:{disabled:n.states.data&&0===n.states.data.length,indeterminate:n.states.selection.length>0&&!this.isAllSelected,value:this.isAllSelected},nativeOn:{click:this.toggleAllSelection}})},renderCell:function(t,e){var n=e.row,i=e.column,r=e.store,o=e.$index;return t("el-checkbox",{nativeOn:{click:function(t){return t.stopPropagation()}},attrs:{value:r.isSelected(n),disabled:!!i.selectable&&!i.selectable.call(null,n,o)},on:{input:function(){r.commit("rowSelectedChanged",n)}}})},sortable:!1,resizable:!1},index:{renderHeader:function(t,e){return e.column.label||"#"},renderCell:function(t,e){var n=e.$index,i=n+1,r=e.column.index;return"number"==typeof r?i=n+r:"function"==typeof r&&(i=r(n)),t("div",[i])},sortable:!1},expand:{renderHeader:function(t,e){return e.column.label||""},renderCell:function(t,e){var n=e.row,i=e.store,r=["el-table__expand-icon"];i.states.expandRows.indexOf(n)>-1&&r.push("el-table__expand-icon--expanded");return t("div",{class:r,on:{click:function(t){t.stopPropagation(),i.toggleRowExpansion(n)}}},[t("i",{class:"el-icon el-icon-arrow-right"})])},sortable:!1,resizable:!1,className:"el-table__expand-column"}};function si(t,e){var n=e.row,i=e.column,r=e.$index,o=i.property,s=o&&Object(g.getPropByPath)(n,o).v;return i&&i.formatter?i.formatter(n,i,s,r):s}var ai=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},li=1,ui={name:"ElTableColumn",props:{type:{type:String,default:"default"},label:String,className:String,labelClassName:String,property:String,prop:String,width:{},minWidth:{},renderHeader:Function,sortable:{type:[Boolean,String],default:!1},sortMethod:Function,sortBy:[String,Function,Array],resizable:{type:Boolean,default:!0},columnKey:String,align:String,headerAlign:String,showTooltipWhenOverflow:Boolean,showOverflowTooltip:Boolean,fixed:[Boolean,String],formatter:Function,selectable:Function,reserveSelection:Boolean,filterMethod:Function,filteredValue:Array,filters:Array,filterPlacement:String,filterMultiple:{type:Boolean,default:!0},index:[Number,Function],sortOrders:{type:Array,default:function(){return["ascending","descending",null]},validator:function(t){return t.every(function(t){return["ascending","descending",null].indexOf(t)>-1})}}},data:function(){return{isSubColumn:!1,columns:[]}},computed:{owner:function(){for(var t=this.$parent;t&&!t.tableId;)t=t.$parent;return t},columnOrTableParent:function(){for(var t=this.$parent;t&&!t.tableId&&!t.columnId;)t=t.$parent;return t},realWidth:function(){return Tn(this.width)},realMinWidth:function(){return void 0!==(t=this.minWidth)&&(t=Tn(t),isNaN(t)&&(t=80)),t;var t},realAlign:function(){return this.align?"is-"+this.align:null},realHeaderAlign:function(){return this.headerAlign?"is-"+this.headerAlign:this.realAlign}},methods:{getPropsData:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return n.reduce(function(e,n){return Array.isArray(n)&&n.forEach(function(n){e[n]=t[n]}),e},{})},getColumnElIndex:function(t,e){return[].indexOf.call(t,e)},setColumnWidth:function(t){return this.realWidth&&(t.width=this.realWidth),this.realMinWidth&&(t.minWidth=this.realMinWidth),t.minWidth||(t.minWidth=80),t.realWidth=void 0===t.width?t.minWidth:t.width,t},setColumnForcedProps:function(t){var e=t.type,n=oi[e]||{};return Object.keys(n).forEach(function(e){var i=n[e];void 0!==i&&(t[e]="className"===e?t[e]+" "+i:i)}),t},setColumnRenders:function(t){var e=this;this.$createElement;this.renderHeader?console.warn("[Element Warn][TableColumn]Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header."):"selection"!==t.type&&(t.renderHeader=function(n,i){var r=e.$scopedSlots.header;return r?r(i):t.label});var n=t.renderCell;return"expand"===t.type?(t.renderCell=function(t,e){return t("div",{class:"cell"},[n(t,e)])},this.owner.renderExpanded=function(t,n){return e.$scopedSlots.default?e.$scopedSlots.default(n):e.$slots.default}):(n=n||si,t.renderCell=function(i,r){var o=null;o=e.$scopedSlots.default?e.$scopedSlots.default(r):n(i,r);var s=function(t,e){var n=e.row,i=e.treeNode,r=e.store;if(!i)return null;var o=[];if(i.indent&&o.push(t("span",{class:"el-table__indent",style:{"padding-left":i.indent+"px"}})),"boolean"!=typeof i.expanded||i.noLazyChildren)o.push(t("span",{class:"el-table__placeholder"}));else{var s=["el-table__expand-icon",i.expanded?"el-table__expand-icon--expanded":""],a=["el-icon-arrow-right"];i.loading&&(a=["el-icon-loading"]),o.push(t("div",{class:s,on:{click:function(t){t.stopPropagation(),r.loadOrToggle(n)}}},[t("i",{class:a})]))}return o}(i,r),a={class:"cell",style:{}};return t.showOverflowTooltip&&(a.class+=" el-tooltip",a.style={width:(r.column.realWidth||r.column.width)-1+"px"}),i("div",a,[s,o])}),t},registerNormalWatchers:function(){var t=this,e={prop:"property",realAlign:"align",realHeaderAlign:"headerAlign",realWidth:"width"},n=["label","property","filters","filterMultiple","sortable","index","formatter","className","labelClassName","showOverflowTooltip"].reduce(function(t,e){return t[e]=e,t},e);Object.keys(n).forEach(function(n){var i=e[n];t.$watch(n,function(e){t.columnConfig[i]=e})})},registerComplexWatchers:function(){var t=this,e={realWidth:"width",realMinWidth:"minWidth"},n=["fixed"].reduce(function(t,e){return t[e]=e,t},e);Object.keys(n).forEach(function(n){var i=e[n];t.$watch(n,function(e){t.columnConfig[i]=e;var n="fixed"===i;t.owner.store.scheduleLayout(n)})})}},components:{ElCheckbox:rn.a},beforeCreate:function(){this.row={},this.column={},this.$index=0,this.columnId=""},created:function(){var t=this.columnOrTableParent;this.isSubColumn=this.owner!==t,this.columnId=(t.tableId||t.columnId)+"_column_"+li++;var e=this.type||"default",n=""===this.sortable||this.sortable,i=ai({},ri[e],{id:this.columnId,type:e,property:this.prop||this.property,align:this.realAlign,headerAlign:this.realHeaderAlign,showOverflowTooltip:this.showOverflowTooltip||this.showTooltipWhenOverflow,filterable:this.filters||this.filterMethod,filteredValue:[],filterPlacement:"",isColumnGroup:!1,filterOpened:!1,sortable:n,index:this.index}),r=this.getPropsData(["columnKey","label","className","labelClassName","type","renderHeader","formatter","fixed","resizable"],["sortMethod","sortBy","sortOrders"],["selectable","reserveSelection"],["filterMethod","filters","filterMultiple","filterOpened","filteredValue","filterPlacement"]);r=function(t,e){var n={},i=void 0;for(i in t)n[i]=t[i];for(i in e)if(bn(e,i)){var r=e[i];void 0!==r&&(n[i]=r)}return n}(i,r),r=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}(this.setColumnRenders,this.setColumnWidth,this.setColumnForcedProps)(r),this.columnConfig=r,this.registerNormalWatchers(),this.registerComplexWatchers()},mounted:function(){var t=this.owner,e=this.columnOrTableParent,n=this.isSubColumn?e.$el.children:e.$refs.hiddenColumns.children,i=this.getColumnElIndex(n,this.$el);t.store.commit("insertColumn",this.columnConfig,i,this.isSubColumn?e.columnConfig:null)},destroyed:function(){if(this.$parent){var t=this.$parent;this.owner.store.commit("removeColumn",this.columnConfig,this.isSubColumn?t.columnConfig:null)}},render:function(t){return t("div",this.$slots.default)},install:function(t){t.component(ui.name,ui)}},ci=ui,hi=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.ranged?n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleClose,expression:"handleClose"}],ref:"reference",staticClass:"el-date-editor el-range-editor el-input__inner",class:["el-date-editor--"+t.type,t.pickerSize?"el-range-editor--"+t.pickerSize:"",t.pickerDisabled?"is-disabled":"",t.pickerVisible?"is-active":""],on:{click:t.handleRangeClick,mouseenter:t.handleMouseEnter,mouseleave:function(e){t.showClose=!1},keydown:t.handleKeydown}},[n("i",{class:["el-input__icon","el-range__icon",t.triggerClass]}),n("input",t._b({staticClass:"el-range-input",attrs:{autocomplete:"off",placeholder:t.startPlaceholder,disabled:t.pickerDisabled,readonly:!t.editable||t.readonly,name:t.name&&t.name[0]},domProps:{value:t.displayValue&&t.displayValue[0]},on:{input:t.handleStartInput,change:t.handleStartChange,focus:t.handleFocus}},"input",t.firstInputId,!1)),t._t("range-separator",[n("span",{staticClass:"el-range-separator"},[t._v(t._s(t.rangeSeparator))])]),n("input",t._b({staticClass:"el-range-input",attrs:{autocomplete:"off",placeholder:t.endPlaceholder,disabled:t.pickerDisabled,readonly:!t.editable||t.readonly,name:t.name&&t.name[1]},domProps:{value:t.displayValue&&t.displayValue[1]},on:{input:t.handleEndInput,change:t.handleEndChange,focus:t.handleFocus}},"input",t.secondInputId,!1)),t.haveTrigger?n("i",{staticClass:"el-input__icon el-range__close-icon",class:[t.showClose?""+t.clearIcon:""],on:{click:t.handleClickIcon}}):t._e()],2):n("el-input",t._b({directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleClose,expression:"handleClose"}],ref:"reference",staticClass:"el-date-editor",class:"el-date-editor--"+t.type,attrs:{readonly:!t.editable||t.readonly||"dates"===t.type||"week"===t.type,disabled:t.pickerDisabled,size:t.pickerSize,name:t.name,placeholder:t.placeholder,value:t.displayValue,validateEvent:!1},on:{focus:t.handleFocus,input:function(e){return t.userInput=e},change:t.handleChange},nativeOn:{keydown:function(e){return t.handleKeydown(e)},mouseenter:function(e){return t.handleMouseEnter(e)},mouseleave:function(e){t.showClose=!1}}},"el-input",t.firstInputId,!1),[n("i",{staticClass:"el-input__icon",class:t.triggerClass,attrs:{slot:"prefix"},on:{click:t.handleFocus},slot:"prefix"}),t.haveTrigger?n("i",{staticClass:"el-input__icon",class:[t.showClose?""+t.clearIcon:""],attrs:{slot:"suffix"},on:{click:t.handleClickIcon},slot:"suffix"}):t._e()])};hi._withStripped=!0;var pi=n(0),di={props:{appendToBody:L.a.props.appendToBody,offset:L.a.props.offset,boundariesPadding:L.a.props.boundariesPadding,arrowOffset:L.a.props.arrowOffset},methods:L.a.methods,data:function(){return Ht()({visibleArrow:!0},L.a.data)},beforeDestroy:L.a.beforeDestroy},fi={date:"yyyy-MM-dd",month:"yyyy-MM",datetime:"yyyy-MM-dd HH:mm:ss",time:"HH:mm:ss",week:"yyyywWW",timerange:"HH:mm:ss",daterange:"yyyy-MM-dd",monthrange:"yyyy-MM",datetimerange:"yyyy-MM-dd HH:mm:ss",year:"yyyy"},gi=["date","datetime","time","time-select","week","month","year","daterange","monthrange","timerange","datetimerange","dates"],mi=function(t,e){return"timestamp"===e?t.getTime():Object(pi.formatDate)(t,e)},vi=function(t,e){return"timestamp"===e?new Date(Number(t)):Object(pi.parseDate)(t,e)},_i=function(t,e){if(Array.isArray(t)&&2===t.length){var n=t[0],i=t[1];if(n&&i)return[mi(n,e),mi(i,e)]}return""},yi=function(t,e,n){if(Array.isArray(t)||(t=t.split(n)),2===t.length){var i=t[0],r=t[1];return[vi(i,e),vi(r,e)]}return[]},bi={default:{formatter:function(t){return t?""+t:""},parser:function(t){return void 0===t||""===t?null:t}},week:{formatter:function(t,e){var n=Object(pi.getWeekNumber)(t),i=t.getMonth(),r=new Date(t);1===n&&11===i&&(r.setHours(0,0,0,0),r.setDate(r.getDate()+3-(r.getDay()+6)%7));var o=Object(pi.formatDate)(r,e);return o=/WW/.test(o)?o.replace(/WW/,n<10?"0"+n:n):o.replace(/W/,n)},parser:function(t,e){return bi.date.parser(t,e)}},date:{formatter:mi,parser:vi},datetime:{formatter:mi,parser:vi},daterange:{formatter:_i,parser:yi},monthrange:{formatter:_i,parser:yi},datetimerange:{formatter:_i,parser:yi},timerange:{formatter:_i,parser:yi},time:{formatter:mi,parser:vi},month:{formatter:mi,parser:vi},year:{formatter:mi,parser:vi},number:{formatter:function(t){return t?""+t:""},parser:function(t){var e=Number(t);return isNaN(t)?null:e}},dates:{formatter:function(t,e){return t.map(function(t){return mi(t,e)})},parser:function(t,e){return("string"==typeof t?t.split(", "):t).map(function(t){return t instanceof Date?t:vi(t,e)})}}},Ti={left:"bottom-start",center:"bottom",right:"bottom-end"},Ei=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";return t?(0,(bi[n]||bi.default).parser)(t,e||fi[n],i):null},Ci=function(t,e,n){return t?(0,(bi[n]||bi.default).formatter)(t,e||fi[n]):null},Si=function(t,e){var n=function(t,e){var n=t instanceof Date,i=e instanceof Date;return n&&i?t.getTime()===e.getTime():!n&&!i&&t===e},i=t instanceof Array,r=e instanceof Array;return i&&r?t.length===e.length&&t.every(function(t,i){return n(t,e[i])}):!i&&!r&&n(t,e)},wi=function(t){return"string"==typeof t||t instanceof String},ki=function(t){return null===t||void 0===t||wi(t)||Array.isArray(t)&&2===t.length&&t.every(wi)},xi=r({mixins:[S.a,di],inject:{elForm:{default:""},elFormItem:{default:""}},props:{size:String,format:String,valueFormat:String,readonly:Boolean,placeholder:String,startPlaceholder:String,endPlaceholder:String,prefixIcon:String,clearIcon:{type:String,default:"el-icon-circle-close"},name:{default:"",validator:ki},disabled:Boolean,clearable:{type:Boolean,default:!0},id:{default:"",validator:ki},popperClass:String,editable:{type:Boolean,default:!0},align:{type:String,default:"left"},value:{},defaultValue:{},defaultTime:{},rangeSeparator:{default:"-"},pickerOptions:{},unlinkPanels:Boolean,validateEvent:{type:Boolean,default:!0}},components:{ElInput:p.a},directives:{Clickoutside:A.a},data:function(){return{pickerVisible:!1,showClose:!1,userInput:null,valueOnOpen:null,unwatchPickerOptions:null}},watch:{pickerVisible:function(t){this.readonly||this.pickerDisabled||(t?(this.showPicker(),this.valueOnOpen=Array.isArray(this.value)?[].concat(this.value):this.value):(this.hidePicker(),this.emitChange(this.value),this.userInput=null,this.validateEvent&&this.dispatch("ElFormItem","el.form.blur"),this.$emit("blur",this),this.blur()))},parsedValue:{immediate:!0,handler:function(t){this.picker&&(this.picker.value=t)}},defaultValue:function(t){this.picker&&(this.picker.defaultValue=t)},value:function(t,e){Si(t,e)||this.pickerVisible||!this.validateEvent||this.dispatch("ElFormItem","el.form.change",t)}},computed:{ranged:function(){return this.type.indexOf("range")>-1},reference:function(){var t=this.$refs.reference;return t.$el||t},refInput:function(){return this.reference?[].slice.call(this.reference.querySelectorAll("input")):[]},valueIsEmpty:function(){var t=this.value;if(Array.isArray(t)){for(var e=0,n=t.length;e<n;e++)if(t[e])return!1}else if(t)return!1;return!0},triggerClass:function(){return this.prefixIcon||(-1!==this.type.indexOf("time")?"el-icon-time":"el-icon-date")},selectionMode:function(){return"week"===this.type?"week":"month"===this.type?"month":"year"===this.type?"year":"dates"===this.type?"dates":"day"},haveTrigger:function(){return void 0!==this.showTrigger?this.showTrigger:-1!==gi.indexOf(this.type)},displayValue:function(){var t=Ci(this.parsedValue,this.format,this.type,this.rangeSeparator);return Array.isArray(this.userInput)?[this.userInput[0]||t&&t[0]||"",this.userInput[1]||t&&t[1]||""]:null!==this.userInput?this.userInput:t?"dates"===this.type?t.join(", "):t:""},parsedValue:function(){return this.value?"time-select"===this.type?this.value:Object(pi.isDateObject)(this.value)||Array.isArray(this.value)&&this.value.every(pi.isDateObject)?this.value:this.valueFormat?Ei(this.value,this.valueFormat,this.type,this.rangeSeparator)||this.value:Array.isArray(this.value)?this.value.map(function(t){return new Date(t)}):new Date(this.value):this.value},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},pickerSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},pickerDisabled:function(){return this.disabled||(this.elForm||{}).disabled},firstInputId:function(){var t={},e=void 0;return(e=this.ranged?this.id&&this.id[0]:this.id)&&(t.id=e),t},secondInputId:function(){var t={},e=void 0;return this.ranged&&(e=this.id&&this.id[1]),e&&(t.id=e),t}},created:function(){this.popperOptions={boundariesPadding:0,gpuAcceleration:!1},this.placement=Ti[this.align]||Ti.left,this.$on("fieldReset",this.handleFieldReset)},methods:{focus:function(){this.ranged?this.handleFocus():this.$refs.reference.focus()},blur:function(){this.refInput.forEach(function(t){return t.blur()})},parseValue:function(t){var e=Object(pi.isDateObject)(t)||Array.isArray(t)&&t.every(pi.isDateObject);return this.valueFormat&&!e&&Ei(t,this.valueFormat,this.type,this.rangeSeparator)||t},formatToValue:function(t){var e=Object(pi.isDateObject)(t)||Array.isArray(t)&&t.every(pi.isDateObject);return this.valueFormat&&e?Ci(t,this.valueFormat,this.type,this.rangeSeparator):t},parseString:function(t){var e=Array.isArray(t)?this.type:this.type.replace("range","");return Ei(t,this.format,e)},formatToString:function(t){var e=Array.isArray(t)?this.type:this.type.replace("range","");return Ci(t,this.format,e)},handleMouseEnter:function(){this.readonly||this.pickerDisabled||!this.valueIsEmpty&&this.clearable&&(this.showClose=!0)},handleChange:function(){if(this.userInput){var t=this.parseString(this.displayValue);t&&(this.picker.value=t,this.isValidValue(t)&&(this.emitInput(t),this.userInput=null))}""===this.userInput&&(this.emitInput(null),this.emitChange(null),this.userInput=null)},handleStartInput:function(t){this.userInput?this.userInput=[t.target.value,this.userInput[1]]:this.userInput=[t.target.value,null]},handleEndInput:function(t){this.userInput?this.userInput=[this.userInput[0],t.target.value]:this.userInput=[null,t.target.value]},handleStartChange:function(t){var e=this.parseString(this.userInput&&this.userInput[0]);if(e){this.userInput=[this.formatToString(e),this.displayValue[1]];var n=[e,this.picker.value&&this.picker.value[1]];this.picker.value=n,this.isValidValue(n)&&(this.emitInput(n),this.userInput=null)}},handleEndChange:function(t){var e=this.parseString(this.userInput&&this.userInput[1]);if(e){this.userInput=[this.displayValue[0],this.formatToString(e)];var n=[this.picker.value&&this.picker.value[0],e];this.picker.value=n,this.isValidValue(n)&&(this.emitInput(n),this.userInput=null)}},handleClickIcon:function(t){this.readonly||this.pickerDisabled||(this.showClose?(this.valueOnOpen=this.value,t.stopPropagation(),this.emitInput(null),this.emitChange(null),this.showClose=!1,this.picker&&"function"==typeof this.picker.handleClear&&this.picker.handleClear()):this.pickerVisible=!this.pickerVisible)},handleClose:function(){if(this.pickerVisible&&(this.pickerVisible=!1,"dates"===this.type)){var t=Ei(this.valueOnOpen,this.valueFormat,this.type,this.rangeSeparator)||this.valueOnOpen;this.emitInput(t)}},handleFieldReset:function(t){this.userInput=""===t?null:t},handleFocus:function(){var t=this.type;-1===gi.indexOf(t)||this.pickerVisible||(this.pickerVisible=!0),this.$emit("focus",this)},handleKeydown:function(t){var e=this,n=t.keyCode;return 27===n?(this.pickerVisible=!1,void t.stopPropagation()):9!==n?13===n?((""===this.userInput||this.isValidValue(this.parseString(this.displayValue)))&&(this.handleChange(),this.pickerVisible=this.picker.visible=!1,this.blur()),void t.stopPropagation()):void(this.userInput?t.stopPropagation():this.picker&&this.picker.handleKeydown&&this.picker.handleKeydown(t)):void(this.ranged?setTimeout(function(){-1===e.refInput.indexOf(document.activeElement)&&(e.pickerVisible=!1,e.blur(),t.stopPropagation())},0):(this.handleChange(),this.pickerVisible=this.picker.visible=!1,this.blur(),t.stopPropagation()))},handleRangeClick:function(){var t=this.type;-1===gi.indexOf(t)||this.pickerVisible||(this.pickerVisible=!0),this.$emit("focus",this)},hidePicker:function(){this.picker&&(this.picker.resetView&&this.picker.resetView(),this.pickerVisible=this.picker.visible=!1,this.destroyPopper())},showPicker:function(){var t=this;this.$isServer||(this.picker||this.mountPicker(),this.pickerVisible=this.picker.visible=!0,this.updatePopper(),this.picker.value=this.parsedValue,this.picker.resetView&&this.picker.resetView(),this.$nextTick(function(){t.picker.adjustSpinners&&t.picker.adjustSpinners()}))},mountPicker:function(){var t=this;this.picker=new hn.a(this.panel).$mount(),this.picker.defaultValue=this.defaultValue,this.picker.defaultTime=this.defaultTime,this.picker.popperClass=this.popperClass,this.popperElm=this.picker.$el,this.picker.width=this.reference.getBoundingClientRect().width,this.picker.showTime="datetime"===this.type||"datetimerange"===this.type,this.picker.selectionMode=this.selectionMode,this.picker.unlinkPanels=this.unlinkPanels,this.picker.arrowControl=this.arrowControl||this.timeArrowControl||!1,this.$watch("format",function(e){t.picker.format=e});var e=function(){var e=t.pickerOptions;if(e&&e.selectableRange){var n=e.selectableRange,i=bi.datetimerange.parser,r=fi.timerange;n=Array.isArray(n)?n:[n],t.picker.selectableRange=n.map(function(e){return i(e,r,t.rangeSeparator)})}for(var o in e)e.hasOwnProperty(o)&&"selectableRange"!==o&&(t.picker[o]=e[o]);t.format&&(t.picker.format=t.format)};e(),this.unwatchPickerOptions=this.$watch("pickerOptions",function(){return e()},{deep:!0}),this.$el.appendChild(this.picker.$el),this.picker.resetView&&this.picker.resetView(),this.picker.$on("dodestroy",this.doDestroy),this.picker.$on("pick",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.userInput=null,t.pickerVisible=t.picker.visible=n,t.emitInput(e),t.picker.resetView&&t.picker.resetView()}),this.picker.$on("select-range",function(e,n,i){0!==t.refInput.length&&(i&&"min"!==i?"max"===i&&(t.refInput[1].setSelectionRange(e,n),t.refInput[1].focus()):(t.refInput[0].setSelectionRange(e,n),t.refInput[0].focus()))})},unmountPicker:function(){this.picker&&(this.picker.$destroy(),this.picker.$off(),"function"==typeof this.unwatchPickerOptions&&this.unwatchPickerOptions(),this.picker.$el.parentNode.removeChild(this.picker.$el))},emitChange:function(t){Si(t,this.valueOnOpen)||(this.$emit("change",t),this.valueOnOpen=t,this.validateEvent&&this.dispatch("ElFormItem","el.form.change",t))},emitInput:function(t){var e=this.formatToValue(t);Si(this.value,e)||this.$emit("input",e)},isValidValue:function(t){return this.picker||this.mountPicker(),!this.picker.isValidValue||t&&this.picker.isValidValue(t)}}},hi,[],!1,null,null,null);xi.options.__file="packages/date-picker/src/picker.vue";var Ii=xi.exports,Ri=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-enter":t.handleEnter,"after-leave":t.handleLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-picker-panel el-date-picker el-popper",class:[{"has-sidebar":t.$slots.sidebar||t.shortcuts,"has-time":t.showTime},t.popperClass]},[n("div",{staticClass:"el-picker-panel__body-wrapper"},[t._t("sidebar"),t.shortcuts?n("div",{staticClass:"el-picker-panel__sidebar"},t._l(t.shortcuts,function(e,i){return n("button",{key:i,staticClass:"el-picker-panel__shortcut",attrs:{type:"button"},on:{click:function(n){t.handleShortcutClick(e)}}},[t._v(t._s(e.text))])}),0):t._e(),n("div",{staticClass:"el-picker-panel__body"},[t.showTime?n("div",{staticClass:"el-date-picker__time-header"},[n("span",{staticClass:"el-date-picker__editor-wrap"},[n("el-input",{attrs:{placeholder:t.t("el.datepicker.selectDate"),value:t.visibleDate,size:"small"},on:{input:function(e){return t.userInputDate=e},change:t.handleVisibleDateChange}})],1),n("span",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleTimePickClose,expression:"handleTimePickClose"}],staticClass:"el-date-picker__editor-wrap"},[n("el-input",{ref:"input",attrs:{placeholder:t.t("el.datepicker.selectTime"),value:t.visibleTime,size:"small"},on:{focus:function(e){t.timePickerVisible=!0},input:function(e){return t.userInputTime=e},change:t.handleVisibleTimeChange}}),n("time-picker",{ref:"timepicker",attrs:{"time-arrow-control":t.arrowControl,visible:t.timePickerVisible},on:{pick:t.handleTimePick,mounted:t.proxyTimePickerDataProperties}})],1)]):t._e(),n("div",{directives:[{name:"show",rawName:"v-show",value:"time"!==t.currentView,expression:"currentView !== 'time'"}],staticClass:"el-date-picker__header",class:{"el-date-picker__header--bordered":"year"===t.currentView||"month"===t.currentView}},[n("button",{staticClass:"el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",attrs:{type:"button","aria-label":t.t("el.datepicker.prevYear")},on:{click:t.prevYear}}),n("button",{directives:[{name:"show",rawName:"v-show",value:"date"===t.currentView,expression:"currentView === 'date'"}],staticClass:"el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",attrs:{type:"button","aria-label":t.t("el.datepicker.prevMonth")},on:{click:t.prevMonth}}),n("span",{staticClass:"el-date-picker__header-label",attrs:{role:"button"},on:{click:t.showYearPicker}},[t._v(t._s(t.yearLabel))]),n("span",{directives:[{name:"show",rawName:"v-show",value:"date"===t.currentView,expression:"currentView === 'date'"}],staticClass:"el-date-picker__header-label",class:{active:"month"===t.currentView},attrs:{role:"button"},on:{click:t.showMonthPicker}},[t._v(t._s(t.t("el.datepicker.month"+(t.month+1))))]),n("button",{staticClass:"el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",attrs:{type:"button","aria-label":t.t("el.datepicker.nextYear")},on:{click:t.nextYear}}),n("button",{directives:[{name:"show",rawName:"v-show",value:"date"===t.currentView,expression:"currentView === 'date'"}],staticClass:"el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",attrs:{type:"button","aria-label":t.t("el.datepicker.nextMonth")},on:{click:t.nextMonth}})]),n("div",{staticClass:"el-picker-panel__content"},[n("date-table",{directives:[{name:"show",rawName:"v-show",value:"date"===t.currentView,expression:"currentView === 'date'"}],attrs:{"selection-mode":t.selectionMode,"first-day-of-week":t.firstDayOfWeek,value:t.value,"default-value":t.defaultValue?new Date(t.defaultValue):null,date:t.date,"cell-class-name":t.cellClassName,"disabled-date":t.disabledDate},on:{pick:t.handleDatePick}}),n("year-table",{directives:[{name:"show",rawName:"v-show",value:"year"===t.currentView,expression:"currentView === 'year'"}],attrs:{value:t.value,"default-value":t.defaultValue?new Date(t.defaultValue):null,date:t.date,"disabled-date":t.disabledDate},on:{pick:t.handleYearPick}}),n("month-table",{directives:[{name:"show",rawName:"v-show",value:"month"===t.currentView,expression:"currentView === 'month'"}],attrs:{value:t.value,"default-value":t.defaultValue?new Date(t.defaultValue):null,date:t.date,"disabled-date":t.disabledDate},on:{pick:t.handleMonthPick}})],1)])],2),n("div",{directives:[{name:"show",rawName:"v-show",value:t.footerVisible&&"date"===t.currentView,expression:"footerVisible && currentView === 'date'"}],staticClass:"el-picker-panel__footer"},[n("el-button",{directives:[{name:"show",rawName:"v-show",value:"dates"!==t.selectionMode,expression:"selectionMode !== 'dates'"}],staticClass:"el-picker-panel__link-btn",attrs:{size:"mini",type:"text"},on:{click:t.changeToNow}},[t._v("\n "+t._s(t.t("el.datepicker.now"))+"\n ")]),n("el-button",{staticClass:"el-picker-panel__link-btn",attrs:{plain:"",size:"mini"},on:{click:t.confirm}},[t._v("\n "+t._s(t.t("el.datepicker.confirm"))+"\n ")])],1)])])};Ri._withStripped=!0;var Oi=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":function(e){t.$emit("dodestroy")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-time-panel el-popper",class:t.popperClass},[n("div",{staticClass:"el-time-panel__content",class:{"has-seconds":t.showSeconds}},[n("time-spinner",{ref:"spinner",attrs:{"arrow-control":t.useArrow,"show-seconds":t.showSeconds,"am-pm-mode":t.amPmMode,date:t.date},on:{change:t.handleChange,"select-range":t.setSelectionRange}})],1),n("div",{staticClass:"el-time-panel__footer"},[n("button",{staticClass:"el-time-panel__btn cancel",attrs:{type:"button"},on:{click:t.handleCancel}},[t._v(t._s(t.t("el.datepicker.cancel")))]),n("button",{staticClass:"el-time-panel__btn",class:{confirm:!t.disabled},attrs:{type:"button"},on:{click:function(e){t.handleConfirm()}}},[t._v(t._s(t.t("el.datepicker.confirm")))])])])])};Oi._withStripped=!0;var Di=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-time-spinner",class:{"has-seconds":t.showSeconds}},[t.arrowControl?t._e():[n("el-scrollbar",{ref:"hours",staticClass:"el-time-spinner__wrapper",attrs:{"wrap-style":"max-height: inherit;","view-class":"el-time-spinner__list",noresize:"",tag:"ul"},nativeOn:{mouseenter:function(e){t.emitSelectRange("hours")},mousemove:function(e){t.adjustCurrentSpinner("hours")}}},t._l(t.hoursList,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:i===t.hours,disabled:e},on:{click:function(n){t.handleClick("hours",{value:i,disabled:e})}}},[t._v(t._s(("0"+(t.amPmMode?i%12||12:i)).slice(-2))+t._s(t.amPm(i)))])}),0),n("el-scrollbar",{ref:"minutes",staticClass:"el-time-spinner__wrapper",attrs:{"wrap-style":"max-height: inherit;","view-class":"el-time-spinner__list",noresize:"",tag:"ul"},nativeOn:{mouseenter:function(e){t.emitSelectRange("minutes")},mousemove:function(e){t.adjustCurrentSpinner("minutes")}}},t._l(t.minutesList,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:i===t.minutes,disabled:!e},on:{click:function(e){t.handleClick("minutes",{value:i,disabled:!1})}}},[t._v(t._s(("0"+i).slice(-2)))])}),0),n("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:t.showSeconds,expression:"showSeconds"}],ref:"seconds",staticClass:"el-time-spinner__wrapper",attrs:{"wrap-style":"max-height: inherit;","view-class":"el-time-spinner__list",noresize:"",tag:"ul"},nativeOn:{mouseenter:function(e){t.emitSelectRange("seconds")},mousemove:function(e){t.adjustCurrentSpinner("seconds")}}},t._l(60,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:i===t.seconds},on:{click:function(e){t.handleClick("seconds",{value:i,disabled:!1})}}},[t._v(t._s(("0"+i).slice(-2)))])}),0)],t.arrowControl?[n("div",{staticClass:"el-time-spinner__wrapper is-arrow",on:{mouseenter:function(e){t.emitSelectRange("hours")}}},[n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),n("ul",{ref:"hours",staticClass:"el-time-spinner__list"},t._l(t.arrowHourList,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:e===t.hours,disabled:t.hoursList[e]}},[t._v(t._s(void 0===e?"":("0"+(t.amPmMode?e%12||12:e)).slice(-2)+t.amPm(e)))])}),0)]),n("div",{staticClass:"el-time-spinner__wrapper is-arrow",on:{mouseenter:function(e){t.emitSelectRange("minutes")}}},[n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),n("ul",{ref:"minutes",staticClass:"el-time-spinner__list"},t._l(t.arrowMinuteList,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:e===t.minutes}},[t._v("\n "+t._s(void 0===e?"":("0"+e).slice(-2))+"\n ")])}),0)]),t.showSeconds?n("div",{staticClass:"el-time-spinner__wrapper is-arrow",on:{mouseenter:function(e){t.emitSelectRange("seconds")}}},[n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-time-spinner__arrow el-icon-arrow-up"}),n("i",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-time-spinner__arrow el-icon-arrow-down"}),n("ul",{ref:"seconds",staticClass:"el-time-spinner__list"},t._l(t.arrowSecondList,function(e,i){return n("li",{key:i,staticClass:"el-time-spinner__item",class:{active:e===t.seconds}},[t._v("\n "+t._s(void 0===e?"":("0"+e).slice(-2))+"\n ")])}),0)]):t._e()]:t._e()],2)};Di._withStripped=!0;var Ai=r({components:{ElScrollbar:B.a},directives:{repeatClick:Xt},props:{date:{},defaultValue:{},showSeconds:{type:Boolean,default:!0},arrowControl:Boolean,amPmMode:{type:String,default:""}},computed:{hours:function(){return this.date.getHours()},minutes:function(){return this.date.getMinutes()},seconds:function(){return this.date.getSeconds()},hoursList:function(){return Object(pi.getRangeHours)(this.selectableRange)},minutesList:function(){return Object(pi.getRangeMinutes)(this.selectableRange,this.hours)},arrowHourList:function(){var t=this.hours;return[t>0?t-1:void 0,t,t<23?t+1:void 0]},arrowMinuteList:function(){var t=this.minutes;return[t>0?t-1:void 0,t,t<59?t+1:void 0]},arrowSecondList:function(){var t=this.seconds;return[t>0?t-1:void 0,t,t<59?t+1:void 0]}},data:function(){return{selectableRange:[],currentScrollbar:null}},mounted:function(){var t=this;this.$nextTick(function(){!t.arrowControl&&t.bindScrollEvent()})},methods:{increase:function(){this.scrollDown(1)},decrease:function(){this.scrollDown(-1)},modifyDateField:function(t,e){switch(t){case"hours":this.$emit("change",Object(pi.modifyTime)(this.date,e,this.minutes,this.seconds));break;case"minutes":this.$emit("change",Object(pi.modifyTime)(this.date,this.hours,e,this.seconds));break;case"seconds":this.$emit("change",Object(pi.modifyTime)(this.date,this.hours,this.minutes,e))}},handleClick:function(t,e){var n=e.value;e.disabled||(this.modifyDateField(t,n),this.emitSelectRange(t),this.adjustSpinner(t,n))},emitSelectRange:function(t){"hours"===t?this.$emit("select-range",0,2):"minutes"===t?this.$emit("select-range",3,5):"seconds"===t&&this.$emit("select-range",6,8),this.currentScrollbar=t},bindScrollEvent:function(){var t=this,e=function(e){t.$refs[e].wrap.onscroll=function(n){t.handleScroll(e,n)}};e("hours"),e("minutes"),e("seconds")},handleScroll:function(t){var e=Math.min(Math.round((this.$refs[t].wrap.scrollTop-(.5*this.scrollBarHeight(t)-10)/this.typeItemHeight(t)+3)/this.typeItemHeight(t)),"hours"===t?23:59);this.modifyDateField(t,e)},adjustSpinners:function(){this.adjustSpinner("hours",this.hours),this.adjustSpinner("minutes",this.minutes),this.adjustSpinner("seconds",this.seconds)},adjustCurrentSpinner:function(t){this.adjustSpinner(t,this[t])},adjustSpinner:function(t,e){if(!this.arrowControl){var n=this.$refs[t].wrap;n&&(n.scrollTop=Math.max(0,e*this.typeItemHeight(t)))}},scrollDown:function(t){var e=this;this.currentScrollbar||this.emitSelectRange("hours");var n=this.currentScrollbar,i=this.hoursList,r=this[n];if("hours"===this.currentScrollbar){var o=Math.abs(t);t=t>0?1:-1;for(var s=i.length;s--&&o;)i[r=(r+t+i.length)%i.length]||o--;if(i[r])return}else r=(r+t+60)%60;this.modifyDateField(n,r),this.adjustSpinner(n,r),this.$nextTick(function(){return e.emitSelectRange(e.currentScrollbar)})},amPm:function(t){if(!("a"===this.amPmMode.toLowerCase()))return"";var e="A"===this.amPmMode,n=t<12?" am":" pm";return e&&(n=n.toUpperCase()),n},typeItemHeight:function(t){return this.$refs[t].$el.querySelector("li").offsetHeight},scrollBarHeight:function(t){return this.$refs[t].$el.offsetHeight}}},Di,[],!1,null,null,null);Ai.options.__file="packages/date-picker/src/basic/time-spinner.vue";var Mi=Ai.exports,Ni=r({mixins:[f.a],components:{TimeSpinner:Mi},props:{visible:Boolean,timeArrowControl:Boolean},watch:{visible:function(t){var e=this;t?(this.oldValue=this.value,this.$nextTick(function(){return e.$refs.spinner.emitSelectRange("hours")})):this.needInitAdjust=!0},value:function(t){var e=this,n=void 0;t instanceof Date?n=Object(pi.limitTimeRange)(t,this.selectableRange,this.format):t||(n=this.defaultValue?new Date(this.defaultValue):new Date),this.date=n,this.visible&&this.needInitAdjust&&(this.$nextTick(function(t){return e.adjustSpinners()}),this.needInitAdjust=!1)},selectableRange:function(t){this.$refs.spinner.selectableRange=t},defaultValue:function(t){Object(pi.isDate)(this.value)||(this.date=t?new Date(t):new Date)}},data:function(){return{popperClass:"",format:"HH:mm:ss",value:"",defaultValue:null,date:new Date,oldValue:new Date,selectableRange:[],selectionRange:[0,2],disabled:!1,arrowControl:!1,needInitAdjust:!0}},computed:{showSeconds:function(){return-1!==(this.format||"").indexOf("ss")},useArrow:function(){return this.arrowControl||this.timeArrowControl||!1},amPmMode:function(){return-1!==(this.format||"").indexOf("A")?"A":-1!==(this.format||"").indexOf("a")?"a":""}},methods:{handleCancel:function(){this.$emit("pick",this.oldValue,!1)},handleChange:function(t){this.visible&&(this.date=Object(pi.clearMilliseconds)(t),this.isValidValue(this.date)&&this.$emit("pick",this.date,!0))},setSelectionRange:function(t,e){this.$emit("select-range",t,e),this.selectionRange=[t,e]},handleConfirm:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments[1];if(!e){var n=Object(pi.clearMilliseconds)(Object(pi.limitTimeRange)(this.date,this.selectableRange,this.format));this.$emit("pick",n,t,e)}},handleKeydown:function(t){var e=t.keyCode,n={38:-1,40:1,37:-1,39:1};if(37===e||39===e){var i=n[e];return this.changeSelectionRange(i),void t.preventDefault()}if(38===e||40===e){var r=n[e];return this.$refs.spinner.scrollDown(r),void t.preventDefault()}},isValidValue:function(t){return Object(pi.timeWithinRange)(t,this.selectableRange,this.format)},adjustSpinners:function(){return this.$refs.spinner.adjustSpinners()},changeSelectionRange:function(t){var e=[0,3].concat(this.showSeconds?[6]:[]),n=["hours","minutes"].concat(this.showSeconds?["seconds"]:[]),i=(e.indexOf(this.selectionRange[0])+t+e.length)%e.length;this.$refs.spinner.emitSelectRange(n[i])}},mounted:function(){var t=this;this.$nextTick(function(){return t.handleConfirm(!0,!0)}),this.$emit("mounted")}},Oi,[],!1,null,null,null);Ni.options.__file="packages/date-picker/src/panel/time.vue";var Li=Ni.exports,Pi=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("table",{staticClass:"el-year-table",on:{click:t.handleYearTableClick}},[n("tbody",[n("tr",[n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+0)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+1)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+1))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+2)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+2))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+3)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+3))])])]),n("tr",[n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+4)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+4))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+5)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+5))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+6)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+6))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+7)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+7))])])]),n("tr",[n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+8)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+8))])]),n("td",{staticClass:"available",class:t.getCellStyle(t.startYear+9)},[n("a",{staticClass:"cell"},[t._v(t._s(t.startYear+9))])]),n("td"),n("td")])])])};Pi._withStripped=!0;var Bi=r({props:{disabledDate:{},value:{},defaultValue:{validator:function(t){return null===t||t instanceof Date&&Object(pi.isDate)(t)}},date:{}},computed:{startYear:function(){return 10*Math.floor(this.date.getFullYear()/10)}},methods:{getCellStyle:function(t){var e={},n=new Date;return e.disabled="function"==typeof this.disabledDate&&function(t){var e=Object(pi.getDayCountOfYear)(t),n=new Date(t,0,1);return Object(pi.range)(e).map(function(t){return Object(pi.nextDate)(n,t)})}(t).every(this.disabledDate),e.current=Object(g.arrayFindIndex)(Object(g.coerceTruthyValueToArray)(this.value),function(e){return e.getFullYear()===t})>=0,e.today=n.getFullYear()===t,e.default=this.defaultValue&&this.defaultValue.getFullYear()===t,e},handleYearTableClick:function(t){var e=t.target;if("A"===e.tagName){if(Object(ft.hasClass)(e.parentNode,"disabled"))return;var n=e.textContent||e.innerText;this.$emit("pick",Number(n))}}}},Pi,[],!1,null,null,null);Bi.options.__file="packages/date-picker/src/basic/year-table.vue";var Fi=Bi.exports,Ui=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("table",{staticClass:"el-month-table",on:{click:t.handleMonthTableClick,mousemove:t.handleMouseMove}},[n("tbody",t._l(t.rows,function(e,i){return n("tr",{key:i},t._l(e,function(e,i){return n("td",{key:i,class:t.getCellStyle(e)},[n("div",[n("a",{staticClass:"cell"},[t._v(t._s(t.t("el.datepicker.months."+t.months[e.text])))])])])}),0)}),0)])};Ui._withStripped=!0;var Vi=function(t){return new Date(t.getFullYear(),t.getMonth())},Hi=function(t){return"number"==typeof t||"string"==typeof t?Vi(new Date(t)).getTime():t instanceof Date?Vi(t).getTime():NaN},Wi=r({props:{disabledDate:{},value:{},selectionMode:{default:"month"},minDate:{},maxDate:{},defaultValue:{validator:function(t){return null===t||Object(pi.isDate)(t)||Array.isArray(t)&&t.every(pi.isDate)}},date:{},rangeState:{default:function(){return{endDate:null,selecting:!1}}}},mixins:[f.a],watch:{"rangeState.endDate":function(t){this.markRange(this.minDate,t)},minDate:function(t,e){Hi(t)!==Hi(e)&&this.markRange(this.minDate,this.maxDate)},maxDate:function(t,e){Hi(t)!==Hi(e)&&this.markRange(this.minDate,this.maxDate)}},data:function(){return{months:["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],tableRows:[[],[],[]],lastRow:null,lastColumn:null}},methods:{cellMatchesDate:function(t,e){var n=new Date(e);return this.date.getFullYear()===n.getFullYear()&&Number(t.text)===n.getMonth()},getCellStyle:function(t){var e=this,n={},i=this.date.getFullYear(),r=new Date,o=t.text,s=this.defaultValue?Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue]:[];return n.disabled="function"==typeof this.disabledDate&&function(t,e){var n=Object(pi.getDayCountOfMonth)(t,e),i=new Date(t,e,1);return Object(pi.range)(n).map(function(t){return Object(pi.nextDate)(i,t)})}(i,o).every(this.disabledDate),n.current=Object(g.arrayFindIndex)(Object(g.coerceTruthyValueToArray)(this.value),function(t){return t.getFullYear()===i&&t.getMonth()===o})>=0,n.today=r.getFullYear()===i&&r.getMonth()===o,n.default=s.some(function(n){return e.cellMatchesDate(t,n)}),t.inRange&&(n["in-range"]=!0,t.start&&(n["start-date"]=!0),t.end&&(n["end-date"]=!0)),n},getMonthOfCell:function(t){var e=this.date.getFullYear();return new Date(e,t,1)},markRange:function(t,e){t=Hi(t),e=Hi(e)||t;var n=[Math.min(t,e),Math.max(t,e)];t=n[0],e=n[1];for(var i=this.rows,r=0,o=i.length;r<o;r++)for(var s=i[r],a=0,l=s.length;a<l;a++){var u=s[a],c=4*r+a,h=new Date(this.date.getFullYear(),c).getTime();u.inRange=t&&h>=t&&h<=e,u.start=t&&h===t,u.end=e&&h===e}},handleMouseMove:function(t){if(this.rangeState.selecting){var e=t.target;if("A"===e.tagName&&(e=e.parentNode.parentNode),"DIV"===e.tagName&&(e=e.parentNode),"TD"===e.tagName){var n=e.parentNode.rowIndex,i=e.cellIndex;this.rows[n][i].disabled||n===this.lastRow&&i===this.lastColumn||(this.lastRow=n,this.lastColumn=i,this.$emit("changerange",{minDate:this.minDate,maxDate:this.maxDate,rangeState:{selecting:!0,endDate:this.getMonthOfCell(4*n+i)}}))}}},handleMonthTableClick:function(t){var e=t.target;if("A"===e.tagName&&(e=e.parentNode.parentNode),"DIV"===e.tagName&&(e=e.parentNode),"TD"===e.tagName&&!Object(ft.hasClass)(e,"disabled")){var n=e.cellIndex,i=4*e.parentNode.rowIndex+n,r=this.getMonthOfCell(i);"range"===this.selectionMode?this.rangeState.selecting?(r>=this.minDate?this.$emit("pick",{minDate:this.minDate,maxDate:r}):this.$emit("pick",{minDate:r,maxDate:this.minDate}),this.rangeState.selecting=!1):(this.$emit("pick",{minDate:r,maxDate:null}),this.rangeState.selecting=!0):this.$emit("pick",i)}}},computed:{rows:function(){for(var t=this,e=this.tableRows,n=this.disabledDate,i=[],r=Hi(new Date),o=0;o<3;o++)for(var s=e[o],a=function(e){var a=s[e];a||(a={row:o,column:e,type:"normal",inRange:!1,start:!1,end:!1}),a.type="normal";var l=4*o+e,u=new Date(t.date.getFullYear(),l).getTime();a.inRange=u>=Hi(t.minDate)&&u<=Hi(t.maxDate),a.start=t.minDate&&u===Hi(t.minDate),a.end=t.maxDate&&u===Hi(t.maxDate),u===r&&(a.type="today"),a.text=l;var c=new Date(u);a.disabled="function"==typeof n&&n(c),a.selected=Object(g.arrayFind)(i,function(t){return t.getTime()===c.getTime()}),t.$set(s,e,a)},l=0;l<4;l++)a(l);return e}}},Ui,[],!1,null,null,null);Wi.options.__file="packages/date-picker/src/basic/month-table.vue";var Gi=Wi.exports,ji=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("table",{staticClass:"el-date-table",class:{"is-week-mode":"week"===t.selectionMode},attrs:{cellspacing:"0",cellpadding:"0"},on:{click:t.handleClick,mousemove:t.handleMouseMove}},[n("tbody",[n("tr",[t.showWeekNumber?n("th",[t._v(t._s(t.t("el.datepicker.week")))]):t._e(),t._l(t.WEEKS,function(e,i){return n("th",{key:i},[t._v(t._s(t.t("el.datepicker.weeks."+e)))])})],2),t._l(t.rows,function(e,i){return n("tr",{key:i,staticClass:"el-date-table__row",class:{current:t.isWeekActive(e[1])}},t._l(e,function(e,i){return n("td",{key:i,class:t.getCellClasses(e)},[n("div",[n("span",[t._v("\n "+t._s(e.text)+"\n ")])])])}),0)})],2)])};ji._withStripped=!0;var zi=["sun","mon","tue","wed","thu","fri","sat"],$i=function(t){return"number"==typeof t||"string"==typeof t?Object(pi.clearTime)(new Date(t)).getTime():t instanceof Date?Object(pi.clearTime)(t).getTime():NaN},Xi=r({mixins:[f.a],props:{firstDayOfWeek:{default:7,type:Number,validator:function(t){return t>=1&&t<=7}},value:{},defaultValue:{validator:function(t){return null===t||Object(pi.isDate)(t)||Array.isArray(t)&&t.every(pi.isDate)}},date:{},selectionMode:{default:"day"},showWeekNumber:{type:Boolean,default:!1},disabledDate:{},cellClassName:{},minDate:{},maxDate:{},rangeState:{default:function(){return{endDate:null,selecting:!1}}}},computed:{offsetDay:function(){var t=this.firstDayOfWeek;return t>3?7-t:-t},WEEKS:function(){var t=this.firstDayOfWeek;return zi.concat(zi).slice(t,t+7)},year:function(){return this.date.getFullYear()},month:function(){return this.date.getMonth()},startDate:function(){return Object(pi.getStartDateOfMonth)(this.year,this.month)},rows:function(){var t=this,e=new Date(this.year,this.month,1),n=Object(pi.getFirstDayOfMonth)(e),i=Object(pi.getDayCountOfMonth)(e.getFullYear(),e.getMonth()),r=Object(pi.getDayCountOfMonth)(e.getFullYear(),0===e.getMonth()?11:e.getMonth()-1);n=0===n?7:n;for(var o=this.offsetDay,s=this.tableRows,a=1,l=this.startDate,u=this.disabledDate,c=this.cellClassName,h="dates"===this.selectionMode?Object(g.coerceTruthyValueToArray)(this.value):[],p=$i(new Date),d=0;d<6;d++){var f=s[d];this.showWeekNumber&&(f[0]||(f[0]={type:"week",text:Object(pi.getWeekNumber)(Object(pi.nextDate)(l,7*d+1))}));for(var m=function(e){var s=f[t.showWeekNumber?e+1:e];s||(s={row:d,column:e,type:"normal",inRange:!1,start:!1,end:!1}),s.type="normal";var m=7*d+e,v=Object(pi.nextDate)(l,m-o).getTime();if(s.inRange=v>=$i(t.minDate)&&v<=$i(t.maxDate),s.start=t.minDate&&v===$i(t.minDate),s.end=t.maxDate&&v===$i(t.maxDate),v===p&&(s.type="today"),d>=0&&d<=1){var _=n+o<0?7+n+o:n+o;e+7*d>=_?s.text=a++:(s.text=r-(_-e%7)+1+7*d,s.type="prev-month")}else a<=i?s.text=a++:(s.text=a++-i,s.type="next-month");var y=new Date(v);s.disabled="function"==typeof u&&u(y),s.selected=Object(g.arrayFind)(h,function(t){return t.getTime()===y.getTime()}),s.customClass="function"==typeof c&&c(y),t.$set(f,t.showWeekNumber?e+1:e,s)},v=0;v<7;v++)m(v);if("week"===this.selectionMode){var _=this.showWeekNumber?1:0,y=this.showWeekNumber?7:6,b=this.isWeekActive(f[_+1]);f[_].inRange=b,f[_].start=b,f[y].inRange=b,f[y].end=b}}return s}},watch:{"rangeState.endDate":function(t){this.markRange(this.minDate,t)},minDate:function(t,e){$i(t)!==$i(e)&&this.markRange(this.minDate,this.maxDate)},maxDate:function(t,e){$i(t)!==$i(e)&&this.markRange(this.minDate,this.maxDate)}},data:function(){return{tableRows:[[],[],[],[],[],[]],lastRow:null,lastColumn:null}},methods:{cellMatchesDate:function(t,e){var n=new Date(e);return this.year===n.getFullYear()&&this.month===n.getMonth()&&Number(t.text)===n.getDate()},getCellClasses:function(t){var e=this,n=this.selectionMode,i=this.defaultValue?Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue]:[],r=[];return"normal"!==t.type&&"today"!==t.type||t.disabled?r.push(t.type):(r.push("available"),"today"===t.type&&r.push("today")),"normal"===t.type&&i.some(function(n){return e.cellMatchesDate(t,n)})&&r.push("default"),"day"!==n||"normal"!==t.type&&"today"!==t.type||!this.cellMatchesDate(t,this.value)||r.push("current"),!t.inRange||"normal"!==t.type&&"today"!==t.type&&"week"!==this.selectionMode||(r.push("in-range"),t.start&&r.push("start-date"),t.end&&r.push("end-date")),t.disabled&&r.push("disabled"),t.selected&&r.push("selected"),t.customClass&&r.push(t.customClass),r.join(" ")},getDateOfCell:function(t,e){var n=7*t+(e-(this.showWeekNumber?1:0))-this.offsetDay;return Object(pi.nextDate)(this.startDate,n)},isWeekActive:function(t){if("week"!==this.selectionMode)return!1;var e=new Date(this.year,this.month,1),n=e.getFullYear(),i=e.getMonth();if("prev-month"===t.type&&(e.setMonth(0===i?11:i-1),e.setFullYear(0===i?n-1:n)),"next-month"===t.type&&(e.setMonth(11===i?0:i+1),e.setFullYear(11===i?n+1:n)),e.setDate(parseInt(t.text,10)),Object(pi.isDate)(this.value)){var r=(this.value.getDay()-this.firstDayOfWeek+7)%7-1;return Object(pi.prevDate)(this.value,r).getTime()===e.getTime()}return!1},markRange:function(t,e){t=$i(t),e=$i(e)||t;var n=[Math.min(t,e),Math.max(t,e)];t=n[0],e=n[1];for(var i=this.startDate,r=this.rows,o=0,s=r.length;o<s;o++)for(var a=r[o],l=0,u=a.length;l<u;l++)if(!this.showWeekNumber||0!==l){var c=a[l],h=7*o+l+(this.showWeekNumber?-1:0),p=Object(pi.nextDate)(i,h-this.offsetDay).getTime();c.inRange=t&&p>=t&&p<=e,c.start=t&&p===t,c.end=e&&p===e}},handleMouseMove:function(t){if(this.rangeState.selecting){var e=t.target;if("SPAN"===e.tagName&&(e=e.parentNode.parentNode),"DIV"===e.tagName&&(e=e.parentNode),"TD"===e.tagName){var n=e.parentNode.rowIndex-1,i=e.cellIndex;this.rows[n][i].disabled||n===this.lastRow&&i===this.lastColumn||(this.lastRow=n,this.lastColumn=i,this.$emit("changerange",{minDate:this.minDate,maxDate:this.maxDate,rangeState:{selecting:!0,endDate:this.getDateOfCell(n,i)}}))}}},handleClick:function(t){var e=t.target;if("SPAN"===e.tagName&&(e=e.parentNode.parentNode),"DIV"===e.tagName&&(e=e.parentNode),"TD"===e.tagName){var n=e.parentNode.rowIndex-1,i="week"===this.selectionMode?1:e.cellIndex,r=this.rows[n][i];if(!r.disabled&&"week"!==r.type){var o,s,a,l=this.getDateOfCell(n,i);if("range"===this.selectionMode)this.rangeState.selecting?(l>=this.minDate?this.$emit("pick",{minDate:this.minDate,maxDate:l}):this.$emit("pick",{minDate:l,maxDate:this.minDate}),this.rangeState.selecting=!1):(this.$emit("pick",{minDate:l,maxDate:null}),this.rangeState.selecting=!0);else if("day"===this.selectionMode)this.$emit("pick",l);else if("week"===this.selectionMode){var u=Object(pi.getWeekNumber)(l),c=l.getFullYear()+"w"+u;this.$emit("pick",{year:l.getFullYear(),week:u,value:c,date:l})}else if("dates"===this.selectionMode){var h=this.value||[],p=r.selected?(o=h,(a="function"==typeof(s=function(t){return t.getTime()===l.getTime()})?Object(g.arrayFindIndex)(o,s):o.indexOf(s))>=0?[].concat(o.slice(0,a),o.slice(a+1)):o):[].concat(h,[l]);this.$emit("pick",p)}}}}}},ji,[],!1,null,null,null);Xi.options.__file="packages/date-picker/src/basic/date-table.vue";var Yi=Xi.exports,Ki=r({mixins:[f.a],directives:{Clickoutside:A.a},watch:{showTime:function(t){var e=this;t&&this.$nextTick(function(t){var n=e.$refs.input.$el;n&&(e.pickerWidth=n.getBoundingClientRect().width+10)})},value:function(t){"dates"===this.selectionMode&&this.value||(Object(pi.isDate)(t)?this.date=new Date(t):this.date=this.getDefaultValue())},defaultValue:function(t){Object(pi.isDate)(this.value)||(this.date=t?new Date(t):new Date)},timePickerVisible:function(t){var e=this;t&&this.$nextTick(function(){return e.$refs.timepicker.adjustSpinners()})},selectionMode:function(t){"month"===t?"year"===this.currentView&&"month"===this.currentView||(this.currentView="month"):"dates"===t&&(this.currentView="date")}},methods:{proxyTimePickerDataProperties:function(){var t,e=this,n=function(t){e.$refs.timepicker.value=t},i=function(t){e.$refs.timepicker.date=t},r=function(t){e.$refs.timepicker.selectableRange=t};this.$watch("value",n),this.$watch("date",i),this.$watch("selectableRange",r),t=this.timeFormat,e.$refs.timepicker.format=t,n(this.value),i(this.date),r(this.selectableRange)},handleClear:function(){this.date=this.getDefaultValue(),this.$emit("pick",null)},emit:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];if(t)if(Array.isArray(t)){var o=t.map(function(t){return e.showTime?Object(pi.clearMilliseconds)(t):Object(pi.clearTime)(t)});this.$emit.apply(this,["pick",o].concat(i))}else this.$emit.apply(this,["pick",this.showTime?Object(pi.clearMilliseconds)(t):Object(pi.clearTime)(t)].concat(i));else this.$emit.apply(this,["pick",t].concat(i));this.userInputDate=null,this.userInputTime=null},showMonthPicker:function(){this.currentView="month"},showYearPicker:function(){this.currentView="year"},prevMonth:function(){this.date=Object(pi.prevMonth)(this.date)},nextMonth:function(){this.date=Object(pi.nextMonth)(this.date)},prevYear:function(){"year"===this.currentView?this.date=Object(pi.prevYear)(this.date,10):this.date=Object(pi.prevYear)(this.date)},nextYear:function(){"year"===this.currentView?this.date=Object(pi.nextYear)(this.date,10):this.date=Object(pi.nextYear)(this.date)},handleShortcutClick:function(t){t.onClick&&t.onClick(this)},handleTimePick:function(t,e,n){if(Object(pi.isDate)(t)){var i=this.value?Object(pi.modifyTime)(this.value,t.getHours(),t.getMinutes(),t.getSeconds()):Object(pi.modifyWithTimeString)(this.getDefaultValue(),this.defaultTime);this.date=i,this.emit(this.date,!0)}else this.emit(t,!0);n||(this.timePickerVisible=e)},handleTimePickClose:function(){this.timePickerVisible=!1},handleMonthPick:function(t){"month"===this.selectionMode?(this.date=Object(pi.modifyDate)(this.date,this.year,t,1),this.emit(this.date)):(this.date=Object(pi.changeYearMonthAndClampDate)(this.date,this.year,t),this.currentView="date")},handleDatePick:function(t){if("day"===this.selectionMode){var e=this.value?Object(pi.modifyDate)(this.value,t.getFullYear(),t.getMonth(),t.getDate()):Object(pi.modifyWithTimeString)(t,this.defaultTime);this.checkDateWithinRange(e)||(e=Object(pi.modifyDate)(this.selectableRange[0][0],t.getFullYear(),t.getMonth(),t.getDate())),this.date=e,this.emit(this.date,this.showTime)}else"week"===this.selectionMode?this.emit(t.date):"dates"===this.selectionMode&&this.emit(t,!0)},handleYearPick:function(t){"year"===this.selectionMode?(this.date=Object(pi.modifyDate)(this.date,t,0,1),this.emit(this.date)):(this.date=Object(pi.changeYearMonthAndClampDate)(this.date,t,this.month),this.currentView="month")},changeToNow:function(){this.disabledDate&&this.disabledDate(new Date)||!this.checkDateWithinRange(new Date)||(this.date=new Date,this.emit(this.date))},confirm:function(){if("dates"===this.selectionMode)this.emit(this.value);else{var t=this.value?this.value:Object(pi.modifyWithTimeString)(this.getDefaultValue(),this.defaultTime);this.date=new Date(t),this.emit(t)}},resetView:function(){"month"===this.selectionMode?this.currentView="month":"year"===this.selectionMode?this.currentView="year":this.currentView="date"},handleEnter:function(){document.body.addEventListener("keydown",this.handleKeydown)},handleLeave:function(){this.$emit("dodestroy"),document.body.removeEventListener("keydown",this.handleKeydown)},handleKeydown:function(t){var e=t.keyCode;this.visible&&!this.timePickerVisible&&(-1!==[38,40,37,39].indexOf(e)&&(this.handleKeyControl(e),t.stopPropagation(),t.preventDefault()),13===e&&null===this.userInputDate&&null===this.userInputTime&&this.emit(this.date,!1))},handleKeyControl:function(t){for(var e={year:{38:-4,40:4,37:-1,39:1,offset:function(t,e){return t.setFullYear(t.getFullYear()+e)}},month:{38:-4,40:4,37:-1,39:1,offset:function(t,e){return t.setMonth(t.getMonth()+e)}},week:{38:-1,40:1,37:-1,39:1,offset:function(t,e){return t.setDate(t.getDate()+7*e)}},day:{38:-7,40:7,37:-1,39:1,offset:function(t,e){return t.setDate(t.getDate()+e)}}},n=this.selectionMode,i=this.date.getTime(),r=new Date(this.date.getTime());Math.abs(i-r.getTime())<=31536e6;){var o=e[n];if(o.offset(r,o[t]),"function"!=typeof this.disabledDate||!this.disabledDate(r)){this.date=r,this.$emit("pick",r,!0);break}}},handleVisibleTimeChange:function(t){var e=Object(pi.parseDate)(t,this.timeFormat);e&&this.checkDateWithinRange(e)&&(this.date=Object(pi.modifyDate)(e,this.year,this.month,this.monthDate),this.userInputTime=null,this.$refs.timepicker.value=this.date,this.timePickerVisible=!1,this.emit(this.date,!0))},handleVisibleDateChange:function(t){var e=Object(pi.parseDate)(t,this.dateFormat);if(e){if("function"==typeof this.disabledDate&&this.disabledDate(e))return;this.date=Object(pi.modifyTime)(e,this.date.getHours(),this.date.getMinutes(),this.date.getSeconds()),this.userInputDate=null,this.resetView(),this.emit(this.date,!0)}},isValidValue:function(t){return t&&!isNaN(t)&&("function"!=typeof this.disabledDate||!this.disabledDate(t))&&this.checkDateWithinRange(t)},getDefaultValue:function(){return this.defaultValue?new Date(this.defaultValue):new Date},checkDateWithinRange:function(t){return!(this.selectableRange.length>0)||Object(pi.timeWithinRange)(t,this.selectableRange,this.format||"HH:mm:ss")}},components:{TimePicker:Li,YearTable:Fi,MonthTable:Gi,DateTable:Yi,ElInput:p.a,ElButton:$.a},data:function(){return{popperClass:"",date:new Date,value:"",defaultValue:null,defaultTime:null,showTime:!1,selectionMode:"day",shortcuts:"",visible:!1,currentView:"date",disabledDate:"",cellClassName:"",selectableRange:[],firstDayOfWeek:7,showWeekNumber:!1,timePickerVisible:!1,format:"",arrowControl:!1,userInputDate:null,userInputTime:null}},computed:{year:function(){return this.date.getFullYear()},month:function(){return this.date.getMonth()},week:function(){return Object(pi.getWeekNumber)(this.date)},monthDate:function(){return this.date.getDate()},footerVisible:function(){return this.showTime||"dates"===this.selectionMode},visibleTime:function(){return null!==this.userInputTime?this.userInputTime:Object(pi.formatDate)(this.value||this.defaultValue,this.timeFormat)},visibleDate:function(){return null!==this.userInputDate?this.userInputDate:Object(pi.formatDate)(this.value||this.defaultValue,this.dateFormat)},yearLabel:function(){var t=this.t("el.datepicker.year");if("year"===this.currentView){var e=10*Math.floor(this.year/10);return t?e+" "+t+" - "+(e+9)+" "+t:e+" - "+(e+9)}return this.year+" "+t},timeFormat:function(){return this.format?Object(pi.extractTimeFormat)(this.format):"HH:mm:ss"},dateFormat:function(){return this.format?Object(pi.extractDateFormat)(this.format):"yyyy-MM-dd"}}},Ri,[],!1,null,null,null);Ki.options.__file="packages/date-picker/src/panel/date.vue";var Ji=Ki.exports,qi=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":function(e){t.$emit("dodestroy")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-picker-panel el-date-range-picker el-popper",class:[{"has-sidebar":t.$slots.sidebar||t.shortcuts,"has-time":t.showTime},t.popperClass]},[n("div",{staticClass:"el-picker-panel__body-wrapper"},[t._t("sidebar"),t.shortcuts?n("div",{staticClass:"el-picker-panel__sidebar"},t._l(t.shortcuts,function(e,i){return n("button",{key:i,staticClass:"el-picker-panel__shortcut",attrs:{type:"button"},on:{click:function(n){t.handleShortcutClick(e)}}},[t._v(t._s(e.text))])}),0):t._e(),n("div",{staticClass:"el-picker-panel__body"},[t.showTime?n("div",{staticClass:"el-date-range-picker__time-header"},[n("span",{staticClass:"el-date-range-picker__editors-wrap"},[n("span",{staticClass:"el-date-range-picker__time-picker-wrap"},[n("el-input",{ref:"minInput",staticClass:"el-date-range-picker__editor",attrs:{size:"small",disabled:t.rangeState.selecting,placeholder:t.t("el.datepicker.startDate"),value:t.minVisibleDate},on:{input:function(e){return t.handleDateInput(e,"min")},change:function(e){return t.handleDateChange(e,"min")}}})],1),n("span",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleMinTimeClose,expression:"handleMinTimeClose"}],staticClass:"el-date-range-picker__time-picker-wrap"},[n("el-input",{staticClass:"el-date-range-picker__editor",attrs:{size:"small",disabled:t.rangeState.selecting,placeholder:t.t("el.datepicker.startTime"),value:t.minVisibleTime},on:{focus:function(e){t.minTimePickerVisible=!0},input:function(e){return t.handleTimeInput(e,"min")},change:function(e){return t.handleTimeChange(e,"min")}}}),n("time-picker",{ref:"minTimePicker",attrs:{"time-arrow-control":t.arrowControl,visible:t.minTimePickerVisible},on:{pick:t.handleMinTimePick,mounted:function(e){t.$refs.minTimePicker.format=t.timeFormat}}})],1)]),n("span",{staticClass:"el-icon-arrow-right"}),n("span",{staticClass:"el-date-range-picker__editors-wrap is-right"},[n("span",{staticClass:"el-date-range-picker__time-picker-wrap"},[n("el-input",{staticClass:"el-date-range-picker__editor",attrs:{size:"small",disabled:t.rangeState.selecting,placeholder:t.t("el.datepicker.endDate"),value:t.maxVisibleDate,readonly:!t.minDate},on:{input:function(e){return t.handleDateInput(e,"max")},change:function(e){return t.handleDateChange(e,"max")}}})],1),n("span",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.handleMaxTimeClose,expression:"handleMaxTimeClose"}],staticClass:"el-date-range-picker__time-picker-wrap"},[n("el-input",{staticClass:"el-date-range-picker__editor",attrs:{size:"small",disabled:t.rangeState.selecting,placeholder:t.t("el.datepicker.endTime"),value:t.maxVisibleTime,readonly:!t.minDate},on:{focus:function(e){t.minDate&&(t.maxTimePickerVisible=!0)},input:function(e){return t.handleTimeInput(e,"max")},change:function(e){return t.handleTimeChange(e,"max")}}}),n("time-picker",{ref:"maxTimePicker",attrs:{"time-arrow-control":t.arrowControl,visible:t.maxTimePickerVisible},on:{pick:t.handleMaxTimePick,mounted:function(e){t.$refs.maxTimePicker.format=t.timeFormat}}})],1)])]):t._e(),n("div",{staticClass:"el-picker-panel__content el-date-range-picker__content is-left"},[n("div",{staticClass:"el-date-range-picker__header"},[n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-left",attrs:{type:"button"},on:{click:t.leftPrevYear}}),n("button",{staticClass:"el-picker-panel__icon-btn el-icon-arrow-left",attrs:{type:"button"},on:{click:t.leftPrevMonth}}),t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-right",class:{"is-disabled":!t.enableYearArrow},attrs:{type:"button",disabled:!t.enableYearArrow},on:{click:t.leftNextYear}}):t._e(),t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-arrow-right",class:{"is-disabled":!t.enableMonthArrow},attrs:{type:"button",disabled:!t.enableMonthArrow},on:{click:t.leftNextMonth}}):t._e(),n("div",[t._v(t._s(t.leftLabel))])]),n("date-table",{attrs:{"selection-mode":"range",date:t.leftDate,"default-value":t.defaultValue,"min-date":t.minDate,"max-date":t.maxDate,"range-state":t.rangeState,"disabled-date":t.disabledDate,"cell-class-name":t.cellClassName,"first-day-of-week":t.firstDayOfWeek},on:{changerange:t.handleChangeRange,pick:t.handleRangePick}})],1),n("div",{staticClass:"el-picker-panel__content el-date-range-picker__content is-right"},[n("div",{staticClass:"el-date-range-picker__header"},[t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-left",class:{"is-disabled":!t.enableYearArrow},attrs:{type:"button",disabled:!t.enableYearArrow},on:{click:t.rightPrevYear}}):t._e(),t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-arrow-left",class:{"is-disabled":!t.enableMonthArrow},attrs:{type:"button",disabled:!t.enableMonthArrow},on:{click:t.rightPrevMonth}}):t._e(),n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-right",attrs:{type:"button"},on:{click:t.rightNextYear}}),n("button",{staticClass:"el-picker-panel__icon-btn el-icon-arrow-right",attrs:{type:"button"},on:{click:t.rightNextMonth}}),n("div",[t._v(t._s(t.rightLabel))])]),n("date-table",{attrs:{"selection-mode":"range",date:t.rightDate,"default-value":t.defaultValue,"min-date":t.minDate,"max-date":t.maxDate,"range-state":t.rangeState,"disabled-date":t.disabledDate,"cell-class-name":t.cellClassName,"first-day-of-week":t.firstDayOfWeek},on:{changerange:t.handleChangeRange,pick:t.handleRangePick}})],1)])],2),t.showTime?n("div",{staticClass:"el-picker-panel__footer"},[n("el-button",{staticClass:"el-picker-panel__link-btn",attrs:{size:"mini",type:"text"},on:{click:t.handleClear}},[t._v("\n "+t._s(t.t("el.datepicker.clear"))+"\n ")]),n("el-button",{staticClass:"el-picker-panel__link-btn",attrs:{plain:"",size:"mini",disabled:t.btnDisabled},on:{click:function(e){t.handleConfirm(!1)}}},[t._v("\n "+t._s(t.t("el.datepicker.confirm"))+"\n ")])],1):t._e()])])};qi._withStripped=!0;var Zi=function(t){return Array.isArray(t)?[new Date(t[0]),new Date(t[1])]:t?[new Date(t),Object(pi.nextDate)(new Date(t),1)]:[new Date,Object(pi.nextDate)(new Date,1)]},Qi=r({mixins:[f.a],directives:{Clickoutside:A.a},computed:{btnDisabled:function(){return!(this.minDate&&this.maxDate&&!this.selecting&&this.isValidValue([this.minDate,this.maxDate]))},leftLabel:function(){return this.leftDate.getFullYear()+" "+this.t("el.datepicker.year")+" "+this.t("el.datepicker.month"+(this.leftDate.getMonth()+1))},rightLabel:function(){return this.rightDate.getFullYear()+" "+this.t("el.datepicker.year")+" "+this.t("el.datepicker.month"+(this.rightDate.getMonth()+1))},leftYear:function(){return this.leftDate.getFullYear()},leftMonth:function(){return this.leftDate.getMonth()},leftMonthDate:function(){return this.leftDate.getDate()},rightYear:function(){return this.rightDate.getFullYear()},rightMonth:function(){return this.rightDate.getMonth()},rightMonthDate:function(){return this.rightDate.getDate()},minVisibleDate:function(){return null!==this.dateUserInput.min?this.dateUserInput.min:this.minDate?Object(pi.formatDate)(this.minDate,this.dateFormat):""},maxVisibleDate:function(){return null!==this.dateUserInput.max?this.dateUserInput.max:this.maxDate||this.minDate?Object(pi.formatDate)(this.maxDate||this.minDate,this.dateFormat):""},minVisibleTime:function(){return null!==this.timeUserInput.min?this.timeUserInput.min:this.minDate?Object(pi.formatDate)(this.minDate,this.timeFormat):""},maxVisibleTime:function(){return null!==this.timeUserInput.max?this.timeUserInput.max:this.maxDate||this.minDate?Object(pi.formatDate)(this.maxDate||this.minDate,this.timeFormat):""},timeFormat:function(){return this.format?Object(pi.extractTimeFormat)(this.format):"HH:mm:ss"},dateFormat:function(){return this.format?Object(pi.extractDateFormat)(this.format):"yyyy-MM-dd"},enableMonthArrow:function(){var t=(this.leftMonth+1)%12,e=this.leftMonth+1>=12?1:0;return this.unlinkPanels&&new Date(this.leftYear+e,t)<new Date(this.rightYear,this.rightMonth)},enableYearArrow:function(){return this.unlinkPanels&&12*this.rightYear+this.rightMonth-(12*this.leftYear+this.leftMonth+1)>=12}},data:function(){return{popperClass:"",value:[],defaultValue:null,defaultTime:null,minDate:"",maxDate:"",leftDate:new Date,rightDate:Object(pi.nextMonth)(new Date),rangeState:{endDate:null,selecting:!1,row:null,column:null},showTime:!1,shortcuts:"",visible:"",disabledDate:"",cellClassName:"",firstDayOfWeek:7,minTimePickerVisible:!1,maxTimePickerVisible:!1,format:"",arrowControl:!1,unlinkPanels:!1,dateUserInput:{min:null,max:null},timeUserInput:{min:null,max:null}}},watch:{minDate:function(t){var e=this;this.dateUserInput.min=null,this.timeUserInput.min=null,this.$nextTick(function(){if(e.$refs.maxTimePicker&&e.maxDate&&e.maxDate<e.minDate){e.$refs.maxTimePicker.selectableRange=[[Object(pi.parseDate)(Object(pi.formatDate)(e.minDate,"HH:mm:ss"),"HH:mm:ss"),Object(pi.parseDate)("23:59:59","HH:mm:ss")]]}}),t&&this.$refs.minTimePicker&&(this.$refs.minTimePicker.date=t,this.$refs.minTimePicker.value=t)},maxDate:function(t){this.dateUserInput.max=null,this.timeUserInput.max=null,t&&this.$refs.maxTimePicker&&(this.$refs.maxTimePicker.date=t,this.$refs.maxTimePicker.value=t)},minTimePickerVisible:function(t){var e=this;t&&this.$nextTick(function(){e.$refs.minTimePicker.date=e.minDate,e.$refs.minTimePicker.value=e.minDate,e.$refs.minTimePicker.adjustSpinners()})},maxTimePickerVisible:function(t){var e=this;t&&this.$nextTick(function(){e.$refs.maxTimePicker.date=e.maxDate,e.$refs.maxTimePicker.value=e.maxDate,e.$refs.maxTimePicker.adjustSpinners()})},value:function(t){if(t){if(Array.isArray(t))if(this.minDate=Object(pi.isDate)(t[0])?new Date(t[0]):null,this.maxDate=Object(pi.isDate)(t[1])?new Date(t[1]):null,this.minDate)if(this.leftDate=this.minDate,this.unlinkPanels&&this.maxDate){var e=this.minDate.getFullYear(),n=this.minDate.getMonth(),i=this.maxDate.getFullYear(),r=this.maxDate.getMonth();this.rightDate=e===i&&n===r?Object(pi.nextMonth)(this.maxDate):this.maxDate}else this.rightDate=Object(pi.nextMonth)(this.leftDate);else this.leftDate=Zi(this.defaultValue)[0],this.rightDate=Object(pi.nextMonth)(this.leftDate)}else this.minDate=null,this.maxDate=null},defaultValue:function(t){if(!Array.isArray(this.value)){var e=Zi(t),n=e[0],i=e[1];this.leftDate=n,this.rightDate=t&&t[1]&&this.unlinkPanels?i:Object(pi.nextMonth)(this.leftDate)}}},methods:{handleClear:function(){this.minDate=null,this.maxDate=null,this.leftDate=Zi(this.defaultValue)[0],this.rightDate=Object(pi.nextMonth)(this.leftDate),this.$emit("pick",null)},handleChangeRange:function(t){this.minDate=t.minDate,this.maxDate=t.maxDate,this.rangeState=t.rangeState},handleDateInput:function(t,e){if(this.dateUserInput[e]=t,t.length===this.dateFormat.length){var n=Object(pi.parseDate)(t,this.dateFormat);if(n){if("function"==typeof this.disabledDate&&this.disabledDate(new Date(n)))return;"min"===e?(this.minDate=Object(pi.modifyDate)(this.minDate||new Date,n.getFullYear(),n.getMonth(),n.getDate()),this.leftDate=new Date(n),this.unlinkPanels||(this.rightDate=Object(pi.nextMonth)(this.leftDate))):(this.maxDate=Object(pi.modifyDate)(this.maxDate||new Date,n.getFullYear(),n.getMonth(),n.getDate()),this.rightDate=new Date(n),this.unlinkPanels||(this.leftDate=Object(pi.prevMonth)(n)))}}},handleDateChange:function(t,e){var n=Object(pi.parseDate)(t,this.dateFormat);n&&("min"===e?(this.minDate=Object(pi.modifyDate)(this.minDate,n.getFullYear(),n.getMonth(),n.getDate()),this.minDate>this.maxDate&&(this.maxDate=this.minDate)):(this.maxDate=Object(pi.modifyDate)(this.maxDate,n.getFullYear(),n.getMonth(),n.getDate()),this.maxDate<this.minDate&&(this.minDate=this.maxDate)))},handleTimeInput:function(t,e){var n=this;if(this.timeUserInput[e]=t,t.length===this.timeFormat.length){var i=Object(pi.parseDate)(t,this.timeFormat);i&&("min"===e?(this.minDate=Object(pi.modifyTime)(this.minDate,i.getHours(),i.getMinutes(),i.getSeconds()),this.$nextTick(function(t){return n.$refs.minTimePicker.adjustSpinners()})):(this.maxDate=Object(pi.modifyTime)(this.maxDate,i.getHours(),i.getMinutes(),i.getSeconds()),this.$nextTick(function(t){return n.$refs.maxTimePicker.adjustSpinners()})))}},handleTimeChange:function(t,e){var n=Object(pi.parseDate)(t,this.timeFormat);n&&("min"===e?(this.minDate=Object(pi.modifyTime)(this.minDate,n.getHours(),n.getMinutes(),n.getSeconds()),this.minDate>this.maxDate&&(this.maxDate=this.minDate),this.$refs.minTimePicker.value=this.minDate,this.minTimePickerVisible=!1):(this.maxDate=Object(pi.modifyTime)(this.maxDate,n.getHours(),n.getMinutes(),n.getSeconds()),this.maxDate<this.minDate&&(this.minDate=this.maxDate),this.$refs.maxTimePicker.value=this.minDate,this.maxTimePickerVisible=!1))},handleRangePick:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.defaultTime||[],r=Object(pi.modifyWithTimeString)(t.minDate,i[0]),o=Object(pi.modifyWithTimeString)(t.maxDate,i[1]);this.maxDate===o&&this.minDate===r||(this.onPick&&this.onPick(t),this.maxDate=o,this.minDate=r,setTimeout(function(){e.maxDate=o,e.minDate=r},10),n&&!this.showTime&&this.handleConfirm())},handleShortcutClick:function(t){t.onClick&&t.onClick(this)},handleMinTimePick:function(t,e,n){this.minDate=this.minDate||new Date,t&&(this.minDate=Object(pi.modifyTime)(this.minDate,t.getHours(),t.getMinutes(),t.getSeconds())),n||(this.minTimePickerVisible=e),(!this.maxDate||this.maxDate&&this.maxDate.getTime()<this.minDate.getTime())&&(this.maxDate=new Date(this.minDate))},handleMinTimeClose:function(){this.minTimePickerVisible=!1},handleMaxTimePick:function(t,e,n){this.maxDate&&t&&(this.maxDate=Object(pi.modifyTime)(this.maxDate,t.getHours(),t.getMinutes(),t.getSeconds())),n||(this.maxTimePickerVisible=e),this.maxDate&&this.minDate&&this.minDate.getTime()>this.maxDate.getTime()&&(this.minDate=new Date(this.maxDate))},handleMaxTimeClose:function(){this.maxTimePickerVisible=!1},leftPrevYear:function(){this.leftDate=Object(pi.prevYear)(this.leftDate),this.unlinkPanels||(this.rightDate=Object(pi.nextMonth)(this.leftDate))},leftPrevMonth:function(){this.leftDate=Object(pi.prevMonth)(this.leftDate),this.unlinkPanels||(this.rightDate=Object(pi.nextMonth)(this.leftDate))},rightNextYear:function(){this.unlinkPanels?this.rightDate=Object(pi.nextYear)(this.rightDate):(this.leftDate=Object(pi.nextYear)(this.leftDate),this.rightDate=Object(pi.nextMonth)(this.leftDate))},rightNextMonth:function(){this.unlinkPanels?this.rightDate=Object(pi.nextMonth)(this.rightDate):(this.leftDate=Object(pi.nextMonth)(this.leftDate),this.rightDate=Object(pi.nextMonth)(this.leftDate))},leftNextYear:function(){this.leftDate=Object(pi.nextYear)(this.leftDate)},leftNextMonth:function(){this.leftDate=Object(pi.nextMonth)(this.leftDate)},rightPrevYear:function(){this.rightDate=Object(pi.prevYear)(this.rightDate)},rightPrevMonth:function(){this.rightDate=Object(pi.prevMonth)(this.rightDate)},handleConfirm:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isValidValue([this.minDate,this.maxDate])&&this.$emit("pick",[this.minDate,this.maxDate],t)},isValidValue:function(t){return Array.isArray(t)&&t&&t[0]&&t[1]&&Object(pi.isDate)(t[0])&&Object(pi.isDate)(t[1])&&t[0].getTime()<=t[1].getTime()&&("function"!=typeof this.disabledDate||!this.disabledDate(t[0])&&!this.disabledDate(t[1]))},resetView:function(){this.minDate&&null==this.maxDate&&(this.rangeState.selecting=!1),this.minDate=this.value&&Object(pi.isDate)(this.value[0])?new Date(this.value[0]):null,this.maxDate=this.value&&Object(pi.isDate)(this.value[0])?new Date(this.value[1]):null}},components:{TimePicker:Li,DateTable:Yi,ElInput:p.a,ElButton:$.a}},qi,[],!1,null,null,null);Qi.options.__file="packages/date-picker/src/panel/date-range.vue";var tr=Qi.exports,er=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":function(e){t.$emit("dodestroy")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-picker-panel el-date-range-picker el-popper",class:[{"has-sidebar":t.$slots.sidebar||t.shortcuts},t.popperClass]},[n("div",{staticClass:"el-picker-panel__body-wrapper"},[t._t("sidebar"),t.shortcuts?n("div",{staticClass:"el-picker-panel__sidebar"},t._l(t.shortcuts,function(e,i){return n("button",{key:i,staticClass:"el-picker-panel__shortcut",attrs:{type:"button"},on:{click:function(n){t.handleShortcutClick(e)}}},[t._v(t._s(e.text))])}),0):t._e(),n("div",{staticClass:"el-picker-panel__body"},[n("div",{staticClass:"el-picker-panel__content el-date-range-picker__content is-left"},[n("div",{staticClass:"el-date-range-picker__header"},[n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-left",attrs:{type:"button"},on:{click:t.leftPrevYear}}),t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-right",class:{"is-disabled":!t.enableYearArrow},attrs:{type:"button",disabled:!t.enableYearArrow},on:{click:t.leftNextYear}}):t._e(),n("div",[t._v(t._s(t.leftLabel))])]),n("month-table",{attrs:{"selection-mode":"range",date:t.leftDate,"default-value":t.defaultValue,"min-date":t.minDate,"max-date":t.maxDate,"range-state":t.rangeState,"disabled-date":t.disabledDate},on:{changerange:t.handleChangeRange,pick:t.handleRangePick}})],1),n("div",{staticClass:"el-picker-panel__content el-date-range-picker__content is-right"},[n("div",{staticClass:"el-date-range-picker__header"},[t.unlinkPanels?n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-left",class:{"is-disabled":!t.enableYearArrow},attrs:{type:"button",disabled:!t.enableYearArrow},on:{click:t.rightPrevYear}}):t._e(),n("button",{staticClass:"el-picker-panel__icon-btn el-icon-d-arrow-right",attrs:{type:"button"},on:{click:t.rightNextYear}}),n("div",[t._v(t._s(t.rightLabel))])]),n("month-table",{attrs:{"selection-mode":"range",date:t.rightDate,"default-value":t.defaultValue,"min-date":t.minDate,"max-date":t.maxDate,"range-state":t.rangeState,"disabled-date":t.disabledDate},on:{changerange:t.handleChangeRange,pick:t.handleRangePick}})],1)])],2)])])};er._withStripped=!0;var nr=function(t){return Array.isArray(t)?[new Date(t[0]),new Date(t[1])]:t?[new Date(t),Object(pi.nextMonth)(new Date(t))]:[new Date,Object(pi.nextMonth)(new Date)]},ir=r({mixins:[f.a],directives:{Clickoutside:A.a},computed:{btnDisabled:function(){return!(this.minDate&&this.maxDate&&!this.selecting&&this.isValidValue([this.minDate,this.maxDate]))},leftLabel:function(){return this.leftDate.getFullYear()+" "+this.t("el.datepicker.year")},rightLabel:function(){return this.rightDate.getFullYear()+" "+this.t("el.datepicker.year")},leftYear:function(){return this.leftDate.getFullYear()},rightYear:function(){return this.rightDate.getFullYear()===this.leftDate.getFullYear()?this.leftDate.getFullYear()+1:this.rightDate.getFullYear()},enableYearArrow:function(){return this.unlinkPanels&&this.rightYear>this.leftYear+1}},data:function(){return{popperClass:"",value:[],defaultValue:null,defaultTime:null,minDate:"",maxDate:"",leftDate:new Date,rightDate:Object(pi.nextYear)(new Date),rangeState:{endDate:null,selecting:!1,row:null,column:null},shortcuts:"",visible:"",disabledDate:"",format:"",arrowControl:!1,unlinkPanels:!1}},watch:{value:function(t){if(t){if(Array.isArray(t))if(this.minDate=Object(pi.isDate)(t[0])?new Date(t[0]):null,this.maxDate=Object(pi.isDate)(t[1])?new Date(t[1]):null,this.minDate)if(this.leftDate=this.minDate,this.unlinkPanels&&this.maxDate){var e=this.minDate.getFullYear(),n=this.maxDate.getFullYear();this.rightDate=e===n?Object(pi.nextYear)(this.maxDate):this.maxDate}else this.rightDate=Object(pi.nextYear)(this.leftDate);else this.leftDate=nr(this.defaultValue)[0],this.rightDate=Object(pi.nextYear)(this.leftDate)}else this.minDate=null,this.maxDate=null},defaultValue:function(t){if(!Array.isArray(this.value)){var e=nr(t),n=e[0],i=e[1];this.leftDate=n,this.rightDate=t&&t[1]&&n.getFullYear()!==i.getFullYear()&&this.unlinkPanels?i:Object(pi.nextYear)(this.leftDate)}}},methods:{handleClear:function(){this.minDate=null,this.maxDate=null,this.leftDate=nr(this.defaultValue)[0],this.rightDate=Object(pi.nextYear)(this.leftDate),this.$emit("pick",null)},handleChangeRange:function(t){this.minDate=t.minDate,this.maxDate=t.maxDate,this.rangeState=t.rangeState},handleRangePick:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.defaultTime||[],r=Object(pi.modifyWithTimeString)(t.minDate,i[0]),o=Object(pi.modifyWithTimeString)(t.maxDate,i[1]);this.maxDate===o&&this.minDate===r||(this.onPick&&this.onPick(t),this.maxDate=o,this.minDate=r,setTimeout(function(){e.maxDate=o,e.minDate=r},10),n&&this.handleConfirm())},handleShortcutClick:function(t){t.onClick&&t.onClick(this)},leftPrevYear:function(){this.leftDate=Object(pi.prevYear)(this.leftDate),this.unlinkPanels||(this.rightDate=Object(pi.prevYear)(this.rightDate))},rightNextYear:function(){this.unlinkPanels||(this.leftDate=Object(pi.nextYear)(this.leftDate)),this.rightDate=Object(pi.nextYear)(this.rightDate)},leftNextYear:function(){this.leftDate=Object(pi.nextYear)(this.leftDate)},rightPrevYear:function(){this.rightDate=Object(pi.prevYear)(this.rightDate)},handleConfirm:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isValidValue([this.minDate,this.maxDate])&&this.$emit("pick",[this.minDate,this.maxDate],t)},isValidValue:function(t){return Array.isArray(t)&&t&&t[0]&&t[1]&&Object(pi.isDate)(t[0])&&Object(pi.isDate)(t[1])&&t[0].getTime()<=t[1].getTime()&&("function"!=typeof this.disabledDate||!this.disabledDate(t[0])&&!this.disabledDate(t[1]))},resetView:function(){this.minDate=this.value&&Object(pi.isDate)(this.value[0])?new Date(this.value[0]):null,this.maxDate=this.value&&Object(pi.isDate)(this.value[0])?new Date(this.value[1]):null}},components:{MonthTable:Gi,ElInput:p.a,ElButton:$.a}},er,[],!1,null,null,null);ir.options.__file="packages/date-picker/src/panel/month-range.vue";var rr=ir.exports,or=function(t){return"daterange"===t||"datetimerange"===t?tr:"monthrange"===t?rr:Ji},sr={mixins:[Ii],name:"ElDatePicker",props:{type:{type:String,default:"date"},timeArrowControl:Boolean},watch:{type:function(t){this.picker?(this.unmountPicker(),this.panel=or(t),this.mountPicker()):this.panel=or(t)}},created:function(){this.panel=or(this.type)},install:function(t){t.component(sr.name,sr)}},ar=sr,lr=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"before-enter":t.handleMenuEnter,"after-leave":function(e){t.$emit("dodestroy")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],ref:"popper",staticClass:"el-picker-panel time-select el-popper",class:t.popperClass,style:{width:t.width+"px"}},[n("el-scrollbar",{attrs:{noresize:"","wrap-class":"el-picker-panel__content"}},t._l(t.items,function(e){return n("div",{key:e.value,staticClass:"time-select-item",class:{selected:t.value===e.value,disabled:e.disabled,default:e.value===t.defaultValue},attrs:{disabled:e.disabled},on:{click:function(n){t.handleClick(e)}}},[t._v(t._s(e.value))])}),0)],1)])};lr._withStripped=!0;var ur=function(t){var e=(t||"").split(":");return e.length>=2?{hours:parseInt(e[0],10),minutes:parseInt(e[1],10)}:null},cr=function(t,e){var n=ur(t),i=ur(e),r=n.minutes+60*n.hours,o=i.minutes+60*i.hours;return r===o?0:r>o?1:-1},hr=function(t,e){var n=ur(t),i=ur(e),r={hours:n.hours,minutes:n.minutes};return r.minutes+=i.minutes,r.hours+=i.hours,r.hours+=Math.floor(r.minutes/60),r.minutes=r.minutes%60,function(t){return(t.hours<10?"0"+t.hours:t.hours)+":"+(t.minutes<10?"0"+t.minutes:t.minutes)}(r)},pr=r({components:{ElScrollbar:B.a},watch:{value:function(t){var e=this;t&&this.$nextTick(function(){return e.scrollToOption()})}},methods:{handleClick:function(t){t.disabled||this.$emit("pick",t.value)},handleClear:function(){this.$emit("pick",null)},scrollToOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".selected",e=this.$refs.popper.querySelector(".el-picker-panel__content");Fe()(e,e.querySelector(t))},handleMenuEnter:function(){var t=this,e=-1!==this.items.map(function(t){return t.value}).indexOf(this.value),n=-1!==this.items.map(function(t){return t.value}).indexOf(this.defaultValue),i=(e?".selected":n&&".default")||".time-select-item:not(.disabled)";this.$nextTick(function(){return t.scrollToOption(i)})},scrollDown:function(t){for(var e=this.items,n=e.length,i=e.length,r=e.map(function(t){return t.value}).indexOf(this.value);i--;)if(!e[r=(r+t+n)%n].disabled)return void this.$emit("pick",e[r].value,!0)},isValidValue:function(t){return-1!==this.items.filter(function(t){return!t.disabled}).map(function(t){return t.value}).indexOf(t)},handleKeydown:function(t){var e=t.keyCode;if(38===e||40===e){var n={40:1,38:-1}[e.toString()];return this.scrollDown(n),void t.stopPropagation()}}},data:function(){return{popperClass:"",start:"09:00",end:"18:00",step:"00:30",value:"",defaultValue:"",visible:!1,minTime:"",maxTime:"",width:0}},computed:{items:function(){var t=this.start,e=this.end,n=this.step,i=[];if(t&&e&&n)for(var r=t;cr(r,e)<=0;)i.push({value:r,disabled:cr(r,this.minTime||"-1:-1")<=0||cr(r,this.maxTime||"100:100")>=0}),r=hr(r,n);return i}}},lr,[],!1,null,null,null);pr.options.__file="packages/date-picker/src/panel/time-select.vue";var dr=pr.exports,fr={mixins:[Ii],name:"ElTimeSelect",componentName:"ElTimeSelect",props:{type:{type:String,default:"time-select"}},beforeCreate:function(){this.panel=dr},install:function(t){t.component(fr.name,fr)}},gr=fr,mr=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":function(e){t.$emit("dodestroy")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-time-range-picker el-picker-panel el-popper",class:t.popperClass},[n("div",{staticClass:"el-time-range-picker__content"},[n("div",{staticClass:"el-time-range-picker__cell"},[n("div",{staticClass:"el-time-range-picker__header"},[t._v(t._s(t.t("el.datepicker.startTime")))]),n("div",{staticClass:"el-time-range-picker__body el-time-panel__content",class:{"has-seconds":t.showSeconds,"is-arrow":t.arrowControl}},[n("time-spinner",{ref:"minSpinner",attrs:{"show-seconds":t.showSeconds,"am-pm-mode":t.amPmMode,"arrow-control":t.arrowControl,date:t.minDate},on:{change:t.handleMinChange,"select-range":t.setMinSelectionRange}})],1)]),n("div",{staticClass:"el-time-range-picker__cell"},[n("div",{staticClass:"el-time-range-picker__header"},[t._v(t._s(t.t("el.datepicker.endTime")))]),n("div",{staticClass:"el-time-range-picker__body el-time-panel__content",class:{"has-seconds":t.showSeconds,"is-arrow":t.arrowControl}},[n("time-spinner",{ref:"maxSpinner",attrs:{"show-seconds":t.showSeconds,"am-pm-mode":t.amPmMode,"arrow-control":t.arrowControl,date:t.maxDate},on:{change:t.handleMaxChange,"select-range":t.setMaxSelectionRange}})],1)])]),n("div",{staticClass:"el-time-panel__footer"},[n("button",{staticClass:"el-time-panel__btn cancel",attrs:{type:"button"},on:{click:function(e){t.handleCancel()}}},[t._v(t._s(t.t("el.datepicker.cancel")))]),n("button",{staticClass:"el-time-panel__btn confirm",attrs:{type:"button",disabled:t.btnDisabled},on:{click:function(e){t.handleConfirm()}}},[t._v(t._s(t.t("el.datepicker.confirm")))])])])])};mr._withStripped=!0;var vr=Object(pi.parseDate)("00:00:00","HH:mm:ss"),_r=Object(pi.parseDate)("23:59:59","HH:mm:ss"),yr=function(t){return Object(pi.modifyDate)(_r,t.getFullYear(),t.getMonth(),t.getDate())},br=function(t,e){return new Date(Math.min(t.getTime()+e,yr(t).getTime()))},Tr=r({mixins:[f.a],components:{TimeSpinner:Mi},computed:{showSeconds:function(){return-1!==(this.format||"").indexOf("ss")},offset:function(){return this.showSeconds?11:8},spinner:function(){return this.selectionRange[0]<this.offset?this.$refs.minSpinner:this.$refs.maxSpinner},btnDisabled:function(){return this.minDate.getTime()>this.maxDate.getTime()},amPmMode:function(){return-1!==(this.format||"").indexOf("A")?"A":-1!==(this.format||"").indexOf("a")?"a":""}},data:function(){return{popperClass:"",minDate:new Date,maxDate:new Date,value:[],oldValue:[new Date,new Date],defaultValue:null,format:"HH:mm:ss",visible:!1,selectionRange:[0,2],arrowControl:!1}},watch:{value:function(t){Array.isArray(t)?(this.minDate=new Date(t[0]),this.maxDate=new Date(t[1])):Array.isArray(this.defaultValue)?(this.minDate=new Date(this.defaultValue[0]),this.maxDate=new Date(this.defaultValue[1])):this.defaultValue?(this.minDate=new Date(this.defaultValue),this.maxDate=br(new Date(this.defaultValue),36e5)):(this.minDate=new Date,this.maxDate=br(new Date,36e5))},visible:function(t){var e=this;t&&(this.oldValue=this.value,this.$nextTick(function(){return e.$refs.minSpinner.emitSelectRange("hours")}))}},methods:{handleClear:function(){this.$emit("pick",null)},handleCancel:function(){this.$emit("pick",this.oldValue)},handleMinChange:function(t){this.minDate=Object(pi.clearMilliseconds)(t),this.handleChange()},handleMaxChange:function(t){this.maxDate=Object(pi.clearMilliseconds)(t),this.handleChange()},handleChange:function(){var t;this.isValidValue([this.minDate,this.maxDate])&&(this.$refs.minSpinner.selectableRange=[[(t=this.minDate,Object(pi.modifyDate)(vr,t.getFullYear(),t.getMonth(),t.getDate())),this.maxDate]],this.$refs.maxSpinner.selectableRange=[[this.minDate,yr(this.maxDate)]],this.$emit("pick",[this.minDate,this.maxDate],!0))},setMinSelectionRange:function(t,e){this.$emit("select-range",t,e,"min"),this.selectionRange=[t,e]},setMaxSelectionRange:function(t,e){this.$emit("select-range",t,e,"max"),this.selectionRange=[t+this.offset,e+this.offset]},handleConfirm:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.$refs.minSpinner.selectableRange,n=this.$refs.maxSpinner.selectableRange;this.minDate=Object(pi.limitTimeRange)(this.minDate,e,this.format),this.maxDate=Object(pi.limitTimeRange)(this.maxDate,n,this.format),this.$emit("pick",[this.minDate,this.maxDate],t)},adjustSpinners:function(){this.$refs.minSpinner.adjustSpinners(),this.$refs.maxSpinner.adjustSpinners()},changeSelectionRange:function(t){var e=this.showSeconds?[0,3,6,11,14,17]:[0,3,8,11],n=["hours","minutes"].concat(this.showSeconds?["seconds"]:[]),i=(e.indexOf(this.selectionRange[0])+t+e.length)%e.length,r=e.length/2;i<r?this.$refs.minSpinner.emitSelectRange(n[i]):this.$refs.maxSpinner.emitSelectRange(n[i-r])},isValidValue:function(t){return Array.isArray(t)&&Object(pi.timeWithinRange)(this.minDate,this.$refs.minSpinner.selectableRange)&&Object(pi.timeWithinRange)(this.maxDate,this.$refs.maxSpinner.selectableRange)},handleKeydown:function(t){var e=t.keyCode,n={38:-1,40:1,37:-1,39:1};if(37===e||39===e){var i=n[e];return this.changeSelectionRange(i),void t.preventDefault()}if(38===e||40===e){var r=n[e];return this.spinner.scrollDown(r),void t.preventDefault()}}}},mr,[],!1,null,null,null);Tr.options.__file="packages/date-picker/src/panel/time-range.vue";var Er=Tr.exports,Cr={mixins:[Ii],name:"ElTimePicker",props:{isRange:Boolean,arrowControl:Boolean},data:function(){return{type:""}},watch:{isRange:function(t){this.picker?(this.unmountPicker(),this.type=t?"timerange":"time",this.panel=t?Er:Li,this.mountPicker()):(this.type=t?"timerange":"time",this.panel=t?Er:Li)}},created:function(){this.type=this.isRange?"timerange":"time",this.panel=this.isRange?Er:Li},install:function(t){t.component(Cr.name,Cr)}},Sr=Cr,wr=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",[n("transition",{attrs:{name:t.transition},on:{"after-enter":t.handleAfterEnter,"after-leave":t.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!t.disabled&&t.showPopper,expression:"!disabled && showPopper"}],ref:"popper",staticClass:"el-popover el-popper",class:[t.popperClass,t.content&&"el-popover--plain"],style:{width:t.width+"px"},attrs:{role:"tooltip",id:t.tooltipId,"aria-hidden":t.disabled||!t.showPopper?"true":"false"}},[t.title?n("div",{staticClass:"el-popover__title",domProps:{textContent:t._s(t.title)}}):t._e(),t._t("default",[t._v(t._s(t.content))])],2)]),n("span",{ref:"wrapper",staticClass:"el-popover__reference-wrapper"},[t._t("reference")],2)],1)};wr._withStripped=!0;var kr=r({name:"ElPopover",mixins:[L.a],props:{trigger:{type:String,default:"click",validator:function(t){return["click","focus","hover","manual"].indexOf(t)>-1}},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:200},title:String,disabled:Boolean,content:String,reference:{},popperClass:String,width:{},visibleArrow:{default:!0},arrowOffset:{type:Number,default:0},transition:{type:String,default:"fade-in-linear"},tabindex:{type:Number,default:0}},computed:{tooltipId:function(){return"el-popover-"+Object(g.generateId)()}},watch:{showPopper:function(t){this.disabled||(t?this.$emit("show"):this.$emit("hide"))}},mounted:function(){var t=this,e=this.referenceElm=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),e&&(Object(ft.addClass)(e,"el-popover__reference"),e.setAttribute("aria-describedby",this.tooltipId),e.setAttribute("tabindex",this.tabindex),n.setAttribute("tabindex",0),"click"!==this.trigger&&(Object(ft.on)(e,"focusin",function(){t.handleFocus();var n=e.__vue__;n&&"function"==typeof n.focus&&n.focus()}),Object(ft.on)(n,"focusin",this.handleFocus),Object(ft.on)(e,"focusout",this.handleBlur),Object(ft.on)(n,"focusout",this.handleBlur)),Object(ft.on)(e,"keydown",this.handleKeydown),Object(ft.on)(e,"click",this.handleClick)),"click"===this.trigger?(Object(ft.on)(e,"click",this.doToggle),Object(ft.on)(document,"click",this.handleDocumentClick)):"hover"===this.trigger?(Object(ft.on)(e,"mouseenter",this.handleMouseEnter),Object(ft.on)(n,"mouseenter",this.handleMouseEnter),Object(ft.on)(e,"mouseleave",this.handleMouseLeave),Object(ft.on)(n,"mouseleave",this.handleMouseLeave)):"focus"===this.trigger&&(this.tabindex<0&&console.warn("[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key"),e.querySelector("input, textarea")?(Object(ft.on)(e,"focusin",this.doShow),Object(ft.on)(e,"focusout",this.doClose)):(Object(ft.on)(e,"mousedown",this.doShow),Object(ft.on)(e,"mouseup",this.doClose)))},beforeDestroy:function(){this.cleanup()},deactivated:function(){this.cleanup()},methods:{doToggle:function(){this.showPopper=!this.showPopper},doShow:function(){this.showPopper=!0},doClose:function(){this.showPopper=!1},handleFocus:function(){Object(ft.addClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!0)},handleClick:function(){Object(ft.removeClass)(this.referenceElm,"focusing")},handleBlur:function(){Object(ft.removeClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!1)},handleMouseEnter:function(){var t=this;clearTimeout(this._timer),this.openDelay?this._timer=setTimeout(function(){t.showPopper=!0},this.openDelay):this.showPopper=!0},handleKeydown:function(t){27===t.keyCode&&"manual"!==this.trigger&&this.doClose()},handleMouseLeave:function(){var t=this;clearTimeout(this._timer),this.closeDelay?this._timer=setTimeout(function(){t.showPopper=!1},this.closeDelay):this.showPopper=!1},handleDocumentClick:function(t){var e=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),this.$el&&e&&!this.$el.contains(t.target)&&!e.contains(t.target)&&n&&!n.contains(t.target)&&(this.showPopper=!1)},handleAfterEnter:function(){this.$emit("after-enter")},handleAfterLeave:function(){this.$emit("after-leave"),this.doDestroy()},cleanup:function(){(this.openDelay||this.closeDelay)&&clearTimeout(this._timer)}},destroyed:function(){var t=this.reference;Object(ft.off)(t,"click",this.doToggle),Object(ft.off)(t,"mouseup",this.doClose),Object(ft.off)(t,"mousedown",this.doShow),Object(ft.off)(t,"focusin",this.doShow),Object(ft.off)(t,"focusout",this.doClose),Object(ft.off)(t,"mousedown",this.doShow),Object(ft.off)(t,"mouseup",this.doClose),Object(ft.off)(t,"mouseleave",this.handleMouseLeave),Object(ft.off)(t,"mouseenter",this.handleMouseEnter),Object(ft.off)(document,"click",this.handleDocumentClick)}},wr,[],!1,null,null,null);kr.options.__file="packages/popover/src/main.vue";var xr=kr.exports,Ir=function(t,e,n){var i=e.expression?e.value:e.arg,r=n.context.$refs[i];r&&(Array.isArray(r)?r[0].$refs.reference=t:r.$refs.reference=t)},Rr={bind:function(t,e,n){Ir(t,e,n)},inserted:function(t,e,n){Ir(t,e,n)}};hn.a.directive("popover",Rr),xr.install=function(t){t.directive("popover",Rr),t.component(xr.name,xr)},xr.directive=Rr;var Or=xr,Dr={name:"ElTooltip",mixins:[L.a],props:{openDelay:{type:Number,default:0},disabled:Boolean,manual:Boolean,effect:{type:String,default:"dark"},arrowOffset:{type:Number,default:0},popperClass:String,content:String,visibleArrow:{default:!0},transition:{type:String,default:"el-fade-in-linear"},popperOptions:{default:function(){return{boundariesPadding:10,gpuAcceleration:!1}}},enterable:{type:Boolean,default:!0},hideAfter:{type:Number,default:0},tabindex:{type:Number,default:0}},data:function(){return{tooltipId:"el-tooltip-"+Object(g.generateId)(),timeoutPending:null,focusing:!1}},beforeCreate:function(){var t=this;this.$isServer||(this.popperVM=new hn.a({data:{node:""},render:function(t){return this.node}}).$mount(),this.debounceClose=O()(200,function(){return t.handleClosePopper()}))},render:function(t){var e=this;this.popperVM&&(this.popperVM.node=t("transition",{attrs:{name:this.transition},on:{afterLeave:this.doDestroy}},[t("div",{on:{mouseleave:function(){e.setExpectedState(!1),e.debounceClose()},mouseenter:function(){e.setExpectedState(!0)}},ref:"popper",attrs:{role:"tooltip",id:this.tooltipId,"aria-hidden":this.disabled||!this.showPopper?"true":"false"},directives:[{name:"show",value:!this.disabled&&this.showPopper}],class:["el-tooltip__popper","is-"+this.effect,this.popperClass]},[this.$slots.content||this.content])]));var n=this.getFirstElement();if(!n)return null;var i=n.data=n.data||{};return i.staticClass=this.addTooltipClass(i.staticClass),n},mounted:function(){var t=this;this.referenceElm=this.$el,1===this.$el.nodeType&&(this.$el.setAttribute("aria-describedby",this.tooltipId),this.$el.setAttribute("tabindex",this.tabindex),Object(ft.on)(this.referenceElm,"mouseenter",this.show),Object(ft.on)(this.referenceElm,"mouseleave",this.hide),Object(ft.on)(this.referenceElm,"focus",function(){if(t.$slots.default&&t.$slots.default.length){var e=t.$slots.default[0].componentInstance;e&&e.focus?e.focus():t.handleFocus()}else t.handleFocus()}),Object(ft.on)(this.referenceElm,"blur",this.handleBlur),Object(ft.on)(this.referenceElm,"click",this.removeFocusing)),this.value&&this.popperVM&&this.popperVM.$nextTick(function(){t.value&&t.updatePopper()})},watch:{focusing:function(t){t?Object(ft.addClass)(this.referenceElm,"focusing"):Object(ft.removeClass)(this.referenceElm,"focusing")}},methods:{show:function(){this.setExpectedState(!0),this.handleShowPopper()},hide:function(){this.setExpectedState(!1),this.debounceClose()},handleFocus:function(){this.focusing=!0,this.show()},handleBlur:function(){this.focusing=!1,this.hide()},removeFocusing:function(){this.focusing=!1},addTooltipClass:function(t){return t?"el-tooltip "+t.replace("el-tooltip",""):"el-tooltip"},handleShowPopper:function(){var t=this;this.expectedState&&!this.manual&&(clearTimeout(this.timeout),this.timeout=setTimeout(function(){t.showPopper=!0},this.openDelay),this.hideAfter>0&&(this.timeoutPending=setTimeout(function(){t.showPopper=!1},this.hideAfter)))},handleClosePopper:function(){this.enterable&&this.expectedState||this.manual||(clearTimeout(this.timeout),this.timeoutPending&&clearTimeout(this.timeoutPending),this.showPopper=!1,this.disabled&&this.doDestroy())},setExpectedState:function(t){!1===t&&clearTimeout(this.timeoutPending),this.expectedState=t},getFirstElement:function(){var t=this.$slots.default;if(!Array.isArray(t))return null;for(var e=null,n=0;n<t.length;n++)t[n]&&t[n].tag&&(e=t[n]);return e}},beforeDestroy:function(){this.popperVM&&this.popperVM.$destroy()},destroyed:function(){var t=this.referenceElm;1===t.nodeType&&(Object(ft.off)(t,"mouseenter",this.show),Object(ft.off)(t,"mouseleave",this.hide),Object(ft.off)(t,"focus",this.handleFocus),Object(ft.off)(t,"blur",this.handleBlur),Object(ft.off)(t,"click",this.removeFocusing))},install:function(t){t.component(Dr.name,Dr)}},Ar=Dr,Mr=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"msgbox-fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-message-box__wrapper",attrs:{tabindex:"-1",role:"dialog","aria-modal":"true","aria-label":t.title||"dialog"},on:{click:function(e){return e.target!==e.currentTarget?null:t.handleWrapperClick(e)}}},[n("div",{staticClass:"el-message-box",class:[t.customClass,t.center&&"el-message-box--center"]},[null!==t.title?n("div",{staticClass:"el-message-box__header"},[n("div",{staticClass:"el-message-box__title"},[t.icon&&t.center?n("div",{class:["el-message-box__status",t.icon]}):t._e(),n("span",[t._v(t._s(t.title))])]),t.showClose?n("button",{staticClass:"el-message-box__headerbtn",attrs:{type:"button","aria-label":"Close"},on:{click:function(e){t.handleAction(t.distinguishCancelAndClose?"close":"cancel")},keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.handleAction(t.distinguishCancelAndClose?"close":"cancel")}}},[n("i",{staticClass:"el-message-box__close el-icon-close"})]):t._e()]):t._e(),n("div",{staticClass:"el-message-box__content"},[n("div",{staticClass:"el-message-box__container"},[t.icon&&!t.center&&""!==t.message?n("div",{class:["el-message-box__status",t.icon]}):t._e(),""!==t.message?n("div",{staticClass:"el-message-box__message"},[t._t("default",[t.dangerouslyUseHTMLString?n("p",{domProps:{innerHTML:t._s(t.message)}}):n("p",[t._v(t._s(t.message))])])],2):t._e()]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.showInput,expression:"showInput"}],staticClass:"el-message-box__input"},[n("el-input",{ref:"input",attrs:{type:t.inputType,placeholder:t.inputPlaceholder},nativeOn:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.handleInputEnter(e):null}},model:{value:t.inputValue,callback:function(e){t.inputValue=e},expression:"inputValue"}}),n("div",{staticClass:"el-message-box__errormsg",style:{visibility:t.editorErrorMessage?"visible":"hidden"}},[t._v(t._s(t.editorErrorMessage))])],1)]),n("div",{staticClass:"el-message-box__btns"},[t.showCancelButton?n("el-button",{class:[t.cancelButtonClasses],attrs:{loading:t.cancelButtonLoading,round:t.roundButton,size:"small"},on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.handleAction("cancel")}},nativeOn:{click:function(e){t.handleAction("cancel")}}},[t._v("\n "+t._s(t.cancelButtonText||t.t("el.messagebox.cancel"))+"\n ")]):t._e(),n("el-button",{directives:[{name:"show",rawName:"v-show",value:t.showConfirmButton,expression:"showConfirmButton"}],ref:"confirm",class:[t.confirmButtonClasses],attrs:{loading:t.confirmButtonLoading,round:t.roundButton,size:"small"},on:{keydown:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key,"Enter"))return null;t.handleAction("confirm")}},nativeOn:{click:function(e){t.handleAction("confirm")}}},[t._v("\n "+t._s(t.confirmButtonText||t.t("el.messagebox.confirm"))+"\n ")])],1)])])])};Mr._withStripped=!0;var Nr=n(12),Lr=n.n(Nr),Pr=n(39),Br=n.n(Pr),Fr=void 0,Ur={success:"success",info:"info",warning:"warning",error:"error"},Vr=r({mixins:[b.a,f.a],props:{modal:{default:!0},lockScroll:{default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{default:!0},closeOnPressEscape:{default:!0},closeOnHashChange:{default:!0},center:{default:!1,type:Boolean},roundButton:{default:!1,type:Boolean}},components:{ElInput:p.a,ElButton:$.a},computed:{icon:function(){var t=this.type;return this.iconClass||(t&&Ur[t]?"el-icon-"+Ur[t]:"")},confirmButtonClasses:function(){return"el-button--primary "+this.confirmButtonClass},cancelButtonClasses:function(){return""+this.cancelButtonClass}},methods:{getSafeClose:function(){var t=this,e=this.uid;return function(){t.$nextTick(function(){e===t.uid&&t.doClose()})}},doClose:function(){var t=this;this.visible&&(this.visible=!1,this._closing=!0,this.onClose&&this.onClose(),Fr.closeDialog(),this.lockScroll&&setTimeout(this.restoreBodyStyle,200),this.opened=!1,this.doAfterClose(),setTimeout(function(){t.action&&t.callback(t.action,t)}))},handleWrapperClick:function(){this.closeOnClickModal&&this.handleAction(this.distinguishCancelAndClose?"close":"cancel")},handleInputEnter:function(){if("textarea"!==this.inputType)return this.handleAction("confirm")},handleAction:function(t){("prompt"!==this.$type||"confirm"!==t||this.validate())&&(this.action=t,"function"==typeof this.beforeClose?(this.close=this.getSafeClose(),this.beforeClose(t,this,this.close)):this.doClose())},validate:function(){if("prompt"===this.$type){var t=this.inputPattern;if(t&&!t.test(this.inputValue||""))return this.editorErrorMessage=this.inputErrorMessage||Object(Nr.t)("el.messagebox.error"),Object(ft.addClass)(this.getInputElement(),"invalid"),!1;var e=this.inputValidator;if("function"==typeof e){var n=e(this.inputValue);if(!1===n)return this.editorErrorMessage=this.inputErrorMessage||Object(Nr.t)("el.messagebox.error"),Object(ft.addClass)(this.getInputElement(),"invalid"),!1;if("string"==typeof n)return this.editorErrorMessage=n,Object(ft.addClass)(this.getInputElement(),"invalid"),!1}}return this.editorErrorMessage="",Object(ft.removeClass)(this.getInputElement(),"invalid"),!0},getFirstFocus:function(){var t=this.$el.querySelector(".el-message-box__btns .el-button"),e=this.$el.querySelector(".el-message-box__btns .el-message-box__title");return t||e},getInputElement:function(){var t=this.$refs.input.$refs;return t.input||t.textarea},handleClose:function(){this.handleAction("close")}},watch:{inputValue:{immediate:!0,handler:function(t){var e=this;this.$nextTick(function(n){"prompt"===e.$type&&null!==t&&e.validate()})}},visible:function(t){var e=this;t&&(this.uid++,"alert"!==this.$type&&"confirm"!==this.$type||this.$nextTick(function(){e.$refs.confirm.$el.focus()}),this.focusAfterClosed=document.activeElement,Fr=new Br.a(this.$el,this.focusAfterClosed,this.getFirstFocus())),"prompt"===this.$type&&(t?setTimeout(function(){e.$refs.input&&e.$refs.input.$el&&e.getInputElement().focus()},500):(this.editorErrorMessage="",Object(ft.removeClass)(this.getInputElement(),"invalid")))}},mounted:function(){var t=this;this.$nextTick(function(){t.closeOnHashChange&&window.addEventListener("hashchange",t.close)})},beforeDestroy:function(){this.closeOnHashChange&&window.removeEventListener("hashchange",this.close),setTimeout(function(){Fr.closeDialog()})},data:function(){return{uid:1,title:void 0,message:"",type:"",iconClass:"",customClass:"",showInput:!1,inputValue:null,inputPlaceholder:"",inputType:"text",inputPattern:null,inputValidator:null,inputErrorMessage:"",showConfirmButton:!0,showCancelButton:!1,action:"",confirmButtonText:"",cancelButtonText:"",confirmButtonLoading:!1,cancelButtonLoading:!1,confirmButtonClass:"",confirmButtonDisabled:!1,cancelButtonClass:"",editorErrorMessage:null,callback:null,dangerouslyUseHTMLString:!1,focusAfterClosed:null,isOnComposition:!1,distinguishCancelAndClose:!1}}},Mr,[],!1,null,null,null);Vr.options.__file="packages/message-box/src/main.vue";var Hr=Vr.exports,Wr=n(23),Gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr={title:null,message:"",type:"",iconClass:"",showInput:!1,showClose:!0,modalFade:!0,lockScroll:!0,closeOnClickModal:!0,closeOnPressEscape:!0,closeOnHashChange:!0,inputValue:null,inputPlaceholder:"",inputType:"text",inputPattern:null,inputValidator:null,inputErrorMessage:"",showConfirmButton:!0,showCancelButton:!1,confirmButtonPosition:"right",confirmButtonHighlight:!1,cancelButtonHighlight:!1,confirmButtonText:"",cancelButtonText:"",confirmButtonClass:"",cancelButtonClass:"",customClass:"",beforeClose:null,dangerouslyUseHTMLString:!1,center:!1,roundButton:!1,distinguishCancelAndClose:!1},zr=hn.a.extend(Hr),$r=void 0,Xr=void 0,Yr=[],Kr=function(t){if($r){var e=$r.callback;"function"==typeof e&&(Xr.showInput?e(Xr.inputValue,t):e(t)),$r.resolve&&("confirm"===t?Xr.showInput?$r.resolve({value:Xr.inputValue,action:t}):$r.resolve(t):!$r.reject||"cancel"!==t&&"close"!==t||$r.reject(t))}},Jr=function t(){if(Xr||((Xr=new zr({el:document.createElement("div")})).callback=Kr),Xr.action="",(!Xr.visible||Xr.closeTimer)&&Yr.length>0){var e=($r=Yr.shift()).options;for(var n in e)e.hasOwnProperty(n)&&(Xr[n]=e[n]);void 0===e.callback&&(Xr.callback=Kr);var i=Xr.callback;Xr.callback=function(e,n){i(e,n),t()},Object(Wr.isVNode)(Xr.message)?(Xr.$slots.default=[Xr.message],Xr.message=null):delete Xr.$slots.default,["modal","showClose","closeOnClickModal","closeOnPressEscape","closeOnHashChange"].forEach(function(t){void 0===Xr[t]&&(Xr[t]=!0)}),document.body.appendChild(Xr.$el),hn.a.nextTick(function(){Xr.visible=!0})}},qr=function t(e,n){if(!hn.a.prototype.$isServer){if("string"==typeof e||Object(Wr.isVNode)(e)?(e={message:e},"string"==typeof arguments[1]&&(e.title=arguments[1])):e.callback&&!n&&(n=e.callback),"undefined"!=typeof Promise)return new Promise(function(i,r){Yr.push({options:Ht()({},jr,t.defaults,e),callback:n,resolve:i,reject:r}),Jr()});Yr.push({options:Ht()({},jr,t.defaults,e),callback:n}),Jr()}};qr.setDefaults=function(t){qr.defaults=t},qr.alert=function(t,e,n){return"object"===(void 0===e?"undefined":Gr(e))?(n=e,e=""):void 0===e&&(e=""),qr(Ht()({title:e,message:t,$type:"alert",closeOnPressEscape:!1,closeOnClickModal:!1},n))},qr.confirm=function(t,e,n){return"object"===(void 0===e?"undefined":Gr(e))?(n=e,e=""):void 0===e&&(e=""),qr(Ht()({title:e,message:t,$type:"confirm",showCancelButton:!0},n))},qr.prompt=function(t,e,n){return"object"===(void 0===e?"undefined":Gr(e))?(n=e,e=""):void 0===e&&(e=""),qr(Ht()({title:e,message:t,showCancelButton:!0,showInput:!0,$type:"prompt"},n))},qr.close=function(){Xr.doClose(),Xr.visible=!1,Yr=[],$r=null};var Zr=qr,Qr=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-breadcrumb",attrs:{"aria-label":"Breadcrumb",role:"navigation"}},[this._t("default")],2)};Qr._withStripped=!0;var to=r({name:"ElBreadcrumb",props:{separator:{type:String,default:"/"},separatorClass:{type:String,default:""}},provide:function(){return{elBreadcrumb:this}},mounted:function(){var t=this.$el.querySelectorAll(".el-breadcrumb__item");t.length&&t[t.length-1].setAttribute("aria-current","page")}},Qr,[],!1,null,null,null);to.options.__file="packages/breadcrumb/src/breadcrumb.vue";var eo=to.exports;eo.install=function(t){t.component(eo.name,eo)};var no=eo,io=function(){var t=this.$createElement,e=this._self._c||t;return e("span",{staticClass:"el-breadcrumb__item"},[e("span",{ref:"link",class:["el-breadcrumb__inner",this.to?"is-link":""],attrs:{role:"link"}},[this._t("default")],2),this.separatorClass?e("i",{staticClass:"el-breadcrumb__separator",class:this.separatorClass}):e("span",{staticClass:"el-breadcrumb__separator",attrs:{role:"presentation"}},[this._v(this._s(this.separator))])])};io._withStripped=!0;var ro=r({name:"ElBreadcrumbItem",props:{to:{},replace:Boolean},data:function(){return{separator:"",separatorClass:""}},inject:["elBreadcrumb"],mounted:function(){var t=this;this.separator=this.elBreadcrumb.separator,this.separatorClass=this.elBreadcrumb.separatorClass;var e=this.$refs.link;e.setAttribute("role","link"),e.addEventListener("click",function(e){var n=t.to,i=t.$router;n&&i&&(t.replace?i.replace(n):i.push(n))})}},io,[],!1,null,null,null);ro.options.__file="packages/breadcrumb/src/breadcrumb-item.vue";var oo=ro.exports;oo.install=function(t){t.component(oo.name,oo)};var so=oo,ao=function(){var t=this.$createElement;return(this._self._c||t)("form",{staticClass:"el-form",class:[this.labelPosition?"el-form--label-"+this.labelPosition:"",{"el-form--inline":this.inline}]},[this._t("default")],2)};ao._withStripped=!0;var lo=r({name:"ElForm",componentName:"ElForm",provide:function(){return{elForm:this}},props:{model:Object,rules:Object,labelPosition:String,labelWidth:String,labelSuffix:{type:String,default:""},inline:Boolean,inlineMessage:Boolean,statusIcon:Boolean,showMessage:{type:Boolean,default:!0},size:String,disabled:Boolean,validateOnRuleChange:{type:Boolean,default:!0},hideRequiredAsterisk:{type:Boolean,default:!1}},watch:{rules:function(){this.fields.forEach(function(t){t.removeValidateEvents(),t.addValidateEvents()}),this.validateOnRuleChange&&this.validate(function(){})}},computed:{autoLabelWidth:function(){if(!this.potentialLabelWidthArr.length)return 0;var t=Math.max.apply(Math,this.potentialLabelWidthArr);return t?t+"px":""}},data:function(){return{fields:[],potentialLabelWidthArr:[]}},created:function(){var t=this;this.$on("el.form.addField",function(e){e&&t.fields.push(e)}),this.$on("el.form.removeField",function(e){e.prop&&t.fields.splice(t.fields.indexOf(e),1)})},methods:{resetFields:function(){this.model?this.fields.forEach(function(t){t.resetField()}):console.warn("[Element Warn][Form]model is required for resetFields to work.")},clearValidate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(t.length?"string"==typeof t?this.fields.filter(function(e){return t===e.prop}):this.fields.filter(function(e){return t.indexOf(e.prop)>-1}):this.fields).forEach(function(t){t.clearValidate()})},validate:function(t){var e=this;if(this.model){var n=void 0;"function"!=typeof t&&window.Promise&&(n=new window.Promise(function(e,n){t=function(t){t?e(t):n(t)}}));var i=!0,r=0;0===this.fields.length&&t&&t(!0);var o={};return this.fields.forEach(function(n){n.validate("",function(n,s){n&&(i=!1),o=Ht()({},o,s),"function"==typeof t&&++r===e.fields.length&&t(i,o)})}),n||void 0}console.warn("[Element Warn][Form]model is required for validate to work!")},validateField:function(t,e){t=[].concat(t);var n=this.fields.filter(function(e){return-1!==t.indexOf(e.prop)});n.length?n.forEach(function(t){t.validate("",e)}):console.warn("[Element Warn]please pass correct props!")},getLabelWidthIndex:function(t){var e=this.potentialLabelWidthArr.indexOf(t);if(-1===e)throw new Error("[ElementForm]unpected width ",t);return e},registerLabelWidth:function(t,e){if(t&&e){var n=this.getLabelWidthIndex(e);this.potentialLabelWidthArr.splice(n,1,t)}else t&&this.potentialLabelWidthArr.push(t)},deregisterLabelWidth:function(t){var e=this.getLabelWidthIndex(t);this.potentialLabelWidthArr.splice(e,1)}}},ao,[],!1,null,null,null);lo.options.__file="packages/form/src/form.vue";var uo=lo.exports;uo.install=function(t){t.component(uo.name,uo)};var co=uo,ho=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-form-item",class:[{"el-form-item--feedback":t.elForm&&t.elForm.statusIcon,"is-error":"error"===t.validateState,"is-validating":"validating"===t.validateState,"is-success":"success"===t.validateState,"is-required":t.isRequired||t.required,"is-no-asterisk":t.elForm&&t.elForm.hideRequiredAsterisk},t.sizeClass?"el-form-item--"+t.sizeClass:""]},[n("label-wrap",{attrs:{"is-auto-width":t.labelStyle&&"auto"===t.labelStyle.width,"update-all":"auto"===t.form.labelWidth}},[t.label||t.$slots.label?n("label",{staticClass:"el-form-item__label",style:t.labelStyle,attrs:{for:t.labelFor}},[t._t("label",[t._v(t._s(t.label+t.form.labelSuffix))])],2):t._e()]),n("div",{staticClass:"el-form-item__content",style:t.contentStyle},[t._t("default"),n("transition",{attrs:{name:"el-zoom-in-top"}},["error"===t.validateState&&t.showMessage&&t.form.showMessage?t._t("error",[n("div",{staticClass:"el-form-item__error",class:{"el-form-item__error--inline":"boolean"==typeof t.inlineMessage?t.inlineMessage:t.elForm&&t.elForm.inlineMessage||!1}},[t._v("\n "+t._s(t.validateMessage)+"\n ")])],{error:t.validateMessage}):t._e()],2)],2)],1)};ho._withStripped=!0;var po=n(40),fo=n.n(po),go=r({props:{isAutoWidth:Boolean,updateAll:Boolean},inject:["elForm","elFormItem"],render:function(){var t=arguments[0],e=this.$slots.default;if(!e)return null;if(this.isAutoWidth){var n=this.elForm.autoLabelWidth,i={};if(n&&"auto"!==n){var r=parseInt(n,10)-this.computedWidth;r&&(i.marginLeft=r+"px")}return t("div",{class:"el-form-item__label-wrap",style:i},[e])}return e[0]},methods:{getLabelWidth:function(){if(this.$el&&this.$el.firstElementChild){var t=window.getComputedStyle(this.$el.firstElementChild).width;return Math.ceil(parseFloat(t))}return 0},updateLabelWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"update";this.$slots.default&&this.isAutoWidth&&this.$el.firstElementChild&&("update"===t?this.computedWidth=this.getLabelWidth():"remove"===t&&this.elForm.deregisterLabelWidth(this.computedWidth))}},watch:{computedWidth:function(t,e){this.updateAll&&(this.elForm.registerLabelWidth(t,e),this.elFormItem.updateComputedLabelWidth(t))}},data:function(){return{computedWidth:0}},mounted:function(){this.updateLabelWidth("update")},updated:function(){this.updateLabelWidth("update")},beforeDestroy:function(){this.updateLabelWidth("remove")}},void 0,void 0,!1,null,null,null);go.options.__file="packages/form/src/label-wrap.vue";var mo=go.exports,vo=r({name:"ElFormItem",componentName:"ElFormItem",mixins:[S.a],provide:function(){return{elFormItem:this}},inject:["elForm"],props:{label:String,labelWidth:String,prop:String,required:{type:Boolean,default:void 0},rules:[Object,Array],error:String,validateStatus:String,for:String,inlineMessage:{type:[String,Boolean],default:""},showMessage:{type:Boolean,default:!0},size:String},components:{LabelWrap:mo},watch:{error:{immediate:!0,handler:function(t){this.validateMessage=t,this.validateState=t?"error":""}},validateStatus:function(t){this.validateState=t}},computed:{labelFor:function(){return this.for||this.prop},labelStyle:function(){var t={};if("top"===this.form.labelPosition)return t;var e=this.labelWidth||this.form.labelWidth;return e&&(t.width=e),t},contentStyle:function(){var t={},e=this.label;if("top"===this.form.labelPosition||this.form.inline)return t;if(!e&&!this.labelWidth&&this.isNested)return t;var n=this.labelWidth||this.form.labelWidth;return"auto"===n?"auto"===this.labelWidth?t.marginLeft=this.computedLabelWidth:"auto"===this.form.labelWidth&&(t.marginLeft=this.elForm.autoLabelWidth):t.marginLeft=n,t},form:function(){for(var t=this.$parent,e=t.$options.componentName;"ElForm"!==e;)"ElFormItem"===e&&(this.isNested=!0),e=(t=t.$parent).$options.componentName;return t},fieldValue:function(){var t=this.form.model;if(t&&this.prop){var e=this.prop;return-1!==e.indexOf(":")&&(e=e.replace(/:/,".")),Object(g.getPropByPath)(t,e,!0).v}},isRequired:function(){var t=this.getRules(),e=!1;return t&&t.length&&t.every(function(t){return!t.required||(e=!0,!1)}),e},_formSize:function(){return this.elForm.size},elFormItemSize:function(){return this.size||this._formSize},sizeClass:function(){return this.elFormItemSize||(this.$ELEMENT||{}).size}},data:function(){return{validateState:"",validateMessage:"",validateDisabled:!1,validator:{},isNested:!1,computedLabelWidth:""}},methods:{validate:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.noop;this.validateDisabled=!1;var i=this.getFilteredRule(t);if((!i||0===i.length)&&void 0===this.required)return n(),!0;this.validateState="validating";var r={};i&&i.length>0&&i.forEach(function(t){delete t.trigger}),r[this.prop]=i;var o=new fo.a(r),s={};s[this.prop]=this.fieldValue,o.validate(s,{firstFields:!0},function(t,i){e.validateState=t?"error":"success",e.validateMessage=t?t[0].message:"",n(e.validateMessage,i),e.elForm&&e.elForm.$emit("validate",e.prop,!t,e.validateMessage||null)})},clearValidate:function(){this.validateState="",this.validateMessage="",this.validateDisabled=!1},resetField:function(){var t=this;this.validateState="",this.validateMessage="";var e=this.form.model,n=this.fieldValue,i=this.prop;-1!==i.indexOf(":")&&(i=i.replace(/:/,"."));var r=Object(g.getPropByPath)(e,i,!0);this.validateDisabled=!0,Array.isArray(n)?r.o[r.k]=[].concat(this.initialValue):r.o[r.k]=this.initialValue,this.$nextTick(function(){t.validateDisabled=!1}),this.broadcast("ElTimeSelect","fieldReset",this.initialValue)},getRules:function(){var t=this.form.rules,e=this.rules,n=void 0!==this.required?{required:!!this.required}:[],i=Object(g.getPropByPath)(t,this.prop||"");return t=t?i.o[this.prop||""]||i.v:[],[].concat(e||t||[]).concat(n)},getFilteredRule:function(t){return this.getRules().filter(function(e){return!e.trigger||""===t||(Array.isArray(e.trigger)?e.trigger.indexOf(t)>-1:e.trigger===t)}).map(function(t){return Ht()({},t)})},onFieldBlur:function(){this.validate("blur")},onFieldChange:function(){this.validateDisabled?this.validateDisabled=!1:this.validate("change")},updateComputedLabelWidth:function(t){this.computedLabelWidth=t?t+"px":""},addValidateEvents:function(){(this.getRules().length||void 0!==this.required)&&(this.$on("el.form.blur",this.onFieldBlur),this.$on("el.form.change",this.onFieldChange))},removeValidateEvents:function(){this.$off()}},mounted:function(){if(this.prop){this.dispatch("ElForm","el.form.addField",[this]);var t=this.fieldValue;Array.isArray(t)&&(t=[].concat(t)),Object.defineProperty(this,"initialValue",{value:t}),this.addValidateEvents()}},beforeDestroy:function(){this.dispatch("ElForm","el.form.removeField",[this])}},ho,[],!1,null,null,null);vo.options.__file="packages/form/src/form-item.vue";var _o=vo.exports;_o.install=function(t){t.component(_o.name,_o)};var yo=_o,bo=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-tabs__active-bar",class:"is-"+this.rootTabs.tabPosition,style:this.barStyle})};bo._withStripped=!0;var To=r({name:"TabBar",props:{tabs:Array},inject:["rootTabs"],computed:{barStyle:{get:function(){var t=this,e={},n=0,i=0,r=-1!==["top","bottom"].indexOf(this.rootTabs.tabPosition)?"width":"height",o="width"===r?"x":"y",s=function(t){return t.toLowerCase().replace(/( |^)[a-z]/g,function(t){return t.toUpperCase()})};this.tabs.every(function(e,o){var a=Object(g.arrayFind)(t.$parent.$refs.tabs||[],function(t){return t.id.replace("tab-","")===e.paneName});if(!a)return!1;if(e.active){i=a["client"+s(r)];var l=window.getComputedStyle(a);return"width"===r&&t.tabs.length>1&&(i-=parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)),"width"===r&&(n+=parseFloat(l.paddingLeft)),!1}return n+=a["client"+s(r)],!0});var a="translate"+s(o)+"("+n+"px)";return e[r]=i+"px",e.transform=a,e.msTransform=a,e.webkitTransform=a,e}}}},bo,[],!1,null,null,null);function Eo(){}To.options.__file="packages/tabs/src/tab-bar.vue";var Co=function(t){return t.toLowerCase().replace(/( |^)[a-z]/g,function(t){return t.toUpperCase()})},So=r({name:"TabNav",components:{TabBar:To.exports},inject:["rootTabs"],props:{panes:Array,currentName:String,editable:Boolean,onTabClick:{type:Function,default:Eo},onTabRemove:{type:Function,default:Eo},type:String,stretch:Boolean},data:function(){return{scrollable:!1,navOffset:0,isFocus:!1,focusable:!0}},computed:{navStyle:function(){return{transform:"translate"+(-1!==["top","bottom"].indexOf(this.rootTabs.tabPosition)?"X":"Y")+"(-"+this.navOffset+"px)"}},sizeName:function(){return-1!==["top","bottom"].indexOf(this.rootTabs.tabPosition)?"width":"height"}},methods:{scrollPrev:function(){var t=this.$refs.navScroll["offset"+Co(this.sizeName)],e=this.navOffset;if(e){var n=e>t?e-t:0;this.navOffset=n}},scrollNext:function(){var t=this.$refs.nav["offset"+Co(this.sizeName)],e=this.$refs.navScroll["offset"+Co(this.sizeName)],n=this.navOffset;if(!(t-n<=e)){var i=t-n>2*e?n+e:t-e;this.navOffset=i}},scrollToActiveTab:function(){if(this.scrollable){var t=this.$refs.nav,e=this.$el.querySelector(".is-active");if(e){var n=this.$refs.navScroll,i=-1!==["top","bottom"].indexOf(this.rootTabs.tabPosition),r=e.getBoundingClientRect(),o=n.getBoundingClientRect(),s=i?t.offsetWidth-o.width:t.offsetHeight-o.height,a=this.navOffset,l=a;i?(r.left<o.left&&(l=a-(o.left-r.left)),r.right>o.right&&(l=a+r.right-o.right)):(r.top<o.top&&(l=a-(o.top-r.top)),r.bottom>o.bottom&&(l=a+(r.bottom-o.bottom))),l=Math.max(l,0),this.navOffset=Math.min(l,s)}}},update:function(){if(this.$refs.nav){var t=this.sizeName,e=this.$refs.nav["offset"+Co(t)],n=this.$refs.navScroll["offset"+Co(t)],i=this.navOffset;if(n<e){var r=this.navOffset;this.scrollable=this.scrollable||{},this.scrollable.prev=r,this.scrollable.next=r+n<e,e-r<n&&(this.navOffset=e-n)}else this.scrollable=!1,i>0&&(this.navOffset=0)}},changeTab:function(t){var e=t.keyCode,n=void 0,i=void 0,r=void 0;-1!==[37,38,39,40].indexOf(e)&&(r=t.currentTarget.querySelectorAll("[role=tab]"),i=Array.prototype.indexOf.call(r,t.target),r[n=37===e||38===e?0===i?r.length-1:i-1:i<r.length-1?i+1:0].focus(),r[n].click(),this.setFocus())},setFocus:function(){this.focusable&&(this.isFocus=!0)},removeFocus:function(){this.isFocus=!1},visibilityChangeHandler:function(){var t=this,e=document.visibilityState;"hidden"===e?this.focusable=!1:"visible"===e&&setTimeout(function(){t.focusable=!0},50)},windowBlurHandler:function(){this.focusable=!1},windowFocusHandler:function(){var t=this;setTimeout(function(){t.focusable=!0},50)}},updated:function(){this.update()},render:function(t){var e=this,n=this.type,i=this.panes,r=this.editable,o=this.stretch,s=this.onTabClick,a=this.onTabRemove,l=this.navStyle,u=this.scrollable,c=this.scrollNext,h=this.scrollPrev,p=this.changeTab,d=this.setFocus,f=this.removeFocus,g=u?[t("span",{class:["el-tabs__nav-prev",u.prev?"":"is-disabled"],on:{click:h}},[t("i",{class:"el-icon-arrow-left"})]),t("span",{class:["el-tabs__nav-next",u.next?"":"is-disabled"],on:{click:c}},[t("i",{class:"el-icon-arrow-right"})])]:null,m=this._l(i,function(n,i){var o,l=n.name||n.index||i,u=n.isClosable||r;n.index=""+i;var c=u?t("span",{class:"el-icon-close",on:{click:function(t){a(n,t)}}}):null,h=n.$slots.label||n.label,p=n.active?0:-1;return t("div",{class:(o={"el-tabs__item":!0},o["is-"+e.rootTabs.tabPosition]=!0,o["is-active"]=n.active,o["is-disabled"]=n.disabled,o["is-closable"]=u,o["is-focus"]=e.isFocus,o),attrs:{id:"tab-"+l,"aria-controls":"pane-"+l,role:"tab","aria-selected":n.active,tabindex:p},key:"tab-"+l,ref:"tabs",refInFor:!0,on:{focus:function(){d()},blur:function(){f()},click:function(t){f(),s(n,l,t)},keydown:function(t){!u||46!==t.keyCode&&8!==t.keyCode||a(n,t)}}},[h,c])});return t("div",{class:["el-tabs__nav-wrap",u?"is-scrollable":"","is-"+this.rootTabs.tabPosition]},[g,t("div",{class:["el-tabs__nav-scroll"],ref:"navScroll"},[t("div",{class:["el-tabs__nav","is-"+this.rootTabs.tabPosition,o&&-1!==["top","bottom"].indexOf(this.rootTabs.tabPosition)?"is-stretch":""],ref:"nav",style:l,attrs:{role:"tablist"},on:{keydown:p}},[n?null:t("tab-bar",{attrs:{tabs:i}}),m])])])},mounted:function(){var t=this;Object(Pe.addResizeListener)(this.$el,this.update),document.addEventListener("visibilitychange",this.visibilityChangeHandler),window.addEventListener("blur",this.windowBlurHandler),window.addEventListener("focus",this.windowFocusHandler),setTimeout(function(){t.scrollToActiveTab()},0)},beforeDestroy:function(){this.$el&&this.update&&Object(Pe.removeResizeListener)(this.$el,this.update),document.removeEventListener("visibilitychange",this.visibilityChangeHandler),window.removeEventListener("blur",this.windowBlurHandler),window.removeEventListener("focus",this.windowFocusHandler)}},void 0,void 0,!1,null,null,null);So.options.__file="packages/tabs/src/tab-nav.vue";var wo=r({name:"ElTabs",components:{TabNav:So.exports},props:{type:String,activeName:String,closable:Boolean,addable:Boolean,value:{},editable:Boolean,tabPosition:{type:String,default:"top"},beforeLeave:Function,stretch:Boolean},provide:function(){return{rootTabs:this}},data:function(){return{currentName:this.value||this.activeName,panes:[]}},watch:{activeName:function(t){this.setCurrentName(t)},value:function(t){this.setCurrentName(t)},currentName:function(t){var e=this;this.$refs.nav&&this.$nextTick(function(){e.$refs.nav.$nextTick(function(t){e.$refs.nav.scrollToActiveTab()})})}},methods:{calcPaneInstances:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.$slots.default){var n=this.$slots.default.filter(function(t){return t.tag&&t.componentOptions&&"ElTabPane"===t.componentOptions.Ctor.options.name}).map(function(t){return t.componentInstance}),i=!(n.length===this.panes.length&&n.every(function(e,n){return e===t.panes[n]}));(e||i)&&(this.panes=n)}else 0!==this.panes.length&&(this.panes=[])},handleTabClick:function(t,e,n){t.disabled||(this.setCurrentName(e),this.$emit("tab-click",t,n))},handleTabRemove:function(t,e){t.disabled||(e.stopPropagation(),this.$emit("edit",t.name,"remove"),this.$emit("tab-remove",t.name))},handleTabAdd:function(){this.$emit("edit",null,"add"),this.$emit("tab-add")},setCurrentName:function(t){var e=this,n=function(){e.currentName=t,e.$emit("input",t)};if(this.currentName!==t&&this.beforeLeave){var i=this.beforeLeave(t,this.currentName);i&&i.then?i.then(function(){n(),e.$refs.nav&&e.$refs.nav.removeFocus()},function(){}):!1!==i&&n()}else n()}},render:function(t){var e,n=this.type,i=this.handleTabClick,r=this.handleTabRemove,o=this.handleTabAdd,s=this.currentName,a=this.panes,l=this.editable,u=this.addable,c=this.tabPosition,h=this.stretch,p=t("div",{class:["el-tabs__header","is-"+c]},[l||u?t("span",{class:"el-tabs__new-tab",on:{click:o,keydown:function(t){13===t.keyCode&&o()}},attrs:{tabindex:"0"}},[t("i",{class:"el-icon-plus"})]):null,t("tab-nav",{props:{currentName:s,onTabClick:i,onTabRemove:r,editable:l,type:n,panes:a,stretch:h},ref:"nav"})]),d=t("div",{class:"el-tabs__content"},[this.$slots.default]);return t("div",{class:(e={"el-tabs":!0,"el-tabs--card":"card"===n},e["el-tabs--"+c]=!0,e["el-tabs--border-card"]="border-card"===n,e)},["bottom"!==c?[p,d]:[d,p]])},created:function(){this.currentName||this.setCurrentName("0"),this.$on("tab-nav-update",this.calcPaneInstances.bind(null,!0))},mounted:function(){this.calcPaneInstances()},updated:function(){this.calcPaneInstances()}},void 0,void 0,!1,null,null,null);wo.options.__file="packages/tabs/src/tabs.vue";var ko=wo.exports;ko.install=function(t){t.component(ko.name,ko)};var xo=ko,Io=function(){var t=this,e=t.$createElement,n=t._self._c||e;return!t.lazy||t.loaded||t.active?n("div",{directives:[{name:"show",rawName:"v-show",value:t.active,expression:"active"}],staticClass:"el-tab-pane",attrs:{role:"tabpanel","aria-hidden":!t.active,id:"pane-"+t.paneName,"aria-labelledby":"tab-"+t.paneName}},[t._t("default")],2):t._e()};Io._withStripped=!0;var Ro=r({name:"ElTabPane",componentName:"ElTabPane",props:{label:String,labelContent:Function,name:String,closable:Boolean,disabled:Boolean,lazy:Boolean},data:function(){return{index:null,loaded:!1}},computed:{isClosable:function(){return this.closable||this.$parent.closable},active:function(){var t=this.$parent.currentName===(this.name||this.index);return t&&(this.loaded=!0),t},paneName:function(){return this.name||this.index}},updated:function(){this.$parent.$emit("tab-nav-update")}},Io,[],!1,null,null,null);Ro.options.__file="packages/tabs/src/tab-pane.vue";var Oo=Ro.exports;Oo.install=function(t){t.component(Oo.name,Oo)};var Do=Oo,Ao=r({name:"ElTag",props:{text:String,closable:Boolean,type:String,hit:Boolean,disableTransitions:Boolean,color:String,size:String,effect:{type:String,default:"light",validator:function(t){return-1!==["dark","light","plain"].indexOf(t)}}},methods:{handleClose:function(t){t.stopPropagation(),this.$emit("close",t)},handleClick:function(t){this.$emit("click",t)}},computed:{tagSize:function(){return this.size||(this.$ELEMENT||{}).size}},render:function(t){var e=this.type,n=this.tagSize,i=this.hit,r=this.effect,o=t("span",{class:["el-tag",e?"el-tag--"+e:"",n?"el-tag--"+n:"",r?"el-tag--"+r:"",i&&"is-hit"],style:{backgroundColor:this.color},on:{click:this.handleClick}},[this.$slots.default,this.closable&&t("i",{class:"el-tag__close el-icon-close",on:{click:this.handleClose}})]);return this.disableTransitions?o:t("transition",{attrs:{name:"el-zoom-in-center"}},[o])}},void 0,void 0,!1,null,null,null);Ao.options.__file="packages/tag/src/tag.vue";var Mo=Ao.exports;Mo.install=function(t){t.component(Mo.name,Mo)};var No=Mo,Lo=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-tree",class:{"el-tree--highlight-current":t.highlightCurrent,"is-dragging":!!t.dragState.draggingNode,"is-drop-not-allow":!t.dragState.allowDrop,"is-drop-inner":"inner"===t.dragState.dropType},attrs:{role:"tree"}},[t._l(t.root.childNodes,function(e){return n("el-tree-node",{key:t.getNodeKey(e),attrs:{node:e,props:t.props,"render-after-expand":t.renderAfterExpand,"show-checkbox":t.showCheckbox,"render-content":t.renderContent},on:{"node-expand":t.handleNodeExpand}})}),t.isEmpty?n("div",{staticClass:"el-tree__empty-block"},[n("span",{staticClass:"el-tree__empty-text"},[t._v(t._s(t.emptyText))])]):t._e(),n("div",{directives:[{name:"show",rawName:"v-show",value:t.dragState.showDropIndicator,expression:"dragState.showDropIndicator"}],ref:"dropIndicator",staticClass:"el-tree__drop-indicator"})],2)};Lo._withStripped=!0;var Po="$treeNodeId",Bo=function(t,e){e&&!e[Po]&&Object.defineProperty(e,Po,{value:t.id,enumerable:!1,configurable:!1,writable:!1})},Fo=function(t,e){return t?e[t]:e[Po]},Uo=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var Vo=function(t){for(var e=!0,n=!0,i=!0,r=0,o=t.length;r<o;r++){var s=t[r];(!0!==s.checked||s.indeterminate)&&(e=!1,s.disabled||(i=!1)),(!1!==s.checked||s.indeterminate)&&(n=!1)}return{all:e,none:n,allWithoutDisable:i,half:!e&&!n}},Ho=function t(e){if(0!==e.childNodes.length){var n=Vo(e.childNodes),i=n.all,r=n.none,o=n.half;i?(e.checked=!0,e.indeterminate=!1):o?(e.checked=!1,e.indeterminate=!0):r&&(e.checked=!1,e.indeterminate=!1);var s=e.parent;s&&0!==s.level&&(e.store.checkStrictly||t(s))}},Wo=function(t,e){var n=t.store.props,i=t.data||{},r=n[e];if("function"==typeof r)return r(i,t);if("string"==typeof r)return i[r];if(void 0===r){var o=i[e];return void 0===o?"":o}},Go=0,jo=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=Go++,this.text=null,this.checked=!1,this.indeterminate=!1,this.data=null,this.expanded=!1,this.parent=null,this.visible=!0,this.isCurrent=!1,e)e.hasOwnProperty(n)&&(this[n]=e[n]);this.level=0,this.loaded=!1,this.childNodes=[],this.loading=!1,this.parent&&(this.level=this.parent.level+1);var i=this.store;if(!i)throw new Error("[Node]store is required!");i.registerNode(this);var r=i.props;if(r&&void 0!==r.isLeaf){var o=Wo(this,"isLeaf");"boolean"==typeof o&&(this.isLeafByUser=o)}if(!0!==i.lazy&&this.data?(this.setData(this.data),i.defaultExpandAll&&(this.expanded=!0)):this.level>0&&i.lazy&&i.defaultExpandAll&&this.expand(),Array.isArray(this.data)||Bo(this,this.data),this.data){var s=i.defaultExpandedKeys,a=i.key;a&&s&&-1!==s.indexOf(this.key)&&this.expand(null,i.autoExpandParent),a&&void 0!==i.currentNodeKey&&this.key===i.currentNodeKey&&(i.currentNode=this,i.currentNode.isCurrent=!0),i.lazy&&i._initDefaultCheckedNode(this),this.updateLeafState()}}return t.prototype.setData=function(t){Array.isArray(t)||Bo(this,t),this.data=t,this.childNodes=[];for(var e=void 0,n=0,i=(e=0===this.level&&this.data instanceof Array?this.data:Wo(this,"children")||[]).length;n<i;n++)this.insertChild({data:e[n]})},t.prototype.contains=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function n(i){for(var r=i.childNodes||[],o=!1,s=0,a=r.length;s<a;s++){var l=r[s];if(l===t||e&&n(l)){o=!0;break}}return o}(this)},t.prototype.remove=function(){var t=this.parent;t&&t.removeChild(this)},t.prototype.insertChild=function(e,n,i){if(!e)throw new Error("insertChild error: child is required.");if(!(e instanceof t)){if(!i){var r=this.getChildren(!0);-1===r.indexOf(e.data)&&(void 0===n||n<0?r.push(e.data):r.splice(n,0,e.data))}Ht()(e,{parent:this,store:this.store}),e=new t(e)}e.level=this.level+1,void 0===n||n<0?this.childNodes.push(e):this.childNodes.splice(n,0,e),this.updateLeafState()},t.prototype.insertBefore=function(t,e){var n=void 0;e&&(n=this.childNodes.indexOf(e)),this.insertChild(t,n)},t.prototype.insertAfter=function(t,e){var n=void 0;e&&-1!==(n=this.childNodes.indexOf(e))&&(n+=1),this.insertChild(t,n)},t.prototype.removeChild=function(t){var e=this.getChildren()||[],n=e.indexOf(t.data);n>-1&&e.splice(n,1);var i=this.childNodes.indexOf(t);i>-1&&(this.store&&this.store.deregisterNode(t),t.parent=null,this.childNodes.splice(i,1)),this.updateLeafState()},t.prototype.removeChildByData=function(t){for(var e=null,n=0;n<this.childNodes.length;n++)if(this.childNodes[n].data===t){e=this.childNodes[n];break}e&&this.removeChild(e)},t.prototype.expand=function(t,e){var n=this,i=function(){if(e)for(var i=n.parent;i.level>0;)i.expanded=!0,i=i.parent;n.expanded=!0,t&&t()};this.shouldLoadData()?this.loadData(function(t){t instanceof Array&&(n.checked?n.setChecked(!0,!0):n.store.checkStrictly||Ho(n),i())}):i()},t.prototype.doCreateChildren=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.forEach(function(t){e.insertChild(Ht()({data:t},n),void 0,!0)})},t.prototype.collapse=function(){this.expanded=!1},t.prototype.shouldLoadData=function(){return!0===this.store.lazy&&this.store.load&&!this.loaded},t.prototype.updateLeafState=function(){if(!0!==this.store.lazy||!0===this.loaded||void 0===this.isLeafByUser){var t=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!t||0===t.length:this.isLeaf=!1}else this.isLeaf=this.isLeafByUser},t.prototype.setChecked=function(t,e,n,i){var r=this;if(this.indeterminate="half"===t,this.checked=!0===t,!this.store.checkStrictly){if(!this.shouldLoadData()||this.store.checkDescendants){var o=Vo(this.childNodes),s=o.all,a=o.allWithoutDisable;this.isLeaf||s||!a||(this.checked=!1,t=!1);var l=function(){if(e){for(var n=r.childNodes,o=0,s=n.length;o<s;o++){var a=n[o];i=i||!1!==t;var l=a.disabled?a.checked:i;a.setChecked(l,e,!0,i)}var u=Vo(n),c=u.half,h=u.all;h||(r.checked=h,r.indeterminate=c)}};if(this.shouldLoadData())return void this.loadData(function(){l(),Ho(r)},{checked:!1!==t});l()}var u=this.parent;u&&0!==u.level&&(n||Ho(u))}},t.prototype.getChildren=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(0===this.level)return this.data;var e=this.data;if(!e)return null;var n=this.store.props,i="children";return n&&(i=n.children||"children"),void 0===e[i]&&(e[i]=null),t&&!e[i]&&(e[i]=[]),e[i]},t.prototype.updateChildren=function(){var t=this,e=this.getChildren()||[],n=this.childNodes.map(function(t){return t.data}),i={},r=[];e.forEach(function(t,e){var o=t[Po];!!o&&Object(g.arrayFindIndex)(n,function(t){return t[Po]===o})>=0?i[o]={index:e,data:t}:r.push({index:e,data:t})}),this.store.lazy||n.forEach(function(e){i[e[Po]]||t.removeChildByData(e)}),r.forEach(function(e){var n=e.index,i=e.data;t.insertChild({data:i},n)}),this.updateLeafState()},t.prototype.loadData=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!0!==this.store.lazy||!this.store.load||this.loaded||this.loading&&!Object.keys(n).length)t&&t.call(this);else{this.loading=!0;this.store.load(this,function(i){e.loaded=!0,e.loading=!1,e.childNodes=[],e.doCreateChildren(i,n),e.updateLeafState(),t&&t.call(e,i)})}},Uo(t,[{key:"label",get:function(){return Wo(this,"label")}},{key:"key",get:function(){var t=this.store.key;return this.data?this.data[t]:null}},{key:"disabled",get:function(){return Wo(this,"disabled")}},{key:"nextSibling",get:function(){var t=this.parent;if(t){var e=t.childNodes.indexOf(this);if(e>-1)return t.childNodes[e+1]}return null}},{key:"previousSibling",get:function(){var t=this.parent;if(t){var e=t.childNodes.indexOf(this);if(e>-1)return e>0?t.childNodes[e-1]:null}return null}}]),t}(),zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var $o=function(){function t(e){var n=this;for(var i in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.currentNode=null,this.currentNodeKey=null,e)e.hasOwnProperty(i)&&(this[i]=e[i]);(this.nodesMap={},this.root=new jo({data:this.data,store:this}),this.lazy&&this.load)?(0,this.load)(this.root,function(t){n.root.doCreateChildren(t),n._initDefaultCheckedNodes()}):this._initDefaultCheckedNodes()}return t.prototype.filter=function(t){var e=this.filterNodeMethod,n=this.lazy;!function i(r){var o=r.root?r.root.childNodes:r.childNodes;if(o.forEach(function(n){n.visible=e.call(n,t,n.data,n),i(n)}),!r.visible&&o.length){var s;s=!o.some(function(t){return t.visible}),r.root?r.root.visible=!1===s:r.visible=!1===s}t&&(!r.visible||r.isLeaf||n||r.expand())}(this)},t.prototype.setData=function(t){t!==this.root.data?(this.root.setData(t),this._initDefaultCheckedNodes()):this.root.updateChildren()},t.prototype.getNode=function(t){if(t instanceof jo)return t;var e="object"!==(void 0===t?"undefined":zo(t))?t:Fo(this.key,t);return this.nodesMap[e]||null},t.prototype.insertBefore=function(t,e){var n=this.getNode(e);n.parent.insertBefore({data:t},n)},t.prototype.insertAfter=function(t,e){var n=this.getNode(e);n.parent.insertAfter({data:t},n)},t.prototype.remove=function(t){var e=this.getNode(t);e&&e.parent&&(e===this.currentNode&&(this.currentNode=null),e.parent.removeChild(e))},t.prototype.append=function(t,e){var n=e?this.getNode(e):this.root;n&&n.insertChild({data:t})},t.prototype._initDefaultCheckedNodes=function(){var t=this,e=this.defaultCheckedKeys||[],n=this.nodesMap;e.forEach(function(e){var i=n[e];i&&i.setChecked(!0,!t.checkStrictly)})},t.prototype._initDefaultCheckedNode=function(t){-1!==(this.defaultCheckedKeys||[]).indexOf(t.key)&&t.setChecked(!0,!this.checkStrictly)},t.prototype.setDefaultCheckedKey=function(t){t!==this.defaultCheckedKeys&&(this.defaultCheckedKeys=t,this._initDefaultCheckedNodes())},t.prototype.registerNode=function(t){this.key&&t&&t.data&&(void 0!==t.key&&(this.nodesMap[t.key]=t))},t.prototype.deregisterNode=function(t){var e=this;this.key&&t&&t.data&&(t.childNodes.forEach(function(t){e.deregisterNode(t)}),delete this.nodesMap[t.key])},t.prototype.getCheckedNodes=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return function i(r){(r.root?r.root.childNodes:r.childNodes).forEach(function(r){(r.checked||e&&r.indeterminate)&&(!t||t&&r.isLeaf)&&n.push(r.data),i(r)})}(this),n},t.prototype.getCheckedKeys=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.getCheckedNodes(e).map(function(e){return(e||{})[t.key]})},t.prototype.getHalfCheckedNodes=function(){var t=[];return function e(n){(n.root?n.root.childNodes:n.childNodes).forEach(function(n){n.indeterminate&&t.push(n.data),e(n)})}(this),t},t.prototype.getHalfCheckedKeys=function(){var t=this;return this.getHalfCheckedNodes().map(function(e){return(e||{})[t.key]})},t.prototype._getAllNodes=function(){var t=[],e=this.nodesMap;for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},t.prototype.updateChildren=function(t,e){var n=this.nodesMap[t];if(n){for(var i=n.childNodes,r=i.length-1;r>=0;r--){var o=i[r];this.remove(o.data)}for(var s=0,a=e.length;s<a;s++){var l=e[s];this.append(l,n.data)}}},t.prototype._setCheckedKeys=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments[2],i=this._getAllNodes().sort(function(t,e){return e.level-t.level}),r=Object.create(null),o=Object.keys(n);i.forEach(function(t){return t.setChecked(!1,!1)});for(var s=0,a=i.length;s<a;s++){var l=i[s],u=l.data[t].toString();if(o.indexOf(u)>-1){for(var c=l.parent;c&&c.level>0;)r[c.data[t]]=!0,c=c.parent;l.isLeaf||this.checkStrictly?l.setChecked(!0,!1):(l.setChecked(!0,!0),e&&function(){l.setChecked(!1,!1);!function t(e){e.childNodes.forEach(function(e){e.isLeaf||e.setChecked(!1,!1),t(e)})}(l)}())}else l.checked&&!r[u]&&l.setChecked(!1,!1)}},t.prototype.setCheckedNodes=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.key,i={};t.forEach(function(t){i[(t||{})[n]]=!0}),this._setCheckedKeys(n,e,i)},t.prototype.setCheckedKeys=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.defaultCheckedKeys=t;var n=this.key,i={};t.forEach(function(t){i[t]=!0}),this._setCheckedKeys(n,e,i)},t.prototype.setDefaultExpandedKeys=function(t){var e=this;t=t||[],this.defaultExpandedKeys=t,t.forEach(function(t){var n=e.getNode(t);n&&n.expand(null,e.autoExpandParent)})},t.prototype.setChecked=function(t,e,n){var i=this.getNode(t);i&&i.setChecked(!!e,n)},t.prototype.getCurrentNode=function(){return this.currentNode},t.prototype.setCurrentNode=function(t){var e=this.currentNode;e&&(e.isCurrent=!1),this.currentNode=t,this.currentNode.isCurrent=!0},t.prototype.setUserCurrentNode=function(t){var e=t[this.key],n=this.nodesMap[e];this.setCurrentNode(n)},t.prototype.setCurrentNodeKey=function(t){if(null===t||void 0===t)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);var e=this.getNode(t);e&&this.setCurrentNode(e)},t}(),Xo=function(){var t=this,e=this,n=e.$createElement,i=e._self._c||n;return i("div",{directives:[{name:"show",rawName:"v-show",value:e.node.visible,expression:"node.visible"}],ref:"node",staticClass:"el-tree-node",class:{"is-expanded":e.expanded,"is-current":e.node.isCurrent,"is-hidden":!e.node.visible,"is-focusable":!e.node.disabled,"is-checked":!e.node.disabled&&e.node.checked},attrs:{role:"treeitem",tabindex:"-1","aria-expanded":e.expanded,"aria-disabled":e.node.disabled,"aria-checked":e.node.checked,draggable:e.tree.draggable},on:{click:function(t){return t.stopPropagation(),e.handleClick(t)},contextmenu:function(e){return t.handleContextMenu(e)},dragstart:function(t){return t.stopPropagation(),e.handleDragStart(t)},dragover:function(t){return t.stopPropagation(),e.handleDragOver(t)},dragend:function(t){return t.stopPropagation(),e.handleDragEnd(t)},drop:function(t){return t.stopPropagation(),e.handleDrop(t)}}},[i("div",{staticClass:"el-tree-node__content",style:{"padding-left":(e.node.level-1)*e.tree.indent+"px"}},[i("span",{class:[{"is-leaf":e.node.isLeaf,expanded:!e.node.isLeaf&&e.expanded},"el-tree-node__expand-icon",e.tree.iconClass?e.tree.iconClass:"el-icon-caret-right"],on:{click:function(t){return t.stopPropagation(),e.handleExpandIconClick(t)}}}),e.showCheckbox?i("el-checkbox",{attrs:{indeterminate:e.node.indeterminate,disabled:!!e.node.disabled},on:{change:e.handleCheckChange},nativeOn:{click:function(t){t.stopPropagation()}},model:{value:e.node.checked,callback:function(t){e.$set(e.node,"checked",t)},expression:"node.checked"}}):e._e(),e.node.loading?i("span",{staticClass:"el-tree-node__loading-icon el-icon-loading"}):e._e(),i("node-content",{attrs:{node:e.node}})],1),i("el-collapse-transition",[!e.renderAfterExpand||e.childNodeRendered?i("div",{directives:[{name:"show",rawName:"v-show",value:e.expanded,expression:"expanded"}],staticClass:"el-tree-node__children",attrs:{role:"group","aria-expanded":e.expanded}},e._l(e.node.childNodes,function(t){return i("el-tree-node",{key:e.getNodeKey(t),attrs:{"render-content":e.renderContent,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,node:t},on:{"node-expand":e.handleChildNodeExpand}})}),1):e._e()])],1)};Xo._withStripped=!0;var Yo=r({name:"ElTreeNode",componentName:"ElTreeNode",mixins:[S.a],props:{node:{default:function(){return{}}},props:{},renderContent:Function,renderAfterExpand:{type:Boolean,default:!0},showCheckbox:{type:Boolean,default:!1}},components:{ElCollapseTransition:yt.a,ElCheckbox:rn.a,NodeContent:{props:{node:{required:!0}},render:function(t){var e=this.$parent,n=e.tree,i=this.node,r=i.data,o=i.store;return e.renderContent?e.renderContent.call(e._renderProxy,t,{_self:n.$vnode.context,node:i,data:r,store:o}):n.$scopedSlots.default?n.$scopedSlots.default({node:i,data:r}):t("span",{class:"el-tree-node__label"},[i.label])}}},data:function(){return{tree:null,expanded:!1,childNodeRendered:!1,oldChecked:null,oldIndeterminate:null}},watch:{"node.indeterminate":function(t){this.handleSelectChange(this.node.checked,t)},"node.checked":function(t){this.handleSelectChange(t,this.node.indeterminate)},"node.expanded":function(t){var e=this;this.$nextTick(function(){return e.expanded=t}),t&&(this.childNodeRendered=!0)}},methods:{getNodeKey:function(t){return Fo(this.tree.nodeKey,t.data)},handleSelectChange:function(t,e){this.oldChecked!==t&&this.oldIndeterminate!==e&&this.tree.$emit("check-change",this.node.data,t,e),this.oldChecked=t,this.indeterminate=e},handleClick:function(){var t=this.tree.store;t.setCurrentNode(this.node),this.tree.$emit("current-change",t.currentNode?t.currentNode.data:null,t.currentNode),this.tree.currentNode=this,this.tree.expandOnClickNode&&this.handleExpandIconClick(),this.tree.checkOnClickNode&&!this.node.disabled&&this.handleCheckChange(null,{target:{checked:!this.node.checked}}),this.tree.$emit("node-click",this.node.data,this.node,this)},handleContextMenu:function(t){this.tree._events["node-contextmenu"]&&this.tree._events["node-contextmenu"].length>0&&(t.stopPropagation(),t.preventDefault()),this.tree.$emit("node-contextmenu",t,this.node.data,this.node,this)},handleExpandIconClick:function(){this.node.isLeaf||(this.expanded?(this.tree.$emit("node-collapse",this.node.data,this.node,this),this.node.collapse()):(this.node.expand(),this.$emit("node-expand",this.node.data,this.node,this)))},handleCheckChange:function(t,e){var n=this;this.node.setChecked(e.target.checked,!this.tree.checkStrictly),this.$nextTick(function(){var t=n.tree.store;n.tree.$emit("check",n.node.data,{checkedNodes:t.getCheckedNodes(),checkedKeys:t.getCheckedKeys(),halfCheckedNodes:t.getHalfCheckedNodes(),halfCheckedKeys:t.getHalfCheckedKeys()})})},handleChildNodeExpand:function(t,e,n){this.broadcast("ElTreeNode","tree-node-expand",e),this.tree.$emit("node-expand",t,e,n)},handleDragStart:function(t){this.tree.draggable&&this.tree.$emit("tree-node-drag-start",t,this)},handleDragOver:function(t){this.tree.draggable&&(this.tree.$emit("tree-node-drag-over",t,this),t.preventDefault())},handleDrop:function(t){t.preventDefault()},handleDragEnd:function(t){this.tree.draggable&&this.tree.$emit("tree-node-drag-end",t,this)}},created:function(){var t=this,e=this.$parent;e.isTree?this.tree=e:this.tree=e.tree;var n=this.tree;n||console.warn("Can not find node's tree.");var i=(n.props||{}).children||"children";this.$watch("node.data."+i,function(){t.node.updateChildren()}),this.node.expanded&&(this.expanded=!0,this.childNodeRendered=!0),this.tree.accordion&&this.$on("tree-node-expand",function(e){t.node!==e&&t.node.collapse()})}},Xo,[],!1,null,null,null);Yo.options.__file="packages/tree/src/tree-node.vue";var Ko=Yo.exports,Jo=r({name:"ElTree",mixins:[S.a],components:{ElTreeNode:Ko},data:function(){return{store:null,root:null,currentNode:null,treeItems:null,checkboxItems:[],dragState:{showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0}}},props:{data:{type:Array},emptyText:{type:String,default:function(){return Object(Nr.t)("el.tree.emptyText")}},renderAfterExpand:{type:Boolean,default:!0},nodeKey:String,checkStrictly:Boolean,defaultExpandAll:Boolean,expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:Boolean,checkDescendants:{type:Boolean,default:!1},autoExpandParent:{type:Boolean,default:!0},defaultCheckedKeys:Array,defaultExpandedKeys:Array,currentNodeKey:[String,Number],renderContent:Function,showCheckbox:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},allowDrag:Function,allowDrop:Function,props:{default:function(){return{children:"children",label:"label",disabled:"disabled"}}},lazy:{type:Boolean,default:!1},highlightCurrent:Boolean,load:Function,filterNodeMethod:Function,accordion:Boolean,indent:{type:Number,default:18},iconClass:String},computed:{children:{set:function(t){this.data=t},get:function(){return this.data}},treeItemArray:function(){return Array.prototype.slice.call(this.treeItems)},isEmpty:function(){var t=this.root.childNodes;return!t||0===t.length||t.every(function(t){return!t.visible})}},watch:{defaultCheckedKeys:function(t){this.store.setDefaultCheckedKey(t)},defaultExpandedKeys:function(t){this.store.defaultExpandedKeys=t,this.store.setDefaultExpandedKeys(t)},data:function(t){this.store.setData(t)},checkboxItems:function(t){Array.prototype.forEach.call(t,function(t){t.setAttribute("tabindex",-1)})},checkStrictly:function(t){this.store.checkStrictly=t}},methods:{filter:function(t){if(!this.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");this.store.filter(t)},getNodeKey:function(t){return Fo(this.nodeKey,t.data)},getNodePath:function(t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in getNodePath");var e=this.store.getNode(t);if(!e)return[];for(var n=[e.data],i=e.parent;i&&i!==this.root;)n.push(i.data),i=i.parent;return n.reverse()},getCheckedNodes:function(t,e){return this.store.getCheckedNodes(t,e)},getCheckedKeys:function(t){return this.store.getCheckedKeys(t)},getCurrentNode:function(){var t=this.store.getCurrentNode();return t?t.data:null},getCurrentKey:function(){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");var t=this.getCurrentNode();return t?t[this.nodeKey]:null},setCheckedNodes:function(t,e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedNodes");this.store.setCheckedNodes(t,e)},setCheckedKeys:function(t,e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedKeys");this.store.setCheckedKeys(t,e)},setChecked:function(t,e,n){this.store.setChecked(t,e,n)},getHalfCheckedNodes:function(){return this.store.getHalfCheckedNodes()},getHalfCheckedKeys:function(){return this.store.getHalfCheckedKeys()},setCurrentNode:function(t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");this.store.setUserCurrentNode(t)},setCurrentKey:function(t){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");this.store.setCurrentNodeKey(t)},getNode:function(t){return this.store.getNode(t)},remove:function(t){this.store.remove(t)},append:function(t,e){this.store.append(t,e)},insertBefore:function(t,e){this.store.insertBefore(t,e)},insertAfter:function(t,e){this.store.insertAfter(t,e)},handleNodeExpand:function(t,e,n){this.broadcast("ElTreeNode","tree-node-expand",e),this.$emit("node-expand",t,e,n)},updateKeyChildren:function(t,e){if(!this.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");this.store.updateChildren(t,e)},initTabIndex:function(){this.treeItems=this.$el.querySelectorAll(".is-focusable[role=treeitem]"),this.checkboxItems=this.$el.querySelectorAll("input[type=checkbox]");var t=this.$el.querySelectorAll(".is-checked[role=treeitem]");t.length?t[0].setAttribute("tabindex",0):this.treeItems[0]&&this.treeItems[0].setAttribute("tabindex",0)},handleKeydown:function(t){var e=t.target;if(-1!==e.className.indexOf("el-tree-node")){var n=t.keyCode;this.treeItems=this.$el.querySelectorAll(".is-focusable[role=treeitem]");var i=this.treeItemArray.indexOf(e),r=void 0;[38,40].indexOf(n)>-1&&(t.preventDefault(),r=38===n?0!==i?i-1:0:i<this.treeItemArray.length-1?i+1:0,this.treeItemArray[r].focus()),[37,39].indexOf(n)>-1&&(t.preventDefault(),e.click());var o=e.querySelector('[type="checkbox"]');[13,32].indexOf(n)>-1&&o&&(t.preventDefault(),o.click())}}},created:function(){var t=this;this.isTree=!0,this.store=new $o({key:this.nodeKey,data:this.data,lazy:this.lazy,props:this.props,load:this.load,currentNodeKey:this.currentNodeKey,checkStrictly:this.checkStrictly,checkDescendants:this.checkDescendants,defaultCheckedKeys:this.defaultCheckedKeys,defaultExpandedKeys:this.defaultExpandedKeys,autoExpandParent:this.autoExpandParent,defaultExpandAll:this.defaultExpandAll,filterNodeMethod:this.filterNodeMethod}),this.root=this.store.root;var e=this.dragState;this.$on("tree-node-drag-start",function(n,i){if("function"==typeof t.allowDrag&&!t.allowDrag(i.node))return n.preventDefault(),!1;n.dataTransfer.effectAllowed="move";try{n.dataTransfer.setData("text/plain","")}catch(t){}e.draggingNode=i,t.$emit("node-drag-start",i.node,n)}),this.$on("tree-node-drag-over",function(n,i){var r=function(t,e){for(var n=t;n&&"BODY"!==n.tagName;){if(n.__vue__&&n.__vue__.$options.name===e)return n.__vue__;n=n.parentNode}return null}(n.target,"ElTreeNode"),o=e.dropNode;o&&o!==r&&Object(ft.removeClass)(o.$el,"is-drop-inner");var s=e.draggingNode;if(s&&r){var a=!0,l=!0,u=!0,c=!0;"function"==typeof t.allowDrop&&(a=t.allowDrop(s.node,r.node,"prev"),c=l=t.allowDrop(s.node,r.node,"inner"),u=t.allowDrop(s.node,r.node,"next")),n.dataTransfer.dropEffect=l?"move":"none",(a||l||u)&&o!==r&&(o&&t.$emit("node-drag-leave",s.node,o.node,n),t.$emit("node-drag-enter",s.node,r.node,n)),(a||l||u)&&(e.dropNode=r),r.node.nextSibling===s.node&&(u=!1),r.node.previousSibling===s.node&&(a=!1),r.node.contains(s.node,!1)&&(l=!1),(s.node===r.node||s.node.contains(r.node))&&(a=!1,l=!1,u=!1);var h=r.$el.getBoundingClientRect(),p=t.$el.getBoundingClientRect(),d=void 0,f=a?l?.25:u?.45:1:-1,g=u?l?.75:a?.55:0:1,m=-9999,v=n.clientY-h.top;d=v<h.height*f?"before":v>h.height*g?"after":l?"inner":"none";var _=r.$el.querySelector(".el-tree-node__expand-icon").getBoundingClientRect(),y=t.$refs.dropIndicator;"before"===d?m=_.top-p.top:"after"===d&&(m=_.bottom-p.top),y.style.top=m+"px",y.style.left=_.right-p.left+"px","inner"===d?Object(ft.addClass)(r.$el,"is-drop-inner"):Object(ft.removeClass)(r.$el,"is-drop-inner"),e.showDropIndicator="before"===d||"after"===d,e.allowDrop=e.showDropIndicator||c,e.dropType=d,t.$emit("node-drag-over",s.node,r.node,n)}}),this.$on("tree-node-drag-end",function(n){var i=e.draggingNode,r=e.dropType,o=e.dropNode;if(n.preventDefault(),n.dataTransfer.dropEffect="move",i&&o){var s={data:i.node.data};"none"!==r&&i.node.remove(),"before"===r?o.node.parent.insertBefore(s,o.node):"after"===r?o.node.parent.insertAfter(s,o.node):"inner"===r&&o.node.insertChild(s),"none"!==r&&t.store.registerNode(s),Object(ft.removeClass)(o.$el,"is-drop-inner"),t.$emit("node-drag-end",i.node,o.node,r,n),"none"!==r&&t.$emit("node-drop",i.node,o.node,r,n)}i&&!o&&t.$emit("node-drag-end",i.node,null,r,n),e.showDropIndicator=!1,e.draggingNode=null,e.dropNode=null,e.allowDrop=!0})},mounted:function(){this.initTabIndex(),this.$el.addEventListener("keydown",this.handleKeydown)},updated:function(){this.treeItems=this.$el.querySelectorAll("[role=treeitem]"),this.checkboxItems=this.$el.querySelectorAll("input[type=checkbox]")}},Lo,[],!1,null,null,null);Jo.options.__file="packages/tree/src/tree.vue";var qo=Jo.exports;qo.install=function(t){t.component(qo.name,qo)};var Zo=qo,Qo=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-alert-fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-alert",class:[t.typeClass,t.center?"is-center":"","is-"+t.effect],attrs:{role:"alert"}},[t.showIcon?n("i",{staticClass:"el-alert__icon",class:[t.iconClass,t.isBigIcon]}):t._e(),n("div",{staticClass:"el-alert__content"},[t.title||t.$slots.title?n("span",{staticClass:"el-alert__title",class:[t.isBoldTitle]},[t._t("title",[t._v(t._s(t.title))])],2):t._e(),t.$slots.default&&!t.description?n("p",{staticClass:"el-alert__description"},[t._t("default")],2):t._e(),t.description&&!t.$slots.default?n("p",{staticClass:"el-alert__description"},[t._v(t._s(t.description))]):t._e(),n("i",{directives:[{name:"show",rawName:"v-show",value:t.closable,expression:"closable"}],staticClass:"el-alert__closebtn",class:{"is-customed":""!==t.closeText,"el-icon-close":""===t.closeText},on:{click:function(e){t.close()}}},[t._v(t._s(t.closeText))])])])])};Qo._withStripped=!0;var ts={success:"el-icon-success",warning:"el-icon-warning",error:"el-icon-error"},es=r({name:"ElAlert",props:{title:{type:String,default:""},description:{type:String,default:""},type:{type:String,default:"info"},closable:{type:Boolean,default:!0},closeText:{type:String,default:""},showIcon:Boolean,center:Boolean,effect:{type:String,default:"light",validator:function(t){return-1!==["light","dark"].indexOf(t)}}},data:function(){return{visible:!0}},methods:{close:function(){this.visible=!1,this.$emit("close")}},computed:{typeClass:function(){return"el-alert--"+this.type},iconClass:function(){return ts[this.type]||"el-icon-info"},isBigIcon:function(){return this.description||this.$slots.default?"is-big":""},isBoldTitle:function(){return this.description||this.$slots.default?"is-bold":""}}},Qo,[],!1,null,null,null);es.options.__file="packages/alert/src/main.vue";var ns=es.exports;ns.install=function(t){t.component(ns.name,ns)};var is=ns,rs=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-notification-fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],class:["el-notification",t.customClass,t.horizontalClass],style:t.positionStyle,attrs:{role:"alert"},on:{mouseenter:function(e){t.clearTimer()},mouseleave:function(e){t.startTimer()},click:t.click}},[t.type||t.iconClass?n("i",{staticClass:"el-notification__icon",class:[t.typeClass,t.iconClass]}):t._e(),n("div",{staticClass:"el-notification__group",class:{"is-with-icon":t.typeClass||t.iconClass}},[n("h2",{staticClass:"el-notification__title",domProps:{textContent:t._s(t.title)}}),n("div",{directives:[{name:"show",rawName:"v-show",value:t.message,expression:"message"}],staticClass:"el-notification__content"},[t._t("default",[t.dangerouslyUseHTMLString?n("p",{domProps:{innerHTML:t._s(t.message)}}):n("p",[t._v(t._s(t.message))])])],2),t.showClose?n("div",{staticClass:"el-notification__closeBtn el-icon-close",on:{click:function(e){return e.stopPropagation(),t.close(e)}}}):t._e()])])])};rs._withStripped=!0;var os={success:"success",info:"info",warning:"warning",error:"error"},ss=r({data:function(){return{visible:!1,title:"",message:"",duration:4500,type:"",showClose:!0,customClass:"",iconClass:"",onClose:null,onClick:null,closed:!1,verticalOffset:0,timer:null,dangerouslyUseHTMLString:!1,position:"top-right"}},computed:{typeClass:function(){return this.type&&os[this.type]?"el-icon-"+os[this.type]:""},horizontalClass:function(){return this.position.indexOf("right")>-1?"right":"left"},verticalProperty:function(){return/^top-/.test(this.position)?"top":"bottom"},positionStyle:function(){var t;return(t={})[this.verticalProperty]=this.verticalOffset+"px",t}},watch:{closed:function(t){t&&(this.visible=!1,this.$el.addEventListener("transitionend",this.destroyElement))}},methods:{destroyElement:function(){this.$el.removeEventListener("transitionend",this.destroyElement),this.$destroy(!0),this.$el.parentNode.removeChild(this.$el)},click:function(){"function"==typeof this.onClick&&this.onClick()},close:function(){this.closed=!0,"function"==typeof this.onClose&&this.onClose()},clearTimer:function(){clearTimeout(this.timer)},startTimer:function(){var t=this;this.duration>0&&(this.timer=setTimeout(function(){t.closed||t.close()},this.duration))},keydown:function(t){46===t.keyCode||8===t.keyCode?this.clearTimer():27===t.keyCode?this.closed||this.close():this.startTimer()}},mounted:function(){var t=this;this.duration>0&&(this.timer=setTimeout(function(){t.closed||t.close()},this.duration)),document.addEventListener("keydown",this.keydown)},beforeDestroy:function(){document.removeEventListener("keydown",this.keydown)}},rs,[],!1,null,null,null);ss.options.__file="packages/notification/src/main.vue";var as=ss.exports,ls=hn.a.extend(as),us=void 0,cs=[],hs=1,ps=function t(e){if(!hn.a.prototype.$isServer){var n=(e=Ht()({},e)).onClose,i="notification_"+hs++,r=e.position||"top-right";e.onClose=function(){t.close(i,n)},us=new ls({data:e}),Object(Wr.isVNode)(e.message)&&(us.$slots.default=[e.message],e.message="REPLACED_BY_VNODE"),us.id=i,us.$mount(),document.body.appendChild(us.$el),us.visible=!0,us.dom=us.$el,us.dom.style.zIndex=y.PopupManager.nextZIndex();var o=e.offset||0;return cs.filter(function(t){return t.position===r}).forEach(function(t){o+=t.$el.offsetHeight+16}),o+=16,us.verticalOffset=o,cs.push(us),us}};["success","warning","info","error"].forEach(function(t){ps[t]=function(e){return("string"==typeof e||Object(Wr.isVNode)(e))&&(e={message:e}),e.type=t,ps(e)}}),ps.close=function(t,e){var n=-1,i=cs.length,r=cs.filter(function(e,i){return e.id===t&&(n=i,!0)})[0];if(r&&("function"==typeof e&&e(r),cs.splice(n,1),!(i<=1)))for(var o=r.position,s=r.dom.offsetHeight,a=n;a<i-1;a++)cs[a].position===o&&(cs[a].dom.style[r.verticalProperty]=parseInt(cs[a].dom.style[r.verticalProperty],10)-s-16+"px")},ps.closeAll=function(){for(var t=cs.length-1;t>=0;t--)cs[t].close()};var ds=ps,fs=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-slider",class:{"is-vertical":t.vertical,"el-slider--with-input":t.showInput},attrs:{role:"slider","aria-valuemin":t.min,"aria-valuemax":t.max,"aria-orientation":t.vertical?"vertical":"horizontal","aria-disabled":t.sliderDisabled}},[t.showInput&&!t.range?n("el-input-number",{ref:"input",staticClass:"el-slider__input",attrs:{step:t.step,disabled:t.sliderDisabled,controls:t.showInputControls,min:t.min,max:t.max,debounce:t.debounce,size:t.inputSize},on:{change:t.emitChange},model:{value:t.firstValue,callback:function(e){t.firstValue=e},expression:"firstValue"}}):t._e(),n("div",{ref:"slider",staticClass:"el-slider__runway",class:{"show-input":t.showInput,disabled:t.sliderDisabled},style:t.runwayStyle,on:{click:t.onSliderClick}},[n("div",{staticClass:"el-slider__bar",style:t.barStyle}),n("slider-button",{ref:"button1",attrs:{vertical:t.vertical,"tooltip-class":t.tooltipClass},model:{value:t.firstValue,callback:function(e){t.firstValue=e},expression:"firstValue"}}),t.range?n("slider-button",{ref:"button2",attrs:{vertical:t.vertical,"tooltip-class":t.tooltipClass},model:{value:t.secondValue,callback:function(e){t.secondValue=e},expression:"secondValue"}}):t._e(),t._l(t.stops,function(e,i){return t.showStops?n("div",{key:i,staticClass:"el-slider__stop",style:t.getStopStyle(e)}):t._e()}),t.markList.length>0?[n("div",t._l(t.markList,function(e,i){return n("div",{key:i,staticClass:"el-slider__stop el-slider__marks-stop",style:t.getStopStyle(e.position)})}),0),n("div",{staticClass:"el-slider__marks"},t._l(t.markList,function(e,i){return n("slider-marker",{key:i,style:t.getStopStyle(e.position),attrs:{mark:e.mark}})}),1)]:t._e()],2)],1)};fs._withStripped=!0;var gs=n(41),ms=n.n(gs),vs=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{ref:"button",staticClass:"el-slider__button-wrapper",class:{hover:t.hovering,dragging:t.dragging},style:t.wrapperStyle,attrs:{tabindex:"0"},on:{mouseenter:t.handleMouseEnter,mouseleave:t.handleMouseLeave,mousedown:t.onButtonDown,touchstart:t.onButtonDown,focus:t.handleMouseEnter,blur:t.handleMouseLeave,keydown:[function(e){return"button"in e||!t._k(e.keyCode,"left",37,e.key,["Left","ArrowLeft"])?"button"in e&&0!==e.button?null:t.onLeftKeyDown(e):null},function(e){return"button"in e||!t._k(e.keyCode,"right",39,e.key,["Right","ArrowRight"])?"button"in e&&2!==e.button?null:t.onRightKeyDown(e):null},function(e){return"button"in e||!t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?(e.preventDefault(),t.onLeftKeyDown(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?(e.preventDefault(),t.onRightKeyDown(e)):null}]}},[n("el-tooltip",{ref:"tooltip",attrs:{placement:"top","popper-class":t.tooltipClass,disabled:!t.showTooltip}},[n("span",{attrs:{slot:"content"},slot:"content"},[t._v(t._s(t.formatValue))]),n("div",{staticClass:"el-slider__button",class:{hover:t.hovering,dragging:t.dragging}})])],1)};vs._withStripped=!0;var _s=r({name:"ElSliderButton",components:{ElTooltip:xt.a},props:{value:{type:Number,default:0},vertical:{type:Boolean,default:!1},tooltipClass:String},data:function(){return{hovering:!1,dragging:!1,isClick:!1,startX:0,currentX:0,startY:0,currentY:0,startPosition:0,newPosition:null,oldValue:this.value}},computed:{disabled:function(){return this.$parent.sliderDisabled},max:function(){return this.$parent.max},min:function(){return this.$parent.min},step:function(){return this.$parent.step},showTooltip:function(){return this.$parent.showTooltip},precision:function(){return this.$parent.precision},currentPosition:function(){return(this.value-this.min)/(this.max-this.min)*100+"%"},enableFormat:function(){return this.$parent.formatTooltip instanceof Function},formatValue:function(){return this.enableFormat&&this.$parent.formatTooltip(this.value)||this.value},wrapperStyle:function(){return this.vertical?{bottom:this.currentPosition}:{left:this.currentPosition}}},watch:{dragging:function(t){this.$parent.dragging=t}},methods:{displayTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.showPopper=!0)},hideTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.showPopper=!1)},handleMouseEnter:function(){this.hovering=!0,this.displayTooltip()},handleMouseLeave:function(){this.hovering=!1,this.hideTooltip()},onButtonDown:function(t){this.disabled||(t.preventDefault(),this.onDragStart(t),window.addEventListener("mousemove",this.onDragging),window.addEventListener("touchmove",this.onDragging),window.addEventListener("mouseup",this.onDragEnd),window.addEventListener("touchend",this.onDragEnd),window.addEventListener("contextmenu",this.onDragEnd))},onLeftKeyDown:function(){this.disabled||(this.newPosition=parseFloat(this.currentPosition)-this.step/(this.max-this.min)*100,this.setPosition(this.newPosition),this.$parent.emitChange())},onRightKeyDown:function(){this.disabled||(this.newPosition=parseFloat(this.currentPosition)+this.step/(this.max-this.min)*100,this.setPosition(this.newPosition),this.$parent.emitChange())},onDragStart:function(t){this.dragging=!0,this.isClick=!0,"touchstart"===t.type&&(t.clientY=t.touches[0].clientY,t.clientX=t.touches[0].clientX),this.vertical?this.startY=t.clientY:this.startX=t.clientX,this.startPosition=parseFloat(this.currentPosition),this.newPosition=this.startPosition},onDragging:function(t){if(this.dragging){this.isClick=!1,this.displayTooltip(),this.$parent.resetSize();var e=0;"touchmove"===t.type&&(t.clientY=t.touches[0].clientY,t.clientX=t.touches[0].clientX),this.vertical?(this.currentY=t.clientY,e=(this.startY-this.currentY)/this.$parent.sliderSize*100):(this.currentX=t.clientX,e=(this.currentX-this.startX)/this.$parent.sliderSize*100),this.newPosition=this.startPosition+e,this.setPosition(this.newPosition)}},onDragEnd:function(){var t=this;this.dragging&&(setTimeout(function(){t.dragging=!1,t.hideTooltip(),t.isClick||(t.setPosition(t.newPosition),t.$parent.emitChange())},0),window.removeEventListener("mousemove",this.onDragging),window.removeEventListener("touchmove",this.onDragging),window.removeEventListener("mouseup",this.onDragEnd),window.removeEventListener("touchend",this.onDragEnd),window.removeEventListener("contextmenu",this.onDragEnd))},setPosition:function(t){var e=this;if(null!==t&&!isNaN(t)){t<0?t=0:t>100&&(t=100);var n=100/((this.max-this.min)/this.step),i=Math.round(t/n)*n*(this.max-this.min)*.01+this.min;i=parseFloat(i.toFixed(this.precision)),this.$emit("input",i),this.$nextTick(function(){e.displayTooltip(),e.$refs.tooltip&&e.$refs.tooltip.updatePopper()}),this.dragging||this.value===this.oldValue||(this.oldValue=this.value)}}}},vs,[],!1,null,null,null);_s.options.__file="packages/slider/src/button.vue";var ys=_s.exports,bs={name:"ElMarker",props:{mark:{type:[String,Object]}},render:function(){var t=arguments[0],e="string"==typeof this.mark?this.mark:this.mark.label;return t("div",{class:"el-slider__marks-text",style:this.mark.style||{}},[e])}},Ts=r({name:"ElSlider",mixins:[S.a],inject:{elForm:{default:""}},props:{min:{type:Number,default:0},max:{type:Number,default:100},step:{type:Number,default:1},value:{type:[Number,Array],default:0},showInput:{type:Boolean,default:!1},showInputControls:{type:Boolean,default:!0},inputSize:{type:String,default:"small"},showStops:{type:Boolean,default:!1},showTooltip:{type:Boolean,default:!0},formatTooltip:Function,disabled:{type:Boolean,default:!1},range:{type:Boolean,default:!1},vertical:{type:Boolean,default:!1},height:{type:String},debounce:{type:Number,default:300},label:{type:String},tooltipClass:String,marks:Object},components:{ElInputNumber:ms.a,SliderButton:ys,SliderMarker:bs},data:function(){return{firstValue:null,secondValue:null,oldValue:null,dragging:!1,sliderSize:1}},watch:{value:function(t,e){this.dragging||Array.isArray(t)&&Array.isArray(e)&&t.every(function(t,n){return t===e[n]})||this.setValues()},dragging:function(t){t||this.setValues()},firstValue:function(t){this.range?this.$emit("input",[this.minValue,this.maxValue]):this.$emit("input",t)},secondValue:function(){this.range&&this.$emit("input",[this.minValue,this.maxValue])},min:function(){this.setValues()},max:function(){this.setValues()}},methods:{valueChanged:function(){var t=this;return this.range?![this.minValue,this.maxValue].every(function(e,n){return e===t.oldValue[n]}):this.value!==this.oldValue},setValues:function(){if(this.min>this.max)console.error("[Element Error][Slider]min should not be greater than max.");else{var t=this.value;this.range&&Array.isArray(t)?t[1]<this.min?this.$emit("input",[this.min,this.min]):t[0]>this.max?this.$emit("input",[this.max,this.max]):t[0]<this.min?this.$emit("input",[this.min,t[1]]):t[1]>this.max?this.$emit("input",[t[0],this.max]):(this.firstValue=t[0],this.secondValue=t[1],this.valueChanged()&&(this.dispatch("ElFormItem","el.form.change",[this.minValue,this.maxValue]),this.oldValue=t.slice())):this.range||"number"!=typeof t||isNaN(t)||(t<this.min?this.$emit("input",this.min):t>this.max?this.$emit("input",this.max):(this.firstValue=t,this.valueChanged()&&(this.dispatch("ElFormItem","el.form.change",t),this.oldValue=t)))}},setPosition:function(t){var e=this.min+t*(this.max-this.min)/100;if(this.range){var n=void 0;n=Math.abs(this.minValue-e)<Math.abs(this.maxValue-e)?this.firstValue<this.secondValue?"button1":"button2":this.firstValue>this.secondValue?"button1":"button2",this.$refs[n].setPosition(t)}else this.$refs.button1.setPosition(t)},onSliderClick:function(t){if(!this.sliderDisabled&&!this.dragging){if(this.resetSize(),this.vertical){var e=this.$refs.slider.getBoundingClientRect().bottom;this.setPosition((e-t.clientY)/this.sliderSize*100)}else{var n=this.$refs.slider.getBoundingClientRect().left;this.setPosition((t.clientX-n)/this.sliderSize*100)}this.emitChange()}},resetSize:function(){this.$refs.slider&&(this.sliderSize=this.$refs.slider["client"+(this.vertical?"Height":"Width")])},emitChange:function(){var t=this;this.$nextTick(function(){t.$emit("change",t.range?[t.minValue,t.maxValue]:t.value)})},getStopStyle:function(t){return this.vertical?{bottom:t+"%"}:{left:t+"%"}}},computed:{stops:function(){var t=this;if(!this.showStops||this.min>this.max)return[];if(0===this.step)return[];for(var e=(this.max-this.min)/this.step,n=100*this.step/(this.max-this.min),i=[],r=1;r<e;r++)i.push(r*n);return this.range?i.filter(function(e){return e<100*(t.minValue-t.min)/(t.max-t.min)||e>100*(t.maxValue-t.min)/(t.max-t.min)}):i.filter(function(e){return e>100*(t.firstValue-t.min)/(t.max-t.min)})},markList:function(){var t=this;return this.marks?Object.keys(this.marks).map(parseFloat).sort(function(t,e){return t-e}).filter(function(e){return e<=t.max&&e>=t.min}).map(function(e){return{point:e,position:100*(e-t.min)/(t.max-t.min),mark:t.marks[e]}}):[]},minValue:function(){return Math.min(this.firstValue,this.secondValue)},maxValue:function(){return Math.max(this.firstValue,this.secondValue)},barSize:function(){return this.range?100*(this.maxValue-this.minValue)/(this.max-this.min)+"%":100*(this.firstValue-this.min)/(this.max-this.min)+"%"},barStart:function(){return this.range?100*(this.minValue-this.min)/(this.max-this.min)+"%":"0%"},precision:function(){var t=[this.min,this.max,this.step].map(function(t){var e=(""+t).split(".")[1];return e?e.length:0});return Math.max.apply(null,t)},runwayStyle:function(){return this.vertical?{height:this.height}:{}},barStyle:function(){return this.vertical?{height:this.barSize,bottom:this.barStart}:{width:this.barSize,left:this.barStart}},sliderDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},mounted:function(){var t=void 0;this.range?(Array.isArray(this.value)?(this.firstValue=Math.max(this.min,this.value[0]),this.secondValue=Math.min(this.max,this.value[1])):(this.firstValue=this.min,this.secondValue=this.max),this.oldValue=[this.firstValue,this.secondValue],t=this.firstValue+"-"+this.secondValue):("number"!=typeof this.value||isNaN(this.value)?this.firstValue=this.min:this.firstValue=Math.min(this.max,Math.max(this.min,this.value)),this.oldValue=this.firstValue,t=this.firstValue),this.$el.setAttribute("aria-valuetext",t),this.$el.setAttribute("aria-label",this.label?this.label:"slider between "+this.min+" and "+this.max),this.resetSize(),window.addEventListener("resize",this.resetSize)},beforeDestroy:function(){window.removeEventListener("resize",this.resetSize)}},fs,[],!1,null,null,null);Ts.options.__file="packages/slider/src/main.vue";var Es=Ts.exports;Es.install=function(t){t.component(Es.name,Es)};var Cs=Es,Ss=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-loading-fade"},on:{"after-leave":t.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-loading-mask",class:[t.customClass,{"is-fullscreen":t.fullscreen}],style:{backgroundColor:t.background||""}},[n("div",{staticClass:"el-loading-spinner"},[t.spinner?n("i",{class:t.spinner}):n("svg",{staticClass:"circular",attrs:{viewBox:"25 25 50 50"}},[n("circle",{staticClass:"path",attrs:{cx:"50",cy:"50",r:"20",fill:"none"}})]),t.text?n("p",{staticClass:"el-loading-text"},[t._v(t._s(t.text))]):t._e()])])])};Ss._withStripped=!0;var ws=r({data:function(){return{text:null,spinner:null,background:null,fullscreen:!0,visible:!1,customClass:""}},methods:{handleAfterLeave:function(){this.$emit("after-leave")},setText:function(t){this.text=t}}},Ss,[],!1,null,null,null);ws.options.__file="packages/loading/src/loading.vue";var ks=ws.exports,xs=n(32),Is=n.n(xs),Rs=hn.a.extend(ks),Os={install:function(t){if(!t.prototype.$isServer){var e=function(e,i){i.value?t.nextTick(function(){i.modifiers.fullscreen?(e.originalPosition=Object(ft.getStyle)(document.body,"position"),e.originalOverflow=Object(ft.getStyle)(document.body,"overflow"),e.maskStyle.zIndex=y.PopupManager.nextZIndex(),Object(ft.addClass)(e.mask,"is-fullscreen"),n(document.body,e,i)):(Object(ft.removeClass)(e.mask,"is-fullscreen"),i.modifiers.body?(e.originalPosition=Object(ft.getStyle)(document.body,"position"),["top","left"].forEach(function(t){var n="top"===t?"scrollTop":"scrollLeft";e.maskStyle[t]=e.getBoundingClientRect()[t]+document.body[n]+document.documentElement[n]-parseInt(Object(ft.getStyle)(document.body,"margin-"+t),10)+"px"}),["height","width"].forEach(function(t){e.maskStyle[t]=e.getBoundingClientRect()[t]+"px"}),n(document.body,e,i)):(e.originalPosition=Object(ft.getStyle)(e,"position"),n(e,e,i)))}):(Is()(e.instance,function(t){if(e.instance.hiding){e.domVisible=!1;var n=i.modifiers.fullscreen||i.modifiers.body?document.body:e;Object(ft.removeClass)(n,"el-loading-parent--relative"),Object(ft.removeClass)(n,"el-loading-parent--hidden"),e.instance.hiding=!1}},300,!0),e.instance.visible=!1,e.instance.hiding=!0)},n=function(e,n,i){n.domVisible||"none"===Object(ft.getStyle)(n,"display")||"hidden"===Object(ft.getStyle)(n,"visibility")?n.domVisible&&!0===n.instance.hiding&&(n.instance.visible=!0,n.instance.hiding=!1):(Object.keys(n.maskStyle).forEach(function(t){n.mask.style[t]=n.maskStyle[t]}),"absolute"!==n.originalPosition&&"fixed"!==n.originalPosition&&Object(ft.addClass)(e,"el-loading-parent--relative"),i.modifiers.fullscreen&&i.modifiers.lock&&Object(ft.addClass)(e,"el-loading-parent--hidden"),n.domVisible=!0,e.appendChild(n.mask),t.nextTick(function(){n.instance.hiding?n.instance.$emit("after-leave"):n.instance.visible=!0}),n.domInserted=!0)};t.directive("loading",{bind:function(t,n,i){var r=t.getAttribute("element-loading-text"),o=t.getAttribute("element-loading-spinner"),s=t.getAttribute("element-loading-background"),a=t.getAttribute("element-loading-custom-class"),l=i.context,u=new Rs({el:document.createElement("div"),data:{text:l&&l[r]||r,spinner:l&&l[o]||o,background:l&&l[s]||s,customClass:l&&l[a]||a,fullscreen:!!n.modifiers.fullscreen}});t.instance=u,t.mask=u.$el,t.maskStyle={},n.value&&e(t,n)},update:function(t,n){t.instance.setText(t.getAttribute("element-loading-text")),n.oldValue!==n.value&&e(t,n)},unbind:function(t,n){t.domInserted&&(t.mask&&t.mask.parentNode&&t.mask.parentNode.removeChild(t.mask),e(t,{value:!1,modifiers:n.modifiers})),t.instance&&t.instance.$destroy()}})}}},Ds=Os,As=hn.a.extend(ks),Ms={text:null,fullscreen:!0,body:!1,lock:!1,customClass:""},Ns=void 0;As.prototype.originalPosition="",As.prototype.originalOverflow="",As.prototype.close=function(){var t=this;this.fullscreen&&(Ns=void 0),Is()(this,function(e){var n=t.fullscreen||t.body?document.body:t.target;Object(ft.removeClass)(n,"el-loading-parent--relative"),Object(ft.removeClass)(n,"el-loading-parent--hidden"),t.$el&&t.$el.parentNode&&t.$el.parentNode.removeChild(t.$el),t.$destroy()},300),this.visible=!1};var Ls=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!hn.a.prototype.$isServer){if("string"==typeof(t=Ht()({},Ms,t)).target&&(t.target=document.querySelector(t.target)),t.target=t.target||document.body,t.target!==document.body?t.fullscreen=!1:t.body=!0,t.fullscreen&&Ns)return Ns;var e=t.body?document.body:t.target,n=new As({el:document.createElement("div"),data:t});return function(t,e,n){var i={};t.fullscreen?(n.originalPosition=Object(ft.getStyle)(document.body,"position"),n.originalOverflow=Object(ft.getStyle)(document.body,"overflow"),i.zIndex=y.PopupManager.nextZIndex()):t.body?(n.originalPosition=Object(ft.getStyle)(document.body,"position"),["top","left"].forEach(function(e){var n="top"===e?"scrollTop":"scrollLeft";i[e]=t.target.getBoundingClientRect()[e]+document.body[n]+document.documentElement[n]+"px"}),["height","width"].forEach(function(e){i[e]=t.target.getBoundingClientRect()[e]+"px"})):n.originalPosition=Object(ft.getStyle)(e,"position"),Object.keys(i).forEach(function(t){n.$el.style[t]=i[t]})}(t,e,n),"absolute"!==n.originalPosition&&"fixed"!==n.originalPosition&&Object(ft.addClass)(e,"el-loading-parent--relative"),t.fullscreen&&t.lock&&Object(ft.addClass)(e,"el-loading-parent--hidden"),e.appendChild(n.$el),hn.a.nextTick(function(){n.visible=!0}),t.fullscreen&&(Ns=n),n}},Ps={install:function(t){t.use(Ds),t.prototype.$loading=Ls},directive:Ds,service:Ls},Bs=function(){var t=this.$createElement;return(this._self._c||t)("i",{class:"el-icon-"+this.name})};Bs._withStripped=!0;var Fs=r({name:"ElIcon",props:{name:String}},Bs,[],!1,null,null,null);Fs.options.__file="packages/icon/src/icon.vue";var Us=Fs.exports;Us.install=function(t){t.component(Us.name,Us)};var Vs=Us,Hs={name:"ElRow",componentName:"ElRow",props:{tag:{type:String,default:"div"},gutter:Number,type:String,justify:{type:String,default:"start"},align:String},computed:{style:function(){var t={};return this.gutter&&(t.marginLeft="-"+this.gutter/2+"px",t.marginRight=t.marginLeft),t}},render:function(t){return t(this.tag,{class:["el-row","start"!==this.justify?"is-justify-"+this.justify:"",this.align?"is-align-"+this.align:"",{"el-row--flex":"flex"===this.type}],style:this.style},this.$slots.default)},install:function(t){t.component(Hs.name,Hs)}},Ws=Hs,Gs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},js={name:"ElCol",props:{span:{type:Number,default:24},tag:{type:String,default:"div"},offset:Number,pull:Number,push:Number,xs:[Number,Object],sm:[Number,Object],md:[Number,Object],lg:[Number,Object],xl:[Number,Object]},computed:{gutter:function(){for(var t=this.$parent;t&&"ElRow"!==t.$options.componentName;)t=t.$parent;return t?t.gutter:0}},render:function(t){var e=this,n=[],i={};return this.gutter&&(i.paddingLeft=this.gutter/2+"px",i.paddingRight=i.paddingLeft),["span","offset","pull","push"].forEach(function(t){(e[t]||0===e[t])&&n.push("span"!==t?"el-col-"+t+"-"+e[t]:"el-col-"+e[t])}),["xs","sm","md","lg","xl"].forEach(function(t){if("number"==typeof e[t])n.push("el-col-"+t+"-"+e[t]);else if("object"===Gs(e[t])){var i=e[t];Object.keys(i).forEach(function(e){n.push("span"!==e?"el-col-"+t+"-"+e+"-"+i[e]:"el-col-"+t+"-"+i[e])})}}),t(this.tag,{class:["el-col",n],style:i},this.$slots.default)},install:function(t){t.component(js.name,js)}},zs=js,$s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition-group",{class:["el-upload-list","el-upload-list--"+t.listType,{"is-disabled":t.disabled}],attrs:{tag:"ul",name:"el-list"}},t._l(t.files,function(e){return n("li",{key:e.uid,class:["el-upload-list__item","is-"+e.status,t.focusing?"focusing":""],attrs:{tabindex:"0"},on:{keydown:function(n){if(!("button"in n)&&t._k(n.keyCode,"delete",[8,46],n.key,["Backspace","Delete","Del"]))return null;!t.disabled&&t.$emit("remove",e)},focus:function(e){t.focusing=!0},blur:function(e){t.focusing=!1},click:function(e){t.focusing=!1}}},[t._t("default",["uploading"!==e.status&&["picture-card","picture"].indexOf(t.listType)>-1?n("img",{staticClass:"el-upload-list__item-thumbnail",attrs:{src:e.url,alt:""}}):t._e(),n("a",{staticClass:"el-upload-list__item-name",on:{click:function(n){t.handleClick(e)}}},[n("i",{staticClass:"el-icon-document"}),t._v(t._s(e.name)+"\n ")]),n("label",{staticClass:"el-upload-list__item-status-label"},[n("i",{class:{"el-icon-upload-success":!0,"el-icon-circle-check":"text"===t.listType,"el-icon-check":["picture-card","picture"].indexOf(t.listType)>-1}})]),t.disabled?t._e():n("i",{staticClass:"el-icon-close",on:{click:function(n){t.$emit("remove",e)}}}),t.disabled?t._e():n("i",{staticClass:"el-icon-close-tip"},[t._v(t._s(t.t("el.upload.deleteTip")))]),"uploading"===e.status?n("el-progress",{attrs:{type:"picture-card"===t.listType?"circle":"line","stroke-width":"picture-card"===t.listType?6:2,percentage:t.parsePercentage(e.percentage)}}):t._e(),"picture-card"===t.listType?n("span",{staticClass:"el-upload-list__item-actions"},[t.handlePreview&&"picture-card"===t.listType?n("span",{staticClass:"el-upload-list__item-preview",on:{click:function(n){t.handlePreview(e)}}},[n("i",{staticClass:"el-icon-zoom-in"})]):t._e(),t.disabled?t._e():n("span",{staticClass:"el-upload-list__item-delete",on:{click:function(n){t.$emit("remove",e)}}},[n("i",{staticClass:"el-icon-delete"})])]):t._e()],{file:e})],2)}),0)};$s._withStripped=!0;var Xs=n(33),Ys=n.n(Xs),Ks=r({name:"ElUploadList",mixins:[f.a],data:function(){return{focusing:!1}},components:{ElProgress:Ys.a},props:{files:{type:Array,default:function(){return[]}},disabled:{type:Boolean,default:!1},handlePreview:Function,listType:String},methods:{parsePercentage:function(t){return parseInt(t,10)},handleClick:function(t){this.handlePreview&&this.handlePreview(t)}}},$s,[],!1,null,null,null);Ks.options.__file="packages/upload/src/upload-list.vue";var Js=Ks.exports,qs=n(24),Zs=n.n(qs);var Qs=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"el-upload-dragger",class:{"is-dragover":t.dragover},on:{drop:function(e){return e.preventDefault(),t.onDrop(e)},dragover:function(e){return e.preventDefault(),t.onDragover(e)},dragleave:function(e){e.preventDefault(),t.dragover=!1}}},[t._t("default")],2)};Qs._withStripped=!0;var ta=r({name:"ElUploadDrag",props:{disabled:Boolean},inject:{uploader:{default:""}},data:function(){return{dragover:!1}},methods:{onDragover:function(){this.disabled||(this.dragover=!0)},onDrop:function(t){if(!this.disabled&&this.uploader){var e=this.uploader.accept;this.dragover=!1,e?this.$emit("file",[].slice.call(t.dataTransfer.files).filter(function(t){var n=t.type,i=t.name,r=i.indexOf(".")>-1?"."+i.split(".").pop():"",o=n.replace(/\/.*$/,"");return e.split(",").map(function(t){return t.trim()}).filter(function(t){return t}).some(function(t){return/\..+$/.test(t)?r===t:/\/\*$/.test(t)?o===t.replace(/\/\*$/,""):!!/^[^\/]+\/[^\/]+$/.test(t)&&n===t})})):this.$emit("file",t.dataTransfer.files)}}}},Qs,[],!1,null,null,null);ta.options.__file="packages/upload/src/upload-dragger.vue";var ea=r({inject:["uploader"],components:{UploadDragger:ta.exports},props:{type:String,action:{type:String,required:!0},name:{type:String,default:"file"},data:Object,headers:Object,withCredentials:Boolean,multiple:Boolean,accept:String,onStart:Function,onProgress:Function,onSuccess:Function,onError:Function,beforeUpload:Function,drag:Boolean,onPreview:{type:Function,default:function(){}},onRemove:{type:Function,default:function(){}},fileList:Array,autoUpload:Boolean,listType:String,httpRequest:{type:Function,default:function(t){if("undefined"!=typeof XMLHttpRequest){var e=new XMLHttpRequest,n=t.action;e.upload&&(e.upload.onprogress=function(e){e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress(e)});var i=new FormData;t.data&&Object.keys(t.data).forEach(function(e){i.append(e,t.data[e])}),i.append(t.filename,t.file,t.file.name),e.onerror=function(e){t.onError(e)},e.onload=function(){if(e.status<200||e.status>=300)return t.onError(function(t,e,n){var i=void 0;i=n.response?""+(n.response.error||n.response):n.responseText?""+n.responseText:"fail to post "+t+" "+n.status;var r=new Error(i);return r.status=n.status,r.method="post",r.url=t,r}(n,0,e));t.onSuccess(function(t){var e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}(e))},e.open("post",n,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);var r=t.headers||{};for(var o in r)r.hasOwnProperty(o)&&null!==r[o]&&e.setRequestHeader(o,r[o]);return e.send(i),e}}},disabled:Boolean,limit:Number,onExceed:Function},data:function(){return{mouseover:!1,reqs:{}}},methods:{isImage:function(t){return-1!==t.indexOf("image")},handleChange:function(t){var e=t.target.files;e&&this.uploadFiles(e)},uploadFiles:function(t){var e=this;if(this.limit&&this.fileList.length+t.length>this.limit)this.onExceed&&this.onExceed(t,this.fileList);else{var n=Array.prototype.slice.call(t);this.multiple||(n=n.slice(0,1)),0!==n.length&&n.forEach(function(t){e.onStart(t),e.autoUpload&&e.upload(t)})}},upload:function(t){var e=this;if(this.$refs.input.value=null,!this.beforeUpload)return this.post(t);var n=this.beforeUpload(t);n&&n.then?n.then(function(n){var i=Object.prototype.toString.call(n);if("[object File]"===i||"[object Blob]"===i){for(var r in"[object Blob]"===i&&(n=new File([n],t.name,{type:t.type})),t)t.hasOwnProperty(r)&&(n[r]=t[r]);e.post(n)}else e.post(t)},function(){e.onRemove(null,t)}):!1!==n?this.post(t):this.onRemove(null,t)},abort:function(t){var e=this.reqs;if(t){var n=t;t.uid&&(n=t.uid),e[n]&&e[n].abort()}else Object.keys(e).forEach(function(t){e[t]&&e[t].abort(),delete e[t]})},post:function(t){var e=this,n=t.uid,i={headers:this.headers,withCredentials:this.withCredentials,file:t,data:this.data,filename:this.name,action:this.action,onProgress:function(n){e.onProgress(n,t)},onSuccess:function(i){e.onSuccess(i,t),delete e.reqs[n]},onError:function(i){e.onError(i,t),delete e.reqs[n]}},r=this.httpRequest(i);this.reqs[n]=r,r&&r.then&&r.then(i.onSuccess,i.onError)},handleClick:function(){this.disabled||(this.$refs.input.value=null,this.$refs.input.click())},handleKeydown:function(t){t.target===t.currentTarget&&(13!==t.keyCode&&32!==t.keyCode||this.handleClick())}},render:function(t){var e=this.handleClick,n=this.drag,i=this.name,r=this.handleChange,o=this.multiple,s=this.accept,a=this.listType,l=this.uploadFiles,u=this.disabled,c={class:{"el-upload":!0},on:{click:e,keydown:this.handleKeydown}};return c.class["el-upload--"+a]=!0,t("div",Zs()([c,{attrs:{tabindex:"0"}}]),[n?t("upload-dragger",{attrs:{disabled:u},on:{file:l}},[this.$slots.default]):this.$slots.default,t("input",{class:"el-upload__input",attrs:{type:"file",name:i,multiple:o,accept:s},ref:"input",on:{change:r}})])}},void 0,void 0,!1,null,null,null);ea.options.__file="packages/upload/src/upload.vue";var na=ea.exports;function ia(){}var ra=r({name:"ElUpload",mixins:[E.a],components:{ElProgress:Ys.a,UploadList:Js,Upload:na},provide:function(){return{uploader:this}},inject:{elForm:{default:""}},props:{action:{type:String,required:!0},headers:{type:Object,default:function(){return{}}},data:Object,multiple:Boolean,name:{type:String,default:"file"},drag:Boolean,dragger:Boolean,withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:String,type:{type:String,default:"select"},beforeUpload:Function,beforeRemove:Function,onRemove:{type:Function,default:ia},onChange:{type:Function,default:ia},onPreview:{type:Function},onSuccess:{type:Function,default:ia},onProgress:{type:Function,default:ia},onError:{type:Function,default:ia},fileList:{type:Array,default:function(){return[]}},autoUpload:{type:Boolean,default:!0},listType:{type:String,default:"text"},httpRequest:Function,disabled:Boolean,limit:Number,onExceed:{type:Function,default:ia}},data:function(){return{uploadFiles:[],dragOver:!1,draging:!1,tempIndex:1}},computed:{uploadDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},watch:{listType:function(t){"picture-card"!==t&&"picture"!==t||(this.uploadFiles=this.uploadFiles.map(function(t){if(!t.url&&t.raw)try{t.url=URL.createObjectURL(t.raw)}catch(t){console.error("[Element Error][Upload]",t)}return t}))},fileList:{immediate:!0,handler:function(t){var e=this;this.uploadFiles=t.map(function(t){return t.uid=t.uid||Date.now()+e.tempIndex++,t.status=t.status||"success",t})}}},methods:{handleStart:function(t){t.uid=Date.now()+this.tempIndex++;var e={status:"ready",name:t.name,size:t.size,percentage:0,uid:t.uid,raw:t};if("picture-card"===this.listType||"picture"===this.listType)try{e.url=URL.createObjectURL(t)}catch(t){return void console.error("[Element Error][Upload]",t)}this.uploadFiles.push(e),this.onChange(e,this.uploadFiles)},handleProgress:function(t,e){var n=this.getFile(e);this.onProgress(t,n,this.uploadFiles),n.status="uploading",n.percentage=t.percent||0},handleSuccess:function(t,e){var n=this.getFile(e);n&&(n.status="success",n.response=t,this.onSuccess(t,n,this.uploadFiles),this.onChange(n,this.uploadFiles))},handleError:function(t,e){var n=this.getFile(e),i=this.uploadFiles;n.status="fail",i.splice(i.indexOf(n),1),this.onError(t,n,this.uploadFiles),this.onChange(n,this.uploadFiles)},handleRemove:function(t,e){var n=this;e&&(t=this.getFile(e));var i=function(){n.abort(t);var e=n.uploadFiles;e.splice(e.indexOf(t),1),n.onRemove(t,e)};if(this.beforeRemove){if("function"==typeof this.beforeRemove){var r=this.beforeRemove(t,this.uploadFiles);r&&r.then?r.then(function(){i()},ia):!1!==r&&i()}}else i()},getFile:function(t){var e=void 0;return this.uploadFiles.every(function(n){return!(e=t.uid===n.uid?n:null)}),e},abort:function(t){this.$refs["upload-inner"].abort(t)},clearFiles:function(){this.uploadFiles=[]},submit:function(){var t=this;this.uploadFiles.filter(function(t){return"ready"===t.status}).forEach(function(e){t.$refs["upload-inner"].upload(e.raw)})},getMigratingConfig:function(){return{props:{"default-file-list":"default-file-list is renamed to file-list.","show-upload-list":"show-upload-list is renamed to show-file-list.","thumbnail-mode":"thumbnail-mode has been deprecated, you can implement the same effect according to this case: http://element.eleme.io/#/zh-CN/component/upload#yong-hu-tou-xiang-shang-chuan"}}}},beforeDestroy:function(){this.uploadFiles.forEach(function(t){t.url&&0===t.url.indexOf("blob:")&&URL.revokeObjectURL(t.url)})},render:function(t){var e=this,n=void 0;this.showFileList&&(n=t(Js,{attrs:{disabled:this.uploadDisabled,listType:this.listType,files:this.uploadFiles,handlePreview:this.onPreview},on:{remove:this.handleRemove}},[function(t){if(e.$scopedSlots.file)return e.$scopedSlots.file({file:t.file})}]));var i=t("upload",{props:{type:this.type,drag:this.drag,action:this.action,multiple:this.multiple,"before-upload":this.beforeUpload,"with-credentials":this.withCredentials,headers:this.headers,name:this.name,data:this.data,accept:this.accept,fileList:this.uploadFiles,autoUpload:this.autoUpload,listType:this.listType,disabled:this.uploadDisabled,limit:this.limit,"on-exceed":this.onExceed,"on-start":this.handleStart,"on-progress":this.handleProgress,"on-success":this.handleSuccess,"on-error":this.handleError,"on-preview":this.onPreview,"on-remove":this.handleRemove,"http-request":this.httpRequest},ref:"upload-inner"},[this.$slots.trigger||this.$slots.default]);return t("div",["picture-card"===this.listType?n:"",this.$slots.trigger?[i,this.$slots.default]:i,this.$slots.tip,"picture-card"!==this.listType?n:""])}},void 0,void 0,!1,null,null,null);ra.options.__file="packages/upload/src/index.vue";var oa=ra.exports;oa.install=function(t){t.component(oa.name,oa)};var sa=oa,aa=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-progress",class:["el-progress--"+t.type,t.status?"is-"+t.status:"",{"el-progress--without-text":!t.showText,"el-progress--text-inside":t.textInside}],attrs:{role:"progressbar","aria-valuenow":t.percentage,"aria-valuemin":"0","aria-valuemax":"100"}},["line"===t.type?n("div",{staticClass:"el-progress-bar"},[n("div",{staticClass:"el-progress-bar__outer",style:{height:t.strokeWidth+"px"}},[n("div",{staticClass:"el-progress-bar__inner",style:t.barStyle},[t.showText&&t.textInside?n("div",{staticClass:"el-progress-bar__innerText"},[t._v(t._s(t.content))]):t._e()])])]):n("div",{staticClass:"el-progress-circle",style:{height:t.width+"px",width:t.width+"px"}},[n("svg",{attrs:{viewBox:"0 0 100 100"}},[n("path",{staticClass:"el-progress-circle__track",style:t.trailPathStyle,attrs:{d:t.trackPath,stroke:"#e5e9f2","stroke-width":t.relativeStrokeWidth,fill:"none"}}),n("path",{staticClass:"el-progress-circle__path",style:t.circlePathStyle,attrs:{d:t.trackPath,stroke:t.stroke,fill:"none","stroke-linecap":t.strokeLinecap,"stroke-width":t.percentage?t.relativeStrokeWidth:0}})])]),t.showText&&!t.textInside?n("div",{staticClass:"el-progress__text",style:{fontSize:t.progressTextSize+"px"}},[t.status?n("i",{class:t.iconClass}):[t._v(t._s(t.content))]],2):t._e()])};aa._withStripped=!0;var la=r({name:"ElProgress",props:{type:{type:String,default:"line",validator:function(t){return["line","circle","dashboard"].indexOf(t)>-1}},percentage:{type:Number,default:0,required:!0,validator:function(t){return t>=0&&t<=100}},status:{type:String,validator:function(t){return["success","exception","warning"].indexOf(t)>-1}},strokeWidth:{type:Number,default:6},strokeLinecap:{type:String,default:"round"},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:[String,Array,Function],default:""},format:Function},computed:{barStyle:function(){var t={};return t.width=this.percentage+"%",t.backgroundColor=this.getCurrentColor(this.percentage),t},relativeStrokeWidth:function(){return(this.strokeWidth/this.width*100).toFixed(1)},radius:function(){return"circle"===this.type||"dashboard"===this.type?parseInt(50-parseFloat(this.relativeStrokeWidth)/2,10):0},trackPath:function(){var t=this.radius,e="dashboard"===this.type;return"\n M 50 50\n m 0 "+(e?"":"-")+t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"-":"")+2*t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"":"-")+2*t+"\n "},perimeter:function(){return 2*Math.PI*this.radius},rate:function(){return"dashboard"===this.type?.75:1},strokeDashoffset:function(){return-1*this.perimeter*(1-this.rate)/2+"px"},trailPathStyle:function(){return{strokeDasharray:this.perimeter*this.rate+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset}},circlePathStyle:function(){return{strokeDasharray:this.perimeter*this.rate*(this.percentage/100)+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"}},stroke:function(){var t=void 0;if(this.color)t=this.getCurrentColor(this.percentage);else switch(this.status){case"success":t="#13ce66";break;case"exception":t="#ff4949";break;case"warning":t="#e6a23c";break;default:t="#20a0ff"}return t},iconClass:function(){return"warning"===this.status?"el-icon-warning":"line"===this.type?"success"===this.status?"el-icon-circle-check":"el-icon-circle-close":"success"===this.status?"el-icon-check":"el-icon-close"},progressTextSize:function(){return"line"===this.type?12+.4*this.strokeWidth:.111111*this.width+2},content:function(){return"function"==typeof this.format?this.format(this.percentage)||"":this.percentage+"%"}},methods:{getCurrentColor:function(t){return"function"==typeof this.color?this.color(t):"string"==typeof this.color?this.color:this.getLevelColor(t)},getLevelColor:function(t){for(var e=this.getColorArray().sort(function(t,e){return t.percentage-e.percentage}),n=0;n<e.length;n++)if(e[n].percentage>t)return e[n].color;return e[e.length-1].color},getColorArray:function(){var t=this.color,e=100/t.length;return t.map(function(t,n){return"string"==typeof t?{color:t,percentage:(n+1)*e}:t})}}},aa,[],!1,null,null,null);la.options.__file="packages/progress/src/progress.vue";var ua=la.exports;ua.install=function(t){t.component(ua.name,ua)};var ca=ua,ha=function(){var t=this.$createElement,e=this._self._c||t;return e("span",{staticClass:"el-spinner"},[e("svg",{staticClass:"el-spinner-inner",style:{width:this.radius/2+"px",height:this.radius/2+"px"},attrs:{viewBox:"0 0 50 50"}},[e("circle",{staticClass:"path",attrs:{cx:"25",cy:"25",r:"20",fill:"none",stroke:this.strokeColor,"stroke-width":this.strokeWidth}})])])};ha._withStripped=!0;var pa=r({name:"ElSpinner",props:{type:String,radius:{type:Number,default:100},strokeWidth:{type:Number,default:5},strokeColor:{type:String,default:"#efefef"}}},ha,[],!1,null,null,null);pa.options.__file="packages/spinner/src/spinner.vue";var da=pa.exports;da.install=function(t){t.component(da.name,da)};var fa=da,ga=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-message-fade"},on:{"after-leave":t.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],class:["el-message",t.type&&!t.iconClass?"el-message--"+t.type:"",t.center?"is-center":"",t.showClose?"is-closable":"",t.customClass],style:t.positionStyle,attrs:{role:"alert"},on:{mouseenter:t.clearTimer,mouseleave:t.startTimer}},[t.iconClass?n("i",{class:t.iconClass}):n("i",{class:t.typeClass}),t._t("default",[t.dangerouslyUseHTMLString?n("p",{staticClass:"el-message__content",domProps:{innerHTML:t._s(t.message)}}):n("p",{staticClass:"el-message__content"},[t._v(t._s(t.message))])]),t.showClose?n("i",{staticClass:"el-message__closeBtn el-icon-close",on:{click:t.close}}):t._e()],2)])};ga._withStripped=!0;var ma={success:"success",info:"info",warning:"warning",error:"error"},va=r({data:function(){return{visible:!1,message:"",duration:3e3,type:"info",iconClass:"",customClass:"",onClose:null,showClose:!1,closed:!1,verticalOffset:20,timer:null,dangerouslyUseHTMLString:!1,center:!1}},computed:{typeClass:function(){return this.type&&!this.iconClass?"el-message__icon el-icon-"+ma[this.type]:""},positionStyle:function(){return{top:this.verticalOffset+"px"}}},watch:{closed:function(t){t&&(this.visible=!1)}},methods:{handleAfterLeave:function(){this.$destroy(!0),this.$el.parentNode.removeChild(this.$el)},close:function(){this.closed=!0,"function"==typeof this.onClose&&this.onClose(this)},clearTimer:function(){clearTimeout(this.timer)},startTimer:function(){var t=this;this.duration>0&&(this.timer=setTimeout(function(){t.closed||t.close()},this.duration))},keydown:function(t){27===t.keyCode&&(this.closed||this.close())}},mounted:function(){this.startTimer(),document.addEventListener("keydown",this.keydown)},beforeDestroy:function(){document.removeEventListener("keydown",this.keydown)}},ga,[],!1,null,null,null);va.options.__file="packages/message/src/main.vue";var _a=va.exports,ya=hn.a.extend(_a),ba=void 0,Ta=[],Ea=1,Ca=function t(e){if(!hn.a.prototype.$isServer){"string"==typeof(e=e||{})&&(e={message:e});var n=e.onClose,i="message_"+Ea++;e.onClose=function(){t.close(i,n)},(ba=new ya({data:e})).id=i,Object(Wr.isVNode)(ba.message)&&(ba.$slots.default=[ba.message],ba.message=null),ba.$mount(),document.body.appendChild(ba.$el);var r=e.offset||20;return Ta.forEach(function(t){r+=t.$el.offsetHeight+16}),ba.verticalOffset=r,ba.visible=!0,ba.$el.style.zIndex=y.PopupManager.nextZIndex(),Ta.push(ba),ba}};["success","warning","info","error"].forEach(function(t){Ca[t]=function(e){return"string"==typeof e&&(e={message:e}),e.type=t,Ca(e)}}),Ca.close=function(t,e){for(var n=Ta.length,i=-1,r=void 0,o=0;o<n;o++)if(t===Ta[o].id){r=Ta[o].$el.offsetHeight,i=o,"function"==typeof e&&e(Ta[o]),Ta.splice(o,1);break}if(!(n<=1||-1===i||i>Ta.length-1))for(var s=i;s<n-1;s++){var a=Ta[s].$el;a.style.top=parseInt(a.style.top,10)-r-16+"px"}},Ca.closeAll=function(){for(var t=Ta.length-1;t>=0;t--)Ta[t].close()};var Sa=Ca,wa=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-badge"},[t._t("default"),n("transition",{attrs:{name:"el-zoom-in-center"}},[n("sup",{directives:[{name:"show",rawName:"v-show",value:!t.hidden&&(t.content||0===t.content||t.isDot),expression:"!hidden && (content || content === 0 || isDot)"}],staticClass:"el-badge__content",class:["el-badge__content--"+t.type,{"is-fixed":t.$slots.default,"is-dot":t.isDot}],domProps:{textContent:t._s(t.content)}})])],2)};wa._withStripped=!0;var ka=r({name:"ElBadge",props:{value:[String,Number],max:Number,isDot:Boolean,hidden:Boolean,type:{type:String,validator:function(t){return["primary","success","warning","info","danger"].indexOf(t)>-1}}},computed:{content:function(){if(!this.isDot){var t=this.value,e=this.max;return"number"==typeof t&&"number"==typeof e&&e<t?e+"+":t}}}},wa,[],!1,null,null,null);ka.options.__file="packages/badge/src/main.vue";var xa=ka.exports;xa.install=function(t){t.component(xa.name,xa)};var Ia=xa,Ra=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-card",class:t.shadow?"is-"+t.shadow+"-shadow":"is-always-shadow"},[t.$slots.header||t.header?n("div",{staticClass:"el-card__header"},[t._t("header",[t._v(t._s(t.header))])],2):t._e(),n("div",{staticClass:"el-card__body",style:t.bodyStyle},[t._t("default")],2)])};Ra._withStripped=!0;var Oa=r({name:"ElCard",props:{header:{},bodyStyle:{},shadow:{type:String}}},Ra,[],!1,null,null,null);Oa.options.__file="packages/card/src/main.vue";var Da=Oa.exports;Da.install=function(t){t.component(Da.name,Da)};var Aa=Da,Ma=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-rate",attrs:{role:"slider","aria-valuenow":t.currentValue,"aria-valuetext":t.text,"aria-valuemin":"0","aria-valuemax":t.max,tabindex:"0"},on:{keydown:t.handleKey}},[t._l(t.max,function(e,i){return n("span",{key:i,staticClass:"el-rate__item",style:{cursor:t.rateDisabled?"auto":"pointer"},on:{mousemove:function(n){t.setCurrentValue(e,n)},mouseleave:t.resetCurrentValue,click:function(n){t.selectValue(e)}}},[n("i",{staticClass:"el-rate__icon",class:[t.classes[e-1],{hover:t.hoverIndex===e}],style:t.getIconStyle(e)},[t.showDecimalIcon(e)?n("i",{staticClass:"el-rate__decimal",class:t.decimalIconClass,style:t.decimalStyle}):t._e()])])}),t.showText||t.showScore?n("span",{staticClass:"el-rate__text",style:{color:t.textColor}},[t._v(t._s(t.text))]):t._e()],2)};Ma._withStripped=!0;var Na=n(18),La=r({name:"ElRate",mixins:[E.a],inject:{elForm:{default:""}},data:function(){return{pointerAtLeftHalf:!0,currentValue:this.value,hoverIndex:-1}},props:{value:{type:Number,default:0},lowThreshold:{type:Number,default:2},highThreshold:{type:Number,default:4},max:{type:Number,default:5},colors:{type:[Array,Object],default:function(){return["#F7BA2A","#F7BA2A","#F7BA2A"]}},voidColor:{type:String,default:"#C6D1DE"},disabledVoidColor:{type:String,default:"#EFF2F7"},iconClasses:{type:[Array,Object],default:function(){return["el-icon-star-on","el-icon-star-on","el-icon-star-on"]}},voidIconClass:{type:String,default:"el-icon-star-off"},disabledVoidIconClass:{type:String,default:"el-icon-star-on"},disabled:{type:Boolean,default:!1},allowHalf:{type:Boolean,default:!1},showText:{type:Boolean,default:!1},showScore:{type:Boolean,default:!1},textColor:{type:String,default:"#1f2d3d"},texts:{type:Array,default:function(){return["极差","失望","一般","满意","惊喜"]}},scoreTemplate:{type:String,default:"{value}"}},computed:{text:function(){var t="";return this.showScore?t=this.scoreTemplate.replace(/\{\s*value\s*\}/,this.rateDisabled?this.value:this.currentValue):this.showText&&(t=this.texts[Math.ceil(this.currentValue)-1]),t},decimalStyle:function(){var t="";return this.rateDisabled?t=this.valueDecimal+"%":this.allowHalf&&(t="50%"),{color:this.activeColor,width:t}},valueDecimal:function(){return 100*this.value-100*Math.floor(this.value)},classMap:function(){var t;return Array.isArray(this.iconClasses)?((t={})[this.lowThreshold]=this.iconClasses[0],t[this.highThreshold]={value:this.iconClasses[1],excluded:!0},t[this.max]=this.iconClasses[2],t):this.iconClasses},decimalIconClass:function(){return this.getValueFromMap(this.value,this.classMap)},voidClass:function(){return this.rateDisabled?this.disabledVoidIconClass:this.voidIconClass},activeClass:function(){return this.getValueFromMap(this.currentValue,this.classMap)},colorMap:function(){var t;return Array.isArray(this.colors)?((t={})[this.lowThreshold]=this.colors[0],t[this.highThreshold]={value:this.colors[1],excluded:!0},t[this.max]=this.colors[2],t):this.colors},activeColor:function(){return this.getValueFromMap(this.currentValue,this.colorMap)},classes:function(){var t=[],e=0,n=this.currentValue;for(this.allowHalf&&this.currentValue!==Math.floor(this.currentValue)&&n--;e<n;e++)t.push(this.activeClass);for(;e<this.max;e++)t.push(this.voidClass);return t},rateDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},watch:{value:function(t){this.currentValue=t,this.pointerAtLeftHalf=this.value!==Math.floor(this.value)}},methods:{getMigratingConfig:function(){return{props:{"text-template":"text-template is renamed to score-template."}}},getValueFromMap:function(t,e){var n=Object.keys(e).filter(function(n){var i=e[n];return!!Object(Na.isObject)(i)&&i.excluded?t<n:t<=n}).sort(function(t,e){return t-e}),i=e[n[0]];return Object(Na.isObject)(i)?i.value:i||""},showDecimalIcon:function(t){var e=this.rateDisabled&&this.valueDecimal>0&&t-1<this.value&&t>this.value,n=this.allowHalf&&this.pointerAtLeftHalf&&t-.5<=this.currentValue&&t>this.currentValue;return e||n},getIconStyle:function(t){var e=this.rateDisabled?this.disabledVoidColor:this.voidColor;return{color:t<=this.currentValue?this.activeColor:e}},selectValue:function(t){this.rateDisabled||(this.allowHalf&&this.pointerAtLeftHalf?(this.$emit("input",this.currentValue),this.$emit("change",this.currentValue)):(this.$emit("input",t),this.$emit("change",t)))},handleKey:function(t){if(!this.rateDisabled){var e=this.currentValue,n=t.keyCode;38===n||39===n?(this.allowHalf?e+=.5:e+=1,t.stopPropagation(),t.preventDefault()):37!==n&&40!==n||(this.allowHalf?e-=.5:e-=1,t.stopPropagation(),t.preventDefault()),e=(e=e<0?0:e)>this.max?this.max:e,this.$emit("input",e),this.$emit("change",e)}},setCurrentValue:function(t,e){if(!this.rateDisabled){if(this.allowHalf){var n=e.target;Object(ft.hasClass)(n,"el-rate__item")&&(n=n.querySelector(".el-rate__icon")),Object(ft.hasClass)(n,"el-rate__decimal")&&(n=n.parentNode),this.pointerAtLeftHalf=2*e.offsetX<=n.clientWidth,this.currentValue=this.pointerAtLeftHalf?t-.5:t}else this.currentValue=t;this.hoverIndex=t}},resetCurrentValue:function(){this.rateDisabled||(this.allowHalf&&(this.pointerAtLeftHalf=this.value!==Math.floor(this.value)),this.currentValue=this.value,this.hoverIndex=-1)}},created:function(){this.value||this.$emit("input",0)}},Ma,[],!1,null,null,null);La.options.__file="packages/rate/src/main.vue";var Pa=La.exports;Pa.install=function(t){t.component(Pa.name,Pa)};var Ba=Pa,Fa=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-steps",class:[!this.simple&&"el-steps--"+this.direction,this.simple&&"el-steps--simple"]},[this._t("default")],2)};Fa._withStripped=!0;var Ua=r({name:"ElSteps",mixins:[E.a],props:{space:[Number,String],active:Number,direction:{type:String,default:"horizontal"},alignCenter:Boolean,simple:Boolean,finishStatus:{type:String,default:"finish"},processStatus:{type:String,default:"process"}},data:function(){return{steps:[],stepOffset:0}},methods:{getMigratingConfig:function(){return{props:{center:"center is removed."}}}},watch:{active:function(t,e){this.$emit("change",t,e)},steps:function(t){t.forEach(function(t,e){t.index=e})}}},Fa,[],!1,null,null,null);Ua.options.__file="packages/steps/src/steps.vue";var Va=Ua.exports;Va.install=function(t){t.component(Va.name,Va)};var Ha=Va,Wa=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-step",class:[!t.isSimple&&"is-"+t.$parent.direction,t.isSimple&&"is-simple",t.isLast&&!t.space&&!t.isCenter&&"is-flex",t.isCenter&&!t.isVertical&&!t.isSimple&&"is-center"],style:t.style},[n("div",{staticClass:"el-step__head",class:"is-"+t.currentStatus},[n("div",{staticClass:"el-step__line",style:t.isLast?"":{marginRight:t.$parent.stepOffset+"px"}},[n("i",{staticClass:"el-step__line-inner",style:t.lineStyle})]),n("div",{staticClass:"el-step__icon",class:"is-"+(t.icon?"icon":"text")},["success"!==t.currentStatus&&"error"!==t.currentStatus?t._t("icon",[t.icon?n("i",{staticClass:"el-step__icon-inner",class:[t.icon]}):t._e(),t.icon||t.isSimple?t._e():n("div",{staticClass:"el-step__icon-inner"},[t._v(t._s(t.index+1))])]):n("i",{staticClass:"el-step__icon-inner is-status",class:["el-icon-"+("success"===t.currentStatus?"check":"close")]})],2)]),n("div",{staticClass:"el-step__main"},[n("div",{ref:"title",staticClass:"el-step__title",class:["is-"+t.currentStatus]},[t._t("title",[t._v(t._s(t.title))])],2),t.isSimple?n("div",{staticClass:"el-step__arrow"}):n("div",{staticClass:"el-step__description",class:["is-"+t.currentStatus]},[t._t("description",[t._v(t._s(t.description))])],2)])])};Wa._withStripped=!0;var Ga=r({name:"ElStep",props:{title:String,icon:String,description:String,status:String},data:function(){return{index:-1,lineStyle:{},internalStatus:""}},beforeCreate:function(){this.$parent.steps.push(this)},beforeDestroy:function(){var t=this.$parent.steps,e=t.indexOf(this);e>=0&&t.splice(e,1)},computed:{currentStatus:function(){return this.status||this.internalStatus},prevStatus:function(){var t=this.$parent.steps[this.index-1];return t?t.currentStatus:"wait"},isCenter:function(){return this.$parent.alignCenter},isVertical:function(){return"vertical"===this.$parent.direction},isSimple:function(){return this.$parent.simple},isLast:function(){var t=this.$parent;return t.steps[t.steps.length-1]===this},stepsCount:function(){return this.$parent.steps.length},space:function(){var t=this.isSimple,e=this.$parent.space;return t?"":e},style:function(){var t={},e=this.$parent.steps.length,n="number"==typeof this.space?this.space+"px":this.space?this.space:100/(e-(this.isCenter?0:1))+"%";return t.flexBasis=n,this.isVertical?t:(this.isLast?t.maxWidth=100/this.stepsCount+"%":t.marginRight=-this.$parent.stepOffset+"px",t)}},methods:{updateStatus:function(t){var e=this.$parent.$children[this.index-1];t>this.index?this.internalStatus=this.$parent.finishStatus:t===this.index&&"error"!==this.prevStatus?this.internalStatus=this.$parent.processStatus:this.internalStatus="wait",e&&e.calcProgress(this.internalStatus)},calcProgress:function(t){var e=100,n={};n.transitionDelay=150*this.index+"ms",t===this.$parent.processStatus?(this.currentStatus,e=0):"wait"===t&&(e=0,n.transitionDelay=-150*this.index+"ms"),n.borderWidth=e&&!this.isSimple?"1px":0,"vertical"===this.$parent.direction?n.height=e+"%":n.width=e+"%",this.lineStyle=n}},mounted:function(){var t=this,e=this.$watch("index",function(n){t.$watch("$parent.active",t.updateStatus,{immediate:!0}),t.$watch("$parent.processStatus",function(){var e=t.$parent.active;t.updateStatus(e)},{immediate:!0}),e()})}},Wa,[],!1,null,null,null);Ga.options.__file="packages/steps/src/step.vue";var ja=Ga.exports;ja.install=function(t){t.component(ja.name,ja)};var za=ja,$a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.carouselClasses,on:{mouseenter:function(e){return e.stopPropagation(),t.handleMouseEnter(e)},mouseleave:function(e){return e.stopPropagation(),t.handleMouseLeave(e)}}},[n("div",{staticClass:"el-carousel__container",style:{height:t.height}},[t.arrowDisplay?n("transition",{attrs:{name:"carousel-arrow-left"}},[n("button",{directives:[{name:"show",rawName:"v-show",value:("always"===t.arrow||t.hover)&&(t.loop||t.activeIndex>0),expression:"(arrow === 'always' || hover) && (loop || activeIndex > 0)"}],staticClass:"el-carousel__arrow el-carousel__arrow--left",attrs:{type:"button"},on:{mouseenter:function(e){t.handleButtonEnter("left")},mouseleave:t.handleButtonLeave,click:function(e){e.stopPropagation(),t.throttledArrowClick(t.activeIndex-1)}}},[n("i",{staticClass:"el-icon-arrow-left"})])]):t._e(),t.arrowDisplay?n("transition",{attrs:{name:"carousel-arrow-right"}},[n("button",{directives:[{name:"show",rawName:"v-show",value:("always"===t.arrow||t.hover)&&(t.loop||t.activeIndex<t.items.length-1),expression:"(arrow === 'always' || hover) && (loop || activeIndex < items.length - 1)"}],staticClass:"el-carousel__arrow el-carousel__arrow--right",attrs:{type:"button"},on:{mouseenter:function(e){t.handleButtonEnter("right")},mouseleave:t.handleButtonLeave,click:function(e){e.stopPropagation(),t.throttledArrowClick(t.activeIndex+1)}}},[n("i",{staticClass:"el-icon-arrow-right"})])]):t._e(),t._t("default")],2),"none"!==t.indicatorPosition?n("ul",{class:t.indicatorsClasses},t._l(t.items,function(e,i){return n("li",{key:i,class:["el-carousel__indicator","el-carousel__indicator--"+t.direction,{"is-active":i===t.activeIndex}],on:{mouseenter:function(e){t.throttledIndicatorHover(i)},click:function(e){e.stopPropagation(),t.handleIndicatorClick(i)}}},[n("button",{staticClass:"el-carousel__button"},[t.hasLabel?n("span",[t._v(t._s(e.label))]):t._e()])])}),0):t._e()])};$a._withStripped=!0;var Xa=n(25),Ya=n.n(Xa),Ka=r({name:"ElCarousel",props:{initialIndex:{type:Number,default:0},height:String,trigger:{type:String,default:"hover"},autoplay:{type:Boolean,default:!0},interval:{type:Number,default:3e3},indicatorPosition:String,indicator:{type:Boolean,default:!0},arrow:{type:String,default:"hover"},type:String,loop:{type:Boolean,default:!0},direction:{type:String,default:"horizontal",validator:function(t){return-1!==["horizontal","vertical"].indexOf(t)}}},data:function(){return{items:[],activeIndex:-1,containerWidth:0,timer:null,hover:!1}},computed:{arrowDisplay:function(){return"never"!==this.arrow&&"vertical"!==this.direction},hasLabel:function(){return this.items.some(function(t){return t.label.toString().length>0})},carouselClasses:function(){var t=["el-carousel","el-carousel--"+this.direction];return"card"===this.type&&t.push("el-carousel--card"),t},indicatorsClasses:function(){var t=["el-carousel__indicators","el-carousel__indicators--"+this.direction];return this.hasLabel&&t.push("el-carousel__indicators--labels"),"outside"!==this.indicatorPosition&&"card"!==this.type||t.push("el-carousel__indicators--outside"),t}},watch:{items:function(t){t.length>0&&this.setActiveItem(this.initialIndex)},activeIndex:function(t,e){this.resetItemPosition(e),e>-1&&this.$emit("change",t,e)},autoplay:function(t){t?this.startTimer():this.pauseTimer()},loop:function(){this.setActiveItem(this.activeIndex)},interval:function(){this.pauseTimer(),this.startTimer()}},methods:{handleMouseEnter:function(){this.hover=!0,this.pauseTimer()},handleMouseLeave:function(){this.hover=!1,this.startTimer()},itemInStage:function(t,e){var n=this.items.length;return e===n-1&&t.inStage&&this.items[0].active||t.inStage&&this.items[e+1]&&this.items[e+1].active?"left":!!(0===e&&t.inStage&&this.items[n-1].active||t.inStage&&this.items[e-1]&&this.items[e-1].active)&&"right"},handleButtonEnter:function(t){var e=this;"vertical"!==this.direction&&this.items.forEach(function(n,i){t===e.itemInStage(n,i)&&(n.hover=!0)})},handleButtonLeave:function(){"vertical"!==this.direction&&this.items.forEach(function(t){t.hover=!1})},updateItems:function(){this.items=this.$children.filter(function(t){return"ElCarouselItem"===t.$options.name})},resetItemPosition:function(t){var e=this;this.items.forEach(function(n,i){n.translateItem(i,e.activeIndex,t)})},playSlides:function(){this.activeIndex<this.items.length-1?this.activeIndex++:this.loop&&(this.activeIndex=0)},pauseTimer:function(){this.timer&&(clearInterval(this.timer),this.timer=null)},startTimer:function(){this.interval<=0||!this.autoplay||this.timer||(this.timer=setInterval(this.playSlides,this.interval))},setActiveItem:function(t){if("string"==typeof t){var e=this.items.filter(function(e){return e.name===t});e.length>0&&(t=this.items.indexOf(e[0]))}if(t=Number(t),isNaN(t)||t!==Math.floor(t))console.warn("[Element Warn][Carousel]index must be an integer.");else{var n=this.items.length,i=this.activeIndex;this.activeIndex=t<0?this.loop?n-1:0:t>=n?this.loop?0:n-1:t,i===this.activeIndex&&this.resetItemPosition(i)}},prev:function(){this.setActiveItem(this.activeIndex-1)},next:function(){this.setActiveItem(this.activeIndex+1)},handleIndicatorClick:function(t){this.activeIndex=t},handleIndicatorHover:function(t){"hover"===this.trigger&&t!==this.activeIndex&&(this.activeIndex=t)}},created:function(){var t=this;this.throttledArrowClick=Ya()(300,!0,function(e){t.setActiveItem(e)}),this.throttledIndicatorHover=Ya()(300,function(e){t.handleIndicatorHover(e)})},mounted:function(){var t=this;this.updateItems(),this.$nextTick(function(){Object(Pe.addResizeListener)(t.$el,t.resetItemPosition),t.initialIndex<t.items.length&&t.initialIndex>=0&&(t.activeIndex=t.initialIndex),t.startTimer()})},beforeDestroy:function(){this.$el&&Object(Pe.removeResizeListener)(this.$el,this.resetItemPosition),this.pauseTimer()}},$a,[],!1,null,null,null);Ka.options.__file="packages/carousel/src/main.vue";var Ja=Ka.exports;Ja.install=function(t){t.component(Ja.name,Ja)};var qa=Ja,Za={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}};var Qa={name:"Bar",props:{vertical:Boolean,size:String,move:Number},computed:{bar:function(){return Za[this.vertical?"vertical":"horizontal"]},wrap:function(){return this.$parent.wrap}},render:function(t){var e=this.size,n=this.move,i=this.bar;return t("div",{class:["el-scrollbar__bar","is-"+i.key],on:{mousedown:this.clickTrackHandler}},[t("div",{ref:"thumb",class:"el-scrollbar__thumb",on:{mousedown:this.clickThumbHandler},style:function(t){var e=t.move,n=t.size,i=t.bar,r={},o="translate"+i.axis+"("+e+"%)";return r[i.size]=n,r.transform=o,r.msTransform=o,r.webkitTransform=o,r}({size:e,move:n,bar:i})})])},methods:{clickThumbHandler:function(t){t.ctrlKey||2===t.button||(this.startDrag(t),this[this.bar.axis]=t.currentTarget[this.bar.offset]-(t[this.bar.client]-t.currentTarget.getBoundingClientRect()[this.bar.direction]))},clickTrackHandler:function(t){var e=100*(Math.abs(t.target.getBoundingClientRect()[this.bar.direction]-t[this.bar.client])-this.$refs.thumb[this.bar.offset]/2)/this.$el[this.bar.offset];this.wrap[this.bar.scroll]=e*this.wrap[this.bar.scrollSize]/100},startDrag:function(t){t.stopImmediatePropagation(),this.cursorDown=!0,Object(ft.on)(document,"mousemove",this.mouseMoveDocumentHandler),Object(ft.on)(document,"mouseup",this.mouseUpDocumentHandler),document.onselectstart=function(){return!1}},mouseMoveDocumentHandler:function(t){if(!1!==this.cursorDown){var e=this[this.bar.axis];if(e){var n=100*(-1*(this.$el.getBoundingClientRect()[this.bar.direction]-t[this.bar.client])-(this.$refs.thumb[this.bar.offset]-e))/this.$el[this.bar.offset];this.wrap[this.bar.scroll]=n*this.wrap[this.bar.scrollSize]/100}}},mouseUpDocumentHandler:function(t){this.cursorDown=!1,this[this.bar.axis]=0,Object(ft.off)(document,"mousemove",this.mouseMoveDocumentHandler),document.onselectstart=null}},destroyed:function(){Object(ft.off)(document,"mouseup",this.mouseUpDocumentHandler)}},tl={name:"ElScrollbar",components:{Bar:Qa},props:{native:Boolean,wrapStyle:{},wrapClass:{},viewClass:{},viewStyle:{},noresize:Boolean,tag:{type:String,default:"div"}},data:function(){return{sizeWidth:"0",sizeHeight:"0",moveX:0,moveY:0}},computed:{wrap:function(){return this.$refs.wrap}},render:function(t){var e=Nn()(),n=this.wrapStyle;if(e){var i="-"+e+"px",r="margin-bottom: "+i+"; margin-right: "+i+";";Array.isArray(this.wrapStyle)?(n=Object(g.toObject)(this.wrapStyle)).marginRight=n.marginBottom=i:"string"==typeof this.wrapStyle?n+=r:n=r}var o=t(this.tag,{class:["el-scrollbar__view",this.viewClass],style:this.viewStyle,ref:"resize"},this.$slots.default),s=t("div",{ref:"wrap",style:n,on:{scroll:this.handleScroll},class:[this.wrapClass,"el-scrollbar__wrap",e?"":"el-scrollbar__wrap--hidden-default"]},[[o]]);return t("div",{class:"el-scrollbar"},this.native?[t("div",{ref:"wrap",class:[this.wrapClass,"el-scrollbar__wrap"],style:n},[[o]])]:[s,t(Qa,{attrs:{move:this.moveX,size:this.sizeWidth}}),t(Qa,{attrs:{vertical:!0,move:this.moveY,size:this.sizeHeight}})])},methods:{handleScroll:function(){var t=this.wrap;this.moveY=100*t.scrollTop/t.clientHeight,this.moveX=100*t.scrollLeft/t.clientWidth},update:function(){var t,e,n=this.wrap;n&&(t=100*n.clientHeight/n.scrollHeight,e=100*n.clientWidth/n.scrollWidth,this.sizeHeight=t<100?t+"%":"",this.sizeWidth=e<100?e+"%":"")}},mounted:function(){this.native||(this.$nextTick(this.update),!this.noresize&&Object(Pe.addResizeListener)(this.$refs.resize,this.update))},beforeDestroy:function(){this.native||!this.noresize&&Object(Pe.removeResizeListener)(this.$refs.resize,this.update)},install:function(t){t.component(tl.name,tl)}},el=tl,nl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.ready,expression:"ready"}],staticClass:"el-carousel__item",class:{"is-active":t.active,"el-carousel__item--card":"card"===t.$parent.type,"is-in-stage":t.inStage,"is-hover":t.hover,"is-animating":t.animating},style:t.itemStyle,on:{click:t.handleItemClick}},["card"===t.$parent.type?n("div",{directives:[{name:"show",rawName:"v-show",value:!t.active,expression:"!active"}],staticClass:"el-carousel__mask"}):t._e(),t._t("default")],2)};nl._withStripped=!0;var il=r({name:"ElCarouselItem",props:{name:String,label:{type:[String,Number],default:""}},data:function(){return{hover:!1,translate:0,scale:1,active:!1,ready:!1,inStage:!1,animating:!1}},methods:{processIndex:function(t,e,n){return 0===e&&t===n-1?-1:e===n-1&&0===t?n:t<e-1&&e-t>=n/2?n+1:t>e+1&&t-e>=n/2?-2:t},calcCardTranslate:function(t,e){var n=this.$parent.$el.offsetWidth;return this.inStage?n*(1.17*(t-e)+1)/4:t<e?-1.83*n/4:3.83*n/4},calcTranslate:function(t,e,n){return this.$parent.$el[n?"offsetHeight":"offsetWidth"]*(t-e)},translateItem:function(t,e,n){var i=this.$parent.type,r=this.parentDirection,o=this.$parent.items.length;if("card"!==i&&void 0!==n&&(this.animating=t===e||t===n),t!==e&&o>2&&this.$parent.loop&&(t=this.processIndex(t,e,o)),"card"===i)"vertical"===r&&console.warn("[Element Warn][Carousel]vertical direction is not supported in card mode"),this.inStage=Math.round(Math.abs(t-e))<=1,this.active=t===e,this.translate=this.calcCardTranslate(t,e),this.scale=this.active?1:.83;else{this.active=t===e;var s="vertical"===r;this.translate=this.calcTranslate(t,e,s),this.scale=1}this.ready=!0},handleItemClick:function(){var t=this.$parent;if(t&&"card"===t.type){var e=t.items.indexOf(this);t.setActiveItem(e)}}},computed:{parentDirection:function(){return this.$parent.direction},itemStyle:function(){var t={transform:("vertical"===this.parentDirection?"translateY":"translateX")+"("+this.translate+"px) scale("+this.scale+")"};return Object(g.autoprefixer)(t)}},created:function(){this.$parent&&this.$parent.updateItems()},destroyed:function(){this.$parent&&this.$parent.updateItems()}},nl,[],!1,null,null,null);il.options.__file="packages/carousel/src/item.vue";var rl=il.exports;rl.install=function(t){t.component(rl.name,rl)};var ol=rl,sl=function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"el-collapse",attrs:{role:"tablist","aria-multiselectable":"true"}},[this._t("default")],2)};sl._withStripped=!0;var al=r({name:"ElCollapse",componentName:"ElCollapse",props:{accordion:Boolean,value:{type:[Array,String,Number],default:function(){return[]}}},data:function(){return{activeNames:[].concat(this.value)}},provide:function(){return{collapse:this}},watch:{value:function(t){this.activeNames=[].concat(t)}},methods:{setActiveNames:function(t){t=[].concat(t);var e=this.accordion?t[0]:t;this.activeNames=t,this.$emit("input",e),this.$emit("change",e)},handleItemClick:function(t){if(this.accordion)this.setActiveNames(!this.activeNames[0]&&0!==this.activeNames[0]||this.activeNames[0]!==t.name?t.name:"");else{var e=this.activeNames.slice(0),n=e.indexOf(t.name);n>-1?e.splice(n,1):e.push(t.name),this.setActiveNames(e)}}},created:function(){this.$on("item-click",this.handleItemClick)}},sl,[],!1,null,null,null);al.options.__file="packages/collapse/src/collapse.vue";var ll=al.exports;ll.install=function(t){t.component(ll.name,ll)};var ul=ll,cl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-collapse-item",class:{"is-active":t.isActive,"is-disabled":t.disabled}},[n("div",{attrs:{role:"tab","aria-expanded":t.isActive,"aria-controls":"el-collapse-content-"+t.id,"aria-describedby":"el-collapse-content-"+t.id}},[n("div",{staticClass:"el-collapse-item__header",class:{focusing:t.focusing,"is-active":t.isActive},attrs:{role:"button",id:"el-collapse-head-"+t.id,tabindex:t.disabled?void 0:0},on:{click:t.handleHeaderClick,keyup:function(e){return"button"in e||!t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"])||!t._k(e.keyCode,"enter",13,e.key,"Enter")?(e.stopPropagation(),t.handleEnterClick(e)):null},focus:t.handleFocus,blur:function(e){t.focusing=!1}}},[t._t("title",[t._v(t._s(t.title))]),n("i",{staticClass:"el-collapse-item__arrow el-icon-arrow-right",class:{"is-active":t.isActive}})],2)]),n("el-collapse-transition",[n("div",{directives:[{name:"show",rawName:"v-show",value:t.isActive,expression:"isActive"}],staticClass:"el-collapse-item__wrap",attrs:{role:"tabpanel","aria-hidden":!t.isActive,"aria-labelledby":"el-collapse-head-"+t.id,id:"el-collapse-content-"+t.id}},[n("div",{staticClass:"el-collapse-item__content"},[t._t("default")],2)])])],1)};cl._withStripped=!0;var hl=r({name:"ElCollapseItem",componentName:"ElCollapseItem",mixins:[S.a],components:{ElCollapseTransition:yt.a},data:function(){return{contentWrapStyle:{height:"auto",display:"block"},contentHeight:0,focusing:!1,isClick:!1,id:Object(g.generateId)()}},inject:["collapse"],props:{title:String,name:{type:[String,Number],default:function(){return this._uid}},disabled:Boolean},computed:{isActive:function(){return this.collapse.activeNames.indexOf(this.name)>-1}},methods:{handleFocus:function(){var t=this;setTimeout(function(){t.isClick?t.isClick=!1:t.focusing=!0},50)},handleHeaderClick:function(){this.disabled||(this.dispatch("ElCollapse","item-click",this),this.focusing=!1,this.isClick=!0)},handleEnterClick:function(){this.dispatch("ElCollapse","item-click",this)}}},cl,[],!1,null,null,null);hl.options.__file="packages/collapse/src/collapse-item.vue";var pl=hl.exports;pl.install=function(t){t.component(pl.name,pl)};var dl=pl,fl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:function(){return t.toggleDropDownVisible(!1)},expression:"() => toggleDropDownVisible(false)"}],ref:"reference",class:["el-cascader",t.realSize&&"el-cascader--"+t.realSize,{"is-disabled":t.isDisabled}],on:{mouseenter:function(e){t.inputHover=!0},mouseleave:function(e){t.inputHover=!1},click:function(){return t.toggleDropDownVisible(!t.readonly||void 0)},keydown:t.handleKeyDown}},[n("el-input",{ref:"input",class:{"is-focus":t.dropDownVisible},attrs:{size:t.realSize,placeholder:t.placeholder,readonly:t.readonly,disabled:t.isDisabled,"validate-event":!1},on:{focus:t.handleFocus,blur:t.handleBlur,input:t.handleInput},model:{value:t.multiple?t.presentText:t.inputValue,callback:function(e){t.multiple?t.presentText:t.inputValue=e},expression:"multiple ? presentText : inputValue"}},[n("template",{slot:"suffix"},[t.clearBtnVisible?n("i",{key:"clear",staticClass:"el-input__icon el-icon-circle-close",on:{click:function(e){return e.stopPropagation(),t.handleClear(e)}}}):n("i",{key:"arrow-down",class:["el-input__icon","el-icon-arrow-down",t.dropDownVisible&&"is-reverse"],on:{click:function(e){e.stopPropagation(),t.toggleDropDownVisible()}}})])],2),t.multiple?n("div",{staticClass:"el-cascader__tags"},[t._l(t.presentTags,function(e){return n("el-tag",{key:e.key,attrs:{type:"info",size:t.tagSize,hit:e.hitState,closable:e.closable,"disable-transitions":""},on:{close:function(n){t.deleteTag(e)}}},[n("span",[t._v(t._s(e.text))])])}),t.filterable&&!t.isDisabled?n("input",{directives:[{name:"model",rawName:"v-model.trim",value:t.inputValue,expression:"inputValue",modifiers:{trim:!0}}],staticClass:"el-cascader__search-input",attrs:{type:"text",placeholder:t.presentTags.length?"":t.placeholder},domProps:{value:t.inputValue},on:{input:[function(e){e.target.composing||(t.inputValue=e.target.value.trim())},function(e){return t.handleInput(t.inputValue,e)}],click:function(e){e.stopPropagation(),t.toggleDropDownVisible(!0)},keydown:function(e){return"button"in e||!t._k(e.keyCode,"delete",[8,46],e.key,["Backspace","Delete","Del"])?t.handleDelete(e):null},blur:function(e){t.$forceUpdate()}}}):t._e()],2):t._e(),n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":t.handleDropdownLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.dropDownVisible,expression:"dropDownVisible"}],ref:"popper",class:["el-popper","el-cascader__dropdown",t.popperClass]},[n("el-cascader-panel",{directives:[{name:"show",rawName:"v-show",value:!t.filtering,expression:"!filtering"}],ref:"panel",attrs:{options:t.options,props:t.config,border:!1,"render-label":t.$scopedSlots.default},on:{"expand-change":t.handleExpandChange,close:function(e){t.toggleDropDownVisible(!1)}},model:{value:t.checkedValue,callback:function(e){t.checkedValue=e},expression:"checkedValue"}}),t.filterable?n("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:t.filtering,expression:"filtering"}],ref:"suggestionPanel",staticClass:"el-cascader__suggestion-panel",attrs:{tag:"ul","view-class":"el-cascader__suggestion-list"},nativeOn:{keydown:function(e){return t.handleSuggestionKeyDown(e)}}},[t.suggestions.length?t._l(t.suggestions,function(e,i){return n("li",{key:e.uid,class:["el-cascader__suggestion-item",e.checked&&"is-checked"],attrs:{tabindex:-1},on:{click:function(e){t.handleSuggestionClick(i)}}},[n("span",[t._v(t._s(e.text))]),e.checked?n("i",{staticClass:"el-icon-check"}):t._e()])}):t._t("empty",[n("li",{staticClass:"el-cascader__empty-text"},[t._v(t._s(t.t("el.cascader.noMatch")))])])],2):t._e()],1)])],1)};fl._withStripped=!0;var gl=n(42),ml=n.n(gl),vl=n(34),_l=n.n(vl),yl=_l.a.keys,bl={expandTrigger:{newProp:"expandTrigger",type:String},changeOnSelect:{newProp:"checkStrictly",type:Boolean},hoverThreshold:{newProp:"hoverThreshold",type:Number}},Tl={props:{placement:{type:String,default:"bottom-start"},appendToBody:L.a.props.appendToBody,visibleArrow:{type:Boolean,default:!0},arrowOffset:L.a.props.arrowOffset,offset:L.a.props.offset,boundariesPadding:L.a.props.boundariesPadding,popperOptions:L.a.props.popperOptions},methods:L.a.methods,data:L.a.data,beforeDestroy:L.a.beforeDestroy},El={medium:36,small:32,mini:28},Cl=r({name:"ElCascader",directives:{Clickoutside:A.a},mixins:[Tl,S.a,f.a,E.a],inject:{elForm:{default:""},elFormItem:{default:""}},components:{ElInput:p.a,ElTag:Le.a,ElScrollbar:B.a,ElCascaderPanel:ml.a},props:{value:{},options:Array,props:Object,size:String,placeholder:{type:String,default:function(){return Object(Nr.t)("el.cascader.placeholder")}},disabled:Boolean,clearable:Boolean,filterable:Boolean,filterMethod:Function,separator:{type:String,default:" / "},showAllLevels:{type:Boolean,default:!0},collapseTags:Boolean,debounce:{type:Number,default:300},beforeFilter:{type:Function,default:function(){return function(){}}},popperClass:String},data:function(){return{dropDownVisible:!1,checkedValue:this.value||null,inputHover:!1,inputValue:null,presentText:null,presentTags:[],checkedNodes:[],filtering:!1,suggestions:[],inputInitialHeight:0,pressDeleteCount:0}},computed:{realSize:function(){var t=(this.elFormItem||{}).elFormItemSize;return this.size||t||(this.$ELEMENT||{}).size},tagSize:function(){return["small","mini"].indexOf(this.realSize)>-1?"mini":"small"},isDisabled:function(){return this.disabled||(this.elForm||{}).disabled},config:function(){var t=this.props||{},e=this.$attrs;return Object.keys(bl).forEach(function(n){var i=bl[n],r=i.newProp,o=i.type,s=e[n]||e[Object(g.kebabCase)(n)];Object(Wt.isDef)(n)&&!Object(Wt.isDef)(t[r])&&(o===Boolean&&""===s&&(s=!0),t[r]=s)}),t},multiple:function(){return this.config.multiple},leafOnly:function(){return!this.config.checkStrictly},readonly:function(){return!this.filterable||this.multiple},clearBtnVisible:function(){return!(!this.clearable||this.isDisabled||this.filtering||!this.inputHover)&&(this.multiple?!!this.checkedNodes.filter(function(t){return!t.isDisabled}).length:!!this.presentText)},panel:function(){return this.$refs.panel}},watch:{disabled:function(){this.computePresentContent()},value:function(t){Object(g.isEqual)(t,this.checkedValue)||(this.checkedValue=t,this.computePresentContent())},checkedValue:function(t){var e=this.value,n=this.dropDownVisible,i=this.config,r=i.checkStrictly,o=i.multiple;Object(g.isEqual)(t,e)&&!Object(Na.isUndefined)(e)||(this.computePresentContent(),o||r||!n||this.toggleDropDownVisible(!1),this.$emit("input",t),this.$emit("change",t),this.dispatch("ElFormItem","el.form.change",[t]))},options:{handler:function(){this.$nextTick(this.computePresentContent)},deep:!0},presentText:function(t){this.inputValue=t},presentTags:function(t,e){this.multiple&&(t.length||e.length)&&this.$nextTick(this.updateStyle)},filtering:function(t){this.$nextTick(this.updatePopper)}},mounted:function(){var t=this,e=this.$refs.input;e&&e.$el&&(this.inputInitialHeight=e.$el.offsetHeight||El[this.realSize]||40),Object(g.isEmpty)(this.value)||this.computePresentContent(),this.filterHandler=O()(this.debounce,function(){var e=t.inputValue;if(e){var n=t.beforeFilter(e);n&&n.then?n.then(t.getSuggestions):!1!==n?t.getSuggestions():t.filtering=!1}else t.filtering=!1}),Object(Pe.addResizeListener)(this.$el,this.updateStyle)},beforeDestroy:function(){Object(Pe.removeResizeListener)(this.$el,this.updateStyle)},methods:{getMigratingConfig:function(){return{props:{"expand-trigger":"expand-trigger is removed, use `props.expandTrigger` instead.","change-on-select":"change-on-select is removed, use `props.checkStrictly` instead.","hover-threshold":"hover-threshold is removed, use `props.hoverThreshold` instead"},events:{"active-item-change":"active-item-change is renamed to expand-change"}}},toggleDropDownVisible:function(t){var e=this;if(!this.isDisabled){var n=this.dropDownVisible,i=this.$refs.input;(t=Object(Wt.isDef)(t)?t:!n)!==n&&(this.dropDownVisible=t,t&&this.$nextTick(function(){e.updatePopper(),e.panel.scrollIntoView()}),i.$refs.input.setAttribute("aria-expanded",t),this.$emit("visible-change",t))}},handleDropdownLeave:function(){this.filtering=!1,this.inputValue=this.presentText},handleKeyDown:function(t){switch(t.keyCode){case yl.enter:this.toggleDropDownVisible();break;case yl.down:this.toggleDropDownVisible(!0),this.focusFirstNode(),t.preventDefault();break;case yl.esc:case yl.tab:this.toggleDropDownVisible(!1)}},handleFocus:function(t){this.$emit("focus",t)},handleBlur:function(t){this.$emit("blur",t)},handleInput:function(t,e){!this.dropDownVisible&&this.toggleDropDownVisible(!0),e&&e.isComposing||(t?this.filterHandler():this.filtering=!1)},handleClear:function(){this.presentText="",this.panel.clearCheckedNodes()},handleExpandChange:function(t){this.$nextTick(this.updatePopper.bind(this)),this.$emit("expand-change",t),this.$emit("active-item-change",t)},focusFirstNode:function(){var t=this;this.$nextTick(function(){var e=t.filtering,n=t.$refs,i=n.popper,r=n.suggestionPanel,o=null;e&&r?o=r.$el.querySelector(".el-cascader__suggestion-item"):o=i.querySelector(".el-cascader-menu").querySelector('.el-cascader-node[tabindex="-1"]');o&&(o.focus(),!e&&o.click())})},computePresentContent:function(){var t=this;this.$nextTick(function(){t.config.multiple?(t.computePresentTags(),t.presentText=t.presentTags.length?" ":null):t.computePresentText()})},computePresentText:function(){var t=this.checkedValue,e=this.config;if(!Object(g.isEmpty)(t)){var n=this.panel.getNodeByValue(t);if(n&&(e.checkStrictly||n.isLeaf))return void(this.presentText=n.getText(this.showAllLevels,this.separator))}this.presentText=null},computePresentTags:function(){var t=this.isDisabled,e=this.leafOnly,n=this.showAllLevels,i=this.separator,r=this.collapseTags,o=this.getCheckedNodes(e),s=[],a=function(e){return{node:e,key:e.uid,text:e.getText(n,i),hitState:!1,closable:!t&&!e.isDisabled}};if(o.length){var l=o[0],u=o.slice(1),c=u.length;s.push(a(l)),c&&(r?s.push({key:-1,text:"+ "+c,closable:!1}):u.forEach(function(t){return s.push(a(t))}))}this.checkedNodes=o,this.presentTags=s},getSuggestions:function(){var t=this,e=this.filterMethod;Object(Na.isFunction)(e)||(e=function(t,e){return t.text.includes(e)});var n=this.panel.getFlattedNodes(this.leafOnly).filter(function(n){return!n.isDisabled&&(n.text=n.getText(t.showAllLevels,t.separator)||"",e(n,t.inputValue))});this.multiple?this.presentTags.forEach(function(t){t.hitState=!1}):n.forEach(function(e){e.checked=Object(g.isEqual)(t.checkedValue,e.getValueByOption())}),this.filtering=!0,this.suggestions=n,this.$nextTick(this.updatePopper)},handleSuggestionKeyDown:function(t){var e=t.keyCode,n=t.target;switch(e){case yl.enter:n.click();break;case yl.up:var i=n.previousElementSibling;i&&i.focus();break;case yl.down:var r=n.nextElementSibling;r&&r.focus();break;case yl.esc:case yl.tab:this.toggleDropDownVisible(!1)}},handleDelete:function(){var t=this.inputValue,e=this.pressDeleteCount,n=this.presentTags,i=n[n.length-1];this.pressDeleteCount=t?0:e+1,i&&this.pressDeleteCount&&(i.hitState?this.deleteTag(i):i.hitState=!0)},handleSuggestionClick:function(t){var e=this.multiple,n=this.suggestions[t];if(e){var i=n.checked;n.doCheck(!i),this.panel.calculateMultiCheckedValue()}else this.checkedValue=n.getValueByOption(),this.toggleDropDownVisible(!1)},deleteTag:function(t){var e=this.checkedValue,n=t.node.getValueByOption(),i=e.find(function(t){return Object(g.isEqual)(t,n)});this.checkedValue=e.filter(function(t){return!Object(g.isEqual)(t,n)}),this.$emit("remove-tag",i)},updateStyle:function(){var t=this.$el,e=this.inputInitialHeight;if(!this.$isServer&&t){var n=this.$refs.suggestionPanel,i=t.querySelector(".el-input__inner");if(i){var r=t.querySelector(".el-cascader__tags"),o=null;if(n&&(o=n.$el))o.querySelector(".el-cascader__suggestion-list").style.minWidth=i.offsetWidth+"px";if(r){var s=r.offsetHeight,a=Math.max(s+6,e)+"px";i.style.height=a,this.updatePopper()}}}},getCheckedNodes:function(t){return this.panel.getCheckedNodes(t)}}},fl,[],!1,null,null,null);Cl.options.__file="packages/cascader/src/cascader.vue";var Sl=Cl.exports;Sl.install=function(t){t.component(Sl.name,Sl)};var wl=Sl,kl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:t.hide,expression:"hide"}],class:["el-color-picker",t.colorDisabled?"is-disabled":"",t.colorSize?"el-color-picker--"+t.colorSize:""]},[t.colorDisabled?n("div",{staticClass:"el-color-picker__mask"}):t._e(),n("div",{staticClass:"el-color-picker__trigger",on:{click:t.handleTrigger}},[n("span",{staticClass:"el-color-picker__color",class:{"is-alpha":t.showAlpha}},[n("span",{staticClass:"el-color-picker__color-inner",style:{backgroundColor:t.displayedColor}}),t.value||t.showPanelColor?t._e():n("span",{staticClass:"el-color-picker__empty el-icon-close"})]),n("span",{directives:[{name:"show",rawName:"v-show",value:t.value||t.showPanelColor,expression:"value || showPanelColor"}],staticClass:"el-color-picker__icon el-icon-arrow-down"})]),n("picker-dropdown",{ref:"dropdown",class:["el-color-picker__panel",t.popperClass||""],attrs:{color:t.color,"show-alpha":t.showAlpha,predefine:t.predefine},on:{pick:t.confirmValue,clear:t.clearValue},model:{value:t.showPicker,callback:function(e){t.showPicker=e},expression:"showPicker"}})],1)};kl._withStripped=!0;var xl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var Il=function(t,e,n){return[t,e*n/((t=(2-e)*n)<1?t:2-t)||0,t/2]},Rl=function(t,e){var n;"string"==typeof(n=t)&&-1!==n.indexOf(".")&&1===parseFloat(n)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!==t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)},Ol={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"},Dl={A:10,B:11,C:12,D:13,E:14,F:15},Al=function(t){return 2===t.length?16*(Dl[t[0].toUpperCase()]||+t[0])+(Dl[t[1].toUpperCase()]||+t[1]):Dl[t[1].toUpperCase()]||+t[1]},Ml=function(t,e,n){t=Rl(t,255),e=Rl(e,255),n=Rl(n,255);var i,r=Math.max(t,e,n),o=Math.min(t,e,n),s=void 0,a=r,l=r-o;if(i=0===r?0:l/r,r===o)s=0;else{switch(r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4}s/=6}return{h:360*s,s:100*i,v:100*a}},Nl=function(t,e,n){t=6*Rl(t,360),e=Rl(e,100),n=Rl(n,100);var i=Math.floor(t),r=t-i,o=n*(1-e),s=n*(1-r*e),a=n*(1-(1-r)*e),l=i%6,u=[n,s,o,o,a,n][l],c=[a,n,n,s,o,o][l],h=[o,o,a,n,n,s][l];return{r:Math.round(255*u),g:Math.round(255*c),b:Math.round(255*h)}},Ll=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._hue=0,this._saturation=100,this._value=100,this._alpha=100,this.enableAlpha=!1,this.format="hex",this.value="",e=e||{})e.hasOwnProperty(n)&&(this[n]=e[n]);this.doOnChange()}return t.prototype.set=function(t,e){if(1!==arguments.length||"object"!==(void 0===t?"undefined":xl(t)))this["_"+t]=e,this.doOnChange();else for(var n in t)t.hasOwnProperty(n)&&this.set(n,t[n])},t.prototype.get=function(t){return this["_"+t]},t.prototype.toRgb=function(){return Nl(this._hue,this._saturation,this._value)},t.prototype.fromString=function(t){var e=this;if(!t)return this._hue=0,this._saturation=100,this._value=100,void this.doOnChange();var n=function(t,n,i){e._hue=Math.max(0,Math.min(360,t)),e._saturation=Math.max(0,Math.min(100,n)),e._value=Math.max(0,Math.min(100,i)),e.doOnChange()};if(-1!==t.indexOf("hsl")){var i=t.replace(/hsla|hsl|\(|\)/gm,"").split(/\s|,/g).filter(function(t){return""!==t}).map(function(t,e){return e>2?parseFloat(t):parseInt(t,10)});if(4===i.length?this._alpha=Math.floor(100*parseFloat(i[3])):3===i.length&&(this._alpha=100),i.length>=3){var r=function(t,e,n){n/=100;var i=e/=100,r=Math.max(n,.01);return e*=(n*=2)<=1?n:2-n,i*=r<=1?r:2-r,{h:t,s:100*(0===n?2*i/(r+i):2*e/(n+e)),v:(n+e)/2*100}}(i[0],i[1],i[2]);n(r.h,r.s,r.v)}}else if(-1!==t.indexOf("hsv")){var o=t.replace(/hsva|hsv|\(|\)/gm,"").split(/\s|,/g).filter(function(t){return""!==t}).map(function(t,e){return e>2?parseFloat(t):parseInt(t,10)});4===o.length?this._alpha=Math.floor(100*parseFloat(o[3])):3===o.length&&(this._alpha=100),o.length>=3&&n(o[0],o[1],o[2])}else if(-1!==t.indexOf("rgb")){var s=t.replace(/rgba|rgb|\(|\)/gm,"").split(/\s|,/g).filter(function(t){return""!==t}).map(function(t,e){return e>2?parseFloat(t):parseInt(t,10)});if(4===s.length?this._alpha=Math.floor(100*parseFloat(s[3])):3===s.length&&(this._alpha=100),s.length>=3){var a=Ml(s[0],s[1],s[2]);n(a.h,a.s,a.v)}}else if(-1!==t.indexOf("#")){var l=t.replace("#","").trim();if(!/^(?:[0-9a-fA-F]{3}){1,2}|[0-9a-fA-F]{8}$/.test(l))return;var u=void 0,c=void 0,h=void 0;3===l.length?(u=Al(l[0]+l[0]),c=Al(l[1]+l[1]),h=Al(l[2]+l[2])):6!==l.length&&8!==l.length||(u=Al(l.substring(0,2)),c=Al(l.substring(2,4)),h=Al(l.substring(4,6))),8===l.length?this._alpha=Math.floor(Al(l.substring(6))/255*100):3!==l.length&&6!==l.length||(this._alpha=100);var p=Ml(u,c,h);n(p.h,p.s,p.v)}},t.prototype.compare=function(t){return Math.abs(t._hue-this._hue)<2&&Math.abs(t._saturation-this._saturation)<1&&Math.abs(t._value-this._value)<1&&Math.abs(t._alpha-this._alpha)<1},t.prototype.doOnChange=function(){var t=this._hue,e=this._saturation,n=this._value,i=this._alpha,r=this.format;if(this.enableAlpha)switch(r){case"hsl":var o=Il(t,e/100,n/100);this.value="hsla("+t+", "+Math.round(100*o[1])+"%, "+Math.round(100*o[2])+"%, "+i/100+")";break;case"hsv":this.value="hsva("+t+", "+Math.round(e)+"%, "+Math.round(n)+"%, "+i/100+")";break;default:var s=Nl(t,e,n),a=s.r,l=s.g,u=s.b;this.value="rgba("+a+", "+l+", "+u+", "+i/100+")"}else switch(r){case"hsl":var c=Il(t,e/100,n/100);this.value="hsl("+t+", "+Math.round(100*c[1])+"%, "+Math.round(100*c[2])+"%)";break;case"hsv":this.value="hsv("+t+", "+Math.round(e)+"%, "+Math.round(n)+"%)";break;case"rgb":var h=Nl(t,e,n),p=h.r,d=h.g,f=h.b;this.value="rgb("+p+", "+d+", "+f+")";break;default:this.value=function(t){var e=t.r,n=t.g,i=t.b,r=function(t){t=Math.min(Math.round(t),255);var e=Math.floor(t/16),n=t%16;return""+(Ol[e]||e)+(Ol[n]||n)};return isNaN(e)||isNaN(n)||isNaN(i)?"":"#"+r(e)+r(n)+r(i)}(Nl(t,e,n))}},t}(),Pl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-zoom-in-top"},on:{"after-leave":t.doDestroy}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.showPopper,expression:"showPopper"}],staticClass:"el-color-dropdown"},[n("div",{staticClass:"el-color-dropdown__main-wrapper"},[n("hue-slider",{ref:"hue",staticStyle:{float:"right"},attrs:{color:t.color,vertical:""}}),n("sv-panel",{ref:"sl",attrs:{color:t.color}})],1),t.showAlpha?n("alpha-slider",{ref:"alpha",attrs:{color:t.color}}):t._e(),t.predefine?n("predefine",{attrs:{color:t.color,colors:t.predefine}}):t._e(),n("div",{staticClass:"el-color-dropdown__btns"},[n("span",{staticClass:"el-color-dropdown__value"},[n("el-input",{attrs:{"validate-event":!1,size:"mini"},on:{blur:t.handleConfirm},nativeOn:{keyup:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.handleConfirm(e):null}},model:{value:t.customInput,callback:function(e){t.customInput=e},expression:"customInput"}})],1),n("el-button",{staticClass:"el-color-dropdown__link-btn",attrs:{size:"mini",type:"text"},on:{click:function(e){t.$emit("clear")}}},[t._v("\n "+t._s(t.t("el.colorpicker.clear"))+"\n ")]),n("el-button",{staticClass:"el-color-dropdown__btn",attrs:{plain:"",size:"mini"},on:{click:t.confirmValue}},[t._v("\n "+t._s(t.t("el.colorpicker.confirm"))+"\n ")])],1)],1)])};Pl._withStripped=!0;var Bl=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"el-color-svpanel",style:{backgroundColor:this.background}},[e("div",{staticClass:"el-color-svpanel__white"}),e("div",{staticClass:"el-color-svpanel__black"}),e("div",{staticClass:"el-color-svpanel__cursor",style:{top:this.cursorTop+"px",left:this.cursorLeft+"px"}},[e("div")])])};Bl._withStripped=!0;var Fl=!1,Ul=function(t,e){if(!hn.a.prototype.$isServer){var n=function(t){e.drag&&e.drag(t)},i=function t(i){document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t),document.onselectstart=null,document.ondragstart=null,Fl=!1,e.end&&e.end(i)};t.addEventListener("mousedown",function(t){Fl||(document.onselectstart=function(){return!1},document.ondragstart=function(){return!1},document.addEventListener("mousemove",n),document.addEventListener("mouseup",i),Fl=!0,e.start&&e.start(t))})}},Vl=r({name:"el-sl-panel",props:{color:{required:!0}},computed:{colorValue:function(){return{hue:this.color.get("hue"),value:this.color.get("value")}}},watch:{colorValue:function(){this.update()}},methods:{update:function(){var t=this.color.get("saturation"),e=this.color.get("value"),n=this.$el,i=n.clientWidth,r=n.clientHeight;this.cursorLeft=t*i/100,this.cursorTop=(100-e)*r/100,this.background="hsl("+this.color.get("hue")+", 100%, 50%)"},handleDrag:function(t){var e=this.$el.getBoundingClientRect(),n=t.clientX-e.left,i=t.clientY-e.top;n=Math.max(0,n),n=Math.min(n,e.width),i=Math.max(0,i),i=Math.min(i,e.height),this.cursorLeft=n,this.cursorTop=i,this.color.set({saturation:n/e.width*100,value:100-i/e.height*100})}},mounted:function(){var t=this;Ul(this.$el,{drag:function(e){t.handleDrag(e)},end:function(e){t.handleDrag(e)}}),this.update()},data:function(){return{cursorTop:0,cursorLeft:0,background:"hsl(0, 100%, 50%)"}}},Bl,[],!1,null,null,null);Vl.options.__file="packages/color-picker/src/components/sv-panel.vue";var Hl=Vl.exports,Wl=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"el-color-hue-slider",class:{"is-vertical":this.vertical}},[e("div",{ref:"bar",staticClass:"el-color-hue-slider__bar",on:{click:this.handleClick}}),e("div",{ref:"thumb",staticClass:"el-color-hue-slider__thumb",style:{left:this.thumbLeft+"px",top:this.thumbTop+"px"}})])};Wl._withStripped=!0;var Gl=r({name:"el-color-hue-slider",props:{color:{required:!0},vertical:Boolean},data:function(){return{thumbLeft:0,thumbTop:0}},computed:{hueValue:function(){return this.color.get("hue")}},watch:{hueValue:function(){this.update()}},methods:{handleClick:function(t){var e=this.$refs.thumb;t.target!==e&&this.handleDrag(t)},handleDrag:function(t){var e=this.$el.getBoundingClientRect(),n=this.$refs.thumb,i=void 0;if(this.vertical){var r=t.clientY-e.top;r=Math.min(r,e.height-n.offsetHeight/2),r=Math.max(n.offsetHeight/2,r),i=Math.round((r-n.offsetHeight/2)/(e.height-n.offsetHeight)*360)}else{var o=t.clientX-e.left;o=Math.min(o,e.width-n.offsetWidth/2),o=Math.max(n.offsetWidth/2,o),i=Math.round((o-n.offsetWidth/2)/(e.width-n.offsetWidth)*360)}this.color.set("hue",i)},getThumbLeft:function(){if(this.vertical)return 0;var t=this.$el,e=this.color.get("hue");if(!t)return 0;var n=this.$refs.thumb;return Math.round(e*(t.offsetWidth-n.offsetWidth/2)/360)},getThumbTop:function(){if(!this.vertical)return 0;var t=this.$el,e=this.color.get("hue");if(!t)return 0;var n=this.$refs.thumb;return Math.round(e*(t.offsetHeight-n.offsetHeight/2)/360)},update:function(){this.thumbLeft=this.getThumbLeft(),this.thumbTop=this.getThumbTop()}},mounted:function(){var t=this,e=this.$refs,n=e.bar,i=e.thumb,r={drag:function(e){t.handleDrag(e)},end:function(e){t.handleDrag(e)}};Ul(n,r),Ul(i,r),this.update()}},Wl,[],!1,null,null,null);Gl.options.__file="packages/color-picker/src/components/hue-slider.vue";var jl=Gl.exports,zl=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"el-color-alpha-slider",class:{"is-vertical":this.vertical}},[e("div",{ref:"bar",staticClass:"el-color-alpha-slider__bar",style:{background:this.background},on:{click:this.handleClick}}),e("div",{ref:"thumb",staticClass:"el-color-alpha-slider__thumb",style:{left:this.thumbLeft+"px",top:this.thumbTop+"px"}})])};zl._withStripped=!0;var $l=r({name:"el-color-alpha-slider",props:{color:{required:!0},vertical:Boolean},watch:{"color._alpha":function(){this.update()},"color.value":function(){this.update()}},methods:{handleClick:function(t){var e=this.$refs.thumb;t.target!==e&&this.handleDrag(t)},handleDrag:function(t){var e=this.$el.getBoundingClientRect(),n=this.$refs.thumb;if(this.vertical){var i=t.clientY-e.top;i=Math.max(n.offsetHeight/2,i),i=Math.min(i,e.height-n.offsetHeight/2),this.color.set("alpha",Math.round((i-n.offsetHeight/2)/(e.height-n.offsetHeight)*100))}else{var r=t.clientX-e.left;r=Math.max(n.offsetWidth/2,r),r=Math.min(r,e.width-n.offsetWidth/2),this.color.set("alpha",Math.round((r-n.offsetWidth/2)/(e.width-n.offsetWidth)*100))}},getThumbLeft:function(){if(this.vertical)return 0;var t=this.$el,e=this.color._alpha;if(!t)return 0;var n=this.$refs.thumb;return Math.round(e*(t.offsetWidth-n.offsetWidth/2)/100)},getThumbTop:function(){if(!this.vertical)return 0;var t=this.$el,e=this.color._alpha;if(!t)return 0;var n=this.$refs.thumb;return Math.round(e*(t.offsetHeight-n.offsetHeight/2)/100)},getBackground:function(){if(this.color&&this.color.value){var t=this.color.toRgb(),e=t.r,n=t.g,i=t.b;return"linear-gradient(to right, rgba("+e+", "+n+", "+i+", 0) 0%, rgba("+e+", "+n+", "+i+", 1) 100%)"}return null},update:function(){this.thumbLeft=this.getThumbLeft(),this.thumbTop=this.getThumbTop(),this.background=this.getBackground()}},data:function(){return{thumbLeft:0,thumbTop:0,background:null}},mounted:function(){var t=this,e=this.$refs,n=e.bar,i=e.thumb,r={drag:function(e){t.handleDrag(e)},end:function(e){t.handleDrag(e)}};Ul(n,r),Ul(i,r),this.update()}},zl,[],!1,null,null,null);$l.options.__file="packages/color-picker/src/components/alpha-slider.vue";var Xl=$l.exports,Yl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-color-predefine"},[n("div",{staticClass:"el-color-predefine__colors"},t._l(t.rgbaColors,function(e,i){return n("div",{key:t.colors[i],staticClass:"el-color-predefine__color-selector",class:{selected:e.selected,"is-alpha":e._alpha<100},on:{click:function(e){t.handleSelect(i)}}},[n("div",{style:{"background-color":e.value}})])}),0)])};Yl._withStripped=!0;var Kl=r({props:{colors:{type:Array,required:!0},color:{required:!0}},data:function(){return{rgbaColors:this.parseColors(this.colors,this.color)}},methods:{handleSelect:function(t){this.color.fromString(this.colors[t])},parseColors:function(t,e){return t.map(function(t){var n=new Ll;return n.enableAlpha=!0,n.format="rgba",n.fromString(t),n.selected=n.value===e.value,n})}},watch:{"$parent.currentColor":function(t){var e=new Ll;e.fromString(t),this.rgbaColors.forEach(function(t){t.selected=e.compare(t)})},colors:function(t){this.rgbaColors=this.parseColors(t,this.color)},color:function(t){this.rgbaColors=this.parseColors(this.colors,t)}}},Yl,[],!1,null,null,null);Kl.options.__file="packages/color-picker/src/components/predefine.vue";var Jl=Kl.exports,ql=r({name:"el-color-picker-dropdown",mixins:[L.a,f.a],components:{SvPanel:Hl,HueSlider:jl,AlphaSlider:Xl,ElInput:p.a,ElButton:$.a,Predefine:Jl},props:{color:{required:!0},showAlpha:Boolean,predefine:Array},data:function(){return{customInput:""}},computed:{currentColor:function(){var t=this.$parent;return t.value||t.showPanelColor?t.color.value:""}},methods:{confirmValue:function(){this.$emit("pick")},handleConfirm:function(){this.color.fromString(this.customInput)}},mounted:function(){this.$parent.popperElm=this.popperElm=this.$el,this.referenceElm=this.$parent.$el},watch:{showPopper:function(t){var e=this;!0===t&&this.$nextTick(function(){var t=e.$refs,n=t.sl,i=t.hue,r=t.alpha;n&&n.update(),i&&i.update(),r&&r.update()})},currentColor:{immediate:!0,handler:function(t){this.customInput=t}}}},Pl,[],!1,null,null,null);ql.options.__file="packages/color-picker/src/components/picker-dropdown.vue";var Zl=ql.exports,Ql=r({name:"ElColorPicker",mixins:[S.a],props:{value:String,showAlpha:Boolean,colorFormat:String,disabled:Boolean,size:String,popperClass:String,predefine:Array},inject:{elForm:{default:""},elFormItem:{default:""}},directives:{Clickoutside:A.a},computed:{displayedColor:function(){return this.value||this.showPanelColor?this.displayedRgb(this.color,this.showAlpha):"transparent"},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},colorSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},colorDisabled:function(){return this.disabled||(this.elForm||{}).disabled}},watch:{value:function(t){t?t&&t!==this.color.value&&this.color.fromString(t):this.showPanelColor=!1},color:{deep:!0,handler:function(){this.showPanelColor=!0}},displayedColor:function(t){if(this.showPicker){var e=new Ll({enableAlpha:this.showAlpha,format:this.colorFormat});e.fromString(this.value),t!==this.displayedRgb(e,this.showAlpha)&&this.$emit("active-change",t)}}},methods:{handleTrigger:function(){this.colorDisabled||(this.showPicker=!this.showPicker)},confirmValue:function(){var t=this.color.value;this.$emit("input",t),this.$emit("change",t),this.dispatch("ElFormItem","el.form.change",t),this.showPicker=!1},clearValue:function(){this.$emit("input",null),this.$emit("change",null),null!==this.value&&this.dispatch("ElFormItem","el.form.change",null),this.showPanelColor=!1,this.showPicker=!1,this.resetColor()},hide:function(){this.showPicker=!1,this.resetColor()},resetColor:function(){var t=this;this.$nextTick(function(e){t.value?t.color.fromString(t.value):t.showPanelColor=!1})},displayedRgb:function(t,e){if(!(t instanceof Ll))throw Error("color should be instance of Color Class");var n=t.toRgb(),i=n.r,r=n.g,o=n.b;return e?"rgba("+i+", "+r+", "+o+", "+t.get("alpha")/100+")":"rgb("+i+", "+r+", "+o+")"}},mounted:function(){var t=this.value;t&&this.color.fromString(t),this.popperElm=this.$refs.dropdown.$el},data:function(){return{color:new Ll({enableAlpha:this.showAlpha,format:this.colorFormat}),showPicker:!1,showPanelColor:!1}},components:{PickerDropdown:Zl}},kl,[],!1,null,null,null);Ql.options.__file="packages/color-picker/src/main.vue";var tu=Ql.exports;tu.install=function(t){t.component(tu.name,tu)};var eu=tu,nu=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-transfer"},[n("transfer-panel",t._b({ref:"leftPanel",attrs:{data:t.sourceData,title:t.titles[0]||t.t("el.transfer.titles.0"),"default-checked":t.leftDefaultChecked,placeholder:t.filterPlaceholder||t.t("el.transfer.filterPlaceholder")},on:{"checked-change":t.onSourceCheckedChange}},"transfer-panel",t.$props,!1),[t._t("left-footer")],2),n("div",{staticClass:"el-transfer__buttons"},[n("el-button",{class:["el-transfer__button",t.hasButtonTexts?"is-with-texts":""],attrs:{type:"primary",disabled:0===t.rightChecked.length},nativeOn:{click:function(e){return t.addToLeft(e)}}},[n("i",{staticClass:"el-icon-arrow-left"}),void 0!==t.buttonTexts[0]?n("span",[t._v(t._s(t.buttonTexts[0]))]):t._e()]),n("el-button",{class:["el-transfer__button",t.hasButtonTexts?"is-with-texts":""],attrs:{type:"primary",disabled:0===t.leftChecked.length},nativeOn:{click:function(e){return t.addToRight(e)}}},[void 0!==t.buttonTexts[1]?n("span",[t._v(t._s(t.buttonTexts[1]))]):t._e(),n("i",{staticClass:"el-icon-arrow-right"})])],1),n("transfer-panel",t._b({ref:"rightPanel",attrs:{data:t.targetData,title:t.titles[1]||t.t("el.transfer.titles.1"),"default-checked":t.rightDefaultChecked,placeholder:t.filterPlaceholder||t.t("el.transfer.filterPlaceholder")},on:{"checked-change":t.onTargetCheckedChange}},"transfer-panel",t.$props,!1),[t._t("right-footer")],2)],1)};nu._withStripped=!0;var iu=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-transfer-panel"},[n("p",{staticClass:"el-transfer-panel__header"},[n("el-checkbox",{attrs:{indeterminate:t.isIndeterminate},on:{change:t.handleAllCheckedChange},model:{value:t.allChecked,callback:function(e){t.allChecked=e},expression:"allChecked"}},[t._v("\n "+t._s(t.title)+"\n "),n("span",[t._v(t._s(t.checkedSummary))])])],1),n("div",{class:["el-transfer-panel__body",t.hasFooter?"is-with-footer":""]},[t.filterable?n("el-input",{staticClass:"el-transfer-panel__filter",attrs:{size:"small",placeholder:t.placeholder},nativeOn:{mouseenter:function(e){t.inputHover=!0},mouseleave:function(e){t.inputHover=!1}},model:{value:t.query,callback:function(e){t.query=e},expression:"query"}},[n("i",{class:["el-input__icon","el-icon-"+t.inputIcon],attrs:{slot:"prefix"},on:{click:t.clearQuery},slot:"prefix"})]):t._e(),n("el-checkbox-group",{directives:[{name:"show",rawName:"v-show",value:!t.hasNoMatch&&t.data.length>0,expression:"!hasNoMatch && data.length > 0"}],staticClass:"el-transfer-panel__list",class:{"is-filterable":t.filterable},model:{value:t.checked,callback:function(e){t.checked=e},expression:"checked"}},t._l(t.filteredData,function(e){return n("el-checkbox",{key:e[t.keyProp],staticClass:"el-transfer-panel__item",attrs:{label:e[t.keyProp],disabled:e[t.disabledProp]}},[n("option-content",{attrs:{option:e}})],1)}),1),n("p",{directives:[{name:"show",rawName:"v-show",value:t.hasNoMatch,expression:"hasNoMatch"}],staticClass:"el-transfer-panel__empty"},[t._v(t._s(t.t("el.transfer.noMatch")))]),n("p",{directives:[{name:"show",rawName:"v-show",value:0===t.data.length&&!t.hasNoMatch,expression:"data.length === 0 && !hasNoMatch"}],staticClass:"el-transfer-panel__empty"},[t._v(t._s(t.t("el.transfer.noData")))])],1),t.hasFooter?n("p",{staticClass:"el-transfer-panel__footer"},[t._t("default")],2):t._e()])};iu._withStripped=!0;var ru=r({mixins:[f.a],name:"ElTransferPanel",componentName:"ElTransferPanel",components:{ElCheckboxGroup:zn.a,ElCheckbox:rn.a,ElInput:p.a,OptionContent:{props:{option:Object},render:function(t){var e=function t(e){return"ElTransferPanel"===e.$options.componentName?e:e.$parent?t(e.$parent):e}(this),n=e.$parent||e;return e.renderContent?e.renderContent(t,this.option):n.$scopedSlots.default?n.$scopedSlots.default({option:this.option}):t("span",[this.option[e.labelProp]||this.option[e.keyProp]])}}},props:{data:{type:Array,default:function(){return[]}},renderContent:Function,placeholder:String,title:String,filterable:Boolean,format:Object,filterMethod:Function,defaultChecked:Array,props:Object},data:function(){return{checked:[],allChecked:!1,query:"",inputHover:!1,checkChangeByUser:!0}},watch:{checked:function(t,e){if(this.updateAllChecked(),this.checkChangeByUser){var n=t.concat(e).filter(function(n){return-1===t.indexOf(n)||-1===e.indexOf(n)});this.$emit("checked-change",t,n)}else this.$emit("checked-change",t),this.checkChangeByUser=!0},data:function(){var t=this,e=[],n=this.filteredData.map(function(e){return e[t.keyProp]});this.checked.forEach(function(t){n.indexOf(t)>-1&&e.push(t)}),this.checkChangeByUser=!1,this.checked=e},checkableData:function(){this.updateAllChecked()},defaultChecked:{immediate:!0,handler:function(t,e){var n=this;if(!e||t.length!==e.length||!t.every(function(t){return e.indexOf(t)>-1})){var i=[],r=this.checkableData.map(function(t){return t[n.keyProp]});t.forEach(function(t){r.indexOf(t)>-1&&i.push(t)}),this.checkChangeByUser=!1,this.checked=i}}}},computed:{filteredData:function(){var t=this;return this.data.filter(function(e){return"function"==typeof t.filterMethod?t.filterMethod(t.query,e):(e[t.labelProp]||e[t.keyProp].toString()).toLowerCase().indexOf(t.query.toLowerCase())>-1})},checkableData:function(){var t=this;return this.filteredData.filter(function(e){return!e[t.disabledProp]})},checkedSummary:function(){var t=this.checked.length,e=this.data.length,n=this.format,i=n.noChecked,r=n.hasChecked;return i&&r?t>0?r.replace(/\${checked}/g,t).replace(/\${total}/g,e):i.replace(/\${total}/g,e):t+"/"+e},isIndeterminate:function(){var t=this.checked.length;return t>0&&t<this.checkableData.length},hasNoMatch:function(){return this.query.length>0&&0===this.filteredData.length},inputIcon:function(){return this.query.length>0&&this.inputHover?"circle-close":"search"},labelProp:function(){return this.props.label||"label"},keyProp:function(){return this.props.key||"key"},disabledProp:function(){return this.props.disabled||"disabled"},hasFooter:function(){return!!this.$slots.default}},methods:{updateAllChecked:function(){var t=this,e=this.checkableData.map(function(e){return e[t.keyProp]});this.allChecked=e.length>0&&e.every(function(e){return t.checked.indexOf(e)>-1})},handleAllCheckedChange:function(t){var e=this;this.checked=t?this.checkableData.map(function(t){return t[e.keyProp]}):[]},clearQuery:function(){"circle-close"===this.inputIcon&&(this.query="")}}},iu,[],!1,null,null,null);ru.options.__file="packages/transfer/src/transfer-panel.vue";var ou=ru.exports,su=r({name:"ElTransfer",mixins:[S.a,f.a,E.a],components:{TransferPanel:ou,ElButton:$.a},props:{data:{type:Array,default:function(){return[]}},titles:{type:Array,default:function(){return[]}},buttonTexts:{type:Array,default:function(){return[]}},filterPlaceholder:{type:String,default:""},filterMethod:Function,leftDefaultChecked:{type:Array,default:function(){return[]}},rightDefaultChecked:{type:Array,default:function(){return[]}},renderContent:Function,value:{type:Array,default:function(){return[]}},format:{type:Object,default:function(){return{}}},filterable:Boolean,props:{type:Object,default:function(){return{label:"label",key:"key",disabled:"disabled"}}},targetOrder:{type:String,default:"original"}},data:function(){return{leftChecked:[],rightChecked:[]}},computed:{dataObj:function(){var t=this.props.key;return this.data.reduce(function(e,n){return(e[n[t]]=n)&&e},{})},sourceData:function(){var t=this;return this.data.filter(function(e){return-1===t.value.indexOf(e[t.props.key])})},targetData:function(){var t=this;return"original"===this.targetOrder?this.data.filter(function(e){return t.value.indexOf(e[t.props.key])>-1}):this.value.reduce(function(e,n){var i=t.dataObj[n];return i&&e.push(i),e},[])},hasButtonTexts:function(){return 2===this.buttonTexts.length}},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",t)}},methods:{getMigratingConfig:function(){return{props:{"footer-format":"footer-format is renamed to format."}}},onSourceCheckedChange:function(t,e){this.leftChecked=t,void 0!==e&&this.$emit("left-check-change",t,e)},onTargetCheckedChange:function(t,e){this.rightChecked=t,void 0!==e&&this.$emit("right-check-change",t,e)},addToLeft:function(){var t=this.value.slice();this.rightChecked.forEach(function(e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}),this.$emit("input",t),this.$emit("change",t,"left",this.rightChecked)},addToRight:function(){var t=this,e=this.value.slice(),n=[],i=this.props.key;this.data.forEach(function(e){var r=e[i];t.leftChecked.indexOf(r)>-1&&-1===t.value.indexOf(r)&&n.push(r)}),e="unshift"===this.targetOrder?n.concat(e):e.concat(n),this.$emit("input",e),this.$emit("change",e,"right",this.leftChecked)},clearQuery:function(t){"left"===t?this.$refs.leftPanel.query="":"right"===t&&(this.$refs.rightPanel.query="")}}},nu,[],!1,null,null,null);su.options.__file="packages/transfer/src/main.vue";var au=su.exports;au.install=function(t){t.component(au.name,au)};var lu=au,uu=function(){var t=this.$createElement;return(this._self._c||t)("section",{staticClass:"el-container",class:{"is-vertical":this.isVertical}},[this._t("default")],2)};uu._withStripped=!0;var cu=r({name:"ElContainer",componentName:"ElContainer",props:{direction:String},computed:{isVertical:function(){return"vertical"===this.direction||"horizontal"!==this.direction&&(!(!this.$slots||!this.$slots.default)&&this.$slots.default.some(function(t){var e=t.componentOptions&&t.componentOptions.tag;return"el-header"===e||"el-footer"===e}))}}},uu,[],!1,null,null,null);cu.options.__file="packages/container/src/main.vue";var hu=cu.exports;hu.install=function(t){t.component(hu.name,hu)};var pu=hu,du=function(){var t=this.$createElement;return(this._self._c||t)("header",{staticClass:"el-header",style:{height:this.height}},[this._t("default")],2)};du._withStripped=!0;var fu=r({name:"ElHeader",componentName:"ElHeader",props:{height:{type:String,default:"60px"}}},du,[],!1,null,null,null);fu.options.__file="packages/header/src/main.vue";var gu=fu.exports;gu.install=function(t){t.component(gu.name,gu)};var mu=gu,vu=function(){var t=this.$createElement;return(this._self._c||t)("aside",{staticClass:"el-aside",style:{width:this.width}},[this._t("default")],2)};vu._withStripped=!0;var _u=r({name:"ElAside",componentName:"ElAside",props:{width:{type:String,default:"300px"}}},vu,[],!1,null,null,null);_u.options.__file="packages/aside/src/main.vue";var yu=_u.exports;yu.install=function(t){t.component(yu.name,yu)};var bu=yu,Tu=function(){var t=this.$createElement;return(this._self._c||t)("main",{staticClass:"el-main"},[this._t("default")],2)};Tu._withStripped=!0;var Eu=r({name:"ElMain",componentName:"ElMain"},Tu,[],!1,null,null,null);Eu.options.__file="packages/main/src/main.vue";var Cu=Eu.exports;Cu.install=function(t){t.component(Cu.name,Cu)};var Su=Cu,wu=function(){var t=this.$createElement;return(this._self._c||t)("footer",{staticClass:"el-footer",style:{height:this.height}},[this._t("default")],2)};wu._withStripped=!0;var ku=r({name:"ElFooter",componentName:"ElFooter",props:{height:{type:String,default:"60px"}}},wu,[],!1,null,null,null);ku.options.__file="packages/footer/src/main.vue";var xu=ku.exports;xu.install=function(t){t.component(xu.name,xu)};var Iu=xu,Ru=r({name:"ElTimeline",props:{reverse:{type:Boolean,default:!1}},provide:function(){return{timeline:this}},render:function(){var t=arguments[0],e=this.reverse,n={"el-timeline":!0,"is-reverse":e},i=this.$slots.default||[];return e&&(i=i.reverse()),t("ul",{class:n},[i])}},void 0,void 0,!1,null,null,null);Ru.options.__file="packages/timeline/src/main.vue";var Ou=Ru.exports;Ou.install=function(t){t.component(Ou.name,Ou)};var Du=Ou,Au=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("li",{staticClass:"el-timeline-item"},[n("div",{staticClass:"el-timeline-item__tail"}),t.$slots.dot?t._e():n("div",{staticClass:"el-timeline-item__node",class:["el-timeline-item__node--"+(t.size||""),"el-timeline-item__node--"+(t.type||"")],style:{backgroundColor:t.color}},[t.icon?n("i",{staticClass:"el-timeline-item__icon",class:t.icon}):t._e()]),t.$slots.dot?n("div",{staticClass:"el-timeline-item__dot"},[t._t("dot")],2):t._e(),n("div",{staticClass:"el-timeline-item__wrapper"},[t.hideTimestamp||"top"!==t.placement?t._e():n("div",{staticClass:"el-timeline-item__timestamp is-top"},[t._v("\n "+t._s(t.timestamp)+"\n ")]),n("div",{staticClass:"el-timeline-item__content"},[t._t("default")],2),t.hideTimestamp||"bottom"!==t.placement?t._e():n("div",{staticClass:"el-timeline-item__timestamp is-bottom"},[t._v("\n "+t._s(t.timestamp)+"\n ")])])])};Au._withStripped=!0;var Mu=r({name:"ElTimelineItem",inject:["timeline"],props:{timestamp:String,hideTimestamp:{type:Boolean,default:!1},placement:{type:String,default:"bottom"},type:String,color:String,size:{type:String,default:"normal"},icon:String}},Au,[],!1,null,null,null);Mu.options.__file="packages/timeline/src/item.vue";var Nu=Mu.exports;Nu.install=function(t){t.component(Nu.name,Nu)};var Lu=Nu,Pu=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a",t._b({class:["el-link",t.type?"el-link--"+t.type:"",t.disabled&&"is-disabled",t.underline&&!t.disabled&&"is-underline"],attrs:{href:t.disabled?null:t.href},on:{click:t.handleClick}},"a",t.$attrs,!1),[t.icon?n("i",{class:t.icon}):t._e(),t.$slots.default?n("span",{staticClass:"el-link--inner"},[t._t("default")],2):t._e(),t.$slots.icon?[t.$slots.icon?t._t("icon"):t._e()]:t._e()],2)};Pu._withStripped=!0;var Bu=r({name:"ElLink",props:{type:{type:String,default:"default"},underline:{type:Boolean,default:!0},disabled:Boolean,href:String,icon:String},methods:{handleClick:function(t){this.disabled||this.href||this.$emit("click",t)}}},Pu,[],!1,null,null,null);Bu.options.__file="packages/link/src/main.vue";var Fu=Bu.exports;Fu.install=function(t){t.component(Fu.name,Fu)};var Uu=Fu,Vu=function(t,e){var n=e._c;return n("div",e._g(e._b({class:[e.data.staticClass,"el-divider","el-divider--"+e.props.direction]},"div",e.data.attrs,!1),e.listeners),[e.slots().default&&"vertical"!==e.props.direction?n("div",{class:["el-divider__text","is-"+e.props.contentPosition]},[e._t("default")],2):e._e()])};Vu._withStripped=!0;var Hu=r({name:"ElDivider",props:{direction:{type:String,default:"horizontal",validator:function(t){return-1!==["horizontal","vertical"].indexOf(t)}},contentPosition:{type:String,default:"center",validator:function(t){return-1!==["left","center","right"].indexOf(t)}}}},Vu,[],!0,null,null,null);Hu.options.__file="packages/divider/src/main.vue";var Wu=Hu.exports;Wu.install=function(t){t.component(Wu.name,Wu)};var Gu=Wu,ju=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-image"},[t.loading?t._t("placeholder",[n("div",{staticClass:"el-image__placeholder"})]):t.error?t._t("error",[n("div",{staticClass:"el-image__error"},[t._v(t._s(t.t("el.image.error")))])]):n("img",t._g(t._b({staticClass:"el-image__inner",class:{"el-image__inner--center":t.alignCenter,"el-image__preview":t.preview},style:t.imageStyle,attrs:{src:t.src},on:{click:t.clickHandler}},"img",t.$attrs,!1),t.$listeners)),t.preview?[t.showViewer?n("image-viewer",{attrs:{"z-index":t.zIndex,"initial-index":t.imageIndex,"on-close":t.closeViewer,"url-list":t.previewSrcList}}):t._e()]:t._e()],2)};ju._withStripped=!0;var zu=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"viewer-fade"}},[n("div",{ref:"el-image-viewer__wrapper",staticClass:"el-image-viewer__wrapper",style:{"z-index":t.viewerZIndex},attrs:{tabindex:"-1"}},[n("div",{staticClass:"el-image-viewer__mask",on:{click:function(e){return e.target!==e.currentTarget?null:t.handleMaskClick(e)}}}),n("span",{staticClass:"el-image-viewer__btn el-image-viewer__close",on:{click:t.hide}},[n("i",{staticClass:"el-icon-close"})]),t.isSingle?t._e():[n("span",{staticClass:"el-image-viewer__btn el-image-viewer__prev",class:{"is-disabled":!t.infinite&&t.isFirst},on:{click:t.prev}},[n("i",{staticClass:"el-icon-arrow-left"})]),n("span",{staticClass:"el-image-viewer__btn el-image-viewer__next",class:{"is-disabled":!t.infinite&&t.isLast},on:{click:t.next}},[n("i",{staticClass:"el-icon-arrow-right"})])],n("div",{staticClass:"el-image-viewer__btn el-image-viewer__actions"},[n("div",{staticClass:"el-image-viewer__actions__inner"},[n("i",{staticClass:"el-icon-zoom-out",on:{click:function(e){t.handleActions("zoomOut")}}}),n("i",{staticClass:"el-icon-zoom-in",on:{click:function(e){t.handleActions("zoomIn")}}}),n("i",{staticClass:"el-image-viewer__actions__divider"}),n("i",{class:t.mode.icon,on:{click:t.toggleMode}}),n("i",{staticClass:"el-image-viewer__actions__divider"}),n("i",{staticClass:"el-icon-refresh-left",on:{click:function(e){t.handleActions("anticlocelise")}}}),n("i",{staticClass:"el-icon-refresh-right",on:{click:function(e){t.handleActions("clocelise")}}})])]),n("div",{staticClass:"el-image-viewer__canvas"},t._l(t.urlList,function(e,i){return i===t.index?n("img",{key:e,ref:"img",refInFor:!0,staticClass:"el-image-viewer__img",style:t.imgStyle,attrs:{src:t.currentImg},on:{load:t.handleImgLoad,error:t.handleImgError,mousedown:t.handleMouseDown}}):t._e()}),0)],2)])};zu._withStripped=!0;var $u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Xu={CONTAIN:{name:"contain",icon:"el-icon-full-screen"},ORIGINAL:{name:"original",icon:"el-icon-c-scale-to-original"}},Yu=Object(g.isFirefox)()?"DOMMouseScroll":"mousewheel",Ku=r({name:"elImageViewer",props:{urlList:{type:Array,default:function(){return[]}},zIndex:{type:Number,default:2e3},onSwitch:{type:Function,default:function(){}},onClose:{type:Function,default:function(){}},initialIndex:{type:Number,default:0},appendToBody:{type:Boolean,default:!0},maskClosable:{type:Boolean,default:!0}},data:function(){return{index:this.initialIndex,isShow:!1,infinite:!0,loading:!1,mode:Xu.CONTAIN,transform:{scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}}},computed:{isSingle:function(){return this.urlList.length<=1},isFirst:function(){return 0===this.index},isLast:function(){return this.index===this.urlList.length-1},currentImg:function(){return this.urlList[this.index]},imgStyle:function(){var t=this.transform,e=t.scale,n=t.deg,i=t.offsetX,r=t.offsetY,o={transform:"scale("+e+") rotate("+n+"deg)",transition:t.enableTransition?"transform .3s":"","margin-left":i+"px","margin-top":r+"px"};return this.mode===Xu.CONTAIN&&(o.maxWidth=o.maxHeight="100%"),o},viewerZIndex:function(){var t=y.PopupManager.nextZIndex();return this.zIndex>t?this.zIndex:t}},watch:{index:{handler:function(t){this.reset(),this.onSwitch(t)}},currentImg:function(t){var e=this;this.$nextTick(function(t){e.$refs.img[0].complete||(e.loading=!0)})}},methods:{hide:function(){this.deviceSupportUninstall(),this.onClose()},deviceSupportInstall:function(){var t=this;this._keyDownHandler=function(e){switch(e.stopPropagation(),e.keyCode){case 27:t.hide();break;case 32:t.toggleMode();break;case 37:t.prev();break;case 38:t.handleActions("zoomIn");break;case 39:t.next();break;case 40:t.handleActions("zoomOut")}},this._mouseWheelHandler=Object(g.rafThrottle)(function(e){(e.wheelDelta?e.wheelDelta:-e.detail)>0?t.handleActions("zoomIn",{zoomRate:.015,enableTransition:!1}):t.handleActions("zoomOut",{zoomRate:.015,enableTransition:!1})}),Object(ft.on)(document,"keydown",this._keyDownHandler),Object(ft.on)(document,Yu,this._mouseWheelHandler)},deviceSupportUninstall:function(){Object(ft.off)(document,"keydown",this._keyDownHandler),Object(ft.off)(document,Yu,this._mouseWheelHandler),this._keyDownHandler=null,this._mouseWheelHandler=null},handleImgLoad:function(t){this.loading=!1},handleImgError:function(t){this.loading=!1,t.target.alt="加载失败"},handleMouseDown:function(t){var e=this;if(!this.loading&&0===t.button){var n=this.transform,i=n.offsetX,r=n.offsetY,o=t.pageX,s=t.pageY;this._dragHandler=Object(g.rafThrottle)(function(t){e.transform.offsetX=i+t.pageX-o,e.transform.offsetY=r+t.pageY-s}),Object(ft.on)(document,"mousemove",this._dragHandler),Object(ft.on)(document,"mouseup",function(t){Object(ft.off)(document,"mousemove",e._dragHandler)}),t.preventDefault()}},handleMaskClick:function(){this.maskClosable&&this.hide()},reset:function(){this.transform={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},toggleMode:function(){if(!this.loading){var t=Object.keys(Xu),e=(Object.values(Xu).indexOf(this.mode)+1)%t.length;this.mode=Xu[t[e]],this.reset()}},prev:function(){if(!this.isFirst||this.infinite){var t=this.urlList.length;this.index=(this.index-1+t)%t}},next:function(){if(!this.isLast||this.infinite){var t=this.urlList.length;this.index=(this.index+1)%t}},handleActions:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.loading){var n=$u({zoomRate:.2,rotateDeg:90,enableTransition:!0},e),i=n.zoomRate,r=n.rotateDeg,o=n.enableTransition,s=this.transform;switch(t){case"zoomOut":s.scale>.2&&(s.scale=parseFloat((s.scale-i).toFixed(3)));break;case"zoomIn":s.scale=parseFloat((s.scale+i).toFixed(3));break;case"clocelise":s.deg+=r;break;case"anticlocelise":s.deg-=r}s.enableTransition=o}}},mounted:function(){this.deviceSupportInstall(),this.appendToBody&&document.body.appendChild(this.$el),this.$refs["el-image-viewer__wrapper"].focus()},destroyed:function(){this.appendToBody&&this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}},zu,[],!1,null,null,null);Ku.options.__file="packages/image/src/image-viewer.vue";var Ju=Ku.exports,qu=function(){return void 0!==document.documentElement.style.objectFit},Zu="none",Qu="contain",tc="cover",ec="fill",nc="scale-down",ic="",rc=r({name:"ElImage",mixins:[f.a],inheritAttrs:!1,components:{ImageViewer:Ju},props:{src:String,fit:String,lazy:Boolean,scrollContainer:{},previewSrcList:{type:Array,default:function(){return[]}},zIndex:{type:Number,default:2e3}},data:function(){return{loading:!0,error:!1,show:!this.lazy,imageWidth:0,imageHeight:0,showViewer:!1}},computed:{imageStyle:function(){var t=this.fit;return!this.$isServer&&t?qu()?{"object-fit":t}:this.getImageStyle(t):{}},alignCenter:function(){return!this.$isServer&&!qu()&&this.fit!==ec},preview:function(){var t=this.previewSrcList;return Array.isArray(t)&&t.length>0},imageIndex:function(){var t=0,e=this.previewSrcList.indexOf(this.src);return e>=0&&(t=e),t}},watch:{src:function(t){this.show&&this.loadImage()},show:function(t){t&&this.loadImage()}},mounted:function(){this.lazy?this.addLazyLoadListener():this.loadImage()},beforeDestroy:function(){this.lazy&&this.removeLazyLoadListener()},methods:{loadImage:function(){var t=this;if(!this.$isServer){this.loading=!0,this.error=!1;var e=new Image;e.onload=function(n){return t.handleLoad(n,e)},e.onerror=this.handleError.bind(this),Object.keys(this.$attrs).forEach(function(n){var i=t.$attrs[n];e.setAttribute(n,i)}),e.src=this.src}},handleLoad:function(t,e){this.imageWidth=e.width,this.imageHeight=e.height,this.loading=!1,this.error=!1},handleError:function(t){this.loading=!1,this.error=!0,this.$emit("error",t)},handleLazyLoad:function(){Object(ft.isInContainer)(this.$el,this._scrollContainer)&&(this.show=!0,this.removeLazyLoadListener())},addLazyLoadListener:function(){if(!this.$isServer){var t=this.scrollContainer,e=null;(e=Object(Na.isHtmlElement)(t)?t:Object(Na.isString)(t)?document.querySelector(t):Object(ft.getScrollContainer)(this.$el))&&(this._scrollContainer=e,this._lazyLoadHandler=Ya()(200,this.handleLazyLoad),Object(ft.on)(e,"scroll",this._lazyLoadHandler),this.handleLazyLoad())}},removeLazyLoadListener:function(){var t=this._scrollContainer,e=this._lazyLoadHandler;!this.$isServer&&t&&e&&(Object(ft.off)(t,"scroll",e),this._scrollContainer=null,this._lazyLoadHandler=null)},getImageStyle:function(t){var e=this.imageWidth,n=this.imageHeight,i=this.$el,r=i.clientWidth,o=i.clientHeight;if(!(e&&n&&r&&o))return{};var s=e/n,a=r/o;t===nc&&(t=e<r&&n<o?Zu:Qu);switch(t){case Zu:return{width:"auto",height:"auto"};case Qu:return s<a?{width:"auto"}:{height:"auto"};case tc:return s<a?{height:"auto"}:{width:"auto"};default:return{}}},clickHandler:function(){this.preview&&(ic=document.body.style.overflow,document.body.style.overflow="hidden",this.showViewer=!0)},closeViewer:function(){document.body.style.overflow=ic,this.showViewer=!1}}},ju,[],!1,null,null,null);rc.options.__file="packages/image/src/main.vue";var oc=rc.exports;oc.install=function(t){t.component(oc.name,oc)};var sc=oc,ac=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-calendar"},[n("div",{staticClass:"el-calendar__header"},[n("div",{staticClass:"el-calendar__title"},[t._v("\n "+t._s(t.i18nDate)+"\n ")]),0===t.validatedRange.length?n("div",{staticClass:"el-calendar__button-group"},[n("el-button-group",[n("el-button",{attrs:{type:"plain",size:"mini"},on:{click:function(e){t.selectDate("prev-month")}}},[t._v("\n "+t._s(t.t("el.datepicker.prevMonth"))+"\n ")]),n("el-button",{attrs:{type:"plain",size:"mini"},on:{click:function(e){t.selectDate("today")}}},[t._v("\n "+t._s(t.t("el.datepicker.today"))+"\n ")]),n("el-button",{attrs:{type:"plain",size:"mini"},on:{click:function(e){t.selectDate("next-month")}}},[t._v("\n "+t._s(t.t("el.datepicker.nextMonth"))+"\n ")])],1)],1):t._e()]),0===t.validatedRange.length?n("div",{key:"no-range",staticClass:"el-calendar__body"},[n("date-table",{attrs:{date:t.date,"selected-day":t.realSelectedDay,"first-day-of-week":t.realFirstDayOfWeek},on:{pick:t.pickDay}})],1):n("div",{key:"has-range",staticClass:"el-calendar__body"},t._l(t.validatedRange,function(e,i){return n("date-table",{key:i,attrs:{date:e[0],"selected-day":t.realSelectedDay,range:e,"hide-header":0!==i,"first-day-of-week":t.realFirstDayOfWeek},on:{pick:t.pickDay}})}),1)])};ac._withStripped=!0;var lc=n(20),uc=n.n(lc),cc=r({props:{selectedDay:String,range:{type:Array,validator:function(t){if(!t||!t.length)return!0;var e=t[0],n=t[1];return Object(pi.validateRangeInOneMonth)(e,n)}},date:Date,hideHeader:Boolean,firstDayOfWeek:Number},inject:["elCalendar"],methods:{toNestedArr:function(t){return Object(pi.range)(t.length/7).map(function(e,n){var i=7*n;return t.slice(i,i+7)})},getFormateDate:function(t,e){if(!t||-1===["prev","current","next"].indexOf(e))throw new Error("invalid day or type");var n=this.curMonthDatePrefix;return"prev"===e?n=this.prevMonthDatePrefix:"next"===e&&(n=this.nextMonthDatePrefix),n+"-"+(t=("00"+t).slice(-2))},getCellClass:function(t){var e=t.text,n=t.type,i=[n];if("current"===n){var r=this.getFormateDate(e,n);r===this.selectedDay&&i.push("is-selected"),r===this.formatedToday&&i.push("is-today")}return i},pickDay:function(t){var e=t.text,n=t.type,i=this.getFormateDate(e,n);this.$emit("pick",i)},cellRenderProxy:function(t){var e=t.text,n=t.type,i=this.$createElement,r=this.elCalendar.$scopedSlots.dateCell;if(!r)return i("span",[e]);var o=this.getFormateDate(e,n);return r({date:new Date(o),data:{isSelected:this.selectedDay===o,type:n+"-month",day:o}})}},computed:{WEEK_DAYS:function(){return Object(pi.getI18nSettings)().dayNames},prevMonthDatePrefix:function(){var t=new Date(this.date.getTime());return t.setDate(0),uc.a.format(t,"yyyy-MM")},curMonthDatePrefix:function(){return uc.a.format(this.date,"yyyy-MM")},nextMonthDatePrefix:function(){var t=new Date(this.date.getFullYear(),this.date.getMonth()+1,1);return uc.a.format(t,"yyyy-MM")},formatedToday:function(){return this.elCalendar.formatedToday},isInRange:function(){return this.range&&this.range.length},rows:function(){var t=[];if(this.isInRange){var e=this.range,n=e[0],i=e[1],r=Object(pi.range)(i.getDate()-n.getDate()+1).map(function(t,e){return{text:n.getDate()+e,type:"current"}}),o=r.length%7;o=0===o?0:7-o;var s=Object(pi.range)(o).map(function(t,e){return{text:e+1,type:"next"}});t=r.concat(s)}else{var a=this.date,l=Object(pi.getFirstDayOfMonth)(a),u=(7+(l=0===l?7:l)-("number"==typeof this.firstDayOfWeek?this.firstDayOfWeek:1))%7,c=Object(pi.getPrevMonthLastDays)(a,u).map(function(t){return{text:t,type:"prev"}}),h=Object(pi.getMonthDays)(a).map(function(t){return{text:t,type:"current"}});t=[].concat(c,h);var p=Object(pi.range)(42-t.length).map(function(t,e){return{text:e+1,type:"next"}});t=t.concat(p)}return this.toNestedArr(t)},weekDays:function(){var t=this.firstDayOfWeek,e=this.WEEK_DAYS;return"number"!=typeof t||0===t?e.slice():e.slice(t).concat(e.slice(0,t))}},render:function(){var t=this,e=arguments[0],n=this.hideHeader?null:e("thead",[this.weekDays.map(function(t){return e("th",{key:t},[t])})]);return e("table",{class:{"el-calendar-table":!0,"is-range":this.isInRange},attrs:{cellspacing:"0",cellpadding:"0"}},[n,e("tbody",[this.rows.map(function(n,i){return e("tr",{class:{"el-calendar-table__row":!0,"el-calendar-table__row--hide-border":0===i&&t.hideHeader},key:i},[n.map(function(n,i){return e("td",{key:i,class:t.getCellClass(n),on:{click:t.pickDay.bind(t,n)}},[e("div",{class:"el-calendar-day"},[t.cellRenderProxy(n)])])})])})])])}},void 0,void 0,!1,null,null,null);cc.options.__file="packages/calendar/src/date-table.vue";var hc=cc.exports,pc=["prev-month","today","next-month"],dc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],fc=r({name:"ElCalendar",mixins:[f.a],components:{DateTable:hc,ElButton:$.a,ElButtonGroup:Y.a},props:{value:[Date,String,Number],range:{type:Array,validator:function(t){return!Array.isArray(t)||2===t.length&&t.every(function(t){return"string"==typeof t||"number"==typeof t||t instanceof Date})}},firstDayOfWeek:{type:Number,default:1}},provide:function(){return{elCalendar:this}},methods:{pickDay:function(t){this.realSelectedDay=t},selectDate:function(t){if(-1===pc.indexOf(t))throw new Error("invalid type "+t);var e="";(e="prev-month"===t?this.prevMonthDatePrefix+"-01":"next-month"===t?this.nextMonthDatePrefix+"-01":this.formatedToday)!==this.formatedDate&&this.pickDay(e)},toDate:function(t){if(!t)throw new Error("invalid val");return t instanceof Date?t:new Date(t)},rangeValidator:function(t,e){var n=this.realFirstDayOfWeek,i=e?n:0===n?6:n-1,r=(e?"start":"end")+" of range should be "+dc[i]+".";return t.getDay()===i||(console.warn("[ElementCalendar]",r,"Invalid range will be ignored."),!1)}},computed:{prevMonthDatePrefix:function(){var t=new Date(this.date.getTime());return t.setDate(0),uc.a.format(t,"yyyy-MM")},curMonthDatePrefix:function(){return uc.a.format(this.date,"yyyy-MM")},nextMonthDatePrefix:function(){var t=new Date(this.date.getFullYear(),this.date.getMonth()+1,1);return uc.a.format(t,"yyyy-MM")},formatedDate:function(){return uc.a.format(this.date,"yyyy-MM-dd")},i18nDate:function(){var t=this.date.getFullYear(),e=this.date.getMonth()+1;return t+" "+this.t("el.datepicker.year")+" "+this.t("el.datepicker.month"+e)},formatedToday:function(){return uc.a.format(this.now,"yyyy-MM-dd")},realSelectedDay:{get:function(){return this.value?this.formatedDate:this.selectedDay},set:function(t){this.selectedDay=t;var e=new Date(t);this.$emit("input",e)}},date:function(){if(this.value)return this.toDate(this.value);if(this.realSelectedDay){var t=this.selectedDay.split("-");return new Date(t[0],t[1]-1,t[2])}return this.validatedRange.length?this.validatedRange[0][0]:this.now},validatedRange:function(){var t=this,e=this.range;if(!e)return[];if(2===(e=e.reduce(function(e,n,i){var r=t.toDate(n);return t.rangeValidator(r,0===i)&&(e=e.concat(r)),e},[])).length){var n=e,i=n[0],r=n[1];if(i>r)return console.warn("[ElementCalendar]end time should be greater than start time"),[];if(Object(pi.validateRangeInOneMonth)(i,r))return[[i,r]];var o=[],s=new Date(i.getFullYear(),i.getMonth()+1,1),a=this.toDate(s.getTime()-864e5);if(!Object(pi.validateRangeInOneMonth)(s,r))return console.warn("[ElementCalendar]start time and end time interval must not exceed two months"),[];o.push([i,a]);var l=this.realFirstDayOfWeek,u=s.getDay(),c=0;return u!==l&&(c=0===l?7-u:(c=l-u)>0?c:7+c),(s=this.toDate(s.getTime()+864e5*c)).getDate()<r.getDate()&&o.push([s,r]),o}return[]},realFirstDayOfWeek:function(){return this.firstDayOfWeek<1||this.firstDayOfWeek>6?0:Math.floor(this.firstDayOfWeek)}},data:function(){return{selectedDay:"",now:new Date}}},ac,[],!1,null,null,null);fc.options.__file="packages/calendar/src/main.vue";var gc=fc.exports;gc.install=function(t){t.component(gc.name,gc)};var mc=gc,vc=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-fade-in"}},[t.visible?n("div",{staticClass:"el-backtop",style:{right:t.styleRight,bottom:t.styleBottom},on:{click:function(e){return e.stopPropagation(),t.handleClick(e)}}},[t._t("default",[n("el-icon",{attrs:{name:"caret-top"}})])],2):t._e()])};vc._withStripped=!0;var _c=function(t){return Math.pow(t,3)},yc=r({name:"ElBacktop",props:{visibilityHeight:{type:Number,default:200},target:[String],right:{type:Number,default:40},bottom:{type:Number,default:40}},data:function(){return{el:null,container:null,visible:!1}},computed:{styleBottom:function(){return this.bottom+"px"},styleRight:function(){return this.right+"px"}},mounted:function(){this.init(),this.throttledScrollHandler=Ya()(300,this.onScroll),this.container.addEventListener("scroll",this.throttledScrollHandler)},methods:{init:function(){if(this.container=document,this.el=document.documentElement,this.target){if(this.el=document.querySelector(this.target),!this.el)throw new Error("target is not existed: "+this.target);this.container=this.el}},onScroll:function(){var t=this.el.scrollTop;this.visible=t>=this.visibilityHeight},handleClick:function(t){this.scrollToTop(),this.$emit("click",t)},scrollToTop:function(){var t=this.el,e=Date.now(),n=t.scrollTop,i=window.requestAnimationFrame||function(t){return setTimeout(t,16)};i(function r(){var o,s=(Date.now()-e)/500;s<1?(t.scrollTop=n*(1-((o=s)<.5?_c(2*o)/2:1-_c(2*(1-o))/2)),i(r)):t.scrollTop=0})}},beforeDestroy:function(){this.container.removeEventListener("scroll",this.throttledScrollHandler)}},vc,[],!1,null,null,null);yc.options.__file="packages/backtop/src/main.vue";var bc=yc.exports;bc.install=function(t){t.component(bc.name,bc)};var Tc=bc,Ec=function(t,e){return t===window||t===document?document.documentElement[e]:t[e]},Cc=function(t){return Ec(t,"offsetHeight")},Sc="ElInfiniteScroll",wc={delay:{type:Number,default:200},distance:{type:Number,default:0},disabled:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0}},kc=function(t,e){return Object(Na.isHtmlElement)(t)?(n=wc,Object.keys(n||{}).map(function(t){return[t,n[t]]})).reduce(function(n,i){var r=i[0],o=i[1],s=o.type,a=o.default,l=t.getAttribute("infinite-scroll-"+r);switch(l=Object(Na.isUndefined)(e[l])?l:e[l],s){case Number:l=Number(l),l=Number.isNaN(l)?a:l;break;case Boolean:l=Object(Na.isDefined)(l)?"false"!==l&&Boolean(l):a;break;default:l=s(l)}return n[r]=l,n},{}):{};var n},xc=function(t){return t.getBoundingClientRect().top},Ic=function(t){var e=this[Sc],n=e.el,i=e.vm,r=e.container,o=e.observer,s=kc(n,i),a=s.distance;if(!s.disabled){var l=r.getBoundingClientRect();if(l.width||l.height){var u=!1;if(r===n){var c=r.scrollTop+function(t){return Ec(t,"clientHeight")}(r);u=r.scrollHeight-c<=a}else{u=Cc(n)+xc(n)-xc(r)-Cc(r)+Number.parseFloat(function(t,e){if(t===window&&(t=document.documentElement),1!==t.nodeType)return[];var n=window.getComputedStyle(t,null);return e?n[e]:n}(r,"borderBottomWidth"))<=a}u&&Object(Na.isFunction)(t)?t.call(i):o&&(o.disconnect(),this[Sc].observer=null)}}},Rc={name:"InfiniteScroll",inserted:function(t,e,n){var i=e.value,r=n.context,o=Object(ft.getScrollContainer)(t,!0),s=kc(t,r),a=s.delay,l=s.immediate,u=O()(a,Ic.bind(t,i));(t[Sc]={el:t,vm:r,container:o,onScroll:u},o)&&(o.addEventListener("scroll",u),l&&((t[Sc].observer=new MutationObserver(u)).observe(o,{childList:!0,subtree:!0}),u()))},unbind:function(t){var e=t[Sc],n=e.container,i=e.onScroll;n&&n.removeEventListener("scroll",i)},install:function(t){t.directive(Rc.name,Rc)}},Oc=Rc,Dc=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-page-header"},[n("div",{staticClass:"el-page-header__left",on:{click:function(e){t.$emit("back")}}},[n("i",{staticClass:"el-icon-back"}),n("div",{staticClass:"el-page-header__title"},[t._t("title",[t._v(t._s(t.title))])],2)]),n("div",{staticClass:"el-page-header__content"},[t._t("content",[t._v(t._s(t.content))])],2)])};Dc._withStripped=!0;var Ac=r({name:"ElPageHeader",props:{title:{type:String,default:function(){return Object(Nr.t)("el.pageHeader.title")}},content:String}},Dc,[],!1,null,null,null);Ac.options.__file="packages/page-header/src/main.vue";var Mc=Ac.exports;Mc.install=function(t){t.component(Mc.name,Mc)};var Nc=Mc,Lc=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:["el-cascader-panel",this.border&&"is-bordered"],on:{keydown:this.handleKeyDown}},this._l(this.menus,function(t,n){return e("cascader-menu",{key:n,ref:"menu",refInFor:!0,attrs:{index:n,nodes:t}})}),1)};Lc._withStripped=!0;var Pc=n(43),Bc=n.n(Pc),Fc=function(t){return t.stopPropagation()},Uc=r({inject:["panel"],components:{ElCheckbox:rn.a,ElRadio:Bc.a},props:{node:{required:!0},nodeId:String},computed:{config:function(){return this.panel.config},isLeaf:function(){return this.node.isLeaf},isDisabled:function(){return this.node.isDisabled},checkedValue:function(){return this.panel.checkedValue},isChecked:function(){return this.node.isSameNode(this.checkedValue)},inActivePath:function(){return this.isInPath(this.panel.activePath)},inCheckedPath:function(){var t=this;return!!this.config.checkStrictly&&this.panel.checkedNodePaths.some(function(e){return t.isInPath(e)})},value:function(){return this.node.getValueByOption()}},methods:{handleExpand:function(){var t=this,e=this.panel,n=this.node,i=this.isDisabled,r=this.config,o=r.multiple;!r.checkStrictly&&i||n.loading||(r.lazy&&!n.loaded?e.lazyLoad(n,function(){var e=t.isLeaf;if(e||t.handleExpand(),o){var i=!!e&&n.checked;t.handleMultiCheckChange(i)}}):e.handleExpand(n))},handleCheckChange:function(){var t=this.panel,e=this.value,n=this.node;t.handleCheckChange(e),t.handleExpand(n)},handleMultiCheckChange:function(t){this.node.doCheck(t),this.panel.calculateMultiCheckedValue()},isInPath:function(t){var e=this.node;return(t[e.level-1]||{}).uid===e.uid},renderPrefix:function(t){var e=this.isLeaf,n=this.isChecked,i=this.config,r=i.checkStrictly;return i.multiple?this.renderCheckbox(t):r?this.renderRadio(t):e&&n?this.renderCheckIcon(t):null},renderPostfix:function(t){var e=this.node,n=this.isLeaf;return e.loading?this.renderLoadingIcon(t):n?null:this.renderExpandIcon(t)},renderCheckbox:function(t){var e=this.node,n=this.config,i=this.isDisabled,r={on:{change:this.handleMultiCheckChange},nativeOn:{}};return n.checkStrictly&&(r.nativeOn.click=Fc),t("el-checkbox",Zs()([{attrs:{value:e.checked,indeterminate:e.indeterminate,disabled:i}},r]))},renderRadio:function(t){var e=this.checkedValue,n=this.value,i=this.isDisabled;return Object(g.isEqual)(n,e)&&(n=e),t("el-radio",{attrs:{value:e,label:n,disabled:i},on:{change:this.handleCheckChange},nativeOn:{click:Fc}},[t("span")])},renderCheckIcon:function(t){return t("i",{class:"el-icon-check el-cascader-node__prefix"})},renderLoadingIcon:function(t){return t("i",{class:"el-icon-loading el-cascader-node__postfix"})},renderExpandIcon:function(t){return t("i",{class:"el-icon-arrow-right el-cascader-node__postfix"})},renderContent:function(t){var e=this.panel,n=this.node,i=e.renderLabelFn;return t("span",{class:"el-cascader-node__label"},[(i?i({node:n,data:n.data}):null)||n.label])}},render:function(t){var e=this,n=this.inActivePath,i=this.inCheckedPath,r=this.isChecked,o=this.isLeaf,s=this.isDisabled,a=this.config,l=this.nodeId,u=a.expandTrigger,c=a.checkStrictly,h=a.multiple,p=!c&&s,d={on:{}};return"click"===u?d.on.click=this.handleExpand:(d.on.mouseenter=function(t){e.handleExpand(),e.$emit("expand",t)},d.on.focus=function(t){e.handleExpand(),e.$emit("expand",t)}),!o||s||c||h||(d.on.click=this.handleCheckChange),t("li",Zs()([{attrs:{role:"menuitem",id:l,"aria-expanded":n,tabindex:p?null:-1},class:{"el-cascader-node":!0,"is-selectable":c,"in-active-path":n,"in-checked-path":i,"is-active":r,"is-disabled":p}},d]),[this.renderPrefix(t),this.renderContent(t),this.renderPostfix(t)])}},void 0,void 0,!1,null,null,null);Uc.options.__file="packages/cascader-panel/src/cascader-node.vue";var Vc=Uc.exports,Hc=r({name:"ElCascaderMenu",mixins:[f.a],inject:["panel"],components:{ElScrollbar:B.a,CascaderNode:Vc},props:{nodes:{type:Array,required:!0},index:Number},data:function(){return{activeNode:null,hoverTimer:null,id:Object(g.generateId)()}},computed:{isEmpty:function(){return!this.nodes.length},menuId:function(){return"cascader-menu-"+this.id+"-"+this.index}},methods:{handleExpand:function(t){this.activeNode=t.target},handleMouseMove:function(t){var e=this.activeNode,n=this.hoverTimer,i=this.$refs.hoverZone;if(e&&i)if(e.contains(t.target)){clearTimeout(n);var r=this.$el.getBoundingClientRect().left,o=t.clientX-r,s=this.$el,a=s.offsetWidth,l=s.offsetHeight,u=e.offsetTop,c=u+e.offsetHeight;i.innerHTML='\n <path style="pointer-events: auto;" fill="transparent" d="M'+o+" "+u+" L"+a+" 0 V"+u+' Z" />\n <path style="pointer-events: auto;" fill="transparent" d="M'+o+" "+c+" L"+a+" "+l+" V"+c+' Z" />\n '}else n||(this.hoverTimer=setTimeout(this.clearHoverZone,this.panel.config.hoverThreshold))},clearHoverZone:function(){var t=this.$refs.hoverZone;t&&(t.innerHTML="")},renderEmptyText:function(t){return t("div",{class:"el-cascader-menu__empty-text"},[this.t("el.cascader.noData")])},renderNodeList:function(t){var e=this.menuId,n=this.panel.isHoverMenu,i={on:{}};n&&(i.on.expand=this.handleExpand);var r=this.nodes.map(function(n,r){var o=n.hasChildren;return t("cascader-node",Zs()([{key:n.uid,attrs:{node:n,"node-id":e+"-"+r,"aria-haspopup":o,"aria-owns":o?e:null}},i]))});return[].concat(r,[n?t("svg",{ref:"hoverZone",class:"el-cascader-menu__hover-zone"}):null])}},render:function(t){var e=this.isEmpty,n=this.menuId,i={nativeOn:{}};return this.panel.isHoverMenu&&(i.nativeOn.mousemove=this.handleMouseMove),t("el-scrollbar",Zs()([{attrs:{tag:"ul",role:"menu",id:n,"wrap-class":"el-cascader-menu__wrap","view-class":{"el-cascader-menu__list":!0,"is-empty":e}},class:"el-cascader-menu"},i]),[e?this.renderEmptyText(t):this.renderNodeList(t)])}},void 0,void 0,!1,null,null,null);Hc.options.__file="packages/cascader-panel/src/cascader-menu.vue";var Wc=Hc.exports,Gc=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var jc=0,zc=function(){function t(e,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.config=n,this.parent=i||null,this.level=this.parent?this.parent.level+1:1,this.uid=jc++,this.initState(),this.initChildren()}return t.prototype.initState=function(){var t=this.config,e=t.value,n=t.label;this.value=this.data[e],this.label=this.data[n],this.pathNodes=this.calculatePathNodes(),this.path=this.pathNodes.map(function(t){return t.value}),this.pathLabels=this.pathNodes.map(function(t){return t.label}),this.loading=!1,this.loaded=!1},t.prototype.initChildren=function(){var e=this,n=this.config,i=n.children,r=this.data[i];this.hasChildren=Array.isArray(r),this.children=(r||[]).map(function(i){return new t(i,n,e)})},t.prototype.calculatePathNodes=function(){for(var t=[this],e=this.parent;e;)t.unshift(e),e=e.parent;return t},t.prototype.getPath=function(){return this.path},t.prototype.getValue=function(){return this.value},t.prototype.getValueByOption=function(){return this.config.emitPath?this.getPath():this.getValue()},t.prototype.getText=function(t,e){return t?this.pathLabels.join(e):this.label},t.prototype.isSameNode=function(t){var e=this.getValueByOption();return this.config.multiple&&Array.isArray(t)?t.some(function(t){return Object(g.isEqual)(t,e)}):Object(g.isEqual)(t,e)},t.prototype.broadcast=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];var r="onParent"+Object(g.capitalize)(t);this.children.forEach(function(e){e&&(e.broadcast.apply(e,[t].concat(n)),e[r]&&e[r].apply(e,n))})},t.prototype.emit=function(t){var e=this.parent,n="onChild"+Object(g.capitalize)(t);if(e){for(var i=arguments.length,r=Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];e[n]&&e[n].apply(e,r),e.emit.apply(e,[t].concat(r))}},t.prototype.onParentCheck=function(t){this.isDisabled||this.setCheckState(t)},t.prototype.onChildCheck=function(){var t=this.children.filter(function(t){return!t.isDisabled}),e=!!t.length&&t.every(function(t){return t.checked});this.setCheckState(e)},t.prototype.setCheckState=function(t){var e=this.children.length,n=this.children.reduce(function(t,e){return t+(e.checked?1:e.indeterminate?.5:0)},0);this.checked=t,this.indeterminate=n!==e&&n>0},t.prototype.syncCheckState=function(t){var e=this.getValueByOption(),n=this.isSameNode(t,e);this.doCheck(n)},t.prototype.doCheck=function(t){this.checked!==t&&(this.config.checkStrictly?this.checked=t:(this.broadcast("check",t),this.setCheckState(t),this.emit("check")))},Gc(t,[{key:"isDisabled",get:function(){var t=this.data,e=this.parent,n=this.config,i=n.disabled,r=n.checkStrictly;return t[i]||!r&&e&&e.isDisabled}},{key:"isLeaf",get:function(){var t=this.data,e=this.loaded,n=this.hasChildren,i=this.children,r=this.config,o=r.lazy,s=r.leaf;if(o){var a=Object(Wt.isDef)(t[s])?t[s]:!!e&&!i.length;return this.hasChildren=!a,a}return!n}}]),t}();var $c=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=n,this.initNodes(e)}return t.prototype.initNodes=function(t){var e=this;t=Object(g.coerceTruthyValueToArray)(t),this.nodes=t.map(function(t){return new zc(t,e.config)}),this.flattedNodes=this.getFlattedNodes(!1,!1),this.leafNodes=this.getFlattedNodes(!0,!1)},t.prototype.appendNode=function(t,e){var n=new zc(t,this.config,e);(e?e.children:this.nodes).push(n)},t.prototype.appendNodes=function(t,e){var n=this;(t=Object(g.coerceTruthyValueToArray)(t)).forEach(function(t){return n.appendNode(t,e)})},t.prototype.getNodes=function(){return this.nodes},t.prototype.getFlattedNodes=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t?this.leafNodes:this.flattedNodes;return e?n:function t(e,n){return e.reduce(function(e,i){return i.isLeaf?e.push(i):(!n&&e.push(i),e=e.concat(t(i.children,n))),e},[])}(this.nodes,t)},t.prototype.getNodeByValue=function(t){if(t){var e=this.getFlattedNodes(!1,!this.config.lazy).filter(function(e){return Object(g.valueEquals)(e.path,t)||e.value===t});return e&&e.length?e[0]:null}return null},t}(),Xc=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Yc=_l.a.keys,Kc={expandTrigger:"click",multiple:!1,checkStrictly:!1,emitPath:!0,lazy:!1,lazyLoad:g.noop,value:"value",label:"label",children:"children",leaf:"leaf",disabled:"disabled",hoverThreshold:500},Jc=function(t){return!t.getAttribute("aria-owns")},qc=function(t,e){var n=t.parentNode;if(n){var i=n.querySelectorAll('.el-cascader-node[tabindex="-1"]');return i[Array.prototype.indexOf.call(i,t)+e]||null}return null},Zc=function(t,e){if(t){var n=t.id.split("-");return Number(n[n.length-2])}},Qc=function(t){t&&(t.focus(),!Jc(t)&&t.click())},th=r({name:"ElCascaderPanel",components:{CascaderMenu:Wc},props:{value:{},options:Array,props:Object,border:{type:Boolean,default:!0},renderLabel:Function},provide:function(){return{panel:this}},data:function(){return{checkedValue:null,checkedNodePaths:[],store:[],menus:[],activePath:[],loadCount:0}},computed:{config:function(){return Ht()(Xc({},Kc),this.props||{})},multiple:function(){return this.config.multiple},checkStrictly:function(){return this.config.checkStrictly},leafOnly:function(){return!this.checkStrictly},isHoverMenu:function(){return"hover"===this.config.expandTrigger},renderLabelFn:function(){return this.renderLabel||this.$scopedSlots.default}},watch:{options:{handler:function(){this.initStore()},immediate:!0,deep:!0},value:function(){this.syncCheckedValue(),this.checkStrictly&&this.calculateCheckedNodePaths()},checkedValue:function(t){Object(g.isEqual)(t,this.value)||(this.checkStrictly&&this.calculateCheckedNodePaths(),this.$emit("input",t),this.$emit("change",t))}},mounted:function(){Object(g.isEmpty)(this.value)||this.syncCheckedValue()},methods:{initStore:function(){var t=this.config,e=this.options;t.lazy&&Object(g.isEmpty)(e)?this.lazyLoad():(this.store=new $c(e,t),this.menus=[this.store.getNodes()],this.syncMenuState())},syncCheckedValue:function(){var t=this.value,e=this.checkedValue;Object(g.isEqual)(t,e)||(this.activePath=[],this.checkedValue=t,this.syncMenuState())},syncMenuState:function(){var t=this.multiple,e=this.checkStrictly;this.syncActivePath(),t&&this.syncMultiCheckState(),e&&this.calculateCheckedNodePaths(),this.$nextTick(this.scrollIntoView)},syncMultiCheckState:function(){var t=this;this.getFlattedNodes(this.leafOnly).forEach(function(e){e.syncCheckState(t.checkedValue)})},syncActivePath:function(){var t=this,e=this.store,n=this.multiple,i=this.activePath,r=this.checkedValue;if(Object(g.isEmpty)(i))if(Object(g.isEmpty)(r))this.activePath=[],this.menus=[e.getNodes()];else{var o=n?r[0]:r,s=((this.getNodeByValue(o)||{}).pathNodes||[]).slice(0,-1);this.expandNodes(s)}else{var a=i.map(function(e){return t.getNodeByValue(e.getValue())});this.expandNodes(a)}},expandNodes:function(t){var e=this;t.forEach(function(t){return e.handleExpand(t,!0)})},calculateCheckedNodePaths:function(){var t=this,e=this.checkedValue,n=this.multiple?Object(g.coerceTruthyValueToArray)(e):[e];this.checkedNodePaths=n.map(function(e){var n=t.getNodeByValue(e);return n?n.pathNodes:[]})},handleKeyDown:function(t){var e=t.target;switch(t.keyCode){case Yc.up:var n=qc(e,-1);Qc(n);break;case Yc.down:var i=qc(e,1);Qc(i);break;case Yc.left:var r=this.$refs.menu[Zc(e)-1];if(r){var o=r.$el.querySelector('.el-cascader-node[aria-expanded="true"]');Qc(o)}break;case Yc.right:var s=this.$refs.menu[Zc(e)+1];if(s){var a=s.$el.querySelector('.el-cascader-node[tabindex="-1"]');Qc(a)}break;case Yc.enter:!function(t){if(t){var e=t.querySelector("input");e?e.click():Jc(t)&&t.click()}}(e);break;case Yc.esc:case Yc.tab:this.$emit("close");break;default:return}},handleExpand:function(t,e){var n=this.activePath,i=t.level,r=n.slice(0,i-1),o=this.menus.slice(0,i);if(t.isLeaf||(r.push(t),o.push(t.children)),this.activePath=r,this.menus=o,!e){var s=r.map(function(t){return t.getValue()}),a=n.map(function(t){return t.getValue()});Object(g.valueEquals)(s,a)||(this.$emit("active-item-change",s),this.$emit("expand-change",s))}},handleCheckChange:function(t){this.checkedValue=t},lazyLoad:function(t,e){var n=this,i=this.config;t||(t=t||{root:!0,level:0},this.store=new $c([],i),this.menus=[this.store.getNodes()]),t.loading=!0;i.lazyLoad(t,function(i){var r=t.root?null:t;if(i&&i.length&&n.store.appendNodes(i,r),t.loading=!1,t.loaded=!0,Array.isArray(n.checkedValue)){var o=n.checkedValue[n.loadCount++],s=n.config.value,a=n.config.leaf;if(Array.isArray(i)&&i.filter(function(t){return t[s]===o}).length>0){var l=n.store.getNodeByValue(o);l.data[a]||n.lazyLoad(l,function(){n.handleExpand(l)}),n.loadCount===n.checkedValue.length&&n.$parent.computePresentText()}}e&&e(i)})},calculateMultiCheckedValue:function(){this.checkedValue=this.getCheckedNodes(this.leafOnly).map(function(t){return t.getValueByOption()})},scrollIntoView:function(){this.$isServer||(this.$refs.menu||[]).forEach(function(t){var e=t.$el;if(e){var n=e.querySelector(".el-scrollbar__wrap"),i=e.querySelector(".el-cascader-node.is-active")||e.querySelector(".el-cascader-node.in-active-path");Fe()(n,i)}})},getNodeByValue:function(t){return this.store.getNodeByValue(t)},getFlattedNodes:function(t){var e=!this.config.lazy;return this.store.getFlattedNodes(t,e)},getCheckedNodes:function(t){var e=this.checkedValue;return this.multiple?this.getFlattedNodes(t).filter(function(t){return t.checked}):Object(g.isEmpty)(e)?[]:[this.getNodeByValue(e)]},clearCheckedNodes:function(){var t=this.config,e=this.leafOnly,n=t.multiple,i=t.emitPath;n?(this.getCheckedNodes(e).filter(function(t){return!t.isDisabled}).forEach(function(t){return t.doCheck(!1)}),this.calculateMultiCheckedValue()):this.checkedValue=i?[]:null}}},Lc,[],!1,null,null,null);th.options.__file="packages/cascader-panel/src/cascader-panel.vue";var eh=th.exports;eh.install=function(t){t.component(eh.name,eh)};var nh=eh,ih=r({name:"ElAvatar",props:{size:{type:[Number,String],validator:function(t){return"string"==typeof t?["large","medium","small"].includes(t):"number"==typeof t}},shape:{type:String,default:"circle",validator:function(t){return["circle","square"].includes(t)}},icon:String,src:String,alt:String,srcSet:String,error:Function,fit:{type:String,default:"cover"}},data:function(){return{isImageExist:!0}},computed:{avatarClass:function(){var t=this.size,e=this.icon,n=this.shape,i=["el-avatar"];return t&&"string"==typeof t&&i.push("el-avatar--"+t),e&&i.push("el-avatar--icon"),n&&i.push("el-avatar--"+n),i.join(" ")}},methods:{handleError:function(){var t=this.error;!1!==(t?t():void 0)&&(this.isImageExist=!1)},renderAvatar:function(){var t=this.$createElement,e=this.icon,n=this.src,i=this.alt,r=this.isImageExist,o=this.srcSet,s=this.fit;return r&&n?t("img",{attrs:{src:n,alt:i,srcSet:o},on:{error:this.handleError},style:{"object-fit":s}}):e?t("i",{class:e}):this.$slots.default}},render:function(){var t=arguments[0],e=this.avatarClass,n=this.size;return t("span",{class:e,style:"number"==typeof n?{height:n+"px",width:n+"px",lineHeight:n+"px"}:{}},[this.renderAvatar()])}},void 0,void 0,!1,null,null,null);ih.options.__file="packages/avatar/src/main.vue";var rh=ih.exports;rh.install=function(t){t.component(rh.name,rh)};var oh=rh,sh=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"el-drawer-fade"},on:{"after-enter":t.afterEnter,"after-leave":t.afterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.visible,expression:"visible"}],staticClass:"el-drawer__wrapper",attrs:{tabindex:"-1"}},[n("div",{staticClass:"el-drawer__container",class:t.visible&&"el-drawer__open",attrs:{role:"document",tabindex:"-1"},on:{click:function(e){return e.target!==e.currentTarget?null:t.handleWrapperClick(e)}}},[n("div",{ref:"drawer",staticClass:"el-drawer",class:[t.direction,t.customClass],style:t.isHorizontal?"width: "+t.drawerSize:"height: "+t.drawerSize,attrs:{"aria-modal":"true","aria-labelledby":"el-drawer__title","aria-label":t.title,role:"dialog",tabindex:"-1"}},[t.withHeader?n("header",{staticClass:"el-drawer__header",attrs:{id:"el-drawer__title"}},[t._t("title",[n("span",{attrs:{role:"heading",title:t.title}},[t._v(t._s(t.title))])]),t.showClose?n("button",{staticClass:"el-drawer__close-btn",attrs:{"aria-label":"close "+(t.title||"drawer"),type:"button"},on:{click:t.closeDrawer}},[n("i",{staticClass:"el-dialog__close el-icon el-icon-close"})]):t._e()],2):t._e(),t.rendered?n("section",{staticClass:"el-drawer__body"},[t._t("default")],2):t._e()])])])])};sh._withStripped=!0;var ah=r({name:"ElDrawer",mixins:[b.a,S.a],props:{appendToBody:{type:Boolean,default:!1},beforeClose:{type:Function},customClass:{type:String,default:""},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0},direction:{type:String,default:"rtl",validator:function(t){return-1!==["ltr","rtl","ttb","btt"].indexOf(t)}},modalAppendToBody:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},size:{type:[Number,String],default:"30%"},title:{type:String,default:""},visible:{type:Boolean},wrapperClosable:{type:Boolean,default:!0},withHeader:{type:Boolean,default:!0}},computed:{isHorizontal:function(){return"rtl"===this.direction||"ltr"===this.direction},drawerSize:function(){return"number"==typeof this.size?this.size+"px":this.size}},data:function(){return{closed:!1,prevActiveElement:null}},watch:{visible:function(t){var e=this;t?(this.closed=!1,this.$emit("open"),this.appendToBody&&document.body.appendChild(this.$el),this.prevActiveElement=document.activeElement):(this.closed||(this.$emit("close"),!0===this.destroyOnClose&&(this.rendered=!1)),this.$nextTick(function(){e.prevActiveElement&&e.prevActiveElement.focus()}))}},methods:{afterEnter:function(){this.$emit("opened")},afterLeave:function(){this.$emit("closed")},hide:function(t){!1!==t&&(this.$emit("update:visible",!1),this.$emit("close"),!0===this.destroyOnClose&&(this.rendered=!1),this.closed=!0)},handleWrapperClick:function(){this.wrapperClosable&&this.closeDrawer()},closeDrawer:function(){"function"==typeof this.beforeClose?this.beforeClose(this.hide):this.hide()},handleClose:function(){this.closeDrawer()}},mounted:function(){this.visible&&(this.rendered=!0,this.open())},destroyed:function(){this.appendToBody&&this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el)}},sh,[],!1,null,null,null);ah.options.__file="packages/drawer/src/main.vue";var lh=ah.exports;lh.install=function(t){t.component(lh.name,lh)};var uh=lh,ch=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("el-popover",t._b({attrs:{trigger:"click"},model:{value:t.visible,callback:function(e){t.visible=e},expression:"visible"}},"el-popover",t.$attrs,!1),[n("div",{staticClass:"el-popconfirm"},[n("p",{staticClass:"el-popconfirm__main"},[t.hideIcon?t._e():n("i",{staticClass:"el-popconfirm__icon",class:t.icon,style:{color:t.iconColor}}),t._v("\n "+t._s(t.title)+"\n ")]),n("div",{staticClass:"el-popconfirm__action"},[n("el-button",{attrs:{size:"mini",type:t.cancelButtonType},on:{click:t.cancel}},[t._v("\n "+t._s(t.displayCancelButtonText)+"\n ")]),n("el-button",{attrs:{size:"mini",type:t.confirmButtonType},on:{click:t.confirm}},[t._v("\n "+t._s(t.displayConfirmButtonText)+"\n ")])],1)]),t._t("reference",null,{slot:"reference"})],2)};ch._withStripped=!0;var hh=n(44),ph=r({name:"ElPopconfirm",props:{title:{type:String},confirmButtonText:{type:String},cancelButtonText:{type:String},confirmButtonType:{type:String,default:"primary"},cancelButtonType:{type:String,default:"text"},icon:{type:String,default:"el-icon-question"},iconColor:{type:String,default:"#f90"},hideIcon:{type:Boolean,default:!1}},components:{ElPopover:n.n(hh).a,ElButton:$.a},data:function(){return{visible:!1}},computed:{displayConfirmButtonText:function(){return this.confirmButtonText||Object(Nr.t)("el.popconfirm.confirmButtonText")},displayCancelButtonText:function(){return this.cancelButtonText||Object(Nr.t)("el.popconfirm.cancelButtonText")}},methods:{confirm:function(){this.visible=!1,this.$emit("confirm")},cancel:function(){this.visible=!1,this.$emit("cancel")}}},ch,[],!1,null,null,null);ph.options.__file="packages/popconfirm/src/main.vue";var dh=ph.exports;dh.install=function(t){t.component(dh.name,dh)};var fh=dh,gh=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.uiLoading?[n("div",t._b({class:["el-skeleton",t.animated?"is-animated":""]},"div",t.$attrs,!1),[t._l(t.count,function(e){return[t.loading?t._t("template",t._l(t.rows,function(e){return n("el-skeleton-item",{key:e,class:{"el-skeleton__paragraph":1!==e,"is-first":1===e,"is-last":e===t.rows&&t.rows>1},attrs:{variant:"p"}})})):t._e()]})],2)]:[t._t("default",null,null,t.$attrs)]],2)};gh._withStripped=!0;var mh=r({name:"ElSkeleton",props:{animated:{type:Boolean,default:!1},count:{type:Number,default:1},rows:{type:Number,default:4},loading:{type:Boolean,default:!0},throttle:{type:Number,default:0}},watch:{loading:{handler:function(t){var e=this;this.throttle<=0?this.uiLoading=t:t?(clearTimeout(this.timeoutHandle),this.timeoutHandle=setTimeout(function(){e.uiLoading=e.loading},this.throttle)):this.uiLoading=t},immediate:!0}},data:function(){return{uiLoading:this.throttle<=0&&this.loading}}},gh,[],!1,null,null,null);mh.options.__file="packages/skeleton/src/index.vue";var vh=mh.exports;vh.install=function(t){t.component(vh.name,vh)};var _h=vh,yh=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:["el-skeleton__item","el-skeleton__"+this.variant]},["image"===this.variant?e("img-placeholder"):this._e()],1)};yh._withStripped=!0;var bh=function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{attrs:{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"}},[e("path",{attrs:{d:"M64 896V128h896v768H64z m64-128l192-192 116.352 116.352L640 448l256 307.2V192H128v576z m224-480a96 96 0 1 1-0.064 192.064A96 96 0 0 1 352 288z"}})])};bh._withStripped=!0;var Th=r({name:"ImgPlaceholder"},bh,[],!1,null,null,null);Th.options.__file="packages/skeleton/src/img-placeholder.vue";var Eh,Ch=Th.exports,Sh=r({name:"ElSkeletonItem",props:{variant:{type:String,default:"text"}},components:(Eh={},Eh[Ch.name]=Ch,Eh)},yh,[],!1,null,null,null);Sh.options.__file="packages/skeleton/src/item.vue";var wh=Sh.exports;wh.install=function(t){t.component(wh.name,wh)};var kh=wh,xh=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-empty"},[n("div",{staticClass:"el-empty__image",style:t.imageStyle},[t.image?n("img",{attrs:{src:t.image,ondragstart:"return false"}}):t._t("image",[n("img-empty")])],2),n("div",{staticClass:"el-empty__description"},[t.$slots.description?t._t("description"):n("p",[t._v(t._s(t.emptyDescription))])],2),t.$slots.default?n("div",{staticClass:"el-empty__bottom"},[t._t("default")],2):t._e()])};xh._withStripped=!0;var Ih=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("svg",{attrs:{viewBox:"0 0 79 86",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},[n("defs",[n("linearGradient",{attrs:{id:"linearGradient-1-"+t.id,x1:"38.8503086%",y1:"0%",x2:"61.1496914%",y2:"100%"}},[n("stop",{attrs:{"stop-color":"#FCFCFD",offset:"0%"}}),n("stop",{attrs:{"stop-color":"#EEEFF3",offset:"100%"}})],1),n("linearGradient",{attrs:{id:"linearGradient-2-"+t.id,x1:"0%",y1:"9.5%",x2:"100%",y2:"90.5%"}},[n("stop",{attrs:{"stop-color":"#FCFCFD",offset:"0%"}}),n("stop",{attrs:{"stop-color":"#E9EBEF",offset:"100%"}})],1),n("rect",{attrs:{id:"path-3-"+t.id,x:"0",y:"0",width:"17",height:"36"}})],1),n("g",{attrs:{id:"Illustrations",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"}},[n("g",{attrs:{id:"B-type",transform:"translate(-1268.000000, -535.000000)"}},[n("g",{attrs:{id:"Group-2",transform:"translate(1268.000000, 535.000000)"}},[n("path",{attrs:{id:"Oval-Copy-2",d:"M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",fill:"#F7F8FC"}}),n("polygon",{attrs:{id:"Rectangle-Copy-14",fill:"#E5E7E9",transform:"translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",points:"13 58 53 58 42 45 2 45"}}),n("g",{attrs:{id:"Group-Copy",transform:"translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"}},[n("polygon",{attrs:{id:"Rectangle-Copy-10",fill:"#E5E7E9",transform:"translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",points:"2.84078316e-14 3 18 3 23 7 5 7"}}),n("polygon",{attrs:{id:"Rectangle-Copy-11",fill:"#EDEEF2",points:"-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"}}),n("rect",{attrs:{id:"Rectangle-Copy-12",fill:"url(#linearGradient-1-"+t.id+")",transform:"translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",x:"38",y:"7",width:"17",height:"36"}}),n("polygon",{attrs:{id:"Rectangle-Copy-13",fill:"#F8F9FB",transform:"translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",points:"24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"}})]),n("rect",{attrs:{id:"Rectangle-Copy-15",fill:"url(#linearGradient-2-"+t.id+")",x:"13",y:"45",width:"40",height:"36"}}),n("g",{attrs:{id:"Rectangle-Copy-17",transform:"translate(53.000000, 45.000000)"}},[n("mask",{attrs:{id:"mask-4-"+t.id,fill:"white"}},[n("use",{attrs:{"xlink:href":"#path-3-"+t.id}})]),n("use",{attrs:{id:"Mask",fill:"#E0E3E9",transform:"translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ","xlink:href":"#path-3-"+t.id}}),n("polygon",{attrs:{id:"Rectangle-Copy",fill:"#D5D7DE",mask:"url(#mask-4-"+t.id+")",transform:"translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",points:"7 0 24 0 20 18 -1.70530257e-13 16"}})]),n("polygon",{attrs:{id:"Rectangle-Copy-18",fill:"#F8F9FB",transform:"translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",points:"62 45 79 45 70 58 53 58"}})])])])])};Ih._withStripped=!0;var Rh=0,Oh=r({name:"ImgEmpty",data:function(){return{id:++Rh}}},Ih,[],!1,null,null,null);Oh.options.__file="packages/empty/src/img-empty.vue";var Dh,Ah=Oh.exports,Mh=r({name:"ElEmpty",components:(Dh={},Dh[Ah.name]=Ah,Dh),props:{image:{type:String,default:""},imageSize:Number,description:{type:String,default:""}},computed:{emptyDescription:function(){return this.description||Object(Nr.t)("el.empty.description")},imageStyle:function(){return{width:this.imageSize?this.imageSize+"px":""}}}},xh,[],!1,null,null,null);Mh.options.__file="packages/empty/src/index.vue";var Nh=Mh.exports;Nh.install=function(t){t.component(Nh.name,Nh)};var Lh=Nh,Ph=[v,x,j,q,et,ot,vt,St,Ot,Nt,zt,Jt,te,oe,ue,de,ve,Te,we,He,We,$e,Je,tn,ii,ci,ar,gr,Sr,Or,Ar,no,so,co,yo,xo,Do,No,Zo,is,Cs,Vs,Ws,zs,sa,ca,fa,Ia,Aa,Ba,Ha,za,qa,el,ol,ul,dl,wl,eu,lu,pu,mu,bu,Su,Iu,Du,Lu,Uu,Gu,sc,mc,Tc,Nc,nh,oh,uh,fh,_h,kh,Lh,yt.a],Bh=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Lr.a.use(e.locale),Lr.a.i18n(e.i18n),Ph.forEach(function(e){t.component(e.name,e)}),t.use(Oc),t.use(Ps.directive),t.prototype.$ELEMENT={size:e.size||"",zIndex:e.zIndex||2e3},t.prototype.$loading=Ps.service,t.prototype.$msgbox=Zr,t.prototype.$alert=Zr.alert,t.prototype.$confirm=Zr.confirm,t.prototype.$prompt=Zr.prompt,t.prototype.$notify=ds,t.prototype.$message=Sa};"undefined"!=typeof window&&window.Vue&&Bh(window.Vue);e.default={version:"2.15.3",locale:Lr.a.use,i18n:Lr.a.i18n,install:Bh,CollapseTransition:yt.a,Loading:Ps,Pagination:v,Dialog:x,Autocomplete:j,Dropdown:q,DropdownMenu:et,DropdownItem:ot,Menu:vt,Submenu:St,MenuItem:Ot,MenuItemGroup:Nt,Input:zt,InputNumber:Jt,Radio:te,RadioGroup:oe,RadioButton:ue,Checkbox:de,CheckboxButton:ve,CheckboxGroup:Te,Switch:we,Select:He,Option:We,OptionGroup:$e,Button:Je,ButtonGroup:tn,Table:ii,TableColumn:ci,DatePicker:ar,TimeSelect:gr,TimePicker:Sr,Popover:Or,Tooltip:Ar,MessageBox:Zr,Breadcrumb:no,BreadcrumbItem:so,Form:co,FormItem:yo,Tabs:xo,TabPane:Do,Tag:No,Tree:Zo,Alert:is,Notification:ds,Slider:Cs,Icon:Vs,Row:Ws,Col:zs,Upload:sa,Progress:ca,Spinner:fa,Message:Sa,Badge:Ia,Card:Aa,Rate:Ba,Steps:Ha,Step:za,Carousel:qa,Scrollbar:el,CarouselItem:ol,Collapse:ul,CollapseItem:dl,Cascader:wl,ColorPicker:eu,Transfer:lu,Container:pu,Header:mu,Aside:bu,Main:Su,Footer:Iu,Timeline:Du,TimelineItem:Lu,Link:Uu,Divider:Gu,Image:sc,Calendar:mc,Backtop:Tc,InfiniteScroll:Oc,PageHeader:Nc,CascaderPanel:nh,Avatar:oh,Drawer:uh,Popconfirm:fh,Skeleton:_h,SkeletonItem:kh,Empty:Lh}}]).default},zQR9:function(t,e,n){"use strict";var i=n("h65t")(!0);n("vIB/")(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})})},zTCi:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){if(o.default.prototype.$isServer)return;if(!e)return void(t.scrollTop=0);var n=[],i=e.offsetParent;for(;i&&t!==i&&t.contains(i);)n.push(i),i=i.offsetParent;var r=e.offsetTop+n.reduce(function(t,e){return t+e.offsetTop},0),s=r+e.offsetHeight,a=t.scrollTop,l=a+t.clientHeight;r<a?t.scrollTop=r:s>l&&(t.scrollTop=s-t.clientHeight)};var i,r=n("7+uW"),o=(i=r)&&i.__esModule?i:{default:i}}});
  108. //# sourceMappingURL=vendor.c45496ecc850f4852679.js.map