@guihz/trading-vue-editor-tes 0.0.225 → 0.0.227
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.
@@ -116,7 +116,8 @@ ${this._prefixNameVar}.setVarValue("${v}", ${y}, ${v}, "${h}")`}n==="-="?M=`${v}
|
|
116
116
|
`}return this._isInFunc=!1,this._currentFuncName="",this._codesCol[this._blockCount].push({funcName:n,depends:this._getDepends(n),hasRequest:e.hasRequest,code:d}),d}_parserArrowFunction(e){let n=`$_${e.name}`;this._nameMap.set(e.name,n);const r=[...e.params];n=`${n}${e.index?`$${e.index}`:""}`,this._currentFuncName=n,this._dependsObj[n]=new Map;const a=e.hasRequest?", $paramsExpr":"",c=`const ${n} = (${this._parserParameters(r)}$posStr${a}) => {
|
117
117
|
${this._parserBlock(e.block,!0,!0)}
|
118
118
|
}`;return this._isInFunc=!1,this._currentFuncName="",this._codesCol[this._blockCount].push({funcName:n,depends:this._getDepends(n),hasRequest:e.hasRequest,code:c}),c}_parserParameters(e){return e.length?`{${e.map(n=>{const{name:r,defaultValue:a}=n;let c=r;if(a){const h=this._parserSingleExpression(a);c=`${c} = ${h}`}return c}).join(", ")}},`:""}_parserBlock(e,n=!1,r=!1){return r&&(this._isInFunc=!0),this._parserBlockLine(Array.isArray(e)?e:[e],n,r)}_addVarList(e){var r,a;const n=this._varlist[this._blockCount]||{};if(e.names){const c=e.posList;for(const[h,d]of e.names.entries()){const v=((r=c[h])==null?void 0:r.reName)||d;n[v]=c[h]}}else{const c=((a=e.pos)==null?void 0:a.reName)||e.name;n[c]=e.pos}this._varlist[this._blockCount]=n}_parserDeclareAssign(e){var S;const{nameList:n,value:r}=e,a=this._parserDeclareAssignNames(n);this._addVarList(n);const c={code:"",varNames:a.replace(/[\[\]]/g,"").split(", "),depends:[]},h=`$${a}_${this._blockCount}`;this._dependsObj[h]=new Map;const d=this._parserSingleExpression(r);let v=`let ${a} = ${d}`;if(n.declare){const C=`${n.pos.column}_${n.pos.lineNumber}`,T=this._isInFunc?`$posStr + "_${C}"`:`"${C}"`;v=`let ${a} = ${this._prefixNameVar}.verifyVarAndVarip("${a}", ${T}, "${n.declare}") ? ${this._prefixNameVar}.getVarValue("${a}", ${T}, "${n.declare}") : ${this._prefixNameVar}.setVarValue("${a}", ${T}, ${d}, "${n.declare}")`}return c.code=v,c.depends=this._getDepends(h),(S=this._codesCol[this._blockCount])==null||S.push(c),v}_parserDeclareAssignNames(e){var n,r;switch(e==null?void 0:e.ruleType){case"VarMultiple":const a=e.posList;return`[${e.names.map((c,h)=>{var d,v;return c==="_"?(this.__count++,`_$$${this.__count}`):(d=a[h])!=null&&d.reName?(v=a[h])==null?void 0:v.reName:wn.includes(c)?`$${c}`:c}).join(", ")}]`;case"VarSingle":return e.name==="_"?(this.__count++,`_$$${this.__count}`):(n=e.pos)!=null&&n.reName?(r=e.pos)==null?void 0:r.reName:wn.includes(e.name)?`$${e.name}`:e.name}return""}_parserSingleExpression(e){if(!e)return"";const{exprs:n,operator:r}=e;let a="",c=this._isInConditionalStmt;switch(e.ruleType){case le.MemberIndexExpression:return this._parserMemberIndexExpression(e);case le.MethodExpression:return this._parserMethodExpression(e);case le.UnaryExpression:return`${r}${this._parserSingleExpression(n[0])}`;case le.NotExpression:return`!${this._parserSingleExpression(n[0])}`;case le.AdditiveExpression:return this._parserAdditiveExpression(e);case le.MultiplicativeExpression:case le.RelationalExpression:case le.EqualityExpression:return`${this._parserSingleExpression(n[0])} ${r} ${this._parserSingleExpression(n[1])}`;case le.LogicalAndExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} && ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.LogicalOrExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} || ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.TernaryExpression:return a=`${this._parserSingleExpression(n[0])} ? ${this._parserSingleExpression(n[1])} : ${this._parserSingleExpression(n[2])}`,a;case le.Name:return this._parserName(e);case le.Literal:return this._parseLiteral(e);case le.ParenthesizedExpression:return`(${this._parserSingleExpression(e.exprs)})`;default:return e.name||""}}_parserAdditiveExpression(e){const{exprs:n,operator:r}=e,a=this._parserSingleExpression(n[0]),c=this._parserSingleExpression(n[1]);return r==="-"?`${this._prefixNameVar}.sub(${a}, ${c})`:`${this._prefixNameVar}.add(${a}, ${c})`}_parserMemberIndexExpression(e){var C;const{exprs:n,isInFunc:r,ctx:a}=e,c=n[0],h=this._parserSingleExpression(n[1]);let d=this._parserSingleExpression(c);const v=a.start.tokenIndex,S=r?"$posStr":v;if(c.ruleType===le.Name&&!c.hasMethod){let T=this._blockCount;const D=((C=c.varPos)==null?void 0:C.reName)||c.name;for(;T>=0;){const M=this._varlist[T]||{},P=M[D];if(P)return this._getUserVarMemberIndexs(P,D,T,h,r);if(c.isBuiltIn){const b=this._memberIndexList[0]||{};return b[D]=`${this._prefixNameVar}.setCacheData("${D}", ${d})`,`${this._prefixNameVar}.getCacheData("${D}", ${h}, ${d})`}if(D.includes(".")){const b=D.split(".")[0],y=M[b];if(y)return this._getUserVarMemberIndexs(y,D,T,h,r)}T--}return this._getOtherVarMemberIndexs(`${D}_${c.varScope||c.scope}`,D,c.varScope||c.scope,h,r)}else{const T=this._preRunMembers[this._blockCount]||[],D=`$$m${v}_${S}`;T.push(`const ${D} = ${d};
|
119
|
-
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})
|
119
|
+
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})
|
120
|
+
`),this._preRunMembers[this._blockCount]=T}return`${this._prefixNameVar}.getCacheData("m${v}_" + ${S}, ${h}, ${d})`}_getOtherVarMemberIndexs(e,n,r,a,c){const h=this._memberIndexList[r]||{};e=c&&r!==0?`"${e}_" + $posStr`:`"${e}"`;const d=`${this._prefixNameVar}.setCacheData(${e}, ${n})`;return h[e]=d,this._memberIndexList[r]=h,this._setDepend({name:n,scope:r,memberCode:d}),`${this._prefixNameVar}.getCacheData(${e}, ${a}, ${n})`}_getUserVarMemberIndexs(e,n,r,a,c){return this._getOtherVarMemberIndexs(`${n}_${e.lineNumber}_${e.column}`,n,r,a,c)}_parseLiteral(e){return e.type.endsWith(V.COLOR)?`"${this._colorToRgba(e.value)}"`:e.value}_colorToRgba(e){if(e.startsWith("#")){let n;const r=parseInt(e.substring(1,3),16),a=parseInt(e.substring(3,5),16),c=parseInt(e.substring(5,7),16),h=e.substring(7);return h?n=parseInt(h,16)/255:n=1,`rgba(${Math.round(r)}, ${Math.round(a)}, ${Math.round(c)}, ${n.toFixed(2)})`}return e}_parserName(e,n=!1){const{exprs:r,varScope:a,hasMethod:c,arg:h,varPos:d}=e,v=r.map(S=>{var M;if(typeof S=="string")return(d==null?void 0:d.reName)||S;const{column:C,line:T}=((M=S==null?void 0:S.ctx)==null?void 0:M.start)||{},D=`${T}_${C}`;return this._parserMethodElement(S,D)});if(e.expr&&v.unshift(`(${this._parserSingleExpression(e.expr)})`),e.isBuiltIn){const S=v.join(".");S==="strategy.opentrades"?v.push("opentrades"):S==="chart.left_visible_bar_time"?this._hasLeftVisibleBarTime=!0:S==="chart.right_visible_bar_time"&&(this._hasRightVisibleBarTime=!0),v.unshift(e.isConst?this._prefixNameConst:this._prefixNameVar)}else if(wn.includes(v[0])&&(v[0]=`$${v[0]}`),!c){const S={name:v[0],scope:a||(h==null?void 0:h.varScope)||0,isAgainAssign:n,isArg:h==null?void 0:h.isArg,functionName:this._currentFuncName};this._setDepend(S)}return v.join(".")}_setDepend(e){const n=e.name;for(const r of Object.values(this._dependsObj)){const a=r.get(n)||{},c={...e,...a};r.set(n,c)}}_parserMethodExpression(e){const{exprs:n,ctx:r}=e,{column:a,line:c}=r.start,h=`${c}_${a}`;let d=this._isInFunc?`$posStr + "__${h}"`:`"${h}"`;d=this._isInLoop?`$$count${this._count} + ${d}`:d;let v=!1;const C=n.map(T=>(T.hasMemberIndex&&(v=!0),this._parserMethodElement(T,d))).join(".");if(this._isInConditionalStmt&&v){const T=`$$result_${this._preRunMemberFuncsCount}`;this._preRunMemberFuncsCount++;const D=this._preRunMembersFuncs[this._blockCount]||[];return D.push(`const ${T} = ${C}`),this._preRunMembersFuncs[this._blockCount]=D,T}return C}_parserMethodElement(e,n){let r="",a="";const c={...e.args};e.expr&&(r=`(${this._parserSingleExpression(e.expr)})`),r=r?`${r}.${e.name}`:this._nameMap.get(e.name)||e.name,e.hasVarPrefix&&(r=`${this._prefixNameVar}.${r}`);let h=!1;if(e.isBuiltIn){if(Lp.includes(r))r=`${r}.${r}`;else if(r==="max_bars_back"){const{name:v,varPos:S}=c.var||c.params[0];a=`var_name: "${S?`${v}_${S.lineNumber}_${S.column}`:v}"`}r.startsWith(V.INPUT)?(a=`index: ${this._inputCount}`,this._inputCount++):r.startsWith("request.")&&(h=!0),r=`${this._prefixNameFunc}.${r}`}else{const v=r.split(".");let S=v[0];wn.includes(S)&&(S=`$${S}`,r=v.join("."))}if(e.selfArg){const v=r.split("."),S=v.length;Object.assign(c,{[e.selfArg.name]:{name:v.slice(0,S-1).join(".")}}),r=v[S-1],r=this._nameMap.get(r)||r,this._setDepend({name:v[0],scope:e.varScope||0})}r=`${r}${e.index?`$${e.index}`:""}`;const d=this._parserArguments(c,a,n,h,e.hasRequest,r);if(!e.isBuiltIn){const v=r.split(".");if(v.length>1?this._setDepend({name:v[0],scope:e.varScope||0}):this._setDepend({name:r,scope:0,hasRequest:e.hasRequest,isFunc:!0}),e.funcName){const S=this._nameMap.get(e.funcName)||e.funcName;this._setDepend({name:S,originName:r,scope:0,hasRequest:e.hasRequest,isFunc:!0})}}return r+d}_parserArguments(e,n,r,a=!1,c=!1,h){const d=e.params||[];delete e.params;const v=[],S=[];let C=[],T;const D=(P,b)=>{c&&(this._dependsObj[r]=new Map),a&&b==="expression"&&(this._dependsObj[`$arg_${b}${r}`]=new Map);let y=P.ruleType===le.Brackethesized?this._parserBrackethesized(P):this._parserSingleExpression(P);if(b&&!["arg0, arg1, ...","number0, number1, ..."].includes(b)){P.isSourceType?v.push(`sourceTypeName: "${P.name}"`):b==="defval"&&h===`${this._prefixNameFunc}.input.enum`&&(T=this._enums.get(P.enumName));const g=this._requestParamsHandle(a,b,r,c,y,h);y=(g==null?void 0:g.code)||y,g!=null&&g.paramsExpr&&C.push(g==null?void 0:g.paramsExpr),v.push(`${b}: ${y}`)}else S.push(y)};for(const P of d)D(P,P.originName);for(const P of Object.keys(e))D(e[P],P);a&&this._isInFunc&&v.push("paramsExpr: $paramsExpr"),n&&v.push(n),T&&v.unshift(`options: [${T.join(", ")}]`);const M=C.length?`, [${this._isInFunc?"...$paramsExpr, ":""}${C.join(", ")}]`:"";return S.length?`({${v.join(", ")}}, [${S.join(", ")}], ${r}${M})`:v.length?`({${v.join(", ")}}, ${r}${M})`:`(${r}${M})`}_requestParamsHandle(e,n,r,a,c,h){const d=this._memberIndexList[0],v={};for(const S of Object.keys(d))S.includes("_")||(v[S]=d[S]);if(e&&n==="expression"){const S=this._getDepends(`$arg_${n}${r}`),C=this._getExpressionContext(S);return C.push({scope:1,depends:S.map(T=>(T.isArg&&(T.functionName=this._currentFuncName),T)),code:c,memberCodes:v}),{code:`'${pu(JSON.stringify(C))}'`}}else if(a){const S=this._getDepends(r),C=this._getExpressionContext(S);return C.push({scope:2,varNames:n,methodName:h,depends:S,dependSelf:S.some(T=>T.name===n),code:`${n} = ${c}`,memberCodes:v}),{paramsExpr:`'${pu(JSON.stringify(C))}'`}}}_getExpressionContext(e){const n=[],r=[];return this._getDependsCode(e,n,r),n}_getDependsCode(e,n,r){var a,c;for(const h of e)if(!h.isArg){const d=this._codesCol[h.scope||0],v=d.find(C=>{var T;return((T=C.varNames)==null?void 0:T.includes(h.name))||C.funcName===h.name});v&&(r.includes(v)||(r.push(v),v.depends.length&&this._getDependsCode(v.depends,n,r),n.push({scope:h.scope||0,code:v.code,depends:v.depends,funcName:v.funcName,varNames:(a=v.varNames)==null?void 0:a.join(", ")})));const S=d.filter(C=>C.depends.some(T=>T.name===h.name&&T.scope===h.scope&&T.isAgainAssign));for(const C of S)r.includes(C)||(r.push(C),C.depends.length&&this._getDependsCode(C.depends,n,r),n.push({scope:h.scope||0,code:C.code,depends:C.depends,funcName:C.funcName,varNames:(c=C.varNames)==null?void 0:c.join(", ")}))}}_parserBrackethesized(e){return`[${e.exprs.map(r=>this._parserSingleExpression(r)).join(", ")}]`}_functionalProcess(e){return`(function () {
|
120
121
|
let $$_result=undefined;
|
121
122
|
${e}
|
122
123
|
return $$_result
|
@@ -234,7 +235,8 @@ ${this._prefixNameVar}.againAssignParse(${v}, ${M});
|
|
234
235
|
if ($posStr.startsWith('export')) return;
|
235
236
|
${this._parserBlock(e.block,!0,!0)}
|
236
237
|
}`;return this._isInFunc=!1,this._currentFuncName="",this._codesCol[this._blockCount].push({funcName:n,depends:this._getDepends(n),hasRequest:e.hasRequest,code:h}),h}_parserParameters(e){return e.length?`{${e.map(n=>{const{name:r,defaultValue:a}=n;let c=r;if(a){const h=this._parserSingleExpression(a);c=`${c} = ${h}`}return c}).join(", ")}},`:""}_parserBlock(e,n=!1,r=!1){return r&&(this._isInFunc=!0),this._parserBlockLine(Array.isArray(e)?e:[e],n,r)}_addVarList(e){var r,a;const n=this._varlist[this._blockCount]||{};if(e.names){const c=e.posList;for(const[h,d]of e.names.entries()){const v=((r=c[h])==null?void 0:r.reName)||d;n[v]=c[h]}}else{const c=((a=e.pos)==null?void 0:a.reName)||e.name;n[c]=e.pos}this._varlist[this._blockCount]=n}_parserDeclareAssign(e){var S;const{nameList:n,value:r}=e,a=this._parserDeclareAssignNames(n);this._addVarList(n);const c={code:"",varNames:a.replace(/[\[\]]/g,"").split(", "),depends:[]},h=`$${a}_${this._blockCount}`;this._dependsObj[h]=new Map;const d=this._parserSingleExpression(r);let v=`let ${a} = ${d}`;if(n.declare){const C=`${n.pos.column}_${n.pos.lineNumber}`,T=this._isInFunc?`$posStr + '_' + '${C}'`:`"export_${this._libTitle}_${C}"`;v=`let ${a} = ${this._prefixNameVar}.verifyVarAndVarip("${a}", ${T}, "${n.declare}") ? ${this._prefixNameVar}.getVarValue("${a}", ${T}, "${n.declare}") : ${this._prefixNameVar}.setVarValue("${a}", ${T}, ${d}, "${n.declare}")`}return c.code=v,c.depends=this._getDepends(h),(S=this._codesCol[this._blockCount])==null||S.push(c),v}_parserDeclareAssignNames(e){var n,r;switch(e==null?void 0:e.ruleType){case"VarMultiple":const a=e.posList;return`[${e.names.map((c,h)=>{var d,v;return c==="_"?(this.__count++,`_$$${this.__count}`):(d=a[h])!=null&&d.reName?(v=a[h])==null?void 0:v.reName:wn.includes(c)?`$${c}`:c}).join(", ")}]`;case"VarSingle":return e.name==="_"?(this.__count++,`_$$${this.__count}`):(n=e.pos)!=null&&n.reName?(r=e.pos)==null?void 0:r.reName:wn.includes(e.name)?`$${e.name}`:e.name}return""}_parserSingleExpression(e){if(!e)return"";const{exprs:n,operator:r}=e;let a="",c=this._isInConditionalStmt;switch(e.ruleType){case le.MemberIndexExpression:return this._parserMemberIndexExpression(e);case le.MethodExpression:return this._parserMethodExpression(e);case le.UnaryExpression:return`${r}${this._parserSingleExpression(n[0])}`;case le.NotExpression:return`!${this._parserSingleExpression(n[0])}`;case le.AdditiveExpression:return this._parserAdditiveExpression(e);case le.MultiplicativeExpression:case le.RelationalExpression:case le.EqualityExpression:return`${this._parserSingleExpression(n[0])} ${r} ${this._parserSingleExpression(n[1])}`;case le.LogicalAndExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} && ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.LogicalOrExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} || ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.TernaryExpression:return a=`${this._parserSingleExpression(n[0])} ? ${this._parserSingleExpression(n[1])} : ${this._parserSingleExpression(n[2])}`,a;case le.Name:return this._parserName(e);case le.Literal:return this._parseLiteral(e);case le.ParenthesizedExpression:return`(${this._parserSingleExpression(e.exprs)})`;default:return e.name||""}}_parserAdditiveExpression(e){const{exprs:n,operator:r}=e,a=this._parserSingleExpression(n[0]),c=this._parserSingleExpression(n[1]);return r==="-"?`${this._prefixNameVar}.sub(${a}, ${c})`:`${this._prefixNameVar}.add(${a}, ${c})`}_parserMemberIndexExpression(e){var C;const{exprs:n,isInFunc:r,ctx:a}=e,c=n[0],h=this._parserSingleExpression(n[1]);let d=this._parserSingleExpression(c);const v=a.start.tokenIndex,S=r?"$posStr":v;if(c.ruleType===le.Name&&!c.hasMethod){let T=this._blockCount;const D=((C=c.varPos)==null?void 0:C.reName)||c.name;for(;T>=0;){const M=this._varlist[T]||{},P=M[D];if(P)return this._getUserVarMemberIndexs(P,D,T,h,r);if(c.isBuiltIn){const b=this._memberIndexList[0]||{};return b[D]=`${this._prefixNameVar}.setCacheData("${D}", ${d})`,`${this._prefixNameVar}.getCacheData("${D}", ${h}, ${d})`}if(D.includes(".")){const b=D.split(".")[0],y=M[b];if(y)return this._getUserVarMemberIndexs(y,D,T,h,r)}T--}return this._getOtherVarMemberIndexs(`${D}_${c.varScope||c.scope}`,D,c.varScope||c.scope,h,r)}else{const T=this._preRunMembers[this._blockCount]||[],D=`$$m${v}_${S}`;T.push(`const ${D} = ${d};
|
237
|
-
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})
|
238
|
+
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})
|
239
|
+
`),this._preRunMembers[this._blockCount]=T}return`${this._prefixNameVar}.getCacheData("m${v}_" + ${S}, ${h}, ${d})`}_getOtherVarMemberIndexs(e,n,r,a,c){const h=this._memberIndexList[r]||{};e=c&&r!==0?`"${e}_" + $posStr`:`"${e}"`;const d=`${this._prefixNameVar}.setCacheData(${e}, ${n})`;return h[e]=d,this._memberIndexList[r]=h,this._setDepend({name:n,scope:r,memberCode:d}),`${this._prefixNameVar}.getCacheData(${e}, ${a}, ${n})`}_getUserVarMemberIndexs(e,n,r,a,c){return this._getOtherVarMemberIndexs(`${n}_${e.lineNumber}_${e.column}`,n,r,a,c)}_parseLiteral(e){return e.type.endsWith(V.COLOR)?`"${this._colorToRgba(e.value)}"`:e.value}_colorToRgba(e){if(e.startsWith("#")){let n;const r=parseInt(e.substring(1,3),16),a=parseInt(e.substring(3,5),16),c=parseInt(e.substring(5,7),16),h=e.substring(7);return h?n=(255-parseInt(h,16))/255:n=1,`rgba(${Math.round(r)}, ${Math.round(a)}, ${Math.round(c)}, ${n.toFixed(2)})`}return e}_parserName(e,n=!1){const{exprs:r,varScope:a,hasMethod:c,arg:h,varPos:d}=e,v=r.map(S=>{var M;if(typeof S=="string")return(d==null?void 0:d.reName)||S;const{column:C,line:T}=((M=S==null?void 0:S.ctx)==null?void 0:M.start)||{},D=this._isInFunc?`${T}_${C}`:`export_${this._libTitle}_${T}_${C}`;return this._parserMethodElement(S,D)});if(e.expr&&v.unshift(`(${this._parserSingleExpression(e.expr)})`),e.isBuiltIn)v.join(".")==="strategy.opentrades"&&v.push("opentrades"),v.unshift(e.isConst?this._prefixNameConst:this._prefixNameVar);else if(wn.includes(v[0])&&(v[0]=`$${v[0]}`),!c){const S={name:v[0],scope:a||(h==null?void 0:h.varScope)||0,isAgainAssign:n,isArg:h==null?void 0:h.isArg,functionName:this._currentFuncName};this._setDepend(S)}return v.join(".")}_setDepend(e){const n=e.name;for(const r of Object.values(this._dependsObj)){const a=r.get(n)||{},c={...e,...a};r.set(n,c)}}_parserMethodExpression(e){const{exprs:n,ctx:r}=e,{column:a,line:c}=r.start,h=`${c}_${a}`;let d=this._isInFunc?`$posStr + "_${h}"`:`"export_${this._libTitle}_${h}"`;d=this._isInLoop?`$$count${this._count} + ${d}`:d;let v=!1;const S=n.map(T=>(T.hasMemberIndex&&(v=!0),this._parserMethodElement(T,d))),C=S.join(".");if(S.length===1&&[...Al,Ii.library].some(T=>S[0].startsWith(`${this._prefixNameFunc}.${T}`)))return"";if(this._isInConditionalStmt&&v){const T=`$$result_${this._preRunMemberFuncsCount}`;this._preRunMemberFuncsCount++;const D=this._preRunMembersFuncs[this._blockCount]||[];return D.push(`const ${T} = ${C}`),this._preRunMembersFuncs[this._blockCount]=D,T}return C}_parserMethodElement(e,n){let r="",a="";const c={...e.args};e.expr&&(r=`(${this._parserSingleExpression(e.expr)})`),r=r?`${r}.${e.name}`:this._nameMap.get(e.name)||e.name,e.hasVarPrefix&&(r=`${this._prefixNameVar}.${r}`);let h=!1;if(e.isBuiltIn){if(Lp.includes(r))r=`${r}.${r}`;else if(r==="max_bars_back"){const{name:v,varPos:S}=c.var||c.params[0];a=`var_name: "${S?`${v}_${S.lineNumber}_${S.column}`:v}"`}r.startsWith(V.INPUT)?(a=`index: ${this._inputCount}`,this._inputCount++):r.startsWith("request.")&&(h=!0),r=`${this._prefixNameFunc}.${r}`}else{const v=r.split(".");let S=v[0];wn.includes(S)&&(S=`$${S}`,r=v.join("."))}if(e.selfArg){const v=r.split("."),S=v.length;Object.assign(c,{[e.selfArg.name]:{name:v.slice(0,S-1).join(".")}}),r=v[S-1],r=this._nameMap.get(r)||r,this._setDepend({name:v[0],scope:e.varScope||0})}r=`${r}${e.index?`$${e.index}`:""}`;const d=this._parserArguments(c,a,n,h,e.hasRequest,r);if(!e.isBuiltIn){const v=r.split(".");if(v.length>1?this._setDepend({name:v[0],scope:e.varScope||0}):this._setDepend({name:r,scope:0,hasRequest:e.hasRequest,isFunc:!0}),e.funcName){const S=this._nameMap.get(e.funcName)||e.funcName;this._setDepend({name:S,originName:r,scope:0,hasRequest:e.hasRequest,isFunc:!0})}}return r+d}_parserArguments(e,n,r,a=!1,c=!1,h){const d=e.params||[];delete e.params;const v=[],S=[];let C=[],T;const D=(P,b)=>{c&&(this._dependsObj[r]=new Map),a&&b==="expression"&&(this._dependsObj[`$arg_${b}${r}`]=new Map);let y=P.ruleType===le.Brackethesized?this._parserBrackethesized(P):this._parserSingleExpression(P);if(b&&!["arg0, arg1, ...","number0, number1, ..."].includes(b)){P.isSourceType?v.push(`sourceTypeName: "${P.name}"`):b==="defval"&&h===`${this._prefixNameFunc}.input.enum`&&(T=this._enums.get(P.enumName));const g=this._requestParamsHandle(a,b,r,c,y,h);y=(g==null?void 0:g.code)||y,g!=null&&g.paramsExpr&&C.push(g==null?void 0:g.paramsExpr),v.push(`${b}: ${y}`)}else S.push(y)};for(const P of d)D(P,P.originName);for(const P of Object.keys(e))D(e[P],P);a&&this._isInFunc&&v.push("paramsExpr: $paramsExpr"),n&&v.push(n),T&&v.unshift(`options: [${T.join(", ")}]`);const M=C.length?`, [${this._isInFunc?"...$paramsExpr, ":""}${C.join(", ")}]`:"";return S.length?`({${v.join(", ")}}, [${S.join(", ")}], ${r}${M})`:v.length?`({${v.join(", ")}}, ${r}${M})`:`(${r}${M})`}_requestParamsHandle(e,n,r,a,c,h){const d=this._memberIndexList[0],v={};for(const S of Object.keys(d))S.includes("_")||(v[S]=d[S]);if(e&&n==="expression"){const S=this._getDepends(`$arg_${n}${r}`),C=this._getExpressionContext(S);return C.push({scope:1,depends:S.map(T=>(T.isArg&&(T.functionName=this._currentFuncName),T)),code:c,memberCodes:v}),{code:`'${pu(JSON.stringify(C))}'`}}else if(a){const S=this._getDepends(r),C=this._getExpressionContext(S);return C.push({scope:2,varNames:n,methodName:h,depends:S,dependSelf:S.some(T=>T.name===n),code:`${n} = ${c}`,memberCodes:v}),{paramsExpr:`'${pu(JSON.stringify(C))}'`}}}_getExpressionContext(e){const n=[],r=[];return this._getDependsCode(e,n,r),n}_getDependsCode(e,n,r){var a,c;for(const h of e)if(!h.isArg){const d=this._codesCol[h.scope||0],v=d.find(C=>{var T;return((T=C.varNames)==null?void 0:T.includes(h.name))||C.funcName===h.name});v&&(r.includes(v)||(r.push(v),v.depends.length&&this._getDependsCode(v.depends,n,r),n.push({scope:h.scope||0,code:v.code,depends:v.depends,funcName:v.funcName,varNames:(a=v.varNames)==null?void 0:a.join(", ")})));const S=d.filter(C=>C.depends.some(T=>T.name===h.name&&T.scope===h.scope&&T.isAgainAssign));for(const C of S)r.includes(C)||(r.push(C),C.depends.length&&this._getDependsCode(C.depends,n,r),n.push({scope:h.scope||0,code:C.code,depends:C.depends,funcName:C.funcName,varNames:(c=C.varNames)==null?void 0:c.join(", ")}))}}_parserBrackethesized(e){return`[${e.exprs.map(r=>this._parserSingleExpression(r)).join(", ")}]`}_functionalProcess(e){return`(function () {
|
238
240
|
let $$_result=undefined;
|
239
241
|
${e}
|
240
242
|
return $$_result
|
@@ -69145,7 +69145,7 @@ Cd.onerror = (a) => {
|
|
69145
69145
|
async function Sd(a) {
|
69146
69146
|
return await wn.setInlayHints(a);
|
69147
69147
|
}
|
69148
|
-
const Nd = xo(Cd), zd = xo(new Worker(new URL("" + new URL("assets/parserTccWorker-
|
69148
|
+
const Nd = xo(Cd), zd = xo(new Worker(new URL("" + new URL("assets/parserTccWorker-C2b6T_uv.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
|
69149
69149
|
async function zw(a, s = !1) {
|
69150
69150
|
const { functions: r, types: n, constants: o, variables: l, methods: c } = dt;
|
69151
69151
|
return await zd.parseTcc(a, s, ho(Sd), { functions: Object.fromEntries(r), methods: Object.fromEntries(c), types: Object.fromEntries(n), constants: Object.fromEntries(o), variables: Object.fromEntries(l) });
|
@@ -70287,7 +70287,7 @@ const Nv = (a) => {
|
|
70287
70287
|
const B = (q) => {
|
70288
70288
|
const C = r.replace(`${s == null ? void 0 : s.prefix}_`, ""), O = dt[s == null ? void 0 : s.key].get(C);
|
70289
70289
|
x(q), O && vo(O, q).then((z) => {
|
70290
|
-
d(z), _(`${window.location.origin}/reference-manual/#${s == null ? void 0 : s.
|
70290
|
+
d(z), _(`${window.location.origin}/reference-manual/#${s == null ? void 0 : s.prefix}_${z == null ? void 0 : z.orirginalName}`);
|
70291
70291
|
});
|
70292
70292
|
}, U = (q) => {
|
70293
70293
|
B(q);
|
@@ -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 tl=Symbol("Comlink.proxy"),km=Symbol("Comlink.endpoint"),Dm=Symbol("Comlink.releaseProxy"),Bn=Symbol("Comlink.finalizer"),wa=Symbol("Comlink.thrown"),sl=a=>typeof a=="object"&&a!==null||typeof a=="function",Im={canHandle:a=>sl(a)&&a[tl],serialize(a){const{port1:s,port2:r}=new MessageChannel;return al(a,s),[r,[r]]},deserialize(a){return a.start(),Un(a)}},Am={canHandle:a=>sl(a)&&wa in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},rl=new Map([["proxy",Im],["throw",Am]]);function qm(a,s){for(const r of a)if(s===r||r==="*"||r instanceof RegExp&&r.test(s))return!0;return!1}function al(a,s=globalThis,r=["*"]){s.addEventListener("message",function n(o){if(!o||!o.data)return;if(!qm(r,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:l,type:c,path:d}=Object.assign({path:[]},o.data),m=(o.data.argumentList||[]).map(As);let _;try{const g=d.slice(0,-1).reduce((h,D)=>h[D],a),x=d.reduce((h,D)=>h[D],a);switch(c){case"GET":_=x;break;case"SET":g[d.slice(-1)[0]]=As(o.data.value),_=!0;break;case"APPLY":_=x.apply(g,m);break;case"CONSTRUCT":{const h=new x(...m);_=Kn(h)}break;case"ENDPOINT":{const{port1:h,port2:D}=new MessageChannel;al(a,D),_=Em(h,[h])}break;case"RELEASE":_=void 0;break;default:return}}catch(g){_={value:g,[wa]:0}}Promise.resolve(_).catch(g=>({value:g,[wa]:0})).then(g=>{const[x,h]=Da(g);s.postMessage(Object.assign(Object.assign({},x),{id:l}),h),c==="RELEASE"&&(s.removeEventListener("message",n),nl(s),Bn in a&&typeof a[Bn]=="function"&&a[Bn]())}).catch(g=>{const[x,h]=Da({value:new TypeError("Unserializable return value"),[wa]:0});s.postMessage(Object.assign(Object.assign({},x),{id:l}),h)})}),s.start&&s.start()}function Cm(a){return a.constructor.name==="MessagePort"}function nl(a){Cm(a)&&a.close()}function Un(a,s){return $n(a,[],s)}function va(a){if(a)throw new Error("Proxy has been released and is not useable")}function il(a){return Hs(a,{type:"RELEASE"}).then(()=>{nl(a)})}const Ta=new WeakMap,ka="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(Ta.get(a)||0)-1;Ta.set(a,s),s===0&&il(a)});function Sm(a,s){const r=(Ta.get(s)||0)+1;Ta.set(s,r),ka&&ka.register(a,s,a)}function zm(a){ka&&ka.unregister(a)}function $n(a,s=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(l,c){if(va(n),c===Dm)return()=>{zm(o),il(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>o};const d=Hs(a,{type:"GET",path:s.map(m=>m.toString())}).then(As);return d.then.bind(d)}return $n(a,[...s,c])},set(l,c,d){va(n);const[m,_]=Da(d);return Hs(a,{type:"SET",path:[...s,c].map(g=>g.toString()),value:m},_).then(As)},apply(l,c,d){va(n);const m=s[s.length-1];if(m===km)return Hs(a,{type:"ENDPOINT"}).then(As);if(m==="bind")return $n(a,s.slice(0,-1));const[_,g]=ol(d);return Hs(a,{type:"APPLY",path:s.map(x=>x.toString()),argumentList:_},g).then(As)},construct(l,c){va(n);const[d,m]=ol(c);return Hs(a,{type:"CONSTRUCT",path:s.map(_=>_.toString()),argumentList:d},m).then(As)}});return Sm(o,a),o}function Nm(a){return Array.prototype.concat.apply([],a)}function ol(a){const s=a.map(Da);return[s.map(r=>r[0]),Nm(s.map(r=>r[1]))]}const ll=new WeakMap;function Em(a,s){return ll.set(a,s),a}function Kn(a){return Object.assign(a,{[tl]:!0})}function Da(a){for(const[s,r]of rl)if(r.canHandle(a)){const[n,o]=r.serialize(a);return[{type:"HANDLER",name:s,value:n},o]}return[{type:"RAW",value:a},ll.get(a)||[]]}function As(a){switch(a.type){case"HANDLER":return rl.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Hs(a,s,r){return new Promise(n=>{const o=Lm();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==o||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:o},s),r)})}function Lm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const cl=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CdZluQjS.js").href:new URL("assets/scriptsRunWorker-CdZluQjS.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:ra&&ra.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});cl.onerror=a=>{console.error(a)};async function pl(a){return await ba.setInlayHints(a)}const dl=Un(cl),ul=Un(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-DVfTw1lJ.js").href:new URL("assets/parserTccWorker-DVfTw1lJ.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:ra&&ra.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function ml(a,s=!1){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await ul.parseTcc(a,s,Kn(pl),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Mm(a,s){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await ul.parseLibraryCode(a,s,Kn(pl),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Om(a,s,r=!0){return await dl.runScript(a,s,r)}async function Pm(a){return await dl.removeScript(a)}function Rm(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})}const{slice:Fm,forEach:Bm}=[];function Um(a){return Bm.call(Fm.call(arguments,1),s=>{if(s)for(const r in s)a[r]===void 0&&(a[r]=s[r])}),a}const yl=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,$m=(a,s,r)=>{const n=r||{};n.path=n.path||"/";const o=encodeURIComponent(s);let l=`${a}=${o}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!yl.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!yl.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},_l={create(a,s,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),n&&(o.domain=n),document.cookie=$m(a,encodeURIComponent(s),o)},read(a){const s=`${a}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let o=r[n];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(s)===0)return o.substring(s.length,o.length)}return null},remove(a){this.create(a,"",-1)}};var Km={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return _l.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:r,cookieMinutes:n,cookieDomain:o,cookieOptions:l}=s;r&&typeof document<"u"&&_l.create(r,a,n,o,l)}},jm={name:"querystring",lookup(a){var n;let{lookupQuerystring:s}=a,r;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const c=o.substring(1).split("&");for(let d=0;d<c.length;d++){const m=c[d].indexOf("=");m>0&&c[d].substring(0,m)===s&&(r=c[d].substring(m+1))}}return r}};let Cr=null;const fl=()=>{if(Cr!==null)return Cr;try{Cr=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{Cr=!1}return Cr};var Hm={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&fl())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:r}=s;r&&fl()&&window.localStorage.setItem(r,a)}};let Sr=null;const gl=()=>{if(Sr!==null)return Sr;try{Sr=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{Sr=!1}return Sr};var Wm={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&gl())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:r}=s;r&&gl()&&window.sessionStorage.setItem(r,a)}},Vm={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:o}=navigator;if(r)for(let l=0;l<r.length;l++)s.push(r[l]);n&&s.push(n),o&&s.push(o)}return s.length>0?s:void 0}},Gm={name:"htmlTag",lookup(a){let{htmlTag:s}=a,r;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Xm={name:"path",lookup(a){var o;let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(o=r[typeof s=="number"?s:0])==null?void 0:o.replace("/",""):void 0}},Ym={name:"subdomain",lookup(a){var o,l;let{lookupFromSubdomainIndex:s}=a;const r=typeof s=="number"?s+1:1,n=typeof window<"u"&&((l=(o=window.location)==null?void 0:o.hostname)==null?void 0:l.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[r]}};function Qm(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class bl{constructor(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,r)}init(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Um(r,this.options||{},Qm()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Km),this.addDetector(jm),this.addDetector(Hm),this.addDetector(Wm),this.addDetector(Vm),this.addDetector(Gm),this.addDetector(Xm),this.addDetector(Ym)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let r=[];return s.forEach(n=>{if(this.detectors[n]){let o=this.detectors[n].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),r=r.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(s,r){r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}bl.type="languageDetector";const Zm=(...a)=>{console!=null&&console.warn&&(qs(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},xl={},jn=(...a)=>{qs(a[0])&&xl[a[0]]||(qs(a[0])&&(xl[a[0]]=new Date),Zm(...a))},hl=(a,s)=>()=>{if(a.isInitialized)s();else{const r=()=>{setTimeout(()=>{a.off("initialized",r)},0),s()};a.on("initialized",r)}},Hn=(a,s,r)=>{a.loadNamespaces(s,hl(a,r))},wl=(a,s,r,n)=>{if(qs(r)&&(r=[r]),a.options.preload&&a.options.preload.indexOf(s)>-1)return Hn(a,r,n);r.forEach(o=>{a.options.ns.indexOf(o)<0&&a.options.ns.push(o)}),a.loadLanguages(s,hl(a,n))},Jm=(a,s,r={})=>!s.languages||!s.languages.length?(jn("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:r.lng,precheck:(n,o)=>{var l;if(((l=r.bindI18n)==null?void 0:l.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,a))return!1}}),qs=a=>typeof a=="string",ey=a=>typeof a=="object"&&a!==null,ty=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,sy={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ry=a=>sy[a];let Wn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(ty,ry)};const ay=(a={})=>{Wn={...Wn,...a}},ny=()=>Wn;let vl;const iy=a=>{vl=a},oy=()=>vl,ly={type:"3rdParty",init(a){ay(a.options.react),iy(a)}},cy=S.createContext();class py{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const dy=(a,s)=>{const r=S.useRef();return S.useEffect(()=>{r.current=s?r.current:a},[a,s]),r.current},Tl=(a,s,r,n)=>a.getFixedT(s,r,n),uy=(a,s,r,n)=>S.useCallback(Tl(a,s,r,n),[a,s,r,n]),Ws=(a,s={})=>{var V,Q,q,C;const{i18n:r}=s,{i18n:n,defaultNS:o}=S.useContext(cy)||{},l=r||n||oy();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new py),!l){jn("You will need to pass in an i18next instance by using initReactI18next");const R=(A,O)=>qs(O)?O:ey(O)&&qs(O.defaultValue)?O.defaultValue:Array.isArray(A)?A[A.length-1]:A,E=[R,{},!1];return E.t=R,E.i18n={},E.ready=!1,E}(V=l.options.react)!=null&&V.wait&&jn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...ny(),...l.options.react,...s},{useSuspense:d,keyPrefix:m}=c;let _=a||o||((Q=l.options)==null?void 0:Q.defaultNS);_=qs(_)?[_]:_||["translation"],(C=(q=l.reportNamespaces).addUsedNamespaces)==null||C.call(q,_);const g=(l.isInitialized||l.initializedStoreOnce)&&_.every(R=>Jm(R,l,c)),x=uy(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),h=()=>x,D=()=>Tl(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),[z,P]=S.useState(h);let $=_.join();s.lng&&($=`${s.lng}${$}`);const j=dy($),W=S.useRef(!0);S.useEffect(()=>{const{bindI18n:R,bindI18nStore:E}=c;W.current=!0,!g&&!d&&(s.lng?wl(l,s.lng,_,()=>{W.current&&P(D)}):Hn(l,_,()=>{W.current&&P(D)})),g&&j&&j!==$&&W.current&&P(D);const A=()=>{W.current&&P(D)};return R&&(l==null||l.on(R,A)),E&&(l==null||l.store.on(E,A)),()=>{W.current=!1,l&&(R==null||R.split(" ").forEach(O=>l.off(O,A))),E&&l&&E.split(" ").forEach(O=>l.store.off(O,A))}},[l,$]),S.useEffect(()=>{W.current&&g&&P(h)},[l,m,g]);const re=[z,l,g];if(re.t=z,re.i18n=l,re.ready=g,g||!g&&!d)return re;throw new Promise(R=>{s.lng?wl(l,s.lng,_,()=>R()):Hn(l,_,()=>R())})},my={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v1 Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help"},yy={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v1参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助"};Me.use(bl).use(ly).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:my},zh:{translation:yy}}}),self.MonacoEnvironment={getWorker(){return new Rm({name:"Editor Worker"})}},Cn.config({paths:{vs:"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const _y=(a,s)=>{const{height:r,width:n,theme:o,options:l,hasDiff:c,readOnly:d,defaultValue:m,language:_,onChange:g,onLinkOpen:x,onCursorPositionChange:h,onActionTrigger:D,onEditorDidMount:z}=a,{t:P,i18n:$}=Ws(),j=S.useRef(null),W=S.useRef(null),re=S.useRef(!1),V=S.useRef(!1);S.useImperativeHandle(s,()=>({setOriginalScript(A){var O;(O=j.current)==null||O.setOriginalScript(A)},setScript(A){var O;(O=j.current)==null||O.setValue(A)},gotoLine(){var A;(A=j.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=j.current)==null?void 0:A.getEditorLayout()},setPosition(A,O){var J;(J=j.current)==null||J.setPosition({column:A,lineNumber:O})},setModelMarkers(A){var O;V.current=!0,(O=j.current)==null||O.setModelMarkers(A),setTimeout(()=>{V.current=!1},2e3)},focus(){var A;(A=j.current)==null||A.focus()}})),S.useEffect(()=>{var A,O;c?(O=j.current)==null||O.addDiffDecorations():(A=j.current)==null||A.removeDiffDecorations()},[c]),S.useEffect(()=>{o&&Ae.editor.setTheme(o)},[o]),S.useEffect(()=>{_&&$.changeLanguage(_)},[_]),S.useEffect(()=>{var A;(A=j.current)==null||A.updateActionTrigger(D)},[D]),S.useEffect(()=>{var A;x&&((A=j.current)==null||A.addLinkOpenFunc(x))},[x]);function Q(A,O){var se,le;Pt.initBuiltinsTrees(),ba.setEditor(A),j.current=new Tm(A,O,D),x&&((se=j.current)==null||se.addLinkOpenFunc(x)),c&&((le=j.current)==null||le.addDiffDecorations()),Vu(A),requestAnimationFrame(E);const J=A.getValue();j.current.onChangeCursorPosition(h),g&&g(J),!d&&q(J),z&&z()}const q=S.useCallback(async A=>{var Rt;re.current=!1;const{errors:O,functions:J,methods:se,types:le,variables:Y,overloadsFuncs:oe,imports:xe,enums:pe}=await ml(A),_e=new Map(Object.entries(J)),Ee=new Map(Object.entries(se)),ee=new Map(Object.entries(le)),de=new Map(Object.entries(Y)),Oe=new Map(Object.entries(xe)),Ge=new Map(Object.entries(pe));Ds.setUserDefined({functions:_e,methods:Ee,types:ee,variables:de,imports:Oe,enums:Ge},oe),Pt.setUserDefind(_e,ee,de,Ee,Ge);const Qe=O.map(us=>({...us,severity:us.type||Ae.MarkerSeverity.Error}));d||!re.current&&!V.current&&Qe.length&&((Rt=j.current)==null||Rt.setModelMarkers(Qe))},[d]),C=S.useMemo(()=>Yu.debounce(q,1500),[q]);function R(A){var O;if(d){q(A||"");return}re.current=!0,ba.clearInlayHints(),(O=j.current)==null||O.setModelMarkers([]),A!==void 0&&(g&&g(A),C(A))}const E=S.useCallback(()=>{var O,J;const A=(O=W.current)==null?void 0:O.getBoundingClientRect();(J=j.current)==null||J.setEditorLayout((A==null?void 0:A.height)||0,A==null?void 0:A.width)},[]);return S.useEffect(()=>{const A=()=>{window.requestAnimationFrame(E)},O=new ResizeObserver(A);return W.current&&O.observe(W.current),()=>{var J;W.current&&O.unobserve(W.current),O.disconnect(),(J=j.current)==null||J.dispose()}},[]),T.jsx("div",{ref:W,children:T.jsx(uu,{height:r,width:n||"100%",defaultLanguage:Re,defaultValue:m||`indicator("我的脚本")
|
144
|
+
*/const tl=Symbol("Comlink.proxy"),km=Symbol("Comlink.endpoint"),Dm=Symbol("Comlink.releaseProxy"),Bn=Symbol("Comlink.finalizer"),wa=Symbol("Comlink.thrown"),sl=a=>typeof a=="object"&&a!==null||typeof a=="function",Im={canHandle:a=>sl(a)&&a[tl],serialize(a){const{port1:s,port2:r}=new MessageChannel;return al(a,s),[r,[r]]},deserialize(a){return a.start(),Un(a)}},Am={canHandle:a=>sl(a)&&wa in a,serialize({value:a}){let s;return a instanceof Error?s={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:s={isError:!1,value:a},[s,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},rl=new Map([["proxy",Im],["throw",Am]]);function qm(a,s){for(const r of a)if(s===r||r==="*"||r instanceof RegExp&&r.test(s))return!0;return!1}function al(a,s=globalThis,r=["*"]){s.addEventListener("message",function n(o){if(!o||!o.data)return;if(!qm(r,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:l,type:c,path:d}=Object.assign({path:[]},o.data),m=(o.data.argumentList||[]).map(As);let _;try{const g=d.slice(0,-1).reduce((h,D)=>h[D],a),x=d.reduce((h,D)=>h[D],a);switch(c){case"GET":_=x;break;case"SET":g[d.slice(-1)[0]]=As(o.data.value),_=!0;break;case"APPLY":_=x.apply(g,m);break;case"CONSTRUCT":{const h=new x(...m);_=Kn(h)}break;case"ENDPOINT":{const{port1:h,port2:D}=new MessageChannel;al(a,D),_=Em(h,[h])}break;case"RELEASE":_=void 0;break;default:return}}catch(g){_={value:g,[wa]:0}}Promise.resolve(_).catch(g=>({value:g,[wa]:0})).then(g=>{const[x,h]=Da(g);s.postMessage(Object.assign(Object.assign({},x),{id:l}),h),c==="RELEASE"&&(s.removeEventListener("message",n),nl(s),Bn in a&&typeof a[Bn]=="function"&&a[Bn]())}).catch(g=>{const[x,h]=Da({value:new TypeError("Unserializable return value"),[wa]:0});s.postMessage(Object.assign(Object.assign({},x),{id:l}),h)})}),s.start&&s.start()}function Cm(a){return a.constructor.name==="MessagePort"}function nl(a){Cm(a)&&a.close()}function Un(a,s){return $n(a,[],s)}function va(a){if(a)throw new Error("Proxy has been released and is not useable")}function il(a){return Hs(a,{type:"RELEASE"}).then(()=>{nl(a)})}const Ta=new WeakMap,ka="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const s=(Ta.get(a)||0)-1;Ta.set(a,s),s===0&&il(a)});function Sm(a,s){const r=(Ta.get(s)||0)+1;Ta.set(s,r),ka&&ka.register(a,s,a)}function zm(a){ka&&ka.unregister(a)}function $n(a,s=[],r=function(){}){let n=!1;const o=new Proxy(r,{get(l,c){if(va(n),c===Dm)return()=>{zm(o),il(a),n=!0};if(c==="then"){if(s.length===0)return{then:()=>o};const d=Hs(a,{type:"GET",path:s.map(m=>m.toString())}).then(As);return d.then.bind(d)}return $n(a,[...s,c])},set(l,c,d){va(n);const[m,_]=Da(d);return Hs(a,{type:"SET",path:[...s,c].map(g=>g.toString()),value:m},_).then(As)},apply(l,c,d){va(n);const m=s[s.length-1];if(m===km)return Hs(a,{type:"ENDPOINT"}).then(As);if(m==="bind")return $n(a,s.slice(0,-1));const[_,g]=ol(d);return Hs(a,{type:"APPLY",path:s.map(x=>x.toString()),argumentList:_},g).then(As)},construct(l,c){va(n);const[d,m]=ol(c);return Hs(a,{type:"CONSTRUCT",path:s.map(_=>_.toString()),argumentList:d},m).then(As)}});return Sm(o,a),o}function Nm(a){return Array.prototype.concat.apply([],a)}function ol(a){const s=a.map(Da);return[s.map(r=>r[0]),Nm(s.map(r=>r[1]))]}const ll=new WeakMap;function Em(a,s){return ll.set(a,s),a}function Kn(a){return Object.assign(a,{[tl]:!0})}function Da(a){for(const[s,r]of rl)if(r.canHandle(a)){const[n,o]=r.serialize(a);return[{type:"HANDLER",name:s,value:n},o]}return[{type:"RAW",value:a},ll.get(a)||[]]}function As(a){switch(a.type){case"HANDLER":return rl.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Hs(a,s,r){return new Promise(n=>{const o=Lm();a.addEventListener("message",function l(c){!c.data||!c.data.id||c.data.id!==o||(a.removeEventListener("message",l),n(c.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:o},s),r)})}function Lm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const cl=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CdZluQjS.js").href:new URL("assets/scriptsRunWorker-CdZluQjS.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:ra&&ra.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});cl.onerror=a=>{console.error(a)};async function pl(a){return await ba.setInlayHints(a)}const dl=Un(cl),ul=Un(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-C2b6T_uv.js").href:new URL("assets/parserTccWorker-C2b6T_uv.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:ra&&ra.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function ml(a,s=!1){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await ul.parseTcc(a,s,Kn(pl),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Mm(a,s){const{functions:r,types:n,constants:o,variables:l,methods:c}=nt;return await ul.parseLibraryCode(a,s,Kn(pl),{functions:Object.fromEntries(r),methods:Object.fromEntries(c),types:Object.fromEntries(n),constants:Object.fromEntries(o),variables:Object.fromEntries(l)})}async function Om(a,s,r=!0){return await dl.runScript(a,s,r)}async function Pm(a){return await dl.removeScript(a)}function Rm(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})}const{slice:Fm,forEach:Bm}=[];function Um(a){return Bm.call(Fm.call(arguments,1),s=>{if(s)for(const r in s)a[r]===void 0&&(a[r]=s[r])}),a}const yl=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,$m=(a,s,r)=>{const n=r||{};n.path=n.path||"/";const o=encodeURIComponent(s);let l=`${a}=${o}`;if(n.maxAge>0){const c=n.maxAge-0;if(Number.isNaN(c))throw new Error("maxAge should be a Number");l+=`; Max-Age=${Math.floor(c)}`}if(n.domain){if(!yl.test(n.domain))throw new TypeError("option domain is invalid");l+=`; Domain=${n.domain}`}if(n.path){if(!yl.test(n.path))throw new TypeError("option path is invalid");l+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");l+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(l+="; HttpOnly"),n.secure&&(l+="; Secure"),n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"strict":l+="; SameSite=Strict";break;case"none":l+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return l},_l={create(a,s,r,n){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),n&&(o.domain=n),document.cookie=$m(a,encodeURIComponent(s),o)},read(a){const s=`${a}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let o=r[n];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(s)===0)return o.substring(s.length,o.length)}return null},remove(a){this.create(a,"",-1)}};var Km={name:"cookie",lookup(a){let{lookupCookie:s}=a;if(s&&typeof document<"u")return _l.read(s)||void 0},cacheUserLanguage(a,s){let{lookupCookie:r,cookieMinutes:n,cookieDomain:o,cookieOptions:l}=s;r&&typeof document<"u"&&_l.create(r,a,n,o,l)}},jm={name:"querystring",lookup(a){var n;let{lookupQuerystring:s}=a,r;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((n=window.location.hash)==null?void 0:n.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const c=o.substring(1).split("&");for(let d=0;d<c.length;d++){const m=c[d].indexOf("=");m>0&&c[d].substring(0,m)===s&&(r=c[d].substring(m+1))}}return r}};let Cr=null;const fl=()=>{if(Cr!==null)return Cr;try{Cr=window!=="undefined"&&window.localStorage!==null;const a="i18next.translate.boo";window.localStorage.setItem(a,"foo"),window.localStorage.removeItem(a)}catch{Cr=!1}return Cr};var Hm={name:"localStorage",lookup(a){let{lookupLocalStorage:s}=a;if(s&&fl())return window.localStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupLocalStorage:r}=s;r&&fl()&&window.localStorage.setItem(r,a)}};let Sr=null;const gl=()=>{if(Sr!==null)return Sr;try{Sr=window!=="undefined"&&window.sessionStorage!==null;const a="i18next.translate.boo";window.sessionStorage.setItem(a,"foo"),window.sessionStorage.removeItem(a)}catch{Sr=!1}return Sr};var Wm={name:"sessionStorage",lookup(a){let{lookupSessionStorage:s}=a;if(s&&gl())return window.sessionStorage.getItem(s)||void 0},cacheUserLanguage(a,s){let{lookupSessionStorage:r}=s;r&&gl()&&window.sessionStorage.setItem(r,a)}},Vm={name:"navigator",lookup(a){const s=[];if(typeof navigator<"u"){const{languages:r,userLanguage:n,language:o}=navigator;if(r)for(let l=0;l<r.length;l++)s.push(r[l]);n&&s.push(n),o&&s.push(o)}return s.length>0?s:void 0}},Gm={name:"htmlTag",lookup(a){let{htmlTag:s}=a,r;const n=s||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(r=n.getAttribute("lang")),r}},Xm={name:"path",lookup(a){var o;let{lookupFromPathIndex:s}=a;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?(o=r[typeof s=="number"?s:0])==null?void 0:o.replace("/",""):void 0}},Ym={name:"subdomain",lookup(a){var o,l;let{lookupFromSubdomainIndex:s}=a;const r=typeof s=="number"?s+1:1,n=typeof window<"u"&&((l=(o=window.location)==null?void 0:o.hostname)==null?void 0:l.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(n)return n[r]}};function Qm(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:a=>a}}class bl{constructor(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(s,r)}init(s){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=s||{languageUtils:{}},this.options=Um(r,this.options||{},Qm()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Km),this.addDetector(jm),this.addDetector(Hm),this.addDetector(Wm),this.addDetector(Vm),this.addDetector(Gm),this.addDetector(Xm),this.addDetector(Ym)}addDetector(s){return this.detectors[s.name]=s,this}detect(s){s||(s=this.options.order);let r=[];return s.forEach(n=>{if(this.detectors[n]){let o=this.detectors[n].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(r=r.concat(o))}}),r=r.map(n=>this.options.convertDetectedLanguage(n)),this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(s,r){r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(s)>-1||r.forEach(n=>{this.detectors[n]&&this.detectors[n].cacheUserLanguage(s,this.options)}))}}bl.type="languageDetector";const Zm=(...a)=>{console!=null&&console.warn&&(qs(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),console.warn(...a))},xl={},jn=(...a)=>{qs(a[0])&&xl[a[0]]||(qs(a[0])&&(xl[a[0]]=new Date),Zm(...a))},hl=(a,s)=>()=>{if(a.isInitialized)s();else{const r=()=>{setTimeout(()=>{a.off("initialized",r)},0),s()};a.on("initialized",r)}},Hn=(a,s,r)=>{a.loadNamespaces(s,hl(a,r))},wl=(a,s,r,n)=>{if(qs(r)&&(r=[r]),a.options.preload&&a.options.preload.indexOf(s)>-1)return Hn(a,r,n);r.forEach(o=>{a.options.ns.indexOf(o)<0&&a.options.ns.push(o)}),a.loadLanguages(s,hl(a,n))},Jm=(a,s,r={})=>!s.languages||!s.languages.length?(jn("i18n.languages were undefined or empty",s.languages),!0):s.hasLoadedNamespace(a,{lng:r.lng,precheck:(n,o)=>{var l;if(((l=r.bindI18n)==null?void 0:l.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,a))return!1}}),qs=a=>typeof a=="string",ey=a=>typeof a=="object"&&a!==null,ty=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,sy={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ry=a=>sy[a];let Wn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:a=>a.replace(ty,ry)};const ay=(a={})=>{Wn={...Wn,...a}},ny=()=>Wn;let vl;const iy=a=>{vl=a},oy=()=>vl,ly={type:"3rdParty",init(a){ay(a.options.react),iy(a)}},cy=S.createContext();class py{constructor(){this.usedNamespaces={}}addUsedNamespaces(s){s.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const dy=(a,s)=>{const r=S.useRef();return S.useEffect(()=>{r.current=s?r.current:a},[a,s]),r.current},Tl=(a,s,r,n)=>a.getFixedT(s,r,n),uy=(a,s,r,n)=>S.useCallback(Tl(a,s,r,n),[a,s,r,n]),Ws=(a,s={})=>{var V,Q,q,C;const{i18n:r}=s,{i18n:n,defaultNS:o}=S.useContext(cy)||{},l=r||n||oy();if(l&&!l.reportNamespaces&&(l.reportNamespaces=new py),!l){jn("You will need to pass in an i18next instance by using initReactI18next");const R=(A,O)=>qs(O)?O:ey(O)&&qs(O.defaultValue)?O.defaultValue:Array.isArray(A)?A[A.length-1]:A,E=[R,{},!1];return E.t=R,E.i18n={},E.ready=!1,E}(V=l.options.react)!=null&&V.wait&&jn("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const c={...ny(),...l.options.react,...s},{useSuspense:d,keyPrefix:m}=c;let _=a||o||((Q=l.options)==null?void 0:Q.defaultNS);_=qs(_)?[_]:_||["translation"],(C=(q=l.reportNamespaces).addUsedNamespaces)==null||C.call(q,_);const g=(l.isInitialized||l.initializedStoreOnce)&&_.every(R=>Jm(R,l,c)),x=uy(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),h=()=>x,D=()=>Tl(l,s.lng||null,c.nsMode==="fallback"?_:_[0],m),[z,P]=S.useState(h);let $=_.join();s.lng&&($=`${s.lng}${$}`);const j=dy($),W=S.useRef(!0);S.useEffect(()=>{const{bindI18n:R,bindI18nStore:E}=c;W.current=!0,!g&&!d&&(s.lng?wl(l,s.lng,_,()=>{W.current&&P(D)}):Hn(l,_,()=>{W.current&&P(D)})),g&&j&&j!==$&&W.current&&P(D);const A=()=>{W.current&&P(D)};return R&&(l==null||l.on(R,A)),E&&(l==null||l.store.on(E,A)),()=>{W.current=!1,l&&(R==null||R.split(" ").forEach(O=>l.off(O,A))),E&&l&&E.split(" ").forEach(O=>l.store.off(O,A))}},[l,$]),S.useEffect(()=>{W.current&&g&&P(h)},[l,m,g]);const re=[z,l,g];if(re.t=z,re.i18n=l,re.ready=g,g||!g&&!d)return re;throw new Promise(R=>{s.lng?wl(l,s.lng,_,()=>R()):Hn(l,_,()=>R())})},my={type:"type",syntax:"syntax",overloads:"overloads",arguments:"arguments",fields:"fields",example:"example",returns:"returns",remarks:"remarks","see also":"see also","Copy code":"Copy code","Copy link":"Copy link",Copied:"Copied","Link copied":"Link copied",variables:"Variables",constants:"Constants",functions:"Functions",keywords:"Keywords",types:"Types",operators:"Operators",annotations:"Annotations",search:"Search","Mine Script® v1 Reference Manual":"Mine Script® v1 Reference Manual","This script is read-only. It cannot be edited.":"This script is read-only. It cannot be edited.","save script":"Save script","open script":"Open script","find/replace":"Find/Replace","toggle console":"Toggle console","open editor in new tab":"Open editor in new tab","open editor in new window":"Open editor in new window",keyword:"keyword","built-in function":"built-in function","built-in variable":"built-in variable","built-in method":"built-in method","built-in type":"built-in type",annotation:"annotation","built-in constant":"built-in constant",namespace:"namespace","user-defined variable":"user-defined variable","user-defined type":"user-defined type",field:"field",enum:"enum","user-defined method":"user-defined method","user-defined function":"user-defined function",parameter:"parameter","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Mine functions, variables, and methods.","to trigger parameters hint":"to trigger parameters hint",library:"library","enum member":"enum member",Returns:"Returns",Syntax:"Syntax",Remarks:"Remarks",Fields:"Fields",Description:"Description",Example:"Example","Enum members":"Enum members",statement:"statement",loop:"loop","`click` on keyword for more help":"`click` on keyword for more help"},yy={type:"类型",syntax:"语法",overloads:"重载",arguments:"参数",fields:"字段",example:"例子",returns:"返回值",remarks:"备注","see also":"另见","Copy code":"复制代码","Copy link":"复制链接",Copied:"已复制","Link copied":"链接已复制",variables:"内置变量",constants:"常量",functions:"函数",keywords:"关键词",types:"类型",operators:"运算符",annotations:"注释",search:"搜索","Mine Script® v1 Reference Manual":"Mine Script™ v1参考手册","This script is read-only. It cannot be edited.":"该脚本是只读的。它无法被编辑。","save script":"保存脚本","open script":"打开脚本","find/replace":"寻找/替换","toggle console":"切换控制台","open editor in new tab":"在新标签页中打开","open editor in new window":"在新窗口中打开",keyword:"关键词","built-in function":"内置函数","built-in variable":"内置变量","built-in method":"内置方法","built-in type":"内置类型",annotation:"注释","built-in constant":"内置常量",namespace:"命名空间","user-defined variable":"用户自定义变量","user-defined type":"用户自定义类型",field:"字段",enum:"枚举","user-defined method":"用户自定义方法","user-defined function":"用户自定义函数",parameter:"参数","**Namespaces** are immutable terms that act as prefixes for groups of identifiers. A dot and another term always follow a namespace when naming Tcc functions, variables, and methods.":"命名空间是不可变的术语,充当标识符组的前缀。在命名Mine函数、变量和方法时,点和另一个术语始终遵循命名空间。","to trigger parameters hint":"触发参数提示",library:"脚本库","enum member":"枚举成员",Returns:"返回值",Syntax:"语法",Remarks:"备注",Fields:"字段",Description:"描述",Example:"例子","Enum members":"枚举成员",statement:"声明",loop:"循环","`click` on keyword for more help":"“点击”关键词以获得更多帮助"};Me.use(bl).use(ly).init({debug:!1,fallbackLng:"zh",interpolation:{escapeValue:!1},resources:{en:{translation:my},zh:{translation:yy}}}),self.MonacoEnvironment={getWorker(){return new Rm({name:"Editor Worker"})}},Cn.config({paths:{vs:"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs"},"vs/nls":{availableLanguages:{"*":"zh-cn"}}});const _y=(a,s)=>{const{height:r,width:n,theme:o,options:l,hasDiff:c,readOnly:d,defaultValue:m,language:_,onChange:g,onLinkOpen:x,onCursorPositionChange:h,onActionTrigger:D,onEditorDidMount:z}=a,{t:P,i18n:$}=Ws(),j=S.useRef(null),W=S.useRef(null),re=S.useRef(!1),V=S.useRef(!1);S.useImperativeHandle(s,()=>({setOriginalScript(A){var O;(O=j.current)==null||O.setOriginalScript(A)},setScript(A){var O;(O=j.current)==null||O.setValue(A)},gotoLine(){var A;(A=j.current)==null||A.gotoLine()},getEditorLayout(){var A;return(A=j.current)==null?void 0:A.getEditorLayout()},setPosition(A,O){var J;(J=j.current)==null||J.setPosition({column:A,lineNumber:O})},setModelMarkers(A){var O;V.current=!0,(O=j.current)==null||O.setModelMarkers(A),setTimeout(()=>{V.current=!1},2e3)},focus(){var A;(A=j.current)==null||A.focus()}})),S.useEffect(()=>{var A,O;c?(O=j.current)==null||O.addDiffDecorations():(A=j.current)==null||A.removeDiffDecorations()},[c]),S.useEffect(()=>{o&&Ae.editor.setTheme(o)},[o]),S.useEffect(()=>{_&&$.changeLanguage(_)},[_]),S.useEffect(()=>{var A;(A=j.current)==null||A.updateActionTrigger(D)},[D]),S.useEffect(()=>{var A;x&&((A=j.current)==null||A.addLinkOpenFunc(x))},[x]);function Q(A,O){var se,le;Pt.initBuiltinsTrees(),ba.setEditor(A),j.current=new Tm(A,O,D),x&&((se=j.current)==null||se.addLinkOpenFunc(x)),c&&((le=j.current)==null||le.addDiffDecorations()),Vu(A),requestAnimationFrame(E);const J=A.getValue();j.current.onChangeCursorPosition(h),g&&g(J),!d&&q(J),z&&z()}const q=S.useCallback(async A=>{var Rt;re.current=!1;const{errors:O,functions:J,methods:se,types:le,variables:Y,overloadsFuncs:oe,imports:xe,enums:pe}=await ml(A),_e=new Map(Object.entries(J)),Ee=new Map(Object.entries(se)),ee=new Map(Object.entries(le)),de=new Map(Object.entries(Y)),Oe=new Map(Object.entries(xe)),Ge=new Map(Object.entries(pe));Ds.setUserDefined({functions:_e,methods:Ee,types:ee,variables:de,imports:Oe,enums:Ge},oe),Pt.setUserDefind(_e,ee,de,Ee,Ge);const Qe=O.map(us=>({...us,severity:us.type||Ae.MarkerSeverity.Error}));d||!re.current&&!V.current&&Qe.length&&((Rt=j.current)==null||Rt.setModelMarkers(Qe))},[d]),C=S.useMemo(()=>Yu.debounce(q,1500),[q]);function R(A){var O;if(d){q(A||"");return}re.current=!0,ba.clearInlayHints(),(O=j.current)==null||O.setModelMarkers([]),A!==void 0&&(g&&g(A),C(A))}const E=S.useCallback(()=>{var O,J;const A=(O=W.current)==null?void 0:O.getBoundingClientRect();(J=j.current)==null||J.setEditorLayout((A==null?void 0:A.height)||0,A==null?void 0:A.width)},[]);return S.useEffect(()=>{const A=()=>{window.requestAnimationFrame(E)},O=new ResizeObserver(A);return W.current&&O.observe(W.current),()=>{var J;W.current&&O.unobserve(W.current),O.disconnect(),(J=j.current)==null||J.dispose()}},[]),T.jsx("div",{ref:W,children:T.jsx(uu,{height:r,width:n||"100%",defaultLanguage:Re,defaultValue:m||`indicator("我的脚本")
|
145
145
|
plot(close)
|
146
146
|
`,theme:o||"vs-dark",className:`tvue-script ${o||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,automaticLayout:!1,unicodeHighlight:{allowedCharacters:{" ":!0}},suggest:{filterGraceful:!0},fontSize:13,...d?rm:{},readOnlyMessage:{value:P("This script is read-only. It cannot be edited.")},...l},onMount:Q,onChange:R})})},fy=S.forwardRef(_y),gy=a=>{const{theme:s,modified:r,original:n,height:o,width:l,renderSideBySide:c=!0}=a,d=S.useCallback((m,_)=>{_.languages.register({id:Re}),_.editor.defineTheme("vs-dark",ga),_.editor.defineTheme("vs",fa),_.languages.setMonarchTokensProvider(Re,Is),_.languages.setLanguageConfiguration(Re,_a)},[]);return T.jsx(ou,{height:o||"90vh",width:l||"100%",theme:s||"vs-dark",options:{readOnly:!0,renderSideBySide:c,scrollBeyondLastLine:!1},language:Re,modified:r,original:n,onMount:d})};L.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"}(L.VMarkerSeverity||(L.VMarkerSeverity={}));var Ia={},by=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var s=document.activeElement,r=[],n=0;n<a.rangeCount;n++)r.push(a.getRangeAt(n));switch(s.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":s.blur();break;default:s=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||r.forEach(function(o){a.addRange(o)}),s&&s.focus()}},xy=by,kl={"text/plain":"Text","text/html":"Url",default:"Text"},hy="Copy to clipboard: #{key}, Enter";function wy(a){var s=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,s)}function vy(a,s){var r,n,o,l,c,d,m=!1;s||(s={}),r=s.debug||!1;try{o=xy(),l=document.createRange(),c=document.getSelection(),d=document.createElement("span"),d.textContent=a,d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top=0,d.style.clip="rect(0, 0, 0, 0)",d.style.whiteSpace="pre",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.style.userSelect="text",d.addEventListener("copy",function(g){if(g.stopPropagation(),s.format)if(g.preventDefault(),typeof g.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var x=kl[s.format]||kl.default;window.clipboardData.setData(x,a)}else g.clipboardData.clearData(),g.clipboardData.setData(s.format,a);s.onCopy&&(g.preventDefault(),s.onCopy(g.clipboardData))}),document.body.appendChild(d),l.selectNodeContents(d),c.addRange(l);var _=document.execCommand("copy");if(!_)throw new Error("copy command was unsuccessful");m=!0}catch(g){r&&console.error("unable to copy using execCommand: ",g),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(s.format||"text",a),s.onCopy&&s.onCopy(window.clipboardData),m=!0}catch(x){r&&console.error("unable to copy using clipboardData: ",x),r&&console.error("falling back to prompt"),n=wy("message"in s?s.message:hy),window.prompt(n,a)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(l):c.removeAllRanges()),d&&document.body.removeChild(d),o()}return m}var Ty=vy;function Vn(a){"@babel/helpers - typeof";return Vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Vn(a)}Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.CopyToClipboard=void 0;var Aa=Dl(S),ky=Dl(Ty),Dy=["text","onCopy","options","children"];function Dl(a){return a&&a.__esModule?a:{default:a}}function Il(a,s){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);s&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),r.push.apply(r,n)}return r}function Al(a){for(var s=1;s<arguments.length;s++){var r=arguments[s]!=null?arguments[s]:{};s%2?Il(Object(r),!0).forEach(function(n){Xn(a,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):Il(Object(r)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(r,n))})}return a}function Iy(a,s){if(a==null)return{};var r=Ay(a,s),n,o;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(o=0;o<l.length;o++)n=l[o],!(s.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(a,n)&&(r[n]=a[n])}return r}function Ay(a,s){if(a==null)return{};var r={},n=Object.keys(a),o,l;for(l=0;l<n.length;l++)o=n[l],!(s.indexOf(o)>=0)&&(r[o]=a[o]);return r}function qy(a,s){if(!(a instanceof s))throw new TypeError("Cannot call a class as a function")}function ql(a,s){for(var r=0;r<s.length;r++){var n=s[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function Cy(a,s,r){return s&&ql(a.prototype,s),r&&ql(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}function Sy(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(s&&s.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),s&&Gn(a,s)}function Gn(a,s){return Gn=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Gn(a,s)}function zy(a){var s=Ey();return function(){var n=qa(a),o;if(s){var l=qa(this).constructor;o=Reflect.construct(n,arguments,l)}else o=n.apply(this,arguments);return Ny(this,o)}}function Ny(a,s){if(s&&(Vn(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cl(a)}function Cl(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Ey(){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 qa(a){return qa=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},qa(a)}function Xn(a,s,r){return s in a?Object.defineProperty(a,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[s]=r,a}var Sl=function(a){Sy(r,a);var s=zy(r);function r(){var n;qy(this,r);for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];return n=s.call.apply(s,[this].concat(l)),Xn(Cl(n),"onClick",function(d){var m=n.props,_=m.text,g=m.onCopy,x=m.children,h=m.options,D=Aa.default.Children.only(x),z=(0,ky.default)(_,h);g&&g(_,z),D&&D.props&&typeof D.props.onClick=="function"&&D.props.onClick(d)}),n}return Cy(r,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var l=o.children,c=Iy(o,Dy),d=Aa.default.Children.only(l);return Aa.default.cloneElement(d,Al(Al({},c),{},{onClick:this.onClick}))}}]),r}(Aa.default.PureComponent);Ia.CopyToClipboard=Sl,Xn(Sl,"defaultProps",{onCopy:void 0,options:void 0});var Ly=Ia,Yn=Ly.CopyToClipboard;Yn.CopyToClipboard=Yn;var My=Yn;const Vs=ad(My);async function Qn(a,s=0){const r=a[s];if(!r)return;const{name:n,args:o,type:l,desc:c,examples:d,remarks:m,seeAlso:_,syntax:g,detailedDesc:x,fields:h,returns:D}=r,z={name:n,orirginalName:n};if(a.length>1&&(z.overloads=`${a.length} ${Me.t("overloads")}`),l&&(z.type=l),o&&(z.name=`${n}()`,z.args=o.map(P=>{const{name:$,desc:j,displayType:W}=P;return{label:`${$} (${W})`,desc:j&&Cs(j)}})),c&&(z.desc=c.map(P=>Cs(P))),d&&(z.originalExample=d.join(`
|
147
147
|
`),z.examples=await Ae.editor.colorize(z.originalExample,Re,{tabSize:4})),x){z.detailedDesc=[];for(const P of x){const{desc:$,examples:j}=P;let W=$.map(Q=>Cs(Q)),re,V;j&&(V=j.join(`
|
148
148
|
`),re=await Ae.editor.colorize(V,Re,{tabSize:4})),z.detailedDesc.push({desc:W,examples:re,originalExample:V})}}return D&&(z.returns=D.map(P=>Cs(P))),m&&(z.remarks=typeof m=="string"?[Cs(m)]:m.map(P=>Cs(P))),g&&(z.syntax=a.map(P=>{var $;return($=P.syntax)==null?void 0:$[0]})),h&&(z.fields=h.map(P=>{const{name:$,desc:j,type:W}=P;return{label:`${$} (${W})`,desc:j&&Cs(j)}})),_&&(z.seeAlso=_.map(P=>Oy(P))),z}function Oy(a){const r=/\[([^\[\]]+)\]\(([^\(\)]+)\)/g.exec(a);if(r){const[n,o,l]=r;return{name:o,link:l}}}function Cs(a){const s=/\*\*([^\*]+)\*\*/g,r=/\`([^\`]+)\`/g,n=/\[([^\[\]]+)\]\(([^\(\)]+)\)/g;return a.replace(s,(o,l)=>`<strong>${l}</strong>`).replace(r,(o,l)=>`<code>${l}</code>`).replace(n,(o,l,c)=>`<a ${c.startsWith("#")?`data-name="${l}"`:'target="_blank"'} class="manual-content-text-link" href="${c}">${l}</a>`)}function zl(a){var o;const s=[];let r=0;const n=[];for(const l of it)for(let[c,d]of ks[l.key].entries()){let m=d;l.prefix==="fun"&&(m=`${d}()`),m.includes(a)&&(m.startsWith(a)?(m.includes(".")?s.splice(r,0,{label:m,index:c,group:l,key:`${l.prefix}_${d}`}):s.unshift({label:m,index:c,group:l,key:`${l.prefix}_${d}`}),r++):s.push({label:m,index:c,group:l,key:`${l.prefix}_${d}`}));const _=nt[l.key].get(d)||[];for(const g of _){const{name:x,args:h,type:D,desc:z,examples:P,remarks:$,seeAlso:j,syntax:W,detailedDesc:re,fields:V,returns:Q}=g,q={label:x,index:c,group:l,key:`${l.prefix}_${x}`};if(l.prefix==="fun"&&(q.label=`${x}()`),q.label.includes(a))break;if(h){let C=!1;for(const R of h){const{name:E,desc:A,displayType:O}=R;if(E.includes(a)||A!=null&&A.includes(a)||O!=null&&O.includes(a)){n.push(q),C=!0;break}}if(C)break}if(D&&D.includes(a)){n.push(q);break}if(z){let C=!1;for(const R of z)if(R.includes(a)){n.push(q),C=!0;break}if(C)break}if(P){let C=!1;for(const R of P)if(R.includes(a)){n.push(q),C=!0;break}if(C)break}if($&&(typeof $=="string"?$:$.join(`
|
149
149
|
`)).includes(a)){n.push(q);break}if(W){let C=!1;for(const R of W)if(R.includes(a)){n.push(q),C=!0;break}if(C)break}if(re){let C=!1;for(const R of re){const{desc:E,examples:A}=R;if(E.join(`
|
150
150
|
`).includes(a)){n.push(q),C=!0;break}if((o=A==null?void 0:A.join(`
|
151
|
-
`))!=null&&o.includes(a)){n.push(q),C=!0;break}}if(C)break}if(V){let C=!1;for(const R of V){const{name:E,desc:A,type:O}=R;if(E.includes(a)||A!=null&&A.includes(a)||O!=null&&O.includes(a)){n.push(q),C=!0;break}}if(C)break}if(Q){let C=!1;for(const R of Q)if(R.includes(a)){n.push(q),C=!0;break}if(C)break}}}return{labelList:s,contentList:n}}const Py=a=>{var Q;const{group:s,itemKey:r,onItemClick:n,currentIndex:o}=a,{t:l}=Ws(),[c,d]=S.useState(),[m,_]=S.useState(""),[g,x]=S.useState(0),[h,D]=S.useState(l("Copy code")),[z,P]=S.useState(l("Copy link"));S.useEffect(()=>{$(o)},[r]);const $=q=>{const C=r.replace(`${s==null?void 0:s.prefix}_`,""),R=nt[s==null?void 0:s.key].get(C);x(q),R&&Qn(R,q).then(E=>{d(E),_(`${window.location.origin}/reference-manual/#${s==null?void 0:s.key}_${E==null?void 0:E.orirginalName}`)})},j=q=>{$(q)},W=q=>{var C,R;if(q.target.localName==="a"&&q.target.hash&&((R=(C=q.target)==null?void 0:C.dataset)!=null&&R.name)){q.preventDefault();const{hash:E}=q.target;n(E.replace("#",""))}},re=()=>{D(l("Copied")),setTimeout(()=>{D(l("Copy code"))},1e3)},V=()=>{P(l("Link copied")),setTimeout(()=>{P(l("Copy link"))},3e3)};return T.jsx("div",{onClick:W,id:`#${r}`,children:T.jsxs("div",{className:"manual-content-wrapper",children:[T.jsxs("div",{className:"manual-content-header",children:[T.jsxs("div",{children:[T.jsx("h3",{className:"manual-content-header-title",children:c==null?void 0:c.name}),!!(c!=null&&c.overloads)&&T.jsx("span",{className:"manual-content-header-overloads",children:c==null?void 0:c.overloads})]}),T.jsx(Vs,{text:m,onCopy:V,children:T.jsx("div",{"data-tooltip":z,className:"manual-content-btn",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28",width:"28",height:"28",children:T.jsxs("g",{fill:"currentColor",children:[T.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"}),T.jsx("path",{d:"M10.485 16.141l5.656-5.656.707.707-5.656 5.656z"})]})})})})]}),(Q=c==null?void 0:c.desc)==null?void 0:Q.map((q,C)=>T.jsx("div",{dangerouslySetInnerHTML:{__html:q},className:"manual-content-text"},C)),(c==null?void 0:c.type)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("type")}),T.jsx("div",{className:"manual-content-text",children:c.type})]}),(c==null?void 0:c.syntax)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-content-sub-title",children:[l("syntax")," ",!!(c!=null&&c.overloads)&&`& ${l("overloads")}`]}),c.syntax.map((q,C)=>{var R;return(((R=c.syntax)==null?void 0:R.length)||0)>1?T.jsx("div",{onClick:()=>j(C),children:T.jsx("pre",{className:`manual-content-syntax with-overloads ${C===g?"selected":""}`,children:q})},C):T.jsx("pre",{className:"manual-content-syntax",children:q},C)})]}),(c==null?void 0:c.args)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("arguments")}),c.args.map((q,C)=>T.jsxs("div",{className:"manual-content-text",children:[T.jsx("span",{className:"manual-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.fields)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("fields")}),c.fields.map((q,C)=>T.jsxs("div",{className:"manual-content-text",children:[T.jsx("span",{className:"manual-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.examples)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:c.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-content-btn manual-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:c.examples}})})]}),(c==null?void 0:c.detailedDesc)&&c.detailedDesc.map((q,C)=>T.jsxs(S.Fragment,{children:[q.desc.map((R,E)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:R}},E)),T.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:q.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-content-btn manual-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:q.examples||""}})})]},C)),(c==null?void 0:c.returns)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("returns")}),c.returns.map((q,C)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.remarks)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("remarks")}),c.remarks.map((q,C)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.seeAlso)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("see also")}),T.jsx("div",{className:"manual-content-see_also",children:c.seeAlso.map((q,C)=>T.jsx("a",{className:"manual-content-see_also-tag","data-name":q==null?void 0:q.name,href:q==null?void 0:q.link,children:q==null?void 0:q.name},C))})]})]})})};Ae.languages.register({id:Re}),Ae.editor.defineTheme("vs-dark",ga),Ae.editor.defineTheme("vs",fa),Ae.languages.setMonarchTokensProvider(Re,Is),Ae.languages.setLanguageConfiguration(Re,_a);const Ry=({theme:a="vs-dark",language:s,currentValue:r})=>{const{t:n,i18n:o}=Ws(),[l,c]=S.useState(it[0]),[d,m]=S.useState(null),[_,g]=S.useState(0),[x,h]=S.useState(""),[D,z]=S.useState("var_bar_index"),P=S.useRef(null),$=S.useRef(null),j=S.useRef(null),W=R=>{var E;R.key===(l==null?void 0:l.key)&&!(l!=null&&l.isHidden)?c({...R,isHidden:!0}):c(R),(E=P.current)==null||E.focus()};S.useEffect(()=>{Ae.editor.setTheme(a)},[a]),S.useEffect(()=>{var R;if(r.value){const[E]=r.value.split("_"),A=it.find(O=>E===O.prefix);A&&(g(r.index||0),q(A,r.value)),(R=P.current)==null||R.focus()}},[r]),S.useEffect(()=>{s&&o.changeLanguage(s)},[s]),S.useEffect(()=>{var R;(R=P.current)==null||R.focus()},[P.current]);const re=(R,E)=>{var A,O;R!==D&&(E&&c(E),g(0),z(R),(A=j.current)==null||A.scrollTo({top:0}),(O=P.current)==null||O.focus())},V=R=>{if(R.target.value.trim()==="")Q();else{h(R.target.value);const E=zl(R.target.value);m(E)}},Q=()=>{var R;h(""),m(null),setTimeout(()=>{var E,A;(A=(E=$.current)==null?void 0:E.querySelector(`a[data-href="${D}"]`))==null||A.scrollIntoView(!0)},10),(R=P.current)==null||R.focus()},q=(R,E)=>{var A;c(R),z(E),setTimeout(()=>{var O,J;(J=(O=$.current)==null?void 0:O.querySelector(`a[data-href="${E}"]`))==null||J.scrollIntoView(!0)},10),(A=j.current)==null||A.scrollTo({top:0})},C=R=>{var A;const E=it.find(O=>R.startsWith(O.prefix));E&&(g(0),q(E,R),(A=P.current)==null||A.focus())};return T.jsxs("div",{className:`${a} manual-warpper`,children:[T.jsxs("div",{className:"manual-left",children:[T.jsxs("div",{className:"manual-search",children:[T.jsx("span",{className:"manual-search-icon",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:"18px",height:"18px",children:T.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"})})}),T.jsx("input",{onChange:V,ref:P,spellCheck:"false",value:x,className:"manual-search-input",autoComplete:"off",placeholder:n("search"),type:"text"}),T.jsx("span",{onClick:Q,className:`manual-search-clear ${x?"":"hide"}`,children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95.939 95.939",width:"9",height:"9",children:T.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"})})})]}),T.jsx("div",{className:`manual-group-search-list manual-scroll ${x?"":"hide"}`,children:T.jsxs("div",{children:[d==null?void 0:d.labelList.map(R=>T.jsx("a",{onClick:E=>{E.preventDefault(),re(R.key,R.group)},className:`manual-group-body-item ${R.key===D?"manual-group-body-item-selected":""}`,"data-href":R.key,href:`#${R.key}`,children:R.label},`search_${R.key}`)),T.jsx("div",{className:"manual-content-separator"}),d==null?void 0:d.contentList.map(R=>T.jsx("a",{onClick:E=>{E.preventDefault(),re(R.key,R.group)},className:`manual-group-body-item ${R.key===D?"manual-group-body-item-selected":""}`,"data-href":R.key,href:`#${R.key}`,children:R.label},`search_${R.key}`))]})}),T.jsx("div",{className:`manual-group-list manual-scroll ${x?"hide":""}`,ref:$,children:it.map(R=>{var E,A;return T.jsxs(S.Fragment,{children:[T.jsx("div",{onClick:()=>W(R),className:`manual-group-title ${R.key===(l==null?void 0:l.key)&&!(l!=null&&l.isHidden)?"active":""}`,children:n(R.key)}),T.jsx("div",{className:`manual-group-body manual-scroll ${R.key!==(l==null?void 0:l.key)||l!=null&&l.isHidden?"hide":""}`,children:(A=(E=zn[R.key])==null?void 0:E.sort().filter(O=>!Lo.includes(O)))==null?void 0:A.map(O=>{const J=`${R.prefix}_${O}`;return T.jsx("a",{onClick:se=>{se.preventDefault(),re(J)},className:`manual-group-body-item ${J===D?"manual-group-body-item-selected":""}`,"data-href":J,href:`#${J}`,children:`${O}${R.prefix==="fun"?"()":""}`},J)})})]},R.key)})})]}),T.jsx("div",{ref:j,className:"manual-right manual-scroll",children:T.jsx(Py,{currentIndex:_,group:l,itemKey:D,onItemClick:C})})]})},Fy=a=>{var Q;const{onItemClick:s,item:r,prefix:n,value:o}=a,{t:l}=Ws(),[c,d]=S.useState(),[m,_]=S.useState(""),[g,x]=S.useState(0),[h,D]=S.useState(l("Copy code")),[z,P]=S.useState(l("Copy link"));S.useEffect(()=>{o&&(d(o),_(`${window.location.origin}/reference-manual/#${n}_${o==null?void 0:o.orirginalName}`))},[o]);const $=(q=0)=>{x(q),Qn(r,q).then(C=>{d(C),_(`${window.location.origin}/reference-manual/#${n}_${C==null?void 0:C.orirginalName}`)})},j=q=>{$(q)},W=q=>{var C,R;if(q.target.localName==="a"&&q.target.hash&&((R=(C=q.target)==null?void 0:C.dataset)!=null&&R.name)){q.preventDefault();const{hash:E}=q.target;s(E.replace("#",""))}},re=()=>{D(l("Copied")),setTimeout(()=>{D(l("Copy code"))},1e3)},V=()=>{P(l("Link copied")),setTimeout(()=>{P(l("Copy link"))},3e3)};return T.jsx("div",{onClick:W,id:`${n}_${c==null?void 0:c.orirginalName}`,children:T.jsxs("div",{className:"manual-page-content-wrapper",children:[T.jsxs("div",{className:"manual-page-content-header",children:[T.jsxs("div",{children:[T.jsx("h3",{className:"manual-page-content-header-title",children:c==null?void 0:c.name}),!!(c!=null&&c.overloads)&&T.jsx("span",{className:"manual-page-content-header-overloads",children:c==null?void 0:c.overloads})]}),T.jsx(Vs,{text:m,onCopy:V,children:T.jsx("div",{"data-tooltip":z,className:"manual-page-content-btn",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28",width:"28",height:"28",children:T.jsxs("g",{fill:"currentColor",children:[T.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"}),T.jsx("path",{d:"M10.485 16.141l5.656-5.656.707.707-5.656 5.656z"})]})})})})]}),(Q=c==null?void 0:c.desc)==null?void 0:Q.map((q,C)=>T.jsx("div",{dangerouslySetInnerHTML:{__html:q},className:"manual-page-content-text"},C)),(c==null?void 0:c.type)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("type")}),T.jsx("div",{className:"manual-page-content-text",children:c.type})]}),(c==null?void 0:c.syntax)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-page-content-sub-title",children:[l("syntax")," ",!!(c!=null&&c.overloads)&&`& ${l("overloads")}`]}),c.syntax.map((q,C)=>{var R;return(((R=c.syntax)==null?void 0:R.length)||0)>1?T.jsx("div",{onClick:()=>j(C),children:T.jsx("pre",{className:`manual-page-content-syntax with-overloads ${C===g?"selected":""}`,children:q})},C):T.jsx("pre",{className:"manual-page-content-syntax",children:q},C)})]}),(c==null?void 0:c.args)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("arguments")}),c.args.map((q,C)=>T.jsxs("div",{className:"manual-page-content-text",children:[T.jsx("span",{className:"manual-page-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.fields)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("fields")}),c.fields.map((q,C)=>T.jsxs("div",{className:"manual-page-content-text",children:[T.jsx("span",{className:"manual-page-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.examples)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-page-content-sub-title manual-page-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:c.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-page-content-btn manual-page-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-page-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:c.examples}})})]}),(c==null?void 0:c.detailedDesc)&&c.detailedDesc.map((q,C)=>T.jsxs(S.Fragment,{children:[q.desc.map((R,E)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:R}},E)),T.jsxs("div",{className:"manual-page-content-sub-title manual-page-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:q.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-page-content-btn manual-page-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-page-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:q.examples||""}})})]},C)),(c==null?void 0:c.returns)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("returns")}),c.returns.map((q,C)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.remarks)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("remarks")}),c.remarks.map((q,C)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.seeAlso)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("see also")}),T.jsx("div",{className:"manual-page-content-see_also",children:c.seeAlso.map((q,C)=>T.jsx("a",{className:"manual-page-content-see_also-tag","data-name":q==null?void 0:q.name,href:q==null?void 0:q.link,children:q==null?void 0:q.name},C))})]})]})})},By=({onItemClick:a,onGroupClick:s,selectedItemChange:r,selectItem:n,manualTabRef:o,searchRef:l})=>{const{t:c}=Ws(),[d,m]=S.useState(null),[_,g]=S.useState("");S.useEffect(()=>{var D;(D=l.current)==null||D.focus()},[l.current]);const x=D=>{if(D.target.value.trim()==="")h();else{g(D.target.value);const z=zl(D.target.value);m(z)}},h=()=>{var D;g(""),m(null),setTimeout(()=>{n.current&&r(n.current,!0)},10),(D=l.current)==null||D.focus()};return T.jsxs("div",{className:"manual-page-left",children:[T.jsxs("div",{className:"manual-page-search",children:[T.jsx("span",{className:"manual-page-search-icon",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:"18px",height:"18px",children:T.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"})})}),T.jsx("input",{onChange:x,ref:l,spellCheck:"false",value:_,className:"manual-page-search-input",autoComplete:"off",placeholder:c("search"),type:"text"}),T.jsx("span",{onClick:h,className:`manual-page-search-clear ${_?"":"hide"}`,children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95.939 95.939",width:"9",height:"9",children:T.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"})})})]}),T.jsxs("div",{ref:o,className:"manual-page-group-container",children:[T.jsx("div",{className:`manual-page-group-search-list manual-page-scroll ${_?"":"hide"}`,children:T.jsxs("div",{children:[d==null?void 0:d.labelList.map(D=>T.jsx("a",{onClick:z=>{z.preventDefault(),a(D.key,D.index,D.group)},className:"manual-page-group-body-item","data-href":D.key,href:`#${D.key}`,children:D.label},`search_${D.key}`)),T.jsx("div",{className:"manual-page-content-separator"}),d==null?void 0:d.contentList.map(D=>T.jsx("a",{onClick:z=>{z.preventDefault(),a(D.key,D.index,D.group)},className:"manual-page-group-body-item","data-href":D.key,href:`#${D.key}`,children:D.label},`search_${D.key}`))]})}),T.jsx("div",{className:`manual-page-group-list manual-page-scroll ${_?"hide":""}`,children:it.map(D=>{var z;return T.jsxs(S.Fragment,{children:[T.jsx("div",{onClick:()=>s(D),className:"manual-page-group-title manual-page-group-t",children:c(D.key)}),T.jsx("div",{className:"manual-page-group-body manual-page-group-b manual-page-scroll hide",children:(z=ks[D.key])==null?void 0:z.map((P,$)=>{const j=`${D.prefix}_${P}`;return T.jsx("a",{onClick:W=>{W.preventDefault(),a(j,$)},className:"manual-page-group-body-item","data-href":j,href:`#${j}`,children:`${P}${D.prefix==="fun"?"()":""}`},j)})})]},D.key)})})]})]})};Ae.languages.register({id:Re}),Ae.editor.defineTheme("vs-dark",ga),Ae.editor.defineTheme("vs",fa),Ae.languages.setMonarchTokensProvider(Re,Is),Ae.languages.setLanguageConfiguration(Re,_a);const Uy=({theme:a="vs-dark",language:s})=>{const{t:r,i18n:n}=Ws(),[o,l]=S.useState(),c=S.useRef(""),d=S.useRef(null),m=S.useRef(null),_=S.useRef(null),g=S.useRef(null),x=S.useRef(null),h=S.useRef(null),D=S.useRef(0),z=S.useRef({startTop:0,endTop:0,key:"var_bar_index",group:it[0],index:0}),P=E=>{var A;C(E),(A=d.current)==null||A.focus()};S.useEffect(()=>{var E;x.current||($(),D.current=((E=_.current)==null?void 0:E.offsetTop)||0)},[]);const $=async()=>{const E={};for(const A of it){const O=A.key,J=new Map;for(const se of ks[O]){const le=await Qn(nt[O].get(se)||[],0);le&&J.set(se,le)}E[O]=J}l(E)};S.useEffect(()=>{if(!x.current&&o){const E=window.location.hash;if(E){const A=E.replace(/^#/,""),[O]=A.split("_"),J=it.find(se=>se.prefix===O);if(J){C(J),V(A,!0),setTimeout(()=>{const se=document.getElementById(A);se==null||se.scrollIntoView(),se==null||se.classList.add("reference-item-selected")},10);return}}C(it[0]),setTimeout(()=>{R(it[0],"bar_index",0,92)},10)}},[o]),S.useEffect(()=>{Ae.editor.setTheme(a)},[a]),S.useEffect(()=>{s&&n.changeLanguage(s)},[s]),S.useEffect(()=>{var E;(E=d.current)==null||E.focus()},[d.current]);const j=(E,A,O)=>{var le,Y,oe,xe;if(E===c.current)return;O&&O.key!==((le=x.current)==null?void 0:le.key)&&C(O),V(E),window.location.href=`#${E}`;const[J,se]=W(E,A);z.current={startTop:J,endTop:se,group:O||x.current,index:A,key:E},(oe=(Y=g.current)==null?void 0:Y.classList)==null||oe.remove("manual-page-current-item-bg"),(xe=d.current)==null||xe.focus()},W=(E,A=0)=>{const O=document.getElementById(E),J=(O==null?void 0:O.offsetHeight)||0,se=A?0:78,le=((O==null?void 0:O.offsetTop)||0)-72-D.current;return[le-se,le+J]},re=(E,A)=>{var O;E.key!==((O=x.current)==null?void 0:O.key)&&C(E),V(A,!0)},V=(E,A=!1)=>{var J,se,le,Y;const O=(J=m.current)==null?void 0:J.querySelector(`a[data-href="${E}"]`);if(A&&(O==null||O.scrollIntoView({block:"nearest"})),(se=document.getElementById(c.current))==null||se.classList.remove("reference-item-selected"),(le=document.getElementById(E))==null||le.classList.add("reference-item-selected"),E===c.current){!(O!=null&&O.classList.contains("manual-page-group-body-item-selected"))&&(O==null||O.classList.add("manual-page-group-body-item-selected")),h.current=O;return}c.current=E,(Y=h.current)==null||Y.classList.remove("manual-page-group-body-item-selected"),O==null||O.classList.add("manual-page-group-body-item-selected"),h.current=O},Q=E=>{var O;const A=it.find(J=>E.startsWith(J.prefix));A&&(re(A,E),window.location.href=`#${E}`,(O=d.current)==null||O.focus())},q=S.useCallback(E=>{var Oe;const{startTop:A,endTop:O,index:J,group:se,key:le}=z.current;let Y=O,oe=A;Y||([oe,Y]=W(le,J),z.current={startTop:oe,endTop:Y,group:se,index:J,key:le}),se.key!==((Oe=x.current)==null?void 0:Oe.key)&&C(se);const xe=E.currentTarget.scrollTop;if(xe>=oe&&xe<Y)return;let pe=!1,_e=J,Ee=se.index,ee=ks[se.key],de=se;if(xe>=Y)for(;!pe;){_e++;const Ge=ee[_e];if(Ge)pe=R(de,Ge,_e,xe);else{if(Ee++,de=it[Ee],ee=ks[de==null?void 0:de.key],!ee){pe=!0;return}C(de),_e=-1}}else for(;!pe;)if(_e--,_e>=0){const Ge=ee[_e];pe=R(de,Ge,_e,xe)}else{if(Ee--,Ee<0){pe=!0;return}de=it[Ee],C(de),ee=ks[de==null?void 0:de.key],_e=ee.length}},[]),C=E=>{var le,Y,oe,xe,pe,_e,Ee,ee,de,Oe,Ge;const A=(le=x.current)==null?void 0:le.index,O=(Y=m.current)==null?void 0:Y.querySelectorAll(".manual-page-group-t"),J=(oe=m.current)==null?void 0:oe.querySelectorAll(".manual-page-group-b"),se=E.index;if((pe=(xe=J==null?void 0:J[A])==null?void 0:xe.classList)==null||pe.add("hide"),(Ee=(_e=O==null?void 0:O[A])==null?void 0:_e.classList)==null||Ee.remove("active"),A===se){x.current=null;return}else(de=(ee=O==null?void 0:O[se])==null?void 0:ee.classList)==null||de.add("active"),(Ge=(Oe=J==null?void 0:J[se])==null?void 0:Oe.classList)==null||Ge.remove("hide"),x.current=E},R=(E,A,O,J)=>{var oe,xe,pe;const se=`${E.prefix}_${A}`,[le,Y]=W(se,O);if(le<=J&&J<Y){z.current={startTop:le,endTop:Y,group:E,index:O,key:se};const _e=(oe=m.current)==null?void 0:oe.querySelector(`a[data-href="${se}"]`);return(pe=(xe=g.current)==null?void 0:xe.classList)==null||pe.remove("manual-page-current-item-bg"),g.current=_e,_e==null||_e.scrollIntoView({block:"nearest"}),_e==null||_e.classList.add("manual-page-current-item-bg"),!0}return!1};return T.jsxs("div",{ref:_,className:`${a} manual-page-warpper ${o?"show-warpper":""}`,children:[T.jsx(By,{onGroupClick:P,onItemClick:j,selectItem:c,manualTabRef:m,searchRef:d,selectedItemChange:V}),T.jsxs("div",{className:"manual-page-right",children:[T.jsx("div",{children:T.jsx("h1",{className:"manual-page-title",children:r("Mine Script® v1 Reference Manual")})}),T.jsx("div",{onScroll:q,className:"manual-page-scroll manual-page-scroll-none",children:it.map(E=>T.jsxs(S.Fragment,{children:[T.jsx("h2",{className:"manual-page-header",children:r(E.key)}),T.jsx("div",{children:ks[E.key].map(A=>{var O;return T.jsx(Fy,{item:nt[E.key].get(A)||[],value:(O=o==null?void 0:o[E.key])==null?void 0:O.get(A),prefix:E.prefix,onItemClick:Q},A)})})]},E.key))})]})]})};L.ReferenceManual=Ry,L.ReferenceManualPage=Uy,L.TradingVueDiffEditor=gy,L.TradingVueEditor=fy,L.parseLibrary=Mm,L.parseTcc=ml,L.removeScript=Pm,L.scriptsRun=Om,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
151
|
+
`))!=null&&o.includes(a)){n.push(q),C=!0;break}}if(C)break}if(V){let C=!1;for(const R of V){const{name:E,desc:A,type:O}=R;if(E.includes(a)||A!=null&&A.includes(a)||O!=null&&O.includes(a)){n.push(q),C=!0;break}}if(C)break}if(Q){let C=!1;for(const R of Q)if(R.includes(a)){n.push(q),C=!0;break}if(C)break}}}return{labelList:s,contentList:n}}const Py=a=>{var Q;const{group:s,itemKey:r,onItemClick:n,currentIndex:o}=a,{t:l}=Ws(),[c,d]=S.useState(),[m,_]=S.useState(""),[g,x]=S.useState(0),[h,D]=S.useState(l("Copy code")),[z,P]=S.useState(l("Copy link"));S.useEffect(()=>{$(o)},[r]);const $=q=>{const C=r.replace(`${s==null?void 0:s.prefix}_`,""),R=nt[s==null?void 0:s.key].get(C);x(q),R&&Qn(R,q).then(E=>{d(E),_(`${window.location.origin}/reference-manual/#${s==null?void 0:s.prefix}_${E==null?void 0:E.orirginalName}`)})},j=q=>{$(q)},W=q=>{var C,R;if(q.target.localName==="a"&&q.target.hash&&((R=(C=q.target)==null?void 0:C.dataset)!=null&&R.name)){q.preventDefault();const{hash:E}=q.target;n(E.replace("#",""))}},re=()=>{D(l("Copied")),setTimeout(()=>{D(l("Copy code"))},1e3)},V=()=>{P(l("Link copied")),setTimeout(()=>{P(l("Copy link"))},3e3)};return T.jsx("div",{onClick:W,id:`#${r}`,children:T.jsxs("div",{className:"manual-content-wrapper",children:[T.jsxs("div",{className:"manual-content-header",children:[T.jsxs("div",{children:[T.jsx("h3",{className:"manual-content-header-title",children:c==null?void 0:c.name}),!!(c!=null&&c.overloads)&&T.jsx("span",{className:"manual-content-header-overloads",children:c==null?void 0:c.overloads})]}),T.jsx(Vs,{text:m,onCopy:V,children:T.jsx("div",{"data-tooltip":z,className:"manual-content-btn",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28",width:"28",height:"28",children:T.jsxs("g",{fill:"currentColor",children:[T.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"}),T.jsx("path",{d:"M10.485 16.141l5.656-5.656.707.707-5.656 5.656z"})]})})})})]}),(Q=c==null?void 0:c.desc)==null?void 0:Q.map((q,C)=>T.jsx("div",{dangerouslySetInnerHTML:{__html:q},className:"manual-content-text"},C)),(c==null?void 0:c.type)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("type")}),T.jsx("div",{className:"manual-content-text",children:c.type})]}),(c==null?void 0:c.syntax)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-content-sub-title",children:[l("syntax")," ",!!(c!=null&&c.overloads)&&`& ${l("overloads")}`]}),c.syntax.map((q,C)=>{var R;return(((R=c.syntax)==null?void 0:R.length)||0)>1?T.jsx("div",{onClick:()=>j(C),children:T.jsx("pre",{className:`manual-content-syntax with-overloads ${C===g?"selected":""}`,children:q})},C):T.jsx("pre",{className:"manual-content-syntax",children:q},C)})]}),(c==null?void 0:c.args)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("arguments")}),c.args.map((q,C)=>T.jsxs("div",{className:"manual-content-text",children:[T.jsx("span",{className:"manual-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.fields)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("fields")}),c.fields.map((q,C)=>T.jsxs("div",{className:"manual-content-text",children:[T.jsx("span",{className:"manual-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.examples)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:c.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-content-btn manual-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:c.examples}})})]}),(c==null?void 0:c.detailedDesc)&&c.detailedDesc.map((q,C)=>T.jsxs(S.Fragment,{children:[q.desc.map((R,E)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:R}},E)),T.jsxs("div",{className:"manual-content-sub-title manual-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:q.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-content-btn manual-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:q.examples||""}})})]},C)),(c==null?void 0:c.returns)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("returns")}),c.returns.map((q,C)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.remarks)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("remarks")}),c.remarks.map((q,C)=>T.jsx("div",{className:"manual-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.seeAlso)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-content-sub-title",children:l("see also")}),T.jsx("div",{className:"manual-content-see_also",children:c.seeAlso.map((q,C)=>T.jsx("a",{className:"manual-content-see_also-tag","data-name":q==null?void 0:q.name,href:q==null?void 0:q.link,children:q==null?void 0:q.name},C))})]})]})})};Ae.languages.register({id:Re}),Ae.editor.defineTheme("vs-dark",ga),Ae.editor.defineTheme("vs",fa),Ae.languages.setMonarchTokensProvider(Re,Is),Ae.languages.setLanguageConfiguration(Re,_a);const Ry=({theme:a="vs-dark",language:s,currentValue:r})=>{const{t:n,i18n:o}=Ws(),[l,c]=S.useState(it[0]),[d,m]=S.useState(null),[_,g]=S.useState(0),[x,h]=S.useState(""),[D,z]=S.useState("var_bar_index"),P=S.useRef(null),$=S.useRef(null),j=S.useRef(null),W=R=>{var E;R.key===(l==null?void 0:l.key)&&!(l!=null&&l.isHidden)?c({...R,isHidden:!0}):c(R),(E=P.current)==null||E.focus()};S.useEffect(()=>{Ae.editor.setTheme(a)},[a]),S.useEffect(()=>{var R;if(r.value){const[E]=r.value.split("_"),A=it.find(O=>E===O.prefix);A&&(g(r.index||0),q(A,r.value)),(R=P.current)==null||R.focus()}},[r]),S.useEffect(()=>{s&&o.changeLanguage(s)},[s]),S.useEffect(()=>{var R;(R=P.current)==null||R.focus()},[P.current]);const re=(R,E)=>{var A,O;R!==D&&(E&&c(E),g(0),z(R),(A=j.current)==null||A.scrollTo({top:0}),(O=P.current)==null||O.focus())},V=R=>{if(R.target.value.trim()==="")Q();else{h(R.target.value);const E=zl(R.target.value);m(E)}},Q=()=>{var R;h(""),m(null),setTimeout(()=>{var E,A;(A=(E=$.current)==null?void 0:E.querySelector(`a[data-href="${D}"]`))==null||A.scrollIntoView(!0)},10),(R=P.current)==null||R.focus()},q=(R,E)=>{var A;c(R),z(E),setTimeout(()=>{var O,J;(J=(O=$.current)==null?void 0:O.querySelector(`a[data-href="${E}"]`))==null||J.scrollIntoView(!0)},10),(A=j.current)==null||A.scrollTo({top:0})},C=R=>{var A;const E=it.find(O=>R.startsWith(O.prefix));E&&(g(0),q(E,R),(A=P.current)==null||A.focus())};return T.jsxs("div",{className:`${a} manual-warpper`,children:[T.jsxs("div",{className:"manual-left",children:[T.jsxs("div",{className:"manual-search",children:[T.jsx("span",{className:"manual-search-icon",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:"18px",height:"18px",children:T.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"})})}),T.jsx("input",{onChange:V,ref:P,spellCheck:"false",value:x,className:"manual-search-input",autoComplete:"off",placeholder:n("search"),type:"text"}),T.jsx("span",{onClick:Q,className:`manual-search-clear ${x?"":"hide"}`,children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95.939 95.939",width:"9",height:"9",children:T.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"})})})]}),T.jsx("div",{className:`manual-group-search-list manual-scroll ${x?"":"hide"}`,children:T.jsxs("div",{children:[d==null?void 0:d.labelList.map(R=>T.jsx("a",{onClick:E=>{E.preventDefault(),re(R.key,R.group)},className:`manual-group-body-item ${R.key===D?"manual-group-body-item-selected":""}`,"data-href":R.key,href:`#${R.key}`,children:R.label},`search_${R.key}`)),T.jsx("div",{className:"manual-content-separator"}),d==null?void 0:d.contentList.map(R=>T.jsx("a",{onClick:E=>{E.preventDefault(),re(R.key,R.group)},className:`manual-group-body-item ${R.key===D?"manual-group-body-item-selected":""}`,"data-href":R.key,href:`#${R.key}`,children:R.label},`search_${R.key}`))]})}),T.jsx("div",{className:`manual-group-list manual-scroll ${x?"hide":""}`,ref:$,children:it.map(R=>{var E,A;return T.jsxs(S.Fragment,{children:[T.jsx("div",{onClick:()=>W(R),className:`manual-group-title ${R.key===(l==null?void 0:l.key)&&!(l!=null&&l.isHidden)?"active":""}`,children:n(R.key)}),T.jsx("div",{className:`manual-group-body manual-scroll ${R.key!==(l==null?void 0:l.key)||l!=null&&l.isHidden?"hide":""}`,children:(A=(E=zn[R.key])==null?void 0:E.sort().filter(O=>!Lo.includes(O)))==null?void 0:A.map(O=>{const J=`${R.prefix}_${O}`;return T.jsx("a",{onClick:se=>{se.preventDefault(),re(J)},className:`manual-group-body-item ${J===D?"manual-group-body-item-selected":""}`,"data-href":J,href:`#${J}`,children:`${O}${R.prefix==="fun"?"()":""}`},J)})})]},R.key)})})]}),T.jsx("div",{ref:j,className:"manual-right manual-scroll",children:T.jsx(Py,{currentIndex:_,group:l,itemKey:D,onItemClick:C})})]})},Fy=a=>{var Q;const{onItemClick:s,item:r,prefix:n,value:o}=a,{t:l}=Ws(),[c,d]=S.useState(),[m,_]=S.useState(""),[g,x]=S.useState(0),[h,D]=S.useState(l("Copy code")),[z,P]=S.useState(l("Copy link"));S.useEffect(()=>{o&&(d(o),_(`${window.location.origin}/reference-manual/#${n}_${o==null?void 0:o.orirginalName}`))},[o]);const $=(q=0)=>{x(q),Qn(r,q).then(C=>{d(C),_(`${window.location.origin}/reference-manual/#${n}_${C==null?void 0:C.orirginalName}`)})},j=q=>{$(q)},W=q=>{var C,R;if(q.target.localName==="a"&&q.target.hash&&((R=(C=q.target)==null?void 0:C.dataset)!=null&&R.name)){q.preventDefault();const{hash:E}=q.target;s(E.replace("#",""))}},re=()=>{D(l("Copied")),setTimeout(()=>{D(l("Copy code"))},1e3)},V=()=>{P(l("Link copied")),setTimeout(()=>{P(l("Copy link"))},3e3)};return T.jsx("div",{onClick:W,id:`${n}_${c==null?void 0:c.orirginalName}`,children:T.jsxs("div",{className:"manual-page-content-wrapper",children:[T.jsxs("div",{className:"manual-page-content-header",children:[T.jsxs("div",{children:[T.jsx("h3",{className:"manual-page-content-header-title",children:c==null?void 0:c.name}),!!(c!=null&&c.overloads)&&T.jsx("span",{className:"manual-page-content-header-overloads",children:c==null?void 0:c.overloads})]}),T.jsx(Vs,{text:m,onCopy:V,children:T.jsx("div",{"data-tooltip":z,className:"manual-page-content-btn",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 28 28",width:"28",height:"28",children:T.jsxs("g",{fill:"currentColor",children:[T.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"}),T.jsx("path",{d:"M10.485 16.141l5.656-5.656.707.707-5.656 5.656z"})]})})})})]}),(Q=c==null?void 0:c.desc)==null?void 0:Q.map((q,C)=>T.jsx("div",{dangerouslySetInnerHTML:{__html:q},className:"manual-page-content-text"},C)),(c==null?void 0:c.type)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("type")}),T.jsx("div",{className:"manual-page-content-text",children:c.type})]}),(c==null?void 0:c.syntax)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-page-content-sub-title",children:[l("syntax")," ",!!(c!=null&&c.overloads)&&`& ${l("overloads")}`]}),c.syntax.map((q,C)=>{var R;return(((R=c.syntax)==null?void 0:R.length)||0)>1?T.jsx("div",{onClick:()=>j(C),children:T.jsx("pre",{className:`manual-page-content-syntax with-overloads ${C===g?"selected":""}`,children:q})},C):T.jsx("pre",{className:"manual-page-content-syntax",children:q},C)})]}),(c==null?void 0:c.args)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("arguments")}),c.args.map((q,C)=>T.jsxs("div",{className:"manual-page-content-text",children:[T.jsx("span",{className:"manual-page-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.fields)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("fields")}),c.fields.map((q,C)=>T.jsxs("div",{className:"manual-page-content-text",children:[T.jsx("span",{className:"manual-page-content-args-label",children:q.label})," ",T.jsx("span",{dangerouslySetInnerHTML:{__html:q.desc||""}})]},C))]}),(c==null?void 0:c.examples)&&T.jsxs(S.Fragment,{children:[T.jsxs("div",{className:"manual-page-content-sub-title manual-page-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:c.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-page-content-btn manual-page-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-page-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:c.examples}})})]}),(c==null?void 0:c.detailedDesc)&&c.detailedDesc.map((q,C)=>T.jsxs(S.Fragment,{children:[q.desc.map((R,E)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:R}},E)),T.jsxs("div",{className:"manual-page-content-sub-title manual-page-content-example-header",children:[T.jsx("div",{children:T.jsx("span",{children:l("example")})}),T.jsx(Vs,{text:q.originalExample||"",onCopy:re,children:T.jsx("div",{"data-tooltip":h,className:"manual-page-content-btn manual-page-content-example-copy",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",fill:"none",children:T.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"})})})})]}),T.jsx("pre",{className:"manual-page-content-example",children:T.jsx("code",{dangerouslySetInnerHTML:{__html:q.examples||""}})})]},C)),(c==null?void 0:c.returns)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("returns")}),c.returns.map((q,C)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.remarks)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("remarks")}),c.remarks.map((q,C)=>T.jsx("div",{className:"manual-page-content-text",dangerouslySetInnerHTML:{__html:q}},C))]}),(c==null?void 0:c.seeAlso)&&T.jsxs(S.Fragment,{children:[T.jsx("div",{className:"manual-page-content-sub-title",children:l("see also")}),T.jsx("div",{className:"manual-page-content-see_also",children:c.seeAlso.map((q,C)=>T.jsx("a",{className:"manual-page-content-see_also-tag","data-name":q==null?void 0:q.name,href:q==null?void 0:q.link,children:q==null?void 0:q.name},C))})]})]})})},By=({onItemClick:a,onGroupClick:s,selectedItemChange:r,selectItem:n,manualTabRef:o,searchRef:l})=>{const{t:c}=Ws(),[d,m]=S.useState(null),[_,g]=S.useState("");S.useEffect(()=>{var D;(D=l.current)==null||D.focus()},[l.current]);const x=D=>{if(D.target.value.trim()==="")h();else{g(D.target.value);const z=zl(D.target.value);m(z)}},h=()=>{var D;g(""),m(null),setTimeout(()=>{n.current&&r(n.current,!0)},10),(D=l.current)==null||D.focus()};return T.jsxs("div",{className:"manual-page-left",children:[T.jsxs("div",{className:"manual-page-search",children:[T.jsx("span",{className:"manual-page-search-icon",children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",width:"18px",height:"18px",children:T.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"})})}),T.jsx("input",{onChange:x,ref:l,spellCheck:"false",value:_,className:"manual-page-search-input",autoComplete:"off",placeholder:c("search"),type:"text"}),T.jsx("span",{onClick:h,className:`manual-page-search-clear ${_?"":"hide"}`,children:T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 95.939 95.939",width:"9",height:"9",children:T.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"})})})]}),T.jsxs("div",{ref:o,className:"manual-page-group-container",children:[T.jsx("div",{className:`manual-page-group-search-list manual-page-scroll ${_?"":"hide"}`,children:T.jsxs("div",{children:[d==null?void 0:d.labelList.map(D=>T.jsx("a",{onClick:z=>{z.preventDefault(),a(D.key,D.index,D.group)},className:"manual-page-group-body-item","data-href":D.key,href:`#${D.key}`,children:D.label},`search_${D.key}`)),T.jsx("div",{className:"manual-page-content-separator"}),d==null?void 0:d.contentList.map(D=>T.jsx("a",{onClick:z=>{z.preventDefault(),a(D.key,D.index,D.group)},className:"manual-page-group-body-item","data-href":D.key,href:`#${D.key}`,children:D.label},`search_${D.key}`))]})}),T.jsx("div",{className:`manual-page-group-list manual-page-scroll ${_?"hide":""}`,children:it.map(D=>{var z;return T.jsxs(S.Fragment,{children:[T.jsx("div",{onClick:()=>s(D),className:"manual-page-group-title manual-page-group-t",children:c(D.key)}),T.jsx("div",{className:"manual-page-group-body manual-page-group-b manual-page-scroll hide",children:(z=ks[D.key])==null?void 0:z.map((P,$)=>{const j=`${D.prefix}_${P}`;return T.jsx("a",{onClick:W=>{W.preventDefault(),a(j,$)},className:"manual-page-group-body-item","data-href":j,href:`#${j}`,children:`${P}${D.prefix==="fun"?"()":""}`},j)})})]},D.key)})})]})]})};Ae.languages.register({id:Re}),Ae.editor.defineTheme("vs-dark",ga),Ae.editor.defineTheme("vs",fa),Ae.languages.setMonarchTokensProvider(Re,Is),Ae.languages.setLanguageConfiguration(Re,_a);const Uy=({theme:a="vs-dark",language:s})=>{const{t:r,i18n:n}=Ws(),[o,l]=S.useState(),c=S.useRef(""),d=S.useRef(null),m=S.useRef(null),_=S.useRef(null),g=S.useRef(null),x=S.useRef(null),h=S.useRef(null),D=S.useRef(0),z=S.useRef({startTop:0,endTop:0,key:"var_bar_index",group:it[0],index:0}),P=E=>{var A;C(E),(A=d.current)==null||A.focus()};S.useEffect(()=>{var E;x.current||($(),D.current=((E=_.current)==null?void 0:E.offsetTop)||0)},[]);const $=async()=>{const E={};for(const A of it){const O=A.key,J=new Map;for(const se of ks[O]){const le=await Qn(nt[O].get(se)||[],0);le&&J.set(se,le)}E[O]=J}l(E)};S.useEffect(()=>{if(!x.current&&o){const E=window.location.hash;if(E){const A=E.replace(/^#/,""),[O]=A.split("_"),J=it.find(se=>se.prefix===O);if(J){C(J),V(A,!0),setTimeout(()=>{const se=document.getElementById(A);se==null||se.scrollIntoView(),se==null||se.classList.add("reference-item-selected")},10);return}}C(it[0]),setTimeout(()=>{R(it[0],"bar_index",0,92)},10)}},[o]),S.useEffect(()=>{Ae.editor.setTheme(a)},[a]),S.useEffect(()=>{s&&n.changeLanguage(s)},[s]),S.useEffect(()=>{var E;(E=d.current)==null||E.focus()},[d.current]);const j=(E,A,O)=>{var le,Y,oe,xe;if(E===c.current)return;O&&O.key!==((le=x.current)==null?void 0:le.key)&&C(O),V(E),window.location.href=`#${E}`;const[J,se]=W(E,A);z.current={startTop:J,endTop:se,group:O||x.current,index:A,key:E},(oe=(Y=g.current)==null?void 0:Y.classList)==null||oe.remove("manual-page-current-item-bg"),(xe=d.current)==null||xe.focus()},W=(E,A=0)=>{const O=document.getElementById(E),J=(O==null?void 0:O.offsetHeight)||0,se=A?0:78,le=((O==null?void 0:O.offsetTop)||0)-72-D.current;return[le-se,le+J]},re=(E,A)=>{var O;E.key!==((O=x.current)==null?void 0:O.key)&&C(E),V(A,!0)},V=(E,A=!1)=>{var J,se,le,Y;const O=(J=m.current)==null?void 0:J.querySelector(`a[data-href="${E}"]`);if(A&&(O==null||O.scrollIntoView({block:"nearest"})),(se=document.getElementById(c.current))==null||se.classList.remove("reference-item-selected"),(le=document.getElementById(E))==null||le.classList.add("reference-item-selected"),E===c.current){!(O!=null&&O.classList.contains("manual-page-group-body-item-selected"))&&(O==null||O.classList.add("manual-page-group-body-item-selected")),h.current=O;return}c.current=E,(Y=h.current)==null||Y.classList.remove("manual-page-group-body-item-selected"),O==null||O.classList.add("manual-page-group-body-item-selected"),h.current=O},Q=E=>{var O;const A=it.find(J=>E.startsWith(J.prefix));A&&(re(A,E),window.location.href=`#${E}`,(O=d.current)==null||O.focus())},q=S.useCallback(E=>{var Oe;const{startTop:A,endTop:O,index:J,group:se,key:le}=z.current;let Y=O,oe=A;Y||([oe,Y]=W(le,J),z.current={startTop:oe,endTop:Y,group:se,index:J,key:le}),se.key!==((Oe=x.current)==null?void 0:Oe.key)&&C(se);const xe=E.currentTarget.scrollTop;if(xe>=oe&&xe<Y)return;let pe=!1,_e=J,Ee=se.index,ee=ks[se.key],de=se;if(xe>=Y)for(;!pe;){_e++;const Ge=ee[_e];if(Ge)pe=R(de,Ge,_e,xe);else{if(Ee++,de=it[Ee],ee=ks[de==null?void 0:de.key],!ee){pe=!0;return}C(de),_e=-1}}else for(;!pe;)if(_e--,_e>=0){const Ge=ee[_e];pe=R(de,Ge,_e,xe)}else{if(Ee--,Ee<0){pe=!0;return}de=it[Ee],C(de),ee=ks[de==null?void 0:de.key],_e=ee.length}},[]),C=E=>{var le,Y,oe,xe,pe,_e,Ee,ee,de,Oe,Ge;const A=(le=x.current)==null?void 0:le.index,O=(Y=m.current)==null?void 0:Y.querySelectorAll(".manual-page-group-t"),J=(oe=m.current)==null?void 0:oe.querySelectorAll(".manual-page-group-b"),se=E.index;if((pe=(xe=J==null?void 0:J[A])==null?void 0:xe.classList)==null||pe.add("hide"),(Ee=(_e=O==null?void 0:O[A])==null?void 0:_e.classList)==null||Ee.remove("active"),A===se){x.current=null;return}else(de=(ee=O==null?void 0:O[se])==null?void 0:ee.classList)==null||de.add("active"),(Ge=(Oe=J==null?void 0:J[se])==null?void 0:Oe.classList)==null||Ge.remove("hide"),x.current=E},R=(E,A,O,J)=>{var oe,xe,pe;const se=`${E.prefix}_${A}`,[le,Y]=W(se,O);if(le<=J&&J<Y){z.current={startTop:le,endTop:Y,group:E,index:O,key:se};const _e=(oe=m.current)==null?void 0:oe.querySelector(`a[data-href="${se}"]`);return(pe=(xe=g.current)==null?void 0:xe.classList)==null||pe.remove("manual-page-current-item-bg"),g.current=_e,_e==null||_e.scrollIntoView({block:"nearest"}),_e==null||_e.classList.add("manual-page-current-item-bg"),!0}return!1};return T.jsxs("div",{ref:_,className:`${a} manual-page-warpper ${o?"show-warpper":""}`,children:[T.jsx(By,{onGroupClick:P,onItemClick:j,selectItem:c,manualTabRef:m,searchRef:d,selectedItemChange:V}),T.jsxs("div",{className:"manual-page-right",children:[T.jsx("div",{children:T.jsx("h1",{className:"manual-page-title",children:r("Mine Script® v1 Reference Manual")})}),T.jsx("div",{onScroll:q,className:"manual-page-scroll manual-page-scroll-none",children:it.map(E=>T.jsxs(S.Fragment,{children:[T.jsx("h2",{className:"manual-page-header",children:r(E.key)}),T.jsx("div",{children:ks[E.key].map(A=>{var O;return T.jsx(Fy,{item:nt[E.key].get(A)||[],value:(O=o==null?void 0:o[E.key])==null?void 0:O.get(A),prefix:E.prefix,onItemClick:Q},A)})})]},E.key))})]})]})};L.ReferenceManual=Ry,L.ReferenceManualPage=Uy,L.TradingVueDiffEditor=gy,L.TradingVueEditor=fy,L.parseLibrary=Mm,L.parseTcc=ml,L.removeScript=Pm,L.scriptsRun=Om,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|