@lcap/nasl-unified-frontend-generator 3.8.3-alpha.1-optimize → 3.8.3-alpha.2-optimize

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.
@@ -4743,95 +4743,95 @@ export const useHandlePageNavigationEvent = ()=>{
4743
4743
  },
4744
4744
  "include": ["src"]
4745
4745
  }
4746
- `}},environment:"vanilla"};import{Container as oo}from"inversify";import"@abraham/reflection";import{Argument as bt,Assignment as xt,BinaryExpression as At,BindAttribute as kt,BindEvent as Dt,CallFunction as St,Identifier as ln,Logic as un,Param as dn,StringLiteral as mn,genMetaData as Tt}from"@lcap/nasl";import{isCallLogic as Rt,isConnector as Nt,isIdentifier as Pe,isMemberExpression as Pt}from"@lcap/nasl/out/concepts/utils/asserts";import{injectable as It}from"inversify";import{isObject as jt,pick as Ct}from"lodash";var $=class{static{a(this,"StateActionIR")}__raw;deps;params;logics;name;kind;constructor(e){Object.assign(this,e)}};function F(n){return n!=null}a(F,"isNotNil");function $e(n){return Array.isArray(n)?n:[n]}a($e,"ensureArray");function _e(){throw new Error("todo")}a(_e,"todo");function H(n){let e=n?JSON.stringify(n):String(n);throw new Error(`not implemented for ${e}`)}a(H,"notImplemented");function M(n){let e=n?JSON.stringify(n):String(n);throw new Error(`never implemented for ${e}. Should never be here!`)}a(M,"neverImplemented");function G(n){throw new Error(`assertNever failed: ${n}`)}a(G,"assertNever");var en=a(n=>n.startsWith("elements."),"isNameAElementRef"),nn=a(n=>n.split(".").at(1),"extractComponentNameFromElementRefName"),Te=a(n=>`${n}Ref`,"componentNameToRefName");function Re(n){return n.kind==="library"}a(Re,"isComponentFromLib");function tn(n){return n.tag==="template"}a(tn,"isReferencedComponentATemplate");import{isFunction as pt}from"lodash";import ut from"pino";var dt=process.env.LOG_LEVEL||"info",mt=ut({level:dt,transport:{target:"pino-pretty",options:{colorize:!0}}});function D(n){return mt.child({},{msgPrefix:`[${n}] `})}a(D,"Logger");function rn(n){if(!pt(n))throw new Error;let e=n.name,r=Object.getOwnPropertyNames(n.prototype),i=D(e);return r.forEach(o=>{let s=n.prototype[o];n.prototype[o]=function(...l){return i.trace({method:o,args:l}),s.apply(this,l)}}),n}a(rn,"logging");import{Argument as on,CallFunction as ft,StringLiteral as gt,Unparsed as ht}from"@lcap/nasl";function Ne(n,e){let r=n?.split(".")||[],o=r[0]==="app"?1:0;return r.findIndex((s,l)=>l%2===o?s===e:!1)}a(Ne,"findConceptKeyWordIndexFromNamespace");function sn(n){let e=n.typeAnnotation||n.__TypeAnnotation,{sortedTypeKey:r,typeKind:i,typeName:o,typeNamespace:s}=e||{};if(s?.endsWith(".metadataTypes")){let w=(n.app.findNodeByCompleteName(s+"."+o)||{}).typeAnnotation||{};r=`${w.typeNamespace}.${w.typeName}`,i=w.typeKind,o=w.typeName}let l=e&&(!["primitive","union"].includes(i)||o==="DateTime"),d=n.defaultValue?.expression?n.defaultValue.expression:new ht({code:void 0});return l?ft.from({calleeName:"genInitFromSchema",arguments:[new on({expression:new gt({value:r})}),new on({expression:d})]},n.parentNode,n.parentKey):d}a(sn,"prepareVariableDefaultValue");import{firstUpperCase as yt}from"@lcap/nasl/out/utils/string";var se=a(n=>n.replaceAll("_","-").replace(/(?:-)([a-zA-Z0-9])/g,(e,r)=>r.toUpperCase()),"trueKebab2Camel"),_=a(n=>yt(se(n)),"kebab2Pascal");function an(n){return/^[A-Z]/.test(n)}a(an,"startsWithUpperCase");function cn(n){return F(n)&&n!==""}a(cn,"isNotEmptyString");function C({name:n,functions:e}){return{name:n,functions:e}}a(C,"makePlugin");var vt={enabled:!1,locale:"zh-CN",messages:{},I18nList:[]},de=C({name:"MetadataPlugin",functions:{makeBasePlatformConfig(n,e,r){let i=r?.lowcodeDomain,o=r?.envNuimsDomain?.[r?.env]||r?.nuimsDomain,s=r?.envLcpDomain?.[r?.env]?.lcpDomain||r?.lowcodeDomain;return{appConfig:{project:n.name,domainName:n.name,nuimsDomain:o,lowcodeDomain:i,envNuimsDomain:r.envNuimsDomain,tenantType:r.tenantType,tenantLevel:r.tenantLevel,extendedConfig:r.extendedConfig,envConfig:{lowcodeDomain:s},tenant:r.tenant,documentTitle:e.documentTitle,i18nInfo:vt},dnsAddr:n.dnsAddr,tenant:r.tenant,env:r.env,hasUserCenter:n.hasUserCenter,hasAuth:n.hasAuth,basePath:e.prefixPath,sysPrefixPath:n.sysPrefixPath,frontendName:e.name}}}});function wt(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(wt,"_ts_decorate");var me=class n{static{a(this,"StateContextIR")}providedStates;consumedStateNames;actions;parentCtx;constructor(e,r,i,o){this.providedStates=e,this.consumedStateNames=r,this.actions=i,this.parentCtx=o}recursivelyExtractTreeStates(){return[...this.providedStates.filter(e=>e.kind==="tree"),...this.parentCtx?.recursivelyExtractTreeStates()??[]]}resolveExprToString(e,r,i){return r.printSyntaxNode(e,{resolve({kind:o,value:s}){switch(o){case"calleeNamespace":return i.resolveCalleeNamespace(s);case"identifier":return i.resolveIdentifier(s)}}})}static fromParent(e){return new n([],[],[],e)}provide(e){return this.providedStates.push(e),this}provideAction(e){return this.actions.push(e),this}findStateByName(e){return this.providedStates.find(r=>r.identifier===e)??this.parentCtx?.findStateByName(e)}findActionByName(e){return this.actions.find(r=>r.name===e)??this.parentCtx?.findActionByName(e)}findComponentRefByComponentName(e){return this.findStateByName(Te(e))??this.parentCtx?.findComponentRefByComponentName(e)}};function Lt(n,e){let r=[],i=[];return n.dependencies&&r.push(...n.dependencies),n.interfaceDependencies&&r.push(...n.interfaceDependencies),e.views&&i.push(...e.views),r.forEach(o=>{o.views&&i.push(...o.views)}),i}a(Lt,"collectTopLevelViews");function ee(n){return{name:n.name,typeAnnotation:n.__TypeAnnotation,defaultValue:n.defaultValue}}a(ee,"paramToIR");function Et(n){if(e(n)||r(n)){if(r(n)){let i=St.from({calleeNamespace:"nasl.auth",calleeName:"has",arguments:[bt.from({expression:new mn({value:n.viewElement.authPath})})]},n.parentNode,n.parentKey);return{__raw:n,concept:n.concept,expression:ne(i),kind:"if"}}else{let i=n.expression;if(i)return{__raw:n,concept:n.concept,expression:ne(i),kind:"if"};W.debug({nodePath:n.nodePath},"\u65E0expression\u7684directive\uFF0C\u53EF\u80FD\u4E3A\u810F\u6570\u636E")}return}else return W.error({nodePath:n.nodePath},`\u9047\u5230\u4E86\u4E0D\u652F\u6301\u7684 directive: ${n.name}`),H(n);function e(i){return i.name==="if"}a(e,"isIfDirective");function r(i){return i.name==="auth"}a(r,"isAuthDirective")}a(Et,"bindDirectiveToIR");function ne(n){return{expr:n,deps:[]}}a(ne,"exprToIR");function ge(n){if(n.type===void 0&&n.name==="rules")return{kind:"validation-rules",concept:"BindAttribute",name:"rules",rules:n.rules,__raw:n};switch(n.type){case"string":{let e=mn.from({value:n.value});if(n.sync)throw W.error({nodePath:n.nodePath},"string\u4E0D\u53EF\u4E3Async"),new Error("string\u4E0D\u53EF\u4E3Async");return{__raw:n,concept:n.concept,kind:"expr",expression:ne(e),name:n.name,sync:!1}}case"static":case"dynamic":return n.type==="dynamic"&&(n.destination?n.expression=n.destination:n.externalDestination&&(n.expression=n.externalDestination,n.name="link")),{__raw:n,concept:n.concept,kind:"expr",expression:ne(n.expression),name:n.name,sync:n.sync??!1};case"component":return{kind:"render",concept:"BindAttribute",component:n.component,scopeVariable:n.scopeVariable,name:n.name};default:G(n)}}a(ge,"bindAttrToIR");function Z(n){return{logic:n,deps:[]}}a(Z,"logicToLogicIR");function fn(n,e){return se(`${e??""}-${n}`)}a(fn,"getHandlerName");function Ft(n){return{value:"change",checked:"change"}[n]??`${n}-change`}a(Ft,"inferChangeEventNameFromAttrName");function ae(n){return{__raw:n,logics:n.logics.map(Z),concept:n.concept,params:n.getContextLogicParams().map(ee),handlerName:fn(n.name,n.parentNode?.name)}}a(ae,"bindViewElementEventToIR");function je(n){return{__raw:n.__raw,logics:n.logics,deps:[],name:n.handlerName,params:n.params,kind:"standalone"}}a(je,"bindEventToAction");var pn="@lcap/pc-react-ui";function Vt(n){let e=n.tag;if(an(e)){let r=n?.app?.dependencies?.find(o=>o.frontends.some(s=>s.viewComponents.some(l=>l.name===e)));return e==="Router"?{kind:"library",libraryName:"react-router-dom",tag:"Outlet"}:{kind:"library",libraryName:r?`@extension/${r.name}`:pn,tag:e}}else if(e){if(e.includes("-"))throw W.error({viewElement:Ct(n,["name","concept","tag"]),nodePath:n.nodePath},"\u4E0D\u652F\u6301\u7684tag\uFF0C\u53EF\u80FD\u4E3A\u810F\u6570\u636E"),new Error(`\u5B58\u5728\u810F\u6570\u636E: ${n.nodePath}`);return{kind:"library",libraryName:pn,tag:e}}throw new Error("empty tag name!")}a(Vt,"getReferencedLibComponent");function Mt(n){n.attrs.flatMap(r=>{if(r.kind==="expr"&&r.sync){if(r.expression.expr)return[r];W.debug(`${r.__raw.nodePath}\u7684expression\u4E3A\u7A7A\uFF0C\u4F46\u4ECD\u4E3A\u53CC\u5411\u7ED1\u5B9A\u3002\u5DF2\u5FFD\u7565\u3002`)}return[]}).forEach(r=>{W.debug({x:r},"\u6784\u9020\u53CC\u5411\u7ED1\u5B9A\u7684handler");let i=d(),o=i.params.at(0),s=new dn({name:o?.name??"event"}),l=un.from({name:"_syncChange",body:[xt.from({left:r.expression.expr,right:s},r.__raw.parentNode,r.__raw.parentKey)],params:[s]});i.logics.unshift(Z(l)),o||i.params.push(ee(s));function d(){let f=Ft(r.name),w=fn(f,r.__raw.parentNode?.name);W.trace({targetEventName:f,targetHandlerName:w});let b=n.events.find(t=>t.handlerName===w);if(b)return b;let g=ae(Dt.from({logics:[],name:"change"},r.__raw.parentNode,"bindEvents"));return n.events.push(g),g}a(d,"findOrCreateBindEvent")})}a(Mt,"prependBindEventForSyncBindAttribute");function gn(n){if(n.logics.length>1){let e=[],r=n.params.map(s=>dn.from(s)),i=n.logics.map(s=>{let l=`${n.name}_${s.logic.name}`,d=un.from({...s.logic.toJSON(),params:r,name:l},s.logic.parentNode,s.logic.parentKey);return Z(d)}),o=new $({...n,logics:i});return e.push(o),i.forEach(s=>{let l=new $({...n,name:s.logic.name,logics:[s],kind:"standalone"});e.push(l)}),e}else return[n]}a(gn,"splitLogicsInActionToMultipleActions");function Ot(n){if(n.some(s=>s.kind!=="if"))throw W.error("mergeIfDirectives\u63A5\u6536\u5230\u4E86\u4E0D\u662Fif\u6307\u4EE4\u7684bindDirectives"),new Error("mergeIfDirectives\u63A5\u6536\u5230\u4E86\u4E0D\u662Fif\u6307\u4EE4\u7684bindDirectives");let[e,...r]=n;if(!e)return n;let i=e.expression.expr;for(let s of r)i=At.from({left:i,operator:"&&",right:s.expression.expr},s.__raw.parentNode,s.__raw.parentKey);return[{kind:"if",concept:"BindDirective",expression:ne(i),__raw:e.__raw}]}a(Ot,"mergeMultipleIfDirectivesIntoConjunctiveNormalForm");function hn(n,e){let r=e.bindAttrs.map(ge),o={directives:Ot(e.bindDirectives.map(Et).filter(F)),attrs:r,events:e.bindEvents.map(ae).filter(F),children:e.children.map(l=>hn(n,l)),component:Vt(e),__raw:e,slot:{scope:e.slotScope||void 0,target:s(e.slotTarget)}};return Mt(o),o.events.forEach(l=>{let d=gn(je(l));for(let f of d)n.provideAction(f)}),o;function s(l){if(!(l==="default"||l===""))return l}a(s,"normalizeSlotTarget")}a(hn,"extractAsComponentInstanceIR");function zt(n){let e=[],r=[];return n.variables.forEach(o=>{let s={kind:"local-logic",initialization:{kind:"static",value:ne(sn(o))},identifier:o.name,typeAnnotation:o.__TypeAnnotation};e.push(s)}),n.bindEvents.forEach(o=>{let s=new $({__raw:o,logics:o.logics.map(Z),deps:[],name:o.name,params:o.getContextLogicParams().map(ee),kind:"view-lifecycle"}),l=gn(s);r.push(...l)}),n.logics.forEach(o=>{r.push(new $({__raw:o,deps:[],name:o.name,params:o.params.map(ee),logics:[o].map(Z),kind:"standalone"}))}),n.params.forEach(o=>{let s={kind:"local-logic",initialization:{kind:"url-param",__raw:ee(o),defaultValue:o.defaultValue?.expression?ne(o.defaultValue.expression):void 0},identifier:o.name,typeAnnotation:o.__TypeAnnotation};e.push(s)}),{consumedStateNames:[],providedStates:e,actions:r}}a(zt,"collectStatesAndActionsFromView");function Ut(n){return n.provide({identifier:"nasl",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useNasl"}}).provide({identifier:"$frontendVariables",kind:"tree",typeAnnotation:null,initialization:{kind:"frontend-variable",hookName:"useFrontendVariables"}}).provide({identifier:"$services",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useServices"}}).provide({identifier:"$destination",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useDestination"}}).provide({identifier:"$library",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useLibrary"}}).provide({identifier:"$link",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useLink"}}).provide({identifier:"userInfo",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useUserInfo"}}).provide({identifier:"genInitFromSchema",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useGenInitFromSchema"}})}a(Ut,"enhanceStateContext");function Ie(n,e){if(e&&en(e)){let r=nn(e);if(!r)return;let i=n.findComponentRefByComponentName(r);if(i)return i;let s={kind:"standalone",identifier:Te(r),initialization:{kind:"component-ref",componentName:r},typeAnnotation:null};return n.provide(s),s}}a(Ie,"provideAsComponentRefIfOk");function Qt(n){let e=new me([],[],[],null);return Ut(e)}a(Qt,"makeBaseCtx");var Ce="apiClient";function Gt(n,e){return e.provide({kind:"tree",identifier:Ce,initialization:{kind:"api-client"},typeAnnotation:null}),n.map(Z)}a(Gt,"collectApis");function Kt(n){return n.dependencies.map(r=>{if(!Nt(r)&&r.frontends?.length)return r}).filter(F)}a(Kt,"collectFrontendExtensionModules");function qt(n,e,r){let i=Lt(n,e);return s(i,r);function s(l,d){return l.map(f=>{let w=s(f.children,d),{providedStates:b,actions:g}=zt(f),t=new me(b,[],g,d);x(t);let v=f.elements.map(p=>hn(t,p));return c(v),{__raw:f,childComponents:w,stateContext:t,identifier:f.name,elements:v};function x(p){f.traverseStrictChildren(u=>{if(jt(u)&&"playground"in u&&(u.playground=[]),Pt(u)){if(Pe(u.object)&&Pe(u.property)&&u.object.name==="elements"&&u.property.name==="$ce"){let y=u.getAncestor("ViewElement");if(y){let m=`elements.${y.name}`,h=Ie(p,m);h&&(u.emit=()=>{},u.parentNode&&(u.parentNode.emit=()=>{}),u.replaceNode({name:h.identifier,concept:"Identifier"}))}}else if(Pe(u.object)&&u.object.namespace==="elements.$ce.property"){let y=u.getAncestor("ViewElement");if(y){let m=`elements.${y.name}`,h=Ie(p,m);h&&(u.object=new ln({name:h.identifier}))}}}else if(Rt(u)){let y=Ie(p,u.calleeNamespace);y&&(u.calleeNamespace=y.identifier)}})}a(x,"resolveComponentRef");function c(p){p.forEach(u=>{let y=t.findComponentRefByComponentName(u.__raw.name);if(y){let m=ge(new kt({name:"ref",type:"dynamic",expression:new ln({name:y.identifier})}));u.attrs.push(m)}c(u.children)})}a(c,"recursivelyBindRefAttrIfNecessary")})}}a(qt,"collectAllViews");var W=D("IR builder"),fe=class{static{a(this,"NASLAppIRBuilderPlugin")}buildIR(e,r,i){let o=Qt(r.variables),s=Gt(e.logics,o),l=qt(e,r,o);return{baseCtx:o,configs:d(),apis:s,views:l,packages:f()};function d(){let b={...de.functions}.makeBasePlatformConfig(e,r,i),g=Tt(e,r,i),t=r.bindEvents.map(ae).filter(F);return{config:i,basePlatformConfig:b,events:t,metaData:g,globalVariables:r.variables,themeCSS:r.genThemeCSS(),document:{icon:r.documentIcon}}}function f(){let w=Kt(e).map(b=>({kind:"extension",name:b.name,version:b.version,hasCss:!0}));return W.debug({extensionPackages:w}),[...w,{kind:"standard",name:"@lcap/pc-react-ui",version:"1.0.0"}]}}};fe=wt([It()],fe);import{Argument as vn,CallFunction as Bt,Identifier as ce,MemberExpression as Ht,StringLiteral as wn,Unparsed as Jt,asserts as Wt,transfromMetadataType as Le,transfromUnionTypeAnnotation as bn}from"@lcap/nasl";import{isAbort as Xt,isAnchor as Yt,isAnonymousFunction as Zt,isArgument as $t,isAssignee as _t,isAssignment as er,isBatchAssignment as nr,isBinaryExpression as tr,isBindAttribute as xn,isBlock as rr,isBooleanLiteral as ir,isCallAuthInterface as or,isCallConnector as sr,isCallFunction as An,isCallInterface as ar,isCallLogic as he,isCallQueryComponent as cr,isComment as lr,isDefaultValue as kn,isDestination as pr,isEnd as ur,isExternalDestination as dr,isForEachStatement as mr,isIdentifier as ye,isIfStatement as fr,isJSBlock as gr,isJavaLogic as hr,isLogic as yr,isLogicItem as vr,isMatch as Dn,isMatchCase as wr,isMemberExpression as br,isNew as xr,isNewComposite as Sn,isNewList as Tn,isNewMap as Ar,isNullLiteral as kr,isNumericLiteral as Dr,isOqlQueryComponent as Sr,isParam as Tr,isProcessOutcome as Rr,isProcessOutcomes as Nr,isQueryAggregateExpression as Pr,isQueryFieldExpression as Ir,isQueryFromExpression as jr,isQueryGroupByExpression as Cr,isQueryJoinExpression as Lr,isQueryLimitExpression as Er,isQueryOrderByExpression as Fr,isQuerySelectExpression as Vr,isReturn as Mr,isSqlQueryComponent as Or,isStart as zr,isStringInterpolation as Ur,isStringLiteral as Qr,isSubLogic as Gr,isSwitchCase as Kr,isSwitchStatement as Rn,isUnaryExpression as qr,isUnparsed as Br,isValidationRule as Hr,isVariable as Jr,isWhileStatement as Wr}from"@lcap/nasl/out/concepts/utils/asserts";import*as Nn from"json5";import{isNil as Xr}from"lodash";var yn={required:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",filled:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",notEmpty:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",empty:"\u8868\u5355\u9879\u5FC5\u987B\u4E3A\u7A7A",minLength:"\u4E0D\u5F97\u5C11\u4E8E{args}\u4E2A\u5B57\u7B26",maxLength:"\u4E0D\u5F97\u8D85\u8FC7{args}\u4E2A\u5B57\u7B26",rangeLength:"\u8BF7\u8F93\u5165{args}-{args}\u4E2A\u5B57\u7B26",min:"\u4E0D\u80FD\u5C0F\u4E8E{args}",max:"\u4E0D\u80FD\u5927\u4E8E{args}",range:"\u8303\u56F4\u5728{args}-{args}\u4E4B\u95F4",pattern:"\u8868\u5355\u9879\u683C\u5F0F\u4E0D\u6B63\u786E",is:"\u5FC5\u987B\u4E0E{args}\u76F8\u540C",isNot:"\u5FC5\u987B\u4E0E{args}\u4E0D\u540C",equals:"\u5FC5\u987B\u7B49\u4E8E{args}",notEquals:"\u5FC5\u987B\u4E0D\u7B49\u4E8E{args}",confirmed:"\u4E24\u6B21\u8F93\u5165\u7684\u5BC6\u7801\u4E0D\u4E00\u81F4",includes:"\u5FC5\u987B\u5305\u542B{args}",excludes:"\u4E0D\u80FD\u5305\u542B{args}",included:"\u5FC5\u987B\u4E3A{args}\u4E2D\u7684\u503C",excluded:"\u4E0D\u80FD\u4E3A{args}\u4E2D\u7684\u503C",unique:"\u8BE5\u8868\u5355\u9879\u5DF2\u7ECF\u5B58\u5728",noDuplicates:"\u4E0D\u80FD\u51FA\u73B0\u91CD\u590D\u9879",string:"\u8BF7\u8F93\u5165\u5B57\u7B26\u4E32",number:"\u8BF7\u8F93\u5165\u6570\u5B57",numeric:"\u8BF7\u8F93\u5165\u6570\u5B57",integer:"\u8BF7\u8F93\u5165\u6574\u6570",decimal:"\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\u7684\u5C0F\u6570",boolean:"\u5FC5\u987B\u4E3A\u5E03\u5C14\u7C7B\u578B",function:"\u5FC5\u987B\u4E3A\u51FD\u6570",object:"\u5FC5\u987B\u4E3A\u5BF9\u8C61",plainObject:"\u5FC5\u987B\u4E3A\u7B80\u5355\u5BF9\u8C61",array:"\u5FC5\u987B\u4E3A\u6570\u7EC4",alpha:"\u8BF7\u8F93\u5165\u5B57\u6BCD",alphaNum:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u6216\u6570\u5B57",alphaDash:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u6216\u4E0B\u5212\u7EBF",alphaNumDash:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF",alphaSpaces:"\u4EE5\u5B57\u6BCD\u6216\u7A7A\u683C\u7EC4\u6210",lowerCase:"\u4E0D\u80FD\u51FA\u73B0\u5927\u5199\u5B57\u6BCD",upperCase:"\u4E0D\u80FD\u51FA\u73B0\u5C0F\u5199\u5B57\u6BCD","^az":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u5F00\u5934","^az09":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934","^az09_":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u5F00\u5934","^azAZ":"\u4EE5\u5B57\u6BCD\u5F00\u5934","^azAZ09":"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934","^azAZ09_":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u5F00\u5934",az09$:"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u5C3E",azAZ09$:"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u5C3E","^09$":"\u4EE5\u6570\u5B57\u7EC4\u6210","^az09$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u7EC4\u6210","^az09-$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E2D\u5212\u7EBF\u7EC4\u6210","^az09-.$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'.'\u7EC4\u6210","^azAZ09$":"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u7EC4\u6210","^azAZ09-$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216'-'\u7EC4\u6210","^az09-_$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'_'\u7EC4\u6210","^azAZ09_$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216'_'\u7EC4\u6210","^azAZ09-_$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'_'\u7EC4\u6210","without--":"\u4E0D\u80FD\u8FDE\u7EED\u51FA\u73B0\u4E2D\u5212\u7EBF",without__:"\u4E0D\u80FD\u8FDE\u7EED\u51FA\u73B0\u4E0B\u5212\u7EBF",email:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1",ip:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 IP",ipRange:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 IP \u6BB5",port:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u7AEF\u53E3",url:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 URL",macAddress:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 MAC \u5730\u5740",md5:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 MD5",ascii:"\u5FC5\u987B\u4E3A ASCII",base32:"\u5FC5\u987B\u4E3A base32 \u7F16\u7801",base64:"\u5FC5\u987B\u4E3A base64 \u7F16\u7801",byteLength:"\u5B57\u8282\u957F\u5EA6\u4E0D\u5728\u6307\u5B9A\u8303\u56F4\u5185",dataURI:"\u5FC5\u987B\u4E3A DataURI \u7F16\u7801",magnetURI:"\u5FC5\u987B\u4E3A MagnetURI \u7F16\u7801",divisibleBy:"\u5FC5\u987B\u88AB{args}\u6574\u9664",fullWidth:"\u5FC5\u987B\u8F93\u5165\u5168\u89D2\u5B57\u7B26",halfWidth:"\u5FC5\u987B\u8F93\u5165\u534A\u89D2\u5B57\u7B26",hash:"\u54C8\u5E0C\u7F16\u7801\u4E0D\u7B26\u5408{args}\u7B97\u6CD5",hexColor:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u5341\u516D\u8FDB\u5236\u989C\u8272\u503C",hex:"\u8BF7\u8F93\u5165\u5341\u516D\u8FDB\u5236\u6570",identityCard:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u8EAB\u4EFD\u8BC1\u53F7\u7801",creditCard:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u4FE1\u7528\u5361\u53F7",fqdn:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u5168\u9650\u5B9A\u57DF\u540D",ipOrFQDN:"\u8BF7\u8F93\u5165\u4E00\u4E2A\u5408\u6CD5 IP \u6216\u5168\u9650\u5B9A\u57DF\u540D",isbn:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u6807\u51C6\u4E66\u53F7",issn:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u6807\u51C6\u8FDE\u7EED\u51FA\u7248\u7269\u7F16\u53F7",isin:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u8BC1\u5238\u8BC6\u522B\u7801",iso8601:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO8601 \u65E5\u671F\u683C\u5F0F",rfc3339:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 RFC3339 \u65E5\u671F\u683C\u5F0F",iso31661Alpha2:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO 3166-1 Alpha-2 \u56FD\u5BB6\u4EE3\u7801",iso31661Alpha3:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO 3166-1 Alpha-3 \u56FD\u5BB6\u4EE3\u7801",json:"\u5FC5\u987B\u4E3A JSON \u683C\u5F0F\u5B57\u7B26\u4E32",jwt:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 JSON Web Token",latLong:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u7ECF\u7EAC\u5EA6\u5750\u6807\uFF0C\u5982 (-17.738223, 85.605469)",mobile:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u624B\u673A\u53F7\u7801",mongoId:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684 MongoDB \u5BF9\u8C61 ID",postalCode:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u90AE\u653F\u7F16\u7801",uuid:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684 UUID",chinese:"\u8BF7\u8F93\u5165\u4E2D\u6587\u5185\u5BB9"};var ve=D("JavaScriptCodeGen");function O(n,e){return r(o(n));function r(t){return vr(t)?g(t):yr(t)?l(t):d(t)}function i(t){let v=t.typeAnnotation||t.__TypeAnnotation,{sortedTypeKey:x,typeKind:c,typeName:p,typeNamespace:u}=v||{};if(u?.endsWith(".metadataTypes")){let m=t.app.findNodeByCompleteName(u+"."+p)?.typeAnnotation;m&&(x=`${m.typeNamespace}.${m.typeName}`,c=m.typeKind,p=m.typeName)}if(v&&(!["primitive","union"].includes(c??"")||p==="DateTime")){let m=r(t);return Bt.from({calleeName:"genInitFromSchema",arguments:[new vn({expression:new wn({value:x})}),new vn({expression:new Jt({code:m})})]},t.parentNode,t.parentKey)}return t}function o(t){return An(t)||he(t)||Sn(t)||kn(t)?i(t):t}function s(t){return`(${x()})=>(${v()})`;function v(){let c=t.logics[0];return O(c,e)}function x(){return t.params.map(c=>c.name).toString()}}function l(t){let v="async (";return Array.isArray(t.params)&&(v+=t.params.map(x=>x.name).toString()),v+=") => {",Array.isArray(t.params)&&t.params.forEach(x=>{let c=O(x,e);x.name!==c&&(v+=`${x.name} = ${c};
4746
+ `}},environment:"vanilla"};import{Container as oo}from"inversify";import"@abraham/reflection";import{Argument as bt,Assignment as xt,BinaryExpression as At,BindAttribute as kt,BindEvent as Dt,CallFunction as St,Identifier as ln,Logic as un,Param as dn,StringLiteral as mn,genMetaData as Tt}from"@lcap/nasl";import{isCallLogic as Rt,isConnector as Nt,isIdentifier as Pe,isMemberExpression as Pt}from"@lcap/nasl/out/concepts/utils/asserts";import{injectable as It}from"inversify";import{isObject as jt,pick as Ct}from"lodash";var $=class{static{a(this,"StateActionIR")}__raw;deps;params;logics;name;kind;constructor(e){Object.assign(this,e)}};function F(n){return n!=null}a(F,"isNotNil");function $e(n){return Array.isArray(n)?n:[n]}a($e,"ensureArray");function _e(){throw new Error("todo")}a(_e,"todo");function H(n){let e=n?JSON.stringify(n):String(n);throw new Error(`not implemented for ${e}`)}a(H,"notImplemented");function M(n){let e=n?JSON.stringify(n):String(n);throw new Error(`never implemented for ${e}. Should never be here!`)}a(M,"neverImplemented");function G(n){throw new Error(`assertNever failed: ${n}`)}a(G,"assertNever");var en=a(n=>n.startsWith("elements."),"isNameAElementRef"),nn=a(n=>n.split(".").at(1),"extractComponentNameFromElementRefName"),Te=a(n=>`${n}Ref`,"componentNameToRefName");function Re(n){return n.kind==="library"}a(Re,"isComponentFromLib");function tn(n){return n.tag==="template"}a(tn,"isReferencedComponentATemplate");import{isFunction as pt}from"lodash";import ut from"pino";var dt=process.env.LOG_LEVEL||"info",mt=ut({level:dt,transport:{target:"pino-pretty",options:{colorize:!0}}});function D(n){return mt.child({},{msgPrefix:`[${n}] `})}a(D,"Logger");function rn(n){if(!pt(n))throw new Error;let e=n.name,r=Object.getOwnPropertyNames(n.prototype),i=D(e);return r.forEach(o=>{let s=n.prototype[o];n.prototype[o]=function(...l){return i.trace({method:o,args:l}),s.apply(this,l)}}),n}a(rn,"logging");import{Argument as on,CallFunction as ft,StringLiteral as gt,Unparsed as ht}from"@lcap/nasl";function Ne(n,e){let r=n?.split(".")||[],o=r[0]==="app"?1:0;return r.findIndex((s,l)=>l%2===o?s===e:!1)}a(Ne,"findConceptKeyWordIndexFromNamespace");function sn(n){let e=n.typeAnnotation||n.__TypeAnnotation,{sortedTypeKey:r,typeKind:i,typeName:o,typeNamespace:s}=e||{};if(s?.endsWith(".metadataTypes")){let w=(n.app.findNodeByCompleteName(s+"."+o)||{}).typeAnnotation||{};r=`${w.typeNamespace}.${w.typeName}`,i=w.typeKind,o=w.typeName}let l=e&&(!["primitive","union"].includes(i)||o==="DateTime"),d=n.defaultValue?.expression?n.defaultValue.expression:new ht({code:void 0});return l?ft.from({calleeName:"genInitFromSchema",arguments:[new on({expression:new gt({value:r})}),new on({expression:d})]},n.parentNode,n.parentKey):d}a(sn,"prepareVariableDefaultValue");import{firstUpperCase as yt}from"@lcap/nasl/out/utils/string";var se=a(n=>n.replaceAll("_","-").replace(/(?:-)([a-zA-Z0-9])/g,(e,r)=>r.toUpperCase()),"trueKebab2Camel"),_=a(n=>yt(se(n)),"kebab2Pascal");function an(n){return/^[A-Z]/.test(n)}a(an,"startsWithUpperCase");function cn(n){return F(n)&&n!==""}a(cn,"isNotEmptyString");function C({name:n,functions:e}){return{name:n,functions:e}}a(C,"makePlugin");var vt={enabled:!1,locale:"zh-CN",messages:{},I18nList:[]},de=C({name:"MetadataPlugin",functions:{makeBasePlatformConfig(n,e,r){let i=r?.lowcodeDomain,o=r?.envNuimsDomain?.[r?.env]||r?.nuimsDomain,s=r?.envLcpDomain?.[r?.env]?.lcpDomain||r?.lowcodeDomain;return{appConfig:{project:n.name,domainName:n.name,nuimsDomain:o,lowcodeDomain:i,envNuimsDomain:r.envNuimsDomain,tenantType:r.tenantType,tenantLevel:r.tenantLevel,extendedConfig:r.extendedConfig,envConfig:{lowcodeDomain:s},tenant:r.tenant,documentTitle:e.documentTitle,i18nInfo:vt},dnsAddr:n.dnsAddr,tenant:r.tenant,env:r.env,hasUserCenter:n.hasUserCenter,hasAuth:n.hasAuth,basePath:e.prefixPath,sysPrefixPath:n.sysPrefixPath,frontendName:e.name}}}});function wt(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(wt,"_ts_decorate");var me=class n{static{a(this,"StateContextIR")}providedStates;consumedStateNames;actions;parentCtx;constructor(e,r,i,o){this.providedStates=e,this.consumedStateNames=r,this.actions=i,this.parentCtx=o}recursivelyExtractTreeStates(){return[...this.providedStates.filter(e=>e.kind==="tree"),...this.parentCtx?.recursivelyExtractTreeStates()??[]]}resolveExprToString(e,r,i){return r.printSyntaxNode(e,{resolve({kind:o,value:s}){switch(o){case"calleeNamespace":return i.resolveCalleeNamespace(s);case"identifier":return i.resolveIdentifier(s)}}})}static fromParent(e){return new n([],[],[],e)}provide(e){return this.providedStates.push(e),this}provideAction(e){return this.actions.push(e),this}findStateByName(e){return this.providedStates.find(r=>r.identifier===e)??this.parentCtx?.findStateByName(e)}findActionByName(e){return this.actions.find(r=>r.name===e)??this.parentCtx?.findActionByName(e)}findComponentRefByComponentName(e){return this.findStateByName(Te(e))??this.parentCtx?.findComponentRefByComponentName(e)}};function Lt(n,e){let r=[],i=[];return n.dependencies&&r.push(...n.dependencies),n.interfaceDependencies&&r.push(...n.interfaceDependencies),e.views&&i.push(...e.views),r.forEach(o=>{o.views&&i.push(...o.views)}),i}a(Lt,"collectTopLevelViews");function ee(n){return{name:n.name,typeAnnotation:n.__TypeAnnotation,defaultValue:n.defaultValue}}a(ee,"paramToIR");function Et(n){if(e(n)||r(n)){if(r(n)){let i=St.from({calleeNamespace:"nasl.auth",calleeName:"has",arguments:[bt.from({expression:new mn({value:n.viewElement.authPath})})]},n.parentNode,n.parentKey);return{__raw:n,concept:n.concept,expression:ne(i),kind:"if"}}else{let i=n.expression;if(i)return{__raw:n,concept:n.concept,expression:ne(i),kind:"if"};W.debug({nodePath:n.nodePath},"\u65E0expression\u7684directive\uFF0C\u53EF\u80FD\u4E3A\u810F\u6570\u636E")}return}else return W.error({nodePath:n.nodePath},`\u9047\u5230\u4E86\u4E0D\u652F\u6301\u7684 directive: ${n.name}`),H(n);function e(i){return i.name==="if"}a(e,"isIfDirective");function r(i){return i.name==="auth"}a(r,"isAuthDirective")}a(Et,"bindDirectiveToIR");function ne(n){return{expr:n,deps:[]}}a(ne,"exprToIR");function ge(n){if(n.type===void 0&&n.name==="rules")return{kind:"validation-rules",concept:"BindAttribute",name:"rules",rules:n.rules,__raw:n};switch(n.type){case"string":{let e=mn.from({value:n.value});if(n.sync)throw W.error({nodePath:n.nodePath},"string\u4E0D\u53EF\u4E3Async"),new Error("string\u4E0D\u53EF\u4E3Async");return{__raw:n,concept:n.concept,kind:"expr",expression:ne(e),name:n.name,sync:!1}}case"static":case"dynamic":return n.type==="dynamic"&&(n.destination?n.expression=n.destination:n.externalDestination&&(n.expression=n.externalDestination,n.name="link")),{__raw:n,concept:n.concept,kind:"expr",expression:ne(n.expression),name:n.name,sync:n.sync??!1};case"component":return{kind:"render",concept:"BindAttribute",component:n.component,scopeVariable:n.scopeVariable,name:n.name};default:G(n)}}a(ge,"bindAttrToIR");function Z(n){return{logic:n,deps:[]}}a(Z,"logicToLogicIR");function fn(n,e){return se(`${e??""}-${n}`)}a(fn,"getHandlerName");function Ft(n){return{value:"change",checked:"change"}[n]??`${n}-change`}a(Ft,"inferChangeEventNameFromAttrName");function ae(n){return{__raw:n,logics:n.logics.map(Z),concept:n.concept,params:n.getContextLogicParams().map(ee),handlerName:fn(n.name,n.parentNode?.name)}}a(ae,"bindViewElementEventToIR");function je(n){return{__raw:n.__raw,logics:n.logics,deps:[],name:n.handlerName,params:n.params,kind:"standalone"}}a(je,"bindEventToAction");var pn="@lcap/pc-react-ui";function Vt(n){let e=n.tag;if(an(e)){let r=n?.app?.dependencies?.find(o=>o.frontends.some(s=>s.viewComponents.some(l=>l.name===e)));return e==="Router"?{kind:"library",libraryName:"react-router-dom",tag:"Outlet"}:{kind:"library",libraryName:r?`@extension/${r.name}`:pn,tag:e}}else if(e){if(e.includes("-"))throw W.error({viewElement:Ct(n,["name","concept","tag"]),nodePath:n.nodePath},"\u4E0D\u652F\u6301\u7684tag\uFF0C\u53EF\u80FD\u4E3A\u810F\u6570\u636E"),new Error(`\u5B58\u5728\u810F\u6570\u636E: ${n.nodePath}`);return{kind:"library",libraryName:pn,tag:e}}throw new Error("empty tag name!")}a(Vt,"getReferencedLibComponent");function Mt(n){n.attrs.flatMap(r=>{if(r.kind==="expr"&&r.sync){if(r.expression.expr)return[r];W.debug(`${r.__raw.nodePath}\u7684expression\u4E3A\u7A7A\uFF0C\u4F46\u4ECD\u4E3A\u53CC\u5411\u7ED1\u5B9A\u3002\u5DF2\u5FFD\u7565\u3002`)}return[]}).forEach(r=>{W.debug({x:r},"\u6784\u9020\u53CC\u5411\u7ED1\u5B9A\u7684handler");let i=d(),o=i.params.at(0),s=new dn({name:o?.name??"event"}),l=un.from({name:"_syncChange",body:[xt.from({left:r.expression.expr,right:s},r.__raw.parentNode,r.__raw.parentKey)],params:[s]});i.logics.unshift(Z(l)),o||i.params.push(ee(s));function d(){let f=Ft(r.name),w=fn(f,r.__raw.parentNode?.name);W.trace({targetEventName:f,targetHandlerName:w});let b=n.events.find(t=>t.handlerName===w);if(b)return b;let h=ae(Dt.from({logics:[],name:"change"},r.__raw.parentNode,"bindEvents"));return n.events.push(h),h}a(d,"findOrCreateBindEvent")})}a(Mt,"prependBindEventForSyncBindAttribute");function gn(n){if(n.logics.length>1){let e=[],r=n.params.map(s=>dn.from(s)),i=n.logics.map(s=>{let l=`${n.name}_${s.logic.name}`,d=un.from({...s.logic.toJSON(),params:r,name:l},s.logic.parentNode,s.logic.parentKey);return Z(d)}),o=new $({...n,logics:i});return e.push(o),i.forEach(s=>{let l=new $({...n,name:s.logic.name,logics:[s],kind:"standalone"});e.push(l)}),e}else return[n]}a(gn,"splitLogicsInActionToMultipleActions");function Ot(n){if(n.some(s=>s.kind!=="if"))throw W.error("mergeIfDirectives\u63A5\u6536\u5230\u4E86\u4E0D\u662Fif\u6307\u4EE4\u7684bindDirectives"),new Error("mergeIfDirectives\u63A5\u6536\u5230\u4E86\u4E0D\u662Fif\u6307\u4EE4\u7684bindDirectives");let[e,...r]=n;if(!e)return n;let i=e.expression.expr;for(let s of r)i=At.from({left:i,operator:"&&",right:s.expression.expr},s.__raw.parentNode,s.__raw.parentKey);return[{kind:"if",concept:"BindDirective",expression:ne(i),__raw:e.__raw}]}a(Ot,"mergeMultipleIfDirectivesIntoConjunctiveNormalForm");function hn(n,e){let r=e.bindAttrs.map(ge),o={directives:Ot(e.bindDirectives.map(Et).filter(F)),attrs:r,events:e.bindEvents.map(ae).filter(F),children:e.children.map(l=>hn(n,l)),component:Vt(e),__raw:e,slot:{scope:e.slotScope||void 0,target:s(e.slotTarget)}};return Mt(o),o.events.forEach(l=>{let d=gn(je(l));for(let f of d)n.provideAction(f)}),o;function s(l){if(!(l==="default"||l===""))return l}a(s,"normalizeSlotTarget")}a(hn,"extractAsComponentInstanceIR");function zt(n){let e=[],r=[];return n.variables.forEach(o=>{let s={kind:"local-logic",initialization:{kind:"static",value:ne(sn(o))},identifier:o.name,typeAnnotation:o.__TypeAnnotation};e.push(s)}),n.bindEvents.forEach(o=>{let s=new $({__raw:o,logics:o.logics.map(Z),deps:[],name:o.name,params:o.getContextLogicParams().map(ee),kind:"view-lifecycle"}),l=gn(s);r.push(...l)}),n.logics.forEach(o=>{r.push(new $({__raw:o,deps:[],name:o.name,params:o.params.map(ee),logics:[o].map(Z),kind:"standalone"}))}),n.params.forEach(o=>{let s={kind:"local-logic",initialization:{kind:"url-param",__raw:ee(o),defaultValue:o.defaultValue?.expression?ne(o.defaultValue.expression):void 0},identifier:o.name,typeAnnotation:o.__TypeAnnotation};e.push(s)}),{consumedStateNames:[],providedStates:e,actions:r}}a(zt,"collectStatesAndActionsFromView");function Ut(n){return n.provide({identifier:"nasl",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useNasl"}}).provide({identifier:"$frontendVariables",kind:"tree",typeAnnotation:null,initialization:{kind:"frontend-variable",hookName:"useFrontendVariables"}}).provide({identifier:"$services",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useServices"}}).provide({identifier:"$destination",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useDestination"}}).provide({identifier:"$library",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useLibrary"}}).provide({identifier:"$link",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useLink"}}).provide({identifier:"userInfo",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useUserInfo"}}).provide({identifier:"genInitFromSchema",kind:"tree",typeAnnotation:null,initialization:{kind:"global-hook",hookName:"useGenInitFromSchema"}})}a(Ut,"enhanceStateContext");function Ie(n,e){if(e&&en(e)){let r=nn(e);if(!r)return;let i=n.findComponentRefByComponentName(r);if(i)return i;let s={kind:"standalone",identifier:Te(r),initialization:{kind:"component-ref",componentName:r},typeAnnotation:null};return n.provide(s),s}}a(Ie,"provideAsComponentRefIfOk");function Qt(n){let e=new me([],[],[],null);return Ut(e)}a(Qt,"makeBaseCtx");var Ce="apiClient";function Gt(n,e){return e.provide({kind:"tree",identifier:Ce,initialization:{kind:"api-client"},typeAnnotation:null}),n.map(Z)}a(Gt,"collectApis");function Kt(n){return n.dependencies.map(r=>{if(!Nt(r)&&r.frontends?.length)return r}).filter(F)}a(Kt,"collectFrontendExtensionModules");function qt(n,e,r){let i=Lt(n,e);return s(i,r);function s(l,d){return l.map(f=>{let w=s(f.children,d),{providedStates:b,actions:h}=zt(f),t=new me(b,[],h,d);x(t);let v=f.elements.map(p=>hn(t,p));return c(v),{__raw:f,childComponents:w,stateContext:t,identifier:f.name,elements:v};function x(p){f.traverseStrictChildren(u=>{if(jt(u)&&"playground"in u&&(u.playground=[]),Pt(u)){if(Pe(u.object)&&Pe(u.property)&&u.object.name==="elements"&&u.property.name==="$ce"){let y=u.getAncestor("ViewElement");if(y){let m=`elements.${y.name}`,g=Ie(p,m);g&&(u.emit=()=>{},u.parentNode&&(u.parentNode.emit=()=>{}),u.replaceNode({name:g.identifier,concept:"Identifier"}))}}else if(Pe(u.object)&&u.object.namespace==="elements.$ce.property"){let y=u.getAncestor("ViewElement");if(y){let m=`elements.${y.name}`,g=Ie(p,m);g&&(u.object=new ln({name:g.identifier}))}}}else if(Rt(u)){let y=Ie(p,u.calleeNamespace);y&&(u.calleeNamespace=y.identifier)}})}a(x,"resolveComponentRef");function c(p){p.forEach(u=>{let y=t.findComponentRefByComponentName(u.__raw.name);if(y){let m=ge(new kt({name:"ref",type:"dynamic",expression:new ln({name:y.identifier})}));u.attrs.push(m)}c(u.children)})}a(c,"recursivelyBindRefAttrIfNecessary")})}}a(qt,"collectAllViews");var W=D("IR builder"),fe=class{static{a(this,"NASLAppIRBuilderPlugin")}buildIR(e,r,i){let o=Qt(r.variables),s=Gt(e.logics,o),l=qt(e,r,o);return{baseCtx:o,configs:d(),apis:s,views:l,packages:f()};function d(){let b={...de.functions}.makeBasePlatformConfig(e,r,i),h=Tt(e,r,i),t=r.bindEvents.map(ae).filter(F);return{config:i,basePlatformConfig:b,events:t,metaData:h,globalVariables:r.variables,themeCSS:r.genThemeCSS(),document:{icon:r.documentIcon}}}function f(){let w=Kt(e).map(b=>({kind:"extension",name:b.name,version:b.version,hasCss:!0}));return W.debug({extensionPackages:w}),[...w,{kind:"standard",name:"@lcap/pc-react-ui",version:"1.0.0"}]}}};fe=wt([It()],fe);import{Argument as vn,CallFunction as Bt,Identifier as ce,MemberExpression as Ht,StringLiteral as wn,Unparsed as Jt,asserts as Wt,transfromMetadataType as Le,transfromUnionTypeAnnotation as bn}from"@lcap/nasl";import{isAbort as Xt,isAnchor as Yt,isAnonymousFunction as Zt,isArgument as $t,isAssignee as _t,isAssignment as er,isBatchAssignment as nr,isBinaryExpression as tr,isBindAttribute as xn,isBlock as rr,isBooleanLiteral as ir,isCallAuthInterface as or,isCallConnector as sr,isCallFunction as An,isCallInterface as ar,isCallLogic as he,isCallQueryComponent as cr,isComment as lr,isDefaultValue as kn,isDestination as pr,isEnd as ur,isExternalDestination as dr,isForEachStatement as mr,isIdentifier as ye,isIfStatement as fr,isJSBlock as gr,isJavaLogic as hr,isLogic as yr,isLogicItem as vr,isMatch as Dn,isMatchCase as wr,isMemberExpression as br,isNew as xr,isNewComposite as Sn,isNewList as Tn,isNewMap as Ar,isNullLiteral as kr,isNumericLiteral as Dr,isOqlQueryComponent as Sr,isParam as Tr,isProcessOutcome as Rr,isProcessOutcomes as Nr,isQueryAggregateExpression as Pr,isQueryFieldExpression as Ir,isQueryFromExpression as jr,isQueryGroupByExpression as Cr,isQueryJoinExpression as Lr,isQueryLimitExpression as Er,isQueryOrderByExpression as Fr,isQuerySelectExpression as Vr,isReturn as Mr,isSqlQueryComponent as Or,isStart as zr,isStringInterpolation as Ur,isStringLiteral as Qr,isSubLogic as Gr,isSwitchCase as Kr,isSwitchStatement as Rn,isUnaryExpression as qr,isUnparsed as Br,isValidationRule as Hr,isVariable as Jr,isWhileStatement as Wr}from"@lcap/nasl/out/concepts/utils/asserts";import*as Nn from"json5";import{isNil as Xr}from"lodash";var yn={required:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",filled:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",notEmpty:"\u8868\u5355\u9879\u4E0D\u5F97\u4E3A\u7A7A",empty:"\u8868\u5355\u9879\u5FC5\u987B\u4E3A\u7A7A",minLength:"\u4E0D\u5F97\u5C11\u4E8E{args}\u4E2A\u5B57\u7B26",maxLength:"\u4E0D\u5F97\u8D85\u8FC7{args}\u4E2A\u5B57\u7B26",rangeLength:"\u8BF7\u8F93\u5165{args}-{args}\u4E2A\u5B57\u7B26",min:"\u4E0D\u80FD\u5C0F\u4E8E{args}",max:"\u4E0D\u80FD\u5927\u4E8E{args}",range:"\u8303\u56F4\u5728{args}-{args}\u4E4B\u95F4",pattern:"\u8868\u5355\u9879\u683C\u5F0F\u4E0D\u6B63\u786E",is:"\u5FC5\u987B\u4E0E{args}\u76F8\u540C",isNot:"\u5FC5\u987B\u4E0E{args}\u4E0D\u540C",equals:"\u5FC5\u987B\u7B49\u4E8E{args}",notEquals:"\u5FC5\u987B\u4E0D\u7B49\u4E8E{args}",confirmed:"\u4E24\u6B21\u8F93\u5165\u7684\u5BC6\u7801\u4E0D\u4E00\u81F4",includes:"\u5FC5\u987B\u5305\u542B{args}",excludes:"\u4E0D\u80FD\u5305\u542B{args}",included:"\u5FC5\u987B\u4E3A{args}\u4E2D\u7684\u503C",excluded:"\u4E0D\u80FD\u4E3A{args}\u4E2D\u7684\u503C",unique:"\u8BE5\u8868\u5355\u9879\u5DF2\u7ECF\u5B58\u5728",noDuplicates:"\u4E0D\u80FD\u51FA\u73B0\u91CD\u590D\u9879",string:"\u8BF7\u8F93\u5165\u5B57\u7B26\u4E32",number:"\u8BF7\u8F93\u5165\u6570\u5B57",numeric:"\u8BF7\u8F93\u5165\u6570\u5B57",integer:"\u8BF7\u8F93\u5165\u6574\u6570",decimal:"\u8BF7\u8F93\u5165\u6B63\u786E\u683C\u5F0F\u7684\u5C0F\u6570",boolean:"\u5FC5\u987B\u4E3A\u5E03\u5C14\u7C7B\u578B",function:"\u5FC5\u987B\u4E3A\u51FD\u6570",object:"\u5FC5\u987B\u4E3A\u5BF9\u8C61",plainObject:"\u5FC5\u987B\u4E3A\u7B80\u5355\u5BF9\u8C61",array:"\u5FC5\u987B\u4E3A\u6570\u7EC4",alpha:"\u8BF7\u8F93\u5165\u5B57\u6BCD",alphaNum:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u6216\u6570\u5B57",alphaDash:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u6216\u4E0B\u5212\u7EBF",alphaNumDash:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF",alphaSpaces:"\u4EE5\u5B57\u6BCD\u6216\u7A7A\u683C\u7EC4\u6210",lowerCase:"\u4E0D\u80FD\u51FA\u73B0\u5927\u5199\u5B57\u6BCD",upperCase:"\u4E0D\u80FD\u51FA\u73B0\u5C0F\u5199\u5B57\u6BCD","^az":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u5F00\u5934","^az09":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934","^az09_":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u5F00\u5934","^azAZ":"\u4EE5\u5B57\u6BCD\u5F00\u5934","^azAZ09":"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934","^azAZ09_":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u5F00\u5934",az09$:"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u5C3E",azAZ09$:"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u5C3E","^09$":"\u4EE5\u6570\u5B57\u7EC4\u6210","^az09$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u7EC4\u6210","^az09-$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E2D\u5212\u7EBF\u7EC4\u6210","^az09-.$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'.'\u7EC4\u6210","^azAZ09$":"\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u7EC4\u6210","^azAZ09-$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216'-'\u7EC4\u6210","^az09-_$":"\u4EE5\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'_'\u7EC4\u6210","^azAZ09_$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u6216'_'\u7EC4\u6210","^azAZ09-_$":"\u4EE5\u5B57\u6BCD\u3001\u6570\u5B57\u3001'-'\u6216'_'\u7EC4\u6210","without--":"\u4E0D\u80FD\u8FDE\u7EED\u51FA\u73B0\u4E2D\u5212\u7EBF",without__:"\u4E0D\u80FD\u8FDE\u7EED\u51FA\u73B0\u4E0B\u5212\u7EBF",email:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1",ip:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 IP",ipRange:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 IP \u6BB5",port:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u7AEF\u53E3",url:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 URL",macAddress:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 MAC \u5730\u5740",md5:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684 MD5",ascii:"\u5FC5\u987B\u4E3A ASCII",base32:"\u5FC5\u987B\u4E3A base32 \u7F16\u7801",base64:"\u5FC5\u987B\u4E3A base64 \u7F16\u7801",byteLength:"\u5B57\u8282\u957F\u5EA6\u4E0D\u5728\u6307\u5B9A\u8303\u56F4\u5185",dataURI:"\u5FC5\u987B\u4E3A DataURI \u7F16\u7801",magnetURI:"\u5FC5\u987B\u4E3A MagnetURI \u7F16\u7801",divisibleBy:"\u5FC5\u987B\u88AB{args}\u6574\u9664",fullWidth:"\u5FC5\u987B\u8F93\u5165\u5168\u89D2\u5B57\u7B26",halfWidth:"\u5FC5\u987B\u8F93\u5165\u534A\u89D2\u5B57\u7B26",hash:"\u54C8\u5E0C\u7F16\u7801\u4E0D\u7B26\u5408{args}\u7B97\u6CD5",hexColor:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u5341\u516D\u8FDB\u5236\u989C\u8272\u503C",hex:"\u8BF7\u8F93\u5165\u5341\u516D\u8FDB\u5236\u6570",identityCard:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u8EAB\u4EFD\u8BC1\u53F7\u7801",creditCard:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u4FE1\u7528\u5361\u53F7",fqdn:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u5168\u9650\u5B9A\u57DF\u540D",ipOrFQDN:"\u8BF7\u8F93\u5165\u4E00\u4E2A\u5408\u6CD5 IP \u6216\u5168\u9650\u5B9A\u57DF\u540D",isbn:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u6807\u51C6\u4E66\u53F7",issn:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u6807\u51C6\u8FDE\u7EED\u51FA\u7248\u7269\u7F16\u53F7",isin:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u56FD\u9645\u8BC1\u5238\u8BC6\u522B\u7801",iso8601:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO8601 \u65E5\u671F\u683C\u5F0F",rfc3339:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 RFC3339 \u65E5\u671F\u683C\u5F0F",iso31661Alpha2:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO 3166-1 Alpha-2 \u56FD\u5BB6\u4EE3\u7801",iso31661Alpha3:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 ISO 3166-1 Alpha-3 \u56FD\u5BB6\u4EE3\u7801",json:"\u5FC5\u987B\u4E3A JSON \u683C\u5F0F\u5B57\u7B26\u4E32",jwt:"\u5FC5\u987B\u4E3A\u5408\u6CD5\u7684 JSON Web Token",latLong:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u7ECF\u7EAC\u5EA6\u5750\u6807\uFF0C\u5982 (-17.738223, 85.605469)",mobile:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u624B\u673A\u53F7\u7801",mongoId:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684 MongoDB \u5BF9\u8C61 ID",postalCode:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684\u90AE\u653F\u7F16\u7801",uuid:"\u8BF7\u8F93\u5165\u5408\u6CD5\u7684 UUID",chinese:"\u8BF7\u8F93\u5165\u4E2D\u6587\u5185\u5BB9"};var ve=D("JavaScriptCodeGen");function O(n,e){return r(o(n));function r(t){return vr(t)?h(t):yr(t)?l(t):d(t)}function i(t){let v=t.typeAnnotation||t.__TypeAnnotation,{sortedTypeKey:x,typeKind:c,typeName:p,typeNamespace:u}=v||{};if(u?.endsWith(".metadataTypes")){let m=t.app.findNodeByCompleteName(u+"."+p)?.typeAnnotation;m&&(x=`${m.typeNamespace}.${m.typeName}`,c=m.typeKind,p=m.typeName)}if(v&&(!["primitive","union"].includes(c??"")||p==="DateTime")){let m=r(t);return Bt.from({calleeName:"genInitFromSchema",arguments:[new vn({expression:new wn({value:x})}),new vn({expression:new Jt({code:m})})]},t.parentNode,t.parentKey)}return t}function o(t){return An(t)||he(t)||Sn(t)||kn(t)?i(t):t}function s(t){return`(${x()})=>(${v()})`;function v(){let c=t.logics[0];return O(c,e)}function x(){return t.params.map(c=>c.name).toString()}}function l(t){let v="async (";return Array.isArray(t.params)&&(v+=t.params.map(x=>x.name).toString()),v+=") => {",Array.isArray(t.params)&&t.params.forEach(x=>{let c=O(x,e);x.name!==c&&(v+=`${x.name} = ${c};
4747
4747
  `)}),Array.isArray(t.variables)&&t.variables.forEach(x=>{v+=`let ${O(x,e)};
