UNPKG

cesium-ws-patch

Version:

Cesium WebSocket 多连接补丁,支持请求耗时统计、负载均衡、超时重试等功能

1 lines 37.1 kB
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["index"]=e():t["index"]=e()})(this,(function(){return function(){var t={6221:function(t,e,r){var n=r(477);t.exports=function(){return n('(function(){self.onmessage=async e=>{const{type:t,key:a,buffer:r}=e.data,s=await navigator.storage.getDirectory(),o=a.replace(/[^\\w.-]/g,"_");try{const e=await s.getFileHandle(o,{create:"write"===t});if("write"===t){const t=await e.createWritable();await t.write(r),await t.close(),self.postMessage({status:"written",key:a})}else if("read"===t){const t=await e.getFile(),r=await t.arrayBuffer();self.postMessage({status:"read",key:a,buffer:r},[r])}}catch(i){self.postMessage({status:"error",key:a,error:i.message})}},self.onerror=function(e){console.error("CacheWorker error:",e)}})();',"Worker",void 0,void 0)}},564:function(t,e,r){var n=r(477);t.exports=function(){return n('(function(){importScripts("http://192.168.2.122:18889/modelWsD/libs/pako.min.js"),self.onmessage=function(e){if(!e?.data?.id)return;const{id:r,payload:o}=e.data;try{const e=pako.inflate(new Uint8Array(o)).buffer;self.postMessage({id:r,buffer:e},[e])}catch(s){console.error("inflate.worker.js 解压失败",s),self.postMessage({id:r,error:s.message})}},self.onerror=function(e){console.error("Worker error:",e)}})();',"Worker",void 0,void 0)}},9931:function(t,e,r){var n=r(477);t.exports=function(){return n('(function(){self.onmessage=async e=>{const{type:a,key:t,data:s}=e.data,r=await navigator.storage.getDirectory();try{switch(a){case"list":{const e=[];for await(const[a,t]of r.entries())if("file"===t.kind){const s=await t.getFile();e.push({name:a,size:s.size})}self.postMessage({type:"list",list:e});break}case"read":{const e=await r.getFileHandle(t),a=await e.getFile(),s=await a.arrayBuffer();self.postMessage({type:"read",key:t,buffer:s},[s]);break}case"write":{const e=await r.getFileHandle(t,{create:!0}),a=await e.createWritable();await a.write(s),await a.close(),self.postMessage({type:"write",key:t,success:!0});break}case"delete":await r.removeEntry(t),self.postMessage({type:"delete",key:t,success:!0});break;case"clear":for await(const[e]of r.entries())await r.removeEntry(e);self.postMessage({type:"clear",success:!0});break;case"quota":{const{usage:e,quota:a}=await navigator.storage.estimate();self.postMessage({type:"quota",usage:e,quota:a,free:a-e});break}default:throw new Error(`Unsupported operation type: ${a}`)}}catch(o){console.error(`[OPFSWorker] 处理 ${a} 时出错:`,o),self.postMessage({type:"error",key:t,error:o.message})}}})();',"Worker",void 0,void 0)}},9662:function(t,e,r){var n=r(614),o=r(6330),i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not a function")}},6077:function(t,e,r){var n=r(614),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||n(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},5787:function(t,e,r){var n=r(7976),o=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw o("Incorrect invocation")}},9670:function(t,e,r){var n=r(111),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw i(o(t)+" is not an object")}},3013:function(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},260:function(t,e,r){"use strict";var n,o,i,c=r(3013),a=r(9781),s=r(7854),u=r(614),f=r(111),p=r(2597),l=r(648),d=r(6330),y=r(8880),v=r(8052),g=r(7045),m=r(7976),h=r(9518),b=r(7674),w=r(5112),x=r(9711),E=r(9909),S=E.enforce,T=E.get,O=s.Int8Array,A=O&&O.prototype,_=s.Uint8ClampedArray,R=_&&_.prototype,I=O&&h(O),M=A&&h(A),k=Object.prototype,j=s.TypeError,P=w("toStringTag"),C=x("TYPED_ARRAY_TAG"),D="TypedArrayConstructor",B=c&&!!b&&"Opera"!==l(s.opera),F=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},W={BigInt64Array:8,BigUint64Array:8},U=function(t){if(!f(t))return!1;var e=l(t);return"DataView"===e||p(N,e)||p(W,e)},z=function(t){var e=h(t);if(f(e)){var r=T(e);return r&&p(r,D)?r[D]:z(e)}},L=function(t){if(!f(t))return!1;var e=l(t);return p(N,e)||p(W,e)},$=function(t){if(L(t))return t;throw j("Target is not a typed array")},q=function(t){if(u(t)&&(!b||m(I,t)))return t;throw j(d(t)+" is not a typed array constructor")},H=function(t,e,r,n){if(a){if(r)for(var o in N){var i=s[o];if(i&&p(i.prototype,t))try{delete i.prototype[t]}catch(c){try{i.prototype[t]=e}catch(u){}}}M[t]&&!r||v(M,t,r?e:B&&A[t]||e,n)}},V=function(t,e,r){var n,o;if(a){if(b){if(r)for(n in N)if(o=s[n],o&&p(o,t))try{delete o[t]}catch(i){}if(I[t]&&!r)return;try{return v(I,t,r?e:B&&I[t]||e)}catch(i){}}for(n in N)o=s[n],!o||o[t]&&!r||v(o,t,e)}};for(n in N)o=s[n],i=o&&o.prototype,i?S(i)[D]=o:B=!1;for(n in W)o=s[n],i=o&&o.prototype,i&&(S(i)[D]=o);if((!B||!u(I)||I===Function.prototype)&&(I=function(){throw j("Incorrect invocation")},B))for(n in N)s[n]&&b(s[n],I);if((!B||!M||M===k)&&(M=I.prototype,B))for(n in N)s[n]&&b(s[n].prototype,M);if(B&&h(R)!==M&&b(R,M),a&&!p(M,P))for(n in F=!0,g(M,P,{configurable:!0,get:function(){return f(this)?this[C]:void 0}}),N)s[n]&&y(s[n],C,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:F&&C,aTypedArray:$,aTypedArrayConstructor:q,exportTypedArrayMethod:H,exportTypedArrayStaticMethod:V,getTypedArrayConstructor:z,isView:U,isTypedArray:L,TypedArray:I,TypedArrayPrototype:M}},7745:function(t,e,r){var n=r(6244);t.exports=function(t,e){var r=0,o=n(e),i=new t(o);while(o>r)i[r]=e[r++];return i}},1318:function(t,e,r){var n=r(5656),o=r(1400),i=r(6244),c=function(t){return function(e,r,c){var a,s=n(e),u=i(s),f=o(c,u);if(t&&r!=r){while(u>f)if(a=s[f++],a!=a)return!0}else for(;u>f;f++)if((t||f in s)&&s[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:c(!0),indexOf:c(!1)}},3658:function(t,e,r){"use strict";var n=r(9781),o=r(3157),i=TypeError,c=Object.getOwnPropertyDescriptor,a=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=a?function(t,e){if(o(t)&&!c(t,"length").writable)throw i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},1843:function(t,e,r){var n=r(6244);t.exports=function(t,e){for(var r=n(t),o=new e(r),i=0;i<r;i++)o[i]=t[r-i-1];return o}},1572:function(t,e,r){var n=r(6244),o=r(9303),i=RangeError;t.exports=function(t,e,r,c){var a=n(t),s=o(r),u=s<0?a+s:s;if(u>=a||u<0)throw i("Incorrect index");for(var f=new e(a),p=0;p<a;p++)f[p]=p===u?c:t[p];return f}},4326:function(t,e,r){var n=r(1702),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},648:function(t,e,r){var n=r(1694),o=r(614),i=r(4326),c=r(5112),a=c("toStringTag"),s=Object,u="Arguments"==i(function(){return arguments}()),f=function(t,e){try{return t[e]}catch(r){}};t.exports=n?i:function(t){var e,r,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=f(e=s(t),a))?r:u?i(e):"Object"==(n=i(e))&&o(e.callee)?"Arguments":n}},9920:function(t,e,r){var n=r(2597),o=r(3887),i=r(1236),c=r(3070);t.exports=function(t,e,r){for(var a=o(e),s=c.f,u=i.f,f=0;f<a.length;f++){var p=a[f];n(t,p)||r&&n(r,p)||s(t,p,u(e,p))}}},8544:function(t,e,r){var n=r(7293);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},8880:function(t,e,r){var n=r(9781),o=r(3070),i=r(9114);t.exports=n?function(t,e,r){return o.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},7045:function(t,e,r){var n=r(6339),o=r(3070);t.exports=function(t,e,r){return r.get&&n(r.get,e,{getter:!0}),r.set&&n(r.set,e,{setter:!0}),o.f(t,e,r)}},8052:function(t,e,r){var n=r(614),o=r(3070),i=r(6339),c=r(3072);t.exports=function(t,e,r,a){a||(a={});var s=a.enumerable,u=void 0!==a.name?a.name:e;if(n(r)&&i(r,u,a),a.global)s?t[e]=r:c(e,r);else{try{a.unsafe?t[e]&&(s=!0):delete t[e]}catch(f){}s?t[e]=r:o.f(t,e,{value:r,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},3072:function(t,e,r){var n=r(7854),o=Object.defineProperty;t.exports=function(t,e){try{o(n,t,{value:e,configurable:!0,writable:!0})}catch(r){n[t]=e}return e}},9781:function(t,e,r){var n=r(7293);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:function(t){var e="object"==typeof document&&document.all,r="undefined"==typeof e&&void 0!==e;t.exports={all:e,IS_HTMLDDA:r}},317:function(t,e,r){var n=r(7854),o=r(111),i=n.document,c=o(i)&&o(i.createElement);t.exports=function(t){return c?i.createElement(t):{}}},7207:function(t){var e=TypeError,r=9007199254740991;t.exports=function(t){if(t>r)throw e("Maximum allowed index exceeded");return t}},3678:function(t){t.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,r){var n,o,i=r(7854),c=r(8113),a=i.process,s=i.Deno,u=a&&a.versions||s&&s.version,f=u&&u.v8;f&&(n=f.split("."),o=n[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&c&&(n=c.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=c.match(/Chrome\/(\d+)/),n&&(o=+n[1]))),t.exports=o},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1060:function(t,e,r){var n=r(1702),o=Error,i=n("".replace),c=function(t){return String(o(t).stack)}("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,s=a.test(c);t.exports=function(t,e){if(s&&"string"==typeof t&&!o.prepareStackTrace)while(e--)t=i(t,a,"");return t}},2109:function(t,e,r){var n=r(7854),o=r(1236).f,i=r(8880),c=r(8052),a=r(3072),s=r(9920),u=r(4705);t.exports=function(t,e){var r,f,p,l,d,y,v=t.target,g=t.global,m=t.stat;if(f=g?n:m?n[v]||a(v,{}):(n[v]||{}).prototype,f)for(p in e){if(d=e[p],t.dontCallGetSet?(y=o(f,p),l=y&&y.value):l=f[p],r=u(g?p:v+(m?".":"#")+p,t.forced),!r&&void 0!==l){if(typeof d==typeof l)continue;s(d,l)}(t.sham||l&&l.sham)&&i(d,"sham",!0),c(f,p,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,r){var n=r(7293);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,r){var n=r(4374),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},6530:function(t,e,r){var n=r(9781),o=r(2597),i=Function.prototype,c=n&&Object.getOwnPropertyDescriptor,a=o(i,"name"),s=a&&"something"===function(){}.name,u=a&&(!n||n&&c(i,"name").configurable);t.exports={EXISTS:a,PROPER:s,CONFIGURABLE:u}},5668:function(t,e,r){var n=r(1702),o=r(9662);t.exports=function(t,e,r){try{return n(o(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(i){}}},1702:function(t,e,r){var n=r(4374),o=Function.prototype,i=o.call,c=n&&o.bind.bind(i,i);t.exports=n?c:function(t){return function(){return i.apply(t,arguments)}}},5005:function(t,e,r){var n=r(7854),o=r(614),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(n[t]):n[t]&&n[t][e]}},8173:function(t,e,r){var n=r(9662),o=r(8554);t.exports=function(t,e){var r=t[e];return o(r)?void 0:n(r)}},7854:function(t,e,r){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},2597:function(t,e,r){var n=r(1702),o=r(7908),i=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,r){var n=r(9781),o=r(7293),i=r(317);t.exports=!n&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,r){var n=r(1702),o=r(7293),i=r(4326),c=Object,a=n("".split);t.exports=o((function(){return!c("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?a(t,""):c(t)}:c},9587:function(t,e,r){var n=r(614),o=r(111),i=r(7674);t.exports=function(t,e,r){var c,a;return i&&n(c=e.constructor)&&c!==r&&o(a=c.prototype)&&a!==r.prototype&&i(t,a),t}},2788:function(t,e,r){var n=r(1702),o=r(614),i=r(5465),c=n(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return c(t)}),t.exports=i.inspectSource},9909:function(t,e,r){var n,o,i,c=r(4811),a=r(7854),s=r(111),u=r(8880),f=r(2597),p=r(5465),l=r(6200),d=r(3501),y="Object already initialized",v=a.TypeError,g=a.WeakMap,m=function(t){return i(t)?o(t):n(t,{})},h=function(t){return function(e){var r;if(!s(e)||(r=o(e)).type!==t)throw v("Incompatible receiver, "+t+" required");return r}};if(c||p.state){var b=p.state||(p.state=new g);b.get=b.get,b.has=b.has,b.set=b.set,n=function(t,e){if(b.has(t))throw v(y);return e.facade=t,b.set(t,e),e},o=function(t){return b.get(t)||{}},i=function(t){return b.has(t)}}else{var w=l("state");d[w]=!0,n=function(t,e){if(f(t,w))throw v(y);return e.facade=t,u(t,w,e),e},o=function(t){return f(t,w)?t[w]:{}},i=function(t){return f(t,w)}}t.exports={set:n,get:o,has:i,enforce:m,getterFor:h}},3157:function(t,e,r){var n=r(4326);t.exports=Array.isArray||function(t){return"Array"==n(t)}},4067:function(t,e,r){var n=r(648);t.exports=function(t){var e=n(t);return"BigInt64Array"==e||"BigUint64Array"==e}},614:function(t,e,r){var n=r(4154),o=n.all;t.exports=n.IS_HTMLDDA?function(t){return"function"==typeof t||t===o}:function(t){return"function"==typeof t}},4705:function(t,e,r){var n=r(7293),o=r(614),i=/#|\.prototype\./,c=function(t,e){var r=s[a(t)];return r==f||r!=u&&(o(e)?n(e):!!e)},a=c.normalize=function(t){return String(t).replace(i,".").toLowerCase()},s=c.data={},u=c.NATIVE="N",f=c.POLYFILL="P";t.exports=c},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,r){var n=r(614),o=r(4154),i=o.all;t.exports=o.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:n(t)||t===i}:function(t){return"object"==typeof t?null!==t:n(t)}},1913:function(t){t.exports=!1},2190:function(t,e,r){var n=r(5005),o=r(614),i=r(7976),c=r(3307),a=Object;t.exports=c?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return o(e)&&i(e.prototype,a(t))}},6244:function(t,e,r){var n=r(7466);t.exports=function(t){return n(t.length)}},6339:function(t,e,r){var n=r(1702),o=r(7293),i=r(614),c=r(2597),a=r(9781),s=r(6530).CONFIGURABLE,u=r(2788),f=r(9909),p=f.enforce,l=f.get,d=String,y=Object.defineProperty,v=n("".slice),g=n("".replace),m=n([].join),h=a&&!o((function(){return 8!==y((function(){}),"length",{value:8}).length})),b=String(String).split("String"),w=t.exports=function(t,e,r){"Symbol("===v(d(e),0,7)&&(e="["+g(d(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!c(t,"name")||s&&t.name!==e)&&(a?y(t,"name",{value:e,configurable:!0}):t.name=e),h&&r&&c(r,"arity")&&t.length!==r.arity&&y(t,"length",{value:r.arity});try{r&&c(r,"constructor")&&r.constructor?a&&y(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var n=p(t);return c(n,"source")||(n.source=m(b,"string"==typeof e?e:"")),t};Function.prototype.toString=w((function(){return i(this)&&l(this).source||u(this)}),"toString")},4758:function(t){var e=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?r:e)(n)}},6277:function(t,e,r){var n=r(1340);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:n(t)}},3070:function(t,e,r){var n=r(9781),o=r(4664),i=r(3353),c=r(9670),a=r(4948),s=TypeError,u=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",d="writable";e.f=n?i?function(t,e,r){if(c(t),e=a(e),c(r),"function"===typeof t&&"prototype"===e&&"value"in r&&d in r&&!r[d]){var n=f(t,e);n&&n[d]&&(t[e]=r.value,r={configurable:l in r?r[l]:n[l],enumerable:p in r?r[p]:n[p],writable:!1})}return u(t,e,r)}:u:function(t,e,r){if(c(t),e=a(e),c(r),o)try{return u(t,e,r)}catch(n){}if("get"in r||"set"in r)throw s("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},1236:function(t,e,r){var n=r(9781),o=r(6916),i=r(5296),c=r(9114),a=r(5656),s=r(4948),u=r(2597),f=r(4664),p=Object.getOwnPropertyDescriptor;e.f=n?p:function(t,e){if(t=a(t),e=s(e),f)try{return p(t,e)}catch(r){}if(u(t,e))return c(!o(i.f,t,e),t[e])}},8006:function(t,e,r){var n=r(6324),o=r(748),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,i)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},9518:function(t,e,r){var n=r(2597),o=r(614),i=r(7908),c=r(6200),a=r(8544),s=c("IE_PROTO"),u=Object,f=u.prototype;t.exports=a?u.getPrototypeOf:function(t){var e=i(t);if(n(e,s))return e[s];var r=e.constructor;return o(r)&&e instanceof r?r.prototype:e instanceof u?f:null}},7976:function(t,e,r){var n=r(1702);t.exports=n({}.isPrototypeOf)},6324:function(t,e,r){var n=r(1702),o=r(2597),i=r(5656),c=r(1318).indexOf,a=r(3501),s=n([].push);t.exports=function(t,e){var r,n=i(t),u=0,f=[];for(r in n)!o(a,r)&&o(n,r)&&s(f,r);while(e.length>u)o(n,r=e[u++])&&(~c(f,r)||s(f,r));return f}},5296:function(t,e){"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},7674:function(t,e,r){var n=r(5668),o=r(9670),i=r(6077);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{t=n(Object.prototype,"__proto__","set"),t(r,[]),e=r instanceof Array}catch(c){}return function(r,n){return o(r),i(n),e?t(r,n):r.__proto__=n,r}}():void 0)},2140:function(t,e,r){var n=r(6916),o=r(614),i=r(111),c=TypeError;t.exports=function(t,e){var r,a;if("string"===e&&o(r=t.toString)&&!i(a=n(r,t)))return a;if(o(r=t.valueOf)&&!i(a=n(r,t)))return a;if("string"!==e&&o(r=t.toString)&&!i(a=n(r,t)))return a;throw c("Can't convert object to primitive value")}},3887:function(t,e,r){var n=r(5005),o=r(1702),i=r(8006),c=r(5181),a=r(9670),s=o([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=i.f(a(t)),r=c.f;return r?s(e,r(t)):e}},4488:function(t,e,r){var n=r(8554),o=TypeError;t.exports=function(t){if(n(t))throw o("Can't call method on "+t);return t}},6200:function(t,e,r){var n=r(2309),o=r(9711),i=n("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,e,r){var n=r(7854),o=r(3072),i="__core-js_shared__",c=n[i]||o(i,{});t.exports=c},2309:function(t,e,r){var n=r(1913),o=r(5465);(t.exports=function(t,e){return o[t]||(o[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.29.1",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,r){var n=r(7392),o=r(7293);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},1400:function(t,e,r){var n=r(9303),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},4599:function(t,e,r){var n=r(7593),o=TypeError;t.exports=function(t){var e=n(t,"number");if("number"==typeof e)throw o("Can't convert number to bigint");return BigInt(e)}},5656:function(t,e,r){var n=r(8361),o=r(4488);t.exports=function(t){return n(o(t))}},9303:function(t,e,r){var n=r(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:n(e)}},7466:function(t,e,r){var n=r(9303),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},7908:function(t,e,r){var n=r(4488),o=Object;t.exports=function(t){return o(n(t))}},7593:function(t,e,r){var n=r(6916),o=r(111),i=r(2190),c=r(8173),a=r(2140),s=r(5112),u=TypeError,f=s("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var r,s=c(t,f);if(s){if(void 0===e&&(e="default"),r=n(s,t,e),!o(r)||i(r))return r;throw u("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},4948:function(t,e,r){var n=r(7593),o=r(2190);t.exports=function(t){var e=n(t,"string");return o(e)?e:e+""}},1694:function(t,e,r){var n=r(5112),o=n("toStringTag"),i={};i[o]="z",t.exports="[object z]"===String(i)},1340:function(t,e,r){var n=r(648),o=String;t.exports=function(t){if("Symbol"===n(t))throw TypeError("Cannot convert a Symbol value to a string");return o(t)}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(r){return"Object"}}},9711:function(t,e,r){var n=r(1702),o=0,i=Math.random(),c=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+c(++o+i,36)}},3307:function(t,e,r){var n=r(6293);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,r){var n=r(9781),o=r(7293);t.exports=n&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,r){var n=r(7854),o=r(614),i=n.WeakMap;t.exports=o(i)&&/native code/.test(String(i))},5112:function(t,e,r){var n=r(7854),o=r(2309),i=r(2597),c=r(9711),a=r(6293),s=r(3307),u=n.Symbol,f=o("wks"),p=s?u["for"]||u:u&&u.withoutSetter||c;t.exports=function(t){return i(f,t)||(f[t]=a&&i(u,t)?u[t]:p("Symbol."+t)),f[t]}},7658:function(t,e,r){"use strict";var n=r(2109),o=r(7908),i=r(6244),c=r(3658),a=r(7207),s=r(7293),u=s((function(){return 4294967297!==[].push.call({length:4294967296},1)})),f=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},p=u||!f();n({target:"Array",proto:!0,arity:1,forced:p},{push:function(t){var e=o(this),r=i(e),n=arguments.length;a(r+n);for(var s=0;s<n;s++)e[r]=arguments[s],r++;return c(e,r),r}})},1439:function(t,e,r){"use strict";var n=r(1843),o=r(260),i=o.aTypedArray,c=o.exportTypedArrayMethod,a=o.getTypedArrayConstructor;c("toReversed",(function(){return n(i(this),a(this))}))},7585:function(t,e,r){"use strict";var n=r(260),o=r(1702),i=r(9662),c=r(7745),a=n.aTypedArray,s=n.getTypedArrayConstructor,u=n.exportTypedArrayMethod,f=o(n.TypedArrayPrototype.sort);u("toSorted",(function(t){void 0!==t&&i(t);var e=a(this),r=c(s(e),e);return f(r,t)}))},5315:function(t,e,r){"use strict";var n=r(1572),o=r(260),i=r(4067),c=r(9303),a=r(4599),s=o.aTypedArray,u=o.getTypedArrayConstructor,f=o.exportTypedArrayMethod,p=!!function(){try{new Int8Array(1)["with"](2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}();f("with",{with:function(t,e){var r=s(this),o=c(t),f=i(r)?a(e):+e;return n(r,u(r),o,f)}}["with"],!p)},3767:function(t,e,r){r(1439)},8585:function(t,e,r){r(7585)},8696:function(t,e,r){r(5315)},2801:function(t,e,r){"use strict";var n=r(2109),o=r(7854),i=r(5005),c=r(9114),a=r(3070).f,s=r(2597),u=r(5787),f=r(9587),p=r(6277),l=r(3678),d=r(1060),y=r(9781),v=r(1913),g="DOMException",m=i("Error"),h=i(g),b=function(){u(this,w);var t=arguments.length,e=p(t<1?void 0:arguments[0]),r=p(t<2?void 0:arguments[1],"Error"),n=new h(e,r),o=m(e);return o.name=g,a(n,"stack",c(1,d(o.stack,1))),f(n,this,b),n},w=b.prototype=h.prototype,x="stack"in m(g),E="stack"in new h(1,2),S=h&&y&&Object.getOwnPropertyDescriptor(o,g),T=!!S&&!(S.writable&&S.configurable),O=x&&!T&&!E;n({global:!0,constructor:!0,forced:v||O},{DOMException:O?b:h});var A=i(g),_=A.prototype;if(_.constructor!==A)for(var R in v||a(_,"constructor",c(1,A)),l)if(s(l,R)){var I=l[R],M=I.s;s(A,M)||a(A,M,c(6,I.c))}},477:function(t){"use strict";t.exports=function(t,e,r,n){var o=self||window;try{try{var i;try{i=new o.Blob([t])}catch(f){var c=o.BlobBuilder||o.WebKitBlobBuilder||o.MozBlobBuilder||o.MSBlobBuilder;i=new c,i.append(t),i=i.getBlob()}var a=o.URL||o.webkitURL,s=a.createObjectURL(i),u=new o[e](s,r);return a.revokeObjectURL(s),u}catch(f){return new o[e]("data:application/javascript,".concat(encodeURIComponent(t)),r)}}catch(f){if(!n)throw Error("Inline worker is not supported");return new o[e](n,r)}}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}!function(){r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,{a:e}),e}}(),function(){r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){r.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){r.p=""}();var n={};return function(){"use strict";if(r.r(n),r.d(n,{default:function(){return V}}),"undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(r.p=e[1])}r(7658),r(3767),r(8585),r(8696),r(2801);let o,i="ws-monitor-panel",c="ws-monitor-btn";function a(t){const e=document.getElementById(t);if(!e)return console.warn(`[cesium-ws-ui] 容器 #${t} 不存在`);const r=document.createElement("button");r.id=c,r.innerText="📊 模型加载监控",r.style="\n position: absolute;\n top: 10px;\n right: 10px;\n z-index: 10000;\n padding: 5px 10px;\n font-size: 12px;\n border: none;\n border-radius: 4px;\n background: #007aff;\n color: white;\n cursor: pointer;\n ",r.onclick=()=>{const t=document.getElementById(i);t&&(t.style.display="none"===t.style.display?"block":"none")};const n=document.createElement("div");n.id=i,n.style="\n position: absolute;\n top: 50px;\n right: 10px;\n width: 280px;\n max-height: 80%;\n overflow-y: auto;\n background: rgba(0,0,0,0.8);\n color: white;\n font-size: 12px;\n padding: 10px;\n border-radius: 8px;\n z-index: 9999;\n display: none;\n box-shadow: 0 0 8px rgba(0,0,0,0.3);\n scrollbar-width: thin;\n ";const o=document.createElement("div");o.id="ws-summary",o.innerHTML='\n <div style="font-size: 18px;"><b>总连接数:</b> <span id="ws-conn-count">-</span></div>\n <div style="font-size: 18px;"><b>当前剩余任务:</b> <span id="ws-task-count">-</span></div>\n <div style="font-size: 18px;"><b>总耗时:</b> <span id="ws-total-time">-</span> 秒</div>\n <hr>\n ',n.appendChild(o);const a=document.createElement("div");a.id="ws-monitor-content",n.appendChild(a),e.style.position="relative",e.appendChild(r),e.appendChild(n)}function s(t=1e3){function e(t,e){const r=document.getElementById(t);r&&(r.textContent=e)}o=setInterval((()=>{const t=document.getElementById("ws-monitor-content");if(!t||"none"===t.parentElement.style.display)return;const{connections:r,requestsMap:n,requestDurations:o,allCostTime:i}=window.WebSocketPoolDispatcher||{};if(!r)return;e("ws-conn-count",r.length),e("ws-task-count",n.reduce(((t,e)=>t+e.size),0)),e("ws-total-time",i[0]||"-");let c="";r.forEach(((t,e)=>{const r=["🟥关闭","🟡连接中","🟢已连接","🟣关闭中"][t.readyState]||"❓未知",i=n[e]?.size||0,a=o[e]||[],s=a.length?(a.reduce(((t,e)=>t+e),0)/a.length).toFixed(1):"-";c+=`\n <div><b>连接 ${e+1}</b> ${r}</div>\n <div> ➤ 剩余任务: ${i}</div>\n <div> ➤ 平均耗时: ${s}ms</div>\n <hr>\n `})),t.innerHTML=c}),t)}function u(t={}){let{containerId:e="cesiumcontainer",intervalMs:r=1e3}=t;const n="string"===typeof e?document.getElementById(e):document.getElementById(WebSocketPoolDispatcher.cesiumContainer);if(n){if(document.getElementById(i)||document.getElementById(c))return console.error("不可重复初始化");a(e||WebSocketPoolDispatcher.cesiumContainer),s(r)}else console.warn(`[WebSocketMonitor] 容器未找到: ${e}`)}function f(){const t=document.getElementById(i);t&&t.remove();const e=document.getElementById(c);e&&e.remove(),o&&clearInterval(o)}var p=r(9931),l=r.n(p);const d="opfs-cache-panel",y="opfs-toggle-button",v=new(l());let g=[],m={usage:0,quota:0,free:0},h=!1;function b(t){if(0===t)return"0 B";const e=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,n)).toFixed(2))+" "+r[n]}function w(t){let e=document.getElementById(d);e||(e=document.createElement("div"),e.id=d,e.style.cssText="\n position: absolute;\n top: 80px;\n right: 10px;\n width: 320px;\n max-height: 60%;\n overflow-y: auto;\n background: rgba(0,0,0,0.85);\n color: #fff;\n padding: 10px;\n font-size: 13px;\n border-radius: 8px;\n z-index: 9999;\n display: none;\n ",t.appendChild(e));const r=g.reduce(((t,e)=>t+e.size),0),n=b(r),o=[`\n <div style="display: flex; justify-content: space-between; align-items: center;">\n <strong>OPFS 缓存管理</strong>\n <div>\n <button id="opfs-refresh" style="margin-right: 5px;">刷新</button>\n <button id="opfs-clear">清空</button>\n </div>\n </div>\n <div style="margin-top: 6px; font-size: 12px; color: #ccc;">\n 缓存总大小:${n}\n </div>\n <div style="margin-top: 4px; font-size: 12px; color: #ccc;">\n 已用空间:${b(m.usage)} / 可用空间:${b(m.quota)}\n </div>\n <div style="margin-top: 2px; font-size: 12px; color: #888;">\n 剩余空间:${b(m.free)}\n </div>\n <ul style="margin-top: 10px; list-style: none; padding-left: 0;">\n ${g?.length?g.map((t=>`\n <li style="margin-bottom: 6px;">\n ${t.name} (${b(t.size)})\n <button data-del="${t.name}" style="float: right;">删除</button>\n </li>\n `)).join(""):'<li style="color:#888;">暂无缓存文件</li>'}\n </ul>\n `];e.innerHTML=o.join(""),e.querySelectorAll("button[data-del]").forEach((t=>{t.onclick=()=>{const e=t.dataset.del;v.postMessage({type:"delete",key:e})}})),e.querySelector("#opfs-refresh").onclick=()=>{v.postMessage({type:"list"}),v.postMessage({type:"quota"})},e.querySelector("#opfs-clear").onclick=()=>{v.postMessage({type:"clear"})}}function x(t){const e=document.getElementById(d);e&&(h=!h,e.style.display=h?"block":"none")}function E(t){let e=document.getElementById(y);e||(e=document.createElement("button"),e.id=y,e.textContent="📦 缓存管理",e.style.cssText="\n position: absolute;\n top: 40px;\n right: 10px;\n z-index: 9999;\n background: #007aff;\n color: #fff;\n border: none;\n border-radius: 5px;\n padding: 5px 10px;\n cursor: pointer;\n ",t.appendChild(e)),e.onclick=()=>x(t)}function S(t){const e="string"===typeof t?document.getElementById(t):document.getElementById(WebSocketPoolDispatcher.cesiumContainer);if(e){if(document.getElementById(d)||document.getElementById(y))return console.error("不可重复初始化");E(e),w(e),v.onmessage=t=>{const{type:r,key:n,list:o,success:i,usage:c,quota:a,free:s}=t.data;switch(r){case"list":g=o,w(e);break;case"quota":m={usage:c,quota:a,free:s},w(e);break;case"delete":case"clear":v.postMessage({type:"list"}),v.postMessage({type:"quota"});break;case"error":console.warn(`[OPFSWorker] 错误: ${n} -> ${t.data.error}`);break;default:i&&console.log(`[OPFSWorker] ${r} ${n} 操作成功`)}},v.postMessage({type:"list"}),v.postMessage({type:"quota"})}else console.warn(`[OpfsManager] 容器未找到: ${t}`)}function T(){const t=document.getElementById(d);t&&t.remove();const e=document.getElementById(y);e&&e.remove(),v.terminate()}var O=r(564),A=r.n(O),_=r(6221),R=r.n(_);const I=3e5,M=5,k=80,j=3e3,P=5,C=new(A()),D=new Map;C.onmessage=function(t){const{id:e,buffer:r}=t.data,n=D.get(e);n&&(D.delete(e),n(r))},C.onerror=t=>{console.error("inflateWorker 加载失败:",t)};const B=new(R()),F=new Map;function N(t){return new Promise(((e,r)=>{F.set(t,{resolve:e,reject:r}),B.postMessage({type:"read",key:t})}))}function W(t,e){return new Promise(((r,n)=>{F.set(t,{resolve:r,reject:n}),B.postMessage({type:"write",key:t,buffer:e},[e])}))}function U(t){const e=new WebSocket(t);return e.binaryType="arraybuffer",e}B.onmessage=function(t){const{status:e,key:r,buffer:n,error:o}=t.data,i=F.get(r);i&&(F.delete(r),"read"===e?i.resolve(n):"written"===e?i.resolve(!0):"error"===e&&i.reject(new Error(o)))},B.onerror=t=>{console.error("cacheWorker 加载失败:",t)};let z=null,L=0;const $=(()=>{const t=[],e=[],r=[],n=[],o=[],i=[],c=[];let a=[],s=1;function p(a,s){const u=U(s);t[a]=u,e[a]=e[a]||new Map,r[a]=r[a]||[],c[a]=c[a]||0,o[a]=new Promise((t=>{n[a]=t})),u.onopen=()=>{c[a]=0,n[a]()},u.onerror=()=>{const t=e[a];for(const{reject:e,timer:r}of t.values())clearTimeout(r),e(new Error("[cesium-ws-patch] 连接错误"));t.clear()},u.onclose=()=>{c[a]<P?i[a]=setTimeout((()=>{c[a]++,console.warn(`[cesium-ws-patch] 连接 ${a} 关闭,尝试重连(第 ${c[a]} 次)`),p(a,s)}),j):console.warn(`[cesium-ws-patch] 连接 ${a} 达到最大重连次数,放弃重连`)},u.onmessage=t=>{const n=performance.now(),o=e[a];try{if(t.data instanceof ArrayBuffer){const e=new DataView(t.data),i=e.getUint32(0,!0),c=t.data.slice(4),s=o.get(i);if(!s)return;clearTimeout(s.timer),o.delete(i),D.set(i,(t=>{if(s.resolve(t),l(),s.__startTime){const t=n-s.__startTime;r[a].push(t),r[a].length>k&&r[a].shift()}})),C.postMessage({id:i,payload:c},[c])}else if("string"===typeof t.data){const e=JSON.parse(t.data),{id:i,error:c,payload:s}=e,u=o.get(i);if(!u)return;if(clearTimeout(u.timer),o.delete(i),c)u.reject(new Error(c));else{const t=Uint8Array.from(atob(s),(t=>t.charCodeAt(0))).buffer;u.resolve(t)}if(u.__startTime){const t=n-u.__startTime;r[a].push(t),r[a].length>k&&r[a].shift()}l()}}catch(i){console.error("[cesium-ws-patch] 解析响应失败:",i)}}}function l(){if(L--,0===L){const t=(performance.now()-z).toFixed(2);a[0]=(t/1e3).toFixed(2),console.log(`[cesium-ws-patch] 加载完成,总耗时:${a[0]} 秒`);let e=`耗时:${a[0]} 秒`;$.calllFn&&"function"===typeof $.calllFn&&$.calllFn(e),z=null}}async function d(t,e){for(let r=0;r<e;r++)p(r,t)}function y(n){const o=t[n];if(!o||o.readyState!==WebSocket.OPEN)return 1/0;const i=e[n].size,c=r[n],a=0===c.length?1:c.reduce(((t,e)=>t+e),0)/c.length;return i*a}function v(){let t=0,r=y(0);for(let n=1;n<e.length;n++){const e=y(n);e<r&&(r=e,t=n)}return t}async function g(r,n,i,c=0){null===z&&(z=performance.now()),L++;const a=r;try{const t=await N(a);if(t&&t.byteLength>0)return l(),t}catch(h){}0===t.length&&await d(n,i),await Promise.all(o);const u=v(),f=t[u],p=e[u];if(!f||f.readyState!==WebSocket.OPEN)return Promise.reject(new Error("[cesium-ws-patch] WebSocket未连接"));const y=s++,m=performance.now();return new Promise(((t,e)=>{const o=setTimeout((()=>{p.delete(y),c<M?(console.warn(`[cesium-ws-patch] 请求超时,重试第 ${c+1} 次:${r}`),g(r,n,i,c+1).then(t).catch(e)):e(new Error("[cesium-ws-patch] 请求超时,已达最大重试次数"))}),I);p.set(y,{url:r,resolve:async e=>{try{W(a,e.slice(0))}catch(h){console.warn(`[cache] 写入失败: ${a}`,h)}t(e)},reject:e,timer:o,__startTime:m});const s=JSON.stringify({id:y,filepath:r});f.send(s)}))}return{connections:t,requestsMap:e,requestDurations:r,connectionReadyPromises:o,allCostTime:a,initConnections:d,request:g,initWebSocketMonitor:u,initOPFSCacheManager:S,destroyWebSocketMonitor:f,destroyOPFSCacheManager:T}})();async function q({cesiumContainer:t,serverUrl:e,Cesium:r,filetypes:n=[".b3dm",".glb","tileset.json"],maxConnections:o=20,calllFn:i,useWsMonitor:c=!0,useOpfsManager:a=!0}){if(!r||!r.Resource||!r.Resource.prototype)return void console.warn("[cesium-ws-patch] Cesium.Resource 未找到,补丁未应用");0===$.connections.length&&await $.initConnections(e,o),await Promise.all($.connectionReadyPromises),$.STATUS_CODE=1,$.cesiumContainer=t,c&&u({cesiumContainer:t}),a&&S(t),$.calllFn=i;const s=r.Resource.prototype.fetchArrayBuffer;r.Resource.prototype.fetchArrayBuffer=function(){const t=this.url,r=n.some((e=>t.endsWith(e)||t.includes(e)));return r?$.request(t,e,o):s.call(this)},console.log("[cesium-ws-patch] WebSocket_multi_connection_patch 已加载")}window.WebSocketPoolDispatcher=$;var H=q,V=H}(),n}()}));