@openmrs/esm-form-builder-app 3.5.2-pre.3904 → 3.5.2-pre.3908

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/8998.js CHANGED
@@ -1,8 +1,8 @@
1
- (globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["8998"],{97136(e,t,n){"use strict";n.d(t,{aZ:()=>l});var i,r,o=n(47499),s=n.n(o),a=n(51154);let l=s().forwardRef(function({children:e,size:t=16,...n},o){return s().createElement(a.A,{width:t,height:t,ref:o,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},i||(i=s().createElement("path",{d:"M16,18a5,5,0,1,1,5-5A5.0057,5.0057,0,0,1,16,18Zm0-8a3,3,0,1,0,3,3A3.0033,3.0033,0,0,0,16,10Z"})),r||(r=s().createElement("path",{d:"M16,30,7.5645,20.0513c-.0479-.0571-.3482-.4515-.3482-.4515A10.8888,10.8888,0,0,1,5,13a11,11,0,0,1,22,0,10.8844,10.8844,0,0,1-2.2148,6.5973l-.0015.0025s-.3.3944-.3447.4474ZM8.8125,18.395c.001.0007.2334.3082.2866.3744L16,26.9079l6.91-8.15c.0439-.0552.2783-.3649.2788-.3657A8.901,8.901,0,0,0,25,13,9,9,0,1,0,7,13a8.9054,8.9054,0,0,0,1.8125,5.395Z"})),e)})},32749(e,t,n){"use strict";n.r(t),n.d(t,{createAttachment:()=>a,fetchClobData:()=>g,fetchOpenMRSForm:()=>f,getAllLocations:()=>u,getConcept:()=>l,getLatestObs:()=>h,getLatestObsForConceptSet:()=>p,getLocationsByTag:()=>c,getPatientEnrolledPrograms:()=>m,getPreviousEncounter:()=>d,markPatientAsDeceased:()=>w,saveEncounter:()=>s,savePatientIdentifier:()=>b,savePersonAttribute:()=>y,saveProgramEnrollment:()=>v});var i=n(23365),r=n(9495),o=n(6232);function s(e,t,n){let o=n?`${i.restBaseUrl}/encounter/${n}?v=${r.RZ}`:`${i.restBaseUrl}/encounter?v=${r.RZ}`;return(0,i.openmrsFetch)(o,{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}async function a(e,t,n){let r=new FormData;return r.append("fileCaption",n.fileDescription),r.append("patient",e),n.file?r.append("file",n.file,n.fileName):(r.append("file",new File([""],n.fileName),n.fileName),r.append("base64Content",n.base64Content)),r.append("encounter",t),r.append("formFieldNamespace",n.formFieldNamespace),r.append("formFieldPath",n.formFieldPath),(0,i.openmrsFetch)(`${i.attachmentUrl}`,{method:"POST",body:r})}function l(e,t){return(0,i.openmrsFetch)(`${i.restBaseUrl}/concept/${e}?v=${t}`).then(({data:e})=>e.results)}function c(e){return(0,i.openmrsFetch)(`${i.restBaseUrl}/location?tag=${e}&v=custom:(uuid,display)`).then(({data:e})=>e.results)}function u(){return(0,i.openmrsFetch)(`${i.restBaseUrl}/location?v=custom:(uuid,display)`).then(({data:e})=>e.results)}async function d(e,t){let n=`patient=${e}&_sort=-date&_count=1&type=${t}`,o=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Encounter?${n}`);if(o?.data?.entry?.length){let e=o.data.entry[0].resource.id;return(o=await (0,i.openmrsFetch)(`${i.restBaseUrl}/encounter/${e}?v=${r.RZ}`)).data}return null}async function h(e,t,n){let r=`patient=${e}&code=${t}${n?`&encounter.type=${n}`:""}`;r+="&_sort=-date&_count=1";let{data:o}=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Observation?${r}`);return o.entry?.length?o.entry[0].resource:null}async function p(e,t,n){let r=await h(e,t,n);if(!r)return[];let o=r.encounter?.reference?.split("/").pop();if(!o)return[r];let s=`patient=${e}&code=${t}&encounter=${o}`,{data:a}=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Observation?${s}`);return a.entry?.map(e=>e.resource)??[]}async function f(e){if(!e)return null;let{url:t,isUUID:n}=(0,o.O)(e)?{url:`${i.restBaseUrl}/form/${e}?v=full`,isUUID:!0}:{url:`${i.restBaseUrl}/form?q=${e}&v=full`,isUUID:!1},{data:r}=await (0,i.openmrsFetch)(t);if(n)return r;if(r.results?.length){let e=r.results.find(e=>!1===e.retired);if(e)return e}throw Error(`Form with ID "${e}" was not found`)}async function g(e){if(!e)return null;let t=e.resources?.find(({name:e})=>"JSON schema"===e);if(!t)return null;let n=`${i.restBaseUrl}/clobdata/${t.valueReference}`,{data:r}=await (0,i.openmrsFetch)(n);return r}function m(e){return(0,i.openmrsFetch)(`${i.restBaseUrl}/programenrollment?patient=${e}&v=custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(state:(uuid,name,concept:(uuid),programWorkflow:(uuid)))`).then(({data:e})=>e||null)}function v(e,t){if(!e)throw Error("Program enrollment cannot be created because no payload is supplied");let n=e.uuid?`${i.restBaseUrl}/programenrollment/${e.uuid}`:`${i.restBaseUrl}/programenrollment`;return(0,i.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:e,signal:t.signal})}function b(e,t){let n;return n=e.uuid?`${i.restBaseUrl}/patient/${t}/identifier/${e.uuid}`:`${i.restBaseUrl}/patient/${t}/identifier`,(0,i.openmrsFetch)(n,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)})}function y(e,t){let n;return n=e.uuid?`${i.restBaseUrl}/person/${t}/attribute/${e.uuid}`:`${i.restBaseUrl}/person/${t}/attribute`,(0,i.openmrsFetch)(n,{headers:{"Content-Type":"application/json"},method:"POST",body:e})}function w(e,t,n,r){if(!n)throw Error(e("patientCannotBeMarkedAsDeceasedBecauseNoPayloadSupplied","Patient cannot be marked as deceased because no payload is supplied"));let o=`${i.restBaseUrl}/person/${t}`;return(0,i.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:n,signal:r.signal})}},9495(e,t,n){"use strict";n.d(t,{FU:()=>a,Mi:()=>r,RA:()=>s,RZ:()=>o,ZA:()=>l,t$:()=>i});let i="cf82933b-3f3f-45e7-a5ab-5d31aaee3da3",r="488b58ff-64f5-4f8a-8979-fa79940b1594",o="custom:(uuid,encounterDatetime,encounterType:(uuid,name,description),location:(uuid,name),patient:(uuid,display),encounterProviders:(uuid,provider:(uuid,name),encounterRole:(uuid,name)),orders:(uuid,display,concept:(uuid,display),voided),diagnoses:(uuid,certainty,condition,formFieldPath,formFieldNamespace,display,rank,voided,diagnosis:(coded:(uuid,display))),obs:(uuid,obsDatetime,comment,voided,groupMembers,formFieldNamespace,formFieldPath,concept:(uuid,name:(uuid,name)),value:(uuid,name:(uuid,name),names:(uuid,conceptNameType,name))))",s="forms-engine-store",a=["radio","checkbox","select","content-switcher"],l="OPTION_NULL"},45278(e,t,n){"use strict";n.d(t,{L:()=>i});let i="@openmrs/esm-form-engine-app"},22958(e,t,n){"use strict";function i(e,t,n){if(!e)return t;let s=JSON.parse(JSON.stringify(t));return s.defaultPage=s.availableIntents?.find(t=>t.intent===(e?.intent||e))?.defaultPage,s.markdown&&o(s.markdown,e),s.pages=s.pages||[],s.pages.forEach(t=>{if(t.isSubform&&t.subform?.form){let n=[],r=t.subform.behaviours?.find(t=>t.intent==e?.intent||e);(r?.readonly!==void 0||r?.readonly!=null)&&n.push({name:"readonly",type:"field",value:r?.readonly}),t.subform.form=i(r?.subform_intent||"*",t.subform?.form,n)}let s=t.behaviours?.find(t=>t.intent===(e?.intent||e));if(s)t.hide=s.hide??t.hide,t.readonly=s.readonly??t.readonly;else{let e=t.behaviours?.find(e=>"*"===e.intent);e&&(t.hide=e.hide??t.hide,t.readonly=e.readonly??t.readonly)}t.markdown&&o(t.markdown,e),t.sections=t.sections||[],t.sections.forEach(t=>{let i=t.behaviours?.find(t=>t.intent===e?.intent||e);if(i)t.hide=i.hide??t.hide;else{let e=t.behaviours?.find(e=>"*"===e.intent);t.hide=e?.hide??t.hide}t.markdown&&o(t.markdown,e),t.questions=t.questions||[],t.questions.forEach(t=>{t.behaviours&&(r(t,e?.intent||e),n?.filter(e=>"all"==e.type||"field"==e.type)?.forEach(e=>{t[e.name]=e.value})),t.questions&&t.questions.length&&t.questions.forEach(t=>{r(t,e?.intent||e),n?.filter(e=>"all"==e.type||"field"==e.type)?.forEach(e=>{t[e.name]=e.value})})})})}),s}function r(e,t){let n=e.behaviours?.find(e=>e.intent===t),i=e.behaviours?.find(e=>"*"===e.intent);if(n||i){delete n?.intent,delete i?.intent;let t=Object.assign(i||{},n||{}),r=t.defaultValue;void 0!=r&&(e.questionOptions.defaultValue=r,delete t.defaultValue),e=Object.assign(e,t),delete e.behaviours}}function o(e,t){let n=e.behaviours?.find(e=>e.intent===t),i=e.behaviours?.find(e=>"*"===e.intent);n&&i?(delete n.intent,delete i.intent,e=Object.assign(e,Object.assign(i,n)),delete e.behaviours):!n&&i&&(delete i.intent,e=Object.assign(e,i),delete e.behaviours)}n.d(t,{y6:()=>oZ,Im:()=>e6,Tn:()=>aU}),n(99589);var s,a=n(23365),l=n(9495),c=n(47499),u=n.n(c),d=n(46942),h=n.n(d);let p={flexColumn:"-esm-form-builder__obs-group__flexColumn___oca-0",flexFullWidth:"-esm-form-builder__obs-group__flexFullWidth___eogPE",groupContainer:"-esm-form-builder__obs-group__groupContainer___mfwmG",boldLegend:"-esm-form-builder__obs-group__boldLegend___CY7xw"};var f=n(58646),g=n(14968),m=e=>"checkbox"===e.type,v=e=>e instanceof Date,b=e=>null==e;let y=e=>"object"==typeof e;var w=e=>!b(e)&&!Array.isArray(e)&&y(e)&&!v(e),x=e=>w(e)&&e.target?m(e.target)?e.target.checked:e.target.value:e,$=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,_=(e,t)=>e.has($(t)),S=e=>{let t=e.constructor&&e.constructor.prototype;return w(t)&&t.hasOwnProperty("isPrototypeOf")},M="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function C(e){let t,n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(M&&(e instanceof Blob||e instanceof FileList))&&(n||w(e))))return e;else if(t=n?[]:{},n||S(e))for(let n in e)e.hasOwnProperty(n)&&(t[n]=C(e[n]));else t=e;return t}var E=e=>Array.isArray(e)?e.filter(Boolean):[],k=e=>void 0===e,A=(e,t,n)=>{if(!t||!w(e))return n;let i=E(t.split(/[,[\].]+?/)).reduce((e,t)=>b(e)?e:e[t],e);return k(i)||i===e?k(e[t])?n:e[t]:i},T=e=>"boolean"==typeof e,L=e=>/^\w*$/.test(e),O=e=>E(e.replace(/["|']|\]/g,"").split(/\.|\[/)),R=(e,t,n)=>{let i=-1,r=L(t)?[t]:O(t),o=r.length,s=o-1;for(;++i<o;){let t=r[i],o=n;if(i!==s){let n=e[t];o=w(n)||Array.isArray(n)?n:isNaN(+r[i+1])?{}:[]}if("__proto__"===t)return;e[t]=o,e=e[t]}return e};let D="blur",I="focusout",j="change",N="onBlur",P="onChange",F="onSubmit",U="onTouched",V="all",z="max",H="min",W="maxLength",B="minLength",q="pattern",G="required",K="validate",Y=u().createContext(null),Q=()=>u().useContext(Y);var Z=(e,t,n,i=!0)=>{let r={defaultValues:t._defaultValues};for(let o in e)Object.defineProperty(r,o,{get:()=>{let r=o;return t._proxyFormState[r]!==V&&(t._proxyFormState[r]=!i||V),n&&(n[r]=!0),e[r]}});return r},J=e=>w(e)&&!Object.keys(e).length,X=(e,t,n,i)=>{n(e);let{name:r,...o}=e;return J(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!i||V))},ee=e=>Array.isArray(e)?e:[e],et=(e,t,n)=>!e||!t||e===t||ee(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e)));function en(e){let t=u().useRef(e);t.current=e,u().useEffect(()=>{let n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function ei(e){let t=Q(),{control:n=t.control,disabled:i,name:r,exact:o}=e||{},[s,a]=u().useState(n._formState),l=u().useRef(!0),c=u().useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=u().useRef(r);return d.current=r,en({disabled:i,next:e=>l.current&&et(d.current,e.name,o)&&X(e,c.current,n._updateFormState)&&a({...n._formState,...e}),subject:n._subjects.state}),u().useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Z(s,n,c.current,!1)}var er=e=>"string"==typeof e,eo=(e,t,n,i,r)=>er(e)?(i&&t.watch.add(e),A(n,e,r)):Array.isArray(e)?e.map(e=>(i&&t.watch.add(e),A(n,e))):(i&&(t.watchAll=!0),n);function es(e){let t=Q(),{control:n=t.control,name:i,defaultValue:r,disabled:o,exact:s}=e||{},a=u().useRef(i);a.current=i,en({disabled:o,subject:n._subjects.values,next:e=>{et(a.current,e.name,s)&&c(C(eo(a.current,n._names,e.values||n._formValues,!1,r)))}});let[l,c]=u().useState(n._getWatch(i,r));return u().useEffect(()=>n._removeUnmounted()),l}function ea(e){let t=Q(),{name:n,disabled:i,control:r=t.control,shouldUnregister:o}=e,s=_(r._names.array,n),a=es({control:r,name:n,defaultValue:A(r._formValues,n,A(r._defaultValues,n,e.defaultValue)),exact:!0}),l=ei({control:r,name:n,exact:!0}),c=u().useRef(r.register(n,{...e.rules,value:a,...T(e.disabled)?{disabled:e.disabled}:{}}));return u().useEffect(()=>{let e=r._options.shouldUnregister||o,t=(e,t)=>{let n=A(r._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=C(A(r._options.defaultValues,n));R(r._defaultValues,n,e),k(A(r._formValues,n))&&R(r._formValues,n,e)}return()=>{(s?e&&!r._state.action:e)?r.unregister(n):t(n,!1)}},[n,r,s,o]),u().useEffect(()=>{A(r._fields,n)&&r._updateDisabledField({disabled:i,fields:r._fields,name:n,value:A(r._fields,n)._f.value})},[i,n,r]),{field:{name:n,value:a,...T(i)||l.disabled?{disabled:l.disabled||i}:{},onChange:u().useCallback(e=>c.current.onChange({target:{value:x(e),name:n},type:j}),[n]),onBlur:u().useCallback(()=>c.current.onBlur({target:{value:A(r._formValues,n),name:n},type:D}),[n,r]),ref:u().useCallback(e=>{let t=A(r._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[r._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!A(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!A(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!A(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!A(l.validatingFields,n)},error:{enumerable:!0,get:()=>A(l.errors,n)}})}}let el=e=>e.render(ea(e));var ec=(e,t,n,i,r)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[i]:r||!0}}:{},eu=e=>({isOnSubmit:!e||e===F,isOnBlur:e===N,isOnChange:e===P,isOnAll:e===V,isOnTouch:e===U}),ed=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let eh=(e,t,n,i)=>{for(let r of n||Object.keys(e)){let n=A(e,r);if(n){let{_f:e,...o}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],r)&&!i)return!0;else if(e.ref&&t(e.ref,e.name)&&!i)return!0;else if(eh(o,t))break}else if(w(o)&&eh(o,t))break}}};var ep=(e,t,n)=>{let i=ee(A(e,n));return R(i,"root",t[n]),R(e,n,i),e},ef=e=>"file"===e.type,eg=e=>"function"==typeof e,em=e=>{if(!M)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ev=e=>er(e),eb=e=>"radio"===e.type,ey=e=>e instanceof RegExp;let ew={value:!1,isValid:!1},ex={value:!0,isValid:!0};var e$=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!k(e[0].attributes.value)?k(e[0].value)||""===e[0].value?ex:{value:e[0].value,isValid:!0}:ex:ew}return ew};let e_={isValid:!1,value:null};var eS=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,e_):e_;function eM(e,t,n="validate"){if(ev(e)||Array.isArray(e)&&e.every(ev)||T(e)&&!e)return{type:n,message:ev(e)?e:"",ref:t}}var eC=e=>w(e)&&!ey(e)?e:{value:e,message:""},eE=async(e,t,n,i,r)=>{let{ref:o,refs:s,required:a,maxLength:l,minLength:c,min:u,max:d,pattern:h,validate:p,name:f,valueAsNumber:g,mount:v,disabled:y}=e._f,x=A(t,f);if(!v||y)return{};let $=s?s[0]:o,_=e=>{i&&$.reportValidity&&($.setCustomValidity(T(e)?"":e||""),$.reportValidity())},S={},M=eb(o),C=m(o),E=M||C,L=(g||ef(o))&&k(o.value)&&k(x)||em(o)&&""===o.value||""===x||Array.isArray(x)&&!x.length,O=ec.bind(null,f,n,S),R=(e,t,n,i=W,r=B)=>{let s=e?t:n;S[f]={type:e?i:r,message:s,ref:o,...O(e?i:r,s)}};if(r?!Array.isArray(x)||!x.length:a&&(!E&&(L||b(x))||T(x)&&!x||C&&!e$(s).isValid||M&&!eS(s).isValid)){let{value:e,message:t}=ev(a)?{value:!!a,message:a}:eC(a);if(e&&(S[f]={type:G,message:t,ref:$,...O(G,t)},!n))return _(t),S}if(!L&&(!b(u)||!b(d))){let e,t,i=eC(d),r=eC(u);if(b(x)||isNaN(x)){let n=o.valueAsDate||new Date(x),s=e=>new Date(new Date().toDateString()+" "+e),a="time"==o.type,l="week"==o.type;er(i.value)&&x&&(e=a?s(x)>s(i.value):l?x>i.value:n>new Date(i.value)),er(r.value)&&x&&(t=a?s(x)<s(r.value):l?x<r.value:n<new Date(r.value))}else{let n=o.valueAsNumber||(x?+x:x);b(i.value)||(e=n>i.value),b(r.value)||(t=n<r.value)}if((e||t)&&(R(!!e,i.message,r.message,z,H),!n))return _(S[f].message),S}if((l||c)&&!L&&(er(x)||r&&Array.isArray(x))){let e=eC(l),t=eC(c),i=!b(e.value)&&x.length>+e.value,r=!b(t.value)&&x.length<+t.value;if((i||r)&&(R(i,e.message,t.message),!n))return _(S[f].message),S}if(h&&!L&&er(x)){let{value:e,message:t}=eC(h);if(ey(e)&&!x.match(e)&&(S[f]={type:q,message:t,ref:o,...O(q,t)},!n))return _(t),S}if(p){if(eg(p)){let e=eM(await p(x,t),$);if(e&&(S[f]={...e,...O(K,e.message)},!n))return _(e.message),S}else if(w(p)){let e={};for(let i in p){if(!J(e)&&!n)break;let r=eM(await p[i](x,t),$,i);r&&(e={...r,...O(i,r.message)},_(r.message),n&&(S[f]=e))}if(!J(e)&&(S[f]={ref:$,...e},!n))return S}}return _(!0),S};function ek(e,t){let n=t.slice(0,-1).length,i=0;for(;i<n;)e=k(e)?i++:e[t[i++]];return e}function eA(e){for(let t in e)if(e.hasOwnProperty(t)&&!k(e[t]))return!1;return!0}function eT(e,t){let n=Array.isArray(t)?t:L(t)?[t]:O(t),i=1===n.length?e:ek(e,n),r=n.length-1,o=n[r];return i&&delete i[o],0!==r&&(w(i)&&J(i)||Array.isArray(i)&&eA(i))&&eT(e,n.slice(0,-1)),e}var eL=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},eO=e=>b(e)||!y(e);function eR(e,t){if(eO(e)||eO(t))return e===t;if(v(e)&&v(t))return e.getTime()===t.getTime();let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r of n){let n=e[r];if(!i.includes(r))return!1;if("ref"!==r){let e=t[r];if(v(n)&&v(e)||w(n)&&w(e)||Array.isArray(n)&&Array.isArray(e)?!eR(n,e):n!==e)return!1}}return!0}var eD=e=>"select-multiple"===e.type,eI=e=>eb(e)||m(e),ej=e=>em(e)&&e.isConnected,eN=e=>{for(let t in e)if(eg(e[t]))return!0;return!1};function eP(e,t={}){let n=Array.isArray(e);if(w(e)||n)for(let n in e)Array.isArray(e[n])||w(e[n])&&!eN(e[n])?(t[n]=Array.isArray(e[n])?[]:{},eP(e[n],t[n])):b(e[n])||(t[n]=!0);return t}function eF(e,t,n){let i=Array.isArray(e);if(w(e)||i)for(let i in e)Array.isArray(e[i])||w(e[i])&&!eN(e[i])?k(t)||eO(n[i])?n[i]=Array.isArray(e[i])?eP(e[i],[]):{...eP(e[i])}:eF(e[i],b(t)?{}:t[i],n[i]):n[i]=!eR(e[i],t[i]);return n}var eU=(e,t)=>eF(e,t,eP(t)),eV=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:i})=>k(e)?e:t?""===e?NaN:e?+e:e:n&&er(e)?new Date(e):i?i(e):e;function ez(e){let t=e.ref;if(e.refs?!e.refs.every(e=>e.disabled):!t.disabled)return ef(t)?t.files:eb(t)?eS(e.refs).value:eD(t)?[...t.selectedOptions].map(({value:e})=>e):m(t)?e$(e.refs).value:eV(k(t.value)?e.ref.value:t.value,e)}var eH=(e,t,n,i)=>{let r={};for(let n of e){let e=A(t,n);e&&R(r,n,e._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:i}},eW=e=>k(e)?e:ey(e)?e.source:w(e)?ey(e.value)?e.value.source:e.value:e;let eB="AsyncFunction";var eq=e=>(!e||!e.validate)&&!!(eg(e.validate)&&e.validate.constructor.name===eB||w(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===eB)),eG=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eK(e,t,n){let i=A(e,n);if(i||L(n))return{error:i,name:n};let r=n.split(".");for(;r.length;){let i=r.join("."),o=A(t,i),s=A(e,i);if(o&&!Array.isArray(o)&&n!==i)break;if(s&&s.type)return{name:i,error:s};r.pop()}return{name:n}}var eY=(e,t,n,i,r)=>!r.isOnAll&&(!n&&r.isOnTouch?!(t||e):(n?i.isOnBlur:r.isOnBlur)?!e:(n?!i.isOnChange:!r.isOnChange)||e),eQ=(e,t)=>!E(A(e,t)).length&&eT(e,t);let eZ={mode:F,reValidateMode:P,shouldFocusError:!0};function eJ(e={}){let t,n={...eZ,...e},i={submitCount:0,isDirty:!1,isLoading:eg(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},r={},o=(w(n.defaultValues)||w(n.values))&&C(n.defaultValues||n.values)||{},s=n.shouldUnregister?{}:C(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:eL(),array:eL(),state:eL()},h=eu(n.mode),p=eu(n.reValidateMode),f=n.criteriaMode===V,g=e=>t=>{clearTimeout(c),c=setTimeout(e,t)},y=async t=>{if(!e.disabled&&(u.isValid||t)){let e=n.resolver?J((await F()).errors):await z(r,!0);e!==i.isValid&&d.state.next({isValid:e})}},$=(t,n)=>{!e.disabled&&(u.isValidating||u.validatingFields)&&((t||Array.from(l.mount)).forEach(e=>{e&&(n?R(i.validatingFields,e,n):eT(i.validatingFields,e))}),d.state.next({validatingFields:i.validatingFields,isValidating:!J(i.validatingFields)}))},S=(t,n=[],l,c,h=!0,p=!0)=>{if(c&&l&&!e.disabled){if(a.action=!0,p&&Array.isArray(A(r,t))){let e=l(A(r,t),c.argA,c.argB);h&&R(r,t,e)}if(p&&Array.isArray(A(i.errors,t))){let e=l(A(i.errors,t),c.argA,c.argB);h&&R(i.errors,t,e),eQ(i.errors,t)}if(u.touchedFields&&p&&Array.isArray(A(i.touchedFields,t))){let e=l(A(i.touchedFields,t),c.argA,c.argB);h&&R(i.touchedFields,t,e)}u.dirtyFields&&(i.dirtyFields=eU(o,s)),d.state.next({name:t,isDirty:W(t,n),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else R(s,t,n)},L=(e,t)=>{R(i.errors,e,t),d.state.next({errors:i.errors})},O=e=>{i.errors=e,d.state.next({errors:i.errors,isValid:!1})},j=(e,t,n,i)=>{let l=A(r,e);if(l){let r=A(s,e,k(n)?A(o,e):n);k(r)||i&&i.defaultChecked||t?R(s,e,t?r:ez(l._f)):q(e,r),a.mount&&y()}},N=(t,n,s,a,l)=>{let c=!1,h=!1,p={name:t};if(!e.disabled){let e=!!(A(r,t)&&A(r,t)._f&&A(r,t)._f.disabled);if(!s||a){u.isDirty&&(h=i.isDirty,i.isDirty=p.isDirty=W(),c=h!==p.isDirty);let r=e||eR(A(o,t),n);h=!!(!e&&A(i.dirtyFields,t)),r||e?eT(i.dirtyFields,t):R(i.dirtyFields,t,!0),p.dirtyFields=i.dirtyFields,c=c||u.dirtyFields&&!r!==h}if(s){let e=A(i.touchedFields,t);e||(R(i.touchedFields,t,s),p.touchedFields=i.touchedFields,c=c||u.touchedFields&&e!==s)}c&&l&&d.state.next(p)}return c?p:{}},P=(n,r,o,s)=>{let a=A(i.errors,n),l=u.isValid&&T(r)&&i.isValid!==r;if(e.delayError&&o?(t=g(()=>L(n,o)))(e.delayError):(clearTimeout(c),t=null,o?R(i.errors,n,o):eT(i.errors,n)),(o?!eR(a,o):a)||!J(s)||l){let e={...s,...l&&T(r)?{isValid:r}:{},errors:i.errors,name:n};i={...i,...e},d.state.next(e)}},F=async e=>{$(e,!0);let t=await n.resolver(s,n.context,eH(e||l.mount,r,n.criteriaMode,n.shouldUseNativeValidation));return $(e),t},U=async e=>{let{errors:t}=await F(e);if(e)for(let n of e){let e=A(t,n);e?R(i.errors,n,e):eT(i.errors,n)}else i.errors=t;return t},z=async(e,t,r={valid:!0})=>{for(let o in e){let a=e[o];if(a){let{_f:e,...c}=a;if(e){let c=l.array.has(e.name),d=a._f&&eq(a._f);d&&u.validatingFields&&$([o],!0);let h=await eE(a,s,f,n.shouldUseNativeValidation&&!t,c);if(d&&u.validatingFields&&$([o]),h[e.name]&&(r.valid=!1,t))break;t||(A(h,e.name)?c?ep(i.errors,h,e.name):R(i.errors,e.name,h[e.name]):eT(i.errors,e.name))}J(c)||await z(c,t,r)}}return r.valid},H=()=>{for(let e of l.unMount){let t=A(r,e);t&&(t._f.refs?t._f.refs.every(e=>!ej(e)):!ej(t._f.ref))&&ea(e)}l.unMount=new Set},W=(t,n)=>!e.disabled&&(t&&n&&R(s,t,n),!eR(X(),o)),B=(e,t,n)=>eo(e,l,{...a.mount?s:k(t)?o:er(e)?{[e]:t}:t},n,t),q=(e,t,n={})=>{let i=A(r,e),o=t;if(i){let n=i._f;n&&(n.disabled||R(s,e,eV(t,n)),o=em(n.ref)&&b(t)?"":t,eD(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?m(n.ref)?n.refs.length>1?n.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value)):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach(e=>e.checked=e.value===o):ef(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||d.values.next({name:e,values:{...s}})))}(n.shouldDirty||n.shouldTouch)&&N(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&Z(e)},G=(e,t,n)=>{for(let i in t){let o=t[i],s=`${e}.${i}`,a=A(r,s);(l.array.has(e)||w(o)||a&&!a._f)&&!v(o)?G(s,o,n):q(s,o,n)}},K=(e,t,n={})=>{let c=A(r,e),h=l.array.has(e),p=C(t);R(s,e,p),h?(d.array.next({name:e,values:{...s}}),(u.isDirty||u.dirtyFields)&&n.shouldDirty&&d.state.next({name:e,dirtyFields:eU(o,s),isDirty:W(e,p)})):!c||c._f||b(p)?q(e,p,n):G(e,p,n),ed(e,l)&&d.state.next({...i}),d.values.next({name:a.mount?e:void 0,values:{...s}})},Y=async o=>{a.mount=!0;let c=o.target,g=c.name,m=!0,b=A(r,g),w=()=>c.type?ez(b._f):x(o),_=e=>{m=Number.isNaN(e)||v(e)&&isNaN(e.getTime())||eR(e,A(s,g,e))};if(b){let a,c,v=w(),x=o.type===D||o.type===I,S=!eG(b._f)&&!n.resolver&&!A(i.errors,g)&&!b._f.deps||eY(x,A(i.touchedFields,g),i.isSubmitted,p,h),M=ed(g,l,x);R(s,g,v),x?(b._f.onBlur&&b._f.onBlur(o),t&&t(0)):b._f.onChange&&b._f.onChange(o);let C=N(g,v,x,!1),E=!J(C)||M;if(x||d.values.next({name:g,type:o.type,values:{...s}}),S)return u.isValid&&("onBlur"===e.mode?x&&y():y()),E&&d.state.next({name:g,...M?{}:C});if(!x&&M&&d.state.next({...i}),n.resolver){let{errors:e}=await F([g]);if(_(v),m){let t=eK(i.errors,r,g),n=eK(e,r,t.name||g);a=n.error,g=n.name,c=J(e)}}else $([g],!0),a=(await eE(b,s,f,n.shouldUseNativeValidation))[g],$([g]),_(v),m&&(a?c=!1:u.isValid&&(c=await z(r,!0)));m&&(b._f.deps&&Z(b._f.deps),P(g,c,a,C))}},Q=(e,t)=>{if(A(i.errors,t)&&e.focus)return e.focus(),1},Z=async(e,t={})=>{let o,s,a=ee(e);if(n.resolver){let t=await U(k(e)?e:a);o=J(t),s=e?!a.some(e=>A(t,e)):o}else e?((s=(await Promise.all(a.map(async e=>{let t=A(r,e);return await z(t&&t._f?{[e]:t}:t)}))).every(Boolean))||i.isValid)&&y():s=o=await z(r);return d.state.next({...!er(e)||u.isValid&&o!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:i.errors}),t.shouldFocus&&!s&&eh(r,Q,e?a:l.mount),s},X=e=>{let t={...a.mount?s:o};return k(e)?t:er(e)?A(t,e):e.map(e=>A(t,e))},et=(e,t)=>({invalid:!!A((t||i).errors,e),isDirty:!!A((t||i).dirtyFields,e),error:A((t||i).errors,e),isValidating:!!A(i.validatingFields,e),isTouched:!!A((t||i).touchedFields,e)}),en=e=>{e&&ee(e).forEach(e=>eT(i.errors,e)),d.state.next({errors:e?i.errors:{}})},ei=(e,t,n)=>{let o=(A(r,e,{_f:{}})._f||{}).ref,{ref:s,message:a,type:l,...c}=A(i.errors,e)||{};R(i.errors,e,{...c,...t,ref:o}),d.state.next({name:e,errors:i.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},es=(e,t)=>eg(e)?d.values.subscribe({next:n=>e(B(void 0,t),n)}):B(e,t,!0),ea=(e,t={})=>{for(let a of e?ee(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(eT(r,a),eT(s,a)),t.keepError||eT(i.errors,a),t.keepDirty||eT(i.dirtyFields,a),t.keepTouched||eT(i.touchedFields,a),t.keepIsValidating||eT(i.validatingFields,a),n.shouldUnregister||t.keepDefaultValue||eT(o,a);d.values.next({values:{...s}}),d.state.next({...i,...!t.keepDirty?{}:{isDirty:W()}}),t.keepIsValid||y()},el=({disabled:e,name:t,field:n,fields:i,value:r})=>{if(T(e)&&a.mount||e){let o=e?void 0:k(r)?ez(n?n._f:A(i,t)._f):r;R(s,t,o),N(t,o,!1,!1,!0)}},ec=(t,i={})=>{let s=A(r,t),c=T(i.disabled)||T(e.disabled);return R(r,t,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:t}},name:t,mount:!0,...i}}),l.mount.add(t),s?el({field:s,disabled:T(i.disabled)?i.disabled:e.disabled,name:t,value:i.value}):j(t,!0,i.value),{...c?{disabled:i.disabled||e.disabled}:{},...n.progressive?{required:!!i.required,min:eW(i.min),max:eW(i.max),minLength:eW(i.minLength),maxLength:eW(i.maxLength),pattern:eW(i.pattern)}:{},name:t,onChange:Y,onBlur:Y,ref:e=>{if(e){ec(t,i),s=A(r,t);let n=k(e.value)&&e.querySelectorAll&&e.querySelectorAll("input,select,textarea")[0]||e,a=eI(n),l=s._f.refs||[];(a?l.find(e=>e===n):n===s._f.ref)||(R(r,t,{_f:{...s._f,...a?{refs:[...l.filter(ej),n,...Array.isArray(A(o,t))?[{}]:[]],ref:{type:n.type,name:t}}:{ref:n}}}),j(t,!1,void 0,n))}else(s=A(r,t,{}))._f&&(s._f.mount=!1),(n.shouldUnregister||i.shouldUnregister)&&!(_(l.array,t)&&a.action)&&l.unMount.add(t)}}},ev=()=>n.shouldFocusError&&eh(r,Q,l.mount),eb=(e,t)=>async o=>{let a;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=C(s);if(d.state.next({isSubmitting:!0}),n.resolver){let{errors:e,values:t}=await F();i.errors=e,l=t}else await z(r);if(eT(i.errors,"root"),J(i.errors)){d.state.next({errors:{}});try{await e(l,o)}catch(e){a=e}}else t&&await t({...i.errors},o),ev(),setTimeout(ev);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:J(i.errors)&&!a,submitCount:i.submitCount+1,errors:i.errors}),a)throw a},ey=(e,t={})=>{A(r,e)&&(k(t.defaultValue)?K(e,C(A(o,e))):(K(e,t.defaultValue),R(o,e,C(t.defaultValue))),t.keepTouched||eT(i.touchedFields,e),t.keepDirty||(eT(i.dirtyFields,e),i.isDirty=t.defaultValue?W(e,C(A(o,e))):W()),!t.keepError&&(eT(i.errors,e),u.isValid&&y()),d.state.next({...i}))},ew=(t,n={})=>{let c=t?C(t):o,h=C(c),p=J(t),f=p?o:h;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues)for(let e of Array.from(new Set([...l.mount,...Object.keys(eU(o,s))])))A(i.dirtyFields,e)?R(f,e,A(s,e)):K(e,A(f,e));else{if(M&&k(t))for(let e of l.mount){let t=A(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(em(e)){let t=e.closest("form");if(t){t.reset();break}}}}r={}}s=e.shouldUnregister?n.keepDefaultValues?C(o):{}:C(f),d.array.next({values:{...f}}),d.values.next({values:{...f}})}l={mount:n.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!u.isValid||!!n.keepIsValid||!!n.keepDirtyValues,a.watch=!!e.shouldUnregister,d.state.next({submitCount:n.keepSubmitCount?i.submitCount:0,isDirty:!p&&(n.keepDirty?i.isDirty:!!(n.keepDefaultValues&&!eR(t,o))),isSubmitted:!!n.keepIsSubmitted&&i.isSubmitted,dirtyFields:p?{}:n.keepDirtyValues?n.keepDefaultValues&&s?eU(o,s):i.dirtyFields:n.keepDefaultValues&&t?eU(o,t):n.keepDirty?i.dirtyFields:{},touchedFields:n.keepTouched?i.touchedFields:{},errors:n.keepErrors?i.errors:{},isSubmitSuccessful:!!n.keepIsSubmitSuccessful&&i.isSubmitSuccessful,isSubmitting:!1})},ex=(e,t)=>ew(eg(e)?e(s):e,t),e$=(e,t={})=>{let n=A(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}};return{control:{register:ec,unregister:ea,getFieldState:et,handleSubmit:eb,setError:ei,_executeSchema:F,_getWatch:B,_getDirty:W,_updateValid:y,_removeUnmounted:H,_updateFieldArray:S,_updateDisabledField:el,_getFieldArray:t=>E(A(a.mount?s:o,t,e.shouldUnregister?A(o,t,[]):[])),_reset:ew,_resetDefaultValues:()=>eg(n.defaultValues)&&n.defaultValues().then(e=>{ex(e,n.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:e=>{i={...i,...e}},_disableForm:e=>{T(e)&&(d.state.next({disabled:e}),eh(r,(t,n)=>{let i=A(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:d,_proxyFormState:u,_setErrors:O,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(value){a=value},get _defaultValues(){return o},get _names(){return l},set _names(value){l=value},get _formState(){return i},set _formState(value){i=value},get _options(){return n},set _options(value){n={...n,...value}}},trigger:Z,register:ec,handleSubmit:eb,watch:es,setValue:K,getValues:X,reset:ex,resetField:ey,clearErrors:en,unregister:ea,setError:ei,setFocus:e$,getFieldState:et}}function eX(e={}){let t=u().useRef(),n=u().useRef(),[i,r]=u().useState({isDirty:!1,isValidating:!1,isLoading:eg(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eg(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...eJ(e),formState:i});let o=t.current.control;return o._options=e,en({subject:o._subjects.state,next:e=>{X(e,o._proxyFormState,o._updateFormState,!0)&&r({...o._formState})}}),u().useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),u().useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),u().useEffect(()=>{e.values&&!eR(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,r(e=>({...e}))):o._resetDefaultValues()},[e.values,o]),u().useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),u().useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),u().useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),u().useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[i]),t.current.formState=Z(i,o),t.current}var e0=n(58779),e1=n(47665),e2=n(74353),e4=n.n(e2);let e3="field.required",e5="field.outOfBound",e9={validate:(e,t)=>{if(e.meta?.submission?.unspecified)return[];if(e6(t)&&e.isRequired){if("object"==typeof e.required&&"conditionalRequired"===e.required.type&&e.isRequired)return te(e3,e.required.message??"Field is mandatory");else if(e.isRequired)return te(e3,"Field is mandatory")}if("text"===e.questionOptions.rendering)return e7(e.questionOptions.minLength,e.questionOptions.maxLength,t?.length)??[];if("number"===e.questionOptions.rendering){let n=Number(e.questionOptions.min),i=Number(e.questionOptions.max),r=e.questionOptions.disallowDecimals||e.meta?.concept?.allowDecimal;if(e6(t))return[];if(r&&!Number.isInteger(t))return te(e5,"Decimal values are not allowed for this field");if(!Number.isNaN(n)||!Number.isNaN(i))return e8(n,i,t)}return[]}};function e8(e,t,n){return!Number.isNaN(e)&&n<e?te(e5,`Value must be greater than ${e}`):!Number.isNaN(t)&&n>t?te(e5,`Value must be lower than ${t}`):[]}function e6(e){return!!(null==e||""===e||"string"==typeof e&&!e?.trim()||Array.isArray(e)&&!e.length)}function e7(e,t,n){let i=Number(e),r=Number(t);if("number"==typeof n&&!Number.isNaN(n)){if(i&&r&&n>=i&&n<=r)return[];if(i&&n<i)return te(e5,`Length should be at least ${i} characters`);if(r&&n>r)return te(e5,`Length should not exceed ${r} characters`);if(r&&i&&n<i&&n>r)return te(e5,`Length should be between ${i} and ${r} characters`)}}function te(e,t){return[{resultType:"error",errCode:e,message:t}]}function tt(e){let t=[];function n(e){t.push(e),e.groupMembers?.length&&e.groupMembers.forEach(e=>{n(e)})}return e.forEach(e=>{n(e)}),t}function tn(e,t){return e.questionOptions.rendering===t}function ti(e){e.meta?.submission||(e.meta={...e.meta||{},submission:{}}),e.meta.submission={...e.meta.submission,voidedValue:null,newValue:null}}function tr(e,t,n){return e.meta?.submission||(e.meta={...e.meta||{},submission:{}}),e6(t)||(e.meta.submission.newValue=t),e6(n)||(e.meta.submission.voidedValue=n),e.meta.submission.newValue}function to(e){return!!e.meta.submission?.newValue||!!e.meta.submission?.voidedValue}function ts(e){return"view"===e||"embedded-view"===e}function ta(e){let t=e4()(e).toDate();if(isNaN(t.getTime()))return new Date(NaN);try{let n=e.split("T")[1];if(n){let e=n.split(":");t.setHours(parseInt(e[0]),parseInt(e[1]),0)}}catch(e){console.error(e)}return t}function tl(e,t){if(!t)return e;let n=t.startDatetime?new Date(t.startDatetime):null,i=t.stopDatetime?new Date(t.stopDatetime):null;return n&&e<n||i&&e>i?n??i:e}function tc(e,t){let n={noToday:!0};return"calendar"===e.datePickerFormat?n.time=!1:n.time=!0,(0,a.formatDate)(t,n)}function tu(e){return e.pages=e.pages.map(e=>(e.sections=Array.from(e.sections),e)),{...e}}function td(e,t=16){return e/t}var th=n(66401),tp=n(90445),tf=n.n(tp),tg=n(24713),tm=n.n(tg),tv=n(87612),tb=n.n(tv),ty=n(56170),tw=n.n(ty),tx=n(39754),t$=n.n(tx),t_=n(68090),tS=n.n(t_),tM=n(32749);let tC={wflFemaleBelow5:()=>n.e("6601").then(n.t.bind(n,6784,19)),wflMaleBelow5:()=>n.e("1989").then(n.t.bind(n,22596,19)),hfaFemaleBelow5:()=>n.e("7663").then(n.t.bind(n,34626,19)),hfaMaleBelow5:()=>n.e("7367").then(n.t.bind(n,6282,19)),hfaFemale5Above:()=>n.e("4364").then(n.t.bind(n,96855,19)),hfaMale5Above:()=>n.e("1668").then(n.t.bind(n,3791,19)),bfaFemale5Above:()=>n.e("7538").then(n.t.bind(n,79529,19)),bfaMale5Above:()=>n.e("902").then(n.t.bind(n,79189,19))},tE={calcWeightForHeightZscore:["wflFemaleBelow5","wflMaleBelow5"],calcHeightForAgeZscore:["hfaFemaleBelow5","hfaMaleBelow5","hfaFemale5Above","hfaMale5Above"],calcBMIForAgeZscore:["bfaFemale5Above","bfaMale5Above"]},tk=new Map;async function tA(e){let t=JSON.stringify(e??{}),n=Object.entries(tE).filter(([e])=>t.includes(e)).flatMap(([,e])=>e).filter(e=>!tk.has(e)),i=(await Promise.allSettled(n.map(async e=>{let t=await tC[e]();tk.set(e,t.default)}))).find(e=>"rejected"===e.status);if(i)throw i.reason}function tT(e){let t=tk.get(e);return t||console.warn(`Z-score calculation: the ${e} reference table hasn't been loaded`),t}function tL(e,t,n){let i=tI(t,n,"years");return"F"===e&&i<5?tT("wflFemaleBelow5"):"M"===e&&i<5?tT("wflMaleBelow5"):null}function tO(e,t,n){let i=tI(t,n,"years"),r=tI(t,n,"months"),o=tI(t,n,"days");if("F"===e){if(i<5)return tD(tT("hfaFemaleBelow5"),"Day",o);if(i>=5&&i<18)return tD(tT("hfaFemale5Above"),"Month",r)}if("M"===e){if(i<5)return tD(tT("hfaMaleBelow5"),"Day",o);if(i>=5&&i<18)return tD(tT("hfaMale5Above"),"Month",r)}return null}function tR(e,t,n){let i=tI(t,n,"years"),r=tI(t,n,"months");return"F"===e&&i>=5&&i<18?tD(tT("bfaFemale5Above"),"Month",r):"M"===e&&i>=5&&i<18?tD(tT("bfaMale5Above"),"Month",r):null}function tD(e,t,n){return tb()(e,e=>e[t]===n)}function tI(e,t,n){if(e&&t&&n){let i=e4()(t),r=e4()(e);return i.diff(r,n)}return null}function tj(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e4().extend(tf());class tN{constructor(e,t,n,i){tj(this,"node",null),tj(this,"patient",null),tj(this,"allFields",[]),tj(this,"allFieldValues",{}),tj(this,"api",tM),tj(this,"isEmpty",e6),tj(this,"dayjs",e4()),tj(this,"calculateZScoreFromRef",(e,t)=>{if(!e)return console.warn("Z-score calculation: No reference data object provided"),null;let n=Object.keys(e),i=n.map(t=>e[t]),r=i[1],o=[];t<r?o.push(r):t$()(i,e=>{e<=t&&o.push(e)});let s=tS()(o),a=n[tm()(i,e=>e===s)],l=a?.replace("SD","");return l?.includes("neg")&&(l="-"+l.substring(0,1)),("S"===l||"L"===l||"M"===l||"-5"===l)&&(l="-4"),l??null}),tj(this,"today",()=>new Date),tj(this,"includes",(e,t)=>e?.includes(t)),tj(this,"isDateBefore",(e,t,n)=>{let i=t instanceof Date?t:n?e4()(t,n,!0).toDate():e4()(t,"YYYY-MM-DD",!0).toDate();return e?.getTime()<i.getTime()}),tj(this,"isDateAfter",(e,t,n,i)=>{let r,o=e4()(t);switch(i){case"months":r=o.add(n,"month").toDate();break;case"weeks":r=o.add(n,"week").toDate();break;case"days":r=o.add(n,"day").toDate();break;case"years":r=o.add(n,"year").toDate();break;default:r=new Date(0)}return e.getTime()>=r.getTime()}),tj(this,"addWeeksToDate",(e,t)=>e4()(e).add(t,"week").toDate()),tj(this,"addDaysToDate",(e,t)=>e4()(e).add(t,"day").toDate()),tj(this,"isDateAfterSimple",(e,t,n)=>{let i=t instanceof Date?t:n?e4()(t,n,!0).toDate():e4()(t,"YYYY-MM-DD",!0).toDate();return e?.getTime()>i.getTime()}),tj(this,"useFieldValue",e=>{let t=this.allFields.find(t=>t.id===e);return t&&tF(this.node,t),this.allFieldValues[e]??null}),tj(this,"doesNotMatchExpression",(e,t)=>!!(!t||["undefined","null",""].includes(t.toString()))||!new RegExp(e).test(t)),tj(this,"calcBMI",(e,t)=>{if(!e||!t)return null;let n=e/100;return parseFloat((t/(n*n)).toFixed(1))}),tj(this,"calcEDD",e=>e?new Date(e.getTime()+24192e6):null),tj(this,"calcMonthsOnART",e=>{if(null==e)return null;if(!(e instanceof Date))throw Error("DateFormatException: value passed is not a valid date");let t=new Date;return 30>Math.round((t.getTime()-e.getTime())/864e5)?0:e4()(t).diff(e,"month")}),tj(this,"calcViralLoadStatus",e=>{let t;return e&&(t=e>50?"a6768be6-c08e-464d-8f53-5f4229508e54":"5d5e42cc-acc4-4069-b3a8-7163e0db5d96"),t??null}),tj(this,"calcNextVisitDate",(e,t)=>e&&t?new Date(e.getTime()+24*t*36e5):null),tj(this,"calcTreatmentEndDate",(e,t,n)=>{if(!e||!t||"160429AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"!==n)return null;let i=30+t;return new Date(e.getTime()+24*i*36e5)}),tj(this,"calcAgeBasedOnDate",e=>(e?new Date(e).getFullYear():new Date().getFullYear())-new Date(this.patient.birthDate).getFullYear()),tj(this,"calcBSA",(e,t)=>e&&t?parseFloat(Math.sqrt(e*t/3600).toFixed(2)):null),tj(this,"arrayContains",(e,t)=>{if(!e||!Array.isArray(e))return!1;if(0===e.length)return null==t||Array.isArray(t)&&0===t.length;if(Array.isArray(t)||(t=[t]),0===t.length)return!0;for(let n of t)if(-1===e.indexOf(n))return!1;return!0}),tj(this,"arrayContainsAny",(e,t)=>{if(!e||!Array.isArray(e))return!1;if(0===e.length)return null==t||Array.isArray(t)&&0===t.length;if(Array.isArray(t)||(t=[t]),0===t.length)return!0;for(let n of t)if(-1!==e.indexOf(n))return!0;return!1}),tj(this,"parseDate",e=>(0,a.parseDate)(e)),tj(this,"formatDate",(e,t)=>{if(!(e instanceof Date)&&isNaN((e=new Date(e)).getTime()))throw Error("DateFormatException: value passed is not a valid date");return t?e4()(e).format(t):(0,a.formatDate)(e)}),tj(this,"extractRepeatingGroupValues",(e,t)=>t.map(function(t){return t[e]})),tj(this,"calcGravida",(e,t)=>{let n="number"==typeof e?e:parseInt(e,10),i="number"==typeof t?t:parseInt(t,10);if(!Number.isInteger(n)||!Number.isInteger(i))throw Error("Both inputs must be valid numbers.");return n+i}),tj(this,"calcWeightForHeightZscore",(e,t)=>{let n=Number(e);if(!n||!t)return null;let i=new Date(this.patient.birthDate),r=tL(this.patient.sex,i,new Date);if(!r)return null;let o=110;if(n<45||n>o)return null;let s=n.toFixed(1),a=tb()(r,e=>parseFloat(e.Length).toFixed(1)===s),l=tw()(a);return this.calculateZScoreFromRef(l,t)}),tj(this,"calcBMIForAgeZscore",(e,t)=>{if(!e||!t)return null;let n=new Date(this.patient.birthDate),i=tR(this.patient.sex,n,new Date),r=e/100,o=parseFloat((t/(r*r)).toFixed(1)),s=tw()(i);return this.calculateZScoreFromRef(s,o)}),tj(this,"calcHeightForAgeZscore",(e,t)=>{if(!e)return null;let n=new Date(this.patient.birthDate),i=tO(this.patient.sex,n,new Date),r=tw()(i);return this.calculateZScoreFromRef(r,e)}),tj(this,"calcTimeDifference",(e,t)=>{if(!e)return 0;let n=e4()();switch(t){case"d":return Math.abs(Math.round(n.diff(e,"day",!0)));case"w":return Math.abs(Math.round(n.diff(e,"week",!0)));case"m":return Math.abs(Math.round(n.diff(e,"month",!0)));case"y":return Math.abs(Math.round(n.diff(e,"year",!0)))}}),tj(this,"resolve",e=>Promise.resolve(e)),this.allFields=n,this.allFieldValues=i,this.node=e,this.patient=t}}function tP(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function tF(e,t){if(e&&t)switch(e.type){case"page":t.pageDependents||(t.pageDependents=new Set),t.pageDependents.add(e.value.label);break;case"section":t.sectionDependents||(t.sectionDependents=new Set),t.sectionDependents.add(e.value.label);break;default:t.fieldDependents||(t.fieldDependents=new Set),t.fieldDependents.add(e.value.id)}}function tU(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class tV{putObject(e,t){this.dataSourceMap[e]=t}getObject(e){return this.dataSourceMap[e]}constructor(){tU(this,"dataSourceMap",{})}}let tz=new Map;function tH(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||"object"==typeof e||null==e}function tW(e,t,n,i,r){if(!e?.trim())return null;let o=tG(e);tK(o,t,n);try{return(0,a.evaluateAsType)(o,tq(t,n,i,r),tH)}catch(t){console.error(`Error: ${t}
1
+ (globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["8998"],{97136(e,t,n){"use strict";n.d(t,{aZ:()=>l});var i,r,o=n(47499),s=n.n(o),a=n(51154);let l=s().forwardRef(function({children:e,size:t=16,...n},o){return s().createElement(a.A,{width:t,height:t,ref:o,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",...n},i||(i=s().createElement("path",{d:"M16,18a5,5,0,1,1,5-5A5.0057,5.0057,0,0,1,16,18Zm0-8a3,3,0,1,0,3,3A3.0033,3.0033,0,0,0,16,10Z"})),r||(r=s().createElement("path",{d:"M16,30,7.5645,20.0513c-.0479-.0571-.3482-.4515-.3482-.4515A10.8888,10.8888,0,0,1,5,13a11,11,0,0,1,22,0,10.8844,10.8844,0,0,1-2.2148,6.5973l-.0015.0025s-.3.3944-.3447.4474ZM8.8125,18.395c.001.0007.2334.3082.2866.3744L16,26.9079l6.91-8.15c.0439-.0552.2783-.3649.2788-.3657A8.901,8.901,0,0,0,25,13,9,9,0,1,0,7,13a8.9054,8.9054,0,0,0,1.8125,5.395Z"})),e)})},32749(e,t,n){"use strict";n.r(t),n.d(t,{createAttachment:()=>a,fetchClobData:()=>g,fetchOpenMRSForm:()=>f,getAllLocations:()=>u,getConcept:()=>l,getLatestObs:()=>h,getLatestObsForConceptSet:()=>p,getLocationsByTag:()=>c,getPatientEnrolledPrograms:()=>m,getPreviousEncounter:()=>d,markPatientAsDeceased:()=>w,saveEncounter:()=>s,savePatientIdentifier:()=>b,savePersonAttribute:()=>y,saveProgramEnrollment:()=>v});var i=n(23365),r=n(9495),o=n(6232);function s(e,t,n){let o=n?`${i.restBaseUrl}/encounter/${n}?v=${r.RZ}`:`${i.restBaseUrl}/encounter?v=${r.RZ}`;return(0,i.openmrsFetch)(o,{headers:{"Content-Type":"application/json"},method:"POST",body:t,signal:e.signal})}async function a(e,t,n){let r=new FormData;return r.append("fileCaption",n.fileDescription),r.append("patient",e),n.file?r.append("file",n.file,n.fileName):(r.append("file",new File([""],n.fileName),n.fileName),r.append("base64Content",n.base64Content)),r.append("encounter",t),r.append("formFieldNamespace",n.formFieldNamespace),r.append("formFieldPath",n.formFieldPath),(0,i.openmrsFetch)(`${i.attachmentUrl}`,{method:"POST",body:r})}function l(e,t){return(0,i.openmrsFetch)(`${i.restBaseUrl}/concept/${e}?v=${t}`).then(({data:e})=>e.results)}function c(e){return(0,i.openmrsFetch)(`${i.restBaseUrl}/location?tag=${e}&v=custom:(uuid,display)`).then(({data:e})=>e.results)}function u(){return(0,i.openmrsFetch)(`${i.restBaseUrl}/location?v=custom:(uuid,display)`).then(({data:e})=>e.results)}async function d(e,t){let n=`patient=${e}&_sort=-date&_count=1&type=${t}`,o=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Encounter?${n}`);if(o?.data?.entry?.length){let e=o.data.entry[0].resource.id;return(o=await (0,i.openmrsFetch)(`${i.restBaseUrl}/encounter/${e}?v=${r.RZ}`)).data}return null}async function h(e,t,n){let r=`patient=${e}&code=${t}${n?`&encounter.type=${n}`:""}`;r+="&_sort=-date&_count=1";let{data:o}=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Observation?${r}`);return o.entry?.length?o.entry[0].resource:null}async function p(e,t,n){let r=await h(e,t,n);if(!r)return[];let o=r.encounter?.reference?.split("/").pop();if(!o)return[r];let s=`patient=${e}&code=${t}&encounter=${o}`,{data:a}=await (0,i.openmrsFetch)(`${i.fhirBaseUrl}/Observation?${s}`);return a.entry?.map(e=>e.resource)??[]}async function f(e){if(!e)return null;let{url:t,isUUID:n}=(0,o.O)(e)?{url:`${i.restBaseUrl}/form/${e}?v=full`,isUUID:!0}:{url:`${i.restBaseUrl}/form?q=${e}&v=full`,isUUID:!1},{data:r}=await (0,i.openmrsFetch)(t);if(n)return r;if(r.results?.length){let e=r.results.find(e=>!1===e.retired);if(e)return e}throw Error(`Form with ID "${e}" was not found`)}async function g(e){if(!e)return null;let t=e.resources?.find(({name:e})=>"JSON schema"===e);if(!t)return null;let n=`${i.restBaseUrl}/clobdata/${t.valueReference}`,{data:r}=await (0,i.openmrsFetch)(n);return r}function m(e){return(0,i.openmrsFetch)(`${i.restBaseUrl}/programenrollment?patient=${e}&v=custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(state:(uuid,name,concept:(uuid),programWorkflow:(uuid)))`).then(({data:e})=>e||null)}function v(e,t){if(!e)throw Error("Program enrollment cannot be created because no payload is supplied");let n=e.uuid?`${i.restBaseUrl}/programenrollment/${e.uuid}`:`${i.restBaseUrl}/programenrollment`;return(0,i.openmrsFetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:e,signal:t.signal})}function b(e,t){let n;return n=e.uuid?`${i.restBaseUrl}/patient/${t}/identifier/${e.uuid}`:`${i.restBaseUrl}/patient/${t}/identifier`,(0,i.openmrsFetch)(n,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)})}function y(e,t){let n;return n=e.uuid?`${i.restBaseUrl}/person/${t}/attribute/${e.uuid}`:`${i.restBaseUrl}/person/${t}/attribute`,(0,i.openmrsFetch)(n,{headers:{"Content-Type":"application/json"},method:"POST",body:e})}function w(e,t,n,r){if(!n)throw Error(e("patientCannotBeMarkedAsDeceasedBecauseNoPayloadSupplied","Patient cannot be marked as deceased because no payload is supplied"));let o=`${i.restBaseUrl}/person/${t}`;return(0,i.openmrsFetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:n,signal:r.signal})}},9495(e,t,n){"use strict";n.d(t,{FU:()=>a,Mi:()=>r,RA:()=>s,RZ:()=>o,ZA:()=>l,t$:()=>i});let i="cf82933b-3f3f-45e7-a5ab-5d31aaee3da3",r="488b58ff-64f5-4f8a-8979-fa79940b1594",o="custom:(uuid,encounterDatetime,encounterType:(uuid,name,description),location:(uuid,name),patient:(uuid,display),encounterProviders:(uuid,provider:(uuid,name),encounterRole:(uuid,name)),orders:(uuid,display,concept:(uuid,display),voided),diagnoses:(uuid,certainty,condition,formFieldPath,formFieldNamespace,display,rank,voided,diagnosis:(coded:(uuid,display))),obs:(uuid,obsDatetime,comment,voided,groupMembers,formFieldNamespace,formFieldPath,concept:(uuid,name:(uuid,name)),value:(uuid,name:(uuid,name),names:(uuid,conceptNameType,name))))",s="forms-engine-store",a=["radio","checkbox","select","content-switcher"],l="OPTION_NULL"},45278(e,t,n){"use strict";n.d(t,{L:()=>i});let i="@openmrs/esm-form-engine-app"},22958(e,t,n){"use strict";function i(e,t,n){if(!e)return t;let s=JSON.parse(JSON.stringify(t));return s.defaultPage=s.availableIntents?.find(t=>t.intent===(e?.intent||e))?.defaultPage,s.markdown&&o(s.markdown,e),s.pages=s.pages||[],s.pages.forEach(t=>{if(t.isSubform&&t.subform?.form){let n=[],r=t.subform.behaviours?.find(t=>t.intent==e?.intent||e);(r?.readonly!==void 0||r?.readonly!=null)&&n.push({name:"readonly",type:"field",value:r?.readonly}),t.subform.form=i(r?.subform_intent||"*",t.subform?.form,n)}let s=t.behaviours?.find(t=>t.intent===(e?.intent||e));if(s)t.hide=s.hide??t.hide,t.readonly=s.readonly??t.readonly;else{let e=t.behaviours?.find(e=>"*"===e.intent);e&&(t.hide=e.hide??t.hide,t.readonly=e.readonly??t.readonly)}t.markdown&&o(t.markdown,e),t.sections=t.sections||[],t.sections.forEach(t=>{let i=t.behaviours?.find(t=>t.intent===e?.intent||e);if(i)t.hide=i.hide??t.hide;else{let e=t.behaviours?.find(e=>"*"===e.intent);t.hide=e?.hide??t.hide}t.markdown&&o(t.markdown,e),t.questions=t.questions||[],t.questions.forEach(t=>{t.behaviours&&(r(t,e?.intent||e),n?.filter(e=>"all"==e.type||"field"==e.type)?.forEach(e=>{t[e.name]=e.value})),t.questions&&t.questions.length&&t.questions.forEach(t=>{r(t,e?.intent||e),n?.filter(e=>"all"==e.type||"field"==e.type)?.forEach(e=>{t[e.name]=e.value})})})})}),s}function r(e,t){let n=e.behaviours?.find(e=>e.intent===t),i=e.behaviours?.find(e=>"*"===e.intent);if(n||i){delete n?.intent,delete i?.intent;let t=Object.assign(i||{},n||{}),r=t.defaultValue;void 0!=r&&(e.questionOptions.defaultValue=r,delete t.defaultValue),e=Object.assign(e,t),delete e.behaviours}}function o(e,t){let n=e.behaviours?.find(e=>e.intent===t),i=e.behaviours?.find(e=>"*"===e.intent);n&&i?(delete n.intent,delete i.intent,e=Object.assign(e,Object.assign(i,n)),delete e.behaviours):!n&&i&&(delete i.intent,e=Object.assign(e,i),delete e.behaviours)}n.d(t,{y6:()=>oX,Im:()=>e6,Tn:()=>az}),n(99589);var s,a=n(23365),l=n(9495),c=n(47499),u=n.n(c),d=n(46942),h=n.n(d);let p={flexColumn:"-esm-form-builder__obs-group__flexColumn___oca-0",flexFullWidth:"-esm-form-builder__obs-group__flexFullWidth___eogPE",groupContainer:"-esm-form-builder__obs-group__groupContainer___mfwmG",boldLegend:"-esm-form-builder__obs-group__boldLegend___CY7xw"};var f=n(58646),g=n(14968),m=e=>"checkbox"===e.type,v=e=>e instanceof Date,b=e=>null==e;let y=e=>"object"==typeof e;var w=e=>!b(e)&&!Array.isArray(e)&&y(e)&&!v(e),x=e=>w(e)&&e.target?m(e.target)?e.target.checked:e.target.value:e,$=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,_=(e,t)=>e.has($(t)),S=e=>{let t=e.constructor&&e.constructor.prototype;return w(t)&&t.hasOwnProperty("isPrototypeOf")},M="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function C(e){let t,n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(M&&(e instanceof Blob||e instanceof FileList))&&(n||w(e))))return e;else if(t=n?[]:{},n||S(e))for(let n in e)e.hasOwnProperty(n)&&(t[n]=C(e[n]));else t=e;return t}var E=e=>Array.isArray(e)?e.filter(Boolean):[],k=e=>void 0===e,A=(e,t,n)=>{if(!t||!w(e))return n;let i=E(t.split(/[,[\].]+?/)).reduce((e,t)=>b(e)?e:e[t],e);return k(i)||i===e?k(e[t])?n:e[t]:i},T=e=>"boolean"==typeof e,L=e=>/^\w*$/.test(e),O=e=>E(e.replace(/["|']|\]/g,"").split(/\.|\[/)),R=(e,t,n)=>{let i=-1,r=L(t)?[t]:O(t),o=r.length,s=o-1;for(;++i<o;){let t=r[i],o=n;if(i!==s){let n=e[t];o=w(n)||Array.isArray(n)?n:isNaN(+r[i+1])?{}:[]}if("__proto__"===t)return;e[t]=o,e=e[t]}return e};let D="blur",I="focusout",j="change",N="onBlur",P="onChange",F="onSubmit",U="onTouched",V="all",z="max",H="min",W="maxLength",B="minLength",q="pattern",G="required",K="validate",Y=u().createContext(null),Q=()=>u().useContext(Y);var Z=(e,t,n,i=!0)=>{let r={defaultValues:t._defaultValues};for(let o in e)Object.defineProperty(r,o,{get:()=>{let r=o;return t._proxyFormState[r]!==V&&(t._proxyFormState[r]=!i||V),n&&(n[r]=!0),e[r]}});return r},J=e=>w(e)&&!Object.keys(e).length,X=(e,t,n,i)=>{n(e);let{name:r,...o}=e;return J(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>t[e]===(!i||V))},ee=e=>Array.isArray(e)?e:[e],et=(e,t,n)=>!e||!t||e===t||ee(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e)));function en(e){let t=u().useRef(e);t.current=e,u().useEffect(()=>{let n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function ei(e){let t=Q(),{control:n=t.control,disabled:i,name:r,exact:o}=e||{},[s,a]=u().useState(n._formState),l=u().useRef(!0),c=u().useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=u().useRef(r);return d.current=r,en({disabled:i,next:e=>l.current&&et(d.current,e.name,o)&&X(e,c.current,n._updateFormState)&&a({...n._formState,...e}),subject:n._subjects.state}),u().useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),Z(s,n,c.current,!1)}var er=e=>"string"==typeof e,eo=(e,t,n,i,r)=>er(e)?(i&&t.watch.add(e),A(n,e,r)):Array.isArray(e)?e.map(e=>(i&&t.watch.add(e),A(n,e))):(i&&(t.watchAll=!0),n);function es(e){let t=Q(),{control:n=t.control,name:i,defaultValue:r,disabled:o,exact:s}=e||{},a=u().useRef(i);a.current=i,en({disabled:o,subject:n._subjects.values,next:e=>{et(a.current,e.name,s)&&c(C(eo(a.current,n._names,e.values||n._formValues,!1,r)))}});let[l,c]=u().useState(n._getWatch(i,r));return u().useEffect(()=>n._removeUnmounted()),l}function ea(e){let t=Q(),{name:n,disabled:i,control:r=t.control,shouldUnregister:o}=e,s=_(r._names.array,n),a=es({control:r,name:n,defaultValue:A(r._formValues,n,A(r._defaultValues,n,e.defaultValue)),exact:!0}),l=ei({control:r,name:n,exact:!0}),c=u().useRef(r.register(n,{...e.rules,value:a,...T(e.disabled)?{disabled:e.disabled}:{}}));return u().useEffect(()=>{let e=r._options.shouldUnregister||o,t=(e,t)=>{let n=A(r._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=C(A(r._options.defaultValues,n));R(r._defaultValues,n,e),k(A(r._formValues,n))&&R(r._formValues,n,e)}return()=>{(s?e&&!r._state.action:e)?r.unregister(n):t(n,!1)}},[n,r,s,o]),u().useEffect(()=>{A(r._fields,n)&&r._updateDisabledField({disabled:i,fields:r._fields,name:n,value:A(r._fields,n)._f.value})},[i,n,r]),{field:{name:n,value:a,...T(i)||l.disabled?{disabled:l.disabled||i}:{},onChange:u().useCallback(e=>c.current.onChange({target:{value:x(e),name:n},type:j}),[n]),onBlur:u().useCallback(()=>c.current.onBlur({target:{value:A(r._formValues,n),name:n},type:D}),[n,r]),ref:u().useCallback(e=>{let t=A(r._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[r._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!A(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!A(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!A(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!A(l.validatingFields,n)},error:{enumerable:!0,get:()=>A(l.errors,n)}})}}let el=e=>e.render(ea(e));var ec=(e,t,n,i,r)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[i]:r||!0}}:{},eu=e=>({isOnSubmit:!e||e===F,isOnBlur:e===N,isOnChange:e===P,isOnAll:e===V,isOnTouch:e===U}),ed=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let eh=(e,t,n,i)=>{for(let r of n||Object.keys(e)){let n=A(e,r);if(n){let{_f:e,...o}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],r)&&!i)return!0;else if(e.ref&&t(e.ref,e.name)&&!i)return!0;else if(eh(o,t))break}else if(w(o)&&eh(o,t))break}}};var ep=(e,t,n)=>{let i=ee(A(e,n));return R(i,"root",t[n]),R(e,n,i),e},ef=e=>"file"===e.type,eg=e=>"function"==typeof e,em=e=>{if(!M)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ev=e=>er(e),eb=e=>"radio"===e.type,ey=e=>e instanceof RegExp;let ew={value:!1,isValid:!1},ex={value:!0,isValid:!0};var e$=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!k(e[0].attributes.value)?k(e[0].value)||""===e[0].value?ex:{value:e[0].value,isValid:!0}:ex:ew}return ew};let e_={isValid:!1,value:null};var eS=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,e_):e_;function eM(e,t,n="validate"){if(ev(e)||Array.isArray(e)&&e.every(ev)||T(e)&&!e)return{type:n,message:ev(e)?e:"",ref:t}}var eC=e=>w(e)&&!ey(e)?e:{value:e,message:""},eE=async(e,t,n,i,r)=>{let{ref:o,refs:s,required:a,maxLength:l,minLength:c,min:u,max:d,pattern:h,validate:p,name:f,valueAsNumber:g,mount:v,disabled:y}=e._f,x=A(t,f);if(!v||y)return{};let $=s?s[0]:o,_=e=>{i&&$.reportValidity&&($.setCustomValidity(T(e)?"":e||""),$.reportValidity())},S={},M=eb(o),C=m(o),E=M||C,L=(g||ef(o))&&k(o.value)&&k(x)||em(o)&&""===o.value||""===x||Array.isArray(x)&&!x.length,O=ec.bind(null,f,n,S),R=(e,t,n,i=W,r=B)=>{let s=e?t:n;S[f]={type:e?i:r,message:s,ref:o,...O(e?i:r,s)}};if(r?!Array.isArray(x)||!x.length:a&&(!E&&(L||b(x))||T(x)&&!x||C&&!e$(s).isValid||M&&!eS(s).isValid)){let{value:e,message:t}=ev(a)?{value:!!a,message:a}:eC(a);if(e&&(S[f]={type:G,message:t,ref:$,...O(G,t)},!n))return _(t),S}if(!L&&(!b(u)||!b(d))){let e,t,i=eC(d),r=eC(u);if(b(x)||isNaN(x)){let n=o.valueAsDate||new Date(x),s=e=>new Date(new Date().toDateString()+" "+e),a="time"==o.type,l="week"==o.type;er(i.value)&&x&&(e=a?s(x)>s(i.value):l?x>i.value:n>new Date(i.value)),er(r.value)&&x&&(t=a?s(x)<s(r.value):l?x<r.value:n<new Date(r.value))}else{let n=o.valueAsNumber||(x?+x:x);b(i.value)||(e=n>i.value),b(r.value)||(t=n<r.value)}if((e||t)&&(R(!!e,i.message,r.message,z,H),!n))return _(S[f].message),S}if((l||c)&&!L&&(er(x)||r&&Array.isArray(x))){let e=eC(l),t=eC(c),i=!b(e.value)&&x.length>+e.value,r=!b(t.value)&&x.length<+t.value;if((i||r)&&(R(i,e.message,t.message),!n))return _(S[f].message),S}if(h&&!L&&er(x)){let{value:e,message:t}=eC(h);if(ey(e)&&!x.match(e)&&(S[f]={type:q,message:t,ref:o,...O(q,t)},!n))return _(t),S}if(p){if(eg(p)){let e=eM(await p(x,t),$);if(e&&(S[f]={...e,...O(K,e.message)},!n))return _(e.message),S}else if(w(p)){let e={};for(let i in p){if(!J(e)&&!n)break;let r=eM(await p[i](x,t),$,i);r&&(e={...r,...O(i,r.message)},_(r.message),n&&(S[f]=e))}if(!J(e)&&(S[f]={ref:$,...e},!n))return S}}return _(!0),S};function ek(e,t){let n=t.slice(0,-1).length,i=0;for(;i<n;)e=k(e)?i++:e[t[i++]];return e}function eA(e){for(let t in e)if(e.hasOwnProperty(t)&&!k(e[t]))return!1;return!0}function eT(e,t){let n=Array.isArray(t)?t:L(t)?[t]:O(t),i=1===n.length?e:ek(e,n),r=n.length-1,o=n[r];return i&&delete i[o],0!==r&&(w(i)&&J(i)||Array.isArray(i)&&eA(i))&&eT(e,n.slice(0,-1)),e}var eL=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},eO=e=>b(e)||!y(e);function eR(e,t){if(eO(e)||eO(t))return e===t;if(v(e)&&v(t))return e.getTime()===t.getTime();let n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r of n){let n=e[r];if(!i.includes(r))return!1;if("ref"!==r){let e=t[r];if(v(n)&&v(e)||w(n)&&w(e)||Array.isArray(n)&&Array.isArray(e)?!eR(n,e):n!==e)return!1}}return!0}var eD=e=>"select-multiple"===e.type,eI=e=>eb(e)||m(e),ej=e=>em(e)&&e.isConnected,eN=e=>{for(let t in e)if(eg(e[t]))return!0;return!1};function eP(e,t={}){let n=Array.isArray(e);if(w(e)||n)for(let n in e)Array.isArray(e[n])||w(e[n])&&!eN(e[n])?(t[n]=Array.isArray(e[n])?[]:{},eP(e[n],t[n])):b(e[n])||(t[n]=!0);return t}function eF(e,t,n){let i=Array.isArray(e);if(w(e)||i)for(let i in e)Array.isArray(e[i])||w(e[i])&&!eN(e[i])?k(t)||eO(n[i])?n[i]=Array.isArray(e[i])?eP(e[i],[]):{...eP(e[i])}:eF(e[i],b(t)?{}:t[i],n[i]):n[i]=!eR(e[i],t[i]);return n}var eU=(e,t)=>eF(e,t,eP(t)),eV=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:i})=>k(e)?e:t?""===e?NaN:e?+e:e:n&&er(e)?new Date(e):i?i(e):e;function ez(e){let t=e.ref;if(e.refs?!e.refs.every(e=>e.disabled):!t.disabled)return ef(t)?t.files:eb(t)?eS(e.refs).value:eD(t)?[...t.selectedOptions].map(({value:e})=>e):m(t)?e$(e.refs).value:eV(k(t.value)?e.ref.value:t.value,e)}var eH=(e,t,n,i)=>{let r={};for(let n of e){let e=A(t,n);e&&R(r,n,e._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:i}},eW=e=>k(e)?e:ey(e)?e.source:w(e)?ey(e.value)?e.value.source:e.value:e;let eB="AsyncFunction";var eq=e=>(!e||!e.validate)&&!!(eg(e.validate)&&e.validate.constructor.name===eB||w(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===eB)),eG=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eK(e,t,n){let i=A(e,n);if(i||L(n))return{error:i,name:n};let r=n.split(".");for(;r.length;){let i=r.join("."),o=A(t,i),s=A(e,i);if(o&&!Array.isArray(o)&&n!==i)break;if(s&&s.type)return{name:i,error:s};r.pop()}return{name:n}}var eY=(e,t,n,i,r)=>!r.isOnAll&&(!n&&r.isOnTouch?!(t||e):(n?i.isOnBlur:r.isOnBlur)?!e:(n?!i.isOnChange:!r.isOnChange)||e),eQ=(e,t)=>!E(A(e,t)).length&&eT(e,t);let eZ={mode:F,reValidateMode:P,shouldFocusError:!0};function eJ(e={}){let t,n={...eZ,...e},i={submitCount:0,isDirty:!1,isLoading:eg(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},r={},o=(w(n.defaultValues)||w(n.values))&&C(n.defaultValues||n.values)||{},s=n.shouldUnregister?{}:C(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:eL(),array:eL(),state:eL()},h=eu(n.mode),p=eu(n.reValidateMode),f=n.criteriaMode===V,g=e=>t=>{clearTimeout(c),c=setTimeout(e,t)},y=async t=>{if(!e.disabled&&(u.isValid||t)){let e=n.resolver?J((await F()).errors):await z(r,!0);e!==i.isValid&&d.state.next({isValid:e})}},$=(t,n)=>{!e.disabled&&(u.isValidating||u.validatingFields)&&((t||Array.from(l.mount)).forEach(e=>{e&&(n?R(i.validatingFields,e,n):eT(i.validatingFields,e))}),d.state.next({validatingFields:i.validatingFields,isValidating:!J(i.validatingFields)}))},S=(t,n=[],l,c,h=!0,p=!0)=>{if(c&&l&&!e.disabled){if(a.action=!0,p&&Array.isArray(A(r,t))){let e=l(A(r,t),c.argA,c.argB);h&&R(r,t,e)}if(p&&Array.isArray(A(i.errors,t))){let e=l(A(i.errors,t),c.argA,c.argB);h&&R(i.errors,t,e),eQ(i.errors,t)}if(u.touchedFields&&p&&Array.isArray(A(i.touchedFields,t))){let e=l(A(i.touchedFields,t),c.argA,c.argB);h&&R(i.touchedFields,t,e)}u.dirtyFields&&(i.dirtyFields=eU(o,s)),d.state.next({name:t,isDirty:W(t,n),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else R(s,t,n)},L=(e,t)=>{R(i.errors,e,t),d.state.next({errors:i.errors})},O=e=>{i.errors=e,d.state.next({errors:i.errors,isValid:!1})},j=(e,t,n,i)=>{let l=A(r,e);if(l){let r=A(s,e,k(n)?A(o,e):n);k(r)||i&&i.defaultChecked||t?R(s,e,t?r:ez(l._f)):q(e,r),a.mount&&y()}},N=(t,n,s,a,l)=>{let c=!1,h=!1,p={name:t};if(!e.disabled){let e=!!(A(r,t)&&A(r,t)._f&&A(r,t)._f.disabled);if(!s||a){u.isDirty&&(h=i.isDirty,i.isDirty=p.isDirty=W(),c=h!==p.isDirty);let r=e||eR(A(o,t),n);h=!!(!e&&A(i.dirtyFields,t)),r||e?eT(i.dirtyFields,t):R(i.dirtyFields,t,!0),p.dirtyFields=i.dirtyFields,c=c||u.dirtyFields&&!r!==h}if(s){let e=A(i.touchedFields,t);e||(R(i.touchedFields,t,s),p.touchedFields=i.touchedFields,c=c||u.touchedFields&&e!==s)}c&&l&&d.state.next(p)}return c?p:{}},P=(n,r,o,s)=>{let a=A(i.errors,n),l=u.isValid&&T(r)&&i.isValid!==r;if(e.delayError&&o?(t=g(()=>L(n,o)))(e.delayError):(clearTimeout(c),t=null,o?R(i.errors,n,o):eT(i.errors,n)),(o?!eR(a,o):a)||!J(s)||l){let e={...s,...l&&T(r)?{isValid:r}:{},errors:i.errors,name:n};i={...i,...e},d.state.next(e)}},F=async e=>{$(e,!0);let t=await n.resolver(s,n.context,eH(e||l.mount,r,n.criteriaMode,n.shouldUseNativeValidation));return $(e),t},U=async e=>{let{errors:t}=await F(e);if(e)for(let n of e){let e=A(t,n);e?R(i.errors,n,e):eT(i.errors,n)}else i.errors=t;return t},z=async(e,t,r={valid:!0})=>{for(let o in e){let a=e[o];if(a){let{_f:e,...c}=a;if(e){let c=l.array.has(e.name),d=a._f&&eq(a._f);d&&u.validatingFields&&$([o],!0);let h=await eE(a,s,f,n.shouldUseNativeValidation&&!t,c);if(d&&u.validatingFields&&$([o]),h[e.name]&&(r.valid=!1,t))break;t||(A(h,e.name)?c?ep(i.errors,h,e.name):R(i.errors,e.name,h[e.name]):eT(i.errors,e.name))}J(c)||await z(c,t,r)}}return r.valid},H=()=>{for(let e of l.unMount){let t=A(r,e);t&&(t._f.refs?t._f.refs.every(e=>!ej(e)):!ej(t._f.ref))&&ea(e)}l.unMount=new Set},W=(t,n)=>!e.disabled&&(t&&n&&R(s,t,n),!eR(X(),o)),B=(e,t,n)=>eo(e,l,{...a.mount?s:k(t)?o:er(e)?{[e]:t}:t},n,t),q=(e,t,n={})=>{let i=A(r,e),o=t;if(i){let n=i._f;n&&(n.disabled||R(s,e,eV(t,n)),o=em(n.ref)&&b(t)?"":t,eD(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?m(n.ref)?n.refs.length>1?n.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value)):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach(e=>e.checked=e.value===o):ef(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||d.values.next({name:e,values:{...s}})))}(n.shouldDirty||n.shouldTouch)&&N(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&Z(e)},G=(e,t,n)=>{for(let i in t){let o=t[i],s=`${e}.${i}`,a=A(r,s);(l.array.has(e)||w(o)||a&&!a._f)&&!v(o)?G(s,o,n):q(s,o,n)}},K=(e,t,n={})=>{let c=A(r,e),h=l.array.has(e),p=C(t);R(s,e,p),h?(d.array.next({name:e,values:{...s}}),(u.isDirty||u.dirtyFields)&&n.shouldDirty&&d.state.next({name:e,dirtyFields:eU(o,s),isDirty:W(e,p)})):!c||c._f||b(p)?q(e,p,n):G(e,p,n),ed(e,l)&&d.state.next({...i}),d.values.next({name:a.mount?e:void 0,values:{...s}})},Y=async o=>{a.mount=!0;let c=o.target,g=c.name,m=!0,b=A(r,g),w=()=>c.type?ez(b._f):x(o),_=e=>{m=Number.isNaN(e)||v(e)&&isNaN(e.getTime())||eR(e,A(s,g,e))};if(b){let a,c,v=w(),x=o.type===D||o.type===I,S=!eG(b._f)&&!n.resolver&&!A(i.errors,g)&&!b._f.deps||eY(x,A(i.touchedFields,g),i.isSubmitted,p,h),M=ed(g,l,x);R(s,g,v),x?(b._f.onBlur&&b._f.onBlur(o),t&&t(0)):b._f.onChange&&b._f.onChange(o);let C=N(g,v,x,!1),E=!J(C)||M;if(x||d.values.next({name:g,type:o.type,values:{...s}}),S)return u.isValid&&("onBlur"===e.mode?x&&y():y()),E&&d.state.next({name:g,...M?{}:C});if(!x&&M&&d.state.next({...i}),n.resolver){let{errors:e}=await F([g]);if(_(v),m){let t=eK(i.errors,r,g),n=eK(e,r,t.name||g);a=n.error,g=n.name,c=J(e)}}else $([g],!0),a=(await eE(b,s,f,n.shouldUseNativeValidation))[g],$([g]),_(v),m&&(a?c=!1:u.isValid&&(c=await z(r,!0)));m&&(b._f.deps&&Z(b._f.deps),P(g,c,a,C))}},Q=(e,t)=>{if(A(i.errors,t)&&e.focus)return e.focus(),1},Z=async(e,t={})=>{let o,s,a=ee(e);if(n.resolver){let t=await U(k(e)?e:a);o=J(t),s=e?!a.some(e=>A(t,e)):o}else e?((s=(await Promise.all(a.map(async e=>{let t=A(r,e);return await z(t&&t._f?{[e]:t}:t)}))).every(Boolean))||i.isValid)&&y():s=o=await z(r);return d.state.next({...!er(e)||u.isValid&&o!==i.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:i.errors}),t.shouldFocus&&!s&&eh(r,Q,e?a:l.mount),s},X=e=>{let t={...a.mount?s:o};return k(e)?t:er(e)?A(t,e):e.map(e=>A(t,e))},et=(e,t)=>({invalid:!!A((t||i).errors,e),isDirty:!!A((t||i).dirtyFields,e),error:A((t||i).errors,e),isValidating:!!A(i.validatingFields,e),isTouched:!!A((t||i).touchedFields,e)}),en=e=>{e&&ee(e).forEach(e=>eT(i.errors,e)),d.state.next({errors:e?i.errors:{}})},ei=(e,t,n)=>{let o=(A(r,e,{_f:{}})._f||{}).ref,{ref:s,message:a,type:l,...c}=A(i.errors,e)||{};R(i.errors,e,{...c,...t,ref:o}),d.state.next({name:e,errors:i.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},es=(e,t)=>eg(e)?d.values.subscribe({next:n=>e(B(void 0,t),n)}):B(e,t,!0),ea=(e,t={})=>{for(let a of e?ee(e):l.mount)l.mount.delete(a),l.array.delete(a),t.keepValue||(eT(r,a),eT(s,a)),t.keepError||eT(i.errors,a),t.keepDirty||eT(i.dirtyFields,a),t.keepTouched||eT(i.touchedFields,a),t.keepIsValidating||eT(i.validatingFields,a),n.shouldUnregister||t.keepDefaultValue||eT(o,a);d.values.next({values:{...s}}),d.state.next({...i,...!t.keepDirty?{}:{isDirty:W()}}),t.keepIsValid||y()},el=({disabled:e,name:t,field:n,fields:i,value:r})=>{if(T(e)&&a.mount||e){let o=e?void 0:k(r)?ez(n?n._f:A(i,t)._f):r;R(s,t,o),N(t,o,!1,!1,!0)}},ec=(t,i={})=>{let s=A(r,t),c=T(i.disabled)||T(e.disabled);return R(r,t,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:t}},name:t,mount:!0,...i}}),l.mount.add(t),s?el({field:s,disabled:T(i.disabled)?i.disabled:e.disabled,name:t,value:i.value}):j(t,!0,i.value),{...c?{disabled:i.disabled||e.disabled}:{},...n.progressive?{required:!!i.required,min:eW(i.min),max:eW(i.max),minLength:eW(i.minLength),maxLength:eW(i.maxLength),pattern:eW(i.pattern)}:{},name:t,onChange:Y,onBlur:Y,ref:e=>{if(e){ec(t,i),s=A(r,t);let n=k(e.value)&&e.querySelectorAll&&e.querySelectorAll("input,select,textarea")[0]||e,a=eI(n),l=s._f.refs||[];(a?l.find(e=>e===n):n===s._f.ref)||(R(r,t,{_f:{...s._f,...a?{refs:[...l.filter(ej),n,...Array.isArray(A(o,t))?[{}]:[]],ref:{type:n.type,name:t}}:{ref:n}}}),j(t,!1,void 0,n))}else(s=A(r,t,{}))._f&&(s._f.mount=!1),(n.shouldUnregister||i.shouldUnregister)&&!(_(l.array,t)&&a.action)&&l.unMount.add(t)}}},ev=()=>n.shouldFocusError&&eh(r,Q,l.mount),eb=(e,t)=>async o=>{let a;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=C(s);if(d.state.next({isSubmitting:!0}),n.resolver){let{errors:e,values:t}=await F();i.errors=e,l=t}else await z(r);if(eT(i.errors,"root"),J(i.errors)){d.state.next({errors:{}});try{await e(l,o)}catch(e){a=e}}else t&&await t({...i.errors},o),ev(),setTimeout(ev);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:J(i.errors)&&!a,submitCount:i.submitCount+1,errors:i.errors}),a)throw a},ey=(e,t={})=>{A(r,e)&&(k(t.defaultValue)?K(e,C(A(o,e))):(K(e,t.defaultValue),R(o,e,C(t.defaultValue))),t.keepTouched||eT(i.touchedFields,e),t.keepDirty||(eT(i.dirtyFields,e),i.isDirty=t.defaultValue?W(e,C(A(o,e))):W()),!t.keepError&&(eT(i.errors,e),u.isValid&&y()),d.state.next({...i}))},ew=(t,n={})=>{let c=t?C(t):o,h=C(c),p=J(t),f=p?o:h;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues)for(let e of Array.from(new Set([...l.mount,...Object.keys(eU(o,s))])))A(i.dirtyFields,e)?R(f,e,A(s,e)):K(e,A(f,e));else{if(M&&k(t))for(let e of l.mount){let t=A(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(em(e)){let t=e.closest("form");if(t){t.reset();break}}}}r={}}s=e.shouldUnregister?n.keepDefaultValues?C(o):{}:C(f),d.array.next({values:{...f}}),d.values.next({values:{...f}})}l={mount:n.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!u.isValid||!!n.keepIsValid||!!n.keepDirtyValues,a.watch=!!e.shouldUnregister,d.state.next({submitCount:n.keepSubmitCount?i.submitCount:0,isDirty:!p&&(n.keepDirty?i.isDirty:!!(n.keepDefaultValues&&!eR(t,o))),isSubmitted:!!n.keepIsSubmitted&&i.isSubmitted,dirtyFields:p?{}:n.keepDirtyValues?n.keepDefaultValues&&s?eU(o,s):i.dirtyFields:n.keepDefaultValues&&t?eU(o,t):n.keepDirty?i.dirtyFields:{},touchedFields:n.keepTouched?i.touchedFields:{},errors:n.keepErrors?i.errors:{},isSubmitSuccessful:!!n.keepIsSubmitSuccessful&&i.isSubmitSuccessful,isSubmitting:!1})},ex=(e,t)=>ew(eg(e)?e(s):e,t),e$=(e,t={})=>{let n=A(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}};return{control:{register:ec,unregister:ea,getFieldState:et,handleSubmit:eb,setError:ei,_executeSchema:F,_getWatch:B,_getDirty:W,_updateValid:y,_removeUnmounted:H,_updateFieldArray:S,_updateDisabledField:el,_getFieldArray:t=>E(A(a.mount?s:o,t,e.shouldUnregister?A(o,t,[]):[])),_reset:ew,_resetDefaultValues:()=>eg(n.defaultValues)&&n.defaultValues().then(e=>{ex(e,n.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:e=>{i={...i,...e}},_disableForm:e=>{T(e)&&(d.state.next({disabled:e}),eh(r,(t,n)=>{let i=A(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:d,_proxyFormState:u,_setErrors:O,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(value){a=value},get _defaultValues(){return o},get _names(){return l},set _names(value){l=value},get _formState(){return i},set _formState(value){i=value},get _options(){return n},set _options(value){n={...n,...value}}},trigger:Z,register:ec,handleSubmit:eb,watch:es,setValue:K,getValues:X,reset:ex,resetField:ey,clearErrors:en,unregister:ea,setError:ei,setFocus:e$,getFieldState:et}}function eX(e={}){let t=u().useRef(),n=u().useRef(),[i,r]=u().useState({isDirty:!1,isValidating:!1,isLoading:eg(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:eg(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...eJ(e),formState:i});let o=t.current.control;return o._options=e,en({subject:o._subjects.state,next:e=>{X(e,o._proxyFormState,o._updateFormState,!0)&&r({...o._formState})}}),u().useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),u().useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),u().useEffect(()=>{e.values&&!eR(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values,r(e=>({...e}))):o._resetDefaultValues()},[e.values,o]),u().useEffect(()=>{e.errors&&o._setErrors(e.errors)},[e.errors,o]),u().useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),u().useEffect(()=>{e.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[e.shouldUnregister,o]),u().useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[i]),t.current.formState=Z(i,o),t.current}var e0=n(58779),e1=n(47665),e2=n(74353),e4=n.n(e2);let e3="field.required",e5="field.outOfBound",e9={validate:(e,t)=>{if(e.meta?.submission?.unspecified)return[];if(e6(t)&&e.isRequired){if("object"==typeof e.required&&"conditionalRequired"===e.required.type&&e.isRequired)return te(e3,e.required.message??"Field is mandatory");else if(e.isRequired)return te(e3,"Field is mandatory")}if("text"===e.questionOptions.rendering)return e7(e.questionOptions.minLength,e.questionOptions.maxLength,t?.length)??[];if("number"===e.questionOptions.rendering){let n=Number(e.questionOptions.min),i=Number(e.questionOptions.max),r=e.questionOptions.disallowDecimals||e.meta?.concept?.allowDecimal;if(e6(t))return[];if(r&&!Number.isInteger(t))return te(e5,"Decimal values are not allowed for this field");if(!Number.isNaN(n)||!Number.isNaN(i))return e8(n,i,t)}return[]}};function e8(e,t,n){return!Number.isNaN(e)&&n<e?te(e5,`Value must be greater than ${e}`):!Number.isNaN(t)&&n>t?te(e5,`Value must be lower than ${t}`):[]}function e6(e){return!!(null==e||""===e||"string"==typeof e&&!e?.trim()||Array.isArray(e)&&!e.length)}function e7(e,t,n){let i=Number(e),r=Number(t);if("number"==typeof n&&!Number.isNaN(n)){if(i&&r&&n>=i&&n<=r)return[];if(i&&n<i)return te(e5,`Length should be at least ${i} characters`);if(r&&n>r)return te(e5,`Length should not exceed ${r} characters`);if(r&&i&&n<i&&n>r)return te(e5,`Length should be between ${i} and ${r} characters`)}}function te(e,t){return[{resultType:"error",errCode:e,message:t}]}function tt(e){let t=[];function n(e){t.push(e),e.groupMembers?.length&&e.groupMembers.forEach(e=>{n(e)})}return e.forEach(e=>{n(e)}),t}function tn(e,t){return e.questionOptions.rendering===t}function ti(e){e.meta?.submission||(e.meta={...e.meta||{},submission:{}}),e.meta.submission={...e.meta.submission,voidedValue:null,newValue:null}}function tr(e,t,n){return e.meta?.submission||(e.meta={...e.meta||{},submission:{}}),e6(t)||(e.meta.submission.newValue=t),e6(n)||(e.meta.submission.voidedValue=n),e.meta.submission.newValue}function to(e){return!!e.meta.submission?.newValue||!!e.meta.submission?.voidedValue}function ts(e){return"view"===e||"embedded-view"===e}function ta(e){let t=e4()(e).toDate();if(isNaN(t.getTime()))return new Date(NaN);try{let n=e.split("T")[1];if(n){let e=n.split(":");t.setHours(parseInt(e[0]),parseInt(e[1]),0)}}catch(e){console.error(e)}return t}function tl(e,t){if(!t)return e;let n=t.startDatetime?new Date(t.startDatetime):null,i=t.stopDatetime?new Date(t.stopDatetime):null;return n&&e<n||i&&e>i?n??i:e}function tc(e,t){let n={noToday:!0};return"calendar"===e.datePickerFormat?n.time=!1:n.time=!0,(0,a.formatDate)(t,n)}function tu(e){return e.pages=e.pages.map(e=>(e.sections=Array.from(e.sections),e)),{...e}}function td(e,t=16){return e/t}var th=n(66401),tp=n(90445),tf=n.n(tp),tg=n(24713),tm=n.n(tg),tv=n(87612),tb=n.n(tv),ty=n(56170),tw=n.n(ty),tx=n(39754),t$=n.n(tx),t_=n(68090),tS=n.n(t_),tM=n(32749);let tC={wflFemaleBelow5:()=>n.e("6601").then(n.t.bind(n,6784,19)),wflMaleBelow5:()=>n.e("1989").then(n.t.bind(n,22596,19)),hfaFemaleBelow5:()=>n.e("7663").then(n.t.bind(n,34626,19)),hfaMaleBelow5:()=>n.e("7367").then(n.t.bind(n,6282,19)),hfaFemale5Above:()=>n.e("4364").then(n.t.bind(n,96855,19)),hfaMale5Above:()=>n.e("1668").then(n.t.bind(n,3791,19)),bfaFemale5Above:()=>n.e("7538").then(n.t.bind(n,79529,19)),bfaMale5Above:()=>n.e("902").then(n.t.bind(n,79189,19))},tE={calcWeightForHeightZscore:["wflFemaleBelow5","wflMaleBelow5"],calcHeightForAgeZscore:["hfaFemaleBelow5","hfaMaleBelow5","hfaFemale5Above","hfaMale5Above"],calcBMIForAgeZscore:["bfaFemale5Above","bfaMale5Above"]},tk=new Map;async function tA(e){let t=JSON.stringify(e??{}),n=Object.entries(tE).filter(([e])=>t.includes(e)).flatMap(([,e])=>e).filter(e=>!tk.has(e)),i=(await Promise.allSettled(n.map(async e=>{let t=await tC[e]();tk.set(e,t.default)}))).find(e=>"rejected"===e.status);if(i)throw i.reason}function tT(e){let t=tk.get(e);return t||console.warn(`Z-score calculation: the ${e} reference table hasn't been loaded`),t}let tL=1856,tO=61;function tR(e,t,n){let i=tN(t,n,"years");return"F"===e&&null!==i&&i<5?tT("wflFemaleBelow5"):"M"===e&&null!==i&&i<5?tT("wflMaleBelow5"):null}function tD(e,t,n){let i=tN(t,n,"years"),r=tN(t,n,"months"),o=tN(t,n,"days"),s=Math.max(r,tO);if("F"===e){if(null!==o&&o<=tL)return tj(tT("hfaFemaleBelow5"),"Day",o);if(o>tL&&i<18)return tj(tT("hfaFemale5Above"),"Month",s)}if("M"===e){if(null!==o&&o<=tL)return tj(tT("hfaMaleBelow5"),"Day",o);if(o>tL&&i<18)return tj(tT("hfaMale5Above"),"Month",s)}return null}function tI(e,t,n){let i=tN(t,n,"years"),r=tN(t,n,"months"),o=tN(t,n,"days"),s=Math.max(r,tO);return"F"===e&&o>tL&&i<18?tj(tT("bfaFemale5Above"),"Month",s):"M"===e&&o>tL&&i<18?tj(tT("bfaMale5Above"),"Month",s):null}function tj(e,t,n){return tb()(e,e=>e[t]===n)}function tN(e,t,n){if(e&&t&&n){let i=e4()(t),r=e4()(e);return i.isValid()&&r.isValid()?i.diff(r,n):null}return null}function tP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}e4().extend(tf());class tF{constructor(e,t,n,i){tP(this,"node",null),tP(this,"patient",null),tP(this,"allFields",[]),tP(this,"allFieldValues",{}),tP(this,"api",tM),tP(this,"isEmpty",e6),tP(this,"dayjs",e4()),tP(this,"calculateZScoreFromRef",(e,t)=>{if(!e)return console.warn("Z-score calculation: No reference data object provided"),null;let n=Object.keys(e),i=n.map(t=>e[t]),r=i[1],o=[];t<r?o.push(r):t$()(i,e=>{e<=t&&o.push(e)});let s=tS()(o),a=n[tm()(i,e=>e===s)],l=a?.replace("SD","");return l?.includes("neg")&&(l="-"+l.substring(0,1)),("S"===l||"L"===l||"M"===l||"-5"===l)&&(l="-4"),l??null}),tP(this,"today",()=>new Date),tP(this,"includes",(e,t)=>e?.includes(t)),tP(this,"isDateBefore",(e,t,n)=>{let i=t instanceof Date?t:n?e4()(t,n,!0).toDate():e4()(t,"YYYY-MM-DD",!0).toDate();return e?.getTime()<i.getTime()}),tP(this,"isDateAfter",(e,t,n,i)=>{let r,o=e4()(t);switch(i){case"months":r=o.add(n,"month").toDate();break;case"weeks":r=o.add(n,"week").toDate();break;case"days":r=o.add(n,"day").toDate();break;case"years":r=o.add(n,"year").toDate();break;default:r=new Date(0)}return e.getTime()>=r.getTime()}),tP(this,"addWeeksToDate",(e,t)=>e4()(e).add(t,"week").toDate()),tP(this,"addDaysToDate",(e,t)=>e4()(e).add(t,"day").toDate()),tP(this,"isDateAfterSimple",(e,t,n)=>{let i=t instanceof Date?t:n?e4()(t,n,!0).toDate():e4()(t,"YYYY-MM-DD",!0).toDate();return e?.getTime()>i.getTime()}),tP(this,"useFieldValue",e=>{let t=this.allFields.find(t=>t.id===e);return t&&tV(this.node,t),this.allFieldValues[e]??null}),tP(this,"doesNotMatchExpression",(e,t)=>!!(!t||["undefined","null",""].includes(t.toString()))||!new RegExp(e).test(t)),tP(this,"calcBMI",(e,t)=>{if(!e||!t)return null;let n=e/100;return parseFloat((t/(n*n)).toFixed(1))}),tP(this,"calcEDD",e=>e?new Date(e.getTime()+24192e6):null),tP(this,"calcMonthsOnART",e=>{if(null==e)return null;if(!(e instanceof Date))throw Error("DateFormatException: value passed is not a valid date");let t=new Date;return 30>Math.round((t.getTime()-e.getTime())/864e5)?0:e4()(t).diff(e,"month")}),tP(this,"calcViralLoadStatus",e=>{let t;return e&&(t=e>50?"a6768be6-c08e-464d-8f53-5f4229508e54":"5d5e42cc-acc4-4069-b3a8-7163e0db5d96"),t??null}),tP(this,"calcNextVisitDate",(e,t)=>e&&t?new Date(e.getTime()+24*t*36e5):null),tP(this,"calcTreatmentEndDate",(e,t,n)=>{if(!e||!t||"160429AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"!==n)return null;let i=30+t;return new Date(e.getTime()+24*i*36e5)}),tP(this,"calcAgeBasedOnDate",e=>(e?new Date(e).getFullYear():new Date().getFullYear())-new Date(this.patient.birthDate).getFullYear()),tP(this,"calcBSA",(e,t)=>e&&t?parseFloat(Math.sqrt(e*t/3600).toFixed(2)):null),tP(this,"arrayContains",(e,t)=>{if(!e||!Array.isArray(e))return!1;if(0===e.length)return null==t||Array.isArray(t)&&0===t.length;if(Array.isArray(t)||(t=[t]),0===t.length)return!0;for(let n of t)if(-1===e.indexOf(n))return!1;return!0}),tP(this,"arrayContainsAny",(e,t)=>{if(!e||!Array.isArray(e))return!1;if(0===e.length)return null==t||Array.isArray(t)&&0===t.length;if(Array.isArray(t)||(t=[t]),0===t.length)return!0;for(let n of t)if(-1!==e.indexOf(n))return!0;return!1}),tP(this,"parseDate",e=>(0,a.parseDate)(e)),tP(this,"formatDate",(e,t)=>{if(!(e instanceof Date)&&isNaN((e=new Date(e)).getTime()))throw Error("DateFormatException: value passed is not a valid date");return t?e4()(e).format(t):(0,a.formatDate)(e)}),tP(this,"extractRepeatingGroupValues",(e,t)=>t.map(function(t){return t[e]})),tP(this,"calcGravida",(e,t)=>{let n="number"==typeof e?e:parseInt(e,10),i="number"==typeof t?t:parseInt(t,10);if(!Number.isInteger(n)||!Number.isInteger(i))throw Error("Both inputs must be valid numbers.");return n+i}),tP(this,"calcWeightForHeightZscore",(e,t)=>{let n=Number(e);if(!n||!t)return null;let i=new Date(this.patient.birthDate),r=tR(this.patient.sex,i,new Date);if(!r)return null;let o=110;if(n<45||n>o)return null;let s=n.toFixed(1),a=tb()(r,e=>parseFloat(e.Length).toFixed(1)===s),l=tw()(a);return this.calculateZScoreFromRef(l,t)}),tP(this,"calcBMIForAgeZscore",(e,t)=>{if(!e||!t)return null;let n=new Date(this.patient.birthDate),i=tI(this.patient.sex,n,new Date),r=e/100,o=parseFloat((t/(r*r)).toFixed(1)),s=tw()(i);return this.calculateZScoreFromRef(s,o)}),tP(this,"calcHeightForAgeZscore",(e,t)=>{if(!e)return null;let n=new Date(this.patient.birthDate),i=tD(this.patient.sex,n,new Date),r=tw()(i);return this.calculateZScoreFromRef(r,e)}),tP(this,"calcTimeDifference",(e,t)=>{if(!e)return 0;let n=e4()();switch(t){case"d":return Math.abs(Math.round(n.diff(e,"day",!0)));case"w":return Math.abs(Math.round(n.diff(e,"week",!0)));case"m":return Math.abs(Math.round(n.diff(e,"month",!0)));case"y":return Math.abs(Math.round(n.diff(e,"year",!0)))}}),tP(this,"resolve",e=>Promise.resolve(e)),this.allFields=n,this.allFieldValues=i,this.node=e,this.patient=t}}function tU(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function tV(e,t){if(e&&t)switch(e.type){case"page":t.pageDependents||(t.pageDependents=new Set),t.pageDependents.add(e.value.label);break;case"section":t.sectionDependents||(t.sectionDependents=new Set),t.sectionDependents.add(e.value.label);break;default:t.fieldDependents||(t.fieldDependents=new Set),t.fieldDependents.add(e.value.id)}}function tz(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class tH{putObject(e,t){this.dataSourceMap[e]=t}getObject(e){return this.dataSourceMap[e]}constructor(){tz(this,"dataSourceMap",{})}}let tW=new Map;function tB(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||"object"==typeof e||null==e}function tq(e,t,n,i,r){if(!e?.trim())return null;let o=tY(e);tQ(o,t,n);try{return(0,a.evaluateAsType)(o,tK(t,n,i,r),tB)}catch(t){console.error(`Error: ${t}
2
2
 
3
- failing expression: ${e}`)}return null}async function tB(e,t,n,i,r){if(!e?.trim())return null;let o=tG(e);tK(o,t,n);try{return(0,a.evaluateAsTypeAsync)(o,tq(t,n,i,r),tH)}catch(t){console.error(`Error: ${t}
3
+ failing expression: ${e}`)}return null}async function tG(e,t,n,i,r){if(!e?.trim())return null;let o=tY(e);tQ(o,t,n);try{return(0,a.evaluateAsTypeAsync)(o,tK(t,n,i,r),tB)}catch(t){console.error(`Error: ${t}
4
4
 
5
- failing expression: ${e}`)}return null}function tq(e,t,n,i){let{myValue:r,patient:o}=i,{sex:s,age:a}=o??{};"field"===e.type&&void 0===r&&e.value&&(r=n[e.value.id]);let l=new tV;l.putObject("prevEnc",{value:i.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(t=>t.concept.uuid==e)}});let c=i?.visit??{},u=c?.visitType||{uuid:""},d=u.uuid??"",h={isEmpty:th.A};return{...new tN(e,o,t,n),...oK(),...i,...n,patient:o,myValue:r,sex:s,age:a,HD:l,visit:c,visitType:u,visitTypeUuid:d,_:h}}function tG(e){let t=tP(e);if(tz.has(t))return tz.get(t);let n=(0,a.compile)(e);return tz.set(t,n),n}function tK(e,t,n){for(let i of(0,a.extractVariableNames)(e)){let e=n.find(e=>e.id===i);e&&tF(t,e)}}function tY(e,t,n,i){return"embedded-view"==i||("automatic"==e?"maximized"==n&&t.endsWith("desktop"):"single-line"==e)}function tQ(e,t){let n=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,i=t.find(e=>e.id==n);i&&(i.fieldDependents||(i.fieldDependents=new Set)).add(e.id)}function tZ(e,t,n){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:i,referenceQuestionId:r}=e.required,o=t.find(e=>e.id==r);return!!o&&((o.fieldDependents||(o.fieldDependents=new Set)).add(e.id),i?.includes(n[r]))}function tJ(e,t,n,i,r,o){let{value:s}=e;return o(s.disabled?.disableWhenExpression,e,t,n,{mode:i,patient:r})}function tX(e,t,n,i,r,o,s){let{value:a,type:l}=e,c=o(a.hide?.hideWhenExpression,e,t,n,{mode:i,patient:r});e.value.isHidden=c,"field"==l&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=c}),"page"==l&&a.sections.forEach(e=>{e.isParentHidden=c,t0(c,e,t,s)}),"section"==l&&t0(c,a,t,s)}function t0(e,t,n,i){let r=t.questions.map(e=>e.id);n.filter(e=>r.includes(e.id)).forEach(t=>{t.isParentHidden=e,"group"==t.questionOptions.rendering&&t.questions.forEach(t=>{t.isParentHidden=e}),i?.(t)})}function t1(e,t){if(!e?.includes(":"))return t?.find(t=>t.uuid===e);{let[n,i]=e.split(":");return t?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===n.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===i.toUpperCase()))}}function t2(e,t=!1){let n=document.getElementById(e);n?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),t&&n?.focus()}let t4=(e,t)=>{let n=e.questionOptions.rendering;if("object"!=typeof t)return{value:t,display:t};let i="Observation"===t.resourceType?t5(t,n):t;if(!i)return{value:null,display:null};if("string"==typeof i.value||"number"==typeof i.value){if("date"===n||"datetime"===n){let e=ta(`${i.value}`);return{value:e,display:e4()(e).format("YYYY-MM-DD HH:mm")}}return{value:i.value,display:i.value}}return["toggle","checkbox"].includes(n)?{value:i.value?.uuid,display:i.value?.name?.name}:{value:i.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===i.value?.uuid)?.label}};function t3(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function t5(e,t){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:t9(e,t)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function t9(e,t){switch(t){case"toggle":return e.valueBoolean?{uuid:l.t$}:{uuid:l.Mi};case"date":case"datetime":return e.valueDateTime;case"number":return e.valueQuantity?.value??null;case"radio":case"checkbox":case"select":case"content-switcher":return e.valueCodeableConcept?.coding[0]?{uuid:e.valueCodeableConcept?.coding[0].code,name:{name:e.valueCodeableConcept?.coding[0].display}}:null;default:return e.valueString}}function t8(e,t){let n=e.pages.find(e=>t.meta.pageId===e.id);return n?.sections.find(e=>e.questions.find(e=>e.id===t.id))}var t6=n(10578);function t7(e,t){let{methods:{getValues:n}}=t,i=n();l.FU.includes(e.questionOptions.rendering)&&ne(e,i,t),nt(e,i,t)}function ne(e,t,n){let{sessionMode:i,formFields:r,patient:o,visit:s}=n;e.questionOptions.answers.forEach(n=>{let a=n.disable?.disableWhenExpression;a&&a.includes("myValue")&&(n.disable.isDisabled=tW(n.disable?.disableWhenExpression,{value:e,type:"field"},r,t,{mode:i,patient:o,visit:s}))})}function nt(e,t,n){let{sessionMode:i,formFields:r,patient:o,formFieldValidators:s,formJson:a,methods:{setValue:l},updateFormField:c,setForm:u,visit:d}=n,h=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let u=r.find(t=>t.id==e);if(u){if(u.questionOptions.calculate?.calculateExpression&&tB(u.questionOptions.calculate.calculateExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d}).then(e=>{l(u.id,e);let{errors:s,warnings:a}=nn(u,e,n.formFieldValidators,{formFields:r,values:t,expressionContext:{patient:o,mode:i}});u.meta.submission||(u.meta.submission={}),u.meta.submission.errors=s,u.meta.submission.warnings=a,s.length||n.formFieldAdapters[u.type].transformFieldValue(u,e,n),c(u)}).catch(e=>{(0,t6.N)(e,"Error evaluating calculate expression")}),u.hide){let e=t8(a,u),n=e?.questions.some(e=>!e.isHidden);if(tX({value:u,type:"field"},r,t,i,o,tW,c),e){e.questions=e?.questions.map(e=>e.id===u.id?u:e);let t=u.isHidden,i=[...e.questions,u].some(e=>!e.isHidden);n||t?n&&!i&&(e.isHidden=!0,h=!0):(e.isHidden=!1,h=!0)}}if("object"==typeof u.disabled&&u.disabled.disableWhenExpression&&(u.isDisabled=tJ({value:u,type:"field"},r,t,i,o,tW)),"object"==typeof u.required&&u.required?.type==="conditionalRequired"&&(u.isRequired=tZ(u,r,t)),u.validators?.some(e=>"conditionalAnswered"===e.type)){let e=u.validators?.find(e=>"conditionalAnswered"===e.type),n=s.conditionalAnswered.validate(u,u.meta.submission?.newValue,{...e,expressionContext:{patient:o,mode:i},values:t,formFields:r});u.meta.submission={...u.meta.submission,errors:n}}u?.questionOptions.answers?.filter(e=>!e6(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=tW(e.hide?.hideWhenExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})}),u?.questionOptions.answers?.filter(e=>!e6(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=tW(e.disable?.disableWhenExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})}),!u.isHidden&&u.meta.readonlyExpression&&(u.readonly=tW(u.meta.readonlyExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})),tn(u,"repeating")&&!e6(u.questionOptions.repeatOptions?.limitExpression)&&(u.questionOptions.repeatOptions.limit=tW(u.questionOptions.repeatOptions?.limitExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})),c(u)}}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let n=0;n<a.pages.length;n++){let s=a.pages[n].sections.find(t=>t.label==e);if(s){tX({value:s,type:"section"},r,t,i,o,tW,c),h=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{tX({value:a.pages.find(t=>t.label==e),type:"page"},r,t,i,o,tW,c),h=!0}),h&&u(a)}function nn(e,t,n,i){let r=[],o=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(s=>{let a=n[s.type]?.validate?.(e,t,{...s,...i});a&&a.forEach(e=>{"error"===e.resultType?r.push(e):"warning"===e.resultType&&o.push(e)})})}catch(e){console.error(e)}return{errors:r,warnings:o}}var ni=n(6232);let nr=u().createContext(void 0),no=({methods:e,children:t,...n})=>u().createElement(nr.Provider,{value:{...n,methods:e}},t),ns=()=>{let e=u().useContext(nr);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e},na="-esm-form-builder__value__value___GMGmn",nl="-esm-form-builder__value__item___U1v45",nc="-esm-form-builder__value__empty___sor36",nu=()=>{let{t:e}=(0,e0.useTranslation)();return u().createElement("div",null,u().createElement("span",{className:nc},"(",e("blank","Blank"),")"))},nd=({value:e})=>Array.isArray(e)?u().createElement(nh,{valueArray:e}):u().createElement("div",{className:na},e),nh=({valueArray:e})=>u().createElement("ul",null,e.map(e=>u().createElement("li",{className:nl},e))),np="-esm-form-builder__previous-value-review__formField___vrMDb",nf="-esm-form-builder__previous-value-review__row___XRir3",ng="-esm-form-builder__previous-value-review__value___OZCed",nm="-esm-form-builder__previous-value-review__reuseButton___mtoQ-",nv=({previousValue:e,displayText:t,field:n,hideHeader:i,onAfterChange:r})=>{let{t:o}=(0,e0.useTranslation)(),{methods:{setValue:s}}=ns(),a=t=>{t.preventDefault(),s(n.id,e),r(e)};return u().createElement("div",{className:np},u().createElement("div",{className:nf},!i&&u().createElement("div",null,o("previousValue","Previous value:")),u().createElement("div",{className:ng},u().createElement(nd,{value:t}))),u().createElement("div",{className:nm,role:"button",tabIndex:0,onClick:a},o("reuseValue","Reuse value")))},nb="-esm-form-builder__unspecified__unspecified___suBpN",ny=({field:e,fieldValue:t,setFieldValue:n,onAfterChange:i})=>{let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)(!1),{sessionMode:a,updateFormField:l}=ns();(0,c.useEffect)(()=>{e6(t)&&"edit"===a&&(s(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,c.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!e6(t))&&(e.meta.submission.unspecified=!1,l(e)),s(!!e.meta.submission?.unspecified)},[e.meta?.submission,e.meta.submission?.unspecified,t]);let d=(0,c.useCallback)(t=>{let r=e.questionOptions.rendering;if(t.target.checked){s(!0);let t="checkbox"===r?[]:"";ti(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],l(e),n(t),i(t)}else s(!1),e.meta.submission.unspecified=!1,l(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,ni.H)(e.readonly)&&!ts(a)&&u().createElement("div",{className:nb},u().createElement(g.Checkbox,{id:`${e.id}-unspecified`,labelText:r("unspecified","Unspecified"),value:r("unspecified","Unspecified"),onChange:d,checked:o,disabled:e.isDisabled}))};function nw(e,t,n,i){return!("embedded-view"===e&&n&&(t||i))}let nx="-esm-form-builder__form-field-renderer__unspecifiedContainer___Z9L4T",n$=({fieldId:e,valueAdapter:t,repeatOptions:n})=>{let[i,r]=(0,c.useState)(null),[o,s]=(0,c.useState)([]),[l,d]=(0,c.useState)([]),[h,p]=(0,c.useState)(null),g=ns(),m=!1;try{let e=(0,a.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});m=e?.hideUnansweredQuestionsInReadonlyForms??!1}catch(e){console.warn("Failed to load @openmrs/esm-form engine-app config - using hideUnansweredQuestionsInReadonlyForms=false (empty fields will be visible in readonly mode): ",e)}let{methods:{control:v,getValues:b,getFieldState:y},patient:w,sessionMode:x,formFields:$,formFieldValidators:_,addInvalidField:S,removeInvalidField:M,updateFormField:C}=g,E=(0,c.useRef)(null),k=es({control:v,name:e,exact:!0}),A=()=>{},T=(0,c.useMemo)(()=>$.find(t=>t.id===e),[e,$]);(0,c.useEffect)(()=>{if(tn(T,"repeating")&&n?.targetRendering?oV(n.targetRendering).then(e=>{e&&r({value:e})}):oz(T).then(e=>{e&&r({value:e})}),"enter"===x&&(T.historicalExpression||g.previousDomainObjectValue))try{g.processor.getHistoricalValue(T,g).then(e=>{p(e)})}catch(e){console.error(e)}},[]),(0,c.useEffect)(()=>{let{isDirty:e,isTouched:n}=y(T.id),{submission:i,unspecified:r}=T.meta,{calculate:o,defaultValue:s}=T.questionOptions;!e6(k)&&!i?.newValue&&!e&&!r&&(o?.calculateExpression||s)&&t.transformFieldValue(T,k,g);let a=E.current;E.current=null,(e||n)&&(!a||!(0,f.A)(a.value,k))&&L(k)},[k]),(0,c.useEffect)(()=>{T.meta.submission?.errors&&s(T.meta.submission.errors),T.meta.submission?.warnings&&d(T.meta.submission.warnings),T.meta.submission?.unspecified&&(s([]),M(T.id))},[T.meta.submission]);let L=e=>{T.meta.submission?.unspecified&&!e6(e)&&(T.meta.submission.unspecified=!1);let{errors:n,warnings:i}=nn(T,e,_,{formFields:$,values:b(),expressionContext:{patient:w,mode:x}});if(T.meta.submission&&(T.meta.submission.errors=void 0,T.meta.submission.warnings=void 0),o.length&&!n.length?(M(T.id),s([])):n.length&&(s(n),S(T)),n.length||t.transformFieldValue(T,e,g),d(i),t7(T,g),T.meta.groupId){let e=$.find(e=>e.id===T.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===T.id?T:e),C(e))}},O=e=>{E.current={value:e},L(e)};if(!i)return null;let R=i.value;return!n?.targetRendering&&nM(T.questionOptions.rendering)?u().createElement(R,{key:T.id,field:T,value:null,errors:o,warnings:l,setFieldValue:null}):nw(x,!!T.questionOptions.isTransient,e6(k),m)?u().createElement(e1.tH,{FallbackComponent:n_,onReset:A},u().createElement(el,{control:v,name:T.id,render:({field:{value:e,onChange:t,onBlur:n}})=>u().createElement("div",null,u().createElement(R,{key:`${T.id}-input-component`,field:T,value:e,errors:o,warnings:l,setFieldValue:e=>{t(e),O(e),n()}}),nS(T)&&u().createElement("div",{className:nx},T.unspecified&&u().createElement(ny,{key:`${T.id}-unspecified`,field:T,setFieldValue:t,onAfterChange:O,fieldValue:e})),h?.value&&u().createElement("div",null,u().createElement(nv,{key:`${T.id}-previous-value-review`,previousValue:h.value,displayText:h.display,onAfterChange:O,field:T})))})):null};function n_({error:e}){let{t}=(0,e0.useTranslation)();return u().createElement(g.ToastNotification,{"aria-label":t("closesNotification","Closes notification"),caption:"",hideCloseButton:!0,lowContrast:!0,onClose:function(){},onCloseButtonClick:function(){},statusIconDescription:t("notification","Notification"),subtitle:e.message,title:t("errorRenderingField","Error rendering field")})}function nS(e){let{rendering:t}=e.questionOptions;return(0,ni.H)(e.unspecified)&&"toggle"!=t&&"group"!=t&&"repeating"!=t&&"markdown"!=t&&"extension-widget"!=t&&"workspace-launcher"!=t}function nM(e){return"group"===e||"repeating"===e}let nC=({field:e,...t})=>{let{t:n}=(0,e0.useTranslation)(),{formFieldAdapters:i,formFields:r}=ns(),o=(0,c.useMemo)(()=>e.questions.map(e=>r.find(t=>t.id===e.id)).filter(e=>!e.isHidden).map((n,r)=>{let o=`${n.id}_${r}`;return n.id===e.id?u().createElement(n_,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===n.type&&nM(n.questionOptions.rendering)?u().createElement("div",{key:o,className:p.nestedGroupContainer},u().createElement(nC,{field:n,...t})):i[n.type]?u().createElement("div",{className:h()(p.flexColumn),key:o},u().createElement("div",{className:p.groupContainer},u().createElement(n$,{fieldId:n.id,valueAdapter:i[n.type]}))):void 0}),[e,r]);return u().createElement("div",{className:p.groupContainer},o.length>1?u().createElement(g.FormGroup,{legendText:n(e.label),className:p.boldLegend},o):o)},nE=nC,nk="-esm-form-builder__label__label___hCNId",nA=({value:e,tooltipText:t})=>u().createElement("div",{className:nk},u().createElement(g.DefinitionTooltip,{autoAlign:!0,tabIndex:0,definition:t??""},u().createElement("span",{className:"cds--label"},`${e}:`))),nT="-esm-form-builder__field-value-view__formField___03eTm",nL="-esm-form-builder__field-value-view__readonly___EsDxp",nO="-esm-form-builder__field-value-view__value___Uo2uV",nR="-esm-form-builder__field-value-view__inlineFlexRow___b4Ii6",nD="-esm-form-builder__field-value-view__inlineFlexColumn___9opmW",nI=({label:e,conceptName:t,value:n,isInline:i})=>u().createElement(u().Fragment,null,i?u().createElement("div",{className:nR},u().createElement("div",{className:nD},u().createElement(nA,{value:e,tooltipText:t})),u().createElement("div",{className:nD},e6(n)?u().createElement(nu,null):u().createElement(nd,{value:n}))):u().createElement("div",{className:nL},u().createElement("div",{className:nT},u().createElement(nA,{value:e,tooltipText:t}),u().createElement("div",{className:nO},e6(n)?u().createElement(nu,null):u().createElement(nd,{value:n}))))),nj="-esm-form-builder__content-switcher__formField___7p+cd",nN="-esm-form-builder__content-switcher__errorLegend___Wo7IC",nP="-esm-form-builder__content-switcher__boldedLegend___ocVuA",nF="-esm-form-builder__content-switcher__selectedOption___Nhf+y";var nU=n(31362);let nV="-esm-form-builder__field-label__required___v5kNF",nz="-esm-form-builder__field-label__questionLabel___iTCWA",nH="-esm-form-builder__field-label__tooltipIcon___i1hW9",nW=({field:e,children:t})=>{let{t:n}=(0,e0.useTranslation)();return e.questionInfo?u().createElement(g.Tooltip,{autoAlign:!0,label:n(e.questionInfo)},u().createElement("div",null,t)):u().createElement(u().Fragment,null,t)},nB=({field:e,customLabel:t})=>{let{t:n}=(0,e0.useTranslation)(),i=!!e.questionInfo,r=t||n(e.label);return u().createElement(nW,{field:e},u().createElement("div",{className:nz,"data-testid":`${e.id}-label`},u().createElement("span",null,r),e.isRequired&&u().createElement("span",{title:n("required","Required"),className:nV},"*"),i&&u().createElement(nU.$$,{size:16,"aria-hidden":"true",className:nH,"data-testid":`${e.id}-information-icon`})))},nq=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=ns(),p=(0,c.useCallback)(e=>{r(e.name)},[r]),f=(0,c.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),m=(0,c.useMemo)(()=>f.findIndex(e=>e.concept==t),[t,f]),v=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a||(0,ni.H)(e.readonly)?u().createElement("div",{className:nj},u().createElement(nI,{label:o(e.label),value:t?d[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:v})):!e.isHidden&&u().createElement(g.FormGroup,{legendText:u().createElement("div",{className:nP},u().createElement(nB,{field:e})),className:h()({[nN]:n.length>0,[nP]:0===n.length})},u().createElement(g.ContentSwitcher,{onChange:p,selectedIndex:m,className:nF,size:"md"},f.map((t,n)=>u().createElement(g.Switch,{name:t.concept||t.value,text:o(t.label),key:n,disabled:e.isDisabled}))))},nG="-esm-form-builder__date__datePickerWarn___kHnXv",nK="-esm-form-builder__date__datePickerLabel___jB51j",nY="-esm-form-builder__date__boldedLabel___iRLd7",nQ="-esm-form-builder__date__datetime___Vcy8S",nZ="-esm-form-builder__date__datePickerSpacing___qjcEN",nJ="-esm-form-builder__date__timeInput___LsT4x",nX=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),[s,l]=(0,c.useState)(""),{layoutType:d,sessionMode:p,workspaceLayout:f}=ns(),m=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(p)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,d,f,p),[p,e.readonly,e.inlineRendering,d,f]),v=(0,c.useCallback)(e=>{b(e,s),r(e)},[r,s]),b=(0,c.useCallback)((e,t)=>{if(!e6(t)){let[n,i]=t.split(":").map(Number);e.setHours(n??0,i??0)}},[]),y=(0,c.useCallback)(n=>{let i=n.target.value;l(i);let o="timer"===e.datePickerFormat?new Date:new Date(t);b(o,i),r(o)},[r,b,t]);(0,c.useEffect)(()=>{t&&t instanceof Date&&l([10>t.getHours()?`0${t.getHours()}`:`${t.getHours()}`,10>t.getMinutes()?`0${t.getMinutes()}`:`${t.getMinutes()}`].join(":"))},[t]);let w=(0,c.useMemo)(()=>"timer"===e.datePickerFormat?u().createElement(nB,{field:e}):u().createElement(nB,{field:e,customLabel:o("time","Time")}),[e.datePickerFormat,e.label,o]);return"view"==p||"embedded-view"==p||(0,ni.H)(e.readonly)?u().createElement(nI,{label:o(e.label),value:t instanceof Date?tc(e,t):t,conceptName:e.meta?.concept?.display,isInline:m}):!e.isHidden&&u().createElement("div",{className:nQ},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&u().createElement("div",{className:nZ},u().createElement(g.Layer,null,u().createElement(a.OpenmrsDatePicker,{id:e.id,onChange:v,labelText:u().createElement("span",{className:nK},u().createElement(nB,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,ni.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:n.length>0,invalidText:n[0]?.message,value:t})),i.length>0?u().createElement("div",{className:nG},i[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?u().createElement("div",null,u().createElement(g.Layer,null,u().createElement(g.TimePicker,{className:h()(nY,nJ),id:e.id,labelText:w,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!t,invalid:n.length>0,invalidText:n[0]?.message,readOnly:(0,ni.H)(e.readonly),warning:i.length>0,warningText:i[0]?.message,value:s||(t instanceof Date?t.toLocaleDateString(window.navigator.language):t),onChange:y}))):null)},n0=({field:e,setFieldValue:t})=>{let n=ns();return(0,c.useEffect)(()=>{e.meta?.initialValue?.omrsObject||e6(e.meta.fixedValue)||(t(e.meta.fixedValue),n.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,n))},[]),u().createElement(u().Fragment,null)};var n1=n(29012);let n2="-esm-form-builder__markdown-wrapper__markdownWrapper___l1Syp",n4={a:({node:e,...t})=>u().createElement("a",{...t,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},n3=({markdown:e})=>u().createElement("div",{className:n2},u().createElement(n1.o,{children:e,unwrapDisallowed:!0,allowedElements:["h1","h2","h3","h4","h5","h6","p","strong","em","code","pre","ul","ol","li","a","blockquote","hr","br"],components:n4})),n5=({field:e})=>{let{t}=(0,e0.useTranslation)(),n=e=>Array.isArray(e)?e.map(e=>t(e,{defaultValue:e,interpolation:{escapeValue:!1}})).join("\n\n"):"string"==typeof e?t(e,{defaultValue:e,interpolation:{escapeValue:!1}}):e;return!e.isHidden&&u().createElement(n3,{markdown:n(e.value)})},n9={boldedLabel:"-esm-form-builder__multi-select__boldedLabel___S2peR",errorLabel:"-esm-form-builder__multi-select__errorLabel___E6HgK",selectionDisplay:"-esm-form-builder__multi-select__selectionDisplay___ToQER",tagContainer:"-esm-form-builder__multi-select__tagContainer___rt9TQ",checkbox:"-esm-form-builder__multi-select__checkbox___+3cXj"},n8=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=ns(),[h,p]=(0,c.useState)(0),[f,m]=(0,c.useState)([]),v=(0,c.useRef)(!0),b=e.questionOptions.answers.filter(e=>!e.isHidden).map((t,n)=>({id:`${e.id}-${t.concept}`,concept:t.concept,label:o(t.label),key:n,disabled:t.disable?.isDisabled,readonly:(0,ni.H)(e.readonly)})),y=(0,c.useMemo)(()=>t?.length&&h<1?(p(h+1),b.filter(e=>t?.includes(e.concept))):[],[t]),w=({selectedItems:e})=>{r(e.map(e=>e.concept))},x=(0,c.useMemo)(()=>(0,ni.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,c.useEffect)(()=>{v.current&&1===h&&(m(y.map(e=>e.concept)),v.current=!1)},[y,v]);let $=e=>{let t,n=e.concept;m(t=f.some(e=>e===n)?f.filter(e=>e!==n):f.some(e=>e===n)?f.filter(e=>e!==n):[...f,n]),r(t)},_=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a?u().createElement("div",{className:n9.formField},u().createElement(nI,{label:o(e.label),value:t?d[e.type]?.getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:_})):!e.isHidden&&u().createElement(u().Fragment,null,u().createElement("div",{className:n9.boldedLabel},u().createElement(g.Layer,null,x?u().createElement(g.FilterableMultiSelect,{disabled:e.isDisabled,id:e.id,initialSelectedItems:y,invalid:n.length>0,invalidText:n[0]?.message,items:b,itemToString:e=>e?o(e.label):" ",key:e.id,onChange:w,placeholder:o("search","Search")+"...",readOnly:(0,ni.H)(e.readonly),titleText:u().createElement(nB,{field:e}),warn:i.length>0,warnText:i[0]?.message}):u().createElement(g.CheckboxGroup,{legendText:u().createElement(nB,{field:e}),readOnly:(0,ni.H)(e.readonly)},b?.map((t,n)=>u().createElement(g.Checkbox,{className:n9.checkbox,checked:f.some(e=>e===t.concept),disabled:t.disabled,id:`${e.id}-${t.concept}`,key:`${e.id}-${t.concept}-${n}`,labelText:o(t.label),name:t.concept,onChange:()=>$(t),readOnly:(0,ni.H)(e.readonly)}))))),x&&u().createElement("div",{className:n9.selectionDisplay},t?.length?u().createElement("div",{className:n9.tagContainer},d[e.type]?.getDisplayValue(e,t)?.map((e,t)=>u().createElement(g.Tag,{key:t,type:"cool-gray"},o(e)))):u().createElement(nu,null)))},n6={boldedLabel:"-esm-form-builder__number__boldedLabel___knlll",errorLabel:"-esm-form-builder__number__errorLabel___nt7Zx",controlWidthConstrained:"-esm-form-builder__number__controlWidthConstrained___dJyLz"},n7=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l}=ns(),d=(0,c.useMemo)(()=>isNaN(t)?"":t??"",[t]),p=(0,c.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),f=(0,c.useCallback)((e,{value:t})=>{let n=p(t);r(isNaN(n)?void 0:n)},[r,p]),m=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]),v=p(e.questionOptions.max),b=p(e.questionOptions.min);return"view"==a||"embedded-view"==a?u().createElement("div",{className:n6.formField},u().createElement(nI,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:m})):!e.isHidden&&u().createElement(g.Layer,null,u().createElement(g.NumberInput,{id:e.id,invalid:n.length>0,invalidText:n[0]?.message,label:u().createElement(nB,{field:e}),max:v,min:b,name:e.id,value:d,onChange:f,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,ni.H)(e.readonly),className:h()(n6.controlWidthConstrained,n6.boldedLabel),warn:i.length>0,warnText:i[0]?.message,step:e.questionOptions.step??.01}))},ie="-esm-form-builder__radio__boldedLegend___MaNSB",it="-esm-form-builder__radio__errorMessage___oqROk",ii=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=ns(),h=e=>{r(e)},p=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a||(0,ni.H)(e.readonly)?u().createElement(nI,{label:o(e.label),value:t?d[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:p}):!e.isHidden&&u().createElement(g.FormGroup,{legendText:u().createElement(nB,{field:e}),className:ie,disabled:e.isDisabled,invalid:n?.length>0},u().createElement(g.RadioButtonGroup,{name:e.id,valueSelected:t,onChange:h,readOnly:(0,ni.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((n,i)=>u().createElement(g.RadioButton,{id:`${e.id}-${n.label}`,labelText:o(n.label)??"",value:n.concept,key:i,onClick:e=>{t&&e.target.checked?(e.target.checked=!1,e.preventDefault(),h(null)):h(n.concept)}}))),(n?.length>0||i?.length>0)&&u().createElement("div",null,u().createElement("div",{className:it},n.length>0?n[0].message:i.length>0?i[0].message:null)))},ir="-esm-form-builder__dropdown__boldedLabel___y7U7P",io=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:d,formFieldAdapters:h}=ns(),p=(0,c.useCallback)(({selectedItem:e})=>{r(e===l.ZA?null:e)},[r]),f=(0,c.useCallback)(t=>{let n=e.questionOptions.answers.find(e=>e.value?e.value==t:e.concept==t);return n?o(n.label):""},[e.questionOptions.answers,o]),m=(0,c.useMemo)(()=>{let t=e.questionOptions.answers;return t.some(e=>e.value===l.ZA)||t.unshift({value:l.ZA,label:o("chooseAnOption","Choose an option")}),t.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),v=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,d,a),[a,e.readonly,e.inlineRendering,s,d]);return"view"==a||"embedded-view"==a?u().createElement(nI,{label:o(e.label),value:t?h[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:v}):!e.isHidden&&u().createElement("div",{className:ir},u().createElement(g.Layer,null,u().createElement(g.Dropdown,{"aria-label":o(e.label),disabled:e.isDisabled,id:e.id,invalid:n.length>0,invalidText:n[0]?.message,items:m,itemToString:f,label:"",onChange:p,readOnly:(0,ni.H)(e.readonly),selectedItem:e6(t)?l.ZA:t,titleText:u().createElement(nB,{field:e}),warn:i.length>0,warnText:i[0]?.message})))},is="-esm-form-builder__text-area__boldedLabel___SSRKf",ia=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),[s,a]=(0,c.useState)(t),{layoutType:l,sessionMode:d,workspaceLayout:h}=ns(),p=e=>{e.preventDefault(),s!==t&&a(t)},f=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(d)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,l,h,d),[d,e.readonly,e.inlineRendering,l,h]);return"view"==d||"embedded-view"==d?u().createElement(nI,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&u().createElement("div",{className:is},u().createElement(g.Layer,null,u().createElement(g.TextArea,{id:e.id,labelText:u().createElement(nB,{field:e}),name:e.id,onChange:r,onBlur:p,value:t||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,ni.H)(e.readonly),invalid:n.length>0,invalidText:n[0]?.message,warn:i.length>0,warnText:i[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))},il="-esm-form-builder__text__boldedLabel___LG-wl",ic=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l}=ns(),[d,h]=(0,c.useState)(null),p=e=>{e.preventDefault(),d!==t&&h(t)},f=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a?u().createElement(nI,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&u().createElement("div",{className:il},u().createElement(g.Layer,null,u().createElement(g.TextInput,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:n.length>0,invalidText:n[0]?.message,labelText:u().createElement(nB,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:p,onChange:e=>{r(e.target.value)},readOnly:(0,ni.H)(e.readonly),value:t??"",warn:i.length>0,warnText:i.length>0?i[0].message:void 0})))},iu="-esm-form-builder__toggle__boldedLabel___mj4Gi",id=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),s=ns(),a=e=>{r(e)};(0,c.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=s.sessionMode||s.formFieldAdapters[e.type].transformFieldValue(e,t??!1,s)},[]);let l=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(s.sessionMode)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,s.layoutType,s.workspaceLayout,s.sessionMode),[s.sessionMode,e.readonly,e.inlineRendering,s.layoutType,s.workspaceLayout]);return"view"==s.sessionMode||"embedded-view"==s.sessionMode?u().createElement(nI,{label:o(e.label),value:e6(t)?t:s.formFieldAdapters[e.type].getDisplayValue(e,t),conceptName:e.meta?.concept?.display,isInline:l}):!e.isHidden&&u().createElement("div",{className:iu},u().createElement(g.Toggle,{labelText:o(e.label),className:iu,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:a,toggled:!!t,disabled:e.isDisabled,readOnly:(0,ni.H)(e.readonly)}))};var ih=n(44861);let ip=[{name:"drug",datasource:{name:"drug_datasource",config:{class:"8d490dfc-c2cc-11de-8d13-0010c6dffd0f"}}},{name:"select-concept-answers",datasource:{name:"select_concept_answers_datasource",config:{concept:""}}},{name:"encounter-provider",datasource:{name:"provider_datasource"}},{name:"encounter-role",datasource:{name:"encounter_role_datasource"}},{name:"encounter-location",datasource:{name:"location_datasource"}},{name:"problem",datasource:{name:"problem_datasource",config:{class:["8d4918b0-c2cc-11de-8d13-0010c6dffd0f","8d492954-c2cc-11de-8d13-0010c6dffd0f","8d492b2a-c2cc-11de-8d13-0010c6dffd0f"]}}}],ig=e=>ip.find(t=>t.name===e),im=e=>{let t=e.questionOptions.config?.referencedField,{methods:{control:n}}=ns();return es({control:n,name:t,exact:!0,disabled:!t})},iv="-esm-form-builder__ui-select-extended__boldedLabel___nE2bK",ib="-esm-form-builder__ui-select-extended__loader___F1lqE",iy="-esm-form-builder__ui-select-extended__item___1+q74",iw="-esm-form-builder__ui-select-extended__code___Cd2IH",ix="-esm-form-builder__ui-select-extended__label___GOcHS",i$=({field:e,errors:t,warnings:n,setFieldValue:i})=>{let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)([]),[a,l]=(0,c.useState)(!1),[d,h]=(0,c.useState)(!1),[p,f]=(0,c.useState)(""),m=(0,c.useRef)(!1),[v,b]=(0,c.useState)(null),[y,w]=(0,c.useState)({}),x=im(e),$=(0,ni.H)(e.questionOptions.isSearchable),{layoutType:_,sessionMode:S,workspaceLayout:M,methods:{control:C,getFieldState:E,getValues:k}}=ns(),A=es({control:C,name:e.id,exact:!0}),{isDirty:T}=E(e.id),L=(0,c.useMemo)(()=>!!(ts(S)||(0,ni.H)(e.readonly))&&tY(e.inlineRendering,_,M,S),[S,e.readonly,e.inlineRendering,_,M]),O=(0,c.useMemo)(()=>o.find(e=>e.uuid==A)||null,[o,A]),R=(0,c.useRef)(0),D=(0,c.useMemo)(()=>(0,ih.A)((t,n)=>{let i=R.current;h(!0),n.fetchData(t,y).then(t=>{i===R.current&&(t.length&&s(i=>{let r=k(e.id),o=i.find(e=>e.uuid==r),s=t.map(e=>n.toUuidAndDisplay(e,y));return o&&!s.some(e=>e.uuid==o.uuid)&&s.unshift(o),s}),h(!1))}).catch(e=>{i===R.current&&(console.error(e),h(!1))})},300),[y,e.id,k]),I=(0,c.useCallback)(e=>o.some(t=>t.display?.toLowerCase().includes(e.toLowerCase())),[o]);return((0,c.useEffect)(()=>{let t=e.questionOptions?.datasource?.name;w(t?e.questionOptions.datasource?.config:ig(e.questionOptions.rendering)?.datasource?.config),oG(t||e.questionOptions.rendering).then(e=>b(e))},[e.questionOptions?.datasource]),(0,c.useEffect)(()=>{let t=!1;return v&&!(0,ni.H)(e.questionOptions.isSearchable)&&(s([]),l(!0),v.fetchData(null,{...y,referencedValue:x}).then(e=>{t||(s(e.map(e=>v.toUuidAndDisplay(e,y))),l(!1))}).catch(e=>{t||(console.error(e),l(!1),s([]))})),()=>{t=!0}},[v,y,x]),(0,c.useEffect)(()=>(v&&$&&!e6(p)&&!I(p)?D(p,v):h(!1),()=>{D.cancel(),R.current++}),[v,p,$,D]),(0,c.useEffect)(()=>{let e=!1;return A&&!T&&v&&$&&!o.length&&(l(!0),v.fetchSingleItem(A,y).then(t=>{e||(s([v.toUuidAndDisplay(t,y)]),l(!1))}).catch(t=>{e||(console.error(t),l(!1))})),()=>{e=!0}},[A,T,v,$,o,y]),a)?u().createElement(g.DropdownSkeleton,null):ts(S)||(0,ni.H)(e.readonly)?u().createElement(nI,{label:r(e.label),value:A?i_(o.find(e=>e.uuid==A)):A,conceptName:e.meta?.concept?.display,isInline:L}):!e.isHidden&&u().createElement("div",{className:iv},u().createElement(g.Layer,null,u().createElement(g.ComboBox,{id:e.id,titleText:u().createElement(nB,{field:e}),items:o,itemToElement:e=>u().createElement("span",{className:iy},e?.code&&u().createElement("span",{className:iw},e.code),u().createElement("span",{className:ix},e?.display)),itemToString:i_,selectedItem:O,placeholder:$?r("search","Search")+"...":null,onChange:({selectedItem:e})=>{D.cancel(),R.current++,h(!1),m.current=!0,i(e?.uuid)},disabled:e.isDisabled,readOnly:(0,ni.H)(e.readonly),invalid:t.length>0,invalidText:t.length&&t[0].message,onInputChange:t=>{if(m.current){m.current=!1;return}e.questionOptions.isSearchable&&f(t)},onBlur:e=>{e.target.value||i(null)}}),d&&u().createElement(g.InlineLoading,{className:ib,description:r("searching","Searching")+"..."})))};function i_(e){return e?.code?`${e.code} ${e.display}`:e?.display??""}let iS="-esm-form-builder__workspace-launcher__label___E9RiP",iM="-esm-form-builder__workspace-launcher__workspaceButton___MlMFr",iC="-esm-form-builder__workspace-launcher__noPatientNotification___28OZv",iE=({field:e})=>{let{t}=(0,e0.useTranslation)(),{sessionMode:n,patient:i,visit:r}=ns(),o=async()=>{let n=e.questionOptions?.workspaceName;if(!n)return void(0,a.showSnackbar)({title:t("invalidWorkspaceName","Invalid workspace name."),subtitle:t("invalidWorkspaceNameSubtitle","Please provide a valid workspace name."),kind:"error",isLowContrast:!0});let o=e.questionOptions?.workspaceProps??{},s={patient:i,patientUuid:i?.id,visitContext:r};try{await (0,a.launchWorkspace2)(n,o,s)}catch(e){(0,a.showSnackbar)({title:t("errorLaunchingWorkspace","Error launching workspace"),subtitle:e?.message??t("errorLaunchingWorkspaceSubtitle","An unexpected error occurred while launching the workspace."),kind:"error",isLowContrast:!0})}};return e.isHidden||ts(n)?null:u().createElement("div",null,u().createElement("div",{className:iS},u().createElement(nB,{field:e})),u().createElement("div",{className:iM},u().createElement(g.Button,{disabled:(0,ni.H)(e.readonly??!1)||!i,onClick:o},e.questionOptions.buttonLabel?t(e.questionOptions.buttonLabel):t("launchWorkspace","Launch Workspace")),!i&&u().createElement(g.InlineNotification,{className:iC,kind:"info",lowContrast:!0,hideCloseButton:!0,title:t("noPatientContext","No patient selected"),subtitle:t("noPatientContextSubtitle","This button is only active when a patient chart is open.")})))};var ik=n(20903);function iA(e,t,n){let i=[],r=(0,ik.A)(e);return r.questionOptions.repeatOptions={...r.questionOptions.repeatOptions??{}},r.meta={repeat:{...r.meta??{},isClone:!0},initialValue:{omrsObject:t}},r.id=`${r.id}_${n}`,r.questions?.forEach(e=>{i.push(e.id),e.id=`${e.id}_${n}`,e.meta.groupId=r.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,ti(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=iT(e.hide.hideWhenExpression,n,i)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=iT(e.failsWhenExpression,n,i))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=iT(e.questionOptions.calculate?.calculateExpression,n,i))}),r}function iT(e,t,n){let i=[...new Set(n)];if(!i.length)return e;let r=i.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return e.replace(RegExp(`\\b(?:${r})\\b`,"g"),e=>`${e}_${t}`)}function iL(e,t){let n=Number(e);return!(e6(e)||isNaN(n))&&t>=n}let iO=[],iR={async getInitialValue(e,t,n){let i=iz(tt((t??n.domainObjectValue).obs),iO,e);return tn(e,"file")&&i?.length?iH(e,i):iD(e,i,!0)},async getPreviousValue(e,t,n){let i=t??n.previousDomainObjectValue;if(i){let t=iD(e,iz(tt(i.obs),iO,e),!0);if(!e6(t))return{value:t,display:this.getDisplayValue(e,t)}}return null},getDisplayValue:(e,t)=>{let n=e.questionOptions.rendering;return e6(t)?t:t instanceof Date?tc(e,t):"checkbox"===n?t.map(t=>e.questionOptions.answers?.find(e=>e.concept==t)?.label):"toggle"===n?t?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:l.FU.includes(n)?e.questionOptions.answers?.find(e=>e.concept==t)?.label:t},transformFieldValue:(e,t,n)=>(ti(e),!e.meta.initialValue?.omrsObject&&e6(t))?null:tn(e,"checkbox")?iU(e,Array.isArray(t)?t:[t]):tn(e,"file")?iV(e,t):!e6(t)&&iF(e,t)?tr(e,iN(e,t),void 0):e.meta.initialValue?.omrsObject&&e6(t)?tr(e,void 0,ij(e.meta.initialValue.omrsObject)):e6(t)?null:tr(e,iI(e,t),void 0),tearDown:function(){iO=[]}};function iD(e,t=[],n=!1){let i=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),t.length){if("checkbox"==i)return iO.push(...t.map(e=>e.uuid)),e.meta.initialValue.omrsObject=n?t:null,t.map(e=>e.value.uuid);let r=t[0];if(n&&(e.meta.initialValue.omrsObject={...r}),iO.push(r.uuid),"string"==typeof r.value||"number"==typeof r.value){if(i.startsWith("date")){let t=ta(r.value);return n&&(e.meta.initialValue.omrsObject.value=e4()(t).format("YYYY-MM-DD HH:mm")),t}return r.value}return"toggle"==i?r.value.uuid===l.t$:"fixed-value"==i?e.fixedValue:r.value?.uuid}return""}function iI(e,t){return e6(t)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?iP(e,t):t},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function ij(e){return{uuid:e.uuid,voided:!0}}function iN(e,t){let n=e.meta.initialValue?.omrsObject,i=e.questionOptions.rendering.startsWith("date")?iP(e,t):t;return{uuid:n.uuid,value:i,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function iP(e,t){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return e4()(t).format("YYYY-MM-DD");case"timer":return e4()(t).format("HH:mm");case"both":return e4()(t).format("YYYY-MM-DD HH:mm")}return t}function iF(e,t){let n=e.meta.initialValue?.omrsObject;return!e6(n)&&(l.FU.includes(e.questionOptions.rendering)?n.value.uuid!==t:tn(e,"date")?0!==e4()(t).diff(e4()(n.value),"D"):tn(e,"datetime")||"both"===e.datePickerFormat?0!==e4()(t).diff(e4()(n.value),"minute"):tn(e,"toggle")?n.value.uuid===l.t$!==t:n.value!==t)}function iU(e,t=[]){let n=e.meta.initialValue?.omrsObject;if(n?.length&&e6(t))return tr(e,null,n.map(e=>ij(e)));if(n?.length&&!e6(t)){let i=n.filter(e=>!t.includes(e.value.uuid));return tr(e,t.filter(e=>!n.some(t=>t.value.uuid===e)).map(t=>iI(e,t)),i.map(e=>ij(e)))}return tr(e,t.map(t=>iI(e,t)),void 0)}function iV(e,t=[]){let n=t.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),i=e.meta.submission.newValue=t.filter(e=>!e.uuid).map(t=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...t}));return tr(e,i,n)}function iz(e,t,n){let i=e.filter(e=>!!tn(n,"file")&&e.formFieldPath==`rfe-forms-${n.id}`||e.formFieldPath==`rfe-forms-${n.id}`&&e.concept.uuid==n.questionOptions.concept);if(!i?.length){let i=e.filter(e=>e.concept.uuid==n.questionOptions.concept);return t?.length?i.filter(e=>!t.includes(e.uuid)):i}return i}async function iH(e,t){let n=new AbortController,i=await Promise.all(t.map(e=>(0,a.getAttachmentByUuid)(e.uuid,n).then(e=>e.data).catch(t=>(console.error(`Failed to fetch attachment ${e.uuid}:`,t),null))));return e.meta.initialValue={omrsObject:t},i.filter(Boolean).map(e=>({uuid:e.uuid,base64Content:`${window.openmrsBase}${a.attachmentUrl}/${e.uuid}/bytes`,fileName:e.filename,fileDescription:e.comment,fileType:e.bytesContentFamily?.toLowerCase()}))}let iW={validate:(e,t)=>!e6(t)&&l.FU.includes(e.questionOptions.rendering)&&!(Array.isArray(t)?t:[t]).every(t=>e.questionOptions.answers?.find(e=>e.concept===t||e.value===t))?[{resultType:"error",errCode:"invalid.defaultValue",message:"Value not found in coded answers list"}]:e6(t)||"date"!=e.questionOptions.rendering||e4()(t).isValid()?!e6(t)&&"number"==e.questionOptions.rendering&&isNaN(t)?[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid numerical value: '${t}'`}]:[]:[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid date value: '${t}'`}]},iB=[],iq="testorder",iG="6f0c9a92-6f24-11e3-af88-005056821db0",iK={transformFieldValue:function(e,t,n){if(ti(e),"edit"===n.sessionMode&&e.meta.initialValue?.omrsObject)return iQ(t,e,n.currentProvider.uuid);let i=iY(t,e,n.currentProvider.uuid);return tr(e,i,null),i},getInitialValue:function(e,t,n){let i=e.questionOptions.answers?.map(e=>e.concept)||[],r=t?.orders.filter(e=>!iB.includes(e.uuid)&&!e.voided).find(e=>i.includes(e.concept.uuid));return r?(e.meta={...e.meta||{},initialValue:{omrsObject:r,refinedValue:r.concept.uuid}},iB.push(r.uuid),r.concept.uuid):null},getPreviousValue:function(e,t,n){return null},getDisplayValue:(e,t)=>e.questionOptions.answers?.find(e=>e.concept==t)?.label||t,tearDown:function(){iB=[]}};function iY(e,t,n){return e?{action:"NEW",concept:e,type:t?.questionOptions?.orderType||iq,careSetting:t?.questionOptions?.orderSettingUuid||iG,orderer:n}:null}function iQ(e,t,n){let i=t.meta.initialValue?.omrsObject;if(e===i?.concept?.uuid)return null;let r={uuid:i?.uuid,voided:!0};return tr(t,iY(e,t,n),r),t.meta.submission.newValue||null}let iZ=[],iJ={transformFieldValue:function(e,t,n){if(ti(e),e.meta.initialValue?.omrsObject&&e6(t))return tr(e,void 0,i2(e.meta.initialValue.omrsObject));if(!e6(t)){let i=e.meta.initialValue?.omrsObject;if(i1(i,t))return tr(e,i0(t,e,i,n.patient.id),void 0)}let i=iX(t,e,n.patient.id);return tr(e,i,null),i},getInitialValue:function(e,t,n){let i=(t??n.domainObjectValue).diagnoses.find(t=>t.formFieldPath===`rfe-forms-${e.id}`);return i?(e.meta={...e.meta||{},initialValue:{omrsObject:i,refinedValue:i.diagnosis?.coded.uuid}},iZ.includes(i.diagnosis?.coded?.uuid)||iZ.push(i.diagnosis?.coded?.uuid),i.diagnosis?.coded.uuid):null},getPreviousValue:function(e,t,n){return null},getDisplayValue:(e,t)=>e.questionOptions.answers?.find(e=>e.concept==t)?.label||t,tearDown:function(){iZ=[]}},iX=(e,t,n)=>e?{patient:n,condition:null,diagnosis:{coded:e},certainty:(0,ni.H)(t.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:t.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${t.id}`,formFieldNamespace:"rfe-forms"}:null;function i0(e,t,n,i){return{patient:i,condition:null,diagnosis:{coded:e},certainty:(0,ni.H)(t.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:t.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${t.id}`,formFieldNamespace:"rfe-forms",uuid:n.uuid}}function i1(e,t){return!e6(e)&&e.value!==t}function i2(e){return{uuid:e.uuid,voided:!0}}function i4(e,t,n,i,r){let{patient:o,formJson:s,domainObjectValue:a,formFields:l,visit:c,deletedFields:u}=e,d=[...l,...u],h=[];rn(h,d);let p=rs(d),f=rh(d),g={};return a?(Object.assign(g,a),-1===g.encounterProviders.findIndex(e=>e.provider.uuid==i)&&(g.encounterProviders=[...g.encounterProviders,{provider:i,encounterRole:n}]),t&&(g.encounterDatetime=t),g.location=r,g.form={uuid:s.uuid},c&&(g.visit=c.uuid),g.obs=h,g.orders=p,g.diagnoses=f):(g={patient:o.id,location:r,encounterType:s.encounterType,encounterProviders:[{provider:i,encounterRole:n}],obs:h,form:{uuid:s.uuid},visit:c?.uuid,orders:p,diagnoses:f},t&&(g.encounterDatetime=t)),g}function i3(e,t){return e.filter(e=>"patientIdentifier"===e.type&&to(e)).map(e=>e.meta.submission.newValue)}function i5(e,t){return t.map(t=>(0,tM.savePatientIdentifier)(t,e.id))}function i9(e){return e.filter(e=>"personAttribute"===e.type&&to(e)).map(e=>e.meta.submission.newValue)}function i8(e,t){return t.map(t=>(0,tM.savePersonAttribute)(t,e.id))}function i6(e,t,n){let i=e.filter(e=>"programState"===e.type&&to(e)),r=new Map;return i.forEach(e=>{let i=e.questionOptions.programUuid,o=e.meta.submission.newValue,s=n.find(e=>e.program.uuid===i);s?r.has(i)?r.get(i).states.push(o):r.set(i,{uuid:s.uuid,states:[o]}):r.has(i)?r.get(i).states.push(o):r.set(i,{patient:t.id,program:i,states:[o],dateEnrolled:e4()().format()})}),Array.from(r.values())}function i7(e){let t=new AbortController;return Promise.all(e.map(e=>(0,tM.saveProgramEnrollment)(e,t)))}function re(e,t,n){let i=e?.filter(e=>e?.questionOptions.rendering==="file"&&to(e));return i?.length?Promise.all(i.flatMap(e=>{let n="string"==typeof t?.patient?t?.patient:t?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,tM.createAttachment)(n,t.uuid,e))})):[]}function rt(e){let{formFields:t,location:n,currentProvider:i,customDependencies:r,sessionDate:o,domainObjectValue:s,visit:a}=e,{defaultEncounterRole:l}=r,c=t.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||l?.uuid,u=t.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||i.uuid,d=t.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,h=a?.stopDatetime?o:void 0;return{encounterRole:c,encounterProvider:u,encounterDate:d??(s?.encounterDatetime?new Date(s.encounterDatetime):h),encounterLocation:t.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||s?.location?.uuid||n.uuid}}function rn(e,t){t.filter(e=>rc(e)).forEach(n=>ri(e,n,t))}function ri(e,t,n){rl(t)&&t.meta.initialValue.omrsObject?ro(e,t):"obsGroup"===t.type?rr(e,t,n):(tn(t,"file")||ra(e,t.meta.submission.newValue),ra(e,t.meta.submission.voidedValue))}function rr(e,t,n){if(t.meta.submission?.voidedValue)return void ra(e,t.meta.submission.voidedValue);let i=iI(t,null);t.meta.initialValue?.omrsObject&&(i.uuid=t.meta.initialValue.omrsObject.uuid),t.questions.forEach(e=>{let t=n.find(t=>t.id===e.id)??e;if(rl(t))ro(i.groupMembers,t);else if("obsGroup"===t.type){let e=[];rr(e,t,n),ra(i.groupMembers,e)}else to(t)&&(ra(i.groupMembers,t.meta.submission.newValue),ra(i.groupMembers,t.meta.submission.voidedValue))}),(i.groupMembers?.length||i.voided)&&ra(e,i)}function ro(e,t){let n=t.meta.initialValue?.omrsObject;n&&ra(e,(Array.isArray(n)?n:[n]).map(e=>ij(e)))}function rs(e){return e.filter(e=>"testOrder"===e.type&&to(e)).flatMap(e=>rl(e)?[e.meta.submission.newValue?void 0:e.meta.submission.voidedValue]:[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function ra(e,t){t&&(Array.isArray(t)?e.push(...t):e.push(t))}function rl(e){return!!(e.isHidden||e.isParentHidden)}function rc(e){let{questionOptions:{isTransient:t},type:n}=e;return!t&&!!["obs","obsGroup"].includes(n)&&!e.meta.groupId&&(!!(rl(e)&&e.meta.initialValue?.omrsObject)||!rl(e)&&("obsGroup"===n||to(e)))}function ru(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==l.t$;let t=iW.validate(e,e.questionOptions.defaultValue);return t.length?(console.error(`Default value validation errors for field "${e.id}" with value "${e.questionOptions.defaultValue}":`,t),null):e.questionOptions.defaultValue}async function rd(e,t,n,i){let r=1,{formFieldAdapters:o}=i,s=t.obs.filter(t=>t.concept.uuid===e.questionOptions.concept&&t.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!iO.includes(t.uuid)),a=t.orders.filter(t=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(t.concept?.uuid)&&!iB.includes(t.uuid));if("testOrder"===e.type)return Promise.all(a.filter(e=>!e.voided).map(async t=>{let s=iA(e,t,r++);return n[s.id]=await o[e.type].getInitialValue(s,{orders:[t]},i),s}));let l=t.diagnoses.filter(t=>!t.voided&&!iZ.includes(t?.diagnosis?.coded.uuid)&&t.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(l.map(async t=>{let r=parseInt(t.formFieldPath.split("_")[1]),s=iA(e,t,r);return n[s.id]=await o[e.type].getInitialValue(s,{diagnoses:[t]},i),iZ.includes(t.diagnosis.coded.uuid)||iZ.push(t.diagnosis.coded.uuid),s})):Promise.all(s.map(async t=>{let s=iA(e,t,r++);return await Promise.all(s.questions.map(async r=>{n[r.id]=await o[e.type].getInitialValue(r,{obs:[t]},i)})),iO.push(t.uuid),[s,...s.questions]})).then(e=>e.flat())}function rh(e){return e.filter(e=>"diagnosis"===e.type&&to(e)).map(e=>rl(e)?e.meta.submission.newValue?void 0:e.meta.submission.voidedValue:e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function rp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class rf{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,t,n){return Promise.resolve({})}constructor(e){rp(this,"formJson",void 0),rp(this,"domainObjectValue",void 0),this.formJson=e}}var rg=n(45278),rm=n(18348),rv=n(92049),rb=n(53098),ry="[object String]";let rw=function(e){return"string"==typeof e||!(0,rv.A)(e)&&(0,rb.A)(e)&&(0,rm.A)(e)==ry};function rx(e){let[t,n]=(0,c.useState)(null),[i,r]=(0,c.useState)(!0),[o,s]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let t=new AbortController;return!e6(e.encounter)&&rw(e.encounter)?(0,a.openmrsFetch)(`${a.restBaseUrl}/encounter/${e.encounter}?v=${l.RZ}`,{signal:t.signal}).then(e=>{n(e.data),r(!1)}).catch(e=>{s(e)}):(e6(e.encounter)||n(e.encounter),r(!1)),()=>{t.abort()}},[e.encounter]),{encounter:t,error:o,isLoading:i}}var r$=n(66148),r_=n.n(r$);function rS(){let{data:e,error:t,isLoading:n}=r_()(`${a.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,a.openmrsFetch),i=e?.data.results.find(e=>"Clinician"===e.name);return i?{encounterRole:i,error:t,isLoading:n}:{encounterRole:e?.data.results[0],error:t,isLoading:n}}var rM=n(73391),rC=n.n(rM);let rE=e=>{let t="custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,state:(uuid,name,retired,concept:(uuid),programWorkflow:(uuid)))",n=`${a.restBaseUrl}/programenrollment?patient=${e}&v=${t}`,{data:i,error:r,isLoading:o}=rC()(e?n:null,a.openmrsFetch),s=i?.data?.results.length>0?i?.data.results.sort((e,t)=>t.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:s?.filter(e=>!e.dateCompleted),error:r,isLoading:o}},rk=(e,t)=>{let{activePrograms:n,error:i,isLoading:r}=rE(t.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:n,errorFetchingPatientPrograms:i,isLoadingPatientPrograms:r}};function rA(e){let[t,n]=(0,c.useState)(!0),{encounter:i,isLoading:r}=rx(e.formJson),{encounterRole:o,isLoading:s}=rS(),{isLoadingPatientPrograms:a,patientPrograms:l}=rk(e.patient?.id,e.formJson);return(0,c.useEffect)(()=>{n(a||r||s)},[a,r,s]),{data:{encounter:i,patientPrograms:l,encounterRole:o},isLoading:t,error:null,updateContext:(t,{setDomainObjectValue:n,setCustomDependencies:r})=>{e.processor.domainObjectValue=i,n(i),r(e=>({...e,patientPrograms:l,defaultEncounterRole:o}))}}}let rT={checkbox:[],toggle:!1,text:""},rL=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class rO extends rf{prepareFormSchema(e){let t=new Set;function n(e,i,r,o){e.id&&t.add(e.id),e.inlineRendering=e.inlineRendering??i.inlineRendering??r.inlineRendering??o.inlineRendering,e.readonly=e.readonly??i.readonly??r.readonly??o.readonly,e.questionOptions?.rendering!="fixed-value"||e.meta.fixedValue||(e.meta.fixedValue=e.value,delete e.value),(e.questionOptions?.rendering=="group"||"obsGroup"===e.type)&&e.questions?.forEach(t=>(t.readonly=t.readonly??e.readonly,n(t,i,r,o)))}return e.pages.forEach(t=>{t.sections.forEach(i=>{i.questions.forEach(r=>{n(r,i,t,e)})})}),rD(e,t),e}async processSubmission(e,t){let{encounterRole:n,encounterProvider:i,encounterDate:r,encounterLocation:o}=rt(e),s=(e,t,n)=>(0,a.translateFrom)(rg.L,e,t,n),l=i3(e.formFields,o),c=i4(e,r,n,i,o);try{await Promise.all(i5(e.patient,l)),l?.length&&(0,a.showSnackbar)({title:s("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,t6.j)(t);return Promise.reject({title:s("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let t=i9(e.formFields);await Promise.all(i8(e.patient,t)),t?.length&&(0,a.showSnackbar)({title:s("personAttributesSaved","Person attribute(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,t6.j)(t);return Promise.reject({title:s("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let t=i6(e.formFields,e.patient,e.customDependencies.patientPrograms),n=await await i7(t);n?.length&&(0,a.showSnackbar)({title:s("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,t6.j)(t);return Promise.reject({title:s("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:n}=await (0,tM.saveEncounter)(t,c,c.uuid),i=n.orders.map(e=>e.orderNumber),r=n.diagnoses.map(e=>e.display);i.length&&(0,a.showSnackbar)({title:s("ordersSaved","Order(s) saved successfully"),subtitle:i.join(", "),kind:"success",isLowContrast:!0}),r.length&&(0,a.showSnackbar)({title:s("diagnosisSaved","Diagnosis(es) saved successfully"),subtitle:r.join(", "),kind:"success",isLowContrast:!0});try{let i=await re(e.formFields,n,t);i?.length&&(0,a.showSnackbar)({title:s("attachmentsSaved","Attachment(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){console.error("Error saving attachments",t);let e=(0,t6.j)(t);return Promise.reject({title:s("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return n}catch(t){console.error("Error saving encounter",t);let e=(0,t6.j)(t);return Promise.reject({title:s("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:rA}}async getInitialValues(e){let{domainObjectValue:t,formFields:n,formFieldAdapters:i}=e,r={},o=[];if(t){await Promise.all(n.map(async n=>{let s=i[n.type];if(n.meta.initialValue?.omrsObject&&!e6(n.meta.initialValue.refinedValue)){r[n.id]=n.meta.initialValue.refinedValue;return}if(s){tn(n,"repeating")&&!n.meta?.repeat?.isClone&&o.push(n);let i=null;try{i=await s.getInitialValue(n,t,e),n.meta.initialValue.refinedValue=i}catch(e){console.error(e)}if("obsGroup"===n.type)return;if(e6(i)?e6(n.questionOptions.defaultValue)?r[n.id]=rT[n.questionOptions.rendering]??"":r[n.id]=ru(n):r[n.id]=i,n.questionOptions.calculate?.calculateExpression)try{await rR(n,r,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${n.type}`)}));let s=await Promise.all(o.flatMap(n=>rd(n,t,r,e))).then(e=>e.flat());n.push(...s)}else{let t=n.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),o=[];await Promise.all(t.map(async t=>{let n=i[t.type];if(r[t.id]=rT[t.questionOptions.rendering]??null,e6(r[t.id])&&rL.includes(t.type))try{r[t.id]=await n.getInitialValue(t,null,e)}catch(e){console.error(e)}t.questionOptions.defaultValue&&(r[t.id]=ru(t)),t.questionOptions.calculate?.calculateExpression&&o.push(t)})),await Promise.all(o.map(async t=>{try{await rR(t,r,e)}catch(e){console.error(e)}}))}return r}async loadDependencies(e,t,{setPreviousDomainObjectValue:n}){let{patient:i,formJson:r}=e;return n(await (0,tM.getPreviousEncounter)(i?.id,r.encounterType)),e}async getHistoricalValue(e,t){let{formFields:n,sessionMode:i,patient:r,methods:{getValues:o},formFieldAdapters:s,previousDomainObjectValue:a,visit:l}=t,c={value:e,type:"field"},u=s[e.type];if(e.historicalExpression){let t=await tB(e.historicalExpression,c,n,o(),{mode:i,patient:r,previousEncounter:a,visit:l});return t?t4(e,t):null}return a&&e.questionOptions.enablePreviousValue?await u.getPreviousValue(e,a,t):null}}async function rR(e,t,n){let{formFields:i,sessionMode:r,patient:o,visit:s}=n,a=e.questionOptions.calculate.calculateExpression,l={value:e,type:"field"},c={mode:r,patient:o,visit:s},u=await tB(a,l,i,t,c);e6(u)||(t[e.id]=u)}function rD(e,t){let n=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function i(e,i){for(let r of e.matchAll(n)){let e=r[2];t.has(e)&&console.error(`The calculateExpression for the field '${i}' incorrectly quotes the field ID '${e}' as a string. Field IDs must be referenced as variables without quotes to access their values. Remove the quotes: use ${e} instead of '${e}'.`)}}function r(e){e.questionOptions?.calculate?.calculateExpression&&i(e.questionOptions.calculate.calculateExpression,e.id),e.questions&&e.questions.forEach(r)}e.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(r)})})}var rI=n(77541);function rj(e){let{formFields:t,formFieldValidators:n,patient:i,sessionMode:r,addInvalidField:o,updateFormField:s,methods:{getValues:a,trigger:l}}=e,c=a();return 0===t.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(a=>{let l=n[a.type];if(l){let n=l.validate(e,c[e.id],{formFields:t,values:c,expressionContext:{patient:i,mode:r},...a}).filter(e=>"error"===e.resultType);return n.length&&(e.meta.submission={...e.meta.submission,errors:n},s(e),o(e)),n}})).filter(e=>!!e).length}async function rN(e,t,n,i,r){return Promise.all(e.map(async({postAction:e,config:o,actionId:s,enabled:l})=>{try{let r=[];if(t)if(t.forEach(e=>{e?.data&&r.push(e.data),e?.uuid&&r.push(e)}),r.length)(!l||(0,rI.g)(l,r))&&await e.applyAction({patient:n,sessionMode:i,encounters:r},o);else throw Error("No encounter data to process post submission action");else throw Error("No handlers available to process post submission action")}catch(t){let e=(0,t6.j)(t);(0,a.showSnackbar)({title:String(r("errorDescriptionTitle",s?s.replace(/([a-z])([A-Z])/g,"$1 $2"):"Post Submission Error")),subtitle:String(r("errorDescription","{{errors}}",{errors:e.join(", ")})),kind:"error",isLowContrast:!1})}}))}function rP({patientUuid:e,formUuid:t,setIsSubmitting:n,setIsValidating:i}){let{t:r}=(0,e0.useTranslation)();(0,c.useEffect)(()=>{let o=o=>{let{formUuid:s,patientUuid:a,action:l}=o.detail;if(!l||!s||!a)return void(0,t6.N)(Error("The form action event is missing required details (formUuid, patientUuid, or action)."),r("formActionFailed","Form action failed"));if(s===t&&a===e)switch(l){case"onSubmit":n(!0);break;case"validateForm":i(!0);break;default:(0,t6.N)(Error(`Unsupported form action: "${l}"`),r("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",o),()=>{window.removeEventListener("ampath-form-action",o)}},[n,i,t,e])}function rF(e){let[t,n]=(0,c.useState)([]);return(0,c.useEffect)(()=>{let t=[];e?.length&&e.map(e=>{let n="string"==typeof e?e:e.actionId;oB(n)?.then(i=>t.push({postAction:i,config:e.config,actionId:n,enabled:e.enabled}))}),n(t)},[e]),t}let rU=(0,c.createContext)(void 0),rV=({patient:e,patientUUID:t,sessionMode:n,sessionDate:i,formJson:r,workspaceLayout:o,location:s,provider:l,visit:d,isFormExpanded:h=!0,children:p,isLoadingDependencies:f=!1,formSubmissionProps:g,hideFormCollapseToggle:m,handleConfirmQuestionDeletion:v,setIsFormDirty:b})=>{let{t:y}=(0,e0.useTranslation)(),w=(0,c.useRef)(void 0),x=(0,c.useRef)({}),$=(0,a.useLayoutType)(),{isSubmitting:_,setIsSubmitting:S,onSubmit:M,onError:C,handleClose:E}=g,[k,A]=(0,c.useState)(!1),T=rF(r.postSubmissionActions),L=new AbortController,O=(0,c.useCallback)((e,t,n)=>{t?x.current[e]=n:w.current=n},[]),R=(0,c.useRef)({EncounterFormProcessor:rO}),D=(0,c.useCallback)(()=>{let e=[w.current,...Object.values(x.current)],t=e.every(e=>rj(e));return{forms:e,isValid:t}},[]);return rP({patientUuid:t,formUuid:r?.uuid,setIsSubmitting:S,setIsValidating:A}),(0,c.useEffect)(()=>{k&&(f||D(),A(!1))},[k,D,f]),(0,c.useEffect)(()=>{if(_){if(f)return void S(!1);let{forms:t,isValid:i}=D();i?Promise.all(t.map(e=>e.processor.processSubmission(e,L))).then(async t=>{g.setIsSubmitting(!1),"edit"===n?(0,a.showSnackbar)({title:y("updatedRecord","Record updated"),subtitle:y("updatedRecordDescription","The patient encounter was updated"),kind:"success",isLowContrast:!0}):(0,a.showSnackbar)({title:y("submittedForm","Form submitted"),subtitle:y("submittedFormDescription","Form submitted successfully"),kind:"success",isLowContrast:!0}),T&&await rN(T,t,e,n,y),m(),M?M(t):E()}).catch(e=>{S(!1),e instanceof Error?(0,a.showSnackbar)({title:y("errorProcessingFormSubmission","Error processing form submission"),kind:"error",subtitle:e.message,isLowContrast:!1}):(0,a.showSnackbar)(e)}):S(!1)}return()=>{L.abort()}},[_,D,f]),u().createElement(rU.Provider,{value:{patient:e,sessionMode:n,sessionDate:i,formJson:r,formProcessors:R.current,layoutType:$,workspaceLayout:o,visit:d,location:s,provider:l,isFormExpanded:h,registerForm:O,handleConfirmQuestionDeletion:v,setIsFormDirty:b}},R.current&&p)},rz=()=>{let e=(0,c.useContext)(rU);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e},rH={actionButtons:"-esm-form-builder__repeat-controls__actionButtons___LgvQb"},rW=function({question:e,rows:t,handleDelete:n,handleAdd:i,questionIndex:r}){let{t:o}=(0,e0.useTranslation)();return u().createElement("div",{className:rH.actionButtons},r>0&&u().createElement(g.Button,{className:rH.button,kind:"danger",onClick:n},u().createElement("span",null,o("remove","Remove"))),r===t.length-1&&u().createElement(g.Button,{className:rH.button,iconDescription:o("add","Add"),kind:"primary",disabled:iL(e.questionOptions.repeatOptions?.limit,t.length),onClick:i},u().createElement("span",null,e.questionOptions.repeatOptions?.addText||o("add","Add"))))},rB="-esm-form-builder__repeat__nodeContainer___APyxV",rq="-esm-form-builder__repeat__divider___h9XcK",rG={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function rK(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function rY(e){return{...e,questionOptions:{...e.questionOptions,rendering:rG[e.type]||null}}}let rQ=({field:e})=>{let[t,n]=(0,c.useState)([]),i=ns(),{handleConfirmQuestionDeletion:r}=rz(),{patient:o,sessionMode:s,formFieldAdapters:l,formFields:d,methods:{getValues:h,setValue:p,unregister:f},addFormField:g,removeFormField:m,deletedFields:v,setDeletedFields:b,visit:y}=i;(0,c.useEffect)(()=>{n(d.filter(t=>t.questionOptions.concept===e.questionOptions.concept&&t.id.startsWith(e.id)&&!t.meta?.repeat?.wasDeleted))},[d,e]);let w=(0,c.useCallback)(r=>{let a=[];function c(e){e.hide?.hideWhenExpression&&(e.isHidden=tW(e.hide.hideWhenExpression,{value:e,type:"field"},[...d,...a],h(),{mode:s,patient:o,visit:y})),e.questionOptions.calculate?.calculateExpression&&tB(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...d,...a],h(),{mode:s,patient:o,visit:y}).then(t=>{e6(t)||(p(e.id,t),l[e.type]?.transformFieldValue(e,t,i))})}let u=iA(e,null,r);a.push(u),"obsGroup"===u.type&&u.questions?.forEach(e=>{a.push(e)}),a.forEach(e=>{c(e),g(e)}),n([...t,u])},[d,e,t,i]),x=e=>{e.meta.initialValue?.omrsObject?(l[e.type]?.transformFieldValue(e,null,i),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(t=>{t.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},l[t.type]?.transformFieldValue(t,null,i)})):(ti(e),f(e.id),e.questions?.forEach(e=>f(e.id))),n(t.filter(t=>t.id!==e.id)),b([...v,e]),m(e.id)},$=e=>{if(r&&"function"==typeof r){let t=r(e);t&&"function"==typeof t.then&&"function"==typeof t.catch?t.then(()=>x(e)).catch(()=>(0,a.createErrorHandler)()):"boolean"==typeof t?t&&x(e):x(e)}else x(e)},_=(0,c.useMemo)(()=>t.map((n,i)=>{let r=u().createElement(n$,{fieldId:n.id,valueAdapter:l[n.type],repeatOptions:{targetRendering:rY(n).questionOptions.rendering}});return u().createElement("div",{key:n.id+"_wrapper"},0!==i&&u().createElement("div",null,u().createElement("hr",{className:rq})),u().createElement("div",{className:rB},r),!ts(s)&&u().createElement(rW,{question:n,rows:t,questionIndex:i,handleDelete:()=>{$(n)},handleAdd:()=>{w(t.reduce((t,n)=>{let i=Number(n.id.slice(e.id.length+1));return Number.isFinite(i)?Math.max(t,i):t},0)+1)}}))}),[t]);return!e.isHidden&&_&&rK(e)?u().createElement(u().Fragment,null,u().createElement("div",null,_)):null};var rZ=n(92137);let rJ={label:"-esm-form-builder__file__label___ltBsg",thumbnailGrid:"-esm-form-builder__file__thumbnailGrid___rstZS",thumbnailContainer:"-esm-form-builder__file__thumbnailContainer___Z0tS3"},rX="-esm-form-builder__file-thumbnail__thumbnail___WlgwA",r0="-esm-form-builder__file-thumbnail__imageThumbnail___gZWBB",r1="-esm-form-builder__file-thumbnail__pdfThumbnail___49Zd9",r2="-esm-form-builder__file-thumbnail__removeButton___y2WED",r4="-esm-form-builder__file-thumbnail__closeIcon___2MzVN";var r3=n(59184),r5=n(63654);function r9({bytesContentFamily:e,removeFileCb:t,...n}){let i=(0,c.useMemo)(()=>{switch(e){case"image":return r8;case"pdf":return r6;default:return r7}},[]);return u().createElement("div",{className:rX},u().createElement(i,n),u().createElement(g.Button,{kind:"ghost",className:r2,onClick:t},u().createElement(r3.bm,{size:16,className:r4})))}function r8(e){return u().createElement("img",{className:r0,src:e.src,alt:e.title})}function r6(e){return u().createElement("div",{className:r1,role:"button",tabIndex:0},u().createElement(r5.aD,{size:24}))}function r7(e){return u().createElement("div",{className:r1,role:"button",tabIndex:0},u().createElement(r5.WZ,{size:24}))}let oe=[{name:"drug",baseControlComponent:i$},{name:"problem",baseControlComponent:i$},{name:"encounter-provider",baseControlComponent:i$},{name:"encounter-location",baseControlComponent:i$},{name:"select-concept-answers",baseControlComponent:i$},{name:"encounter-role",baseControlComponent:i$}],ot=[{name:"text",component:ic},{name:"textarea",component:ia},{name:"select",component:io},{name:"checkbox",component:n8},{name:"radio",component:ii},{name:"date",component:nX},{name:"datetime",component:nX},{name:"number",component:n7},{name:"content-switcher",component:nq},{name:"toggle",component:id},{name:"workspace-launcher",component:iE},{name:"group",component:nE},{name:"repeating",component:rQ},{name:"markdown",component:n5},{name:"fixed-value",component:n0},{name:"ui-select-extended",component:i$},{name:"file",component:({field:e,value:t,setFieldValue:n})=>{let{t:i}=(0,e0.useTranslation)(),{sessionMode:r}=ns(),o="tablet"===(0,a.useLayoutType)(),s=(0,c.useCallback)(()=>{let i=(0,a.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),n([...t||[],e]),i(),Promise.resolve()),closeModal:()=>{i()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[t,e]),l=(0,c.useCallback)(e=>{let i=[...t],r=i[e];r.uuid?i[e]={...r,voided:!0}:i.splice(e,1),n(i)},[t]);return ts(r)&&!t?u().createElement(nI,{label:i(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):u().createElement("div",null,u().createElement("div",{className:h()(rJ.label,"cds--label")},u().createElement(nB,{field:e})),!ts(r)&&u().createElement("div",null,u().createElement(g.Button,{className:rJ.uploadButton,kind:o?"ghost":"tertiary",onClick:s,renderIcon:e=>u().createElement(rZ.OM,{size:16,...e})},e.questionOptions.buttonLabel?i(e.questionOptions.buttonLabel):i("addFile","Add file"))),u().createElement("div",{className:rJ.thumbnailGrid},t&&t.filter(e=>!e.voided).map((e,t)=>u().createElement("div",{className:rJ.thumbnailContainer},u().createElement(r9,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>l(t)})))))}},...ip.map(e=>({name:e.name,component:oe.find(t=>t.name===e.name).baseControlComponent}))],on={validate:(e,t,n)=>{let i=new Date,r=t?[]:e9.validate(e,t);return r.length?r:t&&!(0,ni.H)(n?.allowFutureDates)&&t.getTime&&t.getTime()>i.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},oi=[{name:"default_value",component:iW},{name:"form_field",component:e9},{name:"date",component:on},{name:"js_expression",component:{validate:function(e,t,n){let i="value.invalid",r="Invalid value",o="Field has warnings";return n.expressionContext.myValue=t,Object.keys(n).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(s=>{let a="failsWhenExpression"===s;return tW(n[s],{value:e,type:"field"},n.formFields,{...n.values,[e.id]:t},n.expressionContext)?[{resultType:a?"error":"warning",errCode:a?i:null,message:n.message?n.message:a?r:o}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,t,n){let{referenceQuestionId:i,referenceQuestionAnswers:r,values:o,formFields:s,message:a}=n,l=o[s.find(e=>e.id===i).id];return e6(t)||r.includes(l)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:a}]}}}];function or(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class oo{fetchData(e){return(0,a.openmrsFetch)(e?`${this.url}&q=${e}`:this.url).then(({data:e})=>e.results)}fetchSingleItem(e){let t=this.url;if(t.includes("?")){let n=t.split("?");t=`${n[0]}/${e}?${n[1]}`}else t=`${t}/${e}`;return(0,a.openmrsFetch)(t).then(({data:e})=>e)}toUuidAndDisplay(e){if(void 0===e.uuid||void 0===e.display)throw Error("'uuid' or 'display' not found in the OpenMRS object.");return e}constructor(e){or(this,"url",void 0),this.url=e}}let os="custom:(uuid,display,conceptClass:(uuid,display))",oa="custom:(uuid,display,conceptClass:(uuid,display),mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid))))",ol="35543629-7d8c-11e1-909d-c80aa9edcf4e";class oc extends oo{fetchData(e,t){if(e6(t?.class)&&e6(t?.concept)&&!t?.useSetMembersByConcept&&e6(e))return Promise.resolve([]);let n=t?.conceptSourceUuid?oa:os,i=`${a.restBaseUrl}/concept?name=&searchType=fuzzy&v=${n}`;if(t?.class)if("string"!=typeof t.class)return(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results.filter(e=>e.conceptClass&&t.class.includes(e.conceptClass.uuid)));else{let e=i.split("searchType=fuzzy");i=`${e[0]}searchType=fuzzy&class=${t.class}&${e[1]}`}if(t?.concept&&t?.useSetMembersByConcept){let n=i.split("?name=&searchType=fuzzy&v="),r=t?.conceptSourceUuid?"custom:(uuid,setMembers:(uuid,display,mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid)))))":"custom:(uuid,setMembers:(uuid,display))";return i=`${n[0]}/${t.concept}?v=${r}`,(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.setMembers)}return(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results)}fetchSingleItem(e,t){let n=t?.conceptSourceUuid?oa:os;return(0,a.openmrsFetch)(`${a.restBaseUrl}/concept/${e}?v=${n}`).then(({data:e})=>e)}toUuidAndDisplay(e,t){let n=super.toUuidAndDisplay(e),i=this.getConceptSourceMapping(e,t?.conceptSourceUuid)?.conceptReferenceTerm?.code;return i?{...n,code:i}:n}getConceptSourceMapping(e,t){if(!t)return;let n=e.mappings?.filter(e=>e.conceptReferenceTerm?.conceptSource?.uuid===t)??[];return n.find(e=>e.conceptMapType?.uuid===ol||e.conceptMapType?.display?.toUpperCase()==="SAME-AS")??n[0]}constructor(){super(`${a.restBaseUrl}/concept?v=${os}`)}}class ou extends oo{fetchData(e,t,n){let i=this.url,r=i.split("?");return t?.tag&&(i=`${r[0]}?tag=${t.tag}&${r[1]}`),n&&(i=`${r[0]}/${n}?${r[1]}`),(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${a.restBaseUrl}/location?v=custom:(uuid,display)`)}}class od extends oo{async fetchData(e,t){let n="v=custom:(uuid,display)",i=`${a.restBaseUrl}/provider?${n}`,{data:r}=await (0,a.openmrsFetch)(e?`${i}&q=${e}`:i);return r?.results}async fetchSingleItem(e){let{data:t}=await (0,a.openmrsFetch)(`${a.restBaseUrl}/provider/${e}?v=custom:(uuid,display)`);return t}constructor(){super(null)}}class oh extends oo{fetchSingleItem(e){return(0,a.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,t){let n=this.buildUrl(t.referencedValue||t.concept);return(0,a.openmrsFetch)(n).then(({data:e})=>e.setMembers.length?e.setMembers:e.answers)}buildUrl(e){return this.url.replace(":conceptUuid",e)}constructor(){super(`${a.restBaseUrl}/concept/:conceptUuid?v=custom:(uuid,display,setMembers:(uuid,display),answers:(uuid,display))`)}}class op extends oo{async fetchData(e,t){let n="v=custom:(uuid,display,name)",i=`${a.restBaseUrl}/encounterrole?${n}`,{data:r}=await (0,a.openmrsFetch)(e?`${i}&q=${e}`:i);return r?.results}constructor(){super(null)}}let of=[{name:"location_datasource",component:new ou},{name:"drug_datasource",component:new oc},{name:"problem_datasource",component:new oc},{name:"select_concept_answers_datasource",component:new oh},{name:"provider_datasource",component:new od},{name:"encounter_role_datasource",component:new op}],og=[{name:"ProgramEnrollmentSubmissionAction",load:()=>n.e("4831").then(n.bind(n,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>n.e("7484").then(n.bind(n,26679))}];function om(e,t,n){if("programState"===e.type){let e=n.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},n.meta=e}try{ob(e),ow(e),ox(e),o$(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>om(e,t,n)):e.questions.forEach(e=>om(e,t,n))),e.meta.pageId=t.id}catch(e){console.error(e)}}function ov(e){let t=[];return e?.forEach(e=>{if(t.push(e),"inlineDate"!==e.type&&(0,ni.H)(e.questionOptions?.showDate)){let n={id:`${e.id}_inline_date`,label:`Date for ${e.label}`,type:"inlineDate",questionOptions:{rendering:"date",isTransient:!0},validators:e.questionOptions.shownDateOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownDateOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.obsDatetime}}};t.push(n)}}),t}function ob(e){oy(e,"readonly"),oy(e,"required"),oy(e,"unspecified"),oy(e.questionOptions,"disallowDecimals"),oy(e.questionOptions,"isSearchable"),oy(e.questionOptions,"isTransient"),oy(e.questionOptions,"enablePreviousValue"),oy(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function oy(e,t){if(e&&"string"==typeof e[t]){let n=e[t].trim().toLowerCase();("true"===n||"false"===n)&&(e[t]="true"===n)}return e}function ow(e){!tn(e,"group")&&(e.validators=e.validators||[],0>e.validators.findIndex(e=>"form_field"===e.type)&&e.validators.push({type:"form_field"}),0>e.validators.findIndex(e=>"default_value"===e.type)&&e.validators.push({type:"default_value"}))}function ox(e){switch(e.type){case"encounterProvider":e.questionOptions.rendering="encounter-provider";break;case"encounterLocation":e.questionOptions.rendering="encounter-location";break;case"encounterRole":e.questionOptions.rendering="encounter-role";break;case"encounterDatetime":e.questionOptions.rendering=tn(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":ok(e)}}function o$(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":o_(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":oM(e);break;case"repeating":case"group":oS(e);break;case"date":e.datePickerFormat=e.datePickerFormat??"calendar";break;case"datetime":e.datePickerFormat=e.datePickerFormat??"both";break;case"workspace-launcher":case"markdown":e.type="control";break;case"drug":case"problem":e.questionOptions.isSearchable=!0}return e}function o_(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,ni.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),tn(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function oS(e){tn(e,"group")&&e.questions?.length&&e.questions.forEach(oS),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function oM(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function oC(e){if(e.meta.programs.isEnrollment||e.meta.programs.discontinuationDateQuestionId){let t={programUuid:e.meta.programs.uuid};e.meta.programs.isEnrollment?t.enrollmentDate="":t.completionDate=e.meta.programs.discontinuationDateQuestionId,e.postSubmissionActions=[{actionId:"ProgramEnrollmentSubmissionAction",enabled:"true",config:t}]}}function oE(e){let t=[];return e?.forEach(e=>{if(t.push(e),"obsComment"!==e.type&&(0,ni.H)(e.questionOptions?.showComment)){let n={id:`${e.id}_obs_comment`,label:`Comment for ${e.label}`,type:"obsComment",questionOptions:{rendering:"text",isTransient:!0},validators:e.questionOptions.shownCommentOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownCommentOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.comment}}};t.push(n)}}),t}function ok(e){if("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type){let t=e.questionOptions.datasource?.config;e.questionOptions.datasource={name:"problem_datasource",config:{...t,class:e.questionOptions.diagnosis?.conceptClasses??t?.class}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{...t,concept:e.questionOptions.diagnosis.conceptSet,useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource}}function oA(e,t){Object.entries(t).forEach(([t,n])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===t?e.questionOptions.defaultValue=n:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===t&&(e.questionOptions.defaultValue=n)})})})})})}let oT=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,t)=>(oy(e,"readonly"),e.pages.forEach((t,n)=>{let i=t.label??"";t.id=`page-${i.replace(/\s/g,"")}-${n}`,oy(t,"readonly"),t.sections&&t.sections.forEach(n=>{n.questions=ov(n.questions),n.questions=oE(n.questions),oy(n,"readonly"),oy(n,"isExpanded"),n?.questions?.forEach((n,i)=>om(n,t,e))})}),t&&"object"==typeof t&&oA(e,t),e.meta?.programs&&oC(e),e)}}];function oL(e){if(e&&e.encounterProviders?.length){let t=e.encounterProviders.length-1;return e.encounterProviders[t].provider}return null}function oO(e){if(e&&e.encounterProviders?.length){let t=e.encounterProviders.length-1;return e.encounterProviders[t].encounterRole}return null}function oR(e,t){return iF(e,t)||!e6(e.meta.submission.newValue.obsDatetime)}let oD=[{type:"obs",component:iR},{type:"control",component:{getDisplayValue:(e,t)=>t,transformFieldValue:function(e,t,n){return null},getInitialValue:function(e,t,n){return null},getPreviousValue:function(e,t,n){return null},tearDown:function(){}}},{type:"obsGroup",component:iR},{type:"testOrder",component:iK},{type:"programState",component:{transformFieldValue:function(e,t,n){if(ti(e),e.meta?.initialValue?.omrsObject?.uuid===t||e6(t))return null;e.meta.submission.newValue={state:t,startDate:e4()().format()}},getInitialValue:function(e,t,n){let i=n.customDependencies.patientPrograms?.find(t=>t.program.uuid===e.questionOptions.programUuid);if(i?.states?.length>0){let t=i.states.filter(e=>!e.endDate).find(t=>t.state.programWorkflow?.uuid===e.questionOptions.workflowUuid)?.state;return e.meta={...e.meta||{},initialValue:{omrsObject:t}},t?.uuid}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){return t&&t.location?.uuid?t.location.uuid:n.location.uuid},getPreviousValue:function(e,t,n){let i=t??n.previousDomainObjectValue;return{value:i?.location?.uuid,display:i?.location?.name}},getDisplayValue:function(e,t){return t},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){let i=oL(t);return i?.uuid?i.uuid:n.currentProvider?.uuid},getPreviousValue:function(e,t,n){let i=oL(t??n.previousDomainObjectValue);return{value:i?.uuid,display:i?.name}},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){let i=t??n.domainObjectValue;return i?oO(i)?.uuid:n.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,t,n){let i=t??n.previousDomainObjectValue;if(i){let e=oO(i);return{value:e?.uuid,display:e?.name}}return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"obsComment",component:{transformFieldValue:function(e,t,n){let i=n.getFormField(e.meta.targetField),r=n.methods.getValues(i.id),o=i.meta.initialValue?.omrsObject;if(i.meta.submission?.newValue)e6(t)&&!oR(i,r)?i.meta.submission.newValue=null:i.meta.submission.newValue.comment=t;else if(!to(i)&&o){if(e6(t)&&e6(o.comment))return null;let e=iN(i,r);i.meta.submission={newValue:{...e,comment:t}}}return null},getInitialValue:function(e,t,n){if(t??n.domainObjectValue){let t=e.id.split("_obs_comment")[0],i=n.formFields.find(e=>e.id===t);return i?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){return t?.encounterDatetime?new Date(t.encounterDatetime):n.sessionDate},getPreviousValue:function(e,t,n){if(t?.encounterDatetime){let n=new Date(t.encounterDatetime);return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:function(e,t){return(0,a.formatDate)(t)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,t,n){let i=n.getFormField(e.meta.targetField),r=n.methods.getValues(i.id),o=t instanceof Date?(0,a.toOmrsIsoString)(t):t;if(i.meta.submission?.newValue)e6(o)&&!oR(i,r)?i.meta.submission.newValue=null:i.meta.submission.newValue.obsDatetime=o;else if(!to(i)&&i.meta.initialValue?.omrsObject){if(e6(t)&&e6(i.meta.initialValue.omrsObject?.obsDatetime))return null;let e=iN(i,r);i.meta.submission={newValue:{...e,obsDatetime:o}}}},getInitialValue:function(e,t,n){if(t??n.domainObjectValue){let t=e.id.split("_inline_date")[0],i=n.formFields.find(e=>e.id===t),r=i?.meta.initialValue?.omrsObject;if(r?.obsDatetime)return(0,a.parseDate)(r.obsDatetime)}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?(0,a.formatDate)(t):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,t,n){return(ti(e),e.meta.initialValue?.refinedValue===t||e6(t))?null:(e.meta.submission.newValue={identifier:t,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:n.location},e.meta.submission.newValue)},getInitialValue:function(e,t,n){let i=n.patient?.identifier?.find(t=>t.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:i,refinedValue:i?.value}},i?.value},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,t,n){return(ti(e),e.meta.initialValue?.refinedValue===t||e6(t))?null:(e.meta.submission.newValue={value:t,attributeType:e.questionOptions.attributeType,uuid:e.meta.initialValue?.omrsObject?.uuid},e.meta.submission.newValue)},getInitialValue:function(e,t,n){let i=n.patient?.extension?.find(t=>t.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:i,refinedValue:i?.valueString||i?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"diagnosis",component:iJ}],oI={},oj={},oN={},oP={},oF={},oU={};async function oV(e){if(oj[e])return oj[e];let t=ot.find(t=>t.name===e||t?.alias===e)?.component;if(!t){let n=await oY().controls.find(t=>t.name===e||t?.alias===e)?.load?.();t=n?.default}return oj[e]=t,t}function oz(e){return oQ(e)&&!tn(e,"file")?(e.disabled=!0,e.isDisabled=!0,oV("text")):oV(e.questionOptions.rendering)}async function oH(e){if(oN[e])return oN[e];let t=oD.find(t=>t.type===e)?.component;if(!t){let n=await oY().fieldValueAdapters.find(t=>t.type===e)?.load?.();t=n?.default}return oN[e]=t,t}async function oW(){let e=[],t=oU;if(Object.keys(t).length)return Object.values(t);let n=oY().formSchemaTransformers||[];return e.push(...(await Promise.all(n.map(async e=>{let t=await e.load?.();return t?.default}))).filter(e=>void 0!==e)),e.push(...oT.map(e=>e.component)),e.forEach(e=>{oU[oT.find(t=>t.component===e).name]=e}),e}async function oB(e){let t=oP[e];if(t)return t;let n=og.find(t=>t.name===e);if(n){let t=n.load,i=await t();return oP[e]=i.default,i.default}let i=oY().postSubmissionActions.find(t=>t.name===e);if(i){let t=i.load,n=await t();return oP[e]=n.default,n.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function oq(e){if(oI[e])return oI[e];let t=oi.find(t=>t.name===e)?.component;if(!t){let n=await oY().fieldValidators.find(t=>t.name===e)?.load?.();t=n?.default}return oI[e]=t,t}async function oG(e){if(oF[e])return oF[e];let t=of.find(t=>t.name===e)?.component;if(!t){let n=ig(e);if(n)t=of.find(e=>e.name===n.datasource.name)?.component;else{let n=await oY().dataSources.find(t=>t.name===e)?.load?.();if(!n)throw Error("Datasource not found");t=n.default}}return oF[e]=t,t}function oK(){return oY().expressionHelpers}function oY(){return(0,a.getGlobalStore)(l.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function oQ(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function oZ(e,t,n,i,r){let[o,s]=(0,c.useState)(null),[a,l]=(0,c.useState)(o2(e,t));return(0,c.useEffect)(()=>{let o=new AbortController,a=e=>{if(e?.translations){let t=window.i18next.language;window.i18next.addResourceBundle(t,rg.L,e.translations,!0,!0)}s(e)};return oJ(e,t,i,r).then(e=>{a({...e,encounter:n})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),l(Error("Error loading form JSON: "+e.message)))}),()=>{o.abort()}},[i,e,t,n]),{formJson:o,isLoading:!o&&!a,formError:a}}async function oJ(e,t,n,i){let r=await (0,tM.fetchOpenMRSForm)(e),o=await (0,tM.fetchClobData)(r),s=await oW(),a=o?{...o,uuid:r.uuid}:o3(t),l=oX(a);o1(a,await o0(l,n));let c=o8(a),u=await o6(c),d=c.reduce((e,t)=>(e[t.formName]=t.alias,e),{});return se(a,o7(u),d),o4(a,s,n,i)}function oX(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function o0(e,t){return Promise.all(e.map(e=>oJ(e,null,t)))}function o1(e,t){t.forEach(t=>{let n=e.pages.find(e=>e.subform?.name===t.name);n&&(n.subform.form=t)})}function o2(e,t){return e||t?e&&t?Error("InvalidArgumentsErr: Both formUuid and formJson cannot be provided at the same time."):void 0:Error("InvalidArgumentsErr: Neither formUuid nor formJson was provided")}function o4(e,t=[],n,r){return o5(e,n),t.reduce((e,t)=>t.transform(e,r),e),o9(e),i(n,e)}function o3(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function o5(e,t){for(let n=e.pages.length-1;n>=0;n--){let i=e.pages[n];(0,ni.H)(i.isSubform)&&!(0,ni.H)(i.isHidden)&&i.subform?.form?.encounterType===e.encounterType&&(i.subform.form.pages.filter(e=>!(0,ni.H)(e.isSubform)),e.pages.splice(n,1,...o4(i.subform.form,[],t).pages))}}function o9(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function o8(e){let t=e?.referencedForms;return t||[]}async function o6(e){return Promise.all(e.map(e=>oJ(e.formName,null,null)))}function o7(e){let t=new Map;return e.forEach(e=>{t.set(e.name,e)}),t}function se(e,t,n){t.forEach((t,i)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===i||e.reference.form===n[i])){let n=st(e,t);Object.assign(e,n)}})})})}function st(e,t){let n,i=t.pages.filter(t=>t.label===e.reference.page);if(i.length>0){let t=i[0].sections.filter(t=>t.label===e.reference.section);t.length>0&&(n=t[0])}return sn(n,e.reference)}function sn(e,t){if(t?.excludeQuestions){let n=t.excludeQuestions;e.questions=e.questions.filter(e=>!n.includes(e.id))}return e}var si=n(76922);function sr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class so{setEvaluatedPagesVisibility(e){this.evaluatedPagesVisibilitySubject.next(e)}updateScrollablePages(e){this.scrollablePagesSubject.next(e)}updatePagesWithErrors(e){this.pagesWithErrorsSubject.next(new Set(e))}addActivePage(e){let t=this.activePagesSubject.value;t.add(e),this.activePagesSubject.next(t)}removeInactivePage(e){let t=this.activePagesSubject.value;t.delete(e),this.activePagesSubject.next(t)}getActivePagesObservable(){return this.activePagesSubject.asObservable()}getScrollablePagesObservable(){return this.scrollablePagesSubject.asObservable()}getPagesWithErrorsObservable(){return this.pagesWithErrorsSubject.asObservable()}getEvaluatedPagesVisibilityObservable(){return this.evaluatedPagesVisibilitySubject.asObservable()}clear(){this.scrollablePagesSubject.next([]),this.pagesWithErrorsSubject.next(new Set),this.activePagesSubject.next(new Set),this.evaluatedPagesVisibilitySubject.next(!1)}constructor(){sr(this,"scrollablePagesSubject",new si.BehaviorSubject([])),sr(this,"pagesWithErrorsSubject",new si.BehaviorSubject(new Set)),sr(this,"activePagesSubject",new si.BehaviorSubject(new Set)),sr(this,"evaluatedPagesVisibilitySubject",new si.BehaviorSubject(null))}}let ss=new so,sa=new Set;function sl(e){e&&Object.values(e).forEach(e=>{sa.add(e)})}function sc(){sa.forEach(e=>{try{e.tearDown()}catch(e){}}),sa.clear(),ss.clear()}function su(e){let[t,n]=(0,c.useState)(void 0),i=(0,c.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),r=(0,c.useCallback)(e=>{n(e.detail.value)},[]);return(0,c.useEffect)(()=>{let t=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(t)},[e]),(0,c.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",r),()=>{window.removeEventListener("openmrs:form-collapse-toggle",r)}),[]),{isFormExpanded:t,hideFormCollapseToggle:i}}let sd=26.25,sh=32.25,sp=48.25;function sf(e){let[t,n]=(0,c.useState)(0),i=(0,c.useMemo)(()=>t<=sd?"narrow":t<=sh?"wider":t<=sp?"extra-wide":"ultra-wide",[t]);return(0,c.useLayoutEffect)(()=>{let t=()=>{let t=e.current?.parentElement?.offsetWidth,i=parseInt(getComputedStyle(document.documentElement).fontSize);t&&n(td(t,i))};t();let i=new ResizeObserver(e=>{t()});return e.current?.parentElement&&i.observe(e.current?.parentElement),()=>{i.disconnect()}},[e]),i}let sg=()=>{let[e,t]=(0,c.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,c.useEffect)(()=>{let e=[ss.getScrollablePagesObservable().subscribe(e=>{t(t=>({...t,pages:e,hasMultiplePages:e.length>1}))}),ss.getPagesWithErrorsObservable().subscribe(e=>{t(t=>({...t,pagesWithErrors:Array.from(e)}))}),ss.getActivePagesObservable().subscribe(e=>{t(t=>({...t,activePages:Array.from(e)}))}),ss.getEvaluatedPagesVisibilityObservable().subscribe(e=>{t(t=>({...t,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function sm(e){let t=new Date,n=t.getFullYear()-e.getFullYear();return t.getMonth()<e.getMonth()||t.getMonth()===e.getMonth()&&t.getDate()<e.getDate()?n-1:n}let sv={female:"F",male:"M",other:"O",unknown:"U"},sb=e=>{let{patient:t,isLoading:n,error:i}=(0,a.usePatient)(e);return t&&!n&&(t.age=sm(new Date(t?.birthDate)),t.sex=sv[t.gender]??"U"),{patient:t,isLoadingPatient:n,patientError:i}},sy=(e,t,n,i)=>{let{loadDependencies:r}=e,{formJson:o}=t,[s,a]=(0,c.useState)(0),[l,u]=(0,c.useState)(null),d=(0,c.useCallback)(()=>a(e=>e+1),[]),h=l?.loadDependencies===r&&l?.attempt===s?l:null;return(0,c.useEffect)(()=>{let e=!1;return async function(){let a=await Promise.allSettled([Promise.resolve().then(()=>r?.(t,n,i)),tA(o)]);if(!e){let e=a.find(e=>"rejected"===e.status);u({loadDependencies:r,attempt:s,error:e?Error(e.reason?.message??String(e.reason)):null})}}(),()=>{e=!0}},[r,s]),{isLoading:!h||!!h.error,error:h?.error,retry:d}},sw=(e,t,n)=>{let[i,r]=(0,c.useState)(!0),[o,s]=(0,c.useState)({}),[a,l]=(0,c.useState)(null),u=(0,c.useRef)(n);u.current=n;let d=(0,c.useRef)(!1),h=n.formFields?.length>0,p=Object.keys(n.formFieldAdapters??{}).length>0;return(0,c.useEffect)(()=>{if(e&&!t&&h&&p&&!d.current){d.current=!0;let t=u.current;e.getInitialValues(t).then(e=>{s(e),r(!1)}).catch(e=>{console.error(e),l(e),r(!1)})}},[e,t,h,p]),{isLoadingInitialValues:i,initialValues:o,error:a}},sx="-esm-form-builder__section-renderer__section___+aK-S",s$="-esm-form-builder__section-renderer__sectionBody___0kmuN",s_=({section:e})=>{let{formFieldAdapters:t}=ns(),n=(0,c.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return u().createElement("div",{className:sx},e.questions.map(e=>t[e.type]?u().createElement("div",{key:`${n}-${e.id}`,className:s$},u().createElement(n$,{key:e.id,fieldId:e.id,valueAdapter:t[e.type]})):null))};var sS=n(20594),sM=!!("u">typeof window&&window.document&&window.document.createElement);function sC(){if(!sM||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),n=function(){};window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t)}catch(e){}return e}var sE=void 0;function sk(){return void 0===sE&&(sE=sC()),sE}function sA(e){if(e)return sk()?e:!!e.capture}function sT(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function sL(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function sO(e){this.target=e,this.events={}}sO.prototype.getEventHandlers=function(){return function(e,t){var n=String(e)+" "+String(sT(t));return this.events[n]||(this.events[n]={handlers:[],handleEvent:void 0},this.events[n].nextHandlers=this.events[n].handlers),this.events[n]}}(),sO.prototype.handleEvent=function(){return function(e,t,n){var i=this.getEventHandlers(e,t);i.handlers=i.nextHandlers,i.handlers.forEach(function(e){e&&e(n)})}}(),sO.prototype.add=function(){return function(e,t,n){var i=this,r=this.getEventHandlers(e,n);sL(r),0===r.nextHandlers.length&&(r.handleEvent=this.handleEvent.bind(this,e,n),this.target.addEventListener(e,r.handleEvent,n)),r.nextHandlers.push(t);var o=!0;return function(){return function(){if(o){o=!1,sL(r);var s=r.nextHandlers.indexOf(t);r.nextHandlers.splice(s,1),0===r.nextHandlers.length&&(i.target&&i.target.removeEventListener(e,r.handleEvent,n),r.handleEvent=void 0)}}}()}}();var sR="__consolidated_events_handlers__";function sD(e,t,n,i){e[sR]||(e[sR]=new sO(e));var r=sA(i);return e[sR].add(t,n,r)}var sI=n(23286);function sj(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function sN(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function sP(e,t){var n=sN(e);if("number"==typeof n)return n;var i=sj(e);if("number"==typeof i)return i*t}var sF="above",sU="inside",sV="below",sz="invisible";function sH(e){return"string"==typeof e.type}var sW="<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n\nSee https://goo.gl/LrBNgw for more info.";function sB(e,t){if(e&&!sH(e)&&!t)throw Error(sW)}function sq(e){return e.viewportBottom-e.viewportTop==0?sz:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?sU:e.viewportBottom<e.waypointTop?sV:e.waypointTop<e.viewportTop?sF:sz}var sG=[];function sK(e){sG.push(e),s||(s=setTimeout(function(){var e;for(s=null;e=sG.shift();)e()},0));var t=!0;return function(){if(t){t=!1;var n=sG.indexOf(e);-1!==n&&(sG.splice(n,1),!sG.length&&s&&(clearTimeout(s),s=null))}}}function sY(e){return"window"===e?n.g.window:e}var sQ="u">typeof window,sZ={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},sJ=function(e){function t(t){var n;return(n=e.call(this,t)||this).refElement=function(e){n._ref=e},n}(0,sS.A)(t,e);var n=t.prototype;return n.componentDidMount=function(){var e=this;sQ&&(this.cancelOnNextTick=sK(function(){e.cancelOnNextTick=null;var t=e.props,n=t.children;t.debug,sB(n,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=sD(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=sD(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},n.componentDidUpdate=function(){var e=this;sQ&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=sK(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},n.componentWillUnmount=function(){sQ&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},n._findScrollableAncestor=function(){var e=this.props,t=e.horizontal,n=e.scrollableAncestor;if(n)return sY(n);for(var i=this._ref;i.parentNode&&(i=i.parentNode)!==document.body;){var r=window.getComputedStyle(i),o=(t?r.getPropertyValue("overflow-x"):r.getPropertyValue("overflow-y"))||r.getPropertyValue("overflow");if("auto"===o||"scroll"===o||"overlay"===o)return i}return window},n._handleScroll=function(e){if(this._ref){var t=this._getBounds(),n=sq(t),i=this._previousPosition,r=this.props,o=(r.debug,r.onPositionChange),s=r.onEnter,a=r.onLeave,l=r.fireOnRapidScroll;if(this._previousPosition=n,i!==n){var c={currentPosition:n,previousPosition:i,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom};o.call(this,c),n===sU?s.call(this,c):i===sU&&a.call(this,c);var u=i===sV&&n===sF,d=i===sF&&n===sV;l&&(u||d)&&(s.call(this,{currentPosition:sU,previousPosition:i,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}),a.call(this,{currentPosition:n,previousPosition:sU,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}))}}},n._getBounds=function(){var e,t,n=this.props,i=n.horizontal;n.debug;var r=this._ref.getBoundingClientRect(),o=r.left,s=r.top,a=r.right,l=r.bottom,c=i?o:s,u=i?a:l;this.scrollableAncestor===window?(e=i?window.innerWidth:window.innerHeight,t=0):(e=i?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,t=i?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var d=this.props,h=d.bottomOffset,p=sP(d.topOffset,e),f=sP(h,e),g=t+e;return{waypointTop:c,waypointBottom:u,viewportTop:t+p,viewportBottom:g-f}},n.render=function(){var e=this,t=this.props.children;if(!t)return u().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(sH(t)||(0,sI.isForwardRef)(t)){var n=function(n){e.refElement(n),t.ref&&("function"==typeof t.ref?t.ref(n):t.ref.current=n)};return u().cloneElement(t,{ref:n})}return u().cloneElement(t,{innerRef:this.refElement})},t}(u().PureComponent);sJ.above=sF,sJ.below=sV,sJ.inside=sU,sJ.invisible=sz,sJ.defaultProps=sZ,sJ.displayName="Waypoint";let sX={pageContent:"-esm-form-builder__page-renderer__pageContent___1sqJE",pageHeader:"-esm-form-builder__page-renderer__pageHeader___5xq2Z",pageTitle:"-esm-form-builder__page-renderer__pageTitle___L0LWE",collapseIcon:"-esm-form-builder__page-renderer__collapseIcon___FAxsi",sectionContainer:"-esm-form-builder__page-renderer__sectionContainer___GuKLn",accordionContainer:"-esm-form-builder__page-renderer__accordionContainer___S5AuC",firstSection:"-esm-form-builder__page-renderer__firstSection___cvqEr",lastSection:"-esm-form-builder__page-renderer__lastSection___FcNvF",formSection:"-esm-form-builder__page-renderer__formSection___2sNJr",hiddenAccordion:"-esm-form-builder__page-renderer__hiddenAccordion___ldAud"};function s0({section:e,sectionIndex:t,visibleSections:n,isFormExpanded:i}){let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)(i);return(0,c.useEffect)(()=>{s(i)},[i]),u().createElement(g.AccordionItem,{title:r(e.label),open:o,className:h()(sX.sectionContainer,{[sX.firstSection]:0===t,[sX.lastSection]:t===n.length-1})},u().createElement("div",{className:sX.formSection},u().createElement(s_,{section:e})))}let s1=function({page:e,isFormExpanded:t}){let{t:n}=(0,e0.useTranslation)(),[i,r]=(0,c.useState)(!1),o=(0,c.useMemo)(()=>e.sections.filter(e=>{let t=e.questions.some(e=>!(0,ni.H)(e.isHidden));return!(0,ni.H)(e.isHidden)&&t}),[e.sections]),s=()=>r(!i);return(0,c.useEffect)(()=>(r(!t),()=>{ss.removeInactivePage(e.id)}),[t]),u().createElement("div",null,u().createElement(sJ,{key:e.id,onEnter:()=>ss.addActivePage(e.id),onLeave:()=>ss.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},u().createElement("div",{id:e.id,className:sX.pageContent},u().createElement("div",{className:sX.pageHeader,onClick:s},u().createElement("p",{className:sX.pageTitle},n(e.label),u().createElement("span",{className:sX.collapseIconWrapper},i?u().createElement(a.ChevronDownIcon,{className:sX.collapseIcon,"aria-label":"Expand"}):u().createElement(a.ChevronUpIcon,{className:sX.collapseIcon,"aria-label":"Collapse"})))),u().createElement("div",{className:h()({[sX.hiddenAccordion]:i,[sX.accordionContainer]:!i})},u().createElement(g.Accordion,null,o.map((e,n)=>u().createElement(s0,{key:`section-${e.label}`,section:e,sectionIndex:n,visibleSections:o,isFormExpanded:t})))))))},s2={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},s4=(e,t)=>{switch(t.type){case"SET_FORM_FIELDS":return{...e,formFields:t.value};case"ADD_FORM_FIELD":return{...e,formFields:[...e.formFields,t.value]};case"UPDATE_FORM_FIELD":return{...e,formFields:e.formFields.map(e=>e.id===t.value.id?t.value:e)};case"REMOVE_FORM_FIELD":return{...e,formFields:e.formFields.filter(e=>e.id!==t.value)};case"SET_INVALID_FIELDS":return{...e,invalidFields:t.value};case"ADD_INVALID_FIELD":return{...e,invalidFields:[...e.invalidFields,t.value]};case"REMOVE_INVALID_FIELD":return{...e,invalidFields:e.invalidFields.filter(e=>e.id!==t.value)};case"CLEAR_INVALID_FIELDS":return{...e,invalidFields:[]};case"SET_FORM_JSON":return{...e,formJson:t.value};case"SET_DELETED_FIELDS":return{...e,deletedFields:t.value};default:return e}},s3=(e,t)=>{let{formFields:n,patient:i,sessionMode:r,visit:o}=t,[s,a]=(0,c.useState)(t.formJson),[l,u]=(0,c.useState)(!1),d=(0,c.useMemo)(()=>n?.map(t=>{let s={value:t,type:"field"},a={patient:i,mode:r,visit:o};if(t.hide?.hideWhenExpression){let i=tW(t.hide.hideWhenExpression,s,n,e,a);t.isHidden=i,Array.isArray(t.questions)&&t.questions.forEach(e=>{e.isHidden=i})}else t.isHidden=!1;"object"==typeof t.required&&"conditionalRequired"===t.required.type?t.isRequired=tZ(t,n,e):t.isRequired=(0,ni.H)(t.required),"object"==typeof t.disabled&&t.disabled.disableWhenExpression?t.isDisabled=tW(t.disabled.disableWhenExpression,s,n,e,a):t.isDisabled=(0,ni.H)(t.disabled),t.validators?.some(e=>"conditionalAnswered"===e.type)&&tQ(t,n),t.questionOptions.answers?.filter(e=>!e6(e.hide?.hideWhenExpression)).forEach(t=>{t.isHidden=tW(t.hide.hideWhenExpression,s,n,e,a)}),t.questionOptions.answers?.filter(e=>!e6(e.disable?.disableWhenExpression)).forEach(t=>{t.disable.isDisabled=tW(t.disable?.disableWhenExpression,s,n,e,a)}),"string"==typeof t.readonly&&s5(t.readonly)&&(t.meta.readonlyExpression=t.readonly,t.readonly=tW(t.readonly,s,n,e,a));let l=t.questionOptions.repeatOptions?.limitExpression;return"repeating"!==t.questionOptions.rendering||e6(l)||(t.questionOptions.repeatOptions.limit=tW(l,s,n,e,a)),t}),[e,n,i,r]);return(0,c.useEffect)(()=>{t.formJson?.pages?.forEach(t=>{t.hide?tX({value:t,type:"page"},n,e,r,i,tW,null):t.isHidden=!1,t?.sections?.forEach(t=>{t.hide?tX({value:t,type:"section"},n,e,r,i,tW,null):t.isHidden=!1})}),a(tu(t.formJson)),u(!0)},[t.formJson,n]),{evaluatedFormJson:s,evaluatedFields:d,evaluatedPagesVisibility:l}};function s5(e){return"true"!==e&&"false"!==e}function s9(e,t){let n=(0,c.useCallback)(t=>{e({type:"ADD_FORM_FIELD",value:t})},[]),i=(0,c.useCallback)(n=>{if(n.meta.groupId){let e=t.find(e=>e.id===n.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===n.id?n:e),i(e))}e({type:"UPDATE_FORM_FIELD",value:(0,ik.A)(n)})},[t]),r=(0,c.useCallback)(e=>t.find(t=>t.id===e),[t]),o=(0,c.useCallback)(t=>{e({type:"REMOVE_FORM_FIELD",value:t})},[]),s=(0,c.useCallback)(t=>{e({type:"SET_INVALID_FIELDS",value:t})},[]),a=(0,c.useCallback)(t=>{e({type:"ADD_INVALID_FIELD",value:t})},[]),l=(0,c.useCallback)(t=>{e({type:"REMOVE_INVALID_FIELD",value:t})},[]);return{addFormField:n,updateFormField:i,getFormField:r,removeFormField:o,setInvalidFields:s,addInvalidField:a,removeInvalidField:l,setForm:(0,c.useCallback)(t=>{e({type:"SET_FORM_JSON",value:tu(t)})},[]),setDeletedFields:(0,c.useCallback)(t=>{e({type:"SET_DELETED_FIELDS",value:t})},[])}}let s8=({processorContext:e,initialValues:t,isSubForm:n,setIsLoadingFormDependencies:i})=>{let{evaluatedFields:r,evaluatedFormJson:o,evaluatedPagesVisibility:s}=s3(t,e),{registerForm:a,setIsFormDirty:l,workspaceLayout:d,isFormExpanded:h}=rz(),p=eX({defaultValues:t,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:f}}=p,[{formFields:g,invalidFields:m,formJson:v,deletedFields:b},y]=(0,c.useReducer)(s4,{...s2,formFields:r,formJson:o}),{addFormField:w,updateFormField:x,getFormField:$,removeFormField:_,setInvalidFields:S,addInvalidField:M,removeInvalidField:C,setForm:E,setDeletedFields:k}=s9(y,g);(0,c.useEffect)(()=>{let e=v.pages.filter(e=>!e.isSubform).map(e=>e);ss.updateScrollablePages(e)},[v.pages]),(0,c.useEffect)(()=>{ss.setEvaluatedPagesVisibility(s)},[s]),(0,c.useEffect)(()=>{ss.updatePagesWithErrors(m.map(e=>e.meta.pageId))},[m]);let A=(0,c.useMemo)(()=>({...e,workspaceLayout:d,methods:p,formFields:g,formJson:v,invalidFields:m,deletedFields:b,addFormField:w,updateFormField:x,getFormField:$,removeFormField:_,setInvalidFields:S,addInvalidField:M,removeInvalidField:C,setForm:E,setDeletedFields:k}),[e,d,p,g,v,m,b]);return(0,c.useEffect)(()=>{a(v.name,n,A)},[v.name,n,A]),(0,c.useEffect)(()=>{l(f)},[f]),u().createElement(no,A,v.pages.map(e=>e.isSubform||t3(e)?e.isSubform&&e.subform?.form?u().createElement(ah,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:i}):u().createElement(s1,{key:e.label,page:e,isFormExpanded:h}):null))},s6=({context:e,setContext:t,setters:n,useCustomHooks:i,setIsLoadingCustomHooks:r})=>{let{isLoading:o=!1,error:s=null,data:a,updateContext:l}=i(e);return(0,c.useEffect)(()=>{!o&&l&&(l(t,n),r(!1))},[o]),null};function s7(e){let[t,n]=(0,c.useMemo)(()=>{let t=[],n=new Set,i=(e,r)=>{let o=r?{...e,meta:{...e.meta,groupId:r}}:e;t.push(o),o.questionOptions?.concept&&n.add(o.questionOptions.concept),o.questionOptions?.answers?.forEach(e=>{e.concept&&n.add(e.concept)}),"obsGroup"===o.type&&o.questions&&o.questions.forEach(e=>{i(e,o.id)})};return e.pages?.forEach(e=>e.sections?.forEach(e=>{e.questions?.forEach(e=>i(e))})),[t,JSON.stringify(Array.from(n).sort())]},[e]);return{formFields:t,conceptReferences:(0,c.useMemo)(()=>new Set(JSON.parse(n)),[n])}}let ae="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function at(e){let{data:t,error:n,isLoading:i}=rC()([`${a.restBaseUrl}/conceptreferences?v=${ae}`,e],([e,t])=>(0,a.openmrsFetch)(e,{headers:{"Content-Type":"application/json"},body:{references:t},method:"POST"}),{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{concepts:(0,c.useMemo)(()=>t?.data?Object.values(t.data):void 0,[t]),isLoading:i,error:n}}let an={};function ai(e){let t=(0,c.useMemo)(()=>{let t=new Set;return e.forEach(e=>{e.validators?.forEach(e=>t.add(e.type))}),Array.from(t).sort().join(",")},[e]),{data:n}=r_()(t?["formFieldValidators",t]:null,async([,e])=>{let t=e.split(","),n=await Promise.all(t.map(e=>oq(e))),i={};return t.forEach((e,t)=>{i[e]=n[t]}),i},{keepPreviousData:!0});return n??an}function ar(e,t){return(0,c.useMemo)(()=>e.length&&t?.length?e.map(e=>{let n=t1(e.questionOptions.concept,t);return e.questionOptions.concept=n?n.uuid:e.questionOptions.concept,e.label=e.label?e.label:n?.display,l.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&n?.conceptClass?.display==="Question"&&n?.answers?.length&&(e.questionOptions.answers=n.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:n},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let n=t1(e.concept,t);return{...e,concept:n?n.uuid:e.concept,label:e.label?e.label:n?.display}})),e}):e??[],[t,e])}let ao={},as=e=>{let t=(0,c.useMemo)(()=>{let t=new Set;return e.forEach(e=>t.add(e.type)),Array.from(t).sort().join(",")},[e]),{data:n}=r_()(t?["formFieldValueAdapters",t]:null,async([,e])=>{let t=e.split(","),n=await Promise.all(t.map(e=>oH(e))),i={};return t.forEach((e,t)=>{i[e]=n[t]}),i},{keepPreviousData:!0});return n??ao},aa="-esm-form-builder__loader__loaderContainer___ZkHfb",al="-esm-form-builder__loader__loader___YgDLP",ac=()=>{let{t:e}=(0,e0.useTranslation)();return u().createElement("div",{className:aa},u().createElement(g.InlineLoading,{className:al,description:`${e("loading","Loading")} ...`}))},au=["patient","formJson","visit","sessionMode","sessionDate","location","currentProvider","layoutType","processor","formFields","formFieldAdapters","formFieldValidators"];function ad(e,t){let n=au.filter(n=>n in t&&t[n]!==e[n]);n.length&&console.warn(`A form processor tried to set the context propert${1===n.length?"y":"ies"} ${n.join(", ")}, which the form engine derives itself. ${1===n.length?"It was":"They were"} ignored. Use the setters passed alongside setContext to update the domain object or custom dependencies.`)}let ah=({formJson:e,isSubForm:t=!1,setIsLoadingFormDependencies:n})=>{let{patient:i,sessionMode:r,formProcessors:o,layoutType:s,location:a,provider:l,sessionDate:d,visit:h}=rz(),{t:p}=(0,e0.useTranslation)(),f=(0,c.useId)(),m=(0,c.useMemo)(()=>{let t,n=o[e.processor];return n?t=new n(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),t=new rO(e)),t.prepareFormSchema(e),t},[o,e.processor]),{formFields:v,conceptReferences:b}=s7(e),{concepts:y,isLoading:w}=at(Array.from(b)),x=ar(v,y),$=as(v),_=ai(v),S=(0,c.useMemo)(()=>x?.length?x:v??[],[x,v]),[M,C]=(0,c.useState)({}),E=(0,c.useMemo)(()=>({patient:i,formJson:e,sessionMode:r,layoutType:s,location:a,currentProvider:l,processor:m,sessionDate:d,visit:h,formFields:S,formFieldAdapters:$??{},formFieldValidators:_??{}}),[i,e,r,s,a,l,m,d,h,S,$,_]),k=(0,c.useMemo)(()=>({...E,...M}),[E,M]),A=(0,c.useCallback)(e=>{C(t=>{let n={...E,...t},i="function"==typeof e?e(n):e;return"function"==typeof e&&ad(n,i),{domainObjectValue:i.domainObjectValue,previousDomainObjectValue:i.previousDomainObjectValue,customDependencies:i.customDependencies}})},[E]),T=(0,c.useMemo)(()=>({setDomainObjectValue:e=>C(t=>({...t,domainObjectValue:e})),setPreviousDomainObjectValue:e=>C(t=>({...t,previousDomainObjectValue:e})),setCustomDependencies:e=>C(t=>({...t,customDependencies:"function"==typeof e?e(t.customDependencies??{}):e}))}),[]),{isLoading:L,error:O,retry:R}=sy(m,k,A,T),D=m.getCustomHooks().useCustomHooks,[I,j]=(0,c.useState)(!!D),{isLoadingInitialValues:N,initialValues:P,error:F}=sw(m,L||I||w,k),U=(0,c.useMemo)(()=>L||I||w||N,[L,I,w,N]);return(0,c.useEffect)(()=>{n(f,U)},[f,U,n]),(0,c.useEffect)(()=>()=>n(f,!1),[f,n]),(0,c.useEffect)(()=>{(0,t6.N)(F,p("errorLoadingInitialValues","Error loading initial values"))},[F,p]),(0,c.useEffect)(()=>{$&&sl($)},[$]),u().createElement(u().Fragment,null,D&&u().createElement(s6,{context:k,setContext:A,setters:T,useCustomHooks:D,setIsLoadingCustomHooks:j}),O?u().createElement("div",null,u().createElement(g.InlineNotification,{kind:"error",hideCloseButton:!0,title:p("errorLoadingFormDependencies","Unable to load form data"),subtitle:p("retryLoadingFormDependencies","Required form data could not be loaded. Retry to complete and save this form.")}),u().createElement(g.Button,{kind:"tertiary",onClick:R},p("retry","Retry"))):U?u().createElement(ac,null):u().createElement(s8,{processorContext:k,initialValues:P,isSubForm:t,setIsLoadingFormDependencies:n}))},ap="-esm-form-builder__patient-banner__patientBannerContainer___KlhJI",af=({patient:e,hideActionsOverflow:t})=>u().createElement("div",{className:ap},u().createElement(a.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:t}})),ag=({pages:e,defaultPage:t,activePages:n,evaluatedPagesVisibility:i})=>{let[r,o]=(0,c.useState)(null),[s,a]=(0,c.useState)(!1),[l,u]=(0,c.useState)(null),d=(0,c.useRef)(!0);return(0,c.useEffect)(()=>{s||!i||((()=>{let n=e.find(({label:e})=>e===t);if(n&&!n.isHidden)o(n.id),t2(n.id);else{let t=e.find(e=>!e.isHidden);t&&o(t.id)}})(),a(!0))},[e,t,i,s]),(0,c.useEffect)(()=>{let e=null;return s&&(e=setTimeout(()=>{d.current=!1},200)),()=>{e&&clearTimeout(e)}},[s]),(0,c.useEffect)(()=>{if(d.current)return;let t=null;if(l&&n.includes(l)){o(l),t=setTimeout(()=>{u(null)},100);return}return!l&&n.length>0&&o(n.reduce((t,n)=>e.findIndex(e=>e.id===t)<e.findIndex(e=>e.id===n)?t:n)),()=>{t&&clearTimeout(t)}},[n,l,e]),{currentActivePage:r,requestPage:(0,c.useCallback)(e=>{d.current=!1,u(e),o(e),t2(e)},[])}},am="-esm-form-builder__sidebar__pageLink___Op55o",av="-esm-form-builder__sidebar__pageLinkTablet___cXw5r",ab="-esm-form-builder__sidebar__activePage___buqNi",ay="-esm-form-builder__sidebar__errorPage___Eu-K9",aw="-esm-form-builder__sidebar__activeErrorPage___KHaKn",ax="-esm-form-builder__sidebar__sidebar___vTQvS",a$="-esm-form-builder__sidebar__sideNavActions___dzMCV",a_="-esm-form-builder__sidebar__divider___akCoV",aS="-esm-form-builder__sidebar__closeButton___HiIEp",aM="-esm-form-builder__sidebar__saveButton___6rQj1",aC="-esm-form-builder__sidebar__topMargin___Fh16B";function aE({page:e,currentActivePage:t,pagesWithErrors:n,requestPage:i}){let{t:r}=(0,e0.useTranslation)(),o=e.id===t,s=n.includes(e.id),l="tablet"===(0,a.useLayoutType)();return u().createElement("div",{className:h()(am,{[ab]:o&&!s,[ay]:s&&!o,[aw]:s&&o,[av]:l})},u().createElement("button",{onClick:t=>{t.preventDefault(),i(e.id)}},u().createElement("span",null,r(e.label))))}let ak=({defaultPage:e,isFormSubmitting:t,sessionMode:n,onCancel:i,handleClose:r,hideFormCollapseToggle:o,hideControls:s})=>{let{t:l}=(0,e0.useTranslation)(),{pages:d,pagesWithErrors:p,activePages:f,evaluatedPagesVisibility:m}=sg(),{currentActivePage:v,requestPage:b}=ag({pages:d,defaultPage:e,activePages:f,evaluatedPagesVisibility:m}),y=(0,a.useLayoutType)(),w=(0,c.useMemo)(()=>"tablet"===y?"lg":"sm",[y]);return u().createElement("div",{className:ax},d.filter(e=>t3(e)).map(e=>u().createElement(aE,{key:e.id,page:e,currentActivePage:v,pagesWithErrors:p,requestPage:b})),"view"!==n&&!s&&u().createElement("hr",{className:a_}),!s&&u().createElement("div",{className:a$},"view"!==n&&u().createElement(g.Button,{className:aM,disabled:t,type:"submit",size:w},t?u().createElement(g.InlineLoading,{description:l("submitting","Submitting")+"..."}):u().createElement("span",null,`${l("save","Save")}`)),u().createElement(g.Button,{className:h()(aS,{[aC]:"view"===n}),kind:"tertiary",onClick:()=>{i?.(),r?.(),o()},size:w},"view"===n?l("close","Close"):l("cancel","Cancel"))))},aA="-esm-form-builder__form-engine__form___j8Gb3",aT="-esm-form-builder__form-engine__formContainer___Cvw6g",aL="-esm-form-builder__form-engine__formContent___F7MoF",aO="-esm-form-builder__form-engine__formContentInner___CXTIX",aR="-esm-form-builder__form-engine__formBody___DgyqX",aD="-esm-form-builder__form-engine__minifiedButtons___Ieyml",aI="-esm-form-builder__form-engine__markdownContainer___8OoYZ",aj="-esm-form-builder__form-engine__linearActivity___g2Tl3",aN="-esm-form-builder__form-engine__indeterminate___aYMI1",aP="-esm-form-builder__form-engine__saveButton___CQZOn",aF=({formJson:e,patientUUID:t,formUUID:n,encounterUUID:i,visit:r,formSessionIntent:o,mode:s,onSubmit:l,onCancel:d,handleClose:p,handleConfirmQuestionDeletion:f,markFormAsDirty:m,hideControls:v=!1,hidePatientBanner:b=!1,preFilledQuestions:y})=>{let{t:w}=(0,e0.useTranslation)(),x=(0,a.useSession)(),$=(0,c.useRef)(null),_=(0,c.useRef)(new Date),S=(0,c.useMemo)(()=>tl(_.current,r),[r?.startDatetime,r?.stopDatetime]),M=sf($),{patient:C,isLoadingPatient:E}=sb(t),[k,A]=(0,c.useState)(!0),T=(0,c.useRef)(new Set),L=(0,c.useCallback)((e,t)=>{t?T.current.add(e):T.current.delete(e),A(T.current.size>0)},[]),[O,R]=(0,c.useState)(!1),[D,I]=(0,c.useState)(!1),j=e6(s)?e6(i)?"enter":"edit":s,{isFormExpanded:N,hideFormCollapseToggle:P}=su(j),{hasMultiplePages:F}=sg(),{formJson:U,isLoading:V,formError:z}=oZ(n,e,i,o,y),H=(0,c.useMemo)(()=>!b&&C&&"ultra-wide"===M&&"embedded-view"!==s,[C,s,M,b]),W=(0,c.useMemo)(()=>["narrow"].includes(M),[M]),B=(0,c.useMemo)(()=>"embedded-view"!==s&&!k&&null!==F&&(W||!F),[s,W,k,F]),q=(0,c.useMemo)(()=>"embedded-view"!==s&&!k&&null!==F&&!W&&F,[W,k,F]);(0,c.useEffect)(()=>{(0,t6.N)(z,w("errorLoadingFormSchema","Error loading form schema"))},[z]),(0,c.useEffect)(()=>()=>{sc()},[]),(0,c.useEffect)(()=>{m?.(D)},[D]);let G=(0,c.useCallback)(e=>{e.preventDefault(),R(!0)},[]);return u().createElement("form",{ref:$,noValidate:!0,className:h()("cds--form",aA),onSubmit:G},E||V?u().createElement(ac,null):u().createElement(rV,{patient:C,isLoadingDependencies:k,patientUUID:t,sessionMode:j,sessionDate:S,formJson:U,workspaceLayout:"ultra-wide"===M?"maximized":"minimized",location:x?.sessionLocation,provider:x?.currentProvider,visit:r,handleConfirmQuestionDeletion:f,isFormExpanded:N,formSubmissionProps:{isSubmitting:O,setIsSubmitting:R,onSubmit:l,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:P,setIsFormDirty:I},u().createElement("div",{className:aT},k&&u().createElement("div",{className:aj},u().createElement("div",{className:aN})),u().createElement("div",{className:aL},q&&u().createElement(ak,{isFormSubmitting:O,sessionMode:s,defaultPage:U.defaultPage,onCancel:d,handleClose:p,hideFormCollapseToggle:P,hideControls:v}),u().createElement("div",{className:aO},H&&u().createElement(af,{patient:C,hideActionsOverflow:!0}),U.markdown&&u().createElement("div",{className:aI},u().createElement(n3,{markdown:U.markdown})),u().createElement("div",{className:aR},u().createElement(ah,{formJson:U,setIsLoadingFormDependencies:L})),B&&!v&&u().createElement(g.ButtonSet,{className:aD},u().createElement(g.Button,{kind:"secondary",onClick:()=>{d&&d(),p&&p(),P()}},"view"===s?w("close","Close"):w("cancel","Cancel")),u().createElement(g.Button,{className:aP,disabled:k||O||"view"===s,kind:"primary",type:"submit"},O?u().createElement(g.InlineLoading,{description:w("submitting","Submitting")+"..."}):u().createElement("span",null,`${w("save","Save")}`))))))))},aU=function(e){return u().createElement(c.Suspense,{fallback:u().createElement(ac,null)},u().createElement(e0.I18nextProvider,{i18n:window.i18next,defaultNS:rg.L},u().createElement(aF,e)))}},6232(e,t,n){"use strict";function i(e){return"boolean"==typeof e?e:"string"==typeof e?"true"==e:!!e}function r(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}n.d(t,{H:()=>i,O:()=>r})},10578(e,t,n){"use strict";n.d(t,{N:()=>r,j:()=>o});var i=n(23365);function r(e,t){if(e){let n=o(e).join(", ");console.error(e),(0,i.showSnackbar)({subtitle:n,title:t,kind:"error",isLowContrast:!1})}}function o(e){let t=e?.responseBody?.error?.fieldErrors,n=e?.responseBody?.error?.globalErrors;return t&&0!==Object.keys(t).length||n?n?.length?n.flatMap(e=>e.message):Object.values(t).flatMap(e=>e.map(e=>e.message)):[e?.responseBody?.error?.message??e?.message]}},77541(__unused_rspack_module,__webpack_exports__,__webpack_require__){"use strict";function evaluatePostSubmissionExpression(expression,encounters){let match,encounter=encounters[0],regx=/(?:\w+|'(?:\\'|[^'\n])*')/g,fieldIds=new Set;try{let replacedExpression;for(;match=regx.exec(expression);){let value=match[0].replace(/\\'/g,"'"),isBoolean=/^(true|false)$/i.test(value),isNumber=/^-?\d+$/.test(value),isFloat=/^-?\d+\.\d+$/.test(value);value.startsWith("'")&&value.endsWith("'")||"string"!=typeof value||isBoolean||isNumber||isFloat||fieldIds.add(value)}let fieldToValueMap={};return fieldIds.size&&(fieldToValueMap=getFieldValues(fieldIds,encounter)),replacedExpression=Object.keys(fieldToValueMap).length?expression.replace(/(\w+)/g,e=>Object.prototype.hasOwnProperty.call(fieldToValueMap,e)?fieldToValueMap[e]:e):expression,eval(replacedExpression)}catch(error){throw Error("Error evaluating expression")}}function getFieldValues(e,t){let n={};return e.forEach(e=>{let i=t.obs?.find(t=>t.formFieldPath.includes(e))?.value;"object"==typeof i&&(i=i.uuid),i&&(i=formatValue(i)),n[e]=i}),n}function formatValue(e){if("string"==typeof e&&(!(e.length>=2)||"'"!==e[0]||"'"!==e[e.length-1]))return`'${e}'`;return e}__webpack_require__.d(__webpack_exports__,{g:()=>evaluatePostSubmissionExpression})},80952(e,t,n){e=n.nmd(e),function(){var e="ace",t=function(){return this}();if(!t&&"u">typeof window&&(t=window),e||"u"<typeof requirejs){var n=function(e,t,i){"string"!=typeof e?n.original?n.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(i=t),n.modules[e]||(n.payloads[e]=i,n.modules[e]=null))};n.modules={},n.payloads={};var i=function(e,t,n){if("string"==typeof t){var i=s(e,t);if(void 0!=i)return n&&n(),i}else if("[object Array]"===Object.prototype.toString.call(t)){for(var o=[],a=0,l=t.length;a<l;++a){var c=s(e,t[a]);if(void 0==c&&r.original)return;o.push(c)}return n&&n.apply(null,o)||!0}},r=function(e,t){var n=i("",e,t);return void 0==n&&r.original?r.original.apply(this,arguments):n},o=function(e,t){if(-1!==t.indexOf("!")){var n=t.split("!");return o(e,n[0])+"!"+o(e,n[1])}if("."==t.charAt(0))for(t=e.split("/").slice(0,-1).join("/")+"/"+t;-1!==t.indexOf(".")&&i!=t;){var i=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return t},s=function(e,t){t=o(e,t);var r=n.modules[t];if(!r){if("function"==typeof(r=n.payloads[t])){var s={},a={id:t,uri:"",exports:s,packaged:!0};s=r(function(e,n){return i(t,e,n)},s,a)||a.exports,n.modules[t]=s,delete n.payloads[t]}r=n.modules[t]=s||r}return r};a(e)}function a(e){var i=t;e&&(t[e]||(t[e]={}),i=t[e]),i.define&&i.define.packaged||(n.original=i.define,i.define=n,i.define.packaged=!0),i.require&&i.require.packaged||(r.original=i.require,i.require=r,i.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,t,n){function i(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||i(String.prototype,"startsWith",function(e,t){return t=t||0,this.lastIndexOf(e,t)===t}),String.prototype.endsWith||i(String.prototype,"endsWith",function(e,t){var n=this;(void 0===t||t>n.length)&&(t=n.length),t-=e.length;var i=n.indexOf(e,t);return -1!==i&&i===t}),String.prototype.repeat||i(String.prototype,"repeat",function(e){for(var t="",n=this;e>0;)1&e&&(t+=n),(e>>=1)&&(n+=n);return t}),String.prototype.includes||i(String.prototype,"includes",function(e,t){return -1!=this.indexOf(e,t)}),Object.assign||(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];null!=i&&Object.keys(i).forEach(function(e){t[e]=i[e]})}return t}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(t){return e[t]})}),Array.prototype.find||i(Array.prototype,"find",function(e){for(var t=this.length,n=arguments[1],i=0;i<t;i++){var r=this[i];if(e.call(n,r,i,this))return r}}),Array.prototype.findIndex||i(Array.prototype,"findIndex",function(e){for(var t=this.length,n=arguments[1],i=0;i<t;i++){var r=this[i];if(e.call(n,r,i,this))return i}}),Array.prototype.includes||i(Array.prototype,"includes",function(e,t){return -1!=this.indexOf(e,t)}),Array.prototype.fill||i(Array.prototype,"fill",function(e){for(var t=this,n=t.length>>>0,i=arguments[1],r=0|i,o=r<0?Math.max(n+r,0):Math.min(r,n),s=arguments[2],a=void 0===s?n:0|s,l=a<0?Math.max(n+a,0):Math.min(a,n);o<l;)t[o]=e,o++;return t}),Array.of||i(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,t,n){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,t,n){t.deepCopy=function e(t){if("object"!=typeof t||!t)return t;if(Array.isArray(t)){n=[];for(var n,i=0;i<t.length;i++)n[i]=e(t[i]);return n}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var i in n={},t)n[i]=e(t[i]);return n}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>=1)&&(e+=e);return n};var i=/^\s\s*/,r=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(i,"")},t.stringTrimRight=function(e){return e.replace(r,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){for(var t=[],n=0,i=e.length;n<i;n++)e[n]&&"object"==typeof e[n]?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=e("./deep_copy").deepCopy,t.arrayToMap=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},i=function(e){return i.cancel(),t=setTimeout(n,e||0),i};return i.schedule=i,i.call=function(){return this.cancel(),e(),i},i.cancel=function(){return clearTimeout(t),t=null,i},i.isPending=function(){return t},i},t.delayedCall=function(e,t){var n=null,i=function(){n=null,e()},r=function(e){null==n&&(n=setTimeout(i,e||t))};return r.delay=function(e){n&&clearTimeout(n),n=setTimeout(i,e||t)},r.schedule=r,r.call=function(){this.cancel(),e()},r.cancel=function(){n&&clearTimeout(n),n=null},r.isPending=function(){return n},r},t.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},t.skipEmptyMatch=function(e,t,n){return n&&e.codePointAt(t)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,t,n){"use strict";t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};var i="object"==typeof navigator?navigator:{},r=(/mac|win|linux/i.exec(i.platform)||["other"])[0].toLowerCase(),o=i.userAgent||"",s=i.appName||"";t.isWin="win"==r,t.isMac="mac"==r,t.isLinux="linux"==r,t.isIE="Microsoft Internet Explorer"==s||s.indexOf("MSAppHost")>=0?parseFloat((o.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((o.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=o.match(/ Gecko\/\d+/),t.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(o.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(o.split(" Chrome/")[1])||void 0,t.isSafari=parseFloat(o.split(" Safari/")[1])&&!t.isChrome||void 0,t.isEdge=parseFloat(o.split(" Edge/")[1])||void 0,t.isAIR=o.indexOf("AdobeAIR")>=0,t.isAndroid=o.indexOf("Android")>=0,t.isChromeOS=o.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(o)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIOS||t.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var i,r=e("./useragent"),o="http://www.w3.org/1999/xhtml";t.buildDom=function e(t,n,i){if("string"==typeof t&&t){var r=document.createTextNode(t);return n&&n.appendChild(r),r}if(!Array.isArray(t))return t&&t.appendChild&&n&&n.appendChild(t),t;if("string"!=typeof t[0]||!t[0]){for(var o=[],s=0;s<t.length;s++){var a=e(t[s],n,i);a&&o.push(a)}return o}var l=document.createElement(t[0]),c=t[1],u=1;c&&"object"==typeof c&&!Array.isArray(c)&&(u=2);for(var s=u;s<t.length;s++)e(t[s],l,i);return 2==u&&Object.keys(c).forEach(function(e){var t=c[e];"class"===e?l.className=Array.isArray(t)?t.join(" "):t:"function"==typeof t||"value"==e||"$"==e[0]?l[e]=t:"ref"===e?i&&(i[t]=l):"style"===e?"string"==typeof t&&(l.style.cssText=t):null!=t&&l.setAttribute(e,t)}),n&&n.appendChild(l),l},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||o,e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){return(t?t.ownerDocument:document).createTextNode(e)},t.createFragment=function(e){return(e?e.ownerDocument:document).createDocumentFragment()},t.hasCssClass=function(e,t){return -1!==(e.className+"").split(/\s+/g).indexOf(t)},t.addCssClass=function(e,n){t.hasCssClass(e,n)||(e.className+=" "+n)},t.removeCssClass=function(e,t){for(var n=e.className.split(/\s+/g);;){var i=n.indexOf(t);if(-1==i)break;n.splice(i,1)}e.className=n.join(" ")},t.toggleCssClass=function(e,t){for(var n=e.className.split(/\s+/g),i=!0;;){var r=n.indexOf(t);if(-1==r)break;i=!1,n.splice(r,1)}return i&&n.push(t),e.className=n.join(" "),i},t.setCssClass=function(e,n,i){i?t.addCssClass(e,n):t.removeCssClass(e,n)},t.hasCssString=function(e,t){var n,i=0;if(n=(t=t||document).querySelectorAll("style")){for(;i<n.length;)if(n[i++].id===e)return!0}},t.removeElementById=function(e,t){(t=t||document).getElementById(e)&&t.getElementById(e).remove()};var s=[];function a(){var e=s;s=null,e&&e.forEach(function(e){l(e[0],e[1])})}function l(e,n,r){if(!("u"<typeof document)){if(s){if(r)a();else if(!1===r)return s.push([e,n])}if(!i){var o=r;r&&r.getRootNode&&(o=r.getRootNode())&&o!=r||(o=document);var l=o.ownerDocument||o;if(n&&t.hasCssString(n,o))return null;n&&(e+="\n/*# sourceURL=ace/css/"+n+" */");var c=t.createElement("style");c.appendChild(l.createTextNode(e)),n&&(c.id=n),o==l&&(o=t.getDocumentHead(l)),o.insertBefore(c,o.firstChild)}}}if(t.useStrictCSP=function(e){i=e,!1==e?a():s||(s=[])},t.importCssString=l,t.importCssStylsheet=function(e,n){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(n))},t.scrollbarWidth=function(e){var n=t.createElement("ace_inner");n.style.width="100%",n.style.minWidth="0px",n.style.height="200px",n.style.display="block";var i=t.createElement("ace_outer"),r=i.style;r.position="absolute",r.left="-10000px",r.overflow="hidden",r.width="200px",r.minWidth="0px",r.height="150px",r.display="block",i.appendChild(n);var o=e&&e.documentElement||document&&document.documentElement;if(!o)return 0;o.appendChild(i);var s=n.offsetWidth;r.overflow="scroll";var a=n.offsetWidth;return s===a&&(a=i.clientWidth),o.removeChild(i),s-a},t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,n){e[t]!==n&&(e[t]=n)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=!r.isWin||"u">typeof window&&window.devicePixelRatio>=1.5,r.isChromeOS&&(t.HI_DPI=!1),"u">typeof document){var c=document.createElement("div");t.HI_DPI&&void 0!==c.style.transform&&(t.HAS_CSS_TRANSFORMS=!0),r.isEdge||void 0===c.style.animationName||(t.HAS_CSS_ANIMATION=!0),c=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){4===n.readyState&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=i.getDocumentHead(),r=document.createElement("script");r.src=e,n.appendChild(r),r.onload=r.onreadystatechange=function(e,n){(n||!r.readyState||"loaded"==r.readyState||"complete"==r.readyState)&&(r=r.onload=r.onreadystatechange=null,n||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var i={},r=function(){this.propagationStopped=!0},o=function(){this.defaultPrevented=!0};i._emit=i._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],i=this._defaultHandlers[e];if(n.length||i){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=r),t.preventDefault||(t.preventDefault=o),n=n.slice();for(var s=0;s<n.length&&(n[s](t,this),!t.propagationStopped);s++);if(i&&!t.defaultPrevented)return i(t,this)}},i._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(n){n=n.slice();for(var i=0;i<n.length;i++)n[i](t,this)}},i.once=function(e,t){var n=this;if(this.on(e,function i(){n.off(e,i),t.apply(null,arguments)}),!t)return new Promise(function(e){t=e})},i.setDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n||(n=this._defaultHandlers={_disabled_:{}}),n[e]){var i=n[e],r=n._disabled_[e];r||(n._disabled_[e]=r=[]),r.push(i);var o=r.indexOf(t);-1!=o&&r.splice(o,1)}n[e]=t},i.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n){var i=n._disabled_[e];if(n[e]==t)i&&this.setDefaultHandler(e,i.pop());else if(i){var r=i.indexOf(t);-1!=r&&i.splice(r,1)}}},i.on=i.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];return i||(i=this._eventRegistry[e]=[]),-1==i.indexOf(t)&&i[n?"unshift":"push"](t),t},i.off=i.removeListener=i.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}},i.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},t.EventEmitter=i}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,t,n){t.reportError=function(e,t){var n=Error(e);n.data=t,"object"==typeof console&&console.error&&console.error(n),setTimeout(function(){throw n})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,t,n){t.defaultEnglishMessages={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions"}}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(e,t,n){var i,r,o=e("./oop"),s=e("./event_emitter").EventEmitter,a=e("./report_error").reportError,l=e("./default_english_messages").defaultEnglishMessages,c={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};if(e)Array.isArray(e)||(e=Object.keys(t=e));else{var n=this.$options;e=Object.keys(n).filter(function(e){return!n[e].hidden})}return e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]!==t){var n=this.$options[e];if(!n)return u('misspelled option "'+e+'"');if(n.forwardTo)return this[n.forwardTo]&&this[n.forwardTo].setOption(e,t);n.handlesSet||(this["$"+e]=t),n&&n.set&&n.set.call(this,t)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:u('misspelled option "'+e+'"')}};function u(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var d=function(){function e(){this.$defaultOptions={},i=l,r="dollarSigns"}return e.prototype.defineOptions=function(e,t,n){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(n).forEach(function(t){var i=n[t];"string"==typeof i&&(i={forwardTo:i}),i.name||(i.name=t),e.$options[i.name]=i,"initialValue"in i&&(e["$"+i.name]=i.initialValue)}),o.implement(e,c),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var n=e.$options[t];"value"in n&&e.setOption(t,n.value)})},e.prototype.setDefaultValue=function(e,t,n){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][t])break;if(!this.$defaultOptions[e][t])return!1}var i=this.$defaultOptions[e]||(this.$defaultOptions[e]={});i[t]&&(i.forwardTo?this.setDefaultValue(i.forwardTo,t,n):i[t].value=n)},e.prototype.setDefaultValues=function(e,t){Object.keys(t).forEach(function(n){this.setDefaultValue(e,n,t[n])},this)},e.prototype.setMessages=function(e,t){i=e,t&&t.placeholders&&(r=t.placeholders)},e.prototype.nls=function(e,t,n){!i[e]&&(u("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+t+"'."),i[t]||u("No message found for the default string '"+t+"' in the provided messages. Falling back to the default English message."));var o=i[e]||i[t]||t;return n&&("dollarSigns"===r&&(o=o.replace(/\$(\$|[\d]+)/g,function(e,t){return"$"==t?"$":n[t]})),"curlyBrackets"===r&&(o=o.replace(/\{([^\}]+)\}/g,function(e,t){return n[t]}))),o},e}();d.prototype.warn=u,d.prototype.reportError=a,o.implement(d.prototype,s),t.AppConfig=d}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,t,n){n.exports='.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print-margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm {\n background-color: #FFFFFF;\n color: black;\n}\n\n.ace-tm .ace_cursor {\n color: black;\n}\n \n.ace-tm .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText=e("./textmate-css"),t.$id="ace/theme/textmate",e("../lib/dom").importCssString(t.cssText,t.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(e,t,n){var i,r=e("./lib/lang"),o=e("./lib/net"),s=e("./lib/dom");n.exports=t=new(e("./lib/app_config")).AppConfig;var a={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};t.get=function(e){if(!a.hasOwnProperty(e))throw Error("Unknown config key: "+e);return a[e]},t.set=function(e,t){if(a.hasOwnProperty(e))a[e]=t;else if(!1==this.setDefaultValue("",e,t))throw Error("Unknown config key: "+e);"useStrictCSP"==e&&s.useStrictCSP(t)},t.all=function(){return r.copyObject(a)},t.$modes={},t.moduleUrl=function(e,t){if(a.$moduleUrls[e])return a.$moduleUrls[e];var n=e.split("/"),i="snippets"==(t=t||n[n.length-2]||"")?"/":"-",r=n[n.length-1];if("worker"==t&&"-"==i){var o=RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");r=r.replace(o,"")}(!r||r==t)&&n.length>1&&(r=n[n.length-2]);var s=a[t+"Path"];return null==s?s=a.basePath:"/"==i&&(t=i=""),s&&"/"!=s.slice(-1)&&(s+="/"),s+t+i+r+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t};var l=function(t,n){return"ace/theme/textmate"===t||"./theme/textmate"===t?n(null,e("./theme/textmate")):i?i(t,n):void console.error("loader is not configured")};t.setLoader=function(e){i=e},t.dynamicModules=Object.create(null),t.$loading={},t.$loaded={},t.loadModule=function(e,n){if(Array.isArray(e))var i,r=e[0],s=e[1];else if("string"==typeof e)var s=e;var a=function(e){if(e&&!t.$loading[s])return n&&n(e);if(t.$loading[s]||(t.$loading[s]=[]),t.$loading[s].push(n),!(t.$loading[s].length>1)){var i=function(){l(s,function(e,n){n&&(t.$loaded[s]=n),t._emit("load.module",{name:s,module:n});var i=t.$loading[s];t.$loading[s]=null,i.forEach(function(e){e&&e(n)})})};if(!t.get("packaged"))return i();o.loadScript(t.moduleUrl(s,r),i),c()}};if(t.dynamicModules[s])t.dynamicModules[s]().then(function(e){e.default?a(e.default):a(e)});else{try{i=this.$require(s)}catch(e){}a(i||t.$loaded[s])}},t.$require=function(e){if("function"==typeof n.require)return n.require(e)},t.setModuleLoader=function(e,n){t.dynamicModules[e]=n};var c=function(){a.basePath||a.workerPath||a.modePath||a.themePath||Object.keys(a.$moduleUrls).length||(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),c=function(){})};t.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var i=e("./config");i.setLoader(function(t,n){e([t],function(e){n(null,e)})});var r=function(){return this||"u">typeof window&&window}();function o(t){if(r&&r.document){i.set("packaged",t||e.packaged||n.packaged||r.define&&define.packaged);var o={},a="",l=document.currentScript||document._currentScript,c=l&&l.ownerDocument||document;l&&l.src&&(a=l.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var u=c.getElementsByTagName("script"),d=0;d<u.length;d++){var h=u[d],p=h.src||h.getAttribute("src");if(p){for(var f=h.attributes,g=0,m=f.length;g<m;g++){var v=f[g];0===v.name.indexOf("data-ace-")&&(o[s(v.name.replace(/^data-ace-/,""))]=v.value)}var b=p.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);b&&(a=b[1])}}for(var y in a&&(o.base=o.base||a,o.packaged=!0),o.basePath=o.base,o.workerPath=o.workerPath||o.base,o.modePath=o.modePath||o.base,o.themePath=o.themePath||o.base,delete o.base,o)void 0!==o[y]&&i.set(y,o[y])}}function s(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}n.exports=function(t){i.init=o,i.$require=e,t.require=e,"function"==typeof define&&(t.define=define)},o(!0)}),ace.define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var i=function(){function e(e,t,n,i){this.start={row:e,column:t},this.end={row:n,column:i}}return e.prototype.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},e.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},e.prototype.contains=function(e,t){return 0==this.compare(e,t)},e.prototype.compareRange=function(e){var t,n=e.end,i=e.start;return 1==(t=this.compare(n.row,n.column))?1==(t=this.compare(i.row,i.column))?2:+(0==t):-1==t?-2:-1==(t=this.compare(i.row,i.column))?-1:42*(1==t)},e.prototype.comparePoint=function(e){return this.compare(e.row,e.column)},e.prototype.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},e.prototype.intersects=function(e){var t=this.compareRange(e);return -1==t||0==t||1==t},e.prototype.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},e.prototype.isStart=function(e,t){return this.start.row==e&&this.start.column==t},e.prototype.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},e.prototype.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},e.prototype.inside=function(e,t){if(0==this.compare(e,t)&&!(this.isEnd(e,t)||this.isStart(e,t)))return!0;return!1},e.prototype.insideStart=function(e,t){if(0==this.compare(e,t)&&!this.isEnd(e,t))return!0;return!1},e.prototype.insideEnd=function(e,t){if(0==this.compare(e,t)&&!this.isStart(e,t))return!0;return!1},e.prototype.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:+(t>this.end.column)},e.prototype.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},e.prototype.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},e.prototype.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},e.prototype.clipRows=function(t,n){if(this.end.row>n)var i={row:n+1,column:0};else if(this.end.row<t)var i={row:t,column:0};if(this.start.row>n)var r={row:n+1,column:0};else if(this.start.row<t)var r={row:t,column:0};return e.fromPoints(r||this.start,i||this.end)},e.prototype.extend=function(t,n){var i=this.compare(t,n);if(0==i)return this;if(-1==i)var r={row:t,column:n};else var o={row:t,column:n};return e.fromPoints(r||this.start,o||this.end)},e.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},e.prototype.isMultiLine=function(){return this.start.row!==this.end.row},e.prototype.clone=function(){return e.fromPoints(this.start,this.end)},e.prototype.collapseRows=function(){return 0==this.end.column?new e(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new e(this.start.row,0,this.end.row,0)},e.prototype.toScreenRange=function(t){var n=t.documentToScreenPosition(this.start),i=t.documentToScreenPosition(this.end);return new e(n.row,n.column,i.row,i.column)},e.prototype.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t},e}();i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,t,n){"use strict";for(var i=e("./oop"),r={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},o={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},s=0;s<10;s++)o["Digit"+s]=48+s,o["Numpad"+s]=96+s,r.PRINTABLE_KEYS[48+s]=""+s,r.FUNCTION_KEYS[96+s]="Numpad"+s;for(var s=65;s<91;s++){var a=String.fromCharCode(s+32);o["Key"+a.toUpperCase()]=s,r.PRINTABLE_KEYS[s]=a}for(var s=1;s<13;s++)o["F"+s]=111+s,r.FUNCTION_KEYS[111+s]="F"+s;var l={Shift:16,Control:17,Alt:18,Meta:224};for(var c in l)o[c]=o[c+"Left"]=o[c+"Right"]=l[c];for(var u in t.$codeToKeyCode=o,r.PRINTABLE_KEYS[173]="-",r.FUNCTION_KEYS){var d=r.FUNCTION_KEYS[u].toLowerCase();r[d]=parseInt(u,10)}for(var u in r.PRINTABLE_KEYS){var d=r.PRINTABLE_KEYS[u].toLowerCase();r[d]=parseInt(u,10)}i.mixin(r,r.MODIFIER_KEYS),i.mixin(r,r.PRINTABLE_KEYS),i.mixin(r,r.FUNCTION_KEYS),r.enter=r.return,r.escape=r.esc,r.del=r.delete,function(){for(var e=["cmd","ctrl","alt","shift"],t=Math.pow(2,e.length);t--;)r.KEY_MODS[t]=e.filter(function(e){return t&r.KEY_MODS[e]}).join("-")+"-"}(),r.KEY_MODS[0]="",r.KEY_MODS[-1]="input-",i.mixin(t,r),t.default=t,t.keyCodeToString=function(e){var t=r[e];return"string"!=typeof t&&(t=String.fromCharCode(e)),t.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";var i,r=e("./keys"),o=e("./useragent"),s=null,a=0;function l(){i=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return i={passive:!1},!0}})}catch(e){}}function c(){return void 0==i&&l(),i}function u(e,t,n){this.elem=e,this.type=t,this.callback=n}u.prototype.destroy=function(){h(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var d=t.addListener=function(e,t,n,i){e.addEventListener(t,n,c()),i&&i.$toDestroy.push(new u(e,t,n))},h=t.removeListener=function(e,t,n){e.removeEventListener(t,n,c())};function p(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function f(e,t,n){var i=p(t);if(!n&&t.code&&(n=r.$codeToKeyCode[t.code]||n),!o.isMac&&s){if(t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(i|=8),s.altGr)if((3&i)==3)return;else s.altGr=0;if(18===n||17===n){var l=t.location;17===n&&1===l?1==s[n]&&(a=t.timeStamp):18===n&&3===i&&2===l&&t.timeStamp-a<50&&(s.altGr=!0)}}if(n in r.MODIFIER_KEYS&&(n=-1),i||13!==n||3!==t.location||(e(t,i,-n),!t.defaultPrevented)){if(o.isChromeOS&&8&i){if(e(t,i,n),t.defaultPrevented)return;i&=-9}return(!!i||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS)&&e(t,i,n)}}function g(){s=Object.create(null)}if(t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},t.preventDefault=function(e){e.preventDefault&&e.preventDefault()},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||o.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},t.capture=function(e,t,n){var i=e&&e.ownerDocument||document;function r(e){t&&t(e),n&&n(e),h(i,"mousemove",t),h(i,"mouseup",r),h(i,"dragstart",r)}return d(i,"mousemove",t),d(i,"mouseup",r),d(i,"dragstart",r),r},t.addMouseWheelListener=function(e,t,n){d(e,"wheel",function(e){var n=.15,i=e.deltaX||0,r=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=i*n,e.wheelY=r*n;break;case e.DOM_DELTA_LINE:var o=15;e.wheelX=15*i,e.wheelY=r*o;break;case e.DOM_DELTA_PAGE:var s=150;e.wheelX=150*i,e.wheelY=r*s}t(e)},n)},t.addMultiMouseDownListener=function(e,n,i,r,s){var a,l,c,u=0,h={2:"dblclick",3:"tripleclick",4:"quadclick"};function p(e){if(0!==t.getButton(e)?u=0:e.detail>1?++u>4&&(u=1):u=1,o.isIE){var s=Math.abs(e.clientX-a)>5||Math.abs(e.clientY-l)>5;(!c||s)&&(u=1),c&&clearTimeout(c),c=setTimeout(function(){c=null},n[u-1]||600),1==u&&(a=e.clientX,l=e.clientY)}if(e._clicks=u,i[r]("mousedown",e),u>4)u=0;else if(u>1)return i[r](h[u],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){d(e,"mousedown",p,s)})},t.getModifierString=function(e){return r.KEY_MODS[p(e)]},t.addCommandKeyListener=function(e,n,i){var r=null;d(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=f(n,e,e.keyCode);return r=e.defaultPrevented,t},i),d(e,"keypress",function(e){r&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),r=null)},i),d(e,"keyup",function(e){s[e.keyCode]=null},i),s||(g(),d(window,"focus",g))},"object"==typeof window&&window.postMessage&&!o.isOldIE){var m=1;t.nextTick=function(e,n){n=n||window;var i="zero-timeout-message-"+m++,r=function(o){o.data==i&&(t.stopPropagation(o),h(n,"message",r),e())};d(n,"message",r),n.postMessage(i,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function n(){t.$idleBlocked?setTimeout(n,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(e,t,n){"use strict";var i;n.exports={lineMode:!1,pasteCancelled:function(){return!!(i&&i>Date.now()-50)||(i=!1)},cancel:function(){i=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../config").nls,o=e("../lib/useragent"),s=e("../lib/dom"),a=e("../lib/lang"),l=e("../clipboard"),c=o.isChrome<18,u=o.isIE,d=o.isChrome>63,h=400,p=e("../lib/keys"),f=p.KEY_MODS,g=o.isIOS,m=g?/\s/:/\n/,v=o.isMobile;t.TextInput=function(e,t){var n,b=s.createElement("textarea");b.className="ace_text-input",b.setAttribute("wrap","off"),b.setAttribute("autocorrect","off"),b.setAttribute("autocapitalize","off"),b.setAttribute("spellcheck","false"),b.style.opacity="0",e.insertBefore(b,e.firstChild);var y=!1,w=!1,x=!1,$=!1,_="";v||(b.style.fontSize="1px");var S=!1,M=!1,C="",E=0,k=0,A=0,T=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,O=0;try{var R=document.activeElement===b}catch(e){}this.setNumberOfExtraLines=function(e){if(T=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,e<0){O=0;return}O=e},this.setAriaOptions=function(e){if(e.activeDescendant?(b.setAttribute("aria-haspopup","true"),b.setAttribute("aria-autocomplete",e.inline?"both":"list"),b.setAttribute("aria-activedescendant",e.activeDescendant)):(b.setAttribute("aria-haspopup","false"),b.setAttribute("aria-autocomplete","both"),b.removeAttribute("aria-activedescendant")),e.role&&b.setAttribute("role",e.role),e.setLabel){b.setAttribute("aria-roledescription",r("text-input.aria-roledescription","editor"));var n="";t.$textInputAriaLabel&&(n+="".concat(t.$textInputAriaLabel,", ")),t.session&&(n+=r("text-input.aria-label","Cursor at row $0",[t.session.selection.cursor.row+1])),b.setAttribute("aria-label",n)}},this.setAriaOptions({role:"textbox"}),i.addListener(b,"blur",function(e){M||(t.onBlur(e),R=!1)},t),i.addListener(b,"focus",function(e){if(!M){if(R=!0,o.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),o.isEdge?setTimeout(I):I()}},t),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:t.renderer.enableKeyboardAccessibility}),_||d||"browser"==this.$focusScroll)return b.focus({preventScroll:!0});var e=b.style.top;b.style.position="fixed",b.style.top="0px";try{var n=0!=b.getBoundingClientRect().top}catch(e){return}var i=[];if(n)for(var r=b.parentElement;r&&1==r.nodeType;)i.push(r),r.setAttribute("ace_nocontext","true"),r=!r.parentElement&&r.getRootNode?r.getRootNode().host:r.parentElement;b.focus({preventScroll:!0}),n&&i.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){b.style.position="","0px"==b.style.top&&(b.style.top=e)},0)},this.blur=function(){b.blur()},this.isFocused=function(){return R},t.on("beforeEndOperation",function(){var e=t.curOp,n=e&&e.command&&e.command.name;if("insertstring"!=n){var i=n&&(e.docChanged||e.selectionChanged);x&&i&&(C=b.value="",Y()),I()}});var D=function(e,n){for(var i=n,r=1;r<=e-T&&r<2*O+1;r++)i+=t.session.getLine(e-r).length+1;return i},I=g?function(e){if(R&&(!y||e)&&!$){e||(e="");var n="\n ab"+e+"cde fg\n";n!=b.value&&(b.value=C=n);var i=4,r=4+(e.length||+!t.selection.isEmpty());(E!=i||k!=r)&&b.setSelectionRange(i,r),E=i,k=r}}:function(){if(!x&&!$&&(R||F)){x=!0;var e=0,n=0,i="";if(t.session){var r=t.selection,o=r.getRange(),s=r.cursor.row;s===L+1?L=(T=L+1)+2*O:s===T-1?T=(L=T-1)-2*O:(s<T-1||s>L+1)&&(T=s>O?s-O:0,L=s>O?s+O:2*O);for(var a=[],l=T;l<=L;l++)a.push(t.session.getLine(l));if(i=a.join("\n"),e=D(o.start.row,o.start.column),n=D(o.end.row,o.end.column),o.start.row<T){var c=t.session.getLine(T-1);e=o.start.row<T-1?0:e,n+=c.length+1,i=c+"\n"+i}else if(o.end.row>L){var u=t.session.getLine(L+1);n=(o.end.row>L+1?u.length:o.end.column)+(i.length+1),i=i+"\n"+u}else v&&s>0&&(i="\n"+i,n+=1,e+=1);i.length>h&&(e<h&&n<h?i=i.slice(0,h):(i="\n",e==n?e=n=0:(e=0,n=1)));var d=i+"\n\n";d!=C&&(b.value=C=d,E=k=d.length)}if(F&&(E=b.selectionStart,k=b.selectionEnd),k!=n||E!=e||b.selectionEnd!=k)try{b.setSelectionRange(e,n),E=e,k=n}catch(e){}x=!1}};this.resetSelection=I,R&&t.onFocus();var j=function(e){return 0===e.selectionStart&&e.selectionEnd>=C.length&&e.value===C&&C&&e.selectionEnd!==k},N=function(e){!x&&(y?y=!1:j(b)?(t.selectAll(),I()):v&&b.selectionStart!=E&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,n){if(F&&(F=!1),w)return I(),e&&t.onPaste(e),w=!1,"";for(var i=b.selectionStart,r=b.selectionEnd,s=E,a=C.length-k,l=e,c=e.length-i,u=e.length-r,d=0;s>0&&C[d]==e[d];)d++,s--;for(l=l.slice(d),d=1;a>0&&C.length-d>E-1&&C[C.length-d]==e[e.length-d];)d++,a--;c-=d-1,u-=d-1;var h=l.length-d+1;if(h<0&&(s=-h,h=0),l=l.slice(0,h),!n&&!l&&!c&&!s&&!a&&!u)return"";$=!0;var p=!1;return o.isAndroid&&". "==l&&(l=" ",p=!0),(!l||s||a||c||u)&&!S?t.onTextInput(l,{extendLeft:s,extendRight:a,restoreStart:c,restoreEnd:u}):t.onTextInput(l),$=!1,C=e,E=i,k=r,A=u,p?"\n":l},V=function(e){if(x)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return t.execCommand("undo");if("historyRedo"==e.inputType)return t.execCommand("redo")}var n=b.value,i=U(n,!0);(n.length>h+100||m.test(i)||v&&E<1&&E==k)&&I()},z=function(e,t,n){var i=e.clipboardData||window.clipboardData;if(i&&!c){var r=u||n?"Text":"text/plain";try{if(t)return!1!==i.setData(r,t);return i.getData(r)}catch(e){if(!n)return z(e,t,!0)}}},H=function(e,n){var r=t.getCopyText();if(!r)return i.preventDefault(e);z(e,r)?(g&&(I(r),y=r,setTimeout(function(){y=!1},10)),n?t.onCut():t.onCopy(),i.preventDefault(e)):(y=!0,b.value=r,b.select(),setTimeout(function(){y=!1,I(),n?t.onCut():t.onCopy()}))},W=function(e){H(e,!0)},B=function(e){H(e,!1)},q=function(e){var n=z(e);l.pasteCancelled()||("string"==typeof n?(n&&t.onPaste(n,e),o.isIE&&setTimeout(I),i.preventDefault(e)):(b.value="",w=!0))};i.addCommandKeyListener(b,function(e,n,i){if(!x)return t.onCommandKey(e,n,i)},t),i.addListener(b,"select",N,t),i.addListener(b,"input",V,t),i.addListener(b,"cut",W,t),i.addListener(b,"copy",B,t),i.addListener(b,"paste",q,t),"oncut"in b&&"oncopy"in b&&"onpaste"in b||i.addListener(e,"keydown",function(e){if((!o.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:B(e);break;case 86:q(e);break;case 88:W(e)}},t);var G=function(e){if(!x&&t.onCompositionStart&&!t.$readOnly&&(x={},!S)){e.data&&(x.useTextareaForIME=!1),setTimeout(K,0),t._signal("compositionStart"),t.on("mousedown",Q);var n=t.getSelectionRange();n.end.row=n.start.row,n.end.column=n.start.column,x.markerRange=n,x.selectionStart=E,t.onCompositionStart(x),x.useTextareaForIME?(C=b.value="",E=0,k=0):(b.msGetInputContext&&(x.context=b.msGetInputContext()),b.getInputContext&&(x.context=b.getInputContext()))}},K=function(){if(x&&t.onCompositionUpdate&&!t.$readOnly){if(S)return Q();x.useTextareaForIME?t.onCompositionUpdate(b.value):(U(b.value),x.markerRange&&(x.context&&(x.markerRange.start.column=x.selectionStart=x.context.compositionStartOffset),x.markerRange.end.column=x.markerRange.start.column+k-x.selectionStart+A))}},Y=function(e){t.onCompositionEnd&&!t.$readOnly&&(x=!1,t.onCompositionEnd(),t.off("mousedown",Q),e&&V())};function Q(){M=!0,b.blur(),b.focus(),M=!1}var Z=a.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&b.value.length<b.selectionStart&&(x||(C=b.value),E=k=-1,I()),Z()}function X(){clearTimeout(n),n=setTimeout(function(){_&&(b.style.cssText=_,_=""),t.renderer.$isMousePressed=!1,t.renderer.$keepTextAreaAtCursor&&t.renderer.$moveTextAreaToCursor()},0)}i.addListener(b,"compositionstart",G,t),i.addListener(b,"compositionupdate",K,t),i.addListener(b,"keyup",J,t),i.addListener(b,"keydown",Z,t),i.addListener(b,"compositionend",Y,t),this.getElement=function(){return b},this.setCommandMode=function(e){S=e,b.readOnly=!1},this.setReadOnly=function(e){S||(b.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){F=!0,I(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,r){_||(_=b.style.cssText),b.style.cssText=(r?"z-index:100000;":"")+(o.isIE?"opacity:0.1;":"")+"text-indent: -"+(E+k)*t.renderer.characterWidth*.5+"px;";var a=t.container.getBoundingClientRect(),l=s.computedStyle(t.container),c=a.top+(parseInt(l.borderTopWidth)||0),u=a.left+(parseInt(a.borderLeftWidth)||0),d=a.bottom-c-b.clientHeight-2,h=function(e){s.translate(b,e.clientX-u-2,Math.min(e.clientY-c-2,d))};h(e),"mousedown"==e.type&&(t.renderer.$isMousePressed=!0,clearTimeout(n),o.isWin&&i.capture(t.container,h,X))},this.onContextMenuClose=X;var ee=function(e){t.textInput.onContextMenu(e),X()};function et(e,t,n){var i=null,r=!1;n.addEventListener("keydown",function(e){i&&clearTimeout(i),r=!0},!0),n.addEventListener("keyup",function(e){i=setTimeout(function(){r=!1},100)},!0);var o=function(e){if(document.activeElement===n&&!r&&!x&&!t.$mouseHandler.isMousePressed&&!y){var i=n.selectionStart,o=n.selectionEnd,s=null,a=0;if(0==i?s=p.up:1==i?s=p.home:o>k&&"\n"==C[o]?s=p.end:i<E&&" "==C[i-1]?(s=p.left,a=f.option):i<E||i==E&&k!=E&&i==o?s=p.left:o>k&&C.slice(0,o).split("\n").length>2?s=p.down:o>k&&" "==C[o-1]?(s=p.right,a=f.option):(o>k||o==k&&k!=E&&i==o)&&(s=p.right),i!==o&&(a|=f.shift),s){if(!t.onCommandKey({},a,s)&&t.commands){s=p.keyCodeToString(s);var l=t.commands.findKeyCommand(a,s);l&&t.execCommand(l)}E=i,k=o,I("")}}};document.addEventListener("selectionchange",o),t.on("destroy",function(){document.removeEventListener("selectionchange",o)})}i.addListener(b,"mouseup",ee,t),i.addListener(b,"mousedown",function(e){e.preventDefault(),X()},t),i.addListener(t.renderer.scroller,"contextmenu",ee,t),i.addListener(b,"contextmenu",ee,t),g&&et(e,t,b),this.destroy=function(){b.parentElement&&b.parentElement.removeChild(b)}},t.$setUserAgentForTests=function(e,t){v=e,g=t}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/useragent"),r=0,o=550,s=function(){function e(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}return e.prototype.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,o=e.getButton();if(0!==o){(r.getSelectionRange().isEmpty()||1==o)&&r.selection.moveToPosition(n),2==o&&(r.textInput.onContextMenu(e.domEvent),i.isMozilla||e.preventDefault());return}if(this.mousedownEvent.time=Date.now(),t&&!r.isFocused()&&(r.focus(),this.$focusTimeout&&!this.$clickSelection&&!r.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(e);return}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var i=this.$clickSelection.comparePoint(n);if(-1==i)e=this.$clickSelection.end;else if(1==i)e=this.$clickSelection.start;else{var r=l(this.$clickSelection,n);n=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var t,n=this.editor,i=n.renderer.screenToTextCoordinates(this.x,this.y),r=n.selection[e](i.row,i.column);if(this.$clickSelection){var o=this.$clickSelection.comparePoint(r.start),s=this.$clickSelection.comparePoint(r.end);if(-1==o&&s<=0)t=this.$clickSelection.end,(r.end.row!=i.row||r.end.column!=i.column)&&(i=r.start);else if(1==s&&o>=0)t=this.$clickSelection.start,(r.start.row!=i.row||r.start.column!=i.column)&&(i=r.end);else if(-1==o&&1==s)i=r.end,t=r.start;else{var a=l(this.$clickSelection,i);i=a.cursor,t=a.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(i),n.renderer.scrollCursorIntoView()},e.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},e.prototype.focusWait=function(){var e=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>r||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},e.prototype.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,i=n.session.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},e.prototype.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var i=n.getSelectionRange();i.isMultiLine()&&i.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(i.start.row),this.$clickSelection.end=n.selection.getLineRange(i.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},e.prototype.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},e.prototype.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,i=e.domEvent.timeStamp,r=i-n.t,s=r?e.wheelX/r:n.vx,a=r?e.wheelY/r:n.vy;r<o&&(s=(s+n.vx)/2,a=(a+n.vy)/2);var l=Math.abs(s/a),c=!1;if(l>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(c=!0),l<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(c=!0),c?n.allowed=i:i-n.allowed<o&&(Math.abs(s)<=1.5*Math.abs(n.vx)&&Math.abs(a)<=1.5*Math.abs(n.vy)?(c=!0,n.allowed=i):n.allowed=0),n.t=i,n.vx=s,n.vy=a,c)return t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function a(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}function l(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var n=2*t.row-e.start.row-e.end.row;else var n=t.column-4;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}s.prototype.selectEnd=s.prototype.selectByLinesEnd,s.prototype.selectAllEnd=s.prototype.selectByLinesEnd,s.prototype.selectByWordsEnd=s.prototype.selectByLinesEnd,t.DefaultHandlers=s}),ace.define("ace/lib/scroll",["require","exports","module"],function(e,t,n){t.preventParentScroll=function(e){e.stopPropagation();var t=e.currentTarget;t.scrollHeight>t.clientHeight||e.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=e("./lib/dom");e("./lib/event");var s=e("./range").Range,a=e("./lib/scroll").preventParentScroll,l="ace_tooltip",c=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=o.createElement("div"),this.$element.className=l,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},e.prototype.getElement=function(){return this.$element||this.$init()},e.prototype.setText=function(e){this.getElement().textContent=e},e.prototype.setHtml=function(e){this.getElement().innerHTML=e},e.prototype.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},e.prototype.setClassName=function(e){o.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=l+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,t,n){null!=e&&this.setText(e),null!=t&&null!=n&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},e.prototype.hide=function(e){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=l,this.isOpen=!1)},e.prototype.getHeight=function(){return this.getElement().offsetHeight},e.prototype.getWidth=function(){return this.getElement().offsetWidth},e.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},e}(),u=new(function(){function e(){this.popups=[]}return e.prototype.addPopup=function(e){this.popups.push(e),this.updatePopups()},e.prototype.removePopup=function(e){var t=this.popups.indexOf(e);-1!==t&&(this.popups.splice(t,1),this.updatePopups())},e.prototype.updatePopups=function(){this.popups.sort(function(e,t){return t.priority-e.priority});var e,t,n,i,o=[];try{for(var s=r(this.popups),a=s.next();!a.done;a=s.next()){var l=a.value,c=!0;try{for(var u=(n=void 0,r(o)),d=u.next();!d.done;d=u.next()){var h=d.value;if(this.doPopupsOverlap(h,l)){c=!1;break}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}c?o.push(l):l.hide()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}},e.prototype.doPopupsOverlap=function(e,t){var n=e.getElement().getBoundingClientRect(),i=t.getElement().getBoundingClientRect();return n.left<i.right&&n.right>i.left&&n.top<i.bottom&&n.bottom>i.top},e}());t.popupManager=u,t.Tooltip=c,t.HoverTooltip=function(e){function t(t){void 0===t&&(t=document.body);var n=e.call(this,t)||this;n.timeout=void 0,n.lastT=0,n.idleTime=350,n.lastEvent=void 0,n.onMouseOut=n.onMouseOut.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.waitForHover=n.waitForHover.bind(n),n.hide=n.hide.bind(n);var i=n.getElement();return i.style.whiteSpace="pre-wrap",i.style.pointerEvents="auto",i.addEventListener("mouseout",n.onMouseOut),i.tabIndex=-1,i.addEventListener("blur",(function(){i.contains(document.activeElement)||this.hide()}).bind(n)),i.addEventListener("wheel",a),n}return i(t,e),t.prototype.addToEditor=function(e){e.on("mousemove",this.onMouseMove),e.on("mousedown",this.hide),e.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},t.prototype.removeFromEditor=function(e){e.off("mousemove",this.onMouseMove),e.off("mousedown",this.hide),e.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},t.prototype.onMouseMove=function(e,t){this.lastEvent=e,this.lastT=Date.now();var n=t.$mouseHandler.isMousePressed;if(this.isOpen){var i=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(i.row,i.column)||n||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||n||(this.lastEvent=e,this.timeout=setTimeout(this.waitForHover,this.idleTime))},t.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var e=Date.now()-this.lastT;if(this.idleTime-e>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-e);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},t.prototype.isOutsideOfText=function(e){var t=e.editor,n=e.getDocumentPosition(),i=t.session.getLine(n.row);if(n.column==i.length){var r=t.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),o=t.session.documentToScreenPosition(n.row,n.column);if(o.column!=r.column||o.row!=r.row)return!0}return!1},t.prototype.setDataProvider=function(e){this.$gatherData=e},t.prototype.showForRange=function(e,t,n,i){var r=10;if((!i||i==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var o=e.renderer;this.isOpen||(u.addPopup(this),this.$registerCloseEvents(),this.setTheme(o.theme)),this.isOpen=!0,this.addMarker(t,e.session),this.range=s.fromPoints(t.start,t.end);var a=o.textToScreenCoordinates(t.start.row,t.start.column),l=o.scroller.getBoundingClientRect();a.pageX<l.left&&(a.pageX=l.left);var c=this.getElement();c.innerHTML="",c.appendChild(n),c.style.maxHeight="",c.style.display="block";var d=c.clientHeight,h=c.clientWidth,p=window.innerHeight-a.pageY-o.lineHeight,f=!0;a.pageY-d<0&&a.pageY<p&&(f=!1),c.style.maxHeight=(f?a.pageY:p)-r+"px",c.style.top=f?"":a.pageY+o.lineHeight+"px",c.style.bottom=f?window.innerHeight-a.pageY+"px":"",c.style.left=Math.min(a.pageX,window.innerWidth-h-r)+"px"}},t.prototype.addMarker=function(e,t){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=t,this.marker=t&&t.addMarker(e,"ace_highlight-marker","text")},t.prototype.hide=function(e){(e||document.activeElement!=this.getElement())&&!(e&&e.target&&("keydown"!=e.type||e.ctrlKey||e.metaKey)&&this.$element.contains(e.target))&&(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,u.removePopup(this)))},t.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},t.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},t.prototype.onMouseOut=function(e){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,!this.isOpen||!e.relatedTarget||this.getElement().contains(e.relatedTarget)||!(e&&e.currentTarget.contains(e.relatedTarget))&&(e.relatedTarget.classList.contains("ace_content")||this.hide())},t}(c)}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config","ace/lib/lang"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=e("../lib/dom"),s=e("../lib/event"),a=e("../tooltip").Tooltip,l=e("../config").nls;e("../lib/lang"),t.GutterHandler=function(e){var t,n,i=e.editor,r=i.renderer.$gutterLayer,a=new c(i);function l(){var t=n.getDocumentPosition().row;if(t==i.session.getLength()){var o=i.renderer.pixelToScreenCoordinates(0,n.y).row,s=n.$pos;if(o>i.session.documentToScreenRow(s.row,s.column))return u()}if(a.showTooltip(t),a.isOpen)if(i.on("mousewheel",u),e.$tooltipFollowsMouse)d(n);else{var l=n.getGutterRow(),c=r.$lines.get(l);if(c){var h=c.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),p=a.getElement().style;p.left=h.right+"px",p.top=h.bottom+"px"}else d(n)}}function u(){t&&(t=clearTimeout(t)),a.isOpen&&(a.hideTooltip(),i.off("mousewheel",u))}function d(e){a.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(t){if(i.isFocused()&&0==t.getButton()&&"foldWidgets"!=r.getRegion(t)){var n=t.getDocumentPosition().row,o=i.session.selection;if(t.getShiftKey())o.selectTo(n,0);else{if(2==t.domEvent.detail)return i.selectAll(),t.preventDefault();e.$clickSelection=i.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(i){var r=i.domEvent.target||i.domEvent.srcElement;if(o.hasCssClass(r,"ace_fold-widget"))return u();a.isOpen&&e.$tooltipFollowsMouse&&d(i),n=i,t||(t=setTimeout(function(){t=null,n&&!e.isMousePressed?l():u()},50))}),s.addListener(i.renderer.$gutter,"mouseout",function(e){n=null,a.isOpen&&!t&&(t=setTimeout(function(){t=null,u()},50))},i),i.on("changeSession",u),i.on("input",u)};var c=function(e){function t(t){var n=e.call(this,t.container)||this;return n.editor=t,n}return i(t,e),t.prototype.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight,r=this.getWidth(),o=this.getHeight();t+=15,(e+=15)+r>n&&(e-=e+r-n),t+o>i&&(t-=20+o),a.prototype.setPosition.call(this,e,t)},Object.defineProperty(t,"annotationLabels",{get:function(){return{error:{singular:l("gutter-tooltip.aria-label.error.singular","error"),plural:l("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:l("gutter-tooltip.aria-label.security.singular","security finding"),plural:l("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:l("gutter-tooltip.aria-label.warning.singular","warning"),plural:l("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:l("gutter-tooltip.aria-label.info.singular","information message"),plural:l("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:l("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:l("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),t.prototype.showTooltip=function(e){var n=this.editor.renderer.$gutterLayer,i=n.$annotations[e];a=i?{displayText:Array.from(i.displayText),type:Array.from(i.type)}:{displayText:[],type:[]};var r=n.session.getFoldLine(e);if(r&&n.$showFoldedAnnotations){for(var s,a,l,c={error:[],security:[],warning:[],info:[],hint:[]},u={error:1,security:2,warning:3,info:4,hint:5},d=e+1;d<=r.end.row;d++)if(n.$annotations[d])for(var h=0;h<n.$annotations[d].text.length;h++){var p=n.$annotations[d].type[h];c[p].push(n.$annotations[d].text[h]),(!l||u[p]<u[l])&&(l=p)}if(["error","security","warning"].includes(l)){var f="".concat(t.annotationsToSummaryString(c)," in folded code.");a.displayText.push(f),a.type.push(l+"_fold")}}if(0===a.displayText.length)return this.hide();for(var g={error:[],security:[],warning:[],info:[],hint:[]},m=n.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",d=0;d<a.displayText.length;d++){var v=o.createElement("span"),b=o.createElement("span");(s=b.classList).add.apply(s,["ace_".concat(a.type[d]),m]),b.setAttribute("aria-label","".concat(t.annotationLabels[a.type[d].replace("_fold","")].singular)),b.setAttribute("role","img"),b.appendChild(o.createTextNode(" ")),v.appendChild(b),v.appendChild(o.createTextNode(a.displayText[d])),v.appendChild(o.createElement("br")),g[a.type[d].replace("_fold","")].push(v)}var y=this.getElement();o.removeChildren(y),g.error.forEach(function(e){return y.appendChild(e)}),g.security.forEach(function(e){return y.appendChild(e)}),g.warning.forEach(function(e){return y.appendChild(e)}),g.info.forEach(function(e){return y.appendChild(e)}),g.hint.forEach(function(e){return y.appendChild(e)}),y.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.editor._signal("showGutterTooltip",this)},t.prototype.hideTooltip=function(){this.$element.removeAttribute("aria-live"),this.hide(),this.editor._signal("hideGutterTooltip",this)},t.annotationsToSummaryString=function(e){var n,i,o=[],s=["error","security","warning","info","hint"];try{for(var a=r(s),l=a.next();!l.done;l=a.next()){var c=l.value;if(e[c].length){var u=1===e[c].length?t.annotationLabels[c].singular:t.annotationLabels[c].plural;o.push("".concat(e[c].length," ").concat(u))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o.join(", ")},t}(a);t.GutterTooltip=c}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../lib/useragent");t.MouseEvent=function(){function e(e,t){this.speed,this.wheelX,this.wheelY,this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return e.prototype.stopPropagation=function(){i.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){i.preventDefault(this.domEvent),this.defaultPrevented=!0},e.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},e.prototype.getDocumentPosition=function(){return this.$pos||(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY)),this.$pos},e.prototype.getGutterRow=function(){var e=this.getDocumentPosition().row;return this.editor.session.documentToScreenRow(e,0)-this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0)},e.prototype.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var t=this.getDocumentPosition();this.$inSelection=e.contains(t.row,t.column)}return this.$inSelection},e.prototype.getButton=function(){return i.getButton(this.domEvent)},e.prototype.getShiftKey=function(){return this.domEvent.shiftKey},e.prototype.getAccelKey=function(){return r.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},e}()}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/event"),o=e("../lib/useragent"),s=200,a=200,l=5;function c(e){var t,n,c,d,h,p=e.editor,f=i.createElement("div");f.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",f.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(t){e[t]=this[t]},this),p.on("mousedown",this.onMouseDown.bind(e));var g,m,v,b,y,w,x=p.container,$=0;function _(e,t){var n=Date.now(),i=!t||e.row!=t.row,r=!t||e.column!=t.column;!d||i||r?(p.moveCursorToPosition(e),d=n,h={x:m,y:v}):u(h.x,h.y,m,v)>l?d=null:n-d>=a&&(p.renderer.scrollCursorIntoView(),d=null)}function S(e,t){var n=Date.now(),i=p.renderer.layerConfig.lineHeight,r=p.renderer.layerConfig.characterWidth,o=p.renderer.scroller.getBoundingClientRect(),a={x:{left:m-o.left,right:o.right-m},y:{top:v-o.top,bottom:o.bottom-v}},l=Math.min(a.x.left,a.x.right),u=Math.min(a.y.top,a.y.bottom),d={row:e.row,column:e.column};l/r<=2&&(d.column+=a.x.left<a.x.right?-3:2),u/i<=1&&(d.row+=a.y.top<a.y.bottom?-1:1);var h=e.row!=d.row,f=e.column!=d.column,g=!t||e.row!=t.row;h||f&&!g?c?n-c>=s&&p.renderer.scrollCursorIntoView(d):c=n:c=null}function M(){var e=w;_(w=p.renderer.screenToTextCoordinates(m,v),e),S(w,e)}function C(){y=p.selection.toOrientedRange(),g=p.session.addMarker(y,"ace_selection",p.getSelectionStyle()),p.clearSelection(),p.isFocused()&&p.renderer.$cursorLayer.setBlinking(!1),clearInterval(b),M(),b=setInterval(M,20),$=0,r.addListener(document,"mousemove",A)}function E(){clearInterval(b),p.session.removeMarker(g),g=null,p.selection.fromOrientedRange(y),p.isFocused()&&!n&&p.$resetCursorStyle(),y=null,w=null,$=0,c=null,d=null,r.removeListener(document,"mousemove",A)}this.onDragStart=function(e){if(this.cancelDrag||!x.draggable){var t=this;return setTimeout(function(){t.startSelect(),t.captureMouse(e)},0),e.preventDefault()}y=p.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=p.getReadOnly()?"copy":"copyMove",p.container.appendChild(f),i.setDragImage&&i.setDragImage(f,0,0),setTimeout(function(){p.container.removeChild(f)}),i.clearData(),i.setData("Text",p.session.getTextRange()),n=!0,this.setState("drag")},this.onDragEnd=function(e){if(x.draggable=!1,n=!1,this.setState(null),!p.getReadOnly()){var i=e.dataTransfer.dropEffect;t||"move"!=i||p.session.remove(p.getSelectionRange()),p.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!p.getReadOnly()&&T(e.dataTransfer))return m=e.clientX,v=e.clientY,g||C(),$++,e.dataTransfer.dropEffect=t=L(e),r.preventDefault(e)},this.onDragOver=function(e){if(!p.getReadOnly()&&T(e.dataTransfer))return m=e.clientX,v=e.clientY,!g&&(C(),$++),null!==k&&(k=null),e.dataTransfer.dropEffect=t=L(e),r.preventDefault(e)},this.onDragLeave=function(e){if(--$<=0&&g)return E(),t=null,r.preventDefault(e)},this.onDrop=function(e){if(w){var i=e.dataTransfer;if(n)switch(t){case"move":y=y.contains(w.row,w.column)?{start:w,end:w}:p.moveText(y,w);break;case"copy":y=p.moveText(y,w,!0)}else{var o=i.getData("Text");y={start:w,end:p.session.insert(w,o)},p.focus(),t=null}return E(),r.preventDefault(e)}},r.addListener(x,"dragstart",this.onDragStart.bind(e),p),r.addListener(x,"dragend",this.onDragEnd.bind(e),p),r.addListener(x,"dragenter",this.onDragEnter.bind(e),p),r.addListener(x,"dragover",this.onDragOver.bind(e),p),r.addListener(x,"dragleave",this.onDragLeave.bind(e),p),r.addListener(x,"drop",this.onDrop.bind(e),p);var k=null;function A(){null==k&&(k=setTimeout(function(){null!=k&&g&&E()},20))}function T(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return"text/plain"==e||"Text"==e})}function L(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],i=o.isMac?e.altKey:e.ctrlKey,r="uninitialized";try{r=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var s="none";return i&&t.indexOf(r)>=0?s="copy":n.indexOf(r)>=0?s="move":t.indexOf(r)>=0&&(s="copy"),s}}function u(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}(function(){this.dragWait=function(){Date.now()-this.mousedownEvent.time>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){this.editor.container.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor;e.container.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var t=o.isWin?"default":"move";e.renderer.setCursorStyle(t),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(o.isIE&&"dragReady"==this.state){var n=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if("dragWait"===this.state){var n=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),i=e.getButton(),r=e.domEvent.detail||1;if(1===r&&0===i&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var s=e.domEvent.target||e.domEvent.srcElement;"unselectable"in s&&(s.unselectable="on"),t.getDragDelay()?(o.isWebKit&&(this.cancelDrag=!0,t.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(c.prototype),t.DragdropHandler=c}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./mouse_event").MouseEvent,r=e("../lib/event"),o=e("../lib/dom");t.addTouchListeners=function(e,t){var n,s,a,l,c,u,d,h,p,f="scroll",g=0,m=0,v=0,b=0;function y(){var e=window.navigator&&window.navigator.clipboard,n=!1,i=function(){var i=t.getCopyText(),s=t.session.getUndoManager().hasUndo();p.replaceChild(o.buildDom(n?["span",!i&&r("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],i&&r("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],i&&r("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],e&&r("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],s&&r("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],r("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],r("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),p.firstChild)},r=function(e){return t.commands.canExecute(e,t)},s=function(r){var o=r.target.getAttribute("action");if("more"==o||!n)return n=!n,i();"paste"==o?e.readText().then(function(e){t.execCommand(o,e)}):o&&(("cut"==o||"copy"==o)&&(e?e.writeText(t.getCopyText()):document.execCommand("copy")),t.execCommand(o)),p.firstChild.style.display="none",n=!1,"openCommandPalette"!=o&&t.focus()};p=o.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){f="menu",e.stopPropagation(),e.preventDefault(),t.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),s(e)},onclick:s},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],t.container)}function w(){if(!t.getOption("enableMobileMenu")){p&&x();return}p||y();var e=t.selection.cursor,n=t.renderer.textToScreenCoordinates(e.row,e.column),i=t.renderer.textToScreenCoordinates(0,0).pageX,r=t.renderer.scrollLeft,o=t.container.getBoundingClientRect();p.style.top=n.pageY-o.top-3+"px",n.pageX-o.left<o.width-70?(p.style.left="",p.style.right="10px"):(p.style.right="",p.style.left=i+r-o.left+"px"),p.style.display="",p.firstChild.style.display="none",t.on("input",x)}function x(e){p&&(p.style.display="none"),t.off("input",x)}function $(){clearTimeout(c=null);var e=t.selection.getRange(),n=e.contains(d.row,d.column);(e.isEmpty()||!n)&&(t.selection.moveToPosition(d),t.selection.selectWord()),f="wait",w()}function _(){clearTimeout(c=null),t.selection.moveToPosition(d);var e=m>=2?t.selection.getLineRange(d.row):t.session.getBracketRange(d);e&&!e.isEmpty()?t.selection.setRange(e):t.selection.selectWord(),f="wait"}function S(){g+=60,u=setInterval(function(){g--<=0&&(clearInterval(u),u=null),.01>Math.abs(v)&&(v=0),.01>Math.abs(b)&&(b=0),g<20&&(v*=.9),g<20&&(b*=.9);var e=t.session.getScrollTop();t.renderer.scrollBy(10*v,10*b),e==t.session.getScrollTop()&&(g=0)},10)}r.addListener(e,"contextmenu",function(e){if(h){var n=t.textInput.getElement();n.focus()}},t),r.addListener(e,"touchstart",function(e){var r=e.touches;if(c||r.length>1){clearTimeout(c),c=null,a=-1,f="zoom";return}h=t.$mouseHandler.isMousePressed=!0;var o=t.renderer.layerConfig.lineHeight,u=t.renderer.layerConfig.lineHeight,p=e.timeStamp;l=p;var y=r[0],w=y.clientX,x=y.clientY;if(Math.abs(n-w)+Math.abs(s-x)>o&&(a=-1),n=e.clientX=w,s=e.clientY=x,v=b=0,d=new i(e,t).getDocumentPosition(),p-a<500&&1==r.length&&!g)m++,e.preventDefault(),e.button=0,_();else{m=0;var S=t.selection.cursor,M=t.selection.isEmpty()?S:t.selection.anchor,C=t.renderer.$cursorLayer.getPixelPosition(S,!0),E=t.renderer.$cursorLayer.getPixelPosition(M,!0),k=t.renderer.scroller.getBoundingClientRect(),A=t.renderer.layerConfig.offset,T=t.renderer.scrollLeft,L=function(e,t){return(e/=u)*e+(t=t/o-.75)*t};if(e.clientX<k.left){f="zoom";return}var O=L(e.clientX-k.left-C.left+T,e.clientY-k.top-C.top+A),R=L(e.clientX-k.left-E.left+T,e.clientY-k.top-E.top+A);O<3.5&&R<3.5&&(f=O>R?"cursor":"anchor"),f=R<3.5?"anchor":O<3.5?"cursor":"scroll",c=setTimeout($,450)}a=p},t),r.addListener(e,"touchend",function(e){h=t.$mouseHandler.isMousePressed=!1,u&&clearInterval(u),"zoom"==f?(f="",g=0):c?(t.selection.moveToPosition(d),g=0,w()):"scroll"==f?(S(),x()):w(),clearTimeout(c),c=null},t),r.addListener(e,"touchmove",function(e){c&&(clearTimeout(c),c=null);var r=e.touches;if(!(r.length>1)&&"zoom"!=f){var o=r[0],a=n-o.clientX,u=s-o.clientY;if("wait"==f)if(!(a*a+u*u>4))return e.preventDefault();else f="cursor";n=o.clientX,s=o.clientY,e.clientX=o.clientX,e.clientY=o.clientY;var d=e.timeStamp,h=d-l;if(l=d,"scroll"==f){var p=new i(e,t);p.speed=1,p.wheelX=a,p.wheelY=u,10*Math.abs(a)<Math.abs(u)&&(a=0),10*Math.abs(u)<Math.abs(a)&&(u=0),0!=h&&(v=a/h,b=u/h),t._emit("mousewheel",p),p.propagationStopped||(v=b=0)}else{var g=new i(e,t).getDocumentPosition();"cursor"==f?t.selection.moveCursorToPosition(g):"anchor"==f&&t.selection.setSelectionAnchor(g.row,g.column),t.renderer.scrollCursorIntoView(g),e.preventDefault()}}},t)}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../lib/useragent"),o=e("./default_handlers").DefaultHandlers,s=e("./default_gutter_handler").GutterHandler,a=e("./mouse_event").MouseEvent,l=e("./dragdrop_handler").DragdropHandler,c=e("./touch_handler").addTouchListeners,u=e("../config"),d=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var t=this;this.editor=e,new o(this),new s(this),new l(this);var n=function(t){document.hasFocus&&document.hasFocus()&&(e.isFocused()||document.activeElement!=(e.textInput&&e.textInput.getElement()))||window.focus(),e.focus(),setTimeout(function(){e.isFocused()||e.focus()})},a=e.renderer.getMouseEventTarget();i.addListener(a,"click",this.onMouseEvent.bind(this,"click"),e),i.addListener(a,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),i.addMultiMouseDownListener([a,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),i.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),c(e.container,e);var u=e.renderer.$gutter;i.addListener(u,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),i.addListener(u,"click",this.onMouseEvent.bind(this,"gutterclick"),e),i.addListener(u,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),i.addListener(u,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),i.addListener(a,"mousedown",n,e),i.addListener(u,"mousedown",n,e),r.isIE&&e.renderer.scrollBarV&&(i.addListener(e.renderer.scrollBarV.element,"mousedown",n,e),i.addListener(e.renderer.scrollBarH.element,"mousedown",n,e)),e.on("mousemove",function(n){if(!t.state&&!t.$dragDelay&&t.$dragEnabled){var i=e.renderer.screenToTextCoordinates(n.x,n.y),r=e.session.selection.getRange(),o=e.renderer;!r.isEmpty()&&r.insideStart(i.row,i.column)?o.setCursorStyle("default"):o.setCursorStyle("")}},e)}return e.prototype.onMouseEvent=function(e,t){this.editor.session&&this.editor._emit(e,new a(t,this.editor))},e.prototype.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;n&&n.length&&this.editor._emit(e,new a(t,this.editor))},e.prototype.onMouseWheel=function(e,t){var n=new a(t,this.editor);n.speed=2*this.$scrollSpeed,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},e.prototype.setState=function(e){this.state=e},e.prototype.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,o=this.editor.renderer;o.$isMousePressed=!0;var s=this,l=function(e){if(e){if(r.isWebKit&&!e.which&&s.releaseMouse)return s.releaseMouse();s.x=e.clientX,s.y=e.clientY,t&&t(e),s.mouseEvent=new a(e,s.editor),s.$mouseMoved=!0}},c=function(e){n.off("beforeEndOperation",d),clearInterval(h),n.session&&u(),s[s.state+"End"]&&s[s.state+"End"](e),s.state="",s.isMousePressed=o.$isMousePressed=!1,o.$keepTextAreaAtCursor&&o.$moveTextAreaToCursor(),s.$onCaptureMouseMove=s.releaseMouse=null,e&&s.onMouseEvent("mouseup",e),n.endOperation()},u=function(){s[s.state]&&s[s.state](),s.$mouseMoved=!1};if(r.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){c(e)});var d=function(e){s.releaseMouse&&n.curOp.command.name&&n.curOp.selectionChanged&&(s[s.state+"End"]&&s[s.state+"End"](),s.state="",s.releaseMouse())};n.on("beforeEndOperation",d),n.startOperation({command:{name:"mouse"}}),s.$onCaptureMouseMove=l,s.releaseMouse=i.capture(this.editor.container,l,c);var h=setInterval(u,20)},e.prototype.cancelContextMenu=function(){var e=(function(t){(!t||!t.domEvent||"contextmenu"==t.domEvent.type)&&(this.editor.off("nativecontextmenu",e),t&&t.domEvent&&i.stopEvent(t.domEvent))}).bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)},e.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},e}();d.prototype.releaseMouse=null,u.defineOptions(d.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150*!!r.isMac},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=d}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom");t.FoldHandler=function(){return function(e){e.on("click",function(t){var n=t.getDocumentPosition(),r=e.session,o=r.getFoldAt(n.row,n.column,1);o&&(t.getAccelKey()?r.removeFold(o):r.expandFold(o),t.stop());var s=t.domEvent&&t.domEvent.target;s&&i.hasCssClass(s,"ace_inline_button")&&i.hasCssClass(s,"ace_toggle_wrap")&&(r.setOption("wrap",!r.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(t)){var n=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(t)){var n=t.getDocumentPosition().row,i=e.session,r=i.getParentFoldRangeData(n,!0),o=r.range||r.firstRange;if(o){n=o.start.row;var s=i.getFoldAt(n,i.getLine(n).length,1);s?i.removeFold(s):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var i=e("../lib/keys"),r=e("../lib/event");t.KeyBinding=function(){function e(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)}return e.prototype.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},e.prototype.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){for(;t[t.length-1]&&t[t.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},e.prototype.addKeyboardHandler=function(e,t){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);-1!=n&&this.$handlers.splice(n,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==n&&e.attach&&e.attach(this.$editor)}},e.prototype.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return -1!=t&&(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},e.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},e.prototype.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,t,n,i){for(var o,s=!1,a=this.$editor.commands,l=this.$handlers.length;l--&&(!(o=this.$handlers[l].handleKeyboard(this.$data,e,t,n,i))||!o.command||((s="null"==o.command||a.exec(o.command,this.$editor,o.args,i))&&i&&-1!=e&&!0!=o.passEvent&&!0!=o.command.passEvent&&r.stopEvent(i),!s)););return s||-1!=e||(o={command:"insertstring"},s=a.exec("insertstring",this.$editor,t)),s&&this.$editor._signal&&this.$editor._signal("keyboardActivity",o),s},e.prototype.onCommandKey=function(e,t,n){var r=i.keyCodeToString(n);return this.$callKeyboardHandlers(t,r,n,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";var i=0,r=0,o=!1,s=!1,a=!1,l=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],c=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],u=0,d=1,h=0,p=1,f=2,g=3,m=4,v=5,b=6,y=7,w=8,x=9,$=10,_=11,S=12,M=13,C=14,E=15,k=16,A=17,T=18,L=[18,18,18,18,18,18,18,18,18,6,5,6,8,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,5,5,5,6,8,4,4,11,11,11,4,4,4,4,4,10,9,10,9,9,2,2,2,2,2,2,2,2,2,2,9,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,18,18,18,18,18,18,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,9,4,11,11,11,11,4,4,4,4,0,4,4,18,4,4,11,11,2,2,4,0,4,4,4,2,0,4,4,4,4,4],O=[8,8,8,8,8,8,8,8,8,8,8,18,18,18,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,5,13,14,15,16,17,9,11,11,11,11,11,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,9,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8];function R(e,t,n,u){var d=i?c:l,h=null,p=null,f=null,g=0,m=null,y=null,x=-1,$=null,_=null,S=[];if(!u)for($=0,u=[];$<n;$++)u[$]=j(e[$]);for(_=0,r=i,o=!1,s=!1,a=!1;_<n;_++){if(h=g,S[_]=p=I(e,u,S,_),m=240&(g=d[h][p]),g&=15,t[_]=f=d[g][5],m>0)if(16==m){for($=x;$<_;$++)t[$]=1;x=-1}else x=-1;if(y=d[g][6])-1==x&&(x=_);else if(x>-1){for($=x;$<_;$++)t[$]=f;x=-1}u[_]==v&&(t[_]=0),r|=f}if(a){for($=0;$<n;$++)if(u[$]==b){t[$]=i;for(var M=$-1;M>=0;M--)if(u[M]==w)t[M]=i;else break}}}function D(e,t,n){if(!(r<e)){if(1==e&&i==d&&!s)return void n.reverse();for(var o,a,l,c,u=n.length,h=0;h<u;){if(t[h]>=e){for(o=h+1;o<u&&t[o]>=e;)o++;for(a=h,l=o-1;a<l;a++,l--)c=n[a],n[a]=n[l],n[l]=c;h=o}h++}}}function I(e,t,n,r){var l,c,u,d,L=t[r];switch(L){case h:case p:o=!1;case m:case g:return L;case f:return o?g:f;case y:return o=!0,p;case w:return m;case x:if(r<1||r+1>=t.length||(l=n[r-1])!=f&&l!=g||(c=t[r+1])!=f&&c!=g)return m;return o&&(c=g),c==l?c:m;case $:if((l=r>0?n[r-1]:v)==f&&r+1<t.length&&t[r+1]==f)return f;return m;case _:if(r>0&&n[r-1]==f)return f;if(o)return m;for(d=r+1,u=t.length;d<u&&t[d]==_;)d++;if(d<u&&t[d]==f)return f;return m;case S:for(u=t.length,d=r+1;d<u&&t[d]==S;)d++;if(d<u){var O=e[r],R=O>=1425&&O<=2303||64286==O;if(l=t[d],R&&(l==p||l==y))return p}if(r<1||(l=t[r-1])==v)return m;return n[r-1];case v:return o=!1,s=!0,i;case b:return a=!0,m;case M:case C:case k:case A:case E:o=!1;case T:return m}}function j(e){var t=e.charCodeAt(0),n=t>>8;if(0==n)return t>191?h:L[t];if(5==n)return/[\u0591-\u05f4]/.test(e)?p:h;if(6==n)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return S;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return g;else if(1642==t)return _;else if(/[\u06f0-\u06f9]/.test(e))return f;else return y;if(32==n&&t<=8287)return O[255&t];if(254==n)return t>=65136?y:m;return m}t.L=0,t.R=p,t.EN=f,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\xb7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var o=e.split(""),s=Array(o.length),a=Array(o.length),l=[];i=r?d:u,R(o,l,o.length,n);for(var c=0;c<s.length;s[c]=c,c++);D(2,l,s),D(1,l,s);for(var c=0;c<s.length-1;c++)n[c]===g?l[c]=t.AN:l[c]===p&&(n[c]>y&&n[c]<M||n[c]===m||n[c]===T)?l[c]=t.ON_R:c>0&&"ل"===o[c-1]&&/\u0622|\u0623|\u0625|\u0627/.test(o[c])&&(l[c-1]=l[c]=t.R_H,c++);o[o.length-1]===t.DOT&&(l[o.length-1]=t.B),"‫"===o[0]&&(l[0]=t.RLE);for(var c=0;c<s.length;c++)a[c]=l[s[c]];return{logicalFromVisual:s,bidiLevels:a}},t.hasBidiCharacters=function(e,t){for(var n=!1,i=0;i<e.length;i++)t[i]=j(e.charAt(i)),n||t[i]!=p&&t[i]!=y&&t[i]!=g||(n=!0);return n},t.getVisualFromLogicalIdx=function(e,t){for(var n=0;n<t.logicalFromVisual.length;n++)if(t.logicalFromVisual[n]==e)return n;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,t,n){"use strict";var i=e("./lib/bidiutil"),r=e("./lib/lang"),o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;t.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=i,this.charWidths=[],this.EOL="\xac",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="\xb6",this.RLE="‫",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=o.test(e.getValue())}return e.prototype.isBidiRow=function(e,t,n){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,n),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&o.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},e.prototype.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n=this.session.$getRowCacheIndex(t,this.currentRow);n>=0&&(e=this.session.$docRowCache[n])}return e},e.prototype.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length)for(var n,i=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(n=this.session.$getRowCacheIndex(t,this.currentRow-e-1))===i;)i=n,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,t){void 0===e&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(void 0===t&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[i.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t]),t==o.length&&(this.line+=this.showInvisibles?n:i.DOT))}else this.line+=this.showInvisibles?n:i.DOT;var s,a=this.session,l=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,t){return" "===e||a.isFullWidth(e.charCodeAt(0))?(s=" "===e?a.getScreenTabSize(t+l):2,l+=s-1,r.stringRepeat(i.DOT,s)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==i.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},e.prototype.updateBidiMap=function(){var e=[];i.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=i.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},e.prototype.markAsDirty=function(){this.currentRow=null},e.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,n=e.$measureCharWidth("ה");this.charWidths[i.L]=this.charWidths[i.EN]=this.charWidths[i.ON_R]=t,this.charWidths[i.R]=this.charWidths[i.AN]=n,this.charWidths[i.R_H]=.45*n,this.charWidths[i.B]=this.charWidths[i.RLE]=0,this.currentRow=null}},e.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},e.prototype.setEolChar=function(e){this.EOL=e},e.prototype.setContentWidth=function(e){this.contentWidth=e},e.prototype.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},e.prototype.setRtlDirection=function(e,t){for(var n=e.getCursorPosition(),i=e.selection.getSelectionAnchor().row;i<=n.row;i++)t||e.session.getLine(i).charAt(0)!==e.session.$bidiHandler.RLE?t&&e.session.getLine(i).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:i},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(i,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var t=+(this.line.charAt(0)===this.RLE),n=e>t?this.session.getOverwrite()?e:e-1:t,r=i.getVisualFromLogicalIdx(n,this.bidiMap),o=this.bidiMap.bidiLevels,s=0;!this.session.getOverwrite()&&e<=t&&o[r]%2!=0&&r++;for(var a=0;a<r;a++)s+=this.charWidths[o[a]];return!this.session.getOverwrite()&&e>t&&o[r]%2==0&&(s+=this.charWidths[o[r]]),this.wrapIndent&&(s+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(s+=this.rtlLineOffset),s},e.prototype.getSelections=function(e,t){var n,i=this.bidiMap,r=i.bidiLevels,o=[],s=0,a=Math.min(e,t)-this.wrapIndent,l=Math.max(e,t)-this.wrapIndent,c=!1,u=!1,d=0;this.wrapIndent&&(s+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p<r.length;p++)h=i.logicalFromVisual[p],n=r[p],(c=h>=a&&h<l)&&!u?d=s:!c&&u&&o.push({left:d,width:s-d}),s+=this.charWidths[n],u=c;if(c&&p===r.length&&o.push({left:d,width:s-d}),this.isRtlDir)for(var f=0;f<o.length;f++)o[f].left+=this.rtlLineOffset;return o},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,e=Math.max(e,0),n=0,i=0,r=this.bidiMap.bidiLevels,o=this.charWidths[r[i]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>n+o/2;){if(n+=o,i===r.length-1){o=0;break}o=this.charWidths[r[++i]]}return i>0&&r[i-1]%2!=0&&r[i]%2==0?(e<n&&i--,t=this.bidiMap.logicalFromVisual[i]):i>0&&r[i-1]%2==0&&r[i]%2!=0?t=1+(e>n?this.bidiMap.logicalFromVisual[i]:this.bidiMap.logicalFromVisual[i-1]):this.isRtlDir&&i===r.length-1&&0===o&&r[i-1]%2==0||!this.isRtlDir&&0===i&&r[i]%2!=0?t=1+this.bidiMap.logicalFromVisual[i]:(i>0&&r[i-1]%2!=0&&0!==o&&i--,t=this.bidiMap.logicalFromVisual[i]),0===t&&this.isRtlDir&&t++,t+this.wrapIndent},e}()}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/lang"),o=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,a=function(){function e(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),t.$isEmpty||t.$silent||t._emit("changeSelection"),t.$keepDesiredColumnOnChange||e.old.column==e.value.column||(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,t.$isEmpty||t.$silent||t._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},e.prototype.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?s.fromPoints(t,t):this.isBackwards()?s.fromPoints(t,e):s.fromPoints(e,t)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(e,t){var n=t?e.end:e.start,i=t?e.start:e.end;this.$setSelection(n.row,n.column,i.row,i.column)},e.prototype.$setSelection=function(e,t,n,i){if(!this.$silent){var r=this.$isEmpty,o=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,i),this.$isEmpty=!s.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||r!=this.$isEmpty||o)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},e.prototype.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},e.prototype.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},e.prototype.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},e.prototype.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(e,t){if(void 0===t){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},e.prototype.getLineRange=function(e,t){var n,i="number"==typeof e?e:this.lead.row,r=this.session.getFoldLine(i);return(r?(i=r.start.row,n=r.end.row):n=i,!0===t)?new s(i,0,n,this.session.getLine(n).length):new s(i,0,n+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(e,t,n){var i=e.column,r=e.column+t;return n<0&&(i=e.column-t,r=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(i,r).split(" ").length-1==t},e.prototype.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var n=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,n,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,n):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,n=this.session.documentToScreenRow(e,t),i=this.session.screenToDocumentPosition(n,0),r=this.session.getDisplayLine(e,null,i.row,i.column).match(/^\s*/);r[0].length==t||this.session.$useEmacsStyleLineStart||(i.column+=r[0].length),this.moveCursorToPosition(i)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var n=this.session.getLine(t.row);if(t.column==n.length){var i=n.search(/\s+$/);i>0&&(t.column=i)}}this.moveCursorTo(t.row,t.column)},e.prototype.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),i=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(e,t,1);if(r)return void this.moveCursorTo(r.end.row,r.end.column);if(this.session.nonTokenRe.exec(i)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,i=n.substring(t)),t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(i)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},e.prototype.moveCursorLongWordLeft=function(){var e,t=this.lead.row,n=this.lead.column;if(e=this.session.getFoldAt(t,n,-1))return void this.moveCursorTo(e.start.row,e.start.column);var i=this.session.getFoldStringAt(t,n,-1);null==i&&(i=this.doc.getLine(t).substring(0,n));var o=r.stringReverse(i);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(o)&&(n-=this.session.nonTokenRe.lastIndex,o=o.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),n<=0){this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(o)&&(n-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,n)},e.prototype.$shortWordEndIndex=function(e){var t,n=0,i=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{for(;(t=e[n])&&i.test(t);)n++;if(n<1){for(r.lastIndex=0;(t=e[n])&&!r.test(t);)if(r.lastIndex=0,n++,i.test(t))if(n>2){n--;break}else{for(;(t=e[n])&&i.test(t);)n++;if(n>2)break}}}return r.lastIndex=0,n},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),i=n.substring(t),r=this.session.getFoldAt(e,t,1);if(r)return this.moveCursorTo(r.end.row,r.end.column);if(t==n.length){var o=this.doc.getLength();do e++,i=this.doc.getLine(e);while(e<o&&/^\s*$/.test(i));/^\s+/.test(i)||(i=""),t=0}var s=this.$shortWordEndIndex(i);this.moveCursorTo(e,t+s)},e.prototype.moveCursorShortWordLeft=function(){var e,t=this.lead.row,n=this.lead.column;if(e=this.session.getFoldAt(t,n,-1))return this.moveCursorTo(e.start.row,e.start.column);var i=this.session.getLine(t).substring(0,n);if(0===n){do t--,i=this.doc.getLine(t);while(t>0&&/^\s*$/.test(i));n=i.length,/\s+$/.test(i)||(i="")}var o=r.stringReverse(i),s=this.$shortWordEndIndex(o);return this.moveCursorTo(t,n-s)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(e,t){var n,i=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===t&&(0!==e&&(this.session.$bidiHandler.isBidiRow(i.row,this.lead.row)?(n=this.session.$bidiHandler.getPosLeft(i.column),i.column=Math.round(n/this.session.$bidiHandler.charWidths[0])):n=i.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?i.column=this.$desiredColumn:this.$desiredColumn=i.column),0!=e&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var r=this.session.lineWidgets[this.lead.row];e<0?e-=r.rowsAbove||0:e>0&&(e+=r.rowCount-(r.rowsAbove||0))}var o=this.session.screenToDocumentPosition(i.row+e,i.column,n);0!==e&&0===t&&o.row===this.lead.row&&(o.column,this.lead.column),this.moveCursorTo(o.row,o.column+t,0===t)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,t,n){var i=this.session.getFoldAt(e,t,1);i&&(e=i.start.row,t=i.start.column),this.$keepDesiredColumnOnChange=!0;var r=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(r.charAt(t))&&r.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,t,n){var i=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(i.row,i.column,n)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},e.prototype.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return s.fromPoints(t,n)}catch(e){return s.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},e.prototype.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},e.prototype.fromJSON=function(e){if(void 0==e.start)if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=s.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}else e=e[0];this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},e.prototype.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0},e}();a.prototype.setSelectionAnchor=a.prototype.setAnchor,a.prototype.getSelectionAnchor=a.prototype.getAnchor,a.prototype.setSelectionRange=a.prototype.setRange,i.implement(a.prototype,o),t.Selection=a}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,t,n){"use strict";var i=e("./lib/report_error").reportError,r=2e3,o=function(){function e(e){for(var t in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var n=this.states[t],i=[],r=0,o=this.matchMappings[t]={defaultToken:"text"},s="g",a=[],l=0;l<n.length;l++){var c=n[l];if(c.defaultToken&&(o.defaultToken=c.defaultToken),c.caseInsensitive&&-1===s.indexOf("i")&&(s+="i"),c.unicode&&-1===s.indexOf("u")&&(s+="u"),null!=c.regex){c.regex instanceof RegExp&&(c.regex=c.regex.toString().slice(1,-1));var u=c.regex,d=RegExp("(?:("+u+")|(.))").exec("a").length-2;Array.isArray(c.token)?1==c.token.length||1==d?c.token=c.token[0]:d-1!=c.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:c,groupCount:d-1}),c.token=c.token[0]):(c.tokenArray=c.token,c.token=null,c.onMatch=this.$arrayTokens):"function"!=typeof c.token||c.onMatch||(d>1?c.onMatch=this.$applyToken:c.onMatch=c.token),d>1&&(/\\\d/.test(c.regex)?u=c.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+r+1)}):(d=1,u=this.removeCapturingGroups(c.regex)),c.splitRegex||"string"==typeof c.token||a.push(c)),o[r]=l,r+=d,i.push(u),c.onMatch||(c.onMatch=null)}}i.length||(o[0]=0,i.push("$")),a.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,s)},this),this.regExps[t]=RegExp("("+i.join(")|(")+")|($)",s)}}return e.prototype.$setMaxTokenCount=function(e){r=0|e},e.prototype.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if("string"==typeof n)return[{type:n,value:e}];for(var i=[],r=0,o=n.length;r<o;r++)t[r]&&(i[i.length]={type:n[r],value:t[r]});return i},e.prototype.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var n=[],i=this.tokenArray,r=0,o=i.length;r<o;r++)t[r+1]&&(n[n.length]={type:i[r],value:t[r+1]});return n},e.prototype.removeCapturingGroups=function(e){return e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(e,t){return t?"(?:":e})},e.prototype.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var n=0,i=!1,r={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,o,s,a,l){return i?i="]"!=a:a?i=!0:s?(n==r.stack&&(r.end=l+1,r.stack=-1),n--):o&&(n++,1!=o.length&&(r.stack=n,r.start=l)),e}),null!=r.end&&/^\)*$/.test(e.substr(r.end))&&(e=e.substring(0,r.start)+e.substr(r.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},e.prototype.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var n=t.slice(0);"#tmp"===(t=n[0])&&(n.shift(),t=n.shift())}else var n=[];var i=t||"start",o=this.states[i];o||(i="start",o=this.states[i]);var s=this.matchMappings[i],a=this.regExps[i];a.lastIndex=0;for(var l,c=[],u=0,d=0,h={type:null,value:""};l=a.exec(e);){var p=s.defaultToken,f=null,g=l[0],m=a.lastIndex;if(m-g.length>u){var v=e.substring(u,m-g.length);h.type==p?h.value+=v:(h.type&&c.push(h),h={type:p,value:v})}for(var b=0;b<l.length-2;b++)if(void 0!==l[b+1]){f=o[s[b]],p=f.onMatch?f.onMatch(g,i,n,e):f.token,f.next&&(i="string"==typeof f.next?f.next:f.next(i,n),(o=this.states[i])||(this.reportError("state doesn't exist",i),i="start",o=this.states[i]),s=this.matchMappings[i],u=m,(a=this.regExps[i]).lastIndex=m),f.consumeLineEnd&&(u=m);break}if(g){if("string"==typeof p)f&&!1===f.merge||h.type!==p?(h.type&&c.push(h),h={type:p,value:g}):h.value+=g;else if(p){h.type&&c.push(h),h={type:null,value:""};for(var b=0;b<p.length;b++)c.push(p[b])}}if(u==e.length)break;if(u=m,d++>r){for(d>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});u<e.length;)h.type&&c.push(h),h={value:e.substring(u,u+=500),type:"overflow"};i="start",n=[];break}}return h.type&&c.push(h),n.length>1&&n[0]!==i&&n.unshift("#tmp",i),{tokens:c,state:n.length?n:i}},e}();o.prototype.reportError=i,t.Tokenizer=o}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,t,n){"use strict";var i,r=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){for(var i=e[n],r=0;r<i.length;r++){var o=i[r];(o.next||o.onMatch)&&("string"==typeof o.next&&0!==o.next.indexOf(t)&&(o.next=t+o.next),o.nextState&&0!==o.nextState.indexOf(t)&&(o.nextState=t+o.nextState))}this.$rules[t+n]=i}},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,o){var s="function"==typeof e?new e().getRules():e;if(i)for(var a=0;a<i.length;a++)i[a]=t+i[a];else for(var l in i=[],s)i.push(t+l);if(this.addRules(s,t),n)for(var c=Array.prototype[o?"push":"unshift"],a=0;a<i.length;a++)c.apply(this.$rules[i[a]],r(n));this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return("start"!=e||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){var n=0,i=this.$rules;function r(o){var s=i[o];s.processed=!0;for(var a=0;a<s.length;a++){var l=s[a],c=null;Array.isArray(l)&&(c=l,l={}),!l.regex&&l.start&&(l.regex=l.start,l.next||(l.next=[]),l.next.push({defaultToken:l.token},{token:l.token+".end",regex:l.end||l.start,next:"pop"}),l.token=l.token+".start",l.push=!0);var u=l.next||l.push;if(u&&Array.isArray(u)){var d=l.stateName;!d&&("string"!=typeof(d=l.token)&&(d=d[0]||""),i[d]&&(d+=n++)),i[d]=u,l.next=d,r(d)}else"pop"==u&&(l.next=t);if(l.push&&(l.nextState=l.next||l.push,l.next=e,delete l.push),l.rules)for(var h in l.rules)i[h]?i[h].push&&i[h].push.apply(i[h],l.rules[h]):i[h]=l.rules[h];var p="string"==typeof l?l:l.include;if(p&&("$self"===p&&(p="start"),c=Array.isArray(p)?p.map(function(e){return i[e]}):i[p]),c){var f=[a,1].concat(c);l.noEscape&&(f=f.filter(function(e){return!e.next})),s.splice.apply(s,f),a--}l.keywordMap&&(l.token=this.createKeywordMapper(l.keywordMap,l.defaultToken||"text",l.caseInsensitive),delete l.defaultToken)}}Object.keys(i).forEach(r,this)},this.createKeywordMapper=function(e,t,n,i){var r=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(t){for(var o=e[t].split(i||"|"),s=o.length;s--;){var a=o[s];this.$keywordList.push(a),n&&(a=a.toLowerCase()),r[a]=t}},this),e=null,n?function(e){return r[e.toLowerCase()]||t}:function(e){return r[e]||t}},this.getKeywords=function(){return this.$keywords}}).call((i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),t.TextHighlightRules=i}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,t,n){"use strict";var i;(function(){this.add=function(e,t,n){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=n},this.addBehaviours=function(e){for(var t in e)for(var n in e[t])this.add(t,n,e[t][n])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"==typeof e)var n=new e().getBehaviours(t);else var n=e.getBehaviours(t);this.addBehaviours(n)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var t={},n=0;n<e.length;n++)this.$behaviours[e[n]]&&(t[e[n]]=this.$behaviours[e[n]]);return t}}).call((i=function(){this.$behaviours={}}).prototype),t.Behaviour=i}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("./range").Range;t.TokenIterator=function(){function e(e,t,n){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var i=e.getTokenAt(t,n);this.$tokenIndex=i?i.index:-1}return e.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},e.prototype.stepForward=function(){var e;for(this.$tokenIndex+=1;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentTokenRow=function(){return this.$row},e.prototype.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(void 0!==n)return n;for(n=0;t>0;)t-=1,n+=e[t].value.length;return n},e.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},e.prototype.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new i(this.$row,t,this.$row,t+e.value.length)},e}()}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var i,r,o=e("../../lib/oop"),s=e("../behaviour").Behaviour,a=e("../../token_iterator").TokenIterator,l=e("../../lib/lang"),c=["text","paren.rparen","rparen","paren","punctuation.operator"],u=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],d={},h={'"':'"',"'":"'"},p=function(e){var t=-1;if(e.multiSelect&&(t=e.selection.index,d.rangeCount!=e.multiSelect.rangeCount&&(d={rangeCount:e.multiSelect.rangeCount})),d[t])return i=d[t];i=d[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},f=function(e,t,n,i){var r=e.end.row-e.start.row;return{text:n+t+i,selection:[0,e.start.column+1,r,e.end.column+ +!r]}};(r=function(e){e=e||{},this.add("braces","insertion",function(t,n,o,s,a){var c=o.getCursorPosition(),u=s.doc.getLine(c.row);if("{"==a){p(o);var d=o.getSelectionRange(),h=s.doc.getTextRange(d),g=s.getTokenAt(c.row,c.column);if(""!==h&&"{"!==h&&o.getWrapBehavioursEnabled())return f(d,h,"{","}");if(g&&/(?:string)\.quasi|\.xml/.test(g.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(g.type)})||/(string)\.quasi/.test(g.type)&&"$"!==g.value[c.column-g.start-1])return;return r.recordAutoInsert(o,s,"}"),{text:"{}",selection:[1,1]}}if(r.isSaneInsertion(o,s))if(/[\]\}\)]/.test(u[c.column])||o.inMultiSelectMode||e.braces)return r.recordAutoInsert(o,s,"}"),{text:"{}",selection:[1,1]};else return r.recordMaybeInsert(o,s,"{"),{text:"{",selection:[1,1]}}else if("}"==a){p(o);var m=u.substring(c.column,c.column+1);if("}"==m&&null!==s.$findOpeningBracket("}",{column:c.column+1,row:c.row})&&r.isAutoInsertedClosing(c,u,a))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==a||"\r\n"==a){p(o);var v="";r.isMaybeInsertedClosing(c,u)&&(v=l.stringRepeat("}",i.maybeInsertedBrackets),r.clearMaybeInsertedClosing());var m=u.substring(c.column,c.column+1);if("}"===m){var b=s.findMatchingBracket({row:c.row,column:c.column+1},"}");if(!b)return null;var y=this.$getIndent(s.getLine(b.row))}else if(!v)return void r.clearMaybeInsertedClosing();else var y=this.$getIndent(u);var w=y+s.getTabString();return{text:"\n"+w+"\n"+y+v,selection:[1,w.length,1,w.length]}}else r.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,t,n,r,o){var s=r.doc.getTextRange(o);if(!o.isMultiLine()&&"{"==s){if(p(n),"}"==r.doc.getLine(o.start.row).substring(o.end.column,o.end.column+1))return o.end.column++,o;i.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,i,o){if("("==o){p(n);var s=n.getSelectionRange(),a=i.doc.getTextRange(s);if(""!==a&&n.getWrapBehavioursEnabled())return f(s,a,"(",")");if(r.isSaneInsertion(n,i))return r.recordAutoInsert(n,i,")"),{text:"()",selection:[1,1]}}else if(")"==o){p(n);var l=n.getCursorPosition(),c=i.doc.getLine(l.row);if(")"==c.substring(l.column,l.column+1)&&null!==i.$findOpeningBracket(")",{column:l.column+1,row:l.row})&&r.isAutoInsertedClosing(l,c,o))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,t,n,i,r){var o=i.doc.getTextRange(r);if(!r.isMultiLine()&&"("==o&&(p(n),")"==i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)))return r.end.column++,r}),this.add("brackets","insertion",function(e,t,n,i,o){if("["==o){p(n);var s=n.getSelectionRange(),a=i.doc.getTextRange(s);if(""!==a&&n.getWrapBehavioursEnabled())return f(s,a,"[","]");if(r.isSaneInsertion(n,i))return r.recordAutoInsert(n,i,"]"),{text:"[]",selection:[1,1]}}else if("]"==o){p(n);var l=n.getCursorPosition(),c=i.doc.getLine(l.row);if("]"==c.substring(l.column,l.column+1)&&null!==i.$findOpeningBracket("]",{column:l.column+1,row:l.row})&&r.isAutoInsertedClosing(l,c,o))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,t,n,i,r){var o=i.doc.getTextRange(r);if(!r.isMultiLine()&&"["==o&&(p(n),"]"==i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)))return r.end.column++,r}),this.add("string_dquotes","insertion",function(e,t,n,i,r){var o=i.$mode.$quotes||h;if(1==r.length&&o[r]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(r))return;p(n);var s=r,a=n.getSelectionRange(),l=i.doc.getTextRange(a);if(""!==l&&(1!=l.length||!o[l])&&n.getWrapBehavioursEnabled())return f(a,l,s,s);if(!l){var c,u=n.getCursorPosition(),d=i.doc.getLine(u.row),g=d.substring(u.column-1,u.column),m=d.substring(u.column,u.column+1),v=i.getTokenAt(u.row,u.column),b=i.getTokenAt(u.row,u.column+1);if("\\"==g&&v&&/escape/.test(v.type))return null;var y=v&&/string|escape/.test(v.type),w=!b||/string|escape/.test(b.type);if(m==s)(c=y!==w)&&/string\.end/.test(b.type)&&(c=!1);else{if(y&&!w||y&&w)return null;var x=i.$mode.tokenRe;x.lastIndex=0;var $=x.test(g);x.lastIndex=0;var _=x.test(m),S=i.$mode.$pairQuotesAfter;if(!(S&&S[s]&&S[s].test(g))&&$||_||m&&!/[\s;,.})\]\\]/.test(m))return null;var M=d[u.column-2];if(g==s&&(M==s||x.test(M)))return null;c=!0}return{text:c?s+s:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,i,r){var o=i.$mode.$quotes||h,s=i.doc.getTextRange(r);if(!r.isMultiLine()&&o.hasOwnProperty(s)&&(p(n),i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)==s))return r.end.column++,r}),!1!==e.closeDocComment&&this.add("doc comment end","insertion",function(e,t,n,i,r){if("doc-start"===e&&("\n"===r||"\r\n"===r)&&n.selection.isEmpty()){var o=n.getCursorPosition();if(0!==o.column){for(var s=i.doc.getLine(o.row),a=i.doc.getLine(o.row+1),l=i.getTokens(o.row),c=0,u=0;u<l.length;u++){c+=l[u].value.length;var d=l[u];if(c>=o.column){if(c===o.column){if(!/\.doc/.test(d.type))return;if(/\*\//.test(d.value)){var h=l[u+1];if(!h||!/\.doc/.test(h.type))return}}var p=o.column-(c-d.value.length),f=d.value.indexOf("*/"),g=d.value.indexOf("/**",f>-1?f+2:0);if(-1!==g&&p>g&&p<g+3||-1!==f&&-1!==g&&p>=f&&p<=g||!/\.doc/.test(d.type))return;break}}var m=this.$getIndent(s);if(/\s*\*/.test(a))if(/^\s*\*/.test(s))return{text:r+m+"* ",selection:[1,2+m.length,1,2+m.length]};else return{text:r+m+" * ",selection:[1,3+m.length,1,3+m.length]};if(/\/\*\*/.test(s.substring(0,o.column)))return{text:r+m+" * "+r+" "+m+"*/",selection:[1,4+m.length,1,4+m.length]}}}})}).isSaneInsertion=function(e,t){var n=e.getCursorPosition(),i=new a(t,n.row,n.column);if(!this.$matchTokenType(i.getCurrentToken()||"text",c)){if(/[)}\]]/.test(e.session.getLine(n.row)[n.column]))return!0;var r=new a(t,n.row,n.column+1);if(!this.$matchTokenType(r.getCurrentToken()||"text",c))return!1}return i.stepForward(),i.getCurrentTokenRow()!==n.row||this.$matchTokenType(i.getCurrentToken()||"text",u)},r.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},r.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),o=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,o,i.autoInsertedLineEnd[0])||(i.autoInsertedBrackets=0),i.autoInsertedRow=r.row,i.autoInsertedLineEnd=n+o.substr(r.column),i.autoInsertedBrackets++},r.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),o=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,o)||(i.maybeInsertedBrackets=0),i.maybeInsertedRow=r.row,i.maybeInsertedLineStart=o.substr(0,r.column)+n,i.maybeInsertedLineEnd=o.substr(r.column),i.maybeInsertedBrackets++},r.isAutoInsertedClosing=function(e,t,n){return i.autoInsertedBrackets>0&&e.row===i.autoInsertedRow&&n===i.autoInsertedLineEnd[0]&&t.substr(e.column)===i.autoInsertedLineEnd},r.isMaybeInsertedClosing=function(e,t){return i.maybeInsertedBrackets>0&&e.row===i.maybeInsertedRow&&t.substr(e.column)===i.maybeInsertedLineEnd&&t.substr(0,e.column)==i.maybeInsertedLineStart},r.popAutoInsertedClosing=function(){i.autoInsertedLineEnd=i.autoInsertedLineEnd.substr(1),i.autoInsertedBrackets--},r.clearMaybeInsertedClosing=function(){i&&(i.maybeInsertedBrackets=0,i.maybeInsertedRow=-1)},o.inherits(r,s),t.CstyleBehaviour=r}),ace.define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";for(var i=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],r=0,o=[],s=0;s<i.length;s+=2)o.push(r+=i[s]),i[s+1]&&o.push(45,r+=i[s+1]);t.wordChars=String.fromCharCode.apply(null,o)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var i,r=e("../config"),o=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,a=e("./behaviour/cstyle").CstyleBehaviour,l=e("../unicode"),c=e("../lib/lang"),u=e("../token_iterator").TokenIterator,d=e("../range").Range;(function(){this.$defaultBehaviour=new a,this.tokenRe=RegExp("^["+l.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+l.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new o(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,n,i){var r=t.doc,o=!0,s=!0,a=1/0,l=t.getTabSize(),u=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var d=this.lineCommentStart.map(c.escapeRegExp).join("|"),h=this.lineCommentStart[0];else var d=c.escapeRegExp(this.lineCommentStart),h=this.lineCommentStart;d=RegExp("^(\\s*)(?:"+d+") ?"),u=t.getUseSoftTabs();var p=function(e,t){var n=e.match(d);if(n){var i=n[1].length,o=n[0].length;!v(e,i,o)&&" "==n[0][o-1]&&o--,r.removeInLine(t,i,o)}},f=h+" ",g=function(e,t){(!o||/\S/.test(e))&&(v(e,a,a)?r.insertInLine({row:t,column:a},f):r.insertInLine({row:t,column:a},h))},m=function(e,t){return d.test(e)},v=function(e,t,n){for(var i=0;t--&&" "==e.charAt(t);)i++;if(i%l!=0)return!1;for(var i=0;" "==e.charAt(n++);)i++;return l>2?i%l!=l-1:i%l==0}}else{if(!this.blockComment)return!1;var h=this.blockComment.start,b=this.blockComment.end,d=RegExp("^(\\s*)(?:"+c.escapeRegExp(h)+")"),y=RegExp("(?:"+c.escapeRegExp(b)+")\\s*$"),g=function(e,t){!m(e,t)&&(!o||/\S/.test(e))&&(r.insertInLine({row:t,column:e.length},b),r.insertInLine({row:t,column:a},h))},p=function(e,t){var n;(n=e.match(y))&&r.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(d))&&r.removeInLine(t,n[1].length,n[0].length)},m=function(e,n){if(d.test(e))return!0;for(var i=t.getTokens(n),r=0;r<i.length;r++)if("comment"===i[r].type)return!0}}function w(e){for(var t=n;t<=i;t++)e(r.getLine(t),t)}var x=1/0;w(function(e,t){var n=e.search(/\S/);-1!==n?(n<a&&(a=n),s&&!m(e,t)&&(s=!1)):x>e.length&&(x=e.length)}),a==1/0&&(a=x,o=!1,s=!1),u&&a%l!=0&&(a=Math.floor(a/l)*l),w(s?p:g)},this.toggleBlockComment=function(e,t,n,i){var r=this.blockComment;if(r){!r.start&&r[0]&&(r=r[0]);var o=new u(t,i.row,i.column),s=o.getCurrentToken();t.selection;var a=t.selection.toOrientedRange();if(s&&/comment/.test(s.type)){for(;s&&/comment/.test(s.type);){var l,c,h,p,f=s.value.indexOf(r.start);if(-1!=f){var g=o.getCurrentTokenRow(),m=o.getCurrentTokenColumn()+f;h=new d(g,m,g,m+r.start.length);break}s=o.stepBackward()}for(var o=new u(t,i.row,i.column),s=o.getCurrentToken();s&&/comment/.test(s.type);){var f=s.value.indexOf(r.end);if(-1!=f){var g=o.getCurrentTokenRow(),m=o.getCurrentTokenColumn()+f;p=new d(g,m,g,m+r.end.length);break}s=o.stepForward()}p&&t.remove(p),h&&(t.remove(h),l=h.start.row,c=-r.start.length)}else c=r.start.length,l=n.start.row,t.insert(n.end,r.end),t.insert(n.start,r.start);a.start.row==l&&(a.start.column+=c),a.end.row==l&&(a.end.column+=c),t.selection.fromOrientedRange(a)}},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var t in this.$embeds=[],this.$modes={},e)if(e[t]){var n=e[t],i=n.prototype.$id,o=r.$modes[i];o||(r.$modes[i]=o=new n),r.$modes[t]||(r.$modes[t]=o),this.$embeds.push(t),this.$modes[t]=o}for(var s=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],a=function(e){!function(t){var n=s[e],i=t[n];t[s[e]]=function(){return this.$delegator(n,arguments,i)}}(l)},l=this,t=0;t<s.length;t++)a(t)},this.$delegator=function(e,t,n){var i=t[0]||"start";if("string"!=typeof i){if(Array.isArray(i[2])){var r=i[2][i[2].length-1],o=this.$modes[r];if(o)return o[e].apply(o,[i[1]].concat([].slice.call(t,1)))}i=i[0]||"start"}for(var s=0;s<this.$embeds.length;s++)if(this.$modes[this.$embeds[s]]){var a=i.split(this.$embeds[s]);if(!a[0]&&a[1]){t[0]=a[1];var o=this.$modes[this.$embeds[s]];return o[e].apply(o,t)}}var l=n.apply(this,t);return n?l:void 0},this.transformAction=function(e,t,n,i,r){if(this.$behaviour){var o=this.$behaviour.getBehaviours();for(var s in o)if(o[s][t]){var a=o[s][t].apply(this,arguments);if(a)return a}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,n=[];for(var i in t)for(var r=t[i],o=0,s=r.length;o<s;o++)if("string"==typeof r[o].token)/keyword|support|storage/.test(r[o].token)&&n.push(r[o].regex);else if("object"==typeof r[o].token){for(var a=0,l=r[o].token.length;a<l;a++)if(/keyword|support|storage/.test(r[o].token[a])){var i=r[o].regex.match(/\(.+?\)/g)[a];n.push(i.substr(1,i.length-2))}}this.completionKeywords=n}return e?n.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,n,i){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((i=function(){this.HighlightRules=s}).prototype),t.Mode=i}),ace.define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";t.applyDelta=function(e,t,n){var i=t.start.row,r=t.start.column,o=e[i]||"";switch(t.action){case"insert":if(1===t.lines.length)e[i]=o.substring(0,r)+t.lines[0]+o.substring(r);else{var s=[i,1].concat(t.lines);e.splice.apply(e,s),e[i]=o.substring(0,r)+e[i],e[i+t.lines.length-1]+=o.substring(r)}break;case"remove":var a=t.end.column,l=t.end.row;i===l?e[i]=o.substring(0,r)+o.substring(a):e.splice(i,l-i+1,o.substring(0,r)+e[l].substring(a))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,o=function(){function e(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof t?this.setPosition(t.row,t.column):this.setPosition(t,n)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(e){if((e.start.row!=e.end.row||e.start.row==this.row)&&!(e.start.row>this.row)){var t=a(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(t.row,t.column,!0)}},e.prototype.setPosition=function(e,t,n){if(i=n?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=i.row||this.column!=i.column){var i,r={row:this.row,column:this.column};this.row=i.row,this.column=i.column,this._signal("change",{old:r,value:i})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n},e}();function s(e,t,n){var i=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&i}function a(e,t,n){var i="insert"==e.action,r=(i?1:-1)*(e.end.row-e.start.row),o=(i?1:-1)*(e.end.column-e.start.column),a=e.start,l=i?a:e.end;return s(t,a,n)?{row:t.row,column:t.column}:s(l,t,!n)?{row:t.row+r,column:t.column+(t.row==l.row?o:0)}:{row:a.row,column:a.column}}o.prototype.$insertRight=!1,i.implement(o.prototype,r),t.Anchor=o}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./apply_delta").applyDelta,o=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,a=e("./anchor").Anchor,l=function(){function e(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return e.prototype.setValue=function(e){var t=this.getLength()-1;this.remove(new s(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e||"")},e.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},e.prototype.createAnchor=function(e,t){return new a(this,e,t)},e.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},e.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},e.prototype.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},e.prototype.getNewLineMode=function(){return this.$newLineMode},e.prototype.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},e.prototype.getLine=function(e){return this.$lines[e]||""},e.prototype.getLines=function(e,t){return this.$lines.slice(e,t+1)},e.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},e.prototype.getLength=function(){return this.$lines.length},e.prototype.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},e.prototype.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(t=this.getLines(e.start.row,e.end.row))[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},e.prototype.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},e.prototype.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},e.prototype.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},e.prototype.insert=function(e,t){return 1>=this.getLength()&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},e.prototype.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),i=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:i,action:"insert",lines:[t]},!0),this.clonePos(i)},e.prototype.clippedPos=function(e,t){var n=this.getLength();void 0===e?e=n:e<0?e=0:e>=n&&(e=n-1,t=void 0);var i=this.getLine(e);return void 0==t&&(t=i.length),{row:e,column:t=Math.min(Math.max(t,0),i.length)}},e.prototype.clonePos=function(e){return{row:e.row,column:e.column}},e.prototype.pos=function(e,t){return{row:e,column:t}},e.prototype.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},e.prototype.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},e.prototype.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),i={row:n.row+t.length-1,column:(1==t.length?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:i,action:"insert",lines:t}),this.clonePos(i)},e.prototype.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},e.prototype.removeInLine=function(e,t,n){var i=this.clippedPos(e,t),r=this.clippedPos(e,n);return this.applyDelta({start:i,end:r,action:"remove",lines:this.getLinesForRange({start:i,end:r})},!0),this.clonePos(i)},e.prototype.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1);var n=(t=Math.min(Math.max(0,t),this.getLength()-1))==this.getLength()-1&&e>0,i=t<this.getLength()-1,r=n?e-1:e,o=n?this.getLine(r).length:0,a=i?t+1:t,l=i?0:this.getLine(a).length,c=new s(r,o,a,l),u=this.$lines.slice(e,t+1);return this.applyDelta({start:c.start,end:c.end,action:"remove",lines:this.getLinesForRange(c)}),u},e.prototype.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},e.prototype.replace=function(e,t){var n;return(e instanceof s||(e=s.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty())?e.start:t==this.getTextRange(e)?e.end:(this.remove(e),n=t?this.insert(e.start,t):e.start)},e.prototype.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},e.prototype.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},e.prototype.applyDelta=function(e,t){var n="insert"==e.action;(n?!(e.lines.length<=1)||e.lines[0]:s.comparePoints(e.start,e.end))&&(n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(r(this.$lines,e,t),this._signal("change",e)))},e.prototype.$safeApplyDelta=function(e){var t=this.$lines.length;("remove"==e.action&&e.start.row<t&&e.end.row<t||"insert"==e.action&&e.start.row<=t)&&this.applyDelta(e)},e.prototype.$splitAndapplyLargeDelta=function(e,t){for(var n=e.lines,i=n.length-t+1,r=e.start.row,o=e.start.column,s=0,a=0;s<i;s=a){a+=t-1;var l=n.slice(s,a);l.push(""),this.applyDelta({start:this.pos(r+s,o),end:this.pos(r+a,o=0),action:e.action,lines:l},!0)}e.lines=n.slice(s),e.start.row=r+s,e.start.column=o,this.applyDelta(e,!0)},e.prototype.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},e.prototype.indexToPosition=function(e,t){for(var n=this.$lines||this.getAllLines(),i=this.getNewLineCharacter().length,r=t||0,o=n.length;r<o;r++)if((e-=n[r].length+i)<0)return{row:r,column:e+n[r].length+i};return{row:o-1,column:e+n[o-1].length+i}},e.prototype.positionToIndex=function(e,t){for(var n=this.$lines||this.getAllLines(),i=this.getNewLineCharacter().length,r=0,o=Math.min(e.row,n.length),s=t||0;s<o;++s)r+=n[s].length+i;return r+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();l.prototype.$autoNewLine="",l.prototype.$newLineMode="auto",i.implement(l.prototype,o),t.Document=l}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,o=function(){function e(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var n=this;this.$worker=function(){if(n.running){for(var e=new Date,t=n.currentLine,i=-1,r=n.doc,o=t;n.lines[t];)t++;var s=r.getLength(),a=0;for(n.running=!1;t<s;){n.$tokenizeRow(t),i=t;do t++;while(n.lines[t]);if(++a%5==0&&new Date-e>20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,-1==i&&(i=t),o<=i&&n.fireUpdateEvent(o,i)}}}return e.prototype.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},e.prototype.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},e.prototype.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},e.prototype.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},e.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},e.prototype.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(0===n)this.lines[t]=null;else if("remove"==e.action)this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.lines.splice.apply(this.lines,i),this.states.splice.apply(this.states,i)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},e.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},e.prototype.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},e.prototype.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},e.prototype.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],i=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=i.state+""?(this.states[e]=i.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=i.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();i.implement(o.prototype,r),t.BackgroundTokenizer=o}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,t,n){"use strict";var i=e("./lib/lang"),r=e("./range").Range,o=function(){function e(e,t,n){void 0===n&&(n="text"),this.setRegexp(e),this.clazz=t,this.type=n}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,t,n,o){if(this.regExp)for(var s=o.firstRow,a=o.lastRow,l={},c=s;c<=a;c++){var u=this.cache[c];null==u&&((u=i.getMatchOffsets(n.getLine(c),this.regExp)).length>this.MAX_RANGES&&(u=u.slice(0,this.MAX_RANGES)),u=u.map(function(e){return new r(c,e.offset,c,e.offset+e.length)}),this.cache[c]=u.length?u:"");for(var d=u.length;d--;){var h=u[d].toScreenRange(n),p=h.toString();l[p]||(l[p]=!0,t.drawSingleLineMarker(e,h,this.clazz,o))}}},e}();o.prototype.MAX_RANGES=500,t.SearchHighlight=o}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=function(){function e(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return e.prototype.addSession=function(e){this.$session=e},e.prototype.add=function(e,t,n){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===t||!this.lastDeltas){this.lastDeltas=[];var i=this.$undoStack.length;i>this.$undoDepth-1&&this.$undoStack.splice(0,i-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev}("remove"==e.action||"insert"==e.action)&&(this.$lastDelta=e),this.lastDeltas.push(e)}},e.prototype.addSelection=function(e,t){this.selections.push({value:e,rev:t||this.$rev})},e.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},e.prototype.markIgnored=function(e,t){null==t&&(t=this.$rev+1);for(var n=this.$undoStack,i=n.length;i--;){var r=n[i][0];if(r.id<=e)break;r.id<t&&(r.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,t){for(var n=this.selections,i=n.length;i--;){var r=n[i];if(r.rev<e)return t&&(r=n[i+1]),r}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,t){null==t&&(t=this.$rev+1);for(var n=this.$undoStack,i=null,r=0,o=n.length;o--;){var s=n[o][0];if(s.id<t&&!i&&(i=o+1),s.id<=e){r=o+1;break}}return n.slice(r,i)},e.prototype.getChangedRanges=function(e,t){null==t&&(t=this.$rev+1)},e.prototype.getChangedLines=function(e,t){null==t&&(t=this.$rev+1)},e.prototype.undo=function(e,t){this.lastDeltas=null;var n=this.$undoStack;if(r(n,n.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var i=n.pop(),o=null;return i&&(o=e.undoChanges(i,t),this.$redoStack.push(i),this.$syncRev()),this.$fromUndo=!1,o}},e.prototype.redo=function(e,t){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var n=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);b(this.$redoStack,n),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var i=this.$redoStack.pop(),r=null;return i&&(r=e.redoChanges(i,t),this.$undoStack.push(i),this.$syncRev()),this.$fromUndo=!1,r},e.prototype.$syncRev=function(){var e=this.$undoStack,t=e[e.length-1],n=t&&t[0].id||0;this.$redoStackBaseRev=n,this.$rev=n},e.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},e.prototype.canUndo=function(){return this.$undoStack.length>0},e.prototype.canRedo=function(){return this.$redoStack.length>0},e.prototype.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},e.prototype.isAtBookmark=function(){return this.$rev===this.mark},e.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},e.prototype.fromJSON=function(e){this.reset(),this.$undoStack=e.$undoStack,this.$redoStack=e.$redoStack},e.prototype.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)},e}();function r(e,t){for(var n=t;n--;){var i=e[n];if(i&&!i[0].ignore){for(;n<t-1;){var r=h(e[n],e[n+1]);e[n]=r[0],e[n+1]=r[1],n++}return!0}}}i.prototype.hasUndo=i.prototype.canUndo,i.prototype.hasRedo=i.prototype.canRedo,i.prototype.isClean=i.prototype.isAtBookmark,i.prototype.markClean=i.prototype.bookmark;var o=e("./range").Range,s=o.comparePoints;function a(e){return{row:e.row,column:e.column}}function l(e){return{start:a(e.start),end:a(e.end),action:e.action,lines:e.lines.slice()}}function c(e){if(Array.isArray(e=e||this))return e.map(c).join("\n");var t="";return e.action?t=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(t=Array.isArray(e.value)?e.value.map(u).join("\n"):u(e.value)),e.start&&(t+=u(e)),(e.id||e.rev)&&(t+=" ("+(e.id||e.rev)+")"),t}function u(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function d(e,t){var n="insert"==e.action,i="insert"==t.action;if(n&&i)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.start,e.start)))return null;f(e,t,1)}else if(n&&!i)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.end,e.start)))return null;f(e,t,-1)}else if(!n&&i)if(s(t.start,e.start)>=0)f(t,e,1);else{if(!(0>=s(t.start,e.start)))return null;f(e,t,1)}else if(!n&&!i)if(s(t.start,e.start)>=0)f(t,e,1);else{if(!(0>=s(t.end,e.start)))return null;f(e,t,-1)}return[t,e]}function h(e,t){for(var n=e.length;n--;)for(var i=0;i<t.length;i++)if(!d(e[n],t[i])){for(;n<e.length;){for(;i--;)d(t[i],e[n]);i=t.length,n++}return[e,t]}return e.selectionBefore=t.selectionBefore=e.selectionAfter=t.selectionAfter=null,[t,e]}function p(e,t){var n,i,r="insert"==e.action,a="insert"==t.action;if(r&&a)0>s(e.start,t.start)?f(t,e,1):f(e,t,1);else if(r&&!a)s(e.start,t.end)>=0?f(e,t,-1):(0>=s(e.start,t.start)||f(e,o.fromPoints(t.start,e.start),-1),f(t,e,1));else if(!r&&a)s(t.start,e.end)>=0?f(t,e,-1):(0>=s(t.start,e.start)||f(t,o.fromPoints(e.start,t.start),-1),f(e,t,1));else if(!r&&!a)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.end,e.start)))return 0>s(e.start,t.start)&&(n=e,e=m(e,t.start)),s(e.end,t.end)>0&&(i=m(e,t.end)),g(t.end,e.start,e.end,-1),i&&!n&&(e.lines=i.lines,e.start=i.start,e.end=i.end,i=e),[t,n,i].filter(Boolean);f(e,t,-1)}return[t,e]}function f(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,i){e.row==(1==i?t:n).row&&(e.column+=i*(n.column-t.column)),e.row+=i*(n.row-t.row)}function m(e,t){var n=e.lines,i=e.end;e.end=a(t);var r=e.end.row-e.start.row,o=n.splice(r,n.length),s=r?t.column:t.column-e.start.column;return n.push(o[0].substring(0,s)),o[0]=o[0].substr(s),{start:a(t),end:i,lines:o,action:e.action}}function v(e,t){t=l(t);for(var n=e.length;n--;){for(var i=e[n],r=0;r<i.length;r++){var o=p(i[r],t);t=o[0],2!=o.length&&(o[2]?(i.splice(r+1,1,o[1],o[2]),r++):!o[1]&&(i.splice(r,1),r--))}i.length||e.splice(n,1)}return e}function b(e,t){for(var n=0;n<t.length;n++)for(var i=t[n],r=0;r<i.length;r++)v(e,i[r])}o.comparePoints,t.UndoManager=i}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("../range").Range;t.FoldLine=function(){function e(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new i(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}return e.prototype.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},e.prototype.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):0>this.range.compareStart(e.end.row,e.end.column)&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else if(e.end.row==this.start.row)this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column;else throw Error("Trying to add fold to FoldRow that doesn't have a matching row");e.foldLine=this},e.prototype.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},e.prototype.walk=function(e,t,n){var i,r,o,s=0,a=this.folds,l=!0;null==t&&(t=this.end.row,n=this.end.column);for(var c=0;c<a.length;c++){if(-1==(r=(i=a[c]).range.compareStart(t,n)))return void e(null,t,n,s,l);if((o=!(o=e(null,i.start.row,i.start.column,s,l))&&e(i.placeholder,i.start.row,i.start.column,s))||0===r)return;l=!i.sameRow,s=i.end.column}e(null,t,n,s,l)},e.prototype.getNextFoldTo=function(e,t){for(var n,i,r=0;r<this.folds.length;r++){if(-1==(i=(n=this.folds[r]).range.compareEnd(e,t)))return{fold:n,kind:"after"};if(0===i)return{fold:n,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,t,n){var i,r,o=this.getNextFoldTo(e,t);if(o){if(i=o.fold,"inside"==o.kind&&i.start.column!=t&&i.start.row!=e)window.console&&window.console.log(e,t,i);else if(i.start.row==e){var s=(r=this.folds).indexOf(i);for(0===s&&(this.start.column+=n);s<r.length;s++){if(i=r[s],i.start.column+=n,!i.sameRow)return;i.end.column+=n}this.end.column+=n}}},e.prototype.split=function(t,n){var i=this.getNextFoldTo(t,n);if(!i||"inside"==i.kind)return null;var r=i.fold,o=this.folds,s=this.foldData,a=o.indexOf(r),l=o[a-1];this.end.row=l.end.row,this.end.column=l.end.column;var c=new e(s,o=o.splice(a,o.length-a));return s.splice(s.indexOf(this)+1,0,c),c},e.prototype.merge=function(e){for(var t=e.folds,n=0;n<t.length;n++)this.addFold(t[n]);var i=this.foldData;i.splice(i.indexOf(e),1)},e.prototype.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push(" "+t.toString())}),e.push("]"),e.join("\n")},e.prototype.idxToPosition=function(e){for(var t=0,n=0;n<this.folds.length;n++){var i=this.folds[n];if((e-=i.start.column-t)<0)return{row:i.start.row,column:i.start.column+e};if((e-=i.placeholder.length)<0)return i.start;t=i.end.column}return{row:this.end.row,column:this.end.column+e}},e}()}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("./range").Range.comparePoints,r=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,t,n){for(var r=this.ranges,o=n||0;o<r.length;o++){var s=r[o],a=i(e,s.end);if(!(a>0)){var l=i(e,s.start);if(0===a)return t&&0!==l?-o-2:o;if(l>0||0===l&&!t)return o;break}}return-o-1},e.prototype.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var i=this.pointIndex(e.end,t,n);return i<0?i=-i-1:i++,this.ranges.splice(n,i-n,e)},e.prototype.addList=function(e){for(var t=[],n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},e.prototype.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},e.prototype.merge=function(){for(var e,t=[],n=this.ranges,r=(n=n.sort(function(e,t){return i(e.start,t.start)}))[0],o=1;o<n.length;o++){e=r,r=n[o];var s=i(e.end,r.start);!(s<0)&&(0!=s||e.isEmpty()||r.isEmpty())&&(0>i(e.end,r.end)&&(e.end.row=r.end.row,e.end.column=r.end.column),n.splice(o,1),t.push(r),r=e,o--)}return this.ranges=n,t},e.prototype.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},e.prototype.containsPoint=function(e){return this.pointIndex(e)>=0},e.prototype.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},e.prototype.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row<e)return[];var i=this.pointIndex({row:e,column:0});i<0&&(i=-i-1);var r=this.pointIndex({row:t,column:0},i);r<0&&(r=-r-1);for(var o=[],s=i;s<r;s++)o.push(n[s]);return o},e.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},e.prototype.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},e.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},e.prototype.$onChange=function(e){for(var t=e.start,n=e.end,i=t.row,r=n.row,o=this.ranges,s=0,a=o.length;s<a;s++){var l=o[s];if(l.end.row>=i)break}if("insert"==e.action)for(var c=r-i,u=-t.column+n.column;s<a;s++){var l=o[s];if(l.start.row>i)break;if(l.start.row==i&&l.start.column>=t.column&&(l.start.column==t.column&&this.$bias<=0||(l.start.column+=u,l.start.row+=c)),l.end.row==i&&l.end.column>=t.column){if(l.end.column==t.column&&this.$bias<0)continue;l.end.column==t.column&&u>0&&s<a-1&&l.end.column>l.start.column&&l.end.column==o[s+1].start.column&&(l.end.column-=u),l.end.column+=u,l.end.row+=c}}else for(var c=i-r,u=t.column-n.column;s<a;s++){var l=o[s];if(l.start.row>r)break;l.end.row<r&&(i<l.end.row||i==l.end.row&&t.column<l.end.column)?(l.end.row=i,l.end.column=t.column):l.end.row==r?l.end.column<=n.column?(c||l.end.column>t.column)&&(l.end.column=t.column,l.end.row=t.row):(l.end.column+=u,l.end.row+=c):l.end.row>r&&(l.end.row+=c),l.start.row<r&&(i<l.start.row||i==l.start.row&&t.column<l.start.column)?(l.start.row=i,l.start.column=t.column):l.start.row==r?l.start.column<=n.column?(c||l.start.column>t.column)&&(l.start.column=t.column,l.start.row=t.row):(l.start.column+=u,l.start.row+=c):l.start.row>r&&(l.start.row+=c)}if(0!=c&&s<a)for(;s<a;s++){var l=o[s];l.start.row+=c,l.end.row+=c}},e}();r.prototype.comparePoints=i,t.RangeList=r}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();function r(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function o(e,t){r(e.start,t),r(e.end,t)}function s(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}function a(e,t){s(e.start,t),s(e.end,t)}t.Fold=function(e){function t(t,n){var i=e.call(this)||this;return i.foldLine=null,i.placeholder=n,i.range=t,i.start=t.start,i.end=t.end,i.sameRow=t.start.row==t.end.row,i.subFolds=i.ranges=[],i}return i(t,e),t.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},t.prototype.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},t.prototype.clone=function(){var e=new t(this.range.clone(),this.placeholder);return this.subFolds.forEach(function(t){e.subFolds.push(t.clone())}),e.collapseChildren=this.collapseChildren,e},t.prototype.addSubFold=function(e){if(!this.range.isEqual(e)){o(e,this.start);for(var t=e.start.row,n=e.start.column,i=0,r=-1;i<this.subFolds.length&&1==(r=this.subFolds[i].range.compare(t,n));i++);var s=this.subFolds[i],a=0;if(0==r)if(s.range.containsRange(e))return s.addSubFold(e);else a=1;for(var t=e.range.end.row,n=e.range.end.column,l=i,r=-1;l<this.subFolds.length&&1==(r=this.subFolds[l].range.compare(t,n));l++);0==r&&l++;for(var c=this.subFolds.splice(i,l-i,e),u=0==r?c.length-1:c.length,d=a;d<u;d++)e.addSubFold(c[d]);return e.setFoldLine(this.foldLine),e}},t.prototype.restoreRange=function(e){return a(e,this.start)},t}(e("../range_list").RangeList)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(e,t,n){"use strict";var i=e("../range").Range,r=e("./fold_line").FoldLine,o=e("./fold").Fold,s=e("../token_iterator").TokenIterator,a=e("../mouse/mouse_event").MouseEvent;t.Folding=function(){this.getFoldAt=function(e,t,n){var i=this.getFoldLine(e);if(!i)return null;for(var r=i.folds,o=0;o<r.length;o++){var s=r[o].range;if(s.contains(e,t)){if(1==n&&s.isEnd(e,t)&&!s.isEmpty()||-1==n&&s.isStart(e,t)&&!s.isEmpty())continue;return r[o]}}},this.getFoldsInRange=function(e){var t=e.start,n=e.end,i=this.$foldData,r=[];t.column+=1,n.column-=1;for(var o=0;o<i.length;o++){var s=i[o].range.compareRange(e);if(2!=s){if(-2==s)break;for(var a=i[o].folds,l=0;l<a.length;l++){var c=a[l];if(-2==(s=c.range.compareRange(e)))break;if(2!=s){if(42==s)break;r.push(c)}}}}return t.column-=1,n.column+=1,r},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){for(var e=[],t=this.$foldData,n=0;n<t.length;n++)for(var i=0;i<t[n].folds.length;i++)e.push(t[n].folds[i]);return e},this.getFoldStringAt=function(e,t,n,i){if(!(i=i||this.getFoldLine(e)))return null;for(var r,o,s={end:{column:0}},a=0;a<i.folds.length;a++){var l=(o=i.folds[a]).range.compareEnd(e,t);if(-1==l){r=this.getLine(o.start.row).substring(s.end.column,o.start.column);break}if(0===l)return null;s=o}return(r||(r=this.getLine(o.start.row).substring(s.end.column)),-1==n)?r.substring(0,t-s.end.column):1==n?r.substring(t-s.end.column):r},this.getFoldLine=function(e,t){var n=this.$foldData,i=0;for(t&&(i=n.indexOf(t)),-1==i&&(i=0);i<n.length;i++){var r=n[i];if(r.start.row<=e&&r.end.row>=e)return r;if(r.end.row>e)break}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,i=0;for(t&&(i=n.indexOf(t)),-1==i&&(i=0);i<n.length;i++){var r=n[i];if(r.end.row>=e)return r}return null},this.getFoldedRowCount=function(e,t){for(var n=this.$foldData,i=t-e+1,r=0;r<n.length;r++){var o=n[r],s=o.end.row,a=o.start.row;if(s>=t){a<t&&(a>=e?i-=t-a:i=0);break}s>=e&&(a>=e?i-=s-a:i-=s-e+1)}return i},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n,i=this.$foldData,s=!1;e instanceof o?n=e:(n=new o(t,e)).collapseChildren=t.collapseChildren,this.$clipRangeToDocument(n.range);var a=n.start.row,l=n.start.column,c=n.end.row,u=n.end.column,d=this.getFoldAt(a,l,1),h=this.getFoldAt(c,u,-1);if(d&&h==d)return d.addSubFold(n);d&&!d.range.isStart(a,l)&&this.removeFold(d),h&&!h.range.isEnd(c,u)&&this.removeFold(h);var p=this.getFoldsInRange(n.range);p.length>0&&(this.removeFolds(p),n.collapseChildren||p.forEach(function(e){n.addSubFold(e)}));for(var f=0;f<i.length;f++){var g=i[f];if(c==g.start.row){g.addFold(n),s=!0;break}if(a==g.end.row){if(g.addFold(n),s=!0,!n.sameRow){var m=i[f+1];m&&m.start.row==c&&g.merge(m)}break}if(c<=g.start.row)break}return s||(g=this.$addFoldLine(new r(this.$foldData,n))),this.$useWrapMode?this.$updateWrapData(g.start.row,g.start.row):this.$updateRowLengthCache(g.start.row,g.start.row),this.$modified=!0,this._signal("changeFold",{data:n,action:"add"}),n},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,n=t.start.row,i=t.end.row,r=this.$foldData,o=t.folds;if(1==o.length)r.splice(r.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))o.pop(),t.end.row=o[o.length-1].end.row,t.end.column=o[o.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))o.shift(),t.start.row=o[0].start.row,t.start.column=o[0].start.column;else if(e.sameRow)o.splice(o.indexOf(e),1);else{var s=t.split(e.start.row,e.start.column);(o=s.folds).shift(),s.start.row=o[0].start.row,s.start.column=o[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(n,i):this.$updateRowLengthCache(n,i)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){if(null==e)n=new i(0,0,this.getLength(),0),null==t&&(t=!0);else if("number"==typeof e)n=new i(e,0,e,this.getLine(e).length);else if("row"in e)n=i.fromPoints(e,e);else{if(Array.isArray(e))return r=[],e.forEach(function(e){r=r.concat(this.unfold(e))},this),r;n=e}for(var n,r=this.getFoldsInRangeList(n),o=r;1==r.length&&0>i.comparePoints(r[0].start,n.start)&&i.comparePoints(r[0].end,n.end)>0;)this.expandFolds(r),r=this.getFoldsInRangeList(n);if(!1!=t?this.removeFolds(r):this.expandFolds(r),o.length)return o},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,i,r){null==i&&(i=e.start.row),null==r&&(r=0),null==t&&(t=e.end.row),null==n&&(n=this.getLine(t).length);var o=this.doc,s="";return e.walk(function(e,t,n,a){if(!(t<i)){if(t==i){if(n<r)return;a=Math.max(r,a)}null!=e?s+=e:s+=o.getLine(t).substring(a,n)}},t,n),s},this.getDisplayLine=function(e,t,n,i){var r,o=this.getFoldLine(e);return o?this.getFoldDisplayLine(o,e,t,n,i):(r=this.doc.getLine(e)).substring(i||0,t||r.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var n=t.folds.map(function(e){return e.clone()});return new r(e,n)})},this.toggleFold=function(e){var t,n,i=this.selection.getRange();if(i.isEmpty()){var r=i.start;if(t=this.getFoldAt(r.row,r.column))return void this.expandFold(t);(n=this.findMatchingBracket(r))?1==i.comparePoint(n)?i.end=n:(i.start=n,i.start.column++,i.end.column--):(n=this.findMatchingBracket({row:r.row,column:r.column+1}))?(1==i.comparePoint(n)?i.end=n:i.start=n,i.start.column++):i=this.getCommentFoldRange(r.row,r.column)||i}else{var o=this.getFoldsInRange(i);if(e&&o.length)return void this.expandFolds(o);1==o.length&&(t=o[0])}if(t||(t=this.getFoldAt(i.start.row,i.start.column)),t&&t.range.toString()==i.toString())return void this.expandFold(t);var s="...";if(!i.isMultiLine()){if((s=this.getTextRange(i)).length<4)return;s=s.trim().substring(0,2)+".."}this.addFold(s,i)},this.getCommentFoldRange=function(e,t,n){var r=new s(this,e,t),o=r.getCurrentToken(),a=o&&o.type;if(o&&/^comment|string/.test(a)){"comment"==(a=a.match(/comment|string/)[0])&&(a+="|doc-start|\\.doc");var l=new RegExp(a),c=new i;if(1!=n){do o=r.stepBackward();while(o&&l.test(o.type));o=r.stepForward()}c.start.row=r.getCurrentTokenRow(),c.start.column=r.getCurrentTokenColumn()+o.value.length,r=new s(this,e,t);var u=this.getState(r.$row);if(-1!=n){var d=-1;do if(o=r.stepForward(),-1==d){var h=this.getState(r.$row);u.toString()!==h.toString()&&(d=r.$row)}else if(r.$row>d)break;while(o&&l.test(o.type));o=r.stepBackward()}else o=r.getCurrentToken();return c.end.row=r.getCurrentTokenRow(),c.end.column=r.getCurrentTokenColumn(),c}},this.foldAll=function(e,t,n,i){void 0==n&&(n=1e5);var r=this.foldWidgets;if(r){t=t||this.getLength(),e=e||0;for(var o=e;o<t;o++)if((null==r[o]&&(r[o]=this.getFoldWidget(o)),"start"==r[o])&&(!i||i(o))){var s=this.getFoldWidgetRange(o);s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e&&(o=s.end.row,s.collapseChildren=n,this.addFold("...",s))}}},this.foldToLevel=function(e){for(this.foldAll();e-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var e=this;this.foldAll(null,null,null,function(t){for(var n=e.getTokens(t),i=0;i<n.length;i++){var r=n[i];if(!("text"==r.type&&/^\s+$/.test(r.value))){if(/comment/.test(r.type))return!0;return!1}}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){if(this.$foldMode!=e){if(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!e||"manual"==this.$foldStyle){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};for(var i,r=e-1;r>=0;){var o=n[r];if(null==o&&(o=n[r]=this.getFoldWidget(r)),"start"==o){var s=this.getFoldWidgetRange(r);if(i||(i=s),s&&s.end.row>=e)break}r--}return{range:-1!==r&&s,firstRange:i}},this.onFoldWidgetClick=function(e,t){t instanceof a&&(t=t.domEvent);var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey};if(!this.$toggleFoldWidget(e,n)){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(this.getFoldWidget){var n=this.getFoldWidget(e),i=this.getLine(e),r="end"===n?-1:1,o=this.getFoldAt(e,-1===r?0:i.length,r);if(o)return t.children||t.all?this.removeFold(o):this.expandFold(o),o;var s=this.getFoldWidgetRange(e,!0);if(s&&!s.isMultiLine()&&(o=this.getFoldAt(s.start.row,s.start.column,1))&&s.isEqual(o.range))return this.removeFold(o),o;if(t.siblings){var a=this.getParentFoldRangeData(e);if(a.range)var l=a.range.start.row+1,c=a.range.end.row;this.foldAll(l,c,1e4*!!t.all)}else t.children?(c=s?s.end.row:this.getLength(),this.foldAll(e+1,c,1e4*!!t.all)):s&&(t.all&&(s.collapseChildren=1e4),this.addFold("...",s));return s}},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(!n){var i=this.getParentFoldRangeData(t,!0);if(n=i.range||i.firstRange){t=n.start.row;var r=this.getFoldAt(t,this.getLine(t).length,1);r?this.removeFold(r):this.addFold("...",n)}}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(0===n)this.foldWidgets[t]=null;else if("remove"==e.action)this.foldWidgets.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,i)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var i=e("../token_iterator").TokenIterator,r=e("../range").Range;t.BracketMatch=function(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(""==n)return null;var i=n.match(/([\(\[\{])|([\)\]\}])/);return i?i[1]?this.$findClosingBracket(i[1],e):this.$findOpeningBracket(i[2],e):null},this.getBracketRange=function(e){var t,n=this.getLine(e.row),i=!0,o=n.charAt(e.column-1),s=o&&o.match(/([\(\[\{])|([\)\]\}])/);if(s||(o=n.charAt(e.column),e={row:e.row,column:e.column+1},s=o&&o.match(/([\(\[\{])|([\)\]\}])/),i=!1),!s)return null;if(s[1]){var a=this.$findClosingBracket(s[1],e);if(!a)return null;t=r.fromPoints(e,a),!i&&(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(s[2],e);if(!a)return null;t=r.fromPoints(a,e),!i&&(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(e,t){var n=this.getLine(e.row),i=/([\(\[\{])|([\)\]\}])/,o=!t&&n.charAt(e.column-1),s=o&&o.match(i);if(s||(o=(void 0===t||t)&&n.charAt(e.column),e={row:e.row,column:e.column+1},s=o&&o.match(i)),!s)return null;var a=new r(e.row,e.column-1,e.row,e.column),l=s[1]?this.$findClosingBracket(s[1],e):this.$findOpeningBracket(s[2],e);return l?[a,new r(l.row,l.column,l.row,l.column+1)]:[a]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,n){var r=this.$brackets[e],o=1,s=new i(this,t.row,t.column),a=s.getCurrentToken();if(a||(a=s.stepForward()),a){n||(n=RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var l=t.column-s.getCurrentTokenColumn()-2,c=a.value;;){for(;l>=0;){var u=c.charAt(l);if(u==r){if(0==(o-=1))return{row:s.getCurrentTokenRow(),column:l+s.getCurrentTokenColumn()}}else u==e&&(o+=1);l-=1}do a=s.stepBackward();while(a&&!n.test(a.type));if(null==a)break;l=(c=a.value).length-1}return null}},this.$findClosingBracket=function(e,t,n){var r=this.$brackets[e],o=1,s=new i(this,t.row,t.column),a=s.getCurrentToken();if(a||(a=s.stepForward()),a){n||(n=RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var l=t.column-s.getCurrentTokenColumn();;){for(var c=a.value,u=c.length;l<u;){var d=c.charAt(l);if(d==r){if(0==(o-=1))return{row:s.getCurrentTokenRow(),column:l+s.getCurrentTokenColumn()}}else d==e&&(o+=1);l+=1}do a=s.stepForward();while(a&&!n.test(a.type));if(null==a)break;l=0}return null}},this.getMatchingTags=function(e){var t=new i(this,e.row,e.column),n=this.$findTagName(t);if(n){var r=t.stepBackward();return"<"===r.value?this.$findClosingTag(t,n):this.$findOpeningTag(t,n)}},this.$findTagName=function(e){var t=e.getCurrentToken(),n=!1,i=!1;if(t&&-1===t.type.indexOf("tag-name"))do(t=i?e.stepBackward():e.stepForward())&&("/>"===t.value?i=!0:-1!==t.type.indexOf("tag-name")&&(n=!0));while(t&&!n);return t},this.$findClosingTag=function(e,t){var n,i=t.value,o=t.value,s=0,a=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);t=e.stepForward();var l=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length),c=!1;do{if(-1!==(n=t).type.indexOf("tag-close")&&!c){var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);c=!0}if(t=e.stepForward()){if(">"===t.value&&!c){var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);c=!0}if(-1!==t.type.indexOf("tag-name")){if(o===(i=t.value)){if("<"===n.value)s++;else if("</"===n.value&&--s<0){e.stepBackward();var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);t=e.stepForward();var h=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length);if(-1===t.type.indexOf("tag-close")&&(t=e.stepForward()),!t||">"!==t.value)return;var p=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(o===i&&"/>"===t.value&&--s<0)var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),h=d,p=h,u=new r(l.end.row,l.end.column,l.end.row,l.end.column+1)}}while(t&&s>=0);if(a&&u&&d&&p&&l&&h)return{openTag:new r(a.start.row,a.start.column,u.end.row,u.end.column),closeTag:new r(d.start.row,d.start.column,p.end.row,p.end.column),openTagName:l,closeTagName:h}},this.$findOpeningTag=function(e,t){var n=e.getCurrentToken(),i=t.value,o=0,s=e.getCurrentTokenRow(),a=e.getCurrentTokenColumn(),l=a+2,c=new r(s,a,s,l);e.stepForward();var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length);if(-1===t.type.indexOf("tag-close")&&(t=e.stepForward()),t&&">"===t.value){var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);e.stepBackward(),e.stepBackward();do if(t=n,s=e.getCurrentTokenRow(),l=(a=e.getCurrentTokenColumn())+t.value.length,n=e.stepBackward(),t){if(-1!==t.type.indexOf("tag-name")){if(i===t.value)if("<"===n.value){if(++o>0){var h=new r(s,a,s,l),p=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do t=e.stepForward();while(t&&">"!==t.value);var f=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===n.value&&o--}else if("/>"===t.value){for(var g=0,m=n;m;){if(-1!==m.type.indexOf("tag-name")&&m.value===i){o--;break}if("<"===m.value)break;m=e.stepBackward(),g++}for(var v=0;v<g;v++)e.stepForward()}}while(n&&o<=0);if(p&&f&&c&&d&&h&&u)return{openTag:new r(p.start.row,p.start.column,f.end.row,f.end.column),closeTag:new r(c.start.row,c.start.column,d.end.row,d.end.column),openTagName:h,closeTagName:u}}}}}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/lang"),o=e("./bidihandler").BidiHandler,s=e("./config"),a=e("./lib/event_emitter").EventEmitter,l=e("./selection").Selection,c=e("./mode/text").Mode,u=e("./range").Range,d=e("./document").Document,h=e("./background_tokenizer").BackgroundTokenizer,p=e("./search_highlight").SearchHighlight,f=e("./undomanager").UndoManager,g=function(){function e(t,n){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.prevOp={},this.$foldData=[],this.id="session"+ ++e.$uid,this.$foldData.toString=function(){return this.join("\n")},this.bgTokenizer=new h(new c().getTokenizer(),this);var i=this;this.bgTokenizer.on("update",function(e){i._signal("tokenizerUpdate",e)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof t&&t.getLine||(t=new d(t)),this.setDocument(t),this.selection=new l(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new o(this),s.resetOptions(this),this.setMode(n),s._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return e.prototype.$initOperationListeners=function(){var e=this;this.curOp=null,this.on("change",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.docChanged=!0},!0),this.on("changeSelection",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.selectionChanged=!0},!0),this.$operationResetTimer=r.delayedCall(this.endOperation.bind(this,!0))},e.prototype.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(e={}),this.$operationResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",e)},e.prototype.endOperation=function(e){if(this.curOp){if(e&&!1===e.returnValue){this.curOp=null,this._signal("endOperation",e);return}if(!0!=e||!this.curOp.command||"mouse"!=this.curOp.command.name){var t=this.selection.toJSON();this.curOp.selectionAfter=t,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(t),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",e)}}},e.prototype.setDocument=function(e){this.doc&&this.doc.off("change",this.$onChange),this.doc=e,e.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},e.prototype.getDocument=function(){return this.doc},e.prototype.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},e.prototype.$getRowCacheIndex=function(e,t){for(var n=0,i=e.length-1;n<=i;){var r=n+i>>1,o=e[r];if(t>o)n=r+1;else{if(!(t<o))return r;i=r-1}}return n-1},e.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},e.prototype.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},e.prototype.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},e.prototype.onSelectionChange=function(){this._signal("changeSelection")},e.prototype.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},e.fromJSON=function(t){"string"==typeof t&&(t=JSON.parse(t));var n=new f;n.$undoStack=t.history.undo,n.$redoStack=t.history.redo,n.mark=t.history.mark,n.$rev=t.history.rev;var i=new e(t.value);return t.folds.forEach(function(e){i.addFold("...",u.fromPoints(e.start,e.end))}),i.setAnnotations(t.annotations),i.setBreakpoints(t.breakpoints),i.setMode(t.mode),i.setScrollLeft(t.scrollLeft),i.setScrollTop(t.scrollTop),i.setUndoManager(n),i.selection.fromJSON(t.selection),i},e.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(e){return e.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},e.prototype.toString=function(){return this.doc.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.getState=function(e){return this.bgTokenizer.getState(e)},e.prototype.getTokens=function(e){return this.bgTokenizer.getTokens(e)},e.prototype.getTokenAt=function(e,t){var n,i=this.bgTokenizer.getTokens(e),r=0;if(null==t){var o=i.length-1;r=this.getLine(e).length}else for(var o=0;o<i.length&&!((r+=i[o].value.length)>=t);o++);return(n=i[o])?(n.index=o,n.start=r-n.value.length,n):null},e.prototype.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=r.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},e.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},e.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},e.prototype.getTabString=function(){return this.getUseSoftTabs()?r.stringRepeat(" ",this.getTabSize()):" "},e.prototype.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},e.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},e.prototype.setTabSize=function(e){this.setOption("tabSize",e)},e.prototype.getTabSize=function(){return this.$tabSize},e.prototype.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},e.prototype.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},e.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},e.prototype.setOverwrite=function(e){this.setOption("overwrite",e)},e.prototype.getOverwrite=function(){return this.$overwrite},e.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},e.prototype.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},e.prototype.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},e.prototype.getBreakpoints=function(){return this.$breakpoints},e.prototype.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},e.prototype.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.addMarker=function(e,t,n,i){var r=this.$markerId++,o={range:e,type:n||"line",renderer:"function"==typeof n?n:null,clazz:t,inFront:!!i,id:r};return i?(this.$frontMarkers[r]=o,this._signal("changeFrontMarker")):(this.$backMarkers[r]=o,this._signal("changeBackMarker")),r},e.prototype.addDynamicMarker=function(e,t){if(e.update){var n=this.$markerId++;return e.id=n,e.inFront=!!t,t?(this.$frontMarkers[n]=e,this._signal("changeFrontMarker")):(this.$backMarkers[n]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var n=t.inFront?this.$frontMarkers:this.$backMarkers;delete n[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")}},e.prototype.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},e.prototype.highlight=function(e){if(!this.$searchHighlight){var t=new p(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,t,n,i){"number"!=typeof t&&(n=t,t=e),n||(n="ace_step");var r=new u(e,0,t,1/0);return r.id=this.addMarker(r,n,"fullLine",i),r},e.prototype.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},e.prototype.getAnnotations=function(){return this.$annotations||[]},e.prototype.clearAnnotations=function(){this.setAnnotations([])},e.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);t?this.$autoNewLine=t[1]:this.$autoNewLine="\n"},e.prototype.getWordRange=function(e,t){var n=this.getLine(e),i=!1;if(t>0&&(i=!!n.charAt(t-1).match(this.tokenRe)),i||(i=!!n.charAt(t).match(this.tokenRe)),i)var r=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var r=/\s/;else var r=this.nonTokenRe;var o=t;if(o>0){do o--;while(o>=0&&n.charAt(o).match(r));o++}for(var s=t;s<n.length&&n.charAt(s).match(r);)s++;return new u(e,o,e,s)},e.prototype.getAWordRange=function(e,t){for(var n=this.getWordRange(e,t),i=this.getLine(n.end.row);i.charAt(n.end.column).match(/[ \t]/);)n.end.column+=1;return n},e.prototype.setNewLineMode=function(e){this.doc.setNewLineMode(e)},e.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},e.prototype.setUseWorker=function(e){this.setOption("useWorker",e)},e.prototype.getUseWorker=function(){return this.$useWorker},e.prototype.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},e.prototype.setMode=function(e,t){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var n=e,i=n.path}else i=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new c),this.$modes[i]&&!n){this.$onChangeMode(this.$modes[i]),t&&t();return}this.$modeId=i,s.loadModule(["mode",i],(function(e){if(this.$modeId!==i)return t&&t();this.$modes[i]&&!n?this.$onChangeMode(this.$modes[i]):e&&e.Mode&&(e=new e.Mode(n),n||(this.$modes[i]=e,e.$id=i),this.$onChangeMode(e)),t&&t()}).bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},e.prototype.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){var n=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var i=e.getTokenizer();if(void 0!==i.on){var r=this.onReloadTokenizer.bind(this);i.on("update",r)}this.bgTokenizer.setTokenizer(i),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:n,mode:e}))}},e.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},e.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){s.warn("Could not load worker",e),this.$worker=null}},e.prototype.getMode=function(){return this.$mode},e.prototype.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},e.prototype.getScrollTop=function(){return this.$scrollTop},e.prototype.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},e.prototype.getScrollLeft=function(){return this.$scrollLeft},e.prototype.getScreenWidth=function(){return(this.$computeWidth(),this.lineWidgets)?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},e.prototype.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},e.prototype.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),n=this.$rowLengthCache,i=0,r=0,o=this.$foldData[r],s=o?o.start.row:1/0,a=t.length,l=0;l<a;l++){if(l>s){if((l=o.end.row+1)>=a)break;s=(o=this.$foldData[r++])?o.start.row:1/0}null==n[l]&&(n[l]=this.$getStringScreenWidth(t[l])[0]),n[l]>i&&(i=n[l])}this.screenWidth=i}},e.prototype.getLine=function(e){return this.doc.getLine(e)},e.prototype.getLines=function(e,t){return this.doc.getLines(e,t)},e.prototype.getLength=function(){return this.doc.getLength()},e.prototype.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},e.prototype.insert=function(e,t){return this.doc.insert(e,t)},e.prototype.remove=function(e){return this.doc.remove(e)},e.prototype.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},e.prototype.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var n=e.length-1;-1!=n;n--){var i=e[n];"insert"==i.action||"remove"==i.action?this.doc.revertDelta(i):i.folds&&this.addFolds(i.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},e.prototype.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var n=0;n<e.length;n++){var i=e[n];("insert"==i.action||"remove"==i.action)&&this.doc.$safeApplyDelta(i)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},e.prototype.setUndoSelect=function(e){this.$undoSelect=e},e.prototype.$getUndoSelection=function(e,t){function n(e){return t?"insert"!==e.action:"insert"===e.action}for(var i,r,o=0;o<e.length;o++){var s=e[o];if(s.start){if(!i){i=n(s)?u.fromPoints(s.start,s.end):u.fromPoints(s.start,s.start);continue}n(s)?(r=s.start,-1==i.compare(r.row,r.column)&&i.setStart(r),r=s.end,1==i.compare(r.row,r.column)&&i.setEnd(r)):(r=s.start,-1==i.compare(r.row,r.column)&&(i=u.fromPoints(s.start,s.start)))}}return i},e.prototype.replace=function(e,t){return this.doc.replace(e,t)},e.prototype.moveText=function(e,t,n){var i=this.getTextRange(e),r=this.getFoldsInRange(e),o=u.fromPoints(t,t);if(!n){this.remove(e);var s=e.start.row-e.end.row,a=s?-e.end.column:e.start.column-e.end.column;a&&(o.start.row==e.end.row&&o.start.column>e.end.column&&(o.start.column+=a),o.end.row==e.end.row&&o.end.column>e.end.column&&(o.end.column+=a)),s&&o.start.row>=e.end.row&&(o.start.row+=s,o.end.row+=s)}if(o.end=this.insert(o.start,i),r.length){var l=e.start,c=o.start,s=c.row-l.row,a=c.column-l.column;this.addFolds(r.map(function(e){return(e=e.clone()).start.row==l.row&&(e.start.column+=a),e.end.row==l.row&&(e.end.column+=a),e.start.row+=s,e.end.row+=s,e}))}return o},e.prototype.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var i=e;i<=t;i++)this.doc.insertInLine({row:i,column:0},n)},e.prototype.outdentRows=function(e){for(var t=e.collapseRows(),n=new u(0,0,0,0),i=this.getTabSize(),r=t.start.row;r<=t.end.row;++r){var o=this.getLine(r);n.start.row=r,n.end.row=r;for(var s=0;s<i&&" "==o.charAt(s);++s);s<i&&" "==o.charAt(s)?(n.start.column=s,n.end.column=s+1):(n.start.column=0,n.end.column=s),this.remove(n)}},e.prototype.$moveLines=function(e,t,n){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),n<0){var i=this.getRowFoldStart(e+n);if(i<0)return 0;var r=i-e}else if(n>0){var i=this.getRowFoldEnd(t+n);if(i>this.doc.getLength()-1)return 0;var r=i-t}else{e=this.$clipRowToDocument(e);var r=(t=this.$clipRowToDocument(t))-e+1}var o=new u(e,0,t,Number.MAX_VALUE),s=this.getFoldsInRange(o).map(function(e){return e=e.clone(),e.start.row+=r,e.end.row+=r,e}),a=0==n?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+r,a),s.length&&this.addFolds(s),r},e.prototype.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},e.prototype.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},e.prototype.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},e.prototype.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},e.prototype.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},e.prototype.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},e.prototype.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},e.prototype.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},e.prototype.getUseWrapMode=function(){return this.$useWrapMode},e.prototype.setWrapLimitRange=function(e,t){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)&&(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},e.prototype.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var i=this.$constrainWrapLimit(e,n.min,n.max);return i!=this.$wrapLimit&&i>1&&(this.$wrapLimit=i,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},e.prototype.getWrapLimit=function(){return this.$wrapLimit},e.prototype.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},e.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},e.prototype.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,i=e.start,r=e.end,o=i.row,s=r.row,a=s-o,l=null;if(this.$updating=!0,0!=a)if("remove"===n){this[t?"$wrapData":"$rowLengthCache"].splice(o,a);var c=this.$foldData;l=this.getFoldsInRange(e),this.removeFolds(l);var u=this.getFoldLine(r.row),d=0;if(u){u.addRemoveChars(r.row,r.column,i.column-r.column),u.shiftRow(-a);var h=this.getFoldLine(o);h&&h!==u&&(h.merge(u),u=h),d=c.indexOf(u)+1}for(;d<c.length;d++){var u=c[d];u.start.row>=r.row&&u.shiftRow(-a)}s=o}else{var p=Array(a);p.unshift(o,0);var f=t?this.$wrapData:this.$rowLengthCache;f.splice.apply(f,p);var c=this.$foldData,u=this.getFoldLine(o),d=0;if(u){var g=u.range.compareInside(i.row,i.column);0==g?(u=u.split(i.row,i.column))&&(u.shiftRow(a),u.addRemoveChars(s,0,r.column-i.column)):-1==g&&(u.addRemoveChars(o,0,r.column-i.column),u.shiftRow(a)),d=c.indexOf(u)+1}for(;d<c.length;d++){var u=c[d];u.start.row>=o&&u.shiftRow(a)}}else{a=Math.abs(e.start.column-e.end.column),"remove"===n&&(l=this.getFoldsInRange(e),this.removeFolds(l),a=-a);var u=this.getFoldLine(o);u&&u.addRemoveChars(o,i.column,a)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(o,s):this.$updateRowLengthCache(o,s),l},e.prototype.$updateRowLengthCache=function(e,t){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},e.prototype.$updateWrapData=function(e,t){var n,i,r=this.doc.getAllLines(),o=this.getTabSize(),s=this.$wrapData,a=this.$wrapLimit,l=e;for(t=Math.min(t,r.length-1);l<=t;)(i=this.getFoldLine(l,i))?(n=[],i.walk((function(e,t,i,o){var s;if(null!=e){(s=this.$getDisplayTokens(e,n.length))[0]=b;for(var a=1;a<s.length;a++)s[a]=y}else s=this.$getDisplayTokens(r[t].substring(o,i),n.length);n=n.concat(s)}).bind(this),i.end.row,r[i.end.row].length+1),s[i.start.row]=this.$computeWrapSplits(n,a,o),l=i.end.row+1):(n=this.$getDisplayTokens(r[l]),s[l]=this.$computeWrapSplits(n,a,o),l++)},e.prototype.$computeWrapSplits=function(e,t,n){if(0==e.length)return[];var i=[],r=e.length,o=0,s=0,a=this.$wrapAsCode,l=this.$indentedSoftWrap,c=t<=Math.max(2*n,8)||!1===l?0:Math.floor(t/2);function u(){var t=0;if(0===c)return t;if(l)for(var i=0;i<e.length;i++){var r=e[i];if(r==x)t+=1;else if(r==$)t+=n;else if(r==_)continue;else break}return a&&!1!==l&&(t+=n),Math.min(t,c)}function d(t){for(var n=t-o,r=o;r<t;r++){var a=e[r];(12===a||2===a)&&(n-=1)}i.length||(i.indent=h=u()),s+=n,i.push(s),o=t}for(var h=0;r-o>t-h;){var p=o+t-h;if(e[p-1]>=x&&e[p]>=x){d(p);continue}if(e[p]==b||e[p]==y){for(;p!=o-1&&e[p]!=b;p--);if(p>o){d(p);continue}for(p=o+t;p<e.length&&e[p]==y;p++);if(p==e.length)break;d(p);continue}for(var f=Math.max(p-(t-(t>>2)),o-1);p>f&&e[p]<b;)p--;if(a){for(;p>f&&e[p]<b;)p--;for(;p>f&&e[p]==w;)p--}else for(;p>f&&e[p]<x;)p--;if(p>f){d(++p);continue}e[p=o+t]==v&&p--,d(p-h)}return i},e.prototype.$getDisplayTokens=function(e,t){var n,i=[];t=t||0;for(var r=0;r<e.length;r++){var o=e.charCodeAt(r);if(9==o){n=this.getScreenTabSize(i.length+t),i.push($);for(var s=1;s<n;s++)i.push(_)}else 32==o?i.push(x):o>39&&o<48||o>57&&o<64?i.push(w):o>=4352&&S(o)?i.push(m,v):i.push(m)}return i},e.prototype.$getStringScreenWidth=function(e,t,n){var i,r;if(0==t)return[0,0];for(null==t&&(t=1/0),n=n||0,r=0;r<e.length&&(9==(i=e.charCodeAt(r))?n+=this.getScreenTabSize(n):i>=4352&&S(i)?n+=2:n+=1,!(n>t));r++);return[n,r]},e.prototype.getRowLength=function(e){var t=1;return(this.lineWidgets&&(t+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+t:t},e.prototype.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},e.prototype.getRowWrapIndent=function(e){if(!this.$useWrapMode)return 0;var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]<t.column?n.indent:0},e.prototype.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},e.prototype.getDocumentLastRowColumn=function(e,t){var n=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(n)},e.prototype.getDocumentLastRowColumnPosition=function(e,t){var n=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(n,Number.MAX_VALUE/10)},e.prototype.getRowSplitData=function(e){if(this.$useWrapMode)return this.$wrapData[e]},e.prototype.getScreenTabSize=function(e){return this.$tabSize-(e%this.$tabSize|0)},e.prototype.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},e.prototype.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},e.prototype.screenToDocumentPosition=function(e,t,n){if(e<0)return{row:0,column:0};var i,r,o=0,s=0,a=0,l=0,c=this.$screenRowCache,u=this.$getRowCacheIndex(c,e),d=c.length;if(d&&u>=0)var a=c[u],o=this.$docRowCache[u],h=e>c[d-1];else var h=!d;for(var p=this.getLength()-1,f=this.getNextFoldLine(o),g=f?f.start.row:1/0;a<=e&&!(a+(l=this.getRowLength(o))>e)&&!(o>=p);)a+=l,++o>g&&(o=f.end.row+1,g=(f=this.getNextFoldLine(o,f))?f.start.row:1/0),h&&(this.$docRowCache.push(o),this.$screenRowCache.push(a));if(f&&f.start.row<=o)i=this.getFoldDisplayLine(f),o=f.start.row;else{if(a+l<=e||o>p)return{row:p,column:this.getLine(p).length};i=this.getLine(o),f=null}var m=0,v=Math.floor(e-a);if(this.$useWrapMode){var b=this.$wrapData[o];b&&(r=b[v],v>0&&b.length&&(m=b.indent,s=b[v-1]||b[b.length-1],i=i.substring(s)))}return(void 0!==n&&this.$bidiHandler.isBidiRow(a+v,o,v)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(i,t-m)[1],this.$useWrapMode&&s>=r&&(s=r-1),f)?f.idxToPosition(s):{row:o,column:s}},e.prototype.documentToScreenPosition=function(e,t){if(void 0===t)var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var i=0,r=null,o=null;(o=this.getFoldAt(e,t,1))&&(e=o.start.row,t=o.start.column);var s,a=0,l=this.$docRowCache,c=this.$getRowCacheIndex(l,e),u=l.length;if(u&&c>=0)var a=l[c],i=this.$screenRowCache[c],d=e>l[u-1];else var d=!u;for(var h=this.getNextFoldLine(a),p=h?h.start.row:1/0;a<e;){if(a>=p){if((s=h.end.row+1)>e)break;p=(h=this.getNextFoldLine(s,h))?h.start.row:1/0}else s=a+1;i+=this.getRowLength(a),a=s,d&&(this.$docRowCache.push(a),this.$screenRowCache.push(i))}var f="";h&&a>=p?(f=this.getFoldDisplayLine(h,e,t),r=h.start.row):(f=this.getLine(e).substring(0,t),r=e);var g=0;if(this.$useWrapMode){var m=this.$wrapData[r];if(m){for(var v=0;f.length>=m[v];)i++,v++;f=f.substring(m[v-1]||0,f.length),g=v>0?m.indent:0}}return this.lineWidgets&&this.lineWidgets[a]&&this.lineWidgets[a].rowsAbove&&(i+=this.lineWidgets[a].rowsAbove),{row:i,column:g+this.$getStringScreenWidth(f)[0]}},e.prototype.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},e.prototype.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},e.prototype.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode)for(var n=this.$wrapData.length,i=0,r=0,t=this.$foldData[r++],o=t?t.start.row:1/0;i<n;){var s=this.$wrapData[i];e+=s?s.length+1:1,++i>o&&(i=t.end.row+1,o=(t=this.$foldData[r++])?t.start.row:1/0)}else{e=this.getLength();for(var a=this.$foldData,r=0;r<a.length;r++)e-=(t=a[r]).end.row-t.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},e.prototype.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(t,n,i){var r,o;if(0===n)return[0,0];for(n||(n=1/0),i=i||0,o=0;o<t.length&&(" "===(r=t.charAt(o))?i+=this.getScreenTabSize(i):i+=e.getCharacterWidth(r),!(i>n));o++);return[i,o]})},e.prototype.getPrecedingCharacter=function(){var e=this.selection.getCursor();return 0===e.column?0===e.row?"":this.doc.getNewLineCharacter():this.getLine(e.row)[e.column-1]},e.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},e}();g.$uid=0,g.prototype.$modes=s.$modes,g.prototype.getValue=g.prototype.toString,g.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},g.prototype.$overwrite=!1,g.prototype.$mode=null,g.prototype.$modeId=null,g.prototype.$scrollTop=0,g.prototype.$scrollLeft=0,g.prototype.$wrapLimit=80,g.prototype.$useWrapMode=!1,g.prototype.$wrapLimitRange={min:null,max:null},g.prototype.lineWidgets=null,g.prototype.isFullWidth=S,i.implement(g.prototype,a);var m=1,v=2,b=3,y=4,w=9,x=10,$=11,_=12;function S(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}e("./edit_session/folding").Folding.call(g.prototype),e("./edit_session/bracket_match").BracketMatch.call(g.prototype),s.defineOptions(g.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){(e="auto"==e?"text"!=this.$mode.type:"text"!=e)!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){(e=parseInt(e))>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=g}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var i=e("./lib/lang"),r=e("./lib/oop"),o=e("./range").Range;function s(e,t){var n=i.supportsLookbehind();function r(e,i){if(void 0===i&&(i=!0),(n&&t.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||t.regExp)return n&&t.$supportsUnicodeFlag?i?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var o=Array.from(e),s=o[0],a=o[o.length-1];return r(s)+e+r(a,!1)}t.Search=function(){function e(){this.$options={}}return e.prototype.set=function(e){return r.mixin(this.$options,e),this},e.prototype.getOptions=function(){return i.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var i=null;return n.forEach(function(e,n,r,s){return i=new o(e,n,r,s),!(n==s&&t.start&&t.start.start&&!1!=t.skipCurrent&&i.isEqual(t.start))||(i=null,!1)}),i},e.prototype.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,r=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),s=[],a=t.re;if(t.$isMultiLine){var l,c=a.length,u=r.length-c;e:for(var d=a.offset||0;d<=u;d++){for(var h=0;h<c;h++)if(-1==r[d+h].search(a[h]))continue e;var p=r[d],f=r[d+c-1],g=p.length-p.match(a[0])[0].length,m=f.match(a[c-1])[0].length;l&&l.end.row===d&&l.end.column>g||(s.push(l=new o(d,g,d+c-1,m)),c>2&&(d=d+c-2))}}else for(var v=0;v<r.length;v++)for(var b=i.getMatchOffsets(r[v],a),h=0;h<b.length;h++){var y=b[h];s.push(new o(v,y.offset,v,y.offset+y.length))}if(n){for(var w=n.start.column,x=n.end.column,v=0,h=s.length-1;v<h&&s[v].start.column<w&&0==s[v].start.row;)v++;for(var $=n.end.row-n.start.row;v<h&&s[h].end.column>x&&s[h].end.row==$;)h--;for(s=s.slice(v,h+1),v=0,h=s.length;v<h;v++)s[v].start.row+=n.start.row,s[v].end.row+=n.start.row}return s},e.prototype.replace=function(e,t){var n=this.$options,i=this.$assembleRegExp(n);if(n.$isMultiLine)return t;if(i){var r=i.exec(e);if(!r||r[0].length!=e.length)return null;if(n.regExp||(t=t.replace(/\$/g,"$$$$")),t=e.replace(i,t),n.preserveCase){t=t.split("");for(var o=Math.min(e.length,e.length);o--;){var s=e[o];s&&s.toLowerCase()!=s?t[o]=t[o].toUpperCase():t[o]=t[o].toLowerCase()}t=t.join("")}return t}},e.prototype.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=i.escapeRegExp(n));var r=e.caseSensitive?"gm":"gmi";try{RegExp(n,"u"),e.$supportsUnicodeFlag=!0,r+="u"}catch(t){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(n=s(n,e)),e.$isMultiLine=!t&&/[\n\r]/.test(n),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,r);try{var o=new RegExp(n,r)}catch(e){o=!1}return e.re=o},e.prototype.$assembleMultilineRegExp=function(e,t){for(var n=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),i=[],r=0;r<n.length;r++)try{i.push(new RegExp(n[r],t))}catch(e){return!1}return i},e.prototype.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r=!0==t.backwards,o=!1!=t.skipCurrent,s=n.unicode,a=t.range,l=t.start;l||(l=a?a[r?"end":"start"]:e.selection.getRange()),l.start&&(l=l[o!=r?"end":"start"]);var c=a?a.start.row:0,u=a?a.end.row:e.getLength()-1;if(r)var d=function(e){var n=l.row;if(!p(n,l.column,e)){for(n--;n>=c;n--)if(p(n,Number.MAX_VALUE,e))return;if(!1!=t.wrap){for(n=u,c=l.row;n>=c;n--)if(p(n,Number.MAX_VALUE,e))return}}};else var d=function(e){var n=l.row;if(!p(n,l.column,e)){for(n+=1;n<=u;n++)if(p(n,0,e))return;if(!1!=t.wrap){for(n=c,u=l.row;n<=u;n++)if(p(n,0,e))return}}};if(t.$isMultiLine)var h=n.length,p=function(t,i,o){var s=r?t-h+1:t;if(!(s<0||s+h>e.getLength())){var a=e.getLine(s),l=a.search(n[0]);if((r||!(l<i))&&-1!==l){for(var c=1;c<h;c++)if(-1==(a=e.getLine(s+c)).search(n[c]))return;var u=a.match(n[h-1])[0].length;if((!r||!(u>i))&&o(s,l,s+h-1,u))return!0}}};else if(r)var p=function(t,r,o){var a,l=e.getLine(t),c=[],u=0;for(n.lastIndex=0;a=n.exec(l);){var d=a[0].length;if(u=a.index,!d){if(u>=l.length)break;n.lastIndex=u+=i.skipEmptyMatch(l,u,s)}if(a.index+d>r)break;c.push(a.index,d)}for(var h=c.length-1;h>=0;h-=2){var p=c[h-1],d=c[h];if(o(t,p,t,p+d))return!0}};else var p=function(t,r,o){var a,l,c=e.getLine(t);for(n.lastIndex=r;l=n.exec(c);){var u=l[0].length;if(o(t,a=l.index,t,a+u))return!0;if(!u&&(n.lastIndex=a+=i.skipEmptyMatch(c,a,s),a>=c.length))return!1}};return{forEach:d}},e}()}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("../lib/keys"),o=e("../lib/useragent"),s=r.KEY_MODS,a=function(){function e(e,t){this.$init(e,t,!1)}return e.prototype.$init=function(e,t,n){this.platform=t||(o.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=n},e.prototype.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},e.prototype.removeCommand=function(e,t){var n=e&&("string"==typeof e?e:e.name);e=this.commands[n],t||delete this.commands[n];var i=this.commandKeyBinding;for(var r in i){var o=i[r];if(o==e)delete i[r];else if(Array.isArray(o)){var s=o.indexOf(e);-1!=s&&(o.splice(s,1),1==o.length&&(i[r]=o[0]))}}},e.prototype.bindKey=function(e,t,n){if("object"==typeof e&&e&&(void 0==n&&(n=e.position),e=e[this.platform]),e){if("function"==typeof t)return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var i="";if(-1!=e.indexOf(" ")){var r=e.split(/\s+/);e=r.pop(),r.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;i+=(i?" ":"")+n,this._addCommandToBinding(i,"chainKeys")},this),i+=" "}var o=this.parseKeys(e),a=s[o.hashId]+o.key;this._addCommandToBinding(i+a,t,n)},this)}},e.prototype._addCommandToBinding=function(e,t,n){var i,r=this.commandKeyBinding;if(t)if(!r[e]||this.$singleCommand)r[e]=t;else{Array.isArray(r[e])?-1!=(i=r[e].indexOf(t))&&r[e].splice(i,1):r[e]=[r[e]],"number"!=typeof n&&(n=l(t));var o=r[e];for(i=0;i<o.length&&!(l(o[i])>n);i++);o.splice(i,0,t)}else delete r[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(n){if("string"==typeof n)return this.bindKey(n,t);"function"==typeof n&&(n={exec:n}),"object"==typeof n&&(n.name||(n.name=t),this.addCommand(n))}},this)},e.prototype.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},e.prototype.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},e.prototype._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},e.prototype.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else if(!t.length)return{key:n,hashId:-1};else if(1==t.length&&"shift"==t[0])return{key:n.toUpperCase(),hashId:-1};for(var o=0,s=t.length;s--;){var a=r.KEY_MODS[t[s]];if(null==a)return"u">typeof console&&console.error("invalid modifier "+t[s]+" in "+e),!1;o|=a}return{key:n,hashId:o}},e.prototype.findKeyCommand=function(e,t){var n=s[e]+t;return this.commandKeyBinding[n]},e.prototype.handleKeyboard=function(e,t,n,i){if(!(i<0)){var r=s[t]+n,o=this.commandKeyBinding[r];return(e.$keyChain&&(e.$keyChain+=" "+r,o=this.commandKeyBinding[e.$keyChain]||o),o&&("chainKeys"==o||"chainKeys"==o[o.length-1]))?(e.$keyChain=e.$keyChain||r,{command:"null"}):(e.$keyChain&&(t&&4!=t||1!=n.length?(-1==t||i>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-r.length-1)),{command:o})}},e.prototype.getStatusText=function(e,t){return t.$keyChain||""},e}();function l(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var c=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.$singleCommand=!0,i}return i(t,e),t}(a);c.call=function(e,t,n){a.prototype.$init.call(e,t,n,!0)},a.call=function(e,t,n){a.prototype.$init.call(e,t,n,!1)},t.HashHandler=c,t.MultiHashHandler=a}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("../lib/oop"),o=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,a=function(e){function t(t,n){var i=e.call(this,n,t)||this;return i.byName=i.commands,i.setDefaultHandler("exec",function(e){return e.args?e.command.exec(e.editor,e.args,e.event,!1):e.command.exec(e.editor,{},e.event,!0)}),i}return i(t,e),t.prototype.exec=function(e,t,n){if(Array.isArray(e)){for(var i=e.length;i--;)if(this.exec(e[i],t,n))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!this.canExecute(e,t))return!1;var r={editor:t,command:e,args:n};return r.returnValue=this._emit("exec",r),this._signal("afterExec",r),!1!==r.returnValue},t.prototype.canExecute=function(e,t){return"string"==typeof e&&(e=this.commands[e]),!!e&&(!t||!t.$readOnly||!!e.readOnly)&&(!1==this.$checkCommandState||!e.isAvailable||!!e.isAvailable(t))},t.prototype.toggleRecording=function(e){if(!this.$inReplay)return(e&&e._emit("changeStatus"),this.recording)?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(e){this.macro.push([e.command,e.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},t.prototype.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})},t}(o);r.implement(a.prototype,s),t.CommandManager=a}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";var i=e("../lib/lang"),r=e("../config"),o=e("../range").Range;function s(e,t){return{win:e,mac:t}}t.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:s("Ctrl-,","Command-,"),exec:function(e){r.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:s("Alt-E","F4"),exec:function(e){r.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:s("Alt-Shift-E","Shift-F4"),exec:function(e){r.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:s("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:s(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:s("Ctrl-L","Command-L"),exec:function(e,t){"number"!=typeof t||isNaN(t)||e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:s("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:s("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:s("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:s("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:s("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:s("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:s("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:s("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:s("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:s("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:s("Ctrl-F","Command-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:s("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:s("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:s("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:s("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:s("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:s("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:s("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:s("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:s("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:s("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:s("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:s("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:s("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:s("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:s("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:s("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:s("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:s("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:s("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:s("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:s(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:s("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:s(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:s("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:s("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:s("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:s("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:s("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:s("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:s("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:s(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty()?e.selection.getLineRange():e.selection.getRange();e._emit("cut",t),t.isEmpty()||e.session.remove(t),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:s("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:s("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:s("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:s("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:s("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:s("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:s("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:s("Ctrl-H","Command-Option-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:s("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:s("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:s("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:s("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:s("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:s("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:s("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:s("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:s("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:s("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:s("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:s("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:s("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:s("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:s("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:s("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:s("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:s("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:s("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(i.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:s(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:s("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:s("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:s("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:s(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:s("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:s("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:s(null,null),exec:function(e){for(var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),r=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),s=e.session.doc.getLine(n.row).length,a=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,l=e.session.doc.getLine(n.row),c=n.row+1;c<=r.row+1;c++){var u=i.stringTrimLeft(i.stringTrimRight(e.session.doc.getLine(c)));0!==u.length&&(u=" "+u),l+=u}r.row+1<e.session.doc.getLength()-1&&(l+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new o(n.row,0,r.row+2,0),l),a>0?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(s=e.session.doc.getLine(n.row).length>s?s+1:s,e.selection.moveCursorTo(n.row,s))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:s(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,i=e.selection.rangeList.ranges,r=[];i.length<1&&(i=[e.selection.getRange()]);for(var s=0;s<i.length;s++)s==i.length-1&&(i[s].end.row!==t||i[s].end.column!==n)&&r.push(new o(i[s].end.row,i[s].end.column,t,n)),0===s?(0!==i[s].start.row||0!==i[s].start.column)&&r.push(new o(0,0,i[s].start.row,i[s].start.column)):r.push(new o(i[s-1].end.row,i[s-1].end.column,i[s].start.row,i[s].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var s=0;s<r.length;s++)e.selection.addRange(r[s],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert("\n")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(e){e.selection.clearSelection();var t=e.getCursorPosition();e.selection.moveTo(t.row-1,Number.MAX_VALUE),e.insert("\n"),0===t.row&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:s("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:s(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var a=1;a<9;a++)t.commands.push({name:"foldToLevel"+a,description:"Fold To Level "+a,level:a,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./lib/dom");t.LineWidgets=function(){function e(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return e.prototype.getRowLength=function(e){var t;return(t=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+1+t:1+t},e.prototype.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},e.prototype.$onChangeEditor=function(e){this.attach(e.editor)},e.prototype.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},e.prototype.detach=function(e){var t=this.editor;if(t){this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},e.prototype.updateOnFold=function(e,t){var n=t.lineWidgets;if(n&&e.action){for(var i=e.data,r=i.start.row,o=i.end.row,s="add"==e.action,a=r+1;a<o;a++)n[a]&&(n[a].hidden=s);n[o]&&(s?n[r]?n[o].hidden=s:n[r]=n[o]:(n[r]==n[o]&&(n[r]=void 0),n[o].hidden=s))}},e.prototype.updateOnChange=function(e){var t=this.session.lineWidgets;if(t){var n=e.start.row,i=e.end.row-n;if(0===i);else if("remove"==e.action){var r=t.splice(n+1,i);!t[n]&&r[r.length-1]&&(t[n]=r.pop()),r.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var o=Array(i);t[n]&&null!=t[n].column&&e.start.column>t[n].column&&n++,o.unshift(n,0),t.splice.apply(t,o),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var t=!0;e.forEach(function(e,n){if(e)for(t=!1,e.row=n;e.$oldWidget;)e.$oldWidget.row=n,e=e.$oldWidget}),t&&(this.session.lineWidgets=null)}},e.prototype.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];return t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},e.prototype.addLineWidget=function(e){if(this.$registerLineWidget(e),e.session=this.session,!this.editor)return e;var t=this.editor.renderer;e.html&&!e.el&&(e.el=i.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=i.createElement("div"),e.el.textContent=e.text),e.el&&(i.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&i.addCssClass(e.el,e.className),e.el.style.position="absolute",e.el.style.zIndex="5",t.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex="3"),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight)),null==e.rowCount&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight);var n=this.session.getFoldAt(e.row,0);if(e.$fold=n,n){var r=this.session.lineWidgets;e.row!=n.end.row||r[n.start.row]?e.hidden=!0:r[n.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),this.onWidgetChanged(e),e},e.prototype.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(e){}if(this.session.lineWidgets){var t=this.session.lineWidgets[e.row];if(t==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else for(;t;){if(t.$oldWidget==e){t.$oldWidget=e.$oldWidget;break}t=t.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},e.prototype.getWidgetsAtRow=function(e){for(var t=this.session.lineWidgets,n=t&&t[e],i=[];n;)i.push(n),n=n.$oldWidget;return i},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,t){var n=this.session._changedWidgets,i=t.layerConfig;if(n&&n.length){for(var r=1/0,o=0;o<n.length;o++){var s=n[o];if(s&&s.el&&s.session==this.session){if(!s._inDocument){if(this.session.lineWidgets[s.row]!=s)continue;s._inDocument=!0,t.container.appendChild(s.el)}s.h=s.el.offsetHeight,s.fixedWidth||(s.w=s.el.offsetWidth,s.screenWidth=Math.ceil(s.w/i.characterWidth));var a=s.h/i.lineHeight;s.coverLine&&(a-=this.session.getRowLineCount(s.row))<0&&(a=0),s.rowCount!=a&&(s.rowCount=a,s.row<r&&(r=s.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},e.prototype.renderWidgets=function(e,t){var n=t.layerConfig,i=this.session.lineWidgets;if(i){for(var r=Math.min(this.firstRow,n.firstRow),o=Math.max(this.lastRow,n.lastRow,i.length);r>0&&!i[r];)r--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var s=r;s<=o;s++){var a=i[s];if(a&&a.el){if(a.hidden){a.el.style.top=-100-(a.pixelHeight||0)+"px";continue}a._inDocument||(a._inDocument=!0,t.container.appendChild(a.el));var l=t.$cursorLayer.getPixelPosition({row:s,column:0},!0).top;a.coverLine||(l+=n.lineHeight*this.session.getRowLineCount(a.row)),a.el.style.top=l-n.offset+"px";var c=a.coverGutter?0:t.gutterWidth;a.fixedWidth||(c-=t.scrollLeft),a.el.style.left=c+"px",a.fullWidth&&a.screenWidth&&(a.el.style.minWidth=n.width+2*n.padding+"px"),a.fixedWidth?a.el.style.right=t.scrollBar.getWidth()+"px":a.el.style.right=""}}}},e}()}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(e,t,n){"use strict";var i=e("../lib/keys"),r=e("../mouse/default_gutter_handler").GutterTooltip;t.GutterKeyboardHandler=function(){function e(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new r(this.editor)}return e.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},e.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},e.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===i.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=i.enter)return;e.preventDefault();var t=this.editor.getCursorPosition().row;this.editor.isRowVisible(t)||this.editor.scrollToLine(t,!0,!0),setTimeout((function(){var e=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),t=this.$findNearestFoldWidget(e),n=this.$findNearestAnnotation(e);if(null!==t||null!==n){if(null===t&&null!==n){this.activeRowIndex=n,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==t&&null===n){this.activeRowIndex=t,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(n-e)<Math.abs(t-e)){this.activeRowIndex=n,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}this.activeRowIndex=t,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}}).bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout((function(){this.editor._signal("gutterkeydown",new o(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===i.tab)return void e.preventDefault();if(e.keyCode===i.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===i.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===i.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===i.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===i.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===i.enter||e.keyCode===i.space){switch(e.preventDefault(),this.activeLane){case"fold":if("start"===this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]){var t=this.$rowIndexToRow(this.activeRowIndex);this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout((function(){this.$rowIndexToRow(this.activeRowIndex)!==t&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(t),this.$focusFoldWidget(this.activeRowIndex))}).bind(this),10);break}this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)];break;case"annotation":var n=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),r=this.annotationTooltip.getElement().style;r.left=n.right+"px",r.top=n.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex))}return}},e.prototype.$blurGutter=function(){if(null!==this.activeRowIndex)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex)}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},e.prototype.$isFoldWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),n="none"!==this.$getFoldWidget(e).style.display;return t&&n},e.prototype.$isAnnotationVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),n="none"!==this.$getAnnotation(e).style.display;return t&&n},e.prototype.$getFoldWidget=function(e){return this.lines.get(e).element.childNodes[1]},e.prototype.$getAnnotation=function(e){return this.lines.get(e).element.childNodes[2]},e.prototype.$findNearestFoldWidget=function(e){if(this.$isFoldWidgetVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(e-++t>=0&&this.$isFoldWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+t))return e+t}return null},e.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(e-++t>=0&&this.$isAnnotationVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+t))return e+t}return null},e.prototype.$focusFoldWidget=function(e){if(null!=e){var t=this.$getFoldWidget(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},e.prototype.$focusAnnotation=function(e){if(null!=e){var t=this.$getAnnotation(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},e.prototype.$blurFoldWidget=function(e){var t=this.$getFoldWidget(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},e.prototype.$blurAnnotation=function(e){var t=this.$getAnnotation(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},e.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$switchLane=function(e){switch(e){case"annotation":if("annotation"===this.activeLane)break;var t=this.$findNearestAnnotation(this.activeRowIndex);if(null==t)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=t,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if("fold"===this.activeLane)break;var n=this.$findNearestFoldWidget(this.activeRowIndex);if(null==n)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=n,this.$focusFoldWidget(this.activeRowIndex)}},e.prototype.$rowIndexToRow=function(e){var t=this.lines.get(e);return t?t.row:null},e.prototype.$rowToRowIndex=function(e){for(var t=0;t<this.lines.getLength();t++)if(this.lines.get(t).row==e)return t;return null},e}();var o=function(){function e(e,t){this.gutterKeyboardHandler=t,this.domEvent=e}return e.prototype.getKey=function(){return i.keyCodeToString(this.domEvent.keyCode)},e.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},e.prototype.isInAnnotationLane=function(){return"annotation"===this.gutterKeyboardHandler.activeLane},e.prototype.isInFoldLane=function(){return"fold"===this.gutterKeyboardHandler.activeLane},e}();t.GutterKeyboardEvent=o}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/line_widgets","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys"],function(e,t,n){"use strict";var i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/lang"),a=e("./lib/useragent"),l=e("./keyboard/textinput").TextInput,c=e("./mouse/mouse_handler").MouseHandler,u=e("./mouse/fold_handler").FoldHandler,d=e("./keyboard/keybinding").KeyBinding,h=e("./edit_session").EditSession,p=e("./search").Search,f=e("./range").Range,g=e("./lib/event_emitter").EventEmitter,m=e("./commands/command_manager").CommandManager,v=e("./commands/default_commands").commands,b=e("./config"),y=e("./token_iterator").TokenIterator,w=e("./line_widgets").LineWidgets,x=e("./keyboard/gutter_handler").GutterKeyboardHandler,$=e("./config").nls,_=e("./clipboard"),S=e("./lib/keys"),M=function(){function e(t,n,i){this.session,this.$toDestroy=[];var r=t.getContainerElement();this.container=r,this.renderer=t,this.id="editor"+ ++e.$uid,this.commands=new m(a.isMac?"mac":"win",v),"object"==typeof document&&(this.textInput=new l(t.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new c(this),new u(this)),this.keyBinding=new d(this),this.$search=new p().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(n||i&&i.session||new h("")),b.resetOptions(this),i&&this.setOptions(i),b._signal("editor",this)}return e.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},e.prototype.startOperation=function(e){this.session.startOperation(e)},e.prototype.endOperation=function(e){this.session.endOperation(e)},e.prototype.onStartOperation=function(e){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,e||(this.previousCommand=null)},e.prototype.onEndOperation=function(e){if(this.curOp&&this.session){if(e&&!1===e.returnValue){this.curOp=null;return}if(this._signal("beforeEndOperation"),this.curOp){var t=this.curOp.command,n=t&&t.scrollIntoView;if(n){switch(n){case"center-animate":n="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var i=this.selection.getRange(),r=this.renderer.layerConfig;(i.start.row>=r.lastRow||i.end.row<=r.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==n&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}}},e.prototype.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,n=this.$mergeableCommands,i=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var r=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),i=i&&this.mergeNextCommand&&(!/\s/.test(r)||/\s/.test(t.args)),this.mergeNextCommand=!0}else i=i&&-1!==n.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(i=!1),i?this.session.mergeUndoDeltas=!0:-1!==n.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},e.prototype.setKeyboardHandler=function(e,t){if(e&&"string"==typeof e&&"ace"!=e){this.$keybindingId=e;var n=this;b.loadModule(["keybinding",e],function(i){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(i&&i.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},e.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},e.prototype.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&!e.destroyed&&e.bgTokenizer.scheduleStart()}},e.prototype.getSession=function(){return this.session},e.prototype.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},e.prototype.getValue=function(){return this.session.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.resize=function(e){this.renderer.onResize(e)},e.prototype.setTheme=function(e,t){this.renderer.setTheme(e,t)},e.prototype.getTheme=function(){return this.renderer.getTheme()},e.prototype.setStyle=function(e){this.renderer.setStyle(e)},e.prototype.unsetStyle=function(e){this.renderer.unsetStyle(e)},e.prototype.getFontSize=function(){return this.getOption("fontSize")||o.computedStyle(this.container).fontSize},e.prototype.setFontSize=function(e){this.setOption("fontSize",e)},e.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(t&&!t.destroyed){t.$bracketHighlight&&(t.$bracketHighlight.markerIds.forEach(function(e){t.removeMarker(e)}),t.$bracketHighlight=null);var n=e.getCursorPosition(),i=e.getKeyboardHandler(),r=i&&i.$getDirectionForHighlight&&i.$getDirectionForHighlight(e),o=t.getMatchingBracketRanges(n,r);if(!o){var s=new y(t,n.row,n.column).getCurrentToken();if(s&&/\b(?:tag-open|tag-name)/.test(s.type)){var a=t.getMatchingTags(n);a&&(o=[a.openTagName.isEmpty()?a.openTag:a.openTagName,a.closeTagName.isEmpty()?a.closeTag:a.closeTagName])}}if(!o&&t.$mode.getMatching&&(o=t.$mode.getMatching(e.session)),!o){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var l="ace_bracket";Array.isArray(o)?1==o.length&&(l="ace_error_bracket"):o=[o],2==o.length&&(0==f.comparePoints(o[0].end,o[1].start)?o=[f.fromPoints(o[0].start,o[1].end)]:0==f.comparePoints(o[0].start,o[1].end)&&(o=[f.fromPoints(o[1].start,o[0].end)])),t.$bracketHighlight={ranges:o,markerIds:o.map(function(e){return t.addMarker(e,l,"text")})},e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide()}},50)}},e.prototype.focus=function(){this.textInput.focus()},e.prototype.isFocused=function(){return this.textInput.isFocused()},e.prototype.blur=function(){this.textInput.blur()},e.prototype.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},e.prototype.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},e.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},e.prototype.onDocumentChange=function(e){var t=this.session.$useWrapMode,n=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,n,t),this._signal("change",e),this.$cursorChange()},e.prototype.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},e.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},e.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},e.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},e.prototype.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),this.renderer.$maxLines&&1===this.session.getLength()&&!(this.renderer.$minLines>1)&&(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var n=new f(e.row,e.column,e.row,1/0);n.id=t.addMarker(n,"ace_active-line","screenLine"),t.$highlightLineMarker=n}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._signal("changeBackMarker"))},e.prototype.onSelectionChange=function(e){var t=this.session;if(t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var n=this.selection.getRange(),i=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",i)}var r=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(r),this._signal("changeSelection")},e.prototype.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!(t.isEmpty()||t.isMultiLine())){var n=t.start.column,i=t.end.column,r=e.getLine(t.start.row),o=r.substring(n,i);if(!(o.length>5e3)&&/[\w\d]/.test(o)){var s=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:o}),a=r.substring(n-1,i+1);if(s.test(a))return s}}},e.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},e.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},e.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},e.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},e.prototype.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},e.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},e.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},e.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},e.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},e.prototype.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;for(var i=this.selection.getAllRanges(),r=0;r<i.length;r++){var o=i[r];r&&i[r-1].start.row==o.start.row||(e+=this.session.getLine(o.start.row)+t)}}var s={text:e};return this._signal("copy",s),_.lineMode=!!n&&s.text,s.text},e.prototype.onCopy=function(){this.commands.exec("copy",this)},e.prototype.onCut=function(){this.commands.exec("cut",this)},e.prototype.onPaste=function(e,t){var n={text:e,event:t};this.commands.exec("paste",this,n)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var t=e.text,n=t===_.lineMode,i=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)n?i.insert({row:this.selection.lead.row,column:0},t):this.insert(t);else if(n)this.selection.rangeList.ranges.forEach(function(e){i.insert({row:e.start.row,column:0},t)});else{var r=t.split(/\r\n|\r|\n/),o=this.selection.rangeList.ranges,s=2==r.length&&(!r[0]||!r[1]);if(r.length!=o.length||s)return this.commands.exec("insertstring",this,t);for(var a=o.length;a--;){var l=o[a];l.isEmpty()||i.remove(l),i.insert(l.start,r[a])}}},e.prototype.execCommand=function(e,t){return this.commands.exec(e,this,t)},e.prototype.insert=function(e,t){var n=this.session,i=n.getMode(),r=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var o=i.transformAction(n.getState(r.row),"insertion",this,n,e);o&&(e===o.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=o.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var s=f.fromPoints(r,r);s.end.column+=e.length,this.session.remove(s)}}else{var s=this.getSelectionRange();r=this.session.remove(s),this.clearSelection()}if("\n"==e||"\r\n"==e){var a=n.getLine(r.row);if(r.column>a.search(/\S|$/)){var l=a.substr(r.column).search(/\S|$/);n.doc.removeInLine(r.row,r.column,r.column+l)}}this.clearSelection();var c=r.column,u=n.getState(r.row),a=n.getLine(r.row),d=i.checkOutdent(u,a,e);if(n.insert(r,e),o&&o.selection&&(2==o.selection.length?this.selection.setSelectionRange(new f(r.row,c+o.selection[0],r.row,c+o.selection[1])):this.selection.setSelectionRange(new f(r.row+o.selection[0],o.selection[1],r.row+o.selection[2],o.selection[3]))),this.$enableAutoIndent){if(n.getDocument().isNewLine(e)){var h=i.getNextLineIndent(u,a.slice(0,r.column),n.getTabString());n.insert({row:r.row+1,column:0},h)}d&&i.autoOutdent(u,n,r.row)}},e.prototype.autoIndent=function(){for(var e=this.session,t=e.getMode(),n=this.selection.isEmpty()?[new f(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),i="",r="",o="",s=e.getTabString(),a=0;a<n.length;a++)for(var l=n[a].start.row,c=n[a].end.row,u=l;u<=c;u++){u>0&&(i=e.getState(u-1),r=e.getLine(u-1),o=t.getNextLineIndent(i,r,s));var d=e.getLine(u),h=t.$getIndent(d);if(o!==h){if(h.length>0){var p=new f(u,0,u,h.length);e.remove(p)}o.length>0&&e.insert({row:u,column:0},o)}t.autoOutdent(i,e,u)}},e.prototype.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var n=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(n):n(),this.endOperation()},e.prototype.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var n=this.selection.getRange();n.start.column-=t.extendLeft,n.end.column+=t.extendRight,n.start.column<0&&(n.start.row--,n.start.column+=this.session.getLine(n.start.row).length+1),this.selection.setRange(n),e||n.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),t.restoreStart||t.restoreEnd){var n=this.selection.getRange();n.start.column-=t.restoreStart,n.end.column-=t.restoreEnd,this.selection.setRange(n)}},e.prototype.onCommandKey=function(e,t,n){return this.keyBinding.onCommandKey(e,t,n)},e.prototype.setOverwrite=function(e){this.session.setOverwrite(e)},e.prototype.getOverwrite=function(){return this.session.getOverwrite()},e.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},e.prototype.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},e.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},e.prototype.setDragDelay=function(e){this.setOption("dragDelay",e)},e.prototype.getDragDelay=function(){return this.getOption("dragDelay")},e.prototype.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},e.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},e.prototype.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},e.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},e.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},e.prototype.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},e.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},e.prototype.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},e.prototype.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},e.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},e.prototype.setHighlightIndentGuides=function(e){this.renderer.setHighlightIndentGuides(e)},e.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},e.prototype.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},e.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},e.prototype.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},e.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},e.prototype.setReadOnly=function(e){this.setOption("readOnly",e)},e.prototype.getReadOnly=function(){return this.getOption("readOnly")},e.prototype.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},e.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},e.prototype.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},e.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},e.prototype.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},e.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,i=n.getState(t.start.row),r=n.getMode().transformAction(i,"deletion",this,n,t);if(0===t.end.column){var o=n.getTextRange(t);if("\n"==o[o.length-1]){var s=n.getLine(t.end.row);/^\s+$/.test(s)&&(t.end.column=s.length)}}r&&(t=r)}this.session.remove(t),this.clearSelection()},e.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},e.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},e.prototype.setGhostText=function(e,t){this.session.widgetManager||(this.session.widgetManager=new w(this.session),this.session.widgetManager.attach(this)),this.renderer.setGhostText(e,t)},e.prototype.removeGhostText=function(){this.session.widgetManager&&this.renderer.removeGhostText()},e.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var e,t,n=this.getCursorPosition(),i=n.column;if(0!==i){var r=this.session.getLine(n.row);i<r.length?(e=r.charAt(i)+r.charAt(i-1),t=new f(n.row,i-1,n.row,i+1)):(e=r.charAt(i-1)+r.charAt(i-2),t=new f(n.row,i-2,n.row,i)),this.session.replace(t,e),this.session.selection.moveToPosition(t.end)}}},e.prototype.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}if(t.start.column<t.end.column){var i=e.getTextRange(t);if(!/^\s+$/.test(i)){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}}var r=e.getLine(t.start.row),o=t.start,a=e.getTabSize(),l=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var c=a-l%a,u=s.stringRepeat(" ",c);else{for(var c=l%a;" "==r[t.start.column-1]&&c;)t.start.column--,c--;this.selection.setSelectionRange(t),u=" "}return this.insert(u)},e.prototype.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},e.prototype.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},e.prototype.sortLines=function(){for(var e=this.$getSelectedRows(),t=this.session,n=[],i=e.first;i<=e.last;i++)n.push(t.getLine(i));n.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:+(e.toLowerCase()>t.toLowerCase())});for(var r=new f(0,0,0,0),i=e.first;i<=e.last;i++){var o=t.getLine(i);r.start.row=i,r.end.row=i,r.end.column=o.length,t.replace(r,n[i-e.first])}},e.prototype.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},e.prototype.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},e.prototype.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;for(var i=this.session.getLine(e);n.lastIndex<t;){var r=n.exec(i);if(r.index<=t&&r.index+r[0].length>=t)return{value:r[0],start:r.index,end:r.index+r[0].length}}return null},e.prototype.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,i=new f(t,n-1,t,n),r=this.session.getTextRange(i);if(!isNaN(parseFloat(r))&&isFinite(r)){var o=this.getNumberAt(t,n);if(o){var s=o.value.indexOf(".")>=0?o.start+o.value.indexOf(".")+1:o.end,a=o.start+o.value.length-s,l=parseFloat(o.value);l*=Math.pow(10,a),s!==o.end&&n<s?e*=Math.pow(10,o.end-n-1):e*=Math.pow(10,o.end-n),l+=e;var c=(l/=Math.pow(10,a)).toFixed(a),u=new f(t,o.start,t,o.end);this.session.replace(u,c),this.moveCursorTo(t,Math.max(o.start+1,n+c.length-o.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,t=this.selection.getCursor().row,n=this.selection.getCursor().column;this.selection.selectWord();var i=this.getSelectedText(),r=this.selection.getWordRange().start.column,o=i.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),a=n-r-1;a<0&&(a=0);var l=0,c=0,u=this;i.match(/[A-Za-z0-9_]+/)&&o.forEach(function(e,n){c=l+e.length,a>=l&&a<=c&&(i=e,u.selection.clearSelection(),u.moveCursorTo(t,l+r),u.selection.selectTo(t,c+r)),l=c});for(var d=this.$toggleWordPairs,h=0;h<d.length;h++)for(var p=d[h],f=0;f<=1;f++){var g=+!f,m=i.match(RegExp("^\\s?_?("+s.escapeRegExp(p[f])+")\\s?$","i"));m&&i.match(RegExp("([_]|^|\\s)("+s.escapeRegExp(m[1])+")($|\\s)","g"))&&(e=i.replace(RegExp(s.escapeRegExp(p[f]),"i"),function(e){var t=p[g];return e.toUpperCase()==e?t=t.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(t=t.substr(0,0)+p[g].charAt(0).toUpperCase()+t.substr(1)),t}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,t){var n=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),r=t;r<0&&(r=0);var o,s,a,l=0,c=0;try{for(var u=i(n),d=u.next();!d.done;d=u.next()){var h=d.value;if(c=l+h.length,r>=l&&r<=c&&h.match(/((?:https?|ftp):\/\/[\S]+)/)){a=h.replace(/[\s:.,'";}\]]+$/,"");break}l=c}}catch(e){o={error:e}}finally{try{d&&!d.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}return a},e.prototype.openLink=function(){var e=this.selection.getCursor(),t=this.findLinkAt(e.row,e.column);return t&&window.open(t,"_blank"),null!=t},e.prototype.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},e.prototype.duplicateSelection=function(){var e=this.selection,t=this.session,n=e.getRange(),i=e.isBackwards();if(n.isEmpty()){var r=n.start.row;t.duplicateLines(r,r)}else{var o=i?n.start:n.end,s=t.insert(o,t.getTextRange(n));n.start=o,n.end=s,e.setSelectionRange(n,i)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,t,n){return this.session.moveText(e,t,n)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,t){var n,i,r=this.selection;if(!r.inMultiSelectMode||this.inVirtualSelectionMode){var o=r.toOrientedRange();n=this.$getSelectedRows(o),i=this.session.$moveLines(n.first,n.last,t?0:e),t&&-1==e&&(i=0),o.moveBy(i,0),r.fromOrientedRange(o)}else{var s=r.rangeList.ranges;r.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var a=0,l=0,c=s.length,u=0;u<c;u++){var d=u;s[u].moveBy(a,0);for(var h=(n=this.$getSelectedRows(s[u])).first,p=n.last;++u<c;){l&&s[u].moveBy(l,0);var f=this.$getSelectedRows(s[u]);if(t&&f.first!=p||!t&&f.first>p+1)break;p=f.last}for(u--,a=this.session.$moveLines(h,p,t?0:e),t&&-1==e&&(d=u+1);d<=u;)s[d].moveBy(a,0),d++;t||(a=0),l+=a}r.fromOrientedRange(r.ranges[0]),r.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},e.prototype.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},e.prototype.onCompositionStart=function(e){this.renderer.showComposition(e)},e.prototype.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},e.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},e.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},e.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},e.prototype.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},e.prototype.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},e.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},e.prototype.$moveByPage=function(e,t){var n=this.renderer,i=this.renderer.layerConfig,r=e*Math.floor(i.height/i.lineHeight);!0===t?this.selection.$moveSelection(function(){this.moveCursorBy(r,0)}):!1===t&&(this.selection.moveCursorBy(r,0),this.selection.clearSelection());var o=n.scrollTop;n.scrollBy(0,r*i.lineHeight),null!=t&&n.scrollCursorIntoView(null,.5),n.animateScrolling(o)},e.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},e.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},e.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},e.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},e.prototype.scrollPageDown=function(){this.$moveByPage(1)},e.prototype.scrollPageUp=function(){this.$moveByPage(-1)},e.prototype.scrollToRow=function(e){this.renderer.scrollToRow(e)},e.prototype.scrollToLine=function(e,t,n,i){this.renderer.scrollToLine(e,t,n,i)},e.prototype.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},e.prototype.getCursorPosition=function(){return this.selection.getCursor()},e.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},e.prototype.getSelectionRange=function(){return this.selection.getRange()},e.prototype.selectAll=function(){this.selection.selectAll()},e.prototype.clearSelection=function(){this.selection.clearSelection()},e.prototype.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},e.prototype.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},e.prototype.jumpToMatching=function(e,t){var n,i,r,o,s=this.getCursorPosition(),a=new y(this.session,s.row,s.column),l=a.getCurrentToken(),c=0;l&&-1!==l.type.indexOf("tag-name")&&(l=a.stepBackward());var u=l||a.stepForward();if(u){var d=!1,h={},p=s.column-u.start,g={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(u.value.match(/[{}()\[\]]/g)){for(;p<u.value.length&&!d;p++)if(g[u.value[p]])switch(isNaN(h[i=g[u.value[p]]+"."+u.type.replace("rparen","lparen")])&&(h[i]=0),u.value[p]){case"(":case"[":case"{":h[i]++;break;case")":case"]":case"}":h[i]--,-1===h[i]&&(n="bracket",d=!0)}}else -1!==u.type.indexOf("tag-name")&&(isNaN(h[u.value])&&(h[u.value]=0),"<"===l.value&&c>1?h[u.value]++:"</"===l.value&&h[u.value]--,-1===h[u.value]&&(n="tag",d=!0));d||(l=u,c++,u=a.stepForward(),p=0)}while(u&&!d);if(n){if("bracket"===n)!(r=this.session.getBracketRange(s))&&(o=(r=new f(a.getCurrentTokenRow(),a.getCurrentTokenColumn()+p-1,a.getCurrentTokenRow(),a.getCurrentTokenColumn()+p-1)).start,(t||o.row===s.row&&2>Math.abs(o.column-s.column))&&(r=this.session.getBracketRange(o)));else if("tag"===n){if(!u||-1===u.type.indexOf("tag-name"))return;if(0===(r=new f(a.getCurrentTokenRow(),a.getCurrentTokenColumn()-2,a.getCurrentTokenRow(),a.getCurrentTokenColumn()-2)).compare(s.row,s.column)){var m=this.session.getMatchingTags(s);m&&(m.openTag.contains(s.row,s.column)?o=(r=m.closeTag).start:(r=m.openTag,o=m.closeTag.start.row===s.row&&m.closeTag.start.column===s.column?r.end:r.start))}o=o||r.start}o=r&&r.cursor||o,o&&(e?r&&t?this.selection.setRange(r):r&&r.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(o.row,o.column):this.selection.moveTo(o.row,o.column))}}},e.prototype.gotoLine=function(e,t,n){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,n)},e.prototype.navigateTo=function(e,t){this.selection.moveTo(e,t)},e.prototype.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},e.prototype.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},e.prototype.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},e.prototype.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}this.clearSelection()},e.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},e.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},e.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},e.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},e.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},e.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},e.prototype.replace=function(e,t){t&&this.$search.set(t);var n=this.$search.find(this.session),i=0;return n&&(this.$tryReplace(n,e)&&(i=1),this.selection.setSelectionRange(n),this.renderer.scrollSelectionIntoView(n.start,n.end)),i},e.prototype.replaceAll=function(e,t){t&&this.$search.set(t);var n=this.$search.findAll(this.session),i=0;if(!n.length)return i;var r=this.getSelectionRange();this.selection.moveTo(0,0);for(var o=n.length-1;o>=0;--o)this.$tryReplace(n[o],e)&&i++;return this.selection.setSelectionRange(r),i},e.prototype.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return null!==(t=this.$search.replace(n,t))?(e.end=this.session.replace(e,t),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,t,n){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&r.mixin(t,e);var i=this.selection.getRange();null==t.needle&&((e=this.session.getTextRange(i)||this.$search.$options.needle)||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var o=this.$search.find(this.session);return t.preventScroll?o:o?(this.revealRange(o,n),o):void(t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i))},e.prototype.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},e.prototype.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},e.prototype.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==t&&this.renderer.animateScrolling(n)},e.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(e){e.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},e.prototype.setAutoScrollEditorIntoView=function(e){if(e){var t,n=this,i=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var r=this.$scrollAnchor;r.style.cssText="position:absolute",this.container.insertBefore(r,this.container.firstChild);var o=this.on("changeSelection",function(){i=!0}),s=this.renderer.on("beforeRender",function(){i&&(t=n.renderer.container.getBoundingClientRect())}),a=this.renderer.on("afterRender",function(){if(i&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,o=e.$cursorLayer.$pixelPos,s=e.layerConfig,a=o.top-s.offset;null!=(i=o.top>=0&&a+t.top<0||(!(o.top<s.height)||!(o.top+t.top+s.lineHeight>window.innerHeight))&&null)&&(r.style.top=a+"px",r.style.left=o.left+"px",r.style.height=s.lineHeight+"px",r.scrollIntoView(i)),i=t=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",o),this.renderer.off("afterRender",a),this.renderer.off("beforeRender",s))}}},e.prototype.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&"wide"!=e,o.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,t,n){var i=this;b.loadModule("ace/ext/prompt",function(r){r.prompt(i,e,t,n)})},e}();M.$uid=0,M.prototype.curOp=null,M.prototype.prevOp={},M.prototype.$mergeableCommands=["backspace","del","insertstring"],M.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],r.implement(M.prototype,g),b.defineOptions(M.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?C.attach(this):C.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?C.attach(this):C.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var e=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),o.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(e||this.renderer.placeholderNode)!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"");else{this.renderer.on("afterRender",this.$updatePlaceholder),o.addCssClass(this.container,"ace_hasPlaceholder");var t=o.createElement("div");t.className="ace_placeholder",t.textContent=this.$placeholder||"",this.renderer.placeholderNode=t,this.renderer.content.appendChild(this.renderer.placeholderNode)}}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(e){var t,n={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(e){e.blur(),e.renderer.scroller.focus()},readOnly:!0},i=function(e){if(e.target==this.renderer.scroller&&e.keyCode===S.enter){e.preventDefault();var t=this.getCursorPosition().row;this.isRowVisible(t)||this.scrollToLine(t,!0,!0),this.focus()}};e?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(3*!!a.isWin),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",$("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",$("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",i.bind(this)),this.commands.addCommand(n),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",$("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",$("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),t||(t=new x(this)),t.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",i.bind(this)),this.commands.removeCommand(n),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),t&&t.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(e){this.$textInputAriaLabel=e},initialValue:""},enableMobileMenu:{set:function(e){this.$enableMobileMenu=e},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var C={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"\xb7":""))+""},getWidth:function(e,t,n){return Math.max(t.toString().length,(n.lastRow+1).toString().length,2)*n.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=M}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom");t.Lines=function(){function e(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return e.prototype.moveContainer=function(e){i.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},e.prototype.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},e.prototype.computeLineTop=function(e,t,n){var i=Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight);return n.documentToScreenRow(e,0)*t.lineHeight-i*this.canvasHeight},e.prototype.computeLineHeight=function(e,t,n){return t.lineHeight*n.getRowLineCount(e)},e.prototype.getLength=function(){return this.cells.length},e.prototype.get=function(e){return this.cells[e]},e.prototype.shift=function(){this.$cacheCell(this.cells.shift())},e.prototype.pop=function(){this.$cacheCell(this.cells.pop())},e.prototype.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var t=i.createFragment(this.element),n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.appendChild(t)}else this.cells.push(e),this.element.appendChild(e.element)},e.prototype.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var t=i.createFragment(this.element),n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.firstChild?this.element.insertBefore(t,this.element.firstChild):this.element.appendChild(t)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},e.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},e.prototype.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},e.prototype.createCell=function(e,t,n,r){var o=this.cellCache.pop();if(!o){var s=i.createElement("div");r&&r(s),this.element.appendChild(s),o={element:s,text:"",row:e}}return o.row=e,o},e}()}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/oop"),o=e("../lib/lang"),s=e("../lib/event_emitter").EventEmitter,a=e("./lines").Lines,l=e("../config").nls,c=function(){function e(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new a(this.element),this.$lines.$offsetCoefficient=1}return e.prototype.setSession=function(e){this.session&&this.session.off("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},e.prototype.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},e.prototype.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},e.prototype.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var n=e[t],i=n.row,r=this.$annotations[i];r||(r=this.$annotations[i]={text:[],type:[],displayText:[]});var s=n.text,a=n.text,l=n.type;s=s?o.escapeHTML(s):n.html||"",a=a||n.html||"",-1===r.text.indexOf(s)&&(r.text.push(s),r.type.push(l),r.displayText.push(a));var c=n.className;c?r.className=c:"error"===l?r.className=" ace_error":"security"!==l||/\bace_error\b/.test(r.className)?"warning"!==l||/\bace_(error|security)\b/.test(r.className)?"info"!==l||r.className?"hint"!==l||r.className||(r.className=" ace_hint"):r.className=" ace_info":r.className=" ace_warning":r.className=" ace_security"}},e.prototype.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.start.row,n=e.end.row-t;if(0===n);else if("remove"==e.action)this.$annotations.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.$annotations.splice.apply(this.$annotations,i)}}},e.prototype.update=function(e){this.config=e;var t=this.session,n=e.firstRow,i=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1);this.oldLastRow=i,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var r=t.getNextFoldLine(n),o=r?r.start.row:1/0,s=null,a=-1,l=n;;){if(l>o&&(l=r.end.row+1,o=(r=t.getNextFoldLine(l,r))?r.start.row:1/0),l>i){for(;this.$lines.getLength()>a+1;)this.$lines.pop();break}(s=this.$lines.get(++a))?s.row=l:(s=this.$lines.createCell(l,e,this.session,u),this.$lines.push(s)),this.$renderCell(s,e,r,l),l++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var t=this.session,n=t.gutterRenderer||this.$renderer,i=t.$firstLineNumber,r=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||t.$useWrapMode)&&(r=t.getLength()+i-1);var o=n?n.getWidth(t,r,e):r.toString().length*e.characterWidth,s=this.$padding||this.$computePadding();(o+=s.left+s.right)===this.gutterWidth||isNaN(o)||(this.gutterWidth=o,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",o))},e.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},e.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var n=0;n<t.length;n++){var i=t[n];if(i.row>=this.$cursorRow){if(i.row>this.$cursorRow){var r=this.session.getFoldLine(this.$cursorRow);if(n>0&&r&&r.start.row==t[n-1].row)i=t[n-1];else break}i.element.className="ace_gutter-active-line "+i.element.className,this.$cursorCell=i;break}}}}},e.prototype.scrollLines=function(e){var t=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),i=this.oldLastRow;if(this.oldLastRow=n,!t||i<e.firstRow||n<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(i>n)for(var r=this.session.getFoldedRowCount(n+1,i);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,t.firstRow-1)),n>i&&this.$lines.push(this.$renderLines(e,i+1,n)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,t,n){for(var i=[],r=t,o=this.session.getNextFoldLine(r),s=o?o.start.row:1/0;r>s&&(r=o.end.row+1,s=(o=this.session.getNextFoldLine(r,o))?o.start.row:1/0),!(r>n);){var a=this.$lines.createCell(r,e,this.session,u);this.$renderCell(a,e,o,r),i.push(a),r++}return i},e.prototype.$renderCell=function(e,t,n,r){var o,s=e.element,a=this.session,c=s.childNodes[0],u=s.childNodes[1],d=s.childNodes[2],h=d.firstChild,p=a.$firstLineNumber,f=a.$breakpoints,g=a.$decorations,m=a.gutterRenderer||this.$renderer,v=this.$showFoldWidgets&&a.foldWidgets,b=n?n.start.row:Number.MAX_VALUE,y=t.lineHeight+"px",w=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",x=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",$=(m?m.getText(a,r):r+p).toString();if(this.$highlightGutterLine&&(r==this.$cursorRow||n&&r<this.$cursorRow&&r>=b&&this.$cursorRow<=n.end.row)&&(w+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),f[r]&&(w+=f[r]),g[r]&&(w+=g[r]),this.$annotations[r]&&r!==b&&(w+=this.$annotations[r].className),v){var _=v[r];null==_&&(_=v[r]=a.getFoldWidget(r))}if(_){var S="ace_fold-widget ace_"+_,M="start"==_&&r==b&&r<n.end.row;if(M){S+=" ace_closed";for(var C="",E=!1,k=r+1;k<=n.end.row;k++)if(this.$annotations[k]){if(" ace_error"===this.$annotations[k].className){E=!0,C=" ace_error_fold";break}" ace_security"===this.$annotations[k].className?(E=!0,C=" ace_security_fold"):" ace_warning"===this.$annotations[k].className&&" ace_security_fold"!==C&&(E=!0,C=" ace_warning_fold")}w+=C}else S+=" ace_open";u.className!=S&&(u.className=S),i.setStyle(u.style,"height",y),i.setStyle(u.style,"display","inline-block"),u.setAttribute("role","button"),u.setAttribute("tabindex","-1");var A=a.getFoldWidgetRange(r);A?u.setAttribute("aria-label",l("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[A.start.row+1,A.end.row+1])):n?u.setAttribute("aria-label",l("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[n.start.row+1,n.end.row+1])):u.setAttribute("aria-label",l("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[r+1])),M?(u.setAttribute("aria-expanded","false"),u.setAttribute("title",l("gutter.code-folding.closed.title","Unfold code"))):(u.setAttribute("aria-expanded","true"),u.setAttribute("title",l("gutter.code-folding.open.title","Fold code")))}else u&&(i.setStyle(u.style,"display","none"),u.setAttribute("tabindex","0"),u.removeAttribute("role"),u.removeAttribute("aria-label"));if(E&&this.$showFoldedAnnotations){switch(d.className="ace_gutter_annotation",h.className=x,h.className+=C,i.setStyle(h.style,"height",y),i.setStyle(d.style,"display","block"),i.setStyle(d.style,"height",y),C){case" ace_error_fold":o=l("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security_fold":o=l("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning_fold":o=l("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$])}d.setAttribute("aria-label",o),d.setAttribute("tabindex","-1"),d.setAttribute("role","button")}else if(this.$annotations[r]){switch(d.className="ace_gutter_annotation",h.className=x,this.$useSvgGutterIcons?h.className+=this.$annotations[r].className:s.classList.add(this.$annotations[r].className.replace(" ","")),i.setStyle(h.style,"height",y),i.setStyle(d.style,"display","block"),i.setStyle(d.style,"height",y),this.$annotations[r].className){case" ace_error":o=l("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security":o=l("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning":o=l("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$]);break;case" ace_info":o=l("gutter.annotation.aria-label.info","Info, read annotations row $0",[$]);break;case" ace_hint":o=l("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[$])}d.setAttribute("aria-label",o),d.setAttribute("tabindex","-1"),d.setAttribute("role","button")}else i.setStyle(d.style,"display","none"),d.removeAttribute("aria-label"),d.removeAttribute("role"),d.setAttribute("tabindex","0");return $!==c.data&&(c.data=$),s.className!=w&&(s.className=w),i.setStyle(e.element.style,"height",this.$lines.computeLineHeight(r,t,a)+"px"),i.setStyle(e.element.style,"top",this.$lines.computeLineTop(r,t,a)+"px"),e.text=$,"none"===d.style.display&&"none"===u.style.display?e.element.setAttribute("aria-hidden",!0):e.element.setAttribute("aria-hidden",!1),e},e.prototype.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},e.prototype.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},e.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},e.prototype.setShowFoldWidgets=function(e){e?i.addCssClass(this.element,"ace_folding-enabled"):i.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},e.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},e.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=i.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},e.prototype.getRegion=function(e){var t=this.$padding||this.$computePadding(),n=this.element.getBoundingClientRect();return e.x<t.left+n.left?"markers":this.$showFoldWidgets&&e.x>n.right-t.right?"foldWidgets":void 0},e}();function u(e){var t=document.createTextNode("");e.appendChild(t);var n=i.createElement("span");e.appendChild(n);var r=i.createElement("span");e.appendChild(r);var o=i.createElement("span");return r.appendChild(o),e}c.prototype.$fixedWidth=!1,c.prototype.$highlightGutterLine=!0,c.prototype.$renderer="",c.prototype.$showLineNumbers=!0,c.prototype.$showFoldWidgets=!0,r.implement(c.prototype,s),t.Gutter=c}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../range").Range,r=e("../lib/dom"),o=function(){function e(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setMarkers=function(e){this.markers=e},e.prototype.elt=function(e,t){var n=-1!=this.i&&this.element.childNodes[this.i];n?this.i++:(n=document.createElement("div"),this.element.appendChild(n),this.i=-1),n.style.cssText=t,n.className=e},e.prototype.update=function(e){if(e){for(var t in this.config=e,this.i=0,this.markers){var n,i=this.markers[t];if(!i.range){i.update(n,this,this.session,e);continue}var r=i.range.clipRows(e.firstRow,e.lastRow);if(!r.isEmpty())if(r=r.toScreenRange(this.session),i.renderer){var o=this.$getTop(r.start.row,e),s=this.$padding+r.start.column*e.characterWidth;i.renderer(n,r,s,o,e)}else"fullLine"==i.type?this.drawFullLineMarker(n,r,i.clazz,e):"screenLine"==i.type?this.drawScreenLineMarker(n,r,i.clazz,e):r.isMultiLine()?"text"==i.type?this.drawTextMarker(n,r,i.clazz,e):this.drawMultiLineMarker(n,r,i.clazz,e):this.drawSingleLineMarker(n,r,i.clazz+" ace_start ace_br15",e)}if(-1!=this.i)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},e.prototype.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},e.prototype.drawTextMarker=function(e,t,n,r,o){for(var a=this.session,l=t.start.row,c=t.end.row,u=l,d=0,h=0,p=a.getScreenLastRowColumn(u),f=new i(u,t.start.column,u,h);u<=c;u++)f.start.row=f.end.row=u,f.start.column=u==l?t.start.column:a.getRowWrapIndent(u),f.end.column=p,d=h,h=p,p=u+1<c?a.getScreenLastRowColumn(u+1):u==c?0:t.end.column,this.drawSingleLineMarker(e,f,n+(u==l?" ace_start":"")+" ace_br"+s(u==l||u==l+1&&t.start.column,d<h,h>p,u==c),r,+(u!=c),o)},e.prototype.drawMultiLineMarker=function(e,t,n,i,r){var o=this.$padding,s=i.lineHeight,a=this.$getTop(t.start.row,i),l=o+t.start.column*i.characterWidth;if(r=r||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var c=t.clone();c.end.row=c.start.row,c.end.column=this.session.getLine(c.start.row).length,this.drawBidiSingleLineMarker(e,c,n+" ace_br1 ace_start",i,null,r)}else this.elt(n+" ace_br1 ace_start","height:"+s+"px;right:"+o+"px;top:"+a+"px;left:"+l+"px;"+(r||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var c=t.clone();c.start.row=c.end.row,c.start.column=0,this.drawBidiSingleLineMarker(e,c,n+" ace_br12",i,null,r)}else{a=this.$getTop(t.end.row,i);var u=t.end.column*i.characterWidth;this.elt(n+" ace_br12","height:"+s+"px;width:"+u+"px;top:"+a+"px;left:"+o+"px;"+(r||""))}if(!((s=(t.end.row-t.start.row-1)*i.lineHeight)<=0)){a=this.$getTop(t.start.row+1,i);var d=!!t.start.column|8*!t.end.column;this.elt(n+(d?" ace_br"+d:""),"height:"+s+"px;right:"+o+"px;top:"+a+"px;left:"+o+"px;"+(r||""))}},e.prototype.drawSingleLineMarker=function(e,t,n,i,r,o){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,n,i,r,o);var s=i.lineHeight,a=(t.end.column+(r||0)-t.start.column)*i.characterWidth,l=this.$getTop(t.start.row,i),c=this.$padding+t.start.column*i.characterWidth;this.elt(n,"height:"+s+"px;width:"+a+"px;top:"+l+"px;left:"+c+"px;"+(o||""))},e.prototype.drawBidiSingleLineMarker=function(e,t,n,i,r,o){var s=i.lineHeight,a=this.$getTop(t.start.row,i),l=this.$padding;this.session.$bidiHandler.getSelections(t.start.column,t.end.column).forEach(function(e){this.elt(n,"height:"+s+"px;width:"+(e.width+(r||0))+"px;top:"+a+"px;left:"+(l+e.left)+"px;"+(o||""))},this)},e.prototype.drawFullLineMarker=function(e,t,n,i,r){var o=this.$getTop(t.start.row,i),s=i.lineHeight;t.start.row!=t.end.row&&(s+=this.$getTop(t.end.row,i)-o),this.elt(n,"height:"+s+"px;top:"+o+"px;left:0;right:0;"+(r||""))},e.prototype.drawScreenLineMarker=function(e,t,n,i,r){var o=this.$getTop(t.start.row,i),s=i.lineHeight;this.elt(n,"height:"+s+"px;top:"+o+"px;left:0;right:0;"+(r||""))},e}();function s(e,t,n,i){return!!e|2*!!t|4*!!n|8*!!i}o.prototype.$padding=0,t.Marker=o}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,t,n){var i=new Set(["text","rparen","lparen"]);t.isTextToken=function(e){return i.has(e)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(e,t,n){"use strict";var i=e("../lib/oop"),r=e("../lib/dom"),o=e("../lib/lang"),s=e("./lines").Lines,a=e("../lib/event_emitter").EventEmitter,l=e("../config").nls,c=e("./text_util").isTextToken,u=function(){function e(e){this.dom=r,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new s(this.element)}return e.prototype.$updateEolChar=function(){var e=this.session.doc,t="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode()?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=t)return this.EOL_CHAR=t,!0},e.prototype.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},e.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},e.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},e.prototype.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",(function(e){this._signal("changeCharacterSize",e)}).bind(this)),this.$pollSizeChanges()},e.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},e.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},e.prototype.setSession=function(e){this.session=e,e&&this.$computeTabString()},e.prototype.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,"string"==typeof e?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},e.prototype.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},e.prototype.setHighlightIndentGuides=function(e){return this.$highlightIndentGuides!==e&&(this.$highlightIndentGuides=e,e)},e.prototype.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],n=1;n<e+1;n++)if(this.showTabs){var i=this.dom.createElement("span");i.className="ace_invisible ace_invisible_tab",i.textContent=o.stringRepeat(this.TAB_CHAR,n),t.push(i)}else t.push(this.dom.createTextNode(o.stringRepeat(" ",n),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",s=this.showSpaces?" ace_invisible ace_invisible_space":"",a=this.showSpaces?o.stringRepeat(this.SPACE_CHAR,this.tabSize):o.stringRepeat(" ",this.tabSize),l=this.showTabs?" ace_invisible ace_invisible_tab":"",c=this.showTabs?o.stringRepeat(this.TAB_CHAR,this.tabSize):a,i=this.dom.createElement("span");i.className=r+s,i.textContent=a,this.$tabStrings[" "]=i;var i=this.dom.createElement("span");i.className=r+l,i.textContent=c,this.$tabStrings[" "]=i}},e.prototype.updateLines=function(e,t,n){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var i=Math.max(t,e.firstRow),r=Math.min(n,e.lastRow),o=this.element.childNodes,s=0,a=e.firstRow;a<i;a++){var l=this.session.getFoldLine(a);if(l)if(l.containsRow(i)){i=l.start.row;break}else a=l.end.row;s++}for(var c=!1,a=i,l=this.session.getNextFoldLine(a),u=l?l.start.row:1/0;a>u&&(a=l.end.row+1,u=(l=this.session.getNextFoldLine(a,l))?l.start.row:1/0),!(a>r);){var d=o[s++];if(d){this.dom.removeChildren(d),this.$renderLine(d,a,a==u&&l),c&&(d.style.top=this.$lines.computeLineTop(a,e,this.session)+"px");var h=e.lineHeight*this.session.getRowLength(a)+"px";d.style.height!=h&&(c=!0,d.style.height=h)}a++}if(c)for(;s<this.$lines.cells.length;){var p=this.$lines.cells[s++];p.element.style.top=this.$lines.computeLineTop(p.row,e,this.session)+"px"}},e.prototype.scrollLines=function(e){var t=this.config;if(this.config=e,this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=e.lastRow,i=t?t.lastRow:-1;if(!t||i<e.firstRow||n<t.firstRow||!t||t.lastRow<e.firstRow||e.lastRow<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,t.firstRow-1)),e.lastRow>t.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow)),this.$highlightIndentGuide()},e.prototype.$renderLinesFragment=function(e,t,n){for(var i=[],o=t,s=this.session.getNextFoldLine(o),a=s?s.start.row:1/0;o>a&&(o=s.end.row+1,a=(s=this.session.getNextFoldLine(o,s))?s.start.row:1/0),!(o>n);){var l=this.$lines.createCell(o,e,this.session),c=l.element;this.dom.removeChildren(c),r.setStyle(c.style,"height",this.$lines.computeLineHeight(o,e,this.session)+"px"),r.setStyle(c.style,"top",this.$lines.computeLineTop(o,e,this.session)+"px"),this.$renderLine(c,o,o==a&&s),this.$useLineGroups()?c.className="ace_line_group":c.className="ace_line",i.push(l),o++}return i},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var t=e.firstRow,n=e.lastRow,i=this.$lines;i.getLength();)i.pop();i.push(this.$renderLinesFragment(e,t,n))},e.prototype.$renderToken=function(e,t,n,i){for(var r,s=this,a=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,u=this.dom.createFragment(this.element),d=0;r=a.exec(i);){var h=r[1],p=r[2],f=r[3],g=r[4],m=r[5];if(s.showSpaces||!p){var v=d!=r.index?i.slice(d,r.index):"";if(d=r.index+r[0].length,v&&u.appendChild(this.dom.createTextNode(v,this.element)),h){var b=s.session.getScreenTabSize(t+r.index);u.appendChild(s.$tabStrings[b].cloneNode(!0)),t+=b-1}else if(p)if(s.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=o.stringRepeat(s.SPACE_CHAR,p.length),u.appendChild(y)}else u.appendChild(this.dom.createTextNode(p,this.element));else if(f){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=o.stringRepeat(s.SPACE_CHAR,f.length),u.appendChild(y)}else if(g){t+=1;var y=this.dom.createElement("span");y.style.width=2*s.config.characterWidth+"px",y.className=s.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",y.textContent=s.showSpaces?s.SPACE_CHAR:g,u.appendChild(y)}else if(m){t+=1;var y=this.dom.createElement("span");y.style.width=2*s.config.characterWidth+"px",y.className="ace_cjk",y.textContent=m,u.appendChild(y)}}}if(u.appendChild(this.dom.createTextNode(d?i.slice(d):i,this.element)),c(n.type))e.appendChild(u);else{var w="ace_"+n.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==n.type&&(y.style.width=n.value.length*this.config.characterWidth+"px",y.setAttribute("title",l("inline-fold.closed.title","Unfold code"))),y.className=w,y.appendChild(u),e.appendChild(y)}return t+i.length},e.prototype.renderIndentGuide=function(e,t,n){var i=t.search(this.$indentGuideRe);if(i<=0||i>=n)return t;if(" "==t[0]){for(var r=(i-=i%this.tabSize)/this.tabSize,o=0;o<r;o++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),t.substr(i)}if(" "==t[0]){for(var o=0;o<i;o++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),t.substr(i)}return this.$highlightIndentGuide(),t},e.prototype.$highlightIndentGuide=function(){if(this.$highlightIndentGuides&&this.displayIndentGuides){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var e=this.session.doc.$lines;if(e){var t=this.session.selection.getCursor(),n=/^\s*/.exec(this.session.doc.getLine(t.row))[0].length,i=Math.floor(n/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:i,start:t.row};var r=this.session.$bracketHighlight;if(r){for(var o=this.session.$bracketHighlight.ranges,s=0;s<o.length;s++)if(t.row!==o[s].start.row){this.$highlightIndentGuideMarker.end=o[s].start.row,t.row>o[s].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&""!==e[t.row]&&t.column===e[t.row].length){this.$highlightIndentGuideMarker.dir=1;for(var s=t.row+1;s<e.length;s++){var a=e[s],l=/^\s*/.exec(a)[0].length;if(""!==a&&(this.$highlightIndentGuideMarker.end=s,l<=n))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,t=0;t<e.length;t++){var n=e[t].element.childNodes;if(n.length>0){for(var i=0;i<n.length;i++)if(n[i].classList&&n[i].classList.contains("ace_indent-guide-active")){n[i].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,t){if(""!==this.session.doc.getLine(e.row)){var n=e.element.childNodes;if(n){var i=n[t-1];i&&i.classList&&i.classList.contains("ace_indent-guide")&&i.classList.add("ace_indent-guide-active")}}},e.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var e=this.$lines.cells;this.$clearActiveIndentGuide();var t=this.$highlightIndentGuideMarker.indentLevel;if(0!==t)if(1===this.$highlightIndentGuideMarker.dir)for(var n=0;n<e.length;n++){var i=e[n];if(this.$highlightIndentGuideMarker.end&&i.row>=this.$highlightIndentGuideMarker.start+1){if(i.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(i,t)}}else for(var n=e.length-1;n>=0;n--){var i=e[n];if(this.$highlightIndentGuideMarker.end&&i.row<this.$highlightIndentGuideMarker.start){if(i.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(i,t)}}}},e.prototype.$createLineElement=function(e){var t=this.dom.createElement("div");return t.className="ace_line",t.style.height=this.config.lineHeight+"px",t},e.prototype.$renderWrappedLine=function(e,t,n){var i=0,r=0,s=n[0],a=0,l=this.$createLineElement();e.appendChild(l);for(var c=0;c<t.length;c++){var u=t[c],d=u.value;if(0==c&&this.displayIndentGuides){if(i=d.length,!(d=this.renderIndentGuide(l,d,s)))continue;i-=d.length}if(i+d.length<s)a=this.$renderToken(l,a,u,d),i+=d.length;else{for(;i+d.length>=s;)a=this.$renderToken(l,a,u,d.substring(0,s-i)),d=d.substring(s-i),i=s,l=this.$createLineElement(),e.appendChild(l),l.appendChild(this.dom.createTextNode(o.stringRepeat("\xa0",n.indent),this.element)),a=0,s=n[++r]||Number.MAX_VALUE;0!=d.length&&(i+=d.length,a=this.$renderToken(l,a,u,d))}}n[n.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(l,a,null,"",!0)},e.prototype.$renderSimpleLine=function(e,t){for(var n=0,i=0;i<t.length;i++){var r=t[i],o=r.value;if(0!=i||!this.displayIndentGuides||(o=this.renderIndentGuide(e,o))){if(n+o.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,o);n=this.$renderToken(e,n,r,o)}}},e.prototype.$renderOverflowMessage=function(e,t,n,i,r){n&&this.$renderToken(e,t,n,i.slice(0,this.MAX_LINE_LENGTH-t));var o=this.dom.createElement("span");o.className="ace_inline_button ace_keyword ace_toggle_wrap",o.textContent=r?"<hide>":"<click to see more...>",e.appendChild(o)},e.prototype.$renderLine=function(e,t,n){if(n||!1==n||(n=this.session.getFoldLine(t)),n)var i=this.$getFoldLineTokens(t,n);else var i=this.session.getTokens(t);var r=e;if(i.length){var o=this.session.getRowSplitData(t);if(o&&o.length){this.$renderWrappedLine(e,i,o);var r=e.lastChild}else{var r=e;this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r)),this.$renderSimpleLine(r,i)}}else this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r));if(this.showEOL&&r){n&&(t=n.end.row);var s=this.dom.createElement("span");s.className="ace_invisible ace_invisible_eol",s.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,r.appendChild(s)}},e.prototype.$getFoldLineTokens=function(e,t){var n=this.session,i=[];function r(e,t,n){for(var r=0,o=0;o+e[r].value.length<t;)if(o+=e[r].value.length,++r==e.length)return;if(o!=t){var s=e[r].value.substring(t-o);s.length>n-t&&(s=s.substring(0,n-t)),i.push({type:e[r].type,value:s}),o=t+s.length,r+=1}for(;o<n&&r<e.length;){var s=e[r].value;s.length+o>n?i.push({type:e[r].type,value:s.substring(0,n-o)}):i.push(e[r]),o+=s.length,r+=1}}var o=n.getTokens(e);return t.walk(function(e,t,s,a,l){null!=e?i.push({type:"fold",value:e}):(l&&(o=n.getTokens(t)),o.length&&r(o,a,s))},t.end.row,this.session.getLine(t.end.row).length),i},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();u.prototype.EOF_CHAR="\xb6",u.prototype.EOL_CHAR_LF="\xac",u.prototype.EOL_CHAR_CRLF="\xa4",u.prototype.EOL_CHAR=u.prototype.EOL_CHAR_LF,u.prototype.TAB_CHAR="—",u.prototype.SPACE_CHAR="\xb7",u.prototype.$padding=0,u.prototype.MAX_LINE_LENGTH=1e4,u.prototype.showInvisibles=!1,u.prototype.showSpaces=!1,u.prototype.showTabs=!1,u.prototype.showEOL=!1,u.prototype.displayIndentGuides=!0,u.prototype.$highlightIndentGuides=!0,u.prototype.$tabStrings=[],u.prototype.destroy={},u.prototype.onChangeTabSize=u.prototype.$computeTabString,i.implement(u.prototype,a),t.Text=u}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=function(){function e(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),i.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var t=this.cursors,n=t.length;n--;)i.setStyle(t[n].style,"opacity",e?"":"0")},e.prototype.$startCssAnimation=function(){for(var e=this.cursors,t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&i.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,i.removeCssClass(this.element,"ace_animate-blinking")},e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},e.prototype.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},e.prototype.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,i.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=i.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},e.prototype.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},e.prototype.hideCursor=function(){this.isVisible=!1,i.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,i.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,i.removeCssClass(this.element,"ace_smooth-blinking")),e(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible)return void this.$stopCssAnimation();if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&i.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),i.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=(function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},e.prototype.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),top:(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight}},e.prototype.isCursorInView=function(e,t){return e.top>=0&&e.top<t.maxHeight},e.prototype.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,r=0;(void 0===t||0===t.length)&&(t=[{cursor:null}]);for(var n=0,o=t.length;n<o;n++){var s=this.getPixelPosition(t[n].cursor,!0);if(!(s.top>e.height+e.offset)&&!(s.top<0)||!(n>1)){var a=this.cursors[r++]||this.addCursor(),l=a.style;this.drawCursor?this.drawCursor(a,s,e,t[n],this.session):this.isCursorInView(s,e)?(i.setStyle(l,"display","block"),i.translate(a,s.left,s.top),i.setStyle(l,"width",Math.round(e.characterWidth)+"px"),i.setStyle(l,"height",e.lineHeight+"px")):i.setStyle(l,"display","none")}}for(;this.cursors.length>r;)this.removeCursor();var c=this.session.getOverwrite();this.$setOverwrite(c),this.$pixelPos=s,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?i.addCssClass(this.element,"ace_overwrite-cursors"):i.removeCssClass(this.element,"ace_overwrite-cursors"))},e.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},e}();r.prototype.$padding=0,r.prototype.drawCursor=null,t.Cursor=r}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/event"),a=e("./lib/event_emitter").EventEmitter,l=32768,c=function(){function e(e,t){this.element=o.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+t,this.inner=o.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\xa0",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();r.implement(c.prototype,a);var u=function(e){function t(t,n){var i=e.call(this,t,"-v")||this;return i.scrollTop=0,i.scrollHeight=0,n.$scrollbarWidth=i.width=o.scrollbarWidth(t.ownerDocument),i.inner.style.width=i.element.style.width=(i.width||15)+5+"px",i.$minWidth=0,i}return i(t,e),t.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},t.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},t.prototype.setHeight=function(e){this.element.style.height=e+"px"},t.prototype.setScrollHeight=function(e){this.scrollHeight=e,e>l?(this.coeff=l/e,e=l):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},t.prototype.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)},t}(c);u.prototype.setInnerHeight=u.prototype.setScrollHeight;var d=function(e){function t(t,n){var i=e.call(this,t,"-h")||this;return i.scrollLeft=0,i.height=n.$scrollbarWidth,i.inner.style.height=i.element.style.height=(i.height||15)+5+"px",i}return i(t,e),t.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},t.prototype.getHeight=function(){return this.isVisible?this.height:0},t.prototype.setWidth=function(e){this.element.style.width=e+"px"},t.prototype.setInnerWidth=function(e){this.inner.style.width=e+"px"},t.prototype.setScrollWidth=function(e){this.inner.style.width=e+"px"},t.prototype.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)},t}(c);t.ScrollBar=u,t.ScrollBarV=u,t.ScrollBarH=d,t.VScrollBar=u,t.HScrollBar=d}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/event"),a=e("./lib/event_emitter").EventEmitter;o.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n position: absolute;\n background: rgba(128, 128, 128, 0.6);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid #bbb;\n border-radius: 2px;\n z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n position: absolute;\n z-index: 6;\n background: none;\n overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n z-index: 6;\n right: 0;\n top: 0;\n width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n z-index: 8;\n right: 0;\n width: 100%;\n}\n.ace_editor>.ace_sb-h {\n bottom: 0;\n left: 0;\n height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n bottom: 0;\n height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n z-index: 8;\n background: #000;\n}","ace_scrollbar.css",!1);var l=function(){function e(e,t){this.element=o.createElement("div"),this.element.className="ace_sb"+t,this.inner=o.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();r.implement(l.prototype,a);var c=function(e){function t(t,n){var i=e.call(this,t,"-v")||this;return i.scrollTop=0,i.scrollHeight=0,i.parent=t,i.width=i.VScrollWidth,i.renderer=n,i.inner.style.width=i.element.style.width=(i.width||15)+"px",i.$minWidth=0,i}return i(t,e),t.prototype.onMouseDown=function(e,t){if("mousedown"===e&&0===s.getButton(t)&&2!==t.detail){if(t.target===this.inner){var n=this,i=t.clientY,r=function(e){i=e.clientY},o=function(){clearInterval(u)},a=t.clientY,l=this.thumbTop,c=function(){if(void 0!==i){var e=n.scrollTopFromThumbTop(l+i-a);e!==n.scrollTop&&n._emit("scroll",{data:e})}};s.capture(this.inner,r,o);var u=setInterval(c,20);return s.preventDefault(t)}var d=t.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(d)}),s.preventDefault(t)}},t.prototype.getHeight=function(){return this.height},t.prototype.scrollTopFromThumbTop=function(e){var t=e*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return(t|=0)<0?t=0:t>this.pageHeight-this.viewHeight&&(t=this.pageHeight-this.viewHeight),t},t.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},t.prototype.setHeight=function(e){this.height=Math.max(0,e),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},t.prototype.setScrollHeight=function(e,t){(this.pageHeight!==e||t)&&(this.pageHeight=e,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},t.prototype.setScrollTop=function(e){this.scrollTop=e,e<0&&(e=0),this.thumbTop=e*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},t}(l);c.prototype.setInnerHeight=c.prototype.setScrollHeight;var u=function(e){function t(t,n){var i=e.call(this,t,"-h")||this;return i.scrollLeft=0,i.scrollWidth=0,i.height=i.HScrollHeight,i.inner.style.height=i.element.style.height=(i.height||12)+"px",i.renderer=n,i}return i(t,e),t.prototype.onMouseDown=function(e,t){if("mousedown"===e&&0===s.getButton(t)&&2!==t.detail){if(t.target===this.inner){var n=this,i=t.clientX,r=function(e){i=e.clientX},o=function(){clearInterval(u)},a=t.clientX,l=this.thumbLeft,c=function(){if(void 0!==i){var e=n.scrollLeftFromThumbLeft(l+i-a);e!==n.scrollLeft&&n._emit("scroll",{data:e})}};s.capture(this.inner,r,o);var u=setInterval(c,20);return s.preventDefault(t)}var d=t.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(d)}),s.preventDefault(t)}},t.prototype.getHeight=function(){return this.isVisible?this.height:0},t.prototype.scrollLeftFromThumbLeft=function(e){var t=e*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return(t|=0)<0?t=0:t>this.pageWidth-this.viewWidth&&(t=this.pageWidth-this.viewWidth),t},t.prototype.setWidth=function(e){this.width=Math.max(0,e),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},t.prototype.setScrollWidth=function(e,t){(this.pageWidth!==e||t)&&(this.pageWidth=e,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},t.prototype.setScrollLeft=function(e){this.scrollLeft=e,e<0&&(e=0),this.thumbLeft=e*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},t}(l);u.prototype.setInnerWidth=u.prototype.setScrollWidth,t.ScrollBar=c,t.ScrollBarV=c,t.ScrollBarH=u,t.VScrollBar=c,t.HScrollBar=u}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var i=e("./lib/event");t.RenderLoop=function(){function e(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var n=this;this._flush=function(e){n.pending=!1;var t=n.changes;if(t&&(i.blockIdle(100),n.changes=0,n.onRender(t)),n.changes){if(n.$recursionLimit--<0)return;n.schedule()}else n.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(i.nextFrame(this._flush),this.pending=!0)},e.prototype.clear=function(e){var t=this.changes;return this.changes=0,t},e}()}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var i=e("../lib/oop"),r=e("../lib/dom"),o=e("../lib/lang"),s=e("../lib/event"),a=e("../lib/useragent"),l=e("../lib/event_emitter").EventEmitter,c=512,u="function"==typeof ResizeObserver,d=200,h=function(){function e(e){this.el=r.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=r.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=r.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=o.stringRepeat("X",c),this.$characterSize={width:0,height:0},u?this.$addObserver():this.checkForSizeChanges()}return e.prototype.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",a.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},e.prototype.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},e.prototype.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){e.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},e.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=s.onIdle(function t(){e.checkForSizeChanges(),s.onIdle(t,500)},500)},e.prototype.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},e.prototype.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/c};return 0===t.width||0===t.height?null:t},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=o.stringRepeat(e,c),this.$main.getBoundingClientRect().width/c},e.prototype.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},e.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype.$getZoom=function(e){return e&&e.parentElement?(Number(window.getComputedStyle(e).zoom)||1)*this.$getZoom(e.parentElement):1},e.prototype.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=r.buildDom([e(0,0),e(d,0),e(0,d),e(d,d)],this.el)},e.prototype.transformCoordinates=function(e,t){function n(e,t,n){var i=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/i,(e[1]*n[0]-e[0]*n[1])/i]}function i(e,t){return[e[0]-t[0],e[1]-t[1]]}function r(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function s(e){var t=e.getBoundingClientRect();return[t.left,t.top]}e&&(e=o(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var a=s(this.els[0]),l=s(this.els[1]),c=s(this.els[2]),u=s(this.els[3]),h=n(i(u,l),i(u,c),i(r(l,c),r(u,a))),p=o(1+h[0],i(l,a)),f=o(1+h[1],i(c,a));if(t){var g=t,m=h[0]*g[0]/d+h[1]*g[1]/d+1,v=r(o(g[0],p),o(g[1],f));return r(o(1/m/d,v),a)}var b=i(e,a),y=n(i(p,o(h[0],b)),i(f,o(h[1],b)),b);return o(d,y)},e}();h.prototype.$characterSize={width:0,height:0},i.implement(h.prototype,l),t.FontMetrics=h}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,t,n){n.exports='\n.ace_br1 {border-top-left-radius : 3px;}\n.ace_br2 {border-top-right-radius : 3px;}\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\n.ace_br4 {border-bottom-right-radius: 3px;}\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\n.ace_br8 {border-bottom-left-radius : 3px;}\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n\n\n.ace_editor {\n position: relative;\n overflow: hidden;\n padding: 0;\n font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'Source Code Pro\', \'source-code-pro\', monospace;\n direction: ltr;\n text-align: left;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n forced-color-adjust: none;\n}\n\n.ace_scroller {\n position: absolute;\n overflow: hidden;\n top: 0;\n bottom: 0;\n background-color: inherit;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n cursor: text;\n}\n\n.ace_content {\n position: absolute;\n box-sizing: border-box;\n min-width: 100%;\n contain: style size layout;\n font-variant-ligatures: no-common-ligatures;\n}\n\n.ace_keyboard-focus:focus {\n box-shadow: inset 0 0 0 2px #5E9ED6;\n outline: none;\n}\n\n.ace_dragging .ace_scroller:before{\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n content: \'\';\n background: rgba(250, 250, 250, 0.01);\n z-index: 1000;\n}\n.ace_dragging.ace_dark .ace_scroller:before{\n background: rgba(0, 0, 0, 0.01);\n}\n\n.ace_gutter {\n position: absolute;\n overflow : hidden;\n width: auto;\n top: 0;\n bottom: 0;\n left: 0;\n cursor: default;\n z-index: 4;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n contain: style size layout;\n}\n\n.ace_gutter-active-line {\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.ace_scroller.ace_scroll-left:after {\n content: "";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n pointer-events: none;\n}\n\n.ace_gutter-cell, .ace_gutter-cell_svg-icons {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-left: 19px;\n padding-right: 6px;\n background-repeat: no-repeat;\n}\n\n.ace_gutter-cell_svg-icons .ace_gutter_annotation {\n margin-left: -14px;\n float: left;\n}\n\n.ace_gutter-cell .ace_gutter_annotation {\n margin-left: -19px;\n float: left;\n}\n\n.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\n}\n\n.ace_icon_svg.ace_error {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: darkorange;\n}\n.ace_icon_svg.ace_info {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: royalblue;\n}\n.ace_icon_svg.ace_hint {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");\n background-color: silver;\n}\n\n.ace_icon_svg.ace_error_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");\n background-color: darkorange;\n}\n\n.ace_scrollbar {\n contain: strict;\n position: absolute;\n right: 0;\n bottom: 0;\n z-index: 6;\n}\n\n.ace_scrollbar-inner {\n position: absolute;\n cursor: text;\n left: 0;\n top: 0;\n}\n\n.ace_scrollbar-v{\n overflow-x: hidden;\n overflow-y: scroll;\n top: 0;\n}\n\n.ace_scrollbar-h {\n overflow-x: scroll;\n overflow-y: hidden;\n left: 0;\n}\n\n.ace_print-margin {\n position: absolute;\n height: 100%;\n}\n\n.ace_text-input {\n position: absolute;\n z-index: 0;\n width: 0.5em;\n height: 1em;\n opacity: 0;\n background: transparent;\n -moz-appearance: none;\n appearance: none;\n border: none;\n resize: none;\n outline: none;\n overflow: hidden;\n font: inherit;\n padding: 0 1px;\n margin: 0 -1px;\n contain: strict;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n user-select: text;\n /*with `pre-line` chrome inserts &nbsp; instead of space*/\n white-space: pre!important;\n}\n.ace_text-input.ace_composition {\n background: transparent;\n color: inherit;\n z-index: 1000;\n opacity: 1;\n}\n.ace_composition_placeholder { color: transparent }\n.ace_composition_marker { \n border-bottom: 1px solid;\n position: absolute;\n border-radius: 0;\n margin-top: 1px;\n}\n\n[ace_nocontext=true] {\n transform: none!important;\n filter: none!important;\n clip-path: none!important;\n mask : none!important;\n contain: none!important;\n perspective: none!important;\n mix-blend-mode: initial!important;\n z-index: auto;\n}\n\n.ace_layer {\n z-index: 1;\n position: absolute;\n overflow: hidden;\n /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/\n word-wrap: normal;\n white-space: pre;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n /* setting pointer-events: auto; on node under the mouse, which changes\n during scroll, will break mouse wheel scrolling in Safari */\n pointer-events: none;\n}\n\n.ace_gutter-layer {\n position: relative;\n width: auto;\n text-align: right;\n pointer-events: auto;\n height: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer {\n font: inherit !important;\n position: absolute;\n height: 1000000px;\n width: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\n contain: style size layout;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ace_hidpi .ace_text-layer,\n.ace_hidpi .ace_gutter-layer,\n.ace_hidpi .ace_content,\n.ace_hidpi .ace_gutter {\n contain: strict;\n}\n.ace_hidpi .ace_text-layer > .ace_line, \n.ace_hidpi .ace_text-layer > .ace_line_group {\n contain: strict;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n box-sizing: border-box;\n border-left: 2px solid;\n /* workaround for smooth cursor repaintng whole screen in chrome */\n transform: translatez(0);\n}\n\n.ace_multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_slim-cursors .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_overwrite-cursors .ace_cursor {\n border-left-width: 0;\n border-bottom: 1px solid;\n}\n\n.ace_hidden-cursors .ace_cursor {\n opacity: 0.2;\n}\n\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\n opacity: 0;\n}\n\n.ace_smooth-blinking .ace_cursor {\n transition: opacity 0.18s;\n}\n\n.ace_animate-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: step-end;\n animation-name: blink-ace-animate;\n animation-iteration-count: infinite;\n}\n\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: ease-in-out;\n animation-name: blink-ace-animate-smooth;\n}\n \n@keyframes blink-ace-animate {\n from, to { opacity: 1; }\n 60% { opacity: 0; }\n}\n\n@keyframes blink-ace-animate-smooth {\n from, to { opacity: 1; }\n 45% { opacity: 1; }\n 60% { opacity: 0; }\n 85% { opacity: 0; }\n}\n\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_error_bracket {\n position: absolute;\n border-bottom: 1px solid #DE5555;\n border-radius: 0;\n}\n\n.ace_marker-layer .ace_active-line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected-word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\n}\n\n.ace_tooltip {\n background-color: #f5f5f5;\n border: 1px solid gray;\n border-radius: 1px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n color: black;\n max-width: 100%;\n padding: 3px 4px;\n position: fixed;\n z-index: 999999;\n box-sizing: border-box;\n cursor: default;\n white-space: pre-wrap;\n word-wrap: break-word;\n line-height: normal;\n font-style: normal;\n font-weight: normal;\n letter-spacing: normal;\n pointer-events: none;\n overflow: auto;\n max-width: min(60em, 66vw);\n overscroll-behavior: contain;\n}\n.ace_tooltip pre {\n white-space: pre-wrap;\n}\n\n.ace_tooltip.ace_dark {\n background-color: #636363;\n color: #fff;\n}\n\n.ace_tooltip:focus {\n outline: 1px solid #5E9ED6;\n}\n\n.ace_icon {\n display: inline-block;\n width: 18px;\n vertical-align: top;\n}\n\n.ace_icon_svg {\n display: inline-block;\n width: 12px;\n vertical-align: top;\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-size: 12px;\n -webkit-mask-position: center;\n}\n\n.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: none;\n width: 11px;\n vertical-align: top;\n\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n cursor: pointer;\n}\n\n.ace_folding-enabled .ace_fold-widget {\n display: inline-block; \n}\n\n.ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\n}\n\n.ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\n}\n.ace_dark .ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n\n.ace_inline_button {\n border: 1px solid lightgray;\n display: inline-block;\n margin: -1px 8px;\n padding: 0 5px;\n pointer-events: auto;\n cursor: pointer;\n}\n.ace_inline_button:hover {\n border-color: gray;\n background: rgba(200,200,200,0.2);\n display: inline-block;\n pointer-events: auto;\n}\n\n.ace_fold-widget.ace_invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_nobold .ace_bold {\n font-weight: normal;\n}\n\n.ace_italic {\n font-style: italic;\n}\n\n\n.ace_error-marker {\n background-color: rgba(255, 0, 0,0.2);\n position: absolute;\n z-index: 9;\n}\n\n.ace_highlight-marker {\n background-color: rgba(255, 255, 0,0.2);\n position: absolute;\n z-index: 8;\n}\n\n.ace_mobile-menu {\n position: absolute;\n line-height: 1.5;\n border-radius: 4px;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n background: white;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #dcdcdc;\n color: black;\n}\n.ace_dark > .ace_mobile-menu {\n background: #333;\n color: #ccc;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #444;\n\n}\n.ace_mobile-button {\n padding: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n.ace_mobile-button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_mobile-button:active {\n background-color: #ddd;\n}\n\n.ace_placeholder {\n position: relative;\n font-family: arial;\n transform: scale(0.9);\n transform-origin: left;\n white-space: pre;\n opacity: 0.7;\n margin: 0 10px;\n z-index: 1;\n}\n\n.ace_ghost_text {\n opacity: 0.5;\n font-style: italic;\n}\n\n.ace_ghost_text_container > div {\n white-space: pre;\n}\n\n.ghost_text_line_wrapped::after {\n content: "↩";\n position: absolute;\n}\n\n.ace_lineWidgetContainer.ace_ghost_text {\n margin: 0px 4px\n}\n\n.ace_screenreader-only {\n position:absolute;\n left:-10000px;\n top:auto;\n width:1px;\n height:1px;\n overflow:hidden;\n}\n\n.ace_hidden_token {\n display: none;\n}'}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/oop"),o=e("../lib/event_emitter").EventEmitter,s=function(){function e(e,t){this.canvas=i.createElement("canvas"),this.renderer=t,this.pixelRatio=1,this.maxHeight=t.layerConfig.maxHeight,this.lineHeight=t.layerConfig.lineHeight,this.canvasHeight=e.parent.scrollHeight,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvasWidth=e.width,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},e.element.appendChild(this.canvas)}return e.prototype.$updateDecorators=function(e){var t=!0===this.renderer.theme.isDark?this.colors.dark:this.colors.light;e&&(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,(e.lastRow+1)*this.lineHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight);var n=this.canvas.getContext("2d");function i(e,t){return e.priority<t.priority?-1:+(e.priority>t.priority)}var r=this.renderer.session.$annotations;if(n.clearRect(0,0,this.canvas.width,this.canvas.height),r){var o={info:1,warning:2,error:3};r.forEach(function(e){e.priority=o[e.type]||null}),r=r.sort(i);for(var s=this.renderer.session.$foldData,a=0;a<r.length;a++){var l=r[a].row,c=this.compensateFoldRows(l,s),u=Math.round((l-c)*this.lineHeight*this.heightRatio),d=Math.round((l-c)*this.lineHeight*this.heightRatio),h=Math.round(((l-c)*this.lineHeight+this.lineHeight)*this.heightRatio);if(h-d<this.minDecorationHeight){var p=(d+h)/2|0;p<this.halfMinDecorationHeight?p=this.halfMinDecorationHeight:p+this.halfMinDecorationHeight>this.canvasHeight&&(p=this.canvasHeight-this.halfMinDecorationHeight),d=Math.round(p-this.halfMinDecorationHeight),h=Math.round(p+this.halfMinDecorationHeight)}n.fillStyle=t[r[a].type]||null,n.fillRect(0,u,this.canvasWidth,h-d)}}var f=this.renderer.session.selection.getCursor();if(f){var c=this.compensateFoldRows(f.row,s),u=Math.round((f.row-c)*this.lineHeight*this.heightRatio);n.fillStyle="rgba(0, 0, 0, 0.5)",n.fillRect(0,u,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,t){var n=0;if(t&&t.length>0)for(var i=0;i<t.length;i++)e>t[i].start.row&&e<t[i].end.row?n+=e-t[i].start.row:e>=t[i].end.row&&(n+=t[i].end.row-t[i].start.row);return n},e}();r.implement(s.prototype,o),t.Decorator=s}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/dom"),o=e("./lib/lang"),s=e("./config"),a=e("./layer/gutter").Gutter,l=e("./layer/marker").Marker,c=e("./layer/text").Text,u=e("./layer/cursor").Cursor,d=e("./scrollbar").HScrollBar,h=e("./scrollbar").VScrollBar,p=e("./scrollbar_custom").HScrollBar,f=e("./scrollbar_custom").VScrollBar,g=e("./renderloop").RenderLoop,m=e("./layer/font_metrics").FontMetrics,v=e("./lib/event_emitter").EventEmitter,b=e("./css/editor-css"),y=e("./layer/decorators").Decorator,w=e("./lib/useragent"),x=e("./layer/text_util").isTextToken;r.importCssString(b,"ace_editor.css",!1);var $=function(){function e(e,t){var n=this;this.container=e||r.createElement("div"),r.addCssClass(this.container,"ace_editor"),r.HI_DPI&&r.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),null==s.get("useStrictCSP")&&s.set("useStrictCSP",!1),this.$gutter=r.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=r.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=r.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new a(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new l(this.content);var i=this.$textLayer=new c(this.content);this.canvas=i.element,this.$markerFront=new l(this.content),this.$cursorLayer=new u(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new h(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new m(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!w.isIOS,this.$loop=new g(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),s.resetOptions(this),s._signal("renderer",this)}return e.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),r.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},e.prototype.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&0>=e.getScrollTop()&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},e.prototype.updateLines=function(e,t,n){if(void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t},this.$changedLines.lastRow<this.layerConfig.firstRow)if(!n)return;else this.$changedLines.lastRow=this.layerConfig.lastRow;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},e.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},e.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},e.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},e.prototype.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},e.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},e.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},e.prototype.onResize=function(e,t,n,i){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var r=this.container;i||(i=r.clientHeight||r.scrollHeight),!i&&this.$maxLines&&this.lineHeight>1&&(!r.style.height||"0px"==r.style.height)&&(r.style.height="1px",i=r.clientHeight||r.scrollHeight),n||(n=r.clientWidth||r.scrollWidth);var o=this.$updateCachedSize(e,t,n,i);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!n&&!i)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(o|this.$changes,!0):this.$loop.schedule(o|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},e.prototype.$updateCachedSize=function(e,t,n,i){i-=this.$extraHeight||0;var o=0,s=this.$size,a={width:s.width,height:s.height,scrollerHeight:s.scrollerHeight,scrollerWidth:s.scrollerWidth};if(i&&(e||s.height!=i)&&(s.height=i,o|=this.CHANGE_SIZE,s.scrollerHeight=s.height,this.$horizScroll&&(s.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(s.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",o|=this.CHANGE_SCROLL),n&&(e||s.width!=n)){o|=this.CHANGE_SIZE,s.width=n,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,r.setStyle(this.scrollBarH.element.style,"left",t+"px"),r.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),s.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()-this.margin.h),r.setStyle(this.$gutter.style,"left",this.margin.left+"px");var l=this.scrollBarV.getWidth()+"px";r.setStyle(this.scrollBarH.element.style,"right",l),r.setStyle(this.scroller.style,"right",l),r.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(s.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(o|=this.CHANGE_FULL)}return s.$dirty=!n||!i,o&&this._signal("resize",a),o},e.prototype.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()||this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},e.prototype.adjustWrapLimit=function(){var e=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth);return this.session.adjustWrapLimit(e,this.$showPrintMargin&&this.$printMarginColumn)},e.prototype.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},e.prototype.getAnimatedScroll=function(){return this.$animatedScroll},e.prototype.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},e.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},e.prototype.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},e.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},e.prototype.setHighlightIndentGuides=function(e){this.setOption("highlightIndentGuides",e)},e.prototype.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},e.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},e.prototype.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},e.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},e.prototype.getShowGutter=function(){return this.getOption("showGutter")},e.prototype.setShowGutter=function(e){return this.setOption("showGutter",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=r.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=r.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},e.prototype.getContainerElement=function(){return this.container},e.prototype.getMouseEventTarget=function(){return this.scroller},e.prototype.getTextAreaContainer=function(){return this.container},e.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var e=this.textarea.style,t=this.$composition;if(!this.$keepTextAreaAtCursor&&!t)return void r.translate(this.textarea,-100,0);var n=this.$cursorLayer.$pixelPos;if(n){t&&t.markerRange&&(n=this.$cursorLayer.getPixelPosition(t.markerRange.start,!0));var i=this.layerConfig,o=n.top,s=n.left;o-=i.offset;var a=t&&t.useTextareaForIME||w.isMobile?this.lineHeight:1;if(o<0||o>i.height-a)return void r.translate(this.textarea,0,0);var l=1,c=this.$size.height-a;if(t)if(t.useTextareaForIME){var u=this.textarea.value;l=this.characterWidth*this.session.$getStringScreenWidth(u)[0]}else o+=this.lineHeight+2;else o+=this.lineHeight;s-=this.scrollLeft,s>this.$size.scrollerWidth-l&&(s=this.$size.scrollerWidth-l),s+=this.gutterWidth+this.margin.left,r.setStyle(e,"height",a+"px"),r.setStyle(e,"width",l+"px"),r.translate(this.textarea,Math.min(s,this.$size.scrollerWidth-l),Math.min(o,c))}}},e.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},e.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+ +(0!==this.layerConfig.offset)},e.prototype.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow;return this.session.documentToScreenRow(t,0)*e.lineHeight-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},e.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},e.prototype.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},e.prototype.setScrollMargin=function(e,t,n,i){var r=this.scrollMargin;r.top=0|e,r.bottom=0|t,r.right=0|i,r.left=0|n,r.v=r.top+r.bottom,r.h=r.left+r.right,r.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-r.top),this.updateFull()},e.prototype.setMargin=function(e,t,n,i){var r=this.margin;r.top=0|e,r.bottom=0|t,r.right=0|i,r.left=0|n,r.v=r.top+r.bottom,r.h=r.left+r.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},e.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},e.prototype.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},e.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},e.prototype.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},e.prototype.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},e.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},e.prototype.freeze=function(){this.$frozen=!0},e.prototype.unfreeze=function(){this.$frozen=!1},e.prototype.$renderChanges=function(e,t){if(this.$changes&&(e|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var i=this.scrollTop+(n.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;i>0&&(this.scrollTop=i,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),r.translate(this.content,-this.scrollLeft,-n.offset);var o=n.width+2*this.$padding+"px",s=n.minHeight+"px";r.setStyle(this.content.style,"width",o),r.setStyle(this.content.style,"height",s)}if(e&this.CHANGE_H_SCROLL&&(r.translate(this.content,-this.scrollLeft,-n.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),e&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}if(e&this.CHANGE_SCROLL){this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(n):this.$gutterLayer.scrollLines(n)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var i=!(n<=2*this.lineHeight)&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var r=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,r,n),this.desiredHeight=n,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,t,n=this.session,i=this.$size,r=i.height<=2*this.lineHeight,o=this.session.getScreenLength()*this.lineHeight,s=this.$getLongestLine(),a=!r&&(this.$hScrollBarAlwaysVisible||i.scrollerWidth-s-2*this.$padding<0),l=this.$horizScroll!==a;l&&(this.$horizScroll=a,this.scrollBarH.setVisible(a));var c=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var u=i.scrollerHeight+this.lineHeight,d=!this.$maxLines&&this.$scrollPastEnd?(i.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;o+=d;var h=this.scrollMargin;this.session.setScrollTop(Math.max(-h.top,Math.min(this.scrollTop,o-i.scrollerHeight+h.bottom))),this.session.setScrollLeft(Math.max(-h.left,Math.min(this.scrollLeft,s+2*this.$padding-i.scrollerWidth+h.right)));var p=!r&&(this.$vScrollBarAlwaysVisible||i.scrollerHeight-o+d<0||this.scrollTop>h.top),f=c!==p;f&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var g=this.scrollTop%this.lineHeight,m=Math.ceil(u/this.lineHeight)-1,v=Math.max(0,Math.round((this.scrollTop-g)/this.lineHeight)),b=v+m,y=this.lineHeight;v=n.screenToDocumentRow(v,0);var w=n.getFoldLine(v);w&&(v=w.start.row),e=n.documentToScreenRow(v,0),t=n.getRowLength(v)*y,b=Math.min(n.screenToDocumentRow(b,0),n.getLength()-1),u=i.scrollerHeight+n.getRowLength(b)*y+t,g=this.scrollTop-e*y;var x=0;return(this.layerConfig.width!=s||l)&&(x=this.CHANGE_H_SCROLL),(l||f)&&(x|=this.$updateCachedSize(!0,this.gutterWidth,i.width,i.height),this._signal("scrollbarVisibilityChanged"),f&&(s=this.$getLongestLine())),this.layerConfig={width:s,padding:this.$padding,firstRow:v,firstRowScreen:e,lastRow:b,lineHeight:y,characterWidth:this.characterWidth,minHeight:u,maxHeight:o,offset:g,gutterOffset:y?Math.max(0,Math.ceil((g+i.height-i.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),x},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(!(e>n.lastRow+1)&&!(t<n.firstRow)){if(t===1/0){this.$showGutter&&this.$gutterLayer.update(n),this.$textLayer.update(n);return}return this.$textLayer.updateLines(n,e,t),!0}}},e.prototype.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},e.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},e.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},e.prototype.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},e.prototype.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},e.prototype.updateBreakpoints=function(e){this._rows=e,this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},e.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},e.prototype.showCursor=function(){this.$cursorLayer.showCursor()},e.prototype.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},e.prototype.scrollCursorIntoView=function(e,t,n){if(0!==this.$size.scrollerHeight){var i=this.$cursorLayer.getPixelPosition(e),r=i.left,o=i.top,s=n&&n.top||0,a=n&&n.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var l=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;l+s>o?(t&&l+s>o+this.lineHeight&&(o-=t*this.$size.scrollerHeight),0===o&&(o=-this.scrollMargin.top),this.session.setScrollTop(o)):l+this.$size.scrollerHeight-a<o+this.lineHeight&&(t&&l+this.$size.scrollerHeight-a<o-this.lineHeight&&(o+=t*this.$size.scrollerHeight),this.session.setScrollTop(o+this.lineHeight+a-this.$size.scrollerHeight));var c=this.scrollLeft,u=2*this.layerConfig.characterWidth;r-u<c?((r-=u)<this.$padding+u&&(r=-this.scrollMargin.left),this.session.setScrollLeft(r)):(r+=u,c+this.$size.scrollerWidth<r+this.characterWidth?this.session.setScrollLeft(Math.round(r+this.characterWidth-this.$size.scrollerWidth)):c<=this.$padding&&r-c<this.characterWidth&&this.session.setScrollLeft(0))}},e.prototype.getScrollTop=function(){return this.session.getScrollTop()},e.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},e.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},e.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},e.prototype.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},e.prototype.alignCursor=function(e,t){"number"==typeof e&&(e={row:e,column:0});var n=this.$cursorLayer.getPixelPosition(e),i=this.$size.scrollerHeight-this.lineHeight,r=n.top-i*(t||0);return this.session.setScrollTop(r),r},e.prototype.$calcSteps=function(e,t){var n=0,i=this.STEPS,r=[],o=function(e,t,n){return n*(Math.pow(e-1,3)+1)+t};for(n=0;n<i;++n)r.push(o(n/this.STEPS,e,t-e));return r},e.prototype.scrollToLine=function(e,t,n,i){var r=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;t&&(r-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(r),!1!==n&&this.animateScrolling(o,i)},e.prototype.animateScrolling=function(e,t){var n=this.scrollTop;if(this.$animatedScroll){var i=this;if(e!=n){if(this.$scrollAnimation){var r=this.$scrollAnimation.steps;if(r.length&&(e=r[0])==n)return}var o=i.$calcSteps(e,n);this.$scrollAnimation={from:e,to:n,steps:o},clearInterval(this.$timer),i.session.setScrollTop(o.shift()),i.session.$scrollTop=n,this.$timer=setInterval(function(){return i.$stopAnimation?void s():i.session?void(o.length?(i.session.setScrollTop(o.shift()),i.session.$scrollTop=n):null!=n?(i.session.$scrollTop=-1,i.session.setScrollTop(n),n=null):s()):clearInterval(i.$timer)},10)}}function s(){i.$timer=clearInterval(i.$timer),i.$scrollAnimation=null,i.$stopAnimation=!1,t&&t()}},e.prototype.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},e.prototype.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},e.prototype.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(e)},e.prototype.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},e.prototype.isScrollableBy=function(e,t){if(t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},e.prototype.pixelToScreenCoordinates=function(e,t){if(this.$hasCssTransforms){var n={top:0,left:0},i=this.$fontMetrics.transformCoordinates([e,t]);e=i[1]-this.gutterWidth-this.margin.left,t=i[0]}else n=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-n.left-this.$padding,o=r/this.characterWidth,s=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),a=this.$blockCursor?Math.floor(o):Math.round(o);return{row:s,column:a,side:o-a>0?1:-1,offsetX:r}},e.prototype.screenToTextCoordinates=function(e,t){if(this.$hasCssTransforms){var n={top:0,left:0},i=this.$fontMetrics.transformCoordinates([e,t]);e=i[1]-this.gutterWidth-this.margin.left,t=i[0]}else n=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-n.left-this.$padding,o=r/this.characterWidth,s=this.$blockCursor?Math.floor(o):Math.round(o),a=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(a,Math.max(s,0),r)},e.prototype.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),i=this.session.documentToScreenPosition(e,t),r=this.$padding+(this.session.$bidiHandler.isBidiRow(i.row,e)?this.session.$bidiHandler.getPosLeft(i.column):Math.round(i.column*this.characterWidth)),o=i.row*this.lineHeight;return{pageX:n.left+r-this.scrollLeft,pageY:n.top+o-this.scrollTop}},e.prototype.visualizeFocus=function(){r.addCssClass(this.container,"ace_focus")},e.prototype.visualizeBlur=function(){r.removeCssClass(this.container,"ace_focus")},e.prototype.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),void 0==e.useTextareaForIME&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(r.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},e.prototype.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},e.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),r.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},e.prototype.setGhostText=function(e,t){var n=this.session.selection.cursor,i=t||{row:n.row,column:n.column};this.removeGhostText();var o=this.$calculateWrappedTextChunks(e,i);this.addToken(o[0].text,"ghost_text",i.row,i.column),this.$ghostText={text:e,position:{row:i.row,column:i.column}};var s=r.createElement("div");if(o.length>1){var a,l=this.hideTokensAfterPosition(i.row,i.column);o.slice(1).forEach(function(e){var t=r.createElement("div"),n=r.createElement("span");n.className="ace_ghost_text",e.wrapped&&(t.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),n.appendChild(r.createTextNode(e.text)),t.appendChild(n),s.appendChild(t),a=t}),l.forEach(function(e){var t=r.createElement("span");x(e.type)||(t.className="ace_"+e.type.replace(/\./g," ace_")),t.appendChild(r.createTextNode(e.value)),a.appendChild(t)}),this.$ghostTextWidget={el:s,row:i.row,column:i.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var c=this.$cursorLayer.getPixelPosition(i,!0),u=this.container.getBoundingClientRect().height,d=o.length*this.lineHeight;if(d<u-c.top)return;d<u?this.scrollBy(0,(o.length-1)*this.lineHeight):this.scrollToRow(i.row)}},e.prototype.$calculateWrappedTextChunks=function(e,t){var n=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;n=n<=0?60:n;for(var i=e.split(/\r?\n/),r=[],o=0;o<i.length;o++){var s=this.session.$getDisplayTokens(i[o],t.column),a=this.session.$computeWrapSplits(s,n,this.session.$tabSize);if(a.length>0){var l=0;a.push(i[o].length);for(var c=0;c<a.length;c++){var u=i[o].slice(l,a[c]);r.push({text:u,wrapped:!0}),l=a[c]}}else r.push({text:i[o],wrapped:!1})}return r},e.prototype.removeGhostText=function(){if(this.$ghostText){var e=this.$ghostText.position;this.removeExtraToken(e.row,e.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},e.prototype.addToken=function(e,t,n,i){var r=this.session;r.bgTokenizer.lines[n]=null;var o={type:t,value:e},s=r.getTokens(n);if(null!=i&&s.length)for(var a=0,l=0;l<s.length;l++){var c=s[l];if(i<=(a+=c.value.length)){var u=c.value.length-(a-i),d=c.value.slice(0,u),h=c.value.slice(u);s.splice(l,1,{type:c.type,value:d},o,{type:c.type,value:h});break}}else s.push(o);this.updateLines(n,n)},e.prototype.hideTokensAfterPosition=function(e,t){for(var n=this.session.getTokens(e),i=0,r=!1,o=[],s=0;s<n.length;s++){var a=n[s];if(i+=a.value.length,"ghost_text"!==a.type){if(r){o.push({type:a.type,value:a.value}),a.type="hidden_token";continue}i===t&&(r=!0)}}return this.updateLines(e,e),o},e.prototype.removeExtraToken=function(e,t){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,t){var n=this;if(this.$themeId=e,n._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)o(e);else{var i=e||this.$options.theme.initialValue;s.loadModule(["theme",i],o)}function o(i){if(n.$themeId!=e)return t&&t();if(!i||!i.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");i.$id&&(n.$themeId=i.$id),r.importCssString(i.cssText,i.cssClass,n.container),n.theme&&r.removeCssClass(n.container,n.theme.cssClass);var o="padding"in i?i.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&o!=n.$padding&&n.setPadding(o),n.$theme=i.cssClass,n.theme=i,r.addCssClass(n.container,i.cssClass),r.setCssClass(n.container,"ace_dark",i.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:i}),t&&t(),w.isSafari&&n.scroller&&(n.scroller.style.background="red",n.scroller.style.background="")}},e.prototype.getTheme=function(){return this.$themeId},e.prototype.setStyle=function(e,t){r.setCssClass(this.container,e,!1!==t)},e.prototype.unsetStyle=function(e){r.removeCssClass(this.container,e)},e.prototype.setCursorStyle=function(e){r.setStyle(this.scroller.style,"cursor",e)},e.prototype.setMouseCursor=function(e){r.setStyle(this.scroller.style,"cursor",e)},e.prototype.attachToShadowRoot=function(){r.importCssString(b,"ace_editor.css",this.container)},e.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},e.prototype.$updateCustomScrollbar=function(e){var t=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,!0===e?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new p(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}),this.$scrollDecorator=new y(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new h(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}))},e.prototype.$addResizeObserver=function(){if(window.ResizeObserver&&!this.$resizeObserver){var e=this;this.$resizeTimer=o.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(t){var n=t[0].contentRect.width,i=t[0].contentRect.height;Math.abs(e.$size.width-n)>1||Math.abs(e.$size.height-i)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();$.prototype.CHANGE_CURSOR=1,$.prototype.CHANGE_MARKER=2,$.prototype.CHANGE_GUTTER=4,$.prototype.CHANGE_SCROLL=8,$.prototype.CHANGE_LINES=16,$.prototype.CHANGE_TEXT=32,$.prototype.CHANGE_SIZE=64,$.prototype.CHANGE_MARKER_BACK=128,$.prototype.CHANGE_MARKER_FRONT=256,$.prototype.CHANGE_FULL=512,$.prototype.CHANGE_H_SCROLL=1024,$.prototype.$changes=0,$.prototype.$padding=null,$.prototype.$frozen=!1,$.prototype.STEPS=8,i.implement($.prototype,v),s.defineOptions($.prototype,"renderer",{useResizeObserver:{set:function(e){!e&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):e&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(e){this.$gutterLayer.$useSvgGutterIcons=e},initialValue:!1},showFoldedAnnotations:{set:function(e){this.$gutterLayer.$showFoldedAnnotations=e},initialValue:!1},fadeFoldWidgets:{set:function(e){r.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(e){!0==this.$textLayer.setHighlightIndentGuides(e)?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<0x1ffffffffffff||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(e){this.$updateCustomScrollbar(e)},initialValue:!1},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!w.isMobile&&!w.isIE}}),t.VirtualRenderer=$}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,n){"use strict";var i=e("../lib/oop"),r=e("../lib/net"),o=e("../lib/event_emitter").EventEmitter,s=e("../config");function a(e){var t="importScripts('"+r.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(e){var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return n.append(t),n.getBlob("application/javascript")}}function l(e){if("u"<typeof Worker)return{postMessage:function(){},terminate:function(){}};if(s.get("loadWorkerFromBlob")){var t=a(e);return new Worker((window.URL||window.webkitURL).createObjectURL(t))}return new Worker(e)}var c=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){i.implement(this,o),this.$createWorkerFromOldConfig=function(t,n,i,r,o){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),s.get("packaged")||!e.toUrl)r=r||s.moduleUrl(n,"worker");else{var a=this.$normalizePath;r=r||a(e.toUrl("ace/worker/worker.js",null,"_"));var c={};t.forEach(function(t){c[t]=a(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=l(r),o&&this.send("importScripts",o),this.$worker.postMessage({init:!0,tlns:c,module:n,classname:i}),this.$worker},this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var n=this.callbacks[t.id];n&&(n(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return r.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(e){e.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,n){if(n){var i=this.callbackId++;this.callbacks[i]=n,t.push(i)}this.send(e,t)},this.emit=function(e,t){try{t.data&&t.data.err&&(t.data.err={message:t.data.err.message,stack:t.data.err.stack,code:t.data.err.code}),this.$worker&&this.$worker.postMessage({event:e,data:{data:t.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener,!0)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(c.prototype),t.UIWorkerClient=function(e,t,n){var i=null,r=!1,a=Object.create(o),l=[],u=new c({messageBuffer:l,terminate:function(){},postMessage:function(e){l.push(e),i&&(r?setTimeout(d):d())}});u.setEmitSync=function(e){r=e};var d=function(){var e=l.shift();e.command?i[e.command].apply(i,e.args):e.event&&a._signal(e.event,e.data)};return a.postMessage=function(e){u.onMessage({data:e})},a.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},a.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},s.loadModule(["worker",t],function(e){for(i=new e[n](a);l.length;)d()}),u},t.WorkerClient=c,t.createWorker=l}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var i=e("./range").Range,r=e("./lib/event_emitter").EventEmitter,o=e("./lib/oop"),s=function(){function e(e,t,n,i,r,o){var s=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=r,this.othersClass=o,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=i,this.$onCursorChange=function(){setTimeout(function(){s.onCursorChange()})},this.$pos=n;var a=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=a.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return e.prototype.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var r=this.pos;r.$insertRight=!0,r.detach(),r.markerId=n.addMarker(new i(r.row,r.column,r.row,r.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var i=t.createAnchor(n.row,n.column);i.$insertRight=!0,i.detach(),e.others.push(i)}),n.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new i(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})}},e.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},e.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var n="insert"===e.action?t.end.column-t.start.column:t.start.column-t.end.column,r=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,o=t.start.column-this.pos.column;if(this.updateAnchors(e),r&&(this.length+=n),r&&!this.session.$fromUndo){if("insert"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.insertMergedLines(l,e.lines)}else if("remove"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.remove(new i(l.row,l.column,l.row,l.column-n))}}this.$updating=!1,this.updateMarkers()}},e.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},e.prototype.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,n=function(n,r){t.removeMarker(n.markerId),n.markerId=t.addMarker(new i(n.row,n.column,n.row,n.column+e.length),r,null,!1)};n(this.pos,this.mainClass);for(var r=this.others.length;r--;)n(this.others[r],this.othersClass)}},e.prototype.onCursorChange=function(e){if(!this.$updating&&this.session){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},e.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},e.prototype.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,n=0;n<t;n++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();o.implement(s.prototype,r),t.PlaceHolder=s}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){var i=e("../lib/event"),r=e("../lib/useragent");function o(e,t){return e.row==t.row&&e.column==t.column}t.onMouseDown=function(e){var t=e.domEvent,n=t.altKey,s=t.shiftKey,a=t.ctrlKey,l=e.getAccelKey(),c=e.getButton();if(a&&r.isMac&&(c=t.button),e.editor.inMultiSelectMode&&2==c)return void e.editor.textInput.onContextMenu(e.domEvent);if(!a&&!n&&!l){0===c&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===c){var u=e.editor,d=u.selection,h=u.inMultiSelectMode,p=e.getDocumentPosition(),f=d.getCursor(),g=e.inSelection()||d.isEmpty()&&o(p,f),m=e.x,v=e.y,b=function(e){m=e.clientX,v=e.clientY},y=u.session,w=u.renderer.pixelToScreenCoordinates(m,v),x=w;if(u.$mouseHandler.$enableJumpToDef)a&&n||l&&n?S=s?"block":"add":n&&u.$blockSelectEnabled&&(S="block");else if(l&&!n){if(S="add",!h&&s)return}else n&&u.$blockSelectEnabled&&(S="block");if(S&&r.isMac&&t.ctrlKey&&u.$mouseHandler.cancelContextMenu(),"add"==S){if(!h&&g)return;if(!h){var $=d.toOrientedRange();u.addSelectionMarker($)}var _=d.rangeList.rangeAtPoint(p);u.inVirtualSelectionMode=!0,s&&(_=null,$=d.ranges[0]||$,u.removeSelectionMarker($)),u.once("mouseup",function(){var e=d.toOrientedRange();_&&e.isEmpty()&&o(_.cursor,e.cursor)?d.substractPoint(e.cursor):(s?d.substractPoint($.cursor):$&&(u.removeSelectionMarker($),d.addRange($)),d.addRange(e)),u.inVirtualSelectionMode=!1})}else if("block"==S){e.stop(),u.inVirtualSelectionMode=!0;var S,M,C=[],E=function(){var e=u.renderer.pixelToScreenCoordinates(m,v),t=y.screenToDocumentPosition(e.row,e.column,e.offsetX);o(x,e)&&o(t,d.lead)||(x=e,u.selection.moveToPosition(t),u.renderer.scrollCursorIntoView(),u.removeSelectionMarkers(C),C=d.rectangularRangeBlock(x,w),u.$mouseHandler.$clickSelection&&1==C.length&&C[0].isEmpty()&&(C[0]=u.$mouseHandler.$clickSelection.clone()),C.forEach(u.addSelectionMarker,u),u.updateSelectionMarkers())};h&&!l?d.toSingleRange():!h&&l&&(M=d.toOrientedRange(),u.addSelectionMarker(M)),s?w=y.documentToScreenPosition(d.lead):d.moveToPosition(p),x={row:-1,column:-1};var k=function(e){E(),clearInterval(T),u.removeSelectionMarkers(C),C.length||(C=[d.toOrientedRange()]),M&&(u.removeSelectionMarker(M),d.toSingleRange(M));for(var t=0;t<C.length;t++)d.addRange(C[t]);u.inVirtualSelectionMode=!1,u.$mouseHandler.$clickSelection=null},A=E;i.capture(u.container,b,k);var T=setInterval(function(){A()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,t,n){t.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(e){e.multiSelect.rangeCount>1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}],t.keyboardHandler=new(e("../keyboard/hash_handler")).HashHandler(t.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,t,n){var i=e("./range_list").RangeList,r=e("./range").Range,o=e("./selection").Selection,s=e("./mouse/multi_select_handler").onMouseDown,a=e("./lib/event"),l=e("./lib/lang"),c=e("./commands/multi_select_commands");t.commands=c.defaultCommands.concat(c.multiSelectCommands);var u=new(e("./search")).Search;function d(e,t,n){return u.$options.wrap=!0,u.$options.needle=t,u.$options.backwards=-1==n,u.find(e)}(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(e("./edit_session").EditSession.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var n=this.toOrientedRange();if(this.rangeList.add(n),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(n),this.$onAddRange(n)}e.cursor||(e.cursor=e.end);var i=this.rangeList.add(e);return this.$onAddRange(e),i.length&&this.$onRemoveRange(i),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var i=this.ranges.indexOf(e[n]);this.ranges.splice(i,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(t=t||this.ranges[0])&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new i,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var e=this.ranges.length?this.ranges:[this.getRange()],t=[],n=0;n<e.length;n++){var i=e[n],o=i.start.row,s=i.end.row;if(o===s)t.push(i.clone());else{for(t.push(new r(o,i.start.column,o,this.session.getLine(o).length));++o<s;)t.push(this.getLineRange(o,!0));t.push(new r(s,0,s,i.end.column))}0!=n||this.isBackwards()||(t=t.reverse())}this.toSingleRange();for(var n=t.length;n--;)this.addRange(t[n])},this.joinSelections=function(){var e=this.rangeList.ranges,t=e[e.length-1],n=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var i=this.session.documentToScreenPosition(this.cursor),o=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(i,o).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var i,o=[],s=e.column<t.column;if(s)var a=e.column,l=t.column,c=e.offsetX,u=t.offsetX;else var a=t.column,l=e.column,c=t.offsetX,u=e.offsetX;var d=e.row<t.row;if(d)var h=e.row,f=t.row;else var h=t.row,f=e.row;a<0&&(a=0),h<0&&(h=0),h==f&&(n=!0);for(var g=h;g<=f;g++){var m=r.fromPoints(this.session.screenToDocumentPosition(g,a,c),this.session.screenToDocumentPosition(g,l,u));if(m.isEmpty()){if(i&&p(m.end,i))break;i=m.end}m.cursor=s?m.start:m.end,o.push(m)}if(d&&o.reverse(),!n){for(var v=o.length-1;o[v].isEmpty()&&v>0;)v--;if(v>0)for(var b=0;o[b].isEmpty();)b++;for(var y=v;y>=b;y--)o[y].isEmpty()&&o.splice(y,1)}return o}}).call(o.prototype);var h=e("./editor").Editor;function p(e,t){return e.row==t.row&&e.column==t.column}function f(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",s),e.commands.addCommands(c.defaultCommands),g(e))}function g(e){if(e.textInput){var t=e.textInput.getElement(),n=!1;a.addListener(t,"keydown",function(t){var r=18==t.keyCode&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&r?n||(e.renderer.setMouseCursor("crosshair"),n=!0):n&&i()},e),a.addListener(t,"keyup",i,e),a.addListener(t,"blur",i,e)}function i(t){n&&(e.renderer.setMouseCursor(""),n=!1)}}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,n=e.length;n--;){var i=e[n];if(i.marker){this.session.removeMarker(i.marker);var r=t.indexOf(i);-1!=r&&t.splice(r,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(c.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(c.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(n.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?i=n.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?i=n.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(n.exitMultiSelectMode(),i=t.exec(n,e.args||{})):i=t.multiSelectAction(n,e.args||{});else{var i=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}return i}},this.forEachSelection=function(e,t,n){if(!this.inVirtualSelectionMode){var i,r=n&&n.keepOrder,s=!0==n||n&&n.$byLines,a=this.session,l=this.selection,c=l.rangeList,u=(r?l:c).ranges;if(!u.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var d=l._eventRegistry;l._eventRegistry={};var h=new o(a);this.inVirtualSelectionMode=!0;for(var p=u.length;p--;){if(s)for(;p>0&&u[p].start.row==u[p-1].end.row;)p--;h.fromOrientedRange(u[p]),h.index=p,this.selection=a.selection=h;var f=e.exec?e.exec(this,t||{}):e(this,t||{});i||void 0===f||(i=f),h.toOrientedRange(u[p])}h.detach(),this.selection=a.selection=l,this.inVirtualSelectionMode=!1,l._eventRegistry=d,l.mergeOverlappingRanges(),l.ranges[0]&&l.fromOrientedRange(l.ranges[0]);var g=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),g&&g.from==g.to&&this.renderer.animateScrolling(g.from),i}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,n=[],i=0;i<t.length;i++)n.push(this.session.getTextRange(t[i]));var r=this.session.getDocument().getNewLineCharacter();(e=n.join(r)).length==(n.length-1)*r.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,t){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var n=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||t!=this.multiSelect.anchor){var i=t==this.multiSelect.anchor?n.cursor==n.start?n.end:n.start:n.cursor;i.row!=t.row||this.session.$clipPositionToDocument(i.row,i.column).column!=t.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,t,n){if((t=t||{}).needle=e||t.needle,void 0==t.needle){var i=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(i)}this.$search.set(t);var r=this.$search.findAll(this.session);if(!r.length)return 0;var o=this.multiSelect;n||o.toSingleRange(r[0]);for(var s=r.length;s--;)o.addRange(r[s],!0);return i&&o.rangeList.rangeAtPoint(i.start)&&o.addRange(i,!0),r.length},this.selectMoreLines=function(e,t){var n=this.selection.toOrientedRange(),i=n.cursor==n.end,o=this.session.documentToScreenPosition(n.cursor);this.selection.$desiredColumn&&(o.column=this.selection.$desiredColumn);var s=this.session.screenToDocumentPosition(o.row+e,o.column);if(n.isEmpty())var a=s;else var l=this.session.documentToScreenPosition(i?n.end:n.start),a=this.session.screenToDocumentPosition(l.row+e,l.column);if(i){var c=r.fromPoints(s,a);c.cursor=c.start}else{var c=r.fromPoints(a,s);c.cursor=c.end}if(c.desiredColumn=o.column,this.selection.inMultiSelectMode){if(t)var u=n.cursor}else this.selection.addRange(n);this.selection.addRange(c),u&&this.selection.substractPoint(u)},this.transposeSelections=function(e){for(var t=this.session,n=t.multiSelect,i=n.ranges,r=i.length;r--;){var o=i[r];if(o.isEmpty()){var s=t.getWordRange(o.start.row,o.start.column);o.start.row=s.start.row,o.start.column=s.start.column,o.end.row=s.end.row,o.end.column=s.end.column}}n.mergeOverlappingRanges();for(var a=[],r=i.length;r--;){var o=i[r];a.unshift(t.getTextRange(o))}e<0?a.unshift(a.pop()):a.push(a.shift());for(var r=i.length;r--;){var o=i[r],l=o.clone();t.replace(o,a[r]),o.start.row=l.start.row,o.start.column=l.start.column}n.fromOrientedRange(n.ranges[0])},this.selectMore=function(e,t,n){var i=this.session,r=i.multiSelect.toOrientedRange();if(!r.isEmpty()||((r=i.getWordRange(r.start.row,r.start.column)).cursor=-1==e?r.start:r.end,this.multiSelect.addRange(r),!n)){var o=i.getTextRange(r),s=d(i,o,e);s&&(s.cursor=-1==e?s.start:s.end,this.session.unfold(s),this.multiSelect.addRange(s),this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(r.cursor)}},this.alignCursors=function(){var e=this.session,t=e.multiSelect,n=t.ranges,i=-1,o=n.filter(function(e){if(e.cursor.row==i)return!0;i=e.cursor.row});if(n.length&&o.length!=n.length-1){o.forEach(function(e){t.substractPoint(e.cursor)});var s=0,a=1/0,c=n.map(function(t){var n=t.cursor,i=e.getLine(n.row).substr(n.column).search(/\S/g);return -1==i&&(i=0),n.column>s&&(s=n.column),i<a&&(a=i),i});n.forEach(function(t,n){var i=t.cursor,o=s-i.column,u=c[n]-a;o>u?e.insert(i,l.stringRepeat(" ",o-u)):e.remove(new r(i.row,i.column,i.row,i.column-o+u)),t.start.column=t.end.column=s,t.start.row=t.end.row=i.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var u=this.selection.getRange(),d=u.start.row,h=u.end.row,p=d==h;if(p){var f,g=this.session.getLength();do f=this.session.getLine(h);while(/[=:]/.test(f)&&++h<g);do f=this.session.getLine(d);while(/[=:]/.test(f)&&--d>0);d<0&&(d=0),h>=g&&(h=g-1)}var m=this.session.removeFullLines(d,h);m=this.$reAlignText(m,p),this.session.insert({row:d,column:0},m.join("\n")+"\n"),p||(u.start.column=0,u.end.column=m[m.length-1].length),this.selection.setRange(u)}},this.$reAlignText=function(e,t){var n,i,r,o=!0,s=!0;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?(null==n?(n=t[1].length,i=t[2].length,r=t[3].length):(n+i+r!=t[1].length+t[2].length+t[3].length&&(s=!1),n!=t[1].length&&(o=!1),n>t[1].length&&(n=t[1].length),i<t[2].length&&(i=t[2].length),r>t[3].length&&(r=t[3].length)),t):[e]}).map(t?c:o?s?u:c:d);function a(e){return l.stringRepeat(" ",e)}function c(e){return e[2]?a(n)+e[2]+a(i-e[2].length+r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function u(e){return e[2]?a(n+i-e[2].length)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function d(e){return e[2]?a(n)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(h.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=f,e("./config").defineOptions(h.prototype,"editor",{enableMultiselect:{set:function(e){f(this),e?this.on("mousedown",s):this.off("mousedown",s)},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var i=e.getLine(n);return this.foldingStartMarker.test(i)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(i)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var r=/\S/,o=e.getLine(t),s=o.search(r);if(-1!=s){for(var a=n||o.length,l=e.getLength(),c=t,u=t;++t<l;){var d=e.getLine(t).search(r);if(-1!=d){if(d<=s){var h=e.getTokenAt(t,0);if(!h||"string"!==h.type)break}u=t}}if(u>c){var p=e.getLine(u).length;return new i(c,a,u,p)}}},this.openingBracketBlock=function(e,t,n,r,o){var s={row:n,column:r+1},a=e.$findClosingBracket(t,s,o);if(a){var l=e.foldWidgets[a.row];return null==l&&(l=e.getFoldWidget(a.row)),"start"==l&&a.row>s.row&&(a.row--,a.column=e.getLine(a.row).length),i.fromPoints(s,a)}},this.closingBracketBlock=function(e,t,n,r,o){var s={row:n,column:r},a=e.$findOpeningBracket(t,s);if(a)return a.column++,s.column--,i.fromPoints(a,s)}}).call((t.FoldMode=function(){}).prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range","ace/config"],function(e,t,n){"use strict";var i=e("../line_widgets").LineWidgets,r=e("../lib/dom"),o=e("../range").Range,s=e("../config").nls;function a(e,t,n){for(var i=0,r=e.length-1;i<=r;){var o=i+r>>1,s=n(t,e[o]);if(s>0)i=o+1;else{if(!(s<0))return o;r=o-1}}return-(i+1)}function l(e,t,n){var i=e.getAnnotations().sort(o.comparePoints);if(i.length){var r=a(i,{row:t,column:-1},o.comparePoints);r<0&&(r=-r-1),r>=i.length?r=n>0?0:i.length-1:0===r&&n<0&&(r=i.length-1);var s=i[r];if(s&&n){if(s.row===t){do s=i[r+=n];while(s&&s.row===t);if(!s)return i.slice()}var l=[];t=s.row;do l[n<0?"unshift":"push"](s),s=i[r+=n];while(s&&s.row==t);return l.length&&l}}}t.showErrorMarker=function(e,t){var n,o=e.session;o.widgetManager||(o.widgetManager=new i(o),o.widgetManager.attach(e));var a=e.getCursorPosition(),c=a.row,u=o.widgetManager.getWidgetsAtRow(c).filter(function(e){return"errorMarker"==e.type})[0];u?u.destroy():c-=t;var d=l(o,c,t);if(d){var h=d[0];a.column=(h.pos&&"number"!=typeof h.column?h.pos.sc:h.column)||0,a.row=h.row,n=e.renderer.$gutterLayer.$annotations[a.row]}else{if(u)return;n={displayText:[s("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(a.row),e.selection.moveToPosition(a);var p={row:a.row,fixedWidth:!0,coverGutter:!0,el:r.createElement("div"),type:"errorMarker"},f=p.el.appendChild(r.createElement("div")),g=p.el.appendChild(r.createElement("div"));g.className="error_widget_arrow "+n.className;var m=e.renderer.$cursorLayer.getPixelPosition(a).left;g.style.left=m+e.renderer.gutterWidth-5+"px",p.el.className="error_widget_wrapper",f.className="error_widget "+n.className,n.displayText.forEach(function(e,t){f.appendChild(r.createTextNode(e)),t<n.displayText.length-1&&f.appendChild(r.createElement("br"))}),f.appendChild(r.createElement("div"));var v=function(e,t,n){if(0===t&&("esc"===n||"return"===n))return p.destroy(),{command:"null"}};p.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(v),o.widgetManager.removeLineWidget(p),e.off("changeSelection",p.destroy),e.off("changeSession",p.destroy),e.off("mouseup",p.destroy),e.off("change",p.destroy))},e.keyBinding.addKeyboardHandler(v),e.on("changeSelection",p.destroy),e.on("changeSession",p.destroy),e.on("mouseup",p.destroy),e.on("change",p.destroy),e.session.widgetManager.addLineWidget(p),p.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:p.el.offsetHeight})},r.importCssString("\n .error_widget_wrapper {\n background: inherit;\n color: inherit;\n border:none\n }\n .error_widget {\n border-top: solid 2px;\n border-bottom: solid 2px;\n margin: 5px 0;\n padding: 10px 40px;\n white-space: pre-wrap;\n }\n .error_widget.ace_error, .error_widget_arrow.ace_error{\n border-color: #ff5a5a\n }\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n border-color: #F1D817\n }\n .error_widget.ace_info, .error_widget_arrow.ace_info{\n border-color: #5a5a5a\n }\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n border-color: #5aaa5a\n }\n .error_widget_arrow {\n position: absolute;\n border: solid 5px;\n border-top-color: transparent!important;\n border-right-color: transparent!important;\n border-left-color: transparent!important;\n top: -5px;\n }\n","error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(e,t,n){"use strict";e("./loader_build")(t);var i=e("./lib/dom"),r=e("./range").Range,o=e("./editor").Editor,s=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,l=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.edit=function(e,n){if("string"==typeof e){var r=e;if(!(e=document.getElementById(r)))throw Error("ace.edit can't find div #"+r)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var s="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;s=a.value,e=i.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(s=e.textContent,e.innerHTML="");var c=t.createEditSession(s),u=new o(new l(e),c,n),d={document:c,editor:u,onResize:u.resize.bind(u,null)};return a&&(d.textarea=a),u.on("destroy",function(){d.editor.container.env=null}),u.container.env=u.env=d,u},t.createEditSession=function(e,t){var n=new s(e,t);return n.setUndoManager(new a),n},t.Range=r,t.Editor=o,t.EditSession=s,t.UndoManager=a,t.VirtualRenderer=l,t.version=t.config.version}),function(){ace.require(["ace/ace"],function(t){t&&(t.config.init(!0),t.define=ace.define);var n=function(){return this}();for(var i in!n&&"u">typeof window&&(n=window),!n&&"u">typeof self&&(n=self),n.ace||(n.ace=t),t)t.hasOwnProperty(i)&&(n.ace[i]=t[i]);n.ace.default=n.ace,e&&(e.exports=n.ace)})}()},20047(e,t,n){e=n.nmd(e),ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(e,t,n){"use strict";var i=e("./lib/dom"),r=e("./lib/oop"),o=e("./lib/event_emitter").EventEmitter,s=e("./lib/lang"),a=e("./range").Range,l=e("./range_list").RangeList,c=e("./keyboard/hash_handler").HashHandler,u=e("./tokenizer").Tokenizer,d=e("./clipboard"),h={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,t,n){var i=e.session.getTextRange();return n?i.replace(/\n\r?([ \t]*\S)/g,"\n"+n+"$1"):i},CURRENT_LINE:function(e){return e.session.getLine(e.getCursorPosition().row)},PREV_LINE:function(e){return e.session.getLine(e.getCursorPosition().row-1)},LINE_INDEX:function(e){return e.getCursorPosition().row},LINE_NUMBER:function(e){return e.getCursorPosition().row+1},SOFT_TABS:function(e){return e.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(e){return e.session.getTabSize()},CLIPBOARD:function(e){return d.getText&&d.getText()},FILENAME:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0]},FILENAME_BASE:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(e){return this.FILEPATH(e).replace(/[^/\\]*$/,"")},FILEPATH:function(e){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(e){var t=e.session.$mode||{};return t.blockComment&&t.blockComment.start||""},BLOCK_COMMENT_END:function(e){var t=e.session.$mode||{};return t.blockComment&&t.blockComment.end||""},LINE_COMMENT:function(e){return(e.session.$mode||{}).lineCommentStart||""},CURRENT_YEAR:p.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:p.bind(null,{year:"2-digit"}),CURRENT_MONTH:p.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:p.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:p.bind(null,{month:"short"}),CURRENT_DATE:p.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:p.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:p.bind(null,{weekday:"short"}),CURRENT_HOUR:p.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:p.bind(null,{minute:"2-digit"}),CURRENT_SECOND:p.bind(null,{second:"2-digit"})};function p(e){var t=new Date().toLocaleString("en-us",e);return 1==t.length?"0"+t:t}h.SELECTED_TEXT=h.SELECTION;var f=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=h}return e.prototype.getTokenizer=function(){return e.$tokenizer||this.createTokenizer()},e.prototype.createTokenizer=function(){function t(e){return(e=e.substr(1),/^\d+$/.test(e))?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function n(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var i={regex:"/("+n("/")+"+)/",onMatch:function(e,t,n){var i=n[0];return i.fmtString=!0,i.guard=e.slice(1,-1),i.flag="",""},next:"formatString"};return e.$tokenizer=new u({start:[{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return"}"==i&&n.length?e=i:-1!="`$\\".indexOf(i)&&(e=i),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:t},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,n,i){var r=t(e.substr(1));return i.unshift(r[0]),r},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+n("\\|")+"*\\|",onMatch:function(e,t,n){var i=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return n[0].choices=i,[i[0]]},next:"start"},i,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectElse?(n[0].expectElse=!1,n[0].ifEnd={elseEnd:n[0]},[n[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return"}"==i&&n.length||-1!="`$\\".indexOf(i)?e=i:"n"==i?e="\n":"t"==i?e=" ":-1!="ulULE".indexOf(i)&&(e={changeCase:i,local:i>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,t,n){var i=n.shift();return i&&(i.flag=e.slice(1,-1)),this.next=i&&i.tabstopId?"start":"",[i||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,t,n){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,t,n){var i={text:e.slice(2)};return n.unshift(i),[i]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,t,n){var i=n.shift();return this.next=i&&i.tabstopId?"start":"",[i||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,t,n){return n[0].formatFunction=e.slice(2,-1),[n.shift()]},next:"formatString"},i,{regex:/:[\?\-+]?/,onMatch:function(e,t,n){"+"==e[1]&&(n[0].ifEnd=n[0]),"?"==e[1]&&(n[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),e.$tokenizer},e.prototype.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},e.prototype.getVariableValue=function(e,t,n){if(/^\d+$/.test(t))return(this.variables.__||{})[t]||"";if(/^[A-Z]\d+$/.test(t))return(this.variables[t[0]+"__"]||{})[t.substr(1)]||"";if(t=t.replace(/^TM_/,""),!this.variables.hasOwnProperty(t))return"";var i=this.variables[t];return"function"==typeof i&&(i=this.variables[t](e,t,n)),null==i?"":i},e.prototype.tmStrFormat=function(e,t,n){if(!t.fmt)return e;var i=t.flag||"",r=t.guard;r=new RegExp(r,i.replace(/[^gim]/g,""));var o="string"==typeof t.fmt?this.tokenizeTmSnippet(t.fmt,"formatString"):t.fmt,s=this;return e.replace(r,function(){var e=s.variables.__;s.variables.__=[].slice.call(arguments);for(var t=s.resolveVariables(o,n),i="E",r=0;r<t.length;r++){var a=t[r];if("object"==typeof a)if(t[r]="",a.changeCase&&a.local){var l=t[r+1];l&&"string"==typeof l&&("u"==a.changeCase?t[r]=l[0].toUpperCase():t[r]=l[0].toLowerCase(),t[r+1]=l.substr(1))}else a.changeCase&&(i=a.changeCase);else"U"==i?t[r]=a.toUpperCase():"L"==i&&(t[r]=a.toLowerCase())}return s.variables.__=e,t.join("")})},e.prototype.tmFormatFunction=function(e,t,n){return"upcase"==t.formatFunction?e.toUpperCase():"downcase"==t.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,t){for(var n=[],i="",r=!0,o=0;o<e.length;o++){var s=e[o];if("string"==typeof s){n.push(s),"\n"==s?(r=!0,i=""):r&&(i=/^\t*/.exec(s)[0],r=/\S/.test(s));continue}if(s){if(r=!1,s.fmtString){var a=e.indexOf(s,o+1);-1==a&&(a=e.length),s.fmt=e.slice(o+1,a),o=a}if(s.text){var l=this.getVariableValue(t,s.text,i)+"";s.fmtString&&(l=this.tmStrFormat(l,s,t)),s.formatFunction&&(l=this.tmFormatFunction(l,s,t)),l&&!s.ifEnd?(n.push(l),c(s)):!l&&s.ifEnd&&c(s.ifEnd)}else s.elseEnd?c(s.elseEnd):null!=s.tabstopId?n.push(s):null!=s.changeCase&&n.push(s)}}function c(t){var n=e.indexOf(t,o+1);-1!=n&&(o=n)}return n},e.prototype.getDisplayTextForSnippet=function(e,t){return g.call(this,e,t).text},e.prototype.insertSnippetForSelection=function(e,t,n){void 0===n&&(n={});var i=g.call(this,e,t,n),r=e.getSelectionRange(),o=e.session.replace(r,i.text),s=new m(e),a=e.inVirtualSelectionMode&&e.selection.index;s.addTabstops(i.tabstops,r.start,o,a)},e.prototype.insertSnippet=function(e,t,n){void 0===n&&(n={});var i=this;if(e.inVirtualSelectionMode)return i.insertSnippetForSelection(e,t,n);e.forEachSelection(function(){i.insertSnippetForSelection(e,t,n)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},e.prototype.$getScope=function(e){var t=e.session.$mode.$id||"";if("html"===(t=t.split("/").pop())||"php"===t){"php"!==t||e.session.$mode.inlinePhp||(t="html");var n=e.getCursorPosition(),i=e.session.getState(n.row);"object"==typeof i&&(i=i[0]),i.substring&&("js-"==i.substring(0,3)?t="javascript":"css-"==i.substring(0,4)?t="css":"php-"==i.substring(0,4)&&(t="php"))}return t},e.prototype.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],i=this.snippetMap;return i[t]&&i[t].includeScopes&&n.push.apply(n,i[t].includeScopes),n.push("_"),n},e.prototype.expandWithTab=function(e,t){var n=this,i=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return i&&e.tabstopManager&&e.tabstopManager.tabNext(),i},e.prototype.expandSnippetForSelection=function(e,t){var n,i=e.getCursorPosition(),r=e.session.getLine(i.row),o=r.substring(0,i.column),s=r.substr(i.column),a=this.snippetMap;return this.getActiveScopes(e).some(function(e){var t=a[e];return t&&(n=this.findMatchingSnippet(t,o,s)),!!n},this),!!n&&(!!t&&!!t.dryRun||(e.session.doc.removeInLine(i.row,i.column-n.replaceBefore.length,i.column+n.replaceAfter.length),this.variables.M__=n.matchBefore,this.variables.T__=n.matchAfter,this.insertSnippetForSelection(e,n.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,t,n){for(var i=e.length;i--;){var r=e[i];if((!r.startRe||r.startRe.test(t))&&(!r.endRe||r.endRe.test(n))&&(r.startRe||r.endRe))return r.matchBefore=r.startRe?r.startRe.exec(t):[""],r.matchAfter=r.endRe?r.endRe.exec(n):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(t)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(n)[0]:"",r}},e.prototype.register=function(e,t){var n=this.snippetMap,i=this.snippetNameMap,r=this;function o(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function a(e,t,n){return e=o(e),t=o(t),n?(e=t+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=t)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function l(e){e.scope||(e.scope=t||"_"),n[t=e.scope]||(n[t]=[],i[t]={});var o=i[t];if(e.name){var l=o[e.name];l&&r.unregister(l),o[e.name]=e}n[t].push(e),e.prefix&&(e.tabTrigger=e.prefix),!e.content&&e.body&&(e.content=Array.isArray(e.body)?e.body.join("\n"):e.body),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=s.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=a(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger),e.endRe=a(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger))}e||(e=[]),Array.isArray(e)?e.forEach(l):Object.keys(e).forEach(function(t){l(e[t])}),this._signal("registerSnippets",{scope:t})},e.prototype.unregister=function(e,t){var n=this.snippetMap,i=this.snippetNameMap;function r(e){var r=i[e.scope||t];if(r&&r[e.name]){delete r[e.name];var o=n[e.scope||t],s=o&&o.indexOf(e);s>=0&&o.splice(s,1)}}e.content?r(e):Array.isArray(e)&&e.forEach(r)},e.prototype.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var t,n=[],i={},r=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;t=r.exec(e);){if(t[1])try{i=JSON.parse(t[1]),n.push(i)}catch(e){}if(t[4])i.content=t[4].replace(/^\t/gm,""),n.push(i),i={};else{var o=t[2],s=t[3];if("regex"==o){var a=/\/((?:[^\/\\]|\\.)*)|$/g;i.guard=a.exec(s)[1],i.trigger=a.exec(s)[1],i.endTrigger=a.exec(s)[1],i.endGuard=a.exec(s)[1]}else"snippet"==o?(i.tabTrigger=s.match(/^\S*/)[0],i.name||(i.name=s)):o&&(i[o]=s)}}return n},e.prototype.getSnippetByName=function(e,t){var n,i=this.snippetNameMap;return this.getActiveScopes(t).some(function(t){var r=i[t];return r&&(n=r[e]),!!n},this),n},e}();r.implement(f.prototype,o);var g=function(e,t,n){void 0===n&&(n={});var i=e.getCursorPosition(),r=e.session.getLine(i.row),o=e.session.getTabString(),s=r.match(/^\s*/)[0];i.column<s.length&&(s=s.slice(0,i.column)),t=t.replace(/\r/g,"");var a=this.tokenizeTmSnippet(t);a=(a=this.resolveVariables(a,e)).map(function(e){return"\n"!=e||n.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,o):e:e+s});var l=[];a.forEach(function(e,t){if("object"==typeof e){var n=e.tabstopId,i=l[n];if(i||((i=l[n]=[]).index=n,i.value="",i.parents={}),-1===i.indexOf(e)){e.choices&&!i.choices&&(i.choices=e.choices),i.push(e);var r=a.indexOf(e,t+1);if(-1!==r){var o=a.slice(t+1,r),s=o.some(function(e){return"object"==typeof e});s&&!i.value?i.value=o:o.length&&(!i.value||"string"!=typeof i.value)&&(i.value=o.join(""))}}}}),l.forEach(function(e){e.length=0});var c={};function u(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];if("object"==typeof i){if(c[i.tabstopId])continue;i=t[e.lastIndexOf(i,n-1)]||{tabstopId:i.tabstopId}}t[n]=i}return t}for(var d=0;d<a.length;d++){var h=a[d];if("object"==typeof h){var p=h.tabstopId,f=l[p],g=a.indexOf(h,d+1);if(c[p]){c[p]===h&&(delete c[p],Object.keys(c).forEach(function(e){f.parents[e]=!0}));continue}c[p]=h;var m=f.value;"string"!=typeof m?m=u(m):h.fmt&&(m=this.tmStrFormat(m,h,e)),a.splice.apply(a,[d+1,Math.max(0,g-d)].concat(m,h)),-1===f.indexOf(h)&&f.push(h)}}var v=0,b=0,y="";return a.forEach(function(e){if("string"==typeof e){var t=e.split("\n");t.length>1?(b=t[t.length-1].length,v+=t.length-1):b+=e.length,y+=e}else e&&(e.start?e.end={row:v,column:b}:e.start={row:v,column:b})}),{text:y,tabstops:l,tokens:a}},m=function(){function e(e){if(this.index=0,this.ranges=[],this.tabstops=[],e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)}return e.prototype.attach=function(e){this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.session=e.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},e.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},e.prototype.onChange=function(e){for(var t="r"==e.action[0],n=this.selectedTabstop||{},i=n.parents||{},r=this.tabstops.slice(),o=0;o<r.length;o++){var s=r[o],a=s==n||i[s.index];if(s.rangeList.$bias=+!a,"remove"==e.action&&s!==n){var l=s.parents&&s.parents[n.index],c=s.rangeList.pointIndex(e.start,l);c=c<0?-c-1:c+1;var u=s.rangeList.pointIndex(e.end,l);u=u<0?-u-1:u-1;for(var d=s.rangeList.ranges.slice(c,u),h=0;h<d.length;h++)this.removeRange(d[h])}s.rangeList.$onChange(e)}var p=this.session;this.$inChange||!t||1!=p.getLength()||p.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var n=this.session,i=n.getTextRange(e.firstNonLinked),r=0;r<e.length;r++){var o=e[r];if(o.linked){var s=o.original,a=t.snippetManager.tmStrFormat(i,s,this.editor);n.replace(o,a)}}this.$inChange=!1}},e.prototype.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},e.prototype.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty(),i=0;i<this.ranges.length;i++)if(!this.ranges[i].linked){var r=this.ranges[i].contains(e.row,e.column),o=n||this.ranges[i].contains(t.row,t.column);if(r&&o)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);(n=Math.min(Math.max(n,1),t))==t&&(n=0),this.selectTabstop(n),this.updateTabstopMarkers(),0===n&&this.detach()},e.prototype.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];if(t&&this.addTabstopMarkers(t),this.index=e,(t=this.tabstops[this.index])&&t.length){this.selectedTabstop=t;var n=t.firstNonLinked||t;if(t.choices&&(n.cursor=n.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(n);else{var i=this.editor.multiSelect;i.toSingleRange(n);for(var r=0;r<t.length;r++)t.hasLinkedRanges&&t[r].linked||i.addRange(t[r].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},e.prototype.addTabstops=function(e,t,n){var i=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var r=a.fromPoints(n,n);b(r.start,t),b(r.end,t),e[0]=[r],e[0].index=0}var o=[this.index+1,0],s=this.ranges,c=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;r.snippetId=c;for(var u=0;u<e.length;u++){var d=e[u],h=a.fromPoints(d.start,d.end||d.start);v(h.start,t),v(h.end,t),h.original=d,h.tabstop=r,s.push(h),r!=e?r.unshift(h):r[u]=h,d.fmtString||r.firstNonLinked&&i?(h.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=h)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(o.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r),r.rangeList=r.rangeList||new l,r.rangeList.$bias=0,r.rangeList.addList(r)},this),o.length>2&&(this.tabstops.length&&o.push(o.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,o))},e.prototype.addTabstopMarkers=function(e){var t=this.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},e.prototype.removeTabstopMarkers=function(e){var t=this.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},e.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var e=this.selectedTabstop.snippetId;0===this.selectedTabstop.index&&e--,this.tabstops.forEach(function(t){t.snippetId===e?this.addTabstopMarkers(t):this.removeTabstopMarkers(t)},this)}},e.prototype.removeRange=function(e){var t=e.tabstop.indexOf(e);-1!=t&&e.tabstop.splice(t,1),-1!=(t=this.ranges.indexOf(e))&&this.ranges.splice(t,1),-1!=(t=e.tabstop.rangeList.ranges.indexOf(e))&&e.tabstop.splice(t,1),this.session.removeMarker(e.markerId),!e.tabstop.length&&(-1!=(t=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},e}();m.prototype.keyboardHandler=new c,m.prototype.keyboardHandler.bindKeys({Tab:function(e){t.snippetManager&&t.snippetManager.expandWithTab(e)||(e.tabstopManager.tabNext(1),e.renderer.scrollCursorIntoView())},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1),e.renderer.scrollCursorIntoView()},Esc:function(e){e.tabstopManager.detach()}});var v=function(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row},b=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};i.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}","snippets.css",!1),t.snippetManager=new f,(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(e("./editor").Editor.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../virtual_renderer").VirtualRenderer,r=e("../editor").Editor,o=e("../range").Range,s=e("../lib/event"),a=e("../lib/lang"),l=e("../lib/dom"),c=e("../config").nls,u=e("./../lib/useragent"),d=function(e){return"suggest-aria-id:".concat(e)},h=u.isSafari?"menu":"listbox",p=u.isSafari?"menuitem":"option",f=u.isSafari?"aria-current":"aria-selected",g=function(e){var t=new i(e);t.$maxLines=4;var n=new r(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusTimeout=0,n.$highlightTagPending=!0,n},m=function(){return function(e){var t,n=l.createElement("div"),i=g(n);e&&e.appendChild(n),n.style.display="none",i.renderer.content.style.cursor="default",i.renderer.setStyle("ace_autocomplete"),i.renderer.$textLayer.element.setAttribute("role",h),i.renderer.$textLayer.element.setAttribute("aria-roledescription",c("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),i.renderer.$textLayer.element.setAttribute("aria-label",c("autocomplete.popup.aria-label","Autocomplete suggestions")),i.renderer.textarea.setAttribute("aria-hidden","true"),i.setOption("displayIndentGuides",!1),i.setOption("dragDelay",150);var r=function(){};i.focus=r,i.$isFocused=!0,i.renderer.$cursorLayer.restartTimer=r,i.renderer.$cursorLayer.element.style.opacity="0",i.renderer.$maxLines=8,i.renderer.$keepTextAreaAtCursor=!1,i.setHighlightActiveLine(!1),i.session.highlight(""),i.session.$searchHighlight.clazz="ace_highlight-marker",i.on("mousedown",function(e){var t=e.getDocumentPosition();i.selection.moveToPosition(t),m.start.row=m.end.row=t.row,e.stop()});var u=new o(-1,0,-1,1/0),m=new o(-1,0,-1,1/0);m.id=i.session.addMarker(m,"ace_active-line","fullLine"),i.setSelectOnHover=function(e){e?u.id&&(i.session.removeMarker(u.id),u.id=null):u.id=i.session.addMarker(u,"ace_line-hover","fullLine")},i.setSelectOnHover(!1),i.on("mousemove",function(e){if(!t){t=e;return}if(t.x!=e.x||t.y!=e.y){t=e,t.scrollTop=i.renderer.scrollTop,i.isMouseOver=!0;var n=t.getDocumentPosition().row;u.start.row!=n&&(u.id||i.setRow(n),b(n))}}),i.renderer.on("beforeRender",function(){if(t&&-1!=u.start.row){t.$pos=null;var e=t.getDocumentPosition().row;u.id||i.setRow(e),b(e,!0)}}),i.renderer.on("afterRender",function(){var e=i.getRow(),t=i.renderer.$textLayer,n=t.element.childNodes[e-t.config.firstRow],r=document.activeElement;if(n!==i.selectedNode&&i.selectedNode&&(l.removeCssClass(i.selectedNode,"ace_selected"),r.removeAttribute("aria-activedescendant"),i.selectedNode.removeAttribute(f),i.selectedNode.removeAttribute("id")),i.selectedNode=n,n){l.addCssClass(n,"ace_selected");var o=d(e);n.id=o,t.element.setAttribute("aria-activedescendant",o),r.setAttribute("aria-activedescendant",o),n.setAttribute("role",p),n.setAttribute("aria-roledescription",c("autocomplete.popup.item.aria-roledescription","item")),n.setAttribute("aria-label",i.getData(e).caption||i.getData(e).value),n.setAttribute("aria-setsize",i.data.length),n.setAttribute("aria-posinset",e+1),n.setAttribute("aria-describedby","doc-tooltip"),n.setAttribute(f,"true")}});var v=function(){b(-1)},b=function(e,t){e!==u.start.row&&(u.start.row=u.end.row=e,t||i.session._emit("changeBackMarker"),i._emit("changeHoverMarker"))};i.getHoveredRow=function(){return u.start.row},s.addListener(i.container,"mouseout",function(){i.isMouseOver=!1,v()}),i.on("hide",v),i.on("changeSelection",v),i.session.doc.getLength=function(){return i.data.length},i.session.doc.getLine=function(e){var t=i.data[e];return"string"==typeof t?t:t&&t.value||""};var y=i.session.bgTokenizer;return y.$tokenizeRow=function(e){var t=i.data[e],n=[];if(!t)return n;"string"==typeof t&&(t={value:t});var r=t.caption||t.value||t.name;function o(e,i){e&&n.push({type:(t.className||"")+(i||""),value:e})}for(var s=r.toLowerCase(),a=(i.filterText||"").toLowerCase(),l=0,c=0,u=0;u<=a.length;u++)if(u!=c&&(t.matchMask&1<<u||u==a.length)){var d=a.slice(c,u);c=u;var h=s.indexOf(d,l);if(-1==h)continue;o(r.slice(l,h),""),l=h+d.length,o(r.slice(h,l),"completion-highlight")}return o(r.slice(l,r.length),""),n.push({type:"completion-spacer",value:" "}),t.meta&&n.push({type:"completion-meta",value:t.meta}),t.message&&n.push({type:"completion-message",value:t.message}),n},y.$updateOnChange=r,y.start=r,i.session.$computeWidth=function(){return this.screenWidth=0},i.isOpen=!1,i.isTopdown=!1,i.autoSelect=!0,i.filterText="",i.isMouseOver=!1,i.data=[],i.setData=function(e,t){i.filterText=t||"",i.setValue(a.stringRepeat("\n",e.length),-1),i.data=e||[],i.setRow(0)},i.getData=function(e){return i.data[e]},i.getRow=function(){return m.start.row},i.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),m.start.row!=e&&(i.selection.clearSelection(),m.start.row=m.end.row=e||0,i.session._emit("changeBackMarker"),i.moveCursorTo(e||0,0),i.isOpen&&i._signal("select"))},i.on("changeSelection",function(){i.isOpen&&i.setRow(i.selection.lead.row),i.renderer.scrollCursorIntoView()}),i.hide=function(){this.container.style.display="none",i.anchorPos=null,i.anchor=null,i.isOpen&&(i.isOpen=!1,this._signal("hide"))},i.tryShow=function(e,n,r,o){if(!o&&i.isOpen&&i.anchorPos&&i.anchor&&i.anchorPos.top===e.top&&i.anchorPos.left===e.left&&i.anchor===r)return!0;var s=this.container,a=window.innerHeight,l=window.innerWidth,c=this.renderer,u=c.$maxLines*n*1.4,d={top:0,bottom:0},h=a-e.top-3*this.$borderSize-n,p=e.top-3*this.$borderSize;r||(r=p<=h||h>=u?"bottom":"top"),"top"===r?(d.bottom=e.top-this.$borderSize,d.top=d.bottom-u):"bottom"===r&&(d.top=e.top+n+this.$borderSize,d.bottom=d.top+u);var f=d.top>=0&&d.bottom<=a;if(!o&&!f)return!1;f?c.$maxPixelHeight=null:"top"===r?c.$maxPixelHeight=p:c.$maxPixelHeight=h,"top"===r?(s.style.top="",s.style.bottom=a-d.bottom+"px",i.isTopdown=!1):(s.style.top=d.top+"px",s.style.bottom="",i.isTopdown=!0),s.style.display="";var g=e.left;return g+s.offsetWidth>l&&(g=l-s.offsetWidth),s.style.left=g+"px",s.style.right="",i.isOpen||(i.isOpen=!0,this._signal("show"),t=null),i.anchorPos=e,i.anchor=r,!0},i.show=function(e,t,n){this.tryShow(e,t,n?"bottom":void 0,!0)},i.goTo=function(e){var t=this.getRow(),n=this.session.getLength()-1;switch(e){case"up":t=t<=0?n:t-1;break;case"down":t=t>=n?-1:t+1;break;case"start":t=0;break;case"end":t=n}this.setRow(t)},i.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},i.$imageSize=0,i.$borderSize=1,i}}();l.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: "";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n',"autocompletion.css",!1),t.AcePopup=m,t.$singleLineEditor=g,t.getAriaId=d}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,t,n){"use strict";t.AceInlineScreenReader=function(){function e(e){this.editor=e,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return e.prototype.setScreenReaderContent=function(e){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",(function(){var e=this.popup.getRow(),t=this.popup.renderer.$textLayer,n=t.element.childNodes[e-t.config.firstRow];if(n){for(var i="doc-tooltip ",r=0;r<this._lines.length;r++)i+="ace-inline-screenreader-line-".concat(r," ");n.setAttribute("aria-describedby",i)}}).bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=e.split(/\r\n|\r|\n/);var t=this.createCodeBlock();this.screenReaderDiv.appendChild(t)},e.prototype.destroy=function(){this.screenReaderDiv.remove()},e.prototype.createCodeBlock=function(){var e=document.createElement("pre");e.setAttribute("id","ace-inline-screenreader");for(var t=0;t<this._lines.length;t++){var n=document.createElement("code");n.setAttribute("id","ace-inline-screenreader-line-".concat(t));var i=document.createTextNode(this._lines[t]);n.appendChild(i),e.appendChild(n)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,t,n){"use strict";var i=e("../snippets").snippetManager,r=e("./inline_screenreader").AceInlineScreenReader;t.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,t,n){if(n=n||"",e&&this.editor&&this.editor!==e&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!e||!t)return!1;this.inlineScreenReader||(this.inlineScreenReader=new r(e));var o=t.snippet?i.getDisplayTextForSnippet(e,t.snippet):t.value;return!t.hideInlinePreview&&!!o&&!!o.startsWith(n)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(o),""===(o=o.slice(n.length))?e.removeGhostText():e.setGhostText(o),!0)},e.prototype.isOpen=function(){return!!this.editor&&!!this.editor.renderer.$ghostText},e.prototype.hide=function(){return!!this.editor&&(this.editor.removeGhostText(),!0)},e.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},e}()}),ace.define("ace/autocomplete/util",["require","exports","module"],function(e,t,n){"use strict";t.parForEach=function(e,t,n){var i=0,r=e.length;0===r&&n();for(var o=0;o<r;o++)t(e[o],function(e,t){++i===r&&n(e,t)})};var i=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||i;for(var r=[],o=t-1;o>=0;o--)if(n.test(e[o]))r.push(e[o]);else break;return r.reverse().join("")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||i;for(var r=[],o=t;o<e.length;o++)if(n.test(e[o]))r.push(e[o]);else break;return r},t.getCompletionPrefix=function(e){var t,n=e.getCursorPosition(),i=e.session.getLine(n.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!t&&e&&(t=this.retrievePrecedingIdentifier(i,n.column,e))}).bind(this))}).bind(this)),t||this.retrievePrecedingIdentifier(i,n.column)},t.triggerAutocomplete=function(e,t){var t=null==t?e.session.getPrecedingCharacter():t;return e.completers.some(function(e){if(e.triggerCharacters&&Array.isArray(e.triggerCharacters))return e.triggerCharacters.includes(t)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(e,t,n){"use strict";var i=e("./keyboard/hash_handler").HashHandler,r=e("./autocomplete/popup").AcePopup,o=e("./autocomplete/inline").AceInline,s=e("./autocomplete/popup").getAriaId,a=e("./autocomplete/util"),l=e("./lib/lang"),c=e("./lib/dom"),u=e("./snippets").snippetManager,d=e("./config"),h=e("./lib/event"),p=e("./lib/scroll").preventParentScroll,f=function(e,t){t.completer&&t.completer.destroy()},g=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new i,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=l.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=l.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=l.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=l.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=l.delayedCall((function(){var t=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!t||0===this.editor.completers.length||(this.completions=new v(e.completionsForLoading),this.openPopup(this.editor,t.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}).bind(this),this.stickySelectionDelay)}return Object.defineProperty(e,"completionsForLoading",{get:function(){return[{caption:d.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),e.prototype.$init=function(){return this.popup=new r(this.parentNode||document.body||document.documentElement),this.popup.on("click",(function(e){this.insertMatch(),e.stop()}).bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),h.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},e.prototype.$initInline=function(){if(this.inlineEnabled&&!this.inlineRenderer)return this.inlineRenderer=new o,this.inlineRenderer},e.prototype.getPopup=function(){return this.popup||this.$init()},e.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},e.prototype.$seen=function(e){!this.hasSeen.has(e)&&e&&e.completer&&e.completer.onSeen&&"function"==typeof e.completer.onSeen&&(e.completer.onSeen(this.editor,e),this.hasSeen.add(e))},e.prototype.$onPopupChange=function(e){if(this.inlineRenderer&&this.inlineEnabled){var t=e?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(t),this.popup.isMouseOver&&this.setSelectOnHover)return void this.tooltipTimer.call(null,null);this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},e.prototype.$updateGhostText=function(e){var t=this.base.row,n=this.base.column,i=this.editor.getCursorPosition().column,r=this.editor.session.getLine(t).slice(n,i);this.inlineRenderer.show(this.editor,e,r)?this.$seen(e):this.inlineRenderer.hide()},e.prototype.$onPopupRender=function(){var e=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var t=this.popup.getFirstVisibleRow();t<=this.popup.getLastVisibleRow();t++){var n=this.popup.getData(t);n&&(!e||n.hideInlinePreview)&&this.$seen(n)}},e.prototype.$onPopupShow=function(e){this.$onPopupChange(e),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},e.prototype.observeLayoutChanges=function(){if(!this.$elements&&this.editor){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var e=this.editor.container.parentNode,t=[];e;)t.push(e),e.addEventListener("scroll",this.onLayoutChange,{passive:!0}),e=e.parentNode;this.$elements=t}},e.prototype.unObserveLayoutChanges=function(){var e=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(t){t.removeEventListener("scroll",e.onLayoutChange,{passive:!0})}),this.$elements=null},e.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},e.prototype.$updatePopupPosition=function(){var e=this.editor,t=e.renderer,n=t.layerConfig.lineHeight,i=t.$cursorLayer.getPixelPosition(this.base,!0);i.left-=this.popup.getTextLeftOffset();var r=e.container.getBoundingClientRect();i.top+=r.top-t.layerConfig.offset,i.left+=r.left-e.renderer.scrollLeft,i.left+=t.gutterWidth;var o={top:i.top,left:i.left};t.$ghostText&&t.$ghostTextWidget&&this.base.row===t.$ghostText.position.row&&(o.top+=t.$ghostTextWidget.el.offsetHeight);var s=e.container.getBoundingClientRect().bottom-n,a=s<o.top?{top:s,left:o.left}:o;this.popup.tryShow(a,n,"bottom")||this.popup.tryShow(i,n,"top")||this.popup.show(i,n)},e.prototype.openPopup=function(e,t,n){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var i,r=this.popup.getRow(),o=this.popup.data[r];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:s(this.popup.getRow()),inline:this.inlineEnabled}),e.keyBinding.addKeyboardHandler(this.keyboardHandler),this.stickySelection&&(i=this.popup.data.indexOf(o)),i&&-1!==i||(i=0),this.popup.setRow(this.autoSelect?i:-1),i===r&&o!==this.completions.filtered[i]&&this.$onPopupChange();var a=this.inlineRenderer&&this.inlineEnabled;if(i===r&&a){var l=this.popup.getData(this.popup.getRow());this.$updateGhostText(l)}!n&&(this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},e.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},e.prototype.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},e.prototype.blurListener=function(e){var t=document.activeElement,n=this.editor.textInput.getElement(),i=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),r=this.popup&&this.popup.container;t==n||t.parentNode==r||i||t==this.tooltipNode||e.relatedTarget==n||this.detach()},e.prototype.mousedownListener=function(e){this.detach()},e.prototype.mousewheelListener=function(e){this.popup&&!this.popup.isMouseOver&&this.detach()},e.prototype.mouseOutListener=function(e){this.popup.isOpen&&this.$updatePopupPosition()},e.prototype.goTo=function(e){this.popup.goTo(e)},e.prototype.insertMatch=function(e,t){if(e||(e=this.popup.getData(this.popup.getRow())),!e)return!1;if(""===e.value)return this.detach();var n=this.completions,i=this.getCompletionProvider().insertMatch(this.editor,e,n.filterText,t);return this.completions==n&&this.detach(),i},e.prototype.showPopup=function(e,t){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,t)},e.prototype.getCompletionProvider=function(e){return this.completionProvider||(this.completionProvider=new m(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,t){return this.getCompletionProvider().gatherCompletions(e,t)},e.prototype.updateCompletions=function(t,n){if(t&&this.base&&this.completions){var i=this.editor.getCursorPosition(),r=this.editor.session.getTextRange({start:this.base,end:i});return r==this.completions.filterText?void 0:(this.completions.setFilter(r),this.completions.filtered.length&&(1!=this.completions.filtered.length||this.completions.filtered[0].value!=r||this.completions.filtered[0].snippet))?void this.openPopup(this.editor,r,t):this.detach()}if(n&&n.matches){var i=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(i.row,i.column),this.base.$insertRight=!0,this.completions=new v(n.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",t)}var o=this.editor.getSession(),i=this.editor.getCursorPosition(),r=a.getCompletionPrefix(this.editor);this.base=o.doc.createAnchor(i.row,i.column-r.length),this.base.$insertRight=!0;var s={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:r,pos:i}).provideCompletions(this.editor,s,(function(n,i,r){var o=i.filtered,s=a.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),r){if(!o.length){var l=!this.autoShown&&this.emptyMessage;if("function"==typeof l&&(l=this.emptyMessage(s)),l){var c=[{caption:l,value:""}];this.completions=new v(c),this.openPopup(this.editor,s,t),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(1==o.length&&o[0].value==s&&!o[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==o.length)return this.insertMatch(o[0])}this.completions=!r&&this.showLoadingState?new v(e.completionsForLoading.concat(o),i.filterText):i,this.openPopup(this.editor,s,t),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!r)}).bind(this)),!this.showLoadingState||this.autoShown||this.popup&&this.popup.isOpen||this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},e.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},e.prototype.updateDocTooltip=function(){var e=this.popup,t=this.completions.filtered,n=t&&(t[e.getHoveredRow()]||t[e.getRow()]),i=null;if(!n||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var r=this.editor.completers.length,o=0;o<r;o++){var s=this.editor.completers[o];if(s.getDocTooltip&&n.completerId===s.id){i=s.getDocTooltip(n);break}}if(i||"string"==typeof n||(i=n),"string"==typeof i&&(i={docText:i}),!i||!(i.docHTML||i.docText))return this.hideDocTooltip();this.showDocTooltip(i)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=c.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",p));var t=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(t.isDark?"ace_dark ":"")+(t.cssClass||"");var n=this.tooltipNode;e.docHTML?n.innerHTML=e.docHTML:e.docText&&(n.textContent=e.docText),n.parentNode||this.popup.container.appendChild(this.tooltipNode);var i=this.popup,r=i.container.getBoundingClientRect();n.style.top=i.container.style.top,n.style.bottom=i.container.style.bottom,n.style.display="block",window.innerWidth-r.right<320?r.left<320?(i.isTopdown?n.style.top=r.bottom+"px":n.style.top=i.container.offsetTop-n.offsetHeight+"px",n.style.left=r.left+"px",n.style.right="",n.style.bottom=""):(n.style.right=window.innerWidth-r.left+"px",n.style.left=""):(n.style.left=r.right+1+"px",n.style.right="")},e.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),this.tooltipNode){var e=this.tooltipNode;this.editor.isFocused()||document.activeElement!=e||this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}},e.prototype.onTooltipClick=function(e){for(var t=e.target;t&&t!=this.tooltipNode;){if("A"==t.nodeName&&t.href){t.rel="noreferrer",t.target="_blank";break}t=t.parentNode}},e.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var e=this.popup.container;e&&e.parentNode&&e.parentNode.removeChild(e)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",f),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();g.prototype.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var t=e.completer.insertMatch();if(t||e.tabstopManager)return t;e.completer.goTo("down")},Backspace:function(e){e.execCommand("backspace"),!a.getCompletionPrefix(e)&&e.completer&&e.completer.detach()},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},g.for=function(e){return e.completer instanceof g||(e.completer&&(e.completer.destroy(),e.completer=null),d.get("sharedPopups")?(g.$sharedInstance||(g.$sharedInstance=new g),e.completer=g.$sharedInstance):(e.completer=new g,e.once("destroy",f))),e.completer},g.startCommand={name:"startAutocomplete",exec:function(e,t){var n=g.for(e);n.autoInsert=!1,n.autoSelect=!0,n.autoShown=!1,n.showPopup(e,t),n.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var m=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,t,n){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[t],n)},e.prototype.insertMatch=function(e,t,n){if(!t)return!1;if(e.startOperation({command:{name:"insertMatch"}}),t.completer&&t.completer.insertMatch)t.completer.insertMatch(e,t);else{if(!this.completions)return!1;var i=this.completions.filterText.length,r=0;if(t.range&&t.range.start.row===t.range.end.row&&(i-=this.initialPosition.prefix.length,i+=this.initialPosition.pos.column-t.range.start.column,r+=t.range.end.column-this.initialPosition.pos.column),i||r){o=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var o,s,a=0;s=o[a];a++)s.start.column-=i,s.end.column+=r,e.session.remove(s)}t.snippet?u.insertSnippet(e,t.snippet):this.$insertString(e,t),t.completer&&t.completer.onInsert&&"function"==typeof t.completer.onInsert&&t.completer.onInsert(e,t),t.command&&"startAutocomplete"===t.command&&e.execCommand(t.command)}return e.endOperation(),!0},e.prototype.$insertString=function(e,t){var n=t.value||t;e.execCommand("insertstring",n)},e.prototype.gatherCompletions=function(e,t){var n=e.getSession(),i=e.getCursorPosition(),r=a.getCompletionPrefix(e),o=[];this.completers=e.completers;var s=e.completers.length;return e.completers.forEach(function(l,c){l.getCompletions(e,n,i,r,function(n,i){l.hideInlinePreview&&(i=i.map(function(e){return Object.assign(e,{hideInlinePreview:l.hideInlinePreview})})),!n&&i&&(o=o.concat(i)),t(null,{prefix:a.getCompletionPrefix(e),matches:o,finished:0==--s})})}),!0},e.prototype.provideCompletions=function(e,t,n){var i=(function(e){var i=e.prefix,r=e.matches;this.completions=new v(r),t.exactMatch&&(this.completions.exactMatch=!0),t.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(i),(e.finished||this.completions.filtered.length)&&n(null,this.completions,e.finished)}).bind(this),r=!0,o=null;if(this.gatherCompletions(e,(function(e,t){if(this.active&&(e&&(n(e,[],!0),this.detach()),0===t.prefix.indexOf(t.prefix))){if(r){o=t;return}i(t)}}).bind(this)),r=!1,o){var s=o;o=null,i(s)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),v=function(){function e(e,t){this.all=e,this.filtered=e,this.filterText=t||"",this.exactMatch=!1,this.ignoreCaption=!1}return e.prototype.setFilter=function(e){if(e.length>this.filterText&&0===e.lastIndexOf(this.filterText,0))var t=this.filtered;else var t=this.all;this.filterText=e;var n=null;t=(t=(t=this.filterCompletions(t,this.filterText)).sort(function(e,t){return t.exactMatch-e.exactMatch||t.$score-e.$score||(e.caption||e.value).localeCompare(t.caption||t.value)})).filter(function(e){var t=e.snippet||e.caption||e.value;return t!==n&&(n=t,!0)}),this.filtered=t},e.prototype.filterCompletions=function(e,t){var n=[],i=t.toUpperCase(),r=t.toLowerCase();t:for(var o,s=0;o=e[s];s++){var a,l,c=!this.ignoreCaption&&o.caption||o.value||o.snippet;if(c){var u=-1,d=0,h=0;if(this.exactMatch){if(t!==c.substr(0,t.length))continue}else{var p=c.toLowerCase().indexOf(r);if(p>-1)h=p;else for(var f=0;f<t.length;f++){var g=c.indexOf(r[f],u+1),m=c.indexOf(i[f],u+1);if((a=g>=0&&(m<0||g<m)?g:m)<0)continue t;(l=a-u-1)>0&&(-1===u&&(h+=10),h+=l,d|=1<<f),u=a}}o.matchMask=d,o.exactMatch=+!h,o.$score=(o.score||0)-h,n.push(o)}}return n},e}();t.Autocomplete=g,t.CompletionProvider=m,t.FilteredList=v}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,t,n){var i=e("../range").Range,r=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function o(e,t){return e.getTextRange(i.fromPoints({row:0,column:0},t)).split(r).length-1}function s(e,t){var n=o(e,t),i=e.getValue().split(r),s=Object.create(null),a=i[n];return i.forEach(function(e,t){if(e&&e!==a){var r=Math.abs(n-t),o=i.length-r;s[e]?s[e]=Math.max(o,s[e]):s[e]=o}}),s}t.getCompletions=function(e,t,n,i,r){var o=s(t,n);r(null,Object.keys(o).map(function(e){return{caption:e,value:e,score:o[e],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(e,t,n){"use strict";var i,r=e("../snippets").snippetManager,o=e("../autocomplete").Autocomplete,s=e("../config"),a=e("../lib/lang"),l=e("../autocomplete/util"),c=e("../autocomplete/text_completer"),u={getCompletions:function(e,t,n,i,r){if(t.$mode.completer)return t.$mode.completer.getCompletions(e,t,n,i,r);var o=e.session.getState(n.row),s=t.$mode.getCompletions(o,t,n,i);r(null,s=s.map(function(e){return e.completerId=u.id,e}))},id:"keywordCompleter"},d=function(e){var t={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,n,i,r){return t[n]=r||""}).replace(/\$(\d+?)/g,function(e,n){return t[n]})},h={getCompletions:function(e,t,n,i,o){var s=[],a=t.getTokenAt(n.row,n.column);a&&a.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?s.push("html-tag"):s=r.getActiveScopes(e);var l=r.snippetMap,c=[];s.forEach(function(e){for(var t=l[e]||[],n=t.length;n--;){var i=t[n],r=i.name||i.tabTrigger;r&&c.push({caption:r,snippet:i.content,meta:i.tabTrigger&&!i.name?i.tabTrigger+"⇥ ":"snippet",completerId:h.id})}},this),o(null,c)},getDocTooltip:function(e){e.snippet&&!e.docHTML&&(e.docHTML=["<b>",a.escapeHTML(e.caption),"</b>","<hr></hr>",a.escapeHTML(d(e.snippet))].join(""))},id:"snippetCompleter"},p=[h,c,u];t.setCompleters=function(e){p.length=0,e&&p.push.apply(p,e)},t.addCompleter=function(e){p.push(e)},t.textCompleter=c,t.keyWordCompleter=u,t.snippetCompleter=h;var f={name:"expandSnippet",exec:function(e){return r.expandWithTab(e)},bindKey:"Tab"},g=function(e,t){m(t.session.$mode)},m=function(e){"string"==typeof e&&(e=s.$modes[e]),e&&(r.files||(r.files={}),v(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(m))},v=function(e,t){t&&e&&!r.files[e]&&(r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){m("ace/mode/"+e)})))}))},b=function(e){var t=e.editor,n=t.completer&&t.completer.activated;if("backspace"===e.command.name)n&&!l.getCompletionPrefix(t)&&t.completer.detach();else if("insertstring"===e.command.name&&!n){i=e;var r=e.editor.$liveAutocompletionDelay;r?y.delay(r):w(e)}},y=a.delayedCall(function(){w(i)},0),w=function(e){var t=e.editor,n=l.getCompletionPrefix(t),i=e.args,r=l.triggerAutocomplete(t,i);if(n&&n.length>=t.$liveAutocompletionThreshold||r){var s=o.for(t);s.autoShown=!0,s.showPopup(t)}},x=e("../editor").Editor;e("../config").defineOptions(x.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:p),this.commands.addCommand(o.startCommand)):this.commands.removeCommand(o.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:p),this.commands.on("afterExec",b)):this.commands.off("afterExec",b)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(e){e?(this.commands.addCommand(f),this.on("changeMode",g),g(null,this)):(this.commands.removeCommand(f),this.off("changeMode",g))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(t){e&&(e.exports=t)})}()},20009(e,t,n){e=n.nmd(e),ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,t,n){"use strict";var i,r=e("./lib/oop");e("./lib/lang");var o=e("./lib/event_emitter").EventEmitter,s=e("./editor").Editor,a=e("./virtual_renderer").VirtualRenderer,l=e("./edit_session").EditSession;(function(){r.implement(this,o),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var t=new s(new a(e,this.$theme));return t.on("focus",(function(){this._emit("focus",t)}).bind(this)),this.$editors.push(t),t.setFontSize(this.$fontSize),t},this.setSplits=function(e){var t;if(e<1)throw"The number of splits have to be > 0!";if(e!=this.$splits){if(e>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<e;)t=this.$editors[this.$splits],this.$container.appendChild(t.container),t.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<e;)this.$createEditor(),this.$splits++}else for(;this.$splits>e;)t=this.$editors[this.$splits-1],this.$container.removeChild(t.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(t){t.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(t){t.setKeyboardHandler(e)})},this.forEach=function(e,t){this.$editors.forEach(e,t)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(t){t.setFontSize(e)})},this.$cloneSession=function(e){var t=new l(e.getDocument(),e.getMode()),n=e.getUndoManager();return t.setUndoManager(n),t.setTabSize(e.getTabSize()),t.setUseSoftTabs(e.getUseSoftTabs()),t.setOverwrite(e.getOverwrite()),t.setBreakpoints(e.getBreakpoints()),t.setUseWrapMode(e.getUseWrapMode()),t.setUseWorker(e.getUseWorker()),t.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),t.$foldData=e.$cloneFoldData(),t},this.setSession=function(e,t){var n=null==t?this.$cEditor:this.$editors[t];return this.$editors.some(function(t){return t.session===e})&&(e=this.$cloneSession(e)),n.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){this.$orientation!=e&&(this.$orientation=e,this.resize())},this.resize=function(){var e,t=this.$container.clientWidth,n=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var i=t/this.$splits,r=0;r<this.$splits;r++)(e=this.$editors[r]).container.style.width=i+"px",e.container.style.top="0px",e.container.style.left=r*i+"px",e.container.style.height=n+"px",e.resize();else for(var o=n/this.$splits,r=0;r<this.$splits;r++)(e=this.$editors[r]).container.style.width=t+"px",e.container.style.top=r*o+"px",e.container.style.left="0px",e.container.style.height=o+"px",e.resize()}}).call((i=function(e,t,n){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=t,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(n||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),t.Split=i}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,t,n){"use strict";n.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(t){e&&(e.exports=t)})}()},62432(e,t,n){ace.config.setModuleUrl("ace/ext/beautify",n(1853)),ace.config.setModuleUrl("ace/ext/code_lens",n(42836)),ace.config.setModuleUrl("ace/ext/command_bar",n(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",n(40275)),ace.config.setModuleUrl("ace/ext/emmet",n(25962)),ace.config.setModuleUrl("ace/ext/error_marker",n(377)),ace.config.setModuleUrl("ace/ext/hardwrap",n(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",n(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",n(97188)),ace.config.setModuleUrl("ace/ext/language_tools",n(10194)),ace.config.setModuleUrl("ace/ext/linking",n(43794)),ace.config.setModuleUrl("ace/ext/modelist",n(71739)),ace.config.setModuleUrl("ace/ext/options",n(43804)),ace.config.setModuleUrl("ace/ext/prompt",n(20706)),ace.config.setModuleUrl("ace/ext/rtl",n(27480)),ace.config.setModuleUrl("ace/ext/searchbox",n(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",n(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",n(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",n(51834)),ace.config.setModuleUrl("ace/ext/split",n(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",n(99729)),ace.config.setModuleUrl("ace/ext/statusbar",n(86397)),ace.config.setModuleUrl("ace/ext/textarea",n(36454)),ace.config.setModuleUrl("ace/ext/themelist",n(85107)),ace.config.setModuleUrl("ace/ext/whitespace",n(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",n(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",n(1832)),ace.config.setModuleUrl("ace/keyboard/vim",n(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",n(98557)),ace.config.setModuleUrl("ace/mode/abap",n(48208)),ace.config.setModuleUrl("ace/mode/abc",n(22128)),ace.config.setModuleUrl("ace/mode/actionscript",n(3871)),ace.config.setModuleUrl("ace/mode/ada",n(87272)),ace.config.setModuleUrl("ace/mode/alda",n(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",n(70029)),ace.config.setModuleUrl("ace/mode/apex",n(24266)),ace.config.setModuleUrl("ace/mode/applescript",n(78831)),ace.config.setModuleUrl("ace/mode/aql",n(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",n(36417)),ace.config.setModuleUrl("ace/mode/asl",n(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",n(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",n(9319)),ace.config.setModuleUrl("ace/mode/astro",n(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",n(5215)),ace.config.setModuleUrl("ace/mode/batchfile",n(182)),ace.config.setModuleUrl("ace/mode/bibtex",n(54316)),ace.config.setModuleUrl("ace/mode/c9search",n(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",n(69563)),ace.config.setModuleUrl("ace/mode/cirru",n(25995)),ace.config.setModuleUrl("ace/mode/clojure",n(81384)),ace.config.setModuleUrl("ace/mode/cobol",n(12307)),ace.config.setModuleUrl("ace/mode/coffee",n(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",n(82540)),ace.config.setModuleUrl("ace/mode/crystal",n(70162)),ace.config.setModuleUrl("ace/mode/csharp",n(86173)),ace.config.setModuleUrl("ace/mode/csound_document",n(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",n(54722)),ace.config.setModuleUrl("ace/mode/csound_score",n(48055)),ace.config.setModuleUrl("ace/mode/csp",n(61634)),ace.config.setModuleUrl("ace/mode/css",n(59119)),ace.config.setModuleUrl("ace/mode/curly",n(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",n(34379)),ace.config.setModuleUrl("ace/mode/d",n(48656)),ace.config.setModuleUrl("ace/mode/dart",n(1647)),ace.config.setModuleUrl("ace/mode/diff",n(30365)),ace.config.setModuleUrl("ace/mode/django",n(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",n(62136)),ace.config.setModuleUrl("ace/mode/dot",n(40631)),ace.config.setModuleUrl("ace/mode/drools",n(36363)),ace.config.setModuleUrl("ace/mode/edifact",n(19906)),ace.config.setModuleUrl("ace/mode/eiffel",n(61933)),ace.config.setModuleUrl("ace/mode/ejs",n(78924)),ace.config.setModuleUrl("ace/mode/elixir",n(91429)),ace.config.setModuleUrl("ace/mode/elm",n(98664)),ace.config.setModuleUrl("ace/mode/erlang",n(18885)),ace.config.setModuleUrl("ace/mode/flix",n(98513)),ace.config.setModuleUrl("ace/mode/forth",n(50379)),ace.config.setModuleUrl("ace/mode/fortran",n(87166)),ace.config.setModuleUrl("ace/mode/fsharp",n(55288)),ace.config.setModuleUrl("ace/mode/fsl",n(96369)),ace.config.setModuleUrl("ace/mode/ftl",n(5474)),ace.config.setModuleUrl("ace/mode/gcode",n(39264)),ace.config.setModuleUrl("ace/mode/gherkin",n(67942)),ace.config.setModuleUrl("ace/mode/gitignore",n(37898)),ace.config.setModuleUrl("ace/mode/glsl",n(2474)),ace.config.setModuleUrl("ace/mode/gobstones",n(70154)),ace.config.setModuleUrl("ace/mode/golang",n(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",n(75542)),ace.config.setModuleUrl("ace/mode/groovy",n(50436)),ace.config.setModuleUrl("ace/mode/haml",n(63920)),ace.config.setModuleUrl("ace/mode/handlebars",n(51526)),ace.config.setModuleUrl("ace/mode/haskell",n(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",n(67784)),ace.config.setModuleUrl("ace/mode/haxe",n(81690)),ace.config.setModuleUrl("ace/mode/hjson",n(44406)),ace.config.setModuleUrl("ace/mode/html",n(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",n(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",n(76542)),ace.config.setModuleUrl("ace/mode/ini",n(88110)),ace.config.setModuleUrl("ace/mode/io",n(91930)),ace.config.setModuleUrl("ace/mode/ion",n(24958)),ace.config.setModuleUrl("ace/mode/jack",n(42901)),ace.config.setModuleUrl("ace/mode/jade",n(55300)),ace.config.setModuleUrl("ace/mode/java",n(29750)),ace.config.setModuleUrl("ace/mode/javascript",n(80437)),ace.config.setModuleUrl("ace/mode/jexl",n(62115)),ace.config.setModuleUrl("ace/mode/json",n(46544)),ace.config.setModuleUrl("ace/mode/json5",n(62727)),ace.config.setModuleUrl("ace/mode/jsoniq",n(78118)),ace.config.setModuleUrl("ace/mode/jsp",n(41705)),ace.config.setModuleUrl("ace/mode/jssm",n(22901)),ace.config.setModuleUrl("ace/mode/jsx",n(73937)),ace.config.setModuleUrl("ace/mode/julia",n(941)),ace.config.setModuleUrl("ace/mode/kotlin",n(86571)),ace.config.setModuleUrl("ace/mode/latex",n(30808)),ace.config.setModuleUrl("ace/mode/latte",n(2986)),ace.config.setModuleUrl("ace/mode/less",n(72799)),ace.config.setModuleUrl("ace/mode/liquid",n(95630)),ace.config.setModuleUrl("ace/mode/lisp",n(85950)),ace.config.setModuleUrl("ace/mode/livescript",n(74703)),ace.config.setModuleUrl("ace/mode/logiql",n(72094)),ace.config.setModuleUrl("ace/mode/logtalk",n(39512)),ace.config.setModuleUrl("ace/mode/lsl",n(94275)),ace.config.setModuleUrl("ace/mode/lua",n(46890)),ace.config.setModuleUrl("ace/mode/luapage",n(81029)),ace.config.setModuleUrl("ace/mode/lucene",n(7616)),ace.config.setModuleUrl("ace/mode/makefile",n(77882)),ace.config.setModuleUrl("ace/mode/markdown",n(21459)),ace.config.setModuleUrl("ace/mode/mask",n(54050)),ace.config.setModuleUrl("ace/mode/matlab",n(35907)),ace.config.setModuleUrl("ace/mode/maze",n(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",n(72268)),ace.config.setModuleUrl("ace/mode/mel",n(66018)),ace.config.setModuleUrl("ace/mode/mips",n(20617)),ace.config.setModuleUrl("ace/mode/mixal",n(98667)),ace.config.setModuleUrl("ace/mode/mushcode",n(61026)),ace.config.setModuleUrl("ace/mode/mysql",n(21630)),ace.config.setModuleUrl("ace/mode/nasal",n(23523)),ace.config.setModuleUrl("ace/mode/nginx",n(16788)),ace.config.setModuleUrl("ace/mode/nim",n(31900)),ace.config.setModuleUrl("ace/mode/nix",n(6135)),ace.config.setModuleUrl("ace/mode/nsis",n(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",n(51481)),ace.config.setModuleUrl("ace/mode/objectivec",n(75466)),ace.config.setModuleUrl("ace/mode/ocaml",n(49088)),ace.config.setModuleUrl("ace/mode/odin",n(5610)),ace.config.setModuleUrl("ace/mode/partiql",n(76557)),ace.config.setModuleUrl("ace/mode/pascal",n(80694)),ace.config.setModuleUrl("ace/mode/perl",n(7135)),ace.config.setModuleUrl("ace/mode/pgsql",n(55707)),ace.config.setModuleUrl("ace/mode/php",n(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",n(49935)),ace.config.setModuleUrl("ace/mode/pig",n(7124)),ace.config.setModuleUrl("ace/mode/plain_text",n(92868)),ace.config.setModuleUrl("ace/mode/plsql",n(24808)),ace.config.setModuleUrl("ace/mode/powershell",n(77823)),ace.config.setModuleUrl("ace/mode/praat",n(46124)),ace.config.setModuleUrl("ace/mode/prisma",n(18114)),ace.config.setModuleUrl("ace/mode/prolog",n(35061)),ace.config.setModuleUrl("ace/mode/properties",n(56059)),ace.config.setModuleUrl("ace/mode/protobuf",n(86305)),ace.config.setModuleUrl("ace/mode/prql",n(58317)),ace.config.setModuleUrl("ace/mode/puppet",n(85804)),ace.config.setModuleUrl("ace/mode/python",n(51652)),ace.config.setModuleUrl("ace/mode/qml",n(11038)),ace.config.setModuleUrl("ace/mode/r",n(438)),ace.config.setModuleUrl("ace/mode/raku",n(4847)),ace.config.setModuleUrl("ace/mode/razor",n(67300)),ace.config.setModuleUrl("ace/mode/rdoc",n(6430)),ace.config.setModuleUrl("ace/mode/red",n(85347)),ace.config.setModuleUrl("ace/mode/redshift",n(36975)),ace.config.setModuleUrl("ace/mode/rhtml",n(7047)),ace.config.setModuleUrl("ace/mode/robot",n(66276)),ace.config.setModuleUrl("ace/mode/rst",n(8781)),ace.config.setModuleUrl("ace/mode/ruby",n(334)),ace.config.setModuleUrl("ace/mode/rust",n(43292)),ace.config.setModuleUrl("ace/mode/sac",n(26329)),ace.config.setModuleUrl("ace/mode/sass",n(52748)),ace.config.setModuleUrl("ace/mode/scad",n(46193)),ace.config.setModuleUrl("ace/mode/scala",n(19366)),ace.config.setModuleUrl("ace/mode/scheme",n(81413)),ace.config.setModuleUrl("ace/mode/scrypt",n(70877)),ace.config.setModuleUrl("ace/mode/scss",n(55146)),ace.config.setModuleUrl("ace/mode/sh",n(77105)),ace.config.setModuleUrl("ace/mode/sjs",n(16042)),ace.config.setModuleUrl("ace/mode/slim",n(58715)),ace.config.setModuleUrl("ace/mode/smarty",n(48146)),ace.config.setModuleUrl("ace/mode/smithy",n(75144)),ace.config.setModuleUrl("ace/mode/snippets",n(33124)),ace.config.setModuleUrl("ace/mode/soy_template",n(23446)),ace.config.setModuleUrl("ace/mode/space",n(29582)),ace.config.setModuleUrl("ace/mode/sparql",n(4911)),ace.config.setModuleUrl("ace/mode/sql",n(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",n(19771)),ace.config.setModuleUrl("ace/mode/stylus",n(60940)),ace.config.setModuleUrl("ace/mode/svg",n(68506)),ace.config.setModuleUrl("ace/mode/swift",n(39215)),ace.config.setModuleUrl("ace/mode/tcl",n(54987)),ace.config.setModuleUrl("ace/mode/terraform",n(31372)),ace.config.setModuleUrl("ace/mode/tex",n(63609)),ace.config.setModuleUrl("ace/mode/text",n(12585)),ace.config.setModuleUrl("ace/mode/textile",n(29541)),ace.config.setModuleUrl("ace/mode/toml",n(69774)),ace.config.setModuleUrl("ace/mode/tsx",n(53135)),ace.config.setModuleUrl("ace/mode/turtle",n(12476)),ace.config.setModuleUrl("ace/mode/twig",n(71255)),ace.config.setModuleUrl("ace/mode/typescript",n(5397)),ace.config.setModuleUrl("ace/mode/vala",n(98124)),ace.config.setModuleUrl("ace/mode/vbscript",n(70801)),ace.config.setModuleUrl("ace/mode/velocity",n(33189)),ace.config.setModuleUrl("ace/mode/verilog",n(36982)),ace.config.setModuleUrl("ace/mode/vhdl",n(98256)),ace.config.setModuleUrl("ace/mode/visualforce",n(7335)),ace.config.setModuleUrl("ace/mode/vue",n(2256)),ace.config.setModuleUrl("ace/mode/wollok",n(29446)),ace.config.setModuleUrl("ace/mode/xml",n(93489)),ace.config.setModuleUrl("ace/mode/xquery",n(27174)),ace.config.setModuleUrl("ace/mode/yaml",n(32113)),ace.config.setModuleUrl("ace/mode/zeek",n(38035)),ace.config.setModuleUrl("ace/mode/zig",n(86882)),ace.config.setModuleUrl("ace/theme/ambiance",n(7890)),ace.config.setModuleUrl("ace/theme/chaos",n(40156)),ace.config.setModuleUrl("ace/theme/chrome",n(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",n(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",n(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",n(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",n(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",n(93008)),ace.config.setModuleUrl("ace/theme/clouds",n(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",n(54131)),ace.config.setModuleUrl("ace/theme/cobalt",n(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",n(63553)),ace.config.setModuleUrl("ace/theme/dawn",n(58732)),ace.config.setModuleUrl("ace/theme/dracula",n(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",n(71791)),ace.config.setModuleUrl("ace/theme/eclipse",n(28409)),ace.config.setModuleUrl("ace/theme/github",n(28573)),ace.config.setModuleUrl("ace/theme/github_dark",n(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",n(50836)),ace.config.setModuleUrl("ace/theme/gob",n(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",n(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",n(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",n(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",n(46925)),ace.config.setModuleUrl("ace/theme/iplastic",n(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",n(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",n(67773)),ace.config.setModuleUrl("ace/theme/kuroir",n(78990)),ace.config.setModuleUrl("ace/theme/merbivore",n(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",n(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",n(61343)),ace.config.setModuleUrl("ace/theme/monokai",n(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",n(63554)),ace.config.setModuleUrl("ace/theme/one_dark",n(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",n(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",n(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",n(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",n(14995)),ace.config.setModuleUrl("ace/theme/terminal",n(91493)),ace.config.setModuleUrl("ace/theme/textmate",n(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",n(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",n(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",n(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",n(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",n(59069)),ace.config.setModuleUrl("ace/theme/twilight",n(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",n(26689)),ace.config.setModuleUrl("ace/theme/xcode",n(26433)),ace.config.setModuleUrl("ace/mode/base_worker",n(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",n(74901)),ace.config.setModuleUrl("ace/mode/css_worker",n(88494)),ace.config.setModuleUrl("ace/mode/html_worker",n(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",n(7182)),ace.config.setModuleUrl("ace/mode/json_worker",n(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",n(55639)),ace.config.setModuleUrl("ace/mode/php_worker",n(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",n(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",n(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",n(67782)),ace.config.setModuleUrl("ace/snippets/abap",n(57909)),ace.config.setModuleUrl("ace/snippets/abc",n(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",n(63178)),ace.config.setModuleUrl("ace/snippets/ada",n(70563)),ace.config.setModuleUrl("ace/snippets/alda",n(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",n(53290)),ace.config.setModuleUrl("ace/snippets/apex",n(64691)),ace.config.setModuleUrl("ace/snippets/applescript",n(86568)),ace.config.setModuleUrl("ace/snippets/aql",n(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",n(64428)),ace.config.setModuleUrl("ace/snippets/asl",n(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",n(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",n(54726)),ace.config.setModuleUrl("ace/snippets/astro",n(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",n(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",n(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",n(34929)),ace.config.setModuleUrl("ace/snippets/c9search",n(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",n(51824)),ace.config.setModuleUrl("ace/snippets/cirru",n(90368)),ace.config.setModuleUrl("ace/snippets/clojure",n(70819)),ace.config.setModuleUrl("ace/snippets/cobol",n(10232)),ace.config.setModuleUrl("ace/snippets/coffee",n(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",n(71241)),ace.config.setModuleUrl("ace/snippets/crystal",n(94925)),ace.config.setModuleUrl("ace/snippets/csharp",n(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",n(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",n(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",n(46326)),ace.config.setModuleUrl("ace/snippets/csp",n(3029)),ace.config.setModuleUrl("ace/snippets/css",n(21452)),ace.config.setModuleUrl("ace/snippets/curly",n(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",n(46790)),ace.config.setModuleUrl("ace/snippets/d",n(32803)),ace.config.setModuleUrl("ace/snippets/dart",n(48138)),ace.config.setModuleUrl("ace/snippets/diff",n(54060)),ace.config.setModuleUrl("ace/snippets/django",n(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",n(58661)),ace.config.setModuleUrl("ace/snippets/dot",n(38180)),ace.config.setModuleUrl("ace/snippets/drools",n(53542)),ace.config.setModuleUrl("ace/snippets/edifact",n(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",n(71020)),ace.config.setModuleUrl("ace/snippets/ejs",n(78027)),ace.config.setModuleUrl("ace/snippets/elixir",n(81672)),ace.config.setModuleUrl("ace/snippets/elm",n(20259)),ace.config.setModuleUrl("ace/snippets/erlang",n(80564)),ace.config.setModuleUrl("ace/snippets/flix",n(38984)),ace.config.setModuleUrl("ace/snippets/forth",n(50528)),ace.config.setModuleUrl("ace/snippets/fortran",n(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",n(60317)),ace.config.setModuleUrl("ace/snippets/fsl",n(60470)),ace.config.setModuleUrl("ace/snippets/ftl",n(64093)),ace.config.setModuleUrl("ace/snippets/gcode",n(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",n(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",n(51069)),ace.config.setModuleUrl("ace/snippets/glsl",n(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",n(19433)),ace.config.setModuleUrl("ace/snippets/golang",n(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",n(90933)),ace.config.setModuleUrl("ace/snippets/groovy",n(28101)),ace.config.setModuleUrl("ace/snippets/haml",n(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",n(63083)),ace.config.setModuleUrl("ace/snippets/haskell",n(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",n(11831)),ace.config.setModuleUrl("ace/snippets/haxe",n(71443)),ace.config.setModuleUrl("ace/snippets/hjson",n(70389)),ace.config.setModuleUrl("ace/snippets/html",n(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",n(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",n(42201)),ace.config.setModuleUrl("ace/snippets/ini",n(36453)),ace.config.setModuleUrl("ace/snippets/io",n(93307)),ace.config.setModuleUrl("ace/snippets/ion",n(4345)),ace.config.setModuleUrl("ace/snippets/jack",n(37832)),ace.config.setModuleUrl("ace/snippets/jade",n(17469)),ace.config.setModuleUrl("ace/snippets/java",n(44967)),ace.config.setModuleUrl("ace/snippets/javascript",n(64472)),ace.config.setModuleUrl("ace/snippets/jexl",n(63542)),ace.config.setModuleUrl("ace/snippets/json",n(50165)),ace.config.setModuleUrl("ace/snippets/json5",n(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",n(60927)),ace.config.setModuleUrl("ace/snippets/jsp",n(36142)),ace.config.setModuleUrl("ace/snippets/jssm",n(44592)),ace.config.setModuleUrl("ace/snippets/jsx",n(33158)),ace.config.setModuleUrl("ace/snippets/julia",n(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",n(94158)),ace.config.setModuleUrl("ace/snippets/latex",n(1075)),ace.config.setModuleUrl("ace/snippets/latte",n(46769)),ace.config.setModuleUrl("ace/snippets/less",n(52466)),ace.config.setModuleUrl("ace/snippets/liquid",n(27191)),ace.config.setModuleUrl("ace/snippets/lisp",n(63635)),ace.config.setModuleUrl("ace/snippets/livescript",n(41122)),ace.config.setModuleUrl("ace/snippets/logiql",n(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",n(27299)),ace.config.setModuleUrl("ace/snippets/lsl",n(38552)),ace.config.setModuleUrl("ace/snippets/lua",n(67401)),ace.config.setModuleUrl("ace/snippets/luapage",n(57030)),ace.config.setModuleUrl("ace/snippets/lucene",n(95437)),ace.config.setModuleUrl("ace/snippets/makefile",n(63275)),ace.config.setModuleUrl("ace/snippets/markdown",n(81586)),ace.config.setModuleUrl("ace/snippets/mask",n(49087)),ace.config.setModuleUrl("ace/snippets/matlab",n(65946)),ace.config.setModuleUrl("ace/snippets/maze",n(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",n(29999)),ace.config.setModuleUrl("ace/snippets/mel",n(17417)),ace.config.setModuleUrl("ace/snippets/mips",n(74332)),ace.config.setModuleUrl("ace/snippets/mixal",n(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",n(31539)),ace.config.setModuleUrl("ace/snippets/mysql",n(59577)),ace.config.setModuleUrl("ace/snippets/nasal",n(49224)),ace.config.setModuleUrl("ace/snippets/nginx",n(82227)),ace.config.setModuleUrl("ace/snippets/nim",n(93243)),ace.config.setModuleUrl("ace/snippets/nix",n(72152)),ace.config.setModuleUrl("ace/snippets/nsis",n(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",n(81136)),ace.config.setModuleUrl("ace/snippets/objectivec",n(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",n(96183)),ace.config.setModuleUrl("ace/snippets/odin",n(91983)),ace.config.setModuleUrl("ace/snippets/partiql",n(78106)),ace.config.setModuleUrl("ace/snippets/pascal",n(79323)),ace.config.setModuleUrl("ace/snippets/perl",n(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",n(98692)),ace.config.setModuleUrl("ace/snippets/php",n(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",n(43416)),ace.config.setModuleUrl("ace/snippets/pig",n(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",n(91365)),ace.config.setModuleUrl("ace/snippets/plsql",n(18423)),ace.config.setModuleUrl("ace/snippets/powershell",n(41273)),ace.config.setModuleUrl("ace/snippets/praat",n(8711)),ace.config.setModuleUrl("ace/snippets/prisma",n(87915)),ace.config.setModuleUrl("ace/snippets/prolog",n(58432)),ace.config.setModuleUrl("ace/snippets/properties",n(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",n(93932)),ace.config.setModuleUrl("ace/snippets/prql",n(79240)),ace.config.setModuleUrl("ace/snippets/puppet",n(35129)),ace.config.setModuleUrl("ace/snippets/python",n(54309)),ace.config.setModuleUrl("ace/snippets/qml",n(31005)),ace.config.setModuleUrl("ace/snippets/r",n(55961)),ace.config.setModuleUrl("ace/snippets/raku",n(42950)),ace.config.setModuleUrl("ace/snippets/razor",n(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",n(62535)),ace.config.setModuleUrl("ace/snippets/red",n(13500)),ace.config.setModuleUrl("ace/snippets/redshift",n(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",n(84064)),ace.config.setModuleUrl("ace/snippets/robot",n(61111)),ace.config.setModuleUrl("ace/snippets/rst",n(43530)),ace.config.setModuleUrl("ace/snippets/ruby",n(12767)),ace.config.setModuleUrl("ace/snippets/rust",n(36729)),ace.config.setModuleUrl("ace/snippets/sac",n(37506)),ace.config.setModuleUrl("ace/snippets/sass",n(82737)),ace.config.setModuleUrl("ace/snippets/scad",n(35400)),ace.config.setModuleUrl("ace/snippets/scala",n(92945)),ace.config.setModuleUrl("ace/snippets/scheme",n(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",n(64128)),ace.config.setModuleUrl("ace/snippets/scss",n(48387)),ace.config.setModuleUrl("ace/snippets/sh",n(13176)),ace.config.setModuleUrl("ace/snippets/sjs",n(68801)),ace.config.setModuleUrl("ace/snippets/slim",n(93390)),ace.config.setModuleUrl("ace/snippets/smarty",n(67831)),ace.config.setModuleUrl("ace/snippets/smithy",n(34577)),ace.config.setModuleUrl("ace/snippets/snippets",n(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",n(93779)),ace.config.setModuleUrl("ace/snippets/space",n(50673)),ace.config.setModuleUrl("ace/snippets/sparql",n(38842)),ace.config.setModuleUrl("ace/snippets/sql",n(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",n(56420)),ace.config.setModuleUrl("ace/snippets/stylus",n(3309)),ace.config.setModuleUrl("ace/snippets/svg",n(82161)),ace.config.setModuleUrl("ace/snippets/swift",n(41200)),ace.config.setModuleUrl("ace/snippets/tcl",n(32384)),ace.config.setModuleUrl("ace/snippets/terraform",n(75607)),ace.config.setModuleUrl("ace/snippets/tex",n(6874)),ace.config.setModuleUrl("ace/snippets/text",n(54012)),ace.config.setModuleUrl("ace/snippets/textile",n(93878)),ace.config.setModuleUrl("ace/snippets/toml",n(49599)),ace.config.setModuleUrl("ace/snippets/tsx",n(22028)),ace.config.setModuleUrl("ace/snippets/turtle",n(86333)),ace.config.setModuleUrl("ace/snippets/twig",n(11078)),ace.config.setModuleUrl("ace/snippets/typescript",n(40344)),ace.config.setModuleUrl("ace/snippets/vala",n(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",n(5368)),ace.config.setModuleUrl("ace/snippets/velocity",n(4896)),ace.config.setModuleUrl("ace/snippets/verilog",n(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",n(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",n(82036)),ace.config.setModuleUrl("ace/snippets/vue",n(36751)),ace.config.setModuleUrl("ace/snippets/wollok",n(12463)),ace.config.setModuleUrl("ace/snippets/xml",n(65690)),ace.config.setModuleUrl("ace/snippets/xquery",n(84835)),ace.config.setModuleUrl("ace/snippets/yaml",n(46716)),ace.config.setModuleUrl("ace/snippets/zeek",n(51174)),ace.config.setModuleUrl("ace/snippets/zig",n(64865))},63282(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let i=n(4042),r=n(86144),o=n(36653),s=n(72079),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=n(62586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=n(99029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var h=n(13558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var p=n(34551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})},41520(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=i;class r extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){let n=[e[0]],i=0;for(;i<t.length;)l(n,t[i]),n.push(e[++i]);return new r(n)}t._Code=r,t.nil=new r(""),t._=o;let s=new r("+");function a(e,...t){let n=[h(e[0])],i=0;for(;i<t.length;)n.push(s),l(n,t[i]),n.push(s,h(e[++i]));return c(n),new r(n)}function l(e,t){t instanceof r?e.push(...t._items):t instanceof i?e.push(t):e.push(d(t))}function c(e){let t=1;for(;t<e.length-1;){if(e[t]===s){let n=u(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function u(e,t){return'""'===t?e:'""'===e?t:"string"==typeof e?t instanceof i||'"'!==e[e.length-1]?void 0:"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0:"string"!=typeof t||'"'!==t[0]||e instanceof i?void 0:`"${e}${t.slice(1)}`}function d(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:h(Array.isArray(e)?e.join(","):e)}function h(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function p(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):o`[${e}]`}function f(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(h(e))},t.safeStringify=h,t.getProperty=p,t.getEsmExportName=f,t.regexpCode=function(e){return new r(e.toString())}},99029(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let i=n(41520),r=n(57845);var o=n(41520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var s=n(57845);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,e,t),this}get names(){return L(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class f extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=O(this.code,e,t),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class g extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,i=n.length;for(;i--;){let r=n[i];r.optimizeNames(e,t)||(R(e,r.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}}class m extends g{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends g{}class b extends m{}b.kind="else";class y extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(D(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null==(n=this.else)?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=O(this.condition,e,t),this}get names(){let e=super.names;return L(e,this.condition),this.else&&T(e,this.else.names),e}}y.kind="if";class w extends m{}w.kind="for";class x extends w{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=O(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class $ extends w{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${t} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=L(super.names,this.from);return L(e,this.to)}}class _ extends w{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=O(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class S extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class M extends g{render(e){return"return "+super.render(e)}}M.kind="return";class C extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null==(n=this.catch)||n.optimizeNames(e,t),null==(i=this.finally)||i.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class E extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class k extends m{render(e){return"finally"+super.render(e)}}k.kind="finally";class A{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){let r=this._scope.toName(t);return void 0!==n&&i&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new f(e)),this}object(...e){let t=["{"];for(let[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,r));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new y(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(y,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new x(e),t)}forRange(e,t,n,i,o=this.opts.es5?r.varKinds.var:r.varKinds.let){let s=this._scope.toName(e);return this._for(new $(o,s,t,n),()=>i(s))}forOf(e,t,n,o=r.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,i._)`${e}.length`,t=>{this.var(s,(0,i._)`${e}[${t}]`),n(s)})}return this._for(new _("of",o,s,t),()=>n(s))}forIn(e,t,n,o=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,i._)`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new _("in",o,s,t),()=>n(s))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new h(e))}return(e){let t=new M;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(M)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new C;if(this._blockNode(i),this.code(e),t){let e=this.name("e");this._currNode=i.catch=new E(e),t(e)}return n&&(this._currNode=i.finally=new k,this.code(n)),this._endBlockNode(E,k)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=i.nil,n,r){return this._blockNode(new S(e,t,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}function T(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function L(e,t){return t instanceof i._CodeOrName?T(e,t.names):e}function O(e,t,n){if(e instanceof i.Name)return r(e);if(!o(e))return e;return new i._Code(e._items.reduce((e,t)=>(t instanceof i.Name&&(t=r(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e),[]));function r(e){let i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}function o(e){return e instanceof i._Code&&e._items.some(e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str])}}function R(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,i._)`!${P(e)}`}t.CodeGen=A,t.not=D;let I=N(t.operators.AND);t.and=function(...e){return e.reduce(I)};let j=N(t.operators.OR);function N(e){return(t,n)=>t===i.nil?n:n===i.nil?t:(0,i._)`${P(t)} ${e} ${P(n)}`}function P(e){return e instanceof i.Name?e:(0,i._)`(${e})`}t.or=function(...e){return e.reduce(j)}},57845(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=n(41520);class o extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(i||(t.UsedValueState=i={})),t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof r.Name?e:this.name(e)}name(e){return new r.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if((null==(n=null==(t=this._parent)?void 0:t._prefixes)?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=s;class a extends r.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=(0,r._)`.${new r.Name(t)}[${n}]`}}t.ValueScopeName=a;let l=(0,r._)`\n`;class c extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:r.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:r}=i,o=null!=(n=t.key)?n:t.ref,s=this._values[r];if(s){let e=s.get(o);if(e)return e}else s=this._values[r]=new Map;s.set(o,i);let a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:r,itemIndex:l}),i}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,r._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(e,n,s={},a){let l=r.nil;for(let c in e){let u=e[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(e=>{if(d.has(e))return;d.set(e,i.Started);let s=n(e);if(s){let n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,r._)`${l}${n} ${e} = ${s};${this.opts._n}`}else if(s=null==a?void 0:a(e))l=(0,r._)`${l}${s}${this.opts._n}`;else throw new o(e);d.set(e,i.Completed)})}return l}}t.ValueScope=c},48708(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let i=n(99029),r=n(94227),o=n(42023);function s(e,n=t.keywordError,r,o){let{it:a}=e,{gen:u,compositeRule:h,allErrors:p}=a,f=d(e,n,r);(null!=o?o:h||p)?l(u,f):c(a,(0,i._)`[${f}]`)}function a(e,n=t.keywordError,i){let{it:r}=e,{gen:s,compositeRule:u,allErrors:h}=r;l(s,d(e,n,i)),u||h||c(r,o.default.vErrors)}function l(e,t){let n=e.const("err",t);e.if((0,i._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,i._)`[${n}]`),(0,i._)`${o.default.vErrors}.push(${n})`),e.code((0,i._)`${o.default.errors}++`)}function c(e,t){let{gen:n,validateName:r,schemaEnv:o}=e;o.$async?n.throw((0,i._)`new ${e.ValidationError}(${t})`):(n.assign((0,i._)`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>(0,i.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,i.str)`"${e}" keyword must be ${t} ($data)`:(0,i.str)`"${e}" keyword is invalid ($data)`},t.reportError=s,t.reportExtraError=a,t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if((0,i._)`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,i._)`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:a}){if(void 0===s)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(l,(0,i._)`${o.default.vErrors}[${s}]`),e.if((0,i._)`${l}.instancePath === undefined`,()=>e.assign((0,i._)`${l}.instancePath`,(0,i.strConcat)(o.default.instancePath,a.errorPath))),e.assign((0,i._)`${l}.schemaPath`,(0,i.str)`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign((0,i._)`${l}.schema`,n),e.assign((0,i._)`${l}.data`,r))})};let u={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function d(e,t,n){let{createErrors:r}=e.it;return!1===r?(0,i._)`{}`:h(e,t,n)}function h(e,t,n={}){let{gen:i,it:r}=e,o=[p(r,n),f(e,n)];return g(e,t,o),i.object(...o)}function p({errorPath:e},{instancePath:t}){let n=t?(0,i.str)`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[o.default.instancePath,(0,i.strConcat)(o.default.instancePath,n)]}function f({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:o}){let s=o?t:(0,i.str)`${t}/${e}`;return n&&(s=(0,i.str)`${s}${(0,r.getErrorPath)(n,r.Type.Str)}`),[u.schemaPath,s]}function g(e,{params:t,message:n},r){let{keyword:s,data:a,schemaValue:l,it:c}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:f}=c;r.push([u.keyword,s],[u.params,"function"==typeof t?t(e):t||(0,i._)`{}`]),d.messages&&r.push([u.message,"function"==typeof n?n(e):n]),d.verbose&&r.push([u.schema,l],[u.parentSchema,(0,i._)`${p}${f}`],[o.default.data,a]),h&&r.push([u.propertyName,h])}},73835(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let i=n(99029),r=n(13558),o=n(42023),s=n(66939),a=n(94227),l=n(62586);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,s.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){let t,n,a=h.call(this,e);if(a)return a;let c=(0,s.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:u,lines:d}=this.opts.code,{ownProperties:p}=this.opts,f=new i.CodeGen(this.scope,{es5:u,lines:d,ownProperties:p});e.$async&&(t=f.scopeValue("Error",{ref:r.default,code:(0,i._)`require("ajv/dist/runtime/validation_error").default`}));let g=f.scopeName("validate");e.validateName=g;let m={gen:f,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:g,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,i._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(m),f.optimize(this.opts.code.optimize);let t=f.toString();n=`${f.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(n=this.opts.code.process(n,e));let r=Function(`${o.default.self}`,`${o.default.scope}`,n)(this,this.scope.get());if(this.scope.value(g,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:g,validateCode:t,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:t}=m;r.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},r.source&&(r.source.evaluated=(0,i.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,n&&this.logger.error("Error compiling schema, function code:",n),t}finally{this._compilations.delete(e)}}function d(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function h(e){for(let t of this._compilations)if(p(t,e))return t}function p(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function f(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||g.call(this,e,t)}function g(e,t){let n=this.opts.uriResolver.parse(t),i=(0,s._getFullPath)(this.opts.uriResolver,n),r=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===r)return v.call(this,n,e);let o=(0,s.normalizeId)(i),a=this.refs[o]||this.schemas[o];if("string"==typeof a){let t=g.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),o===(0,s.normalizeId)(t)){let{schema:t}=a,{schemaId:n}=this.opts,i=t[n];return i&&(r=(0,s.resolveUrl)(this.opts.uriResolver,r,i)),new c({schema:t,schemaId:n,root:e,baseId:r})}return v.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,s.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let o=f.call(this,e,n);if(void 0===o){let r=null==(i=e.localRefs)?void 0:i[n],{schemaId:s}=this.opts;r&&(o=new c({schema:r,schemaId:s,root:e,baseId:t}))}if(void 0!==o)return e.refs[n]=d.call(this,o)},t.getCompilingSchema=h,t.resolveSchema=g;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:n,root:i}){var r;let o;if((null==(r=e.fragment)?void 0:r[0])!=="/")return;for(let i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;let e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;let r="object"==typeof(n=e)&&n[this.opts.schemaId];!m.has(i)&&r&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,r))}if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,s.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=g.call(this,i,e)}let{schemaId:l}=this.opts;if((o=o||new c({schema:n,schemaId:l,root:i,baseId:t})).schema!==o.root.schema)return o}},42023(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(99029);t.default={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")}},34551(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(66939);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,i.resolveUrl)(e,t,n),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(e,this.missingRef))}}t.default=r},66939(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let i=n(94227),r=n(32017),o=n(7106),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!l(e):!!t&&c(e)<=t)};let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(let t in e){if(a.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(l)||"object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(let n in e)if("$ref"===n||(t++,!s.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],e=>t+=c(e)),t===1/0)))return 1/0;return t}function u(e,t="",n){!1!==n&&(t=p(t));let i=e.parse(t);return d(e,i)}function d(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;let h=/#\/?$/;function p(e){return e?e.replace(h,""):""}t.normalizeId=p,t.resolveUrl=function(e,t,n){return n=p(n),e.resolve(t,n)};let f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:n,uriResolver:i}=this.opts,s=p(e[n]||t),a={"":s},l=u(i,s,!1),c={},d=new Set;return o(e,{allKeys:!0},(e,t,i,r)=>{if(void 0===r)return;let o=l+t,s=a[r];function u(t){let n=this.opts.uriResolver.resolve;if(t=p(s?n(s,t):t),d.has(t))throw g(t);d.add(t);let i=this.refs[t];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?h(e,i.schema,t):t!==p(o)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=o),t}function m(e){if("string"==typeof e){if(!f.test(e))throw Error(`invalid anchor "${e}"`);u.call(this,`#${e}`)}}"string"==typeof e[n]&&(s=u.call(this,e[n])),m.call(this,e.$anchor),m.call(this,e.$dynamicAnchor),a[t]=s}),c;function h(e,t,n){if(void 0!==t&&!r(e,t))throw g(n)}function g(e){return Error(`reference "${e}" resolves to more than one schema`)}}},10396(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},94227(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let r=n(99029),o=n(41520);function s(e,t=e.schema){let{opts:n,self:i}=e;if(!n.strictSchema||"boolean"==typeof t)return;let r=i.RULES.keywords;for(let n in t)r[n]||f(e,`unknown keyword: "${n}"`)}function a(e,t){if("boolean"==typeof e)return!e;for(let n in e)if(t[n])return!0;return!1}function l(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:i}){return(o,s,a,l)=>{let c=void 0===a?s:a instanceof r.Name?(s instanceof r.Name?e(o,s,a):t(o,s,a),a):s instanceof r.Name?(t(o,a,s),s):n(s,a);return l!==r.Name||c instanceof r.Name?c:i(o,c)}}function d(e,t){if(!0===t)return e.var("props",!0);let n=e.var("props",(0,r._)`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach(n=>e.assign((0,r._)`${t}${(0,r.getProperty)(n)}`,!0))}t.toHash=function(e){let t={};for(let n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(s(e,t),!a(t,e.self.RULES.all))},t.checkUnknownRules=s,t.schemaHasRules=a,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,i,o){if(!o){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return(0,r._)`${n}`}return(0,r._)`${e}${t}${(0,r.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(l(e))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,n)=>e.if((0,r._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,r._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,r._)`${n} || {}`).code((0,r._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,r._)`${n} !== true`,()=>{!0===t?e.assign(n,!0):(e.assign(n,(0,r._)`${n} || {}`),h(e,n,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:d}),items:u({mergeNames:(e,t,n)=>e.if((0,r._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,r._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,r._)`${n} !== true`,()=>e.assign(n,!0===t||(0,r._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=d,t.setEvaluated=h;let p={};function f(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new o._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(i||(t.Type=i={})),t.getErrorPath=function(e,t,n){if(e instanceof r.Name){let o=t===i.Num;return n?o?(0,r._)`"[" + ${e} + "]"`:(0,r._)`"['" + ${e} + "']"`:o?(0,r._)`"/" + ${e}`:(0,r._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,r.getProperty)(e).toString():"/"+l(e)},t.checkStrictMode=f},7887(e,t){"use strict";function n(e,t){return t.rules.some(t=>i(e,t))}function i(e,t){var n;return void 0!==e[t.keyword]||(null==(n=t.definition.implements)?void 0:n.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},i){let r=t.RULES.types[i];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=i},28727(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let i=n(48708),r=n(99029),o=n(42023),s={message:"boolean schema is false"};function a(e,t){let{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(o,s,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(o.default.data):(t.assign((0,r._)`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:n,schema:i}=e;!1===i?(n.var(t,!1),a(e)):n.var(t,!0)}},10208(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let r=n(10396),o=n(7887),s=n(48708),a=n(99029),l=n(94227);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(r.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(i||(t.DataType=i={})),t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){let{gen:n,data:r,opts:s}=e,a=d(t,s.coerceTypes),l=t.length>0&&!(0===a.length&&1===t.length&&(0,o.schemaHasRulesForType)(e,t[0]));if(l){let o=g(t,r,s.strictNumbers,i.Wrong);n.if(o,()=>{a.length?h(e,t,a):v(e)})}return l};let u=new Set(["string","number","integer","boolean","null"]);function d(e,t){return t?e.filter(e=>u.has(e)||"array"===t&&"array"===e):[]}function h(e,t,n){let{gen:i,data:r,opts:o}=e,s=i.let("dataType",(0,a._)`typeof ${r}`),l=i.let("coerced",(0,a._)`undefined`);for(let e of("array"===o.coerceTypes&&i.if((0,a._)`${s} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>i.assign(r,(0,a._)`${r}[0]`).assign(s,(0,a._)`typeof ${r}`).if(g(t,r,o.strictNumbers),()=>i.assign(l,r))),i.if((0,a._)`${l} !== undefined`),n))(u.has(e)||"array"===e&&"array"===o.coerceTypes)&&c(e);function c(e){switch(e){case"string":i.elseIf((0,a._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,a._)`"" + ${r}`).elseIf((0,a._)`${r} === null`).assign(l,(0,a._)`""`);return;case"number":i.elseIf((0,a._)`${s} == "boolean" || ${r} === null
5
+ failing expression: ${e}`)}return null}function tK(e,t,n,i){let{myValue:r,patient:o}=i,{sex:s,age:a}=o??{};"field"===e.type&&void 0===r&&e.value&&(r=n[e.value.id]);let l=new tH;l.putObject("prevEnc",{value:i.previousEncounter||{obs:[]},getValue(e){return this.value.obs.find(t=>t.concept.uuid==e)}});let c=i?.visit??{},u=c?.visitType||{uuid:""},d=u.uuid??"",h={isEmpty:th.A};return{...new tF(e,o,t,n),...oQ(),...i,...n,patient:o,myValue:r,sex:s,age:a,HD:l,visit:c,visitType:u,visitTypeUuid:d,_:h}}function tY(e){let t=tU(e);if(tW.has(t))return tW.get(t);let n=(0,a.compile)(e);return tW.set(t,n),n}function tQ(e,t,n){for(let i of(0,a.extractVariableNames)(e)){let e=n.find(e=>e.id===i);e&&tV(t,e)}}function tZ(e,t,n,i){return"embedded-view"==i||("automatic"==e?"maximized"==n&&t.endsWith("desktop"):"single-line"==e)}function tJ(e,t){let n=e.validators.find(e=>"conditionalAnswered"===e.type).referenceQuestionId,i=t.find(e=>e.id==n);i&&(i.fieldDependents||(i.fieldDependents=new Set)).add(e.id)}function tX(e,t,n){if("object"!=typeof e.required)return!1;let{referenceQuestionAnswers:i,referenceQuestionId:r}=e.required,o=t.find(e=>e.id==r);return!!o&&((o.fieldDependents||(o.fieldDependents=new Set)).add(e.id),i?.includes(n[r]))}function t0(e,t,n,i,r,o){let{value:s}=e;return o(s.disabled?.disableWhenExpression,e,t,n,{mode:i,patient:r})}function t1(e,t,n,i,r,o,s){let{value:a,type:l}=e,c=o(a.hide?.hideWhenExpression,e,t,n,{mode:i,patient:r});e.value.isHidden=c,"field"==l&&e.value?.questions?.length&&e.value?.questions.forEach(e=>{e.isParentHidden=c}),"page"==l&&a.sections.forEach(e=>{e.isParentHidden=c,t2(c,e,t,s)}),"section"==l&&t2(c,a,t,s)}function t2(e,t,n,i){let r=t.questions.map(e=>e.id);n.filter(e=>r.includes(e.id)).forEach(t=>{t.isParentHidden=e,"group"==t.questionOptions.rendering&&t.questions.forEach(t=>{t.isParentHidden=e}),i?.(t)})}function t4(e,t){if(!e?.includes(":"))return t?.find(t=>t.uuid===e);{let[n,i]=e.split(":");return t?.find(e=>e?.conceptMappings?.find(e=>e?.conceptReferenceTerm?.conceptSource?.name.toUpperCase()===n.toUpperCase()&&e?.conceptReferenceTerm?.code.toUpperCase()===i.toUpperCase()))}}function t3(e,t=!1){let n=document.getElementById(e);n?.scrollIntoView({behavior:"smooth",block:"start",inline:"center"}),t&&n?.focus()}let t5=(e,t)=>{let n=e.questionOptions.rendering;if("object"!=typeof t)return{value:t,display:t};let i="Observation"===t.resourceType?t8(t,n):t;if(!i)return{value:null,display:null};if("string"==typeof i.value||"number"==typeof i.value){if("date"===n||"datetime"===n){let e=ta(`${i.value}`);return{value:e,display:e4()(e).format("YYYY-MM-DD HH:mm")}}return{value:i.value,display:i.value}}return["toggle","checkbox"].includes(n)?{value:i.value?.uuid,display:i.value?.name?.name}:{value:i.value?.uuid,display:e.questionOptions.answers?.find(e=>e.concept===i.value?.uuid)?.label}};function t9(e){return!e.isHidden&&(e.sections?.some(e=>!e.isHidden&&e.questions?.some(e=>!e.isHidden))??!1)}function t8(e,t){try{return{obsDatetime:e.effectiveDateTime,uuid:e.id,concept:{uuid:e.code.coding[0]?.code,display:e.code.coding[0]?.display},value:t6(e,t)}}catch(e){return console.error("Error converting FHIR Obs to OpenMRS modelling",e),null}}function t6(e,t){switch(t){case"toggle":return e.valueBoolean?{uuid:l.t$}:{uuid:l.Mi};case"date":case"datetime":return e.valueDateTime;case"number":return e.valueQuantity?.value??null;case"radio":case"checkbox":case"select":case"content-switcher":return e.valueCodeableConcept?.coding[0]?{uuid:e.valueCodeableConcept?.coding[0].code,name:{name:e.valueCodeableConcept?.coding[0].display}}:null;default:return e.valueString}}function t7(e,t){let n=e.pages.find(e=>t.meta.pageId===e.id);return n?.sections.find(e=>e.questions.find(e=>e.id===t.id))}var ne=n(10578);function nt(e,t){let{methods:{getValues:n}}=t,i=n();l.FU.includes(e.questionOptions.rendering)&&nn(e,i,t),ni(e,i,t)}function nn(e,t,n){let{sessionMode:i,formFields:r,patient:o,visit:s}=n;e.questionOptions.answers.forEach(n=>{let a=n.disable?.disableWhenExpression;a&&a.includes("myValue")&&(n.disable.isDisabled=tq(n.disable?.disableWhenExpression,{value:e,type:"field"},r,t,{mode:i,patient:o,visit:s}))})}function ni(e,t,n){let{sessionMode:i,formFields:r,patient:o,formFieldValidators:s,formJson:a,methods:{setValue:l},updateFormField:c,setForm:u,visit:d}=n,h=!1;e.fieldDependents&&e.fieldDependents.forEach(e=>{let u=r.find(t=>t.id==e);if(u){if(u.questionOptions.calculate?.calculateExpression&&tG(u.questionOptions.calculate.calculateExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d}).then(e=>{l(u.id,e);let{errors:s,warnings:a}=nr(u,e,n.formFieldValidators,{formFields:r,values:t,expressionContext:{patient:o,mode:i}});u.meta.submission||(u.meta.submission={}),u.meta.submission.errors=s,u.meta.submission.warnings=a,s.length||n.formFieldAdapters[u.type].transformFieldValue(u,e,n),c(u)}).catch(e=>{(0,ne.N)(e,"Error evaluating calculate expression")}),u.hide){let e=t7(a,u),n=e?.questions.some(e=>!e.isHidden);if(t1({value:u,type:"field"},r,t,i,o,tq,c),e){e.questions=e?.questions.map(e=>e.id===u.id?u:e);let t=u.isHidden,i=[...e.questions,u].some(e=>!e.isHidden);n||t?n&&!i&&(e.isHidden=!0,h=!0):(e.isHidden=!1,h=!0)}}if("object"==typeof u.disabled&&u.disabled.disableWhenExpression&&(u.isDisabled=t0({value:u,type:"field"},r,t,i,o,tq)),"object"==typeof u.required&&u.required?.type==="conditionalRequired"&&(u.isRequired=tX(u,r,t)),u.validators?.some(e=>"conditionalAnswered"===e.type)){let e=u.validators?.find(e=>"conditionalAnswered"===e.type),n=s.conditionalAnswered.validate(u,u.meta.submission?.newValue,{...e,expressionContext:{patient:o,mode:i},values:t,formFields:r});u.meta.submission={...u.meta.submission,errors:n}}u?.questionOptions.answers?.filter(e=>!e6(e.hide?.hideWhenExpression)).forEach(e=>{e.isHidden=tq(e.hide?.hideWhenExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})}),u?.questionOptions.answers?.filter(e=>!e6(e.disable?.isDisabled)).forEach(e=>{e.disable.isDisabled=tq(e.disable?.disableWhenExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})}),!u.isHidden&&u.meta.readonlyExpression&&(u.readonly=tq(u.meta.readonlyExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})),tn(u,"repeating")&&!e6(u.questionOptions.repeatOptions?.limitExpression)&&(u.questionOptions.repeatOptions.limit=tq(u.questionOptions.repeatOptions?.limitExpression,{value:u,type:"field"},r,t,{mode:i,patient:o,visit:d})),c(u)}}),e.sectionDependents&&e.sectionDependents.forEach(e=>{for(let n=0;n<a.pages.length;n++){let s=a.pages[n].sections.find(t=>t.label==e);if(s){t1({value:s,type:"section"},r,t,i,o,tq,c),h=!0;break}}}),e.pageDependents&&e.pageDependents?.forEach(e=>{t1({value:a.pages.find(t=>t.label==e),type:"page"},r,t,i,o,tq,c),h=!0}),h&&u(a)}function nr(e,t,n,i){let r=[],o=[];if(e.meta.submission?.unspecified)return{errors:[],warnings:[]};try{e.validators.forEach(s=>{let a=n[s.type]?.validate?.(e,t,{...s,...i});a&&a.forEach(e=>{"error"===e.resultType?r.push(e):"warning"===e.resultType&&o.push(e)})})}catch(e){console.error(e)}return{errors:r,warnings:o}}var no=n(6232);let ns=u().createContext(void 0),na=({methods:e,children:t,...n})=>u().createElement(ns.Provider,{value:{...n,methods:e}},t),nl=()=>{let e=u().useContext(ns);if(!e)throw Error("FormProviderContext must be used within a FormProviderContext");return e},nc="-esm-form-builder__value__value___GMGmn",nu="-esm-form-builder__value__item___U1v45",nd="-esm-form-builder__value__empty___sor36",nh=()=>{let{t:e}=(0,e0.useTranslation)();return u().createElement("div",null,u().createElement("span",{className:nd},"(",e("blank","Blank"),")"))},np=({value:e})=>Array.isArray(e)?u().createElement(nf,{valueArray:e}):u().createElement("div",{className:nc},e),nf=({valueArray:e})=>u().createElement("ul",null,e.map(e=>u().createElement("li",{className:nu},e))),ng="-esm-form-builder__previous-value-review__formField___vrMDb",nm="-esm-form-builder__previous-value-review__row___XRir3",nv="-esm-form-builder__previous-value-review__value___OZCed",nb="-esm-form-builder__previous-value-review__reuseButton___mtoQ-",ny=({previousValue:e,displayText:t,field:n,hideHeader:i,onAfterChange:r})=>{let{t:o}=(0,e0.useTranslation)(),{methods:{setValue:s}}=nl(),a=t=>{t.preventDefault(),s(n.id,e),r(e)};return u().createElement("div",{className:ng},u().createElement("div",{className:nm},!i&&u().createElement("div",null,o("previousValue","Previous value:")),u().createElement("div",{className:nv},u().createElement(np,{value:t}))),u().createElement("div",{className:nb,role:"button",tabIndex:0,onClick:a},o("reuseValue","Reuse value")))},nw="-esm-form-builder__unspecified__unspecified___suBpN",nx=({field:e,fieldValue:t,setFieldValue:n,onAfterChange:i})=>{let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)(!1),{sessionMode:a,updateFormField:l}=nl();(0,c.useEffect)(()=>{e6(t)&&"edit"===a&&(s(!0),e.meta.submission||(e.meta.submission={}),e.meta.submission.unspecified=!0)},[]),(0,c.useEffect)(()=>{e.meta.submission?.unspecified&&(e.meta.submission.newValue||!e6(t))&&(e.meta.submission.unspecified=!1,l(e)),s(!!e.meta.submission?.unspecified)},[e.meta?.submission,e.meta.submission?.unspecified,t]);let d=(0,c.useCallback)(t=>{let r=e.questionOptions.rendering;if(t.target.checked){s(!0);let t="checkbox"===r?[]:"";ti(e),e.meta.submission.unspecified=!0,e.meta.submission.errors=[],e.meta.submission.warnings=[],l(e),n(t),i(t)}else s(!1),e.meta.submission.unspecified=!1,l(e)},[e.questionOptions.rendering]);return!e.isHidden&&!(0,no.H)(e.readonly)&&!ts(a)&&u().createElement("div",{className:nw},u().createElement(g.Checkbox,{id:`${e.id}-unspecified`,labelText:r("unspecified","Unspecified"),value:r("unspecified","Unspecified"),onChange:d,checked:o,disabled:e.isDisabled}))};function n$(e,t,n,i){return!("embedded-view"===e&&n&&(t||i))}let n_="-esm-form-builder__form-field-renderer__unspecifiedContainer___Z9L4T",nS=({fieldId:e,valueAdapter:t,repeatOptions:n})=>{let[i,r]=(0,c.useState)(null),[o,s]=(0,c.useState)([]),[l,d]=(0,c.useState)([]),[h,p]=(0,c.useState)(null),g=nl(),m=!1;try{let e=(0,a.useConfig)({externalModuleName:"@openmrs/esm-form-engine-app"});m=e?.hideUnansweredQuestionsInReadonlyForms??!1}catch(e){console.warn("Failed to load @openmrs/esm-form engine-app config - using hideUnansweredQuestionsInReadonlyForms=false (empty fields will be visible in readonly mode): ",e)}let{methods:{control:v,getValues:b,getFieldState:y},patient:w,sessionMode:x,formFields:$,formFieldValidators:_,addInvalidField:S,removeInvalidField:M,updateFormField:C}=g,E=(0,c.useRef)(null),k=es({control:v,name:e,exact:!0}),A=()=>{},T=(0,c.useMemo)(()=>$.find(t=>t.id===e),[e,$]);(0,c.useEffect)(()=>{if(tn(T,"repeating")&&n?.targetRendering?oH(n.targetRendering).then(e=>{e&&r({value:e})}):oW(T).then(e=>{e&&r({value:e})}),"enter"===x&&(T.historicalExpression||g.previousDomainObjectValue))try{g.processor.getHistoricalValue(T,g).then(e=>{p(e)})}catch(e){console.error(e)}},[]),(0,c.useEffect)(()=>{let{isDirty:e,isTouched:n}=y(T.id),{submission:i,unspecified:r}=T.meta,{calculate:o,defaultValue:s}=T.questionOptions;!e6(k)&&!i?.newValue&&!e&&!r&&(o?.calculateExpression||s)&&t.transformFieldValue(T,k,g);let a=E.current;E.current=null,(e||n)&&(!a||!(0,f.A)(a.value,k))&&L(k)},[k]),(0,c.useEffect)(()=>{T.meta.submission?.errors&&s(T.meta.submission.errors),T.meta.submission?.warnings&&d(T.meta.submission.warnings),T.meta.submission?.unspecified&&(s([]),M(T.id))},[T.meta.submission]);let L=e=>{T.meta.submission?.unspecified&&!e6(e)&&(T.meta.submission.unspecified=!1);let{errors:n,warnings:i}=nr(T,e,_,{formFields:$,values:b(),expressionContext:{patient:w,mode:x}});if(T.meta.submission&&(T.meta.submission.errors=void 0,T.meta.submission.warnings=void 0),o.length&&!n.length?(M(T.id),s([])):n.length&&(s(n),S(T)),n.length||t.transformFieldValue(T,e,g),d(i),nt(T,g),T.meta.groupId){let e=$.find(e=>e.id===T.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===T.id?T:e),C(e))}},O=e=>{E.current={value:e},L(e)};if(!i)return null;let R=i.value;return!n?.targetRendering&&nE(T.questionOptions.rendering)?u().createElement(R,{key:T.id,field:T,value:null,errors:o,warnings:l,setFieldValue:null}):n$(x,!!T.questionOptions.isTransient,e6(k),m)?u().createElement(e1.tH,{FallbackComponent:nM,onReset:A},u().createElement(el,{control:v,name:T.id,render:({field:{value:e,onChange:t,onBlur:n}})=>u().createElement("div",null,u().createElement(R,{key:`${T.id}-input-component`,field:T,value:e,errors:o,warnings:l,setFieldValue:e=>{t(e),O(e),n()}}),nC(T)&&u().createElement("div",{className:n_},T.unspecified&&u().createElement(nx,{key:`${T.id}-unspecified`,field:T,setFieldValue:t,onAfterChange:O,fieldValue:e})),h?.value&&u().createElement("div",null,u().createElement(ny,{key:`${T.id}-previous-value-review`,previousValue:h.value,displayText:h.display,onAfterChange:O,field:T})))})):null};function nM({error:e}){let{t}=(0,e0.useTranslation)();return u().createElement(g.ToastNotification,{"aria-label":t("closesNotification","Closes notification"),caption:"",hideCloseButton:!0,lowContrast:!0,onClose:function(){},onCloseButtonClick:function(){},statusIconDescription:t("notification","Notification"),subtitle:e.message,title:t("errorRenderingField","Error rendering field")})}function nC(e){let{rendering:t}=e.questionOptions;return(0,no.H)(e.unspecified)&&"toggle"!=t&&"group"!=t&&"repeating"!=t&&"markdown"!=t&&"extension-widget"!=t&&"workspace-launcher"!=t}function nE(e){return"group"===e||"repeating"===e}let nk=({field:e,...t})=>{let{t:n}=(0,e0.useTranslation)(),{formFieldAdapters:i,formFields:r}=nl(),o=(0,c.useMemo)(()=>e.questions.map(e=>r.find(t=>t.id===e.id)).filter(e=>!e.isHidden).map((n,r)=>{let o=`${n.id}_${r}`;return n.id===e.id?u().createElement(nM,{error:Error("ObsGroup child has same id as parent question")}):"obsGroup"===n.type&&nE(n.questionOptions.rendering)?u().createElement("div",{key:o,className:p.nestedGroupContainer},u().createElement(nk,{field:n,...t})):i[n.type]?u().createElement("div",{className:h()(p.flexColumn),key:o},u().createElement("div",{className:p.groupContainer},u().createElement(nS,{fieldId:n.id,valueAdapter:i[n.type]}))):void 0}),[e,r]);return u().createElement("div",{className:p.groupContainer},o.length>1?u().createElement(g.FormGroup,{legendText:n(e.label),className:p.boldLegend},o):o)},nA=nk,nT="-esm-form-builder__label__label___hCNId",nL=({value:e,tooltipText:t})=>u().createElement("div",{className:nT},u().createElement(g.DefinitionTooltip,{autoAlign:!0,tabIndex:0,definition:t??""},u().createElement("span",{className:"cds--label"},`${e}:`))),nO="-esm-form-builder__field-value-view__formField___03eTm",nR="-esm-form-builder__field-value-view__readonly___EsDxp",nD="-esm-form-builder__field-value-view__value___Uo2uV",nI="-esm-form-builder__field-value-view__inlineFlexRow___b4Ii6",nj="-esm-form-builder__field-value-view__inlineFlexColumn___9opmW",nN=({label:e,conceptName:t,value:n,isInline:i})=>u().createElement(u().Fragment,null,i?u().createElement("div",{className:nI},u().createElement("div",{className:nj},u().createElement(nL,{value:e,tooltipText:t})),u().createElement("div",{className:nj},e6(n)?u().createElement(nh,null):u().createElement(np,{value:n}))):u().createElement("div",{className:nR},u().createElement("div",{className:nO},u().createElement(nL,{value:e,tooltipText:t}),u().createElement("div",{className:nD},e6(n)?u().createElement(nh,null):u().createElement(np,{value:n}))))),nP="-esm-form-builder__content-switcher__formField___7p+cd",nF="-esm-form-builder__content-switcher__errorLegend___Wo7IC",nU="-esm-form-builder__content-switcher__boldedLegend___ocVuA",nV="-esm-form-builder__content-switcher__selectedOption___Nhf+y";var nz=n(31362);let nH="-esm-form-builder__field-label__required___v5kNF",nW="-esm-form-builder__field-label__questionLabel___iTCWA",nB="-esm-form-builder__field-label__tooltipIcon___i1hW9",nq=({field:e,children:t})=>{let{t:n}=(0,e0.useTranslation)();return e.questionInfo?u().createElement(g.Tooltip,{autoAlign:!0,label:n(e.questionInfo)},u().createElement("div",null,t)):u().createElement(u().Fragment,null,t)},nG=({field:e,customLabel:t})=>{let{t:n}=(0,e0.useTranslation)(),i=!!e.questionInfo,r=t||n(e.label);return u().createElement(nq,{field:e},u().createElement("div",{className:nW,"data-testid":`${e.id}-label`},u().createElement("span",null,r),e.isRequired&&u().createElement("span",{title:n("required","Required"),className:nH},"*"),i&&u().createElement(nz.$$,{size:16,"aria-hidden":"true",className:nB,"data-testid":`${e.id}-information-icon`})))},nK=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=nl(),p=(0,c.useCallback)(e=>{r(e.name)},[r]),f=(0,c.useMemo)(()=>e.questionOptions.answers.filter(e=>!e.isHidden),[e.questionOptions.answers]),m=(0,c.useMemo)(()=>f.findIndex(e=>e.concept==t),[t,f]),v=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a||(0,no.H)(e.readonly)?u().createElement("div",{className:nP},u().createElement(nN,{label:o(e.label),value:t?d[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:v})):!e.isHidden&&u().createElement(g.FormGroup,{legendText:u().createElement("div",{className:nU},u().createElement(nG,{field:e})),className:h()({[nF]:n.length>0,[nU]:0===n.length})},u().createElement(g.ContentSwitcher,{onChange:p,selectedIndex:m,className:nV,size:"md"},f.map((t,n)=>u().createElement(g.Switch,{name:t.concept||t.value,text:o(t.label),key:n,disabled:e.isDisabled}))))},nY="-esm-form-builder__date__datePickerWarn___kHnXv",nQ="-esm-form-builder__date__datePickerLabel___jB51j",nZ="-esm-form-builder__date__boldedLabel___iRLd7",nJ="-esm-form-builder__date__datetime___Vcy8S",nX="-esm-form-builder__date__datePickerSpacing___qjcEN",n0="-esm-form-builder__date__timeInput___LsT4x",n1=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),[s,l]=(0,c.useState)(""),{layoutType:d,sessionMode:p,workspaceLayout:f}=nl(),m=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(p)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,d,f,p),[p,e.readonly,e.inlineRendering,d,f]),v=(0,c.useCallback)(e=>{b(e,s),r(e)},[r,s]),b=(0,c.useCallback)((e,t)=>{if(!e6(t)){let[n,i]=t.split(":").map(Number);e.setHours(n??0,i??0)}},[]),y=(0,c.useCallback)(n=>{let i=n.target.value;l(i);let o="timer"===e.datePickerFormat?new Date:new Date(t);b(o,i),r(o)},[r,b,t]);(0,c.useEffect)(()=>{t&&t instanceof Date&&l([10>t.getHours()?`0${t.getHours()}`:`${t.getHours()}`,10>t.getMinutes()?`0${t.getMinutes()}`:`${t.getMinutes()}`].join(":"))},[t]);let w=(0,c.useMemo)(()=>"timer"===e.datePickerFormat?u().createElement(nG,{field:e}):u().createElement(nG,{field:e,customLabel:o("time","Time")}),[e.datePickerFormat,e.label,o]);return"view"==p||"embedded-view"==p||(0,no.H)(e.readonly)?u().createElement(nN,{label:o(e.label),value:t instanceof Date?tc(e,t):t,conceptName:e.meta?.concept?.display,isInline:m}):!e.isHidden&&u().createElement("div",{className:nJ},("calendar"===e.datePickerFormat||"both"===e.datePickerFormat)&&u().createElement("div",{className:nX},u().createElement(g.Layer,null,u().createElement(a.OpenmrsDatePicker,{id:e.id,onChange:v,labelText:u().createElement("span",{className:nQ},u().createElement(nG,{field:e})),isDisabled:e.isDisabled,isReadOnly:(0,no.H)(e.readonly),isRequired:e.isRequired??!1,isInvalid:n.length>0,invalidText:n[0]?.message,value:t})),i.length>0?u().createElement("div",{className:nY},i[0]?.message):null),"both"===e.datePickerFormat||"timer"===e.datePickerFormat?u().createElement("div",null,u().createElement(g.Layer,null,u().createElement(g.TimePicker,{className:h()(nZ,n0),id:e.id,labelText:w,placeholder:"HH:MM",pattern:"(1[012]|[1-9]):[0-5][0-9]$",type:"time",disabled:"timer"===e.datePickerFormat?e.isDisabled:!t,invalid:n.length>0,invalidText:n[0]?.message,readOnly:(0,no.H)(e.readonly),warning:i.length>0,warningText:i[0]?.message,value:s||(t instanceof Date?t.toLocaleDateString(window.navigator.language):t),onChange:y}))):null)},n2=({field:e,setFieldValue:t})=>{let n=nl();return(0,c.useEffect)(()=>{e.meta?.initialValue?.omrsObject||e6(e.meta.fixedValue)||(t(e.meta.fixedValue),n.formFieldAdapters[e.type].transformFieldValue(e,e.meta.fixedValue,n))},[]),u().createElement(u().Fragment,null)};var n4=n(29012);let n3="-esm-form-builder__markdown-wrapper__markdownWrapper___l1Syp",n5={a:({node:e,...t})=>u().createElement("a",{...t,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer"})},n9=({markdown:e})=>u().createElement("div",{className:n3},u().createElement(n4.o,{children:e,unwrapDisallowed:!0,allowedElements:["h1","h2","h3","h4","h5","h6","p","strong","em","code","pre","ul","ol","li","a","blockquote","hr","br"],components:n5})),n8=({field:e})=>{let{t}=(0,e0.useTranslation)(),n=e=>Array.isArray(e)?e.map(e=>t(e,{defaultValue:e,interpolation:{escapeValue:!1}})).join("\n\n"):"string"==typeof e?t(e,{defaultValue:e,interpolation:{escapeValue:!1}}):e;return!e.isHidden&&u().createElement(n9,{markdown:n(e.value)})},n6={boldedLabel:"-esm-form-builder__multi-select__boldedLabel___S2peR",errorLabel:"-esm-form-builder__multi-select__errorLabel___E6HgK",selectionDisplay:"-esm-form-builder__multi-select__selectionDisplay___ToQER",tagContainer:"-esm-form-builder__multi-select__tagContainer___rt9TQ",checkbox:"-esm-form-builder__multi-select__checkbox___+3cXj"},n7=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=nl(),[h,p]=(0,c.useState)(0),[f,m]=(0,c.useState)([]),v=(0,c.useRef)(!0),b=e.questionOptions.answers.filter(e=>!e.isHidden).map((t,n)=>({id:`${e.id}-${t.concept}`,concept:t.concept,label:o(t.label),key:n,disabled:t.disable?.isDisabled,readonly:(0,no.H)(e.readonly)})),y=(0,c.useMemo)(()=>t?.length&&h<1?(p(h+1),b.filter(e=>t?.includes(e.concept))):[],[t]),w=({selectedItems:e})=>{r(e.map(e=>e.concept))},x=(0,c.useMemo)(()=>(0,no.H)(e.questionOptions.isCheckboxSearchable),[e.questionOptions.isCheckboxSearchable]);(0,c.useEffect)(()=>{v.current&&1===h&&(m(y.map(e=>e.concept)),v.current=!1)},[y,v]);let $=e=>{let t,n=e.concept;m(t=f.some(e=>e===n)?f.filter(e=>e!==n):f.some(e=>e===n)?f.filter(e=>e!==n):[...f,n]),r(t)},_=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a?u().createElement("div",{className:n6.formField},u().createElement(nN,{label:o(e.label),value:t?d[e.type]?.getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:_})):!e.isHidden&&u().createElement(u().Fragment,null,u().createElement("div",{className:n6.boldedLabel},u().createElement(g.Layer,null,x?u().createElement(g.FilterableMultiSelect,{disabled:e.isDisabled,id:e.id,initialSelectedItems:y,invalid:n.length>0,invalidText:n[0]?.message,items:b,itemToString:e=>e?o(e.label):" ",key:e.id,onChange:w,placeholder:o("search","Search")+"...",readOnly:(0,no.H)(e.readonly),titleText:u().createElement(nG,{field:e}),warn:i.length>0,warnText:i[0]?.message}):u().createElement(g.CheckboxGroup,{legendText:u().createElement(nG,{field:e}),readOnly:(0,no.H)(e.readonly)},b?.map((t,n)=>u().createElement(g.Checkbox,{className:n6.checkbox,checked:f.some(e=>e===t.concept),disabled:t.disabled,id:`${e.id}-${t.concept}`,key:`${e.id}-${t.concept}-${n}`,labelText:o(t.label),name:t.concept,onChange:()=>$(t),readOnly:(0,no.H)(e.readonly)}))))),x&&u().createElement("div",{className:n6.selectionDisplay},t?.length?u().createElement("div",{className:n6.tagContainer},d[e.type]?.getDisplayValue(e,t)?.map((e,t)=>u().createElement(g.Tag,{key:t,type:"cool-gray"},o(e)))):u().createElement(nh,null)))},ie={boldedLabel:"-esm-form-builder__number__boldedLabel___knlll",errorLabel:"-esm-form-builder__number__errorLabel___nt7Zx",controlWidthConstrained:"-esm-form-builder__number__controlWidthConstrained___dJyLz"},it=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l}=nl(),d=(0,c.useMemo)(()=>isNaN(t)?"":t??"",[t]),p=(0,c.useCallback)(e=>void 0===e||isNaN(Number(e))?void 0:Number(e),[]),f=(0,c.useCallback)((e,{value:t})=>{let n=p(t);r(isNaN(n)?void 0:n)},[r,p]),m=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]),v=p(e.questionOptions.max),b=p(e.questionOptions.min);return"view"==a||"embedded-view"==a?u().createElement("div",{className:ie.formField},u().createElement(nN,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:m})):!e.isHidden&&u().createElement(g.Layer,null,u().createElement(g.NumberInput,{id:e.id,invalid:n.length>0,invalidText:n[0]?.message,label:u().createElement(nG,{field:e}),max:v,min:b,name:e.id,value:d,onChange:f,allowEmpty:!0,size:"lg",hideSteppers:e.hideSteppers??!1,disabled:e.isDisabled,readOnly:(0,no.H)(e.readonly),className:h()(ie.controlWidthConstrained,ie.boldedLabel),warn:i.length>0,warnText:i[0]?.message,step:e.questionOptions.step??.01}))},ii="-esm-form-builder__radio__boldedLegend___MaNSB",ir="-esm-form-builder__radio__errorMessage___oqROk",io=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l,formFieldAdapters:d}=nl(),h=e=>{r(e)},p=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a||(0,no.H)(e.readonly)?u().createElement(nN,{label:o(e.label),value:t?d[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:p}):!e.isHidden&&u().createElement(g.FormGroup,{legendText:u().createElement(nG,{field:e}),className:ii,disabled:e.isDisabled,invalid:n?.length>0},u().createElement(g.RadioButtonGroup,{name:e.id,valueSelected:t,onChange:h,readOnly:(0,no.H)(e.readonly),orientation:e.questionOptions?.orientation||"vertical"},e.questionOptions.answers.filter(e=>!e.isHidden).map((n,i)=>u().createElement(g.RadioButton,{id:`${e.id}-${n.label}`,labelText:o(n.label)??"",value:n.concept,key:i,onClick:e=>{t&&e.target.checked?(e.target.checked=!1,e.preventDefault(),h(null)):h(n.concept)}}))),(n?.length>0||i?.length>0)&&u().createElement("div",null,u().createElement("div",{className:ir},n.length>0?n[0].message:i.length>0?i[0].message:null)))},is="-esm-form-builder__dropdown__boldedLabel___y7U7P",ia=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:d,formFieldAdapters:h}=nl(),p=(0,c.useCallback)(({selectedItem:e})=>{r(e===l.ZA?null:e)},[r]),f=(0,c.useCallback)(t=>{let n=e.questionOptions.answers.find(e=>e.value?e.value==t:e.concept==t);return n?o(n.label):""},[e.questionOptions.answers,o]),m=(0,c.useMemo)(()=>{let t=e.questionOptions.answers;return t.some(e=>e.value===l.ZA)||t.unshift({value:l.ZA,label:o("chooseAnOption","Choose an option")}),t.filter(e=>!e.isHidden).map(e=>e.value||e.concept)},[e.questionOptions.answers]),v=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,d,a),[a,e.readonly,e.inlineRendering,s,d]);return"view"==a||"embedded-view"==a?u().createElement(nN,{label:o(e.label),value:t?h[e.type].getDisplayValue(e,t):t,conceptName:e.meta?.concept?.display,isInline:v}):!e.isHidden&&u().createElement("div",{className:is},u().createElement(g.Layer,null,u().createElement(g.Dropdown,{"aria-label":o(e.label),disabled:e.isDisabled,id:e.id,invalid:n.length>0,invalidText:n[0]?.message,items:m,itemToString:f,label:"",onChange:p,readOnly:(0,no.H)(e.readonly),selectedItem:e6(t)?l.ZA:t,titleText:u().createElement(nG,{field:e}),warn:i.length>0,warnText:i[0]?.message})))},il="-esm-form-builder__text-area__boldedLabel___SSRKf",ic=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),[s,a]=(0,c.useState)(t),{layoutType:l,sessionMode:d,workspaceLayout:h}=nl(),p=e=>{e.preventDefault(),s!==t&&a(t)},f=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(d)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,l,h,d),[d,e.readonly,e.inlineRendering,l,h]);return"view"==d||"embedded-view"==d?u().createElement(nN,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&u().createElement("div",{className:il},u().createElement(g.Layer,null,u().createElement(g.TextArea,{id:e.id,labelText:u().createElement(nG,{field:e}),name:e.id,onChange:r,onBlur:p,value:t||"",rows:e.questionOptions.rows||4,disabled:e.isDisabled,readOnly:(0,no.H)(e.readonly),invalid:n.length>0,invalidText:n[0]?.message,warn:i.length>0,warnText:i[0]?.message,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength)})))},iu="-esm-form-builder__text__boldedLabel___LG-wl",id=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),{layoutType:s,sessionMode:a,workspaceLayout:l}=nl(),[d,h]=(0,c.useState)(null),p=e=>{e.preventDefault(),d!==t&&h(t)},f=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(a)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s,l,a),[a,e.readonly,e.inlineRendering,s,l]);return"view"==a||"embedded-view"==a?u().createElement(nN,{label:o(e.label),value:t,conceptName:e.meta?.concept?.display,isInline:f}):!e.isHidden&&u().createElement("div",{className:iu},u().createElement(g.Layer,null,u().createElement(g.TextInput,{disabled:e.isDisabled,enableCounter:!!(e.questionOptions.max||e.questionOptions.maxLength),id:e.id,invalid:n.length>0,invalidText:n[0]?.message,labelText:u().createElement(nG,{field:e}),maxCount:e.questionOptions.max?Number(e.questionOptions.max):Number(e.questionOptions.maxLength),name:e.id,onBlur:p,onChange:e=>{r(e.target.value)},readOnly:(0,no.H)(e.readonly),value:t??"",warn:i.length>0,warnText:i.length>0?i[0].message:void 0})))},ih="-esm-form-builder__toggle__boldedLabel___mj4Gi",ip=({field:e,value:t,errors:n,warnings:i,setFieldValue:r})=>{let{t:o}=(0,e0.useTranslation)(),s=nl(),a=e=>{r(e)};(0,c.useEffect)(()=>{e.meta?.initialValue?.omrsObject||"enter"!=s.sessionMode||s.formFieldAdapters[e.type].transformFieldValue(e,t??!1,s)},[]);let l=(0,c.useMemo)(()=>!!(["view","embedded-view"].includes(s.sessionMode)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,s.layoutType,s.workspaceLayout,s.sessionMode),[s.sessionMode,e.readonly,e.inlineRendering,s.layoutType,s.workspaceLayout]);return"view"==s.sessionMode||"embedded-view"==s.sessionMode?u().createElement(nN,{label:o(e.label),value:e6(t)?t:s.formFieldAdapters[e.type].getDisplayValue(e,t),conceptName:e.meta?.concept?.display,isInline:l}):!e.isHidden&&u().createElement("div",{className:ih},u().createElement(g.Toggle,{labelText:o(e.label),className:ih,id:e.id,labelA:e.questionOptions.toggleOptions.labelFalse,labelB:e.questionOptions.toggleOptions.labelTrue,onToggle:a,toggled:!!t,disabled:e.isDisabled,readOnly:(0,no.H)(e.readonly)}))};var ig=n(44861);let im=[{name:"drug",datasource:{name:"drug_datasource",config:{class:"8d490dfc-c2cc-11de-8d13-0010c6dffd0f"}}},{name:"select-concept-answers",datasource:{name:"select_concept_answers_datasource",config:{concept:""}}},{name:"encounter-provider",datasource:{name:"provider_datasource"}},{name:"encounter-role",datasource:{name:"encounter_role_datasource"}},{name:"encounter-location",datasource:{name:"location_datasource"}},{name:"problem",datasource:{name:"problem_datasource",config:{class:["8d4918b0-c2cc-11de-8d13-0010c6dffd0f","8d492954-c2cc-11de-8d13-0010c6dffd0f","8d492b2a-c2cc-11de-8d13-0010c6dffd0f"]}}}],iv=e=>im.find(t=>t.name===e),ib=e=>{let t=e.questionOptions.config?.referencedField,{methods:{control:n}}=nl();return es({control:n,name:t,exact:!0,disabled:!t})},iy="-esm-form-builder__ui-select-extended__boldedLabel___nE2bK",iw="-esm-form-builder__ui-select-extended__loader___F1lqE",ix="-esm-form-builder__ui-select-extended__item___1+q74",i$="-esm-form-builder__ui-select-extended__code___Cd2IH",i_="-esm-form-builder__ui-select-extended__label___GOcHS",iS=({field:e,errors:t,warnings:n,setFieldValue:i})=>{let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)([]),[a,l]=(0,c.useState)(!1),[d,h]=(0,c.useState)(!1),[p,f]=(0,c.useState)(""),m=(0,c.useRef)(!1),[v,b]=(0,c.useState)(null),[y,w]=(0,c.useState)({}),x=ib(e),$=(0,no.H)(e.questionOptions.isSearchable),{layoutType:_,sessionMode:S,workspaceLayout:M,methods:{control:C,getFieldState:E,getValues:k}}=nl(),A=es({control:C,name:e.id,exact:!0}),{isDirty:T}=E(e.id),L=(0,c.useMemo)(()=>!!(ts(S)||(0,no.H)(e.readonly))&&tZ(e.inlineRendering,_,M,S),[S,e.readonly,e.inlineRendering,_,M]),O=(0,c.useMemo)(()=>o.find(e=>e.uuid==A)||null,[o,A]),R=(0,c.useRef)(0),D=(0,c.useMemo)(()=>(0,ig.A)((t,n)=>{let i=R.current;h(!0),n.fetchData(t,y).then(t=>{i===R.current&&(t.length&&s(i=>{let r=k(e.id),o=i.find(e=>e.uuid==r),s=t.map(e=>n.toUuidAndDisplay(e,y));return o&&!s.some(e=>e.uuid==o.uuid)&&s.unshift(o),s}),h(!1))}).catch(e=>{i===R.current&&(console.error(e),h(!1))})},300),[y,e.id,k]),I=(0,c.useCallback)(e=>o.some(t=>t.display?.toLowerCase().includes(e.toLowerCase())),[o]);return((0,c.useEffect)(()=>{let t=e.questionOptions?.datasource?.name;w(t?e.questionOptions.datasource?.config:iv(e.questionOptions.rendering)?.datasource?.config),oY(t||e.questionOptions.rendering).then(e=>b(e))},[e.questionOptions?.datasource]),(0,c.useEffect)(()=>{let t=!1;return v&&!(0,no.H)(e.questionOptions.isSearchable)&&(s([]),l(!0),v.fetchData(null,{...y,referencedValue:x}).then(e=>{t||(s(e.map(e=>v.toUuidAndDisplay(e,y))),l(!1))}).catch(e=>{t||(console.error(e),l(!1),s([]))})),()=>{t=!0}},[v,y,x]),(0,c.useEffect)(()=>(v&&$&&!e6(p)&&!I(p)?D(p,v):h(!1),()=>{D.cancel(),R.current++}),[v,p,$,D]),(0,c.useEffect)(()=>{let e=!1;return A&&!T&&v&&$&&!o.length&&(l(!0),v.fetchSingleItem(A,y).then(t=>{e||(s([v.toUuidAndDisplay(t,y)]),l(!1))}).catch(t=>{e||(console.error(t),l(!1))})),()=>{e=!0}},[A,T,v,$,o,y]),a)?u().createElement(g.DropdownSkeleton,null):ts(S)||(0,no.H)(e.readonly)?u().createElement(nN,{label:r(e.label),value:A?iM(o.find(e=>e.uuid==A)):A,conceptName:e.meta?.concept?.display,isInline:L}):!e.isHidden&&u().createElement("div",{className:iy},u().createElement(g.Layer,null,u().createElement(g.ComboBox,{id:e.id,titleText:u().createElement(nG,{field:e}),items:o,itemToElement:e=>u().createElement("span",{className:ix},e?.code&&u().createElement("span",{className:i$},e.code),u().createElement("span",{className:i_},e?.display)),itemToString:iM,selectedItem:O,placeholder:$?r("search","Search")+"...":null,onChange:({selectedItem:e})=>{D.cancel(),R.current++,h(!1),m.current=!0,i(e?.uuid)},disabled:e.isDisabled,readOnly:(0,no.H)(e.readonly),invalid:t.length>0,invalidText:t.length&&t[0].message,onInputChange:t=>{if(m.current){m.current=!1;return}e.questionOptions.isSearchable&&f(t)},onBlur:e=>{e.target.value||i(null)}}),d&&u().createElement(g.InlineLoading,{className:iw,description:r("searching","Searching")+"..."})))};function iM(e){return e?.code?`${e.code} ${e.display}`:e?.display??""}let iC="-esm-form-builder__workspace-launcher__label___E9RiP",iE="-esm-form-builder__workspace-launcher__workspaceButton___MlMFr",ik="-esm-form-builder__workspace-launcher__noPatientNotification___28OZv",iA=({field:e})=>{let{t}=(0,e0.useTranslation)(),{sessionMode:n,patient:i,visit:r}=nl(),o=async()=>{let n=e.questionOptions?.workspaceName;if(!n)return void(0,a.showSnackbar)({title:t("invalidWorkspaceName","Invalid workspace name."),subtitle:t("invalidWorkspaceNameSubtitle","Please provide a valid workspace name."),kind:"error",isLowContrast:!0});let o=e.questionOptions?.workspaceProps??{},s={patient:i,patientUuid:i?.id,visitContext:r};try{await (0,a.launchWorkspace2)(n,o,s)}catch(e){(0,a.showSnackbar)({title:t("errorLaunchingWorkspace","Error launching workspace"),subtitle:e?.message??t("errorLaunchingWorkspaceSubtitle","An unexpected error occurred while launching the workspace."),kind:"error",isLowContrast:!0})}};return e.isHidden||ts(n)?null:u().createElement("div",null,u().createElement("div",{className:iC},u().createElement(nG,{field:e})),u().createElement("div",{className:iE},u().createElement(g.Button,{disabled:(0,no.H)(e.readonly??!1)||!i,onClick:o},e.questionOptions.buttonLabel?t(e.questionOptions.buttonLabel):t("launchWorkspace","Launch Workspace")),!i&&u().createElement(g.InlineNotification,{className:ik,kind:"info",lowContrast:!0,hideCloseButton:!0,title:t("noPatientContext","No patient selected"),subtitle:t("noPatientContextSubtitle","This button is only active when a patient chart is open.")})))};var iT=n(20903);function iL(e,t,n){let i=[],r=(0,iT.A)(e);return r.questionOptions.repeatOptions={...r.questionOptions.repeatOptions??{}},r.meta={repeat:{...r.meta??{},isClone:!0},initialValue:{omrsObject:t}},r.id=`${r.id}_${n}`,r.questions?.forEach(e=>{i.push(e.id),e.id=`${e.id}_${n}`,e.meta.groupId=r.id,e.meta.initialValue={omrsObject:null,refinedValue:null},e.fieldDependents=new Set,ti(e),e.hide&&e.hide.hideWhenExpression&&(e.hide.hideWhenExpression=iO(e.hide.hideWhenExpression,n,i)),e.validators?.length&&e.validators.forEach(e=>{"js_expression"===e.type&&(e.failsWhenExpression=iO(e.failsWhenExpression,n,i))}),e.questionOptions.calculate?.calculateExpression&&(e.questionOptions.calculate.calculateExpression=iO(e.questionOptions.calculate?.calculateExpression,n,i))}),r}function iO(e,t,n){let i=[...new Set(n)];if(!i.length)return e;let r=i.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return e.replace(RegExp(`\\b(?:${r})\\b`,"g"),e=>`${e}_${t}`)}function iR(e,t){let n=Number(e);return!(e6(e)||isNaN(n))&&t>=n}let iD=[],iI={async getInitialValue(e,t,n){let i=iW(tt((t??n.domainObjectValue).obs),iD,e);return tn(e,"file")&&i?.length?iB(e,i):ij(e,i,!0)},async getPreviousValue(e,t,n){let i=t??n.previousDomainObjectValue;if(i){let t=ij(e,iW(tt(i.obs),iD,e),!0);if(!e6(t))return{value:t,display:this.getDisplayValue(e,t)}}return null},getDisplayValue:(e,t)=>{let n=e.questionOptions.rendering;return e6(t)?t:t instanceof Date?tc(e,t):"checkbox"===n?t.map(t=>e.questionOptions.answers?.find(e=>e.concept==t)?.label):"toggle"===n?t?e.questionOptions.toggleOptions.labelTrue:e.questionOptions.toggleOptions.labelFalse:l.FU.includes(n)?e.questionOptions.answers?.find(e=>e.concept==t)?.label:t},transformFieldValue:(e,t,n)=>(ti(e),!e.meta.initialValue?.omrsObject&&e6(t))?null:tn(e,"checkbox")?iz(e,Array.isArray(t)?t:[t]):tn(e,"file")?iH(e,t):!e6(t)&&iV(e,t)?tr(e,iF(e,t),void 0):e.meta.initialValue?.omrsObject&&e6(t)?tr(e,void 0,iP(e.meta.initialValue.omrsObject)):e6(t)?null:tr(e,iN(e,t),void 0),tearDown:function(){iD=[]}};function ij(e,t=[],n=!1){let i=e.questionOptions.rendering;if(e.meta||(e.meta={initialValue:{omrsObject:null,refinedValue:null}}),t.length){if("checkbox"==i)return iD.push(...t.map(e=>e.uuid)),e.meta.initialValue.omrsObject=n?t:null,t.map(e=>e.value.uuid);let r=t[0];if(n&&(e.meta.initialValue.omrsObject={...r}),iD.push(r.uuid),"string"==typeof r.value||"number"==typeof r.value){if(i.startsWith("date")){let t=ta(r.value);return n&&(e.meta.initialValue.omrsObject.value=e4()(t).format("YYYY-MM-DD HH:mm")),t}return r.value}return"toggle"==i?r.value.uuid===l.t$:"fixed-value"==i?e.fixedValue:r.value?.uuid}return""}function iN(e,t){return e6(t)&&"obsGroup"!==e.type?null:{..."obsGroup"===e.type?{groupMembers:[]}:{value:e.questionOptions.rendering.startsWith("date")?iU(e,t):t},concept:e.questionOptions.concept,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function iP(e){return{uuid:e.uuid,voided:!0}}function iF(e,t){let n=e.meta.initialValue?.omrsObject,i=e.questionOptions.rendering.startsWith("date")?iU(e,t):t;return{uuid:n.uuid,value:i,formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`}}function iU(e,t){if(e.datePickerFormat)switch(e.datePickerFormat){case"calendar":default:return e4()(t).format("YYYY-MM-DD");case"timer":return e4()(t).format("HH:mm");case"both":return e4()(t).format("YYYY-MM-DD HH:mm")}return t}function iV(e,t){let n=e.meta.initialValue?.omrsObject;return!e6(n)&&(l.FU.includes(e.questionOptions.rendering)?n.value.uuid!==t:tn(e,"date")?0!==e4()(t).diff(e4()(n.value),"D"):tn(e,"datetime")||"both"===e.datePickerFormat?0!==e4()(t).diff(e4()(n.value),"minute"):tn(e,"toggle")?n.value.uuid===l.t$!==t:n.value!==t)}function iz(e,t=[]){let n=e.meta.initialValue?.omrsObject;if(n?.length&&e6(t))return tr(e,null,n.map(e=>iP(e)));if(n?.length&&!e6(t)){let i=n.filter(e=>!t.includes(e.value.uuid));return tr(e,t.filter(e=>!n.some(t=>t.value.uuid===e)).map(t=>iN(e,t)),i.map(e=>iP(e)))}return tr(e,t.map(t=>iN(e,t)),void 0)}function iH(e,t=[]){let n=t.filter(e=>e.uuid&&e.voided).map(e=>({uuid:e.uuid,voided:!0})),i=e.meta.submission.newValue=t.filter(e=>!e.uuid).map(t=>({formFieldNamespace:"rfe-forms",formFieldPath:`rfe-forms-${e.id}`,...t}));return tr(e,i,n)}function iW(e,t,n){let i=e.filter(e=>!!tn(n,"file")&&e.formFieldPath==`rfe-forms-${n.id}`||e.formFieldPath==`rfe-forms-${n.id}`&&e.concept.uuid==n.questionOptions.concept);if(!i?.length){let i=e.filter(e=>e.concept.uuid==n.questionOptions.concept);return t?.length?i.filter(e=>!t.includes(e.uuid)):i}return i}async function iB(e,t){let n=new AbortController,i=await Promise.all(t.map(e=>(0,a.getAttachmentByUuid)(e.uuid,n).then(e=>e.data).catch(t=>(console.error(`Failed to fetch attachment ${e.uuid}:`,t),null))));return e.meta.initialValue={omrsObject:t},i.filter(Boolean).map(e=>({uuid:e.uuid,base64Content:`${window.openmrsBase}${a.attachmentUrl}/${e.uuid}/bytes`,fileName:e.filename,fileDescription:e.comment,fileType:e.bytesContentFamily?.toLowerCase()}))}let iq={validate:(e,t)=>!e6(t)&&l.FU.includes(e.questionOptions.rendering)&&!(Array.isArray(t)?t:[t]).every(t=>e.questionOptions.answers?.find(e=>e.concept===t||e.value===t))?[{resultType:"error",errCode:"invalid.defaultValue",message:"Value not found in coded answers list"}]:e6(t)||"date"!=e.questionOptions.rendering||e4()(t).isValid()?!e6(t)&&"number"==e.questionOptions.rendering&&isNaN(t)?[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid numerical value: '${t}'`}]:[]:[{resultType:"error",errCode:"invalid.defaultValue",message:`Invalid date value: '${t}'`}]},iG=[],iK="testorder",iY="6f0c9a92-6f24-11e3-af88-005056821db0",iQ={transformFieldValue:function(e,t,n){if(ti(e),"edit"===n.sessionMode&&e.meta.initialValue?.omrsObject)return iJ(t,e,n.currentProvider.uuid);let i=iZ(t,e,n.currentProvider.uuid);return tr(e,i,null),i},getInitialValue:function(e,t,n){let i=e.questionOptions.answers?.map(e=>e.concept)||[],r=t?.orders.filter(e=>!iG.includes(e.uuid)&&!e.voided).find(e=>i.includes(e.concept.uuid));return r?(e.meta={...e.meta||{},initialValue:{omrsObject:r,refinedValue:r.concept.uuid}},iG.push(r.uuid),r.concept.uuid):null},getPreviousValue:function(e,t,n){return null},getDisplayValue:(e,t)=>e.questionOptions.answers?.find(e=>e.concept==t)?.label||t,tearDown:function(){iG=[]}};function iZ(e,t,n){return e?{action:"NEW",concept:e,type:t?.questionOptions?.orderType||iK,careSetting:t?.questionOptions?.orderSettingUuid||iY,orderer:n}:null}function iJ(e,t,n){let i=t.meta.initialValue?.omrsObject;if(e===i?.concept?.uuid)return null;let r={uuid:i?.uuid,voided:!0};return tr(t,iZ(e,t,n),r),t.meta.submission.newValue||null}let iX=[],i0={transformFieldValue:function(e,t,n){if(ti(e),e.meta.initialValue?.omrsObject&&e6(t))return tr(e,void 0,i3(e.meta.initialValue.omrsObject));if(!e6(t)){let i=e.meta.initialValue?.omrsObject;if(i4(i,t))return tr(e,i2(t,e,i,n.patient.id),void 0)}let i=i1(t,e,n.patient.id);return tr(e,i,null),i},getInitialValue:function(e,t,n){let i=(t??n.domainObjectValue).diagnoses.find(t=>t.formFieldPath===`rfe-forms-${e.id}`);return i?(e.meta={...e.meta||{},initialValue:{omrsObject:i,refinedValue:i.diagnosis?.coded.uuid}},iX.includes(i.diagnosis?.coded?.uuid)||iX.push(i.diagnosis?.coded?.uuid),i.diagnosis?.coded.uuid):null},getPreviousValue:function(e,t,n){return null},getDisplayValue:(e,t)=>e.questionOptions.answers?.find(e=>e.concept==t)?.label||t,tearDown:function(){iX=[]}},i1=(e,t,n)=>e?{patient:n,condition:null,diagnosis:{coded:e},certainty:(0,no.H)(t.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:t.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${t.id}`,formFieldNamespace:"rfe-forms"}:null;function i2(e,t,n,i){return{patient:i,condition:null,diagnosis:{coded:e},certainty:(0,no.H)(t.questionOptions?.diagnosis?.isConfirmed)?"CONFIRMED":"PROVISIONAL",rank:t.questionOptions.diagnosis?.rank??1,formFieldPath:`rfe-forms-${t.id}`,formFieldNamespace:"rfe-forms",uuid:n.uuid}}function i4(e,t){return!e6(e)&&e.value!==t}function i3(e){return{uuid:e.uuid,voided:!0}}function i5(e,t,n,i,r){let{patient:o,formJson:s,domainObjectValue:a,formFields:l,visit:c,deletedFields:u}=e,d=[...l,...u],h=[];rr(h,d);let p=rl(d),f=rf(d),g={};return a?(Object.assign(g,a),-1===g.encounterProviders.findIndex(e=>e.provider.uuid==i)&&(g.encounterProviders=[...g.encounterProviders,{provider:i,encounterRole:n}]),t&&(g.encounterDatetime=t),g.location=r,g.form={uuid:s.uuid},c&&(g.visit=c.uuid),g.obs=h,g.orders=p,g.diagnoses=f):(g={patient:o.id,location:r,encounterType:s.encounterType,encounterProviders:[{provider:i,encounterRole:n}],obs:h,form:{uuid:s.uuid},visit:c?.uuid,orders:p,diagnoses:f},t&&(g.encounterDatetime=t)),g}function i9(e,t){return e.filter(e=>"patientIdentifier"===e.type&&to(e)).map(e=>e.meta.submission.newValue)}function i8(e,t){return t.map(t=>(0,tM.savePatientIdentifier)(t,e.id))}function i6(e){return e.filter(e=>"personAttribute"===e.type&&to(e)).map(e=>e.meta.submission.newValue)}function i7(e,t){return t.map(t=>(0,tM.savePersonAttribute)(t,e.id))}function re(e,t,n){let i=e.filter(e=>"programState"===e.type&&to(e)),r=new Map;return i.forEach(e=>{let i=e.questionOptions.programUuid,o=e.meta.submission.newValue,s=n.find(e=>e.program.uuid===i);s?r.has(i)?r.get(i).states.push(o):r.set(i,{uuid:s.uuid,states:[o]}):r.has(i)?r.get(i).states.push(o):r.set(i,{patient:t.id,program:i,states:[o],dateEnrolled:e4()().format()})}),Array.from(r.values())}function rt(e){let t=new AbortController;return Promise.all(e.map(e=>(0,tM.saveProgramEnrollment)(e,t)))}function rn(e,t,n){let i=e?.filter(e=>e?.questionOptions.rendering==="file"&&to(e));return i?.length?Promise.all(i.flatMap(e=>{let n="string"==typeof t?.patient?t?.patient:t?.patient?.uuid;return(e.meta.submission.newValue??[]).map(e=>(0,tM.createAttachment)(n,t.uuid,e))})):[]}function ri(e){let{formFields:t,location:n,currentProvider:i,customDependencies:r,sessionDate:o,domainObjectValue:s,visit:a}=e,{defaultEncounterRole:l}=r,c=t.find(e=>"encounterRole"===e.type)?.meta.submission?.newValue||l?.uuid,u=t.find(e=>"encounterProvider"===e.type)?.meta.submission?.newValue||i.uuid,d=t.find(e=>"encounterDatetime"===e.type)?.meta.submission?.newValue,h=a?.stopDatetime?o:void 0;return{encounterRole:c,encounterProvider:u,encounterDate:d??(s?.encounterDatetime?new Date(s.encounterDatetime):h),encounterLocation:t.find(e=>"encounterLocation"===e.type)?.meta.submission?.newValue||s?.location?.uuid||n.uuid}}function rr(e,t){t.filter(e=>rd(e)).forEach(n=>ro(e,n,t))}function ro(e,t,n){ru(t)&&t.meta.initialValue.omrsObject?ra(e,t):"obsGroup"===t.type?rs(e,t,n):(tn(t,"file")||rc(e,t.meta.submission.newValue),rc(e,t.meta.submission.voidedValue))}function rs(e,t,n){if(t.meta.submission?.voidedValue)return void rc(e,t.meta.submission.voidedValue);let i=iN(t,null);t.meta.initialValue?.omrsObject&&(i.uuid=t.meta.initialValue.omrsObject.uuid),t.questions.forEach(e=>{let t=n.find(t=>t.id===e.id)??e;if(ru(t))ra(i.groupMembers,t);else if("obsGroup"===t.type){let e=[];rs(e,t,n),rc(i.groupMembers,e)}else to(t)&&(rc(i.groupMembers,t.meta.submission.newValue),rc(i.groupMembers,t.meta.submission.voidedValue))}),(i.groupMembers?.length||i.voided)&&rc(e,i)}function ra(e,t){let n=t.meta.initialValue?.omrsObject;n&&rc(e,(Array.isArray(n)?n:[n]).map(e=>iP(e)))}function rl(e){return e.filter(e=>"testOrder"===e.type&&to(e)).flatMap(e=>ru(e)?[e.meta.submission.newValue?void 0:e.meta.submission.voidedValue]:[e.meta.submission.newValue,e.meta.submission.voidedValue]).filter(e=>e)}function rc(e,t){t&&(Array.isArray(t)?e.push(...t):e.push(t))}function ru(e){return!!(e.isHidden||e.isParentHidden)}function rd(e){let{questionOptions:{isTransient:t},type:n}=e;return!t&&!!["obs","obsGroup"].includes(n)&&!e.meta.groupId&&(!!(ru(e)&&e.meta.initialValue?.omrsObject)||!ru(e)&&("obsGroup"===n||to(e)))}function rh(e){if("toggle"==e.questionOptions.rendering&&"boolean"!=typeof e.questionOptions.defaultValue)return e.questionOptions.defaultValue==l.t$;let t=iq.validate(e,e.questionOptions.defaultValue);return t.length?(console.error(`Default value validation errors for field "${e.id}" with value "${e.questionOptions.defaultValue}":`,t),null):e.questionOptions.defaultValue}async function rp(e,t,n,i){let r=1,{formFieldAdapters:o}=i,s=t.obs.filter(t=>t.concept.uuid===e.questionOptions.concept&&t.uuid!=e.meta.initialValue?.omrsObject?.uuid&&!iD.includes(t.uuid)),a=t.orders.filter(t=>(e.questionOptions.answers?.map(e=>e.concept)||[]).includes(t.concept?.uuid)&&!iG.includes(t.uuid));if("testOrder"===e.type)return Promise.all(a.filter(e=>!e.voided).map(async t=>{let s=iL(e,t,r++);return n[s.id]=await o[e.type].getInitialValue(s,{orders:[t]},i),s}));let l=t.diagnoses.filter(t=>!t.voided&&!iX.includes(t?.diagnosis?.coded.uuid)&&t.formFieldPath.startsWith(`rfe-forms-${e.id}_`));return"diagnosis"===e.type?Promise.all(l.map(async t=>{let r=parseInt(t.formFieldPath.split("_")[1]),s=iL(e,t,r);return n[s.id]=await o[e.type].getInitialValue(s,{diagnoses:[t]},i),iX.includes(t.diagnosis.coded.uuid)||iX.push(t.diagnosis.coded.uuid),s})):Promise.all(s.map(async t=>{let s=iL(e,t,r++);return await Promise.all(s.questions.map(async r=>{n[r.id]=await o[e.type].getInitialValue(r,{obs:[t]},i)})),iD.push(t.uuid),[s,...s.questions]})).then(e=>e.flat())}function rf(e){return e.filter(e=>"diagnosis"===e.type&&to(e)).map(e=>ru(e)?e.meta.submission.newValue?void 0:e.meta.submission.voidedValue:e.meta.submission.newValue||e.meta.submission.voidedValue).filter(e=>e)}function rg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class rm{getDomainObject(){return this.domainObjectValue}async loadDependencies(e,t,n){return Promise.resolve({})}constructor(e){rg(this,"formJson",void 0),rg(this,"domainObjectValue",void 0),this.formJson=e}}var rv=n(45278),rb=n(18348),ry=n(92049),rw=n(53098),rx="[object String]";let r$=function(e){return"string"==typeof e||!(0,ry.A)(e)&&(0,rw.A)(e)&&(0,rb.A)(e)==rx};function r_(e){let[t,n]=(0,c.useState)(null),[i,r]=(0,c.useState)(!0),[o,s]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let t=new AbortController;return!e6(e.encounter)&&r$(e.encounter)?(0,a.openmrsFetch)(`${a.restBaseUrl}/encounter/${e.encounter}?v=${l.RZ}`,{signal:t.signal}).then(e=>{n(e.data),r(!1)}).catch(e=>{s(e)}):(e6(e.encounter)||n(e.encounter),r(!1)),()=>{t.abort()}},[e.encounter]),{encounter:t,error:o,isLoading:i}}var rS=n(66148),rM=n.n(rS);function rC(){let{data:e,error:t,isLoading:n}=rM()(`${a.restBaseUrl}/encounterrole?v=custom:(uuid,display,name)`,a.openmrsFetch),i=e?.data.results.find(e=>"Clinician"===e.name);return i?{encounterRole:i,error:t,isLoading:n}:{encounterRole:e?.data.results[0],error:t,isLoading:n}}var rE=n(73391),rk=n.n(rE);let rA=e=>{let t="custom:(uuid,display,program:(uuid,name,allWorkflows),dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,state:(uuid,name,retired,concept:(uuid),programWorkflow:(uuid)))",n=`${a.restBaseUrl}/programenrollment?patient=${e}&v=${t}`,{data:i,error:r,isLoading:o}=rk()(e?n:null,a.openmrsFetch),s=i?.data?.results.length>0?i?.data.results.sort((e,t)=>t.dateEnrolled>e.dateEnrolled?1:-1):null;return{activePrograms:s?.filter(e=>!e.dateCompleted),error:r,isLoading:o}},rT=(e,t)=>{let{activePrograms:n,error:i,isLoading:r}=rA(t.meta?.programs?.hasProgramFields?e:null);return{patientPrograms:n,errorFetchingPatientPrograms:i,isLoadingPatientPrograms:r}};function rL(e){let[t,n]=(0,c.useState)(!0),{encounter:i,isLoading:r}=r_(e.formJson),{encounterRole:o,isLoading:s}=rC(),{isLoadingPatientPrograms:a,patientPrograms:l}=rT(e.patient?.id,e.formJson);return(0,c.useEffect)(()=>{n(a||r||s)},[a,r,s]),{data:{encounter:i,patientPrograms:l,encounterRole:o},isLoading:t,error:null,updateContext:(t,{setDomainObjectValue:n,setCustomDependencies:r})=>{e.processor.domainObjectValue=i,n(i),r(e=>({...e,patientPrograms:l,defaultEncounterRole:o}))}}}let rO={checkbox:[],toggle:!1,text:""},rR=["encounterProvider","encounterDatetime","encounterLocation","patientIdentifier","encounterRole","programState","personAttribute"];class rD extends rm{prepareFormSchema(e){let t=new Set;function n(e,i,r,o){e.id&&t.add(e.id),e.inlineRendering=e.inlineRendering??i.inlineRendering??r.inlineRendering??o.inlineRendering,e.readonly=e.readonly??i.readonly??r.readonly??o.readonly,e.questionOptions?.rendering!="fixed-value"||e.meta.fixedValue||(e.meta.fixedValue=e.value,delete e.value),(e.questionOptions?.rendering=="group"||"obsGroup"===e.type)&&e.questions?.forEach(t=>(t.readonly=t.readonly??e.readonly,n(t,i,r,o)))}return e.pages.forEach(t=>{t.sections.forEach(i=>{i.questions.forEach(r=>{n(r,i,t,e)})})}),rj(e,t),e}async processSubmission(e,t){let{encounterRole:n,encounterProvider:i,encounterDate:r,encounterLocation:o}=ri(e),s=(e,t,n)=>(0,a.translateFrom)(rv.L,e,t,n),l=i9(e.formFields,o),c=i5(e,r,n,i,o);try{await Promise.all(i8(e.patient,l)),l?.length&&(0,a.showSnackbar)({title:s("patientIdentifiersSaved","Patient identifier(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,ne.j)(t);return Promise.reject({title:s("errorSavingPatientIdentifiers","Error saving patient identifiers"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let t=i6(e.formFields);await Promise.all(i7(e.patient,t)),t?.length&&(0,a.showSnackbar)({title:s("personAttributesSaved","Person attribute(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,ne.j)(t);return Promise.reject({title:s("errorSavingPersonAttributes","Error saving person attributes"),description:e.join(", "),kind:"error",critical:!0})}try{let t=re(e.formFields,e.patient,e.customDependencies.patientPrograms),n=await await rt(t);n?.length&&(0,a.showSnackbar)({title:s("patientProgramsSaved","Patient program(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){let e=(0,ne.j)(t);return Promise.reject({title:s("errorSavingPatientPrograms","Error saving patient program(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}try{let{data:n}=await (0,tM.saveEncounter)(t,c,c.uuid),i=n.orders.map(e=>e.orderNumber),r=n.diagnoses.map(e=>e.display);i.length&&(0,a.showSnackbar)({title:s("ordersSaved","Order(s) saved successfully"),subtitle:i.join(", "),kind:"success",isLowContrast:!0}),r.length&&(0,a.showSnackbar)({title:s("diagnosisSaved","Diagnosis(es) saved successfully"),subtitle:r.join(", "),kind:"success",isLowContrast:!0});try{let i=await rn(e.formFields,n,t);i?.length&&(0,a.showSnackbar)({title:s("attachmentsSaved","Attachment(s) saved successfully"),kind:"success",isLowContrast:!0})}catch(t){console.error("Error saving attachments",t);let e=(0,ne.j)(t);return Promise.reject({title:s("errorSavingAttachments","Error saving attachment(s)"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}return n}catch(t){console.error("Error saving encounter",t);let e=(0,ne.j)(t);return Promise.reject({title:s("errorSavingEncounter","Error saving encounter"),subtitle:e.join(", "),kind:"error",isLowContrast:!1})}}getCustomHooks(){return{useCustomHooks:rL}}async getInitialValues(e){let{domainObjectValue:t,formFields:n,formFieldAdapters:i}=e,r={},o=[];if(t){await Promise.all(n.map(async n=>{let s=i[n.type];if(n.meta.initialValue?.omrsObject&&!e6(n.meta.initialValue.refinedValue)){r[n.id]=n.meta.initialValue.refinedValue;return}if(s){tn(n,"repeating")&&!n.meta?.repeat?.isClone&&o.push(n);let i=null;try{i=await s.getInitialValue(n,t,e),n.meta.initialValue.refinedValue=i}catch(e){console.error(e)}if("obsGroup"===n.type)return;if(e6(i)?e6(n.questionOptions.defaultValue)?r[n.id]=rO[n.questionOptions.rendering]??"":r[n.id]=rh(n):r[n.id]=i,n.questionOptions.calculate?.calculateExpression)try{await rI(n,r,e)}catch(e){console.error(e)}}else console.warn(`No adapter found for field type ${n.type}`)}));let s=await Promise.all(o.flatMap(n=>rp(n,t,r,e))).then(e=>e.flat());n.push(...s)}else{let t=n.filter(e=>"group"!==e.questionOptions.rendering&&"obsGroup"!==e.type),o=[];await Promise.all(t.map(async t=>{let n=i[t.type];if(r[t.id]=rO[t.questionOptions.rendering]??null,e6(r[t.id])&&rR.includes(t.type))try{r[t.id]=await n.getInitialValue(t,null,e)}catch(e){console.error(e)}t.questionOptions.defaultValue&&(r[t.id]=rh(t)),t.questionOptions.calculate?.calculateExpression&&o.push(t)})),await Promise.all(o.map(async t=>{try{await rI(t,r,e)}catch(e){console.error(e)}}))}return r}async loadDependencies(e,t,{setPreviousDomainObjectValue:n}){let{patient:i,formJson:r}=e;return n(await (0,tM.getPreviousEncounter)(i?.id,r.encounterType)),e}async getHistoricalValue(e,t){let{formFields:n,sessionMode:i,patient:r,methods:{getValues:o},formFieldAdapters:s,previousDomainObjectValue:a,visit:l}=t,c={value:e,type:"field"},u=s[e.type];if(e.historicalExpression){let t=await tG(e.historicalExpression,c,n,o(),{mode:i,patient:r,previousEncounter:a,visit:l});return t?t5(e,t):null}return a&&e.questionOptions.enablePreviousValue?await u.getPreviousValue(e,a,t):null}}async function rI(e,t,n){let{formFields:i,sessionMode:r,patient:o,visit:s}=n,a=e.questionOptions.calculate.calculateExpression,l={value:e,type:"field"},c={mode:r,patient:o,visit:s},u=await tG(a,l,i,t,c);e6(u)||(t[e.id]=u)}function rj(e,t){let n=/(['"])([a-zA-Z_][a-zA-Z0-9_]*)\1/g;function i(e,i){for(let r of e.matchAll(n)){let e=r[2];t.has(e)&&console.error(`The calculateExpression for the field '${i}' incorrectly quotes the field ID '${e}' as a string. Field IDs must be referenced as variables without quotes to access their values. Remove the quotes: use ${e} instead of '${e}'.`)}}function r(e){e.questionOptions?.calculate?.calculateExpression&&i(e.questionOptions.calculate.calculateExpression,e.id),e.questions&&e.questions.forEach(r)}e.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(r)})})}var rN=n(77541);function rP(e){let{formFields:t,formFieldValidators:n,patient:i,sessionMode:r,addInvalidField:o,updateFormField:s,methods:{getValues:a,trigger:l}}=e,c=a();return 0===t.filter(e=>!e.isHidden&&!e.isParentHidden&&!e.isDisabled&&!e.meta.submission?.unspecified).flatMap(e=>e.validators?.flatMap(a=>{let l=n[a.type];if(l){let n=l.validate(e,c[e.id],{formFields:t,values:c,expressionContext:{patient:i,mode:r},...a}).filter(e=>"error"===e.resultType);return n.length&&(e.meta.submission={...e.meta.submission,errors:n},s(e),o(e)),n}})).filter(e=>!!e).length}async function rF(e,t,n,i,r){return Promise.all(e.map(async({postAction:e,config:o,actionId:s,enabled:l})=>{try{let r=[];if(t)if(t.forEach(e=>{e?.data&&r.push(e.data),e?.uuid&&r.push(e)}),r.length)(!l||(0,rN.g)(l,r))&&await e.applyAction({patient:n,sessionMode:i,encounters:r},o);else throw Error("No encounter data to process post submission action");else throw Error("No handlers available to process post submission action")}catch(t){let e=(0,ne.j)(t);(0,a.showSnackbar)({title:String(r("errorDescriptionTitle",s?s.replace(/([a-z])([A-Z])/g,"$1 $2"):"Post Submission Error")),subtitle:String(r("errorDescription","{{errors}}",{errors:e.join(", ")})),kind:"error",isLowContrast:!1})}}))}function rU({patientUuid:e,formUuid:t,setIsSubmitting:n,setIsValidating:i}){let{t:r}=(0,e0.useTranslation)();(0,c.useEffect)(()=>{let o=o=>{let{formUuid:s,patientUuid:a,action:l}=o.detail;if(!l||!s||!a)return void(0,ne.N)(Error("The form action event is missing required details (formUuid, patientUuid, or action)."),r("formActionFailed","Form action failed"));if(s===t&&a===e)switch(l){case"onSubmit":n(!0);break;case"validateForm":i(!0);break;default:(0,ne.N)(Error(`Unsupported form action: "${l}"`),r("formActionFailed","Form action failed"))}};return window.addEventListener("ampath-form-action",o),()=>{window.removeEventListener("ampath-form-action",o)}},[n,i,t,e])}function rV(e){let[t,n]=(0,c.useState)([]);return(0,c.useEffect)(()=>{let t=[];e?.length&&e.map(e=>{let n="string"==typeof e?e:e.actionId;oG(n)?.then(i=>t.push({postAction:i,config:e.config,actionId:n,enabled:e.enabled}))}),n(t)},[e]),t}let rz=(0,c.createContext)(void 0),rH=({patient:e,patientUUID:t,sessionMode:n,sessionDate:i,formJson:r,workspaceLayout:o,location:s,provider:l,visit:d,isFormExpanded:h=!0,children:p,isLoadingDependencies:f=!1,formSubmissionProps:g,hideFormCollapseToggle:m,handleConfirmQuestionDeletion:v,setIsFormDirty:b})=>{let{t:y}=(0,e0.useTranslation)(),w=(0,c.useRef)(void 0),x=(0,c.useRef)({}),$=(0,a.useLayoutType)(),{isSubmitting:_,setIsSubmitting:S,onSubmit:M,onError:C,handleClose:E}=g,[k,A]=(0,c.useState)(!1),T=rV(r.postSubmissionActions),L=new AbortController,O=(0,c.useCallback)((e,t,n)=>{t?x.current[e]=n:w.current=n},[]),R=(0,c.useRef)({EncounterFormProcessor:rD}),D=(0,c.useCallback)(()=>{let e=[w.current,...Object.values(x.current)],t=e.every(e=>rP(e));return{forms:e,isValid:t}},[]);return rU({patientUuid:t,formUuid:r?.uuid,setIsSubmitting:S,setIsValidating:A}),(0,c.useEffect)(()=>{k&&(f||D(),A(!1))},[k,D,f]),(0,c.useEffect)(()=>{if(_){if(f)return void S(!1);let{forms:t,isValid:i}=D();i?Promise.all(t.map(e=>e.processor.processSubmission(e,L))).then(async t=>{g.setIsSubmitting(!1),"edit"===n?(0,a.showSnackbar)({title:y("updatedRecord","Record updated"),subtitle:y("updatedRecordDescription","The patient encounter was updated"),kind:"success",isLowContrast:!0}):(0,a.showSnackbar)({title:y("submittedForm","Form submitted"),subtitle:y("submittedFormDescription","Form submitted successfully"),kind:"success",isLowContrast:!0}),T&&await rF(T,t,e,n,y),m(),M?M(t):E()}).catch(e=>{S(!1),e instanceof Error?(0,a.showSnackbar)({title:y("errorProcessingFormSubmission","Error processing form submission"),kind:"error",subtitle:e.message,isLowContrast:!1}):(0,a.showSnackbar)(e)}):S(!1)}return()=>{L.abort()}},[_,D,f]),u().createElement(rz.Provider,{value:{patient:e,sessionMode:n,sessionDate:i,formJson:r,formProcessors:R.current,layoutType:$,workspaceLayout:o,visit:d,location:s,provider:l,isFormExpanded:h,registerForm:O,handleConfirmQuestionDeletion:v,setIsFormDirty:b}},R.current&&p)},rW=()=>{let e=(0,c.useContext)(rz);if(!e)throw Error("useFormFactoryContext must be used within a FormFactoryProvider");return e},rB={actionButtons:"-esm-form-builder__repeat-controls__actionButtons___LgvQb"},rq=function({question:e,rows:t,handleDelete:n,handleAdd:i,questionIndex:r}){let{t:o}=(0,e0.useTranslation)();return u().createElement("div",{className:rB.actionButtons},r>0&&u().createElement(g.Button,{className:rB.button,kind:"danger",onClick:n},u().createElement("span",null,o("remove","Remove"))),r===t.length-1&&u().createElement(g.Button,{className:rB.button,iconDescription:o("add","Add"),kind:"primary",disabled:iR(e.questionOptions.repeatOptions?.limit,t.length),onClick:i},u().createElement("span",null,e.questionOptions.repeatOptions?.addText||o("add","Add"))))},rG="-esm-form-builder__repeat__nodeContainer___APyxV",rK="-esm-form-builder__repeat__divider___h9XcK",rY={obsGroup:"group",testOrder:"select",diagnosis:"ui-select-extended"};function rQ(e){return e.questions?.length?e.questions?.some(e=>!e.isHidden):!e.isHidden}function rZ(e){return{...e,questionOptions:{...e.questionOptions,rendering:rY[e.type]||null}}}let rJ=({field:e})=>{let[t,n]=(0,c.useState)([]),i=nl(),{handleConfirmQuestionDeletion:r}=rW(),{patient:o,sessionMode:s,formFieldAdapters:l,formFields:d,methods:{getValues:h,setValue:p,unregister:f},addFormField:g,removeFormField:m,deletedFields:v,setDeletedFields:b,visit:y}=i;(0,c.useEffect)(()=>{n(d.filter(t=>t.questionOptions.concept===e.questionOptions.concept&&t.id.startsWith(e.id)&&!t.meta?.repeat?.wasDeleted))},[d,e]);let w=(0,c.useCallback)(r=>{let a=[];function c(e){e.hide?.hideWhenExpression&&(e.isHidden=tq(e.hide.hideWhenExpression,{value:e,type:"field"},[...d,...a],h(),{mode:s,patient:o,visit:y})),e.questionOptions.calculate?.calculateExpression&&tG(e.questionOptions.calculate?.calculateExpression,{value:e,type:"field"},[...d,...a],h(),{mode:s,patient:o,visit:y}).then(t=>{e6(t)||(p(e.id,t),l[e.type]?.transformFieldValue(e,t,i))})}let u=iL(e,null,r);a.push(u),"obsGroup"===u.type&&u.questions?.forEach(e=>{a.push(e)}),a.forEach(e=>{c(e),g(e)}),n([...t,u])},[d,e,t,i]),x=e=>{e.meta.initialValue?.omrsObject?(l[e.type]?.transformFieldValue(e,null,i),e.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},"obsGroup"===e.type&&e.questions.forEach(t=>{t.meta.repeat={...e.meta.repeat||{},wasDeleted:!0},l[t.type]?.transformFieldValue(t,null,i)})):(ti(e),f(e.id),e.questions?.forEach(e=>f(e.id))),n(t.filter(t=>t.id!==e.id)),b([...v,e]),m(e.id)},$=e=>{if(r&&"function"==typeof r){let t=r(e);t&&"function"==typeof t.then&&"function"==typeof t.catch?t.then(()=>x(e)).catch(()=>(0,a.createErrorHandler)()):"boolean"==typeof t?t&&x(e):x(e)}else x(e)},_=(0,c.useMemo)(()=>t.map((n,i)=>{let r=u().createElement(nS,{fieldId:n.id,valueAdapter:l[n.type],repeatOptions:{targetRendering:rZ(n).questionOptions.rendering}});return u().createElement("div",{key:n.id+"_wrapper"},0!==i&&u().createElement("div",null,u().createElement("hr",{className:rK})),u().createElement("div",{className:rG},r),!ts(s)&&u().createElement(rq,{question:n,rows:t,questionIndex:i,handleDelete:()=>{$(n)},handleAdd:()=>{w(t.reduce((t,n)=>{let i=Number(n.id.slice(e.id.length+1));return Number.isFinite(i)?Math.max(t,i):t},0)+1)}}))}),[t]);return!e.isHidden&&_&&rQ(e)?u().createElement(u().Fragment,null,u().createElement("div",null,_)):null};var rX=n(92137);let r0={label:"-esm-form-builder__file__label___ltBsg",thumbnailGrid:"-esm-form-builder__file__thumbnailGrid___rstZS",thumbnailContainer:"-esm-form-builder__file__thumbnailContainer___Z0tS3"},r1="-esm-form-builder__file-thumbnail__thumbnail___WlgwA",r2="-esm-form-builder__file-thumbnail__imageThumbnail___gZWBB",r4="-esm-form-builder__file-thumbnail__pdfThumbnail___49Zd9",r3="-esm-form-builder__file-thumbnail__removeButton___y2WED",r5="-esm-form-builder__file-thumbnail__closeIcon___2MzVN";var r9=n(59184),r8=n(63654);function r6({bytesContentFamily:e,removeFileCb:t,...n}){let i=(0,c.useMemo)(()=>{switch(e){case"image":return r7;case"pdf":return oe;default:return ot}},[]);return u().createElement("div",{className:r1},u().createElement(i,n),u().createElement(g.Button,{kind:"ghost",className:r3,onClick:t},u().createElement(r9.bm,{size:16,className:r5})))}function r7(e){return u().createElement("img",{className:r2,src:e.src,alt:e.title})}function oe(e){return u().createElement("div",{className:r4,role:"button",tabIndex:0},u().createElement(r8.aD,{size:24}))}function ot(e){return u().createElement("div",{className:r4,role:"button",tabIndex:0},u().createElement(r8.WZ,{size:24}))}let on=[{name:"drug",baseControlComponent:iS},{name:"problem",baseControlComponent:iS},{name:"encounter-provider",baseControlComponent:iS},{name:"encounter-location",baseControlComponent:iS},{name:"select-concept-answers",baseControlComponent:iS},{name:"encounter-role",baseControlComponent:iS}],oi=[{name:"text",component:id},{name:"textarea",component:ic},{name:"select",component:ia},{name:"checkbox",component:n7},{name:"radio",component:io},{name:"date",component:n1},{name:"datetime",component:n1},{name:"number",component:it},{name:"content-switcher",component:nK},{name:"toggle",component:ip},{name:"workspace-launcher",component:iA},{name:"group",component:nA},{name:"repeating",component:rJ},{name:"markdown",component:n8},{name:"fixed-value",component:n2},{name:"ui-select-extended",component:iS},{name:"file",component:({field:e,value:t,setFieldValue:n})=>{let{t:i}=(0,e0.useTranslation)(),{sessionMode:r}=nl(),o="tablet"===(0,a.useLayoutType)(),s=(0,c.useCallback)(()=>{let i=(0,a.showModal)("capture-photo-modal",{saveFile:e=>(e.capturedFromWebcam&&!e.fileName.includes(".")&&(e.fileName=`${e.fileName}.png`),n([...t||[],e]),i(),Promise.resolve()),closeModal:()=>{i()},allowedExtensions:e.questionOptions.allowedFileTypes,multipleFiles:e.questionOptions.allowMultiple,collectDescription:!0})},[t,e]),l=(0,c.useCallback)(e=>{let i=[...t],r=i[e];r.uuid?i[e]={...r,voided:!0}:i.splice(e,1),n(i)},[t]);return ts(r)&&!t?u().createElement(nN,{label:i(e.label),value:null,conceptName:e.meta.concept?.display,isInline:!1}):u().createElement("div",null,u().createElement("div",{className:h()(r0.label,"cds--label")},u().createElement(nG,{field:e})),!ts(r)&&u().createElement("div",null,u().createElement(g.Button,{className:r0.uploadButton,kind:o?"ghost":"tertiary",onClick:s,renderIcon:e=>u().createElement(rX.OM,{size:16,...e})},e.questionOptions.buttonLabel?i(e.questionOptions.buttonLabel):i("addFile","Add file"))),u().createElement("div",{className:r0.thumbnailGrid},t&&t.filter(e=>!e.voided).map((e,t)=>u().createElement("div",{className:r0.thumbnailContainer},u().createElement(r6,{title:e.fileName,src:e.base64Content,bytesContentFamily:e.fileType,removeFileCb:()=>l(t)})))))}},...im.map(e=>({name:e.name,component:on.find(t=>t.name===e.name).baseControlComponent}))],or={validate:(e,t,n)=>{let i=new Date,r=t?[]:e9.validate(e,t);return r.length?r:t&&!(0,no.H)(n?.allowFutureDates)&&t.getTime&&t.getTime()>i.getTime()?[{resultType:"error",errCode:"value.invalid",message:"Future dates not allowed"}]:[]}},oo=[{name:"default_value",component:iq},{name:"form_field",component:e9},{name:"date",component:or},{name:"js_expression",component:{validate:function(e,t,n){let i="value.invalid",r="Invalid value",o="Field has warnings";return n.expressionContext.myValue=t,Object.keys(n).filter(e=>"failsWhenExpression"===e||"warnsWhenExpression"===e).flatMap(s=>{let a="failsWhenExpression"===s;return tq(n[s],{value:e,type:"field"},n.formFields,{...n.values,[e.id]:t},n.expressionContext)?[{resultType:a?"error":"warning",errCode:a?i:null,message:n.message?n.message:a?r:o}]:[]})}}},{name:"conditionalAnswered",component:{validate:function(e,t,n){let{referenceQuestionId:i,referenceQuestionAnswers:r,values:o,formFields:s,message:a}=n,l=o[s.find(e=>e.id===i).id];return e6(t)||r.includes(l)?[]:[{resultType:"error",errCode:"invalid.valueSelected",message:a}]}}}];function os(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class oa{fetchData(e){return(0,a.openmrsFetch)(e?`${this.url}&q=${e}`:this.url).then(({data:e})=>e.results)}fetchSingleItem(e){let t=this.url;if(t.includes("?")){let n=t.split("?");t=`${n[0]}/${e}?${n[1]}`}else t=`${t}/${e}`;return(0,a.openmrsFetch)(t).then(({data:e})=>e)}toUuidAndDisplay(e){if(void 0===e.uuid||void 0===e.display)throw Error("'uuid' or 'display' not found in the OpenMRS object.");return e}constructor(e){os(this,"url",void 0),this.url=e}}let ol="custom:(uuid,display,conceptClass:(uuid,display))",oc="custom:(uuid,display,conceptClass:(uuid,display),mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid))))",ou="35543629-7d8c-11e1-909d-c80aa9edcf4e";class od extends oa{fetchData(e,t){if(e6(t?.class)&&e6(t?.concept)&&!t?.useSetMembersByConcept&&e6(e))return Promise.resolve([]);let n=t?.conceptSourceUuid?oc:ol,i=`${a.restBaseUrl}/concept?name=&searchType=fuzzy&v=${n}`;if(t?.class)if("string"!=typeof t.class)return(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results.filter(e=>e.conceptClass&&t.class.includes(e.conceptClass.uuid)));else{let e=i.split("searchType=fuzzy");i=`${e[0]}searchType=fuzzy&class=${t.class}&${e[1]}`}if(t?.concept&&t?.useSetMembersByConcept){let n=i.split("?name=&searchType=fuzzy&v="),r=t?.conceptSourceUuid?"custom:(uuid,setMembers:(uuid,display,mappings:(conceptMapType:(uuid,display),conceptReferenceTerm:(code,conceptSource:(uuid)))))":"custom:(uuid,setMembers:(uuid,display))";return i=`${n[0]}/${t.concept}?v=${r}`,(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.setMembers)}return(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results)}fetchSingleItem(e,t){let n=t?.conceptSourceUuid?oc:ol;return(0,a.openmrsFetch)(`${a.restBaseUrl}/concept/${e}?v=${n}`).then(({data:e})=>e)}toUuidAndDisplay(e,t){let n=super.toUuidAndDisplay(e),i=this.getConceptSourceMapping(e,t?.conceptSourceUuid)?.conceptReferenceTerm?.code;return i?{...n,code:i}:n}getConceptSourceMapping(e,t){if(!t)return;let n=e.mappings?.filter(e=>e.conceptReferenceTerm?.conceptSource?.uuid===t)??[];return n.find(e=>e.conceptMapType?.uuid===ou||e.conceptMapType?.display?.toUpperCase()==="SAME-AS")??n[0]}constructor(){super(`${a.restBaseUrl}/concept?v=${ol}`)}}class oh extends oa{fetchData(e,t,n){let i=this.url,r=i.split("?");return t?.tag&&(i=`${r[0]}?tag=${t.tag}&${r[1]}`),n&&(i=`${r[0]}/${n}?${r[1]}`),(0,a.openmrsFetch)(e?`${i}&q=${e}`:i).then(({data:e})=>e.results?e.results:e)}constructor(){super(`${a.restBaseUrl}/location?v=custom:(uuid,display)`)}}class op extends oa{async fetchData(e,t){let n="v=custom:(uuid,display)",i=`${a.restBaseUrl}/provider?${n}`,{data:r}=await (0,a.openmrsFetch)(e?`${i}&q=${e}`:i);return r?.results}async fetchSingleItem(e){let{data:t}=await (0,a.openmrsFetch)(`${a.restBaseUrl}/provider/${e}?v=custom:(uuid,display)`);return t}constructor(){super(null)}}class of extends oa{fetchSingleItem(e){return(0,a.openmrsFetch)(this.buildUrl(e)).then(({data:e})=>e)}fetchData(e,t){let n=this.buildUrl(t.referencedValue||t.concept);return(0,a.openmrsFetch)(n).then(({data:e})=>e.setMembers.length?e.setMembers:e.answers)}buildUrl(e){return this.url.replace(":conceptUuid",e)}constructor(){super(`${a.restBaseUrl}/concept/:conceptUuid?v=custom:(uuid,display,setMembers:(uuid,display),answers:(uuid,display))`)}}class og extends oa{async fetchData(e,t){let n="v=custom:(uuid,display,name)",i=`${a.restBaseUrl}/encounterrole?${n}`,{data:r}=await (0,a.openmrsFetch)(e?`${i}&q=${e}`:i);return r?.results}constructor(){super(null)}}let om=[{name:"location_datasource",component:new oh},{name:"drug_datasource",component:new od},{name:"problem_datasource",component:new od},{name:"select_concept_answers_datasource",component:new of},{name:"provider_datasource",component:new op},{name:"encounter_role_datasource",component:new og}],ov=[{name:"ProgramEnrollmentSubmissionAction",load:()=>n.e("4831").then(n.bind(n,61042))},{name:"MarkPatientAsDeceasedAction",load:()=>n.e("7484").then(n.bind(n,26679))}];function ob(e,t,n){if("programState"===e.type){let e=n.meta??{};e.programs=e.programs?{...e.programs,hasProgramFields:!0}:{hasProgramFields:!0},n.meta=e}try{ow(e),o$(e),o_(e),oS(e),e.questions?.length&&("obsGroup"===e.type&&e.questions.length?e.questions.forEach(e=>ob(e,t,n)):e.questions.forEach(e=>ob(e,t,n))),e.meta.pageId=t.id}catch(e){console.error(e)}}function oy(e){let t=[];return e?.forEach(e=>{if(t.push(e),"inlineDate"!==e.type&&(0,no.H)(e.questionOptions?.showDate)){let n={id:`${e.id}_inline_date`,label:`Date for ${e.label}`,type:"inlineDate",questionOptions:{rendering:"date",isTransient:!0},validators:e.questionOptions.shownDateOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownDateOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.obsDatetime}}};t.push(n)}}),t}function ow(e){ox(e,"readonly"),ox(e,"required"),ox(e,"unspecified"),ox(e.questionOptions,"disallowDecimals"),ox(e.questionOptions,"isSearchable"),ox(e.questionOptions,"isTransient"),ox(e.questionOptions,"enablePreviousValue"),ox(e.questionOptions,"allowMultiple"),e.meta||(e.meta={submission:null,initialValue:{omrsObject:null,refinedValue:null}})}function ox(e,t){if(e&&"string"==typeof e[t]){let n=e[t].trim().toLowerCase();("true"===n||"false"===n)&&(e[t]="true"===n)}return e}function o$(e){!tn(e,"group")&&(e.validators=e.validators||[],0>e.validators.findIndex(e=>"form_field"===e.type)&&e.validators.push({type:"form_field"}),0>e.validators.findIndex(e=>"default_value"===e.type)&&e.validators.push({type:"default_value"}))}function o_(e){switch(e.type){case"encounterProvider":e.questionOptions.rendering="encounter-provider";break;case"encounterLocation":e.questionOptions.rendering="encounter-location";break;case"encounterRole":e.questionOptions.rendering="encounter-role";break;case"encounterDatetime":e.questionOptions.rendering=tn(e,"ui-select-extended")?"date":e.questionOptions.rendering;break;case"diagnosis":oT(e)}}function oS(e){switch(e.questionOptions.rendering){case"checkbox-searchable":case"multiCheckbox":oM(e);break;case"numeric":e.questionOptions.rendering="number";break;case"select-concept-answers":oE(e);break;case"repeating":case"group":oC(e);break;case"date":e.datePickerFormat=e.datePickerFormat??"calendar";break;case"datetime":e.datePickerFormat=e.datePickerFormat??"both";break;case"workspace-launcher":case"markdown":e.type="control";break;case"drug":case"problem":e.questionOptions.isSearchable=!0}return e}function oM(e){"multiCheckbox"===e.questionOptions.rendering&&(e.questionOptions.rendering="checkbox-searchable",(0,no.H)(e.inlineMultiCheckbox)&&(e.questionOptions.rendering="checkbox")),tn(e,"checkbox-searchable")&&(e.questionOptions.rendering="checkbox",e.questionOptions.isCheckboxSearchable=!0)}function oC(e){tn(e,"group")&&e.questions?.length&&e.questions.forEach(oC),"testOrder"===e.type&&e.questionOptions.selectableOrders?.length&&(e.questionOptions.answers=e.questionOptions.selectableOrders||[],delete e.questionOptions.selectableOrders)}function oE(e){e.questionOptions.isSearchable=!0,e.questionOptions.datasource?.config||(e.questionOptions.datasource={name:"select_concept_answers_datasource",config:{concept:e.questionOptions.concept}})}function ok(e){if(e.meta.programs.isEnrollment||e.meta.programs.discontinuationDateQuestionId){let t={programUuid:e.meta.programs.uuid};e.meta.programs.isEnrollment?t.enrollmentDate="":t.completionDate=e.meta.programs.discontinuationDateQuestionId,e.postSubmissionActions=[{actionId:"ProgramEnrollmentSubmissionAction",enabled:"true",config:t}]}}function oA(e){let t=[];return e?.forEach(e=>{if(t.push(e),"obsComment"!==e.type&&(0,no.H)(e.questionOptions?.showComment)){let n={id:`${e.id}_obs_comment`,label:`Comment for ${e.label}`,type:"obsComment",questionOptions:{rendering:"text",isTransient:!0},validators:e.questionOptions.shownCommentOptions?.validators,disabled:{disableWhenExpression:`isEmpty(${e.id})`},hide:e.questionOptions.shownCommentOptions?.hide||e.hide,meta:{targetField:e.id,initialValue:{omrsObject:e.meta?.initialValue?.omrsObject?.comment}}};t.push(n)}}),t}function oT(e){if("dataSource"in e.questionOptions&&"diagnoses"===e.questionOptions.dataSource||"diagnosis"===e.type){let t=e.questionOptions.datasource?.config;e.questionOptions.datasource={name:"problem_datasource",config:{...t,class:e.questionOptions.diagnosis?.conceptClasses??t?.class}},e.questionOptions.diagnosis?.conceptSet&&(e.questionOptions={...e.questionOptions,concept:e.questionOptions.diagnosis?.conceptSet,datasource:{name:"problem_datasource",config:{...t,concept:e.questionOptions.diagnosis.conceptSet,useSetMembersByConcept:!0}}}),e.questionOptions.isSearchable=!0,delete e.questionOptions.dataSource}}function oL(e,t){Object.entries(t).forEach(([t,n])=>{e?.pages.forEach(e=>{e.sections.forEach(e=>{e.questions.forEach(e=>{e.id===t?e.questionOptions.defaultValue=n:Array.isArray(e?.questions)&&e.questions.length>0&&e.questions.forEach(e=>{e.id===t&&(e.questionOptions.defaultValue=n)})})})})})}let oO=[{name:"DefaultFormSchemaTransformer",component:{transform:(e,t)=>(ox(e,"readonly"),e.pages.forEach((t,n)=>{let i=t.label??"";t.id=`page-${i.replace(/\s/g,"")}-${n}`,ox(t,"readonly"),t.sections&&t.sections.forEach(n=>{n.questions=oy(n.questions),n.questions=oA(n.questions),ox(n,"readonly"),ox(n,"isExpanded"),n?.questions?.forEach((n,i)=>ob(n,t,e))})}),t&&"object"==typeof t&&oL(e,t),e.meta?.programs&&ok(e),e)}}];function oR(e){if(e&&e.encounterProviders?.length){let t=e.encounterProviders.length-1;return e.encounterProviders[t].provider}return null}function oD(e){if(e&&e.encounterProviders?.length){let t=e.encounterProviders.length-1;return e.encounterProviders[t].encounterRole}return null}function oI(e,t){return iV(e,t)||!e6(e.meta.submission.newValue.obsDatetime)}let oj=[{type:"obs",component:iI},{type:"control",component:{getDisplayValue:(e,t)=>t,transformFieldValue:function(e,t,n){return null},getInitialValue:function(e,t,n){return null},getPreviousValue:function(e,t,n){return null},tearDown:function(){}}},{type:"obsGroup",component:iI},{type:"testOrder",component:iQ},{type:"programState",component:{transformFieldValue:function(e,t,n){if(ti(e),e.meta?.initialValue?.omrsObject?.uuid===t||e6(t))return null;e.meta.submission.newValue={state:t,startDate:e4()().format()}},getInitialValue:function(e,t,n){let i=n.customDependencies.patientPrograms?.find(t=>t.program.uuid===e.questionOptions.programUuid);if(i?.states?.length>0){let t=i.states.filter(e=>!e.endDate).find(t=>t.state.programWorkflow?.uuid===e.questionOptions.workflowUuid)?.state;return e.meta={...e.meta||{},initialValue:{omrsObject:t}},t?.uuid}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"encounterLocation",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){return t&&t.location?.uuid?t.location.uuid:n.location.uuid},getPreviousValue:function(e,t,n){let i=t??n.previousDomainObjectValue;return{value:i?.location?.uuid,display:i?.location?.name}},getDisplayValue:function(e,t){return t},tearDown:function(){}}},{type:"encounterProvider",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){let i=oR(t);return i?.uuid?i.uuid:n.currentProvider?.uuid},getPreviousValue:function(e,t,n){let i=oR(t??n.previousDomainObjectValue);return{value:i?.uuid,display:i?.name}},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"encounterRole",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){let i=t??n.domainObjectValue;return i?oD(i)?.uuid:n.customDependencies.defaultEncounterRole.uuid},getPreviousValue:function(e,t,n){let i=t??n.previousDomainObjectValue;if(i){let e=oD(i);return{value:e?.uuid,display:e?.name}}return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"obsComment",component:{transformFieldValue:function(e,t,n){let i=n.getFormField(e.meta.targetField),r=n.methods.getValues(i.id),o=i.meta.initialValue?.omrsObject;if(i.meta.submission?.newValue)e6(t)&&!oI(i,r)?i.meta.submission.newValue=null:i.meta.submission.newValue.comment=t;else if(!to(i)&&o){if(e6(t)&&e6(o.comment))return null;let e=iF(i,r);i.meta.submission={newValue:{...e,comment:t}}}return null},getInitialValue:function(e,t,n){if(t??n.domainObjectValue){let t=e.id.split("_obs_comment")[0],i=n.formFields.find(e=>e.id===t);return i?.meta.initialValue.omrsObject?.comment}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t},tearDown:function(){}}},{type:"encounterDatetime",component:{transformFieldValue:function(e,t,n){tr(e,t,null)},getInitialValue:function(e,t,n){return t?.encounterDatetime?new Date(t.encounterDatetime):n.sessionDate},getPreviousValue:function(e,t,n){if(t?.encounterDatetime){let n=new Date(t.encounterDatetime);return{value:n,display:this.getDisplayValue(e,n)}}return null},getDisplayValue:function(e,t){return(0,a.formatDate)(t)},tearDown:function(){}}},{type:"inlineDate",component:{transformFieldValue:function(e,t,n){let i=n.getFormField(e.meta.targetField),r=n.methods.getValues(i.id),o=t instanceof Date?(0,a.toOmrsIsoString)(t):t;if(i.meta.submission?.newValue)e6(o)&&!oI(i,r)?i.meta.submission.newValue=null:i.meta.submission.newValue.obsDatetime=o;else if(!to(i)&&i.meta.initialValue?.omrsObject){if(e6(t)&&e6(i.meta.initialValue.omrsObject?.obsDatetime))return null;let e=iF(i,r);i.meta.submission={newValue:{...e,obsDatetime:o}}}},getInitialValue:function(e,t,n){if(t??n.domainObjectValue){let t=e.id.split("_inline_date")[0],i=n.formFields.find(e=>e.id===t),r=i?.meta.initialValue?.omrsObject;if(r?.obsDatetime)return(0,a.parseDate)(r.obsDatetime)}return null},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?(0,a.formatDate)(t):null},tearDown:function(){}}},{type:"patientIdentifier",component:{transformFieldValue:function(e,t,n){return(ti(e),e.meta.initialValue?.refinedValue===t||e6(t))?null:(e.meta.submission.newValue={identifier:t,identifierType:e.questionOptions.identifierType,uuid:e.meta.initialValue?.omrsObject?.id,location:n.location},e.meta.submission.newValue)},getInitialValue:function(e,t,n){let i=n.patient?.identifier?.find(t=>t.type?.coding[0]?.code===e.questionOptions.identifierType);return e.meta={...e.meta||{},initialValue:{omrsObject:i,refinedValue:i?.value}},i?.value},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"personAttribute",component:{transformFieldValue:function(e,t,n){return(ti(e),e.meta.initialValue?.refinedValue===t||e6(t))?null:(e.meta.submission.newValue={value:t,attributeType:e.questionOptions.attributeType,uuid:e.meta.initialValue?.omrsObject?.uuid},e.meta.submission.newValue)},getInitialValue:function(e,t,n){let i=n.patient?.extension?.find(t=>t.url===`http://fhir.openmrs.org/ext/person-attribute/${e.questionOptions.attributeType}`);return e.meta={...e.meta,initialValue:{omrsObject:i,refinedValue:i?.valueString||i?.valueReference?.reference}},e.meta.initialValue.refinedValue},getPreviousValue:function(e,t,n){return null},getDisplayValue:function(e,t){return t?.display?t.display:t},tearDown:function(){}}},{type:"diagnosis",component:i0}],oN={},oP={},oF={},oU={},oV={},oz={};async function oH(e){if(oP[e])return oP[e];let t=oi.find(t=>t.name===e||t?.alias===e)?.component;if(!t){let n=await oZ().controls.find(t=>t.name===e||t?.alias===e)?.load?.();t=n?.default}return oP[e]=t,t}function oW(e){return oJ(e)&&!tn(e,"file")?(e.disabled=!0,e.isDisabled=!0,oH("text")):oH(e.questionOptions.rendering)}async function oB(e){if(oF[e])return oF[e];let t=oj.find(t=>t.type===e)?.component;if(!t){let n=await oZ().fieldValueAdapters.find(t=>t.type===e)?.load?.();t=n?.default}return oF[e]=t,t}async function oq(){let e=[],t=oz;if(Object.keys(t).length)return Object.values(t);let n=oZ().formSchemaTransformers||[];return e.push(...(await Promise.all(n.map(async e=>{let t=await e.load?.();return t?.default}))).filter(e=>void 0!==e)),e.push(...oO.map(e=>e.component)),e.forEach(e=>{oz[oO.find(t=>t.component===e).name]=e}),e}async function oG(e){let t=oU[e];if(t)return t;let n=ov.find(t=>t.name===e);if(n){let t=n.load,i=await t();return oU[e]=i.default,i.default}let i=oZ().postSubmissionActions.find(t=>t.name===e);if(i){let t=i.load,n=await t();return oU[e]=n.default,n.default}return console.error(`No loader found for PostSubmissionAction registration of id: ${e}`),null}async function oK(e){if(oN[e])return oN[e];let t=oo.find(t=>t.name===e)?.component;if(!t){let n=await oZ().fieldValidators.find(t=>t.name===e)?.load?.();t=n?.default}return oN[e]=t,t}async function oY(e){if(oV[e])return oV[e];let t=om.find(t=>t.name===e)?.component;if(!t){let n=iv(e);if(n)t=om.find(e=>e.name===n.datasource.name)?.component;else{let n=await oZ().dataSources.find(t=>t.name===e)?.load?.();if(!n)throw Error("Datasource not found");t=n.default}}return oV[e]=t,t}function oQ(){return oZ().expressionHelpers}function oZ(){return(0,a.getGlobalStore)(l.RA,{controls:[],postSubmissionActions:[],expressionHelpers:{},fieldValidators:[],fieldValueAdapters:[],dataSources:[],formSchemaTransformers:[]}).getState()}function oJ(e){return"obs"==e.type&&!e.questionOptions.concept&&"fixed-value"!==e.questionOptions.rendering}function oX(e,t,n,i,r){let[o,s]=(0,c.useState)(null),[a,l]=(0,c.useState)(o3(e,t));return(0,c.useEffect)(()=>{let o=new AbortController,a=e=>{if(e?.translations){let t=window.i18next.language;window.i18next.addResourceBundle(t,rv.L,e.translations,!0,!0)}s(e)};return o0(e,t,i,r).then(e=>{a({...e,encounter:n})}).catch(e=>{"AbortError"!==e.name&&(console.error(e),l(Error("Error loading form JSON: "+e.message)))}),()=>{o.abort()}},[i,e,t,n]),{formJson:o,isLoading:!o&&!a,formError:a}}async function o0(e,t,n,i){let r=await (0,tM.fetchOpenMRSForm)(e),o=await (0,tM.fetchClobData)(r),s=await oq(),a=o?{...o,uuid:r.uuid}:o9(t),l=o1(a);o4(a,await o2(l,n));let c=o7(a),u=await se(c),d=c.reduce((e,t)=>(e[t.formName]=t.alias,e),{});return sn(a,st(u),d),o5(a,s,n,i)}function o1(e){return e.pages.filter(e=>e.isSubform&&!e.subform.form&&e.subform?.name).map(e=>e.subform?.name)}async function o2(e,t){return Promise.all(e.map(e=>o0(e,null,t)))}function o4(e,t){t.forEach(t=>{let n=e.pages.find(e=>e.subform?.name===t.name);n&&(n.subform.form=t)})}function o3(e,t){return e||t?e&&t?Error("InvalidArgumentsErr: Both formUuid and formJson cannot be provided at the same time."):void 0:Error("InvalidArgumentsErr: Neither formUuid nor formJson was provided")}function o5(e,t=[],n,r){return o8(e,n),t.reduce((e,t)=>t.transform(e,r),e),o6(e),i(n,e)}function o9(e){return"string"==typeof e?JSON.parse(e):JSON.parse(JSON.stringify(e))}function o8(e,t){for(let n=e.pages.length-1;n>=0;n--){let i=e.pages[n];(0,no.H)(i.isSubform)&&!(0,no.H)(i.isHidden)&&i.subform?.form?.encounterType===e.encounterType&&(i.subform.form.pages.filter(e=>!(0,no.H)(e.isSubform)),e.pages.splice(n,1,...o5(i.subform.form,[],t).pages))}}function o6(e){e.encounter&&"string"==typeof e.encounter&&!e.encounterType&&(e.encounterType=e.encounter,delete e.encounter)}function o7(e){let t=e?.referencedForms;return t||[]}async function se(e){return Promise.all(e.map(e=>o0(e.formName,null,null)))}function st(e){let t=new Map;return e.forEach(e=>{t.set(e.name,e)}),t}function sn(e,t,n){t.forEach((t,i)=>{e.pages.forEach(e=>{e.sections&&e.sections.forEach(e=>{if(e.reference&&(e.reference.form===i||e.reference.form===n[i])){let n=si(e,t);Object.assign(e,n)}})})})}function si(e,t){let n,i=t.pages.filter(t=>t.label===e.reference.page);if(i.length>0){let t=i[0].sections.filter(t=>t.label===e.reference.section);t.length>0&&(n=t[0])}return sr(n,e.reference)}function sr(e,t){if(t?.excludeQuestions){let n=t.excludeQuestions;e.questions=e.questions.filter(e=>!n.includes(e.id))}return e}var so=n(76922);function ss(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class sa{setEvaluatedPagesVisibility(e){this.evaluatedPagesVisibilitySubject.next(e)}updateScrollablePages(e){this.scrollablePagesSubject.next(e)}updatePagesWithErrors(e){this.pagesWithErrorsSubject.next(new Set(e))}addActivePage(e){let t=this.activePagesSubject.value;t.add(e),this.activePagesSubject.next(t)}removeInactivePage(e){let t=this.activePagesSubject.value;t.delete(e),this.activePagesSubject.next(t)}getActivePagesObservable(){return this.activePagesSubject.asObservable()}getScrollablePagesObservable(){return this.scrollablePagesSubject.asObservable()}getPagesWithErrorsObservable(){return this.pagesWithErrorsSubject.asObservable()}getEvaluatedPagesVisibilityObservable(){return this.evaluatedPagesVisibilitySubject.asObservable()}clear(){this.scrollablePagesSubject.next([]),this.pagesWithErrorsSubject.next(new Set),this.activePagesSubject.next(new Set),this.evaluatedPagesVisibilitySubject.next(!1)}constructor(){ss(this,"scrollablePagesSubject",new so.BehaviorSubject([])),ss(this,"pagesWithErrorsSubject",new so.BehaviorSubject(new Set)),ss(this,"activePagesSubject",new so.BehaviorSubject(new Set)),ss(this,"evaluatedPagesVisibilitySubject",new so.BehaviorSubject(null))}}let sl=new sa,sc=new Set;function su(e){e&&Object.values(e).forEach(e=>{sc.add(e)})}function sd(){sc.forEach(e=>{try{e.tearDown()}catch(e){}}),sc.clear(),sl.clear()}function sh(e){let[t,n]=(0,c.useState)(void 0),i=(0,c.useCallback)(()=>{let e=new CustomEvent("openmrs:form-view-embedded",{detail:{value:!1}});window.dispatchEvent(e)},[]),r=(0,c.useCallback)(e=>{n(e.detail.value)},[]);return(0,c.useEffect)(()=>{let t=new CustomEvent("openmrs:form-view-embedded",{detail:{value:"embedded-view"!=e}});window.dispatchEvent(t)},[e]),(0,c.useEffect)(()=>(window.addEventListener("openmrs:form-collapse-toggle",r),()=>{window.removeEventListener("openmrs:form-collapse-toggle",r)}),[]),{isFormExpanded:t,hideFormCollapseToggle:i}}let sp=26.25,sf=32.25,sg=48.25;function sm(e){let[t,n]=(0,c.useState)(0),i=(0,c.useMemo)(()=>t<=sp?"narrow":t<=sf?"wider":t<=sg?"extra-wide":"ultra-wide",[t]);return(0,c.useLayoutEffect)(()=>{let t=()=>{let t=e.current?.parentElement?.offsetWidth,i=parseInt(getComputedStyle(document.documentElement).fontSize);t&&n(td(t,i))};t();let i=new ResizeObserver(e=>{t()});return e.current?.parentElement&&i.observe(e.current?.parentElement),()=>{i.disconnect()}},[e]),i}let sv=()=>{let[e,t]=(0,c.useState)({pages:[],pagesWithErrors:[],activePages:[],evaluatedPagesVisibility:!1,hasMultiplePages:null});return(0,c.useEffect)(()=>{let e=[sl.getScrollablePagesObservable().subscribe(e=>{t(t=>({...t,pages:e,hasMultiplePages:e.length>1}))}),sl.getPagesWithErrorsObservable().subscribe(e=>{t(t=>({...t,pagesWithErrors:Array.from(e)}))}),sl.getActivePagesObservable().subscribe(e=>{t(t=>({...t,activePages:Array.from(e)}))}),sl.getEvaluatedPagesVisibilityObservable().subscribe(e=>{t(t=>({...t,evaluatedPagesVisibility:e}))})];return()=>e.forEach(e=>e.unsubscribe())},[]),e};function sb(e){let t=new Date,n=t.getFullYear()-e.getFullYear();return t.getMonth()<e.getMonth()||t.getMonth()===e.getMonth()&&t.getDate()<e.getDate()?n-1:n}let sy={female:"F",male:"M",other:"O",unknown:"U"},sw=e=>{let{patient:t,isLoading:n,error:i}=(0,a.usePatient)(e);return t&&!n&&(t.age=sb(new Date(t?.birthDate)),t.sex=sy[t.gender]??"U"),{patient:t,isLoadingPatient:n,patientError:i}},sx=(e,t,n,i)=>{let{loadDependencies:r}=e,{formJson:o}=t,[s,a]=(0,c.useState)(0),[l,u]=(0,c.useState)(null),d=(0,c.useCallback)(()=>a(e=>e+1),[]),h=l?.loadDependencies===r&&l?.attempt===s?l:null;return(0,c.useEffect)(()=>{let e=!1;return async function(){let a=await Promise.allSettled([Promise.resolve().then(()=>r?.(t,n,i)),tA(o)]);if(!e){let e=a.find(e=>"rejected"===e.status);u({loadDependencies:r,attempt:s,error:e?Error(e.reason?.message??String(e.reason)):null})}}(),()=>{e=!0}},[r,s]),{isLoading:!h||!!h.error,error:h?.error,retry:d}},s$=(e,t,n)=>{let[i,r]=(0,c.useState)(!0),[o,s]=(0,c.useState)({}),[a,l]=(0,c.useState)(null),u=(0,c.useRef)(n);u.current=n;let d=(0,c.useRef)(!1),h=n.formFields?.length>0,p=Object.keys(n.formFieldAdapters??{}).length>0;return(0,c.useEffect)(()=>{if(e&&!t&&h&&p&&!d.current){d.current=!0;let t=u.current;e.getInitialValues(t).then(e=>{s(e),r(!1)}).catch(e=>{console.error(e),l(e),r(!1)})}},[e,t,h,p]),{isLoadingInitialValues:i,initialValues:o,error:a}},s_="-esm-form-builder__section-renderer__section___+aK-S",sS="-esm-form-builder__section-renderer__sectionBody___0kmuN",sM=({section:e})=>{let{formFieldAdapters:t}=nl(),n=(0,c.useMemo)(()=>e.label.replace(/\s/g,""),[e.label]);return u().createElement("div",{className:s_},e.questions.map(e=>t[e.type]?u().createElement("div",{key:`${n}-${e.id}`,className:sS},u().createElement(nS,{key:e.id,fieldId:e.id,valueAdapter:t[e.type]})):null))};var sC=n(20594),sE=!!("u">typeof window&&window.document&&window.document.createElement);function sk(){if(!sE||!window.addEventListener||!window.removeEventListener||!Object.defineProperty)return!1;var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){return function(){e=!0}}()}),n=function(){};window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t)}catch(e){}return e}var sA=void 0;function sT(){return void 0===sA&&(sA=sk()),sA}function sL(e){if(e)return sT()?e:!!e.capture}function sO(e){return e?!0===e?100:(0|e.capture)+(e.passive<<1)+(e.once<<2):0}function sR(e){e.handlers===e.nextHandlers&&(e.nextHandlers=e.handlers.slice())}function sD(e){this.target=e,this.events={}}sD.prototype.getEventHandlers=function(){return function(e,t){var n=String(e)+" "+String(sO(t));return this.events[n]||(this.events[n]={handlers:[],handleEvent:void 0},this.events[n].nextHandlers=this.events[n].handlers),this.events[n]}}(),sD.prototype.handleEvent=function(){return function(e,t,n){var i=this.getEventHandlers(e,t);i.handlers=i.nextHandlers,i.handlers.forEach(function(e){e&&e(n)})}}(),sD.prototype.add=function(){return function(e,t,n){var i=this,r=this.getEventHandlers(e,n);sR(r),0===r.nextHandlers.length&&(r.handleEvent=this.handleEvent.bind(this,e,n),this.target.addEventListener(e,r.handleEvent,n)),r.nextHandlers.push(t);var o=!0;return function(){return function(){if(o){o=!1,sR(r);var s=r.nextHandlers.indexOf(t);r.nextHandlers.splice(s,1),0===r.nextHandlers.length&&(i.target&&i.target.removeEventListener(e,r.handleEvent,n),r.handleEvent=void 0)}}}()}}();var sI="__consolidated_events_handlers__";function sj(e,t,n,i){e[sI]||(e[sI]=new sD(e));var r=sL(i);return e[sI].add(t,n,r)}var sN=n(23286);function sP(e){if("%"===e.slice(-1))return parseFloat(e.slice(0,-1))/100}function sF(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseFloat(e):"px"===e.slice(-2)?parseFloat(e.slice(0,-2)):void 0}function sU(e,t){var n=sF(e);if("number"==typeof n)return n;var i=sP(e);if("number"==typeof i)return i*t}var sV="above",sz="inside",sH="below",sW="invisible";function sB(e){return"string"==typeof e.type}var sq="<Waypoint> needs a DOM element to compute boundaries. The child you passed is neither a DOM element (e.g. <div>) nor does it use the innerRef prop.\n\nSee https://goo.gl/LrBNgw for more info.";function sG(e,t){if(e&&!sB(e)&&!t)throw Error(sq)}function sK(e){return e.viewportBottom-e.viewportTop==0?sW:e.viewportTop<=e.waypointTop&&e.waypointTop<=e.viewportBottom||e.viewportTop<=e.waypointBottom&&e.waypointBottom<=e.viewportBottom||e.waypointTop<=e.viewportTop&&e.viewportBottom<=e.waypointBottom?sz:e.viewportBottom<e.waypointTop?sH:e.waypointTop<e.viewportTop?sV:sW}var sY=[];function sQ(e){sY.push(e),s||(s=setTimeout(function(){var e;for(s=null;e=sY.shift();)e()},0));var t=!0;return function(){if(t){t=!1;var n=sY.indexOf(e);-1!==n&&(sY.splice(n,1),!sY.length&&s&&(clearTimeout(s),s=null))}}}function sZ(e){return"window"===e?n.g.window:e}var sJ="u">typeof window,sX={debug:!1,scrollableAncestor:void 0,children:void 0,topOffset:"0px",bottomOffset:"0px",horizontal:!1,onEnter:function(){},onLeave:function(){},onPositionChange:function(){},fireOnRapidScroll:!0},s0=function(e){function t(t){var n;return(n=e.call(this,t)||this).refElement=function(e){n._ref=e},n}(0,sC.A)(t,e);var n=t.prototype;return n.componentDidMount=function(){var e=this;sJ&&(this.cancelOnNextTick=sQ(function(){e.cancelOnNextTick=null;var t=e.props,n=t.children;t.debug,sG(n,e._ref),e._handleScroll=e._handleScroll.bind(e),e.scrollableAncestor=e._findScrollableAncestor(),e.scrollEventListenerUnsubscribe=sj(e.scrollableAncestor,"scroll",e._handleScroll,{passive:!0}),e.resizeEventListenerUnsubscribe=sj(window,"resize",e._handleScroll,{passive:!0}),e._handleScroll(null)}))},n.componentDidUpdate=function(){var e=this;sJ&&this.scrollableAncestor&&(this.cancelOnNextTick||(this.cancelOnNextTick=sQ(function(){e.cancelOnNextTick=null,e._handleScroll(null)})))},n.componentWillUnmount=function(){sJ&&(this.scrollEventListenerUnsubscribe&&this.scrollEventListenerUnsubscribe(),this.resizeEventListenerUnsubscribe&&this.resizeEventListenerUnsubscribe(),this.cancelOnNextTick&&this.cancelOnNextTick())},n._findScrollableAncestor=function(){var e=this.props,t=e.horizontal,n=e.scrollableAncestor;if(n)return sZ(n);for(var i=this._ref;i.parentNode&&(i=i.parentNode)!==document.body;){var r=window.getComputedStyle(i),o=(t?r.getPropertyValue("overflow-x"):r.getPropertyValue("overflow-y"))||r.getPropertyValue("overflow");if("auto"===o||"scroll"===o||"overlay"===o)return i}return window},n._handleScroll=function(e){if(this._ref){var t=this._getBounds(),n=sK(t),i=this._previousPosition,r=this.props,o=(r.debug,r.onPositionChange),s=r.onEnter,a=r.onLeave,l=r.fireOnRapidScroll;if(this._previousPosition=n,i!==n){var c={currentPosition:n,previousPosition:i,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom};o.call(this,c),n===sz?s.call(this,c):i===sz&&a.call(this,c);var u=i===sH&&n===sV,d=i===sV&&n===sH;l&&(u||d)&&(s.call(this,{currentPosition:sz,previousPosition:i,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}),a.call(this,{currentPosition:n,previousPosition:sz,event:e,waypointTop:t.waypointTop,waypointBottom:t.waypointBottom,viewportTop:t.viewportTop,viewportBottom:t.viewportBottom}))}}},n._getBounds=function(){var e,t,n=this.props,i=n.horizontal;n.debug;var r=this._ref.getBoundingClientRect(),o=r.left,s=r.top,a=r.right,l=r.bottom,c=i?o:s,u=i?a:l;this.scrollableAncestor===window?(e=i?window.innerWidth:window.innerHeight,t=0):(e=i?this.scrollableAncestor.offsetWidth:this.scrollableAncestor.offsetHeight,t=i?this.scrollableAncestor.getBoundingClientRect().left:this.scrollableAncestor.getBoundingClientRect().top);var d=this.props,h=d.bottomOffset,p=sU(d.topOffset,e),f=sU(h,e),g=t+e;return{waypointTop:c,waypointBottom:u,viewportTop:t+p,viewportBottom:g-f}},n.render=function(){var e=this,t=this.props.children;if(!t)return u().createElement("span",{ref:this.refElement,style:{fontSize:0}});if(sB(t)||(0,sN.isForwardRef)(t)){var n=function(n){e.refElement(n),t.ref&&("function"==typeof t.ref?t.ref(n):t.ref.current=n)};return u().cloneElement(t,{ref:n})}return u().cloneElement(t,{innerRef:this.refElement})},t}(u().PureComponent);s0.above=sV,s0.below=sH,s0.inside=sz,s0.invisible=sW,s0.defaultProps=sX,s0.displayName="Waypoint";let s1={pageContent:"-esm-form-builder__page-renderer__pageContent___1sqJE",pageHeader:"-esm-form-builder__page-renderer__pageHeader___5xq2Z",pageTitle:"-esm-form-builder__page-renderer__pageTitle___L0LWE",collapseIcon:"-esm-form-builder__page-renderer__collapseIcon___FAxsi",sectionContainer:"-esm-form-builder__page-renderer__sectionContainer___GuKLn",accordionContainer:"-esm-form-builder__page-renderer__accordionContainer___S5AuC",firstSection:"-esm-form-builder__page-renderer__firstSection___cvqEr",lastSection:"-esm-form-builder__page-renderer__lastSection___FcNvF",formSection:"-esm-form-builder__page-renderer__formSection___2sNJr",hiddenAccordion:"-esm-form-builder__page-renderer__hiddenAccordion___ldAud"};function s2({section:e,sectionIndex:t,visibleSections:n,isFormExpanded:i}){let{t:r}=(0,e0.useTranslation)(),[o,s]=(0,c.useState)(i);return(0,c.useEffect)(()=>{s(i)},[i]),u().createElement(g.AccordionItem,{title:r(e.label),open:o,className:h()(s1.sectionContainer,{[s1.firstSection]:0===t,[s1.lastSection]:t===n.length-1})},u().createElement("div",{className:s1.formSection},u().createElement(sM,{section:e})))}let s4=function({page:e,isFormExpanded:t}){let{t:n}=(0,e0.useTranslation)(),[i,r]=(0,c.useState)(!1),o=(0,c.useMemo)(()=>e.sections.filter(e=>{let t=e.questions.some(e=>!(0,no.H)(e.isHidden));return!(0,no.H)(e.isHidden)&&t}),[e.sections]),s=()=>r(!i);return(0,c.useEffect)(()=>(r(!t),()=>{sl.removeInactivePage(e.id)}),[t]),u().createElement("div",null,u().createElement(s0,{key:e.id,onEnter:()=>sl.addActivePage(e.id),onLeave:()=>sl.removeInactivePage(e.id),topOffset:"40%",bottomOffset:"40%"},u().createElement("div",{id:e.id,className:s1.pageContent},u().createElement("div",{className:s1.pageHeader,onClick:s},u().createElement("p",{className:s1.pageTitle},n(e.label),u().createElement("span",{className:s1.collapseIconWrapper},i?u().createElement(a.ChevronDownIcon,{className:s1.collapseIcon,"aria-label":"Expand"}):u().createElement(a.ChevronUpIcon,{className:s1.collapseIcon,"aria-label":"Collapse"})))),u().createElement("div",{className:h()({[s1.hiddenAccordion]:i,[s1.accordionContainer]:!i})},u().createElement(g.Accordion,null,o.map((e,n)=>u().createElement(s2,{key:`section-${e.label}`,section:e,sectionIndex:n,visibleSections:o,isFormExpanded:t})))))))},s3={formFields:[],invalidFields:[],formJson:null,deletedFields:[]},s5=(e,t)=>{switch(t.type){case"SET_FORM_FIELDS":return{...e,formFields:t.value};case"ADD_FORM_FIELD":return{...e,formFields:[...e.formFields,t.value]};case"UPDATE_FORM_FIELD":return{...e,formFields:e.formFields.map(e=>e.id===t.value.id?t.value:e)};case"REMOVE_FORM_FIELD":return{...e,formFields:e.formFields.filter(e=>e.id!==t.value)};case"SET_INVALID_FIELDS":return{...e,invalidFields:t.value};case"ADD_INVALID_FIELD":return{...e,invalidFields:[...e.invalidFields,t.value]};case"REMOVE_INVALID_FIELD":return{...e,invalidFields:e.invalidFields.filter(e=>e.id!==t.value)};case"CLEAR_INVALID_FIELDS":return{...e,invalidFields:[]};case"SET_FORM_JSON":return{...e,formJson:t.value};case"SET_DELETED_FIELDS":return{...e,deletedFields:t.value};default:return e}},s9=(e,t)=>{let{formFields:n,patient:i,sessionMode:r,visit:o}=t,[s,a]=(0,c.useState)(t.formJson),[l,u]=(0,c.useState)(!1),d=(0,c.useMemo)(()=>n?.map(t=>{let s={value:t,type:"field"},a={patient:i,mode:r,visit:o};if(t.hide?.hideWhenExpression){let i=tq(t.hide.hideWhenExpression,s,n,e,a);t.isHidden=i,Array.isArray(t.questions)&&t.questions.forEach(e=>{e.isHidden=i})}else t.isHidden=!1;"object"==typeof t.required&&"conditionalRequired"===t.required.type?t.isRequired=tX(t,n,e):t.isRequired=(0,no.H)(t.required),"object"==typeof t.disabled&&t.disabled.disableWhenExpression?t.isDisabled=tq(t.disabled.disableWhenExpression,s,n,e,a):t.isDisabled=(0,no.H)(t.disabled),t.validators?.some(e=>"conditionalAnswered"===e.type)&&tJ(t,n),t.questionOptions.answers?.filter(e=>!e6(e.hide?.hideWhenExpression)).forEach(t=>{t.isHidden=tq(t.hide.hideWhenExpression,s,n,e,a)}),t.questionOptions.answers?.filter(e=>!e6(e.disable?.disableWhenExpression)).forEach(t=>{t.disable.isDisabled=tq(t.disable?.disableWhenExpression,s,n,e,a)}),"string"==typeof t.readonly&&s8(t.readonly)&&(t.meta.readonlyExpression=t.readonly,t.readonly=tq(t.readonly,s,n,e,a));let l=t.questionOptions.repeatOptions?.limitExpression;return"repeating"!==t.questionOptions.rendering||e6(l)||(t.questionOptions.repeatOptions.limit=tq(l,s,n,e,a)),t}),[e,n,i,r]);return(0,c.useEffect)(()=>{t.formJson?.pages?.forEach(t=>{t.hide?t1({value:t,type:"page"},n,e,r,i,tq,null):t.isHidden=!1,t?.sections?.forEach(t=>{t.hide?t1({value:t,type:"section"},n,e,r,i,tq,null):t.isHidden=!1})}),a(tu(t.formJson)),u(!0)},[t.formJson,n]),{evaluatedFormJson:s,evaluatedFields:d,evaluatedPagesVisibility:l}};function s8(e){return"true"!==e&&"false"!==e}function s6(e,t){let n=(0,c.useCallback)(t=>{e({type:"ADD_FORM_FIELD",value:t})},[]),i=(0,c.useCallback)(n=>{if(n.meta.groupId){let e=t.find(e=>e.id===n.meta.groupId);e&&(e.questions=e.questions.map(e=>e.id===n.id?n:e),i(e))}e({type:"UPDATE_FORM_FIELD",value:(0,iT.A)(n)})},[t]),r=(0,c.useCallback)(e=>t.find(t=>t.id===e),[t]),o=(0,c.useCallback)(t=>{e({type:"REMOVE_FORM_FIELD",value:t})},[]),s=(0,c.useCallback)(t=>{e({type:"SET_INVALID_FIELDS",value:t})},[]),a=(0,c.useCallback)(t=>{e({type:"ADD_INVALID_FIELD",value:t})},[]),l=(0,c.useCallback)(t=>{e({type:"REMOVE_INVALID_FIELD",value:t})},[]);return{addFormField:n,updateFormField:i,getFormField:r,removeFormField:o,setInvalidFields:s,addInvalidField:a,removeInvalidField:l,setForm:(0,c.useCallback)(t=>{e({type:"SET_FORM_JSON",value:tu(t)})},[]),setDeletedFields:(0,c.useCallback)(t=>{e({type:"SET_DELETED_FIELDS",value:t})},[])}}let s7=({processorContext:e,initialValues:t,isSubForm:n,setIsLoadingFormDependencies:i})=>{let{evaluatedFields:r,evaluatedFormJson:o,evaluatedPagesVisibility:s}=s9(t,e),{registerForm:a,setIsFormDirty:l,workspaceLayout:d,isFormExpanded:h}=rW(),p=eX({defaultValues:t,mode:"onChange",reValidateMode:"onChange",criteriaMode:"all"}),{formState:{isDirty:f}}=p,[{formFields:g,invalidFields:m,formJson:v,deletedFields:b},y]=(0,c.useReducer)(s5,{...s3,formFields:r,formJson:o}),{addFormField:w,updateFormField:x,getFormField:$,removeFormField:_,setInvalidFields:S,addInvalidField:M,removeInvalidField:C,setForm:E,setDeletedFields:k}=s6(y,g);(0,c.useEffect)(()=>{let e=v.pages.filter(e=>!e.isSubform).map(e=>e);sl.updateScrollablePages(e)},[v.pages]),(0,c.useEffect)(()=>{sl.setEvaluatedPagesVisibility(s)},[s]),(0,c.useEffect)(()=>{sl.updatePagesWithErrors(m.map(e=>e.meta.pageId))},[m]);let A=(0,c.useMemo)(()=>({...e,workspaceLayout:d,methods:p,formFields:g,formJson:v,invalidFields:m,deletedFields:b,addFormField:w,updateFormField:x,getFormField:$,removeFormField:_,setInvalidFields:S,addInvalidField:M,removeInvalidField:C,setForm:E,setDeletedFields:k}),[e,d,p,g,v,m,b]);return(0,c.useEffect)(()=>{a(v.name,n,A)},[v.name,n,A]),(0,c.useEffect)(()=>{l(f)},[f]),u().createElement(na,A,v.pages.map(e=>e.isSubform||t9(e)?e.isSubform&&e.subform?.form?u().createElement(af,{key:e.subform.form.uuid,formJson:e.subform.form,isSubForm:!0,setIsLoadingFormDependencies:i}):u().createElement(s4,{key:e.label,page:e,isFormExpanded:h}):null))},ae=({context:e,setContext:t,setters:n,useCustomHooks:i,setIsLoadingCustomHooks:r})=>{let{isLoading:o=!1,error:s=null,data:a,updateContext:l}=i(e);return(0,c.useEffect)(()=>{!o&&l&&(l(t,n),r(!1))},[o]),null};function at(e){let[t,n]=(0,c.useMemo)(()=>{let t=[],n=new Set,i=(e,r)=>{let o=r?{...e,meta:{...e.meta,groupId:r}}:e;t.push(o),o.questionOptions?.concept&&n.add(o.questionOptions.concept),o.questionOptions?.answers?.forEach(e=>{e.concept&&n.add(e.concept)}),"obsGroup"===o.type&&o.questions&&o.questions.forEach(e=>{i(e,o.id)})};return e.pages?.forEach(e=>e.sections?.forEach(e=>{e.questions?.forEach(e=>i(e))})),[t,JSON.stringify(Array.from(n).sort())]},[e]);return{formFields:t,conceptReferences:(0,c.useMemo)(()=>new Set(JSON.parse(n)),[n])}}let an="custom:(uuid,display,conceptClass:(uuid,display),answers:(uuid,display),conceptMappings:(conceptReferenceTerm:(conceptSource:(name),code)))";function ai(e){let{data:t,error:n,isLoading:i}=rk()([`${a.restBaseUrl}/conceptreferences?v=${an}`,e],([e,t])=>(0,a.openmrsFetch)(e,{headers:{"Content-Type":"application/json"},body:{references:t},method:"POST"}),{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,shouldRetryOnError:!1});return{concepts:(0,c.useMemo)(()=>t?.data?Object.values(t.data):void 0,[t]),isLoading:i,error:n}}let ar={};function ao(e){let t=(0,c.useMemo)(()=>{let t=new Set;return e.forEach(e=>{e.validators?.forEach(e=>t.add(e.type))}),Array.from(t).sort().join(",")},[e]),{data:n}=rM()(t?["formFieldValidators",t]:null,async([,e])=>{let t=e.split(","),n=await Promise.all(t.map(e=>oK(e))),i={};return t.forEach((e,t)=>{i[e]=n[t]}),i},{keepPreviousData:!0});return n??ar}function as(e,t){return(0,c.useMemo)(()=>e.length&&t?.length?e.map(e=>{let n=t4(e.questionOptions.concept,t);return e.questionOptions.concept=n?n.uuid:e.questionOptions.concept,e.label=e.label?e.label:n?.display,l.FU.includes(e.questionOptions.rendering)&&!e.questionOptions.answers?.length&&n?.conceptClass?.display==="Question"&&n?.answers?.length&&(e.questionOptions.answers=n.answers.map(e=>({concept:e?.uuid,label:e?.display}))),e.meta={...e.meta||{},concept:n},e.questionOptions.answers&&(e.questionOptions.answers=e.questionOptions.answers.map(e=>{let n=t4(e.concept,t);return{...e,concept:n?n.uuid:e.concept,label:e.label?e.label:n?.display}})),e}):e??[],[t,e])}let aa={},al=e=>{let t=(0,c.useMemo)(()=>{let t=new Set;return e.forEach(e=>t.add(e.type)),Array.from(t).sort().join(",")},[e]),{data:n}=rM()(t?["formFieldValueAdapters",t]:null,async([,e])=>{let t=e.split(","),n=await Promise.all(t.map(e=>oB(e))),i={};return t.forEach((e,t)=>{i[e]=n[t]}),i},{keepPreviousData:!0});return n??aa},ac="-esm-form-builder__loader__loaderContainer___ZkHfb",au="-esm-form-builder__loader__loader___YgDLP",ad=()=>{let{t:e}=(0,e0.useTranslation)();return u().createElement("div",{className:ac},u().createElement(g.InlineLoading,{className:au,description:`${e("loading","Loading")} ...`}))},ah=["patient","formJson","visit","sessionMode","sessionDate","location","currentProvider","layoutType","processor","formFields","formFieldAdapters","formFieldValidators"];function ap(e,t){let n=ah.filter(n=>n in t&&t[n]!==e[n]);n.length&&console.warn(`A form processor tried to set the context propert${1===n.length?"y":"ies"} ${n.join(", ")}, which the form engine derives itself. ${1===n.length?"It was":"They were"} ignored. Use the setters passed alongside setContext to update the domain object or custom dependencies.`)}let af=({formJson:e,isSubForm:t=!1,setIsLoadingFormDependencies:n})=>{let{patient:i,sessionMode:r,formProcessors:o,layoutType:s,location:a,provider:l,sessionDate:d,visit:h}=rW(),{t:p}=(0,e0.useTranslation)(),f=(0,c.useId)(),m=(0,c.useMemo)(()=>{let t,n=o[e.processor];return n?t=new n(e):(console.error(`Form processor ${e.processor} not found, defaulting to EncounterFormProcessor`),t=new rD(e)),t.prepareFormSchema(e),t},[o,e.processor]),{formFields:v,conceptReferences:b}=at(e),{concepts:y,isLoading:w}=ai(Array.from(b)),x=as(v,y),$=al(v),_=ao(v),S=(0,c.useMemo)(()=>x?.length?x:v??[],[x,v]),[M,C]=(0,c.useState)({}),E=(0,c.useMemo)(()=>({patient:i,formJson:e,sessionMode:r,layoutType:s,location:a,currentProvider:l,processor:m,sessionDate:d,visit:h,formFields:S,formFieldAdapters:$??{},formFieldValidators:_??{}}),[i,e,r,s,a,l,m,d,h,S,$,_]),k=(0,c.useMemo)(()=>({...E,...M}),[E,M]),A=(0,c.useCallback)(e=>{C(t=>{let n={...E,...t},i="function"==typeof e?e(n):e;return"function"==typeof e&&ap(n,i),{domainObjectValue:i.domainObjectValue,previousDomainObjectValue:i.previousDomainObjectValue,customDependencies:i.customDependencies}})},[E]),T=(0,c.useMemo)(()=>({setDomainObjectValue:e=>C(t=>({...t,domainObjectValue:e})),setPreviousDomainObjectValue:e=>C(t=>({...t,previousDomainObjectValue:e})),setCustomDependencies:e=>C(t=>({...t,customDependencies:"function"==typeof e?e(t.customDependencies??{}):e}))}),[]),{isLoading:L,error:O,retry:R}=sx(m,k,A,T),D=m.getCustomHooks().useCustomHooks,[I,j]=(0,c.useState)(!!D),{isLoadingInitialValues:N,initialValues:P,error:F}=s$(m,L||I||w,k),U=(0,c.useMemo)(()=>L||I||w||N,[L,I,w,N]);return(0,c.useEffect)(()=>{n(f,U)},[f,U,n]),(0,c.useEffect)(()=>()=>n(f,!1),[f,n]),(0,c.useEffect)(()=>{(0,ne.N)(F,p("errorLoadingInitialValues","Error loading initial values"))},[F,p]),(0,c.useEffect)(()=>{$&&su($)},[$]),u().createElement(u().Fragment,null,D&&u().createElement(ae,{context:k,setContext:A,setters:T,useCustomHooks:D,setIsLoadingCustomHooks:j}),O?u().createElement("div",null,u().createElement(g.InlineNotification,{kind:"error",hideCloseButton:!0,title:p("errorLoadingFormDependencies","Unable to load form data"),subtitle:p("retryLoadingFormDependencies","Required form data could not be loaded. Retry to complete and save this form.")}),u().createElement(g.Button,{kind:"tertiary",onClick:R},p("retry","Retry"))):U?u().createElement(ad,null):u().createElement(s7,{processorContext:k,initialValues:P,isSubForm:t,setIsLoadingFormDependencies:n}))},ag="-esm-form-builder__patient-banner__patientBannerContainer___KlhJI",am=({patient:e,hideActionsOverflow:t})=>u().createElement("div",{className:ag},u().createElement(a.ExtensionSlot,{name:"patient-header-slot",state:{patient:e,patientUuid:e.id,hideActionsOverflow:t}})),av=({pages:e,defaultPage:t,activePages:n,evaluatedPagesVisibility:i})=>{let[r,o]=(0,c.useState)(null),[s,a]=(0,c.useState)(!1),[l,u]=(0,c.useState)(null),d=(0,c.useRef)(!0);return(0,c.useEffect)(()=>{s||!i||((()=>{let n=e.find(({label:e})=>e===t);if(n&&!n.isHidden)o(n.id),t3(n.id);else{let t=e.find(e=>!e.isHidden);t&&o(t.id)}})(),a(!0))},[e,t,i,s]),(0,c.useEffect)(()=>{let e=null;return s&&(e=setTimeout(()=>{d.current=!1},200)),()=>{e&&clearTimeout(e)}},[s]),(0,c.useEffect)(()=>{if(d.current)return;let t=null;if(l&&n.includes(l)){o(l),t=setTimeout(()=>{u(null)},100);return}return!l&&n.length>0&&o(n.reduce((t,n)=>e.findIndex(e=>e.id===t)<e.findIndex(e=>e.id===n)?t:n)),()=>{t&&clearTimeout(t)}},[n,l,e]),{currentActivePage:r,requestPage:(0,c.useCallback)(e=>{d.current=!1,u(e),o(e),t3(e)},[])}},ab="-esm-form-builder__sidebar__pageLink___Op55o",ay="-esm-form-builder__sidebar__pageLinkTablet___cXw5r",aw="-esm-form-builder__sidebar__activePage___buqNi",ax="-esm-form-builder__sidebar__errorPage___Eu-K9",a$="-esm-form-builder__sidebar__activeErrorPage___KHaKn",a_="-esm-form-builder__sidebar__sidebar___vTQvS",aS="-esm-form-builder__sidebar__sideNavActions___dzMCV",aM="-esm-form-builder__sidebar__divider___akCoV",aC="-esm-form-builder__sidebar__closeButton___HiIEp",aE="-esm-form-builder__sidebar__saveButton___6rQj1",ak="-esm-form-builder__sidebar__topMargin___Fh16B";function aA({page:e,currentActivePage:t,pagesWithErrors:n,requestPage:i}){let{t:r}=(0,e0.useTranslation)(),o=e.id===t,s=n.includes(e.id),l="tablet"===(0,a.useLayoutType)();return u().createElement("div",{className:h()(ab,{[aw]:o&&!s,[ax]:s&&!o,[a$]:s&&o,[ay]:l})},u().createElement("button",{onClick:t=>{t.preventDefault(),i(e.id)}},u().createElement("span",null,r(e.label))))}let aT=({defaultPage:e,isFormSubmitting:t,sessionMode:n,onCancel:i,handleClose:r,hideFormCollapseToggle:o,hideControls:s})=>{let{t:l}=(0,e0.useTranslation)(),{pages:d,pagesWithErrors:p,activePages:f,evaluatedPagesVisibility:m}=sv(),{currentActivePage:v,requestPage:b}=av({pages:d,defaultPage:e,activePages:f,evaluatedPagesVisibility:m}),y=(0,a.useLayoutType)(),w=(0,c.useMemo)(()=>"tablet"===y?"lg":"sm",[y]);return u().createElement("div",{className:a_},d.filter(e=>t9(e)).map(e=>u().createElement(aA,{key:e.id,page:e,currentActivePage:v,pagesWithErrors:p,requestPage:b})),"view"!==n&&!s&&u().createElement("hr",{className:aM}),!s&&u().createElement("div",{className:aS},"view"!==n&&u().createElement(g.Button,{className:aE,disabled:t,type:"submit",size:w},t?u().createElement(g.InlineLoading,{description:l("submitting","Submitting")+"..."}):u().createElement("span",null,`${l("save","Save")}`)),u().createElement(g.Button,{className:h()(aC,{[ak]:"view"===n}),kind:"tertiary",onClick:()=>{i?.(),r?.(),o()},size:w},"view"===n?l("close","Close"):l("cancel","Cancel"))))},aL="-esm-form-builder__form-engine__form___j8Gb3",aO="-esm-form-builder__form-engine__formContainer___Cvw6g",aR="-esm-form-builder__form-engine__formContent___F7MoF",aD="-esm-form-builder__form-engine__formContentInner___CXTIX",aI="-esm-form-builder__form-engine__formBody___DgyqX",aj="-esm-form-builder__form-engine__minifiedButtons___Ieyml",aN="-esm-form-builder__form-engine__markdownContainer___8OoYZ",aP="-esm-form-builder__form-engine__linearActivity___g2Tl3",aF="-esm-form-builder__form-engine__indeterminate___aYMI1",aU="-esm-form-builder__form-engine__saveButton___CQZOn",aV=({formJson:e,patientUUID:t,formUUID:n,encounterUUID:i,visit:r,formSessionIntent:o,mode:s,onSubmit:l,onCancel:d,handleClose:p,handleConfirmQuestionDeletion:f,markFormAsDirty:m,hideControls:v=!1,hidePatientBanner:b=!1,preFilledQuestions:y})=>{let{t:w}=(0,e0.useTranslation)(),x=(0,a.useSession)(),$=(0,c.useRef)(null),_=(0,c.useRef)(new Date),S=(0,c.useMemo)(()=>tl(_.current,r),[r?.startDatetime,r?.stopDatetime]),M=sm($),{patient:C,isLoadingPatient:E}=sw(t),[k,A]=(0,c.useState)(!0),T=(0,c.useRef)(new Set),L=(0,c.useCallback)((e,t)=>{t?T.current.add(e):T.current.delete(e),A(T.current.size>0)},[]),[O,R]=(0,c.useState)(!1),[D,I]=(0,c.useState)(!1),j=e6(s)?e6(i)?"enter":"edit":s,{isFormExpanded:N,hideFormCollapseToggle:P}=sh(j),{hasMultiplePages:F}=sv(),{formJson:U,isLoading:V,formError:z}=oX(n,e,i,o,y),H=(0,c.useMemo)(()=>!b&&C&&"ultra-wide"===M&&"embedded-view"!==s,[C,s,M,b]),W=(0,c.useMemo)(()=>["narrow"].includes(M),[M]),B=(0,c.useMemo)(()=>"embedded-view"!==s&&!k&&null!==F&&(W||!F),[s,W,k,F]),q=(0,c.useMemo)(()=>"embedded-view"!==s&&!k&&null!==F&&!W&&F,[W,k,F]);(0,c.useEffect)(()=>{(0,ne.N)(z,w("errorLoadingFormSchema","Error loading form schema"))},[z]),(0,c.useEffect)(()=>()=>{sd()},[]),(0,c.useEffect)(()=>{m?.(D)},[D]);let G=(0,c.useCallback)(e=>{e.preventDefault(),R(!0)},[]);return u().createElement("form",{ref:$,noValidate:!0,className:h()("cds--form",aL),onSubmit:G},E||V?u().createElement(ad,null):u().createElement(rH,{patient:C,isLoadingDependencies:k,patientUUID:t,sessionMode:j,sessionDate:S,formJson:U,workspaceLayout:"ultra-wide"===M?"maximized":"minimized",location:x?.sessionLocation,provider:x?.currentProvider,visit:r,handleConfirmQuestionDeletion:f,isFormExpanded:N,formSubmissionProps:{isSubmitting:O,setIsSubmitting:R,onSubmit:l,onError:()=>{},handleClose:()=>{}},hideFormCollapseToggle:P,setIsFormDirty:I},u().createElement("div",{className:aO},k&&u().createElement("div",{className:aP},u().createElement("div",{className:aF})),u().createElement("div",{className:aR},q&&u().createElement(aT,{isFormSubmitting:O,sessionMode:s,defaultPage:U.defaultPage,onCancel:d,handleClose:p,hideFormCollapseToggle:P,hideControls:v}),u().createElement("div",{className:aD},H&&u().createElement(am,{patient:C,hideActionsOverflow:!0}),U.markdown&&u().createElement("div",{className:aN},u().createElement(n9,{markdown:U.markdown})),u().createElement("div",{className:aI},u().createElement(af,{formJson:U,setIsLoadingFormDependencies:L})),B&&!v&&u().createElement(g.ButtonSet,{className:aj},u().createElement(g.Button,{kind:"secondary",onClick:()=>{d&&d(),p&&p(),P()}},"view"===s?w("close","Close"):w("cancel","Cancel")),u().createElement(g.Button,{className:aU,disabled:k||O||"view"===s,kind:"primary",type:"submit"},O?u().createElement(g.InlineLoading,{description:w("submitting","Submitting")+"..."}):u().createElement("span",null,`${w("save","Save")}`))))))))},az=function(e){return u().createElement(c.Suspense,{fallback:u().createElement(ad,null)},u().createElement(e0.I18nextProvider,{i18n:window.i18next,defaultNS:rv.L},u().createElement(aV,e)))}},6232(e,t,n){"use strict";function i(e){return"boolean"==typeof e?e:"string"==typeof e?"true"==e:!!e}function r(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}n.d(t,{H:()=>i,O:()=>r})},10578(e,t,n){"use strict";n.d(t,{N:()=>r,j:()=>o});var i=n(23365);function r(e,t){if(e){let n=o(e).join(", ");console.error(e),(0,i.showSnackbar)({subtitle:n,title:t,kind:"error",isLowContrast:!1})}}function o(e){let t=e?.responseBody?.error?.fieldErrors,n=e?.responseBody?.error?.globalErrors;return t&&0!==Object.keys(t).length||n?n?.length?n.flatMap(e=>e.message):Object.values(t).flatMap(e=>e.map(e=>e.message)):[e?.responseBody?.error?.message??e?.message]}},77541(__unused_rspack_module,__webpack_exports__,__webpack_require__){"use strict";function evaluatePostSubmissionExpression(expression,encounters){let match,encounter=encounters[0],regx=/(?:\w+|'(?:\\'|[^'\n])*')/g,fieldIds=new Set;try{let replacedExpression;for(;match=regx.exec(expression);){let value=match[0].replace(/\\'/g,"'"),isBoolean=/^(true|false)$/i.test(value),isNumber=/^-?\d+$/.test(value),isFloat=/^-?\d+\.\d+$/.test(value);value.startsWith("'")&&value.endsWith("'")||"string"!=typeof value||isBoolean||isNumber||isFloat||fieldIds.add(value)}let fieldToValueMap={};return fieldIds.size&&(fieldToValueMap=getFieldValues(fieldIds,encounter)),replacedExpression=Object.keys(fieldToValueMap).length?expression.replace(/(\w+)/g,e=>Object.prototype.hasOwnProperty.call(fieldToValueMap,e)?fieldToValueMap[e]:e):expression,eval(replacedExpression)}catch(error){throw Error("Error evaluating expression")}}function getFieldValues(e,t){let n={};return e.forEach(e=>{let i=t.obs?.find(t=>t.formFieldPath.includes(e))?.value;"object"==typeof i&&(i=i.uuid),i&&(i=formatValue(i)),n[e]=i}),n}function formatValue(e){if("string"==typeof e&&(!(e.length>=2)||"'"!==e[0]||"'"!==e[e.length-1]))return`'${e}'`;return e}__webpack_require__.d(__webpack_exports__,{g:()=>evaluatePostSubmissionExpression})},80952(e,t,n){e=n.nmd(e),function(){var e="ace",t=function(){return this}();if(!t&&"u">typeof window&&(t=window),e||"u"<typeof requirejs){var n=function(e,t,i){"string"!=typeof e?n.original?n.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace()):(2==arguments.length&&(i=t),n.modules[e]||(n.payloads[e]=i,n.modules[e]=null))};n.modules={},n.payloads={};var i=function(e,t,n){if("string"==typeof t){var i=s(e,t);if(void 0!=i)return n&&n(),i}else if("[object Array]"===Object.prototype.toString.call(t)){for(var o=[],a=0,l=t.length;a<l;++a){var c=s(e,t[a]);if(void 0==c&&r.original)return;o.push(c)}return n&&n.apply(null,o)||!0}},r=function(e,t){var n=i("",e,t);return void 0==n&&r.original?r.original.apply(this,arguments):n},o=function(e,t){if(-1!==t.indexOf("!")){var n=t.split("!");return o(e,n[0])+"!"+o(e,n[1])}if("."==t.charAt(0))for(t=e.split("/").slice(0,-1).join("/")+"/"+t;-1!==t.indexOf(".")&&i!=t;){var i=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return t},s=function(e,t){t=o(e,t);var r=n.modules[t];if(!r){if("function"==typeof(r=n.payloads[t])){var s={},a={id:t,uri:"",exports:s,packaged:!0};s=r(function(e,n){return i(t,e,n)},s,a)||a.exports,n.modules[t]=s,delete n.payloads[t]}r=n.modules[t]=s||r}return r};a(e)}function a(e){var i=t;e&&(t[e]||(t[e]={}),i=t[e]),i.define&&i.define.packaged||(n.original=i.define,i.define=n,i.define.packaged=!0),i.require&&i.require.packaged||(r.original=i.require,i.require=r,i.require.packaged=!0)}}(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(e,t,n){function i(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||i(String.prototype,"startsWith",function(e,t){return t=t||0,this.lastIndexOf(e,t)===t}),String.prototype.endsWith||i(String.prototype,"endsWith",function(e,t){var n=this;(void 0===t||t>n.length)&&(t=n.length),t-=e.length;var i=n.indexOf(e,t);return -1!==i&&i===t}),String.prototype.repeat||i(String.prototype,"repeat",function(e){for(var t="",n=this;e>0;)1&e&&(t+=n),(e>>=1)&&(n+=n);return t}),String.prototype.includes||i(String.prototype,"includes",function(e,t){return -1!=this.indexOf(e,t)}),Object.assign||(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];null!=i&&Object.keys(i).forEach(function(e){t[e]=i[e]})}return t}),Object.values||(Object.values=function(e){return Object.keys(e).map(function(t){return e[t]})}),Array.prototype.find||i(Array.prototype,"find",function(e){for(var t=this.length,n=arguments[1],i=0;i<t;i++){var r=this[i];if(e.call(n,r,i,this))return r}}),Array.prototype.findIndex||i(Array.prototype,"findIndex",function(e){for(var t=this.length,n=arguments[1],i=0;i<t;i++){var r=this[i];if(e.call(n,r,i,this))return i}}),Array.prototype.includes||i(Array.prototype,"includes",function(e,t){return -1!=this.indexOf(e,t)}),Array.prototype.fill||i(Array.prototype,"fill",function(e){for(var t=this,n=t.length>>>0,i=arguments[1],r=0|i,o=r<0?Math.max(n+r,0):Math.min(r,n),s=arguments[2],a=void 0===s?n:0|s,l=a<0?Math.max(n+a,0):Math.min(a,n);o<l;)t[o]=e,o++;return t}),Array.of||i(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(e,t,n){"use strict";e("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(e,t,n){t.deepCopy=function e(t){if("object"!=typeof t||!t)return t;if(Array.isArray(t)){n=[];for(var n,i=0;i<t.length;i++)n[i]=e(t[i]);return n}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var i in n={},t)n[i]=e(t[i]);return n}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>=1)&&(e+=e);return n};var i=/^\s\s*/,r=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(i,"")},t.stringTrimRight=function(e){return e.replace(r,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){for(var t=[],n=0,i=e.length;n<i;n++)e[n]&&"object"==typeof e[n]?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=e("./deep_copy").deepCopy,t.arrayToMap=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},i=function(e){return i.cancel(),t=setTimeout(n,e||0),i};return i.schedule=i,i.call=function(){return this.cancel(),e(),i},i.cancel=function(){return clearTimeout(t),t=null,i},i.isPending=function(){return t},i},t.delayedCall=function(e,t){var n=null,i=function(){n=null,e()},r=function(e){null==n&&(n=setTimeout(i,e||t))};return r.delay=function(e){n&&clearTimeout(n),n=setTimeout(i,e||t)},r.schedule=r,r.call=function(){this.cancel(),e()},r.cancel=function(){n&&clearTimeout(n),n=null},r.isPending=function(){return n},r},t.supportsLookbehind=function(){try{RegExp("(?<=.)")}catch(e){return!1}return!0},t.skipEmptyMatch=function(e,t,n){return n&&e.codePointAt(t)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,t,n){"use strict";t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};var i="object"==typeof navigator?navigator:{},r=(/mac|win|linux/i.exec(i.platform)||["other"])[0].toLowerCase(),o=i.userAgent||"",s=i.appName||"";t.isWin="win"==r,t.isMac="mac"==r,t.isLinux="linux"==r,t.isIE="Microsoft Internet Explorer"==s||s.indexOf("MSAppHost")>=0?parseFloat((o.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((o.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=o.match(/ Gecko\/\d+/),t.isOpera="object"==typeof opera&&"[object Opera]"==Object.prototype.toString.call(window.opera),t.isWebKit=parseFloat(o.split("WebKit/")[1])||void 0,t.isChrome=parseFloat(o.split(" Chrome/")[1])||void 0,t.isSafari=parseFloat(o.split(" Safari/")[1])&&!t.isChrome||void 0,t.isEdge=parseFloat(o.split(" Edge/")[1])||void 0,t.isAIR=o.indexOf("AdobeAIR")>=0,t.isAndroid=o.indexOf("Android")>=0,t.isChromeOS=o.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(o)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIOS||t.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var i,r=e("./useragent"),o="http://www.w3.org/1999/xhtml";t.buildDom=function e(t,n,i){if("string"==typeof t&&t){var r=document.createTextNode(t);return n&&n.appendChild(r),r}if(!Array.isArray(t))return t&&t.appendChild&&n&&n.appendChild(t),t;if("string"!=typeof t[0]||!t[0]){for(var o=[],s=0;s<t.length;s++){var a=e(t[s],n,i);a&&o.push(a)}return o}var l=document.createElement(t[0]),c=t[1],u=1;c&&"object"==typeof c&&!Array.isArray(c)&&(u=2);for(var s=u;s<t.length;s++)e(t[s],l,i);return 2==u&&Object.keys(c).forEach(function(e){var t=c[e];"class"===e?l.className=Array.isArray(t)?t.join(" "):t:"function"==typeof t||"value"==e||"$"==e[0]?l[e]=t:"ref"===e?i&&(i[t]=l):"style"===e?"string"==typeof t&&(l.style.cssText=t):null!=t&&l.setAttribute(e,t)}),n&&n.appendChild(l),l},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||o,e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){return(t?t.ownerDocument:document).createTextNode(e)},t.createFragment=function(e){return(e?e.ownerDocument:document).createDocumentFragment()},t.hasCssClass=function(e,t){return -1!==(e.className+"").split(/\s+/g).indexOf(t)},t.addCssClass=function(e,n){t.hasCssClass(e,n)||(e.className+=" "+n)},t.removeCssClass=function(e,t){for(var n=e.className.split(/\s+/g);;){var i=n.indexOf(t);if(-1==i)break;n.splice(i,1)}e.className=n.join(" ")},t.toggleCssClass=function(e,t){for(var n=e.className.split(/\s+/g),i=!0;;){var r=n.indexOf(t);if(-1==r)break;i=!1,n.splice(r,1)}return i&&n.push(t),e.className=n.join(" "),i},t.setCssClass=function(e,n,i){i?t.addCssClass(e,n):t.removeCssClass(e,n)},t.hasCssString=function(e,t){var n,i=0;if(n=(t=t||document).querySelectorAll("style")){for(;i<n.length;)if(n[i++].id===e)return!0}},t.removeElementById=function(e,t){(t=t||document).getElementById(e)&&t.getElementById(e).remove()};var s=[];function a(){var e=s;s=null,e&&e.forEach(function(e){l(e[0],e[1])})}function l(e,n,r){if(!("u"<typeof document)){if(s){if(r)a();else if(!1===r)return s.push([e,n])}if(!i){var o=r;r&&r.getRootNode&&(o=r.getRootNode())&&o!=r||(o=document);var l=o.ownerDocument||o;if(n&&t.hasCssString(n,o))return null;n&&(e+="\n/*# sourceURL=ace/css/"+n+" */");var c=t.createElement("style");c.appendChild(l.createTextNode(e)),n&&(c.id=n),o==l&&(o=t.getDocumentHead(l)),o.insertBefore(c,o.firstChild)}}}if(t.useStrictCSP=function(e){i=e,!1==e?a():s||(s=[])},t.importCssString=l,t.importCssStylsheet=function(e,n){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(n))},t.scrollbarWidth=function(e){var n=t.createElement("ace_inner");n.style.width="100%",n.style.minWidth="0px",n.style.height="200px",n.style.display="block";var i=t.createElement("ace_outer"),r=i.style;r.position="absolute",r.left="-10000px",r.overflow="hidden",r.width="200px",r.minWidth="0px",r.height="150px",r.display="block",i.appendChild(n);var o=e&&e.documentElement||document&&document.documentElement;if(!o)return 0;o.appendChild(i);var s=n.offsetWidth;r.overflow="scroll";var a=n.offsetWidth;return s===a&&(a=i.clientWidth),o.removeChild(i),s-a},t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,n){e[t]!==n&&(e[t]=n)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=!r.isWin||"u">typeof window&&window.devicePixelRatio>=1.5,r.isChromeOS&&(t.HI_DPI=!1),"u">typeof document){var c=document.createElement("div");t.HI_DPI&&void 0!==c.style.transform&&(t.HAS_CSS_TRANSFORMS=!0),r.isEdge||void 0===c.style.animationName||(t.HAS_CSS_ANIMATION=!0),c=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){4===n.readyState&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=i.getDocumentHead(),r=document.createElement("script");r.src=e,n.appendChild(r),r.onload=r.onreadystatechange=function(e,n){(n||!r.readyState||"loaded"==r.readyState||"complete"==r.readyState)&&(r=r.onload=r.onreadystatechange=null,n||t())}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var i={},r=function(){this.propagationStopped=!0},o=function(){this.defaultPrevented=!0};i._emit=i._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],i=this._defaultHandlers[e];if(n.length||i){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=r),t.preventDefault||(t.preventDefault=o),n=n.slice();for(var s=0;s<n.length&&(n[s](t,this),!t.propagationStopped);s++);if(i&&!t.defaultPrevented)return i(t,this)}},i._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(n){n=n.slice();for(var i=0;i<n.length;i++)n[i](t,this)}},i.once=function(e,t){var n=this;if(this.on(e,function i(){n.off(e,i),t.apply(null,arguments)}),!t)return new Promise(function(e){t=e})},i.setDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n||(n=this._defaultHandlers={_disabled_:{}}),n[e]){var i=n[e],r=n._disabled_[e];r||(n._disabled_[e]=r=[]),r.push(i);var o=r.indexOf(t);-1!=o&&r.splice(o,1)}n[e]=t},i.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n){var i=n._disabled_[e];if(n[e]==t)i&&this.setDefaultHandler(e,i.pop());else if(i){var r=i.indexOf(t);-1!=r&&i.splice(r,1)}}},i.on=i.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var i=this._eventRegistry[e];return i||(i=this._eventRegistry[e]=[]),-1==i.indexOf(t)&&i[n?"unshift":"push"](t),t},i.off=i.removeListener=i.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}},i.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},t.EventEmitter=i}),ace.define("ace/lib/report_error",["require","exports","module"],function(e,t,n){t.reportError=function(e,t){var n=Error(e);n.data=t,"object"==typeof console&&console.error&&console.error(n),setTimeout(function(){throw n})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(e,t,n){t.defaultEnglishMessages={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions"}}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(e,t,n){var i,r,o=e("./oop"),s=e("./event_emitter").EventEmitter,a=e("./report_error").reportError,l=e("./default_english_messages").defaultEnglishMessages,c={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};if(e)Array.isArray(e)||(e=Object.keys(t=e));else{var n=this.$options;e=Object.keys(n).filter(function(e){return!n[e].hidden})}return e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]!==t){var n=this.$options[e];if(!n)return u('misspelled option "'+e+'"');if(n.forwardTo)return this[n.forwardTo]&&this[n.forwardTo].setOption(e,t);n.handlesSet||(this["$"+e]=t),n&&n.set&&n.set.call(this,t)}},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:u('misspelled option "'+e+'"')}};function u(e){"u">typeof console&&console.warn&&console.warn.apply(console,arguments)}var d=function(){function e(){this.$defaultOptions={},i=l,r="dollarSigns"}return e.prototype.defineOptions=function(e,t,n){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(n).forEach(function(t){var i=n[t];"string"==typeof i&&(i={forwardTo:i}),i.name||(i.name=t),e.$options[i.name]=i,"initialValue"in i&&(e["$"+i.name]=i.initialValue)}),o.implement(e,c),this},e.prototype.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var n=e.$options[t];"value"in n&&e.setOption(t,n.value)})},e.prototype.setDefaultValue=function(e,t,n){if(!e){for(e in this.$defaultOptions)if(this.$defaultOptions[e][t])break;if(!this.$defaultOptions[e][t])return!1}var i=this.$defaultOptions[e]||(this.$defaultOptions[e]={});i[t]&&(i.forwardTo?this.setDefaultValue(i.forwardTo,t,n):i[t].value=n)},e.prototype.setDefaultValues=function(e,t){Object.keys(t).forEach(function(n){this.setDefaultValue(e,n,t[n])},this)},e.prototype.setMessages=function(e,t){i=e,t&&t.placeholders&&(r=t.placeholders)},e.prototype.nls=function(e,t,n){!i[e]&&(u("No message found for the key '"+e+"' in the provided messages, trying to find a translation for the default string '"+t+"'."),i[t]||u("No message found for the default string '"+t+"' in the provided messages. Falling back to the default English message."));var o=i[e]||i[t]||t;return n&&("dollarSigns"===r&&(o=o.replace(/\$(\$|[\d]+)/g,function(e,t){return"$"==t?"$":n[t]})),"curlyBrackets"===r&&(o=o.replace(/\{([^\}]+)\}/g,function(e,t){return n[t]}))),o},e}();d.prototype.warn=u,d.prototype.reportError=a,o.implement(d.prototype,s),t.AppConfig=d}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(e,t,n){n.exports='.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print-margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm {\n background-color: #FFFFFF;\n color: black;\n}\n\n.ace-tm .ace_cursor {\n color: black;\n}\n \n.ace-tm .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText=e("./textmate-css"),t.$id="ace/theme/textmate",e("../lib/dom").importCssString(t.cssText,t.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(e,t,n){var i,r=e("./lib/lang"),o=e("./lib/net"),s=e("./lib/dom");n.exports=t=new(e("./lib/app_config")).AppConfig;var a={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};t.get=function(e){if(!a.hasOwnProperty(e))throw Error("Unknown config key: "+e);return a[e]},t.set=function(e,t){if(a.hasOwnProperty(e))a[e]=t;else if(!1==this.setDefaultValue("",e,t))throw Error("Unknown config key: "+e);"useStrictCSP"==e&&s.useStrictCSP(t)},t.all=function(){return r.copyObject(a)},t.$modes={},t.moduleUrl=function(e,t){if(a.$moduleUrls[e])return a.$moduleUrls[e];var n=e.split("/"),i="snippets"==(t=t||n[n.length-2]||"")?"/":"-",r=n[n.length-1];if("worker"==t&&"-"==i){var o=RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");r=r.replace(o,"")}(!r||r==t)&&n.length>1&&(r=n[n.length-2]);var s=a[t+"Path"];return null==s?s=a.basePath:"/"==i&&(t=i=""),s&&"/"!=s.slice(-1)&&(s+="/"),s+t+i+r+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t};var l=function(t,n){return"ace/theme/textmate"===t||"./theme/textmate"===t?n(null,e("./theme/textmate")):i?i(t,n):void console.error("loader is not configured")};t.setLoader=function(e){i=e},t.dynamicModules=Object.create(null),t.$loading={},t.$loaded={},t.loadModule=function(e,n){if(Array.isArray(e))var i,r=e[0],s=e[1];else if("string"==typeof e)var s=e;var a=function(e){if(e&&!t.$loading[s])return n&&n(e);if(t.$loading[s]||(t.$loading[s]=[]),t.$loading[s].push(n),!(t.$loading[s].length>1)){var i=function(){l(s,function(e,n){n&&(t.$loaded[s]=n),t._emit("load.module",{name:s,module:n});var i=t.$loading[s];t.$loading[s]=null,i.forEach(function(e){e&&e(n)})})};if(!t.get("packaged"))return i();o.loadScript(t.moduleUrl(s,r),i),c()}};if(t.dynamicModules[s])t.dynamicModules[s]().then(function(e){e.default?a(e.default):a(e)});else{try{i=this.$require(s)}catch(e){}a(i||t.$loaded[s])}},t.$require=function(e){if("function"==typeof n.require)return n.require(e)},t.setModuleLoader=function(e,n){t.dynamicModules[e]=n};var c=function(){a.basePath||a.workerPath||a.modePath||a.themePath||Object.keys(a.$moduleUrls).length||(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),c=function(){})};t.version="1.36.3"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var i=e("./config");i.setLoader(function(t,n){e([t],function(e){n(null,e)})});var r=function(){return this||"u">typeof window&&window}();function o(t){if(r&&r.document){i.set("packaged",t||e.packaged||n.packaged||r.define&&define.packaged);var o={},a="",l=document.currentScript||document._currentScript,c=l&&l.ownerDocument||document;l&&l.src&&(a=l.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var u=c.getElementsByTagName("script"),d=0;d<u.length;d++){var h=u[d],p=h.src||h.getAttribute("src");if(p){for(var f=h.attributes,g=0,m=f.length;g<m;g++){var v=f[g];0===v.name.indexOf("data-ace-")&&(o[s(v.name.replace(/^data-ace-/,""))]=v.value)}var b=p.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);b&&(a=b[1])}}for(var y in a&&(o.base=o.base||a,o.packaged=!0),o.basePath=o.base,o.workerPath=o.workerPath||o.base,o.modePath=o.modePath||o.base,o.themePath=o.themePath||o.base,delete o.base,o)void 0!==o[y]&&i.set(y,o[y])}}function s(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}n.exports=function(t){i.init=o,i.$require=e,t.require=e,"function"==typeof define&&(t.define=define)},o(!0)}),ace.define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var i=function(){function e(e,t,n,i){this.start={row:e,column:t},this.end={row:n,column:i}}return e.prototype.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},e.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},e.prototype.contains=function(e,t){return 0==this.compare(e,t)},e.prototype.compareRange=function(e){var t,n=e.end,i=e.start;return 1==(t=this.compare(n.row,n.column))?1==(t=this.compare(i.row,i.column))?2:+(0==t):-1==t?-2:-1==(t=this.compare(i.row,i.column))?-1:42*(1==t)},e.prototype.comparePoint=function(e){return this.compare(e.row,e.column)},e.prototype.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},e.prototype.intersects=function(e){var t=this.compareRange(e);return -1==t||0==t||1==t},e.prototype.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},e.prototype.isStart=function(e,t){return this.start.row==e&&this.start.column==t},e.prototype.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},e.prototype.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},e.prototype.inside=function(e,t){if(0==this.compare(e,t)&&!(this.isEnd(e,t)||this.isStart(e,t)))return!0;return!1},e.prototype.insideStart=function(e,t){if(0==this.compare(e,t)&&!this.isEnd(e,t))return!0;return!1},e.prototype.insideEnd=function(e,t){if(0==this.compare(e,t)&&!this.isStart(e,t))return!0;return!1},e.prototype.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:+(t>this.end.column)},e.prototype.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},e.prototype.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},e.prototype.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},e.prototype.clipRows=function(t,n){if(this.end.row>n)var i={row:n+1,column:0};else if(this.end.row<t)var i={row:t,column:0};if(this.start.row>n)var r={row:n+1,column:0};else if(this.start.row<t)var r={row:t,column:0};return e.fromPoints(r||this.start,i||this.end)},e.prototype.extend=function(t,n){var i=this.compare(t,n);if(0==i)return this;if(-1==i)var r={row:t,column:n};else var o={row:t,column:n};return e.fromPoints(r||this.start,o||this.end)},e.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},e.prototype.isMultiLine=function(){return this.start.row!==this.end.row},e.prototype.clone=function(){return e.fromPoints(this.start,this.end)},e.prototype.collapseRows=function(){return 0==this.end.column?new e(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new e(this.start.row,0,this.end.row,0)},e.prototype.toScreenRange=function(t){var n=t.documentToScreenPosition(this.start),i=t.documentToScreenPosition(this.end);return new e(n.row,n.column,i.row,i.column)},e.prototype.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t},e}();i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,t,n){"use strict";for(var i=e("./oop"),r={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},o={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},s=0;s<10;s++)o["Digit"+s]=48+s,o["Numpad"+s]=96+s,r.PRINTABLE_KEYS[48+s]=""+s,r.FUNCTION_KEYS[96+s]="Numpad"+s;for(var s=65;s<91;s++){var a=String.fromCharCode(s+32);o["Key"+a.toUpperCase()]=s,r.PRINTABLE_KEYS[s]=a}for(var s=1;s<13;s++)o["F"+s]=111+s,r.FUNCTION_KEYS[111+s]="F"+s;var l={Shift:16,Control:17,Alt:18,Meta:224};for(var c in l)o[c]=o[c+"Left"]=o[c+"Right"]=l[c];for(var u in t.$codeToKeyCode=o,r.PRINTABLE_KEYS[173]="-",r.FUNCTION_KEYS){var d=r.FUNCTION_KEYS[u].toLowerCase();r[d]=parseInt(u,10)}for(var u in r.PRINTABLE_KEYS){var d=r.PRINTABLE_KEYS[u].toLowerCase();r[d]=parseInt(u,10)}i.mixin(r,r.MODIFIER_KEYS),i.mixin(r,r.PRINTABLE_KEYS),i.mixin(r,r.FUNCTION_KEYS),r.enter=r.return,r.escape=r.esc,r.del=r.delete,function(){for(var e=["cmd","ctrl","alt","shift"],t=Math.pow(2,e.length);t--;)r.KEY_MODS[t]=e.filter(function(e){return t&r.KEY_MODS[e]}).join("-")+"-"}(),r.KEY_MODS[0]="",r.KEY_MODS[-1]="input-",i.mixin(t,r),t.default=t,t.keyCodeToString=function(e){var t=r[e];return"string"!=typeof t&&(t=String.fromCharCode(e)),t.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";var i,r=e("./keys"),o=e("./useragent"),s=null,a=0;function l(){i=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return i={passive:!1},!0}})}catch(e){}}function c(){return void 0==i&&l(),i}function u(e,t,n){this.elem=e,this.type=t,this.callback=n}u.prototype.destroy=function(){h(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var d=t.addListener=function(e,t,n,i){e.addEventListener(t,n,c()),i&&i.$toDestroy.push(new u(e,t,n))},h=t.removeListener=function(e,t,n){e.removeEventListener(t,n,c())};function p(e){return!!e.ctrlKey|2*!!e.altKey|4*!!e.shiftKey|8*!!e.metaKey}function f(e,t,n){var i=p(t);if(!n&&t.code&&(n=r.$codeToKeyCode[t.code]||n),!o.isMac&&s){if(t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(i|=8),s.altGr)if((3&i)==3)return;else s.altGr=0;if(18===n||17===n){var l=t.location;17===n&&1===l?1==s[n]&&(a=t.timeStamp):18===n&&3===i&&2===l&&t.timeStamp-a<50&&(s.altGr=!0)}}if(n in r.MODIFIER_KEYS&&(n=-1),i||13!==n||3!==t.location||(e(t,i,-n),!t.defaultPrevented)){if(o.isChromeOS&&8&i){if(e(t,i,n),t.defaultPrevented)return;i&=-9}return(!!i||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS)&&e(t,i,n)}}function g(){s=Object.create(null)}if(t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},t.preventDefault=function(e){e.preventDefault&&e.preventDefault()},t.getButton=function(e){return"dblclick"==e.type?0:"contextmenu"==e.type||o.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},t.capture=function(e,t,n){var i=e&&e.ownerDocument||document;function r(e){t&&t(e),n&&n(e),h(i,"mousemove",t),h(i,"mouseup",r),h(i,"dragstart",r)}return d(i,"mousemove",t),d(i,"mouseup",r),d(i,"dragstart",r),r},t.addMouseWheelListener=function(e,t,n){d(e,"wheel",function(e){var n=.15,i=e.deltaX||0,r=e.deltaY||0;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=i*n,e.wheelY=r*n;break;case e.DOM_DELTA_LINE:var o=15;e.wheelX=15*i,e.wheelY=r*o;break;case e.DOM_DELTA_PAGE:var s=150;e.wheelX=150*i,e.wheelY=r*s}t(e)},n)},t.addMultiMouseDownListener=function(e,n,i,r,s){var a,l,c,u=0,h={2:"dblclick",3:"tripleclick",4:"quadclick"};function p(e){if(0!==t.getButton(e)?u=0:e.detail>1?++u>4&&(u=1):u=1,o.isIE){var s=Math.abs(e.clientX-a)>5||Math.abs(e.clientY-l)>5;(!c||s)&&(u=1),c&&clearTimeout(c),c=setTimeout(function(){c=null},n[u-1]||600),1==u&&(a=e.clientX,l=e.clientY)}if(e._clicks=u,i[r]("mousedown",e),u>4)u=0;else if(u>1)return i[r](h[u],e)}Array.isArray(e)||(e=[e]),e.forEach(function(e){d(e,"mousedown",p,s)})},t.getModifierString=function(e){return r.KEY_MODS[p(e)]},t.addCommandKeyListener=function(e,n,i){var r=null;d(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=f(n,e,e.keyCode);return r=e.defaultPrevented,t},i),d(e,"keypress",function(e){r&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),r=null)},i),d(e,"keyup",function(e){s[e.keyCode]=null},i),s||(g(),d(window,"focus",g))},"object"==typeof window&&window.postMessage&&!o.isOldIE){var m=1;t.nextTick=function(e,n){n=n||window;var i="zero-timeout-message-"+m++,r=function(o){o.data==i&&(t.stopPropagation(o),h(n,"message",r),e())};d(n,"message",r),n.postMessage(i,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function n(){t.$idleBlocked?setTimeout(n,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame="object"==typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(e,t,n){"use strict";var i;n.exports={lineMode:!1,pasteCancelled:function(){return!!(i&&i>Date.now()-50)||(i=!1)},cancel:function(){i=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../config").nls,o=e("../lib/useragent"),s=e("../lib/dom"),a=e("../lib/lang"),l=e("../clipboard"),c=o.isChrome<18,u=o.isIE,d=o.isChrome>63,h=400,p=e("../lib/keys"),f=p.KEY_MODS,g=o.isIOS,m=g?/\s/:/\n/,v=o.isMobile;t.TextInput=function(e,t){var n,b=s.createElement("textarea");b.className="ace_text-input",b.setAttribute("wrap","off"),b.setAttribute("autocorrect","off"),b.setAttribute("autocapitalize","off"),b.setAttribute("spellcheck","false"),b.style.opacity="0",e.insertBefore(b,e.firstChild);var y=!1,w=!1,x=!1,$=!1,_="";v||(b.style.fontSize="1px");var S=!1,M=!1,C="",E=0,k=0,A=0,T=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,O=0;try{var R=document.activeElement===b}catch(e){}this.setNumberOfExtraLines=function(e){if(T=Number.MAX_SAFE_INTEGER,L=Number.MIN_SAFE_INTEGER,e<0){O=0;return}O=e},this.setAriaOptions=function(e){if(e.activeDescendant?(b.setAttribute("aria-haspopup","true"),b.setAttribute("aria-autocomplete",e.inline?"both":"list"),b.setAttribute("aria-activedescendant",e.activeDescendant)):(b.setAttribute("aria-haspopup","false"),b.setAttribute("aria-autocomplete","both"),b.removeAttribute("aria-activedescendant")),e.role&&b.setAttribute("role",e.role),e.setLabel){b.setAttribute("aria-roledescription",r("text-input.aria-roledescription","editor"));var n="";t.$textInputAriaLabel&&(n+="".concat(t.$textInputAriaLabel,", ")),t.session&&(n+=r("text-input.aria-label","Cursor at row $0",[t.session.selection.cursor.row+1])),b.setAttribute("aria-label",n)}},this.setAriaOptions({role:"textbox"}),i.addListener(b,"blur",function(e){M||(t.onBlur(e),R=!1)},t),i.addListener(b,"focus",function(e){if(!M){if(R=!0,o.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),o.isEdge?setTimeout(I):I()}},t),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:t.renderer.enableKeyboardAccessibility}),_||d||"browser"==this.$focusScroll)return b.focus({preventScroll:!0});var e=b.style.top;b.style.position="fixed",b.style.top="0px";try{var n=0!=b.getBoundingClientRect().top}catch(e){return}var i=[];if(n)for(var r=b.parentElement;r&&1==r.nodeType;)i.push(r),r.setAttribute("ace_nocontext","true"),r=!r.parentElement&&r.getRootNode?r.getRootNode().host:r.parentElement;b.focus({preventScroll:!0}),n&&i.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){b.style.position="","0px"==b.style.top&&(b.style.top=e)},0)},this.blur=function(){b.blur()},this.isFocused=function(){return R},t.on("beforeEndOperation",function(){var e=t.curOp,n=e&&e.command&&e.command.name;if("insertstring"!=n){var i=n&&(e.docChanged||e.selectionChanged);x&&i&&(C=b.value="",Y()),I()}});var D=function(e,n){for(var i=n,r=1;r<=e-T&&r<2*O+1;r++)i+=t.session.getLine(e-r).length+1;return i},I=g?function(e){if(R&&(!y||e)&&!$){e||(e="");var n="\n ab"+e+"cde fg\n";n!=b.value&&(b.value=C=n);var i=4,r=4+(e.length||+!t.selection.isEmpty());(E!=i||k!=r)&&b.setSelectionRange(i,r),E=i,k=r}}:function(){if(!x&&!$&&(R||F)){x=!0;var e=0,n=0,i="";if(t.session){var r=t.selection,o=r.getRange(),s=r.cursor.row;s===L+1?L=(T=L+1)+2*O:s===T-1?T=(L=T-1)-2*O:(s<T-1||s>L+1)&&(T=s>O?s-O:0,L=s>O?s+O:2*O);for(var a=[],l=T;l<=L;l++)a.push(t.session.getLine(l));if(i=a.join("\n"),e=D(o.start.row,o.start.column),n=D(o.end.row,o.end.column),o.start.row<T){var c=t.session.getLine(T-1);e=o.start.row<T-1?0:e,n+=c.length+1,i=c+"\n"+i}else if(o.end.row>L){var u=t.session.getLine(L+1);n=(o.end.row>L+1?u.length:o.end.column)+(i.length+1),i=i+"\n"+u}else v&&s>0&&(i="\n"+i,n+=1,e+=1);i.length>h&&(e<h&&n<h?i=i.slice(0,h):(i="\n",e==n?e=n=0:(e=0,n=1)));var d=i+"\n\n";d!=C&&(b.value=C=d,E=k=d.length)}if(F&&(E=b.selectionStart,k=b.selectionEnd),k!=n||E!=e||b.selectionEnd!=k)try{b.setSelectionRange(e,n),E=e,k=n}catch(e){}x=!1}};this.resetSelection=I,R&&t.onFocus();var j=function(e){return 0===e.selectionStart&&e.selectionEnd>=C.length&&e.value===C&&C&&e.selectionEnd!==k},N=function(e){!x&&(y?y=!1:j(b)?(t.selectAll(),I()):v&&b.selectionStart!=E&&I())},P=null;this.setInputHandler=function(e){P=e},this.getInputHandler=function(){return P};var F=!1,U=function(e,n){if(F&&(F=!1),w)return I(),e&&t.onPaste(e),w=!1,"";for(var i=b.selectionStart,r=b.selectionEnd,s=E,a=C.length-k,l=e,c=e.length-i,u=e.length-r,d=0;s>0&&C[d]==e[d];)d++,s--;for(l=l.slice(d),d=1;a>0&&C.length-d>E-1&&C[C.length-d]==e[e.length-d];)d++,a--;c-=d-1,u-=d-1;var h=l.length-d+1;if(h<0&&(s=-h,h=0),l=l.slice(0,h),!n&&!l&&!c&&!s&&!a&&!u)return"";$=!0;var p=!1;return o.isAndroid&&". "==l&&(l=" ",p=!0),(!l||s||a||c||u)&&!S?t.onTextInput(l,{extendLeft:s,extendRight:a,restoreStart:c,restoreEnd:u}):t.onTextInput(l),$=!1,C=e,E=i,k=r,A=u,p?"\n":l},V=function(e){if(x)return K();if(e&&e.inputType){if("historyUndo"==e.inputType)return t.execCommand("undo");if("historyRedo"==e.inputType)return t.execCommand("redo")}var n=b.value,i=U(n,!0);(n.length>h+100||m.test(i)||v&&E<1&&E==k)&&I()},z=function(e,t,n){var i=e.clipboardData||window.clipboardData;if(i&&!c){var r=u||n?"Text":"text/plain";try{if(t)return!1!==i.setData(r,t);return i.getData(r)}catch(e){if(!n)return z(e,t,!0)}}},H=function(e,n){var r=t.getCopyText();if(!r)return i.preventDefault(e);z(e,r)?(g&&(I(r),y=r,setTimeout(function(){y=!1},10)),n?t.onCut():t.onCopy(),i.preventDefault(e)):(y=!0,b.value=r,b.select(),setTimeout(function(){y=!1,I(),n?t.onCut():t.onCopy()}))},W=function(e){H(e,!0)},B=function(e){H(e,!1)},q=function(e){var n=z(e);l.pasteCancelled()||("string"==typeof n?(n&&t.onPaste(n,e),o.isIE&&setTimeout(I),i.preventDefault(e)):(b.value="",w=!0))};i.addCommandKeyListener(b,function(e,n,i){if(!x)return t.onCommandKey(e,n,i)},t),i.addListener(b,"select",N,t),i.addListener(b,"input",V,t),i.addListener(b,"cut",W,t),i.addListener(b,"copy",B,t),i.addListener(b,"paste",q,t),"oncut"in b&&"oncopy"in b&&"onpaste"in b||i.addListener(e,"keydown",function(e){if((!o.isMac||e.metaKey)&&e.ctrlKey)switch(e.keyCode){case 67:B(e);break;case 86:q(e);break;case 88:W(e)}},t);var G=function(e){if(!x&&t.onCompositionStart&&!t.$readOnly&&(x={},!S)){e.data&&(x.useTextareaForIME=!1),setTimeout(K,0),t._signal("compositionStart"),t.on("mousedown",Q);var n=t.getSelectionRange();n.end.row=n.start.row,n.end.column=n.start.column,x.markerRange=n,x.selectionStart=E,t.onCompositionStart(x),x.useTextareaForIME?(C=b.value="",E=0,k=0):(b.msGetInputContext&&(x.context=b.msGetInputContext()),b.getInputContext&&(x.context=b.getInputContext()))}},K=function(){if(x&&t.onCompositionUpdate&&!t.$readOnly){if(S)return Q();x.useTextareaForIME?t.onCompositionUpdate(b.value):(U(b.value),x.markerRange&&(x.context&&(x.markerRange.start.column=x.selectionStart=x.context.compositionStartOffset),x.markerRange.end.column=x.markerRange.start.column+k-x.selectionStart+A))}},Y=function(e){t.onCompositionEnd&&!t.$readOnly&&(x=!1,t.onCompositionEnd(),t.off("mousedown",Q),e&&V())};function Q(){M=!0,b.blur(),b.focus(),M=!1}var Z=a.delayedCall(K,50).schedule.bind(null,null);function J(e){27==e.keyCode&&b.value.length<b.selectionStart&&(x||(C=b.value),E=k=-1,I()),Z()}function X(){clearTimeout(n),n=setTimeout(function(){_&&(b.style.cssText=_,_=""),t.renderer.$isMousePressed=!1,t.renderer.$keepTextAreaAtCursor&&t.renderer.$moveTextAreaToCursor()},0)}i.addListener(b,"compositionstart",G,t),i.addListener(b,"compositionupdate",K,t),i.addListener(b,"keyup",J,t),i.addListener(b,"keydown",Z,t),i.addListener(b,"compositionend",Y,t),this.getElement=function(){return b},this.setCommandMode=function(e){S=e,b.readOnly=!1},this.setReadOnly=function(e){S||(b.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){F=!0,I(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,r){_||(_=b.style.cssText),b.style.cssText=(r?"z-index:100000;":"")+(o.isIE?"opacity:0.1;":"")+"text-indent: -"+(E+k)*t.renderer.characterWidth*.5+"px;";var a=t.container.getBoundingClientRect(),l=s.computedStyle(t.container),c=a.top+(parseInt(l.borderTopWidth)||0),u=a.left+(parseInt(a.borderLeftWidth)||0),d=a.bottom-c-b.clientHeight-2,h=function(e){s.translate(b,e.clientX-u-2,Math.min(e.clientY-c-2,d))};h(e),"mousedown"==e.type&&(t.renderer.$isMousePressed=!0,clearTimeout(n),o.isWin&&i.capture(t.container,h,X))},this.onContextMenuClose=X;var ee=function(e){t.textInput.onContextMenu(e),X()};function et(e,t,n){var i=null,r=!1;n.addEventListener("keydown",function(e){i&&clearTimeout(i),r=!0},!0),n.addEventListener("keyup",function(e){i=setTimeout(function(){r=!1},100)},!0);var o=function(e){if(document.activeElement===n&&!r&&!x&&!t.$mouseHandler.isMousePressed&&!y){var i=n.selectionStart,o=n.selectionEnd,s=null,a=0;if(0==i?s=p.up:1==i?s=p.home:o>k&&"\n"==C[o]?s=p.end:i<E&&" "==C[i-1]?(s=p.left,a=f.option):i<E||i==E&&k!=E&&i==o?s=p.left:o>k&&C.slice(0,o).split("\n").length>2?s=p.down:o>k&&" "==C[o-1]?(s=p.right,a=f.option):(o>k||o==k&&k!=E&&i==o)&&(s=p.right),i!==o&&(a|=f.shift),s){if(!t.onCommandKey({},a,s)&&t.commands){s=p.keyCodeToString(s);var l=t.commands.findKeyCommand(a,s);l&&t.execCommand(l)}E=i,k=o,I("")}}};document.addEventListener("selectionchange",o),t.on("destroy",function(){document.removeEventListener("selectionchange",o)})}i.addListener(b,"mouseup",ee,t),i.addListener(b,"mousedown",function(e){e.preventDefault(),X()},t),i.addListener(t.renderer.scroller,"contextmenu",ee,t),i.addListener(b,"contextmenu",ee,t),g&&et(e,t,b),this.destroy=function(){b.parentElement&&b.parentElement.removeChild(b)}},t.$setUserAgentForTests=function(e,t){v=e,g=t}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/useragent"),r=0,o=550,s=function(){function e(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"].forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}return e.prototype.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,o=e.getButton();if(0!==o){(r.getSelectionRange().isEmpty()||1==o)&&r.selection.moveToPosition(n),2==o&&(r.textInput.onContextMenu(e.domEvent),i.isMozilla||e.preventDefault());return}if(this.mousedownEvent.time=Date.now(),t&&!r.isFocused()&&(r.focus(),this.$focusTimeout&&!this.$clickSelection&&!r.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(e);return}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},e.prototype.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.setStyle("ace_selecting"),this.setState("select"))},e.prototype.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var i=this.$clickSelection.comparePoint(n);if(-1==i)e=this.$clickSelection.end;else if(1==i)e=this.$clickSelection.start;else{var r=l(this.$clickSelection,n);n=r.cursor,e=r.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},e.prototype.extendSelectionBy=function(e){var t,n=this.editor,i=n.renderer.screenToTextCoordinates(this.x,this.y),r=n.selection[e](i.row,i.column);if(this.$clickSelection){var o=this.$clickSelection.comparePoint(r.start),s=this.$clickSelection.comparePoint(r.end);if(-1==o&&s<=0)t=this.$clickSelection.end,(r.end.row!=i.row||r.end.column!=i.column)&&(i=r.start);else if(1==s&&o>=0)t=this.$clickSelection.start,(r.start.row!=i.row||r.start.column!=i.column)&&(i=r.end);else if(-1==o&&1==s)i=r.end,t=r.start;else{var a=l(this.$clickSelection,i);i=a.cursor,t=a.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(i),n.renderer.scrollCursorIntoView()},e.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},e.prototype.focusWait=function(){var e=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>r||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},e.prototype.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,i=n.session.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},e.prototype.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var i=n.getSelectionRange();i.isMultiLine()&&i.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(i.start.row),this.$clickSelection.end=n.selection.getLineRange(i.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},e.prototype.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},e.prototype.onMouseWheel=function(e){if(!e.getAccelKey()){e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,i=e.domEvent.timeStamp,r=i-n.t,s=r?e.wheelX/r:n.vx,a=r?e.wheelY/r:n.vy;r<o&&(s=(s+n.vx)/2,a=(a+n.vy)/2);var l=Math.abs(s/a),c=!1;if(l>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(c=!0),l<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(c=!0),c?n.allowed=i:i-n.allowed<o&&(Math.abs(s)<=1.5*Math.abs(n.vx)&&Math.abs(a)<=1.5*Math.abs(n.vy)?(c=!0,n.allowed=i):n.allowed=0),n.t=i,n.vx=s,n.vy=a,c)return t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}},e}();function a(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}function l(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row!=e.end.row-1||e.start.column||e.end.column)var n=2*t.row-e.start.row-e.end.row;else var n=t.column-4;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}s.prototype.selectEnd=s.prototype.selectByLinesEnd,s.prototype.selectAllEnd=s.prototype.selectByLinesEnd,s.prototype.selectByWordsEnd=s.prototype.selectByLinesEnd,t.DefaultHandlers=s}),ace.define("ace/lib/scroll",["require","exports","module"],function(e,t,n){t.preventParentScroll=function(e){e.stopPropagation();var t=e.currentTarget;t.scrollHeight>t.clientHeight||e.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=e("./lib/dom");e("./lib/event");var s=e("./range").Range,a=e("./lib/scroll").preventParentScroll,l="ace_tooltip",c=function(){function e(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}return e.prototype.$init=function(){return this.$element=o.createElement("div"),this.$element.className=l,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},e.prototype.getElement=function(){return this.$element||this.$init()},e.prototype.setText=function(e){this.getElement().textContent=e},e.prototype.setHtml=function(e){this.getElement().innerHTML=e},e.prototype.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},e.prototype.setClassName=function(e){o.addCssClass(this.getElement(),e)},e.prototype.setTheme=function(e){this.$element.className=l+" "+(e.isDark?"ace_dark ":"")+(e.cssClass||"")},e.prototype.show=function(e,t,n){null!=e&&this.setText(e),null!=t&&null!=n&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},e.prototype.hide=function(e){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=l,this.isOpen=!1)},e.prototype.getHeight=function(){return this.getElement().offsetHeight},e.prototype.getWidth=function(){return this.getElement().offsetWidth},e.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},e}(),u=new(function(){function e(){this.popups=[]}return e.prototype.addPopup=function(e){this.popups.push(e),this.updatePopups()},e.prototype.removePopup=function(e){var t=this.popups.indexOf(e);-1!==t&&(this.popups.splice(t,1),this.updatePopups())},e.prototype.updatePopups=function(){this.popups.sort(function(e,t){return t.priority-e.priority});var e,t,n,i,o=[];try{for(var s=r(this.popups),a=s.next();!a.done;a=s.next()){var l=a.value,c=!0;try{for(var u=(n=void 0,r(o)),d=u.next();!d.done;d=u.next()){var h=d.value;if(this.doPopupsOverlap(h,l)){c=!1;break}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}c?o.push(l):l.hide()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}},e.prototype.doPopupsOverlap=function(e,t){var n=e.getElement().getBoundingClientRect(),i=t.getElement().getBoundingClientRect();return n.left<i.right&&n.right>i.left&&n.top<i.bottom&&n.bottom>i.top},e}());t.popupManager=u,t.Tooltip=c,t.HoverTooltip=function(e){function t(t){void 0===t&&(t=document.body);var n=e.call(this,t)||this;n.timeout=void 0,n.lastT=0,n.idleTime=350,n.lastEvent=void 0,n.onMouseOut=n.onMouseOut.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.waitForHover=n.waitForHover.bind(n),n.hide=n.hide.bind(n);var i=n.getElement();return i.style.whiteSpace="pre-wrap",i.style.pointerEvents="auto",i.addEventListener("mouseout",n.onMouseOut),i.tabIndex=-1,i.addEventListener("blur",(function(){i.contains(document.activeElement)||this.hide()}).bind(n)),i.addEventListener("wheel",a),n}return i(t,e),t.prototype.addToEditor=function(e){e.on("mousemove",this.onMouseMove),e.on("mousedown",this.hide),e.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},t.prototype.removeFromEditor=function(e){e.off("mousemove",this.onMouseMove),e.off("mousedown",this.hide),e.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},t.prototype.onMouseMove=function(e,t){this.lastEvent=e,this.lastT=Date.now();var n=t.$mouseHandler.isMousePressed;if(this.isOpen){var i=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(i.row,i.column)||n||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||n||(this.lastEvent=e,this.timeout=setTimeout(this.waitForHover,this.idleTime))},t.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var e=Date.now()-this.lastT;if(this.idleTime-e>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-e);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},t.prototype.isOutsideOfText=function(e){var t=e.editor,n=e.getDocumentPosition(),i=t.session.getLine(n.row);if(n.column==i.length){var r=t.renderer.pixelToScreenCoordinates(e.clientX,e.clientY),o=t.session.documentToScreenPosition(n.row,n.column);if(o.column!=r.column||o.row!=r.row)return!0}return!1},t.prototype.setDataProvider=function(e){this.$gatherData=e},t.prototype.showForRange=function(e,t,n,i){var r=10;if((!i||i==this.lastEvent)&&(!this.isOpen||document.activeElement!=this.getElement())){var o=e.renderer;this.isOpen||(u.addPopup(this),this.$registerCloseEvents(),this.setTheme(o.theme)),this.isOpen=!0,this.addMarker(t,e.session),this.range=s.fromPoints(t.start,t.end);var a=o.textToScreenCoordinates(t.start.row,t.start.column),l=o.scroller.getBoundingClientRect();a.pageX<l.left&&(a.pageX=l.left);var c=this.getElement();c.innerHTML="",c.appendChild(n),c.style.maxHeight="",c.style.display="block";var d=c.clientHeight,h=c.clientWidth,p=window.innerHeight-a.pageY-o.lineHeight,f=!0;a.pageY-d<0&&a.pageY<p&&(f=!1),c.style.maxHeight=(f?a.pageY:p)-r+"px",c.style.top=f?"":a.pageY+o.lineHeight+"px",c.style.bottom=f?window.innerHeight-a.pageY+"px":"",c.style.left=Math.min(a.pageX,window.innerWidth-h-r)+"px"}},t.prototype.addMarker=function(e,t){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=t,this.marker=t&&t.addMarker(e,"ace_highlight-marker","text")},t.prototype.hide=function(e){(e||document.activeElement!=this.getElement())&&!(e&&e.target&&("keydown"!=e.type||e.ctrlKey||e.metaKey)&&this.$element.contains(e.target))&&(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,u.removePopup(this)))},t.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},t.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},t.prototype.onMouseOut=function(e){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,!this.isOpen||!e.relatedTarget||this.getElement().contains(e.relatedTarget)||!(e&&e.currentTarget.contains(e.relatedTarget))&&(e.relatedTarget.classList.contains("ace_content")||this.hide())},t}(c)}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config","ace/lib/lang"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=e("../lib/dom"),s=e("../lib/event"),a=e("../tooltip").Tooltip,l=e("../config").nls;e("../lib/lang"),t.GutterHandler=function(e){var t,n,i=e.editor,r=i.renderer.$gutterLayer,a=new c(i);function l(){var t=n.getDocumentPosition().row;if(t==i.session.getLength()){var o=i.renderer.pixelToScreenCoordinates(0,n.y).row,s=n.$pos;if(o>i.session.documentToScreenRow(s.row,s.column))return u()}if(a.showTooltip(t),a.isOpen)if(i.on("mousewheel",u),e.$tooltipFollowsMouse)d(n);else{var l=n.getGutterRow(),c=r.$lines.get(l);if(c){var h=c.element.querySelector(".ace_gutter_annotation").getBoundingClientRect(),p=a.getElement().style;p.left=h.right+"px",p.top=h.bottom+"px"}else d(n)}}function u(){t&&(t=clearTimeout(t)),a.isOpen&&(a.hideTooltip(),i.off("mousewheel",u))}function d(e){a.setPosition(e.x,e.y)}e.editor.setDefaultHandler("guttermousedown",function(t){if(i.isFocused()&&0==t.getButton()&&"foldWidgets"!=r.getRegion(t)){var n=t.getDocumentPosition().row,o=i.session.selection;if(t.getShiftKey())o.selectTo(n,0);else{if(2==t.domEvent.detail)return i.selectAll(),t.preventDefault();e.$clickSelection=i.selection.getLineRange(n)}return e.setState("selectByLines"),e.captureMouse(t),t.preventDefault()}}),e.editor.setDefaultHandler("guttermousemove",function(i){var r=i.domEvent.target||i.domEvent.srcElement;if(o.hasCssClass(r,"ace_fold-widget"))return u();a.isOpen&&e.$tooltipFollowsMouse&&d(i),n=i,t||(t=setTimeout(function(){t=null,n&&!e.isMousePressed?l():u()},50))}),s.addListener(i.renderer.$gutter,"mouseout",function(e){n=null,a.isOpen&&!t&&(t=setTimeout(function(){t=null,u()},50))},i),i.on("changeSession",u),i.on("input",u)};var c=function(e){function t(t){var n=e.call(this,t.container)||this;return n.editor=t,n}return i(t,e),t.prototype.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight,r=this.getWidth(),o=this.getHeight();t+=15,(e+=15)+r>n&&(e-=e+r-n),t+o>i&&(t-=20+o),a.prototype.setPosition.call(this,e,t)},Object.defineProperty(t,"annotationLabels",{get:function(){return{error:{singular:l("gutter-tooltip.aria-label.error.singular","error"),plural:l("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:l("gutter-tooltip.aria-label.security.singular","security finding"),plural:l("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:l("gutter-tooltip.aria-label.warning.singular","warning"),plural:l("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:l("gutter-tooltip.aria-label.info.singular","information message"),plural:l("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:l("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:l("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),t.prototype.showTooltip=function(e){var n=this.editor.renderer.$gutterLayer,i=n.$annotations[e];a=i?{displayText:Array.from(i.displayText),type:Array.from(i.type)}:{displayText:[],type:[]};var r=n.session.getFoldLine(e);if(r&&n.$showFoldedAnnotations){for(var s,a,l,c={error:[],security:[],warning:[],info:[],hint:[]},u={error:1,security:2,warning:3,info:4,hint:5},d=e+1;d<=r.end.row;d++)if(n.$annotations[d])for(var h=0;h<n.$annotations[d].text.length;h++){var p=n.$annotations[d].type[h];c[p].push(n.$annotations[d].text[h]),(!l||u[p]<u[l])&&(l=p)}if(["error","security","warning"].includes(l)){var f="".concat(t.annotationsToSummaryString(c)," in folded code.");a.displayText.push(f),a.type.push(l+"_fold")}}if(0===a.displayText.length)return this.hide();for(var g={error:[],security:[],warning:[],info:[],hint:[]},m=n.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",d=0;d<a.displayText.length;d++){var v=o.createElement("span"),b=o.createElement("span");(s=b.classList).add.apply(s,["ace_".concat(a.type[d]),m]),b.setAttribute("aria-label","".concat(t.annotationLabels[a.type[d].replace("_fold","")].singular)),b.setAttribute("role","img"),b.appendChild(o.createTextNode(" ")),v.appendChild(b),v.appendChild(o.createTextNode(a.displayText[d])),v.appendChild(o.createElement("br")),g[a.type[d].replace("_fold","")].push(v)}var y=this.getElement();o.removeChildren(y),g.error.forEach(function(e){return y.appendChild(e)}),g.security.forEach(function(e){return y.appendChild(e)}),g.warning.forEach(function(e){return y.appendChild(e)}),g.info.forEach(function(e){return y.appendChild(e)}),g.hint.forEach(function(e){return y.appendChild(e)}),y.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.editor._signal("showGutterTooltip",this)},t.prototype.hideTooltip=function(){this.$element.removeAttribute("aria-live"),this.hide(),this.editor._signal("hideGutterTooltip",this)},t.annotationsToSummaryString=function(e){var n,i,o=[],s=["error","security","warning","info","hint"];try{for(var a=r(s),l=a.next();!l.done;l=a.next()){var c=l.value;if(e[c].length){var u=1===e[c].length?t.annotationLabels[c].singular:t.annotationLabels[c].plural;o.push("".concat(e[c].length," ").concat(u))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return o.join(", ")},t}(a);t.GutterTooltip=c}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../lib/useragent");t.MouseEvent=function(){function e(e,t){this.speed,this.wheelX,this.wheelY,this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return e.prototype.stopPropagation=function(){i.stopPropagation(this.domEvent),this.propagationStopped=!0},e.prototype.preventDefault=function(){i.preventDefault(this.domEvent),this.defaultPrevented=!0},e.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},e.prototype.getDocumentPosition=function(){return this.$pos||(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY)),this.$pos},e.prototype.getGutterRow=function(){var e=this.getDocumentPosition().row;return this.editor.session.documentToScreenRow(e,0)-this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0)},e.prototype.inSelection=function(){if(null!==this.$inSelection)return this.$inSelection;var e=this.editor.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var t=this.getDocumentPosition();this.$inSelection=e.contains(t.row,t.column)}return this.$inSelection},e.prototype.getButton=function(){return i.getButton(this.domEvent)},e.prototype.getShiftKey=function(){return this.domEvent.shiftKey},e.prototype.getAccelKey=function(){return r.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},e}()}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/event"),o=e("../lib/useragent"),s=200,a=200,l=5;function c(e){var t,n,c,d,h,p=e.editor,f=i.createElement("div");f.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",f.textContent="\xa0",["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"].forEach(function(t){e[t]=this[t]},this),p.on("mousedown",this.onMouseDown.bind(e));var g,m,v,b,y,w,x=p.container,$=0;function _(e,t){var n=Date.now(),i=!t||e.row!=t.row,r=!t||e.column!=t.column;!d||i||r?(p.moveCursorToPosition(e),d=n,h={x:m,y:v}):u(h.x,h.y,m,v)>l?d=null:n-d>=a&&(p.renderer.scrollCursorIntoView(),d=null)}function S(e,t){var n=Date.now(),i=p.renderer.layerConfig.lineHeight,r=p.renderer.layerConfig.characterWidth,o=p.renderer.scroller.getBoundingClientRect(),a={x:{left:m-o.left,right:o.right-m},y:{top:v-o.top,bottom:o.bottom-v}},l=Math.min(a.x.left,a.x.right),u=Math.min(a.y.top,a.y.bottom),d={row:e.row,column:e.column};l/r<=2&&(d.column+=a.x.left<a.x.right?-3:2),u/i<=1&&(d.row+=a.y.top<a.y.bottom?-1:1);var h=e.row!=d.row,f=e.column!=d.column,g=!t||e.row!=t.row;h||f&&!g?c?n-c>=s&&p.renderer.scrollCursorIntoView(d):c=n:c=null}function M(){var e=w;_(w=p.renderer.screenToTextCoordinates(m,v),e),S(w,e)}function C(){y=p.selection.toOrientedRange(),g=p.session.addMarker(y,"ace_selection",p.getSelectionStyle()),p.clearSelection(),p.isFocused()&&p.renderer.$cursorLayer.setBlinking(!1),clearInterval(b),M(),b=setInterval(M,20),$=0,r.addListener(document,"mousemove",A)}function E(){clearInterval(b),p.session.removeMarker(g),g=null,p.selection.fromOrientedRange(y),p.isFocused()&&!n&&p.$resetCursorStyle(),y=null,w=null,$=0,c=null,d=null,r.removeListener(document,"mousemove",A)}this.onDragStart=function(e){if(this.cancelDrag||!x.draggable){var t=this;return setTimeout(function(){t.startSelect(),t.captureMouse(e)},0),e.preventDefault()}y=p.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=p.getReadOnly()?"copy":"copyMove",p.container.appendChild(f),i.setDragImage&&i.setDragImage(f,0,0),setTimeout(function(){p.container.removeChild(f)}),i.clearData(),i.setData("Text",p.session.getTextRange()),n=!0,this.setState("drag")},this.onDragEnd=function(e){if(x.draggable=!1,n=!1,this.setState(null),!p.getReadOnly()){var i=e.dataTransfer.dropEffect;t||"move"!=i||p.session.remove(p.getSelectionRange()),p.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(!p.getReadOnly()&&T(e.dataTransfer))return m=e.clientX,v=e.clientY,g||C(),$++,e.dataTransfer.dropEffect=t=L(e),r.preventDefault(e)},this.onDragOver=function(e){if(!p.getReadOnly()&&T(e.dataTransfer))return m=e.clientX,v=e.clientY,!g&&(C(),$++),null!==k&&(k=null),e.dataTransfer.dropEffect=t=L(e),r.preventDefault(e)},this.onDragLeave=function(e){if(--$<=0&&g)return E(),t=null,r.preventDefault(e)},this.onDrop=function(e){if(w){var i=e.dataTransfer;if(n)switch(t){case"move":y=y.contains(w.row,w.column)?{start:w,end:w}:p.moveText(y,w);break;case"copy":y=p.moveText(y,w,!0)}else{var o=i.getData("Text");y={start:w,end:p.session.insert(w,o)},p.focus(),t=null}return E(),r.preventDefault(e)}},r.addListener(x,"dragstart",this.onDragStart.bind(e),p),r.addListener(x,"dragend",this.onDragEnd.bind(e),p),r.addListener(x,"dragenter",this.onDragEnter.bind(e),p),r.addListener(x,"dragover",this.onDragOver.bind(e),p),r.addListener(x,"dragleave",this.onDragLeave.bind(e),p),r.addListener(x,"drop",this.onDrop.bind(e),p);var k=null;function A(){null==k&&(k=setTimeout(function(){null!=k&&g&&E()},20))}function T(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return"text/plain"==e||"Text"==e})}function L(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],i=o.isMac?e.altKey:e.ctrlKey,r="uninitialized";try{r=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var s="none";return i&&t.indexOf(r)>=0?s="copy":n.indexOf(r)>=0?s="move":t.indexOf(r)>=0&&(s="copy"),s}}function u(e,t,n,i){return Math.sqrt(Math.pow(n-e,2)+Math.pow(i-t,2))}(function(){this.dragWait=function(){Date.now()-this.mousedownEvent.time>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){this.editor.container.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor;e.container.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var t=o.isWin?"default":"move";e.renderer.setCursorStyle(t),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(o.isIE&&"dragReady"==this.state){var n=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if("dragWait"===this.state){var n=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(this.$dragEnabled){this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),i=e.getButton(),r=e.domEvent.detail||1;if(1===r&&0===i&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var s=e.domEvent.target||e.domEvent.srcElement;"unselectable"in s&&(s.unselectable="on"),t.getDragDelay()?(o.isWebKit&&(this.cancelDrag=!0,t.container.draggable=!0),this.setState("dragWait")):this.startDrag(),this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}}).call(c.prototype),t.DragdropHandler=c}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./mouse_event").MouseEvent,r=e("../lib/event"),o=e("../lib/dom");t.addTouchListeners=function(e,t){var n,s,a,l,c,u,d,h,p,f="scroll",g=0,m=0,v=0,b=0;function y(){var e=window.navigator&&window.navigator.clipboard,n=!1,i=function(){var i=t.getCopyText(),s=t.session.getUndoManager().hasUndo();p.replaceChild(o.buildDom(n?["span",!i&&r("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],i&&r("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],i&&r("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],e&&r("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],s&&r("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],r("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],r("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),p.firstChild)},r=function(e){return t.commands.canExecute(e,t)},s=function(r){var o=r.target.getAttribute("action");if("more"==o||!n)return n=!n,i();"paste"==o?e.readText().then(function(e){t.execCommand(o,e)}):o&&(("cut"==o||"copy"==o)&&(e?e.writeText(t.getCopyText()):document.execCommand("copy")),t.execCommand(o)),p.firstChild.style.display="none",n=!1,"openCommandPalette"!=o&&t.focus()};p=o.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(e){f="menu",e.stopPropagation(),e.preventDefault(),t.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),s(e)},onclick:s},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],t.container)}function w(){if(!t.getOption("enableMobileMenu")){p&&x();return}p||y();var e=t.selection.cursor,n=t.renderer.textToScreenCoordinates(e.row,e.column),i=t.renderer.textToScreenCoordinates(0,0).pageX,r=t.renderer.scrollLeft,o=t.container.getBoundingClientRect();p.style.top=n.pageY-o.top-3+"px",n.pageX-o.left<o.width-70?(p.style.left="",p.style.right="10px"):(p.style.right="",p.style.left=i+r-o.left+"px"),p.style.display="",p.firstChild.style.display="none",t.on("input",x)}function x(e){p&&(p.style.display="none"),t.off("input",x)}function $(){clearTimeout(c=null);var e=t.selection.getRange(),n=e.contains(d.row,d.column);(e.isEmpty()||!n)&&(t.selection.moveToPosition(d),t.selection.selectWord()),f="wait",w()}function _(){clearTimeout(c=null),t.selection.moveToPosition(d);var e=m>=2?t.selection.getLineRange(d.row):t.session.getBracketRange(d);e&&!e.isEmpty()?t.selection.setRange(e):t.selection.selectWord(),f="wait"}function S(){g+=60,u=setInterval(function(){g--<=0&&(clearInterval(u),u=null),.01>Math.abs(v)&&(v=0),.01>Math.abs(b)&&(b=0),g<20&&(v*=.9),g<20&&(b*=.9);var e=t.session.getScrollTop();t.renderer.scrollBy(10*v,10*b),e==t.session.getScrollTop()&&(g=0)},10)}r.addListener(e,"contextmenu",function(e){if(h){var n=t.textInput.getElement();n.focus()}},t),r.addListener(e,"touchstart",function(e){var r=e.touches;if(c||r.length>1){clearTimeout(c),c=null,a=-1,f="zoom";return}h=t.$mouseHandler.isMousePressed=!0;var o=t.renderer.layerConfig.lineHeight,u=t.renderer.layerConfig.lineHeight,p=e.timeStamp;l=p;var y=r[0],w=y.clientX,x=y.clientY;if(Math.abs(n-w)+Math.abs(s-x)>o&&(a=-1),n=e.clientX=w,s=e.clientY=x,v=b=0,d=new i(e,t).getDocumentPosition(),p-a<500&&1==r.length&&!g)m++,e.preventDefault(),e.button=0,_();else{m=0;var S=t.selection.cursor,M=t.selection.isEmpty()?S:t.selection.anchor,C=t.renderer.$cursorLayer.getPixelPosition(S,!0),E=t.renderer.$cursorLayer.getPixelPosition(M,!0),k=t.renderer.scroller.getBoundingClientRect(),A=t.renderer.layerConfig.offset,T=t.renderer.scrollLeft,L=function(e,t){return(e/=u)*e+(t=t/o-.75)*t};if(e.clientX<k.left){f="zoom";return}var O=L(e.clientX-k.left-C.left+T,e.clientY-k.top-C.top+A),R=L(e.clientX-k.left-E.left+T,e.clientY-k.top-E.top+A);O<3.5&&R<3.5&&(f=O>R?"cursor":"anchor"),f=R<3.5?"anchor":O<3.5?"cursor":"scroll",c=setTimeout($,450)}a=p},t),r.addListener(e,"touchend",function(e){h=t.$mouseHandler.isMousePressed=!1,u&&clearInterval(u),"zoom"==f?(f="",g=0):c?(t.selection.moveToPosition(d),g=0,w()):"scroll"==f?(S(),x()):w(),clearTimeout(c),c=null},t),r.addListener(e,"touchmove",function(e){c&&(clearTimeout(c),c=null);var r=e.touches;if(!(r.length>1)&&"zoom"!=f){var o=r[0],a=n-o.clientX,u=s-o.clientY;if("wait"==f)if(!(a*a+u*u>4))return e.preventDefault();else f="cursor";n=o.clientX,s=o.clientY,e.clientX=o.clientX,e.clientY=o.clientY;var d=e.timeStamp,h=d-l;if(l=d,"scroll"==f){var p=new i(e,t);p.speed=1,p.wheelX=a,p.wheelY=u,10*Math.abs(a)<Math.abs(u)&&(a=0),10*Math.abs(u)<Math.abs(a)&&(u=0),0!=h&&(v=a/h,b=u/h),t._emit("mousewheel",p),p.propagationStopped||(v=b=0)}else{var g=new i(e,t).getDocumentPosition();"cursor"==f?t.selection.moveCursorToPosition(g):"anchor"==f&&t.selection.setSelectionAnchor(g.row,g.column),t.renderer.scrollCursorIntoView(g),e.preventDefault()}}},t)}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(e,t,n){"use strict";var i=e("../lib/event"),r=e("../lib/useragent"),o=e("./default_handlers").DefaultHandlers,s=e("./default_gutter_handler").GutterHandler,a=e("./mouse_event").MouseEvent,l=e("./dragdrop_handler").DragdropHandler,c=e("./touch_handler").addTouchListeners,u=e("../config"),d=function(){function e(e){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var t=this;this.editor=e,new o(this),new s(this),new l(this);var n=function(t){document.hasFocus&&document.hasFocus()&&(e.isFocused()||document.activeElement!=(e.textInput&&e.textInput.getElement()))||window.focus(),e.focus(),setTimeout(function(){e.isFocused()||e.focus()})},a=e.renderer.getMouseEventTarget();i.addListener(a,"click",this.onMouseEvent.bind(this,"click"),e),i.addListener(a,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),i.addMultiMouseDownListener([a,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),i.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),c(e.container,e);var u=e.renderer.$gutter;i.addListener(u,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),i.addListener(u,"click",this.onMouseEvent.bind(this,"gutterclick"),e),i.addListener(u,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),i.addListener(u,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),i.addListener(a,"mousedown",n,e),i.addListener(u,"mousedown",n,e),r.isIE&&e.renderer.scrollBarV&&(i.addListener(e.renderer.scrollBarV.element,"mousedown",n,e),i.addListener(e.renderer.scrollBarH.element,"mousedown",n,e)),e.on("mousemove",function(n){if(!t.state&&!t.$dragDelay&&t.$dragEnabled){var i=e.renderer.screenToTextCoordinates(n.x,n.y),r=e.session.selection.getRange(),o=e.renderer;!r.isEmpty()&&r.insideStart(i.row,i.column)?o.setCursorStyle("default"):o.setCursorStyle("")}},e)}return e.prototype.onMouseEvent=function(e,t){this.editor.session&&this.editor._emit(e,new a(t,this.editor))},e.prototype.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;n&&n.length&&this.editor._emit(e,new a(t,this.editor))},e.prototype.onMouseWheel=function(e,t){var n=new a(t,this.editor);n.speed=2*this.$scrollSpeed,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},e.prototype.setState=function(e){this.state=e},e.prototype.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,o=this.editor.renderer;o.$isMousePressed=!0;var s=this,l=function(e){if(e){if(r.isWebKit&&!e.which&&s.releaseMouse)return s.releaseMouse();s.x=e.clientX,s.y=e.clientY,t&&t(e),s.mouseEvent=new a(e,s.editor),s.$mouseMoved=!0}},c=function(e){n.off("beforeEndOperation",d),clearInterval(h),n.session&&u(),s[s.state+"End"]&&s[s.state+"End"](e),s.state="",s.isMousePressed=o.$isMousePressed=!1,o.$keepTextAreaAtCursor&&o.$moveTextAreaToCursor(),s.$onCaptureMouseMove=s.releaseMouse=null,e&&s.onMouseEvent("mouseup",e),n.endOperation()},u=function(){s[s.state]&&s[s.state](),s.$mouseMoved=!1};if(r.isOldIE&&"dblclick"==e.domEvent.type)return setTimeout(function(){c(e)});var d=function(e){s.releaseMouse&&n.curOp.command.name&&n.curOp.selectionChanged&&(s[s.state+"End"]&&s[s.state+"End"](),s.state="",s.releaseMouse())};n.on("beforeEndOperation",d),n.startOperation({command:{name:"mouse"}}),s.$onCaptureMouseMove=l,s.releaseMouse=i.capture(this.editor.container,l,c);var h=setInterval(u,20)},e.prototype.cancelContextMenu=function(){var e=(function(t){(!t||!t.domEvent||"contextmenu"==t.domEvent.type)&&(this.editor.off("nativecontextmenu",e),t&&t.domEvent&&i.stopEvent(t.domEvent))}).bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)},e.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},e}();d.prototype.releaseMouse=null,u.defineOptions(d.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150*!!r.isMac},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=d}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom");t.FoldHandler=function(){return function(e){e.on("click",function(t){var n=t.getDocumentPosition(),r=e.session,o=r.getFoldAt(n.row,n.column,1);o&&(t.getAccelKey()?r.removeFold(o):r.expandFold(o),t.stop());var s=t.domEvent&&t.domEvent.target;s&&i.hasCssClass(s,"ace_inline_button")&&i.hasCssClass(s,"ace_toggle_wrap")&&(r.setOption("wrap",!r.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(t)){var n=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[n]&&e.session.onFoldWidgetClick(n,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){if("foldWidgets"==e.renderer.$gutterLayer.getRegion(t)){var n=t.getDocumentPosition().row,i=e.session,r=i.getParentFoldRangeData(n,!0),o=r.range||r.firstRange;if(o){n=o.start.row;var s=i.getFoldAt(n,i.getLine(n).length,1);s?i.removeFold(s):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}}()}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var i=e("../lib/keys"),r=e("../lib/event");t.KeyBinding=function(){function e(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)}return e.prototype.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},e.prototype.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]!=e){for(;t[t.length-1]&&t[t.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)}},e.prototype.addKeyboardHandler=function(e,t){if(e){"function"!=typeof e||e.handleKeyboard||(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);-1!=n&&this.$handlers.splice(n,1),void 0==t?this.$handlers.push(e):this.$handlers.splice(t,0,e),-1==n&&e.attach&&e.attach(this.$editor)}},e.prototype.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return -1!=t&&(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},e.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},e.prototype.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},e.prototype.$callKeyboardHandlers=function(e,t,n,i){for(var o,s=!1,a=this.$editor.commands,l=this.$handlers.length;l--&&(!(o=this.$handlers[l].handleKeyboard(this.$data,e,t,n,i))||!o.command||((s="null"==o.command||a.exec(o.command,this.$editor,o.args,i))&&i&&-1!=e&&!0!=o.passEvent&&!0!=o.command.passEvent&&r.stopEvent(i),!s)););return s||-1!=e||(o={command:"insertstring"},s=a.exec("insertstring",this.$editor,t)),s&&this.$editor._signal&&this.$editor._signal("keyboardActivity",o),s},e.prototype.onCommandKey=function(e,t,n){var r=i.keyCodeToString(n);return this.$callKeyboardHandlers(t,r,n,e)},e.prototype.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)},e}()}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";var i=0,r=0,o=!1,s=!1,a=!1,l=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],c=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],u=0,d=1,h=0,p=1,f=2,g=3,m=4,v=5,b=6,y=7,w=8,x=9,$=10,_=11,S=12,M=13,C=14,E=15,k=16,A=17,T=18,L=[18,18,18,18,18,18,18,18,18,6,5,6,8,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,5,5,5,6,8,4,4,11,11,11,4,4,4,4,4,10,9,10,9,9,2,2,2,2,2,2,2,2,2,2,9,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,18,18,18,18,18,18,5,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,9,4,11,11,11,11,4,4,4,4,0,4,4,18,4,4,11,11,2,2,4,0,4,4,4,2,0,4,4,4,4,4],O=[8,8,8,8,8,8,8,8,8,8,8,18,18,18,0,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,5,13,14,15,16,17,9,11,11,11,11,11,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,9,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8];function R(e,t,n,u){var d=i?c:l,h=null,p=null,f=null,g=0,m=null,y=null,x=-1,$=null,_=null,S=[];if(!u)for($=0,u=[];$<n;$++)u[$]=j(e[$]);for(_=0,r=i,o=!1,s=!1,a=!1;_<n;_++){if(h=g,S[_]=p=I(e,u,S,_),m=240&(g=d[h][p]),g&=15,t[_]=f=d[g][5],m>0)if(16==m){for($=x;$<_;$++)t[$]=1;x=-1}else x=-1;if(y=d[g][6])-1==x&&(x=_);else if(x>-1){for($=x;$<_;$++)t[$]=f;x=-1}u[_]==v&&(t[_]=0),r|=f}if(a){for($=0;$<n;$++)if(u[$]==b){t[$]=i;for(var M=$-1;M>=0;M--)if(u[M]==w)t[M]=i;else break}}}function D(e,t,n){if(!(r<e)){if(1==e&&i==d&&!s)return void n.reverse();for(var o,a,l,c,u=n.length,h=0;h<u;){if(t[h]>=e){for(o=h+1;o<u&&t[o]>=e;)o++;for(a=h,l=o-1;a<l;a++,l--)c=n[a],n[a]=n[l],n[l]=c;h=o}h++}}}function I(e,t,n,r){var l,c,u,d,L=t[r];switch(L){case h:case p:o=!1;case m:case g:return L;case f:return o?g:f;case y:return o=!0,p;case w:return m;case x:if(r<1||r+1>=t.length||(l=n[r-1])!=f&&l!=g||(c=t[r+1])!=f&&c!=g)return m;return o&&(c=g),c==l?c:m;case $:if((l=r>0?n[r-1]:v)==f&&r+1<t.length&&t[r+1]==f)return f;return m;case _:if(r>0&&n[r-1]==f)return f;if(o)return m;for(d=r+1,u=t.length;d<u&&t[d]==_;)d++;if(d<u&&t[d]==f)return f;return m;case S:for(u=t.length,d=r+1;d<u&&t[d]==S;)d++;if(d<u){var O=e[r],R=O>=1425&&O<=2303||64286==O;if(l=t[d],R&&(l==p||l==y))return p}if(r<1||(l=t[r-1])==v)return m;return n[r-1];case v:return o=!1,s=!0,i;case b:return a=!0,m;case M:case C:case k:case A:case E:o=!1;case T:return m}}function j(e){var t=e.charCodeAt(0),n=t>>8;if(0==n)return t>191?h:L[t];if(5==n)return/[\u0591-\u05f4]/.test(e)?p:h;if(6==n)if(/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e))return S;else if(/[\u0660-\u0669\u066b-\u066c]/.test(e))return g;else if(1642==t)return _;else if(/[\u06f0-\u06f9]/.test(e))return f;else return y;if(32==n&&t<=8287)return O[255&t];if(254==n)return t>=65136?y:m;return m}t.L=0,t.R=p,t.EN=f,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\xb7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var o=e.split(""),s=Array(o.length),a=Array(o.length),l=[];i=r?d:u,R(o,l,o.length,n);for(var c=0;c<s.length;s[c]=c,c++);D(2,l,s),D(1,l,s);for(var c=0;c<s.length-1;c++)n[c]===g?l[c]=t.AN:l[c]===p&&(n[c]>y&&n[c]<M||n[c]===m||n[c]===T)?l[c]=t.ON_R:c>0&&"ل"===o[c-1]&&/\u0622|\u0623|\u0625|\u0627/.test(o[c])&&(l[c-1]=l[c]=t.R_H,c++);o[o.length-1]===t.DOT&&(l[o.length-1]=t.B),"‫"===o[0]&&(l[0]=t.RLE);for(var c=0;c<s.length;c++)a[c]=l[s[c]];return{logicalFromVisual:s,bidiLevels:a}},t.hasBidiCharacters=function(e,t){for(var n=!1,i=0;i<e.length;i++)t[i]=j(e.charAt(i)),n||t[i]!=p&&t[i]!=y&&t[i]!=g||(n=!0);return n},t.getVisualFromLogicalIdx=function(e,t){for(var n=0;n<t.logicalFromVisual.length;n++)if(t.logicalFromVisual[n]==e)return n;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,t,n){"use strict";var i=e("./lib/bidiutil"),r=e("./lib/lang"),o=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;t.BidiHandler=function(){function e(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=i,this.charWidths=[],this.EOL="\xac",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="\xb6",this.RLE="‫",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=o.test(e.getValue())}return e.prototype.isBidiRow=function(e,t,n){return!!this.seenBidi&&(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,n),this.updateBidiMap()),this.bidiMap.bidiLevels)},e.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:"insert"==e.action&&o.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},e.prototype.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n=this.session.$getRowCacheIndex(t,this.currentRow);n>=0&&(e=this.session.$docRowCache[n])}return e},e.prototype.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length)for(var n,i=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(n=this.session.$getRowCacheIndex(t,this.currentRow-e-1))===i;)i=n,e++;else e=this.currentRow;return e},e.prototype.updateRowLine=function(e,t){void 0===e&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(void 0===t&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[i.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t]),t==o.length&&(this.line+=this.showInvisibles?n:i.DOT))}else this.line+=this.showInvisibles?n:i.DOT;var s,a=this.session,l=0;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,t){return" "===e||a.isFullWidth(e.charCodeAt(0))?(s=" "===e?a.getScreenTabSize(t+l):2,l+=s-1,r.stringRepeat(i.DOT,s)):e}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==i.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},e.prototype.updateBidiMap=function(){var e=[];i.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=i.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},e.prototype.markAsDirty=function(){this.currentRow=null},e.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,n=e.$measureCharWidth("ה");this.charWidths[i.L]=this.charWidths[i.EN]=this.charWidths[i.ON_R]=t,this.charWidths[i.R]=this.charWidths[i.AN]=n,this.charWidths[i.R_H]=.45*n,this.charWidths[i.B]=this.charWidths[i.RLE]=0,this.currentRow=null}},e.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},e.prototype.setEolChar=function(e){this.EOL=e},e.prototype.setContentWidth=function(e){this.contentWidth=e},e.prototype.isRtlLine=function(e){return!!this.$isRtl||(void 0!=e?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir)},e.prototype.setRtlDirection=function(e,t){for(var n=e.getCursorPosition(),i=e.selection.getSelectionAnchor().row;i<=n.row;i++)t||e.session.getLine(i).charAt(0)!==e.session.$bidiHandler.RLE?t&&e.session.getLine(i).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:i},e.session.$bidiHandler.RLE):e.session.doc.removeInLine(i,0,1)},e.prototype.getPosLeft=function(e){e-=this.wrapIndent;var t=+(this.line.charAt(0)===this.RLE),n=e>t?this.session.getOverwrite()?e:e-1:t,r=i.getVisualFromLogicalIdx(n,this.bidiMap),o=this.bidiMap.bidiLevels,s=0;!this.session.getOverwrite()&&e<=t&&o[r]%2!=0&&r++;for(var a=0;a<r;a++)s+=this.charWidths[o[a]];return!this.session.getOverwrite()&&e>t&&o[r]%2==0&&(s+=this.charWidths[o[r]]),this.wrapIndent&&(s+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(s+=this.rtlLineOffset),s},e.prototype.getSelections=function(e,t){var n,i=this.bidiMap,r=i.bidiLevels,o=[],s=0,a=Math.min(e,t)-this.wrapIndent,l=Math.max(e,t)-this.wrapIndent,c=!1,u=!1,d=0;this.wrapIndent&&(s+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p<r.length;p++)h=i.logicalFromVisual[p],n=r[p],(c=h>=a&&h<l)&&!u?d=s:!c&&u&&o.push({left:d,width:s-d}),s+=this.charWidths[n],u=c;if(c&&p===r.length&&o.push({left:d,width:s-d}),this.isRtlDir)for(var f=0;f<o.length;f++)o[f].left+=this.rtlLineOffset;return o},e.prototype.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,e=Math.max(e,0),n=0,i=0,r=this.bidiMap.bidiLevels,o=this.charWidths[r[i]];for(this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);e>n+o/2;){if(n+=o,i===r.length-1){o=0;break}o=this.charWidths[r[++i]]}return i>0&&r[i-1]%2!=0&&r[i]%2==0?(e<n&&i--,t=this.bidiMap.logicalFromVisual[i]):i>0&&r[i-1]%2==0&&r[i]%2!=0?t=1+(e>n?this.bidiMap.logicalFromVisual[i]:this.bidiMap.logicalFromVisual[i-1]):this.isRtlDir&&i===r.length-1&&0===o&&r[i-1]%2==0||!this.isRtlDir&&0===i&&r[i]%2!=0?t=1+this.bidiMap.logicalFromVisual[i]:(i>0&&r[i-1]%2!=0&&0!==o&&i--,t=this.bidiMap.logicalFromVisual[i]),0===t&&this.isRtlDir&&t++,t+this.wrapIndent},e}()}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/lang"),o=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,a=function(){function e(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),t.$isEmpty||t.$silent||t._emit("changeSelection"),t.$keepDesiredColumnOnChange||e.old.column==e.value.column||(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,t.$isEmpty||t.$silent||t._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},e.prototype.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?s.fromPoints(t,t):this.isBackwards()?s.fromPoints(t,e):s.fromPoints(e,t)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(e,t){var n=t?e.end:e.start,i=t?e.start:e.end;this.$setSelection(n.row,n.column,i.row,i.column)},e.prototype.$setSelection=function(e,t,n,i){if(!this.$silent){var r=this.$isEmpty,o=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,i),this.$isEmpty=!s.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||r!=this.$isEmpty||o)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},e.prototype.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},e.prototype.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},e.prototype.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},e.prototype.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(e,t){if(void 0===t){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},e.prototype.getLineRange=function(e,t){var n,i="number"==typeof e?e:this.lead.row,r=this.session.getFoldLine(i);return(r?(i=r.start.row,n=r.end.row):n=i,!0===t)?new s(i,0,n,this.session.getLine(n).length):new s(i,0,n+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(e,t,n){var i=e.column,r=e.column+t;return n<0&&(i=e.column-t,r=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(i,r).split(" ").length-1==t},e.prototype.moveCursorLeft=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(e.start.row,e.start.column);else if(0===t.column)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var e,t=this.lead.getPosition();if(e=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(e.end.row,e.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var n=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,n,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,n):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,n=this.session.documentToScreenRow(e,t),i=this.session.screenToDocumentPosition(n,0),r=this.session.getDisplayLine(e,null,i.row,i.column).match(/^\s*/);r[0].length==t||this.session.$useEmacsStyleLineStart||(i.column+=r[0].length),this.moveCursorToPosition(i)},e.prototype.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var n=this.session.getLine(t.row);if(t.column==n.length){var i=n.search(/\s+$/);i>0&&(t.column=i)}}this.moveCursorTo(t.row,t.column)},e.prototype.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),i=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var r=this.session.getFoldAt(e,t,1);if(r)return void this.moveCursorTo(r.end.row,r.end.column);if(this.session.nonTokenRe.exec(i)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,i=n.substring(t)),t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(i)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},e.prototype.moveCursorLongWordLeft=function(){var e,t=this.lead.row,n=this.lead.column;if(e=this.session.getFoldAt(t,n,-1))return void this.moveCursorTo(e.start.row,e.start.column);var i=this.session.getFoldStringAt(t,n,-1);null==i&&(i=this.doc.getLine(t).substring(0,n));var o=r.stringReverse(i);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(o)&&(n-=this.session.nonTokenRe.lastIndex,o=o.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),n<=0){this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(o)&&(n-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,n)},e.prototype.$shortWordEndIndex=function(e){var t,n=0,i=/\s/,r=this.session.tokenRe;if(r.lastIndex=0,this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{for(;(t=e[n])&&i.test(t);)n++;if(n<1){for(r.lastIndex=0;(t=e[n])&&!r.test(t);)if(r.lastIndex=0,n++,i.test(t))if(n>2){n--;break}else{for(;(t=e[n])&&i.test(t);)n++;if(n>2)break}}}return r.lastIndex=0,n},e.prototype.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),i=n.substring(t),r=this.session.getFoldAt(e,t,1);if(r)return this.moveCursorTo(r.end.row,r.end.column);if(t==n.length){var o=this.doc.getLength();do e++,i=this.doc.getLine(e);while(e<o&&/^\s*$/.test(i));/^\s+/.test(i)||(i=""),t=0}var s=this.$shortWordEndIndex(i);this.moveCursorTo(e,t+s)},e.prototype.moveCursorShortWordLeft=function(){var e,t=this.lead.row,n=this.lead.column;if(e=this.session.getFoldAt(t,n,-1))return this.moveCursorTo(e.start.row,e.start.column);var i=this.session.getLine(t).substring(0,n);if(0===n){do t--,i=this.doc.getLine(t);while(t>0&&/^\s*$/.test(i));n=i.length,/\s+$/.test(i)||(i="")}var o=r.stringReverse(i),s=this.$shortWordEndIndex(o);return this.moveCursorTo(t,n-s)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(e,t){var n,i=this.session.documentToScreenPosition(this.lead.row,this.lead.column);if(0===t&&(0!==e&&(this.session.$bidiHandler.isBidiRow(i.row,this.lead.row)?(n=this.session.$bidiHandler.getPosLeft(i.column),i.column=Math.round(n/this.session.$bidiHandler.charWidths[0])):n=i.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?i.column=this.$desiredColumn:this.$desiredColumn=i.column),0!=e&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var r=this.session.lineWidgets[this.lead.row];e<0?e-=r.rowsAbove||0:e>0&&(e+=r.rowCount-(r.rowsAbove||0))}var o=this.session.screenToDocumentPosition(i.row+e,i.column,n);0!==e&&0===t&&o.row===this.lead.row&&(o.column,this.lead.column),this.moveCursorTo(o.row,o.column+t,0===t)},e.prototype.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},e.prototype.moveCursorTo=function(e,t,n){var i=this.session.getFoldAt(e,t,1);i&&(e=i.start.row,t=i.start.column),this.$keepDesiredColumnOnChange=!0;var r=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(r.charAt(t))&&r.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(e,t,n){var i=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(i.row,i.column,n)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},e.prototype.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return s.fromPoints(t,n)}catch(e){return s.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},e.prototype.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},e.prototype.fromJSON=function(e){if(void 0==e.start)if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=s.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}else e=e[0];this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},e.prototype.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0},e}();a.prototype.setSelectionAnchor=a.prototype.setAnchor,a.prototype.getSelectionAnchor=a.prototype.getAnchor,a.prototype.setSelectionRange=a.prototype.setRange,i.implement(a.prototype,o),t.Selection=a}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(e,t,n){"use strict";var i=e("./lib/report_error").reportError,r=2e3,o=function(){function e(e){for(var t in this.splitRegex,this.states=e,this.regExps={},this.matchMappings={},this.states){for(var n=this.states[t],i=[],r=0,o=this.matchMappings[t]={defaultToken:"text"},s="g",a=[],l=0;l<n.length;l++){var c=n[l];if(c.defaultToken&&(o.defaultToken=c.defaultToken),c.caseInsensitive&&-1===s.indexOf("i")&&(s+="i"),c.unicode&&-1===s.indexOf("u")&&(s+="u"),null!=c.regex){c.regex instanceof RegExp&&(c.regex=c.regex.toString().slice(1,-1));var u=c.regex,d=RegExp("(?:("+u+")|(.))").exec("a").length-2;Array.isArray(c.token)?1==c.token.length||1==d?c.token=c.token[0]:d-1!=c.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:c,groupCount:d-1}),c.token=c.token[0]):(c.tokenArray=c.token,c.token=null,c.onMatch=this.$arrayTokens):"function"!=typeof c.token||c.onMatch||(d>1?c.onMatch=this.$applyToken:c.onMatch=c.token),d>1&&(/\\\d/.test(c.regex)?u=c.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+r+1)}):(d=1,u=this.removeCapturingGroups(c.regex)),c.splitRegex||"string"==typeof c.token||a.push(c)),o[r]=l,r+=d,i.push(u),c.onMatch||(c.onMatch=null)}}i.length||(o[0]=0,i.push("$")),a.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,s)},this),this.regExps[t]=RegExp("("+i.join(")|(")+")|($)",s)}}return e.prototype.$setMaxTokenCount=function(e){r=0|e},e.prototype.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if("string"==typeof n)return[{type:n,value:e}];for(var i=[],r=0,o=n.length;r<o;r++)t[r]&&(i[i.length]={type:n[r],value:t[r]});return i},e.prototype.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";for(var n=[],i=this.tokenArray,r=0,o=i.length;r<o;r++)t[r+1]&&(n[n.length]={type:i[r],value:t[r+1]});return n},e.prototype.removeCapturingGroups=function(e){return e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(e,t){return t?"(?:":e})},e.prototype.createSplitterRegexp=function(e,t){if(-1!=e.indexOf("(?=")){var n=0,i=!1,r={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,o,s,a,l){return i?i="]"!=a:a?i=!0:s?(n==r.stack&&(r.end=l+1,r.stack=-1),n--):o&&(n++,1!=o.length&&(r.stack=n,r.start=l)),e}),null!=r.end&&/^\)*$/.test(e.substr(r.end))&&(e=e.substring(0,r.start)+e.substr(r.end))}return"^"!=e.charAt(0)&&(e="^"+e),"$"!=e.charAt(e.length-1)&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},e.prototype.getLineTokens=function(e,t){if(t&&"string"!=typeof t){var n=t.slice(0);"#tmp"===(t=n[0])&&(n.shift(),t=n.shift())}else var n=[];var i=t||"start",o=this.states[i];o||(i="start",o=this.states[i]);var s=this.matchMappings[i],a=this.regExps[i];a.lastIndex=0;for(var l,c=[],u=0,d=0,h={type:null,value:""};l=a.exec(e);){var p=s.defaultToken,f=null,g=l[0],m=a.lastIndex;if(m-g.length>u){var v=e.substring(u,m-g.length);h.type==p?h.value+=v:(h.type&&c.push(h),h={type:p,value:v})}for(var b=0;b<l.length-2;b++)if(void 0!==l[b+1]){f=o[s[b]],p=f.onMatch?f.onMatch(g,i,n,e):f.token,f.next&&(i="string"==typeof f.next?f.next:f.next(i,n),(o=this.states[i])||(this.reportError("state doesn't exist",i),i="start",o=this.states[i]),s=this.matchMappings[i],u=m,(a=this.regExps[i]).lastIndex=m),f.consumeLineEnd&&(u=m);break}if(g){if("string"==typeof p)f&&!1===f.merge||h.type!==p?(h.type&&c.push(h),h={type:p,value:g}):h.value+=g;else if(p){h.type&&c.push(h),h={type:null,value:""};for(var b=0;b<p.length;b++)c.push(p[b])}}if(u==e.length)break;if(u=m,d++>r){for(d>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});u<e.length;)h.type&&c.push(h),h={value:e.substring(u,u+=500),type:"overflow"};i="start",n=[];break}}return h.type&&c.push(h),n.length>1&&n[0]!==i&&n.unshift("#tmp",i),{tokens:c,state:n.length?n:i}},e}();o.prototype.reportError=i,t.Tokenizer=o}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(e,t,n){"use strict";var i,r=e("../lib/deep_copy").deepCopy;(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){for(var i=e[n],r=0;r<i.length;r++){var o=i[r];(o.next||o.onMatch)&&("string"==typeof o.next&&0!==o.next.indexOf(t)&&(o.next=t+o.next),o.nextState&&0!==o.nextState.indexOf(t)&&(o.nextState=t+o.nextState))}this.$rules[t+n]=i}},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,o){var s="function"==typeof e?new e().getRules():e;if(i)for(var a=0;a<i.length;a++)i[a]=t+i[a];else for(var l in i=[],s)i.push(t+l);if(this.addRules(s,t),n)for(var c=Array.prototype[o?"push":"unshift"],a=0;a<i.length;a++)c.apply(this.$rules[i[a]],r(n));this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return("start"!=e||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){var n=0,i=this.$rules;function r(o){var s=i[o];s.processed=!0;for(var a=0;a<s.length;a++){var l=s[a],c=null;Array.isArray(l)&&(c=l,l={}),!l.regex&&l.start&&(l.regex=l.start,l.next||(l.next=[]),l.next.push({defaultToken:l.token},{token:l.token+".end",regex:l.end||l.start,next:"pop"}),l.token=l.token+".start",l.push=!0);var u=l.next||l.push;if(u&&Array.isArray(u)){var d=l.stateName;!d&&("string"!=typeof(d=l.token)&&(d=d[0]||""),i[d]&&(d+=n++)),i[d]=u,l.next=d,r(d)}else"pop"==u&&(l.next=t);if(l.push&&(l.nextState=l.next||l.push,l.next=e,delete l.push),l.rules)for(var h in l.rules)i[h]?i[h].push&&i[h].push.apply(i[h],l.rules[h]):i[h]=l.rules[h];var p="string"==typeof l?l:l.include;if(p&&("$self"===p&&(p="start"),c=Array.isArray(p)?p.map(function(e){return i[e]}):i[p]),c){var f=[a,1].concat(c);l.noEscape&&(f=f.filter(function(e){return!e.next})),s.splice.apply(s,f),a--}l.keywordMap&&(l.token=this.createKeywordMapper(l.keywordMap,l.defaultToken||"text",l.caseInsensitive),delete l.defaultToken)}}Object.keys(i).forEach(r,this)},this.createKeywordMapper=function(e,t,n,i){var r=Object.create(null);return this.$keywordList=[],Object.keys(e).forEach(function(t){for(var o=e[t].split(i||"|"),s=o.length;s--;){var a=o[s];this.$keywordList.push(a),n&&(a=a.toLowerCase()),r[a]=t}},this),e=null,n?function(e){return r[e.toLowerCase()]||t}:function(e){return r[e]||t}},this.getKeywords=function(){return this.$keywords}}).call((i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}}).prototype),t.TextHighlightRules=i}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,t,n){"use strict";var i;(function(){this.add=function(e,t,n){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=n},this.addBehaviours=function(e){for(var t in e)for(var n in e[t])this.add(t,n,e[t][n])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if("function"==typeof e)var n=new e().getBehaviours(t);else var n=e.getBehaviours(t);this.addBehaviours(n)},this.getBehaviours=function(e){if(!e)return this.$behaviours;for(var t={},n=0;n<e.length;n++)this.$behaviours[e[n]]&&(t[e[n]]=this.$behaviours[e[n]]);return t}}).call((i=function(){this.$behaviours={}}).prototype),t.Behaviour=i}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("./range").Range;t.TokenIterator=function(){function e(e,t,n){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var i=e.getTokenAt(t,n);this.$tokenIndex=i?i.index:-1}return e.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},e.prototype.stepForward=function(){var e;for(this.$tokenIndex+=1;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,e||(e=this.$session.getLength()),this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},e.prototype.getCurrentTokenRow=function(){return this.$row},e.prototype.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(void 0!==n)return n;for(n=0;t>0;)t-=1,n+=e[t].value.length;return n},e.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},e.prototype.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new i(this.$row,t,this.$row,t+e.value.length)},e}()}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var i,r,o=e("../../lib/oop"),s=e("../behaviour").Behaviour,a=e("../../token_iterator").TokenIterator,l=e("../../lib/lang"),c=["text","paren.rparen","rparen","paren","punctuation.operator"],u=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],d={},h={'"':'"',"'":"'"},p=function(e){var t=-1;if(e.multiSelect&&(t=e.selection.index,d.rangeCount!=e.multiSelect.rangeCount&&(d={rangeCount:e.multiSelect.rangeCount})),d[t])return i=d[t];i=d[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},f=function(e,t,n,i){var r=e.end.row-e.start.row;return{text:n+t+i,selection:[0,e.start.column+1,r,e.end.column+ +!r]}};(r=function(e){e=e||{},this.add("braces","insertion",function(t,n,o,s,a){var c=o.getCursorPosition(),u=s.doc.getLine(c.row);if("{"==a){p(o);var d=o.getSelectionRange(),h=s.doc.getTextRange(d),g=s.getTokenAt(c.row,c.column);if(""!==h&&"{"!==h&&o.getWrapBehavioursEnabled())return f(d,h,"{","}");if(g&&/(?:string)\.quasi|\.xml/.test(g.type)){if([/tag\-(?:open|name)/,/attribute\-name/].some(function(e){return e.test(g.type)})||/(string)\.quasi/.test(g.type)&&"$"!==g.value[c.column-g.start-1])return;return r.recordAutoInsert(o,s,"}"),{text:"{}",selection:[1,1]}}if(r.isSaneInsertion(o,s))if(/[\]\}\)]/.test(u[c.column])||o.inMultiSelectMode||e.braces)return r.recordAutoInsert(o,s,"}"),{text:"{}",selection:[1,1]};else return r.recordMaybeInsert(o,s,"{"),{text:"{",selection:[1,1]}}else if("}"==a){p(o);var m=u.substring(c.column,c.column+1);if("}"==m&&null!==s.$findOpeningBracket("}",{column:c.column+1,row:c.row})&&r.isAutoInsertedClosing(c,u,a))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}else if("\n"==a||"\r\n"==a){p(o);var v="";r.isMaybeInsertedClosing(c,u)&&(v=l.stringRepeat("}",i.maybeInsertedBrackets),r.clearMaybeInsertedClosing());var m=u.substring(c.column,c.column+1);if("}"===m){var b=s.findMatchingBracket({row:c.row,column:c.column+1},"}");if(!b)return null;var y=this.$getIndent(s.getLine(b.row))}else if(!v)return void r.clearMaybeInsertedClosing();else var y=this.$getIndent(u);var w=y+s.getTabString();return{text:"\n"+w+"\n"+y+v,selection:[1,w.length,1,w.length]}}else r.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(e,t,n,r,o){var s=r.doc.getTextRange(o);if(!o.isMultiLine()&&"{"==s){if(p(n),"}"==r.doc.getLine(o.start.row).substring(o.end.column,o.end.column+1))return o.end.column++,o;i.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,i,o){if("("==o){p(n);var s=n.getSelectionRange(),a=i.doc.getTextRange(s);if(""!==a&&n.getWrapBehavioursEnabled())return f(s,a,"(",")");if(r.isSaneInsertion(n,i))return r.recordAutoInsert(n,i,")"),{text:"()",selection:[1,1]}}else if(")"==o){p(n);var l=n.getCursorPosition(),c=i.doc.getLine(l.row);if(")"==c.substring(l.column,l.column+1)&&null!==i.$findOpeningBracket(")",{column:l.column+1,row:l.row})&&r.isAutoInsertedClosing(l,c,o))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("parens","deletion",function(e,t,n,i,r){var o=i.doc.getTextRange(r);if(!r.isMultiLine()&&"("==o&&(p(n),")"==i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)))return r.end.column++,r}),this.add("brackets","insertion",function(e,t,n,i,o){if("["==o){p(n);var s=n.getSelectionRange(),a=i.doc.getTextRange(s);if(""!==a&&n.getWrapBehavioursEnabled())return f(s,a,"[","]");if(r.isSaneInsertion(n,i))return r.recordAutoInsert(n,i,"]"),{text:"[]",selection:[1,1]}}else if("]"==o){p(n);var l=n.getCursorPosition(),c=i.doc.getLine(l.row);if("]"==c.substring(l.column,l.column+1)&&null!==i.$findOpeningBracket("]",{column:l.column+1,row:l.row})&&r.isAutoInsertedClosing(l,c,o))return r.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}),this.add("brackets","deletion",function(e,t,n,i,r){var o=i.doc.getTextRange(r);if(!r.isMultiLine()&&"["==o&&(p(n),"]"==i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)))return r.end.column++,r}),this.add("string_dquotes","insertion",function(e,t,n,i,r){var o=i.$mode.$quotes||h;if(1==r.length&&o[r]){if(this.lineCommentStart&&-1!=this.lineCommentStart.indexOf(r))return;p(n);var s=r,a=n.getSelectionRange(),l=i.doc.getTextRange(a);if(""!==l&&(1!=l.length||!o[l])&&n.getWrapBehavioursEnabled())return f(a,l,s,s);if(!l){var c,u=n.getCursorPosition(),d=i.doc.getLine(u.row),g=d.substring(u.column-1,u.column),m=d.substring(u.column,u.column+1),v=i.getTokenAt(u.row,u.column),b=i.getTokenAt(u.row,u.column+1);if("\\"==g&&v&&/escape/.test(v.type))return null;var y=v&&/string|escape/.test(v.type),w=!b||/string|escape/.test(b.type);if(m==s)(c=y!==w)&&/string\.end/.test(b.type)&&(c=!1);else{if(y&&!w||y&&w)return null;var x=i.$mode.tokenRe;x.lastIndex=0;var $=x.test(g);x.lastIndex=0;var _=x.test(m),S=i.$mode.$pairQuotesAfter;if(!(S&&S[s]&&S[s].test(g))&&$||_||m&&!/[\s;,.})\]\\]/.test(m))return null;var M=d[u.column-2];if(g==s&&(M==s||x.test(M)))return null;c=!0}return{text:c?s+s:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,i,r){var o=i.$mode.$quotes||h,s=i.doc.getTextRange(r);if(!r.isMultiLine()&&o.hasOwnProperty(s)&&(p(n),i.doc.getLine(r.start.row).substring(r.start.column+1,r.start.column+2)==s))return r.end.column++,r}),!1!==e.closeDocComment&&this.add("doc comment end","insertion",function(e,t,n,i,r){if("doc-start"===e&&("\n"===r||"\r\n"===r)&&n.selection.isEmpty()){var o=n.getCursorPosition();if(0!==o.column){for(var s=i.doc.getLine(o.row),a=i.doc.getLine(o.row+1),l=i.getTokens(o.row),c=0,u=0;u<l.length;u++){c+=l[u].value.length;var d=l[u];if(c>=o.column){if(c===o.column){if(!/\.doc/.test(d.type))return;if(/\*\//.test(d.value)){var h=l[u+1];if(!h||!/\.doc/.test(h.type))return}}var p=o.column-(c-d.value.length),f=d.value.indexOf("*/"),g=d.value.indexOf("/**",f>-1?f+2:0);if(-1!==g&&p>g&&p<g+3||-1!==f&&-1!==g&&p>=f&&p<=g||!/\.doc/.test(d.type))return;break}}var m=this.$getIndent(s);if(/\s*\*/.test(a))if(/^\s*\*/.test(s))return{text:r+m+"* ",selection:[1,2+m.length,1,2+m.length]};else return{text:r+m+" * ",selection:[1,3+m.length,1,3+m.length]};if(/\/\*\*/.test(s.substring(0,o.column)))return{text:r+m+" * "+r+" "+m+"*/",selection:[1,4+m.length,1,4+m.length]}}}})}).isSaneInsertion=function(e,t){var n=e.getCursorPosition(),i=new a(t,n.row,n.column);if(!this.$matchTokenType(i.getCurrentToken()||"text",c)){if(/[)}\]]/.test(e.session.getLine(n.row)[n.column]))return!0;var r=new a(t,n.row,n.column+1);if(!this.$matchTokenType(r.getCurrentToken()||"text",c))return!1}return i.stepForward(),i.getCurrentTokenRow()!==n.row||this.$matchTokenType(i.getCurrentToken()||"text",u)},r.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},r.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),o=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,o,i.autoInsertedLineEnd[0])||(i.autoInsertedBrackets=0),i.autoInsertedRow=r.row,i.autoInsertedLineEnd=n+o.substr(r.column),i.autoInsertedBrackets++},r.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),o=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,o)||(i.maybeInsertedBrackets=0),i.maybeInsertedRow=r.row,i.maybeInsertedLineStart=o.substr(0,r.column)+n,i.maybeInsertedLineEnd=o.substr(r.column),i.maybeInsertedBrackets++},r.isAutoInsertedClosing=function(e,t,n){return i.autoInsertedBrackets>0&&e.row===i.autoInsertedRow&&n===i.autoInsertedLineEnd[0]&&t.substr(e.column)===i.autoInsertedLineEnd},r.isMaybeInsertedClosing=function(e,t){return i.maybeInsertedBrackets>0&&e.row===i.maybeInsertedRow&&t.substr(e.column)===i.maybeInsertedLineEnd&&t.substr(0,e.column)==i.maybeInsertedLineStart},r.popAutoInsertedClosing=function(){i.autoInsertedLineEnd=i.autoInsertedLineEnd.substr(1),i.autoInsertedBrackets--},r.clearMaybeInsertedClosing=function(){i&&(i.maybeInsertedBrackets=0,i.maybeInsertedRow=-1)},o.inherits(r,s),t.CstyleBehaviour=r}),ace.define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";for(var i=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],r=0,o=[],s=0;s<i.length;s+=2)o.push(r+=i[s]),i[s+1]&&o.push(45,r+=i[s+1]);t.wordChars=String.fromCharCode.apply(null,o)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var i,r=e("../config"),o=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,a=e("./behaviour/cstyle").CstyleBehaviour,l=e("../unicode"),c=e("../lib/lang"),u=e("../token_iterator").TokenIterator,d=e("../range").Range;(function(){this.$defaultBehaviour=new a,this.tokenRe=RegExp("^["+l.wordChars+"\\$_]+","g"),this.nonTokenRe=RegExp("^(?:[^"+l.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new o(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,n,i){var r=t.doc,o=!0,s=!0,a=1/0,l=t.getTabSize(),u=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var d=this.lineCommentStart.map(c.escapeRegExp).join("|"),h=this.lineCommentStart[0];else var d=c.escapeRegExp(this.lineCommentStart),h=this.lineCommentStart;d=RegExp("^(\\s*)(?:"+d+") ?"),u=t.getUseSoftTabs();var p=function(e,t){var n=e.match(d);if(n){var i=n[1].length,o=n[0].length;!v(e,i,o)&&" "==n[0][o-1]&&o--,r.removeInLine(t,i,o)}},f=h+" ",g=function(e,t){(!o||/\S/.test(e))&&(v(e,a,a)?r.insertInLine({row:t,column:a},f):r.insertInLine({row:t,column:a},h))},m=function(e,t){return d.test(e)},v=function(e,t,n){for(var i=0;t--&&" "==e.charAt(t);)i++;if(i%l!=0)return!1;for(var i=0;" "==e.charAt(n++);)i++;return l>2?i%l!=l-1:i%l==0}}else{if(!this.blockComment)return!1;var h=this.blockComment.start,b=this.blockComment.end,d=RegExp("^(\\s*)(?:"+c.escapeRegExp(h)+")"),y=RegExp("(?:"+c.escapeRegExp(b)+")\\s*$"),g=function(e,t){!m(e,t)&&(!o||/\S/.test(e))&&(r.insertInLine({row:t,column:e.length},b),r.insertInLine({row:t,column:a},h))},p=function(e,t){var n;(n=e.match(y))&&r.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(d))&&r.removeInLine(t,n[1].length,n[0].length)},m=function(e,n){if(d.test(e))return!0;for(var i=t.getTokens(n),r=0;r<i.length;r++)if("comment"===i[r].type)return!0}}function w(e){for(var t=n;t<=i;t++)e(r.getLine(t),t)}var x=1/0;w(function(e,t){var n=e.search(/\S/);-1!==n?(n<a&&(a=n),s&&!m(e,t)&&(s=!1)):x>e.length&&(x=e.length)}),a==1/0&&(a=x,o=!1,s=!1),u&&a%l!=0&&(a=Math.floor(a/l)*l),w(s?p:g)},this.toggleBlockComment=function(e,t,n,i){var r=this.blockComment;if(r){!r.start&&r[0]&&(r=r[0]);var o=new u(t,i.row,i.column),s=o.getCurrentToken();t.selection;var a=t.selection.toOrientedRange();if(s&&/comment/.test(s.type)){for(;s&&/comment/.test(s.type);){var l,c,h,p,f=s.value.indexOf(r.start);if(-1!=f){var g=o.getCurrentTokenRow(),m=o.getCurrentTokenColumn()+f;h=new d(g,m,g,m+r.start.length);break}s=o.stepBackward()}for(var o=new u(t,i.row,i.column),s=o.getCurrentToken();s&&/comment/.test(s.type);){var f=s.value.indexOf(r.end);if(-1!=f){var g=o.getCurrentTokenRow(),m=o.getCurrentTokenColumn()+f;p=new d(g,m,g,m+r.end.length);break}s=o.stepForward()}p&&t.remove(p),h&&(t.remove(h),l=h.start.row,c=-r.start.length)}else c=r.start.length,l=n.start.row,t.insert(n.end,r.end),t.insert(n.start,r.start);a.start.row==l&&(a.start.column+=c),a.end.row==l&&(a.end.column+=c),t.selection.fromOrientedRange(a)}},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){for(var t in this.$embeds=[],this.$modes={},e)if(e[t]){var n=e[t],i=n.prototype.$id,o=r.$modes[i];o||(r.$modes[i]=o=new n),r.$modes[t]||(r.$modes[t]=o),this.$embeds.push(t),this.$modes[t]=o}for(var s=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],a=function(e){!function(t){var n=s[e],i=t[n];t[s[e]]=function(){return this.$delegator(n,arguments,i)}}(l)},l=this,t=0;t<s.length;t++)a(t)},this.$delegator=function(e,t,n){var i=t[0]||"start";if("string"!=typeof i){if(Array.isArray(i[2])){var r=i[2][i[2].length-1],o=this.$modes[r];if(o)return o[e].apply(o,[i[1]].concat([].slice.call(t,1)))}i=i[0]||"start"}for(var s=0;s<this.$embeds.length;s++)if(this.$modes[this.$embeds[s]]){var a=i.split(this.$embeds[s]);if(!a[0]&&a[1]){t[0]=a[1];var o=this.$modes[this.$embeds[s]];return o[e].apply(o,t)}}var l=n.apply(this,t);return n?l:void 0},this.transformAction=function(e,t,n,i,r){if(this.$behaviour){var o=this.$behaviour.getBehaviours();for(var s in o)if(o[s][t]){var a=o[s][t].apply(this,arguments);if(a)return a}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,n=[];for(var i in t)for(var r=t[i],o=0,s=r.length;o<s;o++)if("string"==typeof r[o].token)/keyword|support|storage/.test(r[o].token)&&n.push(r[o].regex);else if("object"==typeof r[o].token){for(var a=0,l=r[o].token.length;a<l;a++)if(/keyword|support|storage/.test(r[o].token[a])){var i=r[o].regex.match(/\(.+?\)/g)[a];n.push(i.substr(1,i.length-2))}}this.completionKeywords=n}return e?n.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,n,i){return(this.$keywordList||this.$createKeywordList()).map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call((i=function(){this.HighlightRules=s}).prototype),t.Mode=i}),ace.define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";t.applyDelta=function(e,t,n){var i=t.start.row,r=t.start.column,o=e[i]||"";switch(t.action){case"insert":if(1===t.lines.length)e[i]=o.substring(0,r)+t.lines[0]+o.substring(r);else{var s=[i,1].concat(t.lines);e.splice.apply(e,s),e[i]=o.substring(0,r)+e[i],e[i+t.lines.length-1]+=o.substring(r)}break;case"remove":var a=t.end.column,l=t.end.row;i===l?e[i]=o.substring(0,r)+o.substring(a):e.splice(i,l-i+1,o.substring(0,r)+e[l].substring(a))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,o=function(){function e(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),"number"!=typeof t?this.setPosition(t.row,t.column):this.setPosition(t,n)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(e){if((e.start.row!=e.end.row||e.start.row==this.row)&&!(e.start.row>this.row)){var t=a(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(t.row,t.column,!0)}},e.prototype.setPosition=function(e,t,n){if(i=n?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=i.row||this.column!=i.column){var i,r={row:this.row,column:this.column};this.row=i.row,this.column=i.column,this._signal("change",{old:r,value:i})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n},e}();function s(e,t,n){var i=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&i}function a(e,t,n){var i="insert"==e.action,r=(i?1:-1)*(e.end.row-e.start.row),o=(i?1:-1)*(e.end.column-e.start.column),a=e.start,l=i?a:e.end;return s(t,a,n)?{row:t.row,column:t.column}:s(l,t,!n)?{row:t.row+r,column:t.column+(t.row==l.row?o:0)}:{row:a.row,column:a.column}}o.prototype.$insertRight=!1,i.implement(o.prototype,r),t.Anchor=o}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./apply_delta").applyDelta,o=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,a=e("./anchor").Anchor,l=function(){function e(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return e.prototype.setValue=function(e){var t=this.getLength()-1;this.remove(new s(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e||"")},e.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},e.prototype.createAnchor=function(e,t){return new a(this,e,t)},e.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},e.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},e.prototype.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},e.prototype.getNewLineMode=function(){return this.$newLineMode},e.prototype.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},e.prototype.getLine=function(e){return this.$lines[e]||""},e.prototype.getLines=function(e,t){return this.$lines.slice(e,t+1)},e.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},e.prototype.getLength=function(){return this.$lines.length},e.prototype.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},e.prototype.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(t=this.getLines(e.start.row,e.end.row))[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},e.prototype.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},e.prototype.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},e.prototype.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},e.prototype.insert=function(e,t){return 1>=this.getLength()&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},e.prototype.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),i=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:i,action:"insert",lines:[t]},!0),this.clonePos(i)},e.prototype.clippedPos=function(e,t){var n=this.getLength();void 0===e?e=n:e<0?e=0:e>=n&&(e=n-1,t=void 0);var i=this.getLine(e);return void 0==t&&(t=i.length),{row:e,column:t=Math.min(Math.max(t,0),i.length)}},e.prototype.clonePos=function(e){return{row:e.row,column:e.column}},e.prototype.pos=function(e,t){return{row:e,column:t}},e.prototype.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},e.prototype.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},e.prototype.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),i={row:n.row+t.length-1,column:(1==t.length?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:i,action:"insert",lines:t}),this.clonePos(i)},e.prototype.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},e.prototype.removeInLine=function(e,t,n){var i=this.clippedPos(e,t),r=this.clippedPos(e,n);return this.applyDelta({start:i,end:r,action:"remove",lines:this.getLinesForRange({start:i,end:r})},!0),this.clonePos(i)},e.prototype.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1);var n=(t=Math.min(Math.max(0,t),this.getLength()-1))==this.getLength()-1&&e>0,i=t<this.getLength()-1,r=n?e-1:e,o=n?this.getLine(r).length:0,a=i?t+1:t,l=i?0:this.getLine(a).length,c=new s(r,o,a,l),u=this.$lines.slice(e,t+1);return this.applyDelta({start:c.start,end:c.end,action:"remove",lines:this.getLinesForRange(c)}),u},e.prototype.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},e.prototype.replace=function(e,t){var n;return(e instanceof s||(e=s.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty())?e.start:t==this.getTextRange(e)?e.end:(this.remove(e),n=t?this.insert(e.start,t):e.start)},e.prototype.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},e.prototype.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},e.prototype.applyDelta=function(e,t){var n="insert"==e.action;(n?!(e.lines.length<=1)||e.lines[0]:s.comparePoints(e.start,e.end))&&(n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(r(this.$lines,e,t),this._signal("change",e)))},e.prototype.$safeApplyDelta=function(e){var t=this.$lines.length;("remove"==e.action&&e.start.row<t&&e.end.row<t||"insert"==e.action&&e.start.row<=t)&&this.applyDelta(e)},e.prototype.$splitAndapplyLargeDelta=function(e,t){for(var n=e.lines,i=n.length-t+1,r=e.start.row,o=e.start.column,s=0,a=0;s<i;s=a){a+=t-1;var l=n.slice(s,a);l.push(""),this.applyDelta({start:this.pos(r+s,o),end:this.pos(r+a,o=0),action:e.action,lines:l},!0)}e.lines=n.slice(s),e.start.row=r+s,e.start.column=o,this.applyDelta(e,!0)},e.prototype.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},e.prototype.indexToPosition=function(e,t){for(var n=this.$lines||this.getAllLines(),i=this.getNewLineCharacter().length,r=t||0,o=n.length;r<o;r++)if((e-=n[r].length+i)<0)return{row:r,column:e+n[r].length+i};return{row:o-1,column:e+n[o-1].length+i}},e.prototype.positionToIndex=function(e,t){for(var n=this.$lines||this.getAllLines(),i=this.getNewLineCharacter().length,r=0,o=Math.min(e.row,n.length),s=t||0;s<o;++s)r+=n[s].length+i;return r+e.column},e.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},e}();l.prototype.$autoNewLine="",l.prototype.$newLineMode="auto",i.implement(l.prototype,o),t.Document=l}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,o=function(){function e(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var n=this;this.$worker=function(){if(n.running){for(var e=new Date,t=n.currentLine,i=-1,r=n.doc,o=t;n.lines[t];)t++;var s=r.getLength(),a=0;for(n.running=!1;t<s;){n.$tokenizeRow(t),i=t;do t++;while(n.lines[t]);if(++a%5==0&&new Date-e>20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,-1==i&&(i=t),o<=i&&n.fireUpdateEvent(o,i)}}}return e.prototype.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},e.prototype.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},e.prototype.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},e.prototype.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},e.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},e.prototype.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(0===n)this.lines[t]=null;else if("remove"==e.action)this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.lines.splice.apply(this.lines,i),this.states.splice.apply(this.states,i)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},e.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},e.prototype.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},e.prototype.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},e.prototype.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],i=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=i.state+""?(this.states[e]=i.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=i.tokens},e.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},e}();i.implement(o.prototype,r),t.BackgroundTokenizer=o}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(e,t,n){"use strict";var i=e("./lib/lang"),r=e("./range").Range,o=function(){function e(e,t,n){void 0===n&&(n="text"),this.setRegexp(e),this.clazz=t,this.type=n}return e.prototype.setRegexp=function(e){this.regExp+""!=e+""&&(this.regExp=e,this.cache=[])},e.prototype.update=function(e,t,n,o){if(this.regExp)for(var s=o.firstRow,a=o.lastRow,l={},c=s;c<=a;c++){var u=this.cache[c];null==u&&((u=i.getMatchOffsets(n.getLine(c),this.regExp)).length>this.MAX_RANGES&&(u=u.slice(0,this.MAX_RANGES)),u=u.map(function(e){return new r(c,e.offset,c,e.offset+e.length)}),this.cache[c]=u.length?u:"");for(var d=u.length;d--;){var h=u[d].toScreenRange(n),p=h.toString();l[p]||(l[p]=!0,t.drawSingleLineMarker(e,h,this.clazz,o))}}},e}();o.prototype.MAX_RANGES=500,t.SearchHighlight=o}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=function(){function e(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return e.prototype.addSession=function(e){this.$session=e},e.prototype.add=function(e,t,n){if(!this.$fromUndo&&e!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),!1===t||!this.lastDeltas){this.lastDeltas=[];var i=this.$undoStack.length;i>this.$undoDepth-1&&this.$undoStack.splice(0,i-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev}("remove"==e.action||"insert"==e.action)&&(this.$lastDelta=e),this.lastDeltas.push(e)}},e.prototype.addSelection=function(e,t){this.selections.push({value:e,rev:t||this.$rev})},e.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},e.prototype.markIgnored=function(e,t){null==t&&(t=this.$rev+1);for(var n=this.$undoStack,i=n.length;i--;){var r=n[i][0];if(r.id<=e)break;r.id<t&&(r.ignore=!0)}this.lastDeltas=null},e.prototype.getSelection=function(e,t){for(var n=this.selections,i=n.length;i--;){var r=n[i];if(r.rev<e)return t&&(r=n[i+1]),r}},e.prototype.getRevision=function(){return this.$rev},e.prototype.getDeltas=function(e,t){null==t&&(t=this.$rev+1);for(var n=this.$undoStack,i=null,r=0,o=n.length;o--;){var s=n[o][0];if(s.id<t&&!i&&(i=o+1),s.id<=e){r=o+1;break}}return n.slice(r,i)},e.prototype.getChangedRanges=function(e,t){null==t&&(t=this.$rev+1)},e.prototype.getChangedLines=function(e,t){null==t&&(t=this.$rev+1)},e.prototype.undo=function(e,t){this.lastDeltas=null;var n=this.$undoStack;if(r(n,n.length)){e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var i=n.pop(),o=null;return i&&(o=e.undoChanges(i,t),this.$redoStack.push(i),this.$syncRev()),this.$fromUndo=!1,o}},e.prototype.redo=function(e,t){if(this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var n=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);b(this.$redoStack,n),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var i=this.$redoStack.pop(),r=null;return i&&(r=e.redoChanges(i,t),this.$undoStack.push(i),this.$syncRev()),this.$fromUndo=!1,r},e.prototype.$syncRev=function(){var e=this.$undoStack,t=e[e.length-1],n=t&&t[0].id||0;this.$redoStackBaseRev=n,this.$rev=n},e.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},e.prototype.canUndo=function(){return this.$undoStack.length>0},e.prototype.canRedo=function(){return this.$redoStack.length>0},e.prototype.bookmark=function(e){void 0==e&&(e=this.$rev),this.mark=e},e.prototype.isAtBookmark=function(){return this.$rev===this.mark},e.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},e.prototype.fromJSON=function(e){this.reset(),this.$undoStack=e.$undoStack,this.$redoStack=e.$redoStack},e.prototype.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)},e}();function r(e,t){for(var n=t;n--;){var i=e[n];if(i&&!i[0].ignore){for(;n<t-1;){var r=h(e[n],e[n+1]);e[n]=r[0],e[n+1]=r[1],n++}return!0}}}i.prototype.hasUndo=i.prototype.canUndo,i.prototype.hasRedo=i.prototype.canRedo,i.prototype.isClean=i.prototype.isAtBookmark,i.prototype.markClean=i.prototype.bookmark;var o=e("./range").Range,s=o.comparePoints;function a(e){return{row:e.row,column:e.column}}function l(e){return{start:a(e.start),end:a(e.end),action:e.action,lines:e.lines.slice()}}function c(e){if(Array.isArray(e=e||this))return e.map(c).join("\n");var t="";return e.action?t=("insert"==e.action?"+":"-")+("["+e.lines)+"]":e.value&&(t=Array.isArray(e.value)?e.value.map(u).join("\n"):u(e.value)),e.start&&(t+=u(e)),(e.id||e.rev)&&(t+=" ("+(e.id||e.rev)+")"),t}function u(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function d(e,t){var n="insert"==e.action,i="insert"==t.action;if(n&&i)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.start,e.start)))return null;f(e,t,1)}else if(n&&!i)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.end,e.start)))return null;f(e,t,-1)}else if(!n&&i)if(s(t.start,e.start)>=0)f(t,e,1);else{if(!(0>=s(t.start,e.start)))return null;f(e,t,1)}else if(!n&&!i)if(s(t.start,e.start)>=0)f(t,e,1);else{if(!(0>=s(t.end,e.start)))return null;f(e,t,-1)}return[t,e]}function h(e,t){for(var n=e.length;n--;)for(var i=0;i<t.length;i++)if(!d(e[n],t[i])){for(;n<e.length;){for(;i--;)d(t[i],e[n]);i=t.length,n++}return[e,t]}return e.selectionBefore=t.selectionBefore=e.selectionAfter=t.selectionAfter=null,[t,e]}function p(e,t){var n,i,r="insert"==e.action,a="insert"==t.action;if(r&&a)0>s(e.start,t.start)?f(t,e,1):f(e,t,1);else if(r&&!a)s(e.start,t.end)>=0?f(e,t,-1):(0>=s(e.start,t.start)||f(e,o.fromPoints(t.start,e.start),-1),f(t,e,1));else if(!r&&a)s(t.start,e.end)>=0?f(t,e,-1):(0>=s(t.start,e.start)||f(t,o.fromPoints(e.start,t.start),-1),f(e,t,1));else if(!r&&!a)if(s(t.start,e.end)>=0)f(t,e,-1);else{if(!(0>=s(t.end,e.start)))return 0>s(e.start,t.start)&&(n=e,e=m(e,t.start)),s(e.end,t.end)>0&&(i=m(e,t.end)),g(t.end,e.start,e.end,-1),i&&!n&&(e.lines=i.lines,e.start=i.start,e.end=i.end,i=e),[t,n,i].filter(Boolean);f(e,t,-1)}return[t,e]}function f(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,i){e.row==(1==i?t:n).row&&(e.column+=i*(n.column-t.column)),e.row+=i*(n.row-t.row)}function m(e,t){var n=e.lines,i=e.end;e.end=a(t);var r=e.end.row-e.start.row,o=n.splice(r,n.length),s=r?t.column:t.column-e.start.column;return n.push(o[0].substring(0,s)),o[0]=o[0].substr(s),{start:a(t),end:i,lines:o,action:e.action}}function v(e,t){t=l(t);for(var n=e.length;n--;){for(var i=e[n],r=0;r<i.length;r++){var o=p(i[r],t);t=o[0],2!=o.length&&(o[2]?(i.splice(r+1,1,o[1],o[2]),r++):!o[1]&&(i.splice(r,1),r--))}i.length||e.splice(n,1)}return e}function b(e,t){for(var n=0;n<t.length;n++)for(var i=t[n],r=0;r<i.length;r++)v(e,i[r])}o.comparePoints,t.UndoManager=i}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("../range").Range;t.FoldLine=function(){function e(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new i(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}return e.prototype.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},e.prototype.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):0>this.range.compareStart(e.end.row,e.end.column)&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else if(e.end.row==this.start.row)this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column;else throw Error("Trying to add fold to FoldRow that doesn't have a matching row");e.foldLine=this},e.prototype.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},e.prototype.walk=function(e,t,n){var i,r,o,s=0,a=this.folds,l=!0;null==t&&(t=this.end.row,n=this.end.column);for(var c=0;c<a.length;c++){if(-1==(r=(i=a[c]).range.compareStart(t,n)))return void e(null,t,n,s,l);if((o=!(o=e(null,i.start.row,i.start.column,s,l))&&e(i.placeholder,i.start.row,i.start.column,s))||0===r)return;l=!i.sameRow,s=i.end.column}e(null,t,n,s,l)},e.prototype.getNextFoldTo=function(e,t){for(var n,i,r=0;r<this.folds.length;r++){if(-1==(i=(n=this.folds[r]).range.compareEnd(e,t)))return{fold:n,kind:"after"};if(0===i)return{fold:n,kind:"inside"}}return null},e.prototype.addRemoveChars=function(e,t,n){var i,r,o=this.getNextFoldTo(e,t);if(o){if(i=o.fold,"inside"==o.kind&&i.start.column!=t&&i.start.row!=e)window.console&&window.console.log(e,t,i);else if(i.start.row==e){var s=(r=this.folds).indexOf(i);for(0===s&&(this.start.column+=n);s<r.length;s++){if(i=r[s],i.start.column+=n,!i.sameRow)return;i.end.column+=n}this.end.column+=n}}},e.prototype.split=function(t,n){var i=this.getNextFoldTo(t,n);if(!i||"inside"==i.kind)return null;var r=i.fold,o=this.folds,s=this.foldData,a=o.indexOf(r),l=o[a-1];this.end.row=l.end.row,this.end.column=l.end.column;var c=new e(s,o=o.splice(a,o.length-a));return s.splice(s.indexOf(this)+1,0,c),c},e.prototype.merge=function(e){for(var t=e.folds,n=0;n<t.length;n++)this.addFold(t[n]);var i=this.foldData;i.splice(i.indexOf(e),1)},e.prototype.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push(" "+t.toString())}),e.push("]"),e.join("\n")},e.prototype.idxToPosition=function(e){for(var t=0,n=0;n<this.folds.length;n++){var i=this.folds[n];if((e-=i.start.column-t)<0)return{row:i.start.row,column:i.start.column+e};if((e-=i.placeholder.length)<0)return i.start;t=i.end.column}return{row:this.end.row,column:this.end.column+e}},e}()}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("./range").Range.comparePoints,r=function(){function e(){this.ranges=[],this.$bias=1}return e.prototype.pointIndex=function(e,t,n){for(var r=this.ranges,o=n||0;o<r.length;o++){var s=r[o],a=i(e,s.end);if(!(a>0)){var l=i(e,s.start);if(0===a)return t&&0!==l?-o-2:o;if(l>0||0===l&&!t)return o;break}}return-o-1},e.prototype.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var i=this.pointIndex(e.end,t,n);return i<0?i=-i-1:i++,this.ranges.splice(n,i-n,e)},e.prototype.addList=function(e){for(var t=[],n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},e.prototype.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},e.prototype.merge=function(){for(var e,t=[],n=this.ranges,r=(n=n.sort(function(e,t){return i(e.start,t.start)}))[0],o=1;o<n.length;o++){e=r,r=n[o];var s=i(e.end,r.start);!(s<0)&&(0!=s||e.isEmpty()||r.isEmpty())&&(0>i(e.end,r.end)&&(e.end.row=r.end.row,e.end.column=r.end.column),n.splice(o,1),t.push(r),r=e,o--)}return this.ranges=n,t},e.prototype.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},e.prototype.containsPoint=function(e){return this.pointIndex(e)>=0},e.prototype.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},e.prototype.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row<e)return[];var i=this.pointIndex({row:e,column:0});i<0&&(i=-i-1);var r=this.pointIndex({row:t,column:0},i);r<0&&(r=-r-1);for(var o=[],s=i;s<r;s++)o.push(n[s]);return o},e.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},e.prototype.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},e.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},e.prototype.$onChange=function(e){for(var t=e.start,n=e.end,i=t.row,r=n.row,o=this.ranges,s=0,a=o.length;s<a;s++){var l=o[s];if(l.end.row>=i)break}if("insert"==e.action)for(var c=r-i,u=-t.column+n.column;s<a;s++){var l=o[s];if(l.start.row>i)break;if(l.start.row==i&&l.start.column>=t.column&&(l.start.column==t.column&&this.$bias<=0||(l.start.column+=u,l.start.row+=c)),l.end.row==i&&l.end.column>=t.column){if(l.end.column==t.column&&this.$bias<0)continue;l.end.column==t.column&&u>0&&s<a-1&&l.end.column>l.start.column&&l.end.column==o[s+1].start.column&&(l.end.column-=u),l.end.column+=u,l.end.row+=c}}else for(var c=i-r,u=t.column-n.column;s<a;s++){var l=o[s];if(l.start.row>r)break;l.end.row<r&&(i<l.end.row||i==l.end.row&&t.column<l.end.column)?(l.end.row=i,l.end.column=t.column):l.end.row==r?l.end.column<=n.column?(c||l.end.column>t.column)&&(l.end.column=t.column,l.end.row=t.row):(l.end.column+=u,l.end.row+=c):l.end.row>r&&(l.end.row+=c),l.start.row<r&&(i<l.start.row||i==l.start.row&&t.column<l.start.column)?(l.start.row=i,l.start.column=t.column):l.start.row==r?l.start.column<=n.column?(c||l.start.column>t.column)&&(l.start.column=t.column,l.start.row=t.row):(l.start.column+=u,l.start.row+=c):l.start.row>r&&(l.start.row+=c)}if(0!=c&&s<a)for(;s<a;s++){var l=o[s];l.start.row+=c,l.end.row+=c}},e}();r.prototype.comparePoints=i,t.RangeList=r}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();function r(e,t){e.row-=t.row,0==e.row&&(e.column-=t.column)}function o(e,t){r(e.start,t),r(e.end,t)}function s(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row}function a(e,t){s(e.start,t),s(e.end,t)}t.Fold=function(e){function t(t,n){var i=e.call(this)||this;return i.foldLine=null,i.placeholder=n,i.range=t,i.start=t.start,i.end=t.end,i.sameRow=t.start.row==t.end.row,i.subFolds=i.ranges=[],i}return i(t,e),t.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},t.prototype.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},t.prototype.clone=function(){var e=new t(this.range.clone(),this.placeholder);return this.subFolds.forEach(function(t){e.subFolds.push(t.clone())}),e.collapseChildren=this.collapseChildren,e},t.prototype.addSubFold=function(e){if(!this.range.isEqual(e)){o(e,this.start);for(var t=e.start.row,n=e.start.column,i=0,r=-1;i<this.subFolds.length&&1==(r=this.subFolds[i].range.compare(t,n));i++);var s=this.subFolds[i],a=0;if(0==r)if(s.range.containsRange(e))return s.addSubFold(e);else a=1;for(var t=e.range.end.row,n=e.range.end.column,l=i,r=-1;l<this.subFolds.length&&1==(r=this.subFolds[l].range.compare(t,n));l++);0==r&&l++;for(var c=this.subFolds.splice(i,l-i,e),u=0==r?c.length-1:c.length,d=a;d<u;d++)e.addSubFold(c[d]);return e.setFoldLine(this.foldLine),e}},t.prototype.restoreRange=function(e){return a(e,this.start)},t}(e("../range_list").RangeList)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(e,t,n){"use strict";var i=e("../range").Range,r=e("./fold_line").FoldLine,o=e("./fold").Fold,s=e("../token_iterator").TokenIterator,a=e("../mouse/mouse_event").MouseEvent;t.Folding=function(){this.getFoldAt=function(e,t,n){var i=this.getFoldLine(e);if(!i)return null;for(var r=i.folds,o=0;o<r.length;o++){var s=r[o].range;if(s.contains(e,t)){if(1==n&&s.isEnd(e,t)&&!s.isEmpty()||-1==n&&s.isStart(e,t)&&!s.isEmpty())continue;return r[o]}}},this.getFoldsInRange=function(e){var t=e.start,n=e.end,i=this.$foldData,r=[];t.column+=1,n.column-=1;for(var o=0;o<i.length;o++){var s=i[o].range.compareRange(e);if(2!=s){if(-2==s)break;for(var a=i[o].folds,l=0;l<a.length;l++){var c=a[l];if(-2==(s=c.range.compareRange(e)))break;if(2!=s){if(42==s)break;r.push(c)}}}}return t.column-=1,n.column+=1,r},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){for(var e=[],t=this.$foldData,n=0;n<t.length;n++)for(var i=0;i<t[n].folds.length;i++)e.push(t[n].folds[i]);return e},this.getFoldStringAt=function(e,t,n,i){if(!(i=i||this.getFoldLine(e)))return null;for(var r,o,s={end:{column:0}},a=0;a<i.folds.length;a++){var l=(o=i.folds[a]).range.compareEnd(e,t);if(-1==l){r=this.getLine(o.start.row).substring(s.end.column,o.start.column);break}if(0===l)return null;s=o}return(r||(r=this.getLine(o.start.row).substring(s.end.column)),-1==n)?r.substring(0,t-s.end.column):1==n?r.substring(t-s.end.column):r},this.getFoldLine=function(e,t){var n=this.$foldData,i=0;for(t&&(i=n.indexOf(t)),-1==i&&(i=0);i<n.length;i++){var r=n[i];if(r.start.row<=e&&r.end.row>=e)return r;if(r.end.row>e)break}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,i=0;for(t&&(i=n.indexOf(t)),-1==i&&(i=0);i<n.length;i++){var r=n[i];if(r.end.row>=e)return r}return null},this.getFoldedRowCount=function(e,t){for(var n=this.$foldData,i=t-e+1,r=0;r<n.length;r++){var o=n[r],s=o.end.row,a=o.start.row;if(s>=t){a<t&&(a>=e?i-=t-a:i=0);break}s>=e&&(a>=e?i-=s-a:i-=s-e+1)}return i},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n,i=this.$foldData,s=!1;e instanceof o?n=e:(n=new o(t,e)).collapseChildren=t.collapseChildren,this.$clipRangeToDocument(n.range);var a=n.start.row,l=n.start.column,c=n.end.row,u=n.end.column,d=this.getFoldAt(a,l,1),h=this.getFoldAt(c,u,-1);if(d&&h==d)return d.addSubFold(n);d&&!d.range.isStart(a,l)&&this.removeFold(d),h&&!h.range.isEnd(c,u)&&this.removeFold(h);var p=this.getFoldsInRange(n.range);p.length>0&&(this.removeFolds(p),n.collapseChildren||p.forEach(function(e){n.addSubFold(e)}));for(var f=0;f<i.length;f++){var g=i[f];if(c==g.start.row){g.addFold(n),s=!0;break}if(a==g.end.row){if(g.addFold(n),s=!0,!n.sameRow){var m=i[f+1];m&&m.start.row==c&&g.merge(m)}break}if(c<=g.start.row)break}return s||(g=this.$addFoldLine(new r(this.$foldData,n))),this.$useWrapMode?this.$updateWrapData(g.start.row,g.start.row):this.$updateRowLengthCache(g.start.row,g.start.row),this.$modified=!0,this._signal("changeFold",{data:n,action:"add"}),n},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,n=t.start.row,i=t.end.row,r=this.$foldData,o=t.folds;if(1==o.length)r.splice(r.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))o.pop(),t.end.row=o[o.length-1].end.row,t.end.column=o[o.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))o.shift(),t.start.row=o[0].start.row,t.start.column=o[0].start.column;else if(e.sameRow)o.splice(o.indexOf(e),1);else{var s=t.split(e.start.row,e.start.column);(o=s.folds).shift(),s.start.row=o[0].start.row,s.start.column=o[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(n,i):this.$updateRowLengthCache(n,i)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){if(null==e)n=new i(0,0,this.getLength(),0),null==t&&(t=!0);else if("number"==typeof e)n=new i(e,0,e,this.getLine(e).length);else if("row"in e)n=i.fromPoints(e,e);else{if(Array.isArray(e))return r=[],e.forEach(function(e){r=r.concat(this.unfold(e))},this),r;n=e}for(var n,r=this.getFoldsInRangeList(n),o=r;1==r.length&&0>i.comparePoints(r[0].start,n.start)&&i.comparePoints(r[0].end,n.end)>0;)this.expandFolds(r),r=this.getFoldsInRangeList(n);if(!1!=t?this.removeFolds(r):this.expandFolds(r),o.length)return o},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,i,r){null==i&&(i=e.start.row),null==r&&(r=0),null==t&&(t=e.end.row),null==n&&(n=this.getLine(t).length);var o=this.doc,s="";return e.walk(function(e,t,n,a){if(!(t<i)){if(t==i){if(n<r)return;a=Math.max(r,a)}null!=e?s+=e:s+=o.getLine(t).substring(a,n)}},t,n),s},this.getDisplayLine=function(e,t,n,i){var r,o=this.getFoldLine(e);return o?this.getFoldDisplayLine(o,e,t,n,i):(r=this.doc.getLine(e)).substring(i||0,t||r.length)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var n=t.folds.map(function(e){return e.clone()});return new r(e,n)})},this.toggleFold=function(e){var t,n,i=this.selection.getRange();if(i.isEmpty()){var r=i.start;if(t=this.getFoldAt(r.row,r.column))return void this.expandFold(t);(n=this.findMatchingBracket(r))?1==i.comparePoint(n)?i.end=n:(i.start=n,i.start.column++,i.end.column--):(n=this.findMatchingBracket({row:r.row,column:r.column+1}))?(1==i.comparePoint(n)?i.end=n:i.start=n,i.start.column++):i=this.getCommentFoldRange(r.row,r.column)||i}else{var o=this.getFoldsInRange(i);if(e&&o.length)return void this.expandFolds(o);1==o.length&&(t=o[0])}if(t||(t=this.getFoldAt(i.start.row,i.start.column)),t&&t.range.toString()==i.toString())return void this.expandFold(t);var s="...";if(!i.isMultiLine()){if((s=this.getTextRange(i)).length<4)return;s=s.trim().substring(0,2)+".."}this.addFold(s,i)},this.getCommentFoldRange=function(e,t,n){var r=new s(this,e,t),o=r.getCurrentToken(),a=o&&o.type;if(o&&/^comment|string/.test(a)){"comment"==(a=a.match(/comment|string/)[0])&&(a+="|doc-start|\\.doc");var l=new RegExp(a),c=new i;if(1!=n){do o=r.stepBackward();while(o&&l.test(o.type));o=r.stepForward()}c.start.row=r.getCurrentTokenRow(),c.start.column=r.getCurrentTokenColumn()+o.value.length,r=new s(this,e,t);var u=this.getState(r.$row);if(-1!=n){var d=-1;do if(o=r.stepForward(),-1==d){var h=this.getState(r.$row);u.toString()!==h.toString()&&(d=r.$row)}else if(r.$row>d)break;while(o&&l.test(o.type));o=r.stepBackward()}else o=r.getCurrentToken();return c.end.row=r.getCurrentTokenRow(),c.end.column=r.getCurrentTokenColumn(),c}},this.foldAll=function(e,t,n,i){void 0==n&&(n=1e5);var r=this.foldWidgets;if(r){t=t||this.getLength(),e=e||0;for(var o=e;o<t;o++)if((null==r[o]&&(r[o]=this.getFoldWidget(o)),"start"==r[o])&&(!i||i(o))){var s=this.getFoldWidgetRange(o);s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e&&(o=s.end.row,s.collapseChildren=n,this.addFold("...",s))}}},this.foldToLevel=function(e){for(this.foldAll();e-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var e=this;this.foldAll(null,null,null,function(t){for(var n=e.getTokens(t),i=0;i<n.length;i++){var r=n[i];if(!("text"==r.type&&/^\s+$/.test(r.value))){if(/comment/.test(r.type))return!0;return!1}}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=e){this.$foldStyle=e,"manual"==e&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)}},this.$setFolding=function(e){if(this.$foldMode!=e){if(this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!e||"manual"==this.$foldStyle){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};for(var i,r=e-1;r>=0;){var o=n[r];if(null==o&&(o=n[r]=this.getFoldWidget(r)),"start"==o){var s=this.getFoldWidgetRange(r);if(i||(i=s),s&&s.end.row>=e)break}r--}return{range:-1!==r&&s,firstRange:i}},this.onFoldWidgetClick=function(e,t){t instanceof a&&(t=t.domEvent);var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey};if(!this.$toggleFoldWidget(e,n)){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(this.getFoldWidget){var n=this.getFoldWidget(e),i=this.getLine(e),r="end"===n?-1:1,o=this.getFoldAt(e,-1===r?0:i.length,r);if(o)return t.children||t.all?this.removeFold(o):this.expandFold(o),o;var s=this.getFoldWidgetRange(e,!0);if(s&&!s.isMultiLine()&&(o=this.getFoldAt(s.start.row,s.start.column,1))&&s.isEqual(o.range))return this.removeFold(o),o;if(t.siblings){var a=this.getParentFoldRangeData(e);if(a.range)var l=a.range.start.row+1,c=a.range.end.row;this.foldAll(l,c,1e4*!!t.all)}else t.children?(c=s?s.end.row:this.getLength(),this.foldAll(e+1,c,1e4*!!t.all)):s&&(t.all&&(s.collapseChildren=1e4),this.addFold("...",s));return s}},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(!n){var i=this.getParentFoldRangeData(t,!0);if(n=i.range||i.firstRange){t=n.start.row;var r=this.getFoldAt(t,this.getLine(t).length,1);r?this.removeFold(r):this.addFold("...",n)}}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(0===n)this.foldWidgets[t]=null;else if("remove"==e.action)this.foldWidgets.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,i)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var i=e("../token_iterator").TokenIterator,r=e("../range").Range;t.BracketMatch=function(){this.findMatchingBracket=function(e,t){if(0==e.column)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(""==n)return null;var i=n.match(/([\(\[\{])|([\)\]\}])/);return i?i[1]?this.$findClosingBracket(i[1],e):this.$findOpeningBracket(i[2],e):null},this.getBracketRange=function(e){var t,n=this.getLine(e.row),i=!0,o=n.charAt(e.column-1),s=o&&o.match(/([\(\[\{])|([\)\]\}])/);if(s||(o=n.charAt(e.column),e={row:e.row,column:e.column+1},s=o&&o.match(/([\(\[\{])|([\)\]\}])/),i=!1),!s)return null;if(s[1]){var a=this.$findClosingBracket(s[1],e);if(!a)return null;t=r.fromPoints(e,a),!i&&(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(s[2],e);if(!a)return null;t=r.fromPoints(a,e),!i&&(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(e,t){var n=this.getLine(e.row),i=/([\(\[\{])|([\)\]\}])/,o=!t&&n.charAt(e.column-1),s=o&&o.match(i);if(s||(o=(void 0===t||t)&&n.charAt(e.column),e={row:e.row,column:e.column+1},s=o&&o.match(i)),!s)return null;var a=new r(e.row,e.column-1,e.row,e.column),l=s[1]?this.$findClosingBracket(s[1],e):this.$findOpeningBracket(s[2],e);return l?[a,new r(l.row,l.column,l.row,l.column+1)]:[a]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,n){var r=this.$brackets[e],o=1,s=new i(this,t.row,t.column),a=s.getCurrentToken();if(a||(a=s.stepForward()),a){n||(n=RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var l=t.column-s.getCurrentTokenColumn()-2,c=a.value;;){for(;l>=0;){var u=c.charAt(l);if(u==r){if(0==(o-=1))return{row:s.getCurrentTokenRow(),column:l+s.getCurrentTokenColumn()}}else u==e&&(o+=1);l-=1}do a=s.stepBackward();while(a&&!n.test(a.type));if(null==a)break;l=(c=a.value).length-1}return null}},this.$findClosingBracket=function(e,t,n){var r=this.$brackets[e],o=1,s=new i(this,t.row,t.column),a=s.getCurrentToken();if(a||(a=s.stepForward()),a){n||(n=RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var l=t.column-s.getCurrentTokenColumn();;){for(var c=a.value,u=c.length;l<u;){var d=c.charAt(l);if(d==r){if(0==(o-=1))return{row:s.getCurrentTokenRow(),column:l+s.getCurrentTokenColumn()}}else d==e&&(o+=1);l+=1}do a=s.stepForward();while(a&&!n.test(a.type));if(null==a)break;l=0}return null}},this.getMatchingTags=function(e){var t=new i(this,e.row,e.column),n=this.$findTagName(t);if(n){var r=t.stepBackward();return"<"===r.value?this.$findClosingTag(t,n):this.$findOpeningTag(t,n)}},this.$findTagName=function(e){var t=e.getCurrentToken(),n=!1,i=!1;if(t&&-1===t.type.indexOf("tag-name"))do(t=i?e.stepBackward():e.stepForward())&&("/>"===t.value?i=!0:-1!==t.type.indexOf("tag-name")&&(n=!0));while(t&&!n);return t},this.$findClosingTag=function(e,t){var n,i=t.value,o=t.value,s=0,a=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);t=e.stepForward();var l=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length),c=!1;do{if(-1!==(n=t).type.indexOf("tag-close")&&!c){var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);c=!0}if(t=e.stepForward()){if(">"===t.value&&!c){var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);c=!0}if(-1!==t.type.indexOf("tag-name")){if(o===(i=t.value)){if("<"===n.value)s++;else if("</"===n.value&&--s<0){e.stepBackward();var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2);t=e.stepForward();var h=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length);if(-1===t.type.indexOf("tag-close")&&(t=e.stepForward()),!t||">"!==t.value)return;var p=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}}else if(o===i&&"/>"===t.value&&--s<0)var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+2),h=d,p=h,u=new r(l.end.row,l.end.column,l.end.row,l.end.column+1)}}while(t&&s>=0);if(a&&u&&d&&p&&l&&h)return{openTag:new r(a.start.row,a.start.column,u.end.row,u.end.column),closeTag:new r(d.start.row,d.start.column,p.end.row,p.end.column),openTagName:l,closeTagName:h}},this.$findOpeningTag=function(e,t){var n=e.getCurrentToken(),i=t.value,o=0,s=e.getCurrentTokenRow(),a=e.getCurrentTokenColumn(),l=a+2,c=new r(s,a,s,l);e.stepForward();var u=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+t.value.length);if(-1===t.type.indexOf("tag-close")&&(t=e.stepForward()),t&&">"===t.value){var d=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);e.stepBackward(),e.stepBackward();do if(t=n,s=e.getCurrentTokenRow(),l=(a=e.getCurrentTokenColumn())+t.value.length,n=e.stepBackward(),t){if(-1!==t.type.indexOf("tag-name")){if(i===t.value)if("<"===n.value){if(++o>0){var h=new r(s,a,s,l),p=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1);do t=e.stepForward();while(t&&">"!==t.value);var f=new r(e.getCurrentTokenRow(),e.getCurrentTokenColumn(),e.getCurrentTokenRow(),e.getCurrentTokenColumn()+1)}}else"</"===n.value&&o--}else if("/>"===t.value){for(var g=0,m=n;m;){if(-1!==m.type.indexOf("tag-name")&&m.value===i){o--;break}if("<"===m.value)break;m=e.stepBackward(),g++}for(var v=0;v<g;v++)e.stepForward()}}while(n&&o<=0);if(p&&f&&c&&d&&h&&u)return{openTag:new r(p.start.row,p.start.column,f.end.row,f.end.column),closeTag:new r(c.start.row,c.start.column,d.end.row,d.end.column),openTagName:h,closeTagName:u}}}}}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/lang"),o=e("./bidihandler").BidiHandler,s=e("./config"),a=e("./lib/event_emitter").EventEmitter,l=e("./selection").Selection,c=e("./mode/text").Mode,u=e("./range").Range,d=e("./document").Document,h=e("./background_tokenizer").BackgroundTokenizer,p=e("./search_highlight").SearchHighlight,f=e("./undomanager").UndoManager,g=function(){function e(t,n){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.prevOp={},this.$foldData=[],this.id="session"+ ++e.$uid,this.$foldData.toString=function(){return this.join("\n")},this.bgTokenizer=new h(new c().getTokenizer(),this);var i=this;this.bgTokenizer.on("update",function(e){i._signal("tokenizerUpdate",e)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),"object"==typeof t&&t.getLine||(t=new d(t)),this.setDocument(t),this.selection=new l(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new o(this),s.resetOptions(this),this.setMode(n),s._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return e.prototype.$initOperationListeners=function(){var e=this;this.curOp=null,this.on("change",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.docChanged=!0},!0),this.on("changeSelection",function(){e.curOp||(e.startOperation(),e.curOp.selectionBefore=e.$lastSel),e.curOp.selectionChanged=!0},!0),this.$operationResetTimer=r.delayedCall(this.endOperation.bind(this,!0))},e.prototype.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(e={}),this.$operationResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",e)},e.prototype.endOperation=function(e){if(this.curOp){if(e&&!1===e.returnValue){this.curOp=null,this._signal("endOperation",e);return}if(!0!=e||!this.curOp.command||"mouse"!=this.curOp.command.name){var t=this.selection.toJSON();this.curOp.selectionAfter=t,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(t),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",e)}}},e.prototype.setDocument=function(e){this.doc&&this.doc.off("change",this.$onChange),this.doc=e,e.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},e.prototype.getDocument=function(){return this.doc},e.prototype.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},e.prototype.$getRowCacheIndex=function(e,t){for(var n=0,i=e.length-1;n<=i;){var r=n+i>>1,o=e[r];if(t>o)n=r+1;else{if(!(t<o))return r;i=r-1}}return n-1},e.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},e.prototype.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},e.prototype.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},e.prototype.onSelectionChange=function(){this._signal("changeSelection")},e.prototype.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},e.fromJSON=function(t){"string"==typeof t&&(t=JSON.parse(t));var n=new f;n.$undoStack=t.history.undo,n.$redoStack=t.history.redo,n.mark=t.history.mark,n.$rev=t.history.rev;var i=new e(t.value);return t.folds.forEach(function(e){i.addFold("...",u.fromPoints(e.start,e.end))}),i.setAnnotations(t.annotations),i.setBreakpoints(t.breakpoints),i.setMode(t.mode),i.setScrollLeft(t.scrollLeft),i.setScrollTop(t.scrollTop),i.setUndoManager(n),i.selection.fromJSON(t.selection),i},e.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(e){return e.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},e.prototype.toString=function(){return this.doc.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.getState=function(e){return this.bgTokenizer.getState(e)},e.prototype.getTokens=function(e){return this.bgTokenizer.getTokens(e)},e.prototype.getTokenAt=function(e,t){var n,i=this.bgTokenizer.getTokens(e),r=0;if(null==t){var o=i.length-1;r=this.getLine(e).length}else for(var o=0;o<i.length&&!((r+=i[o].value.length)>=t);o++);return(n=i[o])?(n.index=o,n.start=r-n.value.length,n):null},e.prototype.setUndoManager=function(e){if(this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel(),e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=r.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},e.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},e.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},e.prototype.getTabString=function(){return this.getUseSoftTabs()?r.stringRepeat(" ",this.getTabSize()):" "},e.prototype.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},e.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},e.prototype.setTabSize=function(e){this.setOption("tabSize",e)},e.prototype.getTabSize=function(){return this.$tabSize},e.prototype.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize==0},e.prototype.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},e.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},e.prototype.setOverwrite=function(e){this.setOption("overwrite",e)},e.prototype.getOverwrite=function(){return this.$overwrite},e.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},e.prototype.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},e.prototype.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},e.prototype.getBreakpoints=function(){return this.$breakpoints},e.prototype.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},e.prototype.setBreakpoint=function(e,t){void 0===t&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},e.prototype.addMarker=function(e,t,n,i){var r=this.$markerId++,o={range:e,type:n||"line",renderer:"function"==typeof n?n:null,clazz:t,inFront:!!i,id:r};return i?(this.$frontMarkers[r]=o,this._signal("changeFrontMarker")):(this.$backMarkers[r]=o,this._signal("changeBackMarker")),r},e.prototype.addDynamicMarker=function(e,t){if(e.update){var n=this.$markerId++;return e.id=n,e.inFront=!!t,t?(this.$frontMarkers[n]=e,this._signal("changeFrontMarker")):(this.$backMarkers[n]=e,this._signal("changeBackMarker")),e}},e.prototype.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(t){var n=t.inFront?this.$frontMarkers:this.$backMarkers;delete n[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")}},e.prototype.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},e.prototype.highlight=function(e){if(!this.$searchHighlight){var t=new p(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},e.prototype.highlightLines=function(e,t,n,i){"number"!=typeof t&&(n=t,t=e),n||(n="ace_step");var r=new u(e,0,t,1/0);return r.id=this.addMarker(r,n,"fullLine",i),r},e.prototype.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},e.prototype.getAnnotations=function(){return this.$annotations||[]},e.prototype.clearAnnotations=function(){this.setAnnotations([])},e.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);t?this.$autoNewLine=t[1]:this.$autoNewLine="\n"},e.prototype.getWordRange=function(e,t){var n=this.getLine(e),i=!1;if(t>0&&(i=!!n.charAt(t-1).match(this.tokenRe)),i||(i=!!n.charAt(t).match(this.tokenRe)),i)var r=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var r=/\s/;else var r=this.nonTokenRe;var o=t;if(o>0){do o--;while(o>=0&&n.charAt(o).match(r));o++}for(var s=t;s<n.length&&n.charAt(s).match(r);)s++;return new u(e,o,e,s)},e.prototype.getAWordRange=function(e,t){for(var n=this.getWordRange(e,t),i=this.getLine(n.end.row);i.charAt(n.end.column).match(/[ \t]/);)n.end.column+=1;return n},e.prototype.setNewLineMode=function(e){this.doc.setNewLineMode(e)},e.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},e.prototype.setUseWorker=function(e){this.setOption("useWorker",e)},e.prototype.getUseWorker=function(){return this.$useWorker},e.prototype.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},e.prototype.setMode=function(e,t){if(e&&"object"==typeof e){if(e.getTokenizer)return this.$onChangeMode(e);var n=e,i=n.path}else i=e||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new c),this.$modes[i]&&!n){this.$onChangeMode(this.$modes[i]),t&&t();return}this.$modeId=i,s.loadModule(["mode",i],(function(e){if(this.$modeId!==i)return t&&t();this.$modes[i]&&!n?this.$onChangeMode(this.$modes[i]):e&&e.Mode&&(e=new e.Mode(n),n||(this.$modes[i]=e,e.$id=i),this.$onChangeMode(e)),t&&t()}).bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},e.prototype.$onChangeMode=function(e,t){if(t||(this.$modeId=e.$id),this.$mode!==e){var n=this.$mode;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var i=e.getTokenizer();if(void 0!==i.on){var r=this.onReloadTokenizer.bind(this);i.on("update",r)}this.bgTokenizer.setTokenizer(i),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:n,mode:e}))}},e.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},e.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){s.warn("Could not load worker",e),this.$worker=null}},e.prototype.getMode=function(){return this.$mode},e.prototype.setScrollTop=function(e){this.$scrollTop===e||isNaN(e)||(this.$scrollTop=e,this._signal("changeScrollTop",e))},e.prototype.getScrollTop=function(){return this.$scrollTop},e.prototype.setScrollLeft=function(e){this.$scrollLeft===e||isNaN(e)||(this.$scrollLeft=e,this._signal("changeScrollLeft",e))},e.prototype.getScrollLeft=function(){return this.$scrollLeft},e.prototype.getScreenWidth=function(){return(this.$computeWidth(),this.lineWidgets)?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},e.prototype.getLineWidgetMaxWidth=function(){if(null!=this.lineWidgetsWidth)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},e.prototype.$computeWidth=function(e){if(this.$modified||e){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var t=this.doc.getAllLines(),n=this.$rowLengthCache,i=0,r=0,o=this.$foldData[r],s=o?o.start.row:1/0,a=t.length,l=0;l<a;l++){if(l>s){if((l=o.end.row+1)>=a)break;s=(o=this.$foldData[r++])?o.start.row:1/0}null==n[l]&&(n[l]=this.$getStringScreenWidth(t[l])[0]),n[l]>i&&(i=n[l])}this.screenWidth=i}},e.prototype.getLine=function(e){return this.doc.getLine(e)},e.prototype.getLines=function(e,t){return this.doc.getLines(e,t)},e.prototype.getLength=function(){return this.doc.getLength()},e.prototype.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},e.prototype.insert=function(e,t){return this.doc.insert(e,t)},e.prototype.remove=function(e){return this.doc.remove(e)},e.prototype.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},e.prototype.undoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var n=e.length-1;-1!=n;n--){var i=e[n];"insert"==i.action||"remove"==i.action?this.doc.revertDelta(i):i.folds&&this.addFolds(i.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1}},e.prototype.redoChanges=function(e,t){if(e.length){this.$fromUndo=!0;for(var n=0;n<e.length;n++){var i=e[n];("insert"==i.action||"remove"==i.action)&&this.doc.$safeApplyDelta(i)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1}},e.prototype.setUndoSelect=function(e){this.$undoSelect=e},e.prototype.$getUndoSelection=function(e,t){function n(e){return t?"insert"!==e.action:"insert"===e.action}for(var i,r,o=0;o<e.length;o++){var s=e[o];if(s.start){if(!i){i=n(s)?u.fromPoints(s.start,s.end):u.fromPoints(s.start,s.start);continue}n(s)?(r=s.start,-1==i.compare(r.row,r.column)&&i.setStart(r),r=s.end,1==i.compare(r.row,r.column)&&i.setEnd(r)):(r=s.start,-1==i.compare(r.row,r.column)&&(i=u.fromPoints(s.start,s.start)))}}return i},e.prototype.replace=function(e,t){return this.doc.replace(e,t)},e.prototype.moveText=function(e,t,n){var i=this.getTextRange(e),r=this.getFoldsInRange(e),o=u.fromPoints(t,t);if(!n){this.remove(e);var s=e.start.row-e.end.row,a=s?-e.end.column:e.start.column-e.end.column;a&&(o.start.row==e.end.row&&o.start.column>e.end.column&&(o.start.column+=a),o.end.row==e.end.row&&o.end.column>e.end.column&&(o.end.column+=a)),s&&o.start.row>=e.end.row&&(o.start.row+=s,o.end.row+=s)}if(o.end=this.insert(o.start,i),r.length){var l=e.start,c=o.start,s=c.row-l.row,a=c.column-l.column;this.addFolds(r.map(function(e){return(e=e.clone()).start.row==l.row&&(e.start.column+=a),e.end.row==l.row&&(e.end.column+=a),e.start.row+=s,e.end.row+=s,e}))}return o},e.prototype.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var i=e;i<=t;i++)this.doc.insertInLine({row:i,column:0},n)},e.prototype.outdentRows=function(e){for(var t=e.collapseRows(),n=new u(0,0,0,0),i=this.getTabSize(),r=t.start.row;r<=t.end.row;++r){var o=this.getLine(r);n.start.row=r,n.end.row=r;for(var s=0;s<i&&" "==o.charAt(s);++s);s<i&&" "==o.charAt(s)?(n.start.column=s,n.end.column=s+1):(n.start.column=0,n.end.column=s),this.remove(n)}},e.prototype.$moveLines=function(e,t,n){if(e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t),n<0){var i=this.getRowFoldStart(e+n);if(i<0)return 0;var r=i-e}else if(n>0){var i=this.getRowFoldEnd(t+n);if(i>this.doc.getLength()-1)return 0;var r=i-t}else{e=this.$clipRowToDocument(e);var r=(t=this.$clipRowToDocument(t))-e+1}var o=new u(e,0,t,Number.MAX_VALUE),s=this.getFoldsInRange(o).map(function(e){return e=e.clone(),e.start.row+=r,e.end.row+=r,e}),a=0==n?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+r,a),s.length&&this.addFolds(s),r},e.prototype.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},e.prototype.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},e.prototype.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},e.prototype.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},e.prototype.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},e.prototype.$clipPositionToDocument=function(e,t){if(t=Math.max(0,t),e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},e.prototype.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},e.prototype.setUseWrapMode=function(e){if(e!=this.$useWrapMode){if(this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0),e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},e.prototype.getUseWrapMode=function(){return this.$useWrapMode},e.prototype.setWrapLimitRange=function(e,t){(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)&&(this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},e.prototype.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var i=this.$constrainWrapLimit(e,n.min,n.max);return i!=this.$wrapLimit&&i>1&&(this.$wrapLimit=i,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0)},e.prototype.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},e.prototype.getWrapLimit=function(){return this.$wrapLimit},e.prototype.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},e.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},e.prototype.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,i=e.start,r=e.end,o=i.row,s=r.row,a=s-o,l=null;if(this.$updating=!0,0!=a)if("remove"===n){this[t?"$wrapData":"$rowLengthCache"].splice(o,a);var c=this.$foldData;l=this.getFoldsInRange(e),this.removeFolds(l);var u=this.getFoldLine(r.row),d=0;if(u){u.addRemoveChars(r.row,r.column,i.column-r.column),u.shiftRow(-a);var h=this.getFoldLine(o);h&&h!==u&&(h.merge(u),u=h),d=c.indexOf(u)+1}for(;d<c.length;d++){var u=c[d];u.start.row>=r.row&&u.shiftRow(-a)}s=o}else{var p=Array(a);p.unshift(o,0);var f=t?this.$wrapData:this.$rowLengthCache;f.splice.apply(f,p);var c=this.$foldData,u=this.getFoldLine(o),d=0;if(u){var g=u.range.compareInside(i.row,i.column);0==g?(u=u.split(i.row,i.column))&&(u.shiftRow(a),u.addRemoveChars(s,0,r.column-i.column)):-1==g&&(u.addRemoveChars(o,0,r.column-i.column),u.shiftRow(a)),d=c.indexOf(u)+1}for(;d<c.length;d++){var u=c[d];u.start.row>=o&&u.shiftRow(a)}}else{a=Math.abs(e.start.column-e.end.column),"remove"===n&&(l=this.getFoldsInRange(e),this.removeFolds(l),a=-a);var u=this.getFoldLine(o);u&&u.addRemoveChars(o,i.column,a)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(o,s):this.$updateRowLengthCache(o,s),l},e.prototype.$updateRowLengthCache=function(e,t){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},e.prototype.$updateWrapData=function(e,t){var n,i,r=this.doc.getAllLines(),o=this.getTabSize(),s=this.$wrapData,a=this.$wrapLimit,l=e;for(t=Math.min(t,r.length-1);l<=t;)(i=this.getFoldLine(l,i))?(n=[],i.walk((function(e,t,i,o){var s;if(null!=e){(s=this.$getDisplayTokens(e,n.length))[0]=b;for(var a=1;a<s.length;a++)s[a]=y}else s=this.$getDisplayTokens(r[t].substring(o,i),n.length);n=n.concat(s)}).bind(this),i.end.row,r[i.end.row].length+1),s[i.start.row]=this.$computeWrapSplits(n,a,o),l=i.end.row+1):(n=this.$getDisplayTokens(r[l]),s[l]=this.$computeWrapSplits(n,a,o),l++)},e.prototype.$computeWrapSplits=function(e,t,n){if(0==e.length)return[];var i=[],r=e.length,o=0,s=0,a=this.$wrapAsCode,l=this.$indentedSoftWrap,c=t<=Math.max(2*n,8)||!1===l?0:Math.floor(t/2);function u(){var t=0;if(0===c)return t;if(l)for(var i=0;i<e.length;i++){var r=e[i];if(r==x)t+=1;else if(r==$)t+=n;else if(r==_)continue;else break}return a&&!1!==l&&(t+=n),Math.min(t,c)}function d(t){for(var n=t-o,r=o;r<t;r++){var a=e[r];(12===a||2===a)&&(n-=1)}i.length||(i.indent=h=u()),s+=n,i.push(s),o=t}for(var h=0;r-o>t-h;){var p=o+t-h;if(e[p-1]>=x&&e[p]>=x){d(p);continue}if(e[p]==b||e[p]==y){for(;p!=o-1&&e[p]!=b;p--);if(p>o){d(p);continue}for(p=o+t;p<e.length&&e[p]==y;p++);if(p==e.length)break;d(p);continue}for(var f=Math.max(p-(t-(t>>2)),o-1);p>f&&e[p]<b;)p--;if(a){for(;p>f&&e[p]<b;)p--;for(;p>f&&e[p]==w;)p--}else for(;p>f&&e[p]<x;)p--;if(p>f){d(++p);continue}e[p=o+t]==v&&p--,d(p-h)}return i},e.prototype.$getDisplayTokens=function(e,t){var n,i=[];t=t||0;for(var r=0;r<e.length;r++){var o=e.charCodeAt(r);if(9==o){n=this.getScreenTabSize(i.length+t),i.push($);for(var s=1;s<n;s++)i.push(_)}else 32==o?i.push(x):o>39&&o<48||o>57&&o<64?i.push(w):o>=4352&&S(o)?i.push(m,v):i.push(m)}return i},e.prototype.$getStringScreenWidth=function(e,t,n){var i,r;if(0==t)return[0,0];for(null==t&&(t=1/0),n=n||0,r=0;r<e.length&&(9==(i=e.charCodeAt(r))?n+=this.getScreenTabSize(n):i>=4352&&S(i)?n+=2:n+=1,!(n>t));r++);return[n,r]},e.prototype.getRowLength=function(e){var t=1;return(this.lineWidgets&&(t+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+t:t},e.prototype.getRowLineCount=function(e){return this.$useWrapMode&&this.$wrapData[e]?this.$wrapData[e].length+1:1},e.prototype.getRowWrapIndent=function(e){if(!this.$useWrapMode)return 0;var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]<t.column?n.indent:0},e.prototype.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},e.prototype.getDocumentLastRowColumn=function(e,t){var n=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(n)},e.prototype.getDocumentLastRowColumnPosition=function(e,t){var n=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(n,Number.MAX_VALUE/10)},e.prototype.getRowSplitData=function(e){if(this.$useWrapMode)return this.$wrapData[e]},e.prototype.getScreenTabSize=function(e){return this.$tabSize-(e%this.$tabSize|0)},e.prototype.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},e.prototype.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},e.prototype.screenToDocumentPosition=function(e,t,n){if(e<0)return{row:0,column:0};var i,r,o=0,s=0,a=0,l=0,c=this.$screenRowCache,u=this.$getRowCacheIndex(c,e),d=c.length;if(d&&u>=0)var a=c[u],o=this.$docRowCache[u],h=e>c[d-1];else var h=!d;for(var p=this.getLength()-1,f=this.getNextFoldLine(o),g=f?f.start.row:1/0;a<=e&&!(a+(l=this.getRowLength(o))>e)&&!(o>=p);)a+=l,++o>g&&(o=f.end.row+1,g=(f=this.getNextFoldLine(o,f))?f.start.row:1/0),h&&(this.$docRowCache.push(o),this.$screenRowCache.push(a));if(f&&f.start.row<=o)i=this.getFoldDisplayLine(f),o=f.start.row;else{if(a+l<=e||o>p)return{row:p,column:this.getLine(p).length};i=this.getLine(o),f=null}var m=0,v=Math.floor(e-a);if(this.$useWrapMode){var b=this.$wrapData[o];b&&(r=b[v],v>0&&b.length&&(m=b.indent,s=b[v-1]||b[b.length-1],i=i.substring(s)))}return(void 0!==n&&this.$bidiHandler.isBidiRow(a+v,o,v)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(i,t-m)[1],this.$useWrapMode&&s>=r&&(s=r-1),f)?f.idxToPosition(s):{row:o,column:s}},e.prototype.documentToScreenPosition=function(e,t){if(void 0===t)var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var i=0,r=null,o=null;(o=this.getFoldAt(e,t,1))&&(e=o.start.row,t=o.start.column);var s,a=0,l=this.$docRowCache,c=this.$getRowCacheIndex(l,e),u=l.length;if(u&&c>=0)var a=l[c],i=this.$screenRowCache[c],d=e>l[u-1];else var d=!u;for(var h=this.getNextFoldLine(a),p=h?h.start.row:1/0;a<e;){if(a>=p){if((s=h.end.row+1)>e)break;p=(h=this.getNextFoldLine(s,h))?h.start.row:1/0}else s=a+1;i+=this.getRowLength(a),a=s,d&&(this.$docRowCache.push(a),this.$screenRowCache.push(i))}var f="";h&&a>=p?(f=this.getFoldDisplayLine(h,e,t),r=h.start.row):(f=this.getLine(e).substring(0,t),r=e);var g=0;if(this.$useWrapMode){var m=this.$wrapData[r];if(m){for(var v=0;f.length>=m[v];)i++,v++;f=f.substring(m[v-1]||0,f.length),g=v>0?m.indent:0}}return this.lineWidgets&&this.lineWidgets[a]&&this.lineWidgets[a].rowsAbove&&(i+=this.lineWidgets[a].rowsAbove),{row:i,column:g+this.$getStringScreenWidth(f)[0]}},e.prototype.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},e.prototype.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},e.prototype.getScreenLength=function(){var e=0,t=null;if(this.$useWrapMode)for(var n=this.$wrapData.length,i=0,r=0,t=this.$foldData[r++],o=t?t.start.row:1/0;i<n;){var s=this.$wrapData[i];e+=s?s.length+1:1,++i>o&&(i=t.end.row+1,o=(t=this.$foldData[r++])?t.start.row:1/0)}else{e=this.getLength();for(var a=this.$foldData,r=0;r<a.length;r++)e-=(t=a[r]).end.row-t.start.row}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},e.prototype.$setFontMetrics=function(e){this.$enableVarChar&&(this.$getStringScreenWidth=function(t,n,i){var r,o;if(0===n)return[0,0];for(n||(n=1/0),i=i||0,o=0;o<t.length&&(" "===(r=t.charAt(o))?i+=this.getScreenTabSize(i):i+=e.getCharacterWidth(r),!(i>n));o++);return[i,o]})},e.prototype.getPrecedingCharacter=function(){var e=this.selection.getCursor();return 0===e.column?0===e.row?"":this.doc.getNewLineCharacter():this.getLine(e.row)[e.column-1]},e.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},e}();g.$uid=0,g.prototype.$modes=s.$modes,g.prototype.getValue=g.prototype.toString,g.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},g.prototype.$overwrite=!1,g.prototype.$mode=null,g.prototype.$modeId=null,g.prototype.$scrollTop=0,g.prototype.$scrollLeft=0,g.prototype.$wrapLimit=80,g.prototype.$useWrapMode=!1,g.prototype.$wrapLimitRange={min:null,max:null},g.prototype.lineWidgets=null,g.prototype.isFullWidth=S,i.implement(g.prototype,a);var m=1,v=2,b=3,y=4,w=9,x=10,$=11,_=12;function S(e){return!(e<4352)&&(e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510)}e("./edit_session/folding").Folding.call(g.prototype),e("./edit_session/bracket_match").BracketMatch.call(g.prototype),s.defineOptions(g.prototype,"session",{wrap:{set:function(e){if(e&&"off"!=e?"free"==e?e=!0:"printMargin"==e?e=-1:"string"==typeof e&&(e=parseInt(e,10)||!1):e=!1,this.$wrap!=e)if(this.$wrap=e,e){var t="number"==typeof e?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}else this.setUseWrapMode(!1)},get:function(){return this.getUseWrapMode()?-1==this.$wrap?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){(e="auto"==e?"text"!=this.$mode.type:"text"!=e)!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){(e=parseInt(e))>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=g}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var i=e("./lib/lang"),r=e("./lib/oop"),o=e("./range").Range;function s(e,t){var n=i.supportsLookbehind();function r(e,i){if(void 0===i&&(i=!0),(n&&t.$supportsUnicodeFlag?RegExp("[\\p{L}\\p{N}_]","u"):RegExp("\\w")).test(e)||t.regExp)return n&&t.$supportsUnicodeFlag?i?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b";return""}var o=Array.from(e),s=o[0],a=o[o.length-1];return r(s)+e+r(a,!1)}t.Search=function(){function e(){this.$options={}}return e.prototype.set=function(e){return r.mixin(this.$options,e),this},e.prototype.getOptions=function(){return i.copyObject(this.$options)},e.prototype.setOptions=function(e){this.$options=e},e.prototype.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var i=null;return n.forEach(function(e,n,r,s){return i=new o(e,n,r,s),!(n==s&&t.start&&t.start.start&&!1!=t.skipCurrent&&i.isEqual(t.start))||(i=null,!1)}),i},e.prototype.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,r=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),s=[],a=t.re;if(t.$isMultiLine){var l,c=a.length,u=r.length-c;e:for(var d=a.offset||0;d<=u;d++){for(var h=0;h<c;h++)if(-1==r[d+h].search(a[h]))continue e;var p=r[d],f=r[d+c-1],g=p.length-p.match(a[0])[0].length,m=f.match(a[c-1])[0].length;l&&l.end.row===d&&l.end.column>g||(s.push(l=new o(d,g,d+c-1,m)),c>2&&(d=d+c-2))}}else for(var v=0;v<r.length;v++)for(var b=i.getMatchOffsets(r[v],a),h=0;h<b.length;h++){var y=b[h];s.push(new o(v,y.offset,v,y.offset+y.length))}if(n){for(var w=n.start.column,x=n.end.column,v=0,h=s.length-1;v<h&&s[v].start.column<w&&0==s[v].start.row;)v++;for(var $=n.end.row-n.start.row;v<h&&s[h].end.column>x&&s[h].end.row==$;)h--;for(s=s.slice(v,h+1),v=0,h=s.length;v<h;v++)s[v].start.row+=n.start.row,s[v].end.row+=n.start.row}return s},e.prototype.replace=function(e,t){var n=this.$options,i=this.$assembleRegExp(n);if(n.$isMultiLine)return t;if(i){var r=i.exec(e);if(!r||r[0].length!=e.length)return null;if(n.regExp||(t=t.replace(/\$/g,"$$$$")),t=e.replace(i,t),n.preserveCase){t=t.split("");for(var o=Math.min(e.length,e.length);o--;){var s=e[o];s&&s.toLowerCase()!=s?t[o]=t[o].toUpperCase():t[o]=t[o].toLowerCase()}t=t.join("")}return t}},e.prototype.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=i.escapeRegExp(n));var r=e.caseSensitive?"gm":"gmi";try{RegExp(n,"u"),e.$supportsUnicodeFlag=!0,r+="u"}catch(t){e.$supportsUnicodeFlag=!1}if(e.wholeWord&&(n=s(n,e)),e.$isMultiLine=!t&&/[\n\r]/.test(n),e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,r);try{var o=new RegExp(n,r)}catch(e){o=!1}return e.re=o},e.prototype.$assembleMultilineRegExp=function(e,t){for(var n=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),i=[],r=0;r<n.length;r++)try{i.push(new RegExp(n[r],t))}catch(e){return!1}return i},e.prototype.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r=!0==t.backwards,o=!1!=t.skipCurrent,s=n.unicode,a=t.range,l=t.start;l||(l=a?a[r?"end":"start"]:e.selection.getRange()),l.start&&(l=l[o!=r?"end":"start"]);var c=a?a.start.row:0,u=a?a.end.row:e.getLength()-1;if(r)var d=function(e){var n=l.row;if(!p(n,l.column,e)){for(n--;n>=c;n--)if(p(n,Number.MAX_VALUE,e))return;if(!1!=t.wrap){for(n=u,c=l.row;n>=c;n--)if(p(n,Number.MAX_VALUE,e))return}}};else var d=function(e){var n=l.row;if(!p(n,l.column,e)){for(n+=1;n<=u;n++)if(p(n,0,e))return;if(!1!=t.wrap){for(n=c,u=l.row;n<=u;n++)if(p(n,0,e))return}}};if(t.$isMultiLine)var h=n.length,p=function(t,i,o){var s=r?t-h+1:t;if(!(s<0||s+h>e.getLength())){var a=e.getLine(s),l=a.search(n[0]);if((r||!(l<i))&&-1!==l){for(var c=1;c<h;c++)if(-1==(a=e.getLine(s+c)).search(n[c]))return;var u=a.match(n[h-1])[0].length;if((!r||!(u>i))&&o(s,l,s+h-1,u))return!0}}};else if(r)var p=function(t,r,o){var a,l=e.getLine(t),c=[],u=0;for(n.lastIndex=0;a=n.exec(l);){var d=a[0].length;if(u=a.index,!d){if(u>=l.length)break;n.lastIndex=u+=i.skipEmptyMatch(l,u,s)}if(a.index+d>r)break;c.push(a.index,d)}for(var h=c.length-1;h>=0;h-=2){var p=c[h-1],d=c[h];if(o(t,p,t,p+d))return!0}};else var p=function(t,r,o){var a,l,c=e.getLine(t);for(n.lastIndex=r;l=n.exec(c);){var u=l[0].length;if(o(t,a=l.index,t,a+u))return!0;if(!u&&(n.lastIndex=a+=i.skipEmptyMatch(c,a,s),a>=c.length))return!1}};return{forEach:d}},e}()}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("../lib/keys"),o=e("../lib/useragent"),s=r.KEY_MODS,a=function(){function e(e,t){this.$init(e,t,!1)}return e.prototype.$init=function(e,t,n){this.platform=t||(o.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=n},e.prototype.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},e.prototype.removeCommand=function(e,t){var n=e&&("string"==typeof e?e:e.name);e=this.commands[n],t||delete this.commands[n];var i=this.commandKeyBinding;for(var r in i){var o=i[r];if(o==e)delete i[r];else if(Array.isArray(o)){var s=o.indexOf(e);-1!=s&&(o.splice(s,1),1==o.length&&(i[r]=o[0]))}}},e.prototype.bindKey=function(e,t,n){if("object"==typeof e&&e&&(void 0==n&&(n=e.position),e=e[this.platform]),e){if("function"==typeof t)return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var i="";if(-1!=e.indexOf(" ")){var r=e.split(/\s+/);e=r.pop(),r.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;i+=(i?" ":"")+n,this._addCommandToBinding(i,"chainKeys")},this),i+=" "}var o=this.parseKeys(e),a=s[o.hashId]+o.key;this._addCommandToBinding(i+a,t,n)},this)}},e.prototype._addCommandToBinding=function(e,t,n){var i,r=this.commandKeyBinding;if(t)if(!r[e]||this.$singleCommand)r[e]=t;else{Array.isArray(r[e])?-1!=(i=r[e].indexOf(t))&&r[e].splice(i,1):r[e]=[r[e]],"number"!=typeof n&&(n=l(t));var o=r[e];for(i=0;i<o.length&&!(l(o[i])>n);i++);o.splice(i,0,t)}else delete r[e]},e.prototype.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(n){if("string"==typeof n)return this.bindKey(n,t);"function"==typeof n&&(n={exec:n}),"object"==typeof n&&(n.name||(n.name=t),this.addCommand(n))}},this)},e.prototype.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},e.prototype.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},e.prototype._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},e.prototype.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else if(!t.length)return{key:n,hashId:-1};else if(1==t.length&&"shift"==t[0])return{key:n.toUpperCase(),hashId:-1};for(var o=0,s=t.length;s--;){var a=r.KEY_MODS[t[s]];if(null==a)return"u">typeof console&&console.error("invalid modifier "+t[s]+" in "+e),!1;o|=a}return{key:n,hashId:o}},e.prototype.findKeyCommand=function(e,t){var n=s[e]+t;return this.commandKeyBinding[n]},e.prototype.handleKeyboard=function(e,t,n,i){if(!(i<0)){var r=s[t]+n,o=this.commandKeyBinding[r];return(e.$keyChain&&(e.$keyChain+=" "+r,o=this.commandKeyBinding[e.$keyChain]||o),o&&("chainKeys"==o||"chainKeys"==o[o.length-1]))?(e.$keyChain=e.$keyChain||r,{command:"null"}):(e.$keyChain&&(t&&4!=t||1!=n.length?(-1==t||i>0)&&(e.$keyChain=""):e.$keyChain=e.$keyChain.slice(0,-r.length-1)),{command:o})}},e.prototype.getStatusText=function(e,t){return t.$keyChain||""},e}();function l(e){return"object"==typeof e&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}var c=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.$singleCommand=!0,i}return i(t,e),t}(a);c.call=function(e,t,n){a.prototype.$init.call(e,t,n,!0)},a.call=function(e,t,n){a.prototype.$init.call(e,t,n,!1)},t.HashHandler=c,t.MultiHashHandler=a}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("../lib/oop"),o=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,a=function(e){function t(t,n){var i=e.call(this,n,t)||this;return i.byName=i.commands,i.setDefaultHandler("exec",function(e){return e.args?e.command.exec(e.editor,e.args,e.event,!1):e.command.exec(e.editor,{},e.event,!0)}),i}return i(t,e),t.prototype.exec=function(e,t,n){if(Array.isArray(e)){for(var i=e.length;i--;)if(this.exec(e[i],t,n))return!0;return!1}if("string"==typeof e&&(e=this.commands[e]),!this.canExecute(e,t))return!1;var r={editor:t,command:e,args:n};return r.returnValue=this._emit("exec",r),this._signal("afterExec",r),!1!==r.returnValue},t.prototype.canExecute=function(e,t){return"string"==typeof e&&(e=this.commands[e]),!!e&&(!t||!t.$readOnly||!!e.readOnly)&&(!1==this.$checkCommandState||!e.isAvailable||!!e.isAvailable(t))},t.prototype.toggleRecording=function(e){if(!this.$inReplay)return(e&&e._emit("changeStatus"),this.recording)?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=(function(e){this.macro.push([e.command,e.args])}).bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},t.prototype.replay=function(e){if(!this.$inReplay&&this.macro){if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){"string"==typeof t?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(e){return e.map(function(e){return"string"!=typeof e[0]&&(e[0]=e[0].name),e[1]||(e=e[0]),e})},t}(o);r.implement(a.prototype,s),t.CommandManager=a}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";var i=e("../lib/lang"),r=e("../config"),o=e("../range").Range;function s(e,t){return{win:e,mac:t}}t.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:s("Ctrl-,","Command-,"),exec:function(e){r.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:s("Alt-E","F4"),exec:function(e){r.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:s("Alt-Shift-E","Shift-F4"),exec:function(e){r.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:s("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:s(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:s("Ctrl-L","Command-L"),exec:function(e,t){"number"!=typeof t||isNaN(t)||e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:s("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:s("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:s("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:s("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:s("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:s("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:s("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:s("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:s("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:s("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:s("Ctrl-F","Command-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:s("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:s("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:s("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:s("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:s("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:s("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:s("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:s("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:s("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:s("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:s("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:s("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:s("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:s("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:s("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:s("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:s("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:s("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:s("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:s("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:s(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:s("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:s(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:s("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:s("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:s("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:s("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:s("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:s("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:s("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:s(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty()?e.selection.getLineRange():e.selection.getRange();e._emit("cut",t),t.isEmpty()||e.session.remove(t),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:s("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:s("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:s("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:s("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:s("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:s("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:s("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:s("Ctrl-H","Command-Option-F"),exec:function(e){r.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:s("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:s("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:s("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:s("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:s("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:s("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:s("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:s("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:s("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:s("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:s("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:s("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:s("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:s("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:s("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:s("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:s("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:s("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:s("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(i.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:s(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:s("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:s("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:s("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:s(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:s("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:s("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:s(null,null),exec:function(e){for(var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),r=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),s=e.session.doc.getLine(n.row).length,a=e.session.doc.getTextRange(e.selection.getRange()).replace(/\n\s*/," ").length,l=e.session.doc.getLine(n.row),c=n.row+1;c<=r.row+1;c++){var u=i.stringTrimLeft(i.stringTrimRight(e.session.doc.getLine(c)));0!==u.length&&(u=" "+u),l+=u}r.row+1<e.session.doc.getLength()-1&&(l+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new o(n.row,0,r.row+2,0),l),a>0?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(s=e.session.doc.getLine(n.row).length>s?s+1:s,e.selection.moveCursorTo(n.row,s))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:s(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,i=e.selection.rangeList.ranges,r=[];i.length<1&&(i=[e.selection.getRange()]);for(var s=0;s<i.length;s++)s==i.length-1&&(i[s].end.row!==t||i[s].end.column!==n)&&r.push(new o(i[s].end.row,i[s].end.column,t,n)),0===s?(0!==i[s].start.row||0!==i[s].start.column)&&r.push(new o(0,0,i[s].start.row,i[s].start.column)):r.push(new o(i[s-1].end.row,i[s-1].end.column,i[s].start.row,i[s].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var s=0;s<r.length;s++)e.selection.addRange(r[s],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert("\n")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(e){e.selection.clearSelection();var t=e.getCursorPosition();e.selection.moveTo(t.row-1,Number.MAX_VALUE),e.insert("\n"),0===t.row&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:s("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:s(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var a=1;a<9;a++)t.commands.push({name:"foldToLevel"+a,description:"Fold To Level "+a,level:a,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("./lib/dom");t.LineWidgets=function(){function e(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return e.prototype.getRowLength=function(e){var t;return(t=this.lineWidgets&&this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0,this.$useWrapMode&&this.$wrapData[e])?this.$wrapData[e].length+1+t:1+t},e.prototype.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},e.prototype.$onChangeEditor=function(e){this.attach(e.editor)},e.prototype.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach(),this.editor!=e&&(this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets)))},e.prototype.detach=function(e){var t=this.editor;if(t){this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})}},e.prototype.updateOnFold=function(e,t){var n=t.lineWidgets;if(n&&e.action){for(var i=e.data,r=i.start.row,o=i.end.row,s="add"==e.action,a=r+1;a<o;a++)n[a]&&(n[a].hidden=s);n[o]&&(s?n[r]?n[o].hidden=s:n[r]=n[o]:(n[r]==n[o]&&(n[r]=void 0),n[o].hidden=s))}},e.prototype.updateOnChange=function(e){var t=this.session.lineWidgets;if(t){var n=e.start.row,i=e.end.row-n;if(0===i);else if("remove"==e.action){var r=t.splice(n+1,i);!t[n]&&r[r.length-1]&&(t[n]=r.pop()),r.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var o=Array(i);t[n]&&null!=t[n].column&&e.start.column>t[n].column&&n++,o.unshift(n,0),t.splice.apply(t,o),this.$updateRows()}}},e.prototype.$updateRows=function(){var e=this.session.lineWidgets;if(e){var t=!0;e.forEach(function(e,n){if(e)for(t=!1,e.row=n;e.$oldWidget;)e.$oldWidget.row=n,e=e.$oldWidget}),t&&(this.session.lineWidgets=null)}},e.prototype.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];return t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},e.prototype.addLineWidget=function(e){if(this.$registerLineWidget(e),e.session=this.session,!this.editor)return e;var t=this.editor.renderer;e.html&&!e.el&&(e.el=i.createElement("div"),e.el.innerHTML=e.html),e.text&&!e.el&&(e.el=i.createElement("div"),e.el.textContent=e.text),e.el&&(i.addCssClass(e.el,"ace_lineWidgetContainer"),e.className&&i.addCssClass(e.el,e.className),e.el.style.position="absolute",e.el.style.zIndex="5",t.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex="3"),null==e.pixelHeight&&(e.pixelHeight=e.el.offsetHeight)),null==e.rowCount&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight);var n=this.session.getFoldAt(e.row,0);if(e.$fold=n,n){var r=this.session.lineWidgets;e.row!=n.end.row||r[n.start.row]?e.hidden=!0:r[n.start.row]=e}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),this.onWidgetChanged(e),e},e.prototype.removeLineWidget=function(e){if(e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el),e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(e){}if(this.session.lineWidgets){var t=this.session.lineWidgets[e.row];if(t==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else for(;t;){if(t.$oldWidget==e){t.$oldWidget=e.$oldWidget;break}t=t.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},e.prototype.getWidgetsAtRow=function(e){for(var t=this.session.lineWidgets,n=t&&t[e],i=[];n;)i.push(n),n=n.$oldWidget;return i},e.prototype.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},e.prototype.measureWidgets=function(e,t){var n=this.session._changedWidgets,i=t.layerConfig;if(n&&n.length){for(var r=1/0,o=0;o<n.length;o++){var s=n[o];if(s&&s.el&&s.session==this.session){if(!s._inDocument){if(this.session.lineWidgets[s.row]!=s)continue;s._inDocument=!0,t.container.appendChild(s.el)}s.h=s.el.offsetHeight,s.fixedWidth||(s.w=s.el.offsetWidth,s.screenWidth=Math.ceil(s.w/i.characterWidth));var a=s.h/i.lineHeight;s.coverLine&&(a-=this.session.getRowLineCount(s.row))<0&&(a=0),s.rowCount!=a&&(s.rowCount=a,s.row<r&&(r=s.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},e.prototype.renderWidgets=function(e,t){var n=t.layerConfig,i=this.session.lineWidgets;if(i){for(var r=Math.min(this.firstRow,n.firstRow),o=Math.max(this.lastRow,n.lastRow,i.length);r>0&&!i[r];)r--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var s=r;s<=o;s++){var a=i[s];if(a&&a.el){if(a.hidden){a.el.style.top=-100-(a.pixelHeight||0)+"px";continue}a._inDocument||(a._inDocument=!0,t.container.appendChild(a.el));var l=t.$cursorLayer.getPixelPosition({row:s,column:0},!0).top;a.coverLine||(l+=n.lineHeight*this.session.getRowLineCount(a.row)),a.el.style.top=l-n.offset+"px";var c=a.coverGutter?0:t.gutterWidth;a.fixedWidth||(c-=t.scrollLeft),a.el.style.left=c+"px",a.fullWidth&&a.screenWidth&&(a.el.style.minWidth=n.width+2*n.padding+"px"),a.fixedWidth?a.el.style.right=t.scrollBar.getWidth()+"px":a.el.style.right=""}}}},e}()}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(e,t,n){"use strict";var i=e("../lib/keys"),r=e("../mouse/default_gutter_handler").GutterTooltip;t.GutterKeyboardHandler=function(){function e(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new r(this.editor)}return e.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},e.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},e.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===i.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=i.enter)return;e.preventDefault();var t=this.editor.getCursorPosition().row;this.editor.isRowVisible(t)||this.editor.scrollToLine(t,!0,!0),setTimeout((function(){var e=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),t=this.$findNearestFoldWidget(e),n=this.$findNearestAnnotation(e);if(null!==t||null!==n){if(null===t&&null!==n){this.activeRowIndex=n,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}if(null!==t&&null===n){this.activeRowIndex=t,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}if(Math.abs(n-e)<Math.abs(t-e)){this.activeRowIndex=n,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}this.activeRowIndex=t,this.activeLane="fold",this.$focusFoldWidget(this.activeRowIndex);return}}).bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout((function(){this.editor._signal("gutterkeydown",new o(e,this))}).bind(this),10)},e.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===i.tab)return void e.preventDefault();if(e.keyCode===i.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===i.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp()}return}if(e.keyCode===i.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown()}return}if(e.keyCode===i.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===i.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===i.enter||e.keyCode===i.space){switch(e.preventDefault(),this.activeLane){case"fold":if("start"===this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]){var t=this.$rowIndexToRow(this.activeRowIndex);this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout((function(){this.$rowIndexToRow(this.activeRowIndex)!==t&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(t),this.$focusFoldWidget(this.activeRowIndex))}).bind(this),10);break}this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)];break;case"annotation":var n=this.lines.cells[this.activeRowIndex].element.childNodes[2].getBoundingClientRect(),r=this.annotationTooltip.getElement().style;r.left=n.right+"px",r.top=n.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex))}return}},e.prototype.$blurGutter=function(){if(null!==this.activeRowIndex)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex)}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},e.prototype.$isFoldWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),n="none"!==this.$getFoldWidget(e).style.display;return t&&n},e.prototype.$isAnnotationVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),n="none"!==this.$getAnnotation(e).style.display;return t&&n},e.prototype.$getFoldWidget=function(e){return this.lines.get(e).element.childNodes[1]},e.prototype.$getAnnotation=function(e){return this.lines.get(e).element.childNodes[2]},e.prototype.$findNearestFoldWidget=function(e){if(this.$isFoldWidgetVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(e-++t>=0&&this.$isFoldWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+t))return e+t}return null},e.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(e-++t>=0&&this.$isAnnotationVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+t))return e+t}return null},e.prototype.$focusFoldWidget=function(e){if(null!=e){var t=this.$getFoldWidget(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},e.prototype.$focusAnnotation=function(e){if(null!=e){var t=this.$getAnnotation(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},e.prototype.$blurFoldWidget=function(e){var t=this.$getFoldWidget(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},e.prototype.$blurAnnotation=function(e){var t=this.$getAnnotation(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},e.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=e,this.$focusFoldWidget(this.activeRowIndex);break}},e.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);break}},e.prototype.$switchLane=function(e){switch(e){case"annotation":if("annotation"===this.activeLane)break;var t=this.$findNearestAnnotation(this.activeRowIndex);if(null==t)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=t,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if("fold"===this.activeLane)break;var n=this.$findNearestFoldWidget(this.activeRowIndex);if(null==n)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=n,this.$focusFoldWidget(this.activeRowIndex)}},e.prototype.$rowIndexToRow=function(e){var t=this.lines.get(e);return t?t.row:null},e.prototype.$rowToRowIndex=function(e){for(var t=0;t<this.lines.getLength();t++)if(this.lines.get(t).row==e)return t;return null},e}();var o=function(){function e(e,t){this.gutterKeyboardHandler=t,this.domEvent=e}return e.prototype.getKey=function(){return i.keyCodeToString(this.domEvent.keyCode)},e.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},e.prototype.isInAnnotationLane=function(){return"annotation"===this.gutterKeyboardHandler.activeLane},e.prototype.isInFoldLane=function(){return"fold"===this.gutterKeyboardHandler.activeLane},e}();t.GutterKeyboardEvent=o}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/line_widgets","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys"],function(e,t,n){"use strict";var i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/lang"),a=e("./lib/useragent"),l=e("./keyboard/textinput").TextInput,c=e("./mouse/mouse_handler").MouseHandler,u=e("./mouse/fold_handler").FoldHandler,d=e("./keyboard/keybinding").KeyBinding,h=e("./edit_session").EditSession,p=e("./search").Search,f=e("./range").Range,g=e("./lib/event_emitter").EventEmitter,m=e("./commands/command_manager").CommandManager,v=e("./commands/default_commands").commands,b=e("./config"),y=e("./token_iterator").TokenIterator,w=e("./line_widgets").LineWidgets,x=e("./keyboard/gutter_handler").GutterKeyboardHandler,$=e("./config").nls,_=e("./clipboard"),S=e("./lib/keys"),M=function(){function e(t,n,i){this.session,this.$toDestroy=[];var r=t.getContainerElement();this.container=r,this.renderer=t,this.id="editor"+ ++e.$uid,this.commands=new m(a.isMac?"mac":"win",v),"object"==typeof document&&(this.textInput=new l(t.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new c(this),new u(this)),this.keyBinding=new d(this),this.$search=new p().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall((function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}).bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(n||i&&i.session||new h("")),b.resetOptions(this),i&&this.setOptions(i),b._signal("editor",this)}return e.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},e.prototype.startOperation=function(e){this.session.startOperation(e)},e.prototype.endOperation=function(e){this.session.endOperation(e)},e.prototype.onStartOperation=function(e){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,e||(this.previousCommand=null)},e.prototype.onEndOperation=function(e){if(this.curOp&&this.session){if(e&&!1===e.returnValue){this.curOp=null;return}if(this._signal("beforeEndOperation"),this.curOp){var t=this.curOp.command,n=t&&t.scrollIntoView;if(n){switch(n){case"center-animate":n="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var i=this.selection.getRange(),r=this.renderer.layerConfig;(i.start.row>=r.lastRow||i.end.row<=r.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead)}"animate"==n&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}}},e.prototype.$historyTracker=function(e){if(this.$mergeUndoDeltas){var t=this.prevOp,n=this.$mergeableCommands,i=t.command&&e.command.name==t.command.name;if("insertstring"==e.command.name){var r=e.args;void 0===this.mergeNextCommand&&(this.mergeNextCommand=!0),i=i&&this.mergeNextCommand&&(!/\s/.test(r)||/\s/.test(t.args)),this.mergeNextCommand=!0}else i=i&&-1!==n.indexOf(e.command.name);"always"!=this.$mergeUndoDeltas&&Date.now()-this.sequenceStartTime>2e3&&(i=!1),i?this.session.mergeUndoDeltas=!0:-1!==n.indexOf(e.command.name)&&(this.sequenceStartTime=Date.now())}},e.prototype.setKeyboardHandler=function(e,t){if(e&&"string"==typeof e&&"ace"!=e){this.$keybindingId=e;var n=this;b.loadModule(["keybinding",e],function(i){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(i&&i.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},e.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},e.prototype.setSession=function(e){if(this.session!=e){this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&!e.destroyed&&e.bgTokenizer.scheduleStart()}},e.prototype.getSession=function(){return this.session},e.prototype.setValue=function(e,t){return this.session.doc.setValue(e),t?1==t?this.navigateFileEnd():-1==t&&this.navigateFileStart():this.selectAll(),e},e.prototype.getValue=function(){return this.session.getValue()},e.prototype.getSelection=function(){return this.selection},e.prototype.resize=function(e){this.renderer.onResize(e)},e.prototype.setTheme=function(e,t){this.renderer.setTheme(e,t)},e.prototype.getTheme=function(){return this.renderer.getTheme()},e.prototype.setStyle=function(e){this.renderer.setStyle(e)},e.prototype.unsetStyle=function(e){this.renderer.unsetStyle(e)},e.prototype.getFontSize=function(){return this.getOption("fontSize")||o.computedStyle(this.container).fontSize},e.prototype.setFontSize=function(e){this.setOption("fontSize",e)},e.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(t&&!t.destroyed){t.$bracketHighlight&&(t.$bracketHighlight.markerIds.forEach(function(e){t.removeMarker(e)}),t.$bracketHighlight=null);var n=e.getCursorPosition(),i=e.getKeyboardHandler(),r=i&&i.$getDirectionForHighlight&&i.$getDirectionForHighlight(e),o=t.getMatchingBracketRanges(n,r);if(!o){var s=new y(t,n.row,n.column).getCurrentToken();if(s&&/\b(?:tag-open|tag-name)/.test(s.type)){var a=t.getMatchingTags(n);a&&(o=[a.openTagName.isEmpty()?a.openTag:a.openTagName,a.closeTagName.isEmpty()?a.closeTag:a.closeTagName])}}if(!o&&t.$mode.getMatching&&(o=t.$mode.getMatching(e.session)),!o){e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide();return}var l="ace_bracket";Array.isArray(o)?1==o.length&&(l="ace_error_bracket"):o=[o],2==o.length&&(0==f.comparePoints(o[0].end,o[1].start)?o=[f.fromPoints(o[0].start,o[1].end)]:0==f.comparePoints(o[0].start,o[1].end)&&(o=[f.fromPoints(o[1].start,o[0].end)])),t.$bracketHighlight={ranges:o,markerIds:o.map(function(e){return t.addMarker(e,l,"text")})},e.getHighlightIndentGuides()&&e.renderer.$textLayer.$highlightIndentGuide()}},50)}},e.prototype.focus=function(){this.textInput.focus()},e.prototype.isFocused=function(){return this.textInput.isFocused()},e.prototype.blur=function(){this.textInput.blur()},e.prototype.onFocus=function(e){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e))},e.prototype.onBlur=function(e){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e))},e.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},e.prototype.onDocumentChange=function(e){var t=this.session.$useWrapMode,n=e.start.row==e.end.row?e.end.row:1/0;this.renderer.updateLines(e.start.row,n,t),this._signal("change",e),this.$cursorChange()},e.prototype.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},e.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},e.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},e.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},e.prototype.$updateHighlightActiveLine=function(){var e,t=this.getSession();if(this.$highlightActiveLine&&("line"==this.$selectionStyle&&this.selection.isMultiLine()||(e=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(e=!1),this.renderer.$maxLines&&1===this.session.getLength()&&!(this.renderer.$minLines>1)&&(e=!1)),t.$highlightLineMarker&&!e)t.removeMarker(t.$highlightLineMarker.id),t.$highlightLineMarker=null;else if(!t.$highlightLineMarker&&e){var n=new f(e.row,e.column,e.row,1/0);n.id=t.addMarker(n,"ace_active-line","screenLine"),t.$highlightLineMarker=n}else e&&(t.$highlightLineMarker.start.row=e.row,t.$highlightLineMarker.end.row=e.row,t.$highlightLineMarker.start.column=e.column,t._signal("changeBackMarker"))},e.prototype.onSelectionChange=function(e){var t=this.session;if(t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var n=this.selection.getRange(),i=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",i)}var r=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(r),this._signal("changeSelection")},e.prototype.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(!(t.isEmpty()||t.isMultiLine())){var n=t.start.column,i=t.end.column,r=e.getLine(t.start.row),o=r.substring(n,i);if(!(o.length>5e3)&&/[\w\d]/.test(o)){var s=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:o}),a=r.substring(n-1,i+1);if(s.test(a))return s}}},e.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},e.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},e.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},e.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},e.prototype.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},e.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},e.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},e.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},e.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},e.prototype.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;for(var i=this.selection.getAllRanges(),r=0;r<i.length;r++){var o=i[r];r&&i[r-1].start.row==o.start.row||(e+=this.session.getLine(o.start.row)+t)}}var s={text:e};return this._signal("copy",s),_.lineMode=!!n&&s.text,s.text},e.prototype.onCopy=function(){this.commands.exec("copy",this)},e.prototype.onCut=function(){this.commands.exec("cut",this)},e.prototype.onPaste=function(e,t){var n={text:e,event:t};this.commands.exec("paste",this,n)},e.prototype.$handlePaste=function(e){"string"==typeof e&&(e={text:e}),this._signal("paste",e);var t=e.text,n=t===_.lineMode,i=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)n?i.insert({row:this.selection.lead.row,column:0},t):this.insert(t);else if(n)this.selection.rangeList.ranges.forEach(function(e){i.insert({row:e.start.row,column:0},t)});else{var r=t.split(/\r\n|\r|\n/),o=this.selection.rangeList.ranges,s=2==r.length&&(!r[0]||!r[1]);if(r.length!=o.length||s)return this.commands.exec("insertstring",this,t);for(var a=o.length;a--;){var l=o[a];l.isEmpty()||i.remove(l),i.insert(l.start,r[a])}}},e.prototype.execCommand=function(e,t){return this.commands.exec(e,this,t)},e.prototype.insert=function(e,t){var n=this.session,i=n.getMode(),r=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var o=i.transformAction(n.getState(r.row),"insertion",this,n,e);o&&(e===o.text||this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1),e=o.text)}if(" "==e&&(e=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&-1==e.indexOf("\n")){var s=f.fromPoints(r,r);s.end.column+=e.length,this.session.remove(s)}}else{var s=this.getSelectionRange();r=this.session.remove(s),this.clearSelection()}if("\n"==e||"\r\n"==e){var a=n.getLine(r.row);if(r.column>a.search(/\S|$/)){var l=a.substr(r.column).search(/\S|$/);n.doc.removeInLine(r.row,r.column,r.column+l)}}this.clearSelection();var c=r.column,u=n.getState(r.row),a=n.getLine(r.row),d=i.checkOutdent(u,a,e);if(n.insert(r,e),o&&o.selection&&(2==o.selection.length?this.selection.setSelectionRange(new f(r.row,c+o.selection[0],r.row,c+o.selection[1])):this.selection.setSelectionRange(new f(r.row+o.selection[0],o.selection[1],r.row+o.selection[2],o.selection[3]))),this.$enableAutoIndent){if(n.getDocument().isNewLine(e)){var h=i.getNextLineIndent(u,a.slice(0,r.column),n.getTabString());n.insert({row:r.row+1,column:0},h)}d&&i.autoOutdent(u,n,r.row)}},e.prototype.autoIndent=function(){for(var e=this.session,t=e.getMode(),n=this.selection.isEmpty()?[new f(0,0,e.doc.getLength()-1,0)]:this.selection.getAllRanges(),i="",r="",o="",s=e.getTabString(),a=0;a<n.length;a++)for(var l=n[a].start.row,c=n[a].end.row,u=l;u<=c;u++){u>0&&(i=e.getState(u-1),r=e.getLine(u-1),o=t.getNextLineIndent(i,r,s));var d=e.getLine(u),h=t.$getIndent(d);if(o!==h){if(h.length>0){var p=new f(u,0,u,h.length);e.remove(p)}o.length>0&&e.insert({row:u,column:0},o)}t.autoOutdent(i,e,u)}},e.prototype.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var n=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(n):n(),this.endOperation()},e.prototype.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var n=this.selection.getRange();n.start.column-=t.extendLeft,n.end.column+=t.extendRight,n.start.column<0&&(n.start.row--,n.start.column+=this.session.getLine(n.start.row).length+1),this.selection.setRange(n),e||n.isEmpty()||this.remove()}if((e||!this.selection.isEmpty())&&this.insert(e,!0),t.restoreStart||t.restoreEnd){var n=this.selection.getRange();n.start.column-=t.restoreStart,n.end.column-=t.restoreEnd,this.selection.setRange(n)}},e.prototype.onCommandKey=function(e,t,n){return this.keyBinding.onCommandKey(e,t,n)},e.prototype.setOverwrite=function(e){this.session.setOverwrite(e)},e.prototype.getOverwrite=function(){return this.session.getOverwrite()},e.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},e.prototype.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},e.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},e.prototype.setDragDelay=function(e){this.setOption("dragDelay",e)},e.prototype.getDragDelay=function(){return this.getOption("dragDelay")},e.prototype.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},e.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},e.prototype.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},e.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},e.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},e.prototype.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},e.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},e.prototype.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},e.prototype.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},e.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},e.prototype.setHighlightIndentGuides=function(e){this.renderer.setHighlightIndentGuides(e)},e.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},e.prototype.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},e.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},e.prototype.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},e.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},e.prototype.setReadOnly=function(e){this.setOption("readOnly",e)},e.prototype.getReadOnly=function(){return this.getOption("readOnly")},e.prototype.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},e.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},e.prototype.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},e.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},e.prototype.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},e.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.remove=function(e){this.selection.isEmpty()&&("left"==e?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,i=n.getState(t.start.row),r=n.getMode().transformAction(i,"deletion",this,n,t);if(0===t.end.column){var o=n.getTextRange(t);if("\n"==o[o.length-1]){var s=n.getLine(t.end.row);/^\s+$/.test(s)&&(t.end.column=s.length)}}r&&(t=r)}this.session.remove(t),this.clearSelection()},e.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},e.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},e.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},e.prototype.setGhostText=function(e,t){this.session.widgetManager||(this.session.widgetManager=new w(this.session),this.session.widgetManager.attach(this)),this.renderer.setGhostText(e,t)},e.prototype.removeGhostText=function(){this.session.widgetManager&&this.renderer.removeGhostText()},e.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var e,t,n=this.getCursorPosition(),i=n.column;if(0!==i){var r=this.session.getLine(n.row);i<r.length?(e=r.charAt(i)+r.charAt(i-1),t=new f(n.row,i-1,n.row,i+1)):(e=r.charAt(i-1)+r.charAt(i-2),t=new f(n.row,i-2,n.row,i)),this.session.replace(t,e),this.session.selection.moveToPosition(t.end)}}},e.prototype.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toLowerCase()),this.selection.setSelectionRange(e)},e.prototype.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toUpperCase()),this.selection.setSelectionRange(e)},e.prototype.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}if(t.start.column<t.end.column){var i=e.getTextRange(t);if(!/^\s+$/.test(i)){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}}var r=e.getLine(t.start.row),o=t.start,a=e.getTabSize(),l=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var c=a-l%a,u=s.stringRepeat(" ",c);else{for(var c=l%a;" "==r[t.start.column-1]&&c;)t.start.column--,c--;this.selection.setSelectionRange(t),u=" "}return this.insert(u)},e.prototype.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},e.prototype.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},e.prototype.sortLines=function(){for(var e=this.$getSelectedRows(),t=this.session,n=[],i=e.first;i<=e.last;i++)n.push(t.getLine(i));n.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:+(e.toLowerCase()>t.toLowerCase())});for(var r=new f(0,0,0,0),i=e.first;i<=e.last;i++){var o=t.getLine(i);r.start.row=i,r.end.row=i,r.end.column=o.length,t.replace(r,n[i-e.first])}},e.prototype.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},e.prototype.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},e.prototype.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;for(var i=this.session.getLine(e);n.lastIndex<t;){var r=n.exec(i);if(r.index<=t&&r.index+r[0].length>=t)return{value:r[0],start:r.index,end:r.index+r[0].length}}return null},e.prototype.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,i=new f(t,n-1,t,n),r=this.session.getTextRange(i);if(!isNaN(parseFloat(r))&&isFinite(r)){var o=this.getNumberAt(t,n);if(o){var s=o.value.indexOf(".")>=0?o.start+o.value.indexOf(".")+1:o.end,a=o.start+o.value.length-s,l=parseFloat(o.value);l*=Math.pow(10,a),s!==o.end&&n<s?e*=Math.pow(10,o.end-n-1):e*=Math.pow(10,o.end-n),l+=e;var c=(l/=Math.pow(10,a)).toFixed(a),u=new f(t,o.start,t,o.end);this.session.replace(u,c),this.moveCursorTo(t,Math.max(o.start+1,n+c.length-o.value.length))}}else this.toggleWord()},e.prototype.toggleWord=function(){var e,t=this.selection.getCursor().row,n=this.selection.getCursor().column;this.selection.selectWord();var i=this.getSelectedText(),r=this.selection.getWordRange().start.column,o=i.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),a=n-r-1;a<0&&(a=0);var l=0,c=0,u=this;i.match(/[A-Za-z0-9_]+/)&&o.forEach(function(e,n){c=l+e.length,a>=l&&a<=c&&(i=e,u.selection.clearSelection(),u.moveCursorTo(t,l+r),u.selection.selectTo(t,c+r)),l=c});for(var d=this.$toggleWordPairs,h=0;h<d.length;h++)for(var p=d[h],f=0;f<=1;f++){var g=+!f,m=i.match(RegExp("^\\s?_?("+s.escapeRegExp(p[f])+")\\s?$","i"));m&&i.match(RegExp("([_]|^|\\s)("+s.escapeRegExp(m[1])+")($|\\s)","g"))&&(e=i.replace(RegExp(s.escapeRegExp(p[f]),"i"),function(e){var t=p[g];return e.toUpperCase()==e?t=t.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(t=t.substr(0,0)+p[g].charAt(0).toUpperCase()+t.substr(1)),t}),this.insert(e),e="")}},e.prototype.findLinkAt=function(e,t){var n=this.session.getLine(e).split(/((?:https?|ftp):\/\/[\S]+)/),r=t;r<0&&(r=0);var o,s,a,l=0,c=0;try{for(var u=i(n),d=u.next();!d.done;d=u.next()){var h=d.value;if(c=l+h.length,r>=l&&r<=c&&h.match(/((?:https?|ftp):\/\/[\S]+)/)){a=h.replace(/[\s:.,'";}\]]+$/,"");break}l=c}}catch(e){o={error:e}}finally{try{d&&!d.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}return a},e.prototype.openLink=function(){var e=this.selection.getCursor(),t=this.findLinkAt(e.row,e.column);return t&&window.open(t,"_blank"),null!=t},e.prototype.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},e.prototype.duplicateSelection=function(){var e=this.selection,t=this.session,n=e.getRange(),i=e.isBackwards();if(n.isEmpty()){var r=n.start.row;t.duplicateLines(r,r)}else{var o=i?n.start:n.end,s=t.insert(o,t.getTextRange(n));n.start=o,n.end=s,e.setSelectionRange(n,i)}},e.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},e.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},e.prototype.moveText=function(e,t,n){return this.session.moveText(e,t,n)},e.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},e.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},e.prototype.$moveLines=function(e,t){var n,i,r=this.selection;if(!r.inMultiSelectMode||this.inVirtualSelectionMode){var o=r.toOrientedRange();n=this.$getSelectedRows(o),i=this.session.$moveLines(n.first,n.last,t?0:e),t&&-1==e&&(i=0),o.moveBy(i,0),r.fromOrientedRange(o)}else{var s=r.rangeList.ranges;r.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var a=0,l=0,c=s.length,u=0;u<c;u++){var d=u;s[u].moveBy(a,0);for(var h=(n=this.$getSelectedRows(s[u])).first,p=n.last;++u<c;){l&&s[u].moveBy(l,0);var f=this.$getSelectedRows(s[u]);if(t&&f.first!=p||!t&&f.first>p+1)break;p=f.last}for(u--,a=this.session.$moveLines(h,p,t?0:e),t&&-1==e&&(d=u+1);d<=u;)s[d].moveBy(a,0),d++;t||(a=0),l+=a}r.fromOrientedRange(r.ranges[0]),r.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},e.prototype.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},e.prototype.onCompositionStart=function(e){this.renderer.showComposition(e)},e.prototype.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},e.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},e.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},e.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},e.prototype.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},e.prototype.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},e.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},e.prototype.$moveByPage=function(e,t){var n=this.renderer,i=this.renderer.layerConfig,r=e*Math.floor(i.height/i.lineHeight);!0===t?this.selection.$moveSelection(function(){this.moveCursorBy(r,0)}):!1===t&&(this.selection.moveCursorBy(r,0),this.selection.clearSelection());var o=n.scrollTop;n.scrollBy(0,r*i.lineHeight),null!=t&&n.scrollCursorIntoView(null,.5),n.animateScrolling(o)},e.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},e.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},e.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},e.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},e.prototype.scrollPageDown=function(){this.$moveByPage(1)},e.prototype.scrollPageUp=function(){this.$moveByPage(-1)},e.prototype.scrollToRow=function(e){this.renderer.scrollToRow(e)},e.prototype.scrollToLine=function(e,t,n,i){this.renderer.scrollToLine(e,t,n,i)},e.prototype.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},e.prototype.getCursorPosition=function(){return this.selection.getCursor()},e.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},e.prototype.getSelectionRange=function(){return this.selection.getRange()},e.prototype.selectAll=function(){this.selection.selectAll()},e.prototype.clearSelection=function(){this.selection.clearSelection()},e.prototype.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},e.prototype.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},e.prototype.jumpToMatching=function(e,t){var n,i,r,o,s=this.getCursorPosition(),a=new y(this.session,s.row,s.column),l=a.getCurrentToken(),c=0;l&&-1!==l.type.indexOf("tag-name")&&(l=a.stepBackward());var u=l||a.stepForward();if(u){var d=!1,h={},p=s.column-u.start,g={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(u.value.match(/[{}()\[\]]/g)){for(;p<u.value.length&&!d;p++)if(g[u.value[p]])switch(isNaN(h[i=g[u.value[p]]+"."+u.type.replace("rparen","lparen")])&&(h[i]=0),u.value[p]){case"(":case"[":case"{":h[i]++;break;case")":case"]":case"}":h[i]--,-1===h[i]&&(n="bracket",d=!0)}}else -1!==u.type.indexOf("tag-name")&&(isNaN(h[u.value])&&(h[u.value]=0),"<"===l.value&&c>1?h[u.value]++:"</"===l.value&&h[u.value]--,-1===h[u.value]&&(n="tag",d=!0));d||(l=u,c++,u=a.stepForward(),p=0)}while(u&&!d);if(n){if("bracket"===n)!(r=this.session.getBracketRange(s))&&(o=(r=new f(a.getCurrentTokenRow(),a.getCurrentTokenColumn()+p-1,a.getCurrentTokenRow(),a.getCurrentTokenColumn()+p-1)).start,(t||o.row===s.row&&2>Math.abs(o.column-s.column))&&(r=this.session.getBracketRange(o)));else if("tag"===n){if(!u||-1===u.type.indexOf("tag-name"))return;if(0===(r=new f(a.getCurrentTokenRow(),a.getCurrentTokenColumn()-2,a.getCurrentTokenRow(),a.getCurrentTokenColumn()-2)).compare(s.row,s.column)){var m=this.session.getMatchingTags(s);m&&(m.openTag.contains(s.row,s.column)?o=(r=m.closeTag).start:(r=m.openTag,o=m.closeTag.start.row===s.row&&m.closeTag.start.column===s.column?r.end:r.start))}o=o||r.start}o=r&&r.cursor||o,o&&(e?r&&t?this.selection.setRange(r):r&&r.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(o.row,o.column):this.selection.moveTo(o.row,o.column))}}},e.prototype.gotoLine=function(e,t,n){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,n)},e.prototype.navigateTo=function(e,t){this.selection.moveTo(e,t)},e.prototype.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},e.prototype.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},e.prototype.navigateLeft=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorLeft();else{var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}this.clearSelection()},e.prototype.navigateRight=function(e){if(this.selection.isEmpty())for(e=e||1;e--;)this.selection.moveCursorRight();else{var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}this.clearSelection()},e.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},e.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},e.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},e.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},e.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},e.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},e.prototype.replace=function(e,t){t&&this.$search.set(t);var n=this.$search.find(this.session),i=0;return n&&(this.$tryReplace(n,e)&&(i=1),this.selection.setSelectionRange(n),this.renderer.scrollSelectionIntoView(n.start,n.end)),i},e.prototype.replaceAll=function(e,t){t&&this.$search.set(t);var n=this.$search.findAll(this.session),i=0;if(!n.length)return i;var r=this.getSelectionRange();this.selection.moveTo(0,0);for(var o=n.length-1;o>=0;--o)this.$tryReplace(n[o],e)&&i++;return this.selection.setSelectionRange(r),i},e.prototype.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return null!==(t=this.$search.replace(n,t))?(e.end=this.session.replace(e,t),e):null},e.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},e.prototype.find=function(e,t,n){t||(t={}),"string"==typeof e||e instanceof RegExp?t.needle=e:"object"==typeof e&&r.mixin(t,e);var i=this.selection.getRange();null==t.needle&&((e=this.session.getTextRange(i)||this.$search.$options.needle)||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var o=this.$search.find(this.session);return t.preventScroll?o:o?(this.revealRange(o,n),o):void(t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i))},e.prototype.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},e.prototype.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},e.prototype.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),!1!==t&&this.renderer.animateScrolling(n)},e.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},e.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(e){e.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},e.prototype.setAutoScrollEditorIntoView=function(e){if(e){var t,n=this,i=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var r=this.$scrollAnchor;r.style.cssText="position:absolute",this.container.insertBefore(r,this.container.firstChild);var o=this.on("changeSelection",function(){i=!0}),s=this.renderer.on("beforeRender",function(){i&&(t=n.renderer.container.getBoundingClientRect())}),a=this.renderer.on("afterRender",function(){if(i&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,o=e.$cursorLayer.$pixelPos,s=e.layerConfig,a=o.top-s.offset;null!=(i=o.top>=0&&a+t.top<0||(!(o.top<s.height)||!(o.top+t.top+s.lineHeight>window.innerHeight))&&null)&&(r.style.top=a+"px",r.style.left=o.left+"px",r.style.height=s.lineHeight+"px",r.scrollIntoView(i)),i=t=null}});this.setAutoScrollEditorIntoView=function(e){e||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",o),this.renderer.off("afterRender",a),this.renderer.off("beforeRender",s))}}},e.prototype.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;t&&(t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&"wide"!=e,o.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e)))},e.prototype.prompt=function(e,t,n){var i=this;b.loadModule("ace/ext/prompt",function(r){r.prompt(i,e,t,n)})},e}();M.$uid=0,M.prototype.curOp=null,M.prototype.prevOp={},M.prototype.$mergeableCommands=["backspace","del","insertstring"],M.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],r.implement(M.prototype,g),b.defineOptions(M.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?C.attach(this):C.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?C.attach(this):C.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=(function(){var e=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),o.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(e||this.renderer.placeholderNode)!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"");else{this.renderer.on("afterRender",this.$updatePlaceholder),o.addCssClass(this.container,"ace_hasPlaceholder");var t=o.createElement("div");t.className="ace_placeholder",t.textContent=this.$placeholder||"",this.renderer.placeholderNode=t,this.renderer.content.appendChild(this.renderer.placeholderNode)}}).bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(e){var t,n={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(e){e.blur(),e.renderer.scroller.focus()},readOnly:!0},i=function(e){if(e.target==this.renderer.scroller&&e.keyCode===S.enter){e.preventDefault();var t=this.getCursorPosition().row;this.isRowVisible(t)||this.scrollToLine(t,!0,!0),this.focus()}};e?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(3*!!a.isWin),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",$("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",$("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",i.bind(this)),this.commands.addCommand(n),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",$("editor.gutter.aria-roledescription","editor")),this.renderer.$gutter.setAttribute("aria-label",$("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),t||(t=new x(this)),t.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",i.bind(this)),this.commands.removeCommand(n),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),t&&t.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(e){this.$textInputAriaLabel=e},initialValue:""},enableMobileMenu:{set:function(e){this.$enableMobileMenu=e},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var C={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"\xb7":""))+""},getWidth:function(e,t,n){return Math.max(t.toString().length,(n.lastRow+1).toString().length,2)*n.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=M}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom");t.Lines=function(){function e(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=2*this.canvasHeight+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return e.prototype.moveContainer=function(e){i.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},e.prototype.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},e.prototype.computeLineTop=function(e,t,n){var i=Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight);return n.documentToScreenRow(e,0)*t.lineHeight-i*this.canvasHeight},e.prototype.computeLineHeight=function(e,t,n){return t.lineHeight*n.getRowLineCount(e)},e.prototype.getLength=function(){return this.cells.length},e.prototype.get=function(e){return this.cells[e]},e.prototype.shift=function(){this.$cacheCell(this.cells.shift())},e.prototype.pop=function(){this.$cacheCell(this.cells.pop())},e.prototype.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);for(var t=i.createFragment(this.element),n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.appendChild(t)}else this.cells.push(e),this.element.appendChild(e.element)},e.prototype.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);for(var t=i.createFragment(this.element),n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.firstChild?this.element.insertBefore(t,this.element.firstChild):this.element.appendChild(t)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},e.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},e.prototype.$cacheCell=function(e){e&&(e.element.remove(),this.cellCache.push(e))},e.prototype.createCell=function(e,t,n,r){var o=this.cellCache.pop();if(!o){var s=i.createElement("div");r&&r(s),this.element.appendChild(s),o={element:s,text:"",row:e}}return o.row=e,o},e}()}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/oop"),o=e("../lib/lang"),s=e("../lib/event_emitter").EventEmitter,a=e("./lines").Lines,l=e("../config").nls,c=function(){function e(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new a(this.element),this.$lines.$offsetCoefficient=1}return e.prototype.setSession=function(e){this.session&&this.session.off("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},e.prototype.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},e.prototype.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},e.prototype.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var n=e[t],i=n.row,r=this.$annotations[i];r||(r=this.$annotations[i]={text:[],type:[],displayText:[]});var s=n.text,a=n.text,l=n.type;s=s?o.escapeHTML(s):n.html||"",a=a||n.html||"",-1===r.text.indexOf(s)&&(r.text.push(s),r.type.push(l),r.displayText.push(a));var c=n.className;c?r.className=c:"error"===l?r.className=" ace_error":"security"!==l||/\bace_error\b/.test(r.className)?"warning"!==l||/\bace_(error|security)\b/.test(r.className)?"info"!==l||r.className?"hint"!==l||r.className||(r.className=" ace_hint"):r.className=" ace_info":r.className=" ace_warning":r.className=" ace_security"}},e.prototype.$updateAnnotations=function(e){if(this.$annotations.length){var t=e.start.row,n=e.end.row-t;if(0===n);else if("remove"==e.action)this.$annotations.splice(t,n+1,null);else{var i=Array(n+1);i.unshift(t,1),this.$annotations.splice.apply(this.$annotations,i)}}},e.prototype.update=function(e){this.config=e;var t=this.session,n=e.firstRow,i=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1);this.oldLastRow=i,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();for(var r=t.getNextFoldLine(n),o=r?r.start.row:1/0,s=null,a=-1,l=n;;){if(l>o&&(l=r.end.row+1,o=(r=t.getNextFoldLine(l,r))?r.start.row:1/0),l>i){for(;this.$lines.getLength()>a+1;)this.$lines.pop();break}(s=this.$lines.get(++a))?s.row=l:(s=this.$lines.createCell(l,e,this.session,u),this.$lines.push(s)),this.$renderCell(s,e,r,l),l++}this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$updateGutterWidth=function(e){var t=this.session,n=t.gutterRenderer||this.$renderer,i=t.$firstLineNumber,r=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||t.$useWrapMode)&&(r=t.getLength()+i-1);var o=n?n.getWidth(t,r,e):r.toString().length*e.characterWidth,s=this.$padding||this.$computePadding();(o+=s.left+s.right)===this.gutterWidth||isNaN(o)||(this.gutterWidth=o,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",o))},e.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var e=this.session.selection.getCursor();this.$cursorRow!==e.row&&(this.$cursorRow=e.row)}},e.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var e=this.session.selection.cursor.row;if(this.$cursorRow=e,!this.$cursorCell||this.$cursorCell.row!=e){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var n=0;n<t.length;n++){var i=t[n];if(i.row>=this.$cursorRow){if(i.row>this.$cursorRow){var r=this.session.getFoldLine(this.$cursorRow);if(n>0&&r&&r.start.row==t[n-1].row)i=t[n-1];else break}i.element.className="ace_gutter-active-line "+i.element.className,this.$cursorCell=i;break}}}}},e.prototype.scrollLines=function(e){var t=this.config;if(this.config=e,this.$updateCursorRow(),this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),i=this.oldLastRow;if(this.oldLastRow=n,!t||i<e.firstRow||n<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(i>n)for(var r=this.session.getFoldedRowCount(n+1,i);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,t.firstRow-1)),n>i&&this.$lines.push(this.$renderLines(e,i+1,n)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},e.prototype.$renderLines=function(e,t,n){for(var i=[],r=t,o=this.session.getNextFoldLine(r),s=o?o.start.row:1/0;r>s&&(r=o.end.row+1,s=(o=this.session.getNextFoldLine(r,o))?o.start.row:1/0),!(r>n);){var a=this.$lines.createCell(r,e,this.session,u);this.$renderCell(a,e,o,r),i.push(a),r++}return i},e.prototype.$renderCell=function(e,t,n,r){var o,s=e.element,a=this.session,c=s.childNodes[0],u=s.childNodes[1],d=s.childNodes[2],h=d.firstChild,p=a.$firstLineNumber,f=a.$breakpoints,g=a.$decorations,m=a.gutterRenderer||this.$renderer,v=this.$showFoldWidgets&&a.foldWidgets,b=n?n.start.row:Number.MAX_VALUE,y=t.lineHeight+"px",w=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",x=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",$=(m?m.getText(a,r):r+p).toString();if(this.$highlightGutterLine&&(r==this.$cursorRow||n&&r<this.$cursorRow&&r>=b&&this.$cursorRow<=n.end.row)&&(w+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),f[r]&&(w+=f[r]),g[r]&&(w+=g[r]),this.$annotations[r]&&r!==b&&(w+=this.$annotations[r].className),v){var _=v[r];null==_&&(_=v[r]=a.getFoldWidget(r))}if(_){var S="ace_fold-widget ace_"+_,M="start"==_&&r==b&&r<n.end.row;if(M){S+=" ace_closed";for(var C="",E=!1,k=r+1;k<=n.end.row;k++)if(this.$annotations[k]){if(" ace_error"===this.$annotations[k].className){E=!0,C=" ace_error_fold";break}" ace_security"===this.$annotations[k].className?(E=!0,C=" ace_security_fold"):" ace_warning"===this.$annotations[k].className&&" ace_security_fold"!==C&&(E=!0,C=" ace_warning_fold")}w+=C}else S+=" ace_open";u.className!=S&&(u.className=S),i.setStyle(u.style,"height",y),i.setStyle(u.style,"display","inline-block"),u.setAttribute("role","button"),u.setAttribute("tabindex","-1");var A=a.getFoldWidgetRange(r);A?u.setAttribute("aria-label",l("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[A.start.row+1,A.end.row+1])):n?u.setAttribute("aria-label",l("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[n.start.row+1,n.end.row+1])):u.setAttribute("aria-label",l("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[r+1])),M?(u.setAttribute("aria-expanded","false"),u.setAttribute("title",l("gutter.code-folding.closed.title","Unfold code"))):(u.setAttribute("aria-expanded","true"),u.setAttribute("title",l("gutter.code-folding.open.title","Fold code")))}else u&&(i.setStyle(u.style,"display","none"),u.setAttribute("tabindex","0"),u.removeAttribute("role"),u.removeAttribute("aria-label"));if(E&&this.$showFoldedAnnotations){switch(d.className="ace_gutter_annotation",h.className=x,h.className+=C,i.setStyle(h.style,"height",y),i.setStyle(d.style,"display","block"),i.setStyle(d.style,"height",y),C){case" ace_error_fold":o=l("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security_fold":o=l("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning_fold":o=l("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$])}d.setAttribute("aria-label",o),d.setAttribute("tabindex","-1"),d.setAttribute("role","button")}else if(this.$annotations[r]){switch(d.className="ace_gutter_annotation",h.className=x,this.$useSvgGutterIcons?h.className+=this.$annotations[r].className:s.classList.add(this.$annotations[r].className.replace(" ","")),i.setStyle(h.style,"height",y),i.setStyle(d.style,"display","block"),i.setStyle(d.style,"height",y),this.$annotations[r].className){case" ace_error":o=l("gutter.annotation.aria-label.error","Error, read annotations row $0",[$]);break;case" ace_security":o=l("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[$]);break;case" ace_warning":o=l("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[$]);break;case" ace_info":o=l("gutter.annotation.aria-label.info","Info, read annotations row $0",[$]);break;case" ace_hint":o=l("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[$])}d.setAttribute("aria-label",o),d.setAttribute("tabindex","-1"),d.setAttribute("role","button")}else i.setStyle(d.style,"display","none"),d.removeAttribute("aria-label"),d.removeAttribute("role"),d.setAttribute("tabindex","0");return $!==c.data&&(c.data=$),s.className!=w&&(s.className=w),i.setStyle(e.element.style,"height",this.$lines.computeLineHeight(r,t,a)+"px"),i.setStyle(e.element.style,"top",this.$lines.computeLineTop(r,t,a)+"px"),e.text=$,"none"===d.style.display&&"none"===u.style.display?e.element.setAttribute("aria-hidden",!0):e.element.setAttribute("aria-hidden",!1),e},e.prototype.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},e.prototype.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return 0},getText:function(){return""}}},e.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},e.prototype.setShowFoldWidgets=function(e){e?i.addCssClass(this.element,"ace_folding-enabled"):i.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},e.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},e.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=i.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},e.prototype.getRegion=function(e){var t=this.$padding||this.$computePadding(),n=this.element.getBoundingClientRect();return e.x<t.left+n.left?"markers":this.$showFoldWidgets&&e.x>n.right-t.right?"foldWidgets":void 0},e}();function u(e){var t=document.createTextNode("");e.appendChild(t);var n=i.createElement("span");e.appendChild(n);var r=i.createElement("span");e.appendChild(r);var o=i.createElement("span");return r.appendChild(o),e}c.prototype.$fixedWidth=!1,c.prototype.$highlightGutterLine=!0,c.prototype.$renderer="",c.prototype.$showLineNumbers=!0,c.prototype.$showFoldWidgets=!0,r.implement(c.prototype,s),t.Gutter=c}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../range").Range,r=e("../lib/dom"),o=function(){function e(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setMarkers=function(e){this.markers=e},e.prototype.elt=function(e,t){var n=-1!=this.i&&this.element.childNodes[this.i];n?this.i++:(n=document.createElement("div"),this.element.appendChild(n),this.i=-1),n.style.cssText=t,n.className=e},e.prototype.update=function(e){if(e){for(var t in this.config=e,this.i=0,this.markers){var n,i=this.markers[t];if(!i.range){i.update(n,this,this.session,e);continue}var r=i.range.clipRows(e.firstRow,e.lastRow);if(!r.isEmpty())if(r=r.toScreenRange(this.session),i.renderer){var o=this.$getTop(r.start.row,e),s=this.$padding+r.start.column*e.characterWidth;i.renderer(n,r,s,o,e)}else"fullLine"==i.type?this.drawFullLineMarker(n,r,i.clazz,e):"screenLine"==i.type?this.drawScreenLineMarker(n,r,i.clazz,e):r.isMultiLine()?"text"==i.type?this.drawTextMarker(n,r,i.clazz,e):this.drawMultiLineMarker(n,r,i.clazz,e):this.drawSingleLineMarker(n,r,i.clazz+" ace_start ace_br15",e)}if(-1!=this.i)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},e.prototype.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},e.prototype.drawTextMarker=function(e,t,n,r,o){for(var a=this.session,l=t.start.row,c=t.end.row,u=l,d=0,h=0,p=a.getScreenLastRowColumn(u),f=new i(u,t.start.column,u,h);u<=c;u++)f.start.row=f.end.row=u,f.start.column=u==l?t.start.column:a.getRowWrapIndent(u),f.end.column=p,d=h,h=p,p=u+1<c?a.getScreenLastRowColumn(u+1):u==c?0:t.end.column,this.drawSingleLineMarker(e,f,n+(u==l?" ace_start":"")+" ace_br"+s(u==l||u==l+1&&t.start.column,d<h,h>p,u==c),r,+(u!=c),o)},e.prototype.drawMultiLineMarker=function(e,t,n,i,r){var o=this.$padding,s=i.lineHeight,a=this.$getTop(t.start.row,i),l=o+t.start.column*i.characterWidth;if(r=r||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var c=t.clone();c.end.row=c.start.row,c.end.column=this.session.getLine(c.start.row).length,this.drawBidiSingleLineMarker(e,c,n+" ace_br1 ace_start",i,null,r)}else this.elt(n+" ace_br1 ace_start","height:"+s+"px;right:"+o+"px;top:"+a+"px;left:"+l+"px;"+(r||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var c=t.clone();c.start.row=c.end.row,c.start.column=0,this.drawBidiSingleLineMarker(e,c,n+" ace_br12",i,null,r)}else{a=this.$getTop(t.end.row,i);var u=t.end.column*i.characterWidth;this.elt(n+" ace_br12","height:"+s+"px;width:"+u+"px;top:"+a+"px;left:"+o+"px;"+(r||""))}if(!((s=(t.end.row-t.start.row-1)*i.lineHeight)<=0)){a=this.$getTop(t.start.row+1,i);var d=!!t.start.column|8*!t.end.column;this.elt(n+(d?" ace_br"+d:""),"height:"+s+"px;right:"+o+"px;top:"+a+"px;left:"+o+"px;"+(r||""))}},e.prototype.drawSingleLineMarker=function(e,t,n,i,r,o){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,n,i,r,o);var s=i.lineHeight,a=(t.end.column+(r||0)-t.start.column)*i.characterWidth,l=this.$getTop(t.start.row,i),c=this.$padding+t.start.column*i.characterWidth;this.elt(n,"height:"+s+"px;width:"+a+"px;top:"+l+"px;left:"+c+"px;"+(o||""))},e.prototype.drawBidiSingleLineMarker=function(e,t,n,i,r,o){var s=i.lineHeight,a=this.$getTop(t.start.row,i),l=this.$padding;this.session.$bidiHandler.getSelections(t.start.column,t.end.column).forEach(function(e){this.elt(n,"height:"+s+"px;width:"+(e.width+(r||0))+"px;top:"+a+"px;left:"+(l+e.left)+"px;"+(o||""))},this)},e.prototype.drawFullLineMarker=function(e,t,n,i,r){var o=this.$getTop(t.start.row,i),s=i.lineHeight;t.start.row!=t.end.row&&(s+=this.$getTop(t.end.row,i)-o),this.elt(n,"height:"+s+"px;top:"+o+"px;left:0;right:0;"+(r||""))},e.prototype.drawScreenLineMarker=function(e,t,n,i,r){var o=this.$getTop(t.start.row,i),s=i.lineHeight;this.elt(n,"height:"+s+"px;top:"+o+"px;left:0;right:0;"+(r||""))},e}();function s(e,t,n,i){return!!e|2*!!t|4*!!n|8*!!i}o.prototype.$padding=0,t.Marker=o}),ace.define("ace/layer/text_util",["require","exports","module"],function(e,t,n){var i=new Set(["text","rparen","lparen"]);t.isTextToken=function(e){return i.has(e)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(e,t,n){"use strict";var i=e("../lib/oop"),r=e("../lib/dom"),o=e("../lib/lang"),s=e("./lines").Lines,a=e("../lib/event_emitter").EventEmitter,l=e("../config").nls,c=e("./text_util").isTextToken,u=function(){function e(e){this.dom=r,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new s(this.element)}return e.prototype.$updateEolChar=function(){var e=this.session.doc,t="\n"==e.getNewLineCharacter()&&"windows"!=e.getNewLineMode()?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=t)return this.EOL_CHAR=t,!0},e.prototype.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},e.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},e.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},e.prototype.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",(function(e){this._signal("changeCharacterSize",e)}).bind(this)),this.$pollSizeChanges()},e.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},e.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},e.prototype.setSession=function(e){this.session=e,e&&this.$computeTabString()},e.prototype.setShowInvisibles=function(e){return this.showInvisibles!=e&&(this.showInvisibles=e,"string"==typeof e?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},e.prototype.setDisplayIndentGuides=function(e){return this.displayIndentGuides!=e&&(this.displayIndentGuides=e,this.$computeTabString(),!0)},e.prototype.setHighlightIndentGuides=function(e){return this.$highlightIndentGuides!==e&&(this.$highlightIndentGuides=e,e)},e.prototype.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;for(var t=this.$tabStrings=[0],n=1;n<e+1;n++)if(this.showTabs){var i=this.dom.createElement("span");i.className="ace_invisible ace_invisible_tab",i.textContent=o.stringRepeat(this.TAB_CHAR,n),t.push(i)}else t.push(this.dom.createTextNode(o.stringRepeat(" ",n),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",s=this.showSpaces?" ace_invisible ace_invisible_space":"",a=this.showSpaces?o.stringRepeat(this.SPACE_CHAR,this.tabSize):o.stringRepeat(" ",this.tabSize),l=this.showTabs?" ace_invisible ace_invisible_tab":"",c=this.showTabs?o.stringRepeat(this.TAB_CHAR,this.tabSize):a,i=this.dom.createElement("span");i.className=r+s,i.textContent=a,this.$tabStrings[" "]=i;var i=this.dom.createElement("span");i.className=r+l,i.textContent=c,this.$tabStrings[" "]=i}},e.prototype.updateLines=function(e,t,n){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;for(var i=Math.max(t,e.firstRow),r=Math.min(n,e.lastRow),o=this.element.childNodes,s=0,a=e.firstRow;a<i;a++){var l=this.session.getFoldLine(a);if(l)if(l.containsRow(i)){i=l.start.row;break}else a=l.end.row;s++}for(var c=!1,a=i,l=this.session.getNextFoldLine(a),u=l?l.start.row:1/0;a>u&&(a=l.end.row+1,u=(l=this.session.getNextFoldLine(a,l))?l.start.row:1/0),!(a>r);){var d=o[s++];if(d){this.dom.removeChildren(d),this.$renderLine(d,a,a==u&&l),c&&(d.style.top=this.$lines.computeLineTop(a,e,this.session)+"px");var h=e.lineHeight*this.session.getRowLength(a)+"px";d.style.height!=h&&(c=!0,d.style.height=h)}a++}if(c)for(;s<this.$lines.cells.length;){var p=this.$lines.cells[s++];p.element.style.top=this.$lines.computeLineTop(p.row,e,this.session)+"px"}},e.prototype.scrollLines=function(e){var t=this.config;if(this.config=e,this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=e.lastRow,i=t?t.lastRow:-1;if(!t||i<e.firstRow||n<t.firstRow||!t||t.lastRow<e.firstRow||e.lastRow<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,t.firstRow-1)),e.lastRow>t.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow)),this.$highlightIndentGuide()},e.prototype.$renderLinesFragment=function(e,t,n){for(var i=[],o=t,s=this.session.getNextFoldLine(o),a=s?s.start.row:1/0;o>a&&(o=s.end.row+1,a=(s=this.session.getNextFoldLine(o,s))?s.start.row:1/0),!(o>n);){var l=this.$lines.createCell(o,e,this.session),c=l.element;this.dom.removeChildren(c),r.setStyle(c.style,"height",this.$lines.computeLineHeight(o,e,this.session)+"px"),r.setStyle(c.style,"top",this.$lines.computeLineTop(o,e,this.session)+"px"),this.$renderLine(c,o,o==a&&s),this.$useLineGroups()?c.className="ace_line_group":c.className="ace_line",i.push(l),o++}return i},e.prototype.update=function(e){this.$lines.moveContainer(e),this.config=e;for(var t=e.firstRow,n=e.lastRow,i=this.$lines;i.getLength();)i.pop();i.push(this.$renderLinesFragment(e,t,n))},e.prototype.$renderToken=function(e,t,n,i){for(var r,s=this,a=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,u=this.dom.createFragment(this.element),d=0;r=a.exec(i);){var h=r[1],p=r[2],f=r[3],g=r[4],m=r[5];if(s.showSpaces||!p){var v=d!=r.index?i.slice(d,r.index):"";if(d=r.index+r[0].length,v&&u.appendChild(this.dom.createTextNode(v,this.element)),h){var b=s.session.getScreenTabSize(t+r.index);u.appendChild(s.$tabStrings[b].cloneNode(!0)),t+=b-1}else if(p)if(s.showSpaces){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=o.stringRepeat(s.SPACE_CHAR,p.length),u.appendChild(y)}else u.appendChild(this.dom.createTextNode(p,this.element));else if(f){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=o.stringRepeat(s.SPACE_CHAR,f.length),u.appendChild(y)}else if(g){t+=1;var y=this.dom.createElement("span");y.style.width=2*s.config.characterWidth+"px",y.className=s.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",y.textContent=s.showSpaces?s.SPACE_CHAR:g,u.appendChild(y)}else if(m){t+=1;var y=this.dom.createElement("span");y.style.width=2*s.config.characterWidth+"px",y.className="ace_cjk",y.textContent=m,u.appendChild(y)}}}if(u.appendChild(this.dom.createTextNode(d?i.slice(d):i,this.element)),c(n.type))e.appendChild(u);else{var w="ace_"+n.type.replace(/\./g," ace_"),y=this.dom.createElement("span");"fold"==n.type&&(y.style.width=n.value.length*this.config.characterWidth+"px",y.setAttribute("title",l("inline-fold.closed.title","Unfold code"))),y.className=w,y.appendChild(u),e.appendChild(y)}return t+i.length},e.prototype.renderIndentGuide=function(e,t,n){var i=t.search(this.$indentGuideRe);if(i<=0||i>=n)return t;if(" "==t[0]){for(var r=(i-=i%this.tabSize)/this.tabSize,o=0;o<r;o++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),t.substr(i)}if(" "==t[0]){for(var o=0;o<i;o++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),t.substr(i)}return this.$highlightIndentGuide(),t},e.prototype.$highlightIndentGuide=function(){if(this.$highlightIndentGuides&&this.displayIndentGuides){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var e=this.session.doc.$lines;if(e){var t=this.session.selection.getCursor(),n=/^\s*/.exec(this.session.doc.getLine(t.row))[0].length,i=Math.floor(n/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:i,start:t.row};var r=this.session.$bracketHighlight;if(r){for(var o=this.session.$bracketHighlight.ranges,s=0;s<o.length;s++)if(t.row!==o[s].start.row){this.$highlightIndentGuideMarker.end=o[s].start.row,t.row>o[s].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&""!==e[t.row]&&t.column===e[t.row].length){this.$highlightIndentGuideMarker.dir=1;for(var s=t.row+1;s<e.length;s++){var a=e[s],l=/^\s*/.exec(a)[0].length;if(""!==a&&(this.$highlightIndentGuideMarker.end=s,l<=n))break}}this.$renderHighlightIndentGuide()}}},e.prototype.$clearActiveIndentGuide=function(){for(var e=this.$lines.cells,t=0;t<e.length;t++){var n=e[t].element.childNodes;if(n.length>0){for(var i=0;i<n.length;i++)if(n[i].classList&&n[i].classList.contains("ace_indent-guide-active")){n[i].classList.remove("ace_indent-guide-active");break}}}},e.prototype.$setIndentGuideActive=function(e,t){if(""!==this.session.doc.getLine(e.row)){var n=e.element.childNodes;if(n){var i=n[t-1];i&&i.classList&&i.classList.contains("ace_indent-guide")&&i.classList.add("ace_indent-guide-active")}}},e.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var e=this.$lines.cells;this.$clearActiveIndentGuide();var t=this.$highlightIndentGuideMarker.indentLevel;if(0!==t)if(1===this.$highlightIndentGuideMarker.dir)for(var n=0;n<e.length;n++){var i=e[n];if(this.$highlightIndentGuideMarker.end&&i.row>=this.$highlightIndentGuideMarker.start+1){if(i.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(i,t)}}else for(var n=e.length-1;n>=0;n--){var i=e[n];if(this.$highlightIndentGuideMarker.end&&i.row<this.$highlightIndentGuideMarker.start){if(i.row<=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(i,t)}}}},e.prototype.$createLineElement=function(e){var t=this.dom.createElement("div");return t.className="ace_line",t.style.height=this.config.lineHeight+"px",t},e.prototype.$renderWrappedLine=function(e,t,n){var i=0,r=0,s=n[0],a=0,l=this.$createLineElement();e.appendChild(l);for(var c=0;c<t.length;c++){var u=t[c],d=u.value;if(0==c&&this.displayIndentGuides){if(i=d.length,!(d=this.renderIndentGuide(l,d,s)))continue;i-=d.length}if(i+d.length<s)a=this.$renderToken(l,a,u,d),i+=d.length;else{for(;i+d.length>=s;)a=this.$renderToken(l,a,u,d.substring(0,s-i)),d=d.substring(s-i),i=s,l=this.$createLineElement(),e.appendChild(l),l.appendChild(this.dom.createTextNode(o.stringRepeat("\xa0",n.indent),this.element)),a=0,s=n[++r]||Number.MAX_VALUE;0!=d.length&&(i+=d.length,a=this.$renderToken(l,a,u,d))}}n[n.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(l,a,null,"",!0)},e.prototype.$renderSimpleLine=function(e,t){for(var n=0,i=0;i<t.length;i++){var r=t[i],o=r.value;if(0!=i||!this.displayIndentGuides||(o=this.renderIndentGuide(e,o))){if(n+o.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,o);n=this.$renderToken(e,n,r,o)}}},e.prototype.$renderOverflowMessage=function(e,t,n,i,r){n&&this.$renderToken(e,t,n,i.slice(0,this.MAX_LINE_LENGTH-t));var o=this.dom.createElement("span");o.className="ace_inline_button ace_keyword ace_toggle_wrap",o.textContent=r?"<hide>":"<click to see more...>",e.appendChild(o)},e.prototype.$renderLine=function(e,t,n){if(n||!1==n||(n=this.session.getFoldLine(t)),n)var i=this.$getFoldLineTokens(t,n);else var i=this.session.getTokens(t);var r=e;if(i.length){var o=this.session.getRowSplitData(t);if(o&&o.length){this.$renderWrappedLine(e,i,o);var r=e.lastChild}else{var r=e;this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r)),this.$renderSimpleLine(r,i)}}else this.$useLineGroups()&&(r=this.$createLineElement(),e.appendChild(r));if(this.showEOL&&r){n&&(t=n.end.row);var s=this.dom.createElement("span");s.className="ace_invisible ace_invisible_eol",s.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,r.appendChild(s)}},e.prototype.$getFoldLineTokens=function(e,t){var n=this.session,i=[];function r(e,t,n){for(var r=0,o=0;o+e[r].value.length<t;)if(o+=e[r].value.length,++r==e.length)return;if(o!=t){var s=e[r].value.substring(t-o);s.length>n-t&&(s=s.substring(0,n-t)),i.push({type:e[r].type,value:s}),o=t+s.length,r+=1}for(;o<n&&r<e.length;){var s=e[r].value;s.length+o>n?i.push({type:e[r].type,value:s.substring(0,n-o)}):i.push(e[r]),o+=s.length,r+=1}}var o=n.getTokens(e);return t.walk(function(e,t,s,a,l){null!=e?i.push({type:"fold",value:e}):(l&&(o=n.getTokens(t)),o.length&&r(o,a,s))},t.end.row,this.session.getLine(t.end.row).length),i},e.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},e}();u.prototype.EOF_CHAR="\xb6",u.prototype.EOL_CHAR_LF="\xac",u.prototype.EOL_CHAR_CRLF="\xa4",u.prototype.EOL_CHAR=u.prototype.EOL_CHAR_LF,u.prototype.TAB_CHAR="—",u.prototype.SPACE_CHAR="\xb7",u.prototype.$padding=0,u.prototype.MAX_LINE_LENGTH=1e4,u.prototype.showInvisibles=!1,u.prototype.showSpaces=!1,u.prototype.showTabs=!1,u.prototype.showEOL=!1,u.prototype.displayIndentGuides=!0,u.prototype.$highlightIndentGuides=!0,u.prototype.$tabStrings=[],u.prototype.destroy={},u.prototype.onChangeTabSize=u.prototype.$computeTabString,i.implement(u.prototype,a),t.Text=u}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=function(){function e(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),i.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return e.prototype.$updateOpacity=function(e){for(var t=this.cursors,n=t.length;n--;)i.setStyle(t[n].style,"opacity",e?"":"0")},e.prototype.$startCssAnimation=function(){for(var e=this.cursors,t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout((function(){this.$isAnimating&&i.addCssClass(this.element,"ace_animate-blinking")}).bind(this))},e.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,i.removeCssClass(this.element,"ace_animate-blinking")},e.prototype.setPadding=function(e){this.$padding=e},e.prototype.setSession=function(e){this.session=e},e.prototype.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},e.prototype.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},e.prototype.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,i.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},e.prototype.addCursor=function(){var e=i.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},e.prototype.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},e.prototype.hideCursor=function(){this.isVisible=!1,i.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.showCursor=function(){this.isVisible=!0,i.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},e.prototype.restartTimer=function(){var e=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,i.removeCssClass(this.element,"ace_smooth-blinking")),e(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible)return void this.$stopCssAnimation();if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout((function(){this.$isSmoothBlinking&&i.addCssClass(this.element,"ace_smooth-blinking")}).bind(this))),i.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=(function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}).bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},e.prototype.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e);return{left:this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),top:(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight}},e.prototype.isCursorInView=function(e,t){return e.top>=0&&e.top<t.maxHeight},e.prototype.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,r=0;(void 0===t||0===t.length)&&(t=[{cursor:null}]);for(var n=0,o=t.length;n<o;n++){var s=this.getPixelPosition(t[n].cursor,!0);if(!(s.top>e.height+e.offset)&&!(s.top<0)||!(n>1)){var a=this.cursors[r++]||this.addCursor(),l=a.style;this.drawCursor?this.drawCursor(a,s,e,t[n],this.session):this.isCursorInView(s,e)?(i.setStyle(l,"display","block"),i.translate(a,s.left,s.top),i.setStyle(l,"width",Math.round(e.characterWidth)+"px"),i.setStyle(l,"height",e.lineHeight+"px")):i.setStyle(l,"display","none")}}for(;this.cursors.length>r;)this.removeCursor();var c=this.session.getOverwrite();this.$setOverwrite(c),this.$pixelPos=s,this.restartTimer()},e.prototype.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?i.addCssClass(this.element,"ace_overwrite-cursors"):i.removeCssClass(this.element,"ace_overwrite-cursors"))},e.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},e}();r.prototype.$padding=0,r.prototype.drawCursor=null,t.Cursor=r}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/event"),a=e("./lib/event_emitter").EventEmitter,l=32768,c=function(){function e(e,t){this.element=o.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+t,this.inner=o.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\xa0",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();r.implement(c.prototype,a);var u=function(e){function t(t,n){var i=e.call(this,t,"-v")||this;return i.scrollTop=0,i.scrollHeight=0,n.$scrollbarWidth=i.width=o.scrollbarWidth(t.ownerDocument),i.inner.style.width=i.element.style.width=(i.width||15)+5+"px",i.$minWidth=0,i}return i(t,e),t.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,1!=this.coeff){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},t.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},t.prototype.setHeight=function(e){this.element.style.height=e+"px"},t.prototype.setScrollHeight=function(e){this.scrollHeight=e,e>l?(this.coeff=l/e,e=l):1!=this.coeff&&(this.coeff=1),this.inner.style.height=e+"px"},t.prototype.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)},t}(c);u.prototype.setInnerHeight=u.prototype.setScrollHeight;var d=function(e){function t(t,n){var i=e.call(this,t,"-h")||this;return i.scrollLeft=0,i.height=n.$scrollbarWidth,i.inner.style.height=i.element.style.height=(i.height||15)+5+"px",i}return i(t,e),t.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},t.prototype.getHeight=function(){return this.isVisible?this.height:0},t.prototype.setWidth=function(e){this.element.style.width=e+"px"},t.prototype.setInnerWidth=function(e){this.inner.style.width=e+"px"},t.prototype.setScrollWidth=function(e){this.inner.style.width=e+"px"},t.prototype.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)},t}(c);t.ScrollBar=u,t.ScrollBarV=u,t.ScrollBarH=d,t.VScrollBar=u,t.HScrollBar=d}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),r=e("./lib/oop"),o=e("./lib/dom"),s=e("./lib/event"),a=e("./lib/event_emitter").EventEmitter;o.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n position: absolute;\n background: rgba(128, 128, 128, 0.6);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid #bbb;\n border-radius: 2px;\n z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n position: absolute;\n z-index: 6;\n background: none;\n overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n z-index: 6;\n right: 0;\n top: 0;\n width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n z-index: 8;\n right: 0;\n width: 100%;\n}\n.ace_editor>.ace_sb-h {\n bottom: 0;\n left: 0;\n height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n bottom: 0;\n height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n z-index: 8;\n background: #000;\n}","ace_scrollbar.css",!1);var l=function(){function e(e,t){this.element=o.createElement("div"),this.element.className="ace_sb"+t,this.inner=o.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return e.prototype.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1},e}();r.implement(l.prototype,a);var c=function(e){function t(t,n){var i=e.call(this,t,"-v")||this;return i.scrollTop=0,i.scrollHeight=0,i.parent=t,i.width=i.VScrollWidth,i.renderer=n,i.inner.style.width=i.element.style.width=(i.width||15)+"px",i.$minWidth=0,i}return i(t,e),t.prototype.onMouseDown=function(e,t){if("mousedown"===e&&0===s.getButton(t)&&2!==t.detail){if(t.target===this.inner){var n=this,i=t.clientY,r=function(e){i=e.clientY},o=function(){clearInterval(u)},a=t.clientY,l=this.thumbTop,c=function(){if(void 0!==i){var e=n.scrollTopFromThumbTop(l+i-a);e!==n.scrollTop&&n._emit("scroll",{data:e})}};s.capture(this.inner,r,o);var u=setInterval(c,20);return s.preventDefault(t)}var d=t.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(d)}),s.preventDefault(t)}},t.prototype.getHeight=function(){return this.height},t.prototype.scrollTopFromThumbTop=function(e){var t=e*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return(t|=0)<0?t=0:t>this.pageHeight-this.viewHeight&&(t=this.pageHeight-this.viewHeight),t},t.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},t.prototype.setHeight=function(e){this.height=Math.max(0,e),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},t.prototype.setScrollHeight=function(e,t){(this.pageHeight!==e||t)&&(this.pageHeight=e,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},t.prototype.setScrollTop=function(e){this.scrollTop=e,e<0&&(e=0),this.thumbTop=e*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},t}(l);c.prototype.setInnerHeight=c.prototype.setScrollHeight;var u=function(e){function t(t,n){var i=e.call(this,t,"-h")||this;return i.scrollLeft=0,i.scrollWidth=0,i.height=i.HScrollHeight,i.inner.style.height=i.element.style.height=(i.height||12)+"px",i.renderer=n,i}return i(t,e),t.prototype.onMouseDown=function(e,t){if("mousedown"===e&&0===s.getButton(t)&&2!==t.detail){if(t.target===this.inner){var n=this,i=t.clientX,r=function(e){i=e.clientX},o=function(){clearInterval(u)},a=t.clientX,l=this.thumbLeft,c=function(){if(void 0!==i){var e=n.scrollLeftFromThumbLeft(l+i-a);e!==n.scrollLeft&&n._emit("scroll",{data:e})}};s.capture(this.inner,r,o);var u=setInterval(c,20);return s.preventDefault(t)}var d=t.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(d)}),s.preventDefault(t)}},t.prototype.getHeight=function(){return this.isVisible?this.height:0},t.prototype.scrollLeftFromThumbLeft=function(e){var t=e*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return(t|=0)<0?t=0:t>this.pageWidth-this.viewWidth&&(t=this.pageWidth-this.viewWidth),t},t.prototype.setWidth=function(e){this.width=Math.max(0,e),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},t.prototype.setScrollWidth=function(e,t){(this.pageWidth!==e||t)&&(this.pageWidth=e,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},t.prototype.setScrollLeft=function(e){this.scrollLeft=e,e<0&&(e=0),this.thumbLeft=e*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},t}(l);u.prototype.setInnerWidth=u.prototype.setScrollWidth,t.ScrollBar=c,t.ScrollBarV=c,t.ScrollBarH=u,t.VScrollBar=c,t.HScrollBar=u}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var i=e("./lib/event");t.RenderLoop=function(){function e(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var n=this;this._flush=function(e){n.pending=!1;var t=n.changes;if(t&&(i.blockIdle(100),n.changes=0,n.onRender(t)),n.changes){if(n.$recursionLimit--<0)return;n.schedule()}else n.$recursionLimit=2}}return e.prototype.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(i.nextFrame(this._flush),this.pending=!0)},e.prototype.clear=function(e){var t=this.changes;return this.changes=0,t},e}()}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var i=e("../lib/oop"),r=e("../lib/dom"),o=e("../lib/lang"),s=e("../lib/event"),a=e("../lib/useragent"),l=e("../lib/event_emitter").EventEmitter,c=512,u="function"==typeof ResizeObserver,d=200,h=function(){function e(e){this.el=r.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=r.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=r.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=o.stringRepeat("X",c),this.$characterSize={width:0,height:0},u?this.$addObserver():this.checkForSizeChanges()}return e.prototype.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",a.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},e.prototype.checkForSizeChanges=function(e){if(void 0===e&&(e=this.$measureSizes()),e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},e.prototype.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){e.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},e.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=s.onIdle(function t(){e.checkForSizeChanges(),s.onIdle(t,500)},500)},e.prototype.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},e.prototype.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/c};return 0===t.width||0===t.height?null:t},e.prototype.$measureCharWidth=function(e){return this.$main.textContent=o.stringRepeat(e,c),this.$main.getBoundingClientRect().width/c},e.prototype.getCharacterWidth=function(e){var t=this.charSizes[e];return void 0===t&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},e.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},e.prototype.$getZoom=function(e){return e&&e.parentElement?(Number(window.getComputedStyle(e).zoom)||1)*this.$getZoom(e.parentElement):1},e.prototype.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=r.buildDom([e(0,0),e(d,0),e(0,d),e(d,d)],this.el)},e.prototype.transformCoordinates=function(e,t){function n(e,t,n){var i=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/i,(e[1]*n[0]-e[0]*n[1])/i]}function i(e,t){return[e[0]-t[0],e[1]-t[1]]}function r(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function s(e){var t=e.getBoundingClientRect();return[t.left,t.top]}e&&(e=o(1/this.$getZoom(this.el),e)),this.els||this.$initTransformMeasureNodes();var a=s(this.els[0]),l=s(this.els[1]),c=s(this.els[2]),u=s(this.els[3]),h=n(i(u,l),i(u,c),i(r(l,c),r(u,a))),p=o(1+h[0],i(l,a)),f=o(1+h[1],i(c,a));if(t){var g=t,m=h[0]*g[0]/d+h[1]*g[1]/d+1,v=r(o(g[0],p),o(g[1],f));return r(o(1/m/d,v),a)}var b=i(e,a),y=n(i(p,o(h[0],b)),i(f,o(h[1],b)),b);return o(d,y)},e}();h.prototype.$characterSize={width:0,height:0},i.implement(h.prototype,l),t.FontMetrics=h}),ace.define("ace/css/editor-css",["require","exports","module"],function(e,t,n){n.exports='\n.ace_br1 {border-top-left-radius : 3px;}\n.ace_br2 {border-top-right-radius : 3px;}\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\n.ace_br4 {border-bottom-right-radius: 3px;}\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\n.ace_br8 {border-bottom-left-radius : 3px;}\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\n\n\n.ace_editor {\n position: relative;\n overflow: hidden;\n padding: 0;\n font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'Source Code Pro\', \'source-code-pro\', monospace;\n direction: ltr;\n text-align: left;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n forced-color-adjust: none;\n}\n\n.ace_scroller {\n position: absolute;\n overflow: hidden;\n top: 0;\n bottom: 0;\n background-color: inherit;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n cursor: text;\n}\n\n.ace_content {\n position: absolute;\n box-sizing: border-box;\n min-width: 100%;\n contain: style size layout;\n font-variant-ligatures: no-common-ligatures;\n}\n\n.ace_keyboard-focus:focus {\n box-shadow: inset 0 0 0 2px #5E9ED6;\n outline: none;\n}\n\n.ace_dragging .ace_scroller:before{\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n content: \'\';\n background: rgba(250, 250, 250, 0.01);\n z-index: 1000;\n}\n.ace_dragging.ace_dark .ace_scroller:before{\n background: rgba(0, 0, 0, 0.01);\n}\n\n.ace_gutter {\n position: absolute;\n overflow : hidden;\n width: auto;\n top: 0;\n bottom: 0;\n left: 0;\n cursor: default;\n z-index: 4;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n contain: style size layout;\n}\n\n.ace_gutter-active-line {\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.ace_scroller.ace_scroll-left:after {\n content: "";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n pointer-events: none;\n}\n\n.ace_gutter-cell, .ace_gutter-cell_svg-icons {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-left: 19px;\n padding-right: 6px;\n background-repeat: no-repeat;\n}\n\n.ace_gutter-cell_svg-icons .ace_gutter_annotation {\n margin-left: -14px;\n float: left;\n}\n\n.ace_gutter-cell .ace_gutter_annotation {\n margin-left: -19px;\n float: left;\n}\n\n.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");\n}\n\n.ace_icon_svg.ace_error {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: darkorange;\n}\n.ace_icon_svg.ace_info {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");\n background-color: royalblue;\n}\n.ace_icon_svg.ace_hint {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");\n background-color: silver;\n}\n\n.ace_icon_svg.ace_error_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_security_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");\n background-color: crimson;\n}\n.ace_icon_svg.ace_warning_fold {\n -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");\n background-color: darkorange;\n}\n\n.ace_scrollbar {\n contain: strict;\n position: absolute;\n right: 0;\n bottom: 0;\n z-index: 6;\n}\n\n.ace_scrollbar-inner {\n position: absolute;\n cursor: text;\n left: 0;\n top: 0;\n}\n\n.ace_scrollbar-v{\n overflow-x: hidden;\n overflow-y: scroll;\n top: 0;\n}\n\n.ace_scrollbar-h {\n overflow-x: scroll;\n overflow-y: hidden;\n left: 0;\n}\n\n.ace_print-margin {\n position: absolute;\n height: 100%;\n}\n\n.ace_text-input {\n position: absolute;\n z-index: 0;\n width: 0.5em;\n height: 1em;\n opacity: 0;\n background: transparent;\n -moz-appearance: none;\n appearance: none;\n border: none;\n resize: none;\n outline: none;\n overflow: hidden;\n font: inherit;\n padding: 0 1px;\n margin: 0 -1px;\n contain: strict;\n -ms-user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n user-select: text;\n /*with `pre-line` chrome inserts &nbsp; instead of space*/\n white-space: pre!important;\n}\n.ace_text-input.ace_composition {\n background: transparent;\n color: inherit;\n z-index: 1000;\n opacity: 1;\n}\n.ace_composition_placeholder { color: transparent }\n.ace_composition_marker { \n border-bottom: 1px solid;\n position: absolute;\n border-radius: 0;\n margin-top: 1px;\n}\n\n[ace_nocontext=true] {\n transform: none!important;\n filter: none!important;\n clip-path: none!important;\n mask : none!important;\n contain: none!important;\n perspective: none!important;\n mix-blend-mode: initial!important;\n z-index: auto;\n}\n\n.ace_layer {\n z-index: 1;\n position: absolute;\n overflow: hidden;\n /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/\n word-wrap: normal;\n white-space: pre;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n /* setting pointer-events: auto; on node under the mouse, which changes\n during scroll, will break mouse wheel scrolling in Safari */\n pointer-events: none;\n}\n\n.ace_gutter-layer {\n position: relative;\n width: auto;\n text-align: right;\n pointer-events: auto;\n height: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer {\n font: inherit !important;\n position: absolute;\n height: 1000000px;\n width: 1000000px;\n contain: style size layout;\n}\n\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\n contain: style size layout;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ace_hidpi .ace_text-layer,\n.ace_hidpi .ace_gutter-layer,\n.ace_hidpi .ace_content,\n.ace_hidpi .ace_gutter {\n contain: strict;\n}\n.ace_hidpi .ace_text-layer > .ace_line, \n.ace_hidpi .ace_text-layer > .ace_line_group {\n contain: strict;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n box-sizing: border-box;\n border-left: 2px solid;\n /* workaround for smooth cursor repaintng whole screen in chrome */\n transform: translatez(0);\n}\n\n.ace_multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_slim-cursors .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_overwrite-cursors .ace_cursor {\n border-left-width: 0;\n border-bottom: 1px solid;\n}\n\n.ace_hidden-cursors .ace_cursor {\n opacity: 0.2;\n}\n\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\n opacity: 0;\n}\n\n.ace_smooth-blinking .ace_cursor {\n transition: opacity 0.18s;\n}\n\n.ace_animate-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: step-end;\n animation-name: blink-ace-animate;\n animation-iteration-count: infinite;\n}\n\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: ease-in-out;\n animation-name: blink-ace-animate-smooth;\n}\n \n@keyframes blink-ace-animate {\n from, to { opacity: 1; }\n 60% { opacity: 0; }\n}\n\n@keyframes blink-ace-animate-smooth {\n from, to { opacity: 1; }\n 45% { opacity: 1; }\n 60% { opacity: 0; }\n 85% { opacity: 0; }\n}\n\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_error_bracket {\n position: absolute;\n border-bottom: 1px solid #DE5555;\n border-radius: 0;\n}\n\n.ace_marker-layer .ace_active-line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected-word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\n}\n\n.ace_tooltip {\n background-color: #f5f5f5;\n border: 1px solid gray;\n border-radius: 1px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n color: black;\n max-width: 100%;\n padding: 3px 4px;\n position: fixed;\n z-index: 999999;\n box-sizing: border-box;\n cursor: default;\n white-space: pre-wrap;\n word-wrap: break-word;\n line-height: normal;\n font-style: normal;\n font-weight: normal;\n letter-spacing: normal;\n pointer-events: none;\n overflow: auto;\n max-width: min(60em, 66vw);\n overscroll-behavior: contain;\n}\n.ace_tooltip pre {\n white-space: pre-wrap;\n}\n\n.ace_tooltip.ace_dark {\n background-color: #636363;\n color: #fff;\n}\n\n.ace_tooltip:focus {\n outline: 1px solid #5E9ED6;\n}\n\n.ace_icon {\n display: inline-block;\n width: 18px;\n vertical-align: top;\n}\n\n.ace_icon_svg {\n display: inline-block;\n width: 12px;\n vertical-align: top;\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-size: 12px;\n -webkit-mask-position: center;\n}\n\n.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: none;\n width: 11px;\n vertical-align: top;\n\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n cursor: pointer;\n}\n\n.ace_folding-enabled .ace_fold-widget {\n display: inline-block; \n}\n\n.ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\n}\n\n.ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\n}\n.ace_dark .ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n\n.ace_inline_button {\n border: 1px solid lightgray;\n display: inline-block;\n margin: -1px 8px;\n padding: 0 5px;\n pointer-events: auto;\n cursor: pointer;\n}\n.ace_inline_button:hover {\n border-color: gray;\n background: rgba(200,200,200,0.2);\n display: inline-block;\n pointer-events: auto;\n}\n\n.ace_fold-widget.ace_invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_nobold .ace_bold {\n font-weight: normal;\n}\n\n.ace_italic {\n font-style: italic;\n}\n\n\n.ace_error-marker {\n background-color: rgba(255, 0, 0,0.2);\n position: absolute;\n z-index: 9;\n}\n\n.ace_highlight-marker {\n background-color: rgba(255, 255, 0,0.2);\n position: absolute;\n z-index: 8;\n}\n\n.ace_mobile-menu {\n position: absolute;\n line-height: 1.5;\n border-radius: 4px;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n background: white;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #dcdcdc;\n color: black;\n}\n.ace_dark > .ace_mobile-menu {\n background: #333;\n color: #ccc;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #444;\n\n}\n.ace_mobile-button {\n padding: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n.ace_mobile-button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_mobile-button:active {\n background-color: #ddd;\n}\n\n.ace_placeholder {\n position: relative;\n font-family: arial;\n transform: scale(0.9);\n transform-origin: left;\n white-space: pre;\n opacity: 0.7;\n margin: 0 10px;\n z-index: 1;\n}\n\n.ace_ghost_text {\n opacity: 0.5;\n font-style: italic;\n}\n\n.ace_ghost_text_container > div {\n white-space: pre;\n}\n\n.ghost_text_line_wrapped::after {\n content: "↩";\n position: absolute;\n}\n\n.ace_lineWidgetContainer.ace_ghost_text {\n margin: 0px 4px\n}\n\n.ace_screenreader-only {\n position:absolute;\n left:-10000px;\n top:auto;\n width:1px;\n height:1px;\n overflow:hidden;\n}\n\n.ace_hidden_token {\n display: none;\n}'}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var i=e("../lib/dom"),r=e("../lib/oop"),o=e("../lib/event_emitter").EventEmitter,s=function(){function e(e,t){this.canvas=i.createElement("canvas"),this.renderer=t,this.pixelRatio=1,this.maxHeight=t.layerConfig.maxHeight,this.lineHeight=t.layerConfig.lineHeight,this.canvasHeight=e.parent.scrollHeight,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvasWidth=e.width,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},e.element.appendChild(this.canvas)}return e.prototype.$updateDecorators=function(e){var t=!0===this.renderer.theme.isDark?this.colors.dark:this.colors.light;e&&(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,(e.lastRow+1)*this.lineHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight);var n=this.canvas.getContext("2d");function i(e,t){return e.priority<t.priority?-1:+(e.priority>t.priority)}var r=this.renderer.session.$annotations;if(n.clearRect(0,0,this.canvas.width,this.canvas.height),r){var o={info:1,warning:2,error:3};r.forEach(function(e){e.priority=o[e.type]||null}),r=r.sort(i);for(var s=this.renderer.session.$foldData,a=0;a<r.length;a++){var l=r[a].row,c=this.compensateFoldRows(l,s),u=Math.round((l-c)*this.lineHeight*this.heightRatio),d=Math.round((l-c)*this.lineHeight*this.heightRatio),h=Math.round(((l-c)*this.lineHeight+this.lineHeight)*this.heightRatio);if(h-d<this.minDecorationHeight){var p=(d+h)/2|0;p<this.halfMinDecorationHeight?p=this.halfMinDecorationHeight:p+this.halfMinDecorationHeight>this.canvasHeight&&(p=this.canvasHeight-this.halfMinDecorationHeight),d=Math.round(p-this.halfMinDecorationHeight),h=Math.round(p+this.halfMinDecorationHeight)}n.fillStyle=t[r[a].type]||null,n.fillRect(0,u,this.canvasWidth,h-d)}}var f=this.renderer.session.selection.getCursor();if(f){var c=this.compensateFoldRows(f.row,s),u=Math.round((f.row-c)*this.lineHeight*this.heightRatio);n.fillStyle="rgba(0, 0, 0, 0.5)",n.fillRect(0,u,this.canvasWidth,2)}},e.prototype.compensateFoldRows=function(e,t){var n=0;if(t&&t.length>0)for(var i=0;i<t.length;i++)e>t[i].start.row&&e<t[i].end.row?n+=e-t[i].start.row:e>=t[i].end.row&&(n+=t[i].end.row-t[i].start.row);return n},e}();r.implement(s.prototype,o),t.Decorator=s}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(e,t,n){"use strict";var i=e("./lib/oop"),r=e("./lib/dom"),o=e("./lib/lang"),s=e("./config"),a=e("./layer/gutter").Gutter,l=e("./layer/marker").Marker,c=e("./layer/text").Text,u=e("./layer/cursor").Cursor,d=e("./scrollbar").HScrollBar,h=e("./scrollbar").VScrollBar,p=e("./scrollbar_custom").HScrollBar,f=e("./scrollbar_custom").VScrollBar,g=e("./renderloop").RenderLoop,m=e("./layer/font_metrics").FontMetrics,v=e("./lib/event_emitter").EventEmitter,b=e("./css/editor-css"),y=e("./layer/decorators").Decorator,w=e("./lib/useragent"),x=e("./layer/text_util").isTextToken;r.importCssString(b,"ace_editor.css",!1);var $=function(){function e(e,t){var n=this;this.container=e||r.createElement("div"),r.addCssClass(this.container,"ace_editor"),r.HI_DPI&&r.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),null==s.get("useStrictCSP")&&s.set("useStrictCSP",!1),this.$gutter=r.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=r.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=r.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new a(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new l(this.content);var i=this.$textLayer=new c(this.content);this.canvas=i.element,this.$markerFront=new l(this.content),this.$cursorLayer=new u(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new h(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new m(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!w.isIOS,this.$loop=new g(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),s.resetOptions(this),s._signal("renderer",this)}return e.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),r.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},e.prototype.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&0>=e.getScrollTop()&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),e&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},e.prototype.updateLines=function(e,t,n){if(void 0===t&&(t=1/0),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t},this.$changedLines.lastRow<this.layerConfig.firstRow)if(!n)return;else this.$changedLines.lastRow=this.layerConfig.lastRow;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},e.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},e.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},e.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},e.prototype.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},e.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},e.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},e.prototype.onResize=function(e,t,n,i){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=+!!e;var r=this.container;i||(i=r.clientHeight||r.scrollHeight),!i&&this.$maxLines&&this.lineHeight>1&&(!r.style.height||"0px"==r.style.height)&&(r.style.height="1px",i=r.clientHeight||r.scrollHeight),n||(n=r.clientWidth||r.scrollWidth);var o=this.$updateCachedSize(e,t,n,i);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!n&&!i)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(o|this.$changes,!0):this.$loop.schedule(o|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},e.prototype.$updateCachedSize=function(e,t,n,i){i-=this.$extraHeight||0;var o=0,s=this.$size,a={width:s.width,height:s.height,scrollerHeight:s.scrollerHeight,scrollerWidth:s.scrollerWidth};if(i&&(e||s.height!=i)&&(s.height=i,o|=this.CHANGE_SIZE,s.scrollerHeight=s.height,this.$horizScroll&&(s.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(s.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",o|=this.CHANGE_SCROLL),n&&(e||s.width!=n)){o|=this.CHANGE_SIZE,s.width=n,null==t&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,r.setStyle(this.scrollBarH.element.style,"left",t+"px"),r.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),s.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()-this.margin.h),r.setStyle(this.$gutter.style,"left",this.margin.left+"px");var l=this.scrollBarV.getWidth()+"px";r.setStyle(this.scrollBarH.element.style,"right",l),r.setStyle(this.scroller.style,"right",l),r.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(s.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)&&(o|=this.CHANGE_FULL)}return s.$dirty=!n||!i,o&&this._signal("resize",a),o},e.prototype.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()||this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},e.prototype.adjustWrapLimit=function(){var e=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth);return this.session.adjustWrapLimit(e,this.$showPrintMargin&&this.$printMarginColumn)},e.prototype.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},e.prototype.getAnimatedScroll=function(){return this.$animatedScroll},e.prototype.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},e.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},e.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},e.prototype.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},e.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},e.prototype.setHighlightIndentGuides=function(e){this.setOption("highlightIndentGuides",e)},e.prototype.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},e.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},e.prototype.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},e.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},e.prototype.getShowGutter=function(){return this.getOption("showGutter")},e.prototype.setShowGutter=function(e){return this.setOption("showGutter",e)},e.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},e.prototype.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},e.prototype.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},e.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},e.prototype.$updatePrintMargin=function(){if(this.$showPrintMargin||this.$printMarginEl){if(!this.$printMarginEl){var e=r.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=r.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&-1==this.session.$wrap&&this.adjustWrapLimit()}},e.prototype.getContainerElement=function(){return this.container},e.prototype.getMouseEventTarget=function(){return this.scroller},e.prototype.getTextAreaContainer=function(){return this.container},e.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var e=this.textarea.style,t=this.$composition;if(!this.$keepTextAreaAtCursor&&!t)return void r.translate(this.textarea,-100,0);var n=this.$cursorLayer.$pixelPos;if(n){t&&t.markerRange&&(n=this.$cursorLayer.getPixelPosition(t.markerRange.start,!0));var i=this.layerConfig,o=n.top,s=n.left;o-=i.offset;var a=t&&t.useTextareaForIME||w.isMobile?this.lineHeight:1;if(o<0||o>i.height-a)return void r.translate(this.textarea,0,0);var l=1,c=this.$size.height-a;if(t)if(t.useTextareaForIME){var u=this.textarea.value;l=this.characterWidth*this.session.$getStringScreenWidth(u)[0]}else o+=this.lineHeight+2;else o+=this.lineHeight;s-=this.scrollLeft,s>this.$size.scrollerWidth-l&&(s=this.$size.scrollerWidth-l),s+=this.gutterWidth+this.margin.left,r.setStyle(e,"height",a+"px"),r.setStyle(e,"width",l+"px"),r.translate(this.textarea,Math.min(s,this.$size.scrollerWidth-l),Math.min(o,c))}}},e.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},e.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+ +(0!==this.layerConfig.offset)},e.prototype.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow;return this.session.documentToScreenRow(t,0)*e.lineHeight-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},e.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},e.prototype.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},e.prototype.setScrollMargin=function(e,t,n,i){var r=this.scrollMargin;r.top=0|e,r.bottom=0|t,r.right=0|i,r.left=0|n,r.v=r.top+r.bottom,r.h=r.left+r.right,r.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-r.top),this.updateFull()},e.prototype.setMargin=function(e,t,n,i){var r=this.margin;r.top=0|e,r.bottom=0|t,r.right=0|i,r.left=0|n,r.v=r.top+r.bottom,r.h=r.left+r.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},e.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},e.prototype.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},e.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},e.prototype.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},e.prototype.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},e.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},e.prototype.freeze=function(){this.$frozen=!0},e.prototype.unfreeze=function(){this.$frozen=!1},e.prototype.$renderChanges=function(e,t){if(this.$changes&&(e|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){if(e|=this.$computeLayerConfig()|this.$loop.clear(),n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var i=this.scrollTop+(n.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;i>0&&(this.scrollTop=i,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),r.translate(this.content,-this.scrollLeft,-n.offset);var o=n.width+2*this.$padding+"px",s=n.minHeight+"px";r.setStyle(this.content.style,"width",o),r.setStyle(this.content.style,"height",s)}if(e&this.CHANGE_H_SCROLL&&(r.translate(this.content,-this.scrollLeft,-n.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),e&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}if(e&this.CHANGE_SCROLL){this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(n):this.$gutterLayer.scrollLines(n)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_LINES?((this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)):e&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(n),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(n)),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender",e)},e.prototype.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var i=!(n<=2*this.lineHeight)&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var r=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,r,n),this.desiredHeight=n,this._signal("autosize")}},e.prototype.$computeLayerConfig=function(){var e,t,n=this.session,i=this.$size,r=i.height<=2*this.lineHeight,o=this.session.getScreenLength()*this.lineHeight,s=this.$getLongestLine(),a=!r&&(this.$hScrollBarAlwaysVisible||i.scrollerWidth-s-2*this.$padding<0),l=this.$horizScroll!==a;l&&(this.$horizScroll=a,this.scrollBarH.setVisible(a));var c=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var u=i.scrollerHeight+this.lineHeight,d=!this.$maxLines&&this.$scrollPastEnd?(i.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;o+=d;var h=this.scrollMargin;this.session.setScrollTop(Math.max(-h.top,Math.min(this.scrollTop,o-i.scrollerHeight+h.bottom))),this.session.setScrollLeft(Math.max(-h.left,Math.min(this.scrollLeft,s+2*this.$padding-i.scrollerWidth+h.right)));var p=!r&&(this.$vScrollBarAlwaysVisible||i.scrollerHeight-o+d<0||this.scrollTop>h.top),f=c!==p;f&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var g=this.scrollTop%this.lineHeight,m=Math.ceil(u/this.lineHeight)-1,v=Math.max(0,Math.round((this.scrollTop-g)/this.lineHeight)),b=v+m,y=this.lineHeight;v=n.screenToDocumentRow(v,0);var w=n.getFoldLine(v);w&&(v=w.start.row),e=n.documentToScreenRow(v,0),t=n.getRowLength(v)*y,b=Math.min(n.screenToDocumentRow(b,0),n.getLength()-1),u=i.scrollerHeight+n.getRowLength(b)*y+t,g=this.scrollTop-e*y;var x=0;return(this.layerConfig.width!=s||l)&&(x=this.CHANGE_H_SCROLL),(l||f)&&(x|=this.$updateCachedSize(!0,this.gutterWidth,i.width,i.height),this._signal("scrollbarVisibilityChanged"),f&&(s=this.$getLongestLine())),this.layerConfig={width:s,padding:this.$padding,firstRow:v,firstRowScreen:e,lastRow:b,lineHeight:y,characterWidth:this.characterWidth,minHeight:u,maxHeight:o,offset:g,gutterOffset:y?Math.max(0,Math.ceil((g+i.height-i.scrollerHeight)/y)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),x},e.prototype.$updateLines=function(){if(this.$changedLines){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(!(e>n.lastRow+1)&&!(t<n.firstRow)){if(t===1/0){this.$showGutter&&this.$gutterLayer.update(n),this.$textLayer.update(n);return}return this.$textLayer.updateLines(n,e,t),!0}}},e.prototype.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},e.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},e.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},e.prototype.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},e.prototype.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},e.prototype.updateBreakpoints=function(e){this._rows=e,this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},e.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},e.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},e.prototype.showCursor=function(){this.$cursorLayer.showCursor()},e.prototype.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},e.prototype.scrollCursorIntoView=function(e,t,n){if(0!==this.$size.scrollerHeight){var i=this.$cursorLayer.getPixelPosition(e),r=i.left,o=i.top,s=n&&n.top||0,a=n&&n.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var l=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;l+s>o?(t&&l+s>o+this.lineHeight&&(o-=t*this.$size.scrollerHeight),0===o&&(o=-this.scrollMargin.top),this.session.setScrollTop(o)):l+this.$size.scrollerHeight-a<o+this.lineHeight&&(t&&l+this.$size.scrollerHeight-a<o-this.lineHeight&&(o+=t*this.$size.scrollerHeight),this.session.setScrollTop(o+this.lineHeight+a-this.$size.scrollerHeight));var c=this.scrollLeft,u=2*this.layerConfig.characterWidth;r-u<c?((r-=u)<this.$padding+u&&(r=-this.scrollMargin.left),this.session.setScrollLeft(r)):(r+=u,c+this.$size.scrollerWidth<r+this.characterWidth?this.session.setScrollLeft(Math.round(r+this.characterWidth-this.$size.scrollerWidth)):c<=this.$padding&&r-c<this.characterWidth&&this.session.setScrollLeft(0))}},e.prototype.getScrollTop=function(){return this.session.getScrollTop()},e.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},e.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},e.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},e.prototype.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},e.prototype.alignCursor=function(e,t){"number"==typeof e&&(e={row:e,column:0});var n=this.$cursorLayer.getPixelPosition(e),i=this.$size.scrollerHeight-this.lineHeight,r=n.top-i*(t||0);return this.session.setScrollTop(r),r},e.prototype.$calcSteps=function(e,t){var n=0,i=this.STEPS,r=[],o=function(e,t,n){return n*(Math.pow(e-1,3)+1)+t};for(n=0;n<i;++n)r.push(o(n/this.STEPS,e,t-e));return r},e.prototype.scrollToLine=function(e,t,n,i){var r=this.$cursorLayer.getPixelPosition({row:e,column:0}).top;t&&(r-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(r),!1!==n&&this.animateScrolling(o,i)},e.prototype.animateScrolling=function(e,t){var n=this.scrollTop;if(this.$animatedScroll){var i=this;if(e!=n){if(this.$scrollAnimation){var r=this.$scrollAnimation.steps;if(r.length&&(e=r[0])==n)return}var o=i.$calcSteps(e,n);this.$scrollAnimation={from:e,to:n,steps:o},clearInterval(this.$timer),i.session.setScrollTop(o.shift()),i.session.$scrollTop=n,this.$timer=setInterval(function(){return i.$stopAnimation?void s():i.session?void(o.length?(i.session.setScrollTop(o.shift()),i.session.$scrollTop=n):null!=n?(i.session.$scrollTop=-1,i.session.setScrollTop(n),n=null):s()):clearInterval(i.$timer)},10)}}function s(){i.$timer=clearInterval(i.$timer),i.$scrollAnimation=null,i.$stopAnimation=!1,t&&t()}},e.prototype.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},e.prototype.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},e.prototype.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(e)},e.prototype.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},e.prototype.isScrollableBy=function(e,t){if(t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},e.prototype.pixelToScreenCoordinates=function(e,t){if(this.$hasCssTransforms){var n={top:0,left:0},i=this.$fontMetrics.transformCoordinates([e,t]);e=i[1]-this.gutterWidth-this.margin.left,t=i[0]}else n=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-n.left-this.$padding,o=r/this.characterWidth,s=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),a=this.$blockCursor?Math.floor(o):Math.round(o);return{row:s,column:a,side:o-a>0?1:-1,offsetX:r}},e.prototype.screenToTextCoordinates=function(e,t){if(this.$hasCssTransforms){var n={top:0,left:0},i=this.$fontMetrics.transformCoordinates([e,t]);e=i[1]-this.gutterWidth-this.margin.left,t=i[0]}else n=this.scroller.getBoundingClientRect();var r=e+this.scrollLeft-n.left-this.$padding,o=r/this.characterWidth,s=this.$blockCursor?Math.floor(o):Math.round(o),a=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(a,Math.max(s,0),r)},e.prototype.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),i=this.session.documentToScreenPosition(e,t),r=this.$padding+(this.session.$bidiHandler.isBidiRow(i.row,e)?this.session.$bidiHandler.getPosLeft(i.column):Math.round(i.column*this.characterWidth)),o=i.row*this.lineHeight;return{pageX:n.left+r-this.scrollLeft,pageY:n.top+o-this.scrollTop}},e.prototype.visualizeFocus=function(){r.addCssClass(this.container,"ace_focus")},e.prototype.visualizeBlur=function(){r.removeCssClass(this.container,"ace_focus")},e.prototype.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),void 0==e.useTextareaForIME&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(r.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},e.prototype.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},e.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),r.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},e.prototype.setGhostText=function(e,t){var n=this.session.selection.cursor,i=t||{row:n.row,column:n.column};this.removeGhostText();var o=this.$calculateWrappedTextChunks(e,i);this.addToken(o[0].text,"ghost_text",i.row,i.column),this.$ghostText={text:e,position:{row:i.row,column:i.column}};var s=r.createElement("div");if(o.length>1){var a,l=this.hideTokensAfterPosition(i.row,i.column);o.slice(1).forEach(function(e){var t=r.createElement("div"),n=r.createElement("span");n.className="ace_ghost_text",e.wrapped&&(t.className="ghost_text_line_wrapped"),0===e.text.length&&(e.text=" "),n.appendChild(r.createTextNode(e.text)),t.appendChild(n),s.appendChild(t),a=t}),l.forEach(function(e){var t=r.createElement("span");x(e.type)||(t.className="ace_"+e.type.replace(/\./g," ace_")),t.appendChild(r.createTextNode(e.value)),a.appendChild(t)}),this.$ghostTextWidget={el:s,row:i.row,column:i.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var c=this.$cursorLayer.getPixelPosition(i,!0),u=this.container.getBoundingClientRect().height,d=o.length*this.lineHeight;if(d<u-c.top)return;d<u?this.scrollBy(0,(o.length-1)*this.lineHeight):this.scrollToRow(i.row)}},e.prototype.$calculateWrappedTextChunks=function(e,t){var n=Math.floor((this.$size.scrollerWidth-2*this.$padding)/this.characterWidth)-2;n=n<=0?60:n;for(var i=e.split(/\r?\n/),r=[],o=0;o<i.length;o++){var s=this.session.$getDisplayTokens(i[o],t.column),a=this.session.$computeWrapSplits(s,n,this.session.$tabSize);if(a.length>0){var l=0;a.push(i[o].length);for(var c=0;c<a.length;c++){var u=i[o].slice(l,a[c]);r.push({text:u,wrapped:!0}),l=a[c]}}else r.push({text:i[o],wrapped:!1})}return r},e.prototype.removeGhostText=function(){if(this.$ghostText){var e=this.$ghostText.position;this.removeExtraToken(e.row,e.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},e.prototype.addToken=function(e,t,n,i){var r=this.session;r.bgTokenizer.lines[n]=null;var o={type:t,value:e},s=r.getTokens(n);if(null!=i&&s.length)for(var a=0,l=0;l<s.length;l++){var c=s[l];if(i<=(a+=c.value.length)){var u=c.value.length-(a-i),d=c.value.slice(0,u),h=c.value.slice(u);s.splice(l,1,{type:c.type,value:d},o,{type:c.type,value:h});break}}else s.push(o);this.updateLines(n,n)},e.prototype.hideTokensAfterPosition=function(e,t){for(var n=this.session.getTokens(e),i=0,r=!1,o=[],s=0;s<n.length;s++){var a=n[s];if(i+=a.value.length,"ghost_text"!==a.type){if(r){o.push({type:a.type,value:a.value}),a.type="hidden_token";continue}i===t&&(r=!0)}}return this.updateLines(e,e),o},e.prototype.removeExtraToken=function(e,t){this.session.bgTokenizer.lines[e]=null,this.updateLines(e,e)},e.prototype.setTheme=function(e,t){var n=this;if(this.$themeId=e,n._dispatchEvent("themeChange",{theme:e}),e&&"string"!=typeof e)o(e);else{var i=e||this.$options.theme.initialValue;s.loadModule(["theme",i],o)}function o(i){if(n.$themeId!=e)return t&&t();if(!i||!i.cssClass)throw Error("couldn't load module "+e+" or it didn't call define");i.$id&&(n.$themeId=i.$id),r.importCssString(i.cssText,i.cssClass,n.container),n.theme&&r.removeCssClass(n.container,n.theme.cssClass);var o="padding"in i?i.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&o!=n.$padding&&n.setPadding(o),n.$theme=i.cssClass,n.theme=i,r.addCssClass(n.container,i.cssClass),r.setCssClass(n.container,"ace_dark",i.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:i}),t&&t(),w.isSafari&&n.scroller&&(n.scroller.style.background="red",n.scroller.style.background="")}},e.prototype.getTheme=function(){return this.$themeId},e.prototype.setStyle=function(e,t){r.setCssClass(this.container,e,!1!==t)},e.prototype.unsetStyle=function(e){r.removeCssClass(this.container,e)},e.prototype.setCursorStyle=function(e){r.setStyle(this.scroller.style,"cursor",e)},e.prototype.setMouseCursor=function(e){r.setStyle(this.scroller.style,"cursor",e)},e.prototype.attachToShadowRoot=function(){r.importCssString(b,"ace_editor.css",this.container)},e.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},e.prototype.$updateCustomScrollbar=function(e){var t=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,!0===e?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new p(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}),this.$scrollDecorator=new y(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new h(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollTop(e.data-t.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){t.$scrollAnimation||t.session.setScrollLeft(e.data-t.scrollMargin.left)}))},e.prototype.$addResizeObserver=function(){if(window.ResizeObserver&&!this.$resizeObserver){var e=this;this.$resizeTimer=o.delayedCall(function(){e.destroyed||e.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(t){var n=t[0].contentRect.width,i=t[0].contentRect.height;Math.abs(e.$size.width-n)>1||Math.abs(e.$size.height-i)>1?e.$resizeTimer.delay():e.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},e}();$.prototype.CHANGE_CURSOR=1,$.prototype.CHANGE_MARKER=2,$.prototype.CHANGE_GUTTER=4,$.prototype.CHANGE_SCROLL=8,$.prototype.CHANGE_LINES=16,$.prototype.CHANGE_TEXT=32,$.prototype.CHANGE_SIZE=64,$.prototype.CHANGE_MARKER_BACK=128,$.prototype.CHANGE_MARKER_FRONT=256,$.prototype.CHANGE_FULL=512,$.prototype.CHANGE_H_SCROLL=1024,$.prototype.$changes=0,$.prototype.$padding=null,$.prototype.$frozen=!1,$.prototype.STEPS=8,i.implement($.prototype,v),s.defineOptions($.prototype,"renderer",{useResizeObserver:{set:function(e){!e&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):e&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){"number"==typeof e&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(e){this.$gutterLayer.$useSvgGutterIcons=e},initialValue:!1},showFoldedAnnotations:{set:function(e){this.$gutterLayer.$showFoldedAnnotations=e},initialValue:!1},fadeFoldWidgets:{set:function(e){r.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(e){!0==this.$textLayer.setHighlightIndentGuides(e)?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){this.$hScrollBarAlwaysVisible&&this.$horizScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){this.$vScrollBarAlwaysVisible&&this.$vScroll||this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){"number"==typeof e&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<0x1ffffffffffff||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0,this.$scrollPastEnd!=e&&(this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(e){this.$updateCustomScrollbar(e)},initialValue:!1},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!w.isMobile&&!w.isIE}}),t.VirtualRenderer=$}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,n){"use strict";var i=e("../lib/oop"),r=e("../lib/net"),o=e("../lib/event_emitter").EventEmitter,s=e("../config");function a(e){var t="importScripts('"+r.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(e){var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder);return n.append(t),n.getBlob("application/javascript")}}function l(e){if("u"<typeof Worker)return{postMessage:function(){},terminate:function(){}};if(s.get("loadWorkerFromBlob")){var t=a(e);return new Worker((window.URL||window.webkitURL).createObjectURL(t))}return new Worker(e)}var c=function(e){e.postMessage||(e=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=e,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){i.implement(this,o),this.$createWorkerFromOldConfig=function(t,n,i,r,o){if(e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl),s.get("packaged")||!e.toUrl)r=r||s.moduleUrl(n,"worker");else{var a=this.$normalizePath;r=r||a(e.toUrl("ace/worker/worker.js",null,"_"));var c={};t.forEach(function(t){c[t]=a(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=l(r),o&&this.send("importScripts",o),this.$worker.postMessage({init:!0,tlns:c,module:n,classname:i}),this.$worker},this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var n=this.callbacks[t.id];n&&(n(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return r.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(e){e.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,n){if(n){var i=this.callbackId++;this.callbacks[i]=n,t.push(i)}this.send(e,t)},this.emit=function(e,t){try{t.data&&t.data.err&&(t.data.err={message:t.data.err.message,stack:t.data.err.stack,code:t.data.err.code}),this.$worker&&this.$worker.postMessage({event:e,data:{data:t.data}})}catch(e){console.error(e.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener,!0)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),"insert"==e.action?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;e&&(this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e}))}}).call(c.prototype),t.UIWorkerClient=function(e,t,n){var i=null,r=!1,a=Object.create(o),l=[],u=new c({messageBuffer:l,terminate:function(){},postMessage:function(e){l.push(e),i&&(r?setTimeout(d):d())}});u.setEmitSync=function(e){r=e};var d=function(){var e=l.shift();e.command?i[e.command].apply(i,e.args):e.event&&a._signal(e.event,e.data)};return a.postMessage=function(e){u.onMessage({data:e})},a.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},a.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},s.loadModule(["worker",t],function(e){for(i=new e[n](a);l.length;)d()}),u},t.WorkerClient=c,t.createWorker=l}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var i=e("./range").Range,r=e("./lib/event_emitter").EventEmitter,o=e("./lib/oop"),s=function(){function e(e,t,n,i,r,o){var s=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=r,this.othersClass=o,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=i,this.$onCursorChange=function(){setTimeout(function(){s.onCursorChange()})},this.$pos=n;var a=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=a.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return e.prototype.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var r=this.pos;r.$insertRight=!0,r.detach(),r.markerId=n.addMarker(new i(r.row,r.column,r.row,r.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var i=t.createAnchor(n.row,n.column);i.$insertRight=!0,i.detach(),e.others.push(i)}),n.setUndoSelect(!1)},e.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new i(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})}},e.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},e.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var n="insert"===e.action?t.end.column-t.start.column:t.start.column-t.end.column,r=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,o=t.start.column-this.pos.column;if(this.updateAnchors(e),r&&(this.length+=n),r&&!this.session.$fromUndo){if("insert"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.insertMergedLines(l,e.lines)}else if("remove"===e.action)for(var s=this.others.length-1;s>=0;s--){var a=this.others[s],l={row:a.row,column:a.column+o};this.doc.remove(new i(l.row,l.column,l.row,l.column-n))}}this.$updating=!1,this.updateMarkers()}},e.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},e.prototype.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,n=function(n,r){t.removeMarker(n.markerId),n.markerId=t.addMarker(new i(n.row,n.column,n.row,n.column+e.length),r,null,!1)};n(this.pos,this.mainClass);for(var r=this.others.length;r--;)n(this.others[r],this.othersClass)}},e.prototype.onCursorChange=function(e){if(!this.$updating&&this.session){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},e.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},e.prototype.cancel=function(){if(-1!==this.$undoStackDepth){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,n=0;n<t;n++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},e}();o.implement(s.prototype,r),t.PlaceHolder=s}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){var i=e("../lib/event"),r=e("../lib/useragent");function o(e,t){return e.row==t.row&&e.column==t.column}t.onMouseDown=function(e){var t=e.domEvent,n=t.altKey,s=t.shiftKey,a=t.ctrlKey,l=e.getAccelKey(),c=e.getButton();if(a&&r.isMac&&(c=t.button),e.editor.inMultiSelectMode&&2==c)return void e.editor.textInput.onContextMenu(e.domEvent);if(!a&&!n&&!l){0===c&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(0===c){var u=e.editor,d=u.selection,h=u.inMultiSelectMode,p=e.getDocumentPosition(),f=d.getCursor(),g=e.inSelection()||d.isEmpty()&&o(p,f),m=e.x,v=e.y,b=function(e){m=e.clientX,v=e.clientY},y=u.session,w=u.renderer.pixelToScreenCoordinates(m,v),x=w;if(u.$mouseHandler.$enableJumpToDef)a&&n||l&&n?S=s?"block":"add":n&&u.$blockSelectEnabled&&(S="block");else if(l&&!n){if(S="add",!h&&s)return}else n&&u.$blockSelectEnabled&&(S="block");if(S&&r.isMac&&t.ctrlKey&&u.$mouseHandler.cancelContextMenu(),"add"==S){if(!h&&g)return;if(!h){var $=d.toOrientedRange();u.addSelectionMarker($)}var _=d.rangeList.rangeAtPoint(p);u.inVirtualSelectionMode=!0,s&&(_=null,$=d.ranges[0]||$,u.removeSelectionMarker($)),u.once("mouseup",function(){var e=d.toOrientedRange();_&&e.isEmpty()&&o(_.cursor,e.cursor)?d.substractPoint(e.cursor):(s?d.substractPoint($.cursor):$&&(u.removeSelectionMarker($),d.addRange($)),d.addRange(e)),u.inVirtualSelectionMode=!1})}else if("block"==S){e.stop(),u.inVirtualSelectionMode=!0;var S,M,C=[],E=function(){var e=u.renderer.pixelToScreenCoordinates(m,v),t=y.screenToDocumentPosition(e.row,e.column,e.offsetX);o(x,e)&&o(t,d.lead)||(x=e,u.selection.moveToPosition(t),u.renderer.scrollCursorIntoView(),u.removeSelectionMarkers(C),C=d.rectangularRangeBlock(x,w),u.$mouseHandler.$clickSelection&&1==C.length&&C[0].isEmpty()&&(C[0]=u.$mouseHandler.$clickSelection.clone()),C.forEach(u.addSelectionMarker,u),u.updateSelectionMarkers())};h&&!l?d.toSingleRange():!h&&l&&(M=d.toOrientedRange(),u.addSelectionMarker(M)),s?w=y.documentToScreenPosition(d.lead):d.moveToPosition(p),x={row:-1,column:-1};var k=function(e){E(),clearInterval(T),u.removeSelectionMarkers(C),C.length||(C=[d.toOrientedRange()]),M&&(u.removeSelectionMarker(M),d.toSingleRange(M));for(var t=0;t<C.length;t++)d.addRange(C[t]);u.inVirtualSelectionMode=!1,u.$mouseHandler.$clickSelection=null},A=E;i.capture(u.container,b,k);var T=setInterval(function(){A()},20);return e.preventDefault()}}}}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,t,n){t.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(e){e.multiSelect.rangeCount>1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}],t.keyboardHandler=new(e("../keyboard/hash_handler")).HashHandler(t.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,t,n){var i=e("./range_list").RangeList,r=e("./range").Range,o=e("./selection").Selection,s=e("./mouse/multi_select_handler").onMouseDown,a=e("./lib/event"),l=e("./lib/lang"),c=e("./commands/multi_select_commands");t.commands=c.defaultCommands.concat(c.multiSelectCommands);var u=new(e("./search")).Search;function d(e,t,n){return u.$options.wrap=!0,u.$options.needle=t,u.$options.backwards=-1==n,u.find(e)}(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(e("./edit_session").EditSession.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(e){if(!this.inMultiSelectMode&&0===this.rangeCount){var n=this.toOrientedRange();if(this.rangeList.add(n),this.rangeList.add(e),2!=this.rangeList.ranges.length)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(n),this.$onAddRange(n)}e.cursor||(e.cursor=e.end);var i=this.rangeList.add(e);return this.$onAddRange(e),i.length&&this.$onRemoveRange(i),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)}},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){if(this.rangeCount=this.rangeList.ranges.length,1==this.rangeCount&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var i=this.ranges.indexOf(e[n]);this.ranges.splice(i,1)}this._signal("removeRange",{ranges:e}),0===this.rangeCount&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),(t=t||this.ranges[0])&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new i,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var e=this.ranges.length?this.ranges:[this.getRange()],t=[],n=0;n<e.length;n++){var i=e[n],o=i.start.row,s=i.end.row;if(o===s)t.push(i.clone());else{for(t.push(new r(o,i.start.column,o,this.session.getLine(o).length));++o<s;)t.push(this.getLineRange(o,!0));t.push(new r(s,0,s,i.end.column))}0!=n||this.isBackwards()||(t=t.reverse())}this.toSingleRange();for(var n=t.length;n--;)this.addRange(t[n])},this.joinSelections=function(){var e=this.rangeList.ranges,t=e[e.length-1],n=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=r.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var i=this.session.documentToScreenPosition(this.cursor),o=this.session.documentToScreenPosition(this.anchor);this.rectangularRangeBlock(i,o).forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var i,o=[],s=e.column<t.column;if(s)var a=e.column,l=t.column,c=e.offsetX,u=t.offsetX;else var a=t.column,l=e.column,c=t.offsetX,u=e.offsetX;var d=e.row<t.row;if(d)var h=e.row,f=t.row;else var h=t.row,f=e.row;a<0&&(a=0),h<0&&(h=0),h==f&&(n=!0);for(var g=h;g<=f;g++){var m=r.fromPoints(this.session.screenToDocumentPosition(g,a,c),this.session.screenToDocumentPosition(g,l,u));if(m.isEmpty()){if(i&&p(m.end,i))break;i=m.end}m.cursor=s?m.start:m.end,o.push(m)}if(d&&o.reverse(),!n){for(var v=o.length-1;o[v].isEmpty()&&v>0;)v--;if(v>0)for(var b=0;o[b].isEmpty();)b++;for(var y=v;y>=b;y--)o[y].isEmpty()&&o.splice(y,1)}return o}}).call(o.prototype);var h=e("./editor").Editor;function p(e,t){return e.row==t.row&&e.column==t.column}function f(e){e.$multiselectOnSessionChange||(e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",s),e.commands.addCommands(c.defaultCommands),g(e))}function g(e){if(e.textInput){var t=e.textInput.getElement(),n=!1;a.addListener(t,"keydown",function(t){var r=18==t.keyCode&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&r?n||(e.renderer.setMouseCursor("crosshair"),n=!0):n&&i()},e),a.addListener(t,"keyup",i,e),a.addListener(t,"blur",i,e)}function i(t){n&&(e.renderer.setMouseCursor(""),n=!1)}}(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(e.marker){this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);-1!=t&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(e){for(var t=this.session.$selectionMarkers,n=e.length;n--;){var i=e[n];if(i.marker){this.session.removeMarker(i.marker);var r=t.indexOf(i);-1!=r&&t.splice(r,1)}}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(c.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(e){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(c.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(n.multiSelect){if(t.multiSelectAction)"forEach"==t.multiSelectAction?i=n.forEachSelection(t,e.args):"forEachLine"==t.multiSelectAction?i=n.forEachSelection(t,e.args,!0):"single"==t.multiSelectAction?(n.exitMultiSelectMode(),i=t.exec(n,e.args||{})):i=t.multiSelectAction(n,e.args||{});else{var i=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}return i}},this.forEachSelection=function(e,t,n){if(!this.inVirtualSelectionMode){var i,r=n&&n.keepOrder,s=!0==n||n&&n.$byLines,a=this.session,l=this.selection,c=l.rangeList,u=(r?l:c).ranges;if(!u.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var d=l._eventRegistry;l._eventRegistry={};var h=new o(a);this.inVirtualSelectionMode=!0;for(var p=u.length;p--;){if(s)for(;p>0&&u[p].start.row==u[p-1].end.row;)p--;h.fromOrientedRange(u[p]),h.index=p,this.selection=a.selection=h;var f=e.exec?e.exec(this,t||{}):e(this,t||{});i||void 0===f||(i=f),h.toOrientedRange(u[p])}h.detach(),this.selection=a.selection=l,this.inVirtualSelectionMode=!1,l._eventRegistry=d,l.mergeOverlappingRanges(),l.ranges[0]&&l.fromOrientedRange(l.ranges[0]);var g=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),g&&g.from==g.to&&this.renderer.animateScrolling(g.from),i}},this.exitMultiSelectMode=function(){this.inMultiSelectMode&&!this.inVirtualSelectionMode&&this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var t=this.multiSelect.rangeList.ranges,n=[],i=0;i<t.length;i++)n.push(this.session.getTextRange(t[i]));var r=this.session.getDocument().getNewLineCharacter();(e=n.join(r)).length==(n.length-1)*r.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,t){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var n=this.multiSelect.ranges[0];if(!this.multiSelect.isEmpty()||t!=this.multiSelect.anchor){var i=t==this.multiSelect.anchor?n.cursor==n.start?n.end:n.start:n.cursor;i.row!=t.row||this.session.$clipPositionToDocument(i.row,i.column).column!=t.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}}},this.findAll=function(e,t,n){if((t=t||{}).needle=e||t.needle,void 0==t.needle){var i=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(i)}this.$search.set(t);var r=this.$search.findAll(this.session);if(!r.length)return 0;var o=this.multiSelect;n||o.toSingleRange(r[0]);for(var s=r.length;s--;)o.addRange(r[s],!0);return i&&o.rangeList.rangeAtPoint(i.start)&&o.addRange(i,!0),r.length},this.selectMoreLines=function(e,t){var n=this.selection.toOrientedRange(),i=n.cursor==n.end,o=this.session.documentToScreenPosition(n.cursor);this.selection.$desiredColumn&&(o.column=this.selection.$desiredColumn);var s=this.session.screenToDocumentPosition(o.row+e,o.column);if(n.isEmpty())var a=s;else var l=this.session.documentToScreenPosition(i?n.end:n.start),a=this.session.screenToDocumentPosition(l.row+e,l.column);if(i){var c=r.fromPoints(s,a);c.cursor=c.start}else{var c=r.fromPoints(a,s);c.cursor=c.end}if(c.desiredColumn=o.column,this.selection.inMultiSelectMode){if(t)var u=n.cursor}else this.selection.addRange(n);this.selection.addRange(c),u&&this.selection.substractPoint(u)},this.transposeSelections=function(e){for(var t=this.session,n=t.multiSelect,i=n.ranges,r=i.length;r--;){var o=i[r];if(o.isEmpty()){var s=t.getWordRange(o.start.row,o.start.column);o.start.row=s.start.row,o.start.column=s.start.column,o.end.row=s.end.row,o.end.column=s.end.column}}n.mergeOverlappingRanges();for(var a=[],r=i.length;r--;){var o=i[r];a.unshift(t.getTextRange(o))}e<0?a.unshift(a.pop()):a.push(a.shift());for(var r=i.length;r--;){var o=i[r],l=o.clone();t.replace(o,a[r]),o.start.row=l.start.row,o.start.column=l.start.column}n.fromOrientedRange(n.ranges[0])},this.selectMore=function(e,t,n){var i=this.session,r=i.multiSelect.toOrientedRange();if(!r.isEmpty()||((r=i.getWordRange(r.start.row,r.start.column)).cursor=-1==e?r.start:r.end,this.multiSelect.addRange(r),!n)){var o=i.getTextRange(r),s=d(i,o,e);s&&(s.cursor=-1==e?s.start:s.end,this.session.unfold(s),this.multiSelect.addRange(s),this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(r.cursor)}},this.alignCursors=function(){var e=this.session,t=e.multiSelect,n=t.ranges,i=-1,o=n.filter(function(e){if(e.cursor.row==i)return!0;i=e.cursor.row});if(n.length&&o.length!=n.length-1){o.forEach(function(e){t.substractPoint(e.cursor)});var s=0,a=1/0,c=n.map(function(t){var n=t.cursor,i=e.getLine(n.row).substr(n.column).search(/\S/g);return -1==i&&(i=0),n.column>s&&(s=n.column),i<a&&(a=i),i});n.forEach(function(t,n){var i=t.cursor,o=s-i.column,u=c[n]-a;o>u?e.insert(i,l.stringRepeat(" ",o-u)):e.remove(new r(i.row,i.column,i.row,i.column-o+u)),t.start.column=t.end.column=s,t.start.row=t.end.row=i.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}else{var u=this.selection.getRange(),d=u.start.row,h=u.end.row,p=d==h;if(p){var f,g=this.session.getLength();do f=this.session.getLine(h);while(/[=:]/.test(f)&&++h<g);do f=this.session.getLine(d);while(/[=:]/.test(f)&&--d>0);d<0&&(d=0),h>=g&&(h=g-1)}var m=this.session.removeFullLines(d,h);m=this.$reAlignText(m,p),this.session.insert({row:d,column:0},m.join("\n")+"\n"),p||(u.start.column=0,u.end.column=m[m.length-1].length),this.selection.setRange(u)}},this.$reAlignText=function(e,t){var n,i,r,o=!0,s=!0;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?(null==n?(n=t[1].length,i=t[2].length,r=t[3].length):(n+i+r!=t[1].length+t[2].length+t[3].length&&(s=!1),n!=t[1].length&&(o=!1),n>t[1].length&&(n=t[1].length),i<t[2].length&&(i=t[2].length),r>t[3].length&&(r=t[3].length)),t):[e]}).map(t?c:o?s?u:c:d);function a(e){return l.stringRepeat(" ",e)}function c(e){return e[2]?a(n)+e[2]+a(i-e[2].length+r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function u(e){return e[2]?a(n+i-e[2].length)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function d(e){return e[2]?a(n)+e[2]+a(r)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}}}).call(h.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=f,e("./config").defineOptions(h.prototype,"editor",{enableMultiselect:{set:function(e){f(this),e?this.on("mousedown",s):this.off("mousedown",s)},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var i=e("../../range").Range;(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var i=e.getLine(n);return this.foldingStartMarker.test(i)?"start":"markbeginend"==t&&this.foldingStopMarker&&this.foldingStopMarker.test(i)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var r=/\S/,o=e.getLine(t),s=o.search(r);if(-1!=s){for(var a=n||o.length,l=e.getLength(),c=t,u=t;++t<l;){var d=e.getLine(t).search(r);if(-1!=d){if(d<=s){var h=e.getTokenAt(t,0);if(!h||"string"!==h.type)break}u=t}}if(u>c){var p=e.getLine(u).length;return new i(c,a,u,p)}}},this.openingBracketBlock=function(e,t,n,r,o){var s={row:n,column:r+1},a=e.$findClosingBracket(t,s,o);if(a){var l=e.foldWidgets[a.row];return null==l&&(l=e.getFoldWidget(a.row)),"start"==l&&a.row>s.row&&(a.row--,a.column=e.getLine(a.row).length),i.fromPoints(s,a)}},this.closingBracketBlock=function(e,t,n,r,o){var s={row:n,column:r},a=e.$findOpeningBracket(t,s);if(a)return a.column++,s.column--,i.fromPoints(a,s)}}).call((t.FoldMode=function(){}).prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range","ace/config"],function(e,t,n){"use strict";var i=e("../line_widgets").LineWidgets,r=e("../lib/dom"),o=e("../range").Range,s=e("../config").nls;function a(e,t,n){for(var i=0,r=e.length-1;i<=r;){var o=i+r>>1,s=n(t,e[o]);if(s>0)i=o+1;else{if(!(s<0))return o;r=o-1}}return-(i+1)}function l(e,t,n){var i=e.getAnnotations().sort(o.comparePoints);if(i.length){var r=a(i,{row:t,column:-1},o.comparePoints);r<0&&(r=-r-1),r>=i.length?r=n>0?0:i.length-1:0===r&&n<0&&(r=i.length-1);var s=i[r];if(s&&n){if(s.row===t){do s=i[r+=n];while(s&&s.row===t);if(!s)return i.slice()}var l=[];t=s.row;do l[n<0?"unshift":"push"](s),s=i[r+=n];while(s&&s.row==t);return l.length&&l}}}t.showErrorMarker=function(e,t){var n,o=e.session;o.widgetManager||(o.widgetManager=new i(o),o.widgetManager.attach(e));var a=e.getCursorPosition(),c=a.row,u=o.widgetManager.getWidgetsAtRow(c).filter(function(e){return"errorMarker"==e.type})[0];u?u.destroy():c-=t;var d=l(o,c,t);if(d){var h=d[0];a.column=(h.pos&&"number"!=typeof h.column?h.pos.sc:h.column)||0,a.row=h.row,n=e.renderer.$gutterLayer.$annotations[a.row]}else{if(u)return;n={displayText:[s("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(a.row),e.selection.moveToPosition(a);var p={row:a.row,fixedWidth:!0,coverGutter:!0,el:r.createElement("div"),type:"errorMarker"},f=p.el.appendChild(r.createElement("div")),g=p.el.appendChild(r.createElement("div"));g.className="error_widget_arrow "+n.className;var m=e.renderer.$cursorLayer.getPixelPosition(a).left;g.style.left=m+e.renderer.gutterWidth-5+"px",p.el.className="error_widget_wrapper",f.className="error_widget "+n.className,n.displayText.forEach(function(e,t){f.appendChild(r.createTextNode(e)),t<n.displayText.length-1&&f.appendChild(r.createElement("br"))}),f.appendChild(r.createElement("div"));var v=function(e,t,n){if(0===t&&("esc"===n||"return"===n))return p.destroy(),{command:"null"}};p.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(v),o.widgetManager.removeLineWidget(p),e.off("changeSelection",p.destroy),e.off("changeSession",p.destroy),e.off("mouseup",p.destroy),e.off("change",p.destroy))},e.keyBinding.addKeyboardHandler(v),e.on("changeSelection",p.destroy),e.on("changeSession",p.destroy),e.on("mouseup",p.destroy),e.on("change",p.destroy),e.session.widgetManager.addLineWidget(p),p.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:p.el.offsetHeight})},r.importCssString("\n .error_widget_wrapper {\n background: inherit;\n color: inherit;\n border:none\n }\n .error_widget {\n border-top: solid 2px;\n border-bottom: solid 2px;\n margin: 5px 0;\n padding: 10px 40px;\n white-space: pre-wrap;\n }\n .error_widget.ace_error, .error_widget_arrow.ace_error{\n border-color: #ff5a5a\n }\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n border-color: #F1D817\n }\n .error_widget.ace_info, .error_widget_arrow.ace_info{\n border-color: #5a5a5a\n }\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n border-color: #5aaa5a\n }\n .error_widget_arrow {\n position: absolute;\n border: solid 5px;\n border-top-color: transparent!important;\n border-right-color: transparent!important;\n border-left-color: transparent!important;\n top: -5px;\n }\n","error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(e,t,n){"use strict";e("./loader_build")(t);var i=e("./lib/dom"),r=e("./range").Range,o=e("./editor").Editor,s=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,l=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.edit=function(e,n){if("string"==typeof e){var r=e;if(!(e=document.getElementById(r)))throw Error("ace.edit can't find div #"+r)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var s="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;s=a.value,e=i.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(s=e.textContent,e.innerHTML="");var c=t.createEditSession(s),u=new o(new l(e),c,n),d={document:c,editor:u,onResize:u.resize.bind(u,null)};return a&&(d.textarea=a),u.on("destroy",function(){d.editor.container.env=null}),u.container.env=u.env=d,u},t.createEditSession=function(e,t){var n=new s(e,t);return n.setUndoManager(new a),n},t.Range=r,t.Editor=o,t.EditSession=s,t.UndoManager=a,t.VirtualRenderer=l,t.version=t.config.version}),function(){ace.require(["ace/ace"],function(t){t&&(t.config.init(!0),t.define=ace.define);var n=function(){return this}();for(var i in!n&&"u">typeof window&&(n=window),!n&&"u">typeof self&&(n=self),n.ace||(n.ace=t),t)t.hasOwnProperty(i)&&(n.ace[i]=t[i]);n.ace.default=n.ace,e&&(e.exports=n.ace)})}()},20047(e,t,n){e=n.nmd(e),ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(e,t,n){"use strict";var i=e("./lib/dom"),r=e("./lib/oop"),o=e("./lib/event_emitter").EventEmitter,s=e("./lib/lang"),a=e("./range").Range,l=e("./range_list").RangeList,c=e("./keyboard/hash_handler").HashHandler,u=e("./tokenizer").Tokenizer,d=e("./clipboard"),h={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,t,n){var i=e.session.getTextRange();return n?i.replace(/\n\r?([ \t]*\S)/g,"\n"+n+"$1"):i},CURRENT_LINE:function(e){return e.session.getLine(e.getCursorPosition().row)},PREV_LINE:function(e){return e.session.getLine(e.getCursorPosition().row-1)},LINE_INDEX:function(e){return e.getCursorPosition().row},LINE_NUMBER:function(e){return e.getCursorPosition().row+1},SOFT_TABS:function(e){return e.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(e){return e.session.getTabSize()},CLIPBOARD:function(e){return d.getText&&d.getText()},FILENAME:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0]},FILENAME_BASE:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(e){return this.FILEPATH(e).replace(/[^/\\]*$/,"")},FILEPATH:function(e){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(e){var t=e.session.$mode||{};return t.blockComment&&t.blockComment.start||""},BLOCK_COMMENT_END:function(e){var t=e.session.$mode||{};return t.blockComment&&t.blockComment.end||""},LINE_COMMENT:function(e){return(e.session.$mode||{}).lineCommentStart||""},CURRENT_YEAR:p.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:p.bind(null,{year:"2-digit"}),CURRENT_MONTH:p.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:p.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:p.bind(null,{month:"short"}),CURRENT_DATE:p.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:p.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:p.bind(null,{weekday:"short"}),CURRENT_HOUR:p.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:p.bind(null,{minute:"2-digit"}),CURRENT_SECOND:p.bind(null,{second:"2-digit"})};function p(e){var t=new Date().toLocaleString("en-us",e);return 1==t.length?"0"+t:t}h.SELECTED_TEXT=h.SELECTION;var f=function(){function e(){this.snippetMap={},this.snippetNameMap={},this.variables=h}return e.prototype.getTokenizer=function(){return e.$tokenizer||this.createTokenizer()},e.prototype.createTokenizer=function(){function t(e){return(e=e.substr(1),/^\d+$/.test(e))?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function n(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var i={regex:"/("+n("/")+"+)/",onMatch:function(e,t,n){var i=n[0];return i.fmtString=!0,i.guard=e.slice(1,-1),i.flag="",""},next:"formatString"};return e.$tokenizer=new u({start:[{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return"}"==i&&n.length?e=i:-1!="`$\\".indexOf(i)&&(e=i),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:t},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,n,i){var r=t(e.substr(1));return i.unshift(r[0]),r},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+n("\\|")+"*\\|",onMatch:function(e,t,n){var i=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return n[0].choices=i,[i[0]]},next:"start"},i,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectElse?(n[0].expectElse=!1,n[0].ifEnd={elseEnd:n[0]},[n[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return"}"==i&&n.length||-1!="`$\\".indexOf(i)?e=i:"n"==i?e="\n":"t"==i?e=" ":-1!="ulULE".indexOf(i)&&(e={changeCase:i,local:i>"a"}),[e]}},{regex:"/\\w*}",onMatch:function(e,t,n){var i=n.shift();return i&&(i.flag=e.slice(1,-1)),this.next=i&&i.tabstopId?"start":"",[i||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,t,n){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,t,n){var i={text:e.slice(2)};return n.unshift(i),[i]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,t,n){var i=n.shift();return this.next=i&&i.tabstopId?"start":"",[i||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,t,n){return n[0].formatFunction=e.slice(2,-1),[n.shift()]},next:"formatString"},i,{regex:/:[\?\-+]?/,onMatch:function(e,t,n){"+"==e[1]&&(n[0].ifEnd=n[0]),"?"==e[1]&&(n[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),e.$tokenizer},e.prototype.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},e.prototype.getVariableValue=function(e,t,n){if(/^\d+$/.test(t))return(this.variables.__||{})[t]||"";if(/^[A-Z]\d+$/.test(t))return(this.variables[t[0]+"__"]||{})[t.substr(1)]||"";if(t=t.replace(/^TM_/,""),!this.variables.hasOwnProperty(t))return"";var i=this.variables[t];return"function"==typeof i&&(i=this.variables[t](e,t,n)),null==i?"":i},e.prototype.tmStrFormat=function(e,t,n){if(!t.fmt)return e;var i=t.flag||"",r=t.guard;r=new RegExp(r,i.replace(/[^gim]/g,""));var o="string"==typeof t.fmt?this.tokenizeTmSnippet(t.fmt,"formatString"):t.fmt,s=this;return e.replace(r,function(){var e=s.variables.__;s.variables.__=[].slice.call(arguments);for(var t=s.resolveVariables(o,n),i="E",r=0;r<t.length;r++){var a=t[r];if("object"==typeof a)if(t[r]="",a.changeCase&&a.local){var l=t[r+1];l&&"string"==typeof l&&("u"==a.changeCase?t[r]=l[0].toUpperCase():t[r]=l[0].toLowerCase(),t[r+1]=l.substr(1))}else a.changeCase&&(i=a.changeCase);else"U"==i?t[r]=a.toUpperCase():"L"==i&&(t[r]=a.toLowerCase())}return s.variables.__=e,t.join("")})},e.prototype.tmFormatFunction=function(e,t,n){return"upcase"==t.formatFunction?e.toUpperCase():"downcase"==t.formatFunction?e.toLowerCase():e},e.prototype.resolveVariables=function(e,t){for(var n=[],i="",r=!0,o=0;o<e.length;o++){var s=e[o];if("string"==typeof s){n.push(s),"\n"==s?(r=!0,i=""):r&&(i=/^\t*/.exec(s)[0],r=/\S/.test(s));continue}if(s){if(r=!1,s.fmtString){var a=e.indexOf(s,o+1);-1==a&&(a=e.length),s.fmt=e.slice(o+1,a),o=a}if(s.text){var l=this.getVariableValue(t,s.text,i)+"";s.fmtString&&(l=this.tmStrFormat(l,s,t)),s.formatFunction&&(l=this.tmFormatFunction(l,s,t)),l&&!s.ifEnd?(n.push(l),c(s)):!l&&s.ifEnd&&c(s.ifEnd)}else s.elseEnd?c(s.elseEnd):null!=s.tabstopId?n.push(s):null!=s.changeCase&&n.push(s)}}function c(t){var n=e.indexOf(t,o+1);-1!=n&&(o=n)}return n},e.prototype.getDisplayTextForSnippet=function(e,t){return g.call(this,e,t).text},e.prototype.insertSnippetForSelection=function(e,t,n){void 0===n&&(n={});var i=g.call(this,e,t,n),r=e.getSelectionRange(),o=e.session.replace(r,i.text),s=new m(e),a=e.inVirtualSelectionMode&&e.selection.index;s.addTabstops(i.tabstops,r.start,o,a)},e.prototype.insertSnippet=function(e,t,n){void 0===n&&(n={});var i=this;if(e.inVirtualSelectionMode)return i.insertSnippetForSelection(e,t,n);e.forEachSelection(function(){i.insertSnippetForSelection(e,t,n)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},e.prototype.$getScope=function(e){var t=e.session.$mode.$id||"";if("html"===(t=t.split("/").pop())||"php"===t){"php"!==t||e.session.$mode.inlinePhp||(t="html");var n=e.getCursorPosition(),i=e.session.getState(n.row);"object"==typeof i&&(i=i[0]),i.substring&&("js-"==i.substring(0,3)?t="javascript":"css-"==i.substring(0,4)?t="css":"php-"==i.substring(0,4)&&(t="php"))}return t},e.prototype.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],i=this.snippetMap;return i[t]&&i[t].includeScopes&&n.push.apply(n,i[t].includeScopes),n.push("_"),n},e.prototype.expandWithTab=function(e,t){var n=this,i=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return i&&e.tabstopManager&&e.tabstopManager.tabNext(),i},e.prototype.expandSnippetForSelection=function(e,t){var n,i=e.getCursorPosition(),r=e.session.getLine(i.row),o=r.substring(0,i.column),s=r.substr(i.column),a=this.snippetMap;return this.getActiveScopes(e).some(function(e){var t=a[e];return t&&(n=this.findMatchingSnippet(t,o,s)),!!n},this),!!n&&(!!t&&!!t.dryRun||(e.session.doc.removeInLine(i.row,i.column-n.replaceBefore.length,i.column+n.replaceAfter.length),this.variables.M__=n.matchBefore,this.variables.T__=n.matchAfter,this.insertSnippetForSelection(e,n.content),this.variables.M__=this.variables.T__=null,!0))},e.prototype.findMatchingSnippet=function(e,t,n){for(var i=e.length;i--;){var r=e[i];if((!r.startRe||r.startRe.test(t))&&(!r.endRe||r.endRe.test(n))&&(r.startRe||r.endRe))return r.matchBefore=r.startRe?r.startRe.exec(t):[""],r.matchAfter=r.endRe?r.endRe.exec(n):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(t)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(n)[0]:"",r}},e.prototype.register=function(e,t){var n=this.snippetMap,i=this.snippetNameMap,r=this;function o(e){return e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)&&(e="(?:"+e+")"),e||""}function a(e,t,n){return e=o(e),t=o(t),n?(e=t+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=t)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function l(e){e.scope||(e.scope=t||"_"),n[t=e.scope]||(n[t]=[],i[t]={});var o=i[t];if(e.name){var l=o[e.name];l&&r.unregister(l),o[e.name]=e}n[t].push(e),e.prefix&&(e.tabTrigger=e.prefix),!e.content&&e.body&&(e.content=Array.isArray(e.body)?e.body.join("\n"):e.body),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=s.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=a(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger),e.endRe=a(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger))}e||(e=[]),Array.isArray(e)?e.forEach(l):Object.keys(e).forEach(function(t){l(e[t])}),this._signal("registerSnippets",{scope:t})},e.prototype.unregister=function(e,t){var n=this.snippetMap,i=this.snippetNameMap;function r(e){var r=i[e.scope||t];if(r&&r[e.name]){delete r[e.name];var o=n[e.scope||t],s=o&&o.indexOf(e);s>=0&&o.splice(s,1)}}e.content?r(e):Array.isArray(e)&&e.forEach(r)},e.prototype.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var t,n=[],i={},r=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;t=r.exec(e);){if(t[1])try{i=JSON.parse(t[1]),n.push(i)}catch(e){}if(t[4])i.content=t[4].replace(/^\t/gm,""),n.push(i),i={};else{var o=t[2],s=t[3];if("regex"==o){var a=/\/((?:[^\/\\]|\\.)*)|$/g;i.guard=a.exec(s)[1],i.trigger=a.exec(s)[1],i.endTrigger=a.exec(s)[1],i.endGuard=a.exec(s)[1]}else"snippet"==o?(i.tabTrigger=s.match(/^\S*/)[0],i.name||(i.name=s)):o&&(i[o]=s)}}return n},e.prototype.getSnippetByName=function(e,t){var n,i=this.snippetNameMap;return this.getActiveScopes(t).some(function(t){var r=i[t];return r&&(n=r[e]),!!n},this),n},e}();r.implement(f.prototype,o);var g=function(e,t,n){void 0===n&&(n={});var i=e.getCursorPosition(),r=e.session.getLine(i.row),o=e.session.getTabString(),s=r.match(/^\s*/)[0];i.column<s.length&&(s=s.slice(0,i.column)),t=t.replace(/\r/g,"");var a=this.tokenizeTmSnippet(t);a=(a=this.resolveVariables(a,e)).map(function(e){return"\n"!=e||n.excludeExtraIndent?"string"==typeof e?e.replace(/\t/g,o):e:e+s});var l=[];a.forEach(function(e,t){if("object"==typeof e){var n=e.tabstopId,i=l[n];if(i||((i=l[n]=[]).index=n,i.value="",i.parents={}),-1===i.indexOf(e)){e.choices&&!i.choices&&(i.choices=e.choices),i.push(e);var r=a.indexOf(e,t+1);if(-1!==r){var o=a.slice(t+1,r),s=o.some(function(e){return"object"==typeof e});s&&!i.value?i.value=o:o.length&&(!i.value||"string"!=typeof i.value)&&(i.value=o.join(""))}}}}),l.forEach(function(e){e.length=0});var c={};function u(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];if("object"==typeof i){if(c[i.tabstopId])continue;i=t[e.lastIndexOf(i,n-1)]||{tabstopId:i.tabstopId}}t[n]=i}return t}for(var d=0;d<a.length;d++){var h=a[d];if("object"==typeof h){var p=h.tabstopId,f=l[p],g=a.indexOf(h,d+1);if(c[p]){c[p]===h&&(delete c[p],Object.keys(c).forEach(function(e){f.parents[e]=!0}));continue}c[p]=h;var m=f.value;"string"!=typeof m?m=u(m):h.fmt&&(m=this.tmStrFormat(m,h,e)),a.splice.apply(a,[d+1,Math.max(0,g-d)].concat(m,h)),-1===f.indexOf(h)&&f.push(h)}}var v=0,b=0,y="";return a.forEach(function(e){if("string"==typeof e){var t=e.split("\n");t.length>1?(b=t[t.length-1].length,v+=t.length-1):b+=e.length,y+=e}else e&&(e.start?e.end={row:v,column:b}:e.start={row:v,column:b})}),{text:y,tabstops:l,tokens:a}},m=function(){function e(e){if(this.index=0,this.ranges=[],this.tabstops=[],e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)}return e.prototype.attach=function(e){this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.session=e.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},e.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},e.prototype.onChange=function(e){for(var t="r"==e.action[0],n=this.selectedTabstop||{},i=n.parents||{},r=this.tabstops.slice(),o=0;o<r.length;o++){var s=r[o],a=s==n||i[s.index];if(s.rangeList.$bias=+!a,"remove"==e.action&&s!==n){var l=s.parents&&s.parents[n.index],c=s.rangeList.pointIndex(e.start,l);c=c<0?-c-1:c+1;var u=s.rangeList.pointIndex(e.end,l);u=u<0?-u-1:u-1;for(var d=s.rangeList.ranges.slice(c,u),h=0;h<d.length;h++)this.removeRange(d[h])}s.rangeList.$onChange(e)}var p=this.session;this.$inChange||!t||1!=p.getLength()||p.getValue()||this.detach()},e.prototype.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var n=this.session,i=n.getTextRange(e.firstNonLinked),r=0;r<e.length;r++){var o=e[r];if(o.linked){var s=o.original,a=t.snippetManager.tmStrFormat(i,s,this.editor);n.replace(o,a)}}this.$inChange=!1}},e.prototype.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},e.prototype.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty(),i=0;i<this.ranges.length;i++)if(!this.ranges[i].linked){var r=this.ranges[i].contains(e.row,e.column),o=n||this.ranges[i].contains(t.row,t.column);if(r&&o)return}this.detach()}},e.prototype.onChangeSession=function(){this.detach()},e.prototype.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);(n=Math.min(Math.max(n,1),t))==t&&(n=0),this.selectTabstop(n),this.updateTabstopMarkers(),0===n&&this.detach()},e.prototype.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];if(t&&this.addTabstopMarkers(t),this.index=e,(t=this.tabstops[this.index])&&t.length){this.selectedTabstop=t;var n=t.firstNonLinked||t;if(t.choices&&(n.cursor=n.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(n);else{var i=this.editor.multiSelect;i.toSingleRange(n);for(var r=0;r<t.length;r++)t.hasLinkedRanges&&t[r].linked||i.addRange(t[r].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},e.prototype.addTabstops=function(e,t,n){var i=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!e[0]){var r=a.fromPoints(n,n);b(r.start,t),b(r.end,t),e[0]=[r],e[0].index=0}var o=[this.index+1,0],s=this.ranges,c=this.snippetId=(this.snippetId||0)+1;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;r.snippetId=c;for(var u=0;u<e.length;u++){var d=e[u],h=a.fromPoints(d.start,d.end||d.start);v(h.start,t),v(h.end,t),h.original=d,h.tabstop=r,s.push(h),r!=e?r.unshift(h):r[u]=h,d.fmtString||r.firstNonLinked&&i?(h.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=h)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(o.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r),r.rangeList=r.rangeList||new l,r.rangeList.$bias=0,r.rangeList.addList(r)},this),o.length>2&&(this.tabstops.length&&o.push(o.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,o))},e.prototype.addTabstopMarkers=function(e){var t=this.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},e.prototype.removeTabstopMarkers=function(e){var t=this.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},e.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var e=this.selectedTabstop.snippetId;0===this.selectedTabstop.index&&e--,this.tabstops.forEach(function(t){t.snippetId===e?this.addTabstopMarkers(t):this.removeTabstopMarkers(t)},this)}},e.prototype.removeRange=function(e){var t=e.tabstop.indexOf(e);-1!=t&&e.tabstop.splice(t,1),-1!=(t=this.ranges.indexOf(e))&&this.ranges.splice(t,1),-1!=(t=e.tabstop.rangeList.ranges.indexOf(e))&&e.tabstop.splice(t,1),this.session.removeMarker(e.markerId),!e.tabstop.length&&(-1!=(t=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},e}();m.prototype.keyboardHandler=new c,m.prototype.keyboardHandler.bindKeys({Tab:function(e){t.snippetManager&&t.snippetManager.expandWithTab(e)||(e.tabstopManager.tabNext(1),e.renderer.scrollCursorIntoView())},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1),e.renderer.scrollCursorIntoView()},Esc:function(e){e.tabstopManager.detach()}});var v=function(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row},b=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};i.importCssString("\n.ace_snippet-marker {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n background: rgba(194, 193, 208, 0.09);\n border: 1px dotted rgba(211, 208, 235, 0.62);\n position: absolute;\n}","snippets.css",!1),t.snippetManager=new f,(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(e("./editor").Editor.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(e,t,n){"use strict";var i=e("../virtual_renderer").VirtualRenderer,r=e("../editor").Editor,o=e("../range").Range,s=e("../lib/event"),a=e("../lib/lang"),l=e("../lib/dom"),c=e("../config").nls,u=e("./../lib/useragent"),d=function(e){return"suggest-aria-id:".concat(e)},h=u.isSafari?"menu":"listbox",p=u.isSafari?"menuitem":"option",f=u.isSafari?"aria-current":"aria-selected",g=function(e){var t=new i(e);t.$maxLines=4;var n=new r(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusTimeout=0,n.$highlightTagPending=!0,n},m=function(){return function(e){var t,n=l.createElement("div"),i=g(n);e&&e.appendChild(n),n.style.display="none",i.renderer.content.style.cursor="default",i.renderer.setStyle("ace_autocomplete"),i.renderer.$textLayer.element.setAttribute("role",h),i.renderer.$textLayer.element.setAttribute("aria-roledescription",c("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),i.renderer.$textLayer.element.setAttribute("aria-label",c("autocomplete.popup.aria-label","Autocomplete suggestions")),i.renderer.textarea.setAttribute("aria-hidden","true"),i.setOption("displayIndentGuides",!1),i.setOption("dragDelay",150);var r=function(){};i.focus=r,i.$isFocused=!0,i.renderer.$cursorLayer.restartTimer=r,i.renderer.$cursorLayer.element.style.opacity="0",i.renderer.$maxLines=8,i.renderer.$keepTextAreaAtCursor=!1,i.setHighlightActiveLine(!1),i.session.highlight(""),i.session.$searchHighlight.clazz="ace_highlight-marker",i.on("mousedown",function(e){var t=e.getDocumentPosition();i.selection.moveToPosition(t),m.start.row=m.end.row=t.row,e.stop()});var u=new o(-1,0,-1,1/0),m=new o(-1,0,-1,1/0);m.id=i.session.addMarker(m,"ace_active-line","fullLine"),i.setSelectOnHover=function(e){e?u.id&&(i.session.removeMarker(u.id),u.id=null):u.id=i.session.addMarker(u,"ace_line-hover","fullLine")},i.setSelectOnHover(!1),i.on("mousemove",function(e){if(!t){t=e;return}if(t.x!=e.x||t.y!=e.y){t=e,t.scrollTop=i.renderer.scrollTop,i.isMouseOver=!0;var n=t.getDocumentPosition().row;u.start.row!=n&&(u.id||i.setRow(n),b(n))}}),i.renderer.on("beforeRender",function(){if(t&&-1!=u.start.row){t.$pos=null;var e=t.getDocumentPosition().row;u.id||i.setRow(e),b(e,!0)}}),i.renderer.on("afterRender",function(){var e=i.getRow(),t=i.renderer.$textLayer,n=t.element.childNodes[e-t.config.firstRow],r=document.activeElement;if(n!==i.selectedNode&&i.selectedNode&&(l.removeCssClass(i.selectedNode,"ace_selected"),r.removeAttribute("aria-activedescendant"),i.selectedNode.removeAttribute(f),i.selectedNode.removeAttribute("id")),i.selectedNode=n,n){l.addCssClass(n,"ace_selected");var o=d(e);n.id=o,t.element.setAttribute("aria-activedescendant",o),r.setAttribute("aria-activedescendant",o),n.setAttribute("role",p),n.setAttribute("aria-roledescription",c("autocomplete.popup.item.aria-roledescription","item")),n.setAttribute("aria-label",i.getData(e).caption||i.getData(e).value),n.setAttribute("aria-setsize",i.data.length),n.setAttribute("aria-posinset",e+1),n.setAttribute("aria-describedby","doc-tooltip"),n.setAttribute(f,"true")}});var v=function(){b(-1)},b=function(e,t){e!==u.start.row&&(u.start.row=u.end.row=e,t||i.session._emit("changeBackMarker"),i._emit("changeHoverMarker"))};i.getHoveredRow=function(){return u.start.row},s.addListener(i.container,"mouseout",function(){i.isMouseOver=!1,v()}),i.on("hide",v),i.on("changeSelection",v),i.session.doc.getLength=function(){return i.data.length},i.session.doc.getLine=function(e){var t=i.data[e];return"string"==typeof t?t:t&&t.value||""};var y=i.session.bgTokenizer;return y.$tokenizeRow=function(e){var t=i.data[e],n=[];if(!t)return n;"string"==typeof t&&(t={value:t});var r=t.caption||t.value||t.name;function o(e,i){e&&n.push({type:(t.className||"")+(i||""),value:e})}for(var s=r.toLowerCase(),a=(i.filterText||"").toLowerCase(),l=0,c=0,u=0;u<=a.length;u++)if(u!=c&&(t.matchMask&1<<u||u==a.length)){var d=a.slice(c,u);c=u;var h=s.indexOf(d,l);if(-1==h)continue;o(r.slice(l,h),""),l=h+d.length,o(r.slice(h,l),"completion-highlight")}return o(r.slice(l,r.length),""),n.push({type:"completion-spacer",value:" "}),t.meta&&n.push({type:"completion-meta",value:t.meta}),t.message&&n.push({type:"completion-message",value:t.message}),n},y.$updateOnChange=r,y.start=r,i.session.$computeWidth=function(){return this.screenWidth=0},i.isOpen=!1,i.isTopdown=!1,i.autoSelect=!0,i.filterText="",i.isMouseOver=!1,i.data=[],i.setData=function(e,t){i.filterText=t||"",i.setValue(a.stringRepeat("\n",e.length),-1),i.data=e||[],i.setRow(0)},i.getData=function(e){return i.data[e]},i.getRow=function(){return m.start.row},i.setRow=function(e){e=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,e)),m.start.row!=e&&(i.selection.clearSelection(),m.start.row=m.end.row=e||0,i.session._emit("changeBackMarker"),i.moveCursorTo(e||0,0),i.isOpen&&i._signal("select"))},i.on("changeSelection",function(){i.isOpen&&i.setRow(i.selection.lead.row),i.renderer.scrollCursorIntoView()}),i.hide=function(){this.container.style.display="none",i.anchorPos=null,i.anchor=null,i.isOpen&&(i.isOpen=!1,this._signal("hide"))},i.tryShow=function(e,n,r,o){if(!o&&i.isOpen&&i.anchorPos&&i.anchor&&i.anchorPos.top===e.top&&i.anchorPos.left===e.left&&i.anchor===r)return!0;var s=this.container,a=window.innerHeight,l=window.innerWidth,c=this.renderer,u=c.$maxLines*n*1.4,d={top:0,bottom:0},h=a-e.top-3*this.$borderSize-n,p=e.top-3*this.$borderSize;r||(r=p<=h||h>=u?"bottom":"top"),"top"===r?(d.bottom=e.top-this.$borderSize,d.top=d.bottom-u):"bottom"===r&&(d.top=e.top+n+this.$borderSize,d.bottom=d.top+u);var f=d.top>=0&&d.bottom<=a;if(!o&&!f)return!1;f?c.$maxPixelHeight=null:"top"===r?c.$maxPixelHeight=p:c.$maxPixelHeight=h,"top"===r?(s.style.top="",s.style.bottom=a-d.bottom+"px",i.isTopdown=!1):(s.style.top=d.top+"px",s.style.bottom="",i.isTopdown=!0),s.style.display="";var g=e.left;return g+s.offsetWidth>l&&(g=l-s.offsetWidth),s.style.left=g+"px",s.style.right="",i.isOpen||(i.isOpen=!0,this._signal("show"),t=null),i.anchorPos=e,i.anchor=r,!0},i.show=function(e,t,n){this.tryShow(e,t,n?"bottom":void 0,!0)},i.goTo=function(e){var t=this.getRow(),n=this.session.getLength()-1;switch(e){case"up":t=t<=0?n:t-1;break;case"down":t=t>=n?-1:t+1;break;case"start":t=0;break;case"end":t=n}this.setRow(t)},i.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},i.$imageSize=0,i.$borderSize=1,i}}();l.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #CAD6FA;\n z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid #abbffe;\n margin-top: -1px;\n background: rgba(233,233,253,0.4);\n position: absolute;\n z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n border: 1px solid rgba(109, 150, 13, 0.8);\n background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n opacity: 0.5;\n margin-left: 0.9em;\n}\n.ace_completion-message {\n margin-left: 0.9em;\n color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n width: 300px;\n z-index: 200000;\n border: 1px lightgray solid;\n position: fixed;\n box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n line-height: 1.4;\n background: #fefefe;\n color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n border: 1px #484747 solid;\n box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n line-height: 1.4;\n background: #25282c;\n color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer {\n width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n display: flex;\n align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n min-width: 0;\n flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n flex: 0 1 auto;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n flex: 1;\n}\n.ace_autocomplete.ace_loading:after {\n content: "";\n position: absolute;\n top: 0px;\n height: 2px;\n width: 8%;\n background: blue;\n z-index: 100;\n animation: ace_progress 3s infinite linear;\n animation-delay: 300ms;\n transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n 0% { transform: translateX(-100%) scaleX(1) }\n 50% { transform: translateX(625%) scaleX(2) } \n 100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n .ace_autocomplete.ace_loading:after {\n transform: translateX(625%) scaleX(2);\n animation: none;\n }\n}\n',"autocompletion.css",!1),t.AcePopup=m,t.$singleLineEditor=g,t.getAriaId=d}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(e,t,n){"use strict";t.AceInlineScreenReader=function(){function e(e){this.editor=e,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return e.prototype.setScreenReaderContent=function(e){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",(function(){var e=this.popup.getRow(),t=this.popup.renderer.$textLayer,n=t.element.childNodes[e-t.config.firstRow];if(n){for(var i="doc-tooltip ",r=0;r<this._lines.length;r++)i+="ace-inline-screenreader-line-".concat(r," ");n.setAttribute("aria-describedby",i)}}).bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=e.split(/\r\n|\r|\n/);var t=this.createCodeBlock();this.screenReaderDiv.appendChild(t)},e.prototype.destroy=function(){this.screenReaderDiv.remove()},e.prototype.createCodeBlock=function(){var e=document.createElement("pre");e.setAttribute("id","ace-inline-screenreader");for(var t=0;t<this._lines.length;t++){var n=document.createElement("code");n.setAttribute("id","ace-inline-screenreader-line-".concat(t));var i=document.createTextNode(this._lines[t]);n.appendChild(i),e.appendChild(n)}return e},e}()}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(e,t,n){"use strict";var i=e("../snippets").snippetManager,r=e("./inline_screenreader").AceInlineScreenReader;t.AceInline=function(){function e(){this.editor=null}return e.prototype.show=function(e,t,n){if(n=n||"",e&&this.editor&&this.editor!==e&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!e||!t)return!1;this.inlineScreenReader||(this.inlineScreenReader=new r(e));var o=t.snippet?i.getDisplayTextForSnippet(e,t.snippet):t.value;return!t.hideInlinePreview&&!!o&&!!o.startsWith(n)&&(this.editor=e,this.inlineScreenReader.setScreenReaderContent(o),""===(o=o.slice(n.length))?e.removeGhostText():e.setGhostText(o),!0)},e.prototype.isOpen=function(){return!!this.editor&&!!this.editor.renderer.$ghostText},e.prototype.hide=function(){return!!this.editor&&(this.editor.removeGhostText(),!0)},e.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},e}()}),ace.define("ace/autocomplete/util",["require","exports","module"],function(e,t,n){"use strict";t.parForEach=function(e,t,n){var i=0,r=e.length;0===r&&n();for(var o=0;o<r;o++)t(e[o],function(e,t){++i===r&&n(e,t)})};var i=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||i;for(var r=[],o=t-1;o>=0;o--)if(n.test(e[o]))r.push(e[o]);else break;return r.reverse().join("")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||i;for(var r=[],o=t;o<e.length;o++)if(n.test(e[o]))r.push(e[o]);else break;return r},t.getCompletionPrefix=function(e){var t,n=e.getCursorPosition(),i=e.session.getLine(n.row);return e.completers.forEach((function(e){e.identifierRegexps&&e.identifierRegexps.forEach((function(e){!t&&e&&(t=this.retrievePrecedingIdentifier(i,n.column,e))}).bind(this))}).bind(this)),t||this.retrievePrecedingIdentifier(i,n.column)},t.triggerAutocomplete=function(e,t){var t=null==t?e.session.getPrecedingCharacter():t;return e.completers.some(function(e){if(e.triggerCharacters&&Array.isArray(e.triggerCharacters))return e.triggerCharacters.includes(t)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(e,t,n){"use strict";var i=e("./keyboard/hash_handler").HashHandler,r=e("./autocomplete/popup").AcePopup,o=e("./autocomplete/inline").AceInline,s=e("./autocomplete/popup").getAriaId,a=e("./autocomplete/util"),l=e("./lib/lang"),c=e("./lib/dom"),u=e("./snippets").snippetManager,d=e("./config"),h=e("./lib/event"),p=e("./lib/scroll").preventParentScroll,f=function(e,t){t.completer&&t.completer.destroy()},g=function(){function e(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new i,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=l.delayedCall((function(){this.updateCompletions(!0)}).bind(this)),this.tooltipTimer=l.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=l.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=l.delayedCall((function(){this.stickySelection=!0}).bind(this),this.stickySelectionDelay),this.$firstOpenTimer=l.delayedCall((function(){var t=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!t||0===this.editor.completers.length||(this.completions=new v(e.completionsForLoading),this.openPopup(this.editor,t.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}).bind(this),this.stickySelectionDelay)}return Object.defineProperty(e,"completionsForLoading",{get:function(){return[{caption:d.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),e.prototype.$init=function(){return this.popup=new r(this.parentNode||document.body||document.documentElement),this.popup.on("click",(function(e){this.insertMatch(),e.stop()}).bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),h.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},e.prototype.$initInline=function(){if(this.inlineEnabled&&!this.inlineRenderer)return this.inlineRenderer=new o,this.inlineRenderer},e.prototype.getPopup=function(){return this.popup||this.$init()},e.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},e.prototype.$seen=function(e){!this.hasSeen.has(e)&&e&&e.completer&&e.completer.onSeen&&"function"==typeof e.completer.onSeen&&(e.completer.onSeen(this.editor,e),this.hasSeen.add(e))},e.prototype.$onPopupChange=function(e){if(this.inlineRenderer&&this.inlineEnabled){var t=e?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(t),this.popup.isMouseOver&&this.setSelectOnHover)return void this.tooltipTimer.call(null,null);this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},e.prototype.$updateGhostText=function(e){var t=this.base.row,n=this.base.column,i=this.editor.getCursorPosition().column,r=this.editor.session.getLine(t).slice(n,i);this.inlineRenderer.show(this.editor,e,r)?this.$seen(e):this.inlineRenderer.hide()},e.prototype.$onPopupRender=function(){var e=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var t=this.popup.getFirstVisibleRow();t<=this.popup.getLastVisibleRow();t++){var n=this.popup.getData(t);n&&(!e||n.hideInlinePreview)&&this.$seen(n)}},e.prototype.$onPopupShow=function(e){this.$onPopupChange(e),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},e.prototype.observeLayoutChanges=function(){if(!this.$elements&&this.editor){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var e=this.editor.container.parentNode,t=[];e;)t.push(e),e.addEventListener("scroll",this.onLayoutChange,{passive:!0}),e=e.parentNode;this.$elements=t}},e.prototype.unObserveLayoutChanges=function(){var e=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(t){t.removeEventListener("scroll",e.onLayoutChange,{passive:!0})}),this.$elements=null},e.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},e.prototype.$updatePopupPosition=function(){var e=this.editor,t=e.renderer,n=t.layerConfig.lineHeight,i=t.$cursorLayer.getPixelPosition(this.base,!0);i.left-=this.popup.getTextLeftOffset();var r=e.container.getBoundingClientRect();i.top+=r.top-t.layerConfig.offset,i.left+=r.left-e.renderer.scrollLeft,i.left+=t.gutterWidth;var o={top:i.top,left:i.left};t.$ghostText&&t.$ghostTextWidget&&this.base.row===t.$ghostText.position.row&&(o.top+=t.$ghostTextWidget.el.offsetHeight);var s=e.container.getBoundingClientRect().bottom-n,a=s<o.top?{top:s,left:o.left}:o;this.popup.tryShow(a,n,"bottom")||this.popup.tryShow(i,n,"top")||this.popup.show(i,n)},e.prototype.openPopup=function(e,t,n){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var i,r=this.popup.getRow(),o=this.popup.data[r];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:s(this.popup.getRow()),inline:this.inlineEnabled}),e.keyBinding.addKeyboardHandler(this.keyboardHandler),this.stickySelection&&(i=this.popup.data.indexOf(o)),i&&-1!==i||(i=0),this.popup.setRow(this.autoSelect?i:-1),i===r&&o!==this.completions.filtered[i]&&this.$onPopupChange();var a=this.inlineRenderer&&this.inlineEnabled;if(i===r&&a){var l=this.popup.getData(this.popup.getRow());this.$updateGhostText(l)}!n&&(this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},e.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},e.prototype.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},e.prototype.blurListener=function(e){var t=document.activeElement,n=this.editor.textInput.getElement(),i=e.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(e.relatedTarget),r=this.popup&&this.popup.container;t==n||t.parentNode==r||i||t==this.tooltipNode||e.relatedTarget==n||this.detach()},e.prototype.mousedownListener=function(e){this.detach()},e.prototype.mousewheelListener=function(e){this.popup&&!this.popup.isMouseOver&&this.detach()},e.prototype.mouseOutListener=function(e){this.popup.isOpen&&this.$updatePopupPosition()},e.prototype.goTo=function(e){this.popup.goTo(e)},e.prototype.insertMatch=function(e,t){if(e||(e=this.popup.getData(this.popup.getRow())),!e)return!1;if(""===e.value)return this.detach();var n=this.completions,i=this.getCompletionProvider().insertMatch(this.editor,e,n.filterText,t);return this.completions==n&&this.detach(),i},e.prototype.showPopup=function(e,t){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,t)},e.prototype.getCompletionProvider=function(e){return this.completionProvider||(this.completionProvider=new m(e)),this.completionProvider},e.prototype.gatherCompletions=function(e,t){return this.getCompletionProvider().gatherCompletions(e,t)},e.prototype.updateCompletions=function(t,n){if(t&&this.base&&this.completions){var i=this.editor.getCursorPosition(),r=this.editor.session.getTextRange({start:this.base,end:i});return r==this.completions.filterText?void 0:(this.completions.setFilter(r),this.completions.filtered.length&&(1!=this.completions.filtered.length||this.completions.filtered[0].value!=r||this.completions.filtered[0].snippet))?void this.openPopup(this.editor,r,t):this.detach()}if(n&&n.matches){var i=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(i.row,i.column),this.base.$insertRight=!0,this.completions=new v(n.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",t)}var o=this.editor.getSession(),i=this.editor.getCursorPosition(),r=a.getCompletionPrefix(this.editor);this.base=o.doc.createAnchor(i.row,i.column-r.length),this.base.$insertRight=!0;var s={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:r,pos:i}).provideCompletions(this.editor,s,(function(n,i,r){var o=i.filtered,s=a.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),r){if(!o.length){var l=!this.autoShown&&this.emptyMessage;if("function"==typeof l&&(l=this.emptyMessage(s)),l){var c=[{caption:l,value:""}];this.completions=new v(c),this.openPopup(this.editor,s,t),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(1==o.length&&o[0].value==s&&!o[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&1==o.length)return this.insertMatch(o[0])}this.completions=!r&&this.showLoadingState?new v(e.completionsForLoading.concat(o),i.filterText):i,this.openPopup(this.editor,s,t),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!r)}).bind(this)),!this.showLoadingState||this.autoShown||this.popup&&this.popup.isOpen||this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},e.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},e.prototype.updateDocTooltip=function(){var e=this.popup,t=this.completions.filtered,n=t&&(t[e.getHoveredRow()]||t[e.getRow()]),i=null;if(!n||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var r=this.editor.completers.length,o=0;o<r;o++){var s=this.editor.completers[o];if(s.getDocTooltip&&n.completerId===s.id){i=s.getDocTooltip(n);break}}if(i||"string"==typeof n||(i=n),"string"==typeof i&&(i={docText:i}),!i||!(i.docHTML||i.docText))return this.hideDocTooltip();this.showDocTooltip(i)},e.prototype.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=c.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",p));var t=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(t.isDark?"ace_dark ":"")+(t.cssClass||"");var n=this.tooltipNode;e.docHTML?n.innerHTML=e.docHTML:e.docText&&(n.textContent=e.docText),n.parentNode||this.popup.container.appendChild(this.tooltipNode);var i=this.popup,r=i.container.getBoundingClientRect();n.style.top=i.container.style.top,n.style.bottom=i.container.style.bottom,n.style.display="block",window.innerWidth-r.right<320?r.left<320?(i.isTopdown?n.style.top=r.bottom+"px":n.style.top=i.container.offsetTop-n.offsetHeight+"px",n.style.left=r.left+"px",n.style.right="",n.style.bottom=""):(n.style.right=window.innerWidth-r.left+"px",n.style.left=""):(n.style.left=r.right+1+"px",n.style.right="")},e.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),this.tooltipNode){var e=this.tooltipNode;this.editor.isFocused()||document.activeElement!=e||this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}},e.prototype.onTooltipClick=function(e){for(var t=e.target;t&&t!=this.tooltipNode;){if("A"==t.nodeName&&t.href){t.rel="noreferrer",t.target="_blank";break}t=t.parentNode}},e.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var e=this.popup.container;e&&e.parentNode&&e.parentNode.removeChild(e)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",f),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},e}();g.prototype.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var t=e.completer.insertMatch();if(t||e.tabstopManager)return t;e.completer.goTo("down")},Backspace:function(e){e.execCommand("backspace"),!a.getCompletionPrefix(e)&&e.completer&&e.completer.detach()},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},g.for=function(e){return e.completer instanceof g||(e.completer&&(e.completer.destroy(),e.completer=null),d.get("sharedPopups")?(g.$sharedInstance||(g.$sharedInstance=new g),e.completer=g.$sharedInstance):(e.completer=new g,e.once("destroy",f))),e.completer},g.startCommand={name:"startAutocomplete",exec:function(e,t){var n=g.for(e);n.autoInsert=!1,n.autoSelect=!0,n.autoShown=!1,n.showPopup(e,t),n.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var m=function(){function e(e){this.initialPosition=e,this.active=!0}return e.prototype.insertByIndex=function(e,t,n){return!!this.completions&&!!this.completions.filtered&&this.insertMatch(e,this.completions.filtered[t],n)},e.prototype.insertMatch=function(e,t,n){if(!t)return!1;if(e.startOperation({command:{name:"insertMatch"}}),t.completer&&t.completer.insertMatch)t.completer.insertMatch(e,t);else{if(!this.completions)return!1;var i=this.completions.filterText.length,r=0;if(t.range&&t.range.start.row===t.range.end.row&&(i-=this.initialPosition.prefix.length,i+=this.initialPosition.pos.column-t.range.start.column,r+=t.range.end.column-this.initialPosition.pos.column),i||r){o=e.selection.getAllRanges?e.selection.getAllRanges():[e.getSelectionRange()];for(var o,s,a=0;s=o[a];a++)s.start.column-=i,s.end.column+=r,e.session.remove(s)}t.snippet?u.insertSnippet(e,t.snippet):this.$insertString(e,t),t.completer&&t.completer.onInsert&&"function"==typeof t.completer.onInsert&&t.completer.onInsert(e,t),t.command&&"startAutocomplete"===t.command&&e.execCommand(t.command)}return e.endOperation(),!0},e.prototype.$insertString=function(e,t){var n=t.value||t;e.execCommand("insertstring",n)},e.prototype.gatherCompletions=function(e,t){var n=e.getSession(),i=e.getCursorPosition(),r=a.getCompletionPrefix(e),o=[];this.completers=e.completers;var s=e.completers.length;return e.completers.forEach(function(l,c){l.getCompletions(e,n,i,r,function(n,i){l.hideInlinePreview&&(i=i.map(function(e){return Object.assign(e,{hideInlinePreview:l.hideInlinePreview})})),!n&&i&&(o=o.concat(i)),t(null,{prefix:a.getCompletionPrefix(e),matches:o,finished:0==--s})})}),!0},e.prototype.provideCompletions=function(e,t,n){var i=(function(e){var i=e.prefix,r=e.matches;this.completions=new v(r),t.exactMatch&&(this.completions.exactMatch=!0),t.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(i),(e.finished||this.completions.filtered.length)&&n(null,this.completions,e.finished)}).bind(this),r=!0,o=null;if(this.gatherCompletions(e,(function(e,t){if(this.active&&(e&&(n(e,[],!0),this.detach()),0===t.prefix.indexOf(t.prefix))){if(r){o=t;return}i(t)}}).bind(this)),r=!1,o){var s=o;o=null,i(s)}},e.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(e){"function"==typeof e.cancel&&e.cancel()})},e}(),v=function(){function e(e,t){this.all=e,this.filtered=e,this.filterText=t||"",this.exactMatch=!1,this.ignoreCaption=!1}return e.prototype.setFilter=function(e){if(e.length>this.filterText&&0===e.lastIndexOf(this.filterText,0))var t=this.filtered;else var t=this.all;this.filterText=e;var n=null;t=(t=(t=this.filterCompletions(t,this.filterText)).sort(function(e,t){return t.exactMatch-e.exactMatch||t.$score-e.$score||(e.caption||e.value).localeCompare(t.caption||t.value)})).filter(function(e){var t=e.snippet||e.caption||e.value;return t!==n&&(n=t,!0)}),this.filtered=t},e.prototype.filterCompletions=function(e,t){var n=[],i=t.toUpperCase(),r=t.toLowerCase();t:for(var o,s=0;o=e[s];s++){var a,l,c=!this.ignoreCaption&&o.caption||o.value||o.snippet;if(c){var u=-1,d=0,h=0;if(this.exactMatch){if(t!==c.substr(0,t.length))continue}else{var p=c.toLowerCase().indexOf(r);if(p>-1)h=p;else for(var f=0;f<t.length;f++){var g=c.indexOf(r[f],u+1),m=c.indexOf(i[f],u+1);if((a=g>=0&&(m<0||g<m)?g:m)<0)continue t;(l=a-u-1)>0&&(-1===u&&(h+=10),h+=l,d|=1<<f),u=a}}o.matchMask=d,o.exactMatch=+!h,o.$score=(o.score||0)-h,n.push(o)}}return n},e}();t.Autocomplete=g,t.CompletionProvider=m,t.FilteredList=v}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(e,t,n){var i=e("../range").Range,r=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function o(e,t){return e.getTextRange(i.fromPoints({row:0,column:0},t)).split(r).length-1}function s(e,t){var n=o(e,t),i=e.getValue().split(r),s=Object.create(null),a=i[n];return i.forEach(function(e,t){if(e&&e!==a){var r=Math.abs(n-t),o=i.length-r;s[e]?s[e]=Math.max(o,s[e]):s[e]=o}}),s}t.getCompletions=function(e,t,n,i,r){var o=s(t,n);r(null,Object.keys(o).map(function(e){return{caption:e,value:e,score:o[e],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(e,t,n){"use strict";var i,r=e("../snippets").snippetManager,o=e("../autocomplete").Autocomplete,s=e("../config"),a=e("../lib/lang"),l=e("../autocomplete/util"),c=e("../autocomplete/text_completer"),u={getCompletions:function(e,t,n,i,r){if(t.$mode.completer)return t.$mode.completer.getCompletions(e,t,n,i,r);var o=e.session.getState(n.row),s=t.$mode.getCompletions(o,t,n,i);r(null,s=s.map(function(e){return e.completerId=u.id,e}))},id:"keywordCompleter"},d=function(e){var t={};return e.replace(/\${(\d+)(:(.*?))?}/g,function(e,n,i,r){return t[n]=r||""}).replace(/\$(\d+?)/g,function(e,n){return t[n]})},h={getCompletions:function(e,t,n,i,o){var s=[],a=t.getTokenAt(n.row,n.column);a&&a.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?s.push("html-tag"):s=r.getActiveScopes(e);var l=r.snippetMap,c=[];s.forEach(function(e){for(var t=l[e]||[],n=t.length;n--;){var i=t[n],r=i.name||i.tabTrigger;r&&c.push({caption:r,snippet:i.content,meta:i.tabTrigger&&!i.name?i.tabTrigger+"⇥ ":"snippet",completerId:h.id})}},this),o(null,c)},getDocTooltip:function(e){e.snippet&&!e.docHTML&&(e.docHTML=["<b>",a.escapeHTML(e.caption),"</b>","<hr></hr>",a.escapeHTML(d(e.snippet))].join(""))},id:"snippetCompleter"},p=[h,c,u];t.setCompleters=function(e){p.length=0,e&&p.push.apply(p,e)},t.addCompleter=function(e){p.push(e)},t.textCompleter=c,t.keyWordCompleter=u,t.snippetCompleter=h;var f={name:"expandSnippet",exec:function(e){return r.expandWithTab(e)},bindKey:"Tab"},g=function(e,t){m(t.session.$mode)},m=function(e){"string"==typeof e&&(e=s.$modes[e]),e&&(r.files||(r.files={}),v(e.$id,e.snippetFileId),e.modes&&e.modes.forEach(m))},v=function(e,t){t&&e&&!r.files[e]&&(r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){m("ace/mode/"+e)})))}))},b=function(e){var t=e.editor,n=t.completer&&t.completer.activated;if("backspace"===e.command.name)n&&!l.getCompletionPrefix(t)&&t.completer.detach();else if("insertstring"===e.command.name&&!n){i=e;var r=e.editor.$liveAutocompletionDelay;r?y.delay(r):w(e)}},y=a.delayedCall(function(){w(i)},0),w=function(e){var t=e.editor,n=l.getCompletionPrefix(t),i=e.args,r=l.triggerAutocomplete(t,i);if(n&&n.length>=t.$liveAutocompletionThreshold||r){var s=o.for(t);s.autoShown=!0,s.showPopup(t)}},x=e("../editor").Editor;e("../config").defineOptions(x.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:p),this.commands.addCommand(o.startCommand)):this.commands.removeCommand(o.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:p),this.commands.on("afterExec",b)):this.commands.off("afterExec",b)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(e){e?(this.commands.addCommand(f),this.on("changeMode",g),g(null,this)):(this.commands.removeCommand(f),this.off("changeMode",g))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(t){e&&(e.exports=t)})}()},20009(e,t,n){e=n.nmd(e),ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(e,t,n){"use strict";var i,r=e("./lib/oop");e("./lib/lang");var o=e("./lib/event_emitter").EventEmitter,s=e("./editor").Editor,a=e("./virtual_renderer").VirtualRenderer,l=e("./edit_session").EditSession;(function(){r.implement(this,o),this.$createEditor=function(){var e=document.createElement("div");e.className=this.$editorCSS,e.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(e);var t=new s(new a(e,this.$theme));return t.on("focus",(function(){this._emit("focus",t)}).bind(this)),this.$editors.push(t),t.setFontSize(this.$fontSize),t},this.setSplits=function(e){var t;if(e<1)throw"The number of splits have to be > 0!";if(e!=this.$splits){if(e>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<e;)t=this.$editors[this.$splits],this.$container.appendChild(t.container),t.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<e;)this.$createEditor(),this.$splits++}else for(;this.$splits>e;)t=this.$editors[this.$splits-1],this.$container.removeChild(t.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(t){t.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(t){t.setKeyboardHandler(e)})},this.forEach=function(e,t){this.$editors.forEach(e,t)},this.$fontSize="",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(t){t.setFontSize(e)})},this.$cloneSession=function(e){var t=new l(e.getDocument(),e.getMode()),n=e.getUndoManager();return t.setUndoManager(n),t.setTabSize(e.getTabSize()),t.setUseSoftTabs(e.getUseSoftTabs()),t.setOverwrite(e.getOverwrite()),t.setBreakpoints(e.getBreakpoints()),t.setUseWrapMode(e.getUseWrapMode()),t.setUseWorker(e.getUseWorker()),t.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),t.$foldData=e.$cloneFoldData(),t},this.setSession=function(e,t){var n=null==t?this.$cEditor:this.$editors[t];return this.$editors.some(function(t){return t.session===e})&&(e=this.$cloneSession(e)),n.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){this.$orientation!=e&&(this.$orientation=e,this.resize())},this.resize=function(){var e,t=this.$container.clientWidth,n=this.$container.clientHeight;if(this.$orientation==this.BESIDE)for(var i=t/this.$splits,r=0;r<this.$splits;r++)(e=this.$editors[r]).container.style.width=i+"px",e.container.style.top="0px",e.container.style.left=r*i+"px",e.container.style.height=n+"px",e.resize();else for(var o=n/this.$splits,r=0;r<this.$splits;r++)(e=this.$editors[r]).container.style.width=t+"px",e.container.style.top=r*o+"px",e.container.style.left="0px",e.container.style.height=o+"px",e.resize()}}).call((i=function(e,t,n){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=t,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(n||1),this.$cEditor=this.$editors[0],this.on("focus",(function(e){this.$cEditor=e}).bind(this))}).prototype),t.Split=i}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(e,t,n){"use strict";n.exports=e("../split")}),function(){ace.require(["ace/ext/split"],function(t){e&&(e.exports=t)})}()},62432(e,t,n){ace.config.setModuleUrl("ace/ext/beautify",n(1853)),ace.config.setModuleUrl("ace/ext/code_lens",n(42836)),ace.config.setModuleUrl("ace/ext/command_bar",n(59309)),ace.config.setModuleUrl("ace/ext/elastic_tabstops_lite",n(40275)),ace.config.setModuleUrl("ace/ext/emmet",n(25962)),ace.config.setModuleUrl("ace/ext/error_marker",n(377)),ace.config.setModuleUrl("ace/ext/hardwrap",n(63205)),ace.config.setModuleUrl("ace/ext/inline_autocomplete",n(49360)),ace.config.setModuleUrl("ace/ext/keyboard_menu",n(97188)),ace.config.setModuleUrl("ace/ext/language_tools",n(10194)),ace.config.setModuleUrl("ace/ext/linking",n(43794)),ace.config.setModuleUrl("ace/ext/modelist",n(71739)),ace.config.setModuleUrl("ace/ext/options",n(43804)),ace.config.setModuleUrl("ace/ext/prompt",n(20706)),ace.config.setModuleUrl("ace/ext/rtl",n(27480)),ace.config.setModuleUrl("ace/ext/searchbox",n(91179)),ace.config.setModuleUrl("ace/ext/settings_menu",n(24451)),ace.config.setModuleUrl("ace/ext/simple_tokenizer",n(31572)),ace.config.setModuleUrl("ace/ext/spellcheck",n(51834)),ace.config.setModuleUrl("ace/ext/split",n(12042)),ace.config.setModuleUrl("ace/ext/static_highlight",n(99729)),ace.config.setModuleUrl("ace/ext/statusbar",n(86397)),ace.config.setModuleUrl("ace/ext/textarea",n(36454)),ace.config.setModuleUrl("ace/ext/themelist",n(85107)),ace.config.setModuleUrl("ace/ext/whitespace",n(27749)),ace.config.setModuleUrl("ace/keyboard/emacs",n(82656)),ace.config.setModuleUrl("ace/keyboard/sublime",n(1832)),ace.config.setModuleUrl("ace/keyboard/vim",n(76627)),ace.config.setModuleUrl("ace/keyboard/vscode",n(98557)),ace.config.setModuleUrl("ace/mode/abap",n(48208)),ace.config.setModuleUrl("ace/mode/abc",n(22128)),ace.config.setModuleUrl("ace/mode/actionscript",n(3871)),ace.config.setModuleUrl("ace/mode/ada",n(87272)),ace.config.setModuleUrl("ace/mode/alda",n(62524)),ace.config.setModuleUrl("ace/mode/apache_conf",n(70029)),ace.config.setModuleUrl("ace/mode/apex",n(24266)),ace.config.setModuleUrl("ace/mode/applescript",n(78831)),ace.config.setModuleUrl("ace/mode/aql",n(15138)),ace.config.setModuleUrl("ace/mode/asciidoc",n(36417)),ace.config.setModuleUrl("ace/mode/asl",n(34848)),ace.config.setModuleUrl("ace/mode/assembly_arm32",n(96138)),ace.config.setModuleUrl("ace/mode/assembly_x86",n(9319)),ace.config.setModuleUrl("ace/mode/astro",n(37235)),ace.config.setModuleUrl("ace/mode/autohotkey",n(5215)),ace.config.setModuleUrl("ace/mode/batchfile",n(182)),ace.config.setModuleUrl("ace/mode/bibtex",n(54316)),ace.config.setModuleUrl("ace/mode/c9search",n(90622)),ace.config.setModuleUrl("ace/mode/c_cpp",n(69563)),ace.config.setModuleUrl("ace/mode/cirru",n(25995)),ace.config.setModuleUrl("ace/mode/clojure",n(81384)),ace.config.setModuleUrl("ace/mode/cobol",n(12307)),ace.config.setModuleUrl("ace/mode/coffee",n(73098)),ace.config.setModuleUrl("ace/mode/coldfusion",n(82540)),ace.config.setModuleUrl("ace/mode/crystal",n(70162)),ace.config.setModuleUrl("ace/mode/csharp",n(86173)),ace.config.setModuleUrl("ace/mode/csound_document",n(57004)),ace.config.setModuleUrl("ace/mode/csound_orchestra",n(54722)),ace.config.setModuleUrl("ace/mode/csound_score",n(48055)),ace.config.setModuleUrl("ace/mode/csp",n(61634)),ace.config.setModuleUrl("ace/mode/css",n(59119)),ace.config.setModuleUrl("ace/mode/curly",n(95329)),ace.config.setModuleUrl("ace/mode/cuttlefish",n(34379)),ace.config.setModuleUrl("ace/mode/d",n(48656)),ace.config.setModuleUrl("ace/mode/dart",n(1647)),ace.config.setModuleUrl("ace/mode/diff",n(30365)),ace.config.setModuleUrl("ace/mode/django",n(35249)),ace.config.setModuleUrl("ace/mode/dockerfile",n(62136)),ace.config.setModuleUrl("ace/mode/dot",n(40631)),ace.config.setModuleUrl("ace/mode/drools",n(36363)),ace.config.setModuleUrl("ace/mode/edifact",n(19906)),ace.config.setModuleUrl("ace/mode/eiffel",n(61933)),ace.config.setModuleUrl("ace/mode/ejs",n(78924)),ace.config.setModuleUrl("ace/mode/elixir",n(91429)),ace.config.setModuleUrl("ace/mode/elm",n(98664)),ace.config.setModuleUrl("ace/mode/erlang",n(18885)),ace.config.setModuleUrl("ace/mode/flix",n(98513)),ace.config.setModuleUrl("ace/mode/forth",n(50379)),ace.config.setModuleUrl("ace/mode/fortran",n(87166)),ace.config.setModuleUrl("ace/mode/fsharp",n(55288)),ace.config.setModuleUrl("ace/mode/fsl",n(96369)),ace.config.setModuleUrl("ace/mode/ftl",n(5474)),ace.config.setModuleUrl("ace/mode/gcode",n(39264)),ace.config.setModuleUrl("ace/mode/gherkin",n(67942)),ace.config.setModuleUrl("ace/mode/gitignore",n(37898)),ace.config.setModuleUrl("ace/mode/glsl",n(2474)),ace.config.setModuleUrl("ace/mode/gobstones",n(70154)),ace.config.setModuleUrl("ace/mode/golang",n(74616)),ace.config.setModuleUrl("ace/mode/graphqlschema",n(75542)),ace.config.setModuleUrl("ace/mode/groovy",n(50436)),ace.config.setModuleUrl("ace/mode/haml",n(63920)),ace.config.setModuleUrl("ace/mode/handlebars",n(51526)),ace.config.setModuleUrl("ace/mode/haskell",n(46604)),ace.config.setModuleUrl("ace/mode/haskell_cabal",n(67784)),ace.config.setModuleUrl("ace/mode/haxe",n(81690)),ace.config.setModuleUrl("ace/mode/hjson",n(44406)),ace.config.setModuleUrl("ace/mode/html",n(14719)),ace.config.setModuleUrl("ace/mode/html_elixir",n(36149)),ace.config.setModuleUrl("ace/mode/html_ruby",n(76542)),ace.config.setModuleUrl("ace/mode/ini",n(88110)),ace.config.setModuleUrl("ace/mode/io",n(91930)),ace.config.setModuleUrl("ace/mode/ion",n(24958)),ace.config.setModuleUrl("ace/mode/jack",n(42901)),ace.config.setModuleUrl("ace/mode/jade",n(55300)),ace.config.setModuleUrl("ace/mode/java",n(29750)),ace.config.setModuleUrl("ace/mode/javascript",n(80437)),ace.config.setModuleUrl("ace/mode/jexl",n(62115)),ace.config.setModuleUrl("ace/mode/json",n(46544)),ace.config.setModuleUrl("ace/mode/json5",n(62727)),ace.config.setModuleUrl("ace/mode/jsoniq",n(78118)),ace.config.setModuleUrl("ace/mode/jsp",n(41705)),ace.config.setModuleUrl("ace/mode/jssm",n(22901)),ace.config.setModuleUrl("ace/mode/jsx",n(73937)),ace.config.setModuleUrl("ace/mode/julia",n(941)),ace.config.setModuleUrl("ace/mode/kotlin",n(86571)),ace.config.setModuleUrl("ace/mode/latex",n(30808)),ace.config.setModuleUrl("ace/mode/latte",n(2986)),ace.config.setModuleUrl("ace/mode/less",n(72799)),ace.config.setModuleUrl("ace/mode/liquid",n(95630)),ace.config.setModuleUrl("ace/mode/lisp",n(85950)),ace.config.setModuleUrl("ace/mode/livescript",n(74703)),ace.config.setModuleUrl("ace/mode/logiql",n(72094)),ace.config.setModuleUrl("ace/mode/logtalk",n(39512)),ace.config.setModuleUrl("ace/mode/lsl",n(94275)),ace.config.setModuleUrl("ace/mode/lua",n(46890)),ace.config.setModuleUrl("ace/mode/luapage",n(81029)),ace.config.setModuleUrl("ace/mode/lucene",n(7616)),ace.config.setModuleUrl("ace/mode/makefile",n(77882)),ace.config.setModuleUrl("ace/mode/markdown",n(21459)),ace.config.setModuleUrl("ace/mode/mask",n(54050)),ace.config.setModuleUrl("ace/mode/matlab",n(35907)),ace.config.setModuleUrl("ace/mode/maze",n(95709)),ace.config.setModuleUrl("ace/mode/mediawiki",n(72268)),ace.config.setModuleUrl("ace/mode/mel",n(66018)),ace.config.setModuleUrl("ace/mode/mips",n(20617)),ace.config.setModuleUrl("ace/mode/mixal",n(98667)),ace.config.setModuleUrl("ace/mode/mushcode",n(61026)),ace.config.setModuleUrl("ace/mode/mysql",n(21630)),ace.config.setModuleUrl("ace/mode/nasal",n(23523)),ace.config.setModuleUrl("ace/mode/nginx",n(16788)),ace.config.setModuleUrl("ace/mode/nim",n(31900)),ace.config.setModuleUrl("ace/mode/nix",n(6135)),ace.config.setModuleUrl("ace/mode/nsis",n(31117)),ace.config.setModuleUrl("ace/mode/nunjucks",n(51481)),ace.config.setModuleUrl("ace/mode/objectivec",n(75466)),ace.config.setModuleUrl("ace/mode/ocaml",n(49088)),ace.config.setModuleUrl("ace/mode/odin",n(5610)),ace.config.setModuleUrl("ace/mode/partiql",n(76557)),ace.config.setModuleUrl("ace/mode/pascal",n(80694)),ace.config.setModuleUrl("ace/mode/perl",n(7135)),ace.config.setModuleUrl("ace/mode/pgsql",n(55707)),ace.config.setModuleUrl("ace/mode/php",n(57164)),ace.config.setModuleUrl("ace/mode/php_laravel_blade",n(49935)),ace.config.setModuleUrl("ace/mode/pig",n(7124)),ace.config.setModuleUrl("ace/mode/plain_text",n(92868)),ace.config.setModuleUrl("ace/mode/plsql",n(24808)),ace.config.setModuleUrl("ace/mode/powershell",n(77823)),ace.config.setModuleUrl("ace/mode/praat",n(46124)),ace.config.setModuleUrl("ace/mode/prisma",n(18114)),ace.config.setModuleUrl("ace/mode/prolog",n(35061)),ace.config.setModuleUrl("ace/mode/properties",n(56059)),ace.config.setModuleUrl("ace/mode/protobuf",n(86305)),ace.config.setModuleUrl("ace/mode/prql",n(58317)),ace.config.setModuleUrl("ace/mode/puppet",n(85804)),ace.config.setModuleUrl("ace/mode/python",n(51652)),ace.config.setModuleUrl("ace/mode/qml",n(11038)),ace.config.setModuleUrl("ace/mode/r",n(438)),ace.config.setModuleUrl("ace/mode/raku",n(4847)),ace.config.setModuleUrl("ace/mode/razor",n(67300)),ace.config.setModuleUrl("ace/mode/rdoc",n(6430)),ace.config.setModuleUrl("ace/mode/red",n(85347)),ace.config.setModuleUrl("ace/mode/redshift",n(36975)),ace.config.setModuleUrl("ace/mode/rhtml",n(7047)),ace.config.setModuleUrl("ace/mode/robot",n(66276)),ace.config.setModuleUrl("ace/mode/rst",n(8781)),ace.config.setModuleUrl("ace/mode/ruby",n(334)),ace.config.setModuleUrl("ace/mode/rust",n(43292)),ace.config.setModuleUrl("ace/mode/sac",n(26329)),ace.config.setModuleUrl("ace/mode/sass",n(52748)),ace.config.setModuleUrl("ace/mode/scad",n(46193)),ace.config.setModuleUrl("ace/mode/scala",n(19366)),ace.config.setModuleUrl("ace/mode/scheme",n(81413)),ace.config.setModuleUrl("ace/mode/scrypt",n(70877)),ace.config.setModuleUrl("ace/mode/scss",n(55146)),ace.config.setModuleUrl("ace/mode/sh",n(77105)),ace.config.setModuleUrl("ace/mode/sjs",n(16042)),ace.config.setModuleUrl("ace/mode/slim",n(58715)),ace.config.setModuleUrl("ace/mode/smarty",n(48146)),ace.config.setModuleUrl("ace/mode/smithy",n(75144)),ace.config.setModuleUrl("ace/mode/snippets",n(33124)),ace.config.setModuleUrl("ace/mode/soy_template",n(23446)),ace.config.setModuleUrl("ace/mode/space",n(29582)),ace.config.setModuleUrl("ace/mode/sparql",n(4911)),ace.config.setModuleUrl("ace/mode/sql",n(44644)),ace.config.setModuleUrl("ace/mode/sqlserver",n(19771)),ace.config.setModuleUrl("ace/mode/stylus",n(60940)),ace.config.setModuleUrl("ace/mode/svg",n(68506)),ace.config.setModuleUrl("ace/mode/swift",n(39215)),ace.config.setModuleUrl("ace/mode/tcl",n(54987)),ace.config.setModuleUrl("ace/mode/terraform",n(31372)),ace.config.setModuleUrl("ace/mode/tex",n(63609)),ace.config.setModuleUrl("ace/mode/text",n(12585)),ace.config.setModuleUrl("ace/mode/textile",n(29541)),ace.config.setModuleUrl("ace/mode/toml",n(69774)),ace.config.setModuleUrl("ace/mode/tsx",n(53135)),ace.config.setModuleUrl("ace/mode/turtle",n(12476)),ace.config.setModuleUrl("ace/mode/twig",n(71255)),ace.config.setModuleUrl("ace/mode/typescript",n(5397)),ace.config.setModuleUrl("ace/mode/vala",n(98124)),ace.config.setModuleUrl("ace/mode/vbscript",n(70801)),ace.config.setModuleUrl("ace/mode/velocity",n(33189)),ace.config.setModuleUrl("ace/mode/verilog",n(36982)),ace.config.setModuleUrl("ace/mode/vhdl",n(98256)),ace.config.setModuleUrl("ace/mode/visualforce",n(7335)),ace.config.setModuleUrl("ace/mode/vue",n(2256)),ace.config.setModuleUrl("ace/mode/wollok",n(29446)),ace.config.setModuleUrl("ace/mode/xml",n(93489)),ace.config.setModuleUrl("ace/mode/xquery",n(27174)),ace.config.setModuleUrl("ace/mode/yaml",n(32113)),ace.config.setModuleUrl("ace/mode/zeek",n(38035)),ace.config.setModuleUrl("ace/mode/zig",n(86882)),ace.config.setModuleUrl("ace/theme/ambiance",n(7890)),ace.config.setModuleUrl("ace/theme/chaos",n(40156)),ace.config.setModuleUrl("ace/theme/chrome",n(14240)),ace.config.setModuleUrl("ace/theme/cloud9_day",n(46755)),ace.config.setModuleUrl("ace/theme/cloud9_night",n(66655)),ace.config.setModuleUrl("ace/theme/cloud9_night_low_color",n(58614)),ace.config.setModuleUrl("ace/theme/cloud_editor",n(89481)),ace.config.setModuleUrl("ace/theme/cloud_editor_dark",n(93008)),ace.config.setModuleUrl("ace/theme/clouds",n(48516)),ace.config.setModuleUrl("ace/theme/clouds_midnight",n(54131)),ace.config.setModuleUrl("ace/theme/cobalt",n(98093)),ace.config.setModuleUrl("ace/theme/crimson_editor",n(63553)),ace.config.setModuleUrl("ace/theme/dawn",n(58732)),ace.config.setModuleUrl("ace/theme/dracula",n(14166)),ace.config.setModuleUrl("ace/theme/dreamweaver",n(71791)),ace.config.setModuleUrl("ace/theme/eclipse",n(28409)),ace.config.setModuleUrl("ace/theme/github",n(28573)),ace.config.setModuleUrl("ace/theme/github_dark",n(23852)),ace.config.setModuleUrl("ace/theme/github_light_default",n(50836)),ace.config.setModuleUrl("ace/theme/gob",n(66296)),ace.config.setModuleUrl("ace/theme/gruvbox",n(19791)),ace.config.setModuleUrl("ace/theme/gruvbox_dark_hard",n(39620)),ace.config.setModuleUrl("ace/theme/gruvbox_light_hard",n(51326)),ace.config.setModuleUrl("ace/theme/idle_fingers",n(46925)),ace.config.setModuleUrl("ace/theme/iplastic",n(54699)),ace.config.setModuleUrl("ace/theme/katzenmilch",n(99898)),ace.config.setModuleUrl("ace/theme/kr_theme",n(67773)),ace.config.setModuleUrl("ace/theme/kuroir",n(78990)),ace.config.setModuleUrl("ace/theme/merbivore",n(46283)),ace.config.setModuleUrl("ace/theme/merbivore_soft",n(63466)),ace.config.setModuleUrl("ace/theme/mono_industrial",n(61343)),ace.config.setModuleUrl("ace/theme/monokai",n(7654)),ace.config.setModuleUrl("ace/theme/nord_dark",n(63554)),ace.config.setModuleUrl("ace/theme/one_dark",n(97883)),ace.config.setModuleUrl("ace/theme/pastel_on_dark",n(69346)),ace.config.setModuleUrl("ace/theme/solarized_dark",n(41994)),ace.config.setModuleUrl("ace/theme/solarized_light",n(99200)),ace.config.setModuleUrl("ace/theme/sqlserver",n(14995)),ace.config.setModuleUrl("ace/theme/terminal",n(91493)),ace.config.setModuleUrl("ace/theme/textmate",n(13832)),ace.config.setModuleUrl("ace/theme/tomorrow",n(12961)),ace.config.setModuleUrl("ace/theme/tomorrow_night",n(24968)),ace.config.setModuleUrl("ace/theme/tomorrow_night_blue",n(2063)),ace.config.setModuleUrl("ace/theme/tomorrow_night_bright",n(91199)),ace.config.setModuleUrl("ace/theme/tomorrow_night_eighties",n(59069)),ace.config.setModuleUrl("ace/theme/twilight",n(79034)),ace.config.setModuleUrl("ace/theme/vibrant_ink",n(26689)),ace.config.setModuleUrl("ace/theme/xcode",n(26433)),ace.config.setModuleUrl("ace/mode/base_worker",n(60040)),ace.config.setModuleUrl("ace/mode/coffee_worker",n(74901)),ace.config.setModuleUrl("ace/mode/css_worker",n(88494)),ace.config.setModuleUrl("ace/mode/html_worker",n(79944)),ace.config.setModuleUrl("ace/mode/javascript_worker",n(7182)),ace.config.setModuleUrl("ace/mode/json_worker",n(11727)),ace.config.setModuleUrl("ace/mode/lua_worker",n(55639)),ace.config.setModuleUrl("ace/mode/php_worker",n(64021)),ace.config.setModuleUrl("ace/mode/xml_worker",n(76504)),ace.config.setModuleUrl("ace/mode/xquery_worker",n(98529)),ace.config.setModuleUrl("ace/mode/yaml_worker",n(67782)),ace.config.setModuleUrl("ace/snippets/abap",n(57909)),ace.config.setModuleUrl("ace/snippets/abc",n(49159)),ace.config.setModuleUrl("ace/snippets/actionscript",n(63178)),ace.config.setModuleUrl("ace/snippets/ada",n(70563)),ace.config.setModuleUrl("ace/snippets/alda",n(7353)),ace.config.setModuleUrl("ace/snippets/apache_conf",n(53290)),ace.config.setModuleUrl("ace/snippets/apex",n(64691)),ace.config.setModuleUrl("ace/snippets/applescript",n(86568)),ace.config.setModuleUrl("ace/snippets/aql",n(32377)),ace.config.setModuleUrl("ace/snippets/asciidoc",n(64428)),ace.config.setModuleUrl("ace/snippets/asl",n(61451)),ace.config.setModuleUrl("ace/snippets/assembly_arm32",n(40955)),ace.config.setModuleUrl("ace/snippets/assembly_x86",n(54726)),ace.config.setModuleUrl("ace/snippets/astro",n(42916)),ace.config.setModuleUrl("ace/snippets/autohotkey",n(16462)),ace.config.setModuleUrl("ace/snippets/batchfile",n(84129)),ace.config.setModuleUrl("ace/snippets/bibtex",n(34929)),ace.config.setModuleUrl("ace/snippets/c9search",n(71099)),ace.config.setModuleUrl("ace/snippets/c_cpp",n(51824)),ace.config.setModuleUrl("ace/snippets/cirru",n(90368)),ace.config.setModuleUrl("ace/snippets/clojure",n(70819)),ace.config.setModuleUrl("ace/snippets/cobol",n(10232)),ace.config.setModuleUrl("ace/snippets/coffee",n(92203)),ace.config.setModuleUrl("ace/snippets/coldfusion",n(71241)),ace.config.setModuleUrl("ace/snippets/crystal",n(94925)),ace.config.setModuleUrl("ace/snippets/csharp",n(29432)),ace.config.setModuleUrl("ace/snippets/csound_document",n(85259)),ace.config.setModuleUrl("ace/snippets/csound_orchestra",n(79951)),ace.config.setModuleUrl("ace/snippets/csound_score",n(46326)),ace.config.setModuleUrl("ace/snippets/csp",n(3029)),ace.config.setModuleUrl("ace/snippets/css",n(21452)),ace.config.setModuleUrl("ace/snippets/curly",n(52762)),ace.config.setModuleUrl("ace/snippets/cuttlefish",n(46790)),ace.config.setModuleUrl("ace/snippets/d",n(32803)),ace.config.setModuleUrl("ace/snippets/dart",n(48138)),ace.config.setModuleUrl("ace/snippets/diff",n(54060)),ace.config.setModuleUrl("ace/snippets/django",n(3968)),ace.config.setModuleUrl("ace/snippets/dockerfile",n(58661)),ace.config.setModuleUrl("ace/snippets/dot",n(38180)),ace.config.setModuleUrl("ace/snippets/drools",n(53542)),ace.config.setModuleUrl("ace/snippets/edifact",n(58089)),ace.config.setModuleUrl("ace/snippets/eiffel",n(71020)),ace.config.setModuleUrl("ace/snippets/ejs",n(78027)),ace.config.setModuleUrl("ace/snippets/elixir",n(81672)),ace.config.setModuleUrl("ace/snippets/elm",n(20259)),ace.config.setModuleUrl("ace/snippets/erlang",n(80564)),ace.config.setModuleUrl("ace/snippets/flix",n(38984)),ace.config.setModuleUrl("ace/snippets/forth",n(50528)),ace.config.setModuleUrl("ace/snippets/fortran",n(11661)),ace.config.setModuleUrl("ace/snippets/fsharp",n(60317)),ace.config.setModuleUrl("ace/snippets/fsl",n(60470)),ace.config.setModuleUrl("ace/snippets/ftl",n(64093)),ace.config.setModuleUrl("ace/snippets/gcode",n(55011)),ace.config.setModuleUrl("ace/snippets/gherkin",n(69417)),ace.config.setModuleUrl("ace/snippets/gitignore",n(51069)),ace.config.setModuleUrl("ace/snippets/glsl",n(81160)),ace.config.setModuleUrl("ace/snippets/gobstones",n(19433)),ace.config.setModuleUrl("ace/snippets/golang",n(2205)),ace.config.setModuleUrl("ace/snippets/graphqlschema",n(90933)),ace.config.setModuleUrl("ace/snippets/groovy",n(28101)),ace.config.setModuleUrl("ace/snippets/haml",n(17325)),ace.config.setModuleUrl("ace/snippets/handlebars",n(63083)),ace.config.setModuleUrl("ace/snippets/haskell",n(58915)),ace.config.setModuleUrl("ace/snippets/haskell_cabal",n(11831)),ace.config.setModuleUrl("ace/snippets/haxe",n(71443)),ace.config.setModuleUrl("ace/snippets/hjson",n(70389)),ace.config.setModuleUrl("ace/snippets/html",n(89406)),ace.config.setModuleUrl("ace/snippets/html_elixir",n(15798)),ace.config.setModuleUrl("ace/snippets/html_ruby",n(42201)),ace.config.setModuleUrl("ace/snippets/ini",n(36453)),ace.config.setModuleUrl("ace/snippets/io",n(93307)),ace.config.setModuleUrl("ace/snippets/ion",n(4345)),ace.config.setModuleUrl("ace/snippets/jack",n(37832)),ace.config.setModuleUrl("ace/snippets/jade",n(17469)),ace.config.setModuleUrl("ace/snippets/java",n(44967)),ace.config.setModuleUrl("ace/snippets/javascript",n(64472)),ace.config.setModuleUrl("ace/snippets/jexl",n(63542)),ace.config.setModuleUrl("ace/snippets/json",n(50165)),ace.config.setModuleUrl("ace/snippets/json5",n(14102)),ace.config.setModuleUrl("ace/snippets/jsoniq",n(60927)),ace.config.setModuleUrl("ace/snippets/jsp",n(36142)),ace.config.setModuleUrl("ace/snippets/jssm",n(44592)),ace.config.setModuleUrl("ace/snippets/jsx",n(33158)),ace.config.setModuleUrl("ace/snippets/julia",n(88706)),ace.config.setModuleUrl("ace/snippets/kotlin",n(94158)),ace.config.setModuleUrl("ace/snippets/latex",n(1075)),ace.config.setModuleUrl("ace/snippets/latte",n(46769)),ace.config.setModuleUrl("ace/snippets/less",n(52466)),ace.config.setModuleUrl("ace/snippets/liquid",n(27191)),ace.config.setModuleUrl("ace/snippets/lisp",n(63635)),ace.config.setModuleUrl("ace/snippets/livescript",n(41122)),ace.config.setModuleUrl("ace/snippets/logiql",n(62491)),ace.config.setModuleUrl("ace/snippets/logtalk",n(27299)),ace.config.setModuleUrl("ace/snippets/lsl",n(38552)),ace.config.setModuleUrl("ace/snippets/lua",n(67401)),ace.config.setModuleUrl("ace/snippets/luapage",n(57030)),ace.config.setModuleUrl("ace/snippets/lucene",n(95437)),ace.config.setModuleUrl("ace/snippets/makefile",n(63275)),ace.config.setModuleUrl("ace/snippets/markdown",n(81586)),ace.config.setModuleUrl("ace/snippets/mask",n(49087)),ace.config.setModuleUrl("ace/snippets/matlab",n(65946)),ace.config.setModuleUrl("ace/snippets/maze",n(3844)),ace.config.setModuleUrl("ace/snippets/mediawiki",n(29999)),ace.config.setModuleUrl("ace/snippets/mel",n(17417)),ace.config.setModuleUrl("ace/snippets/mips",n(74332)),ace.config.setModuleUrl("ace/snippets/mixal",n(21352)),ace.config.setModuleUrl("ace/snippets/mushcode",n(31539)),ace.config.setModuleUrl("ace/snippets/mysql",n(59577)),ace.config.setModuleUrl("ace/snippets/nasal",n(49224)),ace.config.setModuleUrl("ace/snippets/nginx",n(82227)),ace.config.setModuleUrl("ace/snippets/nim",n(93243)),ace.config.setModuleUrl("ace/snippets/nix",n(72152)),ace.config.setModuleUrl("ace/snippets/nsis",n(93348)),ace.config.setModuleUrl("ace/snippets/nunjucks",n(81136)),ace.config.setModuleUrl("ace/snippets/objectivec",n(59671)),ace.config.setModuleUrl("ace/snippets/ocaml",n(96183)),ace.config.setModuleUrl("ace/snippets/odin",n(91983)),ace.config.setModuleUrl("ace/snippets/partiql",n(78106)),ace.config.setModuleUrl("ace/snippets/pascal",n(79323)),ace.config.setModuleUrl("ace/snippets/perl",n(72506)),ace.config.setModuleUrl("ace/snippets/pgsql",n(98692)),ace.config.setModuleUrl("ace/snippets/php",n(10031)),ace.config.setModuleUrl("ace/snippets/php_laravel_blade",n(43416)),ace.config.setModuleUrl("ace/snippets/pig",n(32523)),ace.config.setModuleUrl("ace/snippets/plain_text",n(91365)),ace.config.setModuleUrl("ace/snippets/plsql",n(18423)),ace.config.setModuleUrl("ace/snippets/powershell",n(41273)),ace.config.setModuleUrl("ace/snippets/praat",n(8711)),ace.config.setModuleUrl("ace/snippets/prisma",n(87915)),ace.config.setModuleUrl("ace/snippets/prolog",n(58432)),ace.config.setModuleUrl("ace/snippets/properties",n(92198)),ace.config.setModuleUrl("ace/snippets/protobuf",n(93932)),ace.config.setModuleUrl("ace/snippets/prql",n(79240)),ace.config.setModuleUrl("ace/snippets/puppet",n(35129)),ace.config.setModuleUrl("ace/snippets/python",n(54309)),ace.config.setModuleUrl("ace/snippets/qml",n(31005)),ace.config.setModuleUrl("ace/snippets/r",n(55961)),ace.config.setModuleUrl("ace/snippets/raku",n(42950)),ace.config.setModuleUrl("ace/snippets/razor",n(44755)),ace.config.setModuleUrl("ace/snippets/rdoc",n(62535)),ace.config.setModuleUrl("ace/snippets/red",n(13500)),ace.config.setModuleUrl("ace/snippets/redshift",n(94862)),ace.config.setModuleUrl("ace/snippets/rhtml",n(84064)),ace.config.setModuleUrl("ace/snippets/robot",n(61111)),ace.config.setModuleUrl("ace/snippets/rst",n(43530)),ace.config.setModuleUrl("ace/snippets/ruby",n(12767)),ace.config.setModuleUrl("ace/snippets/rust",n(36729)),ace.config.setModuleUrl("ace/snippets/sac",n(37506)),ace.config.setModuleUrl("ace/snippets/sass",n(82737)),ace.config.setModuleUrl("ace/snippets/scad",n(35400)),ace.config.setModuleUrl("ace/snippets/scala",n(92945)),ace.config.setModuleUrl("ace/snippets/scheme",n(68140)),ace.config.setModuleUrl("ace/snippets/scrypt",n(64128)),ace.config.setModuleUrl("ace/snippets/scss",n(48387)),ace.config.setModuleUrl("ace/snippets/sh",n(13176)),ace.config.setModuleUrl("ace/snippets/sjs",n(68801)),ace.config.setModuleUrl("ace/snippets/slim",n(93390)),ace.config.setModuleUrl("ace/snippets/smarty",n(67831)),ace.config.setModuleUrl("ace/snippets/smithy",n(34577)),ace.config.setModuleUrl("ace/snippets/snippets",n(7357)),ace.config.setModuleUrl("ace/snippets/soy_template",n(93779)),ace.config.setModuleUrl("ace/snippets/space",n(50673)),ace.config.setModuleUrl("ace/snippets/sparql",n(38842)),ace.config.setModuleUrl("ace/snippets/sql",n(45779)),ace.config.setModuleUrl("ace/snippets/sqlserver",n(56420)),ace.config.setModuleUrl("ace/snippets/stylus",n(3309)),ace.config.setModuleUrl("ace/snippets/svg",n(82161)),ace.config.setModuleUrl("ace/snippets/swift",n(41200)),ace.config.setModuleUrl("ace/snippets/tcl",n(32384)),ace.config.setModuleUrl("ace/snippets/terraform",n(75607)),ace.config.setModuleUrl("ace/snippets/tex",n(6874)),ace.config.setModuleUrl("ace/snippets/text",n(54012)),ace.config.setModuleUrl("ace/snippets/textile",n(93878)),ace.config.setModuleUrl("ace/snippets/toml",n(49599)),ace.config.setModuleUrl("ace/snippets/tsx",n(22028)),ace.config.setModuleUrl("ace/snippets/turtle",n(86333)),ace.config.setModuleUrl("ace/snippets/twig",n(11078)),ace.config.setModuleUrl("ace/snippets/typescript",n(40344)),ace.config.setModuleUrl("ace/snippets/vala",n(52397)),ace.config.setModuleUrl("ace/snippets/vbscript",n(5368)),ace.config.setModuleUrl("ace/snippets/velocity",n(4896)),ace.config.setModuleUrl("ace/snippets/verilog",n(28177)),ace.config.setModuleUrl("ace/snippets/vhdl",n(37321)),ace.config.setModuleUrl("ace/snippets/visualforce",n(82036)),ace.config.setModuleUrl("ace/snippets/vue",n(36751)),ace.config.setModuleUrl("ace/snippets/wollok",n(12463)),ace.config.setModuleUrl("ace/snippets/xml",n(65690)),ace.config.setModuleUrl("ace/snippets/xquery",n(84835)),ace.config.setModuleUrl("ace/snippets/yaml",n(46716)),ace.config.setModuleUrl("ace/snippets/zeek",n(51174)),ace.config.setModuleUrl("ace/snippets/zig",n(64865))},63282(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let i=n(4042),r=n(86144),o=n(36653),s=n(72079),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends i.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=n(62586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=n(99029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var h=n(13558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var p=n(34551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})},41520(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class i extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=i;class r extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof i&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){let n=[e[0]],i=0;for(;i<t.length;)l(n,t[i]),n.push(e[++i]);return new r(n)}t._Code=r,t.nil=new r(""),t._=o;let s=new r("+");function a(e,...t){let n=[h(e[0])],i=0;for(;i<t.length;)n.push(s),l(n,t[i]),n.push(s,h(e[++i]));return c(n),new r(n)}function l(e,t){t instanceof r?e.push(...t._items):t instanceof i?e.push(t):e.push(d(t))}function c(e){let t=1;for(;t<e.length-1;){if(e[t]===s){let n=u(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function u(e,t){return'""'===t?e:'""'===e?t:"string"==typeof e?t instanceof i||'"'!==e[e.length-1]?void 0:"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0:"string"!=typeof t||'"'!==t[0]||e instanceof i?void 0:`"${e}${t.slice(1)}`}function d(e){return"number"==typeof e||"boolean"==typeof e||null===e?e:h(Array.isArray(e)?e.join(","):e)}function h(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function p(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):o`[${e}]`}function f(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(h(e))},t.safeStringify=h,t.getProperty=p,t.getEsmExportName=f,t.regexpCode=function(e){return new r(e.toString())}},99029(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let i=n(41520),r=n(57845);var o=n(41520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return o.Name}});var s=n(57845);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?r.varKinds.var:this.varKind,i=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,e,t)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof i.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=O(this.rhs,e,t),this}get names(){return L(this.lhs instanceof i.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,i){super(e,n,i),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class f extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=O(this.code,e,t),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class g extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,i=n.length;for(;i--;){let r=n[i];r.optimizeNames(e,t)||(R(e,r.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>T(e,t.names),{})}}class m extends g{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class v extends g{}class b extends m{}b.kind="else";class y extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(D(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null==(n=this.else)?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=O(this.condition,e,t),this}get names(){let e=super.names;return L(e,this.condition),this.else&&T(e,this.else.names),e}}y.kind="if";class w extends m{}w.kind="for";class x extends w{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=O(this.iteration,e,t),this}get names(){return T(super.names,this.iteration.names)}}class $ extends w{constructor(e,t,n,i){super(),this.varKind=e,this.name=t,this.from=n,this.to=i}render(e){let t=e.es5?r.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${t} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=L(super.names,this.from);return L(e,this.to)}}class _ extends w{constructor(e,t,n,i){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=O(this.iterable,e,t),this}get names(){return T(super.names,this.iterable.names)}}class S extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class M extends g{render(e){return"return "+super.render(e)}}M.kind="return";class C extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var n,i;return super.optimizeNames(e,t),null==(n=this.catch)||n.optimizeNames(e,t),null==(i=this.finally)||i.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&T(e,this.catch.names),this.finally&&T(e,this.finally.names),e}}class E extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class k extends m{render(e){return"finally"+super.render(e)}}k.kind="finally";class A{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,i){let r=this._scope.toName(t);return void 0!==n&&i&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==i.nil&&this._leafNode(new f(e)),this}object(...e){let t=["{"];for(let[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,i.addCodeArg)(t,r));return t.push("}"),new i._Code(t)}if(e,t,n){if(this._blockNode(new y(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(y,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new x(e),t)}forRange(e,t,n,i,o=this.opts.es5?r.varKinds.var:r.varKinds.let){let s=this._scope.toName(e);return this._for(new $(o,s,t,n),()=>i(s))}forOf(e,t,n,o=r.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let e=t instanceof i.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,i._)`${e}.length`,t=>{this.var(s,(0,i._)`${e}[${t}]`),n(s)})}return this._for(new _("of",o,s,t),()=>n(s))}forIn(e,t,n,o=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,i._)`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new _("in",o,s,t),()=>n(s))}endFor(){return this._endBlockNode(w)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new h(e))}return(e){let t=new M;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(M)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new C;if(this._blockNode(i),this.code(e),t){let e=this.name("e");this._currNode=i.catch=new E(e),t(e)}return n&&(this._currNode=i.finally=new k,this.code(n)),this._endBlockNode(E,k)}throw(e){return this._leafNode(new p(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=i.nil,n,r){return this._blockNode(new S(e,t,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}function T(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function L(e,t){return t instanceof i._CodeOrName?T(e,t.names):e}function O(e,t,n){if(e instanceof i.Name)return r(e);if(!o(e))return e;return new i._Code(e._items.reduce((e,t)=>(t instanceof i.Name&&(t=r(t)),t instanceof i._Code?e.push(...t._items):e.push(t),e),[]));function r(e){let i=n[e.str];return void 0===i||1!==t[e.str]?e:(delete t[e.str],i)}function o(e){return e instanceof i._Code&&e._items.some(e=>e instanceof i.Name&&1===t[e.str]&&void 0!==n[e.str])}}function R(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function D(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,i._)`!${P(e)}`}t.CodeGen=A,t.not=D;let I=N(t.operators.AND);t.and=function(...e){return e.reduce(I)};let j=N(t.operators.OR);function N(e){return(t,n)=>t===i.nil?n:n===i.nil?t:(0,i._)`${P(t)} ${e} ${P(n)}`}function P(e){return e instanceof i.Name?e:(0,i._)`(${e})`}t.or=function(...e){return e.reduce(j)}},57845(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let r=n(41520);class o extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(i||(t.UsedValueState=i={})),t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof r.Name?e:this.name(e)}name(e){return new r.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if((null==(n=null==(t=this._parent)?void 0:t._prefixes)?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=s;class a extends r.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=(0,r._)`.${new r.Name(t)}[${n}]`}}t.ValueScopeName=a;let l=(0,r._)`\n`;class c extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:r.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:r}=i,o=null!=(n=t.key)?n:t.ref,s=this._values[r];if(s){let e=s.get(o);if(e)return e}else s=this._values[r]=new Map;s.set(o,i);let a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,i.setValue(t,{property:r,itemIndex:l}),i}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,r._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(e,n,s={},a){let l=r.nil;for(let c in e){let u=e[c];if(!u)continue;let d=s[c]=s[c]||new Map;u.forEach(e=>{if(d.has(e))return;d.set(e,i.Started);let s=n(e);if(s){let n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,r._)`${l}${n} ${e} = ${s};${this.opts._n}`}else if(s=null==a?void 0:a(e))l=(0,r._)`${l}${s}${this.opts._n}`;else throw new o(e);d.set(e,i.Completed)})}return l}}t.ValueScope=c},48708(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let i=n(99029),r=n(94227),o=n(42023);function s(e,n=t.keywordError,r,o){let{it:a}=e,{gen:u,compositeRule:h,allErrors:p}=a,f=d(e,n,r);(null!=o?o:h||p)?l(u,f):c(a,(0,i._)`[${f}]`)}function a(e,n=t.keywordError,i){let{it:r}=e,{gen:s,compositeRule:u,allErrors:h}=r;l(s,d(e,n,i)),u||h||c(r,o.default.vErrors)}function l(e,t){let n=e.const("err",t);e.if((0,i._)`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,(0,i._)`[${n}]`),(0,i._)`${o.default.vErrors}.push(${n})`),e.code((0,i._)`${o.default.errors}++`)}function c(e,t){let{gen:n,validateName:r,schemaEnv:o}=e;o.$async?n.throw((0,i._)`new ${e.ValidationError}(${t})`):(n.assign((0,i._)`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>(0,i.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,i.str)`"${e}" keyword must be ${t} ($data)`:(0,i.str)`"${e}" keyword is invalid ($data)`},t.reportError=s,t.reportExtraError=a,t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if((0,i._)`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,i._)`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:a}){if(void 0===s)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(l,(0,i._)`${o.default.vErrors}[${s}]`),e.if((0,i._)`${l}.instancePath === undefined`,()=>e.assign((0,i._)`${l}.instancePath`,(0,i.strConcat)(o.default.instancePath,a.errorPath))),e.assign((0,i._)`${l}.schemaPath`,(0,i.str)`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign((0,i._)`${l}.schema`,n),e.assign((0,i._)`${l}.data`,r))})};let u={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function d(e,t,n){let{createErrors:r}=e.it;return!1===r?(0,i._)`{}`:h(e,t,n)}function h(e,t,n={}){let{gen:i,it:r}=e,o=[p(r,n),f(e,n)];return g(e,t,o),i.object(...o)}function p({errorPath:e},{instancePath:t}){let n=t?(0,i.str)`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[o.default.instancePath,(0,i.strConcat)(o.default.instancePath,n)]}function f({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:o}){let s=o?t:(0,i.str)`${t}/${e}`;return n&&(s=(0,i.str)`${s}${(0,r.getErrorPath)(n,r.Type.Str)}`),[u.schemaPath,s]}function g(e,{params:t,message:n},r){let{keyword:s,data:a,schemaValue:l,it:c}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:f}=c;r.push([u.keyword,s],[u.params,"function"==typeof t?t(e):t||(0,i._)`{}`]),d.messages&&r.push([u.message,"function"==typeof n?n(e):n]),d.verbose&&r.push([u.schema,l],[u.parentSchema,(0,i._)`${p}${f}`],[o.default.data,a]),h&&r.push([u.propertyName,h])}},73835(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let i=n(99029),r=n(13558),o=n(42023),s=n(66939),a=n(94227),l=n(62586);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,s.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){let t,n,a=h.call(this,e);if(a)return a;let c=(0,s.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:u,lines:d}=this.opts.code,{ownProperties:p}=this.opts,f=new i.CodeGen(this.scope,{es5:u,lines:d,ownProperties:p});e.$async&&(t=f.scopeValue("Error",{ref:r.default,code:(0,i._)`require("ajv/dist/runtime/validation_error").default`}));let g=f.scopeName("validate");e.validateName=g;let m={gen:f,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,i.stringify)(e.schema)}:{ref:e.schema}),validateName:g,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:c,baseId:e.baseId||c,schemaPath:i.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,i._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(m),f.optimize(this.opts.code.optimize);let t=f.toString();n=`${f.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(n=this.opts.code.process(n,e));let r=Function(`${o.default.self}`,`${o.default.scope}`,n)(this,this.scope.get());if(this.scope.value(g,{ref:r}),r.errors=null,r.schema=e.schema,r.schemaEnv=e,e.$async&&(r.$async=!0),!0===this.opts.code.source&&(r.source={validateName:g,validateCode:t,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:t}=m;r.evaluated={props:e instanceof i.Name?void 0:e,items:t instanceof i.Name?void 0:t,dynamicProps:e instanceof i.Name,dynamicItems:t instanceof i.Name},r.source&&(r.source.evaluated=(0,i.stringify)(r.evaluated))}return e.validate=r,e}catch(t){throw delete e.validate,delete e.validateName,n&&this.logger.error("Error compiling schema, function code:",n),t}finally{this._compilations.delete(e)}}function d(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function h(e){for(let t of this._compilations)if(p(t,e))return t}function p(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function f(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||g.call(this,e,t)}function g(e,t){let n=this.opts.uriResolver.parse(t),i=(0,s._getFullPath)(this.opts.uriResolver,n),r=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===r)return v.call(this,n,e);let o=(0,s.normalizeId)(i),a=this.refs[o]||this.schemas[o];if("string"==typeof a){let t=g.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return v.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),o===(0,s.normalizeId)(t)){let{schema:t}=a,{schemaId:n}=this.opts,i=t[n];return i&&(r=(0,s.resolveUrl)(this.opts.uriResolver,r,i)),new c({schema:t,schemaId:n,root:e,baseId:r})}return v.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var i;n=(0,s.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let o=f.call(this,e,n);if(void 0===o){let r=null==(i=e.localRefs)?void 0:i[n],{schemaId:s}=this.opts;r&&(o=new c({schema:r,schemaId:s,root:e,baseId:t}))}if(void 0!==o)return e.refs[n]=d.call(this,o)},t.getCompilingSchema=h,t.resolveSchema=g;let m=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(e,{baseId:t,schema:n,root:i}){var r;let o;if((null==(r=e.fragment)?void 0:r[0])!=="/")return;for(let i of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;let e=n[(0,a.unescapeFragment)(i)];if(void 0===e)return;let r="object"==typeof(n=e)&&n[this.opts.schemaId];!m.has(i)&&r&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,r))}if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,s.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=g.call(this,i,e)}let{schemaId:l}=this.opts;if((o=o||new c({schema:n,schemaId:l,root:i,baseId:t})).schema!==o.root.schema)return o}},42023(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(99029);t.default={data:new i.Name("data"),valCxt:new i.Name("valCxt"),instancePath:new i.Name("instancePath"),parentData:new i.Name("parentData"),parentDataProperty:new i.Name("parentDataProperty"),rootData:new i.Name("rootData"),dynamicAnchors:new i.Name("dynamicAnchors"),vErrors:new i.Name("vErrors"),errors:new i.Name("errors"),this:new i.Name("this"),self:new i.Name("self"),scope:new i.Name("scope"),json:new i.Name("json"),jsonPos:new i.Name("jsonPos"),jsonLen:new i.Name("jsonLen"),jsonPart:new i.Name("jsonPart")}},34551(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(66939);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,i.resolveUrl)(e,t,n),this.missingSchema=(0,i.normalizeId)((0,i.getFullPath)(e,this.missingRef))}}t.default=r},66939(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let i=n(94227),r=n(32017),o=n(7106),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!l(e):!!t&&c(e)<=t)};let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(let t in e){if(a.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(l)||"object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(let n in e)if("$ref"===n||(t++,!s.has(n)&&("object"==typeof e[n]&&(0,i.eachItem)(e[n],e=>t+=c(e)),t===1/0)))return 1/0;return t}function u(e,t="",n){!1!==n&&(t=p(t));let i=e.parse(t);return d(e,i)}function d(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;let h=/#\/?$/;function p(e){return e?e.replace(h,""):""}t.normalizeId=p,t.resolveUrl=function(e,t,n){return n=p(n),e.resolve(t,n)};let f=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:n,uriResolver:i}=this.opts,s=p(e[n]||t),a={"":s},l=u(i,s,!1),c={},d=new Set;return o(e,{allKeys:!0},(e,t,i,r)=>{if(void 0===r)return;let o=l+t,s=a[r];function u(t){let n=this.opts.uriResolver.resolve;if(t=p(s?n(s,t):t),d.has(t))throw g(t);d.add(t);let i=this.refs[t];return"string"==typeof i&&(i=this.refs[i]),"object"==typeof i?h(e,i.schema,t):t!==p(o)&&("#"===t[0]?(h(e,c[t],t),c[t]=e):this.refs[t]=o),t}function m(e){if("string"==typeof e){if(!f.test(e))throw Error(`invalid anchor "${e}"`);u.call(this,`#${e}`)}}"string"==typeof e[n]&&(s=u.call(this,e[n])),m.call(this,e.$anchor),m.call(this,e.$dynamicAnchor),a[t]=s}),c;function h(e,t,n){if(void 0!==t&&!r(e,t))throw g(n)}function g(e){return Error(`reference "${e}" resolves to more than one schema`)}}},10396(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},94227(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let r=n(99029),o=n(41520);function s(e,t=e.schema){let{opts:n,self:i}=e;if(!n.strictSchema||"boolean"==typeof t)return;let r=i.RULES.keywords;for(let n in t)r[n]||f(e,`unknown keyword: "${n}"`)}function a(e,t){if("boolean"==typeof e)return!e;for(let n in e)if(t[n])return!0;return!1}function l(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:i}){return(o,s,a,l)=>{let c=void 0===a?s:a instanceof r.Name?(s instanceof r.Name?e(o,s,a):t(o,s,a),a):s instanceof r.Name?(t(o,a,s),s):n(s,a);return l!==r.Name||c instanceof r.Name?c:i(o,c)}}function d(e,t){if(!0===t)return e.var("props",!0);let n=e.var("props",(0,r._)`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach(n=>e.assign((0,r._)`${t}${(0,r.getProperty)(n)}`,!0))}t.toHash=function(e){let t={};for(let n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(s(e,t),!a(t,e.self.RULES.all))},t.checkUnknownRules=s,t.schemaHasRules=a,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,i,o){if(!o){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return(0,r._)`${n}`}return(0,r._)`${e}${t}${(0,r.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(l(e))},t.escapeJsonPointer=l,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)},t.mergeEvaluated={props:u({mergeNames:(e,t,n)=>e.if((0,r._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,r._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,r._)`${n} || {}`).code((0,r._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,r._)`${n} !== true`,()=>{!0===t?e.assign(n,!0):(e.assign(n,(0,r._)`${n} || {}`),h(e,n,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:d}),items:u({mergeNames:(e,t,n)=>e.if((0,r._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,r._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,r._)`${n} !== true`,()=>e.assign(n,!0===t||(0,r._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=d,t.setEvaluated=h;let p={};function f(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new o._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(i||(t.Type=i={})),t.getErrorPath=function(e,t,n){if(e instanceof r.Name){let o=t===i.Num;return n?o?(0,r._)`"[" + ${e} + "]"`:(0,r._)`"['" + ${e} + "']"`:o?(0,r._)`"/" + ${e}`:(0,r._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,r.getProperty)(e).toString():"/"+l(e)},t.checkStrictMode=f},7887(e,t){"use strict";function n(e,t){return t.rules.some(t=>i(e,t))}function i(e,t){var n;return void 0!==e[t.keyword]||(null==(n=t.definition.implements)?void 0:n.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},i){let r=t.RULES.types[i];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=i},28727(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let i=n(48708),r=n(99029),o=n(42023),s={message:"boolean schema is false"};function a(e,t){let{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,i.reportError)(o,s,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:n,validateName:i}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(o.default.data):(t.assign((0,r._)`${i}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:n,schema:i}=e;!1===i?(n.var(t,!1),a(e)):n.var(t,!0)}},10208(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let r=n(10396),o=n(7887),s=n(48708),a=n(99029),l=n(94227);function c(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(r.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(i||(t.DataType=i={})),t.getSchemaTypes=function(e){let t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){let{gen:n,data:r,opts:s}=e,a=d(t,s.coerceTypes),l=t.length>0&&!(0===a.length&&1===t.length&&(0,o.schemaHasRulesForType)(e,t[0]));if(l){let o=g(t,r,s.strictNumbers,i.Wrong);n.if(o,()=>{a.length?h(e,t,a):v(e)})}return l};let u=new Set(["string","number","integer","boolean","null"]);function d(e,t){return t?e.filter(e=>u.has(e)||"array"===t&&"array"===e):[]}function h(e,t,n){let{gen:i,data:r,opts:o}=e,s=i.let("dataType",(0,a._)`typeof ${r}`),l=i.let("coerced",(0,a._)`undefined`);for(let e of("array"===o.coerceTypes&&i.if((0,a._)`${s} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>i.assign(r,(0,a._)`${r}[0]`).assign(s,(0,a._)`typeof ${r}`).if(g(t,r,o.strictNumbers),()=>i.assign(l,r))),i.if((0,a._)`${l} !== undefined`),n))(u.has(e)||"array"===e&&"array"===o.coerceTypes)&&c(e);function c(e){switch(e){case"string":i.elseIf((0,a._)`${s} == "number" || ${s} == "boolean"`).assign(l,(0,a._)`"" + ${r}`).elseIf((0,a._)`${r} === null`).assign(l,(0,a._)`""`);return;case"number":i.elseIf((0,a._)`${s} == "boolean" || ${r} === null
6
6
  || (${s} == "string" && ${r} && ${r} == +${r})`).assign(l,(0,a._)`+${r}`);return;case"integer":i.elseIf((0,a._)`${s} === "boolean" || ${r} === null
7
7
  || (${s} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(l,(0,a._)`+${r}`);return;case"boolean":i.elseIf((0,a._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(l,!1).elseIf((0,a._)`${r} === "true" || ${r} === 1`).assign(l,!0);return;case"null":i.elseIf((0,a._)`${r} === "" || ${r} === 0 || ${r} === false`),i.assign(l,null);return;case"array":i.elseIf((0,a._)`${s} === "string" || ${s} === "number"
8
8
  || ${s} === "boolean" || ${r} === null`).assign(l,(0,a._)`[${r}]`)}}i.else(),v(e),i.endIf(),i.if((0,a._)`${l} !== undefined`,()=>{i.assign(r,l),p(e,l)})}function p({gen:e,parentData:t,parentDataProperty:n},i){e.if((0,a._)`${t} !== undefined`,()=>e.assign((0,a._)`${t}[${n}]`,i))}function f(e,t,n,r=i.Correct){let o,s=r===i.Correct?a.operators.EQ:a.operators.NEQ;switch(e){case"null":return(0,a._)`${t} ${s} null`;case"array":o=(0,a._)`Array.isArray(${t})`;break;case"object":o=(0,a._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=l((0,a._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=l();break;default:return(0,a._)`typeof ${t} ${s} ${e}`}return r===i.Correct?o:(0,a.not)(o);function l(e=a.nil){return(0,a.and)((0,a._)`typeof ${t} == "number"`,e,n?(0,a._)`isFinite(${t})`:a.nil)}}function g(e,t,n,i){let r;if(1===e.length)return f(e[0],t,n,i);let o=(0,l.toHash)(e);if(o.array&&o.object){let e=(0,a._)`typeof ${t} != "object"`;r=o.null?e:(0,a._)`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else r=a.nil;for(let e in o.number&&delete o.integer,o)r=(0,a.and)(r,f(e,t,n,i));return r}t.checkDataType=f,t.checkDataTypes=g;let m={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,a._)`{type: ${e}}`:(0,a._)`{type: ${t}}`};function v(e){let t=b(e);(0,s.reportError)(t,m)}function b(e){let{gen:t,data:n,schema:i}=e,r=(0,l.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:r,schemaValue:r,parentSchema:i,params:{},it:e}}t.reportTypeError=v},7870(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let i=n(99029),r=n(94227);function o(e,t,n){let{gen:o,compositeRule:s,data:a,opts:l}=e;if(void 0===n)return;let c=(0,i._)`${a}${(0,i.getProperty)(t)}`;if(s)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=(0,i._)`${c} === undefined`;"empty"===l.useDefaults&&(u=(0,i._)`${u} || ${c} === null || ${c} === ""`),o.if(u,(0,i._)`${c} = ${(0,i.stringify)(n)}`)}t.assignDefaults=function(e,t){let{properties:n,items:i}=e.schema;if("object"===t&&n)for(let t in n)o(e,t,n[t].default);else"array"===t&&Array.isArray(i)&&i.forEach((t,n)=>o(e,n,t.default))}},62586(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let i=n(28727),r=n(10208),o=n(7887),s=n(10208),a=n(7870),l=n(33673),c=n(24495),u=n(99029),d=n(42023),h=n(66939),p=n(94227),f=n(48708);function g({gen:e,validateName:t,schema:n,schemaEnv:i,opts:r},o){r.code.es5?e.func(t,(0,u._)`${d.default.data}, ${d.default.valCxt}`,i.$async,()=>{e.code((0,u._)`"use strict"; ${w(n,r)}`),v(e,r),e.code(o)}):e.func(t,(0,u._)`${d.default.data}, ${m(r)}`,i.$async,()=>e.code(w(n,r)).code(o))}function m(e){return(0,u._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?(0,u._)`, ${d.default.dynamicAnchors}={}`:u.nil}}={}`}function v(e,t){e.if(d.default.valCxt,()=>{e.var(d.default.instancePath,(0,u._)`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,(0,u._)`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,(0,u._)`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,(0,u._)`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,(0,u._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)},()=>{e.var(d.default.instancePath,(0,u._)`""`),e.var(d.default.parentData,(0,u._)`undefined`),e.var(d.default.parentDataProperty,(0,u._)`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,(0,u._)`{}`)})}function b(e){let{schema:t,opts:n,gen:i}=e;g(e,()=>{n.$comment&&t.$comment&&L(e),k(e),i.let(d.default.vErrors,null),i.let(d.default.errors,0),n.unevaluated&&y(e),C(e),O(e)})}function y(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,u._)`${n}.evaluated`),t.if((0,u._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,u._)`${e.evaluated}.props`,(0,u._)`undefined`)),t.if((0,u._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,u._)`${e.evaluated}.items`,(0,u._)`undefined`))}function w(e,t){let n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,u._)`/*# sourceURL=${n} */`:u.nil}function x(e,t){_(e)&&(M(e),$(e))?S(e,t):(0,i.boolOrEmptySchema)(e,t)}function $({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function _(e){return"boolean"!=typeof e.schema}function S(e,t){let{schema:n,gen:i,opts:r}=e;r.$comment&&n.$comment&&L(e),A(e),T(e);let o=i.const("_errs",d.default.errors);C(e,o),i.var(t,(0,u._)`${o} === ${d.default.errors}`)}function M(e){(0,p.checkUnknownRules)(e),E(e)}function C(e,t){if(e.opts.jtd)return D(e,[],!1,t);let n=(0,r.getSchemaTypes)(e.schema),i=(0,r.coerceAndCheckDataType)(e,n);D(e,n,!i,t)}function E(e){let{schema:t,errSchemaPath:n,opts:i,self:r}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function k(e){let{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}function A(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,h.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function T(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function L({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:r}){let o=n.$comment;if(!0===r.$comment)e.code((0,u._)`${d.default.self}.logger.log(${o})`);else if("function"==typeof r.$comment){let n=(0,u.str)`${i}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code((0,u._)`${d.default.self}.opts.$comment(${o}, ${n}, ${r}.schema)`)}}function O(e){let{gen:t,schemaEnv:n,validateName:i,ValidationError:r,opts:o}=e;n.$async?t.if((0,u._)`${d.default.errors} === 0`,()=>t.return(d.default.data),()=>t.throw((0,u._)`new ${r}(${d.default.vErrors})`)):(t.assign((0,u._)`${i}.errors`,d.default.vErrors),o.unevaluated&&R(e),t.return((0,u._)`${d.default.errors} === 0`))}function R({gen:e,evaluated:t,props:n,items:i}){n instanceof u.Name&&e.assign((0,u._)`${t}.props`,n),i instanceof u.Name&&e.assign((0,u._)`${t}.items`,i)}function D(e,t,n,i){let{gen:r,schema:a,data:l,allErrors:c,opts:h,self:f}=e,{RULES:g}=f;if(a.$ref&&(h.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(a,g)))return void r.block(()=>B(e,"$ref",g.all.$ref.definition));function m(p){(0,o.shouldUseGroup)(a,p)&&(p.type?(r.if((0,s.checkDataType)(p.type,l,h.strictNumbers)),I(e,p),1===t.length&&t[0]===p.type&&n&&(r.else(),(0,s.reportTypeError)(e)),r.endIf()):I(e,p),c||r.if((0,u._)`${d.default.errors} === ${i||0}`))}h.jtd||j(e,t),r.block(()=>{for(let e of g.rules)m(e);m(g.post)})}function I(e,t){let{gen:n,schema:i,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,o.shouldUseRule)(i,n)&&B(e,n.keyword,n.definition,t.type)})}function j(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(N(e,t),e.opts.allowUnionTypes||P(e,t),F(e,e.dataTypes))}function N(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{V(e.dataTypes,t)||H(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),z(e,t)}}function P(e,t){t.length>1&&!(2===t.length&&t.includes("null"))&&H(e,"use allowUnionTypes to allow union type keyword")}function F(e,t){let n=e.self.RULES.all;for(let i in n){let r=n[i];if("object"==typeof r&&(0,o.shouldUseRule)(e.schema,r)){let{type:n}=r.definition;n.length&&!n.some(e=>U(t,e))&&H(e,`missing type "${n.join(",")}" for keyword "${i}"`)}}}function U(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function V(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function z(e,t){let n=[];for(let i of e.dataTypes)V(t,i)?n.push(i):t.includes("integer")&&"number"===i&&n.push("integer");e.dataTypes=n}function H(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){_(e)&&(M(e),$(e))?b(e):g(e,()=>(0,i.topBoolOrEmptySchema)(e))};class W{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",K(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",d.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,u._)`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=u.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=u.nil,t=u.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:r,def:o}=this;n.if((0,u.or)((0,u._)`${i} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(r.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:i,it:r}=this;return(0,u.or)(o(),a());function o(){if(n.length){if(!(t instanceof u.Name))throw Error("ajv implementation error");let e=Array.isArray(n)?n:[n];return(0,u._)`${(0,s.checkDataTypes)(e,t,r.opts.strictNumbers,s.DataType.Wrong)}`}return u.nil}function a(){if(i.validateSchema){let n=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,u._)`!${n}(${t})`}return u.nil}}subschema(e,t){let n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return x(i,t),i}mergeEvaluated(e,t){let{it:n,gen:i}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(i,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(i,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return i.if(t,()=>this.mergeEvaluated(e,u.Name)),!0}}function B(e,t,n,i){let r=new W(e,n,t);"code"in n?n.code(r,i):r.$data&&n.validate?(0,l.funcKeywordCode)(r,n):"macro"in n?(0,l.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(r,n)}t.KeywordCxt=W;let q=/^\/(?:[^~]|~0|~1)*$/,G=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function K(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let r,o;if(""===e)return d.default.rootData;if("/"===e[0]){if(!q.test(e))throw Error(`Invalid JSON-pointer: ${e}`);r=e,o=d.default.rootData}else{let s=G.exec(e);if(!s)throw Error(`Invalid JSON-pointer: ${e}`);let l=+s[1];if("#"===(r=s[2])){if(l>=t)throw Error(a("property/index",l));return i[t-l]}if(l>t)throw Error(a("data",l));if(o=n[t-l],!r)return o}let s=o;for(let e of r.split("/"))e&&(o=(0,u._)`${o}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,s=(0,u._)`${s} && ${o}`);return s;function a(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=K},33673(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let i=n(99029),r=n(42023),o=n(15765),s=n(48708);function a(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,i._)`${r.parentData}[${r.parentDataProperty}]`))}function l(e,t){let{gen:n}=e;n.if((0,i._)`Array.isArray(${t})`,()=>{n.assign(r.default.vErrors,(0,i._)`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,(0,i._)`${r.default.vErrors}.length`),(0,s.extendErrors)(e)},()=>e.error())}function c({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function u(e,t,n){if(void 0===n)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,i.stringify)(n)})}t.macroKeywordCode=function(e,t){let{gen:n,keyword:r,schema:o,parentSchema:s,it:a}=e,l=t.macro.call(a.self,o,s,a),c=u(n,r,l);!1!==a.opts.validateSchema&&a.self.validateSchema(l,!0);let d=n.name("valid");e.subschema({schema:l,schemaPath:i.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:c,compositeRule:!0},d),e.pass(d,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var n;let{gen:s,keyword:d,schema:h,parentSchema:p,$data:f,it:g}=e;c(g,t);let m=u(s,d,!f&&t.compile?t.compile.call(g.self,h,p,g):t.validate),v=s.let("valid");function b(){if(!1===t.errors)x(),t.modifying&&a(e),$(()=>e.error());else{let n=t.async?y():w();t.modifying&&a(e),$(()=>l(e,n))}}function y(){let e=s.let("ruleErrs",null);return s.try(()=>x((0,i._)`await `),t=>s.assign(v,!1).if((0,i._)`${t} instanceof ${g.ValidationError}`,()=>s.assign(e,(0,i._)`${t}.errors`),()=>s.throw(t))),e}function w(){let e=(0,i._)`${m}.errors`;return s.assign(e,null),x(i.nil),e}function x(n=t.async?(0,i._)`await `:i.nil){let a=g.opts.passContext?r.default.this:r.default.self,l=!("compile"in t&&!f||!1===t.schema);s.assign(v,(0,i._)`${n}${(0,o.callValidateCode)(e,m,a,l)}`,t.modifying)}function $(e){var n;s.if((0,i.not)(null!=(n=t.valid)?n:v),e)}e.block$data(v,b),e.ok(null!=(n=t.valid)?n:v)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:i},r,o){if(Array.isArray(r.keyword)?!r.keyword.includes(o):r.keyword!==o)throw Error("ajv implementation error");let s=r.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[o])){let e=`keyword "${o}" value is invalid at path "${i}": `+n.errorsText(r.validateSchema.errors);if("log"===t.validateSchema)n.logger.error(e);else throw Error(e)}}},24495(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let i=n(99029),r=n(94227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:o,schemaPath:s,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==o)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let o=e.schema[t];return void 0===n?{schema:o,schemaPath:(0,i._)`${e.schemaPath}${(0,i.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[n],schemaPath:(0,i._)`${e.schemaPath}${(0,i.getProperty)(t)}${(0,i.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===s||void 0===a||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:l,errSchemaPath:a}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:o,data:s,dataTypes:a,propertyName:l}){if(void 0!==s&&void 0!==n)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:c}=t;if(void 0!==n){let{errorPath:s,dataPathArr:a,opts:l}=t;u(c.let("data",(0,i._)`${t.data}${(0,i.getProperty)(n)}`,!0)),e.errorPath=(0,i.str)`${s}${(0,r.getErrorPath)(n,o,l.jsPropertySyntax)}`,e.parentDataProperty=(0,i._)`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}function u(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}void 0!==s&&(u(s instanceof i.Name?s:c.let("data",s,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:r,allErrors:o}){void 0!==i&&(e.compositeRule=i),void 0!==r&&(e.createErrors=r),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=n}},4042(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var i=n(62586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return i.KeywordCxt}});var r=n(99029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=n(13558),s=n(34551),a=n(10396),l=n(73835),c=n(99029),u=n(66939),d=n(10208),h=n(94227),p=n(63837),f=n(55944),g=(e,t)=>new RegExp(e,t);g.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},w=200;function x(e){var t,n,i,r,o,s,a,l,c,u,d,h,p,m,v,b,y,x,$,_,S,M,C,E,k;let A=e.strict,T=null==(t=e.code)?void 0:t.optimize,L=!0===T||void 0===T?1:T||0,O=null!=(i=null==(n=e.code)?void 0:n.regExp)?i:g,R=null!=(r=e.uriResolver)?r:f.default;return{strictSchema:null==(s=null!=(o=e.strictSchema)?o:A)||s,strictNumbers:null==(l=null!=(a=e.strictNumbers)?a:A)||l,strictTypes:null!=(u=null!=(c=e.strictTypes)?c:A)?u:"log",strictTuples:null!=(h=null!=(d=e.strictTuples)?d:A)?h:"log",strictRequired:null!=(m=null!=(p=e.strictRequired)?p:A)&&m,code:e.code?{...e.code,optimize:L,regExp:O}:{optimize:L,regExp:O},loopRequired:null!=(v=e.loopRequired)?v:w,loopEnum:null!=(b=e.loopEnum)?b:w,meta:null==(y=e.meta)||y,messages:null==(x=e.messages)||x,inlineRefs:null==($=e.inlineRefs)||$,schemaId:null!=(_=e.schemaId)?_:"$id",addUsedSchema:null==(S=e.addUsedSchema)||S,validateSchema:null==(M=e.validateSchema)||M,validateFormats:null==(C=e.validateFormats)||C,unicodeRegExp:null==(E=e.unicodeRegExp)||E,int32range:null==(k=e.int32range)||k,uriResolver:R}}class ${constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...x(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:v,es5:t,lines:n}),this.logger=T(e.logger);const i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),_.call(this,b,e,"NOT SUPPORTED"),_.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=k.call(this),e.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),M.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,i=p;"id"===n&&((i={...p}).id=i.$id,delete i.$id),t&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(!(n=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(t);return"$async"in n||(this.errors=n.errors),i}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,t);async function i(e,t){await r.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function r(e){e&&!this.getSchema(e)&&await i.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof s.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),o.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let n=await c.call(this,e);this.refs[e]||await r.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,i=this.opts.validateSchema){let r;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,i);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(r=e[t])&&"string"!=typeof r)throw Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,i,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){let n;if("boolean"==typeof e)return!0;if(void 0!==(n=e.$schema)&&"string"!=typeof n)throw Error("$schema must be a string");if(!(n=n||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return i}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){let{schemaId:n}=this.opts,i=new l.SchemaEnv({schema:{},schemaId:n});if(!(t=l.resolveSchema.call(this,i,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else if("object"==typeof e&&void 0===t){if(Array.isArray(n=(t=e).keyword)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(O.call(this,n,t),!t)return(0,h.eachItem)(n,e=>R.call(this,e)),this;I.call(this,t);let i={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,h.eachItem)(n,0===i.type.length?e=>R.call(this,e,i):e=>i.type.forEach(t=>R.call(this,e,i,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let n of(delete t.keywords[e],delete t.all[e],t.rules)){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n):"No errors"}$dataMetaSchema(e,t){let n=this.RULES.all;for(let i of(e=JSON.parse(JSON.stringify(e)),t)){let t=i.split("/").slice(1),r=e;for(let e of t)r=r[e];for(let e in n){let t=n[e];if("object"!=typeof t)continue;let{$data:i}=t.definition,o=r[e];i&&o&&(r[e]=N(o))}}return e}_removeAllSchemas(e,t){for(let n in e){let i=e[n];(!t||t.test(n))&&("string"==typeof i?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,t,n,i=this.opts.validateSchema,r=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if("object"==typeof e)o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let a=this._cache.get(e);if(void 0!==a)return a;n=(0,u.normalizeId)(o||n);let c=u.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),r&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),i&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function _(e,t,n,i="error"){for(let r in e){let o=r;o in t&&this.logger[i](`${n}: option ${r}. ${e[o]}`)}}function S(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function M(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function C(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}function k(){let e={...this.opts};for(let t of m)delete e[t];return e}$.ValidationError=o.default,$.MissingRefError=s.default,t.default=$;let A={log(){},warn(){},error(){}};function T(e){if(!1===e)return A;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}let L=/^[a-z_$][a-z0-9_$:-]*$/i;function O(e,t){let{RULES:n}=this;if((0,h.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!L.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function R(e,t,n){var i;let r=null==t?void 0:t.post;if(n&&r)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=r?o.post:o.rules.find(({type:e})=>e===n);if(s||(s={type:n,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?D.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,null==(i=t.implements)||i.forEach(e=>this.addKeyword(e))}function D(e,t,n){let i=e.rules.findIndex(e=>e.keyword===n);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=N(t)),e.validateSchema=this.compile(t,!0))}let j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(e){return{anyOf:[e,j]}}},76250(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(32017);i.code='require("ajv/dist/runtime/equal").default',t.default=i},53853(e,t){"use strict";function n(e){let t,n=e.length,i=0,r=0;for(;r<n;)i++,(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<n&&(64512&(t=e.charCodeAt(r)))==56320&&r++;return i}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},55944(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(48343);i.code='require("ajv/dist/runtime/uri").default',t.default=i},13558(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},15457(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let i=n(99029),r=n(94227),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,i.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,i._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:n}=e,{items:i}=t;Array.isArray(i)?s(e,i):(0,r.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(e,t){let{gen:n,schema:o,data:s,keyword:a,it:l}=e;l.items=!0;let c=n.const("len",(0,i._)`${s}.length`);if(!1===o)e.setParams({len:t.length}),e.pass((0,i._)`${c} <= ${t.length}`);else if("object"==typeof o&&!(0,r.alwaysValidSchema)(l,o)){let r=n.var("valid",(0,i._)`${c} <= ${t.length}`);n.if((0,i.not)(r),()=>u(r)),e.ok(r)}function u(o){n.forRange("i",t.length,c,t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},o),l.allErrors||n.if((0,i.not)(o),()=>n.break())})}}t.validateAdditionalItems=s,t.default=o},38660(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(15765),r=n(99029),o=n(42023),s=n(94227);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,r._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:n,parentSchema:a,data:l,errsCount:c,it:u}=e;if(!c)throw Error("ajv implementation error");let{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,s.alwaysValidSchema)(u,n))return;let p=(0,i.allSchemaProperties)(a.properties),f=(0,i.allSchemaProperties)(a.patternProperties);function g(n){let o;if(p.length>8){let e=(0,s.schemaRefOrVal)(u,a.properties,"properties");o=(0,i.isOwnProperty)(t,e,n)}else o=p.length?(0,r.or)(...p.map(e=>(0,r._)`${n} === ${e}`)):r.nil;return f.length&&(o=(0,r.or)(o,...f.map(t=>(0,r._)`${(0,i.usePattern)(e,t)}.test(${n})`))),(0,r.not)(o)}function m(e){t.code((0,r._)`delete ${l}[${e}]`)}function v(i){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)return void m(i);if(!1===n){e.setParams({additionalProperty:i}),e.error(),d||t.break();return}if("object"==typeof n&&!(0,s.alwaysValidSchema)(u,n)){let n=t.name("valid");"failing"===h.removeAdditional?(b(i,n,!1),t.if((0,r.not)(n),()=>{e.reset(),m(i)})):(b(i,n),d||t.if((0,r.not)(n),()=>t.break()))}}function b(t,n,i){let r={keyword:"additionalProperties",dataProp:t,dataPropType:s.Type.Str};!1===i&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,n)}(function e(){t.forIn("key",l,e=>{p.length||f.length?t.if(g(e),()=>v(e)):v(e)})})(),e.ok((0,r._)`${c} === ${o.default.errors}`)}}},15844(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(94227);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let o=t.name("valid");n.forEach((t,n)=>{if((0,i.alwaysValidSchema)(r,t))return;let s=e.subschema({keyword:"allOf",schemaProp:n},o);e.ok(o),e.mergeEvaluated(s)})}}},16505(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(15765).validateUnion,error:{message:"must match a schema in anyOf"}}},12661(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(99029),r=n(94227);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,i.str)`must contain at least ${e} valid item(s)`:(0,i.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,i._)`{minContains: ${e}}`:(0,i._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,n,{gen:o,schema:s,parentSchema:a,data:l,it:c}=e,{minContains:u,maxContains:d}=a;c.opts.next?(t=void 0===u?1:u,n=d):t=1;let h=o.const("len",(0,i._)`${l}.length`);if(e.setParams({min:t,max:n}),void 0===n&&0===t)return void(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==n&&t>n){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,r.alwaysValidSchema)(c,s)){let r=(0,i._)`${h} >= ${t}`;void 0!==n&&(r=(0,i._)`${r} && ${h} <= ${n}`),e.pass(r);return}c.items=!0;let p=o.name("valid");function f(){let e=o.name("_valid"),t=o.let("count",0);g(e,()=>o.if(e,()=>m(t)))}function g(t,n){o.forRange("i",0,h,i=>{e.subschema({keyword:"contains",dataProp:i,dataPropType:r.Type.Num,compositeRule:!0},t),n()})}function m(e){o.code((0,i._)`${e}++`),void 0===n?o.if((0,i._)`${e} >= ${t}`,()=>o.assign(p,!0).break()):(o.if((0,i._)`${e} > ${n}`,()=>o.assign(p,!1).break()),1===t?o.assign(p,!0):o.if((0,i._)`${e} >= ${t}`,()=>o.assign(p,!0)))}void 0===n&&1===t?g(p,()=>o.if(p,()=>o.break())):0===t?(o.let(p,!0),void 0!==n&&o.if((0,i._)`${l}.length > 0`,f)):(o.let(p,!1),f()),e.result(p,()=>e.reset())}}},83025(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let i=n(99029),r=n(94227),o=n(15765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{let r=1===t?"property":"properties";return(0,i.str)`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>(0,i._)`{property: ${e},