var MarsgisEditor=function(e,t){"use strict";var i=Object.defineProperty,n=(e,t,n)=>(((e,t,n)=>{t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const i in e)if("default"!==i){const n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:()=>e[i]})}return t.default=e,Object.freeze(t)}const s=r(t),a=class e{static setConfig(t){e.apiConf=t,e.sessionName=t.packageName+"-homepage-config"}static getConfig(){return e.apiConf}static getPackageName(){return e.apiConf.packageName}static getExampleList(){if("online"===e.apiConf.configFetchType)return e.fetchExampleList();try{const t=JSON.parse(sessionStorage.getItem(e.sessionName)||"");if(t)return e.saveCompConfig(t),Promise.resolve(t);throw new Error("无缓存数据")}catch(t){return e.fetchExampleList()}}static async fetchExampleList(){const t=await fetch(e.apiConf.configSourceUrl),i=await t.json();return e.saveCompConfig(i),"local"===e.apiConf.configFetchType&&sessionStorage.setItem(e.sessionName,JSON.stringify(i)),i}static async getCompConfig(t,i){try{const n=e.mars3dExampleConfig,r=e.mars3dExampleConfig;if(i&&r&&r[i]&&r[i].main===t)return r[i];if(n)return n[t];throw new Error("无缓存数据")}catch(n){return await e.getExampleList(),e.getCompConfig(t,i)}}static saveCompConfig(t){const i={},n={};e.totalCount=0,t.forEach(((t,r)=>{t.id=`ex_${r}`,t.children&&(t.count=0,t.children.forEach(((r,s)=>{r.id=`${t.id}_${s}`,r.children&&(r.count=r.children.length,r.children.forEach(((s,a)=>{t.count++,s.id=`${r.id}_${a}`,s.fullName=`${t.name} - ${r.name} - ${s.name}`,s.thumbnail=`${e.apiConf.thumbnailPublicPath||"/"}${s.thumbnail||"thumbnail.jpg"}`,i[s.main]=s,n[s.id]=s,s.hidden||e.totalCount++})))})))})),e.mars3dExampleConfig=i,e.mars3dExampleConfigKeymap=n}static getResourcesByLibs(t){t&&0!==t.length||(t=[e.apiConf.packageName]);let i=[];const n={};for(let r=0,s=t.length;rt.startsWith("http")||t.startsWith("//:")?t:e.apiConf.libPublicPath+t))))}return i}static getLibs(t,i=[],n=[]){return e.getResourcesByLibs(i).concat(n).map((i=>{let n=i;return i.startsWith(".")||i.startsWith("http")||i.startsWith("//:")?n=i:i.startsWith("/")?"/"!==e.apiConf.baseUrl&&(n=e.apiConf.baseUrl+i):n=`${e.apiConf.resourcePublicPath}/${t}/${i}`,{name:n,url:n}}))}static getQueryString(e){return new URL(window.location.href).searchParams.get(e)}static LoadSource(t){const i=n=>{if(t.length){const r=t.shift();let s;s=r.endsWith(".css")?e.loadLink(r):e.loadScript(r),s.then((()=>{i(n)}))}else n(!0)};return new Promise((e=>{i(e)}))}static loadScript(e,t=!0){const i=document.createElement("script");return i.async=t,i.src=e,document.body.appendChild(i),new Promise((e=>{i.onload=()=>{e(!0)}}))}static loadLink(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,document.head.appendChild(t),new Promise((e=>{t.onload=()=>{e(!0)}}))}static scriptFilter(t){return t=(t=(t=t.replace(/const /gm,"var ")).replace(/let /gm,"var ")).replace(/export /gm,""),t=(t="mars3d"===e.apiConf.packageName?(t=t.replace('import * as mars3d from "mars3d"',"")).replace("const Cesium = mars3d.Cesium",""):(t=t.replace('import * as mars2d from "mars2d"',"")).replace("const L = mars3d.L","")).replace(/import /gm,"// import ")}};n(a,"apiConf"),n(a,"sessionName"),n(a,"totalCount",0),n(a,"mars3dExampleConfig"),n(a,"mars3dExampleConfigKeymap");let o=a;function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var A={};const m=l(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var d={};!function(e){var t=/[|\\{}()[\]^$+*?.]/g,i=Object.prototype.hasOwnProperty,n=function(e,t){return i.apply(e,[t])};e.escapeRegExpChars=function(e){return e?String(e).replace(t,"\\$&"):""};var r={"&":"&","<":"<",">":">",'"':""","'":"'"},s=/[&<>'"]/g;function a(e){return r[e]||e}function o(){return Function.prototype.toString.call(this)+';\nvar _ENCODE_HTML_RULES = {\n "&": "&"\n , "<": "<"\n , ">": ">"\n , \'"\': """\n , "\'": "'"\n }\n , _MATCH_HTML = /[&<>\'"]/g;\nfunction encode_char(c) {\n return _ENCODE_HTML_RULES[c] || c;\n};\n'}e.escapeXML=function(e){return null==e?"":String(e).replace(s,a)};try{"function"==typeof Object.defineProperty?Object.defineProperty(e.escapeXML,"toString",{value:o}):e.escapeXML.toString=o}catch(c){console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}e.shallowCopy=function(e,t){if(t=t||{},null!=e)for(var i in t)n(t,i)&&"__proto__"!==i&&"constructor"!==i&&(e[i]=t[i]);return e},e.shallowCopyFromList=function(e,t,i){if(i=i||[],t=t||{},null!=e)for(var r=0;r * @author Tiancheng "Timothy" Gu * @project EJS * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} */ var t=m,i=m,n=d,r=!1,s=u,a="locals",o=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],c=o.concat("cache"),l=/^\uFEFF/,A=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;function p(i,n){var r;if(n.some((function(n){return r=e.resolveInclude(i,n,!0),t.existsSync(r)})))return r}function g(t,i){var n,r=t.filename,s=arguments.length>1;if(t.cache){if(!r)throw new Error("cache option requires a filename");if(n=e.cache.get(r))return n;s||(i=h(r).toString().replace(l,""))}else if(!s){if(!r)throw new Error("Internal EJS error: no file name or template provided");i=h(r).toString().replace(l,"")}return n=e.compile(i,t),t.cache&&e.cache.set(r,n),n}function h(t){return e.fileLoader(t)}function I(i,r){var s=n.shallowCopy(n.createNullProtoObjWherePossible(),r);if(s.filename=function(i,n){var r,s,a=n.views,o=/^[A-Za-z]+:\\|^\//.exec(i);if(o&&o.length)i=i.replace(/^\/*/,""),r=Array.isArray(n.root)?p(i,n.root):e.resolveInclude(i,n.root||"/",!0);else if(n.filename&&(s=e.resolveInclude(i,n.filename),t.existsSync(s)&&(r=s)),!r&&Array.isArray(a)&&(r=p(i,a)),!r&&"function"!=typeof n.includer)throw new Error('Could not find the include file "'+n.escapeFunction(i)+'"');return r}(i,s),"function"==typeof r.includer){var a=r.includer(i,s.filename);if(a&&(a.filename&&(s.filename=a.filename),a.template))return g(s,a.template)}return g(s)}function f(e,t,i,n,r){var s=t.split("\n"),a=Math.max(n-3,0),o=Math.min(s.length,n+3),c=r(i),l=s.slice(a,o).map((function(e,t){var i=t+a+1;return(i==n?" >> ":" ")+i+"| "+e})).join("\n");throw e.path=c,e.message=(c||"ejs")+":"+n+"\n"+l+"\n\n"+e.message,e}function M(e){return e.replace(/;(\s*$)/,"$1")}function y(t,i){i=i||n.createNullProtoObjWherePossible();var r=n.createNullProtoObjWherePossible();this.templateText=t,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",r.client=i.client||!1,r.escapeFunction=i.escape||i.escapeFunction||n.escapeXML,r.compileDebug=!1!==i.compileDebug,r.debug=!!i.debug,r.filename=i.filename,r.openDelimiter=i.openDelimiter||e.openDelimiter||"<",r.closeDelimiter=i.closeDelimiter||e.closeDelimiter||">",r.delimiter=i.delimiter||e.delimiter||"%",r.strict=i.strict||!1,r.context=i.context,r.cache=i.cache||!1,r.rmWhitespace=i.rmWhitespace,r.root=i.root,r.includer=i.includer,r.outputFunctionName=i.outputFunctionName,r.localsName=i.localsName||e.localsName||a,r.views=i.views,r.async=i.async,r.destructuredLocals=i.destructuredLocals,r.legacyInclude=void 0===i.legacyInclude||!!i.legacyInclude,r.strict?r._with=!1:r._with=void 0===i._with||i._with,this.opts=r,this.regex=this.createRegex()}e.cache=n.cache,e.fileLoader=t.readFileSync,e.localsName=a,e.promiseImpl=new Function("return this;")().Promise,e.resolveInclude=function(e,t,n){var r=i.dirname,s=i.extname,a=(0,i.resolve)(n?t:r(t),e);return s(e)||(a+=".ejs"),a},e.compile=function(e,t){return t&&t.scope&&(r||(console.warn("`scope` option is deprecated and will be removed in EJS 3"),r=!0),t.context||(t.context=t.scope),delete t.scope),new y(e,t).compile()},e.render=function(e,t,i){var r=t||n.createNullProtoObjWherePossible(),s=i||n.createNullProtoObjWherePossible();return 2==arguments.length&&n.shallowCopyFromList(s,r,o),g(s,e)(r)},e.renderFile=function(){var t,i,r,s=Array.prototype.slice.call(arguments),a=s.shift(),o={filename:a};return"function"==typeof arguments[arguments.length-1]&&(t=s.pop()),s.length?(i=s.shift(),s.length?n.shallowCopy(o,s.pop()):(i.settings&&(i.settings.views&&(o.views=i.settings.views),i.settings["view cache"]&&(o.cache=!0),(r=i.settings["view options"])&&n.shallowCopy(o,r)),n.shallowCopyFromList(o,i,c)),o.filename=a):i=n.createNullProtoObjWherePossible(),function(t,i,n){var r;if(!n){if("function"==typeof e.promiseImpl)return new e.promiseImpl((function(e,n){try{e(r=g(t)(i))}catch(s){n(s)}}));throw new Error("Please provide a callback function")}try{r=g(t)(i)}catch(s){return n(s)}n(null,r)}(o,i,t)},e.Template=y,e.clearCache=function(){e.cache.reset()},y.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"},y.prototype={createRegex:function(){var e="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",t=n.escapeRegExpChars(this.opts.delimiter),i=n.escapeRegExpChars(this.opts.openDelimiter),r=n.escapeRegExpChars(this.opts.closeDelimiter);return e=e.replace(/%/g,t).replace(//g,r),new RegExp(e)},compile:function(){var e,t,r,s=this.opts,a="",o="",c=s.escapeFunction,l=s.filename?JSON.stringify(s.filename):"undefined";if(!this.source){if(this.generateSource(),a+=' var __output = "";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n',s.outputFunctionName){if(!A.test(s.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");a+=" var "+s.outputFunctionName+" = __append;\n"}if(s.localsName&&!A.test(s.localsName))throw new Error("localsName is not a valid JS identifier.");if(s.destructuredLocals&&s.destructuredLocals.length){for(var m=" var __locals = ("+s.localsName+" || {}),\n",d=0;d0&&(m+=",\n "),m+=u+" = __locals."+u}a+=m+";\n"}!1!==s._with&&(a+=" with ("+s.localsName+" || {}) {\n",o+=" }\n"),o+=" return __output;\n",this.source=a+this.source+o}e=s.compileDebug?"var __line = 1\n , __lines = "+JSON.stringify(this.templateText)+"\n , __filename = "+l+";\ntry {\n"+this.source+"} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n":this.source,s.client&&(e="escapeFn = escapeFn || "+c.toString()+";\n"+e,s.compileDebug&&(e="rethrow = rethrow || "+f.toString()+";\n"+e)),s.strict&&(e='"use strict";\n'+e),s.debug&&console.log(e),s.compileDebug&&s.filename&&(e=e+"\n//# sourceURL="+l+"\n");try{if(s.async)try{r=new Function("return (async function(){}).constructor;")()}catch(M){throw M instanceof SyntaxError?new Error("This environment does not support async/await"):M}else r=Function;t=new r(s.localsName+", escapeFn, include, rethrow",e)}catch(M){throw M instanceof SyntaxError&&(s.filename&&(M.message+=" in "+s.filename),M.message+=" while compiling ejs\n\n",M.message+="If the above error is not helpful, you may want to try EJS-Lint:\n",M.message+="https://github.com/RyanZim/EJS-Lint",s.async||(M.message+="\n",M.message+="Or, if you meant to create an async function, pass `async: true` as an option.")),M}var p=s.client?t:function(e){return t.apply(s.context,[e||n.createNullProtoObjWherePossible(),c,function(t,i){var r=n.shallowCopy(n.createNullProtoObjWherePossible(),e);return i&&(r=n.shallowCopy(r,i)),I(t,s)(r)},f])};if(s.filename&&"function"==typeof Object.defineProperty){var g=s.filename,h=i.basename(g,i.extname(g));try{Object.defineProperty(p,"name",{value:h,writable:!1,enumerable:!1,configurable:!0})}catch(M){}}return p},generateSource:function(){this.opts.rmWhitespace&&(this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var e=this,t=this.parseTemplateText(),i=this.opts.delimiter,n=this.opts.openDelimiter,r=this.opts.closeDelimiter;t&&t.length&&t.forEach((function(s,a){var o;if(0===s.indexOf(n+i)&&0!==s.indexOf(n+i+i)&&(o=t[a+2])!=i+r&&o!="-"+i+r&&o!="_"+i+r)throw new Error('Could not find matching close tag for "'+s+'".');e.scanLine(s)}))},parseTemplateText:function(){for(var e,t=this.templateText,i=this.regex,n=i.exec(t),r=[];n;)0!==(e=n.index)&&(r.push(t.substring(0,e)),t=t.slice(e)),r.push(n[0]),t=t.slice(n[0].length),n=i.exec(t);return t&&r.push(t),r},_addOutput:function(e){if(this.truncate&&(e=e.replace(/^(?:\r\n|\r|\n)/,""),this.truncate=!1),!e)return e;e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/"/g,'\\"'),this.source+=' ; __append("'+e+'")\n'},scanLine:function(e){var t,i=this.opts.delimiter,n=this.opts.openDelimiter,r=this.opts.closeDelimiter;switch(t=e.split("\n").length-1,e){case n+i:case n+i+"_":this.mode=y.modes.EVAL;break;case n+i+"=":this.mode=y.modes.ESCAPED;break;case n+i+"-":this.mode=y.modes.RAW;break;case n+i+"#":this.mode=y.modes.COMMENT;break;case n+i+i:this.mode=y.modes.LITERAL,this.source+=' ; __append("'+e.replace(n+i+i,n+i)+'")\n';break;case i+i+r:this.mode=y.modes.LITERAL,this.source+=' ; __append("'+e.replace(i+i+r,i+r)+'")\n';break;case i+r:case"-"+i+r:case"_"+i+r:this.mode==y.modes.LITERAL&&this._addOutput(e),this.mode=null,this.truncate=0===e.indexOf("-")||0===e.indexOf("_");break;default:if(this.mode){switch(this.mode){case y.modes.EVAL:case y.modes.ESCAPED:case y.modes.RAW:e.lastIndexOf("//")>e.lastIndexOf("\n")&&(e+="\n")}switch(this.mode){case y.modes.EVAL:this.source+=" ; "+e+"\n";break;case y.modes.ESCAPED:this.source+=" ; __append(escapeFn("+M(e)+"))\n";break;case y.modes.RAW:this.source+=" ; __append("+M(e)+")\n";break;case y.modes.COMMENT:break;case y.modes.LITERAL:this._addOutput(e)}}else this._addOutput(e)}this.opts.compileDebug&&t&&(this.currentLine+=t,this.source+=" ; __line = "+this.currentLine+"\n")}},e.escapeXML=n.escapeXML,e.__express=e.renderFile,e.VERSION=s,e.name="ejs","undefined"!=typeof window&&(window.ejs=e)}(A);const p=c(A);var g="undefined"!=typeof window?window:null,h=null===g,I=h?void 0:g.document,f="addEventListener",M="removeEventListener",y="getBoundingClientRect",S="_a",v="_b",D="_c",w="horizontal",C=function(){return!1},N=h?"calc":["","-webkit-","-moz-","-o-"].filter((function(e){var t=I.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length})).shift()+"calc",b=function(e){return"string"==typeof e||e instanceof String},E=function(e){if(b(e)){var t=I.querySelector(e);if(!t)throw new Error("Selector "+e+" did not match a DOM element");return t}return e},k=function(e,t,i){var n=e[t];return void 0!==n?n:i},j=function(e,t,i,n){if(t){if("end"===n)return 0;if("center"===n)return e/2}else if(i){if("start"===n)return 0;if("center"===n)return e/2}return e},x=function(e,t){var i=I.createElement("div");return i.className="gutter gutter-"+t,i},z=function(e,t,i){var n={};return b(t)?n[e]=t:n[e]=N+"("+t+"% - "+i+"px)",n},L=function(e,t){var i;return(i={})[e]=t+"px",i},P=function(e,t){if(void 0===t&&(t={}),h)return{};var i,n,r,s,a,o,c=e;Array.from&&(c=Array.from(c));var l=E(c[0]).parentNode,A=getComputedStyle?getComputedStyle(l):null,m=A?A.flexDirection:null,d=k(t,"sizes")||c.map((function(){return 100/c.length})),u=k(t,"minSize",100),p=Array.isArray(u)?u:c.map((function(){return u})),N=k(t,"maxSize",1/0),b=Array.isArray(N)?N:c.map((function(){return N})),P=k(t,"expandToMin",!1),T=k(t,"gutterSize",10),Q=k(t,"gutterAlign","center"),B=k(t,"snapOffset",30),Z=Array.isArray(B)?B:c.map((function(){return B})),J=k(t,"dragInterval",1),O=k(t,"direction",w),Y=k(t,"cursor",O===w?"col-resize":"row-resize"),V=k(t,"gutter",x),R=k(t,"elementStyle",z),U=k(t,"gutterStyle",L);function W(e,t,n,r){var s=R(i,t,n,r);Object.keys(s).forEach((function(t){e.style[t]=s[t]}))}function H(){return o.map((function(e){return e.size}))}function G(e){return"touches"in e?e.touches[0][n]:e[n]}function F(e){var t=o[this.a],i=o[this.b],n=t.size+i.size;t.size=e/this.size*n,i.size=n-e/this.size*n,W(t.element,t.size,this[v],t.i),W(i.element,i.size,this[D],i.i)}function X(e){var i,n=o[this.a],r=o[this.b];this.dragging&&(i=G(e)-this.start+(this[v]-this.dragOffset),J>1&&(i=Math.round(i/J)*J),i<=n.minSize+n.snapOffset+this[v]?i=n.minSize+this[v]:i>=this.size-(r.minSize+r.snapOffset+this[D])&&(i=this.size-(r.minSize+this[D])),i>=n.maxSize-n.snapOffset+this[v]?i=n.maxSize+this[v]:i<=this.size-(r.maxSize-r.snapOffset+this[D])&&(i=this.size-(r.maxSize+this[D])),F.call(this,i),k(t,"onDrag",C)(H()))}function K(){var e=o[this.a].element,t=o[this.b].element,n=e[y](),a=t[y]();this.size=n[i]+a[i]+this[v]+this[D],this.start=n[r],this.end=n[s]}function q(e){var t=function(e){if(!getComputedStyle)return null;var t=getComputedStyle(e);if(!t)return null;var i=e[a];return 0===i?null:i-=O===w?parseFloat(t.paddingLeft)+parseFloat(t.paddingRight):parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)}(l);if(null===t)return e;if(p.reduce((function(e,t){return e+t}),0)>t)return e;var i=0,n=[],r=e.map((function(r,s){var a=t*r/100,o=j(T,0===s,s===e.length-1,Q),c=p[s]+o;return a0&&n[r]-i>0){var a=Math.min(i,n[r]-i);i-=a,s=e-a}return s/t*100}))}function _(){var e=this,i=o[e.a].element,n=o[e.b].element;e.dragging&&k(t,"onDragEnd",C)(H()),e.dragging=!1,g[M]("mouseup",e.stop),g[M]("touchend",e.stop),g[M]("touchcancel",e.stop),g[M]("mousemove",e.move),g[M]("touchmove",e.move),e.stop=null,e.move=null,i[M]("selectstart",C),i[M]("dragstart",C),n[M]("selectstart",C),n[M]("dragstart",C),i.style.userSelect="",i.style.webkitUserSelect="",i.style.MozUserSelect="",i.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",I.body.style.cursor=""}function $(e){if(!("button"in e)||0===e.button){var i=this,n=o[i.a].element,r=o[i.b].element;i.dragging||k(t,"onDragStart",C)(H()),e.preventDefault(),i.dragging=!0,i.move=X.bind(i),i.stop=_.bind(i),g[f]("mouseup",i.stop),g[f]("touchend",i.stop),g[f]("touchcancel",i.stop),g[f]("mousemove",i.move),g[f]("touchmove",i.move),n[f]("selectstart",C),n[f]("dragstart",C),r[f]("selectstart",C),r[f]("dragstart",C),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",i.gutter.style.cursor=Y,i.parent.style.cursor=Y,I.body.style.cursor=Y,K.call(i),i.dragOffset=G(e)-i.end}}O===w?(i="width",n="clientX",r="left",s="right",a="clientWidth"):"vertical"===O&&(i="height",n="clientY",r="top",s="bottom",a="clientHeight"),d=q(d);var ee=[];function te(e){var t=e.i===ee.length,i=t?ee[e.i-1]:ee[e.i];K.call(i);var n=t?i.size-e.minSize-i[D]:e.minSize+i[v];F.call(i,n)}return(o=c.map((function(e,t){var n,r={element:E(e),size:d[t],minSize:p[t],maxSize:b[t],snapOffset:Z[t],i:t};if(t>0&&((n={a:t-1,b:t,dragging:!1,direction:O,parent:l})[v]=j(T,t-1==0,!1,Q),n[D]=j(T,!1,t===c.length-1,Q),"row-reverse"===m||"column-reverse"===m)){var s=n.a;n.a=n.b,n.b=s}if(t>0){var a=V(t,O,r.element);!function(e,t,n){var r=U(i,t,n);Object.keys(r).forEach((function(t){e.style[t]=r[t]}))}(a,T,t),n[S]=$.bind(n),a[f]("mousedown",n[S]),a[f]("touchstart",n[S]),l.insertBefore(a,r.element),n.gutter=a}return W(r.element,r.size,j(T,0===t,t===c.length-1,Q),t),t>0&&ee.push(n),r}))).forEach((function(e){var t=e.element[y]()[i];t0){var n=ee[i-1],r=o[n.a],s=o[n.b];r.size=t[i-1],s.size=e,W(r.element,r.size,n[v],r.i),W(s.element,s.size,n[D],s.i)}}))},getSizes:H,collapse:function(e){te(o[e])},destroy:function(e,t){ee.forEach((function(n){if(!0!==t?n.parent.removeChild(n.gutter):(n.gutter[M]("mousedown",n[S]),n.gutter[M]("touchstart",n[S])),!0!==e){var r=R(i,n.a.size,n[v]);Object.keys(r).forEach((function(e){o[n.a].element.style[e]="",o[n.b].element.style[e]=""}))}}))},parent:l,pairs:ee}};class T{constructor(){n(this,"_cache",{})}on(e,t){const i=this._cache[e]=this._cache[e]||[];return-1===i.indexOf(t)&&i.push(t),this}emit(e,...t){const i=this._cache[e];return Array.isArray(i)&&i.forEach((e=>{e(...t)})),this}off(e,t){const i=this._cache[e];if(Array.isArray(i))if(t){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}else i.length=0;return this}}class Q extends T{constructor(e,t,i){super(),n(this,"split"),n(this,"leftId"),n(this,"rightId"),this.leftId=e,this.rightId=t,this.split=P([`#${e}`,`#${t}`],{sizes:i?[35,65]:[0,100],minSize:[0,800],gutterSize:5,gutter(e,t){const n=document.createElement("div");return i||(n.style.display="none"),n.className=`gutter gutter-${t}`,n.id="split-gutter",n},onDrag:()=>{this.getSize(0)<5?this.collapse():(document.getElementById("split-gutter").style.display="block",this.emit("layout"))}}),i||(document.getElementById(this.rightId).style.width="100%")}getSize(e){return this.split.getSizes()[e]}expand(){this.split.setSizes([35,65]),document.getElementById("split-gutter").style.display="block",this.emit("layout")}collapse(){this.split.collapse(0),document.getElementById("split-gutter").style.display="none",document.getElementById(this.rightId).style.width="100%",this.emit("layout")}setLeft(e){const t=document.getElementById(this.leftId);t&&(t.innerHTML=e)}setRight(e){const t=document.getElementById(this.rightId);t&&(t.innerHTML=e)}}const B={theme:"vs-dark",formatOnPaste:!0,fontSize:14,scrollbar:{verticalScrollbarSize:2}};class Z extends T{constructor(e){super(),n(this,"editor"),n(this,"uiEditor"),n(this,"resetBtn"),n(this,"runBtn"),n(this,"jsContainerId","js-editor"),n(this,"originScript"),n(this,"config"),n(this,"showJsBtn"),n(this,"showUIBtn"),n(this,"jsEditorContainer"),n(this,"uiEditorContainer"),n(this,"fileNameEle"),this.config=e,this.editor=s.editor.create(document.getElementById(this.jsContainerId),{language:"javascript",value:"",...B}),this.fetchScript(),this.config.hasPannel&&this.fetchUISource().then((e=>{this.uiEditor=s.editor.create(document.getElementById("ui-editor"),{language:o.apiConf.UIFileLanguage,readOnly:!0,...B}),this.uiEditor.setValue(e)})),this.bindEvent()}async fetchScript(){const e=await fetch(`${o.apiConf.resourcePublicPath}/${this.config.main}/map.js`);this.originScript=await e.text(),this.editor.setValue(this.originScript),this.emit("run",this.originScript)}async fetchUISource(e){let t;if(o.apiConf.fetchUICode){t=await o.apiConf.fetchUICode(this.config.main,e)}else if(e){const i=await fetch(e.url.replaceAll("{main}",`${o.apiConf.resourcePublicPath}/${this.config.main}`));t=await i.text()}else{const e=await fetch(o.apiConf.UIFile(this.config.main));t=await e.text()}return t}resize(){this.editor&&this.editor.layout(),this.uiEditor&&this.uiEditor.layout()}bindEvent(){this.jsEditorContainer||(this.jsEditorContainer=document.getElementById("js-editor")),this.uiEditorContainer||(this.uiEditorContainer=document.getElementById("ui-editor")),this.resetBtn||(this.resetBtn=document.getElementById("jsreset")),this.runBtn||(this.runBtn=document.getElementById("jsrun")),this.fileNameEle||(this.fileNameEle=document.getElementById("filename")),this.config.hasPannel&&(this.showJsBtn||(this.showJsBtn=document.getElementById("showjs-button")),this.showUIBtn||(this.showUIBtn=document.getElementById("showui-button")),this.showJsBtn.addEventListener("click",(()=>{this.jsEditorContainer.style.display="block",this.uiEditorContainer.style.display="none",this.fileNameEle.innerHTML="JS代码",this.resize()})),this.showUIBtn.addEventListener("click",(()=>{this.uiEditorContainer.style.display="block",this.jsEditorContainer.style.display="none",this.fileNameEle.innerHTML="UI面板代码(只读)",this.resize()})),document.querySelectorAll(".uidep-item").forEach((e=>{e.addEventListener("click",(async e=>{const t=e.currentTarget;try{const e=JSON.parse(t.dataset.file);console.log(e);const i=await this.fetchUISource(e);console.log(i),this.uiEditor.setValue(i),this.uiEditorContainer.style.display="block",this.jsEditorContainer.style.display="none",this.fileNameEle.innerHTML=`${e.name}(只读)`,this.resize()}catch(i){throw i}}))}))),this.resetBtn.addEventListener("click",(()=>{this.editor.setValue(this.originScript),this.emit("run",this.scriptFilter(this.originScript))})),this.runBtn.addEventListener("click",(()=>{this.emit("run",this.scriptFilter(this.editor.getValue()))})),window.addEventListener("resize",(()=>{this.resize()})),document.addEventListener("keydown",(e=>{if(!e.ctrlKey)return;const t=String.fromCharCode(e.keyCode).toLowerCase();"s"===t?(e.preventDefault(),this.emit("run",this.scriptFilter(this.editor.getValue()))):"r"===t&&(e.preventDefault(),this.emit("run",this.scriptFilter(this.originScript)))}))}scriptFilter(e){return e=(e=(e=e.replace(/export let /gm,"var ")).replace(/export const /gm,"var ")).replace(/export /gm,""),e=(e="mars3d"===o.apiConf.packageName?(e=e.replace('import * as mars3d from "mars3d"',"")).replace("const Cesium = mars3d.Cesium",""):(e=e.replace('import * as mars2d from "mars2d"',"")).replace("const L = mars3d.L","")).replace(/import /gm,"// import ")}}class J extends T{constructor(e){super(),n(this,"sanboxWapper"),n(this,"scriptDoc"),n(this,"htmlTemp"),n(this,"resourcePublicPath"),n(this,"exampleConfig"),this.exampleConfig=e,this.sanboxWapper=document.getElementById("sanbox"),this.resourcePublicPath=o.apiConf.resourcePublicPath||"",this.getTemp()}writeScriptDoc(e){this.scriptDoc=o.scriptFilter(e),this.loadFramePage()}async loadFramePage(){const{main:e}=this.exampleConfig;if(this.scriptDoc&&this.htmlTemp){const t=this.createFrame().contentWindow.document,i=`\n