4748
4748
  `}),Array.isArray(t.returns)&&t.returns.forEach(x=>{v+=`let ${O(x,e)};
4749
- `}),Array.isArray(t.body)&&t.body.forEach(x=>{if(Xr(x))throw ve.error(`${t.nodePath} \u7684 body \u6709\u7A7A\u503C`),new Error("");v+=g(x),v+=`
4750
- `}),v+="}",v}function d(t){if(Mr(t)){let p=function(u){let y="",m=u.typeAnnotation||u.__TypeAnnotation,h=m&&(!["primitive","union"].includes(m.typeKind)||m.typeName==="DateTime");h&&(y+=`genInitFromSchema('${m?.sortedTypeKey}',`);let A=u.defaultValue?.toJS?.()??"undefined";return y+=A,h&&(y+=")"),y};var v=p;a(p,"makeRight");let x=e?.resolve?.({kind:"identifier",value:new ce({name:t.name})})??t.name,c=p(t);return`${x} = ${c}`}else if(Tr(t)){let x=t.defaultValue?O(t.defaultValue,e):void 0;return x?`${t.name} === undefined ? ${x} : ${t.name}`:`${t.name}`}else if(Jr(t)){let x=t.typeAnnotation||t.__TypeAnnotation,{sortedTypeKey:c,typeKind:p,typeName:u,typeNamespace:y}=x||{};if(y?.endsWith(".metadataTypes")){let k=(t.app.findNodeByCompleteName(y+"."+u)||{}).typeAnnotation||{};c=`${k.typeNamespace}.${k.typeName}`,p=k.typeKind,u=k.typeName}let m=x&&(!["primitive","union"].includes(p)||u==="DateTime"),h=`${t.name} = `;if(m&&(h+=`genInitFromSchema('${c}',`),t.defaultValue?.expression){let A=O(t.defaultValue.expression,e);h+=A}else h+="undefined";return m&&(h+=")"),h}else if(kn(t)){let x="";return["Date","Time","DateTime"].includes(t.parentNode?.typeAnnotation?.typeName)&&t.expression?.value===""?"null":(x+=t.expression?O(t.expression,e):"undefined",x)}else return H(t)}function f(t){if(t.calleeNamespace){let v=t.calleeNamespace,x=v.startsWith("extensions."),c=v.startsWith("extensions.")&&v.includes(".frontends."),p=`'${t.calleeNamespace}.${t.calleeName}'`;return t.calleeNamespace.startsWith("app.dataSources.")?`apiClient[${p}]`:x?c?`$library['${v.split(".")[1]}']['${t.calleeName}']`:`apiClient[${p}]`:`${e?.resolve?.({kind:"calleeNamespace",value:t.calleeNamespace})??t.calleeNamespace}.${t.calleeName}`}else return e?.resolve?.({kind:"identifier",value:new ce({name:t.calleeName})})??t.calleeName}function w(t){let v=f(t),x=he(t)?c(t).join(", "):t.arguments.map(p=>g(p)).join(", ");return`${v}?.(${x})`;function c(p){let u="";u+=`
4749
+ `}),Array.isArray(t.body)&&t.body.forEach(x=>{if(Xr(x))throw ve.error(`${t.nodePath} \u7684 body \u6709\u7A7A\u503C`),new Error("");v+=h(x),v+=`
4750
+ `}),v+="}",v}function d(t){if(Mr(t)){let p=function(u){let y="",m=u.typeAnnotation||u.__TypeAnnotation,g=m&&(!["primitive","union"].includes(m.typeKind)||m.typeName==="DateTime");g&&(y+=`genInitFromSchema('${m?.sortedTypeKey}',`);let A=u.defaultValue?.toJS?.()??"undefined";return y+=A,g&&(y+=")"),y};var v=p;a(p,"makeRight");let x=e?.resolve?.({kind:"identifier",value:new ce({name:t.name})})??t.name,c=p(t);return`${x} = ${c}`}else if(Tr(t)){let x=t.defaultValue?O(t.defaultValue,e):void 0;return x?`${t.name} === undefined ? ${x} : ${t.name}`:`${t.name}`}else if(Jr(t)){let x=t.typeAnnotation||t.__TypeAnnotation,{sortedTypeKey:c,typeKind:p,typeName:u,typeNamespace:y}=x||{};if(y?.endsWith(".metadataTypes")){let k=(t.app.findNodeByCompleteName(y+"."+u)||{}).typeAnnotation||{};c=`${k.typeNamespace}.${k.typeName}`,p=k.typeKind,u=k.typeName}let m=x&&(!["primitive","union"].includes(p)||u==="DateTime"),g=`${t.name} = `;if(m&&(g+=`genInitFromSchema('${c}',`),t.defaultValue?.expression){let A=O(t.defaultValue.expression,e);g+=A}else g+="undefined";return m&&(g+=")"),g}else if(kn(t)){let x="";return["Date","Time","DateTime"].includes(t.parentNode?.typeAnnotation?.typeName)&&t.expression?.value===""?"null":(x+=t.expression?O(t.expression,e):"undefined",x)}else return H(t)}function f(t){if(t.calleeNamespace){let v=t.calleeNamespace,x=v.startsWith("extensions."),c=v.startsWith("extensions.")&&v.includes(".frontends."),p=`'${t.calleeNamespace}.${t.calleeName}'`;return t.calleeNamespace.startsWith("app.dataSources.")?`apiClient[${p}]`:x?c?`$library['${v.split(".")[1]}']['${t.calleeName}']`:`apiClient[${p}]`:`${e?.resolve?.({kind:"calleeNamespace",value:t.calleeNamespace})??t.calleeNamespace}.${t.calleeName}`}else return e?.resolve?.({kind:"identifier",value:new ce({name:t.calleeName})})??t.calleeName}function w(t){let v=f(t),x=he(t)?c(t).join(", "):t.arguments.map(p=>h(p)).join(", ");return`${v}?.(${x})`;function c(p){let u="";u+=`
4751
4751
  config: {
4752
4752
  download: false,
4753
4753
  },
4754
4754
  headers: {
4755
4755
  "lcap-calllogic-uuid": "${p.uuid}",
4756
- },`;let y=p.calleeName;if(p.isProcessV2Logic)throw ve.error("\u7FFB\u8BD1\u5668\u5C1A\u672A\u652F\u6301\u6D41\u7A0BV2\u7684\u903B\u8F91"),new Error("\u7FFB\u8BD1\u5668\u5C1A\u672A\u652F\u6301\u6D41\u7A0BV2\u7684\u903B\u8F91");if(p.isViewLogic)return p.arguments.map(h=>g(h));{let A=p.getCallNode()?.params||[],k=A.some(R=>R.spread),T=Ne(p.calleeNamespace,"entities"),I=Ne(p.calleeNamespace,"processes");if(T!==-1){let R=p.arguments,Q=!1;switch(y){case"get":case"delete":{R=[],u+="query: {";let U=A.map((P,S)=>{let K=p.arguments?.[S];return{keyword:P?.name,arg:K}}).map(P=>`
4757
- ${P.keyword}: ${g(P.arg)}`).join(", ");u+=U,u+=`},
4756
+ },`;let y=p.calleeName;if(p.isProcessV2Logic)throw ve.error("\u7FFB\u8BD1\u5668\u5C1A\u672A\u652F\u6301\u6D41\u7A0BV2\u7684\u903B\u8F91"),new Error("\u7FFB\u8BD1\u5668\u5C1A\u672A\u652F\u6301\u6D41\u7A0BV2\u7684\u903B\u8F91");if(p.isViewLogic)return p.arguments.map(g=>h(g));{let A=p.getCallNode()?.params||[],k=A.some(R=>R.spread),T=Ne(p.calleeNamespace,"entities"),I=Ne(p.calleeNamespace,"processes");if(T!==-1){let R=p.arguments,Q=!1;switch(y){case"get":case"delete":{R=[],u+="query: {";let U=A.map((P,S)=>{let K=p.arguments?.[S];return{keyword:P?.name,arg:K}}).map(P=>`
4757
+ ${P.keyword}: ${h(P.arg)}`).join(", ");u+=U,u+=`},
4758
4758
  `;break}case"update":case"createOrUpdate":case"batchUpdate":{u+=`body: {
4759
- `;let U=R.map(P=>`${P.keyword==="body"?p.calleeName==="batchUpdate"?"entities":"entity":P.keyword}: ${g(P.expression)}`).join(`,
4759
+ `;let U=R.map(P=>`${P.keyword==="body"?p.calleeName==="batchUpdate"?"entities":"entity":P.keyword}: ${h(P.expression)}`).join(`,
4760
4760
  `);u+=U,u+=`},
4761
4761
  `,R=[],Q=!0;break}case"updateBy":{u+="body: {";let U=R.map(P=>{let S=P.keyword==="body"?"entity":P.keyword;if(P.expression.returnExpression){let K=JSON.stringify(m(P.expression.returnExpression)).replace(/"__@@(.*?)@@__"/g,"$1");return`${S}: {
4762
4762
  concept: 'Function',
4763
4763
  name: 'filter',
4764
4764
  returnExpression: window.$resolveRequestData(${K})
4765
- }`}return`${S}: ${g(P.expression)}`}).join(",");u+=U,u+=`},
4765
+ }`}return`${S}: ${h(P.expression)}`}).join(",");u+=U,u+=`},
4766
4766
  `,R=[],Q=!0;break}case"deleteBy":{u+="body: ";let U=JSON.stringify(m(R[0].expression.returnExpression)).replace(/"__@@(.*?)@@__"/g,"$1");u+=`{
4767
4767
  concept: 'Function',
4768
4768
  name: 'filter',
4769
4769
  returnExpression: window.$resolveRequestData(${U})
4770
4770
  }`,u+=`,
