mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-04-20 15:16:38 +00:00
48 lines
246 KiB
JavaScript
48 lines
246 KiB
JavaScript
import{a as Mn,b as Oi,c as ql}from"./chunk-T4FRG4BA.js";import{a as qs}from"./chunk-B2GOFULO.js";import{a as Ys,b as Xs,c as Yl}from"./chunk-7U3MLVOX.js";import{D as Pa,J as ka,l as ee,u as Gs,v as Vs}from"./chunk-HOSZ5TQY.js";import{A as gi,E as qt,F as Sa,G as Mi,H as Fn,I as Bs,J as Aa,T as Ca,V as js,a as br,b as qi,ba as In,ca as zs,d as Ot,da as Yi,e as Ta,f as Tt,g as Ne,k as Us,m as Pn,n as kn,o as Dn,p as mi,q as Ws,t as Rn,w as $s,x as Hs,y as Ln,z as Nt}from"./chunk-RXF2JDJ3.js";import{c as Vi,d as Ea,e as _a}from"./chunk-WAARL7ET.js";var Ra=Ea((Qs,Da)=>{(function(l){if(typeof Qs=="object"&&typeof Da!="undefined")Da.exports=l();else if(typeof define=="function"&&define.amd)define([],l);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=l()}})(function(){var l,t,r;return function a(u,d,m){function y(W,le){if(!d[W]){if(!u[W]){var H=typeof Vi=="function"&&Vi;if(!le&&H)return H(W,!0);if(b)return b(W,!0);var U=new Error("Cannot find module '"+W+"'");throw U.code="MODULE_NOT_FOUND",U}var B=d[W]={exports:{}};u[W][0].call(B.exports,function(ce){var Q=u[W][1][ce];return y(Q||ce)},B,B.exports,a,u,d,m)}return d[W].exports}for(var b=typeof Vi=="function"&&Vi,D=0;D<m.length;D++)y(m[D]);return y}({1:[function(a,u,d){(function(m){"use strict";var y=m.MutationObserver||m.WebKitMutationObserver,b;if(y){var D=0,W=new y(ce),le=m.document.createTextNode("");W.observe(le,{characterData:!0}),b=function(){le.data=D=++D%2}}else if(!m.setImmediate&&typeof m.MessageChannel!="undefined"){var H=new m.MessageChannel;H.port1.onmessage=ce,b=function(){H.port2.postMessage(0)}}else"document"in m&&"onreadystatechange"in m.document.createElement("script")?b=function(){var we=m.document.createElement("script");we.onreadystatechange=function(){ce(),we.onreadystatechange=null,we.parentNode.removeChild(we),we=null},m.document.documentElement.appendChild(we)}:b=function(){setTimeout(ce,0)};var U,B=[];function ce(){U=!0;for(var we,ke,he=B.length;he;){for(ke=B,B=[],we=-1;++we<he;)ke[we]();he=B.length}U=!1}u.exports=Q;function Q(we){B.push(we)===1&&!U&&b()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(a,u,d){"use strict";var m=a(1);function y(){}var b={},D=["REJECTED"],W=["FULFILLED"],le=["PENDING"];u.exports=H;function H(s){if(typeof s!="function")throw new TypeError("resolver must be a function");this.state=le,this.queue=[],this.outcome=void 0,s!==y&&Q(this,s)}H.prototype.catch=function(s){return this.then(null,s)},H.prototype.then=function(s,ue){if(typeof s!="function"&&this.state===W||typeof ue!="function"&&this.state===D)return this;var J=new this.constructor(y);if(this.state!==le){var De=this.state===W?s:ue;B(J,De,this.outcome)}else this.queue.push(new U(J,s,ue));return J};function U(s,ue,J){this.promise=s,typeof ue=="function"&&(this.onFulfilled=ue,this.callFulfilled=this.otherCallFulfilled),typeof J=="function"&&(this.onRejected=J,this.callRejected=this.otherCallRejected)}U.prototype.callFulfilled=function(s){b.resolve(this.promise,s)},U.prototype.otherCallFulfilled=function(s){B(this.promise,this.onFulfilled,s)},U.prototype.callRejected=function(s){b.reject(this.promise,s)},U.prototype.otherCallRejected=function(s){B(this.promise,this.onRejected,s)};function B(s,ue,J){m(function(){var De;try{De=ue(J)}catch(et){return b.reject(s,et)}De===s?b.reject(s,new TypeError("Cannot resolve promise with itself")):b.resolve(s,De)})}b.resolve=function(s,ue){var J=we(ce,ue);if(J.status==="error")return b.reject(s,J.value);var De=J.value;if(De)Q(s,De);else{s.state=W,s.outcome=ue;for(var et=-1,Me=s.queue.length;++et<Me;)s.queue[et].callFulfilled(ue)}return s},b.reject=function(s,ue){s.state=D,s.outcome=ue;for(var J=-1,De=s.queue.length;++J<De;)s.queue[J].callRejected(ue);return s};function ce(s){var ue=s&&s.then;if(s&&(typeof s=="object"||typeof s=="function")&&typeof ue=="function")return function(){ue.apply(s,arguments)}}function Q(s,ue){var J=!1;function De(Qe){J||(J=!0,b.reject(s,Qe))}function et(Qe){J||(J=!0,b.resolve(s,Qe))}function Me(){ue(et,De)}var ve=we(Me);ve.status==="error"&&De(ve.value)}function we(s,ue){var J={};try{J.value=s(ue),J.status="success"}catch(De){J.status="error",J.value=De}return J}H.resolve=ke;function ke(s){return s instanceof this?s:b.resolve(new this(y),s)}H.reject=he;function he(s){var ue=new this(y);return b.reject(ue,s)}H.all=de;function de(s){var ue=this;if(Object.prototype.toString.call(s)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=s.length,De=!1;if(!J)return this.resolve([]);for(var et=new Array(J),Me=0,ve=-1,Qe=new this(y);++ve<J;)St(s[ve],ve);return Qe;function St(wr,mt){ue.resolve(wr).then(Er,function(gt){De||(De=!0,b.reject(Qe,gt))});function Er(gt){et[mt]=gt,++Me===J&&!De&&(De=!0,b.resolve(Qe,et))}}}H.race=He;function He(s){var ue=this;if(Object.prototype.toString.call(s)!=="[object Array]")return this.reject(new TypeError("must be an array"));var J=s.length,De=!1;if(!J)return this.resolve([]);for(var et=-1,Me=new this(y);++et<J;)ve(s[et]);return Me;function ve(Qe){ue.resolve(Qe).then(function(St){De||(De=!0,b.resolve(Me,St))},function(St){De||(De=!0,b.reject(Me,St))})}}},{"1":1}],3:[function(a,u,d){(function(m){"use strict";typeof m.Promise!="function"&&(m.Promise=a(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"2":2}],4:[function(a,u,d){"use strict";var m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function y(p,E){if(!(p instanceof E))throw new TypeError("Cannot call a class as a function")}function b(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(p){return}}var D=b();function W(){try{if(!D||!D.open)return!1;var p=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),E=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||E)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(g){return!1}}function le(p,E){p=p||[],E=E||{};try{return new Blob(p,E)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,A=new g,k=0;k<p.length;k+=1)A.append(p[k]);return A.getBlob(E.type)}}typeof Promise=="undefined"&&a(3);var H=Promise;function U(p,E){E&&p.then(function(g){E(null,g)},function(g){E(g)})}function B(p,E,g){typeof E=="function"&&p.then(E),typeof g=="function"&&p.catch(g)}function ce(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function Q(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var we="local-forage-detect-blob-support",ke=void 0,he={},de=Object.prototype.toString,He="readonly",s="readwrite";function ue(p){for(var E=p.length,g=new ArrayBuffer(E),A=new Uint8Array(g),k=0;k<E;k++)A[k]=p.charCodeAt(k);return g}function J(p){return new H(function(E){var g=p.transaction(we,s),A=le([""]);g.objectStore(we).put(A,"key"),g.onabort=function(k){k.preventDefault(),k.stopPropagation(),E(!1)},g.oncomplete=function(){var k=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);E(S||!k||parseInt(k[1],10)>=43)}}).catch(function(){return!1})}function De(p){return typeof ke=="boolean"?H.resolve(ke):J(p).then(function(E){return ke=E,ke})}function et(p){var E=he[p.name],g={};g.promise=new H(function(A,k){g.resolve=A,g.reject=k}),E.deferredOperations.push(g),E.dbReady?E.dbReady=E.dbReady.then(function(){return g.promise}):E.dbReady=g.promise}function Me(p){var E=he[p.name],g=E.deferredOperations.pop();if(g)return g.resolve(),g.promise}function ve(p,E){var g=he[p.name],A=g.deferredOperations.pop();if(A)return A.reject(E),A.promise}function Qe(p,E){return new H(function(g,A){if(he[p.name]=he[p.name]||qe(),p.db)if(E)et(p),p.db.close();else return g(p.db);var k=[p.name];E&&k.push(p.version);var S=D.open.apply(D,k);E&&(S.onupgradeneeded=function(M){var j=S.result;try{j.createObjectStore(p.storeName),M.oldVersion<=1&&j.createObjectStore(we)}catch(q){if(q.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw q}}),S.onerror=function(M){M.preventDefault(),A(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(j){j.target.close()},g(M),Me(p)}})}function St(p){return Qe(p,!1)}function wr(p){return Qe(p,!0)}function mt(p,E){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),A=p.version<p.db.version,k=p.version>p.db.version;if(A&&(p.version!==E&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),k||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function Er(p){return new H(function(E,g){var A=new FileReader;A.onerror=g,A.onloadend=function(k){var S=btoa(k.target.result||"");E({__local_forage_encoded_blob:!0,data:S,type:p.type})},A.readAsBinaryString(p)})}function gt(p){var E=ue(atob(p.data));return le([E],{type:p.type})}function Kr(p){return p&&p.__local_forage_encoded_blob}function Zr(p){var E=this,g=E._initReady().then(function(){var A=he[E._dbInfo.name];if(A&&A.dbReady)return A.dbReady});return B(g,p,p),g}function Ve(p){et(p);for(var E=he[p.name],g=E.forages,A=0;A<g.length;A++){var k=g[A];k._dbInfo.db&&(k._dbInfo.db.close(),k._dbInfo.db=null)}return p.db=null,St(p).then(function(S){return p.db=S,mt(p)?wr(p):S}).then(function(S){p.db=E.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw ve(p,S),S})}function vt(p,E,g,A){A===void 0&&(A=1);try{var k=p.db.transaction(p.storeName,E);g(null,k)}catch(S){if(A>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return H.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),wr(p)}).then(function(){return Ve(p).then(function(){vt(p,E,g,A-1)})}).catch(g);g(S)}}function qe(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ci(p){var E=this,g={db:null};if(p)for(var A in p)g[A]=p[A];var k=he[g.name];k||(k=qe(),he[g.name]=k),k.forages.push(E),E._initReady||(E._initReady=E.ready,E.ready=Zr);var S=[];function M(){return H.resolve()}for(var j=0;j<k.forages.length;j++){var q=k.forages[j];q!==E&&S.push(q._initReady().catch(M))}var Y=k.forages.slice(0);return H.all(S).then(function(){return g.db=k.db,St(g)}).then(function(z){return g.db=z,mt(g,E._defaultConfig.version)?wr(g):z}).then(function(z){g.db=k.db=z,E._dbInfo=g;for(var ne=0;ne<Y.length;ne++){var xe=Y[ne];xe!==E&&(xe._dbInfo.db=g.db,xe._dbInfo.version=g.version)}})}function ze(p,E){var g=this;p=ce(p);var A=new H(function(k,S){g.ready().then(function(){vt(g._dbInfo,He,function(M,j){if(M)return S(M);try{var q=j.objectStore(g._dbInfo.storeName),Y=q.get(p);Y.onsuccess=function(){var z=Y.result;z===void 0&&(z=null),Kr(z)&&(z=gt(z)),k(z)},Y.onerror=function(){S(Y.error)}}catch(z){S(z)}})}).catch(S)});return U(A,E),A}function _r(p,E){var g=this,A=new H(function(k,S){g.ready().then(function(){vt(g._dbInfo,He,function(M,j){if(M)return S(M);try{var q=j.objectStore(g._dbInfo.storeName),Y=q.openCursor(),z=1;Y.onsuccess=function(){var ne=Y.result;if(ne){var xe=ne.value;Kr(xe)&&(xe=gt(xe));var Ie=p(xe,ne.key,z++);Ie!==void 0?k(Ie):ne.continue()}else k()},Y.onerror=function(){S(Y.error)}}catch(ne){S(ne)}})}).catch(S)});return U(A,E),A}function ei(p,E,g){var A=this;p=ce(p);var k=new H(function(S,M){var j;A.ready().then(function(){return j=A._dbInfo,de.call(E)==="[object Blob]"?De(j.db).then(function(q){return q?E:Er(E)}):E}).then(function(q){vt(A._dbInfo,s,function(Y,z){if(Y)return M(Y);try{var ne=z.objectStore(A._dbInfo.storeName);q===null&&(q=void 0);var xe=ne.put(q,p);z.oncomplete=function(){q===void 0&&(q=null),S(q)},z.onabort=z.onerror=function(){var Ie=xe.error?xe.error:xe.transaction.error;M(Ie)}}catch(Ie){M(Ie)}})}).catch(M)});return U(k,g),k}function ti(p,E){var g=this;p=ce(p);var A=new H(function(k,S){g.ready().then(function(){vt(g._dbInfo,s,function(M,j){if(M)return S(M);try{var q=j.objectStore(g._dbInfo.storeName),Y=q.delete(p);j.oncomplete=function(){k()},j.onerror=function(){S(Y.error)},j.onabort=function(){var z=Y.error?Y.error:Y.transaction.error;S(z)}}catch(z){S(z)}})}).catch(S)});return U(A,E),A}function bt(p){var E=this,g=new H(function(A,k){E.ready().then(function(){vt(E._dbInfo,s,function(S,M){if(S)return k(S);try{var j=M.objectStore(E._dbInfo.storeName),q=j.clear();M.oncomplete=function(){A()},M.onabort=M.onerror=function(){var Y=q.error?q.error:q.transaction.error;k(Y)}}catch(Y){k(Y)}})}).catch(k)});return U(g,p),g}function Pi(p){var E=this,g=new H(function(A,k){E.ready().then(function(){vt(E._dbInfo,He,function(S,M){if(S)return k(S);try{var j=M.objectStore(E._dbInfo.storeName),q=j.count();q.onsuccess=function(){A(q.result)},q.onerror=function(){k(q.error)}}catch(Y){k(Y)}})}).catch(k)});return U(g,p),g}function Jt(p,E){var g=this,A=new H(function(k,S){if(p<0){k(null);return}g.ready().then(function(){vt(g._dbInfo,He,function(M,j){if(M)return S(M);try{var q=j.objectStore(g._dbInfo.storeName),Y=!1,z=q.openKeyCursor();z.onsuccess=function(){var ne=z.result;if(!ne){k(null);return}p===0||Y?k(ne.key):(Y=!0,ne.advance(p))},z.onerror=function(){S(z.error)}}catch(ne){S(ne)}})}).catch(S)});return U(A,E),A}function Ut(p){var E=this,g=new H(function(A,k){E.ready().then(function(){vt(E._dbInfo,He,function(S,M){if(S)return k(S);try{var j=M.objectStore(E._dbInfo.storeName),q=j.openKeyCursor(),Y=[];q.onsuccess=function(){var z=q.result;if(!z){A(Y);return}Y.push(z.key),z.continue()},q.onerror=function(){k(q.error)}}catch(z){k(z)}})}).catch(k)});return U(g,p),g}function Nr(p,E){E=Q.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var A=this,k;if(!p.name)k=H.reject("Invalid arguments");else{var S=p.name===g.name&&A._dbInfo.db,M=S?H.resolve(A._dbInfo.db):St(p).then(function(j){var q=he[p.name],Y=q.forages;q.db=j;for(var z=0;z<Y.length;z++)Y[z]._dbInfo.db=j;return j});p.storeName?k=M.then(function(j){if(!!j.objectStoreNames.contains(p.storeName)){var q=j.version+1;et(p);var Y=he[p.name],z=Y.forages;j.close();for(var ne=0;ne<z.length;ne++){var xe=z[ne];xe._dbInfo.db=null,xe._dbInfo.version=q}var Ie=new H(function(Oe,$e){var Ue=D.open(p.name,q);Ue.onerror=function(Et){var fi=Ue.result;fi.close(),$e(Et)},Ue.onupgradeneeded=function(){var Et=Ue.result;Et.deleteObjectStore(p.storeName)},Ue.onsuccess=function(){var Et=Ue.result;Et.close(),Oe(Et)}});return Ie.then(function(Oe){Y.db=Oe;for(var $e=0;$e<z.length;$e++){var Ue=z[$e];Ue._dbInfo.db=Oe,Me(Ue._dbInfo)}}).catch(function(Oe){throw(ve(p,Oe)||H.resolve()).catch(function(){}),Oe})}}):k=M.then(function(j){et(p);var q=he[p.name],Y=q.forages;j.close();for(var z=0;z<Y.length;z++){var ne=Y[z];ne._dbInfo.db=null}var xe=new H(function(Ie,Oe){var $e=D.deleteDatabase(p.name);$e.onerror=function(){var Ue=$e.result;Ue&&Ue.close(),Oe($e.error)},$e.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},$e.onsuccess=function(){var Ue=$e.result;Ue&&Ue.close(),Ie(Ue)}});return xe.then(function(Ie){q.db=Ie;for(var Oe=0;Oe<Y.length;Oe++){var $e=Y[Oe];Me($e._dbInfo)}}).catch(function(Ie){throw(ve(p,Ie)||H.resolve()).catch(function(){}),Ie})})}return U(k,E),k}var Kt={_driver:"asyncStorage",_initStorage:Ci,_support:W(),iterate:_r,getItem:ze,setItem:ei,removeItem:ti,clear:bt,length:Pi,key:Jt,keys:Ut,dropInstance:Nr};function Tr(){return typeof openDatabase=="function"}var ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot="~~local_forage_type~",Sr=/^~~local_forage_type~([^~]+)~/,Zt="__lfsc__:",Ur=Zt.length,ct="arbf",er="blob",Bt="si08",te="ui08",Ge="uic8",tr="si16",ri="si32",ii="ur16",Wr="ui32",Ar="fl32",rr="fl64",ft=Ur+ct.length,At=Object.prototype.toString;function nt(p){var E=p.length*.75,g=p.length,A,k=0,S,M,j,q;p[p.length-1]==="="&&(E--,p[p.length-2]==="="&&E--);var Y=new ArrayBuffer(E),z=new Uint8Array(Y);for(A=0;A<g;A+=4)S=ut.indexOf(p[A]),M=ut.indexOf(p[A+1]),j=ut.indexOf(p[A+2]),q=ut.indexOf(p[A+3]),z[k++]=S<<2|M>>4,z[k++]=(M&15)<<4|j>>2,z[k++]=(j&3)<<6|q&63;return Y}function jt(p){var E=new Uint8Array(p),g="",A;for(A=0;A<E.length;A+=3)g+=ut[E[A]>>2],g+=ut[(E[A]&3)<<4|E[A+1]>>4],g+=ut[(E[A+1]&15)<<2|E[A+2]>>6],g+=ut[E[A+2]&63];return E.length%3==2?g=g.substring(0,g.length-1)+"=":E.length%3==1&&(g=g.substring(0,g.length-2)+"=="),g}function fr(p,E){var g="";if(p&&(g=At.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&At.call(p.buffer)==="[object ArrayBuffer]")){var A,k=Zt;p instanceof ArrayBuffer?(A=p,k+=ct):(A=p.buffer,g==="[object Int8Array]"?k+=Bt:g==="[object Uint8Array]"?k+=te:g==="[object Uint8ClampedArray]"?k+=Ge:g==="[object Int16Array]"?k+=tr:g==="[object Uint16Array]"?k+=ii:g==="[object Int32Array]"?k+=ri:g==="[object Uint32Array]"?k+=Wr:g==="[object Float32Array]"?k+=Ar:g==="[object Float64Array]"?k+=rr:E(new Error("Failed to get type for BinaryArray"))),E(k+jt(A))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=ot+p.type+"~"+jt(this.result);E(Zt+er+M)},S.readAsArrayBuffer(p)}else try{E(JSON.stringify(p))}catch(M){console.error("Couldn't convert value into a JSON string: ",p),E(null,M)}}function $r(p){if(p.substring(0,Ur)!==Zt)return JSON.parse(p);var E=p.substring(ft),g=p.substring(Ur,ft),A;if(g===er&&Sr.test(E)){var k=E.match(Sr);A=k[1],E=E.substring(k[0].length)}var S=nt(E);switch(g){case ct:return S;case er:return le([S],{type:A});case Bt:return new Int8Array(S);case te:return new Uint8Array(S);case Ge:return new Uint8ClampedArray(S);case tr:return new Int16Array(S);case ii:return new Uint16Array(S);case ri:return new Int32Array(S);case Wr:return new Uint32Array(S);case Ar:return new Float32Array(S);case rr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Hr={serialize:fr,deserialize:$r,stringToBuffer:nt,bufferToString:jt};function Cr(p,E,g,A){p.executeSql("CREATE TABLE IF NOT EXISTS "+E.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,A)}function Wt(p){var E=this,g={db:null};if(p)for(var A in p)g[A]=typeof p[A]!="string"?p[A].toString():p[A];var k=new H(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(j){return M(j)}g.db.transaction(function(j){Cr(j,g,function(){E._dbInfo=g,S()},function(q,Y){M(Y)})},M)});return g.serializer=Hr,k}function yt(p,E,g,A,k,S){p.executeSql(g,A,k,function(M,j){j.code===j.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[E.storeName],function(q,Y){Y.rows.length?S(q,j):Cr(q,E,function(){q.executeSql(g,A,k,S)},S)},S):S(M,j)},S)}function dr(p,E){var g=this;p=ce(p);var A=new H(function(k,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(j){yt(j,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[p],function(q,Y){var z=Y.rows.length?Y.rows.item(0).value:null;z&&(z=M.serializer.deserialize(z)),k(z)},function(q,Y){S(Y)})})}).catch(S)});return U(A,E),A}function ki(p,E){var g=this,A=new H(function(k,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(j){yt(j,M,"SELECT * FROM "+M.storeName,[],function(q,Y){for(var z=Y.rows,ne=z.length,xe=0;xe<ne;xe++){var Ie=z.item(xe),Oe=Ie.value;if(Oe&&(Oe=M.serializer.deserialize(Oe)),Oe=p(Oe,Ie.key,xe+1),Oe!==void 0){k(Oe);return}}k()},function(q,Y){S(Y)})})}).catch(S)});return U(A,E),A}function dt(p,E,g,A){var k=this;p=ce(p);var S=new H(function(M,j){k.ready().then(function(){E===void 0&&(E=null);var q=E,Y=k._dbInfo;Y.serializer.serialize(E,function(z,ne){ne?j(ne):Y.db.transaction(function(xe){yt(xe,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[p,z],function(){M(q)},function(Ie,Oe){j(Oe)})},function(xe){if(xe.code===xe.QUOTA_ERR){if(A>0){M(dt.apply(k,[p,q,g,A-1]));return}j(xe)}})})}).catch(j)});return U(S,g),S}function Pe(p,E,g){return dt.apply(this,[p,E,g,1])}function zt(p,E){var g=this;p=ce(p);var A=new H(function(k,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(j){yt(j,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[p],function(){k()},function(q,Y){S(Y)})})}).catch(S)});return U(A,E),A}function $i(p){var E=this,g=new H(function(A,k){E.ready().then(function(){var S=E._dbInfo;S.db.transaction(function(M){yt(M,S,"DELETE FROM "+S.storeName,[],function(){A()},function(j,q){k(q)})})}).catch(k)});return U(g,p),g}function ni(p){var E=this,g=new H(function(A,k){E.ready().then(function(){var S=E._dbInfo;S.db.transaction(function(M){yt(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(j,q){var Y=q.rows.item(0).c;A(Y)},function(j,q){k(q)})})}).catch(k)});return U(g,p),g}function Br(p,E){var g=this,A=new H(function(k,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(j){yt(j,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[p+1],function(q,Y){var z=Y.rows.length?Y.rows.item(0).key:null;k(z)},function(q,Y){S(Y)})})}).catch(S)});return U(A,E),A}function ir(p){var E=this,g=new H(function(A,k){E.ready().then(function(){var S=E._dbInfo;S.db.transaction(function(M){yt(M,S,"SELECT key FROM "+S.storeName,[],function(j,q){for(var Y=[],z=0;z<q.rows.length;z++)Y.push(q.rows.item(z).key);A(Y)},function(j,q){k(q)})})}).catch(k)});return U(g,p),g}function nr(p){return new H(function(E,g){p.transaction(function(A){A.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(k,S){for(var M=[],j=0;j<S.rows.length;j++)M.push(S.rows.item(j).name);E({db:p,storeNames:M})},function(k,S){g(S)})},function(A){g(A)})})}function ai(p,E){E=Q.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var A=this,k;return p.name?k=new H(function(S){var M;p.name===g.name?M=A._dbInfo.db:M=openDatabase(p.name,"","",0),p.storeName?S({db:M,storeNames:[p.storeName]}):S(nr(M))}).then(function(S){return new H(function(M,j){S.db.transaction(function(q){function Y(Ie){return new H(function(Oe,$e){q.executeSql("DROP TABLE IF EXISTS "+Ie,[],function(){Oe()},function(Ue,Et){$e(Et)})})}for(var z=[],ne=0,xe=S.storeNames.length;ne<xe;ne++)z.push(Y(S.storeNames[ne]));H.all(z).then(function(){M()}).catch(function(Ie){j(Ie)})},function(q){j(q)})})}):k=H.reject("Invalid arguments"),U(k,E),k}var ht={_driver:"webSQLStorage",_initStorage:Wt,_support:Tr(),iterate:ki,getItem:dr,setItem:Pe,removeItem:zt,clear:$i,length:ni,key:Br,keys:ir,dropInstance:ai};function jr(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(p){return!1}}function si(p,E){var g=p.name+"/";return p.storeName!==E.storeName&&(g+=p.storeName+"/"),g}function Di(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch(E){return!0}}function zr(){return!Di()||localStorage.length>0}function Ri(p){var E=this,g={};if(p)for(var A in p)g[A]=p[A];return g.keyPrefix=si(p,E._defaultConfig),zr()?(E._dbInfo=g,g.serializer=Hr,H.resolve()):H.reject()}function $t(p){var E=this,g=E.ready().then(function(){for(var A=E._dbInfo.keyPrefix,k=localStorage.length-1;k>=0;k--){var S=localStorage.key(k);S.indexOf(A)===0&&localStorage.removeItem(S)}});return U(g,p),g}function oi(p,E){var g=this;p=ce(p);var A=g.ready().then(function(){var k=g._dbInfo,S=localStorage.getItem(k.keyPrefix+p);return S&&(S=k.serializer.deserialize(S)),S});return U(A,E),A}function Li(p,E){var g=this,A=g.ready().then(function(){for(var k=g._dbInfo,S=k.keyPrefix,M=S.length,j=localStorage.length,q=1,Y=0;Y<j;Y++){var z=localStorage.key(Y);if(z.indexOf(S)===0){var ne=localStorage.getItem(z);if(ne&&(ne=k.serializer.deserialize(ne)),ne=p(ne,z.substring(M),q++),ne!==void 0)return ne}}});return U(A,E),A}function ar(p,E){var g=this,A=g.ready().then(function(){var k=g._dbInfo,S;try{S=localStorage.key(p)}catch(M){S=null}return S&&(S=S.substring(k.keyPrefix.length)),S});return U(A,E),A}function li(p){var E=this,g=E.ready().then(function(){for(var A=E._dbInfo,k=localStorage.length,S=[],M=0;M<k;M++){var j=localStorage.key(M);j.indexOf(A.keyPrefix)===0&&S.push(j.substring(A.keyPrefix.length))}return S});return U(g,p),g}function ui(p){var E=this,g=E.keys().then(function(A){return A.length});return U(g,p),g}function ae(p,E){var g=this;p=ce(p);var A=g.ready().then(function(){var k=g._dbInfo;localStorage.removeItem(k.keyPrefix+p)});return U(A,E),A}function T(p,E,g){var A=this;p=ce(p);var k=A.ready().then(function(){E===void 0&&(E=null);var S=E;return new H(function(M,j){var q=A._dbInfo;q.serializer.serialize(E,function(Y,z){if(z)j(z);else try{localStorage.setItem(q.keyPrefix+p,Y),M(S)}catch(ne){(ne.name==="QuotaExceededError"||ne.name==="NS_ERROR_DOM_QUOTA_REACHED")&&j(ne),j(ne)}})})});return U(k,g),k}function V(p,E){if(E=Q.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var A=this,k;return p.name?k=new H(function(S){p.storeName?S(si(p,A._defaultConfig)):S(p.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var j=localStorage.key(M);j.indexOf(S)===0&&localStorage.removeItem(j)}}):k=H.reject("Invalid arguments"),U(k,E),k}var ie={_driver:"localStorageWrapper",_initStorage:Ri,_support:jr(),iterate:Li,getItem:oi,setItem:T,removeItem:ae,clear:$t,length:ui,key:ar,keys:li,dropInstance:V},Fe=function(E,g){return E===g||typeof E=="number"&&typeof g=="number"&&isNaN(E)&&isNaN(g)},tt=function(E,g){for(var A=E.length,k=0;k<A;){if(Fe(E[k],g))return!0;k++}return!1},Ye=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Xe={},xt={},It={INDEXEDDB:Kt,WEBSQL:ht,LOCALSTORAGE:ie},rt=[It.INDEXEDDB._driver,It.WEBSQL._driver,It.LOCALSTORAGE._driver],Pr=["dropInstance"],Gr=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Pr),yn={description:"",driver:rt.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function xn(p,E){p[E]=function(){var g=arguments;return p.ready().then(function(){return p[E].apply(p,g)})}}function ci(){for(var p=1;p<arguments.length;p++){var E=arguments[p];if(E)for(var g in E)E.hasOwnProperty(g)&&(Ye(E[g])?arguments[0][g]=E[g].slice():arguments[0][g]=E[g])}return arguments[0]}var wn=function(){function p(E){y(this,p);for(var g in It)if(It.hasOwnProperty(g)){var A=It[g],k=A._driver;this[g]=k,Xe[k]||this.defineDriver(A)}this._defaultConfig=ci({},yn),this._config=ci({},this._defaultConfig,E),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g=="undefined"?"undefined":m(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var A in g){if(A==="storeName"&&(g[A]=g[A].replace(/\W/g,"_")),A==="version"&&typeof g[A]!="number")return new Error("Database version must be a number.");this._config[A]=g[A]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,A,k){var S=new H(function(M,j){try{var q=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){j(Y);return}for(var z=Gr.concat("_initStorage"),ne=0,xe=z.length;ne<xe;ne++){var Ie=z[ne],Oe=!tt(Pr,Ie);if((Oe||g[Ie])&&typeof g[Ie]!="function"){j(Y);return}}var $e=function(){for(var fi=function(_n){return function(){var la=new Error("Method "+_n+" is not implemented by the current driver"),Hi=H.reject(la);return U(Hi,arguments[arguments.length-1]),Hi}},kr=0,En=Pr.length;kr<En;kr++){var di=Pr[kr];g[di]||(g[di]=fi(di))}};$e();var Ue=function(fi){Xe[q]&&console.info("Redefining LocalForage driver: "+q),Xe[q]=g,xt[q]=fi,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ue,j):Ue(!!g._support):Ue(!0)}catch(Et){j(Et)}});return B(S,A,k),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,A,k){var S=Xe[g]?H.resolve(Xe[g]):H.reject(new Error("Driver not found."));return B(S,A,k),S},p.prototype.getSerializer=function(g){var A=H.resolve(Hr);return B(A,g),A},p.prototype.ready=function(g){var A=this,k=A._driverSet.then(function(){return A._ready===null&&(A._ready=A._initDriver()),A._ready});return B(k,g,g),k},p.prototype.setDriver=function(g,A,k){var S=this;Ye(g)||(g=[g]);var M=this._getSupportedDrivers(g);function j(){S._config.driver=S.driver()}function q(ne){return S._extend(ne),j(),S._ready=S._initStorage(S._config),S._ready}function Y(ne){return function(){var xe=0;function Ie(){for(;xe<ne.length;){var Oe=ne[xe];return xe++,S._dbInfo=null,S._ready=null,S.getDriver(Oe).then(q).catch(Ie)}j();var $e=new Error("No available storage method found.");return S._driverSet=H.reject($e),S._driverSet}return Ie()}}var z=this._driverSet!==null?this._driverSet.catch(function(){return H.resolve()}):H.resolve();return this._driverSet=z.then(function(){var ne=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(ne).then(function(xe){S._driver=xe._driver,j(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){j();var ne=new Error("No available storage method found.");return S._driverSet=H.reject(ne),S._driverSet}),B(this._driverSet,A,k),this._driverSet},p.prototype.supports=function(g){return!!xt[g]},p.prototype._extend=function(g){ci(this,g)},p.prototype._getSupportedDrivers=function(g){for(var A=[],k=0,S=g.length;k<S;k++){var M=g[k];this.supports(M)&&A.push(M)}return A},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,A=Gr.length;g<A;g++)xn(this,Gr[g])},p.prototype.createInstance=function(g){return new p(g)},p}(),wt=new wn;u.exports=wt},{"3":3}]},{},[4])(4)})});var to=Ea((eo,Un)=>{(function(l,t){"use strict";typeof Un=="object"&&typeof Un.exports=="object"?Un.exports=l.document?t(l,!0):function(r){if(!r.document)throw new Error("jQuery requires a window with a document");return t(r)}:t(l)})(typeof window!="undefined"?window:eo,function(l,t){"use strict";var r=[],a=Object.getPrototypeOf,u=r.slice,d=r.flat?function(e){return r.flat.call(e)}:function(e){return r.concat.apply([],e)},m=r.push,y=r.indexOf,b={},D=b.toString,W=b.hasOwnProperty,le=W.toString,H=le.call(Object),U={},B=function(i){return typeof i=="function"&&typeof i.nodeType!="number"&&typeof i.item!="function"},ce=function(i){return i!=null&&i===i.window},Q=l.document,we={type:!0,src:!0,nonce:!0,noModule:!0};function ke(e,i,n){n=n||Q;var o,c,f=n.createElement("script");if(f.text=e,i)for(o in we)c=i[o]||i.getAttribute&&i.getAttribute(o),c&&f.setAttribute(o,c);n.head.appendChild(f).parentNode.removeChild(f)}function he(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?b[D.call(e)]||"object":typeof e}var de="3.7.1",He=/HTML$/i,s=function(e,i){return new s.fn.init(e,i)};s.fn=s.prototype={jquery:de,constructor:s,length:0,toArray:function(){return u.call(this)},get:function(e){return e==null?u.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var i=s.merge(this.constructor(),e);return i.prevObject=this,i},each:function(e){return s.each(this,e)},map:function(e){return this.pushStack(s.map(this,function(i,n){return e.call(i,n,i)}))},slice:function(){return this.pushStack(u.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(s.grep(this,function(e,i){return(i+1)%2}))},odd:function(){return this.pushStack(s.grep(this,function(e,i){return i%2}))},eq:function(e){var i=this.length,n=+e+(e<0?i:0);return this.pushStack(n>=0&&n<i?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:m,sort:r.sort,splice:r.splice},s.extend=s.fn.extend=function(){var e,i,n,o,c,f,h=arguments[0]||{},w=1,x=arguments.length,C=!1;for(typeof h=="boolean"&&(C=h,h=arguments[w]||{},w++),typeof h!="object"&&!B(h)&&(h={}),w===x&&(h=this,w--);w<x;w++)if((e=arguments[w])!=null)for(i in e)o=e[i],!(i==="__proto__"||h===o)&&(C&&o&&(s.isPlainObject(o)||(c=Array.isArray(o)))?(n=h[i],c&&!Array.isArray(n)?f=[]:!c&&!s.isPlainObject(n)?f={}:f=n,c=!1,h[i]=s.extend(C,f,o)):o!==void 0&&(h[i]=o));return h},s.extend({expando:"jQuery"+(de+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var i,n;return!e||D.call(e)!=="[object Object]"?!1:(i=a(e),i?(n=W.call(i,"constructor")&&i.constructor,typeof n=="function"&&le.call(n)===H):!0)},isEmptyObject:function(e){var i;for(i in e)return!1;return!0},globalEval:function(e,i,n){ke(e,{nonce:i&&i.nonce},n)},each:function(e,i){var n,o=0;if(ue(e))for(n=e.length;o<n&&i.call(e[o],o,e[o])!==!1;o++);else for(o in e)if(i.call(e[o],o,e[o])===!1)break;return e},text:function(e){var i,n="",o=0,c=e.nodeType;if(!c)for(;i=e[o++];)n+=s.text(i);return c===1||c===11?e.textContent:c===9?e.documentElement.textContent:c===3||c===4?e.nodeValue:n},makeArray:function(e,i){var n=i||[];return e!=null&&(ue(Object(e))?s.merge(n,typeof e=="string"?[e]:e):m.call(n,e)),n},inArray:function(e,i,n){return i==null?-1:y.call(i,e,n)},isXMLDoc:function(e){var i=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!He.test(i||n&&n.nodeName||"HTML")},merge:function(e,i){for(var n=+i.length,o=0,c=e.length;o<n;o++)e[c++]=i[o];return e.length=c,e},grep:function(e,i,n){for(var o,c=[],f=0,h=e.length,w=!n;f<h;f++)o=!i(e[f],f),o!==w&&c.push(e[f]);return c},map:function(e,i,n){var o,c,f=0,h=[];if(ue(e))for(o=e.length;f<o;f++)c=i(e[f],f,n),c!=null&&h.push(c);else for(f in e)c=i(e[f],f,n),c!=null&&h.push(c);return d(h)},guid:1,support:U}),typeof Symbol=="function"&&(s.fn[Symbol.iterator]=r[Symbol.iterator]),s.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,i){b["[object "+i+"]"]=i.toLowerCase()});function ue(e){var i=!!e&&"length"in e&&e.length,n=he(e);return B(e)||ce(e)?!1:n==="array"||i===0||typeof i=="number"&&i>0&&i-1 in e}function J(e,i){return e.nodeName&&e.nodeName.toLowerCase()===i.toLowerCase()}var De=r.pop,et=r.sort,Me=r.splice,ve="[\\x20\\t\\r\\n\\f]",Qe=new RegExp("^"+ve+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ve+"+$","g");s.contains=function(e,i){var n=i&&i.parentNode;return e===n||!!(n&&n.nodeType===1&&(e.contains?e.contains(n):e.compareDocumentPosition&&e.compareDocumentPosition(n)&16))};var St=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function wr(e,i){return i?e==="\0"?"\uFFFD":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}s.escapeSelector=function(e){return(e+"").replace(St,wr)};var mt=Q,Er=m;(function(){var e,i,n,o,c,f=Er,h,w,x,C,I,N=s.expando,L=0,G=0,ge=Tn(),Re=Tn(),Ee=Tn(),pt=Tn(),at=function(v,_){return v===_&&(c=!0),0},hr="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",pr="(?:\\\\[\\da-fA-F]{1,6}"+ve+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",Ce="\\["+ve+"*("+pr+")(?:"+ve+"*([*^$|!~]?=)"+ve+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+pr+"))|)"+ve+"*\\]",hi=":("+pr+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+Ce+")*)|.*)\\)|)",Le=new RegExp(ve+"+","g"),Je=new RegExp("^"+ve+"*,"+ve+"*"),ji=new RegExp("^"+ve+"*([>+~]|"+ve+")"+ve+"*"),pa=new RegExp(ve+"|>"),mr=new RegExp(hi),zi=new RegExp("^"+pr+"$"),gr={ID:new RegExp("^#("+pr+")"),CLASS:new RegExp("^\\.("+pr+")"),TAG:new RegExp("^("+pr+"|[*])"),ATTR:new RegExp("^"+Ce),PSEUDO:new RegExp("^"+hi),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ve+"*(even|odd|(([+-]|)(\\d*)n|)"+ve+"*(?:([+-]|)"+ve+"*(\\d+)|))"+ve+"*\\)|)","i"),bool:new RegExp("^(?:"+hr+")$","i"),needsContext:new RegExp("^"+ve+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ve+"*((?:-\\d)?\\d*)"+ve+"*\\)|)(?=[^-]|$)","i")},Vr=/^(?:input|select|textarea|button)$/i,qr=/^h\d$/i,Gt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ma=/[+~]/,Dr=new RegExp("\\\\[\\da-fA-F]{1,6}"+ve+"?|\\\\([^\\r\\n\\f])","g"),Rr=function(v,_){var R="0x"+v.slice(1)-65536;return _||(R<0?String.fromCharCode(R+65536):String.fromCharCode(R>>10|55296,R&1023|56320))},$l=function(){Yr()},Hl=An(function(v){return v.disabled===!0&&J(v,"fieldset")},{dir:"parentNode",next:"legend"});function Bl(){try{return h.activeElement}catch(v){}}try{f.apply(r=u.call(mt.childNodes),mt.childNodes),r[mt.childNodes.length].nodeType}catch(v){f={apply:function(_,R){Er.apply(_,u.call(R))},call:function(_){Er.apply(_,u.call(arguments,1))}}}function We(v,_,R,F){var O,X,K,se,Z,Te,pe,be=_&&_.ownerDocument,Se=_?_.nodeType:9;if(R=R||[],typeof v!="string"||!v||Se!==1&&Se!==9&&Se!==11)return R;if(!F&&(Yr(_),_=_||h,x)){if(Se!==11&&(Z=Gt.exec(v)))if(O=Z[1]){if(Se===9)if(K=_.getElementById(O)){if(K.id===O)return f.call(R,K),R}else return R;else if(be&&(K=be.getElementById(O))&&We.contains(_,K)&&K.id===O)return f.call(R,K),R}else{if(Z[2])return f.apply(R,_.getElementsByTagName(v)),R;if((O=Z[3])&&_.getElementsByClassName)return f.apply(R,_.getElementsByClassName(O)),R}if(!pt[v+" "]&&(!C||!C.test(v))){if(pe=v,be=_,Se===1&&(pa.test(v)||ji.test(v))){for(be=ma.test(v)&&va(_.parentNode)||_,(be!=_||!U.scope)&&((se=_.getAttribute("id"))?se=s.escapeSelector(se):_.setAttribute("id",se=N)),Te=Gi(v),X=Te.length;X--;)Te[X]=(se?"#"+se:":scope")+" "+Sn(Te[X]);pe=Te.join(",")}try{return f.apply(R,be.querySelectorAll(pe)),R}catch(fe){pt(v,!0)}finally{se===N&&_.removeAttribute("id")}}}return Ns(v.replace(Qe,"$1"),_,R,F)}function Tn(){var v=[];function _(R,F){return v.push(R+" ")>i.cacheLength&&delete _[v.shift()],_[R+" "]=F}return _}function sr(v){return v[N]=!0,v}function Fi(v){var _=h.createElement("fieldset");try{return!!v(_)}catch(R){return!1}finally{_.parentNode&&_.parentNode.removeChild(_),_=null}}function jl(v){return function(_){return J(_,"input")&&_.type===v}}function zl(v){return function(_){return(J(_,"input")||J(_,"button"))&&_.type===v}}function Ms(v){return function(_){return"form"in _?_.parentNode&&_.disabled===!1?"label"in _?"label"in _.parentNode?_.parentNode.disabled===v:_.disabled===v:_.isDisabled===v||_.isDisabled!==!v&&Hl(_)===v:_.disabled===v:"label"in _?_.disabled===v:!1}}function pi(v){return sr(function(_){return _=+_,sr(function(R,F){for(var O,X=v([],R.length,_),K=X.length;K--;)R[O=X[K]]&&(R[O]=!(F[O]=R[O]))})})}function va(v){return v&&typeof v.getElementsByTagName!="undefined"&&v}function Yr(v){var _,R=v?v.ownerDocument||v:mt;return R==h||R.nodeType!==9||!R.documentElement||(h=R,w=h.documentElement,x=!s.isXMLDoc(h),I=w.matches||w.webkitMatchesSelector||w.msMatchesSelector,w.msMatchesSelector&&mt!=h&&(_=h.defaultView)&&_.top!==_&&_.addEventListener("unload",$l),U.getById=Fi(function(F){return w.appendChild(F).id=s.expando,!h.getElementsByName||!h.getElementsByName(s.expando).length}),U.disconnectedMatch=Fi(function(F){return I.call(F,"*")}),U.scope=Fi(function(){return h.querySelectorAll(":scope")}),U.cssHas=Fi(function(){try{return h.querySelector(":has(*,:jqfake)"),!1}catch(F){return!0}}),U.getById?(i.filter.ID=function(F){var O=F.replace(Dr,Rr);return function(X){return X.getAttribute("id")===O}},i.find.ID=function(F,O){if(typeof O.getElementById!="undefined"&&x){var X=O.getElementById(F);return X?[X]:[]}}):(i.filter.ID=function(F){var O=F.replace(Dr,Rr);return function(X){var K=typeof X.getAttributeNode!="undefined"&&X.getAttributeNode("id");return K&&K.value===O}},i.find.ID=function(F,O){if(typeof O.getElementById!="undefined"&&x){var X,K,se,Z=O.getElementById(F);if(Z){if(X=Z.getAttributeNode("id"),X&&X.value===F)return[Z];for(se=O.getElementsByName(F),K=0;Z=se[K++];)if(X=Z.getAttributeNode("id"),X&&X.value===F)return[Z]}return[]}}),i.find.TAG=function(F,O){return typeof O.getElementsByTagName!="undefined"?O.getElementsByTagName(F):O.querySelectorAll(F)},i.find.CLASS=function(F,O){if(typeof O.getElementsByClassName!="undefined"&&x)return O.getElementsByClassName(F)},C=[],Fi(function(F){var O;w.appendChild(F).innerHTML="<a id='"+N+"' href='' disabled='disabled'></a><select id='"+N+"-\r\\' disabled='disabled'><option selected=''></option></select>",F.querySelectorAll("[selected]").length||C.push("\\["+ve+"*(?:value|"+hr+")"),F.querySelectorAll("[id~="+N+"-]").length||C.push("~="),F.querySelectorAll("a#"+N+"+*").length||C.push(".#.+[+~]"),F.querySelectorAll(":checked").length||C.push(":checked"),O=h.createElement("input"),O.setAttribute("type","hidden"),F.appendChild(O).setAttribute("name","D"),w.appendChild(F).disabled=!0,F.querySelectorAll(":disabled").length!==2&&C.push(":enabled",":disabled"),O=h.createElement("input"),O.setAttribute("name",""),F.appendChild(O),F.querySelectorAll("[name='']").length||C.push("\\["+ve+"*name"+ve+"*="+ve+`*(?:''|"")`)}),U.cssHas||C.push(":has"),C=C.length&&new RegExp(C.join("|")),at=function(F,O){if(F===O)return c=!0,0;var X=!F.compareDocumentPosition-!O.compareDocumentPosition;return X||(X=(F.ownerDocument||F)==(O.ownerDocument||O)?F.compareDocumentPosition(O):1,X&1||!U.sortDetached&&O.compareDocumentPosition(F)===X?F===h||F.ownerDocument==mt&&We.contains(mt,F)?-1:O===h||O.ownerDocument==mt&&We.contains(mt,O)?1:o?y.call(o,F)-y.call(o,O):0:X&4?-1:1)}),h}We.matches=function(v,_){return We(v,null,null,_)},We.matchesSelector=function(v,_){if(Yr(v),x&&!pt[_+" "]&&(!C||!C.test(_)))try{var R=I.call(v,_);if(R||U.disconnectedMatch||v.document&&v.document.nodeType!==11)return R}catch(F){pt(_,!0)}return We(_,h,null,[v]).length>0},We.contains=function(v,_){return(v.ownerDocument||v)!=h&&Yr(v),s.contains(v,_)},We.attr=function(v,_){(v.ownerDocument||v)!=h&&Yr(v);var R=i.attrHandle[_.toLowerCase()],F=R&&W.call(i.attrHandle,_.toLowerCase())?R(v,_,!x):void 0;return F!==void 0?F:v.getAttribute(_)},We.error=function(v){throw new Error("Syntax error, unrecognized expression: "+v)},s.uniqueSort=function(v){var _,R=[],F=0,O=0;if(c=!U.sortStable,o=!U.sortStable&&u.call(v,0),et.call(v,at),c){for(;_=v[O++];)_===v[O]&&(F=R.push(O));for(;F--;)Me.call(v,R[F],1)}return o=null,v},s.fn.uniqueSort=function(){return this.pushStack(s.uniqueSort(u.apply(this)))},i=s.expr={cacheLength:50,createPseudo:sr,match:gr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(v){return v[1]=v[1].replace(Dr,Rr),v[3]=(v[3]||v[4]||v[5]||"").replace(Dr,Rr),v[2]==="~="&&(v[3]=" "+v[3]+" "),v.slice(0,4)},CHILD:function(v){return v[1]=v[1].toLowerCase(),v[1].slice(0,3)==="nth"?(v[3]||We.error(v[0]),v[4]=+(v[4]?v[5]+(v[6]||1):2*(v[3]==="even"||v[3]==="odd")),v[5]=+(v[7]+v[8]||v[3]==="odd")):v[3]&&We.error(v[0]),v},PSEUDO:function(v){var _,R=!v[6]&&v[2];return gr.CHILD.test(v[0])?null:(v[3]?v[2]=v[4]||v[5]||"":R&&mr.test(R)&&(_=Gi(R,!0))&&(_=R.indexOf(")",R.length-_)-R.length)&&(v[0]=v[0].slice(0,_),v[2]=R.slice(0,_)),v.slice(0,3))}},filter:{TAG:function(v){var _=v.replace(Dr,Rr).toLowerCase();return v==="*"?function(){return!0}:function(R){return J(R,_)}},CLASS:function(v){var _=ge[v+" "];return _||(_=new RegExp("(^|"+ve+")"+v+"("+ve+"|$)"))&&ge(v,function(R){return _.test(typeof R.className=="string"&&R.className||typeof R.getAttribute!="undefined"&&R.getAttribute("class")||"")})},ATTR:function(v,_,R){return function(F){var O=We.attr(F,v);return O==null?_==="!=":_?(O+="",_==="="?O===R:_==="!="?O!==R:_==="^="?R&&O.indexOf(R)===0:_==="*="?R&&O.indexOf(R)>-1:_==="$="?R&&O.slice(-R.length)===R:_==="~="?(" "+O.replace(Le," ")+" ").indexOf(R)>-1:_==="|="?O===R||O.slice(0,R.length+1)===R+"-":!1):!0}},CHILD:function(v,_,R,F,O){var X=v.slice(0,3)!=="nth",K=v.slice(-4)!=="last",se=_==="of-type";return F===1&&O===0?function(Z){return!!Z.parentNode}:function(Z,Te,pe){var be,Se,fe,je,Mt,_t=X!==K?"nextSibling":"previousSibling",Vt=Z.parentNode,vr=se&&Z.nodeName.toLowerCase(),Ii=!pe&&!se,Ct=!1;if(Vt){if(X){for(;_t;){for(fe=Z;fe=fe[_t];)if(se?J(fe,vr):fe.nodeType===1)return!1;Mt=_t=v==="only"&&!Mt&&"nextSibling"}return!0}if(Mt=[K?Vt.firstChild:Vt.lastChild],K&&Ii){for(Se=Vt[N]||(Vt[N]={}),be=Se[v]||[],je=be[0]===L&&be[1],Ct=je&&be[2],fe=je&&Vt.childNodes[je];fe=++je&&fe&&fe[_t]||(Ct=je=0)||Mt.pop();)if(fe.nodeType===1&&++Ct&&fe===Z){Se[v]=[L,je,Ct];break}}else if(Ii&&(Se=Z[N]||(Z[N]={}),be=Se[v]||[],je=be[0]===L&&be[1],Ct=je),Ct===!1)for(;(fe=++je&&fe&&fe[_t]||(Ct=je=0)||Mt.pop())&&!((se?J(fe,vr):fe.nodeType===1)&&++Ct&&(Ii&&(Se=fe[N]||(fe[N]={}),Se[v]=[L,Ct]),fe===Z)););return Ct-=O,Ct===F||Ct%F==0&&Ct/F>=0}}},PSEUDO:function(v,_){var R,F=i.pseudos[v]||i.setFilters[v.toLowerCase()]||We.error("unsupported pseudo: "+v);return F[N]?F(_):F.length>1?(R=[v,v,"",_],i.setFilters.hasOwnProperty(v.toLowerCase())?sr(function(O,X){for(var K,se=F(O,_),Z=se.length;Z--;)K=y.call(O,se[Z]),O[K]=!(X[K]=se[Z])}):function(O){return F(O,0,R)}):F}},pseudos:{not:sr(function(v){var _=[],R=[],F=wa(v.replace(Qe,"$1"));return F[N]?sr(function(O,X,K,se){for(var Z,Te=F(O,null,se,[]),pe=O.length;pe--;)(Z=Te[pe])&&(O[pe]=!(X[pe]=Z))}):function(O,X,K){return _[0]=O,F(_,null,K,R),_[0]=null,!R.pop()}}),has:sr(function(v){return function(_){return We(v,_).length>0}}),contains:sr(function(v){return v=v.replace(Dr,Rr),function(_){return(_.textContent||s.text(_)).indexOf(v)>-1}}),lang:sr(function(v){return zi.test(v||"")||We.error("unsupported lang: "+v),v=v.replace(Dr,Rr).toLowerCase(),function(_){var R;do if(R=x?_.lang:_.getAttribute("xml:lang")||_.getAttribute("lang"))return R=R.toLowerCase(),R===v||R.indexOf(v+"-")===0;while((_=_.parentNode)&&_.nodeType===1);return!1}}),target:function(v){var _=l.location&&l.location.hash;return _&&_.slice(1)===v.id},root:function(v){return v===w},focus:function(v){return v===Bl()&&h.hasFocus()&&!!(v.type||v.href||~v.tabIndex)},enabled:Ms(!1),disabled:Ms(!0),checked:function(v){return J(v,"input")&&!!v.checked||J(v,"option")&&!!v.selected},selected:function(v){return v.parentNode&&v.parentNode.selectedIndex,v.selected===!0},empty:function(v){for(v=v.firstChild;v;v=v.nextSibling)if(v.nodeType<6)return!1;return!0},parent:function(v){return!i.pseudos.empty(v)},header:function(v){return qr.test(v.nodeName)},input:function(v){return Vr.test(v.nodeName)},button:function(v){return J(v,"input")&&v.type==="button"||J(v,"button")},text:function(v){var _;return J(v,"input")&&v.type==="text"&&((_=v.getAttribute("type"))==null||_.toLowerCase()==="text")},first:pi(function(){return[0]}),last:pi(function(v,_){return[_-1]}),eq:pi(function(v,_,R){return[R<0?R+_:R]}),even:pi(function(v,_){for(var R=0;R<_;R+=2)v.push(R);return v}),odd:pi(function(v,_){for(var R=1;R<_;R+=2)v.push(R);return v}),lt:pi(function(v,_,R){var F;for(R<0?F=R+_:R>_?F=_:F=R;--F>=0;)v.push(F);return v}),gt:pi(function(v,_,R){for(var F=R<0?R+_:R;++F<_;)v.push(F);return v})}},i.pseudos.nth=i.pseudos.eq;for(e in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[e]=jl(e);for(e in{submit:!0,reset:!0})i.pseudos[e]=zl(e);function Os(){}Os.prototype=i.filters=i.pseudos,i.setFilters=new Os;function Gi(v,_){var R,F,O,X,K,se,Z,Te=Re[v+" "];if(Te)return _?0:Te.slice(0);for(K=v,se=[],Z=i.preFilter;K;){(!R||(F=Je.exec(K)))&&(F&&(K=K.slice(F[0].length)||K),se.push(O=[])),R=!1,(F=ji.exec(K))&&(R=F.shift(),O.push({value:R,type:F[0].replace(Qe," ")}),K=K.slice(R.length));for(X in i.filter)(F=gr[X].exec(K))&&(!Z[X]||(F=Z[X](F)))&&(R=F.shift(),O.push({value:R,type:X,matches:F}),K=K.slice(R.length));if(!R)break}return _?K.length:K?We.error(v):Re(v,se).slice(0)}function Sn(v){for(var _=0,R=v.length,F="";_<R;_++)F+=v[_].value;return F}function An(v,_,R){var F=_.dir,O=_.next,X=O||F,K=R&&X==="parentNode",se=G++;return _.first?function(Z,Te,pe){for(;Z=Z[F];)if(Z.nodeType===1||K)return v(Z,Te,pe);return!1}:function(Z,Te,pe){var be,Se,fe=[L,se];if(pe){for(;Z=Z[F];)if((Z.nodeType===1||K)&&v(Z,Te,pe))return!0}else for(;Z=Z[F];)if(Z.nodeType===1||K)if(Se=Z[N]||(Z[N]={}),O&&J(Z,O))Z=Z[F]||Z;else{if((be=Se[X])&&be[0]===L&&be[1]===se)return fe[2]=be[2];if(Se[X]=fe,fe[2]=v(Z,Te,pe))return!0}return!1}}function ba(v){return v.length>1?function(_,R,F){for(var O=v.length;O--;)if(!v[O](_,R,F))return!1;return!0}:v[0]}function Gl(v,_,R){for(var F=0,O=_.length;F<O;F++)We(v,_[F],R);return R}function Cn(v,_,R,F,O){for(var X,K=[],se=0,Z=v.length,Te=_!=null;se<Z;se++)(X=v[se])&&(!R||R(X,F,O))&&(K.push(X),Te&&_.push(se));return K}function ya(v,_,R,F,O,X){return F&&!F[N]&&(F=ya(F)),O&&!O[N]&&(O=ya(O,X)),sr(function(K,se,Z,Te){var pe,be,Se,fe,je=[],Mt=[],_t=se.length,Vt=K||Gl(_||"*",Z.nodeType?[Z]:Z,[]),vr=v&&(K||!_)?Cn(Vt,je,v,Z,Te):Vt;if(R?(fe=O||(K?v:_t||F)?[]:se,R(vr,fe,Z,Te)):fe=vr,F)for(pe=Cn(fe,Mt),F(pe,[],Z,Te),be=pe.length;be--;)(Se=pe[be])&&(fe[Mt[be]]=!(vr[Mt[be]]=Se));if(K){if(O||v){if(O){for(pe=[],be=fe.length;be--;)(Se=fe[be])&&pe.push(vr[be]=Se);O(null,fe=[],pe,Te)}for(be=fe.length;be--;)(Se=fe[be])&&(pe=O?y.call(K,Se):je[be])>-1&&(K[pe]=!(se[pe]=Se))}}else fe=Cn(fe===se?fe.splice(_t,fe.length):fe),O?O(null,se,fe,Te):f.apply(se,fe)})}function xa(v){for(var _,R,F,O=v.length,X=i.relative[v[0].type],K=X||i.relative[" "],se=X?1:0,Z=An(function(be){return be===_},K,!0),Te=An(function(be){return y.call(_,be)>-1},K,!0),pe=[function(be,Se,fe){var je=!X&&(fe||Se!=n)||((_=Se).nodeType?Z(be,Se,fe):Te(be,Se,fe));return _=null,je}];se<O;se++)if(R=i.relative[v[se].type])pe=[An(ba(pe),R)];else{if(R=i.filter[v[se].type].apply(null,v[se].matches),R[N]){for(F=++se;F<O&&!i.relative[v[F].type];F++);return ya(se>1&&ba(pe),se>1&&Sn(v.slice(0,se-1).concat({value:v[se-2].type===" "?"*":""})).replace(Qe,"$1"),R,se<F&&xa(v.slice(se,F)),F<O&&xa(v=v.slice(F)),F<O&&Sn(v))}pe.push(R)}return ba(pe)}function Vl(v,_){var R=_.length>0,F=v.length>0,O=function(X,K,se,Z,Te){var pe,be,Se,fe=0,je="0",Mt=X&&[],_t=[],Vt=n,vr=X||F&&i.find.TAG("*",Te),Ii=L+=Vt==null?1:Math.random()||.1,Ct=vr.length;for(Te&&(n=K==h||K||Te);je!==Ct&&(pe=vr[je])!=null;je++){if(F&&pe){for(be=0,!K&&pe.ownerDocument!=h&&(Yr(pe),se=!x);Se=v[be++];)if(Se(pe,K||h,se)){f.call(Z,pe);break}Te&&(L=Ii)}R&&((pe=!Se&&pe)&&fe--,X&&Mt.push(pe))}if(fe+=je,R&&je!==fe){for(be=0;Se=_[be++];)Se(Mt,_t,K,se);if(X){if(fe>0)for(;je--;)Mt[je]||_t[je]||(_t[je]=De.call(Z));_t=Cn(_t)}f.apply(Z,_t),Te&&!X&&_t.length>0&&fe+_.length>1&&s.uniqueSort(Z)}return Te&&(L=Ii,n=Vt),Mt};return R?sr(O):O}function wa(v,_){var R,F=[],O=[],X=Ee[v+" "];if(!X){for(_||(_=Gi(v)),R=_.length;R--;)X=xa(_[R]),X[N]?F.push(X):O.push(X);X=Ee(v,Vl(O,F)),X.selector=v}return X}function Ns(v,_,R,F){var O,X,K,se,Z,Te=typeof v=="function"&&v,pe=!F&&Gi(v=Te.selector||v);if(R=R||[],pe.length===1){if(X=pe[0]=pe[0].slice(0),X.length>2&&(K=X[0]).type==="ID"&&_.nodeType===9&&x&&i.relative[X[1].type]){if(_=(i.find.ID(K.matches[0].replace(Dr,Rr),_)||[])[0],_)Te&&(_=_.parentNode);else return R;v=v.slice(X.shift().value.length)}for(O=gr.needsContext.test(v)?0:X.length;O--&&(K=X[O],!i.relative[se=K.type]);)if((Z=i.find[se])&&(F=Z(K.matches[0].replace(Dr,Rr),ma.test(X[0].type)&&va(_.parentNode)||_))){if(X.splice(O,1),v=F.length&&Sn(X),!v)return f.apply(R,F),R;break}}return(Te||wa(v,pe))(F,_,!x,R,!_||ma.test(v)&&va(_.parentNode)||_),R}U.sortStable=N.split("").sort(at).join("")===N,Yr(),U.sortDetached=Fi(function(v){return v.compareDocumentPosition(h.createElement("fieldset"))&1}),s.find=We,s.expr[":"]=s.expr.pseudos,s.unique=s.uniqueSort,We.compile=wa,We.select=Ns,We.setDocument=Yr,We.tokenize=Gi,We.escape=s.escapeSelector,We.getText=s.text,We.isXML=s.isXMLDoc,We.selectors=s.expr,We.support=s.support,We.uniqueSort=s.uniqueSort})();var gt=function(e,i,n){for(var o=[],c=n!==void 0;(e=e[i])&&e.nodeType!==9;)if(e.nodeType===1){if(c&&s(e).is(n))break;o.push(e)}return o},Kr=function(e,i){for(var n=[];e;e=e.nextSibling)e.nodeType===1&&e!==i&&n.push(e);return n},Zr=s.expr.match.needsContext,Ve=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function vt(e,i,n){return B(i)?s.grep(e,function(o,c){return!!i.call(o,c,o)!==n}):i.nodeType?s.grep(e,function(o){return o===i!==n}):typeof i!="string"?s.grep(e,function(o){return y.call(i,o)>-1!==n}):s.filter(i,e,n)}s.filter=function(e,i,n){var o=i[0];return n&&(e=":not("+e+")"),i.length===1&&o.nodeType===1?s.find.matchesSelector(o,e)?[o]:[]:s.find.matches(e,s.grep(i,function(c){return c.nodeType===1}))},s.fn.extend({find:function(e){var i,n,o=this.length,c=this;if(typeof e!="string")return this.pushStack(s(e).filter(function(){for(i=0;i<o;i++)if(s.contains(c[i],this))return!0}));for(n=this.pushStack([]),i=0;i<o;i++)s.find(e,c[i],n);return o>1?s.uniqueSort(n):n},filter:function(e){return this.pushStack(vt(this,e||[],!1))},not:function(e){return this.pushStack(vt(this,e||[],!0))},is:function(e){return!!vt(this,typeof e=="string"&&Zr.test(e)?s(e):e||[],!1).length}});var qe,Ci=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,ze=s.fn.init=function(e,i,n){var o,c;if(!e)return this;if(n=n||qe,typeof e=="string")if(e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?o=[null,e,null]:o=Ci.exec(e),o&&(o[1]||!i))if(o[1]){if(i=i instanceof s?i[0]:i,s.merge(this,s.parseHTML(o[1],i&&i.nodeType?i.ownerDocument||i:Q,!0)),Ve.test(o[1])&&s.isPlainObject(i))for(o in i)B(this[o])?this[o](i[o]):this.attr(o,i[o]);return this}else return c=Q.getElementById(o[2]),c&&(this[0]=c,this.length=1),this;else return!i||i.jquery?(i||n).find(e):this.constructor(i).find(e);else{if(e.nodeType)return this[0]=e,this.length=1,this;if(B(e))return n.ready!==void 0?n.ready(e):e(s)}return s.makeArray(e,this)};ze.prototype=s.fn,qe=s(Q);var _r=/^(?:parents|prev(?:Until|All))/,ei={children:!0,contents:!0,next:!0,prev:!0};s.fn.extend({has:function(e){var i=s(e,this),n=i.length;return this.filter(function(){for(var o=0;o<n;o++)if(s.contains(this,i[o]))return!0})},closest:function(e,i){var n,o=0,c=this.length,f=[],h=typeof e!="string"&&s(e);if(!Zr.test(e)){for(;o<c;o++)for(n=this[o];n&&n!==i;n=n.parentNode)if(n.nodeType<11&&(h?h.index(n)>-1:n.nodeType===1&&s.find.matchesSelector(n,e))){f.push(n);break}}return this.pushStack(f.length>1?s.uniqueSort(f):f)},index:function(e){return e?typeof e=="string"?y.call(s(e),this[0]):y.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,i){return this.pushStack(s.uniqueSort(s.merge(this.get(),s(e,i))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});function ti(e,i){for(;(e=e[i])&&e.nodeType!==1;);return e}s.each({parent:function(e){var i=e.parentNode;return i&&i.nodeType!==11?i:null},parents:function(e){return gt(e,"parentNode")},parentsUntil:function(e,i,n){return gt(e,"parentNode",n)},next:function(e){return ti(e,"nextSibling")},prev:function(e){return ti(e,"previousSibling")},nextAll:function(e){return gt(e,"nextSibling")},prevAll:function(e){return gt(e,"previousSibling")},nextUntil:function(e,i,n){return gt(e,"nextSibling",n)},prevUntil:function(e,i,n){return gt(e,"previousSibling",n)},siblings:function(e){return Kr((e.parentNode||{}).firstChild,e)},children:function(e){return Kr(e.firstChild)},contents:function(e){return e.contentDocument!=null&&a(e.contentDocument)?e.contentDocument:(J(e,"template")&&(e=e.content||e),s.merge([],e.childNodes))}},function(e,i){s.fn[e]=function(n,o){var c=s.map(this,i,n);return e.slice(-5)!=="Until"&&(o=n),o&&typeof o=="string"&&(c=s.filter(o,c)),this.length>1&&(ei[e]||s.uniqueSort(c),_r.test(e)&&c.reverse()),this.pushStack(c)}});var bt=/[^\x20\t\r\n\f]+/g;function Pi(e){var i={};return s.each(e.match(bt)||[],function(n,o){i[o]=!0}),i}s.Callbacks=function(e){e=typeof e=="string"?Pi(e):s.extend({},e);var i,n,o,c,f=[],h=[],w=-1,x=function(){for(c=c||e.once,o=i=!0;h.length;w=-1)for(n=h.shift();++w<f.length;)f[w].apply(n[0],n[1])===!1&&e.stopOnFalse&&(w=f.length,n=!1);e.memory||(n=!1),i=!1,c&&(n?f=[]:f="")},C={add:function(){return f&&(n&&!i&&(w=f.length-1,h.push(n)),function I(N){s.each(N,function(L,G){B(G)?(!e.unique||!C.has(G))&&f.push(G):G&&G.length&&he(G)!=="string"&&I(G)})}(arguments),n&&!i&&x()),this},remove:function(){return s.each(arguments,function(I,N){for(var L;(L=s.inArray(N,f,L))>-1;)f.splice(L,1),L<=w&&w--}),this},has:function(I){return I?s.inArray(I,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return c=h=[],f=n="",this},disabled:function(){return!f},lock:function(){return c=h=[],!n&&!i&&(f=n=""),this},locked:function(){return!!c},fireWith:function(I,N){return c||(N=N||[],N=[I,N.slice?N.slice():N],h.push(N),i||x()),this},fire:function(){return C.fireWith(this,arguments),this},fired:function(){return!!o}};return C};function Jt(e){return e}function Ut(e){throw e}function Nr(e,i,n,o){var c;try{e&&B(c=e.promise)?c.call(e).done(i).fail(n):e&&B(c=e.then)?c.call(e,i,n):i.apply(void 0,[e].slice(o))}catch(f){n.apply(void 0,[f])}}s.extend({Deferred:function(e){var i=[["notify","progress",s.Callbacks("memory"),s.Callbacks("memory"),2],["resolve","done",s.Callbacks("once memory"),s.Callbacks("once memory"),0,"resolved"],["reject","fail",s.Callbacks("once memory"),s.Callbacks("once memory"),1,"rejected"]],n="pending",o={state:function(){return n},always:function(){return c.done(arguments).fail(arguments),this},catch:function(f){return o.then(null,f)},pipe:function(){var f=arguments;return s.Deferred(function(h){s.each(i,function(w,x){var C=B(f[x[4]])&&f[x[4]];c[x[1]](function(){var I=C&&C.apply(this,arguments);I&&B(I.promise)?I.promise().progress(h.notify).done(h.resolve).fail(h.reject):h[x[0]+"With"](this,C?[I]:arguments)})}),f=null}).promise()},then:function(f,h,w){var x=0;function C(I,N,L,G){return function(){var ge=this,Re=arguments,Ee=function(){var at,hr;if(!(I<x)){if(at=L.apply(ge,Re),at===N.promise())throw new TypeError("Thenable self-resolution");hr=at&&(typeof at=="object"||typeof at=="function")&&at.then,B(hr)?G?hr.call(at,C(x,N,Jt,G),C(x,N,Ut,G)):(x++,hr.call(at,C(x,N,Jt,G),C(x,N,Ut,G),C(x,N,Jt,N.notifyWith))):(L!==Jt&&(ge=void 0,Re=[at]),(G||N.resolveWith)(ge,Re))}},pt=G?Ee:function(){try{Ee()}catch(at){s.Deferred.exceptionHook&&s.Deferred.exceptionHook(at,pt.error),I+1>=x&&(L!==Ut&&(ge=void 0,Re=[at]),N.rejectWith(ge,Re))}};I?pt():(s.Deferred.getErrorHook?pt.error=s.Deferred.getErrorHook():s.Deferred.getStackHook&&(pt.error=s.Deferred.getStackHook()),l.setTimeout(pt))}}return s.Deferred(function(I){i[0][3].add(C(0,I,B(w)?w:Jt,I.notifyWith)),i[1][3].add(C(0,I,B(f)?f:Jt)),i[2][3].add(C(0,I,B(h)?h:Ut))}).promise()},promise:function(f){return f!=null?s.extend(f,o):o}},c={};return s.each(i,function(f,h){var w=h[2],x=h[5];o[h[1]]=w.add,x&&w.add(function(){n=x},i[3-f][2].disable,i[3-f][3].disable,i[0][2].lock,i[0][3].lock),w.add(h[3].fire),c[h[0]]=function(){return c[h[0]+"With"](this===c?void 0:this,arguments),this},c[h[0]+"With"]=w.fireWith}),o.promise(c),e&&e.call(c,c),c},when:function(e){var i=arguments.length,n=i,o=Array(n),c=u.call(arguments),f=s.Deferred(),h=function(w){return function(x){o[w]=this,c[w]=arguments.length>1?u.call(arguments):x,--i||f.resolveWith(o,c)}};if(i<=1&&(Nr(e,f.done(h(n)).resolve,f.reject,!i),f.state()==="pending"||B(c[n]&&c[n].then)))return f.then();for(;n--;)Nr(c[n],h(n),f.reject);return f.promise()}});var Kt=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;s.Deferred.exceptionHook=function(e,i){l.console&&l.console.warn&&e&&Kt.test(e.name)&&l.console.warn("jQuery.Deferred exception: "+e.message,e.stack,i)},s.readyException=function(e){l.setTimeout(function(){throw e})};var Tr=s.Deferred();s.fn.ready=function(e){return Tr.then(e).catch(function(i){s.readyException(i)}),this},s.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--s.readyWait:s.isReady)||(s.isReady=!0,!(e!==!0&&--s.readyWait>0)&&Tr.resolveWith(Q,[s]))}}),s.ready.then=Tr.then;function ut(){Q.removeEventListener("DOMContentLoaded",ut),l.removeEventListener("load",ut),s.ready()}Q.readyState==="complete"||Q.readyState!=="loading"&&!Q.documentElement.doScroll?l.setTimeout(s.ready):(Q.addEventListener("DOMContentLoaded",ut),l.addEventListener("load",ut));var ot=function(e,i,n,o,c,f,h){var w=0,x=e.length,C=n==null;if(he(n)==="object"){c=!0;for(w in n)ot(e,i,w,n[w],!0,f,h)}else if(o!==void 0&&(c=!0,B(o)||(h=!0),C&&(h?(i.call(e,o),i=null):(C=i,i=function(I,N,L){return C.call(s(I),L)})),i))for(;w<x;w++)i(e[w],n,h?o:o.call(e[w],w,i(e[w],n)));return c?e:C?i.call(e):x?i(e[0],n):f},Sr=/^-ms-/,Zt=/-([a-z])/g;function Ur(e,i){return i.toUpperCase()}function ct(e){return e.replace(Sr,"ms-").replace(Zt,Ur)}var er=function(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType};function Bt(){this.expando=s.expando+Bt.uid++}Bt.uid=1,Bt.prototype={cache:function(e){var i=e[this.expando];return i||(i={},er(e)&&(e.nodeType?e[this.expando]=i:Object.defineProperty(e,this.expando,{value:i,configurable:!0}))),i},set:function(e,i,n){var o,c=this.cache(e);if(typeof i=="string")c[ct(i)]=n;else for(o in i)c[ct(o)]=i[o];return c},get:function(e,i){return i===void 0?this.cache(e):e[this.expando]&&e[this.expando][ct(i)]},access:function(e,i,n){return i===void 0||i&&typeof i=="string"&&n===void 0?this.get(e,i):(this.set(e,i,n),n!==void 0?n:i)},remove:function(e,i){var n,o=e[this.expando];if(o!==void 0){if(i!==void 0)for(Array.isArray(i)?i=i.map(ct):(i=ct(i),i=i in o?[i]:i.match(bt)||[]),n=i.length;n--;)delete o[i[n]];(i===void 0||s.isEmptyObject(o))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var i=e[this.expando];return i!==void 0&&!s.isEmptyObject(i)}};var te=new Bt,Ge=new Bt,tr=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,ri=/[A-Z]/g;function ii(e){return e==="true"?!0:e==="false"?!1:e==="null"?null:e===+e+""?+e:tr.test(e)?JSON.parse(e):e}function Wr(e,i,n){var o;if(n===void 0&&e.nodeType===1)if(o="data-"+i.replace(ri,"-$&").toLowerCase(),n=e.getAttribute(o),typeof n=="string"){try{n=ii(n)}catch(c){}Ge.set(e,i,n)}else n=void 0;return n}s.extend({hasData:function(e){return Ge.hasData(e)||te.hasData(e)},data:function(e,i,n){return Ge.access(e,i,n)},removeData:function(e,i){Ge.remove(e,i)},_data:function(e,i,n){return te.access(e,i,n)},_removeData:function(e,i){te.remove(e,i)}}),s.fn.extend({data:function(e,i){var n,o,c,f=this[0],h=f&&f.attributes;if(e===void 0){if(this.length&&(c=Ge.get(f),f.nodeType===1&&!te.get(f,"hasDataAttrs"))){for(n=h.length;n--;)h[n]&&(o=h[n].name,o.indexOf("data-")===0&&(o=ct(o.slice(5)),Wr(f,o,c[o])));te.set(f,"hasDataAttrs",!0)}return c}return typeof e=="object"?this.each(function(){Ge.set(this,e)}):ot(this,function(w){var x;if(f&&w===void 0)return x=Ge.get(f,e),x!==void 0||(x=Wr(f,e),x!==void 0)?x:void 0;this.each(function(){Ge.set(this,e,w)})},null,i,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Ge.remove(this,e)})}}),s.extend({queue:function(e,i,n){var o;if(e)return i=(i||"fx")+"queue",o=te.get(e,i),n&&(!o||Array.isArray(n)?o=te.access(e,i,s.makeArray(n)):o.push(n)),o||[]},dequeue:function(e,i){i=i||"fx";var n=s.queue(e,i),o=n.length,c=n.shift(),f=s._queueHooks(e,i),h=function(){s.dequeue(e,i)};c==="inprogress"&&(c=n.shift(),o--),c&&(i==="fx"&&n.unshift("inprogress"),delete f.stop,c.call(e,h,f)),!o&&f&&f.empty.fire()},_queueHooks:function(e,i){var n=i+"queueHooks";return te.get(e,n)||te.access(e,n,{empty:s.Callbacks("once memory").add(function(){te.remove(e,[i+"queue",n])})})}}),s.fn.extend({queue:function(e,i){var n=2;return typeof e!="string"&&(i=e,e="fx",n--),arguments.length<n?s.queue(this[0],e):i===void 0?this:this.each(function(){var o=s.queue(this,e,i);s._queueHooks(this,e),e==="fx"&&o[0]!=="inprogress"&&s.dequeue(this,e)})},dequeue:function(e){return this.each(function(){s.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,i){var n,o=1,c=s.Deferred(),f=this,h=this.length,w=function(){--o||c.resolveWith(f,[f])};for(typeof e!="string"&&(i=e,e=void 0),e=e||"fx";h--;)n=te.get(f[h],e+"queueHooks"),n&&n.empty&&(o++,n.empty.add(w));return w(),c.promise(i)}});var Ar=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,rr=new RegExp("^(?:([+-])=|)("+Ar+")([a-z%]*)$","i"),ft=["Top","Right","Bottom","Left"],At=Q.documentElement,nt=function(e){return s.contains(e.ownerDocument,e)},jt={composed:!0};At.getRootNode&&(nt=function(e){return s.contains(e.ownerDocument,e)||e.getRootNode(jt)===e.ownerDocument});var fr=function(e,i){return e=i||e,e.style.display==="none"||e.style.display===""&&nt(e)&&s.css(e,"display")==="none"};function $r(e,i,n,o){var c,f,h=20,w=o?function(){return o.cur()}:function(){return s.css(e,i,"")},x=w(),C=n&&n[3]||(s.cssNumber[i]?"":"px"),I=e.nodeType&&(s.cssNumber[i]||C!=="px"&&+x)&&rr.exec(s.css(e,i));if(I&&I[3]!==C){for(x=x/2,C=C||I[3],I=+x||1;h--;)s.style(e,i,I+C),(1-f)*(1-(f=w()/x||.5))<=0&&(h=0),I=I/f;I=I*2,s.style(e,i,I+C),n=n||[]}return n&&(I=+I||+x||0,c=n[1]?I+(n[1]+1)*n[2]:+n[2],o&&(o.unit=C,o.start=I,o.end=c)),c}var Hr={};function Cr(e){var i,n=e.ownerDocument,o=e.nodeName,c=Hr[o];return c||(i=n.body.appendChild(n.createElement(o)),c=s.css(i,"display"),i.parentNode.removeChild(i),c==="none"&&(c="block"),Hr[o]=c,c)}function Wt(e,i){for(var n,o,c=[],f=0,h=e.length;f<h;f++)o=e[f],!!o.style&&(n=o.style.display,i?(n==="none"&&(c[f]=te.get(o,"display")||null,c[f]||(o.style.display="")),o.style.display===""&&fr(o)&&(c[f]=Cr(o))):n!=="none"&&(c[f]="none",te.set(o,"display",n)));for(f=0;f<h;f++)c[f]!=null&&(e[f].style.display=c[f]);return e}s.fn.extend({show:function(){return Wt(this,!0)},hide:function(){return Wt(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){fr(this)?s(this).show():s(this).hide()})}});var yt=/^(?:checkbox|radio)$/i,dr=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,ki=/^$|^module$|\/(?:java|ecma)script/i;(function(){var e=Q.createDocumentFragment(),i=e.appendChild(Q.createElement("div")),n=Q.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),i.appendChild(n),U.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,i.innerHTML="<textarea>x</textarea>",U.noCloneChecked=!!i.cloneNode(!0).lastChild.defaultValue,i.innerHTML="<option></option>",U.option=!!i.lastChild})();var dt={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};dt.tbody=dt.tfoot=dt.colgroup=dt.caption=dt.thead,dt.th=dt.td,U.option||(dt.optgroup=dt.option=[1,"<select multiple='multiple'>","</select>"]);function Pe(e,i){var n;return typeof e.getElementsByTagName!="undefined"?n=e.getElementsByTagName(i||"*"):typeof e.querySelectorAll!="undefined"?n=e.querySelectorAll(i||"*"):n=[],i===void 0||i&&J(e,i)?s.merge([e],n):n}function zt(e,i){for(var n=0,o=e.length;n<o;n++)te.set(e[n],"globalEval",!i||te.get(i[n],"globalEval"))}var $i=/<|&#?\w+;/;function ni(e,i,n,o,c){for(var f,h,w,x,C,I,N=i.createDocumentFragment(),L=[],G=0,ge=e.length;G<ge;G++)if(f=e[G],f||f===0)if(he(f)==="object")s.merge(L,f.nodeType?[f]:f);else if(!$i.test(f))L.push(i.createTextNode(f));else{for(h=h||N.appendChild(i.createElement("div")),w=(dr.exec(f)||["",""])[1].toLowerCase(),x=dt[w]||dt._default,h.innerHTML=x[1]+s.htmlPrefilter(f)+x[2],I=x[0];I--;)h=h.lastChild;s.merge(L,h.childNodes),h=N.firstChild,h.textContent=""}for(N.textContent="",G=0;f=L[G++];){if(o&&s.inArray(f,o)>-1){c&&c.push(f);continue}if(C=nt(f),h=Pe(N.appendChild(f),"script"),C&&zt(h),n)for(I=0;f=h[I++];)ki.test(f.type||"")&&n.push(f)}return N}var Br=/^([^.]*)(?:\.(.+)|)/;function ir(){return!0}function nr(){return!1}function ai(e,i,n,o,c,f){var h,w;if(typeof i=="object"){typeof n!="string"&&(o=o||n,n=void 0);for(w in i)ai(e,w,n,o,i[w],f);return e}if(o==null&&c==null?(c=n,o=n=void 0):c==null&&(typeof n=="string"?(c=o,o=void 0):(c=o,o=n,n=void 0)),c===!1)c=nr;else if(!c)return e;return f===1&&(h=c,c=function(x){return s().off(x),h.apply(this,arguments)},c.guid=h.guid||(h.guid=s.guid++)),e.each(function(){s.event.add(this,i,c,o,n)})}s.event={global:{},add:function(e,i,n,o,c){var f,h,w,x,C,I,N,L,G,ge,Re,Ee=te.get(e);if(!!er(e))for(n.handler&&(f=n,n=f.handler,c=f.selector),c&&s.find.matchesSelector(At,c),n.guid||(n.guid=s.guid++),(x=Ee.events)||(x=Ee.events=Object.create(null)),(h=Ee.handle)||(h=Ee.handle=function(pt){return typeof s!="undefined"&&s.event.triggered!==pt.type?s.event.dispatch.apply(e,arguments):void 0}),i=(i||"").match(bt)||[""],C=i.length;C--;)w=Br.exec(i[C])||[],G=Re=w[1],ge=(w[2]||"").split(".").sort(),!!G&&(N=s.event.special[G]||{},G=(c?N.delegateType:N.bindType)||G,N=s.event.special[G]||{},I=s.extend({type:G,origType:Re,data:o,handler:n,guid:n.guid,selector:c,needsContext:c&&s.expr.match.needsContext.test(c),namespace:ge.join(".")},f),(L=x[G])||(L=x[G]=[],L.delegateCount=0,(!N.setup||N.setup.call(e,o,ge,h)===!1)&&e.addEventListener&&e.addEventListener(G,h)),N.add&&(N.add.call(e,I),I.handler.guid||(I.handler.guid=n.guid)),c?L.splice(L.delegateCount++,0,I):L.push(I),s.event.global[G]=!0)},remove:function(e,i,n,o,c){var f,h,w,x,C,I,N,L,G,ge,Re,Ee=te.hasData(e)&&te.get(e);if(!(!Ee||!(x=Ee.events))){for(i=(i||"").match(bt)||[""],C=i.length;C--;){if(w=Br.exec(i[C])||[],G=Re=w[1],ge=(w[2]||"").split(".").sort(),!G){for(G in x)s.event.remove(e,G+i[C],n,o,!0);continue}for(N=s.event.special[G]||{},G=(o?N.delegateType:N.bindType)||G,L=x[G]||[],w=w[2]&&new RegExp("(^|\\.)"+ge.join("\\.(?:.*\\.|)")+"(\\.|$)"),h=f=L.length;f--;)I=L[f],(c||Re===I.origType)&&(!n||n.guid===I.guid)&&(!w||w.test(I.namespace))&&(!o||o===I.selector||o==="**"&&I.selector)&&(L.splice(f,1),I.selector&&L.delegateCount--,N.remove&&N.remove.call(e,I));h&&!L.length&&((!N.teardown||N.teardown.call(e,ge,Ee.handle)===!1)&&s.removeEvent(e,G,Ee.handle),delete x[G])}s.isEmptyObject(x)&&te.remove(e,"handle events")}},dispatch:function(e){var i,n,o,c,f,h,w=new Array(arguments.length),x=s.event.fix(e),C=(te.get(this,"events")||Object.create(null))[x.type]||[],I=s.event.special[x.type]||{};for(w[0]=x,i=1;i<arguments.length;i++)w[i]=arguments[i];if(x.delegateTarget=this,!(I.preDispatch&&I.preDispatch.call(this,x)===!1)){for(h=s.event.handlers.call(this,x,C),i=0;(c=h[i++])&&!x.isPropagationStopped();)for(x.currentTarget=c.elem,n=0;(f=c.handlers[n++])&&!x.isImmediatePropagationStopped();)(!x.rnamespace||f.namespace===!1||x.rnamespace.test(f.namespace))&&(x.handleObj=f,x.data=f.data,o=((s.event.special[f.origType]||{}).handle||f.handler).apply(c.elem,w),o!==void 0&&(x.result=o)===!1&&(x.preventDefault(),x.stopPropagation()));return I.postDispatch&&I.postDispatch.call(this,x),x.result}},handlers:function(e,i){var n,o,c,f,h,w=[],x=i.delegateCount,C=e.target;if(x&&C.nodeType&&!(e.type==="click"&&e.button>=1)){for(;C!==this;C=C.parentNode||this)if(C.nodeType===1&&!(e.type==="click"&&C.disabled===!0)){for(f=[],h={},n=0;n<x;n++)o=i[n],c=o.selector+" ",h[c]===void 0&&(h[c]=o.needsContext?s(c,this).index(C)>-1:s.find(c,this,null,[C]).length),h[c]&&f.push(o);f.length&&w.push({elem:C,handlers:f})}}return C=this,x<i.length&&w.push({elem:C,handlers:i.slice(x)}),w},addProp:function(e,i){Object.defineProperty(s.Event.prototype,e,{enumerable:!0,configurable:!0,get:B(i)?function(){if(this.originalEvent)return i(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(n){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:n})}})},fix:function(e){return e[s.expando]?e:new s.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var i=this||e;return yt.test(i.type)&&i.click&&J(i,"input")&&ht(i,"click",!0),!1},trigger:function(e){var i=this||e;return yt.test(i.type)&&i.click&&J(i,"input")&&ht(i,"click"),!0},_default:function(e){var i=e.target;return yt.test(i.type)&&i.click&&J(i,"input")&&te.get(i,"click")||J(i,"a")}},beforeunload:{postDispatch:function(e){e.result!==void 0&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}};function ht(e,i,n){if(!n){te.get(e,i)===void 0&&s.event.add(e,i,ir);return}te.set(e,i,!1),s.event.add(e,i,{namespace:!1,handler:function(o){var c,f=te.get(this,i);if(o.isTrigger&1&&this[i]){if(f)(s.event.special[i]||{}).delegateType&&o.stopPropagation();else if(f=u.call(arguments),te.set(this,i,f),this[i](),c=te.get(this,i),te.set(this,i,!1),f!==c)return o.stopImmediatePropagation(),o.preventDefault(),c}else f&&(te.set(this,i,s.event.trigger(f[0],f.slice(1),this)),o.stopPropagation(),o.isImmediatePropagationStopped=ir)}})}s.removeEvent=function(e,i,n){e.removeEventListener&&e.removeEventListener(i,n)},s.Event=function(e,i){if(!(this instanceof s.Event))return new s.Event(e,i);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===void 0&&e.returnValue===!1?ir:nr,this.target=e.target&&e.target.nodeType===3?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,i&&s.extend(this,i),this.timeStamp=e&&e.timeStamp||Date.now(),this[s.expando]=!0},s.Event.prototype={constructor:s.Event,isDefaultPrevented:nr,isPropagationStopped:nr,isImmediatePropagationStopped:nr,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=ir,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=ir,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=ir,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},s.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},s.event.addProp),s.each({focus:"focusin",blur:"focusout"},function(e,i){function n(o){if(Q.documentMode){var c=te.get(this,"handle"),f=s.event.fix(o);f.type=o.type==="focusin"?"focus":"blur",f.isSimulated=!0,c(o),f.target===f.currentTarget&&c(f)}else s.event.simulate(i,o.target,s.event.fix(o))}s.event.special[e]={setup:function(){var o;if(ht(this,e,!0),Q.documentMode)o=te.get(this,i),o||this.addEventListener(i,n),te.set(this,i,(o||0)+1);else return!1},trigger:function(){return ht(this,e),!0},teardown:function(){var o;if(Q.documentMode)o=te.get(this,i)-1,o?te.set(this,i,o):(this.removeEventListener(i,n),te.remove(this,i));else return!1},_default:function(o){return te.get(o.target,e)},delegateType:i},s.event.special[i]={setup:function(){var o=this.ownerDocument||this.document||this,c=Q.documentMode?this:o,f=te.get(c,i);f||(Q.documentMode?this.addEventListener(i,n):o.addEventListener(e,n,!0)),te.set(c,i,(f||0)+1)},teardown:function(){var o=this.ownerDocument||this.document||this,c=Q.documentMode?this:o,f=te.get(c,i)-1;f?te.set(c,i,f):(Q.documentMode?this.removeEventListener(i,n):o.removeEventListener(e,n,!0),te.remove(c,i))}}}),s.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){s.event.special[e]={delegateType:i,bindType:i,handle:function(n){var o,c=this,f=n.relatedTarget,h=n.handleObj;return(!f||f!==c&&!s.contains(c,f))&&(n.type=h.origType,o=h.handler.apply(this,arguments),n.type=i),o}}}),s.fn.extend({on:function(e,i,n,o){return ai(this,e,i,n,o)},one:function(e,i,n,o){return ai(this,e,i,n,o,1)},off:function(e,i,n){var o,c;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,s(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if(typeof e=="object"){for(c in e)this.off(c,i,e[c]);return this}return(i===!1||typeof i=="function")&&(n=i,i=void 0),n===!1&&(n=nr),this.each(function(){s.event.remove(this,e,n,i)})}});var jr=/<script|<style|<link/i,si=/checked\s*(?:[^=]|=\s*.checked.)/i,Di=/^\s*<!\[CDATA\[|\]\]>\s*$/g;function zr(e,i){return J(e,"table")&&J(i.nodeType!==11?i:i.firstChild,"tr")&&s(e).children("tbody")[0]||e}function Ri(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function $t(e){return(e.type||"").slice(0,5)==="true/"?e.type=e.type.slice(5):e.removeAttribute("type"),e}function oi(e,i){var n,o,c,f,h,w,x;if(i.nodeType===1){if(te.hasData(e)&&(f=te.get(e),x=f.events,x)){te.remove(i,"handle events");for(c in x)for(n=0,o=x[c].length;n<o;n++)s.event.add(i,c,x[c][n])}Ge.hasData(e)&&(h=Ge.access(e),w=s.extend({},h),Ge.set(i,w))}}function Li(e,i){var n=i.nodeName.toLowerCase();n==="input"&&yt.test(e.type)?i.checked=e.checked:(n==="input"||n==="textarea")&&(i.defaultValue=e.defaultValue)}function ar(e,i,n,o){i=d(i);var c,f,h,w,x,C,I=0,N=e.length,L=N-1,G=i[0],ge=B(G);if(ge||N>1&&typeof G=="string"&&!U.checkClone&&si.test(G))return e.each(function(Re){var Ee=e.eq(Re);ge&&(i[0]=G.call(this,Re,Ee.html())),ar(Ee,i,n,o)});if(N&&(c=ni(i,e[0].ownerDocument,!1,e,o),f=c.firstChild,c.childNodes.length===1&&(c=f),f||o)){for(h=s.map(Pe(c,"script"),Ri),w=h.length;I<N;I++)x=c,I!==L&&(x=s.clone(x,!0,!0),w&&s.merge(h,Pe(x,"script"))),n.call(e[I],x,I);if(w)for(C=h[h.length-1].ownerDocument,s.map(h,$t),I=0;I<w;I++)x=h[I],ki.test(x.type||"")&&!te.access(x,"globalEval")&&s.contains(C,x)&&(x.src&&(x.type||"").toLowerCase()!=="module"?s._evalUrl&&!x.noModule&&s._evalUrl(x.src,{nonce:x.nonce||x.getAttribute("nonce")},C):ke(x.textContent.replace(Di,""),x,C))}return e}function li(e,i,n){for(var o,c=i?s.filter(i,e):e,f=0;(o=c[f])!=null;f++)!n&&o.nodeType===1&&s.cleanData(Pe(o)),o.parentNode&&(n&&nt(o)&&zt(Pe(o,"script")),o.parentNode.removeChild(o));return e}s.extend({htmlPrefilter:function(e){return e},clone:function(e,i,n){var o,c,f,h,w=e.cloneNode(!0),x=nt(e);if(!U.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!s.isXMLDoc(e))for(h=Pe(w),f=Pe(e),o=0,c=f.length;o<c;o++)Li(f[o],h[o]);if(i)if(n)for(f=f||Pe(e),h=h||Pe(w),o=0,c=f.length;o<c;o++)oi(f[o],h[o]);else oi(e,w);return h=Pe(w,"script"),h.length>0&&zt(h,!x&&Pe(e,"script")),w},cleanData:function(e){for(var i,n,o,c=s.event.special,f=0;(n=e[f])!==void 0;f++)if(er(n)){if(i=n[te.expando]){if(i.events)for(o in i.events)c[o]?s.event.remove(n,o):s.removeEvent(n,o,i.handle);n[te.expando]=void 0}n[Ge.expando]&&(n[Ge.expando]=void 0)}}}),s.fn.extend({detach:function(e){return li(this,e,!0)},remove:function(e){return li(this,e)},text:function(e){return ot(this,function(i){return i===void 0?s.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=i)})},null,e,arguments.length)},append:function(){return ar(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var i=zr(this,e);i.appendChild(e)}})},prepend:function(){return ar(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var i=zr(this,e);i.insertBefore(e,i.firstChild)}})},before:function(){return ar(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return ar(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,i=0;(e=this[i])!=null;i++)e.nodeType===1&&(s.cleanData(Pe(e,!1)),e.textContent="");return this},clone:function(e,i){return e=e==null?!1:e,i=i==null?e:i,this.map(function(){return s.clone(this,e,i)})},html:function(e){return ot(this,function(i){var n=this[0]||{},o=0,c=this.length;if(i===void 0&&n.nodeType===1)return n.innerHTML;if(typeof i=="string"&&!jr.test(i)&&!dt[(dr.exec(i)||["",""])[1].toLowerCase()]){i=s.htmlPrefilter(i);try{for(;o<c;o++)n=this[o]||{},n.nodeType===1&&(s.cleanData(Pe(n,!1)),n.innerHTML=i);n=0}catch(f){}}n&&this.empty().append(i)},null,e,arguments.length)},replaceWith:function(){var e=[];return ar(this,arguments,function(i){var n=this.parentNode;s.inArray(this,e)<0&&(s.cleanData(Pe(this)),n&&n.replaceChild(i,this))},e)}}),s.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,i){s.fn[e]=function(n){for(var o,c=[],f=s(n),h=f.length-1,w=0;w<=h;w++)o=w===h?this:this.clone(!0),s(f[w])[i](o),m.apply(c,o.get());return this.pushStack(c)}});var ui=new RegExp("^("+Ar+")(?!px)[a-z%]+$","i"),ae=/^--/,T=function(e){var i=e.ownerDocument.defaultView;return(!i||!i.opener)&&(i=l),i.getComputedStyle(e)},V=function(e,i,n){var o,c,f={};for(c in i)f[c]=e.style[c],e.style[c]=i[c];o=n.call(e);for(c in i)e.style[c]=f[c];return o},ie=new RegExp(ft.join("|"),"i");(function(){function e(){if(!!C){x.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",C.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",At.appendChild(x).appendChild(C);var I=l.getComputedStyle(C);n=I.top!=="1%",w=i(I.marginLeft)===12,C.style.right="60%",f=i(I.right)===36,o=i(I.width)===36,C.style.position="absolute",c=i(C.offsetWidth/3)===12,At.removeChild(x),C=null}}function i(I){return Math.round(parseFloat(I))}var n,o,c,f,h,w,x=Q.createElement("div"),C=Q.createElement("div");!C.style||(C.style.backgroundClip="content-box",C.cloneNode(!0).style.backgroundClip="",U.clearCloneStyle=C.style.backgroundClip==="content-box",s.extend(U,{boxSizingReliable:function(){return e(),o},pixelBoxStyles:function(){return e(),f},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),w},scrollboxSize:function(){return e(),c},reliableTrDimensions:function(){var I,N,L,G;return h==null&&(I=Q.createElement("table"),N=Q.createElement("tr"),L=Q.createElement("div"),I.style.cssText="position:absolute;left:-11111px;border-collapse:separate",N.style.cssText="box-sizing:content-box;border:1px solid",N.style.height="1px",L.style.height="9px",L.style.display="block",At.appendChild(I).appendChild(N).appendChild(L),G=l.getComputedStyle(N),h=parseInt(G.height,10)+parseInt(G.borderTopWidth,10)+parseInt(G.borderBottomWidth,10)===N.offsetHeight,At.removeChild(I)),h}}))})();function Fe(e,i,n){var o,c,f,h,w=ae.test(i),x=e.style;return n=n||T(e),n&&(h=n.getPropertyValue(i)||n[i],w&&h&&(h=h.replace(Qe,"$1")||void 0),h===""&&!nt(e)&&(h=s.style(e,i)),!U.pixelBoxStyles()&&ui.test(h)&&ie.test(i)&&(o=x.width,c=x.minWidth,f=x.maxWidth,x.minWidth=x.maxWidth=x.width=h,h=n.width,x.width=o,x.minWidth=c,x.maxWidth=f)),h!==void 0?h+"":h}function tt(e,i){return{get:function(){if(e()){delete this.get;return}return(this.get=i).apply(this,arguments)}}}var Ye=["Webkit","Moz","ms"],Xe=Q.createElement("div").style,xt={};function It(e){for(var i=e[0].toUpperCase()+e.slice(1),n=Ye.length;n--;)if(e=Ye[n]+i,e in Xe)return e}function rt(e){var i=s.cssProps[e]||xt[e];return i||(e in Xe?e:xt[e]=It(e)||e)}var Pr=/^(none|table(?!-c[ea]).+)/,Gr={position:"absolute",visibility:"hidden",display:"block"},yn={letterSpacing:"0",fontWeight:"400"};function xn(e,i,n){var o=rr.exec(i);return o?Math.max(0,o[2]-(n||0))+(o[3]||"px"):i}function ci(e,i,n,o,c,f){var h=i==="width"?1:0,w=0,x=0,C=0;if(n===(o?"border":"content"))return 0;for(;h<4;h+=2)n==="margin"&&(C+=s.css(e,n+ft[h],!0,c)),o?(n==="content"&&(x-=s.css(e,"padding"+ft[h],!0,c)),n!=="margin"&&(x-=s.css(e,"border"+ft[h]+"Width",!0,c))):(x+=s.css(e,"padding"+ft[h],!0,c),n!=="padding"?x+=s.css(e,"border"+ft[h]+"Width",!0,c):w+=s.css(e,"border"+ft[h]+"Width",!0,c));return!o&&f>=0&&(x+=Math.max(0,Math.ceil(e["offset"+i[0].toUpperCase()+i.slice(1)]-f-x-w-.5))||0),x+C}function wn(e,i,n){var o=T(e),c=!U.boxSizingReliable()||n,f=c&&s.css(e,"boxSizing",!1,o)==="border-box",h=f,w=Fe(e,i,o),x="offset"+i[0].toUpperCase()+i.slice(1);if(ui.test(w)){if(!n)return w;w="auto"}return(!U.boxSizingReliable()&&f||!U.reliableTrDimensions()&&J(e,"tr")||w==="auto"||!parseFloat(w)&&s.css(e,"display",!1,o)==="inline")&&e.getClientRects().length&&(f=s.css(e,"boxSizing",!1,o)==="border-box",h=x in e,h&&(w=e[x])),w=parseFloat(w)||0,w+ci(e,i,n||(f?"border":"content"),h,o,w)+"px"}s.extend({cssHooks:{opacity:{get:function(e,i){if(i){var n=Fe(e,"opacity");return n===""?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,i,n,o){if(!(!e||e.nodeType===3||e.nodeType===8||!e.style)){var c,f,h,w=ct(i),x=ae.test(i),C=e.style;if(x||(i=rt(w)),h=s.cssHooks[i]||s.cssHooks[w],n!==void 0){if(f=typeof n,f==="string"&&(c=rr.exec(n))&&c[1]&&(n=$r(e,i,c),f="number"),n==null||n!==n)return;f==="number"&&!x&&(n+=c&&c[3]||(s.cssNumber[w]?"":"px")),!U.clearCloneStyle&&n===""&&i.indexOf("background")===0&&(C[i]="inherit"),(!h||!("set"in h)||(n=h.set(e,n,o))!==void 0)&&(x?C.setProperty(i,n):C[i]=n)}else return h&&"get"in h&&(c=h.get(e,!1,o))!==void 0?c:C[i]}},css:function(e,i,n,o){var c,f,h,w=ct(i),x=ae.test(i);return x||(i=rt(w)),h=s.cssHooks[i]||s.cssHooks[w],h&&"get"in h&&(c=h.get(e,!0,n)),c===void 0&&(c=Fe(e,i,o)),c==="normal"&&i in yn&&(c=yn[i]),n===""||n?(f=parseFloat(c),n===!0||isFinite(f)?f||0:c):c}}),s.each(["height","width"],function(e,i){s.cssHooks[i]={get:function(n,o,c){if(o)return Pr.test(s.css(n,"display"))&&(!n.getClientRects().length||!n.getBoundingClientRect().width)?V(n,Gr,function(){return wn(n,i,c)}):wn(n,i,c)},set:function(n,o,c){var f,h=T(n),w=!U.scrollboxSize()&&h.position==="absolute",x=w||c,C=x&&s.css(n,"boxSizing",!1,h)==="border-box",I=c?ci(n,i,c,C,h):0;return C&&w&&(I-=Math.ceil(n["offset"+i[0].toUpperCase()+i.slice(1)]-parseFloat(h[i])-ci(n,i,"border",!1,h)-.5)),I&&(f=rr.exec(o))&&(f[3]||"px")!=="px"&&(n.style[i]=o,o=s.css(n,i)),xn(n,o,I)}}}),s.cssHooks.marginLeft=tt(U.reliableMarginLeft,function(e,i){if(i)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-V(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),s.each({margin:"",padding:"",border:"Width"},function(e,i){s.cssHooks[e+i]={expand:function(n){for(var o=0,c={},f=typeof n=="string"?n.split(" "):[n];o<4;o++)c[e+ft[o]+i]=f[o]||f[o-2]||f[0];return c}},e!=="margin"&&(s.cssHooks[e+i].set=xn)}),s.fn.extend({css:function(e,i){return ot(this,function(n,o,c){var f,h,w={},x=0;if(Array.isArray(o)){for(f=T(n),h=o.length;x<h;x++)w[o[x]]=s.css(n,o[x],!1,f);return w}return c!==void 0?s.style(n,o,c):s.css(n,o)},e,i,arguments.length>1)}});function wt(e,i,n,o,c){return new wt.prototype.init(e,i,n,o,c)}s.Tween=wt,wt.prototype={constructor:wt,init:function(e,i,n,o,c,f){this.elem=e,this.prop=n,this.easing=c||s.easing._default,this.options=i,this.start=this.now=this.cur(),this.end=o,this.unit=f||(s.cssNumber[n]?"":"px")},cur:function(){var e=wt.propHooks[this.prop];return e&&e.get?e.get(this):wt.propHooks._default.get(this)},run:function(e){var i,n=wt.propHooks[this.prop];return this.options.duration?this.pos=i=s.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=i=e,this.now=(this.end-this.start)*i+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):wt.propHooks._default.set(this),this}},wt.prototype.init.prototype=wt.prototype,wt.propHooks={_default:{get:function(e){var i;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(i=s.css(e.elem,e.prop,""),!i||i==="auto"?0:i)},set:function(e){s.fx.step[e.prop]?s.fx.step[e.prop](e):e.elem.nodeType===1&&(s.cssHooks[e.prop]||e.elem.style[rt(e.prop)]!=null)?s.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},wt.propHooks.scrollTop=wt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},s.easing={linear:function(e){return e},swing:function(e){return .5-Math.cos(e*Math.PI)/2},_default:"swing"},s.fx=wt.prototype.init,s.fx.step={};var p,E,g=/^(?:toggle|show|hide)$/,A=/queueHooks$/;function k(){E&&(Q.hidden===!1&&l.requestAnimationFrame?l.requestAnimationFrame(k):l.setTimeout(k,s.fx.interval),s.fx.tick())}function S(){return l.setTimeout(function(){p=void 0}),p=Date.now()}function M(e,i){var n,o=0,c={height:e};for(i=i?1:0;o<4;o+=2-i)n=ft[o],c["margin"+n]=c["padding"+n]=e;return i&&(c.opacity=c.width=e),c}function j(e,i,n){for(var o,c=(z.tweeners[i]||[]).concat(z.tweeners["*"]),f=0,h=c.length;f<h;f++)if(o=c[f].call(n,i,e))return o}function q(e,i,n){var o,c,f,h,w,x,C,I,N="width"in i||"height"in i,L=this,G={},ge=e.style,Re=e.nodeType&&fr(e),Ee=te.get(e,"fxshow");n.queue||(h=s._queueHooks(e,"fx"),h.unqueued==null&&(h.unqueued=0,w=h.empty.fire,h.empty.fire=function(){h.unqueued||w()}),h.unqueued++,L.always(function(){L.always(function(){h.unqueued--,s.queue(e,"fx").length||h.empty.fire()})}));for(o in i)if(c=i[o],g.test(c)){if(delete i[o],f=f||c==="toggle",c===(Re?"hide":"show"))if(c==="show"&&Ee&&Ee[o]!==void 0)Re=!0;else continue;G[o]=Ee&&Ee[o]||s.style(e,o)}if(x=!s.isEmptyObject(i),!(!x&&s.isEmptyObject(G))){N&&e.nodeType===1&&(n.overflow=[ge.overflow,ge.overflowX,ge.overflowY],C=Ee&&Ee.display,C==null&&(C=te.get(e,"display")),I=s.css(e,"display"),I==="none"&&(C?I=C:(Wt([e],!0),C=e.style.display||C,I=s.css(e,"display"),Wt([e]))),(I==="inline"||I==="inline-block"&&C!=null)&&s.css(e,"float")==="none"&&(x||(L.done(function(){ge.display=C}),C==null&&(I=ge.display,C=I==="none"?"":I)),ge.display="inline-block")),n.overflow&&(ge.overflow="hidden",L.always(function(){ge.overflow=n.overflow[0],ge.overflowX=n.overflow[1],ge.overflowY=n.overflow[2]})),x=!1;for(o in G)x||(Ee?"hidden"in Ee&&(Re=Ee.hidden):Ee=te.access(e,"fxshow",{display:C}),f&&(Ee.hidden=!Re),Re&&Wt([e],!0),L.done(function(){Re||Wt([e]),te.remove(e,"fxshow");for(o in G)s.style(e,o,G[o])})),x=j(Re?Ee[o]:0,o,L),o in Ee||(Ee[o]=x.start,Re&&(x.end=x.start,x.start=0))}}function Y(e,i){var n,o,c,f,h;for(n in e)if(o=ct(n),c=i[o],f=e[n],Array.isArray(f)&&(c=f[1],f=e[n]=f[0]),n!==o&&(e[o]=f,delete e[n]),h=s.cssHooks[o],h&&"expand"in h){f=h.expand(f),delete e[o];for(n in f)n in e||(e[n]=f[n],i[n]=c)}else i[o]=c}function z(e,i,n){var o,c,f=0,h=z.prefilters.length,w=s.Deferred().always(function(){delete x.elem}),x=function(){if(c)return!1;for(var N=p||S(),L=Math.max(0,C.startTime+C.duration-N),G=L/C.duration||0,ge=1-G,Re=0,Ee=C.tweens.length;Re<Ee;Re++)C.tweens[Re].run(ge);return w.notifyWith(e,[C,ge,L]),ge<1&&Ee?L:(Ee||w.notifyWith(e,[C,1,0]),w.resolveWith(e,[C]),!1)},C=w.promise({elem:e,props:s.extend({},i),opts:s.extend(!0,{specialEasing:{},easing:s.easing._default},n),originalProperties:i,originalOptions:n,startTime:p||S(),duration:n.duration,tweens:[],createTween:function(N,L){var G=s.Tween(e,C.opts,N,L,C.opts.specialEasing[N]||C.opts.easing);return C.tweens.push(G),G},stop:function(N){var L=0,G=N?C.tweens.length:0;if(c)return this;for(c=!0;L<G;L++)C.tweens[L].run(1);return N?(w.notifyWith(e,[C,1,0]),w.resolveWith(e,[C,N])):w.rejectWith(e,[C,N]),this}}),I=C.props;for(Y(I,C.opts.specialEasing);f<h;f++)if(o=z.prefilters[f].call(C,e,I,C.opts),o)return B(o.stop)&&(s._queueHooks(C.elem,C.opts.queue).stop=o.stop.bind(o)),o;return s.map(I,j,C),B(C.opts.start)&&C.opts.start.call(e,C),C.progress(C.opts.progress).done(C.opts.done,C.opts.complete).fail(C.opts.fail).always(C.opts.always),s.fx.timer(s.extend(x,{elem:e,anim:C,queue:C.opts.queue})),C}s.Animation=s.extend(z,{tweeners:{"*":[function(e,i){var n=this.createTween(e,i);return $r(n.elem,e,rr.exec(i),n),n}]},tweener:function(e,i){B(e)?(i=e,e=["*"]):e=e.match(bt);for(var n,o=0,c=e.length;o<c;o++)n=e[o],z.tweeners[n]=z.tweeners[n]||[],z.tweeners[n].unshift(i)},prefilters:[q],prefilter:function(e,i){i?z.prefilters.unshift(e):z.prefilters.push(e)}}),s.speed=function(e,i,n){var o=e&&typeof e=="object"?s.extend({},e):{complete:n||!n&&i||B(e)&&e,duration:e,easing:n&&i||i&&!B(i)&&i};return s.fx.off?o.duration=0:typeof o.duration!="number"&&(o.duration in s.fx.speeds?o.duration=s.fx.speeds[o.duration]:o.duration=s.fx.speeds._default),(o.queue==null||o.queue===!0)&&(o.queue="fx"),o.old=o.complete,o.complete=function(){B(o.old)&&o.old.call(this),o.queue&&s.dequeue(this,o.queue)},o},s.fn.extend({fadeTo:function(e,i,n,o){return this.filter(fr).css("opacity",0).show().end().animate({opacity:i},e,n,o)},animate:function(e,i,n,o){var c=s.isEmptyObject(e),f=s.speed(i,n,o),h=function(){var w=z(this,s.extend({},e),f);(c||te.get(this,"finish"))&&w.stop(!0)};return h.finish=h,c||f.queue===!1?this.each(h):this.queue(f.queue,h)},stop:function(e,i,n){var o=function(c){var f=c.stop;delete c.stop,f(n)};return typeof e!="string"&&(n=i,i=e,e=void 0),i&&this.queue(e||"fx",[]),this.each(function(){var c=!0,f=e!=null&&e+"queueHooks",h=s.timers,w=te.get(this);if(f)w[f]&&w[f].stop&&o(w[f]);else for(f in w)w[f]&&w[f].stop&&A.test(f)&&o(w[f]);for(f=h.length;f--;)h[f].elem===this&&(e==null||h[f].queue===e)&&(h[f].anim.stop(n),c=!1,h.splice(f,1));(c||!n)&&s.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var i,n=te.get(this),o=n[e+"queue"],c=n[e+"queueHooks"],f=s.timers,h=o?o.length:0;for(n.finish=!0,s.queue(this,e,[]),c&&c.stop&&c.stop.call(this,!0),i=f.length;i--;)f[i].elem===this&&f[i].queue===e&&(f[i].anim.stop(!0),f.splice(i,1));for(i=0;i<h;i++)o[i]&&o[i].finish&&o[i].finish.call(this);delete n.finish})}}),s.each(["toggle","show","hide"],function(e,i){var n=s.fn[i];s.fn[i]=function(o,c,f){return o==null||typeof o=="boolean"?n.apply(this,arguments):this.animate(M(i,!0),o,c,f)}}),s.each({slideDown:M("show"),slideUp:M("hide"),slideToggle:M("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,i){s.fn[e]=function(n,o,c){return this.animate(i,n,o,c)}}),s.timers=[],s.fx.tick=function(){var e,i=0,n=s.timers;for(p=Date.now();i<n.length;i++)e=n[i],!e()&&n[i]===e&&n.splice(i--,1);n.length||s.fx.stop(),p=void 0},s.fx.timer=function(e){s.timers.push(e),s.fx.start()},s.fx.interval=13,s.fx.start=function(){E||(E=!0,k())},s.fx.stop=function(){E=null},s.fx.speeds={slow:600,fast:200,_default:400},s.fn.delay=function(e,i){return e=s.fx&&s.fx.speeds[e]||e,i=i||"fx",this.queue(i,function(n,o){var c=l.setTimeout(n,e);o.stop=function(){l.clearTimeout(c)}})},function(){var e=Q.createElement("input"),i=Q.createElement("select"),n=i.appendChild(Q.createElement("option"));e.type="checkbox",U.checkOn=e.value!=="",U.optSelected=n.selected,e=Q.createElement("input"),e.value="t",e.type="radio",U.radioValue=e.value==="t"}();var ne,xe=s.expr.attrHandle;s.fn.extend({attr:function(e,i){return ot(this,s.attr,e,i,arguments.length>1)},removeAttr:function(e){return this.each(function(){s.removeAttr(this,e)})}}),s.extend({attr:function(e,i,n){var o,c,f=e.nodeType;if(!(f===3||f===8||f===2)){if(typeof e.getAttribute=="undefined")return s.prop(e,i,n);if((f!==1||!s.isXMLDoc(e))&&(c=s.attrHooks[i.toLowerCase()]||(s.expr.match.bool.test(i)?ne:void 0)),n!==void 0){if(n===null){s.removeAttr(e,i);return}return c&&"set"in c&&(o=c.set(e,n,i))!==void 0?o:(e.setAttribute(i,n+""),n)}return c&&"get"in c&&(o=c.get(e,i))!==null?o:(o=s.find.attr(e,i),o==null?void 0:o)}},attrHooks:{type:{set:function(e,i){if(!U.radioValue&&i==="radio"&&J(e,"input")){var n=e.value;return e.setAttribute("type",i),n&&(e.value=n),i}}}},removeAttr:function(e,i){var n,o=0,c=i&&i.match(bt);if(c&&e.nodeType===1)for(;n=c[o++];)e.removeAttribute(n)}}),ne={set:function(e,i,n){return i===!1?s.removeAttr(e,n):e.setAttribute(n,n),n}},s.each(s.expr.match.bool.source.match(/\w+/g),function(e,i){var n=xe[i]||s.find.attr;xe[i]=function(o,c,f){var h,w,x=c.toLowerCase();return f||(w=xe[x],xe[x]=h,h=n(o,c,f)!=null?x:null,xe[x]=w),h}});var Ie=/^(?:input|select|textarea|button)$/i,Oe=/^(?:a|area)$/i;s.fn.extend({prop:function(e,i){return ot(this,s.prop,e,i,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[s.propFix[e]||e]})}}),s.extend({prop:function(e,i,n){var o,c,f=e.nodeType;if(!(f===3||f===8||f===2))return(f!==1||!s.isXMLDoc(e))&&(i=s.propFix[i]||i,c=s.propHooks[i]),n!==void 0?c&&"set"in c&&(o=c.set(e,n,i))!==void 0?o:e[i]=n:c&&"get"in c&&(o=c.get(e,i))!==null?o:e[i]},propHooks:{tabIndex:{get:function(e){var i=s.find.attr(e,"tabindex");return i?parseInt(i,10):Ie.test(e.nodeName)||Oe.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),U.optSelected||(s.propHooks.selected={get:function(e){var i=e.parentNode;return i&&i.parentNode&&i.parentNode.selectedIndex,null},set:function(e){var i=e.parentNode;i&&(i.selectedIndex,i.parentNode&&i.parentNode.selectedIndex)}}),s.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){s.propFix[this.toLowerCase()]=this});function $e(e){var i=e.match(bt)||[];return i.join(" ")}function Ue(e){return e.getAttribute&&e.getAttribute("class")||""}function Et(e){return Array.isArray(e)?e:typeof e=="string"?e.match(bt)||[]:[]}s.fn.extend({addClass:function(e){var i,n,o,c,f,h;return B(e)?this.each(function(w){s(this).addClass(e.call(this,w,Ue(this)))}):(i=Et(e),i.length?this.each(function(){if(o=Ue(this),n=this.nodeType===1&&" "+$e(o)+" ",n){for(f=0;f<i.length;f++)c=i[f],n.indexOf(" "+c+" ")<0&&(n+=c+" ");h=$e(n),o!==h&&this.setAttribute("class",h)}}):this)},removeClass:function(e){var i,n,o,c,f,h;return B(e)?this.each(function(w){s(this).removeClass(e.call(this,w,Ue(this)))}):arguments.length?(i=Et(e),i.length?this.each(function(){if(o=Ue(this),n=this.nodeType===1&&" "+$e(o)+" ",n){for(f=0;f<i.length;f++)for(c=i[f];n.indexOf(" "+c+" ")>-1;)n=n.replace(" "+c+" "," ");h=$e(n),o!==h&&this.setAttribute("class",h)}}):this):this.attr("class","")},toggleClass:function(e,i){var n,o,c,f,h=typeof e,w=h==="string"||Array.isArray(e);return B(e)?this.each(function(x){s(this).toggleClass(e.call(this,x,Ue(this),i),i)}):typeof i=="boolean"&&w?i?this.addClass(e):this.removeClass(e):(n=Et(e),this.each(function(){if(w)for(f=s(this),c=0;c<n.length;c++)o=n[c],f.hasClass(o)?f.removeClass(o):f.addClass(o);else(e===void 0||h==="boolean")&&(o=Ue(this),o&&te.set(this,"__className__",o),this.setAttribute&&this.setAttribute("class",o||e===!1?"":te.get(this,"__className__")||""))}))},hasClass:function(e){var i,n,o=0;for(i=" "+e+" ";n=this[o++];)if(n.nodeType===1&&(" "+$e(Ue(n))+" ").indexOf(i)>-1)return!0;return!1}});var fi=/\r/g;s.fn.extend({val:function(e){var i,n,o,c=this[0];return arguments.length?(o=B(e),this.each(function(f){var h;this.nodeType===1&&(o?h=e.call(this,f,s(this).val()):h=e,h==null?h="":typeof h=="number"?h+="":Array.isArray(h)&&(h=s.map(h,function(w){return w==null?"":w+""})),i=s.valHooks[this.type]||s.valHooks[this.nodeName.toLowerCase()],(!i||!("set"in i)||i.set(this,h,"value")===void 0)&&(this.value=h))})):c?(i=s.valHooks[c.type]||s.valHooks[c.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(c,"value"))!==void 0?n:(n=c.value,typeof n=="string"?n.replace(fi,""):n==null?"":n)):void 0}}),s.extend({valHooks:{option:{get:function(e){var i=s.find.attr(e,"value");return i!=null?i:$e(s.text(e))}},select:{get:function(e){var i,n,o,c=e.options,f=e.selectedIndex,h=e.type==="select-one",w=h?null:[],x=h?f+1:c.length;for(f<0?o=x:o=h?f:0;o<x;o++)if(n=c[o],(n.selected||o===f)&&!n.disabled&&(!n.parentNode.disabled||!J(n.parentNode,"optgroup"))){if(i=s(n).val(),h)return i;w.push(i)}return w},set:function(e,i){for(var n,o,c=e.options,f=s.makeArray(i),h=c.length;h--;)o=c[h],(o.selected=s.inArray(s.valHooks.option.get(o),f)>-1)&&(n=!0);return n||(e.selectedIndex=-1),f}}}}),s.each(["radio","checkbox"],function(){s.valHooks[this]={set:function(e,i){if(Array.isArray(i))return e.checked=s.inArray(s(e).val(),i)>-1}},U.checkOn||(s.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var kr=l.location,En={guid:Date.now()},di=/\?/;s.parseXML=function(e){var i,n;if(!e||typeof e!="string")return null;try{i=new l.DOMParser().parseFromString(e,"text/xml")}catch(o){}return n=i&&i.getElementsByTagName("parsererror")[0],(!i||n)&&s.error("Invalid XML: "+(n?s.map(n.childNodes,function(o){return o.textContent}).join(`
|
|
`):e)),i};var oa=/^(?:focusinfocus|focusoutblur)$/,_n=function(e){e.stopPropagation()};s.extend(s.event,{trigger:function(e,i,n,o){var c,f,h,w,x,C,I,N,L=[n||Q],G=W.call(e,"type")?e.type:e,ge=W.call(e,"namespace")?e.namespace.split("."):[];if(f=N=h=n=n||Q,!(n.nodeType===3||n.nodeType===8)&&!oa.test(G+s.event.triggered)&&(G.indexOf(".")>-1&&(ge=G.split("."),G=ge.shift(),ge.sort()),x=G.indexOf(":")<0&&"on"+G,e=e[s.expando]?e:new s.Event(G,typeof e=="object"&&e),e.isTrigger=o?2:3,e.namespace=ge.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+ge.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),i=i==null?[e]:s.makeArray(i,[e]),I=s.event.special[G]||{},!(!o&&I.trigger&&I.trigger.apply(n,i)===!1))){if(!o&&!I.noBubble&&!ce(n)){for(w=I.delegateType||G,oa.test(w+G)||(f=f.parentNode);f;f=f.parentNode)L.push(f),h=f;h===(n.ownerDocument||Q)&&L.push(h.defaultView||h.parentWindow||l)}for(c=0;(f=L[c++])&&!e.isPropagationStopped();)N=f,e.type=c>1?w:I.bindType||G,C=(te.get(f,"events")||Object.create(null))[e.type]&&te.get(f,"handle"),C&&C.apply(f,i),C=x&&f[x],C&&C.apply&&er(f)&&(e.result=C.apply(f,i),e.result===!1&&e.preventDefault());return e.type=G,!o&&!e.isDefaultPrevented()&&(!I._default||I._default.apply(L.pop(),i)===!1)&&er(n)&&x&&B(n[G])&&!ce(n)&&(h=n[x],h&&(n[x]=null),s.event.triggered=G,e.isPropagationStopped()&&N.addEventListener(G,_n),n[G](),e.isPropagationStopped()&&N.removeEventListener(G,_n),s.event.triggered=void 0,h&&(n[x]=h)),e.result}},simulate:function(e,i,n){var o=s.extend(new s.Event,n,{type:e,isSimulated:!0});s.event.trigger(o,null,i)}}),s.fn.extend({trigger:function(e,i){return this.each(function(){s.event.trigger(e,i,this)})},triggerHandler:function(e,i){var n=this[0];if(n)return s.event.trigger(e,i,n,!0)}});var la=/\[\]$/,Hi=/\r?\n/g,Sl=/^(?:submit|button|image|reset|file)$/i,Al=/^(?:input|select|textarea|keygen)/i;function ua(e,i,n,o){var c;if(Array.isArray(i))s.each(i,function(f,h){n||la.test(e)?o(e,h):ua(e+"["+(typeof h=="object"&&h!=null?f:"")+"]",h,n,o)});else if(!n&&he(i)==="object")for(c in i)ua(e+"["+c+"]",i[c],n,o);else o(e,i)}s.param=function(e,i){var n,o=[],c=function(f,h){var w=B(h)?h():h;o[o.length]=encodeURIComponent(f)+"="+encodeURIComponent(w==null?"":w)};if(e==null)return"";if(Array.isArray(e)||e.jquery&&!s.isPlainObject(e))s.each(e,function(){c(this.name,this.value)});else for(n in e)ua(n,e[n],i,c);return o.join("&")},s.fn.extend({serialize:function(){return s.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=s.prop(this,"elements");return e?s.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!s(this).is(":disabled")&&Al.test(this.nodeName)&&!Sl.test(e)&&(this.checked||!yt.test(e))}).map(function(e,i){var n=s(this).val();return n==null?null:Array.isArray(n)?s.map(n,function(o){return{name:i.name,value:o.replace(Hi,`\r
|
|
`)}}):{name:i.name,value:n.replace(Hi,`\r
|
|
`)}}).get()}});var Cl=/%20/g,Pl=/#.*$/,kl=/([?&])_=[^&]*/,Dl=/^(.*?):[ \t]*([^\r\n]*)$/mg,Rl=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ll=/^(?:GET|HEAD)$/,Fl=/^\/\//,Ds={},ca={},Rs="*/".concat("*"),fa=Q.createElement("a");fa.href=kr.href;function Ls(e){return function(i,n){typeof i!="string"&&(n=i,i="*");var o,c=0,f=i.toLowerCase().match(bt)||[];if(B(n))for(;o=f[c++];)o[0]==="+"?(o=o.slice(1)||"*",(e[o]=e[o]||[]).unshift(n)):(e[o]=e[o]||[]).push(n)}}function Fs(e,i,n,o){var c={},f=e===ca;function h(w){var x;return c[w]=!0,s.each(e[w]||[],function(C,I){var N=I(i,n,o);if(typeof N=="string"&&!f&&!c[N])return i.dataTypes.unshift(N),h(N),!1;if(f)return!(x=N)}),x}return h(i.dataTypes[0])||!c["*"]&&h("*")}function da(e,i){var n,o,c=s.ajaxSettings.flatOptions||{};for(n in i)i[n]!==void 0&&((c[n]?e:o||(o={}))[n]=i[n]);return o&&s.extend(!0,e,o),e}function Il(e,i,n){for(var o,c,f,h,w=e.contents,x=e.dataTypes;x[0]==="*";)x.shift(),o===void 0&&(o=e.mimeType||i.getResponseHeader("Content-Type"));if(o){for(c in w)if(w[c]&&w[c].test(o)){x.unshift(c);break}}if(x[0]in n)f=x[0];else{for(c in n){if(!x[0]||e.converters[c+" "+x[0]]){f=c;break}h||(h=c)}f=f||h}if(f)return f!==x[0]&&x.unshift(f),n[f]}function Ml(e,i,n,o){var c,f,h,w,x,C={},I=e.dataTypes.slice();if(I[1])for(h in e.converters)C[h.toLowerCase()]=e.converters[h];for(f=I.shift();f;)if(e.responseFields[f]&&(n[e.responseFields[f]]=i),!x&&o&&e.dataFilter&&(i=e.dataFilter(i,e.dataType)),x=f,f=I.shift(),f){if(f==="*")f=x;else if(x!=="*"&&x!==f){if(h=C[x+" "+f]||C["* "+f],!h){for(c in C)if(w=c.split(" "),w[1]===f&&(h=C[x+" "+w[0]]||C["* "+w[0]],h)){h===!0?h=C[c]:C[c]!==!0&&(f=w[0],I.unshift(w[1]));break}}if(h!==!0)if(h&&e.throws)i=h(i);else try{i=h(i)}catch(N){return{state:"parsererror",error:h?N:"No conversion from "+x+" to "+f}}}}return{state:"success",data:i}}s.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:kr.href,type:"GET",isLocal:Rl.test(kr.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Rs,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":s.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,i){return i?da(da(e,s.ajaxSettings),i):da(s.ajaxSettings,e)},ajaxPrefilter:Ls(Ds),ajaxTransport:Ls(ca),ajax:function(e,i){typeof e=="object"&&(i=e,e=void 0),i=i||{};var n,o,c,f,h,w,x,C,I,N,L=s.ajaxSetup({},i),G=L.context||L,ge=L.context&&(G.nodeType||G.jquery)?s(G):s.event,Re=s.Deferred(),Ee=s.Callbacks("once memory"),pt=L.statusCode||{},at={},hr={},pr="canceled",Ce={readyState:0,getResponseHeader:function(Le){var Je;if(x){if(!f)for(f={};Je=Dl.exec(c);)f[Je[1].toLowerCase()+" "]=(f[Je[1].toLowerCase()+" "]||[]).concat(Je[2]);Je=f[Le.toLowerCase()+" "]}return Je==null?null:Je.join(", ")},getAllResponseHeaders:function(){return x?c:null},setRequestHeader:function(Le,Je){return x==null&&(Le=hr[Le.toLowerCase()]=hr[Le.toLowerCase()]||Le,at[Le]=Je),this},overrideMimeType:function(Le){return x==null&&(L.mimeType=Le),this},statusCode:function(Le){var Je;if(Le)if(x)Ce.always(Le[Ce.status]);else for(Je in Le)pt[Je]=[pt[Je],Le[Je]];return this},abort:function(Le){var Je=Le||pr;return n&&n.abort(Je),hi(0,Je),this}};if(Re.promise(Ce),L.url=((e||L.url||kr.href)+"").replace(Fl,kr.protocol+"//"),L.type=i.method||i.type||L.method||L.type,L.dataTypes=(L.dataType||"*").toLowerCase().match(bt)||[""],L.crossDomain==null){w=Q.createElement("a");try{w.href=L.url,w.href=w.href,L.crossDomain=fa.protocol+"//"+fa.host!=w.protocol+"//"+w.host}catch(Le){L.crossDomain=!0}}if(L.data&&L.processData&&typeof L.data!="string"&&(L.data=s.param(L.data,L.traditional)),Fs(Ds,L,i,Ce),x)return Ce;C=s.event&&L.global,C&&s.active++==0&&s.event.trigger("ajaxStart"),L.type=L.type.toUpperCase(),L.hasContent=!Ll.test(L.type),o=L.url.replace(Pl,""),L.hasContent?L.data&&L.processData&&(L.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(L.data=L.data.replace(Cl,"+")):(N=L.url.slice(o.length),L.data&&(L.processData||typeof L.data=="string")&&(o+=(di.test(o)?"&":"?")+L.data,delete L.data),L.cache===!1&&(o=o.replace(kl,"$1"),N=(di.test(o)?"&":"?")+"_="+En.guid+++N),L.url=o+N),L.ifModified&&(s.lastModified[o]&&Ce.setRequestHeader("If-Modified-Since",s.lastModified[o]),s.etag[o]&&Ce.setRequestHeader("If-None-Match",s.etag[o])),(L.data&&L.hasContent&&L.contentType!==!1||i.contentType)&&Ce.setRequestHeader("Content-Type",L.contentType),Ce.setRequestHeader("Accept",L.dataTypes[0]&&L.accepts[L.dataTypes[0]]?L.accepts[L.dataTypes[0]]+(L.dataTypes[0]!=="*"?", "+Rs+"; q=0.01":""):L.accepts["*"]);for(I in L.headers)Ce.setRequestHeader(I,L.headers[I]);if(L.beforeSend&&(L.beforeSend.call(G,Ce,L)===!1||x))return Ce.abort();if(pr="abort",Ee.add(L.complete),Ce.done(L.success),Ce.fail(L.error),n=Fs(ca,L,i,Ce),!n)hi(-1,"No Transport");else{if(Ce.readyState=1,C&&ge.trigger("ajaxSend",[Ce,L]),x)return Ce;L.async&&L.timeout>0&&(h=l.setTimeout(function(){Ce.abort("timeout")},L.timeout));try{x=!1,n.send(at,hi)}catch(Le){if(x)throw Le;hi(-1,Le)}}function hi(Le,Je,ji,pa){var mr,zi,gr,Vr,qr,Gt=Je;x||(x=!0,h&&l.clearTimeout(h),n=void 0,c=pa||"",Ce.readyState=Le>0?4:0,mr=Le>=200&&Le<300||Le===304,ji&&(Vr=Il(L,Ce,ji)),!mr&&s.inArray("script",L.dataTypes)>-1&&s.inArray("json",L.dataTypes)<0&&(L.converters["text script"]=function(){}),Vr=Ml(L,Vr,Ce,mr),mr?(L.ifModified&&(qr=Ce.getResponseHeader("Last-Modified"),qr&&(s.lastModified[o]=qr),qr=Ce.getResponseHeader("etag"),qr&&(s.etag[o]=qr)),Le===204||L.type==="HEAD"?Gt="nocontent":Le===304?Gt="notmodified":(Gt=Vr.state,zi=Vr.data,gr=Vr.error,mr=!gr)):(gr=Gt,(Le||!Gt)&&(Gt="error",Le<0&&(Le=0))),Ce.status=Le,Ce.statusText=(Je||Gt)+"",mr?Re.resolveWith(G,[zi,Gt,Ce]):Re.rejectWith(G,[Ce,Gt,gr]),Ce.statusCode(pt),pt=void 0,C&&ge.trigger(mr?"ajaxSuccess":"ajaxError",[Ce,L,mr?zi:gr]),Ee.fireWith(G,[Ce,Gt]),C&&(ge.trigger("ajaxComplete",[Ce,L]),--s.active||s.event.trigger("ajaxStop")))}return Ce},getJSON:function(e,i,n){return s.get(e,i,n,"json")},getScript:function(e,i){return s.get(e,void 0,i,"script")}}),s.each(["get","post"],function(e,i){s[i]=function(n,o,c,f){return B(o)&&(f=f||c,c=o,o=void 0),s.ajax(s.extend({url:n,type:i,dataType:f,data:o,success:c},s.isPlainObject(n)&&n))}}),s.ajaxPrefilter(function(e){var i;for(i in e.headers)i.toLowerCase()==="content-type"&&(e.contentType=e.headers[i]||"")}),s._evalUrl=function(e,i,n){return s.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(o){s.globalEval(o,i,n)}})},s.fn.extend({wrapAll:function(e){var i;return this[0]&&(B(e)&&(e=e.call(this[0])),i=s(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&i.insertBefore(this[0]),i.map(function(){for(var n=this;n.firstElementChild;)n=n.firstElementChild;return n}).append(this)),this},wrapInner:function(e){return B(e)?this.each(function(i){s(this).wrapInner(e.call(this,i))}):this.each(function(){var i=s(this),n=i.contents();n.length?n.wrapAll(e):i.append(e)})},wrap:function(e){var i=B(e);return this.each(function(n){s(this).wrapAll(i?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){s(this).replaceWith(this.childNodes)}),this}}),s.expr.pseudos.hidden=function(e){return!s.expr.pseudos.visible(e)},s.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},s.ajaxSettings.xhr=function(){try{return new l.XMLHttpRequest}catch(e){}};var Ol={0:200,1223:204},Bi=s.ajaxSettings.xhr();U.cors=!!Bi&&"withCredentials"in Bi,U.ajax=Bi=!!Bi,s.ajaxTransport(function(e){var i,n;if(U.cors||Bi&&!e.crossDomain)return{send:function(o,c){var f,h=e.xhr();if(h.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(f in e.xhrFields)h[f]=e.xhrFields[f];e.mimeType&&h.overrideMimeType&&h.overrideMimeType(e.mimeType),!e.crossDomain&&!o["X-Requested-With"]&&(o["X-Requested-With"]="XMLHttpRequest");for(f in o)h.setRequestHeader(f,o[f]);i=function(w){return function(){i&&(i=n=h.onload=h.onerror=h.onabort=h.ontimeout=h.onreadystatechange=null,w==="abort"?h.abort():w==="error"?typeof h.status!="number"?c(0,"error"):c(h.status,h.statusText):c(Ol[h.status]||h.status,h.statusText,(h.responseType||"text")!=="text"||typeof h.responseText!="string"?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=i(),n=h.onerror=h.ontimeout=i("error"),h.onabort!==void 0?h.onabort=n:h.onreadystatechange=function(){h.readyState===4&&l.setTimeout(function(){i&&n()})},i=i("abort");try{h.send(e.hasContent&&e.data||null)}catch(w){if(i)throw w}},abort:function(){i&&i()}}}),s.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),s.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return s.globalEval(e),e}}}),s.ajaxPrefilter("script",function(e){e.cache===void 0&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),s.ajaxTransport("script",function(e){if(e.crossDomain||e.scriptAttrs){var i,n;return{send:function(o,c){i=s("<script>").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(f){i.remove(),n=null,f&&c(f.type==="error"?404:200,f.type)}),Q.head.appendChild(i[0])},abort:function(){n&&n()}}}});var Is=[],ha=/(=)\?(?=&|$)|\?\?/;s.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Is.pop()||s.expando+"_"+En.guid++;return this[e]=!0,e}}),s.ajaxPrefilter("json jsonp",function(e,i,n){var o,c,f,h=e.jsonp!==!1&&(ha.test(e.url)?"url":typeof e.data=="string"&&(e.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&ha.test(e.data)&&"data");if(h||e.dataTypes[0]==="jsonp")return o=e.jsonpCallback=B(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,h?e[h]=e[h].replace(ha,"$1"+o):e.jsonp!==!1&&(e.url+=(di.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return f||s.error(o+" was not called"),f[0]},e.dataTypes[0]="json",c=l[o],l[o]=function(){f=arguments},n.always(function(){c===void 0?s(l).removeProp(o):l[o]=c,e[o]&&(e.jsonpCallback=i.jsonpCallback,Is.push(o)),f&&B(c)&&c(f[0]),f=c=void 0}),"script"}),U.createHTMLDocument=function(){var e=Q.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",e.childNodes.length===2}(),s.parseHTML=function(e,i,n){if(typeof e!="string")return[];typeof i=="boolean"&&(n=i,i=!1);var o,c,f;return i||(U.createHTMLDocument?(i=Q.implementation.createHTMLDocument(""),o=i.createElement("base"),o.href=Q.location.href,i.head.appendChild(o)):i=Q),c=Ve.exec(e),f=!n&&[],c?[i.createElement(c[1])]:(c=ni([e],i,f),f&&f.length&&s(f).remove(),s.merge([],c.childNodes))},s.fn.load=function(e,i,n){var o,c,f,h=this,w=e.indexOf(" ");return w>-1&&(o=$e(e.slice(w)),e=e.slice(0,w)),B(i)?(n=i,i=void 0):i&&typeof i=="object"&&(c="POST"),h.length>0&&s.ajax({url:e,type:c||"GET",dataType:"html",data:i}).done(function(x){f=arguments,h.html(o?s("<div>").append(s.parseHTML(x)).find(o):x)}).always(n&&function(x,C){h.each(function(){n.apply(this,f||[x.responseText,C,x])})}),this},s.expr.pseudos.animated=function(e){return s.grep(s.timers,function(i){return e===i.elem}).length},s.offset={setOffset:function(e,i,n){var o,c,f,h,w,x,C,I=s.css(e,"position"),N=s(e),L={};I==="static"&&(e.style.position="relative"),w=N.offset(),f=s.css(e,"top"),x=s.css(e,"left"),C=(I==="absolute"||I==="fixed")&&(f+x).indexOf("auto")>-1,C?(o=N.position(),h=o.top,c=o.left):(h=parseFloat(f)||0,c=parseFloat(x)||0),B(i)&&(i=i.call(e,n,s.extend({},w))),i.top!=null&&(L.top=i.top-w.top+h),i.left!=null&&(L.left=i.left-w.left+c),"using"in i?i.using.call(e,L):N.css(L)}},s.fn.extend({offset:function(e){if(arguments.length)return e===void 0?this:this.each(function(c){s.offset.setOffset(this,e,c)});var i,n,o=this[0];if(!!o)return o.getClientRects().length?(i=o.getBoundingClientRect(),n=o.ownerDocument.defaultView,{top:i.top+n.pageYOffset,left:i.left+n.pageXOffset}):{top:0,left:0}},position:function(){if(!!this[0]){var e,i,n,o=this[0],c={top:0,left:0};if(s.css(o,"position")==="fixed")i=o.getBoundingClientRect();else{for(i=this.offset(),n=o.ownerDocument,e=o.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&s.css(e,"position")==="static";)e=e.parentNode;e&&e!==o&&e.nodeType===1&&(c=s(e).offset(),c.top+=s.css(e,"borderTopWidth",!0),c.left+=s.css(e,"borderLeftWidth",!0))}return{top:i.top-c.top-s.css(o,"marginTop",!0),left:i.left-c.left-s.css(o,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&s.css(e,"position")==="static";)e=e.offsetParent;return e||At})}}),s.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n=i==="pageYOffset";s.fn[e]=function(o){return ot(this,function(c,f,h){var w;if(ce(c)?w=c:c.nodeType===9&&(w=c.defaultView),h===void 0)return w?w[i]:c[f];w?w.scrollTo(n?w.pageXOffset:h,n?h:w.pageYOffset):c[f]=h},e,o,arguments.length)}}),s.each(["top","left"],function(e,i){s.cssHooks[i]=tt(U.pixelPosition,function(n,o){if(o)return o=Fe(n,i),ui.test(o)?s(n).position()[i]+"px":o})}),s.each({Height:"height",Width:"width"},function(e,i){s.each({padding:"inner"+e,content:i,"":"outer"+e},function(n,o){s.fn[o]=function(c,f){var h=arguments.length&&(n||typeof c!="boolean"),w=n||(c===!0||f===!0?"margin":"border");return ot(this,function(x,C,I){var N;return ce(x)?o.indexOf("outer")===0?x["inner"+e]:x.document.documentElement["client"+e]:x.nodeType===9?(N=x.documentElement,Math.max(x.body["scroll"+e],N["scroll"+e],x.body["offset"+e],N["offset"+e],N["client"+e])):I===void 0?s.css(x,C,w):s.style(x,C,I,w)},i,h?c:void 0,h)}})}),s.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,i){s.fn[i]=function(n){return this.on(i,n)}}),s.fn.extend({bind:function(e,i,n){return this.on(e,null,i,n)},unbind:function(e,i){return this.off(e,null,i)},delegate:function(e,i,n,o){return this.on(i,e,n,o)},undelegate:function(e,i,n){return arguments.length===1?this.off(e,"**"):this.off(i,e||"**",n)},hover:function(e,i){return this.on("mouseenter",e).on("mouseleave",i||e)}}),s.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,i){s.fn[i]=function(n,o){return arguments.length>0?this.on(i,null,n,o):this.trigger(i)}});var Nl=/^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;s.proxy=function(e,i){var n,o,c;if(typeof i=="string"&&(n=e[i],i=e,e=n),!!B(e))return o=u.call(arguments,2),c=function(){return e.apply(i||this,o.concat(u.call(arguments)))},c.guid=e.guid=e.guid||s.guid++,c},s.holdReady=function(e){e?s.readyWait++:s.ready(!0)},s.isArray=Array.isArray,s.parseJSON=JSON.parse,s.nodeName=J,s.isFunction=B,s.isWindow=ce,s.camelCase=ct,s.type=he,s.now=Date.now,s.isNumeric=function(e){var i=s.type(e);return(i==="number"||i==="string")&&!isNaN(e-parseFloat(e))},s.trim=function(e){return e==null?"":(e+"").replace(Nl,"$1")},typeof define=="function"&&define.amd&&define("jquery",[],function(){return s});var Ul=l.jQuery,Wl=l.$;return s.noConflict=function(e){return l.$===s&&(l.$=Wl),e&&l.jQuery===s&&(l.jQuery=Ul),s},typeof t=="undefined"&&(l.jQuery=l.$=s),s})});var rl=Ea((md,tl)=>{"use strict";var{entries:Ho,setPrototypeOf:Bo,isFrozen:du,getPrototypeOf:hu,getOwnPropertyDescriptor:pu}=Object,{freeze:kt,seal:Yt,create:jo}=Object,{apply:cs,construct:fs}=typeof Reflect!="undefined"&&Reflect;kt||(kt=function(t){return t});Yt||(Yt=function(t){return t});cs||(cs=function(t,r,a){return t.apply(r,a)});fs||(fs=function(t,r){return new t(...r)});var Qn=Rt(Array.prototype.forEach),mu=Rt(Array.prototype.lastIndexOf),zo=Rt(Array.prototype.pop),sn=Rt(Array.prototype.push),gu=Rt(Array.prototype.splice),Jn=Rt(String.prototype.toLowerCase),ds=Rt(String.prototype.toString),Go=Rt(String.prototype.match),on=Rt(String.prototype.replace),vu=Rt(String.prototype.indexOf),bu=Rt(String.prototype.trim),ur=Rt(Object.prototype.hasOwnProperty),Dt=Rt(RegExp.prototype.test),ln=yu(TypeError);function Rt(l){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),u=1;u<r;u++)a[u-1]=arguments[u];return cs(l,t,a)}}function yu(l){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return fs(l,r)}}function Ae(l,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Jn;Bo&&Bo(l,null);let a=t.length;for(;a--;){let u=t[a];if(typeof u=="string"){let d=r(u);d!==u&&(du(t)||(t[a]=d),u=d)}l[u]=!0}return l}function xu(l){for(let t=0;t<l.length;t++)ur(l,t)||(l[t]=null);return l}function Ei(l){let t=jo(null);for(let[r,a]of Ho(l))ur(l,r)&&(Array.isArray(a)?t[r]=xu(a):a&&typeof a=="object"&&a.constructor===Object?t[r]=Ei(a):t[r]=a);return t}function un(l,t){for(;l!==null;){let a=pu(l,t);if(a){if(a.get)return Rt(a.get);if(typeof a.value=="function")return Rt(a.value)}l=hu(l)}function r(){return null}return r}var Vo=kt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),hs=kt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ps=kt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),wu=kt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ms=kt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eu=kt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qo=kt(["#text"]),Yo=kt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),gs=kt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Xo=kt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kn=kt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_u=Yt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Tu=Yt(/<%[\w\W]*|[\w\W]*%>/gm),Su=Yt(/\$\{[\w\W]*/gm),Au=Yt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cu=Yt(/^aria-[\-\w]+$/),Qo=Yt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pu=Yt(/^(?:\w+script|data):/i),ku=Yt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jo=Yt(/^html$/i),Du=Yt(/^[a-z][.\w]*(-[.\w]+)+$/i),Ko=Object.freeze({__proto__:null,ARIA_ATTR:Cu,ATTR_WHITESPACE:ku,CUSTOM_ELEMENT:Du,DATA_ATTR:Au,DOCTYPE_NAME:Jo,ERB_EXPR:Tu,IS_ALLOWED_URI:Qo,IS_SCRIPT_OR_DATA:Pu,MUSTACHE_EXPR:_u,TMPLIT_EXPR:Su}),cn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ru=function(){return typeof window=="undefined"?null:window},Lu=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null,u="data-tt-policy-suffix";r&&r.hasAttribute(u)&&(a=r.getAttribute(u));let d="dompurify"+(a?"#"+a:"");try{return t.createPolicy(d,{createHTML(m){return m},createScriptURL(m){return m}})}catch(m){return console.warn("TrustedTypes policy "+d+" could not be created."),null}},Zo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function el(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ru(),t=ae=>el(ae);if(t.version="3.2.4",t.removed=[],!l||!l.document||l.document.nodeType!==cn.document||!l.Element)return t.isSupported=!1,t;let{document:r}=l,a=r,u=a.currentScript,{DocumentFragment:d,HTMLTemplateElement:m,Node:y,Element:b,NodeFilter:D,NamedNodeMap:W=l.NamedNodeMap||l.MozNamedAttrMap,HTMLFormElement:le,DOMParser:H,trustedTypes:U}=l,B=b.prototype,ce=un(B,"cloneNode"),Q=un(B,"remove"),we=un(B,"nextSibling"),ke=un(B,"childNodes"),he=un(B,"parentNode");if(typeof m=="function"){let ae=r.createElement("template");ae.content&&ae.content.ownerDocument&&(r=ae.content.ownerDocument)}let de,He="",{implementation:s,createNodeIterator:ue,createDocumentFragment:J,getElementsByTagName:De}=r,{importNode:et}=a,Me=Zo();t.isSupported=typeof Ho=="function"&&typeof he=="function"&&s&&s.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ve,ERB_EXPR:Qe,TMPLIT_EXPR:St,DATA_ATTR:wr,ARIA_ATTR:mt,IS_SCRIPT_OR_DATA:Er,ATTR_WHITESPACE:gt,CUSTOM_ELEMENT:Kr}=Ko,{IS_ALLOWED_URI:Zr}=Ko,Ve=null,vt=Ae({},[...Vo,...hs,...ps,...ms,...qo]),qe=null,Ci=Ae({},[...Yo,...gs,...Xo,...Kn]),ze=Object.seal(jo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_r=null,ei=null,ti=!0,bt=!0,Pi=!1,Jt=!0,Ut=!1,Nr=!0,Kt=!1,Tr=!1,ut=!1,ot=!1,Sr=!1,Zt=!1,Ur=!0,ct=!1,er="user-content-",Bt=!0,te=!1,Ge={},tr=null,ri=Ae({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ii=null,Wr=Ae({},["audio","video","img","source","image","track"]),Ar=null,rr=Ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml",jt=nt,fr=!1,$r=null,Hr=Ae({},[ft,At,nt],ds),Cr=Ae({},["mi","mo","mn","ms","mtext"]),Wt=Ae({},["annotation-xml"]),yt=Ae({},["title","style","font","a","script"]),dr=null,ki=["application/xhtml+xml","text/html"],dt="text/html",Pe=null,zt=null,$i=r.createElement("form"),ni=function(T){return T instanceof RegExp||T instanceof Function},Br=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(zt&&zt===T)){if((!T||typeof T!="object")&&(T={}),T=Ei(T),dr=ki.indexOf(T.PARSER_MEDIA_TYPE)===-1?dt:T.PARSER_MEDIA_TYPE,Pe=dr==="application/xhtml+xml"?ds:Jn,Ve=ur(T,"ALLOWED_TAGS")?Ae({},T.ALLOWED_TAGS,Pe):vt,qe=ur(T,"ALLOWED_ATTR")?Ae({},T.ALLOWED_ATTR,Pe):Ci,$r=ur(T,"ALLOWED_NAMESPACES")?Ae({},T.ALLOWED_NAMESPACES,ds):Hr,Ar=ur(T,"ADD_URI_SAFE_ATTR")?Ae(Ei(rr),T.ADD_URI_SAFE_ATTR,Pe):rr,ii=ur(T,"ADD_DATA_URI_TAGS")?Ae(Ei(Wr),T.ADD_DATA_URI_TAGS,Pe):Wr,tr=ur(T,"FORBID_CONTENTS")?Ae({},T.FORBID_CONTENTS,Pe):ri,_r=ur(T,"FORBID_TAGS")?Ae({},T.FORBID_TAGS,Pe):{},ei=ur(T,"FORBID_ATTR")?Ae({},T.FORBID_ATTR,Pe):{},Ge=ur(T,"USE_PROFILES")?T.USE_PROFILES:!1,ti=T.ALLOW_ARIA_ATTR!==!1,bt=T.ALLOW_DATA_ATTR!==!1,Pi=T.ALLOW_UNKNOWN_PROTOCOLS||!1,Jt=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ut=T.SAFE_FOR_TEMPLATES||!1,Nr=T.SAFE_FOR_XML!==!1,Kt=T.WHOLE_DOCUMENT||!1,ot=T.RETURN_DOM||!1,Sr=T.RETURN_DOM_FRAGMENT||!1,Zt=T.RETURN_TRUSTED_TYPE||!1,ut=T.FORCE_BODY||!1,Ur=T.SANITIZE_DOM!==!1,ct=T.SANITIZE_NAMED_PROPS||!1,Bt=T.KEEP_CONTENT!==!1,te=T.IN_PLACE||!1,Zr=T.ALLOWED_URI_REGEXP||Qo,jt=T.NAMESPACE||nt,Cr=T.MATHML_TEXT_INTEGRATION_POINTS||Cr,Wt=T.HTML_INTEGRATION_POINTS||Wt,ze=T.CUSTOM_ELEMENT_HANDLING||{},T.CUSTOM_ELEMENT_HANDLING&&ni(T.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ze.tagNameCheck=T.CUSTOM_ELEMENT_HANDLING.tagNameCheck),T.CUSTOM_ELEMENT_HANDLING&&ni(T.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ze.attributeNameCheck=T.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),T.CUSTOM_ELEMENT_HANDLING&&typeof T.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ze.allowCustomizedBuiltInElements=T.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ut&&(bt=!1),Sr&&(ot=!0),Ge&&(Ve=Ae({},qo),qe=[],Ge.html===!0&&(Ae(Ve,Vo),Ae(qe,Yo)),Ge.svg===!0&&(Ae(Ve,hs),Ae(qe,gs),Ae(qe,Kn)),Ge.svgFilters===!0&&(Ae(Ve,ps),Ae(qe,gs),Ae(qe,Kn)),Ge.mathMl===!0&&(Ae(Ve,ms),Ae(qe,Xo),Ae(qe,Kn))),T.ADD_TAGS&&(Ve===vt&&(Ve=Ei(Ve)),Ae(Ve,T.ADD_TAGS,Pe)),T.ADD_ATTR&&(qe===Ci&&(qe=Ei(qe)),Ae(qe,T.ADD_ATTR,Pe)),T.ADD_URI_SAFE_ATTR&&Ae(Ar,T.ADD_URI_SAFE_ATTR,Pe),T.FORBID_CONTENTS&&(tr===ri&&(tr=Ei(tr)),Ae(tr,T.FORBID_CONTENTS,Pe)),Bt&&(Ve["#text"]=!0),Kt&&Ae(Ve,["html","head","body"]),Ve.table&&(Ae(Ve,["tbody"]),delete _r.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw ln('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ln('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');de=T.TRUSTED_TYPES_POLICY,He=de.createHTML("")}else de===void 0&&(de=Lu(U,u)),de!==null&&typeof He=="string"&&(He=de.createHTML(""));kt&&kt(T),zt=T}},ir=Ae({},[...hs,...ps,...wu]),nr=Ae({},[...ms,...Eu]),ai=function(T){let V=he(T);(!V||!V.tagName)&&(V={namespaceURI:jt,tagName:"template"});let ie=Jn(T.tagName),Fe=Jn(V.tagName);return $r[T.namespaceURI]?T.namespaceURI===At?V.namespaceURI===nt?ie==="svg":V.namespaceURI===ft?ie==="svg"&&(Fe==="annotation-xml"||Cr[Fe]):Boolean(ir[ie]):T.namespaceURI===ft?V.namespaceURI===nt?ie==="math":V.namespaceURI===At?ie==="math"&&Wt[Fe]:Boolean(nr[ie]):T.namespaceURI===nt?V.namespaceURI===At&&!Wt[Fe]||V.namespaceURI===ft&&!Cr[Fe]?!1:!nr[ie]&&(yt[ie]||!ir[ie]):!!(dr==="application/xhtml+xml"&&$r[T.namespaceURI]):!1},ht=function(T){sn(t.removed,{element:T});try{he(T).removeChild(T)}catch(V){Q(T)}},jr=function(T,V){try{sn(t.removed,{attribute:V.getAttributeNode(T),from:V})}catch(ie){sn(t.removed,{attribute:null,from:V})}if(V.removeAttribute(T),T==="is")if(ot||Sr)try{ht(V)}catch(ie){}else try{V.setAttribute(T,"")}catch(ie){}},si=function(T){let V=null,ie=null;if(ut)T="<remove></remove>"+T;else{let Ye=Go(T,/^[\r\n\t ]+/);ie=Ye&&Ye[0]}dr==="application/xhtml+xml"&&jt===nt&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");let Fe=de?de.createHTML(T):T;if(jt===nt)try{V=new H().parseFromString(Fe,dr)}catch(Ye){}if(!V||!V.documentElement){V=s.createDocument(jt,"template",null);try{V.documentElement.innerHTML=fr?He:Fe}catch(Ye){}}let tt=V.body||V.documentElement;return T&&ie&&tt.insertBefore(r.createTextNode(ie),tt.childNodes[0]||null),jt===nt?De.call(V,Kt?"html":"body")[0]:Kt?V.documentElement:tt},Di=function(T){return ue.call(T.ownerDocument||T,T,D.SHOW_ELEMENT|D.SHOW_COMMENT|D.SHOW_TEXT|D.SHOW_PROCESSING_INSTRUCTION|D.SHOW_CDATA_SECTION,null)},zr=function(T){return T instanceof le&&(typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||!(T.attributes instanceof W)||typeof T.removeAttribute!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function")},Ri=function(T){return typeof y=="function"&&T instanceof y};function $t(ae,T,V){Qn(ae,ie=>{ie.call(t,T,V,zt)})}let oi=function(T){let V=null;if($t(Me.beforeSanitizeElements,T,null),zr(T))return ht(T),!0;let ie=Pe(T.nodeName);if($t(Me.uponSanitizeElement,T,{tagName:ie,allowedTags:Ve}),T.hasChildNodes()&&!Ri(T.firstElementChild)&&Dt(/<[/\w]/g,T.innerHTML)&&Dt(/<[/\w]/g,T.textContent)||T.nodeType===cn.progressingInstruction||Nr&&T.nodeType===cn.comment&&Dt(/<[/\w]/g,T.data))return ht(T),!0;if(!Ve[ie]||_r[ie]){if(!_r[ie]&&ar(ie)&&(ze.tagNameCheck instanceof RegExp&&Dt(ze.tagNameCheck,ie)||ze.tagNameCheck instanceof Function&&ze.tagNameCheck(ie)))return!1;if(Bt&&!tr[ie]){let Fe=he(T)||T.parentNode,tt=ke(T)||T.childNodes;if(tt&&Fe){let Ye=tt.length;for(let Xe=Ye-1;Xe>=0;--Xe){let xt=ce(tt[Xe],!0);xt.__removalCount=(T.__removalCount||0)+1,Fe.insertBefore(xt,we(T))}}}return ht(T),!0}return T instanceof b&&!ai(T)||(ie==="noscript"||ie==="noembed"||ie==="noframes")&&Dt(/<\/no(script|embed|frames)/i,T.innerHTML)?(ht(T),!0):(Ut&&T.nodeType===cn.text&&(V=T.textContent,Qn([ve,Qe,St],Fe=>{V=on(V,Fe," ")}),T.textContent!==V&&(sn(t.removed,{element:T.cloneNode()}),T.textContent=V)),$t(Me.afterSanitizeElements,T,null),!1)},Li=function(T,V,ie){if(Ur&&(V==="id"||V==="name")&&(ie in r||ie in $i))return!1;if(!(bt&&!ei[V]&&Dt(wr,V))){if(!(ti&&Dt(mt,V))){if(!qe[V]||ei[V]){if(!(ar(T)&&(ze.tagNameCheck instanceof RegExp&&Dt(ze.tagNameCheck,T)||ze.tagNameCheck instanceof Function&&ze.tagNameCheck(T))&&(ze.attributeNameCheck instanceof RegExp&&Dt(ze.attributeNameCheck,V)||ze.attributeNameCheck instanceof Function&&ze.attributeNameCheck(V))||V==="is"&&ze.allowCustomizedBuiltInElements&&(ze.tagNameCheck instanceof RegExp&&Dt(ze.tagNameCheck,ie)||ze.tagNameCheck instanceof Function&&ze.tagNameCheck(ie))))return!1}else if(!Ar[V]){if(!Dt(Zr,on(ie,gt,""))){if(!((V==="src"||V==="xlink:href"||V==="href")&&T!=="script"&&vu(ie,"data:")===0&&ii[T])){if(!(Pi&&!Dt(Er,on(ie,gt,"")))){if(ie)return!1}}}}}}return!0},ar=function(T){return T!=="annotation-xml"&&Go(T,Kr)},li=function(T){$t(Me.beforeSanitizeAttributes,T,null);let{attributes:V}=T;if(!V||zr(T))return;let ie={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:qe,forceKeepAttr:void 0},Fe=V.length;for(;Fe--;){let tt=V[Fe],{name:Ye,namespaceURI:Xe,value:xt}=tt,It=Pe(Ye),rt=Ye==="value"?xt:bu(xt);if(ie.attrName=It,ie.attrValue=rt,ie.keepAttr=!0,ie.forceKeepAttr=void 0,$t(Me.uponSanitizeAttribute,T,ie),rt=ie.attrValue,ct&&(It==="id"||It==="name")&&(jr(Ye,T),rt=er+rt),Nr&&Dt(/((--!?|])>)|<\/(style|title)/i,rt)){jr(Ye,T);continue}if(ie.forceKeepAttr||(jr(Ye,T),!ie.keepAttr))continue;if(!Jt&&Dt(/\/>/i,rt)){jr(Ye,T);continue}Ut&&Qn([ve,Qe,St],Gr=>{rt=on(rt,Gr," ")});let Pr=Pe(T.nodeName);if(!!Li(Pr,It,rt)){if(de&&typeof U=="object"&&typeof U.getAttributeType=="function"&&!Xe)switch(U.getAttributeType(Pr,It)){case"TrustedHTML":{rt=de.createHTML(rt);break}case"TrustedScriptURL":{rt=de.createScriptURL(rt);break}}try{Xe?T.setAttributeNS(Xe,Ye,rt):T.setAttribute(Ye,rt),zr(T)?ht(T):zo(t.removed)}catch(Gr){}}}$t(Me.afterSanitizeAttributes,T,null)},ui=function ae(T){let V=null,ie=Di(T);for($t(Me.beforeSanitizeShadowDOM,T,null);V=ie.nextNode();)$t(Me.uponSanitizeShadowNode,V,null),oi(V),li(V),V.content instanceof d&&ae(V.content);$t(Me.afterSanitizeShadowDOM,T,null)};return t.sanitize=function(ae){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},V=null,ie=null,Fe=null,tt=null;if(fr=!ae,fr&&(ae="<!-->"),typeof ae!="string"&&!Ri(ae))if(typeof ae.toString=="function"){if(ae=ae.toString(),typeof ae!="string")throw ln("dirty is not a string, aborting")}else throw ln("toString is not a function");if(!t.isSupported)return ae;if(Tr||Br(T),t.removed=[],typeof ae=="string"&&(te=!1),te){if(ae.nodeName){let xt=Pe(ae.nodeName);if(!Ve[xt]||_r[xt])throw ln("root node is forbidden and cannot be sanitized in-place")}}else if(ae instanceof y)V=si("<!---->"),ie=V.ownerDocument.importNode(ae,!0),ie.nodeType===cn.element&&ie.nodeName==="BODY"||ie.nodeName==="HTML"?V=ie:V.appendChild(ie);else{if(!ot&&!Ut&&!Kt&&ae.indexOf("<")===-1)return de&&Zt?de.createHTML(ae):ae;if(V=si(ae),!V)return ot?null:Zt?He:""}V&&ut&&ht(V.firstChild);let Ye=Di(te?ae:V);for(;Fe=Ye.nextNode();)oi(Fe),li(Fe),Fe.content instanceof d&&ui(Fe.content);if(te)return ae;if(ot){if(Sr)for(tt=J.call(V.ownerDocument);V.firstChild;)tt.appendChild(V.firstChild);else tt=V;return(qe.shadowroot||qe.shadowrootmode)&&(tt=et.call(a,tt,!0)),tt}let Xe=Kt?V.outerHTML:V.innerHTML;return Kt&&Ve["!doctype"]&&V.ownerDocument&&V.ownerDocument.doctype&&V.ownerDocument.doctype.name&&Dt(Jo,V.ownerDocument.doctype.name)&&(Xe="<!DOCTYPE "+V.ownerDocument.doctype.name+`>
|
|
`+Xe),Ut&&Qn([ve,Qe,St],xt=>{Xe=on(Xe,xt," ")}),de&&Zt?de.createHTML(Xe):Xe},t.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Br(ae),Tr=!0},t.clearConfig=function(){zt=null,Tr=!1},t.isValidAttribute=function(ae,T,V){zt||Br({});let ie=Pe(ae),Fe=Pe(T);return Li(ie,Fe,V)},t.addHook=function(ae,T){typeof T=="function"&&sn(Me[ae],T)},t.removeHook=function(ae,T){if(T!==void 0){let V=mu(Me[ae],T);return V===-1?void 0:gu(Me[ae],V,1)[0]}return zo(Me[ae])},t.removeHooks=function(ae){Me[ae]=[]},t.removeAllHooks=function(){Me=Zo()},t}var Fu=el();tl.exports=Fu});var vs=_a(Ra());var On=class{constructor(t,r){t=t||[],this.lines=t,this.text=r,this.offset2loc=new Map,this.line2offset=new Map;for(var a of t)a.offset>=0&&(this.offset2loc[a.offset]||(this.offset2loc[a.offset]=a),this.line2offset[a.line]||(this.line2offset[a.line]=a.offset))}findLineForOffset(t,r){if(this.offset2loc)for(var a=0;a<=r;a++){var u=this.offset2loc[t];if(u)return u;t--}return null}lineCount(){return this.lines.length}};function Js(l){return"errors"in l}function Ks(l){return"output"in l}var Zs=_a(Ra()),La=class{constructor(t){this.preset_id=Nt(t)}async getRemoteFile(t){return new Promise((r,a)=>Ln(t,r,mi(t)?"arraybuffer":"text"))}async getFileData(t){var r="presets/"+this.preset_id+"/"+t,a=await this.getRemoteFile(r);return a&&console.log("read",r,a.length,"bytes"),a}async setFileData(t,r){}};var Xi=class{constructor(t,r){this.basefs=t,this.overlayfs=r}async getFileData(t){var r=await this.overlayfs.getFileData(t);return r==null?this.basefs.getFileData(t):r}async setFileData(t,r){return await this.overlayfs.setFileData(t,r),this.basefs.setFileData(t,r)}},Fa=class{constructor(t){this.store=t}async getFileData(t){return this.store.getItem(t)}async setFileData(t,r){return this.store.setItem(t,r)}};var Ia=class{constructor(t,r,a,u){this.filedata={};this.pendingWorkerMessages=0;this.tools_preloaded={};this.isCompiling=!1;this.filename2path={};this.worker=t,this.platform_id=r,this.platform=a,this.filesystem=u,t.onmessage=d=>{this.receiveWorkerMessage(d.data)}}receiveWorkerMessage(t){var r=this.pendingWorkerMessages>1;r?(this.sendBuild(),this.pendingWorkerMessages=1):(this.callbackBuildStatus&&this.callbackBuildStatus(!1),this.isCompiling||(console.log(this.pendingWorkerMessages),console.trace()),this.isCompiling=!1,this.pendingWorkerMessages=0),t&&Ks(t)?this.processBuildResult(t):Js(t)&&this.processBuildListings(t),this.callbackBuildResult(t)}getToolForFilename(t){return this.remoteTool?"remote:"+this.remoteTool:this.platform.getToolForFilename(t)}preloadWorker(t){var r=this.getToolForFilename(t);r&&!this.tools_preloaded[r]&&(this.worker.postMessage({preload:r,platform:this.platform_id}),this.tools_preloaded[r]=!0)}pushAllFiles(t,r){t.push(r);var a=Ta(this.mainPath);a.length>0&&a!="local"&&t.push(a+"/"+r)}parseIncludeDependencies(t){let r=[],a;if(this.platform_id.startsWith("verilog")){let u=/^\s*(`include|[.]include)\s+"(.+?)"/gmi;for(;a=u.exec(t);)this.pushAllFiles(r,a[2]);let d=/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi;for(;a=d.exec(t);)this.pushAllFiles(r,a[2]);let m=/^\s*([.]arch)\s+(\w+)/gmi;for(;a=m.exec(t);)this.pushAllFiles(r,a[2]+".json");let y=/\$readmem[bh]\("(.+?)"/gmi;for(;a=y.exec(t);)this.pushAllFiles(r,a[1])}else{let u=/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi;for(;a=u.exec(t);)this.pushAllFiles(r,a[2]);let d=/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm;for(;a=d.exec(t);)this.pushAllFiles(r,a[3]);let m=/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm;for(;a=m.exec(t);)this.pushAllFiles(r,a[2]);let y=/^\s*(import|embed)\s*"(.+?)";/gmi;for(;a=y.exec(t);)a[1]=="import"?this.pushAllFiles(r,a[2]+".wiz"):this.pushAllFiles(r,a[2]);let b=/^\s*(import)\s*"(.+?)"/gmi;for(;a=b.exec(t);)this.pushAllFiles(r,a[2]);let D=/^[!]src\s+"(.+?)"/gmi;for(;a=D.exec(t);)this.pushAllFiles(r,a[1])}return r}parseLinkDependencies(t){let r=[],a;if(!this.platform_id.startsWith("verilog")){let u=/^\s*([;]|[/][/])#link\s+"(.+?)"/gm;for(;a=u.exec(t);)this.pushAllFiles(r,a[2])}return r}loadFileDependencies(t){let r=this.parseIncludeDependencies(t),a=this.parseLinkDependencies(t),u=r.concat(a);return this.loadFiles(u).then(d=>{if(d)for(let m of d)m.link=a.indexOf(m.path)>=0;return d})}okToSend(){return this.pendingWorkerMessages++==0&&this.mainPath!=null}updateFileInStore(t,r){this.filesystem.setFileData(t,r)}buildWorkerMessage(t){this.preloadWorker(this.mainPath);var r={updates:[],buildsteps:[]},a=this.stripLocalPath(this.mainPath),u=this.getFile(this.mainPath),d=[];r.updates.push({path:a,data:u}),this.filename2path[a]=this.mainPath;let y=this.getToolForFilename(this.mainPath).startsWith("remote:");for(var b of t)(!b.link||y)&&(r.updates.push({path:b.filename,data:b.data}),d.push(b.filename)),this.filename2path[b.filename]=b.path;r.buildsteps.push({path:a,files:[a].concat(d),platform:this.platform_id,tool:this.getToolForFilename(this.mainPath),mainfile:!0});for(var b of t)b.data&&b.link&&(this.preloadWorker(b.filename),r.updates.push({path:b.filename,data:b.data}),r.buildsteps.push({path:b.filename,files:[b.filename].concat(d),platform:this.platform_id,tool:this.getToolForFilename(b.path)}));return this.dataItems&&(r.setitems=this.dataItems),r}async loadFiles(t){var r=[],a=(m,y)=>{r.push({path:m,filename:this.stripLocalPath(m),link:!0,data:y})};for(var u of t)if(u in this.filedata){var d=this.filedata[u];d&&a(u,d)}else{var d=await this.filesystem.getFileData(u);d?(this.filedata[u]=d,a(u,d)):this.filedata[u]=null}return r}getFile(t){return this.filedata[t]}iterateFiles(t){for(var r in this.filedata)t(r,this.getFile(r))}sendBuild(){if(!this.mainPath)throw Error("need to call setMainFile first");var t=this.getFile(this.mainPath);if(t instanceof Uint8Array){this.isCompiling=!0,this.receiveWorkerMessage({output:t,errors:[],listings:null,symbolmap:null,params:{}});return}var r=typeof t=="string"?t:"";return this.loadFileDependencies(r).then(a=>{a||(a=[]);var u=this.buildWorkerMessage(a);this.worker.postMessage(u),this.isCompiling=!0})}updateFile(t,r){this.filedata[t]!=r&&(this.updateFileInStore(t,r),this.filedata[t]=r,this.okToSend()&&(this.callbackBuildStatus&&this.callbackBuildStatus(!0),this.sendBuild()))}setMainFile(t){this.mainPath=t,this.callbackBuildStatus&&this.callbackBuildStatus(!0),this.sendBuild()}processBuildListings(t){if(t.listings){this.listings=t.listings;for(var r in this.listings){var a=this.listings[r];a.lines&&(a.sourcefile=new On(a.lines,a.text)),a.asmlines&&(a.assemblyfile=new On(a.asmlines,a.text))}}}processBuildResult(t){this.processBuildListings(t),this.processBuildSegments(t)}processBuildSegments(t){var r=this.platform.getMemoryMap&&this.platform.getMemoryMap().main||[];(r==null?void 0:r.length)&&r.forEach(a=>a.source="native"),t.segments&&(t.segments.forEach(a=>a.source="linker"),r=r.concat(t.segments||[])),r.sort((a,u)=>a.start-u.start),this.segments=r}getListings(){return this.listings}getListingForFile(t){var r=Tt(this.stripLocalPath(t)),a=this.getListings();for(var u in a)if(u==t)return a[u];for(var u in a)if(Tt(u)==r)return a[u]}stripLocalPath(t){if(this.mainPath){var r=Ta(this.mainPath);r!=""&&t.startsWith(r+"/")&&(t=t.substring(r.length+1))}return t}updateDataItems(t){this.dataItems=t,this.okToSend()&&this.sendBuild()}};function Nn(l){var t=Zs.default.createInstance({name:"__"+l,version:2});return t}var Ma=to(),Oa=class{constructor(t,r){this.id2window={};this.id2createfn={};this.id2showfn={};this.id2div={};this.containerdiv=t,this.project=r,this.undofiles=[]}isWindow(t){return this.id2createfn[t]!=null}setCreateFunc(t,r){this.id2createfn[t]=r}setShowFunc(t,r){this.id2showfn[t]=r}create(t){var r=this.id2window[t];r||(console.log("creating window",t),r=this.id2window[t]=this.id2createfn[t](t));var a=this.id2div[t];return a||(a=this.id2div[t]=r.createDiv(this.containerdiv),Ma(a).hide()),r}createOrShow(t,r){var a=this.create(t),u=this.id2div[t];return this.activewnd!=a?(this.activediv&&Ma(this.activediv).hide(),this.activewnd&&this.activewnd.setVisible&&this.activewnd.setVisible(!1),this.activediv=u,this.activewnd=a,Ma(u).show(),this.refresh(!0),this.refreshErrors(),a.setVisible&&a.setVisible(!0),this.id2showfn[t]&&this.id2showfn[t](t,a)):this.refresh(r),this.activeid=t,a}put(t,r){this.id2window[t]=r}refresh(t){this.activewnd&&this.activewnd.refresh&&this.activewnd.refresh(t)}tick(){this.activewnd&&this.activewnd.tick&&this.activewnd.tick()}setErrors(t){this.lasterrors=t,this.refreshErrors()}refreshErrors(){this.activewnd&&this.activewnd.markErrors&&(this.lasterrors&&this.lasterrors.length?this.activewnd.markErrors(this.lasterrors):this.activewnd.clearErrors())}getActive(){return this.activewnd}getActiveID(){return this.activeid}getCurrentText(){if(this.activewnd&&this.activewnd.getValue)return this.activewnd.getValue();bootbox.alert("Please switch to an editor window.")}resize(){this.activeid&&this.activewnd&&this.activewnd.recreateOnResize&&(this.activewnd=null,this.id2window[this.activeid]=null,this.id2div[this.activeid]=null,this.createOrShow(this.activeid))}updateFile(t,r){var a=this.id2window[t];a&&a.setText&&typeof r=="string"?(a.setText(r),this.undofiles.push(t)):this.project.updateFile(t,r)}undoStep(){var t=this.undofiles.pop(),r=this.id2window[t];r&&r.undoStep?r.undoStep():bootbox.alert("No more steps to undo.")}updateAllOpenWindows(t){for(var r in this.id2window){var a=this.id2window[r];a&&a.setText&&t.getItem(r).then(u=>{this.updateFile(r,u)})}}findWindowWithFilePrefix(t){t=Ot(Tt(t));for(var r in this.id2createfn)if(!(r.toLowerCase().endsWith(".h")||r.toLowerCase().endsWith(".inc")||r.toLowerCase().endsWith(".bas"))&&Ot(Tt(r))==t)return r;return null}};var Xl=`$NAME
|
|
=====
|
|
|
|
[Open this project in 8bitworkshop](http://8bitworkshop.com/redir.html?platform=$PLATFORM&githubURL=$GITHUBURL&file=$MAINFILE).
|
|
`;function Ni(){for(var l={},t=0;t<localStorage.length;t++){var r=localStorage.key(t);if(r.startsWith("__repo__")){var a=JSON.parse(localStorage.getItem(r)),u=r.substring("__repo__".length);l[u]=a}}return l}function Qi(l){var t=l.split("/",8);return t.length<5||t[0]!="https:"||t[2]!="github.com"||t[5]&&t[5]!="tree"?null:{user:t[3],repo:t[4],repopath:t[3]+"/"+t[4],branch:t[6],subtreepath:t[7]}}var Na=class{constructor(t,r,a,u){this.githubCons=t,this.githubToken=r,this.store=a,this.project=u,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((r,a)=>{r()});var t=new firebase.auth.GithubAuthProvider;return t.addScope("repo"),firebase.auth().signInWithPopup(t).then(r=>{this.githubToken=r.credential.accessToken;var a=r.user;this.recreateGithub(),document.cookie="__github_key="+this.githubToken+";path=/;max-age=31536000",console.log("Stored GitHub OAUTH key")})}logout(){return this.githubToken&&this.githubToken.length?firebase.auth().signOut().then(()=>{document.cookie="__github_key=;path=/;max-age=0",this.githubToken=null,this.recreateGithub()}):new Promise((t,r)=>{t()})}isFileIgnored(t){return t=t.toUpperCase(),!!(t.startsWith("LICENSE")||t.startsWith("README")||t.startsWith("."))}async getGithubSession(t){var r=Qi(t);if(!r)throw new Error("Please enter a valid GitHub URL.");var a=Ni()[r.repopath],u=r.branch||a&&a.branch,d=this.github.repos(r.user,r.repo);try{u=(await d.fetch()).defaultBranch||"master"}catch(y){console.log("could not fetch default branch: "+y),u="main"}console.log("branch =",u);var m={url:t,user:r.user,reponame:r.repo,repopath:r.repopath,branch:u,subtreepath:r.subtreepath,prefix:"",repo:d,platform_id:this.project?this.project.platform_id:a?a.platform_id:null};return m}getGithubHEADTree(t){var r;return this.getGithubSession(t).then(a=>(r=a,r.repo.git.refs.heads(r.branch).fetch())).then(a=>(r.head=a,r.sha=a.object.sha,r.repo.git.trees(r.sha).fetch())).then(a=>{if(r.subtreepath){for(let u of a.tree)if(u.type=="tree"&&u.path==r.subtreepath&&u.sha)return r.repo.git.trees(u.sha).fetch();throw Error("Cannot find subtree '"+r.subtreepath+"' in tree "+a.sha)}return a}).then(a=>(r.tree=a,r))}bind(t,r){var a="__repo__"+t.repopath;if(r){var u={url:t.url,branch:t.branch,platform_id:t.platform_id,mainPath:t.mainPath,sha:t.sha};console.log("storing",u),localStorage.setItem(a,JSON.stringify(u))}else localStorage.removeItem(a)}import(t){var r;return this.getGithubSession(t).then(a=>(r=a,r.repo.contents("README.md").read())).catch(a=>(console.log(a),console.log("no README.md found"),r.repo.fetch().then(u=>""))).then(a=>{var u;if(u=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(a),u&&u[1]&&(console.log("main path: '"+u[1]+"'"),r.mainPath=u[1]),u=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(a),u){if(console.log("platform id: '"+u[1]+"'"),r.platform_id&&!r.platform_id.startsWith(u[1]))throw Error("Platform mismatch: Repository is "+u[1]+", you have "+r.platform_id+" selected.");r.platform_id=u[1]}return this.bind(r,!0),r})}pull(t,r){var a;return this.getGithubHEADTree(t).then(u=>{a=u;let d=[];return a.paths=[],a.tree.tree.forEach(m=>{if(console.log(m.path,m.type,m.size),a.paths.push(m.path),m.type=="blob"&&!this.isFileIgnored(m.path)){var y=a.repo.git.blobs(m.sha).fetch().then(b=>{var D=a.prefix+m.path,W=m.size,le=b.encoding,H=b.content;if(b.encoding=="base64"){var U=Pn(atob(H)),B=mi(m.path,U);H=B?U:Dn(U)}return b.size!=H.length&&(H=H.slice(0,b.size)),(r||this.store).setItem(D,H)});d.push(y)}else console.log("ignoring "+m.path)}),Promise.all(d)}).then(u=>a)}importAndPull(t){return this.import(t).then(r=>this.pull(t))}publish(t,r,a,u){var d,m=this.project.platform_id,y=this.project.stripLocalPath(this.project.mainPath);return this.github.user.repos.create({name:t,description:r,private:u,auto_init:!1,license_template:a}).then(b=>{d=b;var D=Xl;D=D.replace(/\$NAME/g,encodeURIComponent(t)),D=D.replace(/\$PLATFORM/g,encodeURIComponent(m)),D=D.replace(/\$GITHUBURL/g,encodeURIComponent(d.htmlUrl)),D=D.replace(/\$MAINFILE/g,encodeURIComponent(y));var W={message:"8bitworkshop: updated metadata in README.md",content:btoa(D)};return d.contents("README.md").add(W)}).then(()=>this.getGithubSession(d.htmlUrl))}commit(t,r,a){var u;return r||(r="updated from 8bitworkshop.com"),this.getGithubHEADTree(t).then(d=>{if(u=d,u.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(a.map(m=>typeof m.data=="string"?u.repo.git.blobs.create({content:m.data,encoding:"utf-8"}):u.repo.git.blobs.create({content:btoa(kn(m.data)),encoding:"base64"})))}).then(d=>u.repo.git.trees.create({tree:a.map((m,y)=>({path:m.path,mode:"100644",type:"blob",sha:d[y].sha})),base_tree:u.tree.sha})).then(d=>u.repo.git.commits.create({message:r,tree:d.sha,parents:[u.head.object.sha]})).then(d=>u.repo.commits(d.sha).fetch()).then(d=>(u.commit=d,u))}push(t){return t.head.update({sha:t.commit.sha}).then(r=>t)}deleteRepository(t){return this.getGithubSession(t).then(r=>r.repo.remove())}};var Ji=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function Lr(l,t){var r=$(document.createElement("div"));return l&&r.appendTo(l),t&&r.addClass(t),r}function ro(l,t){var r=l.charCoords({line:t,ch:0},"local").top,a=l.getScrollerElement().offsetHeight/2;l.scrollTo(null,r-a-5)}function io(l,t){var r=document.createElement("span");return r.setAttribute("class",t),r.appendChild(document.createTextNode(l)),r}var Wn=64,Ql=200,Ua={default:{theme:"mbo"},"6502":{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:"cobalt"},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noLineNumbers:!0,noGutters:!0},ecs:{theme:"mbo",isAsm:!0}},no={input:null},Ki=class{constructor(t,r){this.updateTimer=null;this.dirtylisting=!0;this.errormsgs=[];this.errorwidgets=[];this.errormarks=[];this.refreshDelayMsec=300;this.path=t,this.mode=r}createDiv(t){var r=document.createElement("div");r.setAttribute("class","editor"),t.appendChild(r);var a=ye.getFile(this.path),u=a&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(a);return this.newEditor(r,u),a&&(this.setText(a),this.editor.setSelection({line:0,ch:0},{line:0,ch:0},{scroll:!0})),this.setupEditor(),ye.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),r}setVisible(t){t&&this.editor.focus()}newEditor(t,r){var a=Ua[this.mode]||Ua.default,u=r||a.isAsm,d=!!a.lineWrap,m=a.theme||Ua.default.theme,y=!a.noLineNumbers&&!Ji;re.embed&&(y=!1,u=!1);var b=["CodeMirror-linenumbers","gutter-offset","gutter-info"];u&&(b=["CodeMirror-linenumbers","gutter-offset","gutter-bytes","gutter-clock","gutter-info"]),(a.noGutters||Ji)&&(b=["gutter-info"]),this.editor=CodeMirror(t,{theme:m,lineNumbers:y,matchBrackets:!0,tabSize:8,indentAuto:!0,lineWrapping:d,gutters:b})}editorChanged(){clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>{ye.updateFile(this.path,this.editor.getValue())},this.refreshDelayMsec),this.markHighlight&&(this.markHighlight.clear(),this.markHighlight=null)}setupEditor(){this.editor.on("changes",(t,r)=>{this.editorChanged()}),this.editor.on("cursorActivity",t=>{this.inspectUnderCursor()}),this.editor.on("gutterClick",(t,r)=>{this.toggleBreakpoint(r)}),this.editor.setOption("mode",this.mode),this.editor.on("beforeChange",(t,r)=>{no.input&&r.text&&(r.text=r.text.map(no.input))})}inspectUnderCursor(){var t=this.editor.getCursor(!0),r=this.editor.getCursor(!1);if(t.line==r.line&&t.ch<r.ch&&r.ch-t.ch<80){var a=this.editor.getSelection();this.inspect(a)}else this.inspect(null)}inspect(t){var r;if(P.inspect&&(r=P.inspect(t)),this.inspectWidget&&(this.inspectWidget.clear(),this.inspectWidget=null),r){var a=io(r,"tooltipinfoline"),u=this.editor.getCursor().line;this.inspectWidget=this.editor.addLineWidget(u,a,{above:!1})}}setText(t){var r,a,u=this.editor.getValue();u!=t&&(this.editor.setValue(t),u==""&&this.editor.clearHistory())}insertText(t){var r=this.editor.getCursor();this.editor.replaceRange(t,r,r)}highlightLines(t,r){var a="hilite-span",u={className:a,inclusiveLeft:!0};this.markHighlight=this.editor.markText({line:t,ch:0},{line:r,ch:0},u),this.editor.scrollIntoView({from:{line:t,ch:0},to:{line:r,ch:0}})}replaceSelection(t,r,a){this.editor.setSelection(this.editor.posFromIndex(t),this.editor.posFromIndex(r)),this.editor.replaceSelection(a)}getValue(){return this.editor.getValue()}getPath(){return this.path}addError(t){if(!t.path||this.path.endsWith(t.path)){var r=this.editor.lineCount(),a=t.line-1;if((isNaN(a)||a<0||a>=r)&&(a=0),this.addErrorMarker(a,t.msg),t.start!=null){var u={className:"mark-error",inclusiveLeft:!0},d={line:a,ch:t.end?t.start:t.start-1},m={line:a,ch:t.end?t.end:t.start},y=this.editor.markText(d,m,u);this.errormarks.push(y)}}}addErrorMarker(t,r){var a=document.createElement("div");a.setAttribute("class","tooltipbox tooltiperror"),a.appendChild(document.createTextNode("\u24CD")),this.editor.setGutterMarker(t,"gutter-info",a),this.errormsgs.push({line:t,msg:r}),$(a).mouseover(u=>{this.expandErrors()})}addErrorLine(t,r){var a=io(r,"tooltiperrorline");this.errorwidgets.push(this.editor.addLineWidget(t,a))}expandErrors(){for(var t;t=this.errormsgs.shift();)this.addErrorLine(t.line,t.msg)}markErrors(t){this.clearErrors(),t=t.slice(0,Ql);for(var r of t)this.addError(r)}clearErrors(){for(this.dirtylisting=!0,this.editor.clearGutter("gutter-info"),this.errormsgs=[];this.errorwidgets.length;)this.errorwidgets.shift().clear();for(;this.errormarks.length;)this.errormarks.shift().clear()}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors(),this.editor.clearGutter("gutter-bytes"),this.editor.clearGutter("gutter-offset"),this.editor.clearGutter("gutter-clock");var t=this.sourcefile.lines||[];for(var r of t)if(r.offset>=0&&this.setGutter("gutter-offset",r.line-1,Ne(r.offset&65535,4)),r.insns){var a=r.insns.length>9?"...":r.insns;if(this.setGutter("gutter-bytes",r.line-1,a),r.iscode){if(r.cycles)this.setGutter("gutter-clock",r.line-1,r.cycles+"");else if(P.getOpcodeMetadata){var u=parseInt(r.insns.split(" ")[0],16),d=P.getOpcodeMetadata(u,r.offset);if(d&&d.minCycles){var m=d.minCycles+"";this.setGutter("gutter-clock",r.line-1,m)}}}}}setGutter(t,r,a){var u=this.editor.lineInfo(r);if(!(u&&u.gutterMarkers&&u.gutterMarkers[t])){var d=document.createTextNode(a);this.editor.setGutterMarker(r,t,d)}}setGutterBytes(t,r){this.setGutter("gutter-bytes",t-1,r)}setTimingResult(t){if(this.editor.clearGutter("gutter-bytes"),this.sourcefile!=null)for(let d of Object.keys(this.sourcefile.line2offset)){let m=this.sourcefile.line2offset[d],y=t.pc2clockrange[m];var r=y&&y.minclocks,a=y&&y.maxclocks;if(r>=0&&a>=0){var u;a==r?u=r+"":u=r+"-"+a,a==t.MAX_CLOCKS&&(u+="+"),this.setGutterBytes(parseInt(d),u)}}}setCurrentLine(t,r){var a=P.isBlocked&&P.isBlocked(),u=y=>{var b=document.createElement("div"),D=a?"currentpc-marker-blocked":"currentpc-marker";b.classList.add(D),b.appendChild(document.createTextNode("\u25B6")),this.editor.setGutterMarker(y.line-1,"gutter-info",b)};if(this.clearCurrentLine(r),t){u(t),r&&this.editor.setCursor({line:t.line-1,ch:t.start||0},{scroll:!0});var d=a?"currentpc-span-blocked":"currentpc-span",m={className:d,inclusiveLeft:!0};t.start||t.end?this.markCurrentPC=this.editor.markText({line:t.line-1,ch:t.start},{line:t.line-1,ch:t.end||t.start+1},m):this.markCurrentPC=this.editor.markText({line:t.line-1,ch:0},{line:t.line,ch:0},m),this.currentDebugLine=t}}clearCurrentLine(t){this.currentDebugLine&&(this.editor.clearGutter("gutter-info"),t&&this.editor.setSelection(this.editor.getCursor()),this.currentDebugLine=null),this.markCurrentPC&&(this.markCurrentPC.clear(),this.markCurrentPC=null)}getActiveLine(){if(this.sourcefile){var t=Xr&&Xr.c;if(!t&&P.getCPUState&&!P.isRunning()&&(t=P.getCPUState()),t){var r=t&&(t.EPC||t.PC),a=this.sourcefile.findLineForOffset(r,Wn);return a}}}refreshDebugState(t){this.clearCurrentLine(t);var r=this.getActiveLine();r&&this.setCurrentLine(r,t)}refreshListing(){var t=ye.getListingForFile(this.path);t&&t.sourcefile&&t.sourcefile!==this.sourcefile&&(this.sourcefile=t.sourcefile,this.dirtylisting=!0),!(!this.sourcefile||!this.dirtylisting)&&(this.updateListing(),this.dirtylisting=!1)}refresh(t){this.refreshListing(),this.refreshDebugState(t)}tick(){this.refreshDebugState(!1)}getLine(t){return this.editor.getLine(t-1)}getCurrentLine(){return this.editor.getCursor().line+1}getCursorPC(){for(var t=this.getCurrentLine();this.sourcefile&&t>=0;){var r=this.sourcefile.line2offset[t];if(r>=0)return r;t--}return-1}undoStep(){this.editor.execCommand("undo")}toggleBreakpoint(t){if(this.sourcefile!=null){var r=this.sourcefile.line2offset[t+1];Zi(r)}}},Wa=1024,$n=class{getDisasmView(){return this.disasmview}createDiv(t){var r=document.createElement("div");return r.setAttribute("class","editor"),t.appendChild(r),this.newEditor(r),r}newEditor(t){this.disasmview=CodeMirror(t,{mode:"z80",theme:"cobalt",tabSize:8,readOnly:!0,styleActiveLine:!0})}refresh(t){let r=Xr||P.saveState(),a=r.c?r.c.PC:0,u=0,d=0,m=P.debugSymbols&&P.debugSymbols.addr2symbol||{},y=(W,le)=>{let H="",U=0;for(;U<le;){let B=W+U|0,ce=P.disassemble(B,P.readAddress.bind(P)),Q="",we="";for(let de=0;de<ce.nbytes;de++)Q+=Ne(P.readAddress(B+de));for(;Q.length<14;)Q+=" ";let ke=ce.line;if(m&&ce.isaddr&&(ke=ke.replace(/([^#])[$]([0-9A-F]+)/,(de,...He)=>{let s=parseInt(He[1],16),ue=m[s];return ue?He[0]+ue:(ue=m[s-1],ue?He[0]+ue+"+1":de)})),m){let de=m[B];de&&(we="; "+de)}H+=Ne(B,4)+" "+qi(Q,14)+" "+qi(ke,30)+we+`
|
|
`,B==a&&(d=u),u++,U+=ce.nbytes||1}return H};var b=a<0?a-Wa:Math.max(0,a-Wa);let D=y(b,a-b)+y(a,Wa);this.disasmview.setValue(D),t&&this.disasmview.setCursor(d,0),ro(this.disasmview,d)}getCursorPC(){var t=this.disasmview.getCursor().line;if(t>=0){var r=this.disasmview.getLine(t).trim().split(/\s+/);if(r&&r.length>=1){var a=parseInt(r[0],16);if(a>=0)return a}}return-1}},$a=class extends $n{constructor(t){super();this.path=t}refreshListing(){var t=ye.getListingForFile(this.path);this.assemblyfile=t&&(t.assemblyfile||t.sourcefile)}refresh(t){if(this.refreshListing(),!!this.assemblyfile){var r=this.assemblyfile.text,a=this.getDisasmView();if(a.setValue(r),!!P.saveState){var u=Xr||P.saveState(),d=u.c?u.c.EPC||u.c.PC:0;if(d>=0&&this.assemblyfile){var m=this.assemblyfile.findLineForOffset(d,Wn);m&&(t&&a.setCursor(m.line-1,0),ro(a,m.line-1))}}}}};function ao(l){return l.endsWith("_SIZE__")||l.endsWith("_LAST__")||l.endsWith("STACKSIZE__")||l.endsWith("FILEOFFS__")||l.startsWith("l__")||l.startsWith("s__")||l.startsWith(".__.")}var Hn=class{constructor(){this.recreateOnResize=!0;this.hibits=0;this.totalRows=5120}createDiv(t){var r=document.createElement("div");return r.setAttribute("class","memdump"),t.appendChild(r),this.showMemoryWindow(t,r),this.maindiv=r}showMemoryWindow(t,r){this.memorylist=new Bs({w:$(t).width(),h:$(t).height(),itemHeight:zs(),totalRows:this.totalRows,generatorFn:u=>{var d=this.getMemoryLineAt(u),m=document.createElement("div");if(this.dumplines){var y=this.dumplines[u];y&&m.classList.add("seg_"+this.getMemorySegment(this.dumplines[u].a|this.hibits))}return m.appendChild(document.createTextNode(d)),m}}),$(r).append(this.memorylist.container),this.tick();let a=en();a&&this.dumplines&&this.scrollToAddress(a.data_start)}scrollToAddress(t){this.dumplines&&(this.hibits=t&4294901760,this.memorylist.scrollToItem(this.findMemoryWindowLine(t&65535)))}refresh(){this.dumplines=null,this.tick()}tick(){this.memorylist&&$(this.maindiv).find("[data-index]").each((t,r)=>{var a=$(r),u=parseInt(a.attr("data-index")),d=a.text(),m=this.getMemoryLineAt(u);d!=m&&a.text(m)})}getMemoryLineAt(t){var r=t*16,a=0,u=16,d;if(this.getDumpLines()){var m=this.dumplines[t];if(m)r=m.a&65520,a=m.a-r,u=a+m.l,d=m.s;else return"."}for(var y=Ne(r+a,4)+" ",b=0;b<a;b++)y+=" ";a>8&&(y+=" ");for(var b=a;b<u;b++){var D=this.readAddress(r+b|this.hibits);b==8&&(y+=" "),y+=" "+(typeof D=="number"?Ne(D,2):"??")}for(var b=u;b<16;b++)y+=" ";return d&&(y+=" "+d),y}readAddress(t){return P.readAddress(t)}getDumpLineAt(t){var r=this.dumplines[t];if(r)return r.a+" "+r.s}getDumpLines(){var t=P.debugSymbols&&P.debugSymbols.addr2symbol||{};if(this.dumplines==null){this.dumplines=[];var r=0,a;for(let y of Object.keys(t)){var u=parseInt(y),d=t[u|this.hibits];if(a)for(ao(a)&&(a="");r<u&&this.dumplines.length<65536;){var m=r+16&1048560;m>u&&(m=u),this.dumplines.push({a:r,l:m-r,s:a}),r=m}a=d}}return this.dumplines}getMemorySegment(t){let r=en();if(r){if(t>=r.data_start&&t<r.data_start+r.data_size)return P.getSP&&t>=P.getSP()-15?"stack":"data";if(t>=r.code_start&&t<r.code_start+(r.code_size||r.rom_size))return"code"}var a=ye.segments;if(a){for(var u of a)if(t>=u.start&&t<u.start+u.size){if(u.type=="rom")return"code";if(u.type=="ram")return"data";if(u.type=="io")return"io"}}return"unknown"}findMemoryWindowLine(t){for(var r=0;r<this.dumplines.length;r++)if(this.dumplines[r].a>=t)return r}},Ha=class extends Hn{constructor(){super(...arguments);this.totalRows=2048}readAddress(t){return P.readVRAMAddress(t)}getMemorySegment(t){return"video"}getDumpLines(){return null}},Ba=class{constructor(t,r){this.recreateOnResize=!0;this.path=t,this.data=r}createDiv(t){return this.vlist=new Yi(t),this.vlist.create(t,this.data.length+15>>4,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=t*16,a=0,u=16,d=Ne(r+a,4)+" ",m=0;m<a;m++)d+=" ";a>8&&(d+=" ");for(var m=a;m<u;m++){var y=this.data[r+m];m==8&&(d+=" "),d+=" "+(y>=0?Ne(y,2):" ")}return{text:d}}refresh(){this.vlist.refresh()}getPath(){return this.path}},ja=class{createDiv(t){return this.maindiv=Lr(t,"vertical-scroll"),this.maindiv.css("display","grid"),this.maindiv.css("grid-template-columns","5em 40% 40%"),this.maindiv.css("align-content","start"),this.maindiv[0]}addSegment(t,r){if(r){var a=$('<div class="segment-offset" style="grid-column-start:1"/>');a.text("$"+Ne(t.start,4)),this.maindiv.append(a)}var u=$('<div class="segment"/>');u.text(t.name);let d=`$${Ne(t.start)} - $${Ne(t.last||t.start+t.size-1)}`;d+=` (${t.size} bytes)`,u.attr("title",d),(!r||t.source=="linker")&&u.css("grid-column-start",3);var m=Math.max(3,Math.log(t.size+1))*.5;u.css("height",m+"em"),t.type&&u.addClass("segment-"+t.type),this.maindiv.append(u),u.click(()=>{var y=me.createOrShow("#memory");y.scrollToAddress(t.start)})}refresh(){this.maindiv.empty();var t=ye.segments;if(t){var r=0,a=-1;for(var u of t)u.start>r&&this.addSegment({name:"",start:r,size:u.start-r},!0),this.addSegment(u,a!=u.start),a=u.start,r=u.start+u.size}}},or=4278190080,vi=class{constructor(){this.cumulativeData=!1;var t=160,r=262;try{t=Math.ceil(P.machine.cpuCyclesPerLine)||t,r=Math.ceil(P.machine.numTotalScanlines)||r}catch(a){}this.cyclesPerLine=t,this.totalScanlines=r}addr2symbol(t){var r=P.debugSymbols&&P.debugSymbols.addr2symbol||{};return r[t]}addr2str(t){var r=this.addr2symbol(t);return typeof r=="string"?"$"+Ne(t)+" ("+r+")":"$"+Ne(t)}showTooltip(t){t?(this.tooldiv||(this.tooldiv=document.createElement("div"),this.tooldiv.setAttribute("class","tooltiptrack"),document.body.appendChild(this.tooldiv)),$(this.tooldiv).text(t).show()):$(this.tooldiv).hide()}setVisible(t){t?(this.probe=P.startProbing(),this.probe.singleFrame=!this.cumulativeData,this.tick()):(this.probe&&(this.probe.singleFrame=!0),P.stopProbing(),this.probe=null)}redraw(t){var r=this.probe;if(!(!r||!r.idx)){var a=0,u=0,d=0;this.sp=0;for(var m=0;m<r.idx;m++){var y=r.buf[m],b=y&65535,D=y>>16&255,W=y∨switch(W){case ee.SCANLINE:a++,u=0;break;case ee.FRAME:a=0,u=0;break;case ee.CLOCKS:u+=b,d+=b;break;case ee.SP_PUSH:case ee.SP_POP:this.sp=b;default:t(W,b,u,a,d,D);break}}}}opToString(t,r,a){var u="";switch(t){case ee.EXECUTE:u="Exec";break;case ee.MEM_READ:u="Read";break;case ee.MEM_WRITE:u="Write";break;case ee.IO_READ:u="IO Read";break;case ee.IO_WRITE:u="IO Write";break;case ee.VRAM_READ:u="VRAM Read";break;case ee.VRAM_WRITE:u="VRAM Write";break;case ee.DMA_READ:u="DMA Read";break;case ee.DMA_WRITE:u="DMA Write";break;case ee.INTERRUPT:u="Interrupt";break;case ee.ILLEGAL:u="Error";break;case ee.WAIT:u="Wait";break;case ee.SP_PUSH:u="Stack Push";break;case ee.SP_POP:u="Stack Pop";break;default:return""}return typeof r=="number"&&(u+=" "+this.addr2str(r)),t&ee.HAS_VALUE&&typeof a=="number"&&(u+=" = $"+Ne(a,2)),u}getOpRGB(t,r){switch(t){case ee.EXECUTE:return 98305;case ee.MEM_READ:return 8388865;case ee.MEM_WRITE:return 65920;case ee.IO_READ:return 98432;case ee.IO_WRITE:return 12583296;case ee.DMA_READ:case ee.VRAM_READ:return 8421377;case ee.DMA_WRITE:case ee.VRAM_WRITE:return 4227264;case ee.INTERRUPT:return 4177727;case ee.ILLEGAL:return 4145151;case ee.WAIT:return 16727871;default:return 0}}},so=class extends vi{constructor(){super(...arguments);this.recreateOnResize=!0}createCanvas(t,r,a){var u=document.createElement("div"),d=document.createElement("canvas");return d.width=r,d.height=a,d.classList.add("pixelated"),d.style.width="100%",d.style.height="90vh",d.style.backgroundColor="black",d.style.cursor="crosshair",d.onmousemove=m=>{var y=In(d,m);this.showTooltip(this.getTooltipText(y.x,y.y)),$(this.tooldiv).css("left",m.pageX+10).css("top",m.pageY-30)},d.onmouseout=m=>{$(this.tooldiv).hide()},t.appendChild(u),u.appendChild(d),this.canvas=d,this.ctx=d.getContext("2d"),this.initCanvas(),this.maindiv=u}initCanvas(){}getTooltipText(t,r){return null}getOpAtPos(t,r,a){t=t|0,r=r|0;let u=0;return this.redraw((d,m,y,b,D,W)=>{!u&&b==r&&y>=t&&(d&a)!=0&&(u=d|m)}),u}clear(){}tick(){this.clear(),this.redraw(this.drawEvent.bind(this))}},za=class extends so{constructor(){super(...arguments);this.recreateOnResize=!1}createDiv(t){return this.createCanvas(t,this.cyclesPerLine,this.totalScanlines)}initCanvas(){this.imageData=this.ctx.createImageData(this.canvas.width,this.canvas.height),this.datau32=new Uint32Array(this.imageData.data.buffer)}getTooltipText(t,r){t=t|0,r=r|0;var a="",u=null,d=[],m=-1;return this.redraw((y,b,D,W,le,H)=>{switch(y){case ee.EXECUTE:u=this.addr2symbol(b)||u;break;case ee.SP_PUSH:d.push(u);break;case ee.SP_POP:u=d.pop();break}W==r&&D<=t&&(D!=m&&(a="",m=D),a==""&&u&&(a+=`
|
|
`+u),a+=`
|
|
`+this.opToString(y,b,H))}),"X: "+t+" Y: "+r+" "+a}refresh(){this.tick(),this.datau32.fill(or)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(or)}},Ga=class extends za{createDiv(t){return this.createCanvas(t,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=t=>{var r=In(this.canvas,t),a=Math.floor(r.x)+Math.floor(r.y)*256,u=-1,d=-1;this.redraw((m,y)=>{d<0&&u>=0&&y==a&&(d=u),m==ee.EXECUTE&&(u=y)}),d>=0&&Zi(d)}}clear(){for(var t=0;t<=65535;t++){var r=P.readAddress(t),a=r>>2|r&31;a|=a<<8|a<<16,this.datau32[t]=a|or}}drawEvent(t,r,a,u){var d=this.getOpRGB(t,r);if(!!d){var m=r&255,y=r>>8&255,b=this.datau32[r&65535];b=b|d|or,this.datau32[r&65535]=b}}getTooltipText(t,r){var a=(t&255)+(r<<8),u="",d=-1,m={},y=null,b=[];return this.redraw((D,W,le,H,U,B)=>{switch(D){case ee.EXECUTE:d=W,y=this.addr2symbol(W)||y;break;case ee.SP_PUSH:b.push(y);break;case ee.SP_POP:y=b.pop();break}var ce=D|d;W==a&&!m[ce]&&(u==""&&y&&(u+=`
|
|
`+y),u+=`
|
|
PC `+this.addr2str(d)+" "+this.opToString(D,null,B),m[ce]=1)}),this.addr2str(a)+u}},oo=class extends za{initCanvas(){super.initCanvas(),this.canvas.onclick=t=>{var r=In(this.canvas,t),a=Math.floor(r.x),u=Math.floor(r.y),d=this.getOpAtPos(r.x,r.y,ee.EXECUTE);d&&(yr("toline"),P.runEval(()=>{let m=P.getRasterScanline&&P.getRasterScanline()>=u;return m&&P.getRasterLineClock?m&&P.getRasterLineClock()>a:m}))}}drawEvent(t,r,a,u){var d=this.getOpRGB(t,r);if(!!d){var m=a+u*this.canvas.width,y=d|or;this.datau32[m]|=y}}drawImage(){let t=or;for(let r=0;r<this.datau32.length;r++)this.datau32[r]==or?this.datau32[r]=t:t=this.datau32[r];super.drawImage()}},Va=class extends oo{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,r,a,u){var d=a+u*this.canvas.width;if(t==ee.INTERRUPT&&(this.interrupt=1),this.interrupt==1&&t==ee.SP_PUSH&&(this.interrupt=r),this.interrupt>1&&this.sp>this.interrupt&&(this.interrupt=0),t==ee.MEM_WRITE&&(this.rgb|=47),t==ee.VRAM_WRITE&&(this.rgb|=16256),t==ee.IO_WRITE&&(this.rgb|=2047872),t==ee.IO_READ&&(this.rgb|=7936),t==ee.WAIT&&(this.rgb=32768),t==ee.ILLEGAL||t==ee.DMA_READ)this.datau32[d]=4279176975;else{let m=this.rgb;if(t==ee.EXECUTE){let y=this.sp&15;y>=8&&(y=16-y),Math.abs(this.lastpc)-r>16&&(y+=1),Math.abs(this.lastpc)-r>256&&(y+=1),m=this.rgb=526344*y+2105376,this.lastpc=r}this.interrupt&&(m|=8388672),this.datau32[d]==or&&(this.datau32[d]=m|or)}}},qa=class extends vi{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new Yi(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var r="",a="seg_data",u=this.dumplines&&this.dumplines[t];if(u!=null){var d=u.info.join(", ");r="("+br(u.row,4)+", "+br(u.col,4)+") "+qi(u.asm||"",20)+d,d.indexOf("Write ")>=0&&(a="seg_io")}return{text:r,clas:a}}refresh(){this.tick()}tick(){let t=P instanceof ka||P instanceof Pa;this.dumplines={},this.redraw((r,a,u,d,m,y)=>{t&&(m>>=2);var b=this.dumplines[m];switch(b==null&&(b={op:r,addr:a,row:d,col:u,asm:null,info:[]},this.dumplines[m]=b),r){case ee.EXECUTE:if(P.disassemble){var D=P.disassemble(a,P.readAddress.bind(P));b.asm=D&&D.line}break;default:var W=this.opToString(r,a,y);W!=""&&b.info.push(W);break}}),this.vlist.refresh()}},Ya=class extends vi{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new Yi(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=br(t+"",3)+" ",a="seg_code",u=this.dumplines&&this.dumplines[t]||[],d=Math.round(this.cyclesPerLine/3.3),m=0;m<this.cyclesPerLine;m++){var y=u[m];if(y!==void 0){var b=y&65535,D=D∨if(D==ee.EXECUTE)r+=",";else{var W=Ne(b);r+=W,m+=W.length-1}}else r+=m==d?"|":"."}return u[-1]&&(r+=" "+u[-1]),{text:r,clas:a}}refresh(){this.tick()}tick(){let t=P instanceof ka||P instanceof Pa;this.dumplines={},this.redraw((r,a,u,d,m,y)=>{var b=this.dumplines[d];switch(b==null&&(this.dumplines[d]=b=[]),r){case ee.EXECUTE:var D=P.debugSymbols.addr2symbol[a];D&&(b[-1]=D);break;case ee.IO_READ:case ee.IO_WRITE:case ee.VRAM_READ:case ee.VRAM_WRITE:b[u]=r|a;break}}),this.vlist.refresh()}},Xa=class extends vi{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return P.debugSymbols&&P.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(P.debugSymbols.symbolmap).filter(r=>!ao(r))):this.keys=["no symbols defined"],this.vlist=new Yi(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:br("Symbol",35)+br("Reads",8)+br("Writes",8)};var r=this.keys[t-1],a=this.dumplines&&this.dumplines[r];function u(y){var b=a[y]|0;return br(b?b.toString():"",8)}var d,m;return a!=null?(d=br(r,35)+u(ee.MEM_READ)+u(ee.MEM_WRITE),a[ee.EXECUTE]?m="seg_code":a[ee.IO_READ]||a[ee.IO_WRITE]?m="seg_io":m="seg_data"):(d=br(r,35),m="seg_unknown"),{text:d,clas:m}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,r,a,u,d,m)=>{var y=P.debugSymbols.addr2symbol[r];if(y!=null){var b=this.dumplines[y];b==null&&(b={},this.dumplines[y]=b),b[t]=(b[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}};var Nf=qs(),Bn=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function Jl(l){return l.replace(/(\shex\s+)([0-9a-f]+)/ig,function(t,r,a){for(var u=r,d=0;d<a.length;d+=2)u+="0x"+a.substr(d,2)+",";return u})}function Kl(l){for(var t=[],r;r=Bn.exec(l);){var a;typeof r[4]!="undefined"?a=parseInt(r[5],2):r[2].startsWith("%")||r[2].endsWith("b")?a=parseInt(r[3],2):r[2].startsWith("x")||r[2].startsWith("$")||r[2].endsWith("h")?a=parseInt(r[3],16):a=parseInt(r[3]),t.push(a)}return t}function Zl(l,t){for(var r="",a,u=0,d=0;a=Bn.exec(l);)r+=l.slice(u,Bn.lastIndex-a[0].length),u=Bn.lastIndex,typeof a[4]!="undefined"?r+=a[4]+t[d++].toString(2):a[2].startsWith("%")?r+=a[1]+"%"+t[d++].toString(2):a[2].endsWith("b")?r+=a[1]+a[2]+t[d++].toString(2):a[2].endsWith("h")?r+=a[1]+a[2]+t[d++].toString(16):a[2].startsWith("x")?r+=a[1]+"x"+Ne(t[d++]):a[2].startsWith("$")?r+=a[1]+"$"+Ne(t[d++]):r+=a[1]+t[d++].toString();return r+=l.slice(u),r=r.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(m,y,b)=>{var D=y+b;return D=D.replace(/0x/ig,"").replace(/,/ig,""),D}),r}function lo(l,t){if(!t)return l;for(var r=0,a=0;a<t.length;a++){var u=t[a];u<0&&(u=-u-1,r^=1<<u),l&1<<a&&(r^=1<<u)}return r}function uo(l,t){var r=t[l%t.length];return[r>>3,r&7]}function eu(l,t){for(var r=t.w,a=t.h,u=t.count||1,d=t.bpp||1,m=t.np||1,y=t.bpw||8,b=t.sl||Math.ceil(r*d/y),D=(1<<d)-1,W=t.pofs||b*a*u,le=t.skip||0,H=t.wpimg||b*a,U=[],B=0;B<u;B++){for(var ce=[],Q=0;Q<a;Q++)for(var we=t.flip?a-1-Q:Q,ke=H*B+we*b,he=0,de=0;de<r;de++){var He=0,s=lo(ke,t.remap);t.reindex&&([s,he]=uo(de,t.reindex),s+=ke);for(var ue=0;ue<m;ue++){var J=l[s+ue*W+le];He|=((t.brev?J>>y-he-d:J>>he)&D)<<ue*d}ce.push(He),he+=d,he>=y&&!t.reindex&&(ke+=1,he=0)}U.push(new Uint8Array(ce))}return U}function tu(l,t){t.destfmt&&(t=t.destfmt);var r=t.w,a=t.h,u=t.count||1,d=t.bpp||1,m=t.np||1,y=t.bpw||8,b=t.sl||Math.ceil(t.w*d/y),D=(1<<d)-1,W=t.pofs||b*a*u,le=t.skip||0,H=t.wpimg||b*a,U;m>0&&t.sl?U=new Uint8Array(H*u):y<=8?U=new Uint8Array(H*u*m):U=new Uint32Array(H*u*m);for(var B=0;B<u;B++)for(var ce=l[B],Q=0,we=0;we<a;we++)for(var ke=t.flip?a-1-we:we,he=B*H+ke*b,de=0,He=0;He<r;He++){var s=ce[Q++],ue=lo(he,t.remap);t.reindex&&([ue,de]=uo(He,t.reindex),ue+=he);for(var J=0;J<m;J++){var De=s>>J*d&D;U[ue+J*W+le]|=t.brev?De<<y-de-d:De<<de}de+=d,de>=y&&!t.reindex&&(he+=1,de=0)}return U}function co(l,t,r,a,u,d,m){for(var y=[],b=0;b<l.length;b++){var D=l[b],W=4278190080;W|=(D>>t&(1<<r)-1)<<0+8-r,W|=(D>>a&(1<<u)-1)<<8+8-u,W|=(D>>d&(1<<m)-1)<<16+8-m,y.push(W)}return y}function ru(l){var t=l.pal;if(typeof t=="number"){var r=Math.floor(Math.abs(t/100)%10),a=Math.floor(Math.abs(t/10)%10),u=Math.floor(Math.abs(t)%10);return 1<<r+a+u}else{var d=ho[t];if(d)return d.length;throw new Error("No palette named "+t)}}function fo(l,t){var r=t.pal,a;if(typeof r=="number"){var u=Math.floor(Math.abs(r/100)%10),d=Math.floor(Math.abs(r/10)%10),m=Math.floor(Math.abs(r)%10);r>=0?a=co(l,0,u,u,d,u+d,m):a=co(l,u+d,m,u,d,0,u)}else{var y=ho[r];if(y)a=new Uint32Array(l).map(b=>y[b&y.length-1]|4278190080);else throw new Error("No palette named "+r)}return a}var ho={nes:[5395026,11796480,10485760,11599933,7602281,91,95,6208,12048,543240,26368,1196544,7153664,0,0,0,12899815,16728064,14421538,16729963,14090399,6818519,6588,21681,27227,35843,43776,2918400,10777088,0,0,0,16316664,16755516,16742785,16735173,16730354,14633471,4681215,46327,57599,58229,259115,7911470,15065624,7895160,0,0,16777215,16773822,16300216,16300248,16758527,16761855,13095423,10148607,8973816,8650717,12122296,16119980,16777136,16308472,0,0],ap2lores:[0,16711935,127,8323199,32512,8355711,191,255,12549888,16760576,12566463,16744319,65280,16776960,49023,16777215],vcs:[0,0,4210752,4210752,7105644,7105644,9474192,9474192,11579568,11579568,13158600,13158600,14474460,14474460,16053492,16053492,17476,17476,1074276,1074276,2393220,2393220,3448992,3448992,4241592,4241592,5296336,5296336,6088936,6088936,6880508,6880508,10352,10352,1328260,1328260,2645144,2645144,3963052,3963052,5016764,5016764,6070476,6070476,6862044,6862044,7915756,7915756,6276,6276,1586328,1586328,3166380,3166380,4745408,4745408,6062288,6062288,7378144,7378144,8431852,8431852,9747708,9747708,136,136,2105500,2105500,3947696,3947696,5789888,5789888,7368912,7368912,8947936,8947936,10526956,10526956,11842812,11842812,6029432,6029432,7610508,7610508,8928416,8928416,10246320,10246320,11563200,11563200,12616912,12616912,13671644,13671644,14725356,14725356,7864392,7864392,9445472,9445472,10763384,10763384,12081292,12081292,13398176,13398176,14451892,14451892,15506628,15506628,16560340,16560340,8650772,8650772,9969712,9969712,11287628,11287628,12605544,12605544,13660284,13660284,14715028,14715028,15507624,15507624,16561340,16561340,8912896,8912896,10231836,10231836,11550776,11550776,12606544,12606544,13661288,13661288,14716028,14716028,15508624,15508624,16562340,16562340,8132608,8132608,9451548,9451548,11031608,11031608,12349520,12349520,13404264,13404264,14457980,14457980,15512720,15512720,16566436,16566436,6040576,6040576,7883804,7883804,9463864,9463864,11306064,11306064,12622952,12622952,13939836,13939836,15256720,15256720,16572580,16572580,2898944,2898944,4742172,4742172,6585400,6585400,8428624,8428624,9745512,9745512,11325564,11325564,12641424,12641424,13958308,13958308,15360,15360,2120736,2120736,4226112,4226112,6069340,6069340,7648372,7648372,9228428,9228428,10806436,10806436,12123320,12123320,14356,14356,1858612,1858612,3701840,3701840,5281900,5281900,6861956,6861956,8178844,8178844,9495732,9495732,10812616,10812616,12332,12332,1855564,1855564,3436648,3436648,5016708,5016708,6596764,6596764,7913652,7913652,8967372,8967372,10284256,10284256,10308,10308,1591396,1591396,3172484,3172484,4490400,4490400,5807288,5807288,7124176,7124176,8178920,8178920,9232636,9232636],astrocade:[0,2368548,4737096,7171437,9539985,11974326,14342874,16777215,12255269,14680137,16716142,16725394,16734903,16744155,16753663,16762879,11534409,13959277,16318866,16721334,16730842,16740095,16749311,16758783,10420330,12779662,15138995,16718039,16727291,16736767,16745983,16755199,8847495,11206827,13631696,15994612,16724735,16733951,16743423,16752639,6946975,9306307,11731175,14092287,16461055,16732415,16741631,16751103,4784304,7143637,9568505,11929087,14297599,16731647,16741119,16750335,2425019,4784352,7209215,9570047,12004095,14372863,16741375,16750847,191,2359523,4718847,7146495,9515263,11949311,14318079,16752127,187,224,2294015,4658431,7092735,9461247,11895551,14264063,176,213,249,2367999,4736511,7105279,9539327,11908095,159,195,3303,209151,2577919,4946431,7380735,9749247,135,171,7888,17140,681983,3050495,5484543,7853311,106,3470,12723,22231,31483,1548031,3916799,6285311,73,8557,17810,27318,36570,373759,2742271,5176575,4389,13641,23150,32402,41911,51163,2026495,4456447,9472,18724,27976,37485,46737,56246,1834970,4194303,14080,23296,32803,42055,51564,60816,2031541,4456409,18176,27648,36864,46116,55624,392556,2752401,5177269,21760,30976,40192,49667,58919,1572683,3932016,6291348,24320,33536,43008,52224,716810,3079982,5504851,7864183,25856,35328,44544,250368,2619136,4980503,7405371,9764703,26624,35840,45312,2413824,4782336,7143173,9568041,11927374,26112,35584,2338560,4707328,7141376,9502464,11927326,14286659,24832,2393344,4762112,7196160,9564928,11992832,14352155,16711487,2447360,4815872,7250176,9618688,12052992,14417664,16776990,16777027,4803328,7172096,9606144,11974912,14343424,16776965,16777001,16777038,6962176,9330688,11764992,14133504,16502272,16773655,16777019,16777055,8858112,11226880,13660928,16029440,16759818,16769070,16777043,16777079,10426112,12794624,15163392,16745475,16754727,16764235,16773488,16777108,11534848,13969152,16337664,16740388,16749640,16759148,16768401,16777141,12255232,14684928,16725795,16735047,16744556,16753808,16763317,16772569],c64:[0,16777215,2832232,11707504,8797551,4427096,7940149,7325624,2445167,14659,5859226,4473924,7105644,8704666,11886188,9803157]},iu={nes:[["Screen Color",0,1],["Background 0",1,3],["Background 1",5,3],["Background 2",9,3],["Background 3",13,3],["Sprite 0",17,3],["Sprite 1",21,3],["Sprite 2",25,3],["Sprite 3",29,3]],astrocade:[["Left",0,-4],["Right",4,-4]]};function tn(l,t){if(l==null||t==null||l.length!==t.length)return!1;if(l===t)return!0;for(var r=0;r<l.length;r++)if(l[r]!==t[r])return!1;return!0}function jn(l,t){if(l==null||t==null||l.length!==t.length)return!1;if(l===t)return!0;for(var r=0;r<l.length;r++)if(!tn(l[r],t[r]))return!1;return!0}var Fr=class{refreshLeft(){for(var t=this;t;)t.updateLeft(),t=t.left}refreshRight(){for(var t=this;t;)t.updateRight(),t=t.right}addRight(t){return this.right=t,t.left=this,t}addLeft(t){return this.left=t,t.right=this,t}},Qa=class extends Fr{},zn=class extends Qa{constructor(t,r){super();this.project=t,this.fileid=r,this.label=r}updateLeft(){return this.words=this.right.words,this.project&&this.project.updateFile(this.fileid,this.words),!0}updateRight(){return this.project&&(this.words=this.project.project.getFile(this.fileid)),!0}},Ja=class extends Qa{constructor(t,r,a,u,d){super();this.project=t,this.fileid=r,this.label=a,this.start=u,this.end=d}updateLeft(){if(this.right.words.length!=this.words.length)throw Error("Cannot put "+this.right.words.length+" image bytes into array of "+this.words.length+" bytes");this.words=this.right.words;var t=this.text.substring(this.start,this.end);return t=Zl(t,this.words),this.text=this.text.substring(0,this.start)+t+this.text.substring(this.end),this.project&&this.project.updateFile(this.fileid,this.text),!0}updateRight(){this.project&&(this.text=this.project.project.getFile(this.fileid));var t=this.text.substring(this.start,this.end);t=Jl(t);var r=Kl(t);return this.words=r,!0}},Ka=class extends Fr{updateLeft(){return!1}updateRight(){return this.words=Hs(new Uint8Array(this.left.words)),!0}},Za=class extends Fr{constructor(t){super();this.fmt=t}updateLeft(){return this.images=this.right.images,this.words=tu(this.images,this.fmt),!0}updateRight(){return tn(this.words,this.left.words)?!1:(this.words=this.left.words,this.images=eu(this.words,this.fmt),!0)}},po=class{constructor(t){this.palcols=t}indexOf(t){return this.palcols.indexOf(t)}},Ui=class extends Fr{constructor(t,r){super();this.palindex=0;this.context=t,this.ncolors=1<<(r.bpp||1)*(r.np||1)}updateLeft(){this.right&&(this.rgbimgs=this.right.rgbimgs);var t=new po(this.palette),r=this.rgbimgs.map(a=>{for(var u=new Uint8Array(a.length),d=0;d<a.length;d++)u[d]=t.indexOf(a[d]);return u});return this.images=r,!0}updateRight(){if(!this.updateRefs()&&jn(this.images,this.left.images))return!1;this.images=this.left.images;var t=this.palette.length-1;return this.rgbimgs=this.images.map(r=>{for(var a=new Uint32Array(r.length),u=0;u<r.length;u++)a[u]=this.palette[r[u]&t];return a}),!0}updateRefs(){var t;return this.context!=null&&(this.paloptions=this.context.getPalettes(this.ncolors),this.paloptions&&this.paloptions.length>0&&(t=this.paloptions[this.palindex].palette)),t==null&&(this.ncolors<=2?t=new Uint32Array([4278190080,4294967295]):t=new Uint32Array([4278190080,4294902015,4294967040,4294967295])),tn(this.palette,t)?!1:(this.palette=t,!0)}};function nu(l){for(var t=new Map,r=new Uint32Array(l.length),a=0,u=0;u<l.length;u++){for(var d=l[u];t[d];)d^=++a;r[u]=d,t[d]=1}return r}var Gn=class extends Fr{constructor(t){super();this.palfmt=t}updateLeft(){return!0}updateRight(){return tn(this.words,this.left.words)?!1:(this.words=this.left.words,this.palette=nu(fo(this.words,this.palfmt)),this.layout=iu[this.palfmt.layout],this.rgbimgs=[],this.palette.forEach(t=>{this.rgbimgs.push(new Uint32Array([t]))}),!0)}getAllColors(){for(var t=[],r=0;r<ru(this.palfmt);r++)t.push(r);return fo(t,this.palfmt)}},mo=class extends Fr{constructor(t){super();this.tileindex=0;this.context=t}updateRefs(){var t=this.tilemap;return this.context!=null&&(this.tileoptions=this.context.getTilemaps(256),this.tileoptions&&this.tileoptions.length>0&&(this.tilemap=this.tileoptions[this.tileindex].images)),!jn(t,this.tilemap)}};var es=class extends mo{constructor(t){super(t)}updateLeft(){return!1}updateRight(){if(!this.updateRefs()&&tn(this.words,this.left.words))return!1;this.words=this.left.words,this.cols=32,this.rows=30,this.width=this.cols*8,this.height=this.rows*8,this.baseofs=0;var t=new Uint8Array(this.width*this.height);this.images=[t];for(var r=0,a,u=0;u<this.rows;u++)for(var d=0;d<this.cols;d++){var m=this.words[this.baseofs+r];if(typeof m=="undefined")throw Error("No name for address "+this.baseofs+" + "+r);var y=this.tilemap[m];if(!y)throw Error("No tilemap found for tile index "+m);a=r&11264|960|r&3072|r>>4&56|r>>2&7;for(var b=this.words[a],D=m^b<<9^2147483648,W=u*this.cols*8*8+d*8,le=0,H=(d&2)+((r&64)>>4),U=(b>>H&3)<<2,B=0;B<8;B++){for(var ce=0;ce<8;ce++){var Q=y[le++];Q&&(Q+=U),t[W++]=Q}W+=this.cols*8-8}r++}return!0}},Vn=class{recreate(t,r){var a=$('<div class="asset_grid"/>');t.empty().append(a);var u=Math.max(2,Math.ceil(16/this.width)),d=this.width<=8?16:8,m=null;this.rgbimgs.forEach((y,b)=>{var D=new qn;D.width=this.width,D.height=this.height,D.recreate(),D.canvas.style.width=D.width*u+"px",D.canvas.title="$"+Ne(b),D.updateImage(y),$(D.canvas).addClass("asset_cell"),$(D.canvas).click(le=>{r(b,D)}),m||(m=$("<span/>"),a.append(m)),m.append(D.canvas);var W=b%d==d-1;W&&(a.append($("<br/>")),m=null)})}};function bi(l,t){var r=$(document.createElement("div"));return l&&r.appendTo(l),t&&r.addClass(t),r}var ts=class extends Fr{constructor(t,r,a){super();this.context=t,this.parentdiv=r,this.fmt=a}updateLeft(){return!0}updateRight(){if(jn(this.rgbimgs,this.left.rgbimgs))return!1;this.rgbimgs=this.left.rgbimgs;var t=bi(this.parentdiv.empty(),"asset_dual"),r=bi(t),a=bi(t,"asset_editor").hide(),u=this.chooser=new Vn;u.rgbimgs=this.rgbimgs,u.width=this.fmt.w||1,u.height=this.fmt.h||1,u.recreate(r,(y,b)=>{var D=Math.ceil(256/this.fmt.w),W=D*(this.fmt.aspect||1),le=this.createEditor(a,b,W,D);this.context.setCurrentEditor(a,$(b.canvas),this),this.rgbimgs[y]=b.rgbdata});var d=this.left;if(d instanceof Ui&&d.paloptions.length>1){var m=$(document.createElement("select"));d.paloptions.forEach((y,b)=>{var D=$(document.createElement("option")).text(y.name).val(b).appendTo(m);b==d.palindex&&D.attr("selected","selected")}),m.appendTo(r).change(y=>{var b=$(y.target).val();d.palindex=b,d.refreshRight()})}return!0}createEditor(t,r,a,u){var d=new go;d.createWith(r),d.updateImage();for(var m=r.width*a,y=r.height*u;m>500||y>500;)m/=2,y/=2;return d.canvas.style.width=m+"px",d.canvas.style.height=y+"px",d.makeEditable(this,t,this.left.palette),d}},rs=class extends Fr{constructor(t,r,a){super();this.context=t,this.parentdiv=r,this.fmt=a}updateLeft(){return!0}updateRight(){if(jn(this.rgbimgs,this.left.rgbimgs))return!1;this.rgbimgs=this.left.rgbimgs;var t=bi(this.parentdiv.empty(),"asset_dual"),r=bi(t),a=bi(t,"asset_editor").hide(),u=new qn;return u.width=this.fmt.w,u.height=this.fmt.h,u.recreate(),u.updateImage(this.rgbimgs[0]),r.append(u.canvas),!0}},qn=class{recreate(){this.canvas=this.newCanvas(),this.imagedata=this.ctx.createImageData(this.width,this.height),this.rgbdata=new Uint32Array(this.imagedata.data.buffer),this.peerviewers=[this]}createWith(t){this.width=t.width,this.height=t.height,this.imagedata=t.imagedata,this.rgbdata=t.rgbdata,this.canvas=this.newCanvas(),this.peerviewers=[this,t]}newCanvas(){var t=document.createElement("canvas");return t.width=this.width,t.height=this.height,t.classList.add("pixels"),t.classList.add("pixelated"),this.ctx=t.getContext("2d"),t}updateImage(t){t&&this.rgbdata.set(t);for(let r of this.peerviewers)r.ctx.putImageData(this.imagedata,0,0)}},go=class extends qn{constructor(){super(...arguments);this.curpalcol=-1;this.offscreen=new Map}getPositionFromEvent(t){var r=Math.floor(t.offsetX*this.width/$(this.canvas).width()),a=Math.floor(t.offsetY*this.height/$(this.canvas).height());return{x:r,y:a}}setPaletteColor(t){t&=this.palette.length-1,this.curpalcol!=t&&(this.curpalcol>=0&&this.palbtns[this.curpalcol].removeClass("selected"),this.curpalcol=t,this.currgba=this.palette[t&this.palette.length-1],this.palbtns[t].addClass("selected"))}makeEditable(t,r,a){this.left=t,this.palette=a;var u,d=!1,m=$(this.canvas);m.mousedown(y=>{var b=this.getPositionFromEvent(y);u=this.getPixel(b.x,b.y)==this.currgba?this.palette[0]:this.currgba,this.setPixel(b.x,b.y,this.currgba),d=!0,$(document).mouseup(D=>{$(document).off("mouseup");var W=this.getPositionFromEvent(D);this.setPixel(W.x,W.y,u),d=!1,this.commit()})}).mousemove(y=>{var b=this.getPositionFromEvent(y);d&&this.setPixel(b.x,b.y,u)}),r.empty(),this.createToolbarButtons(r[0]),r.append(this.canvas),r.append(this.createPaletteButtons()),this.setPaletteColor(1)}getPixel(t,r){if(t=Math.round(t),r=Math.round(r),t<0||t>=this.width||r<0||r>=this.height)return this.offscreen[t+","+r]|this.palette[0];var a=t+r*this.width;return this.rgbdata[a]}setPixel(t,r,a){if(t=Math.round(t),r=Math.round(r),t<0||t>=this.width||r<0||r>=this.height)this.offscreen[t+","+r]=a;else{var u=t+r*this.width,d=this.rgbdata[u];d!=a&&(this.rgbdata[u]=a,this.updateImage())}}createPaletteButtons(){this.palbtns=[];for(var t=bi(null,"asset_toolbar"),r=0;r<this.palette.length;r++){var a=$(document.createElement("button")).addClass("palbtn"),u=this.palette[r]&16777215,d="#"+Ne(Rn(u),6);a.click(this.setPaletteColor.bind(this,r)),a.css("backgroundColor",d).text(r.toString(16)),a.css("color",u&32768?"black":"white"),t.append(a),this.palbtns.push(a)}return t}createToolbarButtons(t){var r=new Mn(t,null);r.add("ctrl+shift+h","Flip X","glyphicon-resize-horizontal",this.flipX.bind(this)),r.add("ctrl+shift+v","Flip Y","glyphicon-resize-vertical",this.flipY.bind(this)),r.add("ctrl+shift+9","Rotate","glyphicon-repeat",this.rotate90.bind(this)),r.add("ctrl+shift+left","Move Left","glyphicon-arrow-left",this.translate.bind(this,1,0)),r.add("ctrl+shift+right","Move Right","glyphicon-arrow-right",this.translate.bind(this,-1,0)),r.add("ctrl+shift+up","Move Up","glyphicon-arrow-up",this.translate.bind(this,0,1)),r.add("ctrl+shift+down","Move Down","glyphicon-arrow-down",this.translate.bind(this,0,-1))}commit(){this.updateImage();try{this.left.refreshLeft()}catch(t){console.log(t),alert(`Could not update source code. ${t}`)}}remapPixels(t){for(var r=0,a=new Uint32Array(this.rgbdata.length),u=0;u<this.height;u++)for(var d=0;d<this.width;d++)a[r]=t(d,u),r++;this.rgbdata.set(a),this.commit()}rotate(t){var r=Math.sin(t*Math.PI/180),a=Math.cos(t*Math.PI/180);this.remapPixels((u,d)=>{var m=u+.5-this.width/2,y=d+.5-this.height/2,b=m*a-y*r+this.width/2-.5,D=y*a+m*r+this.height/2-.5;return this.getPixel(b,D)})}rotate90(){this.rotate(90)}flipX(){this.remapPixels((t,r)=>this.getPixel(this.width-1-t,r))}flipY(){this.remapPixels((t,r)=>this.getPixel(t,this.height-1-r))}translate(t,r){this.remapPixels((a,u)=>this.getPixel(a+t,u+r))}};var Yn=qs(),is=class{createDiv(t){return this.maindiv=Lr(t,"vertical-scroll"),this.maindiv[0]}clearAssets(){this.rootnodes=[],this.deferrednodes=[]}registerAsset(t,r,a){this.rootnodes.push(r),a?a>1?this.deferrednodes.push(r):this.deferrednodes.unshift(r):r.refreshRight()}getPalettes(t){var r=[];return this.rootnodes.forEach(a=>{for(;a!=null;){if(a instanceof Gn){var u=a.palette;t==u.length&&r.push({node:a,name:"Palette",palette:u}),a.layout&&a.layout.forEach(([d,m,y])=>{if(m<u.length){if(y==t){var b=u.slice(m,m+y);r.push({node:a,name:d,palette:b})}else if(-y==t){var b=u.slice(m,m-y);b.reverse(),r.push({node:a,name:d,palette:b})}else if(y+1==t){var b=new Uint32Array(t);b[0]=u[0],b.set(u.slice(m,m+y),1),r.push({node:a,name:d,palette:b})}}});break}a=a.right}}),r}getTilemaps(t){var r=[];return this.rootnodes.forEach(a=>{for(;a!=null;){if(a instanceof Ui){var u=a.rgbimgs;u&&u.length>=t&&r.push({node:a,name:"Tilemap",images:a.images,rgbimgs:u})}a=a.right}}),r}isEditing(){return this.cureditordiv!=null}getCurrentEditNode(){return this.cureditnode}setCurrentEditor(t,r,a){let u=250;for(this.cureditordiv!=t&&(this.cureditordiv&&(this.cureditordiv.hide(u),this.cureditordiv=null),t&&(this.cureditordiv=t,this.cureditordiv.show(),this.cureditordiv[0].scrollIntoView({behavior:"smooth",block:"center"}))),this.cureditelem&&(this.cureditelem.removeClass("selected"),this.cureditelem=null),r&&(this.cureditelem=r,this.cureditelem.addClass("selected"));a.left;)a=a.left;this.cureditnode=a}scanFileTextForAssets(t,r){for(var a=[],u=/[/;][*;]([{].+[}])[*;][/;]/g,d;d=u.exec(r);){var m=d.index+d[0].length,y;if(oe.includes("verilog")?y=r.indexOf("end",m):d[0].startsWith(";;")?y=r.indexOf(";;",m):y=r.indexOf(";",m),y>m)try{var b=d[1].replace(/([A-Za-z]+):/g,'"$1":'),D=JSON.parse(b);a.push({fileid:t,fmt:D,start:m,end:y})}catch(de){console.log(de)}}for(var W=/DEF_METASPRITE_(\d+)x(\d+)[(](\w+),\s*(\w+),\s*(\w+)/gi;d=W.exec(r);){for(var le=parseInt(d[1]),H=parseInt(d[2]),U=d[3],B=parseInt(d[4]),ce=parseInt(d[5]),Q=[],we=0;we<le;we++)for(var ke=0;ke<H;ke++)Q.push({x:we*8,y:ke*8,tile:B,attr:ce});var he={defs:Q,width:le*8,height:H*8};a.push({fileid:t,label:U,meta:he})}return a}addPaletteEditorViews(t,r,a){var u=$('<div class="asset_dual"/>').appendTo(t),d=$('<div class="asset_editor"/>').hide(),m=[];r.getAllColors().forEach(U=>{m.push(new Uint32Array([U]))});var y=$("<table/>").appendTo(u);d.appendTo(u);var b=r.layout;if(!b){var D=r.palette.length,W=D>32?8:4;b=[];for(var le=0;le<D;le+=W)b.push(["",le,Math.min(D-le,W)])}function H(U,B){var ce=r.words[B],Q=r.palette[B],we="#"+Ne(Rn(Q),6),ke=Q&32768?"black":"white";U.text(Ne(ce,2)).css("background-color",we).css("color",ke)}b.forEach(([U,B,ce])=>{if(B<r.palette.length){var Q=$("<tr/>").appendTo(y);$("<td/>").text(U).appendTo(Q);for(var we=[],ke=B;ke<B+Math.abs(ce);ke++)we.push(ke);ce<0&&we.reverse(),we.forEach(he=>{var de=$("<td/>").addClass("asset_cell asset_editable").appendTo(Q);H(de,he),de.click(He=>{var s=new Vn;s.rgbimgs=m,s.width=1,s.height=1,s.recreate(d,(ue,J)=>{a(he,ue),H(de,he)}),this.setCurrentEditor(d,de,r)})})}})}addPixelEditor(t,r,a){a.xform="scale(2)";var u=new Za(a);r.addRight(u);var d=new Ui(this,a);u.addRight(d),d.addRight(new ts(this,Lr(t),a))}addPaletteEditor(t,r,a){var u=new Gn(a);r.addRight(u),r.refreshRight(),this.addPaletteEditorViews(t,u,(d,m)=>{console.log("set entry",d,"=",m),r.words[d]=m,u.words=null,u.updateRight(),u.refreshLeft()})}ensureFileDiv(t){var r=this.getFileDivId(t),a=$(document.getElementById(r));if(a.length===0){var u=Lr(this.maindiv,"asset_file"),d=Lr(u,"asset_file_header").text(t);a=Lr(u).attr("id",r).addClass("disable-select")}return a}refreshAssetsInFile(t,r){let a=0;if(oe.startsWith("nes")&&t.endsWith(".chr")&&r instanceof Uint8Array){let u=new zn(me,t),d={w:8,h:8,bpp:1,count:r.length>>4,brev:!0,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]};this.addPixelEditor(this.ensureFileDiv(t),u,d),this.registerAsset("charmap",u,1),a++}else if(oe.startsWith("nes")&&t.endsWith(".pal")&&r instanceof Uint8Array){let u=new zn(me,t),d={pal:"nes",layout:"nes"};this.addPaletteEditor(this.ensureFileDiv(t),u,d),this.registerAsset("palette",u,0),a++}else if(typeof r=="string"){let u=this.scanFileTextForAssets(t,r);for(let d of u)if(d.fmt){let m=t,y=new Ja(me,t,m,d.start,d.end),b=y;if(d.fmt.comp=="rletag"&&(y=y.addRight(new Ka)),d.fmt.map=="nesnt"){y=y.addRight(new es(this)),y=y.addRight(new Ui(this,{w:8,h:8,bpp:4}));let D={w:8*(d.fmt.w||32),h:8*(d.fmt.h||30),count:1};y=y.addRight(new rs(this,Lr(this.ensureFileDiv(t)),D)),this.registerAsset("nametable",b,2),a++}else d.fmt.w>0&&d.fmt.h>0?(this.addPixelEditor(this.ensureFileDiv(t),y,d.fmt),this.registerAsset("charmap",b,1),a++):d.fmt.pal&&(this.addPaletteEditor(this.ensureFileDiv(t),y,d.fmt),this.registerAsset("palette",b,0),a++)}}return a}getFileDivId(t){return"__asset__"+$s(t)}refresh(t){if(t)this.maindiv.empty(),this.clearAssets(),ye.iterateFiles((a,u)=>{try{var d=this.refreshAssetsInFile(a,u)}catch(m){console.log(m),this.ensureFileDiv(a).text(m+"")}}),console.log("Found "+this.rootnodes.length+" assets"),this.deferrednodes.forEach(a=>{try{a.refreshRight()}catch(u){console.log(u),alert(u+"")}}),this.deferrednodes=[];else for(var r of this.rootnodes)r!==this.getCurrentEditNode()&&r.refreshRight()}setVisible(t){t?Yn.bind&&Yn.bind("ctrl+z",me.undoStep.bind(me)):Yn.unbind&&Yn.unbind("ctrl+z")}};var rn=256,vo=100,bo=!1,nn=class{constructor(t,r){this.expanded=!1;this.parent=t,this.name=r,this.children=new Map,this.level=t?t.level+1:-1,this.view=t?t.view:null}getDiv(){return this._div==null&&(this._div=document.createElement("div"),this._div.classList.add("vertical-scroll"),this._div.classList.add("tree-content"),this._header=document.createElement("div"),this._header.classList.add("tree-header"),this._header.classList.add("tree-level-"+this.level),this._header.append(this.name),this._inline=document.createElement("span"),this._inline.classList.add("tree-value"),this._header.append(this._inline),this._div.append(this._header),this.parent._content.append(this._div),this._header.onclick=t=>{this.toggleExpanded()}),this.expanded&&this._content==null?(this._content=document.createElement("div"),this._div.append(this._content)):!this.expanded&&this._content!=null&&(this._content.remove(),this._content=null,this.children.clear()),this._div}toggleExpanded(){this.expanded=!this.expanded,this.view.tick()}remove(){this._div.remove(),this._div=null}update(t){this.getDiv();var r="";if(t&&t.$$&&typeof t.$$=="function"&&this._content!=null&&(t=t.$$()),t==null)r=t+"";else if(typeof t=="number")t!=(t|0)?r=t.toString():r=t+" ($"+Ne(t)+")";else if(typeof t=="boolean")r=t.toString();else if(typeof t=="string")t.length<vo?r=t:r=t.substring(0,vo)+"...";else if(t.buffer&&t.length<=rn)r=js(t,0,t.length);else if(typeof t=="object"||typeof t=="function")if(this._content!=null){if(t.slice&&t.length>rn){let b={},D=t;for(var a=rn;t.length/a>rn;)a*=2;for(let W=0;W<D.length;W+=a)b["$"+Ne(W)]={$$:()=>D.slice(W,W+a)};t=b}if(t instanceof Map){let b={};for(let[D,W]of t.entries())b[D]=W;t=b}let m=t instanceof Array?Array.from(t.keys()):Object.getOwnPropertyNames(t);if(m.length>rn){let b={},D=t;for(var a=100;m.length/a>100;)a*=2;for(let le=0;le<m.length;le+=a){for(var u={},d=le;d<le+a;d++)u[m[d]]=D[m[d]];b["["+le+"...]"]=u}t=b,m=Object.getOwnPropertyNames(t)}let y=new Set(this.children.keys());m.forEach(b=>{var D=!bo&&typeof b=="string"&&b.startsWith("$$");if(!D){let W=this.children.get(b);W==null&&(W=new nn(this,b),this.children.set(b,W)),W.update(t[b])}y.delete(b)}),y.forEach(b=>{this.children.get(b).remove(),this.children.delete(b)}),this._header.classList.add("tree-expanded"),this._header.classList.remove("tree-collapsed")}else this._header.classList.add("tree-collapsed"),this._header.classList.remove("tree-expanded");else r=typeof t;this._inline.innerText!=r&&(this._inline.innerText=r)}};function yo(l,t){var r=new nn(null,null);r.view=t,r._content=l;var a=new nn(r,"/");return a.expanded=!0,a.getDiv(),a._div.style.padding="0px",a}var xo=class{createDiv(t){return this.root=yo(t,this),this.root.getDiv()}refresh(){this.tick()}tick(){this.root.update(this.getRootObject())}};var ns=class extends xo{getRootObject(){return P.getDebugTree()}},as=class extends vi{constructor(){super(...arguments);this.cumulativeData=!0}createDiv(t){return this.clear(),this.treeroot=yo(t,this),this.treeroot.getDiv()}refresh(){this.tick()}tick(){this.treeroot.update(this.getRootObject()),this.probe&&this.probe.clear()}clear(){this.graph=null,this.reset()}reset(){this.stack=[],this.lastsp=-1,this.lastpc=0,this.jsr=!1,this.rts=!1}newNode(t,r){return{$$SP:r,$$PC:t,count:0,startLine:null,endLine:null,calls:{}}}newRoot(t,r){this.stack.length==0?(this.graph=this.newNode(null,r),this.stack.unshift(this.graph)):r>this.stack[0].$$SP&&(this.graph=this.newNode(null,r),this.graph.calls[this.addr2str(t)]=this.stack[0],this.stack.unshift(this.graph))}getRootObject(){return this.redraw((t,r,a,u,d,m)=>{switch(t){case ee.SP_POP:this.newRoot(this.lastpc,this.lastsp);case ee.SP_PUSH:if(this.stack.length){let b=this.stack[this.stack.length-1];var y=this.lastsp-r;(y==2||y==3)&&r<b.$$SP&&(this.jsr=!0),(y==-2||y==-3)&&this.stack.length>1&&r>b.$$SP&&(this.rts=!0)}this.lastsp=r;break;case ee.EXECUTE:if(Math.abs(r-this.lastpc)>=4){if(this.jsr&&this.stack.length){let b=this.stack[this.stack.length-1],D=this.addr2str(r),W=b.calls[D];W==null?W=b.calls[D]=this.newNode(r,this.lastsp):W.$$PC==null&&(W.$$PC=r),this.stack.push(W),W.count++,W.startLine=u}this.jsr=!1,this.rts&&this.stack.length&&(this.stack.pop().endLine=u),this.rts=!1}this.lastpc=r;break}}),this.graph&&(this.graph.$$Stack=this.stack),bo?this.graph:this.graph&&this.graph.calls}};function Be(l){l?(lr(0),$("#pleaseWaitModal").modal("show")):(lr(1),$("#pleaseWaitModal").modal("hide"))}function lr(l){$("#pleaseWaitProgressBar").css("width",l*100+"%").show()}function _e(l){Be(!1),bootbox.alert({title:'<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert',message:Oi.sanitize(l)})}function Ht(l){Be(!1),bootbox.alert(Oi.sanitize(l))}function wo(l){throw _e(l),new Error(l)}function yi(l,t,r,a){window.ga&&ga("send","event",l,t,r,a)}function Eo(l){window.ga&&ga("send","pageview",l)}var ss;async function xi(){if(!ss){await qt("lib/octokat.js"),await qt("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await qt("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await qt("https://8bitworkshop.com/config.js");var l=Fn("__github_key");ss=new Na(Octokat,l,Qr(),Ir()),console.log("loaded github service")}return ss}function an(){var l=(Ke||"").split("/");return l.length!=2?(_e("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+l[0]+"/"+l[1]}async function Xn(l,t){var r,a=Qi(l);if(!a){_e("Could not parse Github URL.");return}var u=Ni()[a.repopath];if(!(u&&!confirm("You've already imported "+a.repopath+" -- do you want to replace all local files?"))){Be(!0);var d=Nn(a.repopath);lr(.25);var m=await xi();return m.import(l).then(y=>(r=y,lr(.75),m.pull(l,d))).then(y=>{Be(!1),yi("sync","import",l),wi(t,{repo:a.repopath})}).catch(y=>{Be(!1),console.log(y),_e("Could not import "+l+"."+y)})}}async function _o(l){var t=await xi();t.login().then(()=>{Ht("You are signed in to Github.")}).catch(r=>{_e("Could not sign in."+r)})}async function To(l){var t=await xi();t.logout().then(()=>{Ht("You are logged out of Github.")})}function So(l){var t=$("#importGithubModal"),r=$("#importGithubButton");t.modal("show"),r.off("click").on("click",()=>{var a=$("#importGithubURL").val()+"";t.modal("hide"),Xn(a,!1)})}function Ao(l){if(!(Ke&&!confirm("This project ("+Ir().mainPath+") is already bound to a Github repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)"))){var t=$("#publishGithubModal"),r=$("#publishGithubButton");$("#githubRepoName").val(Tt(Ot(Ir().mainPath))),t.modal("show"),r.off("click").on("click",async()=>{var a=$("#githubRepoName").val()+"",u=$("#githubRepoDesc").val()+"",d=$("#githubRepoPrivate").val()=="private",m=$("#githubRepoLicense").val()+"",y;if(!a){_e("You did not enter a project name.");return}t.modal("hide"),Be(!0);var b=await xi();b.login().then(()=>(lr(.25),b.publish(a,u,m,d))).then(D=>(y=D,lr(.5),ko("initial import from 8bitworkshop.com"))).then(()=>{yi("sync","publish",d?"":a),Xn(y.url,!1)}).catch(D=>{Be(!1),console.log(D),_e("Could not publish GitHub repository: "+D)})})}}function Co(l){var t=an();if(!!t){var r=$("#pushGithubModal"),a=$("#pushGithubButton");r.modal("show"),a.off("click").on("click",()=>{var u=$("#githubCommitMsg").val()+"";r.modal("hide"),ko(u)})}}function Po(l){var t=an();!t||bootbox.confirm("Pull from repository and replace all local files? Any changes you've made will be overwritten.",async r=>{if(r){Be(!0);var a=await xi();a.pull(t).then(u=>{Be(!1),me.updateAllOpenWindows(Qr())})}})}function au(l){return new Promise((t,r)=>{var a=l.commit.files;if(console.log(a),a.length==0){Be(!1),Ht("No files changed.");return}var u="";for(var d of a)u+=Oi.sanitize(d.filename)+": "+d.status,(d.additions||d.deletions||d.changes)&&(u+=" ("+d.additions+" additions, "+d.deletions+" deletions, "+d.changes+" changes)"),u+="<br/>";bootbox.confirm(u,m=>{m?t(l):Be(!1)})})}async function ko(l){var t=an();if(!!t){var r=[];for(var a in Ir().filedata){var u=Ir().stripLocalPath(a),d=Ir().filedata[a];u&&d&&r.push({path:u,data:d})}if(Pt()instanceof Uint8Array){let y="bin/"+lt()+".rom";r.push({path:y,data:Pt()})}Be(!0);var m=await xi();return m.login().then(()=>(lr(.5),m.commit(t,l,r))).then(y=>au(y)).then(y=>m.push(y)).then(y=>(Be(!1),Ht("Pushed files to "+t),y)).catch(y=>{Be(!1),console.log(y),_e("Could not push GitHub repository: "+y)})}}function Do(){var l=an();!l||bootbox.prompt("<p>Are you sure you want to delete this repository ("+Oi.sanitize(l)+") from browser storage?</p><p>All changes since last commit will be lost.</p><p>Type DELETE to proceed.<p>",t=>{t.trim().toUpperCase()=="DELETE"&&su()})}async function su(){var l=an();Be(!0);let t=await xi(),r=await t.getGithubSession(l);t.bind(r,!1),await Qr().keys().then(a=>Promise.all(a.map(u=>Qr().removeItem(u)))),Be(!1),wi(!1,{repo:"/"})}var os=class{constructor(t){this.options=t,this.sampleRate=44100,this.soundData=[],this.tapData=[67,54,52,45,84,65,80,69,45,82,65,87,1,0,0,0,0,0,0,0]}getWAVHeader(){let t=new Uint8Array(44),r=new DataView(t.buffer);return r.setUint32(0,1380533830,!1),r.setUint32(4,44+this.soundData.length,!0),r.setUint32(8,1463899717,!1),r.setUint32(12,1718449184,!1),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,this.sampleRate,!0),r.setUint32(28,this.sampleRate*2,!0),r.setUint16(32,1,!0),r.setUint16(34,8,!0),r.setUint32(36,1684108385,!1),r.setUint32(40,this.soundData.length,!0),t}addSilence(t){let r=Math.floor(this.sampleRate*t);for(let u=0;u<r;u++)this.soundData.push(0);let a=it.CLOCK_RATE*t;this.tapData.push(0),this.tapData.push(a&255),this.tapData.push(a>>8&255),this.tapData.push(a>>16&255)}addCycle(t){this.tapData.push(t);let r=Math.floor(this.sampleRate*it.TAP_LENGTH_IN_SECONDS*t);for(let a=0;a<r;a++){let u;this.options.sine_wave?u=-Math.sin(a/r*2*Math.PI):a<r/2?u=-1:u=1,this.options.invert_waveform&&(u=-u),this.soundData.push(Math.round(128+u*127))}}updateTAPHeader(){let t=this.tapData.length-20;this.tapData[16]=t&255,this.tapData[17]=t>>8&255,this.tapData[18]=t>>16&255,this.tapData[19]=t>>24&255}getTAPData(){return this.updateTAPHeader(),new Uint8Array(this.tapData)}getSoundData(){let t=this.getWAVHeader(),r=new Uint8Array(t.length+this.soundData.length);return r.set(t,0),r.set(new Uint8Array(this.soundData),t.length),r}},Ze=class{constructor(t,r){this.options=r,this.checksum=0,this.data=new Uint8Array(0),this.filenameData=this.makeFilename(t),this.startAddress=0,this.endAddress=0,this.fileType=Ze.FILE_TYPE_NONE,this.waveFile=null}makeFilename(t){let r=[],a=32;t=t.toUpperCase();for(let u=0;u<Ze.FILENAME_BUFFER_SIZE;u++)if(t.length<=u)r.push(a);else{let d=t.charCodeAt(u);r.push(d)}return r}setContent(t){this.data=t.data,this.startAddress=t.startAddress,this.endAddress=t.startAddress+t.data.length,this.fileType=t.type}generateSound(t){this.waveFile=t,this.addHeader(!1),this.addHeader(!0),t.addSilence(.1),this.addFile()}addTapCycle(t){this.waveFile.addCycle(t)}addBit(t){t===0?(this.addTapCycle(Ze.SHORT_PULSE),this.addTapCycle(Ze.MEDIUM_PULSE)):(this.addTapCycle(Ze.MEDIUM_PULSE),this.addTapCycle(Ze.SHORT_PULSE))}addDataMarker(t){t?(this.addTapCycle(Ze.LONG_PULSE),this.addTapCycle(Ze.MEDIUM_PULSE)):(this.addTapCycle(Ze.LONG_PULSE),this.addTapCycle(Ze.SHORT_PULSE))}resetChecksum(){this.checksum=0}addByteFrame(t,r){let a=1;for(let u=0;u<8;u++){let d=(t&1<<u)!=0?1:0;this.addBit(d),a^=d}this.addBit(a),this.addDataMarker(r),this.checksum^=t}addLeader(t){let r;t===Ze.LEADER_TYPE_HEADER?r=27136:t===Ze.LEADER_TYPE_CONTENT?r=6656:r=79;for(let a=0;a<r;a++)this.addTapCycle(Ze.SHORT_PULSE)}addSyncChain(t){let r;t?r=9:r=137;let a=9;for(;a>0;)this.addByteFrame(r,!0),r-=1,a-=1}addData(){for(let t=0;t<this.data.length;t++)this.addByteFrame(this.data[t],!0)}addFilename(){for(let t=0;t<this.filenameData.length;t++)this.addByteFrame(this.filenameData[t],!0)}addHeader(t){t?this.addLeader(Ze.LEADER_TYPE_REPEATED):this.addLeader(Ze.LEADER_TYPE_HEADER),this.addDataMarker(!0),this.addSyncChain(t),this.resetChecksum(),this.addByteFrame(this.fileType,!0),this.addByteFrame(this.startAddress&255,!0),this.addByteFrame((this.startAddress&65280)>>8,!0),this.addByteFrame(this.endAddress&255,!0),this.addByteFrame((this.endAddress&65280)>>8,!0),this.addFilename();for(let r=0;r<Ze.NUMBER_OF_PADDING_BYTES;r++)this.addByteFrame(Ze.PADDING_CHARACTER,!0);this.addByteFrame(this.checksum,!1)}addFile(){let t=!1;for(let r=0;r<2;r++)t?this.addLeader(Ze.LEADER_TYPE_REPEATED):this.addLeader(Ze.LEADER_TYPE_CONTENT),this.addDataMarker(!0),this.addSyncChain(t),this.resetChecksum(),this.addData(),this.addByteFrame(this.checksum,!1),t=!0;this.addLeader(1)}},it=Ze;it.CLOCK_RATE=985248,it.TAP_LENGTH_IN_SECONDS=8/Ze.CLOCK_RATE,it.FILENAME_BUFFER_SIZE=16,it.FILE_TYPE_NONE=0,it.FILE_TYPE_RELOCATABLE=1,it.FILE_TYPE_SEQUENTIAL=2,it.FILE_TYPE_NON_RELOCATABLE=3,it.LEADER_TYPE_HEADER=0,it.LEADER_TYPE_CONTENT=1,it.LEADER_TYPE_REPEATED=2,it.NUMBER_OF_PADDING_BYTES=171,it.PADDING_CHARACTER=32,it.SHORT_PULSE=48,it.MEDIUM_PULSE=66,it.LONG_PULSE=86;var xr=_a(Yl());function Ro(l){return Pt()==null?(_e("Please fix errors before sharing."),!0):Pt()instanceof Uint8Array?(ou(),qt("lib/liblzg.js").then(()=>{var t=Ws(window.Module,Array.from(Pt()));window.Module=null;var r=btoa(kn(t)),a={p:oe,r},u=$.param(a),d=lu(u,"player.html"),m='<iframe width=640 height=600 src="'+d+'">';$("#embedLinkTextarea").text(d),$("#embedIframeTextarea").text(m),$("#embedLinkModal").modal("show"),$("#embedAdviceWarnAll").hide(),$("#embedAdviceWarnIE").hide(),d.length>=65536?$("#embedAdviceWarnAll").show():d.length>=5120&&$("#embedAdviceWarnIE").show()}),!0):(_e("Can't share a Verilog executable yet. (It's not actually a ROM...)"),!0)}function ou(){console.log("clipboard"),import("./clipboard-2SP4SJIP.js").then(l=>{let t=l.default;new t(".btn")})}function lu(l,t){console.log(l);var r=window.location,a=r.pathname.replace("index.html",""),u=r.host=="8bitworkshop.com"?"https:":r.protocol,d=u+"//"+r.host+a+t+"?"+l;return d}function uu(l){var r;var t=(r=en())==null?void 0:r.code_start;qt("lib/c2t.js").then(()=>{var a="",u=function(H){a+=H+`
|
|
`},d=window.c2t({noInitialRun:!0,print:u,printErr:u}),m=d.FS,y=lt()+".bin",b=lt()+".wav";m.writeFile(y,Pt(),{encoding:"binary"});var D=["-2bc",y+","+t.toString(16),b];d.callMain(D);var W=m.readFile(b,{encoding:"binary"});if(W){var le=new Blob([W],{type:"audio/wav"});(0,xr.saveAs)(le,b),a+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",Ht(a)}})}function cu(l){qt("lib/makewav.js").then(()=>{let t="",r=function(y){t+=y+`
|
|
`};var a=Tt(lt());let u=a+".bin",d=a+".wav";window.makewav({noInitialRun:!1,print:r,printErr:r,arguments:["-ts","-f0","-v10",u],preRun:y=>{y.FS.writeFile(u,Pt(),{encoding:"binary"})}}).ready.then(y=>{let b=[u];y.run(b),console.log(t);let W=y.FS.readFile(d,{encoding:"binary"});if(W){let le=new Blob([W],{type:"audio/wav"});(0,xr.saveAs)(le,d),t+=`
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,Ht(t)}})})}function fu(l){var t=Tt(lt());let r=t+".tap",a=new it(t),u=new os({sine_wave:!0}),d=Pt(),m=d[0]+d[1]*256;d=d.slice(2),a.setContent({data:d,startAddress:m,type:it.FILE_TYPE_NON_RELOCATABLE}),a.generateSound(u);let y=u.getTAPData();if(y){let b=new Blob([y],{type:"application/octet-stream"});(0,xr.saveAs)(b,r)}}function ls(){switch(Nt(oe)){case"vcs":return cu;case"apple2":return uu;case"c64":return fu}}function Lo(l){if(Pt()==null)return _e("Please fix errors before exporting."),!0;var t=ls();if(t===void 0)return _e("Cassette export is not supported on this platform."),!0;t(l)}function Fo(l){if(Pt()==null)return _e("Please finish compiling with no errors before downloading ROM."),!0;var t=Tt(lt());if(P.getDownloadFile){var r=P.getDownloadFile(),t=Tt(lt());(0,xr.saveAs)(r.blob,t+r.extension)}else if(Pt()instanceof Uint8Array){var a=new Blob([Pt()],{type:"application/octet-stream"}),u=P.getROMExtension&&P.getROMExtension(Pt())||"-"+Nt(oe)+".bin";(0,xr.saveAs)(a,t+u)}else _e(`The "${oe}" platform doesn't have downloadable ROMs.`)}function Io(l){var t=me.getCurrentText();if(!t)return!1;var r=new Blob([t],{type:"text/plain;charset=utf-8"});(0,xr.saveAs)(r,$o(),{autoBom:!1})}async function Mo(){let l=(await import("./jszip.min-QZ4ZBVAS.js")).default;return new l}async function Oo(l){var t=await Mo();Ir().iterateFiles((r,a)=>{a&&t.file(Ot(r),a)}),t.generateAsync({type:"blob"}).then(r=>{(0,xr.saveAs)(r,lt()+"-"+Nt(oe)+".zip")})}function No(l){let t=P.getDebugSymbolFile&&P.getDebugSymbolFile();if(!t){_e("This project does not have debug information.");return}var r=Tt(lt());(0,xr.saveAs)(t.blob,r+t.extension,{autoBom:!1})}async function Uo(l){var t=await Mo(),r=await Qr().keys();Be(!0);try{var a=0;await Promise.all(r.map(d=>Qr().getItem(d).then(m=>{lr(a++/(r.length+1)),m&&t.file(d,m)})));var u=await t.generateAsync({type:"blob"});(0,xr.saveAs)(u,Nt(oe)+"-all.zip")}finally{Be(!1)}}var us=!1;function Wo(){us||qt("lib/gif.js").then(()=>{var l=$("#emulator").find("canvas")[0];if(!l){_e("Could not find canvas element to record video!");return}var t=0;l.style&&l.style.transform&&(l.style.transform.indexOf("rotate(-90deg)")>=0?t=-1:l.style.transform.indexOf("rotate(90deg)")>=0&&(t=1));var r=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:t}),a=$("#videoPreviewImage");r.on("progress",b=>{lr(b)}),r.on("finished",b=>{a.attr("src",URL.createObjectURL(b)),Be(!1),P.resume(),$("#videoPreviewModal").modal("show")});var u=20,d=300,m=0;console.log("Recording video",l),$("#emulator").css("backgroundColor","#cc3333");var y=()=>{m++>d?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),Be(!0),P.pause(),r.render(),us=!1):(r.addFrame(l,{delay:u,copy:!0}),setTimeout(y,u),us=!0)};y()})}var Iu=ql(),_i=rl(),re=Sa(window.location.search||"?"),oe,Ti,Ke,P,ye,me,Xr,il,bs,fn=$("#controls_top"),st,Lt,ys,Si,Zn,Xt,dn=Mi(re.electron),Ft=Mi(re.embed),hn,pn,ea=!1,Wi=!1,ta=null,nl=null,xs=!1,al="c.PC == 0x6000";function Qr(){return Xt}function Ir(){return ye}function Pt(){return Si}function en(){return il}var Mu={dasm:"6502",acme:"6502",cc65:"text/x-csrc",ca65:"6502",nesasm:"6502",z80asm:"z80",sdasz80:"z80",sdasgb:"z80",sdcc:"text/x-csrc",verilator:"verilog",jsasm:"z80",zmac:"z80",bataribasic:"bataribasic",markdown:"markdown",js:"javascript",xasm6809:"z80",cmoc:"text/x-csrc",yasm:"gas",smlrc:"text/x-csrc",inform6:"inform6",fastbasic:"fastbasic",basic:"basic",silice:"verilog",wiz:"text/x-wiz",vasmarm:"vasm",armips:"vasm",ecs:"ecs","remote:llvm-mos":"text/x-csrc",cc7800:"text/x-csrc",armtcc:"text/x-csrc",oscar64:"text/x-csrc"},Ou={dasm:"https://raw.githubusercontent.com/sehugg/dasm/master/doc/dasm.txt",cc65:"https://cc65.github.io/doc/cc65.html",ca65:"https://cc65.github.io/doc/ca65.html",sdcc:"http://sdcc.sourceforge.net/doc/sdccman.pdf",verilator:"https://www.veripool.org/ftp/verilator_doc.pdf",fastbasic:"https://github.com/dmsc/fastbasic/blob/master/manual.md",bataribasic:"help/bataribasic/manual.html",wiz:"https://github.com/wiz-lang/wiz/blob/master/readme.md#wiz",silice:"https://github.com/sylefeb/Silice",zmac:"https://raw.githubusercontent.com/sehugg/zmac/master/doc.txt",cmoc:"http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html","remote:llvm-mos":"https://llvm-mos.org/wiki/Welcome",acme:"https://raw.githubusercontent.com/sehugg/acme/main/docs/QuickRef.txt"};function Nu(){return new Worker("./gen/worker/bundle.js")}var Qt=function(){try{let t="__some_random_key_you_are_not_going_to_use__";localStorage.setItem(t,t);var l=localStorage.getItem(t)==t;return localStorage.removeItem(t),l}catch(t){return!1}}(),sl=class{setLastPreset(t){Qt&&!Ft&&(Ke&&oe&&!dn?localStorage.setItem("__lastrepo_"+oe,Ke):localStorage.removeItem("__lastrepo_"+oe),localStorage.setItem("__lastplatform",oe),localStorage.setItem("__lastid_"+Ti,t))}unsetLastPreset(){Qt&&!Ft&&(delete re.file,localStorage.removeItem("__lastid_"+Ti))}getLastPreset(){return Qt&&!Ft&&localStorage.getItem("__lastid_"+Ti)}getLastPlatformID(){return Qt&&!Ft&&localStorage.getItem("__lastplatform")}getLastRepoID(t){return Qt&&!Ft&&t&&localStorage.getItem("__lastrepo_"+t)}shouldCompleteTour(){return Qt&&!Ft&&!localStorage.getItem("8bitworkshop.hello")}completedTour(){Qt&&!Ft&&localStorage.setItem("8bitworkshop.hello","true")}},Ai=new sl;function ws(l,t){navigator.storage&&navigator.storage.persist?navigator.storage.persist().then(r=>{console.log("requestPersistPermission =",r),r?l&&!t&&Ht("Your browser says it will persist your local file edits, but you may want to back up your work anyway."):l&&_e("Your browser refused to expand the peristent storage quota. Your edits may not be preserved after closing the page.")}):l&&_e("Your browser may not persist edits after closing the page. Try a different browser.")}function Uu(){return Zn?Zn.title||Zn.name||ye.mainPath||"ROM":ye.mainPath||"ROM"}async function Wu(){var l=new La(oe);return dn?(console.log("using electron with local filesystem",alternateLocalFilesystem),new Xi(l,alternateLocalFilesystem)):re.localfs!=null?new Xi(l,await Qu(re.localfs)):new Xi(l,new Fa(Xt))}async function $u(){var l=await Wu();ye=new Ia(Nu(),oe,P,l),ye.remoteTool=re.tool||null,me=new Oa($("#workspace")[0],ye),ye.callbackBuildResult=t=>{ic(t)},ye.callbackBuildStatus=t=>{Hu(t)}}function Hu(l){l?fn.addClass("is-busy"):fn.removeClass("is-busy"),$("#compile_spinner").css("visibility",l?"visible":"hidden")}function Es(l,t){var r=document.createElement("li"),a=document.createElement("a");return a.setAttribute("class","dropdown-item"),a.setAttribute("href","#"),a.setAttribute("data-wndid",l),l==me.getActiveID()&&$(a).addClass("dropdown-item-checked"),a.appendChild(document.createTextNode(t)),r.appendChild(a),{li:r,a}}function mn(){var l=$("#windowMenuList").empty(),t=!1;function r(b,D,W){t&&(l.append(document.createElement("hr")),t=!1);let{li:le,a:H}=Es(b,D);if(l.append(le),W){var U=(B,ce)=>{l.find("a").removeClass("dropdown-item-checked"),$(H).addClass("dropdown-item-checked")};me.setCreateFunc(b,W),me.setShowFunc(b,U),$(H).click(B=>{me.createOrShow(b),ta=b})}}function a(b){var D=P.getToolForFilename(b);D=="dasm"&&b.endsWith(".h")&<().endsWith(".c")&&(D="cc65");var W=D&&Mu[D];return new Ki(b,W)}function u(b){r(b,Ot(b),()=>{var D=ye.getFile(b);if(typeof D=="string")return a(b);if(D instanceof Uint8Array)return new Ba(b,D)})}u(ye.mainPath),ye.iterateFiles((b,D)=>{D&&b!=ye.mainPath&&u(b)}),t=!0;var d=ye.getListings();if(d)for(var m in d){var y=d[m];(y.assemblyfile&&y.assemblyfile.text||y.sourcefile&&y.sourcefile.text||y.text)&&r(m,Ot(m),b=>new $a(b))}t=!0,P.disassemble&&P.saveState&&r("#disasm","Disassembly",()=>new $n),P.readAddress&&r("#memory","Memory Browser",()=>new Hn),ye.segments&&ye.segments.length&&r("#memmap","Memory Map",()=>new ja),P.readVRAMAddress&&r("#memvram","VRAM Browser",()=>new Ha),P.startProbing&&(r("#memheatmap","Memory Probe",()=>new Ga),r("#crtheatmap","CRT Probe",()=>new Va),r("#probelog","Probe Log",()=>new qa),r("#scanlineio","Scanline I/O",()=>new Ya),r("#symbolprobe","Symbol Profiler",()=>new Xa),r("#callstack","Call Stack",()=>new as)),P.getDebugTree&&r("#debugview","Debug Tree",()=>new ns),r("#asseteditor","Asset Editor",()=>new is)}function Bu(l,t){if(t){var r=re.highlight.split(","),a=parseInt(r[0])-1,u=parseInt(r[1])-1,d=me.createOrShow(l);d.highlightLines(a,u)}}function ol(l){mn(),me.createOrShow(l),ye.setMainFile(l),Bu(l,re.highlight)}async function ju(l){ye.mainPath=l,Ai.setLastPreset(l);var t=await ye.loadFiles([l]);if(t&&t.length)ol(l);else{var r=await zu(l);ye.filedata[l]=r||`
|
|
`,ol(l),re.newfile?ws(!0,!0):Ht('Could not find file "'+l+'". Loading default file.'),delete re.newfile,sa()}}function _s(l){if(l=="/")re={repo:"/"};else if(l.indexOf("://")>=0){var t=Qi(l);t&&(re={repo:t.repopath})}else re.platform=oe,re.file=l;wi()}async function zu(l){var t=P.getToolForFilename(l);try{return await $.get("presets/"+Nt(oe)+"/skeleton."+t,"text")}catch(r){_e("Could not load skeleton for "+oe+"/"+t+"; using blank file")}}function Ts(l){return l.indexOf(" ")>=0?(_e("No spaces in filenames, please."),!1):!0}function Gu(l){return bootbox.prompt({title:"Enter the name of your new main source file.",placeholder:"newfile"+P.getDefaultExtension(),callback:t=>{if(t&&t.trim().length>0){if(!Ts(t))return;t.indexOf(".")<0&&(t+=P.getDefaultExtension());var r=t;yi("workspace","file","new"),re.newfile="1",_s(r)}}}),!0}function Vu(l){let t=$('<input type="file" multiple accept="*" style="display:none">'),r=t[0];t.change(a=>{qu(r.files)}),t.click()}function qu(l){console.log(l);var t=0;function r(){var a=l[t++];if(!a)console.log("Done uploading",t),t>2?(Ht("Files uploaded."),setTimeout(gn,1e3)):(re.file=l[0].name,bootbox.confirm({message:"Open '"+_i.sanitize(re.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:m=>{m?wi():setTimeout(gn,1e3)}})),yi("workspace","file","upload");else{var u=a.name,d=new FileReader;d.onload=function(m){var y=m.target.result,b=new Uint8Array(y);mi(u,b)||(b=Dn(b).replace(`\r
|
|
`,`
|
|
`)),me.updateFile(u,b),console.log("Uploaded "+u+" "+b.length+" bytes"),r()},d.readAsArrayBuffer(a)}}l&&r()}async function Yu(l){var t=window.showDirectoryPicker;t||_e("This browser can't open local files on your computer, yet. Try Chrome.");var r=await t(),a=r.name,u="__localfs__"+a,d={handle:r},m=vs.createInstance({name:u,version:2});await m.setItem(u,d),re={localfs:a},wi(!0)}async function Xu(l){return new Promise((t,r)=>{bootbox.prompt(_i.sanitize(l),a=>{t(a)})})}async function Qu(l){let t={mode:"readwrite"};var r="__localfs__"+l,a=vs.createInstance({name:r,version:2}),u=await a.getItem(r),d=u.handle;console.log(u,d);var m=await d.queryPermission(t);if(console.log(m),m!=="granted"&&(await Xu("Request permissions to access filesystem?"),m=await d.requestPermission(t)),m!=="granted"){_e("Could not get permission to access filesystem.");return}return{getFileData:async y=>{console.log("getFileData",y);let b=await d.getFileHandle(y,{create:!1});console.log("getFileData",b);let D=await b.getFile();console.log("getFileData",D);let W=await(mi(y)?D.binary():D.text());return console.log(b,D,W),W},setFileData:async(y,b)=>{}}}function lt(){return Ot(ye.mainPath)}function $o(){return Ot(me.getActiveID())}function Ju(l){var t=me.getActive();if(t&&t.setText){var r=me.getActiveID();$.get("presets/"+Nt(oe)+"/"+r,a=>{bootbox.confirm("Reset '"+_i.sanitize(r)+"' to default?",u=>{u&&t.setText(a)})},"text").fail(()=>{Ke?_e("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):_e("Can only revert built-in examples.")})}else _e("Cannot revert the active window. Please choose a text file.")}function Ku(l){var t=me.getActive();if(t&&t.getPath){var r=me.getActiveID();bootbox.confirm("Delete '"+_i.sanitize(r)+"'?",a=>{a&&Xt.removeItem(r).then(()=>{re.file==r?(Ai.unsetLastPreset(),wi()):(gn(),Ht("Deleted "+r))})})}else _e("Cannot delete the active window.")}function Zu(l){var t=me.getActive();if(t&&t.getPath&&ye.getFile(t.getPath())){var r=me.getActiveID();bootbox.prompt({title:"Rename '"+_i.sanitize(r)+"' to?",value:r,callback:a=>{var u=ye.getFile(t.getPath());if(a&&a!=r&&u){if(!Ts(a))return;Xt.removeItem(r).then(()=>Xt.setItem(a,u)).then(()=>{gn(),alert("Renamed "+r+" to "+a),r==ye.mainPath&&_s(a)})}}})}else _e("Cannot rename the active window.")}function ec(l){let t={},r,a=P.getPresets?P.getPresets():[];for(var u=0;u<a.length;u++){var d=a[u],m=d.chapter?d.chapter+". "+d.name:d.name,y=d.id==ye.mainPath;d.category?r=$("<optgroup />").attr("label","Examples: "+d.category).appendTo(l):r||(r=$("<optgroup />").attr("label","Examples").appendTo(l)),r.append($("<option />").val(d.id).text(m).attr("selected",y?"selected":null)),y&&(Zn=d),t[d.id]=m}return t}function tc(l){if(Qt&&!dn){var t=0,r=Ni();if(r){let u=$("<optgroup />").attr("label","Repositories").appendTo(l);for(let d in r){var a=r[d];a.platform_id&&Nt(a.platform_id)==Nt(oe)&&u.append($("<option />").val(a.url).text(a.url.substring(a.url.indexOf("/"))))}}}}async function ll(l,t,r,a){let u=await Xt.keys();u||(u=[]);let d;for(var m=0;m<u.length;m++){let y=u[m];if(y.startsWith(r)&&!a[y]){d||(d=$("<optgroup />").attr("label",t).appendTo(l));let b=y.substring(r.length);d.append($("<option />").val(y).text(b).attr("selected",y==ye.mainPath?"selected":null))}}}function ul(l){l.css("visibility","visible");var t=ye.mainPath;l.val()!=t&&l.append($("<option />").val(t).text(t).attr("selected","selected"))}async function gn(){var l=$("#preset_select").empty();if(Ke)l.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(Ot(Ke)+"/").show(),await ll(l,Ke,"",{}),ul(l);else{tc(l);var t=ec(l);await ll(l,"Local Files","",t),ul(l)}l.off("change").change(function(r){_s($(this).val().toString())})}function rc(l){var t=$("<p/>");if(l.path!=null){var r=l.line?l.label?`(${l.path} @ ${l.label})`:`(${l.path}:${l.line})`:`(${l.path})`,a=$("<a/>").text(r),u=l.path;u==lt()&&(u=ye.mainPath),me.isWindow(u)&&a.click(d=>{var m=me.createOrShow(u);m instanceof Ki&&m.setCurrentLine(l,!0)}),t.append(a),t.append(" ")}return t.append($("<span/>").text(l.msg)),t}function cl(){$("#error_alert").hide(),xs=!1}function Ss(l,t){var r=$("#error_alert_msg").empty();for(var a of l.slice(0,10))r.append(rc(a));$("#error_alert").show(),xs=t}function fl(l,t){if(t!=null){var r={msg:t,line:0};l instanceof Ca&&l.$loc&&(r=Object.create(l.$loc),r.msg=t,console.log(r)),Ss([r],!0)}}async function ic(l){if("errors"in l&&l.errors.length>0)fn.addClass("has-errors"),me.setErrors(l.errors),mn(),Ss(l.errors,!1);else{if(fn.removeClass("has-errors"),me.setErrors(null),cl(),l==null||"unchanged"in l&&l.unchanged||!("output"in l))return;P.debugSymbols=new Gs(l.symbolmap,l.debuginfo),il=l.params;var t=l.output;if(t!=null)try{bn(),vl(),await P.loadROM(Uu(),t),Si=t,ys||Mr(),qc()}catch(r){console.log(r),fn.addClass("has-errors"),fl(r,r+""),Si=null,mn();return}mn(),me.refresh(!1)}}async function nc(){if(P.loadBIOS){var l=oe+".rom",t=await Xt.getItem(l);t instanceof Uint8Array?(console.log("loading BIOS",l,t.length+" bytes"),P.loadBIOS(l,t)):console.log("BIOS file must be binary")}}function dl(){var l=$("#mem_info");l.hide(),hn=null}function vn(l){if(!!Vs(P)){var t=$("#mem_info"),r=$("#mem_info_msg"),a=P.getDebugCategories();a&&!pn&&(pn=a[0]);var u=l&&P.getDebugInfo(pn,l);if(typeof u=="string"){var d=hn?Us(hn,u):u;t.show(),r.html(d);var m=$('<div class="mem_info_links">'),y=D=>{var W=$("<a>"+D+"</a>");D==pn&&W.addClass("selected"),W.click(le=>{pn=D,hn=null,vn(Xr)}),m.append(W),m.append("<span> </span>")};for(var b of a)y(b);r.append("<br>"),r.append(m),hn=u}else dl()}}function ra(l,t){$("#debug_bar, #run_bar").find("button").removeClass("btn_active").removeClass("btn_stopped"),$("#dbg_"+l).addClass("btn_"+t)}function As(){return P&&Si!=null}function cr(){return As()?!0:(_e("Can't do this until build successfully completes."),!1)}function ac(l){if(ta&&ta.startsWith("#")||["toline","restart","tovsync","stepover"].includes(nl)||!P.disassemble)return;let t=ye.getListings(),r="#disasm",a=256;if(t){let u=l.c?l.c.EPC||l.c.PC:0;for(let d in t){let m=t[d],y=m.assemblyfile||m.sourcefile,b=ye.filename2path[d]||d;if(y==m.sourcefile&&(b=me.findWindowWithFilePrefix(d)),me.isWindow(b)){let D=y&&y.findLineForOffset(u,Wn);if(D){let W=y.lines[D.line+1];if(!W||u<W.offset){let le=u-D.offset;le<a&&(r=b,a=le)}}}}}me.createOrShow(r,!0)}function ia(l){Xr=l,vn(l),ac(l),me.refresh(!0),ea=!0}function hl(l){P.setupDebug&&(P.setupDebug((t,r)=>{ia(t),ra(l||"pause","stopped"),r&&Ss([{msg:"STOPPED: "+r,line:0}],!0)}),nl=l)}function yr(l){!cr()||(Ps(),hl(l),l&&ra(l,"active"))}function Jr(){P&&P.isRunning()&&(P.pause(),console.log("Paused")),ra("pause","stopped")}function sc(){!cr()||(bn(),Jr(),ys=!0)}function Mr(){P.isRunning()||(P.resume(),console.log("Resumed")),ra("go","active"),xs&&cl()}function pl(){!cr()||(bn(),P.isRunning()||me.refresh(!1),Mr(),ys=!1,ta=null)}function oc(){!cr()||(yr("step"),P.step())}function lc(){!cr()||(yr("stepover"),P.stepOver())}function uc(){!cr()||(yr("tovsync"),P.runToVsync())}function ml(){var l=me.getActive();return l&&l.getCursorPC&&l.getCursorPC()}function Zi(l){!cr()||!(l>=0)||(yr("toline"),console.log("Run to",l.toString(16)),P.runToPC?P.runToPC(l):P.runEval(t=>t.PC==l))}function cc(){P.restartAtPC(ml())?pl():_e("Could not restart program at selected line.")}function fc(){Zi(ml())}function dc(){!cr()||(yr("stepout"),P.runUntilReturn())}function hc(){!cr()||(yr("stepback"),P.stepBack())}function bn(){Xr=null,P.clearDebug&&P.clearDebug(),hl(),vn()}function Cs(){P.reset(),vl()}function pc(){!cr()||(bn(),Cs(),Mr())}function mc(){if(!!cr()){var l=Wi;Ps(),P.setupDebug&&P.runEval?(bn(),Mr(),Cs(),yr("restart"),P.runEval(t=>!0)):(Cs(),Mr()),l&&bl()}}function gc(){var l=$("#debugExprModal"),t=$("#debugExprSubmit");$("#debugExprInput").val(al),$("#debugExprExamples").text(vc()),l.modal("show"),t.off("click").on("click",()=>{var r=$("#debugExprInput").val()+"";l.modal("hide"),bc(r)})}function vc(){var l=P.saveState&&P.saveState(),t=l.c;console.log(t,l);var r="";return t.PC&&(r+="c.PC == 0x"+Ne(t.PC)+`
|
|
`),t.SP&&(r+="c.SP < 0x"+Ne(t.SP)+`
|
|
`),t.HL&&(r+=`c.HL == 0x4000
|
|
`),P.readAddress&&(r+=`this.readAddress(0x1234) == 0x0
|
|
`),P.readVRAMAddress&&(r+=`this.readVRAMAddress(0x1234) != 0x80
|
|
`),P.getRasterScanline&&(r+=`this.getRasterScanline() > 222
|
|
`),r}function bc(l){var t=new Function("c","return ("+l+");").bind(P);yr(),P.runEval(t),al=l}function gl(){P.isRunning()?(me.tick(),ea=!1):ea||(me.tick(),ea=!0),setTimeout(gl,100)}function na(l){P.setFrameRate(l),l>.01?$("#fps_label").text(l.toFixed(2)):$("#fps_label").text("1/"+Math.round(1/l))}function yc(){var l=P.getFrameRate();l=l/2,l>1e-5&&na(l)}function xc(){var l=P.getFrameRate();l=Math.min(60,l*2),na(l)}function wc(){na(60/65536)}function Ec(){Mr(),na(60)}function _c(){me.refresh(!1);var l=me.getActive();if(l.getSourceFile&&l.setTimingResult){var t=P.newCodeAnalyzer();t.showLoopTimingForPC(0),l.setTimingResult(t)}}function Ps(){Wi&&(P.setRecorder(null),$("#dbg_record").removeClass("btn_recording"),$("#replaydiv").hide(),dl(),Wi=!1)}function vl(){Wi&&Lt.reset()}function bl(){Lt.reset(),P.setRecorder(Lt),$("#dbg_record").addClass("btn_recording"),$("#replaydiv").show(),Wi=!0}function Tc(){Wi?Ps():bl()}function Or(l,t,r){var a=me.getActive();a&&a.insertText?bootbox.prompt({title:"Add "+_i.sanitize(l)+" File to Project",value:"filename"+_i.sanitize(t),callback:u=>{if(u&&u.trim().length>0){if(!Ts(u))return;var d=u,m=`
|
|
`+r(u)+`
|
|
`;ye.loadFiles([d]).then(y=>{y&&y.length?_e(u+" already exists; including anyway"):ye.updateFile(d,`
|
|
`),a.insertText(m),mn()})}}}):_e("Can't insert text in this window -- switch back to main file")}function Sc(){var l=lt(),t=P.getToolForFilename(l);l.endsWith(".c")||t=="sdcc"||t=="cc65"||t=="cmoc"||t=="smlrc"?Or("Header",".h",r=>'#include "'+r+'"'):t=="dasm"||t=="zmac"?Or("Include",".inc",r=>' include "'+r+'"'):t=="ca65"||t=="sdasz80"||t=="vasm"||t=="armips"?Or("Include",".inc",r=>' .include "'+r+'"'):t=="verilator"?Or("Verilog",".v",r=>'`include "'+r+'"'):t=="wiz"?Or("Include",".wiz",r=>'import "'+r+'";'):t=="ecs"?Or("Include",".ecs",r=>'import "'+r+'"'):t=="acme"?Or("Include",".acme",r=>'!src "'+r+'"'):_e("Can't add include file to this project type ("+t+")")}function Ac(){var l=lt(),t=P.getToolForFilename(l);l.endsWith(".c")||t=="sdcc"||t=="cc65"||t=="cmoc"||t=="smlrc"?Or("Linked C (or .s)",".c",r=>'//#link "'+r+'"'):l.endsWith("asm")||l.endsWith(".s")||t=="ca65"||t=="lwasm"?Or("Linked ASM",".inc",r=>';#link "'+r+'"'):_e("Can't add linked file to this project type ("+t+")")}function Cc(){if(st=new Mn($("#toolbar")[0],null),st.grp.prop("id","run_bar"),st.add("ctrl+alt+r","Reset","glyphicon-refresh",pc).prop("id","dbg_reset"),st.add("ctrl+alt+,","Pause","glyphicon-pause",sc).prop("id","dbg_pause"),st.add("ctrl+alt+.","Resume","glyphicon-play",pl).prop("id","dbg_go"),P.restartAtPC&&st.add("ctrl+alt+/","Restart at Cursor","glyphicon-play-circle",cc).prop("id","dbg_restartatline"),st.newGroup(),st.grp.prop("id","debug_bar"),P.runEval&&st.add("ctrl+alt+e","Reset and Debug","glyphicon-fast-backward",mc).prop("id","dbg_restart"),P.stepBack&&st.add("ctrl+alt+b","Step Backwards","glyphicon-step-backward",hc).prop("id","dbg_stepback"),P.step&&st.add("ctrl+alt+s","Single Step","glyphicon-step-forward",oc).prop("id","dbg_step"),P.stepOver&&st.add("ctrl+alt+t","Step Over","glyphicon-hand-right",lc).prop("id","dbg_stepover"),P.runUntilReturn&&st.add("ctrl+alt+o","Step Out of Subroutine","glyphicon-hand-up",dc).prop("id","dbg_stepout"),P.runToVsync&&st.add("ctrl+alt+n","Next Frame/Interrupt","glyphicon-forward",uc).prop("id","dbg_tovsync"),(P.runEval||P.runToPC)&&!oe.startsWith("verilog")&&st.add("ctrl+alt+l","Run To Line","glyphicon-save",fc).prop("id","dbg_toline"),st.newGroup(),st.grp.prop("id","xtra_bar"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(Gu),$("#item_upload_file").click(Vu),$("#item_open_directory").click(Yu),$("#item_github_login").click(_o),$("#item_github_logout").click(To),$("#item_github_import").click(So),$("#item_github_publish").click(Ao),$("#item_github_push").click(Co),$("#item_github_pull").click(Po),$("#item_repo_delete").click(Do),$("#item_share_file").click(Ro),$("#item_reset_file").click(Ju),$("#item_rename_file").click(Zu),$("#item_delete_file").click(Ku),P.runEval?$("#item_debug_expr").click(gc).show():$("#item_debug_expr").hide(),$("#item_download_rom").click(Fo),$("#item_download_file").click(Io),$("#item_download_zip").click(Oo),P.getDebugSymbolFile?$("#item_download_sym").click(No):$("#item_download_sym").hide(),$("#item_download_allzip").click(Uo),$("#item_record_video").click(Wo),ls()?$("#item_export_cassette").click(Lo):$("#item_export_cassette").hide(),P.setFrameRate&&P.getFrameRate&&($("#dbg_slower").click(yc),$("#dbg_faster").click(xc),$("#dbg_slowest").click(wc),$("#dbg_fastest").click(Ec)),$("#item_addfile_include").click(Sc),$("#item_addfile_link").click(Ac),$("#item_request_persist").click(()=>ws(!0,!1)),gl(),P.newCodeAnalyzer&&st.add(null,"Analyze CPU Timing","glyphicon-time",_c),P.setRecorder&&P.advance&&Pc(),P.showHelp){let{li:r,a}=Es("help__"+oe,bs+" Help");$("#help_menu").append(r),$(a).click(()=>window.open(P.showHelp(),"_8bws_help"))}let l=P.getToolForFilename(lt()),t=Ou[l];if(t){let{li:r,a}=Es("help__"+l,l+" Help");$("#help_menu").append(r),$(a).click(()=>window.open(t,"_8bws_help"))}}function Pc(){var l=$("#replayslider"),t=$("#clockslider"),r=$("#replay_frame"),a=$("#replay_clock");P.advanceFrameClock||$("#clockdiv").hide();var u=()=>{r.text(Lt.lastSeekFrame+""),a.text(Lt.lastSeekStep+"")},d=b=>{Jr();var D=parseInt(l.val().toString()),W=parseInt(t.val().toString());Lt.loadFrame(D,W)>=0&&(t.attr("min",0),t.attr("max",Lt.lastStepCount),u(),ia(P.saveState()))},m=b=>{Jr(),Lt.loadFrame(b)>=0&&(l.val(b),u(),ia(P.saveState()))},y=b=>{Jr();var D=parseInt(l.val().toString());Lt.loadFrame(D,b)>=0&&(t.val(b),u(),ia(P.saveState()))};Lt.callbackStateChanged=()=>{l.attr("min",0),l.attr("max",Lt.numFrames()),l.val(Lt.currentFrame()),t.val(Lt.currentStep()),u(),vn(P.saveState())},l.on("input",d),t.on("input",d),$("#replay_min").click(()=>{m(1)}),$("#replay_max").click(()=>{m(Lt.numFrames())}),$("#replay_back").click(()=>{m(parseInt(l.val().toString())-1)}),$("#replay_fwd").click(()=>{m(parseInt(l.val().toString())+1)}),$("#clock_back").click(()=>{y(parseInt(t.val().toString())-1)}),$("#clock_fwd").click(()=>{y(parseInt(t.val().toString())+1)}),$("#replay_bar").show(),st.add("ctrl+alt+0","Start/Stop Replay Recording","glyphicon-record",Tc).prop("id","dbg_record")}function kc(){try{var l=window.screen.orientation||window.screen.msOrientation||window.screen.mozOrientation||null;if(l){if(l.type.indexOf("landscape")!==-1)return!0;if(l.type.indexOf("portrait")!==-1)return!1}if("orientation"in window){var t=window.orientation;if(t===0||t===180)return!1;if(t===90||t===270)return!0}}catch(r){}return window.innerWidth>window.innerHeight}async function Dc(){if(Ai.shouldCompleteTour()){await qt("lib/bootstrap-tourist.js");var l=oe.startsWith("vcs"),t=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+oe+'</b>" platform. You can choose a different one from the menu.'},{element:"#preset_select",title:"Project Selector",content:"You can choose different code examples, create your own files, or import projects from GitHub."},{element:"#workspace",title:"Code Editor",content:l?"Type your 6502 assembly code into the editor, and it'll be assembled in real-time.":"Type your source code into the editor, and it'll be compiled in real-time."},{element:"#emulator",placement:"left",title:"Emulator",content:"We'll load your compiled code into the emulator whenever you make changes."},{element:"#debug_bar",placement:"bottom",title:"Debug Tools",content:"Use these buttons to set breakpoints, single step through code, pause/resume, and use debugging tools."},{element:"#dropdownMenuButton",title:"Main Menu",content:"Click the menu to create new files, download your code, or share your work with others."},{element:"#sidebar",title:"Sidebar",content:"Pull right to expose the sidebar. It lets you switch between source files, view assembly listings, and use other tools like Disassembler, Memory Browser, and Asset Editor."}];kc()||t.unshift({element:"#controls_top",placement:"bottom",title:"Portrait mode detected",content:"This site works best on desktop browsers. For best results, rotate your device to landscape orientation."}),window.location.host.endsWith("8bitworkshop.com")&&(t.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores cookies and other data in your browser. You can review our <a href="/privacy.html" target="_new">privacy policy</a>.'}),t.push({element:"#booksMenuButton",placement:"left",title:"Books",content:"Get some books that explain how to program all of this stuff, and write some games!"})),dn&&(t.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to sentry.io when exceptions are thrown. Hope that's ok."}),t.unshift({element:"#dropdownMenuButton",placement:"right",title:"Welcome to 8bitworkshop Desktop!",content:'The directory "~/8bitworkshop" contains all of your file edits and built ROM images. You can create new projects under the platform directories (e.g. "c64/myproject")'}));var r=new Tour({autoscroll:!1,steps:t,onEnd:()=>{Ai.completedTour()}});setTimeout(()=>{r.start()},2500)}}function aa(l){var t=(l.message||l.error||l)+"";if(t.indexOf("QuotaExceededError")>=0)ws(!1,!1);else{var r=l.error||l.reason;r!=null&&r instanceof Ca&&Rc(r)}}function Rc(l){console.log("haltEmulation"),Jr(),Vc(l)}function Lc(){window.addEventListener("error",aa),window.addEventListener("unhandledrejection",aa)}function yl(){window.removeEventListener("error",aa),window.removeEventListener("unhandledrejection",aa)}function wi(l,t){t&&(re=t),yl(),l?window.location.replace("?"+$.param(re)):window.location.href="?"+$.param(re)}function sa(){oe&&(re.platform=oe),delete re[""],history.replaceState({},"","?"+$.param(re))}function Fc(){var l=!1;document.addEventListener("visibilitychange",()=>{document.visibilityState=="hidden"&&P&&P.isRunning()?(Jr(),l=!0):document.visibilityState=="visible"&&l&&(Mr(),l=!1)}),$(window).on("focus",()=>{l&&(Mr(),l=!1)}),$(window).on("blur",()=>{P&&P.isRunning()&&(Jr(),l=!0)}),$(window).on("orientationchange",()=>{P&&P.resize&&setTimeout(P.resize.bind(P),200)})}function Ic(){var l=$(document).find(".emucontrols-"+gi(oe));oe.endsWith(".mame")&&l.show();var t=$("#emulator").find("canvas");t&&(t.on("focus",()=>{P.isRunning()&&(l.fadeIn(200),P.pause(),P.resume())}),t.on("blur",()=>{l.fadeOut(200)}))}function Mc(){window.ga&&($(".dropdown-item").click(l=>{l.target&&l.target.id&&yi("menu",l.target.id)}),Eo(location.pathname+"?platform="+oe+(Ke?"&repo="+Ke:"&file="+re.file)))}async function Oc(){if(!Aa[oe])throw Error("Invalid platform '"+oe+"'.");let l=$("#emuscreen")[0],t=Sa(re.options||"");P=new Aa[oe](l,t),Bc(),Lt=new Ys(P);let r=P.getPresets?P.getPresets():[];if(!re.file){var a=Ai.getLastPreset(),u=a||(Ke?null:r[0].id);re.file=u||"DEFAULT",u||_e("There is no default main file for this project. Try selecting one from the pulldown.")}oe=="vcs"&&re.file.startsWith("examples/")&&!re.file.endsWith(".a")&&(re.file+=".a"),sa(),Lc(),Mc(),await P.start(),await nc(),await $u(),await ju(re.file),P.sourceFileFetch=d=>ye.filedata[d],Cc(),Fc(),Ic(),Ft?Nc():(gn(),Uc(),Dc()),xl()}function Nc(){$("#dropdownMenuButton").hide(),$("#platformsMenuButton").hide(),$("#booksMenuButton").hide()}function Uc(){gi(oe)=="nes"?$(".book-nes").addClass("book-active"):gi(oe)=="vcs"?$(".book-vcs").addClass("book-active"):gi(oe)=="verilog"?$(".book-verilog").addClass("book-active"):gi(oe)=="c64"?$(".book-c64").addClass("book-active"):P.getToolForFilename(lt())=="sdcc"&&$(".book-arcade").addClass("book-active")}function xl(){setTimeout(()=>{$("#controls_dynamic").css("visibility","inherit")},250)}function Wc(){var l="workspace-split3-"+oe;Ft&&(l="embed-"+l);var t;oe.startsWith("vcs")?t=[0,50,50]:Ft||Ji?t=[0,55,45]:t=[12,44,44];var r=Qt&&localStorage.getItem(l);if(r)try{t=JSON.parse(r)}catch(u){console.log(u)}var a=Iu(["#sidebar","#workspace","#emulator"],{sizes:t,minSize:[0,250,250],onDrag:()=>{P&&P.resize&&P.resize()},onDragEnd:()=>{Qt&&localStorage.setItem(l,JSON.stringify(a.getSizes())),me&&me.resize()}})}function $c(l){let t=Mi(re.ignore)||Ft;Be(!0),Ln(l,async r=>{if(r){var a=Ot(l);console.log("Importing "+r.length+" bytes as "+a);try{var u=await Xt.getItem(a);Be(!1),u!=null&&t||(u==null||confirm("Replace existing file '"+a+"'?"))&&await Xt.setItem(a,r),delete re.importURL,re.file=a,sa(),El()}finally{Be(!1)}}else _e("Could not load source code from URL: "+l),Be(!1)},"text")}async function Hc(){var l=Mi(re.ignore),t=Mi(re.force);Ft?l=!t:t=!1;for(var r=0;r<20;r++){let u=re["file"+r+"_name"],d=re["file"+r+"_data"];if(u==null||d==null)break;var a=await Xt.getItem(u);if(!(l&&a)){let m=d;re["file"+r+"_type"]=="binary"&&(m=Pn(atob(m))),(!a||t||confirm("Replace existing file '"+u+"'?"))&&await Xt.setItem(u,m)}r==0&&(re.file=u),delete re["file"+r+"_name"],delete re["file"+r+"_data"],delete re["file"+r+"_type"]}delete re.ignore,delete re.force,sa()}function Bc(){var l=P.getPlatformName&&P.getPlatformName(),t=$('a[href="?platform='+oe+'"]');t.length&&(t.addClass("dropdown-item-checked"),l=l||t.text()||l),bs=l||oe,$(".platform_name").text(bs)}function jc(){if(oe=re.platform||Ai.getLastPlatformID(),Ke=re.repo,!re.repo&&!re.file&&(Ke=Ai.getLastRepoID(oe)),Qt&&Ke&&Ke!=="/"){var l=Ni()[Ke];l&&(console.log(oe,re,l),re.repo=Ke,l.platform_id&&!re.platform&&(re.platform=oe=l.platform_id),l.mainPath&&!re.file&&(re.file=l.mainPath))}else Ke="",delete re.repo;oe||(Ft&&wo("The 'platform' must be specified when embed=1"),oe=re.platform="vcs")}async function wl(){if(re.githubURL){Xn(re.githubURL,!0);return}if(jc(),Wc(),Ti=Ke||Nt(oe),Ft&&(Ti=(document.referrer||document.location.href)+Ti),Xt=Nn(Ti),re.importURL){$c(re.importURL);return}re.file0_name&&await Hc(),El()}async function El(){try{var l=await Xs(gi(oe));console.log("starting platform",oe),await Oc(),document.title=document.title+" ["+oe+"] - "+(Ke?"["+Ke+"] - ":"")+ye.mainPath}catch(t){console.log(t),_e('Platform "'+oe+'" failed to load.')}finally{xl()}}var ks="__use_https";function _l(l){document.cookie=ks+"="+l+";domain=8bitworkshop.com;path=/;max-age=315360000"}function zc(){var l=Fn(ks);if(typeof l=="string")return!!l;var t=Qt&&!localStorage.getItem("__lastplatform")?1:0;return _l(t),!!t}function Gc(){bootbox.confirm('<p>Do you want to force the browser to use HTTPS from now on?</p><p>WARNING: This will make all of your local files unavailable, so you should "Download All Changes" first for each platform where you have done work.</p><p>You can go back to HTTP by setting the "'+ks+'" cookie to 0.</p>',l=>{l&&(_l(1),Tl())})}function Tl(){window.location.protocol=="http:"&&window.location.host=="8bitworkshop.com"&&(zc()?(yl(),window.location.replace(window.location.href.replace(/^http:/,"https:"))):$("#item_switch_https").click(Gc).show())}Tl();function Bd(l,t){P.writeFile(l,t)}function jd(l){return P.readFile(l)}function zd(){return P.saveState()}function Vc(l){var t=l&&l.message||t;fl(l,t),me.refresh(!1),P.saveState&&vn(P.saveState())}async function Gd(l){var t=ye.filedata[l];t!=null&&(me.updateFile(l,await alternateLocalFilesystem.getFileData(l)),console.log("updating file",l))}function qc(){if(dn&&Si instanceof Uint8Array){var l=Tt(lt()),t=P.getROMExtension&&P.getROMExtension(Si)||"-"+Nt(oe)+".bin";alternateLocalFilesystem.setFileData(`bin/${l}${t}`,Si)}}function Vd(l){var t=me.getActive();if(t instanceof Ki){var r=t.editor.getSearchCursor(l);r.findNext()&&t.editor.setSelection(r.pos.to,r.pos.from)}}function Yc(){let l=!1;new IntersectionObserver((r,a)=>{for(var u of r)u.isIntersecting&&!l&&(wl(),l=!0),u.intersectionRatio==0&&As()&&P.isRunning()&&Jr(),u.intersectionRatio>0&&As()&&!P.isRunning()&&Mr()},{}).observe($("#emulator")[0])}typeof process=="undefined"&&(Ft&&typeof IntersectionObserver=="function"?Yc():wl());export{no as a,re as b,oe as c,Ti as d,Ke as e,P as f,ye as g,me as h,Xr as i,Qr as j,Ir as k,Pt as l,en as m,lt as n,$o as o,yr as p,Zi as q,bn as r,na as s,Rc as t,wi as u,Wc as v,jc as w,wl as x,Bd as y,jd as z,zd as A,Vc as B,Gd as C,Vd as D};
|
|
/*!
|
|
localForage -- Offline Storage, Improved
|
|
Version 1.10.0
|
|
https://localforage.github.io/localForage
|
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
*/
|
|
/*!
|
|
* jQuery JavaScript Library v3.7.1
|
|
* https://jquery.com/
|
|
*
|
|
* Copyright OpenJS Foundation and other contributors
|
|
* Released under the MIT license
|
|
* https://jquery.org/license
|
|
*
|
|
* Date: 2023-08-28T13:37Z
|
|
*/
|
|
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
|
|
//# sourceMappingURL=chunk-R2WG5Q3S.js.map
|