@guihz/trading-vue-editor-tes 0.0.215 → 0.0.216
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/assets/scriptsRunWorker-B3l8bZZ1.js +69 -0
- package/lib/components/editor/parseScript/buildInVarNamespace/strategy.d.ts +2 -2
- package/lib/components/editor/parseScript/utils.d.ts +1 -0
- package/lib/trading-vue-editor.js +1 -1
- package/lib/trading-vue-editor.umd.cjs +1 -1
- package/package.json +1 -1
- package/lib/assets/scriptsRunWorker-DbuGL1sD.js +0 -69
@@ -16,12 +16,12 @@ export declare class Strategy {
|
|
16
16
|
private _netprofit;
|
17
17
|
private _eventrades;
|
18
18
|
private _avg_trade_percent?;
|
19
|
+
private _avg_losing_trade_percent?;
|
20
|
+
private _avg_winning_trade_percent?;
|
19
21
|
private _closedtrades;
|
20
22
|
private _losstrades;
|
21
23
|
private _grossloss;
|
22
|
-
private _grossloss_percent;
|
23
24
|
private _grossprofit;
|
24
|
-
private _grossprofit_percent;
|
25
25
|
private _wintrades;
|
26
26
|
private _opentrades_capital_held;
|
27
27
|
private _position_avg_price?;
|
@@ -13,3 +13,4 @@ export declare function decode(base64: string): string;
|
|
13
13
|
export declare function decimalTrunc(num: number, len: number): number;
|
14
14
|
export declare function decimalCeil(num?: number, precision?: number): number | undefined;
|
15
15
|
export declare function decimalFloor(num?: number, precision?: number): number | undefined;
|
16
|
+
export declare function transformPeriod(period: string): string;
|
@@ -67607,7 +67607,7 @@ function nr(a, n, r) {
|
|
67607
67607
|
function ih() {
|
67608
67608
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
67609
67609
|
}
|
67610
|
-
const Pp = new Worker(new URL("" + new URL("assets/scriptsRunWorker-
|
67610
|
+
const Pp = new Worker(new URL("" + new URL("assets/scriptsRunWorker-B3l8bZZ1.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
|
67611
67611
|
Pp.onerror = (a) => {
|
67612
67612
|
console.error(a);
|
67613
67613
|
};
|
@@ -141,7 +141,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
141
141
|
* @license
|
142
142
|
* Copyright 2019 Google LLC
|
143
143
|
* SPDX-License-Identifier: Apache-2.0
|
144
|
-
*/const yo=Symbol("Comlink.proxy"),tm=Symbol("Comlink.endpoint"),rm=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),_o=a=>typeof a=="object"&&a!==null||typeof a=="function",sm={canHandle:a=>_o(a)&&a[yo],serialize(a){const{port1:n,port2:s}=new MessageChannel;return go(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},am={canHandle:a=>_o(a)&&Ys in a,serialize({value:a}){let n;return a instanceof Error?n={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:n={isError:!1,value:a},[n,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},fo=new Map([["proxy",sm],["throw",am]]);function nm(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function go(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!nm(s,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:y}=Object.assign({path:[]},c.data),f=(c.data.argumentList||[]).map(br);let b;try{const h=y.slice(0,-1).reduce((N,F)=>N[F],a),T=y.reduce((N,F)=>N[F],a);switch(m){case"GET":b=T;break;case"SET":h[y.slice(-1)[0]]=br(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,f);break;case"CONSTRUCT":{const N=new T(...f);b=gn(N)}break;case"ENDPOINT":{const{port1:N,port2:F}=new MessageChannel;go(a,F),b=pm(N,[N])}break;case"RELEASE":b=void 0;break;default:return}}catch(h){b={value:h,[Ys]:0}}Promise.resolve(b).catch(h=>({value:h,[Ys]:0})).then(h=>{const[T,N]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),N),m==="RELEASE"&&(n.removeEventListener("message",o),bo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,N]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),N)})}),n.start&&n.start()}function im(a){return a.constructor.name==="MessagePort"}function bo(a){im(a)&&a.close()}function _n(a,n){return fn(a,[],n)}function Qs(a){if(a)throw new Error("Proxy has been released and is not useable")}function xo(a){return Lr(a,{type:"RELEASE"}).then(()=>{bo(a)})}const Zs=new WeakMap,Js="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const n=(Zs.get(a)||0)-1;Zs.set(a,n),n===0&&xo(a)});function om(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function lm(a){Js&&Js.unregister(a)}function fn(a,n=[],s=function(){}){let o=!1;const c=new Proxy(s,{get(l,m){if(Qs(o),m===rm)return()=>{lm(c),xo(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const y=Lr(a,{type:"GET",path:n.map(f=>f.toString())}).then(br);return y.then.bind(y)}return fn(a,[...n,m])},set(l,m,y){Qs(o);const[f,b]=ea(y);return Lr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:f},b).then(br)},apply(l,m,y){Qs(o);const f=n[n.length-1];if(f===tm)return Lr(a,{type:"ENDPOINT"}).then(br);if(f==="bind")return fn(a,n.slice(0,-1));const[b,h]=ho(y);return Lr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(br)},construct(l,m){Qs(o);const[y,f]=ho(m);return Lr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:y},f).then(br)}});return om(c,a),c}function cm(a){return Array.prototype.concat.apply([],a)}function ho(a){const n=a.map(ea);return[n.map(s=>s[0]),cm(n.map(s=>s[1]))]}const wo=new WeakMap;function pm(a,n){return wo.set(a,n),a}function gn(a){return Object.assign(a,{[yo]:!0})}function ea(a){for(const[n,s]of fo)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},wo.get(a)||[]]}function br(a){switch(a.type){case"HANDLER":return fo.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Lr(a,n,s){return new Promise(o=>{const c=dm();a.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(a.removeEventListener("message",l),o(m.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:c},n),s)})}function dm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const vo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-
|
144
|
+
*/const yo=Symbol("Comlink.proxy"),tm=Symbol("Comlink.endpoint"),rm=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),_o=a=>typeof a=="object"&&a!==null||typeof a=="function",sm={canHandle:a=>_o(a)&&a[yo],serialize(a){const{port1:n,port2:s}=new MessageChannel;return go(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},am={canHandle:a=>_o(a)&&Ys in a,serialize({value:a}){let n;return a instanceof Error?n={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:n={isError:!1,value:a},[n,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},fo=new Map([["proxy",sm],["throw",am]]);function nm(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function go(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!nm(s,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:y}=Object.assign({path:[]},c.data),f=(c.data.argumentList||[]).map(br);let b;try{const h=y.slice(0,-1).reduce((N,F)=>N[F],a),T=y.reduce((N,F)=>N[F],a);switch(m){case"GET":b=T;break;case"SET":h[y.slice(-1)[0]]=br(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,f);break;case"CONSTRUCT":{const N=new T(...f);b=gn(N)}break;case"ENDPOINT":{const{port1:N,port2:F}=new MessageChannel;go(a,F),b=pm(N,[N])}break;case"RELEASE":b=void 0;break;default:return}}catch(h){b={value:h,[Ys]:0}}Promise.resolve(b).catch(h=>({value:h,[Ys]:0})).then(h=>{const[T,N]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),N),m==="RELEASE"&&(n.removeEventListener("message",o),bo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,N]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),N)})}),n.start&&n.start()}function im(a){return a.constructor.name==="MessagePort"}function bo(a){im(a)&&a.close()}function _n(a,n){return fn(a,[],n)}function Qs(a){if(a)throw new Error("Proxy has been released and is not useable")}function xo(a){return Lr(a,{type:"RELEASE"}).then(()=>{bo(a)})}const Zs=new WeakMap,Js="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const n=(Zs.get(a)||0)-1;Zs.set(a,n),n===0&&xo(a)});function om(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function lm(a){Js&&Js.unregister(a)}function fn(a,n=[],s=function(){}){let o=!1;const c=new Proxy(s,{get(l,m){if(Qs(o),m===rm)return()=>{lm(c),xo(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const y=Lr(a,{type:"GET",path:n.map(f=>f.toString())}).then(br);return y.then.bind(y)}return fn(a,[...n,m])},set(l,m,y){Qs(o);const[f,b]=ea(y);return Lr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:f},b).then(br)},apply(l,m,y){Qs(o);const f=n[n.length-1];if(f===tm)return Lr(a,{type:"ENDPOINT"}).then(br);if(f==="bind")return fn(a,n.slice(0,-1));const[b,h]=ho(y);return Lr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(br)},construct(l,m){Qs(o);const[y,f]=ho(m);return Lr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:y},f).then(br)}});return om(c,a),c}function cm(a){return Array.prototype.concat.apply([],a)}function ho(a){const n=a.map(ea);return[n.map(s=>s[0]),cm(n.map(s=>s[1]))]}const wo=new WeakMap;function pm(a,n){return wo.set(a,n),a}function gn(a){return Object.assign(a,{[yo]:!0})}function ea(a){for(const[n,s]of fo)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},wo.get(a)||[]]}function br(a){switch(a.type){case"HANDLER":return fo.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Lr(a,n,s){return new Promise(o=>{const c=dm();a.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(a.removeEventListener("message",l),o(m.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:c},n),s)})}function dm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const vo=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-B3l8bZZ1.js").href:new URL("assets/scriptsRunWorker-B3l8bZZ1.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});vo.onerror=a=>{console.error(a)};async function To(a){return await Gs.setInlayHints(a)}const Do=_n(vo),ko=_n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-CCpcd6u0.js").href:new URL("assets/parserTccWorker-CCpcd6u0.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function Io(a,n=!1){const{functions:s,types:o,constants:c,variables:l,methods:m}=ct;return await ko.parseTcc(a,n,gn(To),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function mm(a,n){const{functions:s,types:o,constants:c,variables:l,methods:m}=ct;return await ko.parseLibraryCode(a,n,gn(To),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function um(a,n,s=!0){return await Do.runScript(a,n,s)}async function ym(a){return await Do.removeScript(a)}function _m(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:a==null?void 0:a.name})}self.MonacoEnvironment={getWorker(){return new _m({name:"Editor Worker"})}},sn.config({paths:{vs:"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const fm=(a,n)=>{const{height:s,width:o,theme:c,options:l,hasDiff:m,readOnly:y,defaultValue:f,onChange:b,onLinkOpen:h,onCursorPositionChange:T,onActionTrigger:N,onEditorDidMount:F}=a,S=O.useRef(null),R=O.useRef(null),W=O.useRef(!1),V=O.useRef(!1);O.useImperativeHandle(n,()=>({setOriginalScript(E){var H;(H=S.current)==null||H.setOriginalScript(E)},setScript(E){var H;(H=S.current)==null||H.setValue(E)},gotoLine(){var E;(E=S.current)==null||E.gotoLine()},getEditorLayout(){var E;return(E=S.current)==null?void 0:E.getEditorLayout()},setPosition(E,H){var Q;(Q=S.current)==null||Q.setPosition({column:E,lineNumber:H})},setModelMarkers(E){var H;V.current=!0,(H=S.current)==null||H.setModelMarkers(E),setTimeout(()=>{V.current=!1},2e3)},focus(){var E;(E=S.current)==null||E.focus()}})),O.useEffect(()=>{var E,H;m?(H=S.current)==null||H.addDiffDecorations():(E=S.current)==null||E.removeDiffDecorations()},[m]),O.useEffect(()=>{c&&ke.editor.setTheme(c)},[c]),O.useEffect(()=>{var E;(E=S.current)==null||E.updateActionTrigger(N)},[N]),O.useEffect(()=>{var E;h&&((E=S.current)==null||E.addLinkOpenFunc(h))},[h]);function Y(E,H){var ie,Qe;zt.initBuiltinsTrees(),Gs.setEditor(E),S.current=new em(E,H,N),h&&((ie=S.current)==null||ie.addLinkOpenFunc(h)),m&&((Qe=S.current)==null||Qe.addDiffDecorations()),kd(E),requestAnimationFrame(B);const Q=E.getValue();S.current.onChangeCursorPosition(T),b&&b(Q),!y&&U(Q),F&&F()}const U=O.useCallback(async E=>{var $e;const H=Date.now();W.current=!1;const{errors:Q,functions:ie,methods:Qe,types:St,variables:Ue,overloadsFuncs:Ke,imports:J,enums:be}=await Io(E),Ee=new Map(Object.entries(ie)),Me=new Map(Object.entries(Qe)),pt=new Map(Object.entries(St)),ht=new Map(Object.entries(Ue)),se=new Map(Object.entries(J)),xe=new Map(Object.entries(be));gr.setUserDefined({functions:Ee,methods:Me,types:pt,variables:ht,imports:se,enums:xe},Ke),zt.setUserDefind(Ee,pt,ht,Me,xe);const Pe=Q.map(Nt=>({...Nt,severity:Nt.type||ke.MarkerSeverity.Error}));if(y)return;!W.current&&!V.current&&Pe.length&&(($e=S.current)==null||$e.setModelMarkers(Pe));const Et=Date.now();console.log((Et-H)/1e3)},[y]),K=O.useMemo(()=>qd.debounce(U,1500),[U]);function A(E){var H;if(y){U(E||"");return}W.current=!0,Gs.clearInlayHints(),(H=S.current)==null||H.setModelMarkers([]),E!==void 0&&(b&&b(E),K(E))}const B=O.useCallback(()=>{var H,Q;const E=(H=R.current)==null?void 0:H.getBoundingClientRect();(Q=S.current)==null||Q.setEditorLayout((E==null?void 0:E.height)||0,E==null?void 0:E.width)},[]);return O.useEffect(()=>{const E=()=>{window.requestAnimationFrame(B)},H=new ResizeObserver(E);return R.current&&H.observe(R.current),()=>{var Q;R.current&&H.unobserve(R.current),H.disconnect(),(Q=S.current)==null||Q.dispose()}},[]),M.jsx("div",{ref:R,children:M.jsx(yd,{height:s,width:o||"100%",defaultLanguage:Se,defaultValue:f||`indicator("我的脚本")
|
145
145
|
plot(close)
|
146
146
|
`,theme:c||"vs-dark",className:`tvue-script ${c||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,automaticLayout:!1,unicodeHighlight:{allowedCharacters:{" ":!0}},suggest:{filterGraceful:!0},fontSize:13,...y?Ld:{},readOnlyMessage:{value:"该脚本是只读的。它无法被编辑。"},...l},onMount:Y,onChange:A})})},gm=O.forwardRef(fm),bm=a=>{const{theme:n,modified:s,original:o,height:c,width:l,renderSideBySide:m=!0}=a,y=O.useCallback((f,b)=>{b.languages.register({id:Se}),b.editor.defineTheme("vs-dark",cn),b.editor.defineTheme("vs",ln),b.languages.setMonarchTokensProvider(Se,Nr),b.languages.setLanguageConfiguration(Se,on)},[]);return M.jsx(cd,{height:c||"90vh",width:l||"100%",theme:n||"vs-dark",options:{readOnly:!0,renderSideBySide:m,scrollBeyondLastLine:!1},language:Se,modified:s,original:o,onMount:y})};I.VMarkerSeverity=void 0,function(a){a[a.Hint=1]="Hint",a[a.Info=2]="Info",a[a.Warning=4]="Warning",a[a.Error=8]="Error"}(I.VMarkerSeverity||(I.VMarkerSeverity={}));var ta={},xm=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var n=document.activeElement,s=[],o=0;o<a.rangeCount;o++)s.push(a.getRangeAt(o));switch(n.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":n.blur();break;default:n=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||s.forEach(function(c){a.addRange(c)}),n&&n.focus()}},hm=xm,Ao={"text/plain":"Text","text/html":"Url",default:"Text"},wm="Copy to clipboard: #{key}, Enter";function vm(a){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,n)}function Tm(a,n){var s,o,c,l,m,y,f=!1;n||(n={}),s=n.debug||!1;try{c=hm(),l=document.createRange(),m=document.getSelection(),y=document.createElement("span"),y.textContent=a,y.ariaHidden="true",y.style.all="unset",y.style.position="fixed",y.style.top=0,y.style.clip="rect(0, 0, 0, 0)",y.style.whiteSpace="pre",y.style.webkitUserSelect="text",y.style.MozUserSelect="text",y.style.msUserSelect="text",y.style.userSelect="text",y.addEventListener("copy",function(h){if(h.stopPropagation(),n.format)if(h.preventDefault(),typeof h.clipboardData>"u"){s&&console.warn("unable to use e.clipboardData"),s&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=Ao[n.format]||Ao.default;window.clipboardData.setData(T,a)}else h.clipboardData.clearData(),h.clipboardData.setData(n.format,a);n.onCopy&&(h.preventDefault(),n.onCopy(h.clipboardData))}),document.body.appendChild(y),l.selectNodeContents(y),m.addRange(l);var b=document.execCommand("copy");if(!b)throw new Error("copy command was unsuccessful");f=!0}catch(h){s&&console.error("unable to copy using execCommand: ",h),s&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(n.format||"text",a),n.onCopy&&n.onCopy(window.clipboardData),f=!0}catch(T){s&&console.error("unable to copy using clipboardData: ",T),s&&console.error("falling back to prompt"),o=vm("message"in n?n.message:wm),window.prompt(o,a)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(l):m.removeAllRanges()),y&&document.body.removeChild(y),c()}return f}var Dm=Tm;function bn(a){"@babel/helpers - typeof";return bn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},bn(a)}Object.defineProperty(ta,"__esModule",{value:!0}),ta.CopyToClipboard=void 0;var ra=qo(O),km=qo(Dm),Im=["text","onCopy","options","children"];function qo(a){return a&&a.__esModule?a:{default:a}}function Co(a,n){var s=Object.keys(a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);n&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})),s.push.apply(s,o)}return s}function zo(a){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?Co(Object(s),!0).forEach(function(o){hn(a,o,s[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):Co(Object(s)).forEach(function(o){Object.defineProperty(a,o,Object.getOwnPropertyDescriptor(s,o))})}return a}function Am(a,n){if(a==null)return{};var s=qm(a,n),o,c;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(c=0;c<l.length;c++)o=l[c],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(a,o)&&(s[o]=a[o])}return s}function qm(a,n){if(a==null)return{};var s={},o=Object.keys(a),c,l;for(l=0;l<o.length;l++)c=o[l],!(n.indexOf(c)>=0)&&(s[c]=a[c]);return s}function Cm(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function So(a,n){for(var s=0;s<n.length;s++){var o=n[s];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(a,o.key,o)}}function zm(a,n,s){return n&&So(a.prototype,n),s&&So(a,s),Object.defineProperty(a,"prototype",{writable:!1}),a}function Sm(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),n&&xn(a,n)}function xn(a,n){return xn=Object.setPrototypeOf||function(o,c){return o.__proto__=c,o},xn(a,n)}function Em(a){var n=Lm();return function(){var o=sa(a),c;if(n){var l=sa(this).constructor;c=Reflect.construct(o,arguments,l)}else c=o.apply(this,arguments);return Nm(this,c)}}function Nm(a,n){if(n&&(bn(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Eo(a)}function Eo(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Lm(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function sa(a){return sa=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},sa(a)}function hn(a,n,s){return n in a?Object.defineProperty(a,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[n]=s,a}var No=function(a){Sm(s,a);var n=Em(s);function s(){var o;Cm(this,s);for(var c=arguments.length,l=new Array(c),m=0;m<c;m++)l[m]=arguments[m];return o=n.call.apply(n,[this].concat(l)),hn(Eo(o),"onClick",function(y){var f=o.props,b=f.text,h=f.onCopy,T=f.children,N=f.options,F=ra.default.Children.only(T),S=(0,km.default)(b,N);h&&h(b,S),F&&F.props&&typeof F.props.onClick=="function"&&F.props.onClick(y)}),o}return zm(s,[{key:"render",value:function(){var c=this.props;c.text,c.onCopy,c.options;var l=c.children,m=Am(c,Im),y=ra.default.Children.only(l);return ra.default.cloneElement(y,zo(zo({},m),{},{onClick:this.onClick}))}}]),s}(ra.default.PureComponent);ta.CopyToClipboard=No,hn(No,"defaultProps",{onCopy:void 0,options:void 0});var Mm=ta,wn=Mm.CopyToClipboard;wn.CopyToClipboard=wn;var Pm=wn;const vn=ip(Pm);async function Om(a,n=0){const s=a[n];if(!s)return;const{name:o,args:c,type:l,desc:m,examples:y,remarks:f,seeAlso:b,syntax:h,detailedDesc:T,fields:N,returns:F}=s,S={name:o};if(a.length>1&&(S.overloads=`${a.length} overloads`),l&&(S.type=l),c&&(S.name=`${o}()`,S.args=c.map(R=>{const{name:W,desc:V,displayType:Y}=R;return{label:`${W} (${Y})`,desc:V&&xr(V)}})),m&&(S.desc=m.map(R=>xr(R))),y&&(S.originalExample=y.join(`
|
147
147
|
`),S.examples=await ke.editor.colorize(S.originalExample,Se,{tabSize:4})),T){S.detailedDesc=[];for(const R of T){const{desc:W,examples:V}=R;let Y=W.map(A=>xr(A)),U,K;V&&(K=V.join(`
|