4771
4771
  `,R=[],Q=!0;break}default:break}let j=R.find(U=>U.keyword==="body");Q||(j?u+=`
4772
- ${j?.keyword}: ${g(j)}`:u+="body: {}")}else{let R=I!==-1,Q=a(j=>!!j?.expression,"isShowArgument");if(u+=`path: {},
4772
+ ${j?.keyword}: ${h(j)}`:u+="body: {}")}else{let R=I!==-1,Q=a(j=>!!j?.expression,"isShowArgument");if(u+=`path: {},
4773
4773
  body: {`,!R){let j=[...A],U;k&&(U=j.pop());let P=j.map((J,N)=>{let Y=p.completeArguments[N];return{keyword:J?.name,arg:Y}}).filter(J=>Q(J.arg)),S=P.map(J=>`
4774
- ${J?.keyword}: ${g(J?.arg)}`).join(", ");if(u+=S,P.length&&(u+=", "),k){let J=p.completeArguments.slice(j.length),N=a(V=>V?.expression,"isShowArgument"),Y=J.filter(V=>N(V)).map(V=>g(V)||"").join(", ");u+=`
4774
+ ${J?.keyword}: ${h(J?.arg)}`).join(", ");if(u+=S,P.length&&(u+=", "),k){let J=p.completeArguments.slice(j.length),N=a(V=>V?.expression,"isShowArgument"),Y=J.filter(V=>N(V)).map(V=>h(V)||"").join(", ");u+=`
4775
4775
  ${U.name}: [${Y}],`}let K=p.__TypeArguments?.length?p.__TypeArguments:p.typeArguments;Array.isArray(K)&&K.length&&(u+=`
4776
- __typeArguments: ${Nn.stringify(K)}`)}u+="}"}}return[`{${u}}`];function m(h){if(!h)return;if(h.concept==="Identifier"){let T=g(h);return{concept:h.concept,name:h.name,value:`__@@${T}@@__`,expression:T}}if(h.concept==="MemberExpression"){let{concept:T}=h,{value:I}=h;if(h?.object.name==="_")return{concept:T,name:h.name,value:I,object:h.object,property:h.property};let R=g(h);return h.object?.namespace==="app.enums"?(I=R.replace(/^"(.+)"$/,"$1"),R=void 0,T="StringLiteral"):I=`__@@${R}@@__`,{concept:T,name:h.name,value:I,expression:R}}let A;h.concept==="UnaryExpression"?A=m(h.argument):A=m(h.left);let k=m(h.right);return{concept:h.concept,name:h.name,value:h.value,expression:h.expression,operator:h.operator,left:A,right:k}}}}function b(t){return t.map(g).join(`;
4777
- `)}function g(t){if(Gr(t))return l(t);if(Zt(t)){let c=t.parentNode?.parentNode;return he(c)&&/dataSources\.[^.]+\.entities\.[^.]+\.logics/.test(c.calleeNamespace)&&["update","updateBy","createOrUpdate","batchUpdate"].includes(c.calleeName)?a(()=>{let u="[";return t.body&&Tn(t.body)&&t.body.items.forEach((y,m,h)=>{u+=`'${g(y.property)}'`,m!==h.length-1&&(u+=",")}),u+="]",u},"toJSOfEntityLogicProperties")():s({logics:[t.body],params:t.params})}else{if(Xt(t))return"throw Error('\u7A0B\u5E8F\u4E2D\u6B62');";if(zr(t))return"";if(ur(t)){let c=t.logic.returns.at(0);return c?`return ${c.name};`:"return;"}else if(fr(t)){let c=`if(${g(t.test)}){
4776
+ __typeArguments: ${Nn.stringify(K)}`)}u+="}"}}return[`{${u}}`];function m(g){if(!g)return;if(g.concept==="Identifier"){let T=h(g);return{concept:g.concept,name:g.name,value:`__@@${T}@@__`,expression:T}}if(g.concept==="MemberExpression"){let{concept:T}=g,{value:I}=g;if(g?.object.name==="_")return{concept:T,name:g.name,value:I,object:g.object,property:g.property};let R=h(g);return g.object?.namespace==="app.enums"?(I=R.replace(/^"(.+)"$/,"$1"),R=void 0,T="StringLiteral"):I=`__@@${R}@@__`,{concept:T,name:g.name,value:I,expression:R}}let A;g.concept==="UnaryExpression"?A=m(g.argument):A=m(g.left);let k=m(g.right);return{concept:g.concept,name:g.name,value:g.value,expression:g.expression,operator:g.operator,left:A,right:k}}}}function b(t){return t.map(h).join(`;
4777
+ `)}function h(t){if(Gr(t))return l(t);if(Zt(t)){let c=t.parentNode?.parentNode;return he(c)&&/dataSources\.[^.]+\.entities\.[^.]+\.logics/.test(c.calleeNamespace)&&["update","updateBy","createOrUpdate","batchUpdate"].includes(c.calleeName)?a(()=>{let u="[";return t.body&&Tn(t.body)&&t.body.items.forEach((y,m,g)=>{u+=`'${h(y.property)}'`,m!==g.length-1&&(u+=",")}),u+="]",u},"toJSOfEntityLogicProperties")():s({logics:[t.body],params:t.params})}else{if(Xt(t))return"throw Error('\u7A0B\u5E8F\u4E2D\u6B62');";if(zr(t))return"";if(ur(t)){let c=t.logic.returns.at(0);return c?`return ${c.name};`:"return;"}else if(fr(t)){let c=`if(${h(t.test)}){
4778
4778
  ${b(t.consequent)}
4779
- }`;return t.alternate.length?`${c} else {${b(t.alternate)}}`:c}else if(Rn(t)){let c="";return t.cases.forEach(p=>{c+=g(p)}),c}else if(Kr(t)){let c=t.parentNode;if(!Rn(c))throw new Error("SwitchCase\u7684\u7236\u8282\u70B9\u4E0D\u662FSwitchStatement");let p=c.cases.indexOf(t),u=c.cases.length;if(p===-1)throw new Error("\u65E0\u6CD5\u5728\u7236\u8282\u70B9\u4E2D\u627E\u5230\u6B64SwitchCase");let y="";return p===0?(y="if (",y+=t.test?g(t.test):"",y+=`) {
4780
- `):p!==u-1?(y="else if (",y+=t.test?g(t.test):"",y+=`) {
4779
+ }`;return t.alternate.length?`${c} else {${b(t.alternate)}}`:c}else if(Rn(t)){let c="";return t.cases.forEach(p=>{c+=h(p)}),c}else if(Kr(t)){let c=t.parentNode;if(!Rn(c))throw new Error("SwitchCase\u7684\u7236\u8282\u70B9\u4E0D\u662FSwitchStatement");let p=c.cases.indexOf(t),u=c.cases.length;if(p===-1)throw new Error("\u65E0\u6CD5\u5728\u7236\u8282\u70B9\u4E2D\u627E\u5230\u6B64SwitchCase");let y="";return p===0?(y="if (",y+=t.test?h(t.test):"",y+=`) {
4780
+ `):p!==u-1?(y="else if (",y+=t.test?h(t.test):"",y+=`) {
4781
4781
  `):y+=`else {
4782
- `,Array.isArray(t.consequent)&&t.consequent.forEach(m=>{y+=`${g(m)}
4782
+ `,Array.isArray(t.consequent)&&t.consequent.forEach(m=>{y+=`${h(m)}
4783
4783
  `}),y+=`}
4784
- `,y}else if(mr(t)){let c="",p=t.each?O(t.each,e):"",u=Math.random(),y=Math.round(u*1e4),m=`$forEachListVariable${y}`,h="";return t.end?h=O(t.end,e):t.each&&(h=`(${m} || {}).length`),c+=`var ${m} = ${p};
4784
+ `,y}else if(mr(t)){let c="",p=t.each?O(t.each,e):"",u=Math.random(),y=Math.round(u*1e4),m=`$forEachListVariable${y}`,g="";return t.end?g=O(t.end,e):t.each&&(g=`(${m} || {}).length`),c+=`var ${m} = ${p};
4785
4785
  `,c+=`var $forEachStartVariable${y} = ${t.start&&O(t.start,e)};
4786
- `,c+=`var $forEachEndVariable${y} = ${h};
4786
+ `,c+=`var $forEachEndVariable${y} = ${g};
4787
4787
  `,c+=`if(Array.isArray($forEachListVariable${y})) {
4788
4788
  `,c+=`for (let ${t.index.name} = $forEachStartVariable${y}; `,c+=`${t.index.name} < $forEachEndVariable${y}; ${t.index.name}++) {
4789
4789
  `,c+=`var ${t.item.name} = $forEachListVariable${y}[${t.index.name}];
4790
4790
  `,Array.isArray(t.body)&&t.body.forEach(A=>{c+=`${O(A,e)}
4791
4791
  `}),c+=`}
4792
4792
  `,c+=`}
4793
- `,c}else if(Wr(t)){let c="";return c+="while (",c+=t.test?g(t.test):"",c+=`) {
4794
- `,Array.isArray(t.body)&&t.body.forEach(p=>{c+=`${g(p)}
4793
+ `,c}else if(Wr(t)){let c="";return c+="while (",c+=t.test?h(t.test):"",c+=`) {
4794
+ `,Array.isArray(t.body)&&t.body.forEach(p=>{c+=`${h(p)}
4795
4795
  `}),c+=`}
