@guihz/trading-vue-editor-tes 0.0.168 → 0.0.170
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ export default class ParseToJs {
|
|
21
21
|
private _isInConditionalStmt;
|
22
22
|
private _preRunMembersFuncs;
|
23
23
|
private _preRunMemberFuncsCount;
|
24
|
+
private __count;
|
24
25
|
constructor(prefix: string);
|
25
26
|
preParser(values: IKeyObjectValue[]): string | undefined;
|
26
27
|
parser(values: IKeyObjectValue[]): string | undefined;
|
@@ -67600,7 +67600,7 @@ Rp.onerror = (a) => {
|
|
67600
67600
|
async function Bp(a) {
|
67601
67601
|
return await Ja.setInlayHints(a);
|
67602
67602
|
}
|
67603
|
-
const Kp = ji(Rp), Up = ji(new Worker(new URL("" + new URL("assets/parserTccWorker-
|
67603
|
+
const Kp = ji(Rp), Up = ji(new Worker(new URL("" + new URL("assets/parserTccWorker-DtwPqtEv.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
|
67604
67604
|
async function lh(a, n = !1) {
|
67605
67605
|
const { functions: r, types: o, constants: c, variables: l, methods: m } = ht;
|
67606
67606
|
return await Up.parseTcc(a, n, Hi(Bp), { functions: Object.fromEntries(r), methods: Object.fromEntries(m), types: Object.fromEntries(o), constants: Object.fromEntries(c), variables: Object.fromEntries(l) });
|
@@ -68122,16 +68122,6 @@ function Nh(a) {
|
|
68122
68122
|
r.push(F);
|
68123
68123
|
break;
|
68124
68124
|
}
|
68125
|
-
if (O) {
|
68126
|
-
let I = !1;
|
68127
|
-
for (const P of O)
|
68128
|
-
if (P.includes(a)) {
|
68129
|
-
r.push(F), I = !0;
|
68130
|
-
break;
|
68131
|
-
}
|
68132
|
-
if (I)
|
68133
|
-
break;
|
68134
|
-
}
|
68135
68125
|
if (E) {
|
68136
68126
|
let I = !1;
|
68137
68127
|
for (const P of E)
|
@@ -141,11 +141,11 @@ 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 _o=Symbol("Comlink.proxy"),sm=Symbol("Comlink.endpoint"),am=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),fo=a=>typeof a=="object"&&a!==null||typeof a=="function",nm={canHandle:a=>fo(a)&&a[_o],serialize(a){const{port1:n,port2:s}=new MessageChannel;return bo(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},im={canHandle:a=>fo(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}},go=new Map([["proxy",nm],["throw",im]]);function om(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function bo(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!om(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(xr);let b;try{const h=y.slice(0,-1).reduce((P,U)=>P[U],a),T=y.reduce((P,U)=>P[U],a);switch(m){case"GET":b=T;break;case"SET":h[y.slice(-1)[0]]=xr(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,f);break;case"CONSTRUCT":{const P=new T(...f);b=gn(P)}break;case"ENDPOINT":{const{port1:P,port2:U}=new MessageChannel;bo(a,U),b=mm(P,[P])}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,P]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),P),m==="RELEASE"&&(n.removeEventListener("message",o),xo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,P]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),P)})}),n.start&&n.start()}function lm(a){return a.constructor.name==="MessagePort"}function xo(a){lm(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 ho(a){return Mr(a,{type:"RELEASE"}).then(()=>{xo(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&&ho(a)});function cm(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function pm(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===am)return()=>{pm(c),ho(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const y=Mr(a,{type:"GET",path:n.map(f=>f.toString())}).then(xr);return y.then.bind(y)}return fn(a,[...n,m])},set(l,m,y){Qs(o);const[f,b]=ea(y);return Mr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:f},b).then(xr)},apply(l,m,y){Qs(o);const f=n[n.length-1];if(f===sm)return Mr(a,{type:"ENDPOINT"}).then(xr);if(f==="bind")return fn(a,n.slice(0,-1));const[b,h]=wo(y);return Mr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(xr)},construct(l,m){Qs(o);const[y,f]=wo(m);return Mr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:y},f).then(xr)}});return cm(c,a),c}function dm(a){return Array.prototype.concat.apply([],a)}function wo(a){const n=a.map(ea);return[n.map(s=>s[0]),dm(n.map(s=>s[1]))]}const vo=new WeakMap;function mm(a,n){return vo.set(a,n),a}function gn(a){return Object.assign(a,{[_o]:!0})}function ea(a){for(const[n,s]of go)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},vo.get(a)||[]]}function xr(a){switch(a.type){case"HANDLER":return go.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Mr(a,n,s){return new Promise(o=>{const c=um();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 um(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-LOCpyQip.js").href:new URL("assets/scriptsRunWorker-LOCpyQip.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"});To.onerror=a=>{console.error(a)};async function Do(a){return await Gs.setInlayHints(a)}const ko=_n(To),Io=_n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-
|
144
|
+
*/const _o=Symbol("Comlink.proxy"),sm=Symbol("Comlink.endpoint"),am=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),fo=a=>typeof a=="object"&&a!==null||typeof a=="function",nm={canHandle:a=>fo(a)&&a[_o],serialize(a){const{port1:n,port2:s}=new MessageChannel;return bo(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},im={canHandle:a=>fo(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}},go=new Map([["proxy",nm],["throw",im]]);function om(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function bo(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!om(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(xr);let b;try{const h=y.slice(0,-1).reduce((P,U)=>P[U],a),T=y.reduce((P,U)=>P[U],a);switch(m){case"GET":b=T;break;case"SET":h[y.slice(-1)[0]]=xr(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,f);break;case"CONSTRUCT":{const P=new T(...f);b=gn(P)}break;case"ENDPOINT":{const{port1:P,port2:U}=new MessageChannel;bo(a,U),b=mm(P,[P])}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,P]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),P),m==="RELEASE"&&(n.removeEventListener("message",o),xo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,P]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),P)})}),n.start&&n.start()}function lm(a){return a.constructor.name==="MessagePort"}function xo(a){lm(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 ho(a){return Mr(a,{type:"RELEASE"}).then(()=>{xo(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&&ho(a)});function cm(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function pm(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===am)return()=>{pm(c),ho(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const y=Mr(a,{type:"GET",path:n.map(f=>f.toString())}).then(xr);return y.then.bind(y)}return fn(a,[...n,m])},set(l,m,y){Qs(o);const[f,b]=ea(y);return Mr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:f},b).then(xr)},apply(l,m,y){Qs(o);const f=n[n.length-1];if(f===sm)return Mr(a,{type:"ENDPOINT"}).then(xr);if(f==="bind")return fn(a,n.slice(0,-1));const[b,h]=wo(y);return Mr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(xr)},construct(l,m){Qs(o);const[y,f]=wo(m);return Mr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:y},f).then(xr)}});return cm(c,a),c}function dm(a){return Array.prototype.concat.apply([],a)}function wo(a){const n=a.map(ea);return[n.map(s=>s[0]),dm(n.map(s=>s[1]))]}const vo=new WeakMap;function mm(a,n){return vo.set(a,n),a}function gn(a){return Object.assign(a,{[_o]:!0})}function ea(a){for(const[n,s]of go)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},vo.get(a)||[]]}function xr(a){switch(a.type){case"HANDLER":return go.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Mr(a,n,s){return new Promise(o=>{const c=um();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 um(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-LOCpyQip.js").href:new URL("assets/scriptsRunWorker-LOCpyQip.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"});To.onerror=a=>{console.error(a)};async function Do(a){return await Gs.setInlayHints(a)}const ko=_n(To),Io=_n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-DtwPqtEv.js").href:new URL("assets/parserTccWorker-DtwPqtEv.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 Ao(a,n=!1){const{functions:s,types:o,constants:c,variables:l,methods:m}=pt;return await Io.parseTcc(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function ym(a,n){const{functions:s,types:o,constants:c,variables:l,methods:m}=pt;return await Io.parseLibraryCode(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function qo(a,n,s=!0){return await ko.runScript(a,n,s)}async function _m(a){return await ko.removeScript(a)}function fm(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 fm({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"}}});let Co={};const gm=(a,n)=>{const{height:s,width:o,theme:c,options:l,hasDiff:m,readOnly:y,defaultValue:f,onChange:b,onLinkOpen:h,onDeclareConfigChange:T,onCursorPositionChange:P,onActionTrigger:U,onEditorDidMount:F}=a,E=R.useRef(null),j=R.useRef(null),G=R.useRef(!1);R.useImperativeHandle(n,()=>({setOriginalScript(S){var W;(W=E.current)==null||W.setOriginalScript(S)},setScript(S){var W;(W=E.current)==null||W.setValue(S)},gotoLine(){var S;(S=E.current)==null||S.gotoLine()},getEditorLayout(){var S;return(S=E.current)==null?void 0:S.getEditorLayout()},setPosition(S,W){var ae;(ae=E.current)==null||ae.setPosition({column:S,lineNumber:W})},setModelMarkers(S){var W;(W=E.current)==null||W.setModelMarkers(S)},focus(){var S;(S=E.current)==null||S.focus()}})),R.useEffect(()=>{var S,W;m?(W=E.current)==null||W.addDiffDecorations():(S=E.current)==null||S.removeDiffDecorations()},[m]),R.useEffect(()=>{c&&De.editor.setTheme(c)},[c]),R.useEffect(()=>{var S;(S=E.current)==null||S.updateActionTrigger(U)},[U]),R.useEffect(()=>{var S;h&&((S=E.current)==null||S.addLinkOpenFunc(h))},[h]);function V(S,W){var ce,Ze;St.initBuiltinsTrees(),Gs.setEditor(S),E.current=new rm(S,W,U),h&&((ce=E.current)==null||ce.addLinkOpenFunc(h)),m&&((Ze=E.current)==null||Ze.addDiffDecorations()),qd(S),requestAnimationFrame(Y);const ae=S.getValue();E.current.onChangeCursorPosition(P),b&&b(ae),!y&&B(ae),F&&F()}const B=R.useCallback(async S=>{var Lt;const W=Date.now();G.current=!1;const{errors:ae,functions:ce,methods:Ze,types:Et,variables:Ue,overloadsFuncs:Ke,imports:Z,preParserCode:be,enums:Le}=await Ao(S),Me=new Map(Object.entries(ce)),dt=new Map(Object.entries(Ze)),wt=new Map(Object.entries(Et)),re=new Map(Object.entries(Ue)),he=new Map(Object.entries(Z)),Pe=new Map(Object.entries(Le));br.setUserDefined({functions:Me,methods:dt,types:wt,variables:re,imports:he,enums:Pe},Ke),St.setUserDefind(Me,wt,re,dt,Pe);const Nt=ae.map(He=>({...He,severity:He.type||De.MarkerSeverity.Error}));if(y)return;try{if(!ae.some(He=>He.type===De.MarkerSeverity.Error)&&be){const He=await qo(be,{isPreParser:!0});io.isEqual(He,Co)||(Co=He,T&&T(He))}}catch(He){console.log(He),ae.push({message:He.message,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}!G.current&&((Lt=E.current)==null||Lt.setModelMarkers(Nt));const je=Date.now();console.log((je-W)/1e3)},[T,y]),k=R.useMemo(()=>io.debounce(B,1500),[B]);function O(S){var W;if(y){B(S||"");return}G.current=!0,Gs.clearInlayHints(),(W=E.current)==null||W.setModelMarkers([]),S!==void 0&&(b&&b(S),k(S))}const Y=R.useCallback(()=>{var W,ae;const S=(W=j.current)==null?void 0:W.getBoundingClientRect();(ae=E.current)==null||ae.setEditorLayout((S==null?void 0:S.height)||0,S==null?void 0:S.width)},[]);return R.useEffect(()=>{const S=()=>{window.requestAnimationFrame(Y)},W=new ResizeObserver(S);return j.current&&W.observe(j.current),()=>{var ae;j.current&&W.unobserve(j.current),W.disconnect(),(ae=E.current)==null||ae.dispose()}},[]),L.jsx("div",{ref:j,children:L.jsx(gd,{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,suggest:{filterGraceful:!0},fontSize:13,...y?Pd:{},readOnlyMessage:{value:"该脚本是只读的。它无法被编辑。"},...l},onMount:V,onChange:O})})},bm=R.forwardRef(gm),xm=a=>{const{theme:n,modified:s,original:o,height:c,width:l,renderSideBySide:m=!0}=a,y=R.useCallback((f,b)=>{b.languages.register({id:Se}),b.editor.defineTheme("vs-dark",cn),b.editor.defineTheme("vs",ln),b.languages.setMonarchTokensProvider(Se,Lr),b.languages.setLanguageConfiguration(Se,on)},[]);return L.jsx(md,{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})};A.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"}(A.VMarkerSeverity||(A.VMarkerSeverity={}));var ta={},hm=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()}},wm=hm,zo={"text/plain":"Text","text/html":"Url",default:"Text"},vm="Copy to clipboard: #{key}, Enter";function Tm(a){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,n)}function Dm(a,n){var s,o,c,l,m,y,f=!1;n||(n={}),s=n.debug||!1;try{c=wm(),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=zo[n.format]||zo.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=Tm("message"in n?n.message:vm),window.prompt(o,a)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(l):m.removeAllRanges()),y&&document.body.removeChild(y),c()}return f}var km=Dm;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=So(R),Im=So(km),Am=["text","onCopy","options","children"];function So(a){return a&&a.__esModule?a:{default:a}}function Eo(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 No(a){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?Eo(Object(s),!0).forEach(function(o){hn(a,o,s[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):Eo(Object(s)).forEach(function(o){Object.defineProperty(a,o,Object.getOwnPropertyDescriptor(s,o))})}return a}function qm(a,n){if(a==null)return{};var s=Cm(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 Cm(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 zm(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function Lo(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 Sm(a,n,s){return n&&Lo(a.prototype,n),s&&Lo(a,s),Object.defineProperty(a,"prototype",{writable:!1}),a}function Em(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 Nm(a){var n=Mm();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 Lm(this,c)}}function Lm(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 Mo(a)}function Mo(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Mm(){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 Po=function(a){Em(s,a);var n=Nm(s);function s(){var o;zm(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(Mo(o),"onClick",function(y){var f=o.props,b=f.text,h=f.onCopy,T=f.children,P=f.options,U=ra.default.Children.only(T),F=(0,Im.default)(b,P);h&&h(b,F),U&&U.props&&typeof U.props.onClick=="function"&&U.props.onClick(y)}),o}return Sm(s,[{key:"render",value:function(){var c=this.props;c.text,c.onCopy,c.options;var l=c.children,m=qm(c,Am),y=ra.default.Children.only(l);return ra.default.cloneElement(y,No(No({},m),{},{onClick:this.onClick}))}}]),s}(ra.default.PureComponent);ta.CopyToClipboard=Po,hn(Po,"defaultProps",{onCopy:void 0,options:void 0});var Pm=ta,wn=Pm.CopyToClipboard;wn.CopyToClipboard=wn;var Om=wn;const vn=cp(Om);async function Rm(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:P,returns:U}=s,F={name:o};if(a.length>1&&(F.overloads=`${a.length} overloads`),l&&(F.type=l),c&&(F.name=`${o}()`,F.args=c.map(E=>{const{name:j,desc:G,displayType:V}=E;return{label:`${j} (${V})`,desc:G&&hr(G)}})),m&&(F.desc=m.map(E=>hr(E))),y&&(F.originalExample=y.join(`
|
147
147
|
`),F.examples=await De.editor.colorize(F.originalExample,Se,{tabSize:4})),T){F.detailedDesc=[];for(const E of T){const{desc:j,examples:G}=E;let V=j.map(O=>hr(O)),B,k;G&&(k=G.join(`
|
148
148
|
`),B=await De.editor.colorize(k,Se,{tabSize:4})),F.detailedDesc.push({desc:V,examples:B,originalExample:k})}}return U&&(F.returns=U.map(E=>hr(E))),f&&(F.remarks=typeof f=="string"?[hr(f)]:f.map(E=>hr(E))),h&&(F.syntax=a.map(E=>{var j;return(j=E.syntax)==null?void 0:j[0]})),P&&(F.fields=P.map(E=>{const{name:j,desc:G,type:V}=E;return{label:`${j} (${V})`,desc:G&&hr(G)}})),b&&(F.seeAlso=b.map(E=>Fm(E))),F}function Fm(a){const s=/\[([^\[\]]+)\]\(([^\(\)]+)\)/g.exec(a);if(s){const[o,c,l]=s;return{name:c,link:l}}}function hr(a){const n=/\*\*([^\*]+)\*\*/g,s=/\`([^\`]+)\`/g,o=/\[([^\[\]]+)\]\(([^\(\)]+)\)/g;return a.replace(n,(c,l)=>`<strong>${l}</strong>`).replace(s,(c,l)=>`<code>${l}</code>`).replace(o,(c,l,m)=>`<a ${m.startsWith("#")?`data-name="${l}"`:'target="_blank"'} class="manual-content-text-link" href="${m}">${l}</a>`)}function Bm(a){var o;const n=[],s=[];for(const c of ds){for(let l of no[c.key].sort()){if(ao.includes(l))continue;let m=l;c.prefix==="fun"&&(m=`${l}()`),m.includes(a)&&(m.startsWith(a)?n.unshift({label:m,group:c,key:`${c.prefix}_${l}`}):n.push({label:m,group:c,key:`${c.prefix}_${l}`}))}for(const[l,m]of pt[c.key])for(const y of m){const{name:f,args:b,type:h,desc:T,examples:P,remarks:U,seeAlso:F,syntax:E,detailedDesc:j,fields:G,returns:V}=y,B={label:f,group:c,key:`${c.prefix}_${f}`};if(c.prefix==="fun"&&(B.label=`${f}()`),B.label.includes(a))break;if(b){let k=!1;for(const O of b){const{name:Y,desc:S,displayType:W}=O;if(Y.includes(a)||S!=null&&S.includes(a)||W!=null&&W.includes(a)){s.push(B),k=!0;break}}if(k)break}if(h&&h.includes(a)){s.push(B);break}if(T){let k=!1;for(const O of T)if(O.includes(a)){s.push(B),k=!0;break}if(k)break}if(P){let k=!1;for(const O of P)if(O.includes(a)){s.push(B),k=!0;break}if(k)break}if(U&&(typeof U=="string"?U:U.join(`
|
149
|
-
`)).includes(a)){s.push(B);break}if(
|
149
|
+
`)).includes(a)){s.push(B);break}if(E){let k=!1;for(const O of E)if(O.includes(a)){s.push(B),k=!0;break}if(k)break}if(j){let k=!1;for(const O of j){const{desc:Y,examples:S}=O;if(Y.join(`
|
150
150
|
`).includes(a)){s.push(B),k=!0;break}if((o=S==null?void 0:S.join(`
|
151
151
|
`))!=null&&o.includes(a)){s.push(B),k=!0;break}}if(k)break}if(G){let k=!1;for(const O of G){const{name:Y,desc:S,type:W}=O;if(Y.includes(a)||S!=null&&S.includes(a)||W!=null&&W.includes(a)){s.push(B),k=!0;break}}if(k)break}if(V){let k=!1;for(const O of V)if(O.includes(a)){s.push(B),k=!0;break}if(k)break}}}return{labelList:n,contentList:s}}const Um=a=>{var V;const{group:n,itemKey:s,onItemClick:o,currentIndex:c}=a,[l,m]=R.useState(),[y,f]=R.useState(0),[b,h]=R.useState("Copy code"),[T,P]=R.useState("Copy link");R.useEffect(()=>{U(c)},[s]);const U=B=>{const k=s.replace(`${n==null?void 0:n.prefix}_`,""),O=pt[n==null?void 0:n.key].get(k);f(B),O&&Rm(O,B).then(Y=>{m(Y)})},F=B=>{U(B)},E=B=>{var k,O;if(B.target.localName==="a"&&B.target.hash&&((O=(k=B.target)==null?void 0:k.dataset)!=null&&O.name)){B.preventDefault();const{hash:Y}=B.target;o(Y.replace("#",""))}},j=()=>{h("Copied"),setTimeout(()=>{h("Copy code")},1e3)},G=()=>{P("Link copied"),setTimeout(()=>{P("Copy link")},3e3)};return L.jsx("div",{onClick:E,id:`#${s}`,children:L.jsxs("div",{className:"manual-content-wrapper",children:[L.jsxs("div",{className:"manual-content-header",children:[L.jsxs("div",{children:[L.jsx("h3",{className:"manual-content-header-title",children:l==null?void 0:l.name}),!!(l!=null&&l.overloads)&&L.jsx("span",{className:"manual-content-header-overloads",children:l==null?void 0:l.overloads})]}),L.jsx(vn,{text:(l==null?void 0:l.name)||"",onCopy:G,children:L.jsx("div",{"data-tooltip":T,className:"manual-content-btn",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28",width:"28",height:"28",children:L.jsxs("g",{fill:"currentColor",children:[L.jsx("path",{fillRule:"nonzero",d:"M15.039 5.969l-.019-.019-2.828 2.828.707.707 2.474-2.474c1.367-1.367 3.582-1.367 4.949 0s1.367 3.582 0 4.949l-2.474 2.474.707.707 2.828-2.828-.019-.019c1.415-1.767 1.304-4.352-.334-5.99-1.638-1.638-4.224-1.749-5.99-.334zM5.97 15.038l-.019-.019 2.828-2.828.707.707-2.475 2.475c-1.367 1.367-1.367 3.582 0 4.949s3.582 1.367 4.949 0l2.474-2.474.707.707-2.828 2.828-.019-.019c-1.767 1.415-4.352 1.304-5.99-.334-1.638-1.638-1.749-4.224-.334-5.99z"}),L.jsx("path",{d:"M10.485 16.141l5.656-5.656.707.707-5.656 5.656z"})]})})})})]}),(V=l==null?void 0:l.desc)==null?void 0:V.map((B,k)=>L.jsx("div",{dangerouslySetInnerHTML:{__html:B},className:"manual-content-text"},k)),(l==null?void 0:l.type)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"type"}),L.jsx("div",{className:"manual-content-text",children:l.type})]}),(l==null?void 0:l.syntax)&&L.jsxs(R.Fragment,{children:[L.jsxs("div",{className:"manual-content-sub-title",children:["Syntax ",!!(l!=null&&l.overloads)&&"& Overloads"]}),l.syntax.map((B,k)=>{var O;return(((O=l.syntax)==null?void 0:O.length)||0)>1?L.jsx("div",{onClick:()=>F(k),children:L.jsx("pre",{className:`manual-content-syntax with-overloads ${k===y?"selected":""}`,children:B})},k):L.jsx("pre",{className:"manual-content-syntax",children:B},k)})]}),(l==null?void 0:l.args)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"arguments"}),l.args.map((B,k)=>L.jsxs("div",{className:"manual-content-text",children:[L.jsx("span",{className:"manual-content-args-label",children:B.label})," ",L.jsx("span",{dangerouslySetInnerHTML:{__html:B.desc||""}})]},k))]}),(l==null?void 0:l.fields)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"fields"}),l.fields.map((B,k)=>L.jsxs("div",{className:"manual-content-text",children:[L.jsx("span",{className:"manual-content-args-label",children:B.label})," ",L.jsx("span",{dangerouslySetInnerHTML:{__html:B.desc||""}})]},k))]}),(l==null?void 0:l.examples)&&L.jsxs(R.Fragment,{children:[L.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[L.jsx("div",{children:L.jsx("span",{children:"example"})}),L.jsx(vn,{text:l.originalExample||"",onCopy:j,children:L.jsx("div",{"data-tooltip":b,className:"manual-content-btn manual-content-example-copy",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:L.jsx("path",{stroke:"currentColor",d:"M8 9.5H6.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V20m-8-1.5h11a1 1 0 0 0 1-1v-11a1 1 0 0 0-1-1h-11a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1z"})})})})]}),L.jsx("pre",{className:"manual-content-example",children:L.jsx("code",{dangerouslySetInnerHTML:{__html:l.examples}})})]}),(l==null?void 0:l.detailedDesc)&&l.detailedDesc.map((B,k)=>L.jsxs(R.Fragment,{children:[B.desc.map((O,Y)=>L.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:O}},Y)),L.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[L.jsx("div",{children:L.jsx("span",{children:"example"})}),L.jsx(vn,{text:B.originalExample||"",onCopy:j,children:L.jsx("div",{"data-tooltip":b,className:"manual-content-btn manual-content-example-copy",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:L.jsx("path",{stroke:"currentColor",d:"M8 9.5H6.5a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V20m-8-1.5h11a1 1 0 0 0 1-1v-11a1 1 0 0 0-1-1h-11a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1z"})})})})]}),L.jsx("pre",{className:"manual-content-example",children:L.jsx("code",{dangerouslySetInnerHTML:{__html:B.examples||""}})})]},k)),(l==null?void 0:l.returns)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"returns"}),l.returns.map((B,k)=>L.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:B}},k))]}),(l==null?void 0:l.remarks)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"remarks"}),l.remarks.map((B,k)=>L.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:B}},k))]}),(l==null?void 0:l.seeAlso)&&L.jsxs(R.Fragment,{children:[L.jsx("div",{className:"manual-content-sub-title",children:"see Also"}),L.jsx("div",{className:"manual-content-see_also",children:l.seeAlso.map((B,k)=>L.jsx("a",{className:"manual-content-see_also-tag","data-name":B==null?void 0:B.name,href:B==null?void 0:B.link,children:B==null?void 0:B.name},k))})]})]})})};De.languages.register({id:Se}),De.editor.defineTheme("vs-dark",cn),De.editor.defineTheme("vs",ln),De.languages.setMonarchTokensProvider(Se,Lr),De.languages.setLanguageConfiguration(Se,on);const Km=({theme:a="vs-dark",currentValue:n})=>{const[s,o]=R.useState(ds[0]),[c,l]=R.useState(null),[m,y]=R.useState(0),[f,b]=R.useState(""),[h,T]=R.useState("var_bar_index"),P=R.useRef(null),U=R.useRef(null),F=k=>{k.key===(s==null?void 0:s.key)&&!(s!=null&&s.isHidden)?o({...k,isHidden:!0}):o(k)};R.useEffect(()=>{De.editor.setTheme(a)},[a]),R.useEffect(()=>{if(n.value){const[k]=n.value.split("_"),O=ds.find(Y=>k===Y.prefix);O&&(y(n.index||0),V(O,n.value))}},[n]);const E=(k,O)=>{var Y;k!==h&&(O&&o(O),y(0),T(k),(Y=U.current)==null||Y.scrollTo({top:0}))},j=k=>{if(k.target.value.trim()==="")G();else{b(k.target.value);const O=Bm(k.target.value);l(O)}},G=()=>{b(""),l(null),setTimeout(()=>{var k,O;(O=(k=P.current)==null?void 0:k.querySelector(`a[data-href="${h}"]`))==null||O.scrollIntoView(!0)},10)},V=(k,O)=>{var Y;o(k),T(O),setTimeout(()=>{var S,W;(W=(S=P.current)==null?void 0:S.querySelector(`a[data-href="${O}"]`))==null||W.scrollIntoView(!0)},10),(Y=U.current)==null||Y.scrollTo({top:0})},B=k=>{const O=ds.find(Y=>k.startsWith(Y.prefix));O&&(y(0),V(O,k))};return L.jsxs("div",{className:`${a} manual-warpper`,children:[L.jsxs("div",{className:"manual-left",children:[L.jsxs("div",{className:"manual-search",children:[L.jsx("span",{className:"manual-search-icon",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:"18px",height:"18px",children:L.jsx("path",{fillRule:"evenodd",d:"M12.5 11h-.79l-.28-.27A6.47 6.47 0 0 0 13 6.5 6.5 6.5 0 1 0 6.5 13c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L17.49 16l-4.99-5zm-6 0C4.01 11 2 8.99 2 6.5S4.01 2 6.5 2 11 4.01 11 6.5 8.99 11 6.5 11z"})})}),L.jsx("input",{onChange:j,spellCheck:"false",value:f,className:"manual-search-input",autoComplete:"off",placeholder:"Search",type:"text"}),L.jsx("span",{onClick:G,className:`manual-search-clear ${f?"":"hide"}`,children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95.939 95.939",width:"9",height:"9",children:L.jsx("path",{d:"M62.82 47.97l32.53-32.534a2 2 0 0 0 0-2.828L83.332.586a2 2 0 0 0-2.827 0L47.97 33.12 15.435.587c-.75-.75-2.078-.75-2.828 0L.587 12.607a2 2 0 0 0 0 2.83L33.12 47.97.588 80.504a2 2 0 0 0 0 2.828l12.02 12.02a1.997 1.997 0 0 0 2.83 0L47.97 62.818l32.535 32.535a2 2 0 0 0 2.827 0l12.02-12.02c.78-.783.78-2.05 0-2.83L62.82 47.97z"})})})]}),L.jsx("div",{className:`manual-group-search-list manual-scroll ${f?"":"hide"}`,children:L.jsxs("div",{children:[c==null?void 0:c.labelList.map(k=>L.jsx("a",{onClick:O=>{O.preventDefault(),E(k.key,k.group)},className:`manual-group-body-item ${k.key===h?"manual-group-body-item-selected":""}`,"data-href":k.key,href:`#${k.key}`,children:k.label},`search_${k.key}`)),L.jsx("div",{className:"manual-content-separator"}),c==null?void 0:c.contentList.map(k=>L.jsx("a",{onClick:O=>{O.preventDefault(),E(k.key,k.group)},className:`manual-group-body-item ${k.key===h?"manual-group-body-item-selected":""}`,"data-href":k.key,href:`#${k.key}`,children:k.label},`search_${k.key}`))]})}),L.jsx("div",{className:`manual-group-list manual-scroll ${f?"hide":""}`,ref:P,children:ds.map(k=>{var O,Y;return L.jsxs(R.Fragment,{children:[L.jsx("div",{onClick:()=>F(k),className:`manual-group-title ${k.key===(s==null?void 0:s.key)&&!(s!=null&&s.isHidden)?"active":""}`,children:k.title}),L.jsx("div",{className:`manual-group-body manual-scroll ${k.key!==(s==null?void 0:s.key)||s!=null&&s.isHidden?"hide":""}`,children:(Y=(O=no[k.key])==null?void 0:O.sort().filter(S=>!ao.includes(S)))==null?void 0:Y.map(S=>{const W=`${k.prefix}_${S}`;return L.jsx("a",{onClick:ae=>{ae.preventDefault(),E(W)},className:`manual-group-body-item ${W===h?"manual-group-body-item-selected":""}`,"data-href":W,href:`#${W}`,children:`${S}${k.prefix==="fun"?"()":""}`},W)})})]},k.key)})})]}),L.jsx("div",{ref:U,className:"manual-right manual-scroll",children:L.jsx(Um,{currentIndex:m,group:s,itemKey:h,onItemClick:B})})]})};A.ReferenceManual=Km,A.TradingVueDiffEditor=xm,A.TradingVueEditor=bm,A.parseLibrary=ym,A.parseTcc=Ao,A.removeScript=_m,A.scriptsRun=qo,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|