1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="22dc12e5-75b4-58e8-b797-f95423e8d701")}catch(e){}}(); 3var e=Object.create,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.getPrototypeOf,r=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,i)=>{let n={};for(var o in e)t(n,o,{get:e[o],enumerable:!0});return i||t(n,Symbol.toStringTag,{value:"Module"}),n},c=(e,o,s,a)=>{if(o&&"object"==typeof o||"function"==typeof o)for(var l,c=n(o),u=0,h=c.length;u<h;u++)l=c[u],!r.call(e,l)&&l!==s&&t(e,l,{get:(e=>o[e]).bind(null,l),enumerable:!(a=i(o,l))||a.enumerable});return e},u=(i,n,r)=>(r=null==i?{}:e(o(i)),c(!n&&i&&i.__esModule?r:t(r,"default",{value:i,enumerable:!0}),i));function h(e){let t=Object.create(null);for(let i of e.split(","))t[i]=1;return e=>e in t}var d,p={},f=[],g=()=>{},m=()=>!1,T=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_=e=>e.startsWith("onUpdate:"),E=Object.assign,b=(e,t)=>{let i=e.indexOf(t);i>-1&&e.splice(i,1)},O=Object.prototype.hasOwnProperty,v=(e,t)=>O.call(e,t),I=Array.isArray,S=e=>"[object Map]"===$(e),y=e=>"[object Set]"===$(e),R=e=>"[object Date]"===$(e),C=e=>"function"==typeof e,k=e=>"string"==typeof e,A=e=>"symbol"==typeof e,L=e=>"object"==typeof e&&!!e,N=e=>(L(e)||C(e))&&C(e.then)&&C(e.catch),w=Object.prototype.toString,$=e=>w.call(e),M=e=>"[object Object]"===$(e),x=e=>k(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,D=h(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),P=e=>{let t=Object.create(null);return i=>t[i]||(t[i]=e(i))},F=/-\w/g,B=P(e=>e.replace(F,e=>e.slice(1).toUpperCase())),U=/\B([A-Z])/g,H=P(e=>e.replace(U,"-$1").toLowerCase()),V=P(e=>e.charAt(0).toUpperCase()+e.slice(1)),G=P(e=>e?`on${V(e)}`:""),W=(e,t)=>!Object.is(e,t),X=(e,...t)=>{for(let i=0;i<e.length;i++)e[i](...t)},z=(e,t,i,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:i})},j=e=>{let t=parseFloat(e);return isNaN(t)?e:t},Y=()=>d||=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};function Q(e){if(I(e)){let t={};for(let i=0;i<e.length;i++){let n=e[i],o=k(n)?Z(n):Q(n);if(o)for(let e in o)t[e]=o[e]}return t}if(k(e)||L(e))return e}var K=/;(?![^(]*\))/g,q=/:([^]+)/,J=/\/\*[^]*?\*\//g;function Z(e){let t={};return e.replace(J,"").split(K).forEach(e=>{if(e){let i=e.split(q);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function ee(e){let t="";if(k(e))t=e;else if(I(e))for(let i=0;i<e.length;i++){let n=ee(e[i]);n&&(t+=n+" ")}else if(L(e))for(let i in e)e[i]&&(t+=i+" ");return t.trim()}var te="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ie=h(te);function ne(e){return!!e||""===e}function oe(e,t){if(e===t)return!0;let i=R(e),n=R(t);if(i||n)return!(!i||!n)&&e.getTime()===t.getTime();if(i=A(e),n=A(t),i||n)return e===t;if(i=I(e),n=I(t),i||n)return!(!i||!n)&&function(e,t){if(e.length!==t.length)return!1;let i=!0;for(let n=0;i&&n<e.length;n++)i=oe(e[n],t[n]);return i}(e,t);if(i=L(e),n=L(t),i||n){if(!i||!n||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e){let n=e.hasOwnProperty(i),o=t.hasOwnProperty(i);if(n&&!o||!n&&o||!oe(e[i],t[i]))return!1}}return String(e)===String(t)}function re(e,t){return e.findIndex(e=>oe(e,t))}var se,ae,le=e=>!(!e||!0!==e.__v_isRef),ce=e=>k(e)?e:null==e?"":I(e)||L(e)&&(e.toString===w||!C(e.toString))?le(e)?ce(e.value):JSON.stringify(e,ue,2):String(e),ue=(e,t)=>le(t)?ue(e,t.value):S(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,i],n)=>(e[he(t,n)+" =>"]=i,e),{})}:y(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>he(e))}:A(t)?he(t):!L(t)||I(t)||M(t)?t:String(t),he=(e,t="")=>A(e)?`Symbol(${e.description??t})`:e,de=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&se&&(se.active?(this.parent=se,this.index=(se.scopes||=[]).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=se;try{return se=this,e()}finally{se=t}}}on(){1===++this._on&&(this.prevScope=se,se=this)}off(){if(this._on>0&&0===--this._on){if(se===this)se=this.prevScope;else{let e=se;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){let t,i;for(this._active=!1,t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(this.effects.length=0,t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function pe(e,t=!1){se&&se.cleanups.push(e)}var fe,ge,me=new WeakSet,Te=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler
3=void 0,se&&(se.active?se.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,me.has(this)&&(me.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Ee(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,we(this),ve(this);let e=ae,t=ke;ae=this,ke=!0;try{return this.fn()}finally{Ie(this),ae=e,ke=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Re(e);this.deps=this.depsTail=void 0,we(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?me.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Se(this)&&this.run()}get dirty(){return Se(this)}},_e=0;function Ee(e,t=!1){if(e.flags|=8,t)return e.next=ge,void(ge=e);e.next=fe,fe=e}function be(){_e++}function Oe(){if(--_e>0)return;if(ge){let e=ge;for(ge=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;fe;){let i=fe;for(fe=void 0;i;){let n=i.next;if(i.next=void 0,i.flags&=-9,1&i.flags)try{i.trigger()}catch(t){e||=t}i=n}}if(e)throw e}function ve(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ie(e){let t,i=e.depsTail,n=i;for(;n;){let e=n.prevDep;-1===n.version?(n===i&&(i=e),Re(n),Ce(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=e}e.deps=t,e.depsTail=i}function Se(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ye(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ye(e){if(4&e.flags&&!(16&e.flags)||(e.flags&=-17,e.globalVersion===$e)||(e.globalVersion=$e,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!Se(e))))return;e.flags|=2;let t=e.dep,i=ae,n=ke;ae=e,ke=!0;try{ve(e);let i=e.fn(e._value);(0===t.version||W(i,e._value))&&(e.flags|=128,e._value=i,t.version++)}catch(e){throw t.version++,e}finally{ae=i,ke=n,Ie(e),e.flags&=-3}}function Re(e,t=!1){let{dep:i,prevSub:n,nextSub:o}=e;if(n&&(n.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=n,e.nextSub=void 0),i.subs===e&&(i.subs=n,!n&&i.computed)){i.computed.flags&=-5;for(let e=i.computed.deps;e;e=e.nextDep)Re(e,!0)}!t&&! --i.sc&&i.map&&i.map.delete(i.key)}function Ce(e){let{prevDep:t,nextDep:i}=e;t&&(t.nextDep=i,e.prevDep=void 0),i&&(i.prevDep=t,e.nextDep=void 0)}var ke=!0,Ae=[];function Le(){Ae.push(ke),ke=!1}function Ne(){let e=Ae.pop();ke=void 0===e||e}function we(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=ae;ae=void 0;try{t()}finally{ae=e}}}var $e=0,Me=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},xe=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!ae||!ke||ae===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==ae)t=this.activeLink=new Me(ae,this),ae.deps?(t.prevDep=ae.depsTail,ae.depsTail.nextDep=t,ae.depsTail=t):ae.deps=ae.depsTail=t,De(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=ae.depsTail,t.nextDep=void 0,ae.depsTail.nextDep=t,ae.depsTail=t,ae.deps===t&&(ae.deps=e)}return t}trigger(e){this.version++,$e++,this.notify(e)}notify(e){be();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Oe()}}};function De(e){if(e.dep.sc++,4&e.sub.flags){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)De(e)}let i=e.dep.subs;i!==e&&(e.prevSub=i,i&&(i.nextSub=e)),e.dep.subs=e}}var Pe=new WeakMap,Fe=Symbol(""),Be=Symbol(""),Ue=Symbol("");function He(e,t,i){if(ke&&ae){let t=Pe.get(e);t||Pe.set(e,t=new Map);let n=t.get(i);n||(t.set(i,n=new xe),n.map=t,n.key=i),n.track()}}function Ve(e,t,i,n,o,r){let s=Pe.get(e);if(!s)return void $e++;let a=e=>{e&&e.trigger()};if(be(),"clear"===t)s.forEach(a);else{let o=I(e),r=o&&x(i);if(o&&"length"===i){let e=Number(n);s.forEach((t,i)=>{("length"===i||i===Ue||!A(i)&&i>=e)&&a(t)})}else switch((void 0!==i||s.has(void 0))&&a(s.get(i)),r&&a(s.get(Ue)),t){case"add":o?r&&a(s.get("length")):(a(s.get(Fe)),S(e)&&a(s.get(Be)));break;case"delete":o||(a(s.get(Fe)),S(e)&&a(s.get(Be)));break;case"set":S(e)&&a(s.get(Fe))}}Oe()}function Ge(e){let t=kt(e);return t===e?t:(He(t,0,Ue),Rt(e)?t:t.map(At))}function We(e){return He(e=kt(e),0,Ue),e}function Xe(e,t){return yt(e)?Lt(St(e)?At(t):t):At(t)}var ze={__proto__:null,[Symbol.iterator](){return je(this,Symbol.iterator,e=>Xe(this,e))},concat(...e){return Ge(this).concat(...e.map(e=>I(e)?Ge(e):e))}
3,entries(){return je(this,"entries",e=>(e[1]=Xe(this,e[1]),e))},every(e,t){return Qe(this,"every",e,t,void 0,arguments)},filter(e,t){return Qe(this,"filter",e,t,e=>e.map(e=>Xe(this,e)),arguments)},find(e,t){return Qe(this,"find",e,t,e=>Xe(this,e),arguments)},findIndex(e,t){return Qe(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Qe(this,"findLast",e,t,e=>Xe(this,e),arguments)},findLastIndex(e,t){return Qe(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Qe(this,"forEach",e,t,void 0,arguments)},includes(...e){return qe(this,"includes",e)},indexOf(...e){return qe(this,"indexOf",e)},join(e){return Ge(this).join(e)},lastIndexOf(...e){return qe(this,"lastIndexOf",e)},map(e,t){return Qe(this,"map",e,t,void 0,arguments)},pop(){return Je(this,"pop")},push(...e){return Je(this,"push",e)},reduce(e,...t){return Ke(this,"reduce",e,t)},reduceRight(e,...t){return Ke(this,"reduceRight",e,t)},shift(){return Je(this,"shift")},some(e,t){return Qe(this,"some",e,t,void 0,arguments)},splice(...e){return Je(this,"splice",e)},toReversed(){return Ge(this).toReversed()},toSorted(e){return Ge(this).toSorted(e)},toSpliced(...e){return Ge(this).toSpliced(...e)},unshift(...e){return Je(this,"unshift",e)},values(){return je(this,"values",e=>Xe(this,e))}};function je(e,t,i){let n=We(e),o=n[t]();return n!==e&&!Rt(e)&&(o._next=o.next,o.next=()=>{let e=o._next();return e.done||(e.value=i(e.value)),e}),o}var Ye=Array.prototype;function Qe(e,t,i,n,o,r){let s=We(e),a=s!==e&&!Rt(e),l=s[t];if(l!==Ye[t]){let t=l.apply(e,r);return a?At(t):t}let c=i;s!==e&&(a?c=function(t,n){return i.call(this,Xe(e,t),n,e)}:i.length>2&&(c=function(t,n){return i.call(this,t,n,e)}));let u=l.call(s,c,n);return a&&o?o(u):u}function Ke(e,t,i,n){let o=We(e),r=i,s=!1;o!==e&&(o!==e&&!Rt(e)?(s=0===n.length,r=function(t,n,o){return s&&(s=!1,t=Xe(e,t)),i.call(this,t,Xe(e,n),o,e)}):i.length>3&&(r=function(t,n,o){return i.call(this,t,n,o,e)}));let a=o[t](r,...n);return s?Xe(e,a):a}function qe(e,t,i){let n=kt(e);He(n,0,Ue);let o=n[t](...i);return-1!==o&&!1!==o||!Ct(i[0])?o:(i[0]=kt(i[0]),n[t](...i))}function Je(e,t,i=[]){Le(),be();let n=kt(e)[t].apply(e,i);return Oe(),Ne(),n}var Ze=h("__proto__,__v_isRef,__isVue"),et=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(A));function tt(e){A(e)||(e=String(e));let t=kt(this);return He(t,0,e),t.hasOwnProperty(e)}var it=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if("__v_skip"===t)return e.__v_skip;let n=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!n;if("__v_isReadonly"===t)return n;if("__v_isShallow"===t)return o;if("__v_raw"===t)return i===(n?o?Et:_t:o?Tt:mt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;let r=I(e);if(!n){let e;if(r&&(e=ze[t]))return e;if("hasOwnProperty"===t)return tt}let s=Reflect.get(e,t,Nt(e)?e:i);if((A(t)?et.has(t):Ze(t))||(n||He(e,0,t),o))return s;if(Nt(s)){let e=r&&x(t)?s:s.value;return n&&L(e)?vt(e):e}return L(s)?n?vt(s):bt(s):s}},nt=class extends it{constructor(e=!1){super(!1,e)}set(e,t,i,n){let o=e[t],r=I(e)&&x(t);if(!this._isShallow){let e=yt(o);if(!Rt(i)&&!yt(i)&&(o=kt(o),i=kt(i)),!r&&Nt(o)&&!Nt(i))return e||(o.value=i),!0}let s=r?Number(t)<e.length:v(e,t),a=Reflect.set(e,t,i,Nt(e)?e:n);return e===kt(n)&&(s?W(i,o)&&Ve(e,"set",t,i):Ve(e,"add",t,i)),a}deleteProperty(e,t){let i=v(e,t),n=(e[t],Reflect.deleteProperty(e,t));return n&&i&&Ve(e,"delete",t,void 0),n}has(e,t){let i=Reflect.has(e,t);return(!A(t)||!et.has(t))&&He(e,0,t),i}ownKeys(e){return He(e,0,I(e)?"length":Fe),Reflect.ownKeys(e)}},ot=class extends it{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},rt=new nt,st=new ot,at=new nt(!0),lt=e=>e,ct=e=>Reflect.getPrototypeOf(e);function ut(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function ht(e,t){let i={get(i){let n=this.__v_raw,o=kt(n),r=kt(i);e||(W(i,r)&&He(o,0,i),He(o,0,r));let{has:s}=ct(o),a=t?lt:e?Lt:At;return s.call(o,i)?a(n.get(i)):s.call(o,r)?a(n.get(r)):void(n!==o&&n.get(i))},get size(){let t=this.__v_raw;return!e&&He(kt(t),0,Fe),t.size},has(t){let i=this.__v_raw,n=kt(i),o=kt(t);return e||(W(t,o)&&He(n,0,t),He(n,0,o)),t===o?i.has(t):i.has(t)||i.has(o)}
3,forEach(i,n){let o=this,r=o.__v_raw,s=t?lt:e?Lt:At;return!e&&He(kt(r),0,Fe),r.forEach((e,t)=>i.call(n,s(e),s(t),o))}};return E(i,e?{add:ut("add"),set:ut("set"),delete:ut("delete"),clear:ut("clear")}:{add(e){let i=kt(this),n=ct(i),o=kt(e),r=t||Rt(e)||yt(e)?e:o;return n.has.call(i,r)||W(e,r)&&n.has.call(i,e)||W(o,r)&&n.has.call(i,o)||(i.add(r),Ve(i,"add",r,r)),this},set(e,i){!t&&!Rt(i)&&!yt(i)&&(i=kt(i));let n=kt(this),{has:o,get:r}=ct(n),s=o.call(n,e);s||=(e=kt(e),o.call(n,e));let a=r.call(n,e);return n.set(e,i),s?W(i,a)&&Ve(n,"set",e,i):Ve(n,"add",e,i),this},delete(e){let t=kt(this),{has:i,get:n}=ct(t),o=i.call(t,e);o||=(e=kt(e),i.call(t,e));n&&n.call(t,e);let r=t.delete(e);return o&&Ve(t,"delete",e,void 0),r},clear(){let e=kt(this),t=0!==e.size,i=e.clear();return t&&Ve(e,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(n=>{i[n]=function(e,t,i){return function(...n){let o=this.__v_raw,r=kt(o),s=S(r),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=o[e](...n),u=i?lt:t?Lt:At;return!t&&He(r,0,l?Be:Fe),E(Object.create(c),{next(){let{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[u(e[0]),u(e[1])]:u(e),done:t}}})}}(n,e,t)}),i}function dt(e,t){let i=ht(e,t);return(t,n,o)=>"__v_isReactive"===n?!e:"__v_isReadonly"===n?e:"__v_raw"===n?t:Reflect.get(v(i,n)&&n in t?i:t,n,o)}var pt={get:dt(!1,!1)},ft={get:dt(!1,!0)},gt={get:dt(!0,!1)},mt=new WeakMap,Tt=new WeakMap,_t=new WeakMap,Et=new WeakMap;function bt(e){return yt(e)?e:It(e,!1,rt,pt,mt)}function Ot(e){return It(e,!1,at,ft,Tt)}function vt(e){return It(e,!0,st,gt,_t)}function It(e,t,i,n,o){if(!L(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let r=o.get(e);if(r)return r;let s=function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>$(e).slice(8,-1))(e));if(0===s)return e;let a=new Proxy(e,2===s?n:i);return o.set(e,a),a}function St(e){return yt(e)?St(e.__v_raw):!(!e||!e.__v_isReactive)}function yt(e){return!(!e||!e.__v_isReadonly)}function Rt(e){return!(!e||!e.__v_isShallow)}function Ct(e){return!!e&&!!e.__v_raw}function kt(e){let t=e&&e.__v_raw;return t?kt(t):e}var At=e=>L(e)?bt(e):e,Lt=e=>L(e)?vt(e):e;function Nt(e){return!!e&&!0===e.__v_isRef}function wt(e){return Mt(e,!1)}function $t(e){return Mt(e,!0)}function Mt(e,t){return Nt(e)?e:new xt(e,t)}var xt=class{constructor(e,t){this.dep=new xe,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:kt(e),this._value=t?e:At(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,i=this.__v_isShallow||Rt(e)||yt(e);W(e=i?e:kt(e),t)&&(this._rawValue=e,this._value=i?e:At(e),this.dep.trigger())}};function Dt(e){return Nt(e)?e.value:e}var Pt={get:(e,t,i)=>"__v_raw"===t?e:Dt(Reflect.get(e,t,i)),set:(e,t,i,n)=>{let o=e[t];return Nt(o)&&!Nt(i)?(o.value=i,!0):Reflect.set(e,t,i,n)}};function Ft(e){return St(e)?e:new Proxy(e,Pt)}var Bt=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new xe,{get:i,set:n}=e(t.track.bind(t),t.trigger.bind(t));this._get=i,this._set=n}get value(){return this._value=this._get()}set value(e){this._set(e)}};var Ut=class{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new xe(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=$e-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(8&this.flags)&&ae!==this)return Ee(this,!0),!0}get value(){let e=this.dep.track();return ye(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function Ht(e,t,i=!1){let n,o;return C(e)?n=e:(n=e.get,o=e.set),new Ut(n,o,i)}var Vt={},Gt=new WeakMap,Wt=void 0;function Xt(e,t,i=p){let n,o,r,s,{immediate:a,deep:l,once:c,scheduler:u,augmentJob:h,call:d}=i,f=e=>l?e:Rt(e)||!1===l||0===l?zt(e,1):zt(e),m=!1,T=!1;if(Nt(e)?(o=()=>e.value,m=Rt(e)):St(e)?(o=()=>f(e),m=!0):I(e)?(T=!0,m=e.some(e=>St(e)||Rt(e)),o=()=>e.map(e=>Nt(e)?e.value:St(e)?f(e):C(e)?d?d(e,2):e():void 0)):o=C(e)?t?d?()=>d(e,2):e:()=>{if(r){Le();try{r()}finally{Ne()}}let t=Wt;Wt=n;try{return d?d(e,3,[s]):e(s)}finally{Wt=t}}:g,t&&l){let e=o,t=!0===l?1/0:l;o=()=>zt(e(),t)}let _=se,E=()=>{n.stop(),_&&_.active&&b(_.effects,n)};if(c&&t){let e=t;t=(...t)=>{e(...t),E()}}let O=T?Array(e.length).fill(Vt):Vt,v=e=>{if(1&n.flags&&(n.dirty||e))if(t){let e=n.run();if(l||m||(T?e.some((e,t)=>W(e,O[t])):W(e,O))){r&&r();let i=Wt;Wt=n;try{let i=[e,O===Vt?void 0:T&&O[0]===Vt?[]:O,s];O=e,d?d(t,3,i):t(...i)}finally{Wt=i}}}else n.run()};
3return h&&h(v),n=new Te(o),n.scheduler=u?()=>u(v,!1):v,s=e=>function(e,t=!1,i=Wt){if(i){let t=Gt.get(i);t||Gt.set(i,t=[]),t.push(e)}}(e,!1,n),r=n.onStop=()=>{let e=Gt.get(n);if(e){if(d)d(e,4);else for(let t of e)t();Gt.delete(n)}},t?a?v(!0):O=n.run():u?u(v.bind(null,!0),!0):n.run(),E.pause=n.pause.bind(n),E.resume=n.resume.bind(n),E.stop=E,E}function zt(e,t=1/0,i){if(t<=0||!L(e)||e.__v_skip||(i||=new Map,(i.get(e)||0)>=t))return e;if(i.set(e,t),t--,Nt(e))zt(e.value,t,i);else if(I(e))for(let n=0;n<e.length;n++)zt(e[n],t,i);else if(y(e)||S(e))e.forEach(e=>{zt(e,t,i)});else if(M(e)){for(let n in e)zt(e[n],t,i);for(let n of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,n)&&zt(e[n],t,i)}return e}function jt(e,t,i,n){try{return n?e(...n):e()}catch(e){Qt(e,t,i)}}function Yt(e,t,i,n){if(C(e)){let o=jt(e,t,i,n);return o&&N(o)&&o.catch(e=>{Qt(e,t,i)}),o}if(I(e)){let o=[];for(let r=0;r<e.length;r++)o.push(Yt(e[r],t,i,n));return o}}function Qt(e,t,i,n=!0){t&&t.vnode;let{errorHandler:o,throwUnhandledErrorInProduction:r}=t&&t.appContext.config||p;if(t){let n=t.parent,r=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${i}`;for(;n;){let t=n.ec;if(t)for(let i=0;i<t.length;i++)if(!1===t[i](e,r,s))return;n=n.parent}if(o)return Le(),jt(o,null,10,[e,r,s]),void Ne()}!function(e,t,i,n=!0,o=!1){if(o)throw e;console.error(e)}(e,0,0,n,r)}var Kt=[],qt=-1,Jt=[],Zt=null,ei=0,ti=Promise.resolve(),ii=null;function ni(e){let t=ii||ti;return e?t.then(this?e.bind(this):e):t}function oi(e){if(!(1&e.flags)){let t=li(e),i=Kt[Kt.length-1];!i||!(2&e.flags)&&t>=li(i)?Kt.push(e):Kt.splice(function(e){let t=qt+1,i=Kt.length;for(;t<i;){let n=t+i>>>1,o=Kt[n],r=li(o);r<e||r===e&&2&o.flags?t=n+1:i=n}return t}(t),0,e),e.flags|=1,ri()}}function ri(){ii||=ti.then(ci)}function si(e,t,i=qt+1){for(;i<Kt.length;i++){let t=Kt[i];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;Kt.splice(i,1),i--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function ai(e){if(Jt.length){let e=[...new Set(Jt)].sort((e,t)=>li(e)-li(t));if(Jt.length=0,Zt)return void Zt.push(...e);for(Zt=e,ei=0;ei<Zt.length;ei++){let e=Zt[ei];4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}Zt=null,ei=0}}var li=e=>null==e.id?2&e.flags?-1:1/0:e.id;function ci(e){try{for(qt=0;qt<Kt.length;qt++){let e=Kt[qt];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),jt(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;qt<Kt.length;qt++){let e=Kt[qt];e&&(e.flags&=-2)}qt=-1,Kt.length=0,ai(),ii=null,(Kt.length||Jt.length)&&ci(e)}}var ui=null,hi=null;function di(e){let t=ui;return ui=e,hi=e&&e.type.__scopeId||null,t}function pi(e,t=ui,i){if(!t||e._n)return e;let n=(...i)=>{n._d&&Io(-1);let o,r=di(t);try{o=e(...i)}finally{di(r),n._d&&Io(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function fi(e,t){if(null===ui)return e;let i=nr(ui),n=e.dirs||=[];for(let o=0;o<t.length;o++){let[e,r,s,a=p]=t[o];e&&(C(e)&&(e={mounted:e,updated:e}),e.deep&&zt(r),n.push({dir:e,instance:i,value:r,oldValue:void 0,arg:s,modifiers:a}))}return e}function gi(e,t,i,n){let o=e.dirs,r=t&&t.dirs;for(let s=0;s<o.length;s++){let a=o[s];r&&(a.oldValue=r[s].value);let l=a.dir[n];l&&(Le(),Yt(l,i,8,[e.el,a,e,t]),Ne())}}function mi(e,t,i=!1){let n=zo();if(n||wn){let o=wn?wn._context.provides:n?null==n.parent||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return i&&C(t)?t.call(n&&n.proxy):t}}var Ti=Symbol.for("v-scx");function _i(e,t,i){return Ei(e,t,i)}function Ei(e,t,i=p){let n,{immediate:o,deep:r,flush:s,once:a}=i,l=E({},i),c=t&&o||!t&&"post"!==s;if(Jo)if("sync"===s){let e=mi(Ti);n=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=g,e.resume=g,e.pause=g,e}let u=Xo;l.call=(e,t,i)=>Yt(e,u,t,i);let h=!1;"post"===s?l.scheduler=e=>{ro(e,u&&u.suspense)}:"sync"!==s&&(h=!0,l.scheduler=(e,t)=>{t?e():oi(e)}),l.augmentJob=e=>{t&&(e.flags|=4),h&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let d=Xt(e,t,l);return Jo&&(n?n.push(d):c&&d()),d}function bi(e,t,i){let n,o=this.proxy,r=k(e)?e.includes(".")?Oi(o,e):()=>o[e]:e.bind(o,o);C(t)?n=t:(n=t.handler,i=t);let s=jo(this),a=Ei(r,n.bind(o),i);return s(),a}function Oi(e,t){let i=t.split(".");return()=>{let t=e;for(let e=0;e<i.length&&t;e++)t=t[i[e]];return t}}var vi=new WeakMap,Ii=Symbol("_vte"),Si=e=>e&&(e.disabled||""===e.disabled),yi=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Ri=e=>"function"==typeof MathMLElement&&e instanceof MathMLElement,Ci=(e,t)=>{let i=e&&e.to;return k(i)?t?t(i):null:i},ki={name:"Teleport",__isTeleport:!0,process(e,t,i,n,o,r,s,a,l,c){let{mc:u,pc:h,pbc:d,o:{insert:p,querySelector:f,createText:g,createComment:m,parentNode:T}}=c,_=Si(t.props),{dynamicChildren:E}=t,b=(e,t,i)=>{16&e.shapeFlag&&u(e.children,t,i,o,r,s,a,l)},O=(e=t)=>{let i=Si(e.props),n=e.target=Ci(e.props,f),r=wi(n,e,g,p);n&&("svg"!==s&&yi(n)?s="svg":"mathml"!==s&&Ri(n)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(n),i||(b(e,n,r),Ni(e,!1)))},v=e=>{let t=()=>{vi.get(e)===t&&(vi.delete(e),Si(e.props)&&(b(e,T(e.el)||i,e.anchor),Ni(e,!0)),O(e))};vi.set(e,t),ro(t,r)};if(null==e){let e=t.el=g(""),o=t.anchor=g("");
3if(p(e,i,n),p(o,i,n),(e=>e&&(e.defer||""===e.defer))(t.props)||r&&r.pendingBranch)return void v(t);_&&(b(t,i,o),Ni(t,!0)),O()}else{t.el=e.el;let n=t.anchor=e.anchor,u=vi.get(e);if(u)return u.flags|=8,vi.delete(e),void v(t);t.targetStart=e.targetStart;let p=t.target=e.target,g=t.targetAnchor=e.targetAnchor,m=Si(e.props),T=m?i:p,b=m?n:g;if("svg"===s||yi(p)?s="svg":("mathml"===s||Ri(p))&&(s="mathml"),E?(d(e.dynamicChildren,E,T,o,r,s,a),co(e,t,!0)):l||h(e,t,T,b,o,r,s,a,!1),_)m?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Ai(t,i,n,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=Ci(t.props,f);e&&Ai(t,e,null,c,0)}else m&&Ai(t,p,g,c,1);Ni(t,_)}},remove(e,t,i,{um:n,o:{remove:o}},r){let{shapeFlag:s,children:a,anchor:l,targetStart:c,targetAnchor:u,target:h,props:d}=e,p=r||!Si(d),f=vi.get(e);if(f&&(f.flags|=8,vi.delete(e)),h&&(o(c),o(u)),r&&o(l),!f&&16&s)for(let g=0;g<a.length;g++){let e=a[g];n(e,t,i,p,!!e.dynamicChildren)}},move:Ai,hydrate:function(e,t,i,n,o,r,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:c,createText:u}},h){function d(e,i){let n=i;for(;n;){if(n&&8===n.nodeType)if("teleport start anchor"===n.data)t.targetStart=n;else if("teleport anchor"===n.data){t.targetAnchor=n,e._lpa=t.targetAnchor&&s(t.targetAnchor);break}n=s(n)}}function p(e,t){t.anchor=h(s(e),t,a(e),i,n,o,r)}let f=t.target=Ci(t.props,l),g=Si(t.props);if(f){let l=f._lpa||f.firstChild;16&t.shapeFlag&&(g?(p(e,t),d(f,l),t.targetAnchor||wi(f,t,u,c,a(e)===f?e:null)):(t.anchor=s(e),d(f,l),t.targetAnchor||wi(f,t,u,c),h(l&&s(l),t,f,i,n,o,r))),Ni(t,g)}else g&&16&t.shapeFlag&&(p(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}};function Ai(e,t,i,{o:{insert:n},m:o},r=2){0===r&&n(e.targetAnchor,t,i);let{el:s,anchor:a,shapeFlag:l,children:c,props:u}=e,h=2===r;if(h&&n(s,t,i),!vi.has(e)&&(!h||Si(u))&&16&l)for(let d=0;d<c.length;d++)o(c[d],t,i,2);h&&n(a,t,i)}var Li=ki;function Ni(e,t){let i=e.ctx;if(i&&i.ut){let n,o;for(t?(n=e.el,o=e.anchor):(n=e.targetStart,o=e.targetAnchor);n&&n!==o;)1===n.nodeType&&n.setAttribute("data-v-owner",i.uid),n=n.nextSibling;i.ut()}}function wi(e,t,i,n,o=null){let r=t.targetStart=i(""),s=t.targetAnchor=i("");return r[Ii]=s,e&&(n(r,e,o),n(s,e,o)),s}var $i=Symbol("_leaveCb");function Mi(e,t){6&e.shapeFlag&&e.component?(e.transition=t,Mi(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function xi(e,t){return C(e)?E({name:e.name},t,{setup:e}):e}function Di(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Pi(e){let t=zo(),i=$t(null);if(t){let n=t.refs===p?t.refs={}:t.refs;Object.defineProperty(n,e,{enumerable:!0,get:()=>i.value,set:e=>i.value=e})}return i}function Fi(e,t){let i;return!(!(i=Object.getOwnPropertyDescriptor(e,t))||i.configurable)}var Bi=new WeakMap;function Ui(e,t,i,n,o=!1){if(I(e))return void e.forEach((e,r)=>Ui(e,t&&(I(t)?t[r]:t),i,n,o));if(Vi(n)&&!o)return void(512&n.shapeFlag&&n.type.__asyncResolved&&n.component.subTree.component&&Ui(e,t,i,n.component.subTree));let r=4&n.shapeFlag?nr(n.component):n.el,s=o?null:r,{i:a,r:l}=e,c=t&&t.r,u=a.refs===p?a.refs={}:a.refs,h=a.setupState,d=kt(h),f=h===p?m:e=>!Fi(u,e)&&v(d,e),g=(e,t)=>!(t&&Fi(u,t));if(null!=c&&c!==l)if(Hi(t),k(c))u[c]=null,f(c)&&(h[c]=null);else if(Nt(c)){let e=t;g(0,e.k)&&(c.value=null),e.k&&(u[e.k]=null)}if(C(l))jt(l,a,12,[s,u]);else{let t=k(l),n=Nt(l);if(t||n){let a=()=>{if(e.f){let i=t?f(l)?h[l]:u[l]:g()||!e.k?l.value:u[e.k];if(o)I(i)&&b(i,r);else if(I(i))i.includes(r)||i.push(r);else if(t)u[l]=[r],f(l)&&(h[l]=u[l]);else{let t=[r];g(0,e.k)&&(l.value=t),e.k&&(u[e.k]=t)}}else t?(u[l]=s,f(l)&&(h[l]=s)):n&&(g(0,e.k)&&(l.value=s),e.k&&(u[e.k]=s))};if(s){let t=()=>{a(),Bi.delete(e)};t.id=-1,Bi.set(e,t),ro(t,i)}else Hi(e),a()}}}function Hi(e){let t=Bi.get(e);t&&(t.flags|=8,Bi.delete(e))}Y().requestIdleCallback,Y().cancelIdleCallback;var Vi=e=>!!e.type.__asyncLoader,Gi=e=>e.type.__isKeepAlive;function Wi(e,t){zi(e,"a",t)}function Xi(e,t){zi(e,"da",t)}function zi(e,t,i=Xo){let n=e.__wdc||=()=>{let t=i;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Yi(t,n,i),i){let e=i.parent;for(;e&&e.parent;)Gi(e.parent.vnode)&&ji(n,t,i,e),e=e.parent}}function ji(e,t,i,n){let o=Yi(t,e,n,!0);tn(()=>{b(n[t],o)},i)}function Yi(e,t,i=Xo,n=!1){if(i){let o=i[e]||(i[e]=[]),r=t.__weh||=(...n)=>{Le();let o=jo(i),r=Yt(t,i,e,n);return o(),Ne(),r};return n?o.unshift(r):o.push(r),r}}var Qi=e=>(t,i=Xo)=>{(!Jo||"sp"===e)&&Yi(e,(...e)=>t(...e),i)},Ki=Qi("bm"),qi=Qi("m"),Ji=Qi("bu"),Zi=Qi("u"),en=Qi("bum"),tn=Qi("um"),nn=Qi("sp"),on=Qi("rtg"),rn=Qi("rtc");function sn(e,t=Xo){Yi("ec",e,t)}var an=Symbol.for("v-ndc");function ln(e,t,i,n){let o,r=i&&i[n],s=I(e);if(s||k(e)){let i=!1,n=!1;s&&St(e)&&(i=!Rt(e),n=yt(e),e=We(e)),o=Array(e.length);for(let s=0,a=e.length;s<a;s++)o[s]=t(i?n?Lt(At(e[s])):At(e[s]):e[s],s,void 0,r&&r[s])}else if("number"==typeof e){o=Array(e);for(let i=0;i<e;i++)o[i]=t(i+1,i,void 0,r&&r[i])}else if(L(e))if(e[Symbol.iterator])o=Array.from(e,(e,i)=>t(e,i,void 0,r&&r[i]));else{let i=Object.keys(e);o=Array(i.length);for(let n=0,s=i.length;n<s;n++){let s=i[n];o[n]=t(e[s],s,n,r&&r[n])}}else o=[];return i&&(i[n]=o),o}function cn(e,t,i={},n,o){if(ui.ce||ui.parent&&Vi(ui.parent)&&ui.parent.ce){let e=Object.keys(i).length>0;return"default"!==t&&(i.name=t),Oo(),Ro(go,null,[wo("slot",i,n&&n())],e?-2:64)}let r=e[t];r&&r._c&&(r._d=!1),Oo();let s=r&&un(r(i)),a=i.key||s&&s.key,l=Ro(go,{key:(a&&!A(a)?a:`_${t}`)+(!s&&n?"_fb":"")},s||(n?n():[]),s&&1===e._?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),r&&r._c&&(r._d=!0),l}function un(e){return e.some(e=>!Co(e)||!(e.type===To||e.type===go&&!un(e.children)))?e:null}var hn=e=>e?Qo(e)?nr(e):hn(e.parent):null,dn=E(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>hn(e.parent),$root:e=>hn(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>On(e),$forceUpdate:e=>e.f||=()=>{oi(e.update)},$nextTick:e=>e.n||=ni.bind(e.proxy),$watch:e=>bi.bind(e)}),pn=(e,t)=>e!==p&&!e.__isScriptSetup&&v(e,t),fn={get({_:e},t){if("__v_skip"===t)return!0;
3let{ctx:i,setupState:n,data:o,props:r,accessCache:s,type:a,appContext:l}=e;if("$"!==t[0]){let e=s[t];if(void 0!==e)switch(e){case 1:return n[t];case 2:return o[t];case 4:return i[t];case 3:return r[t]}else{if(pn(n,t))return s[t]=1,n[t];if(o!==p&&v(o,t))return s[t]=2,o[t];if(v(r,t))return s[t]=3,r[t];if(i!==p&&v(i,t))return s[t]=4,i[t];Tn&&(s[t]=0)}}let c,u,h=dn[t];return h?("$attrs"===t&&He(e.attrs,0,""),h(e)):(c=a.__cssModules)&&(c=c[t])?c:i!==p&&v(i,t)?(s[t]=4,i[t]):(u=l.config.globalProperties,v(u,t)?u[t]:void 0)},set({_:e},t,i){let{data:n,setupState:o,ctx:r}=e;return pn(o,t)?(o[t]=i,!0):n!==p&&v(n,t)?(n[t]=i,!0):!v(e.props,t)&&(("$"!==t[0]||!(t.slice(1)in e))&&(r[t]=i,!0))},has({_:{data:e,setupState:t,accessCache:i,ctx:n,appContext:o,props:r,type:s}},a){let l;return!!(i[a]||e!==p&&"$"!==a[0]&&v(e,a)||pn(t,a)||v(r,a)||v(n,a)||v(dn,a)||v(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,i){return null==i.get?v(i,"value")&&this.set(e,t,i.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,i)}};function gn(e){return I(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function mn(e,t){return e&&t?I(e)&&I(t)?e.concat(t):E({},gn(e),gn(t)):e||t}var Tn=!0;function _n(e){let t=On(e),i=e.proxy,n=e.ctx;Tn=!1,t.beforeCreate&&En(t.beforeCreate,e,"bc");let{data:o,computed:r,methods:s,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:p,updated:f,activated:m,deactivated:T,beforeDestroy:_,beforeUnmount:E,destroyed:b,unmounted:O,render:v,renderTracked:S,renderTriggered:y,errorCaptured:R,serverPrefetch:k,expose:A,inheritAttrs:N,components:w,directives:$,filters:M}=t;if(c&&function(e,t){I(e)&&(e=yn(e));for(let i in e){let n,o=e[i];n=L(o)?"default"in o?mi(o.from||i,o.default,!0):mi(o.from||i):mi(o),Nt(n)?Object.defineProperty(t,i,{enumerable:!0,configurable:!0,get:()=>n.value,set:e=>n.value=e}):t[i]=n}}(c,n,null),s)for(let g in s){let e=s[g];C(e)&&(n[g]=e.bind(i))}if(o){let t=o.call(i,i);L(t)&&(e.data=bt(t))}if(Tn=!0,r)for(let I in r){let e=r[I],t=or({get:C(e)?e.bind(i,i):C(e.get)?e.get.bind(i,i):g,set:!C(e)&&C(e.set)?e.set.bind(i):g});Object.defineProperty(n,I,{enumerable:!0,configurable:!0,get:()=>t.value,set:e=>t.value=e})}if(a)for(let g in a)bn(a[g],n,i,g);if(l){let e=C(l)?l.call(i):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){if(Xo){let i=Xo.provides,n=Xo.parent&&Xo.parent.provides;n===i&&(i=Xo.provides=Object.create(n)),i[e]=t}}(t,e[t])})}function x(e,t){I(t)?t.forEach(t=>e(t.bind(i))):t&&e(t.bind(i))}if(u&&En(u,e,"c"),x(Ki,h),x(qi,d),x(Ji,p),x(Zi,f),x(Wi,m),x(Xi,T),x(sn,R),x(rn,S),x(on,y),x(en,E),x(tn,O),x(nn,k),I(A))if(A.length){let t=e.exposed||={};A.forEach(e=>{Object.defineProperty(t,e,{get:()=>i[e],set:t=>i[e]=t,enumerable:!0})})}else e.exposed||={};v&&e.render===g&&(e.render=v),null!=N&&(e.inheritAttrs=N),w&&(e.components=w),$&&(e.directives=$),k&&Di(e)}function En(e,t,i){Yt(I(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,i)}function bn(e,t,i,n){let o=n.includes(".")?Oi(i,n):()=>i[n];if(k(e)){let i=t[e];C(i)&&_i(o,i)}else if(C(e))_i(o,e.bind(i));else if(L(e))if(I(e))e.forEach(e=>bn(e,t,i,n));else{let n=C(e.handler)?e.handler.bind(i):t[e.handler];C(n)&&_i(o,n,e)}}function On(e){let t,i=e.type,{mixins:n,extends:o}=i,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,l=s.get(i);return l?t=l:r.length||n||o?(t={},r.length&&r.forEach(e=>vn(t,e,a,!0)),vn(t,i,a)):t=i,L(i)&&s.set(i,t),t}function vn(e,t,i,n=!1){let{mixins:o,extends:r}=t;r&&vn(e,r,i,!0),o&&o.forEach(t=>vn(e,t,i,!0));for(let s in t)if(n&&"expose"===s);else{let n=In[s]||i&&i[s];e[s]=n?n(e[s],t[s]):t[s]}return e}var In={data:Sn,props:kn,emits:kn,methods:Cn,computed:Cn,beforeCreate:Rn,created:Rn,beforeMount:Rn,mounted:Rn,beforeUpdate:Rn,updated:Rn,beforeDestroy:Rn,beforeUnmount:Rn,destroyed:Rn,unmounted:Rn,activated:Rn,deactivated:Rn,errorCaptured:Rn,serverPrefetch:Rn,components:Cn,directives:Cn,watch:function(e,t){if(!e)return t;if(!t)return e;let i=E(Object.create(null),e);for(let n in t)i[n]=Rn(e[n],t[n]);return i},provide:Sn,inject:function(e,t){return Cn(yn(e),yn(t))}};function Sn(e,t){return t?e?function(){return E(C(e)?e.call(this,this):e,C(t)?t.call(this,this):t)}:t:e}function yn(e){if(I(e)){let t={};for(let i=0;i<e.length;i++)t[e[i]]=e[i];return t}return e}function Rn(e,t){return e?[...new Set([].concat(e,t))]:t}function Cn(e,t){return e?E(Object.create(null),e,t):t}function kn(e,t){return e?I(e)&&I(t)?[...new Set([...e,...t])]:E(Object.create(null),gn(e),gn(t??{})):t}function An(){return{app:null,config:{isNativeTag:m,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var Ln=0;function Nn(e,t){return function(i,n=null){C(i)||(i=E({},i)),null!=n&&!L(n)&&(n=null);let o=An(),r=new WeakSet,s=[],a=!1,l=o.app={_uid:Ln++,_component:i,_props:n,_container:null,_context:o,_instance:null,version:sr,get config(){return o.config},set config(e){},use:(e,...t)=>(r.has(e)||(e&&C(e.install)?(r.add(e),e.install(l,...t)):C(e)&&(r.add(e),e(l,...t))),l),mixin:e=>(o.mixins.includes(e)||o.mixins.push(e),l),component:(e,t)=>
3t?(o.components[e]=t,l):o.components[e],directive:(e,t)=>t?(o.directives[e]=t,l):o.directives[e],mount(r,s,c){if(!a){let u=l._ceVNode||wo(i,n);return u.appContext=o,!0===c?c="svg":!1===c&&(c=void 0),s&&t?t(u,r):e(u,r,c),a=!0,l._container=r,r.__vue_app__=l,nr(u.component)}},onUnmount(e){s.push(e)},unmount(){a&&(Yt(s,l._instance,16),e(null,l._container),delete l._container.__vue_app__)},provide:(e,t)=>(o.provides[e]=t,l),runWithContext(e){let t=wn;wn=l;try{return e()}finally{wn=t}}};return l}}var wn=null;function $n(e,t,i=p){let n=zo(),o=B(t),r=H(t),s=Mn(e,o),a=function(e){return new Bt(e)}((s,a)=>{let l,c,u=p;return function(e){Ei(e,null,{flush:"sync"})}(()=>{let t=e[o];W(l,t)&&(l=t,a())}),{get:()=>(s(),i.get?i.get(l):l),set(e){let s=i.set?i.set(e):e;if(!(W(s,l)||u!==p&&W(e,u)))return;let h=n.vnode.props;h&&(t in h||o in h||r in h)&&(`onUpdate:${t}`in h||`onUpdate:${o}`in h||`onUpdate:${r}`in h)||(l=e,a()),n.emit(`update:${t}`,s),W(e,s)&&W(e,u)&&!W(s,c)&&a(),u=e,c=s}}});return a[Symbol.iterator]=()=>{let e=0;return{next:()=>e<2?{value:e++?s||p:a,done:!1}:{done:!0}}},a}var Mn=(e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${B(t)}Modifiers`]||e[`${H(t)}Modifiers`];function xn(e,t,...i){if(e.isUnmounted)return;let n=e.vnode.props||p,o=i,r=t.startsWith("update:"),s=r&&Mn(n,t.slice(7));s&&(s.trim&&(o=i.map(e=>k(e)?e.trim():e)),s.number&&(o=i.map(j)));let a,l=n[a=G(t)]||n[a=G(B(t))];!l&&r&&(l=n[a=G(H(t))]),l&&Yt(l,e,6,o);let c=n[a+"Once"];if(c){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,Yt(c,e,6,o)}}var Dn=new WeakMap;function Pn(e,t,i=!1){let n=i?Dn:t.emitsCache,o=n.get(e);if(void 0!==o)return o;let r=e.emits,s={},a=!1;if(!C(e)){let n=e=>{let i=Pn(e,t,!0);i&&(a=!0,E(s,i))};!i&&t.mixins.length&&t.mixins.forEach(n),e.extends&&n(e.extends),e.mixins&&e.mixins.forEach(n)}return r||a?(I(r)?r.forEach(e=>s[e]=null):E(s,r),L(e)&&n.set(e,s),s):(L(e)&&n.set(e,null),null)}function Fn(e,t){return!(!e||!T(t))&&(t=t.slice(2).replace(/Once$/,""),v(e,t[0].toLowerCase()+t.slice(1))||v(e,H(t))||v(e,t))}function Bn(e){let t,i,{type:n,vnode:o,proxy:r,withProxy:s,propsOptions:[a],slots:l,attrs:c,emit:u,render:h,renderCache:d,props:p,data:f,setupState:g,ctx:m,inheritAttrs:T}=e,E=di(e);try{if(4&o.shapeFlag){let e=s||r,n=e;t=Po(h.call(n,e,d,p,g,f,m)),i=c}else{let e=n;t=Po(e.length>1?e(p,{attrs:c,slots:l,emit:u}):e(p,null)),i=n.props?c:Un(c)}}catch(n){Eo.length=0,Qt(n,e,1),t=wo(To)}let b=t;if(i&&!1!==T){let e=Object.keys(i),{shapeFlag:t}=b;e.length&&7&t&&(a&&e.some(_)&&(i=Hn(i,a)),b=$o(b,i,!1,!0))}return o.dirs&&(b=$o(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(o.dirs):o.dirs),o.transition&&Mi(b,o.transition),t=b,di(E),t}var Un=e=>{let t;for(let i in e)("class"===i||"style"===i||T(i))&&((t||={})[i]=e[i]);return t},Hn=(e,t)=>{let i={};for(let n in e)(!_(n)||!(n.slice(9)in t))&&(i[n]=e[n]);return i};function Vn(e,t,i){let n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(let o=0;o<n.length;o++){let r=n[o];if(Gn(t,e,r)&&!Fn(i,r))return!0}return!1}function Gn(e,t,i){let n=e[i],o=t[i];return"style"===i&&L(n)&&L(o)?!oe(n,o):n!==o}var Wn={},Xn=()=>Object.create(Wn),zn=e=>Object.getPrototypeOf(e)===Wn;function jn(e,t,i,n){let{props:o,attrs:r,vnode:{patchFlag:s}}=e,a=kt(o),[l]=e.propsOptions,c=!1;if(!(n||s>0)||16&s){let n;Yn(e,t,o,r)&&(c=!0);for(let r in a)(!t||!v(t,r)&&((n=H(r))===r||!v(t,n)))&&(l?i&&(void 0!==i[r]||void 0!==i[n])&&(o[r]=Qn(l,a,r,void 0,e,!0)):delete o[r]);if(r!==a)for(let e in r)(!t||!v(t,e))&&(delete r[e],c=!0)}else if(8&s){let i=e.vnode.dynamicProps;for(let n=0;n<i.length;n++){let s=i[n];if(Fn(e.emitsOptions,s))continue;let u=t[s];if(l)if(v(r,s))u!==r[s]&&(r[s]=u,c=!0);else{let t=B(s);o[t]=Qn(l,a,t,u,e,!1)}else u!==r[s]&&(r[s]=u,c=!0)}}c&&Ve(e.attrs,"set","")}function Yn(e,t,i,n){let o,[r,s]=e.propsOptions,a=!1;if(t)for(let l in t){if(D(l))continue;let c,u=t[l];r&&v(r,c=B(l))?s&&s.includes(c)?(o||={})[c]=u:i[c]=u:Fn(e.emitsOptions,l)||(!(l in n)||u!==n[l])&&(n[l]=u,a=!0)}if(s){let t=kt(i),n=o||p;for(let o=0;o<s.length;o++){let a=s[o];i[a]=Qn(r,t,a,n[a],e,!v(n,a))}}return a}function Qn(e,t,i,n,o,r){let s=e[i];if(null!=s){let e=v(s,"default");if(e&&void 0===n){let e=s.default;if(s.type!==Function&&!s.skipFactory&&C(e)){let{propsDefaults:r}=o;if(i in r)n=r[i];else{let s=jo(o);n=r[i]=e.call(null,t),s()}}else n=e;o.ce&&o.ce._setProp(i,n)}s[0]&&(r&&!e?n=!1:s[1]&&(""===n||n===H(i))&&(n=!0))}return n}var Kn=new WeakMap;function qn(e,t,i=!1){let n=i?Kn:t.propsCache,o=n.get(e);if(o)return o;let r=e.props,s={},a=[],l=!1;if(!C(e)){let n=e=>{l=!0;let[i,n]=qn(e,t,!0);E(s,i),n&&a.push(...n)};!i&&t.mixins.length&&t.mixins.forEach(n),e.extends&&n(e.extends),e.mixins&&e.mixins.forEach(n)}if(!r&&!l)return L(e)&&n.set(e,f),f;if(I(r))for(let u=0;u<r.length;u++){let e=B(r[u]);Jn(e)&&(s[e]=p)}else if(r)for(let u in r){let e=B(u);if(Jn(e)){let t=r[u],i=s[e]=I(t)||C(t)?{type:t}:E({},t),n=i.type,o=!1,l=!0;if(I(n))for(let e=0;e<n.length;++e){let t=n[e],i=C(t)&&t.name;if("Boolean"===i){o=!0;break}"String"===i&&(l=!1)}else o=C(n)&&"Boolean"===n.name;i[0]=o,i[1]=l,(o||v(i,"default"))&&a.push(e)}}let c=[s,a];return L(e)&&n.set(e,c),c}function Jn(e){return"$"!==e[0]&&!D(e)}var Zn=e=>"_"===e||"_ctx"===e||"$stable"===e,eo=e=>I(e)?e.map(Po):[Po(e)],to=(e,t,i)=>{if(t._n)return t;let n=pi((...e)=>eo(t(...e)),i);return n._c=!1,n},io=(e,t,i)=>{let n=e._ctx;for(let o in e){if(Zn(o))continue;let i=e[o];if(C(i))t[o]=to(0,i,n);else if(null!=i){let e=eo(i);t[o]=()=>e}}},no=(e,t)=>{let i=eo(t);e.slots.default=()=>i},oo=(e,t,i)=>{for(let n in t)(i||!Zn(n))&&(e[n]=t[n])},ro=function(e,t){t&&t.pendingBranch?I(e)?t.effects.push(...e):t.effects.push(e):function(e){I(e)?Jt.push(...e):Zt&&-1===e.id?Zt.splice(ei+1,0,e):1&e.flags||(Jt.push(e),e.flags|=1),ri()}(e)};function so(e){return function(e,t){let i=Y();i.__VUE__=!0;let n,o,{insert:r,remove:s,patchProp:a,createElement:l,createText:c,createComment:u,setText:h,setElementText:d,parentNode:m,nextSibling:T,setScopeId:_=g,insertStaticContent:E}=e,b=(e,t,i,n=null,o=null,r=null,s=void 0,a=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!ko(e,t)&&(n=J(e),W(e,o,r,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);let{type:c,ref:u,shapeFlag:h}=t;switch(c){case mo:O(e,t,i,n);break;case To:v(e,t,i,n);break;case _o:e??I(t,i,n,s);break;case go:$(e,t,i,n,o,r,s,a,l);break;default:1&h?R(e,t,i,n,o,r,s,a,l):6&h?M(e,t,i,n,o,r,s,a,l):(64&h||128&h)&&c.process(e,t,i,n,o,r,s,a,l,te)}null!=u&&o?Ui(u,e&&e.ref,r,t||e,!t):null==u&&e&&null!=e.ref&&Ui(e.ref,null,r,e,!0)},O=(e,t,i,n)=>{if(null==e)r(t.el=c(t.children),i,n);else{let i=t.el=e.el;t.children!==e.children&&h(i,t.children)}},v=(e,t,i,n)=>{null==e?r(t.el=u(t.children||""),i,n):t.el=e.el},I=(e,t,i,n)=>{[e.el,e.anchor]=E(e.children,t,i,n,e.el,e.anchor)},S=({el:e,anchor:t},i,n)=>{let o;for(;e&&e!==t;)o=T(e),r(e,i,n),e=o;r(t,i,n)},y=({el:e,anchor:t})=>{let i;for(;e&&e!==t;)i=T(e),s(e),e=i;s(t)},R=(e,t,i,n,o,r,s,a,l)=>{if("svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e)C(t,i,n,o,r,s,a,l);else{let i=e.el&&e.el._isVueCE?e.el:null;try{i&&i._beginPatch(),L(e,t,o,r,s,a,l)}finally{i&&i._endPatch()}}},C=(e,t,i,n,o,s,c,u)=>{let h,p,{props:f,shapeFlag:g,transition:m,dirs:T}=e;if(h=e.el=l(e.type,s,f&&f.is,f),8&g?d(h,e.children):16&g&&A(e.children,h,null,n,o,ao(e,s),c,u),T&&gi(e,null,n,"created"),k(h,e,e.scopeId,c,n),f){for(let e in f)"value"!==e&&!D(e)&&a(h,e,null,f[e],s,n);"value"in f&&a(h,"value",null,f.value,s),(p=f.onVnodeBeforeMount)&&Uo(p,n,e)}T&&gi(e,null,n,"beforeMount");let _=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(o,m);_&&m.beforeEnter(h),r(h,t,i),((p=f&&f.onVnodeMounted)||_||T)&&ro(()=>{try{p&&Uo(p,n,e),_&&m.enter(h),T&&gi(e,null,n,"mounted")}finally{}},o)},k=(e,t,i,n,o)=>
3{if(i&&_(e,i),n)for(let r=0;r<n.length;r++)_(e,n[r]);if(o){let i=o.subTree;if(t===i||fo(i.type)&&(i.ssContent===t||i.ssFallback===t)){let t=o.vnode;k(e,t,t.scopeId,t.slotScopeIds,o.parent)}}},A=(e,t,i,n,o,r,s,a,l=0)=>{for(let c=l;c<e.length;c++)b(null,e[c]=a?Fo(e[c]):Po(e[c]),t,i,n,o,r,s,a)},L=(e,t,i,n,o,r,s)=>{let l=t.el=e.el,{patchFlag:c,dynamicChildren:u,dirs:h}=t;c|=16&e.patchFlag;let f,g=e.props||p,m=t.props||p;if(i&&lo(i,!1),(f=m.onVnodeBeforeUpdate)&&Uo(f,i,t,e),h&&gi(t,e,i,"beforeUpdate"),i&&lo(i,!0),(g.innerHTML&&null==m.innerHTML||g.textContent&&null==m.textContent)&&d(l,""),u?N(e.dynamicChildren,u,l,i,n,ao(t,o),r):s||U(e,t,l,null,i,n,ao(t,o),r,!1),c>0){if(16&c)w(l,g,m,i,o);else if(2&c&&g.class!==m.class&&a(l,"class",null,m.class,o),4&c&&a(l,"style",g.style,m.style,o),8&c){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t],r=g[n],s=m[n];(s!==r||"value"===n)&&a(l,n,r,s,o,i)}}1&c&&e.children!==t.children&&d(l,t.children)}else!s&&null==u&&w(l,g,m,i,o);((f=m.onVnodeUpdated)||h)&&ro(()=>{f&&Uo(f,i,t,e),h&&gi(t,e,i,"updated")},n)},N=(e,t,i,n,o,r,s)=>{for(let a=0;a<t.length;a++){let l=e[a],c=t[a];b(l,c,l.el&&(l.type===go||!ko(l,c)||198&l.shapeFlag)?m(l.el):i,null,n,o,r,s,!0)}},w=(e,t,i,n,o)=>{if(t!==i){if(t!==p)for(let r in t)!D(r)&&!(r in i)&&a(e,r,t[r],null,o,n);for(let r in i){if(D(r))continue;let s=i[r],l=t[r];s!==l&&"value"!==r&&a(e,r,l,s,o,n)}"value"in i&&a(e,"value",t.value,i.value,o)}},$=(e,t,i,n,o,s,a,l,u)=>{let h=t.el=e?e.el:c(""),d=t.anchor=e?e.anchor:c(""),{patchFlag:p,dynamicChildren:f,slotScopeIds:g}=t;g&&(l=l?l.concat(g):g),null==e?(r(h,i,n),r(d,i,n),A(t.children||[],i,d,o,s,a,l,u)):p>0&&64&p&&f&&e.dynamicChildren&&e.dynamicChildren.length===f.length?(N(e.dynamicChildren,f,i,o,s,a,l),(null!=t.key||o&&t===o.subTree)&&co(e,t,!0)):U(e,t,i,d,o,s,a,l,u)},M=(e,t,i,n,o,r,s,a,l)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?o.ctx.activate(t,i,n,s,l):x(t,i,n,o,r,s,l):P(e,t,l)},x=(e,t,i,n,o,r,s)=>{let a=e.component=function(e,t,i){let n=e.type,o=(t?t.appContext:e.appContext)||Ho,r={uid:Vo++,vnode:e,type:n,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new de(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:qn(n,o),emitsOptions:Pn(n,o),emit:null,emitted:null,propsDefaults:p,inheritAttrs:n.inheritAttrs,ctx:p,data:p,props:p,attrs:p,slots:p,refs:p,setupState:p,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=xn.bind(null,r),e.ce&&e.ce(r),r}(e,n,o);if(Gi(e)&&(a.ctx.renderer=te),function(e,t=!1,i=!1){t&&Wo(t);let{props:n,children:o}=e.vnode,r=Qo(e);(function(e,t,i,n=!1){let o={},r=Xn();e.propsDefaults=Object.create(null),Yn(e,t,o,r);for(let s in e.propsOptions[0])s in o||(o[s]=void 0);i?e.props=n?o:Ot(o):e.type.props?e.props=o:e.props=r,e.attrs=r})(e,n,r,t),((e,t,i)=>{let n=e.slots=Xn();if(32&e.vnode.shapeFlag){let e=t._;e?(oo(n,t,i),i&&z(n,"_",e,!0)):io(t,n)}else t&&no(e,t)})(e,o,i||t);let s=r?Zo(e,t):void 0;t&&Wo(!1)}(a,!1,s),a.asyncDep){if(o&&o.registerDep(a,F,s),!e.el){let n=a.subTree=wo(To);v(null,n,t,i),e.placeholder=n.el}}else F(a,e,t,i,o,r,s)},P=(e,t,i)=>{let n=t.component=e.component;if(function(e,t,i){let{props:n,children:o,component:r}=e,{props:s,children:a,patchFlag:l}=t,c=r.emitsOptions;if(t.dirs||t.transition)return!0;if(!(i&&l>=0))return!(!o&&!a||a&&a.$stable)||n!==s&&(n?!s||Vn(n,s,c):!!s);if(1024&l)return!0;if(16&l)return n?Vn(n,s,c):!!s;if(8&l){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let i=e[t];if(Gn(s,n,i)&&!Fn(c,i))return!0}}return!1}(e,t,i)){if(n.asyncDep&&!n.asyncResolved)return void B(n,t,i);n.next=t,n.update()}else t.el=e.el,n.vnode=t},F=(e,t,i,n,r,s,a)=>{let l=()=>{if(e.isMounted){let{next:t,bu:i,u:n,parent:o,vnode:l}=e;{let i=uo(e);if(i)return t&&(t.el=l.el,B(e,t,a)),void i.asyncDep.then(()=>{ro(()=>{e.isUnmounted||u()},r)})}let c,h=t;lo(e,!1),t?(t.el=l.el,B(e,t,a)):t=l,i&&X(i),(c=t.props&&t.props.onVnodeBeforeUpdate)&&Uo(c,o,t,l),lo(e,!0);let d=Bn(e),p=e.subTree;e.subTree=d,b(p,d,m(p.el),J(p),e,r,s),t.el=d.el,null===h&&function({vnode:e,parent:t,suspense:i},n){for(;t;){let i=t.subTree;if(i.suspense&&i.suspense.activeBranch===e&&(i.suspense.vnode.el=i.el=n,e=i),i!==e)break;(e=t.vnode).el=n,t=t.parent}i&&i.activeBranch===e&&(i.vnode.el=n)}(e,d.el),n&&ro(n,r),(c=t.props&&t.props.onVnodeUpdated)&&ro(()=>Uo(c,o,t,l),r)}else{let a,{el:l,props:c}=t,{bm:u,m:h,parent:d,root:p,type:f}=e,g=Vi(t);if(lo(e,!1),u&&X(u),!g&&(a=c&&c.onVnodeBeforeMount)&&Uo(a,d,t),lo(e,!0),l&&o){let t=()=>{e.subTree=Bn(e),o(l,e.subTree,e,r,null)};g&&f.__asyncHydrate?f.__asyncHydrate(l,e,t):t()}
3else{p.ce&&p.ce._hasShadowRoot()&&p.ce._injectChildStyle(f,e.parent?e.parent.type:void 0);let o=e.subTree=Bn(e);b(null,o,i,n,e,r,s),t.el=o.el}if(h&&ro(h,r),!g&&(a=c&&c.onVnodeMounted)){let e=t;ro(()=>Uo(a,d,e),r)}(256&t.shapeFlag||d&&Vi(d.vnode)&&256&d.vnode.shapeFlag)&&e.a&&ro(e.a,r),e.isMounted=!0,t=i=n=null}};e.scope.on();let c=e.effect=new Te(l);e.scope.off();let u=e.update=c.run.bind(c),h=e.job=c.runIfDirty.bind(c);h.i=e,h.id=e.uid,c.scheduler=()=>oi(h),lo(e,!0),u()},B=(e,t,i)=>{t.component=e;let n=e.vnode.props;e.vnode=t,e.next=null,jn(e,t.props,n,i),((e,t,i)=>{let{vnode:n,slots:o}=e,r=!0,s=p;if(32&n.shapeFlag){let e=t._;e?i&&1===e?r=!1:oo(o,t,i):(r=!t.$stable,io(t,o)),s=t}else t&&(no(e,t),s={default:1});if(r)for(let a in o)!Zn(a)&&null==s[a]&&delete o[a]})(e,t.children,i),Le(),si(e),Ne()},U=(e,t,i,n,o,r,s,a,l=!1)=>{let c=e&&e.children,u=e?e.shapeFlag:0,h=t.children,{patchFlag:p,shapeFlag:f}=t;if(p>0){if(128&p)return void V(c,h,i,n,o,r,s,a,l);if(256&p)return void H(c,h,i,n,o,r,s,a,l)}8&f?(16&u&&q(c,o,r),h!==c&&d(i,h)):16&u?16&f?V(c,h,i,n,o,r,s,a,l):q(c,o,r,!0):(8&u&&d(i,""),16&f&&A(h,i,n,o,r,s,a,l))},H=(e,t,i,n,o,r,s,a,l)=>{e||=f,t||=f;let c,u=e.length,h=t.length,d=Math.min(u,h);for(c=0;c<d;c++){let n=t[c]=l?Fo(t[c]):Po(t[c]);b(e[c],n,i,null,o,r,s,a,l)}u>h?q(e,o,r,!0,!1,d):A(t,i,n,o,r,s,a,l,d)},V=(e,t,i,n,o,r,s,a,l)=>{let c=0,u=t.length,h=e.length-1,d=u-1;for(;c<=h&&c<=d;){let n=e[c],u=t[c]=l?Fo(t[c]):Po(t[c]);if(!ko(n,u))break;b(n,u,i,null,o,r,s,a,l),c++}for(;c<=h&&c<=d;){let n=e[h],c=t[d]=l?Fo(t[d]):Po(t[d]);if(!ko(n,c))break;b(n,c,i,null,o,r,s,a,l),h--,d--}if(c>h){if(c<=d){let e=d+1,h=e<u?t[e].el:n;for(;c<=d;)b(null,t[c]=l?Fo(t[c]):Po(t[c]),i,h,o,r,s,a,l),c++}}else if(c>d)for(;c<=h;)W(e[c],o,r,!0),c++;else{let p=c,g=c,m=new Map;for(c=g;c<=d;c++){let e=t[c]=l?Fo(t[c]):Po(t[c]);null!=e.key&&m.set(e.key,c)}let T,_=0,E=d-g+1,O=!1,v=0,I=Array(E);for(c=0;c<E;c++)I[c]=0;for(c=p;c<=h;c++){let n,u=e[c];if(_>=E)W(u,o,r,!0);else{if(null!=u.key)n=m.get(u.key);else for(T=g;T<=d;T++)if(0===I[T-g]&&ko(u,t[T])){n=T;break}void 0===n?W(u,o,r,!0):(I[n-g]=c+1,n>=v?v=n:O=!0,b(u,t[n],i,null,o,r,s,a,l),_++)}}let S=O?function(e){let t,i,n,o,r,s=e.slice(),a=[0],l=e.length;for(t=0;t<l;t++){let l=e[t];if(0!==l){if(i=a[a.length-1],e[i]<l){s[t]=i,a.push(t);continue}for(n=0,o=a.length-1;n<o;)r=n+o>>1,e[a[r]]<l?n=r+1:o=r;l<e[a[n]]&&(n>0&&(s[t]=a[n-1]),a[n]=t)}}for(n=a.length,o=a[n-1];n-- >0;)a[n]=o,o=s[o];return a}(I):f;for(T=S.length-1,c=E-1;c>=0;c--){let e=g+c,h=t[e],d=t[e+1],p=e+1<u?d.el||po(d):n;0===I[c]?b(null,h,i,p,o,r,s,a,l):O&&(T<0||c!==S[T]?G(h,i,p,2):T--)}}},G=(e,t,i,n,o=null)=>{let{el:a,type:l,transition:c,children:u,shapeFlag:h}=e;if(6&h)G(e.component.subTree,t,i,n);else if(128&h)e.suspense.move(t,i,n);else if(64&h)l.move(e,t,i,te);else if(l!==go)if(l!==_o)if(2!==n&&1&h&&c)if(0===n)c.persisted&&!a[$i]?r(a,t,i):(c.beforeEnter(a),r(a,t,i),ro(()=>c.enter(a),o));else{let{leave:n,delayLeave:o,afterLeave:l}=c,u=()=>{e.ctx.isUnmounted?s(a):r(a,t,i)},h=()=>{let e=a._isLeaving||!!a[$i];a._isLeaving&&a[$i](!0),c.persisted&&!e?u():n(a,()=>{u(),l&&l()})};o?o(a,u,h):h()}else r(a,t,i);else S(e,t,i);else{r(a,t,i);for(let e=0;e<u.length;e++)G(u[e],t,i,n);r(e.anchor,t,i)}},W=(e,t,i,n=!1,o=!1)=>{let{type:r,props:s,ref:a,children:l,dynamicChildren:c,shapeFlag:u,patchFlag:h,dirs:d,cacheIndex:p,memo:f}=e;if(-2===h&&(o=!1),null!=a&&(Le(),Ui(a,null,i,e,!0),Ne()),null!=p&&(t.renderCache[p]=void 0),256&u)return void t.ctx.deactivate(e);let g,m=1&u&&d,T=!Vi(e);if(T&&(g=s&&s.onVnodeBeforeUnmount)&&Uo(g,t,e),6&u)K(e.component,i,n);else{if(128&u)return void e.suspense.unmount(i,n);m&&gi(e,null,t,"beforeUnmount"),64&u?e.type.remove(e,t,i,te,n):c&&!c.hasOnce&&(r!==go||h>0&&64&h)?q(c,t,i,!1,!0):(r===go&&384&h||!o&&16&u)&&q(l,t,i),n&&j(e)}let _=null!=f&&null==p;(T&&(g=s&&s.onVnodeUnmounted)||m||_)&&ro(()=>{g&&Uo(g,t,e),m&&gi(e,null,t,"unmounted"),_&&(e.el=null)},i)},j=e=>{let{type:t,el:i,anchor:n,transition:o}=e;if(t===go)return void Q(i,n);if(t===_o)return void y(e);let r=()=>{s(i),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(1&e.shapeFlag&&o&&!o.persisted){let{leave:t,delayLeave:n}=o,s=()=>t(i,r);n?n(e.el,r,s):s()}else r()},Q=(e,t)=>{let i;for(;e!==t;)i=T(e),s(e),e=i;s(t)},K=(e,t,i)=>{let{bum:n,scope:o,job:r,subTree:s,um:a,m:l,a:c}=e;ho(l),ho(c),n&&X(n),o.stop(),r&&(r.flags|=8,W(s,e,t,i)),a&&ro(a,t),ro(()=>{e.isUnmounted=!0},t)},q=(e,t,i,n=!1,o=!1,r=0)=>{for(let s=r;s<e.length;
3s++)W(e[s],t,i,n,o)},J=e=>{if(6&e.shapeFlag)return J(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();let t=T(e.anchor||e.el),i=t&&t[Ii];return i?T(i):t},Z=!1,ee=(e,t,i)=>{let n;null==e?t._vnode&&(W(t._vnode,null,null,!0),n=t._vnode.component):b(t._vnode||null,e,t,null,null,null,i),t._vnode=e,Z||=(Z=!0,si(n),ai(),!1)},te={p:b,um:W,m:G,r:j,mt:x,mc:A,pc:U,pbc:N,n:J,o:e};return t&&([n,o]=t(te)),{render:ee,hydrate:n,createApp:Nn(ee,n)}}(e)}function ao({type:e,props:t},i){return"svg"===i&&"foreignObject"===e||"mathml"===i&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:i}function lo({effect:e,job:t},i){i?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function co(e,t,i=!1){let n=e.children,o=t.children;if(I(n)&&I(o))for(let r=0;r<n.length;r++){let e=n[r],t=o[r];1&t.shapeFlag&&!t.dynamicChildren&&((t.patchFlag<=0||32===t.patchFlag)&&(t=o[r]=Fo(o[r]),t.el=e.el),!i&&-2!==t.patchFlag&&co(e,t)),t.type===mo&&(-1===t.patchFlag&&(t=o[r]=Fo(t)),t.el=e.el),t.type===To&&!t.el&&(t.el=e.el)}}function uo(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:uo(t)}function ho(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function po(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?po(t.subTree):null}var fo=e=>e.__isSuspense;var go=Symbol.for("v-fgt"),mo=Symbol.for("v-txt"),To=Symbol.for("v-cmt"),_o=Symbol.for("v-stc"),Eo=[],bo=null;function Oo(e=!1){Eo.push(bo=e?null:[])}var vo=1;function Io(e,t=!1){vo+=e,e<0&&bo&&t&&(bo.hasOnce=!0)}function So(e){return e.dynamicChildren=vo>0?bo||f:null,Eo.pop(),bo=Eo[Eo.length-1]||null,vo>0&&bo&&bo.push(e),e}function yo(e,t,i,n,o,r){return So(No(e,t,i,n,o,r,!0))}function Ro(e,t,i,n,o){return So(wo(e,t,i,n,o,!0))}function Co(e){return!!e&&!0===e.__v_isVNode}function ko(e,t){return e.type===t.type&&e.key===t.key}var Ao=({key:e})=>e??null,Lo=({ref:e,ref_key:t,ref_for:i})=>("number"==typeof e&&(e=""+e),null==e?null:k(e)||Nt(e)||C(e)?{i:ui,r:e,k:t,f:!!i}:e);function No(e,t=null,i=null,n=0,o=null,r=(e===go?0:1),s=!1,a=!1){let l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ao(t),ref:t&&Lo(t),scopeId:hi,slotScopeIds:null,children:i,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:n,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:ui};return a?(Bo(l,i),128&r&&e.normalize(l)):i&&(l.shapeFlag|=k(i)?8:16),vo>0&&!s&&bo&&(l.patchFlag>0||6&r)&&32!==l.patchFlag&&bo.push(l),l}var wo=function(e,t=null,i=null,n=0,o=null,r=!1){if((!e||e===an)&&(e=To),Co(e)){let n=$o(e,t,!0);return i&&Bo(n,i),vo>0&&!r&&bo&&(6&n.shapeFlag?bo[bo.indexOf(e)]=n:bo.push(n)),n.patchFlag=-2,n}if(function(e){return C(e)&&"__vccOpts"in e}(e)&&(e=e.__vccOpts),t){t=function(e){return e?Ct(e)||zn(e)?E({},e):e:null}(t);let{class:e,style:i}=t;e&&!k(e)&&(t.class=ee(e)),L(i)&&(Ct(i)&&!I(i)&&(i=E({},i)),t.style=Q(i))}let s=k(e)?1:fo(e)?128:(e=>e.__isTeleport)(e)?64:L(e)?4:C(e)?2:0;return No(e,t,i,n,o,s,r,!0)};function $o(e,t,i=!1,n=!1){let{props:o,ref:r,patchFlag:s,children:a,transition:l}=e,c=t?function(...e){let t={};for(let i=0;i<e.length;i++){let n=e[i];for(let e in n)if("class"===e)t.class!==n.class&&(t.class=ee([t.class,n.class]));else if("style"===e)t.style=Q([t.style,n.style]);else if(T(e)){let i=t[e],o=n[e];!o||i===o||I(i)&&i.includes(o)?null==o&&null==i&&!_(e)&&(t[e]=o):t[e]=i?[].concat(i,o):o}else""!==e&&(t[e]=n[e])}return t}(o||{},t):o,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ao(c),ref:t&&t.ref?i&&r?I(r)?r.concat(Lo(t)):[r,Lo(t)]:Lo(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==go?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&$o(e.ssContent),ssFallback:e.ssFallback&&$o(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&n&&Mi(u,l.clone(u)),u}function Mo(e=" ",t=0){return wo(mo,null,e,t)}function xo(e,t){let i=wo(_o,null,e);return i.staticCount=t,i}
3function Do(e="",t=!1){return t?(Oo(),Ro(To,null,e)):wo(To,null,e)}function Po(e){return null==e||"boolean"==typeof e?wo(To):I(e)?wo(go,null,e.slice()):Co(e)?Fo(e):wo(mo,null,String(e))}function Fo(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:$o(e)}function Bo(e,t){let i=0,{shapeFlag:n}=e;if(null==t)t=null;else if(I(t))i=16;else if("object"==typeof t){if(65&n){let i=t.default;return void(i&&(i._c&&(i._d=!1),Bo(e,i()),i._c&&(i._d=!0)))}{i=32;let n=t._;n||zn(t)?3===n&&ui&&(1===ui.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=ui}}else C(t)?(t={default:t,_ctx:ui},i=32):(t=String(t),64&n?(i=16,t=[Mo(t)]):i=8);e.children=t,e.shapeFlag|=i}function Uo(e,t,i,n=null){Yt(e,t,7,[i,n])}var Ho=An(),Vo=0;var Go,Wo,Xo=null,zo=()=>Xo||ui;{let e=Y(),t=(t,i)=>{let n;return(n=e[t])||(n=e[t]=[]),n.push(i),e=>{n.length>1?n.forEach(t=>t(e)):n[0](e)}};Go=t("__VUE_INSTANCE_SETTERS__",e=>Xo=e),Wo=t("__VUE_SSR_SETTERS__",e=>Jo=e)}var jo=e=>{let t=Xo;return Go(e),e.scope.on(),()=>{e.scope.off(),Go(t)}},Yo=()=>{Xo&&Xo.scope.off(),Go(null)};function Qo(e){return 4&e.vnode.shapeFlag}var Ko,qo,Jo=!1;function Zo(e,t){let i=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,fn);let{setup:n}=i;if(n){Le();let i=e.setupContext=n.length>1?function(e){let t=t=>{e.exposed=t||{}};return{attrs:new Proxy(e.attrs,ir),slots:e.slots,emit:e.emit,expose:t}}(e):null,o=jo(e),r=jt(n,e,0,[e.props,i]),s=N(r);if(Ne(),o(),(s||e.sp)&&!Vi(e)&&Di(e),s){if(r.then(Yo,Yo),t)return r.then(i=>{er(e,i,t)}).catch(t=>{Qt(t,e,0)});e.asyncDep=r}else er(e,r,t)}else tr(e,t)}function er(e,t,i){C(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:L(t)&&(e.setupState=Ft(t)),tr(e,i)}function tr(e,t,i){let n=e.type;if(!e.render){if(!t&&Ko&&!n.render){let t=n.template||On(e).template;if(t){let{isCustomElement:i,compilerOptions:o}=e.appContext.config,{delimiters:r,compilerOptions:s}=n;n.render=Ko(t,E(E({isCustomElement:i,delimiters:r},o),s))}}e.render=n.render||g,qo&&qo(e)}{let t=jo(e);Le();try{_n(e)}finally{Ne(),t()}}}var ir={get:(e,t)=>(He(e,0,""),e[t])};function nr(e){return e.exposed?e.exposeProxy||=new Proxy(Ft(function(e){return!v(e,"__v_skip")&&Object.isExtensible(e)&&z(e,"__v_skip",!0),e}(e.exposed)),{get:(t,i)=>i in t?t[i]:i in dn?dn[i](e):void 0,has:(e,t)=>t in e||t in dn}):e.proxy}var or=(e,t)=>Ht(e,0,Jo);function rr(e,t,i){try{Io(-1);let n=arguments.length;return 2===n?L(t)&&!I(t)?Co(t)?wo(e,null,[t]):wo(e,t):wo(e,null,t):(n>3?i=Array.prototype.slice.call(arguments,2):3===n&&Co(i)&&(i=[i]),wo(e,t,i))}finally{Io(1)}}var sr="3.5.35",ar=void 0,lr=typeof window<"u"&&window.trustedTypes;if(lr)try{ar=lr.createPolicy("vue",{createHTML:e=>e})}catch(e){}var cr=ar?e=>ar.createHTML(e):e=>e,ur=typeof document<"u"?document:null,hr=ur&&ur.createElement("template"),dr={insert:(e,t,i)=>{t.insertBefore(e,i||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,i,n)=>{let o="svg"===t?ur.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?ur.createElementNS("http://www.w3.org/1998/Math/MathML",e):i?ur.createElement(e,{is:i}):ur.createElement(e);return"select"===e&&n&&null!=n.multiple&&o.setAttribute("multiple",n.multiple),o},createText:e=>ur.createTextNode(e),createComment:e=>ur.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>
3{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ur.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,i,n,o,r){let s=i?i.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),i),o!==r&&(o=o.nextSibling););else{hr.innerHTML=cr("svg"===n?`<svg>${e}</svg>`:"mathml"===n?`<math>${e}</math>`:e);let o=hr.content;if("svg"===n||"mathml"===n){let e=o.firstChild;for(;e.firstChild;)o.appendChild(e.firstChild);o.removeChild(e)}t.insertBefore(o,i)}return[s?s.nextSibling:t.firstChild,i?i.previousSibling:t.lastChild]}},pr=Symbol("_vtc");var fr=Symbol("_vod"),gr=Symbol("_vsh"),mr={name:"show",beforeMount(e,{value:t},{transition:i}){e[fr]="none"===e.style.display?"":e.style.display,i&&t?i.beforeEnter(e):Tr(e,t)},mounted(e,{value:t},{transition:i}){i&&t&&i.enter(e)},updated(e,{value:t,oldValue:i},{transition:n}){!t!=!i&&(n?t?(n.beforeEnter(e),Tr(e,!0),n.enter(e)):n.leave(e,()=>{Tr(e,!1)}):Tr(e,t))},beforeUnmount(e,{value:t}){Tr(e,t)}};function Tr(e,t){e.style.display=t?e[fr]:"none",e[gr]=!t}var _r=Symbol(""),Er=/(?:^|;)\s*display\s*:/;var br=/\s*!important$/;function Or(e,t,i){if(I(i))i.forEach(i=>Or(e,t,i));else if(i??="",t.startsWith("--"))e.setProperty(t,i);else{let n=function(e,t){let i=Ir[t];if(i)return i;let n=B(t);if("filter"!==n&&n in e)return Ir[t]=n;n=V(n);for(let o=0;o<vr.length;o++){let i=vr[o]+n;if(i in e)return Ir[t]=i}return t}(e,t);br.test(i)?e.setProperty(H(n),i.replace(br,""),"important"):e[n]=i}}var vr=["Webkit","Moz","ms"],Ir={};function Sr(e,t,i,n){return"TEXTAREA"===e.tagName&&("width"===t||"height"===t)&&k(n)&&i===n}var yr="http://www.w3.org/1999/xlink";function Rr(e,t,i,n,o,r=ie(t)){n&&t.startsWith("xlink:")?null==i?e.removeAttributeNS(yr,t.slice(6,t.length)):e.setAttributeNS(yr,t,i):null==i||r&&!ne(i)?e.removeAttribute(t):e.setAttribute(t,r?"":A(i)?String(i):i)}function Cr(e,t,i,n,o){if("innerHTML"===t||"textContent"===t)return void(null!=i&&(e[t]="innerHTML"===t?cr(i):i));let r=e.tagName;if("value"===t&&"PROGRESS"!==r&&!r.includes("-")){let n="OPTION"===r?e.getAttribute("value")||"":e.value,o=null==i?"checkbox"===e.type?"on":"":String(i);return(n!==o||!("_value"in e))&&(e.value=o),i??e.removeAttribute(t),void(e._value=i)}let s=!1;if(""===i||null==i){let n=typeof e[t];"boolean"===n?i=ne(i):null==i&&"string"===n?(i="",s=!0):"number"===n&&(i=0,s=!0)}try{e[t]=i}catch(e){}s&&e.removeAttribute(o||t)}function kr(e,t,i,n){e.addEventListener(t,i,n)}var Ar=Symbol("_vei");function Lr(e,t,i,n,o=null){let r=e[Ar]||(e[Ar]={}),s=r[t];if(n&&s)s.value=n;else{let[i,a]=function(e){let t;if(Nr.test(e)){let i;for(t={};i=e.match(Nr);)e=e.slice(0,e.length-i[0].length),t[i[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):H(e.slice(2)),t]}(t);n?kr(e,i,r[t]=function(e,t){let i=e=>{if(e._vts){if(e._vts<=i.attached)return}else e._vts=Date.now();let n=i.value;if(I(n)){let i=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{i.call(e),e._stopped=!0};let o=n.slice(),r=[e];for(let n=0;n<o.length&&!e._stopped;n++){let e=o[n];e&&Yt(e,t,5,r)}}else Yt(n,t,5,[e])};return i.value=e,i.attached=Mr(),i}(n,o),a):s&&(function(e,t,i,n){e.removeEventListener(t,i,n)}(e,i,s,a),r[t]=void 0)}}var Nr=/(?:Once|Passive|Capture)$/;var wr=0,$r=Promise.resolve(),Mr=()=>wr||=($r.then(()=>wr=0),Date.now());var xr=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123;var Dr=e=>{let t=e.props["onUpdate:modelValue"]||!1;return I(t)?e=>X(t,e):t};function Pr(e){e.target.composing=!0}function Fr(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}var Br=Symbol("_assign");function Ur(e,t,i){return t&&(e=e.trim()),i&&(e=j(e)),e}var Hr={created(e,{modifiers:{lazy:t,trim:i,number:n}},o){e[Br]=Dr(o);let r=n||o.props&&"number"===o.props.type;kr(e,t?"change":"input",t=>{t.target.composing||e[Br](Ur(e.value,i,r))}),(i||r)&&kr(e,"change",()=>{e.value=Ur(e.value,i,r)}),t||(kr(e,"compositionstart",Pr),kr(e,"compositionend",Fr),kr(e,"change",Fr))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:i,modifiers:{lazy:n,trim:o,number:r}},s){if(e[Br]=Dr(s),e.composing)return;let a=t??"";if((!r&&"number"!==e.type||/^0\d/.test(e.value)?e.value:j(e.value))===a)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&"range"!==e.type&&(n&&t===i||o&&e.value.trim()===a)||(e.value=a)}},Vr={deep:!0,created(e,t,i){e[Br]=Dr(i),kr(e,"change",()=>{let t=e._modelValue,i=jr(e),n=e.checked,o=e[Br];if(I(t)){let e=re(t,i),r=-1!==e;if(n&&!r)o(t.concat(i));else if(!n&&r){let i=[...t];i.splice(e,1),o(i)}}else if(y(t)){let e=new Set(t);n?e.add(i):e.delete(i),o(e)}else o(Yr(e,n))})},mounted:Gr,beforeUpdate(e,t,i){e[Br]=Dr(i),Gr(e,t,i)}};function Gr(e,{value:t,oldValue:i},n){let o;if(e._modelValue=t,I(t))o=re(t,n.props.value)>-1;else if(y(t))o=t.has(n.props.value);else{if(t===i)return;o=oe(t,Yr(e,!0))}e.checked!==o&&(e.checked=o)}var Wr={created(e,{value:t},i){e.checked=oe(t,i.props.value),e[Br]=Dr(i),kr(e,"change",()=>{e[Br](jr(e))})},beforeUpdate(e,{value:t,oldValue:i},n){e[Br]=Dr(n),t!==i&&(e.checked=oe(t,n.props.value))}},Xr={deep:!0,created(e,{value:t,modifiers:{number:i}},n){let o=y(t);kr(e,"change",()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>i?j(jr(e)):jr(e));e[Br](e.multiple?o?new Set(t):t:t[0]),e._assigning=!0,ni(()=>{e._assigning=!1})}),e[Br]=Dr(n)},mounted(e,{value:t}){zr(e,t)},beforeUpdate(e,t,i){e[Br]=Dr(i)},updated(e,{value:t}){e._assigning||zr(e,t)}};function zr(e,t){let i=e.multiple,n=I(t);if(!i||n||y(t)){for(let o=0,r=e.options.length;o<r;o++){let r=e.options[o],s=jr(r);if(i)if(n){let e=typeof s;r.selected="string"===e||"number"===e?t.some(e=>String(e)===String(s)):re(t,s)>-1}else r.selected=t.has(s);else if(oe(jr(r),t))return void(e.selectedIndex!==o&&(e.selectedIndex=o))}!i&&-1!==e.selectedIndex&&(e.selectedIndex=-1)}}function jr(e){return"_value"in e?e._value:e.value}function Yr(e,t){let i=t?"_trueValue":"_falseValue";return i in e?e[i]:t}var Qr={created(e,t,i){Kr(e,t,i,null,"created")},mounted(e,t,i){Kr(e,t,i,null,"mounted")},beforeUpdate(e,t,i,n){Kr(e,t,i,n,"beforeUpdate")},updated(e,t,i,n){Kr(e,t,i,n,"updated")}};function Kr(e,t,i,n,o){let r=function(e,t){switch(e){case"SELECT":return Xr;case"TEXTAREA":return Hr;default:switch(t){case"checkbox":return Vr;case"radio":return Wr;default:return Hr}}}(e.tagName,i.props&&i.props.type)[o];r&&r(e,t,i,n)}var qr,Jr=E({patchProp:(e,t,i,n,o,r)=>{let s="svg"===o;"class"===t?function(e,t,i){let n=e[pr];n&&(t=(t?[t,...n]:[...n]).join(" ")),null==t?e.removeAttribute("class"):i?e.setAttribute("class",t):e.className=t}(e,n,s):"style"===t?function(e,t,i){let n=e.style,o=k(i),r=!1;if(i&&!o){if(t)if(k(t))for(let e of t.split(";")){let t=e.slice(0,e.indexOf(":")).trim();i[t]??Or(n,t,"")}else for(let e in t)i[e]??Or(n,e,"");for(let o in i){"display"===o&&(r=!0);let s=i[o];
3null==s?Or(n,o,""):Sr(e,o,!k(t)&&t?t[o]:void 0,s)||Or(n,o,s)}}else if(o){if(t!==i){let e=n[_r];e&&(i+=";"+e),n.cssText=i,r=Er.test(i)}}else t&&e.removeAttribute("style");fr in e&&(e[fr]=r?n.display:"",e[gr]&&(n.display="none"))}(e,i,n):T(t)?_(t)||Lr(e,t,0,n,r):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,i,n){if(n)return!!("innerHTML"===t||"textContent"===t||t in e&&xr(t)&&C(i));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t||"sandbox"===t&&"IFRAME"===e.tagName||"form"===t||"list"===t&&"INPUT"===e.tagName||"type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){let t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return(!xr(t)||!k(i))&&t in e}(e,t,n,s))?(Cr(e,t,n),!e.tagName.includes("-")&&("value"===t||"checked"===t||"selected"===t)&&Rr(e,t,n,s,0,"value"!==t)):e._isVueCE&&(function(e,t){let i=e._def.props;if(!i)return!1;let n=B(t);return Array.isArray(i)?i.some(e=>B(e)===n):Object.keys(i).some(e=>B(e)===n)}(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!k(n)))?Cr(e,B(t),n,0,t):("true-value"===t?e._trueValue=n:"false-value"===t&&(e._falseValue=n),Rr(e,t,n,s))}},dr);var Zr=(...e)=>{let t=(qr||=so(Jr)).createApp(...e),{mount:i}=t;return t.mount=e=>{let n=function(e){return k(e)?document.querySelector(e):e}(e);if(!n)return;let o=t._component;!C(o)&&!o.render&&!o.template&&(o.template=n.innerHTML),1===n.nodeType&&(n.textContent="");let r=i(n,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),r},t};var es=':root,:host{--fa-font-solid:normal 900 1em/1 "Font Awesome 7 Free";--fa-font-regular:normal 400 1em/1 "Font Awesome 7 Free";--fa-font-light:normal 300 1em/1 "Font Awesome 7 Pro";--fa-font-thin:normal 100 1em/1 "Font Awesome 7 Pro";--fa-font-duotone:normal 900 1em/1 "Font Awesome 7 Duotone";--fa-font-duotone-regular:normal 400 1em/1 "Font Awesome 7 Duotone";--fa-font-duotone-light:normal 300 1em/1 "Font Awesome 7 Duotone";--fa-font-duotone-thin:normal 100 1em/1 "Font Awesome 7 Duotone";--fa-font-brands:normal 400 1em/1 "Font Awesome 7 Brands";--fa-font-sharp-solid:normal 900 1em/1 "Font Awesome 7 Sharp";--fa-font-sharp-regular:normal 400 1em/1 "Font Awesome 7 Sharp";--fa-font-sharp-light:normal 300 1em/1 "Font Awesome 7 Sharp";--fa-font-sharp-thin:normal 100 1em/1 "Font Awesome 7 Sharp";--fa-font-sharp-duotone-solid:normal 900 1em/1 "Font Awesome 7 Sharp Duotone";--fa-font-sharp-duotone-regular:normal 400 1em/1 "Font Awesome 7 Sharp Duotone";--fa-font-sharp-duotone-light:normal 300 1em/1 "Font Awesome 7 Sharp Duotone";--fa-font-sharp-duotone-thin:normal 100 1em/1 "Font Awesome 7 Sharp Duotone";--fa-font-slab-regular:normal 400 1em/1 "Font Awesome 7 Slab";--fa-font-slab-press-regular:normal 400 1em/1 "Font Awesome 7 Slab Press";--fa-font-whiteboard-semibold:normal 600 1em/1 "Font Awesome 7 Whiteboard";--fa-font-thumbprint-light:normal 300 1em/1 "Font Awesome 7 Thumbprint";--fa-font-notdog-solid:normal 900 1em/1 "Font Awesome 7 Notdog";--fa-font-notdog-duo-solid:normal 900 1em/1 "Font Awesome 7 Notdog Duo";--fa-font-etch-solid:normal 900 1em/1 "Font Awesome 7 Etch";--fa-font-graphite-thin:normal 100 1em/1 "Font Awesome 7 Graphite";--fa-font-jelly-regular:normal 400 1em/1 "Font Awesome 7 Jelly";--fa-font-jelly-fill-regular:normal 400 1em/1 "Font Awesome 7 Jelly Fill";--fa-font-jelly-duo-regular:normal 400 1em/1 "Font Awesome 7 Jelly Duo";--fa-font-chisel-regular:normal 400 1em/1 "Font Awesome 7 Chisel";--fa-font-utility-semibold:normal 600 1em/1 "Font Awesome 7 Utility";--fa-font-utility-duo-semibold:normal 600 1em/1 "Font Awesome 7 Utility Duo";--fa-font-utility-fill-semibold:normal 600 1em/1 "Font Awesome 7 Utility Fill"}.svg-inline--fa{box-sizing:content-box;display:var(--fa-display,inline-block);vertical-align:-.125em;height:1em;width:var(--fa-width,1.25em);overflow:visible}.svg-inline--fa.fa-2xs{vertical-align:.1em}.svg-inline--fa.fa-xs{vertical-align:0}.svg-inline--fa.fa-sm{vertical-align:-.0714286em}.svg-inline--fa.fa-lg{vertical-align:-.2em}.svg-inline--fa.fa-xl{vertical-align:-.25em}.svg-inline--fa.fa-2xl{vertical-align:-.3125em}.svg-inline--fa.fa-pull-left,.svg-inline--fa .fa-pull-start{float:inline-start;margin-inline-end:var(--fa-pull-margin,.3em)}.svg-inline--fa.fa-pull-right,.svg-inline--fa .fa-pull-end{float:inline-end;margin-inline-start:var(--fa-pull-margin,.3em)}.svg-inline--fa.fa-li{width:var(--fa-li-width,2em);inset-block-start:.25em;inset-inline-start:calc(-1 * var(--fa-li-width,2em))}.fa-layers-counter,.fa-layers-text{text-align:center;display:inline-block;position:absolute}.fa-layers{text-align:center;vertical-align:-.125em;height:1em;width:var(--fa-width,1.25em);display:inline-block;position:relative}.fa-layers .svg-inline--fa{transform-origin:50%;margin:auto;position:absolute;inset:0}.fa-layers-text{transform-origin:50%;top:50%;left:50%;transform:translate(-50%,-50%)}.fa-layers-counter{background-color:var(--fa-counter-background-color,#ff253a);border-radius:var(--fa-counter-border-radius,1em);box-sizing:border-box;color:var(--fa-inverse,#fff);line-height:var(--fa-counter-line-height,1);max-width:var(--fa-counter-max-width,5em);min-width:var(--fa-counter-min-width,1.5em);padding:var(--fa-counter-padding,.25em .5em);right:var(--fa-right,0);text-overflow:ellipsis;top:var(--fa-top,0);transform:scale(var(--fa-counter-scale,.25));transform-origin:100% 0;overflow:hidden}.fa-layers-bottom-right{bottom:var(--fa-bottom,0);right:var(--fa-right,0);transform:scale(var(--fa-layers-scale,.25));transform-origin:100% 100%;top:auto}.fa-layers-bottom-left{bottom:var(--fa-bottom,0);left:var(--fa-left,0);transform:scale(var(--fa-layers-scale,.25));transform-origin:0 100%;top:auto;right:auto}.fa-layers-top-right{top:var(--fa-top,0);right:var(--fa-right,0);transform:scale(var(--fa-layers-scale,.25));transform-origin:100% 0}.fa-layers-top-left{left:var(--fa-left,0);right:auto;top:var(--fa-top,0);transform:scale(var(--fa-layers-scale,.25));transform-origin:0 0}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-2xs{vertical-align:.225em;font-size:.625em;line-height:.1em}.fa-xs{vertical-align:.125em;font-size:.75em;line-height:.0833333em}.fa-sm{vertical-align:.0535715em;font-size:.875em;line-height:.0714286em}.fa-lg{vertical-align:-.075em;font-size:1.25em;line-height:.05em}.fa-xl{vertical-align:-.125em;font-size:1.5em;line-height:.0416667em}
3.fa-2xl{vertical-align:-.1875em;font-size:2em;line-height:.03125em}.fa-width-auto{--fa-width:auto}.fa-fw,.fa-width-fixed{--fa-width:1.25em}.fa-ul{margin-inline-start:var(--fa-li-margin,2.5em);padding-inline-start:0;list-style-type:none}.fa-ul>li{position:relative}.fa-li{text-align:center;width:var(--fa-li-width,2em);line-height:inherit;position:absolute;inset-inline-start:calc(-1 * var(--fa-li-width,2em))}.fa-border{border-color:var(--fa-border-color,#eee);border-radius:var(--fa-border-radius,.1em);border-style:var(--fa-border-style,solid);border-width:var(--fa-border-width,.0625em);box-sizing:var(--fa-border-box-sizing,content-box);padding:var(--fa-border-padding,.1875em .25em)}.fa-pull-left,.fa-pull-start{float:inline-start;margin-inline-end:var(--fa-pull-margin,.3em)}.fa-pull-right,.fa-pull-end{float:inline-end;margin-inline-start:var(--fa-pull-margin,.3em)}.fa-beat{animation-name:fa-beat;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-bounce{animation-name:fa-bounce;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28, .84, .42, 1))}.fa-fade{animation-name:fa-fade;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4, 0, .6, 1))}.fa-beat-fade{animation-name:fa-beat-fade;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4, 0, .6, 1))}.fa-flip{animation-name:fa-flip;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-shake{animation-name:fa-shake;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin{animation-name:fa-spin;animation-delay:var(--fa-animation-delay,0s);animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,2s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,linear)}.fa-spin-reverse{--fa-animation-direction:reverse}.fa-pulse,.fa-spin-pulse{animation-name:fa-spin;animation-direction:var(--fa-animation-direction,normal);animation-duration:var(--fa-animation-duration,1s);animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-timing-function:var(--fa-animation-timing,steps(8))}@media (prefers-reduced-motion:reduce){.fa-beat,.fa-bounce,.fa-fade,.fa-beat-fade,.fa-flip,.fa-pulse,.fa-shake,.fa-spin,.fa-spin-pulse{transition:none!important;animation:none!important}}@keyframes fa-beat{0%,90%{transform:scale(1)}45%{transform:scale(var(--fa-beat-scale,1.25))}}@keyframes fa-bounce{0%{transform:scale(1)translateY(0)}10%{transform:scale(var(--fa-bounce-start-scale-x,1.1), var(--fa-bounce-start-scale-y,.9)) translateY(0)}30%{transform:scale(var(--fa-bounce-jump-scale-x,.9), var(--fa-bounce-jump-scale-y,1.1)) translateY(var(--fa-bounce-height,-.5em))}50%{transform:scale(var(--fa-bounce-land-scale-x,1.05), var(--fa-bounce-land-scale-y,.95)) translateY(0)}57%{transform:scale(1, 1) translateY(var(--fa-bounce-rebound,-.125em))}64%{transform:scale(1)translateY(0)}to{transform:scale(1)translateY(0)}}@keyframes fa-fade{50%{opacity:var(--fa-fade-opacity,.4)}}@keyframes fa-beat-fade{0%,to{opacity:var(--fa-beat-fade-opacity,.4);transform:scale(1)}50%{opacity:1;transform:scale(var(--fa-beat-fade-scale,1.125))}}
3@keyframes fa-flip{50%{transform:rotate3d(var(--fa-flip-x,0), var(--fa-flip-y,1), var(--fa-flip-z,0), var(--fa-flip-angle,-180deg))}}@keyframes fa-shake{0%{transform:rotate(-15deg)}4%{transform:rotate(15deg)}8%,24%{transform:rotate(-18deg)}12%,28%{transform:rotate(18deg)}16%{transform:rotate(-22deg)}20%{transform:rotate(22deg)}32%{transform:rotate(-12deg)}36%{transform:rotate(12deg)}40%,to{transform:rotate(0)}}@keyframes fa-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fa-rotate-90{transform:rotate(90deg)}.fa-rotate-180{transform:rotate(180deg)}.fa-rotate-270{transform:rotate(270deg)}.fa-flip-horizontal{transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{transform:scale(-1)}.fa-rotate-by{transform:rotate(var(--fa-rotate-angle,0))}.svg-inline--fa .fa-primary{fill:var(--fa-primary-color,currentColor);opacity:var(--fa-primary-opacity,1)}.svg-inline--fa .fa-secondary{fill:var(--fa-secondary-color,currentColor);opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-primary{opacity:var(--fa-secondary-opacity,.4)}.svg-inline--fa.fa-swap-opacity .fa-secondary{opacity:var(--fa-primary-opacity,1)}.svg-inline--fa mask .fa-primary,.svg-inline--fa mask .fa-secondary{fill:#000}.svg-inline--fa.fa-inverse{fill:var(--fa-inverse,#fff)}.fa-stack{vertical-align:middle;width:2.5em;height:2em;line-height:2em;display:inline-block;position:relative}.fa-inverse{color:var(--fa-inverse,#fff)}.svg-inline--fa.fa-stack-1x{--fa-width:1.25em;height:1em;width:var(--fa-width)}.svg-inline--fa.fa-stack-2x{--fa-width:2.5em;height:2em;width:var(--fa-width)}.fa-stack-1x,.fa-stack-2x{z-index:var(--fa-stack-z-index,auto);margin:auto;position:absolute;inset:0}';var ts=["turtle","block-programming"];var is=["pandas","numpy","matplotlib","dateutil","pytz","six","contourpy","cycler","fonttools","kiwisolver","packaging","pillow","pyparsing","pygame","turtle","block-programming"];function ns(e){return e.map(e=>e.trim()).filter(e=>!function(e){return ts.includes(e)}(e))}var os=':host,:root{--brikke-font-family:system-ui, -apple-system, "Segoe UI", roboto, sans-serif;--brikke-text-color:#1e1f24;--brikke-divider-background:#cdced7;--brikke-border:#b9bbc6;--b-gap-lg:20px;--b-gap-md:15px;--b-gap-sm:10px;--b-gap-xs:5px;--b-color:#222;--b-color-bg:#fff;--b-color-bg-1:#f2f2f2;--b-color-bg-2:#e6e6e6;--b-color-bg-3:#d9d9d9;--b-color-primary:#3451b2;--b-color-border:gray;--b-border:1px solid var(--b-color-border);--b-radius:5px;--b-shadow:#0003 0px 4px 8px;--b-input-border:1px solid #b3b3b3;--b-input-hover:#ccc;--b-demo-width:80ch}',rs=[],ss=[];function as(e){if(e<768)return!1;for(let t=0,i=rs.length;;){let n=t+i>>1;if(e<rs[n])i=n;else{if(!(e>=ss[n]))return!0;t=n+1}if(t==i)return!1}}function ls(e){return e>=127462&&e<=127487}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,i=0;t<e.length;t++)(t%2?ss:rs).push(i+=e[t])})();
vendor: 18,599 bytes, line 3
3function cs(e,t,i=!0,n=!0){return(i?us:hs)(e,t,n)}function us(e,t,i){if(t==e.length)return t;t&&ps(e.charCodeAt(t))&&fs(e.charCodeAt(t-1))&&t--;let n=ds(e,t);for(t+=gs(n);t<e.length;){let o=ds(e,t);if(8205==n||8205==o||i&&as(o))t+=gs(o),n=o;else{if(!ls(o))break;{let i=0,n=t-2;for(;n>=0&&ls(ds(e,n));)i++,n-=2;if(i%2==0)break;t+=2}}}return t}function hs(e,t,i){for(;t>0;){let n=us(e,t-2,i);if(n<t)return n;t--}return 0}function ds(e,t){let i=e.charCodeAt(t);if(!fs(i)||t+1==e.length)return i;let n=e.charCodeAt(t+1);return ps(n)?n-56320+(i-55296<<10)+65536:i}function ps(e){return e>=56320&&e<57344}function fs(e){return e>=55296&&e<56320}function gs(e){return e<65536?1:2}var ms=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ys(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),_s.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ys(this,e,t);let i=[];return this.decompose(e,t,i,0),_s.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new Os(this),o=new Os(e);for(let r=t,s=t;;){if(n.next(r),o.next(r),r=0,n.lineBreak!=o.lineBreak||n.done!=o.done||n.value!=o.value)return!1;if(s+=n.value.length,n.done||s>=i)return!0}}iter(e=1){return new Os(this,e)}iterRange(e,t=this.length){return new vs(this,e,t)}iterLines(e,t){let i;if(null==e)i=this.iter();else{t??=this.lines+1;let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Is(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(0==t.length)throw RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new Ts(t):_s.from(Ts.split(t,[])):e.empty}},Ts=class e extends ms{constructor(e,t=function(e){let t=-1;for(let i of e)t+=i.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let o=0;;o++){let r=this.text[o],s=n+r.length;if((t?i:s)>=e)return new Ss(n,s,i,r);n=s+1,i++}}decompose(t,i,n,o){let r=t<=0&&i>=this.length?this:new e(bs(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&o){let t=n.pop(),i=Es(r.text,t.text.slice(),0,r.length);if(i.length<=32)n.push(new e(i,t.length+r.length));else{let t=i.length>>1;n.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else n.push(r)}replace(t,i,n){if(!(n instanceof e))return super.replace(t,i,n);[t,i]=ys(this,t,i);let o=Es(this.text,Es(n.text,bs(this.text,0,t)),i),r=this.length+n.length-(i-t);return o.length<=32?new e(o,r):_s.from(e.split(o,[]),r)}sliceString(e,t=this.length,i="\n"){[e,t]=ys(this,e,t);let n="";for(let o=0,r=0;o<=t&&r<this.text.length;r++){let s=this.text[r],a=o+s.length;o>e&&r&&(n+=i),e<a&&t>o&&(n+=s.slice(Math.max(0,e-o),t-o)),o=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,i){let n=[],o=-1;for(let r of t)n.push(r),o+=r.length+1,32==n.length&&(i.push(new e(n,o)),n=[],o=-1);return o>-1&&i.push(new e(n,o)),i}},_s=class e extends ms{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let o=0;;o++){let r=this.children[o],s=n+r.length,a=i+r.lines-1;if((t?a:s)>=e)return r.lineInner(e,t,i,n);n=s+1,i=a+1}}decompose(e,t,i,n){for(let o=0,r=0;r<=t&&o<this.children.length;o++){let s=this.children[o],a=r+s.length;if(e<=a&&t>=r){let o=n&(r<=e|(a>=t?2:0));r>=e&&a<=t&&!o?i.push(s):s.decompose(e-r,t-r,i,o)}r=a+1}}replace(t,i,n){if([t,i]=ys(this,t,i),n.lines<this.lines)for(let o=0,r=0;o<this.children.length;o++){let s=this.children[o],a=r+s.length;if(t>=r&&i<=a){let l=s.replace(t-r,i-r,n),c=this.lines-s.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let r=this.children.slice();return r[o]=l,new e(r,this.length-(i-t)+n.length)}return super.replace(r,a,l)}r=a+1}return super.replace(t,i,n)}sliceString(e,t=this.length,i="\n"){[e,t]=ys(this,e,t);let n="";for(let o=0,r=0;o<this.children.length&&r<=t;o++){let s=this.children[o],a=r+s.length;r>e&&o&&(n+=i),e<a&&t>r&&(n+=s.sliceString(e-r,t-r,i)),r=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,i){if(!(t instanceof e))return 0;let n=0,[o,r,s,a]=i>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;o+=i,r+=i){if(o==s||r==a)return n;let e=this.children[o],l=t.children[r];if(e!=l)return n+e.scanIdentical(l,i);n+=e.length+1}}static from(t,i=t.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let e of t)n+=e.lines;if(n<32){let e=[];for(let i of t)i.flatten(e);return new Ts(e,i)}let o=Math.max(32,n>>5),r=o<<1,s=o>>1,a=[],l=0,c=-1,u=[];function h(t){let i;if(t.lines>r&&t instanceof e)for(let e of t.children)h(e);else t.lines>s&&(l>s||!l)?(d(),a.push(t)):t instanceof Ts&&l&&(i=u[u.length-1])instanceof Ts&&t.lines+i.lines<=32?(l+=t.lines,c+=t.length+1,u[u.length-1]=new Ts(i.text.concat(t.text),i.length+1+t.length)):(l+t.lines>o&&d(),l+=t.lines,c+=t.length+1,u.push(t))}function d(){0!=l&&(a.push(1==u.length?u[0]:e.from(u,c)),c=-1,l=u.length=0)}for(let e of t)h(e);return d(),1==a.length?a[0]:new e(a,i)}};function Es(e,t,i=0,n=1e9){for(let o=0,r=0,s=!0;r<e.length&&o<=n;r++){let a=e[r],l=o+a.length;l>=i&&(l>n&&(a=a.slice(0,n-o)),o<i&&(a=a.slice(i-o)),s?(t[t.length-1]+=a,s=!1):t.push(a)),o=l+1}return t}function bs(e,t,i){return Es(e,[""],t,i)}ms.empty=new Ts([""],0);var Os=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ts?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],o=this.offsets[i],r=o>>1,s=n instanceof Ts?n.text.length:n.children.length;if(r==(t>0?s:0)){if(0==i)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[i]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(n instanceof Ts){let o=n.text[r+(t<0?-1:0)];if(this.offsets[i]+=t,o.length>Math.max(0,e))return this.value=0==e?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=n.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof Ts?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},vs=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Os(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}},Is=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(ms.prototype[Symbol.iterator]=function(){return this.iter()},Os.prototype[Symbol.iterator]=vs.prototype[Symbol.iterator]=Is.prototype[Symbol.iterator]=function(){return this});var Ss=class{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}};function ys(e,t,i){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,i))]}function Rs(e,t,i=!0,n=!0){return cs(e,t,i,n)}function Cs(e,t){let i=e.charCodeAt(t);if(!function(e){return e>=55296&&e<56320}(i)||t+1==e.length)return i;let n=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(n)?n-56320+(i-55296<<10)+65536:i}function ks(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function As(e){return e<65536?1:2}var Ls=/\r\n?|\n/,Ns=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ns||={}),ws=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,n=0;t<this.sections.length;){let o=this.sections[t++],r=this.sections[t++];r<0?(e(i,n,o),n+=o):n+=r,i+=o}}iterChangedRanges(e,t=!1){Ds(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:Fs(this,e)}mapDesc(e,t=!1){return e.empty?this:Ps(this,e,t)}mapPos(e,t=-1,i=Ns.Simple){let n=0,o=0;for(let r=0;r<this.sections.length;){let s=this.sections[r++],a=this.sections[r++],l=n+s;if(a<0){if(l>e)return o+(e-n);o+=s}else{if(i!=Ns.Simple&&l>=e&&(i==Ns.TrackDel&&n<e&&l>e||i==Ns.TrackBefore&&n<e||i==Ns.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==n||t<0?o:o+a;o+=a}n=l}if(e>n)throw RangeError(`Position ${e} is out of range for changeset of length ${n}`);return o}touchesRange(e,t=e){for(let i=0,n=0;i<this.sections.length&&n<=t;){let o=n+this.sections[i++];if(this.sections[i++]>=0&&n<=t&&o>=e)return!(n<e&&o>t)||"cover";n=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+i+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>"number"!=typeof e))throw RangeError("Invalid JSON representation of ChangeDesc");return new e(t)}static create(t){return new e(t)}},$s=class e extends ws{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return Ds(this,(t,i,n,o,r)=>e=e.replace(n,n+(i-t),r),!1),e}mapDesc(e,t=!1){return Ps(this,e,t,!0)}invert(t){let i=this.sections.slice(),n=[];for(let e=0,o=0;e<i.length;e+=2){let r=i[e],s=i[e+1];if(s>=0){i[e]=s,i[e+1]=r;let a=e>>1;for(;n.length<a;)n.push(ms.empty);n.push(r?t.slice(o,o+r):ms.empty)}o+=r}return new e(i,n)}compose(e){return this.empty?e:e.empty?this:Fs(this,e,!0)}map(e,t=!1){return e.empty?this:Ps(this,e,t,!0)}iterChanges(e,t=!1){Ds(this,e,t)}get desc(){return ws.create(this.sections)}filter(t){let i=[],n=[],o=[],r=new Bs(this);e:for(let e=0,s=0;;){let a=e==t.length?1e9:t[e++];for(;s<a||s==a&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,a-s);Ms(o,e,-1);let t=-1==r.ins?-1:0==r.off?r.ins:0;Ms(i,e,t),t>0&&xs(n,i,r.text),r.forward(e),s+=e}let l=t[e++];for(;s<l;){if(r.done)break e;let e=Math.min(r.len,l-s);Ms(i,e,-1),Ms(o,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),s+=e}}return{changes:new e(i,n),filtered:ws.create(o)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],n=this.sections[t+1];n<0?e.push(i):0==n?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,i,n){let o=[],r=[],s=0,a=null;function l(t=!1){if(!t&&!o.length)return;s<i&&Ms(o,i-s,-1);let n=new e(o,r);a=a?a.compose(n.map(a)):n,o=[],r=[],s=0}return function t(c){if(Array.isArray(c))for(let e of c)t(e);else if(c instanceof e){if(c.length!=i)throw RangeError(`Mismatched change set length (got ${c.length}, expected ${i})`);l(),a=a?a.compose(c.map(a)):c}else{let{from:e,to:t=e,insert:a}=c;if(e>t||e<0||t>i)throw RangeError(`Invalid change range ${e} to ${t} (in doc of length ${i})`);let u=a?"string"==typeof a?ms.of(a.split(n||Ls)):a:ms.empty,h=u.length;if(e==t&&0==h)return;e<s&&l(),e>s&&Ms(o,e-s,-1),Ms(o,t-e,h),xs(r,o,u),s=t}}(t),l(!a),a}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let e=0;e<t.length;e++){let o=t[e];if("number"==typeof o)i.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((e,t)=>t&&"string"!=typeof e))throw RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)i.push(o[0],0);else{for(;n.length<e;)n.push(ms.empty);n[e]=ms.of(o.slice(1)),i.push(o[0],n[e].length)}}}return new e(i,n)}static createSet(t,i){return new e(t,i)}};function Ms(e,t,i,n=!1){if(0==t&&i<=0)return;let o=e.length-2;o>=0&&i<=0&&i==e[o+1]?e[o]+=t:o>=0&&0==t&&0==e[o]?e[o+1]+=i:n?(e[o]+=t,e[o+1]+=i):e.push(t,i)}function xs(e,t,i){if(0==i.length)return;let n=t.length-2>>1;if(n<e.length)e[e.length-1]=e[e.length-1].append(i);else{for(;e.length<n;)e.push(ms.empty);e.push(i)}}function Ds(e,t,i){let n=e.inserted;for(let o=0,r=0,s=0;s<e.sections.length;){let a=e.sections[s++],l=e.sections[s++];if(l<0)o+=a,r+=a;else{let c=o,u=r,h=ms.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[s-2>>1])),!(i||s==e.sections.length||e.sections[s+1]<0);)a=e.sections[s++],l=e.sections[s++];t(o,c,r,u,h),o=c,r=u}}}function Ps(e,t,i,n=!1){let o=[],r=n?[]:null,s=new Bs(e),a=new Bs(t);for(let l=-1;;){if(s.done&&a.len||a.done&&s.len)throw Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);Ms(o,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||l==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!i))){let e=a.len;for(Ms(o,a.ins,-1);e;){let t=Math.min(s.len,e);s.ins>=0&&l<s.i&&s.len<=t&&(Ms(o,0,s.ins),r&&xs(r,o,s.text),l=s.i),s.forward(t),e-=t}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return r?$s.createSet(o,r):ws.create(o);throw Error("Mismatched change set lengths")}{let e=0,t=s.len;for(;t;)if(-1==a.ins){let i=Math.min(t,a.len);e+=i,t-=i,a.forward(i)}else{if(!(0==a.ins&&a.len<t))break;t-=a.len,a.next()}Ms(o,e,l<s.i?s.ins:0),r&&l<s.i&&xs(r,o,s.text),l=s.i,s.forward(s.len-t)}}}}function Fs(e,t,i=!1){let n=[],o=i?[]:null,r=new Bs(e),s=new Bs(t);for(let a=!1;;){if(r.done&&s.done)return o?$s.createSet(n,o):ws.create(n);if(0==r.ins)Ms(n,r.len,0,a),r.next();else if(0!=s.len||s.done){if(r.done||s.done)throw Error("Mismatched change set lengths");{let e=Math.min(r.len2,s.len),t=n.length;if(-1==r.ins){let t=-1==s.ins?-1:s.off?0:s.ins;Ms(n,e,t,a),o&&t&&xs(o,n,s.text)}else-1==s.ins?(Ms(n,r.off?0:r.len,e,a),o&&xs(o,n,r.textBit(e))):(Ms(n,r.off?0:r.len,s.off?0:s.ins,a),o&&!s.off&&xs(o,n,s.text));a=(r.ins>e||s.ins>=0&&s.len>e)&&(a||n.length>t),r.forward2(e),s.forward(e)}}else Ms(n,0,s.ins,a),o&&xs(o,n,s.text),s.next()}}var Bs=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ms.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ms.empty:t[i].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Us=class e{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(t,i=-1){let n,o;return this.empty?n=o=t.mapPos(this.from,i):(n=t.mapPos(this.from,1),o=t.mapPos(this.to,-1)),n==this.from&&o==this.to?this:new e(n,o,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return Hs.range(e,t,void 0,void 0,i);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Hs.range(this.anchor,n,void 0,void 0,i)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw RangeError("Invalid JSON representation for SelectionRange");return Hs.range(e.anchor,e.head)}static create(t,i,n){return new e(t,i,n)}},Hs=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,i=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,i)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new e([this.main],0)}addRange(t,i=!0){return e.create([t].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(t,i=this.mainIndex){let n=this.ranges.slice();return n[i]=t,e.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new e(t.ranges.map(e=>Us.fromJSON(e)),t.main)}static single(t,i=t){return new e([e.range(t,i)],0)}static create(t,i=0){if(0==t.length)throw RangeError("A selection needs at least one range");for(let n=0,o=0;o<t.length;o++){let r=t[o];if(r.empty?r.from<=n:r.from<n)return e.normalized(t.slice(),i);n=r.to}return new e(t,i)}static cursor(e,t=0,i,n){return Us.create(e,e,(0==t?0:t<0?8:16)|(null==i?7:Math.min(6,i))|(n??16777215)<<6)}static range(e,t,i,n,o){let r=(i??16777215)<<6|(null==n?7:Math.min(6,n));return!o&&e!=t&&(o=t<e?1:-1),t<e?Us.create(t,e,48|r):Us.create(e,t,(o?o<0?8:16:0)|r)}static normalized(t,i=0){let n=t[i];t.sort((e,t)=>
3e.from-t.from),i=t.indexOf(n);for(let o=1;o<t.length;o++){let n=t[o],r=t[o-1];if(n.empty?n.from<=r.to:n.from<r.to){let s=r.from,a=Math.max(n.to,r.to);o<=i&&i--,t.splice(--o,2,n.anchor>n.head?e.range(a,s):e.range(s,a))}}return new e(t,i)}};function Vs(e,t){for(let i of e.ranges)if(i.to>t)throw RangeError("Selection points outside of document")}var Gs=0,Ws=class e{constructor(e,t,i,n,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=Gs++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Xs),!!t.static,t.enables)}of(e){return new zs([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new zs(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new zs(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],i=>t(i.field(e)))}};function Xs(e,t){return e==t||e.length==t.length&&e.every((e,i)=>e===t[i])}var zs=class{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=Gs++}dynamicSlot(e){let t=this.value,i=this.facet.compareInput,n=this.id,o=e[n]>>1,r=2==this.type,s=!1,a=!1,l=[];for(let c of this.dependencies)"doc"==c?s=!0:"selection"==c?a=!0:1&(e[c.id]??1)||l.push(e[c.id]);return{create:e=>(e.values[o]=t(e),1),update(e,n){if(s&&n.docChanged||a&&(n.docChanged||n.selection)||Ys(e,l)){let n=t(e);if(r?!js(n,e.values[o],i):!i(n,e.values[o]))return e.values[o]=n,1}return 0},reconfigure:(e,s)=>{let a,l=s.config.address[n];if(null!=l){let n=ca(s,l);if(this.dependencies.every(t=>t instanceof Ws?s.facet(t)===e.facet(t):!(t instanceof qs)||s.field(t,!1)==e.field(t,!1))||(r?js(a=t(e),n,i):i(a=t(e),n)))return e.values[o]=n,0}else a=t(e);return e.values[o]=a,1}}}};function js(e,t,i){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0}function Ys(e,t){let i=!1;for(let n of t)1&la(e,n)&&(i=!0);return i}function Qs(e,t,i){let n=i.map(t=>e[t.id]),o=i.map(e=>e.type),r=n.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let i=[];for(let t=0;t<n.length;t++){let r=ca(e,n[t]);if(2==o[t])for(let e of r)i.push(e);else i.push(r)}return t.combine(i)}return{create(e){for(let t of n)la(e,t);return e.values[s]=a(e),1},update(e,i){if(!Ys(e,r))return 0;let n=a(e);return t.compare(n,e.values[s])?0:(e.values[s]=n,1)},reconfigure(e,o){let r=Ys(e,n),l=o.config.facets[t.id],c=o.facet(t);if(l&&!r&&Xs(i,l))return e.values[s]=c,0;let u=a(e);return t.compare(u,c)?(e.values[s]=c,0):(e.values[s]=u,1)}}}var Ks=Ws.define({static:!0}),qs=class e{constructor(e,t,i,n,o){this.id=e,this.createF=t,this.updateF=i,this.compareF=n,this.spec=o,this.provides=void 0}static define(t){let i=new e(Gs++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(i.provides=t.provide(i)),i}create(e){return(e.facet(Ks).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,i)=>{let n=e.values[t],o=this.updateF(n,i);return this.compareF(n,o)?0:(e.values[t]=o,1)},reconfigure:(e,i)=>{let n,o=e.facet(Ks),r=i.facet(Ks);return(n=o.find(e=>e.field==this))&&n!=r.find(e=>e.field==this)?(e.values[t]=n.create(e),1):null==i.config.address[this.id]?(e.values[t]=this.create(e),1):(e.values[t]=i.field(this),0)}}}init(e){return[this,Ks.of({field:this,create:e})]}get extension(){return this}},Js=4,Zs=3,ea=2,ta=1;function ia(e){return t=>new oa(t,e)}var na={highest:ia(0),high:ia(ta),default:ia(ea),low:ia(Zs),lowest:ia(Js)},oa=class{constructor(e,t){this.inner=e,this.prec=t}},ra=class e{of(e){return new sa(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},sa=class{constructor(e,t){this.compartment=e,this.inner=t}},aa=class e{constructor(e,t,i,n,o,r){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=o,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(t,i,n){let o=[],r=Object.create(null),s=new Map;for(let e of function(e,t,i){let n=[[],[],[],[],[]],o=new Map;function r(e,s){let a=o.get(e);
3if(null!=a){if(a<=s)return;let t=n[a].indexOf(e);t>-1&&n[a].splice(t,1),e instanceof sa&&i.delete(e.compartment)}if(o.set(e,s),Array.isArray(e))for(let t of e)r(t,s);else if(e instanceof sa){if(i.has(e.compartment))throw RangeError("Duplicate use of compartment in extensions");let n=t.get(e.compartment)||e.inner;i.set(e.compartment,n),r(n,s)}else if(e instanceof oa)r(e.inner,e.prec);else if(e instanceof qs)n[s].push(e),e.provides&&r(e.provides,s);else if(e instanceof zs)n[s].push(e),e.facet.extensions&&r(e.facet.extensions,ea);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(t,s)}}return r(e,ea),n.reduce((e,t)=>e.concat(t))}(t,i,s))e instanceof qs?o.push(e):(r[e.facet.id]||(r[e.facet.id]=[])).push(e);let a=Object.create(null),l=[],c=[];for(let e of o)a[e.id]=c.length<<1,c.push(t=>e.slot(t));let u=n?.config.facets;for(let e in r){let t=r[e],i=t[0].facet,o=u&&u[e]||[];if(t.every(e=>0==e.type))if(a[i.id]=l.length<<1|1,Xs(o,t))l.push(n.facet(i));else{let e=i.combine(t.map(e=>e.value));l.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(a[e.id]=l.length<<1|1,l.push(e.value)):(a[e.id]=c.length<<1,c.push(t=>e.dynamicSlot(t)));a[i.id]=c.length<<1,c.push(e=>Qs(e,i,t))}}return new e(t,s,c.map(e=>e(a)),a,l,r)}};function la(e,t){if(1&t)return 2;let i=t>>1,n=e.status[i];if(4==n)throw Error("Cyclic dependency between fields and/or facets");if(2&n)return n;e.status[i]=4;let o=e.computeSlot(e,e.config.dynamicSlots[i]);return e.status[i]=2|o}function ca(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}var ua=Ws.define(),ha=Ws.define({combine:e=>e.some(e=>e),static:!0}),da=Ws.define({combine:e=>e.length?e[0]:void 0,static:!0}),pa=Ws.define(),fa=Ws.define(),ga=Ws.define(),ma=Ws.define({combine:e=>!!e.length&&e[0]}),Ta=class{constructor(e,t){this.type=e,this.value=t}static define(){return new _a}},_a=class{of(e){return new Ta(this,e)}},Ea=class{constructor(e){this.map=e}of(e){return new ba(this,e)}},ba=class e{constructor(e,t){this.type=e,this.value=t}map(t){let i=this.type.map(this.value,t);return void 0===i?void 0:i==this.value?this:new e(this.type,i)}is(e){return this.type==e}static define(e={}){return new Ea(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let e=n.map(t);e&&i.push(e)}return i}};ba.reconfigure=ba.define(),ba.appendConfig=ba.define();var Oa=class e{constructor(t,i,n,o,r,s){this.startState=t,this.changes=i,this.selection=n,this.effects=o,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Vs(n,i.newLength),r.some(t=>t.type==e.time)||(this.annotations=r.concat(e.time.of(Date.now())))}static create(t,i,n,o,r,s){return new e(t,i,n,o,r,s)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let i=this.annotation(e.userEvent);return!(!i||!(i==t||i.length>t.length&&i.slice(0,t.length)==t&&"."==i[t.length]))}};function va(e,t){let i=[];for(let n=0,o=0;;){let r,s;if(n<e.length&&(o==t.length||t[o]>=e[n]))r=e[n++],s=e[n++];else{if(!(o<t.length))return i;r=t[o++],s=t[o++]}!i.length||i[i.length-1]<r?i.push(r,s):i[i.length-1]<s&&(i[i.length-1]=s)}}function Ia(e,t,i){let n,o,r;return i?(n=t.changes,o=$s.empty(t.changes.length),r=e.changes.compose(t.changes)):(n=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),r=e.changes.compose(n)),{changes:r,selection:t.selection?t.selection.map(o):e.selection?.map(n),effects:ba.mapEffects(e.effects,n).concat(ba.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Sa(e,t,i){let n=t.selection,o=Ca(t.annotations);return t.userEvent&&(o=o.concat(Oa.userEvent.of(t.userEvent))),{changes:t.changes instanceof $s?t.changes:$s.of(t.changes||[],i,e.facet(da)),selection:n&&(n instanceof Hs?n:Hs.single(n.anchor,
3n.head)),effects:Ca(t.effects),annotations:o,scrollIntoView:!!t.scrollIntoView}}function ya(e,t,i){let n=Sa(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(i=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(i=!1);let o=!!t[r].sequential;n=Ia(n,Sa(e,t[r],o?n.changes.newLength:e.doc.length),o)}let o=Oa.create(e,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return function(e){let t=e.startState,i=t.facet(ga),n=e;for(let o=i.length-1;o>=0;o--){let r=i[o](e);r&&Object.keys(r).length&&(n=Ia(n,Sa(t,r,e.changes.newLength),!0))}return n==e?e:Oa.create(t,e.changes,e.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(e){let t=e.startState,i=!0;for(let o of t.facet(pa)){let t=o(e);if(!1===t){i=!1;break}Array.isArray(t)&&(i=!0===i?t:va(i,t))}if(!0!==i){let n,o;if(!1===i)o=e.changes.invertedDesc,n=$s.empty(t.doc.length);else{let t=e.changes.filter(i);n=t.changes,o=t.filtered.mapDesc(t.changes).invertedDesc}e=Oa.create(t,n,e.selection&&e.selection.map(o),ba.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let n=t.facet(fa);for(let o=n.length-1;o>=0;o--){let i=n[o](e);e=i instanceof Oa?i:Array.isArray(i)&&1==i.length&&i[0]instanceof Oa?i[0]:ya(t,Ca(i),!1)}return e}(o):o)}Oa.time=Ta.define(),Oa.userEvent=Ta.define(),Oa.addToHistory=Ta.define(),Oa.remote=Ta.define();var Ra=[];function Ca(e){return null==e?Ra:Array.isArray(e)?e:[e]}var ka,Aa=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Aa||={}),La=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{ka=RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Na(e){return t=>{if(!/\S/.test(t))return Aa.Space;if(function(e){if(ka)return ka.test(e);for(let t=0;t<e.length;t++){let i=e[t];if(/\w/.test(i)||i>"Â"&&(i.toUpperCase()!=i.toLowerCase()||La.test(i)))return!0}return!1}(t))return Aa.Word;for(let i=0;i<e.length;i++)if(t.indexOf(e[i])>-1)return Aa.Word;return Aa.Other}}var wa=class e{constructor(e,t,i,n,o,r){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=o,r&&(r._state=this);for(let s=0;s<this.config.dynamicSlots.length;s++)la(this,s<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(null!=i)return la(this,i),ca(this,i);if(t)throw RangeError("Field is not present in this state")}update(...e){return ya(this,e,!0)}applyTransaction(t){let i,n=this.config,{base:o,compartments:r}=n;for(let e of t.effects)e.is(ra.reconfigure)?(n&&=(r=new Map,n.compartments.forEach((e,t)=>r.set(t,e)),null),r.set(e.value.compartment,e.value.extension)):e.is(ba.reconfigure)?(n=null,o=e.value):e.is(ba.appendConfig)&&(n=null,o=Ca(o).concat(e.value));n?i=t.startState.values.slice():(n=aa.resolve(o,r,this),i=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let s=t.startState.facet(ha)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,s,i,(e,i)=>i.update(e,t),t)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Hs.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),n=this.changes(i.changes),o=[i.range],r=Ca(i.effects);for(let s=1;s<t.ranges.length;s++){let i=e(t.ranges[s]),a=this.changes(i.changes),l=a.map(n);for(let e=0;e<s;e++)o[e]=o[e].map(l);let c=n.mapDesc(a,!0);o.push(i.range.map(c)),n=n.compose(l),r=ba.mapEffects(r,l).concat(ba.mapEffects(Ca(i.effects),c))}return{changes:n,selection:Hs.create(o,t.mainIndex),effects:r}}changes(t=[]){return t instanceof $s?t:$s.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return ms.of(t.split(this.facet(e.lineSeparator)||Ls))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(la(this,t),ca(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let n=e[i];n instanceof qs&&null!=this.config.address[n.id]&&(t[i]=n.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(t,i={}
vendor: 10,931 bytes, line 3
3,n){if(!t||"string"!=typeof t.doc)throw RangeError("Invalid JSON representation for EditorState");let o=[];if(n)for(let e in n)if(Object.prototype.hasOwnProperty.call(t,e)){let i=n[e],r=t[e];o.push(i.init(e=>i.spec.fromJSON(r,e)))}return e.create({doc:t.doc,selection:Hs.fromJSON(t.selection),extensions:i.extensions?o.concat([i.extensions]):o})}static create(t={}){let i=aa.resolve(t.extensions||[],new Map),n=t.doc instanceof ms?t.doc:ms.of((t.doc||"").split(i.staticFacet(e.lineSeparator)||Ls)),o=t.selection?t.selection instanceof Hs?t.selection:Hs.single(t.selection.anchor,t.selection.head):Hs.single(0);return Vs(o,n.length),i.staticFacet(ha)||(o=o.asSingle()),new e(i,n,o,i.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||"\n"}get readOnly(){return this.facet(ma)}phrase(t,...i){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return i.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if("$"==t)return"$";let n=+(t||1);return!n||n>i.length?e:i[n-1]})),t}languageDataAt(e,t,i=-1){let n=[];for(let o of this.facet(ua))for(let r of o(this,t,i))Object.prototype.hasOwnProperty.call(r,e)&&n.push(r[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Na(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),o=this.charCategorizer(e),r=e-i,s=e-i;for(;r>0;){let e=Rs(t,r,!1);if(o(t.slice(e,r))!=Aa.Word)break;r=e}for(;s<n;){let e=Rs(t,s);if(o(t.slice(s,e))!=Aa.Word)break;s=e}return r==s?null:Hs.range(r+i,s+i)}};function $a(e,t,i={}){let n={};for(let o of e)for(let e of Object.keys(o)){let t=o[e],r=n[e];if(void 0===r)n[e]=t;else if(r!==t&&void 0!==t){if(!Object.hasOwnProperty.call(i,e))throw Error("Config merge conflict for field "+e);n[e]=i[e](r,t)}}for(let o in t)void 0===n[o]&&(n[o]=t[o]);return n}wa.allowMultipleSelections=ha,wa.tabSize=Ws.define({combine:e=>e.length?e[0]:4}),wa.lineSeparator=da,wa.readOnly=ma,wa.phrases=Ws.define({compare(e,t){let i=Object.keys(e),n=Object.keys(t);return i.length==n.length&&i.every(i=>e[i]==t[i])}}),wa.languageData=ua,wa.changeFilter=pa,wa.transactionFilter=fa,wa.transactionExtender=ga,ra.reconfigure=ba.define();var Ma=class{eq(e){return this==e}range(e,t=e){return Da.create(e,t,this)}};function xa(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}Ma.prototype.startSide=Ma.prototype.endSide=0,Ma.prototype.point=!1,Ma.prototype.mapMode=Ns.TrackDel;var Da=class e{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(t,i,n){return new e(t,i,n)}};function Pa(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var Fa=class e{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let o=i?this.to:this.from;for(let r=n,s=o.length;;){if(r==s)return r;let n=r+s>>1,a=o[n]-e||(i?this.value[n].endSide:this.value[n].startSide)-t;if(n==r)return a>=0?r:s;a>=0?s=n:r=n+1}}between(e,t,i,n){for(let o=this.findIndex(t,-1e9,!0),r=this.findIndex(i,1e9,!1,o);o<r;o++)if(!1===n(this.from[o]+e,this.to[o]+e,this.value[o]))return!1}map(t,i){let n=[],o=[],r=[],s=-1,a=-1;for(let e=0;e<this.value.length;e++){let l,c,u=this.value[e],h=this.from[e]+t,d=this.to[e]+t;if(h==d){let e=i.mapPos(h,u.startSide,u.mapMode);if(null==e||(l=c=e,u.startSide!=u.endSide&&(c=i.mapPos(h,u.endSide),c<l)))continue}else if(l=i.mapPos(h,u.startSide),c=i.mapPos(d,u.endSide),l>c||l==c&&u.startSide>0&&u.endSide<=0)continue;(c-l||u.endSide-u.startSide)<0||(s<0&&(s=l),u.point&&(a=Math.max(a,c-l)),n.push(u),o.push(l-s),r.push(c-s))}return{mapped:n.length?new e(o,r,n,a):null,pos:s}}},Ba=class e{constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(t,i,n,o){return new e(t,i,n,o)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:i=[],sort:n=!1,filterFrom:o=0,filterTo:r=this.length}=t,s=t.filter;if(0==i.length&&!s)return this;if(n&&(i=i.slice().sort(Pa)),this.isEmpty)return i.length?e.of(i):this;let a=new Va(this,null,-1).goto(0),l=0,c=[],u=new Ua;for(;a.value||l<i.length;)if(l<i.length&&(a.from-i[l].from||a.startSide-i[l].value.startSide)>=0){let e=i[l++];u.addInner(e.from,e.to,e.value)||c.push(e)}else 1==a.rangeIndex&&a.chunkIndex<this.chunk.length&&(l==i.length||this.chunkEnd(a.chunkIndex)<i[l].from)&&(!s||o>this.chunkEnd(a.chunkIndex)||r<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!s||o>a.to||r<a.from||s(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Da.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?e.empty:this.nextLayer.update({add:c,filter:s,filterFrom:o,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let i=[],n=[],o=-1;for(let e=0;e<this.chunk.length;e++){let r=this.chunkPos[e],s=this.chunk[e],a=t.touchesRange(r,r+s.length);if(!1===a)o=Math.max(o,s.maxPoint),i.push(s),n.push(t.mapPos(r));else if(!0===a){let{mapped:e,pos:a}=s.map(r,t);e&&(o=Math.max(o,e.maxPoint),i.push(e),n.push(a))}}let r=this.nextLayer.map(t);return 0==i.length?r:new e(n,i,r||e.empty,o)}between(e,t,i){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let o=this.chunkPos[n],r=this.chunk[n];if(t>=o&&e<=o+r.length&&!1===r.between(o,e-o,t-o,i))return}this.nextLayer.between(e,t,i)}}iter(e=0){return Ga.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ga.from(e).goto(t)}static compare(e,t,i,n,o=-1){let r=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o),a=Ha(r,s,i),l=new Xa(r,a,o),c=new Xa(s,a,o);i.iterGaps((e,t,i)=>za(l,e,c,t,i,n)),i.empty&&0==i.length&&za(l,0,c,0,0,n)}static eq(e,t,i=0,n){n??=999999999;let o=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),r=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(o.length!=r.length)return!1;if(!o.length)return!0;let s=Ha(o,r),a=new Xa(o,s,0).goto(i),l=new Xa(r,s,0).goto(i);for(;;){if(a.to!=l.to||!ja(a.active,l.active)||a.point&&(!l.point||!xa(a.point,l.point)))return!1;if(a.to>n)return!0;a.next(),l.next()}}static spans(e,t,i,n,o=-1){let r=new Xa(e,null,o).goto(t),s=t,a=r.openStart;for(;;){let e=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),o=r.pointFrom<t?i.length+1:r.point.startSide<0?i.length:Math.min(i.length,a);n.point(s,e,r.point,i,o,r.pointRank),a=Math.min(r.openEnd(e),i.length)}else e>s&&(n.span(s,e,r.active,a),a=r.openEnd(e));if(r.to>i)return a+(r.point&&r.to>i?1:0);s=r.to,r.next()}}static of(e,t=!1){let i=new Ua;for(let n of e instanceof Da?[e]:t?function(e){if(e.length>1)for(let t=e[0],i=1;i<e.length;i++){let n=e[i];if(Pa(t,n)>0)return e.slice().sort(Pa);t=n}return e}(e):e)i.add(n.from,n.to,n.value);return i.finish()}static join(t){if(!t.length)return e.empty;let i=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let o=t[n];o!=e.empty;o=o.nextLayer)i=new e(o.chunkPos,o.chunk,i,Math.max(o.maxPoint,i.maxPoint));return i}};Ba.empty=new Ba([],[],null,-1),Ba.empty.nextLayer=Ba.empty;var Ua=class e{finishChunk(e){this.chunks.push(new Fa(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,i,n){this.addInner(t,i,n)||(this.nextLayer||=new e).add(t,i,n)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Ba.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Ba.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function Ha(e,t,i){let n=new Map;for(let r of e)for(let e=0;e<r.chunk.length;e++)r.chunk[e].maxPoint<=0&&n.set(r.chunk[e],r.chunkPos[e]);let o=new Set;for(let r of t)for(let e=0;e<r.chunk.length;e++){let t=n.get(r.chunk[e]);null!=t&&(i?i.mapPos(t):t)==r.chunkPos[e]&&!i?.touchesRange(t,t+r.chunk[e].length)&&o.add(r.chunk[e])}return o}var Va=class{constructor(e,t,i,n=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Ga=class e{constructor(e){this.heap=e}
vendor: 4,866 bytes, line 3
3static from(t,i=null,n=-1){let o=[];for(let e=0;e<t.length;e++)for(let r=t[e];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&o.push(new Va(r,i,n,e));return 1==o.length?o[0]:new e(o)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Wa(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Wa(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Wa(this.heap,0)}}};function Wa(e,t){for(let i=e[t];;){let n=1+(t<<1);if(n>=e.length)break;let o=e[n];if(n+1<e.length&&o.compare(e[n+1])>=0&&(o=e[n+1],n++),i.compare(o)<0)break;e[n]=i,e[t]=o,t=n}}var Xa=class{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ga.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Ya(this.active,e),Ya(this.activeTo,e),Ya(this.activeRank,e),this.minActive=Ka(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||n-this.activeTo[t])>0;)t++;Qa(this.active,t,i),Qa(this.activeTo,t,n),Qa(this.activeRank,t,o),e&&Qa(e,t,this.cursor.from),this.minActive=Ka(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Ya(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(i),this.cursor.next()}}}if(i){this.openStart=0;for(let t=i.length-1;t>=0&&i[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}};function za(e,t,i,n,o,r){e.goto(t),i.goto(n);let s=n+o,a=n,l=n-t,c=!!r.boundChange;for(let u=!1;;){let t=e.to+l-i.to,n=t||e.endSide-i.endSide,o=n<0?e.to+l:i.to,h=Math.min(o,s);if(e.point||i.point?(e.point&&i.point&&xa(e.point,i.point)&&ja(e.activeForPoint(e.to),i.activeForPoint(i.to))||r.comparePoint(a,h,e.point,i.point),u=!1):(u&&r.boundChange(a),h>a&&!ja(e.active,i.active)&&r.compareRange(a,h,e.active,i.active),c&&h<s&&(t||e.openEnd(o)!=i.openEnd(o))&&(u=!0)),o>s)break;a=o,n<=0&&e.next(),n>=0&&i.next()}}function ja(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!=t[i]&&!xa(e[i],t[i]))return!1;return!0}function Ya(e,t){for(let i=t,n=e.length-1;i<n;i++)e[i]=e[i+1];e.pop()}function Qa(e,t,i){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=i}function Ka(e,t){let i=-1,n=1e9;for(let o=0;o<t.length;o++)(t[o]-n||e[o].endSide-e[i].endSide)<0&&(i=o,n=t[o]);return i}function qa(e,t,i=e.length){let n=0;for(let o=0;o<i&&o<e.length;)9==e.charCodeAt(o)?(n+=t-n%t,o++):(n++,o=Rs(e,o));return n}function Ja(e,t,i,n){for(let o=0,r=0;;){if(r>=t)return o;if(o==e.length)break;r+=9==e.charCodeAt(o)?i-r%i:1,o=Rs(e,o)}return!0===n?-1:e.length}for(var Za=typeof Symbol>"u"?"__ͼ":Symbol.for("ͼ"),el=typeof Symbol>"u"?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),tl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},il=class{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function o(e,t,r,s){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return r.push(e[0]+";");for(let i in t){let s=t[i];if(/&/.test(i))o(i.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>
3e.concat(t)),s,r);else if(s&&"object"==typeof s){if(!l)throw RangeError("The value of a property ("+i+") should be a primitive value.");o(n(i),s,a,c)}else null!=s&&a.push(i.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+s+";")}(a.length||c)&&r.push((!i||l||s?e:e.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(let r in e)o(n(r),e[r],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=tl[Za]||1;return tl[Za]=e+1,"ͼ"+e.toString(36)}static mount(e,t,i){let n=e[el],o=i&&i.nonce;n?o&&n.setNonce(o):n=new ol(e,o),n.mount(Array.isArray(t)?t:[t],e)}},nl=new Map,ol=class{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let t=nl.get(i);if(t)return e[el]=t;this.sheet=new n.CSSStyleSheet,nl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[el]=this}mount(e,t){let i=this.sheet,n=0,o=0;for(let r=0;r<e.length;r++){let t=e[r],s=this.modules.indexOf(t);if(s<o&&s>-1&&(this.modules.splice(s,1),o--,s=-1),-1==s){if(this.modules.splice(o++,0,t),i)for(let e=0;e<t.rules.length;e++)i.insertRule(t.rules[e],n++)}else{for(;o<s;)n+=this.modules[o++].rules.length;n+=t.rules.length,o++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let i=t.head||t;this.styleTag.parentNode!=i&&i.insertBefore(this.styleTag,i.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}},rl={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},sl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},al=typeof navigator<"u"&&/Mac/.test(navigator.platform),ll=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),cl=0;cl<10;cl++)rl[48+cl]=rl[96+cl]=String(cl);for(cl=1;cl<=24;cl++)rl[cl+111]="F"+cl;for(cl=65;cl<=90;cl++)rl[cl]=String.fromCharCode(cl+32),sl[cl]=String.fromCharCode(cl);for(var ul in rl)sl.hasOwnProperty(ul)||(sl[ul]=rl[ul]);function hl(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var o=i[n];"string"==typeof o?e.setAttribute(n,o):null!=o&&(e[n]=o)}t++}for(;t<arguments.length;t++)dl(e,arguments[t]);return e}function dl(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null!=t)if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw RangeError("Unsupported child node: "+t);for(var i=0;i<t.length;i++)dl(e,t[i])}}var pl=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},fl=typeof document<"u"?document:{documentElement:{style:{}}},gl=/Edge\/(\d+)/.exec(pl.userAgent),ml=/MSIE \d/.test(pl.userAgent),Tl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pl.userAgent),_l=!!(ml||Tl||gl),El=!_l&&/gecko\/(\d+)/i.test(pl.userAgent),bl=!_l&&/Chrome\/(\d+)/.exec(pl.userAgent),Ol="webkitFontSmoothing"in fl.documentElement.style,vl=!_l&&/Apple Computer/.test(pl.vendor),Il=vl&&(/Mobile\/\w+/.test(pl.userAgent)||pl.maxTouchPoints>2),Sl={mac:Il||/Mac/.test(pl.platform),windows:/Win/.test(pl.platform),linux:/Linux|X11/.test(pl.platform),ie:_l,ie_version:ml?fl.documentMode||6:Tl?+Tl[1]:gl?+gl[1]:0,gecko:El,gecko_version:El?+(/Firefox\/(\d+)/.exec(pl.userAgent)||[0,0])[1]:0,chrome:!!bl,chrome_version:bl?+bl[1]:0,ios:Il,android:/Android\b/.test(pl.userAgent),webkit:Ol,webkit_version:Ol?+(/\bAppleWebKit\/(\d+)/.exec(pl.userAgent)||[0,0])[1]:0,safari:vl,safari_version:vl?+(/\bVersion\/(\d+(\.\d+)?)/.exec(pl.userAgent)||[0,0])[1]:0,tabSize:null==fl.documentElement.style.tabSize?"-moz-tab-size":"tab-size"};function yl(e,t){for(let i in e)"class"==i&&t.class?t.class+=" "+e.class:"style"==i&&t.style?t.style+=";"+e.style:t[i]=e[i];return t}var Rl=Object.create(null);function Cl(e,t,i){if(e==t)return!0;e||=Rl,t||=Rl;let n=Object.keys(e),o=Object.keys(t);if(n.length-(i&&n.indexOf(i)>-1?1:0)!=o.length-(i&&o.indexOf(i)>-1?1:0))return!1;for(let r of n)if(r!=i&&(-1==o.indexOf(r)||e[r]!==t[r]))return!1;return!0}function kl(e,t,i){let n=!1;if(t)for(let o in t)i&&o in i||(n=!0,"style"==o?e.style.cssText="":e.removeAttribute(o));if(i)for(let o in i)t&&t[o]==i[o]||(n=!0,"style"==o?e.style.cssText=i[o]:e.setAttribute(o,i[o]));return n}function Al(e){let t=Object.create(null);for(let i=0;i<e.attributes.length;i++){let n=e.attributes[i];t[n.name]=n.value}return t}var Ll=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Nl=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Nl||={}),wl=class extends Ma{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new $l(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new xl(e,t,t,i,e.widget||null,!1)}static replace(e){let t,i,n=!!e.block;if(e.isBlockGap)t=-5e8,i=4e8;else{let{start:o,end:r}=Dl(e,n);t=(o?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new xl(e,t,i,n,e.widget||null,!0)}static line(e){return new Ml(e)}static set(e,t=!1){return Ba.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}};wl.none=Ba.empty;var $l=class e extends wl{constructor(e){let{start:t,end:i}=Dl(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?yl(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Rl}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Cl(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}};$l.prototype.point=!1;var Ml=class e extends wl{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Cl(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};
3Ml.prototype.mapMode=Ns.TrackBefore,Ml.prototype.point=!0;var xl=class e extends wl{constructor(e,t,i,n,o,r){super(t,i,o,e),this.block=n,this.isReplace=r,this.mapMode=n?t<=0?Ns.TrackBefore:Ns.TrackAfter:Ns.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?Nl.WidgetBefore:Nl.WidgetAfter:Nl.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&function(e,t){return e==t||!!(e&&t&&e.compare(t))}(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};function Dl(e,t=!1){let{inclusiveStart:i,inclusiveEnd:n}=e;return i??=e.inclusive,n??=e.inclusive,{start:i??t,end:n??t}}function Pl(e,t,i,n=0){let o=i.length-1;o>=0&&i[o]+n>=e?i[o]=Math.max(i[o],t):i.push(e,t)}xl.prototype.point=!0;var Fl=class e extends Ma{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Cl(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Rl,null==t.rank?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return Ba.of(e,t)}};function Bl(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Ul(e,t){return!!t&&(e==t||e.contains(1==t.nodeType?t:t.parentNode))}function Hl(e,t){if(!t.anchorNode)return!1;try{return Ul(e,t.anchorNode)}catch{return!1}}function Vl(e){return 3==e.nodeType?ic(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Gl(e,t,i,n){return!!i&&(zl(e,t,i,n,-1)||zl(e,t,i,n,1))}function Wl(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Xl(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function zl(e,t,i,n,o){for(;;){if(e==i&&t==n)return!0;if(t==(o<0?0:jl(e))){if("DIV"==e.nodeName)return!1;let i=e.parentNode;if(!i||1!=i.nodeType)return!1;t=Wl(e)+(o<0?0:1),e=i}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?jl(e):0}}}function jl(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Yl(e,t){let i=t?e.left:e.right;return{left:i,right:i,top:e.top,bottom:e.bottom}}function Ql(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Kl(e,t){let i=t.width/e.offsetWidth,n=t.height/e.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.width-e.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.height-e.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function ql(e,t=!0){let i=e.ownerDocument,n=null,o=null;for(let r=e.parentNode;r&&r!=i.body&&(t&&!n||!o);)if(1==r.nodeType)!o&&r.scrollHeight>r.clientHeight&&(o=r),t&&!n&&r.scrollWidth>r.clientWidth&&(n=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:n,y:o}}Fl.prototype.startSide=Fl.prototype.endSide=-1;var Jl,Zl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?jl(t):0),i,Math.min(e.focusOffset,i?jl(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}},ec=null;function tc(e){if(e.setActive)return e.setActive();if(ec)return e.focus(ec);let t=[];for(let i=e;i&&(t.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(e.focus(null==ec?{get preventScroll(){return ec={preventScroll:!0},!0}}:void 0),!ec){ec=!1;for(let e=0;e<t.length;){let i=t[e++],n=t[e++],o=t[e++];i.scrollTop!=n&&(i.scrollTop=n),i.scrollLeft!=o&&(i.scrollLeft=o)}}}function ic(e,t,i=t){let n=Jl||=document.createRange();return n.setEnd(e,i),n.setStart(e,t),n}function nc(e,t,i,n){let o={key:t,code:t,keyCode:i,which:i,cancelable:!0};n&&({altKey:o.altKey,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,metaKey:o.metaKey}=n);let r=new KeyboardEvent("keydown",o);r.synthetic=!0,e.dispatchEvent(r);let s=new KeyboardEvent("keyup",o);return s.synthetic=!0,e.dispatchEvent(s),r.defaultPrevented||s.defaultPrevented}function oc(e){return e instanceof Window?e.pageYOffset>
3Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function rc(e,t){for(let i=e,n=t;;){if(3==i.nodeType&&n>0)return{node:i,offset:n};if(1==i.nodeType&&n>0){if("false"==i.contentEditable)return null;i=i.childNodes[n-1],n=jl(i)}else{if(!i.parentNode||Xl(i))return null;n=Wl(i),i=i.parentNode}}}function sc(e,t){for(let i=e,n=t;;){if(3==i.nodeType&&n<i.nodeValue.length)return{node:i,offset:n};if(1==i.nodeType&&n<i.childNodes.length){if("false"==i.contentEditable)return null;i=i.childNodes[n],n=0}else{if(!i.parentNode||Xl(i))return null;n=Wl(i)+1,i=i.parentNode}}}Sl.safari&&Sl.safari_version>=26&&(ec=!1);var ac=class e{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(t,i){return new e(t.parentNode,Wl(t),i)}static after(t,i){return new e(t.parentNode,Wl(t)+1,i)}},lc=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(lc||={}),cc=lc.LTR,uc=lc.RTL;function hc(e){let t=[];for(let i=0;i<e.length;i++)t.push(1<<e[i]);return t}var dc=hc("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),pc=hc("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),fc=Object.create(null),gc=[];for(let dP of["()","[]","{}"]){let e=dP.charCodeAt(0),t=dP.charCodeAt(1);fc[e]=t,fc[t]=-e}function mc(e){return e<=247?dc[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?pc[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Tc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,_c=class{get dir(){return this.level%2?uc:cc}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,n){let o=-1;for(let r=0;r<e.length;r++){let s=e[r];if(s.from<=t&&s.to>=t){if(s.level==i)return r;(o<0||(0==n?e[o].level>s.level:n<0?s.from<t:s.to>t))&&(o=r)}}if(o<0)throw RangeError("Index out of range");return o}};function Ec(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],o=t[i];if(n.from!=o.from||n.to!=o.to||n.direction!=o.direction||!Ec(n.inner,o.inner))return!1}return!0}var bc=[];function Oc(e,t,i,n,o,r,s){let a=n%2?2:1;if(n%2==o%2)for(let l=t,c=0;l<i;){let t=!0,u=!1;if(c==r.length||l<r[c].from){let e=bc[l];e!=a&&(t=!1,u=16==e)}let h=t||1!=a?null:[],d=t?n:n+1,p=l;e:for(;;)if(c<r.length&&p==r[c].from){if(u)break e;let f=r[c];if(!t)for(let e=f.to,t=c+1;;){if(e==i)break e;if(!(t<r.length&&r[t].from==e)){if(bc[e]==a)break e;break}e=r[t++].to}c++,h?h.push(f):(f.from>l&&s.push(new _c(l,f.from,d)),vc(e,f.direction==cc==!(d%2)?n:n+1,o,f.inner,f.from,f.to,s),l=f.to),p=f.to}else{if(p==i||(t?bc[p]!=a:bc[p]==a))break;p++}h?Oc(e,l,p,n+1,o,h,s):l<p&&s.push(new _c(l,p,d)),l=p}else for(let l=i,c=r.length;l>t;){let i=!0,u=!1;if(!c||l>r[c-1].to){let e=bc[l-1];e!=a&&(i=!1,u=16==e)}let h=i||1!=a?null:[],d=i?n:n+1,p=l;e:for(;;)if(c&&p==r[c-1].to){if(u)break e;let f=r[--c];if(!i)for(let e=f.from,i=c;;){if(e==t)break e;if(!i||r[i-1].to!=e){if(bc[e-1]==a)break e;break}e=r[--i].from}h?h.push(f):(f.to<l&&s.push(new _c(f.to,l,d)),vc(e,f.direction==cc==!(d%2)?n:n+1,o,f.inner,f.from,f.to,s),l=f.from),p=f.from}else{if(p==t||(i?bc[p-1]!=a:bc[p-1]==a))break;p--}h?Oc(e,p,l,n+1,o,h,s):p<l&&s.push(new _c(p,l,d)),l=p}}function vc(e,t,i,n,o,r,s){let a=t%2?2:1;(function(e,t,i,n,o){for(let r=0;r<=n.length;r++){let s=r?n[r-1].to:t,a=r<n.length?n[r].from:i,l=r?256:o;for(let t=s,i=l,n=l;t<a;t++){let o=mc(e.charCodeAt(t));512==o?o=i:8==o&&4==n&&(o=16),bc[t]=4==o?2:o,7&o&&(n=o),i=o}for(let e=s,t=l,n=l;e<a;e++){let o=bc[e];if(128==o)e<a-1&&t==bc[e+1]&&24&t?o=bc[e]=t:bc[e]=256;else if(64==o){let o=e+1;for(;o<a&&64==bc[o];)o++;let r=e&&8==t||o<i&&8==bc[o]?1==n?1:8:256;for(let t=e;t<o;t++)bc[t]=r;e=o-1}else 8==o&&1==n&&(bc[e]=1);t=o,7&o&&(n=o)}}})(e,o,r,n,a),function(e,t,i,n,o){let r=1==o?2:1;for(let s=0,a=0,l=0;s<=n.length;s++){let c=s?n[s-1].to:t,u=s<n.length?n[s].from:i;for(let t,i,n,s=c;s<u;s++)if(i=fc[t=e.charCodeAt(s)])if(i<0){for(let e=a-3;e>=0;e-=3)if(gc[e+1]==-i){let t=gc[e+2],i=2&t?o:4&t?1&t?r:o:0;i&&(bc[s]=bc[gc[e]]=i),a=e;break}}else{if(189==gc.length)break;gc[a++]=s,gc[a++]=t,gc[a++]=l}else if(2==(n=bc[s])||1==n){let e=n==o;l=+!e;for(let t=a-3;t>=0;t-=3){let i=gc[t+2];
3if(2&i)break;if(e)gc[t+2]|=2;else{if(4&i)break;gc[t+2]|=4}}}}}(e,o,r,n,a),function(e,t,i,n){for(let o=0,r=n;o<=i.length;o++){let s=o?i[o-1].to:e,a=o<i.length?i[o].from:t;for(let l=s;l<a;){let s=bc[l];if(256==s){let s=l+1;for(;;)if(s==a){if(o==i.length)break;s=i[o++].to,a=o<i.length?i[o].from:t}else{if(256!=bc[s])break;s++}let c=1==r,u=c==(1==(s<t?bc[s]:n))?c?1:2:n;for(let t=s,n=o,r=n?i[n-1].to:e;t>l;)t==r&&(t=i[--n].from,r=n?i[n-1].to:e),bc[--t]=u;l=s}else r=s,l++}}}(o,r,n,a),Oc(e,o,r,t,i,n,s)}function Ic(e){return[new _c(0,e,0)]}var Sc="";function yc(e,t,i,n,o){let r=n.head-e.from,s=_c.find(t,r,n.bidiLevel??-1,n.assoc),a=t[s],l=a.side(o,i);if(r==l){let e=s+=o?1:-1;if(e<0||e>=t.length)return null;a=t[s=e],r=a.side(!o,i),l=a.side(o,i)}let c=Rs(e.text,r,a.forward(o,i));(c<a.from||c>a.to)&&(c=l),Sc=e.text.slice(Math.min(r,c),Math.max(r,c));let u=s==(o?t.length-1:0)?null:t[s+(o?1:-1)];return u&&c==l&&u.level+ +!o<a.level?Hs.cursor(u.side(!o,i)+e.from,u.forward(o,i)?1:-1,u.level):Hs.cursor(c+e.from,a.forward(o,i)?-1:1,a.level)}function Rc(e,t,i){for(let n=t;n<i;n++){let t=mc(e.charCodeAt(n));if(1==t)return cc;if(2==t||4==t)return uc}return cc}var Cc=Ws.define(),kc=Ws.define(),Ac=Ws.define(),Lc=Ws.define(),Nc=Ws.define(),wc=Ws.define(),$c=Ws.define(),Mc=Ws.define(),xc=Ws.define(),Dc=Ws.define({combine:e=>e.some(e=>e)}),Pc=Ws.define({combine:e=>e.some(e=>e)}),Fc=Ws.define(),Bc=class e{constructor(e,t,i,n,o,r=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=o,this.isSnapshot=r}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(Hs.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Uc=ba.define({map:(e,t)=>e.map(t)}),Hc=ba.define();function Vc(e,t,i){let n=e.facet(Lc);n.length?n[0](t):window.onerror&&window.onerror(String(t),i,void 0,void 0,t)||(i?console.error(i+":",t):console.error(t))}var Gc=Ws.define({combine:e=>!e.length||e[0]}),Wc=0,Xc=Ws.define({combine:e=>e.filter((t,i)=>{for(let n=0;n<i;n++)if(e[n].plugin==t.plugin)return!1;return!0})}),zc=class e{constructor(e,t,i,n,o){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Xc.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Xc.of({plugin:this,arg:e}))}static define(t,i){let{eventHandlers:n,eventObservers:o,provide:r,decorations:s}=i||{};return new e(Wc++,t,n,o,e=>{let t=[];return s&&t.push(Kc.of(t=>{let i=t.plugin(e);return i?s(i):wl.none})),r&&t.push(r(e)),t})}static fromClass(t,i){return e.define((e,i)=>new t(e,i),i)}},jc=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Vc(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Vc(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Vc(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},Yc=Ws.define(),Qc=Ws.define(),Kc=Ws.define(),qc=Ws.define(),Jc=Ws.define(),Zc=Ws.define(),eu=Ws.define();function tu(e,t){let i=e.state.facet(eu);if(!i.length)return i;let n=i.map(t=>t instanceof Function?t(e):t),o=[];return Ba.spans(n,t.from,t.to,{point(){},span(e,i,n,r){let s=e-t.from,a=i-t.from,l=o;for(let o=n.length-1;o>=0;o--,r--){let e,i=n[o].spec.bidiIsolate;if(i??=Rc(t.text,s,a),r>0&&l.length&&(e=l[l.length-1]).to==s&&e.direction==i)e.to=a,l=e.inner;else{let e={from:s,to:a,direction:i,inner:[]};l.push(e),l=e.inner}}}}),o}var iu=Ws.define();function nu(e){let t=0,i=0,n=0,o=0;for(let r of e.state.facet(iu)){let s=r(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(i=Math.max(i,s.right)),null!=s.top&&(n=Math.max(n,s.top)),null!=s.bottom&&(o=Math.max(o,s.bottom)))}return{left:t,right:i,top:n,bottom:o}}var ou=Ws.define(),ru=class e{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;
vendor: 11,327 bytes, line 3
3i=i.join(n),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(t,i){if(0==i.length)return t;let n=[];for(let o=0,r=0,s=0;;){let a=o<t.length?t[o].fromB:1e9,l=r<i.length?i[r]:1e9,c=Math.min(a,l);if(1e9==c)break;let u=c+s,h=c,d=u;for(;;)if(r<i.length&&i[r]<=h){let e=i[r+1];r+=2,h=Math.max(h,e);for(let i=o;i<t.length&&t[i].fromB<=h;i++)s=t[i].toA-t[i].toB;d=Math.max(d,e+s)}else{if(!(o<t.length&&t[o].fromB<=h))break;{let e=t[o++];h=Math.max(h,e.toB),d=Math.max(d,e.toA),s=e.toA-e.toB}}n.push(new e(u,d,c,h))}return n}},su=class e{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=$s.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let n=[];this.changes.iterChangedRanges((e,t,i,o)=>n.push(new ru(e,t,i,o))),this.changedRanges=n}static create(t,i,n){return new e(t,i,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}},au=[],lu=class{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return au}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let i=e.attributes.length-1;i>=0;i--){let n=e.attributes[i].name;t[n]??e.removeAttribute(n)}for(let i in t){let n=t[i];"style"==i?e.style.cssText=n:e.getAttribute(i)!=n&&e.setAttribute(i,n)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let n of this.children){if(n==e)return i;i+=n.length+n.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=Wl(this.dom),n=this.length?e>0:t>0;return new ac(this.parent.dom,i+ +!!n,0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof hu)return e;return null}static get(e){return e.cmTile}},cu=class extends lu{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,i=this.dom,n=null,o=e?.node==i?e:null,r=0;for(let s of this.children){if(s.sync(e),r+=s.length+s.breakAfter,t=n?n.nextSibling:i.firstChild,o&&t!=s.dom&&(o.written=!0),s.dom.parentNode==i)for(;t&&t!=s.dom;)t=uu(t);else i.insertBefore(s.dom,t);n=s.dom}for(t=n?n.nextSibling:i.firstChild,o&&t&&(o.written=!0);t;)t=uu(t);this.length=r}};function uu(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var hu=class extends cu{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=lu.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,n=0,o=0;;)if(n==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,n=t.pop()}else{let r=i.children[n++];if(r instanceof du)t.push(n),i=r,n=0;else{let t=o+r.length,i=e(r,o);if(void 0!==i)return i;o=t+r.breakAfter}}}resolveBlock(e,t){let i,n,o=-1,r=-1;if(this.blockTiles((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(i=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!i||!s.isWidget()&&i.isWidget())&&(i=s,o=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,r=e-a)}}),!i&&!n)throw Error("No tile at position "+e);return i&&t<0||!n?{tile:i,offset:o}:{tile:n,offset:r}}},du=class e extends cu{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(t,i){let n=new e(i||document.createElement(t.tagName),t);return i||(n.flags|=4),n}},pu=class e extends cu{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,i,n){let o=new e(i||document.createElement("div"),t);return(!i||!n)&&(o.flags|=4),o}get domAttrs(){return this.attrs}resolveInline(e,t,i){let n=null,o=-1,r=null,s=-1;!function e(a,l){for(let c=0,u=0;c<a.children.length&&u<=l;c++){let h=a.children[c],d=u+h.length;d>=l&&(h.isComposite()?e(h,l-u):(!r||r.isHidden&&(t>0||i&&fu(r,h)))&&(d>l||32&h.flags)?(r=h,s=l-u):(u<l||16&h.flags&&!h.isHidden)&&(n=h,o=l-u)),u=d}}(this,e);let a=(t<0?n:r)||n||r;return a?{tile:a,offset:a==n?o:s}:null}coordsIn(e,t){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let i=Vl(t);return i[i.length-1]||null}(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:e,offset:n}=i;if(this.dom.contains(e.dom))return e.isText()?new ac(e.dom,Math.min(e.dom.nodeValue.length,n)):e.domPosFor(n,16&e.flags?1:32&e.flags?-1:t);let o=i.tile.parent,r=!1;for(let t of o.children){if(r)return new ac(t.dom,0);t==i.tile&&(r=!0)}}return new ac(this.dom,0)}};function fu(e,t){let i=e.coordsIn(0,1),n=t.coordsIn(0,1);return i&&n&&n.top<i.bottom}var gu=class e extends cu{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,i){let n=new e(i||document.createElement(t.tagName),t);return i||(n.flags|=4),n}},mu=class e extends lu{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let i=this.dom.nodeValue.length;e>i&&(e=i);let n=e,o=e,r=0;0==e&&t<0||e==i&&t>=0?Sl.chrome||Sl.gecko||(e?(n--,r=1):o<i&&(o++,r=-1)):t<0?n--:o<i&&o++;let s=ic(this.dom,n,o).getClientRects();if(!s.length)return null;let a=s[(r?r<0:t>=0)?0:s.length-1];return Sl.safari&&!r&&0==a.width&&(a=Array.prototype.find.call(s,e=>e.width)||a),r?Yl(a,r<0):a||null}static of(t,i){let n=new e(i||document.createTextNode(t),t);return i||(n.flags|=2),n}},Tu=class e extends lu{constructor(e,t,i,n){super(e,t,n),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;if(i)return Yl(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),i=null;if(!t.length)return null;let n=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let o=n?t.length-1:0;i=t[o],!(e>0?0==o:o==t.length-1||i.top<i.bottom);o+=n?-1:1);return Yl(i,!n)}}get overrideDOMText(){if(!this.length)return ms.empty;let{root:e}=this;if(!e)return ms.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,i,n,o,r){return r||(r=t.toDOM(i),t.editable||(r.contentEditable="false")),new e(r,n,t,o)}},_u=class extends lu{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ms.empty}coordsIn(e){return this.dom.getBoundingClientRect()}},Eu=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:n,index:o,beforeBreak:r,parents:s}=this;for(;e||t>0;)if(n.isComposite())if(r){if(!e)break;i&&i.break(),e--,r=!1}else if(o==n.children.length){if(!e&&!s.length)break;i&&i.leave(n),r=!!n.breakAfter,({tile:n,index:o}=s.pop()),o++}else{let a=n.children[o],l=a.breakAfter;!(t>0?a.length<=e:a.length<e)||i&&!1===i.skip(a,0,a.length)&&a.isComposite?(s.push({tile:n,index:o}),n=a,o=0,i&&a.isComposite()&&i.enter(a)):(r=!!l,o++,e-=a.length)}else if(o==n.length)r=!!n.breakAfter,({tile:n,index:o}=s.pop()),o++;else{if(!e)break;{let t=Math.min(e,n.length-o);i&&i.skip(n,o,o+t),e-=t,o+=t}}return this.tile=n,this.index=o,this.beforeBreak=r,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},bu=class{constructor(e,t,i,n){this.from=e,this.to=t,this.wrapper=i,this.rank=n}},Ou=class{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,n){this.flushBuffer();let o=this.ensureMarks(t,i),r=o.lastChild;if(r&&r.isText()&&!(8&r.flags)&&r.length+e.length<512){this.cache.reused.set(r,2),(o.children[o.children.length-1]=new mu(r.dom,r.text+e)).parent=o}else o.append(n||mu.of(e,this.cache.find(mu)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?ku(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let n=i;for(let s=t.marks.length-1;s>=0;s--){let e=t.marks[s],i=n.lastChild;if(i instanceof gu&&i.mark.eq(e.mark))i.dom!=e.dom&&i.setDOM(ku(e.dom)),n=i;else{if(this.cache.reused.get(e)){let t=lu.get(e.dom);t&&t.setDOM(ku(e.dom))}let t=gu.of(e.mark,e.dom);n.append(t),n=t}this.cache.reused.set(e,2)}let o=lu.get(e.text);o&&this.cache.reused.set(o,2);let r=new mu(e.text,e.text.nodeValue);r.flags|=8,this.pos=e.range.toB,n.append(r)}addInlineWidget(e,t,i){let n=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);n||this.flushBuffer();let o=this.ensureMarks(t,i);!n&&!(16&e.flags)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){e||=Cu;let i=pu.start(e,t||this.cache.find(pu)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){let i=this.curLine;for(let n=e.length-1;n>=0;n--){let o,r=e[n];if(t>0&&(o=i.lastChild)&&o instanceof gu&&o.mark.eq(r))i=o,t--;else{let e=gu.of(r,this.cache.find(gu,e=>e.mark.eq(r))?.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();
vendor: 4,102 bytes, line 3
3let e=this.curLine.lastChild;(!e||!Ru(this.curLine,!1)||"BR"!=e.dom.nodeName&&e.isWidget()&&!(Sl.ios&&Ru(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Lu,0,32)||new Tu(Lu.toDOM(),0,Lu,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=102*e.rank+e.value.rank,i=new bu(e.from,e.to,e.value,t),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-i.rank||this.wrappers[n-1].to-i.to)<0;)n--;this.wrappers.splice(n,0,i)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let i=e.lastChild;if(t.from<this.pos&&i instanceof du&&i.wrapper.eq(t.wrapper))e=i;else{let i=du.of(t.wrapper,this.cache.find(du,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(i),e=i}}return e}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(_u,void 0,1);return i&&(i.flags=t),i||new _u(t)}flushBuffer(){this.afterWidget&&!(32&this.afterWidget.flags)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},vu=class{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:i,done:n}=this.cursor.next(this.skipCount);if(this.skipCount=0,n)throw Error("Ran out of text content when drawing inline views");this.text=t;let o=this.textOff=Math.min(e,t.length);return i?null:t.slice(0,o)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}},Iu=[Tu,pu,mu,gu,_u,du,hu];for(let dP=0;dP<Iu.length;dP++)Iu[dP].bucket=dP;var Su=class{constructor(e){this.view=e,this.buckets=Iu.map(()=>[]),this.index=Iu.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let n=e.bucket,o=this.buckets[n],r=this.index[n];for(let s=o.length-1;s>=0;s--){let e=(s+r)%o.length,a=o[e];if((!t||t(a))&&!this.reused.has(a))return o.splice(e,1),e<r&&this.index[n]--,this.reused.set(a,i),a}return null}findWidget(e,t,i){let n=this.buckets[0];if(n.length)for(let o=0,r=0;;o++){if(o==n.length){if(r)return null;r=1,o=0}let s=n[o];if(!this.reused.has(s)&&(0==r?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget)))return n.splice(o,1),o<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==i?(this.reused.set(s,1),s):(this.reused.set(s,2),new Tu(s.dom,t,e,-498&s.flags|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},yu=class{constructor(e,t,i,n,o){this.view=e,this.decorations=n,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new Su(e),this.text=new vu(e.state.doc),this.builder=new Ou(this.cache,new hu(e,e.contentDOM),Ba.iter(i)),this.cache.reused.set(t,2),this.old=new Eu(t),this.reuseWalker={skip:(e,t,i)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let n=0,o=0,r=0;;){let s=r<e.length?e[r++]:null,a=s?s.fromA:this.old.root.length;if(a>n){let e=a-n;this.preserve(e,!r,!s),n=a,o+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit
vendor: 7,553 bytes, line 3
3(o,s.toB)),o=s.toB,n=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let n=function(e){let t=[];for(let i=e.parents.length;i>1;i--){let n=i==e.parents.length?e.tile:e.parents[i].tile;n instanceof gu&&t.push(n.mark)}return t}(this.old),o=this.openMarks;this.old.advance(e,i?1:-1,{skip:(e,t,i)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(i-t);else{let r=i>0||t<e.length?Tu.of(e.widget,this.view,i-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&r.flags?(r.flags&=-2,this.builder.addBlockWidget(r)):(this.builder.ensureLine(null),this.builder.addInlineWidget(r,n,o),o=n.length)}else if(e.isText())this.builder.ensureLine(null),t||i!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,i),n,o)):this.builder.addText(e.text,n,o,this.cache.reuse(e)),o=n.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof _u)this.cache.add(e);else{if(!(e instanceof gu))return!1;this.builder.ensureLine(null),this.builder.addMark(e,n,o),this.cache.reused.set(e,1),o=n.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof gu&&n.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?n.length&&=o=0:e instanceof gu&&(n.shift(),o=Math.min(o,n.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,n=this.builder,o=0,r=Ba.spans(this.decorations,e,t,{point:(e,t,r,s,a,l)=>{if(r instanceof xl){if(this.disallowBlockEffectsFor[l]){if(r.block)throw RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=s.length,a>s.length)n.continueWidget(t-e);else{let o=r.widget||(r.block?Au.block:Au.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(r),c=this.cache.findWidget(o,t-e,l)||Tu.of(o,this.view,t-e,l);r.block?(r.startSide>0&&n.addLineStartIfNotCovered(i),n.addBlockWidget(c)):(n.ensureLine(i),n.addInlineWidget(c,s,a))}i=null}else i=function(e,t){let i=t.spec.attributes,n=t.spec.class;return i||n?(e||={class:"cm-line"},i&&yl(i,e),n&&(e.class+=" "+n),e):e}(i,r);t>e&&this.text.skip(t-e)},span:(e,t,o,r)=>{for(let s=e;s<t;){let a=this.text.next(Math.min(512,t-s));null==a?(n.addLineStartIfNotCovered(i),n.addBreak(),s++):(n.ensureLine(i),n.addText(a,o,s==e?r:o.length),s+=a.length),i=null}}});n.addLineStartIfNotCovered(i),this.openWidget=r>o,this.openMarks=r}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let n=e.parentNode;;n=n.parentNode){let e=lu.get(n);if(n==this.view.contentDOM)break;e instanceof gu?t.push(e):e?.isLine()?i=e:e instanceof du||("DIV"!=n.nodeName||i||n==this.view.contentDOM?i||t.push(gu.of(new $l({tagName:n.nodeName.toLowerCase(),attributes:Al(n)}),n)):i=new pu(n,Cu))}return{line:i,marks:t}}};function Ru(e,t){let i=e=>{for(let n of e.children)if((t?n.isText():n.length)||i(n))return!0;return!1};return i(e)}var Cu={class:"cm-line"};function ku(e){let t=lu.get(e);return t&&t.setDOM(e.cloneNode()),e}var Au=class extends Ll{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};Au.inline=new Au("span"),Au.block=new Au("div");var Lu=new class extends Ll{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}},Nu=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=wl.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new hu(e,e.contentDOM),this.updateInner([new ru(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?i=this.domChanged.newSel.head:!function(e,t){let i=!1;return t&&e.iterChangedRanges((e,n)=>{e<t.to&&n>t.from&&(i=!0)}),i}(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let n=i>-1?function(e,t,i){let n=$u(e,i);if(!n)return null;let{node:o,from:r,to:s}=n,a=o.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(n.from,n.to)!=a)return null;let l=t.invertedDesc;return{range:new ru(l.mapPos(r),l.mapPos(s),r,s),text:o}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:i,to:n}=this.hasComposition;t=new ru(i,n,e.changes.mapPos(i,-1),e.changes.mapPos(n,1)).addToSet(t.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(Sl.ie||Sl.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,r=this.blockWrappers;this.updateDeco();let s=function(e,t,i){let n=new Mu;return Ba.compare(e,t,i,n),n.changes}(o,this.decorations,e.changes);s.length&&(t=ru.extendWithRanges(t,s));let a=function(e,t,i){let n=new xu;return Ba.compare(e,t,i,n),n.changes}(r,this.blockWrappers,e.changes);return a.length&&(t=ru.extendWithRanges(t,a)),n&&!t.some(e=>e.fromA<=n.range.fromA&&e.toA>=n.range.toA)&&(t=n.range.addToSet(t.slice())),!(2&this.tile.flags&&0==t.length)&&(this.updateInner(t,n),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let i=this.tile,n=new yu(this.view,i,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&lu.get(t.text)&&n.cache.reused.set(lu.get(t.text),2),this.tile=n.run(e,t),wu(i,n.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=Sl.chrome||Sl.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),n&&(n.written||i.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let n=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof Du&&n.push(o.dom);i.updateGaps(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Hc)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,n=this.view.root.activeElement,o=n==i,r=!o&&!(this.view.state.facet(Gc)||i.tabIndex>-1)&&Hl(i,this.view.observer.selectionRange)&&!(n&&i.contains(n));if(!(o||t||r))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;
3if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),Sl.gecko&&c.empty&&!this.hasComposition&&function(e){return 1==e.node.nodeType&&e.node.firstChild&&(0==e.offset||"false"==e.node.childNodes[e.offset-1].contentEditable)&&(e.offset==e.node.childNodes.length||"false"==e.node.childNodes[e.offset].contentEditable)}(a)){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new ac(e,0),s=!0}let u=this.view.observer.selectionRange;(s||!u.focusNode||(!Gl(a.node,a.offset,u.anchorNode,u.anchorOffset)||!Gl(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,c))&&(this.view.observer.ignore(()=>{Sl.android&&Sl.chrome&&i.contains(u.focusNode)&&function(e,t){for(let i=e;i&&i!=t;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(u.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let e=Bl(this.view.root);if(e)if(c.empty){if(Sl.gecko){let e=function(e,t){return 1==e.nodeType?(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0):0}(a.node,a.offset);if(e&&3!=e){let t=(1==e?rc:sc)(a.node,a.offset);t&&(a=new ac(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();c.anchor>c.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}
vendor: 9,147 bytes, line 3
3r&&this.view.root.activeElement==i&&(i.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new ac(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new ac(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Gl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Bl(e.root),{anchorNode:n,anchorOffset:o}=e.observer.selectionRange;if(!(i&&t.empty&&t.assoc&&i.modify))return;let r=this.lineAt(t.head,t.assoc);if(!r)return;let s=r.posAtStart;if(t.head==s||t.head==s+r.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&i.collapse(n,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let n=i.posAtStart;if(!i.isComposite())return i.isText()?e==i.dom?n+t:n+(t?i.length:0):n;{let o;if(e==i.dom)o=i.dom.childNodes[t];else{let n=0==jl(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==i.dom)break;0==n&&t.firstChild!=t.lastChild&&(n=e==t.firstChild?-1:1),e=t}o=n<0?e:e.nextSibling}if(o==i.dom.firstChild)return n;for(;o&&!lu.get(o);)o=o.nextSibling;if(!o)return n+i.length;for(let e=0,t=n;;e++){let n=i.children[e];if(n.dom==o)return t;t+=n.length+n.breakAfter}}}domAtPos(e,t){let{tile:i,offset:n}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(n,t)}inlineDOMNearPos(e,t){let i,n,o=-1,r=!1,s=-1,a=!1;return this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(r=!0)}else{let c=l+t.length;if(l<=e&&(i=t,o=e-l,r=c<e),c>=e&&!n&&(n=t,s=e-l,a=l>e),l>e&&n)return!0}}),i||n?(r&&n?i=null:a&&i&&(n=null),i&&t<0||!n?i.domIn(o,t):n.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:i,offset:n}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof Du?null:i.coordsInWidget(n,t,!0):i.coordsIn(n,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;return function e(t,i){if(t.isComposite())for(let n of t.children){if(n.length>=i){let t=e(n,i);if(t)return t}if((i-=n.length)<0)break}else if(t.isText()&&i<t.length){let e=Rs(t.text,i);if(e==i)return null;let n=ic(t.dom,i,e).getClientRects();for(let t=0;t<n.length;t++){let e=n[t];if(t==n.length-1||e.top<e.bottom&&e.left<e.right)return e}}return null}(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:n}=e,o=this.view.contentDOM.clientWidth,r=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==lc.LTR,l=0,c=(e,u,h)=>{for(let d=0;d<e.children.length&&!(u>n);d++){let n=e.children[d],p=u+n.length,f=n.dom.getBoundingClientRect(),{height:g}=f;if(h&&!d&&(l+=f.top-h.top),n instanceof du)p>i&&c(n,u,f);else if(u>=i&&(l>0&&t.push(-l),t.push(g+l),l=0,r)){let e=n.dom.lastChild,t=e?Vl(e):[];if(t.length){let e=t[t.length-1],i=a?e.right-f.left:f.right-e.left;i>s&&(s=i,this.minWidth=o,this.minWidthFrom=u,this.minWidthTo=p)}}h&&d==e.children.length-1&&(l+=h.bottom-f.bottom),u=p+n.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?lc.RTL:lc.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,i=0;for(let n of e.children){if(!n.isText()||/[^ -~]/.test(n.text))return;let e=Vl(n.dom);if(1!=e.length)return;i+=e[0].width,t=e[0].height}if(i)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:i/e.length,textHeight:t}}});if(e)return e;let t,i,n,o=document.createElement("div");return o.className="cm-line",o.style.width="99999px",o.style.position="absolute",o.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(o);let e=Vl(o.firstChild)[0];t=o.getBoundingClientRect().height,i=e&&e.width?e.width/27:7,n=e&&e.height?e.height:t,o.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let o=n==t.viewports.length?null:t.viewports[n],r=o?o.from-1:this.view.state.doc.length;if(r>i){let n=(t.lineBlockAt(r).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(wl.replace({widget:new Du(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!o)break;i=o.to+1}return wl.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Kc).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),i=!1,n=this.view.state.facet(Jc).map((e,t)=>{let n="function"==typeof e;return n&&(i=!0),n?e(this.view):e});for(n.length&&(this.dynamicDecorationMap[e++]=i,t.push(Ba.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(qc).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let l of this.view.state.facet(Fc))try{if(l(this.view,e.range,e))return!0}catch(e){Vc(this.view.state,e,"scroll handler")}let t,{range:i}=e,n=this.coordsAt(i.head,i.assoc??(i.empty?0:i.head>i.anchor?-1:1));if(!n)return;!i.empty&&(t=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,t.left),top:Math.min(n.top,t.top),right:Math.max(n.right,t.right),bottom:Math.max(n.bottom,t.bottom)});let o=nu(this.view),r={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;if(function(e,t,i,n,o,r,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,h=!1;u&&!h;)if(1==u.nodeType){let e,d=u==l.body,p=1,f=1;if(d)e=Ql(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:f}=Kl(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*f}}let g=0,m=0;if("nearest"==o)t.top<e.top+s?(m=t.top-(e.top+s),i>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+s)):t.bottom>e.bottom-s&&(m=t.bottom-e.bottom+s,i<0&&t.top-m<e.top&&(m=t.top-(e.top+s)));else{let n=t.bottom-t.top,r=e.bottom-e.top;m=("center"==o&&n<=r?t.top+n/2-r/2:"start"==o||"center"==o&&i<0?t.top-s:t.bottom-r+s)-e.top}if("nearest"==n?t.left<e.left+r?(g=t.left-(e.left+r),i>0&&t.right>e.right+g&&(g=t.right-e.right+r)):t.right>e.right-r&&(g=t.right-e.right+r,i<0&&t.left<e.left+g&&(g=t.left-(e.left+r))):g=("center"==n?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==n==a?t.left-r:t.right-(e.right-e.left)+r)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,i=0;if(m){let e=u.scrollTop;u.scrollTop+=m/f,i=(u.scrollTop-e)*f}if(g){let t=u.scrollLeft;u.scrollLeft+=g/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-i,right:t.right-e,bottom:t.bottom-i},e&&Math.abs(e-g)<1&&(n="nearest"),i&&Math.abs(i-m)<1&&(o="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else{if(11!=u.nodeType)break;u=u.host}}(this.view.scrollDOM,r,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==lc.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(i.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){wu(this.tile)}};function wu(e,t){let i=t?.get(e);if(1!=i){i??e.destroy();for(let i of e.children)wu(i,t)}}function $u(e,t){let i=e.observer.selectionRange;if(!i.focusNode)return null;let n=rc(i.focusNode,i.focusOffset),o=sc(i.focusNode,i.focusOffset),r=n||o;if(o&&n&&o.node!=n.node){let t=lu.get(o.node);if(!t||t.isText()&&t.text!=o.node.nodeValue)r=o;else if(e.docView.lastCompositionAfterCursor){let e=lu.get(n.node);!e||e.isText()&&e.text!=n.node.nodeValue||(r=o)}}if(e.docView.lastCompositionAfterCursor=r!=n,!r)return null;let s=t-r.offset;return{from:s,to:s+r.node.nodeValue.length,node:r.node}}var Mu=class{constructor(){this.changes=[]}compareRange(e,t){Pl(e,t,this.changes)}comparePoint(e,t){Pl(e,t,this.changes)}boundChange(e){Pl(e,e,this.changes)}};var xu=class{constructor(){this.changes=[]}
vendor: 5,433 bytes, line 3
3compareRange(e,t){Pl(e,t,this.changes)}comparePoint(){}boundChange(e){Pl(e,e,this.changes)}};var Du=class extends Ll{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function Pu(e,t,i){let n=e.lineBlockAt(t);if(Array.isArray(n.type)){let e;for(let o of n.type){if(o.from>t)break;if(!(o.to<t)){if(o.from<t&&o.to>t)return o;(!e||o.type==Nl.Text&&(e.type!=o.type||(i<0?o.from<t:o.to>t)))&&(e=o)}}return e||n}return n}function Fu(e,t,i,n){let o=e.state.doc.lineAt(t.head),r=e.bidiSpans(o),s=e.textDirectionAt(o.from);for(let a=t,l=null;;){let t=yc(o,r,s,a,i),c=Sc;if(!t){if(o.number==(i?e.state.doc.lines:1))return a;c="\n",o=e.state.doc.line(o.number+(i?1:-1)),r=e.bidiSpans(o),t=e.visualLineSide(o,!i)}if(l){if(!l(c))return a}else{if(!n)return t;l=n(c)}a=t}}function Bu(e,t,i){for(;;){let n=0;for(let o of e)o.between(t-1,t+1,(e,o,r)=>{if(t>e&&t<o){let r=n||i||(t-e<o-t?-1:1);t=r<0?e:o,n=r}});if(!n)return t}}function Uu(e,t){let i=null;for(let n=0;n<t.ranges.length;n++){let o=t.ranges[n],r=null;if(o.empty){let t=Bu(e,o.from,0);t!=o.from&&(r=Hs.cursor(t,-1))}else{let t=Bu(e,o.from,-1),i=Bu(e,o.to,1);(t!=o.from||i!=o.to)&&(r=Hs.range(o.from==o.anchor?t:i,o.from==o.head?t:i))}r&&(i||=t.ranges.slice(),i[n]=r)}return i?Hs.create(i,t.mainIndex):t}function Hu(e,t,i){let n=Bu(e.state.facet(Zc).map(t=>t(e)),i.from,t.head>i.from?-1:1);return n==i.from?i:Hs.cursor(n,n<i.from?1:-1)}var Vu=class{constructor(e,t){this.pos=e,this.assoc=t}};function Gu(e,t,i,n){let o,r=e.contentDOM.getBoundingClientRect(),s=r.top+e.viewState.paddingTop,{x:a,y:l}=t,c=l-s;for(;;){if(c<0)return new Vu(0,1);if(c>e.viewState.docHeight)return new Vu(e.state.doc.length,-1);if(o=e.elementAtHeight(c),null==n)break;if(o.type==Nl.Text){if(n<0?o.to<e.viewport.from:o.from>e.viewport.to)break;let t=e.docView.coordsAt(n<0?o.from:o.to,n>0?-1:1);if(t&&(n<0?t.top<=c+s:t.bottom>=c+s))break}let t=e.viewState.heightOracle.textHeight/2;c=n>0?o.bottom+t:o.top-t}if(e.viewport.from>=o.to||e.viewport.to<=o.from){if(i)return null;if(o.type==Nl.Text){let t=function(e,t,i,n,o){let r=Math.round((n-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&i.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;r+=Math.floor((o-i.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(i.from,i.to);return i.from+Ja(s,r,e.state.tabSize)}(e,r,o,a,l);return new Vu(t,t==o.from?1:-1)}}if(o.type!=Nl.Text)return c<(o.top+o.bottom)/2?new Vu(o.from,1):new Vu(o.to,-1);let u=e.docView.lineAt(o.from,2);return(!u||u.length!=o.length)&&(u=e.docView.lineAt(o.from,-2)),new Wu(e,a,l,e.textDirectionAt(o.from)).scanTile(u,o.from)}var Wu=class{constructor(e,t,i,n){this.view=e,this.x=t,this.y=i,this.baseDir=n,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[_c.find(n,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:n}=this.bidiSpansAt(e);return n[_c.find(n,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:n}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+n.from<t)}scan(e,t,i=!1){let n,o,r,s=0,a=e.length-1,l=new Set,c=this.bidiIn(e[0],e[a]),u=-1,h=1e9;e:for(;s<a;){let i=a-s,d=s+a>>1;t:if(l.has(d)){let e=s+Math.floor(Math.random()*i);for(let t=0;t<i;t++){if(!l.has(e)){d=e;break t}e++,e==a&&(e=s)}break e}l.add(d);let p=t(d);if(p)for(let t=0;t<p.length;t++){let i=p[t],l=0;if(!(0==i.width&&p.length>1)){if(i.bottom<this.y)(!n||n.bottom<i.bottom)&&(n=i),l=1;else if(i.top>this.y)(!o||o.top>i.top)&&(o=i),l=-1;else{let e=i.left>this.x?this.x-i.left:i.right<this.x?this.x-i.right:0,t=Math.abs(e);t<h&&(u=d,h=t,r=i),e&&(l=e<0==(this.baseDir==lc.LTR)?-1:1)}-1!=l||c&&!this.baseDirAt(e[d],1)?1==l&&(!c||this.baseDirAt(e[d+1],-1))&&(s=d+1):a=d}}}if(!r){let i=n&&(!o||this.y-n.bottom<o.top-this.y)?n:o;return this.y=(i.top+i.bottom)/2,this.scan(e,t,!0)}if(h&&!i){let{top:i,bottom:s}=r;if(n&&n.bottom>(i+i+s)/3)return this.y=n.bottom-1,this.scan(e,t,!0);if(o&&o.top<(i+s+s)/3)return this.y=o.top+1,this.scan(e,t,!0)}let d=(c?this.dirAt(e[u],1):this.baseDir)==lc.LTR;return{i:u,after:this.x>(r.left+r.right)/2==d}}scanText(e,t){let i=[];for(let o=0;o<e.length;o=Rs(e.text,o))i.push(t+o);i.push(t+e.length);let n=this.scan(i,n=>{let o=i[n]-t,r=i[n+1]-t;return ic(e.dom,o,r).getClientRects()});return n.after?new Vu(i[n.i+1],-1):new Vu(i[n.i],1)}scanTile(e,t){if(!e.length)return new Vu(t,1);if(1==e.children.length){let i=e.children[0];if(i.isText())return this.scanText(i,t);if(i.isComposite())return this.scanTile(i,t)}let i=[t];for(let s=0,a=t;s<e.children.length;s++)i.push(a+=e.children[s].length);let n=this.scan(i,t=>{let i=e.children[t];return 48&i.flags?null:(1==i.dom.nodeType?i.dom:ic(i.dom,0,i.length)).getClientRects()}),o=e.children[n.i],r=i[n.i];return o.isText()?this.scanText(o,r):o.isComposite()?this.scanTile(o,r):n.after?new Vu(i[n.i+1],-1):new Vu(r,1)}},Xu="ï¿¿",zu=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(wa.lineSeparator)}append(e){this.text+=e}
vendor: 4,148 bytes, line 3
3lineBreak(){this.text+=Xu}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n);let e=this.text.length;this.readNode(n);let o=lu.get(n),r=n.nextSibling;if(r==t){o?.breakAfter&&!r&&i!=this.view.contentDOM&&this.lineBreak();break}let s=lu.get(r);(o&&s?o.breakAfter:(o?o.breakAfter:Xl(n))||Xl(r)&&("BR"!=n.nodeName||o?.isWidget())&&this.text.length>e)&&!Yu(r,t)&&this.lineBreak(),n=r}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let o,r=-1,s=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),s=this.lineSeparator.length):(o=n.exec(t))&&(r=o.index,s=o[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);i=r+s}}readNode(e){let t=lu.get(e),i=t&&t.overrideDOMText;if(null!=i){this.findPointInside(e,i.length);for(let e=i.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(3==e.nodeType?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(ju(e,i.node,i.offset)?t:0))}};function ju(e,t,i){for(;;){if(!t||i<jl(t))return!1;if(t==e)return!0;i=Wl(t)+1,t=t.parentNode}}function Yu(e,t){let i;for(;e!=t&&e;e=e.nextSibling){let t=lu.get(e);if(!t?.isWidget())return!1;t&&(i||=[]).push(t)}if(i)for(let n of i)if(n.overrideDOMText?.length)return!1;return!0}var Qu=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Ku=class{constructor(e,t,i,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:r}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=qu(e.docView.tile,t,i,0))){let t=o||r?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:i,anchorOffset:n,focusNode:o,focusOffset:r}=e.observer.selectionRange;return i&&(t.push(new Qu(i,n)),(o!=i||r!=n)&&t.push(new Qu(o,r))),t}(e),i=new zu(t,e);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(e,t){if(0==e.length)return null;let i=e[0].pos,n=2==e.length?e[1].pos:i;return i>-1&&n>-1?Hs.single(i+t,n+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,i=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!Ul(e.contentDOM,t.focusNode)?s.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),n=r&&r.node==t.anchorNode&&r.offset==t.anchorOffset||!Ul(e.contentDOM,t.anchorNode)?s.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((Sl.ios||Sl.chrome)&&s.main.empty&&i!=n&&(a.from>0||a.to<e.state.doc.length)){let t=Math.min(i,n),o=Math.max(i,n),r=a.from-t,s=a.to-o;(0==r||1==r||0==t)&&(0==s||-1==s||o==e.state.doc.length)&&(i=0,n=e.state.doc.length)}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(Hs.range(n,i));else if(e.lineWrapping&&n==i&&(!s.main.empty||s.main.head!=i)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(i,-1),n=0;t&&(n=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=Hs.create([Hs.cursor(i,n)])}else this.newSel=Hs.single(n,i)}}};function qu(e,t,i,n){if(e.isComposite()){let o=-1,r=-1,s=-1,a=-1;for(let l=0,c=n,u=n;l<e.children.length;l++){let n=e.children[l],h=c+n.length;if(c<t&&h>i)return qu(n,t,i,c);if(h>=t&&-1==o&&(o=l,r=c),c>i&&n.dom.parentNode==e.dom){s=l,a=u;break}u=h,c=h+n.breakAfter}return{from:r,to:a<0?n+e.length:a,startDOM:(o?e.children[o-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}return e.isText()?{from:n,to:n+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Ju(e,t){let i,{newSel:n}=t,{state:o}=e,r=o.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;
vendor: 5,490 bytes, line 3
3if(t.bounds){let{from:e,to:n}=t.bounds,a=r.from,l=null;(8===s||Sl.android&&t.text.length<n-e)&&(a=r.to,l="end");let c,u,h=o.doc.sliceString(e,n,Xu);!r.empty&&r.from>=e&&r.to<=n&&(t.typeOver||h!=t.text)&&h.slice(0,r.from-e)==t.text.slice(0,r.from-e)&&h.slice(r.to-e)==t.text.slice(c=t.text.length-(h.length-(r.to-e)))?i={from:r.from,to:r.to,insert:ms.of(t.text.slice(r.from-e,c).split(Xu))}:(u=eh(h,t.text,a-e,l))&&(Sl.chrome&&13==s&&u.toB==u.from+2&&"ï¿¿ï¿¿"==t.text.slice(u.from,u.toB)&&u.toB--,i={from:e+u.from,to:e+u.toA,insert:ms.of(t.text.slice(u.from,u.toB).split(Xu))})}else n&&(!e.hasFocus&&o.facet(Gc)||th(n,r))&&(n=null);if(!i&&!n)return!1;if((Sl.mac||Sl.android)&&i&&i.from==i.to&&i.from==r.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==i.insert.length&&(n=Hs.single(n.main.anchor-1,n.main.head-1)),i={from:i.from,to:i.to,insert:ms.of([i.insert.toString().replace("."," ")])}):o.doc.lineAt(r.from).to<r.to&&e.docView.lineHasWidget(r.to)&&e.inputState.insertingTextAt>Date.now()-50?i={from:r.from,to:r.to,insert:o.toText(e.inputState.insertingText)}:Sl.chrome&&i&&i.from==i.to&&i.from==r.head&&"\n "==i.insert.toString()&&e.lineWrapping&&(n&&=Hs.single(n.main.anchor-1,n.main.head-1),i={from:r.from,to:r.to,insert:ms.of([" "])}),i)return Zu(e,i,n,s);if(n&&!th(n,r)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin,"select.pointer"==i&&(n=Uu(o.facet(Zc).map(t=>t(e)),n))),e.dispatch({selection:n,scrollIntoView:t,userEvent:i}),!0}return!1}function Zu(e,t,i,n=-1){if(Sl.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(Sl.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&nc(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==n&&t.insert.length<t.to-t.from&&t.to>o.head)&&nc(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&nc(e.contentDOM,"Delete",46)))return!0;let r=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let s,a=()=>s||=function(e,t,i){let n,o=e.state,r=o.selection.main,s=-1;if(t.from==t.to&&t.from<r.from||t.from>r.to){let i=t.from<r.from?-1:1,n=i<0?r.from:r.to,a=Bu(o.facet(Zc).map(t=>t(e)),n,i);t.from==a&&(s=a)}if(s>-1)n={changes:t,selection:Hs.cursor(t.from+t.insert.length,-1)};else if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let i=r.from<t.from?o.sliceDoc(r.from,t.from):"",s=r.to>t.to?o.sliceDoc(t.to,r.to):"";n=o.replaceSelection(e.state.toText(i+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=o.changes(t),a=i&&i.main.to<=s.newLength?i.main:void 0;if(o.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=r.to+10&&t.to>=r.to-10){let l,c=e.state.sliceDoc(t.from,t.to),u=i&&$u(e,i.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(r.head);let h=r.to-t.to;n=o.changeByRange(i=>{if(i.from==r.from&&i.to==r.to)return{changes:s,range:a||i.map(s)};let n=i.to-h,u=n-c.length;if(e.state.sliceDoc(u,n)!=c||n>=l.from&&u<=l.to)return{range:i};let d=o.changes({from:u,to:n,insert:t.insert}),p=i.to-r.to;return{changes:d,range:a?Hs.range(Math.max(0,a.anchor+p),Math.max(0,a.head+p)):i.map(d)}})}else n={changes:s,selection:a&&o.selection.replaceRange(a)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),o.update(n,{userEvent:a,scrollIntoView:!0})}(e,t,i);return e.state.facet(wc).some(i=>i(e,t.from,t.to,r,a))||e.dispatch(a()),!0}function eh(e,t,i,n){let o=Math.min(e.length,t.length),r=0;for(;r<o&&e.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==o&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;if("end"==n){i-=s+Math.max(0,r-Math.min(s,a))-r}if(s<r&&e.length<t.length){r-=i<=r&&i>=s?r-i:0,a=r+(a-s),s=r}else if(a<r){r-=i<=r&&i>=a?r-i:0,s=r+(s-a),a=r}return{from:r,toA:s,toB:a}}function th(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var ih=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Sl.safari&&e.contentDOM.addEventListener("input",()=>null),Sl.gecko&&function(e){yh.has(e)||(yh.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){!function(e,t){if(!t.bubbles)return!0;
vendor: 6,220 bytes, line 3
3if(t.defaultPrevented)return!1;for(let i,n=t.target;n!=e.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=lu.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}(this.view,e)||this.ignoreDuringComposition(e)||"keydown"==e.type&&this.keydown(e)||(0==this.view.updateState?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e)))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let e of i.observers)e(this.view,t);for(let e of i.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=function(e){let t=Object.create(null);function i(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let n of e){let e=n.spec,t=e&&e.plugin.domEventHandlers,o=e&&e.plugin.domEventObservers;if(t)for(let r in t){let e=t[r];e&&i(r).handlers.push(nh(n.value,e))}if(o)for(let r in o){let e=o[r];e&&i(r).observers.push(nh(n.value,e))}}for(let n in ch)i(n).handlers.push(ch[n]);for(let n in uh)i(n).observers.push(uh[n]);return t}(e),i=this.handlers,n=this.view.contentDOM;for(let o in t)if("scroll"!=o){let e=!t[o].handlers.length,r=i[o];r&&e!=!r.handlers.length&&(n.removeEventListener(o,this.handleEvent),r=null),r||n.addEventListener(o,this.handleEvent,{passive:e})}for(let o in i)"scroll"!=o&&!t[o]&&n.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&sh.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Sl.android&&Sl.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!Sl.ios||e.synthetic||e.altKey||e.metaKey||e.shiftKey||!((t=oh.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||rh.indexOf(e.key)>-1&&e.ctrlKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!(!t||"Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,nc(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(Sl.safari&&!Sl.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function nh(e,t){return(i,n)=>{try{return t.call(e,n,i)}catch(e){Vc(i.state,e)}}}var oh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],rh="dthko",sh=[16,17,18,20,91,92,224,225];function ah(e){return.7*Math.max(0,e)+8}var lh=class{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=ql(e.contentDOM),this.atoms=e.state.facet(Zc).map(t=>t(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(wa.allowMultipleSelections)&&function(e,t){let i=e.state.facet(Cc);return i.length?i[0](t):Sl.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:i}=e.state.selection;if(i.empty)return!1;let n=Bl(e.root);if(!n||0==n.rangeCount)return!0;let o=n.getRangeAt(0).getClientRects();for(let r=0;r<o.length;r++){let e=o[r];if(e.left<=t.clientX&&e.right>=t.clientX&&e.top<=t.clientY&&e.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Eh(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&function(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,n=0,o=0,r=this.view.win.innerWidth,s=this.view.win.innerHeight;this.scrollParents.x&&({left:n,right:r}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:s}=this.scrollParents.y.getBoundingClientRect());let a=nu(this.view);e.clientX-a.left<=n+6?t=-ah(n-e.clientX):e.clientX+a.right>=r-6&&(t=ah(e.clientX-r)),e.clientY-a.top<=o+6?i=-ah(o-e.clientY):e.clientY+a.bottom>=s-6&&(i=ah(e.clientY-s)),this.setScrollSpeed(t,i)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=Uu(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,!1===this.dragging))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};var ch=Object.create(null),uh=Object.create(null),hh=Sl.ie&&Sl.ie_version<15||Sl.ios&&Sl.webkit_version<604;function dh(e,t,i){for(let n of e.facet(t))i=n(i,e);return i}
vendor: 4,218 bytes, line 3
3function ph(e,t){t=dh(e.state,Mc,t);let i,{state:n}=e,o=1,r=n.toText(t),s=r.lines==n.selection.ranges.length;if(null!=Oh&&n.selection.ranges.every(e=>e.empty)&&Oh==r.toString()){let e=-1;i=n.changeByRange(i=>{let a=n.doc.lineAt(i.from);if(a.from==e)return{range:i};e=a.from;let l=n.toText((s?r.line(o++).text:t)+n.lineBreak);return{changes:{from:a.from,insert:l},range:Hs.cursor(i.from+l.length)}})}else i=s?n.changeByRange(e=>{let t=r.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Hs.cursor(e.from+t.length)}}):n.replaceSelection(r);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function fh(e,t,i,n){if(1==n)return Hs.cursor(t,i);if(2==n)return function(e,t,i=1){let n=e.charCategorizer(t),o=e.doc.lineAt(t),r=t-o.from;if(0==o.length)return Hs.cursor(t);0==r?i=1:r==o.length&&(i=-1);let s=r,a=r;i<0?s=Rs(o.text,r,!1):a=Rs(o.text,r);let l=n(o.text.slice(s,a));for(;s>0;){let e=Rs(o.text,s,!1);if(n(o.text.slice(e,s))!=l)break;s=e}for(;a<o.length;){let e=Rs(o.text,a);if(n(o.text.slice(a,e))!=l)break;a=e}return Hs.range(s+o.from,a+o.from)}(e.state,t,i);{let n=e.docView.lineAt(t,i),o=e.state.doc.lineAt(n?n.posAtEnd:t),r=n?n.posAtStart:o.from,s=n?n.posAtEnd:o.to;return s<e.state.doc.length&&s==o.to&&s++,Hs.range(r,s)}}uh.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},uh.wheel=uh.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ch.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),uh.touchstart=(e,t)=>{let i=e.inputState,n=t.targetTouches[0];i.lastTouchTime=Date.now(),n&&(i.lastTouchX=n.clientX,i.lastTouchY=n.clientY),i.setSelectionOrigin("select.pointer")},uh.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},ch.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let n of e.state.facet(Ac))if(i=n(e,t),i)break;if(!i&&0==t.button&&(i=function(e,t){let i=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),n=Eh(t),o=e.state.selection;return{update(e){e.docChanged&&(i.pos=e.changes.mapPos(i.pos),o=o.map(e.changes))},get(t,r,s){let a,l=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=fh(e,l.pos,l.assoc,n);if(i.pos!=l.pos&&!r){let t=fh(e,i.pos,i.assoc,n),o=Math.min(t.from,c.from),r=Math.max(t.to,c.to);c=o<c.from?Hs.range(o,r,c.assoc):Hs.range(r,o,c.assoc)}return r?o.replaceRange(o.main.extend(c.from,c.to,c.assoc)):s&&1==n&&o.ranges.length>1&&(a=function(e,t){for(let i=0;i<e.ranges.length;i++){let{from:n,to:o}=e.ranges[i];if(n<=t&&o>=t)return Hs.create(e.ranges.slice(0,i).concat(e.ranges.slice(i+1)),e.mainIndex==i?0:e.mainIndex-+(e.mainIndex>i))}return null}(o,l.pos))?a:s?o.addRange(c):Hs.create([c])}}}(e,t)),i){let n=!e.hasFocus;e.inputState.startMouseSelection(new lh(e,t,i,n)),n&&e.observer.ignore(()=>{tc(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let o=e.inputState.mouseSelection;if(o)return o.start(t),!1===o.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};var gh=Sl.ie&&Sl.ie_version<=11,mh=null,Th=0,_h=0;function Eh(e){if(!gh)return e.detail;let t=mh,i=_h;return mh=e,_h=Date.now(),Th=!t||i>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Th+1)%3:1}function bh(e,t,i,n){if(!(i=dh(e.state,Mc,i)))return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,s=n&&r&&function(e,t){let i=e.state.facet(kc);return i.length?i[0](t):Sl.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,a={from:o,insert:i},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(o,-1),head:l.mapPos(o,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}ch.dragstart=(e,t)=>{let{selection:{main:i}}=e.state;if(t.target.draggable){let n=e.docView.tile.nearest(t.target);if(n&&n.isWidget()){let e=n.posAtStart,t=e+n.length;(e>=i.to||t<=i.from)&&(i=Hs.range(e,t))}}let{inputState:n}=e;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=i,t.dataTransfer&&(t.dataTransfer.setData("Text",dh(e.state,xc,e.state.sliceDoc(i.from,i.to))
vendor: 16,384 bytes, line 3
3),t.dataTransfer.effectAllowed="copyMove"),!1},ch.dragend=e=>(e.inputState.draggedContent=null,!1),ch.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let i=t.dataTransfer.files;if(i&&i.length){let n=Array(i.length),o=0,r=()=>{++o==i.length&&bh(e,t,n.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<i.length;e++){let t=new FileReader;t.onerror=r,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(n[e]=t.result),r()},t.readAsText(i[e])}return!0}{let i=t.dataTransfer.getData("Text");if(i)return bh(e,t,i,!0),!0}return!1},ch.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let i=hh?null:t.clipboardData;return i?(ph(e,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{e.focus(),i.remove(),ph(e,i.value)},50)}(e),!1)};var Oh=null;ch.copy=ch.cut=(e,t)=>{if(!Hl(e.contentDOM,e.observer.selectionRange))return!1;let{text:i,ranges:n,linewise:o}=function(e){let t=[],i=[],n=!1;for(let o of e.selection.ranges)o.empty||(t.push(e.sliceDoc(o.from,o.to)),i.push(o));if(!t.length){let o=-1;for(let{from:n}of e.selection.ranges){let r=e.doc.lineAt(n);r.number>o&&(t.push(r.text),i.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),o=r.number}n=!0}return{text:dh(e,xc,t.join(e.lineBreak)),ranges:i,linewise:n}}(e.state);if(!i&&!o)return!1;Oh=o?i:null,"cut"==t.type&&!e.state.readOnly&&e.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let r=hh?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",i),!0):(function(e,t){let i=e.dom.parentNode;if(!i)return;let n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=t,n.focus(),n.selectionEnd=t.length,n.selectionStart=0,setTimeout(()=>{n.remove(),e.focus()},50)}(e,i),!1)};var vh=Ta.define();function Ih(e,t){let i=[];for(let n of e.facet($c)){let o=n(e,t);o&&i.push(o)}return i.length?e.update({effects:i,annotations:vh.of(!0)}):null}function Sh(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let i=Ih(e.state,t);i?e.dispatch(i):e.update([])}},10)}uh.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Sh(e)},uh.blur=e=>{e.observer.clearSelectionRange(),Sh(e)},uh.compositionstart=uh.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},uh.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Sl.chrome&&Sl.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},uh.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ch.beforeinput=(e,t)=>{if(("insertText"==t.inputType||"insertCompositionText"==t.inputType)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=t.dataTransfer?.getData("text/plain"),n=t.getTargetRanges();if(i&&n.length){let t=n[0];return Zu(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(i)},null),!0}}let i;if(Sl.chrome&&Sl.android&&(i=oh.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Sl.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),Sl.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>uh.compositionend(e,t),20),!1};var yh=new Set;var Rh=["pre-wrap","normal","pre-line","break-spaces"],Ch=!1;function kh(){Ch=!1}var Ah=class{constructor(e){this.lineWrapping=e,this.doc=ms.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Rh.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let n=e[i];n<0?i++:this.heightSamples[Math.floor(10*n)]||(t=!0,this.heightSamples[Math.floor(10*n)]=!0)}return t}refresh(e,t,i,n,o,r){let s=Rh.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=o,a){this.heightSamples={};for(let e=0;e<r.length;e++){let t=r[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}},Lh=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Nh=class e{constructor(e,t,i,n,o){this.from=e,this.length=t,this.top=i,this.height=n,this._content=o}get type(){return"number"==typeof this._content?Nl.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof xl?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(t){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,i)}},wh=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(wh||={}),$h=.001,Mh=class e{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>$h&&(Ch=!0),this.height=e)}replace(t,i,n){return e.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let o=this,r=i.doc;for(let s=n.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:u}=n[s],h=o.lineAt(a,wh.ByPosNoHeight,i.setDoc(t),0,0),d=h.to>=l?h:o.lineAt(l,wh.ByPosNoHeight,i,0,0);for(u+=d.to-l,l=d.to;s>0&&h.from<=n[s-1].toA;)a=n[s-1].fromA,c=n[s-1].fromB,s--,a<h.from&&(h=o.lineAt(a,wh.ByPosNoHeight,i,0,0));c+=h.from-a,a=h.from;let p=Vh.build(i.setDoc(r),e,c,u);o=xh(o,o.replace(a,l,p))}return o.updateHeight(i,0)}static empty(){return new Fh(0,0,0)}static of(t){if(1==t.length)return t[0];let i=0,n=t.length,o=0,r=0;for(;;)if(i==n)if(o>2*r){let e=t[i-1];e.break?t.splice(--i,1,e.left,null,e.right):t.splice(--i,1,e.left,e.right),n+=1+e.break,o-=e.size}else{if(!(r>2*o))break;{let e=t[n];e.break?t.splice(n,1,e.left,null,e.right):t.splice(n,1,e.left,e.right),n+=2+e.break,r-=e.size}}else if(o<r){let e=t[i++];e&&(o+=e.size)}else{let e=t[--n];e&&(r+=e.size)}let s=0;return null==t[i-1]?(s=1,i--):t[i]??(s=1,n++),new Uh(e.of(t.slice(0,i)),s,e.of(t.slice(n)))}};function xh(e,t){return e==t?e:(e.constructor!=t.constructor&&(Ch=!0),t)}Mh.prototype.size=1;var Dh=wl.replace({}),Ph=class extends Mh{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Nh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,n){return this.spaceAbove&&e<i+this.spaceAbove?new Nh(n,0,i,this.spaceAbove,Dh):this.mainBlock(i,n)}lineAt(e,t,i,n,o){let r=this.mainBlock(n,o);return this.spaceAbove?this.blockAt(0,i,n,o).join(r):r}forEachLine(e,t,i,n,o,r){e<=o+this.length&&t>=o&&r(this.lineAt(0,wh.ByPos,i,n,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setMeasuredHeight(n),this.outdated=!1,this}toString(){return`block(${this.length})`}},Fh=class e extends Ph{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Nh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,i,n){let o=n[0];return 1==n.length&&(o instanceof e||o instanceof Bh&&4&o.flags)&&Math.abs(this.length-o.length)<10?(o instanceof Bh?o=new e(o.length,this.height,this.spaceAbove):o.height=this.height,this.outdated||(o.outdated=!1),o):Mh.of(n)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setMeasuredHeight(n):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Bh=class e extends Mh{constructor(e){super(e,0)}heightMetrics(e,t){let i,n=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,r=o-n+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);i=t/r,this.length>r+1&&(s=(this.height-t)/(this.length-r-1))}else i=this.height/r;return{firstLine:n,lastLine:o,perLine:i,perChar:s}}blockAt(e,t,i,n){let{firstLine:o,lastLine:r,perLine:s,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let o=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),r=t.doc.lineAt(o),l=s+r.length*a,c=Math.max(i,e-l/2);return new Nh(r.from,r.length,c,l,0)}{let n=Math.max(0,Math.min(r-o,Math.floor((e-i)/s))),{from:a,length:l}=t.doc.line(o+n);return new Nh(a,l,i+s*n,s,0)}}lineAt(e,t,i,n,o){if(t==wh.ByHeight)return this.blockAt(e,i,n,o);if(t==wh.ByPosNoHeight){let{from:t,to:n}=i.doc.lineAt(e);return new Nh(t,n-t,0,0,0)}let{firstLine:r,perLine:s,perChar:a}=this.heightMetrics(i,o),l=i.doc.lineAt(e),c=s+l.length*a,u=l.number-r,h=n+s*u+a*(l.from-o-u);return new Nh(l.from,l.length,Math.max(n,Math.min(h,n+this.height-c)),c,0)}forEachLine(e,t,i,n,o,r){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(i,o);for(let c=e,u=n;c<=t;){let t=i.doc.lineAt(c);if(c==e){let i=t.number-s;u+=a*i+l*(e-o-i)}let n=a+l*t.length;r(new Nh(t.from,t.length,u,n,0)),u+=n,c=t.to+1}}replace(t,i,n){let o=this.length-i;if(o>0){let t=n[n.length-1];t instanceof e?n[n.length-1]=new e(t.length+o):n.push(null,new e(o-1))}if(t>0){let i=n[0];i instanceof e?n[0]=new e(t+i.length):n.unshift(new e(t-1),null)}return Mh.of(n)}decomposeLeft(t,i){i.push(new e(t-1),null)}decomposeRight(t,i){i.push(null,new e(this.length-t-1))}updateHeight(t,i=0,n=!1,o){let r=i+this.length;if(o&&o.from<=i+this.length&&o.more){let n=[],s=Math.max(i,o.from),a=-1;for(o.from>i&&n.push(new e(o.from-i-1).updateHeight(t,i));s<=r&&o.more;){let e=t.doc.lineAt(s).length;n.length&&n.push(null);let i=o.heights[o.index++],r=0;i<0&&(r=-i,i=o.heights[o.index++]),-1==a?a=i:Math.abs(i-a)>=$h&&(a=-2);let l=new Fh(e,i,r);l.outdated=!1,n.push(l),s+=e+1}s<=r&&n.push(null,new e(r-s).updateHeight(t,s));let l=Mh.of(n);return(a<0||Math.abs(l.height-this.height)>=$h||Math.abs(a-this.heightMetrics(t,i).perLine)>=$h)&&(Ch=!0),xh(this,l)}return(n||this.outdated)&&(this.setHeight(t.heightForGap(i,i+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Uh=class extends Mh{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return 1&this.flags}blockAt(e,t,i,n){let o=i+this.left.height;return e<o?this.left.blockAt(e,t,i,n):this.right.blockAt(e,t,o,n+this.left.length+this.break)}lineAt(e,t,i,n,o){let r=n+this.left.height,s=o+this.left.length+this.break,a=t==wh.ByHeight?e<r:e<s,l=a?this.left.lineAt(e,t,i,n,o):this.right.lineAt(e,t,i,r,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==wh.ByPosNoHeight?wh.ByPosNoHeight:wh.ByPos;return a?l.join(this.right.lineAt(s,c,i,r,s)):this.left.lineAt(s,c,i,n,o).join(l)}forEachLine(e,t,i,n,o,r){let s=n+this.left.height,a=o+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,i,n,o,r),t>=a&&this.right.forEachLine(e,t,i,s,a,r);else{let l=this.lineAt(a,wh.ByPos,i,n,o);e<l.from&&this.left.forEachLine(e,l.from-1,i,n,o,r),l.to>=e&&l.from<=t&&r(l),t>l.to&&this.right.forEachLine(l.to+1,t,i,s,a,r)}}replace(e,t,i){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let o=[];e>0&&this.decomposeLeft(e,o);let r=o.length;for(let s of i)o.push(s);if(e>0&&Hh(o,r-1),t<this.length){let e=o.length;this.decomposeRight(t,o),Hh(o,e)}return Mh.of(o)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Mh.of(this.break?[e,null,t]:[e,t]):(this.left=xh(this.left,e),this.right=xh(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,n){let{left:o,right:r}=this,s=t+o.length+this.break,a=null;return n&&n.from<=t+o.length&&n.more?a=o=o.updateHeight(e,t,i,n):o.updateHeight(e,t,i),n&&n.from<=s+r.length&&n.more?a=r=r.updateHeight(e,s,i,n):r.updateHeight(e,s,i),a?this.balanced(o,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function Hh(e,t){let i,n;null==e[t]&&(i=e[t-1])instanceof Bh&&(n=e[t+1])instanceof Bh&&e.splice(t-1,3,new Bh(i.length+1+n.length))}var Vh=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Fh?i.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Fh(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let n=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let r=t-e;i.block?this.addBlock(new Ph(r,n,i)):(r||o||n>=5)&&this.addLineDeco(n,o,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Fh(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Bh(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Fh)return e;let t=new Fh(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos+=i}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Fh||this.isCovered?(this.writtenTo<this.po
vendor: 4,211 bytes, line 3
3s||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Fh(0,-1,0));let i=e;for(let n of this.nodes)n instanceof Fh&&n.updateHeight(this.oracle,i),i+=n?n.length:1;return this.nodes}static build(t,i,n,o){let r=new e(n,t);return Ba.spans(i,n,o,r,0),r.finish(n)}};var Gh=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,n){(e<t||i&&i.heightRelevant||n&&n.heightRelevant)&&Pl(e,t,this.changes,5)}};function Wh(e,t){let i=e.getBoundingClientRect(),n=e.ownerDocument,o=n.defaultView||window,r=Math.max(0,i.left),s=Math.min(o.innerWidth,i.right),a=Math.max(0,i.top),l=Math.min(o.innerHeight,i.bottom);for(let c=e.parentNode;c&&c!=n.body;)if(1==c.nodeType){let t=c,i=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&"visible"!=i.overflow){let i=t.getBoundingClientRect();r=Math.max(r,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(c==e.parentNode?o.innerHeight:l,i.bottom)}c="absolute"==i.position||"fixed"==i.position?t.offsetParent:t.parentNode}else{if(11!=c.nodeType)break;c=c.host}return{left:r-i.left,right:Math.max(r,s)-i.left,top:a-(i.top+t),bottom:Math.max(a,l)-(i.top+t)}}function Xh(e,t){let i=e.getBoundingClientRect();return{left:0,right:i.right-i.left,top:t,bottom:i.bottom-(i.top+t)}}var zh=class{constructor(e,t,i,n){this.from=e,this.to=t,this.size=i,this.displaySize=n}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let n=e[i],o=t[i];if(n.from!=o.from||n.to!=o.to||n.size!=o.size)return!1}return!0}draw(e,t){return wl.replace({widget:new jh(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},jh=class extends Ll{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},Yh=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Jh,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=lc.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(Qc).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new Ah(i),this.stateDeco=Zh(t),this.heightMap=Mh.empty().applyChanges(this.stateDeco,ms.empty,this.heightOracle.setDoc(t.doc),[new ru(0,0,0,t.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=wl.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:e,to:t})=>n>=e&&n<=t)){let{from:t,to:i}=this.lineBlockAt(n);e.push(new Qh(t,i))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Jh:new ed(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(td(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=Zh(this.state);let n=e.changedRanges,o=ru.extendWithRanges(n,function(e,t,i){let n=new Gh;return Ba.compare(e,t,i,n,0),n.changes}(i,this.stateDeco,e?e.changes:$s.empty(this.state.doc.length))),r=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);kh(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.
vendor: 2,371 bytes, line 3
3setDoc(this.state.doc),o),(this.heightMap.height!=r||Ch)&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=r);let a=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(l||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Pc)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?lc.RTL:lc.LTR;let r=this.heightOracle.mustRefreshForWrapping(o)||"refresh"===this.mustMeasureContent,s=t.getBoundingClientRect(),a=r||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:i}=Kl(t,s);(e>.005&&Math.abs(this.scaleX-e)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=e,this.scaleY=i,l|=16,r=a=!0)}let u=(parseInt(i.paddingTop)||0)*this.scaleY,h=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=h)&&(this.paddingTop=u,this.paddingBottom=h,l|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=16);let d=ql(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=oc(this.scrollParent||e.win);let f=(this.printing?Xh:Wh)(t,this.paddingTop),g=f.top-this.pixelViewport.top,m=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let T=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;
vendor: 9,754 bytes, line 3
3if(T!=this.inView&&(this.inView=T,T&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),i=e.ownerDocument.defaultView||window;return t.left<i.innerWidth&&t.right>0&&t.top<i.innerHeight&&t.bottom>0}(e.dom))return 0;let _=s.width;if((this.contentDOMWidth!=_||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,l|=16),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(t)&&(r=!0),r||n.lineWrapping&&Math.abs(_-this.contentDOMWidth)>n.charWidth){let{lineHeight:i,charWidth:s,textHeight:a}=e.docView.measureTextSize();r=i>0&&n.refresh(o,i,s,a,Math.max(5,_/s),t),r&&(e.docView.minWidth=0,l|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),kh();for(let i of this.viewports){let o=i.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(i);this.heightMap=(r?Mh.empty().applyChanges(this.stateDeco,ms.empty,this.heightOracle,[new ru(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,r,new Lh(i.from,o))}Ch&&(l|=2)}let E=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,o=this.heightOracle,{visibleTop:r,visibleBottom:s}=this,a=new Qh(n.lineAt(r-1e3*i,wh.ByHeight,o,0,0).from,n.lineAt(s+1e3*(1-i),wh.ByHeight,o,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=n.lineAt(e,wh.ByPos,o,0,0);i="center"==t.y?(s.top+s.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-r,a=new Qh(n.lineAt(i-500,wh.ByHeight,o,0,0).from,n.lineAt(i+r+500,wh.ByHeight,o,0,0).to)}}return a}mapViewport(e,t){let i=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new Qh(this.heightMap.lineAt(i,wh.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,wh.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,wh.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,wh.ByPos,this.heightOracle,0,0),{visibleTop:r,visibleBottom:s}=this;return(0==e||n<=r-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||o>=s+Math.max(10,Math.min(i,250)))&&n>r-2e3&&o<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let n of e)t.touchesRange(n.from,n.to)||i.push(new zh(t.mapPos(n.from),t.mapPos(n.to),n.size,n.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,n=i?1e4:2e3,o=n>>1,r=n<<1;if(this.defaultTextDirection!=lc.LTR&&!i)return[];let s=[],a=(n,r,l,c)=>{if(r-n<o)return;let u=this.state.selection.main,h=[u.from];u.empty||h.push(u.to);for(let e of h)if(e>n&&e<r)return a(n,e-10,l,c),void a(e+10,r,l,c);let d=function(e,t){for(let i of e)if(t(i))return i}(e,e=>e.from>=l.from&&e.to<=l.to&&Math.abs(e.from-n)<o&&Math.abs(e.to-r)<o&&!h.some(t=>e.from<t&&e.to>t));if(!d){if(r<l.to&&t&&i&&t.visibleRanges.some(e=>e.from<=r&&e.to>=r)){let e=t.moveToLineBoundary(Hs.cursor(r),!1,!0).head;e>n&&(r=e)}let e=this.gapSize(l,n,r,c);d=new zh(n,r,e,i||e<2e6?e:2e6)}s.push(d)},l=t=>{if(t.length<r||t.type!=Nl.Text)return;let o=function(e,t,i){let n=[],o=e,r=0;return Ba.spans(i,e,t,{span(){},point(e,t){e>o&&(n.push({from:o,to:e}),r+=e-o),o=t}},20),o<t&&(n.push({from:o,to:t}),r+=t-o),{total:r,ranges:n}}(t.from,t.to,this.stateDeco);if(o.total<r)return;let s,l,c=this.scrollTarget?this.scrollTarget.range.head:null;if(i){let e,i,r=n/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let n=qh(o,c),s=((this.visibleBottom-this.visibleTop)/2+r)/t.height;e=n-s,i=n+s}else e=(this.visibleTop-t.top-r)/t.height,i=(this.visibleBottom-t.top+r)/t.height;s=Kh(o,e),l=Kh(o,i)}else{let i=o.total*this.heightOracle.charWidth,r=n*this.heightOracle.charWidth,a=0;if(i>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+a<this.pixelViewport.left&&(a=n.size-n.displaySize);let u,h,d=this.pixelViewport.left+a,p=this.pixelViewport.right+a;if(null!=c){let e=qh(o,c),t=((p-d)/2+r)/i;u=e-t,h=e+t}else u=(d-r)/i,h=(p+r)/i;s=Kh(o,u),l=Kh(o,h)}s>t.from&&a(t.from,s,t,o),l<t.to&&a(l,t.to,t,o)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(l):l(c);return s}gapSize(e,t,i,n){let o=qh(n,i)-qh(n,t);return this.heightOracle.lineWrapping?e.height*o:n.total*this.heightOracle.charWidth*o}updateLineGaps(e){zh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=wl.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];Ba.spans(t,this.viewport.from,this.viewport.to,{span(e,t){i.push({from:e,to:t})},point(){}},20);let n=0;if(i.length!=this.visibleRanges.length)n=12;else for(let o=0;o<i.length&&!(8&n);o++){let t=this.visibleRanges[o],r=i[o];(t.from!=r.from||t.to!=r.to)&&(n|=4,e&&e.mapPos(t.from,-1)==r.from&&e.mapPos(t.to,1)==r.to||(n|=8))}return this.visibleRanges=i,n}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||td(this.heightMap.lineAt(e,wh.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||td(this.heightMap.lineAt(this.scaler.fromDOM(e),wh.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return td(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Qh=class{constructor(e,t){this.from=e,this.to=t}};function Kh({total:e,ranges:t},i){if(i<=0)return t[0].from;if(i>=1)return t[t.length-1].to;let n=Math.floor(e*i);for(let o=0;;o++){let{from:e,to:i}=t[o],r=i-e;if(n<=r)return e+n;n-=r}}function qh(e,t){let i=0;for(let{from:n,to:o}of e.ranges){if(t<=o){i+=t-n;break}i+=o-n}return i/e.total}var Jh={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function Zh(e){let t=e.facet(Kc).filter(e=>"function"!=typeof e),i=e.facet(Jc).filter(e=>"function"!=typeof e);return i.length&&t.push(Ba.join(i)),t}var ed=class e{constructor(e,t,i){let n=0,o=0,r=0;this.viewports=i.map(({from:i,to:o})=>{let r=t.lineAt(i,wh.ByPos,e,0,0).top,s=t.lineAt(o,wh.ByPos,e,0,0).bottom;return n+=s-r,{from:i,to:o,top:r,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let s of this.viewports)s.domTop=r+(s.top-o)*this.scale,r=s.domBottom=s.domTop+(s.bottom-s.top),o=s.bottom}toDOM(e){for(let t=0,i=0,n=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return n+(e-i)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);i=o.bottom,n=o.domBottom}}fromDOM(e){for(let t=0,i=0,n=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return i+(e-n)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);i=o.bottom,n=o.domBottom}}eq(t){return t instanceof e&&(this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to))}};function td(e,t){if(1==t.scale)return e;let i=t.toDOM(e.top),n=t.toDOM(e.bottom);return new Nh(e.from,e.length,i,n-i,Array.isArray(e._content)?e._content.map(e=>td(e,t)):e._content)}var id=Ws.define({combine:e=>e.join(" ")}),nd=Ws.define({combine:e=>e.indexOf(!0)>-1}),od=il.newName(),rd=il.newName(),sd=il.newName(),ad={"&light":"."+rd,"&dark":"."+sd};function ld(e,t,i){return new il(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!i||!i[t])throw RangeError(`Unsupported selector: ${t}`);return i[t]}):e+" "+t})}var cd=ld("."+od,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}}
vendor: 4,971 bytes, line 3
3,"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},ad),ud={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hd=Sl.ie&&Sl.ie_version<=11,dd=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Zl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);
vendor: 6,496 bytes, line 3
3(Sl.ie&&Sl.ie_version<=11||Sl.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Sl.android&&!1!==e.constructor.EDIT_CONTEXT&&!(Sl.chrome&&Sl.chrome_version<126)&&(this.editContext=new gd(e),e.state.facet(Gc)&&(e.contentDOM.editContext=this.editContext.editContext)),hd&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"==e.type||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(Gc)?i.root.activeElement!=this.dom:!Hl(this.dom,n))return;let o=n.anchorNode&&i.docView.tile.nearest(n.anchorNode);o&&o.isWidget()&&o.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(Sl.ie&&Sl.ie_version<=11||Sl.android&&Sl.chrome)&&!i.state.selection.main.empty&&n.focusNode&&Gl(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Bl(e.root);if(!t)return!1;let i=Sl.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return fd(e,i)}let i=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),i=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),i?fd(e,i):null}(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let n=Hl(this.dom,i);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let i=t.focusNode,n=t.focusOffset;if(!i||t.anchorNode!=i||t.anchorOffset!=n)return!1;for(n=Math.min(n,jl(i));;)if(n){if(1!=i.nodeType)return!1;let e=i.childNodes[n-1];"false"==e.contentEditable?n--:(i=e,n=jl(i))}else{if(i==e)return!0;n=Wl(i),i=i.parentNode}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(1==i.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,ud),hd&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),hd&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&nc(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}(!this.delayedAndroidKey||"Enter"==e)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let o of e){let e=this.readMutation(o);e&&(e.typeOver&&(n=!0),-1==t?({from:t,to:i}=e):(t=Math.min(e.from,t),i=Math.max(e.to,i)))}return{from:t,to:i,typeOver:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Hl(this.dom,this.selectionRange);
vendor: 4,760 bytes, line 3
3if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Ku(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=Ju(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!th(this.view.state.selection,t.newSel.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let i=pd(t,e.previousSibling||e.target.previousSibling,-1),n=pd(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Gc)!=e.state.facet(Gc)&&(e.view.contentDOM.editContext=e.state.facet(Gc)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),null==(e=this.intersection)||e.disconnect(),null==(t=this.gapIntersection)||t.disconnect(),null==(i=this.resizeScroll)||i.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function pd(e,t,i){for(;t;){let n=lu.get(t);if(n&&n.parent==e)return n;let o=t.parentNode;t=o==e.dom?i>0?t.nextSibling:t.previousSibling:o}return null}function fd(e,t){let i=t.startContainer,n=t.startOffset,o=t.endContainer,r=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return Gl(s.node,s.offset,o,r)&&([i,n,o,r]=[o,r,i,n]),{anchorNode:i,anchorOffset:n,focusNode:o,focusOffset:r}}var gd=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let n=e.state.selection.main,{anchor:o,head:r}=n,s=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:s,drifted:!1});let l=a-s>i.text.length;s==this.from&&o<this.from?s=o:a==this.to&&o>this.to&&(a=o);let c=eh(e.state.sliceDoc(s,a),i.text,(l?n.from:n.to)-s,l?"end":null);if(!c){let t=Hs.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));return void(th(t,n)||e.dispatch({selection:t,userEvent:"select"}))}let u={from:c.from+s,to:c.toA+s,insert:ms.of(i.text.slice(c.from,c.toB).split("\n"))};if((Sl.mac||Sl.android)&&u.from==r-1&&/^\. ?$/.test(i.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(u={from:s,to:a,insert:ms.of([i.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Zu(e,u,Hs.single(this.toEditorPos(i.selectionStart,t),this.toEditorPos(i.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)}
vendor: 4,485 bytes, line 3
3,this.handlers.characterboundsupdate=i=>{let n=[],o=null;for(let t=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);t<r;t++){let i=e.coordsForChar(t);o=i&&new DOMRect(i.left,i.top,i.right-i.left,i.bottom-i.top)||o||new DOMRect,n.push(o)}t.updateCharacterBounds(i.rangeStart,n)},this.handlers.textformatupdate=t=>{let i=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,n=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(n)){let o=this.toEditorPos(e.rangeStart),r=this.toEditorPos(e.rangeEnd);if(o<r){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(n)?1:2}px`;i.push(wl.mark({attributes:{style:e}}).range(o,r))}}}e.dispatch({effects:Hc.of(wl.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Bl(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,n=this.pendingContextChange;return e.changes.iterChanges((o,r,s,a,l)=>{if(i)return;let c=l.length-(r-o);if(n&&r>=n.to){if(n.from==o&&n.to==r&&n.insert.eq(l))return n=this.pendingContextChange=null,t+=c,void(this.to+=c);n=null,this.revertPending(e.state)}if(o+=t,(r+=t)<=this.from)this.from+=c,this.to+=c;else if(o<this.to){if(o<this.from||r>this.to||this.to-this.from+l.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(o),this.toContextPos(r),l.toString()),this.to+=c}t+=c}),n&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(i,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},md=class e{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="
3cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Yh(this,e.state||wa.create(e)),e.scrollTo&&e.scrollTo.is(Uc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Xc).map(e=>new jc(e));for(let i of this.plugins)i.update(this);this.observer=new dd(this),this.inputState=new ih(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Nu(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof Oa?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let i,n=!1,o=!1,r=this.state;for(let e of t){if(e.startState!=r)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,a=0,l=null;t.some(e=>e.annotation(vh))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=Ih(r,s),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(wa.phrases)!=this.state.facet(wa.phrases))return this.setState(r);i=su.create(this,r,t),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let i of t){if(h&&=h.map(i.changes),i.scrollIntoView){let{main:t}=i.state.selection,{x:n,y:o}=this.state.facet(e.cursorScrollMargin);h=new Bc(t.empty?t:Hs.cursor(t.head,t.head>t.anchor?-1:1),"nearest","nearest",o,n)}for(let e of i.effects)e.is(Uc)&&(h=e.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=Ed.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(ou)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(id)!=i.state.facet(id)&&(this.viewState.mustMeasureContent=!0),(n||o||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let d of this.state.facet(Nc))try{d(i)}catch(e){Vc(this.state,e,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Ju(this,u)&&c.force&&nc(this.contentDOM,c.key,c.keyCode)})}setState(e){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Yh(this,e),this.plugins=e.facet(Xc).map(e=>new jc(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new Nu(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Xc),i=e.state.facet(Xc);if(t!=i){let n=[];for(let o of i){let i=t.indexOf(o);if(i<0)n.push(new jc(o));else{let t=this.plugins[i];t.mustUpdate=e,n.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let i=t.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(e){Vc(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,n=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:r}=this.viewState;Math.abs(n-this.viewState.scrollOffset)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let s=0;;s++){if(r<0)if(oc(i||this.win))o=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(n);o=e.from,r=e.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&a||([this.measureRequests,l]=[l,this.measureRequests]);let c=l.map(e=>{try{return e.read(this)}catch(e){return Vc(this.state,e),_d}}),u=su.create(this,this.state,[]),h=!1;u.flags|=a,t?t.flags|=a:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),h=this.docView.update(u),h&&this.docViewUpdate());for(let t=0;t<l.length;t++)if(c[t]!=_d)try{let e=l[t];e.write&&e.write(c[t],this)}catch(e){Vc(this.state,e)}if(h&&this.docView.updateSelection(!0),!u.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,r=-1;continue}{let e=((o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-r)/this.scaleY;if((e>1||e<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){n+=e,i?i.scrollTop+=e:this.win.scrollBy(0,e),r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let s of this.state.facet(Nc))s(t)}get themeClasses(){return od+" "+(this.state.facet(nd)?sd:rd)+" "+this.state.facet(id)}updateAttrs(){let e=bd(this,Yc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Gc)?"true":"false",class:"cm-content",style:`${Sl.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),bd(this,Qc,t);let i=this.observer.ignore(()=>{let i=kl(this.contentDOM,this.contentAttrs,t),n=kl(this.dom,this.editorAttrs,e);return i||n});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(t){let i=!0;for(let n of t)for(let t of n.effects)if(t.is(e.announce)){i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(ou);let t=this.state.facet(e.cspNonce);il.mount(this.root,this.styleModules.concat(cd).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Hu(this,e,Fu(this,e,t,i))}moveByGroup(e,t){return Hu(this,e,Fu(this,e,t,t=>function(e,t,i){let n=e.state.charCategorizer(t),o=n(i);return e=>{let t=n(e);return o==Aa.Space&&(o=t),o==t}}(this,e.head,t)))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),o=i[t?i.length-1:0];return Hs.cursor(o.side(t,n)+e.from,o.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return function(e,t,i,n){let o=Pu(e,t.head,t.assoc||-1),r=n&&o.type==Nl.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(r){let t=e.dom.getBoundingClientRect(),n=e.textDirectionAt(o.from),s=e.posAtCoords({x:i==(n==lc.LTR)?t.right-1:t.left+1,y:(r.top+r.bottom)/2});if(null!=s)return Hs.cursor(s,i?-1:1)}return Hs.cursor(i?o.to:o.from,i?-1:1)}(this,e,t,i)}moveVertically(e,t,i){return Hu(this,e,function(e,t,i,n){let o=t.head,r=i?1:-1;if(o==(i?e.state.doc.length:0))return Hs.cursor(o,t.assoc);let s,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(o,t.assoc||((t.empty?i:t.head==t.from)?1:-1)),u=e.documentTop;if(c)a??=c.left-l.left,s=r<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(o);a??=Math.min(l.right-l.left,e.defaultCharacterWidth*(o-t.from)),s=(r<0?t.top:t.bottom)+u}let h=l.left+a,d=e.viewState.heightOracle.textHeight>>1,p=n??d;for(let f=0;;f+=d){let t=s+(p+f)*r,n=Gu(e,{x:h,y:t},!1,r);if(i?t>l.bottom:t<l.top)return Hs.cursor(n.pos,n.assoc);let o=e.coordsAtPos(n.pos,n.assoc),c=o?(o.top+o.bottom)/2:0;if(!o||(i?c>s:c<s))return Hs.cursor(n.pos,n.assoc,void 0,a)}}(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Gu(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Gu(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(e),o=this.bidiSpans(n);return Yl(i,o[_c.find(o,e-n.from,-1,t)].dir==lc.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Dc)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Td)return Ic(e.length);let t,i=this.textDirectionAt(e.from);
3for(let o of this.bidiCache)if(o.from==e.from&&o.dir==i&&(o.fresh||Ec(o.isolates,t=tu(this,e))))return o.order;t||=tu(this,e);let n=function(e,t,i){if(!e)return[new _c(0,0,+(t==uc))];if(t==cc&&!i.length&&!Tc.test(e))return Ic(e.length);if(i.length)for(;e.length>bc.length;)bc[bc.length]=256;let n=[],o=t==cc?0:1;return vc(e,o,o,i,0,e.length,n),n}(e.text,i,t);return this.bidiCache.push(new Ed(e.from,e.to,i,t,!0,n)),n}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||Sl.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{tc(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Uc.of(new Bc("number"==typeof e?Hs.cursor(e):e,t.y??"nearest",t.x??"nearest",t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Uc.of(new Bc(Hs.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return zc.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return zc.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=il.newName(),n=[id.of(i),ou.of(ld(`.${i}`,e))];return t&&t.dark&&n.push(nd.of(!0)),n}static baseTheme(e){return na.lowest(ou.of(ld("."+od,e,ad)))}static findFromDOM(e){let t=e.querySelector(".cm-content");return(t&&lu.get(t)||lu.get(e))?.root?.view||null}};md.styleModule=ou,md.inputHandler=wc,md.clipboardInputFilter=Mc,md.clipboardOutputFilter=xc,md.scrollHandler=Fc,md.focusChangeEffect=$c,md.perLineTextDirection=Dc,md.exceptionSink=Lc,md.updateListener=Nc,md.editable=Gc,md.mouseSelectionStyle=Ac,md.dragMovesSelection=kc,md.clickAddsSelectionRange=Cc,md.decorations=Kc,md.blockWrappers=qc,md.outerDecorations=Jc,md.atomicRanges=Zc,md.bidiIsolatedRanges=eu,md.cursorScrollMargin=Ws.define({combine:e=>{let t=5,i=5;for(let n of e)"number"==typeof n?t=i=n:({x:t,y:i}=n);return{x:t,y:i}}}),md.scrollMargins=iu,md.darkTheme=nd,md.cspNonce=Ws.define({combine:e=>e.length?e[0]:""}),md.contentAttributes=Qc,md.editorAttributes=Yc,md.lineWrapping=md.contentAttributes.of({class:"cm-lineWrapping"}),md.announce=ba.define();var Td=4096,_d={},Ed=class e{constructor(e,t,i,n,o,r){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=o,this.order=r}static update(t,i){if(i.empty&&!t.some(e=>e.fresh))return t;let n=[],o=t.length?t[t.length-1].dir:lc.LTR;for(let r=Math.max(0,t.length-10);r<t.length;r++){let s=t[r];s.dir==o&&!i.touchesRange(s.from,s.to)&&n.push(new e(i.mapPos(s.from,1),i.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}};function bd(e,t,i){for(let n=e.state.facet(t),o=n.length-1;o>=0;o--){let t=n[o],r="function"==typeof t?t(e):t;r&&yl(r,i)}return i}var Od=Sl.mac?"mac":Sl.windows?"win":Sl.linux?"linux":"key";function vd(e,t,i){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==i&&t.shiftKey&&(e="Shift-"+e),e}var Id=na.default(md.domEventHandlers({keydown:(e,t)=>Ld(Rd(t.state),e,t,"editor")})),Sd=Ws.define({enables:Id}),yd=new WeakMap;function Rd(e){let t=e.facet(Sd),i=yd.get(t);return i||yd.set(t,i=function(e,t=Od){let i=Object.create(null),n=Object.create(null),o=(e,t)=>{let i=n[e];if(null==i)n[e]=t;else if(i!=t)throw Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,n,r,s,a)=>{let l=i[e]||(i[e]=Object.create(null)),c=n.split(/ (?!$)/).map(e=>function(e,t){let i,n,o,r,s=e.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(let l=0;l<s.length-1;++l){let e=s[l];if(/^(cmd|meta|m)$/i.test(e))r=!0;else if(/^a(lt)?$/i.test(e))i=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw Error("Unrecognized modifier name: "+e);"mac"==t?r=!0:n=!0}}return i&&(a="Alt-"+a),n&&(a="Ctrl-"+a),r&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<c.length;t++){let i=c.slice(0,t).join(" ");o(i,!0),l[i]||(l[i]={preventDefault:!0,stopPropagation:!1,run:[t=>{let n=Cd={view:t,prefix:i,scope:e};return setTimeout(()=>{Cd==n&&(Cd=null)},kd),!0}]})}let u=c.join(" ");o(u,!1);let h=l[u]||(l[u]={preventDefault:!1,stopPropagation:!1,run:(l._any?.run)?.slice()||[]});r&&h.run.push(r),s&&(h.preventDefault=!0),a&&(h.stopPropagation=!0)};for(let s of e){let e=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let t of e){let e=i[t]||(i[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:n}=s;for(let t in e)e[t].run.push(e=>n(e,Ad))}let n=s[t]||s.key;if(n)for(let t of e)r(t,n,s.run,s.preventDefault,s.stopPropagation),s.shift&&r(t,"Shift-"+n,s.shift,s.preventDefault,s.stopPropagation)}return i}(t.reduce((e,t)=>
vendor: 6,138 bytes, line 3
3e.concat(t),[]))),i}var Cd=null,kd=4e3;var Ad=null;function Ld(e,t,i,n){Ad=t;let o=function(e){var t=!(al&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ll&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?sl:rl)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),r=As(Cs(o,0))==o.length&&" "!=o,s="",a=!1,l=!1,c=!1;Cd&&Cd.view==i&&Cd.scope==n&&(s=Cd.prefix+" ",sh.indexOf(t.keyCode)<0&&(l=!0,Cd=null));let u,h,d=new Set,p=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(i)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},f=e[n];return f&&(p(f[s+vd(o,t,!r)])?a=!0:!r||!(t.altKey||t.metaKey||t.ctrlKey)||Sl.windows&&t.ctrlKey&&t.altKey||Sl.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(u=rl[t.keyCode])||u==o?r&&t.shiftKey&&p(f[s+vd(o,t,!0)])&&(a=!0):(p(f[s+vd(u,t,!0)])||t.shiftKey&&(h=sl[t.keyCode])!=o&&h!=u&&p(f[s+vd(h,t,!1)]))&&(a=!0),!a&&p(f._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),Ad=null,a}var Nd=class e{constructor(e,t,i,n,o){this.className=e,this.left=t,this.top=i,this.width=n,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(t,i,n){if(n.empty){let o=t.coordsAtPos(n.head,n.assoc||1);if(!o)return[];let r=wd(t);return[new e(i,o.left-r.left,o.top-r.top,null,o.bottom-o.top)]}return function(e,t,i){if(i.to<=e.viewport.from||i.from>=e.viewport.to)return[];let n=Math.max(i.from,e.viewport.from),o=Math.min(i.to,e.viewport.to),r=e.textDirection==lc.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=wd(e),c=s.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=Pu(e,n,1),f=Pu(e,o,-1),g=p.type==Nl.Text?p:null,m=f.type==Nl.Text?f:null;if(g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=$d(e,n,1,g)),m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=$d(e,o,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return _(E(i.from,i.to,g));{let t=g?E(i.from,null,g):b(p,!1),n=m?E(null,i.to,m):b(f,!0),o=[];return(g||p).to<(m||f).from-(g&&m?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<n.top?o.push(T(h,t.bottom,d,n.top)):t.bottom<n.top&&e.elementAtHeight((t.bottom+n.top)/2).type==Nl.Text&&(t.bottom=n.top=(t.bottom+n.top)/2),_(t).concat(o).concat(_(n))}function T(e,i,n,o){return new Nd(t,e-l.left,i-l.top,Math.max(0,n-e),o-i)}function _({top:e,bottom:t,horizontal:i}){let n=[];for(let o=0;o<i.length;o+=2)n.push(T(i[o],e,i[o+1],t));return n}function E(t,i,n){let o=1e9,s=-1e9,a=[];function l(t,i,l,c,u){let p=e.coordsAtPos(t,t==n.to?-2:2),f=e.coordsAtPos(l,l==n.from?2:-2);!p||!f||(o=Math.min(p.top,f.top,o),s=Math.max(p.bottom,f.bottom,s),u==lc.LTR?a.push(r&&i?h:p.left,r&&c?d:f.right):a.push(!r&&c?h:f.left,!r&&i?d:p.right))}let c=t??n.from,u=i??n.to;for(let r of e.visibleRanges)if(r.to>c&&r.from<u)for(let n=Math.max(r.from,c),o=Math.min(r.to,u);;){let r=e.state.doc.lineAt(n);for(let s of e.bidiSpans(r)){let e=s.from+r.from,a=s.to+r.from;if(e>=o)break;a>n&&l(Math.max(e,n),null==t&&e<=c,Math.min(a,o),null==i&&a>=u,s.dir)}if(n=r.to+1,n>=o)break}return 0==a.length&&l(c,null==t,u,null==i,e.textDirection),{top:o,bottom:s,horizontal:a}}function b(e,t){let i=a.top+(t?e.top:e.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,i,n)}};function wd(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==lc.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function $d(e,t,i,n){let o=e.coordsAtPos(t,2*i);if(!o)return n;let r=e.dom.getBoundingClientRect(),s=(o.top+o.bottom)/2,a=e.posAtCoords({x:r.left+1,y:s}),l=e.posAtCoords({x:r.right-1,y:s});return null==a||null==l?n:{from:Math.max(n.from,Math.min(a,l)),to:Math.min(n.to,Math.max(a,l))}}var Md=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(xd)!=e.state.facet(xd)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(xd);for(;t<i.length&&i[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!function(e,t){return e.constructor==t.constructor&&e.eq(t)}(e,this.drawn[t]))){let t=this.dom.firstChild,i=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[i].constructor&&n.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(n.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,Sl.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},xd=Ws.define();function Dd(e){return[zc.define(t=>new Md(t,e)),xd.of(e)]}var Pd=Ws.define({combine:e=>$a(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>
vendor: 6,058 bytes, line 3
3Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Fd(e){return e.startState.facet(Pd)!=e.state.facet(Pd)}var Bd=Dd({above:!0,markers(e){let{state:t}=e,i=t.facet(Pd),n=[];for(let o of t.selection.ranges){let r=o==t.selection.main;if(o.empty||i.drawRangeCursor&&!(r&&Sl.ios&&i.iosSelectionHandles)){let t=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=o.empty?o:Hs.cursor(o.head,o.assoc);for(let o of Nd.forRange(e,t,i))n.push(o)}}return n},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let i=Fd(e);return i&&Ud(e.state,t),e.docChanged||e.selectionSet||i},mount(e,t){Ud(t.state,e)},class:"cm-cursorLayer"});function Ud(e,t){t.style.animationDuration=e.facet(Pd).cursorBlinkRate+"ms"}var Hd=Dd({above:!1,markers(e){let t=[],{main:i,ranges:n}=e.state.selection;for(let o of n)if(!o.empty)for(let i of Nd.forRange(e,"cm-selectionBackground",o))t.push(i);if(Sl.ios&&!i.empty&&e.state.facet(Pd).iosSelectionHandles){for(let n of Nd.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Hs.cursor(i.from,1)))t.push(n);for(let n of Nd.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Hs.cursor(i.to,1)))t.push(n)}return t},update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Fd(e),class:"cm-selectionLayer"}),Vd=na.highest(md.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Gd=ba.define({map:(e,t)=>null==e?null:t.mapPos(e)}),Wd=qs.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Gd)?t.value:e,e))}),Xd=zc.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let i=e.state.field(Wd);null==i?null!=this.cursor&&(null==(t=this.cursor)||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Wd)!=i||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(Wd),i=null!=t&&e.coordsAtPos(t);if(!i)return null;let n=e.scrollDOM.getBoundingClientRect();return{left:i.left-n.left+e.scrollDOM.scrollLeft*e.scaleX,top:i.top-n.top+e.scrollDOM.scrollTop*e.scaleY,height:i.bottom-i.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:i}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/i+"px",this.cursor.style.height=e.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Wd)!=e&&this.view.dispatch({effects:Gd.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function zd(e,t,i,n,o){t.lastIndex=0;for(let r,s=e.iterRange(i,n),a=i;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;r=t.exec(s.value);)o(a+r.index,r)}var jd=class{constructor(e){let{regexp:t,decoration:i,decorate:n,boundary:o,maxLength:r=1e3}=e;if(!t.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(e,t,i,o)=>n(o,i,i+e[0].length,e,t);else if("function"==typeof i)this.addMatch=(e,t,n,o)=>{let r=i(e,t,n);r&&o(n,n+e[0].length,r)};else{if(!i)throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,n,o)=>o(n,n+e[0].length,i)}this.boundary=o,this.maxLength=r}createDeco(e){let t=new Ua,i=t.add.bind(t);for(let{from:n,to:o}of function(e,t){let i=e.visibleRanges;if(1==i.length&&i[0].from==e.viewport.from&&i[0].to==e.viewport.to)return i;let n=[];for(let{from:o,to:r}of i)o=Math.max(e.state.doc.lineAt(o).from,o-t),r=Math.min(e.state.doc.lineAt(r).to,r+t),n.length&&n[n.length-1].to>=o?n[n.length-1].to=r:n.push({from:o,to:r});return n}(e,this.maxLength))zd(e.state.doc,this.regexp,n,o,(t,n)=>this.addMatch(n,e,t,i));return t.finish()}updateDeco(e,t){let i=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((t,o,r,s)=>{s>=e.view.viewport.from&&r<=e.view.viewport.to&&(i=Math.min(r,i),n=Math.max(s,n))}),e.viewportMoved||n-i>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),i,n):t}updateRange(e,t,i,n){for(let o of e.visibleRanges){let r=Math.max(o.from,i),s=Math.min(o.to,n);if(s>=r){let i=e.state.doc.lineAt(r),n=i.to<s?e.state.doc.lineAt(s):i,a=Math.max(o.from,i.from),l=Math.min(o.to,n.to);if(this.boundary){for(;r>i.from;r--)if(this.boundary.test(i.text[r-1-i.from])){a=r;break}for(;s<n.to;s++)if(this.boundary.test(n.text[s-n.from])){l=s;break}}let c,u=[],h=(e,t,i)=>u.push(i.range(e,t));if(i==n)for(this.regexp.lastIndex=a-i.from;(c=this.regexp.exec(i.text))&&c.index<l-i.from;)this.addMatch(c,e,c.index+i.from,h);else zd(e.state.doc,this.regexp,a,l,(t,i)=>this.addMatch(i,e,t,h));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:u})}}return t}},Yd=null==/x/.unicode?"g":"gu",Qd=RegExp("[\0-\b\n-��-ÂÂØâââ\u2028\u2029ââ®â¦â§â©\ufeff-]",Yd),Kd={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},qd=null;var Jd=Ws.define({combine(e){let t=$a(e,{render:null,specialChars:Qd,addSpecialChars:null});
3return(t.replaceTabs=!function(){if(null==qd&&typeof document<"u"&&document.body){let e=document.body.style;qd=null!=(e.tabSize??e.MozTabSize)}return qd||!1}())&&(t.specialChars=RegExp("\t|"+t.specialChars.source,Yd)),t.addSpecialChars&&(t.specialChars=RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Yd)),t}});var Zd=null;var ep=class extends Ll{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"â¢":10==e?"â¤":String.fromCharCode(9216+e)}(this.code),i=e.state.phrase("Control character")+" "+(Kd[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}},tp=class extends Ll{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};var ip=wl.line({class:"cm-activeLine"}),np=zc.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,i=[];for(let n of e.state.selection.ranges){let o=e.lineBlockAt(n.head);o.from>t&&(i.push(ip.range(o.from)),t=o.from)}return wl.set(i)}},{decorations:e=>e.decorations}),op=class extends Ll{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Vl(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=Yl(t[0],"rtl"!=i.direction),o=parseInt(i.lineHeight);return n.bottom-n.top>1.5*o?{left:n.left,right:n.right,top:n.top,bottom:n.top+o}:n}ignoreEvent(){return!1}};var rp=2e3;function sp(e,t){let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),n=e.state.doc.lineAt(i),o=i-n.from,r=o>rp?-1:o==n.length?function(e,t){let i=e.coordsAtPos(e.viewport.from);return i?Math.round(Math.abs((i.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):qa(n.text,e.state.tabSize,i-n.from);return{line:n.number,col:r,off:o}}function ap(e,t){let i=sp(e,t),n=e.state.selection;return i?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(i.line).from),o=e.state.doc.lineAt(t);i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},n=n.map(e.changes)}},get(t,o,r){let s=sp(e,t);if(!s)return n;let a=function(e,t,i){let n=Math.min(t.line,i.line),o=Math.max(t.line,i.line),r=[];if(t.off>rp||i.off>rp||t.col<0||i.col<0){let s=Math.min(t.off,i.off),a=Math.max(t.off,i.off);for(let t=n;t<=o;t++){let i=e.doc.line(t);i.length<=a&&r.push(Hs.range(i.from+s,i.to+a))}}else{let s=Math.min(t.col,i.col),a=Math.max(t.col,i.col);for(let t=n;t<=o;t++){let i=e.doc.line(t),n=Ja(i.text,s,e.tabSize,!0);if(n<0)r.push(Hs.cursor(i.to));else{let t=Ja(i.text,a,e.tabSize);r.push(Hs.range(i.from+n,i.from+t))}}}return r}(e.state,i,s);return a.length?r?Hs.create(a.concat(n.ranges)):Hs.create(a):n}}:null}var lp={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},cp={style:"cursor: crosshair"};var up="-10000px",hp=class{constructor(e,t,i,n){this.facet=t,this.createTooltipView=i,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let o=null;this.tooltipViews=this.tooltips.map(e=>o=i(e,o))}update(e,t){var i;let n=e.state.facet(this.facet),o=n.filter(e=>e);if(n===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],s=t?[]:null;for(let a=0;a<o.length;a++){let i=o[a],n=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(n=e)}if(n<0)r[a]=this.createTooltipView(i,a?r[a-1]:null),s&&(s[a]=!!i.above);else{let i=r[a]=this.tooltipViews[n];s&&(s[a]=t[n]),i.update&&i.update(e)}}}for(let a of this.tooltipViews)r.indexOf(a)<0&&(this.removeTooltipView(a),null==(i=a.destroy)||i.call(a));return t&&(s.forEach((e,i)=>t[i]=e),t.length=s.length),this.input=n,this.tooltips=o,this.tooltipViews=r,!0}};function dp(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var pp=Ws.define({combine:e=>({position:Sl.ios?"absolute":e.find(e=>e.position)?.position||"fixed",parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||dp})}),fp=new WeakMap,gp=zc.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(pp);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hp(e,Ep,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}
vendor: 5,067 bytes, line 3
3):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let i=t||e.geometryChanged,n=e.state.facet(pp);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(e,t){let i=e.create(this.view),n=t?t.dom:null;if(i.dom.classList.add("cm-tooltip"),e.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",i.dom.appendChild(e)}return i.dom.style.position=this.position,i.dom.style.top=up,i.dom.style.left="0px",this.container.insertBefore(i.dom,n),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var e,t,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),null==(e=n.destroy)||e.call(n);this.parent&&this.container.remove(),null==(t=this.resizeObserver)||t.disconnect(),null==(i=this.intersectionObserver)||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Sl.safari){let t=e.getBoundingClientRect();i=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else i=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(i||"absolute"==this.position)if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),o=nu(this.view);return{visible:{left:n.left+o.left,top:n.top+o.top,right:n.right-o.right,bottom:n.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(pp).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:t,space:i,scaleX:n,scaleY:o}=e,r=[];for(let s=0;s<this.manager.tooltips.length;s++){let a=this.manager.tooltips[s],l=this.manager.tooltipViews[s],{dom:c}=l,u=e.pos[s],h=e.size[s];if(!u||!1!==a.clip&&(u.bottom<=Math.max(t.top,i.top)||u.top>=Math.min(t.bottom,i.bottom)||u.right<Math.max(t.left,i.left)-.1||u.left>Math.min(t.right,i.right)+.1)){c.style.top=up;continue}let d=a.arrow?l.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,f=h.right-h.left,g=fp.get(l)??h.bottom-h.top,m=l.offset||_p,T=this.view.textDirection==lc.LTR,_=h.width>i.right-i.left?T?i.left:i.right-h.width:T?Math.max(i.left,Math.min(u.left-(d?14:0)+m.x,i.right-f)):Math.min(Math.max(i.left,u.left-f+(d?14:0)-m.x),i.right-f),E=this.above[s];!a.strictSide&&(E?u.top-g-p-m.y<i.top:u.bottom+g+p+m.y>i.bottom)&&E==i.bottom-u.bottom>u.top-i.top&&(E=this.above[s]=!E);let b=(E?u.top-i.top:i.bottom-u.bottom)-p;if(b<g&&!1!==l.resize){if(b<this.view.defaultLineHeight){c.style.top=up;continue}fp.set(l,g),c.style.height=(g=b)/o+"px"}else c.style.height&&(c.style.height="");let O=E?u.top-g-p-m.y:u.bottom+p+m.y,v=_+f;if(!0!==l.overlap)for(let e of r)e.left<v&&e.right>_&&e.top<O+g&&e.bottom>O&&(O=E?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(O-e.parent.top)/o+"px",mp(c,(_-e.parent.left)/n)):(c.style.top=O/o+"px",mp(c,_/n)),d){let e=u.left+(T?m.x:-m.x)-(_+14-7);d.style.left=e/n+"px"}!0!==l.overlap&&r.push({left:_,top:O,right:v,bottom:O+g}),c.classList.toggle("cm-tooltip-above",E),c.classList.toggle("cm-tooltip-below",!E),l.positioned&&l.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&
vendor: 4,851 bytes, line 3
3(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=up}},{eventObservers:{scroll(){this.maybeMeasure()}}});function mp(e,t){let i=parseInt(e.style.left,10);(isNaN(i)||Math.abs(t-i)>1)&&(e.style.left=t+"px")}var Tp=md.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),_p={x:0,y:0},Ep=Ws.define({enables:[gp,Tp]}),bp=Ws.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])}),Op=class e{static create(t){return new e(t)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hp(e,bp,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null==(e=t.destroy)||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let n=i[e];if(void 0!==n)if(void 0===t)t=n;else if(t!==n)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},vp=Ep.compute([bp],e=>{let t=e.facet(bp);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>e.end??e.pos)),create:Op.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Ip=Ws.define(),Sp=class{constructor(e,t,i,n,o,r){this.view=e,this.source=t,this.field=i,this.locked=n,this.setHover=o,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.tile.nearest(t.target);if(!i)return;let n,o=1;if(i.isWidget())n=i.posAtStart;else{if(n=e.posAtCoords(t),null==n)return;let i=e.coordsAtPos(n);if(!i||t.y<i.top||t.y>i.bottom||t.x<i.left-e.defaultCharacterWidth||t.x>i.right+e.defaultCharacterWidth)return;let r=e.bidiSpans(e.state.doc.lineAt(n)).find(e=>e.from<=n&&e.to>=n),s=r&&r.dir==lc.RTL?-1:1;o=t.x<i.left?-s:s}this.activateHover(e,n,o)}activateHover(e,t,i,n){let o=this.source(e,t,i),r=t=>{if(t&&(!Array.isArray(t)||t.length)){let i=Array.isArray(t)?t:[t];n&&this.locked.set(i,n),e.dispatch({effects:this.setHover.of(i)})}};if(o&&"then"in o){let i=this.pending={pos:t};o.then(e=>{this.pending==i&&(this.pending=null,r(e))},t=>Vc(e.state,t,"hover tooltip"))}else r(o)}get tooltip(){let e=this.view.plugin(gp),t=e?e.manager.tooltips.findIndex(e=>e.create==Op.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:t,tooltip:i}=this;if(t.length&&!this.locked.has(t)&&i&&!function(e,t){let i,{left:n,right:o,top:r,bottom:s}=e.getBoundingClientRect();if(i=e.querySelector(".cm-tooltip-arrow")){let e=i.getBoundingClientRect();r=Math.min(e.top,r),s=Math.max(e.bottom,s)}return t.clientX>=n-yp&&t.clientX<=o+yp&&t.clientY>
vendor: 4,590 bytes, line 3
3=r-yp&&t.clientY<=s+yp}(i.dom,e)||this.pending){let{pos:i}=t[0]||this.pending,n=t[0]?.end??i;(i==n?this.view.posAtCoords(this.lastMove)!=i:!function(e,t,i,n,o){let r=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(r.left>n||r.right<n||r.top>o||Math.min(r.bottom,s)<o)return!1;let a=e.posAtCoords({x:n,y:o},!1);return a>=t&&a<=i}(this.view,i,n,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:n}=this;n.length&&!this.locked.has(n)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},yp=4;function Rp(e,t={}){let i=ba.define(),n=new WeakMap,o=qs.define({create:()=>[],update(e,r){let s=n.get(e);if(e.length&&(t.hideOnChange&&(r.docChanged||r.selection)||s&&s(r)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(r,e)))),r.docChanged&&e.length){let t=[];for(let i of e){let e=r.changes.mapPos(i.pos,-1,Ns.TrackDel);if(null!=e){let n=Object.assign(Object.create(null),i);n.pos=e,null!=n.end&&(n.end=r.changes.mapPos(n.end)),t.push(n)}}e=t}for(let t of r.effects)t.is(i)&&(e=t.value,s=void 0),(t.is(kp)&&!t.value||t.value==o)&&(e=[]);return e.length&&s&&n.set(e,s),e},provide:e=>bp.from(e)}),r=zc.define(r=>new Sp(r,e,o,n,i,t.hoverTime||300));return{active:o,extension:[o,r,Ip.of(r),vp]}}function Cp(e,t){let i=e.plugin(gp);if(!i)return null;let n=i.manager.tooltips.indexOf(t);return n<0?null:i.manager.tooltipViews[n]}var kp=ba.define(),Ap=Ws.define({combine(e){let t,i;for(let n of e)t||=n.topContainer,i||=n.bottomContainer;return{topContainer:t,bottomContainer:i}}});function Lp(e,t){let i=e.plugin(Np),n=i?i.specs.indexOf(t):-1;return n>-1?i.panels[n]:null}var Np=zc.fromClass(class{constructor(e){this.input=e.state.facet(Mp),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Ap);this.top=new wp(e,!0,t.topContainer),this.bottom=new wp(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let i of this.panels)i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(e){let t=e.state.facet(Ap);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new wp(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new wp(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=e.state.facet(Mp);if(i!=this.input){let t=i.filter(e=>e),n=[],o=[],r=[],s=[];for(let i of t){let t,a=this.specs.indexOf(i);a<0?(t=i(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),n.push(t),(t.top?o:r).push(t)}this.specs=t,this.panels=n,this.top.sync(o),this.bottom.sync(r);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let n of this.panels)n.update&&n.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>md.scrollMargins.of(t=>{let i=t.plugin(e);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})}),wp=class{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&=void this.dom.remove());if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=$p(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=$p(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}
vendor: 6,250 bytes, line 3
3syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function $p(e){let t=e.nextSibling;return e.remove(),t}var Mp=Ws.define({enables:Np});function xp(e,t){let i,n=new Promise(e=>i=e),o=e=>function(e,t,i){let n=t.content?t.content(e,()=>s(null)):null;if(!n){if(n=hl("form"),t.input){let e=hl("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||="input",n.appendChild(hl("label",(t.label||"")+": ",e))}else n.appendChild(document.createTextNode(t.label||""));n.appendChild(document.createTextNode(" ")),n.appendChild(hl("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let o="FORM"==n.nodeName?[n]:n.querySelectorAll("form");for(let a=0;a<o.length;a++){let e=o[a];e.addEventListener("keydown",t=>{27==t.keyCode?(t.preventDefault(),s(null)):13==t.keyCode&&(t.preventDefault(),s(e))}),e.addEventListener("submit",t=>{t.preventDefault(),s(e)})}let r=hl("div",n,hl("button",{onclick:()=>s(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["Ã"]));function s(t){r.contains(r.ownerDocument.activeElement)&&e.focus(),i(t)}return t.class&&(r.className=t.class),r.classList.add("cm-dialog"),{dom:r,top:t.top,mount:()=>{if(t.focus){let e;e="string"==typeof t.focus?n.querySelector(t.focus):n.querySelector("input")||n.querySelector("button"),e&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}}(e,t,i);e.state.field(Dp,!1)?e.dispatch({effects:Pp.of(o)}):e.dispatch({effects:ba.appendConfig.of(Dp.init(()=>[o]))});let r=Fp.of(o);return{close:r,result:n.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Dp).indexOf(o)>-1&&e.dispatch({effects:r})}),t))}}var Dp=qs.define({create:()=>[],update(e,t){for(let i of t.effects)i.is(Pp)?e=[i.value].concat(e):i.is(Fp)&&(e=e.filter(e=>e!=i.value));return e},provide:e=>Mp.computeN([e],t=>t.field(e))}),Pp=ba.define(),Fp=ba.define();var Bp=class extends Ma{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Bp.prototype.elementClass="",Bp.prototype.toDOM=void 0,Bp.prototype.mapMode=Ns.TrackBefore,Bp.prototype.startSide=Bp.prototype.endSide=-1,Bp.prototype.point=!0;var Up=Ws.define(),Hp=Ws.define(),Vp={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ba.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Gp=Ws.define();function Wp(e){return[zp(),Gp.of({...Vp,...e})]}var Xp=Ws.define({combine:e=>e.some(e=>e)});function zp(e){let t=[jp];return e&&!1===e.fixed&&t.push(Xp.of(!0)),t}var jp=zc.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Gp).map(t=>new qp(e,t)),this.fixed=!e.state.facet(Xp);for(let t of this.gutters)"after"==t.config.side?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,i=e.view.viewport,n=Math.min(t.to,i.to)-Math.max(t.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Xp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=Ba.iter(this.view.state.facet(Up),this.view.viewport.from),n=[],o=this.gutters.map(e=>new Kp(e,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(r.type)){let e=!0;for(let t of r.type)if(t.type==Nl.Text&&e){Qp(i,n,t.from);for(let e of o)e.line(this.view,t,n);e=!1}else if(t.widget)for(let e of o)e.widget(this.view,t)}else if(r.type==Nl.Text){Qp(i,n,r.from);for(let e of o)e.line(this.view,r,n)}else if(r.widget)for(let e of o)e.widget(this.view,r);for(let r of o)r.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Gp),i=e.state.facet(Gp),n=e.docChanged||e.heightChanged||e.viewportChanged||!Ba.eq(e.startState.facet(Up),e.state.facet(Up),e.view.viewport.from,e.view.viewport.to);if(t==i)for(let o of this.gutters)o.update(e)&&(n=!0);else{n=!0;let o=[];for(let n of i){let i=t.indexOf(n);i<0?o.push(new qp(this.view,n)):(this.gutters[i].update(e),o.push(this.gutters[i]))}for(let e of this.gutters)e.dom.remove(),o.indexOf(e)<0&&e.destroy();for(let e of o)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=o}return n}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>md.scrollMargins.of(t=>{let i=t.plugin(e);if(!i||0==i.gutters.length||!i.fixed)return null;let n=i.dom.offsetWidth*t.scaleX,o=i.domAfter?i.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==lc.LTR?{left:n,right:o}:{right:n,left:o}})});function Yp(e){return Array.isArray(e)?e:[e]}function Qp(e,t,i){for(;e.value&&e.from<=i;)e.from==i&&t.push(e.value),e.next()}var Kp=class{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=
3Ba.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:n}=this,o=(t.top-this.height)/e.scaleY,r=t.height/e.scaleY;if(this.i==n.elements.length){let t=new Jp(e,r,o,i);n.elements.push(t),n.dom.appendChild(t.dom)}else n.elements[this.i].update(e,r,o,i);this.height=t.bottom,this.i++}line(e,t,i){let n=[];Qp(this.cursor,n,t.from),i.length&&(n=n.concat(i));let o=this.gutter.config.lineMarker(e,t,n);o&&n.unshift(o);let r=this.gutter;0==n.length&&!r.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),n=i?[i]:null;for(let o of e.state.facet(Hp)){let i=o(e,t.widget,t);i&&(n||=[]).push(i)}n&&this.addElement(e,t,n)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},qp=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,n=>{let o,r=n.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let e=r.getBoundingClientRect();o=(e.top+e.bottom)/2}else o=n.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,s,n)&&n.preventDefault()});this.markers=Yp(t.markers(e)),t.initialSpacer&&(this.spacer=new Jp(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Yp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let i=e.view.viewport;return!Ba.eq(this.markers,t,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}},Jp=class{constructor(e,t,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,n)}update(e,t,i,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].compare(t[i]))return!1;return!0}(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let i="cm-gutterElement",n=this.dom.firstChild;for(let o=0,r=0;;){let s=r,a=o<t.length?t[o++]:null,l=!1;if(a){let e=a.elementClass;e&&(i+=" "+e);for(let t=r;t<this.markers.length;t++)if(this.markers[t].compare(a)){s=t,l=!0;break}}else s=this.markers.length;for(;r<s;){let e=this.markers[r++];if(e.toDOM){e.destroy(n);let t=n.nextSibling;n.remove(),n=t}}if(!a)break;a.toDOM&&(l?n=n.nextSibling:this.dom.insertBefore(a.toDOM(e),n)),l&&r++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}};var Zp=Ws.define(),ef=Ws.define(),tf=Ws.define({combine:e=>$a(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let n in t){let e=i[n],o=t[n];i[n]=e?(t,i,n)=>e(t,i,n)||o(t,i,n):o}return i}})}),nf=class extends Bp{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function of(e,t){return e.state.facet(tf).formatNumber(t,e.state)}var rf=Gp.compute([tf],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Zp),lineMarker:(e,t,i)=>i.some(e=>e.toDOM)?null:new nf(of(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,i)=>{for(let n of e.state.facet(ef)){let o=n(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(tf)!=e.state.facet(tf),initialSpacer:e=>new nf(of(e,sf(e.state.doc.lines))),updateSpacer(e,t){let i=of(t.view,sf(t.view.state.doc.lines));return i==e.number?e:new nf(i)},domEventHandlers:e.facet(tf).domEventHandlers,side:"before"}));function sf(e){let t=9;for(;t<e;)t=10*t+9;return t}var af=new class extends Bp{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},lf=Up.compute(["selection"],e=>{let t=[],i=-1;for(let n of e.selection.ranges){let o=e.doc.lineAt(n.head).from;o>i&&(i=o,t.push(af.range(o)))}return Ba.of(t)});var cf=1024,uf=0,hf=class{constructor(e,t){this.from=e,this.to=t}},df=class{constructor(e={}){this.id=uf++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=gf.match(e)),t=>{let i=e(t);return void 0===i?null:[this,i]}}};df.closedBy=new df({deserialize:e=>e.split(" ")}),df.openedBy=new df({deserialize:e=>e.split(" ")}),df.group=new df({deserialize:e=>e.split(" ")}),df.isolate=new df({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw RangeError("Invalid value for isolate: "+e);return e||"auto"}}),df.contextHash=new df({perNode:!0}),df.lookAhead=new df({perNode:!0}),df.mounted=new df({perNode:!0});var pf=class{constructor(e,t,i,n=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=n}static get(e){return e&&e.props&&e.props[df.mounted.id]}},ff=Object.create(null),gf=class e{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(t){let i=t.props&&t.props.length?Object.create(null):ff,n=!!t.top|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),o=new e(t.name||"",i,t.id,n);if(t.props)for(let e of t.props)if(Array.isArray(e)||(e=e(o)),e){if(e[0].perNode)throw RangeError("Can't store a per-node prop on a node type");i[e[0].id]=e[1]}return o}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(df.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let n of i.split(" "))t[n]=e[i];return e=>{for(let i=e.prop(df.group),n=-1;n<(i?i.length:0);n++){let o=t[n<0?e.name:i[n]];if(o)return o}}}};gf.none=new gf("",Object.create(null),0,8);var mf,Tf=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let i=[];for(let e of this.types){let n=null;for(let i of t){let t=i(e);if(t){n||=Object.assign({},e.props);let i=t[1],o=t[0];o.combine&&o.id in n&&(i=o.combine(n[o.id],i)),n[o.id]=i}}i.push(n?new gf(e.name,n,e.id,e.flags):e)}return new e(i)}},_f=new WeakMap,Ef=new WeakMap;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(mf||={});
vendor: 1,723 bytes, line 3
3var bf=class e{constructor(e,t,i,n,o){if(this.type=e,this.children=t,this.positions=i,this.length=n,this.props=null,o&&o.length){this.props=Object.create(null);for(let[e,t]of o)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=pf.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let e=i.toString();e&&(t&&(t+=","),t+=e)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new $f(this.topNode,e)}cursorAt(e,t=0,i=0){let n=new $f(_f.get(this)||this.topNode);return n.moveTo(e,t),_f.set(this,n._tree),n}get topNode(){return new Rf(this,0,0,null)}resolve(e,t=0){let i=Sf(_f.get(this)||this.topNode,e,t,!1);return _f.set(this,i),i}resolveInner(e,t=0){let i=Sf(Ef.get(this)||this.topNode,e,t,!0);return Ef.set(this,i),i}resolveStack(e,t=0){return function(e,t,i){let n=e.resolveInner(t,i),o=null;for(let r=n instanceof Rf?n:n.context.parent;r;r=r.parent)if(r.index<0){let e=r.parent;(o||=[n]).push(e.resolve(t,i)),r=e}else{let e=pf.get(r.tree);if(e&&e.overlay&&e.overlay[0].from<=t&&e.overlay[e.overlay.length-1].to>=t){let s=new Rf(e.tree,e.overlay[0].from+r.from,-1,r);(o||=[n]).push(Sf(s,t,i,!1))}}return o?Nf(o):n}(this,e,t)}iterate(e){let{enter:t,leave:i,from:n=0,to:o=this.length}=e,r=e.mode||0,s=(r&mf.IncludeAnonymous)>0;for(let a=this.cursor(r|mf.IncludeAnonymous);;){let e=!1;if(a.from<=o&&a.to>=n&&(!s&&a.type.isAnonymous||!1!==t(a))){if(a.firstChild())continue;e=!0}for(;e&&i&&(s||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;e=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];
vendor: 4,591 bytes, line 3
3if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:Pf(gf.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new e(this.type,t,i,n,this.propValues),t.makeTree||((t,i,n)=>new e(gf.none,t,i,n)))}static build(e){return function(e){let{buffer:t,nodeSet:i,maxBufferLength:n=cf,reused:o=[],minRepeatType:r=i.types.length}=e,s=Array.isArray(t)?new Of(t,t.length):t,a=i.types,l=0,c=0;function u(e,t,T,_,E,b){let{id:O,start:v,end:I,size:S}=s,y=c,R=l;if(S<0){if(s.next(),-1==S){let t=o[O];return T.push(t),void _.push(v-e)}if(-3==S)return void(l=O);if(-4==S)return void(c=O);throw RangeError(`Unrecognized record size: ${S}`)}let C,k,A=a[O],L=v-e;if(I-v<=n&&(k=g(s.pos-t,E))){let t=new Uint16Array(k.size-k.skip),n=s.pos-k.size,o=t.length;for(;s.pos>n;)o=m(k.start,t,o);C=new vf(t,I-k.start,i),L=k.start-e}else{let e=s.pos-S;s.next();let t=[],i=[],o=O>=r?O:-1,a=0,l=I;for(;s.pos>e;)o>=0&&s.id==o&&s.size>=0?(s.end<=l-n&&(p(t,i,v,a,s.end,l,o,y,R),a=t.length,l=s.end),s.next()):b>2500?h(v,e,t,i):u(v,e,t,i,o,b+1);if(o>=0&&a>0&&a<t.length&&p(t,i,v,a,v,l,o,y,R),t.reverse(),i.reverse(),o>-1&&a>0){let e=d(A,R);C=Pf(A,t,i,0,t.length,0,I-v,e,e)}else C=f(A,t,i,I-v,y-I,R)}T.push(C),_.push(L)}function h(e,t,o,r){let a=[],l=0,c=-1;for(;s.pos>t;){let{id:e,start:t,end:i,size:o}=s;if(o>4)s.next();else{if(c>-1&&t<c)break;c<0&&(c=i-n),a.push(e,t,i),l++,s.next()}}if(l){let t=new Uint16Array(4*l),n=a[a.length-2];for(let e=a.length-3,i=0;e>=0;e-=3)t[i++]=a[e],t[i++]=a[e+1]-n,t[i++]=a[e+2]-n,t[i++]=i;o.push(new vf(t,a[2]-n,i)),r.push(n-e)}}function d(e,t){return(i,n,o)=>{let r,s,a=0,l=i.length-1;if(l>=0&&(r=i[l])instanceof bf){if(!l&&r.type==e&&r.length==o)return r;(s=r.prop(df.lookAhead))&&(a=n[l]+r.length+s)}return f(e,i,n,o,a,t)}}function p(e,t,n,o,r,s,a,l,c){let u=[],h=[];for(;e.length>o;)u.push(e.pop()),h.push(t.pop()+n-r);e.push(f(i.types[a],u,h,s-r,l-s,c)),t.push(r-n)}function f(e,t,i,n,o,r,s){if(r){let e=[df.contextHash,r];s=s?[e].concat(s):[e]}if(o>25){let e=[df.lookAhead,o];s=s?[e].concat(s):[e]}return new bf(e,t,i,n,s)}function g(e,t){let i=s.fork(),o=0,a=0,l=0,c=i.end-n,u={size:0,start:0,skip:0};e:for(let n=i.pos-e;i.pos>n;){let e=i.size;if(i.id==t&&e>=0){u.size=o,u.start=a,u.skip=l,l+=4,o+=4,i.next();continue}let s=i.pos-e;if(e<0||s<n||i.start<c)break;let h=i.id>=r?4:0,d=i.start;for(i.next();i.pos>s;){if(i.size<0){if(-3!=i.size&&-4!=i.size)break e;h+=4}else i.id>=r&&(h+=4);i.next()}a=d,o+=e,l+=h}return(t<0||o==e)&&(u.size=o,u.start=a,u.skip=l),u.size>4?u:void 0}function m(e,t,i){let{id:n,start:o,end:a,size:u}=s;if(s.next(),u>=0&&n<r){let r=i;if(u>4){let n=s.pos-(u-4);for(;s.pos>n;)i=m(e,t,i)}t[--i]=r,t[--i]=a-e,t[--i]=o-e,t[--i]=n}else-3==u?l=n:-4==u&&(c=n);return i}let T=[],_=[];for(;s.pos>0;)u(e.start||0,e.bufferStart||0,T,_,-1,0);let E=e.length??(T.length?_[0]+T[0].length:0);return new bf(a[e.topID],T.reverse(),_.reverse(),E)}(e)}};bf.empty=new bf(gf.none,[],[],0);var Of=class e{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new e(this.buffer,this.index)}},vf=class e{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return gf.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],n=this.set.types[t],o=n.name;if(/\W/.test(o)&&!n.isError&&(o=JSON.stringify(o)),i==(e+=4))return o;let r=[];for(;e<i;)r.push(this.childString(e)),e=this.buffer[e+3];return o+"("+r.join(",")+")"}findChild(e,t,i,n,o){let{buffer:r}=this,s=-1;for(let a=e;a!=t&&!(If(o,n,r[a+1],r[a+2])&&(s=a,i>0));a=r[a+3]);return s}slice(t,i,n){let o=this.buffer,r=new Uint16Array(i-t),s=0;for(let e=t,a=0;e<i;){r[a++]=o[e++],r[a++]=o[e++]-n;let i=r[a++]=o[e++]-n;r[a++]=o[e++]-t,s=Math.max(s,i)}return new e(r,s,this.set)}};function If(e,t,i,n){switch(e){case-2:return i<t;case-1:return n>=t&&i<t;case 0:return i<t&&n>t;case 1:return i<=t&&n>t;case 2:return n>t;case 4:return!0}}function Sf(e,t,i,n){for(;e.from==e.to||(i<1?e.from>=t:e.from>t)||(i>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof Rf&&e.index<0?null:e.parent;if(!t)return e;e=t}let o=n?0:mf.IgnoreOverlays;if(n)for(let r=e,s=r.parent;s;r=s,s=r.parent)r instanceof Rf&&r.index<0&&s.enter(t,i,o)?.from!=r.from&&(e=s);for(;;){let n=e.enter(t,i,o);if(!n)return e;e=n}}
vendor: 4,138 bytes, line 3
3var yf=class{cursor(e=0){return new $f(this,e)}getChild(e,t=null,i=null){let n=Cf(this,e,t,i);return n.length?n[0]:null}getChildren(e,t=null,i=null){return Cf(this,e,t,i)}resolve(e,t=0){return Sf(this,e,t,!1)}resolveInner(e,t=0){return Sf(this,e,t,!0)}matchContext(e){return kf(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(i=t,t=e.prevSibling):t=e}return i}get node(){return this}get next(){return this.parent}},Rf=class e extends yf{constructor(e,t,i,n){super(),this._tree=e,this.from=t,this.index=i,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,i,n,o,r=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=i>0?a.length:-1;t!=c;t+=i){let c,u=a[t],h=l[t]+s.from;if(r&mf.EnterBracketed&&u instanceof bf&&(c=pf.get(u))&&!c.overlay&&c.bracketed&&n>=h&&n<=h+u.length||If(o,n,h,h+u.length))if(u instanceof vf){if(r&mf.ExcludeBuffers)continue;let e=u.findChild(0,u.buffer.length,i,n-h,o);if(e>-1)return new Lf(new Af(s,u,t,h),null,e)}else if(r&mf.IncludeAnonymous||!u.type.isAnonymous||Mf(u)){let a;if(!(r&mf.IgnoreMounts)&&(a=pf.get(u))&&!a.overlay)return new e(a.tree,h,t,s);let l=new e(u,h,t,s);return r&mf.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(i<0?u.children.length-1:0,i,n,o,r)}}if(r&mf.IncludeAnonymous||!s.type.isAnonymous||(t=s.index>=0?s.index+i:i<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,i,n=0){let o;if(!(n&mf.IgnoreOverlays)&&(o=pf.get(this._tree))&&o.overlay){let r=t-this.from,s=n&mf.EnterBracketed&&o.bracketed;for(let{from:t,to:n}of o.overlay)if((i>0||s?t<=r:t<r)&&(i<0||s?n>=r:n>r))return new e(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,i,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Cf(e,t,i,n){let o=e.cursor(),r=[];if(!o.firstChild())return r;if(null!=i)for(let s=!1;!s;)if(s=o.type.is(i),!o.nextSibling())return r;for(;;){if(null!=n&&o.type.is(n))return r;if(o.type.is(t)&&r.push(o.node),!o.nextSibling())return null==n?r:[]}}function kf(e,t,i=t.length-1){for(let n=e;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[i]&&t[i]!=n.name)return!1;i--}}return!0}var Af=class{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}},Lf=class e extends yf{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(t,i,n){let{buffer:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],t,i-this.context.start,n);return r<0?null:new e(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,i,n=0){if(n&mf.ExcludeBuffers)return null;let{buffer:o}=this.context,r=o.findChild(this.index+4,o.buffer[this.index+3],i>0?1:-1,t-this.context.start,i);return r<0?null:new e(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.
vendor: 1,277 bytes, line 3
3index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,i=t.buffer[this.index+3];return i<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,o=i.buffer[this.index+3];if(o>n){let r=i.buffer[this.index+1];e.push(i.slice(n,o,r)),t.push(0)}return new bf(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Nf(e){if(!e.length)return null;let t=0,i=e[0];for(let r=1;r<e.length;r++){let n=e[r];(n.from>i.from||n.to<i.to)&&(i=n,t=r)}let n=i instanceof Rf&&i.index<0?null:i.parent,o=e.slice();return n?o[t]=n:o.splice(t,1),new wf(o,i)}var wf=class{constructor(e,t){this.heads=e,this.node=t}get next(){return Nf(this.heads)}};var $f=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~mf.EnterBracketed,e instanceof Rf)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;
vendor: 2,347 bytes, line 3
3for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:i,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof Rf?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:n}=this.buffer,o=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,i);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?!(i&mf.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mf.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&mf.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let e=i<0?0:this.stack[i]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(e)}return i<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:i}=n)}else({index:t,_parent:i}=this._tree);for(;i;({index:t,_parent:i}=i))if(t>
vendor: 4,248 bytes, line 3
3-1)for(let n=t+e,o=e<0?-1:i._tree.children.length;n!=o;n+=e){let e=i._tree.children[n];if(this.mode&mf.IncludeAnonymous||e instanceof vf||!e.type.isAnonymous||Mf(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let n=this.index,o=this.stack.length;o>=0;){for(let r=e;r;r=r._parent)if(r.index==n){if(n==this.index)return r;t=r,i=o+1;break e}n=this.stack[--o]}for(let n=i;n<this.stack.length;n++)t=new Lf(this.buffer,t,this.stack[n]);return this.bufferNode=new Lf(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){i++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,n=!0}}}matchContext(e){if(!this.buffer)return kf(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let n=e.length-1,o=this.stack.length-1;n>=0;o--){if(o<0)return kf(this._tree,e,n);let r=i[t.buffer[this.stack[o]]];if(!r.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}};function Mf(e){return e.children.some(e=>e instanceof vf||!e.type.isAnonymous||Mf(e))}var xf=new WeakMap;function Df(e,t){if(!e.isAnonymous||t instanceof vf||t.type!=e)return 1;let i=xf.get(t);if(null==i){i=1;for(let n of t.children){if(n.type!=e||!(n instanceof bf)){i=1;break}i+=Df(e,n)}xf.set(t,i)}return i}function Pf(e,t,i,n,o,r,s,a,l){let c=0;for(let p=n;p<o;p++)c+=Df(e,t[p]);let u=Math.ceil(1.5*c/8),h=[],d=[];return function t(i,n,o,s,a){for(let c=o;c<s;){let o=c,p=n[c],f=Df(e,i[c]);for(c++;c<s;c++){let t=Df(e,i[c]);if(f+t>=u)break;f+=t}if(c==o+1){if(f>u){let e=i[o];t(e.children,e.positions,0,e.children.length,n[o]+a);continue}h.push(i[o])}else{let t=n[c-1]+i[c-1].length-p;h.push(Pf(e,i,n,o,c,p,t,null,l))}d.push(p+a-r)}}(t,i,n,o,0),(a||l)(h,d,s)}var Ff=class{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Lf?this.setBuffer(e.context.buffer,e.index,t):e instanceof Rf&&this.map.set(e.tree,t)}get(e){return e instanceof Lf?this.getBuffer(e.context.buffer,e.index):e instanceof Rf?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},Bf=class e{constructor(e,t,i,n,o=!1,r=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,this.open=!!o|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,i=[],n=!1){let o=[new e(0,t.length,t,0,!1,n)];for(let e of i)e.to>t.length&&o.push(e);return o}static applyChanges(t,i,n=128){if(!i.length)return t;let o=[],r=1,s=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<i.length?i[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;s&&s.from<h;){let i=s;if(l>=i.from||h<=i.to||c){let t=Math.max(i.from,l)-c,n=Math.min(i.to,h)-c;i=t>=n?null:new e(t,n,i.tree,i.offset+c,a>0,!!u)}if(i&&o.push(i),s.to>h)break;s=r<t.length?t[r++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return o}},Uf=class{startParse(e,t,i){return"string"==typeof e&&(e=new Hf(e)),i=i?i.length?i.map(e=>new hf(e.from,e.to)):[new hf(0,0)]:[new hf(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let e=n.advance();if(e)return e}}},Hf=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};new df({perNode:!0});var Vf=0,Gf=class e{constructor(e,t,i,n){this.name=e,this.set=t,this.base=i,this.modified=n,this.id=Vf++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}
3static define(t,i){let n="string"==typeof t?t:"?";if(t instanceof e&&(i=t),i?.base)throw Error("Can not derive from a modified tag");let o=new e(n,[],null,[]);if(o.set.push(o),i)for(let e of i.set)o.set.push(e);return o}static defineModifier(e){let t=new Xf(e);return e=>e.modified.indexOf(t)>-1?e:Xf.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Wf=0,Xf=class e{constructor(e){this.name=e,this.instances=[],this.id=Wf++}static get(t,i){if(!i.length)return t;let n=i[0].instances.find(e=>e.base==t&&function(e,t){return e.length==t.length&&e.every((e,i)=>e==t[i])}(i,e.modified));if(n)return n;let o=[],r=new Gf(t.name,o,t,i);for(let e of i)e.instances.push(r);let s=function(e){let t=[[]];for(let i=0;i<e.length;i++)for(let n=0,o=t.length;n<o;n++)t.push(t[n].concat(e[i]));return t.sort((e,t)=>t.length-e.length)}(i);for(let a of t.set)if(!a.modified.length)for(let t of s)o.push(e.get(a,t));return r}};function zf(e){let t=Object.create(null);for(let i in e){let n=e[i];Array.isArray(n)||(n=[n]);for(let e of i.split(" "))if(e){let i=[],o=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){o=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw RangeError("Invalid path: "+e);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),t+=n[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){o=0;break}if("/"!=s)throw RangeError("Invalid path: "+e);r=e.slice(t)}let s=i.length-1,a=i[s];if(!a)throw RangeError("Invalid path: "+e);t[a]=new Yf(n,o,s>0?i.slice(0,s):null).sort(t[a])}}return jf.add(t)}var jf=new df({combine(e,t){let i,n,o;for(;e||t;){if(!e||t&&e.depth>=t.depth?(o=t,t=t.next):(o=e,e=e.next),i&&i.mode==o.mode&&!o.context&&!i.context)continue;let r=new Yf(o.tags,o.mode,o.context);i?i.next=r:n=r,i=r}return n}}),Yf=class{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};function Qf(e,t){let i=Object.create(null);for(let r of e)if(Array.isArray(r.tag))for(let e of r.tag)i[e.id]=r.class;else i[r.tag.id]=r.class;let{scope:n,all:o=null}=t||{};return{style:e=>{let t=o;for(let n of e)for(let e of n.set){let n=i[e.id];if(n){t=t?t+" "+n:n;break}}return t},scope:n}}function Kf(e,t,i,n=0,o=e.length){let r=new qf(n,Array.isArray(t)?t:[t],i);r.highlightRange(e.cursor(),n,o,"",r.highlighters),r.flush(o)}Yf.empty=new Yf([],2,null);var qf=class{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,n,o){let{type:r,from:s,to:a}=e;if(s>=i||a<=t)return;r.isTop&&(o=this.highlighters.filter(e=>!e.scope||e.scope(r)));let l=n,c=function(e){let t=e.type.prop(jf);for(;t&&t.context&&!e.matchContext(t.context);
vendor: 7,520 bytes, line 3
3)t=t.next;return t||null}(e)||Yf.empty,u=function(e,t){let i=null;for(let n of e){let e=n.style(t);e&&(i=i?i+" "+e:e)}return i}(o,c.tags);if(u&&(l&&(l+=" "),l+=u,1==c.mode&&(n+=(n?" ":"")+u)),this.startSpan(Math.max(t,s),l),c.opaque)return;let h=e.tree&&e.tree.prop(df.mounted);if(h&&h.overlay){let r=e.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter(e=>!e.scope||e.scope(h.tree.type)),u=e.firstChild();for(let d=0,p=s;;d++){let f=d<h.overlay.length?h.overlay[d]:null,g=f?f.from+s:a,m=Math.max(t,p),T=Math.min(i,g);if(m<T&&u)for(;e.from<T&&(this.highlightRange(e,m,T,n,o),this.startSpan(Math.min(T,e.to),l),!(e.to>=g)&&e.nextSibling()););if(!f||g>i)break;p=f.to+s,p>t&&(this.highlightRange(r.cursor(),Math.max(t,f.from+s),Math.min(i,p),"",c),this.startSpan(Math.min(i,p),l))}u&&e.parent()}else if(e.firstChild()){h&&(n="");do{if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,o),this.startSpan(Math.min(i,e.to),l)}}while(e.nextSibling());e.parent()}}};var Jf=Gf.define,Zf=Jf(),eg=Jf(),tg=Jf(eg),ig=Jf(eg),ng=Jf(),og=Jf(ng),rg=Jf(ng),sg=Jf(),ag=Jf(sg),lg=Jf(),cg=Jf(),ug=Jf(),hg=Jf(ug),dg=Jf(),pg={comment:Zf,lineComment:Jf(Zf),blockComment:Jf(Zf),docComment:Jf(Zf),name:eg,variableName:Jf(eg),typeName:tg,tagName:Jf(tg),propertyName:ig,attributeName:Jf(ig),className:Jf(eg),labelName:Jf(eg),namespace:Jf(eg),macroName:Jf(eg),literal:ng,string:og,docString:Jf(og),character:Jf(og),attributeValue:Jf(og),number:rg,integer:Jf(rg),float:Jf(rg),bool:Jf(ng),regexp:Jf(ng),escape:Jf(ng),color:Jf(ng),url:Jf(ng),keyword:lg,self:Jf(lg),null:Jf(lg),atom:Jf(lg),unit:Jf(lg),modifier:Jf(lg),operatorKeyword:Jf(lg),controlKeyword:Jf(lg),definitionKeyword:Jf(lg),moduleKeyword:Jf(lg),operator:cg,derefOperator:Jf(cg),arithmeticOperator:Jf(cg),logicOperator:Jf(cg),bitwiseOperator:Jf(cg),compareOperator:Jf(cg),updateOperator:Jf(cg),definitionOperator:Jf(cg),typeOperator:Jf(cg),controlOperator:Jf(cg),punctuation:ug,separator:Jf(ug),bracket:hg,angleBracket:Jf(hg),squareBracket:Jf(hg),paren:Jf(hg),brace:Jf(hg),content:sg,heading:ag,heading1:Jf(ag),heading2:Jf(ag),heading3:Jf(ag),heading4:Jf(ag),heading5:Jf(ag),heading6:Jf(ag),contentSeparator:Jf(sg),list:Jf(sg),quote:Jf(sg),emphasis:Jf(sg),strong:Jf(sg),link:Jf(sg),monospace:Jf(sg),strikethrough:Jf(sg),inserted:Jf(),deleted:Jf(),changed:Jf(),invalid:Jf(),meta:dg,documentMeta:Jf(dg),annotation:Jf(dg),processingInstruction:Jf(dg),definition:Gf.defineModifier("definition"),constant:Gf.defineModifier("constant"),function:Gf.defineModifier("function"),standard:Gf.defineModifier("standard"),local:Gf.defineModifier("local"),special:Gf.defineModifier("special")};for(let dP in pg){let e=pg[dP];e instanceof Gf&&(e.name=dP)}Qf([{tag:pg.link,class:"tok-link"},{tag:pg.heading,class:"tok-heading"},{tag:pg.emphasis,class:"tok-emphasis"},{tag:pg.strong,class:"tok-strong"},{tag:pg.keyword,class:"tok-keyword"},{tag:pg.atom,class:"tok-atom"},{tag:pg.bool,class:"tok-bool"},{tag:pg.url,class:"tok-url"},{tag:pg.labelName,class:"tok-labelName"},{tag:pg.inserted,class:"tok-inserted"},{tag:pg.deleted,class:"tok-deleted"},{tag:pg.literal,class:"tok-literal"},{tag:pg.string,class:"tok-string"},{tag:pg.number,class:"tok-number"},{tag:[pg.regexp,pg.escape,pg.special(pg.string)],class:"tok-string2"},{tag:pg.variableName,class:"tok-variableName"},{tag:pg.local(pg.variableName),class:"tok-variableName tok-local"},{tag:pg.definition(pg.variableName),class:"tok-variableName tok-definition"},{tag:pg.special(pg.variableName),class:"tok-variableName2"},{tag:pg.definition(pg.propertyName),class:"tok-propertyName tok-definition"},{tag:pg.typeName,class:"tok-typeName"},{tag:pg.namespace,class:"tok-namespace"},{tag:pg.className,class:"tok-className"},{tag:pg.macroName,class:"tok-macroName"},{tag:pg.propertyName,class:"tok-propertyName"},{tag:pg.operator,class:"tok-operator"},{tag:pg.comment,class:"tok-comment"},{tag:pg.meta,class:"tok-meta"},{tag:pg.invalid,class:"tok-invalid"},{tag:pg.punctuation,class:"tok-punctuation"}]);var fg=new df;var gg=new df,mg=class{constructor(e,t,i=[],n=""){this.data=e,this.name=n,wa.prototype.hasOwnProperty("tree")||Object.defineProperty(wa.prototype,"tree",{get(){return _g(this)}}),this.parser=t,this.extension=[Cg.of(this),wa.languageData.of((e,t,i)=>{let n=Tg(e,t,i),o=n.type.prop(fg);if(!o)return[];let r=e.facet(o),s=n.type.prop(gg);if(s){let o=n.resolve(t-n.from,i);for(let t of s)if(t.test(o,e)){let i=e.facet(t.facet);return"replace"==t.type?i:i.concat(r)}}return r})].concat(i)}isActiveAt(e,t,i=-1){return Tg(e,t,i).type.prop(fg)==this.data}findRegions(e){let t=e.facet(Cg);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(e,t)=>{if(e.prop(fg)==this.data)return void i.push({from:t,to:t+e.length});let o=e.prop(df.mounted);if(o){if(o.tree.prop(fg)==this.data){if(o.overlay)for(let e of o.overlay)i.push({from:e.from+t,to:e.to+t});else i.push({from:t,to:t+e.length});return}if(o.overlay){let e=i.length;if(n(o.tree,o.overlay[0].from+t),i.length>e)return}}for(let i=0;i<e.children.length;i++){let o=e.children[i];o instanceof bf&&n(o,e.positions[i]+t)}};return n(_g(e),0),i}get allowsNesting(){return!0}};function Tg(e,t,i){let n=e.facet(Cg),o=_g(e).topNode;if(!n||n.allowsNesting)for(let r=o;r;r=r.enter(t,i,mf.ExcludeBuffers|mf.EnterBracketed))r.type.isTop&&(o=r);return o}mg.setState=ba.define();function _g(e){let t=e.field(mg.state,!1);return t?t.tree:bf.empty}var Eg=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}},bg=null,Og=class e{constructor(e,t,i=[],n,o,r,s,a){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=o,this.viewport=r,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,i,n){return new e(t,i,[],bf.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Eg(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=bf.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Bf.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(t??this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Bf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=bg;bg=this;try{return e()}finally{bg=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=vg(e,t.from,t.to);return e}changes(t,i){let{fragments:n,tree:o,treeLen:r,viewport:s,skipped:a}=this;if(this.takeTree(),!t.empty){let e=[];
vendor: 6,215 bytes, line 3
3if(t.iterChangedRanges((t,i,n,o)=>e.push({fromA:t,toA:i,fromB:n,toB:o})),n=Bf.applyChanges(n,e),o=bf.empty,r=0,s={from:t.mapPos(s.from,-1),to:t.mapPos(s.to,1)},this.skipped.length){a=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);i<n&&a.push({from:i,to:n})}}}return new e(this.parser,i,n,o,r,s,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:t,to:n}=this.skipped[i];t<e.to&&n>e.from&&(this.fragments=vg(this.fragments,t,n),this.skipped.splice(i--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Uf{createParse(t,i,n){let o=n[0].from,r=n[n.length-1].to;return{parsedPos:o,advance(){let t=bg;if(t){for(let e of n)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=r,new bf(gf.none,[],[],r-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return bg}};function vg(e,t,i){return Bf.applyChanges(e,[{fromA:t,toA:i,fromB:t,toB:i}])}var Ig=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,n)||i.takeTree(),new e(i)}static init(t){let i=Math.min(3e3,t.doc.length),n=Og.create(t.facet(Cg).parser,t,{from:0,to:i});return n.work(20,i)||n.takeTree(),new e(n)}};mg.state=qs.define({create:Ig.init,update(e,t){for(let i of t.effects)if(i.is(mg.setState))return i.value;return t.startState.facet(Cg)==t.state.facet(Cg)?e.apply(t):Ig.init(t.state)}});var Sg=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Sg=e=>{let t=-1,i=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(i):cancelIdleCallback(t)});var yg=typeof navigator<"u"&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,Rg=zc.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(mg.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(mg.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Sg(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,o=i.field(mg.state);if(o.tree==o.context.tree&&o.context.isDone(n+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,e&&!yg?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<n&&i.doc.length>n+1e3,a=o.context.work(()=>yg&&yg()||Date.now()>r,n+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:mg.setState.of(new Ig(o.context))})),this.chunkBudget>0&&!(a&&!s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Vc(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Cg=Ws.define({combine:e=>e.length?e[0]:null,enables:e=>[mg.state,Rg,md.contentAttributes.compute([e],t=>{let i=t.facet(e);return i&&i.name?{"data-language":i.name}:{}})]}),kg=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},Ag=Ws.define(),Lg=Ws.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Ng(e){let t=e.facet(Lg);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function wg(e,t){let i="",n=e.tabSize,o=e.facet(Lg)[0];if("\t"==o){for(;t>=n;)i+="\t",t-=n;o=" "}for(let r=0;r<t;r++)i+=o;return i}function $g(e,t){e instanceof wa&&(e=new Mg(e));for(let n of e.state.facet(Ag)){let i=n(e,t);if(void 0!==i)return i}let i=_g(e.state);return i.length>=t?function(e,t,i){let n=t.resolveStack(i),o=t.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(o!=n.node){let e=[];for(let t=o;t&&!(t.from<n.node.from||t.to>n.node.to||t.from==n.node.from&&t.type==n.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)n={node:e[t],next:n}}return Dg(n,e,i)}(e,i,t):null}var Mg=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ng(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:o}=this.options;return null!=n&&n>=i.from&&n<=i.to?o&&n==e?{text:"",from:e}:(t<0?n<e:n<=e)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(e,t);return i.slice(e-n,Math.min(i.length,e+100-n))}column(e,t=1){let{text:i,from:n}=this.lineAt(e,t),o=this.countColumn(i,e-n),r=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return r>-1&&(o+=r-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return qa(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:n}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let e=o(n);if(e>-1)return e}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},xg=new df;function Dg(e,t,i){for(let n=e;n;n=n.next){let e=Pg(n.node);
3if(e)return e(Bg.create(t,i,n))}return 0}function Pg(e){let t=e.type.prop(xg);if(t)return t;let i,n=e.firstChild;if(n&&(i=n.type.prop(df.closedBy))){let t=e.lastChild,n=t&&i.indexOf(t.name)>-1;return e=>Vg(e,!0,1,void 0,n&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Fg:null}function Fg(){return 0}var Bg=class e extends Mg{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(t,i,n){return new e(t,i,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Ug(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Dg(this.context.next,this.base,this.pos)}};function Ug(e,t){for(let i=t;i;i=i.parent)if(e==i)return!0;return!1}function Hg({closing:e,align:t=!0,units:i=1}){return n=>Vg(n,t,i,e)}function Vg(e,t,i,n,o){let r=e.textAfter,s=r.match(/^\s*/)[0].length,a=n&&r.slice(s,s+n.length)==n||o==e.pos+s,l=t?function(e){let t=e.node,i=t.childAfter(t.from),n=t.lastChild;if(!i)return null;let o=e.options.simulateBreak,r=e.state.doc.lineAt(i.from),s=null==o||o<=r.from?r.to:Math.min(r.to,o);for(let a=i.to;;){let e=t.childAfter(a);if(!e||e==n)return null;if(!e.type.isSkipped){if(e.from>=s)return null;let t=/^ */.exec(r.text.slice(i.to-r.from))[0].length;return{from:i.from,to:i.to+t}}a=e.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*i)}var Gg=Ws.define(),Wg=new df;function Xg(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function zg(e,t,i){for(let n of e.facet(Gg)){let o=n(e,t,i);if(o)return o}return function(e,t,i){let n=_g(e);if(n.length<i)return null;let o=null;for(let r=n.resolveStack(i,1);r;r=r.next){let s=r.node;if(s.to<=i||s.from>i)continue;if(o&&s.from<t)break;let a=s.type.prop(Wg);if(a&&(s.to<n.length-50||n.length==e.doc.length||!Xg(s))){let n=a(s,e);n&&n.from<=i&&n.from>=t&&n.to>i&&(o=n)}}return o}(e,t,i)}function jg(e,t){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);return i>=n?void 0:{from:i,to:n}}var Yg=ba.define({map:jg}),Qg=ba.define({map:jg});function Kg(e){let t=[];for(let{head:i}of e.state.selection.ranges)t.some(e=>e.from<=i&&e.to>=i)||t.push(e.lineBlockAt(i));return t}var qg=qs.define({create:()=>wl.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,i)=>e=Jg(e,t,i)),e=e.map(t.changes);for(let i of t.effects)if(i.is(Yg)&&!em(e,i.value.from,i.value.to)){let{preparePlaceholder:n}=t.state.facet(rm),o=n?wl.replace({widget:new cm(n(t.state,i.value))}):lm;e=e.update({add:[o.range(i.value.from,i.value.to)]})}else i.is(Qg)&&(e=e.update({filter:(e,t)=>i.value.from!=e||i.value.to!=t,filterFrom:i.value.from,filterTo:i.value.to}));return t.selection&&(e=Jg(e,t.selection.main.head)),e},provide:e=>md.decorations.from(e),toJSON(e,t){let i=[];return e.between(0,t.doc.length,(e,t)=>{i.push(e,t)}),i},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError("Invalid JSON for fold state");let t=[];for(let i=0;i<e.length;){let n=e[i++],o=e[i++];if("number"!=typeof n||"number"!=typeof o)throw RangeError("Invalid JSON for fold state");t.push(lm.range(n,o))}return wl.set(t,!0)}});function Jg(e,t,i=t){let n=!1;return e.between(t,i,(e,o)=>{e<i&&o>t&&(n=!0)}),n?e.update({filterFrom:t,filterTo:i,filter:(e,n)=>e>=i||n<=t}):e}function Zg(e,t,i){var n;let o=null;return null==(n=e.field(qg,!1))||n.between(t,i,(e,t)=>{(!o||o.from>e)&&(o={from:e,to:t})}),o}function em(e,t,i){let n=!1;return e.between(t,t,(e,o)=>{e==t&&o==i&&(n=!0)}),n}function tm(e,t){return e.field(qg,!1)?t:t.concat(ba.appendConfig.of(sm()))}function im(e,t,i=!0){let n=e.state.doc.lineAt(t.from).number,o=e.state.doc.lineAt(t.to).number;return md.announce.of(`${e.state.phrase(i?"Folded lines":"Unfolded lines")} ${n} ${e.state.phrase("to")} ${o}.`)}var nm=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of Kg(e)){let i=zg(e.state,t.from,t.to);if(i)return e.dispatch({effects:tm(e.state,[Yg.of(i),im(e,i)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(qg,!1))return!1;let t=[];for(let i of Kg(e)){let n=Zg(e.state,i.from,i.to);
3n&&t.push(Qg.of(n),im(e,n,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,i=[];for(let n=0;n<t.doc.length;){let o=e.lineBlockAt(n),r=zg(t,o.from,o.to);r&&i.push(Yg.of(r)),n=(r?e.lineBlockAt(r.to):o).to+1}return i.length&&e.dispatch({effects:tm(e.state,i)}),!!i.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(qg,!1);if(!t||!t.size)return!1;let i=[];return t.between(0,e.state.doc.length,(e,t)=>{i.push(Qg.of({from:e,to:t}))}),e.dispatch({effects:i}),!0}}],om={placeholderDOM:null,preparePlaceholder:null,placeholderText:"â¦"},rm=Ws.define({combine:e=>$a(e,om)});function sm(e){let t=[qg,dm];return e&&t.push(rm.of(e)),t}function am(e,t){let{state:i}=e,n=i.facet(rm),o=t=>{let i=e.lineBlockAt(e.posAtDOM(t.target)),n=Zg(e.state,i.from,i.to);n&&e.dispatch({effects:Qg.of(n)}),t.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(e,o,t);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",i.phrase("folded code")),r.title=i.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=o,r}var lm=wl.replace({widget:new class extends Ll{toDOM(e){return am(e,null)}}}),cm=class extends Ll{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return am(e,this.value)}},um={openText:"â",closedText:"âº",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},hm=class extends Bp{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};var dm=md.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),pm=class e{constructor(e,t){let i;function n(e){let t=il.newName();return(i||=Object.create(null))["."+t]=e,t}this.specs=e;let o="string"==typeof t.all?t.all:t.all?n(t.all):void 0,r=t.scope;this.scope=r instanceof mg?e=>e.prop(fg)==r.data:r?e=>e==r:void 0,this.style=Qf(e.map(e=>({tag:e.tag,class:e.class||n(Object.assign({},e,{tag:null}))})),{all:o}).style,this.module=i?new il(i):null,this.themeType=t.themeType}static define(t,i){return new e(t,i||{})}},fm=Ws.define(),gm=Ws.define({combine:e=>e.length?[e[0]]:null});function mm(e){let t=e.facet(fm);return t.length?t:e.facet(gm)}var Tm=class{constructor(e){this.markCache=Object.create(null),this.tree=_g(e.state),this.decorations=this.buildDeco(e,mm(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=_g(e.state),i=mm(e.state),n=i!=mm(e.startState),{viewport:o}=e.view,r=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!n&&t.type==this.tree.type&&r>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=r):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return wl.none;let i=new Ua;for(let{from:n,to:o}of e.visibleRanges)Kf(this.tree,t,(e,t,n)=>{i.add(e,t,this.markCache[n]||(this.markCache[n]=wl.mark({class:n})))},n,o);return i.finish()}},_m=na.high(zc.fromClass(Tm,{decorations:e=>e.decorations})),Em=pm.define([{tag:pg.meta,color:"#404740"},{tag:pg.link,textDecoration:"underline"},{tag:pg.heading,textDecoration:"underline",fontWeight:"bold"},{tag:pg.emphasis,fontStyle:"italic"},{tag:pg.strong,fontWeight:"bold"},{tag:pg.strikethrough,textDecoration:"line-through"},{tag:pg.keyword,color:"#708"},{tag:[pg.atom,pg.bool,pg.url,pg.contentSeparator,pg.labelName],color:"#219"},{tag:[pg.literal,pg.inserted],color:"#164"},{tag:[pg.string,pg.deleted],color:"#a11"},{tag:[pg.regexp,pg.escape,pg.special(pg.string)],color:"#e40"},{tag:pg.definition(pg.variableName),color:"#00f"},{tag:pg.local(pg.variableName),color:"#30a"},{tag:[pg.typeName,pg.namespace],color:"#085"},{tag:pg.className,color:"#167"},{tag:[pg.special(pg.variableName),pg.macroName],color:"#256"},{tag:pg.definition(pg.propertyName),color:"#00c"},{tag:pg.comment,color:"#940"}
vendor: 6,568 bytes, line 3
3,{tag:pg.invalid,color:"#f00"}]),bm=md.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Om="()[]{}",vm=Ws.define({combine:e=>$a(e,{afterCursor:!0,brackets:Om,maxScanDistance:1e4,renderMatch:ym})}),Im=wl.mark({class:"cm-matchingBracket"}),Sm=wl.mark({class:"cm-nonmatchingBracket"});function ym(e){let t=[],i=e.matched?Im:Sm;return t.push(i.range(e.start.from,e.start.to)),e.end&&t.push(i.range(e.end.from,e.end.to)),t}function Rm(e){let t=[],i=e.facet(vm);for(let n of e.selection.ranges){if(!n.empty)continue;let o=Nm(e,n.head,-1,i)||n.head>0&&Nm(e,n.head-1,1,i)||i.afterCursor&&(Nm(e,n.head,1,i)||n.head<e.doc.length&&Nm(e,n.head+1,-1,i));o&&(t=t.concat(i.renderMatch(o,e)))}return wl.set(t,!0)}var Cm=[zc.fromClass(class{constructor(e){this.paused=!1,this.decorations=Rm(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Rm(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),bm];var km=new df;function Am(e,t,i){let n=e.prop(t<0?df.openedBy:df.closedBy);if(n)return n;if(1==e.name.length){let n=i.indexOf(e.name);if(n>-1&&n%2==+(t<0))return[i[n+t]]}return null}function Lm(e){let t=e.type.prop(km);return t?t(e.node):e}function Nm(e,t,i,n={}){let o=n.maxScanDistance||1e4,r=n.brackets||Om,s=_g(e),a=s.resolveInner(t,i);for(let l=a;l;l=l.parent){let n=Am(l.type,i,r);if(n&&l.from<l.to){let o=Lm(l);if(o&&(i>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return wm(e,t,i,l,o,n,r)}}return function(e,t,i,n,o,r,s){if(i<0?!t:t==e.doc.length)return null;let a=i<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=i>0)return null;let c={from:i<0?t-1:t,to:i>0?t+1:t},u=e.doc.iterRange(t,i>0?e.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=r;){let e=u.value;i<0&&(d+=e.length);let r=t+d*i;for(let t=i>0?0:e.length-1,a=i>0?e.length:-1;t!=a;t+=i){let a=s.indexOf(e[t]);if(!(a<0||n.resolveInner(r+t,1).type!=o))if(a%2==0==i>0)h++;else{if(1==h)return{start:c,end:{from:r+t,to:r+t+1},matched:a>>1==l>>1};h--}}i>0&&(d+=e.length)}return u.done?{start:c,matched:!1}:null}(e,t,i,s,a.type,o,r)}function wm(e,t,i,n,o,r,s){let a=n.parent,l={from:o.from,to:o.to},c=0,u=a?.cursor();if(u&&(i<0?u.childBefore(n.from):u.childAfter(n.to)))do{if(i<0?u.to<=n.from:u.from>=n.to){if(0==c&&r.indexOf(u.type.name)>-1&&u.from<u.to){let e=Lm(u);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Am(u.type,i,s))c++;else if(Am(u.type,-i,s)){if(0==c){let e=Lm(u);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(i<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}var $m=Object.create(null),Mm=[gf.none],xm=[],Dm=Object.create(null),Pm=Object.create(null);for(let[dP,pP]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Pm[dP]=Bm($m,pP);function Fm(e,t){xm.indexOf(e)>-1||(xm.push(e),console.warn(t))}function Bm(e,t){let i=[];for(let a of t.split(" ")){let t=[];for(let i of a.split(".")){let n=e[i]||pg[i];n?"function"==typeof n?t.length?t=t.map(n):Fm(i,`Modifier ${i} used at start of tag`):t.length?Fm(i,`Tag ${i} used as modifier`):t=Array.isArray(n)?n:[n]:Fm(i,`Unknown highlighting tag ${i}`)}for(let e of t)i.push(e)}if(!i.length)return 0;let n=t.replace(/ /g,"_"),o=n+" "+i.map(e=>e.id),r=Dm[o];if(r)return r.id;let s=Dm[o]=gf.define({id:Mm.length,name:n,props:[zf({[n]:i})]});return Mm.push(s),s.id}lc.RTL,lc.LTR;function Um(e,t){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let o=e(t,i);return!!o&&(n(i.update(o)),!0)}}var Hm=Um(jm,0),Vm=Um(zm,0),Gm=Um((e,t)=>zm(e,t,function(e){let t=[];for(let i of e.selection.ranges){let n=e.doc.lineAt(i.from),o=i.to<=n.to?n:e.doc.lineAt(i.to);o.from>n.from&&o.from==i.to&&(o=i.to==n.to+1?n:e.doc.lineAt(i.to-1));let r=t.length-1;r>=0&&t[r].to>n.from?t[r].to=o.to:t.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:o.to})}return t}(t)),0);function Wm(e,t){let i=e.languageDataAt("commentTokens",t,1);return i.length?i[0]:{}}var Xm=50;function zm(e,t,i=t.selection.ranges){let n=i.map(e=>Wm(t,e.from).block);if(!n.every(e=>e))return null;let o=i.map((e,i)=>function(e,{open:t,close:i},n,o){let r,s,a=e.sliceDoc(n-Xm,n),l=e.sliceDoc(o,o+Xm),c=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(l)[0].length,h=a.length-c;if(a.slice(h-t.length,h)==t&&l.slice(u,u+i.length)==i)return{open:{pos:n-c,margin:c&&1},close:{pos:o+u,margin:u&&1}};o-n<=2*Xm?r=s=e.sliceDoc(n,o):(r=e.sliceDoc(n,n+Xm),s=e.sliceDoc(o-Xm,o));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(s)[0].length,f=s.length-p-i.length;return r.slice(d,d+t.length)==t&&s.slice(f,f+i.length)==i?{open:{pos:n+d+t.length,margin:+!!/\s/.test(r.charAt(d+t.length))},close:{pos:o-p-i.length,margin:+!!/\s/.test(s.charAt(f-1))}}:null}(t,n[i],e.from,e.to));if(2!=e&&!o.every(e=>e))return{changes:t.changes(i.map((e,t)=>o[t]?[]:[{from:e.from,insert:n[t].open+" "},{from:e.to,insert:" "+n[t].close}]))};if(1!=e&&o.some(e=>e)){let e=[];for(let t,i=0;i<o.length;i++)if(t=o[i]){let o=n[i],{open:r,close:s}=t;e.push({from:r.pos-o.open.length,to:r.pos+r.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}function jm(e,t,i=t.selection.ranges){let n=[],o=-1;e:for(let{from:r,to:s}of i){let e,i=n.length,a=1e9;for(let l=r;l<=s;){let i=t.doc.lineAt(l);if(null==e&&(e=Wm(t,i.from).line,!e))continue e;if(i.from>o&&(r==s||s>i.from)){o=i.from;let t=/^\s*/.exec(i.text)[0].length,r=t==i.length,s=i.text.slice(t,t+e.length)==e?t:-1;t<i.text.length&&t<a&&(a=t),n.push({line:i,comment:s,token:e,indent:t,empty:r,single:!1})}l=i.to+1}if(a<1e9)for(let t=i;t<n.length;t++)n[t].indent<n[t].line.text.length&&(n[t].indent=a);n.length==i+1&&(n[i].single=!0)}if(2!=e&&n.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:o,indent:r,empty:s,single:a}of n)(a||!s)&&e.push({from:t.from+r,insert:o+" "});let i=t.changes(e);return{changes:i,selection:t.selection.map(i,1)}}if(1!=e&&n.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:i,token:o}of n)if(i>=0){let n=t.from+i,r=n+o.length;" "==t.text[r-t.from]&&r++,e.push({from:n,to:r})}return{changes:e}}return null}var Ym=Ta.define(),Qm=Ta.define(),Km=Ws.define(),qm=Ws.define({combine:e=>$a(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>
3t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}),Jm=qs.define({create:()=>fT.empty,update(e,t){let i=t.state.facet(qm),n=t.annotation(Ym);if(n){let o=oT.fromTransaction(t,n.selection),r=n.side,s=0==r?e.undone:e.done;return s=o?rT(s,s.length,i.minDepth,o):cT(s,t.startState.selection),new fT(0==r?n.rest:s,0==r?s:n.rest)}let o=t.annotation(Qm);if(("full"==o||"before"==o)&&(e=e.isolate()),!1===t.annotation(Oa.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let r=oT.fromTransaction(t),s=t.annotation(Oa.time),a=t.annotation(Oa.userEvent);return r?e=e.addChanges(r,s,a,i,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,i.newGroupDelay)),("full"==o||"after"==o)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new fT(e.done.map(oT.fromJSON),e.undone.map(oT.fromJSON))});function Zm(e,t){return function({state:i,dispatch:n}){if(!t&&i.readOnly)return!1;let o=i.field(Jm,!1);if(!o)return!1;let r=o.pop(e,i,t);return!!r&&(n(r),!0)}}var eT=Zm(0,!1),tT=Zm(1,!1),iT=Zm(0,!0),nT=Zm(1,!0),oT=class e{constructor(e,t,i,n,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=o}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&$s.fromJSON(t.changes),[],t.mapped&&ws.fromJSON(t.mapped),t.startSelection&&Hs.fromJSON(t.startSelection),t.selectionsAfter.map(Hs.fromJSON))}static fromTransaction(t,i){let n=aT;for(let e of t.startState.facet(Km)){let i=e(t);i.length&&(n=n.concat(i))}return!n.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),n,void 0,i||t.startState.selection,aT)}static selection(t){return new e(void 0,aT,void 0,void 0,t)}};function rT(e,t,i,n){let o=t+1>i+20?t-i-1:0,r=e.slice(o,t);return r.push(n),r}function sT(e,t){return e.length?t.length?e.concat(t):e:t}var aT=[],lT=200;function cT(e,t){if(e.length){let i=e[e.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-lT));return n.length&&n[n.length-1].eq(t)?e:(n.push(t),rT(e,e.length-1,1e9,i.setSelAfter(n)))}return[oT.selection([t])]}function uT(e){let t=e[e.length-1],i=e.slice();return i[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),i}function hT(e,t){if(!e.length)return e;let i=e.length,n=aT;for(;i;){let o=dT(e[i-1],t,n);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,i);return t[i-1]=o,t}t=o.mapped,i--,n=o.selectionsAfter}return n.length?[oT.selection(n)]:aT}function dT(e,t,i){let n=sT(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):aT,i);if(!e.changes)return oT.selection(n);let o=e.changes.map(t),r=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(r):r;return new oT(o,ba.mapEffects(e.effects,t),s,e.startSelection.map(r),n)}var pT=/^(input\.type|delete)($|\.)/,fT=class e{constructor(e,t,i=0,n=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,i,n,o,r){let s=this.done,a=s[s.length-1];return s=a&&a.changes&&!a.changes.empty&&t.changes&&(!n||pT.test(n))&&(!a.selectionsAfter.length&&i-this.prevTime<o.newGroupDelay&&o.joinToEvent(r,function(e,t){let i=[],n=!1;return e.iterChangedRanges((e,t)=>i.push(e,t)),t.iterChangedRanges((e,t,o,r)=>{for(let s=0;s<i.length;){let e=i[s++],t=i[s++];r>=e&&o<=t&&(n=!0)}}),n}(a.changes,t.changes))||"input.type.compose"==n)?rT(s,s.length-1,o.minDepth,new oT(t.changes.compose(a.changes),sT(ba.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,aT)):rT(s,s.length,o.minDepth,t),new e(s,aT,i,n)}addSelection(t,i,n,o){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:aT;return r.length>0&&i-this.prevTime<o&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&function(e,t){return e.ranges.length==t.ranges.length&&0===e.ranges.filter((e,i)=>e.empty!=t.ranges[i].empty).length}(r[r.length-1],t)?this:new e(cT(this.done,t),this.undone,i,n)}addMapping(t){return new e(hT(this.done,t),hT(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,i){let n=0==e?this.done:this.undone;if(0==n.length)return null;let o=n[n.length-1],r=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(i&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ym.of({side:e,rest:uT(n),selection:r}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let i=1==n.length?aT:n.slice(0,n.length-1);return o.mapped&&(i=hT(i,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ym.of({side:e,rest:i,selection:r}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}};fT.empty=new fT(aT,aT);var gT=[{key:"Mod-z",run:eT,preventDefault:!0}
vendor: 12,794 bytes, line 3
3,{key:"Mod-y",mac:"Mod-Shift-z",run:tT,preventDefault:!0},{linux:"Ctrl-Shift-z",run:tT,preventDefault:!0},{key:"Mod-u",run:iT,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:nT,preventDefault:!0}];function mT(e,t){return Hs.create(e.ranges.map(t),e.mainIndex)}function TT(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function _T({state:e,dispatch:t},i){let n=mT(e.selection,i);return!n.eq(e.selection,!0)&&(t(TT(e,n)),!0)}function ET(e,t){return Hs.cursor(t?e.to:e.from)}function bT(e,t){return _T(e,i=>i.empty?e.moveByChar(i,t):ET(i,t))}function OT(e){return e.textDirectionAt(e.state.selection.main.head)==lc.LTR}var vT=e=>bT(e,!OT(e)),IT=e=>bT(e,OT(e));function ST(e,t){return _T(e,i=>i.empty?e.moveByGroup(i,t):ET(i,t))}function yT(e,t,i){if(t.type.prop(i))return!0;let n=t.to-t.from;return n&&(n>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function RT(e,t,i){let n,o,r=_g(e).resolveInner(t.head),s=i?df.closedBy:df.openedBy;for(let a=t.head;;){let t=i?r.childAfter(a):r.childBefore(a);if(!t)break;yT(e,t,s)?r=t:a=i?t.to:t.from}return o=r.type.prop(s)&&(n=i?Nm(e,r.from,1):Nm(e,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,Hs.cursor(o,i?-1:1)}typeof Intl<"u"&&Intl.Segmenter;function CT(e,t){return _T(e,i=>{if(!i.empty)return ET(i,t);let n=e.moveVertically(i,t);return n.head==i.head?e.moveToLineBoundary(i,t):n})}var kT=e=>CT(e,!1),AT=e=>CT(e,!0);function LT(e){let t,i=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,o=0;if(i){for(let t of e.state.facet(md.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(o=Math.max(i?.bottom,o))}t=e.scrollDOM.clientHeight-n-o}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:o,selfScroll:i,height:Math.max(e.defaultLineHeight,t-5)}}function NT(e,t){let i,n=LT(e),{state:o}=e,r=mT(o.selection,i=>i.empty?e.moveVertically(i,t,n.height):ET(i,t));if(r.eq(o.selection))return!1;if(n.selfScroll){let t=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),a=s.top+n.marginTop,l=s.bottom-n.marginBottom;t&&t.top>a&&t.bottom<l&&(i=md.scrollIntoView(r.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(TT(o,r),{effects:i}),!0}var wT=e=>NT(e,!1),$T=e=>NT(e,!0);function MT(e,t,i){let n=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,i);if(o.head==t.head&&o.head!=(i?n.to:n.from)&&(o=e.moveToLineBoundary(t,i,!1)),!i&&o.head==n.from&&n.length){let i=/^\s*/.exec(e.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&t.head!=n.from+i&&(o=Hs.cursor(n.from+i))}return o}function xT(e,t){let i=mT(e.state.selection,e=>{let i=t(e);return Hs.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(TT(e.state,i)),!0)}function DT(e,t){return xT(e,i=>e.moveByChar(i,t))}var PT=e=>DT(e,!OT(e)),FT=e=>DT(e,OT(e));function BT(e,t){return xT(e,i=>e.moveByGroup(i,t))}function UT(e,t){return xT(e,i=>e.moveVertically(i,t))}var HT=e=>UT(e,!1),VT=e=>UT(e,!0);function GT(e,t){return xT(e,i=>e.moveVertically(i,t,LT(e).height))}var WT=e=>GT(e,!1),XT=e=>GT(e,!0),zT=({state:e,dispatch:t})=>(t(TT(e,{anchor:0})),!0),jT=({state:e,dispatch:t})=>(t(TT(e,{anchor:e.doc.length})),!0),YT=({state:e,dispatch:t})=>(t(TT(e,{anchor:e.selection.main.anchor,head:0})),!0),QT=({state:e,dispatch:t})=>(t(TT(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function KT(e,t){let{state:i}=e,n=i.selection,o=i.selection.ranges.slice();for(let r of i.selection.ranges){let n=i.doc.lineAt(r.head);if(t?n.to<e.state.doc.length:n.from>0)for(let i=r;;){let r=e.moveVertically(i,t);if(r.head<n.from||r.head>n.to){o.some(e=>e.head==r.head)||o.push(r);break}if(r.head==i.head)break;i=r}}return o.length!=n.ranges.length&&(e.dispatch(TT(i,Hs.create(o,o.length-1))),!0)}function qT(e,t){if(e.state.readOnly)return!1;let i="delete.selection",{state:n}=e,o=n.changeByRange(n=>{let{from:o,to:r}=n;if(o==r){let s=t(n);s<o?(i="delete.backward",s=JT(e,s,!1)):s>o&&(i="delete.forward",s=JT(e,s,!0)),o=Math.min(o,s),r=Math.max(r,s)}else o=JT(e,o,!1),r=JT(e,r,!0);return o==r?{range:n}:{changes:{from:o,to:r},range:Hs.cursor(o,o<n.head?-1:1)}});return!o.changes.empty&&(e.dispatch(n.update(o,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?md.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function JT(e,t,i){if(e instanceof md)for(let n of e.state.facet(md.atomicRanges).map(t=>t(e)))n.between(t,t,(e,n)=>{e<t&&n>t&&(t=i?n:e)});return t}var ZT=(e,t,i)=>qT(e,n=>{let o,r,s=n.from,{state:a}=e,l=a.doc.lineAt(s);if(i&&!t&&s>l.from&&s<l.from+200&&!/[^ \t]/.test(o=l.text.slice(0,s-l.from))){if("\t"==o[o.length-1])return s-1;let e=qa(o,a.tabSize)%Ng(a)||Ng(a);for(let t=0;t<e&&" "==o[o.length-1-t];t++)s--;r=s}else r=Rs(l.text,s-l.from,t,t)+l.from,r==s&&l.number!=(t?a.doc.lines:1)?r+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(r-l.from,s-l.from))&&(r=Rs(l.text,r-l.from,!1,!1)+l.from);return r}),e_=e=>ZT(e,!1,!0),t_=e=>ZT(e,!0,!1),i_=(e,t)=>qT(e,i=>{let n=i.head,{state:o}=e,r=o.doc.lineAt(n),s=o.charCategorizer(n);for(let e=null;;){if(n==(t?r.to:r.from)){n==i.head&&r.number!=(t?o.doc.lines:1)&&(n+=t?1:-1);break}let a=Rs(r.text,n-r.from,t)+r.from,l=r.text.slice(Math.min(n,a)-r.from,Math.max(n,a)-r.from),c=s(l);if(null!=e&&c!=e)break;(" "!=l||n!=i.head)&&(e=c),n=a}return n}),n_=e=>i_(e,!1);function o_(e){let t=[],i=-1;for(let n of e.selection.ranges){let o=e.doc.lineAt(n.from),r=e.doc.lineAt(n.to);if(!n.empty&&n.to==r.from&&(r=e.doc.lineAt(n.to-1)),i>=o.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(n)}else t.push({from:o.from,to:r.to,ranges:[n]});i=r.number+1}return t}function r_(e,t,i){if(e.readOnly)return!1;let n=[],o=[];for(let r of o_(e)){if(i?r.to==e.doc.length:0==r.from)continue;let t=e.doc.lineAt(i?r.to+1:r.from-1),s=t.length+1;if(i){n.push({from:r.to,to:t.to},{from:r.from,insert:t.text+e.lineBreak});for(let t of r.ranges)o.push(Hs.range(Math.min(e.doc.length,t.anchor+s),Math.min(e.doc.length,t.head+s)))}else{n.push({from:t.from,to:r.from},{from:r.to,insert:e.lineBreak+t.text});for(let e of r.ranges)o.push(Hs.range(e.anchor-s,e.head-s))}}return!!n.length&&(t(e.update({changes:n,scrollIntoView:!0,selection:Hs.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function s_(e,t,i){if(e.readOnly)return!1;let n=[];for(let r of o_(e))i?n.push({from:r.from,insert:e.doc.slice(r.from,r.to)+e.lineBreak}):n.push({from:r.to,insert:e.lineBreak+e.doc.slice(r.from,r.to)});let o=e.changes(n);return t(e.update({changes:o,selection:e.selection.map(o,i?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var a_=c_(!1),l_=c_(!0);function c_(e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=t.changeByRange(i=>{let{from:n,to:o}=i,r=t.doc.lineAt(n),s=!e&&n==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let i,n=_g(e).resolveInner(t),o=n.childBefore(t),r=n.childAfter(t);return o&&r&&o.to<=t&&r.from>=t&&(i=o.type.prop(df.closedBy))&&i.indexOf(r.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}(t,n);e&&(n=o=(o<=r.to?r:t.doc.lineAt(o)).to);let a=new Mg(t,{simulateBreak:n,simulateDoubleBreak:!!s}),l=$g(a,n);for(l??=qa(/^\s*/.exec(t.doc.lineAt(n).text)[0],t.tabSize);o<r.to&&/\s/.test(r.text[o-r.from]);)o++;s?({from:n,to:o}=s):n>r.from&&n<r.from+100&&!/\S/.test(r.text.slice(0,n))&&(n=r.from);let c=["",wg(t,l)];return s&&c.push(wg(t,a.lineIndent(r.from,-1))),{changes:{from:n,to:o,insert:ms.of(c)},range:Hs.cursor(n+1+c[1].length)}});return i(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function u_(e,t){let i=-1;return e.changeByRange(n=>{let o=[];for(let s=n.from;s<=n.to;){let r=e.doc.lineAt(s);r.number>i&&(n.empty||n.to>r.from)&&(t(r,o,n),i=r.number),s=r.to+1}let r=e.changes(o);return{changes:o,range:Hs.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}})}var h_=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(u_(e,(t,i)=>{i.push({from:t.from,insert:e.facet(Lg)})}),{userEvent:"input.indent"})),!0),d_=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(u_(e,(t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let o=qa(n,e.tabSize),r=0,s=wg(e,Math.max(0,o-Ng(e)));for(;r<n.length&&r<s.length&&n.charCodeAt(r)==s.charCodeAt(r);)r++;i.push({from:t.from+r,to:t.from+n.length,insert:s.slice(r)})}),{userEvent:"delete.dedent"})),!0),p_=[{key:"Ctrl-b",run:vT,shift:PT,preventDefault:!0},{key:"Ctrl-f",run:IT,shift:FT},{key:"Ctrl-p",run:kT,shift:HT},{key:"Ctrl-n",run:AT,shift:VT},{key:"Ctrl-a",run:e=>_T(e,t=>Hs.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>xT(e,t=>Hs.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>_T(e,t=>Hs.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>xT(e,t=>Hs.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:t_},{key:"Ctrl-h",run:e_},{key:"Ctrl-k",run:e=>qT(e,t=>{let i=e.lineBlockAt(t.head).to;return t.head<i?i:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:n_},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ms.of(["",""])},range:Hs.cursor(e.from)}));return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let i=t.from,n=e.doc.lineAt(i),o=i==n.from?i-1:Rs(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:Rs(n.text,i-n.from,!0)+n.from;return{changes:{from:o,to:r,insert:e.doc.slice(i,r).append(e.doc.slice(o,i))},range:Hs.cursor(r)}});return!i.changes.empty&&(t(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:$T}],f_=[{key:"ArrowLeft",run:vT,shift:PT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>ST(e,!OT(e)),shift:e=>BT(e,!OT(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>_T(e,t=>MT(e,t,!OT(e))),shift:e=>xT(e,t=>MT(e,t,!OT(e))),preventDefault:!0},{key:"ArrowRight",run:IT,shift:FT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>ST(e,OT(e)),shift:e=>BT(e,OT(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>_T(e,t=>MT(e,t,OT(e))),shift:e=>xT(e,t=>MT(e,t,OT(e))),preventDefault:!0},{key:"ArrowUp",run:kT,shift:HT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:zT,shift:YT},{mac:"Ctrl-ArrowUp",run:wT,shift:WT},{key:"ArrowDown",run:AT,shift:VT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:jT,shift:QT},{mac:"Ctrl-ArrowDown",run:$T,shift:XT},{key:"PageUp",run:wT,shift:WT},{key:"PageDown",run:$T,shift:XT},{key:"Home",run:e=>_T(e,t=>MT(e,t,!1)),shift:e=>xT(e,t=>MT(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:zT,shift:YT},{key:"End",run:e=>_T(e,t=>MT(e,t,!0)),shift:e=>xT(e,t=>MT(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:jT,shift:QT},{key:"Enter",run:a_,shift:a_},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:e_,shift:e_,preventDefault:!0},{key:"Delete",run:t_,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:n_,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>i_(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>qT(e,t=>{let i=e.moveToLineBoundary(t,!1).head;return t.head>i?i:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>qT(e,t=>{let i=e.moveToLineBoundary(t,!0).head;return t.head<i?i:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(p_.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),g_=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>_T(e,t=>RT(e.state,t,!OT(e))),shift:e=>xT(e,t=>RT(e.state,t,!OT(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>_T(e,t=>RT(e.state,t,OT(e))),shift:e=>xT(e,t=>RT(e.state,t,OT(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>r_(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>s_(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>r_(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>s_(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>KT(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>KT(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let i=e.selection,n=null;return i.ranges.length>1?n=Hs.create([i.main]):i.main.empty||(n=Hs.create([Hs.cursor(i.main.head)])),!!n&&(t(TT(e,n)),!0)}},{key:"Mod-Enter",run:l_},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let i=o_(e).map(({from:t,to:i})=>Hs.range(t,Math.min(i+1,e.doc.length)));return t(e.update({selection:Hs.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let i=mT(e.selection,t=>{let i=_g(e),n=i.resolveStack(t.from,1);if(t.empty){let e=i.resolveStack(t.from,-1);e.node.from>=n.node.from&&e.node.to<=n.node.to&&(n=e)}for(let e=n;e;e=e.next){let{node:i}=e;if((i.from<t.from&&i.to>=t.to||i.to>t.to&&i.from<=t.from)&&e.next)return Hs.range(i.to,i.from)}return t});
3return!i.eq(e.selection)&&(t(TT(e,i)),!0)},preventDefault:!0},{key:"Mod-[",run:d_},{key:"Mod-]",run:h_},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=Object.create(null),n=new Mg(e,{overrideIndentation:e=>i[e]??-1}),o=u_(e,(t,o,r)=>{let s=$g(n,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0],l=wg(e,s);(a!=l||r.from<t.from+a.length)&&(i[t.from]=s,o.push({from:t.from,to:t.from+a.length,insert:l}))});return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,i=t.changes(o_(t).map(({from:e,to:i})=>(e>0?e--:i<t.doc.length&&i++,{from:e,to:i}))),n=mT(t.selection,t=>{let i;if(e.lineWrapping){let n=e.lineBlockAt(t.head),o=e.coordsAtPos(t.head,t.assoc||1);o&&(i=n.bottom+e.documentTop-o.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,i)}).map(i);return e.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,i){let n=!1,o=mT(e.selection,t=>{let o=Nm(e,t.head,-1)||Nm(e,t.head,1)||t.head>0&&Nm(e,t.head-1,1)||t.head<e.doc.length&&Nm(e,t.head+1,-1);if(!o||!o.end)return t;n=!0;let r=o.start.from==t.head?o.end.to:o.end.from;return i?Hs.range(t.anchor,r):Hs.cursor(r)});return!!n&&(t(TT(e,o)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,i=t.doc.lineAt(t.selection.main.from),n=Wm(e.state,i.from);return n.line?Hm(e):!!n.block&&Gm(e)}},{key:"Alt-A",run:Vm},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat(f_),m_={key:"Tab",run:h_,shift:d_},T_="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e,__=class{constructor(e,t,i=0,n=e.length,o,r){this.test=r,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,n),this.bufferStart=i,this.normalize=o?e=>o(T_(e)):T_,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Cs(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ks(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=As(e);let n=this.normalize(t);if(n.length)for(let o=0,r=i,s=!0;;o++){let e=n.charCodeAt(o),i=this.match(e,r,s,this.bufferPos+this.bufferStart,o==n.length-1);if(i)return this.value=i,this;if(o==n.length-1)break;s&&o<t.length&&t.charCodeAt(o)==e?r++:s=!1}}}match(e,t,i,n,o){let r=null;for(let s=0;s<this.matches.length;){let t=this.matches[s],i=!1;this.query.charCodeAt(t.index)==e&&(t.index==this.query.length-1?r={from:t.from,to:n,precise:o&&t.precise}:(t.index++,i=!0)),i?s++:this.matches.splice(s,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?r={from:t,to:n,precise:i&&o}:this.matches.push({from:t,index:1,precise:i})),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<"u"&&(__.prototype[Symbol.iterator]=function(){return this});var E_={from:-1,to:-1,match:/.*/.exec(""),precise:!0},b_="gm"+(null==/x/.unicode?"":"u"),O_=class{constructor(e,t,i,n=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=E_,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new S_(e,t,i,n,o);this.re=new RegExp(t,b_+(i?.ignoreCase?"i":"")),this.test=i?.test,this.iter=e.iter();let r=e.lineAt(n);this.curLineStart=r.from,this.matchPos=y_(e,n),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,n=i+t[0].length;if(this.matchPos=y_(this.text,n+ +(i==n)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<n||i>this.value.to)&&(!this.test||this.test(i,n,t)))return this.value={from:i,to:n,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}},v_=new WeakMap,I_=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,i,n){let o=v_.get(t);if(!o||o.from>=n||o.to<=i){let o=new e(i,t.sliceString(i,n));return v_.set(t,o),o}if(o.from==i&&o.to==n)return o;let{text:r,from:s}=o;return s>i&&(r=t.sliceString(i,s)+r,s=i),o.to<n&&(r+=t.sliceString(o.to,n)),v_.set(t,new e(s,r)),new e(i,r.slice(i-s,n-s))}},S_=class{constructor(e,t,i,n,o){this.text=e,this.to=o,this.done=!1,this.value=E_,this.matchPos=y_(e,n),this.re=new RegExp(t,b_+(i?.ignoreCase?"i":"")),this.test=i?.test,this.flat=I_.get(e,n,this.chunkEnd(n+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,i=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,i,t)))return this.value={from:e,to:i,precise:!0,match:t},this.matchPos=y_(this.text,i+ +(e==i)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=I_.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}};function y_(e,t){if(t>=e.length)return t;let i,n=e.lineAt(t);for(;t<n.to&&(i=n.text.charCodeAt(t-n.from))>=56320&&i<57344;)t++;return t}typeof Symbol<"u"&&(O_.prototype[Symbol.iterator]=S_.prototype[Symbol.iterator]=function(){return this});var R_={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},C_=Ws.define({combine:e=>$a(e,R_,{highlightWordAroundCursor:(e,t)=>
vendor: 9,597 bytes, line 3
3e||t,minSelectionLength:Math.min,maxMatches:Math.min})});var k_=wl.mark({class:"cm-selectionMatch"}),A_=wl.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function L_(e,t,i,n){return!(0!=i&&e(t.sliceDoc(i-1,i))==Aa.Word||n!=t.doc.length&&e(t.sliceDoc(n,n+1))==Aa.Word)}var N_=zc.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(C_),{state:i}=e,n=i.selection;if(n.ranges.length>1)return wl.none;let o,r=n.main,s=null;if(r.empty){if(!t.highlightWordAroundCursor)return wl.none;let e=i.wordAt(r.head);if(!e)return wl.none;s=i.charCategorizer(r.head),o=i.sliceDoc(e.from,e.to)}else{let e=r.to-r.from;if(e<t.minSelectionLength||e>200)return wl.none;if(t.wholeWords){if(o=i.sliceDoc(r.from,r.to),s=i.charCategorizer(r.head),!L_(s,i,r.from,r.to)||!function(e,t,i,n){return e(t.sliceDoc(i,i+1))==Aa.Word&&e(t.sliceDoc(n-1,n))==Aa.Word}(s,i,r.from,r.to))return wl.none}else if(o=i.sliceDoc(r.from,r.to),!o)return wl.none}let a=[];for(let l of e.visibleRanges){let e=new __(i.doc,o,l.from,l.to);for(;!e.next().done;){let{from:n,to:o}=e.value;if((!s||L_(s,i,n,o))&&(r.empty&&n<=r.from&&o>=r.to?a.push(A_.range(n,o)):(n>=r.to||o<=r.from)&&a.push(k_.range(n,o)),a.length>t.maxMatches))return wl.none}}return wl.set(a)}},{decorations:e=>e.decorations}),w_=md.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});var $_=Ws.define({combine:e=>$a(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new lE(e),scrollToMatch:e=>md.scrollIntoView(e)})}),M_=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,b_),!0}catch{return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new H_(this):new P_(this)}getCursor(e,t=0,i){let n=e.doc?e:wa.create({doc:e});return i??=n.doc.length,this.regexp?F_(this,n,t,i):D_(this,n,t,i)}},x_=class{constructor(e){this.spec=e}};function D_(e,t,i,n){let o;return e.wholeWord&&(o=function(e,t){return(i,n,o,r)=>((r>i||r+o.length<n)&&(r=Math.max(0,i-2),o=e.sliceString(r,Math.min(e.length,n+2))),!(t(B_(o,i-r))==Aa.Word&&t(U_(o,i-r))==Aa.Word||t(U_(o,n-r))==Aa.Word&&t(B_(o,n-r))==Aa.Word))}(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(o=function(e,t,i){return(n,o,r,s)=>!(i&&!i(n,o,r,s))&&e(n>=s&&o<=s+r.length?r.slice(n-s,o-s):t.doc.sliceString(n,o),t,n,o)}(e.test,t,o)),new __(t.doc,e.unquoted,i,n,e.caseSensitive?void 0:e=>e.toLowerCase(),o)}var P_=class extends x_{constructor(e){super(e)}nextMatch(e,t,i){let n=D_(this.spec,e,i,e.doc.length).nextOverlapping();if(n.done){let i=Math.min(e.doc.length,t+this.spec.unquoted.length);n=D_(this.spec,e,0,i).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==i?null:n.value}prevMatchInRange(e,t,i){for(let n=i;;){let i=Math.max(t,n-1e4-this.spec.unquoted.length),o=D_(this.spec,e,i,n),r=null;for(;!o.nextOverlapping().done;)r=o.value;if(r)return r;if(i==t)return null;n-=1e4}}prevMatch(e,t,i){let n=this.prevMatchInRange(e,0,t);return n||=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length),!n||n.from==t&&n.to==i?null:n}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=D_(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let o=D_(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}};function F_(e,t,i,n){let o;return e.wholeWord&&(o=function(e){return(t,i,n)=>!n[0].length||(e(B_(n.input,n.index))!=Aa.Word||e(U_(n.input,n.index))!=Aa.Word)&&(e(U_(n.input,n.index+n[0].length))!=Aa.Word||e(B_(n.input,n.index+n[0].length))!=Aa.Word)}(t.charCategorizer(t.selection.main.head))),e.test&&(o=function(e,t,i){return(n,o,r)=>(!i||i(n,o,r))&&e(r[0],t,n,o)}(e.test,t,o)),new O_(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},i,n)}function B_(e,t){return e.slice(Rs(e,t,!1),t)}function U_(e,t){return e.slice(t,Rs(e,t))}var H_=class extends x_{nextMatch(e,t,i){let n=F_(this.spec,e,i,e.doc.length).next();return n.done&&(n=F_(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let o=Math.max(t,i-1e4*n),r=F_(this.spec,e,o,i),s=null;for(;!r.next().done;)s=r.value;if(s&&(o==t||s.from>o+10))return s;if(o==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if("&"==i)return e.match[0];if("$"==i)return"$";for(let n=i.length;n>0;n--){let t=+i.slice(0,n);if(t>0&&t<e.match.length)return e.match[t]+i.slice(n)}return t})}matchAll(e,t){let i=F_(this.spec,e,0,e.doc.length),n=[];for(;!i.next().done;){if(n.length>=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let o=F_(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)n(o.value.from,o.value.to)}},V_=ba.define(),G_=ba.define(),W_=qs.define({create:e=>new X_(iE(e).create(),null),update(e,t){for(let i of t.effects)i.is(V_)?e=new X_(i.value.create(),e.panel):i.is(G_)&&(e=new X_(e.query,i.value?tE:null));return e},provide:e=>Mp.from(e,e=>e.panel)}),X_=class{constructor(e,t){this.query=e,this.panel=t}},z_=wl.mark({class:"cm-searchMatch"}),j_=wl.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Y_=zc.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(W_))}update(e){let t=e.state.field(W_);(t!=e.startState.field(W_)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return wl.none;let{view:i}=this,n=new Ua;for(let o=0,r=i.visibleRanges,s=r.length;o<s;o++){let{from:t,to:a}=r[o];for(;o<s-1&&a>r[o+1].from-500;)a=r[++o].to;e.highlight(i.state,t,a,(e,t)=>{let o=i.state.selection.ranges.some(i=>i.from==e&&i.to==t);n.add(e,t,o?j_:z_)})}return n.finish()}},{decorations:e=>e.decorations});function Q_(e){return t=>{let i=t.state.field(W_,!1);return i&&i.query.spec.valid?e(t,i):rE(t)}}var K_=Q_((e,{query:t})=>{let{to:i}=e.state.selection.main,n=t.nextMatch(e.state,i,i);if(!n)return!1;let o=Hs.single(n.from,n.to),r=e.state.facet($_);return e.dispatch({selection:o,effects:[dE(e,n),r.scrollToMatch(o.main,e)],userEvent:"select.search"}),oE(e),!0}),q_=Q_((e,{query:t})=>{let{state:i}=e,{from:n}=i.selection.main,o=t.prevMatch(i,n,n);if(!o)return!1;let r=Hs.single(o.from,o.to),s=e.state.facet($_);return e.dispatch({selection:r,effects:[dE(e,o),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),oE(e),!0}),J_=Q_((e,{query:t})=>{let i=t.matchAll(e.state,1e3);return!(!i||!i.length)&&(e.dispatch({selection:Hs.create(i.map(e=>Hs.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),Z_=Q_((e,{query:t})=>{let{state:i}=e,{from:n,to:o}=i.selection.main;if(i.readOnly)return!1;let r=t.nextMatch(i,n,n);if(!r)return!1;let s,a,l=r,c=[],u=[];l.precise?l.from==n&&l.to==o&&(a=i.toText(t.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),u.push(md.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))):l=t.nextMatch(i,l.from,l.to);let h=e.state.changes(c);return l&&(s=Hs.single(l.from,l.to).map(h),u.push(dE(e,l)),u.push(i.facet($_).scrollToMatch(s.main,e))),e.dispatch({changes:h,selection:s,effects:u,userEvent:"input.replace"}),!0}),eE=Q_((e,{query:t})=>{if(e.state.readOnly)return!1;let i=[];for(let o of t.matchAll(e.state,1e9)){let{from:e,to:n,precise:r}=o;r&&i.push({from:e,to:n,insert:t.getReplacement(o)})}if(!i.length)return!1;let n=e.state.phrase("replaced $ matches",i.length)+".";return e.dispatch({changes:i,effects:md.announce.of(n),userEvent:"input.replace.all"}),!0});function tE(e){return e.state.facet($_).createPanel(e)}function iE(e,t){let i=e.selection.main,n=i.empty||i.to>i.from+100?"":e.sliceDoc(i.from,i.to);if(t&&!n)return t;let o=e.facet($_);return new M_({search:t?.literal??o.literal?n:n.replace(/\n/g,"\\n"),caseSensitive:t?.caseSensitive??o.caseSensitive,literal:t?.literal??o.literal,regexp:t?.regexp??o.regexp,wholeWord:t?.wholeWord??o.wholeWord})}function nE(e){let t=Lp(e,tE);return t&&t.dom.querySelector("[main-field]")}function oE(e){let t=nE(e);t&&t==e.root.activeElement&&t.select()}var rE=e=>{let t=e.state.field(W_,!1);if(t&&t.panel){let i=nE(e);if(i&&i!=e.root.activeElement){let n=iE(e.state,t.query.spec);n.valid&&e.dispatch({effects:V_.of(n)}),i.focus(),i.select()}}else e.dispatch({effects:[G_.of(!0),t?V_.of(iE(e.state,t.query.spec)):ba.appendConfig.of(fE)]});return!0},sE=e=>{let t=e.state.field(W_,!1);if(!t||!t.panel)return!1;let i=Lp(e,tE);return i&&i.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:G_.of(!1)}),!0},aE=[{key:"Mod-f",run:rE,scope:"editor search-panel"},{key:"F3",run:K_,shift:q_,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:K_,shift:q_,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:sE,scope:"editor search-panel"}
3,{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let i=e.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:o}=i.main,r=[],s=0;for(let a=new __(e.doc,e.sliceDoc(n,o));!a.next().done;){if(r.length>1e3)return!1;a.value.from==n&&(s=r.length),r.push(Hs.range(a.value.from,a.value.to))}return t(e.update({selection:Hs.create(r,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,i=String(t.doc.lineAt(e.state.selection.main.head).number),{close:n,result:o}=xp(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return o.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o)return void e.dispatch({effects:n});let r=t.doc.lineAt(t.selection.main.head),[,s,a,l,c]=o,u=l?+l.slice(1):0,h=a?+a:r.number;if(a&&c){let e=h/100;s&&(e=e*("-"==s?-1:1)+r.number/t.doc.lines),h=Math.round(t.doc.lines*e)}else a&&s&&(h=h*("-"==s?-1:1)+r.number);let d=t.doc.line(Math.max(1,Math.min(t.doc.lines,h))),p=Hs.cursor(d.from+Math.max(0,Math.min(u,d.length)));e.dispatch({effects:[n,md.scrollIntoView(p.from,{y:"center"})],selection:p})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:i}=e.selection;if(i.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:i}=e,n=Hs.create(i.ranges.map(t=>e.wordAt(t.head)||Hs.cursor(t.head)),i.mainIndex);return!n.eq(i)&&(t(e.update({selection:n})),!0)})({state:e,dispatch:t});let n=e.sliceDoc(i[0].from,i[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=n))return!1;let o=function(e,t){let{main:i,ranges:n}=e.selection,o=e.wordAt(i.head),r=o&&o.from==i.from&&o.to==i.to;for(let s=!1,a=new __(e.doc,t,n[n.length-1].to);;){if(a.next(),!a.done){if(s&&n.some(e=>e.from==a.value.from))continue;if(r){let t=e.wordAt(a.value.from);if(!t||t.from!=a.value.from||t.to!=a.value.to)continue}return a.value}if(s)return null;a=new __(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}}(e,n);return!!o&&(t(e.update({selection:e.selection.addRange(Hs.range(o.from,o.to),!1),effects:md.scrollIntoView(o.to)})),!0)},preventDefault:!0}],lE=class{constructor(e){this.view=e;let t=this.query=e.state.field(W_).query.spec;function i(e,t,i){return hl("button",{class:"cm-button",name:e,onclick:t,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=hl("input",{value:t.search,placeholder:cE(e,"Find"),"aria-label":cE(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=hl("input",{value:t.replace,placeholder:cE(e,"Replace"),"aria-label":cE(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=hl("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=hl("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=hl("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=hl("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,i("next",()=>K_(e),[cE(e,"next")]),i("prev",()=>q_(e),[cE(e,"previous")]),i("select",()=>J_(e),[cE(e,"all")]),hl("label",null,[this.caseField,cE(e,"match case")]),hl("label",null,[this.reField,cE(e,"regexp")]),hl("label",null,[this.wordField,cE(e,"by word")]),...e.state.readOnly?[]:[hl("br"),this.replaceField,i("replace",()=>Z_(e),[cE(e,"replace")]),i("replaceAll",()=>eE(e),[cE(e,"replace all")])],hl("button",{name:"close",onclick:()=>sE(e),"aria-label":cE(e,"close"),type:"button"},["Ã"])])}commit(){let e=new M_({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:V_.of(e)}))}keydown(e){!function(e,t,i){return Ld(Rd(e.state),t,e,i)}(this.view,e,"search-panel")?13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?q_:K_)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),Z_(this.view)):e.preventDefault()}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(V_)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet($_).top}};function cE(e,t){return e.state.phrase(t)}var uE=30,hE=/[\s\.,:;?!]/;function dE(e,{from:t,to:i}){let n=e.state.doc.lineAt(t),o=e.state.doc.lineAt(i).to,r=Math.max(n.from,t-uE),s=Math.min(o,i+uE),a=e.state.sliceDoc(r,s);if(r!=n.from)for(let l=0;l<uE;l++)if(!hE.test(a[l+1])&&hE.test(a[l])){a=a.slice(l);break}if(s!=o)for(let l=a.length-1;l>a.length-uE;l--)if(!hE.test(a[l-1])&&hE.test(a[l])){a=a.slice(0,l);break}return md.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${n.number}.`)}var pE=md.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),fE=[W_,na.low(Y_),pE],gE=class{constructor(e,t,i,n){this.state=e,this.pos=t,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=_g(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),n=t.text.slice(i-t.from,this.pos-t.from),o=n.search(OE(e,!1));return o<0?null:{from:i+o,to:this.pos,text:n.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,i){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}};function mE(e){let t=Object.keys(e).join(""),i=/\w/.test(t);return i&&(t=t.replace(/\w/g,"")),`[${i?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function TE(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[i,n]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),i=Object.create(null);for(let{label:o}of e){t[o[0]]=!0;for(let e=1;e<o.length;e++)i[o[e]]=!0}let n=mE(t)+mE(i)+"*$";return[RegExp("^"+n),new RegExp(n)]}(t);return e=>{let o=e.matchBefore(n);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:i}:null}}function _E(e,t){return i=>{for(let t=_g(i.state).resolveInner(i.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(i)}}var EE=class{constructor(e,t,i,n){this.completion=e,this.source=t,this.match=i,this.score=n}};function bE(e){return e.selection.main.from}function OE(e,t){let{source:i}=e,n=t&&"^"!=i[0],o="$"!=i[i.length-1];return n||o?RegExp(`${n?"^":""}(?:${i})${o?"$":""}`,e.flags??(e.ignoreCase?"i":"")):e}var vE=Ta.define();function IE(e,t,i,n){let{main:o}=e.selection,r=i-o.from,s=n-o.from;return{...e.changeByRange(a=>{if(a!=o&&i!=n&&e.sliceDoc(a.from+r,a.from+s)!=e.sliceDoc(i,n))return{range:a};let l=e.toText(t);return{changes:{from:a.from+r,to:n==o.from?a.to:a.from+s,insert:l},range:Hs.cursor(a.from+r+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var SE=new WeakMap;function yE(e){if(!Array.isArray(e))return e;let t=SE.get(e);return t||SE.set(e,t=TE(e)),t}var RE=ba.define(),CE=ba.define(),kE=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let i=Cs(e,t),n=As(i);this.chars.push(i);let o=e.slice(t,t+n),r=o.toUpperCase();this.folded.push(Cs(r==o?o.toLowerCase():r,0)),t+=n}
vendor: 4,324 bytes, line 3
3this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:i,any:n,precise:o,byWord:r}=this;if(1==t.length){let n=Cs(e,0),o=As(n),r=o==e.length?0:-100;if(n!=t[0]){if(n!=i[0])return null;r+=-200}return this.ret(r,[0,o])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,l=0;if(s<0){for(let o=0,r=Math.min(e.length,200);o<r&&l<a;){let r=Cs(e,o);(r==t[l]||r==i[l])&&(n[l++]=o),o+=As(r)}if(l<a)return null}let c=0,u=0,h=!1,d=0,p=-1,f=-1,g=/[a-z]/.test(e),m=!0;for(let T=0,_=Math.min(e.length,200),E=0;T<_&&u<a;){let n=Cs(e,T);s<0&&(c<a&&n==t[c]&&(o[c++]=T),d<a&&(n==t[d]||n==i[d]?(0==d&&(p=T),f=T+1,d++):d=0));let l,_=n<255?n>=48&&n<=57||n>=97&&n<=122?2:+(n>=65&&n<=90):(l=ks(n))==l.toLowerCase()?l==l.toUpperCase()?0:2:1;(!T||1==_&&g||0==E&&0!=_)&&(t[u]==n||i[u]==n&&(h=!0)?r[u++]=T:r.length&&(m=!1)),E=_,T+=As(n)}return u==a&&0==r[0]&&m?this.result((h?-200:0)-100,r,e):d==a&&0==p?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):d==a?this.ret(-900-e.length,[p,f]):u==a?this.result((h?-200:0)-100-700+(m?0:-1100),r,e):2==t.length?null:this.result((n[0]?-700:0)-200-1100,n,e)}result(e,t,i){let n=[],o=0;for(let r of t){let e=r+(this.astral?As(Cs(i,r)):1);o&&n[o-1]==r?n[o-1]=e:(n[o++]=r,n[o++]=e)}return this.ret(e-i.length,n)}},AE=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),i=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==i?null:(this.matched=[0,t.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}},LE=Ws.define({combine:e=>$a(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:wE,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>NE(e(i),t(i)),optionClass:(e,t)=>i=>NE(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function NE(e,t){return e?t?e+" "+t:e:t}function wE(e,t,i,n,o,r){let s,a,l=e.textDirection==lc.RTL,c=l,u=!1,h="top",d=t.left-o.left,p=o.right-t.right,f=n.right-n.left,g=n.bottom-n.top;if(c&&d<Math.min(f,p)?c=!1:!c&&p<Math.min(f,d)&&(c=!0),f<=(c?d:p))s=Math.max(o.top,Math.min(i.top,o.bottom-g))-t.top,a=Math.min(400,c?d:p);else{u=!0,a=Math.min(400,(l?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=g||e>t.top?s=i.bottom-t.top:(h="bottom",s=t.bottom-i.top)}return{style:`${h}: ${s/((t.bottom-t.top)/r.offsetHeight)}px; max-width: ${a/((t.right-t.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(u?l?"left-narrow":"right-narrow":c?"left":"right")}}var $E=ba.define();function ME(e,t,i){if(e<=i)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/i);return{from:e*i,to:(e+1)*i}}let n=Math.ceil((e-t)/i);return{from:e-n*i,to:e-(n-1)*i}}var xE=class{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:o,selected:r}=n.open,s=e.state.facet(LE);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,i,n){let o=document.createElement("span");o.className="cm-completionLabel";let r=e.displayLabel||e.label,s=0;for(let a=0;a<n.length;){let e=n[a++],t=n[a++];e>s&&o.appendChild(document.createTextNode(r.slice(s,e)));let i=o.appendChild(document.createElement("span"));i.appendChild(document.createTextNode(r.slice(e,t))),i.className="
3cm-completionMatchedText",s=t}return s<r.length&&o.appendChild(document.createTextNode(r.slice(s))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=ME(o.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",i=>{let{options:n}=e.state.field(t).open;for(let t,o=i.target;o&&o!=this.dom;o=o.parentNode)if("LI"==o.nodeName&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<n.length)return this.applyCompletion(e,n[+t[1]]),void i.preventDefault();if(i.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&i.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&i.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:$E.of(t)}),i.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let i=e.state.field(this.stateField,!1);i&&i.tooltip&&e.state.facet(LE).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:CE.of(null)})}),this.showOptions(o,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=i){let{options:n,selected:o,disabled:r}=t.open;(!i.open||i.open.options!=n)&&(this.range=ME(n.length,o,e.state.facet(LE).maxRenderedOptions),this.showOptions(n,t.id)),this.updateSel(),r!=i.open?.disabled&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!r)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ME(t.options.length,t.selected,this.view.state.facet(LE).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();
vendor: 4,604 bytes, line 3
3let{completion:n}=t.options[t.selected],{info:o}=n;if(!o)return;let r="string"==typeof o?document.createTextNode(o):o(n);if(!r)return;"then"in r?r.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)}).catch(e=>Vc(this.view.state,e,"completion info")):(this.addInfoPane(r,n),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)i.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:n}=e;i.appendChild(t),this.infoDestroy=n||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby")):n--;return t&&function(e,t){let i=e.getBoundingClientRect(),n=t.getBoundingClientRect(),o=i.height/e.offsetHeight;n.top<i.top?e.scrollTop-=(i.top-n.top)/o:n.bottom>i.bottom&&(e.scrollTop+=(n.bottom-i.bottom)/o)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return n.top>Math.min(o.bottom,t.bottom)-10||n.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(LE).positionInfo(this.view,t,n,i,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,i){let n=document.createElement("ul");n.id=t,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions")),n.addEventListener("mousedown",e=>{e.target==n&&e.preventDefault()});let o=null;for(let r=i.from;r<i.to;r++){let{completion:s,match:a}=e[r],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;if(e!=o&&(r>i.from||0==i.from))if(o=e,"string"!=typeof l&&l.header)n.appendChild(l.header(l));else{n.appendChild(document.createElement("completion-section")).textContent=e}}let c=n.appendChild(document.createElement("li"));c.id=t+"-"+r,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function DE(e,t){return i=>new xE(i,e,t)}function PE(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}var FE=class e{constructor(e,t,i,n,o,r){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=n,this.selected=o,this.disabled=r}setSelected(t,i){return t==this.selected||t>=this.options.length?this:new e(this.options,VE(i,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,i,n,o,r,s){if(o&&!s&&t.some(e=>e.isPending))return o.setDisabled();let a=function(e,t){let i=[],n=null,o=null,r=e=>{i.push(e);let{section:t}=e.completion;if(t){n||=[];let e="string"==typeof t?t:t.name;n.some(t=>t.name==e)||n.push("string"==typeof t?{name:e}:t)}},s=t.facet(LE);for(let u of e)if(u.hasResult()){let e=u.result.getMatch;if(!1===u.result.filter)for(let t of u.result.options)r(new EE(t,u.source,e?e(t):[],1e9-i.length));else{let i,n=t.sliceDoc(u.from,u.to),a=s.filterStrict?new AE(n):new kE(n);for(let t of u.result.options)if(i=a.match(t.label)){let n=t.displayLabel?e?e(t,i.matched):[]:i.matched,s=i.score+(t.boost||0);if(r(new EE(t,u.source,n,s)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;o||=Object.create(null),o[e]=Math.max(s,o[e]||-1e9)}}}}if(n){let e=Object.create(null),t=0,r=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?o[t.name]-o[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let i of n.sort(r))t-=1e5,e[i.name]=t;for(let n of i){let{section:t}=n.completion;t&&(n.score+=e["string"==typeof t?t:t.name])}}let a=[],l=null,c=s.compareCompletions;for(let u of i.sort((e,t)=>
vendor: 4,376 bytes, line 3
3t.score-e.score||c(e.completion,t.completion))){let e=u.completion;!l||l.label!=e.label||l.detail!=e.detail||null!=l.type&&null!=e.type&&l.type!=e.type||l.apply!=e.apply||l.boost!=e.boost?a.push(u):PE(u.completion)>PE(l)&&(a[a.length-1]=u),l=u.completion}return a}(t,i);if(!a.length)return o&&t.some(e=>e.isPending)?o.setDisabled():null;let l=i.facet(LE).selectOnOpen?0:-1;if(o&&o.selected!=l&&-1!=o.selected){let e=o.options[o.selected].completion;for(let t=0;t<a.length;t++)if(a[t].completion==e){l=t;break}}return new e(a,VE(n,l),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:KE,above:r.aboveCursor},o?o.timestamp:Date.now(),l,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},BE=class e{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new e(GE,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:i}=t,n=i.facet(LE),o=(n.override||i.languageDataAt("autocomplete",bE(i)).map(yE)).map(e=>(this.active.find(t=>t.source==e)||new XE(e,+!!this.active.some(e=>0!=e.state))).update(t,n));o.length==this.active.length&&o.every((e,t)=>e==this.active[t])&&(o=this.active);let r=this.open,s=t.effects.some(e=>e.is(jE));r&&t.docChanged&&(r=r.map(t.changes)),t.selection||o.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!function(e,t){if(e==t)return!0;for(let i=0,n=0;;){for(;i<e.length&&!e[i].hasResult();)i++;for(;n<t.length&&!t[n].hasResult();)n++;let o=i==e.length,r=n==t.length;if(o||r)return o==r;if(e[i++].result!=t[n++].result)return!1}}(o,this.active)||s?r=FE.build(o,i,this.id,r,n,s):r&&r.disabled&&!o.some(e=>e.isPending)&&(r=null),!r&&o.every(e=>!e.isPending)&&o.some(e=>e.hasResult())&&(o=o.map(e=>e.hasResult()?new XE(e.source,0):e));for(let e of t.effects)e.is($E)&&(r&&=r.setSelected(e.value,this.id));return o==this.active&&r==this.open?this:new e(o,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?UE:HE}};var UE={"aria-autocomplete":"list"},HE={};function VE(e,t){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(i["aria-activedescendant"]=e+"-"+t),i}var GE=[];function WE(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(vE);if(i&&t.activateOnCompletion(i))return 12}let i=e.isUserEvent("input.type");return i&&t.activateOnTyping?5:i?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}var XE=class e{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return 1==this.state}update(t,i){let n=WE(t,i),o=this;(8&n||16&n&&this.touches(t))&&(o=new e(o.source,0)),4&n&&0==o.state&&(o=new e(this.source,1)),o=o.updateFor(t,n);for(let r of t.effects)if(r.is(RE))o=new e(o.source,1,r.value);else if(r.is(CE))o=new e(o.source,0);else if(r.is(jE))for(let e of r.value)e.source==o.source&&(o=e);return o}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(bE(e.state))}},zE=class e extends XE{constructor(e,t,i,n,o,r){super(e,3,t),this.limit=i,this.result=n,this.from=o,this.to=r}hasResult(){return!0}updateFor(t,i){if(!(3&i))return this.map(t.changes);let n=this.result;n.map&&!t.changes.empty&&(n=n.map(n,t.changes));let o=t.changes.mapPos(this.from),r=t.changes.mapPos(this.to,1),s=bE(t.state);if(s>r||!n||2&i&&(bE(t.startState)==this.from||s<this.limit))return new XE(this.source,4&i?1:0);let a=t.changes.mapPos(this.limit);return function(e,t,i,n){if(!e)return!1;let o=t.sliceDoc(i,n);return"function"==typeof e?e(o,i,n,t):OE(e,!0).test(o)}(n.validFor,t.state,o,r)?new e(this.source,this.explicit,a,n,o,r):n.update&&(n=n.update(n,o,r,new gE(t.state,s,!1)))?new e(this.source,this.explicit,a,n,n.from,n.to??bE(t.state)):new XE(this.source,1,this.explicit)}map(t){if(t.empty)return this;let i=this.result.map?this.result.map(this.result,t):this.result;return i?new e(this.source,this.explicit,t.mapPos(this.limit),i,t.mapPos(this.from),t.mapPos(this.to,1)):new XE(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};var jE=ba.define({map:(e,t)=>e.map(e=>e.map(t))}),YE=qs.define({create:()=>BE.start(),update:(e,t)=>
vendor: 4,439 bytes, line 3
3e.update(t),provide:e=>[Ep.from(e,e=>e.tooltip),md.contentAttributes.from(e,e=>e.attrs)]});function QE(e,t){let i=t.completion.apply||t.completion.label,n=e.state.field(YE).active.find(e=>e.source==t.source);return n instanceof zE&&("string"==typeof i?e.dispatch({...IE(e.state,i,n.from,n.to),annotations:vE.of(t.completion)}):i(e,t.completion,n.from,n.to),!0)}var KE=DE(YE,QE);function qE(e,t="option"){return i=>{let n=i.state.field(YE,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(LE).interactionDelay)return!1;let o,r=1;"page"==t&&(o=Cp(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=n.open.options,a=n.open.selected>-1?n.open.selected+r*(e?1:-1):e?0:s-1;return a<0?a="page"==t?0:s-1:a>=s&&(a="page"==t?s-1:0),i.dispatch({effects:$E.of(a)}),!0}}var JE=e=>!!e.state.field(YE,!1)&&(e.dispatch({effects:RE.of(!0)}),!0),ZE=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},eb=zc.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(YE).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(YE),i=e.state.facet(LE);if(!e.selectionSet&&!e.docChanged&&e.startState.field(YE)==t)return;let n=e.transactions.some(e=>{let t=WE(e,i);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let r=0;r<this.running.length;r++){let t=this.running[r];if(n||t.context.abortOnDocChange&&e.docChanged||t.updates.length+e.transactions.length>50&&Date.now()-t.time>1e3){for(let i of t.context.abortListeners)try{i()}catch(e){Vc(this.view.state,e)}t.context.abortListeners=null,this.running.splice(r--,1)}else t.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(RE)))&&(this.pendingStart=!0);let o=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),o):-1,0!=this.composing)for(let r of e.transactions)r.isUserEvent("input.type")?this.composing=2:2==this.composing&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(YE);for(let i of t.active)i.isPending&&!this.running.some(e=>e.active.source==i.source)&&this.startQuery(i);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(LE).updateSyncTime))}startQuery(e){let{state:t}=this.view,i=new gE(t,bE(t),e.explicit,this.view),n=new ZE(e,i);this.running.push(n),Promise.resolve(e.source(i)).then(e=>{n.context.aborted||(n.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:CE.of(null)}),Vc(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(LE).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(LE),i=this.view.state.field(YE);for(let n=0;n<this.running.length;n++){let o=this.running[n];if(void 0===o.done)continue;if(this.running.splice(n--,1),o.done){let i=bE(o.updates.length?o.updates[0].startState:this.view.state),n=Math.min(i,o.done.from+ +!o.active.explicit),r=new zE(o.active.source,o.active.explicit,n,o.done,o.done.from,o.done.to??i);for(let e of o.updates)r=r.update(e,t);if(r.hasResult()){e.push(r);continue}}let r=i.active.find(e=>e.source==o.active.source);if(r&&r.isPending)if(null==o.done){let i=new XE(o.active.source,0);for(let e of o.updates)i=i.update(e,t);i.isPending||e.push(i)}else this.startQuery(r)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:jE.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(YE,!1);if(t&&t.tooltip&&this.view.state.facet(LE).closeOnBlur){let i=t.open&&Cp(this.view,t.open.tooltip);(!i||!i.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:CE.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:RE.of(!1)}),20),this.composing=0}}}),tb="object"==typeof navigator&&/Win/.test(navigator.platform),ib=na.highest(md.domEventHandlers({ke
vendor: 4,596 bytes, line 3
3ydown(e,t){let i=t.state.field(YE,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||e.key.length>1||e.ctrlKey&&(!tb||!e.altKey)||e.metaKey)return!1;let n=i.open.options[i.open.selected],o=i.active.find(e=>e.source==n.source),r=n.completion.commitCharacters||o.result.commitCharacters;return r&&r.indexOf(e.key)>-1&&QE(t,n),!1}})),nb=md.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'Æ'"}},".cm-completionIcon-class":{"&:after":{content:"'â'"}},".cm-completionIcon-interface":{"&:after":{content:"'â'"}},".cm-completionIcon-variable":{"&:after":{content:"'ð¥'"}},".cm-completionIcon-constant":{"&:after":{content:"'ð¶'"}},".cm-completionIcon-type":{"&:after":{content:"'ð¡'"}},".cm-completionIcon-enum":{"&:after":{content:"'âª'"}},".cm-completionIcon-property":{"&:after":{content:"'â¡'"}},".cm-completionIcon-keyword":{"&:after":{content:"'ðï¸'"}},".cm-completionIcon-namespace":{"&:after":{content:"'â¢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),ob=class{constructor(e,t,i,n){this.field=e,this.line=t,this.from=i,this.to=n}},rb=class e{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(t){let i=t.mapPos(this.from,-1,Ns.TrackDel),n=t.mapPos(this.to,1,Ns.TrackDel);return null==i||null==n?null:new e(this.field,i,n)}},sb=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],n=[t],o=e.doc.lineAt(t),r=/^\s*/.exec(o.text)[0];for(let s of this.lines){if(i.length){let i=r,o=/^\t*/.exec(s)[0].length;for(let t=0;t<o;t++)i+=e.facet(Lg);n.push(t+i.length-o),s=i+s.slice(o)}i.push(s),t+=s.length+1}return{text:i,ranges:this.fieldPositions.map(e=>new rb(e.field,n[e.line]+e.from,n[e.line]+e.to))}}static parse(t){let i,n=[],o=[],r=[];for(let e of t.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=i[1]?+i[1]:null,s=i[2]||i[3]||"",a=-1;0===t&&(t=1e9);let l=s.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(null==t?l&&n[e].name==l:n[e].seq==t)&&(a=e);if(a<0){let e=0;for(;e<n.length&&(null==t||null!=n[e].seq&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:l}),a=e;for(let t of r)t.field>=a&&t.field++}for(let e of r)if(e.line==o.length&&e.from>i.index){let t=i[2]?3+(i[1]||"").length:2;e.from-=t,e.to-=t}r.push(new ob(a,o.length,i.index,i.index+l.length)),e=e.slice(0,i.index)+s+e.slice(i.index+i[0].length)}e=e.replace(/\\([{}])/g,(e,t,i)=>{for(let n of r)n.line==o.length&&n.from>i&&(n.from--,n.to--);return t}),o.push(e)}return new e(o,r)}},ab=wl.widget({widget:new class extends Ll{toDOM(){let e=document.createElement("span");
vendor: 5,747 bytes, line 3
3return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),lb=wl.mark({class:"cm-snippetField"}),cb=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=wl.set(e.map(e=>(e.from==e.to?ab:lb).range(e.from,e.to)),!0)}map(t){let i=[];for(let e of this.ranges){let n=e.map(t);if(!n)return null;i.push(n)}return new e(i,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},ub=ba.define({map:(e,t)=>e&&e.map(t)}),hb=ba.define(),db=qs.define({create:()=>null,update(e,t){for(let i of t.effects){if(i.is(ub))return i.value;if(i.is(hb)&&e)return new cb(e.ranges,i.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>md.decorations.from(e,e=>e?e.deco:wl.none)});function pb(e,t){return Hs.create(e.filter(e=>e.field==t).map(e=>Hs.range(e.from,e.to)))}function fb(e){let t=sb.parse(e);return(e,i,n,o)=>{let{text:r,ranges:s}=t.instantiate(e.state,n),{main:a}=e.state.selection,l={changes:{from:n,to:o==a.from?a.to:o,insert:ms.of(r)},scrollIntoView:!0,annotations:i?[vE.of(i),Oa.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=pb(s,0)),s.some(e=>e.field>0)){let t=new cb(s,0),i=l.effects=[ub.of(t)];void 0===e.state.field(db,!1)&&i.push(ba.appendConfig.of([db,_b,bb,nb]))}e.dispatch(e.state.update(l))}}function gb(e){return({state:t,dispatch:i})=>{let n=t.field(db,!1);if(!n||e<0&&0==n.active)return!1;let o=n.active+e,r=e>0&&!n.ranges.some(t=>t.field==o+e);return i(t.update({selection:pb(n.ranges,o),effects:ub.of(r?null:new cb(n.ranges,o)),scrollIntoView:!0})),!0}}var mb=[{key:"Tab",run:gb(1),shift:gb(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(db,!1)&&(t(e.update({effects:ub.of(null)})),!0)}],Tb=Ws.define({combine:e=>e.length?e[0]:mb}),_b=na.highest(Sd.compute([Tb],e=>e.facet(Tb)));function Eb(e,t){return{...t,apply:fb(e)}}var bb=md.domEventHandlers({mousedown(e,t){let i,n=t.state.field(db,!1);if(!n||null==(i=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let o=n.ranges.find(e=>e.from<=i&&e.to>=i);return!(!o||o.field==n.active)&&(t.dispatch({selection:pb(n.ranges,o.field),effects:ub.of(n.ranges.some(e=>e.field>o.field)?new cb(n.ranges,o.field):null),scrollIntoView:!0}),!0)}}),Ob={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},vb=ba.define({map:(e,t)=>t.mapPos(e,-1,Ns.TrackAfter)??void 0}),Ib=new class extends Ma{};Ib.startSide=1,Ib.endSide=-1;var Sb=qs.define({create:()=>Ba.empty,update(e,t){if(e=e.map(t.changes),t.selection){let i=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=i.from&&e<=i.to})}for(let i of t.effects)i.is(vb)&&(e=e.update({add:[Ib.range(i.value,i.value+1)]}));return e}});var yb="()[]{}<>«»»«[]ï½ï½";function Rb(e){for(let t=0;t<16;t+=2)if(yb.charCodeAt(t)==e)return yb.charAt(t+1);return ks(e<128?e:e+1)}function Cb(e,t){return e.languageDataAt("closeBrackets",t)[0]||Ob}var kb="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Ab=md.inputHandler.of((e,t,i,n)=>{if((kb?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(n.length>2||2==n.length&&1==As(Cs(n,0))||t!=o.from||i!=o.to)return!1;let r=function(e,t){let i=Cb(e,e.selection.main.head),n=i.brackets||Ob.brackets;for(let o of n){let r=Rb(Cs(o,0));if(t==o)return r==o?xb(e,o,n.indexOf(o+o+o)>-1,i):$b(e,o,r,i.before||Ob.before);if(t==r&&Nb(e,e.selection.main.from))return Mb(e,o,r)}return null}(e.state,n);return!!r&&(e.dispatch(r),!0)}),Lb=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=Cb(e,e.selection.main.head).brackets||Ob.brackets,n=null,o=e.changeByRange(t=>{if(t.empty){let n=function(e,t){let i=e.sliceString(t-2,t);return As(Cs(i,0))==i.length?i:i.slice(1)}(e.doc,t.head);for(let o of i)if(o==n&&wb(e.doc,t.head)==Rb(Cs(o,0)))return{changes:{from:t.head-o.length,to:t.head+o.length},range:Hs.cursor(t.head-o.length)}}return{range:n=t}});return n||t(e.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!n}}];function Nb(e,t){let i=!1;return e.field(Sb).between(0,e.doc.length,e=>{e==t&&(i=!0)}),i}function wb(e,t){let i=e.sliceString(t,t+2);return i.slice(0,As(Cs(i,0)))}function $b(e,t,i,n){let o=null,r=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:i,from:r.to}],effects:vb.of(r.to+t.length),range:Hs.range(r.anchor+t.length,r.head+t.length)};let s=wb(e.doc,r.head);return!s||/\s/.test(s)||n.indexOf(s)>-1?{changes:{insert:t+i,from:r.head},effects:vb.of(r.head+t.length),range:Hs.cursor(r.head+t.length)}:{range:o=r}});return o?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Mb(e,t,i){let n=null,o=e.changeByRange(t=>t.empty&&wb(e.doc,t.head)==i?{changes:{from:t.head,to:t.head+i.length,insert:i},range:Hs.cursor(t.head+i.length)}:n={range:t});return n?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function xb(e,t,i,n){let o=n.stringPrefixes||Ob.stringPrefixes,r=null,s=e.changeByRange(n=>{if(!n.empty)return{changes:[{insert:t,from:n.from},{insert:t,from:n.to}],effects:vb.of(n.to+t.length),range:Hs.range(n.anchor+t.length,n.head+t.length)};let s,a=n.head,l=wb(e.doc,a);if(l==t){if(Db(e,a))return{changes:{insert:t+t,from:a},effects:vb.of(a+t.length),range:Hs.cursor(a+t.length)};if(Nb(e,a)){let n=i&&e.sliceDoc(a,a+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+n.length,insert:n},range:Hs.cursor(a+n.length)}}}else{if(i&&e.sliceDoc(a-2*t.length,a)==t+t&&(s=Pb(e,a-2*t.length,o))>-1&&Db(e,s))return{changes:{insert:t+t+t+t,from:a},effects:vb.of(a+t.length),range:Hs.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=Aa.Word&&Pb(e,a,o)>-1&&!function(e,t,i,n){let o=_g(e).resolveInner(t,-1),r=n.reduce((e,t)=>
vendor: 4,317 bytes, line 3
3Math.max(e,t.length),0);for(let s=0;s<5;s++){let s=e.sliceDoc(o.from,Math.min(o.to,o.from+i.length+r)),a=s.indexOf(i);if(!a||a>-1&&n.indexOf(s.slice(0,a))>-1){let t=o.firstChild;for(;t&&t.from==o.from&&t.to-t.from>i.length+a;){if(e.sliceDoc(t.to-i.length,t.to)==i)return!1;t=t.firstChild}return!0}let l=o.to==t&&o.parent;if(!l)break;o=l}return!1}(e,a,t,o))return{changes:{insert:t+t,from:a},effects:vb.of(a+t.length),range:Hs.cursor(a+t.length)}}return{range:r=n}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Db(e,t){let i=_g(e).resolveInner(t+1);return i.parent&&i.from==t}function Pb(e,t,i){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=Aa.Word)return t;for(let o of i){let i=t-o.length;if(e.sliceDoc(i,t)==o&&n(e.sliceDoc(i-1,i))!=Aa.Word)return i}return-1}var Fb=[{key:"Ctrl-Space",run:JE},{mac:"Alt-`",run:JE},{mac:"Alt-i",run:JE},{key:"Escape",run:e=>{let t=e.state.field(YE,!1);return!(!t||!t.active.some(e=>0!=e.state))&&(e.dispatch({effects:CE.of(null)}),!0)}},{key:"ArrowDown",run:qE(!0)},{key:"ArrowUp",run:qE(!1)},{key:"PageDown",run:qE(!0,"page")},{key:"PageUp",run:qE(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(YE,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(LE).interactionDelay)&&QE(e,t.open.options[t.open.selected])}}],Bb=na.highest(Sd.computeN([LE],e=>e.facet(LE).defaultKeymap?[Fb]:[])),Ub=class{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}},Hb=class e{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(t,i,n){let o=n.facet(Zb).markerFilter;o&&(t=o(t,n));let r=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new Ua,a=[],l=0,c=n.doc.iter(),u=0,h=n.doc.length;for(let e=0;;){let t,i,n=e==r.length?null:r[e];if(!n&&!a.length)break;if(a.length)t=l,i=a.reduce((e,t)=>Math.min(e,t.to),n&&n.from>t?n.from:1e8);else{if(t=n.from,t>h)break;i=n.to,a.push(n),e++}for(;e<r.length;){let n=r[e];if(n.from!=t||!(n.to>n.from||n.to==t)){i=Math.min(n.from,i);break}a.push(n),e++,i=Math.min(n.to,i)}i=Math.min(i,h);let o=!1;if(a.some(e=>e.from==t&&(e.to==i||i==h))&&(o=t==i,!o&&i-t<10)){let e=t-(u+c.value.length);e>0&&(c.next(e),u=t);for(let n=t;;){if(n>=i){o=!0;break}if(!c.lineBreak&&u+c.value.length>n)break;n=u+c.value.length,u+=c.value.length,c.next()}}let d=cO(a);if(o)s.add(t,t,wl.widget({widget:new nO(d),diagnostics:a.slice()}));else{let e=a.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,i,wl.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:a.slice(),inclusiveEnd:a.some(e=>e.to>i)}))}if(l=i,l==h)break;for(let e=0;e<a.length;e++)a[e].to<=l&&a.splice(e--,1)}let d=s.finish();return new e(d,i,Vb(d))}};function Vb(e,t=null,i=0){let n=null;return e.between(i,1e9,(e,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(n){if(o.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Ub(n.from,i,n.diagnostic)}else n=new Ub(e,i,t||o.diagnostics[0])}),n}function Gb(e,t){return e.field(jb,!1)?t:t.concat(ba.appendConfig.of(dO))}var Wb=ba.define(),Xb=ba.define(),zb=ba.define(),jb=qs.define({create:()=>new Hb(wl.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let i=e.diagnostics.map(t.changes),n=null,o=e.panel;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);n=Vb(i,e.selected.diagnostic,o)||Vb(i,null,o)}!i.size&&o&&t.state.facet(Zb).autoPanel&&(o=null),e=new Hb(i,o,n)}for(let i of t.effects)if(i.is(Wb)){let n=t.state.facet(Zb).autoPanel?i.value.length?rO.open:null:e.panel;e=Hb.init(i.value,n,t.state)}else i.is(Xb)?e=new Hb(e.diagnostics,i.value?rO.open:null,e.selected):i.is(zb)&&(e=new Hb(e.diagnostics,e.panel,i.value));return e},provide:e=>[Mp.from(e,e=>e.panel),md.decorations.from(e,e=>e.diagnostics)]}),Yb=wl.mark({class:"cm-lintRange cm-lintRange-active"});function Qb(e,t,i){let n,{diagnostics:o}=e.state.field(jb),r=-1,s=-1;o.between(t-+(i<0),t+ +(i>0),(e,o,{spec:a})=>{if(t>=e&&t<=o&&(e==o||(t>e||i>0)&&(t<o||i<0)))return n=a.diagnostics,r=e,s=o,!1});let a=e.state.facet(Zb).tooltipFilter;return n&&a&&(n=a(n,e.state)),n?{pos:r,end:s,above:e.state.doc.lineAt(r).to<s,create:()=>({dom:Kb(e,n)})}:null}function Kb(e,t){return hl("ul",{class:"cm-tooltip-lint"},t.map(t=>iO(e,t,!1)))}var qb=e=>{let t=e.state.field(jb,!1);return!(!t||!t.panel)&&(e.dispatch({effects:Xb.of(!1)}),!0)}
vendor: 5,607 bytes, line 3
3,Jb=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(jb,!1);(!t||!t.panel)&&e.dispatch({effects:Gb(e.state,[Xb.of(!0)])});let i=Lp(e,rO.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(jb,!1);if(!t)return!1;let i=e.state.selection.main,n=Vb(t.diagnostics,null,i.to+1);return!(!n&&(n=Vb(t.diagnostics,null,0),!n||n.from==i.from&&n.to==i.to))&&(e.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),function(e,t,i,n={}){let o=e.state.facet(Ip).map(t=>e.plugin(t)).filter(e=>!!e);if(n.tooltip&&n.tooltip.active){let e=o.find(e=>e.field==n.tooltip.active);e&&(o=[e])}for(let r of o)r.activateHover(e,t,i,n.until??(()=>!1))}(e,n.from,1,{tooltip:hO,until:e=>e.docChanged||e.newSelection.main.head<n.from||e.newSelection.main.head>n.to}),!0)}}],Zb=Ws.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...$a(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:eO,tooltipFilter:eO,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,n,o)=>e(i,n,o)||t(i,n,o):e:t,autoPanel:(e,t)=>e||t})})});function eO(e,t){return e?t?(i,n)=>t(e(i,n),n):e:t}function tO(e){let t=[];if(e)e:for(let{name:i}of e){for(let e=0;e<i.length;e++){let n=i[e];if(/[a-zA-Z]/.test(n)&&!t.some(e=>e.toLowerCase()==n.toLowerCase())){t.push(n);continue e}}t.push("")}return t}function iO(e,t,i){let n=i?tO(t.actions):[];return hl("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},hl("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((i,o)=>{let r=!1,s=n=>{if(n.preventDefault(),r)return;r=!0;let o=Vb(e.state.field(jb).diagnostics,t);o&&i.apply(e,o.from,o.to)},{name:a}=i,l=n[o]?a.indexOf(n[o]):-1,c=l<0?a:[a.slice(0,l),hl("u",a.slice(l,l+1)),a.slice(l+1)];return hl("button",{type:"button",class:"cm-diagnosticAction"+(i.markClass?" "+i.markClass:""),onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${n[o]})"`}.`},c)}),t.source&&hl("div",{class:"cm-diagnosticSource"},t.source))}var nO=class extends Ll{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return hl("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},oO=class{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=iO(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},rO=class e{constructor(e){this.view=e,this.items=[];this.list=hl("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)qb(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:i}=this.items[this.selectedIndex],n=tO(i.actions);for(let o=0;o<n.length;o++)if(n[o].toUpperCase().charCodeAt(0)==t.keyCode){let t=Vb(this.view.state.field(jb).diagnostics,i);t&&i.actions[o].apply(e,t.from,t.to)}}}t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=hl("div",{class:"cm-panel-lint"},this.list,hl("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>qb(this.view)},"Ã")),this.update()}get selectedIndex(){let e=this.view.state.field(jb).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(jb),i=0,n=!1,o=null,r=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let l of a.diagnostics){if(r.has(l))continue;r.add(l);let e,s=-1;for(let t=i;t<this.items.length;t++)if(this.items[t].diagnostic==l){s=t;break}s<0?(e=new oO(this.view,l),this.items.splice(i,0,e),n=!0):(e=this.items[s],s>i&&(this.items.splice(i,s-i),n=!0)),t&&e.diagnostic==t.diagnostic?e.dom.hasAttribute("aria-selected")||(e.dom.setAttribute("aria-selected","true"),o=e):e.dom.hasAttribute("aria-selected")&&e.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();0==this.items.length&&(this.items.push(new oO(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let i=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/i:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/i)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Vb(this.view.state.field(jb).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:zb.of(t)}
3)}static open(t){return new e(t)}};function sO(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var aO=md.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:sO("#f11")},".cm-lintRange-warning":{backgroundImage:sO("orange")},".cm-lintRange-info":{backgroundImage:sO("#999")},".cm-lintRange-hint":{backgroundImage:sO("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function lO(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function cO(e){let t="hint",i=1;for(let n of e){let e=lO(n.severity);e>i&&(i=e,t=n.severity)}return t}var uO,hO=Rp(Qb,{hideOn:function(e,t){let i=t.pos,n=t.end||i,o=e.state.facet(Zb).hideOn(e,i,n);if(null!=o)return o;let r=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(Wb))&&!e.changes.touchesRange(r.from,Math.max(r.to,n)))}}),dO=[jb,md.decorations.compute([jb],e=>{let{selected:t,panel:i}=e.field(jb);return t&&i&&t.from!=t.to?wl.set([Yb.range(t.from,t.to)]):wl.none}),hO,aO],pO=[function(e={}){return[tf.of(e),zp(),rf]}(),lf,function(e={}){return[Jd.of(e),Zd||=zc.fromClass(class{constructor(e){this.view=e,this.decorations=wl.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Jd)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new jd({regexp:e.specialChars,decoration:(t,i,n)=>{let{doc:o}=i.state,r=Cs(t[0],0);if(9==r){let e=o.lineAt(n),t=i.state.tabSize,r=qa(e.text,t,n-e.from);return wl.replace({widget:new tp((t-r%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=wl.replace({widget:new ep(e,r)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Jd);e.startState.facet(Jd)==t?this.decorations=this.decorator.updateDeco(e,this.decorations):(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view))}},{decorations:e=>e.decorations})]}(),function(e={}){return[Jm,qm.of(e),md.domEventHandlers({beforeinput(e,t){let i="historyUndo"==e.inputType?eT:"historyRedo"==e.inputType?tT:null;return!!i&&(e.preventDefault(),i(t))}})]}(),function(e={}){let t={...um,...e},i=new hm(t,!0),n=new hm(t,!1),o=zc.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Cg)!=e.state.facet(Cg)||e.startState.field(qg,!1)!=e.state.field(qg,!1)||_g(e.startState)!=_g(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Ua;for(let o of e.viewportLineBlocks){let r=Zg(e.state,o.from,o.to)?n:zg(e.state,o.from,o.to)?i:null;r&&t.add(o.from,o.from,r)}return t.finish()}}),{domEventHandlers:r}=t;return[o,Wp({class:"cm-foldGutter",markers:e=>e.plugin(o)?.markers||Ba.empty,initialSpacer:()=>new hm(t,!1),domEventHandlers:{...r,click:(e,t,i)=>{if(r.click&&r.click(e,t,i))return!0;let n=Zg(e.state,t.from,t.to);if(n)return e.dispatch({effects:Qg.of(n)}),!0;let o=zg(e.state,t.from,t.to);return!!o&&(e.dispatch({effects:Yg.of(o)}),!0)}}}),sm()]}(),function(e={}){return[Pd.of(e),Bd,Hd,Vd,Pc.of(!0)]}(),[Wd,Xd],wa.allowMultipleSelections.of(!0),wa.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let i=e.newDoc,{head:n}=e.newSelection.main,o=i.lineAt(n);if(n>o.from+200)return e;let r=i.sliceString(o.from,n);if(!t.some(e=>e.test(r)))return e;let{state:s}=e,a=-1,l=[];for(let{head:c}
3of s.selection.ranges){let e=s.doc.lineAt(c);if(e.from==a)continue;a=e.from;let t=$g(s,e.from);if(null==t)continue;let i=/^\s*/.exec(e.text)[0],n=wg(s,t);i!=n&&l.push({from:e.from,to:e.from+i.length,insert:n})}return l.length?[e,{changes:l,sequential:!0}]:e}),function(e,t){let i,n=[_m];return e instanceof pm&&(e.module&&n.push(md.styleModule.of(e.module)),i=e.themeType),t?.fallback?n.push(gm.of(e)):i?n.push(fm.computeN([md.darkTheme],t=>t.facet(md.darkTheme)==("dark"==i)?[e]:[])):n.push(fm.of(e)),n}(Em,{fallback:!0}),function(e={}){return[vm.of(e),Cm]}(),[Ab,Sb],function(e={}){return[ib,YE,LE.of(e),eb,Bb,nb]}(),function(e){let t=e?.eventFilter||(e=>e.altKey&&0==e.button);return md.mouseSelectionStyle.of((e,i)=>t(i)?ap(e,i):null)}(),function(e={}){let[t,i]=lp[e.key||"Alt"],n=zc.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||i(e))},keyup(e){(e.keyCode==t||!i(e))&&this.set(!1)},mousemove(e){this.set(i(e))}}});return[n,md.contentAttributes.of(e=>e.plugin(n)?.isDown?cp:null)]}(),np,function(e){let t=[w_,N_];return e&&t.push(C_.of(e)),t}(),Sd.of([...Lb,...g_,...aE,...gT,...nm,...Fb,...Jb])],fO=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[pO]}),gO=Symbol("vue-codemirror-global-config"),mO=function(e){var t=new ra;return{compartment:t,run:function(i){t.get(e.state)?e.dispatch({effects:t.reconfigure(i)}):e.dispatch({effects:ba.appendConfig.of(t.of(i))})}}},TO=function(e,t){var i=mO(e),n=i.compartment,o=i.run;return function(i){var r=n.get(e.state);o(i??r!==t?t:[])}},_O={type:Boolean,default:void 0},EO={autofocus:_O,disabled:_O,indentWithTab:_O,tabSize:Number,placeholder:String,style:Object,autoDestroy:_O,phrases:Object,root:Object,extensions:Array,selection:Object},bO={modelValue:{type:String,default:""}},OO=Object.assign(Object.assign({},EO),bO);!function(e){e.Change="change",e.Update="update",e.Focus="focus",e.Blur="blur",e.Ready="ready",e.ModelUpdate="update:modelValue"}(uO||={});var vO={};vO[uO.Change]=function(e,t){return!0},vO[uO.Update]=function(e){return!0},vO[uO.Focus]=function(e){return!0},vO[uO.Blur]=function(e){return!0},vO[uO.Ready]=function(e){return!0};var IO={};IO[uO.ModelUpdate]=vO[uO.Change];var SO=Object.assign(Object.assign({},vO),IO),yO=xi({name:"VueCodemirror",props:Object.assign({},OO),emits:Object.assign({},SO),setup:function(e,t){var i=$t(),n=$t(),o=$t(),r=Object.assign(Object.assign({},fO),mi(gO,{})),s=or(function(){var t={};
3return Object.keys(kt(e)).forEach(function(i){"modelValue"!==i&&(t[i]=e[i]??r[i])}),t});return qi(function(){n.value=function(e){var t=e.onUpdate,i=e.onChange,n=e.onFocus,o=e.onBlur,r=function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(i[n[o]]=e[n[o]])}return i}(e,["onUpdate","onChange","onFocus","onBlur"]);return wa.create({doc:r.doc,selection:r.selection,extensions:(Array.isArray(r.extensions)?r.extensions:[r.extensions]).concat([md.updateListener.of(function(e){t(e),e.docChanged&&i(e.state.doc.toString(),e),e.focusChanged&&(e.view.hasFocus?n(e):o(e))})])})}({doc:e.modelValue,selection:s.value.selection,extensions:r.extensions??[],onFocus:function(e){return t.emit(uO.Focus,e)},onBlur:function(e){return t.emit(uO.Blur,e)},onUpdate:function(e){return t.emit(uO.Update,e)},onChange:function(i,n){i!==e.modelValue&&(t.emit(uO.Change,i,n),t.emit(uO.ModelUpdate,i,n))}}),o.value=function(e){return new md(Object.assign({},e))}({state:n.value,parent:i.value,root:s.value.root});var a=function(e){var t=function(){return e.state.doc.toString()},i=mO(e).run,n=TO(e,[md.editable.of(!1),wa.readOnly.of(!0)]),o=TO(e,Sd.of([m_])),r=mO(e).run,s=mO(e).run,a=mO(e).run,l=mO(e).run;return{focus:function(){return e.focus()},getDoc:t,setDoc:function(i){i!==t()&&e.dispatch({changes:{from:0,to:e.state.doc.length,insert:i}})},reExtensions:i,toggleDisabled:n,toggleIndentWithTab:o,setTabSize:function(e){r([wa.tabSize.of(e),Lg.of(" ".repeat(e))])},setPhrases:function(e){s([wa.phrases.of(e)])},setPlaceholder:function(e){a(function(e){let t=zc.fromClass(class{constructor(t){this.view=t,this.placeholder=e?wl.set([wl.widget({widget:new op(e),side:1}).range(0)]):wl.none}get decorations(){return this.view.state.doc.length?wl.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,md.contentAttributes.of({"aria-placeholder":e})]:t}(e))},setStyle:function(e){void 0===e&&(e={}),l(md.theme({"&":Object.assign({},e)}))}}}(o.value);_i(function(){return e.modelValue},function(e){e!==a.getDoc()&&a.setDoc(e)}),_i(function(){return e.extensions},function(e){return a.reExtensions(e||[])},{immediate:!0}),_i(function(){return s.value.disabled},function(e){return a.toggleDisabled(e)},{immediate:!0}),_i(function(){return s.value.indentWithTab},function(e){return a.toggleIndentWithTab(e)},{immediate:!0}),_i(function(){return s.value.tabSize},function(e){return a.setTabSize(e)},{immediate:!0}),_i(function(){return s.value.phrases},function(e){return a.setPhrases(e||{})},{immediate:!0}),_i(function(){return s.value.placeholder},function(e){return a.setPlaceholder(e)},{immediate:!0}),_i(function(){return s.value.style},function(e){return a.setStyle(e)},{immediate:!0}),s.value.autofocus&&a.focus(),t.emit(uO.Ready,{state:n.value,view:o.value,container:i.value})}),en(function(){s.value.autoDestroy&&o.value&&function(e){e.destroy()}(o.value)}),function(){return rr("div",{class:"v-codemirror",style:{display:"contents"},ref:i})}}}),RO=class e{constructor(e,t,i,n,o,r,s,a,l,c=0,u){this.p=e,this.stack=t,this.state=i,this.reducePos=n,this.pos=o,this.score=r,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,i,n=0){let o=t.parser.context;return new e(t,[],i,n,n,0,[],0,o?new CO(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,i=65535&e,{parser:n}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),r=n.dynamicPrecedence(i);if(r&&(this.score+=r),0==t)return i<n.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(n.getGoto(this.state,i,!0),this.reducePos),i<n.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,o?8:4,!0),void this.reduceContext(i,this.reducePos);let s=this.stack.length-3*(t-1)-(262144&e?6:0),a=s?this.stack[s-2]:this.p.ranges[0].from;i<n.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let l=this.reducePos-a;l>=2e3&&!this.p.parser.nodeSet.types[i]?.isAnonymous&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSize<l&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=l));let c=s?this.stack[s-1]:0,u=this.bufferBase+this.buffer.length-c;if(i<n.minRepeatTerm||131072&e){let e=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,e,u+4,!0)}if(262144&e)this.state=this.stack[s];else{let e=this.stack[s-3];this.state=n.getGoto(e,i,!0)}for(;this.stack.length>s;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,i,n=4,o=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this.buffer.length;if(e>0&&0==this.buffer[e-4]&&this.buffer[e-1]>-1){if(t==i)return;if(this.buffer[e-2]>=t)return void(this.buffer[e-2]=i)}}if(o&&this.pos!=i){let o=this.buffer.length;if(o>0&&(0!=this.buffer[o-4]||this.buffer[o-1]<0)){let e=!1;for(let t=o;t>0&&this.buffer[t-2]>i;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=n}else this.buffer.push(e,t,i,n)}shift(e,t,i,n){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=n,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,n,4);else{let o=e,{parser:r}=this.p;this.pos=n;let s=r.stateFlag(o,1);!s&&(n>i||t<=r.maxNode)&&(this.reducePos=n),this.pushState(o,s?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=r.maxNode&&this.buffer.push(t,i,n,4)}}apply(e,t,i,n){65536&e?this.reduce(e):this.shift(e,t,i,n)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(i,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,i=t.buffer.length;for(i&&0==t.buffer[i-4]&&(i-=4);i>0&&t.buffer[i-2]>t.reducePos;)i-=4;let n=t.buffer.slice(i),o=t.bufferBase+i;for(;t&&o==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,o,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new kO(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==i)return!1;if(!(65536&i))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let i=[];for(let n,o=0;o<t.length;o+=2)(n=t[o+1])!=this.state&&this.p.parser.hasAction(n,e)&&i.push(t[o],n);if(this.stack.length<120)for(let e=0;i.length<8&&e<t.length;e+=2){let n=t[e+1];i.some((e,t)=>1&t&&e==n)||i.push(t[e],n)}t=i}let i=[];for(let n=0;n<t.length&&i.length<4;n+=2){let e=t[n+1];if(e==this.state)continue;let o=this.split();o.pushState(e,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let i=t>>19,n=65535&t,o=this.stack.length-3*i;if(o<0||e.getGoto(this.stack[o],n,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(n,o)=>
vendor: 5,136 bytes, line 3
3{if(!t.includes(n))return t.push(n),e.allActions(n,t=>{if(!(393216&t))if(65536&t){let i=(t>>19)-o;if(i>1){let n=65535&t,o=this.stack.length-3*i;if(o>=0&&e.getGoto(this.stack[o],n,!1)>=0)return i<<19|65536|n}}else{let e=i(t,o+1);if(null!=e)return e}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new CO(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead)&&(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},CO=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},kO=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,i=e>>19;0==i?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(i-1);let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}},AO=class e{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(t,i=t.bufferBase+t.buffer.length){return new e(t,i,i-t.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function LO(e,t=Uint16Array){if("string"!=typeof e)return e;let i=null;for(let n=0,o=0;n<e.length;){let r=0;for(;;){let t=e.charCodeAt(n++),i=!1;if(126==t){r=65535;break}t>=92&&t--,t>=34&&t--;let o=t-32;if(o>=46&&(o-=46,i=!0),r+=o,i)break;r*=46}i?i[o++]=r:i=new t(r)}return i}var NO=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},wO=new NO,$O=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=wO,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,n=this.rangeIndex,o=this.pos+e;for(;o<i.from;){if(!n)return null;let e=this.ranges[--n];o-=i.from-e.to,i=e}for(;t<0?o>i.to:o>=i.to;){if(n==this.ranges.length-1)return null;let e=this.ranges[++n];o+=e.from-i.to,i=e}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,i,n=this.chunkOff+e;if(n>=0&&n<this.chunk.length)t=this.pos+e,i=this.chunk.charCodeAt(n);else{let n=this.resolveOffset(e,1);if(null==n)return-1;if(t=n,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,n=this.range;for(;n.to<=t;)n=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),i=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),i}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(null==i||i<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}
vendor: 5,809 bytes, line 3
3readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=wO,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(i+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return i}},MO=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;DO(this.data,e,t,this.id,i.data,i.tokenPrecTable)}};MO.prototype.contextual=MO.prototype.fallback=MO.prototype.extend=!1;MO.prototype.fallback=MO.prototype.extend=!1;var xO=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function DO(e,t,i,n,o,r){let s=0,a=1<<n,{dialect:l}=i.p.parser;e:for(;0!=(a&e[s]);){let i=e[s+1];for(let h=s+3;h<i;h+=2)if((e[h+1]&a)>0){let i=e[h];if(l.allows(i)&&(-1==t.token.value||t.token.value==i||FO(i,t.token.value,o,r))){t.acceptToken(i);break}}let n=t.next,c=0,u=e[s+2];if(!(t.next<0&&u>c&&65535==e[i+3*u-3])){for(;c<u;){let o=c+u>>1,r=i+o+(o<<1),a=e[r],l=e[r+1]||65536;if(n<a)u=o;else{if(!(n>=l)){s=e[r+2],t.advance();continue e}c=o+1}}break}s=e[i+3*u-1]}}function PO(e,t,i){for(let n,o=t;65535!=(n=e[o]);o++)if(n==i)return o-t;return-1}function FO(e,t,i,n){let o=PO(i,n,t);return o<0||PO(i,n,e)<o}var BO=typeof process<"u"&&/\bparse\b/.test({}.LOG),UO=null;function HO(e,t,i){let n=e.cursor(mf.IncludeAnonymous);for(n.moveTo(t);;)if(!(i<0?n.childBefore(t):n.childAfter(t)))for(;;){if((i<0?n.to<t:n.from>t)&&!n.type.isError)return i<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(i<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return i<0?0:e.length}}var VO=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?HO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?HO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],n=this.index[t];if(n==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[n],r=this.start[t]+i.positions[n];if(r>e)return this.nextStart=r,null;if(o instanceof bf){if(r==e){if(r<this.safeFrom)return null;let e=r+o.length;if(e<=this.safeTo){let t=o.prop(df.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,r+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(r),this.index.push(0))}else this.index[t]++,this.nextStart=r+o.length}}},GO=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new NO)}getActions(e){let t=0,i=null,{parser:n}=e.p,{tokenizers:o}=n,r=n.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,a=0;for(let l=0;l<o.length;l++){if(!(1<<l&r))continue;let n=o[l],c=this.tokens[l];if((!i||n.fallback)&&((n.contextual||c.start!=e.pos||c.mask!=r||c.context!=s)&&(this.updateCachedToken(c,n,e),c.mask=r,c.context=s),c.lookAhead>c.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let o=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!n.extend&&(i=c,t>o))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new NO,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new NO,{pos:i,p:n}=e;return t.start=i,t.end=Math.min(i+1,n.stream.end),t.value=i==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,i){let n=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(n,e),i),e.value>-1){let{parser:t}=i.p;for(let n=0;n<t.specialized.length;n++)if(t.specialized[n]==e.value){let o=t.specializers[n](this.stream.read(e.start,e.end),i);if(o>=0&&i.p.parser.dialect.allows(o>>1)){1&o?e.extended=o>>1:e.value=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,i,n){for(let o=0;o<n;o+=3)if(this.actions[o]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=i,n}
vendor: 1,914 bytes, line 3
3addActions(e,t,i,n){let{state:o}=e,{parser:r}=e.p,{data:s}=r;for(let a=0;a<2;a++)for(let e=r.stateSlot(o,a?2:1);;e+=3){if(65535==s[e]){if(1!=s[e+1]){0==n&&2==s[e+1]&&(n=this.putAction(YO(s,e+2),t,i,n));break}e=YO(s,e+2)}s[e]==t&&(n=this.putAction(YO(s,e+1),t,i,n))}return n}},WO=class{constructor(e,t,i,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new $O(t,n),this.tokens=new GO(e,this.stream),this.topTerm=e.top[1];let{from:o}=n[0];this.stacks=[RO.start(this,e.top[0],o)],this.fragments=i.length&&this.stream.end-o>4*e.bufferLength?new VO(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,i=this.stacks,n=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==i.length){let[e]=i;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<i.length;r++){let s=i[r];for(;;){if(this.tokens.mainToken=null,s.pos>n)o.push(s);else{if(this.advanceStack(s,o,i))continue;{e||(e=[],t=[]),e.push(s);let i=this.tokens.getMainToken(s);t.push(i.value,i.end)}}break}}if(!o.length){let t=e&&function(e){let t=null;for(let i of e){let e=i.p.stoppedAt;(i.pos==i.p.stream.end||null!=e&&i.pos>e)&&i.p.parser.stateFlag(i.state,2)&&(!t||t.score<i.score)&&(t=i)}return t}(e);if(t)return this.stackToTree(t);if(this.parser.strict)throw SyntaxError("No parse at "+n);this.recovering||=5}if(this.recovering&&e){let i=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,o);if(i)return this.stackToTree(i.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(o.length>e)for(o.sort((e,t)=>t.score-e.score);o.length>e;)o.pop();o.some(e=>e.reducePos>n)&&this.recovering--}
vendor: 11,597 bytes, line 3
3else if(o.length>1){e:for(let e=0;e<o.length-1;e++){let t=o[e];for(let i=e+1;i<o.length;i++){let n=o[i];if(t.sameState(n)||t.buffer.length>500&&n.buffer.length>500){if(!((t.score-n.score||t.buffer.length-n.buffer.length)>0)){o.splice(e--,1);continue e}o.splice(i--,1)}}}o.length>12&&(o.sort((e,t)=>t.score-e.score),o.splice(12,o.length-12))}this.minStackPos=o[0].pos;for(let r=1;r<o.length;r++)o[r].pos<this.minStackPos&&(this.minStackPos=o[r].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let n=e.pos,{parser:o}=this;BO&&this.stackID(e);if(null!=this.stoppedAt&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,i=t?e.curContext.hash:0;for(let r=this.fragments.nodeAt(n);r;){let n=this.parser.nodeSet.types[r.type.id]==r.type?o.getGoto(e.state,r.type.id):-1;if(n>-1&&r.length&&(!t||(r.prop(df.contextHash)||0)==i))return e.useNode(r,n),!0;if(!(r instanceof bf)||0==r.children.length||r.positions[0]>0)break;let s=r.children[0];if(!(s instanceof bf&&0==r.positions[0]))break;r=s}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let a=0;a<s.length;){let o=s[a++],r=s[a++],l=s[a++],c=a==s.length||!i,u=c?e:e.split(),h=this.tokens.mainToken;if(u.apply(o,r,h?h.start:u.pos,l),c)return!0;u.pos>n?t.push(u):i.push(u)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return XO(e,t),!0}}runRecovery(e,t,i){let n=null,o=!1;for(let r=0;r<e.length;r++){let s=e[r],a=t[r<<1],l=t[1+(r<<1)],c=BO?this.stackID(s)+" -> ":"";if(s.deadEnd&&(o||(o=!0,s.restart(),this.advanceFully(s,i))))continue;let u=s.split(),h=c;for(let e=0;e<10&&u.forceReduce()&&!this.advanceFully(u,i);e++)BO&&(h=this.stackID(u)+" -> ");for(let e of s.recoverByInsert(a))this.advanceFully(e,i);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),XO(s,i)):(!n||n.score<u.score)&&(n=u)}return n}stackToTree(e){return e.close(),bf.build({buffer:AO.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(UO||=new WeakMap).get(e);return t||UO.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function XO(e,t){for(let i=0;i<t.length;i++){let n=t[i];if(n.pos==e.pos&&n.sameState(e))return void(t[i].score<e.score&&(t[i]=e))}t.push(e)}var zO=class{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||0==this.disabled[e]}},jO=e=>e;function YO(e,t){return e[t]|e[t+1]<<16}function QO(e){if(e.external){let t=+!!e.extend;return(i,n)=>e.external(i,n)<<1|t}return e.get}var KO=10,qO=new Set([25,49,50,263,65,130,56,57,238,62,63,72,73,77,60,61,151,152,155,112]);function JO(e){return e==KO||13==e}function ZO(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}var ev=new xO((e,t)=>{let i;if(e.next<0)e.acceptToken(199);else if(t.context.flags&iv)JO(e.next)&&e.acceptToken(198,1);else if(((i=e.peek(-1))<0||JO(i))&&t.canShift(197)){let t=0;for(;32==e.next||9==e.next;)e.advance(),t++;(e.next==KO||13==e.next||35==e.next)&&e.acceptToken(197,-t)}else JO(e.next)&&e.acceptToken(196,1)},{contextual:!0}),tv=new xO((e,t)=>{let i=t.context;if(i.flags)return;let n=e.peek(-1);if(n==KO||13==n){let t=0,n=0;for(;;){if(32==e.next)t++;else{if(9!=e.next)break;t+=8-t%8}e.advance(),n++}t!=i.indent&&e.next!=KO&&13!=e.next&&35!=e.next&&(t<i.indent?e.acceptToken(195,-n):e.acceptToken(194))}}),iv=1,nv=4,ov=8,rv=16,sv=32;function av(e,t,i){this.parent=e,this.indent=t,this.flags=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i+(i<<6)}var lv=new av(null,0,0);var cv=new Map([[241,0],[242,nv],[243,ov],[244,12],[245,rv],[246,20],[247,24],[248,28],[249,sv],[250,36],[251,40],[252,44],[253,48],[254,52],[255,56],[256,60]].map(([e,t])=>[e,2|t])),uv=new class{constructor(e){this.start=e.start,this.shift=e.shift||jO,this.reduce=e.reduce||jO,this.reuse=e.reuse||jO,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}({start:lv,reduce:(e,t,i,n)=>e.flags&iv&&qO.has(t)||(71==t||72==t)&&2&e.flags?e.parent:e,shift:(e,t,i,n)=>194==t?new av(e,function(e){let t=0;for(let i=0;i<e.length;i++)t+=9==e.charCodeAt(i)?8-t%8:1;return t}(n.read(n.pos,i.pos)),0):195==t?e.parent:24==t||55==t||59==t||3==t?new av(e,0,iv):cv.has(t)?new av(e,0,cv.get(t)|e.flags&iv):e,hash:e=>e.hash}),hv=new xO(e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let i=e.peek(t);if(32!=i&&9!=i)return void(40!=i&&46!=i&&i!=KO&&13!=i&&35!=i&&e.acceptToken(1))}}),dv=new xO((e,t)=>{let{flags:i}=t.context,n=i&nv?34:39,o=(i&ov)>0,r=!(i&rv),s=(i&sv)>0,a=e.pos;for(;!(e.next<0);)if(s&&123==e.next){if(123!=e.peek(1)){if(e.pos==a)return void e.acceptToken(3,1);break}e.advance(2)}else{if(r&&92==e.next){if(e.pos==a){e.advance();let t=e.next;return t>=0&&(e.advance(),pv(e,t)),void e.acceptToken(2)}break}if(92==e.next&&!r&&e.peek(1)>-1)e.advance(2);else{if(e.next==n&&(!o||e.peek(1)==n&&e.peek(2)==n)){if(e.pos==a)return void e.acceptToken(201,o?3:1);break}if(e.next==KO){if(o)e.advance();else if(e.pos==a)return void e.acceptToken(201);break}e.advance()}}e.pos>a&&e.acceptToken(200)});function pv(e,t){if(111==t)for(let i=0;i<2&&e.next>=48&&e.next<=55;i++)e.advance();else if(120==t)for(let i=0;i<2&&ZO(e.next);i++)e.advance();else if(117==t)for(let i=0;i<4&&ZO(e.next);i++)e.advance();else if(85==t)for(let i=0;i<8&&ZO(e.next);i++)e.advance();else if(78==t&&123==e.next){for(e.advance();e.next>=0&&125!=e.next&&39!=e.next&&34!=e.next&&e.next!=KO;)e.advance();125==e.next&&e.advance()}}var fv=zf({'async "*" "**" FormatConversion FormatSpec':pg.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":pg.controlKeyword,"in not and or is del":pg.operatorKeyword,"from def class global nonlocal lambda":pg.definitionKeyword,import:pg.moduleKeyword,"with as print":pg.keyword,Boolean:pg.bool,None:pg.null,VariableName:pg.variableName,"CallExpression/VariableName":pg.function(pg.variableName),"FunctionDefinition/VariableName":pg.function(pg.definition(pg.variableName)),"ClassDefinition/VariableName":pg.definition(pg.className),PropertyName:pg.propertyName,"CallExpression/MemberExpression/PropertyName":pg.function(pg.propertyName),Comment:pg.lineComment,Number:pg.number,String:pg.string,FormatString:pg.special(pg.string),Escape:pg.escape,UpdateOp:pg.updateOperator,"ArithOp!":pg.arithmeticOperator,BitOp:pg.bitwiseOperator,CompareOp:pg.compareOperator,AssignOp:pg.definitionOperator,Ellipsis:pg.punctuation,At:pg.meta,"( )":pg.paren,"[ ]":pg.squareBracket,"{ }":pg.brace,".":pg.derefOperator,", ;":pg.separator}),gv={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},mv=class e extends Uf{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let s=0;s<e.repeatNodeCount;s++)t.push("");let i=Object.keys(e.topRules).map(t=>e.topRules[t][1]),n=[];for(let s=0;s<t.length;s++)n.push([]);function o(e,t,i){n[e].push([t,t.deserialize(String(i))])}if(e.nodeProps)for(let s of e.nodeProps){let e=s[0];"string"==typeof e&&(e=df[e]);for(let t=1;t<s.length;){let i=s[t++];if(i>=0)o(i,e,s[t++]);else{let n=s[t+-i];for(let r=-i;r>0;r--)o(s[t++],e,n);t++}}}this.nodeSet=new Tf(t.map((t,o)=>gf.define({name:o>=this.minRepeatTerm?void 0:t,id:o,props:n[o],top:i.indexOf(o)>-1,error:0==o,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=cf;let r=LO(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(QO),this.states=LO(e.states,Uint32Array),this.data=LO(e.stateData),this.goto=LO(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new MO(r,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let n=new WO(this,e,t,i);for(let o of this.wrappers)n=o(n,e,t,i);return n}getGoto(e,t,i=!1){let n=this.goto;if(t>=n[0])return-1;for(let o=n[t+1];;){let t=n[o++],r=1&t,s=n[o++];if(r&&i)return s;for(let i=o+(t>>1);o<i;o++)if(n[o]==e)return s;if(r)return-1}}hasAction(e,t){let i=this.data;for(let n=0;n<2;n++)for(let o,r=this.stateSlot(e,n?2:1);;r+=3){if(65535==(o=i[r])){if(1!=i[r+1]){if(2==i[r+1])return YO(i,r+2);break}o=i[r=YO(i,r+2)]}if(o==t||0==o)return YO(i,r+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let i=this.stateSlot(e,4),n=i?t(i):void 0;for(let o=this.stateSlot(e,1);null==n;o+=3){if(65535==this.data[o]){if(1!=this.data[o+1])break;o=YO(this.data,o+2)}n=t(YO(this.data,o+1))}return n}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(65535==this.data[i]){if(1!=this.data[i+1])break;i=YO(this.data,i+2)}if(!(1&this.data[i+2])){let e=this.data[i+1];t.some((t,i)=>1&i&&t==e)||t.push(this.data[i],e)}}return t}configure(t){let i=Object.assign(Object.create(e.prototype),this);if(t.props&&(i.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);i.top=e}return t.tokenizers&&(i.tokenizers=this.tokenizers.map(e=>{let i=t.tokenizers.find(t=>t.from==e);return i?i.to:e})),t.specializers&&(i.specializers=this.specializers.slice(),i.specializerSpecs=this.specializerSpecs.map((e,n)=>{let o=t.specializers.find(t=>t.from==e.external);if(!o)return e;let r=Object.assign(Object.assign({},e),{external:o.to});return i.specializers[n]=QO(r),r})),t.contextTracker&&(i.context=t.contextTracker),t.dialect&&(i.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(i.strict=t.strict),t.wrap&&(i.wrappers=i.wrappers.concat(t.wrap)),null!=t.bufferLength&&(i.bufferLength=t.bufferLength),i}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let e=t.indexOf(o);e>=0&&(i[e]=!0)}let n=null;for(let o=0;o<t.length;o++)if(!i[o])for(let e,i=this.dialects[t[o]];65535!=(e=this.data[i++]);)(n||=new Uint8Array(this.maxTerm+1))[e]=1;return new zO(e,i,n)}static deserialize(t){return new e(t)}}.deserialize({version:14,states:"##jQ
vendor: 25,384 bytes, line 3
3`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyO<POWO,5:aOOQS,5:a,5:aO<[QdO'#HwOOOW'#Dw'#DwOOOW'#Fz'#FzO<lOWO,5:bOOQS,5:b,5:bOOQS'#F}'#F}O<zQtO,5:iO?lQtO,5=`O@VQ#xO,5=`O@vQtO,5=`OOQS,5:},5:}OA_QeO'#GWOBqQdO,5;^OOQV,5=^,5=^OB|QtO'#IPOCkQdO,5;tOOQS-E:[-E:[OOQV,5;s,5;sO4dQdO'#FQOOQV-E9o-E9oOCsQtO,59]OEzQtO,59iOFeQdO'#HVOFpQdO'#HVO1XQdO'#HVOF{QdO'#DTOGTQdO,59mOGYQdO'#HZO'vQdO'#HZO0rQdO,5=tOOQS,5=t,5=tO0rQdO'#EROOQS'#ES'#ESOGwQdO'#GPOHXQdO,58|OHXQdO,58|O*xQdO,5:oOHgQtO'#H]OOQS,5:r,5:rOOQS,5:z,5:zOHzQdO,5;OOI]QdO'#IOO1XQdO'#H}OOQS,5;Q,5;QOOQS'#GT'#GTOIqQtO,5;QOJPQdO,5;QOJUQdO'#IQOOQS,5;T,5;TOJdQdO'#H|OOQS,5;W,5;WOJuQdO,5;YO4iQdO,5;`O4iQdO,5;cOJ}QtO'#ITO'vQdO'#ITOKXQdO,5;eO4VQdO,5;eO0rQdO,5;jO1XQdO,5;lOK^QeO'#EuOLjQgO,5;fO!!kQdO'#IUO4iQdO,5;jO!!vQdO,5;lO!#OQdO,5;qO!#ZQtO,5;vO'vQdO,5;vPOOO,5=[,5=[P!#bOSO,5=[P!#jOdO,5=[O!&bQtO1G.jO!&iQtO1G.jO!)YQtO1G.jO!)dQtO1G.jO!+}QtO1G.jO!,bQtO1G.jO!,uQdO'#HcO!-TQtO'#GuO0rQdO'#HcO!-_QdO'#HbOOQS,5:Z,5:ZO!-gQdO,5:ZO!-lQdO'#HeO!-wQdO'#HeO!.[QdO,5>OOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5<jOOQS,5<j,5<jOOQS-E9|-E9|OOQS,5<r,5<rOOQS-E:U-E:UOOQV1G0x1G0xO1XQdO'#GRO!7dQtO,5>kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5<k,5<kOOQS-E9}-E9}O!9wQdO1G.hOOQS1G0Z1G0ZO!:VQdO,5=wO!:gQdO,5=wO0rQdO1G0jO0rQdO1G0jO!:xQdO,5>jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!<RQdO,5>lO!<aQdO,5>lO!<oQdO,5>hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5<m,5<mOOQS-E:P-E:POOQS7+&z7+&zOOQS1G3]1G3]OOQS,5<^,5<^OOQS-E9p-E9pOOQS7+$s7+$sO#)bQdO,5=`O#){QdO,5=`O#*^QtO,5<aO#*qQdO1G3cOOQS-E9s-E9sOOQS7+&U7+&UO#+RQdO7+&UO#+aQdO,5<nO#+uQdO1G4UOOQS-E:Q-E:QO#,WQdO1G4UOOQS1G4T1G4TOOQS7+&W7+&WO#,iQdO7+&WOOQS,5<p,5<pO#,tQdO1G4WOOQS-E:S-E:SOOQS,5<l,5<lO#-SQdO1G4SOOQS-E:O-E:OO1XQdO'#EqO#-jQdO'#EqO#-uQdO'#IRO#-}QdO,5;[OOQS7+&`7+&`O0rQdO7+&`O#.SQgO7+&fO!JmQdO'#GXO4iQdO7+&fO4iQdO7+&iO#2QQtO,5<tO'vQdO,5<tO#2[QdO1G4ZOOQS-E:W-E:WO#2fQdO1G4ZO4iQdO7+&kO0rQdO7+&kOOQV7+&p7+&pO!KrQ!fO7+&rO!KzQdO7+&rO`QeO1G0{OOQV-E:X-E:XO4iQdO7+&lO4iQdO7+&lOOQV,5<u,5<uO#2nQdO,5<uO!JmQdO,5<uOOQV7+&l7+&lO#2yQgO7+&lO#6tQdO,5<vO#7PQdO1G4[OOQS-E:Y-E:YO#7^QdO1G4[O#7fQdO'#IWO#7tQdO'#IWO1XQdO'#IWOOQS'#IW'#IWO#8PQdO'#IVOOQS,5;n,5;nO#8XQdO,5;nO0rQdO'#FUOOQV7+&r7+&rO4iQdO7+&rOOQV7+&w7+&wO4iQdO7+&wO#8^QfO,5;xOOQV7+&|7+&|POOO7+(b7+(bO#8cQdO1G3iOOQS,5<c,5<cO#8qQdO1G3hOOQS-E9u-E9uO#9UQdO,5<dO#9aQdO,5<dO#9tQdO1G3kOOQS-E9v-E9vO#:UQdO1G3kO#:^QdO1G3kO#:nQdO1G3kO#:UQdO1G3kOOQS<<H[<<H[O#:yQtO1G1zOOQS<<Hk<<HkP#;WQdO'#FtO8vQdO1G3bO#;eQdO1G3bO#;jQdO<<HkOOQS<<Hl<<HlO#;zQdO7+)QOOQS<<Hs<<HsO#<[QtO1G1yP#<{QdO'#FsO#=YQdO7+)RO#=jQdO7+)RO#=rQdO<<HwO#=wQdO7+({OOQS<<Hy<<HyO#>nQdO,5<bO'vQdO,5<bOOQS-E9t-E9tOOQS<<Hw<<HwOOQS,5<g,5<gO0rQdO,5<gO#>sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<<IpO1XQdO1G2YP1XQdO'#GSO#AOQdO7+)pO#AaQdO7+)pOOQS<<Ir<<IrP1XQdO'#GUP0rQdO'#GQOOQS,5;],5;]O#ArQdO,5>mO#BQQdO,5>mOOQS1G0v1G0vOOQS<<Iz<<IzOOQV-E:V-E:VO4iQdO<<JQOOQV,5<s,5<sO4iQdO,5<sOOQV<<JQ<<JQOOQV<<JT<<JTO#BYQtO1G2`P#BdQdO'#GYO#BkQdO7+)uO#BuQgO<<JVO4iQdO<<JVOOQV<<J^<<J^O4iQdO<<J^O!KrQ!fO<<J^O#FpQgO7+&gOOQV<<JW<<JWO#FzQgO<<JWOOQV1G2a1G2aO1XQdO1G2aO#JuQdO1G2aO4iQdO<<JWO1XQdO1G2bP0rQdO'#G[O#KQQdO7+)vO#K_QdO7+)vOOQS'#FT'#FTO0rQdO,5>rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<<Jc<<JcO#LhQdO1G1dOOQS7+)T7+)TP#LmQdO'#FwO#L}QdO1G2OO#MbQdO1G2OO#MrQdO1G2OP#M}QdO'#FxO#N[QdO7+)VO#NlQdO7+)VO#NlQdO7+)VO#NtQdO7+)VO$ UQdO7+(|O8vQdO7+(|OOQSAN>VAN>VO$ oQdO<<LmOOQSAN>cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<<MT<<MTO$#nQdO7+(fOOQSAN?[AN?[OOQS7+'t7+'tO$$XQdO<<M[OOQS,5<q,5<qO$$jQdO1G4XOOQS-E:T-E:TOOQVAN?lAN?lOOQV1G2_1G2_O4iQdOAN?qO$$xQgOAN?qOOQVAN?xAN?xO4iQdOAN?xOOQV<<JR<<JRO4iQdOAN?rO4iQdO7+'{OOQV7+'{7+'{O1XQdO7+'{OOQVAN?rAN?rOOQS7+'|7+'|O$(sQdO<<MbOOQS1G4^1G4^O0rQdO1G4^OOQS,5<w,5<wO$)QQdO1G4]OOQS-E:Z-E:ZOOQU'#G_'#G_O$)cQfO7+'OO$)nQdO'#F_O$*uQdO7+'jO$+VQdO7+'jOOQS7+'j7+'jO$+bQdO<<LqO$+rQdO<<LqO$+rQdO<<LqO$+zQdO'#H^OOQS<<Lh<<LhO$,UQdO<<LhOOQS7+'h7+'hOOQS'#D|'#D|OOOO1G4R1G4RO$,oQdO1G4RO$,wQdO1G4RP!=hQdO'#GVOOQVG25]G25]O4iQdOG25]OOQVG25dG25dOOQVG25^G25^OOQV<<Kg<<KgO4iQdO<<KgOOQS7+)x7+)xP$-SQdO'#G]OOQU-E:]-E:]OOQV<<Jj<<JjO$-vQtO'#FaOOQS'#Fc'#FcO$.WQdO'#FbO$.xQdO'#FbOOQS'#Fb'#FbO$.}QdO'#IYO$)nQdO'#FiO$)nQdO'#FiO$/fQdO'#FjO$)nQdO'#FkO$/mQdO'#IZOOQS'#IZ'#IZO$0[QdO,5;yOOQS<<KU<<KUO$0dQdO<<KUO$0tQdOANB]O$1UQdOANB]O$1^QdO'#H_OOQS'#H_'#H_O1sQdO'#DcO$1wQdO,5=xOOQSANBSANBSOOOO7+)m7+)mO$2`QdO7+)mOOQVLD*wLD*wOOQVANARANARO5uQ!fO'#GaO$2hQtO,5<SO$)nQdO'#FmOOQS,5<W,5<WOOQS'#Fd'#FdO$3YQdO,5;|O$3_QdO,5;|OOQS'#Fg'#FgO$)nQdO'#G`O$4PQdO,5<QO$4kQdO,5>tO$4{QdO,5>tO1XQdO,5<PO$5^QdO,5<TO$5cQdO,5<TO$)nQdO'#I[O$5hQdO'#I[O$5mQdO,5<UOOQS,5<V,5<VO0rQdO'#FpOOQU1G1e1G1eO4iQdO1G1eOOQSAN@pAN@pO$5rQdOG27wO$6SQdO,59}OOQS1G3d1G3dOOOO<<MX<<MXOOQS,5<{,5<{OOQS-E:_-E:_O$6XQtO'#FaO$6`QdO'#I]O$6nQdO'#I]O$6vQdO,5<XOOQS1G1h1G1hO$6{QdO1G1hO$7QQdO,5<zOOQS-E:^-E:^O$7lQdO,5=OO$8TQdO1G4`OOQS-E:b-E:bOOQS1G1k1G1kOOQS1G1o1G1oO$8eQdO,5>vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5<YO$8sQdO,5>wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5<ZP$)nQdO'#GcO$;XQdO1G2hO$)nQdO1G2hP$;gQdO'#GbO$;nQdO<<MhO$;xQdO1G1uO$<WQdO7+(SO8vQdO'#C}O8vQdO,59bO8vQdO,59bO8vQdO,59bO$<fQtO,5=`O8vQdO1G.|O0rQdO1G/XO0rQdO7+$pP$<yQdO'#GOO'vQdO'#GtO$=WQdO,59bO$=]QdO,59bO$=dQdO,59mO$=iQdO1G/UO1sQdO'#DRO8vQdO,59j",stateData:"$>S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!<S!<VP!<_!<h!=d!=g]eOn#g$j)t,P'}`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r{!cQ#c#p$R$d$p%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g}!dQ#c#p$R$d$p$u%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!P!eQ#c#p$R$d$p$u$v%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!R!fQ#c#p$R$d$p$u$v$w%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!T!gQ#c#p$R$d$p$u$v$w$x%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!V!hQ#c#p$R$d$p$u$v$w$x$y%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g!Z!hQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0g'}TOTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0r&eVOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0r%oXOYZ[dnrxy}!P!Q!U!i!k#[#d#g#y#{#}$Q$h$j$}%S%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#vqQ/[.kR0o0q't`OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rh#jhz{$W$Z&l&q)S)X+f+g-RW#rq&].k0qQ$]|Q$a!OQ$n!VQ$o!WW$|!i'm*d,gS&[#s#tQ'S$iQ(s&UQ)U&nU)Y&s)Z+jW)a&w+m-T-{Q*Q']W*R'_,`-h.TQ+l)`S,_*S*TQ-Q+eQ-_,TQ-c,WQ.R-al.W-l.^._.a.z.|/R/j/o/t/y0U0Z0^Q/S.`Q/a.tQ/l/OU0P/u0S0[X0V/z0W0_0`R&Z#r!_!wYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZR%^!vQ!{YQ%x#[Q&d#}Q&g$QR,{+YT.j-s/s!Y!jQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gQ&X#kQ'c$oR*^'dR'l$|Q%V!mR/_.r'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rS#a_#b!P.[-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`'|_OTYZ[adnoprtxy}!P!Q!R!U!X!c!d!e!f!g!h!i!k!o!p!q!s!t!z#O#S#T#[#d#g#x#y#{#}$Q$e$g$h$j$q$}%S%Z%^%`%c%g%l%n%w%|&O&Z&_&h&j&k&u&x&|'P'W'Z'l'm'p'r's'w'|(O(S(W(](^(d(g(p(r(z(})^)e)g)k)l)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+Q+U+V+Y+a+c+d+k+x+y,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0l0n0rT#a_#bT#^^#_R(o%xa(l%x(n(o+`,{-y-z.oT+[(k+]R-z,{Q$PsQ+l)aQ,^*RR-e,_X#}s$O$P&fQ&y$aQ'a$nQ'd$oR)s'SQ)b&wV-S+m-T-{ZgOn$j)t,PXkOn)t,PQ$k!TQ&z$bQ&{$cQ'^$mQ'b$oQ)q'RQ)x'WQ){'XQ)|'YQ*Z'`S*]'c'dQ+s)gQ+u)hQ+v)iQ+z)oS+|)r*[Q,Q)vQ,R)wS,S)y)zQ,d*^Q-V+rQ-W+tQ-Y+{S-Z+},OQ-`,UQ-b,VQ-|-XQ.O-[Q.P-^Q.Q-_Q.p-}Q.q.RQ/W.dR/r/XWkOn)t,PR#mjQ'`$nS)r'S'aR,O)sQ,]*RR-f,^Q*['`Q+})rR-[,OZiOjn)t,PQ'f$pR*`'gT-j,e-ku.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^t.c-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^Q/S.`X0V/z0W0_0`!P.Z-l.^._.`.a.t.z.|/R/j/o/t/u/y/z0S0U0W0Z0[0^0_0`Q.w.YR/f.xg.z.].{/b/i/n/|0O0Q0]0a0bu.b-l.^._.a.t.z.|/R/j/o/t/u/y0S0U0Z0[0^X.u.W.b/a0PR/c.tV0R/u0S0[R/X.dQnOS#on,PR,P)tQ&^#uR(x&^S%m#R#wS(_%m(bT(b%p&`Q%a!yQ%h!}W(P%a%h(U(YQ(U%eR(Y%jQ&i$RR)O&iQ(e%qQ*{(`T+R(e*{Q'n%OR*e'nS'q%R%SY*i'q*j,m-q.hU*j'r's'tU,m*k*l*mS-q,n,oR.h-rQ#Y]R%t#YQ#_^R%y#_Q(h%vS+W(h+XR+X(iQ+](kR,|+]Q#b_R%{#bQ#ebQ%}#cW&Q#e%}({+bQ({&cR+b0gQ$OsS&e$O&fR&f$PQ&v$_R)_&vQ&V#jR(t&VQ&m$VS)T&m+hR+h)UQ$Z{R&p$ZQ&t$]R)[&tQ+n)bR-U+nQ#hfR&S#hQ)f&zR+q)fQ&}$dS)m&})nR)n'OQ'V$kR)u'VQ'[$lS*P'[,ZR,Z*QQ,a*VR-i,aWjOn)t,PR#ljQ-k,eR.U-kd.{.]/b/i/n/|0O0Q0]0a0bR/h.{U.s.W/a0PR/`.sQ/{/nS0X/{0YR0Y/|S/v/b/cR0T/vQ.}.]R/k.}R!ZPXmOn)t,PWlOn)t,PR'T$jYfOn$j)t,PR&R#g[sOn#g$j)t,PR&d#}&dQOYZ[dnprxy}!P!Q!U!i!k!o!p!q!s!t#[#d#g#y#{#}$Q$h$j$}%S%Z%^%`%g%l%n%w%|&Z&_&j&k&u&x'P'W'Z'l'm'p'r's'w(O(W(^(d(g(p(r(z)^)e)g)p)t)z*O*Y*d*g*h*k*q*r*t*v*y*z*}+U+V+Y+a+d+k,P,X,Y,],g,h,i,k,l,o,q,s,u,w,y,z-O-d-f-m-p-s.f.g/V/Z/s0c0d0e0f0h0i0j0k0n0rQ!nTQ#caQ#poU$Rt%c(SS$d!R$gQ$p!XQ$u!cQ$v!dQ$w!eQ$x!fQ$y!gQ$z!hQ%e!zQ%j#OQ%p#SQ%q#TQ&`#xQ'O$eQ'g$qQ(q&OU(|&h(}+cW)j&|)l+x+yQ*o'|Q*x(]Q+w)kQ,v+QR0g0lQ!yYQ!}ZQ$b!PQ$c!QQ%R!kQ't%S^'{%`%g(O(W*q*t*v^*f'p*h,k,l-p.g/ZQ*l'rQ*m'sQ+t)gQ,j*gQ,n*kQ-n,hQ-o,iQ-r,oQ.e-mR/Y.f[bOn#g$j)t,P!^!vYZ!P!Q!k%S%`%g'p'r's(O(W)g*g*h*k*q*t*v,h,i,k,l,o-m-p.f.g/ZQ#R[Q#fdS#wrxQ$UyW$_}$Q'P)pS$l!U$hW${!i'm*d,gS%v#[+Y`&P#d%|(p(r(z+a-O0kQ&a#yQ&b#{Q&c#}Q'j$}Q'z%^W([%l(^*y*}Q(`%nQ(i%wQ(v&ZS(y&_0iQ)P&jQ)Q&kU)]&u)^+kQ)d&xQ)y'WY)}'Z*O,X,Y-dQ*b'lS*n'w0jW+P(d*z,s,wW+T(g+V,y,zQ+p)eQ,U)zQ,c*YQ,x+UQ-P+dQ-e,]Q-v,uQ.S-fR/q/VhUOn#d#g$j%|&_'w(p(r)t,P%U!uYZ[drxy}!P!Q!U!i!k#[#y#{#}$Q$h$}%S%^%`%g%l%n%w&Z&j&k&u&x'P'W'Z'l'm'p'r's(O(W(^(d(g(z)^)e)g)p)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/V/Z0i0j0kQ#qpW%W!o!s0d0nQ%X!pQ%Y!qQ%[!tQ%f0cS'v%Z0hQ'x0eQ'y0fQ,p*rQ-u,qS.i-s/sR0p0rU#uq.k0qR(w&][cOn#g$j)t,PZ!xY#[#}$Q+YQ#W[Q#zrR$TxQ%b!yQ%i!}Q%o#RQ'j${Q(V%eQ(Z%jQ(c%pQ(f%qQ*|(`Q,f*bQ-t,pQ.m-uR/].lQ$StQ(R%cR*s(SQ.l-sR/}/sR#QZR#V[R%Q!iQ%O!iV*c'm*d,g!Z!lQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v0gR%T!kT#]^#_Q%x#[R,{+YQ(m%xS+_(n(oQ,}+`Q-x,{S.n-y-zR/^.oT+Z(k+]Q$`}Q&g$QQ)o'PR+{)pQ$XzQ)W&qR+i)XQ$XzQ&o$WQ)W&qR+i)XQ#khW$Vz$W&q)XQ$[{Q&r$ZZ)R&l)S+f+g-RR$^|R)c&wXlOn)t,PQ$f!RR'Q$gQ$m!UR'R$hR*X'_Q*V'_V-g,`-h.TQ.d-lQ/P.^R/Q._U.]-l.^._Q/U.aQ/b.tQ/g.zU/i.|/j/yQ/n/RQ/|/oQ0O/tU0Q/u0S0[Q0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:
3"â print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:uv,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[fv],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%T[]%o]p%Tpq%oqr'ars)Yst*xtu%Tuv,dvw-hwx.Uxy/tyz0[z{0r{|2S|}2p}!O3W!O!P4_!P!Q:Z!Q!R;k!R![>_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>
3fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[hv,tv,ev,dv,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>gv[e]||-1}],tokenPrec:7668}),Tv=new Ff,_v=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Ev(e){return(t,i,n)=>{if(n)return!1;let o=t.node.getChild("VariableName");return o&&i(o,e),!0}}var bv={FunctionDefinition:Ev("function"),ClassDefinition:Ev("class"),ForStatement(e,t,i){if(i)for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if("in"==n.name)break},ImportStatement(e,t){let{node:i}=e,n="from"==i.firstChild?.name;for(let o=i.getChild("import");o;o=o.nextSibling)"VariableName"==o.name&&"as"!=o.nextSibling?.name&&t(o,n?"variable":"namespace")},AssignStatement(e,t){for(let i=e.node.firstChild;i;i=i.nextSibling)if("VariableName"==i.name)t(i,"variable");else if(":"==i.name||"AssignOp"==i.name)break},ParamList(e,t){for(let i=null,n=e.node.firstChild;n;n=n.nextSibling)"VariableName"==n.name&&(!i||!/\*|AssignOp/.test(i.name))&&t(n,"variable"),i=n},CapturePattern:Ev("variable"),AsPattern:Ev("variable"),__proto__:null};function Ov(e,t){let i=Tv.get(t);if(i)return i;let n=[],o=!0;function r(t,i){let o=e.sliceString(t.from,t.to);n.push({label:o,type:i})}
3return t.cursor(mf.IncludeAnonymous).iterate(t=>{if(t.name){let e=bv[t.name];if(e&&e(t,r,o)||!o&&_v.has(t.name))return!1;o=!1}else if(t.to-t.from>8192){for(let i of Ov(e,t.node))n.push(i);return!1}}),Tv.set(t,n),n}var vv=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Iv=["String","FormatString","Comment","PropertyName"];function Sv(e){let t=_g(e.state).resolveInner(e.pos,-1);if(Iv.indexOf(t.name)>-1)return null;let i="VariableName"==t.name||t.to-t.from<20&&vv.test(e.state.sliceDoc(t.from,t.to));if(!i&&!e.explicit)return null;let n=[];for(let o=t;o;o=o.parent)_v.has(o.name)&&(n=n.concat(Ov(e.state.doc,o)));return{options:n,from:i?t.from:e.pos,validFor:vv}}var yv=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat("ArithmeticError.AssertionError.AttributeError.BaseException.BlockingIOError.BrokenPipeError.BufferError.BytesWarning.ChildProcessError.ConnectionAbortedError.ConnectionError.ConnectionRefusedError.ConnectionResetError.DeprecationWarning.EOFError.Ellipsis.EncodingWarning.EnvironmentError.Exception.FileExistsError.FileNotFoundError.FloatingPointError.FutureWarning.GeneratorExit.IOError.ImportError.ImportWarning.IndentationError.IndexError.InterruptedError.IsADirectoryError.KeyError.KeyboardInterrupt.LookupError.MemoryError.ModuleNotFoundError.NameError.NotADirectoryError.NotImplemented.NotImplementedError.OSError.OverflowError.PendingDeprecationWarning.PermissionError.ProcessLookupError.RecursionError.ReferenceError.ResourceWarning.RuntimeError.RuntimeWarning.StopAsyncIteration.StopIteration.SyntaxError.SyntaxWarning.SystemError.SystemExit.TabError.TimeoutError.TypeError.UnboundLocalError.UnicodeDecodeError.UnicodeEncodeError.UnicodeError.UnicodeTranslateError.UnicodeWarning.UserWarning.ValueError.Warning.ZeroDivisionError".split(".").map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat("abs.aiter.all.anext.any.ascii.bin.breakpoint.callable.chr.compile.delattr.dict.dir.divmod.enumerate.eval.exec.exit.filter.format.getattr.globals.hasattr.hash.help.hex.id.input.isinstance.issubclass.iter.len.license.locals.max.min.next.oct.open.ord.pow.print.property.quit.repr.reversed.round.setattr.slice.sorted.sum.vars.zip".split(".").map(e=>({label:e,type:"function"}))),Rv=[Eb("def ${name}(${params}):\n\t${}",{label:"def",detail:"function",type:"keyword"}),Eb("for ${name} in ${collection}:\n\t${}",{label:"for",detail:"loop",type:"keyword"}),Eb("while ${}:\n\t${}",{label:"while",detail:"loop",type:"keyword"}),Eb("try:\n\t${}\nexcept ${error}:\n\t${}",{label:"try",detail:"/ except block",type:"keyword"}),Eb("if ${}:\n\t\n",{label:"if",detail:"block",type:"keyword"}),Eb("if ${}:\n\t${}\nelse:\n\t${}",{label:"if",detail:"/ else block",type:"keyword"}),Eb("class ${name}:\n\tdef __init__(self, ${params}):\n\t\t\t${}",{label:"class",detail:"definition",type:"keyword"}),Eb("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Eb("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Cv=_E(Iv,TE(yv.concat(Rv)));function kv(e){let{node:t,pos:i}=e,n=e.lineIndent(i,-1),o=null;for(;;){let r=t.childBefore(i);if(!r)break;if("Comment"==r.name)i=r.from;else if("Body"==r.name||"MatchBody"==r.name)e.baseIndentFor(r)+e.unit<=n&&(o=r),t=r;else if("MatchClause"==r.name)t=r;else{if(!r.type.is("Statement"))break;t=r}}return o}function Av(e,t){let i=e.baseIndentFor(t),n=e.lineAt(e.pos,-1),o=n.from+n.text.length;return/^\s*($|#)/.test(n.text)&&e.node.to<o+100&&!/\S/.test(e.state.sliceDoc(o,e.node.to))&&e.lineIndent(e.pos,-1)<=i||/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(e.textAfter)&&e.lineIndent(e.pos,-1)>i?null:i+e.unit}var Lv=class e extends mg{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(t){let i=function(e){return Ws.define({combine:e?t=>t.concat(e):void 0})}(t.languageData);return new e(i,t.parser.configure({props:[fg.add(e=>e.isTop?i:void 0)]}),t.name)}
3configure(t,i){return new e(this.data,this.parser.configure(t),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}.define({name:"python",parser:mv.configure({props:[xg.add({Body:e=>Av(e,/^\s*(#|$)/.test(e.textAfter)&&kv(e)||e.node)??e.continue(),MatchBody:e=>Av(e,kv(e)||e.node)??e.continue(),IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Hg({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Hg({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Hg({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{let t=kv(e);return(t&&Av(e,t))??e.continue()}}),Wg.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":function(e){let t=e.firstChild,i=e.lastChild;return t&&t.to<i.from?{from:t.to,to:i.type.isError?e.to:i.from}:null},Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});var Nv={messages:{ADD_COMMENT:"Add Comment",ALT_KEY:"Alt",CANNOT_DELETE_VARIABLE_PROCEDURE:"Can't delete the variable '%1' because it's part of the definition of the function '%2'",CHANGE_VALUE_TITLE:"Change value:",CHROME_OS:"ChromeOS",CLEAN_UP:"Clean up Blocks",CLOSE:"Close",COLLAPSED_WARNINGS_WARNING:"Collapsed blocks contain warnings.",COLLAPSE_ALL:"Collapse Blocks",COLLAPSE_BLOCK:"Collapse Block",COLOUR_BLEND_COLOUR1:"colour 1",COLOUR_BLEND_COLOUR2:"colour 2",COLOUR_BLEND_HELPURL:"https://meyerweb.com/eric/tools/color-blend/#:::rgbp",COLOUR_BLEND_RATIO:"ratio",COLOUR_BLEND_TITLE:"blend",COLOUR_BLEND_TOOLTIP:"Blends two colours together with a given ratio (0.0 - 1.0).",COLOUR_PICKER_HELPURL:"https://en.wikipedia.org/wiki/Color",COLOUR_PICKER_TOOLTIP:"Choose a colour from the palette.",COLOUR_RANDOM_HELPURL:"http://randomcolour.com",COLOUR_RANDOM_TITLE:"random colour",COLOUR_RANDOM_TOOLTIP:"Choose a colour at random.",COLOUR_RGB_BLUE:"blue",COLOUR_RGB_GREEN:"green",COLOUR_RGB_HELPURL:"https://www.december.com/html/spec/colorpercompact.html",COLOUR_RGB_RED:"red",COLOUR_RGB_TITLE:"colour with",COLOUR_RGB_TOOLTIP:"Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.",COMMAND_KEY:"â Command",CONTROLS_FLOW_STATEMENTS_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#loop-termination-blocks",CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK:"break out of loop",CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE:"continue with next iteration of loop",CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK:"Break out of the containing loop.",CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE:"Skip the rest of this loop, and continue with the next iteration.",CONTROLS_FLOW_STATEMENTS_WARNING:"Warning: This block may only be used within a loop.",CONTROLS_FOREACH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#for-each",CONTROLS_FOREACH_TITLE:"for each item %1 in list %2",CONTROLS_FOREACH_TOOLTIP:"For each item in a list, set the variable '%1' to the item, and then do some statements.",CONTROLS_FOR_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#count-with",CONTROLS_FOR_TITLE:"count with %1 from %2 to %3 by %4",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.",CONTROLS_IF_ELSEIF_TOOLTIP:"Add a condition to the if block.",CONTROLS_IF_ELSE_TOOLTIP:"Add a final, catch-all condition to the if block.",CONTROLS_IF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/
3IfElse",CONTROLS_IF_IF_TOOLTIP:"Add, remove, or reorder sections to reconfigure this if block.",CONTROLS_IF_MSG_ELSE:"else",CONTROLS_IF_MSG_ELSEIF:"else if",CONTROLS_IF_MSG_IF:"if",CONTROLS_IF_TOOLTIP_1:"If a value is true, then do some statements.",CONTROLS_IF_TOOLTIP_2:"If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",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.",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.",CONTROLS_REPEAT_HELPURL:"https://en.wikipedia.org/wiki/For_loop",CONTROLS_REPEAT_INPUT_DO:"do",CONTROLS_REPEAT_TITLE:"repeat %1 times",CONTROLS_REPEAT_TOOLTIP:"Do some statements several times.",CONTROLS_WHILEUNTIL_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#repeat",CONTROLS_WHILEUNTIL_OPERATOR_UNTIL:"repeat until",CONTROLS_WHILEUNTIL_OPERATOR_WHILE:"repeat while",CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL:"While a value is false, then do some statements.",CONTROLS_WHILEUNTIL_TOOLTIP_WHILE:"While a value is true, then do some statements.",CONTROL_KEY:"Ctrl",COPY_SHORTCUT:"Copy",CUT_SHORTCUT:"Cut",DELETE_ALL_BLOCKS:"Delete all %1 blocks?",DELETE_BLOCK:"Delete Block",DELETE_VARIABLE:"Delete the '%1' variable",DELETE_VARIABLE_CONFIRMATION:"Delete %1 uses of the '%2' variable?",DELETE_X_BLOCKS:"Delete %1 Blocks",DIALOG_CANCEL:"Cancel",DIALOG_OK:"OK",DISABLE_BLOCK:"Disable Block",DUPLICATE_BLOCK:"Duplicate",DUPLICATE_COMMENT:"Duplicate Comment",EDIT_BLOCK_CONTENTS:"Edit Block contents",ENABLE_BLOCK:"Enable Block",EXPAND_ALL:"Expand Blocks",EXPAND_BLOCK:"Expand Block",EXTERNAL_INPUTS:"External Inputs",HELP:"Help",HELP_PROMPT:"Press %1 for help on keyboard controls",INLINE_INPUTS:"Inline Inputs",LINUX:"Linux",LISTS_CREATE_EMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-empty-list",LISTS_CREATE_EMPTY_TITLE:"create empty list",LISTS_CREATE_EMPTY_TOOLTIP:"Returns a list, of length 0, containing no data records",LISTS_CREATE_WITH_CONTAINER_TITLE_ADD:"list",LISTS_CREATE_WITH_CONTAINER_TOOLTIP:"Add, remove, or reorder sections to reconfigure this list block.",LISTS_CREATE_WITH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_CREATE_WITH_INPUT_WITH:"create list with",LISTS_CREATE_WITH_ITEM_TOOLTIP:"Add an item to the list.",LISTS_CREATE_WITH_TOOLTIP:"Create a list with any number of items.",LISTS_GET_INDEX_FIRST:"first",LISTS_GET_INDEX_FROM_END:"# from end",LISTS_GET_INDEX_FROM_START:"#",LISTS_GET_INDEX_GET:"get",LISTS_GET_INDEX_GET_REMOVE:"get and remove",LISTS_GET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-items-from-a-list",LISTS_GET_INDEX_LAST:"last",LISTS_GET_INDEX_RANDOM:"random",LISTS_GET_INDEX_REMOVE:"remove",LISTS_GET_INDEX_TAIL:"",LISTS_GET_INDEX_TOOLTIP_GET_FIRST:"Returns the first item in a list.",LISTS_GET_INDEX_TOOLTIP_GET_FROM:"Returns the item at the specified position in a list.",LISTS_GET_INDEX_TOOLTIP_GET_LAST:"Returns the last item in a list.",LISTS_GET_INDEX_TOOLTIP_GET_RANDOM:"Returns a random item in a list.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST:"Removes and returns the first item in a list.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM:"Removes and returns the item at the specified position in a list.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST:"Removes and returns the last item in a list.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM:"Removes and returns a random item in a list.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST:"Removes the first item in a list.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM:"Removes the item at the specified position in a list.",LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST:"Removes the last item in a list.",LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM:"Removes a random item in a list.",LISTS_GET_SUBLIST_END_FROM_END:"to # from end",LISTS_GET_SUBLIST_END_FROM_START:"to #",LISTS_GET_SUBLIST_END_LAST:"to last",LISTS_GET_SUBLIST_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-a-sublist",LISTS_GET_SUBLIST_START_FIRST:"get sub-list from first",LISTS_GET_SUBLIST_START_FROM_END:"get sub-list from # from end",LISTS_GET_SUBLIST_START_FROM_START:"get sub-list from #",LISTS_GET_SUBLIST_TAIL:"",LISTS_GET_SUBLIST_TOOLTIP:"Creates a copy of the specified portion of a list.",LISTS_INDEX_FROM_END_TOOLTIP:"%1 is the last item.",LISTS_INDEX_FROM_START_TOOLTIP:"%1 is the first item.",LISTS_INDEX_OF_FIRST:"find first occurrence of item",LISTS_INDEX_OF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#finding-items-in-a-list",LISTS_INDEX_OF_LAST:"find last occurrence of item",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.",LISTS_INLIST:"in list",LISTS_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#is-empty",LISTS_ISEMPTY_TITLE:"%1 is empty",LISTS_ISEMPTY_TOOLTIP:"Returns true if the list is empty.",LISTS_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#length-of",LISTS_LENGTH_TITLE:"length of %1",LISTS_LENGTH_TOOLTIP:"Returns the length of a list.",LISTS_REPEAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_REPEAT_TITLE:"create list with item %1 repeated %2 times",LISTS_REPEAT_TOOLTIP:"Creates a list consisting of the given value repeated the specified number of times.",LISTS_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#reversing-a-list",LISTS_REVERSE_MESSAGE0:"reverse %1",LISTS_REVERSE_TOOLTIP:"Reverse a copy of a list.",LISTS_SET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#in-list--set",LISTS_SET_INDEX_INPUT_TO:"as",LISTS_SET_INDEX_INSERT:"insert at",LISTS_SET_INDEX_SET:"set",LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST:"Inserts the item at the start of a list.",LISTS_SET_INDEX_TOOLTIP_INSERT_FROM:"Inserts the item at the specified position in a list.",LISTS_SET_INDEX_TOOLTIP_INSERT_LAST:"Append the item to the end of a list.",LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM:"Inserts the item randomly in a list.",LISTS_SET_INDEX_TOOLTIP_SET_FIRST:"Sets the first item in a list.",LISTS_SET_INDEX_TOOLTIP_SET_FROM:"Sets the item at the specified position in a list.",LISTS_SET_INDEX_TOOLTIP_SET_LAST:"Sets the last item in a list.",LISTS_SET_INDEX_TOOLTIP_SET_RANDOM:"Sets a random item in a list.",LISTS_SORT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#sorting-a-l
3ist",LISTS_SORT_ORDER_ASCENDING:"ascending",LISTS_SORT_ORDER_DESCENDING:"descending",LISTS_SORT_TITLE:"sort %1 %2 %3",LISTS_SORT_TOOLTIP:"Sort a copy of a list.",LISTS_SORT_TYPE_IGNORECASE:"alphabetic, ignore case",LISTS_SORT_TYPE_NUMERIC:"numeric",LISTS_SORT_TYPE_TEXT:"alphabetic",LISTS_SPLIT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#splitting-strings-and-joining-lists",LISTS_SPLIT_LIST_FROM_TEXT:"make list from text",LISTS_SPLIT_TEXT_FROM_LIST:"make text from list",LISTS_SPLIT_TOOLTIP_JOIN:"Join a list of texts into one text, separated by a delimiter.",LISTS_SPLIT_TOOLTIP_SPLIT:"Split text into a list of texts, breaking at each delimiter.",LISTS_SPLIT_WITH_DELIMITER:"with delimiter",LOGIC_BOOLEAN_FALSE:"false",LOGIC_BOOLEAN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#values",LOGIC_BOOLEAN_TOOLTIP:"Returns either true or false.",LOGIC_BOOLEAN_TRUE:"true",LOGIC_COMPARE_HELPURL:"https://en.wikipedia.org/wiki/Inequality_(mathematics)",LOGIC_COMPARE_TOOLTIP_EQ:"Return true if both inputs equal each other.",LOGIC_COMPARE_TOOLTIP_GT:"Return true if the first input is greater than the second input.",LOGIC_COMPARE_TOOLTIP_GTE:"Return true if the first input is greater than or equal to the second input.",LOGIC_COMPARE_TOOLTIP_LT:"Return true if the first input is smaller than the second input.",LOGIC_COMPARE_TOOLTIP_LTE:"Return true if the first input is smaller than or equal to the second input.",LOGIC_COMPARE_TOOLTIP_NEQ:"Return true if both inputs are not equal to each other.",LOGIC_NEGATE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#not",LOGIC_NEGATE_TITLE:"not %1",LOGIC_NEGATE_TOOLTIP:"Returns true if the input is false. Returns false if the input is true.",LOGIC_NULL:"null",LOGIC_NULL_HELPURL:"https://en.wikipedia.org/wiki/Nullable_type",LOGIC_NULL_TOOLTIP:"Returns null.",LOGIC_OPERATION_AND:"and",LOGIC_OPERATION_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#logical-operations",LOGIC_OPERATION_OR:"or",LOGIC_OPERATION_TOOLTIP_AND:"Return true if both inputs are true.",LOGIC_OPERATION_TOOLTIP_OR:"Return true if at least one of the inputs is true.",LOGIC_TERNARY_CONDITION:"test",LOGIC_TERNARY_HELPURL:"https://en.wikipedia.org/wiki/%3F:",LOGIC_TERNARY_IF_FALSE:"if false",LOGIC_TERNARY_IF_TRUE:"if true",LOGIC_TERNARY_TOOLTIP:"Check the condition in 'test'. If the condition is true, returns the 'if true' value; otherwise returns the 'if false' value.",MAC_OS:"macOS",MATH_ADDITION_SYMBOL:"+",MATH_ARITHMETIC_HELPURL:"https://en.wikipedia.org/wiki/Arithmetic",MATH_ARITHMETIC_TOOLTIP_ADD:"Return the sum of the two numbers.",MATH_ARITHMETIC_TOOLTIP_DIVIDE:"Return the quotient of the two numbers.",MATH_ARITHMETIC_TOOLTIP_MINUS:"Return the difference of the two numbers.",MATH_ARITHMETIC_TOOLTIP_MULTIPLY:"Return the product of the two numbers.",MATH_ARITHMETIC_TOOLTIP_POWER:"Return the first number raised to the power of the second number.",MATH_ATAN2_HELPURL:"https://en.wikipedia.org/wiki/Atan2",MATH_ATAN2_TITLE:"atan2 of X:%1 Y:%2",MATH_ATAN2_TOOLTIP:"Return the arctangent of point (X, Y) in degrees from -180 to 180.",MATH_CHANGE_HELPURL:"https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",MATH_CHANGE_TITLE:"change %1 by %2",MATH_CHANGE_TOOLTIP:"Add a number to variable '%1'.",MATH_CONSTANT_HELPURL:"https://en.wikipedia.org/wiki/Mathematical_constant",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).",MATH_CONSTRAIN_HELPURL:"https://en.wikipedia.org/wiki/Clamping_(graphics)",MATH_CONSTRAIN_TITLE:"constrain %1 low %2 high %3",MATH_CONSTRAIN_TOOLTIP:"Constrain a number to be between the specified limits (inclusive).",MATH_DIVISION_SYMBOL:"÷",MATH_IS_DIVISIBLE_BY:"is divisible by",MATH_IS_EVEN:"is even",MATH_IS_NEGATIVE:"is negative",MATH_IS_ODD:"is odd",MATH_IS_POSITIVE:"is positive",MATH_IS_PRIME:"is prime",MATH_IS_TOOLTIP:"Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain
3number. Returns true or false.",MATH_IS_WHOLE:"is whole",MATH_MODULO_HELPURL:"https://en.wikipedia.org/wiki/Modulo_operation",MATH_MODULO_TITLE:"remainder of %1 ÷ %2",MATH_MODULO_TOOLTIP:"Return the remainder from dividing the two numbers.",MATH_MULTIPLICATION_SYMBOL:"Ã",MATH_NUMBER_HELPURL:"https://en.wikipedia.org/wiki/Number",MATH_NUMBER_TOOLTIP:"A number.",MATH_ONLIST_HELPURL:"",MATH_ONLIST_OPERATOR_AVERAGE:"average of list",MATH_ONLIST_OPERATOR_MAX:"max of list",MATH_ONLIST_OPERATOR_MEDIAN:"median of list",MATH_ONLIST_OPERATOR_MIN:"min of list",MATH_ONLIST_OPERATOR_MODE:"modes of list",MATH_ONLIST_OPERATOR_RANDOM:"random item of list",MATH_ONLIST_OPERATOR_STD_DEV:"standard deviation of list",MATH_ONLIST_OPERATOR_SUM:"sum of list",MATH_ONLIST_TOOLTIP_AVERAGE:"Return the average (arithmetic mean) of the numeric values in the list.",MATH_ONLIST_TOOLTIP_MAX:"Return the largest number in the list.",MATH_ONLIST_TOOLTIP_MEDIAN:"Return the median number in the list.",MATH_ONLIST_TOOLTIP_MIN:"Return the smallest number in the list.",MATH_ONLIST_TOOLTIP_MODE:"Return a list of the most common item(s) in the list.",MATH_ONLIST_TOOLTIP_RANDOM:"Return a random element from the list.",MATH_ONLIST_TOOLTIP_STD_DEV:"Return the standard deviation of the list.",MATH_ONLIST_TOOLTIP_SUM:"Return the sum of all the numbers in the list.",MATH_POWER_SYMBOL:"^",MATH_RANDOM_FLOAT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_FLOAT_TITLE_RANDOM:"random fraction",MATH_RANDOM_FLOAT_TOOLTIP:"Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",MATH_RANDOM_INT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_INT_TITLE:"random integer from %1 to %2",MATH_RANDOM_INT_TOOLTIP:"Return a random integer between the two specified limits, inclusive.",MATH_ROUND_HELPURL:"https://en.wikipedia.org/wiki/Rounding",MATH_ROUND_OPERATOR_ROUND:"round",MATH_ROUND_OPERATOR_ROUNDDOWN:"round down",MATH_ROUND_OPERATOR_ROUNDUP:"round up",MATH_ROUND_TOOLTIP:"Round a number up or down.",MATH_SINGLE_HELPURL:"https://en.wikipedia.org/wiki/Square_root",MATH_SINGLE_OP_ABSOLUTE:"absolute",MATH_SINGLE_OP_ROOT:"square root",MATH_SINGLE_TOOLTIP_ABS:"Return the absolute value of a number.",MATH_SINGLE_TOOLTIP_EXP:"Return e to the power of a number.",MATH_SINGLE_TOOLTIP_LN:"Return the natural logarithm of a number.",MATH_SINGLE_TOOLTIP_LOG10:"Return the base 10 logarithm of a number.",MATH_SINGLE_TOOLTIP_NEG:"Return the negation of a number.",MATH_SINGLE_TOOLTIP_POW10:"Return 10 to the power of a number.",MATH_SINGLE_TOOLTIP_ROOT:"Return the square root of a number.",MATH_SUBTRACTION_SYMBOL:"-",MATH_TRIG_ACOS:"acos",MATH_TRIG_ASIN:"asin",MATH_TRIG_ATAN:"atan",MATH_TRIG_COS:"cos",MATH_TRIG_HELPURL:"https://en.wikipedia.org/wiki/Trigonometric_functions",MATH_TRIG_SIN:"sin",MATH_TRIG_TAN:"tan",MATH_TRIG_TOOLTIP_ACOS:"Return the arccosine of a number.",MATH_TRIG_TOOLTIP_ASIN:"Return the arcsine of a number.",MATH_TRIG_TOOLTIP_ATAN:"Return the arctangent of a number.",MATH_TRIG_TOOLTIP_COS:"Return the cosine of a degree (not radian).",MATH_TRIG_TOOLTIP_SIN:"Return the sine of a degree (not radian).",MATH_TRIG_TOOLTIP_TAN:"Return the tangent of a degree (not radian).",MOVE_BLOCK:"Move Block",NEW_COLOUR_VARIABLE:"Create colour variable...",NEW_NUMBER_VARIABLE:"Create number variable...",NEW_STRING_VARIABLE:"Create string variable...",NEW_VARIABLE:"Create variable...",NEW_VARIABLE_TITLE:"New variable name:",NEW_VARIABLE_TYPE_TITLE:"New variable type:",OPTION_KEY:"⥠Option",ORDINAL_NUMBER_SUFFIX:"",PASTE_SHORTCUT:"Paste",PROCEDURES_ALLOW_STATEMENTS:"allow statements",PROCEDURES_BEFORE_PARAMS:"with:",PROCEDURES_CALLNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLNORETURN_TOOLTIP:"Run the user-defined function '%1'.",PROCEDURES_CALLRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLRETURN_TOOLTIP:"Run the user-defined function '%1' and use its output.",PROCEDURES_CALL_BEFORE_PARAMS:"with:",PROCEDURES_CALL_DISABLED_DEF_WARNING:"Can't run the user-defined function '%1' because the definition block is disabled.",PROCEDURES_CREATE_DO:"Create '%1'",PROCEDURES_DEFNORETURN_COMMENT:"Describe this function...",PROCEDURES_DEFNORETURN_DO:"",PROCEDURES_DEFNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFNORETURN_PROCEDURE:"do something",PROCEDURES_DEFNORETURN_TITLE:"to",PROCEDURES_DEFNORETURN_TOOLTIP:"Creates a function with no output.",PROCEDURES_DEFRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFRETURN_RETURN:"return",PROCEDURES_DEFRETURN_TOOLTIP:"Creates a function with an output.",PROCEDURES_DEF_DUPLICATE_WARNING:"Warning: This function has duplicate parameters.",PROCEDURES_HIGHLIGHT_DEF:"Highlight function definition",PROCEDURES_IFRETURN_HELPURL:"https://c2.com/cgi/wiki?GuardClause",PROCEDURES_IFRETURN_TOOLTIP:"If a value is true, then return a second value.",PROCEDURES_IFRETURN_WARNING:"Warning: This block may be used only within a function definition.",PROCEDURES_MUTATORARG_TITLE:"input name:",PROCEDURES_MUTATORARG_TOOLTIP:"Add an input to the function.",PROCEDURES_MUTATORCONTAINER_TIT
3LE:"inputs",PROCEDURES_MUTATORCONTAINER_TOOLTIP:"Add, remove, or reorder inputs to this function.",REDO:"Redo",REMOVE_COMMENT:"Remove Comment",RENAME_VARIABLE:"Rename variable...",RENAME_VARIABLE_TITLE:"Rename all '%1' variables to:",SHORTCUTS_CODE_NAVIGATION:"Code navigation",SHORTCUTS_EDITING:"Editing",SHORTCUTS_GENERAL:"General",TEXT_APPEND_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_APPEND_TITLE:"to %1 append text %2",TEXT_APPEND_TOOLTIP:"Append some text to variable '%1'.",TEXT_CHANGECASE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#adjusting-text-case",TEXT_CHANGECASE_OPERATOR_LOWERCASE:"to lower case",TEXT_CHANGECASE_OPERATOR_TITLECASE:"to Title Case",TEXT_CHANGECASE_OPERATOR_UPPERCASE:"to UPPER CASE",TEXT_CHANGECASE_TOOLTIP:"Return a copy of the text in a different case.",TEXT_CHARAT_FIRST:"get first letter",TEXT_CHARAT_FROM_END:"get letter # from end",TEXT_CHARAT_FROM_START:"get letter #",TEXT_CHARAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-text",TEXT_CHARAT_LAST:"get last letter",TEXT_CHARAT_RANDOM:"get random letter",TEXT_CHARAT_TAIL:"",TEXT_CHARAT_TITLE:"in text %1 %2",TEXT_CHARAT_TOOLTIP:"Returns the letter at the specified position.",TEXT_COUNT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#counting-substrings",TEXT_COUNT_MESSAGE0:"count %1 in %2",TEXT_COUNT_TOOLTIP:"Count how many times some text occurs within some other text.",TEXT_CREATE_JOIN_ITEM_TOOLTIP:"Add an item to the text.",TEXT_CREATE_JOIN_TITLE_JOIN:"join",TEXT_CREATE_JOIN_TOOLTIP:"Add, remove, or reorder sections to reconfigure this text block.",TEXT_GET_SUBSTRING_END_FROM_END:"to letter # from end",TEXT_GET_SUBSTRING_END_FROM_START:"to letter #",TEXT_GET_SUBSTRING_END_LAST:"to last letter",TEXT_GET_SUBSTRING_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-a-region-of-text",TEXT_GET_SUBSTRING_INPUT_IN_TEXT:"in text",TEXT_GET_SUBSTRING_START_FIRST:"get substring from first letter",TEXT_GET_SUBSTRING_START_FROM_END:"get substring from letter # from end",TEXT_GET_SUBSTRING_START_FROM_START:"get substring from letter #",TEXT_GET_SUBSTRING_TAIL:"",TEXT_GET_SUBSTRING_TOOLTIP:"Returns a specified portion of the text.",TEXT_INDEXOF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#finding-text",TEXT_INDEXOF_OPERATOR_FIRST:"find first occurrence of text",TEXT_INDEXOF_OPERATOR_LAST:"find last occurrence of text",TEXT_INDEXOF_TITLE:"in text %1 %2 %3",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.",TEXT_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#checking-for-empty-text",TEXT_ISEMPTY_TITLE:"%1 is empty",TEXT_ISEMPTY_TOOLTIP:"Returns true if the provided text is empty.",TEXT_JOIN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-creation",TEXT_JOIN_TITLE_CREATEWITH:"create text with",TEXT_JOIN_TOOLTIP:"Create a piece of text by joining together any number of items.",TEXT_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_LENGTH_TITLE:"length of %1",TEXT_LENGTH_TOOLTIP:"Returns the number of letters (including spaces) in the provided text.",TEXT_PRINT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#printing-text",TEXT_PRINT_TITLE:"print %1",TEXT_PRINT_TOOLTIP:"Print the specified text, number or other value.",TEXT_PROMPT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#getting-input-from-the-user",TEXT_PROMPT_TOOLTIP_NUMBER:"Prompt for user for a number.",TEXT_PROMPT_TOOLTIP_TEXT:"Prompt for user for some text.",TEXT_PROMPT_TYPE_NUMBER:"prompt for number with message",TEXT_PROMPT_TYPE_TEXT:"prompt for text with message",TEXT_REPLACE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#replacing-substrings",TEXT_REPLACE_MESSAGE0:"replace %1 with %2 in %3",TEXT_REPLACE_TOOLTIP:"Replace all occurances of some text within some other text.",TEXT_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#reversing-text",TEXT_REVERSE_MESSAGE0:"reverse %1",TEXT_REVERSE_TOOLTIP:"Reverses the order of the characters in the text.",TEXT_TEXT_HELPURL:"https://en.wikipedia.org/wiki/String_(computer_science)",TEXT_TEXT_TOOLTIP:"A letter, word, or line of text.",TEXT_TRIM_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#trimming-removing-spaces",TEXT_TRIM_OPERATOR_BOTH:"trim spaces from both
3sides of",TEXT_TRIM_OPERATOR_LEFT:"trim spaces from left side of",TEXT_TRIM_OPERATOR_RIGHT:"trim spaces from right side of",TEXT_TRIM_TOOLTIP:"Return a copy of the text with spaces removed from one or both ends.",TODAY:"Today",UNDO:"Undo",UNKNOWN:"Unknown",UNNAMED_KEY:"unnamed",VARIABLES_DEFAULT_NAME:"item",VARIABLES_GET_CREATE_SET:"Create 'set %1'",VARIABLES_GET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#get",VARIABLES_GET_TOOLTIP:"Returns the value of this variable.",VARIABLES_SET:"set %1 to %2",VARIABLES_SET_CREATE_GET:"Create 'get %1'",VARIABLES_SET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#set",VARIABLES_SET_TOOLTIP:"Sets this variable to be equal to the input.",VARIABLE_ALREADY_EXISTS:"A variable named '%1' already exists.",VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE:"A variable named '%1' already exists for another type: '%2'.",VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER:"A variable named '%1' already exists as a parameter in the procedure '%2'.",WINDOWS:"Windows",WORKSPACE_ARIA_LABEL:"Blockly Workspace",WORKSPACE_COMMENT_DEFAULT_TEXT:"Say something...",CONTROLS_FOREACH_INPUT_DO:"do",CONTROLS_FOR_INPUT_DO:"do",CONTROLS_IF_ELSEIF_TITLE_ELSEIF:"else if",CONTROLS_IF_ELSE_TITLE_ELSE:"else",CONTROLS_IF_IF_TITLE_IF:"if",CONTROLS_IF_MSG_THEN:"do",CONTROLS_WHILEUNTIL_INPUT_DO:"do",LISTS_CREATE_WITH_ITEM_TITLE:"item",LISTS_GET_INDEX_INPUT_IN_LIST:"in list",LISTS_GET_SUBLIST_INPUT_IN_LIST:"in list",LISTS_INDEX_OF_INPUT_IN_LIST:"in list",LISTS_SET_INDEX_INPUT_IN_LIST:"in list",MATH_CHANGE_TITLE_ITEM:"item",PROCEDURES_DEFRETURN_COMMENT:"Describe this function...",PROCEDURES_DEFRETURN_DO:"",PROCEDURES_DEFRETURN_PROCEDURE:"do something",PROCEDURES_DEFRETURN_TITLE:"to",TEXT_APPEND_VARIABLE:"item",TEXT_CREATE_JOIN_ITEM_TITLE_ITEM:"item",COLOUR_HUE:"20",LISTS_HUE:"260",LOGIC_HUE:"210",LOOPS_HUE:"120",MATH_HUE:"230",PROCEDURES_HUE:"290",TEXTS_HUE:"160",VARIABLES_DYNAMIC_HUE:"310",VARIABLES_HUE:"330",TURTLE_FORWARD:"forward %1 steps",TURTLE_BACKWARD:"backward %1 steps",TURTLE_MOVE:"move %1 by %2",TURTLE_DIR_FORWARD:"forward",TURTLE_DIR_BACKWARD:"backward",TURTLE_TURN:"turn %1 by %2",TURTLE_DIR_LEFT:"left",TURTLE_DIR_RIGHT:"right",TURTLE_LEFT:"turn left %1 degrees",TURTLE_RIGHT:"turn right %1 degrees",TURTLE_PEN_UP:"pen up",TURTLE_PEN_DOWN:"pen down",TURTLE_COLOR_DROPDOWN:"set color to %1",TURTLE_COLOR_INPUT:"set color to %1",TURTLE_COLOR_RED:"red",TURTLE_COLOR_BLUE:"blue",TURTLE_COLOR_GREEN:"green",TURTLE_COLOR_BLACK:"black",TURTLE_COLOR_ORANGE:"orange",TURTLE_COLOR_PURPLE:"purple",TURTLE_CIRCLE:"draw circle radius %1",TURTLE_GOTO:"go to x %1 y %2",TURTLE_HOME:"go home",TURTLE_CLEAR:"clear drawing",TURTLE_WIDTH:"pen width %1",TURTLE_BEGIN_FILL:"begin fill",TURTLE_END_FILL:"end fill",TURTLE_SPEED:"speed (0â10) %1"},toolbox:{turtle:"Turtle",logic:"Logic",loops:"Loops",math:"Math",text:"Text",color:"Color",variables:"Variables"},editor:{title:"Code editor",btnRun:"Run code",btnStop:"Cancel",btnReset:"Reset",btnDownload:"Download",btnBlocks:"Blocks",btnCode:"Code",btnLayoutSide:"Side by side",btnLayoutBelow:"Below",settingsTitle:"Settings",settingsLang:"Language",settingsTheme:"Theme",themeLight:"Light",themeDark:"Dark",loading:"Loading...",readonlyBanner:"Code generated from blocks â not editable",loadError:"Could not read block file",fileLoadError:"Error loading file",unsupportedLibraries:"Error: The following libraries are not supported",ariaModePicker:"Select mode",ariaLangPicker:"Select language",ariaThemePicker:"Select theme",keyboardNavTitle:"Keyboard navigation",keyboardNavActivate:"Activate",keyboardNavNavigate:"Navigate blocks",keyboardNavMove:"Start moving",keyboardNavConfirm:"Confirm position",keyboardNavCancel:"Cancel",resetConfirmTitle:"Reset",resetConfirmPrompt:"Reset to start",labelCanvas:"Canvas",labelConsole:"Console"}},wv={messages:{ADD_COMMENT:"Legg til kommentar",ALT_KEY:"Alt",CANNOT_DELETE_VARIABLE_PROCEDURE:"Kan ikke slette variabelen «%1» fordi den er del av definisjonen for funksjonen «%2»",CHANGE_VALUE_TITLE:"Bytt verdi:",CHROME_OS:"ChromeOS",CLEAN_UP:"Rydd opp Blocks",CLOSE:"Close",COLLAPSED_WARNINGS_WARNING:"SammenslÃ¥tte blokker inneholder advarsler.",COLLAPSE_ALL:"Skjul blokker",COLLAPSE_BLOCK:"Skjul blokk",COLOUR_BLEND_COLOUR1:"farge 1",COLOUR_BLEND_COLOUR2:"farge 2",COLOUR_BLEND_HELPURL:"https://meyerweb.com/eric/tools/color-blend/#:::rgbp",COLOUR_BLEND_RATIO:"forhold",COLOUR_BLEND_TITLE:"blande",COLOUR_BLEND_TOOLTIP:"Blander to farger sammen med et gitt forhold (0.0 - 1.0).",COLOUR_PICKER_HELPURL:"https://en.wikipedia.org/wiki/Color",COLOUR_PICKER_TOOLTIP:"Velg en farge fra paletten.",COLOUR_RANDOM_HELPURL:"http://randomcolour.com",COLOUR_RANDOM_TITLE:"tilfeldig farge",COLOUR_RANDOM_TOOLTIP:"Velg en tilfeldig farge.",COLOUR_RGB_BLUE:"blÃ¥",COLOUR_RGB_GREEN:"grønn",COLOUR_RGB_HELPURL:"https://www.december.com/html/spec/colorpercompact.html",COLOUR_RGB_RED:"rød",COLOUR_RGB_TITLE:"farge med",COLOUR_RGB_TOOLTIP:"Lag en farge med angitt verdi av rød, grønn og blÃ¥. Alle verdier mÃ¥ være mellom 0 og 100.",COMMAND_KEY:"â Command",CONTROLS_FLOW_STATEMENTS_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#loop-termination-blocks",CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK:"bryt ut av løkken",CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE:"fortsett med neste gjentakelse av løkken",CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK:"Bryt ut av den gjeldende løkken.",CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE:"Hopp over resten av denne løkken og fortsett med neste gjentakelse.",CONTROLS_FLOW_STATEMENTS_WARNING:"Advarsel: De
3nne blokken kan kun brukes innenfor en løkke.",CONTROLS_FOREACH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#for-each",CONTROLS_FOREACH_TITLE:"for hvert element %1 i listen %2",CONTROLS_FOREACH_TOOLTIP:"For hvert element i en liste, angi variabelen '%1' til elementet, og deretter lag noen setninger.",CONTROLS_FOR_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#count-with",CONTROLS_FOR_TITLE:"tell med %1 fra %2 til %3 med %4",CONTROLS_FOR_TOOLTIP:'Ha variabel "%1" ta verdiene fra start nummer til slutt nummer, telle med spesifisert intervall og lag de spesifiserte blokkene.',CONTROLS_IF_ELSEIF_TOOLTIP:"Legg til en betingelse til hvis blokken.",CONTROLS_IF_ELSE_TOOLTIP:"Legg til hva som skal skje hvis de andre ikke slår til.",CONTROLS_IF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/IfElse",CONTROLS_IF_IF_TOOLTIP:"Legg til, fjern eller flytt seksjoner i denne hvis-blokken.",CONTROLS_IF_MSG_ELSE:"ellers",CONTROLS_IF_MSG_ELSEIF:"ellers hvis",CONTROLS_IF_MSG_IF:"hvis",CONTROLS_IF_TOOLTIP_1:"Hvis dette er sant, så gjør følgende.",CONTROLS_IF_TOOLTIP_2:"Hvis dette er sant, så utfør den første blokken av instruksjoner. Hvis ikke, utfør den andre blokken.",CONTROLS_IF_TOOLTIP_3:"Hvis det første stemmer, så utfør den første blokken av instruksjoner. Ellers, hvis det andre stemmer, utfør den andre blokken av instruksjoner.",CONTROLS_IF_TOOLTIP_4:"Hvis den første verdien er sann, så utfør den første blokken med setninger. Ellers, hvis den andre verdien er sann, så utfør den andre blokken med setninger. Hvis ingen av verdiene er sanne, så utfør den siste blokken med setninger.",CONTROLS_REPEAT_HELPURL:"https://en.wikipedia.org/wiki/For_loop",CONTROLS_REPEAT_INPUT_DO:"gjør",CONTROLS_REPEAT_TITLE:"gjenta %1 ganger",CONTROLS_REPEAT_TOOLTIP:"Gjenta noen instruksjoner flere ganger.",CONTROLS_WHILEUNTIL_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#repeat",CONTROLS_WHILEUNTIL_OPERATOR_UNTIL:"gjenta til",CONTROLS_WHILEUNTIL_OPERATOR_WHILE:"gjenta mens",CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL:"Så lenge et utsagn ikke stemmer, gjør noen instruksjoner.",CONTROLS_WHILEUNTIL_TOOLTIP_WHILE:"Så lenge et utsagn stemmer, utfør noen instruksjoner.",CONTROL_KEY:"Ctrl",COPY_SHORTCUT:"Copy",CUT_SHORTCUT:"Cut",DELETE_ALL_BLOCKS:"Slett alle %1 blokker?",DELETE_BLOCK:"Slett blokk",DELETE_VARIABLE:"Slett variabelen «%1»",DELETE_VARIABLE_CONFIRMATION:"Slett %1 bruk av variabelen «%2»?",DELETE_X_BLOCKS:"Slett %1 blokker",DIALOG_CANCEL:"Avbryt",DIALOG_OK:"OK",DISABLE_BLOCK:"Deaktiver blokk",DUPLICATE_BLOCK:"duplikat",DUPLICATE_COMMENT:"Dupliser kommentar",EDIT_BLOCK_CONTENTS:"Edit Block contents",ENABLE_BLOCK:"Aktiver blokk",EXPAND_ALL:"Utvid blokker",EXPAND_BLOCK:"Utvid blokk",EXTERNAL_INPUTS:"Eksterne kilder",HELP:"Hjelp",HELP_PROMPT:"Press %1 for help on keyboard controls",INLINE_INPUTS:"Interne kilder",LINUX:"Linux",LISTS_CREATE_EMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-empty-list",LISTS_CREATE_EMPTY_TITLE:"opprett en tom liste",LISTS_CREATE_EMPTY_TOOLTIP:"Returnerer en tom liste, altså med lengde 0",LISTS_CREATE_WITH_CONTAINER_TITLE_ADD:"liste",LISTS_CREATE_WITH_CONTAINER_TOOLTIP:"Legg til, fjern eller endre rekkefølgen for å endre på denne delen av listen.",LISTS_CREATE_WITH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_CREATE_WITH_INPUT_WITH:"lag en liste med",LISTS_CREATE_WITH_ITEM_TOOLTIP:"Tilføy et element til listen.",LISTS_CREATE_WITH_TOOLTIP:"Lag en liste med et vilkårlig antall elementer.",LISTS_GET_INDEX_FIRST:"først",LISTS_GET_INDEX_FROM_END:"# fra slutten",LISTS_GET_INDEX_FROM_START:"#",LISTS_GET_INDEX_GET:"hent",LISTS_GET_INDEX_GET_REMOVE:"hent og fjern",LISTS_GET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-items-from-a-list",LISTS_GET_INDEX_LAST:"siste",LISTS_GET_INDEX_RANDOM:"tilfeldig",LISTS_GET_INDEX_REMOVE:"fjern",LISTS_GET_INDEX_TAIL:"",LISTS_GET_INDEX_TOOLTIP_GET_FIRST:"Returnerer det første elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_FROM:"Returner elementet på den angitte posisjonen i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_LAST:"Returnerer det siste elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_RANDOM:"Returnerer et tilfeldig element i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST:"Fjerner og returnerer det første elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM:"Fjerner og returnerer elementet ved en gitt posisjon i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST:"Fjerner og returnerer det siste elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM:"Fjerner og returnerer et tilfeldig element i en liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST:"Fjerner det første elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM:"Fjerner et element ved en gitt posisjon i en liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST:"Fjerner det siste elementet i en liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM:"Fjerner et tilfeldig element i en liste.",LISTS_GET_SUBLIST_END_FROM_END:"til # fra slutten",LISTS_GET_SUBLIST_END_FROM_START:"til #",LISTS_GET_SUBLIST_END_LAST:"til siste",LISTS_GET_SUBLIST_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-a-sublist",LISTS_GET_SUBLIST_START_FIRST:"Hent en del av listen",LISTS_GET_SUBLIST_START_FROM_END:"Hent de siste # elementene",LISTS_GET_SUBLIST_START_FROM_START:"Hent del-listen fra #",LISTS_GET_SUBLIST_TAIL:"",LISTS_GET_SUBLIST_TOOLTIP:"Kopiérer en ønsket del av en liste.",LISTS_INDEX_FROM_END_TOOLTIP:"%1 er det siste elementet.",LISTS_INDEX_FROM_START_TOOLTIP:"%1 er det første elementet.",LISTS_INDEX_OF_FIRST:"finn første forekomst av elementet",LISTS_INDEX_OF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#finding-items-in-a-list",LISTS_INDEX_OF_LAST:"finn siste forekomst av elementet",LISTS_INDEX_OF_TOOLTIP:"Returnerer indeksen av den første/siste forekomsten av elementet i lista. Returnerer %1 hvis ikke funnet.",LISTS_INLIST:"i listen",LISTS_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#is-empty",LISTS_ISEMPTY_TITLE:"%1 er tom",LISTS_ISEMPTY_TOOLTIP:"Returnerer sann hvis listen er tom.",LISTS_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#length-of",LISTS_LENGTH_TITLE:"lengden på %1",LISTS_LENGTH_TOOLTIP:"Returnerer lengden til en liste.",LISTS_REPEAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_REPEAT_TITLE:"Lag en liste hvor elementet %1 forekommer %2 ganger",LISTS_REPEAT_TOOLTIP:"Lager en liste hvor den gitte verdien gjentas et antall ganger.",LISTS_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#reversing-a-list",LISTS_REVERSE_MESSAGE0:"reverser %1",LISTS_REVERSE_TOOLTIP:"Reverser en kopi av ei liste.",LISTS_SET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#in-list--set",LISTS_SET_INDEX_INPUT_TO:"som",LISTS_SET_INDEX_INSERT:"sett inn ved",LISTS_SET_INDEX_SET:"sett",LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST:"Setter inn elementet i starten av en liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_FROM:"Setter inn elementet ved den angitte posisjonen i en liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_LAST:"Tilføy elementet til slutten av en liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM:"Setter inn elementet ved en tilfeldig posisjon i en liste.",LISTS_SET_INDEX_TOOLTIP_SET_FIRST:"Angir det første elementet i en liste.",LISTS_SET_INDEX_TOOLTIP_SET_FROM:"Setter inn elementet ved den angitte posisjonen i en liste.",LISTS_SET_INDEX_TOOLTIP_SET_LAST:"Angir det siste elementet i en liste.",LISTS_SET_INDEX_TOOLTIP_SET_RANDOM:"Angir et tilfeldig element i en liste.",LISTS_SORT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#sorting-a-l
3ist",LISTS_SORT_ORDER_ASCENDING:"stigende",LISTS_SORT_ORDER_DESCENDING:"synkende",LISTS_SORT_TITLE:"sorter %1 %2 %3",LISTS_SORT_TOOLTIP:"Sorter en kopi av en liste.",LISTS_SORT_TYPE_IGNORECASE:"alfabetisk, ignorert store/smÃ¥ bokstaver",LISTS_SORT_TYPE_NUMERIC:"numerisk",LISTS_SORT_TYPE_TEXT:"alfabetisk",LISTS_SPLIT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#splitting-strings-and-joining-lists",LISTS_SPLIT_LIST_FROM_TEXT:"lag liste av tekst",LISTS_SPLIT_TEXT_FROM_LIST:"lag tekst av liste",LISTS_SPLIT_TOOLTIP_JOIN:"Føy sammen en liste tekster til én tekst, avskilt av en avgrenser.",LISTS_SPLIT_TOOLTIP_SPLIT:"Splitt teksten til en liste med tekster, brutt ved hver avgrenser.",LISTS_SPLIT_WITH_DELIMITER:"med avgrenser",LOGIC_BOOLEAN_FALSE:"usann",LOGIC_BOOLEAN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#values",LOGIC_BOOLEAN_TOOLTIP:"Returnerer enten sann eller usann.",LOGIC_BOOLEAN_TRUE:"sann",LOGIC_COMPARE_HELPURL:"https://en.wikipedia.org/wiki/Inequality_(mathematics)",LOGIC_COMPARE_TOOLTIP_EQ:"Returnerer sann hvis begge inputene er like hverandre.",LOGIC_COMPARE_TOOLTIP_GT:"Returnerer sant hvis det første argumentet er større enn den andre argumentet.",LOGIC_COMPARE_TOOLTIP_GTE:"Returnerer sant hvis det første argumentet er større enn eller likt det andre argumentet.",LOGIC_COMPARE_TOOLTIP_LT:"Returnerer sant hvis det første argumentet er mindre enn det andre argumentet.",LOGIC_COMPARE_TOOLTIP_LTE:"Returnerer sant hvis det første argumentet er mindre enn eller likt det andre argumentet.",LOGIC_COMPARE_TOOLTIP_NEQ:"Returnerer sant hvis begge argumentene er ulike hverandre.",LOGIC_NEGATE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#not",LOGIC_NEGATE_TITLE:"ikke %1",LOGIC_NEGATE_TOOLTIP:"Returnerer sant hvis argumentet er usant. Returnerer usant hvis argumentet er sant.",LOGIC_NULL:"null",LOGIC_NULL_HELPURL:"https://en.wikipedia.org/wiki/Nullable_type",LOGIC_NULL_TOOLTIP:"Returnerer null.",LOGIC_OPERATION_AND:"og",LOGIC_OPERATION_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#logical-operations",LOGIC_OPERATION_OR:"eller",LOGIC_OPERATION_TOOLTIP_AND:"Returnerer sant hvis begge argumentene er sanne.",LOGIC_OPERATION_TOOLTIP_OR:"Returnerer sant hvis minst ett av argumentene er sant.",LOGIC_TERNARY_CONDITION:"test",LOGIC_TERNARY_HELPURL:"https://en.wikipedia.org/wiki/%3F:",LOGIC_TERNARY_IF_FALSE:"hvis usant",LOGIC_TERNARY_IF_TRUE:"hvis sant",LOGIC_TERNARY_TOOLTIP:"Sjekk betingelsen i 'test'. Hvis betingelsen er sann, da returneres 'hvis sant' verdien. Hvis ikke returneres 'hvis usant' verdien.",MAC_OS:"macOS",MATH_ADDITION_SYMBOL:"+",MATH_ARITHMETIC_HELPURL:"https://no.wikipedia.org/wiki/Aritmetikk",MATH_ARITHMETIC_TOOLTIP_ADD:"Returnerer summen av to tall.",MATH_ARITHMETIC_TOOLTIP_DIVIDE:"Returner kvotienten av to tall.",MATH_ARITHMETIC_TOOLTIP_MINUS:"Returner differansen mellom to tall.",MATH_ARITHMETIC_TOOLTIP_MULTIPLY:"Returner produktet av to tall.",MATH_ARITHMETIC_TOOLTIP_POWER:"Returner det første tallet opphøyd i den andre tallet.",MATH_ATAN2_HELPURL:"https://en.wikipedia.org/wiki/Atan2",MATH_ATAN2_TITLE:"atan2 av X:%1 Y:%2",MATH_ATAN2_TOOLTIP:"Returner arctangensen til punkt (X, Y) i grader fra -180 til 180.",MATH_CHANGE_HELPURL:"https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",MATH_CHANGE_TITLE:"endre %1 ved %2",MATH_CHANGE_TOOLTIP:"Addere et tall til variabelen '%1'.",MATH_CONSTANT_HELPURL:"https://en.wikipedia.org/wiki/Mathematical_constant",MATH_CONSTANT_TOOLTIP:"Returner en av felleskonstantene Ï (3.141â¦), e (2.718â¦), Ï (1.618â¦), sqrt(2) (1.414â¦), sqrt(½) (0.707â¦), eller â (uendelig).",MATH_CONSTRAIN_HELPURL:"https://en.wikipedia.org/wiki/Clamping_(graphics)",MATH_CONSTRAIN_TITLE:"begrense %1 lav %2 høy %3",MATH_CONSTRAIN_TOOLTIP:"Begrens et tall til Ã¥ være mellom de angitte grenseverdiene (inklusiv).",MATH_DIVISION_SYMBOL:"÷",MATH_IS_DIVISIBLE_BY:"er delelig med",MATH_IS_EVEN:"er et partall",MATH_IS_NEGATIVE:"er negativt",MATH_IS_ODD:"er et oddetall",MATH_IS_POSITIVE:"er positivt",MATH_IS_PRIME:"er et primtall",MATH_IS_TOOLTIP:"Sjekk om et tall er et partall, oddetall, primtall, heltall, positivt, negativt, eller om det er delelig med et annet tall. Returnerer sant eller usant.",MATH_IS_WHOLE:"er et heltall",MATH_MODULO_HELPURL:"https://en.wikipedia.org/wiki/Modulo_operation",MATH_MODULO_TITLE:"resten av %1 ÷ %2",MATH_MODULO_TOOLTIP:"Returner resten fra delingen av to tall.",MATH_MULTIPLICATION_SYMBOL:"x",MATH_NUMBER_HELPURL:"https://en.wikipedia.org/wiki/Number",MATH_NUMBER_TOOLTIP:"Et tall.",MATH_ONLIST_HELPURL:"",MATH_ONLIST_OPERATOR_AVERAGE:"gjennomsnittet av listen",MATH_ONLIST_OPERATOR_MAX:"maksimum av liste",MATH_ONLIST_OPERATOR_MEDIAN:"medianen til listen",MATH_ONLIST_OPERATOR_MIN:"minimum av listen",MATH_ONLIST_OPERATOR_MODE:"Listens typetall",MATH_ONLIST_OPERATOR_RANDOM:"tilfeldig element i listen",MATH_ONLIST_OPERATOR_STD_DEV:"standardavviket til listen",MATH_ONLIST_OPERATOR_SUM:"summen av listen",MATH_ONLIST_TOOLTIP_AVERAGE:"Returner det aritmetiske gjennomsnittet av tallene i listen.",MATH_ONLIST_TOOLTIP_MAX:"Returner det største tallet i listen.",MATH_ONLIST_TOOLTIP_MEDIAN:"Returner listens median.",MATH_ONLIST_TOOLTIP_MIN:"Returner det minste tallet i listen.",MATH_ONLIST_TOOLTIP_MODE:"Returner en liste av de vanligste elementene i listen.",MATH_ONLIST_TOOLTIP_RANDOM:"Returner et tilfeldig element fra listen.",MATH_ONLIST_TOOLTIP_STD_DEV:"Returner listens standardavvik.",MATH_ONLIST_TOOLTIP_SUM:"Returner summen av alle tallene i listen.",MATH_POWER_SYMBOL:"^",MATH_RANDOM_FLOAT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_FLOAT_TITLE_RANDOM:"tilfeldig flyttall",MATH_RANDOM_FLOAT_TOOLTIP:"Returner et tilfeldig flyttall mellom 0.0 (inkludert) og 1.0 (ikke inkludert).",MATH_RANDOM_INT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_INT_TITLE:"Et tilfeldig heltall mellom %1 og %2",MATH_RANDOM_INT_TOOLTIP:"Returner et tilfeldig tall mellom de to spesifiserte grensene, inkludert de to.",MATH_ROUND_HELPURL:"https://en.wikipedia.org/wiki/R
3ounding",MATH_ROUND_OPERATOR_ROUND:"avrunding",MATH_ROUND_OPERATOR_ROUNDDOWN:"rund ned",MATH_ROUND_OPERATOR_ROUNDUP:"rund opp",MATH_ROUND_TOOLTIP:"Avrund et tall ned eller opp.",MATH_SINGLE_HELPURL:"https://en.wikipedia.org/wiki/Square_root",MATH_SINGLE_OP_ABSOLUTE:"absoluttverdi",MATH_SINGLE_OP_ROOT:"kvadratrot",MATH_SINGLE_TOOLTIP_ABS:"Returner absoluttverdien av et tall.",MATH_SINGLE_TOOLTIP_EXP:"Returner e opphøyd i et tall.",MATH_SINGLE_TOOLTIP_LN:"Returner den naturlige logaritmen til et tall.",MATH_SINGLE_TOOLTIP_LOG10:"Returner base-10 logaritmen til et tall.",MATH_SINGLE_TOOLTIP_NEG:"Returner det negative tallet.",MATH_SINGLE_TOOLTIP_POW10:"Returner 10 opphøyd i et tall.",MATH_SINGLE_TOOLTIP_ROOT:"Returner kvadratroten av et tall.",MATH_SUBTRACTION_SYMBOL:"-",MATH_TRIG_ACOS:"acos",MATH_TRIG_ASIN:"asin",MATH_TRIG_ATAN:"atan",MATH_TRIG_COS:"cos",MATH_TRIG_HELPURL:"https://en.wikipedia.org/wiki/Trigonometric_functions",MATH_TRIG_SIN:"sin",MATH_TRIG_TAN:"tan",MATH_TRIG_TOOLTIP_ACOS:"Returner arccosinus til et tall.",MATH_TRIG_TOOLTIP_ASIN:"Returner arcsinus til et tall.",MATH_TRIG_TOOLTIP_ATAN:"Returner arctangens til et tall.",MATH_TRIG_TOOLTIP_COS:"Returner cosinus av en vinkel (ikke radian).",MATH_TRIG_TOOLTIP_SIN:"Returner sinus av en vinkel (ikke radian).",MATH_TRIG_TOOLTIP_TAN:"Returner tangenten av en vinkel (ikke radian).",MOVE_BLOCK:"Move Block",NEW_COLOUR_VARIABLE:"Oppretter fargevariabel â¦",NEW_NUMBER_VARIABLE:"Oppretter tallvariabel â¦",NEW_STRING_VARIABLE:"Oppretter strengvariabel â¦",NEW_VARIABLE:"Opprett variabelâ¦",NEW_VARIABLE_TITLE:"Nytt variabelnavn:",NEW_VARIABLE_TYPE_TITLE:"Ny variabeltype:",OPTION_KEY:"⥠Option",ORDINAL_NUMBER_SUFFIX:"",PASTE_SHORTCUT:"Paste",PROCEDURES_ALLOW_STATEMENTS:"tillat uttalelser",PROCEDURES_BEFORE_PARAMS:"med:",PROCEDURES_CALLNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLNORETURN_TOOLTIP:"Kjør den brukerdefinerte funksjonen '%1'.",PROCEDURES_CALLRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLRETURN_TOOLTIP:"Kjør den brukerdefinerte funksjonen'%1' og bruk resultatet av den.",PROCEDURES_CALL_BEFORE_PARAMS:"med:",PROCEDURES_CALL_DISABLED_DEF_WARNING:"Kan ikke kjøre den brukerdefinerte funksjonen «%1» fordi definisjonsblokken er deaktivert.",PROCEDURES_CREATE_DO:"Opprett '%1'",PROCEDURES_DEFNORETURN_COMMENT:"Beskriv denne funksjonenâ¦",PROCEDURES_DEFNORETURN_DO:"",PROCEDURES_DEFNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFNORETURN_PROCEDURE:"gjør noe",PROCEDURES_DEFNORETURN_TITLE:"til",PROCEDURES_DEFNORETURN_TOOLTIP:"Opprett en funksjon som ikke har noe resultat.",PROCEDURES_DEFRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFRETURN_RETURN:"returner",PROCEDURES_DEFRETURN_TOOLTIP:"Oppretter en funksjon som har et resultat.",PROCEDURES_DEF_DUPLICATE_WARNING:"Advarsel: Denne funksjonen har duplikate parametere.",PROCEDURES_HIGHLIGHT_DEF:"Marker funksjonsdefinisjonen",PROCEDURES_IFRETURN_HELPURL:"https://c2.com/cgi/wiki?GuardClause",PROCEDURES_IFRETURN_TOOLTIP:"Hvis en verdi er sann, returner da en annen verdi.",PROCEDURES_IFRETURN_WARNING:"Advarsel: Denne blokken kan bare benyttes innenfor en funksjonsdefinisjon.",PROCEDURES_MUTATORARG_TITLE:"Navn pÃ¥ parameter:",PROCEDURES_MUTATORARG_TOOLTIP:"Legg til en input til funksjonen.",PROCEDURES_MUTATORCONTAINER_TITLE:"parametere",PROCEDURES_MUTATORCONTAINER_TOOLTIP:"Legg til, fjern eller endre rekkefølgen pÃ¥ input til denne funksjonen.",REDO:"Gjør om",REMOVE_COMMENT:"Fjern kommentar",RENAME_VARIABLE:"Gi nytt navn til variabelâ¦",RENAME_VARIABLE_TITLE:"Endre navnet til alle '%1' variabler til:",SHORTCUTS_CODE_NAVIGATION:"Code navigation",SHORTCUTS_EDITING:"Editing",SHORTCUTS_GENERAL:"General",TEXT_APPEND_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_APPEND_TITLE:"til %1, legg til teksten %2",TEXT_APPEND_TOOLTIP:"Tilføy tekst til variabelen '%1'.",TEXT_CHANGECASE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#adjusting-text-case",TEXT_CHANGECASE_OPERATOR_LOWERCASE:"til smÃ¥ bokstaver",TEXT_CHANGECASE_OPERATOR_TITLECASE:"til store forbokstaver",TEXT_CHANGECASE_OPERATOR_UPPERCASE:"til STORE BOKSTAVER",TEXT_CHANGECASE_TOOLTIP:"Returnerer en kopi av teksten der store og smÃ¥ bokstaver er byttet om.",TEXT_CHARAT_FIRST:"hent første bokstav",TEXT_CHARAT_FROM_
3END:"hent bokstav # fra slutten",TEXT_CHARAT_FROM_START:"hent bokstav #",TEXT_CHARAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-text",TEXT_CHARAT_LAST:"hent den siste bokstaven",TEXT_CHARAT_RANDOM:"hent en tilfeldig bokstav",TEXT_CHARAT_TAIL:"",TEXT_CHARAT_TITLE:"i teksten %1, %2",TEXT_CHARAT_TOOLTIP:"Returnerer bokstaven pÃ¥ angitt plassering.",TEXT_COUNT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#counting-substrings",TEXT_COUNT_MESSAGE0:"tell %1 i %2",TEXT_COUNT_TOOLTIP:"Tell hvor mange ganger noe tekst dukker opp i annen tekst.",TEXT_CREATE_JOIN_ITEM_TOOLTIP:"Legg til et element til teksten.",TEXT_CREATE_JOIN_TITLE_JOIN:"føy sammen",TEXT_CREATE_JOIN_TOOLTIP:"Legg til, fjern eller forandre rekkefølgen for Ã¥ forandre pÃ¥ denne tekstblokken.",TEXT_GET_SUBSTRING_END_FROM_END:"til bokstav # fra slutten",TEXT_GET_SUBSTRING_END_FROM_START:"til bokstav #",TEXT_GET_SUBSTRING_END_LAST:"til siste bokstav",TEXT_GET_SUBSTRING_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-a-region-of-text",TEXT_GET_SUBSTRING_INPUT_IN_TEXT:"i tekst",TEXT_GET_SUBSTRING_START_FIRST:"hent delstreng fra første bokstav",TEXT_GET_SUBSTRING_START_FROM_END:"hent delstreng fra bokstav # fra slutten",TEXT_GET_SUBSTRING_START_FROM_START:"hent delstreng fra bokstav #",TEXT_GET_SUBSTRING_TAIL:"",TEXT_GET_SUBSTRING_TOOLTIP:"Returnerer den angitte delen av teksten.",TEXT_INDEXOF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#finding-text",TEXT_INDEXOF_OPERATOR_FIRST:"finn første forekomst av tekst",TEXT_INDEXOF_OPERATOR_LAST:"finn siste forekomst av tekst",TEXT_INDEXOF_TITLE:"i teksten %1, %2 %3",TEXT_INDEXOF_TOOLTIP:"Returnerer posisjonen for første/siste forekomsten av den første tekst i den andre teksten. Returnerer %1 hvis teksten ikke blir funnet.",TEXT_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#checking-for-empty-text",TEXT_ISEMPTY_TITLE:"%1 er tom",TEXT_ISEMPTY_TOOLTIP:"Returnerer sann hvis den angitte teksten er tom.",TEXT_JOIN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-creation",TEXT_JOIN_TITLE_CREATEWITH:"lag tekst med",TEXT_JOIN_TOOLTIP:"Opprett en tekst ved Ã¥ sette sammen et antall elementer.",TEXT_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_LENGTH_TITLE:"lengden av %1",TEXT_LENGTH_TOOLTIP:"Returnerer antall bokstaver (inkludert mellomrom) i den angitte teksten.",TEXT_PRINT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#printing-text",TEXT_PRINT_TITLE:"skriv ut %1",TEXT_PRINT_TOOLTIP:"Skriv ut angitt tekst, tall eller annet innhold.",TEXT_PROMPT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#getting-input-from-the-user",TEXT_PROMPT_TOOLTIP_NUMBER:"Be brukeren om et tall.",TEXT_PROMPT_TOOLTIP_TEXT:"Spør brukeren om tekst.",TEXT_PROMPT_TYPE_NUMBER:"spør om et tall med en melding",TEXT_PROMPT_TYPE_TEXT:"spør om tekst med en melding",TEXT_REPLACE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#replacing-substrings",TEXT_REPLACE_MESSAGE0:"erstatt %1 med %2 i %3",TEXT_REPLACE_TOOLTIP:"Erstatter alle forekomster av noe tekst i en annen tekst.",TEXT_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#reversing-text",TEXT_REVERSE_MESSAGE0:"reverser %1",TEXT_REVERSE_TOOLTIP:"Reverserer rekkefølgen pÃ¥ tegnene i teksten.",TEXT_TEXT_HELPURL:"https://en.wikipedia.org/wiki/String_(computer_science)",TEXT_TEXT_TOOLTIP:"En bokstav, ett ord eller en linje med tekst.",TEXT_TRIM_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#trimming-removing-spaces",TEXT_TRIM_OPERATOR_BOTH:"fjern mellomrom fra begge sider av",TEXT_TRIM_OPERATOR_LEFT:"fjern mellomrom fra venstre side av",TEXT_TRIM_OPERATOR_RIGHT:"fjern mellomrom fra høyre side av",TEXT_TRIM_TOOLTIP:"Returner en kopi av teksten med mellomrom fjernet fra en eller begge sidene.",TODAY:"I dag",UNDO:"Angre",UNKNOWN:"Unknown",UNNAMED_KEY:"navnløs",VARIABLES_DEFAULT_NAME:"element",VARIABLES_GET_CREATE_SET:"Opprett 'sett %1'",VARIABLES_GET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#get",VARIABLES_GET_TOOLTIP:"Returnerer verdien av denne variabelen.",VARIABLES_SET:"sett %1 til %2",VARIABLES_SET_CREATE_GET:"Opprett 'hent %1'",VARIABLES_SET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#set",VARIABLES_SET_TOOLTIP:"Setter verdien av denne variablen lik parameteren.",VARIABLE_ALREADY_EXISTS:"En variabel med navn «%1» finnes allerede.",VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE:"En variabel med navn «%1» finnes allerede for en annen type: «%2».",VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER:"En variabel med navn «%1» finnes allerede som en parameter i prosedyren «%2».",WINDOWS:"Windows",WORKSPACE_ARIA_LABEL:"Blockly-arbeidsrom",WORKSPACE_COMMENT_DEFAULT_TEXT:"Si noe â¦",CONTROLS_FOREACH_INPUT_DO:"gjør",CONTROLS_FOR_INPUT_DO:"gjør",CONTROLS_IF_ELSEIF_TITLE_ELSEIF:"ellers hvis",CONTROLS_IF_ELSE_TITLE_ELSE:"ellers",CONTROLS_IF_IF_TITLE_IF:"hvis",CONTROLS_IF_MSG_THEN:"gjør",CONTROLS_WHILEUNTIL_INPUT_DO:"gjør",LISTS_CREATE_WITH_ITEM_TITLE:"element",LISTS_GET_INDEX_INPUT_IN_LIST:"i listen",LISTS_GET_SUBLIST_INPUT_IN_LIST:"i listen",LISTS_INDEX_OF_INPUT_IN_LIST:"i listen",LISTS_SET_INDEX_INPUT_IN_LIST:"i listen",MATH_CHANGE_TITLE_ITEM:"element",PROCEDURES_DEFRETURN_COMMENT:"Beskriv denne funksjonenâ¦",PROCEDURES_DEFRETURN_DO:"",PROCEDURES_DEFRETURN_PROCEDURE:"gjør noe",PROCEDURES_DEFRETURN_TITLE:"til",TEXT_APPEND_VARIABLE:"element",TEXT_CREATE_JOIN_ITEM_TITLE_ITEM:"element",COLOUR_HUE:"20",LISTS_HUE:"260",LOGIC_HUE:"210",LOOPS_HUE:"120",MATH_HUE:"230",PROCEDURES_HUE:"290",TEXTS_HUE:"160",VARIABLES_DYNAMIC_HUE:"310",VARIABLES_HUE:"330",TURTLE_FORWARD:"gÃ¥ fremover %1 steg",TURTLE_BACKWARD:"gÃ¥ bakover %1 steg",TURTLE_MOVE:"beveg %1 med %2",TURTLE_DIR_FORWARD:"fremover",TURTLE_DIR_BACKWARD:"bakover",TURTLE_TURN:"snu %1 med %2",TURTLE_DIR_LEFT:"venstre",TURTLE_DIR_RIGHT:"høyre",TURTLE_LEFT:"snu venstre %1 grader",TURTLE_RIGHT:"snu høyre %1 grader",TURTLE_PEN_UP:"penn opp",TURTLE_PEN_DOWN:"penn ned",TURTLE_COLOR_DROPDOWN:"sett farge til %1",TURTLE_COLOR_INPUT:"sett farge til %1",TURTLE_COLOR_RED:"rød",TURTLE_COLOR_BLUE:"blÃ¥",TURTLE_COLOR_GREEN:"grønn",TURTLE_COLOR_BLACK:"svart",TURTLE_COLOR_ORANGE:"oransje",TURTLE_COLOR_PURPLE:"lilla",TURTLE_CIRCLE:"tegn sirkel med radius %1",TURTLE_GOTO:"gÃ¥ til x %1 y %2",TURTLE_HOME:"gÃ¥ hjem",TURTLE_CLEAR:"tøm tegningen",TURTLE_WIDTH:"penn bredde %1",TURTLE_BEGIN_FILL:"start fyll",TURTLE_END_FILL:"slutt fyll",TURTLE_SPEED:"hastighet (0â10) %1"},toolbox:{turtle:"Skilpadde",logic:"Logikk",loops:"Løkker",math:"Matematikk",text:"Tekst",color:"Farge",variables:"Variabler"},editor:{title:"Kodeeditor",btnRun:"Kjør kode",btnStop:"Avbryt",btnReset:"Nullstill",btnDownload:"Last ned",btnBlocks:"Blokker",btnCode:"Kode",btnLayoutSide:"Sidestilt",btnLayoutBelow:"Under",settingsTitle:"Innstillinger",settingsLang:"SprÃ¥k",settingsTheme:"Tema",themeLight:"Lys",themeDark:"Mørk",loading:"Laster inn...",readonlyBanner:"Kode generert fra blokker â ikke redigerbar",loadError:"Kunne ikke lese blokkfilen",fileLoadError:"Feil ved innlasting av fil",unsupportedLibraries:"Feil: Følgende biblioteker støttes ikke",ariaModePicker:"Velg modus",ariaLangPicker:"Velg sprÃ¥k",ariaThemePicker:"Velg tema",keyboardNavTitle:"Tastaturnavigasjon",keyboardNavActivate:"Aktiver",keyboardNavNavigate:"Naviger blokker",keyboardNavMove:"Start flytting",keyboardNavConfirm:"Bekreft posisjon",keyboardNavCancel:"Avbryt",resetConfirmTitle:"Nullstill",resetConfirmPrompt:"Tilbakestill til start",labelCanvas:"Lerret",labelConsole:"Konsoll"}},$v={messages:{ADD_COMMENT:"Legg til merknad",ALT_KEY:"Alt",CANNOT_DELETE_VARIABLE_PROCEDURE:"Kan ikkje slette variabelen «%1» fordi han er del av definisjonen for funksjonen «%2»",CHANGE_VALUE_TITLE:"Byt verdi:",CHROME_OS:"ChromeOS",CLEAN_UP:"Rydd opp blokker",CLOSE:"Lukk",COLLAPSED_WARNINGS_WARNING:"SamanslÃ¥tte blokker inneheld Ã¥tvaringar.",COLLAPSE_ALL:"Skjul blokker",COLLAPSE_BLOCK:"Skjul blokk",COLOUR_BLEND_COLOUR1:"farge 1",COLOUR_BLEND_COLOUR2:"farge 2",COLOUR_BLEND_HELPURL:"https://meyerweb.com/eric/tools/color-blend/#:::rgbp",COLOUR_BLEND_RATIO:"forhold",COLOUR_BLEND_TITLE:"bland",COLOUR_BLEND_TOOLTIP:"Blandar to fargar saman med eit gjeve forhold (0.0 - 1.0).",COLOUR_PICKER_HELPURL:"https://en.wikipedia.org/wiki/Color",COLOUR_PICKER_TOOLTIP:"Vel ei farge frÃ¥ paletten.",COLOUR_RANDOM_HELPURL:"http://randomcolour.com",COLOUR_RANDOM_TITLE:"tilfeldig farge",COLOUR_RANDOM_TOOLTIP:"Vel ei tilfeldig farge.",COLOUR_RGB_BLUE:"blÃ¥",COLOUR_RGB_GREEN:"grøn",COLOUR_RGB_HELPURL:"https://www.december.com/html/spec/colorpercompact.html",COLOUR_RGB_RED:"raud",COLOUR_RGB_TITLE:"farge med",COLOUR_RGB_TOOLTIP:"Lag ei farge med gjeve mengd raudt, grønt og blÃ¥tt. Alle verdiar mÃ¥ vere mellom 0 og 100.",COMMAND_KEY:"â Command",CONTROLS_FLOW_STATEMENTS_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#loop-termination-blocks",CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK:"bryt ut av løkka",CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE:"hald fram med neste gjentaking av løkka",CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK:"Bryt ut av den gjeldande løkka.",CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE:"Hopp over resten av denne løkka og hald fram med neste gjentaking.",CONTROLS_FLOW_STATEMENTS_WARNING:"Ã
tvaring: Denne blokken kan berre brukast innanfor ei løkke.",CONTROLS_FOREACH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#for-each",CONTROLS_FOREACH_TIT
3LE:"for kvart element %1 i lista %2",CONTROLS_FOREACH_TOOLTIP:"For kvart element i ei liste, set variabelen '%1' til elementet, og gjer deretter nokre setningar.",CONTROLS_FOR_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#count-with",CONTROLS_FOR_TITLE:"tel med %1 frå %2 til %3 med %4",CONTROLS_FOR_TOOLTIP:"La variabelen '%1' ta verdiar frå startnummeret til sluttnummeret, tel med gjeve intervall og gjer dei gjeve blokkane.",CONTROLS_IF_ELSEIF_TOOLTIP:"Legg til eit vilkår til viss-blokken.",CONTROLS_IF_ELSE_TOOLTIP:"Legg til kva som skal skje viss dei andre ikkje slår til.",CONTROLS_IF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/IfElse",CONTROLS_IF_IF_TOOLTIP:"Legg til, fjern eller flytt seksjonar i denne viss-blokken.",CONTROLS_IF_MSG_ELSE:"elles",CONTROLS_IF_MSG_ELSEIF:"elles viss",CONTROLS_IF_MSG_IF:"viss",CONTROLS_IF_TOOLTIP_1:"Viss dette er sant, gjer følgjande.",CONTROLS_IF_TOOLTIP_2:"Viss dette er sant, utfør den fyrste blokken med instruksjonar. Viss ikkje, utfør den andre blokken.",CONTROLS_IF_TOOLTIP_3:"Viss det fyrste stemmer, utfør den fyrste blokken med instruksjonar. Elles, viss det andre stemmer, utfør den andre blokken med instruksjonar.",CONTROLS_IF_TOOLTIP_4:"Viss den fyrste verdien er sann, utfør den fyrste blokken med setningar. Elles, viss den andre verdien er sann, utfør den andre blokken med setningar. Viss ingen av verdiane er sanne, utfør den siste blokken med setningar.",CONTROLS_REPEAT_HELPURL:"https://en.wikipedia.org/wiki/For_loop",CONTROLS_REPEAT_INPUT_DO:"gjer",CONTROLS_REPEAT_TITLE:"gjenta %1 gonger",CONTROLS_REPEAT_TOOLTIP:"Gjenta nokre instruksjonar fleire gonger.",CONTROLS_WHILEUNTIL_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#repeat",CONTROLS_WHILEUNTIL_OPERATOR_UNTIL:"gjenta til",CONTROLS_WHILEUNTIL_OPERATOR_WHILE:"gjenta medan",CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL:"Så lenge eit utsegn ikkje stemmer, gjer nokre instruksjonar.",CONTROLS_WHILEUNTIL_TOOLTIP_WHILE:"Så lenge eit utsegn stemmer, utfør nokre instruksjonar.",CONTROL_KEY:"Ctrl",COPY_SHORTCUT:"Kopier",CUT_SHORTCUT:"Klipp ut",DELETE_ALL_BLOCKS:"Slett alle %1 blokker?",DELETE_BLOCK:"Slett blokk",DELETE_VARIABLE:"Slett variabelen «%1»",DELETE_VARIABLE_CONFIRMATION:"Slett %1 bruk av variabelen «%2»?",DELETE_X_BLOCKS:"Slett %1 blokker",DIALOG_CANCEL:"Avbryt",DIALOG_OK:"OK",DISABLE_BLOCK:"Deaktiver blokk",DUPLICATE_BLOCK:"dupliser",DUPLICATE_COMMENT:"Dupliser merknad",EDIT_BLOCK_CONTENTS:"Endre blokkinnhald",ENABLE_BLOCK:"Aktiver blokk",EXPAND_ALL:"Utvid blokker",EXPAND_BLOCK:"Utvid blokk",EXTERNAL_INPUTS:"Eksterne kjelder",HELP:"Hjelp",HELP_PROMPT:"Trykk %1 for hjelp med tastaturkontrollar",INLINE_INPUTS:"Interne kjelder",LINUX:"Linux",LISTS_CREATE_EMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-empty-list",LISTS_CREATE_EMPTY_TITLE:"lag ei tom liste",LISTS_CREATE_EMPTY_TOOLTIP:"Returnerer ei tom liste, det vil seie med lengde 0",LISTS_CREATE_WITH_CONTAINER_TITLE_ADD:"liste",LISTS_CREATE_WITH_CONTAINER_TOOLTIP:"Legg til, fjern eller endra rekkjefølgja for å endra denne listen.",LISTS_CREATE_WITH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_CREATE_WITH_INPUT_WITH:"lag ei liste med",LISTS_CREATE_WITH_ITEM_TOOLTIP:"Legg til eit element i lista.",LISTS_CREATE_WITH_TOOLTIP:"Lag ei liste med eit valfritt antal element.",LISTS_GET_INDEX_FIRST:"fyrste",LISTS_GET_INDEX_FROM_END:"# frå slutten",LISTS_GET_INDEX_FROM_START:"#",LISTS_GET_INDEX_GET:"hent",LISTS_GET_INDEX_GET_REMOVE:"hent og fjern",LISTS_GET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-items-from-a-list",LISTS_GET_INDEX_LAST:"siste",LISTS_GET_INDEX_RANDOM:"tilfeldig",LISTS_GET_INDEX_REMOVE:"fjern",LISTS_GET_INDEX_TAIL:"",LISTS_GET_INDEX_TOOLTIP_GET_FIRST:"Returnerer det fyrste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_FROM:"Returnerer elementet på den gjeve posisjonen i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_LAST:"Returnerer det siste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_RANDOM:"Returnerer eit tilfeldig element i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST:"Fjernar og returnerer det fyrste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM:"Fjernar og returnerer elementet ved ein gjeven posisjon i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST:"Fjernar og returnerer det siste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM:"Fjernar og returnerer eit tilfeldig element i ei liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST:"Fjernar det fyrste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM:"Fjernar eit element ved ein gjeven posisjon i ei liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST:"Fjernar det siste elementet i ei liste.",LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM:"Fjernar eit tilfeldig element i ei liste.",LISTS_GET_SUBLIST_END_FROM_END:"til # frå slutten",LISTS_GET_SUBLIST_END_FROM_START:"til #",LISTS_GET_SUBLIST_END_LAST:"til siste",LISTS_GET_SUBLIST_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-a-sublist",LISTS_GET_SUBLIST_START_FIRST:"Hent ein del av lista",LISTS_GET_SUBLIST_START_FROM_END:"Hent dei siste # elementa",LISTS_GET_SUBLIST_START_FROM_START:"Hent dellista frå #",LISTS_GET_SUBLIST_TAIL:"",LISTS_GET_SUBLIST_TOOLTIP:"Kopierer ein ønska del av ei liste.",LISTS_INDEX_FROM_END_TOOLTIP:"%1 er det siste elementet.",LISTS_INDEX_FROM_START_TOOLTIP:"%1 er det fyrste elementet.",LISTS_INDEX_OF_FIRST:"finn fyrste førekomst av elementet",LISTS_INDEX_OF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#finding-items-in-a-list",LISTS_INDEX_OF_LAST:"finn siste førekomst av elementet",LISTS_INDEX_OF_TOOLTIP:"Returnerer indeksen til den fyrste/siste førekomsten av elementet i lista. Returnerer %1 viss det ikkje vart funne.",LISTS_INLIST:"i lista",LISTS_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#is-empty",LISTS_ISEMPTY_TITLE:"%1 er tom",LISTS_ISEMPTY_TOOLTIP:"Returnerer sann viss lista er tom.",LISTS_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#length-of",LISTS_LENGTH_TITLE:"lengda på %1",LISTS_LENGTH_TOOLTIP:"Returnerer lengda til ei liste.",LISTS_REPEAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",LISTS_REPEAT_TITLE:"Lag ei liste der elementet %1 førekjem %2 gonger",LISTS_REPEAT_TOOLTIP:"Lagar ei liste der den gjeve verdien vert gjenteken eit antal gonger.",LISTS_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#reversing-a-list",LISTS_REVERSE_MESSAGE0:"reverser %1",LISTS_REVERSE_TOOLTIP:"Reverser ein kopi av ei liste.",LISTS_SET_INDEX_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#in-list--set",LISTS_SET_INDEX_INPUT_TO:"som",LISTS_SET_INDEX_INSERT:"set inn ved",LISTS_SET_INDEX_SET:"set",LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST:"Set inn elementet i starten av ei liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_FROM:"Set inn elementet ved den gjeve posisjonen i ei liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_LAST:"Legg elementet til slutten av ei liste.",LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM:"Set inn elementet ved ein tilfeldig posisjon i ei liste.",LISTS_SET_INDEX_TOOLTIP_SET_FIRST:"Fastset det fyrste elementet i ei liste.",LISTS_SET_INDEX_TOOLTIP_SET_FROM:"Set inn elementet ved den gjeve posisjonen i ei liste.",LISTS_SET_INDEX_TOOLTIP_SET_LAST:"Fastset det siste elementet i ei liste.",LISTS_SET_INDEX_TOOLTIP_SET_RANDOM:"Fastset eit tilfeldig element i ei liste.",LISTS_SORT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#sorting-a-l
3ist",LISTS_SORT_ORDER_ASCENDING:"stigande",LISTS_SORT_ORDER_DESCENDING:"synkande",LISTS_SORT_TITLE:"sorter %1 %2 %3",LISTS_SORT_TOOLTIP:"Sorter ein kopi av ei liste.",LISTS_SORT_TYPE_IGNORECASE:"alfabetisk, ignorerer store/smÃ¥ bokstavar",LISTS_SORT_TYPE_NUMERIC:"numerisk",LISTS_SORT_TYPE_TEXT:"alfabetisk",LISTS_SPLIT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#splitting-strings-and-joining-lists",LISTS_SPLIT_LIST_FROM_TEXT:"lag liste av tekst",LISTS_SPLIT_TEXT_FROM_LIST:"lag tekst av liste",LISTS_SPLIT_TOOLTIP_JOIN:"SlÃ¥ saman ei liste med tekstar til éin tekst, skilt med eit skileteikn.",LISTS_SPLIT_TOOLTIP_SPLIT:"Del teksten opp i ei liste med tekstar, brote ved kvart skileteikn.",LISTS_SPLIT_WITH_DELIMITER:"med skileteikn",LOGIC_BOOLEAN_FALSE:"usann",LOGIC_BOOLEAN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#values",LOGIC_BOOLEAN_TOOLTIP:"Returnerer anten sann eller usann.",LOGIC_BOOLEAN_TRUE:"sann",LOGIC_COMPARE_HELPURL:"https://en.wikipedia.org/wiki/Inequality_(mathematics)",LOGIC_COMPARE_TOOLTIP_EQ:"Returnerer sann viss begge inndata er like kvarandre.",LOGIC_COMPARE_TOOLTIP_GT:"Returnerer sann viss det fyrste argumentet er større enn det andre argumentet.",LOGIC_COMPARE_TOOLTIP_GTE:"Returnerer sann viss det fyrste argumentet er større enn eller likt det andre argumentet.",LOGIC_COMPARE_TOOLTIP_LT:"Returnerer sann viss det fyrste argumentet er mindre enn det andre argumentet.",LOGIC_COMPARE_TOOLTIP_LTE:"Returnerer sann viss det fyrste argumentet er mindre enn eller likt det andre argumentet.",LOGIC_COMPARE_TOOLTIP_NEQ:"Returnerer sann viss begge argumenta er ulike kvarandre.",LOGIC_NEGATE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#not",LOGIC_NEGATE_TITLE:"ikkje %1",LOGIC_NEGATE_TOOLTIP:"Returnerer sann viss argumentet er usant. Returnerer usant viss argumentet er sant.",LOGIC_NULL:"null",LOGIC_NULL_HELPURL:"https://en.wikipedia.org/wiki/Nullable_type",LOGIC_NULL_TOOLTIP:"Returnerer null.",LOGIC_OPERATION_AND:"og",LOGIC_OPERATION_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#logical-operations",LOGIC_OPERATION_OR:"eller",LOGIC_OPERATION_TOOLTIP_AND:"Returnerer sann viss begge argumenta er sanne.",LOGIC_OPERATION_TOOLTIP_OR:"Returnerer sann viss minst eitt av argumenta er sant.",LOGIC_TERNARY_CONDITION:"test",LOGIC_TERNARY_HELPURL:"https://en.wikipedia.org/wiki/%3F:",LOGIC_TERNARY_IF_FALSE:"viss usant",LOGIC_TERNARY_IF_TRUE:"viss sant",LOGIC_TERNARY_TOOLTIP:"Sjekk vilkÃ¥ret i 'test'. Viss vilkÃ¥ret er sant, returnerer 'viss sant'-verdien. Viss ikkje, returnerer 'viss usant'-verdien.",MAC_OS:"macOS",MATH_ADDITION_SYMBOL:"+",MATH_ARITHMETIC_HELPURL:"https://no.wikipedia.org/wiki/Aritmetikk",MATH_ARITHMETIC_TOOLTIP_ADD:"Returnerer summen av to tal.",MATH_ARITHMETIC_TOOLTIP_DIVIDE:"Returnerer kvotienten av to tal.",MATH_ARITHMETIC_TOOLTIP_MINUS:"Returnerer differansen mellom to tal.",MATH_ARITHMETIC_TOOLTIP_MULTIPLY:"Returnerer produktet av to tal.",MATH_ARITHMETIC_TOOLTIP_POWER:"Returnerer det fyrste talet opphøgd i det andre talet.",MATH_ATAN2_HELPURL:"https://en.wikipedia.org/wiki/Atan2",MATH_ATAN2_TITLE:"atan2 av X:%1 Y:%2",MATH_ATAN2_TOOLTIP:"Returnerer arctangensen til punkt (X, Y) i gradar frÃ¥ -180 til 180.",MATH_CHANGE_HELPURL:"https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",MATH_CHANGE_TITLE:"endra %1 med %2",MATH_CHANGE_TOOLTIP:"Legg eit tal til variabelen '%1'.",MATH_CONSTANT_HELPURL:"https://en.wikipedia.org/wiki/Mathematical_constant",MATH_CONSTANT_TOOLTIP:"Returnerer ein av dei vanlege konstantane: Ï (3.141â¦), e (2.718â¦), Ï (1.618â¦), sqrt(2) (1.414â¦), sqrt(½) (0.707â¦) eller â (uendeleg).",MATH_CONSTRAIN_HELPURL:"https://en.wikipedia.org/wiki/Clamping_(graphics)",MATH_CONSTRAIN_TITLE:"avgrens %1 lÃ¥g %2 høg %3",MATH_CONSTRAIN_TOOLTIP:"Avgrensar eit tal til Ã¥ vere mellom dei gjeve grenseverdiane (inklusivt).",MATH_DIVISION_SYMBOL:"÷",MATH_IS_DIVISIBLE_BY:"er delbar med",MATH_IS_EVEN:"er eit partal",MATH_IS_NEGATIVE:"er negativt",MATH_IS_ODD:"er eit oddetal",MATH_IS_POSITIVE:"er positivt",MATH_IS_PRIME:"er eit primtal",MATH_IS_TOOLTIP:"Sjekk om eit tal er eit partal, oddetal, primtal, heiltal, positivt, negativt eller om det er delbar med eit anna tal. Returnerer sann eller usann.",MATH_IS_WHOLE:"er eit heiltal",MATH_MODULO_HELPURL:"https://en.wikipedia.org/wiki/Modulo_operation",MATH_MODULO_TITLE:"resten av %1 ÷ %2",MATH_MODULO_TOOLTIP:"Returnerer resten frÃ¥ delinga av to tal.",MATH_MULTIPLICATION_SYMBOL:"x",MATH_NUMBER_HELPURL:"https://en.wikipedia.org/wiki/Number",MATH_NUMBER_TOOLTIP:"Eit tal.",MATH_ONLIST_HELPURL:"",MATH_ONLIST_OPERATOR_AVERAGE:"gjennomsnittet av lista",MATH_ONLIST_OPERATOR_MAX:"maksimum av lista",MATH_ONLIST_OPERATOR_MEDIAN:"medianen til lista",MATH_ONLIST_OPERATOR_MIN:"minimum av lista",MATH_ONLIST_OPERATOR_MODE:"typetalet i lista",MATH_ONLIST_OPERATOR_RANDOM:"tilfeldig element i lista",MATH_ONLIST_OPERATOR_STD_DEV:"standardavviket til lista",MATH_ONLIST_OPERATOR_SUM:"summen av lista",MATH_ONLIST_TOOLTIP_AVERAGE:"Returnerer det aritmetiske gjennomsnittet av tala i lista.",MATH_ONLIST_TOOLTIP_MAX:"Returnerer det største talet i lista.",MATH_ONLIST_TOOLTIP_MEDIAN:"Returnerer medianen i lista.",MATH_ONLIST_TOOLTIP_MIN:"Returnerer det minste talet i lista.",MATH_ONLIST_TOOLTIP_MODE:"Returnerer ei liste med dei vanlegaste elementa i lista.",MATH_ONLIST_TOOLTIP_RANDOM:"Returnerer eit tilfeldig element frÃ¥ lista.",MATH_ONLIST_TOOLTIP_STD_DEV:"Returnerer standardavviket til lista.",MATH_ONLIST_TOOLTIP_SUM:"Returnerer summen av alle tala i lista.",MATH_POWER_SYMBOL:"^",MATH_RANDOM_FLOAT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_FLOAT_TITLE_RANDOM:"tilfeldig desimaltal",MATH_RANDOM_FLOAT_TOOLTIP:"Returnerer eit tilfeldig desimaltal mellom 0.0 (inkludert) og 1.0 (ikkje inkludert).",MATH_RANDOM_INT_HELPURL:"https://en.wikipedia.org/wiki/Random_number_generation",MATH_RANDOM_INT_TITLE:"Eit tilfeldig heiltal mellom %1 og %2",MATH_RANDOM_INT_TOOLTIP:"Returnerer eit tilfeldig tal mellom dei to gjeve grensene, inkludert dei to.",MATH_ROUND_HELPURL:"https://en.wikipedia.org/wiki/R
3ounding",MATH_ROUND_OPERATOR_ROUND:"avrunding",MATH_ROUND_OPERATOR_ROUNDDOWN:"rund ned",MATH_ROUND_OPERATOR_ROUNDUP:"rund opp",MATH_ROUND_TOOLTIP:"Rund eit tal ned eller opp.",MATH_SINGLE_HELPURL:"https://en.wikipedia.org/wiki/Square_root",MATH_SINGLE_OP_ABSOLUTE:"absoluttverdi",MATH_SINGLE_OP_ROOT:"kvadratrot",MATH_SINGLE_TOOLTIP_ABS:"Returnerer absoluttverdien av eit tal.",MATH_SINGLE_TOOLTIP_EXP:"Returnerer e opphøgd i eit tal.",MATH_SINGLE_TOOLTIP_LN:"Returnerer den naturlege logaritmen til eit tal.",MATH_SINGLE_TOOLTIP_LOG10:"Returnerer base-10-logaritmen til eit tal.",MATH_SINGLE_TOOLTIP_NEG:"Returnerer det negative talet.",MATH_SINGLE_TOOLTIP_POW10:"Returnerer 10 opphøgd i eit tal.",MATH_SINGLE_TOOLTIP_ROOT:"Returnerer kvadratrota av eit tal.",MATH_SUBTRACTION_SYMBOL:"-",MATH_TRIG_ACOS:"acos",MATH_TRIG_ASIN:"asin",MATH_TRIG_ATAN:"atan",MATH_TRIG_COS:"cos",MATH_TRIG_HELPURL:"https://en.wikipedia.org/wiki/Trigonometric_functions",MATH_TRIG_SIN:"sin",MATH_TRIG_TAN:"tan",MATH_TRIG_TOOLTIP_ACOS:"Returnerer arccosinus til eit tal.",MATH_TRIG_TOOLTIP_ASIN:"Returnerer arcsinus til eit tal.",MATH_TRIG_TOOLTIP_ATAN:"Returnerer arctangensen til eit tal.",MATH_TRIG_TOOLTIP_COS:"Returnerer cosinus av ein vinkel (ikkje radian).",MATH_TRIG_TOOLTIP_SIN:"Returnerer sinus av ein vinkel (ikkje radian).",MATH_TRIG_TOOLTIP_TAN:"Returnerer tangenten av ein vinkel (ikkje radian).",MOVE_BLOCK:"Flytt blokk",NEW_COLOUR_VARIABLE:"Lag fargevariabel â¦",NEW_NUMBER_VARIABLE:"Lag talvariabel â¦",NEW_STRING_VARIABLE:"Lag tekststrengvariabel â¦",NEW_VARIABLE:"Opprett variabelâ¦",NEW_VARIABLE_TITLE:"Nytt variabelnamn:",NEW_VARIABLE_TYPE_TITLE:"Ny variabeltype:",OPTION_KEY:"⥠Option",ORDINAL_NUMBER_SUFFIX:"",PASTE_SHORTCUT:"Lim inn",PROCEDURES_ALLOW_STATEMENTS:"tillat uttrykk",PROCEDURES_BEFORE_PARAMS:"med:",PROCEDURES_CALLNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLNORETURN_TOOLTIP:"Køyr den brukardefinerte funksjonen '%1'.",PROCEDURES_CALLRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_CALLRETURN_TOOLTIP:"Køyr den brukardefinerte funksjonen '%1' og bruk resultatet av han.",PROCEDURES_CALL_BEFORE_PARAMS:"med:",PROCEDURES_CALL_DISABLED_DEF_WARNING:"Kan ikkje køyre den brukardefinerte funksjonen «%1» fordi definisjonblokken er deaktivert.",PROCEDURES_CREATE_DO:"Opprett '%1'",PROCEDURES_DEFNORETURN_COMMENT:"Beskriv denne funksjonenâ¦",PROCEDURES_DEFNORETURN_DO:"",PROCEDURES_DEFNORETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFNORETURN_PROCEDURE:"gjer noko",PROCEDURES_DEFNORETURN_TITLE:"til",PROCEDURES_DEFNORETURN_TOOLTIP:"Opprett ein funksjon som ikkje har noko resultat.",PROCEDURES_DEFRETURN_HELPURL:"https://en.wikipedia.org/wiki/Subroutine",PROCEDURES_DEFRETURN_RETURN:"returner",PROCEDURES_DEFRETURN_TOOLTIP:"Opprettar ein funksjon som har eit resultat.",PROCEDURES_DEF_DUPLICATE_WARNING:"Ã
tvaring: Denne funksjonen har duplikate parametrar.",PROCEDURES_HIGHLIGHT_DEF:"Marker funksjonsdefinisjon",PROCEDURES_IFRETURN_HELPURL:"https://c2.com/cgi/wiki?GuardClause",PROCEDURES_IFRETURN_TOOLTIP:"Viss ein verdi er sann, returner dÃ¥ ein annan verdi.",PROCEDURES_IFRETURN_WARNING:"Ã
tvaring: Denne blokken kan berre brukast innanfor ein funksjonsdefinisjon.",PROCEDURES_MUTATORARG_TITLE:"Namn pÃ¥ parameter:",PROCEDURES_MUTATORARG_TOOLTIP:"Legg til ein inndata til funksjonen.",PROCEDURES_MUTATORCONTAINER_TITLE:"parametrar",PROCEDURES_MUTATORCONTAINER_TOOLTIP:"Legg til, fjern eller endra rekkjefølgja pÃ¥ inndataene til denne funksjonen.",REDO:"Gjer om",REMOVE_COMMENT:"Fjern merknad",RENAME_VARIABLE:"Gi nytt namn til variabelâ¦",RENAME_VARIABLE_TITLE:"Endra namnet pÃ¥ alle '%1'-variablar til:",SHORTCUTS_CODE_NAVIGATION:"Kodenavigering",SHORTCUTS_EDITING:"Redigering",SHORTCUTS_GENERAL:"Generelt",TEXT_APPEND_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_APPEND_TITLE:"til %1, legg til teksten %2",TEXT_APPEND_TOOLTIP:"Legg tekst til variabelen '%1'.",TEXT_CHANGECASE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#adjusting-text-case",TEXT_CHANGECASE_OPERATOR_LOWERCASE:"til smÃ¥ bokstavar",TEXT_CHANGECASE_OPERATOR_TITLECASE:"til store forbokstavar",TEXT_CHANGECASE_OPERATOR_UPPERCASE:"til STORE BOKSTAVAR",TEXT_CHANGECASE_TOOLTIP:"Returnerer ein kopi av teksten der store og smÃ¥ bokstavar er endra.",TEXT_CHARAT_FIRST:"hent fyrste bokstav",TEXT_CHARAT_FROM_
3END:"hent bokstav # frÃ¥ slutten",TEXT_CHARAT_FROM_START:"hent bokstav #",TEXT_CHARAT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-text",TEXT_CHARAT_LAST:"hent den siste bokstaven",TEXT_CHARAT_RANDOM:"hent ein tilfeldig bokstav",TEXT_CHARAT_TAIL:"",TEXT_CHARAT_TITLE:"i teksten %1, %2",TEXT_CHARAT_TOOLTIP:"Returnerer bokstaven pÃ¥ gjeven plassering.",TEXT_COUNT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#counting-substrings",TEXT_COUNT_MESSAGE0:"tel %1 i %2",TEXT_COUNT_TOOLTIP:"Tell kor mange gonger ein tekst dukkar opp i ein annan tekst.",TEXT_CREATE_JOIN_ITEM_TOOLTIP:"Legg til eit element til teksten.",TEXT_CREATE_JOIN_TITLE_JOIN:"slÃ¥ saman",TEXT_CREATE_JOIN_TOOLTIP:"Legg til, fjern eller endra rekkjefølgja for Ã¥ endra denne tekstblokken.",TEXT_GET_SUBSTRING_END_FROM_END:"til bokstav # frÃ¥ slutten",TEXT_GET_SUBSTRING_END_FROM_START:"til bokstav #",TEXT_GET_SUBSTRING_END_LAST:"til siste bokstav",TEXT_GET_SUBSTRING_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-a-region-of-text",TEXT_GET_SUBSTRING_INPUT_IN_TEXT:"i tekst",TEXT_GET_SUBSTRING_START_FIRST:"hent delstreng frÃ¥ fyrste bokstav",TEXT_GET_SUBSTRING_START_FROM_END:"hent delstreng frÃ¥ bokstav # frÃ¥ slutten",TEXT_GET_SUBSTRING_START_FROM_START:"hent delstreng frÃ¥ bokstav #",TEXT_GET_SUBSTRING_TAIL:"",TEXT_GET_SUBSTRING_TOOLTIP:"Returnerer den gjeve delen av teksten.",TEXT_INDEXOF_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#finding-text",TEXT_INDEXOF_OPERATOR_FIRST:"finn fyrste førekomst av tekst",TEXT_INDEXOF_OPERATOR_LAST:"finn siste førekomst av tekst",TEXT_INDEXOF_TITLE:"i teksten %1, %2 %3",TEXT_INDEXOF_TOOLTIP:"Returnerer posisjonen til den fyrste/siste førekomsten av den fyrste teksten i den andre teksten. Returnerer %1 viss teksten ikkje vert funnen.",TEXT_ISEMPTY_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#checking-for-empty-text",TEXT_ISEMPTY_TITLE:"%1 er tom",TEXT_ISEMPTY_TOOLTIP:"Returnerer sann viss den gjeve teksten er tom.",TEXT_JOIN_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-creation",TEXT_JOIN_TITLE_CREATEWITH:"lag tekst med",TEXT_JOIN_TOOLTIP:"Lag ein tekst ved Ã¥ slÃ¥ saman eit antal element.",TEXT_LENGTH_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",TEXT_LENGTH_TITLE:"lengda av %1",TEXT_LENGTH_TOOLTIP:"Returnerer antalet bokstavar (inkludert mellomrom) i den gjeve teksten.",TEXT_PRINT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#printing-text",TEXT_PRINT_TITLE:"skriv ut %1",TEXT_PRINT_TOOLTIP:"Skriv ut gjeven tekst, tal eller anna innhald.",TEXT_PROMPT_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#getting-input-from-the-user",TEXT_PROMPT_TOOLTIP_NUMBER:"Be brukaren om eit tal.",TEXT_PROMPT_TOOLTIP_TEXT:"Spør brukaren om tekst.",TEXT_PROMPT_TYPE_NUMBER:"spør om eit tal med ei melding",TEXT_PROMPT_TYPE_TEXT:"spør om tekst med ei melding",TEXT_REPLACE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#replacing-substrings",TEXT_REPLACE_MESSAGE0:"erstatt %1 med %2 i %3",TEXT_REPLACE_TOOLTIP:"Erstattar alle førekomstar av ein tekst i ein annan tekst.",TEXT_REVERSE_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#reversing-text",TEXT_REVERSE_MESSAGE0:"reverser %1",TEXT_REVERSE_TOOLTIP:"Reverserer rekkjefølgja pÃ¥ teikna i teksten.",TEXT_TEXT_HELPURL:"https://en.wikipedia.org/wiki/String_(computer_science)",TEXT_TEXT_TOOLTIP:"Ein bokstav, eit ord eller ei linje med tekst.",TEXT_TRIM_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Text#trimming-removing-spaces",TEXT_TRIM_OPERATOR_BOTH:"fjern mellomrom frÃ¥ begge sider av",TEXT_TRIM_OPERATOR_LEFT:"fjern mellomrom frÃ¥ venstre side av",TEXT_TRIM_OPERATOR_RIGHT:"fjern mellomrom frÃ¥ høgre side av",TEXT_TRIM_TOOLTIP:"Returnerer ein kopi av teksten med mellomrom fjerna frÃ¥ éi eller begge sider.",TODAY:"I dag",UNDO:"Angre",UNKNOWN:"Ukjend",UNNAMED_KEY:"namnlaus",VARIABLES_DEFAULT_NAME:"element",VARIABLES_GET_CREATE_SET:"Opprett 'set %1'",VARIABLES_GET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#get",VARIABLES_GET_TOOLTIP:"Returnerer verdien av denne variabelen.",VARIABLES_SET:"set %1 til %2",VARIABLES_SET_CREATE_GET:"Opprett 'hent %1'",VARIABLES_SET_HELPURL:"https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#set",VARIABLES_SET_TOOLTIP:"Set verdien av denne variabelen lik parameteren.",VARIABLE_ALREADY_EXISTS:"Ein variabel med namn «%1» finst allereie.",VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE:"Ein variabel med namn «%1» finst allereie for ein annan type: «%2».",VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER:"Ein variabel med namn «%1» finst allereie som ein parameter i prosedyren «%2».",WINDOWS:"Windows",WORKSPACE_ARIA_LABEL:"Blockly-arbeidsrom",WORKSPACE_COMMENT_DEFAULT_TEXT:"Si noko â¦",CONTROLS_FOREACH_INPUT_DO:"gjer",CONTROLS_FOR_INPUT_DO:"gjer",CONTROLS_IF_ELSEIF_TITLE_ELSEIF:"elles viss",CONTROLS_IF_ELSE_TITLE_ELSE:"elles",CONTROLS_IF_IF_TITLE_IF:"viss",CONTROLS_IF_MSG_THEN:"gjer",CONTROLS_WHILEUNTIL_INPUT_DO:"gjer",LISTS_CREATE_WITH_ITEM_TITLE:"element",LISTS_GET_INDEX_INPUT_IN_LIST:"i lista",LISTS_GET_SUBLIST_INPUT_IN_LIST:"i lista",LISTS_INDEX_OF_INPUT_IN_LIST:"i lista",LISTS_SET_INDEX_INPUT_IN_LIST:"i lista",MATH_CHANGE_TITLE_ITEM:"element",PROCEDURES_DEFRETURN_COMMENT:"Beskriv denne funksjonenâ¦",PROCEDURES_DEFRETURN_DO:"",PROCEDURES_DEFRETURN_PROCEDURE:"gjer noko",PROCEDURES_DEFRETURN_TITLE:"til",TEXT_APPEND_VARIABLE:"element",TEXT_CREATE_JOIN_ITEM_TITLE_ITEM:"element",COLOUR_HUE:"20",LISTS_HUE:"260",LOGIC_HUE:"210",LOOPS_HUE:"120",MATH_HUE:"230",PROCEDURES_HUE:"290",TEXTS_HUE:"160",VARIABLES_DYNAMIC_HUE:"310",VARIABLES_HUE:"330",TURTLE_FORWARD:"gÃ¥ framover %1 steg",TURTLE_BACKWARD:"gÃ¥ bakover %1 steg",TURTLE_MOVE:"flytt %1 med %2",TURTLE_DIR_FORWARD:"framover",TURTLE_DIR_BACKWARD:"bakover",TURTLE_TURN:"snu %1 med %2",TURTLE_DIR_LEFT:"venstre",TURTLE_DIR_RIGHT:"høgre",TURTLE_LEFT:"snu venstre %1 grader",TURTLE_RIGHT:"snu høgre %1 grader",TURTLE_PEN_UP:"penn opp",TURTLE_PEN_DOWN:"penn ned",TURTLE_COLOR_DROPDOWN:"set farge til %1",TURTLE_COLOR_INPUT:"set farge til %1",TURTLE_COLOR_RED:"raud",TURTLE_COLOR_BLUE:"blÃ¥",TURTLE_COLOR_GREEN:"grøn",TURTLE_COLOR_BLACK:"svart",TURTLE_COLOR_ORANGE:"oransje",TURTLE_COLOR_PURPLE:"lilla",TURTLE_CIRCLE:"teikn sirkel med radius %1",TURTLE_GOTO:"gÃ¥ til x %1 y %2",TURTLE_HOME:"gÃ¥ heim",TURTLE_CLEAR:"tøm teikninga",TURTLE_WIDTH:"pennbreidde %1",TURTLE_BEGIN_FILL:"start fyll",TURTLE_END_FILL:"slutt fyll",TURTLE_SPEED:"hastigheit (0â10) %1"},toolbox:{turtle:"Skjelpadde",logic:"Logikk",loops:"Løkker",math:"Matematikk",text:"Tekst",color:"Farge",variables:"Variablar"},editor:{title:"Kodeeditor",btnRun:"Køyr kode",btnStop:"Avbryt",btnReset:"Nullstill",btnDownload:"Last ned",btnBlocks:"Blokker",btnCode:"Kode",btnLayoutSide:"Sidestilt",btnLayoutBelow:"Under",settingsTitle:"Innstillingar",settingsLang:"SprÃ¥k",settingsTheme:"Tema",themeLight:"Lys",themeDark:"Mørk",loading:"Lastar inn...",readonlyBanner:"Kode generert frÃ¥ blokker â ikkje redigerbar",loadError:"Kunne ikkje lesa blokkfila",fileLoadError:"Feil ved innlasting av fil",unsupportedLibraries:"Feil: Følgjande bibliotek er ikkje støtta",ariaModePicker:"Vel modus",ariaLangPicker:"Vel sprÃ¥k",ariaThemePicker:"Vel tema",keyboardNavTitle:"Tastaturnavigasjon",keyboardNavActivate:"Aktiver",keyboardNavNavigate:"Naviger blokker",keyboardNavMove:"Start flytting",keyboardNavConfirm:"Stadfest posisjon",keyboardNavCancel:"Avbryt",resetConfirmTitle:"Nullstill",resetConfirmPrompt:"Tilbakestill til start",labelCanvas:"Lerret",labelConsole:"Konsoll"}},Mv="<brikke-internal>",xv=`\nimport ast\nimport traceback\n\n_BRIKKE_INTERNAL_FILENAME = ${JSON.stringify(Mv)}\n\n\ndef _brikke_format_error(exc):\n frames = [\n frame\n for frame in traceback.extract_tb(exc.__traceback__)\n if frame.filename != _BRIKKE_INTERNAL_FILENAME\n ]\n lines = []\n if frames:\n lines.append('Traceback (most recent call last):\\n')\n lines.extend(traceback.format_list(frames))\n lines.extend(traceback.format_exception_only(type(exc), exc))\n return ''.join(lines)\n\n\nasync def _brikke_run(source, filename):\n try:\n code = compile(source, filename, 'exec', flags=ast.PyCF_ALLOW_TOP_LEVEL_AWAIT)\n result = eval(code, globals())\n if hasattr(result, '__await__'):\n await result\n return None\n except BaseException as exc:\n return _brikke_format_error(exc)\n`;async function Dv(e,t){return e.runPythonAsync(t,{filename:Mv})}async function Pv(e){await Dv(e,"import sys\nfrom io import StringIO\nsys.stdout = output_capture = StringIO()\n")}function Fv(e){return e.runPython("output_capture.getvalue()",{filename:Mv})}async function Bv(e,t,i="main.py"){return await e.globals.get("_brikke_run")(t,i)??null}function Uv(e){return 0===e?0:Math.max(10,Math.round(550/Math.min(10,Math.max(1,e))))}function Hv(e){return new Promise(t=>setTimeout(t,e))}var Vv=new WeakSet;function Gv(e,t){Vv.has(e)||(e.FS.writeFile("/home/pyodide/turtle.py","\"\"\"Brikke turtle stub â installed into Pyodide's filesystem so that\n`import turtle` resolves here. Eac
3h call enqueues an event; nothing draws\nin Python. The JS animator drains the queue and renders to canvas.\n\"\"\"\nimport js\n\n\ndef _emit(kind, *args):\n js.brikkeTurtleEmit(kind, list(args))\n\n\ndef forward(steps):\n _emit('forward', float(steps))\n\n\ndef backward(steps):\n _emit('backward', float(steps))\n\n\ndef left(deg):\n _emit('left', float(deg))\n\n\ndef right(deg):\n _emit('right', float(deg))\n\n\ndef penup():\n _emit('penup')\n\n\ndef pendown():\n _emit('pendown')\n\n\ndef color(c):\n _emit('color', str(c))\n\n\ndef goto(x, y):\n _emit('goto', float(x), float(y))\n\n\ndef setheading(deg):\n _emit('setheading', float(deg))\n\n\ndef home():\n _emit('home')\n\n\ndef circle(r):\n _emit('circle', float(r))\n\n\ndef clear():\n _emit('clear')\n\n\ndef speed(n):\n _emit('speed', float(max(0, min(10, n))))\n\n\ndef width(n):\n _emit('width', float(n))\n\n\ndef begin_fill():\n _emit('begin_fill')\n\n\ndef end_fill():\n _emit('end_fill')\n\n\n# Common short aliases\nfd = forward\nbk = backward\nback = backward\nlt = left\nrt = right\npensize = width\n",{encoding:"utf8"}),Vv.add(e)),globalThis.brikkeTurtleEmit=(e,i)=>{let n=function(e){if(Array.isArray(e))return e;if(e&&"function"==typeof e.toJs){let t=e.toJs();if(Array.isArray(t))return t}return[]}(i);t.push({kind:e,args:n})},e.setStdout({batched:e=>{t.push({kind:"print",text:e})}})}var Wv={local:{drake:"http://localhost:3000/",pyodideScript:"/pyodide/pyodide.js",pyodideIndex:"/pyodide/"},test:{drake:"https://felles-drake.web.test.aschehoug.cloud/",pyodideScript:"https://flyt-brikke.web.test.aschehoug.cloud/pyodide/pyodide.js",pyodideIndex:"https://flyt-brikke.web.test.aschehoug.cloud/pyodide/"},prod:{drake:"https://felles-drake.web.prod.aschehoug.cloud/",pyodideScript:"https://flyt-brikke.web.prod.aschehoug.cloud/pyodide/pyodide.js",pyodideIndex:"https://flyt-brikke.web.prod.aschehoug.cloud/pyodide/"}};function Xv(e){if(!e||!(e in Wv))throw Error(`[brikke] env must be 'local', 'test', or 'prod', got: ${JSON.stringify(e)}`)}function zv(e){return Xv(e),Wv[e].pyodideIndex}var jv={prefix:"far",iconName:"ear",icon:[384,512,[128066],"f5f0","M336 192c0 48.1-23.6 90.8-60 117-16.8 12.1-34.4 29.8-44.3 54.5l-20.1 50.2c-12.2 30.4-41.6 50.3-74.3 50.3l-9.3 0c-44.2 0-80-35.8-80-80l0-192c0-79.5 64.5-144 144-144s144 64.5 144 144zM276.3 381.4c5.5-13.7 15.8-24.8 27.8-33.4 48.4-34.9 80-91.7 80-156 0-106-86-192-192-192S0 86 0 192L0 384c0 70.7 57.3 128 128 128l9.3 0c52.3 0 99.4-31.9 118.8-80.5l20.1-50.2zM128 192c0-35.3 28.7-64 64-64s64 28.7 64 64l0 8c0 13.3 10.7 24 24 24s24-10.7 24-24l0-8c0-61.9-50.1-112-112-112S80 130.1 80 192l0 40c0 13.3 10.7 24 24 24l16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-16 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l16 0c39.8 0 72-32.2 72-72 0-37.1-28-67.6-64-71.6l0-16.4z"]},Yv={prefix:"fas",iconName:"spinner-scale",icon:[448,512,[],"e62a","M224 116a52 52 0 1 1 0-104 52 52 0 1 1 0 104zm0 300c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zM416 288a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM0 256a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm399.4-96.2a56 56 0 1 1 -79.2-79.2 56 56 0 1 1 79.2 79.2zM65.6 414.4a32 32 0 1 1 45.3-45.3 32 32 0 1 1 -45.3 45.3zm271.5 0a32 32 0 1 1 45.3-45.3 32 32 0 1 1 -45.3 45.3zM54.3 86.3a48 48 0 1 1 67.9 67.9 48 48 0 1 1 -67.9-67.9z"]},Qv={prefix:"fas",iconName:"code",icon:[576,512,[],"f121","M360.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm64.6 136.1c-12.5 12.5-12.5 32.8 0 45.3l73.4 73.4-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0zm-274.7 0c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 150.6 182.6c12.5-12.5 12.5-32.8 0-45.3z"]},Kv={prefix:"fas",iconName:"gear",icon:[512,512,[9881,"cog"],"f013","M195.1 9.5C198.1-5.3 211.2-16 226.4-16l59.8 0c15.2 0 28.3 10.7 31.3 25.5L332 79.5c14.1 6 27.3 13.7 39.3 22.8l67.8-22.5c14.4-4.8 30.2 1.2 37.8 14.4l29.9 51.8c7.6 13.2 4.9 29.8-6.5 39.9L447 233.3c.9 7.4 1.3 15 1.3 22.7s-.5 15.3-1.3 22.7l53.4 47.5c11.4 10.1 14 26.8 6.5 39.9l-29.9 51.8c-7.6 13.1-23.4 19.2-37.8 14.4l-67.8-22.5c-12.1 9.1-25.3 16.7-39.3 22.8l-14.4 69.9c-3.1 14.9-16.2 25.5-31.3 25.5l-59.8 0c-15.2 0-28.3-10.7-31.3-25.5l-14.4-69.9c-14.1-6-27.2-13.7-39.3-22.8L73.5 432.3c-14.4 4.8-30.2-1.2-37.8-14.4L5.8 366.1c-7.6-13.2-4.9-29.8 6.5-39.9l53.4-47.5c-.9-7.4-1.3-15-1.3-22.7s.5-15.3 1.3-22.7L12.3 185.8c-11.4-10.1-14-26.8-6.5-39.9L35.7 94.1c7.6-13.2 23.4-19.2 37.8-14.4l67.8 22.5c12.1-9.1 25.3-16.7 39.3-22.8L195.1 9.5zM256.3 336a80 80 0 1 0 -.6-160 80 80 0 1 0 .6 160z"]},qv={prefix:"fas",iconName:"play",icon:[448,512,[9654],"f04b","M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z"]},Jv={prefix:"fas",iconName:"puzzle-piece",icon:[512,512,[129513],"f12e","M224 0c35.3 0 64 21.5 64 48 0 10.4-4.4 20-12 27.9-6.6 6.9-12 15.3-12 24.9 0 15 12.2 27.2 27.2 27.2l44.8 0c26.5 0 48 21.5 48 48l0 44.8c0 15 12.2 27.2 27.2 27.2 9.5 0 18-5.4 24.9-12 7.9-7.5 17.5-12 27.9-12 26.5 0 48 28.7 48 64s-21.5 64-48 64c-10.4 0-20.1-4.4-27.9-12-6.9-6.6-15.3-12-24.9-12-15 0-27.2 12.2-27.2 27.2L384 464c0 26.5-21.5 48-48 48l-56.8 0c-12.8 0-23.2-10.4-23.2-23.2 0-9.2 5.8-17.3 13.2-22.8 11.6-8.7 18.8-20.7 18.8-34 0-26.5-28.7-48-64-48s-64 21.5-64 48c0 13.3 7.2 25.3 18.8 34 7.4 5.5 13.2 13.5 13.2 22.8 0 12.8-10.4 23.2-23.2 23.2L48 512c-26.5 0-48-21.5-48-48L0 343.2c0-12.8 10.4-23.2 23.2-23.2 9.2 0 17.3 5.8 22.8 13.2 8.7 11.6 20.7 18.8 34 18.8 26.5 0 48-28.7 48-64s-21.5-64-48-64c-13.3 0-25.3 7.2-34
318.8-5.5 7.4-13.5 13.2-22.8 13.2-12.8 0-23.2-10.4-23.2-23.2L0 176c0-26.5 21.5-48 48-48l108.8 0c15 0 27.2-12.2 27.2-27.2 0-9.5-5.4-18-12-24.9-7.5-7.9-12-17.5-12-27.9 0-26.5 28.7-48 64-48z"]},Zv={prefix:"fas",iconName:"code-simple",icon:[576,512,[],"e13d","M214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6zm146.7 0L498.7 256 361.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3z"]},eI={prefix:"fas",iconName:"sun-bright",icon:[576,512,["sun-alt"],"e28f","M288 432c13.3 0 24 10.7 24 24l0 64c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-64c0-13.3 10.7-24 24-24zM129.6 380.4c9.4-9.4 24.6-9.4 34 0s9.4 24.6 0 34l-45.3 45.3c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l45.2-45.3zm282.8 0c9.4-9.4 24.6-9.4 34 0l45.3 45.3c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-45.3-45.3c-9.4-9.4-9.4-24.6 0-34zM288 384a128 128 0 1 1 0-256 128 128 0 1 1 0 256zM88 232c13.3 0 24 10.7 24 24s-10.7 24-24 24l-64 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l64 0zm464 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-64 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l64 0zM84.3 52.3c9.4-9.4 24.6-9.4 33.9 0l45.3 45.2c9.4 9.4 9.4 24.6 0 34s-24.6 9.4-34 0L84.3 86.3c-9.4-9.4-9.4-24.6 0-33.9zm373.4 0c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-45.3 45.3c-9.4 9.4-24.6 9.4-34 0s-9.4-24.6 0-34l45.3-45.2zM288-32c13.3 0 24 10.7 24 24l0 64c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-64c0-13.3 10.7-24 24-24z"]},tI={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]},iI={prefix:"fas",iconName:"moon",icon:[512,512,[127769,9214],"f186","M256 0C114.6 0 0 114.6 0 256S114.6 512 256 512c68.8 0 131.3-27.2 177.3-71.4 7.3-7 9.4-17.9 5.3-27.1s-13.7-14.9-23.8-14.1c-4.9 .4-9.8 .6-14.8 .6-101.6 0-184-82.4-184-184 0-72.1 41.5-134.6 102.1-164.8 9.1-4.5 14.3-14.3 13.1-24.4S322.6 8.5 312.7 6.3C294.4 2.2 275.4 0 256 0z"]},nI={prefix:"fas",iconName:"lock",icon:[384,512,[128274],"f023","M128 96l0 64 128 0 0-64c0-35.3-28.7-64-64-64s-64 28.7-64 64zM64 160l0-64C64 25.3 121.3-32 192-32S320 25.3 320 96l0 64c35.3 0 64 28.7 64 64l0 224c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 224c0-35.3 28.7-64 64-64z"]},oI={prefix:"fas",iconName:"rotate-left",icon:[512,512,["rotate-back","rotate-backward","undo-alt"],"f2ea","M24 192l144 0c9.7 0 18.5-5.8 22.2-14.8s1.7-19.3-5.2-26.2l-46.7-46.7c75.3-58.6 184.3-53.3 253.5 15.9 75 75 75 196.5 0 271.5s-196.5 75-271.5 0c-10.2-10.2-19-21.3-26.4-33-9.5-14.9-29.3-19.3-44.2-9.8s-19.3 29.3-9.8 44.2C49.7 408.7 61.4 423.5 75 437 175 537 337 537 437 437S537 175 437 75C342.8-19.3 193.3-24.7 92.7 58.8L41 7C34.1 .2 23.8-1.9 14.8 1.8S0 14.3 0 24L0 168c0 13.3 10.7 24 24 24z"]},rI={prefix:"fas",iconName:"download",icon:[448,512,[],"f019","M256 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 210.7-41.4-41.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 242.7 256 32zM64 320c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-46.9 0-56.6 56.6c-31.2 31.2-81.9 31.2-113.1 0L110.9 320 64 320zm304 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"]},sI={prefix:"fas",iconName:"arrow-right-arrow-left",icon:[512,512,[8644,"exchange"],"f0ec","M502.6 150.6l-96 96c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L402.7 160 32 160c-17.7 0-32-14.3-32-32S14.3 96 32 96l370.7 0-41.4-41.4c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l96 96c12.5 12.5 12.5 32.8 0 45.3zm-397.3 352l-96-96c-12.5-12.5-12.5-32.8 0-45.3l96-96c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L109.3 352 480 352c17.7 0 32 14.3 32 32s-14.3 32-32 32l-370.7 0 41.4 41.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0z"]},aI={prefix:"fas",iconName:"pause",icon:[384,512,[9208],"f04c","M48 32C21.5 32 0 53.5 0 80L0 432c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48L48 32zm224 0c-26.5 0-48 21.5-48 48l0 352c0 26.5 21.5 48 48 48l64 0c26.5 0 48-21.5 48-48l0-352c0-26.5-21.5-48-48-48l-64 0z"]},lI={prefix:"fas",iconName:"arrow-up-arrow-down",icon:[512,512,["sort-up-down"],"e099","M150.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L96 109.3 96 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-370.7 41.4 41.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-96-96zm352 397.3c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L416 402.7 416 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 370.7-41.4-41.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0l96-96z"]};function cI(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function uI(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,TI(n.key),n)}}function hI(e,t){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=EI(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,a=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return s=e.done,e},e:function(e){a=!0,r=e}
3,f:function(){try{s||null==i.return||i.return()}finally{if(a)throw r}}}}function dI(e,t,i){return(t=TI(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function pI(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function fI(e){for(var t=1;t<arguments.length;t++){var i=null==arguments[t]?{}:arguments[t];t%2?pI(Object(i),!0).forEach(function(t){dI(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):pI(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function gI(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var n,o,r,s,a=[],l=!0,c=!1;try{if(r=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=r.call(i)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||EI(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mI(e){return function(e){if(Array.isArray(e))return cI(e)}(e)||function(e){if(typeof Symbol<"u"&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||EI(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function TI(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function _I(e){return _I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_I(e)}function EI(e,t){if(e){if("string"==typeof e)return cI(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?cI(e,t):void 0}}var bI=function(){},OI={},vI={},II=null,SI={mark:bI,measure:bI};try{typeof window<"u"&&(OI=window),typeof document<"u"&&(vI=document),typeof MutationObserver<"u"&&(II=MutationObserver),typeof performance<"u"&&(SI=performance)}catch{}var yI=(OI.navigator||{}).userAgent,RI=void 0===yI?"":yI,CI=OI,kI=vI,AI=II,LI=SI;CI.document;var NI,wI=!!kI.documentElement&&!!kI.head&&"function"==typeof kI.addEventListener&&"function"==typeof kI.createElement,$I=~RI.indexOf("MSIE")||~RI.indexOf("Trident/"),MI={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"},slab:{"fa-regular":"regular",faslr:"regular"},"slab-press":{"fa-regular":"regular",faslpr:"regular"},thumbprint:{"fa-light":"light",fatl:"light"},whiteboard:{"fa-semibold":"semibold",fawsb:"semibold"},notdog:{"fa-solid":"solid",fans:"solid"},"notdog-duo":{"fa-solid":"solid",fands:"solid"},etch:{"fa-solid":"solid",faes:"solid"},graphite:{"fa-thin":"thin",fagt:"thin"},jelly:{"fa-regular":"regular",fajr:"regular"},"jelly-fill":{"fa-regular":"regular",fajfr:"regular"},"jelly-duo":{"fa-regular":"regular",fajdr:"regular"},chisel:{"fa-regular":"regular",facr:"regular"},utility:{"fa-semibold":"semibold",fausb:"semibold"},"utility-duo":{"fa-semibold":"semibold",faudsb:"semibold"},"utility-fill":{"fa-semibold":"semibold",faufsb:"semibold"}},xI=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-graphite","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press","fa-utility","fa-utility-duo","fa-utility-fill"],DI="classic",PI="duotone",FI="sharp",BI="sharp-duotone",UI="chisel",HI="etch",VI="graphite",GI="jelly",WI="jelly-duo",XI="jelly-fill",zI="notdog",jI="notdog-duo",YI="slab",QI="slab-press",KI="thumbprint",qI="utility",JI="utility-duo",ZI="utility-fill",eS="whiteboard",tS=[DI,PI,FI,BI,UI,HI,VI,GI,WI,XI,zI,jI,YI,QI,KI,qI,JI,ZI,eS];dI(dI(dI(dI(dI(dI(dI(dI(dI(dI(NI={},DI,"Classic"),PI,"Duotone"),FI,"Sharp"),BI,"Sharp Duotone"),UI,"Chisel"),HI,"Etch"),VI,"Graphite"),GI,"Jelly"),WI,"Jelly Duo"),XI,"Jelly Fill"),dI(dI(dI(dI(dI(dI(dI(dI(dI(NI,zI,"Notdog"),jI,"Notdog Duo"),YI,"Slab"),QI,"Slab Press"),KI,"Thumbprint"),qI,"Utility"),JI,"Utility Duo"),ZI,"Utility Fill"),eS,"Whiteboard");var iS=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["chisel",{defaultShortPrefixId:"facr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["etch",{defaultShortPrefixId:"faes",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["graphite",{defaultShortPrefixId:"fagt",defaultStyleId:"thin",styleIds:["thin"],futureStyleIds:[],defaultFontWeight:100}],["jelly",{defaultShortPrefixId:"fajr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-duo",{defaultShortPrefixId:"fajdr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-fill",{defaultShortPrefixId:"fajfr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["notdog",{defaultShortPrefixId:"fans",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["notdog-duo",{defaultShortPrefixId:"fands",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["slab",{defaultShortPrefixId:"faslr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["slab-press",{defaultShortPrefixId:"faslpr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["thumbprint",{defaultShortPrefixId:"fatl",defaultStyleId:"light",styleIds:["light"],futureStyleIds:[],defaultFontWeight:300}],["utility",{defaultShortPrefixId:"fausb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}],["utility-duo",{defaultShortPrefixId:"faudsb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}],["utility-fill",{defaultShortPrefixId:"faufsb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}],["whiteboard",{defaultShortPrefixId:"fawsb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}]]),nS=["fak","fa-kit","fakd","fa-kit-duotone"],oS={fak:"kit","fa-kit":"kit"},rS={fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"};dI(dI({},"kit","Kit"),"kit-duotone","Kit Duotone");var sS,aS={kit:"fak"},lS={"kit-duotone":"fakd"},cS="duotone-group",uS="swap-opacity",hS="primary",dS="secondary";dI(dI(dI(dI(dI(dI(dI(dI(dI(dI(sS={},"classic","Classic"),"duotone","Duotone"),"sharp","Sharp"),"sharp-duotone","Sharp Duotone"),"chisel","Chisel"),"etch","Etch"),"graphite","Graphite"),"jelly","Jelly"),"jelly-duo","Jelly Duo"),"jelly-fill","Jelly Fill"),dI(dI(dI(dI(dI(dI(dI(dI(dI(sS,"notdog","Notdog"),"notdog-duo","Notdog Duo"),"slab","Slab"),"slab-press","Slab Press"),"thumbprint","Thumbprint"),"utility","Utility"),"utility-duo","Utility Duo"),"utility-fill","Utility Fill"),"whiteboard","Whiteboard"),dI(dI({},"kit","Kit"),"kit-duotone","Kit Duotone");var pS={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"},slab:{faslr:"fa-regular"},"slab-press":{faslpr:"fa-regular"},whiteboard:{fawsb:"fa-semibold"},thumbprint:{fatl:"fa-light"},notdog:{fans:"fa-solid"},"notdog-duo":{fands:"fa-solid"},etch:{faes:"fa-solid"},graphite:{fagt:"fa-thin"},jelly:{fajr:"fa-regular"},"jelly-fill":{fajfr:"fa-regular"},"jelly-duo":{fajdr:"fa-regular"},chisel:{facr:"fa-regular"},utility:{fausb:"fa-semibold"},"utility-duo":{faudsb:"fa-semibold"},"utility-fill":{faufsb:"fa-semibold"}},fS="fa.fas.far.fal.fat.fad.fadr.fadl.fadt.fab.fass.fasr.fasl.fast.fasds.fasdr.fasdl.fasdt.faslr.faslpr.fawsb.fatl.fans.fands.faes.fagt.fajr.fajfr.fajdr.facr.fausb.faudsb.faufsb".split(".").concat(["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-graphite","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press","fa-utility","fa-utility-duo","fa-utility-fill"],["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"]),g
3S=[1,2,3,4,5,6,7,8,9,10],mS=gS.concat([11,12,13,14,15,16,17,18,19,20]),TS=[].concat(mI(Object.keys({classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"],slab:["faslr"],"slab-press":["faslpr"],whiteboard:["fawsb"],thumbprint:["fatl"],notdog:["fans"],"notdog-duo":["fands"],etch:["faes"],graphite:["fagt"],jelly:["fajr"],"jelly-fill":["fajfr"],"jelly-duo":["fajdr"],chisel:["facr"],utility:["fausb"],"utility-duo":["faudsb"],"utility-fill":["faufsb"]})),["solid","regular","light","thin","duotone","brands","semibold"],["aw","fw","pull-left","pull-right"],["2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","inverse","layers","layers-bottom-left","layers-bottom-right","layers-counter","layers-text","layers-top-left","layers-top-right","li","pull-end","pull-start","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul","width-auto","width-fixed",cS,uS,hS,dS],gS.map(function(e){return`${e}x`}),mS.map(function(e){return`w-${e}`})),_S="___FONT_AWESOME___",ES="svg-inline--fa",bS="data-fa-i2svg",OS="data-fa-pseudo-element",vS="data-prefix",IS="data-icon",SS="fontawesome-i2svg",yS=["HTML","HEAD","STYLE","SCRIPT"],RS=["::before","::after",":before",":after"],CS=function(){try{return!0}catch{return!1}}();function kS(e){return new Proxy(e,{get:function(e,t){return t in e?e[t]:e[DI]}})}var AS=fI({},MI);AS[DI]=fI(fI(fI(fI({},{"fa-duotone":"duotone"}),MI[DI]),oS),rS);var LS=kS(AS),NS=fI({},{chisel:{regular:"facr"},classic:{brands:"fab",light:"fal",regular:"far",solid:"fas",thin:"fat"},duotone:{light:"fadl",regular:"fadr",solid:"fad",thin:"fadt"},etch:{solid:"faes"},graphite:{thin:"fagt"},jelly:{regular:"fajr"},"jelly-duo":{regular:"fajdr"},"jelly-fill":{regular:"fajfr"},notdog:{solid:"fans"},"notdog-duo":{solid:"fands"},sharp:{light:"fasl",regular:"fasr",solid:"fass",thin:"fast"},"sharp-duotone":{light:"fasdl",regular:"fasdr",solid:"fasds",thin:"fasdt"},slab:{regular:"faslr"},"slab-press":{regular:"faslpr"},thumbprint:{light:"fatl"},utility:{semibold:"fausb"},"utility-duo":{semibold:"faudsb"},"utility-fill":{semibold:"faufsb"},whiteboard:{semibold:"fawsb"}});NS[DI]=fI(fI(fI(fI({},{duotone:"fad"}),NS[DI]),aS),lS);var wS=kS(NS),$S=fI({},pS);$S[DI]=fI(fI({},$S[DI]),{fak:"fa-kit"});var MS=kS($S),xS=fI({},{classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"},slab:{"fa-regular":"faslr"},"slab-press":{"fa-regular":"faslpr"},whiteboard:{"fa-semibold":"fawsb"},thumbprint:{"fa-light":"fatl"},notdog:{"fa-solid":"fans"},"notdog-duo":{"fa-solid":"fands"},etch:{"fa-solid":"faes"},graphite:{"fa-thin":"fagt"},jelly:{"fa-regular":"fajr"},"jelly-fill":{"fa-regular":"fajfr"},"jelly-duo":{"fa-regular":"fajdr"},chisel:{"fa-regular":"facr"},utility:{"fa-semibold":"fausb"},"utility-duo":{"fa-semibold":"faudsb"},"utility-fill":{"fa-semibold":"faufsb"}});xS[DI]=fI(fI({},xS[DI]),{"fa-kit":"fak"}),kS(xS);var DS=/fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|gt|jr|jfr|jdr|usb|ufsb|udsb|cr|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,PS="fa-layers-text",FS=/Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Graphite|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Utility|Utility Fill|Utility Duo|Slab Press|Slab|Whiteboard)?.*/i;kS(fI({},{classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"},slab:{400:"faslr"},"slab-press":{400:"faslpr"},whiteboard:{600:"fawsb"},thumbprint:{300:"fatl"},notdog:{900:"fans"},"notdog-duo":{900:"fands"},etch:{900:"faes"},graphite:{100:"fagt"},chisel:{400:"facr"},jelly:{400:"fajr"},"jelly-fill":{400:"fajfr"},"jelly-duo":{400:"fajdr"},utility:{600:"fausb"},"utility-duo":{600:"faudsb"},"utility-fill":{600:"faufsb"}}));
3var BS=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],US={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},HS=[].concat(mI(["kit"]),mI(TS)),VS=CI.FontAwesomeConfig||{};kI&&"function"==typeof kI.querySelector&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-search-pseudo-elements","searchPseudoElements"],["data-search-pseudo-elements-warnings","searchPseudoElementsWarnings"],["data-search-pseudo-elements-full-scan","searchPseudoElementsFullScan"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(function(e){var t=gI(e,2),i=t[0],n=t[1],o=function(e){return""===e||"false"!==e&&("true"===e||e)}(function(e){var t=kI.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(i));null!=o&&(VS[n]=o)});var GS={styleDefault:"solid",familyDefault:DI,cssPrefix:"fa",replacementClass:ES,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};VS.familyPrefix&&(VS.cssPrefix=VS.familyPrefix);var WS=fI(fI({},GS),VS);WS.autoReplaceSvg||(WS.observeMutations=!1);var XS={};Object.keys(GS).forEach(function(e){Object.defineProperty(XS,e,{enumerable:!0,set:function(t){WS[e]=t,zS.forEach(function(e){return e(XS)})},get:function(){return WS[e]}})}),Object.defineProperty(XS,"familyPrefix",{enumerable:!0,set:function(e){WS.cssPrefix=e,zS.forEach(function(e){return e(XS)})},get:function(){return WS.cssPrefix}}),CI.FontAwesomeConfig=XS;var zS=[];var jS=16,YS={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function QS(){for(var e=12,t="";e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function KS(e){for(var t=[],i=(e||[]).length>>>0;i--;)t[i]=e[i];return t}function qS(e){return e.classList?KS(e.classList):(e.getAttribute("class")||"").split(" ").filter(function(e){return e})}function JS(e){return`${e}`.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function ZS(e){return Object.keys(e||{}).reduce(function(t,i){return t+`${i}: ${e[i].trim()};`},"")}function ey(e){return e.size!==YS.size||e.x!==YS.x||e.y!==YS.y||e.rotate!==YS.rotate||e.flipX||e.flipY}function ty(){var e="fa",t=ES,i=XS.cssPrefix,n=XS.replacementClass,o=":root, :host {\n --fa-font-solid: normal 900 1em/1 'Font Awesome 7 Free';\n --fa-font-regular: normal 400 1em/1 'Font Awesome 7 Free';\n --fa-font-light: normal 300 1em/1 'Font Awesome 7 Pro';\n --fa-font-thin: normal 100 1em/1 'Font Awesome 7 Pro';\n --fa-font-duotone: normal 900 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-regular: normal 400 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-light: normal 300 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-thin: normal 100 1em/1 'Font Awesome 7 Duotone';\n --fa-font-brands: normal 400 1em/1 'Font Awesome 7 Brands';\n --fa-font-sharp-solid: normal 900 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-regular: normal 400 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-light: normal 300 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-thin: normal 100 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-duotone-solid: normal 900 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-regular: normal 400 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-light: normal 300 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-thin: normal 100 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-slab-regular: normal 400 1em/1 'Font Awesome 7 Slab';\n --fa-font-slab-press-regular: normal 400 1em/1 'Font Awesome 7 Slab Press';\n --fa-font-whiteboard-semibold: normal 600 1em/1 'Font Awesome 7 Whiteboard';\n --fa-font-thumbprint-light: normal 300 1em/1 'Font Awesome 7 Thumbprint';\n --fa-font-notdog-solid: normal 900 1em/1 'Font Awesome 7 Notdog';\n --fa-font-notdog-duo-solid: normal 900 1em/1 'Font Awesome 7 Notdog Duo';\n --fa-font-etch-solid: normal 900 1em/1 'Font Awesome 7 Etch';\n --fa-font-graphite-thin: normal 100 1em/1 'Font Awesome 7 Graphite';\n --fa-font-jelly-regular: normal 400 1em/1 'Font Awesome 7 Jelly';\n --fa-font-jelly-fill-regular: normal 400 1em/1 'Font Awesome 7 Jelly Fill';\n --fa-font-jelly-duo-regular: normal 400 1em/1 'Font Awesome 7 Jelly Duo';\n --fa-font-chisel-regular: normal 400 1em/1 'Font Awesome 7 Chisel';\n --fa-font-utility-semibold: normal 600 1em/1 'Font Awesome 7 Utility';\n --fa-font-utility-duo-semibold: normal 600 1em/1 'Font Awesome 7 Utility Duo';\n --fa-font-utility-fill-semibold: normal 600 1em/1 'Font Awesome 7 Utility Fill';\n}\n\n.svg-inline--fa {\n box-sizing: content-box;\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n width: var(--fa-width, 1.25em);\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285714em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;
3\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left,\n.svg-inline--fa .fa-pull-start {\n float: inline-start;\n margin-inline-end: var(--fa-pull-margin, 0.3em);\n}\n.svg-inline--fa.fa-pull-right,\n.svg-inline--fa .fa-pull-end {\n float: inline-end;\n margin-inline-start: var(--fa-pull-margin, 0.3em);\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n inset-inline-start: calc(-1 * var(--fa-li-width, 2em));\n inset-block-start: 0.25em; /* syncing vertical alignment with Web Font rendering */\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: var(--fa-width, 1.25em);\n}\n.fa-layers .svg-inline--fa {\n inset: 0;\n margin: auto;\n position: absolute;\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: calc(10 / 16 * 1em); /* converts a 10px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 10 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 10 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-xs {\n font-size: calc(12 / 16 * 1em); /* converts a 12px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 12 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 12 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-sm {\n font-size: calc(14 / 16 * 1em); /* converts a 14px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 14 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 14 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-lg {\n font-size: calc(20 / 16 * 1em); /* converts a 20px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 20 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 20 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-xl {\n font-size: calc(24 / 16 * 1em); /* converts a 24px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 24 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 24 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-2xl {\n font-size: calc(32 / 16 * 1em); /* converts a 32px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 32 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 32 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-width-auto {\n --fa-width: auto;\n}\n\n.fa-fw,\n.fa-width-fixed {\n --fa-width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-inline-start: var(--fa-li-margin, 2.5em);\n padding-inline-start: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n inset-inline-start: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n/* Heads Up: Bordered Icons will not be supported in the future!\n - This feature will be deprecated
3in the next major release of Font Awesome (v8)!\n - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8.\n*/\n/* Notes:\n* --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size)\n* --@{v.$css-prefix}-border-padding =\n ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment)\n ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon)\n*/\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.0625em);\n box-sizing: var(--fa-border-box-sizing, content-box);\n padding: var(--fa-border-padding, 0.1875em 0.25em);\n}\n\n.fa-pull-left,\n.fa-pull-start {\n float: inline-start;\n margin-inline-end: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right,\n.fa-pull-end {\n float: inline-end;\n margin-inline-start: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n .fa-bounce,\n .fa-fade,\n .fa-beat-fade,\n .fa-flip,\n .fa-pulse,\n .fa-shake,\n .fa-spin,\n .fa-spin-pulse {\n animation: none !important;\n transition: none !important;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}
3\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.svg-inline--fa.fa-inverse {\n fill: var(--fa-inverse, #fff);\n}\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n line-height: 2em;\n position: relative;\n vertical-align: middle;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.svg-inline--fa.fa-stack-1x {\n --fa-width: 1.25em;\n height: 1em;\n width: var(--fa-width);\n}\n.svg-inline--fa.fa-stack-2x {\n --fa-width: 2.5em;\n height: 2em;\n width: var(--fa-width);\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n inset: 0;\n margin: auto;\n position: absolute;\n z-index: var(--fa-stack-z-index, auto);\n}";if(i!==e||n!==t){var r=RegExp(`\\.${e}\\-`,"g"),s=RegExp(`\\--${e}\\-`,"g"),a=RegExp(`\\.${t}`,"g");o=o.replace(r,`.${i}-`).replace(s,`--${i}-`).replace(a,`.${n}`)}return o}var iy=!1;function ny(){XS.autoAddCss&&!iy&&(function(e){if(e&&wI){var t=kI.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;for(var i=kI.head.childNodes,n=null,o=i.length-1;o>-1;o--){var r=i[o],s=(r.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(s)>-1&&(n=r)}kI.head.insertBefore(t,n)}}(ty()),iy=!0)}var oy={mixout:function(){return{dom:{css:ty,insertCss:ny}}},hooks:function(){return{beforeDOMElementCreation:function(){ny()},beforeI2svg:function(){ny()}}}},ry=CI||{};ry[_S]||(ry[_S]={}),ry[_S].styles||(ry[_S].styles={}),ry[_S].hooks||(ry[_S].hooks={}),ry[_S].shims||(ry[_S].shims=[]);var sy=ry[_S],ay=[],ly=function(){kI.removeEventListener("DOMContentLoaded",ly),cy=1,ay.map(function(e){return e()})},cy=!1;function uy(e){var t=e.tag,i=e.attributes,n=void 0===i?{}:i,o=e.children,r=void 0===o?[]:o;return"string"==typeof e?JS(e):`<${t} ${function(e){return Object.keys(e||{}).reduce(function(t,i){return t+`${i}="${JS(e[i])}" `},"").trim()}(n)}>${r.map(uy).join("")}</${t}>`}function hy(e,t,i){if(e&&e[t]&&e[t][i])return{prefix:t,iconName:i,icon:e[t][i]}}wI&&((cy=(kI.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(kI.readyState))||kI.addEventListener("DOMContentLoaded",ly));var dy=function(e,t,i,n){var o,r,s,a=Object.keys(e),l=a.length,c=void 0===n?t:function(e,t){return function(i,n,o,r){return e.call(t,i,n,o,r)}}(t,n);for(void 0===i?(o=1,s=e[a[0]]):(o=0,s=i);o<l;o++)s=c(s,e[r=a[o]],r,e);return s};function py(e){return 1===mI(e).length?e.codePointAt(0).toString(16):null}function fy(e){return Object.keys(e).reduce(function(t,i){var n=e[i];return n.icon?t[n.iconName]=n.icon:t[i]=n,t},{})}function gy(e,t){var i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).skipHooks,n=void 0!==i&&i,o=fy(t);"function"!=typeof sy.hooks.addPack||n?sy.styles[e]=fI(fI({},sy.styles[e]||{}),o):sy.hooks.addPack(e,fy(t)),"fas"===e&&gy("fa",t)}var my=sy.styles,Ty=sy.shims,_y=Object.keys(MS),Ey=_y.reduce(function(e,t){return e[t]=Object.keys(MS[t]),e},{}),by=null,Oy={},vy={},Iy={},Sy={},yy={};function Ry(e,t){var i=t.split("-"),n=i[0],o=i.slice(1).join("-");return n!==e||""===o||function(e){return~HS.indexOf(e)}(o)?null:o}var Cy=function(){var e=function(e){return dy(my,function(t,i,n){return t[n]=dy(i,e,{}),t},{})};Oy=e(function(e,t,i){return t[3]&&(e[t[3]]=i),t[2]&&t[2].filter(function(e){return"number"==typeof e}
3).forEach(function(t){e[t.toString(16)]=i}),e}),vy=e(function(e,t,i){return e[i]=i,t[2]&&t[2].filter(function(e){return"string"==typeof e}).forEach(function(t){e[t]=i}),e}),yy=e(function(e,t,i){var n=t[2];return e[i]=i,n.forEach(function(t){e[t]=i}),e});var t="far"in my||XS.autoFetchSvg,i=dy(Ty,function(e,i){var n=i[0],o=i[1],r=i[2];return"far"===o&&!t&&(o="fas"),"string"==typeof n&&(e.names[n]={prefix:o,iconName:r}),"number"==typeof n&&(e.unicodes[n.toString(16)]={prefix:o,iconName:r}),e},{names:{},unicodes:{}});Iy=i.names,Sy=i.unicodes,by=wy(XS.styleDefault,{family:XS.familyDefault})};function ky(e,t){return(Oy[e]||{})[t]}function Ay(e,t){return(yy[e]||{})[t]}function Ly(e){return Iy[e]||{prefix:null,iconName:null}}function Ny(){return by}(function(e){zS.push(e)})(function(e){by=wy(e.styleDefault,{family:XS.familyDefault})}),Cy();function wy(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).family,i=void 0===t?DI:t,n=LS[i][e];if(i===PI&&!e)return"fad";var o=wS[i][e]||wS[i][n],r=e in sy.styles?e:null;return o||r||null}function $y(e){return e.sort().filter(function(e,t,i){return i.indexOf(e)===t})}var My=fS.concat(nS);function xy(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).skipLookups,i=void 0!==t&&t,n=null,o=$y(e.filter(function(e){return My.includes(e)})),r=$y(e.filter(function(e){return!My.includes(e)})),s=gI(o.filter(function(e){return n=e,!xI.includes(e)}),1)[0],a=void 0===s?null:s,l=function(e){var t=DI,i=_y.reduce(function(e,t){return e[t]=`${XS.cssPrefix}-${t}`,e},{});return tS.forEach(function(n){(e.includes(i[n])||e.some(function(e){return Ey[n].includes(e)}))&&(t=n)}),t}(o),c=fI(fI({},function(e){var t=[],i=null;return e.forEach(function(e){var n=Ry(XS.cssPrefix,e);n?i=n:e&&t.push(e)}),{iconName:i,rest:t}}(r)),{},{prefix:wy(a,{family:l})});return fI(fI(fI({},c),function(e){var t=e.values,i=e.family,n=e.canonical,o=e.givenPrefix,r=void 0===o?"":o,s=e.styles,a=void 0===s?{}:s,l=e.config,c=void 0===l?{}:l,u=i===PI,h=t.includes("fa-duotone")||t.includes("fad"),d="duotone"===c.familyDefault,p="fad"===n.prefix||"fa-duotone"===n.prefix;return!u&&(h||d||p)&&(n.prefix="fad"),(t.includes("fa-brands")||t.includes("fab"))&&(n.prefix="fab"),!n.prefix&&Dy.includes(i)&&(Object.keys(a).find(function(e){return Py.includes(e)})||c.autoFetchSvg)&&(n.prefix=iS.get(i).defaultShortPrefixId,n.iconName=Ay(n.prefix,n.iconName)||n.iconName),("fa"===n.prefix||"fa"===r)&&(n.prefix=Ny()||"fas"),n}({values:e,family:l,styles:my,config:XS,canonical:c,givenPrefix:n})),function(e,t,i){var n=i.prefix,o=i.iconName;if(e||!n||!o)return{prefix:n,iconName:o};var r="fa"===t?Ly(o):{},s=Ay(n,o);return o=r.iconName||s||o,n=r.prefix||n,"far"===n&&!my.far&&my.fas&&!XS.autoFetchSvg&&(n="fas"),{prefix:n,iconName:o}}(i,n,c))}var Dy=tS.filter(function(e){return e!==DI||e!==PI}),Py=Object.keys(pS).filter(function(e){return e!==DI}).map(function(e){return Object.keys(pS[e])}).flat();var Fy=function(){return function(e,t,i){return t&&uI(e.prototype,t),i&&uI(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(){(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this.definitions={}},[{key:"add",value:function(){var e=this,t=[...arguments].reduce(this._pullDefinitions,{});Object.keys(t).forEach(function(i){e.definitions[i]=fI(fI({},e.definitions[i]||{}),t[i]),gy(i,t[i]);var n=MS[DI][i];n&&gy(n,t[i]),Cy()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(e,t){var i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(function(t){var n=i[t],o=n.prefix,r=n.iconName,s=n.icon,a=s[2];e[o]||(e[o]={}),a.length>0&&a.forEach(function(t){"string"==typeof t&&(e[o][t]=s)}),e[o][r]=s}),e}}])}(),By=[],Uy={},Hy={},Vy=Object.keys(Hy);function Gy(e,t){var i=[...arguments].slice(2);return(Uy[e]||[]).forEach(function(e){t=e.apply(null,[t].concat(i))}),t}function Wy(e){var t=[...arguments].slice(1);(Uy[e]||[]).forEach(function(e){e.apply(null,t)})}function Xy(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return Hy[e]?Hy[e].apply(null,t):void 0}function zy(e){"fa"===e.prefix&&(e.prefix="fas");var t=e.iconName,i=e.prefix||Ny();if(t)return t=Ay(i,t)||t,hy(jy.definitions,i,t)||hy(sy.styles,i,t)}var jy=new Fy,Yy={noAuto:function(){XS.autoReplaceSvg=!1,XS.observeMutations=!1,Wy("noAuto")},config:XS,dom:{i2svg:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return wI?(Wy("beforeI2svg",e),Xy("pseudoElements2svg",e),Xy("i2svg",e)):Promise.reject(Error("Operation requires a DOM of some kind."))},watch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.autoReplaceSvgRoot;!1===XS.autoReplaceSvg&&(XS.autoReplaceSvg=!0),XS.observeMutations=!0,function(e){wI&&(cy?setTimeout(e,0):ay.push(e))}(function(){Qy({autoReplaceSvgRoot:t}
3),Wy("watch",e)})}},parse:{icon:function(e){if(null===e)return null;if("object"===_I(e)&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:Ay(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){var t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],i=wy(e[0]);return{prefix:i,iconName:Ay(i,t)||t}}if("string"==typeof e&&(e.indexOf(`${XS.cssPrefix}-`)>-1||e.match(DS))){var n=xy(e.split(" "),{skipLookups:!0});return{prefix:n.prefix||Ny(),iconName:Ay(n.prefix,n.iconName)||n.iconName}}if("string"==typeof e){var o=Ny();return{prefix:o,iconName:Ay(o,e)||e}}}},library:jy,findIconDefinition:zy,toHtml:uy},Qy=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).autoReplaceSvgRoot,t=void 0===e?kI:e;(Object.keys(sy.styles).length>0||XS.autoFetchSvg)&&wI&&XS.autoReplaceSvg&&Yy.dom.i2svg({node:t})};function Ky(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(function(e){return uy(e)})}}),Object.defineProperty(e,"node",{get:function(){if(wI){var t=kI.createElement("div");return t.innerHTML=e.html,t.children}}}),e}function qy(e){var t=e.icons,i=t.main,n=t.mask,o=e.prefix,r=e.iconName,s=e.transform,a=e.symbol,l=e.maskId,c=e.extra,u=e.watchable,h=void 0!==u&&u,d=n.found?n:i,p=d.width,f=d.height,g=[XS.replacementClass,r?`${XS.cssPrefix}-${r}`:""].filter(function(e){return-1===c.classes.indexOf(e)}).filter(function(e){return""!==e||!!e}).concat(c.classes).join(" "),m={children:[],attributes:fI(fI({},c.attributes),{},{"data-prefix":o,"data-icon":r,class:g,role:c.attributes.role||"img",viewBox:`0 0 ${p} ${f}`})};!function(e){return["aria-label","aria-labelledby","title","role"].some(function(t){return t in e})}(c.attributes)&&!c.attributes["aria-hidden"]&&(m.attributes["aria-hidden"]="true"),h&&(m.attributes[bS]="");var T=fI(fI({},m),{},{prefix:o,iconName:r,main:i,mask:n,maskId:l,transform:s,symbol:a,styles:fI({},c.styles)}),_=n.found&&i.found?Xy("generateAbstractMask",T)||{children:[],attributes:{}}:Xy("generateAbstractIcon",T)||{children:[],attributes:{}},E=_.children,b=_.attributes;return T.children=E,T.attributes=b,a?function(e){var t=e.prefix,i=e.iconName,n=e.children,o=e.attributes,r=e.symbol,s=!0===r?`${t}-${XS.cssPrefix}-${i}`:r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:fI(fI({},o),{},{id:s}),children:n}]}]}(T):function(e){var t=e.children,i=e.main,n=e.mask,o=e.attributes,r=e.styles,s=e.transform;if(ey(s)&&i.found&&!n.found){var a={x:i.width/i.height/2,y:.5};o.style=ZS(fI(fI({},r),{},{"transform-origin":`${a.x+s.x/16}em ${a.y+s.y/16}em`}))}return[{tag:"svg",attributes:o,children:t}]}(T)}function Jy(e){var t=e.content,i=e.width,n=e.height,o=e.transform,r=e.extra,s=e.watchable,a=void 0!==s&&s,l=fI(fI({},r.attributes),{},{class:r.classes.join(" ")});a&&(l[bS]="");var c=fI({},r.styles);ey(o)&&(c.transform=function(e){var t=e.transform,i=e.width,n=void 0===i?16:i,o=e.height,r=void 0===o?16:o,s=e.startCentered,a=void 0!==s&&s,l="";return l+=a&&$I?`translate(${t.x/jS-n/2}em, ${t.y/jS-r/2}em) `:a?`translate(calc(-50% + ${t.x/jS}em), calc(-50% + ${t.y/jS}em)) `:`translate(${t.x/jS}em, ${t.y/jS}em) `,l+=`scale(${t.size/jS*(t.flipX?-1:1)}, ${t.size/jS*(t.flipY?-1:1)}) `,l+`rotate(${t.rotate}deg) `}({transform:o,startCentered:!0,width:i,height:n}),c["-webkit-transform"]=c.transform);var u=ZS(c);u.length>0&&(l.style=u);var h=[];return h.push({tag:"span",attributes:l,children:[t]}),h}var Zy=sy.styles;function eR(e){var t=e[0],i=e[1],n=gI(e.slice(4),1)[0];return{found:!0,width:t,height:i,icon:Array.isArray(n)?{tag:"g",attributes:{class:`${XS.cssPrefix}-${US.GROUP}`},children:[{tag:"path",attributes:{class:`${XS.cssPrefix}-${US.SECONDARY}`,fill:"currentColor",d:n[0]}},{tag:"path",attributes:{class:`${XS.cssPrefix}-${US.PRIMARY}`,fill:"currentColor",d:n[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:n}}}}var tR={found:!1,width:512,height:512};function iR(e,t){var i=t;return"fa"===t&&null!==XS.styleDefault&&(t=Ny()),new Promise(function(n,o){if("fa"===i){var r=Ly(e)||{};e=r.iconName||e,t=r.prefix||t}if(e&&t&&Zy[t]&&Zy[t][e])return n(eR(Zy[t][e]));(function(e,t){!CS&&!XS.showMissingIcons&&e&&console.error(`Icon with name "${e}" and prefix "${t}" is missing.`)})(e,t),n(fI(fI({},tR),{},{icon:XS.showMissingIcons&&e&&Xy("missingIconAbstract")||{}}))})}var nR=function(){},oR=XS.measurePerformance&&LI&&LI.mark&&LI.measure?LI:{mark:nR,measure:nR},rR='FA "7.2.0"',sR=function(e){oR.mark(`${rR} ${e} ends`),oR.measure(`${rR} ${e}`,`${rR} ${e} begins`,`${rR} ${e} ends`)},aR=function(e){return oR.mark(`${rR} ${e} begins`),function(){return sR(e)}},lR=function(){};function cR(e){return"string"==typeof(e.getAttribute?e.getAttribute(bS):null)}function uR(e){return kI.createElementNS("http://www.w3.org/2000/svg",e)}function hR(e){return kI.createElement(e)}function dR(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).ceFn,i=void 0===t?"svg"===e.tag?uR:hR:t;if("string"==typeof e)return kI.createTextNode(e);var n=i(e.tag);
vendor: 1,366 bytes, line 3
3return Object.keys(e.attributes||[]).forEach(function(t){n.setAttribute(t,e.attributes[t])}),(e.children||[]).forEach(function(e){n.appendChild(dR(e,{ceFn:i}))}),n}var pR={replace:function(e){var t=e[0];if(t.parentNode)if(e[1].forEach(function(e){t.parentNode.insertBefore(dR(e),t)}),null===t.getAttribute(bS)&&XS.keepOriginalSource){var i=kI.createComment(function(e){var t=` ${e.outerHTML} `;return`${t}Font Awesome fontawesome.com `}(t));t.parentNode.replaceChild(i,t)}else t.remove()},nest:function(e){var t=e[0],i=e[1];if(~qS(t).indexOf(XS.replacementClass))return pR.replace(e);var n=RegExp(`${XS.cssPrefix}-.*`);if(delete i[0].attributes.id,i[0].attributes.class){var o=i[0].attributes.class.split(" ").reduce(function(e,t){return t===XS.replacementClass||t.match(n)?e.toSvg.push(t):e.toNode.push(t),e},{toNode:[],toSvg:[]});i[0].attributes.class=o.toSvg.join(" "),0===o.toNode.length?t.removeAttribute("class"):t.setAttribute("class",o.toNode.join(" "))}var r=i.map(function(e){return uy(e)}).join("\n");t.setAttribute(bS,""),t.innerHTML=r}};function fR(e){e()}function gR(e,t){var i="function"==typeof t?t:lR;if(0===e.length)i();else{var n=fR;"async"===XS.mutateApproach&&(n=CI.requestAnimationFrame||fR),n(function(){var t=!0===XS.autoReplaceSvg?pR.replace:pR[XS.autoReplaceSvg]||pR.replace,n=aR("mutate");e.map(t),n(),i()})}}var mR=!1;function TR(){mR=!0}
3function _R(){mR=!1}var ER=null;function bR(e){if(AI&&XS.observeMutations){var t=e.treeCallback,i=void 0===t?lR:t,n=e.nodeCallback,o=void 0===n?lR:n,r=e.pseudoElementsCallback,s=void 0===r?lR:r,a=e.observeMutationsRoot,l=void 0===a?kI:a;ER=new AI(function(e){if(!mR){var t=Ny();KS(e).forEach(function(e){if("childList"===e.type&&e.addedNodes.length>0&&!cR(e.addedNodes[0])&&(XS.searchPseudoElements&&s(e.target),i(e.target)),"attributes"===e.type&&e.target.parentNode&&XS.searchPseudoElements&&s([e.target],!0),"attributes"===e.type&&cR(e.target)&&~BS.indexOf(e.attributeName))if("class"===e.attributeName&&function(e){var t=e.getAttribute?e.getAttribute(vS):null,i=e.getAttribute?e.getAttribute(IS):null;return t&&i}(e.target)){var n=xy(qS(e.target)),r=n.prefix,a=n.iconName;e.target.setAttribute(vS,r||t),a&&e.target.setAttribute(IS,a)}else(function(e){return e&&e.classList&&e.classList.contains&&e.classList.contains(XS.replacementClass)})(e.target)&&o(e.target)})}}),wI&&ER.observe(l,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function OR(e){var t=e.getAttribute("style"),i=[];return t&&(i=t.split(";").reduce(function(e,t){var i=t.split(":"),n=i[0],o=i.slice(1);return n&&o.length>0&&(e[n]=o.join(":").trim()),e},{})),i}function vR(e){var t=e.getAttribute("data-prefix"),i=e.getAttribute("data-icon"),n=void 0===e.innerText?"":e.innerText.trim(),o=xy(qS(e));return o.prefix||=Ny(),t&&i&&(o.prefix=t,o.iconName=i),o.iconName&&o.prefix||(o.prefix&&n.length>0&&(o.iconName=function(e,t){return(vy[e]||{})[t]}(o.prefix,e.innerText)||ky(o.prefix,py(e.innerText))),!o.iconName&&XS.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(o.iconName=e.firstChild.data)),o}function IR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0},i=vR(e),n=i.iconName,o=i.prefix,r=i.rest,s=function(e){return KS(e.attributes).reduce(function(e,t){return"class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e},{})}(e),a=Gy("parseNodeAttributes",{},e);return fI({iconName:n,prefix:o,transform:YS,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:r,styles:t.styleParser?OR(e):[],attributes:s}},a)}var SR=sy.styles;function yR(e){var t="nest"===XS.autoReplaceSvg?IR(e,{styleParser:!1}):IR(e);return~t.extra.classes.indexOf(PS)?Xy("generateLayersText",e,t):Xy("generateSvgReplacementMutation",e,t)}function RR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!wI)return Promise.resolve();var i=kI.documentElement.classList,n=function(e){return i.add(`${SS}-${e}`)},o=function(e){return i.remove(`${SS}-${e}`)},r=XS.autoFetchSvg?[].concat(mI(nS),mI(fS)):xI.concat(Object.keys(SR));r.includes("fa")||r.push("fa");var s=[`.${PS}:not([${bS}])`].concat(r.map(function(e){return`.${e}:not([${bS}])`})).join(", ");if(0===s.length)return Promise.resolve();var a=[];try{a=KS(e.querySelectorAll(s))}catch{}if(!(a.length>0))return Promise.resolve();n("pending"),o("complete");var l=aR("onTree"),c=a.reduce(function(e,t){try{var i=yR(t);i&&e.push(i)}catch(e){CS||"MissingIcon"===e.name&&console.error(e)}return e},[]);return new Promise(function(e,i){Promise.all(c).then(function(i){gR(i,function(){n("active"),n("complete"),o("pending"),"function"==typeof t&&t(),l(),e()})}).catch(function(e){l(),i(e)})})}function CR(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;yR(e).then(function(e){e&&gR([e],t)})}function kR(e){return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(t||{}).icon?t:zy(t||{}),o=i.mask;return o&&=(o||{}).icon?o:zy(o||{}),e(n,fI(fI({},i),{},{mask:o}))}}var AR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.transform,n=void 0===i?YS:i,o=t.symbol,r=void 0!==o&&o,s=t.mask,a=void 0===s?null:s,l=t.maskId,c=void 0===l?null:l,u=t.classes,h=void 0===u?[]:u,d=t.attributes,p=void 0===d?{}:d,f=t.styles,g=void 0===f?{}:f;if(e){var m=e.prefix,T=e.iconName,_=e.icon;return Ky(fI({type:"icon"},e),function(){return Wy("beforeDOMElementCreation",{iconDefinition:e,params:t}),qy({icons:{main:eR(_),mask:a?eR(a.icon):{found:!1,width:null,height:null,icon:{}}},prefix:m,iconName:T,transform:fI(fI({},YS),n),symbol:r,maskId:c,extra:{attributes:p,styles:g,classes:h}})})}},LR={mixout:function(){return{icon:kR(AR)}},hooks:function(){return{mutationObserverCallbacks:function(e){return e.treeCallback=RR,e.nodeCallback=CR,e}}},provides:function(e){e.i2svg=function(e){var t=e.node,i=void 0===t?kI:t,n=e.callback;return RR(i,void 0===n?function(){}:n)},e.generateSvgReplacementMutation=function(e,t){var i=t.iconName,n=t.prefix,o=t.transform,r=t.symbol,s=t.mask,a=t.maskId,l=t.extra;return new Promise(function(t,c){Promise.all([iR(i,n),s.iconName?iR(s.iconName,s.prefix):Promise.resolve({foun
3d:!1,width:512,height:512,icon:{}})]).then(function(s){var c=gI(s,2),u=c[0],h=c[1];t([e,qy({icons:{main:u,mask:h},prefix:n,iconName:i,transform:o,symbol:r,maskId:a,extra:l,watchable:!0})])}).catch(c)})},e.generateAbstractIcon=function(e){var t,i=e.children,n=e.attributes,o=e.main,r=e.transform,s=ZS(e.styles);return s.length>0&&(n.style=s),ey(r)&&(t=Xy("generateAbstractTransformGrouping",{main:o,transform:r,containerWidth:o.width,iconWidth:o.width})),i.push(t||o.icon),{children:i,attributes:n}}}},NR={mixout:function(){return{layer:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.classes,n=void 0===i?[]:i;return Ky({type:"layer"},function(){Wy("beforeDOMElementCreation",{assembler:e,params:t});var i=[];return e(function(e){Array.isArray(e)?e.map(function(e){i=i.concat(e.abstract)}):i=i.concat(e.abstract)}),[{tag:"span",attributes:{class:[`${XS.cssPrefix}-layers`].concat(mI(n)).join(" ")},children:i}]})}}}},wR={mixout:function(){return{counter:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}
3,i=t.title,n=void 0===i?null:i,o=t.classes,r=void 0===o?[]:o,s=t.attributes,a=void 0===s?{}:s,l=t.styles,c=void 0===l?{}:l;return Ky({type:"counter",content:e},function(){return Wy("beforeDOMElementCreation",{content:e,params:t}),function(e){var t=e.content,i=e.extra,n=fI(fI({},i.attributes),{},{class:i.classes.join(" ")}),o=ZS(i.styles);o.length>0&&(n.style=o);var r=[];return r.push({tag:"span",attributes:n,children:[t]}),r}({content:e.toString(),title:n,extra:{attributes:a,styles:c,classes:[`${XS.cssPrefix}-layers-counter`].concat(mI(r))}})})}}}},$R={mixout:function(){return{text:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.transform,n=void 0===i?YS:i,o=t.classes,r=void 0===o?[]:o,s=t.attributes,a=void 0===s?{}:s,l=t.styles,c=void 0===l?{}:l;return Ky({type:"text",content:e},function(){return Wy("beforeDOMElementCreation",{content:e,params:t}),Jy({content:e,transform:fI(fI({},YS),n),extra:{attributes:a,styles:c,classes:[`${XS.cssPrefix}-layers-text`].concat(mI(r))}})})}}},provides:function(e){e.generateLayersText=function(e,t){var i=t.transform,n=t.extra,o=null,r=null;if($I){var s=parseInt(getComputedStyle(e).fontSize,10),a=e.getBoundingClientRect();o=a.width/s,r=a.height/s}return Promise.resolve([e,Jy({content:e.innerHTML,width:o,height:r,transform:i,extra:n,watchable:!0})])}}},MR=RegExp('"',"ug"),xR=[1105920,1112319],DR=fI(fI(fI(fI({},{FontAwesome:{normal:"fas",400:"fas"}}),{"Font Awesome 7 Free":{900:"fas",400:"far"},"Font Awesome 7 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 7 Brands":{400:"fab",normal:"fab"},"Font Awesome 7 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 7 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 7 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"},"Font Awesome 7 Jelly":{400:"fajr",normal:"fajr"},"Font Awesome 7 Jelly Fill":{400:"fajfr",normal:"fajfr"},"Font Awesome 7 Jelly Duo":{400:"fajdr",normal:"fajdr"},"Font Awesome 7 Slab":{400:"faslr",normal:"faslr"},"Font Awesome 7 Slab Press":{400:"faslpr",normal:"faslpr"},"Font Awesome 7 Thumbprint":{300:"fatl",normal:"fatl"},"Font Awesome 7 Notdog":{900:"fans",normal:"fans"},"Font Awesome 7 Notdog Duo":{900:"fands",normal:"fands"},"Font Awesome 7 Etch":{900:"faes",normal:"faes"},"Font Awesome 7 Graphite":{100:"fagt",normal:"fagt"},"Font Awesome 7 Chisel":{400:"facr",normal:"facr"},"Font Awesome 7 Whiteboard":{600:"fawsb",normal:"fawsb"},"Font Awesome 7 Utility":{600:"fausb",normal:"fausb"},"Font Awesome 7 Utility Duo":{600:"faudsb",normal:"faudsb"},"Font Awesome 7 Utility Fill":{600:"faufsb",normal:"faufsb"}}),{"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}}),{"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}}),PR=Object.keys(DR).reduce(function(e,t){return e[t.toLowerCase()]=DR[t],e},{}),FR=Object.keys(PR).reduce(function(e,t){var i=PR[t];return e[t]=i[900]||mI(Object.entries(i))[0][1],e},{});function BR(e,t){var i=`data-fa-pseudo-element-pending${t.replace(":","-")}`;return new Promise(function(n,o){if(null!==e.getAttribute(i))return n();var r=KS(e.children).filter(function(e){return e.getAttribute(OS)===t})[0],s=CI.getComputedStyle(e,t),a=s.getPropertyValue("font-family"),l=a.match(FS),c=s.getPropertyValue("font-weight"),u=s.getPropertyValue("content");if(r&&!l)return e.removeChild(r),n();if(l&&"none"!==u&&""!==u){var h=s.getPropertyValue("content"),d=function(e,t){var i=e.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(t),o=isNaN(n)?"normal":n;return(PR[i]||{})[o]||FR[i]}(a,c),p=function(e){return py(mI(e.replace(MR,""))[0]||"")}(h),f=l[0].startsWith("FontAwesome"),g=function(e){var t=e.getPropertyValue("font-feature-settings").includes("ss01"),i=e.getPropertyValue("content").replace(MR,""),n=i.codePointAt(0),o=n>=xR[0]&&n<=xR[1],r=2===i.length&&i[0]===i[1];return o||r||t}(s),m=ky(d,p),T=m;if(f){var _=function(e){var t=Sy[e],i=ky("fas",e);return t||(i?{prefix:"fas",iconName:i}:null)||{prefix:null,iconName:null}}(p);_.iconName&&_.prefix&&(m=_.iconName,d=_.prefix)}if(!m||g||r&&r.getAttribute(vS)===d&&r.getAttribute(IS)===T)n();else{e.setAttribute(i,T),r&&e.removeChild(r);var E={iconName:null,prefix:null,transform:YS,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},b=E.extra;b.attributes[OS]=t,iR(m,d).then(function(o){var r=qy(fI(fI({},E),{},{icons:{main:o,mask:{prefix:null,iconName:null,rest:[]}},prefix:d,iconName:T,extra:b,watchable:!0})),s=kI.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(s,e.firstChild):e.appendChild(s),s.outerHTML=r.map(function(e){return uy(e)}).join("\n"),e.removeAttribute(i),n()}).catch(o)}}else n()})}function UR(e){return Promise.all([BR(e,"::before"),BR(e,"::after")])}function HR(e){return!(e.parentNode===document.head||~yS.indexOf(e.tagName.toUpperCase())||e.getAttribute(OS)||e.parentNode&&"svg"===e.parentNode.tagName)}var VR=function(e){return!!e&&RS.some(function(t){return e.includes(t)})},GR=function(e){if(!e)return[];
3var t=new Set,i=e.split(/,(?![^()]*\))/).map(function(e){return e.trim()});i=i.flatMap(function(e){return e.includes("(")?e:e.split(",").map(function(e){return e.trim()})});var n,o=hI(i);try{for(o.s();!(n=o.n()).done;){var r=n.value;if(VR(r)){var s=RS.reduce(function(e,t){return e.replace(t,"")},r);""!==s&&"*"!==s&&t.add(s)}}}catch(e){o.e(e)}finally{o.f()}return t};function WR(e){if(wI){var t;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])t=e;else if(XS.searchPseudoElementsFullScan)t=e.querySelectorAll("*");else{var i,n=new Set,o=hI(document.styleSheets);try{for(o.s();!(i=o.n()).done;){var r=i.value;try{var s,a=hI(r.cssRules);try{for(a.s();!(s=a.n()).done;){var l,c=s.value,u=hI(GR(c.selectorText));try{for(u.s();!(l=u.n()).done;){var h=l.value;n.add(h)}}catch(e){u.e(e)}finally{u.f()}}}catch(e){a.e(e)}finally{a.f()}}catch(e){XS.searchPseudoElementsWarnings&&console.warn(`Font Awesome: cannot parse stylesheet: ${r.href} (${e.message})\nIf it declares any Font Awesome CSS pseudo-elements, they will not be rendered as SVG icons. Add crossorigin="anonymous" to the <link>, enable searchPseudoElementsFullScan for slower but more thorough DOM parsing, or suppress this warning by setting searchPseudoElementsWarnings to false.`)}}}catch(e){o.e(e)}finally{o.f()}if(!n.size)return;var d=Array.from(n).join(", ");try{t=e.querySelectorAll(d)}catch{}}return new Promise(function(e,i){var n=KS(t).filter(HR).map(UR),o=aR("searchPseudoElements");TR(),Promise.all(n).then(function(){o(),_R(),e()}).catch(function(){o(),_R(),i()})})}}var XR={hooks:function(){return{mutationObserverCallbacks:function(e){return e.pseudoElementsCallback=WR,e}}},provides:function(e){e.pseudoElements2svg=function(e){var t=e.node,i=void 0===t?kI:t;XS.searchPseudoElements&&WR(i)}}},zR=!1,jR={mixout:function(){return{dom:{unwatch:function(){TR(),zR=!0}}}},hooks:function(){return{bootstrap:function(){bR(Gy("mutationObserverCallbacks",{}))},noAuto:function(){ER&&ER.disconnect()},watch:function(e){var t=e.observeMutationsRoot;zR?_R():bR(Gy("mutationObserverCallbacks",{observeMutationsRoot:t}))}}}},YR=function(e){return e.toLowerCase().split(" ").reduce(function(e,t){var i=t.toLowerCase().split("-"),n=i[0],o=i.slice(1).join("-");if(n&&"h"===o)return e.flipX=!0,e;if(n&&"v"===o)return e.flipY=!0,e;if(o=parseFloat(o),isNaN(o))return e;switch(n){case"grow":e.size+=o;break;case"shrink":e.size-=o;break;case"left":e.x-=o;break;case"right":e.x+=o;break;case"up":e.y-=o;break;case"down":e.y+=o;break;case"rotate":e.rotate+=o}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0})},QR={mixout:function(){return{parse:{transform:function(e){return YR(e)}}}},hooks:function(){return{parseNodeAttributes:function(e,t){var i=t.getAttribute("data-fa-transform");return i&&(e.transform=YR(i)),e}}},provides:function(e){e.generateAbstractTransformGrouping=function(e){var t=e.main,i=e.transform,n=e.containerWidth,o=e.iconWidth,r={outer:{transform:`translate(${n/2} 256)`},inner:{transform:`translate(${32*i.x}, ${32*i.y}) scale(${i.size/16*(i.flipX?-1:1)}, ${i.size/16*(i.flipY?-1:1)}) rotate(${i.rotate} 0 0)`},path:{transform:`translate(${o/2*-1} -256)`}};return{tag:"g",attributes:fI({},r.outer),children:[{tag:"g",attributes:fI({},r.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:fI(fI({},t.icon.attributes),r.path)}]}]}}}},KR={x:0,y:0,width:"100%",height:"100%"};function qR(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}function JR(e){return"g"===e.tag?e.children:[e]}!function(e,t){var i=t.mixoutsTo;By=e,Uy={},Object.keys(Hy).forEach(function(e){-1===Vy.indexOf(e)&&delete Hy[e]}),By.forEach(function(e){var t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(function(e){"function"==typeof t[e]&&(i[e]=t[e]),"object"===_I(t[e])&&Object.keys(t[e]).forEach(function(n){i[e]||(i[e]={}),i[e][n]=t[e][n]})}),e.hooks){var n=e.hooks();Object.keys(n).forEach(function(e){Uy[e]||(Uy[e]=[]),Uy[e].push(n[e])})}e.provides&&e.provides(Hy)})}([oy,LR,NR,wR,$R,XR,jR,QR,{hooks:function(){return{parseNodeAttributes:function(e,t){var i=t.getAttribute("data-fa-mask"),n=i?xy(i.split(" ").map(function(e){return e.trim()})):{prefix:null,iconName:null,rest:[]};return n.prefix||=Ny(),e.mask=n,e.maskId=t.getAttribute("data-fa-mask-id"),e}}},provides:function(e){e.generateAbstractMask=function(e){var t=e.children,i=e.attributes,n=e.main,o=e.mask,r=e.maskId,s=e.transform,a=n.width,l=n.icon,c=o.width,u=o.icon,h=function(e){var t=e.transform,i=e.containerWidth,n=e.iconWidth;return{outer:{transform:`translate(${i/2} 256)`},inner:{transform:`translate(${32*t.x}, ${32*t.y}) scale(${t.size/16*(t.flipX?-1:1)}, ${t.size/16*(t.flipY?-1:1)}) rotate(${t.rotate} 0 0)`},path:{transform:`translate(${n/2*-1} -256)`}}}({transform:s,containerWidth:c,iconWidth:a}),d={tag:"rect",attributes:fI(fI({},KR),{},{fill:"white"})},p=l.children?{children:l.children.map(qR)}:{},f={tag:"g",attributes:fI({},h.inner),children:[qR(fI({tag:l.tag,attributes:fI(fI({},l.attributes),h.path)},p))]},g={tag:"g",attributes:fI({},h.outer),children:[f]},m=`mask-${r||QS()}`,T=`clip-${r||QS()}`,_={tag:"mask",attributes:fI(fI({},KR),{},{id:m,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[d,g]},E={tag:"defs",children:[{tag:"clipPath",attributes:{id:T}
3,children:JR(u)},_]};return t.push(E,{tag:"rect",attributes:fI({fill:"currentColor","clip-path":`url(#${T})`,mask:`url(#${m})`},KR)}),{children:t,attributes:i}}}},{provides:function(e){var t=!1;CI.matchMedia&&(t=CI.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){var e=[],i={fill:"currentColor"},n={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:fI(fI({},i),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});var o=fI(fI({},n),{},{attributeName:"opacity"}),r={tag:"circle",attributes:fI(fI({},i),{},{cx:"256",cy:"364",r:"28"}),children:[]};return t||r.children.push({tag:"animate",attributes:fI(fI({},n),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:fI(fI({},o),{},{values:"1;0;1;1;0;1;"})}),e.push(r),e.push({tag:"path",attributes:fI(fI({},i),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:t?[]:[{tag:"animate",attributes:fI(fI({},o),{},{values:"1;0;0;0;0;1;"})}]}),t||e.push({tag:"path",attributes:fI(fI({},i),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:fI(fI({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:e}}}},{hooks:function(){return{parseNodeAttributes:function(e,t){var i=t.getAttribute("data-fa-symbol");return e.symbol=null!==i&&(""===i||i),e}}}}],{mixoutsTo:Yy});var ZR=Yy.parse,eC=Yy.icon;function tC(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function iC(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function nC(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function oC(e){for(var t=1;t<arguments.length;t++){var i=null==arguments[t]?{}:arguments[t];t%2?nC(Object(i),!0).forEach(function(t){iC(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nC(Object(i)).forEac
3h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function rC(e,t){if(null==e)return{};var i,n,o=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;i[n]=e[n]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)i=r[n],-1===t.indexOf(i)&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function sC(e){return function(e){if(Array.isArray(e))return tC(e)}(e)||function(e){if(typeof Symbol<"u"&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return tC(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?tC(e,t):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aC(e){return aC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aC(e)}function lC(e,t){return Array.isArray(t)&&t.length>0||!Array.isArray(t)&&t?iC({},e,t):{}}var cC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uC={exports:{}};!function(e){!function(t){var i=function(e,t,n){if(!l(t)||u(t)||h(t)||d(t)||a(t))return t;var o,r=0,s=0;if(c(t))for(o=[],s=t.length;r<s;r++)o.push(i(e,t[r],n));else for(var p in o={},t)Object.prototype.hasOwnProperty.call(t,p)&&(o[e(p,n)]=i(e,t[p],n));return o},n=function(e){return p(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),e.substr(0,1).toLowerCase()+e.substr(1))},o=function(e){var t=n(e);return t.substr(0,1).toUpperCase()+t.substr(1)},r=function(e,t){return function(e,t){t||={};var i=t.separator||"_",n=t.split||/(?=[A-Z])/;return e.split(n).join(i)}(e,t).toLowerCase()},s=Object.prototype.toString,a=function(e){return"function"==typeof e},l=function(e){return e===Object(e)},c=function(e){return"[object Array]"==s.call(e)},u=function(e){return"[object Date]"==s.call(e)},h=function(e){return"[object RegExp]"==s.call(e)},d=function(e){return"[object Boolean]"==s.call(e)},p=function(e){return(e-=0)==e},f=function(e,t){var i=t&&"process"in t?t.process:t;return"function"==typeof i?function(t,n){return i(t,e,n)}:e},g={camelize:n,decamelize:r,pascalize:o,depascalize:r,camelizeKeys:function(e,t){return i(f(n,t),e)},decamelizeKeys:function(e,t){return i(f(r,t),e,t)},pascalizeKeys:function(e,t){return i(f(o,t),e)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};e.exports?e.exports=g:t.humps=g}(cC)}(uC);var hC=uC.exports,dC=["gradientFill"],pC=["class","style"],fC=["type","stops","id"];function gC(e,t){return rr("stop",oC({key:`${t}-${e.offset}`,offset:e.offset,"stop-color":e.color},void 0!==e.opacity&&{"stop-opacity":e.opacity}))}function mC(e){if("string"==typeof e)return e;var t=(e.children||[]).map(mC);return"path"===e.tag&&e.attributes&&"fill"in e.attributes?oC(oC({},e),{},{attributes:oC(oC({},e.attributes),{},{fill:void 0}),children:t}):oC(oC({},e),{},{children:t})}function TC(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof e)return e;var n=t.gradientFill,o=void 0===n?null:n,r=rC(t,dC),s=o||"fill"in i?mC(e):e,a=(s.children||[]).map(function(e){return TC(e,{},{})}),l=Object.keys(s.attributes||{}).reduce(function(e,t){var i=s.attributes[t];switch(t){case"class":e.class=function(e){return e.split(/\s+/).reduce(function(e,t){return e[t]=!0,e},{})}(i);break;case"style":e.style=function(e){return e.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var i=t.indexOf(":");return e[hC.camelize(t.slice(0,i))]=t.slice(i+1).trim(),e},{})}(i);break;default:e.attrs[t]=i}return e},{attrs:{},class:{},style:{}});i.class;var c=i.style,u=void 0===c?{}:c,h=rC(i,pC);if(o&&o.id&&("linear"===o.type||"radial"===o.type)){var d=o.type,p=o.stops,f=void 0===p?[]:p,g=o.id,m=rr("linear"===d?"linearGradient":"radialGradient",oC(oC({},rC(o,fC)),{},{id:g}),f.map(gC));return rr(s.tag,oC(oC(oC(oC({},r),{},{class:l.class,style:oC(oC({},l.style),u)},l.attrs),h),{},{fill:`url(#${g})`}),[m].concat(sC(a)))}return rr(e.tag,oC(oC(oC({},r),{},{class:l.class,style:oC(oC({},l.style),u)},l.attrs),h),a)}var _C=!1;try{_C=!0}catch{}function EC(){var e;!_C&&console&&"function"==typeof console.error&&(e=console).error.apply(e,arguments)}function bC(e){return e&&"object"===aC(e)&&e.prefix&&e.iconName&&e.icon?e:ZR.icon?ZR.icon(e):null===e?null:"object"===aC(e)&&e.prefix&&e.iconName?e:Array.isArray(e)&&2===e.length?{prefix:e[0],iconName:e[1]}:"string"==typeof e?{prefix:"fas",iconName:e}:void 0}var OC=xi({name:"FontAwesomeIcon",props:{border:{type:Boolean,default:!1},fixedWidth:{type:Boolean,default:!1},flip:{type:[Boolean,String],default:!1,validator:function(e){return[!0,
3!1,"horizontal","vertical","both"].indexOf(e)>-1}},icon:{type:[Object,Array,String],required:!0},mask:{type:[Object,Array,String],default:null},maskId:{type:String,default:null},listItem:{type:Boolean,default:!1},pull:{type:String,default:null,validator:function(e){return["right","left"].indexOf(e)>-1}},pulse:{type:Boolean,default:!1},rotation:{type:[String,Number],default:null,validator:function(e){return[90,180,270].indexOf(Number.parseInt(e,10))>-1}},rotateBy:{type:Boolean,default:!1},swapOpacity:{type:Boolean,default:!1},size:{type:String,default:null,validator:function(e){return["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"].indexOf(e)>-1}},spin:{type:Boolean,default:!1},transform:{type:[String,Object],default:null},symbol:{type:[Boolean,String],default:!1},title:{type:String,default:null},titleId:{type:String,default:null},inverse:{type:Boolean,default:!1},bounce:{type:Boolean,default:!1},shake:{type:Boolean,default:!1},beat:{type:Boolean,default:!1},fade:{type:Boolean,default:!1},beatFade:{type:Boolean,default:!1},flash:{type:Boolean,default:!1},spinPulse:{type:Boolean,default:!1},spinReverse:{type:Boolean,default:!1},widthAuto:{type:Boolean,default:!1},gradientFill:{type:Object,default:null,validator:function(e){return"string"==typeof e.id&&e.id?"linear"===e.type||"radial"===e.type||(console.warn('FontAwesomeIcon: gradientFill.type must be "linear" or "radial"'),!1):(console.warn("FontAwesomeIcon: gradientFill.id must be a non-empty string"),!1)}}},setup:function(e,t){var i=t.attrs,n=or(function(){return bC(e.icon)}),o=or(function(){return lC("classes",function(e){var t,i=(iC(iC(iC(iC(iC(iC(iC(iC(iC(iC(t={"fa-spin":e.spin,"fa-pulse":e.pulse,"fa-fw":e.fixedWidth,"fa-border":e.border,"fa-li":e.listItem,"fa-inverse":e.inverse,"fa-flip":!0===e.flip,"fa-flip-horizontal":"horizontal"===e.flip||"both"===e.flip,"fa-flip-vertical":"vertical"===e.flip||"both"===e.flip},`fa-${e.size}`,null!==e.size),`fa-rotate-${e.rotation}`,null!==e.rotation),"fa-rotate-by",e.rotateBy),`fa-pull-${e.pull}`,null!==e.pull),"fa-swap-opacity",e.swapOpacity),"fa-bounce",e.bounce),"fa-shake",e.shake),"fa-beat",e.beat),"fa-fade",e.fade),"fa-beat-fade",e.beatFade),iC(iC(iC(iC(t,"fa-flash",e.flash),"fa-spin-pulse",e.spinPulse),"fa-spin-reverse",e.spinReverse),"fa-width-auto",e.widthAuto));return Object.keys(i).map(function(e){return i[e]?e:null}).filter(function(e){return e})}(e))}),r=or(function(){return lC("transform","string"==typeof e.transform?ZR.transform(e.transform):e.transform)}),s=or(function(){return lC("mask",bC(e.mask))}),a=or(function(){var t=oC(oC(oC(oC({},o.value),r.value),s.value),{},{symbol:e.symbol,maskId:e.maskId});return t.title=e.title,t.titleId=e.titleId,eC(n.value,t)});_i(a,function(e){if(!e)return EC("Could not find one or more icon(s)",n.value,s.value)},{immediate:!0}),e.gradientFill&&e.symbol&&EC("gradientFill is not supported when symbol is true and will be ignored");var l=or(function(){return a.value?TC(a.value.abstract[0],{gradientFill:e.symbol?null:e.gradientFill},i):null});return function(){return l.value}}}),vC=xi({__name:"BaseIcon",props:{icon:{}},setup(e){let t={faArrowRightArrowLeft:sI,faArrowUpArrowDown:lI,faCode:Qv,faCodeSimple:Zv,faDownload:rI,faMoon:iI,faPause:aI,faPlay:qv,farEar:jv,faPuzzlePiece:Jv,faRotateLeft:oI,faSpinnerScale:Yv,faSunBright:eI,faXmark:tI,faGear:Kv,faLock:nI};return(i,n)=>(Oo(),Ro(Dt(OC),{icon:t[e.icon],class:"icon"},null,8,["icon"]))}}),IC=["aria-label"],SC=xi({__name:"BaseButton",props:{icon:{},selected:{type:Boolean},iconView:{type:Boolean},ariaLabel:{}},setup:e=>(t,i)=>(Oo(),yo("button",{class:ee(["button",{"--selected":e.selected,"--icon":!t.$slots.default}]),"aria-label":e.ariaLabel},[cn(t.$slots,"default",{},void 0,!0),e.icon?(Oo(),Ro(vC,{key:0,icon:e.icon},null,8,["icon"])):Do("",!0)],10,IC))}),yC=(e,t)=>{let i=e.__vccOpts||e;for(let[n,o]of t)i[n]=o;return i},RC=yC(SC,[["__scopeId","data-v-a3f12d37"]]),CC={class:"input"},kC={key:0,class:"input-label"},AC=["type"],LC=yC(xi({__name:"BaseInput",props:mn({label:{},type:{},textarea:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){let t=$n(e,"modelValue");return(i,n)=>(Oo(),yo("label",CC,[e.label?(Oo(),yo("div",kC,ce(e.label),1)):Do("",!0),e.textarea?fi((Oo(),yo("textarea",{key:1,"onUpdate:modelValue":n[0]||=e=>t.value=e,class:"input-input"},null,512)),[[Hr,t.value]]):fi((Oo(),yo("input",{key:2,"onUpdate:modelValue":n[1]||=e=>t.value=e,class:"input-input",type:e.type},null,8,AC)),[[Qr,t.value]])]))}}),[["__scopeId","data-v-0860d2f8"]]),NC=["aria-label"],wC={class:"dialog-header"},$C={class:"dialog-title"},MC={class:"dialog-content"},xC={class:"dialog-prompt"},DC={class:"dialog-actions"},PC=yC(xi({__name:"InputDialog",props:{visible:{type:Boolean},prompt:{default:"Skriv inn en verdi:"},title:{default:"Brukerinndata"},confirmOnly:{type:Boolean,default:!1}},emits:["submit","cancel","update:visible"],setup(e,{emit:t}){let i=mi("brikkeTeleportTarget","body"),n=e,o=t,r=wt(""),s=wt(null),a=wt(null);_i(()=>n.visible,async e=>{e&&(r.value="",await ni(),n.confirmOnly?(a.value?.$el)?.focus():(s.value?.$el.querySelector("input"))?.focu
3s())});let l=()=>{o("submit",r.value),o("update:visible",!1)},c=()=>{o("cancel"),o("update:visible",!1)},u=e=>{"Enter"===e.key?(e.preventDefault(),l()):"Escape"===e.key&&(e.preventDefault(),c())},h=e=>{e.target===e.currentTarget&&c()},d=e=>{n.visible&&u(e)};return qi(()=>{document.addEventListener("keydown",d)}),tn(()=>{document.removeEventListener("keydown",d)}),(t,n)=>(Oo(),Ro(Li,{to:Dt(i)},[e.visible?(Oo(),yo("div",{key:0,class:"dialog-overlay",onClick:h},[No("div",{class:"dialog",role:"dialog","aria-modal":"true","aria-label":e.prompt},[No("div",wC,[No("h3",$C,ce(e.title),1)]),No("div",MC,[No("p",xC,ce(e.prompt),1),e.confirmOnly?Do("",!0):(Oo(),Ro(LC,{key:0,ref_key:"inputRef",ref:s,modelValue:r.value,"onUpdate:modelValue":n[0]||=e=>r.value=e,onKeydown:u},null,8,["modelValue"]))]),No("div",DC,[wo(RC,{onClick:c},{default:pi(()=>[...n[1]||=[Mo("Avbryt",-1)]]),_:1}),wo(RC,{ref_key:"confirmButtonRef",ref:a,class:"primary-button",onClick:l},{default:pi(()=>[...n[2]||=[Mo(" OK ",-1)]]),_:1},512)])],8,NC)])):Do("",!0)],8,["to"]))}}
3),[["__scopeId","data-v-d7b7bd58"]]);function FC(e){return{kind:"categoryToolbox",contents:[{kind:"category",name:e.turtle,colour:"160",contents:[{kind:"block",type:"turtle_speed",inputs:{SPEED:{block:{type:"math_number",fields:{NUM:5}}}}},{kind:"block",type:"turtle_move",inputs:{STEPS:{block:{type:"math_number",fields:{NUM:50}}}}},{kind:"block",type:"turtle_forward",inputs:{STEPS:{block:{type:"math_number",fields:{NUM:50}}}}},{kind:"block",type:"turtle_backward",inputs:{STEPS:{block:{type:"math_number",fields:{NUM:50}}}}},{kind:"block",type:"turtle_turn",inputs:{DEG:{block:{type:"math_number",fields:{NUM:90}}}}},{kind:"block",type:"turtle_left",inputs:{DEG:{block:{type:"math_number",fields:{NUM:90}}}}},{kind:"block",type:"turtle_right",inputs:{DEG:{block:{type:"math_number",fields:{NUM:90}}}}},{kind:"block",type:"turtle_color"},{kind:"block",type:"turtle_color_input"},{kind:"block",type:"turtle_width",inputs:{WIDTH:{block:{type:"math_number",fields:{NUM:2}}}}},{kind:"block",type:"turtle_begin_fill"},{kind:"block",type:"turtle_end_fill"},{kind:"block",type:"turtle_circle",inputs:{R:{block:{type:"math_number",fields:{NUM:50}}}}},{kind:"block",type:"turtle_goto",inputs:{X:{block:{type:"math_number",fields:{NUM:0}}},Y:{block:{type:"math_number",fields:{NUM:0}}}}}]},{kind:"category",name:e.logic,colour:"210",contents:[{kind:"block",type:"controls_if"},{kind:"block",type:"logic_compare"},{kind:"block",type:"logic_operation"},{kind:"block",type:"logic_negate"},{kind:"block",type:"logic_boolean"}]},{kind:"category",name:e.loops,colour:"120",contents:[{kind:"block",type:"controls_repeat_ext",inputs:{TIMES:{block:{type:"math_number",fields:{NUM:4}}}}},{kind:"block",type:"controls_whileUntil"}]},{kind:"category",name:e.math,colour:"230",contents:[{kind:"block",type:"math_number"},{kind:"block",type:"math_arithmetic"},{kind:"block",type:"math_number_property"},{kind:"block",type:"math_modulo"},{kind:"block",type:"math_random_int"}]},{kind:"category",name:e.text,colour:"160",contents:[{kind:"block",type:"text"},{kind:"block",type:"text_join"},{kind:"block",type:"text_print"}]},{kind:"category",name:e.color,colour:"20",contents:[{kind:"block",type:"colour_picker"},{kind:"block",type:"colour_random"}]},{kind:"category",name:e.variables,colour:"330",custom:"VARIABLE"}]}}var BC,UC,HC,VC,GC,WC,XC,zC,jC,YC,QC,KC,qC,JC,ZC,ek,tk,ik,nk,ok,rk,sk,ak,lk,ck,uk,hk,dk,pk,fk,gk,mk,Tk,_k,Ek,bk,Ok,vk,Ik,Sk,yk,Rk,Ck,kk,Ak,Lk,Nk,wk,$k,Mk,xk,Dk,Pk,Fk,Bk,Uk,Hk,Vk,Gk,Wk,Xk,zk,jk,Yk,Qk,Kk,qk,Jk,Zk,eA,tA,iA,nA,oA,rA,sA,aA,lA,cA,uA,hA,dA,pA,fA,gA,mA,TA,_A,EA,bA,OA,vA,IA,SA,yA,RA,CA,kA,AA,LA,NA,wA,$A,MA,xA,DA,PA,FA,BA,UA,HA,VA,GA,WA,XA,zA,jA,YA,QA,KA,qA,JA,ZA,eL,tL,iL,nL,oL,rL,sL,aL,lL,cL,uL,hL,dL,pL,fL,gL,mL,TL,_L,EL,bL,OL,vL,IL,SL,yL,RL,CL,kL,AL,LL,NL,wL,$L,ML,xL,DL,PL,FL,BL,UL,HL,VL,GL,WL,XL=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof e?t.exports=n():i.Blockly=n()}(e,function(){var e,t,i,n,o,r,s,a,l,c,u,h,d,p,f,g,m,T,_,E,b,O,v,I,S,y,R,C,k,A,L,N,w,$,M,x,D,P,F,B,U,H,V,G,W,X,z,j,Y,Q,K,q,J,Z,ee,te,ie,ne,oe,re,se,ae,le,ce,ue,he,de,pe,fe,ge,me,Te,_e,Ee,be,Oe,ve,Ie,Se,
3ye,Re,Ce,ke,Ae,Le,Ne,we,$e,Me,xe,De,Pe,Fe,Be,Ue,He,Ve,Ge,We,Xe,ze,je,Ye,Qe,Ke,qe,Je,Ze,et,tt,it,nt,ot,rt,st,at,lt,ct,ut,ht,dt,pt,ft,gt,mt,Tt,_t,Et,bt,Ot,vt,It,St,yt,Rt,Ct,kt,At,Lt,Nt,wt,$t,Mt,xt,Dt,Pt,Ft,Bt,Ut,Ht,Vt,Gt,Wt,Xt,zt,jt,Yt,Qt,Kt,qt,Jt,Zt,ei,ti,ii,ni,oi,ri,si,ai,li,ci,ui,hi,di,pi,fi,gi,mi,Ti,_i,Ei,bi,Oi,vi,Ii,Si,yi,Ri,Ci,ki,Ai,Li,Ni,wi,$i,Mi,xi,Di,Pi,Fi,Bi,Ui,Hi,Vi,Gi,Wi,Xi,zi,ji,Yi,Qi,Ki,qi,Ji,Zi,en,tn,nn,on,rn,sn,an,ln,cn,un,hn,dn,pn,fn,gn,mn,Tn,_n,En,bn,On,vn,In,Sn,yn,Rn,Cn,kn,An,Ln,Nn,wn,$n,Mn,xn,Dn,Pn,Fn,Bn,Un,Hn,Vn,Gn,Wn,Xn,zn,jn,Yn,Qn,Kn,qn,Jn,Zn,eo,to,io,no,oo,ro,so,ao,lo,co,uo,ho,po,fo,go,mo,To,_o,Eo,bo,Oo,vo,Io,So,yo,Ro,Co,ko,Ao,Lo,No,wo,$o,Mo,xo,Do,Po,Fo,Bo,Uo,Ho,Vo,Go,Wo,Xo,zo,jo,Yo,Qo,Ko,qo,Jo,Zo,er,tr,ir,nr,or,rr,sr,ar,lr,cr,ur,hr,dr,pr,fr,gr,mr,Tr,_r,Er,br,Or,vr,Ir,Sr,yr,Rr,Cr,kr,Ar,Lr,Nr,wr,$r,Mr,xr,Dr,Pr,Fr,Br,Ur,Hr,Vr,Gr,Wr,Xr,zr,jr,Yr,Qr,Kr,qr,Jr,Zr,es,ts,is,ns,os,rs,ss,as,ls,cs,us,hs,ds,ps,fs,gs,ms,Ts,_s,Es,bs,Os,vs,Is,Ss,ys,Rs,Cs,ks,As,Ls,Ns,ws,$s,Ms,xs,Ds,Ps,Fs,Bs,Us,Hs,Vs,Gs,Ws,Xs={},zs=function(e,t,i,n){if(!(e instanceof ka)&&"string"!=typeof e||""===`${e}`.trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=`${e}`.toLowerCase(),"string"!=typeof t||""===t.trim())throw Error('Invalid name "'+t+'". The name must be a non-empty string.');let o=t.toLowerCase();if(!i)throw Error("Can not register a null value");let r=Sa[e],s=Ra[e];if(r||(r=Sa[e]=Object.create(null),s=Ra[e]=Object.create(null)),js(e,i),!n&&r[o]&&r[o]!==i)throw Error('Name "'+o+'" with type "'+e+'" already registered.');r[o]=i,s[o]=t},js=function(e,t){if(e===String(ka.FIELD))if("function"!=typeof t.fromJson)throw Error('Type "'+e+'" must have a fromJson function')},Ys=function(e,t){e=`${e}`.toLowerCase(),t=t.toLowerCase();let i=Sa[e];i&&i[t]?(delete Sa[e][t],delete Ra[e][t]):console.warn("Unable to unregister ["+t+"]["+e+"] from the registry.")},Qs=function(e,t,i){e=`${e}`.toLowerCase(),t=t.toLowerCase();let n=Sa[e];if(!n||!n[t]){if(t="Unable to find ["+t+"]["+e+"] in the registry.",i)throw Error(t+" You must require or register a "+e+" plugin.");return console.warn(t),null}return n[t]},Ks=function(e,t){return e=`${e}`.toLowerCase(),t=t.toLowerCase(),!!(e=Sa[e])&&!!e[t]},qs=function(e,t,i){return Qs(e,t,i)},Js=function(e,t,i){return Qs(e,t,i)},Zs=function(e,t,i){e=`${e}`.toLowerCase();var n=Sa[e];if(!n){if(n=`Unable to find [${e}] in the registry.`,i)throw Error(`${n} You must require or register a ${e} plugin.`);return console.warn(n),null}if(!t)return n;e=Ra[e],i=Object.create(null);for(let o of Object.keys(n))i[e[o]]=n[o];return i},ea=function(e,t,i){return"function"==typeof(t=t.plugins[String(e)]||Ca)?t:qs(e,t,i)},ta=function(e,t){ia(),Xa=setTimeout(function(){t&&t.handleRightClick(e)},Ha)},ia=function(){Xa&&=(clearTimeout(Xa),0)},na=function(){Ga=null},oa=function(e){return!e.type.startsWith("pointer")||e instanceof PointerEvent&&sa(e)},ra=function(e){return`${e.pointerId}`},sa=function(e){let t=ra(e);return Ga?Ga===t:"pointerdown"===e.type&&(Ga=t,!0)},aa=function(e,t,i,n,o,r){function s(e){(o||oa(e))&&(i?n.call(i,e):n(e))}let a=[];if(t in Wa)for(let l=0;l<Wa[t].length;l++){let i=Wa[t][l];e.addEventListener(i,s,Object.assign({},{capture:!1},r)),a.push([e,i,s])}else e.addEventListener(t,s,Object.assign({},{capture:!1},r)),a.push([e,t,s]);return a},la=function(e,t,i,n,o){function r(e){i?n.call(i,e):n(e)}let s=[];if(t in Wa)for(let a=0;a<Wa[t].length;a++){let i=Wa[t][a];e.addEventListener(i,r,Object.assign({},{capture:!1},o)),s.push([e,i,r])}else e.addEventListener(t,r,Object.assign({},{capture:!1},o)),s.push([e,t,r]);return s},ca=function(e){let t=e[e.length-1][2];for(;e.length;){let[t,i,n]=e.pop();t.removeEventListener(i,n,!1)}return t},ua=function(e){if(e.target instanceof HTMLElement){if(e.target.isContentEditable||"true"===e.target.getAttribute("data-is-text-input"))return!0;if(e.target instanceof HTMLInputElement)return"text"===(e=e.target).type||"number"===e.type||"email"===e.type||"password"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type;if(e.target instanceof HTMLTextAreaElement)return!0}return!1},ha=function(e){return!(!e.ctrlKey||!el)||2===e.button},da=function(e,t,i){let n=t.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,i||=t.getScreenCTM().inverse(),n.matrixTransform(i)},pa=function(e){switch(e.deltaMode){default:return{x:e.deltaX,y:e.deltaY};case 1:return{x:e.deltaX*nl,y:e.deltaY*nl};case 2:return{x:e.deltaX*ol,y:e.deltaY*ol}}},fa=function(){return"blockly-"+(cl++).toString(36)},ga=function(){return ll.genUid()},ma=function(e){return e.type===ja.BLOCK_CREATE},Ta=function(e){return e.type===ja.BLOCK_DELETE},_a=function(e){return e.type===ja.BLOCK_CHANGE},Ea=function(e){return e.type===ja.BLOCK_FIELD_INTERMEDIATE_CHANGE},ba=function(e){return e.type===ja.BLOCK_MOVE},Oa=function(e){return e.type===ja.CLICK},va=function(e){return e.type===ja.BUBBLE_OPEN},Ia=function(e){return e.type===ja.VIEWPORT_CHANGE};Xs.setRecordUndo$$module$build$src$core$events$utils=function(e){pl=e},e=function(){return pl},t=function(e){Tl.fireInternal(e)},i=function(e){if(a()){if(!ml.length)try{requestAnimationFrame(()=>{setTimeout(n,0)})}catch{setTimeout(n,0)}o(e)}},n=function(){let e=r(ml);ml.length=0;for(let t of e){if(!t.workspaceId)continue;let e;null==(e=L(t.workspaceId))||e.fireChangeListener(t)}},o=function(e){if(_a(e)&&"mutation"===e.element){let t;for(t=ml.length;t>0;t--){let i=ml[t-1];if(i.group!==e.group||i.workspaceId!==e.workspaceId||!ba(i)||i.newParentId!==e.blockId)break}ml.splice(t,0,e)}else ml.push(e)}
3,r=function(e){let t=[];for(let i of e)e=t[t.length-1],!i.isNull()&&(e&&e.workspaceId===i.workspaceId&&e.group===i.group?ba(i)&&ba(e)&&i.blockId===e.blockId?(e.newParentId=i.newParentId,e.newInputName=i.newInputName,e.newCoordinate=i.newCoordinate,(e.reason||i.reason)&&(e.reason=Array.from(new Set((e.reason??[]).concat(i.reason??[]))))):_a(i)&&_a(e)&&i.blockId===e.blockId&&i.element===e.element&&i.name===e.name?e.newValue=i.newValue:Ia(i)&&Ia(e)?(e.viewTop=i.viewTop,e.viewLeft=i.viewLeft,e.scale=i.scale,e.oldScale=i.oldScale):Oa(i)&&va(e)||t.push(i):t.push(i));return t.filter(e=>!e.isNull())},s=function(){for(let e,t=0;e=ml[t];t++)e.recordUndo=!1},Xs.disable$$module$build$src$core$events$utils=function(){fl++},Xs.enable$$module$build$src$core$events$utils=function(){fl--},a=function(){return 0===fl},Xs.getGroup$$module$build$src$core$events$utils=function(){return dl},Xs.setGroup$$module$build$src$core$events$utils=function(e){Tl.setGroupInternal(e)},l=function(e){dl="boolean"==typeof e?e?ga():"":e},c=function(e){let t=[];e=e.getDescendants(!1);for(let i,n=0;i=e[n];n++)t[n]=i.id;return t},u=function(e,t){let i=h(e.type);if(!i)throw Error("Unknown event type.");return i.fromJson(e,t)},h=function(e){let t=qs(ka.EVENT,e);if(!t)throw Error(`Event type ${e} not found in registry.`);return t},d=function(e){if((ba(e)||ma(e))&&e.workspaceId){var t=L(e.workspaceId);if(!e.blockId)throw Error("Encountered a blockEvent without a proper blockId");if(e=t.getBlockById(e.blockId)){let i=pl;try{pl=!1;let i=e.getParent();if(i&&!i.hasDisabledReason(gl)){let t=e.getDescendants(!1);for(let e,i=0;e=t[i];i++)e.setDisabledReason(!1,gl)}else if((e.outputConnection||e.previousConnection)&&!t.isDragging())do{e.setDisabledReason(!0,gl),e=e.getNextBlock()}while(e)}finally{pl=i}}}},p=function(e,t,i){e=document.createElementNS(bl,`${e}`);for(let n in t)e.setAttribute(n,`${t[n]}`);return i&&i.appendChild(e),e},f=function(e,t){return!(t=t.split(" ")).every(t=>e.classList.contains(t))&&(e.classList.add(...t),!0)},g=function(e,t){e.classList.remove(...t.split(" "))},m=function(e,t){return!(t=t.split(" ")).every(t=>!e.classList.contains(t))&&(e.classList.remove(...t),!0)},T=function(e,t){return e.classList.contains(t)},_=function(e){return e&&e.parentNode?e.parentNode.removeChild(e):null},E=function(e,t){let i=t.nextSibling;if(!(t=t.parentNode))throw Error("Reference node has no parent.");i?t.insertBefore(e,i):t.appendChild(e)},b=function(e,t){e.style.transform=t,e.style["-webkit-transform"]=t},O=function(){Sl++,Il||=Object.create(null)},v=function(){--Sl||(Il=null)},I=function(e){let t=e.textContent+"\n"+e.className.baseVal;var i;return Il&&(i=Il[t])||(i=window.getComputedStyle(e),i=y(e,i.fontSize,i.fontWeight,i.fontFamily),Il&&(Il[t]=i)),i},S=function(e,t,i,n){return y(e,t+"pt",i,n)},y=function(e,t,i,n){let o=e.textContent;var r;return e=o+"\n"+e.className.baseVal,Il&&(r=Il[e])||(yl||=((r=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(r),r.getContext("2d")),o&&yl?(yl.font=i+" "+t+" "+n,r=yl.measureText(o).width):r=0,Il&&(Il[e]=r)),r},R=function(e,t,i,n){let o=document.createElement("span");o.style.font=i+" "+t+" "+n,o.textContent=e,(e=document.createElement("div")).style.width="1px",e.style.height="0",(t=document.createElement("div")).style.display="flex",t.style.position="fixed",t.style.top="0",t.style.left="0",t.appendChild(o),t.appendChild(e),document.body.appendChild(t),i={height:0,baseline:0};try{t.style.alignItems="baseline",i.baseline=e.offsetTop-o.offsetTop,t.style.alignItems="flex-end",i.height=e.offsetTop-o.offsetTop}finally{document.body.removeChild(t)}return i},Xs.getFocusManager$$module$build$src$core$focus_manager=function(){return Al.getFocusManager()},C=function(e){return e&&"function"==typeof e.getFocusableElement&&"function"==typeof e.getFocusableTree&&"function"==typeof e.onNodeFocus&&"function"==typeof e.onNodeBlur&&"function"==typeof e.canBeFocused},k=function(e){return C(e)&&"string"==typeof e.id&&"object"==typeof e.workspace&&"function"==typeof e.select&&"function"==typeof e.unselect},A=function(e,t){for(let i in t)null!==t[i]&&Array.isArray(t[i])?e[i]=A(e[i]||[],t[i]):e[i]=null!==t[i]&&"object"==typeof t[i]?A(e[i]||Object.create(null),t[i]):t[i];return e},L=function(e){return xl[e]||null},N=function(){let e=[];for(let t in xl)e.push(xl[t]);return e},w=function(e){xl[e.id]=e},$=function(e){delete xl[e.id]},M=function(){return $l},x=function(e){$l=e},D=function(){let e=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode();return e&&k(e)?e:null},P=function(e){Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)},F=function(e){let i=D(),n=new(h(ja.SELECTED))(i?.id??null,e?.id??null,e?.workspace.id??i?.w
3orkspace.id??"");t(n)},B=function(){return Ml},U=function(e){Ml=e},H=function(e){for(;e.options.parentWorkspace;)e=e.options.parentWorkspace;let t=e.getParentSvg(),i=e.getCachedParentSvgSize();var n=t.parentElement;if(n instanceof HTMLElement){var o=n.offsetWidth;n=n.offsetHeight,i.width!==o&&(t.setAttribute("width",o+"px"),e.setCachedParentSvgSize(o,null)),i.height!==n&&(t.setAttribute("height",n+"px"),e.setCachedParentSvgSize(null,n)),e.resize()}},V=function(e,t){let i=Object.create(null),n=e.getDescendants(!0);t&&(e=e.getNextBlock())&&(e=n.indexOf(e),n.splice(e,n.length-e));for(let o,r=0;o=n[r];r++)i[o.type]?i[o.type]++:i[o.type]=1;return i},G=function(e){return function(){this.jsonInit(e)}},W=function(e){Pl.defineBlocksWithJsonArrayInternal(e)},X=function(e){Xs.defineBlocks$$module$build$src$core$common(Xs.createBlockDefinitionsFromJsonArray$$module$build$src$core$common(e))},Xs.createBlockDefinitionsFromJsonArray$$module$build$src$core$common=function(e){let t={};for(let i=0;i<e.length;i++){let n=e[i];if(!n){console.warn(`Block definition #${i} in JSON array is ${n}. Skipping`);continue}let o=n.type;o?t[o]={init:G(n)}:console.warn(`Block definition #${i} in JSON array is missing a type attribute. Skipping.`)}return t},Xs.defineBlocks$$module$build$src$core$common=function(e){for(let t of Object.keys(e)){let i=e[t];t in Ua&&console.warn(`Block definition "${t}" overwrites previous definition.`),Ua[t]=i}},z=function(e){let t=M(),i=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedTree();for(let n of N())if(i===n){t=n;break}!ua(e)&&t&&(!t.rendered||t.isFlyout||t.isVisible())&&wl.registry.onKeyDown(t,e)},j=function(e,t){return-1!==(t=e.indexOf(t))&&(e.splice(t,1),!0)},Y=function(e){if(Ql)throw Error("CSS already injected");Kl+="\n"+e},Q=function(e,t){Ql||(Ql=!0,e&&(e=t.replace(/[\\/]$/,""),t=Kl.replace(/<<<PATH>>>/g,e),Kl="",(e=document.createElement("style")).id="blockly-common-style",t=document.createTextNode(t),e.appendChild(t),document.head.insertBefore(e,document.head.firstChild)))},K=function(e){return ic.getSizeInternal(e)},q=function(e){if("none"!==Z(e,"display"))return J(e);let t=e.style,i=t.display,n=t.visibility,o=t.position;t.visibility="hidden",t.position="absolute",t.display="inline";let r=e.offsetWidth;return e=e.offsetHeight,t.display=i,t.position=o,t.visibility=n,new tc(r,e)},J=function(e){return new tc(e.offsetWidth,e.offsetHeight)},Z=function(e,t){return(e=window.getComputedStyle(e))[t]||e.getPropertyValue(t)},ee=function(e){let t=new Jl(0,0);e=e.getBoundingClientRect();var i=document.documentElement;return i=new Jl(window.pageXOffset||i.scrollLeft,window.pageYOffset||i.scrollTop),t.x=e.left+i.x,t.y=e.top+i.y,t},te=function(){let e=document.body,t=document.documentElement;return new Jl(e.scrollLeft||t.scrollLeft,e.scrollTop||t.scrollTop)},ie=function(e){let t=parseFloat(Z(e,"borderLeftWidth")),i=parseFloat(Z(e,"borderRightWidth")),n=parseFloat(Z(e,"borderTopWidth"));return e=parseFloat(Z(e,"borderBottomWidth")),new ec(n,e,t,i)},ne=function(e,t,i){e=oe(e,t,i),t.scrollLeft=e.x,t.scrollTop=e.y},oe=function(e,t,i){var n=ee(e),o=ee(t),r=ie(t);let s=n.x-o.x-r.left;return n=n.y-o.y-r.top,o=J(e),e=t.clientWidth-o.width,o=t.clientHeight-o.height,r=t.scrollLeft,t=t.scrollTop,i?(r+=s-e/2,t+=n-o/2):(r+=Math.min(s,Math.max(s-e,0)),t+=Math.min(n,Math.max(n-o,0))),new Jl(r,t)},re=function(e){let t=new Jl(0,0);var i=e.x&&e.getAttribute("x");let n=e.y&&e.getAttribute("y");return i&&(t.x=parseInt(i)),n&&(t.y=parseInt(n)),(i=(i=e.getAttribute("transform"))&&i.match(oc))&&(t.x+=Number(i[1]),i[3]&&(t.y+=Number(i[3]))),(e=e.getAttribute("style"))&&e.includes("translate")&&(e=e.match(rc))&&(t.x+=Number(e[1]),e[3]&&(t.y+=Number(e[3]))
3),t},se=function(e){let t=0,i=0;for(;e;){let n=re(e);if(t+=n.x,i+=n.y,(" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv "))break;e=e.parentNode}return new Jl(t,i)},ae=function(){let e=te();return new ec(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},le=function(){let e=document.documentElement,t=window;return new Jl(t.pageXOffset||e.scrollLeft,t.pageYOffset||e.scrollTop)},ce=function(e,t){var i=t.x;t=t.y;let n=e.getInjectionDiv().getBoundingClientRect();return i=new Jl(i-n.left,t-n.top),t=e.getOriginOffsetInPixels(),Jl.difference(i,t).scale(1/e.scale)},ue=function(e,t){var i=t.scale(e.scale);t=i.x,i=i.y;let n=e.getInjectionDiv().getBoundingClientRect();return e=e.getOriginOffsetInPixels(),new Jl(t+n.left+e.x,i+n.top+e.y)},he=function(e){({document:uc=uc,DOMParser:hc=hc,XMLSerializer:dc=dc}=e),lc=new hc,cc=new dc},Xs.createElement$$module$build$src$core$utils$xml=function(e){return uc.createElementNS(pc,e)},Xs.createTextNode$$module$build$src$core$utils$xml=function(e){return uc.createTextNode(e)},Xs.textToDom$$module$build$src$core$utils$xml=function(e){let t=lc.parseFromString(e,"text/xml");if(t&&t.documentElement&&!t.getElementsByTagName("parsererror").length)return t.documentElement;if((t=lc.parseFromString(e,"text/html"))&&t.body.firstChild&&"xml"===t.body.firstChild.nodeName.toLowerCase())return t.body.firstChild;throw Error(`DOMParser was unable to parse: ${e}`)},de=function(e){return pe(cc.serializeToString(e))},pe=function(e){return e.replace(fc,e=>`&#${e.charCodeAt(0)};`)},fe=function(e){return e?((e instanceof Element||"string"==typeof e)&&(e=Ie(e),e=be(e)),ge(e),e):null},ge=function(e){let t=e.kind;if(e=e.contents,t&&t!==_c&&t!==Tc)throw Error("Invalid toolbox kind "+t+". Please supply either "+_c+" or "+Tc);if(!e)throw Error("Toolbox must have a contents attribute.")},me=function(e){return e?e.contents?e.contents:Array.isArray(e)&&e.length>0&&!e[0].nodeType?e:Oe(e):[]},Te=function(e){return vc.hasCategoriesInternal(e)},_e=function(e){if(!e)return!1;let t=e.kind;return t?t===Tc:!!e.contents.filter(e=>"CATEGORY"===e.kind.toUpperCase()).length},Ee=function(e){return!(!e||!e.contents)&&!!e.contents.filter(function(e){return"CATEGORY"===e.kind.toUpperCase()}).length},be=function(e){let t={contents:Oe(e)};return e instanceof Node&&ve(e,t),t},Oe=function(e){let t=[],i=e.childNodes;i||=e;for(let n,o=0;n=i[o];o++){if(!n.tagName)continue;e={};let i=n.tagName.toUpperCase();e.kind=i,"BLOCK"===i?e.blockxml=n:n.childNodes&&n.childNodes.length>0&&(e.contents=Oe(n)),ve(n,e),t.push(e)}return t},ve=function(e,t){for(let i=0;i<e.attributes.length;i++){let n=e.attributes[i];n.nodeName.includes("css-")?(t.cssconfig=t.cssconfig||{},t.cssconfig[n.nodeName.replace("css-","")]=n.value):t[n.nodeName]=n.value}},Ie=function(e){let t=null;if(e)if("string"==typeof e){if(t=Xs.textToDom$$module$build$src$core$utils$xml(e),"xml"!==t.nodeName.toLowerCase())throw TypeError("Toolbox should be an <xml> document.")}else e instanceof Element&&(t=e);return t},Se=function(e,t,i,n,o,r){let s=r.scrollbar&&r.scrollbar.canScrollVertically();return e.horizontal===bc.LEFT?(i=o.absoluteMetrics.left+i,s&&r.RTL&&(i+=ac.scrollbarThickness)):(i=o.absoluteMetrics.left+o.viewMetrics.width-t.width-i,s&&!r.RTL&&(i-=ac.scrollbarThickness)),e.vertical===Ec.TOP?e=o.absoluteMetrics.top+n:(e=o.absoluteMetrics.top+o.viewMetrics.height-t.height-n,r.scrollbar&&r.scrollbar.canScrollHorizontally()&&(e-=ac.scrollbarThickness)),new ec(e,e+t.height,i,i+t.width)},ye=function(e,t){return{horizontal:t.toolboxMetrics.position===mc.LEFT||e.horizontalLayout&&!e.RTL?bc.RIGHT:bc.LEFT,vertical:t.toolboxMetrics.position===mc.BOTTOM?Ec.TOP:Ec.BOTTOM}},Re=function(e,t,i,n){let o=e.left,r=e.right-e.left,s=e.bottom-e.top;for(let a=0;a<n.length;a++){let l=n[a];e.intersects(l)&&(e=i===Oc.UP?l.top-s-t:l.bottom+t,e=new ec(e,e+s,o,o+r),a=-1)}return e},Ce=function(e,t){zs(ka.SERIALIZER,e,t)},ke=function(e){Ys(ka.SERIALIZER,e)},Ae=function(e,{addCoordinates:t=!1,saveIds:i=!0}={}){let n=e.workspace,o=Object.create(null);return o.height=e.getSize().height,o.width=e.getSize().width,i&&(o.id=e.id),t&&(t=e.getRelativeToSurfaceXY(),o.x=n.RTL?n.getWidth()-t.x:t.x,o.y=t.y),e.getText()&&(o.text=e.getText()),e.isCollapsed()&&(o.collapsed=!0),e.isOwnEditable()||(o.editable=!1),e.isOwnMovable()||(o.movable=!1),e.isOwnDeletable()||(o.deletable=!1),o},Le=function(t,i,{recordUndo:n=!1}={}){let o=e();if(Xs.setRecordUndo$$module$build$src$core$events$utils(n),n=i.newComment(t.id),void 0!==t.text&&n.setText(t.text),void 0!==t.x||void 0!==t.y){let e=n.getRelativeToSurfaceXY(),o=t.x??e.x;var r;o=i.RTL?i.getWidth()-o:o,i=(r=t.y)??e.y,n.moveTo(new Jl(o,i))}return(void 0!==t.width||t.height)&&(r=n.getSize(),n.setSize(new tc(t.width??r.width,t.height??r.height))),void 0!==t.collapsed&&n.setCollapsed(t.collapsed),void 0!==t.editable&&n.setEditable(t.editable),void 0!==t.movable&&n.setMovable(t.movable),void 0!==t.deletable&&n.setDeletable(t.deletable),Xs.setRecordUndo$$module$build$src$core$events$utils(o),n},Ne=function(e,t){zs(ka.PASTER,e,t)},we=function(e){Ys(ka.PASTER,e)},$e=function(e){let t=e.workspace,i=e.getRelativeToSurfaceXY(),n=new Jl(0,0),o=t.getTopComments(!1).filter(t=>t.id!==e.id).map(e=>
3e.getRelativeToSurfaceXY());for(;Me(Jl.sum(i,n),o);)n.translate(t.RTL?-30:30,30);e.moveTo(Jl.sum(i,n))},Me=function(e,t){return t.some(t=>Math.abs(t.x-e.x)<=1&&Math.abs(t.y-e.y)<=1)},xe=function(e,t){e.setAttribute(Fc,t)},De=function(e,t,i){Array.isArray(i)&&(i=i.join(" ")),e.setAttribute(Pc+t,`${i}`)},Pe=function(e){return e&&"function"==typeof e.saveState&&"function"==typeof e.loadState},Fe=function(e){return Ve(e),He()?(Ge(),Promise.resolve()):(Jc||=new Promise(e=>{Zc=e,eu=window.requestAnimationFrame(()=>{Ge(),e()})}),Jc)},Be=function(){return Jc||Promise.resolve()},Ue=function(e){e||window.cancelAnimationFrame(eu),Ge(e),!e&&Zc&&Zc()},He=function(){return Ya},Ve=function(e){Kc.add(e),qc.set(e,Xs.getGroup$$module$build$src$core$events$utils());let t=e.getParent();t?Ve(t):Qc.add(e)},Ge=function(e){let t=e?new Set([e]):new Set([...Qc].map(e=>e.workspace)),i=[...Qc].filter(Xe).filter(e=>t.has(e.workspace));for(var n of i)ze(n);for(let r of t)r.resizeContents();for(var o of i)n=o.getRelativeToSurfaceXY(),o.updateComponentLocations(n);for(let r of i)o=Xs.getGroup$$module$build$src$core$events$utils(),(n=qc.get(r))&&Xs.setGroup$$module$build$src$core$events$utils(n),r.bumpNeighbours(),Xs.setGroup$$module$build$src$core$events$utils(o);for(let r of i)We(r);e||(Jc=null)},We=function(e){Qc.delete(e),Kc.delete(e),qc.delete(e);for(let t of e.getChildren(!1))We(t)},Xe=function(e){return!e.isDisposed()&&!e.getParent()},ze=function(e){if(Kc.has(e)&&e.initialized){for(let t of e.getChildren(!1))ze(t);e.renderEfficiently()}},je=function(e,t){au(e,t)},Ye=function(e=su){au=e},Qe=function(e,t){cu(e,t)},Ke=function(e=lu){cu=e},qe=function(e,t,i){hu(e,t,i)},Je=function(e=uu){hu=e},Ze=function(e,t){du(e,t)},et=function(e=qa){du=e},tt=function(e){return e&&"function"==typeof e.getProcedureDef},it=function(e){return e&&"function"==typeof e.getProcedureCall&&"function"==typeof e.renameProcedure},nt=function(e){return void 0!==e.getVariableModel},ot=function(e,t,i,n){e=e+" was deprecated in "+t+" and will be deleted in "+i+".",n&&(e+="\nUse "+n+" instead."),gu.has(e)||(gu.add(e),console.warn(e))},Xs.allUsedVarModels$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let i=0;i<e.length;i++){let n=e[i].getVarModels();if(n)for(let e=0;e<n.length;e++){let i=n[e];i.getId()&&t.add(i)}}return Array.from(t.values())},Xs.allDeveloperVariables$$module$build$src$core$variables=function(e){e=e.getAllBlocks(!1);let t=new Set;for(let n,o=0;n=e[o];o++){var i=n.getDeveloperVariables;if(i){i=i();for(let e=0;e<i.length;e++)t.add(i[e])}}return Array.from(t.values())},rt=function(e){return st(e,!1)},st=function(e,t=!0){return Ua.variables_set||Ua.variables_get||console.warn("There are no variable blocks, but there is a variable category."),t?(ot("The XML return value of Blockly.Variables.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),ct(e)):(e.registerButtonCallback("CREATE_VARIABLE",function(e){ft(e.getTargetWorkspace())}),[{kind:"button",text:"%{BKY_NEW_VARIABLE}",callbackkey:"CREATE_VARIABLE"},...lt(e,e.getVariableMap().getVariablesOfType(""),!0)])},at=function(e){return{VAR:{name:e.getName(),type:e.getType()}}},lt=function(e,t,i,n="variables_get",o="variables_set"){i&&=Ua.math_change,e=[];let r=t.slice(-1)[0];return r&&(Ua[o]&&e.push({kind:"block",type:o,gap:i?8:24,fields:at(r)}),i&&e.push({kind:"block",type:"math_change",gap:Ua[n]?20:8,fields:at(r),inputs:{DELTA:{shadow:{type:"math_number",fields:{NUM:1}}}}})),Ua[n]&&e.push(...t.sort(St).map(e=>({kind:"block",type:n,gap:8,fields:at(e)}))),e},ct=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text","%{BKY_NEW_VARIABLE}"),i.setAttribute("callbackKey","CREATE_VARIABLE"),e.registerButtonCallback("CREATE_VARIABLE",function(e){ft(e.getTargetWorkspace())}),t.push(i),e=ut(e),t.concat(e)},ut=function(e){let t=[];if((e=e.getVariableMap().getVariablesOfType("")).length>0){var i=e[e.length-1];if(Ua.variables_set){var n=Xs.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set"),n.setAttribute("gap",Ua.math_change?"8":"24"),n.appendChild(Ot(i)),t.push(n)}if(Ua.math_change&&((n=Xs.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","math_change"),n.setAttribute("gap",Ua.variables_get?"20":"8"),n.appendChild(Ot(i)),i=Xs.textToDom$$module$build$src$core$utils$xml('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),n.appendChild(i),t.push(n)),Ua.variables_get){e.sort(St);for(let n,o=0;n=e[o];o++)(i=Xs.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get"),i.setAttribute("gap","8"),i.appendChild(Ot(n)),t.push(i)}}return t},ht=function(e){return Eu.generateUniqueNameInternal(e)},dt=function(e){return pt(_u.charAt(0),e.getVariableMap().getAllVariables().map(e=>e.getName()))},pt=function(e,t){if(!t.length)return e;let i=_u,n="",o=i.indexOf(e);for(;;){let r=!1;for(let i=0;i<t.length;i++)if(t[i].toLowerCase()===e){r=!0;break}if(!r)break;o++,o===i.length&&(o=0,n=`${Number(n)+1}`),e=i.charAt(o)+n}return e},ft=function(e,t,i){let n=i||"";!function i(o){gt(Xs.Msg$$module$build$src$core$msg.NEW_VARIABLE_TITLE,o,function(o){if
3(o){var r=Tt(o,e);if(r){if(r.getType()===n)var s=Xs.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS.replace("%1",r.getName());else s=(s=Xs.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE).replace("%1",r.getName()).replace("%2",r.getType());je(s,function(){i(o)})}else e.getVariableMap().createVariable(o,n),t&&t(o)}else t&&t(null)})}("")},Xs.renameVariable$$module$build$src$core$variables=function(e,t,i){!function n(o){let r=Xs.Msg$$module$build$src$core$msg.RENAME_VARIABLE_TITLE.replace("%1",t.getName());gt(r,o,function(o){if(o){var r=mt(o,t.getType(),e),s=_t(t.getName(),o,e);if(r||s){var a="";r?a=Xs.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",r.getName()).replace("%2",r.getType()):s&&(a=Xs.Msg$$module$build$src$core$msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER.replace("%1",o).replace("%2",s)),je(a,function(){n(o)})}else e.getVariableMap().renameVariable(t,o),i&&i(o)}else i&&i(null)})}("")},gt=function(e,t,i){qe(e,t,function(e){e&&((e=e.replace(/[\s\xa0]+/g," ").trim())===Xs.Msg$$module$build$src$core$msg.RENAME_VARIABLE||e===Xs.Msg$$module$build$src$core$msg.NEW_VARIABLE)&&(e=null),i(e)})},mt=function(e,t,i){i=i.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let n,o=0;n=i[o];o++)if(n.getName().toLowerCase()===e&&n.getType()!==t)return n;return null},Tt=function(e,t){t=t.getVariableMap().getAllVariables(),e=e.toLowerCase();for(let i,n=0;i=t[n];n++)if(i.getName().toLowerCase()===e)return i;return null},_t=function(e,t,i){return i.getProcedureMap().getProcedures().length?Et(e,t,i):bt(e,t,i)},Et=function(e,t,i){e=e.toLowerCase(),t=t.toLowerCase(),i=i.getProcedureMap().getProcedures();for(let o of i){var n=o.getParameters().filter(nt).map(e=>e.getVariableModel().getName());if(n&&(i=n.some(t=>t.toLowerCase()===e),n=n.some(e=>e.toLowerCase()===t),i&&n))return o.getName()}return null},bt=function(e,t,i){e=e.toLowerCase(),t=t.toLowerCase(),i=i.getAllBlocks(!1);for(let o of i){if(!tt(o))continue;var n=(i=o.getProcedureDef())[1];let r=n.some(t=>t.toLowerCase()===e);if(n=n.some(e=>e.toLowerCase()===t),r&&n)return i[0]}return null},Ot=function(e){let t=Xs.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name","VAR"),t.setAttribute("id",e.getId()),t.setAttribute("variabletype",e.getType()),e=Xs.createTextNode$$module$build$src$core$utils$xml(e.getName()),t.appendChild(e),t},Xs.getOrCreateVariablePackage$$module$build$src$core$variables=function(e,t,i,n){let o=Xs.getVariable$$module$build$src$core$variables(e,t,i,n);return o||=vt(e,t,i,n),o},Xs.getVariable$$module$build$src$core$variables=function(e,t,i,n){let o=e.getPotentialVariableMap(),r=null;if(t&&(r=e.getVariableMap().getVariableById(t),!r&&o&&(r=o.getVariableById(t)),r))return r;if(i){if(void 0===n)throw Error("Tried to look up a variable by name without a type");r=e.getVariableMap().getVariable(i,n),!r&&o&&(r=o.getVariable(i,n))}return r},vt=function(e,t,i,n){let o=e.getVariableMap(),r=e.getPotentialVariableMap();return i||=ht(e.isFlyout?e.targetWorkspace:e),r?r.createVariable(i,n,t??void 0):o.createVariable(i,n,t)},It=function(e,t){e=e.getVariableMap().getAllVariables();let i=[];if(t.length!==e.length)for(let n=0;n<e.length;n++){let o=e[n];t.includes(o)||i.push(o)}return i},St=function(e,t){return e.getName().localeCompare(t.getName(),void 0,{sensitivity:"base"})},yt=function(e,t){let i=[];e=e.getAllBlocks(!1);for(let n=0;n<e.length;n++){let o=e[n].getVarModels();if(o)for(let r=0;r<o.length;r++)o[r].getId()===t&&i.push(e[n])}return i},Xs.deleteVariable$$module$build$src$core$variables=function(e,t,i){var n=t.getName();let o=yt(e,t.getId());for(let r=o.length-1;r>=0;r--){let e=o[r];if("procedures_defnoreturn"===e.type||"procedures_defreturn"===e.type)return i=String(e.getFieldValue("NAME")),n=Xs.Msg$$module$build$src$core$msg.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",n).replace("%2",i),void je(n);e===i&&o.splice(r,1)}i&&o.length||o.length>1?(n=Xs.Msg$$module$build$src$core$msg.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(o.length+(i&&!i.workspace.isFlyout?1:0))).replace("%2",n),Qe(n,i=>{i&&t&&e.getVariableMap().deleteVariable(t)}
3)):e.getVariableMap().deleteVariable(t)},Rt=function(e,{addCoordinates:t=!1,addInputBlocks:i=!0,addNextBlocks:n=!0,doFullSerialization:o=!0,saveIds:r=!0}={}){if(e.isInsertionMarker())return null;let s={type:e.type,id:r?e.id:void 0};return t&&kt(e,s),Ct(e,s),At(e,s,o),Lt(e,s,o),Nt(e,s,o),i&&wt(e,s,o,r),n&&$t(e,s,o,r),s},Ct=function(e,t){e.isCollapsed()&&(t.collapsed=!0),e.isEnabled()||(t.disabledReasons=Array.from(e.getDisabledReasons())),e.isOwnDeletable()||(t.deletable=!1),e.isOwnMovable()||(t.movable=!1),e.isOwnEditable()||(t.editable=!1),void 0!==e.inputsInline&&e.inputsInline!==e.inputsInlineDefault&&(t.inline=e.inputsInline),e.data&&(t.data=e.data)},kt=function(e,t){let i=e.workspace;e=e.getRelativeToSurfaceXY(),t.x=Math.round(i.RTL?i.getWidth()-e.x:e.x),t.y=Math.round(e.y)},At=function(e,t,i){e.saveExtraState?null!==(e=e.saveExtraState(i))&&(t.extraState=e):e.mutationToDom&&(null!==(e=e.mutationToDom())&&(t.extraState=Xn(e).replace(' xmlns="https://developers.google.com/blockly/xml"',"")))},Lt=function(e,t,i){let n=Object.create(null);for(let o of e.getIcons())Pe(o)&&(e=o.saveState(i))&&(n[o.getType().toString()]=e);Object.keys(n).length&&(t.icons=n)},Nt=function(e,t,i){let n=Object.create(null);for(let o of e.getFields())o.isSerializable()&&(n[o.name]=o.saveState(i));Object.keys(n).length&&(t.fields=n)},wt=function(e,t,i,n){let o=Object.create(null);for(let r=0;r<e.inputList.length;r++){let t=e.inputList[r];if(!t.connection)continue;let s=Mt(t.connection,i,n);s&&(o[t.name]=s)}Object.keys(o).length&&(t.inputs=o)},$t=function(e,t,i,n){e.nextConnection&&(e=Mt(e.nextConnection,i,n))&&(t.next=e)},Mt=function(e,t,i){let n=e.getShadowState(!0);if(e=e.targetBlock(),!n&&!e)return null;let o=Object.create(null);return n&&(o.shadow=n),e&&!e.isShadow()&&(o.block=Rt(e,{doFullSerialization:t,saveIds:i})),o},xt=function(e,t,{recordUndo:i=!1}={}){return e=Dt(e,t,{recordUndo:i}),t.rendered&&Ue(),e},Dt=function(i,n,{parentConnection:o,isShadow:r=!1,recordUndo:s=!1}={}){let l=e();Xs.setRecordUndo$$module$build$src$core$events$utils(s),(s=Xs.getGroup$$module$build$src$core$events$utils())||Xs.setGroup$$module$build$src$core$events$utils(!0),Xs.disable$$module$build$src$core$events$utils();let c,u=n.getVariableMap().getAllVariables();try{c=Pt(i,n,{parentConnection:o,isShadow:r})}finally{Xs.enable$$module$build$src$core$events$utils()}if(Ft(n,u),a()&&t(new(h(ja.BLOCK_CREATE))(c)),Xs.setGroup$$module$build$src$core$events$utils(s),Xs.setRecordUndo$$module$build$src$core$events$utils(l),n.rendered){let e=c;setTimeout(()=>{e.disposed||e.setConnectionTracking(!0)},1)}return c},Pt=function(e,t,{parentConnection:i,isShadow:n=!1}={}){if(!e.type)throw new vu(e);let o=t.newBlock(e.type,e.id);return o.setShadow(n),Bt(o,e),Ut(o,e),Ht(o,e),Vt(i,o,e),Gt(o,e),Wt(o,e),Xt(o,e),zt(o,e),Yt(o,t.rendered),o},Ft=function(e,i){if(a())for(e=It(e,i),i=0;i<e.length;i++){let n=e[i];t(new(h(ja.VAR_CREATE))(n))}},Bt=function(e,t){let i=void 0===t.x?0:t.x;t=void 0===t.y?0:t.y;let n=e.workspace;i=n.RTL?n.getWidth()-i:i,e.moveBy(i,t)},Ut=function(e,t){if(t.collapsed&&e.setCollapsed(!0),!1===t.deletable&&e.setDeletable(!1),!1===t.movable&&e.setMovable(!1),!1===t.editable&&e.setEditable(!1),!1===t.enabled&&e.setDisabledReason(!0,Xc),Array.isArray(t.disabledReasons))for(let i of t.disabledReasons)e.setDisabledReason(!0,i);void 0!==t.inline&&e.setInputsInline(t.inline),void 0!==t.data&&(e.data=t.data)},Ht=function(e,t){t.extraState&&(e.loadExtraState?e.loadExtraState(t.extraState):e.domToMutation&&e.domToMutation(Xs.textToDom$$module$build$src$core$utils$xml(t.extraState)))},Vt=function(e,t,i){if(e){if(e.getSourceBlock().isShadow()&&!t.isShadow())throw new yu(i);if(e.type===Xs.inputTypes$$module$build$src$core$inputs$input_types.VALUE){var n=t.outputConnection;if(!n)throw new Iu("output",t,i)}else if(!(n=t.previousConnection))throw new Iu("previous",t,i);if(!e.connect(n)){let o=t.workspace.connectionChecker;throw new Su(o.getErrorMessage(o.canConnectWithReason(n,e,!1),n,e),e.type===Xs.inputTypes$$module$build$src$core$inputs$input_types.VALUE?"output connection":"previous connection",t,i)}}},Gt=function(e,t){if(t.icons){var i=Object.keys(t.icons);for(let o of i){i=t.icons[o];var n=e.getIcon(o);
3if(!n){if(!(n=qs(ka.ICON,o,!1)))throw new Ru(o,e,t);n=new n(e),e.addIcon(n)}Pe(n)&&n.loadState(i)}}},Wt=function(e,t){if(t.fields){var i=Object.keys(t.fields);for(let n=0;n<i.length;n++){let o=i[n],r=t.fields[o],s=e.getField(o);s?s.loadState(r):console.warn(`Ignoring non-existant field ${o} in block ${e.type}`)}}},Xt=function(e,t){if(t.inputs){var i=Object.keys(t.inputs);for(let n=0;n<i.length;n++){let o=i[n],r=e.getInput(o);if(!r||!r.connection)throw new Iu(o,e,t);jt(r.connection,t.inputs[o])}}},zt=function(e,t){if(t.next){if(!e.nextConnection)throw new Iu("next",e,t);jt(e.nextConnection,t.next)}},jt=function(e,t){t.shadow&&e.setShadowState(t.shadow),t.block&&Pt(t.block,e.getSourceBlock().workspace,{parentConnection:e})},Yt=function(e,t){if(t){e.setConnectionTracking(!1),e.initSvg(),e.queueRender();for(let t of e.getIcons())t.onLocationChange(e.getRelativeToSurfaceXY())}else e.initModel()},Qt=function(e){return"function"==typeof e.bubbleIsVisible&&"function"==typeof e.setBubbleVisible&&"function"==typeof e.getBubble},Kt=function(e){return e*Math.PI/180},qt=function(e){return 180*e/Math.PI},Jt=function(e,t,i){if(i<e){let t=i;i=e,e=t}return Math.max(e,Math.min(t,i))},Zt=function(){document.querySelector(".blocklyDropDownDiv")||((Mu=document.createElement("div")).className="blocklyDropDownDiv",Mu.tabIndex=-1,(B()||document.body).appendChild(Mu),(xu=document.createElement("div")).className="blocklyDropDownContent",Mu.appendChild(xu),Ku=aa(xu,"keydown",null,z),(Du=document.createElement("div")).className="blocklyDropDownArrow",Mu.appendChild(Du),Mu.style.opacity="0",Mu.style.transition="transform "+Hu+"s, opacity "+Hu+"s")},ei=function(e){zu=e},ti=function(){return ju},ii=function(){return xu},ni=function(){Ku&&=(ca(Ku),null),Mu.remove(),Zt()},oi=function(e,t){Mu.style.backgroundColor=e,Mu.style.borderColor=t},ri=function(e,t,i,n,o=!0){return ci(ai(t),e,o,i,n)},si=function(e,t,i,n=!0){return Yu=!0,ci(li(e),e,n,t,i)},ai=function(e){var t=e.getSvgRoot();let i=e.workspace.scale,n=e.height*i;return e=e.width*i,t=ee(t),new ec(t.y,t.y+n,t.x,t.x+e)},li=function(e){return e=e.getScaledBBox(),new ec(e.top,e.bottom,e.left,e.right)},ci=function(e,t,i,n,o){let r=e.left+(e.right-e.left)/2,s=e.bottom;e=e.top,o&&(e+=o);let a=(o=t.getSourceBlock()).workspace;for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;return ei(a.getParentSvg().parentNode),ui(t,o.RTL,r,s,r,e,i,n)},ui=function(e,t,i,n,o,r,s,a){return ju=e,Gu=a||null,Mu.style.direction=t?"rtl":"ltr",e=M(),Wu=e.getRenderer().getClassName(),Xu=e.getTheme().getClassName(),f(Mu,Wu),f(Mu,Xu),i=Ei(i,n,o,r),s&&(Qu=Xs.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(Mu)),i},hi=function(e,t,i,n){return{initialX:(e=fi(e,i.left,i.right,n.width)).divX,initialY:t,finalX:e.divX,finalY:t+Uu,arrowX:e.arrowX,arrowY:-(Pu/2+Fu),arrowAtTop:!0,arrowVisible:!0}},di=function(e,t,i,n){return{initialX:(e=fi(e,i.left,i.right,n.width)).divX,initialY:t-n.height,finalX:e.divX,finalY:t-n.height-Uu,arrowX:e.arrowX,arrowY:n.height-2*Fu-Pu/2,arrowAtTop:!1,arrowVisible:!0}},pi=function(e,t,i){return{initialX:(e=fi(e,t.left,t.right,i.width)).divX,initialY:0,finalX:e.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},fi=function(e,t,i,n){return t=Jt(t,e-n/2,i-n),{arrowX:e=Jt(i=Bu,e=e-Pu/2-t,n-i-Pu),divX:t}},gi=function(){return!!ju},mi=function(e,t){return ju===e&&(t?_i():Ti(),!0)},Ti=function(){Mu.style.transform="translate(0, 0)",Mu.style.opacity="0",Vu=setTimeout(function(){_i()},1e3*Hu),Gu&&=(Gu(),null)},_i=function(){gi()&&(Vu&&clearTimeout(Vu),Gu&&=(Gu(),null),ni(),ju=null,M().markFocused(),Qu&&=(Qu(),null))},Ei=function(e,t,i,n){(e=qu.getPositionMetrics(e,t,i,n)).arrowVisible?(t=e.arrowX,i=e.arrowY,n=e.arrowAtTop?45:225,Du.style.display="",Du.style.transform=`translate(${t}px, ${i}px) rotate(${n}deg)`,Du.setAttribute("class","blocklyDropDownArrow")):Du.style.display="none",t=Math.floor(e.initialX),i=Math.floor(e.initialY),n=Math.floor(e.finalX);let o=Math.floor(e.finalY);return Mu.style.left=t+"px",Mu.style.top=i+"px",Mu.style.display="block",Mu.style.opacity="1",Mu.style.transform="translate("+(n-t)+"px,"+(o-i)+"px)",!!e.arrowAtTop},bi=function(){if(ju){var e=ju.getSourceBlock();let t=(e=Yu?li(ju):ai(e)).left+(e.right-e.left)/2;Ei(t,e.bottom,t,e.top)}else Ti()},Oi=function(e){return e.length?e.reduce(function(e,t){return e.length<t.length?e:t}).length:0},vi=function(e,t){if(!e.length)return 0;if(1===e.length)return e[0].length;let i,n=0;for(t||=Oi(e),i=0;i<t;i++){for(var o=e[0][i],r=1;r<e.length;r++)if(o!==e[r][i])return n;" "===o&&(n=i+1)}for(o=1;o<e.length;o++)if((r=e[o][i])&&" "!==r)return n;return t},Ii=function(e,t){if(!e.length)return 0;if(1===e.length)return e[0].length;let i,n=0;for(t||=Oi(e),i=0;i<t;i++){for(var o=e[0].substr(-i-1,1),r=1;r<e.length;r++)if(o!==e[r].substr(-i-1,1))return n;" "===o&&(n=i+1)}for(o=1;o<e.length;o++)if((r=e[o].charAt(e[o].length-i-1))&&" "!==r)return n;return t},Xs.wrap$$module$build$src$core$utils$string=function(e,t){e=e.split("\n");for(let i=0;i<e.length;i++)e[i]=Si(e[i],t);return e.join("\n")},Si=function(e,t){if(e.length<=t)return e;let i=e.trim().split(/\s+/);for(var n=0;n<i.length;n++)i[n].length>t&&(t=i[n].length);var o=-1/0;let r,s=1;do{n=o,r=e,e=[],o=i.length/s;let a=1;for(let t=0;t<i.length-1;t++)a<(t+1.5)/o?(a++,e[t]=!0):e[t]=!1;e=Ri(i,e,t),o=yi(i,e,t),e=Ci(i,e),s++}while(o>n);return r},yi=function(e,t,i){let n=[0],o=[];for(var r=0;r<e.length;r++)n[n.length-1]+=e[r].length,!0===t[r]?(n.push(0),o.push(e[r].charAt(e[r].length-1))):!1===t[r]&&n[n.length-1]++;for(e=Math.max(...n),t=0,r=0;r<n.length;r++)t-=Math.abs(i-n[r])**1.5*2,t-=(e-n[r])**1.5,".?!".includes(o[r])?t+=i/3:",;)]}".includes(o[r])&&(t+=i/4);return n.length>1&&n[n.length-1]<=n[n.length-2]&&(t+=.5),t},Ri=function(e,t,i){let n,o=yi(e,t,i);for(let r=0;r<t.length-1;r++){if(t[r]===t[r+1])continue;let s=[].concat(t);s[r]=!s[r],s[r+1]=!s[r+1];let a=yi(e,s,i);a>o&&(o=a,n=s)}return n?Ri(e,n,i):t},Ci=function(e,t){let i=[];for(let n=0;n<e.length;n++)i.push(e[n]),void 0!==t[n]&&i.push(t[n]?"\n":" ");return i.join("")},Xs.isNumber$$module$build$src$core$utils$string=function(e){return/^\s*-?\d+(\.\d+)?\s*$/.test(e)},ki=function(e){eh=e},Ai=function(){return eh},Li=function(){return th},Ni=function(){return gh},wi=function(e){if(e=$i(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""},$i=function(e){for(;e&&e.tooltip;){if("string"==typeof e.tooltip||"function"==typeof e.tooltip)return e;e=e.tooltip}return null},Mi=function(){document.querySelector(".blocklyTooltipDiv")||((gh=document.createElement("div")).className="blocklyTooltipDiv",(B()||document.body).appendChild(gh))},xi=function(e){e.mouseOverWrapper_=la(e,"pointerover",null,Pi),e.mouseOutWrapper_=la(e,"pointerout",null,Fi),e.addEventListener("pointermove",Bi,!1)},Di=function(e){e&&(ca(e.mouseOverWrapper_),ca(e.mouseOutWrapper_),e.removeEventListener("pointermove",Bi))},Pi=function(e){ih||(e=$i(e.currentTarget),lh!==e&&(Hi(),ch=null,lh=e),clearTimeout(oh))},Fi=function(e){ih||(oh=setTimeout(function(){ch=lh=null,Hi()},1),clearTimeout(rh),rh=0)},Bi=function(e){if(lh&&lh.tooltip&&!ih)if(th){let t=sh-e.pageX;e=ah-e.pageY,Math.sqrt(t*t+e*e)>dh&&Hi()}else ch!==lh&&(clearTimeout(rh),sh=e.pageX,ah=e.pageY,rh=setTimeout(ji,ph))},Ui=function(){ch=lh=null,Hi()},Hi=function(){th&&(th=!1,gh&&(gh.style.display="none")),rh&&=(clearTimeout(rh),0)},Vi=function(){Hi(),ih=!0},Gi=function(){ih=!1},Wi=function(){gh&&lh&&("function"==typeof eh?eh(gh,lh):Xi())},Xi=function(){var e=wi(lh);e=(e=Xs.wrap$$module$build$src$core$utils$string(e,nh)).split("\n");for(let t=0;t<e.length;t++){let i=document.createElement("div");i.appendChild(document.createTextNode(e[t])),gh.appendChild(i)}},zi=function(e){let t=document.documentElement.clientWidth,i=document.documentElement.clientHeight,n=sh;n=e?n-(uh+gh.offsetWidth):n+uh;let o=ah+hh;return o+gh.offsetHeight>i+window.scrollY&&(o-=gh.offsetHeight+2*hh),e?n=Math.max(fh-window.scrollX,n):n+gh.offsetWidth>t+window.scrollX-2*fh&&(n=t-gh.offsetWidth-2*fh),{x:n,y:o}},ji=function(){if(!ih&&(ch=lh,gh)){gh.textContent="",Wi();var e=lh.RTL;gh.style.direction=e?"rtl":"ltr",gh.style.display="block",th=!0;var{x:t,y:i}=zi(e);gh.style.left=t+"px",gh.style.top=i+"px"}},Yi=function(){return Th},Qi=function(e){Th=e},Ki=function(){return _h},qi=function(e){_h=e},Ji=function(e){e=`${e}`.toLowerCase().trim();var t=Eh[e];if(t||(t="#"===(t="0x"===e.substring(0,2)?"#"+e.substring(2):e)[0]?t:"#"+t,/^#[0-9a-f]{6}$/.test(t)))return t;if(/^#[0-9a-f]{3}$/.test(t))return["#",t[1],t[1],t[2],t[2],t[3],t[3]].join("");var i=e.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return i&&(e=Number(i[1]),t=Number(i[2]),i=Number(i[3]),e>=0&&e<256&&t>=0&&t<256&&i>=0&&i<256)?Zi(e,t,i):null},Zi=function(e,t,i){return t=e<<16|t<<8|i,e<16?"#"+(16777216|t).toString(16).substr(1):"#"+t.toString(16)},en=function(e){return(e=Ji(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},tn=function(e,t,i){let n=0,o=0,r=0;if(0===t)r=o=n=i;else{let s=Math.floor(e/60),a=e/60-s;e=i*(1-t);let l=i*(1-t*a);switch(t=i*(1-t*(1-a)),s){case 1:n=l,o=i,r=e;break;case 2:n=e,o=i,r=t;break;case 3:n=e,o=l,r=i;break;case 4:n=t,o=e,r=i;break;case 5:n=i,o=e,r=l;break;case 6:case 0:n=i,o=t,r=e}}return Zi(Math.floor(n),Math.floor(o),Math.floor(r))},nn=function(e,t,i){return(e=Ji(e))&&(t=Ji(t))?(e=en(e),t=en(t),Zi(Math.round(t[0]+i*(e[0]-t[0])),Math.round(t[1]+i*(e[1]-t[1])),Math.round(t[2]+i*(e[2]-t[2])))):null},on=function(e){return tn(e,Th,255*_h)},rn=function(e,t,i){let n=[];var o=e.split("");o.push("");var r=0;e=[];let s=null;for(let c=0;c<o.length;c++){var a=o[c];if(0===r)if("%"===a)(r=e.join(""))&&n.push(r),e.length=0,r=1;else if(i&&"\n"===a){let t=e.join("");t&&n.push(t),e.length=0,n.push(a)}else e.push(a);else if(1===r)"%"===a?(e.push(a),r=0):t&&"0"<=a&&a<="9"?(r=2,s=a,(a=e.join(""))&&n.push(a),e.length=0):"{"===a?r=3:(e.push("%",a),r=0);else if(2===r)if("0"<=a&&a<="9")s+=a;else{var l=void 0;n.push(parseInt((l=s)??"",10)),c--,r=0}else 3===r&&(""===a?(e.splice(0,0,"%{"),c--,r=0):"}"===a?(r=e.join(""),/[A-Z]\w*/i.test(r)?(a=(a=r.toUpperCase()).startsWith("BKY_")?a.substring(4):null)&&a in Xs.Msg$$module$build$src$core$msg?"string"==typeof(r=Xs.Msg$$module$build$src$core$msg[a])?Array.prototype.push.apply(n,rn(r,t,i)):t?n.push(`${r}`):n.push(r):n.push("%{"+r+"}"):n.push("%{"+r+"}"),r=e.length=0):e.push(a))}for((t=e.join(""))&&n.push(t),l=[],e.length=0,o=0;o<n.length;o++)"string"!=typeof n[o]||i&&"\n"===n[o]?((t=e.join(""))&&l.push(t),e.length=0,l.push(n[o])):e.push(n[o]);return(t=e.join(""))&&l.push(t),e.length=0,l},sn=function(e){return rn(e,!0,!0)},an=function(e){return"string"==typeof e?(e=rn(e,!1,!1)).length?String(e[0]):"":e},ln=function(e){let t=!0,i=Xs.Msg$$module$build$src$core$msg,n=e.match(/%{BKY_[A-Z]\w*}/gi);if(n)for(let o=0;o<n.length;o++)void 0===i[n[o].toUpperCase().slice(6,-1)]&&(console.warn("No message string for "+n[o]+" in "+e),t=!1);return t},cn=function(e){let t="string"==typeof e?an(e):e;var i=Number(t);if(!isNaN(i)&&0<=i&&i<=360)return{hue:i,hex:tn(i,Yi(),255*Ki())};if(i=Ji(t))return{hue:null,hex:i};throw i='Invalid colour: "'+t+'"',e!==t&&(i+=' (from "'+e+'")'),Error(i)},un=function(){return yh},hn=function(e){if(yh=e,null===e){let e;
3null==(e=document.querySelector("."+Ah))||e.remove()}},dn=function(){let e=B()||document.body,t=document.querySelector("div."+Ah);t?yh=t:((yh=document.createElement("div")).className=Ah,yh.tabIndex=-1),aa(yh,"keydown",null,z),e.appendChild(yh)},pn=function(e,t,i,n,o=!0){fn(),Rh=e,kh=i,(i=yh)&&(i.style.direction=t?"rtl":"ltr",i.style.display="block",!n&&e instanceof vh&&(n=e.getSourceBlock()?.workspace),Ch=n??null,e=n??M(),Lh=e.getRenderer().getClassName(),Nh=e.getTheme().getClassName(),Lh&&f(i,Lh),Nh&&f(i,Nh),o&&(wh=Xs.getFocusManager$$module$build$src$core$focus_manager().takeEphemeralFocus(i)))},fn=function(){if(gn()){Rh=null;var e=yh;e&&(e.style.display="none",e.style.left="",e.style.top="",kh&&=(kh(),null),e.textContent="",Lh&&=(m(e,Lh),""),Nh&&=(m(e,Nh),""),M().markFocused(),wh&&=(wh(),null))}},gn=function(){return!!Rh},mn=function(e){Rh===e&&fn()},Tn=function(e){let t=null===Ch,i=e;for(;!t&&i;){if(i===e){t=!0;break}i=e.options.parentWorkspace}t&&fn()},_n=function(e,t,i){yh.style.left=e+"px",yh.style.top=t+"px",yh.style.height=i+"px"},En=function(e,t,i,n){let o=On(e,t,i);e=bn(e,t,i,n),o<0?_n(e,0,i.height+o):_n(e,o,i.height)},bn=function(e,t,i,n){return n?Math.min(Math.max(t.right-i.width,e.left),e.right-i.width):Math.max(Math.min(t.left,e.right-i.width),e.left)},On=function(e,t,i){return t.bottom+i.height>=e.bottom?t.top-i.height:t.bottom},vn=function(e){return!(null==e||!e.repositionForWindowResize)},In=function(){vn(Rh)&&Rh.repositionForWindowResize()||fn()},Sn=function(){return Mh},yn=function(e){Mh=e},Rn=function(e,t,i,n,o){if(pn(xh,i,wn,n),t.length){o||(e instanceof PointerEvent?o=new Jl(e.clientX,e.clientY):(console.warn("Context menu opened with keyboard but no location given"),o=new Jl(0,0)));var r=Cn(t,i,e,o);Dh=r,kn(r,i,o),setTimeout(function(){r.focus()},1),Mh=null}else Nn()},Cn=function(e,t,i,n){let o=new Hc;o.setRole(xc.MENU);for(let r=0;r<e.length;r++){let s=e[r];if(s.separator){o.addChild(new Vc);continue}let a=new Uc(s.text);a.setRightToLeft(t),a.setRole(xc.MENUITEM),o.addChild(a),a.setEnabled(s.enabled),s.enabled&&a.onAction(function(e,t){Nn(),requestAnimationFrame(()=>{setTimeout(()=>{s.callback(s.scope,i,t,n)},0)})},{})}return o},kn=function(e,t,i){let n=ae();i=new ec(i.y+n.top,i.y+n.top,i.x+n.left,i.x+n.left),An(e);let o=e.getSize();t&&(i.left+=o.width,i.right+=o.width,n.left+=o.width,n.right+=o.width),En(n,i,o,t),e.focus()},An=function(e){var t=un();if(!t)throw Error("Attempting to create a context menu when widget div is null");t=e.render(t),f(t,"blocklyContextMenu"),aa(t,"contextmenu",null,Ln),e.focus()},Ln=function(e){e.preventDefault(),e.stopPropagation()},Nn=function(){let e;mn(xh),Mh=null,null==(e=Dh)||e.dispose(),Dh=null},wn=function(){Dh&&=(Dh.dispose(),null)},Xs.callbackFactory$$module$build$src$core$contextmenu=function(e,i){return()=>{let n;Xs.disable$$module$build$src$core$events$utils();try{n=i instanceof Element?Kn(i,e.workspace):Dt(i,e.workspace);let t=e.getRelativeToSurfaceXY();t.x=e.RTL?t.x-Xs.config$$module$build$src$core$config.snapRadius:t.x+Xs.config$$module$build$src$core$config.snapRadius,t.y+=2*Xs.config$$module$build$src$core$config.snapRadius,n.moveBy(t.x,t.y)}finally{Xs.enable$$module$build$src$core$events$utils()}return a()&&!n.isShadow()&&t(new(h(ja.BLOCK_CREATE))(n)),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(n),n}},$n=function(){return Dh},Mn=function(e,t){return(t=da(t,e.getParentSvg(),e.getInverseScreenCTM())).x/=e.scale,t.y/=e.scale,t},xn=function(e,t,i){t=Mn(e,t),Xh.set(e,Jl.difference(i,t))},Dn=function(e,t){if(t=Mn(e,t),!(e=Xh.get(e)))throw Error("Drag not initialized");return Jl.sum(e,t)},Pn=function(e,t=!1){let i=Xs.createElement$$module$build$src$core$utils$xml("xml");var n=Bn(Xs.allUsedVarModels$$module$build$src$core$variables(e));n.hasChildNodes()&&i.appendChild(n);for(let o of e.getTopComments())i.appendChild(Fn(o,t));for(e=e.getTopBlocks(!0),n=0;n<e.length;n++)i.appendChild(Un(e[n],t));return i},Fn=function(e,t=!1){let i=Xs.createElement$$module$build$src$core$utils$xml("comment");t||i.setAttribute("id",e.id),t=e.workspace;let n=e.getRelativeToSurfaceXY().clone();return n.x=t.RTL?t.getWidth()-n.x:n.x,i.setAttribute("x",`${n.x}`),i.setAttribute("y",`${n.y}`),i.setAttribute("w",`${e.getSize().width}`),i.setAttribute("h",`${e.getSize().height}`),e.getText()&&(i.textContent=e.getText()),e.isCollapsed()&&i.setAttribute("collapsed","true"),e.isOwnEditable()||i.setAttribute("editable","false"),e.isOwnMovable()||i.setAttribute("movable","false"),e.isOwnDeletable()||i.setAttribute("deletable","false"),i},Bn=function(e){let t=Xs.createElement$$module$build$src$core$utils$xml("variables");for(let i=0;i<e.length;i++){let n=e[i],o=Xs.createElement$$module$build$src$core$utils$xml("variable");
3o.appendChild(Xs.createTextNode$$module$build$src$core$utils$xml(n.getName())),n.getType()&&o.setAttribute("type",n.getType()),o.id=n.getId(),t.appendChild(o)}return t},Un=function(e,t){if(e.isInsertionMarker()&&!(e=e.getChildren(!1)[0]))return new DocumentFragment;let i=0;if(e.workspace.RTL&&(i=e.workspace.getWidth()),t=Gn(e,t),co(t)){let n=e.getRelativeToSurfaceXY();t.setAttribute("x",String(Math.round(e.workspace.RTL?i-n.x:n.x))),t.setAttribute("y",String(Math.round(n.y)))}return t},Hn=function(e){if(e.isSerializable()){let t=Xs.createElement$$module$build$src$core$utils$xml("field");return t.setAttribute("name",e.name||""),e.toXml(t)}return null},Vn=function(e,t){for(let i of e.getFields())(e=Hn(i))&&t.appendChild(e)},Gn=function(e,t){if(e.isInsertionMarker())return(t=e.getChildren(!1)[0])?Gn(t):new DocumentFragment;let i,n=Xs.createElement$$module$build$src$core$utils$xml(e.isShadow()?"shadow":"block");if(n.setAttribute("type",e.type),t||(n.id=e.id),e.mutationToDom){var o=e.mutationToDom();o&&(o.hasChildNodes()||o.hasAttributes())&&n.appendChild(o)}if(Vn(e,n),o=e.getCommentText()){var r=e.getIcon(Lu.COMMENT),s=r.getBubbleSize(),a=r.bubbleIsVisible();r=r.getBubbleLocation();var l=Xs.createElement$$module$build$src$core$utils$xml("comment");
3l.appendChild(Xs.createTextNode$$module$build$src$core$utils$xml(o)),l.setAttribute("pinned",`${a}`),l.setAttribute("h",`${s.height}`),l.setAttribute("w",`${s.width}`),r&&(l.setAttribute("x",`${e.workspace.RTL?e.workspace.getWidth()-(r.x+s.width):r.x}`),l.setAttribute("y",`${r.y}`)),n.appendChild(l)}for(e.data&&((o=Xs.createElement$$module$build$src$core$utils$xml("data")).appendChild(Xs.createTextNode$$module$build$src$core$utils$xml(e.data)),n.appendChild(o)),o=0;o<e.inputList.length;o++){var c=void 0;a=!0,(s=e.inputList[o]).type!==Xs.inputTypes$$module$build$src$core$inputs$input_types.DUMMY&&s.type!==Xs.inputTypes$$module$build$src$core$inputs$input_types.END_ROW&&(r=s.connection.targetBlock(),s.type===Xs.inputTypes$$module$build$src$core$inputs$input_types.VALUE?c=Xs.createElement$$module$build$src$core$utils$xml("value"):s.type===Xs.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT&&(c=Xs.createElement$$module$build$src$core$utils$xml("statement")),!(l=s.connection.getShadowDom())||r&&r.isShadow()||c.appendChild(Wn(l,t)),r&&((r=Gn(r,t)).nodeType===El.ELEMENT_NODE&&(c.appendChild(r),a=!1)),c.setAttribute("name",s.name),a||n.appendChild(c))}return void 0!==e.inputsInline&&e.inputsInline!==e.inputsInlineDefault&&n.setAttribute("inline",String(e.inputsInline)),e.isCollapsed()&&n.setAttribute("collapsed","true"),e.isEnabled()||n.setAttribute("disabled-reasons",Array.from(e.getDisabledReasons()).map(encodeURIComponent).join(",")),e.isOwnDeletable()||n.setAttribute("deletable","false"),e.isOwnMovable()||n.setAttribute("movable","false"),e.isOwnEditable()||n.setAttribute("editable","false"),(c=e.getNextBlock())&&((o=Gn(c,t)).nodeType===El.ELEMENT_NODE&&(i=Xs.createElement$$module$build$src$core$utils$xml("next"),i.appendChild(o),n.appendChild(i))),!(e=e.nextConnection&&e.nextConnection.getShadowDom())||c&&c.isShadow()||i.appendChild(Wn(e,t)),n},Wn=function(e,t){let i,n=e=e.cloneNode(!0);for(;n;)if(t&&"shadow"===n.nodeName&&n.removeAttribute("id"),n.firstChild)n=n.firstChild;else{for(;n&&!n.nextSibling;)i=n,n=n.parentNode,i.nodeType===El.TEXT_NODE&&""===i.data.trim()&&n?.firstChild!==i&&_(i);n&&(i=n,n=n.nextSibling,i.nodeType===El.TEXT_NODE&&""===i.data.trim()&&_(i))}return e},Xn=function(e){return de(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},zn=function(e){e=Xn(e).split("<");let t="";for(let i=1;i<e.length;i++){let n=e[i];"/"===n[0]&&(t=t.substring(2)),e[i]=t+"<"+n,"/"!==n[0]&&"/>"!==n.slice(-2)&&(t+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>")).replace(/^\n/,"")},jn=function(e,t){return t.setResizesEnabled(!1),t.clear(),e=Xs.domToWorkspace$$module$build$src$core$xml(e,t),t.setResizesEnabled(!0),e},Xs.domToWorkspace$$module$build$src$core$xml=function(i,n){let o=0;n.RTL&&(o=n.getWidth());let r=[];O();let s=Xs.getGroup$$module$build$src$core$events$utils();s||Xs.setGroup$$module$build$src$core$events$utils(!0),n.setResizesEnabled&&n.setResizesEnabled(!1);let a=!0;try{for(let t,s=0;t=i.childNodes[s];s++){let i=t.nodeName.toLowerCase(),s=t;if("block"===i||"shadow"===i&&!e()){let e=Kn(s,n);r.push(e.id);let t=parseInt(s.getAttribute("x")??"10",10),i=parseInt(s.getAttribute("y")??"10",10);isNaN(t)||isNaN(i)||e.moveBy(n.RTL?o-t:t,i,["create"]),a=!1}else{if("shadow"===i)throw TypeError("Shadow block cannot be a top-level block.");if("comment"===i)Yn(s,n);else if("variables"===i){if(!a)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");qn(s,n),a=!1}}}}finally{Xs.setGroup$$module$build$src$core$events$utils(s),n.setResizesEnabled&&n.setResizesEnabled(!0),n.rendered&&Ue(),v()}return t(new(h(ja.FINISHED_LOADING))(n)),r},Yn=function(e,t){var i;let n=(i=e.getAttribute("id"))??void 0;var o,r,s;return(i=t.rendered?new id(t,n):new td(t,n)).setText((o=e.textContent)??""),o=parseInt(e.getAttribute("x")??"",10),r=parseInt(e.getAttribute("y")??"",10),isNaN(o)||isNaN(r)||(o=t.RTL?t.getWidth()-o:o,i.moveTo(new Jl(o,r))),t=parseInt(e.getAttribute("w")??"",10),s=parseInt(e.getAttribute("h")??"",10),isNaN(t)||isNaN(s)||i.setSize(new tc(t,s)),"true"===e.getAttribute("collapsed")&&i.setCollapsed(!0),"false"===e.getAttribute("editable")&&i.setEditable(!1),"false"===e.getAttribute("movable")&&i.setMovable(!1),"false"===e.getAttribute("deletable")&&i.setDeletable(!1),i},Qn=function(e,t){if(!t.getBlocksBoundingBox)return Xs.domToWorkspace$$module$build$src$core$xml(e,t);var i=t.getBlocksBoundingBox();if(e=Xs.domToWorkspace$$module$build$src$core$xml(e,t),i&&i.top!==i.bottom){var n=i.bottom;i=t.RTL?i.right:i.left;var o=1/0;let r=-1/0,s=1/0;for(let i=0;i<e.length;i++){let n=t.getBlockById(e[i]).getRelativeToSurfaceXY();n.y<s&&(s=n.y),n.x<o&&(o=n.x),n.x>r&&(r=n.x)}for(n=n-s+10,i=t.RTL?i-r:i-o,o=0;o<e.length;o++)t.getBlockById(e[o]).moveBy(i,n,["create"])}return e},Xs.domToBlock$$module$build$src$core$xml=function(e,t){return e=Kn(e,t),t.rendered&&Ue(),e},Kn=function(e,i){Xs.disable$$module$build$src$core$events$utils();var n=i.getVariableMap().getAllVariables();let o;try{if(o=so(e,i),i.rendered){let e=o,t=o.getDescendants(!1);e.setConnectionTracking(!1);for(let i=t.length-1;i>=0;i--)t[i].initSvg();for(let i=t.length-1;i>=0;i--)t[i].queueRender();setTimeout(function(){e.disposed||e.setConnectionTracking(!0)},1),i.resizeContents()}else{let e=o.getDescendants(!1);for(let t=e.length-1;t>=0;t--)e[t].initModel()}}finally{Xs.enable$$module$build$src$core$events$utils()}
3if(a()){for(e=It(i,n),i=0;i<e.length;i++)n=e[i],t(new(h(ja.VAR_CREATE))(n));t(new(h(ja.BLOCK_CREATE))(o))}return o},qn=function(e,t){for(let n=0;n<e.children.length;n++){var i=e.children[n];let o=i.getAttribute("type"),r=i.getAttribute("id");if(!(i=i.textContent))break;t.getVariableMap().createVariable(i,o??void 0,r)}},Jn=function(e){let t={mutation:[],comment:[],data:[],field:[],input:[],next:[]};for(let i=0;i<e.children.length;i++){let n=e.children[i];if(n.nodeType!==El.TEXT_NODE)switch(n.nodeName.toLowerCase()){case"mutation":t.mutation.push(n);break;case"comment":t.comment.push(n);break;case"data":t.data.push(n);break;case"title":case"field":t.field.push(n);break;case"value":case"statement":t.input.push(n);break;case"next":t.next.push(n);break;default:console.warn("Ignoring unknown tag: "+n.nodeName)}}return t},Zn=function(e,t){let i=!1;for(let n=0;n<e.length;n++){let o=e[n];t.domToMutation&&(t.domToMutation(o),t.initSvg&&(i=!0))}return i},eo=function(e,t){for(let i=0;i<e.length;i++){let n=e[i],o=n.textContent,r="true"===n.getAttribute("pinned"),s=parseInt(n.getAttribute("w")??"50",10),a=parseInt(n.getAttribute("h")??"50",10),l=parseInt(n.getAttribute("x")??"",10),c=parseInt(n.getAttribute("y")??"",10);t.setCommentText(o);let u=t.getIcon(Lu.COMMENT);isNaN(s)||isNaN(a)||u.setBubbleSize(new tc(s,a)),u.setBubbleVisible(r),setTimeout(()=>{isNaN(l)||isNaN(c)||(l=t.workspace.RTL?t.workspace.getWidth()-(l+s):l,u.setBubbleLocation(new Jl(l,c))),u.setBubbleVisible(r)},1)}},to=function(e,t){for(let i=0;i<e.length;i++)t.data=e[i].textContent},io=function(e,t){for(let i=0;i<e.length;i++){let n=e[i],o=n.getAttribute("name");o?ao(t,o,n):console.warn(`Ignoring unnamed field in block ${t.type}`)}},no=function(e){let t=null,i=null;for(let n=0;n<e.childNodes.length;n++){let o=e.childNodes[n];co(o)&&("block"===o.nodeName.toLowerCase()?t=o:"shadow"===o.nodeName.toLowerCase()&&(i=o))}return{childBlockElement:t,childShadowElement:i}},oo=function(e,t,i,n){for(let r=0;r<e.length;r++){var o=e[r];let s=o.getAttribute("name"),a=s?i.getInput(s):null;if(!a){console.warn("Ignoring non-existent input "+s+" in block "+n);break}if((o=no(o)).childBlockElement){if(!a.connection)throw TypeError("Input connection does not exist.");so(o.childBlockElement,t,a.connection,!1)}if(o.childShadowElement){let e;null==(e=a.connection)||e.setShadowDom(o.childShadowElement)}}},ro=function(e,t,i){for(let n=0;n<e.length;n++){let o=no(e[n]);if(o.childBlockElement){if(!i.nextConnection)throw TypeError("Next statement does not exist.");if(i.nextConnection.isConnected())throw TypeError("Next statement is already connected.");so(o.childBlockElement,t,i.nextConnection,!0)}o.childShadowElement&&i.nextConnection&&i.nextConnection.setShadowDom(o.childShadowElement)}},so=function(e,t,i,n){var o;let r=e.getAttribute("type");if(!r)throw TypeError("Block type unspecified: "+e.outerHTML);var s=(o=e.getAttribute("id"))??void 0;o=t.newBlock(r,s),s=Jn(e);let a=Zn(s.mutation,o);if(eo(s.comment,o),to(s.data,o),i)if(n){if(!o.previousConnection)throw TypeError("Next block does not have previous statement.");i.connect(o.previousConnection)}else if(o.outputConnection)i.connect(o.outputConnection);else{if(!o.previousConnection)throw TypeError("Child block does not have output or previous statement.");i.connect(o.previousConnection)}if(io(s.field,o),oo(s.input,t,o,r),ro(s.next,t,o),a&&o.initSvg(),(t=e.getAttribute("inline"))&&o.setInputsInline("true"===t),(t=e.getAttribute("disabled"))&&o.setDisabledReason("true"===t||"disabled"===t,Xc),null!==(t=e.getAttribute("disabled-reasons")))for(var l of t.split(","))o.setDisabledReason(!0,decodeURIComponent(l));if((l=e.getAttribute("deletable"))&&o.setDeletable("true"===l),(l=e.getAttribute("movable"))&&o.setMovable("true"===l),(l=e.getAttribute("editable"))&&o.setEditable("true"===l),(l=e.getAttribute("collapsed"))&&o.setCollapsed("true"===l),"shadow"===e.nodeName.toLowerCase()){for(e=o.getChildren(!1),l=0;l<e.length;l++)if(!e[l].isShadow())throw TypeError("Shadow block not allowed non-shadow child.");o.setShadow(!0)}return o},ao=function(e,t,i){let n=e.getField(t);n?n.fromXml(i):console.warn("Ignoring non-existent field "+t+" in block "+e.type)},lo=function(e){for(let t=0;t<e.childNodes.length;t++){let i=e.childNodes[t];
3if("next"===i.nodeName.toLowerCase()){e.removeChild(i);break}}},co=function(e){return e.nodeType===El.ELEMENT_NODE},uo=function(e,t){zs(ka.FIELD,e,t,!0)},ho=function(e){Ys(ka.FIELD,e)},Xs.fromJson$$module$build$src$core$field_registry=function(e){return ld.fromJsonInternal(e)},po=function(e){let t=Js(ka.FIELD,e.type);return t?t.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)},fo=function(e){return e&&"object"==typeof e&&"src"in e&&"string"==typeof e.src&&"alt"in e&&"string"==typeof e.alt&&"width"in e&&"number"==typeof e.width&&"height"in e&&"number"==typeof e.height},Xs.register$$module$build$src$core$extensions=function(e,t){if("string"!=typeof e||""===e.trim())throw Error('Error: Invalid extension name "'+e+'"');if(Ed[e])throw Error('Error: Extension "'+e+'" is already registered.');if("function"!=typeof t)throw Error('Error: Extension "'+e+'" must be a function');Ed[e]=t},Xs.registerMixin$$module$build$src$core$extensions=function(e,t){if(!t||"object"!=typeof t)throw Error('Error: Mixin "'+e+'" must be a object');Xs.register$$module$build$src$core$extensions(e,function(){this.mixin(t)})},Xs.registerMutator$$module$build$src$core$extensions=function(e,t,i,n){let o='Error when registering mutator "'+e+'": ';Io(o,t);let r=Oo(t,o);if(i&&"function"!=typeof i)throw Error(o+'Extension "'+e+'" is not a function');Xs.register$$module$build$src$core$extensions(e,function(){r&&this.setMutator(new Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon(n||[],this)),this.mixin(t),i&&i.apply(this)})},go=function(e){mo(e)?delete Ed[e]:console.warn('No extension mapping for name "'+e+'" found to unregister')},mo=function(e){return!!Ed[e]},To=function(e,t,i){let n,o=Ed[e];if("function"!=typeof o)throw Error('Error: Extension "'+e+'" not found.');if(i?_o(e,t):n=So(t),o.apply(t),i)Io('Error after applying mutator "'+e+'": ',t);else if(!yo(n,t))throw Error('Error when applying extension "'+e+'": mutation properties changed when applying a non-mutator extension.')},_o=function(e,t){if(So(t).length)throw Error('Error: tried to apply mutation "'+e+'" to a block that already has mutator functions. Block id: '+t.id)},Eo=function(e,t){return vo(e.mutationToDom,e.domToMutation,t+" mutationToDom/domToMutation")},bo=function(e,t){return vo(e.saveExtraState,e.loadExtraState,t+" saveExtraState/loadExtraState")},Oo=function(e,t){return vo(e.compose,e.decompose,t+" compose/decompose")},vo=function(e,t,i){if(e&&t){if("function"!=typeof e||"function"!=typeof t)throw Error(i+" must be a function");return!0}if(!e&&!t)return!1;throw Error(i+"Must have both or neither functions")},Io=function(e,t){let i=Eo(t,e),n=bo(t,e);if(!i&&!n)throw Error(e+"Mutations must contain either XML hooks, or JSON hooks, or both");Oo(t,e)},So=function(e){let t=[];return void 0!==e.domToMutation&&t.push(e.domToMutation),void 0!==e.mutationToDom&&t.push(e.mutationToDom),void 0!==e.saveExtraState&&t.push(e.saveExtraState),void 0!==e.loadExtraState&&t.push(e.loadExtraState),void 0!==e.compose&&t.push(e.compose),void 0!==e.decompose&&t.push(e.decompose),t},yo=function(e,t){if((t=So(t)).length!==e.length)return!1;for(let i=0;i<t.length;i++)if(e[i]!==t[i])return!1;return!0},Ro=function(e){if("object"!=typeof document)throw Error("runAfterPageLoad() requires browser document.");if("complete"===document.readyState)e();else{let t=setInterval(function(){"complete"===document.readyState&&(clearInterval(t),e())},10)}},Xs.buildTooltipForDropdown$$module$build$src$core$extensions=function(e,t){let i=[];return function(){i.includes(this.type)||(Co(this,e,t),i.push(this.type)),this.setTooltip(function(){let i=String(this.getFieldValue(e));return an(t[i])}.bind(this))}},Co=function(e,t,i){var n=e.getField(t);if(n instanceof ud&&!n.isOptionListDynamic()){n=n.getOptions();for(let o of n)o!==ud.SEPARATOR&&([,n]=o,void 0===i[n]&&console.warn(`No tooltip mapping for value ${n} of field ${t} of block type ${e.type}.`))}},Xs.buildTooltipWithFieldText$$module$build$src$core$extensions=function(e,t){return function(){this.setTooltip(function(){let i=this.getField(t);return an(e).replace("%1",i?i.getText():"")}.bind(this))}},ko=function(){let e=this.tooltip;this.setTooltip(function(){let t=this.getParent();return t&&t.getInputsInline()&&t.tooltip||e}.bind(this))},Ao=function(e,t){return" "+e+","+t+" "},Lo=function(e,t){return" "+e+t.join("")},No=function(e,t){return" M "+e+","+t+" "},wo=function(e,t){return" m "+e+","+t+" "},$o=function(e,t){return" l "+e+","+t+" "},Mo=function(e){return" l"+e.join("")},xo=function(e,t){return" "+e+" "+t+" "},Do=function(e,t,i,n){return e+" "+i+" "+i+" "+t+n},Po=function(e,t){if(!e||!t)throw Error("Cannot connect null connections.");e.targetConnection=t,t.targetConnection=e},Fo=function(e,t){let i=null;t=t.outputConnection;let n=t?.getConnectionChecker();for(let o,r=0;o=e.inputList[r];r++){let e,r=o.connection;if(r&&null!=(e=n)&&e.canConnect(t,r,!1)){if(i)return null;i=r}}return i},Bo=function(e,t){let i;for(;i=Fo(e,t);)if(!(e=i.targetBlock())||e.isShadow())return i;return null},Uo=function(e){return C(e)&&"function"==typeof e.getType&&"function"==typeof e.initView&&"function"==typeof e.dispose&&"function"==typeof e.getWeight&&"function"==typeof e.getSize&&"function"==typeof e.applyColour&&"function"==typeof e.hideForInsertionMarker&&"function"==typeof e.updateEditable&&"function"==typeof e.updateCollapsed&&"function"==typeof e.isShownWhenCollapsed&&"function"==typeof e.setOffsetInBlock&&"function"==typeof e.onLocationChange&&"function"==typeof e.onClick},Ho=function(e){return Uo(e)&&Qt(e)&&Pe(e)&&"function"==typeof e.setText&&"function"==typeof e.getText&&"function"==typeof e.setBubbleSize&&"function"==typeof e.getBubbleSize&&"function"==typeof e.setBubbleLocation&&"function"==typeof e.getBubbleLocation&&e.getType()===Lu.COMMENT},Vo=function(e){if(!(e.getDescendants(!1).length>100)){var t=e.workspace,i=e.getSvgRoot();t.getAudioManager().play("delete");var n,o=e.getRelativeToSurfaceXY(),r=i.cloneNode(!0);r.setAttribute("transform","translate("+o.x+","+o.y+")"),null==(n=t.getLayerManager())||n.appendToAnimationLayer({getSvgRoot:()=>r}),Go(r,{x:o.x,y:o.y,width:e.width,height:e.height},t.RTL,new Date)}},Go=function(e,t,i,n){let o=((new Date).getTime()-n.getTime())/150;o>1?_(e):(e.setAttribute("transform","translate("+(t.x+(i?-1:1)*t.width/2*o)+","+(t.y+t.height/2*o)+") scale("+(1-o)+")"),setTimeout(Go,10,e,t,i,n))},Wo=function(e){var t=e.workspace;let i=t.scale;if(t.getAudioManager().play("click"),!(i<1)){var n=t.getSvgXY(e.getSvgRoot());e.outputConnection?(n.x+=(e.RTL?3:-3)*i,n.y+=13*i):e.previousConnection&&(n.x+=(e.RTL?-23:23)*i,n.y+=3*i);
3var o=p(Zl.CIRCLE,{cx:n.x,cy:n.y,r:0,fill:"none",stroke:"#888","stroke-width":10},t.getParentSvg());e=p(Zl.ANIMATE,{id:"animationCircle",begin:"indefinite",attributeName:"r",dur:"150ms",from:0,to:25*i},o),t=p(Zl.ANIMATE,{id:"animationOpacity",begin:"indefinite",attributeName:"opacity",dur:"150ms",from:1,to:0},o),e.beginElement(),t.beginElement(),setTimeout(()=>{_(o)},150)}},Xo=function(e){if(jo(),e.workspace.getAudioManager().play("disconnect"),!(e.workspace.scale<1)){var t=e.getHeightWidth().height;t=Math.atan(10/t)/Math.PI*180,e.RTL||(t*=-1),zd=e,zo(e,t,new Date,0)}},zo=function(e,t,i,n){let o=[.66,1,.66,0,-.66,-1,-.66,0],r="";i.getTime()+200>(new Date).getTime()&&(r=`skewX(${Math.round(o[n%o.length]*t)})`,Xd=setTimeout(zo,15,e,t,i,n+1)),e.getSvgRoot().setAttribute("transform",`${e.getTranslation()} ${r}`)},jo=function(){zd&&=(Xd&&=(clearTimeout(Xd),null),zd.getSvgRoot().setAttribute("transform",zd.getTranslation()),null)},Yo=function(e,t){e.workspace.RTL&&(t.x=e.workspace.getWidth()-t.x);let i=e.workspace,n=Xs.config$$module$build$src$core$config.snapRadius,o=Jl.difference(t,e.getRelativeToSurfaceXY()),r=new Jl(0,0),s=i.getAllBlocks(!1).filter(t=>t.id!=e.id).map(e=>e.getRelativeToSurfaceXY());for(;Qo(Jl.sum(t,r),s)||Ko(e,Jl.sum(o,r),n);)i.RTL?r.translate(-n,2*n):r.translate(n,2*n);e.moveTo(Jl.sum(t,r))},Qo=function(e,t){return t.some(t=>Math.abs(t.x-e.x)<=1&&Math.abs(t.y-e.y)<=1)},Ko=function(e,t,i){return e.getConnections_(!1).some(e=>!!e.closest(i,t).connection)},qo=function(e,t,i){let n=i.getBoundingRectangle(),o=n.right-n.left,r=Jt(t.top,n.top,t.top+t.height-(n.bottom-n.top))-n.top,s=t.left;return t=t.left+t.width-o,e.RTL?s=Math.min(t,s):t=Math.max(s,t),!(!(e=Jt(s,n.left,t)-n.left)&&!r)&&(i.moveBy(e,r,["inbounds"]),!0)},Jo=function(e){return t=>{var i,n=e.getMetricsManager();if(n.hasFixedEdges()&&!e.isDragging())if(sl.includes((i=t.type)??"")){i=n.getScrollMetrics(!0);let o=Zo(e,t);o&&(n=Xs.getGroup$$module$build$src$core$events$utils()||!1,Xs.setGroup$$module$build$src$core$events$utils(t.group),qo(e,i,o)&&!t.group&&console.warn("Moved object in bounds but there was no event group. This may break undo."),Xs.setGroup$$module$build$src$core$events$utils(n))}else Ia(t)&&t.scale&&t.oldScale&&t.scale>t.oldScale&&er(e)}},Zo=function(e,t){let i=null;switch(t.type){case ja.BLOCK_CREATE:case ja.BLOCK_MOVE:(i=e.getBlockById(t.blockId))&&(i=i.getRootBlock());break;case ja.COMMENT_CREATE:case ja.COMMENT_MOVE:case ja.COMMENT_RESIZE:i=e.getCommentById(t.commentId)}return i},er=function(e){var t=e.getMetricsManager();if(t.hasFixedEdges()&&!e.isDragging()){t=t.getScrollMetrics(!0);var i=e.getTopBoundedElements();for(let n,o=0;n=i[o];o++)qo(e,t,n)}},tr=function(e){return e&&"function"==typeof e.isDeletable&&"function"==typeof e.dispose&&"function"==typeof e.setDeleteStyle},ir=function(e,t){let i=e.getIcons();for(let n of e.inputList){if(!n.isVisible())continue;let o;i.push(...n.fieldRow),null!=(o=n.connection)&&o.targetBlock()?(e=n.connection.targetBlock(),(n.connection.type!==Rd.NEXT_STATEMENT||t||(e=e.lastConnectionInStack(!1)?.getSourceBlock()))&&i.push(e)):n.connection?.type===Rd.INPUT_VALUE&&i.push(n.connection)}return i},nr=function(e,t){let i=e.workspace.getTopBoundedElements(!0).filter(e=>C(e)),n=null;return(e=i.indexOf(e instanceof ep?e.getRootBlock():e)+t)>=0&&e<i.length?n=i[e]:e<0?n=i[i.length-1]:e>=i.length&&(n=i[0]),t<0&&n instanceof ep?n.lastConnectionInStack(!1)?.getSourceBlock()??n:n},or=function(e,t){var i;let n=e instanceof ep?(i=e.outputConnection)?.targetBlock()??e.getSurroundParent():e.getSourceBlock();return n instanceof ep&&-1!==(e=(i=ir(n,t>0)).indexOf(e))?(t=e+t)>=0&&t<i.length?i[t]:null:null},rr=function(e,t){zs(ka.ICON,e.toString(),t)},sr=function(e){Ys(ka.ICON,e)},ar=function(e){return e&&"function"==typeof e.showContextMenu},lr=function(e){return e&&"function"==typeof e.getRelativeToSurfaceXY&&"function"==typeof e.isMovable&&"function"==typeof e.startDrag&&"function"==typeof e.drag&&"function"==typeof e.endDrag&&"function"==typeof e.revertDrag},cr=function(e){return e&&"function"==typeof e.autoHide},ur=function(e){return"function"==typeof e.getProcedureModel&&"function"==typeof e.doProcedureUpdate&&"function"==typeof e.isProcedureDef},hr=function(e){return e&&"function"==typeof e.startPublishing&&"function"==typeof e.stopPublishing},dr=function(e){let t=e.getProcedureMap().getProcedures().filter(e=>!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!1]);
3e.getBlocksByType("procedures_defnoreturn",!1).forEach(e=>{!ur(e)&&tt(e)&&t.push(e.getProcedureDef())});let i=e.getProcedureMap().getProcedures().filter(e=>!!e.getReturnTypes()).map(e=>[e.getName(),e.getParameters().map(e=>e.getName()),!0]);return e.getBlocksByType("procedures_defreturn",!1).forEach(e=>{!ur(e)&&tt(e)&&i.push(e.getProcedureDef())}),t.sort(pr),i.sort(pr),[t,i]},pr=function(e,t){return e[0].localeCompare(t[0],void 0,{sensitivity:"base"})},Xs.findLegalName$$module$build$src$core$procedures=function(e,t){if(t.isInFlyout)return e;for(e=e||Xs.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed";!fr(e,t.workspace,t);){let t=e.match(/^(.*?)(\d+)$/);e=t?t[1]+(parseInt(t[2])+1):e+"2"}return e},fr=function(e,t,i){return!gr(e,t,i)},gr=function(e,t,i){for(let n of t.getAllBlocks(!1))if(n!==i&&tt(n)&&Xs.Names$$module$build$src$core$names.equals(n.getProcedureDef()[0],e))return!0;i=i&&ur(i)?i?.getProcedureModel():void 0;for(let n of t.getProcedureMap().getProcedures())if(n!==i&&Xs.Names$$module$build$src$core$names.equals(n.getName(),e))return!0;return!1},Xs.rename$$module$build$src$core$procedures=function(e){var t=this.getSourceBlock();if(!t)throw new Ih;e=e.trim();let i=Xs.findLegalName$$module$build$src$core$procedures(e,t);ur(t)&&!t.isInsertionMarker()&&t.getProcedureModel().setName(i);let n=this.getValue();if(n!==e&&n!==i)for(e=t.workspace.getAllBlocks(!1),t=0;t<e.length;t++){let o=e[t];o.renameProcedure&&o.renameProcedure(n,i)}return i},mr=function(e){function t(e,t){for(let o=0;o<e.length;o++){var n=e[o][0];let r=e[o][1],s=Xs.createElement$$module$build$src$core$utils$xml("block");s.setAttribute("type",t),s.setAttribute("gap","16");let a=Xs.createElement$$module$build$src$core$utils$xml("mutation");for(a.setAttribute("name",n),s.appendChild(a),n=0;n<r.length;n++){let e=Xs.createElement$$module$build$src$core$utils$xml("arg");e.setAttribute("name",r[n]),a.appendChild(e)}i.push(s)}}let i=[];if(Ua.procedures_defnoreturn){var n=Xs.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_defnoreturn"),n.setAttribute("gap","16");var o=Xs.createElement$$module$build$src$core$utils$xml("field");
3o.setAttribute("name","NAME"),o.appendChild(Xs.createTextNode$$module$build$src$core$utils$xml(Xs.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE)),n.appendChild(o),i.push(n)}return Ua.procedures_defreturn&&((n=Xs.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_defreturn"),n.setAttribute("gap","16"),(o=Xs.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),o.appendChild(Xs.createTextNode$$module$build$src$core$utils$xml(Xs.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE)),n.appendChild(o),i.push(n)),Ua.procedures_ifreturn&&((n=Xs.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","procedures_ifreturn"),n.setAttribute("gap","16"),i.push(n)),i.length&&i[i.length-1].setAttribute("gap","24"),t((e=dr(e))[0],"procedures_callnoreturn"),t(e[1],"procedures_callreturn"),i},Tr=function(e){return _r(e,!1)},_r=function(e,t=!0){function i(e,t){for(let[i,o]of e)n.push({kind:"block",type:t,gap:16,extraState:{name:i,params:o}})}if(t)return ot("The XML return value of Blockly.Procedures.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),mr(e);let n=[];return Ua.procedures_defnoreturn&&n.push({kind:"block",type:"procedures_defnoreturn",gap:16,fields:{NAME:Xs.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_PROCEDURE}}),Ua.procedures_defreturn&&n.push({kind:"block",type:"procedures_defreturn",gap:16,fields:{NAME:Xs.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_PROCEDURE}}),Ua.procedures_ifreturn&&n.push({kind:"block",type:"procedures_ifreturn",gap:16}),n.length&&(n[n.length-1].gap=24),i((e=dr(e))[0],"procedures_callnoreturn"),i(e[1],"procedures_callreturn"),n},Er=function(e){var t=[],i=e.getBlocksByType("procedures_mutatorarg",!1);for(let r,s=0;r=i[s];s++)t.push(r.getFieldValue("NAME"));i=Xs.createElement$$module$build$src$core$utils$xml("xml");let n=Xs.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","procedures_mutatorarg");let o=Xs.createElement$$module$build$src$core$utils$xml("field");o.setAttribute("name","NAME"),t=pt(Xs.DEFAULT_ARG$$module$build$src$core$procedures,t),t=Xs.createTextNode$$module$build$src$core$utils$xml(t),o.appendChild(t),n.appendChild(o),i.appendChild(n),e.updateToolbox(i)},br=function(e){if(va(e)&&"mutator"===e.bubbleType&&e.isOpen&&e.blockId){var t=(e=L(e.workspaceId).getBlockById(e.blockId)).type;("procedures_defnoreturn"===t||"procedures_defreturn"===t)&&(e=e.getIcon(Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE).getWorkspace(),Er(e),e.addChangeListener(Or))}},Or=function(e){(ma(e)||Ta(e)||_a(e)||Ea(e))&&(e=L(e.workspaceId),Er(e))},vr=function(e,t){return t.getAllBlocks(!1).filter(t=>Ir(t,e)||it(t)&&Xs.Names$$module$build$src$core$names.equals(t.getProcedureCall(),e))},Ir=function(e,t){return ur(e)&&!e.isProcedureDef()&&e.getProcedureModel()&&Xs.Names$$module$build$src$core$names.equals(e.getProcedureModel().getName(),t)},Xs.mutateCallers$$module$build$src$core$procedures=function(i){let n=e();var o=i.getProcedureDef()[0];let r=i.mutationToDom(!0);i=vr(o,i.workspace);for(let e,a=0;e=i[a];a++){o=(o=e.mutationToDom())&&de(o),e.domToMutation&&e.domToMutation(r);var s=e.mutationToDom();s&&=de(s),o!==s&&(Xs.setRecordUndo$$module$build$src$core$events$utils(!1),t(new(h(ja.BLOCK_CHANGE))(e,"mutation",null,o,s)),Xs.setRecordUndo$$module$build$src$core$events$utils(n))}},Xs.getDefinition$$module$build$src$core$procedures=function(e,t){for(let i of t.getAllBlocks(!1))if(ur(i)&&i.isProcedureDef()&&Xs.Names$$module$build$src$core$names.equals(i.getProcedureModel().getName(),e)||tt(i)&&Xs.Names$$module$build$src$core$names.equals(i.getProcedureDef()[0],e))return i;return null},Sr=function(e){return e.isDynamic},yr=function(e){return void 0!==e.pathDown&&void 0!==e.pathUp},Rr=function(e){return void 0!==e.pathLeft&&void 0!==e.pathRight},Cr=function(e,t){zs(ka.RENDERER,e,t)},kr=function(e){Ys(ka.RENDERER,e)},Ar=function(e,t,i){return(e=new(qs(ka.RENDERER,e))(e)).init(t,i),e},Lr=function(e){ft(e.getTargetWorkspace(),void 0,"String")},Nr=function(e){ft(e.getTargetWorkspace(),void 0,"Number")},wr=function(e){ft(e.getTargetWorkspace(),void 0,"Colour")},$r=function(e){return Mr(e,!1)},Mr=function(e,t=!0){return Ua.variables_set_dynamic||Ua.variables_get_dynamic||console.warn("There are no dynamic variable blocks, but there is a dynamic variable c
3ategory."),t?(ot("The XML return value of Blockly.VariablesDynamic.flyoutCategory()","v12","v13","the same method, but handle a return type of FlyoutItemInfo[] (JSON) instead."),xr(e)):(e.registerButtonCallback("CREATE_VARIABLE_STRING",Lr),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",Nr),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",wr),[{kind:"button",text:Xs.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE,callbackkey:"CREATE_VARIABLE_STRING"},{kind:"button",text:Xs.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE,callbackkey:"CREATE_VARIABLE_NUMBER"},{kind:"button",text:Xs.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE,callbackkey:"CREATE_VARIABLE_COLOUR"},...lt(e,e.getVariableMap().getAllVariables(),!1,"variables_get_dynamic","variables_set_dynamic")])},xr=function(e){let t=[],i=document.createElement("button");return i.setAttribute("text",Xs.Msg$$module$build$src$core$msg.NEW_STRING_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),t.push(i),i=document.createElement("button"),i.setAttribute("text",Xs.Msg$$module$build$src$core$msg.NEW_NUMBER_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),t.push(i),i=document.createElement("button"),i.setAttribute("text",Xs.Msg$$module$build$src$core$msg.NEW_COLOUR_VARIABLE),i.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),t.push(i),e.registerButtonCallback("CREATE_VARIABLE_STRING",Lr),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",Nr),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",wr),e=Dr(e),t.concat(e)},Dr=function(e){let t=[];if((e=e.getVariableMap().getAllVariables()).length>0){if(Ua.variables_set_dynamic){var i=e[e.length-1];let n=Xs.createElement$$module$build$src$core$utils$xml("block");n.setAttribute("type","variables_set_dynamic"),n.setAttribute("gap","24"),n.appendChild(Ot(i)),t.push(n)}if(Ua.variables_get_dynamic){e.sort(St);for(let n,o=0;n=e[o];o++)(i=Xs.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type","variables_get_dynamic"),i.setAttribute("gap","8"),i.appendChild(Ot(n)),t.push(i)}}return t},Pr=function(e){e.resizeContents()},Fr=function(e,t){let i=e.toCopyData();return Qf=i,Kf=k(e)&&e.workspace instanceof yf?e.workspace:null,qf=t,i},Br=function(){return Qf},Ur=function(e){Qf=e},Hr=function(){return Kf},Vr=function(e){Kf=e},Gr=function(){return qf},Wr=function(e){qf=e},Xr=function(e,t,i){return e&&t?zr(e,t,i):Qf&&Kf?zr(Qf,Kf,qf):null},zr=function(e,t,i){return t=t.isMutator?t:t.options.parentWorkspace??t,Js(ka.PASTER,e.paster,!1)?.paste(e,t,i)??null},jr=function(e){return e&&"function"==typeof e.toCopyData},Yr=function(){wl.registry.register({name:eg.ESCAPE,preconditionFn:e=>!e.isReadOnly(),callback:e=>(e.hideChaff(),!0),keyCodes:[Od.ESC]})},Qr=function(){wl.registry.register({name:eg.DELETE,preconditionFn:(e,t)=>(t=t.focusedNode,!e.isReadOnly()&&null!=t&&tr(t)&&t.isDeletable()&&!e.isDragging()&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()),callback:(e,t,i,n)=>(t.preventDefault(),(e=n.focusedNode)instanceof ep?e.checkAndDelete():tr(e)&&e.isDeletable()&&(Xs.setGroup$$module$build$src$core$events$utils(!0),e.dispose(),Xs.setGroup$$module$build$src$core$events$utils(!1)),!0),keyCodes:[Od.DELETE,Od.BACKSPACE]})},Kr=function(e){return!!(jr(e)&&tr(e)&&lr(e))&&(e.isCopyable?e.isCopyable():e instanceof ep||e instanceof id?e.isOwnDeletable()&&e.isOwnMovable():e.isDeletable()&&e.isMovable())},qr=function(e){return Kr(e)&&tr(e)&&e.isDeletable()},Jr=function(){let e=wl.registry.createSerializedKey(Od.C,[Od.CTRL_CMD]);wl.registry.register({name:eg.COPY,preconditionFn:(e,t)=>(t=t.focusedNode,e=e.isFlyout?e.targetWorkspace:e,!!t&&!!e&&!e.isDragging()&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&Kr(t)),callback:(e,t,i,n)=>(t.preventDefault(),!!((t=n.focusedNode)&&jr(t)&&Kr(t)&&(e=e.isFlyout?e.targetWorkspace:e,e))&&(t.workspace.isFlyout||e.hideChaff(),e=lr(t)&&t.workspace==e?t.getRelativeToSurfaceXY():void 0,!!Fr(t,e))),keyCodes:[e]})},Zr=function(){let e=wl.registry.createSerializedKey(Od.X,[Od.CTRL_CMD]);wl.registry.register({name:eg.CUT,preconditionFn:(e,t)=>!!(t=t.focusedNode)&&!e.isReadOnly()&&!e.isDragging()&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()&&qr(t),callback:(e,t,i,n)=>!!((e=n.focusedNode)&&qr(e)&&jr(e))&&(t=lr(e)?e.getRelativeToSurfaceXY():void 0,t=Fr(e,t),e instanceof ep?e.checkAndDelete():tr(e)&&e.dispose(),!!t),keyCodes:[e]})}
3,es=function(){let e=wl.registry.createSerializedKey(Od.V,[Od.CTRL_CMD]);wl.registry.register({name:eg.PASTE,preconditionFn(){var e=Hr();return!(!e||!e.rendered)&&(e=e.isFlyout?e.targetWorkspace:e,!(!Br()||!e||e.isReadOnly()||e.isDragging()||Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()))},callback(e,t){if(!(e=Br()))return!1;var i=Hr();if(!i||(!(i=i.isFlyout?i.targetWorkspace:i)||i.isReadOnly()))return!1;if(t instanceof PointerEvent)return t=ce(i,new Jl(t.clientX,t.clientY)),!!Xr(e,i,t);if(!(t=Gr()))return!!Xr(e,i);let{left:n,top:o,width:r,height:s}=i.getMetricsManager().getViewMetrics(!0);return new ec(o,o+s,n,n+r).contains(t.x,t.y)?!!Xr(e,i):(t=new Jl(n+r/2,o+s/2),!!Xr(e,i,t))},keyCodes:[e]})},ts=function(){let e=wl.registry.createSerializedKey(Od.Z,[Od.CTRL_CMD]);wl.registry.register({name:eg.UNDO,preconditionFn:e=>!e.isReadOnly()&&!e.isDragging()&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!1),t.preventDefault(),!0),keyCodes:[e]})},is=function(){let e=wl.registry.createSerializedKey(Od.Z,[Od.CTRL_CMD,Od.SHIFT]),t=wl.registry.createSerializedKey(Od.Y,[Od.CTRL]);wl.registry.register({name:eg.REDO,preconditionFn:e=>!e.isDragging()&&!e.isReadOnly()&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken(),callback:(e,t)=>(e.hideChaff(),e.undo(!0),t.preventDefault(),!0),keyCodes:[e,t]})},ns=function(){let e=wl.registry.createSerializedKey(Od.ENTER,[Od.CTRL_CMD]);wl.registry.register({name:eg.MENU,preconditionFn:e=>!e.isDragging(),callback:(e,t)=>{if(e=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),ar(e)){let i;return e.showContextMenu(t),null==(i=$n())||i.highlightNext(),!0}return!1},keyCodes:[e]})},os=function(){Yr(),Qr(),Jr(),Zr(),es(),ts(),is(),ns()},rs=function(e){let t=e.saveState();return e.getParameters().length&&(t.parameters=e.getParameters().map(e=>e.saveState())),t},ss=function(e,t,i,n){if(e=e.loadState(i,n),!i.parameters)return e;for(let[o,r]of i.parameters.entries())e.insertParameter(t.loadState(r,n),o);return e},as=function(e){let t=Object.create(null),i=Zs(ka.SERIALIZER,!0);for(let n in i){let o=i[n]?.save(e);o&&(t[n]=o)}return t},ls=function(i,n,{recordUndo:o=!1}={}){var r=Zs(ka.SERIALIZER,!0);if(r){r=Object.entries(r).sort((e,t)=>t[1].priority-e[1].priority);var s=e();Xs.setRecordUndo$$module$build$src$core$events$utils(o),(o=Xs.getGroup$$module$build$src$core$events$utils())||Xs.setGroup$$module$build$src$core$events$utils(!0),O(),n instanceof yf&&n.setResizesEnabled(!1);for(let[,e]of r.reverse()){let t;null==(t=e)||t.clear(n)}for(let[e,t]of r.reverse())if(i[e]){let o;null==(o=t)||o.load(i[e],n)}n instanceof yf&&n.setResizesEnabled(!0),v(),t(new(h(ja.FINISHED_LOADING))(n)),Xs.setGroup$$module$build$src$core$events$utils(o),Xs.setRecordUndo$$module$build$src$core$events$utils(s)}},cs=function(e,t){let i=null;var n;if(i="string"==typeof e?document.getElementById(e)||document.querySelector(e):e,!document.contains(i)&&document!==(n=i)?.ownerDocument)throw Error("Error: container is not in current document");e=new fd(t||{}),n=document.createElement("div"),f(n,"injectionDiv"),null!=t&&t.rtl&&f(n,"blocklyRTL"),i.appendChild(n),t=us(n,e);let o=hs(n,t,e);return ds(o),x(o),H(o),n.addEventListener("focusin",function(){x(o)}),aa(n,"keydown",null,z),o},us=function(e,t){e.setAttribute("dir","LTR"),Q(t.hasCss,t.pathToMedia);let i=p(Zl.SVG,{xmlns:bl,"xmlns:html":Ol,"xmlns:xlink":vl,version:"1.1",class:"blocklySvg"},e),n=p(Zl.DEFS,{},i),o=String(Math.random()).substring(2);return t.gridPattern=Mp.createDom(o,t.gridOptions,n,e),i},hs=function(e,t,i){i.parentWorkspace=null;let n=(i=new yf(i)).options;i.scale=n.zoomOptions.startScale,t.appendChild(i.createDom("blocklyMainBackground",e));var o=i.getRenderer().getClassName();return o&&f(e,o),(o=i.getTheme().getClassName())&&f(e,o),!n.hasCategories&&n.languageTree&&(e=i.addFlyout(Zl.SVG),E(e,t)),n.hasTrashcan&&i.addTrashcan(),n.zoomOptions&&n.zoomOptions.controls&&i.addZoomControls(),i.getThemeManager().subscribe(t,"workspaceBackgroun
3dColour","background-color"),i.translate(0,0),i.addChangeListener(Jo(i)),H(i),dn(),Zt(),Mi(),i},ds=function(e){let t=e.options;var i=e.getParentSvg();if(aa(i.parentNode,"contextmenu",null,function(e){ua(e)||e.preventDefault()}),i=aa(window,"resize",null,function(){Hi(),e.hideComponents(!0),bi(),In(),H(e),er(e)}),e.setResizeHandlerWrapper(i),ps(),t.languageTree){i=e.getToolbox();let n=e.getFlyout(!0);i?i.init():n&&(n.init(e),n.show(t.languageTree),"function"==typeof n.scrollToStart&&n.scrollToStart())}t.hasTrashcan&&e.trashcan.init(),t.zoomOptions&&t.zoomOptions.controls&&e.zoomControls_.init(),t.moveOptions&&t.moveOptions.scrollbars?(e.scrollbar=new yp(e,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.horizontal,!0===t.moveOptions.scrollbars||!!t.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),t.hasSounds&&fs(t.pathToMedia,e)},ps=function(){vg||(aa(document,"scroll",null,function(){let e=N();for(let t,i=0;t=e[i];i++)t instanceof yf&&t.updateInverseScreenCTM()}),la(document,"touchend",null,ia),la(document,"touchcancel",null,ia)),vg=!0},fs=function(e,t){(t=t.getAudioManager()).load([`${e}click.mp3`],"click"),t.load([`${e}disconnect.mp3`],"disconnect"),t.load([`${e}delete.mp3`],"delete")},gs=function(e){return!(!e||!e.isSimpleReporter())&&e.getFields().next().value?.isFullBlockField()},ms=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.UNDO,preconditionFn:e=>e.workspace.getUndoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!1)},scopeType:Fh.ScopeType.WORKSPACE,id:"undoWorkspace",weight:1})},Ts=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.REDO,preconditionFn:e=>e.workspace.getRedoStack().length>0?"enabled":"disabled",callback(e){e.workspace.undo(!0)},scopeType:Fh.ScopeType.WORKSPACE,id:"redoWorkspace",weight:2})},_s=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.CLEAN_UP,preconditionFn:e=>e.workspace.isMovable()?e.workspace.getTopBlocks(!1).length>1?"enabled":"disabled":"hidden",callback(e){e.workspace.cleanUp()},scopeType:Fh.ScopeType.WORKSPACE,id:"cleanWorkspace",weight:3})},Es=function(e,t){function i(t){o--,t.setCollapsed(e),0===o&&Xs.setGroup$$module$build$src$core$events$utils(!1)}let n=0,o=0;Xs.setGroup$$module$build$src$core$events$utils(!0);for(let r=0;r<t.length;r++){let e=t[r];for(;e;)o++,setTimeout(i.bind(null,e),n),e=e.getNextBlock(),n+=10}},bs=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.COLLAPSE_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let i=e[t];for(;i;){if(!i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Es(!0,e.workspace.getTopBlocks(!0))},scopeType:Fh.ScopeType.WORKSPACE,id:"collapseWorkspace",weight:4})},Os=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.EXPAND_ALL,preconditionFn(e){if(e.workspace.options.collapse){e=e.workspace.getTopBlocks(!1);for(let t=0;t<e.length;t++){let i=e[t];for(;i;){if(i.isCollapsed())return"enabled";i=i.getNextBlock()}}return"disabled"}return"hidden"},callback(e){Es(!1,e.workspace.getTopBlocks(!0))},scopeType:Fh.ScopeType.WORKSPACE,id:"expandWorkspace",weight:5})},vs=function(e,t){if(e.isDeletable())Array.prototype.push.apply(t,e.getDescendants(!1));else{e=e.getChildren(!1);for(let i=0;i<e.length;i++)vs(e[i],t)}},Is=function(e){let t=[];e=e.getTopBlocks(!0);for(let i=0;i<e.length;i++)vs(e[i],t);return t},Ss=function(e,t){t?Xs.setGroup$$module$build$src$core$events$utils(t):(Xs.setGroup$$module$build$src$core$events$utils(!0),t=Xs.getGroup$$module$build$src$core$events$utils());let i=e.shift();i&&(i.isDeadOrDying()?Ss(e,t):(i.dispose(!1,!0),setTimeout(Ss,10,e,t))),Xs.setGroup$$module$build$src$core$events$utils(!1)},ys=function(){Fh.registry.register({displayText:e=>e.workspace?1===(e=Is(e.workspace).length)?Xs.Msg$$module$build$src$core$msg.DELETE_BLOCK:Xs.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`):"",preconditionFn:e=>
3e.workspace&&Is(e.workspace).length>0?"enabled":"disabled",callback(e){if(e.workspace){e.workspace.cancelCurrentGesture();var t=Is(e.workspace);t.length<2?Ss(t):Qe(Xs.Msg$$module$build$src$core$msg.DELETE_ALL_BLOCKS.replace("%1",String(t.length)),function(e){e&&Ss(t)})}},scopeType:Fh.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},Rs=function(){ms(),Ts(),_s(),bs(),Os(),ys()},Cs=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.DUPLICATE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isDeletable()&&e.isMovable()?e.isDuplicatable()?"enabled":"disabled":"hidden",callback(e){if(e.block){var t=e.block.toCopyData();t&&Xr(t,e.block.workspace)}},scopeType:Fh.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},ks=function(){Fh.registry.register({displayText:e=>e.block.hasIcon(Ep.TYPE)?Xs.Msg$$module$build$src$core$msg.REMOVE_COMMENT:Xs.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>!(e=e.block)||e.isInFlyout||!e.workspace.options.comments||e.isCollapsed()||!e.isEditable()||!e.hasIcon(Ep.TYPE)&&gs(e)?"hidden":"enabled",callback(e){(e=e.block)&&e.hasIcon(Ep.TYPE)?e.setCommentText(null):e.setCommentText("")},scopeType:Fh.ScopeType.BLOCK,id:"blockComment",weight:2})},As=function(){Fh.registry.register({displayText:e=>e.block.getInputsInline()?Xs.Msg$$module$build$src$core$msg.EXTERNAL_INPUTS:Xs.Msg$$module$build$src$core$msg.INLINE_INPUTS,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed())for(let t=1;t<e.inputList.length;t++)if(!(e.inputList[t-1]instanceof fg||e.inputList[t]instanceof fg))return"enabled";return"hidden"},callback(e){e.block.setInputsInline(!e.block.getInputsInline())},scopeType:Fh.ScopeType.BLOCK,id:"blockInline",weight:3})},Ls=function(){Fh.registry.register({displayText:e=>e.block.isCollapsed()?Xs.Msg$$module$build$src$core$msg.EXPAND_BLOCK:Xs.Msg$$module$build$src$core$msg.COLLAPSE_BLOCK,preconditionFn:e=>!(e=e.block).isInFlyout&&e.isMovable()&&e.workspace.options.collapse?"enabled":"hidden",callback(e){e.block.setCollapsed(!e.block.isCollapsed())},scopeType:Fh.ScopeType.BLOCK,id:"blockCollapseExpand",weight:4})},Ns=function(){Fh.registry.register({displayText:e=>e.block.hasDisabledReason(Xc)?Xs.Msg$$module$build$src$core$msg.ENABLE_BLOCK:Xs.Msg$$module$build$src$core$msg.DISABLE_BLOCK,preconditionFn(e){if(!(e=e.block).isInFlyout&&e.workspace.options.disable&&e.isEditable()){var t=e.getDisabledReasons();return t=t.size>+!!t.has(Xc),e.getInheritedDisabled()||t?"disabled":"enabled"}return"hidden"},callback(e){e=e.block;let t=Xs.getGroup$$module$build$src$core$events$utils();t||Xs.setGroup$$module$build$src$core$events$utils(!0),e.setDisabledReason(!e.hasDisabledReason(Xc),Xc),Xs.setGroup$$module$build$src$core$events$utils(t)},scopeType:Fh.ScopeType.BLOCK,id:"blockDisable",weight:5})},ws=function(){Fh.registry.register({displayText(e){var t=e.block;return e=t.getDescendants(!1).length,(t=t.getNextBlock())&&(e-=t.getDescendants(!1).length),1===e?Xs.Msg$$module$build$src$core$msg.DELETE_BLOCK:Xs.Msg$$module$build$src$core$msg.DELETE_X_BLOCKS.replace("%1",`${e}`)},preconditionFn:e=>!e.block.isInFlyout&&e.block.isDeletable()?"enabled":"hidden",callback(e){e.block&&e.block.checkAndDelete()},scopeType:Fh.ScopeType.BLOCK,id:"blockDelete",weight:6})},$s=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.HELP,preconditionFn:e=>("function"==typeof(e=e.block).helpUrl?e.helpUrl():e.helpUrl)?"enabled":"hidden",callback(e){e.block.showHelp()},scopeType:Fh.ScopeType.BLOCK,id:"blockHelp",weight:7})},Ms=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.REMOVE_COMMENT,preconditionFn(e){let t;return null!=(t=e.comment)&&t.isDeletable()?"enabled":"hidden"},callback(e){let t;Xs.setGroup$$module$build$src$core$events$utils(!0),null==(t=e.comment)||t.dispose(),Xs.setGroup$$module$build$src$core$events$utils(!1)},scopeType:Fh.ScopeType.COMMENT,id:"commentDelete",weight:6})},xs=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.DUPLICATE_COMMENT,preconditionFn(e){let t;return null!=(t=e.comment)&&t.isMovable()?"enabled":"hidden"},callback(e){if(e.comment){var t=e.comment.toCopyData();t&&Xr(t,e.comment.workspace)}}
3,scopeType:Fh.ScopeType.COMMENT,id:"commentDuplicate",weight:1})},Ds=function(){Fh.registry.register({displayText:()=>Xs.Msg$$module$build$src$core$msg.ADD_COMMENT,preconditionFn:e=>{let t;return null!=(t=e.workspace)&&t.isMutator?"hidden":"enabled"},callback:(e,t,i,n)=>{(e=e.workspace)&&(Xs.setGroup$$module$build$src$core$events$utils(!0),(t=new id(e)).moveTo(ce(e,new Jl(n.x,n.y))),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),Xs.setGroup$$module$build$src$core$events$utils(!1))},scopeType:Fh.ScopeType.WORKSPACE,id:"commentCreate",weight:8})},Ps=function(){Cs(),ks(),As(),Ls(),Ns(),ws(),$s()},Fs=function(){xs(),Ms(),Ds()},Bs=function(){Rs(),Ps()},Us=function(e){return e&&"function"==typeof e.paste},Hs=function(e){return e&&"function"==typeof e.getSvgRoot},Vs=function(e){return e.isSelectable()},Gs=function(e){M().hideChaff(e)},Ws||={},Ws.scope={},Ws.ASSUME_ES5=!1,Ws.ASSUME_ES6=!1,Ws.ASSUME_ES2020=!1,Ws.ASSUME_NO_NATIVE_MAP=!1,Ws.ASSUME_NO_NATIVE_SET=!1,Ws.ISOLATE_POLYFILLS=!1,Ws.FORCE_POLYFILL_PROMISE=!1,Ws.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1,Ws.INSTRUMENT_ASYNC_CONTEXT=!0,Ws.objectCreate=Ws.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(e){var t=function(){};return t.prototype=e,new t},Ws.defineProperty=Ws.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,i){return e==Array.prototype||e==Object.prototype||(e[t]=i.value),e},Ws.getGlobal=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var t=0;t<e.length;++t){var i=e[t];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")},Ws.global=Ws.ASSUME_ES2020?globalThis:Ws.getGlobal(this),Ws.IS_SYMBOL_NATIVE="function"==typeof Symbol&&"symbol"==typeof Symbol("x"),Ws.TRUST_ES6_POLYFILLS=!Ws.ISOLATE_POLYFILLS||Ws.IS_SYMBOL_NATIVE,Ws.polyfills={},Ws.propertyToPolyfillSymbol={},Ws.POLYFILL_PREFIX="$jscp$",Ws.TYPED_ARRAY_CLASSES=function(){var e="Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64".split(" ");return Ws.global.BigInt64Array&&(e.push("BigInt64"),e.push("BigUint64")),e}(),Ws.polyfillTypedArrayMethod=function(e,t,i,n){if(t)for(var o=0;o<Ws.TYPED_ARRAY_CLASSES.length;o++){var r=Ws.TYPED_ARRAY_CLASSES[o]+"Array.prototype."+e;Ws.ISOLATE_POLYFILLS?Ws.polyfillIsolated(r,t,i,n):Ws.polyfillUnisolated(r,t,i,n)}},Ws.polyfill=function(e,t,i,n){t&&(Ws.ISOLATE_POLYFILLS?Ws.polyfillIsolated(e,t,i,n):Ws.polyfillUnisolated(e,t,i,n))},Ws.polyfillUnisolated=function(e,t,i,n){for(i=Ws.global,e=e.split("."),n=0;n<e.length-1;n++){var o=e[n];if(!(o in i))return;i=i[o]}(t=t(n=i[e=e[e.length-1]]))!=n&&null!=t&&Ws.defineProperty(i,e,{configurable:!0,writable:!0,value:t})},Ws.polyfillIsolated=function(e,t,i,n){var o=e.split(".");e=1===o.length,n=o[0],n=!e&&n in Ws.polyfills?Ws.polyfills:Ws.global;for(var r=0;r<o.length-1;r++){var s=o[r];if(!(s in n))return;n=n[s]}o=o[o.length-1],null!=(t=t(i=Ws.IS_SYMBOL_NATIVE&&"es6"===i?n[o]:null))&&(e?Ws.defineProperty(Ws.polyfills,o,{configurable:!0,writable:!0,value:t}):t!==i&&(void 0===Ws.propertyToPolyfillSymbol[o]&&(i=1e9*Math.random()>>>0,Ws.propertyToPolyfillSymbol[o]=Ws.IS_SYMBOL_NATIVE?Ws.global.Symbol(o):Ws.POLYFILL_PREFIX+i+"$"+o),Ws.defineProperty(n,Ws.propertyToPolyfillSymbol[o],{configurable:!0,writable:!0,value:t})))},Ws.getConstructImplementation=function(){if(Ws.TRUST_ES6_POLYFILLS&&typeof Reflect<"u"&&Reflect.construct){if(function(){function e(){}return new e,Reflect.construct(e,[],function(){}),new e instanceof e}())return Reflect.construct;var e=Reflect.construct;return function(t,i,n){return t=e(t,i),n&&Reflect.setPrototypeOf(t,n.prototype),t}}return function(e,t,i){return void 0===i&&(i=e),i=Ws.objectCreate(i.prototype||Object.prototype),Function.prototype.apply.call(e,i,t)||i}},Ws.construct=Ws.getConstructImplementation(),Ws.underscoreProtoCanBeSet=function(){var e={};try{return e.__proto__={a:!0},e.a}catch{}return!1},Ws.setPrototypeOf=Ws.ASSUME_ES6||Ws.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:Ws.underscoreProtoCanBeSet()?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw TypeError(e+" is not extensible");return e}:null,Ws.inherits=function(e,t){if(e.prototype=Ws.objectCreate(t.prototype),e.prototype.constructor=e,Ws.ASSUME_ES6||Ws.setPrototypeOf){var i=Ws.setPrototypeOf;i(e,t)}else for(i in t)if("prototype"!=i)if(Object.defineProperties){var n=Object.getOwnPropertyDescriptor(t,i);n&&Object.defineProperty(e,i,n)}else e[i]=t[i];e.superClass_=t.prototype},Ws.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}},Ws.arrayIterator=function(e){return{next:Ws.arrayIteratorImpl(e)}},Ws.makeIterator=function(e){var t=typeof Symbol<"u"&&Symbol.iterator&&e[Symbol.iterator];if(t)return t.call(e);
3if("number"==typeof e.length)return Ws.arrayIterator(e);throw Error(String(e)+" is not an iterable or ArrayLike")},Ws.arrayFromIterator=function(e){for(var t,i=[];!(t=e.next()).done;)i.push(t.value);return i},Ws.arrayFromIterable=function(e){return e instanceof Array?e:Ws.arrayFromIterator(Ws.makeIterator(e))},Ws.generator={},Ws.generator.ensureIteratorResultIsObject_=function(e){if(!(e instanceof Object))throw TypeError("Iterator result "+e+" is not an object")},Ws.generator.Context=function(){this.isRunning_=!1,this.yieldAllIterator_=null,this.yieldResult=void 0,this.nextAddress=1,this.finallyAddress_=this.catchAddress_=0,this.finallyContexts_=this.abruptCompletion_=null},Ws.generator.Context.prototype.start_=function(){if(this.isRunning_)throw TypeError("Generator is already running");this.isRunning_=!0},Ws.generator.Context.prototype.stop_=function(){this.isRunning_=!1},Ws.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_},Ws.generator.Context.prototype.next_=function(e){this.yieldResult=e},Ws.generator.Context.prototype.throw_=function(e){this.abruptCompletion_={exception:e,isException:!0},this.jumpToErrorHandler_()},Ws.generator.Context.prototype.getNextAddress=function(){return this.nextAddress},Ws.generator.Context.prototype.getNextAddress=Ws.generator.Context.prototype.getNextAddress,Ws.generator.Context.prototype.getYieldResult=function(){return this.yieldResult},Ws.generator.Context.prototype.getYieldResult=Ws.generator.Context.prototype.getYieldResult,Ws.generator.Context.prototype.return=function(e){this.abruptCompletion_={return:e},this.nextAddress=this.finallyAddress_},Ws.generator.Context.prototype.return=Ws.generator.Context.prototype.return,Ws.generator.Context.prototype.jumpThroughFinallyBlocks=function(e){this.abruptCompletion_={jumpTo:e},this.nextAddress=this.finallyAddress_},Ws.generator.Context.prototype.jumpThroughFinallyBlocks=Ws.generator.Context.prototype.jumpThroughFinallyBlocks,Ws.generator.Context.prototype.yield=function(e,t){return this.nextAddress=t,{value:e}},Ws.generator.Context.prototype.yield=Ws.generator.Context.prototype.yield,Ws.generator.Context.prototype.yieldAll=function(e,t){var i=(e=Ws.makeIterator(e)).next();if(Ws.generator.ensureIteratorResultIsObject_(i),!i.done)return this.yieldAllIterator_=e,this.yield(i.value,t);this.yieldResult=i.value,this.nextAddress=t},Ws.generator.Context.prototype.yieldAll=Ws.generator.Context.prototype.yieldAll,Ws.generator.Context.prototype.jumpTo=function(e){this.nextAddress=e},Ws.generator.Context.prototype.jumpTo=Ws.generator.Context.prototype.jumpTo,Ws.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0},Ws.generator.Context.prototype.jumpToEnd=Ws.generator.Context.prototype.jumpToEnd,Ws.generator.Context.prototype.setCatchFinallyBlocks=function(e,t){this.catchAddress_=e,null!=t&&(this.finallyAddress_=t)},Ws.generator.Context.prototype.setCatchFinallyBlocks=Ws.generator.Context.prototype.setCatchFinallyBlocks,Ws.generator.Context.prototype.setFinallyBlock=function(e){this.catchAddress_=0,this.finallyAddress_=e||0},Ws.generator.Context.prototype.setFinallyBlock=Ws.generator.Context.prototype.setFinallyBlock,Ws.generator.Context.prototype.leaveTryBlock=function(e,t){this.nextAddress=e,this.catchAddress_=t||0},Ws.generator.Context.prototype.leaveTryBlock=Ws.generator.Context.prototype.leaveTryBlock,Ws.generator.Context.prototype.enterCatchBlock=function(e){return this.catchAddress_=e||0,e=this.abruptCompletion_.exception,this.abruptCompletion_=null,e},Ws.generator.Context.prototype.enterCatchBlock=Ws.generator.Context.prototype.enterCatchBlock,Ws.generator.Context.prototype.enterFinallyBlock=function(e,t,i){i?this.finallyContexts_[i]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_],this.catchAddress_=e||0,this.finallyAddress_=t||0},Ws.generator.Context.prototype.enterFinallyBlock=Ws.generator.Context.prototype.enterFinallyBlock,Ws.generator.Context.prototype.leaveFinallyBlock=function(e,t){if(t=this.finallyContexts_.splice(t||0)[0],t=this.abruptCompletion_=this.abruptCompletion_||t){if(t.isException)return this.jumpToErrorHandler_();null!=t.jumpTo&&this.finallyAddress_<t.jumpTo?(this.nextAddress=t.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=e},Ws.generator.Context.prototype.leaveFinallyBlock=Ws.generator.Context.prototype.leaveFinallyBlock,Ws.generator.Context.prototype.forIn=function(e){return new Ws.generator.Context.PropertyIterator(e)},Ws.generator.Context.prototype.forIn=Ws.generator.Context.prototype.forIn,Ws.generator.Context.PropertyIterator=function(e){for(var t in this.object_=e,this.properties_=[],e)this.properties_.push(t);this.properties_.reverse()},Ws.generator.Context.PropertyIterator.prototype.getNext=function(){for(;this.properties_.length>0;){var e=this.properties_.pop();if(e in this.object_)return e}return null},Ws.generator.Context.PropertyIterator.prototype.getNext=Ws.generator.Context.PropertyIterator.prototype.getNext,Ws.generator.Engine_=function(e){this.context_=new Ws.generator.Context,this.program_=e},Ws.generator.Engine_.prototype.next_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.next,e,this.context_.next_):(this.context_.next_(e),this.nextStep_())},Ws.generator.Engine_.prototype.return_=function(e){this.context_.start_();var t=this.context_.yieldAllIterator_;return t?this.yieldAllStep_("return"in t?t.return:function(e){return{value:e,done:!0}},e,this.context_.return):(this.context_.return(e),this.nextStep_())},Ws.generator.Engine_.prototype.throw_=function(e){return this.context_.start_(),this.context_.yieldAllIterator_?this.yieldAllStep_(this.context_.yieldAllIterator_.throw,e,this.context_.next_):(this.context_.throw_(e),this.nextStep_())},Ws.generator.Engine_.prototype.yieldAllStep_=function(e,t,i){try{var n=e.call(this.context_.yieldAllIterator_,t);if(Ws.generator.ensureIteratorResultIsObject_(n),!n.done)return this.context_.stop_(),n;var o=n.value}catch(e){return this.context_.yieldAllIterator_=null,this.context_.throw_(e),this.nextStep_()}
3return this.context_.yieldAllIterator_=null,i.call(this.context_,o),this.nextStep_()},Ws.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var e=this.program_(this.context_);if(e)return this.context_.stop_(),{value:e.value,done:!1}}catch(e){this.context_.yieldResult=void 0,this.context_.throw_(e)}if(this.context_.stop_(),this.context_.abruptCompletion_){if(e=this.context_.abruptCompletion_,this.context_.abruptCompletion_=null,e.isException)throw e.exception;return{value:e.return,done:!0}}return{value:void 0,done:!0}},Ws.generator.Generator_=function(e){this.next=function(t){return e.next_(t)},this.throw=function(t){return e.throw_(t)},this.return=function(t){return e.return_(t)},this[Symbol.iterator]=function(){return this}},Ws.generator.createGenerator=function(e,t){return t=new Ws.generator.Generator_(new Ws.generator.Engine_(t)),Ws.setPrototypeOf&&e.prototype&&Ws.setPrototypeOf(t,e.prototype),t},Ws.asyncExecutePromiseGenerator=function(e){function t(t){return e.next(t)}function i(t){return e.throw(t)}return new Promise(function(n,o){!function e(r){r.done?n(r.value):Promise.resolve(r.value).then(t,i).then(e,o)}(e.next())})},Ws.asyncExecutePromiseGeneratorFunction=function(e){return Ws.asyncExecutePromiseGenerator(e())},Ws.asyncExecutePromiseGeneratorProgram=function(e){return Ws.asyncExecutePromiseGenerator(new Ws.generator.Generator_(new Ws.generator.Engine_(e)))},Ws.polyfill("globalThis",function(e){return e||Ws.global},"es_2020","es3"),Ws.polyfill("Array.prototype.includes",function(e){return e||function(e,t){var i=this;i instanceof String&&(i=String(i));var n=i.length;for(t||=0,t<0&&(t=Math.max(t+n,0));t<n;t++){var o=i[t];if(o===e||Object.is(o,e))return!0}return!1}},"es7","es3"),Ws.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new Ws.global.Proxy(e,{get:function(i,n,o){return i==e&&"q"==n&&o==t}}));return!0===t.q}catch{return!1}},Ws.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1,Ws.ES6_CONFORMANCE=Ws.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&Ws.checkEs6ConformanceViaProxy(),Ws.initSymbol=function(){},Ws.iteratorPrototype=function(e){return(e={next:e})[Symbol.iterator]=function(){return this},e},Ws.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},Ws.MapEntry=function(){},Ws.polyfill("Set.prototype.difference",function(e){return e||function(e){Ws.checkIsSetInstance(this),Ws.checkIsSetLike(e);var t=Ws.getSmallerAndLargerSets(this,e);e=new Set(this);var i=t.smallerSetIterator;t=t.largerSet;for(var n=i.next();!n.done;)t.has(n.value)&&e.delete(n.value),n=i.next();return e}},"es_next","es6"),Ws.checkIsSetLike=function(e){if("object"!=typeof e||!e||"number"!=typeof e.size||e.size<0||"function"!=typeof e.keys||"function"!=typeof e.has)throw TypeError("Argument must be set-like")},Ws.checkIsValidIterator=function(e){if("object"!=typeof e||!e||"function"!=typeof e.next)throw TypeError("Invalid iterator.");return e},Ws.getSmallerAndLargerSets=function(e,t){return e.size<=t.size?{smallerSetIterator:e.keys(),largerSet:t}:{smallerSetIterator:Ws.checkIsValidIterator(t.keys()),largerSet:e}},Ws.checkIsSetInstance=function(e){if(!(e instanceof Set))throw TypeError("Method must be called on an instance of Set.")},Ws.iteratorFromArray=function(e,t){if(Ws.ASSUME_ES6)return e[Symbol.iterator]();e instanceof String&&(e+="");var i=0,n=!1,o={next:function(){if(!n&&i<e.length){var o=i++;return{value:t(o,e[o]),done:!1}}return n=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o},Ws.polyfill("Array.prototype.values",function(e){return e||function(){return Ws.iteratorFromArray(this,function(e,t){return t})}},"es8","es3"),Ws.polyfill("Array.prototype.flatMap",function(e){return e||function(e,t){var i=[];return Array.prototype.forEach.call(this,function(n,o){n=e.call(t,n,o,this),Array.isArray(n)?i.push.apply(i,n):i.push(n)}),i}},"es9","es5"),Ws.polyfill("Array.prototype.flat",function(e){return e||function(e){e=void 0===e?1:e;var t=[];return Array.prototype.forEach.call(this,function(i){Array.isArray(i)&&e>0?(i=Array.prototype.flat.call(i,e-1),t.push.apply(t,i)):t.push(i)}),t}},"es9","es5"),Ws.polyfill("Object.entries",function(e){return e||function(e){var t,i=[];for(t in e)Ws.owns(e,t)&&i.push([t,e[t]]);return i}},"es8","es3"),Ws.polyfill("Object.values",function(e){return e||function(e){var t,i=[];for(t in e)Ws.owns(e,t)&&i.push(e[t]);return i}},"es8","es3");var Sa=Object.create(null),ya={typeMap:Sa},Ra=Object.create(null),Ca="default",ka=class{constructor(e){this.name=e}toString(){return this.name}};ka.CONNECTION_CHECKER=new ka("connectionChecker"),ka.CONNECTION_PREVIEWER=new ka("connectionPreviewer"),ka.CURSOR=new ka("cursor"),ka.EVENT=new ka("event"),k
3a.FIELD=new ka("field"),ka.INPUT=new ka("input"),ka.RENDERER=new ka("renderer"),ka.TOOLBOX=new ka("toolbox"),ka.THEME=new ka("theme"),ka.TOOLBOX_ITEM=new ka("toolboxItem"),ka.FLYOUTS_VERTICAL_TOOLBOX=new ka("flyoutsVerticalToolbox"),ka.FLYOUTS_HORIZONTAL_TOOLBOX=new ka("flyoutsHorizontalToolbox"),ka.FLYOUT_INFLATER=new ka("flyoutInflater"),ka.METRICS_MANAGER=new ka("metricsManager"),ka.BLOCK_DRAGGER=new ka("blockDragger"),ka.SERIALIZER=new ka("serializer"),ka.ICON=new ka("icon"),ka.PASTER=new ka("paster"),ka.VARIABLE_MODEL=new ka("variableModel"),ka.VARIABLE_MAP=new ka("variableMap");var Aa={DEFAULT:Ca,TEST_ONLY:ya};Aa.Type=ka,Aa.getAllItems=Zs,Aa.getClass=qs,Aa.getClassFromOptions=ea,Aa.getObject=Js,Aa.hasItem=Ks,Aa.register=zs,Aa.unregister=Ys;var La,Na,wa,$a,Ma,xa,Da,Pa,Fa,Ba,Ua=Object.create(null),Ha=750,Va="ontouchstart"in globalThis||!!(globalThis.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!globalThis.navigator||!globalThis.navigator.maxTouchPoints&&!globalThis.navigator.msMaxTouchPoints),Ga=null,Wa={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]},Xa=0,za={TOUCH_ENABLED:Va,TOUCH_MAP:Wa};za.checkTouchIdentifier=sa,za.clearTouchIdentifier=na,za.getTouchIdentifierFromEvent=ra,za.longStart=ta,za.longStop=ia,za.shouldHandleEvent=oa,function(e){function t(e){return i.includes(e.toUpperCase())}let i=(La=e).toUpperCase();Na=t("JavaFX"),wa=t("WebKit"),$a=t("Gecko")&&!wa,Ma=t("Android"),e=globalThis.navigator&&globalThis.navigator.maxTouchPoints,xa=t("iPad")||t("Macintosh")&&e>0,Da=t("iPhone")&&!xa,Pa=t("Macintosh"),Fa=xa||Ma&&!t("Mobile")||t("Silk"),Ba=!Fa&&(Da||Ma)}(globalThis.navigator&&globalThis.navigator.userAgent||"");var ja,Ya=Na,Qa=$a,Ka=Ma,Ja=xa,Za=Da,el=Pa,tl=Ba,il={ANDROID:Ka,GECKO:Qa,IPAD:Ja,IPHONE:Za,JavaFx:Ya,MAC:el,MOBILE:tl,raw:La},nl=40,ol=125,rl={};rl.bind=la,rl.conditionalBind=aa,rl.getScrollDeltaPixels=pa,rl.isRightButton=ha,rl.isTargetInput=ua,rl.mouseToSvg=da,rl.unbind=ca,function(e){e.BLOCK_CREATE="create",e.BLOCK_DELETE="delete",e.BLOCK_CHANGE="change",e.BLOCK_FIELD_INTERMEDIATE_CHANGE="block_field_intermediate_change",e.BLOCK_MOVE="move",e.VAR_CREATE="var_create",e.VAR_DELETE="var_delete",e.VAR_RENAME="var_rename",e.VAR_TYPE_CHANGE="var_type_change",e.UI="ui",e.BLOCK_DRAG="drag",e.SELECTED="selected",e.CLICK="click",e.MARKER_MOVE="marker_move",e.BUBBLE_OPEN="bubble_open",e.TRASHCAN_OPEN="trashcan_open",e.TOOLBOX_ITEM_SELECT="toolbox_item_select",e.THEME_CHANGE="theme_change",e.VIEWPORT_CHANGE="viewport_change",e.COMMENT_CREATE="comment_create",e.COMMENT_DELETE="comment_delete",e.COMMENT_CHANGE="comment_change",e.COMMENT_MOVE="comment_move",e.COMMENT_RESIZE="comment_resize",e.COMMENT_DRAG="comment_drag",e.COMMENT_COLLAPSE="comment_collapse",e.FINISHED_LOADING="finished_loading"}(ja||={});var sl=[ja.BLOCK_CREATE,ja.BLOCK_MOVE,ja.COMMENT_CREATE,ja.COMMENT_MOVE];({BUMP_EVENTS:sl}).EventType=ja;var al="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ll={genUid:()=>{let e=[];for(let t=0;t<20;t++)e[t]=al.charAt(88*Math.random());return e.join("")}},cl=0,ul={TEST_ONLY:ll};ul.genUid=ga,ul.getNextUniqueId=fa;var hl={};hl.isBlockChange=_a,hl.isBlockCreate=ma,hl.isBlockDelete=Ta,hl.isBlockDrag=function(e){return e.type===ja.BLOCK_DRAG},hl.isBlockFieldIntermediateChange=Ea,hl.isBlockMove=ba,hl.isBubbleOpen=va,hl.isClick=Oa,hl.isCommentChange=function(e){return e.type===ja.COMMENT_CHANGE},hl.isCommentCollapse=function(e){return e.type===ja.COMMENT_COLLAPSE},hl.isCommentCreate=function(e){return e.type===ja.COMMENT_CREATE},hl.isCommentDelete=function(e){return e.type===ja.COMMENT_DELETE},hl.isCommentDrag=function(e){return e.type===ja.COMMENT_DRAG},hl.isCommentMove=function(e){return e.type===ja.COMMENT_MOVE},hl.isCommentResize=function(e){return e.type===ja.COMMENT_RESIZE},hl.isFinishedLoading=function(e){return e.type===ja.FINISHED_LOADING},hl.isSelected=function(e){return e.type===ja.SELECTED},hl.isThemeChange=function(e){return e.type===ja.THEME_CHANGE},hl.isToolboxItemSelect=function(e){return e.type===ja.TOOLBOX_ITEM_SELECT},hl.isTrashcanOpen=function(e){return e.type===ja.TRASHCAN_OPEN},hl.isVarCreate=function(e){return e.type===ja.VAR_CREATE},hl.isVarDelete=function(e){return e.type===ja.VAR_DELETE},hl.isVarRename=function(e){return e.type===ja.VAR_RENAME},hl.isViewportChange=Ia;var dl="",pl=!0,fl=0,gl="ORPHANED_BLOCK",ml=[],Tl={FIRE_QUEUE:ml,enqueueEvent:o,fireNow:n,fireInternal:i,setGroupInternal:l},_l={TEST_ONLY:Tl};_l.clearPendingUndo=s,_l.disable=Xs.disable$$module$build$src$core$events$utils,_l.disableOrphans=d,_l.enable=Xs.enable$$module$build$src$core$events$utils,_l.filter=r,_l.fire=t,_l.fromJson=u,_l.get=h,_l.getDescendantIds=c,_l.getGroup=Xs.getGroup$$module$build$src$core$events$utils,_l.getRecordUndo=e,_l.isEnabled=a,_l.setGroup=Xs.setGroup$$module$build$src$core$events$utils,_l.setRecordUndo=Xs.setRecordUndo$$module$build$src$core$events$utils;var El,bl="http://www.w3.org/2000/svg",Ol="http://www.w3.org/1999/xhtml",vl="http://www.w3.org/1999/xlink";!function(e){e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE"}(El||={});var Il=null,Sl=0,yl=null,Rl={HTML_NS:Ol};Rl.NodeType=El,Rl.SVG_NS=bl,Rl.XLINK_NS=vl,Rl.addClass=f,Rl.createSvgElement=p,Rl.getFastTextWidth=S,Rl.getFastTextWidthWithSizeString=y,Rl.getTextWidth=I,Rl.hasClass=T,Rl.insertAfter=E,Rl.measureFontMetrics=R,Rl.removeClass=m,Rl.removeClasses=g,Rl.removeNode=_,Rl.setCssTransform=b,Rl.startTextWidthCache=O,Rl.stopTextWidthCache=v;var Cl=class{static findFocusedNode(e){var t=e.getRootFocusableNode();if(!t.canBeFocused())return null;var i=t.getFocusableElement();return T(i,Cl.ACTIVE_CLASS_NAME)||T(i,Cl.PASSIVE_CSS_CLASS_NAME)||((t=i.querySelector(this.ACTIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||t instanceof SVGElement)&&(t=Cl.findFocusableNodeFor(t,e))?t:((i=i.querySelector(this.PASSIVE_FOCUS_NODE_CSS_SELECTOR))instanceof HTMLElement||i instanceof SVGElement)&&(e=Cl.findFocusableNodeFor(i,e))?e:null}static findFocusableNodeFor(e,t){if(!e.id||"null"===e.id||-1!==t.getNestedTrees().map(t=>Cl.findFocusableNodeFor(e,t)).findIndex(e=>!!e))return null;var i,n=t.getRootFocusableNode();return n.canBeFocused()&&e===n.getFocusableElement()||(n=(i=t.lookUpFocusableNode(e.id))??null)?n:(i=e.parentElement,!n&&i?Cl.findFocusableNodeFor(i,t):null)}};Cl.ACTIVE_CLASS_NAME="blocklyActiveFocus",Cl.PASSIVE_CSS_CLASS_NAME="blocklyPassiveFocus",Cl.ACTIVE_FOCUS_NODE_CSS_SELECTOR=`.${Cl.ACTIVE_CLASS_NAME}`,Cl.PASSIVE_FOCUS_NODE_CSS_SELECTOR=`.${Cl.PASSIVE_CSS_CLASS_NAME}`;var kl=class{constructor(e,t){this.tree=e,this.rootShouldBeAutoTabbable=t}},Al=class{constructor(e){this.previouslyFocusedNode=this.focusedNode=null,this.registeredTrees=[],this.isUpdatingFocusedNode=this.recentlyLostAllFocus=this.lockFocusStateChanges=this.currentlyHoldsEphemeralFocus=!1;let t=e=>{if(!this.isUpdatingFocusedNode){this.recentlyLostAllFocus=!e;var t=null;if(e instanceof HTMLElement||e instanceof SVGElement)for(var i of this.registeredTrees)if(t=Cl.findFocusableNodeFor(e,i.tree))break;t&&t.canBeFocused()?(e=t.getFocusableTree(),i=this.focusedNode?.getFocusableTree(),t===e.getRootFocusableNode()&&e!==i?this.focusTree(e):this.focusNode(t)):this.defocusCurrentFocusedNode()}};e("focusin",e=>{e instanceof FocusEvent&&t(document.activeElement)}),e("focusout",e=>{e instanceof FocusEvent&&t(e.relatedTarget)})}registerTree(e,t=!1){if(this.ensureManagerIsUnlocked(),this.isRegistered(e))throw Error(`Attempted to re-register already registered tree: ${e}.`);this.registeredTrees.push(new kl(e,t));let i=e.getRootFocusableNode().getFocusableElement();if(!i.id||"null"===i.id)throw Error(`Attempting to register a tree with a root element that has an invali
3d ID: ${e}.`);t&&(i.tabIndex=0)}isRegistered(e){return!!this.lookUpRegistration(e)}lookUpRegistration(e){return this.registeredTrees.find(t=>t.tree===e)??null}unregisterTree(e){if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to unregister not registered tree: ${e}.`);var t=this.registeredTrees.findIndex(t=>t.tree===e);let i=this.registeredTrees[t];this.registeredTrees.splice(t,1),t=Cl.findFocusedNode(e);let n=e.getRootFocusableNode();t&&this.removeHighlight(t),this.focusedNode!==t&&this.focusedNode!==n||this.updateFocusedNode(null),this.removeHighlight(n),i.rootShouldBeAutoTabbable&&e.getRootFocusableNode().getFocusableElement().removeAttribute("tabindex")}getFocusedTree(){return this.focusedNode?.getFocusableTree()??null}getFocusedNode(){return this.focusedNode}focusTree(e){if(this.ensureManagerIsUnlocked(),!this.isRegistered(e))throw Error(`Attempted to focus unregistered tree: ${e}.`);let t=Cl.findFocusedNode(e),i=e.getRestoredFocusableNode(t);e=e.getRootFocusableNode(),this.focusNode(i??t??e)}focusNode(e){this.ensureManagerIsUnlocked();let t=!this.currentlyHoldsEphemeralFocus;t&&(this.isUpdatingFocusedNode=!0);var i,n=(i=this.focusedNode)?.getFocusableElement()!==document.activeElement;if(this.focusedNode!==e||n)if(e.canBeFocused()){if(i=e.getFocusableTree(),!this.isRegistered(i))throw Error(`Attempted to focus unregistered node: ${e}.`);(n=e.getFocusableElement()).id&&"null"!==n.id||console.warn("Trying to focus a node that has an invalid ID.");var o=Cl.findFocusableNodeFor(n,i);n=Cl.findFocusedNode(i);var r,s=e;if(o!==e)s=i.getRestoredFocusableNode(n),e=i.getRootFocusableNode(),s=(r=s??n)??e;e=this.focusedNode,r=e?.getFocusableTree(),e&&this.passivelyFocusNode(e,i),i=i.getRootFocusableNode(),n&&this.removeHighlight(n),i!==s&&this.removeHighlight(i),this.currentlyHoldsEphemeralFocus||this.activelyFocusNode(s,r??null),this.updateFocusedNode(s)}else console.warn("Trying to focus a node that can't be focused.");t&&(this.isUpdatingFocusedNode=!1)}takeEphemeralFocus(e){if(this.ensureManagerIsUnlocked(),this.currentlyHoldsEphemeralFocus)throw Error(`Attempted to take ephemeral focus when it's already held, with new element: ${e}.`);this.currentlyHoldsEphemeralFocus=!0,this.focusedNode&&this.passivelyFocusNode(this.focusedNode,null),e.focus({preventScroll:!0});let t=!1;return()=>{if(t)throw Error(`Attempted to finish ephemeral focus twice for element: ${e}.`);if(t=!0,this.currentlyHoldsEphemeralFocus=!1,this.focusedNode){this.activelyFocusNode(this.focusedNode,null);let e=this.focusedNode;setTimeout(()=>{!this.focusedNode&&this.previouslyFocusedNode===e&&this.recentlyLostAllFocus&&this.focusNode(e)},0)}}}ephemeralFocusTaken(){return this.currentlyHoldsEphemeralFocus}ensureManagerIsUnlocked(){if(this.lockFocusStateChanges)throw Error("FocusManager state changes cannot happen in a tree/node focus/blur callback.")}updateFocusedNode(e){this.previouslyFocusedNode=this.focusedNode,this.focusedNode=e}defocusCurrentFocusedNode(){this.focusedNode&&!this.currentlyHoldsEphemeralFocus&&(this.passivelyFocusNode(this.focusedNode,null),this.updateFocusedNode(null))}activelyFocusNode(e,t){this.lockFocusStateChanges=!0;let i=e.getFocusableTree(),n=e.getFocusableElement(),o=this.lookUpRegistration(i)?.rootShouldBeAutoTabbable;i!==t&&(i.onTreeFocus(e,t),o&&(i.getRootFocusableNode().getFocusableElement().tabIndex=-1)),e.onNodeFocus(),this.lockFocusStateChanges=!1,o&&e===i.getRootFocusableNode()||n.hasAttribute("tabindex")||(n.tabIndex=-1),this.setNodeToVisualActiveFocus(e),n.focus({preventScroll:!0})}passivelyFocusNode(e,t){this.lockFocusStateChanges=!0;let i=e.getFocusableTree();if(i!==t){let e;i.onTreeBlur(t),null!=(e=this.lookUpRegistration(i))&&e.rootShouldBeAutoTabbable&&(i.getRootFocusableNode().getFocusableElement().tabIndex=0)}e.onNodeBlur(),this.lockFocusStateChanges=!1,i!==t&&this.setNodeToVisualPassiveFocus(e)}setNodeToVisualActiveFocus(e){e=e.getFocusableElement(),f(e,Al.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),m(e,Al.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}setNodeToVisualPassiveFocus(e){e=e.getFocusableElement(),m(e,Al.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),f(e,Al.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}removeHighlight(e){e=e.getFocusableElement(),m(e,Al.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),m(e,Al.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME)}static getFocusManager(){return Al.focusManager||=new Al(document.addEventListener),Al.focusManager}};Al.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyActiveFocus",Al.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME="blocklyPassiveFocus",Al.focusManager=null;var Ll={};Ll.FocusManager=Al,Ll.getFocusManager=Xs.getFocusManager$$module$build$src$core$focus_manager;var Nl={};Nl.deepMerge=A;var wl=class{constructor(){this.shortcuts=new Map,this.keyMap=new Map,this.reset()}reset(){this.shortcuts.clear(),this.keyMap.clear()}register(e,t){if(this.shortcuts.get(e.name)&&!t)throw Error(`Shortcut named "${e.name}" already exists.`);if(this.shortcuts.set(e.name,e),null!=(t=e.keyCodes)&&t.length)for(let i of t)this.addKeyMapping(i,e.name,!!e.allowCollision)}unregister(e){return this.shortcuts.get(e)?(this.removeAllKeyMappings(e),this.shortcuts.delete(e),!0):(console.warn(`Keyboard shortcut named "${e}" not found.`),!1)}addKeyMapping(e,t,i){e=`${e}`;let n=this.keyMap.get(e);if(n&&!i)throw Error(`Shortcut named "${t}" collides with shortcuts "${n}"`);n&&i?n.unshift(t):this.keyMap.set(e,[t])}removeKeyMapping(e,t,i){let n=this.keyMap.get(e);if(!n)return i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1;let o=n.indexOf(t);return o>-1?(n.splice(o,1),0===n.length&&this.keyMap.delete(e),!0):(i||console.warn(`No keyboard shortcut named "${t}" registered with key code "${e}"`),!1)}removeAllKeyMappings(e){for(let t of this.keyMap.keys())this.removeKeyMapping(t,e,!0)}setKeyMap(e){this.keyMap.clear();for(let t in e)this.keyMap.set(t,e[t])}getKeyMap(){let e=Object.create(null);for(let[t,i]of this.keyMap)e[t]=i;return e}getRegistry(){let e=Object.create(null);for(let[t,i]of this.shortcuts)e[t]=i;return A(Object.create(null),e)}onKeyDown(e,t){var i=this.serializeKeyEvent(t);if(!(i=this.getShortcutNamesByKeyCode(i)))return!1;for(let n of i){if(!(i=this.shortcuts.get(n))||i.preconditionFn&&!i.preconditionFn(e,{focusedNode:Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()??void 0}))continue;let o,r;if(null!=(r=(o=i).callback)&&r.call(o,e,t,i,{focusedNode:Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()??void 0}))return!0}return!1}getShortcutNamesByKeyCode(e){return this.keyMap.get(e)?.slice()||[]}getKeyCodesByShortcutName(e){let t=[];for(let[i,n]of this.keyMap)n.indexOf(e)>-1&&t.push(i);return t}serializeKeyEvent(e){let t="";for(let i in wl.modifierKeys)e.getModifierState(i)&&(""!==t&&(t+="+"),t+=i);return""!==t&&e.keyCode?t+="+"+e.keyCode:e.keyCode&&(t=String(e.keyCode)),t}checkModifiers(e){for(let t of e)if(!(t in wl.modifierKeys))throw Error(t+" is not a valid modifier key.")}
3createSerializedKey(e,t){let i="";if(t){this.checkModifiers(t);for(let e in wl.modifierKeys)t.includes(wl.modifierKeys[e])&&(""!==i&&(i+="+"),i+=e)}return""!==i&&e?i+="+"+e:e&&(i=`${e}`),i}};wl.registry=new wl,function(e){(e=e.modifierKeys||={})[e.Shift=16]="Shift",e[e.Control=17]="Control",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta"}(wl||={});var $l,Ml,xl=Object.create(null),Dl=[],Pl={defineBlocksWithJsonArrayInternal:X},Fl={TEST_ONLY:Pl};Fl.createBlockDefinitionsFromJsonArray=Xs.createBlockDefinitionsFromJsonArray$$module$build$src$core$common,Fl.defineBlocks=Xs.defineBlocks$$module$build$src$core$common,Fl.defineBlocksWithJsonArray=W,Fl.draggingConnections=Dl,Fl.fireSelectedEvent=F,Fl.getAllWorkspaces=N,Fl.getBlockTypeCounts=V,Fl.getMainWorkspace=M,Fl.getParentContainer=B,Fl.getSelected=D,Fl.getWorkspaceById=L,Fl.globalShortcutHandler=z,Fl.registerWorkspace=w,Fl.setMainWorkspace=x,Fl.setParentContainer=U,Fl.setSelected=P,Fl.svgResize=H,Fl.unregisterWorkpace=$;var Bl,Ul=class{constructor(){this.workspaceId=void 0,this.isUiEvent=!1,this.type="",this.group=Xs.getGroup$$module$build$src$core$events$utils(),this.recordUndo=e()}toJson(){return{type:this.type,group:this.group}}static fromJson(e,t,i){return i.isBlank=!1,i.group=e.group||"",i.workspaceId=t.id,i}isNull(){return!1}run(e){}getEventWorkspace_(){let e;if(this.workspaceId&&(e=L(this.workspaceId)),!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e}},Hl=class extends Ul{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.isUiEvent=!0,this.isBlank=void 0===e,this.workspaceId=e||""}},Vl=class extends Hl{constructor(e,t,i){null===(t=e?e.workspace.id:t)&&(t=void 0),super(t),this.type=ja.CLICK,this.blockId=e?e.id:void 0,this.targetType=i}toJson(){let e=super.toJson();if(!this.targetType)throw Error("The click target type is undefined. Either pass a block to the constructor, or call fromJson");return e.targetType=this.targetType,e.blockId=this.blockId,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new Vl)).targetType=e.targetType,t.blockId=e.blockId,t}};(function(e){e.BLOCK="block",e.WORKSPACE="workspace",e.ZOOM_CONTROLS="zoom_controls"})(Bl||={}),zs(ka.EVENT,ja.CLICK,Vl);var Gl={};Gl.Click=Vl,Gl.ClickTarget=Bl;var Wl={};Wl.removeElem=j;var Xl=class{constructor(e){this.name=e}toString(){return this.name}};Xl.POSITIONABLE=new Xl("positionable"),Xl.DRAG_TARGET=new Xl("drag_target"),Xl.DELETE_AREA=new Xl("delete_area"),Xl.AUTOHIDEABLE=new Xl("autohideable");var zl=class{constructor(){this.componentData=new Map,this.capabilityToComponentIds=new Map}addComponent(e,t){let i=e.component.id;var n;if(!t&&this.componentData.has(i))throw Error('Plugin "'+i+'" with capabilities "'+(n=this.componentData.get(i))?.capabilities+'" already added.');for(this.componentData.set(i,e),t=[],n=0;n<e.capabilities.length;n++){let o=String(e.capabilities[n]).toLowerCase();if(t.push(o),this.capabilityToComponentIds.has(o)){let e;null==(e=this.capabilityToComponentIds.get(o))||e.push(i)}else this.capabilityToComponentIds.set(o,[i])}this.componentData.get(i).capabilities=t}removeComponent(e){let t=this.componentData.get(e);if(t){for(let i=0;i<t.capabilities.length;i++){let n=String(t.capabilities[i]).toLowerCase();j(this.capabilityToComponentIds.get(n),e)}this.componentData.delete(e)}}addCapability(e,t){if(!this.getComponent(e))throw Error('Cannot add capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');var i,n;this.hasCapability(e,t)?console.warn('Plugin "'+e+'already has capability "'+t+'"'):(t=`${t}`.toLowerCase(),null==(i=this.componentData.get(e))||i.capabilities.push(t),null==(n=this.capabilityToComponentIds.get(t))||n.push(e))}removeCapability(e,t){if(!this.getComponent(e))throw Error('Cannot remove capability, "'+t+'". Plugin "'+e+'" has not been added to the ComponentManager');this.hasCapability(e,t)?(t=`${t}`.toLowerCase(),j(this.componentData.get(e).capabilities,t),j(this.capabilityToComponentIds.get(t),e)):console.warn('Plugin "'+e+"doesn't have capability \""+t+'" to remove')}hasCapability(e,t){return t=`${t}`.toLowerCase(),this.componentData.has(e)&&this.componentData.get(e).
3capabilities.includes(t)}getComponent(e){return this.componentData.get(e)?.component}getComponents(e,t){if(e=`${e}`.toLowerCase(),!(e=this.capabilityToComponentIds.get(e)))return[];let i=[];if(t){let t=[];e.forEach(e=>{t.push(this.componentData.get(e))}),t.sort(function(e,t){return e.weight-t.weight}),t.forEach(function(e){i.push(e.component)})}else e.forEach(e=>{i.push(this.componentData.get(e).component)});return i}};zl.Capability=Xl,function(e){(e=e.ComponentWeight||={})[e.TOOLBOX_WEIGHT=0]="TOOLBOX_WEIGHT",e[e.FLYOUT_WEIGHT=1]="FLYOUT_WEIGHT",e[e.TRASHCAN_WEIGHT=2]="TRASHCAN_WEIGHT",e[e.ZOOM_CONTROLS_WEIGHT=3]="ZOOM_CONTROLS_WEIGHT"}(zl||={});var jl=zl.ComponentWeight,Yl={};Yl.ComponentManager=zl,Yl.ComponentWeight=jl;var Ql=!1,Kl='\n.blocklySvg {\n background-color: #fff;\n outline: none;\n overflow: hidden; /* IE overflows by default. */\n position: absolute;\n display: block;\n}\n\n.blocklyWidgetDiv {\n display: none;\n position: absolute;\n z-index: 99999; /* big value for bootstrap3 compatibility */\n}\n\n.injectionDiv {\n height: 100%;\n position: relative;\n overflow: hidden; /* So blocks in drag surface disappear at edges */\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n.blocklyBlockCanvas.blocklyCanvasTransitioning,\n.blocklyBubbleCanvas.blocklyCanvasTransitioning {\n transition: transform .5s;\n}\n\n.blocklyEmboss {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyTooltipDiv {\n background-color: #ffffc7;\n border: 1px solid #ddc;\n box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);\n color: #000;\n display: none;\n font: 9pt sans-serif;\n opacity: .9;\n padding: 2px;\n position: absolute;\n z-index: 100000; /* big value for bootstrap3 compatibility */\n}\n\n.blocklyDropDownDiv {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1000;\n display: none;\n border: 1px solid;\n border-color: #dadce0;\n background-color: #fff;\n border-radius: 2px;\n padding: 4px;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownContent {\n max-height: 300px; /* @todo: spec for maximum height. */\n}\n\n.blocklyDropDownArrow {\n position: absolute;\n left: 0;\n top: 0;\n width: 16px;\n height: 16px;\n z-index: -1;\n background-color: inherit;\n border-color: inherit;\n border-top: 1px solid;\n border-left: 1px solid;\n border-top-left-radius: 4px;\n border-color: inherit;\n}\n\n.blocklyHighlighted>.blocklyPath {\n filter: var(--blocklyEmbossFilter);\n}\n\n.blocklyHighlightedConnectionPath {\n fill: none;\n stroke: #fc3;\n stroke-width: 4px;\n}\n\n.blocklyPathLight {\n fill: none;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.blocklySelected>.blocklyPathLight {\n display: none;\n}\n\n.blocklyDraggable {\n cursor: grab;\n cursor: -webkit-grab;\n}\n\n.blocklyDragging {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n /* Drag surface disables events to not block the toolbox, so we have to\n * reenable them here for the cursor values to work. */\n pointer-events: auto;\n}\n\n /* Changes cursor on mouse down. Not effective in Firefox because of\n https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */\n.blocklyDraggable:active {\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n.blocklyDragging.blocklyDraggingDelete,\n.blocklyDragging.blocklyDraggingDelete .blocklyField {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyDragging>.blocklyPath,\n.blocklyDragging>.blocklyPathLight {\n fill-opacity: .8;\n stroke-opacity: .8;\n}\n\n.blocklyDragging>.blocklyPathDark {\n display: none;\n}\n\n.blocklyDisabledPattern>.blocklyPath {\n fill: var(--blocklyDisabledPattern);\n fill-opacity: .5;\n stroke-opacity: .5;\n}\n\n.blocklyDisabled>.blocklyPathLight,\n.blocklyDisabled>.blocklyPathDark {\n display: none;\n}\n\n.blocklyInsertionMarker>.blocklyPath,\n.blocklyInsertionMarker>.blocklyPathLight,\n.blocklyInsertionMarker>.blocklyPathDark {\n fill-opacity: .2;\n stroke: none;\n}\n\n.blocklyNonEditableField>text {\n pointer-events: none;\n}\n\n.blocklyFlyout {\n position: absolute;\n z-index: 20;\n}\n\n.blocklyText text {\n cursor: default;\n}\n\n/*\n Don\'t allow users to select text. It gets annoying when trying to\n drag a block and selected text moves instead.\n*/\n.blocklySvg text {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n cursor: inherit;\n}\n\n.blocklyIconGroup {\n cursor: default;\n}\n\n.blocklyIconGroup:not(:hover):not(:focus),\n.blocklyIconGroupReadonly {\n opacity: .6;\n}\n\n.blocklyIconShape {\n fill: #00f;\n stroke: #fff;\n stroke-width: 1px;\n}\n\n.blocklyIconSymbol {\n fill: #fff;\n}\n\n.blocklyMinimalBody {\n margin: 0;\n padding: 0;\n height: 100%;\n}\n\n.blocklyHtmlInput {\n border: none;\n border-radius: 4px;\n height: 100%;\n margin: 0;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: center;\n display: block;\n box-sizing: border-box;\n}\n\n/* Remove the increase and decrease arrows on the field number editor */\ninput.blocklyHtmlInput[type=number]::-webkit-inner-spin-button,\ninput.blocklyHtmlInput[type=number]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput[type=number] {\n -moz-appearance: textfield;\n}
3\n\n.blocklyMainBackground {\n stroke-width: 1;\n stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */\n}\n\n.blocklyMutatorBackground {\n fill: #fff;\n stroke: #ddd;\n stroke-width: 1;\n}\n\n.blocklyFlyoutBackground {\n fill: #ddd;\n fill-opacity: .8;\n}\n\n.blocklyMainWorkspaceScrollbar {\n z-index: 20;\n}\n\n.blocklyFlyoutScrollbar {\n z-index: 30;\n}\n\n.blocklyScrollbarHorizontal,\n.blocklyScrollbarVertical {\n position: absolute;\n outline: none;\n}\n\n.blocklyScrollbarBackground {\n opacity: 0;\n pointer-events: none;\n}\n\n.blocklyScrollbarHandle {\n fill: #ccc;\n}\n\n.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyScrollbarHandle:hover {\n fill: #bbb;\n}\n\n/* Darken flyout scrollbars due to being on a grey background. */\n/* By contrast, workspace scrollbars are on a white background. */\n.blocklyFlyout .blocklyScrollbarHandle {\n fill: #bbb;\n}\n\n.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,\n.blocklyFlyout .blocklyScrollbarHandle:hover {\n fill: #aaa;\n}\n\n.blocklyInvalidInput {\n background: #faa;\n}\n\n.blocklyVerticalMarker {\n stroke-width: 3px;\n fill: rgba(255,255,255,.5);\n pointer-events: none;\n}\n\n.blocklyComputeCanvas {\n position: absolute;\n width: 0;\n height: 0;\n}\n\n.blocklyNoPointerEvents {\n pointer-events: none;\n}\n\n.blocklyContextMenu {\n border-radius: 4px;\n max-height: 100%;\n}\n\n.blocklyDropdownMenu {\n border-radius: 2px;\n padding: 0 !important;\n}\n\n.blocklyDropdownMenu .blocklyMenuItem {\n /* 28px on the left for icon or checkbox. */\n padding-left: 28px;\n}\n\n/* BiDi override for the resting state. */\n.blocklyDropdownMenu .blocklyMenuItemRtl {\n /* Flip left/right padding for BiDi. */\n padding-left: 5px;\n padding-right: 28px;\n}\n\n.blocklyWidgetDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: #fff;\n border: 1px solid transparent;\n box-shadow: 0 0 3px 1px rgba(0,0,0,.3);\n font: normal 13px Arial, sans-serif;\n margin: 0;\n outline: none;\n padding: 4px 0;\n position: absolute;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n.blocklyWidgetDiv .blocklyMenu:focus {\n box-shadow: 0 0 6px 1px rgba(0,0,0,.3);\n}\n\n.blocklyDropDownDiv .blocklyMenu {\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background: inherit; /* Compatibility with gapi, reset from goog-menu */\n border: inherit; /* Compatibility with gapi, reset from goog-menu */\n font: normal 13px "Helvetica Neue", Helvetica, sans-serif;\n outline: none;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 100%;\n z-index: 20000; /* Arbitrary, but some apps depend on it... */\n}\n\n/* State: resting. */\n.blocklyMenuItem {\n border: none;\n color: #000;\n cursor: pointer;\n list-style: none;\n margin: 0;\n /* 7em on the right for shortcut. */\n min-width: 7em;\n padding: 6px 15px;\n white-space: nowrap;\n}\n\n/* State: disabled. */\n.blocklyMenuItemDisabled {\n color: #ccc;\n cursor: inherit;\n}\n\n/* State: hover. */\n.blocklyMenuItemHighlight {\n background-color: rgba(0,0,0,.1);\n}\n\n/* State: selected/checked. */\n.blocklyMenuItemSelected .blocklyMenuItemCheckbox {\n background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;\n float: left;\n margin-left: -24px;\n width: 16px;\n height: 16px;\n position: static; /* Scroll with the menu. */\n display: block;\n}\n\n.blocklyMenuItemRtl .blocklyMenuItemCheckbox {\n float: right;\n margin-right: -24px;\n}\n\n.blocklyMenuSeparator {\n background-color: #ccc;\n height: 1px;\n border: 0;\n margin-left: 4px;\n margin-right: 4px;\n}\n\n.blocklyBlockDragSurface, .blocklyAnimationLayer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: visible !important;\n z-index: 80;\n pointer-events: none;\n}\n\n.blocklyField {\n cursor: default;\n}\n\n.blocklyInputField {\n cursor: text;\n}\n\n.blocklyDragging .blocklyField,\n.blocklyDragging .blocklyIconGroup {\n cursor: grabbing;\n}\n\n.blocklyActiveFocus:is(\n .blocklyFlyout,\n .blocklyWorkspace,\n .blocklyField,\n .blocklyPath,\n .blocklyHighlightedConnectionPath,\n .blocklyComment,\n .blocklyBubble,\n .blocklyIconGroup,\n .blocklyTextarea\n) {\n outline: none;\n}\n',ql={};ql.inject=Q,ql.register=Y;var Jl=class{constructor(e,t){this.x=e,this.y=t}clone(){return new Jl(this.x,this.y)}scale(e){return this.x*=e,this.y*=e,this}translate(e,t){return this.x+=e,this.y+=t,this}static equals(e,t){return e===t||!(!e||!t)&&(e.x===t.x&&e.y===t.y)}static distance(e,t){let i=e.x-t.x;return e=e.y-t.y,Math.sqrt(i*i+e*e)}static magnitude(e){return Math.sqrt(e.x*e.x+e.y*e.y)}static difference(e,t){return new Jl(e.x-t.x,e.y-t.y)}static sum(e,t){return new Jl(e.x+t.x,e.y+t.y)}},Zl=class{constructor(e){this.tagName=e}toString(){return this.tagName}};Zl.ANIMATE=new Zl("animate"),Zl.CIRCLE=new Zl("circle"),Zl.CLIPPATH=new Zl("clipPath"),Zl.DEFS=new Zl("defs"),Zl.FECOMPOSITE=new Zl("feComposite"),Zl.FECOMPONENTTRANSFER=new Zl("feComponentTransfer"),Zl.FEFLOOD=new Zl("feFlood"),Zl.FEFUNCA=new Zl("feFuncA"),Zl.FEGAUSSIANBLUR=new Zl("feGaussianBlur"),Zl.FEPOINTLIGHT=new Zl("fePointLight"),Zl.FESPECULARLIGHTING=new Zl("feSpecularLighting"),Zl.FILTER=new Zl("filter"),Zl.FOREIGNOBJECT=new Zl("foreignObject"),Zl.G=new Zl("g"),Zl.IMAGE=new Zl("image"),Zl.LINE=new Zl("line"),Zl.PATH=new Zl("path"),Zl.PATTERN=new Zl("pattern"),Zl.POLYGON=new Zl("polygon"),Zl.RECT=new Zl("rect"),Zl.SVG=new Zl("svg"),Zl.TEXT=new Zl("text"),Zl.TSPAN=new Zl("tspan");var ec=class{constructor(e,t,i,n){this.top=e,this.bottom=t,this.left=i,this.right=n}static from(e){return new ec(e.y,e.y+e.height,e.x,e.x+e.width)}clone(){return new ec(this.top,this.bottom,this.left,this.right)}getHeight(){return this.bottom-this.top}getWidth(){return this.right-this.left}getOrigin(){return new Jl(this.left,this.top)}contains(e,t){return e>=this.left&&e<=this.right&&t>=this.top&&t<=this.bottom}intersects(e){return this.left<=e.right&&this.right>=e.left&&this.bottom>=e.top&&this.top<=e.bottom}static equals(e,t){return e===t||!(!e||!t)&&(e.top===t.top&&e.bottom===t.bottom&&e.left===t.left&&e.right===t.right)}static createFromPoint(e,t,i){let n=e.x;return e=e.y,new ec(e,e+i,n,n+t)}},tc=class{constructor(e,t){this.width=e,this.height=t}static equals(e,t){return e===t||!(!e||!t)&&(e.width===t.width&&e.height===t.height)}static max(e,t){return new tc(Math.max(e.width,t.width),Math.max(e.height,t.height))}static min(e,t){return new tc(Math.min(e.width,t.width),Math.min(e.height,t.height))}},ic={getSizeInternal:q},nc={TEST_ONLY:ic};nc.getBorderBox=ie,nc.getComputedStyle=Z,nc.getContainerOffsetToScrollInto=oe,nc.getPageOffset=ee,nc.get
3Size=K,nc.getViewportPageOffset=te,nc.scrollIntoContainerView=ne;var oc=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,rc=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,sc={TEST_ONLY:{XY_REGEX:oc,XY_STYLE_REGEX:rc}};sc.getDocumentScroll=le,sc.getInjectionDivXY=se,sc.getRelativeXY=re,sc.getViewportBBox=ae,sc.screenToWsCoordinates=ce,sc.wsToScreenCoordinates=ue;var ac=class{constructor(e,t,i,n,o){this.workspace=e,this.horizontal=t,this.oldHostMetrics=null,this.ratio=1,this.origin=new Jl(0,0),this.startDragHandle=this.handlePosition=this.handleLength=this.scrollbarLength=this.startDragMouse=0,this.containerVisible=this.isHandleVisible=!0,this.position=new Jl(0,0),this.onMouseMoveWrapper_=this.onMouseUpWrapper_=null,this.pair=i||!1,this.margin=void 0===o?ac.DEFAULT_SCROLLBAR_MARGIN:o,e="blocklyScrollbar"+(this.horizontal?"Horizontal":"Vertical"),n&&(e+=" "+n),this.outerSvg=p(Zl.SVG,{class:e}),n=p(Zl.G,{},this.outerSvg),this.svgBackground=p(Zl.RECT,{class:"blocklyScrollbarBackground"},n),e=Math.floor((ac.scrollbarThickness-5)/2),this.svgHandle=p(Zl.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},n),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarColour","fill"),this.workspace.getThemeManager().subscribe(this.svgHandle,"scrollbarOpacity","fill-opacity"),E(this.outerSvg,this.workspace.getParentSvg()),this.setInitialThickness(),t?(this.lengthAttribute_="width",this.positionAttribute_="x"):(this.lengthAttribute_="height",this.positionAttribute_="y"),this.onMouseDownBarWrapper_=aa(this.svgBackground,"pointerdown",this,this.onMouseDownBar),this.onMouseDownHandleWrapper_=aa(this.svgHandle,"pointerdown",this,this.onMouseDownHandle)}setInitialThickness(){let e=ac.scrollbarThickness;this.horizontal?(this.svgBackground.setAttribute("height",String(e)),this.outerSvg.setAttribute("height",String(e)),this.svgHandle.setAttribute("height",String(e-5)),this.svgHandle.setAttribute("y","2.5")):(this.svgBackground.setAttribute("width",String(e)),this.outerSvg.setAttribute("width",String(e)),this.svgHandle.setAttribute("width",String(e-5)),this.svgHandle.setAttribute("x","2.5"))}dispose(){this.cleanUp(),ca(this.onMouseDownBarWrapper_),ca(this.onMouseDownHandleWrapper_),_(this.outerSvg),this.workspace.getThemeManager().unsubscribe(this.svgHandle)}constrainHandleLength(e){return e<=0||isNaN(e)?0:Math.min(e,this.scrollbarLength)}setHandleLength(e){this.handleLength=e,this.svgHandle.setAttribute(this.lengthAttribute_,String(this.handleLength))}constrainHandlePosition(e){return e<=0||isNaN(e)?0:Math.min(e,this.scrollbarLength-this.handleLength)}setHandlePosition(e){this.handlePosition=e,this.svgHandle.setAttribute(this.positionAttribute_,String(this.handlePosition))}setScrollbarLength(e){this.scrollbarLength=e,this.outerSvg.setAttribute(this.lengthAttribute_,String(this.scrollbarLength)),this.svgBackground.setAttribute(this.lengthAttribute_,String(this.scrollbarLength))}setPosition(e,t){this.position.x=e,this.position.y=t,b(this.outerSvg,"translate("+(this.position.x+this.origin.x)+"px,"+(this.position.y+this.origin.y)+"px)")}resize(e){!e&&!(e=this.workspace.getMetrics())||this.oldHostMetrics&&ac.metricsAreEquivalent(e,this.oldHostMetrics)||(this.horizontal?this.resizeHorizontal(e):this.resizeVertical(e),this.oldHostMetrics=e,this.updateMetrics())}requiresViewResize(e){return!this.oldHostMetrics||(this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft||this.oldHostMetrics.absoluteTop!==e.absoluteTop)}resizeHorizontal(e){this.requiresViewResize(e)?this.resizeViewHorizontal(e):this.resizeContentHorizontal(e)}resizeViewHorizontal(e){var t=e.viewWidth-2*this.margin;this.pair&&(t-=ac.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),t=e.absoluteLeft+this.margin,this.pair&&this.workspace.RTL&&
3(t+=ac.scrollbarThickness),this.setPosition(t,e.absoluteTop+e.viewHeight-ac.scrollbarThickness-this.margin),this.resizeContentHorizontal(e)}resizeContentHorizontal(e){if(e.viewWidth>=e.scrollWidth)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewWidth/e.scrollWidth;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollWidth-e.viewWidth;var i=this.scrollbarLength-this.handleLength;e=(e.viewLeft-e.scrollLeft)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}resizeVertical(e){this.requiresViewResize(e)?this.resizeViewVertical(e):this.resizeContentVertical(e)}resizeViewVertical(e){let t=e.viewHeight-2*this.margin;this.pair&&(t-=ac.scrollbarThickness),this.setScrollbarLength(Math.max(0,t)),this.setPosition(this.workspace.RTL?e.absoluteLeft+this.margin:e.absoluteLeft+e.viewWidth-ac.scrollbarThickness-this.margin,e.absoluteTop+this.margin),this.resizeContentVertical(e)}resizeContentVertical(e){if(e.viewHeight>=e.scrollHeight)this.setHandleLength(this.scrollbarLength),this.setHandlePosition(0),this.pair||this.setVisible(!1);else{this.pair||this.setVisible(!0);var t=this.scrollbarLength*e.viewHeight/e.scrollHeight;t=this.constrainHandleLength(t),this.setHandleLength(t),t=e.scrollHeight-e.viewHeight;var i=this.scrollbarLength-this.handleLength;e=(e.viewTop-e.scrollTop)/t*i,e=this.constrainHandlePosition(e),this.setHandlePosition(e),this.ratio=i/t}}isVisible(){return this.isHandleVisible}setContainerVisible(e){let t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay_()}setVisible(e){if(this.pair)throw Error("Unable to toggle visibility of paired scrollbars.");this.setVisibleInternal(e)}setVisibleInternal(e){let t=e!==this.isVisible();this.isHandleVisible=e,t&&this.updateDisplay_()}updateDisplay_(){this.containerVisible&&this.isVisible()?this.outerSvg.setAttribute("display","block"):this.outerSvg.setAttribute("display","none")}onMouseDownBar(e){if(this.workspace.markFocused(),na(),this.cleanUp(),ha(e))e.stopPropagation();else{var t=da(e,this.workspace.getParentSvg(),this.workspace.getInverseScreenCTM());t=this.horizontal?t.x:t.y;var i=se(this.svgHandle);i=this.horizontal?i.x:i.y;var n=this.handlePosition,o=.95*this.handleLength;t<=i?n-=o:t>=i+this.handleLength&&(n+=o),this.setHandlePosition(this.constrainHandlePosition(n)),this.updateMetrics(),e.stopPropagation(),e.preventDefault()}}onMouseDownHandle(e){this.workspace.markFocused(),this.cleanUp(),ha(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition,this.startDragMouse=this.horizontal?e.clientX:e.clientY,this.onMouseUpWrapper_=aa(document,"pointerup",this,this.onMouseUpHandle),this.onMouseMoveWrapper_=aa(document,"pointermove",this,this.onMouseMoveHandle),e.stopPropagation(),e.preventDefault())}onMouseMoveHandle(e){this.setHandlePosition(this.constrainHandlePosition(this.startDragHandle+((this.horizontal?e.clientX:e.clientY)-this.startDragMouse))),this.updateMetrics()}onMouseUpHandle(){na(),this.cleanUp()}cleanUp(){this.workspace.hideChaff(!0),this.onMouseUpWrapper_&&=(ca(this.onMouseUpWrapper_),null),this.onMouseMoveWrapper_&&=(ca(this.onMouseMoveWrapper_),null)}getRatio_(){let e=this.handlePosition/(this.scrollbarLength-this.handleLength);return isNaN(e)&&(e=0),e}updateMetrics(){let e=this.getRatio_();this.horizontal?this.workspace.setMetrics({x:e}):this.workspace.setMetrics({y:e})}set(e,t){this.setHandlePosition(this.constrainHandlePosition(e*this.ratio)),(t||void 0===t)&&this.updateMetrics()}setOrigin(e,t){this.origin=new Jl(e,t)}static metricsAreEquivalent(e,t){return e.viewWidth===t.viewWidth&&e.viewHeight===t.viewHeight&&e.viewLeft===t.viewLeft&&e.viewTop===t.viewTop&&e.absoluteTop===t.absoluteTop&&e.absoluteLeft===t.absoluteLeft&&e.scrollWidth===t.scrollWidth&&e.scrollHeight===t.scrollHeight&&e.scrollLeft===t.scrollLeft&&e.scrollTop===t.scrollTop}};ac.scrollbarThickness=Va?25:15,ac.DEFAULT_SCROLLBAR_MARGIN=.5;var lc={parseFromString:function(){throw Error("DOMParser was not found in the global scope and was not properly injected using injectDependencies")}},cc={serializeToString:function(){throw Error("XMLSerializer was not foundin the global scope and was not properly injected using injectDependencies")}},{document:uc,DOMParser:hc,XMLSerializer:dc}=globalThis;hc&&(lc=new hc),dc&&(cc=new dc);var pc="https://developers.google.com/blockly/xml",fc=/[\x00-\x09\x0B\x0C\x0E-\x1F]/g,gc={NAME_SPACE:pc};gc.createElement=Xs.createElement$$module$build$src$core$utils$xml,gc.createTextNode=Xs.createTextNode$$module$build$src$core$utils$xml,gc.domToText=de,gc.injectDependencies=he,gc.textToDom=Xs.textToDom$$module$build$src$core$utils$xml;var mc,Tc="categoryToolbox",_c="flyoutToolbox";!function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"}(mc||={});var Ec,bc,Oc,vc={hasCategoriesInternal:_e},Ic={};Ic.Position=mc,Ic.TEST_ONLY=vc,Ic.convertFlyoutDefToJsonArray=me,Ic.convertToolboxDefToJson=fe,Ic.hasCategories=Te,Ic.isCategoryCollapsible=Ee,Ic.parseToolboxTree=
3Ie,function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM"}(Ec||={}),function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT"}(bc||={}),function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(Oc||={});var Sc={};Sc.bumpDirection=Oc,Sc.bumpPositionRect=Re,Sc.getCornerOppositeToolbox=ye,Sc.getStartPositionRect=Se,Sc.horizontalPosition=bc,Sc.verticalPosition=Ec;var yc=96,Rc=124,Cc="sprites.png",kc=class{constructor(e){this.workspace=e,this.id="zoomControls",this.boundEvents=[],this.zoomResetGroup=this.zoomOutGroup=this.zoomInGroup=null,this.HEIGHT=this.WIDTH=32,this.SMALL_SPACING=2,this.LARGE_SPACING=11,this.MARGIN_HORIZONTAL=this.MARGIN_VERTICAL=20,this.svgGroup=null,this.top=this.left=0,this.initialized=!1}createDom(){this.svgGroup=p(Zl.G,{});let e=String(Math.random()).substring(2);return this.createZoomOutSvg(e),this.createZoomInSvg(e),this.workspace.isMovable()&&this.createZoomResetSvg(e),this.svgGroup}init(){this.workspace.getComponentManager().addComponent({component:this,weight:zl.ComponentWeight.ZOOM_CONTROLS_WEIGHT,capabilities:[zl.Capability.POSITIONABLE]}),this.initialized=!0}dispose(){this.workspace.getComponentManager().removeComponent("zoomControls"),this.svgGroup&&_(this.svgGroup);for(let e of this.boundEvents)ca(e);this.boundEvents.length=0}getBoundingRectangle(){let e=this.SMALL_SPACING+2*this.HEIGHT;return this.zoomResetGroup&&(e+=this.LARGE_SPACING+this.HEIGHT),new ec(this.top,this.top+e,this.left,this.left+this.WIDTH)}position(e,t){if(this.initialized){var i,n=ye(this.workspace,e),o=this.SMALL_SPACING+2*this.HEIGHT;if(this.zoomResetGroup&&(o+=this.LARGE_SPACING+this.HEIGHT),e=Se(n,new tc(this.WIDTH,o),this.MARGIN_HORIZONTAL,this.MARGIN_VERTICAL,e,this.workspace),n=n.vertical,t=Re(e,this.MARGIN_VERTICAL,n===Ec.TOP?Oc.DOWN:Oc.UP,t),n===Ec.TOP){var r,s=this.SMALL_SPACING+this.HEIGHT;null==(r=this.zoomInGroup)||r.setAttribute("transform","translate(0, "+s+")"),this.zoomResetGroup&&this.zoomResetGroup.setAttribute("transform","translate(0, "+(s+this.LARGE_SPACING+this.HEIGHT)+")")}else{let e;r=this.zoomResetGroup?this.LARGE_SPACING+this.HEIGHT:0,null==(e=this.zoomInGroup)||e.setAttribute("transform","translate(0, "+r+")"),r=r+this.SMALL_SPACING+this.HEIGHT,null==(s=this.zoomOutGroup)||s.setAttribute("transform","translate(0, "+r+")")}this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")")}}createZoomOutSvg(e){this.zoomOutGroup=p(Zl.G,{class:"blocklyZoom blocklyZoomOut"},this.svgGroup);let t=p(Zl.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup);p(Zl.RECT,{width:32,height:32},t),p(Zl.IMAGE,{width:yc,height:Rc,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup).setAttributeNS(vl,"xlink:href",this.workspace.options.pathToMedia+Cc),this.boundEvents.push(aa(this.zoomOutGroup,"pointerdown",null,this.zoom.bind(this,-1)))}createZoomInSvg(e){this.zoomInGroup=p(Zl.G,{class:"blocklyZoom blocklyZoomIn"},this.svgGroup);let t=p(Zl.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup);p(Zl.RECT,{width:32,height:32},t),p(Zl.IMAGE,{width:yc,height:Rc,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup).setAttributeNS(vl,"xlink:href",this.workspace.options.pathToMedia+Cc),this.boundEvents.push(aa(this.zoomInGroup,"pointerdown",null,this.zoom.bind(this,1)))}zoom(e,t){this.workspace.markFocused(),this.workspace.zoomCenter(e),this.fireZoomEvent(),na(),t.stopPropagation(),t.preventDefault()}createZoomResetSvg(e){this.zoomResetGroup=p(Zl.G,{class:"blocklyZoom blocklyZoomReset"},this.svgGroup);let t=p(Zl.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup);p(Zl.RECT,{width:32,height:32},t),p(Zl.IMAGE,{width:yc,height:Rc,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup).setAttributeNS(vl,"xlink:href",this.workspace.options.pathToMedia+Cc),this.boundEvents.push(aa(this.zoomResetGroup,"pointerdown",null,this.resetZoom.bind(this)))}resetZoom(e){this.workspace.markFocused();let t=Math.log(this.workspace.options.zoomOptions.startScale/this.workspace.scale)/Math.log(this.workspace.options.zoomOptions.scaleSpeed);this.workspace.beginCanvasTransition(),this.workspace.zoomCenter(t),this.workspace.scrollCenter(),setTimeout(this.workspace.endCanvasTransition.bind(this.workspace),500),this.fireZoomEvent(),na(),e.stopPropagation(),e.preventDefault()}fireZoomEvent(){let e=new(h(ja.CLICK))(null,this.workspace.id,"zoom_controls");t(e)}};Y("\n.blocklyZoom>image, .blocklyZoom>svg>image {\n opacity: .4;\n}\n\n.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {\n opacity: .6;\n}\n\n.blocklyZoom>image:active, .blocklyZoom>svg>image:active {\n opacity: .8;\n}\n");var Ac={BLOCKS:50,PROCEDURES:75,VARIABLES:100,WORKSPACE_COMMENTS:25},Lc={};Lc.register=Ce,Lc.unregister=ke;var Nc=class{constructor(){this.priority=25}save(e){let t=[];for(let i of e.getTopComments())(e=Ae(i,{addCoordinates:!0,saveIds:!0}
3))&&t.push(e);return t.length?t:null}load(t,i){for(let n of t)Le(n,i,{recordUndo:e()})}clear(e){for(let t of e.getTopComments())t.dispose()}};Ce("workspaceComments",new Nc);var wc={};wc.WorkspaceCommentSerializer=Nc,wc.append=Le,wc.save=Ae;var $c={};$c.register=Ne,$c.unregister=we;var Mc=class{paste(e,i,n){let o;e=e.commentState,n&&(e.x=n.x,e.y=n.y),Xs.disable$$module$build$src$core$events$utils();try{o=Le(e,i),$e(o)}finally{Xs.enable$$module$build$src$core$events$utils()}return o?(a()&&t(new(h(ja.COMMENT_CREATE))(o)),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(o),o):null}};Mc.TYPE="workspace-comment",Ne(Mc.TYPE,new Mc);Xs.config$$module$build$src$core$config={dragRadius:5,flyoutDragRadius:10,snapRadius:28,connectingSnapRadius:28,currentConnectionPreference:8,bumpDelay:250},Xs.config$$module$build$src$core$config;var xc,Dc,Pc="aria-",Fc="role";!function(e){e.GRID="grid",e.GRIDCELL="gridcell",e.GROUP="group",e.LISTBOX="listbox",e.MENU="menu",e.MENUITEM="menuitem",e.MENUITEMCHECKBOX="menuitemcheckbox",e.OPTION="option",e.PRESENTATION="presentation",e.ROW="row",e.TREE="tree",e.TREEITEM="treeitem",e.SEPARATOR="separator",e.STATUS="status"}(xc||={}),function(e){e.ACTIVEDESCENDANT="activedescendant",e.COLCOUNT="colcount",e.DISABLED="disabled",e.EXPANDED="expanded",e.INVALID="invalid",e.LABEL="label",e.LABELLEDBY="labelledby",e.LEVEL="level",e.ORIENTATION="orientation",e.POSINSET="posinset",e.ROWCOUNT="rowcount",e.SELECTED="selected",e.SETSIZE="setsize",e.VALUEMAX="valuemax",e.VALUEMIN="valuemin",e.LIVE="live",e.HIDDEN="hidden"}(Dc||={});var Bc={};Bc.Role=xc,Bc.State=Dc,Bc.setRole=xe,Bc.setState=De;var Uc=class{constructor(e,t){this.content=e,this.opt_value=t,this.enabled=!0,this.element=null,this.rightToLeft=!1,this.roleName=null,this.highlight=this.checked=this.checkable=!1,this.actionHandler=null}createDom(){let e=document.createElement("div");e.id=fa(),this.element=e,e.className="blocklyMenuItem "+(this.enabled?"":"blocklyMenuItemDisabled ")+(this.checked?"blocklyMenuItemSelected ":"")+(this.highlight?"blocklyMenuItemHighlight ":"")+(this.rightToLeft?"blocklyMenuItemRtl ":"");let t=document.createElement("div");t.className="blocklyMenuItemContent";let i=this.content;return"string"==typeof this.content&&(i=document.createTextNode(this.content)),t.appendChild(i),e.appendChild(t),this.checkable&&this.toggleHasCheckbox(!0),this.roleName&&xe(e,this.roleName),De(e,Dc.SELECTED,this.checkable&&this.checked||!1),De(e,Dc.DISABLED,!this.enabled),e}dispose(){this.element=null}getElement(){return this.element}getId(){return this.element.id}getValue(){return this.opt_value??null}setRightToLeft(e){let t;this.rightToLeft=e,null==(t=this.getElement())||t.classList.toggle("blocklyMenuItemRtl",this.rightToLeft)}setRole(e){this.roleName=e}setCheckable(e){(this.checkable=e)||this.setChecked(!1),this.toggleHasCheckbox(e)}setChecked(e){(!e||this.checkable)&&(this.checked=e,(e=this.getElement())&&(e.classList.toggle("blocklyMenuItemSelected",this.checked),De(e,Dc.SELECTED,this.checked)))}setHighlighted(e){if(this.highlight=e,this.isEnabled()){let e;null==(e=this.getElement())||e.classList.toggle("blocklyMenuItemHighlight",this.highlight)}}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e,(e=this.getElement())&&(e.classList.toggle("blocklyMenuItemDisabled",!this.enabled),De(e,Dc.DISABLED,!this.enabled))}performAction(e){this.isEnabled()&&this.actionHandler&&this.actionHandler(this,e)}onAction(e,t){this.actionHandler=e.bind(t)}toggleHasCheckbox(e){if(e){let n;var t,i;if(null==(n=this.getElement())||!n.querySelector(".blocklyMenuItemContent .blocklyMenuItemCheckbox"))(e=document.createElement("div")).className="blocklyMenuItemCheckbox ",null==(t=this.getElement())||null==(i=t.querySelector(".blocklyMenuItemContent"))||i.prepend(e)}else{let e,t;null==(e=this.getElement())||null==(t=e.querySelector(".blocklyMenuItemContent .blocklyMenuItemCheckbox"))||t.remove()}}},Hc=class{constructor(){this.menuItems=[],this.roleName=this.element=this.onKeyDownHandler=this.pointerLeaveHandler=this.pointerEnterHandler=this.clickHandler=this.pointerMoveHandler=this.highlightedItem=this.openingCoords=null}addChild(e){this.menuItems.push(e)}render(e){let t=document.createElement("div");t.className="blocklyMenu",t.tabIndex=0,this.roleName&&xe(t,this.roleName),this.element=t;for(let i,n=0;i=this.menuItems[n];n++)t.appendChild(i.createDom());return this.pointerMoveHandler=aa(t,"pointermove",this,this.handlePointerMove,!0),this.clickHandler=aa(t,"pointerup",this,this.handleClick,!0),this.pointerEnterHandler=aa(t,"pointerenter",this,this.handlePointerEnter,!0),this.pointerLeaveHandler=aa(t,"pointerleave",this,this.handlePointerLeave,!0),this.onKeyDown
3Handler=aa(t,"keydown",this,this.handleKeyEvent),e.appendChild(t),t}getElement(){return this.element}focus(){let e=this.getElement();e&&e.focus({preventScroll:!0})}blur(){let e=this.getElement();e&&e.blur()}setRole(e){this.roleName=e}dispose(){this.pointerMoveHandler&&=(ca(this.pointerMoveHandler),null),this.clickHandler&&=(ca(this.clickHandler),null),this.pointerEnterHandler&&=(ca(this.pointerEnterHandler),null),this.pointerLeaveHandler&&=(ca(this.pointerLeaveHandler),null),this.onKeyDownHandler&&=(ca(this.onKeyDownHandler),null);for(let e,t=0;e=this.menuItems[t];t++)e.dispose();this.element=null}getMenuItem(e){let t=this.getElement();for(;e&&e!==t;){if(e.classList.contains("blocklyMenuItem")){let t=this.getMenuItems();for(let i,n=0;i=t[n];n++)if(i.getElement()===e)return i}e=e.parentElement}return null}setHighlighted(e){var t=this.highlightedItem;if(t&&(t.setHighlighted(!1),this.highlightedItem=null),e){e.setHighlighted(!0),this.highlightedItem=e,t=this.getElement();let i=e.getElement();t&&i&&(ne(i,t),De(t,Dc.ACTIVEDESCENDANT,e.getId()))}}highlightNext(){let e=this.highlightedItem?this.getMenuItems().indexOf(this.highlightedItem):-1;this.highlightHelper(e,1)}highlightPrevious(){let e=this.highlightedItem?this.getMenuItems().indexOf(this.highlightedItem):-1;this.highlightHelper(e<0?this.menuItems.length:e,-1)}highlightFirst(){this.highlightHelper(-1,1)}highlightLast(){this.highlightHelper(this.menuItems.length,-1)}highlightHelper(e,t){e+=t;let i,n=this.getMenuItems();for(;i=n[e];){if(i.isEnabled()){this.setHighlighted(i);break}e+=t}}handlePointerMove(e){0!==Math.max(Math.abs(e.movementX),Math.abs(e.movementY))&&(e=this.getMenuItem(e.target))&&(e.isEnabled()?this.highlightedItem!==e&&this.setHighlighted(e):this.setHighlighted(null))}handleClick(e){var t=this.openingCoords;if(this.openingCoords=null,t&&"number"==typeof e.clientX){let i=new Jl(e.clientX,e.clientY);if(Jl.distance(t,i)<1)return}(t=this.getMenuItem(e.target))&&t.performAction(e)}handlePointerEnter(e){this.focus()}handlePointerLeave(e){this.getElement()&&this.setHighlighted(null)}handleKeyEvent(e){if(this.menuItems.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var t=this.highlightedItem;switch(e.key){case"Enter":case" ":t&&t.performAction(e);break;case"ArrowUp":this.highlightPrevious();break;case"ArrowDown":this.highlightNext();break;case"PageUp":case"Home":this.highlightFirst();break;case"PageDown":case"End":this.highlightLast();break;default:return}e.preventDefault(),e.stopPropagation()}}getSize(){let e=this.getElement(),t=K(e);return t.height=e.scrollHeight,t}getMenuItems(){return this.menuItems.filter(e=>e instanceof Uc)}},Vc=class{constructor(){this.element=null}createDom(){return this.element=document.createElement("hr"),this.element.className="blocklyMenuSeparator",xe(this.element,xc.SEPARATOR),this.element}dispose(){let e;null==(e=this.element)||e.remove(),this.element=null}},Gc="_TEMP_COLLAPSED_INPUT",Wc="_TEMP_COLLAPSED_FIELD",Xc="MANUALLY_DISABLED",zc={COLLAPSED_FIELD_NAME:Wc,COLLAPSED_INPUT_NAME:Gc,MANUALLY_DISABLED:Xc};!function(e){e[e.VALUE=1]="VALUE",e[e.STATEMENT=3]="STATEMENT",e[e.DUMMY=5]="DUMMY",e[e.CUSTOM=6]="CUSTOM",e[e.END_ROW=7]="END_ROW"}(Xs.inputTypes$$module$build$src$core$inputs$input_types||={});Xs.inputTypes$$module$build$src$core$inputs$input_types;var jc,Yc,Qc=new Set,Kc=new WeakSet,qc=new WeakMap,Jc=null,Zc=null,eu=0,tu={};tu.finishQueuedRenders=Be,tu.queueRender=Fe,tu.triggerQueuedRenders=Ue,Xs.Msg$$module$build$src$core$msg=Object.create(null),jc=function(e){Object.keys(e).forEach(function(t){Xs.Msg$$module$build$src$core$msg[t]=e[t]})},Yc={Msg:Xs.Msg$$module$build$src$core$msg,setLocale:jc};var iu="blocklyToast",nu="blocklyToastMessage",ou="blocklyToastCloseButton",ru=class{static show(e,t){if(t.oncePerSession&&t.id){if(this.shownIds.has(t.id))return;this.shownIds.add(t.id)}this.hide(e);let i=this.createDom(e,t);requestAnimationFrame(()=>{i.style.bottom="2rem"})}static createDom(e,t){let{message:i,duration:n=5,assertiveness:o=ru.Assertiveness.POLITE}=t,r=document.createElement("div");e.getInjectionDiv().appendChild(r),r.dataset.toastId=t.id,r.className=iu,xe(r,xc.STATUS),De(r,Dc.LIVE,o),(t=r.appendChild(document.createElement("div"))).className=nu,t.innerText=i,(t=r.appendChild(document.createElement("button"))).className=ou,De(t,Dc.LABEL,Xs.Msg$$module$build$src$core$msg.CLOSE);var s=p(Zl.SVG,{width:24,height:24,viewBox:"0 0 24 24",fill:"none"},t);let a;return De(s,Dc.HIDDEN,!0),p(Zl.RECT,{x:19.7782,y:2.80762,width:2,height:24,transform:"rotate(45, 19.7782, 2.80762)",fill:"black"},s),p(Zl.RECT,{x:2.80762,y:4.22183,width:2,height:24,transform:"rotate(-45, 2.80762, 4.22183)",fill:"black"},s),t.addEventListener("click",()=>{r.remove(),e.markFocused()}),t=()=>{a=setTimeout(()=>r.remove(),1e3*n)},s=()=>clearTimeout(a),r.addEventListener("focusin",s),r.addEventListener("focusout",t),r.addEventListener("mouseenter",s),r.addEventListener("mousemove",s),r.addEventListener("mouseleave",t),t(),r}static hide(e,t){(e=e.getInjectionDiv().querySelector(`.${iu}`))instanceof HTMLElement&&(!t||t===e.dataset.toastId)&&e.remove()}};ru.shownIds=new Set,function(e){(e=e.Assertiveness||={}).ASSERTIVE="assertive",e.POLITE="polite"}(ru||={}),Y(`\n.${iu} {\n font-size: 1.2rem;\n position: absolute;\n bottom: -10rem;\n right: 2rem;\n padding: 1rem;\n color: black;\n background-color: white;\n border: 2px solid black;\n border-radius: 0.4rem;\n z-index: 999;\n display: flex;\n align-items: center;\n gap: 0.8rem;\n line-height: 1.5;\n transition: bottom 0.3s ease-out;\n}\n\n.${iu} .${nu} {\n maxWidth: 18rem;\n}\n\n.${iu} .${ou} {\n margin: 0;\n padding: 0.2rem;\n background-color: transparent;\n color: black;\n border: none;\n cursor: pointer;\n}\n`);var su=function(e,t){window.alert(e),t&&t()},au=su,lu=function(e,t){t(window.confirm(e))},cu=lu,uu=function(e,t,i){i(window.prompt(e,t))},hu=uu,du=ru.show.bind(ru),pu={};pu.alert=je,pu.confirm=Qe,pu.prompt=qe,pu.setAlert=Ye,pu.setConfirm=Ke,pu.setPrompt=Je,pu.setToast=et,pu.toast=Ze;var fu={};fu.isLegacyProcedureCallBlock=it,fu.isLegacyProcedureDefBlock=tt;var gu=new Set,mu={};mu.warn=ot;var Tu="VARIABLE",_u="ijkmnopqrstuvwxyzabcdefgh",Eu={generateUniqueNameInternal:dt},bu={CATEGORY_NAME:Tu,TEST_ONLY:Eu,VAR_LETTER_OPTIONS:_u};bu.allDeveloperVariables=Xs.allDeveloperVariables$$module$build$src$core$variables,bu.allUsedVarModels=Xs.allUsedVarModels$$module$build$src$core$variables,bu.compareByName=St,bu.createVariableButtonHandler=ft,bu.deleteVariable=Xs.deleteVariable$$module$build$src$core$variables,bu.flyoutCategory=st,bu.flyoutCategoryBlocks=ut,bu.generateUniqueName=ht,bu.generateUniqueNameFromOptions=pt,bu.generateVariableFieldDom=Ot,bu.getAddedVariables=It,bu.getOrCreateVariablePackage=Xs.getOrCreateVariablePackage$$module$build$src$core$variables,bu.getVariable=Xs.getVariable$$module$build$src$core$variables,bu.getVariableUsesById=yt,bu.internalFlyoutCategory=rt,bu.jsonFlyoutCategoryBlocks=lt,bu.nameUsedWithAnyType=Tt,bu.nameUsedWithConflictingParam=_t,bu.promptName=gt,bu.renameVariable=Xs.renameVariable$$module$build$src$core$variables;
3var Ou=class extends Error{},vu=class extends Ou{constructor(e){super("Expected to find a 'type' property, defining the block type"),this.state=e}},Iu=class extends Ou{constructor(e,t,i){super(`The block ${t.toDevString()} is missing a(n) ${e}\nconnection`),this.block=t,this.state=i}},Su=class extends Ou{constructor(e,t,i,n){super(`The block ${i.toDevString()} could not connect its\n${t} to its parent, because: ${e}`),this.childBlock=i,this.childState=n}},yu=class extends Ou{constructor(e){super("Encountered a real block which is defined as a child of a shadow\nblock. It is an invariant of Blockly that shadow blocks only have shadow\nchildren"),this.state=e}},Ru=class extends Ou{constructor(e,t,i){super(`Cannot add an icon of type '${e}' to the block ${t.toDevString()}, because there is no icon registered with type '${e}'. Make sure that all of your icons have been registered.`),this.block=t,this.state=i}},Cu={};Cu.BadConnectionCheck=Su,Cu.DeserializationError=Ou,Cu.MissingBlockType=vu,Cu.MissingConnection=Iu,Cu.RealChildOfShadow=yu,Cu.UnregisteredIcon=Ru;var ku=class{constructor(){this.priority=50}save(e){let t=[];for(let i of e.getTopBlocks(!1))(e=Rt(i,{addCoordinates:!0,doFullSerialization:!1}))&&t.push(e);return t.length?{languageVersion:0,blocks:t}:null}load(t,i){t=t.blocks;for(let n of t)xt(n,i,{recordUndo:e()})}clear(e){for(let t of e.getTopBlocks(!1))t.dispose(!1)}};Ce("blocks",new ku);var Au={};Au.BlockSerializer=ku,Au.append=xt,Au.appendInternal=Dt,Au.save=Rt;var Lu=class{constructor(e){this.name=e}toString(){return this.name}equals(e){return this.name===e.toString()}};Lu.MUTATOR=new Lu("mutator"),Lu.WARNING=new Lu("warning"),Lu.COMMENT=new Lu("comment");var Nu=class extends Ul{constructor(e){super(),this.isBlank=!0,this.isBlank=!e,e&&(this.blockId=e.id,this.workspaceId=e.workspace.id)}toJson(){let e=super.toJson();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.blockId=this.blockId,e}static fromJson(e,t,i){return(t=Ul.fromJson(e,t,i??new Nu)).blockId=e.blockId,t}},wu=class extends Nu{constructor(e,t,i,n,o){super(e),this.type=ja.BLOCK_CHANGE,e&&(this.element=t,this.name=i||void 0,this.oldValue=n,this.newValue=o)}toJson(){let e=super.toJson();if(!this.element)throw Error("The changed element is undefined. Either pass an element to the constructor, or call fromJson");return e.element=this.element,e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,this.disabledReason&&(e.disabledReason=this.disabledReason),e}static fromJson(e,t,i){return(t=Nu.fromJson(e,t,i??new wu)).element=e.element,t.name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,void 0!==e.disabledReason&&(t.disabledReason=e.disabledReason),t}setDisabledReason(e){if("disabled"!==this.element)throw Error('Cannot set the disabled reason for a BlockChange event if the element is not "disabled".');this.disabledReason=e}isNull(){return this.oldValue===this.newValue}run(e){var i=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(!(i=i.getBlockById(this.blockId)))throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");let n=i.getIcon(Lu.MUTATOR);switch(n&&Qt(n)&&n.bubbleIsVisible()&&n.setBubbleVisible(!1),e=e?this.newValue:this.oldValue,this.element){case"field":(i=i.getField(this.name))?i.setValue(e):console.warn("Can't set non-existent field: "+this.name);break;case"comment":i.setCommentText(e??null);break;case"collapsed":i.setCollapsed(!!e);break;case"disabled":var o;i.setDisabledReason(!!e,(o=this.disabledReason)??Xc);break;case"inline":i.setInputsInline(!!e);break;case"mutation":o=wu.getExtraBlockState_(i),i.loadExtraState?i.loadExtraState(JSON.parse(e||"{}")):i.domToMutation&&i.domToMutation(Xs.textToDom$$module$build$src$core$utils$xml(e||"<mutation/>")),t(new wu(i,"mutation",null,o,e));break;default:console.warn("Unknown change type: "+this.element)}}static getExtraBlockState_(e){return e.saveExtraState?(e=e.saveExtraState(!0))?JSON.stringify(e):"":e.mutationToDom&&(e=e.mutationToDom())?Xn(e):""}};zs(ka.EVENT,ja.BLOCK_CHANGE,wu);var $u={};$u.clamp=Jt,$u.toDegrees=qt,$u.toRadians=Kt;var Mu,xu,Du,Pu=16,Fu=1,Bu=12,Uu=16,Hu=.25,Vu=null,Gu=null,Wu="",Xu="",zu=null,ju=null,Yu=null,Qu=null,Ku=null,qu={getBoundsInfo:function(){let e=ee(zu),t=K(zu);return{left:e.x,right:e.x+t.width,top:e.y,bottom:e.y+t.height,width:t.width,height:t.height}},getPositionMetrics:function(e,t,i,n){let o=qu.getBoundsInfo(),r=K(Mu);return t+r.height<o.bottom?hi(e,t,o,r):n-r.height>o.top?di(i,n,o,r):t+r.height<document.documentElement.clientHeight?hi(e,t,o,r):n-r.height>document.documentElement.clientTop?di(i,n,o,r):pi(e,o,r)}},Ju={ANIMATION_TIME:Hu,ARROW_HORIZONTAL_PADDING:Bu,ARROW_SIZE:Pu,BORDER_SIZE:Fu,PADDING_Y:Uu,TEST_ONLY:qu};Ju.clearContent=ni,Ju.createDom=Zt,Ju.getContentDiv=ii,Ju.getOwner=ti,Ju.getPositionX=fi,Ju.hide=Ti,Ju.hideIfOwner=mi,Ju.hideWithoutAnimation=_i,Ju.isVisible=gi,Ju.repositionForWindowResize=bi,Ju.setBoundsElement=ei,Ju.setColour=oi,Ju.show=ui,Ju.showPositionedByBlock=ri,Ju.showPositionedByField=si;var Zu={};Zu.commonWordPrefix=vi,Zu.commonWordSuffix=Ii,Zu.isNumber=Xs.isNumber$$module$build$src$core$utils$string,Zu.shortestStringLength=Oi,Zu.wrap=Xs.wrap$$module$build$src$core$utils$string;var eh=void 0,th=!1,ih=!1,nh=50,oh=0,rh=0,sh=0,ah=0,lh=null,ch=null,uh=0,hh=10,dh=10,ph=750,fh=5,gh=null,mh={HOVER_MS:ph,LIMIT:nh,MARGINS:fh,OFFSET_X:uh,OFFSET_Y:hh,RADIUS_OK:dh};mh.bindMouseEvents=xi,mh.block=Vi,mh.createDom=Mi,mh.dispose=Ui,mh.getCustomTooltip=Ai,mh.getDiv=Ni,mh.getTooltipOfObject=wi,mh.hide=Hi,mh.isVisible=Li,mh.setCustomTooltip=ki,mh.unbindMouseEvents=Di,mh.unblock=Gi;var Th=.45,_h=.65,Eh={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"},bh={};bh.blend=nn,bh.getHsvSaturation=Yi,bh.getHsvValue=Ki,bh.hexToRgb=en,bh.hsvToHex=tn,bh.hueToHex=on,bh.names=Eh,bh.parse=Ji,bh.rgbToHex=Zi,bh.setHsvSaturation=Qi,bh.setHsvValue=qi;var Oh={};Oh.checkMessageReferences=ln,Oh.parseBlockColour=cn,Oh.replaceMessageReferences=an,Oh.tokenizeInterpolation=sn;var vh=class{get size_(){return this.size}set size_(e){this.size=e}constructor(e,t,i){this.DEFAULT_VALUE=null,this.name=void 0,this.tooltip=this.validator_=null,this.size=new tc(0,0),this.constants_=this.mouseDownWrapper=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=null,this.disposed=!1,this.maxDisplayLength=50,this.sourceBlock_=null,this.enabled_=this.visible_=this.isDirty_=!0,this.suffixField=this.prefixField=this.clickTarget_=null,this.EDITABLE=!0,this.SERIALIZABLE=!1,this.id_=null,this.value_="DEFAULT_VALUE"in new.target.prototype?new.target.prototype.DEFAULT_VALUE:this.DEFAULT_VALUE,this.size_=new tc(0,0),e!==vh.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){e.tooltip&&this.setTooltip(an(e.tooltip))}setSourceBlock(e){if(this.sourceBlock_)throw Error("Field already bound to a block");if(this.sourceBlock_=e,e.id.includes("_field"))throw Error(`Field ID indicator is contained in block ID. This may cause problems with focus: ${e.id}.`);this.id_=`${e.id}_field_${fa()}`}getConstants(){return!this.constants_&&this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_}getSourceBlock(){return this.sourceBlock_}init(){if(!this.fieldGroup_){var e=this.id_;if(!e)throw Error("Expected ID to be defined prior to init.");this.fieldGroup_=p(Zl.G,{id:e}),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(),this.applyColour()}}initView(){this.createBorderRect_(),this.createTextElement_(),this.fieldGroup_&&f(this.fieldGroup_,"blocklyField")}initModel(){}isFullBlockField(){return!this.borderRect_}createBorderRect_(){this.borderRect_=p(Zl.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_)}createTextElement_(){this.textElement_=p(Zl.TEXT,{class:"blocklyText blocklyFieldText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)}bindEvents_(){let e=this.getClickTarget_();if(!e)throw Error("A click target has not been set.");xi(e),this.mouseDownWrapper=aa(e,"pointerdown",this,this.onMouseDown_)}fromXml(e){this.setValue(e.textContent)}toXml(e){return e.textContent=this.getValue(),e}saveState(e){return null===(e=this.saveLegacyState(vh))?this.getValue():e}loadState(e){this.loadLegacyState(vh,e)||this.setValue(e)}saveLegacyState(e){return e.prototype.saveState===this.saveState&&e.prototype.toXml!==this.toXml?((e=Xs.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name",this.name||""),de(this.toXml(e)).replace(' xmlns="https://developers.google.com/blockly/xml"',"")):null}loadLegacyState(e,t){return e.prototype.loadState===this.loadState&&e.prototype.fromXml!==this.fromXml&&(this.fromXml(Xs.textToDom$$module$build$src$core$utils$xml(t)),!0)}dispose(){let e;mi(this),mn(this),null!=(e=this.getSourceBlock())&&e.isDeadOrDying()||_(this.fieldGroup_),this.disposed=!0}updateEditable(){let e=this.fieldGroup_,t=this.getSourceBlock();this.EDITABLE&&e&&t&&(this.enabled_&&t.isEditable()?(f(e,"blocklyEditableField"),m(e,"blocklyNonEditableField")):(f(e,"blocklyNonEditableField"),m(e,"blocklyEditableField")))}setEnabled(e){this.enabled_=e,this.updateEditable()}isEnabled(){return this.enabled_}isClickable(){return this.enabled_&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&this.showEditor_!==vh.prototype.showEditor_}isClickableInFlyout(e){return!e}isCurrentlyEditable(){return this.enabled_&&this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}isSerializable(){let e=!1;return this.name&&(this.SERIALIZABLE?e=!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."),e=!0)),e}isVisible(){return this.visible_}setVisible(e){if(this.visible_!==e){this.visible_=e;var t=this.fieldGroup_;t&&(t.style.display=e?"block":"none")}}setValidator(e){this.validator_=e}getValidator(){return this.validator_}getSvgRoot(){return this.fieldGroup_}getBorderRect(){if(!this.borderRect_)throw Error(`The border rectangle is ${this.borderRect_}.`);return this.borderRect_}getTextElement(){if(!this.textElement_)throw Error(`The text element is ${this.textElement_}.`);return this.textElement_}getTextContent(){if(!this.textContent_)throw Error(`The text content is ${this.textContent_}.`);return this.textContent_}applyColour(){}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()}showEditor(e){this.isClickable()&&this.showEditor_(e)}showEditor_(e){}repositionForWindowResize(){return!1}updateSize_(e){let t=this.getConstants(),i=2*(e=void 0===e?this.isFullBlockField()?0:this.getConstants().FIELD_BORDER_RECT_X_PADDING:e),n=t.FIELD_TEXT_HEIGHT,o=0;this.textElement_&&(o=I(this.textElement_),i+=o),this.isFullBlockField()||(n=Math.max(n,t.FIELD_BORDER_RECT_HEIGHT)),this.size_=new tc(i,n),this.positionTextElement_(e,o),this.positionBorderRect_()}positionTextElement_(e,t){if(this.textElement_){var i,n=this.getConstants(),o=this.size_.height/2;this.textElement_.setAttribute("x",String(null!=(i=this.getSourceBlock())&&i.RT
3L?this.size_.width-t-e:e)),this.textElement_.setAttribute("y",String(n.FIELD_TEXT_BASELINE_CENTER?o:o-n.FIELD_TEXT_HEIGHT/2+n.FIELD_TEXT_BASELINE))}}positionBorderRect_(){this.borderRect_&&(this.borderRect_.setAttribute("width",String(this.size_.width)),this.borderRect_.setAttribute("height",String(this.size_.height)),this.borderRect_.setAttribute("rx",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)),this.borderRect_.setAttribute("ry",String(this.getConstants().FIELD_BORDER_RECT_RADIUS)))}getSize(){return this.isVisible()?(this.isDirty_&&=(this.render_(),!1),this.size_):new tc(0,0)}getScaledBBox(){let e;var t=this.getSourceBlock();if(!t)throw new Ih;if(this.isFullBlockField()){var i=this.sourceBlock_.getHeightWidth();let n=t.workspace.scale;e=this.getAbsoluteXY_(),t=(i.width+1)*n,i=(i.height+1)*n,Qa?(e.x+=1.5*n,e.y+=1.5*n):(e.x-=.5*n,e.y-=.5*n)}else i=this.borderRect_.getBoundingClientRect(),e=ee(this.borderRect_),t=i.width,i=i.height;return new ec(e.y,e.y+i,e.x,e.x+t)}onLocationChange(e){}getDisplayText_(){let e=this.getText();return e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"â¦"),e=e.replace(/\s/g,vh.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="â"),e}getText(){let e=this.getText_();return String(null===e?this.getValue():e)}getText_(){return null}markDirty(){this.isDirty_=!0,this.constants_=null}forceRerender(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&this.sourceBlock_.queueRender()}setValue(e,i=!0){if(null!==e){var n=Xs.getGroup$$module$build$src$core$events$utils();n||Xs.setGroup$$module$build$src$core$events$utils(!0);try{let n=this.doClassValidation_(e),c=this.processValidation(e,n,i);if(!(c instanceof Error)){var o=this.getValidator()?.call(this,c),r=this.processValidation(c,o,i);if(!(r instanceof Error)){var s=this.sourceBlock_;if(!s||!s.disposed){var l=this.getValue();l===r?this.doValueUpdate_(r):(this.doValueUpdate_(r),i&&s&&a()&&t(new(h(ja.BLOCK_CHANGE))(s,"field",this.name||null,l,r)),this.isDirty_&&this.forceRerender())}}}}finally{Xs.setGroup$$module$build$src$core$events$utils(n)}}}processValidation(e,t,i){return null===t?(this.doValueInvalid_(e,i),this.isDirty_&&this.forceRerender(),Error()):void 0===t?e:t}getValue(){return this.value_}doClassValidation_(e){return e??null}doValueUpdate_(e){this.value_=e,this.isDirty_=!0}doValueInvalid_(e,t){}onMouseDown_(e){this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()&&(e=this.sourceBlock_.workspace.getGesture(e))&&e.setStartField(this)}setTooltip(e){e||""===e||(e=this.sourceBlock_);let t=this.getClickTarget_();t?t.tooltip=e:this.tooltip=e}getTooltip(){let e=this.getClickTarget_();return wi(e||{tooltip:this.tooltip})}getClickTarget_(){return this.clickTarget_||this.getSvgRoot()}getAbsoluteXY_(){return ee(this.getClickTarget_())}referencesVariables(){return!1}refreshVariableName(){}getParentInput(){let e=null,t=this.getSourceBlock();if(!t)throw new Ih;let i=t.inputList;for(let n=0;n<t.inputList.length;n++){let t=i[n],o=t.fieldRow;for(let i=0;i<o.length;i++)if(o[i]===this){e=t;break}}return e}getFlipRtl(){return!1}onShortcut(e){return!1}getFocusableElement(){if(!this.fieldGroup_)throw Error("This field currently has no representative DOM element.");return this.fieldGroup_}getFocusableTree(){let e=this.getSourceBlock();if(!e)throw new Ih;return e.workspace}onNodeFocus(){let e=this.getSourceBlock();e.workspace.scrollBoundsIntoView(e.getBoundingRectangleWithoutChildren())}onNodeBlur(){}canBeFocused(){return!0}static fromJson(e){throw Error("Attempted to instantiate a field from the registry that hasn't defined a 'fromJson' method.")}};vh.NBSP=" ",vh.SKIP_SETUP=Symbol("SKIP_SETUP");var Ih=class extends Error{constructor(){super("The field has not yet been attached to its input. Call appendField to attach it.")}},Sh={};Sh.Field=vh,Sh.UnattachedFieldError=Ih;var yh,Rh=null,Ch=null,kh=null,Ah="blocklyWidgetDiv",Lh="",Nh="",wh=null,$h={};$h.createDom=dn,$h.getDiv=un,$h.hide=fn,$h.hideIfOwner=mn,$h.hideIfOwnerIsInWorkspace=Tn,$h.isVisible=gn,$h.positionWithAnchor=En,$h.repositionForWindowResize=In,$h.show=pn,$h.testOnly_setDiv=hn;var Mh=null,xh={},Dh=null,Ph={};Ph.callbackFactory=Xs.callbackFactory$$module$build$src$core$contextmenu,Ph.dispose=wn,Ph.getCurrentBlock=Sn,Ph.getMenu=$n,Ph.hide=Nn,Ph.setCurrentBlock=yn,Ph.show=Rn;var Fh=class{constructor(){this.registeredItems=new Map,this.reset()}reset(){this.registeredItems.clear()}register(e){if(this.registeredItems.has(e.id))throw Error('Menu item with ID "'+e.id+'" is already registered.');this.registeredItems.set(e.id,e)}unregister(e){if(!this.registeredItems.has(e))throw Error('Menu item with ID "'+e+'" not found.');this.registeredItems.delete(e)}getItem(e){return this.registeredItems.get(e)??null}getContextMenuOptions(e,t){let i=[];for(let n of this.registeredItems.values()){if(n.scopeType&&(n.scopeType===Bh.BLOCK&&!e.block||n.scopeType===Bh.COMMENT&&!e.comment||n.scopeType===Bh.WORKSPACE&&!e.workspace))continue;let o;o={scope:e,weight:n.weight};let r,s=(r=n).preconditionFn?.call(r,e,t);if("hidden"!==s){if(n.separator)o=Object.assign({},o,{separator:!0});else{let t="function"==typeof n.displayText?n.displayText(e):n.displayText;o=Object.assign({},o,{text:t,callback:n.callback,enabled:"enabled"===s})}i.push(o)}}return i.sort(function(e,t){return e.weight-t.weight}),i}};!function(e){var t=e.ScopeType||={};t.BLOCK="block",t.WORKSPACE="workspace",t.COMMENT="comment",e.registry=new e}(Fh||={});var Bh=Fh.ScopeType,Uh={};Uh.ContextMenuRegistry=Fh,Uh.ScopeType=Bh;var Hh=50,Vh=100,Gh={BLOCK:Hh,BUBBLE:Vh},Wh=class{constructor(e){this.comment=e,this.startLoc=null,this.workspace=e.workspace}isMovable(){return this.comment.isOwnMovable()&&!this.comment.isDeadOrDying()&&!this.workspace.isReadOnly()}startDrag(){let e;this.fireDragStartEvent(),this.startLoc=this.comment.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.comment),this.comment.setDragging(!0)}drag(e){this.comment.moveDuringDrag(e)}endDrag(){let e;this.fireDragEndEvent(),this.fireMoveEvent(),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.comment,Hh),this.comment.setDragging(!1),this.comment.snapToGri
3d(),this.workspace.setResizesEnabled(!0)}fireDragStartEvent(){let e=new(h(ja.COMMENT_DRAG))(this.comment,!0);t(e)}fireDragEndEvent(){let e=new(h(ja.COMMENT_DRAG))(this.comment,!1);t(e)}fireMoveEvent(){if(!this.comment.isDeadOrDying()){var e=new(h(ja.COMMENT_MOVE))(this.comment);e.setReason(["drag"]),e.oldCoordinate_=this.startLoc,e.recordNew(),t(e)}}revertDrag(){this.startLoc&&this.comment.moveDuringDrag(this.startLoc)}},Xh=new WeakMap,zh={};zh.move=Dn,zh.start=xn;var jh=class{constructor(e,t,i,n){this.id=e,this.workspace=t,this.container=i,this.commentView=n}isVisible(){return this.icon.checkVisibility()}getCommentView(){return this.commentView}getSize(e=!1){var t=this.icon.getBBox();return t=ec.from(t),e&&(e=this.getMargin(),t.left-=e,t.top-=e,t.bottom+=e,t.right+=e),t}getMargin(){return(this.container.getBBox().height-this.icon.getBBox().height)/2}getFocusableElement(){return this.icon}getFocusableTree(){return this.workspace}onNodeFocus(){let e=this.getCommentView();var t=e.getRelativeToSurfaceXY();let i=e.getSize();t=new ec(t.y,t.y+i.height,t.x,t.x+i.width),e.workspace.scrollBoundsIntoView(t)}onNodeBlur(){}canBeFocused(){return this.isVisible()}},Yh="_collapse_bar_button",Qh=class extends jh{constructor(e,t,i,n){super(e,t,i,n),this.id=e,this.workspace=t,this.container=i,this.commentView=n,this.icon=p(Zl.IMAGE,{class:"blocklyFoldoutIcon",href:`${this.workspace.options.pathToMedia}foldout-icon.svg`,id:`${this.id}${Yh}`},this.container),this.bindId=aa(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){ca(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",`${e}`)}performAction(e){na(),this.getCommentView().bringToFront(),e&&e instanceof PointerEvent&&ha(e)||(this.getCommentView().setCollapsed(!this.getCommentView().isCollapsed()),this.workspace.hideChaff()),e.stopPropagation()}};({COMMENT_COLLAPSE_BAR_BUTTON_FOCUS_IDENTIFIER:Yh}).CollapseCommentBarButton=Qh;var Kh="_comment_textarea_",qh=class{constructor(e,t,i){this.workspace=e,this.onFinishEditing=i,this.textChangeListeners=[],this.text="",this.foreignObject=p(Zl.FOREIGNOBJECT,{class:"blocklyCommentForeignObject"}),(e=document.createElementNS(Ol,"body")).setAttribute("xmlns",Ol),e.className="blocklyMinimalBody",this.textArea=document.createElementNS(Ol,"textarea"),this.textArea.setAttribute("tabindex","-1"),this.textArea.setAttribute("dir",this.workspace.RTL?"RTL":"LTR"),this.textArea.setAttribute("placeholder",Xs.Msg$$module$build$src$core$msg.WORKSPACE_COMMENT_DEFAULT_TEXT),f(this.textArea,"blocklyCommentText"),f(this.textArea,"blocklyTextarea"),f(this.textArea,"blocklyText"),e.appendChild(this.textArea),this.foreignObject.appendChild(e),t&&(this.id=t+Kh,this.textArea.setAttribute("id",this.id)),aa(this.textArea,"change",this,this.onTextChange),aa(this.textArea,"pointerdown",this,e=>{e.stopPropagation(),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this),na()}),aa(this.textArea,"wheel",this,e=>{e.stopPropagation()},!1,{passive:!0}),aa(this.textArea,"keydown",this,this.handleKeyDown)}getDom(){return this.foreignObject}getText(){return this.text}setText(e){this.textArea.value=e,this.onTextChange()}onTextChange(){let e=this.text;this.text=this.textArea.value;for(let t=this.textChangeListeners.length-1;t>=0;t--)this.textChangeListeners[t](e,this.text)}handleKeyDown(e){("Escape"===e.key||"Enter"===e.key&&(e.ctrlKey||e.metaKey))&&(this.onFinishEditing&&this.onFinishEditing(),e.stopPropagation())}addTextChangeListener(e){this.textChangeListeners.push(e)}removeTextChangeListener(e){this.textChangeListeners.splice(this.textChangeListeners.indexOf(e),1)}setPlaceholderText(e){this.textArea.placeholder=e}setEditable(e){e?this.textArea.removeAttribute("readonly"):this.textArea.setAttribute("readonly","true")}updateSize(e,t){this.foreignObject.setAttribute("height",""+(e.height-t.height)),this.foreignObject.setAttribute("width",`${e.width}`),this.foreignObject.setAttribute("y",`${t.height}`),this.workspace.RTL&&this.foreignObject.setAttribute("x",""+-e.width)}getFocusableElement(){return this.textArea}getFocusableTree(){return this.workspace}onNodeFocus(){let e=ec.from(this.foreignObject.getBoundingClientRect());this.workspace.scrollBoundsIntoView(ec.createFromPoint(ce(this.workspace,e.getOrigin()),e.getWidth(),e.getHeight()))}onNodeBlur(){}canBeFocused(){return!!this.id}};({COMMENT_EDITOR_FOCUS_IDENTIFIER:Kh}).CommentEditor=qh;var Jh="_delete_bar_button",Zh=class extends jh{constructor(e,t,i,n){super(e,t,i,n),this.id=e,this.workspace=t,this.container=i,this.commentView=n,this.icon=p(
3Zl.IMAGE,{class:"blocklyDeleteIcon",href:`${this.workspace.options.pathToMedia}delete-icon.svg`,id:`${this.id}${Jh}`},i),this.bindId=aa(this.icon,"pointerdown",this,this.performAction.bind(this))}dispose(){ca(this.bindId)}reposition(){let e=this.getMargin();this.icon.setAttribute("x","0");let t=this.container.getBBox();this.icon.setAttribute("y",`${e}`),this.icon.setAttribute("x",""+(t.width-this.getSize(!0).getWidth()))}performAction(e){na(),e&&e instanceof PointerEvent&&ha(e)?e.stopPropagation():(this.getCommentView().dispose(),e?.stopPropagation(),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.workspace))}};({COMMENT_DELETE_BAR_BUTTON_FOCUS_IDENTIFIER:Jh}).DeleteCommentBarButton=Zh;var ed=class{constructor(e,t){let i;this.workspace=e,this.commentId=t,this.collapsed=!1,this.editable=!0,this.location=new Jl(0,0),this.sizeChangeListeners=[],this.disposeListeners=[],this.collapseChangeListeners=[],this.resizePointerMoveListener=this.resizePointerUpListener=null,this.disposed=this.disposing=!1,this.svgRoot=p(Zl.G,{class:"blocklyComment blocklyEditable blocklyDraggable"}),this.highlightRect=this.createHighlightRect(this.svgRoot),({topBarGroup:this.topBarGroup,topBarBackgroun
3d:this.topBarBackground,deleteButton:this.deleteButton,foldoutButton:this.foldoutButton,textPreview:this.textPreview,textPreviewNode:this.textPreviewNode}=this.createTopBar(this.svgRoot)),this.commentEditor=this.createTextArea(),this.resizeHandle=this.createResizeHandle(this.svgRoot,e),null==(i=e.getLayerManager())||i.append(this,Hh),this.size=ed.defaultCommentSize,this.setSizeWithoutFiringEvents(this.size),this.moveTo(new Jl(0,0))}createHighlightRect(e){return p(Zl.RECT,{class:"blocklyCommentHighlight"},e)}createTopBar(e){e=p(Zl.G,{class:"blocklyCommentTopbar"},e);let t=p(Zl.RECT,{class:"blocklyCommentTopbarBackground"},e),i=new Zh(this.commentId,this.workspace,e,this),n=new Qh(this.commentId,this.workspace,e,this);this.addDisposeListener(()=>{i.dispose(),n.dispose()});let o=p(Zl.TEXT,{class:"blocklyCommentPreview blocklyCommentText blocklyText"},e),r=document.createTextNode("");return o.appendChild(r),{topBarGroup:e,topBarBackground:t,deleteButton:i,foldoutButton:n,textPreview:o,textPreviewNode:r}}createTextArea(){let e=new qh(this.workspace,this.commentId,()=>this.svgRoot.focus());return this.svgRoot.appendChild(e.getDom()),e.addTextChangeListener((e,t)=>{this.updateTextPreview(t),this.setSize(this.size)}),e}getEditorFocusableNode(){return this.commentEditor}createResizeHandle(e,t){return e=p(Zl.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),aa(e,"pointerdown",this,this.onResizePointerDown),e}getSvgRoot(){return this.svgRoot}
3getSize(){return this.collapsed?this.topBarBackground.getBBox():this.size}setSizeWithoutFiringEvents(e){let t=this.topBarBackground.getBBox(),i=this.textPreview.getBBox(),n=this.resizeHandle.getBBox();this.size=e=tc.max(e,this.calcMinSize(t)),this.svgRoot.setAttribute("height",`${e.height}`),this.svgRoot.setAttribute("width",`${e.width}`),this.updateHighlightRect(e),this.updateTopBarSize(e),this.commentEditor.updateSize(e,t),this.deleteButton.reposition(),this.foldoutButton.reposition(),this.updateTextPreviewSize(e,t,i),this.updateResizeHandlePosition(e,n)}setSize(e){let t=this.preResizeSize||this.size;this.setSizeWithoutFiringEvents(e),this.onSizeChange(t,this.size)}calcMinSize(e){var t;this.updateTextPreview(this.commentEditor.getText()??"");let i=t=I(this.textPreview);return this.foldoutButton.isVisible()?i+=this.foldoutButton.getSize(!0).getWidth():t&&(i+=4),this.deleteButton.isVisible()?i+=this.deleteButton.getSize(!0).getWidth():t&&(i+=4),new tc(i,e.height+20)}updateHighlightRect(e){this.highlightRect.setAttribute("height",`${e.height}`),this.highlightRect.setAttribute("width",`${e.width}`),this.workspace.RTL&&this.highlightRect.setAttribute("x",""+-e.width)}
3updateTopBarSize(e){this.topBarBackground.setAttribute("width",`${e.width}`)}updateTextPreviewSize(e,t,i){t=(t.height-i.height)/2;let n=this.foldoutButton.getSize(!0),o=this.deleteButton.getSize(!0);e=e.width-n.getWidth()-o.getWidth(),this.textPreview.setAttribute("x",""+(this.workspace.RTL?-1:1)*n.getWidth()),this.textPreview.setAttribute("y",`${t+i.height/2}`),this.textPreview.setAttribute("width",`${e}`)}updateResizeHandlePosition(e,t){this.resizeHandle.setAttribute("y",""+(e.height-t.height)),this.resizeHandle.setAttribute("x",""+(e.width-t.width))}onSizeChange(e,t){for(let i=this.sizeChangeListeners.length-1;i>=0;i--)this.sizeChangeListeners[i](e,t)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}removeSizeChangeListener(e){this.sizeChangeListeners.splice(this.sizeChangeListeners.indexOf(e),1)}onResizePointerDown(e){this.isEditable()&&(this.bringToFront(),ha(e)||(this.preResizeSize=this.getSize(),xn(this.workspace,e,new Jl(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.getSize().height)),this.resizePointerUpListener=aa(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=aa(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation())}onResizePointerUp(e){na(),this.resizePointerUpListener&&=(ca(this.resizePointerUpListener),null),this.resizePointerMoveListener&&=(ca(this.resizePointerMoveListener),null),this.setSize(this.size),this.preResizeSize=void 0}onResizePointerMove(e){e=Dn(this.workspace,e),this.setSizeWithoutFiringEvents(new tc(this.workspace.RTL?-e.x:e.x,e.y))}isCollapsed(){return this.collapsed}setCollapsed(e){(this.collapsed=e)?f(this.svgRoot,"blocklyCollapsed"):m(this.svgRoot,"blocklyCollapsed"),this.setSizeWithoutFiringEvents(this.size),this.onCollapse()}onCollapse(){for(let e=this.collapseChangeListeners.length-1;e>=0;e--)this.collapseChangeListeners[e](this.collapsed)}addOnCollapseListener(e){this.collapseChangeListeners.push(e)}removeOnCollapseListener(e){this.collapseChangeListeners.splice(this.collapseChangeListeners.indexOf(e),1)}isEditable(){return this.editable}setEditable(e){(this.editable=e)?(f(this.svgRoot,"blocklyEditable"),m(this.svgRoot,"blocklyReadonly")):(m(this.svgRoot,"blocklyEditable"),f(this.svgRoot,"blocklyReadonly")),this.commentEditor.setEditable(e)}getRelativeToSurfaceXY(){return this.location}moveTo(e){this.location=e,this.svgRoot.setAttribute("transform",`translate(${e.x}, ${e.y})`)}getText(){return this.commentEditor.getText()}setText(e){this.commentEditor.setText(e)}setPlaceholderText(e){this.commentEditor.setPlaceholderText(e)}addTextChangeListener(e){this.commentEditor.addTextChangeListener(e)}removeTextChangeListener(e){this.commentEditor.removeTextChangeListener(e)}updateTextPreview(e){this.textPreviewNode.textContent=this.truncateText(e)}truncateText(e){return e.length>=12?`${e.substring(0,9)}...`:e}bringToFront(){let e=this.svgRoot.parentNode,t=e.childNodes;t[t.length-1]!==this.svgRoot&&e.appendChild(this.svgRoot)}onDeleteDown(e){na(),ha(e)||this.dispose(),e.stopPropagation()}dispose(){this.disposing=!0,_(this.svgRoot);for(let e=this.disposeListeners.length-1;e>=0;e--)this.disposeListeners[e]();this.disposeListeners.length=0,this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}addDisposeListener(e){this.disposeListeners.push(e)}removeDisposeListener(e){this.disposeListeners.splice(this.disposeListeners.indexOf(e),1)}getCommentBarButtons(){return[this.foldoutButton,this.deleteButton]}};ed.defaultCommentSize=new tc(120,100),Y("\n.injectionDiv {\n --commentFillColour: #FFFCC7;\n --commentBorderColour: #F2E49B;\n}\n\n.blocklyComment .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 1px solid var(--commentBorderColour);\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n\n.blocklyReadonly.blocklyComment .blocklyTextarea {\n cursor: inherit;\n}\n\n.blocklyDeleteIcon {\n width: 20px;\n height: 20px;\n display: none;\n cursor: pointer;\n}
3\n\n.blocklyFoldoutIcon {\n width: 20px;\n height: 20px;\n transform-origin: 12px 12px;\n cursor: pointer;\n}\n.blocklyResizeHandle {\n width: 12px;\n height: 12px;\n cursor: se-resize;\n}\n.blocklyReadonly.blocklyComment .blocklyResizeHandle {\n cursor: inherit;\n}\n\n.blocklyCommentTopbarBackground {\n fill: var(--commentBorderColour);\n height: 24px;\n}\n\n.blocklyComment .blocklyCommentPreview.blocklyText {\n fill: #000;\n dominant-baseline: middle;\n visibility: hidden;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentPreview {\n visibility: visible;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyCommentForeignObject,\n.blocklyCollapsed.blocklyComment .blocklyResizeHandle {\n display: none;\n}\n\n.blocklyCollapsed.blocklyComment .blocklyFoldoutIcon {\n transform: rotate(-90deg);\n}\n\n.blocklyRTL .blocklyCommentTopbar {\n transform: scale(-1, 1);\n}\n\n.blocklyRTL .blocklyCommentForeignObject {\n direction: rtl;\n}\n\n.blocklyRTL .blocklyCommentPreview {\n /* Revert the scale and control RTL using direction instead. */\n transform: scale(-1, 1);\n direction: rtl;\n}\n\n.blocklyRTL .blocklyResizeHandle {\n transform: scale(-1, 1);\n cursor: sw-resize;\n}\n\n.blocklyCommentHighlight {\n fill: none;\n}\n\n.blocklyCommentText.blocklyActiveFocus {\n border-color: #fc3;\n border-width: 2px;\n}\n\n.blocklySelected .blocklyCommentHighlight {\n stroke: #fc3;\n stroke-width: 3px;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentHighlight {\n stroke: none;\n}\n\n.blocklyCollapsed.blocklySelected .blocklyCommentTopbarBackground {\n stroke: #fc3;\n stroke-width: 3px;\n}\n");var td=class{constructor(e,t){this.workspace=e,this.text="",this.collapsed=!1,this.deletable=this.movable=this.editable=!0,this.location=new Jl(0,0),this.disposing=this.disposed=!1,this.id=t&&!e.getCommentById(t)?t:ga(),this.size=ed.defaultCommentSize,e.addTopComment(this),this.fireCreateEvent()}fireCreateEvent(){a()&&t(new(h(ja.COMMENT_CREATE))(this))}fireDeleteEvent(){a()&&t(new(h(ja.COMMENT_DELETE))(this))}fireChangeEvent(e,i){a()&&t(new(h(ja.COMMENT_CHANGE))(this,e,i))}fireCollapseEvent(e){a()&&t(new(h(ja.COMMENT_COLLAPSE))(this,e))}setText(e){let t=this.text;this.text=e,this.fireChangeEvent(t,e)}getText(){return this.text}setSize(e){let i=new(h(ja.COMMENT_RESIZE))(this);this.size=e,i.recordCurrentSizeAsNewSize(),t(i)}getSize(){return this.size}setCollapsed(e){this.collapsed=e,this.fireCollapseEvent(e)}isCollapsed(){return this.collapsed}setEditable(e){this.editable=e}isEditable(){return this.isOwnEditable()&&!this.workspace.isReadOnly()}isOwnEditable(){return this.editable}setMovable(e){this.movable=e}isMovable(){return this.isOwnMovable()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnMovable(){return this.movable}setDeletable(e){this.deletable=e}isDeletable(){return this.isOwnDeletable()&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.workspace.isFlyout}isOwnDeletable(){return this.deletable}moveTo(e,i){let n=new(h(ja.COMMENT_MOVE))(this);i&&n.setReason(i),this.location=e,n.recordNew(),t(n)}getRelativeToSurfaceXY(){return this.location}dispose(){this.disposing=!0,this.fireDeleteEvent(),this.workspace.removeTopComment(this),this.disposed=!0}isDisposed(){return this.disposed}isDeadOrDying(){return this.disposing||this.disposed}},id=class extends td{constructor(e,t){super(e,t),this.dragStrategy=new Wh(this),this.workspace=e,this.view=new ed(e,this.id),this.view.setSize(this.getSize()),this.view.setEditable(this.isEditable()),this.view.getSvgRoot().setAttribute("data-id",this.id),this.view.getSvgRoot().setAttribute("id",this.id),this.addModelUpdateBindings(),aa(this.view.getSvgRoot(),"pointerdown",this,this.startGesture)}addModelUpdateBindings(){this.view.addTextChangeListener((e,t)=>{super.setText(t)}),this.view.addSizeChangeListener((e,t)=>{super.setSize(t)}),this.view.addOnCollapseListener(()=>{super.setCollapsed(this.view.isCollapsed())}),this.view.addDisposeListener(()=>{this.isDeadOrDying()||this.dispose()})}setText(e){this.view.setText(e)}setPlaceholderText(e){this.view.setPlaceholderText(e)}setSize(e){this.view.setSize(e)}setCollapsed(e){this.view.setCollapsed(e)}setEditable(e){super.setEditable(e),this.view.setEditable(this.isEditable())}getSvgRoot(){return this.view.getSvgRoot()}getSize(){return super.getSize()}getBoundingRectangle(){let e=this.getRelativeToSurfaceXY();var t,i;
3let n=(i=(t=this.view)?.getSize())??this.getSize();return this.workspace.RTL?(t=e.x-n.width,i=e.x):(t=e.x,i=e.x+n.width),new ec(e.y,e.y+n.height,t,i)}moveBy(e,t,i){let n=this.getRelativeToSurfaceXY();e=new Jl(n.x+e,n.y+t),this.moveTo(e,i)}moveTo(e,t){super.moveTo(e,t),this.view.moveTo(e)}moveDuringDrag(e){this.location=e,this.view.moveTo(e)}setDragging(e){e?f(this.getSvgRoot(),"blocklyDragging"):m(this.getSvgRoot(),"blocklyDragging")}dispose(){this.disposing=!0;let e=Xs.getFocusManager$$module$build$src$core$focus_manager();e.getFocusedNode()===this&&setTimeout(()=>e.focusTree(this.workspace),0),this.view.isDeadOrDying()||this.view.dispose(),super.dispose()}startGesture(e){let t=this.workspace.getGesture(e);t&&(t.handleCommentStart(e,this),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this))}setDeleteStyle(e){e?f(this.getSvgRoot(),"blocklyDraggingDelete"):m(this.getSvgRoot(),"blocklyDraggingDelete")}isCopyable(){return this.isOwnMovable()&&this.isOwnDeletable()}isMovable(){return this.dragStrategy.isMovable()}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){f(this.getSvgRoot(),"blocklySelected"),F(this)}unselect(){m(this.getSvgRoot(),"blocklySelected"),F(null)}toCopyData(){return{paster:Mc.TYPE,commentState:Ae(this,{addCoordinates:!0,saveIds:!1})}}showContextMenu(e){let t,i=Fh.registry.getContextMenuOptions({comment:this,focusedNode:this},e);t=e instanceof PointerEvent?new Jl(e.clientX,e.clientY):ue(this.workspace,this.getRelativeToSurfaceXY()).translate(10,10),Rn(e,i,this.workspace.RTL,this.workspace,t)}snapToGrid(){if(!this.isDeadOrDying()){var e=this.workspace.getGrid();if(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getEditorFocusableNode(){return this.view.getEditorFocusableNode()}getFocusableElement(){return this.getSvgRoot()}getFocusableTree(){return this.workspace}onNodeFocus(){let e;this.select(),null==(e=this.getSvgRoot().parentElement)||e.appendChild(this.getSvgRoot()),this.workspace.scrollBoundsIntoView(this.getBoundingRectangle())}onNodeBlur(){this.unselect()}canBeFocused(){return!0}},nd={};nd.appendDomToWorkspace=Qn,nd.blockToDom=Gn,nd.blockToDomWithXY=Un,nd.clearWorkspaceAndLoadFromXml=jn,nd.deleteNext=lo,nd.domToBlock=Xs.domToBlock$$module$build$src$core$xml,nd.domToBlockInternal=Kn,nd.domToPrettyText=zn,nd.domToText=Xn,nd.domToVariables=qn,nd.domToWorkspace=Xs.domToWorkspace$$module$build$src$core$xml,nd.loadWorkspaceComment=Yn,nd.saveWorkspaceComment=Fn,nd.variablesToDom=Bn,nd.workspaceToDom=Pn;var od=class extends Nu{constructor(e){super(e),this.type=ja.BLOCK_CREATE,e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=Un(e),this.ids=c(e),this.json=Rt(e,{addCoordinates:!0}))}toJson(){let e=super.toJson();if(!this.xml)throw Error("The block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Xn(this.xml),e.ids=this.ids,e.json=this.json,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return(t=Nu.fromJson(e,t,i??new od)).xml=Xs.textToDom$$module$build$src$core$utils$xml(e.xml),t.ids=e.ids,t.json=e.json,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let t=this.getEventWorkspace_();if(!this.json)throw Error("The block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!rd(t,this.ids))if(e)xt(this.json,t);else for(e=0;e<this.ids.length;e++){let i=this.ids[e],n=t.getBlockById(i);n?n.dispose(!1):i===this.blockId&&console.warn("Can't uncreate non-existent block: "+i)}}},rd=function(e,t){return t.map(t=>e.getBlockById(t)).filter(e=>e&&e.isShadow()).length===t.length};zs(ka.EVENT,ja.BLOCK_CREATE,od);var sd=class extends Hl{constructor(e,t){super(t),this.type=ja.THEME_CHANGE,this.themeName=e}toJson(){let e=super.toJson();if(!this.themeName)throw Error("The theme name is undefined. Either pass a theme name to the constructor, or call fromJson");return e.themeName=this.themeName,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new sd)).themeName=e.themeName,t}};zs(ka.EVENT,ja.THEME_CHANGE,sd);var ad=class extends Hl{constructor(e,t,i,n,o){super(n),this.type=ja.VIEWPORT_CHANGE,this.viewTop=e,this.viewLeft=t,this.scale=i,this.oldScale=o}toJson(){let e=super.toJson();if(void 0===this.viewTop)throw Error("The view top is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.viewLeft)throw Error("The view left is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.scale)throw Error("The scale is undefined. Either pass a value to the constructor, or call fromJson");if(void 0===this.oldScale)throw Error("The old scale is undefined. Either pass a value to the constructor, or call fromJson");return e.viewTop=this.viewTop,e.viewLeft=this.viewLeft,e.scale=this.scale,e.oldScale=this.oldScale,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new ad)).viewTop=e.viewTop,t.viewLeft=e.viewLeft,t.scale=e.scale,t.oldScale=e.oldScale,t}};zs(ka.EVENT,ja.VIEWPORT_CHANGE,ad);var ld={fromJsonInternal:po},cd={TEST_ONLY:ld};cd.fromJson=Xs.fromJson$$module$build$src$core$field_registry,cd.register=uo,cd.unregister=ho;var ud=class extends vh{constructor(e,t,i){super(vh.SKIP_SETUP),this.svgArrow=this.arrow=this.imageElement=this.menu_=this.selectedMenuItem=null,this.SERIALIZABLE=!0,this.clickTarget_=this.suffixField=this.prefixField=this.generatedOptions=null,e!==vh.SKIP_SETUP&&(this.setOptions(e),i&&this.configure_(i),t&&this.setValidator(t))}fromXml(e){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e.textContent)}loadState(e){this.loadLegacyState(ud,e)||(this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(e))}initView(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement=p(Zl.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&f(this.borderRect_,"blocklyDropdownRect"),this.fieldGroup_&&(f(this.fieldGroup_,"blocklyField"),f(this.fieldGroup_,"blocklyDropdownField"))}shouldAddBorderRect_(){let e;return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!(null!=(e=this.getSourceBlock())&&e.isShadow())}createTextArrow_(){let e,t;this.arrow=p(Zl.TSPAN,{},this.textElement_),this.arrow.appendChild(document.createTextNode(null!=(e=this.getSourceBlock())&&e.RTL?ud.ARROW_CHAR+" ":" "+ud.ARROW_CHAR)),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.arrow.setAttribute("dominant-baseline","central"),null!=(t=this.getSourceBlock())&&t.RTL?this.getTextElement().insertBefore(this.arrow,this.textContent_):this.getTextElement().appendChild(this.arrow)}createSVGArrow_(){this.svgArrow=p(Zl.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow.setAttributeNS(vl,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}showEditor_(e){var t=this.getSourceBlock();if(!t)throw new Ih;this.dropdownCreate(),this.menu_&&(this.menu_.openingCoords=e&&"number"==typeof e.clientX?new Jl(e.clientX,e.clientY):null,ni(),e=this.menu_.render(ii()),f(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV&&(t=t.getColour(),e=this.sourceBlock_.getColourTertiary(),oi(t,e)),si(this,this.dropdownDispose_.bind(this)),ii().style.height=`${this.menu_.getSize().height}px`,this.menu_.focus(),this.selectedMenuItem&&this.menu_.setHighlighted(this.selectedMenuItem),this.applyColour())}dropdownCreate(){let e=this.getSourceBlock();if(!e)throw new Ih;let t=new Hc;t.setRole(xc.LISTBOX),this.menu_=t;let i=this.getOptions(!1);this.selectedMenuItem=null;for(let o=0;o<i.length;o++){var n=i[o];if(n===ud.SEPARATOR){t.addChild(new Vc);continue}let[r,s]=n;fo(r)?((n=new Image(r.width,r.height)).src=r.src,n.alt=r.alt):n=r,(n=new Uc(n,s)).setRole(xc.OPTION),n.setRightToLeft(e.RTL),n.setCheckable(!0),t.addChild(n),n.setChecked(s===this.value_),s===this.value_&&(this.selectedMenuItem=n),n.onAction(this.handleMenuActionEvent,this)}}dropdownDispose_(){this.menu_&&this.menu_.dispose(),this.selectedMenuItem=this.menu_=null,this.applyColour()}handleMenuActionEvent(e){mi(this,!0),this.onItemSelected_(this.menu_,e)}onItemSelected_(e,t){this.setValue(t.getValue())}isOptionListDynamic(){return"function"==typeof this.menuGenerator_}getOptions(e){if(!this.menuGenerator_)throw TypeError("A menu generator was never defined.");return Array.isArray(this.menuGenerator_)?this.menuGenerator_:(e&&this.generatedOptions||(this.generatedOptions=this.menuGenerator_(),this.validateOptions(this.generatedOptions)),this.generatedOptions)}setOptions(e){Array.isArray(e)?(this.validateOptions(e),e=this.trimOptions(e),this.menuGenerator_=e.options,this.prefixField=e.prefix||null,this.suffixField=e.suffix||null):this.menuGenerator_=e,this.selectedOption=this.getOptions(!1)[0],this.setValue(this.selectedOption[1])}doClassValidation_(e){return this.getOptions(!0).some(t=>t[1]===e)?e:(this.sourceBlock_&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.sourceBlock_.type+", Field name: "+this.name+", Value: "+e),null)}doValueUpdate_(e){super.doValueUpdate_(e),e=this.getOptions(!0);for(let t,i=0;t=e[i];i++)t[1]===this.value_&&(this.selectedOption=t)}applyColour(){let e=this.sourceBlock_;this.borderRect_&&(this.borderRect_.setAttribute("stroke",e.getColourTertiary()),this.menu_?this.borderRect_.setAttribute("fill",e.getColourTertiary()):this.borderRect_.setAttribute("fill","transparent")),e&&this.arrow&&(e.isShadow()?this.arrow.style.fill=e.getColourSecondary():this.arrow.style.fill=e.getColour())}render_(){this.getTextContent().nodeValue="",this.imageElement.style.display="none";let e=this.selectedOption&&this.selectedOption[0];fo(e)?this.renderSelectedImage(e):this.renderSelectedText(),this.positionBorderRect_()}renderSelectedImage(e){let t=this.getSourceBlock();if(!t)throw new Ih;this.imageElement.style.display="",this.imageElement.setAttributeNS(vl,"xlink:href",e.src),this.imageElement.setAttribute("height",String(e.height)),this.imageElement.setAttribute("width",String(e.width));let i=Number(e.height);e=Number(e.width);var n=!!this.borderRect_;let o,r=Math.max(n?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,i+ud.IMAGE_Y_PADDING);n=n?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,o=this.svgArrow?this.positionSVGArrow(e+n,r/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2):I(this.arrow),this.size_=new tc(e+o+2*n,r);let s=0;t.RTL?this.imageElement.setAttribute("x",`${n+o}`):(s=e+o,this.getTextElement().setAttribute("text-anchor","end"),this.imageElement.setAttribute("x",`${n}`)),this.imageElement.setAttribute("y",String(r/2-i/2)),this.positionTextElement_(s+n,e+o)}renderSelectedText(){this.getTextContent().nodeValue=this.getDisplayText_();var e=this.getTextElement();f(e,"blocklyDropdownText"),e.setAttribute("text-anchor","start");var t=!!this.borderRect_;e=Math.max(t?this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT:0,this.getConstants().FIELD_TEXT_HEIGHT);let i=I(this.getTextElement());t=t?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;let n=0;this.svgArrow&&(n=this.positionSVGArrow(i+t,e/2-this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE/2)),this.size_=new tc(i+n+2*t,e),this.positionTextElement_(t,i)}positionSVGArrow(e,t){if(!this.svgArrow)return 0;let i=this.getSourceBlock();if(!i)throw new Ih;let n=this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0,o=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING,r=this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE;return this.svgArrow.setAttribute("transform","translate("+(i.RTL?n:e+o)+","+t+")"),r+o}getText_(){if(!this.selectedOption)return null;let e=this.selectedOption[0];return fo(e)?e.alt:typeof HTMLElement<"u"&&e instanceof HTMLElement?e.title??e.ariaLabel??e.innerText:"string"==typeof e?e:(console.warn("Can't get text for existing dropdown option. If you're using HTMLElement dropdown options in node, ensure you're using jsdom-global or similar."),null)}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}trimOptions(e){let t=!1,i=e.map(e=>{if(e===ud.SEPARATOR)return t=!0,e;let[i,n]=e;return"string"==typeof i?[an(i),n]:(t=!0,[fo(i)?Object.assign({},i,{alt:an(i.alt)}):i,n])});if(t||e.length<2)return{options:i};var n=i.map(([e])=>e),o=Oi(n);e=vi(n,o);let r=Ii(n,o);return!e&&!r||o<=e+r?{options:i}:(o=e?n[0].substring(0,e-1):void 0,n=r?n[0].substr(1-r):void 0,{options:this.applyTrim(i,e,r),prefix:o,suffix:n})}applyTrim(e,t,i){return e.map(([e,n])=>[e.substring(t,e.length-i),n])}validateOptions(e){if(!Array.isArray(e))throw TypeError("FieldDropdown options must be an array.");if(!e.length)throw TypeError("FieldDropdown options must not be an empty array.");let t=!1;for(let i=0;i<e.length;i++){let n=e[i];Array.isArray(n)||n===ud.SEPARATOR?"string"==typeof n[1]?!n[0]||"string"==typeof n[0]||fo(n[0])||typeof HTMLElement<"u"&&n[0]instanceof HTMLElement||(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option must have a string\n label, image description, or HTML element. Found ${n[0]} in: ${n}`)):(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option id must be a string.\n Found ${n[1]} in: ${n}`)):(t=!0,console.error(`Invalid option[${i}]: Each FieldDropdown option must be an array or\n the string literal 'separator'. Found: ${n}`))}if(t)throw TypeError("Found invalid FieldDropdown options.")}};ud.SEPARATOR="separator",ud.ARROW_CHAR="â¾",ud.IMAGE_Y_OFFSET=5,ud.IMAGE_Y_PADDING=2*ud.IMAGE_Y_OFFSET,uo("field_dropdown",ud);var hd,dd=class{constructor(e,t,i,n){this.name=e,this.startHats=!1,this.blockStyles=t||Object.create(null),this.categoryStyles=i||Object.create(null),this.componentStyles=n||Object.create(null),this.fontStyle=Object.create(null),zs(ka.THEME,e,this,
3!0)}getClassName(){return this.name+"-theme"}setBlockStyle(e,t){this.blockStyles[e]=t}setCategoryStyle(e,t){this.categoryStyles[e]=t}getComponentStyle(e){if(!(e=this.componentStyles[e]))return null;if("string"==typeof e){let t=this.getComponentStyle(e);if(t)return t}return`${e}`}setComponentStyle(e,t){this.componentStyles[e]=t}setFontStyle(e){this.fontStyle=e}setStartHats(e){this.startHats=e}static defineTheme(e,t){e=e.toLowerCase();let i=new dd(e),n=t.base;return n&&("string"==typeof n&&(n=Js(ka.THEME,n)??void 0),n instanceof dd&&(A(i,n),i.name=e)),A(i.blockStyles,t.blockStyles),A(i.categoryStyles,t.categoryStyles),A(i.componentStyles,t.componentStyles),A(i.fontStyle,t.fontStyle),null!==t.startHats&&(i.startHats=t.startHats),i}},pd=new dd("classic",{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"}},{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"}}),fd=class{constructor(e){this.gridPattern=null,this.getMetrics=this.setMetrics=void 0;let t=null,i=!1;var n=!1,o=!1,r=!1,s=!1,a=!1;let l=!!e.readOnly;var c;l||(t=fe((c=e.toolbox)??null),i=Te(t),n=void 0===(n=e.trashcan)?i:n,o=void 0===(o=e.collapse)?i:o,r=void 0===(r=e.comments)?i:r,s=void 0===(s=e.disable)?i:s,a=void 0===(a=e.sounds)||a);c=e.maxTrashcanContents,n?void 0===c&&(c=32):c=0;let u=!!e.rtl,h=e.horizontalLayout;void 0===h&&(h=!1);var d="end"!==e.toolboxPosition;d=h?d?mc.TOP:mc.BOTTOM:d===u?mc.RIGHT:mc.LEFT;let p=e.css;void 0===p&&(p=!0);let f="https://blockly-demo.appspot.com/static/media/";e.media&&(f=e.media.endsWith("/")?e.media:e.media+"/");let g=e.oneBasedIndex,m=e.renderer||"geras",T=e.plugins||{},_=e.modalInputs;void 0===_&&(_=!0),this.RTL=u,this.oneBasedIndex=void 0===g||g,this.collapse=o,this.comments=r,this.disable=s,this.readOnly=l,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=e.maxInstances??null,this.modalInputs=_,this.pathToMedia=f,this.hasCategories=i,this.moveOptions=fd.parseMoveOptions(e,i),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=n,this.maxTrashcanContents=c,this.hasSounds=a,this.hasCss=p,this.horizontalLayout=h,this.languageTree=t,this.gridOptions=fd.parseGridOptions(e),this.zoomOptions=fd.parseZoomOptions(e),this.toolboxPosition=d,this.theme=fd.parseThemeOptions(e),this.renderer=m,this.rendererOverrides=e.rendererOverrides??null,this.parentWorkspace=e.parentWorkspace??null,this.plugins=T}static parseMoveOptions(e,t){let i=e.move||{},n={};return void 0===i.scrollbars&&void 0===e.scrollbars?n.scrollbars=t:"object"==typeof i.scrollbars?(n.scrollbars={horizontal:!!i.scrollbars.horizontal,vertical:!!i.scrollbars.vertical},n.scrollbars.horizontal&&n.scrollbars.vertical?n.scrollbars=!0:n.scrollbars.horizontal||n.scrollbars.vertical||(n.scrollbars=!1)):n.scrollbars=!!i.scrollbars||!!e.scrollbars,n.wheel=n.scrollbars&&void 0!==i.wheel?!!i.wheel:"object"==typeof n.scrollbars,n.drag=!!n.scrollbars&&(void 0===i.drag||!!i.drag),n}static parseZoomOptions(e){e=e.zoom||{};let t={};return t.controls=void 0!==e.controls&&!!e.controls,t.wheel=void 0!==e.wheel&&!!e.wheel,t.startScale=void 0===e.startScale?1:Number(e.startScale),t.maxScale=void 0===e.maxScale?3:Number(e.maxScale),t.minScale=void 0===e.minScale?.3:Number(e.minScale),t.scaleSpeed=void 0===e.scaleSpeed?1.2:Number(e.scaleSpeed),t.pinch=void 0===e.pinch?t.wheel||t.controls:!!e.pinch,t}static parseGridOptions(e){e=e.grid||{};let t={};return t.spacing=Number(e.spacing)||0,t.colour=e.colour||"#888",t.length=void 0===e.length?1:Number(e.length),t.snap=t.spacing>0&&!!e.snap,t}static parseThemeOptions(e){return"string"==typeof(e=e.theme||pd)?Js(ka.THEME,e):e instanceof dd?e:dd.defineTheme(e.name||"builtin"+fa(),e)}},gd=class{constructor(e,t){this.bubble=e,this.workspace=t,this.startLoc=null}isMovable(){return!0}startDrag(){let e;this.startLoc=this.bubble.getRelativeToSurfaceXY(),this.workspace.setResizesEnabled(!1),null==(e=this.workspace.getLayerManager())||e.moveToDragLayer(this.bubble),this.bubble.setDragging&&this.bubble.setDragging(!0)}drag(e){this.bubble.moveDuringDrag(e)}endDrag(){let e;this.workspace.setResizesEnabled(!0),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.bubble,Vh),this.bubble.setDragging(!1)}revertDrag(){this.startLoc&&this.bubble.moveDuringDrag(this.startLoc)}},md=class{constructor(e,t,i,n,o){this.workspace=e,this.anchor=t,this.ownerRect=i,this.owner=o,this.size=new tc(0,0),this.colour="#ffffff",this.disposed=!1,this.relativeLeft=this.relativeTop=0,this.dragStrategy=new gd(this,this.workspace),this.id=fa(),this.svgRoot=p(Zl.G,{class:"blocklyBubble"},e.getBubbleCanvas()),e=p(Zl.G,{class:"blocklyEmboss"},this.svgRoot),this.tail=p(Zl.PATH,{class:"blocklyBubbleTail"},e),this.background=p(Zl.RECT,{class:"blocklyDraggable",x:0,y:0,rx:hd.BORDER_WIDTH,ry:hd.BORDER_WIDTH},e),this.contentContainer=p(Zl.G,{},this.svgRoot),this.focusableElement=n??this.svgRoot,this.focusableElement.setAttribute("id",this.id),aa(this.background,"pointerdown",this,this.onMouseDown),aa(this.focusableElement,"keydown",this,this.onKeyDown)}dispose(){_(this.svgRoot),this.disposed=!0}setAnchorLocation(e,t=!1){this.anchor=e,t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}setPositionRelativeToAnchor(e,t){this.relativeLeft=e,this.relativeTop=t,this.positionRelativeToAnchor(),this.renderTail()}getSize(){return this.size}setSize(e,t=!1){e.width=Math.max(e.width,hd.MIN_SIZE),e.height=Math.max(e.height,hd.MIN_SIZE),this.size=e,this.background.setAttribute("width",`${e.width}`),this.background.setAttribute("height",`${e.height}`),t?this.positionByRect(this.ownerRect):this.positionRelativeToAnchor(),this.renderTail()}getColour(){return this.colour}setColour(e){this.colour=e,this.tail.setAttribute("fill",e),this.background.setAttribute("fill",e)}
3onMouseDown(e){let t;null==(t=this.workspace.getGesture(e))||t.handleBubbleStart(e,this),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this)}onKeyDown(e){"Escape"===e.key&&this.owner&&(this.owner.setBubbleVisible(!1),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.owner))}positionRelativeToAnchor(){let e=this.anchor.x;e=this.workspace.RTL?e-(this.relativeLeft+this.size.width):e+this.relativeLeft,this.moveTo(e,this.relativeTop+this.anchor.y)}moveTo(e,t){this.svgRoot.setAttribute("transform",`translate(${e}, ${t})`)}positionByRect(e=new ec(0,0,0,0)){var t=this.workspace.getMetricsManager().getViewMetrics(!0),i=this.getOptimalRelativeLeft(t),n=this.getOptimalRelativeTop(t);let o={x:i,y:-this.size.height-this.workspace.getRenderer().getConstants().MIN_BLOCK_HEIGHT},r={x:-this.size.width-30,y:n};n={x:e.getWidth(),y:n};var s={x:i,y:e.getHeight()};i=e.getWidth()<e.getHeight()?n:s,e=e.getWidth()<e.getHeight()?s:n,n=this.getOverlap(o,t),s=this.getOverlap(r,t);let a=this.getOverlap(i,t);t=this.getOverlap(e,t),n===(t=Math.max(n,s,a,t))?(this.relativeLeft=o.x,this.relativeTop=o.y):s===t?(this.relativeLeft=r.x,this.relativeTop=r.y):a===t?(this.relativeLeft=i.x,this.relativeTop=i.y):(this.relativeLeft=e.x,this.relativeTop=e.y),this.positionRelativeToAnchor()}getOverlap(e,t){var i=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x+this.anchor.x;return e=e.y+this.anchor.y,Math.max(0,Math.min(1,(Math.min(i+this.size.width,t.left+t.width)-Math.max(i,t.left))*(Math.min(e+this.size.height,t.top+t.height)-Math.max(e,t.top))/(this.size.width*this.size.height)))}getOptimalRelativeLeft(e){let t=-this.size.width/4;if(this.size.width>e.width)return t;if(e=this.getWorkspaceViewRect(e),this.workspace.RTL){var i=this.anchor.x-t;i-this.size.width<e.left?t=-(e.left-this.anchor.x+this.size.width):i>e.right&&(t=-(e.right-this.anchor.x))}else{let n=(i=t+this.anchor.x)+this.size.width;i<e.left?t=e.left-this.anchor.x:n>e.right&&(t=e.right-this.anchor.x-this.size.width)}return t}getOptimalRelativeTop(e){let t=-this.size.height/4;if(this.size.height>e.height)return t;let i=this.anchor.y+t,n=i+this.size.height;return i<(e=this.getWorkspaceViewRect(e)).top?t=e.top-this.anchor.y:n>e.bottom&&(t=e.bottom-this.anchor.y-this.size.height),t}getWorkspaceViewRect(e){let t=e.top,i=e.top+e.height,n=e.left;return e=e.left+e.width,i-=this.getScrollbarThickness(),this.workspace.RTL?n-=this.getScrollbarThickness():e-=this.getScrollbarThickness(),new ec(t,i,n,e)}getScrollbarThickness(){return ac.scrollbarThickness/this.workspace.scale}renderTail(){let e=[];var t=this.size.width/2,i=this.size.height/2,n=-this.relativeLeft,o=-this.relativeTop;if(t===n&&i===o)e.push("M "+t+","+i);
3else{o-=i,n-=t,this.workspace.RTL&&(n*=-1);var r=Math.sqrt(o*o+n*n),s=Math.acos(n/r);o<0&&(s=2*Math.PI-s);var a=s+Math.PI/2;a>2*Math.PI&&(a-=2*Math.PI);var l=Math.sin(a);let c=Math.cos(a),u=(this.size.width+this.size.height)/hd.TAIL_THICKNESS;u=Math.min(u,this.size.width,this.size.height)/4,n=t+(a=1-hd.ANCHOR_RADIUS/r)*n,o=i+a*o,a=t+u*c;let h=i+u*l;t-=u*c,i-=u*l,(l=s+(l=Kt(this.workspace.RTL?-hd.TAIL_ANGLE:hd.TAIL_ANGLE)))>2*Math.PI&&(l-=2*Math.PI),s=Math.sin(l)*r/hd.TAIL_BEND,r=Math.cos(l)*r/hd.TAIL_BEND,e.push("M"+a+","+h),e.push("C"+(a+r)+","+(h+s)+" "+n+","+o+" "+n+","+o),e.push("C"+n+","+o+" "+(t+r)+","+(i+s)+" "+t+","+i)}let c;e.push("z"),null==(c=this.tail)||c.setAttribute("d",e.join(" "))}bringToFront(){let e=this.svgRoot?.parentNode;return!(!this.svgRoot||e?.lastChild===this.svgRoot)&&(e?.appendChild(this.svgRoot),!0)}getRelativeToSurfaceXY(){return new Jl(this.workspace.RTL?-this.relativeLeft+this.anchor.x-this.size.width:this.anchor.x+this.relativeLeft,this.anchor.y+this.relativeTop)}getSvgRoot(){return this.svgRoot}moveDuringDrag(e){this.moveTo(e.x,e.y),this.relativeLeft=this.workspace.RTL?this.anchor.x-e.x-this.size.width:e.x-this.anchor.x,this.relativeTop=e.y-this.anchor.y,this.renderTail()}setDragging(e){}setDeleteStyle(e){}isDeletable(){return!1}showContextMenu(e){}isMovable(){return!0}startDrag(){this.dragStrategy.startDrag()}drag(e){this.dragStrategy.drag(e)}endDrag(){this.dragStrategy.endDrag()}revertDrag(){this.dragStrategy.revertDrag()}select(){F(this)}unselect(){F(null)}getFocusableElement(){return this.focusableElement}getFocusableTree(){return this.workspace}onNodeFocus(){this.select(),this.bringToFront();var e=this.getRelativeToSurfaceXY();let t=this.getSize();e=new ec(e.y,e.y+t.height,e.x,e.x+t.width),this.workspace.scrollBoundsIntoView(e)}onNodeBlur(){this.unselect()}canBeFocused(){return!0}getOwner(){return this.owner}};hd=md,md.BORDER_WIDTH=6,md.DOUBLE_BORDER=2*hd.BORDER_WIDTH,md.MIN_SIZE=hd.DOUBLE_BORDER,md.TAIL_THICKNESS=1,md.TAIL_ANGLE=20,md.TAIL_BEND=4,md.ANCHOR_RADIUS=8;var Td=class extends md{constructor(e,t,i,n){let o,r;super(t,i,n),this.workspace=t,this.anchor=i,this.ownerRect=n,this.autoLayout=!0,t=new fd(e),this.validateWorkspaceOptions(t),this.svgDialog=p(Zl.SVG,{x:md.BORDER_WIDTH,y:md.BORDER_WIDTH},this.contentContainer),e.parentWorkspace=this.workspace,this.miniWorkspace=this.newWorkspaceSvg(new fd(e)),this.miniWorkspace.internalIsMutator=!0,e=this.miniWorkspace.createDom("blocklyMutatorBackground"),this.svgDialog.appendChild(e),t.languageTree&&(e.insertBefore(this.miniWorkspace.addFlyout(Zl.G),this.miniWorkspace.getCanvas()),e=this.miniWorkspace.getFlyout(),e?.init(this.miniWorkspace),e?.show(t.languageTree)),f(this.svgRoot,"blocklyMiniWorkspaceBubble"),this.miniWorkspace.addChangeListener(this.onWorkspaceChange.bind(this)),null==(o=this.miniWorkspace.getFlyout())||null==(r=o.getWorkspace())||r.addChangeListener(this.onWorkspaceChange.bind(this)),this.updateBubbleSize()}dispose(){this.miniWorkspace.dispose(),super.dispose()}getWorkspace(){return this.miniWorkspace}addWorkspaceChangeListener(e){this.miniWorkspace.addChangeListener(e)}validateWorkspaceOptions(e){if(e.hasCategories)throw Error("The miniworkspace bubble does not support toolboxes with categories");if(e.hasTrashcan)throw Error("The miniworkspace bubble does not support trashcans");if(e.zoomOptions.controls||e.zoomOptions.wheel||e.zoomOptions.pinch)throw Error("The miniworkspace bubble does not support zooming");if(e.moveOptions.scrollbars||e.moveOptions.wheel||e.moveOptions.drag)throw Error("The miniworkspace bubble does not scrolling/moving the workspace");if(e.horizontalLayout)throw Error("The miniworkspace bubble does not support horizontal layouts")}onWorkspaceChange(){this.bumpBlocksIntoBounds(),this.updateBubbleSize()}bumpBlocksIntoBounds(){if(!this.miniWorkspace.isDragging()||this.miniWorkspace.keyboardMoveInProgress)for(let e of this.miniWorkspace.getTopBlocks(!1)){let t=e.getRelativeToSurfaceXY();if(t.y<20&&e.moveBy(0,20-t.y),e.RTL){let i=-20,n=this.miniWorkspace.getFlyout();n&&(i-=n.getWidth()),t.x>i&&e.moveBy(i-t.x,0)}else t.x<20&&e.moveBy(20-t.x,0)}}updateBubbleSize(){if(!this.miniWorkspace.isDragging()||this.miniWorkspace.keyboardMoveInProgress){this.autoLayout&&=!this.miniWorkspace.keyboardMoveInProgress;
3var e=this.getSize(),t=this.calculateWorkspaceSize();Math.abs(e.width-t.width)<Td.MINIMUM_VIEW_CHANGE&&Math.abs(e.height-t.height)<Td.MINIMUM_VIEW_CHANGE||(this.svgDialog.setAttribute("width",`${t.width}px`),this.svgDialog.setAttribute("height",`${t.height}px`),this.miniWorkspace.setCachedParentSvgSize(t.width,t.height),this.miniWorkspace.RTL&&this.miniWorkspace.getCanvas().setAttribute("transform",`translate(${t.width}, 0)`),this.setSize(new tc(t.width+md.DOUBLE_BORDER,t.height+md.DOUBLE_BORDER),this.autoLayout),this.miniWorkspace.resize(),this.miniWorkspace.recordDragTargets())}}calculateWorkspaceSize(){var e=this.miniWorkspace.getCanvas().getBBox();let t=e.width+Td.MARGIN;e=e.height+Td.MARGIN;let i=this.miniWorkspace.getFlyout();if(i){let n=i.getWorkspace().getMetricsManager().getScrollMetrics();e=Math.max(e,n.height+20),t+=i.getWidth()}return new tc(t,e)}updateBlockStyles(){for(var e of this.miniWorkspace.getAllBlocks(!1))e.setStyle(e.getStyleName());if(e=this.miniWorkspace.getFlyout()?.getWorkspace())for(let t of e.getAllBlocks(!1))t.setStyle(t.getStyleName())}moveDuringDrag(e){super.moveDuringDrag(e),this.autoLayout=!1}moveTo(e,t){super.moveTo(e,t),this.miniWorkspace.recordDragTargets()}newWorkspaceSvg(e){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts")}};Td.MINIMUM_VIEW_CHANGE=10,Td.MARGIN=3*md.DOUBLE_BORDER;var _d=class{constructor(e){this.sourceBlock=e,this.offsetInBlock=new Jl(0,0),this.workspaceLocation=new Jl(0,0),this.svgRoot=null,this.tooltip=e,this.id=fa()}getType(){throw Error("Icons must implement getType")}initView(e){if(!this.svgRoot){var t=this.sourceBlock;this.svgRoot=p(Zl.G,{class:"blocklyIconGroup",id:this.id}),t.getSvgRoot().appendChild(this.svgRoot),this.updateSvgRootOffset(),aa(this.svgRoot,"pointerdown",this,e),this.svgRoot.tooltip=this,xi(this.svgRoot)}}dispose(){Di(this.svgRoot),_(this.svgRoot)}getWeight(){return-1}getSize(){return new tc(0,0)}setTooltip(e){this.tooltip=e??this.sourceBlock}getTooltip(){return this.tooltip}applyColour(){}updateEditable(){}updateCollapsed(){this.svgRoot&&(this.sourceBlock.isCollapsed()?this.svgRoot.style.display="none":this.svgRoot.style.display="block",Qt(this)&&this.setBubbleVisible(!1))}hideForInsertionMarker(){this.svgRoot&&(this.svgRoot.style.display="none")}isShownWhenCollapsed(){return!1}setOffsetInBlock(e){this.offsetInBlock=e,this.updateSvgRootOffset()}updateSvgRootOffset(){let e;null==(e=this.svgRoot)||e.setAttribute("transform",`translate(${this.offsetInBlock.x}, ${this.offsetInBlock.y})`)}onLocationChange(e){this.workspaceLocation=Jl.sum(e,this.offsetInBlock)}onClick(){}isClickableInFlyout(e){return!0}getFocusableElement(){let e=this.svgRoot;if(!e)throw Error("Attempting to focus uninitialized icon.");return e}getFocusableTree(){return this.sourceBlock.workspace}onNodeFocus(){var e=this.sourceBlock.getBoundingRectangle();e=new ec(e.top+this.offsetInBlock.y,e.top+this.offsetInBlock.y+this.getSize().height,e.left+this.offsetInBlock.x,e.left+this.offsetInBlock.x+this.getSize().width),this.sourceBlock.workspace.scrollBoundsIntoView(e)}onNodeBlur(){}canBeFocused(){return!0}getSourceBlock(){return this.sourceBlock}showContextMenu(e){this.getSourceBlock().showContextMenu(e)}};Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon=class extends _d{constructor(e,t){super(t),this.flyoutBlockTypes=e,this.sourceBlock=t,this.saveConnectionsListener=this.updateWorkspacePid=this.rootBlock=this.miniWorkspaceBubble=null}getType(){return Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE}initView(e){this.svgRoot||(super.initView(e),p(Zl.RECT,{class:"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},this.svgRoot),p(Zl.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"},this.svgRoot),p(Zl.CIRCLE,{class:"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},this.svgRoot),f(this.svgRoot,"blocklyMutatorIcon"))}dispose(){let e;super.dispose(),null==(e=this.miniWorkspaceBubble)||e.dispose()}
3getWeight(){return Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT}getSize(){return new tc(17,17)}applyColour(){let e,t;super.applyColour(),null==(e=this.miniWorkspaceBubble)||e.setColour(this.sourceBlock.getColour()),null==(t=this.miniWorkspaceBubble)||t.updateBlockStyles()}updateCollapsed(){super.updateCollapsed(),this.sourceBlock.isCollapsed()&&this.setBubbleVisible(!1)}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.miniWorkspaceBubble)||t.setAnchorLocation(this.getAnchorLocation())}onClick(){super.onClick(),this.sourceBlock.isEditable()&&this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.miniWorkspaceBubble}setBubbleVisible(e){let i=this;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){if(i.bubbleIsVisible()!==e){if(yield Be(),e){let e;i.miniWorkspaceBubble=new Td(i.getMiniWorkspaceConfig(),i.sourceBlock.workspace,i.getAnchorLocation(),i.getBubbleOwnerRect()),i.applyColour(),i.createRootBlock(),i.addSaveConnectionsListener(),null==(e=i.miniWorkspaceBubble)||e.addWorkspaceChangeListener(i.createMiniWorkspaceChangeListener())}else{let e;null==(e=i.miniWorkspaceBubble)||e.dispose(),i.miniWorkspaceBubble=null,i.saveConnectionsListener&&i.sourceBlock.workspace.removeChangeListener(i.saveConnectionsListener),i.saveConnectionsListener=null}t(new(h(ja.BUBBLE_OPEN))(i.sourceBlock,e,"mutator"))}})}getBubble(){return this.miniWorkspaceBubble}getMiniWorkspaceConfig(){let e={disable:!1,media:this.sourceBlock.workspace.options.pathToMedia,rtl:this.sourceBlock.RTL,renderer:this.sourceBlock.workspace.options.renderer,rendererOverrides:this.sourceBlock.workspace.options.rendererOverrides??void 0};return this.flyoutBlockTypes.length&&(e.toolbox={kind:"flyoutToolbox",contents:this.flyoutBlockTypes.map(e=>({kind:"block",type:e}))}),e}getAnchorLocation(){return Jl.sum(this.workspaceLocation,new Jl(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new ec(e.y,e.y+e.height,e.x,e.x+e.width)}createRootBlock(){if(!this.sourceBlock.decompose)throw Error("Blocks with mutator icons must include a decompose method");for(var e of(this.rootBlock=this.sourceBlock.decompose(this.miniWorkspaceBubble.getWorkspace()),this.rootBlock.getDescendants(!1)))e.queueRender();let t,i;this.rootBlock.setMovable(!1),this.rootBlock.setDeletable(!1),e=(null==(t=this.miniWorkspaceBubble)||null==(i=t.getWorkspace())?void 0:i.getFlyout()?.getWidth())??0,this.rootBlock.moveBy(this.rootBlock.RTL?-(e+16):16,16)}addSaveConnectionsListener(){this.sourceBlock.saveConnections&&this.rootBlock&&(this.saveConnectionsListener=()=>{this.sourceBlock.saveConnections&&this.rootBlock&&this.sourceBlock.saveConnections(this.rootBlock)},this.saveConnectionsListener(),this.sourceBlock.workspace.addChangeListener(this.saveConnectionsListener))}createMiniWorkspaceChangeListener(){return e=>{Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.isIgnorableMutatorEvent(e)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null,this.recomposeSourceBlock()},0))}}static isIgnorableMutatorEvent(e){return e.isUiEvent||ma(e)||_a(e)&&"disabled"===e.element}recomposeSourceBlock(){if(this.rootBlock){if(!this.sourceBlock.compose)throw Error("Blocks with mutator icons must include a compose method");var e=Xs.getGroup$$module$build$src$core$events$utils();e||Xs.setGroup$$module$build$src$core$events$utils(!0);var i=wu.getExtraBlockState_(this.sourceBlock);this.sourceBlock.compose(this.rootBlock);var n=wu.getExtraBlockState_(this.sourceBlock);i!==n&&t(new(h(ja.BLOCK_CHANGE))(this.sourceBlock,"mutation",null,i,n)),Xs.setGroup$$module$build$src$core$events$utils(e)}}getWorkspace(){return this.miniWorkspaceBubble?.getWorkspace()}},Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE=Lu.MUTATOR,Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.WEIGHT=1;Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon;var Ed=Object.create(null),bd={allExtensions:Ed};Xs.register$$module$build$src$core$extensions("parent_tooltip_when_inline",ko);var Od,vd={TEST_ONLY:bd};vd.apply=To,vd.buildTooltipForDropdown=Xs.buildTooltipForDropdown$$module$build$src$core$extensions,vd.buildTooltipWithFieldText=Xs.buildTooltipWithFieldText$$module$build$src$core$extensions,vd.isRegistered=mo,vd.register=Xs.register$$module$build$src$core$extensions,vd.registerMixin=Xs.registerMixin$$module$build$src$core$extensions,vd.registerMutator=Xs.registerMutator$$module$build$src$core$extensions,vd.runAfterPageLoad=Ro,vd.unregister=go,function(e){e[e.WIN_KEY_FF_LINUX=0]="WIN_KEY_FF_LINUX",e[e.MAC_ENTER=3]="MAC_ENTER",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.NUM_CENTER=12]="NUM_CENTER",e[e.ENTER=13]="ENTE
3R",e[e.SHIFT=16]="SHIFT",e[e.CTRL=17]="CTRL",e[e.ALT=18]="ALT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESC=27]="ESC",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.LEFT=37]="LEFT",e[e.UP=38]="UP",e[e.RIGHT=39]="RIGHT",e[e.DOWN=40]="DOWN",e[e.PLUS_SIGN=43]="PLUS_SIGN",e[e.PRINT_SCREEN=44]="PRINT_SCREEN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.ZERO=48]="ZERO",e[e.ONE=49]="ONE",e[e.TWO=50]="TWO",e[e.THREE=51]="THREE",e[e.FOUR=52]="FOUR",e[e.FIVE=53]="FIVE",e[e.SIX=54]="SIX",e[e.SEVEN=55]="SEVEN",e[e.EIGHT=56]="EIGHT",e[e.NINE=57]="NINE",e[e.FF_SEMICOLON=59]="FF_SEMICOLON",e[e.FF_EQUALS=61]="FF_EQUALS",e[e.FF_DASH=173]="FF_DASH",e[e.FF_HASH=163]="FF_HASH",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.AT_SIGN=64]="AT_SIGN",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.META=91]="META",e[e.WIN_KEY_RIGHT=92]="WIN_KEY_RIGHT",e[e.CONTEXT_MENU=93]="CONTEXT_MENU",e[e.NUM_ZERO=96]="NUM_ZERO",e[e.NUM_ONE=97]="NUM_ONE",e[e.NUM_TWO=98]="NUM_TWO",e[e.NUM_THREE=99]="NUM_THREE",e[e.NUM_FOUR=100]="NUM_FOUR",e[e.NUM_FIVE=101]="NUM_FIVE",e[e.NUM_SIX=102]="NUM_SIX",e[e.NUM_SEVEN=103]="NUM_SEVEN",e[e.NUM_EIGHT=104]="NUM_EIGHT",e[e.NUM_NINE=105]="NUM_NINE",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_MINUS=109]="NUM_MINUS",e[e.NUM_PERIOD=110]="NUM_PERIOD",e[e.NUM_DIVISION=111]="NUM_DIVISION",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUMLOCK=144]="NUMLOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.FIRST_MEDIA_KEY=166]="FIRST_MEDIA_KEY",e[e.LAST_MEDIA_KEY=183]="LAST_MEDIA_KEY",e[e.SEMICOLON=186]="SEMICOLON",e[e.DASH=189]="DASH",e[e.EQUALS=187]="EQUALS",e[e.COMMA=188]="COMMA",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.APOSTROPHE=192]="APOSTROPHE",e[e.TILDE=192]="TILDE",e[e.SINGLE_QUOTE=222]="SINGLE_QUOTE",e[e.OPEN_SQUARE_BRACKET=219]="OPEN_SQUARE_BRACKET",e[e.BACKSLASH=220]="BACKSLASH",e[e.CLOSE_SQUARE_BRACKET=221]="CLOSE_SQUARE_BRACKET",e[e.WIN_KEY=224]="WIN_KEY",e[e.MAC_FF_META=224]="MAC_FF_META",e[e.MAC_WK_CMD_LEFT=91]="MAC_WK_CMD_LEFT",e[e.MAC_WK_CMD_RIGHT=93]="MAC_WK_CMD_RIGHT",e[e.WIN_IME=229]="WIN_IME",e[e.VK_NONAME=252]="VK_NONAME",e[e.PHANTOM=255]="PHANTOM",e[e.CTRL_CMD=el||Za||Ja?e.MAC_WK_CMD_LEFT:e.CTRL]="CTRL_CMD"}(Od||={});var Id={};Id.arc=Do,Id.curve=Lo,Id.line=Mo,Id.lineOnAxis=xo,Id.lineTo=$o,Id.moveBy=wo,Id.moveTo=No,Id.point=Ao;var Sd={};Sd.Coordinate=Jl,Sd.KeyCodes=Od,Sd.Rect=ec,Sd.Size=tc,Sd.Svg=Zl,Sd.aria=Bc,Sd.array=Wl,Sd.browserEvents=rl,Sd.colour=bh,Sd.deprecation=mu,Sd.dom=Rl,Sd.extensions=vd,Sd.idGenerator=ul,Sd.math=$u,Sd.object=Nl,Sd.parsing=Oh,Sd.string=Zu,Sd.style=nc,Sd.svgMath=sc,Sd.svgPaths=Id,Sd.toolbox=Ic,Sd.userAgent=il,Sd.xml=gc;var yd=class extends md{constructor(e,t,i,n){super(e,t,i,void 0,n),this.workspace=e,this.anchor=t,this.ownerRect=i,this.owner=n,this.resizePointerMoveListener=this.resizePointerUpListener=null,this.sizeChangeListeners=[],this.locationChangeListeners=[],this.DEFAULT_SIZE=new tc(160+md.DOUBLE_BORDER,80+md.DOUBLE_BORDER),this.MIN_SIZE=new tc(45+md.DOUBLE_BORDER,20+md.DOUBLE_BORDER),this.editable=!0,f(this.svgRoot,"blocklyTextInputBubble"),this.editor=new qh(e,this.id,()=>{Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this)}),this.contentContainer.appendChild(this.editor.getDom()),this.resizeGroup=this.createResizeHandle(this.svgRoot,e),this.setSize(this.DEFAULT_SIZE,!0)}getText(){return this.editor.getText()}setText(e){this.editor.setText(e)}setEditable(e){this.editable=e,this.editor.setEditable(e)}isEditable(){return this.editable}addTextChangeListener(e){this.editor.addTextChangeListener(e)}addSizeChangeListener(e){this.sizeChangeListeners.push(e)}addLocationChangeListener(e){this.locationChangeListeners.push(e)}createResizeHandle(e,t){return e=p(Zl.IMAGE,{class:"blocklyResizeHandle",href:`${t.options.pathToMedia}resize-handle.svg`},e),aa(e,"pointerdown",this,this.onResizePointerDown),e}setSize(e,t=!1){e.width=Math.max(e.width,this.MIN_SIZE.width),e.height=Math.max(e.height,this.MIN_SIZE.height);let i=e.width-md.DOUBLE_BORDER,n=e.height-md.DOUBLE_BORDER;this.editor.updateSize(new tc(i,n),new tc(0,0)),this.editor.getDom().setAttribute("x",""+md.DOUBLE_BORDER/2),this.editor.getDom().setAttribute("y",""+md.DOUBLE_BORDER/2),this.resizeGroup.setAttribute("y",`${n}`),this.workspace.RTL?this.resizeGroup.setAttribute("x",""+-md.DOUBLE_BORDER):this.resizeGroup.setAttribute("x",`${i}`),super.setSize(e,t),this.onSizeChange()}getSize(){return super.getSize()}moveDuringDrag(e){super.moveDuringDrag(e),this.onLocationChange()}setPositionRelativeToAnchor(e,t){super.setPositionRelativeToAnchor(e,t),this.onLocationChange()}positionByRect(e=new ec(0,0,0,0)){super.positionByRect(e),this.onLocationChange()}onResizePointerDown(e){this.bringToFront(),ha(e)||(xn(this.workspace,e,new Jl(this.workspace.RTL?-this.getSize().width:this.getSize().width,this.get
3Size().height)),this.resizePointerUpListener=aa(document,"pointerup",this,this.onResizePointerUp),this.resizePointerMoveListener=aa(document,"pointermove",this,this.onResizePointerMove),this.workspace.hideChaff()),e.stopPropagation()}onResizePointerUp(e){na(),this.resizePointerUpListener&&=(ca(this.resizePointerUpListener),null),this.resizePointerMoveListener&&=(ca(this.resizePointerMoveListener),null)}onResizePointerMove(e){e=Dn(this.workspace,e),this.setSize(new tc(this.workspace.RTL?-e.x:e.x,e.y),!1),this.onSizeChange()}onSizeChange(){for(let e of this.sizeChangeListeners)e()}onLocationChange(){for(let e of this.locationChangeListeners)e()}getEditor(){return this.editor}};Y("\n.blocklyTextInputBubble .blocklyTextarea {\n background-color: var(--commentFillColour);\n border: 0;\n box-sizing: border-box;\n display: block;\n outline: 0;\n padding: 5px;\n resize: none;\n width: 100%;\n height: 100%;\n}\n");var Rd;!function(e){e[e.INPUT_VALUE=1]="INPUT_VALUE",e[e.OUTPUT_VALUE=2]="OUTPUT_VALUE",e[e.NEXT_STATEMENT=3]="NEXT_STATEMENT",e[e.PREVIOUS_STATEMENT=4]="PREVIOUS_STATEMENT"}(Rd||={});var Cd=class{constructor(e){this.connectionChecker=e,this.connections=[]}addConnection(e,t){t=this.calculateIndexForYPos(t),this.connections.splice(t,0,e)}findIndexOfConnection(e,t){if(!this.connections.length)return-1;let i=this.calculateIndexForYPos(t);if(i>=this.connections.length)return-1;t=e.y;let n=i;for(;n>=0&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n--}for(n=i;n<this.connections.length&&this.connections[n].y===t;){if(this.connections[n]===e)return n;n++}return-1}calculateIndexForYPos(e){if(!this.connections.length)return 0;let t=0,i=this.connections.length;for(;t<i;){let n=Math.floor((t+i)/2);if(this.connections[n].y<e)t=n+1;else{if(!(this.connections[n].y>e)){t=n;break}i=n}}return t}removeConnection(e,t){if(-1===(e=this.findIndexOfConnection(e,t)))throw Error("Unable to find connection in connectionDB.");this.connections.splice(e,1)}getNeighbours(e,t){function i(e){let i=o-n[e].x,s=r-n[e].y;return Math.sqrt(i*i+s*s)<=t&&l.push(n[e]),s<t}let n=this.connections,o=e.x,r=e.y;e=0;let s=n.length-2,a=s;for(;e<a;)n[a].y<r?e=a:s=a,a=Math.floor((e+s)/2);let l=[];if(s=e=a,n.length){for(;e>=0&&i(e);)e--;do{s++}while(s<n.length&&i(s))}return l}isInYRange(e,t,i){return Math.abs(this.connections[e].y-t)<=i}searchForClosest(e,t,i){if(!this.connections.length)return{connection:null,radius:t};let n=e.y,o=e.x;e.x=o+i.x,e.y=n+i.y;var r=this.calculateIndexForYPos(e.y);i=null;let s,a=t,l=r-1;for(;l>=0&&this.isInYRange(l,e.y,t);)s=this.connections[l],this.connectionChecker.canConnect(e,s,!0,a)&&(i=s,a=s.distanceFrom(e)),l--;for(;r<this.connections.length&&this.isInYRange(r,e.y,t);)s=this.connections[r],this.connectionChecker.canConnect(e,s,!0,a)&&(i=s,a=s.distanceFrom(e)),r++;return e.x=o,e.y=n,{connection:i,radius:a}}static init(e){let t=[];return t[Rd.INPUT_VALUE]=new Cd(e),t[Rd.OUTPUT_VALUE]=new Cd(e),t[Rd.NEXT_STATEMENT]=new Cd(e),t[Rd.PREVIOUS_STATEMENT]=new Cd(e),t}},kd=class extends Hl{constructor(e,t,i){super(i),this.type=ja.SELECTED,this.oldElementId=e??void 0,this.newElementId=t??void 0}toJson(){let e=super.toJson();return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new kd)).oldElementId=e.oldElementId,t.newElementId=e.newElementId,t}};zs(ka.EVENT,ja.SELECTED,kd);var Ad=class extends Nu{constructor(e){if(super(e),this.type=ja.BLOCK_DELETE,e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=Un(e),this.ids=c(e),this.wasShadow=e.isShadow(),this.oldJson=Rt(e,{addCoordinates:!0})}}toJson(){let e=super.toJson();if(!this.oldXml)throw Error("The old block XML is undefined. Either pass a block to the constructor, or call fromJson");if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(void 0===this.wasShadow)throw Error("Whether the block was a shadow is undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.oldXml=Xn(this.oldXml),e.ids=this.ids,e.wasShadow=this.wasShadow,e.oldJson=this.oldJson,this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return(t=Nu.fromJson(e,t,i??new Ad)).oldXml=Xs.textToDom$$module$build$src$core$utils$xml(e.oldXml),t.ids=e.ids,t.wasShadow=e.wasShadow||"shadow"===t.oldXml.tagName.toLowerCase(),t.oldJson=e.oldJson,void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}run(e){let t=this.getEventWorkspace_();if(!this.ids)throw Error("The block IDs are undefined. Either pass a block to the constructor, or call fromJson");if(!this.oldJson)throw Error("The old block JSON is undefined. Either pass a block to the constructor, or call fromJson");if(e)for(e=0;e<this.ids.length;e++){let i=this.ids[e],n=t.getBlockById(i);n?n.dispose(!1):i===this.blockId&&console.warn("Can't delete non-existent block: "+i)}else xt(this.oldJson,t)}};zs(ka.EVENT,ja.BLOCK_DELETE,Ad);
3var Ld=class{constructor(e,t){if(this.type=t,this.targetConnection=null,this.disposed=!1,this.shadowDom=this.check=null,this.y=this.x=0,this.shadowState=null,this.sourceBlock_=e,e.id.includes("_connection"))throw Error(`Connection ID indicator is contained in block ID. This will cause problems with focus: ${e.id}.`);this.id=`${e.id}_connection_${fa()}`}connect_(e){let i=Rd.INPUT_VALUE,n=this.getSourceBlock();var o=e.getSourceBlock();let r,s;if(e.isConnected()&&e.disconnectInternal(!1),this.isConnected()){let e=this.stashShadowState(),t=this.targetBlock();t.isShadow()?t.dispose(!1):(this.disconnectInternal(),r=t),this.applyShadowState(e)}a()&&(s=new(h(ja.BLOCK_MOVE))(o),s.setReason(["connect"])),Po(this,e),o.setParent(n),s&&(s.recordNew(),t(s)),r&&(e=this.type===i?r.outputConnection:r.previousConnection)&&((o=Ld.getConnectionForOrphanedConnection(o,e))?e.connect(o):e.onFailedConnect(this))}dispose(){if(this.isConnected()){this.isSuperior()&&this.setShadowStateInternal();let e=this.targetBlock();e&&!e.isDeadOrDying()&&e.unplug()}this.disposed=!0}getSourceBlock(){return this.sourceBlock_}isSuperior(){return this.type===Rd.INPUT_VALUE||this.type===Rd.NEXT_STATEMENT}isConnected(){return!!this.targetConnection}getConnectionChecker(){return this.sourceBlock_.workspace.connectionChecker}onFailedConnect(e){}connect(e){if(this.targetConnection===e)return!0;if(this.getConnectionChecker().canConnect(this,e,!1)){let t=Xs.getGroup$$module$build$src$core$events$utils();t||Xs.setGroup$$module$build$src$core$events$utils(!0),this.isSuperior(
3)?this.connect_(e):e.connect_(this),Xs.setGroup$$module$build$src$core$events$utils(t)}return this.isConnected()}disconnect(){this.disconnectInternal()}disconnectInternal(e=!0){let{parentConnection:i,childConnection:n}=this.getParentAndChildConnections();if(!i||!n)throw Error("Source connection not connected.");let o,r=Xs.getGroup$$module$build$src$core$events$utils();r||Xs.setGroup$$module$build$src$core$events$utils(!0),a()&&(o=new(h(ja.BLOCK_MOVE))(n.getSourceBlock()),o.setReason(["disconnect"]));let s=this.targetConnection;s&&(s.targetConnection=null),this.targetConnection=null,e&&n.getSourceBlock().setParent(null),o&&(o.recordNew(),t(o)),n.getSourceBlock().isShadow()||i.respawnShadow_(),Xs.setGroup$$module$build$src$core$events$utils(r)}getParentAndChildConnections(){return this.targetConnection?this.isSuperior()?{parentConnection:this,childConnection:this.targetConnection}:{parentConnection:this.targetConnection,childConnection:this}:{}}respawnShadow_(){this.createShadowBlock(!0)}reconnect(e,t){return!this.getSourceBlock().isDeadOrDying()&&(t=e.getInput(t)?.connection,!((i=this.targetBlock())&&i!==e||!t||t.targetConnection===this)&&(t.isConnected()&&t.disconnect(),t.connect(this),!0));var i}targetBlock(){return this.isConnected()?this.targetConnection?.getSourceBlock()??null:null}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior(
3)?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return e?(Array.isArray(e)||(e=[e]),this.check=e,this.onCheckChanged_()):this.check=null,this}getCheck(){return this.check}setShadowDom(e){this.setShadowStateInternal({shadowDom:e})}getShadowDom(e){return e&&this.targetBlock().isShadow()?Gn(this.targetBlock()):this.shadowDom}setShadowState(e){this.setShadowStateInternal({shadowState:e})}getShadowState(e){return e&&this.targetBlock()&&this.targetBlock().isShadow()?Rt(this.targetBlock()):this.shadowState}neighbours(e){return[]}getParentInput(){let e=null,t=this.sourceBlock_.inputList;for(let i=0;i<t.length;i++)if(t[i].connection===this){e=t[i];break}return e}toString(){let e=this.sourceBlock_;if(!e)return"Orphan Connection";if(e.outputConnection===this)var t="Output Connection of ";else if(e.previousConnection===this)t="Previous Connection of ";else if(e.nextConnection===this)t="Next Connection of ";else{t=null;for(let i,n=0;i=e.inputList[n];n++)if(i.connection===this){t=i;break}if(!t)return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection";t='Input "'+t.name+'" connection on '}return t+e.toDevString()}stashShadowState(){let e=this.getShadowDom(!0),t=this.getShadowState(!0);return this.shadowState=this.shadowDom=null,{shadowDom:e,shadowState:t}}applyShadowState({shadowDom:e,shadowState:t}){this.shadowDom=e,this.shadowState=t}setShadowStateInternal({shadowDom:e=null,shadowState:t=null}={}){this.shadowDom=e,this.shadowState=t,this.getSourceBlock().isDeadOrDying()||((e=this.targetBlock())?e.isShadow()?(e.dispose(!1),this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())):(e=this.createShadowBlock(!1),this.serializeShadow(e),e&&e.dispose(!1)):(this.respawnShadow_(),this.targetBlock()&&this.targetBlock().isShadow()&&this.serializeShadow(this.targetBlock())))}createShadowBlock(e){var t=this.getSourceBlock();let i=this.getShadowState(),n=this.getShadowDom();if(t.isDeadOrDying()||!i&&!n)return null;if(i)return Dt(i,t.workspace,{parentConnection:e?this:void 0,isShadow:!0,recordUndo:!1});if(n){if(t=Kn(n,t.workspace),e)if(this.type===Rd.INPUT_VALUE){if(!t.outputConnection)throw Error("Shadow block is missing an output connection");if(!this.connect(t.outputConnection))throw Error("Could not connect shadow block to connection")}else{if(this.type!==Rd.NEXT_STATEMENT)throw Error("Cannot connect a shadow block to a previous/output connection");if(!t.previousConnection)throw Error("Shadow block is missing previous connection");if(!this.connect(t.previousConnection))throw Error("Could not connect shadow block to connection")}return t}return null}serializeShadow(e){e&&(this.shadowDom=Gn(e),this.shadowState=Rt(e))}static getConnectionForOrphanedConnection(e,t){if(t.type===Rd.OUTPUT_VALUE)return Bo(e,t.getSourceBlock());e=e.lastConnectionInStack(!0);let i=t.getConnectionChecker();return e&&i.canConnect(t,e,!1)?e:null}};Ld.CAN_CONNECT=0,Ld.REASON_SELF_CONNECTION=1,Ld.REASON_WRONG_TYPE=2,Ld.REASON_TARGET_NULL=3,Ld.REASON_CHECKS_FAILED=4,Ld.REASON_DIFFERENT_WORKSPACES=5,Ld.REASON_SHADOW_PARENT=6,Ld.REASON_DRAG_CHECKS_FAILED=7,Ld.REASON_PREVIOUS_AND_OUTPUT=8;var Nd=class extends Error{constructor(e){super(`Tried to append an icon of type ${e.getType()} when an icon of that type already exists on the block. Use getIcon to access the existing icon.`),this.icon=e}},wd={};wd.DuplicateIconType=Nd,function(e){e[e.LEFT=-1]="LEFT",e[e.CENTRE=0]="CENTRE",e[e.RIGHT=1]="RIGHT"}(Xs.Align$$module$build$src$core$inputs$align||={});Xs.Align$$module$build$src$core$inputs$align;var $d=class extends vh{constructor(e,t,i){super(vh.SKIP_SETUP),this.class=null,this.EDITABLE=!1,this.maxDisplayLength=1/0,e!==vh.SKIP_SETUP&&(i?this.configure_(i):this.class=t||null,this.setValue(e))}configure_(e){super.configure_(e),e.class&&(this.class=e.class)}initView(){this.createTextElement_(),this.class&&f(this.getTextElement(),this.class),this.fieldGroup_&&f(this.fieldGroup_,"blocklyLabelField")}doClassValidation_(e){return null==e?null:`${e}`}setClass(e){this.textElement_&&(this.class&&m(this.textElement_,this.class),e&&f(this.textElement_,e)),this.class=e}static fromJson(e){return new this(an(e.text),void 0,e)}};uo("field_label",$d),$d.prototype.DEFAULT_VALUE="";var Md=[];Md[Rd.INPUT_VALUE]=Rd.OUTPUT_VALUE,Md[Rd.OUTPUT_VALUE]=Rd.INPUT_VALUE,Md[Rd.NEXT_STATEMENT]=Rd.PREVIOUS_STATEMENT,Md[Rd.PREVIOUS_STATEMENT]=Rd.NEXT_STATEMENT;var xd="RENAME_VARIABLE_ID",Dd="DELETE_VARIABLE_ID",Pd=class extends Ld{constructor(e,t){super(e,t),this.highlighted=!1,this.targetConnection=null,this.db=e.workspace.connectionDBList[t],this.dbOpposite=e.workspace.connectionDBList[Md[t]],this.offsetInBlock=new Jl(0,0),this.trackedState=Pd.TrackedState.WILL_TRACK}dispose(){let e,t;super.dispose(),this.trackedState===Pd.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),null==(t=(e=this.sourceBlock_.pathObject).removeConnectionHighlight)||t.call(e,this)}getSourceBlock(){return super.getSourceBlock()}targetBlock(){return super.targetBlock()}distanceFrom(e){let t=this.x-e.x;return e=this.y-e.y,Math.sqrt(t*t+e*e)}bumpAwayFrom(e,t=!1){if(!this.sourceBlock_.workspace.isDragging()){var i=Xs.config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),n=Xs.
3config$$module$build$src$core$config.snapRadius+Math.floor(10*Math.random()),o=e.sourceBlock_.getRootBlock(),r=this.sourceBlock_.getRootBlock();if(!o.isInFlyout&&!r.isInFlyout){var s=!0;if(r.isMovable())o.isMovable()&&t&&(n=-n);else{if(!o.isMovable())return;s=!1,i=-i,n=-n}t=s?e:this,e=s?this:e,(o=s?r:o).RTL&&(i=-i),o.moveBy(t.x+i-e.x,t.y+n-e.y,["bump"])}}}moveTo(e,t){let i=!1;return this.trackedState===Pd.TrackedState.WILL_TRACK?(this.db.addConnection(this,t),this.trackedState=Pd.TrackedState.TRACKED,i=!0):this.trackedState===Pd.TrackedState.TRACKED&&(this.db.removeConnection(this,this.y),this.db.addConnection(this,t),i=!0),this.x=e,this.y=t,i}moveBy(e,t){return this.moveTo(this.x+e,this.y+t)}moveToOffset(e){return this.moveTo(e.x+this.offsetInBlock.x,e.y+this.offsetInBlock.y)}setOffsetInBlock(e,t){this.offsetInBlock.x=e,this.offsetInBlock.y=t}getOffsetInBlock(){return this.offsetInBlock}tightenEfficiently(){var e=this.targetConnection;let t=this.targetBlock();e&&t&&(e=Jl.difference(this.offsetInBlock,e.offsetInBlock),t.translate(e.x,e.y))}closest(e,t){return this.dbOpposite.searchForClosest(this,e,t)}highlight(){this.highlighted=!0;let e=this.findHighlightSvg();e&&(e.style.display="")}unhighlight(){this.highlighted=!1;let e=this.findHighlightSvg();e&&(e.style.display="none")}isHighlighted(){return this.highlighted}setTracking(e){e&&this.trackedState===Pd.TrackedState.TRACKED||!e&&this.trackedState===Pd.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db.addConnection(this,this.y),this.trackedState=Pd.TrackedState.TRACKED):(this.trackedState===Pd.TrackedState.TRACKED&&this.db.removeConnection(this,this.y),this.trackedState=Pd.TrackedState.UNTRACKED))}stopTrackingAll(){if(this.setTracking(!1),this.targetConnection){let e=this.targetBlock().getDescendants(!1);for(let t=0;t<e.length;t++){let i=e[t],n=i.getConnections_(!0);for(let e=0;e<n.length;e++)n[e].setTracking(!1);for(let e of i.getIcons())Qt(e)&&e.setBubbleVisible(!1)}}}startTrackingAll(){this.setTracking(!0);let e=[];
3if(this.type!==Rd.INPUT_VALUE&&this.type!==Rd.NEXT_STATEMENT)return e;let t=this.targetBlock();if(t){let i;t.isCollapsed()?(i=[],t.outputConnection&&i.push(t.outputConnection),t.nextConnection&&i.push(t.nextConnection),t.previousConnection&&i.push(t.previousConnection)):i=t.getConnections_(!0);for(let t=0;t<i.length;t++)e.push(...i[t].startTrackingAll());e.length||(e=[t])}return e}onFailedConnect(t){let i=this.getSourceBlock();if(e()){let e=Xs.getGroup$$module$build$src$core$events$utils();setTimeout(function(){i.isDisposed()||i.getParent()||(Xs.setGroup$$module$build$src$core$events$utils(e),this.bumpAwayFrom(t),Xs.setGroup$$module$build$src$core$events$utils(!1))}.bind(this),Xs.config$$module$build$src$core$config.bumpDelay)}}disconnectInternal(e=!0){let{parentConnection:t,childConnection:i}=this.getParentAndChildConnections();if(t&&i){var n=Xs.getGroup$$module$build$src$core$events$utils();n||Xs.setGroup$$module$build$src$core$events$utils(!0);var o=t.getSourceBlock(),r=i.getSourceBlock();super.disconnectInternal(e),o.queueRender(),r.updateDisabled(),r.queueRender(),r.getSvgRoot().style.display="block",Xs.setGroup$$module$build$src$core$events$utils(n)}}respawnShadow_(){super.respawnShadow_();let e=this.targetBlock();e&&(e.initSvg(),e.queueRender())}neighbours(e){return this.dbOpposite.getNeighbours(this,e)}connect_(e){super.connect_(e);var t=this.getSourceBlock();e=e.getSourceBlock(),t.updateDisabled(),e.updateDisabled(),e.queueRender(),(t=t.getInputWithBlock(e))&&(t=t.isVisible(),e.getSvgRoot().style.display=t?"block":"none")}onCheckChanged_(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior(
3)?this.targetBlock():this.sourceBlock_).unplug()}setCheck(e){return super.setCheck(e),this.sourceBlock_.queueRender(),this}showContextMenu(e){let t=Fh.registry.getContextMenuOptions({focusedNode:this},e);if(t.length){var i=this.getSourceBlock(),n=i.workspace;if(e instanceof PointerEvent)var o=new Jl(e.clientX,e.clientY);else o=new Jl(this.x,this.y),o=ue(n,o).translate(i.RTL?-5:5,5);Rn(e,t,i.RTL,n,o)}}getFocusableElement(){let e=this.findHighlightSvg();if(e)return e;throw Error("No highlight SVG found corresponding to this connection.")}getFocusableTree(){return this.getSourceBlock().workspace}onNodeFocus(){this.highlight(),this.getSourceBlock().workspace.scrollBoundsIntoView(this.getSourceBlock().getBoundingRectangleWithoutChildren())}onNodeBlur(){this.unhighlight()}canBeFocused(){return!0}findHighlightSvg(){return document.getElementById(this.id)}};!function(e){(e=e.TrackedState||={})[e.WILL_TRACK=-1]="WILL_TRACK",e[e.UNTRACKED=0]="UNTRACKED",e[e.TRACKED=1]="TRACKED"}(Pd||={});var Fd=Pd.TrackedState,Bd={};Bd.RenderedConnection=Pd,Bd.TrackedState=Fd;var Ud=class{constructor(e,t){this.name=e,this.sourceBlock=t,this.fieldRow=[],this.align=Xs.Align$$module$build$src$core$inputs$align.LEFT,this.visible=!0,this.type=Xs.inputTypes$$module$build$src$core$inputs$input_types.CUSTOM,this.connection=null}getSourceBlock(){return this.sourceBlock}appendField(e,t){return this.insertFieldAt(this.fieldRow.length,e,t),this}insertFieldAt(e,t,i){if(e<0||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return t||""===t&&i?("string"==typeof t&&(t=Xs.fromJson$$module$build$src$core$field_registry({type:"field_label",text:t})),t.setSourceBlock(this.sourceBlock),this.sourceBlock.initialized&&this.initField(t),t.name=i,t.setVisible(this.isVisible()),t.prefixField&&(e=this.insertFieldAt(e,t.prefixField)),this.fieldRow.splice(e,0,t),e++,t.suffixField&&(e=this.insertFieldAt(e,t.suffixField)),this.sourceBlock.rendered&&this.sourceBlock.queueRender(),e):e}removeField(e,t){for(let i,n=0;i=this.fieldRow[n];n++)if(i.name===e)return i.dispose(),this.fieldRow.splice(n,1),this.sourceBlock.rendered&&this.sourceBlock.queueRender(),!0;if(t)return!1;throw Error('Field "'+e+'" not found.')}isVisible(){return this.visible}setVisible(e){let t=[];if(this.visible===e)return t;this.visible=e;for(let i,n=0;i=this.fieldRow[n];n++)i.setVisible(e);if(this.connection&&this.connection instanceof Pd){e?t=this.connection.startTrackingAll():this.connection.stopTrackingAll();let i=this.connection.targetBlock();i&&(i.getSvgRoot().style.display=e?"block":"none")}return t}markDirty(){for(let e,t=0;e=this.fieldRow[t];t++)e.markDirty()}setCheck(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(e),this}setAlign(e){return this.align=e,this.sourceBlock.rendered&&this.sourceBlock.queueRender(),this}setShadowDom(e){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(e),this}getShadowDom(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()}init(){for(let e of this.fieldRow)e.init()}initModel(){for(let e of this.fieldRow)e.initModel()}initField(e){this.sourceBlock.rendered?e.init():e.initModel()}dispose(){for(let e,t=0;e=this.fieldRow[t];t++)e.dispose();this.connection&&this.connection.dispose()}makeConnection(e){return this.sourceBlock.makeConnection_(e)}},Hd=class extends Ud{constructor(e,t){super(e,t),this.name=e,this.type=Xs.inputTypes$$module$build$src$core$inputs$input_types.DUMMY}},Vd=class extends Ud{constructor(e,t){super(e,t),this.name=e,this.type=Xs.inputTypes$$module$build$src$core$inputs$input_types.END_ROW}},Gd=class extends Ud{constructor(e,t){if(!e)throw Error("Statement inputs must have a non-empty name");super(e,t),this.name=e,this.type=Xs.inputTypes$$module$build$src$core$inputs$input_types.STATEMENT,this.connection=this.makeConnection(Rd.NEXT_STATEMENT)}};Xs.ValueInput$$module$build$src$core$inputs$value_input=class extends Ud{constructor(e,t){if(!e)throw Error("Value inputs must have a non-empty name");super(e,t),this.name=e,this.type=Xs.inputTypes$$module$build$src$core$input
3s$input_types.VALUE,this.connection=this.makeConnection(Rd.INPUT_VALUE)}},Xs.ValueInput$$module$build$src$core$inputs$value_input;var Wd=class{constructor(e,t,i){if(this.data=null,this.disposed=!1,this.hue=null,this.colour_="#000000",this.styleName_="",this.suppressPrefixSuffix=!1,this.previousConnection=this.nextConnection=this.outputConnection=null,this.inputList=[],this.icons=[],this.disabledReasons=new Set,this.tooltip="",this.contextMenu=!0,this.parentBlock_=null,this.childBlocks_=[],this.editable=this.movable=this.deletable=!0,this.collapsed_=this.shadow=!1,this.outputShape_=null,this.rendered=this.isInsertionMarker_=this.initialized=this.disposing=!1,this.onchangeWrapper=this.helpUrl=null,this.statementInputCount=0,this.workspace=e,this.id=i&&!e.getBlockById(i)?i:ga(),e.setBlockById(this.id,this),this.xy=new Jl(0,0),this.isInFlyout=e.isFlyout,this.isInMutator=e.isMutator,this.RTL=e.RTL,t){if(this.type=t,!(i=Ua[t])||"object"!=typeof i)throw TypeError("Invalid block definition for type: "+t);Object.assign(this,i)}e.addTopBlock(this),e.addTypedBlock(this),new.target===Wd&&this.doInit_()}doInit_(){let i=Xs.getGroup$$module$build$src$core$events$utils();i||Xs.setGroup$$module$build$src$core$events$utils(!0);let n=e();try{"function"==typeof this.init&&(Xs.setRecordUndo$$module$build$src$core$events$utils(!1),this.init(),Xs.setRecordUndo$$module$build$src$core$events$utils(n)),a()&&t(new(h(ja.BLOCK_CREATE))(this))}finally{Xs.setGroup$$module$build$src$core$events$utils(i),Xs.setRecordUndo$$module$build$src$core$events$utils(n)}this.inputsInlineDefault=this.inputsInline,"function"==typeof this.onchange&&this.setOnChange(this.onchange)}dispose(e=!1){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.unplug(e),a()&&t(new(h(ja.BLOCK_DELETE))(this)),this.workspace.removeTopBlock(this),this.disposeInternal()}disposeInternal(){this.disposing=!0,this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.workspace.removeTypedBlock(this),this.workspace.removeBlockById(this.id),"function"==typeof this.destroy&&this.destroy(),this.childBlocks_.forEach(e=>e.disposeInternal()),this.inputList.forEach(e=>e.dispose()),this.inputList.length=0,this.getConnections_(!0).forEach(e=>e.dispose()),this.disposed=!0}isDeadOrDying(){return this.disposing||this.disposed}initModel(){if(!this.initialized){for(let e of this.inputList)e.initModel();this.initialized=!0}}unplug(e){this.outputConnection&&this.unplugFromRow(e),this.previousConnection&&this.unplugFromStack(e)}unplugFromRow(e){let t,i=null;null!=(t=this.outputConnection)&&t.isConnected()&&(i=this.outputConnection.targetConnection,this.outputConnection.disconnect()),i&&e&&(e=this.getOnlyValueConnection())&&e.isConnected()&&!e.targetBlock().isShadow()&&(e=e.targetConnection,e?.disconnect(),this.workspace.connectionChecker.canConnect(e,i,!1)?i.connect(e):e?.onFailedConnect(i))}getOnlyValueConnection(){let e=null;for(let t=0;t<this.inputList.length;t++){let i=this.inputList[t].connection;if(i&&i.type===Rd.INPUT_VALUE&&i.targetConnection){if(e)return null;e=i}}return e}unplugFromStack(e){let t,i=null;if(null!=(t=this.previousConnection)&&t.isConnected()&&(i=this.previousConnection.targetConnection,this.previousConnection.disconnect()),e){for(e=this.getNextBlock();e&&(e.isShadow()||!e.isMovable());)e=e.getNextBlock();var n,o;if(e)e=(null==(n=e.previousConnection)||null==(o=n.targetBlock())?void 0:o.nextConnection?.targetConnection)??null,e?.disconnect(),i&&this.workspace.connectionChecker.canConnect(i,e,!1)&&i.connect(e)}}getConnections_(e){e=[],this.outputConnection&&e.push(this.outputConnection),this.previousConnection&&e.push(this.previousConnection),this.nextConnection&&e.push(this.nextConnection);for(let t,i=0;t=this.inputList[i];i++)t.connection&&e.push(t.connection);return e}lastConnectionInStack(e){let t=this.nextConnection;for(;t;){let i=t.targetBlock();if(!i||e&&i.isShadow())return t;t=i.nextConnection}return null}bumpNeighbours(){}getParent(){return this.parentBlock_}getInputWithBlock(e){for(let t,i=0;t=this.inputList[i];i++)if(t.connection&&t.connection.targetBlock()===e)return t;return null}getSurroundParent(){let e,t=this;do{if(e=t,t=t.getParent(),!t)return null}while(t.getNextBlock()===e);return t}getNextBlock(){return this.nextConnection&&this.nextConnection.targetBlock()}getPreviousBlock(){return this.previousConnection&&this.previousConnection.targetBlock()}getRootBlock(){let e,t=this;do{e=t,t=e.parentBlock_}while(t);return e}getTopStackBlock(){let e,t=this;do{e=t.getPreviousBlock()}while(e&&e.getNextBlock()===t&&(t=e));return t}getChildren(e){if(!e)return this.childBlocks_;e=[];for(let i,n=0;i=this.inputList[n];n++)if(i.connection){var t=i.connection.targetBlock();t&&e.push(t)}return(t=this.getNextBlock())&&e.push(t),e}setParent(e){if(e!==this.parentBlock_){var t=this.previousConnection&&this.previousConnection.targetBlock()||this.outputConnection&&this.outputConnection.targetBlock(),i=!!t;if(i&&e&&t!==e)throw Error("Block connected to superior one that is not new parent.");if(!i&&e)throw Error("Block not connected to new parent.");if(i&&!e)throw Error("Cannot set parent to null while block is still connected to superior block.");this.parentBlock_?j(this.parentBlock_.childBlocks_,this):this.workspace.removeTopBlock(this),(this.parentBlock_=e)?e.childBlocks_.push(this):this.workspace.addTopBlock(this)}}getDescendants(e){let t=[this],i=this.getChildren(e);for(let n,o=0;n=i[o];o++)t.push(...n.getDescendants(e));return t}isDeletable(){return this.deletable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnDeletable(){return this.deletable}setDeletable(e){this.deletable=e}isMovable(){return this.movable&&!this.isInFlyout&&!this.shadow&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnMovable(){return this.movable}setMovable(e){this.movable=e}isDuplicatable(){return!this.workspace.hasBlockLimits()||this.workspace.isCapacityAvailable(V(this,!0))}isShadow(){return this.shadow}setShadow(e){this.shadow=e}isInsertionMarker(){return this.isInsertionMarker_}setInsertionMarker(e){this.isInsertionMarker_=e}isEditable(){return this.editable&&!this.isDeadOrDying()&&!this.workspace.isReadOnly()}isOwnEditable(){return this.editable}setEditable(e){this.editable=e;for(let t of this.getFields())t.updateEditable()}isDisposed(){return this.disposed}isSimpleReporter(){if(!this.outputConnection)return!1;for(let e of this.inputList)if(e.connection||e.fieldRow.length>1)return!1;return!0}getMatchingConnection(e,t){let i=this.getConnections_(!0);if(e=e.getConnections_(!0),i.length!==e.length)throw Error("Connection lists did not match in length.");for(let n=0;n<e.length;n++)if(e[n]===t)return i[n];return null}setHelpUrl(e){this.helpUrl=e}setTooltip(e){this.tooltip=e}getTooltip(){return wi(this)}getColour(){return this.colour_}getStyleName(){return this.styleName_}
3getHue(){return this.hue}setColour(e){e=cn(e),this.hue=e.hue,this.colour_=e.hex}setStyle(e){this.styleName_=e}setOnChange(e){if(e&&"function"!=typeof e)throw Error("onchange must be a function.");this.onchangeWrapper&&this.workspace.removeChangeListener(this.onchangeWrapper),this.onchange=e,this.onchangeWrapper=e.bind(this),this.workspace.addChangeListener(this.onchangeWrapper)}getField(e){if("string"!=typeof e)throw TypeError("Block.prototype.getField expects a string with the field name but received "+(void 0===e?"nothing":e+" of type "+typeof e)+" instead");for(let t of this.getFields())if(t.name===e)return t;return null}*getFields(){for(let e of this.inputList)for(let t of e.fieldRow)yield t}getVars(){let e=[];for(let t of this.getFields())t.referencesVariables()&&e.push(t.getValue());return e}getVarModels(){let e=[];for(let t of this.getFields())if(t.referencesVariables()){let i=this.workspace.getVariableMap().getVariableById(t.getValue());i&&e.push(i)}return e}updateVarName(e){for(let t of this.getFields())t.referencesVariables()&&e.getId()===t.getValue()&&t.refreshVariableName()}renameVarById(e,t){for(let i of this.getFields())i.referencesVariables()&&e===i.getValue()&&i.setValue(t)}getFieldValue(e){return(e=this.getField(e))?e.getValue():null}setFieldValue(e,t){let i=this.getField(t);if(!i)throw Error('Field "'+t+'" not found.');i.setValue(e)}setPreviousStatement(e,t){if(e)void 0===t&&(t=null),this.previousConnection||=this.makeConnection_(Rd.PREVIOUS_STATEMENT),this.previousConnection.setCheck(t);else if(this.previousConnection){if(this.previousConnection.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.previousConnection.dispose(),this.previousConnection=null}}setNextStatement(e,t){if(e)void 0===t&&(t=null),this.nextConnection||=this.makeConnection_(Rd.NEXT_STATEMENT),this.nextConnection.setCheck(t);else if(this.nextConnection){if(this.nextConnection.isConnected())throw Error("Must disconnect next statement before removing connection.");this.nextConnection.dispose(),this.nextConnection=null}}setOutput(e,t){if(e)void 0===t&&(t=null),this.outputConnection||=this.makeConnection_(Rd.OUTPUT_VALUE),this.outputConnection.setCheck(t);else if(this.outputConnection){if(this.outputConnection.isConnected())throw Error("Must disconnect output value before removing connection.");this.outputConnection.dispose(),this.outputConnection=null}}setInputsInline(e){this.inputsInline!==e&&(t(new(h(ja.BLOCK_CHANGE))(this,"inline",null,this.inputsInline,e)),this.inputsInline=e)}getInputsInline(){if(void 0!==this.inputsInline)return this.inputsInline;for(var e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof Hd&&this.inputList[e]instanceof Hd)return!1;for(e=1;e<this.inputList.length;e++)if(this.inputList[e-1]instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input&&this.inputList[e]instanceof Hd)return!0;for(e=0;e<this.inputList.length;e++)if(this.inputList[e]instanceof Vd)return!0;return!1}setOutputShape(e){this.outputShape_=e}getOutputShape(){return this.outputShape_}isEnabled(){return 0===this.disabledReasons.size}setDisabledReason(e,i){e||this.workspace.options.disable||!this.hasDisabledReason(Xc)||i==Xc||this.setDisabledReason(!1,Xc),this.disabledReasons.has(i)!==e&&(e?this.disabledReasons.add(i):this.disabledReasons.delete(i),(e=new(h(ja.BLOCK_CHANGE))(this,"disabled",null,!e,e)).setDisabledReason(i),t(e))}getInheritedDisabled(){let e=this.getSurroundParent();for(;e;){if(!e.isEnabled())return!0;e=e.getSurroundParent()}return!1}hasDisabledReason(e){return this.disabledReasons.has(e)}getDisabledReasons(){return this.disabledReasons}isCollapsed(){return this.collapsed_}setCollapsed(e){this.collapsed_!==e&&(t(new(h(ja.BLOCK_CHANGE))(this,"collapsed",null,this.collapsed_,e)),this.collapsed_=e)}toString(e,t){t=this.toTokens(t);for(let n=2;n<t.length;n++)"("===t[n-2]&&")"===t[n]&&(t[n-2]=t[n-1],t.splice(n-1,2));let i="";return t=t.reduce((e,t)=>(e=e+("("===i||")"===t?"":" ")+t,i=t[t.length-1],e),""),t=t.trim()||"???",e&&t.length>e&&(t=t.substring(0,e-3)+"..."),t}toTokens(e="?"){let t=[];for(let n of this.inputList)if(n.name!=Gc){for(let e of n.fieldRow)t.push(e.getText());if(n.connection){let o=n.connection.targetBlock();if(o){var i=n.connection;let r=i.getCheck();!r&&i.targetConnection&&(r=i.targetConnection.getCheck()),(i=!!r&&(r.includes("Boolean")||r.includes("Number")))&&t.pu
3sh("("),t.push(...o.toTokens(e)),i&&t.push(")")}else t.push(e)}}return t}appendValueInput(e){return this.appendInput(new Xs.ValueInput$$module$build$src$core$inputs$value_input(e,this))}appendStatementInput(e){return this.statementInputCount++,this.appendInput(new Gd(e,this))}appendDummyInput(e=""){return this.appendInput(new Hd(e,this))}appendEndRowInput(e=""){return this.appendInput(new Vd(e,this))}appendInput(e){return this.inputList.push(e),e}appendInputFromRegistry(e,t){return(e=qs(ka.INPUT,e,!1))?this.appendInput(new e(t,this)):null}jsonInit(e){var t=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(t+"Must not have both an output and a previousStatement.");for(var i=0;e["args"+i];){if(void 0===e["message"+i])throw Error(t+`args${i} must have a corresponding message (message${i}).`);i++}if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(t+"Must not have both a colour and a style.");for(e.style?this.jsonInitStyle(e,t):this.jsonInitColour(e,t),i=0;void 0!==e["message"+i];)this.interpolate(e["message"+i],e["args"+i]||[],e["implicitAlign"+i]||e["lastDummyAlign"+i],t),i++;if(void 0!==e.inputsInline&&(Xs.disable$$module$build$src$core$events$utils(),this.setInputsInline(e.inputsInline),Xs.enable$$module$build$src$core$events$utils()),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=an(e.tooltip),this.setTooltip(i)),void 0!==e.enableContextMenu&&(this.contextMenu=!!e.enableContextMenu),void 0!==e.suppressPrefixSuffix&&(this.suppressPrefixSuffix=!!e.suppressPrefixSuffix),void 0!==e.helpUrl&&(i=an(e.helpUrl),this.setHelpUrl(i)),"string"==typeof e.extensions&&(console.warn(t+"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&&To(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(t=0;t<e.length;t++)To(e[t],this,!1)}jsonInitColour(e,t){if("colour"in e)if(void 0===e.colour)console.warn(t+"Undefined colour value.");else{e=e.colour;try{this.setColour(e)}catch{console.warn(t+"Illegal colour value: ",e)}}}jsonInitStyle(e,t){e=e.style;try{this.setStyle(e)}catch{console.warn(t+"Style does not exist: ",e)}}mixin(e,t){if(void 0!==t&&"boolean"!=typeof t)throw Error("opt_disableCheck must be a boolean if provided");if(!t){t=[];for(let i in e)void 0!==this[i]&&t.push(i);if(t.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(t))}Object.assign(this,e)}interpolate(e,t,i,n){e=sn(e),this.validateTokens(e,t.length),t=this.interpolateArguments(e,t,i),i=[];for(let o,r=0;o=t[r];r++)if(this.isInputKeyword(o.type)){if(e=this.inputFromJson(o,n)){for(let t,n=0;t=i[n];n++)e.appendField(t[0],t[1]);i.length=0}}else(e=this.fieldFromJson(o))&&i.push([e,o.name])}validateTokens(e,t){let i=[],n=0;for(let o=0;o<e.length;o++){let r=e[o];if("number"==typeof r){if(r<1||r>t)throw Error('Block "'+this.type+'": Message index %'+r+" out of range.");if(i[r])throw Error('Block "'+this.type+'": Message index %'+r+" duplicated.");i[r]=!0,n++}}if(n!==t)throw Error('Block "'+this.type+'": Message does not reference all '+t+" arg(s).")}interpolateArguments(e,t,i){let n=[];for(let r=0;r<e.length;r++){var o=e[r];if("number"==typeof o&&(o=t[o-1]),"string"==typeof o)if("\n"===o)o={type:"input_end_row"},i&&(o.align=i);else if(!(o=this.stringToFieldJson(o)))continue;n.push(o)}return(e=n.length)&&!this.isInputKeyword(n[e-1].type)&&(e={type:"input_dummy"},i&&(e.align=i),n.push(e)),n}fieldFromJson(e){let t=Xs.fromJson$$module$build$src$core$field_registry(e);return!t&&e.alt?"string"==typeof e.alt?(e=this.stringToFieldJson(e.alt))?this.fieldFromJson(e):null:this.fieldFromJson(e.alt):t}inputFromJson(e,t){var i={LEFT:Xs.Align$$module$build$src$core$inputs$align.LEFT,RIGHT:Xs.Align$$module$build$src$core$inputs$align.RIGHT,CENTRE:Xs.Align$$module$build$src$core$input
3s$align.CENTRE,CENTER:Xs.Align$$module$build$src$core$inputs$align.CENTRE};let n;switch(e.type){case"input_value":n=this.appendValueInput(e.name);break;case"input_statement":n=this.appendStatementInput(e.name);break;case"input_dummy":n=this.appendDummyInput(e.name);break;case"input_end_row":n=this.appendEndRowInput(e.name);break;default:n=this.appendInputFromRegistry(e.type,e.name)}return n?(e.check&&n.setCheck(e.check),e.align&&(void 0===(i=i[e.align.toUpperCase()])?console.warn(t+"Illegal align value: ",e.align):n.setAlign(i)),n):null}isInputKeyword(e){return"input_value"===e||"input_statement"===e||"input_dummy"===e||"input_end_row"===e||Ks(ka.INPUT,e)}stringToFieldJson(e){return(e=e.trim())?{type:"field_label",text:e}:null}moveInputBefore(e,t){if(e!==t){var i=-1,n=t?-1:this.inputList.length;for(let o,r=0;o=this.inputList[r];r++)if(o.name===e){if(i=r,-1!==n)break}else if(t&&o.name===t&&(n=r,-1!==i))break;if(-1===i)throw Error('Named input "'+e+'" not found.');if(-1===n)throw Error('Reference input "'+t+'" not found.');this.moveNumberedInputBefore(i,n)}}moveNumberedInputBefore(e,t){if(e===t)throw Error("Can't move input to itself.");if(e>=this.inputList.length)throw RangeError("Input index "+e+" out of bounds.");if(t>this.inputList.length)throw RangeError("Reference input "+t+" out of bounds.");let i=this.inputList[e];this.inputList.splice(e,1),e<t&&t--,this.inputList.splice(t,0,i)}removeInput(e,t){for(let i,n=0;i=this.inputList[n];n++)if(i.name===e)return i instanceof Gd&&this.statementInputCount--,i.dispose(),this.inputList.splice(n,1),!0;if(t)return!1;throw Error("Input not found: "+e)}getInput(e){for(let t,i=0;t=this.inputList[i];i++)if(t.name===e)return t;return null}getInputTargetBlock(e){return(e=this.getInput(e))&&e.connection&&e.connection.targetBlock()}getCommentText(){return this.getIcon(Lu.COMMENT)?.getText()??null}setCommentText(e){var i;let n=(i=this.getIcon(Lu.COMMENT))?.getText()??null;if(n!==e){if(null!==e){if(!(i=this.getIcon(Lu.COMMENT))){if(!(i=qs(ka.ICON,Lu.COMMENT.toString(),!1)))throw Error("No comment icon class is registered, so a comment cannot be set");if(i=new i(this),!Ho(i))throw Error("The class registered as a comment icon does not conform to the ICommentIcon interface");i=this.addIcon(i)}Xs.disable$$module$build$src$core$events$utils(),i.setText(e),Xs.enable$$module$build$src$core$events$utils()}else this.removeIcon(Lu.COMMENT);t(new(h(ja.BLOCK_CHANGE))(this,"comment",null,n,e))}}setWarningText(e,t){}setMutator(e){}addIcon(e){if(this.hasIcon(e.getType()))throw new Nd(e);return this.icons.push(e),this.icons.sort((e,t)=>e.getWeight()-t.getWeight()),e}removeIcon(e){if(!this.hasIcon(e))return!1;let t;return null==(t=this.getIcon(e))||t.dispose(),this.icons=this.icons.filter(t=>!t.getType().equals(e)),!0}hasIcon(e){return this.icons.some(t=>t.getType().equals(e))}getIcon(e){return e instanceof Lu?this.icons.find(t=>t.getType().equals(e)):this.icons.find(t=>t.getType().toString()===e)}getIcons(){return[...this.icons]}getRelativeToSurfaceXY(){return this.xy}moveBy(e,i,n){if(this.parentBlock_)throw Error("Block has parent");let o=new(h(ja.BLOCK_MOVE))(this);n&&o.setReason(n),this.xy.translate(e,i),o.recordNew(),t(o)}makeConnection_(e){return new Ld(this,e)}allInputsFilled(e){if(void 0===e&&(e=!0),!e&&this.isShadow())return!1;for(let i,n=0;i=this.inputList[n];n++)if(i.connection){var t=i.connection.targetBlock();if(!t||!t.allInputsFilled(e))return!1}return!(t=this.getNextBlock())||t.allInputsFilled(e)}toDevString(){let e=this.type?'"'+this.type+'" block':"Block";return this.id&&(e+=' (id="'+this.id+'")'),e}};Wd.COLLAPSED_INPUT_NAME=Gc,Wd.COLLAPSED_FIELD_NAME=Wc;var Xd=null,zd=null,jd={};jd.connectionUiEffect=Wo,jd.disconnectUiEffect=Xo,jd.disconnectUiStop=jo,jd.disposeUiEffect=Vo;var Yd=class{paste(e,i,n){if(!i.isCapacityAvailable(e.typeCounts))return null;let o;n&&(e.blockState.x=n.x,e.blockState.y=n.y),n||=new Jl(e.blockState.x||0,e.blockState.y||0),Xs.disable$$module$build$src$core$events$utils();try{o=xt(e.blockState,i),Yo(o,n)}finally{Xs.enable$$module$build$src$core$events$utils()}if(!o)return o;a()&&!o.isShadow()&&t(new(h(ja.BLOCK_CREATE))(o));let r=o;return Be().then(()=>Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(r)),o}};Yd.TYPE="block",Ne(Yd.TYPE,new Yd);var Qd={};Qd.BlockPaster=Yd,Qd.moveBlockToNotConflict=Yo;var Kd={};Kd.bumpIntoBounds=qo,Kd.bumpIntoBoundsHandler=Jo,Kd.bumpTopObjectsIntoBounds=er;var qd=class{constructor(e){this.block=e,this.connectionPreviewer=this.connectionCandidate=this.startLoc=this.startChildConn=this.startParentConn=null,this.dragging=!1,this.dragOffset=new Jl(0,0),this.originalEventGroup="",this.workspace=e.workspace}isMovable(){return this.block.isShadow()?this.block.getParent()?.isMovable()??!1:this.block.isOwnMovable()&&!this.block.isDeadOrDying()&&!this.workspace.isReadOnly()&&!this.block.isInFlyout}startDrag(e){var t;this.block.isShadow()?this.startDraggingShadow(e):(this.dragging=!0,this.fireDragStartEvent(),this.startLoc=this.block.getRelativeToSurfaceXY(),this.connectionCandidate=null,this.connectionPreviewer=new(ea(ka.CONNECTION_PREVIEWER,this.workspace.options))(this.block),O(),this.workspace.setResizesEnabled(!1),jo(),e=this.shouldHealStack(e),this.shouldDisconnect(e)&&this.disconnectBlock(e),this.block.setDragging(!0),null==(t=this.workspace.getLayerManager())||t.moveToDragLayer(this.block),this.getVisibleBubbles(this.block).forEac
3h(e=>{let t;null==(t=this.workspace.getLayerManager())||t.moveToDragLayer(e,!1)}))}getVisibleBubbles(e){return e.getDescendants(!1).flatMap(e=>e.getIcons()).filter(e=>Qt(e)&&e.bubbleIsVisible()).map(e=>e.getBubble()).filter(e=>!!e).sort((e,t)=>(e=e.getSvgRoot().compareDocumentPosition(t.getSvgRoot()))&Node.DOCUMENT_POSITION_PRECEDING?1:e&Node.DOCUMENT_POSITION_FOLLOWING?-1:0)}shouldHealStack(e){return!!e&&(e.altKey||e.ctrlKey||e.metaKey)}startDraggingShadow(e){let t=this.block.getParent();if(!t)throw Error("Tried to drag a shadow block with no parent. Shadow blocks should always have parents.");this.dragOffset=Jl.difference(t.getRelativeToSurfaceXY(),this.block.getRelativeToSurfaceXY()),t.startDrag(e)}shouldDisconnect(e){return!!(this.block.getParent()||e&&this.block.nextConnection&&this.block.nextConnection.targetBlock())}disconnectBlock(e){this.startParentConn=this.block.outputConnection?.targetConnection??this.block.previousConnection?.targetConnection,e&&(this.startChildConn=this.block.nextConnection?.targetConnection),this.block.unplug(e),Xo(this.block)}fireDragStartEvent(){let e=new(h(ja.BLOCK_DRAG))(this.block,!0,this.block.getDescendants(!1));t(e)}fireDragEndEvent(){let e=new(h(ja.BLOCK_DRAG))(this.block,!1,this.block.getDescendants(!1));t(e)}fireMoveEvent(){if(!this.block.isDeadOrDying()){var e=new(h(ja.BLOCK_MOVE))(this.block);e.setReason(["drag"]),e.oldCoordinate=this.startLoc,e.recordNew(),t(e)}}drag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.drag(Jl.sum(e,this.dragOffset))}else this.block.moveDuringDrag(e),this.updateConnectionPreview(this.block,Jl.difference(e,this.startLoc))}updateConnectionPreview(e,t){var i=this.connectionCandidate;let n=this.getConnectionCandidate(e,t);if(n){this.connectionCandidate=t=i&&this.currCandidateIsBetter(i,t,n)?i:n;var o,{local:r,neighbour:s}=t;if(t=r.type===Rd.OUTPUT_VALUE||r.type===Rd.PREVIOUS_STATEMENT,i=s.isConnected()&&!(null!=(o=s.targetBlock())&&o.isInsertionMarker()),t&&i&&!this.orphanCanConnectAtEnd(e,s.targetBlock(),r.type)){let e;null==(e=this.connectionPreviewer)||e.previewReplacement(r,s,s.targetBlock())}else{var a;null==(a=this.connectionPreviewer)||a.previewConnection(r,s)}}else{let e;null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null}}orphanCanConnectAtEnd(e,t,i){return!!Ld.getConnectionForOrphanedConnection(e,i===Rd.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}currCandidateIsBetter(e,t,i){let{local:n,neighbour:o}=e;e=new Jl(n.x,n.y);let r=new Jl(o.x,o.y);return t=Jl.distance(Jl.sum(e,t),r),i.distance>t-Xs.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(e,t){e=this.getLocalConnections(e);let i=this.getSearchRadius(),n=null;for(let o of e){let{connection:e,radius:r}=o.closest(i,t);e&&(n={local:o,neighbour:e,distance:r},i=r)}return n}getSearchRadius(){return this.connectionCandidate?Xs.config$$module$build$src$core$config.connectingSnapRadius:Xs.config$$module$build$src$core$config.snapRadius}getLocalConnections(e){let t=e.getConnections_(!1),i=e.lastConnectionInStack(!0);return i&&i!==e.nextConnection&&t.push(i),t}endDrag(e){if(this.block.isShadow()){let t;null==(t=this.block.getParent())||t.endDrag(e)}else{var t;if(this.originalEventGroup=Xs.getGroup$$module$build$src$core$events$utils(),this.fireDragEndEvent(),this.fireMoveEvent(),v(),jo(),null==(t=this.connectionPreviewer)||t.hidePreview(),!this.block.isDeadOrDying()&&this.dragging){let e;null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,Hh),this.getVisibleBubbles(this.block).forEach(e=>this.workspace.getLayerManager()?.moveOffDragLayer(e,Vh,!1)),this.block.setDragging(!1)}this.connectionCandidate?(this.applyConnections(this.connectionCandidate),this.disposeStep()):this.block.queueRender().then(()=>this.disposeStep())}}disposeStep(){let e,t=Xs.getGroup$$module$build$src$core$events$utils();Xs.setGroup$$module$build$src$core$events$utils(this.originalEventGroup),this.block.snapToGri
3d(),null==(e=this.connectionPreviewer)||e.dispose(),this.workspace.setResizesEnabled(!0),Xs.setGroup$$module$build$src$core$events$utils(t)}applyConnections(e){let{local:t,neighbour:i}=e;t.connect(i);let n=t.isSuperior()?i:t,o=this.block.getRootBlock();Be().then(()=>{Wo(n.getSourceBlock()),setTimeout(()=>{o.bringToFront()},0)})}revertDrag(){if(this.block.isShadow()){let e;null==(e=this.block.getParent())||e.revertDrag()}else{var e,t;if(null==(e=this.connectionPreviewer)||e.hidePreview(),this.connectionCandidate=null,null==(t=this.startChildConn)||t.connect(this.block.nextConnection),this.startParentConn)switch(this.startParentConn.type){case Rd.INPUT_VALUE:this.startParentConn.connect(this.block.outputConnection);break;case Rd.NEXT_STATEMENT:this.startParentConn.connect(this.block.previousConnection)}else{let e;this.block.moveTo(this.startLoc,["drag"]),null==(e=this.workspace.getLayerManager())||e.moveOffDragLayer(this.block,Hh),this.getVisibleBubbles(this.block).forEach(e=>this.workspace.getLayerManager()?.moveOffDragLayer(e,Vh,!1)),qo(this.workspace,this.workspace.getMetricsManager().getScrollMetrics(!0),this.block)}this.startParentConn=this.startChildConn=null,this.block.setDragging(!1),this.dragging=!1}}},Jd=class extends md{constructor(e,t,i,n){super(t,i,n),this.text=e,this.workspace=t,this.anchor=i,this.ownerRect=n,this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize(),f(this.svgRoot,"blocklyTextBubble")}getText(){return this.text}setText(e){this.text=e,_(this.paragraph),this.paragraph=this.stringToSvg(e,this.contentContainer),this.updateBubbleSize()}stringToSvg(e,t){return t=this.createParagraph(t),e=this.createTextFragments(t,e),this.workspace.RTL&&this.rightAlignTextFragments(t.getBBox().width,e),t}createParagraph(e){return p(Zl.G,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",transform:`translate(0,${md.BORDER_WIDTH})`,style:"direction: "+(this.workspace.RTL?"rtl":"ltr")},e)}createTextFragments(e,t){let i=1;return t.split("\n").map(t=>{let n=p(Zl.TEXT,{y:`${i}em`,x:md.BORDER_WIDTH},e);return t=document.createTextNode(t),n.appendChild(t),i+=1,n})}rightAlignTextFragments(e,t){for(let i of t)i.setAttribute("text-anchor","start"),i.setAttribute("x",`${e+md.BORDER_WIDTH}`)}updateBubbleSize(){let e=this.paragraph.getBBox();this.setSize(new tc(e.width+2*md.BORDER_WIDTH,e.height+2*md.BORDER_WIDTH),!0)}},Zd=class extends _d{constructor(e){super(e),this.sourceBlock=e,this.textMap=new Map,this.textBubble=null}getType(){return Zd.TYPE}initView(e){this.svgRoot||(super.initView(e),p(Zl.PATH,{class:"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},this.svgRoot),p(Zl.PATH,{class:"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},this.svgRoot),p(Zl.RECT,{class:"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},this.svgRoot),f(this.svgRoot,"blocklyWarningIcon"))}dispose(){let e;super.dispose(),null==(e=this.textBubble)||e.dispose()}getWeight(){return Zd.WEIGHT}getSize(){return new tc(17,17)}applyColour(){let e;super.applyColour(),null==(e=this.textBubble)||e.setColour(this.sourceBlock.getColour())}updateCollapsed(){}isShownWhenCollapsed(){return!0}onLocationChange(e){let t;super.onLocationChange(e),null==(t=this.textBubble)||t.setAnchorLocation(this.getAnchorLocation())}addMessage(e,t){if(this.textMap.get(t)===e)return this;let i;return e?this.textMap.set(t,e):this.textMap.delete(t),null==(i=this.textBubble)||i.setText(this.getText()),this}getText(){return[...this.textMap.values()].join("\n")}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}bubbleIsVisible(){return!!this.textBubble}setBubbleVisible(e){let i=this;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){if(i.bubbleIsVisible()!==e){if(yield Be(),e)i.textBubble=new Jd(i.getText(),i.sourceBlock.workspace,i.getAnchorLocation(),i.getBubbleOwnerRect()),i.applyColour();else{let e;null==(e=i.textBubble)||e.dispose(),i.textBubble=null}t(new(h(ja.BUBBLE_OPEN))(i.sourceBlock,e,"warning"))}})}getBubble(){return this.textBubble}getAnchorLocation(){return Jl.sum(this.workspaceLocation,new Jl(8.5,8.5))}getBubbleOwnerRect(){let e=this.sourceBlock.getSvgRoot().getBBox();return new ec(e.y,e.y+e.height,e.x,e.x+e.width)}};Zd.TYPE=Lu.WARNING,Zd.WEIGHT=2;var ep=class extends Wd{constructor(e,t,i){if(super(e,t,i),this.childlessWidth=this.width=this.height=0,this.warningTextDb=new Map,this.mutator=null,this.rendered=!0,this.visuallyDisabled=!1,this.translation="",this.dragging=!1,this.relativeCoords=new Jl(0,0),this.dragStrategy=new qd(this),!e.rendered)throw TypeError("Cannot create a rendered block in a headless workspace");this.workspace=e,this.svgGroup=p(Zl.G,{}),t&&f(this.svgGroup,t),this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup,this.style),(e=this.pathObject.
3svgPath).tooltip=this,xi(e),this.svgGroup.setAttribute("data-id",this.id),e.id=fa(),this.doInit_()}initSvg(){if(!this.initialized){for(var e of this.inputList)e.init();for(let e of this.getIcons())e.initView(this.createIconPointerDownListener(e)),e.updateEditable();this.applyColour(),this.pathObject.updateMovable(this.isMovable()||this.isInFlyout),(e=this.getSvgRoot())&&aa(e,"pointerdown",this,this.onMouseDown),e.parentNode||this.workspace.getCanvas().appendChild(e),this.initialized=!0}}getColourSecondary(){return this.style.colourSecondary}getColourTertiary(){return this.style.colourTertiary}select(){this.addSelect(),F(this)}unselect(){this.removeSelect(),F(null)}setParent(e){var t=this.parentBlock_;if(e!==t){O(),super.setParent(e),v();var i=this.getSvgRoot();if(!this.workspace.isClearing&&i){var n,o=this.getRelativeToSurfaceXY(),r=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),s=this.getSvgRoot().contains((n=r?.getFocusableElement())??null);e?(e.getSvgRoot().appendChild(i),s&&r&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(r)):t&&(e=this.workspace.getCanvas().querySelector(".blocklyDragging"),t=e?.parentElement,t===(n=this.workspace.getCanvas())?n.insertBefore(i,e):(n.appendChild(i),s&&r&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(r)),this.translate(o.x,o.y)),this.applyColour()}}}getRelativeToSurfaceXY(){let e=this.workspace.getLayerManager();if(!e)throw Error("Cannot calculate position because the workspace has not been appended");let t=0,i=0,n=this.getSvgRoot();if(n)do{let e=re(n);t+=e.x,i+=e.y,n=n.parentNode}while(n&&!e.hasLayer(n));return new Jl(t,i)}moveBy(e,i,n){if(this.parentBlock_)throw Error("Block has parent");let o=a(),r=null;o&&(r=new(h(ja.BLOCK_MOVE))(this),n&&r.setReason(n)),e=new Jl(e,i),i=this.getRelativeToSurfaceXY(),e=Jl.sum(i,e),this.translate(e.x,e.y),this.updateComponentLocations(e),o&&r&&(r.recordNew(),t(r)),this.workspace.resizeContents()}translate(e,t){this.translation=`translate(${e}, ${t})`,this.relativeCoords=new Jl(e,t),this.getSvgRoot().setAttribute("transform",this.getTranslation())}getTranslation(){return this.translation}moveTo(e,t){let i=this.getRelativeToSurfaceXY();this.moveBy(e.x-i.x,e.y-i.y,t)}moveDuringDrag(e){this.translate(e.x,e.y),this.getSvgRoot().setAttribute("transform",this.getTranslation()),this.updateComponentLocations(e)}snapToGrid(){if(!this.isDeadOrDying()&&!this.getParent()&&!this.isInFlyout){var e=this.workspace.getGrid();if(null!=e&&e.shouldSnap()){var t=this.getRelativeToSurfaceXY();(e=e.alignXY(t))!==t&&this.moveTo(e,["snap"])}}}getBoundingRectangle(){return this.getBoundingRectangleWithDimensions(this.getHeightWidth())}getBoundingRectangleWithoutChildren(){return this.getBoundingRectangleWithDimensions({height:this.height,width:this.childlessWidth})}getBoundingRectangleWithDimensions(e){let t,i,n=this.getRelativeToSurfaceXY();return this.RTL?(t=n.x-e.width,i=n.x):(t=n.x,i=n.x+e.width),new ec(n.y,n.y+e.height,t,i)}markDirty(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(let e,t=0;e=this.inputList[t];t++)e.markDirty()}setCollapsed(e){this.collapsed_!==e&&(super.setCollapsed(e),this.updateCollapsed())}childHasWarning(){var e=this.getNextBlock();e=e?new Set(e.getDescendants(!1)):null;let t=this.getDescendants(!1);for(let i of t){if(i===this)continue;let t;if((null==(t=e)||!t.has(i))&&i.getIcon(Zd.TYPE))return!0}return!1}updateCollapsed(){var e=this.isCollapsed();let t=Gc,i=Wc;for(let o,r=0;o=this.inputList[r];r++)o.name!==t&&o.setVisible(!e);for(var n of this.getIcons())n.updateCollapsed();e?(f(this.svgGroup,"blocklyCollapsed"),this.childHasWarning()&&this.setWarningText(Xs.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,ep.COLLAPSED_WARNING_ID),e=this.toString(30),(n=this.getField(i))?n.setValue(e):(this.getInput(t)||this.appendDummyInput(t)).appendField(new $d(e),i)):(this.updateDisabled(),this.removeInput(t),m(this.svgGroup,"blocklyCollapsed"),this.setWarningText(null,ep.COLLAPSED_WARNING_ID))}onMouseDown(e){if(!this.workspace.isReadOnly()){var t=this.workspace.getGesture(e);t&&t.handleBlockStart(e,this)}}showHelp(){let e="function"==typeof this.helpUrl?this.helpUrl():this.helpUrl;e&&window.open(e)}generateContextMenu(e){return this.workspace.isReadOnly()||!this.contextMenu?null:(e=Fh.registry.getContextMenuOptions({block:this,focusedNode:this},e),this.customContextMenu&&this.customContextMenu(e),e)}calculateContextMenuLocation(e){if(e instanceof PointerEvent)return new Jl(e.clientX,e.clientY);
3e=ue(this.workspace,this.getRelativeToSurfaceXY());let t=this.inputList.filter(e=>e.isVisible()).flatMap(e=>e.fieldRow).find(e=>e.isVisible())?.getSvgRoot()?.getBoundingClientRect();return new Jl(this.RTL?e.x-5:e.x+5,(t&&t.height?t.y+t.height:e.y+this.height)+5)}showContextMenu(e){let t=this.generateContextMenu(e),i=this.calculateContextMenuLocation(e);t&&t.length&&(Rn(e,t,this.RTL,this.workspace,i),yn(this))}updateComponentLocations(e){this.dragging||this.updateConnectionLocations(e),this.updateIconLocations(e),this.updateFieldLocations(e);for(let t of this.getChildren(!1))t.updateComponentLocations(Jl.sum(e,t.relativeCoords))}updateConnectionLocations(e){for(let t of this.getConnections_(!1))t.moveToOffset(e)}updateIconLocations(e){for(let t of this.getIcons())t.onLocationChange(e)}updateFieldLocations(e){for(let t of this.inputList)for(let i of t.fieldRow)i.onLocationChange(e)}addClass(e){f(this.svgGroup,e)}removeClass(e){m(this.svgGroup,e)}setDragging(e){(this.dragging=e)?(this.translation="",Dl.push(...this.getConnections_(!0)),this.addClass("blocklyDragging")):(Dl.length=0,this.removeClass("blocklyDragging"));for(let t=0;t<this.childBlocks_.length;t++)this.childBlocks_[t].setDragging(e)}setMovable(e){super.setMovable(e),this.pathObject.updateMovable(e)}setEditable(e){super.setEditable(e),e?m(this.svgGroup,"blocklyNotEditable"):f(this.svgGroup,"blocklyNotEditable"),e=this.getIcons();for(let t=0;t<e.length;t++)e[t].updateEditable()}setShadow(e){super.setShadow(e),this.applyColour()}setInsertionMarker(e){this.isInsertionMarker_!==e&&(this.isInsertionMarker_=e)&&(this.setColour(this.workspace.getRenderer().getConstants().INSERTION_MARKER_COLOUR),this.pathObject.updateInsertionMarker(!0))}getSvgRoot(){return this.svgGroup}getNearestNeighbour(){if(!this.workspace.rendered)return null;var e=this.workspace.getAllBlocks(!1).filter(e=>!e.isDeadOrDying());let t=null,i=2**53-1,n=this.getRelativeToSurfaceXY();for(let o of e)e=o.getRelativeToSurfaceXY(),(e=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2))<i&&(t=o,i=e);return t}dispose(e,t){this.disposing=!0,Ui(),Nn();let i=Xs.getFocusManager$$module$build$src$core$focus_manager();var n,o;if(this.getSvgRoot().contains((o=(n=i.getFocusedNode())?.getFocusableElement())??null)){var r;if(!(n=this.getParent()))(o=(r=this.outputConnection)??this.previousConnection)&&(n=o.closest(0,new Jl(0,0)).connection?.getSourceBlock());n?i.focusNode(n):(r=this.getNearestNeighbour())?i.focusNode(r):setTimeout(()=>{this.workspace.rendered&&i.focusTree(this.workspace)},0)}t&&(this.unplug(e),Vo(this)),super.dispose(!!e),_(this.svgGroup)}disposeInternal(){this.disposing=!0,super.disposeInternal(),Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===this&&this.workspace.cancelCurrentGesture(),[...this.warningTextDb.values()].forEach(e=>clearTimeout(e)),this.warningTextDb.clear(),this.getIcons().forEach(e=>e.dispose())}checkAndDelete(){this.workspace.isFlyout||(Xs.setGroup$$module$build$src$core$events$utils(!0),this.workspace.hideChaff(),this.outputConnection?this.dispose(!1,!0):this.dispose(!0,!0),Xs.setGroup$$module$build$src$core$events$utils(!1))}toCopyData(e=!1){return this.isInsertionMarker_?null:{paster:Yd.TYPE,blockState:Rt(this,{addCoordinates:!0,addNextBlocks:e,saveIds:!1}),typeCounts:V(this,!0)}}applyColour(){var e,t;for(null==(t=(e=this.pathObject).applyColour)||t.call(e,this),e=this.getIcons(),t=0;t<e.length;t++)e[t].applyColour();for(let i of this.getFields())i.applyColour()}updateDisabled(){let e=!this.isEnabled()||this.getInheritedDisabled();if(this.visuallyDisabled===e){let e;null==(e=this.getNextBlock())||e.updateDisabled()}else{this.applyColour(),this.visuallyDisabled=e;for(let e of this.getChildren(!1))e.updateDisabled()}}setWarningText(e,t=""){if(t)this.warningTextDb.has(t)&&(clearTimeout(this.warningTextDb.get(t)),this.warningTextDb.delete(t));else{for(var i of this.warningTextDb.values())clearTimeout(i);this.warningTextDb.clear()}if(this.workspace.isDragging())this.warningTextDb.set(t,setTimeout(()=>{this.isDeadOrDying()||(this.warningTextDb.delete(t),this.setWarningText(e,t))},100));else if(this.isInFlyout&&(e=null),i=this.getIcon(Zd.TYPE),e){let n=this.getSurroundParent(),o=null;for(;n;)n.isCollapsed()&&(o=n),n=n.getSurroundParent();o&&o.setWarningText(Xs.Msg$$module$build$src$core$msg.COLLAPSED_WARNINGS_WARNING,ep.COLLAPSED_WARNING_ID),i?i.addMessage(e,t):this.addIcon(new Zd(this).addMessage(e,t))}else i&&(t?(i.addMessage("",t),i.getText()||this.removeIcon(Zd.TYPE)):this.removeIcon(Zd.TYPE))}setMutator(e){this.removeIcon(Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE),e&&this.addIcon(e)}addIcon(e){return super.addIcon(e),e instanceof Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon&&(this.mutator=e),e.initView(this.createIconPointerDownListener(e)),e.applyColour(),e.updateEditable(),this.queueRender(),e}createIconPointerDownListener(e){return t=>{!this.isDeadOrDying()&&(t=this.workspace.getGesture(t))&&(this.bringToFront(),t.setStartIcon(e),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e))}}removeIcon(e){let t=super.removeIcon(e);return e.equals(Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE)&&(this.mutator=null),this.queueRender(),t}setDisabledReason(e,t){let i=this.isEnabled();super.setDisabledReason(e,t),this.isEnabled()===i||this.getInheritedDisabled()||this.updateDisabled()}setDeletable(e){super.setDeletable(e),e?m(this.svgGroup,"blocklyNotDeletable"):f(this.svgGroup,"blocklyNotDeletable")}setHighlighted(e){this.pathObject.updateHighlighted(e)}addSelect(){this.pathObject.updateSelected(!0)}removeSelect(){this.pathObject.updateSelected(!1)}setDeleteStyle(e){this.pathObject.updateDraggingDelete(e)}getColour(){return this.style.colourPrimary}setColour(e){let t,i;super.setColour(e),e=this.workspace.getRenderer().getConstants().getBlockStyleForColour(this.colour_),null==(i=(t=this.pathObject).setStyle)||i.call(t,e.style),this.style=e.style,this.styleName_=e.name,this.applyColour()}setStyle(e){let t=this.workspace.getRenderer().getConstants().getBlockStyle(e);
3if(this.styleName_&&m(this.svgGroup,this.styleName_),!t)throw Error("Invalid style name: "+e);{let i,n;this.hat=t.hat,null==(n=(i=this.pathObject).setStyle)||n.call(i,t),this.colour_=t.colourPrimary,this.style=t,this.applyColour(),f(this.svgGroup,e),this.styleName_=e}}getStyle(){return this.style}bringToFront(e=!1){let t=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode(),i=this;if(!i.isDeadOrDying()){do{let t=i.getSvgRoot(),n=t.parentNode,o=n.childNodes;if(o[o.length-1]!==t&&n.appendChild(t),e)break;i=i.getParent()}while(i);t&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(t)}}setPreviousStatement(e,t){super.setPreviousStatement(e,t),this.queueRender()}setNextStatement(e,t){super.setNextStatement(e,t),this.queueRender()}setOutput(e,t){super.setOutput(e,t),this.queueRender()}setInputsInline(e){super.setInputsInline(e),this.queueRender()}removeInput(e,t){return e=super.removeInput(e,t),this.queueRender(),e}moveNumberedInputBefore(e,t){super.moveNumberedInputBefore(e,t),this.queueRender()}appendInput(e){return super.appendInput(e),this.queueRender(),e}setConnectionTracking(e){if(this.previousConnection&&this.previousConnection.setTracking(e),this.outputConnection&&this.outputConnection.setTracking(e),this.nextConnection){this.nextConnection.setTracking(e);var t=this.nextConnection.targetBlock();t&&t.setConnectionTracking(e)}if(!this.collapsed_)for(t=0;t<this.inputList.length;t++){var i=this.inputList[t].connection;i&&(i.setTracking(e),(i=i.targetBlock())&&i.setConnectionTracking(e))}}getConnections_(e){let t=[];if(this.outputConnection&&t.push(this.outputConnection),this.previousConnection&&t.push(this.previousConnection),this.nextConnection&&t.push(this.nextConnection),e||!this.collapsed_)for(let i,n=0;i=this.inputList[n];n++)i.connection&&t.push(i.connection);return t}lastConnectionInStack(e){return super.lastConnectionInStack(e)}getMatchingConnection(e,t){return super.getMatchingConnection(e,t)}makeConnection_(e){return new Pd(this,e)}getNextBlock(){return super.getNextBlock()}getPreviousBlock(){return super.getPreviousBlock()}bumpNeighbours(){let e=this.getRootBlock();if(!(this.isDeadOrDying()||this.workspace.isDragging()||e.isInFlyout))for(let t of this.getConnections_(!1)){if(t.isSuperior()){let e;null==(e=t.targetBlock())||e.bumpNeighbours()}for(let i of t.neighbours(Xs.config$$module$build$src$core$config.snapRadius))i.getSourceBlock().getRootBlock()!==e&&(t.isConnected()&&i.isConnected()||(t.isSuperior()?i.bumpAwayFrom(t,!1):t.bumpAwayFrom(i,!0)))}}scheduleSnapAndBump(){this.snapToGrid(),this.bumpNeighbours()}positionNearConnection(e,t,i){if(e.type===Rd.NEXT_STATEMENT||e.type===Rd.INPUT_VALUE){let n=t.x;t=t.y,n+=i.x-e.getOffsetInBlock().x,t+=i.y-e.getOffsetInBlock().y,this.moveBy(n,t)}}getChildren(e){return super.getChildren(e)}queueRender(){return Fe(this)}render(){this.queueRender(),Ue()}renderEfficiently(){O(),this.isCollapsed()&&this.updateCollapsed(),this.isEnabled()||this.updateDisabled(),this.workspace.getRenderer().render(this),this.tightenChildrenEfficiently(),v()}tightenChildrenEfficiently(){for(let e of this.inputList){let t=e.connection;t&&t.tightenEfficiently()}this.nextConnection&&this.nextConnection.tightenEfficiently()}getHeightWidth(){let e=this.height,t=this.width;var i=this.getNextBlock();if(i){i=i.getHeightWidth();let n=this.workspace.getRenderer().getConstants().NOTCH_HEIGHT;e+=i.height-n,t=Math.max(t,i.width)}return{height:e,width:t}}fadeForReplacement(e){this.pathObject.updateReplacementFade(e)}highlightShapeForInput(e,t){this.pathObject.updateShapeForInputHighlight(e,t)}getDragStrategy(){return this.dragStrategy}setDragStrategy(e){this.dragStrategy=e}isCopyable(){return this.isOwnDeletable()&&this.isOwnMovable()}isMovable(){return this.dragStrategy.isMovable()}startDrag(e){this.dragStrategy.startDrag(e)}drag(e,t){this.dragStrategy.drag(e,t)}endDrag(e){this.dragStrategy.endDrag(e)}revertDrag(){this.dragStrategy.revertDrag()}toFlyoutInfo(){let e=Object.assign({},{kind:"BLOCK"},Rt(this)),t=new Set(["id","height","width","pinned","enabled"]),i=function(e){for(let n in e)t.has(n)?delete e[n]:"object"==typeof e[n]&&i(e[n])};return i(e),[e]}jsonInit(e){super.jsonInit(e),e.classes&&this.addClass(Array.isArray(e.classes)?e.classes.join(" "):e.classes)}
3getFocusableElement(){return this.pathObject.svgPath}getFocusableTree(){return this.workspace}onNodeFocus(){this.select(),this.workspace.scrollBoundsIntoView(this.getBoundingRectangleWithoutChildren())}onNodeBlur(){this.unselect()}canBeFocused(){return!0}};ep.INLINE=-1,ep.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_";var tp=class{constructor(){}onDragEnter(e){}onDragOver(e){}onDragExit(e){}onDrop(e){}getClientRect(){return null}shouldPreventMove(e){return!1}},ip=class extends tp{constructor(){super(),this.wouldDelete_=!1}wouldDelete(e){return e instanceof ep?(e=!e.getParent()&&e.isDeletable(),this.updateWouldDelete_(e)):this.updateWouldDelete_(tr(e)&&e.isDeletable()),this.wouldDelete_}updateWouldDelete_(e){this.wouldDelete_=e}},np=class{constructor(e,t){this.element=e,this.type=t}getElement(){return this.element}getType(){return this.type}},op=class{constructor(e){this.workspace_=e}getDimensionsPx_(e){let t=0,i=0;return e&&(t=e.getWidth(),i=e.getHeight()),new tc(t,i)}getFlyoutMetrics(e){return{width:(e=this.getDimensionsPx_(this.workspace_.getFlyout(e))).width,height:e.height,position:this.workspace_.toolboxPosition}}getToolboxMetrics(){let e=this.getDimensionsPx_(this.workspace_.getToolbox());return{width:e.width,height:e.height,position:this.workspace_.toolboxPosition}}getSvgMetrics(){return this.workspace_.getCachedParentSvgSize()}getAbsoluteMetrics(){let e=0,t=0,i=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),o=!!this.workspace_.getToolbox();var r;let s=!(null!=(r=this.workspace_.getFlyout())&&r.autoClose),a=(r=o?i.position:n.position)===mc.TOP;return r===mc.LEFT&&(o&&(e+=i.width),s&&(e+=n.width)),a&&(o&&(t+=i.height),s&&(t+=n.height)),{top:t,left:e}}getViewMetrics(e){e=e?this.workspace_.scale:1;let t=this.getSvgMetrics(),i=this.getToolboxMetrics(),n=this.getFlyoutMetrics(),o=!!this.workspace_.getToolbox();var r;let s=!(null!=(r=this.workspace_.getFlyout())&&r.autoClose),a=(r=o?i.position:n.position)===mc.LEFT||r===mc.RIGHT;return(r===mc.TOP||r===mc.BOTTOM)&&(o&&(t.height-=i.height),s&&(t.height-=n.height)),a&&(o&&(t.width-=i.width),s&&(t.width-=n.width)),{height:t.height/e,width:t.width/e,top:-this.workspace_.scrollY/e,left:-this.workspace_.scrollX/e}}getContentMetrics(e){e=e?1:this.workspace_.scale;let t=this.workspace_.getBlocksBoundingBox();return{height:(t.bottom-t.top)*e,width:(t.right-t.left)*e,top:t.top*e,left:t.left*e}}hasFixedEdges(){return!this.workspace_.isMovableHorizontally()||!this.workspace_.isMovableVertically()}getComputedFixedEdges_(e){if(!this.hasFixedEdges())return{};let t=this.workspace_.isMovableHorizontally(),i=this.workspace_.isMovableVertically();e||=this.getViewMetrics(!1);let n={};
3return i||(n.top=e.top,n.bottom=e.top+e.height),t||(n.left=e.left,n.right=e.left+e.width),n}getPaddedContent_(e,t){let i=t.top+t.height,n=t.left+t.width,o=e.width,r=o/2,s=(e=e.height)/2;return{top:Math.min(t.top-s,i-e),bottom:Math.max(i+s,t.top+e),left:Math.min(t.left-r,n-o),right:Math.max(n+r,t.left+o)}}getScrollMetrics(e,t,i){e=e?this.workspace_.scale:1,t||=this.getViewMetrics(!1);var n=i||this.getContentMetrics();i=this.getComputedFixedEdges_(t),t=this.getPaddedContent_(t,n),n=void 0===i.top?t.top:i.top;let o=void 0===i.left?t.left:i.left;return{top:n/e,left:o/e,width:((void 0===i.right?t.right:i.right)-o)/e,height:((void 0===i.bottom?t.bottom:i.bottom)-n)/e}}getUiMetrics(){return{viewMetrics:this.getViewMetrics(),absoluteMetrics:this.getAbsoluteMetrics(),toolboxMetrics:this.getToolboxMetrics()}}getMetrics(){let e=this.getToolboxMetrics(),t=this.getFlyoutMetrics(!0),i=this.getSvgMetrics(),n=this.getAbsoluteMetrics(),o=this.getViewMetrics(),r=this.getContentMetrics(),s=this.getScrollMetrics(!1,o,r);return{contentHeight:r.height,contentWidth:r.width,contentTop:r.top,contentLeft:r.left,scrollHeight:s.height,scrollWidth:s.width,scrollTop:s.top,scrollLeft:s.left,viewHeight:o.height,viewWidth:o.width,viewTop:o.top,viewLeft:o.left,absoluteTop:n.top,absoluteLeft:n.left,svgHeight:i.height,svgWidth:i.width,toolboxWidth:e.width,toolboxHeight:e.height,toolboxPosition:e.position,flyoutWidth:t.width,flyoutHeight:t.height}}};zs(ka.METRICS_MANAGER,Ca,op);var rp=class extends op{constructor(e,t){super(e),this.flyout_=t}getBoundingBox(){let e;try{e=this.workspace_.getCanvas().getBBox()}catch{e={height:0,y:0,width:0,x:0}}return e}getContentMetrics(e){let t=this.getBoundingBox();return e=e?1:this.workspace_.scale,{height:t.height*e,width:t.width*e,top:t.y*e,left:t.x*e}}getScrollMetrics(e,t,i){return t=i||this.getContentMetrics(),i=this.flyout_.MARGIN*this.workspace_.scale,e=e?this.workspace_.scale:1,{height:(t.height+2*i)/e,width:(t.width+t.left+i)/e,top:0,left:0}}},sp=class{constructor(e,t,i,n){let o;this.workspace=e,this.targetWorkspace=t,this.isFlyoutLabel=n,this.height=this.width=0,this.cursorSvg=this.svgText=null,this.text=i.text,this.position=new Jl(0,0),this.callbackKey=i.callbackKey||i.callbackkey,this.cssClass=i["web-class"]||null,this.info=i,e=this.isFlyoutLabel?"blocklyFlyoutLabel":"blocklyFlyoutButton",this.cssClass&&(e+=" "+this.cssClass),this.id=fa(),this.svgGroup=p(Zl.G,{id:this.id,class:e},this.workspace.getCanvas()),this.isFlyoutLabel||(o=p(Zl.RECT,{class:"blocklyFlyoutButtonShadow",rx:sp.BORDER_RADIUS,ry:sp.BORDER_RADIUS,x:1,y:1},this.svgGroup)),e=p(Zl.RECT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:sp.BORDER_RADIUS,ry:sp.BORDER_RADIUS},this.svgGroup),t=p(Zl.TEXT,{class:this.isFlyoutLabel?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"}
3,this.svgGroup),i=an(this.text),this.workspace.RTL&&(i+="â"),t.textContent=i,this.isFlyoutLabel&&(this.svgText=t,this.workspace.getThemeManager().subscribe(this.svgText,"flyoutForegroundColour","fill")),n=Z(t,"fontSize");let r=Z(t,"fontWeight"),s=Z(t,"fontFamily");if(this.width=y(t,n,r,s),i=R(i,n,r,s),this.height=this.height||i.height,!this.isFlyoutLabel){let e,t;this.width+=2*sp.TEXT_MARGIN_X,this.height+=2*sp.TEXT_MARGIN_Y,null==(e=o)||e.setAttribute("width",String(this.width)),null==(t=o)||t.setAttribute("height",String(this.height))}e.setAttribute("width",String(this.width)),e.setAttribute("height",String(this.height)),t.setAttribute("x",String(this.width/2)),t.setAttribute("y",String(this.height/2-i.height/2+i.baseline)),this.updateTransform(),this.onMouseDownWrapper=aa(this.svgGroup,"pointerdown",this,this.onMouseDown),this.onMouseUpWrapper=aa(this.svgGroup,"pointerup",this,this.onMouseUp)}createDom(){return this.svgGroup}show(){this.updateTransform(),this.svgGroup.setAttribute("display","block")}updateTransform(){this.svgGroup.setAttribute("transform","translate("+this.position.x+","+this.position.y+")")}moveTo(e,t){this.position.x=e,this.position.y=t,this.updateTransform()}moveBy(e,t,i){this.moveTo(this.position.x+e,this.position.y+t)}isLabel(){return this.isFlyoutLabel}getPosition(){return this.position}getBoundingRectangle(){return new ec(this.position.y,this.position.y+this.height,this.position.x,this.position.x+this.width)}getButtonText(){return this.text}getTargetWorkspace(){return this.targetWorkspace}getWorkspace(){return this.workspace}dispose(){ca(this.onMouseDownWrapper),ca(this.onMouseUpWrapper),this.svgGroup&&_(this.svgGroup),this.svgText&&this.workspace.getThemeManager().unsubscribe(this.svgText)}setCursorSvg(e){e?this.svgGroup&&(this.svgGroup.appendChild(e),this.cursorSvg=e):this.cursorSvg=null}onMouseUp(e){(e=this.targetWorkspace.getGesture(e))&&e.cancel(),this.isFlyoutLabel&&this.callbackKey?console.warn("Labels should not have callbacks. Label text: "+this.text):this.isFlyoutLabel||this.callbackKey&&this.targetWorkspace.getButtonCallback(this.callbackKey)?this.isFlyoutLabel||(e=this.targetWorkspace.getButtonCallback(this.callbackKey))&&e(this):console.warn("Buttons should have callbacks. Button text: "+this.text)}onMouseDown(e){let t=this.targetWorkspace.getGesture(e),i=this.targetWorkspace.getFlyout();t&&i&&t.handleFlyoutStart(e,i)}getSvgRoot(){return this.svgGroup}getFocusableElement(){return this.svgGroup}getFocusableTree(){return this.workspace}onNodeFocus(){var e=this.getPosition();e=new ec(e.y,e.y+this.height,e.x,e.x+this.width),this.workspace.scrollBoundsIntoView(e)}onNodeBlur(){}canBeFocused(){return!0}};sp.TEXT_MARGIN_X=5,sp.TEXT_MARGIN_Y=2,sp.BORDER_RADIUS=4,Y("\n.blocklyFlyoutButton {\n fill: #888;\n cursor: default;\n}\n\n.blocklyFlyoutButtonShadow {\n fill: #666;\n}\n\n@media (hover: hover) {\n .blocklyFlyoutButton:hover {\n fill: #aaa;\n }\n}\n\n.blocklyFlyoutButton:active {\n fill: #aaa;\n}\n\n.blocklyFlyoutLabel {\n cursor: default;\n}\n\n.blocklyFlyoutLabelBackground {\n opacity: 0;\n}\n");var ap=class{getFirstChild(e){return null}getParent(e){return e.getWorkspace()}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof sp}},lp=class{constructor(e,t){this.policy=e,this.flyout=t}getFirstChild(e){return null}getParent(e){return this.policy.getParent(e)}getNextSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return-1===i?null:(i++,i>=t.length&&(i=0),t[i].getElement())}getPreviousSibling(e){let t=this.flyout.getContents();if(!t)return null;let i=t.findIndex(t=>t.getElement()===e);return-1===i?null:(i--,i<0&&(i=t.length-1),t[i].getElement())}isNavigable(e){return this.policy.isNavigable(e)}isApplicable(e){return this.policy.isApplicable(e)}},cp=class{constructor(e,t){this.gap=e,this.axis=t,this.y=this.x=0}getBoundingRectangle(){switch(this.axis){case"x":return new ec(this.y,this.y,this.x,this.x+this.gap);case"y":return new ec(this.y,this.y+this.gap,this.x,this.x)}}moveBy(e,t,i){this.x+=e,this.y+=t}isNavigable(){return!1}getFocusableElement(){throw Error("Cannot be focused")}getFocusableTree(){throw Error("Cannot be focused")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}},up=class{getFirstChild(e){return null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return!1}isApplicable(e){return e instanceof cp}},hp=class{getFirstChild(e){return e.getEditor()}getParent(e){return e.getOwner()??null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof yd}},dp=class{getFirstChild(e){return ir(e,!0)[0]}getParent(e){var t;
3if(null!=(t=e.previousConnection)&&t.targetBlock()){if(t=e.getSurroundParent())return t}else{let t;if(null!=(t=e.outputConnection)&&t.targetBlock())return e.outputConnection.targetBlock()}return e.workspace}getNextSibling(e){let t,i;return null!=(t=e.nextConnection)&&t.targetBlock()?e.nextConnection?.targetBlock():null!=(i=e.outputConnection)&&i.targetBlock()?or(e,1):e.getSurroundParent()?or(e.getTopStackBlock(),1):this.getParent(e)instanceof yf?nr(e,1):null}getPreviousSibling(e){let t,i;return null!=(t=e.previousConnection)&&t.targetBlock()?e.previousConnection?.targetBlock():null!=(i=e.outputConnection)&&i.targetBlock()?or(e,-1):this.getParent(e)instanceof yf?nr(e,-1):null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof ep}},pp={};pp.BlockNavigationPolicy=dp,pp.navigateBlock=or,pp.navigateStacks=nr;var fp=class{getFirstChild(e){return null}getParent(e){return e.getCommentView().workspace.getCommentById(e.getCommentView().commentId)}getNextSibling(e){let t=e.getCommentView().getCommentBarButtons();return(e=t.indexOf(e))>=0&&e+1<t.length?t[e+1]:null}getPreviousSibling(e){let t=e.getCommentView().getCommentBarButtons();return(e=t.indexOf(e))>0?t[e-1]:null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof jh}},gp=class{getFirstChild(e){return null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof qh}},mp=class{getFirstChild(e){return e.getParentInput()?e.targetConnection:null}getParent(e){return e.getSourceBlock()}getNextSibling(e){if(e.getParentInput())return or(e,1);if(e.type===Rd.NEXT_STATEMENT){let i=e.targetConnection;var t=e.getSourceBlock();return i||t.getRootBlock().lastConnectionInStack(!1)!==e?i:(e=t.workspace.getTopBlocks(!0),(t=e.indexOf(t.getRootBlock())+1)>=e.length&&(t=0),t=e[t],this.getParentConnection(t)??t)}return e.getSourceBlock()}getPreviousSibling(e){if(e.getParentInput())return or(e,-1);if(e.type===Rd.PREVIOUS_STATEMENT||e.type===Rd.OUTPUT_VALUE){let i=e.targetConnection&&!e.targetConnection.getParentInput()?e.targetConnection:null;var t=e.getSourceBlock();return i||this.getParentConnection(t.getRootBlock())!==e?i:(e=t.workspace.getTopBlocks(!0),(t=e.indexOf(t.getRootBlock())-1)<0&&(t=e.length-1),(t=e[t]).lastConnectionInStack(!1)??t)}return e.type===Rd.NEXT_STATEMENT?e.getSourceBlock():null}getParentConnection(e){let t;return!e.outputConnection||null!=(t=e.previousConnection)&&t.isConnected()?e.previousConnection:e.outputConnection}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof Pd}},Tp=class{getFirstChild(e){return null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return or(e,1)}getPreviousSibling(e){return or(e,-1)}isNavigable(e){let t;return e.canBeFocused()&&e.isVisible()&&(e.isClickable()||e.isCurrentlyEditable())&&!(null!=(t=e.getSourceBlock())&&t.isSimpleReporter()&&e.isFullBlockField())&&e.getParentInput().isVisible()}isApplicable(e){return e instanceof vh}},_p={};_p.register=rr,_p.unregister=sr;var Ep=class extends _d{constructor(e){super(e),this.sourceBlock=e,this.textInputBubble=null,this.text="",this.bubbleSize=new tc(160,80),this.bubbleVisiblity=!1}getType(){return Ep.TYPE}initView(e){this.svgRoot||(super.initView(e),p(Zl.CIRCLE,{class:"blocklyIconShape",r:"8",cx:"8",cy:"8"},this.svgRoot),p(Zl.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"},this.svgRoot),p(Zl.RECT,{class:"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},this.svgRoot),f(this.svgRoot,"blocklyCommentIcon"))}dispose(){let e;super.dispose(),null==(e=this.textInputBubble)||e.dispose()}getWeight(){return Ep.WEIGHT}getSize(){return new tc(17,17)}applyColour(){super.applyColour();let e,t=this.sourceBlock.getColour();null==(e=this.textInputBubble)||e.setColour(t)}updateEditable(){let e=this,t=()=>super.updateEditable;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){t().call(e),e.bubbleIsVisible()&&(yield e.setBubbleVisible(!1),yield e.setBubbleVisible(!0))})}onLocationChange(e){let t,i=this.workspaceLocation;super.onLocationChange(e),this.bubbleLocation&&=(e=Jl.difference(this.workspaceLocation,i),Jl.sum(this.bubbleLocation,e)),e=this.getAnchorLocation(),null==(t=this.textInputBubble)||t.setAnchorLocation(e)}setText(e){let i,n=this.text;t(new(h(ja.BLOCK_CHANGE))(this.sourceBlock,"comment",null,n,e)),this.text=e,null==(i=this.textInputBubble)||i.setText(this.text)}getText(){return this.text}setBubbleSize(e){let t;this.bubbleSize=e,null==(t=this.textInputBubble)||t.setSize(this.bubbleSize,!0)}getBubbleSize(){return this.bubbleSize}setBubbleLocation(e){let t;this.bubbleLocation=e,null==(t=this.textInputBubble)||t.moveDuringDrag(e)}getBubbleLocation(){return this.bubbleLocation}saveState(){if(this.text){let e={text:this.text,pinned:this.bubbleIsVisible(),height:this.bubbleSize.height,width:this.bubbleSize.width},t=this.getBubbleLocation();return t&&(e.x=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(t.x+this.bubbleSize.width):t.x,e.y=t.y),e}return null}loadState(e){this.text=e.text??"",this.bubbleSize=new tc(e.width??160,e.height??80),this.bubbleVisiblity=e.pinned??!1,this.setBubbleVisible(this.bubbleVisiblity);let t=e.x,i=e.y;Be().then(()=>{t&&i&&(t=this.sourceBlock.workspace.RTL?this.sourceBlock.workspace.getWidth()-(t+this.bubbleSize.width):t,this.setBubbleLocation(new Jl(t,i)))})}onClick(){super.onClick(),this.setBubbleVisible(!this.bubbleIsVisible())}isClickableInFlyout(){return!1}onTextChange(){if(this.textInputBubble){var e=this.textInputBubble.getText();this.text!==e&&(t(new(h(ja.BLOCK_CHANGE))(this.sourceBlock,"comment",null,this.text,e)),this.text=e)}}onSizeChange(){this.textInputBubble&&(this.bubbleSize=this.textInputBubble.getSize())}onBubbleLocationChange(){this.textInputBubble&&(this.bubbleLocation=this.textInputBubble.getRelativeToSurfaceXY()
3)}bubbleIsVisible(){return this.bubbleVisiblity}setBubbleVisible(e){let i=this;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){i.bubbleVisiblity!==e&&(i.bubbleVisiblity=e,yield Be(),!i.sourceBlock.rendered||i.sourceBlock.isInFlyout||i.sourceBlock.isInsertionMarker()||(e?(i.sourceBlock.isEditable()?i.showEditableBubble():i.showNonEditableBubble(),i.applyColour()):i.hideBubble(),t(new(h(ja.BUBBLE_OPEN))(i.sourceBlock,e,"comment"))))})}getBubble(){return this.textInputBubble}showEditableBubble(){let e,t;this.createBubble(),null==(e=this.textInputBubble)||e.addTextChangeListener(()=>this.onTextChange()),null==(t=this.textInputBubble)||t.addSizeChangeListener(()=>this.onSizeChange())}showNonEditableBubble(){let e;this.createBubble(),null==(e=this.textInputBubble)||e.setEditable(!1)}createBubble(){this.textInputBubble=new yd(this.sourceBlock.workspace,this.getAnchorLocation(),this.getBubbleOwnerRect(),this),this.textInputBubble.setText(this.getText()),this.textInputBubble.setSize(this.bubbleSize,!0),this.bubbleLocation&&this.textInputBubble.moveDuringDrag(this.bubbleLocation),this.textInputBubble.addTextChangeListener(()=>this.onTextChange()),this.textInputBubble.addSizeChangeListener(()=>this.onSizeChange()),this.textInputBubble.addLocationChangeListener(()=>this.onBubbleLocationChange())}hideBubble(){let e;null==(e=this.textInputBubble)||e.dispose(),this.textInputBubble=null}getAnchorLocation(){return Jl.sum(this.workspaceLocation,new Jl(8.5,8.5))}getBubbleOwnerRect(){return this.sourceBlock.getBoundingRectangleWithoutChildren()}};Ep.TYPE=Lu.COMMENT,Ep.WEIGHT=3,rr(Ep.TYPE,Ep);var bp=class{getFirstChild(e){return e instanceof Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()&&Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===e?e.getBubble()?.getWorkspace()??null:e instanceof Ep&&e.bubbleIsVisible()&&Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()===e?e.getBubble()?.getEditor()??null:null}getParent(e){return e.getSourceBlock()}getNextSibling(e){return or(e,1)}getPreviousSibling(e){return or(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof _d}},Op=class{getFirstChild(e){return e.view.getCommentBarButtons()[0]}getParent(e){return e.workspace}getNextSibling(e){return nr(e,1)}getPreviousSibling(e){return nr(e,-1)}isNavigable(e){return e.canBeFocused()}isApplicable(e){return e instanceof id}},vp=class{getFirstChild(e){return(e=e.getTopBlocks(!0)).length?e[0]:null}getParent(e){return null}getNextSibling(e){return null}getPreviousSibling(e){return null}isNavigable(e){return e.canBeFocused()&&!e.isMutator}isApplicable(e){return e instanceof yf}},Ip=class{constructor(){this.rules=[new dp,new Tp,new mp,new vp,new bp,new Op,new fp,new hp,new gp]}addNavigationPolicy(e){this.rules.push(e)}get(e){return this.rules.find(t=>t.isApplicable(e))}getFirstChild(e){let t,i=this.get(e)?.getFirstChild(e);return i?null!=(t=this.get(i))&&t.isNavigable(i)?i:this.getFirstChild(i)||this.getNextSibling(i):null}getParent(e){let t,i=this.get(e)?.getParent(e);return i?null!=(t=this.get(i))&&t.isNavigable(i)?i:this.getParent(i):null}getNextSibling(e){let t,i=this.get(e)?.getNextSibling(e);return i?null!=(t=this.get(i))&&t.isNavigable(i)?i:this.getNextSibling(i):null}getPreviousSibling(e){let t,i=this.get(e)?.getPreviousSibling(e);return i?null!=(t=this.get(i))&&t.isNavigable(i)?i:this.getPreviousSibling(i):null}},Sp=class extends Ip{constructor(e){super(),this.rules.push(new ap,new up),this.rules=this.rules.map(t=>new lp(t,e))}},yp=class{constructor(e,t,i,n,o){this.workspace=e,this.oldHostMetrics=this.corner_=this.vScroll=this.hScroll=null,i=void 0===i||i;let r=(t=void 0===t||t)&&i;t&&(this.hScroll=new ac(e,!0,r,n,o)),i&&(this.vScroll=new ac(e,!1,r,n,o)),r&&(this.corner_=p(Zl.RECT,{height:ac.scrollbarThickness,width:ac.scrollbarThickness,class:"blocklyScrollbarBackground"}),E(this.corner_,e.getBubbleCanvas()))}dispose(){_(this.corner_),this.oldHostMetrics=this.corner_=null,this.hScroll&&=(this.hScroll.dispose(),null),this.vScroll&&=(this.vScroll.dispose(),null)}resize(){let e=this.workspace.getMetrics();if(e){var t=!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||(t=!0),this.oldHostMetrics&&this.oldHostMetrics.scrollHeight===e.scrollHeight&&this.oldHostMetrics.viewTop===e.viewTop&&this.oldHostMetrics.scrollTop===e.scrollTop||(i=!0)):i=t=!0,t||i){try{Xs.disable$$module$build$src$core$events$utils(),this.hScroll&&t&&this.hScroll.resize(e),this.vScroll&&i&&this.vScroll.resize(e)}finally{Xs.enable$$module$build$src$core$events$utils()}this.workspace.maybeFireViewportChangeEvent()}if(this.hScroll&&this.vScroll){if(!this.oldHostMetrics||this.oldHostMetrics.viewWidth!==e.viewWidth||this.oldHostMetrics.absoluteLeft!==e.absoluteLeft){let e;null==(e=this.corner_)||e.setAttribute("x",String(this.vScroll.position.x))}if(!this.oldHostMetrics||this.oldHostMetrics.viewHeight!==e.viewHeight||this.oldHostMetrics.absoluteTop!==e.absoluteTop){let e;null==(e=this.corner_)||e.setAttribute("y",String(this.hScroll.position.y))}}this.oldHostMetrics=e}}canScrollHorizontally(){return!!this.hScroll}canScrollVertically(){return!!this.vScroll}setOrigin(e,t){this.hScroll&&this.hScroll.setOrigin(e,t),this.vScroll&&this.vScroll.
3setOrigin(e,t)}set(e,t,i){this.hScroll&&this.hScroll.set(e,!1),this.vScroll&&this.vScroll.set(t,!1),(i||void 0===i)&&(e={},this.hScroll&&(e.x=this.hScroll.getRatio_()),this.vScroll&&(e.y=this.vScroll.getRatio_()),this.workspace.setMetrics(e))}setX(e){this.hScroll&&this.hScroll.set(e,!0)}setY(e){this.vScroll&&this.vScroll.set(e,!0)}setContainerVisible(e){this.hScroll&&this.hScroll.setContainerVisible(e),this.vScroll&&this.vScroll.setContainerVisible(e)}isVisible(){let e=!1;return this.hScroll&&(e=this.hScroll.isVisible()),this.vScroll&&(e||=this.vScroll.isVisible()),e}setVisible(e){this.hScroll&&this.hScroll.setVisibleInternal(e),this.vScroll&&this.vScroll.setVisibleInternal(e)}resizeContent(e){this.hScroll&&this.hScroll.resizeContentHorizontal(e),this.vScroll&&this.vScroll.resizeContentVertical(e)}resizeView(e){this.hScroll&&this.hScroll.resizeViewHorizontal(e),this.vScroll&&this.vScroll.resizeViewVertical(e)}},Rp="sep",Cp=class{load(e,t){return e=new cp(0,t.horizontalLayout?"x":"y"),new np(e,Rp)}gapForItem(e,t){return parseInt(String(e.gap))??t}disposeItem(e){}getType(){return Rp}};zs(ka.FLYOUT_INFLATER,Rp,Cp),{SEPARATOR_TYPE:Rp}.SeparatorFlyoutInflater=Cp;var kp=class extends ip{constructor(e){super(),this.horizontalLayout=!1,this.boundEvents=[],this.reflowWrapper=null,this.inhibitReflowWrapper=!1,this.contents=[],this.autoClose=!0,this.visible=!1,this.containerVisible=!0,this.CORNER_RADIUS=8,this.SCROLLBAR_MARGIN=2.5,this.height_=this.width_=0,this.dragAngleRange_=70,this.svgGroup_=this.svgBackground_=null,this.inflaters=new Map,e.setMetrics=this.setMetrics_.bind(this),this.workspace_=new yf(e),this.workspace_.setMetricsManager(new rp(this.workspace_,this)),this.workspace_.internalIsFlyout=!0,this.workspace_.setVisible(this.visible),this.workspace_.setNavigator(new Sp(this)),this.id=ga(),this.RTL=!!e.RTL,this.toolboxPosition_=e.toolboxPosition,this.tabWidth_=this.workspace_.getRenderer().getConstants().TAB_WIDTH,this.MARGIN=this.CORNER_RADIUS,this.GAP_X=3*this.MARGIN,this.GAP_Y=3*this.MARGIN}createDom(e){return this.svgGroup_=p(e,{class:"blocklyFlyout"}),this.svgGroup_.style.display="none",this.svgBackground_=p(Zl.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_}init(e){this.targetWorkspace=e,this.workspace_.targetWorkspace=e,this.workspace_.scrollbar=new yp(this.workspace_,this.horizontalLayout,!this.horizontalLayout,"blocklyFlyoutScrollbar",this.SCROLLBAR_MARGIN),this.hide(),this.boundEvents.push(aa(this.svgGroup_,"wheel",this,this.wheel_,!1,{passive:!1})),this.boundEvents.push(aa(this.svgBackground_,"pointerdown",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:zl.ComponentWeight.FLYOUT_WEIGHT,capabilities:[zl.Capability.AUTOHIDEABLE,zl.Capability.DELETE_AREA,zl.Capability.DRAG_TARGET]})}dispose(){this.hide(),this.targetWorkspace.getComponentManager().removeComponent(this.id);for(let e of this.boundEvents)ca(e);this.boundEvents.length=0,this.workspace_&&(this.workspace_.getThemeManager().unsubscribe(this.svgBackground_),this.workspace_.dispose()),this.svgGroup_&&_(this.svgGroup_)}getWidth(){return this.width_}getHeight(){return this.height_}getFlyoutScale(){return this.targetWorkspace.scale}getWorkspace(){return this.workspace_}setAutoClose(e){this.autoClose=e,this.targetWorkspace.recordDragTargets(),this.targetWorkspace.resizeContents()}autoHide(e){!e&&this.targetWorkspace.getFlyout(!0)===this&&this.autoClose&&this.hide()}getTargetWorkspace(){return this.targetWorkspace}isVisible(){return this.visible}setVisible(e){let t=e!==this.isVisible();this.visible=e,t&&(this.autoClose||this.targetWorkspace.recordDragTargets(),this.updateDisplay())}setContainerVisible(e){let t=e!==this.containerVisible;this.containerVisible=e,t&&this.updateDisplay()}getContents(){return this.contents}setContents(e){this.contents=e}updateDisplay(){let e,t;e=!!this.containerVisible&&this.isVisible(),this.svgGroup_&&(this.svgGroup_.style.display=e?"block":"none"),null==(t=this.workspace_.scrollbar)||t.setContainerVisible(e)}positionAt_(e,t,i,n){let o,r;null==(o=this.svgGroup_)||o.setAttribute("width",`${e}`),null==(r=this.svgGroup_)||r.setAttribute("height",`${t}
3`),this.workspace_.setCachedParentSvgSize(e,t),this.svgGroup_&&b(this.svgGroup_,"translate("+i+"px,"+n+"px)"),(e=this.workspace_.scrollbar)&&(e.setOrigin(i,n),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))}hide(){this.isVisible()&&(this.setVisible(!1),this.reflowWrapper&&=(this.workspace_.removeChangeListener(this.reflowWrapper),null))}show(e){this.workspace_.setResizesEnabled(!1),Xs.setRecordUndo$$module$build$src$core$events$utils(!1),this.hide(),this.clearOldBlocks(),"string"==typeof e&&(e=this.getDynamicCategoryContents(e)),this.setVisible(!0),e=me(e),e=this.createFlyoutInfo(e),Ue(this.workspace_),this.setContents(e),this.layout_(e),this.horizontalLayout?this.height_=0:this.width_=0,this.reflow(),Xs.setRecordUndo$$module$build$src$core$events$utils(!0),this.workspace_.setResizesEnabled(!0),this.reflowWrapper=e=>{this.inhibitReflowWrapper||e.type!==ja.BLOCK_CHANGE&&e.type!==ja.BLOCK_FIELD_INTERMEDIATE_CHANGE||this.reflow()},this.workspace_.addChangeListener(this.reflowWrapper)}createFlyoutInfo(e){let t=[],i=this.horizontalLayout?this.GAP_X:this.GAP_Y;for(let n of e)"custom"in n&&(e=this.getDynamicCategoryContents(n.custom),e=me(e),t.push(...this.createFlyoutInfo(e))),e=n.kind.toLowerCase(),(e=this.getInflaterForType(e))&&(t.push(e.load(n,this)),(e=e.gapForItem(n,i))&&t.push(new np(new cp(e,this.horizontalLayout?"x":"y"),Rp)));return this.normalizeSeparators(t)}normalizeSeparators(e){for(let t=e.length-1;t>0;t--){let i=e[t].getType().toLowerCase(),n=e[t-1].getType().toLowerCase();i===Rp&&n===Rp&&e.splice(t-1,1)}return e}getDynamicCategoryContents(e){if("function"!=typeof(e=this.workspace_.targetWorkspace.getToolboxCategoryCallback(e)))throw TypeError("Couldn't find a callback function when opening a toolbox category.");return e(this.workspace_.targetWorkspace)}clearOldBlocks(){let e;this.getContents().forEach(e=>{let t;null==(t=this.getInflaterForType(e.getType()))||t.disposeItem(e)}),null==(e=this.workspace_.getPotentialVariableMap())||e.clear()}onMouseDown(e){let t=this.targetWorkspace.getGesture(e);t&&t.handleFlyoutStart(e,this)}isBlockCreatable(e){return e.isEnabled()&&!this.getTargetWorkspace().isReadOnly()}createBlock(e){let t=this.targetWorkspace;if(!e.getSvgRoot())throw Error("oldBlock is not rendered");var i=this.serializeBlock(e);return t.setResizesEnabled(!1),i=Dt(i,t,{recordUndo:!0}),this.positionNewBlock(e,i),t.hideChaff(),i}reflow(){this.inhibitReflowWrapper=!0,this.reflowInternal_(),this.inhibitReflowWrapper=!1}isScrollable(){return!!this.workspace_.scrollbar&&this.workspace_.scrollbar.isVisible()}serializeBlock(e){return Rt(e)}positionNewBlock(e,t){let i=this.targetWorkspace;var n=i.getOriginOffsetInPixels(),o=this.workspace_.getOriginOffsetInPixels();(e=e.getRelativeToSurfaceXY()).scale(this.workspace_.scale),o=Jl.sum(o,e),(n=Jl.difference(o,n)).scale(1/i.scale),t.moveTo(new Jl(n.x,n.y))}getInflaterForType(e){var t;return this.inflaters.has(e)?(t=this.inflaters.get(e))??null:(t=qs(ka.FLYOUT_INFLATER,e))?(t=new t,this.inflaters.set(e,t),t):null}getFocusableElement(){throw Error("Flyouts are not directly focusable.")}getFocusableTree(){throw Error("Flyouts are not directly focusable.")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}getRootFocusableNode(){throw Error("Flyouts are not directly focusable.")}getRestoredFocusableNode(e){throw Error("Flyouts are not directly focusable.")}getNestedTrees(){throw Error("Flyouts are not directly focusable.")}lookUpFocusableNode(e){throw Error("Flyouts are not directly focusable.")}onTreeFocus(e,t){}onTreeBlur(e){throw Error("Flyouts are not directly focusable.")}},Ap=class{constructor(){this.isActive=!1,this.activeClassName="blocklyKeyboardNavigation"}setIsActive(e=!0){this.isActive=e,this.updateActiveVisualization()}getIsActive(){return this.isActive}updateActiveVisualization(){this.isActive?document.body.classList.add(this.activeClassName):document.body.classList.remove(this.activeClassName)}},Lp=new Ap,Np={};Np.KeyboardNavigationController=Ap,Np.keyboardNavigationController=Lp;var wp=class{constructor(e){this.workspace=e,this.horizontalScrollEnabled=this.workspace.isMovableHorizontally(),this.verticalScrollEnabled=this.workspace.isMovableVertically(),this.startScrollXY_=ne
3w Jl(e.scrollX,e.scrollY)}startDrag(){}endDrag(e){this.drag(e)}drag(e){if(e=Jl.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 TypeError("Invalid state.");this.workspace.scroll(this.workspace.scrollX,e.y)}}},$p=class{constructor(e,t){this.creatorWorkspace=t,this.mouseDownXY=new Jl(0,0),this.startWorkspace_=this.targetBlock=this.startComment=this.startBlock=this.startIcon=this.startField=this.startBubble=null,this.hasExceededDragRadius=!1,this.boundEvents=[],this.workspaceDragger=this.dragger=null,this.dragging=!1,this.flyout=null,this.multiTouch=this.isEnding_=this.gestureHasStarted=this.calledUpdateIsDragging=!1,this.cachedPoints=new Map,this.startDistance=this.previousScale=0,this.currentDropdownOwner=this.isPinchZoomEnabled=null,this.mostRecentEvent=e,this.currentDragDeltaXY=new Jl(0,0)}dispose(){na(),Gi(),this.creatorWorkspace.clearGesture();for(let e of this.boundEvents)ca(e);this.boundEvents.length=0}updateFromEvent(e){let t=new Jl(e.clientX,e.clientY);this.updateDragDelta(t)&&(this.updateIsDragging(e),ia()),this.mostRecentEvent=e}updateDragDelta(e){return this.currentDragDeltaXY=Jl.difference(e,this.mouseDownXY),!this.hasExceededDragRadius&&(this.hasExceededDragRadius=Jl.magnitude(this.currentDragDeltaXY)>(this.flyout?Xs.config$$module$build$src$core$config.flyoutDragRadius:Xs.config$$module$build$src$core$config.dragRadius))}updateIsDraggingFromFlyout(){let e;if(!this.targetBlock||null==(e=this.flyout)||!e.isBlockCreatable(this.targetBlock))return!1;if(!this.flyout.targetWorkspace)throw Error("Cannot update dragging from the flyout because the ' +\n 'flyout's target workspace is undefined");return this.startWorkspace_=this.flyout.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),Xs.getGroup$$module$build$src$core$events$utils()||Xs.setGroup$$module$build$src$core$events$utils(!0),this.startBlock=null,this.targetBlock=this.flyout.createBlock(this.targetBlock),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),!0}updateIsDraggingWorkspace(){if(!this.startWorkspace_)throw Error("Cannot update dragging the workspace because the start workspace is undefined");(this.flyout?this.flyout.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.dragging=!0,this.workspaceDragger=new wp(this.startWorkspace_),this.workspaceDragger.startDrag())}updateIsDragging(e){if(!this.startWorkspace_)throw Error("Cannot update dragging because the start workspace is undefined");if(this.calledUpdateIsDragging)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging=!0,this.flyout&&this.updateIsDraggingFromFlyout();let t=D();t&&lr(t)&&t.isMovable()?(this.dragging=!0,this.dragger=this.createDragger(t,this.startWorkspace_),this.dragger.onDragStart(e),this.dragger.onDrag(e,this.currentDragDeltaXY)):this.updateIsDraggingWorkspace()}createDragger(e,t){return new(ea(ka.BLOCK_DRAGGER,this.creatorWorkspace.options,!0))(e,t)}doStart(e){if(!this.startWorkspace_)throw Error("Cannot start the touch gesture becauase the start workspace is undefined");this.isPinchZoomEnabled=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,ua(e)?this.cancel():(this.gestureHasStarted=!0,jo(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),this.currentDropdownOwner=ti(),this.startWorkspace_.hideChaff(!!this.flyout),this.startWorkspace_.markFocused(),this.mostRecentEvent=e,Vi(),ha(e)?this.handleRightClick(e):("pointerdown"===e.type.toLowerCase()&&"mouse"!==e.pointerType&&ta(e,this),this.mouseDownXY=new Jl(e.clientX,e.clientY),this.bindMouseEvents(e),this.isEnding_||this.handleTouchStart(e)))}bindMouseEvents(e){this.boundEvents.push(aa(document,"pointerdown",null,this.handleStart.bind(this),!0)),this.boundEvents.push(aa(document,"pointermove",null,this.handleMove.bind(this),!0)),this.boundEvents.push(aa(document,"pointerup",null,this.handleUp.bind(this),!0)),this.boundEvents.push(aa(document,"pointercancel",null,this.handleUp.bind(this),!0)),e.preventDefault(),e.stopPropagation()}handleStart(e){this.isDragging()||(this.handleTouchStart(e),this.isMultiTouch()&&ia())}handleMove(e){this.isDragging()&&oa(e)||!this.isMultiTouch()?(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation()):this.isMultiTouch()&&(this.handleTouchMove(e),ia())}handleUp(e){if(this.isDragging()||this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()){if(!oa(e))return;if(this.updateFromEvent(e),ia(),this.isEnding_)return;this.isEnding_=!0,this.dragger?(Lp.setIsActive(!1),this.dragger.onDragEnd(e,this.currentDragDeltaXY)):this.workspaceDragger?(Lp.setIsActive(!1),this.workspaceDragger.endDrag(this.currentDragDeltaXY)):this.isBubbleClick()||this.isCommentClick()||(this.isFieldClick()?this.doFieldClick():this.isIconCl
3ick()?this.doIconClick():this.isBlockClick()?this.doBlockClick():this.isWorkspaceClick()&&this.doWorkspaceClick(e))}e.preventDefault(),e.stopPropagation(),this.dispose()}handleTouchStart(e){var t=ra(e);this.cachedPoints.set(t,this.getTouchPoint(e));var i=Array.from(this.cachedPoints.keys());2===i.length&&(t=this.cachedPoints.get(i[0]),i=this.cachedPoints.get(i[1]),this.startDistance=Jl.distance(t,i),this.multiTouch=!0,e.preventDefault())}handleTouchMove(e){let t=ra(e);this.cachedPoints.set(t,this.getTouchPoint(e)),this.isPinchZoomEnabled&&2===this.cachedPoints.size?this.handlePinch(e):(this.updateFromEvent(e),this.workspaceDragger?this.workspaceDragger.drag(this.currentDragDeltaXY):this.dragger&&this.dragger.onDrag(this.mostRecentEvent,this.currentDragDeltaXY),e.preventDefault(),e.stopPropagation())}handlePinch(e){var t=Array.from(this.cachedPoints.keys()),i=this.cachedPoints.get(t[0]);if(t=this.cachedPoints.get(t[1]),i=Jl.distance(i,t)/this.startDistance,this.previousScale>0&&this.previousScale<1/0){if(t=(t=i-this.previousScale)>0?5*t:6*t,!this.startWorkspace_)throw Error("Cannot handle a pinch because the start workspace is undefined");let n=this.startWorkspace_,o=da(e,n.getParentSvg(),n.getInverseScreenCTM());n.zoom(o.x,o.y,t)}this.previousScale=i,e.preventDefault()}handleTouchEnd(e){e=ra(e),this.cachedPoints.has(e)&&this.cachedPoints.delete(e),this.cachedPoints.size<2&&(this.cachedPoints.clear(),this.previousScale=0)}getTouchPoint(e){return this.startWorkspace_?new Jl(e.pageX,e.pageY):null}isMultiTouch(){return this.multiTouch}cancel(){this.isEnding_||(ia(),this.dragger?this.dragger.onDragEnd(this.mostRecentEvent,this.currentDragDeltaXY):this.workspaceDragger&&this.workspaceDragger.endDrag(this.currentDragDeltaXY),this.dispose())}handleRightClick(e){let t=Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode();if(ar(t)){let i;null==(i=this.startWorkspace_)||i.hideChaff(!!this.flyout),t.showContextMenu(e)}e.preventDefault(),e.stopPropagation(),Lp.setIsActive(!1),this.dispose()}handleWsStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace(t),this.mostRecentEvent=e,this.targetBlock||this.startBubble||this.startComment||this.startIcon||Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(t),this.doStart(e)}fireWorkspaceClick(e){t(new(h(ja.CLICK))(null,e.id,"workspace"))}handleFlyoutStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout(t),this.handleWsStart(e,t.getWorkspace())}handleBlockStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(t),this.mostRecentEvent=e}handleBubbleStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(t),this.mostRecentEvent=e}handleCommentStart(e,t){if(this.gestureHasStarted)throw Error("Tried to call gesture.handleCommentStart, but the gesture had already been started.");this.setStartComment(t),this.mostRecentEvent=e}doFieldClick(){if(!this.startField)throw Error("Cannot do a field click because the start field is undefined");this.currentDropdownOwner!==this.startField&&this.startField.showEditor(this.mostRecentEvent)}doIconClick(){if(!this.startIcon)throw Error("Cannot do an icon click because the start icon is undefined");this.startIcon.onClick()}doBlockClick(){if(this.flyout&&this.flyout.autoClose){if(!this.targetBlock)throw Error("Cannot do a block click because the target block is undefined");if(this.flyout.isBlockCreatable(this.targetBlock)){Xs.getGroup$$module$build$src$core$events$utils()||Xs.setGroup$$module$build$src$core$events$utils(!0);var e=this.flyout.createBlock(this.targetBlock);e.snapToGrid(),e.bumpNeighbours(),Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}}else{if(!this.startWorkspace_)throw Error("Cannot do a block click because the start workspace is undefined");
3e=new(h(ja.CLICK))(this.startBlock,this.startWorkspace_.id,"block"),t(e)}Xs.setGroup$$module$build$src$core$events$utils(!1)}doWorkspaceClick(e){this.fireWorkspaceClick(this.startWorkspace_||this.creatorWorkspace)}setStartField(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField||=e}setStartIcon(e){if(this.gestureHasStarted)throw Error("Tried to call gesture.setStartIcon, but the gesture had already been started.");this.startIcon||=e}setStartBubble(e){this.startBubble||=e}setStartComment(e){this.startComment||=e}setStartBlock(e){this.startBlock||this.startBubble||this.startIcon||(this.startBlock=e,e.isInFlyout&&e!==e.getRootBlock()?this.setTargetBlock(e.getRootBlock()):this.setTargetBlock(e))}setTargetBlock(e){e.isShadow()?this.setTargetBlock(e.getParent()):(this.targetBlock=e,Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.targetBlock),this.targetBlock.bringToFront())}setStartWorkspace(e){this.startWorkspace_||=e}setStartFlyout(e){this.flyout||=e}isBubbleClick(){return!!this.startBubble&&!this.hasExceededDragRadius}isCommentClick(){return!!this.startComment&&!this.hasExceededDragRadius}isBlockClick(){return!(!this.startBlock||this.hasExceededDragRadius||this.isFieldClick()||this.isIconClick())}isFieldClick(){return!!this.startField&&(this.startField.isClickable()&&!this.hasExceededDragRadius&&(!this.flyout||this.startField.isClickableInFlyout(this.flyout.autoClose)))}isIconClick(){if(!this.startIcon)return!1;let e=!this.flyout||!this.startIcon.isClickableInFlyout||this.startIcon.isClickableInFlyout(this.flyout.autoClose);return!this.hasExceededDragRadius&&e}isWorkspaceClick(){return!(this.startBlock||this.startBubble||this.startField||this.hasExceededDragRadius)}getCurrentDragger(){return this.workspaceDragger??this.dragger??null}isDragging(){return this.dragging}hasStarted(){return this.gestureHasStarted}static inProgress(){let e=N();for(let t,i=0;t=e[i];i++)if(t.currentGesture_)return!0;return!1}},Mp=class{constructor(e,t){this.pattern=e,this.scale=1,this.spacing=t.spacing??0,this.length=t.length??1,this.line2=(this.line1=e.firstChild)&&this.line1.nextSibling,this.snapToGrid=t.snap??!1}setSpacing(e){this.spacing=e,this.update(this.scale)}getSpacing(){return this.spacing}setLength(e){this.length=e,this.update(this.scale)}getLength(){return this.length}setSnapToGrid(e){this.snapToGrid=e}shouldSnap(){return this.snapToGrid}getPatternId(){return this.pattern.id}update(e){this.scale=e;var t=this.spacing*e;this.pattern.setAttribute("width",`${t}`),this.pattern.setAttribute("height",`${t}`);let i=(t=Math.floor(this.spacing/2)+.5)-this.length/2,n=t+this.length/2;t*=e,i*=e,n*=e,this.setLineAttributes(this.line1,e,i,n,t,t),this.setLineAttributes(this.line2,e,t,t,i,n)}setLineAttributes(e,t,i,n,o,r){e&&(e.setAttribute("stroke-width",`${t}`),e.setAttribute("x1",`${i}`),e.setAttribute("y1",`${o}`),e.setAttribute("x2",`${n}`),e.setAttribute("y2",`${r}`))}moveTo(e,t){this.pattern.setAttribute("x",`${e}`),this.pattern.setAttribute("y",`${t}`)}alignXY(e){var t=this.getSpacing();let i=t/2,n=Math.round(Math.round((e.x-i)/t)*t+i);return t=Math.round(Math.round((e.y-i)/t)*t+i),n===e.x&&t===e.y?e:new Jl(n,t)}static createDom(e,t,i,n){if(e=p(Zl.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},i),(t.length??1)>0&&(t.spacing??0)>0){let i;p(Zl.LINE,{stroke:t.colour},e),null!=(i=t.length)&&i&&p(Zl.LINE,{stroke:t.colour},e)}else p(Zl.LINE,{},e);return n&&n.style.setProperty("--blocklyGridPattern",`url(#${e.id})`),e}},xp=class{constructor(e){this.workspace=e,this.layers=new Map,(e=e.getInjectionDiv())&&(this.dragLayer=this.createDragLayer(e),this.animationLayer=this.createAnimationLayer(e)),e=this.createLayer(Hh),f(e,"blocklyBlockCanvas"),e=this.createLayer(Vh),f(e,"blocklyBubbleCanvas")}createDragLayer(e){let t=p(Zl.SVG,{class:"blocklyBlockDragSurface",xmlns:bl,"xmlns:html":Ol,"xmlns:xlink":vl,version:"1.1"});return e.append(t),p(Zl.G,{},t)}createAnimationLayer(e){let t=p(Zl.SVG,{class:"blocklyAnimationLayer",xmlns:bl,"xmlns:html":Ol,"xmlns:xlink":vl,version:"1.1"});return e.append(t),p(Zl.G,{},t)}appendToAnimationLayer(e){let t,i=this.dragLayer?.getAttribute("transform");if(i){let e;null==(e=this.animationLayer)||e.setAttribute("transform",i)}null==(t=this.animationLayer)||t.appendChild(e.getSvgRoot())}translateLayers(e,t){let i;e=`translate(${e.x}, ${e.y}) scale(${t})`,null==(i=this.dragLayer)||i.setAttribute("transform",e);for(let[,n]of this.layers)n.setAttribute("transform",e)}moveToDragLayer(e,t=!0){let i;null==(i=this.dragLayer)||i.appendChild(e.getSvgRoot()),t&&e.canBeFocused()&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}moveOffDragLayer(e,t,i=!0){this.append(e,t),i&&e.canBeFocused()&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}append(e,t){if(this.layers.has(t)||this.createLayer(t),e=e.getSvgRoot(),this.layers.get(t)?.lastChild!==e){let i;null==(i=this.layers.get(t))||i.appendChild(e)}}createLayer(e){let t=this.workspace.getSvgGroup(),i=p(Zl.G,{}),n=!1,o=[...this.layers].sort((e,t)=>
3e[0]-t[0]);for(let[r,s]of o)if(e<r){t.insertBefore(i,s),n=!0;break}return n||t.appendChild(i),this.layers.set(e,i),i}hasLayer(e){return e===this.dragLayer||new Set(this.layers.values()).has(e)}getBlockLayer(){return this.layers.get(Hh)}getBubbleLayer(){return this.layers.get(Vh)}getDragLayer(){return this.dragLayer}},Dp=class{constructor(){this.curNode=this.colour=null,this.type="marker"}getCurNode(){return this.curNode}setCurNode(e){this.curNode=e}dispose(){this.curNode=null}getSourceBlockFromNode(e){return e instanceof ep?e:e instanceof vh||e instanceof Pd||e instanceof _d?e.getSourceBlock():null}getSourceBlock(){return this.getSourceBlockFromNode(this.getCurNode())}},Pp=class extends Dp{constructor(e){super(),this.workspace=e,this.type="cursor",this.potentialNodes=null}next(){var e=this.getCurNode();return e?((e=this.getNextNode(e,e=>{let t;return e instanceof ep&&!(null!=(t=e.outputConnection)&&t.targetBlock())||e instanceof id},!0))&&this.setCurNode(e),e):null}in(){var e=this.getCurNode();return e?((e=this.getNextNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}prev(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,e=>{let t;return e instanceof ep&&!(null!=(t=e.outputConnection)&&t.targetBlock())||e instanceof id},!0))&&this.setCurNode(e),e):null}out(){var e=this.getCurNode();return e?((e=this.getPreviousNode(e,()=>!0,!0))&&this.setCurNode(e),e):null}atEndOfLine(){var e=this.getCurNode();if(!e)return!1;let t=this.getNextNode(e,()=>!0,!0);return e=this.getNextNode(e,e=>{let t;return e instanceof ep&&!(null!=(t=e.outputConnection)&&t.targetBlock())},!0),t===e}getNextNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let n=this.workspace.getNavigator().getFirstChild(e)||this.workspace.getNavigator().getNextSibling(e);for(var o=e;o&&!n&&(o=this.workspace.getNavigator().getParent(o));)n=this.workspace.getNavigator().getNextSibling(o);return t(n)?n:n?(i.add(e),this.getNextNodeImpl(n,t,i)):null}getNextNode(e,t,i){return!e||!i&&this.getLastNode()===e?null:this.getNextNodeImpl(e,t)}getPreviousNodeImpl(e,t,i=new Set){if(!e||i.has(e))return null;let n=this.getRightMostChild(this.workspace.getNavigator().getPreviousSibling(e),e)||this.workspace.getNavigator().getParent(e);return t(n)?n:n?(i.add(e),this.getPreviousNodeImpl(n,t,i)):null}getPreviousNode(e,t,i){return!e||!i&&this.getFirstNode()===e?null:this.getPreviousNodeImpl(e,t)}getRightMostChild(e,t){if(!e)return e;let i=this.workspace.getNavigator().getFirstChild(e);if(!i||i===t)return e;for(e=i;e&&e!==t;e=this.workspace.getNavigator().getNextSibling(i))i=e;return this.getRightMostChild(i,t)}preDelete(e){var t,i=this.getCurNode();i=i?[i]:[];let n=e.previousConnection?.targetConnection??e.outputConnection?.targetConnection;n&&i.push(n),(t=e.getNextBlock())&&i.push(t),(e=e.getParent())&&i.push(e),i.push(this.workspace),this.potentialNodes=i}postDelete(){let e=this.potentialNodes;if(this.potentialNodes=null,!e)throw Error("must call preDelete first");for(let t of e){let e;if(null==(e=this.getSourceBlockFromNode(t))||!e.disposed)return void this.setCurNode(t)}throw Error("no valid nodes in this.potentialNodes")}getCurNode(){return Xs.getFocusManager$$module$build$src$core$focus_manager().getFocusedNode()}setCurNode(e){Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e)}getFirstNode(){return this.workspace.getNavigator().getFirstChild(this.workspace)}getLastNode(){let e=this.getFirstNode();return this.getPreviousNode(e,()=>!0,!0)}};zs(ka.CURSOR,Ca,Pp);var Fp=class{constructor(e){this.workspace=e,this.markers=new Map,this.cursor=new Pp(this.workspace)}registerMarker(e,t){this.markers.has(e)&&this.unregisterMarker(e),this.markers.set(e,t)}unregisterMarker(e){let t=this.markers.get(e);if(!t)throw Error("Marker with ID "+e+" does not exist. Can only unregister markers that exist.");t.dispose(),this.markers.delete(e)}getCursor(){return this.cursor}getMarker(e){return this.markers.get(e)||null}setCursor(e){this.cursor=e}dispose(){let e=Object.keys(this.markers);for(let t,i=0;t=e[i];i++)this.unregisterMarker(t);this.markers.clear(),this.cursor.dispose()}};Fp.LOCAL_MARKER="local_marker_1";var Bp={};Bp.CommentIcon=Ep,Bp.Icon=_d,Bp.IconType=Lu,Bp.MutatorIcon=Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon,Bp.WarningIcon=Zd,Bp.exceptions=wd,Bp.registry=_p;Xs.Names$$module$build$src$core$names=class{constructor(e,t){this.db=new Map,this.dbRever
3se=new Set,this.variableMap=null,this.variablePrefix=t||"",this.reservedWords=new Set(e?e.split(","):[])}reset(){this.db.clear(),this.dbReverse.clear(),this.variableMap=null}setVariableMap(e){this.variableMap=e}getNameForUserVariable(e){return this.variableMap?(e=this.variableMap.getVariableById(e))?e.getName():null:(console.warn("Deprecated call to 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)}populateVariables(e){e=Xs.allUsedVarModels$$module$build$src$core$variables(e);for(let t=0;t<e.length;t++)this.getName(e[t].getId(),Xs.NameType$$module$build$src$core$names.VARIABLE)}populateProcedures(e){throw Error("The implementation of populateProcedures should be monkey-patched in by blockly.ts")}getName(e,t){let i=e;t===Xs.NameType$$module$build$src$core$names.VARIABLE&&(e=this.getNameForUserVariable(e))&&(i=e),e=i.toLowerCase();let n=t===Xs.NameType$$module$build$src$core$names.VARIABLE||t===Xs.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"";this.db.has(t)||this.db.set(t,new Map);let o=this.db.get(t);return o.has(e)?n+o.get(e):(t=this.getDistinctName(i,t),o.set(e,t.substr(n.length)),t)}getUserNames(e){return(e=this.db.get(e)?.keys())?Array.from(e):[]}getDistinctName(e,t){e=this.safeName(e);let i=null;for(;this.dbReverse.has(e+(i??""))||this.reservedWords.has(e+(i??""));)i=i?i+1:2;return e+=i??"",this.dbReverse.add(e),(t===Xs.NameType$$module$build$src$core$names.VARIABLE||t===Xs.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE?this.variablePrefix:"")+e}safeName(e){return e?(e=encodeURI(e.replace(/ /g,"_")).replace(/[^\w]/g,"_"),"0123456789".includes(e[0])&&(e="my_"+e)):e=Xs.Msg$$module$build$src$core$msg.UNNAMED_KEY||"unnamed",e}static equals(e,t){return e.toLowerCase()===t.toLowerCase()}},function(e){(e=e.NameType||={}).DEVELOPER_VARIABLE="DEVELOPER_VARIABLE",e.VARIABLE="VARIABLE",e.PROCEDURE="PROCEDURE"}(Xs.Names$$module$build$src$core$names||={}),Xs.NameType$$module$build$src$core$names=Xs.Names$$module$build$src$core$names.NameType,Xs.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE=Xs.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE,{NameType:Xs.NameType$$module$build$src$core$names}.Names=Xs.Names$$module$build$src$core$names;var Up,Hp=class extends Map{constructor(){super()}set(e,t){return this.get(e)===t||(super.set(e,t),hr(t)&&t.startPublishing()),this}delete(e){let t=this.get(e);return(e=super.delete(e))&&(hr(t)&&t.stopPublishing(),e)}clear(){if(this.size)for(let e of this.keys())this.delete(e)}add(e){return this.set(e.getId(),e)}getProcedures(){return[...this.values()]}},Vp="PROCEDURE";Xs.DEFAULT_ARG$$module$build$src$core$procedures="x",(Up={CATEGORY_NAME:Vp,DEFAULT_ARG:Xs.DEFAULT_ARG$$module$build$src$core$procedures}).ObservableProcedureMap=Hp,Up.allProcedures=dr,Up.findLegalName=Xs.findLegalName$$module$build$src$core$procedures,Up.flyoutCategory=_r,Up.getCallers=vr,Up.getDefinition=Xs.getDefinition$$module$build$src$core$procedures,Up.internalFlyoutCategory=Tr,Up.isNameUsed=gr,Up.isProcedureBlock=ur,Up.mutateCallers=Xs.mutateCallers$$module$build$src$core$procedures,Up.mutatorOpenListener=br,Up.rename=Xs.rename$$module$build$src$core$procedures;var Gp=new class{constructor(){this.NONE=0,this.FIELD=1,this.HAT=2,this.ICON=4,this.SPACER=8,this.BETWEEN_ROW_SPACER=16,this.IN_ROW_SPACER=32,this.EXTERNAL_VALUE_INPUT=64,this.INPUT=128,this.INLINE_INPUT=256,this.STATEMENT_INPUT=512,this.CONNECTION=1024,this.PREVIOUS_CONNECTION=2048,this.NEXT_CONNECTION=4096,this.OUTPUT_CONNECTION=8192,this.CORNER=16384,this.LEFT_SQUARE_CORNER=32768,this.LEFT_ROUND_CORNER=65536,this.RIGHT_SQUARE_CORNER=131072,this.RIGHT_ROUND_CORNER=262144,this.JAGGED_EDGE=524288,this.ROW=1048576,this.TOP_ROW=2097152,this.BOTTOM_ROW=4194304,this.INPUT_ROW=8388608,this.LEFT_CORNER=this.LEFT_SQUARE_CORNER|this.LEFT_ROUND_CORNER,this.RIGHT_CORNER=this.RIGHT_SQUARE_CORNER|this.RIGHT_ROUND_CORNER,this.nextTypeValue_=16777216}getType(e){return Object.prototype.hasOwnProperty.call(this,e)||(this[e]=this.nextTypeValue_,this.nextTypeValue_<<=1),this[e]}isField(e){return(e.type&this.FIELD)>=1}isHat(e){return(e.type&this.HAT)>=1}isIcon(e){return(e.type&this.ICON)>=1}isSpacer(e){return(e.type&this.SPACER)>=1}isInRowSpacer(e){return(e.type&this.IN_ROW_SPACER)>=1}isSpacerRow(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isInput(e){return(e.type&this.INPUT)>=1}isExternalInput(e){return(e.type&this.EXTERNAL_VALUE_INPUT)>=1}isInlineInput(e){return(e.type&this.INLINE_INPUT)>=1}isStatementInput(e){return(e.type&this.STATEMENT_INPUT)>=1}isPreviousConnection(e){return(e.type&this.PREVIOUS_CONNECTION)>=1}isNextConnection(e){return(e.type&this.NEXT_CONNECTION)>=1}isPreviousOrNextConnection(e){return this.isPreviousConnection(e)||this.isNext
3Connection(e)}isRoundCorner(e){return(e.type&this.LEFT_ROUND_CORNER)>=1||(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.LEFT_ROUND_CORNER)>=1}isRightRoundedCorner(e){return this.isRoundCorner(e)&&(e.type&this.RIGHT_ROUND_CORNER)>=1}isLeftSquareCorner(e){return(e.type&this.LEFT_SQUARE_CORNER)>=1}isRightSquareCorner(e){return(e.type&this.RIGHT_SQUARE_CORNER)>=1}isCorner(e){return(e.type&this.CORNER)>=1}isJaggedEdge(e){return(e.type&this.JAGGED_EDGE)>=1}isRow(e){return(e.type&this.ROW)>=1}isBetweenRowSpacer(e){return(e.type&this.BETWEEN_ROW_SPACER)>=1}isTopRow(e){return(e.type&this.TOP_ROW)>=1}isBottomRow(e){return(e.type&this.BOTTOM_ROW)>=1}isTopOrBottomRow(e){return this.isTopRow(e)||this.isBottomRow(e)}isInputRow(e){return(e.type&this.INPUT_ROW)>=1}},Wp=class{constructor(e){this.centerline=this.xPos=this.height=this.width=0,this.constants_=e,this.type=Gp.NONE,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}},Xp=class{constructor(e){this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasStatement=this.hasExternalInput=!1,this.statementEdge=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=!1,this.align=null,this.constants_=e,this.type=Gp.ROW,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT}getLastInput(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(Gp.isInput(t))return t}return null}measure(){throw Error("Unexpected attempt to measure a base Row.")}startsWithElemSpacer(){return!0}endsWithElemSpacer(){return!0}getFirstSpacer(){for(let e=0;e<this.elements.length;e++){let t=this.elements[e];if(Gp.isInRowSpacer(t))return t}return null}getLastSpacer(){for(let e=this.elements.length-1;e>=0;e--){let t=this.elements[e];if(Gp.isInRowSpacer(t))return t}return null}},zp=class extends Xp{constructor(e){super(e),this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0,this.type|=Gp.BOTTOM_ROW}hasLeftSquareCorner(e){return!!e.outputConnection||!!e.getNextBlock()}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let n=0;n<this.elements.length;n++){let o=this.elements[n];t+=o.width,Gp.isSpacer(o)||(Gp.isNextConnection(o)?i=Math.max(i,o.height):e=Math.max(e,o.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.descenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},jp=class extends Wp{constructor(e,t){super(e),this.connectionModel=t,this.type|=Gp.CONNECTION,this.shape=this.constants_.shapeFor(t),this.isDynamicShape="isDynamic"in this.shape&&this.shape.isDynamic,this.highlighted=t.isHighlighted()}},Yp=class extends jp{constructor(e,t){super(e,t.connection),this.input=t,this.connectionOffsetY=this.connectionOffsetX=0,this.type|=Gp.INPUT,this.align=t.align,(this.connectedBlock=t.connection&&t.connection.targetBlock()?t.connection.targetBlock():null)?(e=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=e.width,this.connectedBlockHeight=e.height):this.connectedBlockHeight=this.connectedBlockWidth=0}},Qp=class extends Yp{constructor(e,t){super(e,t),this.height=0,this.type|=Gp.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}},Kp=class extends Wp{constructor(e,t,i){super(e),this.field=t,this.parentInput=i,this.isEditable=t.EDITABLE,this.flipRtl=t.getFlipRtl(),this.type|=Gp.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width}},qp=class extends Wp{constructor(e){super(e),this.type|=Gp.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height}},Jp=class extends Wp{constructor(e,t){super(e),this.icon=t,this.flipRtl=!1,this.type|=Gp.ICON,e=t.getSize(),this.height=e.height,this.width=e.width}},Zp=class extends Wp{constructor(e,t){super(e),this.type|=Gp.SPACER|Gp.IN_ROW_SPACER,this.width=t,this.height=this.constants_.SPACER_DEFAULT_HEIGHT}},ef=class extends Yp{constructor(e,t){super(e,t),this.type|=Gp.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="connectionOffsetY"in this.shape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX="connectionOffsetX"in this.shape?this.shape.connectionOffsetX(this.connectionWidth):0}},tf=class extends Xp{constructor(e){super(e),this.connectedBlockWidths=0,this.type|=Gp.INPUT_ROW}measure(){this.width=this.minWidth,this.height=this.minHeight;let e=0;for(let t=0;t<this.elements.length;t++){let i=this.elements[t];this.width+=i.width,Gp.isInput(i)&&(Gp.isStatementInput(i)?e+=i.connectedBlockWidth:Gp.isExternalInput(i)&&0!==i.connectedBlockWidth&&(e+=i.connectedBlockWidth-i.connectionWidth)),Gp.isSpacer(i)||(this.height=Math.max(this.height,i.height))}this.connectedBlockWidths=e,this.widthWithConnectedBlocks=this.width+e}endsWithElemSpacer(){return!this.hasExternalInput&&!this.hasStatement}},nf=class extends Wp{constructor(e){super(e),this.type|=Gp.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width}},of=class extends jp{constructor(e,t){super(e,t),this.type|=Gp.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},rf=class extends jp{constructor(e,t){super(e,t),this.connectionOffsetX=0,this.type|=Gp.OUTPUT_CONNECTION,this.height=this.isDynamicShape?
30:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP}},sf=class extends jp{constructor(e,t){super(e,t),this.type|=Gp.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width}},af=class extends Wp{constructor(e,t){super(e),this.type=(t&&"left"!==t?Gp.RIGHT_ROUND_CORNER:Gp.LEFT_ROUND_CORNER)|Gp.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2}},lf=class extends Xp{constructor(e,t,i){super(e),this.height=t,this.width=i,this.precedesStatement=this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.type|=Gp.SPACER|Gp.BETWEEN_ROW_SPACER,this.elements=[new Zp(this.constants_,i)]}measure(){}},cf=class extends Wp{constructor(e,t){super(e),this.type=(t&&"left"!==t?Gp.RIGHT_SQUARE_CORNER:Gp.LEFT_SQUARE_CORNER)|Gp.CORNER,this.width=this.height=this.constants_.NO_PADDING}},uf=class extends Yp{constructor(e,t){super(e,t),this.type|=Gp.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}},hf=class extends Xp{constructor(e){super(e),this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null,this.type|=Gp.TOP_ROW}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection,i=e.getPreviousBlock();return!!e.outputConnection||t||!!i&&i.getNextBlock()===e}hasRightSquareCorner(e){return!0}measure(){let e=0,t=0,i=0;for(let n=0;n<this.elements.length;n++){let o=this.elements[n];t+=o.width,Gp.isSpacer(o)||(Gp.isHat(o)?i=Math.max(i,o.ascenderHeight):e=Math.max(e,o.height))}this.width=Math.max(this.minWidth,t),this.height=Math.max(this.minHeight,e)+i,this.capline=this.ascenderHeight=i,this.widthWithConnectedBlocks=this.width}startsWithElemSpacer(){return!1}endsWithElemSpacer(){return!1}},df=class{constructor(){this.NO_PADDING=0,this.SMALL_PADDING=3,this.MEDIUM_PADDING=5,this.MEDIUM_LARGE_PADDING=8,this.LARGE_PADDING=10,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.CORNER_RADIUS=8,this.NOTCH_OFFSET_LEFT=15,this.STATEMENT_BOTTOM_SPACER=0,this.STATEMENT_INPUT_PADDING_LEFT=20,this.BETWEEN_STATEMENT_PADDING_Y=4,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.EXTERNAL_VALUE_INPUT_PADDING=2,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_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1,this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12,this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1,this.FIELD_COLOUR_DEFAULT_WIDTH=26,this.defs=null,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},this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING,this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT,this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT,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.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11,this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT,this.START_POINT=wo(0,0),this.FIELD_TEXT_BASELINE_CENTER=!0,this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT,this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3
3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",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)}init(){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()}setTheme(e){this.blockStyles=Object.create(null);let t=e.blockStyles;for(let i in t)this.blockStyles[i]=this.validatedBlockStyle_(t[i]);this.setDynamicProperties_(e)}setDynamicProperties_(e){this.setFontConstants_(e),this.setComponentConstants_(e),this.ADD_START_HATS=void 0===e.startHats?this.ADD_START_HATS:e.startHats}setFontConstants_(e){e.fontStyle&&e.fontStyle.family&&(this.FIELD_TEXT_FONTFAMILY=e.fontStyle.family),e.fontStyle&&e.fontStyle.weight&&(this.FIELD_TEXT_FONTWEIGHT=e.fontStyle.weight),e.fontStyle&&e.fontStyle.size&&(this.FIELD_TEXT_FONTSIZE=e.fontStyle.size),e=R("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}setComponentConstants_(e){this.CURSOR_COLOUR=e.getComponentStyle("cursorColour")||this.CURSOR_COLOUR,this.MARKER_COLOUR=e.getComponentStyle("markerColour")||this.MARKER_COLOUR,this.INSERTION_MARKER_COLOUR=e.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR,this.INSERTION_MARKER_OPACITY=Number(e.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY}getBlockStyleForColour(e){let t="auto_"+e;return this.blockStyles[t]||(this.blockStyles[t]=this.createBlockStyle_(e)),{style:this.blockStyles[t],name:t}}getBlockStyle(e){return this.blockStyles[e||""]||(e&&e.startsWith("auto_")?this.getBlockStyleForColour(e.substring(5)).style:this.createBlockStyle_("#000000"))}createBlockStyle_(e){return this.validatedBlockStyle_({colourPrimary:e})}validatedBlockStyle_(e){let t={};return e&&Object.assign(t,e),e=cn(t.colourPrimary||"#000"),t.colourPrimary=e.hex,t.colourSecondary=t.colourSecondary?cn(t.colourSecondary).hex:this.generateSecondaryColour_(t.colourPrimary),t.colourTertiary=t.colourTertiary?cn(t.colourTertiary).hex:this.generateTertiaryColour_(t.colourPrimary),t.hat=t.hat||"",t}generateSecondaryColour_(e){return nn("#fff",e,.6)||e}generateTertiaryColour_(e){return nn("#fff",e,.3)||e}dispose(){this.embossFilter&&_(this.embossFilter),this.disabledPattern&&_(this.disabledPattern),this.debugFilter&&_(this.debugFilter),this.cssNode=null}makeJaggedTeeth(){let e=this.JAGGED_TEETH_HEIGHT,t=this.JAGGED_TEETH_WIDTH;return{height:e,width:t,path:Mo([Ao(t,e/4),Ao(2*-t,e/2),Ao(t,e/4)])}}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH;return{height:.75*e,width:t,path:Lo("c",[Ao(30,-e),Ao(70,-e),Ao(t,0)])}}makePuzzleTab(){function e(e){let n=-(e=e?-1:1);var o=i/2;let r=o+2.5,s=o+.5,a=Ao(-t,e*o);return o=Ao(t,e*o),Lo("c",[Ao(0,e*r),Ao(-t,n*s),a])+Lo("s",[Ao(t,2.5*n),o])}let t=this.TAB_WIDTH,i=this.TAB_HEIGHT,n=e(!0),o=e(!1);return{type:this.SHAPES.PUZZLE,width:t,height:i,pathDown:o,pathUp:n}}makeNotch(){function e(e){return Mo([Ao(e*n,i),Ao(3*e,0),Ao(e*n,-i)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,n=(t-3)/2,o=e(1),r=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:o,pathRight:r}}makeInsideCorners(){let e=this.CORNER_RADIUS;return{width:e,height:e,pathTop:Do("a","0 0,0",e,Ao(-e,e)),pathBottom:Do("a","0 0,0",e,Ao(e,e))}}makeOutsideCorners(){let e=this.CORNER_RADIUS,t=wo(0,e)+Do("a","0 0,1",e,Ao(e,-e)),i=Do("a","0 0,1",e,Ao(e,e)),n=Do("a","0 0,1",e,Ao(-e,-e));return{topLeft:t,topRight:i,bottomRight:Do("a","0 0,1",e,Ao(-e,e)),bottomLeft:n,rightHeight:e}}shapeFor(e){switch(e.type){case Rd.INPUT_VALUE:case Rd.OUTPUT_VALUE:return this.PUZZLE_TAB;case Rd.PREVIOUS_STATEMENT:case Rd.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type")}}createDom(e,t,i,n){this.injectCSS_(t,i),this.defs=p(Zl.DEFS,{},e),e=p(Zl.FILTER,{id:"blocklyEmbossFilter"+this.randomIdentifier},this.defs),p(Zl.FEGAUSSIANBLUR,{in:"SourceAlpha",stdDeviation:1,result:"blur"},e),t=p(Zl.FESPECULARLIGHTING,{in:"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"},e),p(Zl.FEPOINTLIGHT,{x:-5e3,y:-1e4,z:2e4},t),p(Zl.FECOMPOSITE,{in:"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},e),p(Zl.FECOMPOSITE,{in:"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},e),this.embossFilterId=e.id,this.embossFilter=e,e=p(Zl.PATTERN,{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse",width:10,height:10},this.defs),p(Zl.RECT,{width:10,height:10,fill:"#aaa"},e),p(Zl.PATH,{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},e),this.disabledPatternId=e.id,this.disabledPattern=e,this.createDebugFilter(),n&&(n.style.setProperty("--blocklyEmbossFilter",`url(#${this.embossFilterId}
3)`),n.style.setProperty("--blocklyDisabledPattern",`url(#${this.disabledPatternId})`),n.style.setProperty("--blocklyDebugFilter",`url(#${this.debugFilterId})`))}createDebugFilter(){if(!this.debugFilter){let e=p(Zl.FILTER,{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},this.defs),t=p(Zl.FECOMPONENTTRANSFER,{result:"outBlur"},e);p(Zl.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),p(Zl.FEFLOOD,{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},e),p(Zl.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),this.debugFilterId=e.id,this.debugFilter=e}}injectCSS_(e,t){t=this.getCSS_(t),e="blockly-renderer-style-"+e,this.cssNode=document.getElementById(e);let i=t.join("\n");this.cssNode?this.cssNode.firstChild.textContent=i:((t=document.createElement("style")).id=e,e=document.createTextNode(i),t.appendChild(e),document.head.insertBefore(t,document.head.firstChild),this.cssNode=t)}getCSS_(e){return[`${e} .blocklyText, `,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableField>rect,`,`${e} .blocklyEditableField>rect {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"fill-opacity: .6;","stroke: none;","}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text {`,"fill: #000;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #000;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #000;","}",`${e} .blocklyEditableField:not(.blocklyEditing):hover>rect {`,"stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"}",`${e} .blocklySelected>.blocklyPath {`,"stroke: #fc3;","stroke-width: 3px;","}",`${e} .blocklyHighlightedConnectionPath {`,"stroke: #fc3;","}",`${e} .blocklyReplaceable .blocklyPath {`,"fill-opacity: .5;","}",`${e} .blocklyReplaceable .blocklyPathLight,`,`${e} .blocklyReplaceable .blocklyPathDark {`,"display: none;","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"]}},pf={};pf.ConstantProvider=df,pf.isDynamicShape=Sr,pf.isNotch=Rr,pf.isPuzzleTab=yr;var ff=class{constructor(e,t){this.inlinePath_=this.outlinePath_="",this.block_=e,this.info_=t,this.topLeft_=e.getRelativeToSurfaceXY(),this.constants_=t.getRenderer().getConstants()}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),this.block_.pathObject.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&this.block_.pathObject.flipRTL(),this.recordSizeOnBlock_()}recordSizeOnBlock_(){this.block_.height=this.info_.height,this.block_.width=this.info_.widthWithChildren,this.block_.childlessWidth=this.info_.width}drawOutline_(){this.drawTop_();for(let e=1;e<this.info_.rows.length-1;e++){let t=this.info_.rows[e];t.hasJaggedEdge?this.drawJaggedEdge_(t):t.hasStatement?this.drawStatementInput_(t):t.hasExternalInput?this.drawValueInput_(t):this.drawRightSideRow_(t)}this.drawBottom_(),this.drawLeft_()}drawTop_(){let e=this.info_.topRow,t=e.elements;this.positionPreviousConnection_(),this.outlinePath_+=wo(e.xPos,this.info_.startY);for(let i,n=0;i=t[n];n++)Gp.isLeftRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topLeft:Gp.isRightRoundedCorner(i)?this.outlinePath_+=this.constants_.OUTSIDE_CORNERS.topRight:Gp.isPreviousConnection(i)?this.outlinePath_+=i.shape.pathLeft:Gp.isHat(i)?this.outlinePath_+=this.constants_.START_HAT.path:Gp.isSpacer(i)&&(this.outlinePath_+=xo("h",i.width));this.outlinePath_+=xo("v",e.height-e.ascenderHeight)}drawJaggedEdge_(e){this.outlinePath_+=this.constants_.JAGGED_TEETH.path+xo("v",e.height-this.constants_.JAGGED_TEETH.height)}drawValueInput_(e){let t=e.getLastInput();this.positionExternalValueConnection_(e);let i=Sr(t.shape)?t.shape.pathDown(t.height):t.shape.pathDown;this.outlinePath_+=xo("H",t.xPos+t.width)+i+xo("v",e.height-t.connectionHeight)}drawStatementInput_(e){var t=e.getLastInput();if(t){var i=t.xPos+t.notchOffset+t.shape.width;t=t.shape.pathRight+xo("h",-(t.notchOffset-this.constants_.INSIDE_CORNERS.width))+this.constants_.INSIDE_CORNERS.pathTop;var n=e.height-2*this.constants_.INSIDE_CORNERS.height;this.outlinePath_+=xo("H",i)+t+xo("v",n)+this.constants_.INSIDE_CORNERS.pathBottom+xo("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}}drawRightSideRow_(e){this.outlinePath_+=xo("V",e.yPos+e.height)}drawBottom_(){let e=this.info_.bottomRow,t=e.elements;this.positionNextConnection_();let i=0,n="";for(let o,r=t.length-1;o=t[r];
3r--)Gp.isNextConnection(o)?n+=o.shape.pathRight:Gp.isLeftSquareCorner(o)?n+=xo("H",e.xPos):Gp.isLeftRoundedCorner(o)?n+=this.constants_.OUTSIDE_CORNERS.bottomLeft:Gp.isRightRoundedCorner(o)?(n+=this.constants_.OUTSIDE_CORNERS.bottomRight,i=this.constants_.OUTSIDE_CORNERS.rightHeight):Gp.isSpacer(o)&&(n+=xo("h",-1*o.width));this.outlinePath_+=xo("V",e.baseline-i),this.outlinePath_+=n}drawLeft_(){var e=this.info_.outputConnection;if(this.positionOutputConnection_(),e){let t=e.connectionOffsetY+e.height;e=Sr(e.shape)?e.shape.pathUp(e.height):e.shape.pathUp,this.outlinePath_+=xo("V",t)+e}this.outlinePath_+="z"}drawInternals_(){for(let e,t=0;e=this.info_.rows[t];t++)for(let i,n=0;i=e.elements[n];n++)Gp.isInlineInput(i)?this.drawInlineInput_(i):(Gp.isIcon(i)||Gp.isField(i))&&this.layoutField_(i)}layoutField_(e){let t=e.centerline-e.height/2,i=e.xPos;var n="";this.info_.RTL&&(i=-(i+e.width),e.flipRtl&&(i+=e.width,n="scale(-1 1)")),Gp.isIcon(e)?((n=e.icon).setOffsetInBlock(new Jl(i,t)),this.info_.isInsertionMarker&&n.hideForInsertionMarker()):((e=e.field.getSvgRoot()).setAttribute("transform","translate("+i+","+t+")"+n),this.info_.isInsertionMarker&&e.setAttribute("display","none"))}drawInlineInput_(e){let t=e.width,i=e.height,n=e.connectionOffsetY,o=e.connectionHeight+n;this.inlinePath_+=No(e.xPos+e.connectionWidth,e.centerline-i/2)+xo("v",n)+e.shape.pathDown+xo("v",i-o)+xo("h",t-e.connectionWidth)+xo("v",-i)+"z",this.positionInlineInputConnection_(e)}positionInlineInputConnection_(e){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+e.connectionOffsetX;this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null!=t&&t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionPreviousConnection_(){let e=this.info_.topRow;if(e.connection){let t=e.xPos+e.notchOffset;e.connection.connectionModel.setOffsetInBlock(this.info_.RTL?-t:t,0)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock(this.info_.RTL?-i:i,e.baseline)}}positionOutputConnection_(){if(this.info_.outputConnection){let e=this.info_.startX+this.info_.outputConnection.connectionOffsetX;this.block_.outputConnection.setOffsetInBlock(this.info_.RTL?-e:e,this.info_.outputConnection.connectionOffsetY)}}updateConnectionHighlights(){for(let e of this.info_.rows)for(let t of e.elements){if(!(t instanceof jp))continue;let e=this.drawConnectionHighlightPath(t);e&&(e.style.display=t.highlighted?"":"none")}}drawConnectionHighlightPath(e){let t=e.connectionModel;e=t.type===Rd.INPUT_VALUE||t.type===Rd.OUTPUT_VALUE?this.getExpressionConnectionHighlightPath(e):this.getStatementConnectionHighlightPath(e);let i,n=t.getSourceBlock();return(i=n.pathObject).addConnectionHighlight?.call(i,t,e,t.getOffsetInBlock(),n.RTL)}getExpressionConnectionHighlightPath(e){let t="";return Sr(e.shape)?t=e.shape.pathDown(e.height):yr(e.shape)&&(t=e.shape.pathDown),e=this.constants_.TAB_OFFSET_FROM_TOP,wo(0,-e)+xo("v",e)+t+xo("v",e)}getStatementConnectionHighlightPath(e){if(!Rr(e.shape))throw Error("Statement connections should have notch shapes");let t=this.constants_.NOTCH_OFFSET_LEFT-this.constants_.CORNER_RADIUS;return wo(-t,0)+xo("h",t)+e.shape.pathLeft+xo("h",t)}},gf=class{constructor(e,t){this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.startY=this.startX=0,this.renderer_=e,this.block_=t,this.constants_=this.renderer_.getConstants(),this.outputConnection=t.outputConnection?new rf(this.constants_,t.outputConnection):null,this.isInline=t.getInputsInline()&&!t.isCollapsed(),this.isCollapsed=t.isCollapsed(),this.isInsertionMarker=t.isInsertionMarker(),this.RTL=t.RTL,this.topRow=new hf(this.constants_),this.bottomRow=new zp(this.constants_)}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}createRows_(){this.populateTopRow_(),this.rows.push(this.topRow);let e=new tf(this.constants_);this.inputRows.push(e);var t=this.block_.getIcons();for(let i,n=0;i=t[n];
3n++){let t=new Jp(this.constants_,i);this.isCollapsed&&!i.isShownWhenCollapsed()||e.elements.push(t)}t=void 0;for(let i,n=0;i=this.block_.inputList[n];n++)if(i.isVisible()){this.shouldStartNewRow_(i,t)&&(this.rows.push(e),e=new tf(this.constants_),this.inputRows.push(e));for(let t,n=0;t=i.fieldRow[n];n++)e.elements.push(new Kp(this.constants_,t,i));this.addInput_(i,e),t=i}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new nf(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)}populateTopRow_(){var e=!!this.block_.previousConnection;let t=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e,i=this.topRow.hasLeftSquareCorner(this.block_)?cf:af;this.topRow.elements.push(new i(this.constants_)),t?(e=new qp(this.constants_),this.topRow.elements.push(e)):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new sf(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0]instanceof Gd&&!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_)?cf:af,this.topRow.elements.push(new i(this.constants_,"right"))}populateBottomRow_(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof Gd?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new cf(this.constants_)):this.bottomRow.elements.push(new af(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new of(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new cf(this.constants_,"right")):this.bottomRow.elements.push(new af(this.constants_,"right"))}addInput_(e,t){this.isInline&&e instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new ef(this.constants_,e)),t.hasInlineInput=!0):e instanceof Gd?(t.elements.push(new uf(this.constants_,e)),t.hasStatement=!0):e instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Qp(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Hd||e instanceof Vd)&&(t.minHeight=Math.max(t.minHeight,e.getSourceBlock()&&e.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),null===t.align&&(t.align=e.align)}shouldStartNewRow_(e,t){return!!t&&(t instanceof Vd||e instanceof Gd||t instanceof Gd||(e instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input||e instanceof Hd||t instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input)&&!this.isInline)}addElemSpacing_(){for(let e,t=0;e=this.rows[t];t++){let t=e.elements;if(e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new Zp(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let i=0;i<t.length-1;i++){e.elements.push(t[i]);let n=this.getInRowSpacing_(t[i],t[i+1]);e.elements.push(new Zp(this.constants_,n))}e.elements.push(t[t.length-1]),e.endsWithElemSpacer()&&e.elements.push(new Zp(this.constants_,this.getInRowSpacing_(t[t.length-1],null)))}}}getInRowSpacing_(e,t){if(!e&&t&&Gp.isStatementInput(t))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(e&&Gp.isInput(e)&&!t){if(Gp.isExternalInput(e))return this.constants_.NO_PADDING;if(Gp.isInlineInput(e))return this.constants_.LARGE_PADDING;if(Gp.isStatementInput(e))return this.constants_.NO_PADDING}return e&&Gp.isLeftSquareCorner(e)&&t&&(Gp.isPreviousConnection(t)||Gp.isNextConnection(t))?t.notchOffset:e&&Gp.isLeftRoundedCorner(e)&&t&&(Gp.isPreviousConnection(t)||Gp.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&Gp.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING}computeBounds_(){let e=0,t=0,i=0;for(let o,r=0;o=this.rows[r];r++){if(o.measure(),t=Math.max(t,o.width),o.hasStatement){var n=o.getLastInput();n=o.width-(n?.width??0),e=Math.max(e,n)}i=Math.max(i,o.widthWithConnectedBlocks)}this.statementEdge=e,this.width=t;for(let o,r=0;o=this.rows[r];r++)o.hasStatement&&(o.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(t,i),this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width,this.widthWithChildren+=this.outputConnection.width)}alignRowElements_(){for(let t,i=0;t=this.rows[i];i++)if(t.hasStatement)this.alignStatementRow_(t);else{var e=t.width;(e=this.getDesiredRowWidth_(t)-e)>0&&this.addAlignmentPadding_(t,e),Gp.isTopOrBottomRow(t)&&(t.widthWithConnectedBlocks=t.width)}}getDesiredRowWidth_(e){return this.width-this.startX}
3addAlignmentPadding_(e,t){let i=e.getFirstSpacer(),n=e.getLastSpacer();if((e.hasExternalInput||e.hasStatement)&&(e.widthWithConnectedBlocks+=t),e.align===Xs.Align$$module$build$src$core$inputs$align.LEFT&&n)n.width+=t;else if(e.align===Xs.Align$$module$build$src$core$inputs$align.CENTRE&&i&&n)i.width+=t/2,n.width+=t/2;else if(e.align===Xs.Align$$module$build$src$core$inputs$align.RIGHT&&i)i.width+=t;else{if(!n)return;n.width+=t}e.width+=t}alignStatementRow_(e){let t=e.getLastInput();if(t){var i=e.width-t.width,n=this.statementEdge;(i=n-i)>0&&this.addAlignmentPadding_(e,i),i=e.width,n=this.getDesiredRowWidth_(e),t.width+=n-i,t.height=Math.max(t.height,e.height),e.width+=n-i,e.widthWithConnectedBlocks=Math.max(e.width,this.statementEdge+e.connectedBlockWidths)}}addRowSpacing_(){let e=this.rows;this.rows=[];for(let t=0;t<e.length;t++)this.rows.push(e[t]),t!==e.length-1&&this.rows.push(this.makeSpacerRow_(e[t],e[t+1]))}makeSpacerRow_(e,t){var i=this.getSpacerRowHeight_(e,t);let n=this.getSpacerRowWidth_(e,t);return i=new lf(this.constants_,i,n),e.hasStatement&&(i.followsStatement=!0),t.hasStatement&&(i.precedesStatement=!0),i}getSpacerRowWidth_(e,t){return this.width-this.startX}getSpacerRowHeight_(e,t){return this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){return Gp.isSpacer(t)?e.yPos+t.height/2:Gp.isBottomRow(e)?(e=e.yPos+e.height-e.descenderHeight,Gp.isNextConnection(t)?e+t.height/2:e-t.height/2):Gp.isTopRow(e)?Gp.isHat(t)?e.capline-t.height/2:e.capline+t.height/2:e.yPos+e.height/2}recordElemPositions_(e){let t=e.xPos;for(let i,n=0;i=e.elements[n];n++)Gp.isSpacer(i)&&(i.height=e.height),i.xPos=t,i.centerline=this.getElemCenterline_(e,i),t+=i.width}finalize_(){let e=0,t=0;for(let i,n=0;i=this.rows[n];n++)i.yPos=t,i.xPos=this.startX,t+=i.height,e=Math.max(e,i.widthWithConnectedBlocks),this.recordElemPositions_(i);if(this.outputConnection&&this.block_.nextConnection){let t=this.block_.nextConnection.targetBlock();t&&(e=Math.max(e,t.getHeightWidth().width))}this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline,this.bottomRow.baseline=t-this.bottomRow.descenderHeight}getMeasureableForConnection(e){if(this.outputConnection?.connectionModel===e)return this.outputConnection;for(let t of this.rows)for(let i of t.elements)if(i instanceof jp&&i.connectionModel===e)return i;return null}},mf=class{constructor(e,t,i){this.connectionHighlights=new WeakMap,this.highlightOffsets=new WeakMap,this.constants=i,this.style=t,this.svgRoot=e,this.svgPath=p(Zl.PATH,{class:"blocklyPath"},this.svgRoot),this.setClass_("blocklyBlock",!0)}setPath(e){this.svgPath.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)")}applyColour(e){this.svgPath.setAttribute("stroke",this.style.colourTertiary),this.svgPath.setAttribute("fill",this.style.colourPrimary),this.updateShadow_(e.isShadow()),this.updateDisabled_(!e.isEnabled()||e.getInheritedDisabled())}setStyle(e){this.style=e}setClass_(e,t){e&&(t?f(this.svgRoot,e):m(this.svgRoot,e))}updateHighlighted(e){e?this.setClass_("blocklyHighlighted",!0):this.setClass_("blocklyHighlighted",!1)}updateShadow_(e){e?(this.setClass_("blocklyShadow",!0),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary)):this.setClass_("blocklyShadow",!1)}updateDisabled_(e){this.setClass_("blocklyDisabled",e),this.setClass_("blocklyDisabledPattern",e)}updateSelected(e){this.setClass_("blocklySelected",e)}updateDraggingDelete(e){this.setClass_("blocklyDraggingDelete",e)}updateInsertionMarker(e){this.setClass_("blocklyInsertionMarker",e)}updateMovable(e){this.setClass_("blocklyDraggable",e)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){}addConnectionHighlight(e,t,i,n){return i=`translate(${i.x}, ${i.y})`+(n?" scale(-1 1)":""),(n=this.connectionHighlights.get(e))?(n.setAttribute("d",t),n.setAttribute("transform",i),n):(t=p(Zl.PATH,{id:e.id,class:"blocklyHighlightedConnectionPath",style:"display: none;",d:t,transform:i},this.svgRoot),this.connectionHighlights.set(e,t),t)}removeConnectionHighlight(e){let t=this.connectionHighlights.get(e);t&&(_(t),this.connectionHighlights.delete(e))}},Tf=class{constructor(e){this.overrides=null,this.name=e}getClassName(){return this.name+"-renderer"}init(e,t){this.constants_=this.makeConstants_(),t&&(this.overrides=t,Object.assign(this.constants_,t)),this.constants_.setTheme(e),this.constants_.init()}createDom(e,t,i){this.constants_.createDom(e,this.name+"-"+t.name,"."+this.getClassName()+"."+t.getClassName(),i)}refreshDom(e,t,i){let n=this.getConstants();n.dispose(),this.constants_=this.makeConstants_(),this.overrides&&Object.assign(this.constants_,this.overrides),this.constants_.randomIdentifier=n.randomIdentifier,this.constants_.setTheme(t),this.constants_.init(),this.createDom(e,t,i)}dispose(){this.constants_&&this.constants_.dispose()}makeConstants_(){return new df}
3makeRenderInfo_(e){return new gf(this,e)}makeDrawer_(e,t){return new ff(e,t)}makePathObject(e,t){return new mf(e,t,this.constants_)}getConstants(){return this.constants_}shouldHighlightConnection(e){return!0}orphanCanConnectAtEnd(e,t,i){return!!Ld.getConnectionForOrphanedConnection(e,i===Rd.OUTPUT_VALUE?t.outputConnection:t.previousConnection)}render(e){let t=this.makeRenderInfo_(e);t.measure(),this.makeDrawer_(e,t).draw()}},_f={};_f.BottomRow=zp,_f.Connection=jp,_f.ConstantProvider=df,_f.Drawer=ff,_f.ExternalValueInput=Qp,_f.Field=Kp,_f.Hat=qp,_f.Icon=Jp,_f.InRowSpacer=Zp,_f.InlineInput=ef,_f.InputConnection=Yp,_f.InputRow=tf,_f.JaggedEdge=nf,_f.Measurable=Wp,_f.NextConnection=of,_f.OutputConnection=rf,_f.PathObject=mf,_f.PreviousConnection=sf,_f.RenderInfo=gf,_f.Renderer=Tf,_f.RoundCorner=af,_f.Row=Xp,_f.SpacerRow=lf,_f.SquareCorner=cf,_f.StatementInput=uf,_f.TopRow=hf,_f.Types=Gp,_f.init=Ar,_f.register=Cr,_f.unregister=kr;var Ef=class{constructor(e,t){this.workspace=e,this.theme=t,this.subscribedWorkspaces=[],this.componentDB=new Map}getTheme(){return this.theme}setTheme(e){var t=this.theme;this.theme=e,(e=this.workspace.getInjectionDiv())&&((t&&=t.getClassName())&&m(e,t),(t=this.theme.getClassName())&&f(e,t));for(let i,n=0;i=this.subscribedWorkspaces[n];n++)i.refreshTheme();for(let[i,n]of this.componentDB)for(let o of n){e=o.element,t=o.propertyName;let n=this.theme&&this.theme.getComponentStyle(i);e.style.setProperty(t,n||"")}for(let i of this.subscribedWorkspaces)i.hideChaff()}subscribeWorkspace(e){this.subscribedWorkspaces.push(e)}unsubscribeWorkspace(e){if(!j(this.subscribedWorkspaces,e))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.")}subscribe(e,t,i){this.componentDB.has(t)||this.componentDB.set(t,[]),this.componentDB.get(t).push({element:e,propertyName:i}),t=this.theme&&this.theme.getComponentStyle(t),e.style.setProperty(i,t||"")}unsubscribe(e){if(e)for(let[t,i]of this.componentDB){for(let t=i.length-1;t>=0;t--)i[t].element===e&&i.splice(t,1);i.length||this.componentDB.delete(t)}}dispose(){this.subscribedWorkspaces.length=0,this.componentDB.clear()}},bf="VARIABLE_DYNAMIC",Of={CATEGORY_NAME:bf};Of.flyoutCategory=Mr,Of.flyoutCategoryBlocks=Dr,Of.internalFlyoutCategory=$r,Of.onCreateVariableButtonClick_Colour=wr,Of.onCreateVariableButtonClick_Number=Nr,Of.onCreateVariableButtonClick_String=Lr;var vf=class{canConnect(e,t,i,n){return this.canConnectWithReason(e,t,i,n)===Ld.CAN_CONNECT}canConnectWithReason(e,t,i,n){let o=this.doSafetyChecks(e,t);return o===Ld.CAN_CONNECT?this.doTypeChecks(e,t)?i&&!this.doDragChecks(e,t,n||0)?Ld.REASON_DRAG_CHECKS_FAILED:Ld.CAN_CONNECT:Ld.REASON_CHECKS_FAILED:o}getErrorMessage(e,t,i){switch(e){case Ld.REASON_SELF_CONNECTION:return"Attempted to connect a block to itself.";case Ld.REASON_DIFFERENT_WORKSPACES:return"Blocks not on same workspace.";case Ld.REASON_WRONG_TYPE:return"Attempt to connect incompatible types.";case Ld.REASON_TARGET_NULL:return"Target connection is null.";case Ld.REASON_CHECKS_FAILED:return"Connection checks failed. "+t+" expected "+t.getCheck()+", found "+i.getCheck();case Ld.REASON_SHADOW_PARENT:return"Connecting non-shadow to shadow block.";case Ld.REASON_DRAG_CHECKS_FAILED:return"Drag checks failed.";case Ld.REASON_PREVIOUS_AND_OUTPUT:return"Block would have an output and a previous connection.";default:return"Unknown connection failure: this should never happen!"}}doSafetyChecks(e,t){if(!e||!t)return Ld.REASON_TARGET_NULL;let i,n,o;return e.isSuperior()?(i=e.getSourceBlock(),n=t.getSourceBlock(),o=t):(n=e.getSourceBlock(),i=t.getSourceBlock(),o=e,e=t),i===n?Ld.REASON_SELF_CONNECTION:o.type===Md[e.type]?i.workspace===n.workspace?i.isShadow()&&!n.isShadow()?Ld.REASON_SHADOW_PARENT:o.type===Rd.OUTPUT_VALUE&&n.previousConnection&&n.previousConnection.isConnected()||o.type===Rd.PREVIOUS_STATEMENT&&n.outputConnection&&n.outputConnection.isConnected()?Ld.REASON_PREVIOUS_AND_OUTPUT:Ld.CAN_CONNECT:Ld.REASON_DIFFERENT_WORKSPACES:Ld.REASON_WRONG_TYPE}doTypeChecks(e,t){if(e=e.getCheck(),t=t.getCheck(),!e||!t)return!0;for(let i=0;i<e.length;i++)if(t.includes(e[i]))return!0;return!1}doDragChecks(e,t,i){if(e.distanceFrom(t)>i||t.getSourceBlock().isInsertionMarker())return!1;switch(t.type){case Rd.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,t);case Rd.OUTPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case Rd.INPUT_VALUE:if(t.isConnected()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;case Rd.NEXT_STATEMENT:if(t.isConnected()&&!e.getSourceBlock().nextConnection&&!t.targetBlock().isShadow()&&t.targetBlock().nextConnection||t.targetBlock()&&!t.targetBlock().isMovable()&&!t.targetBlock().isShadow())return!1;break;default:return!1}return!Dl.includes(t)}canConnectToPrevious_(e,t){return!e.targetConnection&&!Dl.includes(t)&&(!t.targetConnection||!!(e=t.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())}};zs(ka.CONNECTION_CHECKER,Ca,vf);var If=class{get isFlyout(){return this.internalIsFlyout}get isMutator(){return this.internalIsMutator}constructor(e){this.isClearing=this.internalIsMutator=this.internalIsFlyout=this.rendered=!1,this.MAX_UNDO=1024,this.connectionDBList=[],this.topBlocks=[],this.topComments=[],this.commentDB=new Map,this.listeners=[],this.undoStack_=[],this.redoStack_=[],this.blockDB=new Map,this.typedBlocksDB=new Map,this.procedureMap=new Hp,this.readOnly=!1,this.potentialVariableMap=null,this.id=ga(),w(this),this.options=e||new fd({}),this.RTL=!!this.options.RTL,this.horizontalLayout=!!this.options.horizontalLayout,this.toolboxPosition=this.options.toolboxPosition,this.connectionChecker=new(ea(ka.CONNECTION_CHECKER,this.options,!0))(this),this.variableMap=new(this.getVariableMapClass())(this),this.setIsReadOnly(this.options.readOnly)}dispose(){this.listeners.length=0,this.clear(),$(this)}sortObjects(e,t){let i=e=>({getBoundingRectangle:()=>{let t=e.getRelativeToSurfaceXY();return new ec(t.y,t.y,t.x,t.x)},moveBy:()=>{}});return this.sortByOrigin(i(e),i(t))}sortByOrigin(e,t){let i=Math.sin(Kt(If.SCAN_ANGLE))*(this.RTL?-1:1);return e=e.getBoundingRectangle().getOrigin(),t=t.getBoundingRectangle().getOrigin(),e.y+i*e.x-(t.y+i*t.x)}addTopBlock(e){this.topBlocks.push(e)}removeTopBlock(e){if(!j(this.topBlocks,e))throw Error("Block not present in
3workspace's list of top-most blocks.")}getTopBlocks(e=!1){let t=[].concat(this.topBlocks);return e&&t.length>1&&t.sort(this.sortObjects.bind(this)),t}addTypedBlock(e){this.typedBlocksDB.has(e.type)||this.typedBlocksDB.set(e.type,[]),this.typedBlocksDB.get(e.type).push(e)}removeTypedBlock(e){j(this.typedBlocksDB.get(e.type),e),this.typedBlocksDB.get(e.type).length||this.typedBlocksDB.delete(e.type)}getBlocksByType(e,t=!1){return this.typedBlocksDB.has(e)?(e=this.typedBlocksDB.get(e).slice(0),t&&e&&e.length>1&&e.sort(this.sortObjects.bind(this)),e.filter(e=>!e.isInsertionMarker())):[]}addTopComment(e){this.topComments.push(e),this.commentDB.has(e.id)&&console.warn('Overriding an existing comment on this workspace, with id "'+e.id+'"'),this.commentDB.set(e.id,e)}removeTopComment(e){if(!j(this.topComments,e))throw Error("Comment not present in workspace's list of top-most comments.");this.commentDB.delete(e.id)}getTopComments(e=!1){let t=[].concat(this.topComments);return e&&t.length>1&&t.sort(this.sortObjects.bind(this)),t}getAllBlocks(e=!1){if(e){var t=this.getTopBlocks(!0);e=[];for(let i=0;i<t.length;i++)e.push(...t[i].getDescendants(!0))}else for(e=this.getTopBlocks(!1),t=0;t<e.length;t++)e.push(...e[t].getChildren(!1));return e.filter(e=>!e.isInsertionMarker())}clear(){this.isClearing=!0;try{let e=Xs.getGroup$$module$build$src$core$events$utils();for(e||Xs.setGroup$$module$build$src$core$events$utils(!0);this.topBlocks.length;)this.topBlocks[0].dispose(!1);for(;this.topComments.length;)this.topComments[this.topComments.length-1].dispose();Xs.setGroup$$module$build$src$core$events$utils(e),this.isFlyout||this.variableMap.clear(),this.potentialVariableMap&&this.potentialVariableMap.clear()}finally{this.isClearing=!1}}renameVariableById(e,t){ot("Blockly.Workspace.renameVariableById","v12","v13","Blockly.Workspace.getVariableMap().renameVariable"),(e=this.variableMap.getVariableById(e))&&this.variableMap.renameVariable(e,t)}createVariable(e,t,i){return ot("Blockly.Workspace.createVariable","v12","v13","Blockly.Workspace.getVariableMap().createVariable"),this.variableMap.createVariable(e,t??void 0,i??void 0)}getVariableUsesById(e){return ot("Blockly.Workspace.getVariableUsesById","v12","v13","Blockly.Variables.getVariableUsesById"),yt(this,e)}deleteVariableById(e){ot("Blockly.Workspace.deleteVariableById","v12","v13","Blockly.Workspace.getVariableMap().deleteVariable");let t=this.variableMap.getVariableById(e);t?Xs.deleteVariable$$module$build$src$core$variables(this,t):console.warn(`Can't delete non-existent variable: ${e}`)}getVariable(e,t){return ot("Blockly.Workspace.getVariable","v12","v13","Blockly.Workspace.getVariableMap().getVariable"),this.variableMap.getVariable(e,t)}getVariableById(e){return ot("Blockly.Workspace.getVariableById","v12","v13","Blockly.Workspace.getVariableMap().getVariableById"),this.variableMap.getVariableById(e)}getVariablesOfType(e){return ot("Blockly.Workspace.getVariablesOfType","v12","v13","Blockly.Workspace.getVariableMap().getVariablesOfType"),this.variableMap.getVariablesOfType(e??"")}getAllVariables(){return ot("Blockly.Workspace.getAllVariables","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables()}getAllVariableNames(){return ot("Blockly.Workspace.getAllVariableNames","v12","v13","Blockly.Workspace.getVariableMap().getAllVariables"),this.variableMap.getAllVariables().map(e=>e.getName())}getWidth(){return 0}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}remainingCapacity(){return isNaN(this.options.maxBlocks)?1/0:this.options.maxBlocks-this.getAllBlocks(!1).length}remainingCapacityOfType(e){return this.options.maxInstances?(void 0===this.options.maxInstances[e]?1/0:this.options.maxInstances[e])-this.getBlocksByType(e,!1).length:1/0}isCapacityAvailable(e){if(!this.hasBlockLimits())return!0;let t=0;for(let i in e){if(e[i]>this.remainingCapacityOfType(i))return!1;t+=e[i]}return!(t>this.remainingCapacity())}hasBlockLimits(){return this.options.maxBlocks!==1/0||!!this.options.maxInstances}getUndoStack(){return this.undoStack_}getRedoStack(){return this.redoStack_}undo(e){var t=e?this.redoStack_:this.undoStack_,i=e?this.undoStack_:this.redoStack_;let n=t.pop();if(n){for(var o=[n];t.length&&n.group&&n.group===t[t.length-1].group;){let e=t.pop();e&&o.push(e)}for(t=0;t<o.length;t++)i.push(o[t]);Xs.setRecordUndo$$module$build$src$core$events$utils(!1);try{for(i=0;i<o.length;i++)o[i].run(e)}finally{Xs.setRecordUndo$$module$build$src$core$events$utils(!0)}}}clearUndo(){this.undoStack_.length=0,this.redoStack_.length=0,s()}addChangeListener(e){return this.listeners.push(e),e}removeChangeListener(e){j(this.listeners,e)}fireChangeListener(e){if(e.recordUndo)for(this.undoStack_.push(e),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&this.MAX_UNDO>=0;)this.undoStack_.shift();for(let t=0;t<this.listeners.length;t++)(0,this.listeners[t])(e)}getBlockById(e){return this.blockDB.get(e)||null}setBlockById(e,t){this.blockDB.set(e,t)}removeBlockById(e){this.blockDB.delete(e)}getCommentById(e){return this.commentDB.get(e)??null}allInputsFilled(e){let t=this.getTopBlocks(!1);for(let i=0;i<t.length;i++)if(!t[i].allInputsFilled(e))return!1;return!0}getPotentialVariableMap(){return this.potentialVariableMap}createPotentialVariableMap(){this.potentialVariableMap=new(this.getVariableMapClass())(this,!0)}getVariableMap(){return this.variableMap}setVariableMap(e){this.variableMap=e}getProcedureMap(){return this.procedureMap}getRootWorkspace(){let e=null,t=this.options.parentWorkspace;return this.isFlyout?t&&t.options&&(e=t.options.parentWorkspace):t&&(e=t),e}static getById(e){return L(e)}static getAll(){return N()}getVariableMapClass(){let e=ea(ka.VARIABLE_MAP,this.options,!0);if(!e)throw Error("No variable map is registered.");return e}isReadOnly(){return this.readOnly}setIsReadOnly(e){this.readOnly=e,this.options.readOnly=e}};If.SCAN_ANGLE=3;var Sf=class{constructor(e){this.parentWorkspace=e,this.sounds=new Map,this.lastSound=null,this.muted=!1,window.AudioContext&&(this.context=new AudioContext)}dispose(){let e;this.sounds.clear(),null==(e=this.context)||e.close()}load(e,t){let i=this;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){if(e.length){var n,o=yield(yield fetch(e[0])).arrayBuffer();null==(n=i.context)||n.decodeAudioData(o,e=>{i.sounds.set(t,e)})}})}play(e,t){let i=this;return(0,Ws.asyncExecutePromiseGeneratorFunction)(function*(){if(!i.muted&&0!==t&&i.context){var n=i.sounds.get(e);if(n){let e=new Date;if(!(null!==i.lastSound&&e.getTime()-i.lastSound.getTime()<100)){i.lastSound=e,"suspended"===i.context.state&&(yield i.context.resume());
3var o=i.context.createBufferSource(),r=i.context.createGain();r.gain.value=t??1,r.connect(i.context.destination),o.buffer=n,o.connect(r),o.addEventListener("ended",()=>{o.disconnect(),r.disconnect()}),o.start()}}else i.parentWorkspace&&i.parentWorkspace.getAudioManager().play(e,t)}})}setMuted(e){this.muted=e}getMuted(){return this.muted}},yf=class extends If{constructor(e){super(e),this.resizeHandlerWrapper=null,this.resizesEnabled=this.visible=this.rendered=!0,this.startScrollY=this.startScrollX=this.scrollY=this.scrollX=0,this.oldScale=this.scale=1,this.oldLeft=this.oldTop=0,this.inverseScreenCTM=this.targetWorkspace=this.dummyWheelListener=this.configureContextMenu=this.lastRecordedPageScroll=this.injectionDiv=this.currentGesture_=this.toolbox=this.flyout=this.scrollbar=this.trashcan=null,this.inverseScreenCTMDirty=!0,this.highlightedBlocks=[],this.toolboxCategoryCallbacks=new Map,this.flyoutButtonCallbacks=new Map,this.cachedParentSvg=null,this.keyboardMoveInProgress=this.keyboardAccessibilityMode=!1,this.topBoundedElements=[],this.dragTargetAreas=[],this.zoomControls_=this.layerManager=null,this.navigator=new Ip,this.metricsManager=new(ea(ka.METRICS_MANAGER,e,!0))(this),this.getMetrics=e.getMetrics||this.metricsManager.getMetrics.bind(this.metricsManager),this.setMetrics=e.setMetrics||yf.setTopLevelWorkspaceMetrics,this.componentManager=new zl,this.connectionDBList=Cd.init(this.connectionChecker),this.audioManager=new Sf(e.parentWorkspace),this.grid=this.options.gridPattern?new Mp(this.options.gridPattern,e.gridOptions):null,this.markerManager=new Fp(this),bu&&rt&&this.registerToolboxCategoryCallback(Tu,rt),Of&&$r&&this.registerToolboxCategoryCallback(bf,$r),Up&&Tr&&(this.registerToolboxCategoryCallback(Vp,Tr),this.addChangeListener(br)),this.addChangeListener(this.variableChangeCallback.bind(this)),this.themeManager_=this.options.parentWorkspace?this.options.parentWorkspace.getThemeManager():new Ef(this,this.options.theme||pd),this.themeManager_.subscribeWorkspace(this),this.renderer=Ar(this.options.renderer||"geras",this.getTheme(),this.options.rendererOverrides??void 0),this.cachedParentSvgSize=new tc(0,0)}getMarkerManager(){return this.markerManager}getMetricsManager(){return this.metricsManager}setMetricsManager(e){this.metricsManager=e,this.getMetrics=this.metricsManager.getMetrics.bind(this.metricsManager)}getComponentManager(){return this.componentManager}getMarker(e){return this.markerManager.getMarker(e)}getCursor(){return this.markerManager.getCursor()}getRenderer(){return this.renderer}getThemeManager(){return this.themeManager_}getTheme(){return this.themeManager_.getTheme()}setTheme(e){e||=pd,this.themeManager_.setTheme(e)}refreshTheme(){if(this.svgGroup_){var e=null===this.options.parentWorkspace;this.renderer.refreshDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0)}this.updateBlockStyles(this.getAllBlocks(!1).filter(e=>!!e.getStyleName())),this.refreshToolboxSelection(),this.toolbox&&this.toolbox.refreshTheme(),this.isVisible()&&this.setVisible(!0),e=new(h(ja.THEME_CHANGE))(this.getTheme().name,this.id),t(e)}updateBlockStyles(e){for(let t,i=0;t=e[i];i++){let e=t.getStyleName();e&&t.setStyle(e)}}getInverseScreenCTM(){if(this.inverseScreenCTMDirty){let e=this.getParentSvg().getScreenCTM();e&&(this.inverseScreenCTM=e.inverse(),this.inverseScreenCTMDirty=!1)}return this.inverseScreenCTM}updateInverseScreenCTM(){this.inverseScreenCTMDirty=!0}isVisible(){return this.visible}getSvgXY(e){let t=0,i=0,n=1;(this.getCanvas().contains(e)||this.getBubbleCanvas().contains(e))&&(n=this.scale);do{let o=re(e);(e===this.getCanvas()||e===this.getBubbleCanvas())&&(n=1),t+=o.x*n,i+=o.y*n,e=e.parentNode}while(e&&e!==this.getParentSvg()&&e!==this.getInjectionDiv());return new Jl(t,i)}getCachedParentSvgSize(){let e=this.cachedParentSvgSize;return new tc(e.width,e.height)}getOriginOffsetInPixels(){return se(this.getCanvas())}getInjectionDiv(){if(!this.injectionDiv){let e=this.svgGroup_;for(;e;){if((" "+(e.getAttribute("class")||"")+" ").includes(" injectionDiv ")){this.injectionDiv=e;break}e=e.parentNode}}return this.injectionDiv}getSvgGroup(){return this.svgGroup_}getBlockCanvas(){return this.getCanvas()}setResizeHandlerWrapper(e){this.resizeHandlerWrapper=e}createDom(e,t){return this.injectionDiv||=t??null,this.svgGroup_=p(Zl.G,{class:"blocklyWorkspace",id:this.id}),t&&De(this.svgGroup_,Dc.LABEL,Xs.Msg$$module$build$src$core$msg.WORKSPACE_ARIA_LABEL),e&&(this.svgBackgroun
3d_=p(Zl.RECT,{height:"100%",width:"100%",class:e},this.svgGroup_),"blocklyMainBackground"===e&&this.grid?this.svgBackground_.style.fill="var(--blocklyGridPattern)":this.themeManager_.subscribe(this.svgBackground_,"workspaceBackgroundColour","fill")),this.layerManager=new xp(this),this.svgBlockCanvas_=this.layerManager.getBlockLayer(),this.svgBubbleCanvas_=this.layerManager.getBubbleLayer(),this.isFlyout||(aa(this.svgGroup_,"pointerdown",this,this.onMouseDown,!1),this.dummyWheelListener=()=>{},document.body.addEventListener("wheel",this.dummyWheelListener,{passive:!0}),aa(this.svgGroup_,"wheel",this,this.onMouseWheel,!1,{passive:!1})),this.options.hasCategories&&(this.toolbox=new(ea(ka.TOOLBOX,this.options,!0))(this)),this.grid&&this.grid.update(this.scale),this.recordDragTargets(),(e=ea(ka.CURSOR,this.options))&&this.markerManager.setCursor(new e(this)),e=null===this.options.parentWorkspace,this.renderer.createDom(this.svgGroup_,this.getTheme(),e?this.getInjectionDiv():void 0),Xs.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!!this.injectionDiv||this.isFlyout),this.svgGroup_}dispose(){if(this.rendered=!1,this.currentGesture_&&this.currentGesture_.cancel(),this.svgGroup_&&_(this.svgGroup_),this.toolbox&&=(this.toolbox.dispose(),null),this.flyout&&=(this.flyout.dispose(),null),this.trashcan&&=(this.trashcan.dispose(),null),this.scrollbar&&=(this.scrollbar.dispose(),null),this.zoomControls_&&this.zoomControls_.dispose(),this.audioManager&&this.audioManager.dispose(),this.grid&&=null,this.renderer.dispose(),this.markerManager.dispose(),super.dispose(),this.themeManager_&&(this.themeManager_.unsubscribeWorkspace(this),this.themeManager_.unsubscribe(this.svgBackground_),this.options.parentWorkspace||this.themeManager_.dispose()),this.connectionDBList.length=0,this.toolboxCategoryCallbacks.clear(),this.flyoutButtonCallbacks.clear(),!this.options.parentWorkspace){let e=this.getParentSvg();e&&e.parentNode&&_(e.parentNode)}this.resizeHandlerWrapper&&=(ca(this.resizeHandlerWrapper),null),this.dummyWheelListener&&=(document.body.removeEventListener("wheel",this.dummyWheelListener),null),Xs.getFocusManager$$module$build$src$core$focus_manager().isRegistered(this)&&Xs.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}addTrashcan(){this.trashcan=yf.newTrashcan(this);let e=this.trashcan.createDom();this.svgGroup_.insertBefore(e,this.getCanvas())}static newTrashcan(e){throw Error("The implementation of newTrashcan should be monkey-patched in by blockly.ts")}addZoomControls(){this.zoomControls_=new kc(this);let e=this.zoomControls_.createDom();this.svgGroup_.appendChild(e)}copyOptionsForFlyout(){return new fd({parentWorkspace:this,rtl:this.RTL,oneBasedIndex:this.options.oneBasedIndex,horizontalLayout:this.horizontalLayout,renderer:this.options.renderer,rendererOverrides:this.options.rendererOverrides,plugins:this.options.plugins,modalInputs:this.options.modalInputs,move:{scrollbars:!0}})}addFlyout(e){let t=this.copyOptionsForFlyout();return t.toolboxPosition=this.options.toolboxPosition,this.flyout=this.horizontalLayout?new(ea(ka.FLYOUTS_HORIZONTAL_TOOLBOX,this.options,!0))(t):new(ea(ka.FLYOUTS_VERTICAL_TOOLBOX,this.options,!0))(t),this.flyout.autoClose=!1,this.flyout.getWorkspace().setVisible(!0),this.flyout.createDom(e)}getFlyout(e){return this.flyout||e?this.flyout:this.toolbox?this.toolbox.getFlyout():null}getToolbox(){return this.toolbox}updateScreenCalculations(){this.updateInverseScreenCTM(),this.recordDragTargets()}resizeContents(){this.resizesEnabled&&this.rendered&&(this.scrollbar&&this.scrollbar.resize(),this.updateInverseScreenCTM())}resize(){this.toolbox?this.toolbox.position():this.flyout&&this.flyout.position();let e=this.componentManager.getComponents(zl.Capability.POSITIONABLE,!0),t=this.getMetricsManager().getUiMetrics(),i=[];for(let n,o=0;n=e[o];o++){n.position(t,i);let e=n.getBoundingRectangle();e&&i.push(e)}this.scrollbar&&this.scrollbar.resize(),this.updateScreenCalculations()}updateScreenCalculationsIfScrolled(){let e=le();Jl.equals(this.lastRecordedPageScroll,e)||(this.lastRecordedPageScroll=e,this.updateScreenCalculations())}getLayerManager(){return this.layerManager}getCanvas(){return this.layerManager.getBlockLayer()}setCachedParentSvgSize(e,t){let i=this.getParentSvg();null!=e&&(this.cachedParentSvgSize.width=e,i.setAttribute("data-cached-width",`${e}`)),null!=t&&(this.cachedParentSvgSize.height=t,i.setAttribute("data-cached-height",`${t}`))}getBubbleCanvas(){return this.layerManager.getBubbleLayer()}getParentSvg(){if(!this.cachedParentSvg){let e=this.svgGroup_;for(;e;){if("svg"===e.tagName){this.cachedParentSvg=e;break}e=e.parentNode}}return this.cachedParentSvg}maybeFireViewportChangeEvent(){if(a()){var e=this.scale,i=-this.scrollY,n=-this.scrollX;if(!(e===this.oldScale&&Math.abs(i-this.oldTop)<1&&Math.abs(n-this.oldLeft)<1)){var o=new(h(ja.VIEWPORT_CHANGE))(i,n,e,this.id,this.oldScale);this.oldScale=e,this.oldTop=i,this.oldLeft=n,t(o)}}}translate(e,t){let i,n;null==(i=this.layerManager)||i.translateLayers(new Jl(e,t),this.scale),null==(n=this.grid)||n.moveTo(e,t),this.maybeFireViewportChangeEvent()}getWidth(){let e=this.getMetrics();return e?e.viewWidth/this.scale:0}setVisible(e){this.visible=e,this.svgGroup_&&(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||this.hideChaff(!0))}render(){let e=this.getAllBlocks(!1);for(let t=e.length-1;t>=0;t--)e[t].queueRender();this.getTopBlocks().flatMap(e=>e.getDescendants(!1)).filter(e=>
3e.isInsertionMarker()).forEach(e=>e.queueRender())}highlightBlock(e,t){if(void 0===t){for(let e,t=0;e=this.highlightedBlocks[t];t++)e.setHighlighted(!1);this.highlightedBlocks.length=0}(e=e?this.getBlockById(e):null)&&((t=void 0===t||t)?this.highlightedBlocks.includes(e)||this.highlightedBlocks.push(e):j(this.highlightedBlocks,e),e.setHighlighted(t))}variableChangeCallback(e){switch(e.type){case ja.VAR_CREATE:case ja.VAR_DELETE:case ja.VAR_RENAME:case ja.VAR_TYPE_CHANGE:this.refreshToolboxSelection()}}refreshToolboxSelection(){let e=this.isFlyout?this.targetWorkspace:this;e&&!e.currentGesture_&&e.toolbox&&e.toolbox.getFlyout()&&e.toolbox.refreshSelection()}recordDragTargets(){let e=this.componentManager.getComponents(zl.Capability.DRAG_TARGET,!0);this.dragTargetAreas=[];for(let t,i=0;t=e[i];i++){let e=t.getClientRect();e&&this.dragTargetAreas.push({component:t,clientRect:e})}}newBlock(e,t){throw Error("The implementation of newBlock should be monkey-patched in by blockly.ts")}newComment(e){throw Error("The implementation of newComment should be monkey-patched in by blockly.ts")}getDragTarget(e){for(let t,i=0;t=this.dragTargetAreas[i];i++)if(t.clientRect.contains(e.clientX,e.clientY))return t.component;return null}onMouseDown(e){let t=this.getGesture(e);t&&t.handleWsStart(e,this)}startDrag(e,t){xn(this,e,t)}moveDrag(e){return Dn(this,e)}setKeyboardMoveInProgress(e){this.keyboardMoveInProgress=e}isDragging(){return this.keyboardMoveInProgress||null!==this.currentGesture_&&this.currentGesture_.isDragging()}isDraggable(){return this.options.moveOptions&&this.options.moveOptions.drag}isMovable(){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}isMovableHorizontally(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollHorizontally())}isMovableVertically(){let e=!!this.scrollbar;return this.isMovable()&&(!e||e&&this.scrollbar.canScrollVertically())}onMouseWheel(e){if($p.inProgress())e.preventDefault(),e.stopPropagation();else{var t=this.options.zoomOptions&&this.options.zoomOptions.wheel,i=this.options.moveOptions&&this.options.moveOptions.wheel;if(t||i){var n=pa(e);if(el)var o=e.metaKey;t&&(e.ctrlKey||o||!i)?(n=-n.y/50,t=da(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(t.x,t.y,n)):(t=this.scrollX-n.x,i=this.scrollY-n.y,e.shiftKey&&!n.x&&(t=this.scrollX-n.y,i=this.scrollY),this.scroll(t,i)),e.preventDefault()}}}getBlocksBoundingBox(){let e=this.getTopBoundedElements();if(!e.length)return new ec(0,0,0,0);let t=e[0].getBoundingRectangle();for(let n=1;n<e.length;n++){var i=e[n];i.isInsertionMarker&&i.isInsertionMarker()||((i=i.getBoundingRectangle()).top<t.top&&(t.top=i.top),i.bottom>t.bottom&&(t.bottom=i.bottom),i.left<t.left&&(t.left=i.left),i.right>t.right&&(t.right=i.right))}return t}cleanUp(){this.setResizesEnabled(!1);let e=Xs.getGroup$$module$build$src$core$events$utils();e||Xs.setGroup$$module$build$src$core$events$utils(!0);var t=this.getTopBlocks(!0),i=t.filter(e=>e.isMovable());let n=t.filter(e=>!e.isMovable()).map(e=>e.getBoundingRectangle());t=function(e){for(let t of n)if(e.intersects(t))return t;return null};var o=0;let r=this.renderer.getConstants().MIN_BLOCK_HEIGHT;for(let s of i){for(i=s.getBoundingRectangle(),s.moveBy(-i.left,o-i.top,["cleanup"]),s.snapToGrid(),o=t(i=s.getBoundingRectangle());null!=o;)o=o.top+o.getHeight()+r,s.moveBy(0,o-i.top,["cleanup"]),s.snapToGrid(),o=t(i=s.getBoundingRectangle());o=s.getRelativeToSurfaceXY().y+s.getHeightWidth().height+r}Xs.setGroup$$module$build$src$core$events$utils(e),this.setResizesEnabled(!0)}showContextMenu(e){if(!this.isReadOnly()&&!this.isFlyout){var t=Fh.registry.getContextMenuOptions({workspace:this,focusedNode:this},e);this.configureContextMenu&&this.configureContextMenu(t,e);var i=e instanceof PointerEvent?new Jl(e.clientX,e.clientY):ue(this,new Jl(5,5));Rn(e,t,this.RTL,this,i)}}updateToolbox(e){if(e=fe(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(Te(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.")}markFocused(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(x(this),this.getParentSvg().focus({preventScroll:!0}))}zoom(e,t,i){i=this.options.zoomOptions.scaleSpeed**+i;let n=this.scale*i;if(this.scale!==n){n>this.options.zoomOptions.maxScale?i=this.options.zoomOptions.maxScale/this.scale:n<this.options.zoomOptions.minScale&&(i=this.options.zoomOptions.minScale/this.scale);var o=this.getCanvas().getCTM(),r=this.getParentSvg().createSVGPoint();r.x=e,r.y=t,e=(r=r.matrixTransform(o.inverse())).x,t=r.y,o=o.translate(e*(1-i),t*(1-i)).scale(i),this.scrollX=o.e,this.scrollY=o.f,this.setScale(n)}}zoomCenter(e){var t=this.getMetrics();let i;
3this.flyout?(i=t.svgWidth?t.svgWidth/2:0,t=t.svgHeight?t.svgHeight/2:0):(i=t.viewWidth/2+t.absoluteLeft,t=t.viewHeight/2+t.absoluteTop),this.zoom(i,t,e)}zoomToFit(){if(this.isMovable()){var e=this.getMetrics(),t=e.viewWidth;e=e.viewHeight;var i=this.getBlocksBoundingBox(),n=i.right-i.left+40;if(i=i.bottom-i.top+40,n){this.flyout&&(this.horizontalLayout?(e+=this.flyout.getHeight(),i+=this.flyout.getHeight()/this.scale):(t+=this.flyout.getWidth(),n+=this.flyout.getWidth()/this.scale)),t/=n,e/=i,Xs.disable$$module$build$src$core$events$utils();try{this.setScale(Math.min(t,e)),this.scrollCenter()}finally{Xs.enable$$module$build$src$core$events$utils()}this.maybeFireViewportChangeEvent()}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}beginCanvasTransition(){f(this.getCanvas(),"blocklyCanvasTransitioning"),f(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}endCanvasTransition(){m(this.getCanvas(),"blocklyCanvasTransitioning"),m(this.getBubbleCanvas(),"blocklyCanvasTransitioning")}scrollCenter(){if(this.isMovable()){var e=this.getMetrics(),t=(e.scrollWidth-e.viewWidth)/2,i=(e.scrollHeight-e.viewHeight)/2;t=-t-e.scrollLeft,i=-i-e.scrollTop,this.scroll(t,i)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}centerOnBlock(e,t){if(this.isMovable()){var i=e?this.getBlockById(e):null;if(i){e=i.getRelativeToSurfaceXY(),i=t?{height:i.height,width:i.width}:i.getHeightWidth();var n=this.scale;t=(e.x+(this.RTL?-1:1)*i.width/2)*n,e=(e.y+i.height/2)*n,i=this.getMetrics(),this.scroll(-(t-i.viewWidth/2),-(e-i.viewHeight/2))}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.")}setScale(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,this.hideChaff(!1),(e=this.getFlyout(!1))&&e.isVisible()&&(e.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))}getScale(){return this.scale}getAbsoluteScale(){let e=e=>{if(e.isFlyout){let t=e.targetWorkspace?.getFlyout();if(t instanceof kp)return t.getFlyoutScale()}return e.getScale()},t=(i,n)=>i.options.parentWorkspace&&i.options.parentWorkspace.getSvgGroup().contains(i.getSvgGroup())?t(i.options.parentWorkspace,n*e(i)):n*e(i);return t(this,1)}scroll(e,t){this.hideChaff(!0);let i=this.getMetrics();e=Math.min(e,-i.scrollLeft),t=Math.min(t,-i.scrollTop);let n=i.scrollTop+Math.max(0,i.scrollHeight-i.viewHeight);e=Math.max(e,-(i.scrollLeft+Math.max(0,i.scrollWidth-i.viewWidth))),t=Math.max(t,-n),this.scrollX=e,this.scrollY=t,this.scrollbar&&this.scrollbar.set(-(e+i.scrollLeft),-(t+i.scrollTop),!1),e+=i.absoluteLeft,t+=i.absoluteTop,this.translate(e,t)}getBlockById(e){return super.getBlockById(e)}getAllBlocks(e=!1){return super.getAllBlocks(e)}getTopBlocks(e=!1){return super.getTopBlocks(e)}addTopBlock(e){this.addTopBoundedElement(e),super.addTopBlock(e)}removeTopBlock(e){this.removeTopBoundedElement(e),super.removeTopBlock(e)}addTopComment(e){this.addTopBoundedElement(e),super.addTopComment(e)}removeTopComment(e){this.removeTopBoundedElement(e),super.removeTopComment(e)}getTopComments(e=!1){return super.getTopComments(e)}getCommentById(e){return super.getCommentById(e)}getRootWorkspace(){return super.getRootWorkspace()}addTopBoundedElement(e){this.topBoundedElements.push(e)}removeTopBoundedElement(e){j(this.topBoundedElements,e)}getTopBoundedElements(e=!1){let t=[].concat(this.topBoundedElements);return e&&t.sort(this.sortByOrigin.bind(this)),t}setResizesEnabled(e){let t=!this.resizesEnabled&&e;this.resizesEnabled=e,t&&this.resizeContents()}clear(){this.setResizesEnabled(!1),super.clear(),this.topBoundedElements=[],this.setResizesEnabled(!0)}registerButtonCallback(e,t){if("function"!=typeof t)throw TypeError("Button callbacks must be functions.");this.flyoutButtonCallbacks.set(e,t)}getButtonCallback(e){return this.flyoutButtonCallbacks.get(e)??null}removeButtonCallback(e){this.flyoutButtonCallbacks.delete(e)}registerToolboxCategoryCallback(e,t){if("function"!=typeof t)throw TypeError("Toolbox category callbacks must be functions.");this.toolboxCategoryCallbacks.set(e,t)}getToolboxCategoryCallback(e){return this.toolboxCategoryCallbacks.get(e)||null}removeToolboxCategoryCallback(e){this.toolboxCategoryCallbacks.delete(e)}getGesture(e){if(this.keyboardMoveInProgress)return e?.preventDefault(),e?.stopPropagation(),null;let t,i="pointerdown"===e?.type;return i&&null!=(t=this.currentGesture_)&&t.hasStarted()&&(console.warn("Tried to start the same gesture twice."),this.currentGesture_.cancel()),!this.currentGesture_&&i&&(this.currentGesture_=new $p(e,this)),this.currentGesture_}clearGesture(){this.currentGesture_=null}cancelCurrentGesture(){this.currentGesture_&&this.currentGesture_.cancel()}getAudioManager(){return this.audioManager}getGrid(){return this.grid}hideChaff(e=!1){Hi(),Tn(this),_i(),this.hideComponents(e)}hideComponents(e=!1){this.getComponentManager().getComponents(zl.Capability.AUTOHIDEABLE,!0).forEac
3h(t=>t.autoHide(e))}static setTopLevelWorkspaceMetrics(e){let t=this.getMetrics();"number"==typeof e.x&&(this.scrollX=-(t.scrollLeft+(t.scrollWidth-t.viewWidth)*e.x)),"number"==typeof e.y&&(this.scrollY=-(t.scrollTop+(t.scrollHeight-t.viewHeight)*e.y)),this.translate(this.scrollX+t.absoluteLeft,this.scrollY+t.absoluteTop)}addClass(e){this.injectionDiv&&f(this.injectionDiv,e)}removeClass(e){this.injectionDiv&&m(this.injectionDiv,e)}setIsReadOnly(e){super.setIsReadOnly(e),e?this.addClass("blocklyReadOnly"):this.removeClass("blocklyReadOnly")}scrollBoundsIntoView(e,t=10){if(!$p.inProgress()){var i=this.getScale(),n=this.getMetricsManager().getViewMetrics(!0);if(n=new ec(n.top,n.top+n.height,n.left,n.left+n.width),!(e.left>=n.left&&e.top>=n.top&&e.right<=n.right&&e.bottom<=n.bottom)){(e=e.clone()).top-=t,e.bottom+=t,e.left-=t,e.right+=t;var o=t=0;e.left<n.left?t=this.RTL?Math.min(n.left-e.left,n.right-e.right):n.left-e.left:e.right>n.right&&(t=this.RTL?n.right-e.right:Math.max(n.right-e.right,n.left-e.left)),e.top<n.top?o=n.top-e.top:e.bottom>n.bottom&&(o=Math.max(n.bottom-e.bottom,n.top-e.top)),this.scroll(this.scrollX+t*i,this.scrollY+o*i)}}}getFocusableElement(){return this.svgGroup_}getFocusableTree(){return this.isMutator&&this.options.parentWorkspace||this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){return e?null:(e=this.targetWorkspace?.getFlyout(),this.isFlyout&&e?e.getContents().find(e=>(e=e.getElement(),C(e)&&e.canBeFocused()))?.getElement()??null:this.getTopBlocks(!0)[0]??null)}getNestedTrees(){let e=this.getAllBlocks().map(e=>e.getIcons()).flat().filter(e=>e instanceof Xs.MutatorIcon$$module$build$src$core$icons$mutator_icon&&e.bubbleIsVisible()).map(e=>e.getBubble()?.getWorkspace()).filter(e=>!!e),t=this.getFlyout(!0);return t&&e.push(t.getWorkspace()),e}searchForWorkspaceComment(e){for(let t of this.getTopComments())if(t instanceof id&&t.canBeFocused()&&t.getFocusableElement().id===e)return t}lookUpFocusableNode(e){var t;let i=(t=this.targetWorkspace)?.getFlyout();if(this.isFlyout&&i)for(var n of i.getContents())if(t=n.getElement(),C(t)&&t.canBeFocused()&&t.getFocusableElement().id===e)return t;if(n=e.indexOf("_field_"),t=e.indexOf("_connection_"),-1!==n){var o=e.substring(0,n);if(o=this.getBlockById(o))for(var r of o.getFields())if(r.canBeFocused()&&r.getFocusableElement().id===e)return r;return null}if(-1!==t){if(o=e.substring(0,t),o=this.getBlockById(o))for(let t of o.getConnections_(!0))if(t.id===e)return t;return null}var s;if(-1!==(r=Math.max(e.indexOf(Kh),e.indexOf(Yh),e.indexOf(Jh)))&&(r=e.substring(0,r),r=this.searchForWorkspaceComment(r)))return e.indexOf(Kh)>-1?r.getEditorFocusableNode():(s=r.view.getCommentBarButtons().find(t=>t.getFocusableElement().id.includes(e)))??null;if((s=this.getAllBlocks(!1).find(t=>t.getFocusableElement().id===e))||(s=this.searchForWorkspaceComment(e)))return s;for(o of(s=this.getAllBlocks().map(e=>e.getIcons()).flat(),s)){if(o.canBeFocused()&&o.getFocusableElement().id===e)return o;if(Qt(o)){if((s=o.getBubble())&&s.canBeFocused()&&s.getFocusableElement().id===e)return s;if(s instanceof yd&&s.getEditor().getFocusableElement().id===e)return s.getEditor()}}return null}onTreeFocus(e,t){}onTreeBlur(e){if(this.isFlyout&&this.targetWorkspace&&!Xs.getFocusManager$$module$build$src$core$focus_manager().ephemeralFocusTaken()){var t=this.targetWorkspace.getToolbox();t&&e===t||cr(t)&&t.autoHide(!1)}}getNavigator(){return this.navigator}setNavigator(e){this.navigator=e}},Rf={};Rf.WorkspaceSvg=yf,Rf.resizeSvgContents=Pr;var Cf=class extends Ul{constructor(e){super(),this.isBlank=!0,this.isBlank=void 0===e,e&&(this.varId=e.getId(),this.workspaceId=e.getWorkspace().id)}toJson(){let e=super.toJson();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");return e.varId=this.varId,e}static fromJson(e,t,i){return(t=Ul.fromJson(e,t,i??new Cf)).varId=e.varId,t}},kf=class extends Cf{constructor(e){super(e),this.type=ja.VAR_CREATE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,i){return(t=Cf.fromJson(e,t,i??new kf)).varType=e.varType,t.varName=e.varName,t}run(e){var t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");t=t.getVariableMap(),e?t.createVariable(this.varName,this.varType,this.varId):(e=t.getVariableById(this.varId))&&t.deleteVariable(e)}};zs(ka.EVENT,ja.VAR_CREATE,kf);var Af=class{constructor(e,t,i,n){this.workspace=e,this.name=t,this.type=i||"",this.id=n||ga()}getId(){return this.id}getName(){return this.name}setName(e){return this.name=e,this}getType(){return this.type}setType(e){return this.type=e,this}getWorkspace(){return this.workspace}save(){let e={name:this.getName(),id:this.getId()},t=this.getType();return t&&(e.type=t),e}static load(e,i){e=new this(i,e.name,e.type,e.id),i.getVariableMap().addVariable(e),t(new(h(ja.VAR_CREATE))(e))}};zs(ka.VARIABLE_MODEL,Ca,Af);var Lf=class extends Cf{constructor(e){super(e),this.type=ja.VAR_DELETE,e&&(this.varType=e.getType(),this.varName=e.getName())}toJson(){let e=super.toJson();if(void 0===this.varType)throw Error("The var type is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");return e.varType=this.varType,e.varName=this.varName,e}static fromJson(e,t,i){return(t=Cf.fromJson(e,t,i??new Lf)).varType=e.varType,t.varName=e.varName,t}run(e){var t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.varName)throw Error("The var name is undefined. Either pass a variable to the constructor, or call fromJson");t=t.getVariableMap(),e?(e=t.getVariableById(this.varId))&&t.deleteVariable(e):t.createVariable(this.varName,this.varType,this.varId)}};zs(ka.EVENT,ja.VAR_DELETE,Lf);var Nf=class extends Cf{constructor(e,t){super(e),this.type=ja.VAR_RENAME,e&&(this.oldName=e.getName(),this.newName=void 0===t?"":t)}toJson(){let e=super.toJson();if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");return e.oldName=this.oldName,e.newName=this.newName,e}static fromJson(e,t,i){return(t=Cf.fromJson(e,t,i??new Nf)).oldName=e.oldName,t.newName=e.newName,t}run(e){var t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldName)throw Error("The old var name is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.newName)throw Error("The new var name is undefined. Either pass a value to the constructor, or call fromJson");let i=(t=t.getVariableMap()).getVariableById(this.varId);e?i&&t.renameVariable(i,this.newName):i&&t.renameVariable(i,this.oldName)}};zs(ka.EVENT,ja.VAR_RENAME,Nf);var wf=class{constructor(e,t=!1){this.workspace=e,this.potentialMap=t,this.variableMap=new Map}clear(){for(let e of this.variableMap.values())for(let t of e.values())this.deleteVariable(t);if(0!==this.variableMap.size)throw Error("Non-empty variable map")}renameVariable(e,t){if(e.getName()===t)return e;var i=e.getType();i=this.getVariable(t,i);let n=this.workspace.getAllBlocks(!1),o="";this.potentialMap||(o=Xs.getGroup$$module$build$src$core$events$utils())||Xs.setGroup$$module$build$src$core$events$utils(!0);try{i&&i.getId()!==e.getId()?this.renameVariableWithConflict(e,t,i,n):this.renameVariableAndUses(e,t,n)}finally{this.potentialMap||Xs.setGroup$$module$build$src$core$events$utils(o)}return e}changeVariableType(e,i){let n=e.getType();if(n===i)return e;var o=this.variableMap.get(n);return o?.delete(e.getId()),0===o?.size&&this.variableMap.delete(n),e.setType(i),(o=this.variableMap.get(i)??new Map).set(e.getId(),e),this.variableMap.has(i)||this.variableMap.set(i,o),t(new(h(ja.VAR_TYPE_CHANGE))(e,n,i)),e}renameVariableById(e,t){ot("VariableMap.renameVariableById","v12","v13","VariableMap.renameVariable");let i=this.getVariableById(e);if(!i)throw Error("Tried to rename a variable that didn't exist. ID: "+e);this.renameVariable(i,t)}renameVariableAndUses(e,i,n){for(this.potentialMap||t(new(h(ja.VAR_RENAME))(e,i)),e.setName(i),i=0;i<n.length;
3i++)n[i].updateVarName(e)}renameVariableWithConflict(e,i,n,o){let r,s=e.getType();for(i!==n.getName()&&this.renameVariableAndUses(n,i,o),i=0;i<o.length;i++)o[i].renameVarById(e.getId(),n.getId());this.potentialMap||t(new(h(ja.VAR_DELETE))(e)),null==(r=this.variableMap.get(s))||r.delete(e.getId())}createVariable(e,i,n){var o=this.getVariable(e,i);if(o){if(n&&o.getId()!==n)throw Error('Variable "'+e+'" is already in use and its id is "'+o.getId()+'" which conflicts with the passed in id, "'+n+'".');return o}if(n&&this.getVariableById(n))throw Error('Variable id, "'+n+'", is already in use.');if(o=n||ga(),i||="",!(n=ea(ka.VARIABLE_MODEL,this.workspace.options,!0)))throw Error("No variable model is registered.");return o=new n(this.workspace,e,i,o),(e=this.variableMap.get(i)??new Map).set(o.getId(),o),this.variableMap.has(i)||this.variableMap.set(i,e),this.potentialMap||t(new(h(ja.VAR_CREATE))(o)),o}addVariable(e){let t,i=e.getType();this.variableMap.has(i)||this.variableMap.set(i,new Map),null==(t=this.variableMap.get(i))||t.set(e.getId(),e)}deleteVariable(e){let i=yt(this.workspace,e.getId()),n="";this.potentialMap||(n=Xs.getGroup$$module$build$src$core$events$utils())||Xs.setGroup$$module$build$src$core$events$utils(!0);try{for(let e=0;e<i.length;e++)i[e].isDeadOrDying()||i[e].dispose(!0);let n=this.variableMap.get(e.getType());n&&n.has(e.getId())&&(n.delete(e.getId()),this.potentialMap||t(new(h(ja.VAR_DELETE))(e)),0===n.size&&this.variableMap.delete(e.getType()))}finally{this.potentialMap||Xs.setGroup$$module$build$src$core$events$utils(n)}}deleteVariableById(e){ot("VariableMap.deleteVariableById","v12","v13","Blockly.Variables.deleteVariable"),(e=this.getVariableById(e))&&Xs.deleteVariable$$module$build$src$core$variables(this.workspace,e)}getVariable(e,t){return(t=this.variableMap.get(t||""))?[...t.values()].find(t=>Xs.Names$$module$build$src$core$names.equals(t.getName(),e))??null:null}getVariableById(e){for(let t of this.variableMap.values())if(t.has(e))return t.get(e)??null;return null}getVariablesOfType(e){return(e=this.variableMap.get(e||""))?[...e.values()]:[]}getTypes(){return[...this.variableMap.keys()]}getAllVariables(){let e=[];for(let t of this.variableMap.values())e=e.concat(...t.values());return e}getAllVariableNames(){ot("VariableMap.getAllVariableNames","v12","v13","Blockly.Variables.getAllVariables");let e=[];for(let t of this.variableMap.values())for(let i of t.values())e.push(i.getName());return e}getVariableUsesById(e){return ot("VariableMap.getVariableUsesById","v12","v13","Blockly.Variables.getVariableUsesById"),yt(this.workspace,e)}};zs(ka.VARIABLE_MAP,Ca,wf);var $f=class extends Hl{constructor(e,t){super(t),this.type=ja.TRASHCAN_OPEN,this.isOpen=e}toJson(){let e=super.toJson();if(void 0===this.isOpen)throw Error("Whether this is already open or not is undefined. Either pass a value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new $f)).isOpen=e.isOpen,t}};zs(ka.EVENT,ja.TRASHCAN_OPEN,$f);var Mf=class extends ip{constructor(e){super(),this.workspace=e,this.id="trashcan",this.contents=[],this.flyout=null,this.isLidOpen=!1,this.minOpenness=0,this.lidTask=this.svgLid=this.svgGroup=null,this.top=this.left=this.lidOpen=0,this.initialized=!1,this.workspace.options.maxTrashcanContents<=0||(e=this.workspace.copyOptionsForFlyout(),this.workspace.horizontalLayout?(e.toolboxPosition=this.workspace.toolboxPosition===mc.TOP?mc.BOTTOM:mc.TOP,this.flyout=new(ea(ka.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace.options,!0))(e)):(e.toolboxPosition=this.workspace.toolboxPosition===mc.RIGHT?mc.LEFT:mc.RIGHT,this.flyout=new(ea(ka.FLYOUTS_VERTICAL_TOOLBOX,this.workspace.options,!0))(e)),this.workspace.addChangeListener(this.onDelete.bind(this)))}createDom(){this.svgGroup=p(Zl.G,{class:"blocklyTrash"});let e,t=String(Math.random()).substring(2);e=p(Zl.CLIPPATH,{id:"blocklyTrashBodyClipPath"+t},this.svgGroup),p(Zl.RECT,{width:xf,height:Df,y:Pf},e);let i=p(Zl.IMAGE,{width:yc,x:-Hf,height:Rc,y:-Vf,"clip-path":"url(#blocklyTrashBodyClipPath"+t+")"},this.svgGroup);return i.setAttributeNS(vl,"xlink:href",this.workspace.options.pathToMedia+Cc),e=p(Zl.CLIPPATH,{id:"blocklyTrashLidClipPath"+t},this.svgGroup),p(Zl.RECT,{width:xf,height:Pf},e),this.svgLid=p(Zl.IMAGE,{width:yc,x:-Hf,height:Rc,y:-Vf,"clip-path":"url(#blocklyTrashLidClipPath"+t+")"},this.svgGroup),this.svgLid.setAttributeNS(vl,"xlink:href",this.workspace.options.pathToMedia+Cc),la(this.svgGroup,"pointerdown",this,this.blockMouseDownWhenOpenable),la(this.svgGroup,"pointerup",this,this.click),la(i,"pointerover",this,this.mouseOver),la(i,"pointerout",this,this.mouseOut),this.animateLid(),this.svgGroup}init(){if(this.workspace.options.maxTrashcanContents>0){let e=this.flyout.createDom(Zl.SVG);f(e,"blocklyTrashcanFlyout"),E(e,this.workspace.getParentSvg()),this.flyout.init(this.workspace)}this.workspace.getComponentManager().addComponent({component:this,weight:zl.ComponentWeight.TRASHCAN_WEIGHT,capabilities:[zl.Capability.AUTOHIDEABLE,zl.Capability.DELETE_AREA,zl.Capability.DRAG_TARGET,zl.Capability.POSITIONABLE]}),this.initialized=!0,this.setLidOpen(!1)}dispose(){this.workspace.getComponentManager().removeComponent("trashcan"),this.svgGroup&&_(this.svgGroup),this.lidTask&&clearTimeout(this.lidTask)}hasContents(){return!!this.contents.length}contentsIsOpen(){return!!this.flyout&&this.flyout.isVisible()}openFlyout(){if(!this.contentsIsOpen()){var e=this.contents.map(function(e){return JSON.parse(e)}),t=this.workspace.getParentSvg().style;t.cursor="wait",setTimeout(()=>{let i,n;null==(i=this.flyout)||i.show(e),t.cursor="",null==(n=this.workspace.scrollbar)||n.setVisible(!1)},10),this.fireUiEvent(!0)}}closeFlyout(){var e,t;this.contentsIsOpen()&&(null==(e=this.flyout)||e.hide(),null==(t=this.workspace.scrollbar)||t.setVisible(!0),this.fireUiEvent(!1),this.workspace.recordDragTargets())}autoHide(e){!e&&this.flyout&&this.closeFlyout()}emptyContents(){this.hasContents()&&(this.contents.length=0,this.setMinOpenness(0),this.closeFlyout())}position(e,t){if(this.initialized){var i,n,o=ye(this.workspace,e);e=Se(o,new tc(xf,Df+Pf),Bf,Ff,e,this.workspace),t=Re(e,Ff,o.vertical===Ec.TOP?Oc.DOWN:Oc.UP,t),this.top=t.top,this.left=t.left,null==(i=this.svgGroup)||i.setAttribute("transform","translate("+this.left+","+this.top+")"),null==(n=this.flyout)||n.position()}}getBoundingRectangle(){return new ec(this.top,this.top+Df+Pf,this.left,this.left+xf)}getClientRect(){if(!this.svgGroup)return null;var e=this.svgGroup.getBoundingClientRect();let t=e.top+Vf-Uf;
3return e=e.left+Hf-Uf,new ec(t,t+Pf+Df+2*Uf,e,e+xf+2*Uf)}onDragOver(e){this.setLidOpen(this.wouldDelete_)}onDragExit(e){this.setLidOpen(!1)}onDrop(e){setTimeout(this.setLidOpen.bind(this,!1),100)}setLidOpen(e){this.isLidOpen!==e&&(this.lidTask&&clearTimeout(this.lidTask),this.isLidOpen=e,this.animateLid())}animateLid(){let e=Xf;var t=1/(e+1);this.lidOpen+=this.isLidOpen?t:-t,this.lidOpen=Math.min(Math.max(this.lidOpen,this.minOpenness),1),this.setLidAngle(this.lidOpen*Yf),t=zf+this.lidOpen*(jf-zf),this.svgGroup&&(this.svgGroup.style.opacity=`${t}`),this.lidOpen>this.minOpenness&&this.lidOpen<1&&(this.lidTask=setTimeout(this.animateLid.bind(this),Wf/e))}setLidAngle(e){let t,i=this.workspace.toolboxPosition===mc.RIGHT||this.workspace.horizontalLayout&&this.workspace.RTL;null==(t=this.svgLid)||t.setAttribute("transform","rotate("+(i?-e:e)+","+(i?4:xf-4)+","+(Pf-2)+")")}setMinOpenness(e){this.minOpenness=e,this.isLidOpen||this.setLidAngle(e*Yf)}closeLid(){this.setLidOpen(!1)}click(){this.hasContents()&&!this.workspace.isDragging()&&this.openFlyout()}fireUiEvent(e){e=new(h(ja.TRASHCAN_OPEN))(e,this.workspace.id),t(e)}blockMouseDownWhenOpenable(e){!this.contentsIsOpen()&&this.hasContents()&&e.stopPropagation()}mouseOver(){this.hasContents()&&this.setLidOpen(!0)}mouseOut(){this.setLidOpen(!1)}onDelete(e){if(!(this.workspace.options.maxTrashcanContents<=0||!Ta(e)||e.wasShadow)){if(!e.oldJson)throw Error("Encountered a delete event without proper oldJson");if(e=JSON.stringify(this.cleanBlockJson(e.oldJson)),!this.contents.includes(e)){for(this.contents.unshift(e);this.contents.length>this.workspace.options.maxTrashcanContents;)this.contents.pop();this.setMinOpenness(Gf)}}}cleanBlockJson(e){return function e(t){if(t){if(delete t.id,delete t.x,delete t.y,delete t.enabled,delete t.disabledReasons,t.icons&&t.icons.comment){var i=t.icons.comment;delete i.height,delete i.width,delete i.pinned}for(var n in i=t.inputs){var o=i[n];let t=o.block;o=o.shadow,t&&e(t),o&&e(o)}t.next&&(t=(n=t.next).block,n=n.shadow,t&&e(t),n&&e(n))}}(e=JSON.parse(JSON.stringify(e))),Object.assign({},{kind:"BLOCK"},e)}},xf=47,Df=44,Pf=16,Ff=20,Bf=20,Uf=10,Hf=0,Vf=32,Gf=.1,Wf=80,Xf=4,zf=.4,jf=.8,Yf=45,Qf=null,Kf=null,qf=void 0,Jf={};Jf.BlockPaster=Yd,Jf.copy=Fr,Jf.getLastCopiedData=Br,Jf.getLastCopiedLocation=Gr,Jf.getLastCopiedWorkspace=Hr,Jf.paste=Xr,Jf.registry=$c,Jf.setLastCopiedData=Ur,Jf.setLastCopiedLocation=Wr,Jf.setLastCopiedWorkspace=Vr;var Zf={};Zf.CollapseCommentBarButton=Qh,Zf.CommentBarButton=jh,Zf.CommentEditor=qh,Zf.CommentView=ed,Zf.DeleteCommentBarButton=Zh,Zf.RenderedWorkspaceComment=id,Zf.WorkspaceComment=td;var eg;(function(e){e.ESCAPE="escape",e.DELETE="delete",e.COPY="copy",e.CUT="cut",e.PASTE="paste",e.UNDO="undo",e.REDO="redo",e.MENU="menu"})(eg||={}),os();var tg={};tg.names=eg,tg.registerCopy=Jr,tg.registerCut=Zr,tg.registerDefaultShortcuts=os,tg.registerDelete=Qr,tg.registerEscape=Yr,tg.registerPaste=es,tg.registerRedo=is,tg.registerShowContextMenu=ns,tg.registerUndo=ts;var ig={ProcedureSerializer:class{constructor(e,t){this.procedureModelClass=e,this.parameterModelClass=t,this.priority=75}save(e){return(e=e.getProcedureMap().getProcedures().map(e=>rs(e))).length?e:null}load(e,t){let i=t.getProcedureMap();for(let n of e)i.add(ss(this.procedureModelClass,this.parameterModelClass,n,t))}clear(e){e.getProcedureMap().clear()}}};ig.loadProcedure=ss,ig.saveProcedure=rs;var ng=class{constructor(){this.priority=100}save(e){return(e=e.getVariableMap().getAllVariables().map(e=>e.save())).length?e:null}load(e,t){let i=Js(ka.VARIABLE_MODEL,Ca);e.forEach(e=>{i?.load(e,t)})}clear(e){e.getVariableMap().clear()}};Ce("variables",new ng);var og={};og.VariableSerializer=ng;var rg={};rg.load=ls,rg.save=as;var sg={blocks:Au,exceptions:Cu,priorities:Ac,procedures:ig,registry:Lc,variables:og,workspaceComments:wc,workspaces:rg};"Blockly"in globalThis||(globalThis.Blockly={Msg:Yc});var ag="label",lg=class{load(e,t){return(e=new sp(t.getWorkspace(),t.targetWorkspace,e,!0)).show(),new np(e,ag)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof sp&&e.dispose()}getType(){return ag}};zs(ka.FLYOUT_INFLATER,ag,lg);
3var cg=class extends df{constructor(e){super(),this.GRID_UNIT=4,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_FONTWEIGHT="bold",this.FIELD_TEXT_FONTFAMILY='"Helvetica Neue", "Segoe UI", Helvetica, sans-serif',this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!0,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.SQUARED=this.ROUNDED=this.HEXAGONAL=this.replacementGlowFilter=null,e&&(this.GRID_UNIT=e),this.SMALL_PADDING=this.GRID_UNIT,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.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.FIELD_TEXT_FONTSIZE=3*this.GRID_UNIT,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_PADDING=this.FIELD_BORDER_RECT_X_PADDING,this.FIELD_COLOUR_DEFAULT_WIDTH=6*this.GRID_UNIT,this.FIELD_COLOUR_DEFAULT_HEIGHT=8*this.GRID_UNIT,this.FIELD_CHECKBOX_X_OFFSET=1*this.GRID_UNIT,this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH=12*this.GRID_UNIT}setFontConstants_(e){super.setFontConstants_(e),this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT=this.FIELD_TEXT_HEIGHT+2*this.FIELD_BORDER_RECT_Y_PADDING}init(){super.init(),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}setDynamicProperties_(e){super.setDynamicProperties_(e),this.SELECTED_GLOW_COLOUR=e.getComponentStyle("selectedGlowColour")||this.SELECTED_GLOW_COLOUR;let t=Number(e.getComponentStyle("selectedGlowSize"));this.SELECTED_GLOW_SIZE=t&&!isNaN(t)?t: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}dispose(){super.dispose(),this.selectedGlowFilter&&_(this.selectedGlowFilter),this.replacementGlowFilter&&_(this.replacementGlowFilter)}makeStartHat(){let e=this.START_HAT_HEIGHT,t=this.START_HAT_WIDTH;return{height:.75*e,width:t,path:Lo("c",[Ao(25,-e),Ao(71,-e),Ao(t,0)])}}makeHexagonal(){function e(e,i,n){var o=e/2;return $o(-(n=n?-1:1)*(o=o>t?t:o),e=(i?-1:1)*e/2)+$o(n*o,e)}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeRounded(){function e(e,t,n){let o=e>i?e-i:0,r=n===t?"0":"1";return Do("a","0 0,"+r,e=(e>i?i:e)/2,Ao((n?1:-1)*e,(t?-1:1)*e))+xo("v",(t?-1:1)*o)+Do("a","0 0,"+r,e,Ao((n?-1:1)*e,(t?-1:1)*e))}let t=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,i=2*t;return{type:this.SHAPES.ROUND,isDynamic:!0,width:e=>(e/=2)>t?t:e,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}makeSquared(){function e(e,i,n){e-=2*t;let o=n===i?"0":"1";return Do("a","0 0,"+o,t,Ao((n?1:-1)*t,(i?-1:1)*t))+xo("v",(i?-1:1)*e)+Do("a","0 0,"+o,t,Ao((n?-1:1)*t,(i?-1:1)*t))}let t=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:e=>t,height:e=>e,connectionOffsetY:e=>e/2,connectionOffsetX:e=>-e,pathDown:t=>e(t,!1,!1),pathUp:t=>e(t,!0,!1),pathRightDown:t=>e(t,!1,!0),pathRightUp:t=>e(t,!1,!0)}}shapeFor(e){let t=e.getCheck();switch(!t&&e.targetConnection&&(t=e.targetConnection.getCheck()),e.type){case Rd.INPUT_VALUE:case Rd.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 t&&t.includes("Boolean")?this.HEXAGONAL:(t&&t.includes("Number")||t&&t.includes("String"),this.ROUNDED);case Rd.PREVIOUS_STATEMENT:case Rd.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}}makeNotch(){function e(e){return Lo("c",[Ao(e*o/2,0),Ao(e*o*3/4,s/2),Ao(e*o,s)])+Mo([Ao(e*o,r)])+Lo("c",[Ao(e*o/4,s/2),Ao(e*o/2,s),Ao(e*o,s)])+xo("h",e*n)+Lo("c",[Ao(e*o/2,0),Ao(e*o*3/4,-s/2),Ao(e*o,-s)])+Mo([Ao(e*o,-r)])+Lo("c",[Ao(e*o/4,-s/2),Ao(e*o/2,-s),Ao(e*o,-s)])}let t=this.NOTCH_WIDTH,i=this.NOTCH_HEIGHT,n=t/3,o=n/3,r=i/2,s=r/2,a=e(1),l=e(-1);return{type:this.SHAPES.NOTCH,width:t,height:i,pathLeft:a,pathRight:l}}makeInsideCorners(){let e=this.CORNER_RADIUS,t=Do("a","0 0,0",e,Ao(-e,e)),i=Do("a","0 0,1",e,Ao(-e,e));return{width:e,height:e,pathTop:t,pathBottom:Do("a","0 0,0",e,Ao(e,e)),rightWidth:e,rightHeight:e,pathTopRight:i,pathBottomRight:Do("a","0 0,1",e,Ao(e,e))}}generateSecondaryColour_(e){return nn("#000",e,.15)||e}generateTertiaryColour_(e){return nn("#000",e,.25)||e}createDom(e,t,i,n){super.createDom(e,t,i,n),e=p(Zl.DEFS,{},e),t=p(Zl.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),p(Zl.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},t),i=p(Zl.FECOMPONENTTRANSFER,{result:"outBlur"},t),p(Zl.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},i),p(Zl.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},t),p(Zl.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},t),this.selectedGlowFilterId=t.id,this.selectedGlowFilter=t,e=p(Zl.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),p(Zl.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),t=p(Zl.FECOMPONENTTRANSFER,{result:"outBlur"},e),p(Zl.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},t),p(Zl.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),p(Zl.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),p(Zl.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter=e,n&&(n.style.setProperty("--blocklySelectedGlowFilter",`url(#${this.selectedGlowFilterId})`),n.style.setProperty("--blocklyReplacementGlowFilter",`url(#${this.replacementGlowFilterId})`))}getCSS_(e){return[`${e} .blocklyText,`,`${e} .blocklyFlyoutLabelText {`,`font: ${this.FIELD_TEXT_FONTWEIGHT} ${this.FIELD_TEXT_FONTSIZE}pt ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e} .blocklyTextInputBubble textarea {`,"font-weight: normal;","}",`${e} .blocklyText {`,"fill: #fff;","}",`${e} .blocklyNonEditableField>rect:not(.blocklyDropdownRect),`,`${e} .blocklyEditableField>rect:not(.blocklyDropdownRect) {`,`fill: ${this.FIELD_BORDER_RECT_COLOUR};`,"}",`${e} .blocklyNonEditableField>text,`,`${e} .blocklyEditableField>text,`,`${e} .blocklyNonEditableField>g>text,`,`${e} .blocklyEditableField>g>text {`,"fill: #575E75;","}",`${e} .blocklyFlyoutLabelText {`,"fill: #575E75;","}",`${e} .blocklyText.blocklyBubbleText {`,"fill: #575E75;","}",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):hover>rect,",`${e} .blocklyDraggable:not(.blocklyDisabled)`," .blocklyEditableField:not(.blocklyEditing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",`${e} .blocklyHtmlInput {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,`font-weight: ${this.FIELD_TEXT_FONTWEIGHT};`,"color: #575E75;","}",`${e} .blocklyDropdownText {`,"fill: #fff !important;","}",`${e}.blocklyWidgetDiv .blocklyMenuItem,`,`${e}.blocklyDropDownDiv .blocklyMenuItem {`,`font-family: ${this.FIELD_TEXT_FONTFAMILY};`,"}",`${e}.blocklyDropDownDiv .blocklyMenuItemContent {`,"color: #fff;","}",`${e} .blocklyHighlightedConnectionPath {`,`stroke: ${this.SELECTED_GLOW_COLOUR};`,"}",`${e} .blocklyDisabledPattern > .blocklyOutlinePath {`,"fill: var(--blocklyDisabledPattern)","}",`${e} .blocklyInsertionMarker>.blocklyPath {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}",`${e} .blocklySelected>.blocklyPath.blocklyPathSelected {`,"fill: none;","filter: var(--blocklySelectedGlowFilter);","}",`${e} .blocklyReplaceable>.blocklyPath {`,"filter: var(--blocklyReplacementGlowFilter);","}"]}},ug=class extends ff{constructor(e,t){super(e,t)}draw(){let e=this.block_.pathObject;e.beginDrawing(),this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights(),e.setPath(this.outlinePath_+"\n"+this.inl
3inePath_),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_(),this.info_.outputConnection&&(e.outputShapeType=this.info_.outputConnection.shape.type),e.endDrawing()}drawOutline_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):super.drawOutline_()}drawLeft_(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():super.drawLeft_()}drawRightSideRow_(e){if(!(e.height<=0)){if(Gp.isSpacer(e)){let n=e.precedesStatement;var t=e.followsStatement;if(n||t){let o=this.constants_.INSIDE_CORNERS;var i=o.rightHeight;return i=e.height-(n?i:0),t=t?o.pathBottomRight:"",e=i>0?xo("V",e.yPos+i):"",void(this.outlinePath_+=t+e+(n?o.pathTopRight:""))}}this.outlinePath_+=xo("V",e.yPos+e.height)}}drawRightDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.outlinePath_+=this.info_.outputConnection.shape.pathRightDown(this.info_.outputConnection.height)}drawLeftDynamicConnection_(){if(!this.info_.outputConnection)throw Error("Cannot draw the output connection of a block that doesn't have one");this.positionOutputConnection_(),this.outlinePath_+=this.info_.outputConnection.shape.pathUp(this.info_.outputConnection.height),this.outlinePath_+="z"}drawFlatTop_(){let e=this.info_.topRow;this.positionPreviousConnection_(),this.outlinePath_+=wo(e.xPos,this.info_.startY),this.outlinePath_+=xo("h",e.width)}drawFlatBottom_(){let e=this.info_.bottomRow;this.positionNextConnection_(),this.outlinePath_+=xo("V",e.baseline),this.outlinePath_+=xo("h",-e.width)}drawInlineInput_(e){this.positionInlineInputConnection_(e);let t=e.input.name;e.connectedBlock||this.info_.isInsertionMarker||(e=No(e.xPos+e.connectionWidth,e.centerline-e.height/2)+this.getInlineInputPath(e),this.block_.pathObject.setOutlinePath(t,e))}getInlineInputPath(e){let t=e.width-2*e.connectionWidth,i=e.height;return xo("h",t)+e.shape.pathRightDown(i)+xo("h",-t)+e.shape.pathUp(i)+"z"}drawStatementInput_(e){var t=e.getLastInput();let i=t.xPos+t.notchOffset+t.shape.width,n=this.constants_.INSIDE_CORNERS,o=t.shape.pathRight+xo("h",-(t.notchOffset-n.width))+n.pathTop,r=e.height-2*n.height;t=n.pathBottom+xo("h",t.notchOffset-n.width)+(t.connectedBottomNextConnection?"":t.shape.pathLeft),this.outlinePath_+=xo("H",i)+o+xo("v",r)+t+xo("H",e.xPos+e.width),this.positionStatementInputConnection_(e)}drawConnectionHighlightPath(e){let t=e.connectionModel;if(t.type===Rd.NEXT_STATEMENT||t.type===Rd.PREVIOUS_STATEMENT||t.type===Rd.OUTPUT_VALUE&&!e.isDynamicShape)return super.drawConnectionHighlightPath(e);e=t.type===Rd.INPUT_VALUE?No(e.connectionWidth,-e.height/2)+this.getInlineInputPath(e):No(e.width,-e.height/2)+e.shape.pathDown(e.height);let i,n=t.getSourceBlock();return(i=n.pathObject).addConnectionHighlight?.call(i,t,e,t.getOffsetInBlock(),n.RTL)}},hg=class extends vh{constructor(e,t,i,n,o,r,s){if(super(vh.SKIP_SETUP),this.imageElement=this.clickHandler=null,this.flipRtl=this.isDirty_=this.EDITABLE=!1,this.altText="",i=Number(an(i)),t=Number(an(t)),isNaN(i)||isNaN(t))throw Error("Height and width values of an image field must cast to numbers.");if(i<=0||t<=0)throw Error("Height and width values of an image field must be greater than 0.");this.size_=new tc(t,i+hg.Y_PADDING),this.imageHeight=i,"function"==typeof o&&(this.clickHandler=o),e!==vh.SKIP_SETUP&&(s?this.configure_(s):(this.flipRtl=!!r,this.altText=an(n)||""),this.setValue(an(e)))}configure_(e){super.configure_(e),e.flipRtl&&(this.flipRtl=e.flipRtl),e.alt&&(this.altText=an(e.alt))}initView(){this.imageElement=p(Zl.IMAGE,{height:this.imageHeight+"px",width:this.size_.width+"px",alt:this.altText},this.fieldGroup_),this.imageElement.setAttributeNS(vl,"xlink:href",this.value_),this.fieldGroup_&&f(this.fieldGroup_,"blocklyImageField"),this.clickHandler&&(this.imageElement.style.cursor="pointer")}updateSize_(){}doClassValidation_(e){return"string"==typeof e?e:null}doValueUpdate_(e){this.value_=e,this.imageElement&&this.imageElement.setAttributeNS(vl,"xlink:href",this.value_)}getFlipRtl(){return this.flipRtl}setAlt(e){e!==this.altText&&(this.altText=e||"",this.imageElement&&this.imageElement.setAttribute("alt",this.altText))}isClickable(){return super.isClickable()&&!!this.clickHandler}showEditor_(){this.clickHandler&&this.clickHandler(this)}setOnClickHandler(e){this.clickHandler=e}getText_(){return this.altText}static fromJson(e){if(!e.src||!e.width||!e.height)throw Error("src, width, and height values for an image field arerequired. The width and height must be non-zero.");return new this(e.src,e.width,e.height,void 0,void 0,void 0,e)}};hg.Y_PADDING=1,uo("field_image",hg),hg.prototype.DEFAULT_VALUE="";var dg=class extends vh{set size_(e){super.size_=e}get size_(){let e=super.size_;return e.width<14&&(e.width=14),e}constructor(e,t,i){super(vh.SKIP_SETUP),this.spellcheck_=!0,this.htmlInput_=null,this.isTextValid_=this.isBeingEdited_=!1,this.onInputWrapper=this.onKeyDownWrapper=this.valueWhenEditorWasOpened_=null,this.fullBlockClickTarget_=!1,this.workspace_=null,this.SERIALIZABLE=!0,e!==vh.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),void 0!==e.spellcheck&&(this.spellcheck_=e.spellcheck)}initView(){if(!this.getSourceBlock())throw new Ih;super.initView(),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot()),this.fieldGroup_&&f(this.fieldGroup_,"blocklyInputField")}isFullBlockField(){let e,t=this.getSourceBlock();if(!t)throw new Ih;return this.fullBlockClickTarget_=!(null==(e=this.getConstants())||!e.FULL_BLOCK_FIELDS)&&t.isSimpleReporter()}doValueInvalid_(e,i=!0){this.isBeingEdited_&&(this.isDirty_=!0,this.isTextValid_=!1,e=this.value_,this.value_=this.valueWhenEditorWasOpened_,this.sourceBlock_&&a()&&this.value_!==e&&i&&t(new(h(ja.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))}doValueUpdate_(e){this.isTextValid_=this.isDirty_=!0,this.value_=e}applyColour(){let e=this.getSourceBlock();if(!e)throw new Ih;this.getConstants().FULL_BLOCK_FIELDS&&this.fieldGroup_&&(!this.isFullBlockField()&&this.borderRect_?(this.borderRect_.style.display="block",this.borderRect_.setAttribute("stroke",e.getColourTertiary())):(this.borderRect_.style.display="none",e.pathObject.
3svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR)))}getSize(){let e;return null!=(e=this.getConstants())&&e.FULL_BLOCK_FIELDS&&(this.render_(),this.isDirty_=!1),super.getSize()}onLocationChange(){this.isBeingEdited_&&this.resizeEditor_()}render_(){if(super.render_(),this.isBeingEdited_){var e=this.htmlInput_;this.isTextValid_?(m(e,"blocklyInvalidInput"),De(e,Dc.INVALID,!1)):(f(e,"blocklyInvalidInput"),De(e,Dc.INVALID,!0))}if(!(e=this.getSourceBlock()))throw new Ih;this.getConstants().FULL_BLOCK_FIELDS&&e.applyColour()}setSpellcheck(e){e!==this.spellcheck_&&(this.spellcheck_=e,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))}showEditor_(e,t=!1,i=!0){this.workspace_=this.sourceBlock_.workspace,!t&&this.workspace_.options.modalInputs&&(tl||Ka||Ja)?this.showPromptEditor():this.showInlineEditor(t,i)}showPromptEditor(){qe(Xs.Msg$$module$build$src$core$msg.CHANGE_VALUE_TITLE,this.getText(),e=>{null!==e&&this.setValue(this.getValueFromEditorText_(e)),this.onFinishEditing_(this.value_)})}showInlineEditor(e,t){let i=this.getSourceBlock();if(!i)throw new Ih;pn(this,i.RTL,this.widgetDispose_.bind(this),this.workspace_,t),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,this.valueWhenEditorWasOpened_=this.value_,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}widgetCreate_(){var e=this.getSourceBlock();if(!e)throw new Ih;Xs.setGroup$$module$build$src$core$events$utils(!0);let t=un();var i=this.getClickTarget_();if(!i)throw Error("A click target has not been set.");f(i,"blocklyEditing"),(i=document.createElement("input")).className="blocklyHtmlInput",i.setAttribute("spellcheck",this.spellcheck_);let n=this.workspace_.getAbsoluteScale();var o=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";return t.style.fontSize=o,i.style.fontSize=o,o=dg.BORDERRADIUS*n+"px",this.isFullBlockField()&&(o=((o=this.getScaledBBox()).bottom-o.top)/2+"px",e=e.getParent()?e.getParent().getColourTertiary():this.sourceBlock_.getColourTertiary(),i.style.border=1*n+"px solid "+e,t.style.borderRadius=o,t.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(t.style.boxShadow="rgba(255, 255, 255, 0.3) 0 0 0 "+4*n+"px")),i.style.borderRadius=o,t.appendChild(i),i.value=i.defaultValue=this.getEditorText_(this.value_),i.setAttribute("data-untyped-default-value",String(this.value_)),this.resizeEditor_(),this.bindInputEvents_(i),i}widgetDispose_(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_(this.value_),this.sourceBlock_&&a()&&null!==this.valueWhenEditorWasOpened_&&this.valueWhenEditorWasOpened_!==this.value_&&(t(new(h(ja.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,this.valueWhenEditorWasOpened_,this.value_)),this.valueWhenEditorWasOpened_=null),Xs.setGroup$$module$build$src$core$events$utils(!1),this.unbindInputEvents_();var e=un().style;if(e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,!(e=this.getClickTarget_()))throw Error("A click target has not been set.");m(e,"blocklyEditing")}onFinishEditing_(e){}bindInputEvents_(e){this.onKeyDownWrapper=aa(e,"keydown",this,this.onHtmlInputKeyDown_),this.onInputWrapper=aa(e,"input",this,this.onHtmlInputChange)}unbindInputEvents_(){this.onKeyDownWrapper&&=(ca(this.onKeyDownWrapper),null),this.onInputWrapper&&=(ca(this.onInputWrapper),null)}onHtmlInputKeyDown_(e){if("Enter"===e.key)mn(this),_i();else if("Escape"===e.key)this.setValue(this.htmlInput_.getAttribute("data-untyped-default-value"),!1),mn(this),_i();else if("Tab"===e.key){e.preventDefault();var t,i=(t=this.workspace_)?.getCursor();t=e=>(e instanceof dg||e instanceof ep&&e.isSimpleReporter())&&e!==this.getSourceBlock(),(e=(e=e.shiftKey?i?.getPreviousNode(this,t,!1):i?.getNextNode(this,t,!1))instanceof ep&&e.isSimpleReporter()?e.getFields().next().value:e)instanceof dg&&(mn(this),_i(),i=e.getSourceBlock(),e.isFullBlockField()&&i&&i instanceof ep?Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(i):Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(e),e.showEditor())}}onHtmlInputChange(e){e=this.value_,this.setValue(this.getValueFromEditorText_(this.htmlInput_.value),!1),this.sourceBlock_&&a()&&this.value_!==e&&t(new(h(ja.BLOCK_FIELD_INTERMEDIATE_CHANGE))(this.sourceBlock_,this.name||null,e,this.value_))}setEditorValue_(e,t=!0){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(e)),this.setValue(e,t)}resizeEditor_(){Be().then(()=>{let e=this.getSourceBlock();if(!e)throw new Ih;let t=un(),i=this.getScaledBBox();t.style.width=i.right-i.left+"px",t.style.height=i.bottom-i.top+"px";let n=i.top;t.style.left=`${e.RTL?i.right-t.offsetWidth:i.left}px`,t.style.top=`${n}px`})}repositionForWindowResize(){let e=this.getSourceBlock()?.getRootBlock();return e instanceof ep&&(qo(this.workspace_,this.workspace_.getMetricsManager().getViewMetrics(!0),e)||this.resizeEditor_(),!0)}positionTextElement_(e,t){let i=2*e+t;super.positionTextElement_(e+(i<14?(14-i)/2:0),t)}getText_(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null}getEditorText_(e){return`${e}`}getValueFromEditorText_(e){return e}};dg.BORDERRADIUS=4;Xs.FieldTextInput$$module$build$src$core$field_textinput=class extends dg{constructor(e,t,i){super(e,t,i)}initView(){super.initView(),this.fieldGroup_&&f(this.fieldGroup_,"blocklyTextInputField")}doClassValidation_(e){return void 0===e?null:`${e}`}static fromJson(e){return new this(an(e.text),void 0,e)}},uo("field_input",Xs.FieldTextInput$$module$build$src$core$field_textinput),Xs.FieldTextInput$$module$build$src$core$field_textinput.prototype.DEFAULT_VALUE="";Xs.FieldTextInput$$module$build$src$core$field_textinput;var pg=class extends zp{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){return!!e.outputConnection}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},fg=class extends uf{constructor(e,t){if(super(e,t),this.connectedBottomNextConnection=!1,this.connectedBlock){for(e=this.connectedBlock;t=e.getNextBlock();)e=t;e.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}}},gg=class extends Wp{constructor(e){super(e),this.width=this.height=0,this.type|=Gp.getType("RIGHT_CONNECTION")}},mg=class extends hf{constructor(e){super(e)}endsWithElemSpacer(){return!1}hasLeftSquareCorner(e){let t=(e.hat?"cap"===e.hat:this.constants_.ADD_START_HATS)&&!e.outputConnection&&!e.previousConnection;return!!e.outputConnection||t}hasRightSquareCorner(e){return!!e.outputConnection&&!e.statementInputCount&&!e.nextConnection}},Tg=class extends gf{constructor(e,t){super(e,t),this.isInline=!0,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.topRow=new mg(this.constants_),this.bottomRow=new pg(this.constants_),this.isMultiRow=!t.getInputsInline()||t.isCollapsed(),this.hasStatementInput=t.statementInputCount>0,this.rightSide=this.outputConnection?new gg(this.constants_):null,this.rightAlignedDummyInputs=new WeakMap}getRenderer(){return this.renderer_}measure(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.adjustXPosition_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()}shouldStartNewRow_(e,t){return!!t&&(t instanceof Vd||e instanceof Gd||t instanceof Gd||(e instanceof Xs.ValueInput$$module$build$src$core$input
3s$value_input||e instanceof Hd||e instanceof Vd)&&(!this.isInline||this.isMultiRow))}getDesiredRowWidth_(e){return e.hasStatement?this.width-this.startX-(this.constants_.INSIDE_CORNERS.rightWidth||0):super.getDesiredRowWidth_(e)}getInRowSpacing_(e,t){return e&&t||!this.outputConnection||!this.outputConnection.isDynamicShape||this.hasStatementInput||this.bottomRow.hasNextConnection?!e&&t&&Gp.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:e&&Gp.isLeftRoundedCorner(e)&&t&&(Gp.isPreviousConnection(t)||Gp.isNextConnection(t))?t.notchOffset-this.constants_.CORNER_RADIUS:e&&Gp.isLeftSquareCorner(e)&&t&&Gp.isHat(t)||e&&Gp.isField(e)&&0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:this.constants_.NO_PADDING}getSpacerRowHeight_(e,t){if(Gp.isTopRow(e)&&Gp.isBottomRow(t))return this.constants_.EMPTY_BLOCK_SPACER_HEIGHT;let i=Gp.isInputRow(e)&&e.hasStatement,n=Gp.isInputRow(t)&&t.hasStatement;return n||i?(e=Math.max(this.constants_.NOTCH_HEIGHT,this.constants_.INSIDE_CORNERS.rightHeight||0),n&&i?Math.max(e,this.constants_.DUMMY_INPUT_MIN_HEIGHT):e):Gp.isTopRow(e)?e.hasPreviousConnection||this.outputConnection&&!this.hasStatementInput?this.constants_.NO_PADDING:Math.abs(this.constants_.NOTCH_HEIGHT-this.constants_.CORNER_RADIUS):Gp.isBottomRow(t)?this.outputConnection?!t.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}getSpacerRowWidth_(e,t){let i=this.width-this.startX;return Gp.isInputRow(e)&&e.hasStatement||Gp.isInputRow(t)&&t.hasStatement?Math.max(i,this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH):i}getElemCenterline_(e,t){if(e.hasStatement&&!Gp.isSpacer(t)&&!Gp.isStatementInput(t))return e.yPos+this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT/2;if(Gp.isInlineInput(t)){let i=t.connectedBlock;if(i&&i.outputConnection&&i.nextConnection)return e.yPos+i.height/2}return super.getElemCenterline_(e,t)}addInput_(e,t){if((e instanceof Hd||e instanceof Vd)&&t.hasDummyInput&&t.align===Xs.Align$$module$build$src$core$inputs$align.LEFT&&e.align===Xs.Align$$module$build$src$core$inputs$align.RIGHT)this.rightAlignedDummyInputs.set(t,e);else if(e instanceof Gd)return t.elements.push(new fg(this.constants_,e)),t.hasStatement=!0,void(null===t.align&&(t.align=e.align));super.addInput_(e,t)}addAlignmentPadding_(e,t){if(this.rightAlignedDummyInputs.get(e)){let i;for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(Gp.isSpacer(n)&&(i=n),Gp.isField(n)&&n.parentInput===this.rightAlignedDummyInputs.get(e))break}if(i)return i.width+=t,void(e.width+=t)}super.addAlignmentPadding_(e,t)}adjustXPosition_(){let e=this.constants_.NOTCH_OFFSET_LEFT+this.constants_.NOTCH_WIDTH,t=e;for(let o=2;o<this.rows.length-1;o+=2){var i=this.rows[o-1];let r=this.rows[o];var n=this.rows[o+1];if(i=2===o?!!this.topRow.hasPreviousConnection:!!i.followsStatement,n=o+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!n.precedesStatement,Gp.isInputRow(r)&&r.hasStatement)r.measure(),t=r.width-(r.getLastInput()?.width??0)+e;else if(i&&(2===o||n)&&Gp.isInputRow(r)&&!r.hasStatement){n=r.xPos,i=null;for(let e=0;e<r.elements.length;e++){let o=r.elements[e];Gp.isSpacer(o)&&(i=o),!(i&&(Gp.isField(o)||Gp.isInput(o))&&n<t)||Gp.isField(o)&&(o.field instanceof $d||o.field instanceof hg)||(i.width+=t-n),n+=o.width}}}}finalizeOutputConnection_(){if(this.outputConnection&&this.outputConnection.isDynamicShape){var e=this.outputConnection.shape;if("isDynamic"in e&&e.isDynamic){for(var t=0,i=0;i<this.rows.length;i++){let e=this.rows[i];e.yPos=t,t+=e.height}this.height=t,i=this.bottomRow.hasNextConnection?this.height-this.bottomRow.descenderHeight:this.height,t=e.height(i),i=e.width(i),this.outputConnection.height=t,this.outputConnection.width=i,this.outputConnection.startX=i,this.outputConnection.connectionOffsetY=e.connectionOffsetY(t),this.outputConnection.connectionOffsetX=e.connectionOffsetX(i),e=0,this.hasStatementInput||this.bottomRow.hasNextConnection||(e=i,this.rightSide.height=t,this.rightSide.width=e,this.rightSide.centerline=t/2,this.rightSide.xPos=this.width+e),this.startX=i,this.width+=i+e,this.widthWithChildren+=i+e}}}finalizeHorizontalAlignment_(){if(this.outputConnection&&!this.hasStatementInput&&!this.bottomRow.hasNextConnection){for(var e=0,t=0;t<this.rows.length;t++){var i=this.rows[t];if(!Gp.isInputRow(i))continue;e=i.elements[i.elements.length-2];let n=this.getNegativeSpacing_(i.elements[1]),o=this.getNegativeSpacing_(e);e=n+o;let r=this.constants_.MIN_BLOCK_WIDTH+2*this.outputConnection.width;this.width-e<r&&(n=(e=this.width-r)/2,o=e/2),i.elements.unshift(new Zp(this.constants_,-n)),i.elements.push(new Zp(this.constants_,-o))}if(e)for(this.width-=e,this.widthWithChildren-=e,this.rightSide.xPos-=e,t=0;t<this.rows.length;t++)i=this.rows[t],Gp.isTopOrBottomRow(i)&&(i.elements[1].width-=e),i.width-=e,i.widthWithConnectedBlocks-=e}}getNegativeSpacing_(e){if(!e||!this.outputConnection)return 0;let t=this.outputConnection.width;var i=this.outputConnection.shape.type;let n=this.constants_;if(this.inputRows.length>1){if(i===n.SHAPES.ROUND)return i=this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,t-(i=this.height/2>i?i:this.height/2)*(1-Math.sin(Math.acos((i-this.constants_.SMALL_PADD
3ING)/i)));return 0}if(Gp.isInlineInput(e)){let o=e.connectedBlock;return null==(e=o?o.pathObject.outputShapeType:e.shape.type)||o&&o.outputConnection&&(o.statementInputCount||o.nextConnection)||i===n.SHAPES.HEXAGONAL&&i!==e?0:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][e]}return Gp.isField(e)?i===n.SHAPES.ROUND&&e.field instanceof Xs.FieldTextInput$$module$build$src$core$field_textinput?t-2.75*n.GRID_UNIT:t-this.constants_.SHAPE_IN_SHAPE_PADDING[i][0]:Gp.isIcon(e)?this.constants_.SMALL_PADDING:0}finalizeVerticalAlignment_(){if(!this.outputConnection)for(let n=2;n<this.rows.length-1;n+=2){let o=this.rows[n-1],r=this.rows[n],s=this.rows[n+1];var e=2===n,t=n+2>=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!s.precedesStatement;if(e?this.topRow.hasPreviousConnection:o.followsStatement){var i=r.elements[1];if(i=3===r.elements.length&&i instanceof Kp&&(i.field instanceof $d||i.field instanceof hg),!e&&i)o.height-=this.constants_.SMALL_PADDING,s.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.MEDIUM_PADDING;else if(e||t){if(t){for(e=!1,t=0;t<r.elements.length;t++)if(i=r.elements[t],Gp.isInlineInput(i)&&i.connectedBlock&&!i.connectedBlock.isShadow()&&i.connectedBlock.getHeightWidth().height>=40){e=!0;break}e&&(o.height-=this.constants_.SMALL_PADDING,s.height-=this.constants_.SMALL_PADDING)}}else o.height+=this.constants_.SMALL_PADDING}}}finalize_(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),super.finalize_(),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)}},_g=class extends mf{constructor(e,t,i){super(e,t,i),this.svgPathSelected=null,this.outlines=new Map,this.remainingOutlines=new Set,this.outputShapeType=null,this.constants=i}setPath(e){super.setPath(e),this.svgPathSelected&&this.svgPathSelected.setAttribute("d",e)}applyColour(e){super.applyColour(e);let t=e.getParent();e.isShadow()&&t&&this.svgPath.setAttribute("stroke",t.getColourTertiary());for(let i of this.outlines.values())i.setAttribute("fill",this.style.colourTertiary)}flipRTL(){super.flipRTL();for(let e of this.outlines.values())e.setAttribute("transform","scale(-1 1)")}updateSelected(e){this.setClass_("blocklySelected",e),e?this.svgPathSelected||(this.svgPathSelected=this.svgPath.cloneNode(!0),this.svgPathSelected.classList.add("blocklyPathSelected"),m(this.svgPathSelected,Al.ACTIVE_FOCUS_NODE_CSS_CLASS_NAME),m(this.svgPathSelected,Al.PASSIVE_FOCUS_NODE_CSS_CLASS_NAME),this.svgPathSelected.removeAttribute("tabindex"),this.svgPathSelected.removeAttribute("id"),this.svgRoot.appendChild(this.svgPathSelected)):this.svgPathSelected&&=(this.svgRoot.removeChild(this.svgPathSelected),null)}updateReplacementFade(e){this.setClass_("blocklyReplaceable",e)}updateShapeForInputHighlight(e,t){e=e.getParentInput().name,(e=this.getOutlinePath(e))&&(t?e.setAttribute("filter","url(#"+this.constants.replacementGlowFilterId+")"):e.removeAttribute("filter"))}beginDrawing(){this.remainingOutlines.clear();for(let e of this.outlines.keys())this.remainingOutlines.add(e)}endDrawing(){if(this.remainingOutlines.size)for(let e of this.remainingOutlines)this.removeOutlinePath(e);this.remainingOutlines.clear()}setOutlinePath(e,t){(e=this.getOutlinePath(e)).setAttribute("d",t),e.setAttribute("fill",this.style.colourTertiary)}getOutlinePath(e){return this.outlines.has(e)||this.outlines.set(e,p(Zl.PATH,{class:"blocklyOutlinePath",d:""},this.svgRoot)),this.remainingOutlines.delete(e),this.outlines.get(e)}removeOutlinePath(e){let t,i;null==(t=this.outlines.get(e))||null==(i=t.parentNode)||i.removeChild(this.outlines.get(e)),this.outlines.delete(e)}},Eg=class extends Tf{constructor(e){super(e)}makeConstants_(){return new cg}makeRenderInfo_(e){return new Tg(this,e)}makeDrawer_(e,t){return new ug(e,t)}makePathObject(e,t){return new _g(e,t,this.getConstants())}getConstants(){return this.constants_}};Cr("zelos",Eg);var bg=class{constructor(e){this.staticConn=this.draggedConn=this.markerConn=this.fadedBlock=null,this.workspace=e.workspace}previewReplacement(e,t,i){Xs.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.fadedBlock=i,i.fadeForReplacement(!0),this.workspace.getRenderer().shouldHighlightConnection(t)&&(t.highlight(),this.staticConn=t)}finally{Xs.enable$$module$build$src$core$events$utils()}}previewConnection(e,t){if(e!==this.draggedConn||t!==this.staticConn){Xs.disable$$module$build$src$core$events$utils();try{this.hidePreview(),this.shouldUseMarkerPreview(e,t)&&(this.markerConn=this.previewMarker(e,t)),this.workspace.getRenderer().shouldHighlightConnection(t)&&t.highlight(),this.draggedConn=e,this.staticConn=t}finally{Xs.enable$$module$build$src$core$events$utils()}}}shouldUseMarkerPreview(e,t){return t.type===Rd.PREVIOUS_STATEMENT||t.type===Rd.NEXT_STATEMENT||!(this.workspace.getRenderer()instanceof Eg)}previewMarker(e,t){let i=e.getSourceBlock(),n=this.createInsertionMarker(i),o=this.getMatchingConnection(i,n,e);if(!o)return null;n.queueRender(),Ue(),o.connect(t);let r={x:t.x-o.x,y:t.y-o.y},s=o.getOffsetInBlock().clone();return Be().then(()=>
3{if(!n.isDeadOrDying()){Xs.disable$$module$build$src$core$events$utils();try{n?.positionNearConnection(o,r,s),n?.getSvgRoot().setAttribute("visibility","visible")}finally{Xs.enable$$module$build$src$core$events$utils()}}}),o}serializeBlockToInsertionMarker(e){let t=Rt(e,{addCoordinates:!1,addInputBlocks:!1,addNextBlocks:!1,doFullSerialization:!1});if(!t)throw Error(`Failed to serialize source block. ${e.toDevString()}`);return t}createInsertionMarker(e){e=this.serializeBlockToInsertionMarker(e),e=xt(e,this.workspace);for(let t of e.getDescendants(!1))t.setInsertionMarker(!0);return e.initSvg(),e.getSvgRoot().setAttribute("visibility","hidden"),e}getMatchingConnection(e,t,i){if(e=e.getConnections_(!0),t=t.getConnections_(!0),e.length!==t.length)return null;for(let n=0;n<e.length;n++)if(e[n]===i)return t[n];return null}hidePreview(){Xs.disable$$module$build$src$core$events$utils();try{this.staticConn&&=(this.staticConn.unhighlight(),null),this.fadedBlock&&=(this.fadedBlock.fadeForReplacement(!1),null),this.markerConn&&(this.hideInsertionMarker(this.markerConn),this.draggedConn=this.markerConn=null)}finally{Xs.enable$$module$build$src$core$events$utils()}}hideInsertionMarker(e){let t,i=e.getSourceBlock(),n=i.outputConnection;if(null!=(t=i.previousConnection)&&t.targetConnection||null!=n&&n.targetConnection)i.unplug(!0);else{let t;null==(t=e.targetBlock())||t.unplug(!1)}i.dispose()}dispose(){this.hidePreview()}};zs(ka.CONNECTION_PREVIEWER,Ca,bg);var Og={};Og.Align=Xs.Align$$module$build$src$core$inputs$align,Og.DummyInput=Hd,Og.EndRowInput=Vd,Og.Input=Ud,Og.StatementInput=Gd,Og.ValueInput=Xs.ValueInput$$module$build$src$core$inputs$value_input,Og.inputTypes=Xs.inputTypes$$module$build$src$core$inputs$input_types;var vg=!1;Xs.CodeGenerator$$module$build$src$core$generator=class{constructor(e){this.forBlock=Object.create(null),this.FUNCTION_NAME_PLACEHOLDER_="{leCUI8hutHZI4480Dc}",this.STATEMENT_SUFFIX=this.STATEMENT_PREFIX=this.INFINITE_LOOP_TRAP=null,this.INDENT=" ",this.COMMENT_WRAP=60,this.ORDER_OVERRIDES=[],this.isInitialized=null,this.RESERVED_WORDS_="",this.definitions_=Object.create(null),this.functionNames_=Object.create(null),this.nameDB_=void 0,this.name_=e,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")}workspaceToCode(e){e||=(console.warn("No workspace specified in workspaceToCode call. Guessing."),M());var t=[];this.init(e),e=e.getTopBlocks(!0);for(let i,n=0;i=e[n];n++){let e=this.blockToCode(i);Array.isArray(e)&&(e=e[0]),e&&(i.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!i.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,i)+e),this.STATEMENT_SUFFIX&&!i.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX,i))),t.push(e))}return t=t.join("\n"),(t=(t=(t=this.finish(t)).replace(/^\s+\n/,"")).replace(/\n\s+$/,"\n")).replace(/[ \t]+\n/g,"\n")}prefixLines(e,t){return t+e.replace(/(?!\n$)\n/g,"\n"+t)}allNestedComments(e){let t=[];e=e.getDescendants(!0);for(let i=0;i<e.length;i++){let n=e[i].getCommentText();n&&t.push(n)}return t.length&&t.push(""),t.join("\n")}blockToCode(e,t){if(!1===this.isInitialized&&console.warn("CodeGenerator init was not called before blockToCode was called."),!e)return"";if(!e.isEnabled())return t?"":this.blockToCode(e.getNextBlock());if(e.isInsertionMarker())return t?"":this.blockToCode(e.getChildren(!1)[0]);var i=this.forBlock[e.type];if("function"!=typeof i)throw Error(`${this.name_} generator does not know how to generate code for block type "${e.type}".`);if(i=i.call(e,e,this),Array.isArray(i)){if(!e.outputConnection)throw TypeError("Expecting string from statement block: "+e.type);return[this.scrub_(e,i[0],t),i[1]]}if("string"==typeof i)return this.STATEMENT_PREFIX&&!e.suppressPrefixSuffix&&(i=this.injectId(this.STATEMENT_PREFIX,e)+i),this.STATEMENT_SUFFIX&&!e.suppressPrefixSuffix&&(i+=this.injectId(this.STATEMENT_SUFFIX,e)),this.scrub_(e,i,t);if(null===i)return"";throw SyntaxError("Invalid code generated: "+i)}valueToCode(e,t,i){if(isNaN(i))throw TypeError("Expecting valid order from block: "+e.type);var n=e.getInputTargetBlock(t);if(!n&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if(!n||""===(t=this.blockToCode(n)))return"";if(!Array.isArray(t))throw TypeError(`Expecting tuple from value block: ${n.type} See developers.google.com/blockly/guides/create-custom-blocks/generating-code for more information`);if(e=t[0],t=t[1],isNaN(t))throw TypeError("Expecting valid order from value block: "+n.type);if(!e)return"";n=!1;var o=Math.floor(i);let r=Math.floor(t);if(o<=r&&(o!==r||0!==o&&99!==o))for(n=!0,o=0;o<this.ORDER_OVERRIDES.length;o++)if(this.ORDER_OVERRIDES[o][0]===i&&this.ORDER_OVERRIDES[o][1]===t){n=!1;break}return n&&(e="("+e+")"),e}statementToCode(e,t){let i=e.getInputTargetBlock(t);if(!i&&!e.getInput(t))throw ReferenceError(`Input "${t}" doesn't exist on "${e.type}"`);if("string"!=typeof(e=this.blockToCode(i)))throw TypeError("Expecting code from statement block: "+(i&&i.type));return e&&=this.prefixLines(e,this.INDENT),e}addLoopTrap(e,t){return this.INFINITE_LOOP_TRAP&&(e=this.prefixLines(this.injectId(this.INFINITE_LOOP_TRAP,t),this.INDENT)+e),this.STATEMENT_SUFFIX&&!t.suppressPrefixSuffix&&(e=this.prefixLines(this.injectId(this.STATEMENT_SUFFIX,t),this.INDENT)+e),this.STATEMENT_PREFIX&&!t.suppressPrefixSuffix&&(e+=this.prefixLines(this.injectId(this.STATEMENT_PREFIX,t),this.INDENT)),e}injectId(e,t){return t=t.id.replace(/\$/g,"$$$$"),e.replace(/%1/g,"'"+t+"'")}addReservedWords(e){this.RESERVED_WORDS_+=e+","}provideFunction_(e,t){if(!this.definitions_[e]){let i,n=this.nameDB_.getDistinctName(e,Xs.NameType$$module$build$src$core$names.PROCEDURE);for(this.functionNames_[e]=n,Array.isArray(t)&&(t=t.join("\n")),t=t.trim().replace(this.FUNCTION_NAME_PLACEHOLDER_REGEXP_,n);i!==t;)i=t,t=t.replace(/^(( {2})*) {2}/gm,"$1\0");t=t.replace(/\0/g,this.INDENT),this.definitions_[e]=t}return this.functionNames_[e]}getVariableName(e){return this.getName(e,Xs.NameType$$module$build$src$core$names.VARIABLE)}getProcedureName(e){return this.getName(e,Xs.NameType$$module$build$src$core$names.PROCEDURE)}getName(e,t){if(!this.nameDB_)throw Error("Name database is not defined. You must initialize `nameDB_` in your generator class and call `init` first.");return this.nameDB_.getName(e,t)}init(e){this.definitions_=Object.create(null),this.functionNames_=Object.create(null)}scrub_(e,t,i){return t}finish(e){return this.definitions_=Object.create(null),this.functionNames_=Object.create(null),e}scrubNakedValue(e){return e}},Xs.CodeGenerator$$module$build$src$core$generator;var Ig=class extends kp{constructor(e){super(e)}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.y&&(this.workspace_.scrollY=-(i.top+(i.height-n.height)*e.y)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_===mc.LEFT?e.width:i.width-this.getWidth():this.toolboxPosition_===mc.LEFT?
30:i.width:this.toolboxPosition_===mc.LEFT?0:i.width+t.left-this.getWidth()}getY(){return 0}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=e.height;var t=this.getWidth()-this.CORNER_RADIUS;this.setBackgroundPath(t,e.height-2*this.CORNER_RADIUS),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===mc.RIGHT;var n=e+this.CORNER_RADIUS;(n=["M "+(i?n:0)+",0"]).push("h",i?-e:e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",Math.max(0,t)),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,+!i,i?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",i?e:-e),n.push("z"),this.svgBackground_.setAttribute("d",n.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setY(0)}wheel_(e){var t=pa(e);if(t.y){let e,i=this.workspace_.getMetricsManager(),n=i.getScrollMetrics();t=i.getViewMetrics().top-n.top+t.y,null==(e=this.workspace_.scrollbar)||e.setY(t),Tn(this.workspace_),_i()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;var t=this.MARGIN;let i=this.RTL?t:t+this.tabWidth_;for(let n of e)n.getElement().moveBy(i,t),t+=n.getElement().getBoundingRectangle().getHeight()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let t=this.dragAngleRange_;return e<t&&e>-t||e<-180+t||e>180-t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;let e=this.svgGroup_.getBoundingClientRect(),t=e.left;return this.toolboxPosition_===mc.LEFT?new ec(-1e9,1e9,-1e9,t+e.width):new ec(-1e9,1e9,t,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getWidth()),0);if(e+=1.5*this.MARGIN+this.tabWidth_,e*=this.workspace_.scale,e+=ac.scrollbarThickness,this.getWidth()!==e){if(this.RTL)for(let t of this.getContents()){let i=t.getElement().getBoundingRectangle().left,n=e/this.workspace_.scale-t.getElement().getBoundingRectangle().getWidth()-this.MARGIN-this.tabWidth_;t.getElement().moveBy(n-i,0)}this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==mc.LEFT||this.targetWorkspace.translate(this.targetWorkspace.scrollX+e,this.targetWorkspace.scrollY),this.width_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets()}}};Ig.registryName="verticalFlyout",zs(ka.FLYOUTS_VERTICAL_TOOLBOX,Ca,Ig);var Sg=class extends kp{constructor(e){super(e),this.horizontalLayout=!0}setMetrics_(e){if(this.isVisible()){var t=this.workspace_.getMetricsManager(),i=t.getScrollMetrics(),n=t.getViewMetrics();t=t.getAbsoluteMetrics(),"number"==typeof e.x&&(this.workspace_.scrollX=-(i.left+(i.width-n.width)*e.x)),this.workspace_.translate(this.workspace_.scrollX+t.left,this.workspace_.scrollY+t.top)}}getX(){return 0}getY(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager();let t=e.getAbsoluteMetrics(),i=e.getViewMetrics();e=e.getToolboxMetrics();let n=this.toolboxPosition_===mc.TOP;return this.targetWorkspace.toolboxPosition===this.toolboxPosition_?this.targetWorkspace.getToolbox()?n?e.height:i.height-this.getHeight():n?0:i.height:n?0:i.height+t.top-this.getHeight()}position(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var e=this.targetWorkspace.getMetricsManager().getViewMetrics();this.width_=e.width,e=e.width-2*this.CORNER_RADIUS;var t=this.getHeight()-this.CORNER_RADIUS;this.setBackgroundPath(e,t),e=this.getX(),t=this.getY(),this.positionAt_(this.getWidth(),this.getHeight(),e,t)}}setBackgroundPath(e,t){let i=this.toolboxPosition_===mc.TOP,n=["M 0,"+(i?0:this.CORNER_RADIUS)];i?(n.push("h",e+2*this.CORNER_RADIUS),n.push("v",t),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("h",-e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,-this.CORNER_RADIUS,-this.CORNER_RADIUS)):(n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,-this.CORNER_RADIUS),n.push("h",e),n.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,1,this.CORNER_RADIUS,this.CORNER_RADIUS),n.push("v",t),n.push("h",-e-2*this.CORNER_RADIUS)),n.push("z"),this.svgBackgroun
3d_.setAttribute("d",n.join(" "))}scrollToStart(){let e;null==(e=this.workspace_.scrollbar)||e.setX(this.RTL?1/0:0)}wheel_(e){var t=pa(e);if(t=t.x||t.y){let e,i=this.workspace_.getMetricsManager(),n=i.getScrollMetrics();t=i.getViewMetrics().left-n.left+t,null==(e=this.workspace_.scrollbar)||e.setX(t),Tn(this.workspace_),_i()}e.preventDefault(),e.stopPropagation()}layout_(e){this.workspace_.scale=this.targetWorkspace.scale;let t=this.MARGIN,i=t+this.tabWidth_;this.RTL&&(e=e.reverse());for(let n of e)e=n.getElement().getBoundingRectangle(),e=this.RTL?i+e.getWidth():i,n.getElement().moveBy(e,t),i+=n.getElement().getBoundingRectangle().getWidth()}isDragTowardWorkspace(e){e=Math.atan2(e.y,e.x)/Math.PI*180;let t=this.dragAngleRange_;return e<90+t&&e>90-t||e>-90-t&&e<-90+t}getClientRect(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;let e=this.svgGroup_.getBoundingClientRect(),t=e.top;return this.toolboxPosition_===mc.TOP?new ec(-1e9,t+e.height,-1e9,1e9):new ec(t,1e9,-1e9,1e9)}reflowInternal_(){this.workspace_.scale=this.getFlyoutScale();let e=this.getContents().reduce((e,t)=>Math.max(e,t.getElement().getBoundingRectangle().getHeight()),0);e+=1.5*this.MARGIN,e*=this.workspace_.scale,e+=ac.scrollbarThickness,this.getHeight()!==e&&(this.targetWorkspace.scrollbar||this.autoClose||this.targetWorkspace.getFlyout()!==this||this.toolboxPosition_!==mc.TOP||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+e),this.height_=e,this.position(),this.targetWorkspace.resizeContents(),this.targetWorkspace.recordDragTargets())}};zs(ka.FLYOUTS_HORIZONTAL_TOOLBOX,Ca,Sg);var yg=class extends ud{constructor(e,t,i,n,o){super(vh.SKIP_SETUP),this.defaultType="",this.variableTypes=[],this.variable=null,this.SERIALIZABLE=!0,this.menuGenerator_=yg.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new tc(0,0),e!==vh.SKIP_SETUP&&(o?this.configure_(o):this.setTypes(i,n),t&&this.setValidator(t))}configure_(e){super.configure_(e),this.setTypes(e.variableTypes,e.defaultType)}initModel(){var e=this.getSourceBlock();if(!e)throw new Ih;this.variable||(e=Xs.getOrCreateVariablePackage$$module$build$src$core$variables(e.workspace,null,this.defaultVariableName,this.defaultType),this.doValueUpdate_(e.getId()))}initView(){super.initView(),f(this.fieldGroup_,"blocklyVariableField")}shouldAddBorderRect_(){let e=this.getSourceBlock();if(!e)throw new Ih;return super.shouldAddBorderRect_()&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!==e.type)}fromXml(e){var t=this.getSourceBlock();if(!t)throw new Ih;let i=e.getAttribute("id"),n=e.textContent,o=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(t=Xs.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,i,n,o),null!==o&&o!==t.getType())throw Error("Serialized variable type with id '"+t.getId()+"' had type "+t.getType()+", and does not match variable field that references it: "+Xn(e)+".");this.setValue(t.getId())}toXml(e){return this.initModel(),e.id=this.variable.getId(),e.textContent=this.variable.getName(),this.variable.getType()&&e.setAttribute("variabletype",this.variable.getType()),e}saveState(e){var t=this.saveLegacyState(yg);return null===t?(this.initModel(),t={id:this.variable.getId()},e&&(t.name=this.variable.getName(),t.type=this.variable.getType()),t):t}loadState(e){let t=this.getSourceBlock();if(!t)throw new Ih;this.loadLegacyState(yg,e)||(e=Xs.getOrCreateVariablePackage$$module$build$src$core$variables(t.workspace,e.id||null,e.name,e.type||""),this.setValue(e.getId()))}setSourceBlock(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");super.setSourceBlock(e)}getValue(){return this.variable?this.variable.getId():null}getText(){return this.variable?this.variable.getName():""}getVariable(){return this.variable}getDefaultType(){return this.defaultType}getValidator(){return this.variable?this.validator_:null}doClassValidation_(e){if(null===e)return null;var t=this.getSourceBlock();if(!t)throw new Ih;return(t=Xs.getVariable$$module$build$src$core$variables(t.workspace,e))?(t=t.getType(),this.typeIsAllowed(t)?e:(console.warn("Variable type doesn't match this field! Type was "+t),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)}doValueUpdate_(e){let t=this.getSourceBlock();if(!t)throw new Ih;this.variable=Xs.getVariable$$module$build$src$core$variables(t.workspace,e),super.doValueUpdate_(e)}typeIsAllowed(e){let t=this.getVariableTypes();if(!t)return!0;for(let i=0;i<t.length;i++)if(e===t[i])return!0;return!1}getVariableTypes(){if(this.variableTypes)return this.variableTypes;if(!this.sourceBlock_||this.sourceBlock_.isDeadOrDying())return[""];let e=this.sourceBlock_.workspace.getVariableMap().getTypes();if(this.sourceBlock_.isInFlyout){let t=this.sourceBlock_.workspace.getPotentialVariableMap();if(!t)return e;e=Array.from(new Set([...e,...t.getTypes()]))}return e}setTypes(e=null,t=""){var i=this.getText();if(Array.isArray(e)){if(0===e.length)throw Error(`'variableTypes' of field variable ${i} was an empty list. If you want to include all variable types, pass 'null' instead.`);i=!1;for(let n=0;n<e.length;n++)e[n]===t&&(i=!0);if(!i)throw Error("Invalid default type '"+t+"' in the definition of a FieldVariable")}else if(null!==e)throw Error(`'variableTypes' was not an array or null in the definition of FieldVariable ${i}`);this.defaultType=t,this.variableTypes=e}refreshVariableName(){this.forceRerender()}onItemSelected_(e,t){if(e=t.getValue(),this.sourceBlock_&&!this.sourceBlock_.isDeadOrDying()){if(e===xd&&this.variable)return void Xs.renameVariable$$module$build$src$core$variables(this.sourceBlock_.workspace,this.variable);if(e===Dd&&this.variable)return e=this.variable.getWorkspace(),void Xs.deleteVariable$$module$build$src$core$variables(e,this.variable,this.sourceBlock_)}this.setValue(e)}referencesVariables(){return!0}static fromJson(e){return new this(an(e.variable),void 0,void 0,void 0,e)}static dropdownCreate(){if(!this.variable)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");let e=this.getText(),t=[];var i=this.getSourceBlock();if(i&&!i.isDeadOrDying()){i=i.workspace;let e=this.getVariableTypes();for(let r=0;r<e.length;r++){let s=e[r],a=i.getVariableMap().getVariablesOfType(s);if(t=t.concat(a),i.isFlyout){var n=void 0,o=void 0;t=t.concat((o=(n=i.getPotentialVariableMap())?.getVariablesOfType(s))??[])}}}for(t.sort(St),n=[],o=0;o<t.length;o++)n[o]=[t[o].getName(),t[o].getId()];return n.push([Xs.Msg$$module$build$src$core$msg.RENAME_VARIABLE,xd]),Xs.Msg$$module$build$src$core$msg.DELETE_VARIABLE&&n.push([Xs.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",e),Dd]),n}};uo("field_variable",yg);var Rg=class extends dg{constructor(e,t,i,n,o,r){super(vh.SKIP_SETUP),this.min_=-1/0,this.max_=1/0,this.precision_=0,this.decimalPlaces=null,this.spellcheck_=!1,e!==vh.SKIP_SETUP&&(r?this.configure_(r):this.setConstraints(t,i,n),this.setValue(e),o&&this.setValidator(o))}configure_(e){super.configure_(e),this.setMinInternal(e.min),this.setMaxInternal(e.max),this.setPrecisionInternal(e.precision)}setConstraints(e,t,i){this.setMinInternal(e),this.setMaxInternal(t),this.setPrecisionInternal(i),this.setValue(this.getValue())}setMin(e){this.setMinInternal(e),this.setValue(this.getValue())}setMinInternal(e){null==e?this.min_=-1/0:(e=Number(e),isNaN(e)||(this.min_=e))}getMin(){return this.min_}setMax(e){this.setMaxInternal(e),this.setValue(this.getValue())}setMaxInternal(e){null==e?this.max_=1/0:(e=Number(e),isNaN(e)||(this.max_=e))}getMax(){return this.max_}setPrecision(e){this.setPrecisionInternal(e),this.setValue(this.getValue())}setPrecisionInternal(e){this.precision_=Number(e)||0;let t=String(this.precision_);
3t.includes("e")&&(t=this.precision_.toLocaleString("en-US",{maximumFractionDigits:20}));let i=t.indexOf(".");this.decimalPlaces=-1===i?e?0:null:t.length-i-1}getPrecision(){return this.precision_}doClassValidation_(e){return null===e||(e=(e=(e=`${e}`.replace(/O/gi,"0")).replace(/,/g,"")).replace(/infinity/i,"Infinity"),e=Number(e||0),isNaN(e))?null:(e=Math.min(Math.max(e,this.min_),this.max_),this.precision_&&isFinite(e)&&(e=Math.round(e/this.precision_)*this.precision_),null!==this.decimalPlaces&&(e=Number(e.toFixed(this.decimalPlaces))),e)}widgetCreate_(){let e=super.widgetCreate_();return this.min_>-1/0&&(e.min=`${this.min_}`,De(e,Dc.VALUEMIN,this.min_)),this.max_<1/0&&(e.max=`${this.max_}`,De(e,Dc.VALUEMAX,this.max_)),e}initView(){super.initView(),this.fieldGroup_&&f(this.fieldGroup_,"blocklyNumberField")}static fromJson(e){return new this(e.value,void 0,void 0,void 0,void 0,e)}};uo("field_number",Rg),Rg.prototype.DEFAULT_VALUE=0;var Cg=class extends $d{constructor(e,t,i){super(String(e??""),t,i),this.EDITABLE=!1,this.SERIALIZABLE=!0}static fromJson(e){return new this(an(e.text),void 0,e)}};uo("field_label_serializable",Cg);var kg=class extends vh{constructor(e,t,i){super(vh.SKIP_SETUP),this.SERIALIZABLE=!0,this.value_=this.value_,this.checkChar=kg.CHECK_CHAR,e!==vh.SKIP_SETUP&&(i&&this.configure_(i),this.setValue(e),t&&this.setValidator(t))}configure_(e){super.configure_(e),e.checkCharacter&&(this.checkChar=e.checkCharacter)}saveState(){let e=this.saveLegacyState(kg);return null===e?this.getValueBoolean():e}initView(){super.initView();let e=this.getTextElement();f(this.fieldGroup_,"blocklyCheckboxField"),e.style.display=this.value_?"block":"none"}render_(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)}getDisplayText_(){return this.checkChar}setCheckCharacter(e){this.checkChar=e||kg.CHECK_CHAR,this.forceRerender()}showEditor_(){this.setValue(!this.value_)}doClassValidation_(e){return!0===e||"TRUE"===e?"TRUE":!1===e||"FALSE"===e?"FALSE":null}doValueUpdate_(e){this.value_=this.convertValueToBool(e),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")}getValue(){return this.value_?"TRUE":"FALSE"}getValueBoolean(){return this.value_}getText(){return String(this.convertValueToBool(this.value_))}convertValueToBool(e){return"string"==typeof e?"TRUE"===e:!!e}static fromJson(e){return new this(e.checked,void 0,e)}};kg.CHECK_CHAR="â",uo("field_checkbox",kg),kg.prototype.DEFAULT_VALUE=!1;var Ag=class{constructor(e,t){this.draggable=e,this.workspace=t,this.dragTarget=null,this.startLoc=e.getRelativeToSurfaceXY()}onDragStart(e){Xs.getGroup$$module$build$src$core$events$utils()||Xs.setGroup$$module$build$src$core$events$utils(!0),this.draggable.startDrag(e)}onDrag(e,t){this.moveDraggable(e,t),t=this.getRoot(this.draggable),tr(t)&&t.setDeleteStyle(this.wouldDeleteDraggable(e,t)),this.updateDragTarget(e)}updateDragTarget(e){e=this.workspace.getDragTarget(e);let t=this.getRoot(this.draggable);if(this.dragTarget!==e){let i;null==(i=this.dragTarget)||i.onDragExit(t),e?.onDragEnter(t)}e?.onDragOver(t),this.dragTarget=e}moveDraggable(e,t){t=this.pixelsToWorkspaceUnits(t),t=Jl.sum(this.startLoc,t),this.draggable.drag(t,e)}wouldDeleteDraggable(e,t){return!(!(e=this.workspace.getDragTarget(e))||!this.workspace.getComponentManager().hasCapability(e.id,zl.Capability.DELETE_AREA))&&e.wouldDelete(t)}onDragEnd(e){let t=Xs.getGroup$$module$build$src$core$events$utils();var i=this.workspace.getDragTarget(e);let n=this.getRoot(this.draggable);if(i){let e;null==(e=this.dragTarget)||e.onDrop(n)}this.shouldReturnToStart(e,n)&&this.draggable.revertDrag(),(i=tr(n)&&this.wouldDeleteDraggable(e,n))&&this.draggable instanceof ep&&Vo(this.draggable.getRootBlock()),this.draggable.endDrag(e),i&&tr(n)&&(Xs.setGroup$$module$build$src$core$events$utils(t),n.dispose()),Xs.setGroup$$module$build$src$core$events$utils(!1),!i&&C(this.draggable)&&Xs.getFocusManager$$module$build$src$core$focus_manager().focusNode(this.draggable)}getRoot(e){return e instanceof ep?e.getRootBlock():e}shouldReturnToStart(e,t){return!!(e=this.workspace.getDragTarget(e))&&e.shouldPreventMove(t)}pixelsToWorkspaceUnits(e){return e=new Jl(e.x/this.workspace.scale,e.y/this.workspace.scale),this.workspace.isMutator&&e.scale(1/this.workspace.options.parentWorkspace.scale),e}};zs(ka.BLOCK_DRAGGER,Ca,Ag);var Lg={};Lg.BlockDragStrategy=qd,Lg.BubbleDragStrategy=gd,Lg.CommentDragStrategy=Wh,Lg.Dragger=Ag;var Ng=class extends Hl{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=ja.BLOCK_DRAG,e&&(this.blockId=e.id,this.isStart=t,this.blocks=i)}
3toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");return e.isStart=this.isStart,e.blockId=this.blockId,e.blocks=this.blocks,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new Ng)).isStart=e.isStart,t.blockId=e.blockId,t.blocks=e.blocks,t}};zs(ka.EVENT,ja.BLOCK_DRAG,Ng);var wg=class extends Nu{constructor(e,t,i,n){super(e),this.type=ja.BLOCK_FIELD_INTERMEDIATE_CHANGE,this.recordUndo=!1,e&&(this.name=t,this.oldValue=i,this.newValue=n)}toJson(){let e=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");return e.name=this.name,e.oldValue=this.oldValue,e.newValue=this.newValue,e}static fromJson(e,t,i){return(t=Nu.fromJson(e,t,i??new wg)).name=e.name,t.oldValue=e.oldValue,t.newValue=e.newValue,t}isNull(){return this.oldValue===this.newValue}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");if(!(t=t.getBlockById(this.blockId)))throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");e=e?this.newValue:this.oldValue,(t=t.getField(this.name))?t.setValue(e):console.warn("Can't set non-existent field: "+this.name)}};zs(ka.EVENT,ja.BLOCK_FIELD_INTERMEDIATE_CHANGE,wg);var $g=class extends Nu{constructor(e){super(e),this.type=ja.BLOCK_MOVE,e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)}toJson(){let e=super.toJson();return e.oldParentId=this.oldParentId,e.oldInputName=this.oldInputName,this.oldCoordinate&&(e.oldCoordinate=`${Math.round(this.oldCoordinate.x)}, ${Math.round(this.oldCoordinate.y)}`),e.newParentId=this.newParentId,e.newInputName=this.newInputName,this.newCoordinate&&(e.newCoordinate=`${Math.round(this.newCoordinate.x)}, ${Math.round(this.newCoordinate.y)}`),this.reason&&(e.reason=this.reason),this.recordUndo||(e.recordUndo=this.recordUndo),e}static fromJson(e,t,i){return(t=Nu.fromJson(e,t,i??new $g)).oldParentId=e.oldParentId,t.oldInputName=e.oldInputName,e.oldCoordinate&&(i=e.oldCoordinate.split(","),t.oldCoordinate=new Jl(Number(i[0]),Number(i[1]))),t.newParentId=e.newParentId,t.newInputName=e.newInputName,e.newCoordinate&&(i=e.newCoordinate.split(","),t.newCoordinate=new Jl(Number(i[0]),Number(i[1]))),void 0!==e.reason&&(t.reason=e.reason),void 0!==e.recordUndo&&(t.recordUndo=e.recordUndo),t}recordNew(){let e=this.currentLocation();this.newParentId=e.parentId,this.newInputName=e.inputName,this.newCoordinate=e.coordinate}setReason(e){this.reason=e}currentLocation(){var e=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var t=e.getBlockById(this.blockId);if(!t)throw Error("The block associated with the block move event could not be found");e={};let i=t.getParent();return i?(e.parentId=i.id,(t=i.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e}isNull(){return this.oldParentId===this.newParentId&&this.oldInputName===this.newInputName&&Jl.equals(this.oldCoordinate,this.newCoordinate)}run(e){var t=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");var i=t.getBlockById(this.blockId);if(i){var n=e?this.newParentId:this.oldParentId,o=e?this.newInputName:this.oldInputName;if(e=e?this.newCoordinate:this.oldCoordinate,n){var r=t.getBlockById(n);if(!r)return void console.warn("Can't connect to non-existent block: "+n)}if(i.getParent()&&i.unplug(),e)o=i.getRelativeToSurfaceXY(),i.moveBy(e.x-o.x,e.y-o.y,this.reason);else{let e;(!(t=i.outputConnection)||i.previousConnection&&i.previousConnection.isConnected())&&(t=i.previousConnection),i=t?.type,o?(i=r.getIn
3put(o))&&(e=i.connection):i===Rd.PREVIOUS_STATEMENT&&(e=r.nextConnection),e&&t?t.connect(e):console.warn("Can't connect to non-existent input: "+o)}}else console.warn("Can't move non-existent block: "+this.blockId)}};zs(ka.EVENT,ja.BLOCK_MOVE,$g);var Mg,xg=class extends Hl{constructor(e,t,i){super(e?e.workspace.id:void 0),this.type=ja.BUBBLE_OPEN,e&&(this.blockId=e.id,this.isOpen=t,this.bubbleType=i)}toJson(){let e=super.toJson();if(void 0===this.isOpen)throw Error("Whether this event is for opening the bubble is undefined. Either pass the value to the constructor, or call fromJson");if(!this.bubbleType)throw Error("The type of bubble is undefined. Either pass the value to the constructor, or call fromJson");return e.isOpen=this.isOpen,e.bubbleType=this.bubbleType,e.blockId=this.blockId||"",e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new xg)).isOpen=e.isOpen,t.bubbleType=e.bubbleType,t.blockId=e.blockId,t}};(function(e){e.MUTATOR="mutator",e.COMMENT="comment",e.WARNING="warning"})(Mg||={}),zs(ka.EVENT,ja.BUBBLE_OPEN,xg);var Dg={};Dg.BubbleOpen=xg,Dg.BubbleType=Mg;var Pg=class extends Ul{constructor(t){super(),this.isBlank=!0,this.isBlank=!t,t&&(this.commentId=t.id,this.workspaceId=t.workspace.id,this.group=Xs.getGroup$$module$build$src$core$events$utils(),this.recordUndo=e())}toJson(){let e=super.toJson();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.commentId=this.commentId,e}static fromJson(e,t,i){return(t=Ul.fromJson(e,t,i??new Pg)).commentId=e.commentId,t}static CommentCreateDeleteHelper(e,t){let i=e.getEventWorkspace_();if(t){if(!e.json)throw Error("Encountered a comment event without proper json");Le(e.json,i)}else{if(!e.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=i.getCommentById(e.commentId))?t.dispose():console.warn("Can't delete non-existent comment: "+e.commentId)}}},Fg=class extends Pg{constructor(e,t,i){super(e),this.type=ja.COMMENT_CHANGE,e&&(this.oldContents_=void 0===t?"":t,this.newContents_=void 0===i?"":i)}toJson(){let e=super.toJson();if(!this.oldContents_)throw Error("The old contents is undefined. Either pass a value to the constructor, or call fromJson");if(!this.newContents_)throw Error("The new contents is undefined. Either pass a value to the constructor, or call fromJson");return e.oldContents=this.oldContents_,e.newContents=this.newContents_,e}static fromJson(e,t,i){return(t=Pg.fromJson(e,t,i??new Fg)).oldContents_=e.oldContents,t.newContents_=e.newContents,t}isNull(){return this.oldContents_===this.newContents_}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){var i=e?this.newContents_:this.oldContents_;if(void 0===i)throw Error(e?"The new contents is undefined. Either pass a value to the constructor, or call fromJson":"The old contents is undefined. Either pass a value to the constructor, or call fromJson");t.setText(i)}else console.warn("Can't change non-existent comment: "+this.commentId)}};zs(ka.EVENT,ja.COMMENT_CHANGE,Fg);var Bg=class extends Pg{constructor(e,t){super(e),this.newCollapsed=t,this.type=ja.COMMENT_COLLAPSE}toJson(){let e=super.toJson();if(void 0===this.newCollapsed)throw Error("The new collapse value undefined. Either call recordNew, or call fromJson");return e.newCollapsed=this.newCollapsed,e}static fromJson(e,t,i){return(t=Pg.fromJson(e,t,i??new Bg)).newCollapsed=e.newCollapsed,t}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");(t=t.getCommentById(this.commentId))?t.setCollapsed(e?!!this.newCollapsed:!this.newCollapsed):console.warn("Can't collapse or uncollapse non-existent comment: "+this.commentId)}};zs(ka.EVENT,ja.COMMENT_COLLAPSE,Bg);var Ug=class extends Pg{constructor(e){super(e),this.type=ja.COMMENT_CREATE,e&&(this.xml=Fn(e),this.json=Ae(e,{addCoordinates:!0}))}toJson(){let e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Xn(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=Pg.fromJson(e,t,i??new Ug)).xml=Xs.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}run(e){Pg.CommentCreateDeleteHelper(this,e)}};zs(ka.EVENT,ja.COMMENT_CREATE,Ug);var Hg=class extends Pg{constructor(e){super(e),this.type=ja.COMMENT_DELETE,e&&(this.xml=Fn(e),this.json=Ae(e,{addCoordinates:!0}))}run(e){Pg.CommentCreateDeleteHelper(this,!e)}toJson(){let e=super.toJson();if(!this.xml)throw Error("The comment XML is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.json)throw Error("The comment JSON is undefined. Either pass a block to the constructor, or call fromJson");return e.xml=Xn(this.xml),e.json=this.json,e}static fromJson(e,t,i){return(t=Pg.fromJson(e,t,i??new Hg)).xml=Xs.textToDom$$module$build$src$core$utils$xml(e.xml),t.json=e.json,t}};zs(ka.EVENT,ja.COMMENT_DELETE,Hg);var Vg=class extends Hl{constructor(e,t){super(e?e.workspace.id:void 0),this.type=ja.COMMENT_DRAG,e&&(this.commentId=e.id,this.isStart=t)}toJson(){let e=super.toJson();if(void 0===this.isStart)throw Error("Whether this event is the start of a drag is undefined. Either pass the value to the constructor, or call fromJson");if(void 0===this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");return e.isStart=this.isStart,e.commentId=this.commentId,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new Vg)).isStart=e.isStart,t.commentId=e.commentId,t}};zs(ka.EVENT,ja.COMMENT_DRAG,Vg);var Gg=class extends Pg{constructor(e){super(e),this.type=ja.COMMENT_MOVE,e&&(this.comment_=e,this.oldCoordinate_=e.getRelativeToSurfaceXY()
3)}recordNew(){if(this.newCoordinate_)throw Error("Tried to record the new position of a comment on the same event twice.");if(!this.comment_)throw Error("The comment is undefined. Pass a comment to the constructor if you want to use the record functionality");this.newCoordinate_=this.comment_.getRelativeToSurfaceXY()}setReason(e){this.reason=e}setOldCoordinate(e){this.oldCoordinate_=e}toJson(){let e=super.toJson();if(!this.oldCoordinate_)throw Error("The old comment position is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newCoordinate_)throw Error("The new comment position is undefined. Either call recordNew, or call fromJson");return e.oldCoordinate=`${Math.round(this.oldCoordinate_.x)}, ${Math.round(this.oldCoordinate_.y)}`,e.newCoordinate=Math.round(this.newCoordinate_.x)+","+Math.round(this.newCoordinate_.y),e}static fromJson(e,t,i){return t=Pg.fromJson(e,t,i??new Gg),i=e.oldCoordinate.split(","),t.oldCoordinate_=new Jl(Number(i[0]),Number(i[1])),i=e.newCoordinate.split(","),t.newCoordinate_=new Jl(Number(i[0]),Number(i[1])),t}isNull(){return Jl.equals(this.oldCoordinate_,this.newCoordinate_)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(!(e=e?this.newCoordinate_:this.oldCoordinate_))throw Error("Either oldCoordinate_ or newCoordinate_ is undefined. Either pass a comment to the constructor and call recordNew, or call fromJson");t.moveTo(e)}else console.warn("Can't move non-existent comment: "+this.commentId)}};zs(ka.EVENT,ja.COMMENT_MOVE,Gg);var Wg=class extends Pg{constructor(e){super(e),this.type=ja.COMMENT_RESIZE,e&&(this.oldSize=e.getSize())}recordCurrentSizeAsNewSize(){if(this.newSize)throw Error("Tried to record the new size of a comment on the same event twice.");var e=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(!(e=e.getCommentById(this.commentId)))throw Error("The comment associated with the comment resize event could not be found");this.newSize=e.getSize()}toJson(){let e=super.toJson();if(!this.oldSize)throw Error("The old comment size is undefined. Either pass a comment to the constructor, or call fromJson");if(!this.newSize)throw Error("The new comment size is undefined. Either call recordCurrentSizeAsNewSize, or call fromJson");return e.oldWidth=Math.round(this.oldSize.width),e.oldHeight=Math.round(this.oldSize.height),e.newWidth=Math.round(this.newSize.width),e.newHeight=Math.round(this.newSize.height),e}static fromJson(e,t,i){return(t=Pg.fromJson(e,t,i??new Wg)).oldSize=new tc(e.oldWidth,e.oldHeight),t.newSize=new tc(e.newWidth,e.newHeight),t}isNull(){return tc.equals(this.oldSize,this.newSize)}run(e){var t=this.getEventWorkspace_();if(!this.commentId)throw Error("The comment ID is undefined. Either pass a comment to the constructor, or call fromJson");if(t=t.getCommentById(this.commentId)){if(!(e=e?this.newSize:this.oldSize))throw Error("Either oldSize or newSize is undefined. Either pass a comment to the constructor and call recordCurrentSizeAsNewSize, or call fromJson");t.setSize(e)}else console.warn("Can't resize non-existent comment: "+this.commentId)}};zs(ka.EVENT,ja.COMMENT_RESIZE,Wg);var Xg=class extends Hl{constructor(e,t,i){super(i),this.type=ja.TOOLBOX_ITEM_SELECT,this.oldItem=e??void 0,this.newItem=t??void 0}toJson(){let e=super.toJson();return e.oldItem=this.oldItem,e.newItem=this.newItem,e}static fromJson(e,t,i){return(t=Hl.fromJson(e,t,i??new Xg)).oldItem=e.oldItem,t.newItem=e.newItem,t}};zs(ka.EVENT,ja.TOOLBOX_ITEM_SELECT,Xg);var zg=class extends Cf{constructor(e,t,i){super(e),this.oldType=t,this.newType=i,this.type=ja.VAR_TYPE_CHANGE}toJson(){let e=super.toJson();if(!this.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");return e.oldType=this.oldType,e.newType=this.newType,e}static fromJson(e,t,i){return(t=Cf.fromJson(e,t,i??new zg)).oldType=e.oldType,t.newType=e.newType,t}run(e){let t=this.getEventWorkspace_();if(!this.varId)throw Error("The var ID is undefined. Either pass a variable to the constructor, or call fromJson");if(!this.oldType||!this.newType)throw Error("The variable's types are undefined. Either pass them to the constructor, or call fromJson");let i=t.getVariableMap().getVariableById(this.varId);i&&(e?t.getVariableMap().changeVariableType(i,this.newType):t.getVariableMap().changeVariableType(i,this.oldType))}};zs(ka.EVENT,ja.VAR_TYPE_CHANGE,zg);var jg=class extends Ul{constructor(e){super(),this.isBlank=!0,this.recordUndo=!1,this.type=ja.FINISHED_LOADING,this.isBlank=!!e,e&&(this.workspaceId=e.id)}};zs(ka.EVENT,ja.FINISHED_LOADING,jg);var Yg,Qg,Kg,qg,Jg,Zg,em,tm,im,nm,om,rm,sm,am,lm,cm,um,hm,dm,pm,fm,gm,mm,Tm,_m;Xs.BLOCK_CHANGE$$module$build$src$core$events$events=ja.BLOCK_CHANGE,Xs.BLOCK_CREATE$$module$build$src$core$events$events=ja.BLOCK_CREATE,Xs.BLOCK_DELETE$$module$build$src$core$events$events=ja.BLOCK_DELETE,Yg=ja.BLOCK_DRAG,Xs.BLOCK_MOVE$$module$build$src$core$events$events=ja.BLOCK_MOVE,Qg=ja.BLOCK_FIELD_INTERMEDIATE_CHANGE,Kg=ja.BUBBLE_OPEN,qg=ja.BLOCK_CHANGE,Jg=ja.CLICK,Zg=ja.COMMENT_CHANGE,em=ja.COMMENT_CREATE,tm=ja.COMMENT_DELETE,im=ja.COMMENT_MOVE,nm=ja.COMMENT_RESIZE,om=ja.COMMENT_DRAG,rm=ja.BLOCK_CREATE,sm=ja.BLOCK_DELETE,am=ja.FINISHED_LOADING,lm=ja.BLOCK_MOVE,cm=ja.SELECTED,um=ja.THEME_CHANGE,hm=ja.TOOLBOX_ITEM_SELECT,dm=ja.TRASHCAN_OPEN,pm=ja.UI,fm=ja.VAR_CREATE,gm=ja.VAR_DELETE,mm=ja.VAR_RENAME,Tm=ja.VIEWPORT_CHANGE,(_m={}).Abstract=Ul,_m.BLOCK_CHANGE=Xs.BLOCK_CHANGE$$module$build$src$core$events$events,_m.BLOCK_CREATE=Xs.BLOCK_CREATE$$module$build$src$core$events$events,_m.BLOCK_DELETE=Xs.BLOCK_DELETE$$module$build$src$core$events$events,_m.BLOCK_DRAG=Yg,_m.BLOCK_FIELD_INTERMEDIATE_CHANGE=Qg,_m.BLOCK_MOVE=Xs.BLOCK_MOVE$$module$build$src$core$events$events,_m.BUBBLE_OPEN=Kg,_m.BUMP_EVENTS=sl,_m.BlockBase=Nu,_m.BlockChange=wu,_m.BlockCreate=od,_m.BlockDelete=Ad,_m.BlockDrag=Ng,_m.BlockFieldIntermediateChange=wg,_m.BlockMove=$g,_m.BubbleOpen=xg,_m.BubbleType=Mg,_m.CHANGE=qg,_m.CLICK=Jg,_m.COMMENT_CHANGE=Zg,_m.COMMENT_CREATE=em,_m.COMMENT_DELETE=tm,_m.COMMENT_DRAG=om,_m.COMMENT_MOVE=im,_m.COMMENT_RESIZE=nm,_m.CREATE=rm,_m.Click=Vl,_m.ClickTarget=Bl,_m.CommentBase=Pg,_m.CommentChange=Fg,_m.CommentCollapse=Bg,_m.CommentCreate=Ug,_m.CommentDelete=Hg,_m.CommentDrag=Vg,_m.CommentMove=Gg,_m.CommentResize=Wg,_m.DELETE=sm,_m.FINISHED_LOADING=am,_m.FinishedLoading=jg,_m.MOVE=lm,_m.SELECTED=cm,_m.Selected=kd,_m.THEME_CHANGE=um,_m.TOOLBOX_ITEM_SELECT=hm,_m.TRASHCAN_OPEN=dm,_m.ThemeChange=sd,_m.ToolboxItemSelect=Xg,_m.TrashcanOpen=$f,_m.UI=pm,_m.UiBase=Hl,_m.VAR_CREATE=fm,_m.VAR_DELETE=gm,_m.VAR_RENAME=mm,_m.V
3IEWPORT_CHANGE=Tm,_m.VarBase=Cf,_m.VarCreate=kf,_m.VarDelete=Lf,_m.VarRename=Nf,_m.VarTypeChange=zg,_m.ViewportChange=ad,_m.clearPendingUndo=s,_m.disable=Xs.disable$$module$build$src$core$events$utils,_m.disableOrphans=d,_m.enable=Xs.enable$$module$build$src$core$events$utils,_m.filter=r,_m.fire=t,_m.fromJson=u,_m.get=h,_m.getDescendantIds=c,_m.getGroup=Xs.getGroup$$module$build$src$core$events$utils,_m.getRecordUndo=e,_m.isEnabled=a,_m.setGroup=Xs.setGroup$$module$build$src$core$events$utils,_m.setRecordUndo=Xs.setRecordUndo$$module$build$src$core$events$utils;var Em={};Em.BottomRow=pg,Em.ConstantProvider=cg,Em.Drawer=ug,Em.PathObject=_g,Em.RenderInfo=Tg,Em.Renderer=Eg,Em.RightConnectionShape=gg,Em.StatementInput=fg,Em.TopRow=mg,Bs();var bm={};bm.registerCleanup=_s,bm.registerCollapse=bs,bm.registerCollapseExpandBlock=Ls,bm.registerComment=ks,bm.registerCommentCreate=Ds,bm.registerCommentDelete=Ms,bm.registerCommentDuplicate=xs,bm.registerCommentOptions=Fs,bm.registerDefaultOptions=Bs,bm.registerDelete=ws,bm.registerDeleteAll=ys,bm.registerDisable=Ns,bm.registerDuplicate=Cs,bm.registerExpand=Os,bm.registerHelp=$s,bm.registerInline=As,bm.registerRedo=Ts,bm.registerUndo=ms;var Om="button",vm=class{load(e,t){return(e=new sp(t.getWorkspace(),t.targetWorkspace,e,!1)).show(),new np(e,Om)}gapForItem(e,t){return t}disposeItem(e){(e=e.getElement())instanceof sp&&e.dispose()}getType(){return Om}};zs(ka.FLYOUT_INFLATER,Om,vm);var Im={};Im.Bubble=md,Im.MiniWorkspaceBubble=Td,Im.TextBubble=Jd,Im.TextInputBubble=yd;var Sm="block",ym=class{constructor(){this.permanentlyDisabledBlocks=new Set,this.listeners=new Map,this.capacityWrapper=this.filterFlyoutBasedOnCapacity.bind(this)}load(e,t){return this.setFlyout(t),(e=this.createBlock(e,t.getWorkspace())).isEnabled()?this.updateStateBasedOnCapacity(e):this.permanentlyDisabledBlocks.add(e),e.getDescendants(!1).forEach(e=>e.isInFlyout=!0),this.addBlockListeners(e),new np(e,Sm)}createBlock(e,t){return e.blockxml?(e="string"==typeof e.blockxml?Xs.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,t=Kn(e,t)):(void 0===e.enabled&&(e.enabled="true"!==e.disabled&&!0!==e.disabled),void 0===e.disabledReasons&&!1===e.enabled&&(e.disabledReasons=[Xc]),"x"in e&&delete e.x,"y"in e&&delete e.y,t=Dt(e,t)),t}gapForItem(e,t){let i;return e.gap?i=parseInt(String(e.gap)):e.blockxml&&(e="string"==typeof e.blockxml?Xs.textToDom$$module$build$src$core$utils$xml(e.blockxml):e.blockxml,i=parseInt(e.getAttribute("gap"))),!i||isNaN(i)?t:i}disposeItem(e){(e=e.getElement())instanceof ep&&(this.removeListeners(e.id),e.dispose(!1,!1))}removeListeners(e){(this.listeners.get(e)??[]).forEach(e=>ca(e)),this.listeners.delete(e)}setFlyout(e){if(this.flyout!==e){if(this.flyout){let e;null==(e=this.flyout.targetWorkspace)||e.removeChangeListener(this.capacityWrapper)}var t;this.flyout=e,null==(t=this.flyout.targetWorkspace)||t.addChangeListener(this.capacityWrapper)}}updateStateBasedOnCapacity(e){let t=this.flyout?.targetWorkspace?.isCapacityAvailable(V(e));for(;e;)e.setDisabledReason(!t,"WORKSPACE_AT_BLOCK_CAPACITY"),e=e.getNextBlock()}addBlockListeners(e){let t=[];t.push(aa(e.getSvgRoot(),"pointerdown",e,t=>{let i=this.flyout?.targetWorkspace?.getGesture(t);i&&this.flyout&&(i.setStartBlock(e),i.handleFlyoutStart(t,this.flyout))})),t.push(la(e.getSvgRoot(),"pointermove",null,()=>{let t,i;null!=(t=this.flyout)&&null!=(i=t.targetWorkspace)&&i.isDragging()||e.addSelect()})),t.push(la(e.getSvgRoot(),"pointerleave",null,()=>{let t,i;null!=(t=this.flyout)&&null!=(i=t.targetWorkspace)&&i.isDragging()||e.removeSelect()})),this.listeners.set(e.id,t)}filterFlyoutBasedOnCapacity(e){!this.flyout||e&&e.type!==ja.BLOCK_CREATE&&e.type!==ja.BLOCK_DELETE||this.flyout.getWorkspace().getTopBlocks(!1).forEach(e=>{this.permanentlyDisabledBlocks.has(e)||this.updateStateBasedOnCapacity(e)})}getType(){return Sm}};zs(ka.FLYOUT_INFLATER,Sm,ym);var Rm=class extends df{constructor(){super(),this.FIELD_TEXT_BASELINE_CENTER=!1,this.DARK_PATH_OFFSET=1,this.MAX_BOTTOM_WIDTH=30,this.STATEMENT_BOTTOM_SPACER=-this.NOTCH_HEIGHT/2}getCSS_(e){return super.getCSS_(e).concat([`${e} .blocklyInsertionMarker>.blocklyPathLight,`,`${e} .blocklyInsertionMarker>.blocklyPathDark {`,`fill-opacity: ${this.INSERTION_MARKER_OPACITY};`,"stroke: none;","}"])}},Cm=class{constructor(e){this.inlineSteps_=this.steps_="",this.info_=e,this.RTL_=this.info_.RTL,e=e.getRenderer(),this.constants_=e.getConstants(),this.highlightConstants_=e.getHighlightConstants(),this.highlightOffset=this.highlightConstants_.OFFSET,this.outsideCornerPaths_
3=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}getPath(){return this.steps_+"\n"+this.inlineSteps_}drawTopCorner(e){this.steps_+=wo(e.xPos,this.info_.startY);for(let t,i=0;t=e.elements[i];i++)Gp.isLeftSquareCorner(t)?this.steps_+=this.highlightConstants_.START_POINT:Gp.isLeftRoundedCorner(t)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Gp.isPreviousConnection(t)?this.steps_+=this.notchPaths_.pathLeft:Gp.isHat(t)?this.steps_+=this.startPaths_.path(this.RTL_):Gp.isSpacer(t)&&0!==t.width&&(this.steps_+=xo("H",t.xPos+t.width-this.highlightOffset));this.steps_+=xo("H",e.xPos+e.width-this.highlightOffset)}drawJaggedEdge_(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+xo("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset))}drawValueInput(e){let t=e.getLastInput();if(this.RTL_){let i=e.height-t.connectionHeight;this.steps_+=No(t.xPos+t.width-this.highlightOffset,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+xo("v",i)}else this.steps_+=No(t.xPos+t.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}drawStatementInput(e){let t=e.getLastInput();if(t)if(this.RTL_){let i=e.height-2*this.insideCornerPaths_.height;this.steps_+=No(t.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+xo("v",i)+this.insideCornerPaths_.pathBottom(this.RTL_)+$o(e.width-t.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=No(t.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+$o(e.width-t.xPos-this.insideCornerPaths_.width,0)}drawRightSideRow(e){let t=e.xPos+e.width-this.highlightOffset;e instanceof lf&&e.followsStatement&&(this.steps_+=xo("H",t)),this.RTL_&&(this.steps_+=xo("H",t),e.height>this.highlightOffset&&(this.steps_+=xo("V",e.yPos+e.height-this.highlightOffset)))}drawBottomRow(e){if(this.RTL_)this.steps_+=xo("V",e.baseline-this.highlightOffset);else{let t=this.info_.bottomRow.elements[0];Gp.isLeftSquareCorner(t)?this.steps_+=No(e.xPos+this.highlightOffset,e.baseline-this.highlightOffset):Gp.isLeftRoundedCorner(t)&&(this.steps_+=No(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}}drawLeft(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=No(this.info_.startX,e):(this.steps_+=No(this.info_.startX+this.highlightOffset,this.info_.bottomRow.baseline-this.highlightOffset),this.steps_+=xo("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,Gp.isLeftRoundedCorner(e.elements[0])?this.steps_+=xo("V",this.outsideCornerPaths_.height):this.steps_+=xo("V",e.capline+this.highlightOffset))}drawInlineInput(e){let t=this.highlightOffset,i=e.xPos+e.connectionWidth;var n=e.centerline-e.height/2;let o=e.width-e.connectionWidth,r=n+t;this.RTL_?(n=e.connectionOffsetY-t,e=e.height-(e.connectionOffsetY+e.connectionHeight)+t,this.inlineSteps_+=No(i-t,r)+xo("v",n)+this.puzzleTabPaths_.pathDown(this.RTL_)+xo("v",e)+xo("h",o)):this.inlineSteps_+=No(e.xPos+e.width+t,r)+xo("v",e.height)+xo("h",-o)+No(i,n+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)}},km=class extends ff{constructor(e,t){super(e,t),this.highlighter_=new Cm(t)}draw(){this.drawOutline_(),this.drawInternals_(),this.updateConnectionHighlights();let e=this.block_.pathObject;e.setPath(this.outlinePath_+"\n"+this.inlinePath_),e.setHighlightPath(this.highlighter_.getPath()),this.info_.RTL&&e.flipRTL(),this.recordSizeOnBlock_()}drawTop_(){this.highlighter_.drawTopCorner(this.info_.topRow),this.highlighter_.drawRightSideRow(this.info_.topRow),super.drawTop_()}drawJaggedEdge_(e){this.highlighter_.drawJaggedEdge_(e),super.drawJaggedEdge_(e)}drawValueInput_(e){this.highlighter_.drawValueInput(e),super.drawValueInput_(e)}drawStatementInput_(e){this.highlighter_.drawStatementInput(e),super.drawStatementInput_(e)}drawRightSideRow_(e){this.highlighter_.drawRightSideRow(e),this.outlinePath_+=xo("H",e.xPos+e.width)+xo("V",e.yPos+e.height)}drawBottom_(){this.highlighter_.drawBottomRow(this.info_.bottomRow),super.drawBottom_()}drawLeft_(){this.highlighter_.drawLeft(),super.drawLeft_()}drawInlineInput_(e){this.highlighter_.drawInlineInput(e),super.drawInlineInput_(e)}positionInlineInputConnection_(e){let t=e.centerline-e.height/2;if(e.connectionModel){let i=e.xPos+e.connectionWidth+this.constants_.DARK_PATH_OFFSET;
3this.info_.RTL&&(i*=-1),e.connectionModel.setOffsetInBlock(i,t+e.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}positionStatementInputConnection_(e){let t=e.getLastInput();if(null!=t&&t.connectionModel){let i=e.xPos+e.statementEdge+t.notchOffset;i=this.info_.RTL?-1*i:i+this.constants_.DARK_PATH_OFFSET,t.connectionModel.setOffsetInBlock(i,e.yPos+this.constants_.DARK_PATH_OFFSET)}}positionExternalValueConnection_(e){let t=e.getLastInput();if(t&&t.connectionModel){let i=e.xPos+e.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(i*=-1),t.connectionModel.setOffsetInBlock(i,e.yPos)}}positionNextConnection_(){let e=this.info_.bottomRow;if(e.connection){let t=e.connection,i=t.xPos;t.connectionModel.setOffsetInBlock((this.info_.RTL?-i:i)+this.constants_.DARK_PATH_OFFSET/2,e.baseline+this.constants_.DARK_PATH_OFFSET)}}},Am=class{constructor(e){this.OFFSET=.5,this.constantProvider=e,this.START_POINT=wo(this.OFFSET,this.OFFSET)}init(){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()}makeInsideCorner(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e+t)-t,n=wo(i,i)+Do("a","0 0,0",e,Ao(-i-t,e-i)),o=Do("a","0 0,0",e+t,Ao(e+t,e+t)),r=wo(i,-i)+Do("a","0 0,0",e+t,Ao(e-i,i+t));return{width:e+t,height:e,pathTop:e=>e?n:"",pathBottom:e=>e?o:r}}makeOutsideCorner(){let e=this.constantProvider.CORNER_RADIUS,t=this.OFFSET,i=(1-Math.SQRT1_2)*(e-t)+t,n=wo(i,i)+Do("a","0 0,1",e-t,Ao(e-i,-i+t)),o=wo(t,e)+Do("a","0 0,1",e-t,Ao(e,-e+t)),r=-i,s=wo(i,r)+Do("a","0 0,1",e-t,Ao(-i+t,-r-e));return{height:e,topLeft:e=>e?n:o,bottomLeft:()=>s}}makePuzzleTab(){let e=this.constantProvider.TAB_WIDTH,t=this.constantProvider.TAB_HEIGHT,i=wo(-2,2.5-t+.9)+$o(-.45*e,-2.1),n=xo("v",2.5)+wo(.97*-e,2.5)+Lo("q",[Ao(.05*-e,10),Ao(.3*e,9.5)])+wo(.67*e,-1.9)+xo("v",2.5),o=xo("v",-1.5)+wo(-.92*e,-.5)+Lo("q",[Ao(-.19*e,-5.5),Ao(0,-11)])+wo(.92*e,1),r=wo(-5,t-.7)+$o(.46*e,-2.1);return{width:e,height:t,pathUp:e=>e?i:o,pathDown:e=>e?n:r}}makeNotch(){return{pathLeft:xo("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}}makeJaggedTeeth(){return{pathLeft:$o(5.1,2.6)+wo(-10.2,6.8)+$o(5.1,2.6),height:12,width:10.2}}makeStartHat(){let e=this.constantProvider.START_HAT.height,t=wo(25,-8.7)+Lo("c",[Ao(29.7,-6.2),Ao(57.2,-.5),Ao(75,8.7)]),i=Lo("c",[Ao(17.8,-9.2),Ao(45.3,-14.9),Ao(75,-8.7)])+No(100.5,e+.5);return{path:e=>e?t:i}}},Lm=class extends ef{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)}},Nm=class extends uf{constructor(e,t){super(e,t),this.constants_=e,this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)}},wm=class extends gf{constructor(e,t){super(e,t),this.renderer_=e}getRenderer(){return this.renderer_}populateBottomRow_(){super.populateBottomRow_(),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1]instanceof Gd||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)}addInput_(e,t){this.isInline&&e instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Lm(this.constants_,e)),t.hasInlineInput=!0):e instanceof Gd?(t.elements.push(new Nm(this.constants_,e)),t.hasStatement=!0):e instanceof Xs.ValueInput$$module$build$src$core$inputs$value_input?(t.elements.push(new Qp(this.constants_,e)),t.hasExternalInput=!0):(e instanceof Hd||e instanceof Vd)&&(t.minHeight=Math.max(t.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),t.hasDummyInput=!0),this.isInline||null!==t.align||(t.align=e.align)}addElemSpacing_(){let e=!1;for(let i,n=0;i=this.rows[n];n++)i.hasExternalInput&&(e=!0);for(let i,n=0;i=this.rows[n];n++){var t=i.elements;if(i.elements=[],i.startsWithElemSpacer()&&i.elements.push(new Zp(this.constants_,this.getInRowSpacing_(null,t[0]))),t.length){for(let e=0;e<t.length-1;e++){i.elements.push(t[e]);let n=this.getInRowSpacing_(t[e],t[e+1]);i.elements.push(new Zp(this.constants_,n))}i.elements.push(t[t.length-1]),i.endsWithElemSpacer()&&(t=this.getInRowSpacing_(t[t.length-1],null),e&&i.hasDummyInput&&(t+=this.constants_.TAB_WIDTH),i.elements.push(new Zp(this.constants_,t)))}}}getInRowSpacing_(e,t){if(!e)return t&&Gp.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&Gp.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&Gp.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Gp.isInput(e)&&(!t||Gp.isStatementInput(t)))return Gp.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:Gp.isIcon(e)?2*this.constants_.LARGE_PADDING+1:Gp.isHat(e)?this.constants_.NO_PADDING:Gp.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:Gp.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:Gp.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Gp.isInput(e)&&!t){if(Gp.isExternalInput(e))return this.constants_.NO_PADDING;if(Gp.isInlineInput(e))return this.constants_.LARGE_PADDING;if(Gp.isStatementInput(e))return this.constants_.NO_PADDING}if(!Gp.isInput(e)&&t&&Gp.isInput(t)){if(Gp.isField(e)&&e.isEditable){if(Gp.isInlineInput(t)||Gp.isExternalInput(t))return this.constants_.SMALL_PADD
3ING}else{if(Gp.isInlineInput(t)||Gp.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(Gp.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Gp.isIcon(e)&&t&&!Gp.isInput(t))return this.constants_.LARGE_PADDING;if(Gp.isInlineInput(e)&&t&&Gp.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Gp.isLeftSquareCorner(e)&&t){if(Gp.isHat(t))return this.constants_.NO_PADDING;if(Gp.isPreviousConnection(t))return t.notchOffset;if(Gp.isNextConnection(t))return t.notchOffset+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}if(Gp.isLeftRoundedCorner(e)&&t){if(Gp.isPreviousConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS;if(Gp.isNextConnection(t))return t.notchOffset-this.constants_.CORNER_RADIUS+(this.RTL?1:-1)*this.constants_.DARK_PATH_OFFSET/2}return Gp.isField(e)&&t&&Gp.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&Gp.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return Gp.isTopRow(e)&&Gp.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Gp.isTopRow(e)||Gp.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||!e.hasStatement&&t.hasDummyInput||e.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(Gp.isSpacer(t))return e.yPos+t.height/2;if(Gp.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,Gp.isNextConnection(t)?e+t.height/2:e-t.height/2;if(Gp.isTopRow(e))return Gp.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return Gp.isField(t)||Gp.isIcon(t)?(i+=t.height/2,(e.hasInlineInput||e.hasStatement)&&t.height+this.constants_.TALL_INPUT_FIELD_OFFSET_Y<=e.height&&(i+=this.constants_.TALL_INPUT_FIELD_OFFSET_Y)):i=Gp.isInlineInput(t)?i+t.height/2:i+e.height/2,i}alignRowElements_(){if(this.isInline){var e=0,t=new WeakMap,i=null;for(let n,o=this.rows.length-1;n=this.rows[o];o--)t.set(n,e),Gp.isInputRow(n)&&(n.hasStatement&&this.alignStatementRow_(n),i&&i.hasStatement&&n.width<i.width?t.set(n,i.width):e=n.hasStatement?n.width:Math.max(e,n.width),i=n);e=0;for(let n,o=0;n=this.rows[o];o++)n.hasStatement?e=this.getDesiredRowWidth_(n):Gp.isSpacer(n)?n.width=Math.max(e,t.get(n)):(i=n.width,(e=Math.max(e,t.get(n))-i)>0&&this.addAlignmentPadding_(n,e),e=n.width)}else super.alignRowElements_()}getDesiredRowWidth_(e){return this.isInline&&e.hasStatement?this.statementEdge+this.constants_.MAX_BOTTOM_WIDTH+this.startX:super.getDesiredRowWidth_(e)}finalize_(){let e=0,t=0;for(let n,o=0;n=this.rows[o];o++){n.yPos=t,n.xPos=this.startX,t+=n.height,e=Math.max(e,n.widthWithConnectedBlocks);var i=t-this.topRow.ascenderHeight;n===this.bottomRow&&i<this.constants_.MIN_BLOCK_HEIGHT&&(i=this.constants_.MIN_BLOCK_HEIGHT-i,this.bottomRow.height+=i,t+=i),this.recordElemPositions_(n)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.getHeightWidth().width-this.constants_.DARK_PATH_OFFSET)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX+this.constants_.DARK_PATH_OFFSET,this.width+=this.constants_.DARK_PATH_OFFSET,this.height=t+this.constants_.DARK_PATH_OFFSET,this.startY=this.topRow.capline}},$m=class extends mf{constructor(e,t,i){super(e,t,i),this.constants=i,this.colourDark="#000000",this.svgPathDark=p(Zl.PATH,{class:"blocklyPathDark",transform:"translate(1,1)"}),this.svgRoot.insertBefore(this.svgPathDark,this.svgPath),this.svgPathLight=p(Zl.PATH,{class:"blocklyPathLight"},this.svgRoot)}setPath(e){this.svgPath.setAttribute("d",e),this.svgPathDark.setAttribute("d",e)}setHighlightPath(e){this.svgPathLight.setAttribute("d",e)}flipRTL(){this.svgPath.setAttribute("transform","scale(-1 1)"),this.svgPathLight.setAttribute("transform","scale(-1 1)"),this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}applyColour(e){this.svgPathLight.style.display="",this.svgPathDark.style.display="",this.svgPathLight.setAttribute("stroke",this.style.colourTertiary),this.svgPathDark.setAttribute("fill",this.colourDark),super.applyColour(e),this.svgPath.setAttribute("stroke","none")}setStyle(e){this.style=e,this.colourDark=nn("#000",this.style.colourPrimary,.2)||this.colourDark}updateHighlighted(e){super.updateHighlighted(e),this.svgPathLight.style.display=e?"none":"inline"}updateShadow_(e){super.updateShadow_(e),e&&(this.svgPathLight.style.display="none",this.svgPathDark.setAttribute("fill",this.style.colourSecondary))}updateDisabled_(e){super.updateDisabled_(e),e&&this.svgPath.setAttribute("stroke","none")}},Mm=class extends Tf{constructor(e){super(e),this.highlightConstants=null}init(e,t){super.init(e,t),this.highlightConstants=this.makeHighlightConstants_(),this.highlightConstants.init()}refreshDom(e,t,i){super.refreshDom(e,t,i),this.getHighlightConstants().init()}makeConstants_(){return new Rm}makeRenderInfo_(e){return new wm(this,e)}makeDrawer_(e,t){return new km(e,t)}makePathObject(e,t){return new $m(e,t,this.getConstants())}makeHighlightConstants_(){return new Am(this.getConstants())}getHighlightConstants(){if(!this.highlightConstants)throw Error("Cannot access the highlight constants because init has not been called");return this.highlightConstants}};Cr("geras",Mm);var xm={};xm.ConstantProvider=Rm,xm.Drawer=km,xm.HighlightConstantProvider=Am,xm.Highlighter=Cm,xm.InlineInput=Lm,xm.PathObject=$m,xm.RenderInfo=wm,xm.Renderer=Mm,xm.StatementInput=Nm;var Dm=class extends gf{constructor(e,t){super(e,t)}getRenderer(){return this.renderer_}addElemSpacing_(){let e=!1;for(var t=0;t<this.rows.length;t++)if(this.rows[t].hasExternalInput){e=!0;break}for(t=0;t<this.rows.length;t++){let n=this.rows[t];var i=n.elements;if(n.elements=[],n.startsWithElemSpacer()&&n.elements.push(new Zp(this.constants_,this.getInRowSpacing_(null,i[0]))),i.length){for(let e=0;e<i.length-1;e++){n.elements.push(i[e]);let t=this.getInRowSpacing_(i[e],i[e+1]);n.elements.push(new Zp(this.constants_,t))}n.elements.push(i[i.length-1]),n.endsWithElemSpacer()&&(i=this.getInRowSpacing_(i[i.length-1],null),e&&n.hasDummyInput&&(i+=this.constants_.TAB_WIDTH),n.elements.push(new Zp(this.constants_,i
3)))}}}getInRowSpacing_(e,t){if(!e)return t&&Gp.isField(t)&&t.isEditable?this.constants_.MEDIUM_PADDING:t&&Gp.isInlineInput(t)?this.constants_.MEDIUM_LARGE_PADDING:t&&Gp.isStatementInput(t)?this.constants_.STATEMENT_INPUT_PADDING_LEFT:this.constants_.LARGE_PADDING;if(!Gp.isInput(e)&&!t)return Gp.isField(e)&&e.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.MEDIUM_PADDING:Gp.isIcon(e)?2*this.constants_.LARGE_PADDING+1:Gp.isHat(e)?this.constants_.NO_PADDING:Gp.isPreviousOrNextConnection(e)?this.constants_.LARGE_PADDING:Gp.isLeftRoundedCorner(e)?this.constants_.MIN_BLOCK_WIDTH:Gp.isJaggedEdge(e)?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING;if(Gp.isInput(e)&&!t){if(Gp.isExternalInput(e))return this.constants_.NO_PADDING;if(Gp.isInlineInput(e))return this.constants_.LARGE_PADDING;if(Gp.isStatementInput(e))return this.constants_.NO_PADDING}if(!Gp.isInput(e)&&t&&Gp.isInput(t)){if(Gp.isField(e)&&e.isEditable){if(Gp.isInlineInput(t)||Gp.isExternalInput(t))return this.constants_.SMALL_PADDING}else{if(Gp.isInlineInput(t)||Gp.isExternalInput(t))return this.constants_.MEDIUM_LARGE_PADDING;if(Gp.isStatementInput(t))return this.constants_.LARGE_PADDING}return this.constants_.LARGE_PADDING-1}if(Gp.isIcon(e)&&t&&!Gp.isInput(t))return this.constants_.LARGE_PADDING;if(Gp.isInlineInput(e)&&t&&Gp.isField(t))return t.isEditable?this.constants_.MEDIUM_PADDING:this.constants_.LARGE_PADDING;if(Gp.isLeftSquareCorner(e)&&t){if(Gp.isHat(t))return this.constants_.NO_PADDING;if(Gp.isPreviousConnection(t)||Gp.isNextConnection(t))return t.notchOffset}return Gp.isLeftRoundedCorner(e)&&t?t.notchOffset-this.constants_.CORNER_RADIUS:Gp.isField(e)&&t&&Gp.isField(t)&&e.isEditable===t.isEditable?0===e.width?this.constants_.NO_PADDING:this.constants_.LARGE_PADDING:t&&Gp.isJaggedEdge(t)?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getSpacerRowHeight_(e,t){return Gp.isTopRow(e)&&Gp.isBottomRow(t)?this.constants_.EMPTY_BLOCK_SPACER_HEIGHT:Gp.isTopRow(e)||Gp.isBottomRow(t)?this.constants_.NO_PADDING:e.hasExternalInput&&t.hasExternalInput?this.constants_.LARGE_PADDING:!e.hasStatement&&t.hasStatement?this.constants_.BETWEEN_STATEMENT_PADDING_Y:e.hasStatement&&t.hasStatement||e.hasDummyInput||t.hasDummyInput?this.constants_.LARGE_PADDING:this.constants_.MEDIUM_PADDING}getElemCenterline_(e,t){if(Gp.isSpacer(t))return e.yPos+t.height/2;if(Gp.isBottomRow(e))return e=e.yPos+e.height-e.descenderHeight,Gp.isNextConnection(t)?e+t.height/2:e-t.height/2;if(Gp.isTopRow(e))return Gp.isHat(t)?e.capline-t.height/2:e.capline+t.height/2;let i=e.yPos;return Gp.isField(t)&&e.hasStatement?i+(this.constants_.TALL_INPUT_FIELD_OFFSET_Y+t.height/2):i+e.height/2}finalize_(){let e=0,t=0;for(var i=0;i<this.rows.length;i++){let o=this.rows[i];o.yPos=t,o.xPos=this.startX,t+=o.height,e=Math.max(e,o.widthWithConnectedBlocks);var n=t-this.topRow.ascenderHeight;o===this.bottomRow&&n<this.constants_.MIN_BLOCK_HEIGHT&&(n=this.constants_.MIN_BLOCK_HEIGHT-n,this.bottomRow.height+=n,t+=n),this.recordElemPositions_(o)}this.outputConnection&&this.block_.nextConnection&&this.block_.nextConnection.isConnected()&&(i=this.block_.nextConnection.targetBlock())&&(e=Math.max(e,i.getHeightWidth().width)),this.bottomRow.baseline=t-this.bottomRow.descenderHeight,this.widthWithChildren=e+this.startX,this.height=t,this.startY=this.topRow.capline}},Pm=class extends Tf{constructor(e){super(e)}makeRenderInfo_(e){return new Dm(this,e)}};Cr("thrasos",Pm);var Fm={};Fm.RenderInfo=Dm,Fm.Renderer=Pm;var Bm={Classic:pd,Zelos:new dd("zelos",{colour_blocks:{colourPrimary:"#CF63CF",colourSecondary:"#C94FC9",colourTertiary:"#BD42BD"},list_blocks:{colourPrimary:"#9966FF",colourSecondary:"#855CD6",colourTertiary:"#774DCB"},logic_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC"},loop_blocks:{colourPrimary:"#0fBD8C",colourSecondary:"#0DA57A",colourTertiary:"#0B8E69"},math_blocks:{colourPrimary:"#59C059",colourSecondary:"#46B946",colourTertiary:"#389438"},procedure_blocks:{colourPrimary:"#FF6680",colourSecondary:"#FF4D6A",colourTertiary:"#FF3355"},text_blocks:{colourPrimary:"#FFBF00",colourSecondary:"#E6AC00",colourTertiary:"#CC9900"},variable_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},variable_dynamic_blocks:{colourPrimary:"#FF8C1A",colourSecondary:"#FF8000",colourTertiary:"#DB6E00"},hat_blocks:{colourPrimary:"#4C97FF",colourSecondary:"#4280D7",colourTertiary:"#3373CC",hat:"cap"}},{colour_category:{colour:"#CF63CF"}
3,list_category:{colour:"#9966FF"},logic_category:{colour:"#4C97FF"},loop_category:{colour:"#0fBD8C"},math_category:{colour:"#59C059"},procedure_category:{colour:"#FF6680"},text_category:{colour:"#FFBF00"},variable_category:{colour:"#FF8C1A"},variable_dynamic_category:{colour:"#FF8C1A"}})},Um=class{constructor(e,t,i){this.id_=e.toolboxitemid||fa(),this.level_=(this.parent_=i||null)?this.parent_.getLevel()+1:0,this.toolboxItemDef_=e,this.parentToolbox_=t,this.workspace_=this.parentToolbox_.getWorkspace()}init(){}getDiv(){return null}getClickTarget(){return null}getId(){return this.id_}getParent(){return null}getLevel(){return this.level_}isSelectable(){return!1}isCollapsible(){return!1}dispose(){}setVisible_(e){}getFocusableElement(){let e=this.getDiv();if(!e)throw Error("Trying to access toolbox item before DOM is initialized.");if(!(e instanceof HTMLElement))throw Error("Toolbox item div is unexpectedly not an HTML element.");return e}getFocusableTree(){return this.parentToolbox_}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}},Hm=class extends Um{constructor(e,t,i){super(e,t,i),this.colour_=this.name_="",this.labelDom_=this.iconDom_=this.rowContents_=this.rowDiv_=this.htmlDiv_=null,this.isDisabled_=this.isHidden_=!1,this.flyoutItems_=[],this.cssConfig_=this.makeDefaultCssConfig_()}init(){this.parseCategoryDef_(this.toolboxItemDef_),this.parseContents_(this.toolboxItemDef_),this.createDom_(),"true"===this.toolboxItemDef_.hidden&&this.hide()}makeDefaultCssConfig_(){return{container:"blocklyToolboxCategoryContainer",row:"blocklyToolboxCategory",rowcontentcontainer:"blocklyTreeRowContentContainer",icon:"blocklyToolboxCategoryIcon",label:"blocklyToolboxCategoryLabel",contents:"blocklyToolboxCategoryGroup",selected:"blocklyToolboxSelected",openicon:"blocklyToolboxCategoryIconOpen",closedicon:"blocklyToolboxCategoryIconClosed"}}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else if(e=e.contents)for(let t=0;t<e.length;t++){let i=e[t];Array.isArray(this.flyoutItems_)&&this.flyoutItems_.push(i)}}parseCategoryDef_(e){this.name_="name"in e?an(e.name):"",this.colour_=this.getColour_(e),Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}createDom_(){this.htmlDiv_=this.createContainer_(),xe(this.htmlDiv_,xc.TREEITEM),De(this.htmlDiv_,Dc.SELECTED,!1),De(this.htmlDiv_,Dc.LEVEL,this.level_+1),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_(),xe(this.iconDom_,xc.PRESENTATION),this.rowContents_.appendChild(this.iconDom_),this.labelDom_=this.createLabelDom_(this.name_),this.rowContents_.appendChild(this.labelDom_);let e=this.labelDom_.getAttribute("id");return e&&De(this.htmlDiv_,Dc.LABELLEDBY,e),this.addColourBorder_(this.colour_),this.htmlDiv_}createContainer_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&f(e,t),e}createRowContainer_(){let e=document.createElement("div");var t=this.cssConfig_.row;return t&&f(e,t),t=Hm.nestedPadding*this.getLevel()+"px",this.workspace_.RTL?e.style.paddingRight=t:e.style.paddingLeft=t,e}createRowContentsContainer_(){let e=document.createElement("div"),t=this.cssConfig_.rowcontentcontainer;return t&&f(e,t),e}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&f(e,t)}return e.style.display="inline-block",e}createLabelDom_(e){let t=document.createElement("span");return t.setAttribute("id",this.getId()+".label"),t.textContent=e,(e=this.cssConfig_.label)&&f(t,e),t}refreshTheme(){this.colour_=this.getColour_(this.toolboxItemDef_),this.addColourBorder_(this.colour_)}addColourBorder_(e){e&&(e=Hm.borderWidth+"px solid "+(e||"#ddd"),this.workspace_.RTL?this.rowDiv_.style.borderRight=e:this.rowDiv_.style.borderLeft=e)}getColour_(e){let t=e.categorystyle||e.categoryStyle;if((e=e.colour)&&t)console.warn('Toolbox category "'+this.name_+'" must not have both a
3style and a colour');else{if(t)return this.getColourfromStyle(t);if(e)return this.parseColour(e)}return""}getColourfromStyle(e){var t=this.workspace_.getTheme();if(e&&t){if((t=t.categoryStyles[e])&&t.colour)return this.parseColour(t.colour);console.warn('Style "'+e+'" must exist and contain a colour value')}return""}getClickTarget(){return this.rowDiv_}parseColour(e){if(null==(e=an(e))||""===e)return"";var t=Number(e);return isNaN(t)?(t=Ji(e))?t:(console.warn('Toolbox category "'+this.name_+'" has unrecognized colour attribute: '+e),""):on(t)}openIcon_(e){if(e){var t=this.cssConfig_.closedicon;t&&g(e,t),(t=this.cssConfig_.openicon)&&f(e,t)}}closeIcon_(e){if(e){var t=this.cssConfig_.openicon;t&&g(e,t),(t=this.cssConfig_.closedicon)&&f(e,t)}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none",this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}hide(){this.setVisible_(!1)}show(){this.setVisible_(!0)}isVisible(){return!this.isHidden_&&this.allAncestorsExpanded_()}allAncestorsExpanded_(){let e=this;for(;e.getParent();)if(e=e.getParent(),!e.isExpanded())return!1;return!0}isSelectable(){return this.isVisible()&&!this.isDisabled_}onClick(e){}setSelected(e){if(this.rowDiv_){var t=this.cssConfig_.selected;if(e){let e=this.parseColour(Hm.defaultBackgroundColour);this.rowDiv_.style.backgroundColor=this.colour_||e,t&&f(this.rowDiv_,t)}else this.rowDiv_.style.backgroundColor="",t&&m(this.rowDiv_,t);De(this.htmlDiv_,Dc.SELECTED,e)}}setDisabled(e){this.isDisabled_=e,this.getDiv().setAttribute("disabled",`${e}`),e?this.getDiv().setAttribute("disabled","true"):this.getDiv().removeAttribute("disabled")}getName(){return this.name_}getParent(){return this.parent_}getDiv(){return this.htmlDiv_}getContents(){return this.flyoutItems_}updateFlyoutContents(e){this.flyoutItems_=[],this.toolboxItemDef_="string"==typeof e?{kind:this.toolboxItemDef_.kind,custom:e,id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden}:{kind:this.toolboxItemDef_.kind,name:"name"in this.toolboxItemDef_?this.toolboxItemDef_.name:"",contents:me(e),id:this.toolboxItemDef_.id,categorystyle:this.toolboxItemDef_.categorystyle,colour:this.toolboxItemDef_.colour,cssconfig:this.toolboxItemDef_.cssconfig,hidden:this.toolboxItemDef_.hidden},this.parseContents_(this.toolboxItemDef_)}dispose(){_(this.htmlDiv_)}};Hm.registrationName="category",Hm.nestedPadding=19,Hm.borderWidth=8,Hm.defaultBackgroundColour="#57e",Y('\n.blocklyToolboxCategory:not(.blocklyToolboxSelected):hover {\n background-color: rgba(255, 255, 255, .2);\n}\n\n.blocklyToolbox[layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 5px 1px 0;\n}\n\n.blocklyToolbox[dir="RTL"][layout="h"] .blocklyToolboxCategoryContainer {\n margin: 1px 0 1px 5px;\n}\n\n.blocklyToolboxCategory {\n height: 22px;\n line-height: 22px;\n margin-bottom: 3px;\n padding-right: 8px;\n white-space: nowrap;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategory {\n margin-left: 8px;\n padding-right: 0;\n}\n\n.blocklyToolboxCategoryIcon {\n background-image: url(<<<PATH>>>/sprites.png);\n height: 16px;\n vertical-align: middle;\n visibility: hidden;\n width: 16px;\n}\n\n.blocklyToolboxCategoryIconClosed {\n background-position: -32px -1px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxCategoryIconClosed {\n background-position: 0 -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: -32px -17px;\n}\n\n.blocklyToolbox[dir="RTL"] .blocklyToolboxSelected>.blocklyToolboxCategoryIconClosed {\n background-position: 0 -17px;\n}\n\n.blocklyToolboxCategoryIconOpen {\n background-position: -16px -1px;\n}\n\n.blocklyToolboxSelected>.blocklyToolboxCategoryIconOpen {\n background-position: -16px -17px;\n}\n\n.blocklyToolboxCategoryLabel {\n cursor: default;\n font: 16px sans-serif;\n padding: 0 3px;\n vertical-align: middle;\n}\n\n.blocklyToolboxDelete .blocklyToolboxCategoryLabel {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxSelected .blocklyToolboxCategoryLabel {\n color: #fff;\n}\n'),zs(ka.TOOLBOX_ITEM,Hm.registrationName,Hm);var Vm=class extends Um{constructor(e,t){super(e,t),this.cssConfig_={container:"blocklyTreeSeparator"},this.htmlDiv=null,Object.assign(this.cssConfig_,e.cssconfig||e.cssConfig)}init(){this.createDom_()}createDom_(){let e=document.createElement("div");e.tabIndex=-1,e.id=this.getId();let t=this.cssConfig_.container;return t&&f(e,t),this.htmlDiv=e}getDiv(){return this.htmlDiv}dispose(){_(this.htmlDiv)}};Vm.registrationName="sep",Y('\n.blocklyTreeSeparator {\n border-bottom: solid #e5e5e5 1px;\n height: 0;\n margin: 5px 0;\n}\n\n.blocklyToolbox[layout="h"] .blocklyTreeSeparator {\n border-right: solid #e5e5e5 1px;\n border-bottom: none;\n height: auto;\n margin: 0 5px 0 5px;\n padding: 5px 0;\n width: 0;\n}\n'),zs(ka.TOOLBOX_ITEM,Vm.registrationName,Vm);var Gm=class extends Hm{constructor(e,t,i){super(e,t,i),this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[]}
3makeDefaultCssConfig_(){let e=super.makeDefaultCssConfig_();return e.contents="blocklyToolboxCategoryGroup",e}parseContents_(e){if("custom"in e)this.flyoutItems_=e.custom;else{let t=e.contents;if(t){this.flyoutItems_=[],e=!0;for(let i=0;i<t.length;i++){let n=t[i];!Ks(ka.TOOLBOX_ITEM,n.kind)||n.kind.toLowerCase()===Vm.registrationName&&e?(this.flyoutItems_.push(n),e=!0):(this.createToolboxItem(n),e=!1)}}}}createToolboxItem(e){let t=e.kind;"CATEGORY"===t.toUpperCase()&&Ee(e)&&(t=Gm.registrationName),e=new(qs(ka.TOOLBOX_ITEM,t))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)}init(){super.init(),this.setExpanded("true"===this.toolboxItemDef_.expanded||!0===this.toolboxItemDef_.expanded)}createDom_(){super.createDom_();let e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),xe(this.subcategoriesDiv_,xc.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.closeIcon_(this.iconDom_),De(this.htmlDiv_,Dc.EXPANDED,!1),this.htmlDiv_}createIconDom_(){let e=document.createElement("span");if(!this.parentToolbox_.isHorizontal()){let t=this.cssConfig_.icon;t&&f(e,t),e.style.visibility="visible"}return e.style.display="inline-block",e}createSubCategoriesDom_(e){let t=document.createElement("div");t.style.display="none";var i=this.cssConfig_.contents;for(i&&f(t,i),i=0;i<e.length;i++){let n=e[i];n.init();let o=n.getDiv();if(t.appendChild(o),n.getClickTarget){let e;null==(e=n.getClickTarget())||e.setAttribute("id",n.getId())}}return t}setExpanded(e){if(this.expanded_!==e){if(this.expanded_=e)this.subcategoriesDiv_.style.display="block",this.openIcon_(this.iconDom_);else{let e;null==(e=this.parentToolbox_.getFlyout())||e.setVisible(!1),this.subcategoriesDiv_.style.display="none",this.closeIcon_(this.iconDom_)}De(this.htmlDiv_,Dc.EXPANDED,e),this.parentToolbox_.handleToolboxItemResize()}}setVisible_(e){this.htmlDiv_.style.display=e?"block":"none";let t=this.getChildToolboxItems();for(let i=0;i<t.length;i++)t[i].setVisible_(e);this.isHidden_=!e,this.parentToolbox_.getSelectedItem()===this&&this.parentToolbox_.clearSelection()}isExpanded(){return this.expanded_}isCollapsible(){return!0}onClick(e){this.toggleExpanded()}toggleExpanded(){this.setExpanded(!this.expanded_)}getDiv(){return this.htmlDiv_}getChildToolboxItems(){return this.toolboxItems_}};Gm.registrationName="collapsibleCategory",zs(ka.TOOLBOX_ITEM,Gm.registrationName,Gm);var Wm=class extends ip{constructor(e){super(),this.id="toolbox",this.contentsDiv_=this.HtmlDiv=null,this.isVisible_=!1,this.height_=this.width_=0,this.flyout=null,this.contents=new Map,this.previouslySelectedItem_=this.selectedItem_=null,this.boundEvents_=[],this.mouseDown=!1,this.workspace_=e,this.toolboxDef_=e.options.languageTree||{contents:[]},this.horizontalLayout=e.options.horizontalLayout,this.RTL=e.options.RTL,this.toolboxPosition=e.options.toolboxPosition}onShortcut(e){return!1}init(){var e=this.workspace_;let t=e.getParentSvg();this.flyout=this.createFlyout_(),this.HtmlDiv=this.createDom_(this.workspace_);let i=this.flyout.createDom("svg");f(i,"blocklyToolboxFlyout"),E(i,t),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:zl.ComponentWeight.TOOLBOX_WEIGHT,capabilities:[zl.Capability.AUTOHIDEABLE,zl.Capability.DELETE_AREA,zl.Capability.DRAG_TARGET]}),Xs.getFocusManager$$module$build$src$core$focus_manager().registerTree(this,!0)}createDom_(e){e=e.getParentSvg();let t,i=this.createContainer_();return i.id=fa(),this.contentsDiv_=this.createContentsContainer_(),xe(this.contentsDiv_,xc.TREE),i.appendChild(this.contentsDiv_),null==(t=e.parentNode)||t.insertBefore(i,e),this.attachEvents_(i,this.contentsDiv_),i}createContainer_(){let e=document.createElement("div");return e.setAttribute("layout",this.isHorizontal()?"h":"v"),f(e,"blocklyToolbox"),e.setAttribute("dir",this.RTL?"RTL":"LTR"),e}createContentsContainer_(){let e=document.createElement("div");return f(e,"blocklyToolboxCategoryGroup"),this.isHorizontal()&&(e.style.flexDirection="row"),e}attachEvents_(e,t){let i=aa(e,"pointerdown",this,this.onClick_,!1);
3this.boundEvents_.push(i),e=la(e,"pointerup",this,()=>{this.mouseDown=!1}),this.boundEvents_.push(e),t=aa(t,"keydown",this,this.onKeyDown_,!1),this.boundEvents_.push(t)}onClick_(e){if(this.mouseDown=!0,ha(e)||e.target===this.HtmlDiv)M().hideChaff(!1);else{var t=e.target.getAttribute("id");t&&(null!=(t=this.getToolboxItemById(t))&&t.isSelectable())&&(this.setSelectedItem(t),t.onClick(e)),M().hideChaff(!0)}na()}onKeyDown_(e){let t=!1;switch(e.key){case"ArrowDown":t=this.selectNext();break;case"ArrowUp":t=this.selectPrevious();break;case"ArrowLeft":t=this.selectParent();break;case"ArrowRight":t=this.selectChild();break;case"Enter":case" ":this.selectedItem_&&this.selectedItem_.isCollapsible()&&(this.selectedItem_.toggleExpanded(),t=!0);break;default:t=!1}!t&&this.selectedItem_&&this.selectedItem_.onKeyDown&&(t=this.selectedItem_.onKeyDown(e)),t&&e.preventDefault()}createFlyout_(){let e=this.workspace_,t=e.copyOptionsForFlyout();return t.toolboxPosition=e.options.toolboxPosition,new(e.horizontalLayout?ea(ka.FLYOUTS_HORIZONTAL_TOOLBOX,e.options,!0):ea(ka.FLYOUTS_VERTICAL_TOOLBOX,e.options,!0))(t)}render(e){this.toolboxDef_=e,this.contents.forEach(e=>e.dispose()),this.contents.clear(),this.renderContents_(e.contents),this.position(),this.handleToolboxItemResize()}renderContents_(e){let t,i=document.createDocumentFragment();for(let n=0;n<e.length;n++)this.createToolboxItem(e[n],i);null==(t=this.contentsDiv_)||t.appendChild(i)}createToolboxItem(e,t){var i=e.kind;if("CATEGORY"===i.toUpperCase()&&Ee(e)&&(i=Gm.registrationName),i=qs(ka.TOOLBOX_ITEM,i.toLowerCase())){let n;(e=new i(e,this)).init(),this.addToolboxItem_(e),(i=e.getDiv())&&t.appendChild(i),null==(n=e.getClickTarget())||n.setAttribute("id",e.getId())}}addToolboxItem_(e){if(this.contents.set(e.getId(),e),e.isCollapsible()){e=e.getChildToolboxItems();for(let t=0;t<e.length;t++)this.addToolboxItem_(e[t])}}getToolboxItems(){return[...this.contents.values()]}addStyle(e){e&&this.HtmlDiv&&f(this.HtmlDiv,e)}removeStyle(e){e&&this.HtmlDiv&&m(this.HtmlDiv,e)}getClientRect(){if(!this.HtmlDiv||!this.isVisible_)return null;var e=this.HtmlDiv.getBoundingClientRect();let t=e.top,i=t+e.height,n=e.left;return e=n+e.width,this.toolboxPosition===mc.TOP?new ec(-1e7,i,-1e7,1e7):this.toolboxPosition===mc.BOTTOM?new ec(t,1e7,-1e7,1e7):this.toolboxPosition===mc.LEFT?new ec(-1e7,1e7,-1e7,e):new ec(-1e7,1e7,n,1e7)}wouldDelete(e){return e instanceof ep?this.updateWouldDelete_(!e.getParent()&&e.isDeletable()):this.updateWouldDelete_(tr(e)&&e.isDeletable()),this.wouldDelete_}onDragEnter(e){this.updateCursorDeleteStyle_(!0)}onDragExit(e){this.updateCursorDeleteStyle_(!1)}onDrop(e){this.updateCursorDeleteStyle_(!1)}updateWouldDelete_(e){e!==this.wouldDelete_&&(this.updateCursorDeleteStyle_(!1),this.wouldDelete_=e,this.updateCursorDeleteStyle_(!0))}updateCursorDeleteStyle_(e){let t=this.wouldDelete_?"blocklyToolboxDelete":"blocklyToolboxGrab";e?this.addStyle(t):this.removeStyle(t)}getToolboxItemById(e){return this.contents.get(e)||null}getWidth(){return this.width_}getHeight(){return this.height_}getFlyout(){return this.flyout}getWorkspace(){return this.workspace_}getSelectedItem(){return this.selectedItem_}getPreviouslySelectedItem(){return this.previouslySelectedItem_}isHorizontal(){return this.horizontalLayout}position(){let e=this.workspace_.getMetrics(),t=this.HtmlDiv;var i;t&&(this.horizontalLayout?(t.style.left="0",t.style.height="auto",t.style.width="100%",this.height_=t.offsetHeight,this.width_=e.viewWidth,this.toolboxPosition===mc.TOP?t.style.top="0":t.style.bottom="0"):(this.toolboxPosition===mc.RIGHT?t.style.right="0":t.style.left="0",t.style.height="100%",this.width_=t.offsetWidth,this.height_=e.viewHeight),null==(i=this.flyout)||i.position())}handleToolboxItemResize(){if(this.HtmlDiv){var e=this.workspace_,t=this.HtmlDiv.getBoundingClientRect(),i=this.getFlyout(),n=this.toolboxPosition===mc.LEFT?e.scrollX+t.width+(null!=i&&i.isVisible()?i.getWidth():0):e.scrollX;t=this.toolboxPosition===mc.TOP?e.scrollY+t.height+(null!=i&&i.isVisible()?i.getHeight():0):e.scrollY,e.translate(n,t),H(e)}}clearSelection(){this.setSelectedItem(null)}
3refreshTheme(){this.contents.forEach(e=>{e.refreshTheme&&e.refreshTheme()})}refreshSelection(){if(this.selectedItem_&&this.selectedItem_.isSelectable()&&this.selectedItem_.getContents().length){let e;null==(e=this.flyout)||e.show(this.selectedItem_.getContents())}}setVisible(e){this.isVisible_!==e&&(this.HtmlDiv&&(this.HtmlDiv.style.display=e?"block":"none"),this.isVisible_=e,this.workspace_.recordDragTargets())}autoHide(e){!e&&this.flyout&&this.flyout.autoClose&&this.clearSelection()}setSelectedItem(e){let t=this.selectedItem_;!e&&!t||e&&!Vs(e)||(this.shouldDeselectItem_(t,e)&&null!==t&&this.deselectItem_(t),this.shouldSelectItem_(t,e)&&null!==e&&this.selectItem_(t,e),this.updateFlyout_(t,e),this.fireSelectEvent(t,e))}shouldDeselectItem_(e,t){return null!==e&&(!e.isCollapsible()||e!==t)}shouldSelectItem_(e,t){return null!==t&&t!==e}deselectItem_(e){this.selectedItem_=null,this.previouslySelectedItem_=e,e.setSelected(!1),De(this.contentsDiv_,Dc.ACTIVEDESCENDANT,"")}selectItem_(e,t){this.selectedItem_=t,this.previouslySelectedItem_=e,t.setSelected(!0),De(this.contentsDiv_,Dc.ACTIVEDESCENDANT,t.getId())}selectItemByPosition(e){(e=this.getToolboxItems()[e])&&this.setSelectedItem(e)}updateFlyout_(e,t){if(t&&(e!==t||t.isCollapsible())&&t.getContents().length){let e,i;null==(e=this.flyout)||e.show(t.getContents()),null==(i=this.flyout)||i.scrollToStart()}else{let e;null==(e=this.flyout)||e.hide()}}fireSelectEvent(e,i){let n=e&&e.getName(),o=i&&i.getName();e===i&&(o=null),e=new(h(ja.TOOLBOX_ITEM_SELECT))(n,o,this.workspace_.id),t(e)}selectParent(){if(!this.selectedItem_)return!1;if(this.selectedItem_.isCollapsible()&&this.selectedItem_.isExpanded())return this.selectedItem_.toggleExpanded(),!0;let e;return!(null==(e=this.selectedItem_.getParent())||!e.isSelectable())&&(this.setSelectedItem(this.selectedItem_.getParent()),!0)}selectChild(){if(!this.selectedItem_||!this.selectedItem_.isCollapsible())return!1;let e=this.selectedItem_;return e.isExpanded()?this.selectNext():e.toggleExpanded(),!0}selectNext(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)+1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[++t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}selectPrevious(){if(!this.selectedItem_)return!1;let e=[...this.contents.values()],t=e.indexOf(this.selectedItem_)-1;if(t>-1&&t<e.length){let i=e[t];for(;i&&!i.isSelectable();)i=e[--t];if(i&&i.isSelectable())return this.setSelectedItem(i),!0}return!1}dispose(){var e;for(this.workspace_.getComponentManager().removeComponent("toolbox"),null==(e=this.flyout)||e.dispose(),this.contents.forEach(e=>e.dispose()),e=0;e<this.boundEvents_.length;e++)ca(this.boundEvents_[e]);this.boundEvents_=[],this.contents.clear(),this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),_(this.HtmlDiv)),Xs.getFocusManager$$module$build$src$core$focus_manager().unregisterTree(this)}getFocusableElement(){if(!this.HtmlDiv)throw Error("Toolbox DOM has not yet been created.");return this.HtmlDiv}getFocusableTree(){return this}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!0}getRootFocusableNode(){return this}getRestoredFocusableNode(e){return e&&e!==this?null:this.getToolboxItems().find(e=>e.isSelectable())??null}getNestedTrees(){return[]}lookUpFocusableNode(e){return this.getToolboxItemById(e)}onTreeFocus(e,t){e===this?this.clearSelection():this.getSelectedItem()===e||this.mouseDown||this.setSelectedItem(e)}onTreeBlur(e){e&&e===this.flyout?.getWorkspace()||this.autoHide(!1)}};Y('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolbox {\n box-sizing: border-box;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxCategoryGroup {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxCategoryGroup:focus {\n outline: none;\n}\n'),zs(ka.TOOLBOX,Ca,Wm);var Xm=Rd.INPUT_VALUE,zm=Rd.OUTPUT_VALUE,jm=Rd.NEXT_STATEMENT,Ym=Rd.PREVIOUS_STATEMENT,Qm=mc.TOP,Km=mc.BOTTOM,qm=mc.LEFT,Jm=mc.RIGHT;If.prototype.newBlock=function(e,t){return new Wd(this,e,t)},yf.prototype.newBlock=function(e,t){return new ep(this,e,t)},If.prototype.newComment=function(e){return new td(this,e)},yf.prototype.newComment=function(e){return new id(this,e)},yf.newTrashcan=function(e){return new Mf(e)}
3,Td.prototype.newWorkspaceSvg=function(e){return new yf(e)},Xs.Names$$module$build$src$core$names.prototype.populateProcedures=function(e){e=(e=dr(e))[0].concat(e[1]);for(let t=0;t<e.length;t++)this.getName(e[t][0],Xs.Names$$module$build$src$core$names.NameType.PROCEDURE)};var Zm={};Zm.Block=Wd,Zm.BlockFlyoutInflater=ym,Zm.BlockNavigationPolicy=dp,Zm.BlockSvg=ep,Zm.Blocks=Ua,Zm.ButtonFlyoutInflater=vm,Zm.COLLAPSED_FIELD_NAME=Wc,Zm.COLLAPSED_INPUT_NAME=Gc,Zm.COLLAPSE_CHARS=30,Zm.CodeGenerator=Xs.CodeGenerator$$module$build$src$core$generator,Zm.CollapsibleToolboxCategory=Gm,Zm.ComponentManager=zl,Zm.Connection=Ld,Zm.ConnectionChecker=vf,Zm.ConnectionDB=Cd,Zm.ConnectionNavigationPolicy=mp,Zm.ConnectionType=Rd,Zm.ContextMenu=Ph,Zm.ContextMenuItems=bm,Zm.ContextMenuRegistry=Fh,Zm.Css=ql,Zm.DELETE_VARIABLE_ID=Dd,Zm.DeleteArea=ip,Zm.DragTarget=tp,Zm.DropDownDiv=Ju,Zm.Events=_m,Zm.Extensions=vd,Zm.Field=vh,Zm.FieldCheckbox=kg,Zm.FieldDropdown=ud,Zm.FieldImage=hg,Zm.FieldLabel=$d,Zm.FieldLabelSerializable=Cg,Zm.FieldNavigationPolicy=Tp,Zm.FieldNumber=
3Rg,Zm.FieldTextInput=Xs.FieldTextInput$$module$build$src$core$field_textinput,Zm.FieldVariable=yg,Zm.Flyout=kp,Zm.FlyoutButton=sp,Zm.FlyoutButtonNavigationPolicy=ap,Zm.FlyoutItem=np,Zm.FlyoutMetricsManager=rp,Zm.FlyoutNavigationPolicy=lp,Zm.FlyoutNavigator=Sp,Zm.FlyoutSeparator=cp,Zm.FlyoutSeparatorNavigationPolicy=up,Zm.FocusManager=Al,Zm.FocusableTreeTraverser=Cl,Zm.Generator=Xs.CodeGenerator$$module$build$src$core$generator,Zm.Gesture=$p,Zm.Grid=Mp,Zm.HorizontalFlyout=Sg,Zm.INPUT_VALUE=Xm,Zm.Input=Ud,Zm.InsertionMarkerPreviewer=bg,Zm.KeyboardNavigationController=Ap,Zm.LabelFlyoutInflater=lg,Zm.LineCursor=Pp,Zm.Marker=Dp,Zm.MarkerManager=Fp,Zm.Menu=Hc,Zm.MenuItem=Uc,Zm.MetricsManager=op,Zm.Msg=Xs.Msg$$module$build$src$core$msg,Zm.NEXT_STATEMENT=jm,Zm.Names=Xs.Names$$module$build$src$core$names,Zm.Navigator=Ip,Zm.OPPOSITE_TYPE=Md,Zm.OUTPUT_VALUE=zm,Zm.Options=fd,Zm.PREVIOUS_STATEMENT=Ym,Zm.PROCEDURE_CATEGORY_NAME=Vp,Zm.Procedures=Up,Zm.RENAME_VARIABLE_ID=xd,Zm.RenderedConnection=Pd,Zm.Scrollbar=ac,Zm.ScrollbarPair=yp,Zm.SeparatorFlyoutInflater=Cp,Zm.ShortcutItems=tg,Zm.ShortcutRegistry=wl,Zm.TOOLBOX_AT_BOTTOM=Km,Zm.TOOLBOX_AT_LEFT=qm,Zm.TOOLBOX_AT_RIGHT=Jm,Zm.TOOLBOX_AT_TOP=Qm,Zm.Theme=dd,Zm.ThemeManager=Ef,Zm.Themes=Bm,Zm.Toast=ru,Zm.Toolbox=Wm,Zm.ToolboxCategory=Hm,Zm.ToolboxItem=Um,Zm.ToolboxSeparator=Vm,Zm.Tooltip=mh,Zm.Touch=za,Zm.Trashcan=Mf,Zm.UnattachedFieldError=Ih,Zm.VARIABLE_CATEGORY_NAME=Tu,Zm.VARIABLE_DYNAMIC_CATEGORY_NAME=bf,Zm.VERSION="12.5.1",Zm.VariableMap=wf,Zm.VariableModel=Af,Zm.Variables=bu,Zm.VariablesDynamic=Of,Zm.VerticalFlyout=Ig,Zm.WidgetDiv=$h,Zm.Workspace=If,Zm.WorkspaceAudio=Sf,Zm.WorkspaceDragger=wp,Zm.WorkspaceNavigationPolicy=vp,Zm.WorkspaceSvg=yf,Zm.Xml=nd,Zm.ZoomControls=kc,Zm.blockAnimations=jd,Zm.blockRendering=_f,Zm.browserEvents=rl,Zm.bubbles=Im,Zm.bumpObjects=Kd,Zm.clipboard=Jf,Zm.comments=Zf,Zm.common=Fl,Zm.config=Xs.config$$module$build$src$core$config,Zm.constants=zc,Zm.defineBlocksWithJsonArray=W,Zm.dialog=pu,Zm.dragging=Lg,Zm.fieldRegistry=cd,Zm.geras=xm,Zm.getFocusManager=Xs.getFocusManager$$module$build$src$core$focus_manager,Zm.getMainWorkspace=M,Zm.getSelected=D,Zm.hasBubble=Qt,Zm.hideChaff=Gs,Zm.icons=Bp,Zm.inject=cs,Zm.inputs=Og,Zm.isCopyable=jr,Zm.isDeletable=tr,Zm.isDraggable=lr,Zm.isIcon=Uo,Zm.isObservable=hr,Zm.isPaster=Us,Zm.isRenderedElement=Hs,Zm.isSelectable=k,Zm.isSerializable=Pe,Zm.isVariableBackedParameterModel=nt,Zm.keyboardNavigationController=Lp,Zm.layers=Gh,Zm.navigateBlock=or,Zm.navigateStacks=nr,Zm.procedures=Up,Zm.registry=Aa,Zm.renderManagement=tu,Zm.serialization=sg,Zm.setLocale=jc,Zm.setParentContainer=U,Zm.svgResize=H,Zm.thrasos=Fm,Zm.uiPosition=Sc,Zm.utils=Sd,Zm.zelos=Em;return Zm.__namespace__=Xs,Zm})}),zL=a((e,t)=>{!function(i,n){if("function"==typeof define&&define.amd)define([],n);else if("object"==typeof e)t.exports=n();else{var o=n();for(var r in o)i.Blockly.Msg[r]=o[r]}}(e,function(){var e=e||{Msg:Object.create(null)};return e.Msg.ADD_COMMENT="Add Comment",e.Msg.ALT_KEY="Alt",e.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="Can't delete the variable '%1' because it's part of the definition of the function '%2'",e.Msg.CHANGE_VALUE_TITLE="Change value:",e.Msg.CHROME_OS="ChromeOS",e.Msg.CLEAN_UP="Clean up Blocks",e.Msg.CLOSE="Close",e.Msg.COLLAPSED_WARNINGS_WARNING="Collapsed blocks contain warnings.",e.Msg.COLLAPSE_ALL="Collapse Blocks",e.Msg.COLLAPSE_BLOCK="Collapse Block",e.Msg.COLOUR_BLEND_COLOUR1="colour 1",e.Msg.COLOUR_BLEND_COLOUR2="colour 2",e.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",e.Msg.COLOUR_BLEND_RATIO="ratio",e.Msg.COLOUR_BLEND_TITLE="blend",e.Msg.COLOUR_BLEND_TOOLTIP="Blends two colours together with a given ratio (0.0 - 1.0).",e.Msg.COLOUR_PICKER_HELPURL="https://en.wikipedia.org/wiki/Color",e.Msg.COLOUR_PICKER_TOOLTIP="Choose a colour from the palette.",e.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",e.Msg.COLOUR_RANDOM_TITLE="random colour",e.Msg.COLOUR_RANDOM_TOOLTIP="Choose a colour at random.",e.Msg.COLOUR_RGB_BLUE="blue",e.Msg.COLOUR_RGB_GREEN="green",e.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",e.Msg.COLOUR_RGB_RED="red",e.Msg.COLOUR_RGB_TITLE="colour with",e.Msg.COLOUR_RGB_TOOLTIP="Create a colour with the specified amount of red, green, and blue. All values must be between 0 and 100.",e.Msg.COMMAND_KEY="â Command",e.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#loop-termination-blocks",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break out of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue with next iteration of loop",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Break out of the containing loop.",e.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Skip the rest of this loop, and continue with the next iteration.",e.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="Warning: This block may only be used within a loop.",e.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#for-each",e.Msg.CONTROLS_FOREACH_TIT
3LE="for each item %1 in list %2",e.Msg.CONTROLS_FOREACH_TOOLTIP="For each item in a list, set the variable '%1' to the item, and then do some statements.",e.Msg.CONTROLS_FOR_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#count-with",e.Msg.CONTROLS_FOR_TITLE="count with %1 from %2 to %3 by %4",e.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.",e.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="Add a condition to the if block.",e.Msg.CONTROLS_IF_ELSE_TOOLTIP="Add a final, catch-all condition to the if block.",e.Msg.CONTROLS_IF_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/IfElse",e.Msg.CONTROLS_IF_IF_TOOLTIP="Add, remove, or reorder sections to reconfigure this if block.",e.Msg.CONTROLS_IF_MSG_ELSE="else",e.Msg.CONTROLS_IF_MSG_ELSEIF="else if",e.Msg.CONTROLS_IF_MSG_IF="if",e.Msg.CONTROLS_IF_TOOLTIP_1="If a value is true, then do some statements.",e.Msg.CONTROLS_IF_TOOLTIP_2="If a value is true, then do the first block of statements. Otherwise, do the second block of statements.",e.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.",e.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.",e.Msg.CONTROLS_REPEAT_HELPURL="https://en.wikipedia.org/wiki/For_loop",e.Msg.CONTROLS_REPEAT_INPUT_DO="do",e.Msg.CONTROLS_REPEAT_TITLE="repeat %1 times",e.Msg.CONTROLS_REPEAT_TOOLTIP="Do some statements several times.",e.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Loops#repeat",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repeat until",e.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repeat while",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="While a value is false, then do some statements.",e.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="While a value is true, then do some statements.",e.Msg.CONTROL_KEY="Ctrl",e.Msg.COPY_SHORTCUT="Copy",e.Msg.CUT_SHORTCUT="Cut",e.Msg.DELETE_ALL_BLOCKS="Delete all %1 blocks?",e.Msg.DELETE_BLOCK="Delete Block",e.Msg.DELETE_VARIABLE="Delete the '%1' variable",e.Msg.DELETE_VARIABLE_CONFIRMATION="Delete %1 uses of the '%2' variable?",e.Msg.DELETE_X_BLOCKS="Delete %1 Blocks",e.Msg.DIALOG_CANCEL="Cancel",e.Msg.DIALOG_OK="OK",e.Msg.DISABLE_BLOCK="Disable Block",e.Msg.DUPLICATE_BLOCK="Duplicate",e.Msg.DUPLICATE_COMMENT="Duplicate Comment",e.Msg.EDIT_BLOCK_CONTENTS="Edit Block contents",e.Msg.ENABLE_BLOCK="Enable Block",e.Msg.EXPAND_ALL="Expand Blocks",e.Msg.EXPAND_BLOCK="Expand Block",e.Msg.EXTERNAL_INPUTS="External Inputs",e.Msg.HELP="Help",e.Msg.HELP_PROMPT="Press %1 for help on keyboard controls",e.Msg.INLINE_INPUTS="Inline Inputs",e.Msg.KEYBOARD_NAV_CONSTRAINED_MOVE_HINT="Use the arrow keys to move, then %1 to accept the position",e.Msg.KEYBOARD_NAV_COPIED_HINT="Copied. Press %1 to paste.",e.Msg.KEYBOARD_NAV_CUT_HINT="Cut. Press %1 to paste.",e.Msg.KEYBOARD_NAV_UNCONSTRAINED_MOVE_HINT="Hold %1 and use arrow keys to move freely, then %2 to accept the position",e.Msg.LINUX="Linux",e.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-empty-list",e.Msg.LISTS_CREATE_EMPTY_TITLE="create empty list",e.Msg.LISTS_CREATE_EMPTY_TOOLTIP="Returns a list, of length 0, containing no data records",e.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="list",e.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Add, remove, or reorder sections to reconfigure this list block.",e.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_CREATE_WITH_INPUT_WITH="create list with",e.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="Add an item to the list.",e.Msg.LISTS_CREATE_WITH_TOOLTIP="Create a list with any number of items.",e.Msg.LISTS_GET_INDEX_FIRST="first",e.Msg.LISTS_GET_INDEX_FROM_END="# from end",e.Msg.LISTS_GET_INDEX_FROM_START="#",e.Msg.LISTS_GET_INDEX_GET="get",e.Msg.LISTS_GET_INDEX_GET_REMOVE="get and remove",e.Msg.LISTS_GET_INDEX_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-items-from-a-list",e.Msg.LISTS_GET_INDEX_LAST="last",e.Msg.LISTS_GET_INDEX_RANDOM="random",e.Msg.LISTS_GET_INDEX_REMOVE="remove",e.Msg.LISTS_GET_INDEX_TAIL="",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Removes and returns the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Removes and returns the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Removes and returns the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Removes and returns a random item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Removes the first item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Removes the item at the specified position in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Removes the last item in a list.",e.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Removes a random item in a list.",e.Msg.LISTS_GET_SUBLIST_END_FROM_END="to # from end",e.Msg.LISTS_GET_SUBLIST_END_FROM_START="to #",e.Msg.LISTS_GET_SUBLIST_END_LAST="to last",e.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#getting-a-sublist",e.Msg.LISTS_GET_SUBLIST_START_FIRST="get sub-list from first",e.Msg.LISTS_GET_SUBLIST_START_FROM_END="get sub-list from # from end",e.Msg.LISTS_GET_SUBLIST_START_FROM_START="get sub-list from #",e.Msg.LISTS_GET_SUBLIST_TAIL="",e.Msg.LISTS_GET_SUBLIST_TOOLTIP="Creates a copy of the specified portion of a list.",e.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1 is the last item.",e.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1 is the first item.",e.Msg.LISTS_INDEX_OF_FIRST="find first occurrence of item",e.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#finding-items-in-a-list",e.Msg.LISTS_INDEX_OF_LAST="find last occurrence of item",e.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.",e.Msg.LISTS_INLIST="in list",e.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#is-empty",e.Msg.LISTS_ISEMPTY_TITLE="%1 is empty",e.Msg.LISTS_ISEMPTY_TOOLTIP="Returns true if the list is empty.",e.Msg.LISTS_LENGTH_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#length-of",e.Msg.LISTS_LENGTH_TITLE="length of %1",e.Msg.LISTS_LENGTH_TOOLTIP="Returns the length of a list.",e.Msg.LISTS_REPEAT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#create-list-with",e.Msg.LISTS_REPEAT_TITLE="create list with item %1 repeated %2 times",e.Msg.LISTS_REPEAT_TOOLTIP="Creates a list consisting of the given value repeated the specified number of times.",e.Msg.LISTS_REVERSE_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#reversing-a-list",e.Msg.LISTS_REVERSE_MESSAGE0="reverse %1",e.Msg.LISTS_REVERSE_TOOLTIP="Reverse a copy of a list.",e.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#in-list--set",e.Msg.LISTS_SET_INDEX_INPUT_TO="as",e.Msg.LISTS_SET_INDEX_INSERT="insert at",e.Msg.LISTS_SET_INDEX_SET="set",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Inserts the item at the start of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Inserts the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Append the item to the end of a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Inserts the item randomly in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Sets the first item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Sets the item at the specified position in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Sets the last item in a list.",e.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Sets a random item in a list.",e.Msg.LISTS_SORT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#sorting-a-l
3ist",e.Msg.LISTS_SORT_ORDER_ASCENDING="ascending",e.Msg.LISTS_SORT_ORDER_DESCENDING="descending",e.Msg.LISTS_SORT_TITLE="sort %1 %2 %3",e.Msg.LISTS_SORT_TOOLTIP="Sort a copy of a list.",e.Msg.LISTS_SORT_TYPE_IGNORECASE="alphabetic, ignore case",e.Msg.LISTS_SORT_TYPE_NUMERIC="numeric",e.Msg.LISTS_SORT_TYPE_TEXT="alphabetic",e.Msg.LISTS_SPLIT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Lists#splitting-strings-and-joining-lists",e.Msg.LISTS_SPLIT_LIST_FROM_TEXT="make list from text",e.Msg.LISTS_SPLIT_TEXT_FROM_LIST="make text from list",e.Msg.LISTS_SPLIT_TOOLTIP_JOIN="Join a list of texts into one text, separated by a delimiter.",e.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="Split text into a list of texts, breaking at each delimiter.",e.Msg.LISTS_SPLIT_WITH_DELIMITER="with delimiter",e.Msg.LOGIC_BOOLEAN_FALSE="false",e.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#values",e.Msg.LOGIC_BOOLEAN_TOOLTIP="Returns either true or false.",e.Msg.LOGIC_BOOLEAN_TRUE="true",e.Msg.LOGIC_COMPARE_HELPURL="https://en.wikipedia.org/wiki/Inequality_(mathematics)",e.Msg.LOGIC_COMPARE_TOOLTIP_EQ="Return true if both inputs equal each other.",e.Msg.LOGIC_COMPARE_TOOLTIP_GT="Return true if the first input is greater than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_GTE="Return true if the first input is greater than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LT="Return true if the first input is smaller than the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_LTE="Return true if the first input is smaller than or equal to the second input.",e.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="Return true if both inputs are not equal to each other.",e.Msg.LOGIC_NEGATE_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#not",e.Msg.LOGIC_NEGATE_TITLE="not %1",e.Msg.LOGIC_NEGATE_TOOLTIP="Returns true if the input is false. Returns false if the input is true.",e.Msg.LOGIC_NULL="null",e.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",e.Msg.LOGIC_NULL_TOOLTIP="Returns null.",e.Msg.LOGIC_OPERATION_AND="and",e.Msg.LOGIC_OPERATION_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Logic#logical-operations",e.Msg.LOGIC_OPERATION_OR="or",e.Msg.LOGIC_OPERATION_TOOLTIP_AND="Return true if both inputs are true.",e.Msg.LOGIC_OPERATION_TOOLTIP_OR="Return true if at least one of the inputs is true.",e.Msg.LOGIC_TERNARY_CONDITION="test",e.Msg.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:",e.Msg.LOGIC_TERNARY_IF_FALSE="if false",e.Msg.LOGIC_TERNARY_IF_TRUE="if true",e.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.",e.Msg.MAC_OS="macOS",e.Msg.MATH_ADDITION_SYMBOL="+",e.Msg.MATH_ARITHMETIC_HELPURL="https://en.wikipedia.org/wiki/Arithmetic",e.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="Return the sum of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Return the quotient of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="Return the difference of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Return the product of the two numbers.",e.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="Return the first number raised to the power of the second number.",e.Msg.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2",e.Msg.MATH_ATAN2_TITLE="atan2 of X:%1 Y:%2",e.Msg.MATH_ATAN2_TOOLTIP="Return the arctangent of point (X, Y) in degrees from -180 to 180.",e.Msg.MATH_CHANGE_HELPURL="https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter",e.Msg.MATH_CHANGE_TITLE="change %1 by %2",e.Msg.MATH_CHANGE_TOOLTIP="Add a number to variable '%1'.",e.Msg.MATH_CONSTANT_HELPURL="https://en.wikipedia.org/wiki/Mathematical_constant",e.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).",e.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",e.Msg.MATH_CONSTRAIN_TITLE="constrain %1 low %2 high %3",e.Msg.MATH_CONSTRAIN_TOOLTIP="Constrain a number to be between the specified limits (inclusive).",e.Msg.MATH_DIVISION_SYMBOL="÷",e.Msg.MATH_IS_DIVISIBLE_BY="is divisible by",e.Msg.MATH_IS_EVEN="is even",e.Msg.MATH_IS_NEGATIVE="is negative",e.Msg.MATH_IS_ODD="is odd",e.Msg.MATH_IS_POSITIVE="is positive",e.Msg.MATH_IS_PRIME="is prime",e.Msg.MATH_IS_TOOLTIP="Check if a number is an even, odd, prime, whole, positive, negative, or if it is divisible by certain
3number. Returns true or false.",e.Msg.MATH_IS_WHOLE="is whole",e.Msg.MATH_MODULO_HELPURL="https://en.wikipedia.org/wiki/Modulo_operation",e.Msg.MATH_MODULO_TITLE="remainder of %1 ÷ %2",e.Msg.MATH_MODULO_TOOLTIP="Return the remainder from dividing the two numbers.",e.Msg.MATH_MULTIPLICATION_SYMBOL="Ã",e.Msg.MATH_NUMBER_HELPURL="https://en.wikipedia.org/wiki/Number",e.Msg.MATH_NUMBER_TOOLTIP="A number.",e.Msg.MATH_ONLIST_HELPURL="",e.Msg.MATH_ONLIST_OPERATOR_AVERAGE="average of list",e.Msg.MATH_ONLIST_OPERATOR_MAX="max of list",e.Msg.MATH_ONLIST_OPERATOR_MEDIAN="median of list",e.Msg.MATH_ONLIST_OPERATOR_MIN="min of list",e.Msg.MATH_ONLIST_OPERATOR_MODE="modes of list",e.Msg.MATH_ONLIST_OPERATOR_RANDOM="random item of list",e.Msg.MATH_ONLIST_OPERATOR_STD_DEV="standard deviation of list",e.Msg.MATH_ONLIST_OPERATOR_SUM="sum of list",e.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="Return the average (arithmetic mean) of the numeric values in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MAX="Return the largest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="Return the median number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MIN="Return the smallest number in the list.",e.Msg.MATH_ONLIST_TOOLTIP_MODE="Return a list of the most common item(s) in the list.",e.Msg.MATH_ONLIST_TOOLTIP_RANDOM="Return a random element from the list.",e.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="Return the standard deviation of the list.",e.Msg.MATH_ONLIST_TOOLTIP_SUM="Return the sum of all the numbers in the list.",e.Msg.MATH_POWER_SYMBOL="^",e.Msg.MATH_RANDOM_FLOAT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="random fraction",e.Msg.MATH_RANDOM_FLOAT_TOOLTIP="Return a random fraction between 0.0 (inclusive) and 1.0 (exclusive).",e.Msg.MATH_RANDOM_INT_HELPURL="https://en.wikipedia.org/wiki/Random_number_generation",e.Msg.MATH_RANDOM_INT_TITLE="random integer from %1 to %2",e.Msg.MATH_RANDOM_INT_TOOLTIP="Return a random integer between the two specified limits, inclusive.",e.Msg.MATH_ROUND_HELPURL="https://en.wikipedia.org/wiki/Rounding",e.Msg.MATH_ROUND_OPERATOR_ROUND="round",e.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="round down",e.Msg.MATH_ROUND_OPERATOR_ROUNDUP="round up",e.Msg.MATH_ROUND_TOOLTIP="Round a number up or down.",e.Msg.MATH_SINGLE_HELPURL="https://en.wikipedia.org/wiki/Square_root",e.Msg.MATH_SINGLE_OP_ABSOLUTE="absolute",e.Msg.MATH_SINGLE_OP_ROOT="square root",e.Msg.MATH_SINGLE_TOOLTIP_ABS="Return the absolute value of a number.",e.Msg.MATH_SINGLE_TOOLTIP_EXP="Return e to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LN="Return the natural logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_LOG10="Return the base 10 logarithm of a number.",e.Msg.MATH_SINGLE_TOOLTIP_NEG="Return the negation of a number.",e.Msg.MATH_SINGLE_TOOLTIP_POW10="Return 10 to the power of a number.",e.Msg.MATH_SINGLE_TOOLTIP_ROOT="Return the square root of a number.",e.Msg.MATH_SUBTRACTION_SYMBOL="-",e.Msg.MATH_TRIG_ACOS="acos",e.Msg.MATH_TRIG_ASIN="asin",e.Msg.MATH_TRIG_ATAN="atan",e.Msg.MATH_TRIG_COS="cos",e.Msg.MATH_TRIG_HELPURL="https://en.wikipedia.org/wiki/Trigonometric_functions",e.Msg.MATH_TRIG_SIN="sin",e.Msg.MATH_TRIG_TAN="tan",e.Msg.MATH_TRIG_TOOLTIP_ACOS="Return the arccosine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ASIN="Return the arcsine of a number.",e.Msg.MATH_TRIG_TOOLTIP_ATAN="Return the arctangent of a number.",e.Msg.MATH_TRIG_TOOLTIP_COS="Return the cosine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_SIN="Return the sine of a degree (not radian).",e.Msg.MATH_TRIG_TOOLTIP_TAN="Return the tangent of a degree (not radian).",e.Msg.MOVE_BLOCK="Move Block",e.Msg.NEW_COLOUR_VARIABLE="Create colour variable...",e.Msg.NEW_NUMBER_VARIABLE="Create number variable...",e.Msg.NEW_STRING_VARIABLE="Create string variable...",e.Msg.NEW_VARIABLE="Create variable...",e.Msg.NEW_VARIABLE_TITLE="New variable name:",e.Msg.NEW_VARIABLE_TYPE_TITLE="New variable type:",e.Msg.OPTION_KEY="⥠Option",e.Msg.ORDINAL_NUMBER_SUFFIX="",e.Msg.PASTE_SHORTCUT="Paste",e.Msg.PROCEDURES_ALLOW_STATEMENTS="allow statements",e.Msg.PROCEDURES_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="Run the user-defined function '%1'.",e.Msg.PROCEDURES_CALLRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_CALLRETURN_TOOLTIP="Run the user-defined function '%1' and use its output.",e.Msg.PROCEDURES_CALL_BEFORE_PARAMS="with:",e.Msg.PROCEDURES_CALL_DISABLED_DEF_WARNING="Can't run the user-defined function '%1' because the definition block is disabled.",e.Msg.PROCEDURES_CREATE_DO="Create '%1'",e.Msg.PROCEDURES_DEFNORETURN_COMMENT="Describe this function...",e.Msg.PROCEDURES_DEFNORETURN_DO="",e.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="do something",e.Msg.PROCEDURES_DEFNORETURN_TITLE="to",e.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="Creates a function with no output.",e.Msg.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine",e.Msg.PROCEDURES_DEFRETURN_RETURN="return",e.Msg.PROCEDURES_DEFRETURN_TOOLTIP="Creates a function with an output.",e.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="Warning: This function has duplicate parameters.",e.Msg.PROCEDURES_HIGHLIGHT_DEF="Highlight function definition",e.Msg.PROCEDURES_IFRETURN_HELPURL="https://c2.com/cgi/wiki?GuardClause",e.Msg.PROCEDURES_IFRETURN_TOOLTIP="If a value is true, then return a second value.",e.Msg.PROCEDURES_IFRETURN_WARNING="Warning: This block may be used only within a function definition.",e.Msg.PROCEDURES_MUTATORARG_TITLE="input name:",e.Msg.PROCEDURES_MUTATORARG_TOOLTIP="Add an input to the function.",e.Msg.PROCEDURES_MUTATORCONTAINER_TIT
3LE="inputs",e.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Add, remove, or reorder inputs to this function.",e.Msg.REDO="Redo",e.Msg.REMOVE_COMMENT="Remove Comment",e.Msg.RENAME_VARIABLE="Rename variable...",e.Msg.RENAME_VARIABLE_TITLE="Rename all '%1' variables to:",e.Msg.SHORTCUTS_CODE_NAVIGATION="Code navigation",e.Msg.SHORTCUTS_EDITING="Editing",e.Msg.SHORTCUTS_GENERAL="General",e.Msg.TEXT_APPEND_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",e.Msg.TEXT_APPEND_TITLE="to %1 append text %2",e.Msg.TEXT_APPEND_TOOLTIP="Append some text to variable '%1'.",e.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#adjusting-text-case",e.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="to lower case",e.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="to Title Case",e.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="to UPPER CASE",e.Msg.TEXT_CHANGECASE_TOOLTIP="Return a copy of the text in a different case.",e.Msg.TEXT_CHARAT_FIRST="get first letter",e.Msg.TEXT_CHARAT_FROM_END="get letter # from end",e.Msg.TEXT_CHARAT_FROM_START="get letter #",e.Msg.TEXT_CHARAT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-text",e.Msg.TEXT_CHARAT_LAST="get last letter",e.Msg.TEXT_CHARAT_RANDOM="get random letter",e.Msg.TEXT_CHARAT_TAIL="",e.Msg.TEXT_CHARAT_TITLE="in text %1 %2",e.Msg.TEXT_CHARAT_TOOLTIP="Returns the letter at the specified position.",e.Msg.TEXT_COUNT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#counting-substrings",e.Msg.TEXT_COUNT_MESSAGE0="count %1 in %2",e.Msg.TEXT_COUNT_TOOLTIP="Count how many times some text occurs within some other text.",e.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Add an item to the text.",e.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="join",e.Msg.TEXT_CREATE_JOIN_TOOLTIP="Add, remove, or reorder sections to reconfigure this text block.",e.Msg.TEXT_GET_SUBSTRING_END_FROM_END="to letter # from end",e.Msg.TEXT_GET_SUBSTRING_END_FROM_START="to letter #",e.Msg.TEXT_GET_SUBSTRING_END_LAST="to last letter",e.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#extracting-a-region-of-text",e.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="in text",e.Msg.TEXT_GET_SUBSTRING_START_FIRST="get substring from first letter",e.Msg.TEXT_GET_SUBSTRING_START_FROM_END="get substring from letter # from end",e.Msg.TEXT_GET_SUBSTRING_START_FROM_START="get substring from letter #",e.Msg.TEXT_GET_SUBSTRING_TAIL="",e.Msg.TEXT_GET_SUBSTRING_TOOLTIP="Returns a specified portion of the text.",e.Msg.TEXT_INDEXOF_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#finding-text",e.Msg.TEXT_INDEXOF_OPERATOR_FIRST="find first occurrence of text",e.Msg.TEXT_INDEXOF_OPERATOR_LAST="find last occurrence of text",e.Msg.TEXT_INDEXOF_TITLE="in text %1 %2 %3",e.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.",e.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#checking-for-empty-text",e.Msg.TEXT_ISEMPTY_TITLE="%1 is empty",e.Msg.TEXT_ISEMPTY_TOOLTIP="Returns true if the provided text is empty.",e.Msg.TEXT_JOIN_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-creation",e.Msg.TEXT_JOIN_TITLE_CREATEWITH="create text with",e.Msg.TEXT_JOIN_TOOLTIP="Create a piece of text by joining together any number of items.",e.Msg.TEXT_LENGTH_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#text-modification",e.Msg.TEXT_LENGTH_TITLE="length of %1",e.Msg.TEXT_LENGTH_TOOLTIP="Returns the number of letters (including spaces) in the provided text.",e.Msg.TEXT_PRINT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#printing-text",e.Msg.TEXT_PRINT_TITLE="print %1",e.Msg.TEXT_PRINT_TOOLTIP="Print the specified text, number or other value.",e.Msg.TEXT_PROMPT_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#getting-input-from-the-user",e.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="Prompt for user for a number.",e.Msg.TEXT_PROMPT_TOOLTIP_TEXT="Prompt for user for some text.",e.Msg.TEXT_PROMPT_TYPE_NUMBER="prompt for number with message",e.Msg.TEXT_PROMPT_TYPE_TEXT="prompt for text with message",e.Msg.TEXT_REPLACE_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#replacing-substrings",e.Msg.TEXT_REPLACE_MESSAGE0="replace %1 with %2 in %3",e.Msg.TEXT_REPLACE_TOOLTIP="Replace all occurances of some text within some other text.",e.Msg.TEXT_REVERSE_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#reversing-text",e.Msg.TEXT_REVERSE_MESSAGE0="reverse %1",e.Msg.TEXT_REVERSE_TOOLTIP="Reverses the order of the characters in the text.",e.Msg.TEXT_TEXT_HELPURL="https://en.wikipedia.org/wiki/String_(computer_science)",e.Msg.TEXT_TEXT_TOOLTIP="A letter, word, or line of text.",e.Msg.TEXT_TRIM_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Text#trimming-removing-spaces",e.Msg.TEXT_TRIM_OPERATOR_BOTH="trim spaces from both
3sides of",e.Msg.TEXT_TRIM_OPERATOR_LEFT="trim spaces from left side of",e.Msg.TEXT_TRIM_OPERATOR_RIGHT="trim spaces from right side of",e.Msg.TEXT_TRIM_TOOLTIP="Return a copy of the text with spaces removed from one or both ends.",e.Msg.TODAY="Today",e.Msg.UNDO="Undo",e.Msg.UNKNOWN="Unknown",e.Msg.UNNAMED_KEY="unnamed",e.Msg.VARIABLES_DEFAULT_NAME="item",e.Msg.VARIABLES_GET_CREATE_SET="Create 'set %1'",e.Msg.VARIABLES_GET_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#get",e.Msg.VARIABLES_GET_TOOLTIP="Returns the value of this variable.",e.Msg.VARIABLES_SET="set %1 to %2",e.Msg.VARIABLES_SET_CREATE_GET="Create 'get %1'",e.Msg.VARIABLES_SET_HELPURL="https://github.com/RaspberryPiFoundation/blockly/wiki/Variables#set",e.Msg.VARIABLES_SET_TOOLTIP="Sets this variable to be equal to the input.",e.Msg.VARIABLE_ALREADY_EXISTS="A variable named '%1' already exists.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="A variable named '%1' already exists for another type: '%2'.",e.Msg.VARIABLE_ALREADY_EXISTS_FOR_A_PARAMETER="A variable named '%1' already exists as a parameter in the procedure '%2'.",e.Msg.WINDOWS="Windows",e.Msg.WORKSPACE_ARIA_LABEL="Blockly Workspace",e.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="Say something...",e.Msg.CONTROLS_FOREACH_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_FOR_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=e.Msg.CONTROLS_IF_MSG_ELSEIF,e.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=e.Msg.CONTROLS_IF_MSG_ELSE,e.Msg.CONTROLS_IF_IF_TITLE_IF=e.Msg.CONTROLS_IF_MSG_IF,e.Msg.CONTROLS_IF_MSG_THEN=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=e.Msg.CONTROLS_REPEAT_INPUT_DO,e.Msg.LISTS_CREATE_WITH_ITEM_TITLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=e.Msg.LISTS_INLIST,e.Msg.MATH_CHANGE_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.PROCEDURES_DEFRETURN_COMMENT=e.Msg.PROCEDURES_DEFNORETURN_COMMENT,e.Msg.PROCEDURES_DEFRETURN_DO=e.Msg.PROCEDURES_DEFNORETURN_DO,e.Msg.PROCEDURES_DEFRETURN_PROCEDURE=e.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,e.Msg.PROCEDURES_DEFRETURN_TITLE=e.Msg.PROCEDURES_DEFNORETURN_TITLE,e.Msg.TEXT_APPEND_VARIABLE=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=e.Msg.VARIABLES_DEFAULT_NAME,e.Msg.COLOUR_HUE="20",e.Msg.LISTS_HUE="260",e.Msg.LOGIC_HUE="210",e.Msg.LOOPS_HUE="120",e.Msg.MATH_HUE="230",e.Msg.PROCEDURES_HUE="290",e.Msg.TEXTS_HUE="160",e.Msg.VARIABLES_DYNAMIC_HUE="310",e.Msg.VARIABLES_HUE="330",e.Msg})}),jL=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):i.Blockly.libraryBlocks=n(i.Blockly)}(e,function(e){var t=e.__namespace__,i=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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"]}]),n={customContextMenu:function(e){if(this.isInFlyout)("variables_get_dynamic"===this.type||"variables_get_reporter_dynamic"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:o(this)},s=this.getField("VAR").getText(),s={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",s),enabled:!0,callback:r(this)},e.unshift(n),e.unshift(s));else{if("variables_get_dynamic"===this.type)var i="variables_set_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else i="variables_get_dynamic",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var s=this.getField("VAR");i={type:i,fields:{VAR:s.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",s.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,i)})}},onchange:function(e){e=this.getFieldValue("VAR"),e=t.getVariable$$module$build$src$core$variables(this.workspace,e),"variables_get_dynamic"===this.type?this.outputConnection.setCheck(e.getType()):this.getInput("VALUE").connection.setCheck(e.getType())}},o=function(e){return function(){let i=e.workspace,n=e.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(i,n)}},r=function(e){return function(){let i=e.getField("VAR").getVariable();i&&t.deleteVariable$$module$build$src$core$variables(i.getWorkspace(),i,e)}};t.registerMixin$$module$build$src$core$extensions("contextMenu_variableDynamicSetterGetter",n),t.defineBlocks$$module$build$src$core$common(i);var s={blocks:i},a=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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"]}]),l={customContextMenu:function(e){if(this.isInFlyout)("variables_get"===this.type||"variables_get_reporter"===this.type)&&(n={text:t.Msg$$module$build$src$core$msg.RENAME_VARIABLE,enabled:!0,callback:c(this)},o=this.getField("VAR").getText(),o={text:t.Msg$$module$build$src$core$msg.DELETE_VARIABLE.replace("%1",o),enabled:!0,callback:u(this)},e.unshift(n),e.unshift(o));else{if("variables_get"===this.type)var i="variables_set",n=t.Msg$$module$build$src$core$msg.VARIABLES_GET_CREATE_SET;else i="variables_get",n=t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET;var o=this.getField("VAR");i={type:i,fields:{VAR:o.saveState(!0)}},e.push({enabled:this.workspace.remainingCapacity()>0,text:n.replace("%1",o.getText()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,i)})}}},c=function(e){return function(){let i=e.workspace,n=e.getField("VAR").getVariable();t.renameVariable$$module$build$src$core$variables(i,n)}},u=function(e){return function(){let i=e.getField("VAR").getVariable();i&&t.deleteVariable$$module$build$src$core$variables(i.getWorkspace(),i,e)}};t.registerMixin$$module$build$src$core$extensions("contextMenu_variableSetterGetter",l),t.defineBlocks$$module$build$src$core$common(a);var h={blocks:a},d=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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_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}
3","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"}]);d.text_getSubstring={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("STRING").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!==("FROM_START"===i||"FROM_END"===i)&&this.getSourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL),this.setInputsInline(!0),this.setOutput(!0,"String"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",`${i}`),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",`${i}`),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),2===e&&t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_GET_SUBSTRING_TAIL)),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT"))}},d.text_changeCase={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE,"UPPERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE,"LOWERCASE"],[t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_OPERATOR_TITLECASE,"TITLECASE"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"CASE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_CHANGECASE_TOOLTIP)}},d.text_trim={init:function(){let e=[[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_BOTH,"BOTH"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_LEFT,"LEFT"],[t.Msg$$module$build$src$core$msg.TEXT_TRIM_OPERATOR_RIGHT,"RIGHT"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_TRIM_HELPURL),this.setStyle("text_blocks"),this.appendValueInput("TEXT").setCheck("String").appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),"MODE"),this.setOutput(!0,"String"),this.setTooltip(t.Msg$$module$build$src$core$msg.TEXT_TRIM_TOOLTIP)}},d.text_print={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TITLE,args0:[{type:"input_value",name:"TEXT"}],previousStatement:null,nextStatement:null,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_PRINT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_PRINT_HELPURL})}};var p={updateType_:function(e){this.outputConnection.setCheck("NUMBER"===e?"Number":"String")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("type",this.getFieldValue("TYPE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("type"))}};d.text_prompt_ext=Object.assign({},p,{init:function(){var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendValueInput("TEXT").appendField(e,"TYPE"),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),d.text_prompt=Object.assign({},p,{init:function(){this.mixin(f);var e=[[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_TEXT,"TEXT"],[t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TYPE_NUMBER,"NUMBER"]];this.setHelpUrl(t.Msg$$module$build$src$core$msg.TEXT_PROMPT_HELPURL),this.setStyle("text_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(e=>{this.updateType_(e)}),this.appendDummyInput().appendField(e,"TYPE").appendField(this.newQuote_(!0)).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:""}),"TEXT").appendField(this.newQuote_(!1)),this.setOutput(!0,"String"),this.setTooltip(()=>"TEXT"===this.getFieldValue("TYPE")?t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_TEXT:t.Msg$$module$build$src$core$msg.TEXT_PROMPT_TOOLTIP_NUMBER)}}),d.text_count={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_COUNT_MESSAGE0,args0:[{type:"input_value",name:"SUB",check:"String"},{type:"input_value",name:"TEXT",check:"String"}
3],output:"Number",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_COUNT_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_COUNT_HELPURL})}},d.text_replace={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$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$$module$build$src$core$msg.TEXT_REPLACE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REPLACE_HELPURL})}},d.text_reverse={init:function(){this.jsonInit({message0:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_MESSAGE0,args0:[{type:"input_value",name:"TEXT",check:"String"}],output:"String",inputsInline:!0,style:"text_blocks",tooltip:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_TOOLTIP,helpUrl:t.Msg$$module$build$src$core$msg.TEXT_REVERSE_HELPURL})}};var f={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(e){for(let t,i=0;t=this.inputList[i];i++)for(let n,o=0;n=t.fieldRow[o];o++)if(e===n.name)return t.insertFieldAt(o,this.newQuote_(!0)),void t.insertFieldAt(o+2,this.newQuote_(!1));console.warn('field named "'+e+'" not found in '+this.toDevString())},newQuote_:function(e){return e=this.RTL?!e:e,t.fromJson$$module$build$src$core$field_registry({type:"field_image",src:e?this.QUOTE_IMAGE_LEFT_DATAURI:this.QUOTE_IMAGE_RIGHT_DATAURI,width:this.QUOTE_IMAGE_WIDTH,height:this.QUOTE_IMAGE_HEIGHT,alt:e?"â":"â"})}};t.register$$module$build$src$core$extensions("text_append_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_TEXT_APPEND_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("text_indexOf_tooltip",function(){this.setTooltip(()=>t.Msg$$module$build$src$core$msg.TEXT_INDEXOF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}),t.register$$module$build$src$core$extensions("text_quotes",function(){this.mixin(f),this.quoteField_("TEXT")}),t.registerMixin$$module$build$src$core$extensions("quote_image_mixin",f),t.registerMutator$$module$build$src$core$extensions("text_join_mutator",{itemCount_:0,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",`${this.itemCount_}`),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("text_create_join_container");t.initSvg();let i=t.getInput("STACK").connection;for(let n=0;n<this.itemCount_;n++){let t=e.newBlock("text_create_join_item");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=i&&i.connection.targetConnection,e=e.getNextBlock(),t++}},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)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$input
3s$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.TEXT_JOIN_TITLE_CREATEWITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},function(){this.mixin(f),this.itemCount_=2,this.updateShape_(),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["text_create_join_item"],this))}),t.registerMutator$$module$build$src$core$extensions("text_charAt_mutator",{isAt_:!1,mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("at",`${this.isAt_}`),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},updateAt_:function(e){this.removeInput("AT",!0),this.removeInput("ORDINAL",!0),e&&(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)),t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL&&(this.removeInput("TAIL",!0),this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TAIL)),this.isAt_=e}},function(){this.getField("WHERE").setValidator(function(e){e="FROM_START"===e||"FROM_END"===e;let t=this.getSourceBlock();e!==t.isAt_&&t.updateAt_(e)}),this.updateAt_(!0),this.setTooltip(()=>{var e=this.getFieldValue("WHERE");let i=t.Msg$$module$build$src$core$msg.TEXT_CHARAT_TOOLTIP;return("FROM_START"===e||"FROM_END"===e)&&(e="FROM_START"===e?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP)&&(i+=" "+e.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),i})}),t.defineBlocks$$module$build$src$core$common(d);var g={blocks:d},m={},T={setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){let e="";this.arguments_.length&&(e=t.Msg$$module$build$src$core$msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),t.disable$$module$build$src$core$events$utils();try{this.setFieldValue(e,"PARAMS")}finally{t.enable$$module$build$src$core$events$utils()}},mutationToDom:function(e){let i=t.createElement$$module$build$src$core$utils$xml("mutation");e&&i.setAttribute("name",this.getFieldValue("NAME"));for(let n=0;n<this.argumentVarModels_.length;n++){let o=t.createElement$$module$build$src$core$utils$xml("arg"),r=this.argumentVarModels_[n];o.setAttribute("name",r.getName()),o.setAttribute("varid",r.getId()),e&&this.paramIds_&&o.setAttribute("paramId",this.paramIds_[n]),i.appendChild(o)}return this.hasStatements_||i.setAttribute("statements","false"),i},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(let n,o=0;n=e.childNodes[o];o++)if("arg"===n.nodeName.toLowerCase()){var i=n;let e=i.getAttribute("name");i=i.getAttribute("varid")||i.getAttribute("varId"),this.arguments_.push(e),null===(i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i,e,""))||this.argumentVarModels_.push(i)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_("false"!==e.getAttribute("statements"))},saveExtraState:function(){if(!this.argumentVarModels_.length&&this.hasStatements_)return null;let e=Object.create(null);if(this.argumentVarModels_.length){e.params=[];for(let t=0;t<this.argumentVarModels_.length;t++)e.params.push({name:this.argumentVarModels_[t].getName(),id:this.argumentVarModels_[t].getId()})}return this.hasStatements_||(e.hasStatements=!1),e},loadExtraState:function(e){if(this.arguments_=[],this.argumentVarModels_=[],e.params)for(let n=0;n<e.params.length;n++){var i=e.params[n];i=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,i.id,i.name,""),this.arguments_.push(i.getName()),this.argumentVarModels_.push(i)}this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),this.setStatements_(!1!==e.hasStatements)},decompose:function(e){let i=t.createElement$$module$build$src$core$utils$xml("block");i.setAttribute("type","procedures_mutatorcontainer");var n=t.createElement$$module$build$src$core$utils$xml("statement");n.setAttribute("name","STACK"),i.appendChild(n);for(let r=0;r<this.arguments_.length;r++){let e=t.createElement$$module$build$src$core$utils$xml("block");
3e.setAttribute("type","procedures_mutatorarg");var o=t.createElement$$module$build$src$core$utils$xml("field");o.setAttribute("name","NAME");let i=t.createTextNode$$module$build$src$core$utils$xml(this.arguments_[r]);o.appendChild(i),e.appendChild(o),o=t.createElement$$module$build$src$core$utils$xml("next"),e.appendChild(o),n.appendChild(e),n=o}return e=t.domToBlock$$module$build$src$core$xml(i,e),"procedures_defreturn"===this.type?e.setFieldValue(this.hasStatements_,"STATEMENTS"):e.removeInput("STATEMENT_INPUT"),t.mutateCallers$$module$build$src$core$procedures(this),e},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];let i=e.getInputTargetBlock("STACK");for(;i&&!i.isInsertionMarker();){var n=i.getFieldValue("NAME");this.arguments_.push(n),n=this.workspace.getVariableMap().getVariable(n,""),this.argumentVarModels_.push(n),this.paramIds_.push(i.id),i=i.nextConnection&&i.nextConnection.targetBlock()}if(this.updateParams_(),t.mutateCallers$$module$build$src$core$procedures(this),null!==(e=e.getFieldValue("STATEMENTS"))&&(e="TRUE"===e,this.hasStatements_!==e))if(e){var o;this.setStatements_(!0),null==(o=this.statementConnection_)||o.reconnect(this,"STACK"),this.statementConnection_=null}else o=this.getInput("STACK").connection,(this.statementConnection_=o.targetConnection)&&((o=o.targetBlock()).unplug(),o.bumpNeighbours()),this.setStatements_(!1)},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},renameVarById:function(e,i){var n=this.workspace.getVariableMap().getVariableById(e);if(""===n.getType()){n=n.getName(),i=this.workspace.getVariableMap().getVariableById(i);var o=!1;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e&&(this.arguments_[t]=i.getName(),this.argumentVarModels_[t]=i,o=!0);o&&(this.displayRenamedVar_(n,i.getName()),t.mutateCallers$$module$build$src$core$procedures(this))}},updateVarName:function(e){let i,n=e.getName(),o=!1;for(let t=0;t<this.argumentVarModels_.length;t++)this.argumentVarModels_[t].getId()===e.getId()&&(i=this.arguments_[t],this.arguments_[t]=n,o=!0);o&&(this.displayRenamedVar_(i,n),t.mutateCallers$$module$build$src$core$procedures(this))},displayRenamedVar_:function(e,i){this.updateParams_();var n=this.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE);if(n&&n.bubbleIsVisible()){n=n.getWorkspace().getAllBlocks(!1);for(let o,r=0;o=n[r];r++)"procedures_mutatorarg"===o.type&&t.Names$$module$build$src$core$names.equals(e,o.getFieldValue("NAME"))&&o.setFieldValue(i,"NAME")}},customContextMenu:function(e){if(!this.isInFlyout){var i=this.getFieldValue("NAME"),n={type:this.callType_,extraState:{name:i,params:this.arguments_}};if(e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_CREATE_DO.replace("%1",i),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,n)}),!this.isCollapsed())for(i=0;i<this.argumentVarModels_.length;i++){let o={type:"variables_get",fields:{VAR:{name:(n=this.argumentVarModels_[i]).getName(),id:n.getId(),type:n.getType()}}};e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",n.getName()),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,o)})}}}};m.procedures_defnoreturn=Object.assign({},T,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!1]},callType_:"procedures_callnoreturn"}),m.procedures_defreturn=Object.assign({},T,{init:function(){var e=t.findLegalName$$module$build$src$core$procedures("",this);(e=t.fromJson$$module$build$src$core$field_registry({type:"field_input",text:e})).setValidator(t.rename$$module$build$src$core$procedures),e.setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.appendValueInput("RETURN").setAlign(t.Align$$module$build$src$core$input
3s$align.RIGHT).appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["procedures_mutatorarg"],this)),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT&&this.setCommentText(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},getProcedureDef:function(){return[this.getFieldValue("NAME"),this.arguments_,!0]},callType_:"procedures_callreturn"}),m.procedures_mutatorcontainer={init:function(){this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TITLE),this.appendStatementInput("STACK"),this.appendDummyInput("STATEMENT_INPUT").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_ALLOW_STATEMENTS).appendField(t.fromJson$$module$build$src$core$field_registry({type:"field_checkbox",checked:!0}
3),"STATEMENTS"),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP),this.contextMenu=!1}};var _=class extends t.FieldTextInput$$module$build$src$core$field_textinput{constructor(){super(...arguments),this.editingInteractively=!1}showEditor_(e){super.showEditor_(e),this.editingInteractively=!0,this.editingVariable=void 0}onFinishEditing_(e){super.onFinishEditing_(e),this.editingInteractively=!1}};m.procedures_mutatorarg={init:function(){let e=new _(t.DEFAULT_ARG$$module$build$src$core$procedures,this.validator_);this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TITLE).appendField(e,"NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_MUTATORARG_TOOLTIP),this.contextMenu=!1},validator_:function(e){var t=this.getSourceBlock(),i=t.workspace.getRootWorkspace();if(!(e=e.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"")))return null;let n=(t.workspace.targetWorkspace||t.workspace).getAllBlocks(!1),o=e.toLowerCase();for(let r=0;r<n.length;r++){if(n[r].id===this.getSourceBlock().id)continue;let e=n[r].getFieldValue("NAME");if(e&&e.toLowerCase()===o)return null}return t.isInFlyout||(t=i.getVariableMap(),(i=t.getVariable(e,""))&&i.getName()!==e&&t.renameVariable(i,e),i||(this.editingInteractively?this.editingVariable?t.renameVariable(this.editingVariable,e):this.editingVariable=t.createVariable(e,""):t.createVariable(e,""))),e}};var E="DISABLED_PROCEDURE_DEFINITION",b={getProcedureCall:function(){return this.getFieldValue("NAME")},renameProcedure:function(e,i){t.Names$$module$build$src$core$names.equals(e,this.getProcedureCall())&&(this.setFieldValue(i,"NAME"),this.setTooltip((this.outputConnection?t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_TOOLTIP:t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",i)))},setProcedureParameters_:function(e,i){var n=t.getDefinition$$module$build$src$core$procedures(this.getProcedureCall(),this.workspace);if((n=(n&&=n.getIcon(t.MutatorIcon$$module$build$src$core$icons$mutator_icon.TYPE))&&n.bubbleIsVisible())?this.setCollapsed(!1):(this.quarkConnections_={},this.quarkIds_=null),e.join("\n")===this.arguments_.join("\n"))this.quarkIds_=i;else{if(i.length!==e.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||=(this.quarkConnections_={},[]);for(let e=0;e<this.arguments_.length;e++){var o=this.getInput("ARG"+e);o&&(o=o.connection.targetConnection,this.quarkConnections_[this.quarkIds_[e]]=o,n&&o&&!i.includes(this.quarkIds_[e])&&(o.disconnect(),o.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(e),this.argumentVarModels_=[],e=0;e<this.arguments_.length;e++)n=t.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,null,this.arguments_[e],""),this.argumentVarModels_.push(n);if(this.updateShape_(),this.quarkIds_=i)for(i=0;i<this.arguments_.length;i++)if((e=this.quarkIds_[i])in this.quarkConnections_){let t;null!=(t=this.quarkConnections_[e])&&t.reconnect(this,"ARG"+i)||delete this.quarkConnections_[e]}}},updateShape_:function(){for(var e=0;e<this.arguments_.length;e++){var i=this.getField("ARGNAME"+e);if(i){t.disable$$module$build$src$core$events$utils();try{i.setValue(this.arguments_[e])}finally{t.enable$$module$build$src$core$events$utils()}}else i=t.fromJson$$module$build$src$core$field_registry({type:"field_label",text:this.arguments_[e]}),this.appendValueInput("ARG"+e).setAlign(t.Align$$module$build$src$core$inputs$align.RIGHT).appendField(i,"ARGNAME"+e)}for(e=this.arguments_.length;this.getInput("ARG"+e);e++)this.removeInput("ARG"+e);(e=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||e.appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&e.removeField("WITH"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("name",this.getProcedureCall());for(let i=0;i<this.arguments_.length;i++){let n=t.createElement$$module$build$src$core$utils$xml("arg");n.setAttribute("name",this.arguments_[i]),e.appendChild(n)}return e},domToMutation:function(e){var t=e.getAttribute("name");this.renameProcedure(this.getProcedureCall(),t),t=[];let i=[];for(let n,o=0;n=e.childNodes[o];o++)"arg"===n.nodeName.toLowerCase()&&(t.push(n.getAttribute("name")),i.push(n.getAttribute("paramId")));this.setProcedureParameters_(t,i)},saveExtraState:function(){let e=Object.create(null);return e.name=this.getProcedureCall(),this.arguments_.length&&(e.params=this.arguments_),e},loadExtraState:function(e){if(this.renameProcedure(this.getProcedureCall(),e.name),e=e.params){let t=[];t.length=e.length,t.fill(null),this.setProcedureParameters_(e,t)}},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.BLOCK_CREATE$$module$build$src$core$events$events&&e.ids.includes(this.id)){var i=this.getProcedureCall(),n=t.getDefinition$$module$build$src$core$procedures(i,this.workspace);if(!n||n.type===this.defType_&&JSON.stringify(n.getVars())===JSON.stringify(this.arguments_)||(n=null),n)n.isEnabled()||(this.setDisabledReason(!0,E),this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)));else{t.setGroup$$module$build$src$core$events$utils(e.group),e=t.createElement$$module$build$src$core$utils$xml("xml"),(i=t.createElement$$module$build$src$core$utils$xml("block")).setAttribute("type",this.defType_);
3var o=(n=this.getRelativeToSurfaceXY()).y+2*t.config$$module$build$src$core$config.snapRadius;i.setAttribute("x",`${n.x+t.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1)}`),i.setAttribute("y",`${o}`),n=this.mutationToDom(),i.appendChild(n),(n=t.createElement$$module$build$src$core$utils$xml("field")).setAttribute("name","NAME"),o=this.getProcedureCall();let r=t.findLegalName$$module$build$src$core$procedures(o,this);o!==r&&this.renameProcedure(o,r),n.appendChild(t.createTextNode$$module$build$src$core$utils$xml(o)),i.appendChild(n),e.appendChild(i),t.domToWorkspace$$module$build$src$core$xml(e,this.workspace),t.setGroup$$module$build$src$core$events$utils(!1)}}else e.type===t.BLOCK_DELETE$$module$build$src$core$events$events?(i=this.getProcedureCall(),t.getDefinition$$module$build$src$core$procedures(i,this.workspace)||(t.setGroup$$module$build$src$core$events$utils(e.group),this.dispose(!0),t.setGroup$$module$build$src$core$events$utils(!1))):e.type===t.BLOCK_CHANGE$$module$build$src$core$events$events&&"disabled"===e.element&&(i=this.getProcedureCall(),(o=t.getDefinition$$module$build$src$core$procedures(i,this.workspace))&&o.id===e.blockId&&(n=t.getGroup$$module$build$src$core$events$utils(),t.setGroup$$module$build$src$core$events$utils(e.group),e=o.isEnabled(),this.setDisabledReason(!e,E),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",i)),t.setGroup$$module$build$src$core$events$utils(n)))},customContextMenu:function(e){if(this.workspace.isMovable()){var i=this.getProcedureCall(),n=this.workspace;e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.PROCEDURES_HIGHLIGHT_DEF,callback:function(){let e=t.getDefinition$$module$build$src$core$procedures(i,n);e&&(n.centerOnBlock(e.id),t.getFocusManager$$module$build$src$core$focus_manager().focusNode(e))}})}}};m.procedures_callnoreturn=Object.assign({},b,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defnoreturn"}),m.procedures_callreturn=Object.assign({},b,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defreturn"});m.procedures_ifreturn={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("value",String(Number(this.hasReturnValue_))),e},domToMutation:function(e){this.hasReturnValue_="1"===e.getAttribute("value"),this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(e){if(!(this.workspace.isDragging&&this.workspace.isDragging()||e.type!==t.BLOCK_MOVE$$module$build$src$core$events$events&&e.type!==t.BLOCK_CREATE$$module$build$src$core$events$events)){e=!1;var i=this;do{if(this.FUNCTION_TYPES.includes(i.type)){e=!0;break}i=i.getSurroundParent()}while(i);if(e?("procedures_defnoreturn"===i.type&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):"procedures_defreturn"!==i.type||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(t.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(t.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_WARNING),!this.isInFlyout)try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"UNPARENTED_IFRETURN")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]},t.defineBlocks$$module$build$src$core$common(m);var O={blocks:m},v=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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_OPE
3RATOR_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.register$$module$build$src$core$extensions("math_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("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.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",{mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i="DIVISIBLE_BY"===this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",String(i)),e},domToMutation:function(e){e="true"===e.getAttribute("divisor_input"),this.updateShape_(e)},updateShape_:function(e){let t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}},function(){this.getField("PROPERTY").setValidator(function(e){e="DIVISIBLE_BY"===e,this.get
3SourceBlock().updateShape_(e)})}),t.register$$module$build$src$core$extensions("math_change_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),t.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",{updateType_:function(e){"MODE"===e?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(e){if(null===(e=e.getAttribute("op")))throw TypeError("xmlElement had no op attribute");this.updateType_(e)}},function(){this.getField("OP").setValidator(function(e){this.updateType_(e)}.bind(this))}),t.defineBlocks$$module$build$src$core$common(v);var I={blocks:v},S=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);t.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",{WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"})),t.register$$module$build$src$core$extensions("controls_flow_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",{BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"})),t.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",{customContextMenu:function(e){if(!this.isInFlyout){var i=this.getField("VAR"),n=i.getVariable().getName();this.isCollapsed()||null===n||(i={type:"variables_get",fields:{VAR:i.saveState(!0)}},e.push({enabled:!0,text:t.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",n),callback:t.callbackFactory$$module$build$src$core$contextmenu(this,i)}))}}}),t.register$$module$build$src$core$extensions("controls_for_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),t.register$$module$build$src$core$extensions("controls_forEach_tooltip",t.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var y=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]);t.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",{getSurroundLoop:function(){let e=this;do{if(y.has(e.type))return e;e=e.getSurroundParent()}while(e);return null},onchange:function(e){let i=this.workspace;if(i.isDragging&&!i.isDragging()&&(e.type===t.BLOCK_MOVE$$module$build$src$core$events$events||e.type===t.BLOCK_CREATE$$module$build$src$core$events$events)&&(e=!!this.getSurroundLoop(),this.setWarningText(e?null:t.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{t.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!e,"CONTROL_FLOW_NOT_IN_LOOP")}finally{t.setRecordUndo$$module$build$src$core$events$utils(!0)}}}),t.defineBlocks$$module$build$src$core$common(S);var R={blocks:S,loopTypes:y},C=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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}",suppressPrefixSuffix:!0,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}",suppressPrefixSuffix:!0,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"]}
3,{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"]},{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.register$$module$build$src$core$extensions("logic_op_tooltip",t.buildTooltipForDropdown$$module$build$src$core$extensions("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.registerMutator$$module$build$src$core$extensions("controls_if_mutator",{elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=t.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&e.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&e.setAttribute("else","1"),e},domToMutation:function(e){this.elseifCount_=parseInt(e.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(e.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;let e=Object.create(null);return this.elseifCount_&&(e.elseIfCount=this.elseifCount_),this.elseCount_&&(e.hasElse=!0),e},loadExtraState:function(e){this.elseifCount_=e.elseIfCount||0,this.elseCount_=+!!e.hasElse,this.updateShape_()},decompose:function(e){let t=e.newBlock("controls_if_if");t.initSvg();let i=t.nextConnection;for(let n=1;n<=this.elseifCount_;n++){let t=e.newBlock("controls_if_elseif");t.initSvg(),i.connect(t.previousConnection),i=t.nextConnection}return this.elseCount_&&((e=e.newBlock("controls_if_else")).initSvg(),i.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;let t=[null],i=[null],n=null;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),i.push(e.statementConnection_);break;case"controls_if_else":this.elseCount_++,n=e.statementConnection_;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(t,i,n)},saveConnections:function(e){e=e.nextConnection.targetBlock();let t=1;for(;e;){if(!e.isInsertionMarker())switch(e.type){case"controls_if_elseif":var i=this.getInput("IF"+t);let n=this.getInput("DO"+t);e.valueConnection_=i&&i.connection.targetConnection,e.statementConnection_=n&&n.connection.targetConnection,t++;break;case"controls_if_else":i=this.getInput("ELSE"),e.statementConnection_=i&&i.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.getNextBlock()}},rebuildShape_:function(){let e=[null],t=[null],i=null;this.getInput("ELSE")&&(i=this.getInput("ELSE").connection.targetConnection);for(let n=1;this.getInput("IF"+n);n++){let i=this.getInput("IF"+n),o=this.getInput("DO"+n);e.push(i.connection.targetConnection),t.push(o.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(e,t,i)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);e++)this.removeInput("IF"+e),this.removeInput("DO"+e);for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(t.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,i){for(let n=1;n<=this.elseifCount_;n++){let i,o;null==(i=e[n])||i.reconnect(this,"IF"+n),null==(o=t[n])||o.reconnect(this,"DO"+n)}i?.reconnect(this,"ELSE")}},null,["controls_if_elseif","controls_if_else"]),t.register$$module$build$src$core$extensions("controls_if_tooltip",function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4:"":t.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1}.bind(this))});var k={onchange:function(e){this.prevBlocks_||=[null,null];var i=this.getInputTargetBlock("A");let n=this.getInputTargetBlock("B");i&&n&&!this.workspace.connectionChecker.doTypeChecks(i.outputConnection,n.outputConnection)&&(t.setGroup$$module$build$src$core$events$utils(e.group),(e=this.prevBlocks_[0])!==i&&(i.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(i=this.prevBlocks_[1])!==n&&(n.unplug(),!i||i.isDisposed()||i.isShadow()||this.getInput("B").connection.connect(i.outputConnection)),this.bumpNeighbours(),t.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}};t.register$$module$build$src$core$extensions("logic_compare",function(){this.mixin(k)}),t.registerMixin$$module$build$src$core$extensions("logic_ternary",{prevParentConnection_:null,onchange:function(e){let i=this.getInputTargetBlock("THEN"),n=this.getInputTargetBlock("ELSE"),o=this.outputConnection.targetConnection;if((i||n)&&o)for(let r=0;r<2;r++){let s=1===r?i:n;s&&!s.workspace.connectionChecker.doTypeChecks(s.outputConnection,o)&&(t.setGroup$$module$build$src$core$events$utils(e.group),o===this.prevParentConnection_?(this.unplug(),o.getSourceBlock().bumpNeighbours()):(s.unplug(),s.bumpNeighbours()),t.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=o}}),t.defineBlocks$$module$build$src$core$common(C);var A={blocks:C},L=t.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{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}"}]);L.lists_create_with={init:function(){this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new t.MutatorIcon$$module$build$src$core$icons$mutator_icon(["lists_create_with_item"],this)),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("items",String(this.itemCount_)),e},domToMutation:function(e){if(!(e=e.getAttribute("items")))throw TypeError("element did not have items");this.itemCount_=parseInt(e,10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(e){this.itemCount_=e.itemCount,this.updateShape_()},decompose:function(e){let t=e.newBlock("lists_create_with_container");t.initSvg();let i=t.getInput("STACK").connection;for(let n=0;n<this.itemCount_;n++){let t=e.newBlock("lists_create_with_item");if(t.initSvg(),!t.previousConnection)throw Error("itemBlock has no previousConnection");i.connect(t.previousConnection),i=t.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)t.isInsertionMarker()||e.push(t.valueConnection_),t=t.getNextBlock();for(t=0;t<this.itemCount_;t++){let i=this.getInput("ADD"+t).connection.targetConnection;i&&!e.includes(i)&&i.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++){let i;null==(i=e[t])||i.reconnect(this,"ADD"+t)}},saveConnections:function(e){e=e.getInputTargetBlock("STACK");let t=0;for(;e;){if(e.isInsertionMarker()){e=e.getNextBlock();continue}let i=this.getInput("ADD"+t);e.valueConnection_=i?.connection.targetConnection,e=e.getNextBlock(),t++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_EMPTY_TITLE);for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){let i=this.appendValueInput("ADD"+e).setAlign(t.Align$$module$build$src$core$input
3s$align.RIGHT);0===e&&i.appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_INPUT_WITH)}for(e=this.itemCount_;this.getInput("ADD"+e);e++)this.removeInput("ADD"+e)}},L.lists_create_with_container={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},L.lists_create_with_item={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},L.lists_indexOf={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_LAST,"LAST"]];if(this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_INPUT_IN_LIST),!(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})))throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(e,"END"),this.setInputsInline(!0),this.setTooltip(()=>t.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}},L.lists_getIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e})).setValidator(function(e){e="REMOVE"===e,this.getSourceBlock().updateStatement_(e)}),this.appendValueInput("VALUE").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!==("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),n="";switch(e+" "+i){case"GET FROM_START":case"GET FROM_END":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":n=t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(n+=" "+("FROM_START"===i?t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),n})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");e.setAttribute("statement",String(!this.outputConnection));let i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$input
3s$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("statement");this.updateStatement_(t),e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(e){e.isStatement?this.updateStatement_(!0):"string"==typeof e&&this.domToMutation(t.textToDom$$module$build$src$core$utils$xml(e))},updateStatement_:function(e){e!==!this.outputConnection&&(this.unplug(!0,!0),e?(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$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},L.lists_setIndex={init:function(){var e=[[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[t.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:e}),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),(e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS})).setValidator(function(e){let t=this.getValue();(e="FROM_START"===e||"FROM_END"===e)!==("FROM_START"===t||"FROM_END"===t)&&this.getSourceBlock().updateAt_(e)}),this.appendDummyInput().appendField(e,"WHERE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{let e=this.getFieldValue("MODE"),i=this.getFieldValue("WHERE"),n="";switch(e+" "+i){case"SET FROM_START":case"SET FROM_END":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":n=t.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return("FROM_START"===i||"FROM_END"===i)&&(n+=" "+t.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),n})},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation"),i=this.getInput("AT")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at",String(i)),e},domToMutation:function(e){e="false"!==e.getAttribute("at"),this.updateAt_(e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}},L.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);let e=e=>{let i=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+e]});return i.setValidator(function(t){let i=this.getValue();(t="FROM_START"===t||"FROM_END"===t)!==("FROM_START"===i||"FROM_END"===i)&&this.get
3SourceBlock().updateAt_(e,t)}),i};this.appendDummyInput("WHERE1_INPUT").appendField(e(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(e(2),"WHERE2"),this.appendDummyInput("AT2"),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");var i=this.getInput("AT1")instanceof t.ValueInput$$module$build$src$core$inputs$value_input;return e.setAttribute("at1",String(i)),i=this.getInput("AT2")instanceof t.ValueInput$$module$build$src$core$inputs$value_input,e.setAttribute("at2",String(i)),e},domToMutation:function(e){let t="true"===e.getAttribute("at1");e="true"===e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(e,i){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),i?(this.appendValueInput("AT"+e).setCheck("Number"),t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(t.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e),1===e&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT")),t.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},L.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},L.lists_split={init:function(){let e=t.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!e)throw Error("field_dropdown not found");e.setValidator(e=>{this.updateType_(e)}),this.setHelpUrl(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(e,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(t.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{let e=this.getFieldValue("MODE");if("SPLIT"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"===e)return t.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+e)})},updateType_:function(e){if(this.getFieldValue("MODE")!==e){let e=this.getInput("INPUT").connection;e.setShadowDom(null);let t=e.targetBlock();t&&(e.disconnect(),t.isShadow()?t.dispose(!1):this.bumpNeighbours())}"SPLIT"===e?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){let e=t.createElement$$module$build$src$core$utils$xml("mutation");return e.setAttribute("mode",this.getFieldValue("MODE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("mode"))},saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(e){this.updateType_(e.mode)}},t.defineBlocks$$module$build$src$core$common(L);var N={blocks:L},w={blocks:Object.assign({},L,C,S,v,m,d,a,i),lists:N,logic:A,loops:R,math:I,procedures:O,texts:g,variables:h,variablesDynamic:s};return w.__namespace__=t,w})}),YL=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["blockly/core","blockly/msg/en","blockly/blocks"],n):"object"==typeof e?t.exports=n(XL(),zL(),jL()):i.Blockly=n(i.Blockly,i.Blockly.Msg,i.Blockly.Blocks)}(e,function(e,t,i){return e.setLocale(t),e})}),QL=l({Block:()=>UC,BlockFlyoutInflater:()=>HC,BlockNavigationPolicy:()=>VC,BlockSvg:()=>GC,Blocks:()=>WC,ButtonFlyoutInflater:()=>XC,COLLAPSED_FIELD_NAME:()=>zC,COLLAPSED_INPUT_NAME:()=>jC,COLLAPSE_CHARS:()=>YC,CodeGenerator:()=>QC,CollapsibleToolboxCategory:()=>KC,ComponentManager:()=>qC,Connection:()=>JC,ConnectionChecker:()=>ZC,ConnectionDB:()=>ek,ConnectionNavigationPolicy:()=>tk,ConnectionType:()=>ik,ContextMenu:()=>nk,ContextMenuItems:()=>ok,ContextMenuRegistry:()=>rk,Css:()=>sk,DELETE_VARIABLE_ID:()=>ak,DeleteArea:()=>lk,DragTarget:()=>ck,DropDownDiv:()=>uk,Events:()=>hk,Extensions:()=>dk,Field:()=>pk,FieldCheckbox:()=>fk,FieldDropdown:()=>gk,FieldImage:()=>mk,FieldLabel:()=>Tk,FieldLabelSerializable:()=>_k,FieldNavigationPolicy:()=>Ek,FieldNumber:()=>bk,FieldTextInput:()=>Ok,FieldVariable:()=>vk,Flyout:()=>Ik,FlyoutButton:()=>Sk,FlyoutButtonNavigationPolicy:()=>yk,FlyoutItem:()=>Rk,FlyoutMetricsManager:()=>Ck,FlyoutNavigationPolicy:()=>kk,FlyoutNavigator:()=>Ak,FlyoutSeparator:()=>Lk,FlyoutSeparatorNavigationPolicy:()=>Nk,FocusManager:()=>wk,FocusableTreeTraverser:()=>$k,Generator:()=>Mk,Gesture:()=>xk,Grid:()=>Dk,HorizontalFlyout:()=>Pk,INPUT_VALUE:()=>Fk,Input:()=>Bk,InsertionMarkerPreviewer:()=>Uk,KeyboardNavigationController:()=>Hk,LabelFlyoutInflater:()=>Vk,LineCursor:()=>Gk,Marker:()=>Wk,MarkerManager:()=>Xk,Menu:()=>zk,MenuItem:()=>jk,MetricsManager:()=>Yk,Msg:()=>Qk,NEXT_STATEMENT:()=>Kk,Names:()=>qk,Navigator:()=>Jk,OPPOSITE_TYPE:()=>Zk,OUTPUT_VALUE:()=>eA,Options:()=>tA,PREVIOUS_STATEMENT:()=>iA,PROCEDURE_CATEGORY_NAME:()=>nA,Procedures:()=>oA,RENAME_VARIABLE_ID:()=>rA,RenderedConnection:()=>sA,Scrollbar:()=>aA,ScrollbarPair:()=>lA,SeparatorFlyoutInflater:()=>cA,ShortcutItems:()=>uA,ShortcutRegistry:()=>hA,TOOLBOX_AT_BOTTOM:()=>dA,TOOLBOX_AT_LEFT:()=>pA,TOOLBOX_AT_RIGHT:()=>fA,TOOLBOX_AT_TOP:()=>gA,Theme:()=>mA,ThemeManager:()=>TA,Themes:()=>_A,Toast:()=>EA,Toolbox:()=>bA,ToolboxCategory:()=>OA,ToolboxItem:()=>vA,ToolboxSeparator:()=>IA,Tooltip:()=>SA,Touch:()=>yA,Trashcan:()=>RA,UnattachedFieldError:()=>CA,VARIABLE_CATEGORY_NAME:()=>kA,VARIABLE_DYNAMIC_CATEGORY_NAME:()=>AA,VERSION:()=>LA,VariableMap:()=>NA,VariableModel:()=>wA,Variables:()=>$A,VariablesDynamic:()=>MA,VerticalFlyout:()=>xA,WidgetDiv:()=>DA,Workspace:()=>PA,WorkspaceAudio:()=>FA,WorkspaceDragger:()=>BA,WorkspaceNavigationPolicy:()=>UA,WorkspaceSvg:()=>HA,Xml:()=>VA,ZoomControls:()=>GA,blockAnimations:()=>WA,blockRendering:()=>XA,browserEvents:()=>zA,bubbles:()=>jA,bumpObjects:()=>YA,clipboard:()=>QA,comments:()=>KA,common:()=>qA,config:()=>JA,constants:()=>ZA,defineBlocksWithJsonArray:()=>eL,dialog:()=>tL,dragging:()=>iL,fieldRegistry:()=>nL,geras:()=>oL,getFocusManager:()=>rL,getMainWorkspace:()=>sL,getSelected:()=>aL,hasBubble:()=>lL,hideChaff:()=>cL,icons:()=>uL,inject:()=>hL,inputs:()=>dL,isCopyable:()=>pL,isDeletable:()=>fL,isDraggable:()=>gL,isIcon:()=>mL,isObservable:()=>TL,isPaster:()=>_L,isRenderedElement:()=>EL,isSelectable:()=>bL,isSerializable:()=>OL,isVariableBackedParameterModel:()=>vL,keyboardNavigationController:()=>IL,layers:()=>SL,navigateBlock:()=>yL,navigateStacks:()=>RL,procedures:()=>CL,registry:()=>kL,renderManagement:()=>AL,serialization:()=>LL,setLocale:()=>NL,setParentContainer:()=>wL,svgResize:()=>$L,thrasos:()=>ML,uiPosition:()=>xL,utils:()=>DL,zelos:()=>PL}),KL=s(()=>{BC=u(YL(),1),({Block:UC,BlockFlyoutInflater:HC,BlockNavigationPolicy:VC,BlockSvg:GC,Blocks:WC,ButtonFlyoutInflater:XC,COLLAPSED_FIELD_NAME:zC,
3COLLAPSED_INPUT_NAME:jC,COLLAPSE_CHARS:YC,CodeGenerator:QC,CollapsibleToolboxCategory:KC,ComponentManager:qC,Connection:JC,ConnectionChecker:ZC,ConnectionDB:ek,ConnectionNavigationPolicy:tk,ConnectionType:ik,ContextMenu:nk,ContextMenuItems:ok,ContextMenuRegistry:rk,Css:sk,DELETE_VARIABLE_ID:ak,DeleteArea:lk,DragTarget:ck,DropDownDiv:uk,Events:hk,Extensions:dk,Field:pk,FieldCheckbox:fk,FieldDropdown:gk,FieldImage:mk,FieldLabel:Tk,FieldLabelSerializable:_k,FieldNavigationPolicy:Ek,FieldNumber:bk,FieldTextInput:Ok,FieldVariable:vk,Flyout:Ik,FlyoutButton:Sk,FlyoutButtonNavigationPolicy:yk,FlyoutItem:Rk,FlyoutMetricsManager:Ck,FlyoutNavigationPolicy:kk,FlyoutNavigator:Ak,FlyoutSeparator:Lk,FlyoutSeparatorNavigationPolicy:Nk,FocusManager:wk,FocusableTreeTraverser:$k,Generator:Mk,Gesture:xk,Grid:Dk,HorizontalFlyout:Pk,INPUT_VALUE:Fk,Input:Bk,InsertionMarkerPreviewer:Uk,KeyboardNavigationController:Hk,LabelFlyoutInflater:Vk,LineCursor:Gk,Marker:Wk,MarkerManager:Xk,Menu:zk,MenuItem:jk,MetricsManager:Yk,Msg:Qk,NEXT_STATEMENT:Kk,Names:qk,Navigator:Jk,OPPOSITE_TYPE:Zk,OUTPUT_VALUE:eA,Options:tA,PREVIOUS_STATEMENT:iA,PROCEDURE_CATEGORY_NAME:nA,Procedures:oA,RENAME_VARIABLE_ID:rA,RenderedConnection:sA,Scrollbar:aA,ScrollbarPair:lA,SeparatorFlyoutInflater:cA,ShortcutItems:uA,ShortcutRegistry:hA,TOOLBOX_AT_BOTTOM:dA,TOOLBOX_AT_LEFT:pA,TOOLBOX_AT_RIGHT:fA,TOOLBOX_AT_TOP:gA,Theme:mA,ThemeManager:TA,Themes:_A,Toast:EA,Toolbox:bA,ToolboxCategory:OA,ToolboxItem:vA,ToolboxSeparator:IA,Tooltip:SA,Touch:yA,Trashcan:RA,UnattachedFieldError:CA,VARIABLE_CATEGORY_NAME:kA,VARIABLE_DYNAMIC_CATEGORY_NAME:AA,VERSION:LA,VariableMap:NA,VariableModel:wA,Variables:$A,VariablesDynamic:MA,VerticalFlyout:xA,WidgetDiv:DA,Workspace:PA,WorkspaceAudio:FA,WorkspaceDragger:BA,WorkspaceNavigationPolicy:UA,WorkspaceSvg:HA,Xml:VA,ZoomControls:GA,blockAnimations:WA,blockRendering:XA,browserEvents:zA,bubbles:jA,bumpObjects:YA,clipboard:QA,comments:KA,common:qA,config:JA,constants:ZA,defineBlocksWithJsonArray:eL,dialog:tL,dragging:iL,fieldRegistry:nL,geras:oL,getFocusManager:rL,getMainWorkspace:sL,getSelected:aL,hasBubble:lL,hideChaff:cL,icons:uL,inject:hL,inputs:dL,isCopyable:pL,isDeletable:fL,isDraggable:gL,isIcon:mL,isObservable:TL,isPaster:_L,isRenderedElement:EL,isSelectable:bL,isSerializable:OL,isVariableBackedParameterModel:vL,keyboardNavigationController:IL,layers:SL,navigateBlock:yL,navigateStacks:RL,procedures:CL,registry:kL,renderManagement:AL,serialization:LL,setLocale:NL,setParentContainer:wL,svgResize:$L,thrasos:ML,uiPosition:xL,utils:DL,zelos:PL}=BC.default)}),qL=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):(i.python=n(i.Blockly),i.Blockly.Python=i.python.pythonGenerator)}(e,function(e){var t,i=e.__namespace__,n=function(e,i){let n,o,r=0,s="";i.STATEMENT_PREFIX&&(s+=i.injectId(i.STATEMENT_PREFIX,e));do{o=i.valueToCode(e,"IF"+r,t.NONE)||"False",n=i.statementToCode(e,"DO"+r)||i.PASS,i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+=(0===r?"if ":"elif ")+o+":\n"+n,r++}while(e.getInput("IF"+r));return(e.getInput("ELSE")||i.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")&&i.statementToCode(e,"ELSE")||i.PASS,i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+="else:\n"+n),s},o=function(e,n){let o;o=e.getField("TIMES")?String(parseInt(e.getFieldValue("TIMES"),10)):n.valueToCode(e,"TIMES",t.NONE)||"0",o=i.isNumber$$module$build$src$core$utils$string(o)?parseInt(o,10):"int("+o+")";let r=n.statementToCode(e,"DO");return r=n.addLoopTrap(r,e)||n.PASS,"for "+n.nameDB_.getDistinctName("count",i.NameType$$module$build$src$core$names.VARIABLE)+" in range("+o+"):\n"+r},r=function(e,i){let n,o=e.getFieldValue("OP");if("NEG"===o)return n=i.valueToCode(e,"NUM",t.UNARY_SIGN)||"0",["-"+n,t.UNARY_SIGN];switch(i.definitions_.import_math="import math",e="SIN"===o||"COS"===o||"TAN"===o?i.valueToCode(e,"NUM",t.MULTIPLICATIVE)||"0":i.valueToCode(e,"NUM",t.NONE)||"0",o){case"ABS":n="math.fabs("+e+")";break;case"ROOT":n="math.sqrt("+e+")";break;case"LN":n="math.log("+e+")";break;case"LOG10":n="math.log10("+e+")";break;case"EXP":n="math.exp("+e+")";break;case"POW10":n="math.pow(10,"+e+")";break;case"ROUND":n="round("+e+")";break;case"ROUNDUP":n="math.ceil("+e+")";break;case"ROUNDDOWN":n="math.floor("+e+")";break;case"SIN":n="math.sin("+e+" / 180.0 * math.pi)";break;case"COS":n="math.cos("+e+" / 180.0 * math.pi)";break;case"TAN":n="math.tan("+e+" / 180.0 * math.pi)"}if(n)return[n,t.FUNCTION_CALL];switch(o){case"ASIN":n="math.asin("+e+") / math.pi * 180";break;case"ACOS":n="math.acos("+e+") / math.pi * 180";break;case"ATAN":n="math.atan("+e+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+o)}return[n,t.MULTIPLICATIVE]},s=function(e,n){var o=[],r=e.workspace,s=i.allUsedVarModels$$module$build$src$core$variables(r)||[];for(var a of s)s=a.getName(),e.getVars().includes(s)||o.push(n.getVariableName(s));for(r=i.allDeveloperVariables$$module$build$src$core$variables(r),a=0;a<r.length;a++)o.push(n.nameDB_.getName(r[a],i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));r=o.length?n.INDENT+"global "+o.join(", ")+"\n":"",o=n.getProcedureName(e.getFieldValue("NAME")),a="",n.STATEMENT_PREFIX&&(a+=n.injectId(n.STATEMENT_PREFIX,e)),n.STATEMENT_SUFFIX&&(a+=n.injectId(n.STATEMENT_SUFFIX,e)),a&&=n.prefixLines(a,n.INDENT),s="",n.INFINITE_LOOP_TRAP&&(s=n.prefixLines(n.injectId(n.INFINITE_LOOP_TRAP,e),n.INDENT));let l="";e.getInput("STACK")&&(l=n.statementToCode(e,"STACK"));let c="";e.getInput("RETURN")&&(c=n.valueToCode(e,"RETURN",t.NONE)||"");let u="";l&&c&&(u=a),c?c=n.INDENT+"return "+c+"\n":l||=n.PASS;let h=[],d=e.getVars();for(let t=0;t<d.length;t++)h[t]=n.getVariableName(d[t]);return r="def "+o+"("+h.join(", ")+"):\n"+r+a+s+l+u+c,r=n.scrub_(e,r),n.definitions_["%"+o]=r,null},a=function(e,i){var n=i.provideFunction_("text_prompt",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(msg):\n try:\n return raw_input(msg)\n except NameError:\n return input(msg)\n`);return n=n+"("+(i=e.getField("TEXT")?i.quote_(e.getFieldValue("TEXT")):i.valueToCode(e,"TEXT",t.NONE)||"''")+")","NUMBER"===e.getFieldValue("TYPE")&&(n="float("+n+")"),[n,t.FUNCTION_CALL]},l=function(e,i){return[i.getVariableName(e.getFieldValue("VAR")),t.ATOMIC]},c=function(e,i){let n=i.valueToCode(e,"VALUE",t.NONE)||"0";return i.getVariableName(e.getFieldValue("VAR"))+" = "+n+"\n"};!function(e){e[e.ATOMIC=0]="ATOMIC",e[e.COLLECTION=1]="COLLECTION",e[e.STRING_CONVERSION=1]="STRING_CONVERSION",e[e.MEMBER=2.1]="MEMBER",e[e.FUNCTION_CALL=2.2]="FUNCTION_CALL",e[e.EXPONENTIATION=3]="EXPONENTIATION",e[e.UNARY_SIGN=4]="UNARY_SIGN",e[e.BITWISE_NOT=4]="BITWISE_NOT",e[e.MULTIPLICATIVE=5]="MULTIPLICATIVE",e[e.ADDITIVE=6]="ADDITIVE",e[e.BITWISE_SHIFT=7]="BITWISE_SHIFT",e[e.BITWISE_AND=8]="BITWISE_AND",e[e.BITWISE_XOR=9]="BITWISE_XOR",e[e.BITWISE_OR=10]="BITWISE_OR",e[e.RELATIONAL=11]="RELATIONAL",e[e.LOGICAL_NOT=12]="LOGICAL_NOT",e[e.LOGICAL_AND=13]="LOGICAL_AND",e[e.LOGICAL_OR=14]="LOGICAL_OR",e[e.CONDITIONAL=15]="CONDITIONAL",e[e.LAMBDA=16]="LAMBDA",e[e.NONE=99]="NONE"}(t||={});var u=class extends i.CodeGenerator$$module$build$src$core$generator{constructor(e="P
3ython"){super(e),this.ORDER_OVERRIDES=[[t.FUNCTION_CALL,t.MEMBER],[t.FUNCTION_CALL,t.FUNCTION_CALL],[t.MEMBER,t.MEMBER],[t.MEMBER,t.FUNCTION_CALL],[t.LOGICAL_NOT,t.LOGICAL_NOT],[t.LOGICAL_AND,t.LOGICAL_AND],[t.LOGICAL_OR,t.LOGICAL_OR]],this.PASS="",this.isInitialized=!1;for(let i in t)"string"!=typeof(e=t[i])&&(this["ORDER_"+i]=e);this.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip")}init(e){super.init(e),this.PASS=this.INDENT+"pass\n",this.nameDB_?this.nameDB_.reset():this.nameDB_=new i.Names$$module$build$src$core$names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);let t=[];var n=i.allDeveloperVariables$$module$build$src$core$variables(e);for(let o=0;o<n.length;o++)t.push(this.nameDB_.getName(n[o],i.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE)+" = None");for(e=i.allUsedVarModels$$module$build$src$core$variables(e),n=0;n<e.length;n++)t.push(this.getVariableName(e[n].getId())+" = None");this.definitions_.variables=t.join("\n"),this.isInitialized=!0}finish(e){let t=[],i=[];for(let n in this.definitions_){let e=this.definitions_[n];e.match(/^(from\s+\S+\s+)?import\s+\S+/)?t.push(e):i.push(e)}return e=super.finish(e),this.isInitialized=!1,this.nameDB_.reset(),(t.join("\n")+"\n\n"+i.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+e}scrubNakedValue(e){return e+"\n"}quote_(e){let t="'";return(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n")).includes("'")&&(e.includes('"')?e=e.replace(/'/g,"\\'"):t='"'),t+e+t}multiline_quote_(e){return e.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(e,t,n=!1){let o="";if(!e.outputConnection||!e.outputConnection.targetConnection){var r=e.getCommentText();r&&(r=i.wrap$$module$build$src$core$utils$string(r,this.COMMENT_WRAP-3),o+=this.prefixLines(r+"\n","# "));for(let t=0;t<e.inputList.length;t++)e.inputList[t].type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(r=e.inputList[t].connection.targetBlock())&&(r=this.allNestedComments(r))&&(o+=this.prefixLines(r,"# "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),o+t+(n=n?"":this.blockToCode(e))}getAdjustedInt(e,n,o=0,r=!1){e.workspace.options.oneBasedIndex&&o--;let s=e.workspace.options.oneBasedIndex?"1":"0";return e=this.valueToCode(e,n,o?t.ADDITIVE:t.NONE)||s,i.isNumber$$module$build$src$core$utils$string(e)?(e=parseInt(e,10)+o,r&&(e=-e)):(e=o>0?"int("+e+" + "+o+")":o<0?"int("+e+" - "+-o+")":"int("+e+")",r&&(e="-"+e)),e}},h={};h.Order=t,h.PythonGenerator=u;var d={lists_create_empty:function(e,i){return["[]",t.ATOMIC]},lists_create_with:function(e,i){let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"None";return["["+n.join(", ")+"]",t.ATOMIC]},lists_getIndex:function(e,i){let n=e.getFieldValue("MODE")||"GET",o=e.getFieldValue("WHERE")||"FROM_START";var r=i.valueToCode(e,"VALUE","RANDOM"===o?t.NONE:t.MEMBER)||"[]";switch(o){case"FIRST":if("GET"===n)return[r+"[0]",t.MEMBER];if("GET_REMOVE"===n)return[r+".pop(0)",t.FUNCTION_CALL];if("REMOVE"===n)return r+".pop(0)\n";break;case"LAST":if("GET"===n)return[r+"[-1]",t.MEMBER];if("GET_REMOVE"===n)return[r+".pop()",t.FUNCTION_CALL];if("REMOVE"===n)return r+".pop()\n";break;case"FROM_START":if(e=i.getAdjustedInt(e,"AT"),"GET"===n)return[r+"["+e+"]",t.MEMBER];if("GET_REMOVE"===n)return[r+".pop("+e+")",t.FUNCTION_CALL];if("REMOVE"===n)return r+".pop("+e+")\n";break;case"FROM_END":if(e=i.getAdjustedInt(e,"AT",1,!0),"GET"===n)return[r+"["+e+"]",t.MEMBER];if("GET_REMOVE"===n)return[r+".pop("+e+")",t.FUNCTION_CALL];if("REMOVE"===n)return r+".pop("+e+")\n";break;case"RANDOM":if(i.definitions_.import_random="import random","GET"===n)return["random.choice("+r+")",t.FUNCTION_CALL];if(r=i.provideFunction_("lists_remove_random_item",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(myList):\n x = int(random.random() * len(myList))\n return myList.pop(x)\n`)+"("+r+")","GET_REMOVE"===n)return[r,t.FUNCTION_CALL];if("REMOVE"===n)return r+"\n"}throw Error("Unhandled combination (lists_getIndex).")},lists_getSublist:function(e,n){let o=n.valueToCode(e,"LIST",t.MEMBER)||"[]";var r=e.getFieldValue("WHERE1");let s=e.getFieldValue("WHERE2");switch(r){case"FROM_START":0===(r=n.getAdjustedInt(e,"AT1"))&&(r="");break;case"FROM_END":r=n.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":r="";break;default:throw Error("Unhandled option (lists_getSublist)")}switch(s){case"FROM_START":e=n.getAdjustedInt(e,"AT2",1);break;case"FROM_END":e=n.getAdjustedInt(e,"AT2",0,!0),i.isNumber$$module$build$src$core$utils$string(String(e))?0===e&&(e=""):(n.definitions_.import_sys="import sys",e+=" or sys.maxsize");break;case"LAST":e="";break;default:throw Error("Unhandled option (lists_getSublist)")}return[o+"["+r+" : "+e+"]",t.MEMBER]},lists_indexOf:function(e,i){let n=i.valueToCode(e,"FIND",t.NONE)||"[]",o=i.valueToCode(e,"VALUE",t.NONE)||"''",r=" -1",s="",a=" - 1";return e.workspace.options.oneBasedIndex&&(r=" 0",s=" + 1",a=""),[("FIRST"===e.getFieldValue("END")?i.provideFunction_("first_index",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(my_list, elem):\n try: index = my_list.index(elem)${s}\n except: index =${r}\n return index\n`):i.provideFunction_("last_index",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(my_list, elem):\n try: index = len(my_list) - my_list[::-1].index(elem)${a}\n except: index =${r}\n return index\n`))+"("+o+", "+n+")",t.FUNCTION_CALL]},lists_isEmpty:function(e,i){return["not len("+(i.valueToCode(e,"VALUE",t.NONE)||"[]")+")",t.LOGICAL_NOT]},lists_length:function(e,i){return["len("+(i.valueToCode(e,"VALUE",t.NONE)||"[]")+")",t.FUNCTION_CALL]},lists_repeat:function(e,i){return["["+(i.valueToCode(e,"ITEM",t.NONE)||"None")+"] * "+(e=i.valueToCode(e,"NUM",t.MULTIPLICATIVE)||"0"),t.MULTIPLICATIVE]},lists_reverse:function(e,i){return["list(reversed("+(i.valueToCode(e,"LIST",t.NONE)||"[]")+"))",t.FUNCTION_CALL]},lists_setIndex:function(e,n){let o=n.valueToCode(e,"LIST",t.MEMBER)||"[]",r=e.getFieldValue("MODE")||"GET";var s=e.getFieldValue("WHERE")||"FROM_START";let a=n.valueToCode(e,"TO",t.NONE)||"None";switch(s){case"FIRST":if("SET"===r)return o+"[0] = "+a+"\n";if("INSERT"===r)return o+".insert(0, "+a+")\n";break;case"LAST":if("SET"===r)return o+"[-1] = "+a+"\n";if("INSERT"===r)return o+".append("+a+")\n";break;case"FROM_START":if(n=n.getAdjustedInt(e,"AT"),"SET"===r)return o+"["+n+"] = "+a+"\n";if("INSERT"===r)return o+".insert("+n+", "+a+")\n";break;case"FROM_END":if(n=n.getAdjustedInt(e,"AT",1,!0),"SET"===r)return o+"["+n+"] = "+a+"\n";if("INSERT"===r)return o+".insert("+n+", "+a+")\n";break;case"RANDOM":if(n.definitions_.import_random="import random",o.match(/^\w+$/)?e="":(s=(e=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+o+"\n",o=e,e=s),e+=(n=n.nameDB_.getDistinctName("tmp_x",i.NameType$$module$build$src$core$names.VARIABLE))+" = int(random.random() * len("+o+"))\n","SET"===r)return e+(o+"[")+n+"] = "+a+"\n";if("INSERT"===r)return e+(o+".insert(")+n+", "+a+")\n"}throw Error("Unhandled combination (lists_setIndex).")},lists_sort:function(e,i){let n=i.valueToCode(e,"LIST",t.NONE)||"[]",o=e.getFieldValue("TYPE");return e="1"===e.getFieldValue("DIRECTION")?"False":"True",[i.provideFunction_("lists_sort",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(my_list, type, reverse):\n def try_float(s):\n try:\n return float(s)\n except:\n return 0\n key_funcs
3= {\n "NUMERIC": try_float,\n "TEXT": str,\n "IGNORE_CASE": lambda s: str(s).lower()\n }\n key_func = key_funcs[type]\n list_cpy = list(my_list)\n return sorted(list_cpy, key=key_func, reverse=reverse)\n`)+"("+n+', "'+o+'", '+e+")",t.FUNCTION_CALL]},lists_split:function(e,i){var n=e.getFieldValue("MODE");if("SPLIT"===n)e=(n=i.valueToCode(e,"INPUT",t.MEMBER)||"''")+".split("+(e=i.valueToCode(e,"DELIM",t.NONE))+")";else{if("JOIN"!==n)throw Error("Unknown mode: "+n);n=i.valueToCode(e,"INPUT",t.NONE)||"[]",e=(i.valueToCode(e,"DELIM",t.MEMBER)||"''")+".join("+n+")"}return[e,t.FUNCTION_CALL]}},p={};p.controls_if=n,p.controls_ifelse=n,p.logic_boolean=function(e,i){return["TRUE"===e.getFieldValue("BOOL")?"True":"False",t.ATOMIC]},p.logic_compare=function(e,i){let n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],o=t.RELATIONAL;return[(i.valueToCode(e,"A",o)||"0")+" "+n+" "+(e=i.valueToCode(e,"B",o)||"0"),o]},p.logic_negate=function(e,i){return["not "+(i.valueToCode(e,"BOOL",t.LOGICAL_NOT)||"True"),t.LOGICAL_NOT]},p.logic_null=function(e,i){return["None",t.ATOMIC]},p.logic_operation=function(e,i){let n="AND"===e.getFieldValue("OP")?"and":"or",o="and"===n?t.LOGICAL_AND:t.LOGICAL_OR,r=i.valueToCode(e,"A",o);return e=i.valueToCode(e,"B",o),r||e?(i="and"===n?"True":"False",r||=i,e||=i):e=r="False",[r+" "+n+" "+e,o]},p.logic_ternary=function(e,i){let n=i.valueToCode(e,"IF",t.CONDITIONAL)||"False";return[(i.valueToCode(e,"THEN",t.CONDITIONAL)||"None")+" if "+n+" else "+(e=i.valueToCode(e,"ELSE",t.CONDITIONAL)||"None"),t.CONDITIONAL]};var f={controls_flow_statements:function(e,t){let i="";if(t.STATEMENT_PREFIX&&(i+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(i+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){let n=e.getSurroundLoop();n&&!n.suppressPrefixSuffix&&(i+=t.injectId(t.STATEMENT_PREFIX,n))}switch(e.getFieldValue("FLOW")){case"BREAK":return i+"break\n";case"CONTINUE":return i+"continue\n"}throw Error("Unknown flow statement.")},controls_for:function(e,n){let o=n.getVariableName(e.getFieldValue("VAR"));var r=n.valueToCode(e,"FROM",t.NONE)||"0",s=n.valueToCode(e,"TO",t.NONE)||"0",a=n.valueToCode(e,"BY",t.NONE)||"1";let l=n.statementToCode(e,"DO");l=n.addLoopTrap(l,e)||n.PASS;let c="";e=function(){return n.provideFunction_("upRange",`\ndef ${n.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):\n while start <= stop:\n yield start\n start += abs(step)\n`)};let u=function(){return n.provideFunction_("downRange",`\ndef ${n.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):\n while start >= stop:\n yield start\n start -= abs(step)\n`)};if(i.isNumber$$module$build$src$core$utils$string(r)&&i.isNumber$$module$build$src$core$utils$string(s)&&i.isNumber$$module$build$src$core$utils$string(a))r=Number(r),s=Number(s),a=Math.abs(Number(a)),r%1==0&&s%1==0&&a%1==0?(r<=s?(s++,e=0===r&&1===a?s:r+", "+s,1!==a&&(e+=", "+a)):e=r+", "+--s+", -"+a,e="range("+e+")"):(e=r<s?e():u(),e+="("+r+", "+s+", "+a+")");else{let t=function(e,t){return i.isNumber$$module$build$src$core$utils$string(e)?e=String(Number(e)):e.match(/^\w+$/)||(t=n.nameDB_.getDistinctName(o+t,i.NameType$$module$build$src$core$names.VARIABLE),c+=t+" = "+e+"\n",e=t),e};r=t(r,"_start"),s=t(s,"_end"),a=t(a,"_inc"),"number"==typeof r&&"number"==typeof s?(e=r<s?e():u(),e+="("+r+", "+s+", "+a+")"):e="("+r+" <= "+s+") and "+e()+"("+r+", "+s+", "+a+") or "+u()+"("+r+", "+s+", "+a+")"}return c+="for "+o+" in "+e+":\n"+l},controls_forEach:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR")),o=i.valueToCode(e,"LIST",t.RELATIONAL)||"[]",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e)||i.PASS,"for "+n+" in "+o+":\n"+r}};f.controls_repeat=o,f.controls_repeat_ext=o,f.controls_whileUntil=function(e,i){let n="UNTIL"===e.getFieldValue("MODE"),o=i.valueToCode(e,"BOOL",n?t.LOGICAL_NOT:t.NONE)||"False",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e)||i.PASS,n&&(o="not "+o),"while "+o+":\n"+r};var g={math_arithmetic:function(e,i){var n={ADD:[" + ",t.ADDITIVE],MINUS:[" - ",t.ADDITIVE],MULTIPLY:[" * ",t.MULTIPLICATIVE],DIVIDE:[" / ",t.MULTIPLICATIVE],POWER:[" ** ",t.EXPONENTIATION]}[e.getFieldValue("OP")];let o=n[0];return n=n[1],[(i.valueToCode(e,"A",n)||"0")+o+(e=i.valueToCode(e,"B",n)||"0"),n]},math_atan2:function(e,i){i.definitions_.import_math="import math";let n=i.valueToCode(e,"X",t.NONE)||"0";return["math.atan2("+(i.valueToCode(e,"Y",t.NONE)||"0")+", "+n+") / math.pi * 180",t.MULTIPLICATIVE]},math_change:function(e,i){i.definitions_.from_numbers_import_Number="from numbers import Number";let n=i.valueToCode(e,"DELTA",t.ADDITIVE)||"0";return(e=i.getVariableName(e.getFieldValue("VAR")))+" = ("+e+" if isinstance("+e+", Number) else 0) + "+n+"\n"},math_constant:function(e,i){let n={PI:["math.pi",t.MEMBER],E:["math.e",t.MEMBER],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",t.MULTIPLICATIVE],SQRT2:["math.sqrt(2)",t.MEMBER],SQRT1_2:["math.sqrt(1.0 / 2)",t.MEMBER],INFINITY:["float('inf')",t.ATOMIC]};return"INFINITY"!==(e=e.getFieldValue("CONSTANT"))&&(i.definitions_.import_math="import math"),n[e]},math_constrain:function(e,i){return["min(max("+(i.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(i.valueToCode(e,"LOW",t.NONE)||"0")+"), "+(e=i.valueToCode(e,"HIGH",t.NONE)||"float('inf')")+")",t.FUNCTION_CALL]},math_modulo:function(e,i){return[(i.valueToCode(e,"DIVIDEND",t.MULTIPLICATIVE)||"0")+" % "+(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"),t.MULTIPLICATIVE]},math_number:function(e,i){return(e=Number(e.getFieldValue("NUM")))===1/0?['float("inf")',t.FUNCTION_CALL]:e===-1/0?['-float("inf")',t.UNARY_SIGN]:[String(e),e<0?t.UNARY_SIGN:t.ATOMIC]},math_number_property:function(e,i){var n={EVEN:[" % 2 == 0",t.MULTIPLICATIVE,t.RELATIONAL],ODD:[" % 2 == 1",t.MULTIPLICATIVE,t.RELATIONAL],WHOLE:[" % 1 == 0",t.MULTIPLICATIVE,t.RELATIONAL],POSITIVE:[" > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[" < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,t.MULTIPLICATIVE,t.RELATIONAL],PRIME:[null,t.NONE,t.FUNCTION_CALL]};let o=e.getFieldValue("PROPERTY"),[r,s,a]=n[o];if(n=i.valueToCode(e,"NUMBER_TO_CHECK",s)||"0","PRIME"===o)i.definitions_.import_math="import math",i.definitions_.from_numbers_import_Number="from numbers import Number",e=i.provideFunction_("math_isPrime",`\n
3def ${i.FUNCTION_NAME_PLACEHOLDER_}(n):\n # https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n # If n is not a number but a string, try parsing it.\n if not isinstance(n, Number):\n try:\n n = float(n)\n except:\n return False\n if n == 2 or n == 3:\n return True\n # False if n is negative, is 1, or not whole, or if n is divisible by 2 or 3.\n if n <= 1 or n % 1 != 0 or n % 2 == 0 or n % 3 == 0:\n return False\n # Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for x in range(6, int(math.sqrt(n)) + 2, 6):\n if n % (x - 1) == 0 or n % (x + 1) == 0:\n return False\n return True\n`)+"("+n+")";else if("DIVISIBLE_BY"===o){if("0"===(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"))return["False",t.ATOMIC];e=n+" % "+e+" == 0"}else e=n+r;return[e,a]},math_on_list:function(e,i){let n=e.getFieldValue("OP");switch(e=i.valueToCode(e,"LIST",t.NONE)||"[]",n){case"SUM":i="sum("+e+")";break;case"MIN":i="min("+e+")";break;case"MAX":i="max("+e+")";break;case"AVERAGE":i.definitions_.from_numbers_import_Number="from numbers import Number",i=i.provideFunction_("math_mean",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(myList):\n localList = [e for e in myList if isinstance(e, Number)]\n if not localList: return\n return float(sum(localList)) / len(localList)\n`)+"("+e+")";break;case"MEDIAN":i.definitions_.from_numbers_import_Number="from numbers import Number",i=i.provideFunction_("math_median",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(myList):\n localList = sorted([e for e in myList if isinstance(e, Number)])\n if not localList: return\n if len(localList) % 2 == 0:\n return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0\n else:\n return localList[(len(localList) - 1) // 2]\n`)+"("+e+")";break;case"MODE":i=i.provideFunction_("math_modes",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(some_list):\n modes = []\n # Using a lists of [item, count] to keep count rather than dict\n # to avoid "unhashable" errors when the counted item is itself a list or dict.\n counts = []\n maxCount = 1\n for item in some_list:\n found = False\n for count in counts:\n if count[0] == item:\n count[1] += 1\n maxCount = max(maxCount, count[1])\n found = True\n if not found:\n counts.append([item, 1])\n for counted_item, item_count in counts:\n if item_count == maxCount:\n modes.append(counted_item)\n return modes\n`)+"("+e+")";break;case"STD_DEV":i.definitions_.import_math="import math",i=i.provideFunction_("math_standard_deviation",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(numbers):\n n = len(numbers)\n if n == 0: return\n mean = float(sum(numbers)) / n\n variance = sum((x - mean) ** 2 for x in numbers) / n\n return math.sqrt(variance)\n`)+"("+e+")";break;case"RANDOM":i.definitions_.import_random="import random",i="random.choice("+e+")";break;default:throw Error("Unknown operator: "+n)}return[i,t.FUNCTION_CALL]},math_random_float:function(e,i){return i.definitions_.import_random="import random",["random.random()",t.FUNCTION_CALL]},math_random_int:function(e,i){return i.definitions_.import_random="import random",["random.randint("+(i.valueToCode(e,"FROM",t.NONE)||"0")+", "+(e=i.valueToCode(e,"TO",t.NONE)||"0")+")",t.FUNCTION_CALL]}};g.math_round=r,g.math_single=r,g.math_trig=r;var m={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+"\n"},procedures_callreturn:function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME")),o=[],r=e.getVars();for(let s=0;s<r.length;s++)o[s]=i.valueToCode(e,"ARG"+s,t.NONE)||"None";return[n+"("+o.join(", ")+")",t.FUNCTION_CALL]}};m.procedures_defnoreturn=s,m.procedures_defreturn=s,m.procedures_ifreturn=function(e,i){let n="if "+(i.valueToCode(e,"CONDITION",t.NONE)||"False")+":\n";return i.STATEMENT_SUFFIX&&(n+=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)),e.hasReturnValue_?(e=i.valueToCode(e,"VALUE",t.NONE)||"None",n+=i.INDENT+"return "+e+"\n"):n+=i.INDENT+"return\n",n};var T=/^\s*'([^']|\\')*'\s*$/,_=function(e){return T.test(e)?[e,t.ATOMIC]:["str("+e+")",t.FUNCTION_CALL]},E={text:function(e,i){return[i.quote_(e.getFieldValue("TEXT")),t.ATOMIC]},text_append:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR"));return e=i.valueToCode(e,"TEXT",t.NONE)||"''",n+" = str("+n+") + "+_(e)[0]+"\n"},text_changeCase:function(e,i){let n={UPPERCASE:".upper()",LOWERCASE:".lower()",TITLECASE:".title()"}[e.getFieldValue("CASE")];return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+n,t.FUNCTION_CALL]},text_charAt:function(e,i){let n=e.getFieldValue("WHERE")||"FROM_START",o=i.valueToCode(e,"VALUE","RANDOM"===n?t.NONE:t.MEMBER)||"''";switch(n){case"FIRST":return[o+"[0]",t.MEMBER];case"LAST":return[o+"[-1]",t.MEMBER];case"FROM_START":return[o+"["+(e=i.getAdjustedInt(e,"AT"))+"]",t.MEMBER];case"FROM_END":return[o+"["+(e=i.getAdjustedInt(e,"AT",1,!0))+"]",t.MEMBER];case"RANDOM":return i.definitions_.import_random="import random",[i.provideFunction_("text_random_letter",`\ndef ${i.FUNCTION_NAME_PLACEHOLDER_}(text):\n x = int(random.random() * len(text))\n return text[x]\n`)+"("+o+")",t.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},text_count:function(e,i){return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+".count("+(e=i.valueToCode(e,"SUB",t.NONE)||"''")+")",t.FUNCTION_CALL]},text_getSubstring:function(e,n){var o=e.getFieldValue("WHERE1");let r=e.getFieldValue("WHERE2"),s=n.valueToCode(e,"STRING",t.MEMBER)||"''";switch(o){case"FROM_START":0===(o=n.getAdjustedInt(e,"AT1"))&&(o="");break;case"FROM_END":o=n.getAdjustedInt(e,"AT1",1,!0);break;case"FIRST":o="";break;default:throw Error("Unhandled option (text_getSubstring)")}switch(r){case"FROM_START":e=n.getAdjustedInt(e,"AT2",1);break;case"FROM_END":e=n.getAdjustedInt(e,"AT2",0,!0),i.isNumber$$module$build$src$core$utils$string(String(e))?0===e&&(e=""):(n.definitions_.import_sys="import sys",e+=" or sys.maxsize");break;case"LAST":e="";break;default:throw Error("Unhandled option (text_getSubstring)")}return[s+"["+o+" : "+e+"]",t.MEMBER]},text_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"find":"rfind",o=i.valueToCode(e,"FIND",t.NONE)||"''";return i=(i.valueToCode(e,"VALUE",t.MEMBER)||"''")+"."+n+"("+o+")",e.workspace.options.oneBasedIndex?[
3i+" + 1",t.ADDITIVE]:[i,t.FUNCTION_CALL]},text_isEmpty:function(e,i){return["not len("+(i.valueToCode(e,"VALUE",t.NONE)||"''")+")",t.LOGICAL_NOT]},text_join:function(e,n){switch(e.itemCount_){case 0:return["''",t.ATOMIC];case 1:return e=n.valueToCode(e,"ADD0",t.NONE)||"''",_(e);case 2:var o=n.valueToCode(e,"ADD0",t.NONE)||"''";return e=n.valueToCode(e,"ADD1",t.NONE)||"''",[_(o)[0]+" + "+_(e)[0],t.ADDITIVE];default:o=[];for(let i=0;i<e.itemCount_;i++)o[i]=n.valueToCode(e,"ADD"+i,t.NONE)||"''";return["''.join([str("+(e=n.nameDB_.getDistinctName("x",i.NameType$$module$build$src$core$names.VARIABLE))+") for "+e+" in ["+o.join(", ")+"]])",t.FUNCTION_CALL]}},text_length:function(e,i){return["len("+(i.valueToCode(e,"VALUE",t.NONE)||"''")+")",t.FUNCTION_CALL]},text_print:function(e,i){return"print("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+")\n"}};E.text_prompt=a,E.text_prompt_ext=a,E.text_replace=function(e,i){return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+".replace("+(i.valueToCode(e,"FROM",t.NONE)||"''")+", "+(e=i.valueToCode(e,"TO",t.NONE)||"''")+")",t.MEMBER]},E.text_reverse=function(e,i){return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+"[::-1]",t.MEMBER]},E.text_trim=function(e,i){let n={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[e.getFieldValue("MODE")];return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+n,t.FUNCTION_CALL]};var b={};b.variables_get=l,b.variables_set=c;var O={};O.variables_get_dynamic=l,O.variables_set_dynamic=c;var v=new u;v.addReservedWords("math,random,Number");var I=Object.assign({},d,p,f,g,m,E,b,O);for(let y in I)v.forBlock[y]=I[y];var S={};return S.Order=t,S.PythonGenerator=u,S.pythonGenerator=v,S.__namespace__=i,S})}),JL=l({Order:()=>BL,PythonGenerator:()=>UL,pythonGenerator:()=>HL}),ZL=s(()=>{FL=u(qL(),1),({Order:BL,PythonGenerator:UL,pythonGenerator:HL}=FL.default)}),eN=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):(i.javascript=n(i.Blockly),i.Blockly.JavaScript=i.javascript.javascriptGenerator)}(e,function(e){var t,i=e.__namespace__,n=function(e,i){var n=0;let o="";i.STATEMENT_PREFIX&&(o+=i.injectId(i.STATEMENT_PREFIX,e));do{let r=i.valueToCode(e,"IF"+n,t.NONE)||"false",s=i.statementToCode(e,"DO"+n);i.STATEMENT_SUFFIX&&(s=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+s),o+=(n>0?" else ":"")+"if ("+r+") {\n"+s+"}",n++}while(e.getInput("IF"+n));return(e.getInput("ELSE")||i.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")?i.statementToCode(e,"ELSE"):"",i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),o+=" else {\n"+n+"}"),o+"\n"},o=function(e,n){let o;o=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):n.valueToCode(e,"TIMES",t.ASSIGNMENT)||"0";let r=n.statementToCode(e,"DO");r=n.addLoopTrap(r,e),e="";let s=n.nameDB_.getDistinctName("count",i.NameType$$module$build$src$core$names.VARIABLE),a=o;return o.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(o)||(a=n.nameDB_.getDistinctName("repeat_end",i.NameType$$module$build$src$core$names.VARIABLE),e+="var "+a+" = "+o+";\n"),e+"for (var "+s+" = 0; "+s+" < "+a+"; "+s+"++) {\n"+r+"}\n"},r=function(e,i){let n,o=e.getFieldValue("OP");if("NEG"===o)return"-"===(e=i.valueToCode(e,"NUM",t.UNARY_NEGATION)||"0")[0]&&(e=" "+e),["-"+e,t.UNARY_NEGATION];switch(e="SIN"===o||"COS"===o||"TAN"===o?i.valueToCode(e,"NUM",t.DIVISION)||"0":i.valueToCode(e,"NUM",t.NONE)||"0",o){case"ABS":n="Math.abs("+e+")";break;case"ROOT":n="Math.sqrt("+e+")";break;case"LN":n="Math.log("+e+")";break;case"EXP":n="Math.exp("+e+")";break;case"POW10":n="Math.pow(10,"+e+")";break;case"ROUND":n="Math.round("+e+")";break;case"ROUNDUP":n="Math.ceil("+e+")";break;case"ROUNDDOWN":n="Math.floor("+e+")";break;case"SIN":n="Math.sin("+e+" / 180 * Math.PI)";break;case"COS":n="Math.cos("+e+" / 180 * Math.PI)";break;case"TAN":n="Math.tan("+e+" / 180 * Math.PI)"}if(n)return[n,t.FUNCTION_CALL];switch(o){case"LOG10":n="Math.log("+e+") / Math.log(10)";break;case"ASIN":n="Math.asin("+e+") / Math.PI * 180";break;case"ACOS":n="Math.acos("+e+") / Math.PI * 180";break;case"ATAN":n="Math.atan("+e+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+o)}return[n,t.DIVISION]},s=function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME"));var o="";i.STATEMENT_PREFIX&&(o+=i.injectId(i.STATEMENT_PREFIX,e)),i.STATEMENT_SUFFIX&&(o+=i.injectId(i.STATEMENT_SUFFIX,e)),o&&=i.prefixLines(o,i.INDENT);let r="";i.INFINITE_LOOP_TRAP&&(r=i.prefixLines(i.injectId(i.INFINITE_LOOP_TRAP,e),i.INDENT));let s="";e.getInput("STACK")&&(s=i.statementToCode(e,"STACK"));let a="";e.getInput("RETURN")&&(a=i.valueToCode(e,"RETURN",t.NONE)||"");let l="";s&&a&&(l=o),a&&=i.INDENT+"return "+a+";\n";let c=[],u=e.getVars();for(let t=0;t<u.length;t++)c[t]=i.getVariableName(u[t]);return o="function "+n+"("+c.join(", ")+") {\n"+o+r+s+l+a+"}",o=i.scrub_(e,o),i.definitions_["%"+n]=o,null},a=function(e,i){return i="window.prompt("+(e.getField("TEXT")?i.quote_(e.getFieldValue("TEXT")):i.valueToCode(e,"TEXT",t.NONE)||"''")+")","NUMBER"===e.getFieldValue("TYPE")&&(i="Number("+i+")"),[i,t.FUNCTION_CALL]},l=function(e,i){return[i.getVariableName(e.getFieldValue("VAR")),t.ATOMIC]},c=function(e,i){let n=i.valueToCode(e,"VALUE",t.ASSIGNMENT)||"0";return i.getVariableName(e.getFieldValue("VAR"))+" = "+n+";\n"};!function(e){e[e.ATOMIC=0]="ATOMIC",e[e.NEW=1.1]="NEW",e[e.MEMBER=1.2]="MEMBER",e[e.FUNCTION_CALL=2]="FUNCTION_CALL",e[e.INCREMENT=3]="INCREMENT",e[e.DECREMENT=3]="DECREMENT",e[e.BITWISE_NOT=4.1]="BITWISE_NOT",e[e.UNARY_PLUS=4.2]="UNARY_PLUS",e[e.UNARY_NEGATION=4.3]="UNARY_NEGATION",e[e.LOGICAL_NOT=4.4]="LOGICAL_NOT",e[e.TYPEOF=4.5]="TYPEOF",e[e.VOID=4.6]="VOID",e[e.DELETE=4.7]="DELETE",e[e.AWAIT=4.8]="AWAIT",e[e.EXPONENTIATION=5]="EXPONENTIATION",e[e.MULTIPLICATION=5.1]="MULTIPLICATION",e[e.DIVISION=5.2]="DIVISION",e[e.MODULUS=5.3]="MODULUS",e[e.SUBTRACTION=6.1]="SUBTRACTION",e[e.ADDITION=6.2]="ADDITION",e[e.BITWISE_SHIFT=7]="BITWISE_SHIFT",e[e.RELATIONAL=8]="RELATIONAL",e[e.IN=8]="IN",e[e.INSTANCEOF=8]="INSTANCEOF",e[e.EQUALITY=9]="EQUALITY",e[e.BITWISE_AND=10]="BITWISE_AND",e[e.BITWISE_XOR=11]="BITWISE_XOR",e[e.BITWISE_OR=12]="BITWISE_OR",e[e.LOGICAL_AND=13]="LOGICAL_AND",e[e.LOGICAL_OR=14]="LOGICAL_OR",e[e.CONDITIONAL=15]="CONDITIONAL",e[e.ASSIGNMENT=16]="ASSIGNMENT",e[e.YIELD=17]="YIELD",e[e.COMMA=18]="COMMA",e[e.NONE=99]="NONE"}(t||={});var u=class extends i.CodeGenerator$$module$build$src$core$generator{constructor(e="JavaScript"){super(e),this.ORDER_OVERRIDES=[[t.FUNCTION_CALL,t.MEMBER],[t.FUNCTION_CALL,t.FUNCTION_CALL],[t.MEMBER,t.MEMBER],[t.MEMBER,t.FUNCTION_CALL],[t.LOGICAL_NOT,t.LOGICAL_NOT],[t.MULTIPLICATION,t.MULTIPLICATION],[t.ADDITION,t.ADDITION],[t.LOGICAL_AND,t.LOGICAL_AND],[t.LOGICAL_OR,t.LOGICAL_OR]],this.isInitialized=!1;for(let i in t)"string"!=typeof(e=t[i])&&(this["ORDER_"+i]=e);this.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(globalThis).join(","))}init(e){super.init(e),this.nameDB_?this.nameDB_.reset():this.nameDB_=new i.Names$$module$build$src$core$names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);let t=[];var n=i.allDeveloperVariables$$module$build$src$core$variables(e);for(let o=0;o<n.length;o++)t.push(this.nameDB_.getName(n[o],i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));for(e=i.allUsedVarModels$$module$build$src$core$variables(e),n=0;n<e.length;n++)t.push(this.nameDB_.getName(e[n].getId(),i.NameType$$module$build$src$core$names.VARIABLE));t.length&&(this.definitions_.variables="var "+t.join(", ")+";"),this.isInitialized=!0}finish(e){let t=Object.values(this.definitions_);return super.finish(e),this.isInitialized=!1,this.nameDB_.reset(),t.join("\n\n")+"\n\n\n"+e}scrubNakedValue(e){return e+";\n"}quote_(e){return"'"+(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'"))+"'"}multiline_quote_(e){return e.split(/\n/g).map(this.quote_).join(" + '\\n' +\n")}scrub_(e,t,n=!1){let o="";if(!e.outputConnection||!e.outputConnection.targetConnection){var r=e.getCommentText();r&&(r=i.wrap$$module$build$src$core$utils$string(r,this.COMMENT_WRAP-3),o+=this.prefixLines(r+"\n","// "));for(let t=0;t<e.inputList.length;t++)e.inputList[t].type===i.inputTypes$$module$build$src$core$input
3s$input_types.VALUE&&(r=e.inputList[t].connection.targetBlock())&&(r=this.allNestedComments(r))&&(o+=this.prefixLines(r,"// "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),o+t+(n=n?"":this.blockToCode(e))}getAdjusted(e,n,o=0,r=!1,s=t.NONE){e.workspace.options.oneBasedIndex&&o--;let a=e.workspace.options.oneBasedIndex?"1":"0",l=s;return o>0?l=t.ADDITION:o<0?l=t.SUBTRACTION:r&&(l=t.UNARY_NEGATION),e=this.valueToCode(e,n,l)||a,0!==o||r?i.isNumber$$module$build$src$core$utils$string(e)?(e=String(Number(e)+o),r&&(e=String(-Number(e))),e):(o>0?e=`${e} + ${o}`:o<0&&(e=`${e} - ${-o}`),r&&(e=o?`-(${e})`:`-${e}`),Math.floor(s)>=Math.floor(l)&&(e=`(${e})`),e):e}},h={};h.JavascriptGenerator=u,h.Order=t;var d=function(e,t,i){return"FIRST"===t?"0":"FROM_END"===t?e+".length - 1 - "+i:"LAST"===t?e+".length - 1":i},p={lists_create_empty:function(e,i){return["[]",t.ATOMIC]},lists_create_with:function(e,i){let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"null";return["["+n.join(", ")+"]",t.ATOMIC]},lists_getIndex:function(e,i){let n=e.getFieldValue("MODE")||"GET",o=e.getFieldValue("WHERE")||"FROM_START";var r=i.valueToCode(e,"VALUE","RANDOM"===o?t.NONE:t.MEMBER)||"[]";switch(o){case"FIRST":if("GET"===n)return[r+"[0]",t.MEMBER];if("GET_REMOVE"===n)return[r+".shift()",t.MEMBER];if("REMOVE"===n)return r+".shift();\n";break;case"LAST":if("GET"===n)return[r+".slice(-1)[0]",t.MEMBER];if("GET_REMOVE"===n)return[r+".pop()",t.MEMBER];if("REMOVE"===n)return r+".pop();\n";break;case"FROM_START":if(e=i.getAdjusted(e,"AT"),"GET"===n)return[r+"["+e+"]",t.MEMBER];if("GET_REMOVE"===n)return[r+".splice("+e+", 1)[0]",t.FUNCTION_CALL];if("REMOVE"===n)return r+".splice("+e+", 1);\n";break;case"FROM_END":if(e=i.getAdjusted(e,"AT",1,!0),"GET"===n)return[r+".slice("+e+")[0]",t.FUNCTION_CALL];if("GET_REMOVE"===n)return[r+".splice("+e+", 1)[0]",t.FUNCTION_CALL];if("REMOVE"===n)return r+".splice("+e+", 1);";break;case"RANDOM":if(r=i.provideFunction_("listsGetRandomItem",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(list, remove) {\n var x = Math.floor(Math.random() * list.length);\n if (remove) {\n return list.splice(x, 1)[0];\n } else {\n return list[x];\n }\n}\n`)+"("+r+", "+("GET"!==n)+")","GET"===n||"GET_REMOVE"===n)return[r,t.FUNCTION_CALL];if("REMOVE"===n)return r+";\n"}throw Error("Unhandled combination (lists_getIndex).")},lists_getSublist:function(e,i){var n={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"},o=i.valueToCode(e,"LIST",t.MEMBER)||"[]";let r=e.getFieldValue("WHERE1"),s=e.getFieldValue("WHERE2");if("FIRST"===r&&"LAST"===s)o+=".slice(0)";else if(o.match(/^\w+$/)||"FROM_END"!==r&&"FROM_START"===s){switch(r){case"FROM_START":n=i.getAdjusted(e,"AT1");break;case"FROM_END":n=o+".length - "+(n=i.getAdjusted(e,"AT1",1,!1,t.SUBTRACTION));break;case"FIRST":n="0";break;default:throw Error("Unhandled option (lists_getSublist).")}switch(s){case"FROM_START":i=i.getAdjusted(e,"AT2",1);break;case"FROM_END":i=o+".length - "+(i=i.getAdjusted(e,"AT2",0,!1,t.SUBTRACTION));break;case"LAST":i=o+".length";break;default:throw Error("Unhandled option (lists_getSublist).")}o=o+".slice("+n+", "+i+")"}else{let t=i.getAdjusted(e,"AT1");e=i.getAdjusted(e,"AT2"),o=i.provideFunction_("subsequence"+n[r]+n[s],`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===r||"FROM_START"===r?", at1":""}${"FROM_END"===s||"FROM_START"===s?", at2":""}) {\n var start = ${d("sequence",r,"at1")};\n var end = ${d("sequence",s,"at2")} + 1;\n return sequence.slice(start, end);\n}\n`)+"("+o+("FROM_END"===r||"FROM_START"===r?", "+t:"")+("FROM_END"===s||"FROM_START"===s?", "+e:"")+")"}return[o,t.FUNCTION_CALL]},lists_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"indexOf":"lastIndexOf",o=i.valueToCode(e,"FIND",t.NONE)||"''";return i=(i.valueToCode(e,"VALUE",t.MEMBER)||"[]")+"."+n+"("+o+")",e.workspace.options.oneBasedIndex?[
3i+" + 1",t.ADDITION]:[i,t.FUNCTION_CALL]},lists_isEmpty:function(e,i){return["!"+(i.valueToCode(e,"VALUE",t.MEMBER)||"[]")+".length",t.LOGICAL_NOT]},lists_length:function(e,i){return[(i.valueToCode(e,"VALUE",t.MEMBER)||"[]")+".length",t.MEMBER]},lists_repeat:function(e,i){return[i.provideFunction_("listsRepeat",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(value, n) {\n var array = [];\n for (var i = 0; i < n; i++) {\n array[i] = value;\n }\n return array;\n}\n`)+"("+(i.valueToCode(e,"ITEM",t.NONE)||"null")+", "+(e=i.valueToCode(e,"NUM",t.NONE)||"0")+")",t.FUNCTION_CALL]},lists_reverse:function(e,i){return[(i.valueToCode(e,"LIST",t.FUNCTION_CALL)||"[]")+".slice().reverse()",t.FUNCTION_CALL]},lists_setIndex:function(e,n){function o(){if(r.match(/^\w+$/))return"";let e=n.nameDB_.getDistinctName("tmpList",i.NameType$$module$build$src$core$names.VARIABLE),t="var "+e+" = "+r+";\n";return r=e,t}let r=n.valueToCode(e,"LIST",t.MEMBER)||"[]",s=e.getFieldValue("MODE")||"GET";var a=e.getFieldValue("WHERE")||"FROM_START";let l=n.valueToCode(e,"TO",t.ASSIGNMENT)||"null";switch(a){case"FIRST":if("SET"===s)return r+"[0] = "+l+";\n";if("INSERT"===s)return r+".unshift("+l+");\n";break;case"LAST":if("SET"===s)return o()+(r+"[")+r+".length - 1] = "+l+";\n";if("INSERT"===s)return r+".push("+l+");\n";break;case"FROM_START":if(e=n.getAdjusted(e,"AT"),"SET"===s)return r+"["+e+"] = "+l+";\n";if("INSERT"===s)return r+".splice("+e+", 0, "+l+");\n";break;case"FROM_END":if(e=n.getAdjusted(e,"AT",1,!1,t.SUBTRACTION),a=o(),"SET"===s)return a+(r+"[")+r+".length - "+e+"] = "+l+";\n";if("INSERT"===s)return a+(r+".splice(")+r+".length - "+e+", 0, "+l+");\n";break;case"RANDOM":if(e=o(),e+="var "+(a=n.nameDB_.getDistinctName("tmpX",i.NameType$$module$build$src$core$names.VARIABLE))+" = Math.floor(Math.random() * "+r+".length);\n","SET"===s)return e+(r+"[")+a+"] = "+l+";\n";if("INSERT"===s)return e+(r+".splice(")+a+", 0, "+l+");\n"}throw Error("Unhandled combination (lists_setIndex).")},lists_sort:function(e,i){let n=i.valueToCode(e,"LIST",t.FUNCTION_CALL)||"[]",o="1"===e.getFieldValue("DIRECTION")?1:-1;return e=e.getFieldValue("TYPE"),[n+".slice().sort("+(i=i.provideFunction_("listsGetSortCompare",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(type, direction) {\n var compareFuncs = {\n 'NUMERIC': function(a, b) {\n return Number(a) - Number(b); },\n 'TEXT': function(a, b) {\n return String(a) > String(b) ? 1 : -1; },\n 'IGNORE_CASE': function(a, b) {\n return String(a).toLowerCase() > String(b).toLowerCase() ? 1 : -1; },\n };\n var compare = compareFuncs[type];\n return function(a, b) { return compare(a, b) * direction; };\n}\n `))+'("'+e+'", '+o+"))",t.FUNCTION_CALL]},lists_split:function(e,i){let n=i.valueToCode(e,"INPUT",t.MEMBER);if(i=i.valueToCode(e,"DELIM",t.NONE)||"''","SPLIT"===(e=e.getFieldValue("MODE")))n||="''",e="split";else{if("JOIN"!==e)throw Error("Unknown mode: "+e);n||="[]",e="join"}return[n+"."+e+"("+i+")",t.FUNCTION_CALL]}},f={};f.controls_if=n,f.controls_ifelse=n,f.logic_boolean=function(e,i){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",t.ATOMIC]},f.logic_compare=function(e,i){let n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],o="=="===n||"!="===n?t.EQUALITY:t.RELATIONAL;return[(i.valueToCode(e,"A",o)||"0")+" "+n+" "+(e=i.valueToCode(e,"B",o)||"0"),o]},f.logic_negate=function(e,i){let n=t.LOGICAL_NOT;return["!"+(i.valueToCode(e,"BOOL",n)||"true"),n]},f.logic_null=function(e,i){return["null",t.ATOMIC]},f.logic_operation=function(e,i){let n="AND"===e.getFieldValue("OP")?"&&":"||",o="&&"===n?t.LOGICAL_AND:t.LOGICAL_OR,r=i.valueToCode(e,"A",o);return e=i.valueToCode(e,"B",o),r||e?(i="&&"===n?"true":"false",r||=i,e||=i):e=r="false",[r+" "+n+" "+e,o]},f.logic_ternary=function(e,i){return[(i.valueToCode(e,"IF",t.CONDITIONAL)||"false")+" ? "+(i.valueToCode(e,"THEN",t.CONDITIONAL)||"null")+" : "+(e=i.valueToCode(e,"ELSE",t.CONDITIONAL)||"null"),t.CONDITIONAL]};var g={controls_flow_statements:function(e,t){let i="";if(t.STATEMENT_PREFIX&&(i+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(i+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){let n=e.getSurroundLoop();n&&!n.suppressPrefixSuffix&&(i+=t.injectId(t.STATEMENT_PREFIX,n))}switch(e.getFieldValue("FLOW")){case"BREAK":return i+"break;\n";case"CONTINUE":return i+"continue;\n"}throw Error("Unknown flow statement.")},controls_for:function(e,n){var o=n.getVariableName(e.getFieldValue("VAR")),r=n.valueToCode(e,"FROM",t.ASSIGNMENT)||"0",s=n.valueToCode(e,"TO",t.ASSIGNMENT)||"0";let a=n.valueToCode(e,"BY",t.ASSIGNMENT)||"1",l=n.statementToCode(e,"DO");
3if(l=n.addLoopTrap(l,e),i.isNumber$$module$build$src$core$utils$string(r)&&i.isNumber$$module$build$src$core$utils$string(s)&&i.isNumber$$module$build$src$core$utils$string(a))e="for ("+o+" = "+r+"; "+o+((n=Number(r)<=Number(s))?" <= ":" >= ")+s+"; "+o,e=1===(o=Math.abs(Number(a)))?e+(n?"++":"--"):e+(n?" += ":" -= ")+o,e+=") {\n"+l+"}\n";else{e="";let t=r;r.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(r)||(t=n.nameDB_.getDistinctName(o+"_start",i.NameType$$module$build$src$core$names.VARIABLE),e+="var "+t+" = "+r+";\n"),r=s,s.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(s)||(e+="var "+(r=n.nameDB_.getDistinctName(o+"_end",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+s+";\n"),e+="var "+(s=n.nameDB_.getDistinctName(o+"_inc",i.NameType$$module$build$src$core$names.VARIABLE))+" = ",e=i.isNumber$$module$build$src$core$utils$string(a)?e+(Math.abs(Number(a))+";\n"):e+"Math.abs("+a+");\n",e+="if ("+t+" > "+r+") {\n",e=(e+=n.INDENT+s+" = -"+s+";\n")+"}\nfor ("+o+" = "+t+"; "+s+" >= 0 ? "+o+" <= "+r+" : "+o+" >= "+r+"; "+o+" += "+s+") {\n"+l+"}\n"}return e},controls_forEach:function(e,n){let o=n.getVariableName(e.getFieldValue("VAR"));var r=n.valueToCode(e,"LIST",t.ASSIGNMENT)||"[]";let s=n.statementToCode(e,"DO");s=n.addLoopTrap(s,e),e="";let a=r;return r.match(/^\w+$/)||(a=n.nameDB_.getDistinctName(o+"_list",i.NameType$$module$build$src$core$names.VARIABLE),e+="var "+a+" = "+r+";\n"),r=n.nameDB_.getDistinctName(o+"_index",i.NameType$$module$build$src$core$names.VARIABLE),s=n.INDENT+o+" = "+a+"["+r+"];\n"+s,e+"for (var "+r+" in "+a+") {\n"+s+"}\n"}};g.controls_repeat=o,g.controls_repeat_ext=o,g.controls_whileUntil=function(e,i){let n="UNTIL"===e.getFieldValue("MODE"),o=i.valueToCode(e,"BOOL",n?t.LOGICAL_NOT:t.NONE)||"false",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e),n&&(o="!"+o),"while ("+o+") {\n"+r+"}\n"};var m={math_arithmetic:function(e,i){var n={ADD:[" + ",t.ADDITION],MINUS:[" - ",t.SUBTRACTION],MULTIPLY:[" * ",t.MULTIPLICATION],DIVIDE:[" / ",t.DIVISION],POWER:[null,t.NONE]}[e.getFieldValue("OP")];let o=n[0];n=n[1];let r=i.valueToCode(e,"A",n)||"0";return e=i.valueToCode(e,"B",n)||"0",o?[r+o+e,n]:["Math.pow("+r+", "+e+")",t.FUNCTION_CALL]},math_atan2:function(e,i){let n=i.valueToCode(e,"X",t.NONE)||"0";return["Math.atan2("+(i.valueToCode(e,"Y",t.NONE)||"0")+", "+n+") / Math.PI * 180",t.DIVISION]},math_change:function(e,i){let n=i.valueToCode(e,"DELTA",t.ADDITION)||"0";return(e=i.getVariableName(e.getFieldValue("VAR")))+" = (typeof "+e+" === 'number' ? "+e+" : 0) + "+n+";\n"},math_constant:function(e,i){return{PI:["Math.PI",t.MEMBER],E:["Math.E",t.MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",t.DIVISION],SQRT2:["Math.SQRT2",t.MEMBER],SQRT1_2:["Math.SQRT1_2",t.MEMBER],INFINITY:["Infinity",t.ATOMIC]}[e.getFieldValue("CONSTANT")]},math_constrain:function(e,i){return["Math.min(Math.max("+(i.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(i.valueToCode(e,"LOW",t.NONE)||"0")+"), "+(e=i.valueToCode(e,"HIGH",t.NONE)||"Infinity")+")",t.FUNCTION_CALL]},math_modulo:function(e,i){return[(i.valueToCode(e,"DIVIDEND",t.MODULUS)||"0")+" % "+(e=i.valueToCode(e,"DIVISOR",t.MODULUS)||"0"),t.MODULUS]},math_number:function(e,i){return e=Number(e.getFieldValue("NUM")),[String(e),e>=0?t.ATOMIC:t.UNARY_NEGATION]},math_number_property:function(e,i){var n={EVEN:[" % 2 === 0",t.MODULUS,t.EQUALITY],ODD:[" % 2 === 1",t.MODULUS,t.EQUALITY],WHOLE:[" % 1 === 0",t.MODULUS,t.EQUALITY],POSITIVE:[" > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[" < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,t.MODULUS,t.EQUALITY],PRIME:[null,t.NONE,t.FUNCTION_CALL]};let o=e.getFieldValue("PROPERTY"),[r,s,a]=n[o];return n=i.valueToCode(e,"NUMBER_TO_CHECK",s)||"0","PRIME"===o?e=i.provideFunction_("mathIsPrime",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if (n == 2 || n == 3) {\n return true;\n }\n // False if n is NaN, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (isNaN(n) || n <= 1 || n % 1 !== 0 || n % 2 === 0 || n % 3 === 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {\n if (n % (x - 1) === 0 || n % (x + 1) === 0) {\n return false;\n }\n }\n return true;\n}\n`)+"("+n+")":"DIVISIBLE_BY"===o?e=n+" % "+(e=i.valueToCode(e,"DIVISOR",t.MODULUS)||"0")+" === 0":e=n+r,[e,a]},math_on_list:function(e,i){var n=e.getFieldValue("OP");switch(n){case"SUM":e=i.valueToCode(e,"LIST",t.MEMBER)||"[]",e+=".reduce(function(x, y) {return x + y;}, 0)";break;case"MIN":e="Math.min.apply(null, "+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MAX":e="Math.max.apply(null, "+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"AVERAGE":e=(n=i.provideFunction_("mathMean",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(myList) {\n return myList.reduce(function(x, y) {return x + y;}, 0) / myList.length;\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MEDIAN":e=(n=i.provideFunction_("mathMedian",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(myList) {\n var localList = myList.filter(function (x) {return typeof x === 'number';});\n if (!localList.length) return null;\n localList.sort(function(a, b) {return b - a;});\n if (localList.length % 2 === 0) {\n return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;\n } else {\n return localList[(localList.length - 1) / 2];\n }\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MODE":e=(n=i.provideFunction_("mathModes",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(values) {\n var modes = [];\n var counts = [];\n var maxCount = 0;\n for (var i = 0; i < values.length;
3 i++) {\n var value = values[i];\n var found = false;\n var thisCount;\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][0] === value) {\n thisCount = ++counts[j][1];\n found = true;\n break;\n }\n }\n if (!found) {\n counts.push([value, 1]);\n thisCount = 1;\n }\n maxCount = Math.max(thisCount, maxCount);\n }\n for (var j = 0; j < counts.length; j++) {\n if (counts[j][1] === maxCount) {\n modes.push(counts[j][0]);\n }\n }\n return modes;\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"STD_DEV":e=(n=i.provideFunction_("mathStandardDeviation",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(numbers) {\n var n = numbers.length;\n if (!n) return null;\n var mean = numbers.reduce(function(x, y) {return x + y;}) / n;\n var variance = 0;\n for (var j = 0; j < n; j++) {\n variance += Math.pow(numbers[j] - mean, 2);\n }\n variance /= n;\n return Math.sqrt(variance);\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"RANDOM":e=(n=i.provideFunction_("mathRandomList",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(list) {\n var x = Math.floor(Math.random() * list.length);\n return list[x];\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+n)}return[e,t.FUNCTION_CALL]},math_random_float:function(e,i){return["Math.random()",t.FUNCTION_CALL]},math_random_int:function(e,i){let n=i.valueToCode(e,"FROM",t.NONE)||"0";return e=i.valueToCode(e,"TO",t.NONE)||"0",[i.provideFunction_("mathRandomInt",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(a, b) {\n if (a > b) {\n // Swap a and b to ensure a is smaller.\n var c = a;\n a = b;\n b = c;\n }\n return Math.floor(Math.random() * (b - a + 1) + a);\n}\n`)+"("+n+", "+e+")",t.FUNCTION_CALL]}};m.math_round=r,m.math_single=r,m.math_trig=r;var T={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+";\n"},procedures_callreturn:function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME")),o=[],r=e.getVars();for(let s=0;s<r.length;s++)o[s]=i.valueToCode(e,"ARG"+s,t.NONE)||"null";return[n+"("+o.join(", ")+")",t.FUNCTION_CALL]}};T.procedures_defnoreturn=s,T.procedures_defreturn=s,T.procedures_ifreturn=function(e,i){let n="if ("+(i.valueToCode(e,"CONDITION",t.NONE)||"false")+") {\n";return i.STATEMENT_SUFFIX&&(n+=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)),e.hasReturnValue_?(e=i.valueToCode(e,"VALUE",t.NONE)||"null",n+=i.INDENT+"return "+e+";\n"):n+=i.INDENT+"return;\n",n+"}\n"};var _=/^\s*'([^']|\\')*'\s*$/,E=function(e){return _.test(e)?[e,t.ATOMIC]:["String("+e+")",t.FUNCTION_CALL]},b=function(e,t,i){return"FIRST"===t?"0":"FROM_END"===t?e+".length - 1 - "+i:"LAST"===t?e+".length - 1":i},O={text:function(e,i){return[i.quote_(e.getFieldValue("TEXT")),t.ATOMIC]},text_append:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR"));return e=i.valueToCode(e,"TEXT",t.NONE)||"''",n+" += "+E(e)[0]+";\n"},text_changeCase:function(e,i){let n={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[e.getFieldValue("CASE")];return e=i.valueToCode(e,"TEXT",n?t.MEMBER:t.NONE)||"''",[n?e+n:i.provideFunction_("textToTitleCase",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str) {\n return str.replace(/\\S+/g,\n function(txt) {return txt[0].toUpperCase() + txt.substring(1).toLowerCase();});\n}\n`)+"("+e+")",t.FUNCTION_CALL]},text_charAt:function(e,i){let n=e.getFieldValue("WHERE")||"FROM_START",o=i.valueToCode(e,"VALUE","RANDOM"===n?t.NONE:t.MEMBER)||"''";switch(n){case"FIRST":return[o+".charAt(0)",t.FUNCTION_CALL];case"LAST":return[o+".slice(-1)",t.FUNCTION_CALL];case"FROM_START":return[o+".charAt("+(e=i.getAdjusted(e,"AT"))+")",t.FUNCTION_CALL];case"FROM_END":return[o+".slice("+(e=i.getAdjusted(e,"AT",1,!0))+").charAt(0)",t.FUNCTION_CALL];case"RANDOM":return[i.provideFunction_("textRandomLetter",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(text) {\n var x = Math.floor(Math.random() * text.length);\n return text[x];\n}\n`)+"("+o+")",t.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},text_count:function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''";return e=i.valueToCode(e,"SUB",t.NONE)||"''",[i.provideFunction_("textCount",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle) {\n if (needle.length === 0) {\n return haystack.length + 1;\n } else {\n return haystack.split(needle).length - 1;\n }\n}\n`)+"("+n+", "+e+")",t.FUNCTION_CALL]},text_getSubstring:function(e,i){var n={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};let o=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2");
3var s="FROM_END"!==o&&"LAST"!==o&&"FROM_END"!==r&&"LAST"!==r,a=i.valueToCode(e,"STRING",s?t.MEMBER:t.NONE)||"''";if("FIRST"===o&&"LAST"===r)return[a,t.NONE];if(a.match(/^'?\w+'?$/)||s){switch(o){case"FROM_START":n=i.getAdjusted(e,"AT1");break;case"FROM_END":n=a+".length - "+(n=i.getAdjusted(e,"AT1",1,!1,t.SUBTRACTION));break;case"FIRST":n="0";break;default:throw Error("Unhandled option (text_getSubstring).")}switch(r){case"FROM_START":i=i.getAdjusted(e,"AT2",1);break;case"FROM_END":i=a+".length - "+(i=i.getAdjusted(e,"AT2",0,!1,t.SUBTRACTION));break;case"LAST":i=a+".length";break;default:throw Error("Unhandled option (text_getSubstring).")}a=a+".slice("+n+", "+i+")"}else s=i.getAdjusted(e,"AT1"),e=i.getAdjusted(e,"AT2"),a=i.provideFunction_("subsequence"+n[o]+n[r],`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(sequence${"FROM_END"===o||"FROM_START"===o?", at1":""}${"FROM_END"===r||"FROM_START"===r?", at2":""}) {\n var start = ${b("sequence",o,"at1")};\n var end = ${b("sequence",r,"at2")} + 1;\n return sequence.slice(start, end);\n}\n`)+"("+a+("FROM_END"===o||"FROM_START"===o?", "+s:"")+("FROM_END"===r||"FROM_START"===r?", "+e:"")+")";return[a,t.FUNCTION_CALL]},text_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"indexOf":"lastIndexOf",o=i.valueToCode(e,"FIND",t.NONE)||"''";return i=(i.valueToCode(e,"VALUE",t.MEMBER)||"''")+"."+n+"("+o+")",e.workspace.options.oneBasedIndex?[
3i+" + 1",t.ADDITION]:[i,t.FUNCTION_CALL]},text_isEmpty:function(e,i){return["!"+(i.valueToCode(e,"VALUE",t.MEMBER)||"''")+".length",t.LOGICAL_NOT]},text_join:function(e,i){switch(e.itemCount_){case 0:return["''",t.ATOMIC];case 1:return e=i.valueToCode(e,"ADD0",t.NONE)||"''",E(e);case 2:var n=i.valueToCode(e,"ADD0",t.NONE)||"''";return e=i.valueToCode(e,"ADD1",t.NONE)||"''",[E(n)[0]+" + "+E(e)[0],t.ADDITION];default:n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"''";return["["+n.join(",")+"].join('')",t.FUNCTION_CALL]}},text_length:function(e,i){return[(i.valueToCode(e,"VALUE",t.MEMBER)||"''")+".length",t.MEMBER]},text_print:function(e,i){return"window.alert("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+");\n"}};O.text_prompt=a,O.text_prompt_ext=a,O.text_replace=function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''",o=i.valueToCode(e,"FROM",t.NONE)||"''";return e=i.valueToCode(e,"TO",t.NONE)||"''",[i.provideFunction_("textReplace",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle, replacement) {\n needle = needle.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1')\n .replace(/\\x08/g, '\\\\x08');\n return haystack.replace(new RegExp(needle, 'g'), replacement);\n}\n`)+"("+n+", "+o+", "+e+")",t.FUNCTION_CALL]},O.text_reverse=function(e,i){return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+".split('').reverse().join('')",t.FUNCTION_CALL]},O.text_trim=function(e,i){let n={LEFT:".replace(/^[\\s\\xa0]+/, '')",RIGHT:".replace(/[\\s\\xa0]+$/, '')",BOTH:".trim()"}[e.getFieldValue("MODE")];return[(i.valueToCode(e,"TEXT",t.MEMBER)||"''")+n,t.FUNCTION_CALL]};var v={};v.variables_get=l,v.variables_set=c;var I={};I.variables_get_dynamic=l,I.variables_set_dynamic=c;var S=new u,y=Object.assign({},p,f,g,m,T,O,v,I);for(let C in y)S.forBlock[C]=y[C];var R={};return R.JavascriptGenerator=u,R.Order=t,R.javascriptGenerator=S,R.__namespace__=i,R})}),tN=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):(i.dart=n(i.Blockly),i.Blockly.Dart=i.dart.dartGenerator)}(e,function(e){var t,i=e.__namespace__,n=function(e,i){let n,o,r=0,s="";i.STATEMENT_PREFIX&&(s+=i.injectId(i.STATEMENT_PREFIX,e));do{o=i.valueToCode(e,"IF"+r,t.NONE)||"false",n=i.statementToCode(e,"DO"+r),i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+=(r>0?"else ":"")+"if ("+o+") {\n"+n+"}",r++}while(e.getInput("IF"+r));return(e.getInput("ELSE")||i.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")?i.statementToCode(e,"ELSE"):"",i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+=" else {\n"+n+"}"),s+"\n"},o=function(e,n){let o;o=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):n.valueToCode(e,"TIMES",t.ASSIGNMENT)||"0";let r=n.statementToCode(e,"DO");r=n.addLoopTrap(r,e),e="";let s=n.nameDB_.getDistinctName("count",i.NameType$$module$build$src$core$names.VARIABLE),a=o;return o.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(o)||(a=n.nameDB_.getDistinctName("repeat_end",i.NameType$$module$build$src$core$names.VARIABLE),e+="var "+a+" = "+o+";\n"),e+"for (int "+s+" = 0; "+s+" < "+a+"; "+s+"++) {\n"+r+"}\n"},r=function(e,i){let n,o=e.getFieldValue("OP");if("NEG"===o)return"-"===(e=i.valueToCode(e,"NUM",t.UNARY_PREFIX)||"0")[0]&&(e=" "+e),["-"+e,t.UNARY_PREFIX];switch(i.definitions_.import_dart_math="import 'dart:math' as Math;",e="ABS"===o||"ROUND"===o.substring(0,5)?i.valueToCode(e,"NUM",t.UNARY_POSTFIX)||"0":"SIN"===o||"COS"===o||"TAN"===o?i.valueToCode(e,"NUM",t.MULTIPLICATIVE)||"0":i.valueToCode(e,"NUM",t.NONE)||"0",o){case"ABS":n=e+".abs()";break;case"ROOT":n="Math.sqrt("+e+")";break;case"LN":n="Math.log("+e+")";break;case"EXP":n="Math.exp("+e+")";break;case"POW10":n="Math.pow(10,"+e+")";break;case"ROUND":n=e+".round()";break;case"ROUNDUP":n=e+".ceil()";break;case"ROUNDDOWN":n=e+".floor()";break;case"SIN":n="Math.sin("+e+" / 180 * Math.pi)";break;case"COS":n="Math.cos("+e+" / 180 * Math.pi)";break;case"TAN":n="Math.tan("+e+" / 180 * Math.pi)"}if(n)return[n,t.UNARY_POSTFIX];switch(o){case"LOG10":n="Math.log("+e+") / Math.log(10)";break;case"ASIN":n="Math.asin("+e+") / Math.pi * 180";break;case"ACOS":n="Math.acos("+e+") / Math.pi * 180";break;case"ATAN":n="Math.atan("+e+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+o)}return[n,t.MULTIPLICATIVE]},s=function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME"));var o="";i.STATEMENT_PREFIX&&(o+=i.injectId(i.STATEMENT_PREFIX,e)),i.STATEMENT_SUFFIX&&(o+=i.injectId(i.STATEMENT_SUFFIX,e)),o&&=i.prefixLines(o,i.INDENT);let r="";i.INFINITE_LOOP_TRAP&&(r=i.prefixLines(i.injectId(i.INFINITE_LOOP_TRAP,e),i.INDENT));let s="";e.getInput("STACK")&&(s=i.statementToCode(e,"STACK"));let a="";e.getInput("RETURN")&&(a=i.valueToCode(e,"RETURN",t.NONE)||"");let l="";s&&a&&(l=o),a&&=i.INDENT+"return "+a+";\n";let c=a?"dynamic":"void",u=[],h=e.getVars();for(let t=0;t<h.length;t++)u[t]=i.getVariableName(h[t]);return o=c+" "+n+"("+u.join(", ")+") {\n"+o+r+s+l+a+"}",o=i.scrub_(e,o),i.definitions_["%"+n]=o,null},a=function(e,i){i.definitions_.import_dart_html="import 'dart:html' as Html;";let n="Html.window.prompt("+(e.getField("TEXT")?i.quote_(e.getFieldValue("TEXT")):i.valueToCode(e,"TEXT",t.NONE)||"''")+", '')";return"NUMBER"===e.getFieldValue("TYPE")&&(i.definitions_.import_dart_math="import 'dart:math' as Math;",n="Math.parseDouble("+n+")"),[n,t.UNARY_POSTFIX]},l=function(e,i){return[i.getVariableName(e.getFieldValue("VAR")),t.ATOMIC]},c=function(e,i){let n=i.valueToCode(e,"VALUE",t.ASSIGNMENT)||"0";return i.getVariableName(e.getFieldValue("VAR"))+" = "+n+";\n"};!function(e){e[e.ATOMIC=0]="ATOMIC",e[e.UNARY_POSTFIX=1]="UNARY_POSTFIX",e[e.UNARY_PREFIX=2]="UNARY_PREFIX",e[e.MULTIPLICATIVE=3]="MULTIPLICATIVE",e[e.ADDITIVE=4]="ADDITIVE",e[e.SHIFT=5]="SHIFT",e[e.BITWISE_AND=6]="BITWISE_AND",e[e.BITWISE_XOR=7]="BITWISE_XOR",e[e.BITWISE_OR=8]="BITWISE_OR",e[e.RELATIONAL=9]="RELATIONAL",e[e.EQUALITY=10]="EQUALITY",e[e.LOGICAL_AND=11]="LOGICAL_AND",e[e.LOGICAL_OR=12]="LOGICAL_OR",e[e.IF_NULL=13]="IF_NULL",e[e.CONDITIONAL=14]="CONDITIONAL",e[e.CASCADE=15]="CASCADE",e[e.ASSIGNMENT=16]="ASSIGNMENT",e[e.NONE=99]="NONE"}(t||={});var u=class extends i.CodeGenerator$$module$build$src$core$generator{constructor(e="Dart"){super(e),this.isInitialized=!1;for(let i in t)"string"!=typeof(e=t[i])&&(this["ORDER_"+i]=e);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(e){super.init(e),this.nameDB_?this.nameDB_.reset():this.nameDB_=new i.Names$$module$build$src$core$names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);let t=[];var n=i.allDeveloperVariables$$module$build$src$core$variables(e);for(let o=0;o<n.length;o++)t.push(this.nameDB_.getName(n[o],i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));for(e=i.allUsedVarModels$$module$build$src$core$variables(e),n=0;n<e.length;n++)t.push(this.nameDB_.getName(e[n].getId(),i.NameType$$module$build$src$core$names.VARIABLE));t.length&&(this.definitions_.variables="var "+t.join(", ")+";"),this.isInitialized=!0}finish(e){e&&=this.prefixLines(e,this.INDENT),e="main() {\n"+e+"}";let t=[],i=[];for(let n in this.definitions_){let e=this.definitions_[n];e.match(/^import\s/)?t.push(e):i.push(e)}return e=super.finish(e),this.isInitialized=!1,this.nameDB_.reset(),(t.join("\n")+"\n\n"+i.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+e}scrubNakedValue(e){return e+";\n"}quote_(e){return"'"+(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'"))+"'"}multiline_quote_(e){return e.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(e,t,n=!1){let o="";if(!e.outputConnection||!e.outputConnection.targetConnection){var r=e.getCommentText();r&&(r=i.wrap$$module$build$src$core$utils$string(r,this.COMMENT_WRAP-3),o="getProcedureDef"in e?o+this.prefixLines(r+"\n","/// "):o+this.prefixLines(r+"\n","// "));for(let t=0;t<e.inputList.length;t++)e.inputList[t].type===i.inputTypes$$module$build$src$core$input
3s$input_types.VALUE&&(r=e.inputList[t].connection.targetBlock())&&(r=this.allNestedComments(r))&&(o+=this.prefixLines(r,"// "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),o+t+(n=n?"":this.blockToCode(e))}getAdjusted(e,n,o=0,r=!1,s=t.NONE){e.workspace.options.oneBasedIndex&&o--;let a=e.workspace.options.oneBasedIndex?"1":"0",l=s;return o?l=t.ADDITIVE:r&&(l=t.UNARY_PREFIX),e=this.valueToCode(e,n,l)||a,0!==o||r?i.isNumber$$module$build$src$core$utils$string(e)?(e=String(Number(e)+o),r&&(e=String(-Number(e))),e):(o>0?e=`${e} + ${o}`:o<0&&(e=`${e} - ${-o}`),r&&(e=o?`-(${e})`:`-${e}`),Math.floor(s)>=Math.floor(l)&&(e=`(${e})`),e):e}},h={};h.DartGenerator=u,h.Order=t;var d={lists_create_empty:function(e,i){return["[]",t.ATOMIC]},lists_create_with:function(e,i){let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"null";return["["+n.join(", ")+"]",t.ATOMIC]},lists_getIndex:function(e,n){function o(){let e=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE),t="List "+e+" = "+a+";\n";return a=e,t}var r=e.getFieldValue("MODE")||"GET";let s=e.getFieldValue("WHERE")||"FROM_START",a=n.valueToCode(e,"VALUE","RANDOM"===s||"FROM_END"===s?t.NONE:t.UNARY_POSTFIX)||"[]";if(("RANDOM"!==s||"REMOVE"!==r)&&"FROM_END"!==s||a.match(/^\w+$/))switch(s){case"FIRST":if("GET"===r)return[a+".first",t.UNARY_POSTFIX];if("GET_REMOVE"===r)return[a+".removeAt(0)",t.UNARY_POSTFIX];if("REMOVE"===r)return a+".removeAt(0);\n";break;case"LAST":if("GET"===r)return[a+".last",t.UNARY_POSTFIX];if("GET_REMOVE"===r)return[a+".removeLast()",t.UNARY_POSTFIX];if("REMOVE"===r)return a+".removeLast();\n";break;case"FROM_START":if(e=n.getAdjusted(e,"AT"),"GET"===r)return[a+"["+e+"]",t.UNARY_POSTFIX];if("GET_REMOVE"===r)return[a+".removeAt("+e+")",t.UNARY_POSTFIX];if("REMOVE"===r)return a+".removeAt("+e+");\n";break;case"FROM_END":if(e=n.getAdjusted(e,"AT",1,!1,t.ADDITIVE),"GET"===r)return[a+"["+a+".length - "+e+"]",t.UNARY_POSTFIX];if("GET_REMOVE"===r||"REMOVE"===r){if(e=a+".removeAt("+a+".length - "+e+")","GET_REMOVE"===r)return[e,t.UNARY_POSTFIX];if("REMOVE"===r)return e+";\n"}break;case"RANDOM":if(n.definitions_.import_dart_math="import 'dart:math' as Math;","REMOVE"===r)return"int "+(r=n.nameDB_.getDistinctName("tmp_x",i.NameType$$module$build$src$core$names.VARIABLE))+" = new Math.Random().nextInt("+a+".length);\n"+a+".removeAt("+r+");\n";if("GET"===r)return[n.provideFunction_("lists_get_random_item",`\ndynamic ${n.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {\n int x = new Math.Random().nextInt(my_list.length);\n return my_list[x];\n}\n`)+"("+a+")",t.UNARY_POSTFIX];if("GET_REMOVE"===r)return[n.provideFunction_("lists_remove_random_item",`\ndynamic ${n.FUNCTION_NAME_PLACEHOLDER_}(List my_list) {\n int x = new Math.Random().nextInt(my_list.length);\n return my_list.removeAt(x);\n}\n`)+"("+a+")",t.UNARY_POSTFIX]}else{if("RANDOM"===s)return n.definitions_.import_dart_math="import 'dart:math' as Math;",(r=o())+"int "+(e=n.nameDB_.getDistinctName("tmp_x",i.NameType$$module$build$src$core$names.VARIABLE))+" = new Math.Random().nextInt("+a+".length);\n"+a+".removeAt("+e+");\n";if("REMOVE"===r)return r=n.getAdjusted(e,"AT",1,!1,t.ADDITIVE),o()+(a+".removeAt(")+a+".length - "+r+");\n";if("GET"===r)return r=n.getAdjusted(e,"AT",1),[n.provideFunction_("lists_get_from_end",`\ndynamic ${n.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {\n x = my_list.length - x;\n return my_list[x];\n}\n`)+"("+a+", "+r+")",t.UNARY_POSTFIX];if("GET_REMOVE"===r)return r=n.getAdjusted(e,"AT",1),[n.provideFunction_("lists_remove_from_end",`\ndynamic ${n.FUNCTION_NAME_PLACEHOLDER_}(List my_list, num x) {\n x = my_list.length - x;\n return my_list.removeAt(x);\n}\n`)+"("+a+", "+r+")",t.UNARY_POSTFIX]}throw Error("Unhandled combination (lists_getIndex).")},lists_getSublist:function(e,i){let n=i.valueToCode(e,"LIST",t.UNARY_POSTFIX)||"[]";var o=e.getFieldValue("WHERE1");let r=e.getFieldValue("WHERE2");if(n.match(/^\w+$/)||"FROM_END"!==o&&"FROM_START"===r){switch(o){case"FROM_START":o=i.getAdjusted(e,"AT1");break;case"FROM_END":o=n+".length - "+(o=i.getAdjusted(e,"AT1",1,!1,t.ADDITIVE));break;case"FIRST":o="0";break;default:throw Error("Unhandled option (lists_getSublist).")}switch(r){case"FROM_START":var s=i.getAdjusted(e,"AT2",1);break;case"FROM_END":s=n+".length - "+(s=i.getAdjusted(e,"AT2",0,!1,t.ADDITIVE));break;case"LAST":break;default:throw Error("Unhandled option (lists_getSublist).")}i="LAST"===r?n+".sublist("+o+")":n+".sublist("+o+", "+s+")"}else s=i.getAdjusted(e,"AT1"),e=i.getAdjusted(e,"AT2"),i=i.provideFunction_("lists_get_sublist",`\nList ${i.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String where2, num at2) {\n int getAt(String where, num at) {\n if (where == 'FROM_END') {\n at = list.length - 1 - at;\n } else if (where == 'FIRST') {\n at = 0;\n } else if (where == 'LAST') {\n at = list.length - 1;\n } else if (where != 'FROM_START') {\n throw 'Unhandled option (lists_getSublist).';\n }\n return at;\n }\n at1 = getAt(where1, at1);\n at2 = getAt(where2, at2) + 1;\n return list.sublist(at1, at2);\n}\n`)+"("+n+", '"+o+"', "+s+", '"+r+"', "+e+")";return[i,t.UNARY_POSTFIX]},lists_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"indexOf":"lastIndexOf",o=i.valueToCode(e,"FIND",t.NONE)||"''";return i=(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"[]")+"."+n+"("+o+")",e.workspace.options.oneBasedIndex?[
3i+" + 1",t.ADDITIVE]:[i,t.UNARY_POSTFIX]},lists_isEmpty:function(e,i){return[(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"[]")+".isEmpty",t.UNARY_POSTFIX]},lists_length:function(e,i){return[(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"[]")+".length",t.UNARY_POSTFIX]},lists_repeat:function(e,i){let n=i.valueToCode(e,"ITEM",t.NONE)||"null";return["new List.filled("+(i.valueToCode(e,"NUM",t.NONE)||"0")+", "+n+")",t.UNARY_POSTFIX]},lists_reverse:function(e,i){return["new List.from("+(i.valueToCode(e,"LIST",t.NONE)||"[]")+".reversed)",t.UNARY_POSTFIX]},lists_setIndex:function(e,n){function o(){if(a.match(/^\w+$/))return"";let e=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE),t="List "+e+" = "+a+";\n";return a=e,t}let r=e.getFieldValue("MODE")||"GET";var s=e.getFieldValue("WHERE")||"FROM_START";let a=n.valueToCode(e,"LIST",t.UNARY_POSTFIX)||"[]",l=n.valueToCode(e,"TO",t.ASSIGNMENT)||"null";switch(s){case"FIRST":if("SET"===r)return a+"[0] = "+l+";\n";if("INSERT"===r)return a+".insert(0, "+l+");\n";break;case"LAST":if("SET"===r)return o()+(a+"[")+a+".length - 1] = "+l+";\n";if("INSERT"===r)return a+".add("+l+");\n";break;case"FROM_START":if(e=n.getAdjusted(e,"AT"),"SET"===r)return a+"["+e+"] = "+l+";\n";if("INSERT"===r)return a+".insert("+e+", "+l+");\n";break;case"FROM_END":if(e=n.getAdjusted(e,"AT",1,!1,t.ADDITIVE),s=o(),"SET"===r)return s+(a+"[")+a+".length - "+e+"] = "+l+";\n";if("INSERT"===r)return s+(a+".insert(")+a+".length - "+e+", "+l+");\n";break;case"RANDOM":if(n.definitions_.import_dart_math="import 'dart:math' as Math;",e=o(),e+="int "+(s=n.nameDB_.getDistinctName("tmp_x",i.NameType$$module$build$src$core$names.VARIABLE))+" = new Math.Random().nextInt("+a+".length);\n","SET"===r)return e+(a+"[")+s+"] = "+l+";\n";if("INSERT"===r)return e+(a+".insert(")+s+", "+l+");\n"}throw Error("Unhandled combination (lists_setIndex).")},lists_sort:function(e,i){let n=i.valueToCode(e,"LIST",t.NONE)||"[]",o="1"===e.getFieldValue("DIRECTION")?1:-1;return e=e.getFieldValue("TYPE"),[i.provideFunction_("lists_sort",`\nList ${i.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {\n var compareFuncs = {\n 'NUMERIC': (a, b) => (direction * a.compareTo(b)).toInt(),\n 'TEXT': (a, b) => direction * a.toString().compareTo(b.toString()),\n 'IGNORE_CASE':\n (a, b) => direction *\n a.toString().toLowerCase().compareTo(b.toString().toLowerCase())\n };\n list = new List.from(list);\n var compare = compareFuncs[type];\n list.sort(compare);\n return list;\n}\n`)+"("+n+', "'+e+'", '+o+")",t.UNARY_POSTFIX]},lists_split:function(e,i){let n=i.valueToCode(e,"INPUT",t.UNARY_POSTFIX);if(i=i.valueToCode(e,"DELIM",t.NONE)||"''","SPLIT"===(e=e.getFieldValue("MODE")))n||="''",e="split";else{if("JOIN"!==e)throw Error("Unknown mode: "+e);n||="[]",e="join"}return[n+"."+e+"("+i+")",t.UNARY_POSTFIX]}},p={};p.controls_if=n,p.controls_ifelse=n,p.logic_boolean=function(e,i){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",t.ATOMIC]},p.logic_compare=function(e,i){let n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],o="=="===n||"!="===n?t.EQUALITY:t.RELATIONAL;return[(i.valueToCode(e,"A",o)||"0")+" "+n+" "+(e=i.valueToCode(e,"B",o)||"0"),o]},p.logic_negate=function(e,i){let n=t.UNARY_PREFIX;return["!"+(i.valueToCode(e,"BOOL",n)||"true"),n]},p.logic_null=function(e,i){return["null",t.ATOMIC]},p.logic_operation=function(e,i){let n="AND"===e.getFieldValue("OP")?"&&":"||",o="&&"===n?t.LOGICAL_AND:t.LOGICAL_OR,r=i.valueToCode(e,"A",o);return e=i.valueToCode(e,"B",o),r||e?(i="&&"===n?"true":"false",r||=i,e||=i):e=r="false",[r+" "+n+" "+e,o]},p.logic_ternary=function(e,i){return[(i.valueToCode(e,"IF",t.CONDITIONAL)||"false")+" ? "+(i.valueToCode(e,"THEN",t.CONDITIONAL)||"null")+" : "+(e=i.valueToCode(e,"ELSE",t.CONDITIONAL)||"null"),t.CONDITIONAL]};var f={controls_flow_statements:function(e,t){let i="";if(t.STATEMENT_PREFIX&&(i+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(i+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){let n=e.getSurroundLoop();n&&!n.suppressPrefixSuffix&&(i+=t.injectId(t.STATEMENT_PREFIX,n))}switch(e.getFieldValue("FLOW")){case"BREAK":return i+"break;\n";case"CONTINUE":return i+"continue;\n"}throw Error("Unknown flow statement.")},controls_for:function(e,n){var o=n.getVariableName(e.getFieldValue("VAR")),r=n.valueToCode(e,"FROM",t.ASSIGNMENT)||"0",s=n.valueToCode(e,"TO",t.ASSIGNMENT)||"0";let a=n.valueToCode(e,"BY",t.ASSIGNMENT)||"1",l=n.statementToCode(e,"DO");
3if(l=n.addLoopTrap(l,e),i.isNumber$$module$build$src$core$utils$string(r)&&i.isNumber$$module$build$src$core$utils$string(s)&&i.isNumber$$module$build$src$core$utils$string(a))e="for ("+o+" = "+r+"; "+o+((n=Number(r)<=Number(s))?" <= ":" >= ")+s+"; "+o,e=1===(o=Math.abs(Number(a)))?e+(n?"++":"--"):e+(n?" += ":" -= ")+o,e+=") {\n"+l+"}\n";else{e="";let t=r;r.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(r)||(t=n.nameDB_.getDistinctName(o+"_start",i.NameType$$module$build$src$core$names.VARIABLE),e+="var "+t+" = "+r+";\n"),r=s,s.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(s)||(e+="var "+(r=n.nameDB_.getDistinctName(o+"_end",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+s+";\n"),e+="num "+(s=n.nameDB_.getDistinctName(o+"_inc",i.NameType$$module$build$src$core$names.VARIABLE))+" = ",e=i.isNumber$$module$build$src$core$utils$string(a)?e+(Math.abs(Number(a))+";\n"):e+"("+a+").abs();\n",e+="if ("+t+" > "+r+") {\n",e=(e+=n.INDENT+s+" = -"+s+";\n")+"}\nfor ("+o+" = "+t+"; "+s+" >= 0 ? "+o+" <= "+r+" : "+o+" >= "+r+"; "+o+" += "+s+") {\n"+l+"}\n"}return e},controls_forEach:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR")),o=i.valueToCode(e,"LIST",t.ASSIGNMENT)||"[]",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e),"for (var "+n+" in "+o+") {\n"+r+"}\n"}};f.controls_repeat=o,f.controls_repeat_ext=o,f.controls_whileUntil=function(e,i){let n="UNTIL"===e.getFieldValue("MODE"),o=i.valueToCode(e,"BOOL",n?t.UNARY_PREFIX:t.NONE)||"false",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e),n&&(o="!"+o),"while ("+o+") {\n"+r+"}\n"};var g={math_arithmetic:function(e,i){var n={ADD:[" + ",t.ADDITIVE],MINUS:[" - ",t.ADDITIVE],MULTIPLY:[" * ",t.MULTIPLICATIVE],DIVIDE:[" / ",t.MULTIPLICATIVE],POWER:[null,t.NONE]}[e.getFieldValue("OP")];let o=n[0];n=n[1];let r=i.valueToCode(e,"A",n)||"0";return e=i.valueToCode(e,"B",n)||"0",o?[r+o+e,n]:(i.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+r+", "+e+")",t.UNARY_POSTFIX])},math_atan2:function(e,i){i.definitions_.import_dart_math="import 'dart:math' as Math;";let n=i.valueToCode(e,"X",t.NONE)||"0";return["Math.atan2("+(i.valueToCode(e,"Y",t.NONE)||"0")+", "+n+") / Math.pi * 180",t.MULTIPLICATIVE]},math_change:function(e,i){let n=i.valueToCode(e,"DELTA",t.ADDITIVE)||"0";return(e=i.getVariableName(e.getFieldValue("VAR")))+" = ("+e+" is num ? "+e+" : 0) + "+n+";\n"},math_constant:function(e,i){let n={PI:["Math.pi",t.UNARY_POSTFIX],E:["Math.e",t.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",t.MULTIPLICATIVE],SQRT2:["Math.sqrt2",t.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",t.UNARY_POSTFIX],INFINITY:["double.infinity",t.ATOMIC]};return"INFINITY"!==(e=e.getFieldValue("CONSTANT"))&&(i.definitions_.import_dart_math="import 'dart:math' as Math;"),n[e]},math_constrain:function(e,i){return i.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.min(Math.max("+(i.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(i.valueToCode(e,"LOW",t.NONE)||"0")+"), "+(e=i.valueToCode(e,"HIGH",t.NONE)||"double.infinity")+")",t.UNARY_POSTFIX]},math_modulo:function(e,i){return[(i.valueToCode(e,"DIVIDEND",t.MULTIPLICATIVE)||"0")+" % "+(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"),t.MULTIPLICATIVE]},math_number:function(e,i){return(e=Number(e.getFieldValue("NUM")))===1/0?["double.infinity",t.UNARY_POSTFIX]:e===-1/0?["-double.infinity",t.UNARY_PREFIX]:[String(e),e<0?t.UNARY_PREFIX:t.ATOMIC]},math_number_property:function(e,i){var n={EVEN:[" % 2 == 0",t.MULTIPLICATIVE,t.EQUALITY],ODD:[" % 2 == 1",t.MULTIPLICATIVE,t.EQUALITY],WHOLE:[" % 1 == 0",t.MULTIPLICATIVE,t.EQUALITY],POSITIVE:[" > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[" < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,t.MULTIPLICATIVE,t.EQUALITY],PRIME:[null,t.NONE,t.UNARY_POSTFIX]};let o=e.getFieldValue("PROPERTY"),[r,s,a]=n[o];if(n=i.valueToCode(e,"NUMBER_TO_CHECK",s)||"0","PRIME"===o)i.definitions_.import_dart_math="import 'dart:math' as Math;",e=i.provideFunction_("math_isPrime",`\nbool ${i.FUNCTION_NAME_PLACEHOLDER_}(n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if (n == 2 || n == 3) {\n return true;\n }\n // False if n is null, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (n == null || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {\n if (n % (x - 1) == 0 || n % (x + 1) == 0) {\n return false;\n }\n }\n return true;\n}\n`)+"("+n+")";else if("DIVISIBLE_BY"===o){if("0"===(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"))return["false",t.ATOMIC];e=n+" % "+e+" == 0"}else e=n+r;return[e,a]},math_on_list:function(e,i){let n=e.getFieldValue("OP");switch(e=i.valueToCode(e,"LIST",t.NONE)||"[]",n){case"SUM":i=i.provideFunction_("math_sum",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {\n num sumVal = 0;\n myList.forEach((num entry) {sumVal += entry;});\n return sumVal;\n}\n`)+"("+e+")";break;case"MIN":i.definitions_.import_dart_math="import 'dart:math' as Math;",i=i.provideFunction_("math_min",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {\n if (myList.isEmpty) return null;\n num minVal = myList[0];\n myList.forEach((num entry) {minVal = Math.min(minVal, entry);});\n return minVal;\n}\n`)+"("+e+")";break;case"MAX":i.definitions_.import_dart_math="import 'dart:math' as Math;",i=i.provideFunction_("math_max",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List<num> myList) {\n if (myList.isEmpty) return null;\n num maxVal = myList[0];\n myList.forEach((num entry) {maxVal = Math.max(maxVal, entry);});\n return maxVal;\n}\n`)+"("+e+")";break;case"AVERAGE":i=i.provideFunction_("math_mean",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List myList) {\n // First filter list for numbers only.\n List localList = new List.from(myList);\n localList.removeWhere((a) => a is! num);\n if (localList.isEmpty) return null;\n num sumVal = 0;\n localList.forEach((var entry) {sumVal += entry;});\n return sumVal / localList.length;\n}\n`)+"("+e+")";break;case"MEDIAN":i=i.provideFunction_("math_median",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List myList) {\n // First filter list for numbers only, then sort, then return middle value\n // or the average of two middle values if list has an even number of elements.\n List localList = new List.from(myList);\n localList.removeWhere((a) => a is! num);\n if (localList.isEmpty) return null;\n localList.sort((a, b) => (a - b));\n int index = localList.length ~/ 2;\n if (localList.length % 2 == 1) {\n return localList[index];\n } else {\n return (localList[index - 1] + localList[index]) / 2;\n }\n}\n`)+"("+e+")";break;case"MODE":i.definitions_.import_dart_math="import 'dart:math' as Math;",i=i.provideFunction_("math_modes",`\nList ${i.FUNCTION_NAME_PLACEHOLDER_}(List values) {\n List modes = [];\n List counts = [];\n int maxCount = 0;\n for (int i = 0; i < values.length;
3 i++) {\n var value = values[i];\n bool found = false;\n int thisCount;\n for (int j = 0; j < counts.length; j++) {\n if (counts[j][0] == value) {\n thisCount = ++counts[j][1];\n found = true;\n break;\n }\n }\n if (!found) {\n counts.add([value, 1]);\n thisCount = 1;\n }\n maxCount = Math.max(thisCount, maxCount);\n }\n for (int j = 0; j < counts.length; j++) {\n if (counts[j][1] == maxCount) {\n modes.add(counts[j][0]);\n }\n }\n return modes;\n}\n`)+"("+e+")";break;case"STD_DEV":i.definitions_.import_dart_math="import 'dart:math' as Math;",i=i.provideFunction_("math_standard_deviation",`\nnum ${i.FUNCTION_NAME_PLACEHOLDER_}(List myList) {\n // First filter list for numbers only.\n List numbers = new List.from(myList);\n numbers.removeWhere((a) => a is! num);\n if (numbers.isEmpty) return null;\n num n = numbers.length;\n num sum = 0;\n numbers.forEach((x) => sum += x);\n num mean = sum / n;\n num sumSquare = 0;\n numbers.forEach((x) => sumSquare += Math.pow(x - mean, 2));\n return Math.sqrt(sumSquare / n);\n}\n`)+"("+e+")";break;case"RANDOM":i.definitions_.import_dart_math="import 'dart:math' as Math;",i=i.provideFunction_("math_random_item",`\ndynamic ${i.FUNCTION_NAME_PLACEHOLDER_}(List myList) {\n int x = new Math.Random().nextInt(myList.length);\n return myList[x];\n}\n`)+"("+e+")";break;default:throw Error("Unknown operator: "+n)}return[i,t.UNARY_POSTFIX]},math_random_float:function(e,i){return i.definitions_.import_dart_math="import 'dart:math' as Math;",["new Math.Random().nextDouble()",t.UNARY_POSTFIX]},math_random_int:function(e,i){i.definitions_.import_dart_math="import 'dart:math' as Math;";let n=i.valueToCode(e,"FROM",t.NONE)||"0";return e=i.valueToCode(e,"TO",t.NONE)||"0",[i.provideFunction_("math_random_int",`\nint ${i.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {\n if (a > b) {\n // Swap a and b to ensure a is smaller.\n num c = a;\n a = b;\n b = c;\n }\n return new Math.Random().nextInt(b - a + 1) + a;\n}\n`)+"("+n+", "+e+")",t.UNARY_POSTFIX]}};g.math_round=r,g.math_single=r,g.math_trig=r;var m={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+";\n"},procedures_callreturn:function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME")),o=[],r=e.getVars();for(let s=0;s<r.length;s++)o[s]=i.valueToCode(e,"ARG"+s,t.NONE)||"null";return[n+"("+o.join(", ")+")",t.UNARY_POSTFIX]}};m.procedures_defnoreturn=s,m.procedures_defreturn=s,m.procedures_ifreturn=function(e,i){let n="if ("+(i.valueToCode(e,"CONDITION",t.NONE)||"false")+") {\n";return i.STATEMENT_SUFFIX&&(n+=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)),e.hasReturnValue_?(e=i.valueToCode(e,"VALUE",t.NONE)||"null",n+=i.INDENT+"return "+e+";\n"):n+=i.INDENT+"return;\n",n+"}\n"};var T={text:function(e,i){return[i.quote_(e.getFieldValue("TEXT")),t.ATOMIC]},text_append:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR"));return n+" = ["+n+", "+(e=i.valueToCode(e,"TEXT",t.NONE)||"''")+"].join();\n"},text_changeCase:function(e,i){let n={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[e.getFieldValue("CASE")];return e=i.valueToCode(e,"TEXT",n?t.UNARY_POSTFIX:t.NONE)||"''",[n?e+n:i.provideFunction_("text_toTitleCase",`\nString ${i.FUNCTION_NAME_PLACEHOLDER_}(String str) {\n RegExp exp = new RegExp(r'\\b');\n List<String> list = str.split(exp);\n final title = new StringBuffer();\n for (String part in list) {\n if (part.length > 0) {\n title.write(part[0].toUpperCase());\n if (part.length > 0) {\n title.write(part.substring(1).toLowerCase());\n }\n }\n }\n return title.toString();\n}\n`)+"("+e+")",t.UNARY_POSTFIX]},text_charAt:function(e,i){let n=e.getFieldValue("WHERE")||"FROM_START",o=i.valueToCode(e,"VALUE","FIRST"===n||"FROM_START"===n?t.UNARY_POSTFIX:t.NONE)||"''";switch(n){case"FIRST":return[o+"[0]",t.UNARY_POSTFIX];case"FROM_START":return[o+"["+(e=i.getAdjusted(e,"AT"))+"]",t.UNARY_POSTFIX];case"LAST":case"FROM_END":return e="LAST"===n?1:i.getAdjusted(e,"AT",1),[`${i.provideFunction_("text_get_from_end",`\nString ${i.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {\n return text[text.length - x];\n}\n`)}(${o}, ${e})`,t.UNARY_POSTFIX];case"RANDOM":return i.definitions_.import_dart_math="import 'dart:math' as Math;",[i.provideFunction_("text_random_letter",`\nString ${i.FUNCTION_NAME_PLACEHOLDER_}(String text) {\n int x = new Math.Random().nextInt(text.length);\n return text[x];\n}\n`)+"("+o+")",t.UNARY_POSTFIX]}throw Error("Unhandled option (text_charAt).")},text_count:function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''";return e=i.valueToCode(e,"SUB",t.NONE)||"''",[i.provideFunction_("text_count",`\nint ${i.FUNCTION_NAME_PLACEHOLDER_}(String haystack, String needle) {\n if (needle.length == 0) {\n return haystack.length + 1;\n }\n int index = 0;\n int count = 0;\n while (index != -1) {\n index = haystack.indexOf(needle, index);\n if (index != -1) {\n count++;\n index += needle.length;\n }\n }\n return count;\n}\n`)+"("+n+", "+e+")",t.UNARY_POSTFIX]},text_getSubstring:function(e,i){var n=e.getFieldValue("WHERE1");let o=e.getFieldValue("WHERE2"),r="FROM_END"!==n&&"FROM_START"===o,s=i.valueToCode(e,"STRING",r?t.UNARY_POSTFIX:t.NONE)||"''";if("FIRST"===n&&"LAST"===o)return[s,t.NONE];if(s.match(/^'?\w+'?$/)||r){switch(n){case"FROM_START":n=i.getAdjusted(e,"AT1");break;case"FROM_END":n=s+".length - "+(n=i.getAdjusted(e,"AT1",1,!1,t.ADDITIVE));break;case"FIRST":n="0";break;default:throw Error("Unhandled option (text_getSubstring).")}switch(o){case"FROM_START":var a=i.getAdjusted(e,"AT2",1);break;case"FROM_END":a=s+".length - "+(a=i.getAdjusted(e,"AT2",0,!1,t.ADDITIVE));break;case"LAST":break;default:throw Error("Unhandled option (text_getSubstring).")}i="LAST"===o?s+".substring("+n+")":s+".substring("+n+", "+a+")"}else a=i.getAdjusted(e,"AT1"),e=i.getAdjusted(e,"AT2"),i=i.provideFunction_("text_get_substring",`\nString ${i.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, String where2, num at2) {\n int getAt(String where, num at) {\n if (where == 'FROM_END') {\n at = text.length - 1 - at;\n } else if (where == 'FIRST') {\n at = 0;\n } else if (where == 'LAST') {\n at = text.length - 1;\n } else if (where != 'FROM_START') {\n throw 'Unhandled option (text_getSubstring).';\n }\n return at;\n }\n at1 = getAt(where1, at1);\n at2 = getAt(where2, at2) + 1;
3\n return text.substring(at1, at2);\n}\n`)+"("+s+", '"+n+"', "+a+", '"+o+"', "+e+")";return[i,t.UNARY_POSTFIX]},text_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"indexOf":"lastIndexOf",o=i.valueToCode(e,"FIND",t.NONE)||"''";return i=(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"''")+"."+n+"("+o+")",e.workspace.options.oneBasedIndex?[i+" + 1",t.ADDITIVE]:[i,t.UNARY_POSTFIX]},text_isEmpty:function(e,i){return[(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"''")+".isEmpty",t.UNARY_POSTFIX]},text_join:function(e,i){switch(e.itemCount_){case 0:return["''",t.ATOMIC];case 1:return[(i.valueToCode(e,"ADD0",t.UNARY_POSTFIX)||"''")+".toString()",t.UNARY_POSTFIX];default:let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"''";return["["+n.join(",")+"].join()",t.UNARY_POSTFIX]}},text_length:function(e,i){return[(i.valueToCode(e,"VALUE",t.UNARY_POSTFIX)||"''")+".length",t.UNARY_POSTFIX]},text_print:function(e,i){return"print("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+");\n"}};T.text_prompt=a,T.text_prompt_ext=a,T.text_replace=function(e,i){return[(i.valueToCode(e,"TEXT",t.UNARY_POSTFIX)||"''")+".replaceAll("+(i.valueToCode(e,"FROM",t.NONE)||"''")+", "+(e=i.valueToCode(e,"TO",t.NONE)||"''")+")",t.UNARY_POSTFIX]},T.text_reverse=function(e,i){return["new String.fromCharCodes("+(i.valueToCode(e,"TEXT",t.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",t.UNARY_PREFIX]},T.text_trim=function(e,i){let n={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[e.getFieldValue("MODE")];return[(i.valueToCode(e,"TEXT",t.UNARY_POSTFIX)||"''")+n,t.UNARY_POSTFIX]};var _={};_.variables_get=l,_.variables_set=c;var E={};E.variables_get_dynamic=l,E.variables_set_dynamic=c;var b=new u;b.addReservedWords("Html,Math");var O=Object.assign({},d,p,f,g,m,T,_,E);for(let I in O)b.forBlock[I]=O[I];var v={};return v.DartGenerator=u,v.Order=t,v.dartGenerator=b,v.__namespace__=i,v})}),iN=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):(i.lua=n(i.Blockly),i.Blockly.Lua=i.lua.luaGenerator)}(e,function(e){var t,i=e.__namespace__,n=function(e,i){var n=0;let o="";i.STATEMENT_PREFIX&&(o+=i.injectId(i.STATEMENT_PREFIX,e));do{let r=i.valueToCode(e,"IF"+n,t.NONE)||"false",s=i.statementToCode(e,"DO"+n);i.STATEMENT_SUFFIX&&(s=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+s),o+=(n>0?"else":"")+"if "+r+" then\n"+s,n++}while(e.getInput("IF"+n));return(e.getInput("ELSE")||i.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")?i.statementToCode(e,"ELSE"):"",i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),o+="else\n"+n),o+"end\n"},o=function(e,t){return e.includes(m)?e+t+"::continue::\n":e},r=function(e,n){let r;r=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):n.valueToCode(e,"TIMES",t.NONE)||"0",r=i.isNumber$$module$build$src$core$utils$string(r)?parseInt(r,10):"math.floor("+r+")";let s=n.statementToCode(e,"DO");return s=n.addLoopTrap(s,e),s=o(s,n.INDENT),"for "+n.nameDB_.getDistinctName("count",i.NameType$$module$build$src$core$names.VARIABLE)+" = 1, "+r+" do\n"+s+"end\n"},s=function(e,i){var n=e.getFieldValue("OP");if("NEG"===n)return["-"+(e=i.valueToCode(e,"NUM",t.UNARY)||"0"),t.UNARY];if("POW10"===n)return["10 ^ "+(e=i.valueToCode(e,"NUM",t.EXPONENTIATION)||"0"),t.EXPONENTIATION];switch(e="ROUND"===n?i.valueToCode(e,"NUM",t.ADDITIVE)||"0":i.valueToCode(e,"NUM",t.NONE)||"0",n){case"ABS":n="math.abs("+e+")";break;case"ROOT":n="math.sqrt("+e+")";break;case"LN":n="math.log("+e+")";break;case"LOG10":n="math.log("+e+", 10)";break;case"EXP":n="math.exp("+e+")";break;case"ROUND":n="math.floor("+e+" + .5)";break;case"ROUNDUP":n="math.ceil("+e+")";break;case"ROUNDDOWN":n="math.floor("+e+")";break;case"SIN":n="math.sin(math.rad("+e+"))";break;case"COS":n="math.cos(math.rad("+e+"))";break;case"TAN":n="math.tan(math.rad("+e+"))";break;case"ASIN":n="math.deg(math.asin("+e+"))";break;case"ACOS":n="math.deg(math.acos("+e+"))";break;case"ATAN":n="math.deg(math.atan("+e+"))";break;default:throw Error("Unknown math operator: "+n)}return[n,t.HIGH]},a=function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME"));var o="";i.STATEMENT_PREFIX&&(o+=i.injectId(i.STATEMENT_PREFIX,e)),i.STATEMENT_SUFFIX&&(o+=i.injectId(i.STATEMENT_SUFFIX,e)),o&&=i.prefixLines(o,i.INDENT);let r="";i.INFINITE_LOOP_TRAP&&(r=i.prefixLines(i.injectId(i.INFINITE_LOOP_TRAP,e),i.INDENT));let s="";e.getInput("STACK")&&(s=i.statementToCode(e,"STACK"));let a="";e.getInput("RETURN")&&(a=i.valueToCode(e,"RETURN",t.NONE)||"");let l="";s&&a&&(l=o),a?a=i.INDENT+"return "+a+"\n":s||="";let c=[],u=e.getVars();for(let t=0;t<u.length;t++)c[t]=i.getVariableName(u[t]);return o="function "+n+"("+c.join(", ")+")\n"+o+r+s+l+a+"end\n",o=i.scrub_(e,o),i.definitions_["%"+n]=o,null},l=function(e,i){let n;return n=e.getField("TEXT")?i.quote_(e.getFieldValue("TEXT")):i.valueToCode(e,"TEXT",t.NONE)||"''",i=i.provideFunction_("text_prompt",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(msg)\n io.write(msg)\n io.flush()\n return io.read()\nend\n`)+"("+n+")","NUMBER"===e.getFieldValue("TYPE")&&(i="tonumber("+i+", 10)"),[i,t.HIGH]},c=function(e,i){return[i.getVariableName(e.getFieldValue("VAR")),t.ATOMIC]},u=function(e,i){let n=i.valueToCode(e,"VALUE",t.NONE)||"0";return i.getVariableName(e.getFieldValue("VAR"))+" = "+n+"\n"};!function(e){e[e.ATOMIC=0]="ATOMIC",e[e.HIGH=1]="HIGH",e[e.EXPONENTIATION=2]="EXPONENTIATION",e[e.UNARY=3]="UNARY",e[e.MULTIPLICATIVE=4]="MULTIPLICATIVE",e[e.ADDITIVE=5]="ADDITIVE",e[e.CONCATENATION=6]="CONCATENATION",e[e.RELATIONAL=7]="RELATIONAL",e[e.AND=8]="AND",e[e.OR=9]="OR",e[e.NONE=99]="NONE"}(t||={});var h=class extends i.CodeGenerator$$module$build$src$core$generator{constructor(e="Lua"){super(e),this.isInitialized=!1;for(let i in t)"string"!=typeof(e=t[i])&&(this["ORDER_"+i]=e);this.addReservedWords("_,__inext,assert,bit,colors,colours,coroutine,disk,dofile,error,fs,fetfenv,getmetatable,gps,help,io,ipairs,keys,loadfile,loadstring,math,native,next,os,paintutils,pairs,parallel,pcall,peripheral,print,printError,rawequal,rawget,rawset,read,rednet,redstone,rs,select,setfenv,setmetatable,sleep,string,table,term,textutils,tonumber,tostring,turtle,type,unpack,vector,write,xpcall,_VERSION,__indext,HTTP,and,break,do,else,elseif,end,false,for,function,if,in,local,nil,not,or,repeat,return,then,true,until,while,add,sub,mul,div,mod,pow,unm,concat,len,eq,lt,le,index,newindex,call,assert,collectgarbage,dofile,error,_G,getmetatable,inpairs,load,loadfile,next,pairs,pcall,print,rawequal,rawget,rawlen,rawset,select,setmetatable,tonumber,tostring,type,_VERSION,xpcall,require,package,string,table,math,bit32,io,file,os,debug")}init(e){super.init(e),this.nameDB_?this.nameDB_.reset():this.nameDB_=new i.Names$$module$build$src$core$names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e),this.isInitialized=!0}finish(e){let t=Object.values(this.definitions_);return e=super.finish(e),this.isInitialized=!1,this.nameDB_.reset(),t.join("\n\n")+"\n\n\n"+e}scrubNakedValue(e){return"local _ = "+e+"\n"}quote_(e){return"'"+(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'"))+"'"}multiline_quote_(e){return e.split(/\n/g).map(this.quote_).join(" .. '\\n' ..\n")}scrub_(e,t,n=!1){let o="";if(!e.outputConnection||!e.outputConnection.targetConnection){var r=e.getCommentText();r&&(r=i.wrap$$module$build$src$core$utils$string(r,this.COMMENT_WRAP-3),o+=this.prefixLines(r,"-- ")+"\n");for(let t=0;t<e.inputList.length;t++)e.inputList[t].type===i.inputTypes$$module$build$src$core$input
3s$input_types.VALUE&&(r=e.inputList[t].connection.targetBlock())&&(r=this.allNestedComments(r))&&(o+=this.prefixLines(r,"-- "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),o+t+(n=n?"":this.blockToCode(e))}},d={};d.LuaGenerator=h,d.Order=t;var p=function(e,t,i){return"FIRST"===t?"1":"FROM_END"===t?"#"+e+" + 1 - "+i:"LAST"===t?"#"+e:"RANDOM"===t?"math.random(#"+e+")":i},f={lists_create_empty:function(e,i){return["{}",t.HIGH]},lists_create_with:function(e,i){let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"nil";return["{"+n.join(", ")+"}",t.HIGH]},lists_getIndex:function(e,n){var o=e.getFieldValue("MODE")||"GET",r=e.getFieldValue("WHERE")||"FROM_START";let s=n.valueToCode(e,"VALUE",t.HIGH)||"({})";return"LAST"!==r&&"FROM_END"!==r&&"RANDOM"!==r||s.match(/^\w+$/)?(n=n.valueToCode(e,"AT","GET"===o&&"FROM_END"===r?t.ADDITIVE:t.NONE)||"1",n=p(s,r,n),"GET"===o?[s+"["+n+"]",t.HIGH]:(r="table.remove("+s+", "+n+")","GET_REMOVE"===o?[r,t.HIGH]:r+"\n")):"REMOVE"===o?(o=n.valueToCode(e,"AT","FROM_END"===r?t.ADDITIVE:t.NONE)||"1",(n=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+s+"\ntable.remove("+n+", "+(o=p(n,r,o))+")\n"):(e=n.valueToCode(e,"AT",t.NONE)||"1",[("GET"===o?n.provideFunction_("list_get_"+r.toLowerCase(),["function "+n.FUNCTION_NAME_PLACEHOLDER_+"(t"+("FROM_END"===r||"FROM_START"===r?", at)":")")," return t["+p("t",r,"at")+"]","end"]):n.provideFunction_("list_remove_"+r.toLowerCase(),["function "+n.FUNCTION_NAME_PLACEHOLDER_+"(t"+("FROM_END"===r||"FROM_START"===r?", at)":")")," return table.remove(t, "+p("t",r,"at")+")","end"]))+"("+s+("FROM_END"===r||"FROM_START"===r?", "+e:"")+")",t.HIGH])},lists_getSublist:function(e,i){let n=i.valueToCode(e,"LIST",t.NONE)||"{}",o=e.getFieldValue("WHERE1"),r=e.getFieldValue("WHERE2"),s=i.valueToCode(e,"AT1",t.NONE)||"1";e=i.valueToCode(e,"AT2",t.NONE)||"1";let a="FROM_END"===o||"FROM_START"===o?", at1":"",l="FROM_END"===r||"FROM_START"===r?", at2":"";return[i.provideFunction_("list_sublist_"+o.toLowerCase()+"_"+r.toLowerCase(),`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(source${a}${l})\n local t = {}\n local start = ${p("source",o,"at1")}\n local finish = ${p("source",r,"at2")}\n for i = start, finish do\n table.insert(t, source[i])\n end\n return t\nend\n`)+"("+n+("FROM_END"===o||"FROM_START"===o?", "+s:"")+("FROM_END"===r||"FROM_START"===r?", "+e:"")+")",t.HIGH]},lists_indexOf:function(e,i){let n=i.valueToCode(e,"FIND",t.NONE)||"''",o=i.valueToCode(e,"VALUE",t.NONE)||"{}";return[("FIRST"===e.getFieldValue("END")?i.provideFunction_("first_index",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t, elem)\n for k, v in ipairs(t) do\n if v == elem then\n return k\n end\n end\n return 0\nend\n`):i.provideFunction_("last_index",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t, elem)\n for i = #t, 1, -1 do\n if t[i] == elem then\n return i\n end\n end\n return 0\nend\n`))+"("+o+", "+n+")",t.HIGH]},lists_isEmpty:function(e,i){return["#"+(i.valueToCode(e,"VALUE",t.UNARY)||"{}")+" == 0",t.RELATIONAL]},lists_length:function(e,i){return["#"+(i.valueToCode(e,"VALUE",t.UNARY)||"{}"),t.UNARY]},lists_repeat:function(e,i){return[i.provideFunction_("create_list_repeated",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(item, count)\n local t = {}\n for i = 1, count do\n table.insert(t, item)\n end\n return t\nend\n `)+"("+(i.valueToCode(e,"ITEM",t.NONE)||"nil")+", "+(e=i.valueToCode(e,"NUM",t.NONE)||"0")+")",t.HIGH]},lists_reverse:function(e,i){return e=i.valueToCode(e,"LIST",t.NONE)||"{}",[i.provideFunction_("list_reverse",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(input)\n local reversed = {}\n for i = #input, 1, -1 do\n table.insert(reversed, input[i])\n end\n return reversed\nend\n`)+"("+e+")",t.HIGH]},lists_setIndex:function(e,n){let o=n.valueToCode(e,"LIST",t.HIGH)||"{}",r=e.getFieldValue("MODE")||"SET",s=e.getFieldValue("WHERE")||"FROM_START",a=n.valueToCode(e,"AT",t.ADDITIVE)||"1";e=n.valueToCode(e,"TO",t.NONE)||"Nil";let l="";return"LAST"!==s&&"FROM_END"!==s&&"RANDOM"!==s||o.match(/^\w+$/)||(l=(n=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+o+"\n",o=n),l="SET"
3===r?l+(o+"[")+p(o,s,a)+"] = "+e:l+"table.insert("+o+", "+p(o,s,a)+("LAST"===s?" + 1":"")+", "+e+")",l+"\n"},lists_sort:function(e,i){let n=i.valueToCode(e,"LIST",t.NONE)||"{}",o="1"===e.getFieldValue("DIRECTION")?1:-1;return e=e.getFieldValue("TYPE"),[i.provideFunction_("list_sort",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(list, typev, direction)\n local t = {}\n for n,v in pairs(list) do table.insert(t, v) end\n local compareFuncs = {\n NUMERIC = function(a, b)\n return (tonumber(tostring(a)) or 0)\n < (tonumber(tostring(b)) or 0) end,\n TEXT = function(a, b)\n return tostring(a) < tostring(b) end,\n IGNORE_CASE = function(a, b)\n return string.lower(tostring(a)) < string.lower(tostring(b)) end\n }\n local compareTemp = compareFuncs[typev]\n local compare = compareTemp\n if direction == -1\n then compare = function(a, b) return compareTemp(b, a) end\n end\n table.sort(t, compare)\n return t\nend\n`)+"("+n+',"'+e+'", '+o+")",t.HIGH]},lists_split:function(e,i){let n=i.valueToCode(e,"INPUT",t.NONE),o=i.valueToCode(e,"DELIM",t.NONE)||"''";if("SPLIT"===(e=e.getFieldValue("MODE")))n||="''",i=i.provideFunction_("list_string_split",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(input, delim)\n local t = {}\n local pos = 1\n while true do\n next_delim = string.find(input, delim, pos)\n if next_delim == nil then\n table.insert(t, string.sub(input, pos))\n break\n else\n table.insert(t, string.sub(input, pos, next_delim-1))\n pos = next_delim + #delim\n end\n end\n return t\nend\n`);else{if("JOIN"!==e)throw Error("Unknown mode: "+e);n||="{}",i="table.concat"}return[i+"("+n+", "+o+")",t.HIGH]}},g={};g.controls_if=n,g.controls_ifelse=n,g.logic_boolean=function(e,i){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",t.ATOMIC]},g.logic_compare=function(e,i){let n={EQ:"==",NEQ:"~=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")];return[(i.valueToCode(e,"A",t.RELATIONAL)||"0")+" "+n+" "+(e=i.valueToCode(e,"B",t.RELATIONAL)||"0"),t.RELATIONAL]},g.logic_negate=function(e,i){return["not "+(i.valueToCode(e,"BOOL",t.UNARY)||"true"),t.UNARY]},g.logic_null=function(e,i){return["nil",t.ATOMIC]},g.logic_operation=function(e,i){let n="AND"===e.getFieldValue("OP")?"and":"or",o="and"===n?t.AND:t.OR,r=i.valueToCode(e,"A",o);return e=i.valueToCode(e,"B",o),r||e?(i="and"===n?"true":"false",r||=i,e||=i):e=r="false",[r+" "+n+" "+e,o]},g.logic_ternary=function(e,i){return[(i.valueToCode(e,"IF",t.AND)||"false")+" and "+(i.valueToCode(e,"THEN",t.AND)||"nil")+" or "+(e=i.valueToCode(e,"ELSE",t.OR)||"nil"),t.OR]};var m="goto continue\n",T={controls_flow_statements:function(e,t){let i="";if(t.STATEMENT_PREFIX&&(i+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(i+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){let n=e.getSurroundLoop();n&&!n.suppressPrefixSuffix&&(i+=t.injectId(t.STATEMENT_PREFIX,n))}switch(e.getFieldValue("FLOW")){case"BREAK":return i+"break\n";case"CONTINUE":return i+m}throw Error("Unknown flow statement.")},controls_for:function(e,n){let r,s=n.getVariableName(e.getFieldValue("VAR")),a=n.valueToCode(e,"FROM",t.NONE)||"0",l=n.valueToCode(e,"TO",t.NONE)||"0",c=n.valueToCode(e,"BY",t.NONE)||"1",u=n.statementToCode(e,"DO");return u=n.addLoopTrap(u,e),u=o(u,n.INDENT),e="",i.isNumber$$module$build$src$core$utils$string(a)&&i.isNumber$$module$build$src$core$utils$string(l)&&i.isNumber$$module$build$src$core$utils$string(c)?r=(Number(a)<=Number(l)?"":"-")+Math.abs(Number(c)):(e="",r=n.nameDB_.getDistinctName(s+"_inc",i.NameType$$module$build$src$core$names.VARIABLE),e+=r+" = ",e=(e=i.isNumber$$module$build$src$core$utils$string(c)?e+(Math.abs(c)+"\n"):e+"math.abs("+c+")\n")+"if ("+a+") > ("+l+") then\n"+(n.INDENT+r)+" = -"+r+"\n",e+="end\n"),e+"for "+s+" = "+a+", "+l+", "+r+" do\n"+u+"end\n"},controls_forEach:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR")),r=i.valueToCode(e,"LIST",t.NONE)||"{}",s=i.statementToCode(e,"DO");return s=i.addLoopTrap(s,e),s=o(s,i.INDENT),"for _, "+n+" in ipairs("+r+") do \n"+s+"end\n"}};T.controls_repeat=r,T.controls_repeat_ext=r,T.controls_whileUntil=function(e,i){let n="UNTIL"===e.getFieldValue("MODE"),r=i.valueToCode(e,"BOOL",n?t.UNARY:t.NONE)||"false",s=i.statementToCode(e,"DO");return s=i.addLoopTrap(s,e),s=o(s,i.INDENT),n&&(r="not "+r),"while "+r+" do\n"+s+"end\n"};var _={math_arithmetic:function(e,i){var n={ADD:[" + ",t.ADDITIVE],MINUS:[" - ",t.ADDITIVE],MULTIPLY:[" * ",t.MULTIPLICATIVE],DIVIDE:[" / ",t.MULTIPLICATIVE],POWER:[" ^ ",t.EXPONENTIATION]}[e.getFieldValue("OP")];let o=n[0];return n=n[1],[(i.valueToCode(e,"A",n)||"0")+o+(e=i.valueToCode(e,"B",n)||"0"),n]},math_atan2:function(e,i){let n=i.valueToCode(e,"X",t.NONE)||"0";return["math.deg(math.atan2("+(i.valueToCode(e,"Y",t.NONE)||"0")+", "+n+"))",t.HIGH]},math_change:function(e,i){let n=i.valueToCode(e,"DELTA",t.ADDITIVE)||"0";return(e=i.getVariableName(e.getFieldValue("VAR")))+" = "+e+" + "+n+"\n"},math_constant:function(e,i){return{PI:["math.pi",t.HIGH],E:["math.exp(1)",t.HIGH],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",t.MULTIPLICATIVE],SQRT2:["math.sqrt(2)",t.HIGH],SQRT1_2:["math.sqrt(1 / 2)",t.HIGH],INFINITY:["math.huge",t.HIGH]}[e.getFieldValue("CONSTANT")]},math_constrain:function(e,i){return["math.min(math.max("+(i.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(i.valueToCode(e,"LOW",t.NONE)||"-math.huge")+"), "+(e=i.valueToCode(e,"HIGH",t.NONE)||"math.huge")+")",t.HIGH]},math_modulo:function(e,i){return[(i.valueToCode(e,"DIVIDEND",t.MULTIPLICATIVE)||"0")+" % "+(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"),t.MULTIPLICATIVE]},math_number:function(e,i){return e=Number(e.getFieldValue("NUM")),[String(e),e<0?t.UNARY:t.ATOMIC]},math_number_property:function(e,i){var n={EVEN:[" % 2 == 0",t.MULTIPLICATIVE,t.RELATIONAL],ODD:[" % 2 == 1",t.MULTIPLICATIVE,t.RELATIONAL],WHOLE:[" % 1 == 0",t.MULTIPLICATIVE,t.RELATIONAL],POSITIVE:[" > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[" < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,t.MULTIPLICATIVE,t.RELATIONAL],PRIME:[null,t.NONE,t.HIGH
3]};let o=e.getFieldValue("PROPERTY"),[r,s,a]=n[o];if(n=i.valueToCode(e,"NUMBER_TO_CHECK",s)||"0","PRIME"===o)e=i.provideFunction_("math_isPrime",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(n)\n -- https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if n == 2 or n == 3 then\n return true\n end\n -- False if n is NaN, negative, is 1, or not whole.\n -- And false if n is divisible by 2 or 3.\n if not(n > 1) or n % 1 ~= 0 or n % 2 == 0 or n % 3 == 0 then\n return false\n end\n -- Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for x = 6, math.sqrt(n) + 1.5, 6 do\n if n % (x - 1) == 0 or n % (x + 1) == 0 then\n return false\n end\n end\n return true\nend\n`)+"("+n+")";else if("DIVISIBLE_BY"===o){if("0"===(e=i.valueToCode(e,"DIVISOR",t.MULTIPLICATIVE)||"0"))return["nil",t.ATOMIC];e=n+" % "+e+" == 0"}else e=n+r;return[e,a]},math_on_list:function(e,i){function n(){return i.provideFunction_("math_sum",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n local result = 0\n for _, v in ipairs(t) do\n result = result + v\n end\n return result\nend\n`)}var o=e.getFieldValue("OP");switch(e=i.valueToCode(e,"LIST",t.NONE)||"{}",o){case"SUM":o=n();break;case"MIN":o=i.provideFunction_("math_min",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n if #t == 0 then\n return 0\n end\n local result = math.huge\n for _, v in ipairs(t) do\n if v < result then\n result = v\n end\n end\n return result\nend\n`);break;case"AVERAGE":o=i.provideFunction_("math_average",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n if #t == 0 then\n return 0\n end\n return ${n()}(t) / #t\nend\n`);break;case"MAX":o=i.provideFunction_("math_max",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n if #t == 0 then\n return 0\n end\n local result = -math.huge\n for _, v in ipairs(t) do\n if v > result then\n result = v\n end\n end\n return result\nend\n`);break;case"MEDIAN":o=i.provideFunction_("math_median",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n -- Source: http://lua-users.org/wiki/SimpleStats\n if #t == 0 then\n return 0\n end\n local temp = {}\n for _, v in ipairs(t) do\n if type(v) == 'number' then\n table.insert(temp, v)\n end\n end\n table.sort(temp)\n if #temp % 2 == 0 then\n return (temp[#temp / 2] + temp[(#temp / 2) + 1]) / 2\n else\n return temp[math.ceil(#temp / 2)]\n end\nend\n`);break;case"MODE":o=i.provideFunction_("math_modes",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n -- Source: http://lua-users.org/wiki/SimpleStats\n local counts = {}\n for _, v in ipairs(t) do\n if counts[v] == nil then\n counts[v] = 1\n else\n counts[v] = counts[v] + 1\n end\n end\n local biggestCount = 0\n for _, v in pairs(counts) do\n if v > biggestCount then\n biggestCount = v\n end\n end\n local temp = {}\n for k, v in pairs(counts) do\n if v == biggestCount then\n table.insert(temp, k)\n end\n end\n return temp\nend\n`);break;case"STD_DEV":o=i.provideFunction_("math_standard_deviation",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n local m\n local vm\n local total = 0\n local count = 0\n local result\n m = #t == 0 and 0 or ${n()}(t) / #t\n for _, v in ipairs(t) do\n if type(v) == 'number' then\n vm = v - m\n total = total + (vm * vm)\n count = count + 1\n end\n end\n result = math.sqrt(total / (count-1))\n return result\nend\n`);break;case"RANDOM":o=i.provideFunction_("math_random_list",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(t)\n if #t == 0 then\n return nil\n end\n return t[math.random(#t)]\nend\n`);break;default:throw Error("Unknown operator: "+o)}return[o+"("+e+")",t.HIGH]},math_random_float:function(e,i){return["math.random()",t.HIGH]},math_random_int:function(e,i){return["math.random("+(i.valueToCode(e,"FROM",t.NONE)||"0")+", "+(e=i.valueToCode(e,"TO",t.NONE)||"0")+")",t.HIGH]}};_.math_round=s,_.math_single=s,_.math_trig=s;var E={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+"\n"},procedures_callreturn:function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME")),o=[],r=e.getVars();for(let s=0;s<r.length;s++)o[s]=i.valueToCode(e,"ARG"+s,t.NONE)||"nil";return[n+"("+o.join(", ")+")",t.HIGH]}};E.procedures_defnoreturn=a,E.procedures_defreturn=a,E.procedures_ifreturn=function(e,i){let n="if "+(i.valueToCode(e,"CONDITION",t.NONE)||"false")+" then\n";return i.STATEMENT_SUFFIX&&(n+=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)),e.hasReturnValue_?(e=i.valueToCode(e,"VALUE",t.NONE)||"nil",n+=i.INDENT+"return "+e+"\n"):n+=i.INDENT+"return\n",n+"end\n"};var b={text:function(e,i){return[i.quote_(e.getFieldValue("TEXT")),t.ATOMIC]},text_append:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR"));return n+" = "+n+" .. "+(e=i.valueToCode(e,"TEXT",t.CONCATENATION)||"''")+"\n"},text_changeCase:function(e,i){let n,o=e.getFieldValue("CASE");return e=i.valueToCode(e,"TEXT",t.NONE)||"''","UPPERCASE"===o?n="string.upper":"LOWERCASE"===o?n="string.lower":"TITLECASE"===o&&(n=i.provideFunction_("text_titlecase",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str)\n local buf = {}\n local inWord = false\n for i = 1, #str do\n local c = string.sub(str, i, i)\n if inWord then\n table.insert(buf, string.lower(c))\n if string.find(c, "%s") then\n inWord = false\n end\n else\n table.insert(buf, string.upper(c))\n inWord = true\n end\n end\n return table.concat(buf)\nend\n`)),[n+"("+e+")",t.HIGH]},text_charAt:function(e,i){var n=e.getFieldValue("WHERE")||"FROM_START";let o=i.valueToCode(e,"VALUE",t.NONE)||"''";if("RANDOM"===n)i=i.provideFunction_("text_random_letter",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str)\n local index = math.random(string.len(str))\n return string.sub(str, index, index)\nend\n`)+"("+o+")";else{if("FIRST"===n)n="1";else if("LAST"===n)n="-1";else if(e=i.valueToCode(e,"AT","FROM_END"===n?t.UNARY:t.NONE)||"1","FROM_START"===n)n=e;else{if("FROM_END"!==n)throw Error("Unhandled option (text_charAt).");n="-"+e}i=n.match(/^-?\w*$/)?"string.sub("+o+", "+n+", "+n+")":i.provideFunction_("text_char_at",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str, index)\n return string.sub(str, index, index)\nend\n`)+"("+o+", "+n+")"}return[i,t.HIGH]},text_count:function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''";return e=i.valueToCode(e,"SUB",t.NONE)||"''",[i.provideFunction_("text_count",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle)\n if #needle == 0 then\n return #haystack + 1\n end\n local i = 1\n local count = 0\n while true do\n i = string.find(haystack, needle, i, true)\n if i == nil then\n break\n end\n count = count + 1\n i = i + #needle\n end\n return count\nend\n`)+"("+n+", "+e+")",t.HIGH]},text_getSubstring:function(e,i){let n=i.valueToCode(e,"STRING",t.NONE)||"''";var o=e.getFieldValue("WHERE1"),r=i.valueToCode(e,"AT1","FROM_END"===o?t.UNARY:t.NONE)||"1";if("FIRST"===o)o=1;else if("FROM_START"===o)o=r;else{if("FROM_END"!==o)throw Error("Unhandled option (text_getSubstring)");o="-"+r}if(r=e.getFieldValue("WHERE2"),e=i.valueToCode(e,"AT2","FROM_END"===r?t.UNARY:t.NONE)||"1","LAST"===r)e=-1;else if("FROM_START"!==r){if("FROM_END"!==r)throw Error("Unhandled option (text_getSubstring)");e="-"+e}return["string.sub("+n+", "+o+", "+e+")",t.HIGH]},text_indexOf:function(e,i){let n=i.valueToCode(e,"FIND",t.NONE)||"''",o=i.valueToCode(e,"VALUE",t.NONE)||"''";return[("FIRST"===e.getFieldValue("END")?i.provideFunction_("firstIndexOf",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str, substr)\n local i = string.find(str, substr, 1, true)\n if i == nil then\n return 0\n end\n return i\nend\n`):i.provideFunction_("lastIndexOf",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(str, substr)\n local i = string.find(string.reverse(str), string.reverse(substr), 1, true)\n if i then\n return #str + 2 - i - #substr\n end\n return 0\nend\n`))+"("+o+", "+n+")",t.HIGH]},text_isEmpty:function(e,i){return["#"+(i.valueToCode(e,"VALUE",t.UNARY)||"''")+" == 0",t.RELATIONAL]},text_join:function(e,i){if(0===e.itemCount_)return["''",t.ATOMIC];if(1===e.itemCount_)return["tostring("+(i.valueToCode(e,"ADD0",t.NONE)||"''")+")",t.HIGH];if(2===e.itemCount_){var n=i.valueToCode(e,"ADD0",t.CONCATENATION)||"''";return[n+" .. "+(e=i.valueToCode(e,"ADD1",t.CONCATENATION)||"''"),t.CONCATENATION]}n=[];for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"''";return["table.concat({"+n.join(", ")+"})",t.HIGH]},text_length:function(e,i){return["#"+(i.valueToCode(e,"VALUE",t.UNARY)||"''"),t.UNARY]},text_print:function(e,i){return"print("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+")\n"}};b.text_prompt=l,b.text_prompt_ext=l,b.text_replace=function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''",o=i.valueToCode(e,"FROM",t.NONE)||"''";return e=i.valueToCode(e,"TO",t.NONE)||"''",[i.provideFunction_("text_replace",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(haystack, needle, replacement)\n local buf = {}\n local i = 1\n while i <= #haystack do\n if string.sub(haystack, i, i + #needle - 1) == needle then\n for j = 1, #replacement do\n table.insert(buf, string.sub(replacement, j, j))\n end\n i = i + #needle\n else\n table.insert(buf, string.sub(haystack, i, i))\n i = i + 1\n end\n end\n return table.concat(buf)\nend\n`)+"("+n+", "+o+", "+e+")",t.HIGH]},b.text_reverse=function(e,i){return["string.reverse("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+")",t.HIGH]},b.text_trim=function(e,i){let n={LEFT:"^%s*(,-)",RIGHT:"(.-)%s*$",BOTH:"^%s*(.-)%s*$"}[e.getFieldValue("MODE")];return["string.gsub("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+', "'+n+'", "%1")',t.HIGH]};var O={};O.variables_get=c,O.variables_set=u;var v={};v.variables_get_dynamic=c,v.variables_set_dynamic=u;var I=new h,S=Object.assign({},f,g,T,_,E,b,O,v);for(let R in S)I.forBlock[R]=S[R];var y={};return y.LuaGenerator=h,y.Order=t,y.luaGenerator=I,y.__namespace__=i,y})}),nN=a((e,t)=>{!function(i,n){"function"==typeof define&&define.amd?define(["./blockly_compressed.js"],n):"object"==typeof e?t.exports=n(XL()):(i.php=n(i.Blockly),i.Blockly.PHP=i.php.phpGenerator)}(e,function(e){var t,i=e.__namespace__,n=function(e,i){let n,o,r=0,s="";i.STATEMENT_PREFIX&&(s+=i.injectId(i.STATEMENT_PREFIX,e));do{o=i.valueToCode(e,"IF"+r,t.NONE)||"false",n=i.statementToCode(e,"DO"+r),i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+=(r>0?" else ":"")+"if ("+o+") {\n"+n+"}",r++}while(e.getInput("IF"+r));return(e.getInput("ELSE")||i.STATEMENT_SUFFIX)&&(n=e.getInput("ELSE")?i.statementToCode(e,"ELSE"):"",i.STATEMENT_SUFFIX&&(n=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)+n),s+=" else {\n"+n+"}"),s+"\n"},o=function(e,n){let o;o=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):n.valueToCode(e,"TIMES",t.ASSIGNMENT)||"0";let r=n.statementToCode(e,"DO");r=n.addLoopTrap(r,e),e="";let s=n.nameDB_.getDistinctName("count",i.NameType$$module$build$src$core$names.VARIABLE),a=o;return o.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(o)||(a=n.nameDB_.getDistinctName("repeat_end",i.NameType$$module$build$src$core$names.VARIABLE),e+=a+" = "+o+";\n"),e+"for ("+s+" = 0; "+s+" < "+a+"; "+s+"++) {\n"+r+"}\n"},r=function(e,i){let n,o=e.getFieldValue("OP");if("NEG"===o)return"-"===(e=i.valueToCode(e,"NUM",t.UNARY_NEGATION)||"0")[0]&&(e=" "+e),["-"+e,t.UNARY_NEGATION];switch(e="SIN"===o||"COS"===o||"TAN"===o?i.valueToCode(e,"NUM",t.DIVISION)||"0":i.valueToCode(e,"NUM",t.NONE)||"0",o){case"ABS":n="abs("+e+")";break;case"ROOT":n="sqrt("+e+")";break;case"LN":n="log("+e+")";break;case"EXP":n="exp("+e+")";break;case"POW10":n="pow(10,"+e+")";break;case"ROUND":n="round("+e+")";break;case"ROUNDUP":n="ceil("+e+")";break;case"ROUNDDOWN":n="floor("+e+")";break;case"SIN":n="sin("+e+" / 180 * pi())";break;case"COS":n="cos("+e+" / 180 * pi())";break;case"TAN":n="tan("+e+" / 180 * pi())"}if(n)return[n,t.FUNCTION_CALL];switch(o){case"LOG10":n="log("+e+") / log(10)";break;case"ASIN":n="asin("+e+") / pi() * 180";break;case"ACOS":n="acos("+e+") / pi() * 180";break;case"ATAN":n="atan("+e+") / pi() * 180";break;default:throw Error("Unknown math operator: "+o)}return[n,t.DIVISION]},s=function(e,n){var o=[],r=e.workspace,s=i.allUsedVarModels$$module$build$src$core$variables(r)||[];for(var a of s)s=a.getName(),e.getVars().includes(s)||o.push(n.getVariableName(s));for(r=i.allDeveloperVariables$$module$build$src$core$variables(r),a=0;a<r.length;a++)o.push(n.nameDB_.getName(r[a],i.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));r=o.length?n.INDENT+"global "+o.join(", ")+";\n":"",o=n.getProcedureName(e.getFieldValue("NAME")),a="",n.STATEMENT_PREFIX&&(a+=n.injectId(n.STATEMENT_PREFIX,e)),n.STATEMENT_SUFFIX&&(a+=n.injectId(n.STATEMENT_SUFFIX,e)),a&&=n.prefixLines(a,n.INDENT),s="",n.INFINITE_LOOP_TRAP&&(s=n.prefixLines(n.injectId(n.INFINITE_LOOP_TRAP,e),n.INDENT));let l="";e.getInput("STACK")&&(l=n.statementToCode(e,"STACK"));let c="";e.getInput("RETURN")&&(c=n.valueToCode(e,"RETURN",t.NONE)||"");let u="";l&&c&&(u=a),c&&=n.INDENT+"return "+c+";\n";let h=[],d=e.getVars();for(let t=0;t<d.length;t++)h[t]=n.getVariableName(d[t]);return r="function "+o+"("+h.join(", ")+") {\n"+r+a+s+l+u+c+"}",r=n.scrub_(e,r),n.definitions_["%"+o]=r,null},a=function(e,i){return i="readline("+(e.getField("TEXT")?i.quote_(e.getFieldValue("TEXT")):i.valueToCode(e,"TEXT",t.NONE)||"''")+")","NUMBER"===e.getFieldValue("TYPE")&&(i="floatval("+i+")"),[i,t.FUNCTION_CALL]},l=function(e,i){return[i.getVariableName(e.getFieldValue("VAR")),t.ATOMIC]},c=function(e,i){let n=i.valueToCode(e,"VALUE",t.ASSIGNMENT)||"0";return i.getVariableName(e.getFieldValue("VAR"))+" = "+n+";\n"};!function(e){e[e.ATOMIC=0]="ATOMIC",e[e.CLONE=1]="CLONE",e[e.NEW=1]="NEW",e[e.MEMBER=2.1]="MEMBER",e[e.FUNCTION_CALL=2.2]="FUNCTION_CALL",e[e.POWER=3]="POWER",e[e.INCREMENT=4]="INCREMENT",e[e.DECREMENT=4]="DECREMENT",e[e.BITWISE_NOT=4]="BITWISE_NOT",e[e.CAST=4]="CAST",e[e.SUPPRESS_ERROR=4]="SUPPRESS_ERROR",e[e.INSTANCEOF=5]="INSTANCEOF",e[e.LOGICAL_NOT=6]="LOGICAL_NOT",e[e.UNARY_PLUS=7.1]="UNARY_PLUS",e[e.UNARY_NEGATION=7.2]="UNARY_NEGATION",e[e.MULTIPLICATION=8.1]="MULTIPLICATION",e[e.DIVISION=8.2]="DIVISION",e[e.MODULUS=8.3]="MODULUS",e[e.ADDITION=9.1]="ADDITION",e[e.SUBTRACTION=9.2]="SUBTRACTION",e[e.STRING_CONCAT=9.3]="STRING_CONCAT",e[e.BITWISE_SHIFT=10]="BITWISE_SHIFT",e[e.RELATIONAL=11]="RELATIONAL",e[e.EQUALITY=12]="EQUALITY",e[e.REFERENCE=13]="REFERENCE",e[e.BITWISE_AND=13]="BITWISE_AND",e[e.BITWISE_XOR=14]="BITWISE_XOR",e[e.BITWISE_OR=15]="BITWISE_OR",e[e.LOGICAL_AND=16]="LOGICAL_AND",e[e.LOGICAL_OR=17]="LOGICAL_OR",e[e.IF_NULL=18]="IF_NULL",e[e.CONDITIONAL=19]="CONDITIONAL",e[e.ASSIGNMENT=20]="ASSIGNMENT",e[e.LOGICAL_AND_WEAK=21]="LOGICAL_AND_WEAK",e[e.LOGICAL_XOR=22]="LOGICAL_XOR",e[e.LOGICAL_OR_WEAK=23]="LOGICAL_OR_WEAK",e[e.NONE=99]="NONE"}(t||={});var u=class extends i.CodeGenerator$$module$build$src$core$generator{constructor(e="PHP"){super(e),this.ORDER_OVERRIDES=[[t.MEMBER,t.FUNCTION_CALL],[t.MEMBER,t.MEMBER],[t.LOGICAL_NOT,t.LOGICAL_NOT],[t.MULTIPLICATION,t.MULTIPLICATION],[t.ADDITION,t.ADDITION],[t.LOGICAL_AND,t.LOGICAL_AND],[t.LOGICAL_OR,t.LOGICAL_OR]],this.isInitialized=!1;for(let i in t)"string"!=typeof(e=t[i])&&(this["ORDER_"+i]=e);this.addReservedWords("__halt_compiler,abstract,and,array,as,break,callable,case,catch,class,clone,const,continue,declare,default,die,do,echo,else,elseif,empty,enddeclare,endfor,endforeach,endif,endswitch,endwhile,eval,exit,extends,final,for,foreach,function,global,goto,if,implements,include,include_once,instanceof,insteadof,interface,isset,list,namespace,new,or,print,private,protected,public,require,require_once,return,static,switch,throw,trait,try,unset,use,var,while,xor,PHP_VERSION,PHP_MAJOR_VERSION,PHP_MINOR_VERSION,PHP_RELEASE_VERSION,PHP_VERSION_ID,PHP_EXTRA_VERSION,PHP_ZTS,PHP_DEBUG,PHP_MAXPATHLEN,PHP_OS,PHP_SAPI,PHP_EOL,PHP_INT_MAX,PHP_INT_SIZE,DEFAULT_INCLUDE_PATH,PEAR_INSTALL_DIR,PEAR_EXTENSION_DIR,PHP_EXTENSION_DIR,PHP_PREFIX,PHP_BINDIR,PHP_BINARY,PHP_MANDIR,PHP_LIBDIR,PHP_DATADIR,PHP_SYSCONFDIR,PHP_LOCALSTATEDIR,PHP_CONFIG_FILE_PATH,PHP_CONFIG_FILE_SCAN_DIR,PHP_SHLIB_SUFFIX,E_ERROR,E_WARNING,E_PARSE,E_NOTICE,E_CORE_ERROR,E_CORE_WARNING,E_COMPILE_ERROR,E_COMPILE_WARNING,E_USER_ERROR,E_USER_
3WARNING,E_USER_NOTICE,E_DEPRECATED,E_USER_DEPRECATED,E_ALL,E_STRICT,__COMPILER_HALT_OFFSET__,TRUE,FALSE,NULL,__CLASS__,__DIR__,__FILE__,__FUNCTION__,__LINE__,__METHOD__,__NAMESPACE__,__TRAIT__")}init(e){super.init(e),this.nameDB_?this.nameDB_.reset():this.nameDB_=new i.Names$$module$build$src$core$names(this.RESERVED_WORDS_,"$"),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e),this.isInitialized=!0}finish(e){let t=Object.values(this.definitions_);return e=super.finish(e),this.isInitialized=!1,this.nameDB_.reset(),t.join("\n\n")+"\n\n\n"+e}scrubNakedValue(e){return e+";\n"}quote_(e){return"'"+(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'"))+"'"}multiline_quote_(e){return e.split(/\n/g).map(this.quote_).join(' . "\\n" .\n')}scrub_(e,t,n=!1){let o="";if(!e.outputConnection||!e.outputConnection.targetConnection){var r=e.getCommentText();r&&(r=i.wrap$$module$build$src$core$utils$string(r,this.COMMENT_WRAP-3),o+=this.prefixLines(r,"// ")+"\n");for(let t=0;t<e.inputList.length;t++)e.inputList[t].type===i.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&(r=e.inputList[t].connection.targetBlock())&&(r=this.allNestedComments(r))&&(o+=this.prefixLines(r,"// "))}return e=e.nextConnection&&e.nextConnection.targetBlock(),o+t+(n=n?"":this.blockToCode(e))}getAdjusted(e,n,o=0,r=!1,s=t.NONE){e.workspace.options.oneBasedIndex&&o--;let a=e.workspace.options.oneBasedIndex?"1":"0",l=s;return o>0?l=t.ADDITION:o<0?l=t.SUBTRACTION:r&&(l=t.UNARY_NEGATION),e=this.valueToCode(e,n,l)||a,0!==o||r?i.isNumber$$module$build$src$core$utils$string(e)?(e=String(Number(e)+o),r&&(e=String(-Number(e))),e):(o>0?e=`${e} + ${o}`:o<0&&(e=`${e} - ${-o}`),r&&(e=o?`-(${e})`:`-${e}`),Math.floor(s)>=Math.floor(l)&&(e=`(${e})`),e):e}},h={};h.Order=t,h.PhpGenerator=u;var d={lists_create_empty:function(e,i){return["array()",t.FUNCTION_CALL]},lists_create_with:function(e,i){let n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"null";return["array("+n.join(", ")+")",t.FUNCTION_CALL]},lists_getIndex:function(e,i){var n=e.getFieldValue("MODE")||"GET";switch(e.getFieldValue("WHERE")||"FROM_START"){case"FIRST":if("GET"===n)return[(i.valueToCode(e,"VALUE",t.MEMBER)||"array()")+"[0]",t.MEMBER];if("GET_REMOVE"===n)return["array_shift("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+")",t.FUNCTION_CALL];if("REMOVE"===n)return"array_shift("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+");\n";break;case"LAST":if("GET"===n)return["end("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+")",t.FUNCTION_CALL];if("GET_REMOVE"===n)return["array_pop("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+")",t.FUNCTION_CALL];if("REMOVE"===n)return"array_pop("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+");\n";break;case"FROM_START":var o=i.getAdjusted(e,"AT");if("GET"===n)return[(i.valueToCode(e,"VALUE",t.MEMBER)||"array()")+"["+o+"]",t.MEMBER];if("GET_REMOVE"===n)return["array_splice("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+", "+o+", 1)[0]",t.FUNCTION_CALL];if("REMOVE"===n)return"array_splice("+(i.valueToCode(e,"VALUE",t.NONE)||"array()")+", "+o+", 1);\n";break;case"FROM_END":if("GET"===n)return["array_slice("+(n=i.valueToCode(e,"VALUE",t.NONE)||"array()")+", "+(i=i.getAdjusted(e,"AT",1,!0))+", 1)[0]",t.FUNCTION_CALL];if("GET_REMOVE"===n||"REMOVE"===n){if(o=i.valueToCode(e,"VALUE",t.NONE)||"array()",i="array_splice("+o+", count("+o+") - "+(i=i.getAdjusted(e,"AT",1,!1,t.SUBTRACTION))+", 1)[0]","GET_REMOVE"===n)return[i,t.FUNCTION_CALL];if("REMOVE"===n)return i+";\n"}break;case"RANDOM":if(e=i.valueToCode(e,"VALUE",t.NONE)||"array()","GET"===n)return[i.provideFunction_("lists_get_random_item",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($list) {\n return $list[rand(0,count($list)-1)];\n}\n`)+"("+e+")",t.FUNCTION_CALL];if("GET_REMOVE"===n)return[i.provideFunction_("lists_get_remove_random_item",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(&$list) {\n $x = rand(0,count($list)-1);\n unset($list[$x]);\n return array_values($list);\n}\n`)+"("+e+")",t.FUNCTION_CALL];if("REMOVE"===n)return i.provideFunction_("lists_remove_random_item",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}(&$list) {\n unset($list[rand(0,count($list)-1)]);\n}\n`)+"("+e+");\n"}throw Error("Unhandled combination (lists_getIndex).")},lists_getSublist:function(e,n){var o=n.valueToCode(e,"LIST",t.NONE)||"array()",r=e.getFieldValue("WHERE1");let s=e.getFieldValue("WHERE2");if("FIRST"!==r||"LAST"!==s)if(o.match(/^\$\w+$/)||"FROM_END"!==r&&"FROM_START"===s){switch(r){case"FROM_START":r=n.getAdjusted(e,"AT1");break;case"FROM_END":r="count("+o+") - "+(r=n.getAdjusted(e,"AT1",1,!1,t.SUBTRACTION));break;
3case"FIRST":r="0";break;default:throw Error("Unhandled option (lists_getSublist).")}switch(s){case"FROM_START":n=n.getAdjusted(e,"AT2",0,!1,t.SUBTRACTION),n+=" - ",n=i.isNumber$$module$build$src$core$utils$string(String(r))||String(r).match(/^\(.+\)$/)?n+r:n+"("+r+")",n+=" + 1";break;case"FROM_END":n="count("+o+") - "+(n=n.getAdjusted(e,"AT2",0,!1,t.SUBTRACTION))+" - ",n=i.isNumber$$module$build$src$core$utils$string(String(r))||String(r).match(/^\(.+\)$/)?n+r:n+"("+r+")";break;case"LAST":n="count("+o+") - ",n=i.isNumber$$module$build$src$core$utils$string(String(r))||String(r).match(/^\(.+\)$/)?n+r:n+"("+r+")";break;default:throw Error("Unhandled option (lists_getSublist).")}o="array_slice("+o+", "+r+", "+n+")"}else{let t=n.getAdjusted(e,"AT1");e=n.getAdjusted(e,"AT2"),o=n.provideFunction_("lists_get_sublist",`\nfunction ${n.FUNCTION_NAME_PLACEHOLDER_}($list, $where1, $at1, $where2, $at2) {\n if ($where1 == 'FROM_END') {\n $at1 = count($list) - 1 - $at1;\n } else if ($where1 == 'FIRST') {\n $at1 = 0;\n } else if ($where1 != 'FROM_START') {\n throw new Exception('Unhandled option (lists_get_sublist).');\n }\n $length = 0;\n if ($where2 == 'FROM_START') {\n $length = $at2 - $at1 + 1;\n } else if ($where2 == 'FROM_END') {\n $length = count($list) - $at1 - $at2;\n } else if ($where2 == 'LAST') {\n $length = count($list) - $at1;\n } else {\n throw new Exception('Unhandled option (lists_get_sublist).');\n }\n return array_slice($list, $at1, $length);\n}\n`)+"("+o+", '"+r+"', "+t+", '"+s+"', "+e+")"}return[o,t.FUNCTION_CALL]},lists_indexOf:function(e,i){let n=i.valueToCode(e,"FIND",t.NONE)||"''",o=i.valueToCode(e,"VALUE",t.MEMBER)||"[]",r=" -1",s="";return e.workspace.options.oneBasedIndex&&(r=" 0",s=" + 1"),[("FIRST"===e.getFieldValue("END")?i.provideFunction_("indexOf",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {\n for ($index = 0; $index < count($haystack); $index++) {\n if ($haystack[$index] == $needle) return $index${s};\n }\n return ${r};\n}\n`):i.provideFunction_("lastIndexOf",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($haystack, $needle) {\n $last = ${r};\n for ($index = 0; $index < count($haystack); $index++) {\n if ($haystack[$index] == $needle) $last = $index${s};\n }\n return $last;\n}\n`))+"("+o+", "+n+")",t.FUNCTION_CALL]},lists_isEmpty:function(e,i){return["empty("+(i.valueToCode(e,"VALUE",t.FUNCTION_CALL)||"array()")+")",t.FUNCTION_CALL]},lists_length:function(e,i){return[i.provideFunction_("length",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($value) {\n if (is_string($value)) {\n return strlen($value);\n } else {\n return count($value);\n }\n}\n`)+"("+(e=i.valueToCode(e,"VALUE",t.NONE)||"''")+")",t.FUNCTION_CALL]},lists_repeat:function(e,i){return[i.provideFunction_("lists_repeat",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($value, $count) {\n $array = array();\n for ($index = 0; $index < $count; $index++) {\n $array[] = $value;\n }\n return $array;\n}\n`)+"("+(i.valueToCode(e,"ITEM",t.NONE)||"null")+", "+(e=i.valueToCode(e,"NUM",t.NONE)||"0")+")",t.FUNCTION_CALL]},lists_reverse:function(e,i){return["array_reverse("+(i.valueToCode(e,"LIST",t.NONE)||"[]")+")",t.FUNCTION_CALL]},lists_setIndex:function(e,n){let o=e.getFieldValue("MODE")||"GET";var r=e.getFieldValue("WHERE")||"FROM_START";let s=n.valueToCode(e,"TO",t.ASSIGNMENT)||"null";switch(r){case"FIRST":if("SET"===o)return(n.valueToCode(e,"LIST",t.MEMBER)||"array()")+"[0] = "+s+";\n";if("INSERT"===o)return"array_unshift("+(n.valueToCode(e,"LIST",t.NONE)||"array()")+", "+s+");\n";break;case"LAST":if(e=n.valueToCode(e,"LIST",t.NONE)||"array()","SET"===o)return n.provideFunction_("lists_set_last_item",`\nfunction ${n.FUNCTION_NAME_PLACEHOLDER_}(&$list, $value) {\n $list[count($list) - 1] = $value;\n}\n`)+"("+e+", "+s+");\n";if("INSERT"===o)return"array_push("+e+", "+s+");\n";break;case"FROM_START":if(r=n.getAdjusted(e,"AT"),"SET"===o)return(n.valueToCode(e,"LIST",t.MEMBER)||"array()")+"["+r+"] = "+s+";\n";if("INSERT"===o)return"array_splice("+(n.valueToCode(e,"LIST",t.NONE)||"array()")+", "+r+", 0, "+s+");\n";break;case"FROM_END":if(r=n.valueToCode(e,"LIST",t.NONE)||"array()",e=n.getAdjusted(e,"AT",1),"SET"===o)return n.provideFunction_("lists_set_from_end",`\nfunction ${n.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {\n $list[count($list) - $at] = $value;\n}\n`)+"("+r+", "+e+", "+s+");\n";if("INSERT"===o)return n.provideFunction_("lists_insert_from_end",`\nfunction ${n.FUNCTION_NAME_PLACEHOLDER_}(&$list, $at, $value) {\n return array_splice($list, count($list) - $at, 0, $value);\n}\n`)+"("+r+", "+e+", "+s+");\n";break;case"RANDOM":if((e=n.valueToCode(e,"LIST",t.REFERENCE)||"array()").match(/^\$\w+$/))r="";else{var a=(r=n.nameDB_.getDistinctName("tmp_list",i.NameType$$module$build$src$core$names.VARIABLE))+" = &"+e+";\n";e=r,r=a}if(r+=(n=n.nameDB_.getDistinctName("tmp_x",i.NameType$$module$build$src$core$names.VARIABLE))+" = rand(0, count("+e+")-1);\n","SET"===o)return r+(e+"[")+n+"] = "+s+";\n";if("INSERT"===o)return r+"array_splice("+e+", "+n+", 0, "+s+");\n"}throw Error("Unhandled combination (lists_setIndex).")},lists_sort:function(e,i){let n=i.valueToCode(e,"LIST",t.NONE)||"array()",o="1"===e.getFieldValue("DIRECTION")?1:-1;return e=e.getFieldValue("TYPE"),[i.provideFunction_("lists_sort",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($list, $type, $direction) {\n $sortCmpFuncs = array(\n 'NUMERIC' =>
3 'strnatcasecmp',\n 'TEXT' => 'strcmp',\n 'IGNORE_CASE' => 'strcasecmp'\n );\n $sortCmp = $sortCmpFuncs[$type];\n $list2 = $list;\n usort($list2, $sortCmp);\n if ($direction == -1) {\n $list2 = array_reverse($list2);\n }\n return $list2;\n}\n`)+"("+n+', "'+e+'", '+o+")",t.FUNCTION_CALL]},lists_split:function(e,i){let n=i.valueToCode(e,"INPUT",t.NONE);if(i=i.valueToCode(e,"DELIM",t.NONE)||"''","SPLIT"===(e=e.getFieldValue("MODE")))n||="''",e="explode";else{if("JOIN"!==e)throw Error("Unknown mode: "+e);n||="array()",e="implode"}return[e+"("+i+", "+n+")",t.FUNCTION_CALL]}},p={};p.controls_if=n,p.controls_ifelse=n,p.logic_boolean=function(e,i){return["TRUE"===e.getFieldValue("BOOL")?"true":"false",t.ATOMIC]},p.logic_compare=function(e,i){let n={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[e.getFieldValue("OP")],o="=="===n||"!="===n?t.EQUALITY:t.RELATIONAL;return[(i.valueToCode(e,"A",o)||"0")+" "+n+" "+(e=i.valueToCode(e,"B",o)||"0"),o]},p.logic_negate=function(e,i){let n=t.LOGICAL_NOT;return["!"+(i.valueToCode(e,"BOOL",n)||"true"),n]},p.logic_null=function(e,i){return["null",t.ATOMIC]},p.logic_operation=function(e,i){let n="AND"===e.getFieldValue("OP")?"&&":"||",o="&&"===n?t.LOGICAL_AND:t.LOGICAL_OR,r=i.valueToCode(e,"A",o);return e=i.valueToCode(e,"B",o),r||e?(i="&&"===n?"true":"false",r||=i,e||=i):e=r="false",[r+" "+n+" "+e,o]},p.logic_ternary=function(e,i){return[(i.valueToCode(e,"IF",t.CONDITIONAL)||"false")+" ? "+(i.valueToCode(e,"THEN",t.CONDITIONAL)||"null")+" : "+(e=i.valueToCode(e,"ELSE",t.CONDITIONAL)||"null"),t.CONDITIONAL]};var f={controls_flow_statements:function(e,t){let i="";if(t.STATEMENT_PREFIX&&(i+=t.injectId(t.STATEMENT_PREFIX,e)),t.STATEMENT_SUFFIX&&(i+=t.injectId(t.STATEMENT_SUFFIX,e)),t.STATEMENT_PREFIX){let n=e.getSurroundLoop();n&&!n.suppressPrefixSuffix&&(i+=t.injectId(t.STATEMENT_PREFIX,n))}switch(e.getFieldValue("FLOW")){case"BREAK":return i+"break;\n";case"CONTINUE":return i+"continue;\n"}throw Error("Unknown flow statement.")},controls_for:function(e,n){var o=n.getVariableName(e.getFieldValue("VAR")),r=n.valueToCode(e,"FROM",t.ASSIGNMENT)||"0",s=n.valueToCode(e,"TO",t.ASSIGNMENT)||"0";let a=n.valueToCode(e,"BY",t.ASSIGNMENT)||"1",l=n.statementToCode(e,"DO");if(l=n.addLoopTrap(l,e),i.isNumber$$module$build$src$core$utils$string(r)&&i.isNumber$$module$build$src$core$utils$string(s)&&i.isNumber$$module$build$src$core$utils$string(a))e="for ("+o+" = "+r+"; "+o+((n=Number(r)<=Number(s))?" <= ":" >= ")+s+"; "+o,e=1===(o=Math.abs(Number(a)))?e+(n?"++":"--"):e+(n?" += ":" -= ")+o,e+=") {\n"+l+"}\n";else{e="";let t=r;r.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(r)||(t=n.nameDB_.getDistinctName(o+"_start",i.NameType$$module$build$src$core$names.VARIABLE),e+=t+" = "+r+";\n"),r=s,s.match(/^\w+$/)||i.isNumber$$module$build$src$core$utils$string(s)||(e+=(r=n.nameDB_.getDistinctName(o+"_end",i.NameType$$module$build$src$core$names.VARIABLE))+" = "+s+";\n"),e+=(s=n.nameDB_.getDistinctName(o+"_inc",i.NameType$$module$build$src$core$names.VARIABLE))+" = ",e=i.isNumber$$module$build$src$core$utils$string(a)?e+(Math.abs(Number(a))+";\n"):e+"abs("+a+");\n",e+="if ("+t+" > "+r+") {\n",e=(e+=n.INDENT+s+" = -"+s+";\n")+"}\nfor ("+o+" = "+t+"; "+s+" >= 0 ? "+o+" <= "+r+" : "+o+" >= "+r+"; "+o+" += "+s+") {\n"+l+"}\n"}return e},controls_forEach:function(e,i){let n=i.getVariableName(e.getFieldValue("VAR")),o=i.valueToCode(e,"LIST",t.ASSIGNMENT)||"[]",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e),"foreach ("+o+" as "+n+") {\n"+r+"}\n"}};f.controls_repeat=o,f.controls_repeat_ext=o,f.controls_whileUntil=function(e,i){let n="UNTIL"===e.getFieldValue("MODE"),o=i.valueToCode(e,"BOOL",n?t.LOGICAL_NOT:t.NONE)||"false",r=i.statementToCode(e,"DO");return r=i.addLoopTrap(r,e),n&&(o="!"+o),"while ("+o+") {\n"+r+"}\n"};var g={math_arithmetic:function(e,i){var n={ADD:[" + ",t.ADDITION],MINUS:[" - ",t.SUBTRACTION],MULTIPLY:[" * ",t.MULTIPLICATION],DIVIDE:[" / ",t.DIVISION],POWER:[" ** ",t.POWER]}[e.getFieldValue("OP")];let o=n[0];return n=n[1],[(i.valueToCode(e,"A",n)||"0")+o+(e=i.valueToCode(e,"B",n)||"0"),n]},math_atan2:function(e,i){let n=i.valueToCode(e,"X",t.NONE)||"0";return["atan2("+(i.valueToCode(e,"Y",t.NONE)||"0")+", "+n+") / pi() * 180",t.DIVISION]},math_change:function(e,i){let n=i.valueToCode(e,"DELTA",t.ADDITION)||"0";
3return i.getVariableName(e.getFieldValue("VAR"))+" += "+n+";\n"},math_constant:function(e,i){return{PI:["M_PI",t.ATOMIC],E:["M_E",t.ATOMIC],GOLDEN_RATIO:["(1 + sqrt(5)) / 2",t.DIVISION],SQRT2:["M_SQRT2",t.ATOMIC],SQRT1_2:["M_SQRT1_2",t.ATOMIC],INFINITY:["INF",t.ATOMIC]}[e.getFieldValue("CONSTANT")]},math_constrain:function(e,i){return["min(max("+(i.valueToCode(e,"VALUE",t.NONE)||"0")+", "+(i.valueToCode(e,"LOW",t.NONE)||"0")+"), "+(e=i.valueToCode(e,"HIGH",t.NONE)||"Infinity")+")",t.FUNCTION_CALL]},math_modulo:function(e,i){return[(i.valueToCode(e,"DIVIDEND",t.MODULUS)||"0")+" % "+(e=i.valueToCode(e,"DIVISOR",t.MODULUS)||"0"),t.MODULUS]},math_number:function(e,i){return(e=Number(e.getFieldValue("NUM")))===1/0?["INF",t.ATOMIC]:e===-1/0?["-INF",t.UNARY_NEGATION]:[String(e),e>=0?t.ATOMIC:t.UNARY_NEGATION]},math_number_property:function(e,i){var n={EVEN:[""," % 2 == 0",t.MODULUS,t.EQUALITY],ODD:[""," % 2 == 1",t.MODULUS,t.EQUALITY],WHOLE:["is_int(",")",t.NONE,t.FUNCTION_CALL],POSITIVE:[""," > 0",t.RELATIONAL,t.RELATIONAL],NEGATIVE:[""," < 0",t.RELATIONAL,t.RELATIONAL],DIVISIBLE_BY:[null,null,t.MODULUS,t.EQUALITY],PRIME:[null,null,t.NONE,t.FUNCTION_CALL]};let o=e.getFieldValue("PROPERTY"),[r,s,a,l]=n[o];if(n=i.valueToCode(e,"NUMBER_TO_CHECK",a)||"0","PRIME"===o)e=i.provideFunction_("math_isPrime",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($n) {\n // https://en.wikipedia.org/wiki/Primality_test#Naive_methods\n if ($n == 2 || $n == 3) {\n return true;\n }\n // False if n is NaN, negative, is 1, or not whole.\n // And false if n is divisible by 2 or 3.\n if (!is_numeric($n) || $n <= 1 || $n % 1 != 0 || $n % 2 == 0 || $n % 3 == 0) {\n return false;\n }\n // Check all the numbers of form 6k +/- 1, up to sqrt(n).\n for ($x = 6; $x <= sqrt($n) + 1; $x += 6) {\n if ($n % ($x - 1) == 0 || $n % ($x + 1) == 0) {\n return false;\n }\n }\n return true;\n}\n`)+"("+n+")";else if("DIVISIBLE_BY"===o){if("0"===(e=i.valueToCode(e,"DIVISOR",t.MODULUS)||"0"))return["false",t.ATOMIC];e=n+" % "+e+" == 0"}else e=r+n+s;return[e,l]},math_on_list:function(e,i){var n=e.getFieldValue("OP");switch(n){case"SUM":e="array_sum("+(e=i.valueToCode(e,"LIST",t.FUNCTION_CALL)||"array()")+")";break;case"MIN":e="min("+(e=i.valueToCode(e,"LIST",t.FUNCTION_CALL)||"array()")+")";break;case"MAX":e="max("+(e=i.valueToCode(e,"LIST",t.FUNCTION_CALL)||"array()")+")";break;case"AVERAGE":e=(n=i.provideFunction_("math_mean",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($myList) {\n return array_sum($myList) / count($myList);\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"array()")+")";break;case"MEDIAN":e=(n=i.provideFunction_("math_median",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($arr) {\n sort($arr,SORT_NUMERIC);\n return (count($arr) % 2) ? $arr[floor(count($arr) / 2)] :\n ($arr[floor(count($arr) / 2)] + $arr[floor(count($arr) / 2) - 1]) / 2;\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"MODE":e=(n=i.provideFunction_("math_modes",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($values) {\n if (empty($values)) return array();\n $counts = array_count_values($values);\n arsort($counts); // Sort counts in descending order\n $modes = array_keys($counts, current($counts), true);\n return $modes;\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"STD_DEV":e=(n=i.provideFunction_("math_standard_deviation",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($numbers) {\n $n = count($numbers);\n if (!$n) return null;\n $mean = array_sum($numbers) / count($numbers);\n foreach($numbers as $key => $num) $devs[$key] = pow($num - $mean, 2);\n return sqrt(array_sum($devs) / (count($devs) - 1));\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;case"RANDOM":e=(n=i.provideFunction_("math_random_list",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($list) {\n $x = rand(0, count($list)-1);\n return $list[$x];\n}\n`))+"("+(e=i.valueToCode(e,"LIST",t.NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+n)}return[e,t.FUNCTION_CALL]},math_random_float:function(e,i){return["(float)rand()/(float)getrandmax()",t.FUNCTION_CALL]},math_random_int:function(e,i){let n=i.valueToCode(e,"FROM",t.NONE)||"0";return e=i.valueToCode(e,"TO",t.NONE)||"0",[i.provideFunction_("math_random_int",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($a, $b) {\n if ($a > $b) {\n return rand($b, $a);\n }\n return rand($a, $b);\n}\n`)+"("+n+", "+e+")",t.FUNCTION_CALL]}};
3g.math_round=r,g.math_single=r,g.math_trig=r;var m={procedures_callnoreturn:function(e,t){return t.forBlock.procedures_callreturn(e,t)[0]+";\n"},procedures_callreturn:function(e,i){let n=i.getProcedureName(e.getFieldValue("NAME")),o=[],r=e.getVars();for(let s=0;s<r.length;s++)o[s]=i.valueToCode(e,"ARG"+s,t.NONE)||"null";return[n+"("+o.join(", ")+")",t.FUNCTION_CALL]}};m.procedures_defnoreturn=s,m.procedures_defreturn=s,m.procedures_ifreturn=function(e,i){let n="if ("+(i.valueToCode(e,"CONDITION",t.NONE)||"false")+") {\n";return i.STATEMENT_SUFFIX&&(n+=i.prefixLines(i.injectId(i.STATEMENT_SUFFIX,e),i.INDENT)),e.hasReturnValue_?(e=i.valueToCode(e,"VALUE",t.NONE)||"null",n+=i.INDENT+"return "+e+";\n"):n+=i.INDENT+"return;\n",n+"}\n"};var T={text:function(e,i){return[i.quote_(e.getFieldValue("TEXT")),t.ATOMIC]},text_append:function(e,i){return i.getVariableName(e.getFieldValue("VAR"))+" .= "+(e=i.valueToCode(e,"TEXT",t.ASSIGNMENT)||"''")+";\n"},text_changeCase:function(e,i){let n;return i=i.valueToCode(e,"TEXT",t.NONE)||"''","UPPERCASE"===e.getFieldValue("CASE")?n="strtoupper("+i+")":"LOWERCASE"===e.getFieldValue("CASE")?n="strtolower("+i+")":"TITLECASE"===e.getFieldValue("CASE")&&(n="ucwords(strtolower("+i+"))"),[n,t.FUNCTION_CALL]},text_charAt:function(e,i){let n=e.getFieldValue("WHERE")||"FROM_START",o=i.valueToCode(e,"VALUE",t.NONE)||"''";switch(n){case"FIRST":return["substr("+o+", 0, 1)",t.FUNCTION_CALL];case"LAST":return["substr("+o+", -1)",t.FUNCTION_CALL];case"FROM_START":return["substr("+o+", "+(e=i.getAdjusted(e,"AT"))+", 1)",t.FUNCTION_CALL];case"FROM_END":return["substr("+o+", "+(e=i.getAdjusted(e,"AT",1,!0))+", 1)",t.FUNCTION_CALL];case"RANDOM":return[i.provideFunction_("text_random_letter",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($text) {\n return $text[rand(0, strlen($text) - 1)];\n}\n`)+"("+o+")",t.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).")},text_count:function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''";return["strlen("+(e=i.valueToCode(e,"SUB",t.NONE)||"''")+") === 0 ? strlen("+n+") + 1 : substr_count("+n+", "+e+")",t.CONDITIONAL]},text_getSubstring:function(e,i){let n=e.getFieldValue("WHERE1"),o=e.getFieldValue("WHERE2"),r=i.valueToCode(e,"STRING",t.NONE)||"''";if("FIRST"===n&&"LAST"===o)return[r,t.NONE];let s=i.getAdjusted(e,"AT1");return e=i.getAdjusted(e,"AT2"),[i.provideFunction_("text_get_substring",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($text, $where1, $at1, $where2, $at2) {\n if ($where1 == 'FROM_END') {\n $at1 = strlen($text) - 1 - $at1;\n } else if ($where1 == 'FIRST') {\n $at1 = 0;\n } else if ($where1 != 'FROM_START') {\n throw new Exception('Unhandled option (text_get_substring).');\n }\n $length = 0;\n if ($where2 == 'FROM_START') {\n $length = $at2 - $at1 + 1;\n } else if ($where2 == 'FROM_END') {\n $length = strlen($text) - $at1 - $at2;\n } else if ($where2 == 'LAST') {\n $length = strlen($text) - $at1;\n } else {\n throw new Exception('Unhandled option (text_get_substring).');\n }\n return substr($text, $at1, $length);\n}\n`)+"("+r+", '"+n+"', "+s+", '"+o+"', "+e+")",t.FUNCTION_CALL]},text_indexOf:function(e,i){let n="FIRST"===e.getFieldValue("END")?"strpos":"strrpos",o=i.valueToCode(e,"FIND",t.NONE)||"''",r=i.valueToCode(e,"VALUE",t.NONE)||"''",s=" -1",a="";return e.workspace.options.oneBasedIndex&&(s=" 0",a=" + 1"),[i.provideFunction_("FIRST"===e.getFieldValue("END")?"text_indexOf":"text_lastIndexOf",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($text, $search) {\n $pos = ${n}($text, $search);\n return $pos === false ? ${s} : $pos${a};\n}\n`)+"("+r+", "+o+")",t.FUNCTION_CALL]},text_isEmpty:function(e,i){return["empty("+(i.valueToCode(e,"VALUE",t.NONE)||"''")+")",t.FUNCTION_CALL]},text_join:function(e,i){if(0===e.itemCount_)return["''",t.ATOMIC];if(1===e.itemCount_)return[i.valueToCode(e,"ADD0",t.NONE)||"''",t.NONE];if(2===e.itemCount_){var n=i.valueToCode(e,"ADD0",t.STRING_CONCAT)||"''";return[n+" . "+(e=i.valueToCode(e,"ADD1",t.STRING_CONCAT)||"''"),t.STRING_CONCAT]}n=Array(e.itemCount_);for(let o=0;o<e.itemCount_;o++)n[o]=i.valueToCode(e,"ADD"+o,t.NONE)||"''";return["implode('', array("+n.join(",")+"))",t.FUNCTION_CALL]},text_length:function(e,i){return[i.provideFunction_("length",`\nfunction ${i.FUNCTION_NAME_PLACEHOLDER_}($value) {\n if (is_string($value)) {\n return strlen($value);\n }\n return count($value);\n}\n`)+"("+(e=i.valueToCode(e,"VALUE",t.NONE)||"''")+")",t.FUNCTION_CALL]},text_print:function(e,i){return"print("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+");\n"}};T.text_prompt=a,T.text_prompt_ext=a,T.text_replace=function(e,i){let n=i.valueToCode(e,"TEXT",t.NONE)||"''";return["str_replace("+(i.valueToCode(e,"FROM",t.NONE)||"''")+", "+(e=i.valueToCode(e,"TO",t.NONE)||"''")+", "+n+")",t.FUNCTION_CALL]},T.text_reverse=function(e,i){return["strrev("+(i.valueToCode(e,"TEXT",t.NONE)||"''")+")",t.FUNCTION_CALL]},T.text_trim=function(e,i){return[{LEFT:"ltrim",RIGHT:"rtrim",BOTH:"trim"}[e.getFieldValue("MODE")]+"("+(e=i.valueToCode(e,"TEXT",t.NONE)||"''")+")",t.FUNCTION_CALL]};var _={};_.variables_get=l,_.variables_set=c;var E={};E.variables_get_dynamic=l,E.variables_set_dynamic=c;var b=new u,O=Object.assign({},d,p,f,g,m,T,_,E);for(let I in O)b.forBlock[I]=O[I];var v={};return v.Order=t,v.PhpGenerator=u,v.phpGenerator=b,v.__namespace__=i,v})}),oN=a((e,t)=>{!function(i,n){if("object"==typeof e&&"object"==typeof t)t.exports=n(XL(),eN(),tN(),iN(),nN(),qL());else if("function"==typeof define&&define.amd)define(["blockly/core","blockly/javascript","blockly/dart","blockly/lua","blockly/php","blockly/python"],n);else{var o="object"==typeof e?n(XL(),eN(),tN(),iN(),nN(),qL()):n(i.Blockly,i["Blockly.JavaScript"],i["Blockly.Dart"],i["Blockly.Lua"],i["Blockly.PHP"],i["Blockly.Python"]);for(var r in o)("object"==typeof e?e:i)[r]=o[r]}}(e,(e,t,i,n,o,r)=>(()=>{var s={127:e=>{e.exports=t},157:e=>{e.exports=n},370:t=>{t.exports=e},379:e=>{e.exports=i},462:function(e,t,i){e.exports=(e=>(()=>{var t={370:t=>{t.exports=e}},i={};function n(e){var o=i[e];if(void 0!==o)return o.exports;var r=i[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}
3),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{FieldGridDropdown:()=>l});var r=n(370);class s{constructor(e,t,i,n){this.value=i,this.selected=!1,this.selectionCallback=n,this.element=document.createElement("button"),this.element.id=r.utils.idGenerator.getNextUniqueId(),this.element.className="blocklyFieldGridItem",this.clickHandler=r.browserEvents.conditionalBind(this.element,"click",this,this.onClick,!0),e.appendChild(this.element);let o="string"==typeof t?document.createTextNode(t):t;this.element.appendChild(o),r.utils.aria.setRole(this.element,r.utils.aria.Role.GRIDCELL)}dispose(){this.selectionCallback=null,this.element.remove(),this.clickHandler&&=(r.browserEvents.unbind(this.clickHandler),null)}getId(){return this.element.id}getValue(){return this.value}isSelected(){return this.selected}setSelected(e){this.selected=e,r.utils.aria.setState(this.element,r.utils.aria.State.SELECTED,this.selected),this.element.classList.toggle("blocklyFieldGridItemSelected",this.selected),this.isSelected()&&this.focus()}onClick(){var e;this.setSelected(!0),null==(e=this.selectionCallback)||e.call(this,this)}focus(){this.element.focus({preventScroll:!0});let e=this.element.offsetParent;if(!e)return;let t=this.element.offsetTop,i=e.scrollTop,n=this.getInterItemSpacing();t<i?e.scrollTo(0,t-n):t+this.element.offsetHeight>i+e.clientHeight&&e.scrollBy(0,t+this.element.clientHeight-(i+e.clientHeight)+n)}getInterItemSpacing(){let e=this.element.closest(".blocklyFieldGrid");if(!e)return 0;let t=[...e.querySelectorAll(".blocklyFieldGridItem")];if(!t.length)return 0;let i=t[0].offsetTop,n=t[0].offsetHeight;for(let o of t)if(o.offsetTop!==i)return o.offsetTop-n-i;return 0}}class a{constructor(e,t,i,n,o){if(this.columns=i,this.rtl=n,this.itemIndices=new Map,this.items=[],this.keyDownHandler=null,this.pointerMoveHandler=null,this.selectionCallback=o,this.root=document.createElement("div"),this.root.className="blocklyFieldGrid",this.root.tabIndex=0,r.utils.aria.setRole(this.root,r.utils.aria.Role.GRID),e.appendChild(this.root),this.populateItems(t),this.keyDownHandler=r.browserEvents.conditionalBind(this.root,"keydown",this,this.onKeyDown),this.pointerMoveHandler=r.browserEvents.conditionalBind(this.root,"pointermove",this,this.onPointerMove,!0),!(i>=1))throw Error(`Number of columns must be >= 1; got ${i}`);this.columns=i,this.root.style.setProperty("--grid-columns",`${this.columns}`)}populateItems(e){let t=document.createElement("div");for(let[i,n]of e.entries()){if(n===r.FieldDropdown.SEPARATOR)continue;i%this.columns===0&&(t=document.createElement("div"),t.className="blocklyFieldGridRow",r.utils.aria.setRole(t,r.utils.aria.Role.ROW),this.root.appendChild(t));let[e,o]=n,a=(()=>{if((t=e)&&"object"==typeof t&&"src"in t&&"string"==typeof t.src&&"alt"in t&&"string"==typeof t.alt&&"width"in t&&"number"==typeof t.width&&"height"in t&&"number"==typeof t.height){let t=new Image(e.width,e.height);return t.src=e.src,t.alt=e.alt||"",t}var t;return e})(),l=new s(t,a,o,e=>{var t;this.setSelectedValue(e.getValue()),null==(t=this.selectionCallback)||t.call(this,e)});this.itemIndices.set(l.getId(),this.itemIndices.size),this.items.push(l)}}dispose(){this.selectionCallback=void 0;for(let e of this.items)e.dispose();this.itemIndices.clear(),this.items.length=0,this.keyDownHandler&&=(r.browserEvents.unbind(this.keyDownHandler),null),this.pointerMoveHandler&&=(r.browserEvents.unbind(this.pointerMoveHandler),null),this.root.remove()}onKeyDown(e){if(!(!this.items.length||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){switch(e.key){case"ArrowUp":this.moveFocus(-1*this.columns,!0);break;case"ArrowDown":this.moveFocus(this.columns,!0);break;case"ArrowLeft":this.moveFocus(-1*(this.rtl?-1:1),!0);break;case"ArrowRight":this.moveFocus(1*(this.rtl?-1:1),!0);break;case"PageUp":case"Home":this.moveFocus(0,!1);break;case"PageDown":case"End":this.moveFocus(this.items.length-1,!1);break;case"Enter":case"Space":return void e.stopPropagation();default:return}e.preventDefault(),e.stopPropagation()}}onPointerMove(e){if(!e.movementX&&!e.movementY||!(e.target instanceof Element))return;let t=e.target.closest(".blocklyFieldGridItem");if(!t)return;let i=t.id,n=this.itemIndices.get(i);void 0!==n&&this.moveFocus(n,!1)}setSelectedValue(e){for(let[t,i]of this.items.entries()){let n=i.getValue()===e;i.setSelected(n),n&&this.moveFocus(t,!1)}}moveFocus(e,t){let i=e;if(t){let e=this.getFocusedItem();if(!e)return;i+=this.indexOfItem(e)}let n=this.itemAtIndex(i);n&&(n.focus(),r.utils.aria.setState(this.root,r.utils.aria.State.ACTIVEDESCENDANT,n.getId()))}indexOfItem(e){return this.itemIndices.get(e.getId())??-1}itemAtIndex(e){return this.items[e]}getFocusedItem(){let e=this.root.querySelector(".blocklyFieldGridItem:focus")??this.root.querySelector(".blocklyFieldGridItem");if(!e||!e.id)return;let t=this.itemIndices.get(e.id);return void 0===t?void 0:this.itemAtIndex(t)}}class l extends r.FieldDropdown{constructor(e,t,i){super(e,t,i),this.columns=3,null!=i&&i.columns&&this.setColumns(parseInt(`${i.columns}`)),i&&i.primaryColour&&(this.primaryColour=i.primaryColour),i&&i.borderColour&&(this.borderColour=i.borderColour)}static fromJson(e){if(!e.options)throw Error("options are required for the dropdown field. The options property must be assigned an array of [humanReadableValue, languageNeutralValue] tuples.");return new this(e.options,void 0,e)}setColumns(e){var t;!isNaN(e)&&e>=1&&(this.columns=e,r.DropDownDiv.getOwner()===this&&r.DropDownDiv.isVisible()&&(null==(t=this.grid)||t.dispose(),this.showEditor_()))}showEditor_(e){r.DropDownDiv.clearContent();let t=!!this.getSourceBlock()?.workspace.RTL;this.grid=new a(r.DropDownDiv.getContentDiv(),this.getOptions(!1),this.columns,t,e=>{r.DropDownDiv.hideIfOwner(this),this.setValue(e.getValue())}),r.DropDownDiv.getContentDiv().classList.add("blocklyFieldGridContainer");let i=this.getColours();i&&i.border&&r.DropDownDiv.setColour(i.primary,i.border),r.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));let n=this.getValue();n&&this.grid.setSelectedValue(n)}doValueUpdate_(e){var t;super.doValueUpdate_(e),null==(t=this.grid)||t.setSelectedValue(e)}getColours(){if(this.primaryColour&&this.borderColour)return{primary:this.primaryColour,border:this.borderColour};let e=this.getSourceBlock();if(!(e instanceof r.BlockSvg))return;let t=e.isShadow()?e.getParent():e;return t?{primary:this.primaryColour??t.getColour(),border:this.borderColour??t.getColourTertiary()}:void 0}}return r.fieldRegistry.register("field_grid_dropdown",l),r.Css.register("\n .blocklyFieldGridContainer {\n padding: 7px;\n overflow: auto;\n }\n \n .blocklyFieldGrid {\n display: grid;\n grid-gap: 7px;\n grid-template-columns: repeat(var(--grid-columns), min-content);\n }\n\n .blocklyFieldGrid .blocklyFieldGridItem {\n border: 1px solid rgba(1, 1, 1, 0.5);\n border-radius: 4px;\n color: white;\n min-width: auto;\n background: none;\n white-space: nowrap;\n cursor: pointer;\n padding: 6px 15px;\n }\n \n .blocklyFieldGrid .blocklyFieldGridRow {\n display: contents;\n }\n \n .blocklyFieldGrid .blocklyFieldGridItem.blocklyFieldGridItemSelected {\n background-color: rgba(1, 1, 1, 0.25);\n }\n\n .blocklyFieldGrid .blocklyFieldGridItem:focus {\n box-shadow: 0 0 0 4px hsla(0, 0%, 100%, .2);\n outline: none;\n }\n "),o})())(i(370))},537:e=>{e.exports=o},557:e=>{e.exports=r}},a={};function l(e){var t=a[e];if(void 0!==t)return t.exports;var i=a[e]={exports:{}};return s[e].call(i.exports,i,i.exports,l),i.exports}l.d=(e,t)=>{for(var i in t)l.o(t,i)&&!l.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}
3),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{l.r(c),l.d(c,{FieldColour:()=>a,colourBlend:()=>n,colourPicker:()=>e,colourRandom:()=>t,colourRgb:()=>i,installAllBlocks:()=>ne,registerFieldColour:()=>h});var e={};l.r(e),l.d(e,{BLOCK_NAME:()=>T,blockDefinition:()=>y,installBlock:()=>R,toDart:()=>b,toJavascript:()=>E,toLua:()=>O,toPhp:()=>v,toPython:()=>I});var t={};l.r(t),l.d(t,{BLOCK_NAME:()=>C,blockDefinition:()=>x,installBlock:()=>D,toDart:()=>L,toJavascript:()=>A,toLua:()=>N,toPhp:()=>w,toPython:()=>$});var i={};l.r(i),l.d(i,{BLOCK_NAME:()=>P,blockDefinition:()=>X,installBlock:()=>z,toDart:()=>U,toJavascript:()=>B,toLua:()=>H,toPhp:()=>V,toPython:()=>G});var n={};l.r(n),l.d(n,{BLOCK_NAME:()=>j,blockDefinition:()=>te,installBlock:()=>ie,toDart:()=>K,toJavascript:()=>Q,toLua:()=>q,toPhp:()=>J,toPython:()=>Z});var o=l(370),r=l(462);let s="#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(".");class a extends r.FieldGridDropdown{constructor(e,t,i){super(u(i?.colourOptions??s),t,Object.assign(Object.assign({},i),{columns:i?.columns??7})),this.isDirty_=!1,e!==o.Field.SKIP_SETUP&&this.setValue(e)}trimOptions(e){return{options:e}}configure_(e){super.configure_(e),e.colourOptions&&this.setColours(e.colourOptions,e.colourTitles)}initView(){let e=this.getConstants();if(!e)throw Error("Constants not found");this.size_=new o.utils.Size(e.FIELD_COLOUR_DEFAULT_WIDTH,e.FIELD_COLOUR_DEFAULT_HEIGHT),this.createBorderRect_(),this.getBorderRect().style.fillOpacity="1",this.getBorderRect().setAttribute("stroke","#fff"),this.isFullBlockField()&&(this.clickTarget_=this.sourceBlock_.getSvgRoot())}showEditor_(e){super.showEditor_(e),o.DropDownDiv.getContentDiv().classList.add("blocklyFieldColour"),o.DropDownDiv.repositionForWindowResize()}isFullBlockField(){if(!this.getSourceBlock())throw new o.UnattachedFieldError;let e=this.getConstants();return this.blockIsSimpleReporter()&&!!e?.FIELD_COLOUR_FULL_BLOCK}blockIsSimpleReporter(){let e=this.getSourceBlock();if(!e)throw new o.UnattachedFieldError;if(!e.outputConnection)return!1;for(let t of e.inputList)if(t.connection||t.fieldRow.length>1)return!1;return!0}applyColour(){let e=this.getSourceBlock();if(!e)throw new o.UnattachedFieldError;if(!this.fieldGroup_)return;let t=this.borderRect_;if(!t)throw Error("The border rect has not been initialized");this.isFullBlockField()?(t.style.display="none",e.pathObject.svgPath.setAttribute("fill",this.getValue()),e.pathObject.svgPath.setAttribute("stroke","#fff")):(t.style.display="block",t.style.fill=this.getValue())}getSize(){var e;return null!=(e=this.getConstants())&&e.FIELD_COLOUR_FULL_BLOCK&&(this.render_(),this.isDirty_=!1),super.getSize()}render_(){this.updateSize_();let e=this.getSourceBlock();if(!e)throw new o.UnattachedFieldError;e.applyColour()}updateSize_(e){let t,i,n=this.getConstants();n&&(this.isFullBlockField()?(t=2*(e??0),i=n.FIELD_TEXT_HEIGHT):(t=n.FIELD_COLOUR_DEFAULT_WIDTH,i=n.FIELD_COLOUR_DEFAULT_HEIGHT),this.size_.height=i,this.size_.width=t,this.positionBorderRect_())}doClassValidation_(e){return"string"==typeof e?o.utils.colour.parse(e):null}getText(){let e=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(e)&&(e="#"+e[1]+e[3]+e[5]),e}setColours(e,t){let i=u(e,t);return this.setOptions(i),this}static fromJson(e){return new this(e.colour,void 0,e)}}function u(e,t){return e.map((e,i)=>{let n=document.createElement("div");return n.className="blocklyColourSwatch",n.style.backgroundColor=e,t&&i<t.length&&(n.title=t[i]),[n,e]})}function h(){o.fieldRegistry.register("field_colour",a)}a.prototype.DEFAULT_VALUE="#ffffff",o.Css.register("\n.blocklyFieldColour .blocklyFieldGridItemSelected,\n.blocklyFieldGridItemSelected:hover {\n border-color: #eee !important;\n outline: 1px solid #333;\n position: relative;\n}
3\n\n.blocklyColourSwatch {\n width: 20px;\n height: 20px;\n}\n\n.blocklyGridContainer {\n padding: 0px;\n}\n\n.blocklyFieldColour .blocklyFieldGrid {\n grid-gap: 0px;\n row-gap: 4px;\n}\n\n.blocklyFieldColour .blocklyFieldGrid .blocklyGridItem {\n border-radius: 0;\n padding: 0;\n border: 0.5px solid #888;\n cursor: pointer;\n}\n\n.blocklyFieldColour .blocklyFieldGrid .blocklyFieldGridItem {\n border: 0.5px solid #888;\n padding: 0;\n margin: 0;\n border-radius: 0;\n}\n\n.blocklyFieldColour .blocklyFieldGrid .blocklyFieldGridItem:focus {\n border-color: #eee;\n box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.3);\n position: relative;\n border-radius: 0;\n outline: none;\n}\n");var d=l(127),p=l(379),f=l(157),g=l(537),m=l(557);let T="colour_picker",_={type:T,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"]};function E(e,t){return[t.quote_(e.getFieldValue("COLOUR")),d.Order.ATOMIC]}function b(e,t){return[t.quote_(e.getFieldValue("COLOUR")),p.Order.ATOMIC]}function O(e,t){return[t.quote_(e.getFieldValue("COLOUR")),f.Order.ATOMIC]}function v(e,t){return[t.quote_(e.getFieldValue("COLOUR")),g.Order.ATOMIC]}function I(e,t){return[t.quote_(e.getFieldValue("COLOUR")),m.Order.ATOMIC]}let S=o.common.createBlockDefinitionsFromJsonArray([_]),y=S[T];function R(e={}){h(),o.common.defineBlocks(S),e.javascript&&(e.javascript.forBlock[T]=E),e.dart&&(e.dart.forBlock[T]=b),e.lua&&(e.lua.forBlock[T]=O),e.php&&(e.php.forBlock[T]=v),e.python&&(e.python.forBlock[T]=I)}let C="colour_random",k={type:C,message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"};function A(e,t){return[t.provideFunction_("colourRandom",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}() {\n var num = Math.floor(Math.random() * 0x1000000);\n return '#' + ('00000' + num.toString(16)).substr(-6);\n}\n`)+"()",d.Order.FUNCTION_CALL]}function L(e,t){return t.definitions_.import_dart_math="import 'dart:math' as Math;",[t.provideFunction_("colour_random",`\nString ${t.FUNCTION_NAME_PLACEHOLDER_}() {\n String hex = '0123456789abcdef';\n var rnd = new Math.Random();\n return '#\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}'\n '\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}'\n '\${hex[rnd.nextInt(16)]}\${hex[rnd.nextInt(16)]}';\n}\n`)+"()",p.Order.UNARY_POSTFIX]}function N(e,t){return['string.format("#%06x", math.random(0, 2^24 - 1))',f.Order.HIGH]}function w(e,t){return[t.provideFunction_("colour_random",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}() {\n return '#' . str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);\n}\n`)+"()",g.Order.FUNCTION_CALL]}function $(e,t){return t.definitions_.import_random="import random",["'#%06x' % random.randint(0, 2**24 - 1)",m.Order.FUNCTION_CALL]}let M=o.common.createBlockDefinitionsFromJsonArray([k]),x=M[C];function D(e={}){h(),o.common.defineBlocks(M),e.javascript&&(e.javascript.forBlock[C]=A),e.dart&&(e.dart.forBlock[C]=L),e.lua&&(e.lua.forBlock[C]=N),e.php&&(e.php.forBlock[C]=w),e.python&&(e.python.forBlock[C]=$)}let P="colour_rgb",F={type:P,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}"};function B(e,t){let i=t.valueToCode(e,"RED",d.Order.NONE)||0,n=t.valueToCode(e,"GREEN",d.Order.NONE)||0,o=t.valueToCode(e,"BLUE",d.Order.NONE)||0;return[`${t.provideFunction_("colourRgb",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {\n r = Math.max(Math.min(Number(r), 100), 0) * 2.55;\n g = Math.max(Math.min(Number(g), 100), 0) * 2.55;\n b = Math.max(Math.min(Number(b), 100), 0) * 2.55;\n r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);\n g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);\n b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n`)}(${i}, ${n}, ${o})`,d.Order.FUNCTION_CALL]}function U(e,t){let i=t.valueToCode(e,"RED",p.Order.NONE)||0,n=t.valueToCode(e,"GREEN",p.Order.NONE)||0,o=t.valueToCode(e,"BLUE",p.Order.NONE)||0;return t.definitions_.import_dart_math="import 'dart:math' as Math;",[`${t.provideFunction_("colour_rgb",`\nString ${t.FUNCTION_NAME_PLACEHOLDER_}(num r, num g, num b) {\n num rn = (Math.max(Math.min(r, 100), 0) * 2.55).round();\n String rs = rn.toInt().toRadixString(16);\n rs = '0$rs';\n rs = rs.substring(rs.length - 2);\n num gn = (Math.max(Math.min(g, 100), 0) * 2.55).round();\n String gs = gn.toInt().toRadixString(16);\n gs = '0$gs';\n gs = gs.substring(gs.length - 2);\n num bn = (Math.max(Math.min(b, 100), 0) * 2.55).round();\n String bs = bn.toInt().toRadixString(16);\n bs = '0$bs';\n bs = bs.substring(bs.length - 2);\n return '#$rs$gs$bs';
3\n}\n`)}(${i}, ${n}, ${o})`,p.Order.UNARY_POSTFIX]}function H(e,t){return[`${t.provideFunction_("colour_rgb",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}(r, g, b)\n r = math.floor(math.min(100, math.max(0, r)) * 2.55 + .5)\n g = math.floor(math.min(100, math.max(0, g)) * 2.55 + .5)\n b = math.floor(math.min(100, math.max(0, b)) * 2.55 + .5)\n return string.format("#%02x%02x%02x", r, g, b)\nend\n`)}(${t.valueToCode(e,"RED",f.Order.NONE)||0}, ${t.valueToCode(e,"GREEN",f.Order.NONE)||0}, ${t.valueToCode(e,"BLUE",f.Order.NONE)||0})`,f.Order.HIGH]}function V(e,t){let i=t.valueToCode(e,"RED",g.Order.NONE)||0,n=t.valueToCode(e,"GREEN",g.Order.NONE)||0,o=t.valueToCode(e,"BLUE",g.Order.NONE)||0;return[`${t.provideFunction_("colour_rgb",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}($r, $g, $b) {\n $r = round(max(min($r, 100), 0) * 2.55);\n $g = round(max(min($g, 100), 0) * 2.55);\n $b = round(max(min($b, 100), 0) * 2.55);\n $hex = '#';\n $hex .= str_pad(dechex($r), 2, '0', STR_PAD_LEFT);\n $hex .= str_pad(dechex($g), 2, '0', STR_PAD_LEFT);\n $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);\n return $hex;\n}\n`)}(${i}, ${n}, ${o})`,g.Order.FUNCTION_CALL]}function G(e,t){return[t.provideFunction_("colour_rgb",`\ndef ${t.FUNCTION_NAME_PLACEHOLDER_}(r, g, b):\n r = round(min(100, max(0, r)) * 2.55)\n g = round(min(100, max(0, g)) * 2.55)\n b = round(min(100, max(0, b)) * 2.55)\n return '#%02x%02x%02x' % (r, g, b)\n`)+"("+(t.valueToCode(e,"RED",m.Order.NONE)||0)+", "+(t.valueToCode(e,"GREEN",m.Order.NONE)||0)+", "+(t.valueToCode(e,"BLUE",m.Order.NONE)||0)+")",m.Order.FUNCTION_CALL]}let W=o.common.createBlockDefinitionsFromJsonArray([F]),X=W[P];function z(e={}){h(),o.common.defineBlocks(W),e.javascript&&(e.javascript.forBlock[P]=B),e.dart&&(e.dart.forBlock[P]=U,e.dart.addReservedWords("Math")),e.lua&&(e.lua.forBlock[P]=H),e.php&&(e.php.forBlock[P]=V),e.python&&(e.python.forBlock[P]=G)}let j="colour_blend",Y={type:j,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}"};function Q(e,t){let i=t.valueToCode(e,"COLOUR1",d.Order.NONE)||"'#000000'",n=t.valueToCode(e,"COLOUR2",d.Order.NONE)||"'#000000'",o=t.valueToCode(e,"RATIO",d.Order.NONE)||.5;return[`${t.provideFunction_("colourBlend",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}(c1, c2, ratio) {\n ratio = Math.max(Math.min(Number(ratio), 1), 0);\n var r1 = parseInt(c1.substring(1, 3), 16);\n var g1 = parseInt(c1.substring(3, 5), 16);\n var b1 = parseInt(c1.substring(5, 7), 16);\n var r2 = parseInt(c2.substring(1, 3), 16);\n var g2 = parseInt(c2.substring(3, 5), 16);\n var b2 = parseInt(c2.substring(5, 7), 16);\n var r = Math.round(r1 * (1 - ratio) + r2 * ratio);\n var g = Math.round(g1 * (1 - ratio) + g2 * ratio);\n var b = Math.round(b1 * (1 - ratio) + b2 * ratio);\n r = ('0' + (r || 0).toString(16)).slice(-2);\n g = ('0' + (g || 0).toString(16)).slice(-2);\n b = ('0' + (b || 0).toString(16)).slice(-2);\n return '#' + r + g + b;\n}\n`)}(${i}, ${n}, ${o})`,d.Order.FUNCTION_CALL]}function K(e,t){let i=t.valueToCode(e,"COLOUR1",p.Order.NONE)||"'#000000'",n=t.valueToCode(e,"COLOUR2",p.Order.NONE)||"'#000000'",o=t.valueToCode(e,"RATIO",p.Order.NONE)||.5;return t.definitions_.import_dart_math="import 'dart:math' as Math;",[`${t.provideFunction_("colour_blend",`\nString ${t.FUNCTION_NAME_PLACEHOLDER_}(String c1, String c2, num ratio) {\n ratio = Math.max(Math.min(ratio, 1), 0);\n int r1 = int.parse('0x\${c1.substring(1, 3)}');\n int g1 = int.parse('0x\${c1.substring(3, 5)}');\n int b1 = int.parse('0x\${c1.substring(5, 7)}');\n int r2 = int.parse('0x\${c2.substring(1, 3)}');\n int g2 = int.parse('0x\${c2.substring(3, 5)}');\n int b2 = int.parse('0x\${c2.substring(5, 7)}');\n num rn = (r1 * (1 - ratio) + r2 * ratio).round();\n String rs = rn.toInt().toRadixString(16);
3\n num gn = (g1 * (1 - ratio) + g2 * ratio).round();\n String gs = gn.toInt().toRadixString(16);\n num bn = (b1 * (1 - ratio) + b2 * ratio).round();\n String bs = bn.toInt().toRadixString(16);\n rs = '0$rs';\n rs = rs.substring(rs.length - 2);\n gs = '0$gs';\n gs = gs.substring(gs.length - 2);\n bs = '0$bs';\n bs = bs.substring(bs.length - 2);\n return '#$rs$gs$bs';\n}\n`)}(${i}, ${n}, ${o})`,p.Order.UNARY_POSTFIX]}function q(e,t){return[`${t.provideFunction_("colour_blend",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}(colour1, colour2, ratio)\n local r1 = tonumber(string.sub(colour1, 2, 3), 16)\n local r2 = tonumber(string.sub(colour2, 2, 3), 16)\n local g1 = tonumber(string.sub(colour1, 4, 5), 16)\n local g2 = tonumber(string.sub(colour2, 4, 5), 16)\n local b1 = tonumber(string.sub(colour1, 6, 7), 16)\n local b2 = tonumber(string.sub(colour2, 6, 7), 16)\n local ratio = math.min(1, math.max(0, ratio))\n local r = math.floor(r1 * (1 - ratio) + r2 * ratio + .5)\n local g = math.floor(g1 * (1 - ratio) + g2 * ratio + .5)\n local b = math.floor(b1 * (1 - ratio) + b2 * ratio + .5)\n return string.format("#%02x%02x%02x", r, g, b)\nend\n`)}(${t.valueToCode(e,"COLOUR1",f.Order.NONE)||"'#000000'"}, ${t.valueToCode(e,"COLOUR2",f.Order.NONE)||"'#000000'"}, ${t.valueToCode(e,"RATIO",f.Order.NONE)||0})`,f.Order.HIGH]}function J(e,t){let i=t.valueToCode(e,"COLOUR1",g.Order.NONE)||"'#000000'",n=t.valueToCode(e,"COLOUR2",g.Order.NONE)||"'#000000'",o=t.valueToCode(e,"RATIO",g.Order.NONE)||.5;return[`${t.provideFunction_("colour_blend",`\nfunction ${t.FUNCTION_NAME_PLACEHOLDER_}($c1, $c2, $ratio) {\n $ratio = max(min($ratio, 1), 0);\n $r1 = hexdec(substr($c1, 1, 2));\n $g1 = hexdec(substr($c1, 3, 2));\n $b1 = hexdec(substr($c1, 5, 2));\n $r2 = hexdec(substr($c2, 1, 2));\n $g2 = hexdec(substr($c2, 3, 2));\n $b2 = hexdec(substr($c2, 5, 2));\n $r = round($r1 * (1 - $ratio) + $r2 * $ratio);\n $g = round($g1 * (1 - $ratio) + $g2 * $ratio);\n $b = round($b1 * (1 - $ratio) + $b2 * $ratio);\n $hex = '#';\n $hex .= str_pad(dechex($r), 2, '0', STR_PAD_LEFT);\n $hex .= str_pad(dechex($g), 2, '0', STR_PAD_LEFT);\n $hex .= str_pad(dechex($b), 2, '0', STR_PAD_LEFT);\n return $hex;\n}\n`)}(${i}, ${n}, ${o})`,g.Order.FUNCTION_CALL]}function Z(e,t){return[`${t.provideFunction_("colour_blend",`\ndef ${t.FUNCTION_NAME_PLACEHOLDER_}(colour1, colour2, ratio):\n r1, r2 = int(colour1[1:3], 16), int(colour2[1:3], 16)\n g1, g2 = int(colour1[3:5], 16), int(colour2[3:5], 16)\n b1, b2 = int(colour1[5:7], 16), int(colour2[5:7], 16)\n ratio = min(1, max(0, ratio))\n r = round(r1 * (1 - ratio) + r2 * ratio)\n g = round(g1 * (1 - ratio) + g2 * ratio)\n b = round(b1 * (1 - ratio) + b2 * ratio)\n return '#%02x%02x%02x' % (r, g, b)\n`)}(${t.valueToCode(e,"COLOUR1",m.Order.NONE)||"'#000000'"}, ${t.valueToCode(e,"COLOUR2",m.Order.NONE)||"'#000000'"}, ${t.valueToCode(e,"RATIO",m.Order.NONE)||0})`,m.Order.FUNCTION_CALL]}let ee=o.common.createBlockDefinitionsFromJsonArray([Y]),te=ee[j];function ie(e={}){h(),o.common.defineBlocks(ee),e.javascript&&(e.javascript.forBlock[j]=Q),e.dart&&(e.dart.forBlock[j]=K,e.dart.addReservedWords("Math")),e.lua&&(e.lua.forBlock[j]=q),e.php&&(e.php.forBlock[j]=J),e.python&&(e.python.forBlock[j]=Z)}function ne(e={}){R(e),z(e),D(e),ie(e)}})(),c})())}),rN=l({registerTurtleBlocks:()=>aN});function sN(){return WL.definitions_.import_turtle="import turtle",""}function aN(){eL([{type:"turtle_forward",message0:"%{BKY_TURTLE_FORWARD}",args0:[{type:"input_value",name:"STEPS",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_backward",message0:"%{BKY_TURTLE_BACKWARD}",args0:[{type:"input_value",name:"STEPS",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_move",message0:"%{BKY_TURTLE_MOVE}",args0:[{type:"field_dropdown",name:"DIR",options:[[Qk.TURTLE_DIR_FORWARD??"forward","forward"],[Qk.TURTLE_DIR_BACKWARD??"backward","backward"]]},{type:"input_value",name:"STEPS",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_speed",message0:"%{BKY_TURTLE_SPEED}",args0:[{type:"input_value",name:"SPEED",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_turn",message0:"%{BKY_TURTLE_TURN}",args0:[{type:"field_dropdown",name:"DIR",options:[[Qk.TURTLE_DIR_LEFT??"left","left"],[Qk.TURTLE_DIR_RIGHT??"right","right"]]},{type:"input_value",name:"DEG",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_left",message0:"%{BKY_TURTLE_LEFT}",args0:[{type:"input_value",name:"DEG",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_right",message0:"%{BKY_TURTLE_RIGHT}",args0:[{type:"input_value",name:"DEG",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_pen_up",message0:"%{BKY_TURTLE_PEN_UP}",previousStatement:null,nextStatement:null,colour:160},{type:"turtle_pen_down",message0:"%{BKY_TURTLE_PEN_DOWN}",previousStatement:null,nextStatement:null,colour:160},{type:"turtle_color",message0:"%{BKY_TURTLE_COLOR_DROPDOWN}",args0:[{type:"field_dropdown",name:"COLOR",options:[[Qk.TURTLE_COLOR_RED??"red","red"],[Qk.TURTLE_COLOR_BLUE??"blue","blue"],[Qk.TURTLE_COLOR_GREEN??"green","green"],[Qk.TURTLE_COLOR_BLACK??"black","black"],[Qk.TURTLE_COLOR_ORANGE??"orange","orange"],[Qk.TURTLE_COLOR_PURPLE??"purple","purple"]]}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_color_input",message0:"%{BKY_TURTLE_COLOR_INPUT}",args0:[{type:"input_value",name:"COLOR",check:"Colour"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_circle",message0:"%{BKY_TURTLE_CIRCLE}",args0:[{type:"input_value",name:"R",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_goto",message0:"%{BKY_TURTLE_GOTO}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_home",message0:"%{BKY_TURTLE_HOME}",previousStatement:null,nextStatement:null,colour:160},{type:"turtle_clear",message0:"%{BKY_TURTLE_CLEAR}",previousStatement:null,nextStatement:null,colour:160},{type:"turtle_width",message0:"%{BKY_TURTLE_WIDTH}",args0:[{type:"input_value",name:"WIDTH",check:"Number"}],previousStatement:null,nextStatement:null,colour:160},{type:"turtle_begin_fill",message0:"%{BKY_TURTLE_BEGIN_FILL}",previousStatement:null,nextStatement:null,colour:160},{type:"turtle_end_fill",message0:"%{BKY_TURTLE_END_FILL}",previousStatement:null,nextStatement:null,colour:160}]),HL.forBlock.turtle_speed=e=>(sN(),`turtle.speed(${HL.valueToCode(e,"SPEED",BL.NONE)||"5"})\n`),HL.forBlock.turtle_turn=e=>(sN(),`turtle.${e.getFieldValue("DIR")??"left"}(${HL.valueToCode(e,"DEG",BL.NONE)||"0"})\n`),HL.forBlock.turtle_move=e=>(sN(),`turtle.${e.getFieldValue("DIR")??"forward"}(${HL.valueToCode(e,"STEPS",BL.NONE)||"0"})\n`),HL.forBlock.turtle_forward=e=>(sN(),`turtle.forward(${HL.valueToCode(e,"STEPS",BL.NONE)||"0"})\n`),HL.forBlock.turtle_backward=e=>(sN(),`turtle.backward(${HL.valueToCode(e,"STEPS",BL.NONE)||"0"})\n`),HL.forBlock.turtle_left=e=>(sN(),`turtle.left(${HL.valueToCode(e,"DEG",BL.NONE)||"0"})\n`),HL.forBlock.turtle_right=e=>(sN(),`turtle.right(${HL.valueToCode(e,"DEG",BL.NONE)||"0"})\n`),HL.forBlock.turtle_pen_up=()=>(sN(),"turtle.penup()\n"),HL.forBlock.turtle_pen_down=()=>(sN(),"turtle.pendown()\n"),HL.forBlock.turtle_color=e=>(sN(),`turtle.color("${e.getFieldValue("COLOR")??"black"}")\n`),HL.forBlock.turtle_color_input=e=>(sN(),`turtle.color(${HL.valueToCode(e,"COLOR",BL.NONE)||'"black"'})\n`),HL.forBlock.turtle_circle=e=>(sN(),`turtle.circle(${HL.valueToCode(e,"R",BL.NONE)||"0"})\n`),HL.forBlock.turtle_goto=e=>(sN(),`turtle.goto(${HL.valueToCode(e,"X",BL.NONE)||"0"}, ${HL.valueToCode(e,"Y",BL.NONE)||"0"})\n`),HL.forBlock.turtle_home=()=>(sN(),"turtle.home()\n"),HL.forBlock.turtle_clear=()=>(sN(),"turtle.clear()\n"),HL.forBlock.turtle_width=e=>(sN(),`turtle.width(${HL.valueToCode(e,"WIDTH",BL.NONE)||"2"})\n`),HL.forBlock.turtle_begin_fill=()=>(sN(),"turtle.begin_fill()\n"),HL.forBlock.turtle_end_fill=()=>(sN(),"turtle.end_fill()\n"),GL||=((0,VL.installAllBlocks)({python:HL}),!0)}var lN=s(()=>{VL=oN(),KL(),ZL(),GL=!1,WL=HL}),cN=l({downloadWorkspaceJson:()=>pN,fetchWorkspace:()=>uN,loadWorkspace:()=>
3dN,serializeWorkspace:()=>hN});async function uN(e,t){try{let i=new Headers;t&&i.append("Authorization",`Bearer ${await t()}`);let n=await fetch(e,{headers:i});return n.ok?{ok:!0,value:await n.json()}:{ok:!1,error:`HTTP ${n.status}`}}catch(e){return{ok:!1,error:e.message??"network error"}}}function hN(e){return LL.workspaces.save(e)}function dN(e,t){LL.workspaces.load(e,t)}function pN(e,t="blokker.json"){let i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),n=URL.createObjectURL(i),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(n)}var fN,gN,mN,TN,_N,EN,bN,ON,vN,IN,SN,yN,RN,CN,kN,AN,LN,NN,wN,$N,MN,xN,DN,PN,FN,BN,UN,HN,VN,GN,WN,XN,zN,jN,YN,QN,KN,qN,JN,ZN,ew,tw,iw,nw,ow,rw,sw,aw,lw,cw,uw,hw,dw,pw,fw,gw,mw,Tw,_w,Ew,bw,Ow,vw,Iw,Sw,yw,Rw,Cw,kw,Aw,Lw,Nw,ww,$w,Mw,xw,Dw,Pw,Fw,Bw,Uw,Hw,Vw,Gw,Ww,Xw,zw,jw,Yw,Qw,Kw,qw,Jw,Zw,e$,t$,i$,n$,o$,r$,s$,a$,l$,c$,u$,h$,d$,p$,f$,g$,m$,T$,_$,E$,b$,O$,v$,I$,S$,y$,R$,C$,k$,A$,L$,N$,w$,$$,M$,x$,D$,P$,F$,B$,U$,H$,V$,G$,W$,X$,z$,j$,Y$,Q$,K$,q$,J$,Z$,eM,tM,iM,nM,oM,rM,sM,aM,lM,cM,uM,hM,dM,pM,fM,gM,mM,TM,_M,EM,bM,OM,vM,IM,SM,yM,RM,CM,kM,AM,LM,NM,wM=s(()=>{KL()}),$M=l({blocks:()=>gN,lists:()=>mN,logic:()=>TN,loops:()=>_N,math:()=>EN,procedures:()=>bN,texts:()=>ON,variables:()=>vN,variablesDynamic:()=>IN}),MM=s(()=>{fN=u(jL(),1),({blocks:gN,lists:mN,logic:TN,loops:_N,math:EN,procedures:bN,texts:ON,variables:vN,variablesDynamic:IN}=fN.default)}),xM=s(()=>{SN=u(XL(),1),({Block:yN,BlockFlyoutInflater:RN,BlockNavigationPolicy:CN,BlockSvg:kN,Blocks:AN,ButtonFlyoutInflater:LN,COLLAPSED_FIELD_NAME:NN,COLLAPSED_INPUT_NAME:wN,COLLAPSE_CHARS:$N,CodeGenerator:MN,CollapsibleToolboxCategory:xN,ComponentManager:DN,Connection:PN,ConnectionChecker:FN,ConnectionDB:BN,ConnectionNavigationPolicy:UN,ConnectionType:HN,ContextMenu:VN,ContextMenuItems:GN,ContextMenuRegistry:WN,Css:XN,DELETE_VARIABLE_ID:zN,DeleteArea:jN,DragTarget:YN,DropDownDiv:QN,Events:KN,Extensions:qN,Field:JN,FieldCheckbox:ZN,FieldDropdown:ew,FieldImage:tw,FieldLabel:iw,FieldLabelSerializable:nw,FieldNavigationPolicy:ow,FieldNumber:rw,FieldTextInput:sw,FieldVariable:aw,Flyout:lw,FlyoutButton:cw,FlyoutButtonNavigationPolicy:uw,FlyoutItem:hw,FlyoutMetricsManager:dw,FlyoutNavigationPolicy:pw,FlyoutNavigator:fw,FlyoutSeparator:gw,FlyoutSeparatorNavigationPolicy:mw,FocusManager:Tw,FocusableTreeTraverser:_w,Generator:Ew,Gesture:bw,Grid:Ow,HorizontalFlyout:vw,INPUT_VALUE:Iw,Input:Sw,InsertionMarkerPreviewer:yw,KeyboardNavigationController:Rw,LabelFlyoutInflater:Cw,LineCursor:kw,Marker:Aw,MarkerManager:Lw,Menu:Nw,MenuItem:ww,MetricsManager:$w,Msg:Mw,NEXT_STATEMENT:xw,Names:Dw,Navigator:Pw,OPPOSITE_TYPE:Fw,OUTPUT_VALUE:Bw,Options:Uw,PREVIOUS_STATEMENT:Hw,PROCEDURE_CATEGORY_NAME:Vw,Procedures:Gw,RENAME_VARIABLE_ID:Ww,RenderedConnection:Xw,Scrollbar:zw,ScrollbarPair:jw,SeparatorFlyoutInflater:Yw,ShortcutItems:Qw,ShortcutRegistry:Kw,TOOLBOX_AT_BOTTOM:qw,TOOLBOX_AT_LEFT:Jw,TOOLBOX_AT_RIGHT:Zw,TOOLBOX_AT_TOP:e$,Theme:t$,ThemeManager:i$,Themes:n$,Toast:o$,Toolbox:r$,ToolboxCategory:s$,ToolboxItem:a$,ToolboxSeparator:l$,Tooltip:c$,Touch:u$,Trashcan:h$,UnattachedFieldError:d$,VARIABLE_CATEGORY_NAME:p$,VARIABLE_DYNAMIC_CATEGORY_NAME:f$,VERSION:g$,VariableMap:m$,VariableModel:T$,Variables:_$,VariablesDynamic:E$,VerticalFlyout:b$,WidgetDiv:O$,Workspace:v$,WorkspaceAudio:I$,WorkspaceDragger:S$,WorkspaceNavigationPolicy:y$,WorkspaceSvg:R$,Xml:C$,ZoomControls:k$,blockAnimations:A$,blockRendering:L$,browserEvents:N$,bubbles:w$,bumpObjects:$$,clipboard:M$,comments:x$,common:D$,config:P$,constants:F$,defineBlocksWithJsonArray:B$,dialog:U$,dragging:H$,fieldRegistry:V$,geras:G$,getFocusManager:W$,getMainWorkspace:X$,getSelected:z$,hasBubble:j$,hideChaff:Y$,icons:Q$,inject:K$,inputs:q$,isCopyable:J$,isDeletable:Z$,isDraggable:eM,isIcon:tM,isObservable:iM,isPaster:nM,isRenderedElement:oM,isSelectable:rM,isSerializable:sM,isVariableBackedParameterModel:aM,keyboardNavigationController:lM,layers:cM,navigateBlock:uM,navigateStacks:hM,procedures:dM,registry:pM,renderManagement:fM,serialization:gM,setLocale:mM,setParentContainer:TM,svgResize:_M,thrasos:EM,uiPosition:bM,utils:OM,zelos:vM}=SN.default)}),DM=s(()=>{xM(),IM=function(e){return e.NOWHERE="nowhere",e.WORKSPACE="workspace",e.FLYOUT="flyout",e.TOOLBOX="toolbox",e}({}),SM=function(e){return e.UP="up",e.DOWN="down",e.RIGHT="right",e.LEFT="left",e.NEXT_STACK="next_stack",e.PREVIOUS_STACK="previous_stack",e.INSERT="insert",e.EDIT_OR_CONFIRM="edit_or_confirm",e.DISCONNECT="disconnect",e.TOOLBOX="toolbox",e.EXIT="exit",e.MENU="menu",e.COPY="keyboard_nav_copy",e.CUT="keyboard_nav_cut",e.PASTE="keyboard_nav_paste",e.DUPLICATE="duplicate",e.MOVE_WS_CURSOR_UP="workspace_up",e.MOVE_WS_CURSOR_DOWN="workspace_down",e.MOVE_WS_CURSOR_LEFT="workspace_left",e.MOVE_WS_CURSOR_RIGHT="workspace_r
3ight",e.CREATE_WS_CURSOR="to_workspace",e.LIST_SHORTCUTS="list_shortcuts",e.CLEAN_UP="clean_up_workspace",e.START_MOVE="start_move",e}({}),yM={keyboard_nav_copy:Mw.Copy||"Copy",keyboard_nav_cut:Mw.Cut||"Cut",keyboard_nav_paste:Mw.Paste||"Paste",start_move:Mw.MOVE_BLOCK||"Move"},(RM={})[Mw.SHORTCUTS_GENERAL]=[SM.MENU,SM.EDIT_OR_CONFIRM,SM.EXIT,SM.TOOLBOX,SM.CLEAN_UP,SM.LIST_SHORTCUTS],RM[Mw.SHORTCUTS_EDITING]=["delete",SM.DISCONNECT,SM.START_MOVE,SM.CUT,SM.COPY,SM.PASTE,SM.DUPLICATE,"undo","redo"],RM[Mw.SHORTCUTS_CODE_NAVIGATION]=[SM.UP,SM.DOWN,SM.RIGHT,SM.LEFT,SM.NEXT_STACK,SM.PREVIOUS_STACK,SM.CREATE_WS_CURSOR]}),PM=s(()=>{CM={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"caps-lock",27:"esc",32:"space",33:"pg-up",34:"pg-down",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:"semicolon",61:"equals",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",93:"context",96:"num-0",97:"num-1",98:"num-2",99:"num-3",100:"num-4",101:"num-5",102:"num-6",103:"num-7",104:"num-8",105:"num-9",106:"num-multiply",107:"num-plus",109:"num-minus",110:"num-period",111:"num-division",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",186:"semicolon",187:"equals",189:"dash",188:",",190:".",191:"/",192:"`",219:"open-square-bracket",220:"\\",221:"close-square-bracket",222:"single-quote",224:"win"}}
3);function FM(e,t){e.indexOf(")")===e.length-1&&(e=e.split(" (")[0]);let i=document.createElement("div");i.className="blocklyShortcutContainer";let n=document.createElement("span");n.textContent=e;let o=document.createElement("span");return o.className="blocklyShortcut",o.textContent=` ${BM(t)}`,i.appendChild(n),i.appendChild(o),i}function BM(e){return UM(e,LM)[0].join(kM?" ":" + ")}function UM(e,t){let i=hA.registry.getKeyCodesByShortcutName(e);if(0===i.length)return[];let n=i.map(e=>e.split("+"));n.forEach(e=>e.sort((e,t)=>VM(e)-VM(t))),n.sort((e,t)=>{let i=+!!e.includes("Meta");return+!!t.includes("Meta")-i});let o=n.filter(e=>e.includes("Meta")===kM);return o=0===o.length?n:o,o.sort((e,t)=>e.length-t.length),(o.some(e=>e.some(e=>"Meta"===e||"Alt"===e||"Control"===e))?[o[0]]:o).map(e=>e.map(e=>CM[e]??e).map(e=>HM(t[e]??e)))}function HM(e){return e.charAt(0).toUpperCase()+e.substring(1)}function VM(e){let t=NM.indexOf(e);return-1===t?Number.MAX_VALUE:t}var GM,WM,XM,zM,jM,YM=s(()=>{KL(),PM(),kM=navigator.platform.startsWith("Mac"),AM={Control:Qk.CONTROL_KEY,Meta:Qk.COMMAND_KEY,Alt:kM?Qk.OPTION_KEY:Qk.ALT_KEY},LM={Control:Qk.CONTROL_KEY,Meta:"â",Alt:kM?"â¥":Qk.ALT_KEY},NM=["Meta","Control","Alt","Shift"]});function QM(e,t=!1){let i=BM(SM.EDIT_OR_CONFIRM),n=`Hold ${navigator.platform.startsWith("Mac")?"â¥":"Ctrl"} and use arrow keys to move freely, then ${i} to accept the position`;EA.show(e,{message:n,id:GM,oncePerSession:!t})}var KM,qM,JM,ZM=s(()=>{KL(),DM(),YM(),GM="unconstrainedMoveHint",WM="constrainedMoveHint",XM="copiedHint",zM="cutHint",jM="helpHint"}),ex=s(()=>{KL(),DM(),YM(),ZM(),KM=class{navigation;options;oldCutShortcut;oldCopyShortcut;oldPasteShortcut;constructor(e,t={allowCrossWorkspacePaste:!1}){this.navigation=e,this.options=t}install(){this.registerCopyShortcut(),this.registerCopyContextMenuAction(),this.registerPasteShortcut(),this.registerPasteContextMenuAction(),this.registerCutShortcut(),this.registerCutContextMenuAction()}uninstall(){rk.registry.unregister("blockCutFromContextMenu"),rk.registry.unregister("blockCopyFromContextMenu"),rk.registry.unregister("blockPasteFromContextMenu"),hA.registry.unregister(SM.CUT),hA.registry.unregister(SM.COPY),hA.registry.unregister(SM.PASTE),this.oldCutShortcut&&hA.registry.register(this.oldCutShortcut),this.oldCopyShortcut&&hA.registry.register(this.oldCopyShortcut),this.oldPasteShortcut&&hA.registry.register(this.oldPasteShortcut)}registerCutShortcut(){if(this.oldCutShortcut=hA.registry.getRegistry()[uA.names.CUT],!this.oldCutShortcut)throw Error("No cut keyboard shortcut registered initially");let e={name:SM.CUT,preconditionFn:this.oldCutShortcut.preconditionFn,callback:this.cutCallback.bind(this),keyCodes:this.oldCutShortcut.keyCodes,allowCollision:!1};hA.registry.unregister(uA.names.CUT),hA.registry.register(e)}registerCutContextMenuAction(){let e={displayText:e=>FM(Qk.CUT_SHORTCUT,SM.CUT),preconditionFn:e=>this.cutPrecondition(e),callback:(e,t)=>{if(!pL(e.focusedNode))return!1;let i=e.focusedNode.workspace;return i instanceof HA&&this.cutCallback(i,t,void 0,e)},id:"blockCutFromContextMenu",weight:12};rk.registry.register(e)}cutPrecondition(e){let t=e.focusedNode;if(!t||!pL(t))return"hidden";let i=t.workspace;return i instanceof HA?this.oldCutShortcut?.preconditionFn&&this.oldCutShortcut.preconditionFn(i,e)?"enabled":"disabled":"hidden"}cutCallback(e,t,i={name:SM.CUT},n){let o=!!this.oldCutShortcut?.callback&&this.oldCutShortcut.callback(e,t,i,n);return o&&function(e){EA.show(e,{message:`Cut. Press ${BM(SM.PASTE)} to paste.`,duration:7,id:zM})}(e),o}registerCopyShortcut(){if(this.oldCopyShortcut=hA.registry.getRegistry()[uA.names.COPY],!this.oldCopyShortcut)throw Error("No copy keyboard shortcut registered initially");let e={name:SM.COPY,preconditionFn:this.oldCopyShortcut.preconditionFn,callback:this.copyCallback.bind(this),keyCodes:this.oldCopyShortcut.keyCodes,allowCollision:!1};hA.registry.unregister(uA.names.COPY),hA.registry.register(e)}registerCopyContextMenuAction(){rk.registry.register({displayText:e=>FM(Qk.COPY_SHORTCUT,SM.COPY),preconditionFn:e=>this.copyPrecondition(e),callback:(e,t)=>{if(!pL(e.focusedNode))return!1;let i=e.focusedNode.workspace;return i instanceof HA&&this.copyCallback(i,t,void 0,e)},id:"blockCopyFromContextMenu",weight:13})}copyPrecondition(e){let t=e.focusedNode;if(!t||!pL(t))return"hidden";let i=t.workspace;return i instanceof HA?this.oldCopyShortcut?.preconditionFn&&this.oldCopyShortcut.preconditionFn(i,e)?"enabled":"disabled":"hidden"}copyCallback(e,t,i={name:SM.CUT},n){let o=!!this.oldCopyShortcut?.callback&&this.oldCopyShortcut.callback(e,t,i,n);return o&&function(e){EA.show(e,{message:`Copied. Press ${BM(SM.PASTE)} to paste.`,duration:7,id:XM})}(e),o}registerPasteShortcut(){if(this.oldPasteShortcut=hA.registry.getRegistry()[uA.names.PASTE],!this.oldPasteShortcut)throw Error("No paste keyboard shortcut registered initially");let e={name:SM.PASTE,preconditionFn:this.oldPasteShortcut.preconditionFn,callback:this.pasteCallback.bind(this),keyCodes:this.oldPasteShortcut.keyCodes,allowCollision:!1};hA.registry.unregister(uA.names.PASTE),hA.registry.register(e)}registerPasteContextMenuAction(){rk.registry.register({displayText:e=>FM(Qk.PASTE_SHORTCUT,SM.PASTE),preconditionFn:e=>this.pastePrecondition(e),callback:(e,t)=>
3{let i=this.getPasteWorkspace(e);return!!i&&this.pasteCallback(i,t,void 0,e)},id:"blockPasteFromContextMenu",weight:14})}getPasteWorkspace(e){let t;if(e.focusedNode instanceof HA?t=e.focusedNode:bL(e.focusedNode)&&(t=e.focusedNode.workspace),t&&t instanceof HA)return t}pastePrecondition(e){let t=this.getPasteWorkspace(e);if(!t||t.isFlyout)return"hidden";if(!this.options.allowCrossWorkspacePaste){let e=QA.getLastCopiedWorkspace();if(e?.isFlyout&&(e=e.targetWorkspace),e!==t)return"disabled"}return this.oldPasteShortcut?.preconditionFn&&this.oldPasteShortcut.preconditionFn(t,e)?"enabled":"disabled"}pasteCallback(e,t,i={name:SM.CUT},n){let o=!!this.oldPasteShortcut?.callback&&this.oldPasteShortcut.callback(e,t,i,n);return function(e){EA.hide(e,zM),EA.hide(e,XM)}(e),o}}}),tx=s(()=>{KL(),YM(),qM=class{oldDisplayText=void 0;oldContextMenuItem=null;constructor(){}install(){this.registerContextMenuAction()}uninstall(){this.oldContextMenuItem&&this.oldDisplayText&&(this.oldContextMenuItem.displayText=this.oldDisplayText)}registerContextMenuAction(){if(this.oldContextMenuItem=rk.registry.getItem("blockDelete"),!this.oldContextMenuItem)return;this.oldDisplayText=this.oldContextMenuItem.displayText;this.oldContextMenuItem.displayText=e=>{let t;if("function"==typeof this.oldDisplayText){let i=this.oldDisplayText(e);t=i instanceof HTMLElement?i.innerText:i}else t="string"==typeof this.oldDisplayText?this.oldDisplayText:Qk.DELETE_BLOCK;return FM(t,uA.names.DELETE)}}}}),ix=s(()=>{KL(),YM(),DM(),JM=class{navigation;constructor(e){this.navigation=e}install(){this.registerContextMenuAction()}uninstall(){rk.registry.unregister("edit")}registerContextMenuAction(){let e={displayText:FM(Qk.EDIT_BLOCK_CONTENTS,SM.RIGHT),preconditionFn:(e,t)=>{if(t instanceof PointerEvent)return"hidden";let i=e.block?.workspace;if(!i||!this.navigation.canCurrentlyNavigate(i))return"disabled";let n=i.getCursor();return n?n.atEndOfLine()?"hidden":"enabled":"disabled"},callback:e=>{IL.setIsActive(!0);let t=e.block?.workspace;return!!t&&(t.getCursor()?.in(),!0)},scopeType:rk.ScopeType.BLOCK,id:"edit",weight:10};rk.registry.register(e)}}});var nx,ox,rx,sx=s(()=>{xM()});var ax,lx,cx,ux,hx,dx,px,fx,gx,mx,Tx=s(()=>{xM(),sx(),nx=class extends kw{flyout;constructor(e){super(e.getWorkspace()),this.flyout=e}next(){let e=this.getCurNode();if(!e)return null;let t=this.workspace.getNavigator().getNextSibling(e);return t&&this.setCurNode(t),t}prev(){let e=this.getCurNode();if(!e)return null;let t=this.workspace.getNavigator().getPreviousSibling(e);return t&&this.setCurNode(t),t}setCurNode(e){let t;if(super.setCurNode(e),e&&"getBoundingRectangle"in e&&"function"==typeof e.getBoundingRectangle)t=e.getBoundingRectangle();else if(e instanceof cw){let{x:i,y:n}=e.getPosition();t=new OM.Rect(n,n+e.height,i,i+e.width)}t instanceof OM.Rect&&function(e,t){if(bw.inProgress())return;let i=t.getScale(),n=t.getMetricsManager().getViewMetrics(!0),o=new OM.Rect(n.top,n.top+n.height,n.left,n.left+n.width);if(e.left>=o.left&&e.top>=o.top&&e.right<=o.right&&e.bottom<=o.bottom)return;(e=e.clone()).top-=10,e.bottom+=10,e.left-=10,e.right+=10;let r=0,s=0;e.left<o.left?r=o.left-e.left:e.right>o.right&&(r=o.right-e.right),e.top<o.top?s=o.top-e.top:e.bottom>o.bottom&&(s=o.bottom-e.bottom),r*=i,s*=i,t.scroll(t.scrollX+r,t.scrollY+s)}(t,this.flyout.getWorkspace())}},ox=pM.Type.CURSOR,rx="FlyoutCursor",ox.toString()}),_x=s(()=>{xM(),DM(),Tx(),ax=class{wsChangeWrapper;flyoutChangeWrapper;workspaces=[];constructor(){this.wsChangeWrapper=this.workspaceChangeListener.bind(this),this.flyoutChangeWrapper=this.flyoutChangeListener.bind(this)}addWorkspace(e){this.workspaces.push(e);let t=e.getFlyout();e.addChangeListener(this.wsChangeWrapper),t&&this.addFlyout(t)}removeWorkspace(e){let t=this.workspaces.indexOf(e),i=e.getFlyout();this.disableKeyboardAccessibility(e),t>-1&&this.workspaces.splice(t,1),e.removeChangeListener(this.wsChangeWrapper),i&&this.removeFlyout(i)}getState(){let e=W$();if(e.ephemeralFocusTaken())return IM.NOWHERE;let t=e.getFocusedTree();return t instanceof R$?t.isFlyout?IM.FLYOUT:IM.WORKSPACE:t instanceof r$?IM.TOOLBOX:t instanceof lw?IM.FLYOUT:IM.NOWHERE}addFlyout(e){let t=e.getWorkspace();t.addChangeListener(this.flyoutChangeWrapper);let i=pM.getClass(ox,rx);i&&t.getMarkerManager().setCursor(new i(e))}removeFlyout(e){e.getWorkspace().removeChangeListener(this.flyoutChangeWrapper)}workspaceChangeListener(e){if(!e.workspaceId)return;let t=v$.getById(e.workspaceId);!t||!t.keyboardAccessibilityMode||e.type===KN.BLOCK_CHANGE&&"mutation"===e.element&&this.handleBlockMutation(t,e)}flyoutChangeListener(e){if(!e.workspaceId)return;let t=v$.getById(e.workspaceId),i=t?.targetWorkspace;if(!i)return;let n=i.getFlyout();if(n)if(i&&i.keyboardAccessibilityMode&&!n.autoClose){if(e.type===KN.CLICK&&"block"===e.targetType){let{blockId:n}=e;if(n){let e=t.getBlockById(n);e&&this.handleBlockClickInFlyout(i,e)}}else if(e.type===KN.SELECTED){let{newElementId:n}=e;if(n){let e=t.getBlockById(n);e&&this.handleBlockClickInFlyout(i,e)}}}
3else e.type===KN.BLOCK_CREATE&&this.getState()===IM.FLYOUT&&this.defaultFlyoutCursorIfNeeded(i)}isFlyoutItemDisposed(e,t){return!!t?.disposed||e instanceof cw&&null===e.getSvgRoot().parentNode}handleBlockMutation(e,t){let i=t.blockId,n=e.getCursor(),o=n.getSourceBlock();o&&o.id===i&&n.setCurNode(o)}handleBlockClickInFlyout(e,t){if(!t)return;let i=t.isShadow()?t:t.getParent();i&&this.getFlyoutCursor(e)?.setCurNode(i);let n=e.getFlyout();n&&W$().focusTree(n.getWorkspace())}defaultFlyoutCursorIfNeeded(e,t="first"){let i=e.getFlyout();if(!i)return!1;let n=this.getFlyoutCursor(e);if(!n)return!1;let o=n.getCurNode(),r=n.getSourceBlock();if(o&&o!==i.getWorkspace()&&o.getFocusableTree()===i.getWorkspace()&&!this.isFlyoutItemDisposed(o,r))return!1;let s=i.getContents(),a="first"===t?s[0]:s[s.length-1];if(!a)return!1;let l=a.getElement();return n.setCurNode(l),!0}defaultWorkspaceCursorPositionIfNeeded(e,t="first"){let i=e.getTopBlocks(!0),n=e.getCursor(),o=n.getSourceBlock()?.disposed;return!(n.getCurNode()&&!o)&&(i.length>0?n.setCurNode(i["first"===t?0:i.length-1]):n.setCurNode(e),!0)}getFlyoutCursor(e){let t=e.getFlyout();return t?t.getWorkspace().getCursor():null}findInsertStartPoint(e,t){let i=!!t.outputConnection;if(e instanceof JN){let i=e.getSourceBlock();return i?this.findInsertStartPoint(i,t):null}if(e instanceof Xw){if(!i&&e.type===HN.INPUT_VALUE){let i=e.getSourceBlock();return i?this.findInsertStartPoint(i,t):null}return e}if(e instanceof R$)return null;if(e instanceof kN){let n=i?q$.inputTypes.VALUE:q$.inputTypes.STATEMENT,o=e.inputList.filter(e=>e.type===n).map(e=>e.connection);for(let e of o){let o=e;if(n===q$.inputTypes.STATEMENT)for(;o?.targetBlock()?.nextConnection;)o=o?.targetBlock()?.nextConnection;if(o&&t.workspace.connectionChecker.canConnect(i?t.outputConnection:t.previousConnection,o,!0,1/0))return o}if(e.nextConnection&&!i){let i=e.nextConnection;for(;i;){if(t.workspace.connectionChecker.canConnect(t.previousConnection,i,!0,1/0))return i;i=i.getSourceBlock().getNextBlock()?.nextConnection??null}}if(e.outputConnection){let n=e.outputConnection.targetConnection;if(i&&n)return this.findInsertStartPoint(n,t);if(!i){let i=e.getParent();return i?this.findInsertStartPoint(i,t):null}return e.outputConnection}}return this.warn(`Unexpected case in findInsertStartPoint ${e}.`),null}tryToConnectBlock(e,t){let i=this.findInsertStartPoint(e,t);return!!i&&this.insertBlock(t,i)}disconnectChild(e,t){let i,n=e.getSourceBlock(),o=t.getSourceBlock();n.getRootBlock()===o.getRootBlock()&&(n.getDescendants(!1).includes(o)?(i=this.getInferiorConnection(t),i&&i.disconnect()):(i=this.getInferiorConnection(e),i&&i.disconnect()))}connect(e,t){if(!e||!t)return!1;let i=this.getInferiorConnection(e),n=this.getSuperiorConnection(t),o=this.getSuperiorConnection(e),r=this.getInferiorConnection(t);if(i&&n&&this.moveAndConnect(i,n)||o&&r&&this.moveAndConnect(o,r)||this.moveAndConnect(e,t))return!0;{let i=e.getConnectionChecker(),n=i.canConnectWithReason(e,t,!1);return this.warn("Connection failed with error: "+i.getErrorMessage(n,e,t)),!1}}getInferiorConnection(e){if(!e)return null;let t=e.getSourceBlock();return e.isSuperior()?t.previousConnection?t.previousConnection:t.outputConnection?t.outputConnection:null:e}getSuperiorConnection(e){return e?e.isSuperior()?e:e.targetConnection?e.targetConnection:null:null}moveAndConnect(e,t){if(!e||!t)return!1;let i=e.getSourceBlock();if(e.getConnectionChecker().canConnect(e,t,!1)&&!t.getSourceBlock().isShadow()){if
3(this.disconnectChild(e,t),!t.isSuperior()){let n=i.getRootBlock(),o={x:t.x-e.x,y:t.y-e.y},r=e.getOffsetInBlock().clone();n.positionNearConnection(e,o,r)}return t.connect(e),!0}return!1}insertBlock(e,t){switch(t.type){case Hw:if(this.connect(e.nextConnection,t))return!0;break;case xw:if(this.connect(e.previousConnection,t))return!0;break;case Iw:if(this.connect(e.outputConnection,t))return!0;break;case Bw:for(let i=0;i<e.inputList.length;i++){let n=e.inputList[i].connection;if(n&&n.type===Iw&&this.connect(n,t))return!0}if(e.outputConnection&&this.connect(e.outputConnection,t))return!0}return this.warn("This block can not be inserted at the marked location."),!1}enableKeyboardAccessibility(e){this.workspaces.includes(e)&&!e.keyboardAccessibilityMode&&(e.keyboardAccessibilityMode=!0)}disableKeyboardAccessibility(e){this.workspaces.includes(e)&&e.keyboardAccessibilityMode&&(e.keyboardAccessibilityMode=!1)}log(e){}warn(e){console.warn(e)}error(e){console.error(e)}openToolboxOrFlyout(e){let t=e.getToolbox(),i=e.getFlyout();t?W$().focusTree(t):i&&W$().focusTree(i.getWorkspace())}paste(e,t){let i=t.getCursor().getCurNode();KN.setGroup(!0);let n=M$.paste(e,t);return n?(i&&this.tryToConnectBlock(i,n),!0):(KN.setGroup(!1),!1)}canCurrentlyNavigate(e){return!!(e.getRootWorkspace()??e.targetWorkspace?.getRootWorkspace()??e.targetWorkspace??e).keyboardAccessibilityMode&&this.getState()!==IM.NOWHERE}canCurrentlyEdit(e){return this.canCurrentlyNavigate(e)&&!e.isReadOnly()}dispose(){for(let e of this.workspaces)this.removeWorkspace(e)}}}),Ex=s(()=>{xM(),DM(),YM(),ZM(),lx=class{outputDiv;modalContainer;shortcutDialog;open;closeButton;constructor(){this.outputDiv=document.getElementById("shortcuts"),this.open=!1,this.modalContainer=null,this.shortcutDialog=null,this.closeButton=null}getPlatform(){let{platform:e,userAgent:t}=navigator;return e.startsWith("Win")?Mw.WINDOWS:e.startsWith("Mac")?Mw.MAC_OS:/\bCrOS\b/.test(t)?Mw.CHROME_OS:e.includes("Linux")?Mw.LINUX:Mw.UNKNOWN}toggle(e){(function(e){EA.hide(e,jM)})(e),this.toggleInternal()}toggleInternal(){this.modalContainer&&this.shortcutDialog&&(this.shortcutDialog.hasAttribute("open")?this.shortcutDialog.close():this.shortcutDialog.showModal())}getReadableShortcutName(e){return yM[e]?yM[e]:HM(e.replace(/_/gi," "))}createModalContent(){let e="";for(let[i,n]of Object.entries(RM)){let t="";for(let e of n)t+=this.getTableRowForShortcut(e);e+=`\n <table class="shortcut-table">\n <tbody>\n <tr class="category"><th colspan="3"><h2>${i}</h2></th></tr>\n ${t}\n </tbody>\n </table>`}let t=`<div class="modal-container">\n <dialog class="shortcut-modal">\n <div class="shortcut-container" tabindex="0">\n <div class="header">\n <button class="close-modal">\n <span class="material-symbols-outlined">close</span>\n </button>\n <h1>${Mw.SHORTCUTS_HELP_HEADER||"Keyboard shortcuts"} â <span class="platform">${this.getPlatform()}</span></h1>\n </div>\n <div class="shortcut-tables">\n ${e}\n </div>\n </dialog>\n </div>`;this.outputDiv&&(this.outputDiv.innerHTML=t,this.modalContainer=this.outputDiv.querySelector(".modal-container"),this.shortcutDialog=this.outputDiv.querySelector(".shortcut-modal"),this.closeButton=this.outputDiv.querySelector(".close-modal"),this.closeButton&&this.closeButton.addEventListener("click",e=>{this.toggleInternal()}))}getTableRowForShortcut(e){let t=this.getReadableShortcutName(e),i=this.actionShortcutsToHTML(e);return t&&i?`\n <tr>\n <td>${t}</td>\n <td>${i}</td>\n </tr>`:""}actionShortcutsToHTML(e){return function(e){return UM(e,AM)}(e).map(e=>this.keysToHTML(e)).join(" / ")}keysToHTML(e){let t=navigator.platform.startsWith("Mac")?"":" + ";return e&&e.length?['<span class="shortcut-combo">',...e.map((i,n)=>`<span class="key">${i}</span>${n<e.length-1?t:""}`),"</span>"].join(""):""}install(){let e={name:SM.LIST_SHORTCUTS,callback:e=>(this.toggle(e),!0),keyCodes:[OM.KeyCodes.SLASH]};Kw.registry.register(e)}uninstall(){Kw.registry.unregister(SM.LIST_SHORTCUTS)}}}),bx=s(()=>
3{KL(),DM(),cx=DL.KeyCodes,ux=hA.registry.createSerializedKey.bind(hA.registry),hx=class{navigation;constructor(e){this.navigation=e}shortcuts=[{name:SM.MOVE_WS_CURSOR_LEFT,preconditionFn:e=>this.navigation.canCurrentlyEdit(e),callback:e=>this.moveWSCursor(e,-1,0),keyCodes:[ux(cx.A,[cx.SHIFT])]},{name:SM.MOVE_WS_CURSOR_RIGHT,preconditionFn:e=>this.navigation.canCurrentlyEdit(e),callback:e=>this.moveWSCursor(e,1,0),keyCodes:[ux(cx.D,[cx.SHIFT])]},{name:SM.MOVE_WS_CURSOR_UP,preconditionFn:e=>this.navigation.canCurrentlyEdit(e),callback:e=>this.moveWSCursor(e,0,-1),keyCodes:[ux(cx.W,[cx.SHIFT])]},{name:SM.MOVE_WS_CURSOR_DOWN,preconditionFn:e=>this.navigation.canCurrentlyEdit(e),callback:e=>this.moveWSCursor(e,0,1),keyCodes:[ux(cx.S,[cx.SHIFT])]},{name:SM.CREATE_WS_CURSOR,preconditionFn:e=>!0,callback:e=>{let t=e.isFlyout?e.targetWorkspace:e;return!!t&&(IL.setIsActive(!0),this.createWSCursor(t))},keyCodes:[cx.W]}];install(){for(let e of this.shortcuts)hA.registry.register(e)}uninstall(){for(let e of this.shortcuts)hA.registry.unregister(e.name)}moveWSCursor(e,t,i){return!1}createWSCursor(e){return e.getCursor().setCurNode(e),!0}}}),Ox=s(()=>{xM(),DM(),dx=OM.KeyCodes,px=class{navigation;constructor(e){this.navigation=e}fieldShortcutHandler(e,t){let i=e.getCursor().getCurNode();return i instanceof JN&&i.onShortcut(t)}install(){let e=(e,t,i)=>{let n=e.getToolbox(),o=e.isFlyout?e.targetWorkspace?.getFlyout():e.getFlyout(),r=!1;switch(this.navigation.getState()){case IM.WORKSPACE:return r=this.fieldShortcutHandler(e,i),!r&&e&&(this.navigation.defaultWorkspaceCursorPositionIfNeeded(e)||e.getCursor().in(),r=!0),r;case IM.TOOLBOX:return r=n&&n.selectChild(),!r&&o&&this.navigation.defaultFlyoutCursorIfNeeded(e),!0;default:return!1}},t=(e,t,i)=>{let n=e.isFlyout?e.targetWorkspace?.getToolbox():e.getToolbox(),o=!1;switch(this.navigation.getState()){case IM.WORKSPACE:return o=this.fieldShortcutHandler(e,i),!o&&e&&(this.navigation.defaultWorkspaceCursorPositionIfNeeded(e)||e.getCursor().out(),o=!0),o;case IM.FLYOUT:return n&&W$().focusTree(n),!0;case IM.TOOLBOX:return n&&n.selectParent();default:return!1}},i={right:{name:SM.RIGHT,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e),callback:(i,n,o)=>(lM.setIsActive(!0),i.RTL?t(i,0,o):e(i,0,o)),keyCodes:[dx.RIGHT]},left:{name:SM.LEFT,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e),callback:(i,n,o)=>(lM.setIsActive(!0),i.RTL?e(i,0,o):t(i,0,o)),keyCodes:[dx.LEFT]},down:{name:SM.DOWN,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e),callback:(e,t,i)=>{lM.setIsActive(!0);let n=!1;switch(this.navigation.getState()){case IM.WORKSPACE:return n=this.fieldShortcutHandler(e,i),!n&&e&&(this.navigation.defaultWorkspaceCursorPositionIfNeeded(e)||e.getCursor().next(),n=!0),n;case IM.FLYOUT:return n=this.fieldShortcutHandler(e,i),!n&&e.targetWorkspace&&(this.navigation.defaultFlyoutCursorIfNeeded(e.targetWorkspace)||e.getCursor().next(),n=!0),n;case IM.TOOLBOX:{let t=e.getToolbox();if(t){if(t.getSelectedItem())n=t.selectNext();else{let e=t.getToolboxItems().find(e=>e.isSelectable())??null;t.setSelectedItem(e),n=!0}let e=t.getSelectedItem();e&&W$().focusNode(e)}return n}default:return!1}},keyCodes:[dx.DOWN]},up:{name:SM.UP,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e),callback:(e,t,i)=>{lM.setIsActive(!0);let n=!1;switch(this.navigation.getState()){case IM.WORKSPACE:return n=this.fieldShortcutHandler(e,i),n||=(this.navigation.defaultWorkspaceCursorPositionIfNeeded(e,"last")||e.getCursor().prev(),!0),n;case IM.FLYOUT:return n=this.fieldShortcutHandler(e,i),!n&&e.targetWorkspace&&(this.navigation.defaultFlyoutCursorIfNeeded(e.targetWorkspace,"last")||e.getCursor().prev(),n=!0),n;case IM.TOOLBOX:{let t=e.getToolbox();if(t){n=t.selectPrevious();let e=t.getSelectedItem();e&&W$().focusNode(e)}return n}default:return!1}},keyCodes:[dx.UP]}};for(let n of Object.values(i))Kw.registry.register(n)}uninstall(){Kw.registry.unregister(SM.LEFT),Kw.registry.unregister(SM.RIGHT),Kw.registry.unregister(SM.DOWN),Kw.registry.unregister(SM.UP)}}}),vx=s(()=>{xM(),DM(),fx=OM.KeyCodes,gx=class{navigation;constructor(e){this.navigation=e}install(){Kw.registry.register({name:SM.EXIT,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e),callback:e=>{switch(this.navigation.getState()){case IM.FLYOUT:case IM.TOOLBOX:return W$().focusTree(e.targetWorkspace??e),bw.inProgress()||e.hideChaff(),!0;case IM.WORKSPACE:if(e.isMutator){let t=e.options.parentWorkspace?.getAllBlocks().map(e=>e.getIcons()).flat().find(t=>t instanceof Q$.MutatorIcon&&t.bubbleIsVisible()&&t.getBubble()?.getWorkspace()===e);if(t)return t.setBubbleVisible(!1),W$().focusNode(t),!0}return!1;default:return!1}},keyCodes:[fx.ESC],allowCollision:!0})}uninstall(){Kw.registry.unregister(SM.EXIT)}}});function Ix(e){if(!e)return{x:0,y:0};switch(e){case mx.Up:return{x:0,y:-1};case mx.Down:return{x:0,y:1};case mx.Left:return{x:-1,y:0};case mx.Right:return{x:1,y:0}}}var Sx,yx,Rx,Cx,kx,Ax,Lx,Nx,wx,$x,Mx,xx,Dx,Px,Fx,Bx,Ux,Hx,Vx=s(()=>{mx=function(e){return e[e.Up=1]="Up",e[e.Down=2]="Down",e[e.Left=3]="Left",e[e.Right=4]="Right",e}({})}),Gx=s(()=>{xM(),Sx=class{sourceElement;svgRoot;location=new OM.Coordinate(0,0);constructor(e){this.sourceElement=e;let t=e.workspace;this.svgRoot=OM.dom.createSvgElement(OM.Svg.G,{},t.getBubbleCanvas()),this.svgRoot.classList.add("blocklyMoveIndicatorBubble");let i=t.RTL;
3OM.dom.createSvgElement(OM.Svg.CIRCLE,{fill:"white","fill-opacity":"0.8",stroke:"grey","stroke-width":"1",r:20,cx:20*(i?-1:1),cy:20},this.svgRoot),OM.dom.createSvgElement(OM.Svg.PATH,{fill:"none",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6",transform:`translate(${8*(i?-4:1)} 8)`},this.svgRoot),this.updateLocation()}isMovable(){return!1}getSvgRoot(){return this.svgRoot}updateLocation(){let e=this.sourceElement instanceof kN?this.sourceElement.getBoundingRectangleWithoutChildren():this.sourceElement.getBoundingRectangle(),t=this.sourceElement.workspace.RTL?e.left+20:e.right-20,i=e.top-20;this.moveTo(t,i),this.sourceElement.workspace.getLayerManager()?.moveToDragLayer(this)}moveTo(e,t){this.location.x=e,this.location.y=t,this.svgRoot.setAttribute("transform",`translate(${e}, ${t})`)}getRelativeToSurfaceXY(){return this.location}dispose(){OM.dom.removeNode(this.svgRoot)}showContextMenu(){}setDragging(e){}startDrag(e){}drag(e,t){}moveDuringDrag(e){}endDrag(){}revertDrag(){}setDeleteStyle(e){}getFocusableElement(){throw Error("This node is not focusable.")}getFocusableTree(){throw Error("This node is not focusable.")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}}}),Wx=s(()=>{xM(),Gx(),yx=class e{sourceBlock;moveIndicator;static type=new Q$.IconType("moveIndicator");constructor(e){this.sourceBlock=e,this.moveIndicator=new Sx(this.sourceBlock)}getType(){return e.type}getWeight(){return-1}getSize(){return new OM.Size(-8,0)}isShownWhenCollapsed(){return!1}isClickableInFlyout(){return!1}bubbleIsVisible(){return!0}getBubble(){return this.moveIndicator}onLocationChange(e){this.moveIndicator?.updateLocation()}dispose(){this.moveIndicator?.dispose()}applyColour(){}hideForInsertionMarker(){}updateEditable(){}updateCollapsed(){}setOffsetInBlock(){}onClick(){}async setBubbleVisible(e){}initView(e){}getFocusableElement(){throw Error("This node is not focusable.")}getFocusableTree(){throw Error("This node is not focusable.")}onNodeFocus(){}onNodeBlur(){}canBeFocused(){return!1}}}),Xx=s(()=>{KL(),Vx(),ZM(),Wx(),Rx=class extends iL.BlockDragStrategy{block;moveType;startPoint;currentDragDirection=null;searchNode=null;allConnections=[];constructor(e,t,i){super(e),this.block=e,this.moveType=t,this.startPoint=i}startDrag(e){super.startDrag(e);for(let t of this.block.workspace.getTopBlocks(!0))this.allConnections.push(...t.getDescendants(!0).filter(e=>!e.isShadow()).flatMap(e=>e.getConnections_(!1)).sort((e,t)=>{let i=e.y-t.y;return 0===i&&(i=e.x-t.x),i}));this.block.moveDuringDrag(this.startLoc),this.connectionCandidate=this.createInitialCandidate(),this.forceShowPreview(),this.block.addIcon(new yx(this.block))}drag(e,t){if(t)if(this.currentDragDirection=function(e){let{x:t,y:i}=e;if(0==t){if(-1==i)return mx.Up;if(1==i)return mx.Down}else if(0==i){if(-1==t)return mx.Left;if(1==t)return mx.Right}return null}({x:t.tiltX,y:t.tiltY}),super.drag(e),this.connectionCandidate){let e=this.connectionCandidate.neighbour;this.searchNode=e,this.isConstrainedMovement()&&this.block.moveDuringDrag(new DL.Coordinate(e.x+10,e.y+10))}else if(this.searchNode=null,this.isConstrainedMovement()){QM(this.workspace,!0)}}endDrag(e){super.endDrag(e),this.allConnections=[],this.block.removeIcon(yx.type)}getConstrainedConnectionCandidate(e){let t=this.getLocalConnections(e);if(0==t.length)return null;let i=this.findTraversalCandidate(e,t);return!i&&!this.searchNode&&(i=this.findNearestCandidate(t)),i}findNearestCandidate(e){let t=1/0,i=null,n=new DL.Coordinate(0,0);for(let o of e){let{connection:e,radius:r}=o.closest(t,n);e&&(i={local:o,neighbour:e,distance:r},t=r)}return i}findTraversalCandidate(e,t){let i=e.workspace.connectionChecker,n=null,o=this.searchNode,r=this.currentDragDirection;for(;o&&!n;){let e=this.allConnections.indexOf(o);if(r===mx.Up||r===mx.Left?o=this.allConnections[e-1]??this.allConnections[this.allConnections.length-1]:(r===mx.Down||r===mx.Right)&&(o=this.allConnections[e+1]??this.allConnections[0]),t.forEach(e=>{o&&i.canConnect(e,o,!0,1/0)&&(n={local:e,neighbour:o,distance:0})}),o==this.searchNode)break}return n}currCandidateIsBetter(e,t,i){return!this.isConstrainedMovement()&&super.currCandidateIsBetter(e,t,i)}getConnectionCandidate(e,t){return this.isConstrainedMovement()?this.getConstrainedConnectionCandidate(e):super.getConnectionCandidate(e,t)}isConstrainedMovement(){return!!this.currentDragDirection}forceShowPreview(){let e=this.connectionPreviewer,t=this.connectionCandidate;if(!t||!e)return;let i=this.block,{local:n,neighbour:o}=t,r=n.type===ik.OUTPUT_VALUE||n.type===ik.PREVIOUS_STATEMENT,s=o.targetBlock(),a=s&&!s.isInsertionMarker(),l=s&&this.orphanCanConnectAtEnd(i,s,n.type);r&&a&&!l?e.previewReplacement(n,o,s):e.previewConnection(n,o),i.moveDuringDrag(new DL.Coordinate(o.x+10,o.y+10))}createInitialCandidate(){let e=this.startPoint??this.startParentConn;if(e)switch(this.searchNode=e,e.type){case ik.INPUT_VALUE:if(this.block.outputConnection)return{neighbour:e,local:this.block.outputConnection,distance:0};break;case ik.NEXT_STATEMENT:if(this.block.previousConnection)return{neighbour:e,local:this.block.previousConnection,distance:0}}return null}shouldHealStack(e){return!!this.block.previousConnection}}}),zx=s(()=>{KL(),DM(),Vx(),Xx(),ZM(),Gx(),Cx="commitMove",kx=function(e){return e[e.Insert=0]="Insert",e[e.Move=1]="Move",e}({}),Ax=class{navigation;moves=new Map;oldDragStrategy=null;moveIndicator;constructor(e){this.navigation=e}canMove(e,t){return!(this.navigation.getState()!==IM.WORKSPACE||!this.navigation.canCurrentlyEdit(e)||this.moves.has(e)||!t?.isMovable())}isMoving(e){return this.navigation.canCurrentlyEdit(e)&&this.moves.has(e)}startMove(e,t,i,n){t instanceof GC?this.patchDragStrategy(t,i,n):t instanceof KA.RenderedWorkspaceComment&&(this.moveIndicator=new Sx(t));let o=kL.getClassFromOptions(kL.Type.BLOCK_DRAGGER,e.options,!0);if(!o)throw Error("no Dragger registered");let r=new o(t,e),s=()=>{this.finishMove(e)};e.setKeyboardMoveInProgress(!0);let a=new Lx(e,t,r,s);this.moves.set(e,a),r.onDragStart(a.fakePointerEvent("pointerdown")),a.updateTotalDelta(),e.getCursor().setCurNode(t),t.getFocusableElement().addEventListener("blur",s);let l={name:Cx,preconditionFn:e=>!!this.moves.get(e),callback:e=>(this.finishMove(e),!1),keyCodes:Object.values(hA.registry.getRegistry()).flatMap(e=>e.keyCodes).filter(e=>e&&![DL.KeyCodes.RIGHT,DL.KeyCodes.LEFT,DL.KeyCodes.UP,DL.KeyCodes.DOWN,DL.KeyCodes.ENTE
3R,DL.KeyCodes.ESC,DL.KeyCodes.M].includes("number"==typeof e?e:parseInt(`${e.split("+").pop()}`))).filter(e=>!!e),allowCollision:!0};return hA.registry.register(l),!0}finishMove(e){let t=this.preDragEndCleanup(e);return t.dragger.onDragEnd(t.fakePointerEvent("pointerup"),new DL.Coordinate(0,0)),this.postDragEndCleanup(e,t),!0}abortMove(e){let t=this.preDragEndCleanup(e),i=t.draggable.dragStrategy;this.patchDragger(t.dragger,i.moveType);let n=i.connectionCandidate?.neighbour;return i.connectionCandidate=null,t.dragger.onDragEnd(t.fakePointerEvent("pointerup"),t.startLocation),i.moveType===kx.Insert&&n&&e.getCursor().setCurNode(n),this.postDragEndCleanup(e,t),!0}preDragEndCleanup(e){hA.registry.unregister(Cx),function(e){EA.hide(e,WM),EA.hide(e,GM)}(e);let t=this.moves.get(e);if(!t)throw Error("no move info for workspace");return t.draggable.getFocusableElement().removeEventListener("blur",t.blurListener),t}postDragEndCleanup(e,t){this.moveIndicator?.dispose(),this.moveIndicator=void 0,t.draggable instanceof GC&&this.unpatchDragStrategy(t.draggable),this.moves.delete(e),e.setKeyboardMoveInProgress(!1),setTimeout(()=>this.scrollCurrentElementIntoView(e),0),rL().focusNode(t.draggable)}moveConstrained(e,t){if(!e)return!1;let i=this.moves.get(e);if(!i)throw Error("no move info for workspace");return i.draggable instanceof KA.RenderedWorkspaceComment?this.moveUnconstrained(e,t):(i.dragger.onDrag(i.fakePointerEvent("pointermove",t),i.totalDelta.clone().scale(e.scale)),i.updateTotalDelta(),this.scrollCurrentElementIntoView(e,70),!0)}moveUnconstrained(e,t){if(!e)return!1;let i=this.moves.get(e);if(!i)throw Error("no move info for workspace");let{x:n,y:o}=Ix(t);return i.totalDelta.x+=20*n*e.scale,i.totalDelta.y+=20*o*e.scale,i.dragger.onDrag(i.fakePointerEvent("pointermove"),i.totalDelta.clone().scale(e.scale)),this.scrollCurrentElementIntoView(e),this.moveIndicator?.updateLocation(),!0}patchDragStrategy(e,t,i){this.oldDragStrategy=e.dragStrategy,e.setDragStrategy(new Rx(e,t,i))}unpatchDragStrategy(e){this.oldDragStrategy&&=(e.setDragStrategy(this.oldDragStrategy),null)}scrollCurrentElementIntoView(e,t=0){let i=this.moves.get(e)?.draggable;if(i){let n=(i instanceof GC?i.getBoundingRectangleWithoutChildren():i.getBoundingRectangle()).clone();n.top-=t,n.bottom+=t,n.left-=t,n.right+=t,e.scrollBoundsIntoView(n)}}patchDragger(e,t){t===kx.Insert?e.wouldDeleteDraggable=()=>!0:e.shouldReturnToStart=()=>!0}},Lx=class{workspace;draggable;dragger;blurListener;totalDelta=new DL.Coordinate(0,0);parentNext=null;parentInput=null;startLocation;constructor(e,t,i,n){this.workspace=e,this.draggable=t,this.dragger=i,this.blurListener=n,t instanceof GC&&(this.parentNext=t.previousConnection?.targetConnection??null,this.parentInput=t.outputConnection?.targetConnection??null),this.startLocation=t.getRelativeToSurfaceXY()}fakePointerEvent(e,t){let i=DL.svgMath.wsToScreenCoordinates(this.workspace,new DL.Coordinate(this.startLocation.x+this.totalDelta.x,this.startLocation.y+this.totalDelta.y)),n=Ix(t);return new PointerEvent(e,{clientX:i.x,clientY:i.y,tiltX:n.x,tiltY:n.y})}updateTotalDelta(){this.draggable instanceof GC?this.totalDelta=new DL.Coordinate(this.draggable.relativeCoords.x-this.startLocation.x,this.draggable.relativeCoords.y-this.startLocation.y):this.totalDelta=new DL.Coordinate(this.draggable.getBoundingRectangle().left-this.startLocation.x,this.draggable.getBoundingRectangle().top-this.startLocation.y)}}}),jx=s(()=>{xM(),DM(),zx(),ZM(),Nx=OM.KeyCodes,wx=class{mover;navigation;constructor(e,t){this.mover=e,this.navigation=t}install(){Kw.registry.register({name:SM.EDIT_OR_CONFIRM,preconditionFn:e=>{switch(this.navigation.getState()){case IM.WORKSPACE:return this.shouldHandleEnterForWS(e);case IM.FLYOUT:{let t=e.isFlyout?e.targetWorkspace:e;return!!t&&this.navigation.canCurrentlyEdit(t)}default:return!1}},callback:(e,t)=>{t.preventDefault();let i,n,o=e.isFlyout?e.targetWorkspace:e;if(!o)return!1;switch(this.navigation.getState()){case IM.WORKSPACE:return this.handleEnterForWS(e);case IM.FLYOUT:return i=this.navigation.getFlyoutCursor(o),!!i&&(n=i.getCurNode(),n instanceof kN?this.insertFromFlyout(o):n instanceof cw&&this.triggerButtonCallback(o),!0);default:return!1}},keyCodes:[Nx.ENTER,Nx.SPACE],allowCollision:!0})}shouldHandleEnterForWS(e){if(!this.navigation.canCurrentlyNavigate(e)||e.isDragging())return!1;let t=e.getCursor().getCurNode();return!!t&&(t instanceof JN?t.isClickable():t instanceof Xw||t instanceof R$?!e.isReadOnly():t instanceof kN||t instanceof Q$.Icon||t instanceof x$.CommentBarButton||t instanceof x$.RenderedWorkspaceComment)}handleEnterForWS(e){let t=e.getCursor(),i=t.getCurNode();return!!i&&(i instanceof JN?(i.showEditor(),!0):i instanceof kN?(this.tryShowFullBlockFieldEditor(i)||function(e){let t=BM("list_shortcuts"),i=Qk.HELP_PROMPT.replace("%1",t),n=jM;EA.show(e,{message:i,id:n})}(e),!0):i instanceof Xw||i instanceof R$?(this.navigation.openToolboxOrFly
3out(e),!0):i instanceof Q$.Icon?(i.onClick(),fM.finishQueuedRenders().then(()=>{j$(i)&&i.bubbleIsVisible()&&t.in()}),!0):i instanceof x$.CommentBarButton?(i.performAction(),!0):i instanceof x$.RenderedWorkspaceComment&&(i.setCollapsed(!1),W$().focusNode(i.getEditorFocusableNode()),!0))}insertFromFlyout(e){e.setResizesEnabled(!1),KN.getGroup()||KN.setGroup(!0);let t=_w.findFocusedNode(e)??e.getRestoredFocusableNode(null),i=this.createNewBlock(e);if(!i)return;let n=t?this.navigation.findInsertStartPoint(t,i):null;e.getTopBlocks().includes(i)&&this.positionNewTopLevelBlock(e,i),e.setResizesEnabled(!0),this.mover.startMove(e,i,kx.Insert,n),i.outputConnection||i.nextConnection||i.previousConnection?function(e){let t=`Use the arrow keys to move, then ${BM(SM.EDIT_OR_CONFIRM)} to accept the position`;EA.show(e,{message:t,id:WM,oncePerSession:!0})}(e):QM(e,!1)}positionNewTopLevelBlock(e,t){let i=e.getTopBlocks(!0).filter(e=>e.id!==t.id).map(e=>e.getBoundingRectangle()),n=e.getToolbox()?.getWidth(),o=e.getParentSvg().clientWidth-(n??0);e.getParentSvg().clientHeight;let{height:r,width:s}=t.getHeightWidth(),a=function(e){for(let t of i)if(e.intersects(t))return t;return null},l=10,c=10,u=e.getRenderer().getConstants().MIN_BLOCK_HEIGHT,h=t.getBoundingRectangle();t.moveBy(c-h.left,l-h.top,["cleanup"]),t.snapToGrid(),h=t.getBoundingRectangle();let d=a(h);for(;null!=d;){let e=d.left+d.getWidth()+80,i=d.top+d.getHeight()+u;e+s<=o?c=e:(l=i,c=10),t.moveBy(c-h.left,l-h.top,["cleanup"]),t.snapToGrid(),h=t.getBoundingRectangle(),d=a(h)}t.bringToFront()}triggerButtonCallback(e){let t=this.navigation.getFlyoutCursor(e)?.getCurNode();if(!(t instanceof cw))return;let i=e.flyoutButtonCallbacks,n=t.callbackKey,o=i.get(n);if(!o)throw Error("No callback function found for flyout button.");o(t)}tryShowFullBlockFieldEditor(e){if(e.isSimpleReporter())for(let t of e.inputList)for(let e of t.fieldRow)if(e.isClickable()&&e.isFullBlockField())return e.showEditor(),!0;return!1}createNewBlock(e){let t=e.getFlyout();if(!t||!t.isVisible())return console.warn("Trying to insert from the flyout when the flyout does not exist or is not visible"),null;let i=this.navigation.getFlyoutCursor(e)?.getCurNode();if(!(i instanceof kN&&i.isEnabled()))return console.warn("Can't insert a disabled block."),null;let n=t.createBlock(i);return n.render(),n.setConnectionTracking(!0),n}uninstall(){Kw.registry.unregister(SM.EDIT_OR_CONFIRM)}}}),Yx=s(()=>{KL(),DM(),$x=DL.KeyCodes,Mx=class{navigation;shortcutName=SM.DISCONNECT;constructor(e){this.navigation=e}install(){this.registerShortcut()}uninstall(){hA.registry.unregister(this.shortcutName)}registerShortcut(){let e={name:this.shortcutName,preconditionFn:e=>this.navigation.canCurrentlyEdit(e),callback:e=>(IL.setIsActive(!0),this.navigation.getState()===IM.WORKSPACE&&(this.disconnectBlocks(e),!0)),keyCodes:[$x.X]};hA.registry.register(e)}disconnectBlocks(e){let t=e.getCursor(),i=t.getCurNode();if(!(i instanceof GC))return;let n=!i.outputConnection?.isConnected();hk.setGroup(!0),i.unplug(n),hk.setGroup(!1),t.setCurNode(i)}}}),Qx=s(()=>{KL(),DM(),xx=DL.KeyCodes,Dx=hA.registry.createSerializedKey.bind(hA.registry),Px=class{navigation;shortcutName=SM.MENU;constructor(e){this.navigation=e}install(){this.registerShortcut()}uninstall(){hA.registry.unregister(this.shortcutName)}registerShortcut(){let e={name:SM.MENU,preconditionFn:e=>this.navigation.canCurrentlyNavigate(e)&&!e.isDragging(),callback:e=>{switch(this.navigation.getState()){case IM.WORKSPACE:case IM.FLYOUT:return this.openActionMenu(e);default:return!1}},keyCodes:[Dx(xx.ENTER,[xx.CTRL]),Dx(xx.ENTER,[xx.ALT]),Dx(xx.ENTER,[xx.META])],allowCollision:!0};hA.registry.register(e,!0)}openActionMenu(e){let t=new KeyboardEvent("keydown"),i=e.getCursor().getCurNode();return!!i&&("showContextMenu"in i&&"function"==typeof i.showContextMenu&&(i.showContextMenu(t),setTimeout(()=>{DA.getDiv()?.querySelector(".blocklyMenu")?.dispatchEvent(new KeyboardEvent("keydown",{key:"ArrowDown",code:"ArrowDown",keyCode:xx.DOWN,which:xx.DOWN,bubbles:!0,cancelable:!0}))},10),!0))}}}),Kx=s(()=>
3{KL(),Vx(),zx(),YM(),Fx=DL.KeyCodes,Bx=hA.registry.createSerializedKey.bind(hA.registry),Ux=class{mover;constructor(e){this.mover=e}shortcuts=[{name:"start_move",preconditionFn:e=>{let t=this.getCurrentDraggable(e);return!!t&&this.mover.canMove(e,t)},callback:e=>{IL.setIsActive(!0);let t=this.getCurrentDraggable(e);return t&&rL().focusNode(t),!!t&&this.mover.startMove(e,t,kx.Move,null)},keyCodes:[Fx.M]},{name:"finish_move",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.finishMove(e),keyCodes:[Fx.ENTER,Fx.SPACE],allowCollision:!0},{name:"abort_move",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.abortMove(e),keyCodes:[Fx.ESC],allowCollision:!0},{name:"move_left_constrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveConstrained(e,mx.Left),keyCodes:[Fx.LEFT],allowCollision:!0},{name:"move_right_constrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveConstrained(e,mx.Right),keyCodes:[Fx.RIGHT],allowCollision:!0},{name:"move_up_constrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveConstrained(e,mx.Up),keyCodes:[Fx.UP],allowCollision:!0},{name:"move_down_constrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveConstrained(e,mx.Down),keyCodes:[Fx.DOWN],allowCollision:!0},{name:"move_left_unconstrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveUnconstrained(e,mx.Left),keyCodes:[Bx(Fx.LEFT,[Fx.ALT]),Bx(Fx.LEFT,[Fx.CTRL])]},{name:"move_right_unconstrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveUnconstrained(e,mx.Right),keyCodes:[Bx(Fx.RIGHT,[Fx.ALT]),Bx(Fx.RIGHT,[Fx.CTRL])]},{name:"move_up_unconstrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveUnconstrained(e,mx.Up),keyCodes:[Bx(Fx.UP,[Fx.ALT]),Bx(Fx.UP,[Fx.CTRL])]},{name:"move_down_unconstrained",preconditionFn:e=>this.mover.isMoving(e),callback:e=>this.mover.moveUnconstrained(e,mx.Down),keyCodes:[Bx(Fx.DOWN,[Fx.ALT]),Bx(Fx.DOWN,[Fx.CTRL])]}];menuItems=[{displayText:()=>FM(Qk.MOVE_BLOCK,"start_move"),preconditionFn:(e,t)=>{let i=e.block?.workspace;if(!i||t instanceof PointerEvent)return"hidden";let n=this.getCurrentDraggable(i);return n&&this.mover.canMove(i,n)?"enabled":"disabled"},callback:e=>{let t=e.block?.workspace;if(!t)return!1;let i=this.getCurrentDraggable(t);return i&&rL().focusNode(i),!!i&&this.mover.startMove(t,i,kx.Move,null)},scopeType:rk.ScopeType.BLOCK,id:"move",weight:8.5},{displayText:()=>FM(Qk.MOVE_COMMENT??"Move Comment","start_move"),preconditionFn:(e,t)=>{let i=e.comment;return i?this.mover.canMove(i.workspace,i)?"enabled":"disabled":"hidden"},callback:e=>{let t=e.comment;if(!t)return!1;this.mover.startMove(t.workspace,t,kx.Move,null)},scopeType:rk.ScopeType.COMMENT,id:"move_comment",weight:8.5}];registerShortcuts(){for(let e of this.shortcuts)hA.registry.register(e)}registerMenuItems(){for(let e of this.menuItems)rk.registry.register(e)}install(){this.registerShortcuts(),this.registerMenuItems()}uninstall(){for(let e of this.shortcuts)hA.registry.unregister(e.name);for(let e of this.menuItems)rk.registry.unregister(e.id)}getCurrentDraggable(e){let t=rL().getFocusedNode();if(t instanceof KA.RenderedWorkspaceComment)return t;let i=e.getCursor().getSourceBlock();if(i){for(;i.isShadow();)if(i=i.getParent(),!i)throw Error("Tried to drag a shadow block with no parent. Shadow blocks should always have parents.");return i}}}});function qx(e,t){let i=rk.registry.getItem(e);if(!i||"separator"in i)return()=>{};let n={...i,displayText:e=>{let n="function"==typeof i.displayText?i.displayText(e):i.displayText;return n instanceof HTMLElement?n:FM(n,t)}};return rk.registry.unregister(e),rk.registry.register(n),()=>{rk.registry.unregister(e),rk.registry.register(i)}}var Jx,Zx,eD,tD,iD=s(()=>{KL(),DM(),YM(),Hx=class{duplicateShortcut=null;uninstallHandlers=[];install(){this.duplicateShortcut=this.registerDuplicateShortcut(),this.duplicateShortcut&&(this.uninstallHandlers.push(qx("blockDuplicate",SM.DUPLICATE)),this.uninstallHandlers.push(qx("commentDuplicate",SM.DUPLICATE)))}
3uninstall(){this.uninstallHandlers.forEach(e=>e()),this.uninstallHandlers.length=0,this.duplicateShortcut&&hA.registry.unregister(this.duplicateShortcut.name)}registerDuplicateShortcut(){if(hA.registry.getRegistry()[SM.DUPLICATE])return null;let e={name:SM.DUPLICATE,preconditionFn(e,t){let{focusedNode:i}=t;return i instanceof GC?!i.isInFlyout&&i.isDeletable()&&i.isMovable()&&i.isDuplicatable():i instanceof KA.RenderedWorkspaceComment&&i.isMovable()},callback(e,t,i,n){let o=n.focusedNode.toCopyData();return!!o&&!!QA.paste(o,e)},keyCodes:[DL.KeyCodes.D]};return hA.registry.register(e),e}}}),nD=s(()=>{xM(),DM(),Jx=class{stackShortcuts=[];install(){let e=e=>!!this.getCurNodeRoot(e),t={name:SM.PREVIOUS_STACK,preconditionFn:e,callback:e=>this.navigate(e,-1),keyCodes:[OM.KeyCodes.B]},i={name:SM.NEXT_STACK,preconditionFn:e,callback:e=>this.navigate(e,1),keyCodes:[OM.KeyCodes.N]};Kw.registry.register(t),this.stackShortcuts.push(t),Kw.registry.register(i),this.stackShortcuts.push(i)}getCurNodeRoot(e){let t=e.getCursor();return t.getSourceBlock()?.getRootBlock()??t.getCurNode()}navigate(e,t){let i=this.getCurNodeRoot(e);if(!i||!rM(i))return!1;let n=hM(i,t);return!!n&&(n instanceof kN&&(n=n.getRootBlock()),e.getCursor().setCurNode(n),!0)}uninstall(){this.stackShortcuts.forEach(e=>Kw.registry.unregister(e.name)),this.stackShortcuts.length=0}}}),oD=s(()=>{xM(),DM(),ex(),tx(),ix(),_x(),Ex(),bx(),Ox(),vx(),jx(),Yx(),Qx(),Kx(),zx(),iD(),nD(),Zx=OM.KeyCodes,eD=class{options;navigation=new ax;mover=new Ax(this.navigation);shortcutDialog=new lx;deleteAction=new qM;editAction=new JM(this.navigation);disconnectAction=new Mx(this.navigation);clipboard;duplicateAction=new Hx;workspaceMovement=new hx(this.navigation);arrowNavigation=new px(this.navigation);exitAction=new gx(this.navigation);enterAction=new wx(this.mover,this.navigation);actionMenu=new Px(this.navigation);moveActions=new Ux(this.mover);stackNavigationAction=new Jx;constructor(e={allowCrossWorkspacePaste:!1}){this.options=e,this.clipboard=new KM(this.navigation,e)}origToolboxOnShortcut=null;init(){this.addShortcutHandlers(),this.registerDefaults()}addShortcutHandlers(){this.origToolboxOnShortcut=r$.prototype.onShortcut,r$.prototype.onShortcut=this.toolboxHandler}removeShortcutHandlers(){if(!this.origToolboxOnShortcut)throw Error("no original onShortcut method recorded");r$.prototype.onShortcut=this.origToolboxOnShortcut,this.origToolboxOnShortcut=null}toolboxHandler(e){if(!this.selectedItem_)return!1;switch(e.name){case SM.UP:return this.selectPrevious();case SM.LEFT:return this.selectParent();case SM.DOWN:return this.selectNext();case SM.RIGHT:return this.selectChild();default:return!1}}addWorkspace(e){this.navigation.addWorkspace(e)}removeWorkspace(e){this.navigation.removeWorkspace(e)}enable(e){this.navigation.enableKeyboardAccessibility(e)}disable(e){this.navigation.disableKeyboardAccessibility(e)}shortcuts={focusToolbox:{name:SM.TOOLBOX,preconditionFn:e=>!e.isDragging(),callback:e=>(lM.setIsActive(!0),this.navigation.getState()===IM.WORKSPACE&&(W$().focusTree(e.getToolbox()??e.getFlyout()?.getWorkspace()??e),!0)),keyCodes:[Zx.T]},cleanup:{name:SM.CLEAN_UP,preconditionFn:e=>this.navigation.canCurrentlyEdit(e)&&e.getTopBlocks(!1).length>0,callback:e=>(e.cleanUp(),!0),keyCodes:[Zx.C]}};registerDefaults(){for(let e of Object.values(this.shortcuts))Kw.registry.register(e);this.deleteAction.install(),this.workspaceMovement.install(),this.arrowNavigation.install(),this.editAction.install(),this.exitAction.install(),this.enterAction.install(),this.disconnectAction.install(),this.actionMenu.install(),this.clipboard.install(),this.duplicateAction.install(),this.moveActions.install(),this.shortcutDialog.install(),this.stackNavigationAction.install(),this.shortcutDialog.createModalContent()}dispose(){this.moveActions.uninstall(),this.deleteAction.uninstall(),this.editAction.uninstall(),this.disconnectAction.uninstall(),this.clipboard.uninstall(),this.duplicateAction.uninstall(),this.workspaceMovement.uninstall(),this.arrowNavigation.uninstall(),this.exitAction.uninstall(),this.enterAction.uninstall(),this.actionMenu.uninstall(),this.shortcutDialog.uninstall(),this.stackNavigationAction.uninstall(),Kw.registry.getRegistry().commitMove&&Kw.registry.unregister(Cx);for(let e of Object.values(this.shortcuts))Kw.registry.unregister(e.name);this.removeShortcutHandlers(),this.navigation.dispose()}}});function rD(e){if(!function(e){return e.type===KN.BLOCK_DRAG}(e)||!e.blockId)return;let t=D$.getWorkspaceById(e.workspaceId).getBlockById(e.blockId);if(!t)return;let i=KN.getRecordUndo();KN.setRecordUndo(!1),e.isStart?(tD.clear(),function(e){e.getDescendants(!1).forEac
3h(e=>{let t=new Set(e.getDisabledReasons());tD.set(e.id,t),t.forEach(t=>e.setDisabledReason(!1,t))})}(t)):function(e){e.getDescendants(!1).forEach(e=>{tD.get(e.id)?.forEach(t=>{e.setDisabledReason(!0,t)})})}(t),KN.setRecordUndo(i)}var sD,aD=s(()=>{xM(),tD=new Map});var lD,cD=s(()=>{xM(),sD=class extends o${static createDom(e,t){let i=super.createDom(e,t),n=i.querySelector("div");return n&&"element"in t&&t.element instanceof HTMLElement&&(n.innerHTML="",n.appendChild(t.element)),i}}}),uD=l({KeyboardNavigation:()=>lD}),hD=s(()=>{xM(),oD(),aD(),cD(),Tx(),lD=class{workspace;navigationController;cursor;workspaceFocusRing=null;workspaceSelectionRing=null;oldWorkspaceResize=null;constructor(e,t={allowCrossWorkspacePaste:!1}){this.workspace=e,this.navigationController=new eD(t),this.navigationController.init(),this.navigationController.addWorkspace(e),this.navigationController.enable(e),this.cursor=new kw(e),e.addChangeListener(rD);let i=e.getFlyout();if(null!=i&&i instanceof lw){let t=i.svgGroup_??null;t?.parentElement?.insertBefore(t,e.getParentSvg())}this.oldWorkspaceResize=e.resize,e.resize=()=>{this.oldWorkspaceResize?.call(this.workspace),this.resizeWorkspaceRings()},this.workspaceSelectionRing=OM.dom.createSvgElement("rect",{fill:"none",class:"blocklyWorkspaceSelectionRing"}),e.getSvgGroup().appendChild(this.workspaceSelectionRing),this.workspaceFocusRing=OM.dom.createSvgElement("rect",{fill:"none",class:"blocklyWorkspaceFocusRing"}),e.getSvgGroup().appendChild(this.workspaceFocusRing),this.resizeWorkspaceRings(),U$.setToast(sD.show.bind(sD))}resizeWorkspaceRings(){!this.workspaceFocusRing||!this.workspaceSelectionRing||(this.resizeFocusRingInternal(this.workspaceSelectionRing,5),this.resizeFocusRingInternal(this.workspaceFocusRing,0))}resizeFocusRingInternal(e,t){let i=this.workspace.getMetrics();e.setAttribute("x",(i.absoluteLeft+t).toString()),e.setAttribute("y",(i.absoluteTop+t).toString()),e.setAttribute("width",Math.max(0,i.viewWidth-2*t).toString()),e.setAttribute("height",Math.max(0,i.svgHeight-2*t).toString())}dispose(){this.workspaceFocusRing?.remove(),this.workspaceSelectionRing?.remove(),this.oldWorkspaceResize&&(this.workspace.resize=this.oldWorkspaceResize),this.workspace.removeChangeListener(rD),this.navigationController.dispose()}toggleShortcutDialog(){this.navigationController.shortcutDialog.toggle(this.workspace)}static registerFlyoutCursor(){pM.register(ox,rx,nx,!0)}static registerNavigationDeferringToolbox(){this.registerNavigationDeferringToolbox()}static registerKeyboardNavigationStyles(){XN.register("\n .blocklyDeleteIcon {\n display: block;\n }\n"),XN.register("\n .injectionDiv {\n --blockly-active-node-color: #fff200;\n --blockly-active-tree-color: #60a5fa;\n --blockly-selection-width: 3px;\n }\n"),XN.register("\n /* Active focus cases: */\n /* Blocks with active focus. */\n .blocklyKeyboardNavigation\n .blocklyActiveFocus:is(.blocklyPath, .blocklyHighlightedConnectionPath),\n /* Fields with active focus, */\n .blocklyKeyboardNavigation\n .blocklyActiveFocus.blocklyField\n > .blocklyFieldRect,\n /* Icons with active focus. */\n .blocklyKeyboardNavigation\n .blocklyActiveFocus.blocklyIconGroup\n > .blocklyIconShape:first-child {\n stroke: var(--blockly-active-node-color);\n stroke-width: var(--blockly-selection-width);\n }\n\n /* Passive focus cases: */\n /* Blocks with passive focus except when widget/dropdown div in use. */\n .blocklyKeyboardNavigation:not(\n :has(\n .blocklyDropDownDiv:focus-within,\n .blocklyWidgetDiv:focus-within\n )\n )\n .blocklyPassiveFocus:is(\n .blocklyPath:not(.blocklyFlyout .blocklyPath),\n .blocklyHighlightedConnectionPath\n ),\n /* Fields with passive focus except when widget/dropdown div in use. */\n .blocklyKeyboardNavigation:not(\n :has(\n .blocklyDropDownDiv:focus-within,\n .blocklyWidgetDiv:focus-within\n )\n )\n .blocklyPassiveFocus.blocklyField\n > .blocklyFieldRect,\n /* Icons with passive focus except when widget/dropdown div in use. */\n .blocklyKeyboardNavigation:not(\n :has(\n .blocklyDropDownDiv:focus-within,\n .blocklyWidgetDiv:focus-within\n )\n )\n .blocklyPassiveFocus.blocklyIconGroup\n > .blocklyIconShape:first-child {\n stroke: var(--blockly-active-node-color);\n stroke-dasharray: 5px 3px;\n stroke-width: var(--blockly-selection-width);\n }\n\n /* Workaround for unexpectedly hidden connection path due to core style. */\n .blocklyKeyboardNavigation\n .blocklyPassiveFocus.blocklyHighlightedConnectionPath {\n display: unset !important;\n }\n"),XN.register("\n /* Different ways for toolbox/flyout to be the active tree: */\n /* Active focus in the flyout. */\n .blocklyKeyboardNavigation .blocklyFlyout:has(.blocklyActiveFocus),\n /* Active focus in the toolbox. */\n .blocklyKeyboardNavigation .blocklyToolbox:has(.blocklyActiveFocus),\n /* Active focus on the toolbox/flyout. */\n .blocklyKeyboardNavigation\n .blocklyActiveFocus:is(.blocklyFlyout, .blocklyToolbox) {\n outline-offset: calc(var(--blockly-selection-width) * -1);\n outline: var(--blockly-selection-width) solid\n var(--blockly-active-tree-color);\n }\n\n /* Suppress default outline. */\n .blocklyKeyboardNavigation\n .blocklyToolboxCategoryContainer:focus-visible {\n outline: none;\n }\n"),XN.register("\n /* Different ways for the workspace to be the active tree: */\n /* Active focus within workspace. */\n .blocklyKeyboardNavigation\n .blocklyWorkspace:has(.blocklyActiveFocus)\n .blocklyWorkspaceFocusRing,\n /* Active focus within drag layer. */\n .blocklyKeyboardNavigation\n .blocklySvg:has(~ .blocklyBlockDragSurface .blocklyActiveFocus)\n .blocklyWorkspaceFocusRing,\n /* Active focus on workspace. */\n .blocklyKeyboardNavigation\n .blocklyWorkspace.blocklyActiveFocus\n .blocklyWorkspaceFocusRing,\n /* Focus in widget/dropdown div considered to be in workspace. */\n .blocklyKeyboardNavigation:has(\n .blocklyWidgetDiv:focus-within,\n .blocklyDropDownDiv:focus-within\n )\n .blocklyWorkspace\n .blocklyWorkspaceFocusRing {\n stroke: var(--blockly-active-tree-color);\n stroke-width: calc(var(--blockly-selection-width) * 2);\n }\n\n /* The workspace itself is the active node. */\n .blocklyKeyboardNavigation\n .blocklyWorkspace.blocklyActiveFocus\n .blocklyWorkspaceSelectionRing {\n stroke: var(--blockly-active-node-color);\n stroke-width: var(--blockly-selection-width);\n }\n \n /* The workspace itself is the active node. */\n .blocklyKeyboardNavigation\n .blocklyBubble.blocklyActiveFocus\n .blocklyDraggable {\n stroke: var(--blockly-active-node-color);\n stroke-width: var(--blockly-selection-width);\n }\n"),XN.register("\n .blocklyRTL .blocklyMenuItemContent .blocklyShortcutContainer {\n flex-direction: row-reverse;\n }\n .blocklyMenuItemContent .blocklyShortcutContainer {\n width: 100%;\n display: flex;\n justify-content: space-between;\n gap: 16px;\n }\n .blocklyMenuItemContent .blocklyShortcutContainer .blocklyShortcut {\n color: #ccc;\n }\n"),XN.register("\n:root {\n --divider-border-color: #eee;\n --key-border-color: #ccc;\n --shortcut-modal-border-color: #9aa0a6;\n}\n\n.shortcut-modal {\n border: 1px solid var(--shortcut-modal-border-color);\n border-radius: 12px;\n box-shadow: 6px 6px 32px rgba(0,0,0,.5);\n flex-direction: column;\n gap: 12px;\n margin: auto;\n max-height: 82vh;\n max-width: calc(100% - 10em);\n padding: 24px 12px 24px 32px;\n position: relative;\n z-index: 99;\n}\n\n.shortcut-modal[open] {\n display: flex;\n}\n\n.shortcut-modal .close-modal {\n border: 0;\n background: transparent;\n float: inline-end;\n margin: 0 0 0 0;\n position: absolute;\n top: 16px;\n right: 24px;\n}\n\n.shortcut-modal h1 {\n font-weight: 600;\n font-size: 1.2em;\n}\n\n.shortcut-modal:before {\n background: radial-gradient(rgba(244, 244, 244, 0.43), rgba(75, 75, 75, 0.51));\n align-items: center;\n display: block;\n font-family: Roboto;\n height: 100%;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.shortcut-tables {\n display: grid;\n align-items: start;\n grid-template-columns: 1fr;\n row-gap: 1em;\n column-gap: 2em;\n}\n\n@media (min-width: 950px) {\n .shortcut-tables {\n grid-template-columns: 1fr 1fr\n }\n}
3\n\n@media (min-width: 1360px) {\n .shortcut-tables {\n grid-template-columns: 1fr 1fr 1fr\n }\n}\n\n.shortcut-table {\n border-collapse: collapse;\n font-family: Roboto;\n font-size: .9em;\n}\n\n.shortcut-table th {\n padding-inline-end: 0.5em;\n text-align: left;\n text-wrap: nowrap;\n vertical-align: baseline;\n}\n\n.shortcut-table td:first-child {\n text-wrap: auto;\n width: 40%;\n}\n\n.shortcut-table tr:has(+ .category) {\n --divider-border-color: transparent;\n margin-end: 1em;\n}\n\n.shortcut-table tr:not(.category, :last-child) {\n border-bottom: 1px solid var(--divider-border-color);\n}\n\n.shortcut-table td {\n padding: 0.2em 1em 0.3em 0;\n text-wrap: nowrap;\n}\n\n.shortcut-table h2 {\n border-bottom: 1px solid #999;\n font-size: 1em;\n padding-block-end: 0.5em;\n}\n\n.shortcut-table .key {\n border: 1px solid var(--key-border-color);\n border-radius: 8px;\n display: inline-block;\n margin: 0 4px;\n min-width: 2em;\n padding: .3em .5em;\n text-align: center;\n}\n\n.shortcut-table .separator {\n color: gray;\n display: inline-block;\n padding: 0 0.5em;\n}\n\n.shortcut-container {\n font-size: 0.95em;\n overflow: auto;\n padding: 0.5em;\n}\n\n.shortcut-combo {\n display: inline-block;\n padding: 0.25em 0;\n text-wrap: nowrap;\n}\n\n")}}}),dD={class:"block-editor-wrapper"},pD={class:"workspace-controls"},fD={class:"zoom-controls"},gD={class:"zoom-label"},mD=!1,TD=!1,_D=!1,ED=yC(xi({__name:"BlockEditor",props:{workspaceUrl:{},filename:{},getAuthToken:{type:Function},lang:{}},emits:["update:python","load-error"],setup(e,{expose:t,emit:i}){let n=e,o=i,r=Pi("containerEl"),s=mi("brikkeShadowRoot",null),a=wt(1),l={en:Nv,nb:wv,nn:$v},c=null,u=null,h=null,d=null,p=null,f=null,g=null,m=null,T=null,_=null,E=null;function b(){return l[n.lang??"en"]}function O(){!u||!d||o("update:python",d.workspaceToCode(u))}async function v(){if(!(u&&n.workspaceUrl&&g&&m))return;let e=await g(n.workspaceUrl,n.getAuthToken);if(e.ok)try{m(e.value,u),O()}catch(e){o("load-error",`Kunne ikke lese blokkfilen: ${e.message}`)}else o("load-error",`Kunne ikke lese blokkfilen: ${e.error}`)}let I=new Set(["constrainedMoveHint","unconstrainedMoveHint","copiedHint","cutHint","helpHint"]);function S(){u?.zoomToFit(),u&&(a.value=Math.round(10*u.getScale())/10)}function y(e){if(!u)return;let t=Math.min(2,Math.max(.5,Math.round(10*(a.value+e))/10));a.value=t,u.setScale(t)}return t({exportJson:()=>u&&p?p(u):null,download(){!u||!p||!f||f(p(u),n.filename??"blokker.json")},async reload(){u&&(u.clear(),await v())}}),qi(async()=>{if(!r.value)return;let[e,{pythonGenerator:t},{registerTurtleBlocks:i},n,,{KeyboardNavigation:o}]=await Promise.all([Promise.resolve().then(()=>(KL(),QL)),Promise.resolve().then(()=>(ZL(),JL)),Promise.resolve().then(()=>(lN(),rN)),Promise.resolve().then(()=>(wM(),cN)),Promise.resolve().then(()=>(MM(),$M)),Promise.resolve().then(()=>(hD(),uD))]);if(c=e,mD||=(o.registerKeyboardNavigationStyles(),!0),!TD){class t extends e.Toolbox{onKeyDown_(e){}}e.registry.register(e.registry.Type.TOOLBOX,e.registry.DEFAULT,t,!0),TD=!0}
3d=t,p=n.serializeWorkspace,f=n.downloadWorkspaceJson,g=n.fetchWorkspace,m=n.loadWorkspace,T=i;let a=b();e.setLocale(a.messages),function(e){if(_D)return;_D=!0;let t=e.Toast.show.bind(e.Toast);e.Toast.show=(e,i)=>{i.id&&I.has(i.id)||t(e,i)}}(e),i(),u=e.inject(r.value,{toolbox:FC(a.toolbox),renderer:"thrasos",sounds:!1,media:new URL(import.meta.url).origin+"/blockly-media/"}),s&&document.head.querySelectorAll('style[id^="blockly-"]').forEach(e=>{let t=e.id;s.querySelector(`style#${CSS.escape(t)}`)||s.appendChild(e.cloneNode(!0))}),h=new ResizeObserver(()=>{u&&e.svgResize(u)}),h.observe(r.value),u.addChangeListener(()=>O()),E=e=>{"Tab"===e.key&&(!r.value||!E||!u||(r.value.removeEventListener("keydown",E),E=null,_=new o(u)))},r.value.addEventListener("keydown",E),await ni(),await v()}),pe(()=>{r.value&&E&&(r.value.removeEventListener("keydown",E),E=null),_?.dispose?.(),_=null,h?.disconnect(),h=null,u?.dispose(),u=null,c=null,T=null}),_i(()=>n.workspaceUrl,async()=>{u&&(u.clear(),await v())}),_i(()=>n.lang,()=>{if(!(u&&c&&T&&m&&p))return;let e=b(),t=p(u);c.setLocale(e.messages),T(),u.updateToolbox(FC(e.toolbox)),u.clear(),m(t,u)}),(e,t)=>(Oo(),yo("div",dD,[No("div",{ref_key:"containerEl",ref:r,class:"block-editor",tabindex:"0"},null,512),No("div",pD,[No("button",{class:"workspace-btn",title:"Sentrér blokker",onClick:S},[...t[2]||=[xo('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-7cd2d3dd><path d="M8 3H5a2 2 0 0 0-2 2v3" data-v-7cd2d3dd></path><path d="M21 8V5a2 2 0 0 0-2-2h-3" data-v-7cd2d3dd></path><path d="M3 16v3a2 2 0 0 0 2 2h3" data-v-7cd2d3dd></path><path d="M16 21h3a2 2 0 0 0 2-2v-3" data-v-7cd2d3dd></path><circle cx="12" cy="12" r="3" data-v-7cd2d3dd></circle></svg>',1)]]),No("div",fD,[No("button",{class:"zoom-btn","aria-label":"Zoom inn",onClick:t[0]||=e=>y(.1)},"+"),No("span",gD,ce(Math.round(100*a.value))+"%",1),No("button",{class:"zoom-btn","aria-label":"Zoom ut",onClick:t[1]||=e=>y(-.1)},"â")])])]))}}),[["__scopeId","data-v-7cd2d3dd"]]),bD={class:"chev"},OD={class:"label"},vD=yC(xi({__name:"ConsoleDrawer",props:{label:{}},setup(e,{expose:t}){let i=e,n=wt(!1),o=wt([]),r=Pi("scrollEl");return t({hasContent:()=>o.value.length>0,reset(){o.value=[]},closeIfEmpty(){0===o.value.length&&(n.value=!1)},appendPrint(e){o.value.push({text:e,isError:!1}),n.value||=!0},appendError(e){o.value.push({text:`Feil: ${e}`,isError:!0}),n.value||=!0},open(){n.value=!0},close(){n.value=!1}}),_i(o,()=>{queueMicrotask(()=>{r.value&&(r.value.scrollTop=r.value.scrollHeight)})},{deep:!0}),(e,t)=>(Oo(),yo("div",{class:ee(["console-drawer",{open:n.value}])},[No("button",{class:"console-toggle",type:"button",onClick:t[0]||=e=>n.value=!n.value},[No("span",bD,ce(n.value?"â¾":"â´"),1),No("span",OD,ce(i.label??"Konsoll"),1)]),fi(No("div",{ref_key:"scrollEl",ref:r,class:"console-body"},[(Oo(!0),yo(go,null,ln(o.value,(e,t)=>(Oo(),yo("div",{key:t,class:ee({error:e.isError})},ce(e.text),3))),128))],512),[[mr,n.value]])],2))}}),[["__scopeId","data-v-fe14330b"]]);var ID=e=>(e%360+360)%360,SD=e=>e*Math.PI/180;function yD(e,t){switch(t.kind){case"forward":{let i=Number(t.args[0]);return{...e,x:e.x+i*Math.cos(SD(e.heading)),y:e.y+i*Math.sin(SD(e.heading))}}case"backward":{let i=Number(t.args[0]);return{...e,x:e.x-i*Math.cos(SD(e.heading)),y:e.y-i*Math.sin(SD(e.heading))}}case"left":return{...e,heading:ID(e.heading+Number(t.args[0]))};case"right":return{...e,heading:ID(e.heading-Number(t.args[0]))};case"setheading":return{...e,heading:ID(Number(t.args[0]))};case"goto":return{...e,x:Number(t.args[0]),y:Number(t.args[1])};case"home":return{...e,x:0,y:0,heading:0};case"penup":return{...e,penDown:!1};case"pendown":return{...e,penDown:!0};case"color":return{...e,color:String(t.args[0])};case"width":return{...e,width:Math.max(1,Number(t.args[0]))};case"speed":case"circle":case"clear":case"begin_fill":case"end_fill":case"print":case"error":return e}}var RD={class:"chev"},CD={class:"label"},kD={class:"zoom-controls"},AD={class:"zoom-label"},LD=yC(xi({__name:"TurtleCanvas",props:{label:{}},setup(e,{expose:t}){let i=e,n=Pi("canvasEl"),o=Pi("containerEl"),r=wt(!1),s=[],a=[],l=[],c=!1,u=[],h="black",d={x:0,y:0,heading:0,penDown:!0,color:"black",width:2,visible:!0},p=null,f=0,g=wt(1);function m(e){g.value=Math.min(2,Math.max(.5,Math.round(10*(g.value+e))/10)),b(d)}let T=new Image;function _(){if(!n.value)throw Error("canvas not mounted");let e=n.value.getContext("2d");if(!e)throw Error("2d context unavailable");return e}function E(e,t){let i=n.value,o=i.width/2,r=i.height/2;return{px:o+e*g.value,py:r-t*g.value}}function b(e,t,i){if(function(){let e=n.value;_().clearRect(0,0,e.width,e.height)}(),function(){let e=_();for(let t of l){if(e.beginPath(),"circle"===t.kind){let{px:i,py:n}=E(t.cx,t.cy);e.arc(i,n,t.r*g.value,0,2*Math.PI)}else{if(t.points.length<2)continue;let i=E(t.points[0].x,t.points[0].y);e.moveTo(i.px,i.py);for(let n=1;n<t.points.length;n++){let i=E(t.points[n].x,t.points[n].y);e.lineTo(i.px,i.py)}e.closePath()}e.fillStyle=t.color,e.fill()}}(),function(){let e=_();for(let t of a){let{px:i,py:n}=E(t.cx,t.cy);e.beginPath(),e.arc(i,n,t.r*g.value,0,2*Math.PI),e.strokeStyle=t.color,e.lineWidth=t.width,e.stroke()}}(),function(){let e=_();for(let t of s){let i=E(t.x1,t.y1),n=E(t.x2,t.y2);e.beginPath(),e.strokeStyle=t.color,e.lineWidth=t.width,e.moveTo(i.px,i.py),e.lineTo(n.px,n.py),e.stroke()}}(),t){let e=_(),i=E(t.x1,t.y1),n=E(t.x2,t.y2);e.beginPath(),e.strokeStyle=t.color,e.lineWidth=t.width,e.moveTo(i.px,i.py),e.lineTo(n.px,n.py),e.stroke()}if(i){let e=_(),{px:t,py:n}=E(i.cx,i.cy);e.beginPath(),e.arc(t,n,i.r*g.value,i.startAngle,i.endAngle,!0),e.strokeStyle=i.color,e.lineWidth=i.width,e.stroke()}!function(e){if(!e.visible)return;let t=_(),{px:i,py:n}=E(e.x,e.y),o=e.heading*Math.PI/180;if(t.save(),t.translate(i,n),t.rotate(-o),T.complete&&T.naturalWi
3dth>0){let e=40*g.value,i=25*g.value;t.drawImage(T,-e/2,-i/2,e,i)}t.restore()}(e)}function O(e){if(!p)return;let{startState:t,targetState:i,startTime:n,durationMs:o,event:r}=p,g=Math.min(1,(e-n)/o),m={...t};switch(r.kind){case"forward":case"backward":case"goto":m={...t,x:t.x+(i.x-t.x)*g,y:t.y+(i.y-t.y)*g},b(m,t.penDown?{x1:t.x,y1:t.y,x2:m.x,y2:m.y,color:t.color,width:t.width}:void 0);break;case"left":case"right":case"setheading":{let e=(i.heading-t.heading+540)%360-180;m={...t,heading:(t.heading+e*g+360)%360},b(m);break}case"circle":{let e=Number(r.args[0]),i=(t.heading+90)*Math.PI/180,n=t.x+e*Math.cos(i),o=t.y+e*Math.sin(i),s=(t.heading-90+360*g)*Math.PI/180;m={...t,x:n+e*Math.cos(s),y:o+e*Math.sin(s),heading:(t.heading+360*g)%360};let a=(90-t.heading)*Math.PI/180;b(m,void 0,t.penDown&&g>0?{cx:n,cy:o,r:Math.abs(e),startAngle:a,endAngle:a-2*Math.PI*g,color:t.color,width:t.width}:void 0);break}default:b(i)}if(g<1)f=requestAnimationFrame(O);else{if(("forward"===r.kind||"backward"===r.kind||"goto"===r.kind)&&(t.penDown&&s.push({x1:t.x,y1:t.y,x2:i.x,y2:i.y,color:t.color,width:t.width}),c&&u.push({x:i.x,y:i.y})),"circle"===r.kind){let e=Number(r.args[0]),i=(t.heading+90)*Math.PI/180,n=t.x+e*Math.cos(i),o=t.y+e*Math.sin(i);t.penDown&&a.push({cx:n,cy:o,r:Math.abs(e),color:t.color,width:t.width}),c&&l.push({kind:"circle",cx:n,cy:o,r:Math.abs(e),color:h})}d=i;let{resolve:e}=p;p=null,b(d),e()}}function v(){let e=n.value,t=o.value;if(!e||!t)return;let i=t.getBoundingClientRect();e.width=Math.floor(i.width),e.height=Math.floor(i.height),b(d)}T.src="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_2'%20data-name='Layer%202'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2047.51%2029.41'%3e%3cdefs%3e%3cstyle%3e%20.cls-1%20{%20fill:%20%23eafff8;%20}%20.cls-1,%20.cls-2,%20.cls-3%20{%20stroke:%20%2300423e;%20}%20.cls-1,%20.cls-2,%20.cls-3,%20.cls-4,%20.cls-5%20{%20stroke-miterlimit:%2010;%20stroke-width:%20.75px;%20}%20.cls-2%20{%20fill:%20%234d9c8b;%20}%20.cls-3%20{%20fill:%20%23aadcd2;%20}%20.cls-4%20{%20fill:%20%23ff6472;%20stroke:%20%23530e20;%20}%20.cls-5%20{%20fill:%20%23e3ccf3;%20stroke:%20%233c2551;%20}%20%3c/style%3e%3c/defs%3e%3cg%20id='Dimensions'%3e%3cpath%20class='cls-5'%20d='M32.69,14.7c0,2.85.44,5.17,4.75,5.17s9.81-1.67,9.7-5.17c-.09-2.85-5.39-5.17-9.7-5.17s-4.75,2.31-4.75,5.17Z'/%3e%3cpolygon%20class='cls-5'%20points='12.18%2010.4%201.22%2014.27%2012.18%2017.51%2012.18%2010.4'/%3e%3cellipse%20class='cls-5'%20cx='11.28'%20cy='4.96'%20rx='3.2'%20ry='5.63'%20transform='translate(-.2%209.43)%20rotate(-45)'/%3e%3cellipse%20class='cls-5'%20cx='11.28'%20cy='24.45'%20rx='5.63'%20ry='3.2'%20transform='translate(-13.99%2015.14)%20rotate(-45)'/%3e%3cellipse%20class='cls-5'%20cx='31.9'%20cy='4.96'%20rx='5.63'%20ry='3.2'%20transform='translate(5.84%2024.01)%20rotate(-45)'/%3e%3cellipse%20class='cls-5'%20cx='31.9'%20cy='24.45'%20rx='3.2'%20ry='5.63'%20transform='translate(-7.95%2029.72)%20rotate(-45)'/%3e%3cpath%20class='cls-2'%20d='M33.86,9.55c-1.16-2.23-3.06-4.09-5.42-5.31h-.01c-2-1.06-4.34-1.67-6.84-1.67s-4.84.61-6.84,1.66h-.01c-2.44,1.29-4.4,3.23-5.54,5.55-.76,1.5-1.18,3.17-1.18,4.93,0,1.6.35,3.11.98,4.5,1.11,2.51,3.15,4.61,5.73,5.97,2,1.06,4.35,1.67,6.86,1.67s4.86-.61,6.86-1.67c2.66-1.39,4.73-3.56,5.83-6.16.57-1.35.88-2.79.88-4.31,0-1.85-.46-3.6-1.3-5.16ZM21.45,19.47c-.72,0-1.41-.07-2.05-.2h-.01c-1.57-.31-2.91-.97-3.82-1.85-.81-.75-1.29-1.68-1.29-2.7,0-1.1.56-2.11,1.51-2.92.89-.76,2.16-1.35,3.6-1.63h.01c.64-.13,1.33-.2,2.05-.2.76,0,1.49.08,2.18.23h.01c1.51.32,2.81.98,3.71,1.84.8.76,1.26,1.69,1.26,2.69,0,.82-.31,1.6-.86,2.26-.88,1.07-2.35,1.89-4.11,2.26-.69.14-1.43.23-2.19.23Z'/%3e%3cpath%20class='cls-3'%20d='M14.27,14.72c0,1.02.48,1.95,1.29,2.7-1.31,1.12-3.35,1.84-5.65,1.84-.31,0-.62-.01-.92-.05-.63-1.39-.98-2.91-.98-4.5,0-1.76.42-3.43,1.18-4.93.24-.01.48-.02.71-.02,2.43,0,4.58.81,5.87,2.05-.95.81-1.51,1.82-1.51,2.92Z'/%3e%3cpath%20class='cls-1'%20d='M28.61,14.72c0,.82-.31,1.6-.86,2.26-.88,1.07-2.35,1.89-4.11,2.26-.69.14-1.43.23-2.19.23-.72,0-1.41-.07-2.05-.2h-.01c-1.57-.31-2.91-.97-3.82-1.85-.81-.75-1.29-1.68-1.29-2.7,0-1.1.56-2.11,1.51-2.92.89-.76,2.16-1.35,3.6-1.63h.01c.64-.13,1.33-.2,2.05-.2.76,
30,1.49.08,2.18.23h.01c1.51.32,2.81.98,3.71,1.84.8.76,1.26,1.69,1.26,2.69Z'/%3e%3cpath%20class='cls-3'%20d='M35.16,14.71c0,1.53-.31,2.97-.88,4.31-.2.01-.41.02-.62.02-2.45,0-4.61-.81-5.91-2.06.55-.67.86-1.44.86-2.26,0-1-.46-1.93-1.26-2.69,1.22-1.48,3.59-2.49,6.32-2.49.07,0,.14,0,.2.01.83,1.56,1.3,3.31,1.3,5.16Z'/%3e%3cpath%20class='cls-3'%20d='M28.76,5.65c0,2.14-2.17,3.97-5.12,4.54h-.01c-.69-.14-1.42-.23-2.18-.23-.72,0-1.41.07-2.05.2h-.01c-2.87-.61-4.97-2.39-4.97-4.52,0-.49.11-.96.32-1.42h.01c2-1.06,4.34-1.67,6.84-1.67s4.84.61,6.84,1.66h.01c.21.46.32.94.32,1.43Z'/%3e%3cpath%20class='cls-3'%20d='M28.76,23.8c0,.48-.11.94-.31,1.38-2,1.06-4.35,1.67-6.86,1.67s-4.86-.61-6.86-1.67c-.2-.44-.31-.91-.31-1.38,0-2.11,2.1-3.91,4.97-4.53h.01c.64.13,1.33.2,2.05.2.76,0,1.5-.08,2.19-.23,2.96.58,5.12,2.41,5.12,4.55Z'/%3e%3ccircle%20class='cls-4'%20cx='38.72'%20cy='11.24'%20r='2.11'/%3e%3ccircle%20class='cls-4'%20cx='38.72'%20cy='18.22'%20r='2.11'/%3e%3c/g%3e%3c/svg%3e",t({hasContent:()=>s.length>0||a.length>0,reset(){f&&cancelAnimationFrame(f),f=0,p&&=(p.resolve(),null),s=[],a=[],l=[],c=!1,u=[],d={x:0,y:0,heading:0,penDown:!0,color:"black",width:2,visible:!0},b(d)},close(){r.value=!1},closeIfEmpty(){0===s.length&&0===a.length&&(r.value=!1)},playEvent:(e,t)=>(r.value||=!0,new Promise(i=>{if("penup"===e.kind||"pendown"===e.kind||"color"===e.kind||"width"===e.kind)return d=yD(d,e),b(d),void setTimeout(i,t);if("clear"===e.kind)return s=[],a=[],l=[],c=!1,u=[],b(d),void setTimeout(i,t);if("begin_fill"===e.kind)return c=!0,u=[{x:d.x,y:d.y}],h=d.color,void setTimeout(i,t);if("end_fill"===e.kind)return c&&u.length>=2&&l.push({kind:"polygon",points:[...u],color:h}),c=!1,u=[],b(d),void setTimeout(i,t);let n=yD(d,e);p={startState:d,targetState:n,startTime:performance.now(),durationMs:t,event:e,resolve:i},f=requestAnimationFrame(O)}))});let I=null;return qi(()=>{T.onload=()=>b(d),v(),typeof ResizeObserver<"u"&&o.value&&(I=new ResizeObserver(()=>v()),I.observe(o.value)),n.value?.addEventListener("wheel",e=>{e.preventDefault(),m(e.deltaY<0?.1:-.1)},{passive:!1})}),pe(()=>{f&&cancelAnimationFrame(f),I?.disconnect()}),(e,t)=>(Oo(),yo("div",{class:ee(["canvas-panel",{open:r.value}])},[No("button",{class:"canvas-toggle",type:"button",onClick:t[0]||=e=>r.value=!r.value},[No("span",RD,ce(r.value?"â¾":"â´"),1),No("span",CD,ce(i.label??"Lerret"),1)]),fi(No("div",{ref_key:"containerEl",ref:o,class:"turtle-canvas-wrap"},[No("canvas",{ref_key:"canvasEl",ref:n},null,512),No("div",kD,[No("button",{class:"zoom-btn","aria-label":"Zoom inn",onClick:t[1]||=e=>m(.1)},"+"),No("span",AD,ce(Math.round(100*g.value))+"%",1),No("button",{class:"zoom-btn","aria-label":"Zoom ut",onClick:t[2]||=e=>m(-.1)},"â")])],512),[[mr,r.value]])],2))}}),[["__scopeId","data-v-b152e6e4"]]),ND={key:0,class:"turtle-output"},wD={key:1,class:"text-output"},$D={key:0},MD={key:0},xD=["src"],DD=yC(xi({__name:"OutputPanel",props:{turtleEnabled:{type:Boolean},textOutput:{},imageSrc:{},labelCanvas:{},labelConsole:{}},setup(e,{expose:t}){let i=e,n=Pi("canvasRef"),o=Pi("consoleRef"),r=wt(!1);return t({reset:function(){n.value?.reset(),n.value?.close(),o.value?.reset(),o.value?.close(),r.value=!1},afterRun:function(){n.value?.closeIfEmpty(),o.value?.closeIfEmpty()},canvas(){let e=n.value;return e?{...e,playEvent:(...t)=>(r.value=!0,e.playEvent(...t)),reset:()=>e.reset()}:null},consoleDrawer(){let e=o.value;return e?{...e,appendPrint(t){r.value=!0,e.appendPrint(t)},appendError(t){r.value=!0,e.appendError(t)},reset:()=>e.reset()}:null}}),(e,t)=>i.turtleEnabled?(Oo(),yo("div",ND,[wo(LD,{ref_key:"canvasRef",ref:n,label:i.labelCanvas},null,8,["label"]),wo(vD,{ref_key:"consoleRef",ref:o,label:i.labelConsole},null,8,["label"])])):(Oo(),yo("div",wD,[i.textOutput||i.imageSrc?(Oo(),yo("div",$D,[t[0]||=No("h3",{class:"result-header"},"Resultat:",-1),i.textOutput?(Oo(),yo("pre",MD,ce(i.textOutput),1)):Do("",!0),i.imageSrc?(Oo(),yo("img",{key:1,src:i.imageSrc,alt:"Generated Plot"},null,8,xD)):Do("",!0)])):Do("",!0)]))}}),[["__scopeId","data-v-b08223f0"]]),PD={key:0},FD={class:"header-wrapper"},BD={class:"header"},UD={class:"header-button-wrapper"},HD=["aria-label"],VD=["aria-label"],GD={class:"settings-row"},WD={class:"settings-label"},XD=["aria-label"],zD=["aria-pressed","onClick"],jD={class:"settings-row"},YD={class:"settings-label"},QD=["aria-label"],KD=["aria-pressed"],qD=["aria-pressed"],JD={key:0,class:"settings-keyboard-nav"},ZD={class:"settings-label"},eP={class:"keyboard-hints"},tP={key:0,class:"tabs"},iP=["disabled","onClick"],nP={class:"code-wrapper"},oP={key:0,class:"readonly-banner"},rP={class:"result-wrapper"},sP={key:0},aP={key:1,class:"output"},lP=yC(xi({__name:"CodeEditor",props:{env:{},code:{},libraries:{},files:{},blocklyWorkspace:{},getAuthToken:{type:Function},lang:{}},emits:["update:lang"],setup(e,{emit:t}){let i=e,n=t,o=mi("brikkeShadowRoot",null)??document,r=wt(i.lang??"en");_i(()=>i.lang,e=>{e&&(r.value=e)});let s={en:Nv,nb:wv,nn:$v},a=or(()=>s[r.value].editor),l=wt(!1),c=Pi("settingsRef");function u(e){let t=e.composedPath();c.value&&!t.includes(c.value)&&(l.value=!1,document.removeEventListener("click",u))}function h(e){e.stopPropagation(),l.value=!l.value,l.value?document.addEventListener("click",u):document.removeEventListener("click",u)}tn(()=>{document.removeEventListener("click",u)});let d=Sd.of([{key:"Escape",run:e=>(e.contentDOM.blur(),!0)}]),p=wt(),f=wt(i.code||""),g=wt(!1),m=wt(null),T=wt(""),_=[new kg(Lv,[Lv.data.of({autocomplete:Sv}),Lv.data.of({autocomplete:Cv})]),d,Sd.of(g_)],E=or(()=>D.value&&"code"===P.value),b=or(()=>E.value?[..._,md.editable.of(!1)]:_),O=wt(""),v=wt(""),I=wt(!1),S=wt("main.py"),y=wt(i.code||""),R=wt(!1),C=wt(!1),k=wt(!1),A=wt(""),L=wt(null),N=wt(!1),w=null,$=null,M=or(()=>[{name:"main.py",url:""},...i.files||[]].map(e=>(e.name||"").split("/").pop()||"")),x=or(()=>function(e){return(e?.includes("turtle")??!1)||(e?.includes("block-programming")??!1)}(i.libraries)),D=or(()=>function(e){return e?.includes("block-programming")??!1}(i.libraries)),P=wt(D.value?"blocks":"code");_i(D,e=>{P.value=e?"blocks":"code"}),_i(()=>[D.value,i.blocklyWorkspace],([e,t])=>{!e&&t&&console.warn("[CodeEditor] blocklyWorkspace prop passed but `block-programming` is not in libraries; ignoring workspace.")},{immediate:!0}),_i(()=>i.libraries,async e=>{O.value="",e&&g.value&&await z(e)}),_i(()=>y.value,e=>{"main.py"===S.value&&(f.value=e)});let F=wt(""),B=Pi("blockEditorRef"),U=Pi("outputPanelRef");function H(e){F.value=e}function V(e){O.value=e}let G=null;function W(){return G||(G=function(e){let t=wt(!1),i=function(){let e=[],t=!1;return{push(i){e.length>=1e3?t=!0:e.push(i)},drain:()=>e.slice(),size:()=>e.length,isCapped:()=>t,reset(){e=[],t=!1}}}(),n=null;return{isRunning:t,async run(o){let r=e.pyodide();if(r&&(n=e.animator(),n)){t.value=!0;
3try{e.canvasReset(),e.consoleReset(),i.reset(),e.isTurtleEnabled()&&Gv(r,i);let t=o;e.requestUserInput&&o.includes("input(")&&(r.registerJsModule("input_handler",{request_input:t=>e.requestUserInput(t)}),await Dv(r,"\nfrom input_handler import request_input\nimport builtins\n\n\nasync def _brikke_async_input(prompt=''):\n return await request_input(str(prompt))\n\n\nbuiltins.input = _brikke_async_input\n"),t=function(e){return e.split("\n").map(e=>e.trim().startsWith("#")?e:e.replace(/(?<![\w.])input\(/g,"await input(")).join("\n")}(o));let s=null;try{s=await Bv(r,t)}catch(e){s=e instanceof Error?e.message:String(e)}s&&i.push({kind:"error",text:s});let a=i.drain();i.isCapped()&&a.push({kind:"error",text:"For mange operasjoner â sjekk for uendelig løkke"}),await n.run(a)}finally{t.value=!1,n=null}}},cancel(){n?.cancel(),t.value=!1}}}({pyodide:()=>m.value,animator:()=>{let e=U.value;if(!e)return null;let t=e.canvas(),i=e.consoleDrawer();return t&&i?function(e,t){let i=!1,n=150;return{async run(o){i=!1,n=150;for(let r of o){if(i)return;if("print"===r.kind)t.appendPrint(r.text),await Hv(n);else{if("error"===r.kind)return void t.appendError(r.text);if("speed"===r.kind)n=Uv(Number(r.args[0]));else if("circle"===r.kind){let t=Math.abs(Number(r.args[0]));await e.playEvent(r,n*(2*Math.PI*t)/50)}else await e.playEvent(r,n)}}},cancel(){i=!0}}}(t,i):null},canvasReset:()=>U.value?.canvas()?.reset(),consoleReset:()=>U.value?.consoleDrawer()?.reset(),isTurtleEnabled:()=>x.value,requestUserInput:e=>Z(e)}),G)}let X=async()=>{let e=window;return e.loadPyodide?e.loadPyodide:(await new Promise((e,t)=>{let n=document.createElement("script");n.src=function(e){return Xv(e),Wv[e].pyodideScript}(i.env??"prod"),n.onload=e,n.onerror=t,document.head.appendChild(n)}),window.loadPyodide)},z=async e=>{try{let t=ns(e),i=e.map(e=>e.trim()).filter(e=>!function(e){return is.includes(e)}(e));i.length>0&&(O.value=`${a.value.unsupportedLibraries}: ${i.join(", ")}`),t.length>0&&await m.value.loadPackage(t)}catch(e){console.error("Feil ved innlasting av biblioteker:",e)}},j=wt(!1);async function Y(){j.value=!1,U.value?.reset(),y.value=i.code||"",f.value=i.code||"",D.value&&await(B.value?.reload())}function Q(){W().cancel(),C.value=!1}async function K(){if(O.value="",x.value){C.value=!0;try{let e="blocks"===P.value?F.value:f.value;await W().run(e)}finally{C.value=!1,U.value?.afterRun()}return}T.value="",v.value="",C.value=!0;let e=f.value;i.files&&i.files?.length>0&&e.includes("pd.read_csv")&&(e=(e=>{let t=e.trim();return Object.keys(p.value??{}).forEach(e=>{if(!e.includes(".csv"))return;let i=(e=>`"""${e.replace(/\\/g,"\\\\").replace(/"""/g,'\\"\\"\\"')}"""`)(p.value?.[e]??""),n=RegExp(`pd\\.read_csv\\(\\s*['"]${(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(e)}['"]\\s*\\)`,"g");t=t.replace(n,()=>`pd.read_csv(StringIO(${i}))`)}),t})(e));let t=e.includes("input(");if(m.value)try{t?await async function(e){try{m.value.registerJsModule("input_handler",{request_input
3:e=>Z(e)});let t=e.split("\n").map(e=>e.trim().startsWith("#")?e:e.replace(/(?<![\w.])input\(/g,"await input(")).join("\n");await Pv(m.value),await Dv(m.value,"\nfrom input_handler import request_input\nimport builtins\n\n\nasync def _brikke_async_input(prompt=''):\n return await request_input(str(prompt))\n\n\nbuiltins.input = _brikke_async_input\n");let i=await Bv(m.value,t);T.value=i??Fv(m.value),i&&te()}catch(e){T.value=`Error: ${e instanceof Error?e.message:String(e)}`,te()}}(e):i.libraries?.includes("matplotlib")?await async function(e){try{await Pv(m.value),await Dv(m.value,'\nimport matplotlib\nmatplotlib.use("Agg")\nimport matplotlib.pyplot as plt\nimport base64\nimport io\ndef safe_show(): pass\nplt.show = safe_show\n');let t=await Bv(m.value,e);if(t)return T.value=t,void(v.value="");let i=m.value.runPython("len(plt.get_fignums()) > 0"),n="";i&&(n=m.value.runPython('\nbuf = io.BytesIO()\nplt.savefig(buf, format="png", bbox_inches="tight")\nbuf.seek(0)\nencoded_image = base64.b64encode(buf.read()).decode("utf-8")\nplt.close("all")\nencoded_image\n')),T.value=Fv(m.value),v.value=n?`data:image/png;base64,${n}`:""}catch(e){T.value=`Error: ${e instanceof Error?e.message:String(e)}`,v.value=""}}(e):await async function(e){try{await Pv(m.value),T.value=await Bv(m.value,e)??Fv(m.value)}catch(e){T.value=`Error: ${e instanceof Error?e.message:String(e)}`}}(e)}catch(e){T.value=`Error: ${e instanceof Error?e.message:String(e)}`}finally{C.value=!1}}let q=e=>{$&&=(clearTimeout($),null),L.value=e,k.value=!1,N.value=!1,w&&=(w(e),null)},J=()=>{$&&=(clearTimeout($),null),L.value=null,k.value=!1,N.value=!1,w&&=(w(""),null)},Z=(e="")=>new Promise(t=>{A.value=e,L.value=null,N.value=!0,k.value=!0,w=t,$=window.setTimeout(()=>{N.value&&(console.warn("Input dialog timed out after 5 minutes"),J())},3e5)});function te(){k.value&&(k.value=!1,N.value=!1,w&&=(w(""),null))}let ie=async()=>{m.value=await(await X())({indexURL:zv(i.env??"prod")}),await async function(e){await e.runPythonAsync(xv,{filename:Mv})}(m.value),m.value.registerJsModule("user_input_js",{requestUserInput:Z}),i.libraries&&await z(i.libraries),g.value=!0};return qi(async()=>{await ie(),i.files&&i.files?.length>0&&await(async()=>{let e=i.files||[];for(let t of e)try{let e=new Headers;if(i.getAuthToken){let t=await i.getAuthToken();e.append("Authorization",`Bearer ${t}`)}let n=await fetch(t.url,{method:"GET",headers:e});if(!n.ok)throw Error(`Status: ${n.status}`);let o=await n.text();m.value.FS.writeFile(t.name,o,{encoding:"utf8"}),p.value={...p.value,[t.name]:o}}catch(e){console.error("Feil ved innlasting av fil:",e);let t=e instanceof Error?e.message:String(e);O.value=`${a.value.fileLoadError}: ${t}`}})()}),(e,t)=>(Oo(),yo("div",null,[O.value?(Oo(),yo("div",PD,[No("p",null,ce(O.value),1)])):(Oo(),yo("div",{key:1,class:ee(["code-editor-wrapper",R.value?"dark-mode":""])},[No("div",FD,[No("h2",BD,ce(a.value.title),1),No("div",UD,[D.value&&"blocks"===P.value?(Oo(),Ro(RC,{key:0,"aria-label":a.value.btnDownload,icon:"faDownload",onClick:t[0]||=e=>B.value?.download()},null,8,["aria-label"])):Do("",!0),x.value?(Oo(),Ro(RC,{key:1,"aria-label":a.value.btnReset,disabled:C.value,icon:"faRotateLeft",onClick:t[1]||=e=>j.value=!0},null,8,["aria-label","disabled"])):Do("",!0),D.value?(Oo(),yo("div",{key:2,class:"mode-toggle",role:"group","aria-label":a.value.ariaModePicker},[wo(RC,{"aria-label":a.value.btnBlocks,icon:"faPuzzlePiece",selected:"blocks"===P.value,onClick:t[2]||=e=>{P.value="blocks"}},null,8,["aria-label","selected"]),wo(RC,{"aria-label":a.value.btnCode,icon:"faCode",selected:"code"===P.value,onClick:t[3]||=e=>(P.value="code",y.value=F.value,void(f.value=F.value))},null,8,["aria-label","selected"])],8,HD)):Do("",!0),x.value?Do("",!0):(Oo(),Ro(RC,{key:3,class:"hide-mobile",selected:I.value,"aria-label":I.value?a.value.btnLayoutBelow:a.value.btnLayoutSide,icon:I.value?"faArrowUpArrowDown":"faArrowRightArrowLeft",onClick:t[4]||=e=>I.value=!I.value},null,8,["selected","aria-label","icon"])),x.value&&C.value?(Oo(),Ro(RC,{key:4,icon:"faXmark",onClick:Q},{default:pi(()=>[Mo(ce(a.value.btnStop),1)]),_:1})):Do("",!0),x.value&&C.value?Do("",!0):(Oo(),Ro(RC,{key:5,disabled:!g.value||C.value,icon:"faPlay",onClick:K},{default:pi(()=>
3[Mo(ce(a.value.btnRun),1)]),_:1},8,["disabled"])),No("div",{ref_key:"settingsRef",ref:c,class:"settings-container"},[wo(RC,{"aria-label":a.value.settingsTitle,selected:l.value,icon:"faGear",onClick:h},null,8,["aria-label","selected"]),l.value?(Oo(),yo("div",{key:0,class:"settings-panel",role:"dialog","aria-label":a.value.settingsTitle},[No("div",GD,[No("span",WD,ce(a.value.settingsLang),1),No("div",{class:"settings-btn-group",role:"group","aria-label":a.value.ariaLangPicker},[(Oo(),yo(go,null,ln([["en","English"],["nb","BokmÃ¥l"],["nn","Nynorsk"]],([e,t])=>No("button",{key:e,class:ee(["settings-btn",{selected:r.value===e}]),"aria-pressed":r.value===e,onClick:t=>function(e){r.value=e,n("update:lang",e)}(e)},ce(t),11,zD)),64))],8,XD)]),No("div",jD,[No("span",YD,ce(a.value.settingsTheme),1),No("div",{class:"settings-btn-group",role:"group","aria-label":a.value.ariaThemePicker},[No("button",{class:ee(["settings-btn",{selected:!R.value}]),"aria-pressed":!R.value,onClick:t[5]||=e=>R.value=!1},ce(a.value.themeLight),11,KD),No("button",{class:ee(["settings-btn",{selected:R.value}]),"aria-pressed":R.value,onClick:t[6]||=e=>R.value=!0},ce(a.value.themeDark),11,qD)],8,QD)]),D.value&&"blocks"===P.value?(Oo(),yo("div",JD,[No("span",ZD,ce(a.value.keyboardNavTitle),1),No("table",eP,[No("tbody",null,[No("tr",null,[t[10]||=No("td",null,[No("kbd",null,"Tab")],-1),No("td",null,ce(a.value.keyboardNavActivate),1)]),No("tr",null,[t[11]||=No("td",null,[No("kbd",null,"â â â â")],-1),No("td",null,ce(a.value.keyboardNavNavigate),1)]),No("tr",null,[t[12]||=No("td",null,[No("kbd",null,"M")],-1),No("td",null,ce(a.value.keyboardNavMove),1)]),No("tr",null,[t[13]||=No("td",null,[No("kbd",null,"Enter")],-1),No("td",null,ce(a.value.keyboardNavConfirm),1)]),No("tr",null,[t[14]||=No("td",null,[No("kbd",null,"Esc")],-1),No("td",null,ce(a.value.keyboardNavCancel),1)])])])])):Do("",!0)],8,VD)):Do("",!0)],512)])]),M.value.length>1?(Oo(),yo("ul",tP,[(Oo(!0),yo(go,null,ln(M.value,e=>(Oo(),yo("li",{key:e,class:"tab-wrapper"},[No("button",{class:ee(["tab",e===S.value?"selected-tab":""]),disabled:!g.value,onClick:t=>(e=>{S.value=e,y.value="main.py"===e?f.value:p.value?.[e]||""})(e)},ce(e),11,iP)]))),128))])):Do("",!0),No("div",{class:ee(["code-and-result",[x.value?"code-and-result-below":I.value?"":"code-and-result-below"]])}
3,[No("div",nP,[D.value?fi((Oo(),Ro(ED,{key:0,ref_key:"blockEditorRef",ref:B,"workspace-url":i.blocklyWorkspace?.url,filename:"blokker.json","get-auth-token":i.getAuthToken,lang:r.value,"onUpdate:python":H,onLoadError:V},null,8,["workspace-url","get-auth-token","lang"])),[[mr,"blocks"===P.value]]):Do("",!0),D.value&&"code"!==P.value?Do("",!0):(Oo(),yo(go,{key:1},[E.value?(Oo(),yo("div",oP,[wo(vC,{icon:"faLock"}),Mo(" "+ce(a.value.readonlyBanner),1)])):Do("",!0),wo(Dt(yO),{modelValue:y.value,"onUpdate:modelValue":t[7]||=e=>y.value=e,class:ee({"editor-readonly":E.value}),extensions:b.value,root:Dt(o)},null,8,["modelValue","class","extensions","root"])],64))]),No("div",rP,[g.value?(Oo(),yo("div",sP,[wo(DD,{ref_key:"outputPanelRef",ref:U,"turtle-enabled":x.value,"text-output":T.value,"image-src":v.value,"label-canvas":a.value.labelCanvas,"label-console":a.value.labelConsole},null,8,["turtle-enabled","text-output","image-src","label-canvas","label-console"])])):(Oo(),yo("div",aP,ce(a.value.loading),1))])],2)],2)),wo(PC,{visible:k.value,"onUpdate:visible":t[8]||=e=>k.value=e,prompt:A.value,onSubmit:q,onCancel:J},null,8,["visible","prompt"]),wo(PC,{visible:j.value,"onUpdate:visible":t[9]||=e=>j.value=e,"confirm-only":"",title:a.value.resetConfirmTitle,prompt:a.value.resetConfirmPrompt,onSubmit:Y}
3,null,8,["visible","title","prompt"])]))}}),[["__scopeId","data-v-4b94e096"]]),cP=".button{&[data-v-a3f12d37]{--btn-color:#e6e6e6;gap:var(--b-gap-xs);padding:var(--b-gap-sm);white-space:nowrap;background-color:var(--btn-color);border-radius:var(--b-radius);border:none;justify-content:center;align-items:center;font-family:inherit;font-weight:700;display:flex}&.--icon[data-v-a3f12d37]{width:37px;height:37px}&.--selected[data-v-a3f12d37]{background-color:hsl(from var(--btn-color) h s 75%)}&[data-v-a3f12d37]:focus-visible{outline-offset:2px;outline:3px solid #1e1f24}&[data-v-a3f12d37]:hover:not(:disabled){background-color:hsl(from var(--btn-color) h s 80%)}}.input{&[data-v-0860d2f8]{padding:var(--b-gap-xs);font:inherit;border:var(--b-input-border);border-radius:var(--b-radius);display:grid}&[data-v-0860d2f8]:focus-within{outline:1px solid var(--b-input-hover)}}.input-label[data-v-0860d2f8]{font-size:14px}textarea[data-v-0860d2f8],input[data-v-0860d2f8]{width:100%;font:inherit;resize:vertical;background-color:#0000;border:none;outline:none}textarea[data-v-0860d2f8]{field-sizing:content}
3.dialog-overlay[data-v-d7b7bd58]{z-index:1000;background:#00000080;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.dialog[data-v-d7b7bd58]{background:var(--b-color-bg);border:var(--b-border);border-radius:var(--b-radius);min-width:400px;max-width:90vw;max-height:90vh;box-shadow:var(--b-shadow);overflow:auto}.dialog-header[data-v-d7b7bd58]{padding:var(--b-gap-md);background:var(--b-color-bg-1);border-bottom:var(--b-border)}.dialog-title[data-v-d7b7bd58]{color:var(--brikke-text-color);margin:0;font-size:19px;font-weight:600}.dialog-content[data-v-d7b7bd58]{gap:var(--b-gap-md);padding:var(--b-gap-md);flex-direction:column;display:flex}.dialog-prompt[data-v-d7b7bd58]{color:var(--brikke-text-color);margin:0;font-weight:500}.dialog-actions[data-v-d7b7bd58]{gap:var(--b-gap-sm);padding:var(--b-gap-md);background:var(--b-color-bg-1);border-top:var(--b-border);justify-content:flex-end;display:flex}.primary-button[data-v-d7b7bd58]{color:#fff;background:var(--b-color-primary)}.primary-button[data-v-d7b7bd
358]:hover{background:#2a4199}.primary-button[data-v-d7b7bd58]:focus-visible{box-shadow:inset 0 0 0 3px #3451b24d}@media (width<=768px){.dialog[data-v-d7b7bd58]{min-width:90vw;margin:var(--b-gap-md)}.dialog-actions[data-v-d7b7bd58]{flex-direction:column-reverse}.dialog-actions button[data-v-d7b7bd58]{width:100%}}.block-editor-wrapper[data-v-7cd2d3dd]{flex-direction:column;width:100%;min-height:360px;display:flex;position:relative}.block-editor[data-v-7cd2d3dd]{flex-direction:column;flex:1;width:100%;min-height:360px;display:flex;position:relative}.workspace-controls[data-v-7cd2d3dd]{z-index:10;flex-direction:column;align-items:center;gap:4px;display:flex;position:absolute;top:24px;right:24px}.workspace-btn{&[data-v-7cd2d3dd]{color:#5b5ea6;cursor:pointer;border:1px solid var(--brikke-border,#0003);opacity:.8;background:#fff;border-radius:4px;justify-content:center;align-items:center;width:32px;height:32px;display:flex}&[data-v-7cd2d3dd]:hover{opacity:1;background:#f4f4f4}}.zoom-controls[data-v-7cd2d3dd]{flex-direction:column;align-items:center;gap:4px;display:flex}.zoom-label[data-v-7cd2d3dd]{box-sizing:border-box;color:#666;text-align:center;user-select:none;opacity:.8;background:#fff;border-radius:4px;width:32px;padding:2px 0;font-size:11px}.zoom-btn{&[data-v-7cd2d3dd]{box-sizing:border-box;cursor:pointer;border:1px solid var(--brikke-border,#0003);opacity:.8;background:#fff;border-radius:4px;justify-content:center;align-items:center;width:32px;height:32px;font-size:18px;line-height:1;display:flex}&[data-v-7cd2d3dd]:hover{opacity:1;background:#f4f4f4}}.block-editor[data-v-7cd2d3dd] .injectionDiv{flex:1;overflow:hidden}.block-editor[data-v-7cd2d3dd] .blocklyFlyoutScrollbar[display=none]{display:none!important}.console-drawer[data-v-fe14330b]{color:#f4f4f4;border-top:1px solid var(--brikke-border);background:#1e1f24;flex-direction:column;max-height:calc(36px + 15em);font-size:15px;transition:max-height .2s;display:flex}.console-drawer[data-v-fe14330b]:not(.open){max-height:36px}.console-toggle{&[data-v-fe14330b]{color:#f4f4f4;text-align:left;cursor:pointer;background:#1e1f24;border:none;align-items:center;gap:8px;height:36px;padding:6px 14px;font-size:15px;display:flex}&[data-v-fe14330b]:focus-visible{outline-offset:-3px;outline:3px solid #f4f4f4}}.console-body[data-v-fe14330b]{scrollbar-color:#555 #1e1f24;flex:1;min-height:0;padding:6px 12px 8px;overflow-y:auto}.error[data-v-fe14330b]{color:#ff6b6b}.canvas-panel[data-v-b152e6e4]{background:#fff;flex-direction:column;flex:none;max-height:36px;transition:max-height .25s;display:flex;overflow:hidden}.canvas-panel.open[data-v-b152e6e4]{flex:auto;min-height:280px;max-height:800px}.canvas-toggle{&[data-v-b152e6e4]{color:#1e1f24;text-align:left;cursor:pointer;border:none;border-bottom:1px solid var(--brikke-border);background:#f4f4f4;flex-shrink:0;align-items:center;gap:8px;height:36px;padding:6px 14px;font-size:15px;display:flex}&[data-v-b152e6e4]:focus-visible{outline-offset:-3px;outline:3px solid #1e1f24}}.turtle-canvas-wrap[data-v-b152e6e4]{background:#fff;flex:1;min-height:0;position:relative}.zoom-controls[data-v-b152e6e4]{flex-direction:column;align-items:center;gap:4px;display:flex;position:absolute;top:24px;right:24px}.zoom-label[data-v-b152e6e4]{box-sizing:border-box;color:#666;text-align:center;user-select:none;opacity:.8;background:#fff;border-radius:4px;width:32px;padding:2px 0;font-size:11px}.zoom-btn{&[data-v-b152e6e4]{cursor:pointer;border:1px solid var(--brikke-border);opacity:.8;background:#fff;border-radius:4px;justify-content:center;align-items:center;width:32px;height:32px;font-size:18px;line-height:1;display:flex}&[data-v-b152e6e4]:hover{opacity:1;background:#f4f4f4}&[data-v-b152e6e4]:focus-visible{outline-offset:2px;opacity:1;outline:3px solid #1e1f24}}canvas[data-v-b152e6e4]{width:100%;height:100%;display:block}.turtle-output[data-v-b08223f0]{flex-direction:column;width:100%;display:flex;position:relative}.text-output[data-v-b08223f0]{padding:15px}.text-output pre[data-v-b08223f0]{white-space:pre-wrap}.result-header[data-v-b08223f0]{color:var(--brikke-text-color);margin-top:0;font-size:20px;font-weight:400;line-height:26px}.tabs[data-v-4b94e096]{border-bottom:1px solid var(--brikke-border);gap:8px;width:100%;margin:0;padding:0;display:flex}.tab-wrapper[data-v-4b94e096]{list-style:none}.tab{&[data-v-4b94e096]{cursor:pointer;background:0 0;border:none;border-radius:0;padding:4px 8px;font-size:16px}&[data-v-4b94e096]:hover{background:#b9bbc6}&[data-v-4b94e096]:focus-visible{outline-offset:-3px;outline:3px solid #1e1f24}}.selected-tab[data-v-4b94e096]{box-shadow:inset 0 -2px #1e1f24}.code-editor-wrapper[data-v-4b94e096]{font-family:var(--brikke-font-family);border:1px solid var(--brikke-border);background:#fff;border-radius:4px;font-size:16px}.header-wrapper[data-v-4b94e096]{border-bottom:1px solid var(--brikke-border);justify-content:space-between;align-items:center;padding:12px;display:flex}.header-button-wrapper[data-v-4b94e096]{align-items:center;gap:12px;display:flex}.header[data-v-4b94e096]{color:var(--brikke-text-color);margin:0;font-size:20px;font-style:normal;font-weight:600;line-height:26px}.result-header[data-v-4b94e096]{color:var(--brikke-text-color);margin-top:0;font-size:20px;font-style:normal;font-weight:400;line-height:26px}.code-and-result[data-v-4b94e096]{display:flex}.code-and-result:not(.code-and-result-below) .code-wrapper[data-v-4b94e096]{border-right:1px solid var(--brikke-border);width:50%}.code-and-result:not(.code-and-result-below) .result-wrapper[data-v-4b94e096]{width:50%}.code-and-result .code-and-result-below .result-wrapper[data-v-4b94e096]{width:100%}.result-wrapper[data-v-4b94e096]{overflow-x:auto}.code-and-result.code-and-result-below .code-wrapper[data-v-4b94e096]{border-bottom:1px solid var(--brikke-border);width:100%}.code-and-result-below[data-v-4b94e096]{flex-direction:column}.output[data-v-4b94e096]{padding:15px}.dark-mode{&[data-v-4b94e096]{filter:invert()}&[data-v-4b94e096] .cm-activeLine,&[data-v-4b94e096] .cm-activeLineGutter{background-color:#ccc}}@media (width<=768px){.hide-mobile[data-v-4b94e096]{display:none}}@media (width>=768px){.hide-desktop[data-v-4b94e096]{display:none}}.mode-toggle{&[data-v-4b94e096]{display:inline-flex}&[data-v-4b94e096] .button{border:none;border-radius:0;position:relative}&[data-v-4b94e096] .button:focus-visible{z-index:1}&[data-v-4b94e096] .button:first-child{border-radius:8px 0 0 8px}&[data-v-4b94e096] .button:last-child{border-radius:0 8px 8px 0}}.settings-container[data-v-4b94e096]{position:relative}.settings-panel[data-v-4b94e096]{z-index:100;border:1px solid var(--brikke-border);background:#fff;border-radius:8px;flex-direction:column;gap:14px;min-width:230px;padding:12px 16px;display:flex;position:absolute;top:calc(100% + 8px);right:0;box-shadow:0 4px 16px #0000001f}.settings-row[data-v-4b94e096]{flex-direction:column;gap:6px;display:flex}.settings-label[data-v-4b94e096]{color:#888;text-transform:uppercase;letter-spacing:.05em;font-size:11px;font-weight:600}.settings-btn-group[data-v-4b94e096]{display:inline-flex}.settings-btn{&[data-v-4b94e096]{color:var(--brikke-text-color);cursor:pointer;background:#efefef;border:none;border-radius:0;padding:4px 10px;font-size:13px;font-weight:500}&[data-v-4b94e096]:first-child{border-radius:6px 0 0 6px}&[data-v-4b94e096]:last-child{border-radius:0 6px 6px 0}&[data-v-4b94e096]:focus-visible{z-index:1;outline-offset:-3px;outline:3px solid #1e1f24;position:relative}&.selected[data-v-4b94e096]{background:#b9bbc6}}.settings-keyboard-nav[data-v-4b94e096]{border-top:1px solid var(--brikke-border);flex-direction:column;gap:6px;padding-top:14px;display:flex}.keyboard-hints{&[data-v-4b94e096]{border-collapse:collapse;border:none;width:100%;font-size:12px}& td[data-v-4b94e096],& th[data-v-4b94e096]{border:none}& td{&[data-v-4b94e096]{vertical-align:middle;padding:2px 0}&[data-v-4b94e096]:first-child{white-space:nowrap;padding-right:10px}}& kbd[data-v-4b94e096]{background:#efefef;border:1px solid #ccc;border-radius:4px;padding:1px 5px;font-family:inherit;font-size:11px;display:inline-block}}.readonly-banner[data-v-4b94e096]{color:#555;border-bottom:1px solid var(--brikke-border);background:#f0f0f2;align-items:center;gap:6px;padding:6px 12px;font-size:13px;display:flex}.editor-readonly{&[data-v-4b94e096] .cm-editor{background:#f5f5f7}&[data-v-4b94e096] .cm-gutters{background:#ebebed}}[data-v-4b94e096] pre{padding:var(--b-gap-md);background-color:var(--b-color-bg-1);border-radius:var(--b-radius)}[data-v-4b94e096] code:not(pre code){padding:var(--b-gap-xs);background-color:var(--b-color-bg-1);border-radius:var(--b-radius)}\n/*$vite$:1*/",uP={CodeEditor:lP};function hP(e,{env:t,component:i,props:n}){let o=uP[i];if(!o)throw Error(`Ukjent komponent: ${i}`);let r=e.shadowRoot??e.attachShadow({mode:"open"}),s=document.createElement("style");s.textContent=[os,es,cP].join("\n"),r.appendChild(s);let a=()=>{},l=document.createElement("div");r.appendChild(l);let c=document.createElement("div");r.appendChild(c);let u=Zr({render:()=>rr(o,{...n,env:t})});return u.provide("brikkeShadowRoot",r),u.provide("brikkeTeleportTarget",c),u.mount(l),()=>{a(),u.unmount(),r.innerHTML=""}}export{hP as mount}; 4//# debugId=22dc12e5-75b4-58e8-b797-f95423e8d701
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.