4796
- `,c}else{if(er(t))return`${O(t.left,{...e,shouldInsertOptional:!1})} = ${O(t.right,e)}`;if(nr(t)){let c="",p=new Map;return t.assignmentLines.forEach(({leftIndex:u,rightIndex:y})=>{let m=JSON.stringify(y);p.has(m)?p.set(m,[...p.get(m),u]):p.set(m,[u])}),p.forEach((u,y)=>{let m=JSON.parse(y)||[],h=u.map(I=>I.length!==1?t.left.members[I[1]]:t.left.expression),[A,k]=[m[0],m[1]],T=k!==void 0?t.rights[A].members[k]:t.rights[A].expression;h.forEach(I=>{c+=`${O(I,{...e,shouldInsertOptional:!1})}`,c+=" = "}),c+=`${g(T)}`,c+=`;
4796
+ `,c}else{if(er(t))return`${O(t.left,{...e,shouldInsertOptional:!1})} = ${O(t.right,e)}`;if(nr(t)){let c="",p=new Map;return t.assignmentLines.forEach(({leftIndex:u,rightIndex:y})=>{let m=JSON.stringify(y);p.has(m)?p.set(m,[...p.get(m),u]):p.set(m,[u])}),p.forEach((u,y)=>{let m=JSON.parse(y)||[],g=u.map(I=>I.length!==1?t.left.members[I[1]]:t.left.expression),[A,k]=[m[0],m[1]],T=k!==void 0?t.rights[A].members[k]:t.rights[A].expression;g.forEach(I=>{c+=`${O(I,{...e,shouldInsertOptional:!1})}`,c+=" = "}),c+=`${h(T)}`,c+=`;
4797
4797
  `}),c}else{if(lr(t))return["/**",...t.value.split(`
4798
4798
  `).map(p=>`* ${p}`),"*/"].join(`
4799
- `);if(he(t))return["jsonSerialize","jsonDeserialize"].includes(t.calleeName)&&t.calleeNamespace==="nasl.util"?w(t):((t.calleeNamespace==="nasl.browser"||t.calleeNamespace==="nasl.configuration"||t.calleeNamespace==="nasl.process")&&(t.calleeNamespace="$global"),`await (${w(t)})`);if(sr(t))return M();if(An(t)){let c=f(t),p="";p+=`${c}`,p+="(";let u;if(t.calleeName==="ToString"){let m=t.arguments[0];u=m.typeAnnotation||m.__TypeAnnotation}else t.calleeName==="FromString"&&(u=t.typeArguments?.[0]);if(t.calleeName==="ToString"&&u&&(p+=`'${u.sortedTypeKey}', `),Array.isArray(t.arguments)&&t.arguments.length&&t.arguments.forEach((m,h)=>{let A=g(m),k=m.typeAnnotation||m.__TypeAnnotation;bn(k,t.app);let{sortedTypeKey:T}=Le(k,t.app);["HasValue"].includes(t.calleeName)&&(A=`{ type: '${T}', value: ${A} }`),p+=A,h!==t.arguments?.length-1&&(p+=", ")}),t.calleeName==="FromString"&&u){let{sortedTypeKey:m}=Le(u,t.app);p+=`, '${m}'`}if(!(["ToString","FromString"].includes(t.calleeName)&&u)&&Array.isArray(t.typeArguments)&&t.typeArguments.length){t.arguments?.length&&(p+=", ");let m=t.typeArguments.length;t.typeArguments?.forEach((h,A)=>{p+=JSON.stringify(h),A!==m-1&&(p+=", ")})}return p+=")",p}else if(ar(t)){let A=function(){let N=t.getAncestor("Connector"),Y=t.getAncestor("Integration");return N&&Y?p?.integration?.connectors?.find?.(V=>V.name===y):N&&!Y?p?.connectorDependencies?.find?.(V=>V.name===y):p?.interfaceDependencies?.find?.(V=>V.name===y)};var v=A;a(A,"getModule");let{calleewholeKey:c,app:p,completeArguments:u}=t,[,y,,m]=c.split("."),k=A()?.interfaces?.find?.(N=>N.name===m);if(!k)throw!t.calleeNamespace||!t.calleeName?new Error("\u8C03\u7528\u63A5\u53E3\u4E3A\u7A7A"):new Error(`${y}\u4E0B\u7684${m}\u63A5\u53E3\u672A\u627E\u5230`);let T=!1,I=k.params,R=I.filter(N=>N.in==="query").map(N=>N.name),Q=I.filter(N=>N.in==="header").map(N=>N.name),j=I.filter(N=>N.in==="body").map(N=>(N.typeAnnotation.typeKind==="primitive"&&(T=!0),N.name)),U=I.filter(N=>N.in==="path").map(N=>N.name),P=a((N,Y,V,We,Xe)=>{let Ye=N.filter(ue=>Y.includes(ue.keyword));return Ye.forEach((ue,ct)=>{let Se=g(ue);Xe?V+=` ...${Se}`:We?V+=`
4799
+ `);if(he(t))return["jsonSerialize","jsonDeserialize"].includes(t.calleeName)&&t.calleeNamespace==="nasl.util"?w(t):((t.calleeNamespace==="nasl.browser"||t.calleeNamespace==="nasl.configuration"||t.calleeNamespace==="nasl.process")&&(t.calleeNamespace="$global"),`await (${w(t)})`);if(sr(t))return M();if(An(t)){let c=f(t),p="";p+=`${c}`,p+="(";let u;if(t.calleeName==="ToString"){let m=t.arguments[0];u=m.typeAnnotation||m.__TypeAnnotation}else t.calleeName==="FromString"&&(u=t.typeArguments?.[0]);if(t.calleeName==="ToString"&&u&&(p+=`'${u.sortedTypeKey}', `),Array.isArray(t.arguments)&&t.arguments.length&&t.arguments.forEach((m,g)=>{let A=h(m),k=m.typeAnnotation||m.__TypeAnnotation;bn(k,t.app);let{sortedTypeKey:T}=Le(k,t.app);["HasValue"].includes(t.calleeName)&&(A=`{ type: '${T}', value: ${A} }`),p+=A,g!==t.arguments?.length-1&&(p+=", ")}),t.calleeName==="FromString"&&u){let{sortedTypeKey:m}=Le(u,t.app);p+=`, '${m}'`}if(!(["ToString","FromString"].includes(t.calleeName)&&u)&&Array.isArray(t.typeArguments)&&t.typeArguments.length){t.arguments?.length&&(p+=", ");let m=t.typeArguments.length;t.typeArguments?.forEach((g,A)=>{p+=JSON.stringify(g),A!==m-1&&(p+=", ")})}return p+=")",p}else if(ar(t)){let A=function(){let N=t.getAncestor("Connector"),Y=t.getAncestor("Integration");return N&&Y?p?.integration?.connectors?.find?.(V=>V.name===y):N&&!Y?p?.connectorDependencies?.find?.(V=>V.name===y):p?.interfaceDependencies?.find?.(V=>V.name===y)};var v=A;a(A,"getModule");let{calleewholeKey:c,app:p,completeArguments:u}=t,[,y,,m]=c.split("."),k=A()?.interfaces?.find?.(N=>N.name===m);if(!k)throw!t.calleeNamespace||!t.calleeName?new Error("\u8C03\u7528\u63A5\u53E3\u4E3A\u7A7A"):new Error(`${y}\u4E0B\u7684${m}\u63A5\u53E3\u672A\u627E\u5230`);let T=!1,I=k.params,R=I.filter(N=>N.in==="query").map(N=>N.name),Q=I.filter(N=>N.in==="header").map(N=>N.name),j=I.filter(N=>N.in==="body").map(N=>(N.typeAnnotation.typeKind==="primitive"&&(T=!0),N.name)),U=I.filter(N=>N.in==="path").map(N=>N.name),P=a((N,Y,V,We,Xe)=>{let Ye=N.filter(ue=>Y.includes(ue.keyword));return Ye.forEach((ue,ct)=>{let Se=h(ue);Xe?V+=` ...${Se}`:We?V+=`
4800
4800
  '${ue?.keyword}': ${Se}`:V+=` ${Se}`,ct!==N.length-1&&(V+=", ")}),Ye.length===0&&!We&&!Xe&&(V+="undefined"),V},"setArgumentCode"),S=`await $services['_custom']['${t.calleeNamespace}.${t.calleeName}']`;S+=`({ config: {
4801
4801
  download: false,
4802
4802
  },
4803
4803
  query: {`,S=P(u,R,S,!0,!1),S+="}, path: {",S=P(u,U,S,!0,!1),S+="}, headers: {",S=P(u,Q,S,!0,!1),S+=`},
4804
4804
  `,T?(S+="body: ",S=P(u,j,S,!1,!1)):(S+="body: {",S=P(u,j,S,!1,!0),S+="}"),S+=`
4805
- })`;let K=t.typeAnnotation||t.__TypeAnnotation;return K&&!["primitive","union"].includes(K.typeKind)&&(S=`genInitFromSchema('${K?.sortedTypeKey}', ${S})`),S}else{if(or(t))return M();if(pr(t)){let y=function(m){let h="`",A=m.genViewArr();if(Array.isArray(A)&&A.length){h+=`${m.viewNode?.frontend?.prefixPath?m.viewNode.frontend.prefixPath:""}/${A.join("/")}`;let{completeArguments:k}=m;if(k.length){let T=m.viewNode,I=[];T?.params&&(I=T.params);let R=I.length,Q=k.map((j,U)=>{let P=g(j),S="";return P&&U<R&&(S+=`${j.keyword}=\${`,P==="undefined"?S+="null":S+=P,S+="}"),S}).filter(j=>!!j);h+=`?${Q.join("&")}`}if(m.anchor){let T=g(m.anchor);T&&(h+=`#\${${T}}`)}}return h+="`",h};var x=y;a(y,"destinationToUrlExpr");let c=y(t);if(xn(t.parentNode))return c;let u="";return u+="$destination(",u+=c,u+=',"',u+=`${t.target}`,u+='")',u}else if(dr(t)){let c="";if(t.link){let p=g(t.link);if(xn(t.parentNode))return p;let y=e?.resolve?.({kind:"identifier",value:new ce({name:"$link"})});if(c+=`${y}(\`\${`,c+=`${p}`,c+="}",t.anchor){let m=g(t.anchor);m&&(c+=`#\${${m}}`)}c+='`,"',c+=`${t.target}`,c+='")'}return c}else if(Hr(t)){let c="{";if(t.calleeName&&t.calleeName.includes("("))return`'${t.calleeName}'`;if(t.calleeName==="unique"?c+="validate: 'excluded',":t.calleeName==="confirmed"?c+="validate: 'is',":c+=`validate: '${t.calleeName}',`,t.arguments.length){let p="[";t.arguments?.forEach((u,y)=>{p+=g(u),y!==t.arguments?.length-1&&(p+=", ")}),p+="]",c+=`args: ${p} ,`}if(t.errorMessage)c+=`message: ${g(t.errorMessage)},`;else{let p=yn[t.calleeName]??"",u=0;for(;p&&p.indexOf("{args}")!==-1;)p=p.replace("{args}",`\${${g(t.arguments[u])}}`),u++;if(p?.includes("{label}"))return _e();c+=`message: \`${p}\`,`}return c+="trigger: 'input+blur'",["required","filled","notEmpty"].includes(t.calleeName)&&(c+=",required: true"),c+="}",c}else if($t(t)){let c="";if(t.expression){let p=O(t.expression,e);c+=p}else c+="undefined";return t.spread?`...${c}`:`${c}`}else{if(Yt(t))return t.expression?g(t.expression):"";if(gr(t))return t.code;if(hr(t))return M();if(rr(t))return`{${t.logicItems.map(p=>g(t)).join(`
4806
- `)}}`;if(ye(t)){let{namespace:c}=t;if(c)if(t.isFrontendVariables){let p=Ht.from({object:new ce({name:"$frontendVariables"}),property:new ce({name:t.name})},t.parentNode,t.parentKey);return g(p)}else if(t.isEnum()){let p=t.name;return c.startsWith("extensions.")&&(p=`${c}.${t.name}`),p}else{if(c.endsWith("configuration.groups.custom.properties"))return`"${c}.${t.name}"`;if(c.endsWith("logics"))return`'${c}.${t.name}'`}return e?.resolve?.({kind:"identifier",value:t})??t.name}else{if(kr(t))return"null";if(ir(t))return t.value;if(Qr(t))return`${JSON.stringify(t.value)}`;if(Ur(t))return t.expressions.length?t.expressions.map(c=>{let p=c.typeAnnotation||c.__TypeAnnotation;bn(p,t.app);let{sortedTypeKey:u}=Le(p,t.app);return`nasl.util.ToString('${u}', ${g(c)})`}).join(" + "):"''";if(Dr(t))return t.value;if(tr(t))return`${g(t.left)}${t.operator}${g(t.right)}`;if(wr(t)){let c=t.parentNode;if(!Dn(c))throw new Error("MatchCase\u7684\u7236\u8282\u70B9\u975EMatch");let p="";if(Array.isArray(t.patterns)){let y=t.patterns.map(h=>Wt.isTypeAnnotation(h)?`window.$isInstanceOf(${g(c.expression)}, '${h.sortedTypeKey}')`:`window.$global.isEqual(${g(c.expression)}, ${g(h)})`).join("||"),m=c.cases.length;if(m>1){let h=c.cases.indexOf(t);if(h===-1)throw new Error("\u65E0\u6CD5\u5728Match\u4E2D\u627E\u5230\u6B64MatchCase");h===0?p=`if (${y}) {
4807
- `:h!==m-1?p=`else if (${y}) {
4805
+ })`;let K=t.typeAnnotation||t.__TypeAnnotation;return K&&!["primitive","union"].includes(K.typeKind)&&(S=`genInitFromSchema('${K?.sortedTypeKey}', ${S})`),S}else{if(or(t))return M();if(pr(t)){let y=function(m){let g="`",A=m.genViewArr();if(Array.isArray(A)&&A.length){g+=`${m.viewNode?.frontend?.prefixPath?m.viewNode.frontend.prefixPath:""}/${A.join("/")}`;let{completeArguments:k}=m;if(k.length){let T=m.viewNode,I=[];T?.params&&(I=T.params);let R=I.length,Q=k.map((j,U)=>{let P=h(j),S="";return P&&U<R&&(S+=`${j.keyword}=\${`,P==="undefined"?S+="null":S+=P,S+="}"),S}).filter(j=>!!j);g+=`?${Q.join("&")}`}if(m.anchor){let T=h(m.anchor);T&&(g+=`#\${${T}}`)}}return g+="`",g};var x=y;a(y,"destinationToUrlExpr");let c=y(t);if(xn(t.parentNode))return c;let u="";return u+="$destination(",u+=c,u+=',"',u+=`${t.target}`,u+='")',u}else if(dr(t)){let c="";if(t.link){let p=h(t.link);if(xn(t.parentNode))return p;let y=e?.resolve?.({kind:"identifier",value:new ce({name:"$link"})});if(c+=`${y}(\`\${`,c+=`${p}`,c+="}",t.anchor){let m=h(t.anchor);m&&(c+=`#\${${m}}`)}c+='`,"',c+=`${t.target}`,c+='")'}return c}else if(Hr(t)){let c="{";if(t.calleeName&&t.calleeName.includes("("))return`'${t.calleeName}'`;if(t.calleeName==="unique"?c+="validate: 'excluded',":t.calleeName==="confirmed"?c+="validate: 'is',":c+=`validate: '${t.calleeName}',`,t.arguments.length){let p="[";t.arguments?.forEach((u,y)=>{p+=h(u),y!==t.arguments?.length-1&&(p+=", ")}),p+="]",c+=`args: ${p} ,`}if(t.errorMessage)c+=`message: ${h(t.errorMessage)},`;else{let p=yn[t.calleeName]??"",u=0;for(;p&&p.indexOf("{args}")!==-1;)p=p.replace("{args}",`\${${h(t.arguments[u])}}`),u++;if(p?.includes("{label}"))return _e();c+=`message: \`${p}\`,`}return c+="trigger: 'input+blur'",["required","filled","notEmpty"].includes(t.calleeName)&&(c+=",required: true"),c+="}",c}else if($t(t)){let c="";if(t.expression){let p=O(t.expression,e);c+=p}else c+="undefined";return t.spread?`...${c}`:`${c}`}else{if(Yt(t))return t.expression?h(t.expression):"";if(gr(t))return t.code;if(hr(t))return M();if(rr(t))return`{${t.logicItems.map(p=>h(t)).join(`
4806
+ `)}}`;if(ye(t)){let{namespace:c}=t;if(c)if(t.isFrontendVariables){let p=Ht.from({object:new ce({name:"$frontendVariables"}),property:new ce({name:t.name})},t.parentNode,t.parentKey);return h(p)}else if(t.isEnum()){let p=t.name;return c.startsWith("extensions.")&&(p=`${c}.${t.name}`),p}else{if(c.endsWith("configuration.groups.custom.properties"))return`"${c}.${t.name}"`;if(c.endsWith("logics"))return`'${c}.${t.name}'`}return e?.resolve?.({kind:"identifier",value:t})??t.name}else{if(kr(t))return"null";if(ir(t))return t.value;if(Qr(t))return`${JSON.stringify(t.value)}`;if(Ur(t))return t.expressions.length?t.expressions.map(c=>{let p=c.typeAnnotation||c.__TypeAnnotation;bn(p,t.app);let{sortedTypeKey:u}=Le(p,t.app);return`nasl.util.ToString('${u}', ${h(c)})`}).join(" + "):"''";if(Dr(t))return t.value;if(tr(t))return`${h(t.left)}${t.operator}${h(t.right)}`;if(wr(t)){let c=t.parentNode;if(!Dn(c))throw new Error("MatchCase\u7684\u7236\u8282\u70B9\u975EMatch");let p="";if(Array.isArray(t.patterns)){let y=t.patterns.map(g=>Wt.isTypeAnnotation(g)?`window.$isInstanceOf(${h(c.expression)}, '${g.sortedTypeKey}')`:`window.$global.isEqual(${h(c.expression)}, ${h(g)})`).join("||"),m=c.cases.length;if(m>1){let g=c.cases.indexOf(t);if(g===-1)throw new Error("\u65E0\u6CD5\u5728Match\u4E2D\u627E\u5230\u6B64MatchCase");g===0?p=`if (${y}) {
4807
+ `:g!==m-1?p=`else if (${y}) {
4808
4808
  `:p+=`else {
4809
- `}Array.isArray(t.body)&&t.body.forEach((h,A)=>{t.parentNode.isExpression&&A===t.body.length-1&&h.concept!=="Abort"&&(p+="return "),p+=`${g(h)}
4809
+ `}Array.isArray(t.body)&&t.body.forEach((g,A)=>{t.parentNode.isExpression&&A===t.body.length-1&&g.concept!=="Abort"&&(p+="return "),p+=`${h(g)}
4810
4810
  `}),m>1&&(p+=`}
4811
4811
  `)}return p}else if(Dn(t)){let c="",p=t.getAncestor("Logic");return(t.isExpression||!p)&&(p?c+=`await (async () => {
4812
4812
  `:c+=`(() => {
4813
- `),t.expression&&Array.isArray(t.cases)&&t.cases.forEach((u,y)=>{c+=g(u)}),(t.isExpression||!p)&&(c+="})()"),c}else if(qr(t)){let c=g(t.argument);return t.operator==="isNull"?c:`!(${c})`}else if(br(t)){if(ye(t.object)&&t.object.isEnum()&&ye(t.property))return g(new wn({value:t.property.name}));let c=e?.shouldInsertOptional===!1?"":"?";if(ye(t.object)){let p=t.object.name;return`${e?.resolve?.({kind:"calleeNamespace",value:p})??p}${c}.${O(t.property)}`}return`${g(t.object)}${c}.${O(t.property)}`}else{if(Br(t))return t.code;if(xr(t))return"";if(Sn(t)){let c="",{typeAnnotation:p}=t,u=t.assignmentLines.findIndex(({leftIndex:m})=>m[1]===void 0);if(!t.typeAnnotation)return"";if(t.getAncestor("Logic")?c+=`await (async () => {
4813
+ `),t.expression&&Array.isArray(t.cases)&&t.cases.forEach((u,y)=>{c+=h(u)}),(t.isExpression||!p)&&(c+="})()"),c}else if(qr(t)){let c=h(t.argument);return t.operator==="isNull"?c:`!(${c})`}else if(br(t)){if(ye(t.object)&&t.object.isEnum()&&ye(t.property))return h(new wn({value:t.property.name}));let c=e?.shouldInsertOptional===!1?"":"?";if(ye(t.object)){let p=t.object.name;return`${e?.resolve?.({kind:"calleeNamespace",value:p})??p}${c}.${O(t.property)}`}return`${h(t.object)}${c}.${O(t.property)}`}else{if(Br(t))return t.code;if(xr(t))return"";if(Sn(t)){let c="",{typeAnnotation:p}=t,u=t.assignmentLines.findIndex(({leftIndex:m})=>m[1]===void 0);if(!t.typeAnnotation)return"";if(t.getAncestor("Logic")?c+=`await (async () => {
4814
4814
  `:c+=`(() => {
4815
- `,u!==-1){let{rightIndex:m}=t.assignmentLines[u],h=m[1]!==void 0?t.rights[m[0]].members[m[1]]:t.rights[m[0]].expression;c+=`return ${g(h)};
4815
+ `,u!==-1){let{rightIndex:m}=t.assignmentLines[u],g=m[1]!==void 0?t.rights[m[0]].members[m[1]]:t.rights[m[0]].expression;c+=`return ${h(g)};
4816
4816
  `}else if(p.typeKind!=="anonymousStructure"){c+=`const obj = genInitFromSchema('${p.sortedTypeKey}', nasl.util.New(${p.toJS()}));
4817
- `;let m=new Map;t.assignmentLines.forEach(({leftIndex:h,rightIndex:A})=>{let k=JSON.stringify(A);m.has(k)?m.set(k,[...m.get(k),h]):m.set(k,[h])}),m.forEach((h,A)=>{let k=JSON.parse(A)||[],T=h.map(j=>t.properties[j[1]]),[I,R]=[k[0],k[1]],Q=R!==void 0?t.rights[I].members[R]:t.rights[I].expression;T.forEach(j=>{c+=`obj.${j.name} = `}),c+=`${g(Q)}`,c+=`;
4817
+ `;let m=new Map;t.assignmentLines.forEach(({leftIndex:g,rightIndex:A})=>{let k=JSON.stringify(A);m.has(k)?m.set(k,[...m.get(k),g]):m.set(k,[g])}),m.forEach((g,A)=>{let k=JSON.parse(A)||[],T=g.map(j=>t.properties[j[1]]),[I,R]=[k[0],k[1]],Q=R!==void 0?t.rights[I].members[R]:t.rights[I].expression;T.forEach(j=>{c+=`obj.${j.name} = `}),c+=`${h(Q)}`,c+=`;
4818
4818
  `}),c+=`return obj;
4819
4819
  `}else{c+=`const obj = {};
4820
- `,t.properties.forEach(h=>{c+=`obj.${h.name} = null;
4821
- `});let m=new Map;t.assignmentLines.forEach(({leftIndex:h,rightIndex:A})=>{let k=JSON.stringify(A);m.has(k)?m.set(k,[...m.get(k),h]):m.set(k,[h])}),m.forEach((h,A)=>{let k=JSON.parse(A)||[],T=h.map(j=>t.properties[j[1]]),[I,R]=[k[0],k[1]],Q=R!==void 0?t.rights[I].members[R]:t.rights[I].expression;T.forEach(j=>{c+=`obj.${j.name} = `}),c+=`${g(Q)}`,c+=`;
4820
+ `,t.properties.forEach(g=>{c+=`obj.${g.name} = null;
4821
+ `});let m=new Map;t.assignmentLines.forEach(({leftIndex:g,rightIndex:A})=>{let k=JSON.stringify(A);m.has(k)?m.set(k,[...m.get(k),g]):m.set(k,[g])}),m.forEach((g,A)=>{let k=JSON.parse(A)||[],T=g.map(j=>t.properties[j[1]]),[I,R]=[k[0],k[1]],Q=R!==void 0?t.rights[I].members[R]:t.rights[I].expression;T.forEach(j=>{c+=`obj.${j.name} = `}),c+=`${h(Q)}`,c+=`;
4822
4822
  `}),c+=`return obj;
4823
4823
  `}return c+="})()",c}else if(Tn(t)){let c="";return t.getAncestor?.("Logic")?c+=`await (async () => {
4824
4824
  `:c+=`(() => {
4825
4825
  `,c+=`const arr = [
4826
- `,t.items.forEach((p,u)=>{c+=g(p),u+1<t.items.length&&(c+=", ")}),c+=`
4826
+ `,t.items.forEach((p,u)=>{c+=h(p),u+1<t.items.length&&(c+=", ")}),c+=`
4827
4827
  ];
4828
4828
  `,c+=`return arr;
4829
4829
  `,c+="})()",c}else if(Ar(t)){let c="";return t.getAncestor?.("Logic")?c+=`await (async () => {
4830
4830
  `:c+=`(() => {
4831
4831
  `,c+=`const obj = {};
4832
4832
  `,c+=`let k;
4833
- `,t.keys.forEach((p,u)=>{let y=p,m=t.values[u];c+="k = ",c+=`${y?g(y):void 0};
4834
- `,c+="obj[k] = ",c+=`${m?g(m):void 0};
4833
+ `,t.keys.forEach((p,u)=>{let y=p,m=t.values[u];c+="k = ",c+=`${y?h(y):void 0};
4834
+ `,c+="obj[k] = ",c+=`${m?h(m):void 0};
4835
4835
  `}),c+=`return obj;
4836
4836
  `,c+="})()",c}else return cr(t)?M():jr(t)?M():Lr(t)?M():Ir(t)?M():Pr(t)?M():Fr(t)?M():Cr(t)?M():Vr(t)?M():Er(t)?M():Or(t)?M():Sr(t)?M():Rr(t)?M():_t(t)?M():Nr(t)?M():t?(ve.error(`Concept:${t.concept} \u672A\u88AB\u5904\u7406\uFF0C\u56DE\u9000\u81F3\u9ED8\u8BA4\u7FFB\u8BD1\uFF0C\u8BF7\u62A5\u544A\u6B64\u9519\u8BEF`),t.toJS()):(ve.error("\u9047\u5230\u7A7A\u8282\u70B9\uFF0C\u8BF7\u62A5\u544A\u6B64\u9519\u8BEF"),"(undefined)")}}}}}}}}}a(O,"getRuntimeStr");var q=C({name:"javaScriptCodeGen",functions:{printSyntaxNode(n,e){return O(n,e)},printParamIR(n){return`${n.name}:any`}}});import*as Wn from"postcss";import Wi from"postcss-js";import{isBindStyle as qn}from"@lcap/nasl/out/concepts/utils/asserts";import{escape as Qi}from"html-escaper";import{Container as Gi}from"inversify";import{flatten as Ki,isObject as qi,isString as Bi,uniq as pe}from"lodash";var L={StateManager:Symbol.for("StateManager"),CodePrinter:Symbol.for("CodePrinter"),ProjectOrganizer:Symbol.for("ProjectOrganizer"),MicroFrontendManager:Symbol.for("MicroFrontendManager"),FrontendCodeGenerator:Symbol.for("FrontendCodeGenerator"),IRBuilder:Symbol.for("IRBuilder"),NASLTranspiler:Symbol.for("NASLTranspiler"),CodeGenerationLifecycleHooks:Symbol.for("CodeGenerationLifecycleHooks"),FileSystemProvider:Symbol.for("FileSystemProvider")};var Pn="__SomethingYouNeverGuessAsUndefinedPlaceholder__undefined__";function In(n){return JSON.stringify(n,(e,r)=>r===void 0?Pn:r,2).replaceAll(`"${Pn}"`,"undefined")}a(In,"jsonStringifyKeepUndefined");import{extname as Yr}from"path";function jn(n){return Yr(n)!==""}a(jn,"hasExtension");function Ee(n){return"/"+n.map(r=>r.name).join("/")}a(Ee,"folderPathToString");var Fe=C({name:"apiClientPlugin",functions:{buildApiStubFile(n,e){function r(o){let s=o.map(l=>[l.logic.name,l.logic.toService()]);return Object.fromEntries(s)}a(r,"apiSignaturesToServiceConfigMap");let i=Object.assign({},e.logicsMap,r(n));return new E("apis",[{from:"@lcap/basic-template",import:"{initLogic, initDataTypes, initService, Global}"}],[],["export { genInitFromSchema } from '@lcap/basic-template/dist/init/dataTypes';",`export const dataTypesMap = ${JSON.stringify(e.dataTypesMap)};`,`export const enumsMap = ${JSON.stringify(e.enumsMap)};`,`export const servicesMap = ${JSON.stringify(e.servicesMap)};`,`const logicsMap = ${JSON.stringify(i)};`,`
4837
4837
  const {$global} = initDataTypes({dataTypesMap});
@@ -4859,7 +4859,7 @@ const genInitFromSchema = useGenInitFromSchema();
4859
4859
  export const useServices = ()=>{
4860
4860
  return services;
4861
4861
  }
4862
- `])}}});import{format as Zr}from"prettier/standalone";import $r from"prettier/parser-typescript";var _r={tabWidth:2,printWidth:150,singleQuote:!0,trailingComma:"es5",plugins:[$r],parser:"typescript"},ei=D("codeFormatPlugin"),Cn=C({name:"CodeFormatPlugin",functions:{async format(n,e){function r(){try{return Zr(n,{..._r,...e})}catch(o){return ei.debug(o,"format\u51FA\u9519"),n}}return a(r,"prettierFormat"),await r()}}});import{injectable as ti}from"inversify";import{Volume as ri}from"memfs";function ni(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(ni,"_ts_decorate");var re=class{static{a(this,"FileSystemPlugin")}vol=new ri;read(e){if(this.vol.existsSync(e))return this.vol.readFileSync(e).toString()}write(e,r){this.vol.fromJSON({[e]:r})}remove(e){this.vol.unlinkSync(e)}toJSON(){return this.vol.toJSON()}};re=ni([ti()],re);import{inject as pi,injectable as ui}from"inversify";import{join as Ve,relative as di}from"path";import{StringLiteral as ii}from"@lcap/nasl";var oi=D("ReactRouterPlugin"),si=[{from:"react-dom",import:"ReactDOM"},{from:"react",import:"React, { useEffect, useState }"},{from:"react-router-dom",import:" { RouterProvider, Navigate, useNavigate,useLocation } "},{from:"./router/component",import:"{ createRouter }"},{from:"./router/hooks",import:"{ useUserInfo, useUserResources }"},{from:"./nasl",import:"{ useAppConfig }"}],we="__views__",ai=class{static{a(this,"NameMangler")}dict=new Map;query(e){let r=this.inc(e);return r===1?`${e}`:`${e}${r}`}inc(e){let r=this.initName(e);return this.dict.set(e,r+1),r+1}initName(e){return this.dict.has(e)?this.dict.get(e):(this.dict.set(e,0),0)}},ie=C({name:"ReactRouter",functions:{routeToCode(n,e){let r={...Ln.functions,...q.functions},i=new ai,o=new WeakMap,s=l(n);function l(t){return t.flatMap(v=>{if(v.kind==="normal"){let x=v.elementTemplate.identifier;if(x){let c=e.get(v.elementTemplate),p=_(x),u=_(`${c}${x}`.replaceAll("/","-").replace(/^-/,"")),y=i.query(u);v.elementMangledName=y,oi.debug({mangledName:y});let h={from:`./${we}${c}/${p}`,import:y,lazy:v.lazy};return o.set(v.elementTemplate,h),[h,...l(v.children??[])]}}return[]})}a(l,"recursivelyExtractImportIR");function d(t){let v=t.thisLevelPath??"/";if(t.kind==="normal"){let y=function(){return`element: ${p}`};var x=y;a(y,"importConfigToPropertyStr");let c=t.children?.map(d).filter(F)??[],p=r.printTag(t.elementMangledName??t.elementTemplate.identifier),u=c.join(`,
4862
+ `])}}});import{format as Zr}from"prettier/standalone";import $r from"prettier/parser-typescript";var _r={tabWidth:2,printWidth:150,singleQuote:!0,trailingComma:"es5",plugins:[$r],parser:"typescript"},ei=D("codeFormatPlugin"),Cn=C({name:"CodeFormatPlugin",functions:{async format(n,e){function r(){try{return Zr(n,{..._r,...e})}catch(o){return ei.debug(o,"format\u51FA\u9519"),n}}return a(r,"prettierFormat"),await r()}}});import{injectable as ti}from"inversify";import{Volume as ri}from"memfs";function ni(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(ni,"_ts_decorate");var re=class{static{a(this,"FileSystemPlugin")}vol=new ri;read(e){if(this.vol.existsSync(e))return this.vol.readFileSync(e).toString()}write(e,r){this.vol.fromJSON({[e]:r})}remove(e){this.vol.unlinkSync(e)}toJSON(){return this.vol.toJSON()}};re=ni([ti()],re);import{inject as pi,injectable as ui}from"inversify";import{join as Ve,relative as di}from"path";import{StringLiteral as ii}from"@lcap/nasl";var oi=D("ReactRouterPlugin"),si=[{from:"react-dom",import:"ReactDOM"},{from:"react",import:"React, { useEffect, useState }"},{from:"react-router-dom",import:" { RouterProvider, Navigate, useNavigate,useLocation } "},{from:"./router/component",import:"{ createRouter }"},{from:"./router/hooks",import:"{ useUserInfo, useUserResources }"},{from:"./nasl",import:"{ useAppConfig }"}],we="__views__",ai=class{static{a(this,"NameMangler")}dict=new Map;query(e){let r=this.inc(e);return r===1?`${e}`:`${e}${r}`}inc(e){let r=this.initName(e);return this.dict.set(e,r+1),r+1}initName(e){return this.dict.has(e)?this.dict.get(e):(this.dict.set(e,0),0)}},ie=C({name:"ReactRouter",functions:{routeToCode(n,e){let r={...Ln.functions,...q.functions},i=new ai,o=new WeakMap,s=l(n);function l(t){return t.flatMap(v=>{if(v.kind==="normal"){let x=v.elementTemplate.identifier;if(x){let c=e.get(v.elementTemplate),p=_(x),u=_(`${c}${x}`.replaceAll("/","-").replace(/^-/,"")),y=i.query(u);v.elementMangledName=y,oi.debug({mangledName:y});let g={from:`./${we}${c}/${p}`,import:y,lazy:v.lazy};return o.set(v.elementTemplate,g),[g,...l(v.children??[])]}}return[]})}a(l,"recursivelyExtractImportIR");function d(t){let v=t.thisLevelPath??"/";if(t.kind==="normal"){let y=function(){return`element: ${p}`};var x=y;a(y,"importConfigToPropertyStr");let c=t.children?.map(d).filter(F)??[],p=r.printTag(t.elementMangledName??t.elementTemplate.identifier),u=c.join(`,
4863
4863
  `);return`{path: "${v}", meta: ${JSON.stringify(t.meta)}, children: [${u}], ${y()} }`}if(t.kind==="redirect"){let c=r.printSyntaxNode(ii.from({value:t.redirect}));return`{path: "${v}", element: <Navigate to={${c}} />}`}H(t)}a(d,"serializeReactRoute");let f=[...si,...s,{from:"@lcap/pc-react-ui",import:"{ConfigProvider, RouterContext}"},{from:"./platform.config",import:"platformConfig"}];return{code:`
4864
4864
  ${`const defaultRoutes = [${n.map(d).filter(F).join(`,
4865
4865
  `)}];`}
@@ -4906,7 +4906,7 @@ const genInitFromSchema = useGenInitFromSchema();
4906
4906
  const {link, destination} = initRouter();
4907
4907
  export const useLink = ()=>link;
4908
4908
  export const useDestination = useNavigate;
4909
- `])}}});function ci(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(ci,"_ts_decorate");function En(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}a(En,"_ts_metadata");function li(n,e){return function(r,i){e(r,i,n)}}a(li,"_ts_param");var mi=a(n=>n.import?n.lazy?`const ${n.import} = React.lazy(() => import('${n.from}'));`:`import ${n.import} from '${n.from}';`:`import '${n.from}';`,"identityImportResolver"),Fn=D("ProjectOrganizerPlugin"),fi=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"];function gi(n){return Vn(n)||n.from.startsWith("/")}a(gi,"isIntraProjectImport");function Vn(n){return n.from.startsWith(".")}a(Vn,"isRelativeImport");async function hi(n){let e=new WeakMap,r={},i=[];return Object.entries(n.project).forEach(([l,d])=>{if(d){let f=$e(d);for(let w of f){let{dir:b}=s(l,w),g=new Me(w,b);i.push(g),r[g.originalAbsolutePath]=g;let t=w.getImports().map(v=>{if(gi(v)){let x=Vn(v)?Ve(b,v.from):v.from;return{ir:v,kind:"relative",getRelativePathAfterMoving:()=>{let p=b,u=y()??x;return Fn.debug({currentDir:p,targetPath:u}),`./${di(p,u)}`;function y(){if(!jn(v.from))for(let m of fi){let h=r[x+m]?.currentAbsolutePath;if(h)return h}}a(y,"tryToAppendExtIfNecessary")}}}else return{ir:v,kind:"absolute"}});e.set(g,t)}}}),{mapping:e,placedFiles:i};function o(l){let d={name:"src"};return l==="views"?[d,{name:we}]:[d]}a(o,"decideDirForKey");function s(l,d){let f=o(l);d.folder=[...f,...d.folder??[]];let w=d.getFolderPath()??"";return{path:Ve(w,d.fileNameWithExt),dir:w}}a(s,"initFilePath")}a(hi,"initImport");var Me=class n{static{a(this,"PlacedFile")}file;folder;constructor(e,r){this.file=e,this.folder=r,this.originalFolder=r,this.currentAbsolutePath=this.originalAbsolutePath}currentAbsolutePath;get originalAbsolutePath(){return Ve(this.originalFolder,this.file.fileNameWithExt)}originalFolder;getFolder(){return this.folder.endsWith("/")?this.folder:`${this.folder}/`}moveFileTo(e){return this.currentAbsolutePath=new n(this.file,e).originalAbsolutePath,this.folder=e,this}};async function yi(n,e){return Promise.all(e.map(async i=>{let o=a(l=>{let d=f(l);return mi(d);function f(w){let b=n.get(i)?.find(g=>g.ir===w);if(b){let g=r(b);return{...w,from:g}}return w}},"ownImportResolver");return{content:await i.file.serialize(o),path:i.currentAbsolutePath}}));function r(i){return i.kind==="relative"?i.getRelativePathAfterMoving():i.ir.from}}a(yi,"writeAllPlacedFile");var be=class{static{a(this,"ProjectOrganizerPlugin")}fileSystemProvider;constructor(e){this.fileSystemProvider=e}async organize(e){let{mapping:r,placedFiles:i}=await hi(e);return await this.moveFilesAsYouWant(i),await yi(r,i)}async moveFilesAsYouWant(e){let r=Fn.child({},{msgPrefix:"[\u79FB\u52A8\u6587\u4EF6] "});for(let i of e){let o=`/${we}/`;if(i.originalAbsolutePath.includes(o)){let s=i.getFolder().replace(o,"/pages/");i.moveFileTo(s),r.debug(`${i.originalAbsolutePath} -> ${i.currentAbsolutePath}`)}}}};be=ci([ui(),rn,li(0,pi(L.FileSystemProvider)),En("design:type",Function),En("design:paramtypes",[typeof GeneratorInfrastructureDomain>"u"||typeof GeneratorInfrastructureDomain.FileSystemProvider>"u"?Object:GeneratorInfrastructureDomain.FileSystemProvider])],be);var vi="notFound",le=C({name:"RoutesExtraction",functions:{extractRoute(n,e,r){let i=a((b,g)=>b.flatMap(t=>{let v=`${g}${t.identifier}`,x={accumulativePath:v,thisLevelPath:`${t.identifier}`,children:i(t.childComponents,`${v}/`),elementTemplate:t,kind:"normal",lazy:!!r?.lazy,meta:{title:t.__raw.title??"",crumb:t.__raw.crumb?.value??""}},c=x.children?.map(p=>{if(p.kind==="normal"&&p.elementTemplate.__raw.isIndex)return{accumulativePath:`${v}/`,thisLevelPath:"",redirect:`${v}/${p.elementTemplate.identifier}`,kind:"redirect"}}).filter(F);return c?.length&&x.children?.push(...c),[x]}),"extractRouteHelper"),o=i(n,e),s=n.find(b=>b.__raw.isIndex);s&&o.push({accumulativePath:"/",thisLevelPath:"/",redirect:`${e}${s.identifier}`,kind:"redirect"});let l=n.find(b=>b.identifier===vi)??s;l&&o.push({accumulativePath:"*",thisLevelPath:"*",redirect:`${e}${l.identifier}`,kind:"redirect"});let d=[],f=[];return o.filter(b=>b.kind==="normal").forEach(b=>{let g=a((t,v)=>{if(t.kind==="normal"){let x=t.elementTemplate.__raw,c=v||x.auth;c?d.push(t.accumulativePath):f.push(t.accumulativePath),t.children?.forEach(p=>{g(p,c)})}},"traverseRoutes");g(b,!1)}),{authResourcePaths:d,baseResourcePaths:f,routes:o}}}});import{Argument as Mn,Assignment as wi,BindEvent as bi,CallFunction as On,Identifier as Oe,Logic as xi,Param as Ai,Return as ki,TypeAnnotation as zn,Unparsed as Di}from"@lcap/nasl";import{isBooleanLiteral as Si,isIdentifier as ze,isMemberExpression as Un,isNullLiteral as Ti,isNumericLiteral as Ri,isStringLiteral as Ni}from"@lcap/nasl/out/concepts/utils/asserts";import{uniqueId as Pi}from"lodash";var Ii=D("component hack"),Ue=C({name:"ReactComponentLibHackPlugin",functions:{__hooksDefinitions(){return new E("ReactComponentLibHackHooks",[{import:"{initUtils, cookie}",from:"@lcap/basic-template"},{import:"{Modal}",from:"antd"},{import:"{message}",from:"@lcap/pc-react-ui"},{from:"./apis",import:"{enumsMap, dataTypesMap}"},{from:"@lcap/basic-template",import:"{ initAuth }"},{from:"./apis",import:"{dataTypesGlobal}"}],[],[`
4909
+ `])}}});function ci(n,e,r,i){var o=arguments.length,s=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,r,i);else for(var d=n.length-1;d>=0;d--)(l=n[d])&&(s=(o<3?l(s):o>3?l(e,r,s):l(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s}a(ci,"_ts_decorate");function En(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}a(En,"_ts_metadata");function li(n,e){return function(r,i){e(r,i,n)}}a(li,"_ts_param");var mi=a(n=>n.import?n.lazy?`const ${n.import} = React.lazy(() => import('${n.from}'));`:`import ${n.import} from '${n.from}';`:`import '${n.from}';`,"identityImportResolver"),Fn=D("ProjectOrganizerPlugin"),fi=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"];function gi(n){return Vn(n)||n.from.startsWith("/")}a(gi,"isIntraProjectImport");function Vn(n){return n.from.startsWith(".")}a(Vn,"isRelativeImport");async function hi(n){let e=new WeakMap,r={},i=[];return Object.entries(n.project).forEach(([l,d])=>{if(d){let f=$e(d);for(let w of f){let{dir:b}=s(l,w),h=new Me(w,b);i.push(h),r[h.originalAbsolutePath]=h;let t=w.getImports().map(v=>{if(gi(v)){let x=Vn(v)?Ve(b,v.from):v.from;return{ir:v,kind:"relative",getRelativePathAfterMoving:()=>{let p=b,u=y()??x;return Fn.debug({currentDir:p,targetPath:u}),`./${di(p,u)}`;function y(){if(!jn(v.from))for(let m of fi){let g=r[x+m]?.currentAbsolutePath;if(g)return g}}a(y,"tryToAppendExtIfNecessary")}}}else return{ir:v,kind:"absolute"}});e.set(h,t)}}}),{mapping:e,placedFiles:i};function o(l){let d={name:"src"};return l==="views"?[d,{name:we}]:[d]}a(o,"decideDirForKey");function s(l,d){let f=o(l);d.folder=[...f,...d.folder??[]];let w=d.getFolderPath()??"";return{path:Ve(w,d.fileNameWithExt),dir:w}}a(s,"initFilePath")}a(hi,"initImport");var Me=class n{static{a(this,"PlacedFile")}file;folder;constructor(e,r){this.file=e,this.folder=r,this.originalFolder=r,this.currentAbsolutePath=this.originalAbsolutePath}currentAbsolutePath;get originalAbsolutePath(){return Ve(this.originalFolder,this.file.fileNameWithExt)}originalFolder;getFolder(){return this.folder.endsWith("/")?this.folder:`${this.folder}/`}moveFileTo(e){return this.currentAbsolutePath=new n(this.file,e).originalAbsolutePath,this.folder=e,this}};async function yi(n,e,r){return Promise.all(e.map(async o=>{let s=a(d=>{let f=w(d);return mi(f);function w(b){let h=n.get(o)?.find(t=>t.ir===b);if(h){let t=i(h);return{...b,from:t}}return b}},"ownImportResolver");return{content:await o.file.serialize(s,r),path:o.currentAbsolutePath}}));function i(o){return o.kind==="relative"?o.getRelativePathAfterMoving():o.ir.from}}a(yi,"writeAllPlacedFile");var be=class{static{a(this,"ProjectOrganizerPlugin")}fileSystemProvider;constructor(e){this.fileSystemProvider=e}async organize(e){let{mapping:r,placedFiles:i}=await hi(e);return await this.moveFilesAsYouWant(i),await yi(r,i,{noFormat:e.options?.noFormat})}async moveFilesAsYouWant(e){let r=Fn.child({},{msgPrefix:"[\u79FB\u52A8\u6587\u4EF6] "});for(let i of e){let o=`/${we}/`;if(i.originalAbsolutePath.includes(o)){let s=i.getFolder().replace(o,"/pages/");i.moveFileTo(s),r.debug(`${i.originalAbsolutePath} -> ${i.currentAbsolutePath}`)}}}};be=ci([ui(),rn,li(0,pi(L.FileSystemProvider)),En("design:type",Function),En("design:paramtypes",[typeof GeneratorInfrastructureDomain>"u"||typeof GeneratorInfrastructureDomain.FileSystemProvider>"u"?Object:GeneratorInfrastructureDomain.FileSystemProvider])],be);var vi="notFound",le=C({name:"RoutesExtraction",functions:{extractRoute(n,e,r){let i=a((b,h)=>b.flatMap(t=>{let v=`${h}${t.identifier}`,x={accumulativePath:v,thisLevelPath:`${t.identifier}`,children:i(t.childComponents,`${v}/`),elementTemplate:t,kind:"normal",lazy:!!r?.lazy,meta:{title:t.__raw.title??"",crumb:t.__raw.crumb?.value??""}},c=x.children?.map(p=>{if(p.kind==="normal"&&p.elementTemplate.__raw.isIndex)return{accumulativePath:`${v}/`,thisLevelPath:"",redirect:`${v}/${p.elementTemplate.identifier}`,kind:"redirect"}}).filter(F);return c?.length&&x.children?.push(...c),[x]}),"extractRouteHelper"),o=i(n,e),s=n.find(b=>b.__raw.isIndex);s&&o.push({accumulativePath:"/",thisLevelPath:"/",redirect:`${e}${s.identifier}`,kind:"redirect"});let l=n.find(b=>b.identifier===vi)??s;l&&o.push({accumulativePath:"*",thisLevelPath:"*",redirect:`${e}${l.identifier}`,kind:"redirect"});let d=[],f=[];return o.filter(b=>b.kind==="normal").forEach(b=>{let h=a((t,v)=>{if(t.kind==="normal"){let x=t.elementTemplate.__raw,c=v||x.auth;c?d.push(t.accumulativePath):f.push(t.accumulativePath),t.children?.forEach(p=>{h(p,c)})}},"traverseRoutes");h(b,!1)}),{authResourcePaths:d,baseResourcePaths:f,routes:o}}}});import{Argument as Mn,Assignment as wi,BindEvent as bi,CallFunction as On,Identifier as Oe,Logic as xi,Param as Ai,Return as ki,TypeAnnotation as zn,Unparsed as Di}from"@lcap/nasl";import{isBooleanLiteral as Si,isIdentifier as ze,isMemberExpression as Un,isNullLiteral as Ti,isNumericLiteral as Ri,isStringLiteral as Ni}from"@lcap/nasl/out/concepts/utils/asserts";import{uniqueId as Pi}from"lodash";var Ii=D("component hack"),Ue=C({name:"ReactComponentLibHackPlugin",functions:{__hooksDefinitions(){return new E("ReactComponentLibHackHooks",[{import:"{initUtils, cookie}",from:"@lcap/basic-template"},{import:"{Modal}",from:"antd"},{import:"{message}",from:"@lcap/pc-react-ui"},{from:"./apis",import:"{enumsMap, dataTypesMap}"},{from:"@lcap/basic-template",import:"{ initAuth }"},{from:"./apis",import:"{dataTypesGlobal}"}],[],[`
4910
4910
  const {utils} = initUtils({enumsMap, dataTypesMap});
4911
4911
  const ui = { showMessage: message.info };
4912
4912
 
@@ -4947,7 +4947,7 @@ const genInitFromSchema = useGenInitFromSchema();
4947
4947
  return nasl;
4948
4948
  };
4949
4949
 
4950
- `])},hackBindAttribute(n,e){function r(s){return s.typeAnnotation??s.__TypeAnnotation}a(r,"getTypeAnnotation");function i(s){return s.typeKind==="primitive"&&s.typeNamespace==="nasl.core"&&s.typeName==="String"}if(a(i,"isNASLPrimitiveStringType"),e.name===xe&&e.__raw.type==="dynamic"){let s=r(e.expression.expr);if(s&&i(s))return e;let l=Mn.from({expression:e.expression.expr},e.__raw,"arguments");l.__TypeAnnotation=s??new zn;let d=On.from({calleeName:"ToString",calleeNamespace:"nasl.util",arguments:[l]});return d.__TypeAnnotation=zn.createPrimitive("String"),{...e,expression:{expr:d}}}else if(e.name==="dataSource"){let g=function(v){return{__raw:v,logics:v.logics.map(Z),concept:v.concept,params:v.getContextLogicParams().map(ee),handlerName:l.dataFetchMethod}};var o=g;if(a(g,"bindManualBindEventToIR"),ze(e.expression.expr)||Un(e.expression.expr)||Ri(e.expression.expr)||Ni(e.expression.expr)||Si(e.expression.expr)||Ti(e.expression.expr)){let v=On.from({calleeName:"toJS",arguments:[new Mn({expression:e.expression.expr})]},e.__raw.parentNode,e.__raw.parentKey);return{...e,expression:{expr:v}}}let s=`dataSource${Pi()}`,l={queryParam:"event",tempResultVariable:`${s}LoadResult`,dataFetchMethod:`${s}Load`},d=e.__raw.getAncestor("ViewElement");if(!d){let v=`\u627E\u4E0D\u5230${e.__raw.nodePath} \u7684\u7956\u5148ViewElement`;throw Ii.error(v),new Error(v)}let f=n.findComponentRefByComponentName(d?.name??"")?.identifier;f&&e.expression.expr.traverseStrictChildren(v=>{Un(v)&&ze(v.object)&&ze(v.property)&&v.object.name===f&&["current","pageSize","sorter","order"].includes(v.property.name)&&(v.object=new Oe({name:l.queryParam}),v.property=new Oe({name:v.property.name}))});let w=xi.from({body:[new wi({left:new Oe({name:l.tempResultVariable}),right:e.expression.expr}),new Di({code:`return ${l.tempResultVariable}`})],params:[new Ai({name:l.queryParam})],returns:[new ki({name:l.tempResultVariable})]},e.__raw.parentNode,void 0),b=bi.from({name:"dataSource",params:w.params,logics:[w]},e.__raw.parentNode,"bindEvents"),t=g(b);return ae(b),n.provideAction(je(t)),t}return e}}});import{App as ji,BaseNode as Qe,TypeAnnotation as Qn}from"@lcap/nasl";function Ae(n){let e=Qe.prototype.subConstructor,r=a(function(o){e.call(this,o),o.typeAnnotation&&(this.typeAnnotation=new Qn(o.typeAnnotation)),o.__TypeArguments&&(this.__TypeArguments=o.__TypeArguments.map(s=>s&&new Qn(s)))},"hack");Qe.prototype.subConstructor=r;let i=new ji(n);return Qe.prototype.subConstructor=e,i}a(Ae,"deserializeAppWhileKeepTypeAnnotation");function Ge(n){let e=n.__proto__.__proto__,r=e._toJSON,i=a(function(o){let s=r.call(this,o);return(this.typeAnnotation||this.__TypeAnnotation)&&(s.typeAnnotation=this.typeAnnotation?.toJSON()??this.__TypeAnnotation?.toJSON()),this.__TypeArguments&&(s.__TypeArguments=this.__TypeArguments.map?.(l=>l&&l.toJSON())),s},"newToJSON");e._toJSON=i;try{return n.toJSON()}catch(o){throw o}finally{e._toJSON=r}}a(Ge,"serializeAppWithKeepTypeAnnotation");var Ia=D("ReactSlotPlugin"),Gn=C({name:"ReactSlotPlugin",functions:{preprocessForSlots(n){let e=[];for(let r of n.children){let i=r.slot.target;if(i){if(n.attrs.some(o=>o.name===i)){let o=n.__raw.nodePath;throw new Error(`${o}\u5B58\u5728\u591A\u4E2AslotName=${i}\u7684\u5B50\u5143\u7D20\u6216\u5DF2\u7ECF\u6709attr\u540D\u4E3A${i}\uFF0C\u4E3A\u810F\u6570\u636E`)}if(tn(r.component)&&r.children.length===0)continue;n.attrs.push(ge({type:"component",component:r,scopeVariable:r.slot.scope,name:i}))}else e.push(r)}n.children=e}}});import{CallLogic as Ei,Logic as Ke,Param as Fi}from"@lcap/nasl";import{Argument as Ci,Identifier as Li}from"@lcap/nasl";function Kn(n){return new Ci({expression:new Li({name:n.name})})}a(Kn,"paramToArgument");var Vi=D("ReactStateManagerVanilla"),Mi=class{static{a(this,"ReactHookTransformer")}static componentRefNameToHook(e){return{kind:"free",code:`const ${e}= useRef(null);`,import:{from:"react",import:"{ useRef }"}}}};function Oi(n){return n.recursivelyExtractTreeStates().map(r=>{let i={...z.functions,...q.functions};switch(r.initialization.kind){case"global-hook":{let o=r.initialization.hookName;return{kind:"free",code:`const ${r.identifier} = ${o}();`,import:{from:"/src/Hooks",import:`{${o}}`}}}case"api-client":return{kind:"free",import:{from:"/src/apis",import:"{apiClient, genInitFromSchema}"},code:""};case"frontend-variable":{let o=r.initialization.hookName;return{kind:"free",code:`const ${r.identifier} = ${o}();`,import:{from:"/src/global-variables",import:`{${o}}`}}}default:G(r.initialization)}})}a(Oi,"makeTreeStateHooks");var z=C({name:"ReactStateManagerVanilla",functions:{makeLocalLogicHooks(n){let e=n.providedStates.flatMap(o=>{let s=o.identifier;return[{kind:"useState",declarations:[`${s}`,`use${s}`],initial:void 0}]}),r={...z.functions,...q.functions},i=n.actions.filter(o=>o.kind==="standalone").flatMap(o=>[{kind:"useCallback",declaration:o.name,deps:[],body:r.actionToBody(n,o)}]);return[...e,...i]},actionToBody(n,e,r){let i={...z.functions,...q.functions};function o(){let s=e.params.map(l=>Fi.from(l));if(e.logics.length===0)return new Ke;if(e.logics.length===1){let l=e.logics[0].logic;return Ke.from({...l,params:s})}else return Ke.from({params:s,body:e.logics.map(d=>{let f=`${d.logic.name}`;return Ei.from({calleeName:f,arguments:e.params.map(Kn)})})})}return a(o,"getLogic"),`${n.resolveExprToString(o(),i,r?.()?.(n)??i.withCtx(n))}`},makeLocalIndividualHooks(n,e){let r={...z.functions,...q.functions};return[...n.providedStates.filter(i=>i.kind==="standalone").flatMap(i=>{if(i.initialization&&i.kind==="standalone")switch(i.initialization.kind){case"component-ref":return[Mi.componentRefNameToHook(i.identifier)];default:G(i.initialization.kind)}return H(i)}),...n.actions.filter(i=>i.kind==="view-lifecycle").flatMap(i=>[{kind:"useEffect",deps:[],body:`()=>{
4950
+ `])},hackBindAttribute(n,e){function r(s){return s.typeAnnotation??s.__TypeAnnotation}a(r,"getTypeAnnotation");function i(s){return s.typeKind==="primitive"&&s.typeNamespace==="nasl.core"&&s.typeName==="String"}if(a(i,"isNASLPrimitiveStringType"),e.name===xe&&e.__raw.type==="dynamic"){let s=r(e.expression.expr);if(s&&i(s))return e;let l=Mn.from({expression:e.expression.expr},e.__raw,"arguments");l.__TypeAnnotation=s??new zn;let d=On.from({calleeName:"ToString",calleeNamespace:"nasl.util",arguments:[l]});return d.__TypeAnnotation=zn.createPrimitive("String"),{...e,expression:{expr:d}}}else if(e.name==="dataSource"){let h=function(v){return{__raw:v,logics:v.logics.map(Z),concept:v.concept,params:v.getContextLogicParams().map(ee),handlerName:l.dataFetchMethod}};var o=h;if(a(h,"bindManualBindEventToIR"),ze(e.expression.expr)||Un(e.expression.expr)||Ri(e.expression.expr)||Ni(e.expression.expr)||Si(e.expression.expr)||Ti(e.expression.expr)){let v=On.from({calleeName:"toJS",arguments:[new Mn({expression:e.expression.expr})]},e.__raw.parentNode,e.__raw.parentKey);return{...e,expression:{expr:v}}}let s=`dataSource${Pi()}`,l={queryParam:"event",tempResultVariable:`${s}LoadResult`,dataFetchMethod:`${s}Load`},d=e.__raw.getAncestor("ViewElement");if(!d){let v=`\u627E\u4E0D\u5230${e.__raw.nodePath} \u7684\u7956\u5148ViewElement`;throw Ii.error(v),new Error(v)}let f=n.findComponentRefByComponentName(d?.name??"")?.identifier;f&&e.expression.expr.traverseStrictChildren(v=>{Un(v)&&ze(v.object)&&ze(v.property)&&v.object.name===f&&["current","pageSize","sorter","order"].includes(v.property.name)&&(v.object=new Oe({name:l.queryParam}),v.property=new Oe({name:v.property.name}))});let w=xi.from({body:[new wi({left:new Oe({name:l.tempResultVariable}),right:e.expression.expr}),new Di({code:`return ${l.tempResultVariable}`})],params:[new Ai({name:l.queryParam})],returns:[new ki({name:l.tempResultVariable})]},e.__raw.parentNode,void 0),b=bi.from({name:"dataSource",params:w.params,logics:[w]},e.__raw.parentNode,"bindEvents"),t=h(b);return ae(b),n.provideAction(je(t)),t}return e}}});import{App as ji,BaseNode as Qe,TypeAnnotation as Qn}from"@lcap/nasl";function Ae(n){let e=Qe.prototype.subConstructor,r=a(function(o){e.call(this,o),o.typeAnnotation&&(this.typeAnnotation=new Qn(o.typeAnnotation)),o.__TypeArguments&&(this.__TypeArguments=o.__TypeArguments.map(s=>s&&new Qn(s)))},"hack");Qe.prototype.subConstructor=r;let i=new ji(n);return Qe.prototype.subConstructor=e,i}a(Ae,"deserializeAppWhileKeepTypeAnnotation");function Ge(n){let e=n.__proto__.__proto__,r=e._toJSON,i=a(function(o){let s=r.call(this,o);return(this.typeAnnotation||this.__TypeAnnotation)&&(s.typeAnnotation=this.typeAnnotation?.toJSON()??this.__TypeAnnotation?.toJSON()),this.__TypeArguments&&(s.__TypeArguments=this.__TypeArguments.map?.(l=>l&&l.toJSON())),s},"newToJSON");e._toJSON=i;try{return n.toJSON()}catch(o){throw o}finally{e._toJSON=r}}a(Ge,"serializeAppWithKeepTypeAnnotation");var Ia=D("ReactSlotPlugin"),Gn=C({name:"ReactSlotPlugin",functions:{preprocessForSlots(n){let e=[];for(let r of n.children){let i=r.slot.target;if(i){if(n.attrs.some(o=>o.name===i)){let o=n.__raw.nodePath;throw new Error(`${o}\u5B58\u5728\u591A\u4E2AslotName=${i}\u7684\u5B50\u5143\u7D20\u6216\u5DF2\u7ECF\u6709attr\u540D\u4E3A${i}\uFF0C\u4E3A\u810F\u6570\u636E`)}if(tn(r.component)&&r.children.length===0)continue;n.attrs.push(ge({type:"component",component:r,scopeVariable:r.slot.scope,name:i}))}else e.push(r)}n.children=e}}});import{CallLogic as Ei,Logic as Ke,Param as Fi}from"@lcap/nasl";import{Argument as Ci,Identifier as Li}from"@lcap/nasl";function Kn(n){return new Ci({expression:new Li({name:n.name})})}a(Kn,"paramToArgument");var Vi=D("ReactStateManagerVanilla"),Mi=class{static{a(this,"ReactHookTransformer")}static componentRefNameToHook(e){return{kind:"free",code:`const ${e}= useRef(null);`,import:{from:"react",import:"{ useRef }"}}}};function Oi(n){return n.recursivelyExtractTreeStates().map(r=>{let i={...z.functions,...q.functions};switch(r.initialization.kind){case"global-hook":{let o=r.initialization.hookName;return{kind:"free",code:`const ${r.identifier} = ${o}();`,import:{from:"/src/Hooks",import:`{${o}}`}}}case"api-client":return{kind:"free",import:{from:"/src/apis",import:"{apiClient, genInitFromSchema}"},code:""};case"frontend-variable":{let o=r.initialization.hookName;return{kind:"free",code:`const ${r.identifier} = ${o}();`,import:{from:"/src/global-variables",import:`{${o}}`}}}default:G(r.initialization)}})}a(Oi,"makeTreeStateHooks");var z=C({name:"ReactStateManagerVanilla",functions:{makeLocalLogicHooks(n){let e=n.providedStates.flatMap(o=>{let s=o.identifier;return[{kind:"useState",declarations:[`${s}`,`use${s}`],initial:void 0}]}),r={...z.functions,...q.functions},i=n.actions.filter(o=>o.kind==="standalone").flatMap(o=>[{kind:"useCallback",declaration:o.name,deps:[],body:r.actionToBody(n,o)}]);return[...e,...i]},actionToBody(n,e,r){let i={...z.functions,...q.functions};function o(){let s=e.params.map(l=>Fi.from(l));if(e.logics.length===0)return new Ke;if(e.logics.length===1){let l=e.logics[0].logic;return Ke.from({...l,params:s})}else return Ke.from({params:s,body:e.logics.map(d=>{let f=`${d.logic.name}`;return Ei.from({calleeName:f,arguments:e.params.map(Kn)})})})}return a(o,"getLogic"),`${n.resolveExprToString(o(),i,r?.()?.(n)??i.withCtx(n))}`},makeLocalIndividualHooks(n,e){let r={...z.functions,...q.functions};return[...n.providedStates.filter(i=>i.kind==="standalone").flatMap(i=>{if(i.initialization&&i.kind==="standalone")switch(i.initialization.kind){case"component-ref":return[Mi.componentRefNameToHook(i.identifier)];default:G(i.initialization.kind)}return H(i)}),...n.actions.filter(i=>i.kind==="view-lifecycle").flatMap(i=>[{kind:"useEffect",deps:[],body:`()=>{
4951
4951
  (${r.actionToBody(n,i,e)})();
4952
4952
  return ()=>{};
4953
4953
  }`}])]},makeTreeStateHooks:Oi,initializationToExpr(n,e){if(!e)return;let r={...z.functions,...q.functions};switch(e.kind){case"static":return n.resolveExprToString(e.value.expr,r,r.withCtx(n));case"url-param":return e.defaultValue?.expr?n.resolveExprToString(e.defaultValue?.expr,r,r.withCtx(n)):void 0;default:return G(e)}},produceHooks(n){let e={...z.functions},r=z.functions.makeTreeStateHooks(n),i=z.functions.makeLocalIndividualHooks(n),o=e.makeLocalLogicHooks(n);return[...r,...i,...o]},withCtx(n){let e={...z.functions};return{resolveIdentifier:r=>e.__resolveIdentifier(n,r),resolveName:r=>e.__resolveName(n,r),resolveCalleeNamespace:r=>e.__resolveName(n,r)}},__resolveIdentifier(n,e){return{...z.functions}.__resolveName(n,e.name)},__resolveName(n,e){let r={...z.functions},i=o(e)??s(e);return i||Vi.debug(`cannot find symbol "${e}" in the state context`),i;function o(l){let d=n.findActionByName(l);if(d)return`${d.name}`}a(o,"resolveAsAction");function s(l){let d=n.findStateByName(l);if(d)switch(d.kind){case"standalone":case"local-logic":case"tree":return l;default:G(d)}}a(s,"resolveAsState")},__hooksDefinitions(){return new E("VanillaHookUtils",[],[],[`
@@ -4962,7 +4962,7 @@ const genInitFromSchema = useGenInitFromSchema();
4962
4962
  // Use "as const" below so the returned array is a proper tuple
4963
4963
  return [state, setState, ref] as const;
4964
4964
  };
4965
- `])}}});function zi(n){let e={...X.functions},r=a(l=>`${l.name}:${z.functions.actionToBody(n,l,()=>e.withCtx.bind(e))}`,"actionToProperty"),i=[...n.providedStates.filter(l=>l.kind==="local-logic"&&l.initialization?.kind!=="url-param").map(s),...n.actions.filter(l=>l.kind==="standalone").map(r)];function o(){let d=n.providedStates.filter(f=>f.kind==="local-logic"&&f.initialization?.kind==="url-param").map(f=>{let b={...z.functions}.initializationToExpr(n,f.initialization)??"''",g=`
4965
+ `])}}});function zi(n){let e={...X.functions},r=a(l=>`${l.name}:${z.functions.actionToBody(n,l,()=>e.withCtx.bind(e))}`,"actionToProperty"),i=[...n.providedStates.filter(l=>l.kind==="local-logic"&&l.initialization?.kind!=="url-param").map(s),...n.actions.filter(l=>l.kind==="standalone").map(r)];function o(){let d=n.providedStates.filter(f=>f.kind==="local-logic"&&f.initialization?.kind==="url-param").map(f=>{let b={...z.functions}.initializationToExpr(n,f.initialization)??"''",h=`
4966
4966
  get ${f.identifier}() {
4967
4967
  return localStore.$queryParams.get('${f.identifier}') || ${b};
4968
4968
  }
@@ -4970,7 +4970,7 @@ const genInitFromSchema = useGenInitFromSchema();
4970
4970
  set ${f.identifier}(value) {
4971
4971
  ${X.functions.storeName}.$updateQueryParam('${f.identifier}', value);
4972
4972
  }
4973
- `;return`${g},${t}`}).join(",");return d&&`
4973
+ `;return`${h},${t}`}).join(",");return d&&`
4974
4974
  $queryParams: new URL(window.location).searchParams,
4975
4975
  $updateQueryParam(key: string, value: string) {
4976
4976
  const params = new URL(window.location).searchParams;
@@ -4985,18 +4985,18 @@ const genInitFromSchema = useGenInitFromSchema();
4985
4985
  }
4986
4986
  })`,import:{import:"{ useLocalObservable }",from:"mobx-react-lite"}};function s(l){let f={...z.functions}.initializationToExpr(n,l.initialization);return`${l.identifier}: ${f??"undefined"}`}a(s,"localLogicStateToProperty")}a(zi,"makeLocalLogicBundleHook");var Ui=D("MobX Plugin"),X=C({name:"ReactStateManagerMobxPlugin",functions:{produceHooks(n){let e=zi(n),r=z.functions.makeTreeStateHooks(n),i={...X.functions},o=z.functions.makeLocalIndividualHooks(n,()=>i.withCtx.bind(i));return[...r,e,...o]},get storeName(){return"localStore"},__resolveIdentifier(n,e){return{...X.functions}.__resolveName(n,e.name)},__resolveName(n,e){let r={...X.functions},i=o(e)??s(e);return i||Ui.debug(`cannot find symbol "${e}" in the state context`),i;function o(l){let d=n.findActionByName(l);if(d)return`${r.storeName}.${d.name}`}a(o,"resolveAsAction");function s(l){let d=n.findStateByName(l);if(d)switch(d.kind){case"standalone":switch(d.initialization.kind){case"component-ref":return l;default:G(d.initialization.kind)}case"tree":return l;case"local-logic":return`${r.storeName}.${l}`;default:G(d)}}a(s,"resolveAsState")},withCtx(n){let e={...X.functions};return{resolveIdentifier:r=>e.__resolveIdentifier(n,r),resolveName:r=>e.__resolveName(n,r),resolveCalleeNamespace:r=>{let o=a(s=>{if(!s.startsWith("nasl.")&&s.startsWith("app.logics"))return e.__resolveName(n,Ce)},"resolveAsNamespace")(r);if(o)return o;{let s=e.__resolveName(n,r);return s?.endsWith("Ref")?`${s}.current`:s}}}},__hooksDefinitions(){return new E("MobxHooks",[],[],[`export const useUserInfo = ()=>{
4987
4987
  return window.$global.userInfo ?? {};
4988
- }`])}}});var Bn=X,B={...Bn.functions,...q.functions},Hi=D("react codegen");function Hn(n){return _(n.identifier)}a(Hn,"getComponentName");var xe="children",oe=class n{static{a(this,"ReactFragment")}name;imports;hooks;children;ctx;options;constructor(e,r,i,o,s,l){this.name=e,this.imports=r,this.hooks=i,this.children=o,this.ctx=s,this.options=l,this.attrMap=new Map,this.directives=new Map}attrMap;directives;getImports(){return pe([...this.imports,...this.hooks.map(e=>e.kind==="free"?e.import:{from:"react",import:`{${e.kind}}`}),{import:"{ observer }",from:"mobx-react-lite"},{from:"mobx",import:"{ toJS }"}].filter(F))}getHooks(){return this.hooks}getAttrMapStr(){let e=[];for(let[r,i]of this.attrMap)if(r!==xe){let o=a(()=>{if(i.kind==="expr")return`{${i.payload}}`;{let s=i.payload;return s.includes('"')?`{${JSON.stringify(s)}}`:`${JSON.stringify(s)}`}},"getAttrValueStr");e.push({key:se(r),value:o()})}return e.map(({key:r,value:i})=>` ${r}=${i}`).join("")}getMangledName(){return this.options?.mangledName??this.name}toJsx(e){let r=this.getAttrMapStr(),i=e?.rootAsFragment?"":this.name,o=a(()=>{let f=a(()=>{let g=this.attrMap.get(xe);if(g)return g.kind==="string"?v(g.payload):`{${g.payload}}`;return e?.shallow?"":this.children.map(x=>x.toJsx()).join(`
4989
- `)??"";function v(x){return Qi(x).replace(/({|})/g,(c,p)=>`{'${p}'}`)}},"getChildrenStr")(),w=b();if(this.options?.slot){let g=this.options?.slot.scope;if(this.options?.slot.target&&g)return{body:`(${g}: any) => ${w}`}}return{body:w};function b(){return i?`<${i}${r}>${f}</${i}>`:`<>${f}</>`}},"getBody"),{body:s}=o(),l=this.directives.get("if");return l?`{(${this.ctx.resolveExprToString(l.expression.expr,B,B.withCtx(this.ctx))}) ? (${s}) : undefined}`:s}toFunctionComponentVariable(){let e=this.getMangledName(),r=this.toJsx({rootAsFragment:!0});function i(l){switch(l.kind){case"useCallback":{let d=l.body;return`const ${l.declaration} = useCallback(${d}, [${l.deps.join(",")}])`}case"useState":return`const [${l.declarations.join(",")}] = useState(${l.initial})`;case"useEffect":return`useEffect(${l.body}, [${l.deps.join(",")}])`;case"free":return`${l.code}`;default:H(l)}}a(i,"serializeReactHook");let o=`const ${e}: FC = observer(() => {
4988
+ }`])}}});var Bn=X,B={...Bn.functions,...q.functions},Hi=D("react codegen");function Hn(n){return _(n.identifier)}a(Hn,"getComponentName");var xe="children",oe=class n{static{a(this,"ReactFragment")}name;imports;hooks;children;ctx;options;constructor(e,r,i,o,s,l){this.name=e,this.imports=r,this.hooks=i,this.children=o,this.ctx=s,this.options=l,this.attrMap=new Map,this.directives=new Map}attrMap;directives;getImports(){return pe([...this.imports,...this.hooks.map(e=>e.kind==="free"?e.import:{from:"react",import:`{${e.kind}}`}),{import:"{ observer }",from:"mobx-react-lite"},{from:"mobx",import:"{ toJS }"}].filter(F))}getHooks(){return this.hooks}getAttrMapStr(){let e=[];for(let[r,i]of this.attrMap)if(r!==xe){let o=a(()=>{if(i.kind==="expr")return`{${i.payload}}`;{let s=i.payload;return s.includes('"')?`{${JSON.stringify(s)}}`:`${JSON.stringify(s)}`}},"getAttrValueStr");e.push({key:se(r),value:o()})}return e.map(({key:r,value:i})=>` ${r}=${i}`).join("")}getMangledName(){return this.options?.mangledName??this.name}toJsx(e){let r=this.getAttrMapStr(),i=e?.rootAsFragment?"":this.name,o=a(()=>{let f=a(()=>{let h=this.attrMap.get(xe);if(h)return h.kind==="string"?v(h.payload):`{${h.payload}}`;return e?.shallow?"":this.children.map(x=>x.toJsx()).join(`
4989
+ `)??"";function v(x){return Qi(x).replace(/({|})/g,(c,p)=>`{'${p}'}`)}},"getChildrenStr")(),w=b();if(this.options?.slot){let h=this.options?.slot.scope;if(this.options?.slot.target&&h)return{body:`(${h}: any) => ${w}`}}return{body:w};function b(){return i?`<${i}${r}>${f}</${i}>`:`<>${f}</>`}},"getBody"),{body:s}=o(),l=this.directives.get("if");return l?`{(${this.ctx.resolveExprToString(l.expression.expr,B,B.withCtx(this.ctx))}) ? (${s}) : undefined}`:s}toFunctionComponentVariable(){let e=this.getMangledName(),r=this.toJsx({rootAsFragment:!0});function i(l){switch(l.kind){case"useCallback":{let d=l.body;return`const ${l.declaration} = useCallback(${d}, [${l.deps.join(",")}])`}case"useState":return`const [${l.declarations.join(",")}] = useState(${l.initial})`;case"useEffect":return`useEffect(${l.body}, [${l.deps.join(",")}])`;case"free":return`${l.code}`;default:H(l)}}a(i,"serializeReactHook");let o=`const ${e}: FC = observer(() => {
4990
4990
  ${this.hooks.map(i).join(`;
4991
4991
  `)}
4992
4992
  return (${r});
4993
- });`,s=pe([...this.getImports()]).filter(F);return{componentStr:o,imports:s}}toCode(){let{componentStr:e,imports:r}=this.toFunctionComponentVariable();return{code:e,imports:r}}static fromComponentIR(e){let r=Hn(e),i=e.elements.map(s=>te.functions.genReactFragment(s,e.stateContext)),o=X.functions.produceHooks(e.stateContext);return new n(r,[...i.flatMap(s=>s.getImports())],[...o,...i.flatMap(s=>s.getHooks())],i,e.stateContext,{mangledName:`__${r}`})}bindEvent(e,r){let i=r?.handlerPrefix??"on-",o=e.__raw.name,s=`${i}${o}`,l=B.__resolveName(this.ctx,e.handlerName);if(!l)throw new Error("cannot find event handler");let d=e.params,f=d.at(0);if(d.length>1&&f){let w=d.map(b=>b.name).join(",");this.attrMap.set(s,{kind:"expr",payload:`(${f.name}) => ${l}(${w})`})}else this.attrMap.set(s,{kind:"expr",payload:l})}bindAttr(e){switch(e.kind){case"expr":{if(e.__raw.type==="string")this.attrMap.set(e.__raw.name,{kind:"string",payload:String(e.__raw.value)});else if(e.__raw.type==="dynamic")if(e.expression.expr){let r=Ue.functions.hackBindAttribute(this.ctx,e);if(r.concept==="BindEvent")return this.bindEvent(r,{handlerPrefix:""});let i=this.ctx.resolveExprToString(r.expression.expr,B,B.withCtx(this.ctx));this.attrMap.set(e.__raw.name,{kind:"expr",payload:i})}else{let r=`${e.__raw.nodePath}@${e.__raw.concept} \u7684expression \u4E3A\u7A7A`;Hi.debug(r);return}else if(e.__raw.type==="static"){if(e.__raw.name==="children"){this.attrMap.set(e.__raw.name,{kind:"string",payload:String(e.__raw.value)});return}cn(e.__raw.value)&&this.attrMap.set(e.__raw.name,{kind:"expr",payload:String(e.__raw.value)})}return}case"render":{let r=te.functions.genReactFragment(e.component,this.ctx),i=r.toJsx();this.imports.push(...r.getImports()),this.attrMap.set(e.name,{kind:"expr",payload:i});return}case"validation-rules":{let r=e.rules.map(i=>this.ctx.resolveExprToString(i,B,B.withCtx(this.ctx)));this.attrMap.set(e.name,{kind:"expr",payload:`[${r.join(", ")}]`});return}default:G(e)}}setStyleAndStaticStyle(e,r){if(e.length===0&&!r)return;let i=Jn(r);e.forEach(f=>{if(!f.name)throw new Error(f.nodePath);if(f.expression&&(i[f.name]=f,!qn(f)))throw new Error(`${f} is not bindStyle`)});let o=this;function s(f){return f.replace(/-([a-z])/g,(w,b)=>b.toUpperCase())}a(s,"cssPropertyNameToReactStyleObjectKey");let l=Object.entries(i).map(([f,w])=>{if(qi(w)&&qn(w)){let b=s(f),g=o.ctx.resolveExprToString(w.expression,B,B.withCtx(o.ctx));return b==="backgroundImage"?{kind:"expr",payload:`\`url(\${${g}})\``,key:b}:{kind:"expr",payload:g,key:b}}else if(Bi(w))return{kind:"string",payload:w,key:f}}).filter(F);function d(f){return{kind:"expr",payload:`{${f.map(b=>{let g=t();return`${JSON.stringify(b.key)}: ${g}`;function t(){return b.kind==="expr"?b.payload:`${JSON.stringify(b.payload)}`}}).join(`,
4994
- `)}}`}}a(d,"formatValuePayloadAsObjectStr"),this.attrMap.set("style",d(l))}bindDirective(e){this.directives.set(e.kind,e)}},E=class n{static{a(this,"ReactFileDescription")}fileName;imports;body;exports;folder;constructor(e,r,i,o,s){this.fileName=e,this.imports=r,this.body=i,this.exports=o,this.folder=s}get fileNameWithExt(){return this.fileName.includes(".")?this.fileName:`${this.fileName}.tsx`}getFolderPath(){if(this.folder)return Ee(this.folder)}getImports(){return[...this.imports,...this.body.flatMap(e=>e.getImports())].filter(F)}async serialize(e){let r=this.exports,i=this.body.map(w=>w.toCode()),s=this.getImports().map(e),d=[pe(s).join(`
4995
- `),i.map(w=>w.code).join(`
4996
- `),pe(r).join(`
4993
+ });`,s=pe([...this.getImports()]).filter(F);return{componentStr:o,imports:s}}toCode(){let{componentStr:e,imports:r}=this.toFunctionComponentVariable();return{code:e,imports:r}}static fromComponentIR(e){let r=Hn(e),i=e.elements.map(s=>te.functions.genReactFragment(s,e.stateContext)),o=X.functions.produceHooks(e.stateContext);return new n(r,[...i.flatMap(s=>s.getImports())],[...o,...i.flatMap(s=>s.getHooks())],i,e.stateContext,{mangledName:`__${r}`})}bindEvent(e,r){let i=r?.handlerPrefix??"on-",o=e.__raw.name,s=`${i}${o}`,l=B.__resolveName(this.ctx,e.handlerName);if(!l)throw new Error("cannot find event handler");let d=e.params,f=d.at(0);if(d.length>1&&f){let w=d.map(b=>b.name).join(",");this.attrMap.set(s,{kind:"expr",payload:`(${f.name}) => ${l}(${w})`})}else this.attrMap.set(s,{kind:"expr",payload:l})}bindAttr(e){switch(e.kind){case"expr":{if(e.__raw.type==="string")this.attrMap.set(e.__raw.name,{kind:"string",payload:String(e.__raw.value)});else if(e.__raw.type==="dynamic")if(e.expression.expr){let r=Ue.functions.hackBindAttribute(this.ctx,e);if(r.concept==="BindEvent")return this.bindEvent(r,{handlerPrefix:""});let i=this.ctx.resolveExprToString(r.expression.expr,B,B.withCtx(this.ctx));this.attrMap.set(e.__raw.name,{kind:"expr",payload:i})}else{let r=`${e.__raw.nodePath}@${e.__raw.concept} \u7684expression \u4E3A\u7A7A`;Hi.debug(r);return}else if(e.__raw.type==="static"){if(e.__raw.name==="children"){this.attrMap.set(e.__raw.name,{kind:"string",payload:String(e.__raw.value)});return}cn(e.__raw.value)&&this.attrMap.set(e.__raw.name,{kind:"expr",payload:String(e.__raw.value)})}return}case"render":{let r=te.functions.genReactFragment(e.component,this.ctx),i=r.toJsx();this.imports.push(...r.getImports()),this.attrMap.set(e.name,{kind:"expr",payload:i});return}case"validation-rules":{let r=e.rules.map(i=>this.ctx.resolveExprToString(i,B,B.withCtx(this.ctx)));this.attrMap.set(e.name,{kind:"expr",payload:`[${r.join(", ")}]`});return}default:G(e)}}setStyleAndStaticStyle(e,r){if(e.length===0&&!r)return;let i=Jn(r);e.forEach(f=>{if(!f.name)throw new Error(f.nodePath);if(f.expression&&(i[f.name]=f,!qn(f)))throw new Error(`${f} is not bindStyle`)});let o=this;function s(f){return f.replace(/-([a-z])/g,(w,b)=>b.toUpperCase())}a(s,"cssPropertyNameToReactStyleObjectKey");let l=Object.entries(i).map(([f,w])=>{if(qi(w)&&qn(w)){let b=s(f),h=o.ctx.resolveExprToString(w.expression,B,B.withCtx(o.ctx));return b==="backgroundImage"?{kind:"expr",payload:`\`url(\${${h}})\``,key:b}:{kind:"expr",payload:h,key:b}}else if(Bi(w))return{kind:"string",payload:w,key:f}}).filter(F);function d(f){return{kind:"expr",payload:`{${f.map(b=>{let h=t();return`${JSON.stringify(b.key)}: ${h}`;function t(){return b.kind==="expr"?b.payload:`${JSON.stringify(b.payload)}`}}).join(`,
4994
+ `)}}`}}a(d,"formatValuePayloadAsObjectStr"),this.attrMap.set("style",d(l))}bindDirective(e){this.directives.set(e.kind,e)}},E=class n{static{a(this,"ReactFileDescription")}fileName;imports;body;exports;folder;constructor(e,r,i,o,s){this.fileName=e,this.imports=r,this.body=i,this.exports=o,this.folder=s}get fileNameWithExt(){return this.fileName.includes(".")?this.fileName:`${this.fileName}.tsx`}getFolderPath(){if(this.folder)return Ee(this.folder)}getImports(){return[...this.imports,...this.body.flatMap(e=>e.getImports())].filter(F)}async serialize(e,r){let i=this.exports,o=this.body.map(b=>b.toCode()),l=this.getImports().map(e),f=[pe(l).join(`
4995
+ `),o.map(b=>b.code).join(`
4996
+ `),pe(i).join(`
4997
4997
  `)].join(`
4998
- `),f=await Cn.functions.format(d);return this.fileNameWithExt.endsWith(".tsx")?`//@ts-nocheck
4999
- ${f}`:f}merge(e){return e?(this.imports.push(...e.imports),this.body.push(...e.body),this.exports.push(...e.exports),this):this}static empty(e){return new n(e??"NoName",[],[],[])}};function Ji(n){return Re(n.component)&&n.component.tag==="template"?"":n.component.tag}a(Ji,"getReactComponentName");var te=C({name:"reactCodeGen",functions:{genReactFragment(n,e){let r={...le.functions,...te.functions,...ie.functions,...Gn.functions},i=[{from:"react",import:"React"},{from:"react",import:"{type FC}"}],o=[];r.preprocessForSlots(n);let s=n.children.map(f=>r.genReactFragment(f,e));s.forEach(f=>{o.push(...f.getHooks()),i.push(...f.getImports())});let l=Ji(n),d=new oe(l,i,o,s,e,{slot:n.slot});l&&Re(n.component)&&i.push({from:`${n.component.libraryName}`,import:`{${n.component.tag}}`}),d.setStyleAndStaticStyle(n.__raw.bindStyles??[],n.__raw.staticStyle??"");for(let f of n.events)d.bindEvent(f);for(let f of n.attrs)d.bindAttr(f);for(let f of n.directives)d.bindDirective(f);return d},genReactComponent(n,e){let r=Hn(n),i=oe.fromComponentIR(n);return[new E(r,pe(i.getImports()),[i],[`export default ${i.getMangledName()}`],e)]},recursivelyGenReactComponent(n,e,r){let i={...te.functions};return e.set(n,r?Ee(r):"/"),Ki([i.genReactComponent(n,r),n.childComponents.flatMap(o=>i.recursivelyGenReactComponent(o,e,[...r??[],{name:n.identifier}]))])},buildRoutes(n,e){let r={...le.functions,...ie.functions},{routes:i}=r.extractRoute(n,"/",{lazy:!0}),{code:o,imports:s}=r.routeToCode(i,e);return new E("Router",[...s],[],[o])},buildPlatformConfig(n){let e={...le.functions,...ie.functions},{authResourcePaths:r,baseResourcePaths:i}=e.extractRoute(n.views,"/",{lazy:!1}),o={...n.configs.basePlatformConfig,authResourcePaths:r,baseResourcePaths:i};return new E("platform.config.ts",[],[],[`export default ${In(o)}`])},buildInit(n){let e={...q.functions},r="",o=n.configs.document.icon?`
4998
+ `);return this.fileNameWithExt.endsWith(".tsx")&&(f=`//@ts-nocheck
4999
+ ${f}`),r?.noFormat?f:await Cn.functions.format(f)}merge(e){return e?(this.imports.push(...e.imports),this.body.push(...e.body),this.exports.push(...e.exports),this):this}static empty(e){return new n(e??"NoName",[],[],[])}};function Ji(n){return Re(n.component)&&n.component.tag==="template"?"":n.component.tag}a(Ji,"getReactComponentName");var te=C({name:"reactCodeGen",functions:{genReactFragment(n,e){let r={...le.functions,...te.functions,...ie.functions,...Gn.functions},i=[{from:"react",import:"React"},{from:"react",import:"{type FC}"}],o=[];r.preprocessForSlots(n);let s=n.children.map(f=>r.genReactFragment(f,e));s.forEach(f=>{o.push(...f.getHooks()),i.push(...f.getImports())});let l=Ji(n),d=new oe(l,i,o,s,e,{slot:n.slot});l&&Re(n.component)&&i.push({from:`${n.component.libraryName}`,import:`{${n.component.tag}}`}),d.setStyleAndStaticStyle(n.__raw.bindStyles??[],n.__raw.staticStyle??"");for(let f of n.events)d.bindEvent(f);for(let f of n.attrs)d.bindAttr(f);for(let f of n.directives)d.bindDirective(f);return d},genReactComponent(n,e){let r=Hn(n),i=oe.fromComponentIR(n);return[new E(r,pe(i.getImports()),[i],[`export default ${i.getMangledName()}`],e)]},recursivelyGenReactComponent(n,e,r){let i={...te.functions};return e.set(n,r?Ee(r):"/"),Ki([i.genReactComponent(n,r),n.childComponents.flatMap(o=>i.recursivelyGenReactComponent(o,e,[...r??[],{name:n.identifier}]))])},buildRoutes(n,e){let r={...le.functions,...ie.functions},{routes:i}=r.extractRoute(n,"/",{lazy:!0}),{code:o,imports:s}=r.routeToCode(i,e);return new E("Router",[...s],[],[o])},buildPlatformConfig(n){let e={...le.functions,...ie.functions},{authResourcePaths:r,baseResourcePaths:i}=e.extractRoute(n.views,"/",{lazy:!1}),o={...n.configs.basePlatformConfig,authResourcePaths:r,baseResourcePaths:i};return new E("platform.config.ts",[],[],[`export default ${In(o)}`])},buildInit(n){let e={...q.functions},r="",o=n.configs.document.icon?`
5000
5000
  {
5001
5001
  const link = document.createElement('link');
5002
5002
  link.rel = 'shortcut icon';
@@ -5052,7 +5052,7 @@ ${f}`:f}merge(e){return e?(this.imports.push(...e.imports),this.body.push(...e.b
5052
5052
  return {
5053
5053
  ${e.map(i=>`${i.name}: ${_(i.name)}`)}
5054
5054
  };
5055
- }`])},async genFiles(n,e){let r={...le.functions,...te.functions,...ie.functions,...Fe.functions,...de.functions},i=E.empty("Hooks").merge(new E("",[{from:"./init"}],[],[])).merge(Bn.functions.__hooksDefinitions()).merge(ie.functions.__hooksDefinitions()).merge(Fe.functions.__hooksDefinitions()).merge(Ue.functions.__hooksDefinitions()).merge(r.buildLibraryHook(n.packages)).merge(new E("",[],[],["export {nasl, genInitFromSchema};"])),o=r.buildApiStubFile(n.apis,n.configs.metaData),s=new WeakMap,l=n.views.flatMap(t=>r.recursivelyGenReactComponent(t,s)),d=r.buildRoutes(n.views,s),f=await r.buildMasterCss(n.configs.themeCSS,n.packages),w=await r.buildGlobalFrontendVariableFile(n.configs.globalVariables,n.baseCtx),b=new Gi;return b.bind(L.FileSystemProvider).to(re),b.bind(L.ProjectOrganizer).to(be),await b.get(L.ProjectOrganizer).organize({baseDir:e,project:{api:o,utils:i,routes:d,views:l,platformConfig:r.buildPlatformConfig(n),init:r.buildInit(n),masterCss:f,globalVariables:w}})}}});function Jn(n){try{let e=Wn.parse(n);return Wi.objectify(e)}catch{return{}}}a(Jn,"styleStringToInlineObject");var Ln=C({name:"JsxCodeGen",functions:{printJSX(n,e){return oe.fromComponentIR(n).toJsx(e)},printTag(n){return`<${n} />`}}});import{injectable as Zi}from"inversify";var Xn=`
5055
+ }`])},async genFiles(n,e){let r={...le.functions,...te.functions,...ie.functions,...Fe.functions,...de.functions},i=E.empty("Hooks").merge(new E("",[{from:"./init"}],[],[])).merge(Bn.functions.__hooksDefinitions()).merge(ie.functions.__hooksDefinitions()).merge(Fe.functions.__hooksDefinitions()).merge(Ue.functions.__hooksDefinitions()).merge(r.buildLibraryHook(n.packages)).merge(new E("",[],[],["export {nasl, genInitFromSchema};"])),o=r.buildApiStubFile(n.apis,n.configs.metaData),s=new WeakMap,l=n.views.flatMap(t=>r.recursivelyGenReactComponent(t,s)),d=r.buildRoutes(n.views,s),f=await r.buildMasterCss(n.configs.themeCSS,n.packages),w=await r.buildGlobalFrontendVariableFile(n.configs.globalVariables,n.baseCtx),b=new Gi;return b.bind(L.FileSystemProvider).to(re),b.bind(L.ProjectOrganizer).to(be),await b.get(L.ProjectOrganizer).organize({baseDir:e,project:{api:o,utils:i,routes:d,views:l,platformConfig:r.buildPlatformConfig(n),init:r.buildInit(n),masterCss:f,globalVariables:w},options:{noFormat:!n.configs.config.isExport}})}}});function Jn(n){try{let e=Wn.parse(n);return Wi.objectify(e)}catch{return{}}}a(Jn,"styleStringToInlineObject");var Ln=C({name:"JsxCodeGen",functions:{printJSX(n,e){return oe.fromComponentIR(n).toJsx(e)},printTag(n){return`<${n} />`}}});import{injectable as Zi}from"inversify";var Xn=`
5056
5056
  if(window.ICESTARK && window.ICESTARK.root) {
5057
5057
  Object.assign(window.ICESTARK, {
5058
5058
  appEnter({ container, customProps }) {
@@ -5178,5 +5178,5 @@ window.LazyLoad.css(\${JSON.stringify(cssAssets)})\`;
5178
5178
  ${d};
5179
5179
  })();\`;
5180
5180
  }
5181
- `}];for(let b of w)this.fileSystemProvider.write(b.path,b.content);return w}catch(o){throw o}}};De=to([ro(),qe(0,Be(L.IRBuilder)),qe(1,Be(L.MicroFrontendManager)),qe(2,Be(L.FileSystemProvider)),et("design:type",Function),et("design:paramtypes",[typeof NASLDomain>"u"||typeof NASLDomain.IRBuilder>"u"?Object:NASLDomain.IRBuilder,typeof JavaScriptDomain>"u"||typeof JavaScriptDomain.FrontendApplicationDomain>"u"||typeof JavaScriptDomain.FrontendApplicationDomain.MicroFrontendManager>"u"?Object:JavaScriptDomain.FrontendApplicationDomain.MicroFrontendManager,typeof GeneratorInfrastructureDomain>"u"||typeof GeneratorInfrastructureDomain.FileSystemProvider>"u"?Object:GeneratorInfrastructureDomain.FileSystemProvider])],De);function nt(){let n=new oo;return n.bind(L.NASLTranspiler).to(De),n.bind(L.IRBuilder).to(fe),n.bind(L.MicroFrontendManager).to(ke),n.bind(L.FileSystemProvider).to(re).inSingletonScope(),n}a(nt,"makeDefaultContainer");async function tt(n,e,r,i="./out",o){let s=D("\u7FFB\u8BD1\u8FC7\u7A0B");s.debug({config:r});async function l(){s.info("\u5F00\u59CB\u7FFB\u8BD1");try{let f=await o.get(L.NASLTranspiler).transpile({app:n,frontend:e,config:r,baseDir:i});return o.isBound(L.CodeGenerationLifecycleHooks)&&o.getAll(L.CodeGenerationLifecycleHooks).forEach(w=>{w.afterAllFilesGenerated()}),f}catch(f){throw s.error(f),f}finally{s.info("\u7FFB\u8BD1\u7ED3\u675F")}}return a(l,"genCode"),await l()??[]}a(tt,"translateNASLToReactApp");function rt(n,e,r){let i=`${e.USER_STATIC_URL}/${e.tenant}/${n.id}/${e.env}`;return r&&i.startsWith("//")?`${r}:${i}`:i}a(rt,"getBasePath");function so(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"?n:"https://"+n}catch{return`https://${n}`}}a(so,"ensureUrlHasProtocol");function it(n){return so(n.replace(/^\/\//,""))}a(it,"normalizeStaticUrl");import{isConnector as ao}from"@lcap/nasl/out/concepts/utils/asserts";function co(n){let e=D("extractFrontendDeps"),r=n.dependencies.filter(s=>!ao(s)&&!!s.frontends?.length);e.info({packageInfo:n.packageInfos});let i=[...r.map(({name:s,version:l})=>({name:s,version:l,kind:"extension"}))],o={name:"@lcap/pc-react-ui",version:"1.0.0",kind:"standard"};return i.push(o),i}a(co,"extractFrontendDeps");async function ot(n,e,r,i){let o=D("downloadDependenciesToProject"),s=co(n);if(s.length===0){o.info("\u65E0\u4F9D\u8D56\u5E93");return}else o.info({feExtensions:s.map(w=>`${w.name}@${w.version}`)},"\u524D\u7AEF\u4F9D\u8D56\u5E93\u5217\u8868");o.info("\u5F00\u59CB\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93");let l=it(i.STATIC_URL),d=i.axios,f=await Promise.all(s.map(async w=>{o.info({ext:w},"\u4E0B\u8F7D\u4F9D\u8D56\u5E93");let g=`packages${w.kind==="extension"?"/extension":""}/${w.name}@${w.version}`,t=`${g}/dist-theme`,v=`${l}/${g}`,x=await p(w);o.debug({sources:x});let c=x.map(u=>{let y=`${l}/${u}`;return o.debug({url:y,source:u}),{url:y,source:u}});r.write(`/src/${g}/dist-theme/index.css`,""),o.info({urls:c.map(u=>u.url)},"\u4E0B\u8F7D\u6587\u4EF6\u5217\u8868");try{await Promise.all([...c.map(async({source:u,url:y})=>{o.debug({url:y},"\u6B63\u5728\u4E0B\u8F7D");try{let h=(await d.get(y,{responseType:"text"})).data,A=`/src/${u}`;r.write(A,h),o.debug({vfsPath:A},"\u5199\u5165\u865A\u62DF\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u5F84")}catch(m){o.error({url:y,error:m},"\u4E0B\u8F7D\u5931\u8D25")}o.debug({url:y},"\u4E0B\u8F7D\u6210\u529F")})])}catch(u){o.error(u)}async function p({name:u,version:y}){if(u==="@lcap/pc-react-ui")return["index.js","index.css"].map(T=>`packages/${u}@${y}/dist-theme/${T}`);let m=`${v}/manifest`,k=(await d.get(m,{responseType:"text"})).data.split(/\n/).filter(T=>T.trim().startsWith(t)).map(T=>T.split(":")[0].trim());return k.length===0?[`${g}/dist-theme/index.js`]:k}return a(p,"listPackageSources"),{packagePath:v,sources:x,projectPath:g,...w}}));return o.info("\u4F9D\u8D56\u5E93\u4E0B\u8F7D\u5B8C\u6210"),o.debug(f),f}a(ot,"downloadDependenciesToProject");var He=class{static{a(this,"VirtualProject")}fileDict;constructor(e){this.fileDict=e}mutateFile(e,r,i={}){this.fileDict[e]={...i,code:r}}getFileDict(){return{files:this.fileDict}}readFile(e){return this.fileDict[e].code}};async function st(n,e,r,i,o){let s=i??nt(),l=D("compileAsProject");l.info("\u5F00\u59CB\u7F16\u8BD1\u9759\u6001\u4EA7\u7269"),l.info("\u8F7D\u5165\u9879\u76EE\u6A21\u677F");let d=s.get(L.FileSystemProvider);Object.entries(Ze.files).forEach(([t,v])=>{d.write(t,v.code)});let f=ot(n,e,d,{STATIC_URL:r.STATIC_URL,axios:o??lo.create()}),w=await tt(n,e,r,"/",s);await g(d),l.debug(Object.keys(d.toJSON()),"\u751F\u6210\u7684\u6587\u4EF6");let b=new He({});return Object.entries(d.toJSON()).forEach(([t,v])=>{b.mutateFile(t,v??"")}),b;async function g(t){let x=(await f)?.map(m=>{let h=m.sources.find(A=>A.endsWith("/index.js"));if(h)return{name:m.name,resolvedTo:`./src/${h}`,scope:m.kind==="extension"?"@extension":void 0}}).filter(F).map(m=>`'${m.scope?`${m.scope}/${m.name}`:m.name}' : path.resolve(__dirname, '${m.resolvedTo}'),`).join(`
5182
- `)??[],c=po(n,r,e),p=y(n,r),u=t.read("/rspack.config.js");u&&t.write("/rspack.config.js",u.replace("const backendUrl = '';",`const backendUrl = '${p}'`).replace("alias: {}",`alias: {${x}}`).replace("const publicPath = '';",`const publicPath = '${c}';`));function y(m,h){return h.isExport?"localhost:8080":`http://${h.env}.${m.name}.${h.tenant}.${h.lowcodeDomain}`}a(y,"getBackendPath")}a(g,"configRspack")}a(st,"compileAsProject");function po(n,e,r){if(e.isExport)return"/";let i=`${rt(n,e)}${r.basePath??""}`;return i.endsWith("/")?i:`${i}/`}a(po,"getPublicPath");import{isNil as uo,isObject as mo}from"lodash";var at=D("SanityCheck");function Je(n,e=[]){if(mo(n)){if("concept"in n&&n?.concept==="ViewElement"&&[uo(n.name),n.name===""].some(Boolean)){let r=`${JSON.stringify(e)}\u7684name\u4E3A\u7A7A\uFF0C\u8FD9\u53EF\u80FD\u7531\u810F\u6570\u636E\u5BFC\u81F4\uFF0C\u8BF7\u62A5\u544A\u6B64\u9519\u8BEF`;throw at.error(r),at.error({appObject:n}),new Error}Object.entries(n).forEach(([r,i])=>{Je(i,[...e,r])})}}a(Je,"sanityCheck");var go={nuimsDomain:"user.lcap.codewave-test.163yun.com",kubeInsightAppCluster:"drill",officialTenantId:"00000000000000000000000000000000",enableOpenAiCompletionForLogic:!0,pwdSecurity:{pwdCategory:"normal"},tenantAndAppMaxLength:32,platformCreateDatabaseOpen:!1,documentCenter:{isLocalDeployment:!1,deliveryMode:"online",url:"https://community.codewave.163.com/CommunityParent"},lcpRedirectSwitch:!0,kubeInsightAddress:"",gatewayType:"light",STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",traceSwitch:!1,resourceAssignStrategy:"app",creatorIsManager:!1,websqlSwitch:"dev,online",enableCodeWaveMarket:!1,platformEnv:"dev",IDE_STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",isPrivatized:"true",clientToken:"ODDINZU1OWYTZWM5NY0ZZJEYLTK3NGQTNWNJNJQYYMM0OGM1",biConfig:!1,platformExtraAbilityDetail:null,USER_STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",kubeInsightServiceName:"codewave#lcap-fe",consoleDomain:"",enableOpenAiForLogic:!0,lowcodeDomain:"lcap.codewave-test.163yun.com",name:"lcap",tenantIntegrationSwitch:!1,envNuimsDomain:{dev:"user.lcap.codewave-test.163yun.com",online:"user.lcap.codewave-test.163yun.com"},envLcpDomain:{dev:{lcpDomain:"lcap.codewave-test.163yun.com"},online:{lcpDomain:"lcap.codewave-test.163yun.com"}},kubeClientApplicationKey:"lcp-drill",tenant:"defaulttenant",env:"dev",tenantID:"00000000000000000000000000000000",multiEnvEnable:!0,tenantType:0,tenantLevel:1,tenantLevelDetail:{onlineReplicasLimit:"3",aiJavaLogicCompletionDisplay:"true",releaseDevAppCountLimit:"-1",customPackageSupport:"true",aiNl2sqlSupport:"false",aiNextComponentSupport:"true",productAppSpecification:"1",configDatabaseSupport:"true",aiJavaLogicDisplay:"true",appPublishOnlineSupport:"true",rdsMode:"0",assetsLibraryExportSupport:"true",assignDeveloperSupport:"true",cpuLimit:"4",configSourceCodeSupport:"true",mavenConfigEditSupport:"true",aiCodeAnalyzeSupport:"false",aiNl2LogicSupport:"false",onboardingSupport:"false",storageLimit:"8",releaseAppCountLimit:"4",configFrontSupport:"true",configFileStorageSupport:"true",aiNl2sqlDisplay:"true",teamDeveloperSupport:"true",accountLimit:"-1",aiD2CSupport:"false",exportSourceSupport:"true",customDomainSupport:"true",reportFormsEditSupport:"true",aiNl2LogicDisplay:"true",memoryLimit:"8",aiJavaLogicCompletionSupport:"false",assetsArchetypeSupport:"true",appCreateLimit:"-1",configImageRepoSupport:"true",configSourceSupport:"true",aiJavaLogicSupport:"false",assetsTemplateExportSupport:"true"},tenantExtraAbilityDetail:null,tenantVersion:{tenantName:"defaulttenant",versionType:4,versionId:"2417a61d7e9a4cb7b5ed2d83d29cc5fa",snapshotId:"c8885750ba4f48eea67f85fc965f71f8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",changeStatus:0,changeDesc:null,createdTime:"2024-02-02 12:44:02",updatedTime:"2024-02-02 12:44:02",businessVersionDTO:{versionType:4,versionId:"2417a61d7e9a4cb7b5ed2d83d29cc5fa",snapshotId:"c8885750ba4f48eea67f85fc965f71f8",versionName:"\u79C1\u6709\u5316\u4F01\u4E1A\u7248",description:"\u79C1\u6709\u5316\u4F01\u4E1A\u7248",resourceList:null,createdTime:"2024-02-02 12:26:04",updatedTime:"2024-02-02 12:26:04"},resourceList:[{resourceItem:"onlineReplicasLimit",resourceValue:"3"},{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true"},{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1"},{resourceItem:"customPackageSupport",resourceValue:"true"},{resourceItem:"aiNl2sqlSupport",resourceValue:"false"},{resourceItem:"aiNextComponentSupport",resourceValue:"true"},{resourceItem:"productAppSpecification",resourceValue:"1"},{resourceItem:"configDatabaseSupport",resourceValue:"true"},{resourceItem:"aiJavaLogicDisplay",resourceValue:"true"},{resourceItem:"appPublishOnlineSupport",resourceValue:"true"},{resourceItem:"rdsMode",resourceValue:"0"},{resourceItem:"assetsLibraryExportSupport",resourceValue:"true"},{resourceItem:"assignDeveloperSupport",resourceValue:"true"},{resourceItem:"cpuLimit",resourceValue:"4"},{resourceItem:"configSourceCodeSupport",resourceValue:"true"},{resourceItem:"mavenConfigEditSupport",resourceValue:"true"},{resourceItem:"aiNl2LogicSupport",resourceValue:"false"},{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false"},{resourceItem:"onboardingSupport",resourceValue:"false"},{resourceItem:"storageLimit",resourceValue:"8"},{resourceItem:"releaseAppCountLimit",resourceValue:"4"},{resourceItem:"configFrontSupport",resourceValue:"true"},{resourceItem:"configFileStorageSupport",resourceValue:"true"},{resourceItem:"accountLimit",resourceValue:"-1"},{resourceItem:"teamDeveloperSupport",resourceValue:"true"},{resourceItem:"aiNl2sqlDisplay",resourceValue:"true"},{resourceItem:"exportSourceSupport",resourceValue:"true"},{resourceItem:"aiD2CSupport",resourceValue:"false"},{resourceItem:"customDomainSupport",resourceValue:"true"},{resourceItem:"reportFormsEditSupport",resourceValue:"true"},{resourceItem:"memoryLimit",resourceValue:"8"},{resourceItem:"aiNl2LogicDisplay",resourceValue:"true"},{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false"},{resourceItem:"appCreateLimit",resourceValue:"-1"},{resourceItem:"assetsArchetypeSupport",resourceValue:"true"},{resourceItem:"configSourceSupport",resourceValue:"true"},{resourceItem:"configImageRepoSupport",resourceValue:"true"},{resourceItem:"assetsTemplateExportSupport",resourceValue:"true"},{resourceItem:"aiJavaLogicSupport",resourceValue:"false"}]},tenantResource:[{resourceItem:"onlineReplicasLimit",resourceValue:"3",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"onlineReplicasLimit",resourceValue:"3",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"customPackageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"customPackageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2sqlSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2sqlSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNextComponentSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNextComponentSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"productAppSpecification",resourceValue:"1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"productAppSpecification",resourceValue:"1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configDatabaseSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configDatabaseSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"appPublishOnlineSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"appPublishOnlineSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"rdsMode",resourceValue:"0",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"rdsMode",resourceValue:"0",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsLibraryExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsLibraryExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assignDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assignDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"cpuLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"cpuLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configSourceCodeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configSourceCodeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"mavenConfigEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"mavenConfigEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2LogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2LogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"onboardingSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"onboardingSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"storageLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"storageLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"releaseAppCountLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"releaseAppCountLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configFrontSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configFrontSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configFileStorageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configFileStorageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"accountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"accountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"teamDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"teamDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2sqlDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2sqlDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"exportSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"exportSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiD2CSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiD2CSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"customDomainSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"customDomainSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"reportFormsEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"reportFormsEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"memoryLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"memoryLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2LogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2LogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"appCreateLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"appCreateLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsArchetypeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsArchetypeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configImageRepoSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configImageRepoSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsTemplateExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsTemplateExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0}],businessConfig:{upgradeClueCollect:{appId:"",support:!1},eventTracking:{appId:"",support:!1},beginnerGuide:{appId:"",support:!1},corpCertify:{appId:"",support:!1},rateLimiter:{appId:"",support:!1},businessAccess:{appId:"",support:!1},createSaaSTenant:{appId:"",support:!1},customApp:{appId:"",support:!1},research:{appId:"",support:!1}},expireTimeStr:null,layOutConfig:{},isPreviewFe:!1,previewVersion:"",isExport:!1,extendedConfig:null,appid:"7c058eff-e54c-4991-9e71-8b6357eb43b7"},ho=D("Playground");async function Np(n){let e=await l();if(!e)throw new Error("app \u4E3A\u7A7A");let r=e.frontendTypes.find(f=>f.kind==="pc")?.frontends.at(0);if(!r)throw new Error("frontend \u4E3A\u7A7A");let o=(await st(e,r,go,n)).getFileDict().files;ho.debug({files:Object.keys(o)},"\u6587\u4EF6\u7CFB\u7EDF\u5185\u5BB9");let s=Object.entries(o).map(([f,w])=>({path:f,content:w.code}));return await d(s),s;async function l(){let f=await yo();return Je(f),Ae(f)}a(l,"getApp");async function d(f){let b="http://localhost:3001",g=D("\u4EE3\u7801\u5199\u5165");g.info("\u5F00\u59CB\u5199\u5165debug\u7528\u6587\u4EF6\u7CFB\u7EDF");for(let{content:t,path:v}of f)g.trace({path:v},"\u5199\u5165"),await fetch(`${b}/compile`,{method:"POST",body:JSON.stringify({path:v,content:t}),headers:{"content-type":"application/json"}}),g.trace({path:v},"\u5199\u5165\u5B8C\u6210");g.info("\u5168\u90E8\u5199\u5165\u5B8C\u6210")}a(d,"writeCode")}a(Np,"startDemoTranslation");function yo(){return n();async function n(){let e=fo("./playground/fixtures/src.json").toString();return JSON.parse(e)}}a(yo,"fetchApp");export{Np as startDemoTranslation};
5181
+ `}];for(let b of w)this.fileSystemProvider.write(b.path,b.content);return w}catch(o){throw o}}};De=to([ro(),qe(0,Be(L.IRBuilder)),qe(1,Be(L.MicroFrontendManager)),qe(2,Be(L.FileSystemProvider)),et("design:type",Function),et("design:paramtypes",[typeof NASLDomain>"u"||typeof NASLDomain.IRBuilder>"u"?Object:NASLDomain.IRBuilder,typeof JavaScriptDomain>"u"||typeof JavaScriptDomain.FrontendApplicationDomain>"u"||typeof JavaScriptDomain.FrontendApplicationDomain.MicroFrontendManager>"u"?Object:JavaScriptDomain.FrontendApplicationDomain.MicroFrontendManager,typeof GeneratorInfrastructureDomain>"u"||typeof GeneratorInfrastructureDomain.FileSystemProvider>"u"?Object:GeneratorInfrastructureDomain.FileSystemProvider])],De);function nt(){let n=new oo;return n.bind(L.NASLTranspiler).to(De),n.bind(L.IRBuilder).to(fe),n.bind(L.MicroFrontendManager).to(ke),n.bind(L.FileSystemProvider).to(re).inSingletonScope(),n}a(nt,"makeDefaultContainer");async function tt(n,e,r,i="./out",o){let s=D("\u7FFB\u8BD1\u8FC7\u7A0B");s.debug({config:r});async function l(){s.info("\u5F00\u59CB\u7FFB\u8BD1");try{let f=await o.get(L.NASLTranspiler).transpile({app:n,frontend:e,config:r,baseDir:i});return o.isBound(L.CodeGenerationLifecycleHooks)&&o.getAll(L.CodeGenerationLifecycleHooks).forEach(w=>{w.afterAllFilesGenerated()}),f}catch(f){throw s.error(f),f}finally{s.info("\u7FFB\u8BD1\u7ED3\u675F")}}return a(l,"genCode"),await l()??[]}a(tt,"translateNASLToReactApp");function rt(n,e,r){let i=`${e.USER_STATIC_URL}/${e.tenant}/${n.id}/${e.env}`;return r&&i.startsWith("//")?`${r}:${i}`:i}a(rt,"getBasePath");function so(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"?n:"https://"+n}catch{return`https://${n}`}}a(so,"ensureUrlHasProtocol");function it(n){return so(n.replace(/^\/\//,""))}a(it,"normalizeStaticUrl");import{isConnector as ao}from"@lcap/nasl/out/concepts/utils/asserts";function co(n){let e=D("extractFrontendDeps"),r=n.dependencies.filter(s=>!ao(s)&&!!s.frontends?.length);e.info({packageInfo:n.packageInfos});let i=[...r.map(({name:s,version:l})=>({name:s,version:l,kind:"extension"}))],o={name:"@lcap/pc-react-ui",version:"1.0.0",kind:"standard"};return i.push(o),i}a(co,"extractFrontendDeps");async function ot(n,e,r,i){let o=D("downloadDependenciesToProject"),s=co(n);if(s.length===0){o.info("\u65E0\u4F9D\u8D56\u5E93");return}else o.info({feExtensions:s.map(w=>`${w.name}@${w.version}`)},"\u524D\u7AEF\u4F9D\u8D56\u5E93\u5217\u8868");o.info("\u5F00\u59CB\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93");let l=it(i.STATIC_URL),d=i.axios,f=await Promise.all(s.map(async w=>{o.info({ext:w},"\u4E0B\u8F7D\u4F9D\u8D56\u5E93");let h=`packages${w.kind==="extension"?"/extension":""}/${w.name}@${w.version}`,t=`${h}/dist-theme`,v=`${l}/${h}`,x=await p(w);o.debug({sources:x});let c=x.map(u=>{let y=`${l}/${u}`;return o.debug({url:y,source:u}),{url:y,source:u}});r.write(`/src/${h}/dist-theme/index.css`,""),o.info({urls:c.map(u=>u.url)},"\u4E0B\u8F7D\u6587\u4EF6\u5217\u8868");try{await Promise.all([...c.map(async({source:u,url:y})=>{o.debug({url:y},"\u6B63\u5728\u4E0B\u8F7D");try{let g=(await d.get(y,{responseType:"text"})).data,A=`/src/${u}`;r.write(A,g),o.debug({vfsPath:A},"\u5199\u5165\u865A\u62DF\u6587\u4EF6\u7CFB\u7EDF\u8DEF\u5F84")}catch(m){o.error({url:y,error:m},"\u4E0B\u8F7D\u5931\u8D25")}o.debug({url:y},"\u4E0B\u8F7D\u6210\u529F")})])}catch(u){o.error(u)}async function p({name:u,version:y}){if(u==="@lcap/pc-react-ui")return["index.js","index.css"].map(T=>`packages/${u}@${y}/dist-theme/${T}`);let m=`${v}/manifest`,k=(await d.get(m,{responseType:"text"})).data.split(/\n/).filter(T=>T.trim().startsWith(t)).map(T=>T.split(":")[0].trim());return k.length===0?[`${h}/dist-theme/index.js`]:k}return a(p,"listPackageSources"),{packagePath:v,sources:x,projectPath:h,...w}}));return o.info("\u4F9D\u8D56\u5E93\u4E0B\u8F7D\u5B8C\u6210"),o.debug(f),f}a(ot,"downloadDependenciesToProject");var He=class{static{a(this,"VirtualProject")}fileDict;constructor(e){this.fileDict=e}mutateFile(e,r,i={}){this.fileDict[e]={...i,code:r}}getFileDict(){return{files:this.fileDict}}readFile(e){return this.fileDict[e].code}};async function st(n,e,r,i,o){let s=i??nt(),l=D("compileAsProject");l.info("\u5F00\u59CB\u7F16\u8BD1\u9759\u6001\u4EA7\u7269"),l.info("\u8F7D\u5165\u9879\u76EE\u6A21\u677F");let d=s.get(L.FileSystemProvider);Object.entries(Ze.files).forEach(([t,v])=>{d.write(t,v.code)});let f=ot(n,e,d,{STATIC_URL:r.STATIC_URL,axios:o??lo.create()}),w=await tt(n,e,r,"/",s);await h(d),l.debug(Object.keys(d.toJSON()),"\u751F\u6210\u7684\u6587\u4EF6");let b=new He({});return Object.entries(d.toJSON()).forEach(([t,v])=>{b.mutateFile(t,v??"")}),b;async function h(t){let x=(await f)?.map(m=>{let g=m.sources.find(A=>A.endsWith("/index.js"));if(g)return{name:m.name,resolvedTo:`./src/${g}`,scope:m.kind==="extension"?"@extension":void 0}}).filter(F).map(m=>`'${m.scope?`${m.scope}/${m.name}`:m.name}' : path.resolve(__dirname, '${m.resolvedTo}'),`).join(`
5182
+ `)??[],c=po(n,r,e),p=y(n,r),u=t.read("/rspack.config.js");u&&t.write("/rspack.config.js",u.replace("const backendUrl = '';",`const backendUrl = '${p}'`).replace("alias: {}",`alias: {${x}}`).replace("const publicPath = '';",`const publicPath = '${c}';`));function y(m,g){return g.isExport?"localhost:8080":`http://${g.env}.${m.name}.${g.tenant}.${g.lowcodeDomain}`}a(y,"getBackendPath")}a(h,"configRspack")}a(st,"compileAsProject");function po(n,e,r){if(e.isExport)return"/";let i=`${rt(n,e)}${r.basePath??""}`;return i.endsWith("/")?i:`${i}/`}a(po,"getPublicPath");import{isNil as uo,isObject as mo}from"lodash";var at=D("SanityCheck");function Je(n,e=[]){if(mo(n)){if("concept"in n&&n?.concept==="ViewElement"&&[uo(n.name),n.name===""].some(Boolean)){let r=`${JSON.stringify(e)}\u7684name\u4E3A\u7A7A\uFF0C\u8FD9\u53EF\u80FD\u7531\u810F\u6570\u636E\u5BFC\u81F4\uFF0C\u8BF7\u62A5\u544A\u6B64\u9519\u8BEF`;throw at.error(r),at.error({appObject:n}),new Error}Object.entries(n).forEach(([r,i])=>{Je(i,[...e,r])})}}a(Je,"sanityCheck");var go={nuimsDomain:"user.lcap.codewave-test.163yun.com",kubeInsightAppCluster:"drill",officialTenantId:"00000000000000000000000000000000",enableOpenAiCompletionForLogic:!0,pwdSecurity:{pwdCategory:"normal"},tenantAndAppMaxLength:32,platformCreateDatabaseOpen:!1,documentCenter:{isLocalDeployment:!1,deliveryMode:"online",url:"https://community.codewave.163.com/CommunityParent"},lcpRedirectSwitch:!0,kubeInsightAddress:"",gatewayType:"light",STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",traceSwitch:!1,resourceAssignStrategy:"app",creatorIsManager:!1,websqlSwitch:"dev,online",enableCodeWaveMarket:!1,platformEnv:"dev",IDE_STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",isPrivatized:"true",clientToken:"ODDINZU1OWYTZWM5NY0ZZJEYLTK3NGQTNWNJNJQYYMM0OGM1",biConfig:!1,platformExtraAbilityDetail:null,USER_STATIC_URL:"//minio-api.codewave-test.163yun.com/lowcode-static",kubeInsightServiceName:"codewave#lcap-fe",consoleDomain:"",enableOpenAiForLogic:!0,lowcodeDomain:"lcap.codewave-test.163yun.com",name:"lcap",tenantIntegrationSwitch:!1,envNuimsDomain:{dev:"user.lcap.codewave-test.163yun.com",online:"user.lcap.codewave-test.163yun.com"},envLcpDomain:{dev:{lcpDomain:"lcap.codewave-test.163yun.com"},online:{lcpDomain:"lcap.codewave-test.163yun.com"}},kubeClientApplicationKey:"lcp-drill",tenant:"defaulttenant",env:"dev",tenantID:"00000000000000000000000000000000",multiEnvEnable:!0,tenantType:0,tenantLevel:1,tenantLevelDetail:{onlineReplicasLimit:"3",aiJavaLogicCompletionDisplay:"true",releaseDevAppCountLimit:"-1",customPackageSupport:"true",aiNl2sqlSupport:"false",aiNextComponentSupport:"true",productAppSpecification:"1",configDatabaseSupport:"true",aiJavaLogicDisplay:"true",appPublishOnlineSupport:"true",rdsMode:"0",assetsLibraryExportSupport:"true",assignDeveloperSupport:"true",cpuLimit:"4",configSourceCodeSupport:"true",mavenConfigEditSupport:"true",aiCodeAnalyzeSupport:"false",aiNl2LogicSupport:"false",onboardingSupport:"false",storageLimit:"8",releaseAppCountLimit:"4",configFrontSupport:"true",configFileStorageSupport:"true",aiNl2sqlDisplay:"true",teamDeveloperSupport:"true",accountLimit:"-1",aiD2CSupport:"false",exportSourceSupport:"true",customDomainSupport:"true",reportFormsEditSupport:"true",aiNl2LogicDisplay:"true",memoryLimit:"8",aiJavaLogicCompletionSupport:"false",assetsArchetypeSupport:"true",appCreateLimit:"-1",configImageRepoSupport:"true",configSourceSupport:"true",aiJavaLogicSupport:"false",assetsTemplateExportSupport:"true"},tenantExtraAbilityDetail:null,tenantVersion:{tenantName:"defaulttenant",versionType:4,versionId:"2417a61d7e9a4cb7b5ed2d83d29cc5fa",snapshotId:"c8885750ba4f48eea67f85fc965f71f8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",changeStatus:0,changeDesc:null,createdTime:"2024-02-02 12:44:02",updatedTime:"2024-02-02 12:44:02",businessVersionDTO:{versionType:4,versionId:"2417a61d7e9a4cb7b5ed2d83d29cc5fa",snapshotId:"c8885750ba4f48eea67f85fc965f71f8",versionName:"\u79C1\u6709\u5316\u4F01\u4E1A\u7248",description:"\u79C1\u6709\u5316\u4F01\u4E1A\u7248",resourceList:null,createdTime:"2024-02-02 12:26:04",updatedTime:"2024-02-02 12:26:04"},resourceList:[{resourceItem:"onlineReplicasLimit",resourceValue:"3"},{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true"},{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1"},{resourceItem:"customPackageSupport",resourceValue:"true"},{resourceItem:"aiNl2sqlSupport",resourceValue:"false"},{resourceItem:"aiNextComponentSupport",resourceValue:"true"},{resourceItem:"productAppSpecification",resourceValue:"1"},{resourceItem:"configDatabaseSupport",resourceValue:"true"},{resourceItem:"aiJavaLogicDisplay",resourceValue:"true"},{resourceItem:"appPublishOnlineSupport",resourceValue:"true"},{resourceItem:"rdsMode",resourceValue:"0"},{resourceItem:"assetsLibraryExportSupport",resourceValue:"true"},{resourceItem:"assignDeveloperSupport",resourceValue:"true"},{resourceItem:"cpuLimit",resourceValue:"4"},{resourceItem:"configSourceCodeSupport",resourceValue:"true"},{resourceItem:"mavenConfigEditSupport",resourceValue:"true"},{resourceItem:"aiNl2LogicSupport",resourceValue:"false"},{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false"},{resourceItem:"onboardingSupport",resourceValue:"false"},{resourceItem:"storageLimit",resourceValue:"8"},{resourceItem:"releaseAppCountLimit",resourceValue:"4"},{resourceItem:"configFrontSupport",resourceValue:"true"},{resourceItem:"configFileStorageSupport",resourceValue:"true"},{resourceItem:"accountLimit",resourceValue:"-1"},{resourceItem:"teamDeveloperSupport",resourceValue:"true"},{resourceItem:"aiNl2sqlDisplay",resourceValue:"true"},{resourceItem:"exportSourceSupport",resourceValue:"true"},{resourceItem:"aiD2CSupport",resourceValue:"false"},{resourceItem:"customDomainSupport",resourceValue:"true"},{resourceItem:"reportFormsEditSupport",resourceValue:"true"},{resourceItem:"memoryLimit",resourceValue:"8"},{resourceItem:"aiNl2LogicDisplay",resourceValue:"true"},{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false"},{resourceItem:"appCreateLimit",resourceValue:"-1"},{resourceItem:"assetsArchetypeSupport",resourceValue:"true"},{resourceItem:"configSourceSupport",resourceValue:"true"},{resourceItem:"configImageRepoSupport",resourceValue:"true"},{resourceItem:"assetsTemplateExportSupport",resourceValue:"true"},{resourceItem:"aiJavaLogicSupport",resourceValue:"false"}]},tenantResource:[{resourceItem:"onlineReplicasLimit",resourceValue:"3",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"onlineReplicasLimit",resourceValue:"3",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicCompletionDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"releaseDevAppCountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"customPackageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"customPackageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2sqlSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2sqlSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNextComponentSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNextComponentSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"productAppSpecification",resourceValue:"1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"productAppSpecification",resourceValue:"1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configDatabaseSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configDatabaseSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"appPublishOnlineSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"appPublishOnlineSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"rdsMode",resourceValue:"0",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"rdsMode",resourceValue:"0",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsLibraryExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsLibraryExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assignDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assignDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"cpuLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"cpuLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configSourceCodeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configSourceCodeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"mavenConfigEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"mavenConfigEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2LogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2LogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiCodeAnalyzeSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"onboardingSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"onboardingSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"storageLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"storageLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"releaseAppCountLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"releaseAppCountLimit",resourceValue:"4",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configFrontSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configFrontSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configFileStorageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configFileStorageSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"accountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"accountLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"teamDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"teamDeveloperSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2sqlDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2sqlDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"exportSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"exportSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiD2CSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiD2CSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"customDomainSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"customDomainSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"reportFormsEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"reportFormsEditSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"memoryLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"memoryLimit",resourceValue:"8",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiNl2LogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiNl2LogicDisplay",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicCompletionSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"appCreateLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"appCreateLimit",resourceValue:"-1",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsArchetypeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsArchetypeSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configSourceSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"configImageRepoSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"configImageRepoSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"assetsTemplateExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"assetsTemplateExportSupport",resourceValue:"true",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0},{resourceItem:"aiJavaLogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:{resourceItem:"aiJavaLogicSupport",resourceValue:"false",validDateType:1,startTime:"2024-02-02 12:44:02",endTime:"2024-02-02 12:44:02",versionResourceDetail:null,valueAddedResourceDetail:null,valid:!0},valueAddedResourceDetail:null,valid:!0}],businessConfig:{upgradeClueCollect:{appId:"",support:!1},eventTracking:{appId:"",support:!1},beginnerGuide:{appId:"",support:!1},corpCertify:{appId:"",support:!1},rateLimiter:{appId:"",support:!1},businessAccess:{appId:"",support:!1},createSaaSTenant:{appId:"",support:!1},customApp:{appId:"",support:!1},research:{appId:"",support:!1}},expireTimeStr:null,layOutConfig:{},isPreviewFe:!1,previewVersion:"",isExport:!1,extendedConfig:null,appid:"7c058eff-e54c-4991-9e71-8b6357eb43b7"},ho=D("Playground");async function Np(n){let e=await l();if(!e)throw new Error("app \u4E3A\u7A7A");let r=e.frontendTypes.find(f=>f.kind==="pc")?.frontends.at(0);if(!r)throw new Error("frontend \u4E3A\u7A7A");let o=(await st(e,r,go,n)).getFileDict().files;ho.debug({files:Object.keys(o)},"\u6587\u4EF6\u7CFB\u7EDF\u5185\u5BB9");let s=Object.entries(o).map(([f,w])=>({path:f,content:w.code}));return await d(s),s;async function l(){let f=await yo();return Je(f),Ae(f)}a(l,"getApp");async function d(f){let b="http://localhost:3001",h=D("\u4EE3\u7801\u5199\u5165");h.info("\u5F00\u59CB\u5199\u5165debug\u7528\u6587\u4EF6\u7CFB\u7EDF");for(let{content:t,path:v}of f)h.trace({path:v},"\u5199\u5165"),await fetch(`${b}/compile`,{method:"POST",body:JSON.stringify({path:v,content:t}),headers:{"content-type":"application/json"}}),h.trace({path:v},"\u5199\u5165\u5B8C\u6210");h.info("\u5168\u90E8\u5199\u5165\u5B8C\u6210")}a(d,"writeCode")}a(Np,"startDemoTranslation");function yo(){return n();async function n(){let e=fo("./playground/fixtures/src.json").toString();return JSON.parse(e)}}a(yo,"fetchApp");export{Np as startDemoTranslation};