@ibiz-template/runtime 0.7.19 → 0.7.21

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.
Files changed (92) hide show
  1. package/dist/index.esm.js +10870 -10255
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +30 -1
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/app-hub.js +44 -0
  6. package/out/application.d.ts +24 -0
  7. package/out/application.d.ts.map +1 -1
  8. package/out/application.js +24 -0
  9. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  10. package/out/controller/common/control/md-control.controller.js +2 -1
  11. package/out/controller/control/calendar/calendar.controller.d.ts +7 -0
  12. package/out/controller/control/calendar/calendar.controller.d.ts.map +1 -1
  13. package/out/controller/control/calendar/calendar.controller.js +25 -0
  14. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  15. package/out/controller/control/chart/generator/base-series-generator.js +6 -8
  16. package/out/controller/control/data-view/data-view.controller.d.ts +7 -0
  17. package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
  18. package/out/controller/control/data-view/data-view.controller.js +31 -0
  19. package/out/controller/control/form/edit-form/edit-form.controller.d.ts +7 -0
  20. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  21. package/out/controller/control/form/edit-form/edit-form.controller.js +11 -0
  22. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts +16 -1
  23. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts.map +1 -1
  24. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.js +21 -0
  25. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts +22 -0
  26. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts.map +1 -1
  27. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.js +27 -0
  28. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts +9 -0
  29. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts.map +1 -1
  30. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.js +9 -0
  31. package/out/controller/control/gantt/gantt.controller.js +8 -8
  32. package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
  33. package/out/controller/control/gantt/gantt.service.js +14 -4
  34. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  35. package/out/controller/control/grid/grid/grid.controller.js +3 -4
  36. package/out/controller/control/list/list.controller.d.ts +7 -0
  37. package/out/controller/control/list/list.controller.d.ts.map +1 -1
  38. package/out/controller/control/list/list.controller.js +31 -0
  39. package/out/controller/control/tree/tree.service.d.ts +17 -0
  40. package/out/controller/control/tree/tree.service.d.ts.map +1 -1
  41. package/out/controller/control/tree/tree.service.js +38 -7
  42. package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +4 -4
  43. package/out/de-logic/de-logic-param/de-logic-param.js +2 -2
  44. package/out/engine/md-view.engine.d.ts.map +1 -1
  45. package/out/engine/md-view.engine.js +4 -0
  46. package/out/engine/view-base.engine.d.ts +15 -0
  47. package/out/engine/view-base.engine.d.ts.map +1 -1
  48. package/out/engine/view-base.engine.js +35 -2
  49. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +31 -1
  50. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  51. package/out/interface/common/i-app-service/i-app-service.d.ts +24 -0
  52. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  53. package/out/interface/controller/state/control/i-data-view-control.state.d.ts +7 -0
  54. package/out/interface/controller/state/control/i-data-view-control.state.d.ts.map +1 -1
  55. package/out/interface/controller/state/control/i-grid.state.d.ts +0 -7
  56. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  57. package/out/interface/controller/state/control/i-list.state.d.ts +7 -0
  58. package/out/interface/controller/state/control/i-list.state.d.ts.map +1 -1
  59. package/out/interface/controller/state/control/i-md-control.state.d.ts +7 -0
  60. package/out/interface/controller/state/control/i-md-control.state.d.ts.map +1 -1
  61. package/out/interface/provider/model-loader.provider.d.ts +31 -1
  62. package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
  63. package/out/locale/en/index.d.ts +8 -6
  64. package/out/locale/en/index.d.ts.map +1 -1
  65. package/out/locale/en/index.js +8 -6
  66. package/out/locale/zh-CN/index.d.ts +8 -6
  67. package/out/locale/zh-CN/index.d.ts.map +1 -1
  68. package/out/locale/zh-CN/index.js +8 -6
  69. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +1 -0
  70. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
  71. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +1 -0
  72. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  73. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +1 -0
  74. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
  75. package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +1 -0
  76. package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
  77. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +1 -0
  78. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  79. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +1 -0
  80. package/out/service/vo/tree-node-data/tree-node-data.d.ts +2 -0
  81. package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
  82. package/out/service/vo/tree-node-data/tree-node-data.js +2 -0
  83. package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +1 -0
  84. package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
  85. package/out/ui-logic/ui-logic-param/ui-logic-param.js +2 -2
  86. package/out/utils/theme-util/custom-theme-util.d.ts +110 -0
  87. package/out/utils/theme-util/custom-theme-util.d.ts.map +1 -0
  88. package/out/utils/theme-util/custom-theme-util.js +199 -0
  89. package/out/utils/theme-util/theme-util.d.ts +79 -0
  90. package/out/utils/theme-util/theme-util.d.ts.map +1 -1
  91. package/out/utils/theme-util/theme-util.js +103 -0
  92. package/package.json +2 -2
@@ -1 +1 @@
1
- System.register(["@ibiz-template/core","lodash-es","ramda","qx-util","qs","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var i,a,n,s,o,r,c,d,l,h,u,p,m,g,f,y,w,E,v,I,b,D,C,A,P,T,N,S,x,L,M,R,O,_,F,z,V,k,U,B,W,G,j,K,H,X,q,Y,Q,$,J,Z,tt,et,it,at,nt,st,ot,rt,ct,dt,lt,ht,ut,pt,mt,gt,ft,yt,wt,Et,vt,It,bt,Dt,Ct,At,Pt;return{setters:[function(t){i=t.RuntimeModelError,a=t.ModelError,n=t.HttpError,s=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.CoreConst,l=t.HttpResponse,h=t.IBizContext,u=t.DataTypes,p=t.clone,m=t.isBase64Image,g=t.updateKeyDefine,f=t.Net,y=t.getToken,w=t.NOOP,E=t.selectFile,v=t.Namespace,I=t.IBizParams,b=t.isElementSame,D=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,N=t.BitMask,S=t.mergeInLeft,x=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.toNumberOrNil},function(t){O=t.isEmpty,_=t.isNil,F=t.isString,z=t.isArray,V=t.isObject,k=t.merge,U=t.debounce,B=t.camelCase,W=t.eq,G=t.gt,j=t.gte,K=t.findIndex,H=t.lt,X=t.lte,q=t.upperFirst,Y=t.snakeCase,Q=t.kebabCase,$=t.isFunction,J=t.isNumber},function(t){Z=t.isNil,tt=t.mergeRight,et=t.isEmpty,it=t.clone,at=t.equals,nt=t.where,st=t.mergeLeft,ot=t.isNotNil,rt=t.mergeDeepRight},function(t){ct=t.notNilEmpty,dt=t.isNilOrEmpty,lt=t.AsyncSeriesHook,ht=t.createUUID,ut=t.QXEvent,pt=t.getCookie,mt=t.isArray,gt=t.setCookie,ft=t.clearCookie,yt=t.ascSort,wt=t.descSort,Et=t.clearAll,vt=t.isNumber,It=t.isString,bt=t.isObject},function(t){Dt=t.default},function(t){Ct=t.default},function(t){At=t.default},function(t){Pt=t.default}],execute:function(){t({SearchCondEx2filterNode:Ud,asyncImportData:wr,asyncImportData2:Pr,calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:i}=t;let a;if(e||i){switch(a={display:"flex"},e){case"TOP":Object.assign(a,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(a,{"align-items":"center"});break;case"BOTTOM":Object.assign(a,{"align-items":"flex-end"})}switch(i){case"LEFT":Object.assign(a,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(a,{"justify-content":"center"});break;case"RIGHT":Object.assign(a,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(a,{"justify-content":"space-between"})}}return a},calcDeCodeNameById:Ae,calcDynaClass:be,calcDynaSysParams:async function(t,e,i={}){const a=i.appId||e.srfappid,n=i.viewParams||{},s={},o=await ibiz.hub.getAppDataEntity(t,a);if(n.srfkey)s.srfkey=n.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(s.srfkey=t)}if(n.srfparentkey&&n.srfparentdename)s.srfparentkey=n.srfparentkey,s.srfparentdename=n.srfparentdename;else{const t=ks(e,o);if(t&&t.keys.length>1){const i=t.keys[t.keys.length-2];s.srfparentkey=n.srfparentkey||e[i],s.srfparentdename=n.srfparentdename||i}}return s},calcFilterModelBySchema:Rd,calcGridLayoutPos:function(t){const{layout:e,colXS:i,colXSOffset:a,colSM:n,colSMOffset:s,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,i)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:i&&-1!==i?i:void 0});return{xs:l(i,a),sm:l(n,s),md:l(o,r),lg:l(c,d)}},calcImportSchemaData:Tr,calcItemVisible:async function(t,e,i,a,n,s){const{enableMode:o,dataAccessAction:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===o&&r){const t=ibiz.hub.getApp(e.srfappid);return!!await t.authority.calcByDataAccessAction(r,e,s,a)}if("DELOGIC"===o&&c&&a&&n){const t=Te(c,await ibiz.hub.getAppDataEntity(a,n));if(t){return!!(await fn(t,e,s,i)).data}}if("SCRIPT"===o&&d){return!!ei.execScriptFn({data:s,context:e,params:i},d,{isAsync:!1,singleRowReturn:!0})}},calcItemVisibleByCounter:function(t,e){const{enableMode:i,counterId:a}=t;if(!e||!a)return;if("COUNT_GTE_ZERO"===i)return e.getCounter(a)>=0;if("COUNT_GT_ZERO"===i)return e.getCounter(a)>0},calcLayoutHeightWidth:Ie,calcMainStateOPPrivsStrs:Ce,calcNavParams:ge,calcResPath:Us,calcSearchCondExs:Wd,calcSearchConds:kd,compare:Ye,compareNumber:Qe,contains:$e,convertNavData:he,convertNavDataByArray:pe,convertObjectToNavParams:le,createImportSchema:async function(t){const e=Tr(t);return await ibiz.net.request("extension/import_schemas",{method:"post",data:e})},deleteImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"delete"})},downloadImportTemplate:Cr,execDELogic:mn,execDELogicAction:fn,execDELogicById:gn,execFieldLogics:wn,execUILogic:Sc,exportData:Ir,fetchImportSchemas:async function(t){var e;const i={n_import_tag_eq:t.appDataEntity.defaultAppDEDataImportId,n_system_tag_eq:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,n_data_entity_tag_eq:t.appDataEntity.codeName};return await ibiz.net.request("extension/import_schemas/fetch_cur_user",{method:"post",data:i})},fieldValueToBoolean:Ws,filterFieldLogics:Ne,filterNode2SearchCond:Vd,filterNode2SearchCondEx:Bd,filterValueRules:Ii,findAppDEMethod:ve,findChildFormDetails:_e,findDELogic:Te,findEditItem:Oe,findFieldById:Se,findModelChild:fe,formatMultiData:me,generateEditorRules:pr,generateRules:ur,getAcItemProvider:async function(t){let e;const{itemSysPFPluginId:i,appId:a}=t;if(i){const t=await Tn(i,a);if(t&&(n=t,e=ibiz.register.get("".concat(Ns,"_").concat(n))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.acItem",{pluginKey:t}))}var n;return e},getAllPanelField:Ge,getAppCounterProvider:Ln,getAppMenuItemProvider:Ds,getAppViewRef:function(t,e){var i,a;let n=t.appViewRefs||[];(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)?void 0:a.length)&&(n=n.concat(t.viewLayoutPanel.appViewRefs));return n.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(i=t.actiontype||"DEFAULT",ibiz.register.get("".concat(ss,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Re,getControl:ye,getControlPanel:Ee,getControlProvider:_n,getControlsByView:ze,getCtrlTeleportParams:function(t){var e,i,a,n;const s=null==(i=null==(e=t.controlParam)?void 0:e.ctrlParams)?void 0:i.TELEPORTTAG,o="true"===(null==(n=null==(a=t.controlParam)?void 0:a.ctrlParams)?void 0:n.TELEPORTFLAG);return{teleportTag:s,teleportFlag:o}},getDEMethodProvider:ys,getDERedirectToView:Xe,getDataImportModels:br,getDeACMode:async function(t,e,i){var a;const n=await ibiz.hub.getAppDataEntity(e,i);return null==(a=n.appDEACModes)?void 0:a.find((e=>e.id===t))},getDefaultDataImport:function(t){var e;if(t.defaultAppDEDataImportId)return null==(e=t.appDEDataImports)?void 0:e.find((e=>e.id===t.defaultAppDEDataImportId))},getDefaultValue:gr,getEditorProvider:Vn,getEntitySchema:Nr,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat(As,"_").concat(i)));var i;return e},getFormDetailProvider:Bn,getGridColumnProvider:jn,getImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"get"})},getInternalMessageProvider:function(t){const e=(i=t.content_type||"DEFAULT",ibiz.register.get("".concat(Cs,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:ks,getOriginData:hr,getOriginFilterNodes:Fd,getPFPlugin:function(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new i(a,ibiz.i18n.t("runtime.model.utils.noFoundApplication"));const{model:n}=a;if(!n.appPFPluginRefs)throw new i(n,ibiz.i18n.t("runtime.model.utils.unconfiguredPlugins"));const s=n.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!s)throw new Error(ibiz.i18n.t("runtime.model.utils.noFound",{id:t}));return s},getPanelItemProvider:Xn,getPlatformProvider:ps,getPlatformType:ds,getPortletProvider:Qn,getRootNode:Le,getToolbarItemProvider:Ts,getTreeGridExColumnProvider:vs,getTreeNode:Me,getUIActionById:xe,getUIActionItemsByActionLevel:function(t,e){const i=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const a=t;a.actionLevel===e&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),i},getUIActionProvider:ts,getUILogicNodeProvider:is,getViewEngines:ke,getViewLogics:Ve,getViewProvider:async function(t){let e;const{viewType:i,viewStyle:a,sysPFPluginId:n,appId:s}=t;if(n){const t=await Tn(n,s);if(t&&(e=ns(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=ns("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=ns(i));e||(e=ns("DEFAULT"));return e},getWFContext:ri,getWFSubmitViewId:function(t,e){var i;const{type:a,sequenceflowview:n,sequenceflowmobview:s}=e,o=(null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)||t.appViewRefs,r=a?"WFUTILACTION@".concat(a.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?s:n),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:Si,hasDeCodeName:Pe,hasSubRoute:dr,importData:Er,importData2:vr,install:function(){const{ibiz:t}=window;t.util=new El,t.hub=new gl,t.register=new kt,t.config=new Vt,t.auth=new ro,t.engine=new fl,t.uiDomainManager=new Pi,t.markOpenData=new vo,jo(),zc(),wo(),Ms(),ibiz.scheduler=new Nl,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Ll(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Ll(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Ll(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Ml(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new xl(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new Ol(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new _l(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new bl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Dl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Dl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Rl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Fl(t,e))),function(){const t=new rs;hs("Browser",(()=>t))}(),t.platform=ps()},installCommand:jo,isDataContainer:Ue,isFormDataContainer:Fe,isHiddenFilter:Dd,isSimpleItems:bd,isValueChange:lr,matchMainState:De,openDataImport:Dr,openRedirectView:Ke,parseSubFieldInfo:Cd,parseUserParams:we,parseViewProtocol:je,presetAppCounterProvider:Ms,presetDEMethodProvider:wo,presetUIActionProvider:zc,registerAcItemProvider:function(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)},registerAppCounterProvider:Sn,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Is,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(ss,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(Rn,"_").concat(t),e)},registerDEMethodProvider:gs,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Fn,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat(As,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(kn,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Wn,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Cs,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Kn,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:hs,registerPortletProvider:function(t,e){ibiz.register.register("".concat(qn,"_").concat(t),e)},registerToolbarItemProvider:function(t,e){ibiz.register.register("".concat(Ps,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ws,"_").concat(t),e)},registerUIActionProvider:Jn,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(es,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(as,"_").concat(t),e)},selectAndImport:Ar,strContain:Je,testCond:qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await He(t,e,i);await ibiz.commands.execute(Bo.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=Tr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:zd,verifyDeRules:ii,verifyFormGroupLogic:ni,verifyPanelGroupLogic:si});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Tt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nt={exports:{}};!function(t,e){t.exports=function(t,e,i){var a=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var i;1===e.length&&e[0].length>0&&(e=e[0]),i=(e=e.filter((function(t){return t})))[0];for(var a=1;a<e.length;a+=1)e[a].isValid()&&!e[a][t](i)||(i=e[a]);return i};i.max=function(){var t=[].slice.call(arguments,0);return a("isAfter",t)},i.min=function(){var t=[].slice.call(arguments,0);return a("isBefore",t)}}}(Nt);var St=Tt(Nt.exports),xt={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(xt);var Lt=Tt(xt.exports),Mt={exports:{}};!function(t,e){var i,a;t.exports=(i="month",a="quarter",function(t,e){var n=e.prototype;n.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var s=n.add;n.add=function(t,e){return t=Number(t),this.$utils().p(e)===a?this.add(3*t,i):s.bind(this)(t,e)};var o=n.startOf;n.startOf=function(t,e){var n=this.$utils(),s=!!n.u(e)||e;if(n.p(t)===a){var r=this.quarter()-1;return s?this.month(3*r).startOf(i).startOf("day"):this.month(3*r+2).endOf(i).endOf("day")}return o.bind(this)(t,e)}})}(Mt);var Rt=Tt(Mt.exports),Ot={exports:{}};!function(t,e){var i,a;t.exports=(i="week",a="year",function(t,e,n){var s=e.prototype;s.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var s=n(this).startOf(a).add(1,a).date(e),o=n(this).endOf(i);if(s.isBefore(o))return 1}var r=n(this).startOf(a).date(e).startOf(i).subtract(1,"millisecond"),c=this.diff(r,i,!0);return c<0?n(this).startOf("week").week():Math.ceil(c)},s.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Ot);var _t=Tt(Ot.exports),Ft={exports:{}};!function(t,e){var i;t.exports=(i="day",function(t,e,a){var n=function(t){return t.add(4-t.isoWeekday(),i)},s=e.prototype;s.isoWeekYear=function(){return n(this).year()},s.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),i);var e,s,o,r=n(this),c=(e=this.isoWeekYear(),o=4-(s=(this.$u?a.utc:a)().year(e).startOf("year")).isoWeekday(),s.isoWeekday()>4&&(o+=7),s.add(o,i));return r.diff(c,"week")+1},s.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=s.startOf;s.startOf=function(t,e){var i=this.$utils(),a=!!i.u(e)||e;return"isoweek"===i.p(t)?a?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(Ft);var zt=Tt(Ft.exports),Vt=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0},this.pickerEditor={overflowMode:"auto"}}},kt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const i=this.providers.get(t);if(i)return i(...e)}}),Ut=t("DefaultErrorHandler",class{handle(t){return t instanceof i||t instanceof a?ibiz.message.error(t.message,10,!0):t instanceof n?401===t.status?ibiz.message.error(ibiz.i18n.t("runtime.utils.errorHandler.noPermissionless")):404===t.status?ibiz.mc.error.send(t):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof s?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Bt=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error(ibiz.i18n.t("runtime.utils.errorHandler.noProcessor"),t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Wt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,i){return i.fn?e?i.fn(t):i.inverse(t):e?i.hash.yes=!0:i.hash.no=!1}};Wt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Gt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},jt=class extends Gt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const i=t.filter((t=>!!t)).length===t.length;return Wt.handleJudgmentExecute(this,i,e)}},Kt=class extends Gt{constructor(t){super(t,"camelCase")}onExecute(t){return t?B(t):""}},Ht=class extends Gt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Xt=class extends Gt{constructor(t){super(t,"eq")}onExecute(t,e,i){const a=W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},qt=class extends Gt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=G(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Yt=class extends Gt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=j(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Qt=class extends Gt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let n=!1;return n=z(t)?!W(K(t,(t=>W(t[e],i))),-1):t.hasOwnProperty(e)&&(n=W(t[e],i)),Wt.handleJudgmentExecute(this,n,a)}},$t=class extends Gt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Jt=class extends Gt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Zt=class extends Gt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},te=class extends Gt{constructor(t){super(t,"lt")}onExecute(t,e,i){const a=H(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ee=class extends Gt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=X(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ie=class extends Gt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ae=class extends Gt{constructor(t){super(t,"not")}onExecute(t,e){const i=et(t)||Z(t);return Wt.handleJudgmentExecute(this,i,e)}},ne=class extends Gt{constructor(t){super(t,"or")}onExecute(...t){var e;const i=t[t.length-1];t.pop();const a=t.find((t=>!!t));if(i.fn){const t=(null==(e=i.data)?void 0:e.root)||{};return a?i.fn(t):i.inverse(t)}return a||""}},se=class extends Gt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?q(t):""}},oe=class extends Gt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?Y(t):""}},re=class extends Gt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?Q(t):""}},ce=class extends Gt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var de=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var i;return this.hsb=t.default||t,this.p=null,i=this.hsb,new jt(i),new Kt(i),new Ht(i),new Xt(i),new qt(i),new Yt(i),new $t(i),new Jt(i),new Zt(i),new te(i),new ee(i),new ie(i),new ae(i),new ne(i),new se(i),new oe(i),new re(i),new ce(i),new Qt(i),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error(ibiz.i18n.t("runtime.utils.handlebars.noInitHandlebars"));return this.hsb.compile(t)(e)}});function le(t){const e=[],i=/^%(.+)%$/;for(const a in t){let n=!0,s=t[a];ct(t[a])&&i.test(t[a])&&(n=!1,s=t[a].substring(1,t[a].length-1)),e.push({key:a.toLowerCase(),rawValue:n,value:s})}return e}function he(t,...e){if(!t||O(t))return{};return pe(Array.isArray(t)?t:le(t),...e)}function ue(t,e){const i=e.split(".");let a;const n=t.find((t=>{if(dt(t))return!1;if(i.length>1){a=t;for(let t=0;t<i.length;t++){const e=i[t];if(!a||!a[e]&&!Object.prototype.hasOwnProperty.call(a,e)){a=void 0;break}a=a[e]}return void 0!==a}return t[e]||Object.prototype.hasOwnProperty.call(t,e)}));return{find:!!n,value:i.length>1?a:null==n?void 0:n[e]}}function pe(t,...e){const i=/\$\{[^}]*\}/g,a={};for(const n of t)if(n.rawValue)a[n.key.toLowerCase()]=n.value||null;else{const t=n.value.match(i);if(null!==t){let i=n.value;t.forEach((t=>{const{find:a,value:n}=ue(e,t.slice(2,-1).toLowerCase());a&&(i=i.replace(t,"".concat(_(n)?"":n)))})),a[n.key.toLowerCase()]=i}else{const{find:t,value:i}=ue(e,n.value.toLowerCase());t&&(a[n.key.toLowerCase()]=i)}}return a}function me(t,e){const i={};if(!t)return i;const a=Array.isArray(t)?t:le(t),n=e[0];return a.forEach((t=>{const{rawValue:a,value:s}=t;!a&&s&&Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=e.map((t=>t[s])).join(";"))})),i}function ge(t,e){const{deName:i,navFilter:a,pickupDEFName:n,navContexts:s,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(i&&(h[i]=p),a&&(u[a]=p),n&&(u["n_".concat(n.toLowerCase(),"_eq")]=p));const m=he(s,d,c,r),g=he(o,d,c,r);return Object.assign(h,m),Object.assign(u,g),{resultContext:h,resultParams:u}}function fe(t,e){if(t&&e){const i=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(i)return i}return null}function ye(t,e){var i,a;let n=t.controls||[];return(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.controls)?void 0:a.length)&&(n=n.concat(t.viewLayoutPanel.controls)),n.find((t=>t.name===e||t.codeName===e||t.id===e))}function we(t){const e={},i={},a={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const s=t[n];if(-1!==n.indexOf(".")){const t=n.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(i,{[t[1]]:s});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:s});break;default:Object.assign(a,{key:s})}}}return{navigateContexts:e,navigateParams:i,other:a}}function Ee(t){let e;if(t.controlRenders){const i=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==i?void 0:i.layoutPanel}return e}function ve(t,e){const i=t.appDEMethods;if(i&&e){const t=fe(i,e);if(t)return t;const a=i.find((t=>{switch(t.methodType){case"DEACTION":{const{actionTag:i}=t;return(null==i?void 0:i.toLowerCase())===e.toLowerCase()}case"FETCH":{const{dataSetTag:i}=t;return"fetch".concat(null==i?void 0:i.toLowerCase())===e.toLowerCase()}default:return!1}}));if(a)return a}return null}function Ie(t){const{width:e,height:i,widthMode:a,heightMode:n}=t,s={width:"",height:""};return"FULL"===a?s.width="100%":e&&e>0&&(s.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===a?"%":"px")),"FULL"===n?s.height="100%":i&&i>0&&(s.height=i>0&&i<=1?"".concat(100*i,"%"):"".concat(i,"PERCENTAGE"===n?"%":"px")),s}function be(t,e){const i=[],a=ei.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return F(a)?i.push(a):z(a)?i.push(...a):V(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function De(t,e){const{mainStateAppDEFieldIds:i,demainStates:a}=t;if(i&&a){const t=[];return i.forEach((i=>{t.push(e[i])})),a.find((e=>{const{stateValue:i,state2Value:a,state3Value:n}=e;let s=!0;const o=[i,a,n];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){s=!1;break}return s}))}}function Ce(t,e){const i=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:a,opprivAllowMode:n}=t,s=(null==a?void 0:a.map((t=>t.name)))||[];let o=[];if(n)o=s;else{o=[...i.deopprivs,...e.deopprivs].filter((t=>!s.includes(t.name))).map((t=>t.name))}return o}function Ae(t){return t.split(".").pop()}function Pe(t,e){const i=Ae(e);return ct(t[i])}function Te(t,e){var i;return null==(i=e.appDELogics)?void 0:i.find((e=>e.id===t))}function Ne(t,e){var i,a;const n=[];return null==(i=t.appDEFields)||i.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?n.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?n.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&n.push(t.defaultValueAppDEFLogicId)})),(null==(a=t.appDELogics)?void 0:a.filter((t=>n.includes(t.id))))||[]}function Se(t,e){var i;return null==(i=t.appDEFields)?void 0:i.find((t=>t.id===e))}async function xe(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Le(t){return t.detreeNodes.find((t=>t.rootNode))}function Me(t,e){return t.detreeNodes.find((t=>t.id===e))}function Re(t,e){const i=e.parentId||Le(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===i&&(a=t.searchMode,n=e.hasQuery,3===a||(n?1===a:2===a));var a,n}))}function Oe(t,e){var i;return null==(i=t.degridEditItems)?void 0:i.find((t=>t.codeName===e))}function _e(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Fe(t){return"MDCTRL"===t.detailType}function ze(t){const{viewLayoutPanel:e}=t,i=t.controls||[];return e&&i.push(...e.controls||[]),i}function Ve(t){const{viewLayoutPanel:e}=t,i=t.appViewLogics||[];return e&&i.push(...e.appViewLogics||[]),i}function ke(t){const{viewLayoutPanel:e}=t,i=t.appViewEngines||[];return e&&i.push(...e.appViewEngines||[]),i.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn(ibiz.i18n.t("runtime.model.view.engineClassifications",{engineType:t.engineType})),!1)))}function Ue(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Be=["panelItems","panelTabPages","rootPanelItems"];function We(t){let e=[];for(const i of Be)if(t[i]&&t[i].length&&t[i].length>0){e=t[i];break}const i=[];return e.length&&(i.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Ue(t)||i.push(...We(t))}))),i}function Ge(t){return We(t)}function je(t){const e=new URL(t),i={},a={};let n="";if(e.searchParams.size>0){const n=e.searchParams.get("srfnavctx");if(n){try{Object.assign(i,JSON.parse(n))}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.parseSrfnavctxParameter",{urlStr:t}),e)}e.searchParams.delete("srfnavctx")}e.searchParams.forEach(((t,e)=>{a[e]=t}))}const s=e.pathname.replace("//","").split("/"),[o,r]=s;return n=r||o,{context:i,params:a,viewId:n}}async function Ke(t,e,i={},a={}){return async function(t,e,i={},a={}){let n;try{n=await Xe(t,e,i,a)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===n.type){const t=n.url;return new Promise((e=>{const i=window.open(t,"_blank");i&&(i.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Bo.TAG,n.viewId,n.context,n.params,n.opts)||{ok:!0,data:[]}}(t,e,i,a)}async function He(t,e,i={}){const a=e.lastIndexOf("?"),n=decodeURIComponent(e.substring(a+1,e.length)),s=Dt.parse(n,{delimiter:";"}),r=s.srfdename||"";if(!r)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.missingEntityName"));const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.noFoundSpecifiedEntity",{deName:r}));s[c.toLowerCase()]=s[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete s.srfdename,"undo"!==s.srfwf){const t=s.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),i=t.substring(t.lastIndexOf("v"));s.wf=e,s.wfVersion=i}return s.srfprocessinstanceid&&(t.srfprocessinstanceid=s.srfprocessinstanceid,delete s.srfprocessinstanceid),{context:t,params:s,opts:i,viewId:l.id}}async function Xe(t,e,a={},n={}){var s;const r=he(t.appViewNavContexts||[],a,e);e=Object.assign(e.clone(),r);const c=he(t.appViewNavParams||[],a,e);Object.assign(a,c);const d=t.appDataEntityId,l=Ae(d);let h=(null==(s=n.data)?void 0:s[0])||{};e[l]=h[l]||e[l]||a[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,a);if(t.ok){h=t.data;let i=h.linkurl;if(i){if(e.srfprocessinstanceid&&(i+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==i.indexOf("appredirectview?")&&(i=i.slice(i.indexOf("appredirectview?"))),i.startsWith("http://")||i.startsWith("https://"))return{type:"url",url:i};if(i.startsWith("appredirectview?")){return{type:"view",...await He(e,i,n)}}throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.unsupportedLinkUrl",{linkUrl:i}))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(d,t.appId),f=await async function(t,e,i,a){let n="";const s=e.typeAppDEFieldId;if(s){const{codeName:i}=Se(t,s),n=a[i.toLowerCase()];if(ct(n))return n.startsWith("view://")?n:"".concat(n.toUpperCase());ibiz.log.warn(ibiz.i18n.t("runtime.utils.openRedirectView.redirectionView",{name:e.name,typeFieldId:s}),a)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=i.srfwf;if(ct(r))return ct(i.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(i.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=Se(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(dt(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Se(t,t.formTypeAppDEFieldId);c=a[e.toLowerCase()]}n=ct(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return n}(g,t,a,h);let y="";if(!f.startsWith("view://")){const s=f.split(":"),o=2===s.length?f:s.slice(0,2).join(":"),r="".concat(g.name.toUpperCase(),":").concat(f),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===f||e===o}));if(d){if(y=d.refAppViewId,d.openMode&&(n.openMode=d.openMode),y)return{type:"view",viewId:y,context:e,params:a,opts:{...n,data:[h]}};throw new i(d,ibiz.i18n.t("runtime.utils.openRedirectView.noConfiguredActualReference"))}throw ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.redirectingViewReferences"),null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:i})=>({viewId:t,tag:e,title:i})))),new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.redirectionIdentifier",{rdTag:f,deRdTag:r,wfRdTag:o}))}{const t=je(f);Object.assign(e,t.context),Object.assign(a,t.params),y=t.viewId}if(y)return{type:"view",viewId:y,context:e,params:a,opts:{...n,data:[h]}};throw new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.noMatchActualReferenceView",{rdTag:f}))}function qe(t,e,i){if(Object.is(e,"IN"))return $e(t,i);if(Object.is(e,"NOTIN"))return!$e(t,i);switch(e){case"EQ":return"".concat(t)==="".concat(i);case"NOTEQ":return"".concat(t)!=="".concat(i);case"LT":return Ye(t,i)<0;case"LTANDEQ":return Ye(t,i)<=0;case"GT":return Ye(t,i)>0;case"GTANDEQ":return Ye(t,i)>=0;case"ISNULL":return dt(t);case"ISNOTNULL":return ct(t);case"TESTNULL":return Z(t);case"IN":return $e(t,i);case"NOTIN":return!$e(t,i);case"LIKE":return Je(t,i);case"LEFTLIKE":return Je(t,i,"start");case"RIGHTLIKE":return Je(t,i,"end");default:throw new o(ibiz.i18n.t("runtime.utils.verify.valueOperations",{op:e}))}}function Ye(t,e){const i=Number(t),a=Number(e);if(!Number.isNaN(i)&&!Number.isNaN(a))return Qe(i,a);const n=new Date(t).getTime(),s=new Date(e).getTime();if(!Number.isNaN(n)&&!Number.isNaN(s))return Qe(n,s);throw new o(ibiz.i18n.t("runtime.utils.verify.noCompared",{value:t,value2:e}))}function Qe(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function $e(t,e){if(!e||"string"!=typeof e)throw new o(ibiz.i18n.t("runtime.utils.verify.conditionalValues"));if(t){return e.split(",").includes("".concat(t))}return!1}function Je(t,e,i){if(!t||!e)return!1;const a="".concat(t).toUpperCase(),n="".concat(e).toUpperCase(),s=a.indexOf(n);switch(i){case"start":return 0===s;case"end":return s+n.length===a.length;default:return-1!==s}}var Ze={singleRowReturn:!1,isAsync:!0},ti=t("ScriptFunction",class{constructor(t,e,i=Ze){this.argKeys=[],this.options=i;const a=this.formatCode(e,i);this.calcArgKeys(t,i);const n=new Function(...this.argKeys,a);this.scriptFn=function(...t){try{return n.apply({},t)}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.utils.script.errorReportingScript"),a),t}}}formatCode(t,e){let i=t;return e.singleRowReturn&&(i="return (".concat(i,")")),e.isAsync&&(i="return (async function() { ".concat(i,"} )();")),i}calcArgKeys(t,e){const i=e.presetParams?Object.keys(e.presetParams):[];i.push(...t);i.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util","ctrl"),this.argKeys=Array.from(new Set(i))}convertArgs(t){const{presetParams:e}=this.options,i=e?tt(e,t):t;i.document=document,i.selector=t=>document.getElementsByClassName(t);const a=[];return this.argKeys.forEach((t=>{void 0===i[t]&&this.fillDefaultParams(t,i),a.push(i[t])})),a}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const i=e.view;if(i)switch(t){case"parent":e.parent=i.parentView;break;case"topView":e.topView=i.getTopView();break;case"parentView":e.parentView=i.parentView;break;case"topViewSession":e.topViewSession=i.getTopView().session;break;case"viewSession":e.viewSession=i.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),ei=t("ScriptFactory",class{static createScriptFn(t,e,i){return new ti(t,e,i)}static execScriptFn(t,e,i){return this.createScriptFn(Object.keys(t),e,i).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function ii(t,e,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(t){return"GROUP"===t.condType}(i)){const n=i.conds;n&&n.length>0&&(a.isPast=function(t,e,i="AND",a=!1){if(!((null==t?void 0:t.length)>0))return!1;let n="AND"===i;for(let a=0,s=t.length;a<s;a++){const s=e(t[a],a);if("AND"===i){if(!s){n=!1;break}}else if("OR"===i&&s){n=!0;break}}return a?!n:n}(n,(i=>{const{isPast:n,infoMessage:s}=ii(t,e,i);return a.infoMessage=s,n}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{t=(null==i?void 0:i.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(i))a.isPast=!function(t,e,i,a,n,s,r){Object.is(n,"CURTIME")&&(i="".concat(new Date));if(Object.is(n,"ENTITYFIELD")){i=s[i=i?i.toLowerCase():""]?s[i]:i}(Z(a)||et(a))&&(a=ibiz.i18n.t("runtime.utils.verify.contentConform"));const c=qe(t,e,i);if(!c&&r)throw new o(a);return!c}(e[t],i.condOp,i.paramValue,i.ruleInfo,i.paramType,e,i.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(i))a.isPast=!function(t,e,i,a,n,s,r){dt(s)&&(s=ibiz.i18n.t("runtime.utils.verify.rangeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return s=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(ai(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(i){if(c<e){if(r)throw new o(s);return!0}}else if(c<=e){if(r)throw new o(s);return!0}if(null!=a)if(n){if(c>a){if(r)throw new o(s);return!0}}else if(c>=a){if(r)throw new o(s);return!0}return s="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"REGEX"===t.condType}(i))a.isPast=!ai(e[t],i.regExCode,i.ruleInfo,i.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(i))a.isPast=!function(t,e,i,a,n,s,r){dt(s)&&(s=ibiz.i18n.t("runtime.utils.verify.scopeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return s=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}const c=t.length;if(null!==e)if(i){if(c<e){if(r)throw new o(s);return!0}}else if(c<=e){if(r)throw new o(s);return!0}if(null!==a)if(n){if(c>a){if(r)throw new o(s);return!0}}else if(c>=a){if(r)throw new o(s);return!0}return s="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:n,regExCode:s,scriptCode:r,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===n)a.isPast=!ai(e[t],s,a.infoMessage,i.keyCond);else if("SCRIPT"===n){const{isPast:n,infoMessage:s}=function(t,e,i,a,n){dt(a)&&(a=ibiz.i18n.t("runtime.utils.verify.scriptRules"));const s=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=ei.execScriptFn({value:t,data:s},i,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(a="",!c&&n)throw new o(a);return{isPast:c,infoMessage:r||a}}(e[t],e,r,a.infoMessage,i.keyCond);a.isPast=n,a.infoMessage=s||a.infoMessage}}}catch(t){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function ai(t,e,i,a){dt(i)&&(i=ibiz.i18n.t("runtime.utils.verify.regularRules"));if(dt(t)){if(a)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return i=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(!new RegExp(e).test(t)){if(a)throw new o(i);return!0}return i="",!1}function ni(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.defdlogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroups"));let n=!0;if("AND"===e.groupOP){n=void 0===a.find((e=>!ni(t,e)))}else if("OR"===e.groupOP){n=void 0!==e.defdlogics.find((e=>ni(t,e)))}return e.notMode?!n:n}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}function si(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.panelItemLogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroupsProperly"));let n=!0;if("AND"===e.groupOP){n=void 0===a.find((e=>!si(t,e)))}else if("OR"===e.groupOP){n=void 0!==e.panelItemLogics.find((e=>si(t,e)))}return e.notMode?!n:n}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}var oi=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const i=it(this.cache.get(e));t.viewLayoutPanel=i,t.appCounterRefs&&(i.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(i.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(i.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(i.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(i.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:i}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(i)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:i,blankMode:a,mainMenuAlign:n}=t;let s="";a?s="BLANK_MODE":n&&(s=n.toUpperCase());let o="";return o=""!==s?"".concat(e,"_").concat(i,"_").concat(s):"".concat(e,"_").concat(i),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function ri(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var ci=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(ci||{})),di=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(di||{})),li=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(li||{})),hi=t("StudioViewEvents",class{});hi.onViewMounted="onMounted",hi.onViewDestroyed="onDestroyed";var ui=t("StudioPanelEvents",class{});ui.onClick="onClick",ui.onChange="onChange",ui.onEnter="onEnter",ui.onLeave="onLeave";var pi=t("StudioControlEvents",class{});pi.onBeforeLoad="onBeforeLoad",pi.onLoadSuccess="onLoadSuccess",pi.onLoadError="onLoadError",pi.onBeforeLoadDraft="onBeforeLoadDraft",pi.onLoadDraftSuccess="onLoadDraftSuccess",pi.onLoadDraftError="onLoadDraftError",pi.onBeforeSave="onBeforeSave",pi.onSaveSuccess="onSaveSuccess",pi.onSaveError="onSaveError",pi.onBeforeRemove="onBeforeRemove",pi.onRemoveSuccess="onRemoveSuccess",pi.onRemoveError="onRemoveError",pi.CLICK="onClick";var mi=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.FIRST_RECORD="FirstRecord",t.LAST_RECORD="LastRecord",t.PREV_RECORD="PrevRecord",t.NEXT_RECORD="NextRecord",t.LOAD_MORE="LoadMore",t.SHOTR_CUT="ShortCut",t))(mi||{})),gi=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(gi||{})),fi=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(fi||{})),yi=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(yi||{})),wi=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(wi||{})),Ei=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(Ei||{})),vi=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new lt,beforeDismiss:new lt},this._dismiss=t=>{ibiz.log.error(ibiz.i18n.t("runtime.utils.modal.externalClosureCapability"),t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),!1===e.allowClose?(ibiz.log.debug(ibiz.i18n.t("runtime.utils.modal.shouldDismissResult")),!1):(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function Ii(t,e){return t.filter((t=>{const{checkMode:i}=t,a=t.deformItemName||t.degridEditItemName;return 2!==i&&a===e}))}var bi=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),Di=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0]}async loadTheme(t){const e=it(t.themeParams||{}),i=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:i}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let i=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];i+="".concat(t,": ").concat(a).concat(a.endsWith(";")?"":";")}i+="}";const a=document.createElement("style");a.id=t.themeTag,a.type="text/css",a.innerHTML=i,document.head.appendChild(a)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}}),Ci=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn(ibiz.i18n.t("runtime.utils.uiDomain.transactionOpen")):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error(ibiz.i18n.t("runtime.utils.uiDomain.currentTransaction"));this.state.isOpen=!1}},Ai=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new Ci,this.dataModification=!1,this.id=t||ht()}dataChange(){this.dataModification=!0}dataChangeCompleted(){this.dataModification=!1}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const i=t.majorAppDataEntityId;this.rs2Map.has(i)||this.rs2Map.set(i,[]),this.rs2Map.get(i).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),Pi=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new Ai(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error(ibiz.i18n.t("runtime.utils.uiDomainManager.invalidInterfaceDomain",{id:t}))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),Ti=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),Ni=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new ut}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}getView(t){return this.stackMap.get(t)}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function Si(t,e=!0){const i=await Promise.allSettled(t),a=[],n=[];if(i.forEach((t=>{"fulfilled"===t.status?a.push(t.value):n.push(t.reason)})),n.length>0){const t=1===n.length?n[0]:n;if(e)throw t;ibiz.util.error.handle(t)}return a}var xi={position:"fixed",zIndex:"10000"};function Li(t,e=document.body,i=!0){const a=Ri(t);if(null==a)throw new Error(ibiz.i18n.t("runtime.utils.anime.noClone"));const n=a.cloneNode(!0);if(i)for(;n.firstChild;)n.removeChild(n.firstChild);return function(t,{width:e,height:i,boundingLeft:a,boundingTop:n}){t.style.left="".concat(a,"px"),t.style.top="".concat(n,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px"),Object.assign(t.style,xi)}(n,Mi(a)),e.appendChild(n),n}function Mi(t){const e=t.offsetWidth,i=t.offsetHeight,a=window.getComputedStyle(t),n=parseFloat(a.padding),{left:s,top:o}=t.getBoundingClientRect();return{width:e,height:i,padding:n,boundingLeft:s,boundingTop:o}}function Ri(t){return"string"==typeof t?document.querySelector(t):t}var Oi={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},_i={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Fi=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],zi={CSS:{},springs:{}};function Vi(t,e,i){return Math.min(Math.max(t,e),i)}function ki(t,e){return t.indexOf(e)>-1}function Ui(t,e){return t.apply(null,e)}var Bi={arr:function(t){return Array.isArray(t)},obj:function(t){return ki(Object.prototype.toString.call(t),"Object")},pth:function(t){return Bi.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Bi.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Bi.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Bi.hex(t)||Bi.rgb(t)||Bi.hsl(t)},key:function(t){return!Oi.hasOwnProperty(t)&&!_i.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function Wi(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Gi(t,e){var i=Wi(t),a=Vi(Bi.und(i[0])?1:i[0],.1,100),n=Vi(Bi.und(i[1])?100:i[1],.1,100),s=Vi(Bi.und(i[2])?10:i[2],.1,100),o=Vi(Bi.und(i[3])?0:i[3],.1,100),r=Math.sqrt(n/a),c=s/(2*Math.sqrt(n*a)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var i=e?e*t/1e3:t;return i=c<1?Math.exp(-i*c*r)*(l*Math.cos(d*i)+h*Math.sin(d*i)):(l+h*i)*Math.exp(-i*r),0===t||1===t?t:1-i}return e?u:function(){var e=zi.springs[t];if(e)return e;for(var i=1/6,a=0,n=0;;)if(1===u(a+=i)){if(++n>=16)break}else n=0;var s=a*i*1e3;return zi.springs[t]=s,s}}function ji(t){return void 0===t&&(t=10),function(e){return Math.ceil(Vi(e,1e-6,1)*t)*(1/t)}}var Ki,Hi,Xi=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function i(t,e){return 3*e-6*t}function a(t){return 3*t}function n(t,n,s){return((e(n,s)*t+i(n,s))*t+a(n))*t}function s(t,n,s){return 3*e(n,s)*t*t+2*i(n,s)*t+a(n)}return function(e,i,a,o){if(0<=e&&e<=1&&0<=a&&a<=1){var r=new Float32Array(11);if(e!==i||a!==o)for(var c=0;c<11;++c)r[c]=n(c*t,e,a);return function(t){return e===i&&a===o||0===t||1===t?t:n(d(t),i,o)}}function d(i){for(var o=0,c=1;10!==c&&r[c]<=i;++c)o+=t;--c;var d=o+(i-r[c])/(r[c+1]-r[c])*t,l=s(d,e,a);return l>=.001?function(t,e,i,a){for(var o=0;o<4;++o){var r=s(e,i,a);if(0===r)return e;e-=(n(e,i,a)-t)/r}return e}(i,d,e,a):0===l?d:function(t,e,i,a,s){var o,r,c=0;do{(o=n(r=e+(i-e)/2,a,s)-t)>0?i=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(i,o,o+t,e,a)}}}(),qi=(Ki={linear:function(){return function(t){return t}}},Hi={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=Vi(t,1,10),a=Vi(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/a)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Hi[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Hi).forEach((function(t){var e=Hi[t];Ki["easeIn"+t]=e,Ki["easeOut"+t]=function(t,i){return function(a){return 1-e(t,i)(1-a)}},Ki["easeInOut"+t]=function(t,i){return function(a){return a<.5?e(t,i)(2*a)/2:1-e(t,i)(-2*a+2)/2}},Ki["easeOutIn"+t]=function(t,i){return function(a){return a<.5?(1-e(t,i)(1-2*a))/2:(e(t,i)(2*a-1)+1)/2}}})),Ki);function Yi(t,e){if(Bi.fnc(t))return t;var i=t.split("(")[0],a=qi[i],n=Wi(t);switch(i){case"spring":return Gi(t,e);case"cubicBezier":return Ui(Xi,n);case"steps":return Ui(ji,n);default:return Ui(a,n)}}function Qi(t){try{return document.querySelectorAll(t)}catch(t){return}}function $i(t,e){for(var i=t.length,a=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<i;s++)if(s in t){var o=t[s];e.call(a,o,s,t)&&n.push(o)}return n}function Ji(t){return t.reduce((function(t,e){return t.concat(Bi.arr(e)?Ji(e):e)}),[])}function Zi(t){return Bi.arr(t)?t:(Bi.str(t)&&(t=Qi(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function ta(t,e){return t.some((function(t){return t===e}))}function ea(t){var e={};for(var i in t)e[i]=t[i];return e}function ia(t,e){var i=ea(t);for(var a in t)i[a]=e.hasOwnProperty(a)?e[a]:t[a];return i}function aa(t,e){var i=ea(t);for(var a in e)i[a]=Bi.und(t[a])?e[a]:t[a];return i}function na(t){return Bi.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Bi.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,a){return e+e+i+i+a+a})),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(i[1],16)+","+parseInt(i[2],16)+","+parseInt(i[3],16)+",1)"}(t):Bi.hsl(t)?function(t){var e,i,a,n=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),s=parseInt(n[1],10)/360,o=parseInt(n[2],10)/100,r=parseInt(n[3],10)/100,c=n[4]||1;function d(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==o)e=i=a=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,s+1/3),i=d(h,l,s),a=d(h,l,s-1/3)}return"rgba("+255*e+","+255*i+","+255*a+","+c+")"}(t):void 0;var e,i}function sa(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function oa(t,e){return Bi.fnc(t)?t(e.target,e.id,e.total):t}function ra(t,e){return t.getAttribute(e)}function ca(t,e,i){if(ta([i,"deg","rad","turn"],sa(e)))return e;var a=zi.CSS[e+i];if(!Bi.und(a))return a;var n=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(n),n.style.position="absolute",n.style.width=100+i;var o=100/n.offsetWidth;s.removeChild(n);var r=o*parseFloat(e);return zi.CSS[e+i]=r,r}function da(t,e,i){if(e in t.style){var a=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?ca(t,n,i):n}}function la(t,e){return Bi.dom(t)&&!Bi.inp(t)&&(!Bi.nil(ra(t,e))||Bi.svg(t)&&t[e])?"attribute":Bi.dom(t)&&ta(Fi,e)?"transform":Bi.dom(t)&&"transform"!==e&&da(t,e)?"css":null!=t[e]?"object":void 0}function ha(t){if(Bi.dom(t)){for(var e,i=t.style.transform||"",a=/(\w+)\(([^)]*)\)/g,n=new Map;e=a.exec(i);)n.set(e[1],e[2]);return n}}function ua(t,e,i,a){var n=ki(e,"scale")?1:0+function(t){return ki(t,"translate")||"perspective"===t?"px":ki(t,"rotate")||ki(t,"skew")?"deg":void 0}(e),s=ha(t).get(e)||n;return i&&(i.transforms.list.set(e,s),i.transforms.last=e),a?ca(t,s,a):s}function pa(t,e,i,a){switch(la(t,e)){case"transform":return ua(t,e,a,i);case"css":return da(t,e,i);case"attribute":return ra(t,e);default:return t[e]||0}}function ma(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var a=sa(t)||0,n=parseFloat(e),s=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return n+s+a;case"-":return n-s+a;case"*":return n*s+a}}function ga(t,e){if(Bi.col(t))return na(t);if(/\s/g.test(t))return t;var i=sa(t),a=i?t.substr(0,t.length-i.length):t;return e?a+e:a}function fa(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ya(t){for(var e,i=t.points,a=0,n=0;n<i.numberOfItems;n++){var s=i.getItem(n);n>0&&(a+=fa(e,s)),e=s}return a}function wa(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*ra(t,"r")}(t);case"rect":return function(t){return 2*ra(t,"width")+2*ra(t,"height")}(t);case"line":return function(t){return fa({x:ra(t,"x1"),y:ra(t,"y1")},{x:ra(t,"x2"),y:ra(t,"y2")})}(t);case"polyline":return ya(t);case"polygon":return function(t){var e=t.points;return ya(t)+fa(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function Ea(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Bi.svg(e)&&Bi.svg(e.parentNode);)e=e.parentNode;return e}(t),n=a.getBoundingClientRect(),s=ra(a,"viewBox"),o=n.width,r=n.height,c=i.viewBox||(s?s.split(" "):[0,0,o,r]);return{el:a,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function va(t,e,i){function a(i){void 0===i&&(i=0);var a=e+i>=1?e+i:0;return t.el.getPointAtLength(a)}var n=Ea(t.el,t.svg),s=a(),o=a(-1),r=a(1),c=i?1:n.w/n.vW,d=i?1:n.h/n.vH;switch(t.property){case"x":return(s.x-n.x)*c;case"y":return(s.y-n.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function Ia(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=ga(Bi.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Bi.str(t)||e?a.split(i):[]}}function ba(t){return $i(t?Ji(Bi.arr(t)?t.map(Zi):Zi(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function Da(t){var e=ba(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:ha(t)}}}))}function Ca(t,e){var i=ea(e);if(/^spring/.test(i.easing)&&(i.duration=Gi(i.easing)),Bi.arr(t)){var a=t.length;2===a&&!Bi.obj(t[0])?t={value:t}:Bi.fnc(e.duration)||(i.duration=e.duration/a)}var n=Bi.arr(t)?t:[t];return n.map((function(t,i){var a=Bi.obj(t)&&!Bi.pth(t)?t:{value:t};return Bi.und(a.delay)&&(a.delay=i?0:e.delay),Bi.und(a.endDelay)&&(a.endDelay=i===n.length-1?e.endDelay:0),a})).map((function(t){return aa(t,i)}))}function Aa(t,e){var i=[],a=e.keyframes;for(var n in a&&(e=aa(function(t){for(var e=$i(Ji(t.map((function(t){return Object.keys(t)}))),(function(t){return Bi.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},a=function(a){var n=e[a];i[n]=t.map((function(t){var e={};for(var i in t)Bi.key(i)?i==n&&(e.value=t[i]):e[i]=t[i];return e}))},n=0;n<e.length;n++)a(n);return i}(a),e)),e)Bi.key(n)&&i.push({name:n,tweens:Ca(e[n],t)});return i}function Pa(t,e){var i;return t.tweens.map((function(a){var n=function(t,e){var i={};for(var a in t){var n=oa(t[a],e);Bi.arr(n)&&1===(n=n.map((function(t){return oa(t,e)}))).length&&(n=n[0]),i[a]=n}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(a,e),s=n.value,o=Bi.arr(s)?s[1]:s,r=sa(o),c=pa(e.target,t.name,r,e),d=i?i.to.original:c,l=Bi.arr(s)?s[0]:d,h=sa(l)||sa(c),u=r||h;return Bi.und(o)&&(o=d),n.from=Ia(l,u),n.to=Ia(ma(o,l),u),n.start=i?i.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Yi(n.easing,n.duration),n.isPath=Bi.pth(s),n.isPathTargetInsideSVG=n.isPath&&Bi.svg(e.target),n.isColor=Bi.col(n.from.original),n.isColor&&(n.round=1),i=n,n}))}var Ta={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,a,n){if(a.list.set(e,i),e===a.last||n){var s="";a.list.forEach((function(t,e){s+=e+"("+t+") "})),t.style.transform=s}}};function Na(t,e){Da(t).forEach((function(t){for(var i in e){var a=oa(e[i],t),n=t.target,s=sa(a),o=pa(n,i,s,t),r=ma(ga(a,s||sa(o)),o),c=la(n,i);Ta[c](n,i,r,t.transforms,!0)}}))}function Sa(t,e){return $i(Ji(t.map((function(t){return e.map((function(e){return function(t,e){var i=la(t.target,e.name);if(i){var a=Pa(e,t),n=a[a.length-1];return{type:i,property:e.name,animatable:t,tweens:a,duration:n.end,delay:a[0].delay,endDelay:n.endDelay}}}(t,e)}))}))),(function(t){return!Bi.und(t)}))}function xa(t,e){var i=t.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},n={};return n.duration=i?Math.max.apply(Math,t.map((function(t){return a(t)+t.duration}))):e.duration,n.delay=i?Math.min.apply(Math,t.map((function(t){return a(t)+t.delay}))):e.delay,n.endDelay=i?n.duration-Math.max.apply(Math,t.map((function(t){return a(t)+t.duration-t.endDelay}))):e.endDelay,n}var La=0;var Ma=[],Ra=function(){var t;function e(i){for(var a=Ma.length,n=0;n<a;){var s=Ma[n];s.paused?(Ma.splice(n,1),a--):(s.tick(i),n++)}t=n>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){_a.suspendWhenDocumentHidden&&(Oa()?t=cancelAnimationFrame(t):(Ma.forEach((function(t){return t._onDocumentVisibility()})),Ra()))})),function(){t||Oa()&&_a.suspendWhenDocumentHidden||!(Ma.length>0)||(t=requestAnimationFrame(e))}}();function Oa(){return!!document&&document.hidden}function _a(t){void 0===t&&(t={});var e,i=0,a=0,n=0,s=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=ia(Oi,t),i=ia(_i,t),a=Aa(i,t),n=Da(t.targets),s=Sa(n,a),o=xa(s,i),r=La;return La++,aa(e,{id:r,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){i=0,a=l(c.currentTime)*(1/_a.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,i=c.animations,a=i.length;e<a;){var n=i[e],s=n.animatable,o=n.tweens,r=o.length-1,d=o[r];r&&(d=$i(o,(function(e){return t<e.end}))[0]||d);for(var l=Vi(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],g=d.to.numbers.length,f=void 0,y=0;y<g;y++){var w=void 0,E=d.to.numbers[y],v=d.from.numbers[y]||0;w=d.isPath?va(d.value,h*E,d.isPathTargetInsideSVG):v+h*(E-v),p&&(d.isColor&&y>2||(w=Math.round(w*p)/p)),m.push(w)}var I=u.length;if(I){f=u[0];for(var b=0;b<I;b++){u[b];var D=u[b+1],C=m[b];isNaN(C)||(f+=D?C+D:C+" ")}}else f=m[0];Ta[n.type](s.target,n.property,f,s.transforms),n.currentValue=f,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function g(t){var h=c.duration,g=c.delay,f=h-c.endDelay,y=l(t);c.progress=Vi(y/h*100,0,100),c.reversePlayback=y<c.currentTime,e&&function(t){if(c.reversePlayback)for(var i=s;i--;)u(t,e[i]);else for(var a=0;a<s;a++)u(t,e[a])}(y),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),y<=g&&0!==c.currentTime&&p(0),(y>=f&&c.currentTime!==h||!h)&&p(h),y>g&&y<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(y)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Vi(y,0,h),c.began&&m("update"),t>=h&&(a=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(i=n,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var i=s=e.length;i--;)c.children[i].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return Na(t,e),c},c.tick=function(t){n=t,i||(i=n),g((n+(a-i))*_a.speed)},c.seek=function(t){g(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,Ma.push(c),h(),Ra())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){za(ba(t),c)},c.reset(),c.autoplay&&c.play(),c}function Fa(t,e){for(var i=e.length;i--;)ta(t,e[i].animatable.target)&&e.splice(i,1)}function za(t,e){var i=e.animations,a=e.children;Fa(t,i);for(var n=a.length;n--;){var s=a[n],o=s.animations;Fa(t,o),o.length||s.children.length||a.splice(n,1)}i.length||a.length||e.pause()}_a.version="3.2.1",_a.speed=1,_a.suspendWhenDocumentHidden=!0,_a.running=Ma,_a.remove=function(t){for(var e=ba(t),i=Ma.length;i--;){za(e,Ma[i])}},_a.get=pa,_a.set=Na,_a.convertPx=ca,_a.path=function(t,e){var i=Bi.str(t)?Qi(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:Ea(i),totalLength:wa(i)*(a/100)}}},_a.setDashoffset=function(t){var e=wa(t);return t.setAttribute("stroke-dasharray",e),e},_a.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",a=e.easing?Yi(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Bi.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=sa(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,y){if(r&&(o=0),c&&(o=(y-1)/2),d&&(o=y-1),!g.length){for(var w=0;w<y;w++){if(n){var E=c?(n[0]-1)/2:o%n[0],v=c?(n[1]-1)/2:Math.floor(o/n[0]),I=E-w%n[0],b=v-Math.floor(w/n[0]),D=Math.sqrt(I*I+b*b);"x"===s&&(D=-I),"y"===s&&(D=-b),g.push(D)}else g.push(Math.abs(o-w));f=Math.max.apply(Math,g)}a&&(g=g.map((function(t){return a(t/f)*f}))),"reverse"===i&&(g=g.map((function(t){return s?t<0?-1*t:-t:Math.abs(f-t)})))}return m+(l?(u-h)/f:h)*(Math.round(100*g[e])/100)+p}},_a.timeline=function(t){void 0===t&&(t={});var e=_a(t);return e.duration=0,e.add=function(i,a){var n=Ma.indexOf(e),s=e.children;function o(t){t.passThrough=!0}n>-1&&Ma.splice(n,1);for(var r=0;r<s.length;r++)o(s[r]);var c=aa(i,ia(_i,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Bi.und(a)?d:ma(a,d),o(e),e.seek(c.timelineOffset);var l=_a(c);o(l),s.push(l);var h=xa(s,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},_a.easing=Yi,_a.penner=qi,_a.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Va=_a,ka={duration:1e3,loop:!1,easing:"easeInOutSine"};function Ua(t,e){const i={};if(e.complete&&t.complete){const a=e.complete,n=t.complete;i.complete=t=>{a(t),n(t)}}return{...t,...e,...i}}function Ba(t,e,i={}){const{left:a,top:n}=t.getBoundingClientRect(),{left:s,top:o}=e.getBoundingClientRect(),r=s-a,c=o-n;return new Promise((e=>{const a=Ua({targets:t,translateX:r,translateY:c,...ka,complete:()=>{e(!0)}},i);Va(a)}))}var Wa=t("AnimeUtil",class{async movePoint(t,e,i={}){const a=Ri(e);if(!a)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistEndpointElement")),!1;const n=Li(t,document.body);if(!n)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:s,width:o,height:r}=Mi(n),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[s,"6px"],duration:700};Object.assign(c,i);const d=await Ba(n,a,c);var l;return(l=n)&&l.remove(),d}moveToTarget(t,e,i={}){return Ba(t,e,i)}resize(t,e={}){return function(t,e={}){return new Promise((i=>{const a=Ua({scale:[1,.8,1],targets:t,...ka,complete:()=>{i(!0)}},e);Va(a)}))}(t,e)}async moveAndResize(t,e,i={}){const a=await this.movePoint(t,e,i);return a&&await this.resize(e,{duration:500}),a}}),Ga=t("FileUtil",class{calcOSSCatUrl(t,e,i){var a;let n="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const s=ibiz.hub.getApp(e.srfappid),o=i||s.model.defaultOSSCat||(null==(a=s.model.userParam)?void 0:a.DefaultOSSCat);return n=n.replace("/{cat}",o?"/".concat(o):""),n}calcFileUpDownUrl(t,e,i={},a={}){const{uploadParams:n,exportParams:s,osscat:o}=a;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return n&&(d=he(n,i,e,t)),s&&(l=he(s,i,e,t)),r+=Dt.stringify(d,{addQueryPrefix:!0}),c+=Dt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(!i.data)throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"));{let t=ibiz.util.file.getFileName(i);e&&(t=e),c(i.data,t)}}async fileUpload(t,e,i){const a=new FormData;a.append("file",e);const n=await ibiz.net.axios({url:t,method:"post",headers:i,data:a});if(200!==n.status)throw new o(ibiz.i18n.t("runtime.utils.fileUtil.fileUploadFailed"));return n.data}getFileName(t){let e="";const i=t.headers["content-disposition"];if(!i)return e;const a=Dt.parse(i,{delimiter:";"});return a&&a.filename&&(e=a.filename),e.startsWith('"')&&e.endsWith('"')&&(e=e.substring(1,e.length-1)),e}async chooseFileAndUpload(t,e,i,a={}){const{accept:n,multiple:s}=a,o=ibiz.util.file.calcFileUpDownUrl(t,e,i),r=await ibiz.util.file.chooseFile(n,s),c=[],l={Authorization:"Bearer ".concat(pt(d.TOKEN))};for(let t=0;t<r.length;t++){const e=await ibiz.util.file.fileUpload(o.uploadUrl,r[t],l);c.push(e)}return Promise.all(c)}chooseFile(t="",e=!1){return new Promise((i=>{const a=document.createElement("input");a.type="file",a.accept=t,a.multiple=e,a.webkitdirectory=!1,a.addEventListener("change",(t=>{i(t.target.files)})),document.body.appendChild(a),a.click(),document.body.removeChild(a)}))}}),ja=t("ShortCutUtil",class{constructor(){this.$ShortCut={items:[],mode:"vertical"},this.evt=new ut,this.initShortCut()}get data(){return this.$ShortCut.items}get mode(){return this.$ShortCut.mode}initShortCut(){const t=window.localStorage.getItem("IBizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){this.evt.emit("change",[...this.$ShortCut.items]),window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}setShortCutMode(t){this.$ShortCut.mode=t,window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}onChange(t){this.evt.on("change",t)}offChange(t){this.evt.off("change",t)}async calcShortCutKey({context:t,appViewId:e}){const i=await ibiz.hub.config.view.get(e);let a="".concat(t.srfappid,"-").concat(t.srfuserid,"-").concat(e);if(i.appDataEntityId){const e=Ae(i.appDataEntityId);a+="-".concat(e,"-").concat(t[e])}return a}addShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.items.splice(e,1,t):this.$ShortCut.items.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.items.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut.items;if(e<0||e>=i||t<0||t>=i)throw new Error(ibiz.i18n.t("runtime.utils.shortCut.invalidIndexNewIndex",{newIndex:t,oldIndex:e,length:i}));const a=this.$ShortCut.items.splice(e,1)[0];this.$ShortCut.items.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.items.findIndex((e=>e.key===t))>=0}}),Ka=class{constructor(t,e,i,a){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:z(i)?i:[i],params:a}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},Ha=class{},Xa=class extends Ha{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,n){const s=t.params[this.dstParam];let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.missingConditionValue"));const t=null!=n[this.value]?n[this.value]:e[this.value];r=t,o=qe(s[this.dstField],this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.sourceDataMissingConditionValue"));const e=t.params[this.srcParam];r=e[this.value],o=qe(s[this.dstField],this.op,e[this.value]);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.noSupportedTime"));default:r=this.value,o=qe(s[this.dstField],this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityLogicalConnection",{name:this.model.name,type:this.type,dstField:this.dstField}),s[this.dstField],ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},qa=class t extends Ha{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new Xa(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let n="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.connectionConditional"));for(let i=0;i<this.conds.length;i++){const s=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===s){n=!1;break}if("OR"===this.op&&!0===s){n=!0;break}}const s=this.notMode?!n:n;return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityConnectionConditional",{name:this.model.name,id:this.model.id}),s),s}},Ya=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new qa(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Qa=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new Ya(t)))}},$a=class extends Qa{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:n,retDELogicParamId:s}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[n],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[s]=c.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.entityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDELogicParamId:s}),t.params[s])}},Ja=class extends Qa{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Za=class extends Qa{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:i,rawValue:n}=this.model;if(i){switch(i){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(n);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedReturnType",{returnType:i}))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endNode",{id:this.model.id,returnType:i}),t.result)}}};function tn(t,e){const{srcDELogicParamId:i,srcFieldName:n,srcValue:s,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=n;switch(r){case"SRCDLPARAM":c=t.params[i],t.isEntityParam(i)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(s);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=it(ibiz.env);break;case"EXPRESSION":if(!o)throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.expressionEmpty"));c=ei.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:r}))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:d}),c),t}return c}var en=class extends Qa{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{let i,n;switch(e.dstDELogicParamId&&"DEBUG"===ibiz.env.logLevel&&(n=it(t.params[e.dstDELogicParamId])),e.paramAction){case"SETPARAMVALUE":i=this.setParamValue(e,t);break;case"RESETPARAM":i=this.resetParam(e,t);break;case"COPYPARAM":i=this.copyParam(e,t);break;case"BINDPARAM":i=this.bindParam(e,t);break;case"RENEWPARAM":i=this.renewParam(e,t);break;case"APPENDPARAM":i=this.appendParam(e,t);break;case"SORTPARAM":i=this.sortParam(e,t);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:e.paramAction}))}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.preparationParameter",{id:this.model.id,paramAction:e.paramAction,dstDELogicParamId:e.dstDELogicParamId}),n,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[e.dstDELogicParamId]),i})))}copyParam(t,e){const{dstDELogicParamId:i}=t,a=tn(e,t);e.params[i]=it(a)}bindParam(t,e){const i=tn(e,t);e.params[t.dstDELogicParamId]=i}setParamValue(t,e){const{dstFieldName:i,dstDELogicParamId:a}=t;let n=i;e.isEntityParam(a)&&(n=null==n?void 0:n.toLowerCase());const s=tn(e,t);n?e.params[a][n]=s:e.params[a]=s}resetParam(t,e){const{dstDELogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDELogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDELogicParamId:i,dstIndex:a,srcIndex:n,srcSize:s}=t,o=tn(e,t),r=a||0,c=n||0,d=s||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:i,dstFieldName:a,dstSortDir:n}=t,s=a.toLowerCase();e.params[i].sort(((t,e)=>"ASC"===n?t[s]-e[s]:e[s]-t[s]))}},an=class extends Qa{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDELogicParamId:a,retDELogicParamId:n}=this.model,s=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(i,e,t.context,s);r.ok&&(t.params[n]=r.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.dataSet",{id:this.model.id,dstAppDataEntityId:i,dstAppDEDataSetId:e,retDELogicParamId:n}),t.params[n])}},nn=class extends Qa{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const n=tn(t,this.model);t.params[e]=n,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),n)}},sn=class extends Qa{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.resetParameter",{id:this.model.id,dstDELogicParamId:e}))}},on=class extends Qa{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.rebuildParameter",{id:this.model.id,dstDELogicParamId:e}))}},rn=class extends Qa{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const n=tn(t,this.model);t.params[e]=it(n),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.copyParameter",{id:this.model.id,dstDELogicParamId:e}),n)}},cn=class extends Qa{async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:n}=this.model;if(!e||!n)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const s=n.toLowerCase(),o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[s]-e[s]:e[s]-t[s])),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.sortedArrayParameters",{id:this.model.id,dstFieldName:n,dstSortDir:a,dstDELogicParamId:e}),o)}},dn=class extends Qa{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:n,srcIndex:s,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const r=tn(t,this.model),c=n||0,d=s||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.additionalParameter",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},ln=class extends Qa{async exec(t){const{errorCode:e,errorInfo:i}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.throwsException",{id:this.model.id,errorCode:e,errorInfo:i})),new n({response:{status:e,statusText:i}})}},hn=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model;if(i.default)i.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(i.appGlobalParam)t.params[e]=it(ibiz.env);else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]={};else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.appContextParam)t.params[e]=t.parameters.context;else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.cloneParam)t.params[e]=it(t.data||{});else{if(i.envParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.environmentVariables"));if(i.fileListParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectListVariable"));if(i.fileParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectVariables"));if(i.filterParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.filterObjectVariables"));if(i.lastParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.finalDataVariables"));if(i.originEntity)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.rawDataObjects"));if(i.sessionParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.operationSessionVariables"))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.calculateEntity",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),t.params[e])}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.reEstablish",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),t.params[e])}},un=class{constructor(t){var e,n;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noScriptCode"));this.scriptFn=ei.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noConfigurationLogicNode"));t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new Ja(t);break;case"END":i=new Za(t);break;case"DEACTION":i=new $a(t);break;case"PREPAREPARAM":i=new en(t);break;case"DEDATASET":i=new an(t);break;case"THROWEXCEPTION":i=new ln(t);break;case"BINDPARAM":i=new nn(t);break;case"RESETPARAM":i=new sn(t);break;case"COPYPARAM":i=new rn(t);break;case"RENEWPARAM":i=new on(t);break;case"APPENDPARAM":i=new dn(t);break;case"SORTPARAM":i=new cn(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),null==(n=t.delogicParams)||n.forEach((t=>{this.params.set(t.id,new hn(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,a){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:a});const n=new Ka(this.params,t,e,a);this.initLogicParams(n);const{startDELogicNodeId:s}=this.model;if(!s||!this.nodes.has(s))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(s);await this.deepExec(t,n)}return n.isEndNode?n.result:n.params[n.defaultParamName]?n.params[n.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:i}=t;for(let a=0;a<i.length;a++){const n=i[a];if(await n.exec(e)&&n.dstNode&&(await this.deepExec(n.dstNode,e),!0!==t.model.parallelOutput))break}}},pn=new Map;async function mn(t,e,i={},a={}){pn.has(t)||pn.set(t,new un(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const n=pn.get(t),s=await n.exec(e,i,a);return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endExecution",{id:t.id,name:t.name})),s}async function gn(t,e,i,a,n){const s=await async function(t,e,i){return Te(t,await ibiz.hub.getAppDataEntity(e,i))}(t,e,i.srfappid);if(!s)throw new o(ibiz.i18n.t("runtime.deLogic.deLogicNode.noFoundEntityLogic",{dataEntityId:e,deDELogicId:t}));return mn(s,i,a,n)}async function fn(t,e,i,a){const s=it(e),o=i?it(i):i,r=a?it(a):a;try{const e=await mn(t,s,o,r);return new l(e)}catch(t){if(t instanceof n)return new l(t,500);throw t}}async function yn(t,e,i,a,n){const s=Ne(t,e);if(s.length){(await Promise.all(s.map((t=>mn(t,i,a,n))))).forEach((t=>{Object.assign(a,t)}))}}async function wn(t,e,i,a,n={}){if(a){if(!z(a))return yn(t,e,i,a,n);await Promise.all(a.map((a=>yn(t,e,i,a,n))))}}var En=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,i){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==i)return!1;let a=-1;if(e==i?a=0:e>i&&(a=1),"EQ"===t||"ABSEQ"===t)return 0===a;if("GT"===t)return a>0;if("GTANDEQ"===t)return a>=0;if("LT"===t)return a<0;if("LTANDEQ"===t)return a<=0;if("NOTEQ"===t)return 0!==a}if("LIKE"===t)return null!=e&&null!=i&&-1!==e.toString().toUpperCase().indexOf(i.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=i&&0===e.toString().toUpperCase().indexOf(i.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},vn=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},In=class extends vn{parse(t){const e=t.length;let i=!0,a=!1,n=!1;for(let s=0;s<e;s++)if(i){const e=t[s];this.setCondOp(e),i=!1,a=!0}else if(a){const e=t[s];this.setParam(e),a=!1,n=!0}else if(n){const e=t[s];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},bn=class t extends vn{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const i=e.length;let a=!0,n=!0,s=!1;for(let r=0;r<i;r++){if(a&&n){if("!"===e[r]){this.setNotMode(!0),a=!1;continue}}if(n){const t=e[r];this.setCondOp(t),n=!1,a=!1,s=!0}else if(s){const i=e[r];if(!(i instanceof Array))throw new o(ibiz.i18n.t("runtime.service.mustArray"));i.forEach((e=>{if(e.length>0){const i=e[0].toString();if("!"===i||"OR"===i||"AND"===i){const i=new t;i.parse(e),this.childCondList.push(i)}else{const t=new In;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Dn=class extends bn{},Cn=class extends In{},An=class t extends En{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof bn){const t=e.getChildPSModelCondBases();if(null==t||et(t))return!e.isNotMode();const n="AND"===e.getCondOp();let s=n;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,i,a)){if(!n){s=!0;break}}else if(n){s=!1;break}}return e.isNotMode()?!s:s}if(e instanceof In){et(e.getParam())&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noAttributeName"),e);const n=i[e.getParam().toLowerCase()];let s=null;const o=e.getValueType(),r=e.getValue();return null==o||et(o)?s=e.getValue():(et(r)&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noContextParameterName")),t.PARAMTYPE_WEBCONTEXT===o?s=a.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(s=a.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),n,s)}return ibiz.log.warn(ibiz.log.warn(ibiz.i18n.t("runtime.service.conditionalObjects")),e),!1}createPSModelSingleCond(){return new Cn}createPSModelGroupCond(){return new Dn}};An.PARAMTYPE_DATACONTEXT="DATACONTEXT",An.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Pn=t("PSDEDQCondEngine",An);async function Tn(t,e){var i;const a=null==(i=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:i.find((e=>e.pluginCode.toLowerCase()===t));if(a)return await ibiz.plugin.loadPlugin(a),"".concat(a.pluginType,"_").concat(a.pluginCode);ibiz.log.error(ibiz.i18n.t("runtime.register.helper.matchedPlugin",{pluginId:t}))}var Nn=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Sn(t,e){ibiz.register.register("".concat(Nn,"_").concat(t),e)}function xn(t){return ibiz.register.get("".concat(Nn,"_").concat(t))}async function Ln(t){let e;const{codeName:i,counterType:a,sysPFPluginId:n,appId:s}=t;if(n){const t=await Tn(n,s);if(t&&(e=xn(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=xn(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=xn(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var Mn=class{static getRegisterKey(t,e){switch(t){case Kn:return this.calcKeyByView(e);case kn:case Wn:case Rn:return this.calcKeyByCtrl(e);default:return""}}static calcKeyByView(t){const{controlItemModel:e,controlModel:i,viewModel:a}=t;let n="";return(null==a?void 0:a.codeName)&&(n+="".concat(a.codeName.toUpperCase())),(null==i?void 0:i.codeName)&&(n+="@".concat(i.codeName.toUpperCase())),(null==e?void 0:e.id)&&(n+="@".concat(e.id.toUpperCase())),n}static calcKeyByCtrl(t){const{controlModel:e,controlItemModel:i}=t;let a="",n="APP";if(e){const{appDataEntityId:t,controlType:i,codeName:s}=e;t&&(n=Ae(t).toUpperCase()),i&&(a+="@".concat(i.toUpperCase())),s&&(a+="@".concat(s.toUpperCase()))}return(null==i?void 0:i.codeName)&&(a+="@".concat(i.codeName.toUpperCase())),a=n+a,a}},Rn=t("CONTROL_PROVIDER_PREFIX","CONTROL");function On(t){return ibiz.register.get("".concat(Rn,"_").concat(t))}async function _n(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:n,appId:s}=t,o=Mn.getRegisterKey(Rn,{controlModel:t});if(e=On(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),n){const t=await Tn(n,s);if(t&&(e=On(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=On("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=On(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var Fn=t("EDITOR_PROVIDER_PREFIX","EDITOR");function zn(t){return ibiz.register.get("".concat(Fn,"_").concat(t))}async function Vn(t){let e;const{editorType:i,editorStyle:a,predefinedType:n,sysPFPluginId:s,appId:o}=t;if(s){const t=await Tn(s,o);if(t&&(e=zn(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=zn("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorStyleType",{editorType:i,editorStyle:a}),t)}if(n){let s="".concat(n,"_").concat(i);if(a&&"DEFAULT"!==a&&(s+="_".concat(a)),e=zn(s),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:n}),t)}if(e=zn(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var kn=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function Un(t){return ibiz.register.get("".concat(kn,"_").concat(t))}async function Bn(t,e){let i;const{detailType:a,sysPFPluginId:n,appId:s}=t,o=Mn.getRegisterKey(kn,{controlItemModel:t,controlModel:e});if(i=Un(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),n){const t=await Tn(n,s);if(t&&(i=Un(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=Un(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var Wn=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Gn(t){return ibiz.register.get("".concat(Wn,"_").concat(t))}async function jn(t,e){let i;const{columnType:a,enableRowEdit:n,sysPFPluginId:s,appId:o}=t,r=Mn.getRegisterKey(Wn,{controlItemModel:t,controlModel:e});if(i=Gn(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),s){const t=await Tn(s,o);if(t&&(i=Gn(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnPlugin",{pluginKey:t}))}const c=n?"".concat(a,"_EDIT"):a;if(i=Gn(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var Kn=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Hn(t){return ibiz.register.get("".concat(Kn,"_").concat(t.toUpperCase()))}async function Xn(t,e,i){var a;let n;const{itemType:s,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=Mn.getRegisterKey(Kn,{controlItemModel:t,controlModel:e,viewModel:i});if(n=Hn(d),n)return n;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Tn(o,r);if(t&&(n=Hn(t)),n)return n;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)n=Hn("PREDEFINE_RENDER");else{if("CONTAINER"===s){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(n=Hn(i),n)return n;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelContainerPredefined",{predefinedType:e,key:i}))}if("RAWITEM"===s){const e=(null==(a=t.rawItem)?void 0:a.predefinedType)||"DEFAULT",i="RAWITEM_".concat(e);if(n=Hn(i),n)return n;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberDirectContent",{predefinedType:e,key:i}))}if("FIELD"===s){const{editor:e}=t;if(e&&e.predefinedType){if(n=Hn("FIELD_".concat(e.predefinedType.toUpperCase())),n)return n}}n=Hn(s)}if(n)return n;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:s}))}var qn=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Yn(t){return ibiz.register.get("".concat(qn,"_").concat(t))}async function Qn(t){let e;const{portletType:i,sysPFPluginId:a,appId:n}=t;if(a){const t=await Tn(a,n);if(t&&(e=Yn(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=Yn(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var $n=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Jn(t,e){ibiz.register.register("".concat($n,"_").concat(t),e)}function Zn(t){return ibiz.register.get("".concat($n,"_").concat(t))}async function ts(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:n,uiactionTag:s}=t;if(a){const t=await Tn(a,n);if(t&&(e=Zn(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=Zn("".concat(i,"_").concat(s)),e)return e;if(e=Zn(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var es=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function is(t){let e;const{sysPFPluginId:i,appId:a}=t,n=await Tn(i,a);if(n){if(e=ibiz.register.get("".concat(es,"_").concat(n)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:n}))}}var as=t("VIEW_PROVIDER_PREFIX","VIEW");function ns(t){return ibiz.register.get("".concat(as,"_").concat(t))}var ss=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var os=t("PlatformProviderBase",class{back(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}init(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}async login(t,e,i){return ibiz.auth.login(t,e)}async download(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(i.data){const t=e;return c(i.data,t),Promise.resolve(!0)}throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"))}}),rs=t("BrowserPlatformProvider",class extends os{});var cs=window.navigator.userAgent.toLowerCase();function ds(){return/Android|Adr/i.test(cs)?"Android":/iPhone|iPod|iPad/i.test(cs)?"IOS":/MicroMessenger/i.test(cs)?"WeChat":/DingTalk/i.test(cs)?"DingTalk":/miniProgram/i.test(cs)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var ls=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function hs(t,e){ibiz.register.register("".concat(ls,"_").concat(t),e)}function us(t){return ibiz.register.get("".concat(ls,"_").concat(t))}function ps(){const t=us(ds());return t||us("Browser")}var ms=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function gs(t,e){ibiz.register.register("".concat(ms,"_").concat(t),e)}function fs(t){return ibiz.register.get("".concat(ms,"_").concat(t))}async function ys(t){let e;const{methodType:i,sysPFPluginId:a,appId:n}=t;if(a){const t=await Tn(a,n);if(t&&(e=fs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=fs(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var ws=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Es(t){return ibiz.register.get("".concat(ws,"_").concat(t))}async function vs(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:n}=t;if(n){const t=await Tn(n,a);if(t&&(e=Es(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Es(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Is=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function bs(t){return ibiz.register.get("".concat(Is,"_").concat(t))}async function Ds(t){let e;const{sysPFPluginId:i,appId:a,itemType:n}=t;if(i){const t=await Tn(i,a);if(t&&(e=bs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=bs(n),e}var Cs=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var As=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Ps=t("TOOLBAR_ITEM_PROVIDER_PREFIX","TOOLBAR_ITEM");async function Ts(t){let e;const{sysPFPluginId:i,appId:a}=t;if(i){const t=await Tn(i,a);if(t&&(n=t,e=ibiz.register.get("".concat(Ps,"_").concat(n))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.toolbarItem",{pluginKey:t}))}var n;return e}var Ns=t("AC_ITEM_PROVIDER_PREFIX","AC_ITEM");var Ss=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=h.create(),this.params={},this.evt=new ut,this.data={},this.countChange=this.countChange.bind(this)}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load(),this.model.appDataEntityId&&ibiz.mc.command.change.on(this.countChange)}countChange(t){const e=t.data;if(this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}setParams(t,e){t&&(this.context=it(t)),e&&(this.params=it(e))}interval(){this.destroyInterval(),this.model.timer&&(this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer))}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o(ibiz.i18n.t("runtime.service.noImplementedCounter"))}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&ct(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset(),ibiz.mc.command.change.off(this.countChange)}}),xs=t("AppDECounter",class extends Ss{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundCounterBehavior"));this.action=a,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),Ls=t("AppDECounterProvider",class{createCounter(t){return new xs(t)}});function Ms(){Sn("DEDR",(()=>new Ls))}var Rs=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const i=new Pn;return 1===e.length?i.parse(this.calcCond(e)[0]):e.length>1&&i.parse(["AND",this.calcCond(e)][0]),this.map.set(t,i),i}return null}static calcCond(t){const e=[];return t.forEach((t=>{const i=[];if("GROUP"===t.condType){const e=t;e.notMode&&i.push("!"),i.push(t.condOp);const a=e.dedqconditions;if(a){const t=this.calcCond(a);i.push(t)}}else{if("SINGLE"!==t.condType)throw new a(t,ibiz.i18n.t("runtime.service.unsupportedQueryTypes",{condType:t.condType}));{const e=t;i.push(e.condOp),i.push(e.fieldName),e.condValue?e.vartypeId?i.push({type:e.vartypeId,value:e.condValue}):i.push(e.condValue):i.push("")}}e.push(i)})),e}});Rs.map=new WeakMap;var Os=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=h.create(),this.params={},this.evt=new ut,this.commonKeys=["query","queryconds","searchconds"],this.codeList=t,this.codeList.enableCache){this.codelistChange=this.codelistChange.bind(this);const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&ibiz.mc.command.change.on(this.codelistChange)}}setParams(t,e){t&&(this.context=h.create({},{...t})),e&&(this.params=it(e))}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new a(this.codeList,ibiz.i18n.t("runtime.service.predefinedType",{predefinedType:t}))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:i,textAppDEFieldId:a,iconClsAppDEFieldId:n,iconClsXAppDEFieldId:s,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=i?t[i]:t.srfkey;if(e.id=u,e.value=u,e.text=a?t[a]:t.srfmajortext,(n||s||o||r)&&(e.sysImage={appId:this.codeList.appId},n&&(e.sysImage.cssClass=t[n]),s&&(e.sysImage.cssClassX=t[s]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Ws(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=ei.execSingleLine(d,t)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.service.dynamicCodeTable"))}return e}presetconvertData(t){const e={},{color:i,bkcolor:a,disabled:n,id:s,text:o,value:r,cls:c}=t;return e.value=r,e.color=i,e.bkcolor=a,e.text=o,e.id=s,e.disableSelect=n,e.cls=c,e.data=t,e}sortShoworder(t){return t.forEach((t=>{"showorder"in t||Object.assign(t,{showorder:1e3})})),t.sort(((t,e)=>t.showorder-e.showorder))}async load(t,e={}){const a={...e};this.commonKeys.forEach((t=>{delete a[t]})),this.setParams(t,a);const n=ibiz.hub.getApp(t.srfappid),{appDataEntityId:s,appDEDataSetId:o,minorSortAppDEFieldId:r,minorSortDir:c,pvalueAppDEFieldId:d,customCond:l}=this.codeList;if(r&&c&&Object.assign(a,{sort:"".concat(r.toLowerCase(),",").concat(c.toLowerCase())}),l){const e=he(ei.execSingleLine(l),a,t);Object.assign(a,e)}if(a.size||(a.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await n.net.get("/dictionaries/codelist/".concat(t),a),i=[],{items:s}=e.data;return this.sortShoworder(s).length&&s.forEach((t=>{i.push(this.presetconvertData(t))})),Object.freeze(i)}if(!s)throw new i(this.codeList,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));if(!o)throw new i(this.codeList,ibiz.i18n.t("runtime.service.unconfiguredDataset"));const h=await n.deService.exec(s,o,t,void 0,a);let u=[];if(h.data.length)if(d){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:i}=this.codeList,a={},n=[];return t.forEach((t=>{a[t[e]]=this.convertData(t)})),t.forEach((t=>{const s=a[t[i]];s?(s.children=s.children||[],s.children.push(a[t[e]])):n.push(a[t[e]])})),n}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const i=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(i)){const t=this.cache.get(i);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(i)}const a=this.load(t,e),{cacheTimeout:n}=this.codeList,s=-1===n||Z(n)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+s,promise:a};this.cache.set(i,o);const r=await a;return o.items=r,delete o.promise,r}codelistChange(t){const e=t.data,{appDataEntityId:i}=this.codeList;if(i){const t=Ae(i);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}async refresh(){const t=JSON.stringify(this.context)+JSON.stringify(this.params);this.cache.delete(t);const e=await this.get(this.context,this.params);this.evt.emit("change",e)}onChange(t,e=!0){this.evt.on("change",t);const i=JSON.stringify(this.context)+JSON.stringify(this.params),a=this.cache.get(i);e&&ct(a)&&t(a.items)}offChange(t){this.evt.off("change",t)}destroy(){const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&this.codeList.enableCache&&ibiz.mc.command.change.off(this.codelistChange)}});function _s(t,e){if(null!=e){const{srfkey:t}=e;if(!Z(t)&&!et(t))return!0}throw new o(ibiz.i18n.t("runtime.service.processedWithout",{funcName:t}))}function Fs(t,e){const{srfsessionid:i}=e;if(!Z(i)&&!et(i))return!0;throw new o(ibiz.i18n.t("runtime.service.noExistProcessed",{funcName:t}))}var zs=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const i=this.cacheMap.get(e.srfkey);i&&(i.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,it(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.createPrimaryKeyData",{srfkey:e.srfkey}));try{Fs("add",t),(Z(e.srfkey)||et(e.srfkey))&&(e.srfkey=ht()),e.srftempdate=(new Date).getTime();const i=()=>{this.cacheMap.set(e.srfkey,it(e)),ibiz.log.warn("add",e.srfkey,e)},a=this.getTransaction(t);return a?a.change(e.srfkey,(()=>{i()})):i(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Fs("get",t);const i=this.cacheMap.get(e);return ibiz.log.warn("get",e,i),it(i)}catch(t){return ibiz.log.error(t),null}}update(t,e){const i=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),i!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:e.srfkey}));try{Fs("update",t),_s("update",e),e.srftempdate=(new Date).getTime();const a=this.cacheMap.get(i);if(a){const n=it(a);n.assign(e);const s=()=>{a.assign(e),i!==e.srfkey&&this.cacheMap.delete(i),this.cacheMap.set(e.srfkey,a),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{s()})):s(),n}throw new Error(ibiz.i18n.t("runtime.service.noExistNoUpdated"))}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Fs("delete",t);const i=e;if(this.cacheMap.has(i)){const e=this.cacheMap.get(i),a=()=>{this.cacheMap.delete(i),ibiz.log.warn("delete",i)},n=this.getTransaction(t);return n?n.change(i,(()=>{a()})):a(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Fs("add",t);const i=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},a=this.getTransaction(t);for(let t=0;t<e.length;t++){const n=e[t];(Z(n.srfkey)||et(n.srfkey))&&(n.srfkey=ht()),n.srftempdate=(new Date).getTime();const s=it(n);a?a.change(s.srfkey,(()=>{i(s)})):i(s)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Fs("update",t);const i=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},a=this.getTransaction(t);for(let n=0;n<e.length;n++){const s=e[n];_s("update",s);const r=s.srfkey;if(this.isUnionKey&&(this.calcUnionKey(s),r!==s.srfkey&&this.checkData(t,s.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:s.srfkey}));s.srftempdate=(new Date).getTime();const c=this.cacheMap.get(s.srfkey);if(!c)throw new Error(ibiz.i18n.t("runtime.service.dataNoExistNoUpdated",{srfdename:s.srfdename,srfmajortext:s.srfmajortext,srfkey:s.srfkey}));{const t=it(c);t.assign(s),e[n]=t,a?a.change(s.srfkey,(()=>{c.assign(s),i(c,r)})):(c.assign(s),i(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Fs("delete",t)}catch(t){return ibiz.log.error(t),e}const i=[];for(let t=0;t<e.length;t++){const a=e[t];this.cacheMap.has(a)||i.push(a)}if(i.length>0)throw new Error(ibiz.i18n.t("runtime.service.noDeleted",{notRemoveKey:i.join("、")}));const a=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},n=this.getTransaction(t);for(let t=0;t<e.length;t++){const i=e[t];n?n.change(i,(()=>{a(i)})):a(i)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=at(t.srfkey)),delete t.srfkey;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e[i]=at(a)}return nt(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>fe(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>Z(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),Vs=/\$\{(.*?)\}/g;function ks(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(Vs);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:i}=e;return 0===i.length||i.every(((e,a)=>a===i.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(i.length>0)return i[0]}function Us(t,e){const i=ks(t,e);if(i){if(i.keys.length>0){let{path:e}=i;return i.keys.forEach(((a,n)=>{e=n===i.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(a,"\\}")),""):e.replace("${".concat(a,"}"),t[a])})),e}return i.path}return""}var Bs=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(Z(e.page)||et(e.page)||(this.page=e.page),Z(e.size)||et(e.size)||(this.size=e.size),Z(e.query)||et(e.query)||(this.query=e.query),!Z(e.sort)&&!et(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Ws(t){if("boolean"==typeof t)return t;if("number"==typeof t)return t>0;if("string"!=typeof t)return!!t;switch(t){case"true":return!0;case"false":return!1;default:{const e=Number(t);return!Number.isNaN(e)&&e>0}}}function Gs(t){const e={};if(!t)return e;const i=t.split(",");return i&&i.length>0&&i.forEach((t=>{const[i,a]=t.split(":");e[i]=parseInt(a,10)})),e}function js(t){const e={};return t.forEach((t=>{e[t.srflistmapfield]=t,delete t.srflistmapfield})),e}function Ks(t){const e=[];return Object.keys(t).forEach((i=>{const a=t[i];a.srflistmapfield=i,e.push(a)})),e}var Hs=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const i=t.codeItems;let a=[];return(null==i?void 0:i.length)&&(a=this.formatStaticItems(i,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(a)),a}setCodeList(t){const{id:e,codeName:i}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(i,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var i;let a=t.text;t.textLanguageRes&&(a=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:n}=t;t.tooltipLanguageRes&&(n=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const s={text:a,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:n,data:t.data?ei.execSingleLine(t.data):void 0,sysImage:t.sysImage,userData:t.userData};return(null==(i=t.codeItems)?void 0:i.length)&&(s.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(s)}))}async getDynamicCodeList(t,e,i={}){let a;const n=t.codeName;return this.cache.has(n)?a=this.cache.get(n):(a=new Os(t),this.cache.set(n,a),await a.init()),a.get(e,i)}async get(t,e,i){const a=this.allCodeLists.get(t);if(!a)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,e,i):[]}async getCodeListInstance(t){let e;const i=this.allCodeLists.get(t);if(!i)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));if("DYNAMIC"===i.codeListType){const t=i.codeName;this.cache.has(t)?e=this.cache.get(t):(e=new Os(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof Os&&t.destroy()}))}}),Xs=t("ConfigService",class{constructor(t,e,i){this.appId=t,this.folder=e,this.tag=i,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),qs=t("CounterService",class{static async getCounter(t,e,i){let a=t.id;if(i&&i.srfcustomtag&&(a=i.srfcustomtag),this.counterMap.has(a)){const t=this.counterMap.get(a);if(!1===t.isDestroyed)return t;this.counterMap.delete(a)}const n=(await Ln(t)).createCounter(t);return await n.init(e,i),this.counterMap.set(a,n),n}static async getCounterByRef(t,e,a){const{appCounter:n}=t;if(!n)throw new i(t,ibiz.i18n.t("runtime.service.noConfiguredCounters"));return this.getCounter(n,e,a)}});qs.counterMap=new Map;var Ys=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:i}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(i))}async getWFLink(t,e){const i=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:a}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(i,"/usertasks/").concat(a,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(i,t)})}async wfSubmit(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(i,t)})}async wfWithdraw(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(i,t)})}async wfReassign(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepBefore(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepAfter(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(i,t)})}async wfSendBack(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(i,t)})}async wfSendCopy(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(i,t)})}async exec(t,e,i={},a={}){switch(t){case"wfstart":return this.wfStart(e,i,a);case"wfsubmit":return this.wfSubmit(e,i,a);case"reassign":return this.wfReassign(e,i,a);case"addstepbefore":return this.wfAddStepBefore(e,i,a);case"addstepafter":return this.wfAddStepAfter(e,i,a);case"sendback":return this.wfSendBack(e,i,a);case"sendcopy":return this.wfSendCopy(e,i,a);default:throw new o(ibiz.i18n.t("runtime.service.noImplemented",{methodName:t}))}}}),Qs=class{constructor(t){this.model=t}exportData(t,e,i,a){const n=Us(i,this.model),s="".concat(n,"/").concat(this.model.deapicodeName2,"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(s,{method:"post",data:a,responseType:"blob"})}},$s=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))($s||{})),Js=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,i={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:it(i instanceof t?i._data:i)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const a=fe(e.appDEFields||[],e.keyAppDEFieldId);if(a){const t=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn(ibiz.i18n.t("runtime.service.noConfiguredPrimary",{codeName:e.codeName}));const n=fe(e.appDEFields||[],e.majorAppDEFieldId);if(n){const t=n.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn(ibiz.i18n.t("runtime.service.noConfiguredField",{codeName:e.codeName}));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:Z(this.srfkey)?ht():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:i}=this,a={};Object.keys(e).forEach((t=>{a[t]={enumerable:!0,set(i){e[t]=i},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const n=t.codeName.toLowerCase();a[n]={enumerable:!0,set(a){e[n]=i(a,t.stdDataType)},get:()=>e[n]},e[n]=i(e[n],t.stdDataType)})),Object.defineProperties(this,a)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let i={};return i=e instanceof t?e._data:e,Object.keys(i).forEach((t=>{void 0===i[t]&&delete i[t]})),Object.assign(this._data,i),this}convertVal(t,e){if(null==t)return t;if(Z(e))return t;if(u.isNumber(e)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),Zs=t("MethodDto",class{constructor(t,e,i,a){this.service=t,this.entity=e,this.isLocalMode=i,this.dto=a,this.dtoMap=new Map,a?(this.app=ibiz.hub.getApp(e.appId),this.fields=a.appDEMethodDTOFields||[]):this.fields=[]}async get(t,e,n=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return e=this.format(t,e);const s={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(s[d]=0===e[d].length?null:js(e[d]));else{if(void 0!==e[d]&&!1===n)break;if(!c.refAppDataEntityId)break;const a=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=a.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const i=it(t);i[this.entity.codeName.toLowerCase()]=e.srfkey;const a={};h.parentAppDEFieldId&&(a[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,i,a)}else{if(r.entity.id===this.entity.id)throw new i(c,ibiz.i18n.t("runtime.service.subRelationships"));u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,i=[];for(let a=0;a<e.length;a++)i.push(await r.get(t,e[a],!0));s[d]=i}}break;default:throw new a(c,ibiz.i18n.t("runtime.service.unsupportedMethod",{type:c.type}))}}return{...e,...s}}async sets(t,e){if(!0===t.srfsimple&&!1===this.isLocalMode){if(e&&e.length>0){for(let i=0;i<e.length;i++)e[i]=this.format(t,e[i]);return e.map((t=>this.service.createEntity(t)))}return[]}const i=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const n=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[n])e[n]=Ks(e[n]);else{if(!a.refAppDataEntityId)return;const s=i.getDERConfig(a.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,a);s||o.service.local.clear();const r=e[n];if(r&&r.length>0){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&r.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const n=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,n),n})))}async calcRs(t,e=0){if(e>10)return;e+=1;const i=ibiz.uiDomainManager.get(t.srfsessionid),a=this.fields.filter((t=>"DTOS"===t.type));for(let n=0;n<a.length;n++){const s=a[n];if(!s.refAppDataEntityId)continue;if(0===i.getDERConfig(s.refAppDataEntityId).length){const a=await this.getFieldDto(t,s);a.entity.minorAppDERSs&&i.setDERConfig(s.refAppDataEntityId,a.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await a.calcRs(t,e)}}}format(t,e){const i={};for(let t=0;t<this.fields.length;t++){const a=this.fields[t],n=a.codeName.toLowerCase();"DTOS"===a.type&&a.listMap&&("[object Object]"===Object.prototype.toString.call(e[n])&&(i[n]=Ks(e[n])),"[object Array]"===Object.prototype.toString.call(e[n])&&(i[n]=js(e[n])))}return{...e,...i}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const i=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),a=fe(i.appDEMethodDTOs||[],e.refAppDEMethodDTOId),n=await this.app.deService.getService(t,i.id);n.isLocalMode=!0;const s=n.createMethodDto(a,{isLocalMode:!0});return this.dtoMap.set(e.codeName,s),s}}),to=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new zs(e),this.configCache=new Xs(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Ys(e),this.file=new Qs(e)}async getMethod(t,e=!1){const n=e?"ac-".concat(t):t;if(this.methodMap.has(n))return this.methodMap.get(n);const s=ve(this.model,t);if(!s)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundServiceMethod",{id:t}));const o=await ys(s);if(!o)throw new a(s,ibiz.i18n.t("runtime.service.UnsupportedServiceMethod",{methodType:s.methodType}));const r=o.create(this,this.model,s,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(n,r),r}async exec(t,e,i,a,n){const s=await this.getMethod(t);if(s)return s.exec(e,i,a,n);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}getDraft(t,e,i){return this.exec("GetDraft",t,e,i)}create(t,e,i){return this.exec("Create",t,e,i)}get(t,e,i){return this.exec("Get",t,e,i)}update(t,e,i){return this.exec("Update",t,e,i)}remove(t,e,i){return this.exec("Remove",t,e,i)}fetchDefault(t,e,i){return this.exec("FetchDefault",t,e,i)}getDraftTemp(t,e,i){return this.exec("GetDraftTemp",t,e,i)}createTemp(t,e,i){return this.exec("CreateTemp",t,e,i)}getTemp(t,e,i){return this.exec("GetTemp",t,e,i)}updateTemp(t,e,i){return this.exec("UpdateTemp",t,e,i)}removeTemp(t,e,i){return this.exec("RemoveTemp",t,e,i)}fetchTempDefault(t,e,i){return this.exec("FetchTempDefault",t,e,i)}async execAc(t,e,i,a={}){const n=await this.getMethod(t,!0);if(n)return n.exec(e,i,a);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}aiChatSse(t,e,i={},a={}){const n=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(e);return new Promise(((e,o)=>{n.net.sse("/".concat(s),{srfactag:"AIChat",...i},{headers:{"Content-Type":"application/json"},body:JSON.stringify(a),onmessage:e=>{if(e.data){const i=JSON.parse(e.data);t(i)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},i={}){const a=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(t,!0);return a.net.post(n,i,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const i=t[this.model.codeName.toLowerCase()],a="/".concat(this.model.deapicodeName2,"/ssechatcompletion").concat(e?"/histories":"").concat(i?"/".concat(i):"");return Us(t,this.model)+a}newEntity(t){return t instanceof Js?t.clone():new Js(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new Zs(this,this.model,null==e?void 0:e.isLocalMode,t)}}),eo=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],io=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:Z(this.srfkey)?ht():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const i=t.dataKey;this.linkProperty(e,i,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,i){const a=!i||i.isOriginField;eo.includes(t)||(a||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=it(this.$origin),i=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{i[t]=this[t]})),i}}),ao=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,i,a){const n=this.handleCustomRequestHeader(),s=await this.app.deService.exec(this.model.appDataEntityId,t,e,i,a,n);return await this.handleItemPrivilege(s.data,e),s}async handleItemPrivilege(t,e){const{enableItemPrivilege:i,appDataEntityId:a}=this.model;if(t&&i&&a){const i=await this.app.authority.getService(a);(Array.isArray(t)?t:[t]).forEach((t=>{i.setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}))}}handleCustomRequestHeader(){const t={},{enableItemPrivilege:e}=this.model;return e&&Object.assign(t,{srfdataaccaction:!0}),t}handleResponse(t){return p(t)}toUIData(t){return new io(t,this.dataUIMap)}}),no=t("MDControlService",class extends ao{async fetch(t,e={}){var i;const a=(null==(i=this.model.fetchControlAction)?void 0:i.appDEMethodId)||"fetchdefault";let n=await this.exec(a,t,e);return n=this.handleResponse(n),n}async get(t,e={}){var i;const a=(null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get";let n=await this.exec(a,t,void 0,e);return n=this.handleResponse(n),n}async getDraft(t,e={}){var i;const a=(null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft";let n=await this.exec(a,t,void 0,e);return n=this.handleResponse(n),n}async remove(t,e={}){var i;const a=(null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove";return await this.exec(a,t,void 0,e)}async create(t,e){var i;const a=(null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create";let n=await this.exec(a,t,e.getOrigin());return n=this.handleResponse(n),n}async update(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let n=await this.exec(a,t,e.getOrigin());return n=this.handleResponse(n),n}async updateBatch(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let n=await this.exec(a,t,e.map((t=>t.getOrigin())));return n=this.handleResponse(n),n}async exportData(t,e,i={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"])),e.headers["x-total-pages"]&&(e.totalPages=Number(e.headers["x-total-pages"]))),e.ok&&(mt(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),so=t("DeAuthorityService",class{constructor(t){this.entityModel=t,this.dataAccActionMap=new Map}setDataAccAction(t,e){t.srfsessionid&&this.dataAccActionMap.set("".concat(t.srfsessionid,"-").concat(t.srfkey),e),this.dataAccActionMap.set(t.srfkey,e)}getDataAccAction(t){return this.dataAccActionMap.get(t)}async calcByDataAccessAction(t,e,i,a){if(a){if(!await this.calcDeDataAccAction(t,e,i))return!1}return!!await this.calcByDeMainState(t,e)}async calcMajorDataAccAction(t){const{minorAppDERSs:e}=this.entityModel;if(!e)return;const i=null==e?void 0:e.find((e=>{const i=Ae(e.majorAppDataEntityId);return Object.prototype.hasOwnProperty.call(t,i)&&t[i]}));if(!i)return;const a=await ibiz.hub.getApp(t.srfappid),n=await a.authority.getService(i.majorAppDataEntityId);if(!n)return;const s=Ae(i.majorAppDataEntityId);return n.getDataAccAction("".concat(t.srfsessionid,"-").concat(t[s]))||n.getDataAccAction("".concat(t[s]))}async calcDeDataAccAction(t,e,i){let a,n=!0;const{dataAccCtrlMode:s}=this.entityModel;switch(s){case 1:a=(null==e?void 0:e.srfdataaccaction)?Gs(e.srfdataaccaction):void 0;break;case 2:case 3:if(a=Gs(await this.calcMajorDataAccAction(i)),e&&e.srfdataaccaction){const t=Gs(e.srfdataaccaction);Object.assign(a,t)}}return a&&t&&!a[t]&&(n=!1),n}async calcByDeMainState(t,e={}){let i=!0;if(0===Object.keys(e).length)return i;const a=this.entityModel;if(!a.enableDEMainState)return ibiz.log.debug(ibiz.i18n.t("runtime.service.masterState",{codeName:a.codeName})),i;ibiz.log.debug(ibiz.i18n.t("runtime.service.operationIdentifier",{dataAccessAction:t}),e,a);const n=De(a,e);if(n){ibiz.log.debug(ibiz.i18n.t("runtime.service.matchMasterState"),n);const e=Ce(n,a);ibiz.log.debug(ibiz.i18n.t("runtime.service.masterStatePermissions"),e),i=e.includes(t)}else ibiz.log.debug(ibiz.i18n.t("runtime.service.noMatchedState")),i=!1;return ibiz.log.debug(ibiz.i18n.t("runtime.service.permissionCalculation",{dataAccessAction:t,result:i})),i}}),oo=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}));const i=this.constructorCache.get(t);let a;a=i?await i(e):new so(e),this.cache.set(t,a)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByNoDataAccessAction(t,e,i){if(this.enablePermission){const a=await ibiz.hub.getApp(this.appModel.appId),n=await a.getOPPriv(t,i);if(this.enablePermission&&(null==n?void 0:n.mapSysUniResCode)){if(!this.calcByResCode(n.mapSysUniResCode))return!1}else if(i){const a=await this.getService(i),n=Gs(await a.calcMajorDataAccAction(e));if(n&&t&&!n[t])return!1}}return!0}async calcByDataAccessAction(t,e,i,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(a){return(await this.getService(a)).calcByDataAccessAction(t,i,e,this.enablePermission)}return!0}}),ro=t("V7AuthService",class{get isAnonymous(){return"1"===pt(d.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error(ibiz.i18n.t("runtime.service.noFoundUsernamePassword")),!1;const i=await this.login(t,e);if(i){gt(d.IS_ANONYMOUS,"1",0,!0);const t=pt(d.TOKEN),e=pt(d.TOKEN_EXPIRES),i=pt(d.TOKEN_REMEMBER),a=pt(d.REFRESH_TOKEN);gt(d.TOKEN,t,0,!0),gt(d.TOKEN_EXPIRES,e,0,!0),gt(d.TOKEN_REMEMBER,i,0,!0),a&&gt(d.REFRESH_TOKEN,a,0,!0)}return i}async login(t,e,i,a){try{this.clearAuthData();const n=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:i},{},a),{data:s}=n;if(s&&s.token){const t=i?30:0;i&&gt(d.TOKEN_REMEMBER,"1",t,!0),gt(d.TOKEN,s.token,t,!0);const e=(new Date).getTime()+1e3*(s.expirein||7199);gt(d.TOKEN_EXPIRES,"".concat(e),t,!0),s.refresh_token&&gt(d.REFRESH_TOKEN,s.refresh_token,t,!0),ft(d.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.loginFailure"),desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),this.clearAuthData(),!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.logoutFailure"),desc:t.message||""})}return!1}async changePwd(t,e){try{return{ok:!0,result:await ibiz.net.post("/uaa/changepwd",{oldPwd:t,newPwd:e})}}catch(t){return{ok:!1,result:t}}}async extendLogin(){if(this.isAnonymous)return;const t=pt(d.TOKEN),e=pt(d.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=pt(d.TOKEN_REMEMBER),e=pt(d.REFRESH_TOKEN),i=t?30:0;let a;if(a=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),a.ok){t&&gt(d.TOKEN_REMEMBER,"1",i,!0),gt(d.TOKEN,a.data.token,i,!0);const e=(new Date).getTime()+1e3*(a.data.expirein||7199);gt(d.TOKEN_EXPIRES,"".concat(e),i,!0),a.data.refresh_token&&gt(d.REFRESH_TOKEN,a.data.refresh_token,i,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}async refreshToken(){const t=pt(d.TOKEN_REMEMBER),e=pt(d.REFRESH_TOKEN);if(null!=e&&""!==e){const i=await ibiz.net.get("/uaa/refresh_token/".concat(e));if(i.ok){const e=t?30:0;t&&gt(d.TOKEN_REMEMBER,"1",e,!0),gt(d.TOKEN,i.data.token,e,!0);const a=(new Date).getTime()+1e3*(i.data.expirein||7199);gt(d.TOKEN_EXPIRES,"".concat(a),e,!0),i.data.refresh_token&&gt(d.REFRESH_TOKEN,i.data.refresh_token,e,!0),ft(d.IS_ANONYMOUS)}}}getAuthInfo(){const t=pt(d.TOKEN),e=!!pt(d.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}async loadAppData(){const t=await ibiz.net.get("/appdata");t.ok&&(ibiz.appData=t.data)}clearAuthData(){ft(d.TOKEN),ft(d.TOKEN_EXPIRES),ft(d.TOKEN_REMEMBER),ft(d.REFRESH_TOKEN),ft(d.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0}}),co=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return Z(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),lo=t("MethodInput",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const n=i.appDEMethodInput;if(n){const i=fe(e.appDEMethodDTOs||[],n.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}async format(t,e){return this.dto?this.dto.format(t,e):e}}),ho=t("MethodReturn",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const n=i.appDEMethodReturn;if(n){const i=fe(e.appDEMethodDTOs||[],n.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const i=ibiz.hub.getApp(this.entity.appId),a=ibiz.uiDomainManager.get(t.srfsessionid);a&&!0!==a.state.rsInit&&(await this.dto.calcRs(t),a.calcParentRs(),a.state.rsInit=!0),a.dataChangeCompleted(),i.deService.clearTempCacheByRs({srfappid:i.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return dt(e)&&(e={}),new Js(this.entity,e)}async format(t,e){return this.dto?this.dto.format(t,e):e}}),uo=t("Method",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a,this.app=ibiz.hub.getApp(e.appId),this.input=new lo(t,e,i),this.result=new ho(t,e,i)}async request(t,e,a,n,s){const{actionType:o,requestMethod:r}=this.method;if("REMOTE"===o){const e=this.method.requestPath;let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),a||n||{},{},s);break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),a||n,s);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),a||n||{},s);break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),a||n);break;default:throw new i(this.method,r?ibiz.i18n.t("runtime.service.requestMethods",{requestMethod:r}):ibiz.i18n.t("runtime.service.noConfiguredRequestMethod"))}return o}throw new i(this.method,ibiz.i18n.t("runtime.service.unsupportedBehaviorTypes",{actionType:o}))}mergeRequestPath(t,e){return e?"".concat(t).concat(e):"".concat(t)}calcPath(t){const e="/".concat(this.entity.deapicodeName2);return Us(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),po=t("DEActionMethod",class extends uo{async inputHandle(t,e){return z(e)?e:this.input.handle(t,e)}async inputFormat(t,e){const i=async e=>this.input.format(t,e);if(Array.isArray(e)){const t=[];for(let a=0;a<e.length;a++)t.push(await i(e[a]));return t}return i(e)}async exec(t,e,a,n){let s;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await wn(this.entity,"change",t,e,a),"DELOGIC"===this.method.actionType){const n=Te(this.method.appDELogicId,this.entity);if(!n)throw new i(this.method,ibiz.i18n.t("runtime.service.lackEntityLogic"));s=await fn(n,t,e,a)}else{e&&(e=this.isLocalMode?await this.inputFormat(t,e):await this.inputHandle(t,e));switch(this.method.actionTag?this.method.actionTag.toUpperCase():this.method.codeName.toUpperCase()){case"CREATE":s=await this.create(t,e,a||{},n);break;case"GET":s=await this.get(t,a,n);break;case"GETDRAFT":s=await this.getDraft(t,a,n);break;case"REMOVE":s=await this.remove(t,a);break;case"UPDATE":s=await this.update(t,e,a,n);break;case"CREATETEMP":s=await this.createTemp(t,e);break;case"GETTEMP":s=await this.getTemp(t,e);break;case"GETDRAFTTEMP":s=await this.getDraftTemp(t,a);break;case"REMOVETEMP":s=await this.removeTemp(t,e);break;case"UPDATETEMP":s=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let a=t[this.entity.codeName.toLowerCase()];_(a)&&(a=z(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(a)}const o=await this.request(i,t,e,a,n);a&&a.srfupdateitem||(o.data=await this.result.handle(t,o.data)),s=o}}}return s.data&&await wn(this.entity,"compute",t,s.data,a),s}async create(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.createBehavior"));if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const n=this.calcPath(t),s=await this.app.net.post(n,e,i,a);return s.data=await this.result.handle(t,s.data),s}async remove(t,e,i){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i)}async update(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.updateBehavior"));if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const n=this.calcPath(t),s=await this.app.net.put("".concat(n,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i,a);return s.data=await this.result.handle(t,s.data),s}async get(t,e={},i={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),n=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i);return n.data=await this.result.handle(t,n.data),n}async getDraft(t,e,i){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),n=await this.app.net.get(this.mergeRequestPath(a,this.method.requestPath),e,i);return n.data=await this.result.handle(t,n.data),n}async createTemp(t,e){try{const i=this.createEntity(e);let a;a=z(i)?await Promise.all(i.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,i));const n=ibiz.uiDomainManager.get(t.srfsessionid);return n&&n.dataChange(),new l(a)}catch(t){throw new n(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new l(t):new l(t,500)}catch(t){return new l(t,500)}}async removeTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(i,t,e)}catch(t){throw new n({response:new l(null,500,t.message)})}const a=this.service.local.delete(t,i);if(a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new l(a)}return new l(a,500)}catch(t){throw new n(t)}}async associationDeletion(t,e,a){const n=ibiz.uiDomainManager.get(e.srfsessionid),s=n.transaction;let o=!1;!1===s.state.isOpen&&(s.open(),o=!0);try{let a=n.getDERConfigByMajor(this.entity.id);if(a.length>0){const n=this.service.local.get(e,t);a=yt(a,"removeOrder");for(const s of a){if("DER1N"!==s.rstype)throw new i(s,ibiz.i18n.t("runtime.service.deletionDeletion"));const{removeActionType:a,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=s,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=it(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(a){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const i=await l.remove(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[s.parentAppDEFieldId.toLowerCase()]=void 0;const i=await l.updateTemp(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e=ibiz.i18n.t("runtime.service.unableDelete",{logicName:this.entity.logicName,srfmajortext:n.srfmajortext,modelLogicName:l.model.logicName,msg:t});throw new Error(o||e)}}}}o&&s.state.isOpen&&s.commit()}catch(t){throw o&&s.state.isOpen&&s.rollback(),t}finally{o&&s.state.isOpen&&s.close()}}async updateTemp(t,e){try{const i=this.createEntity(e);let a;if(a=z(i)?await Promise.all(i.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,i)),a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new l(a)}return new l(a,500)}catch(t){throw new n(t)}}async getTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);const a=this.service.local.get(t,i);return a?new l(a):new l(a,500)}catch(t){throw new n(t)}}async removeBatchTemp(t,e){return new l(!0)}attach(t,e){const i=t.srfsessionid,a=ibiz.uiDomainManager.get(i).getDERConfig(this.entity.id);return a.length>0&&a.forEach((i=>{if(i.parentAppDEFieldId){const{majorAppDataEntityId:a,parentAppDEFieldId:n}=i,s=Ae(a),o=n.toLowerCase(),r=t[s];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),mo=class{create(t,e,i,a){return new po(t,e,i,a.localMode)}},go=t("FetchMethod",class extends uo{async exec(t,e,i,n){const s=e&&!z(e)?e:i||{};let o;if(this.isLocalMode){const e=Rs.getCond(this.method),i=new Bs(t,s),a=await this.searchLocal(e,i);o=new l(a,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,s);break;case"REMOTE":{const a=this.calcPath(t);o=await this.request(a,t,e,i,n)}break;default:throw new a(this.method,ibiz.i18n.t("runtime.service.noSupportedDataSource",{dataSetType:this.method.dataSetType}))}const r=o.data||[];for(let e=0;e<r.length;e++)r[e]=await this.result.format(t,r[e]);o.data=r.map((t=>this.createEntity(t)))}return o.data&&await wn(this.entity,"compute",t,o.data,s),o}async searchLocal(t,e,i=this.entity.quickSearchAppDEFieldIds){let a=this.service.local.getList();t?a.length>0&&(a=a.filter((i=>t.test(i,e)))):a.length>0&&e.query&&""!==e.query&&i&&(a=a.filter((t=>{const a=new RegExp(e.query);for(let e=0;e<i.length;e+=1){const n=t[i[e]];if(a.test(n))return!0}return!1}))),Z(e.sortField)||et(e.sortField)||(a="DESC"===e.sortMode?wt(a,e.sortField):yt(a,e.sortField));const{page:n,size:s}=e,o=n*s,r=(n+1)*s-1;return a.slice(o,r).map((t=>it(t)))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new i(this.method,ibiz.i18n.t("runtime.service.sourceCodeTable"));const n=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:s,majorAppDEFieldId:o}=this.entity,r=n.map((t=>({[s]:t.value,[o]:t.text})));return new l(r,200)}}),fo=t("AcFetchMethod",class extends go{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),yo=class{create(t,e,i,a){return a.acMode?new fo(t,e,i,a.localMode):new go(t,e,i,a.localMode)}};function wo(){const t=new mo;gs("DEACTION",(()=>t));const e=new yo;gs("FETCH",(()=>e)),gs("FETCHTEMP",(()=>e))}var Eo=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"timestamp,desc"};Object.assign(e,t);const i=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return i.headers&&(i.headers["x-page"]&&(i.page=Number(i.headers["x-page"])),i.headers["x-per-page"]&&(i.size=Number(i.headers["x-per-page"])),i.headers["x-total"]&&(i.total=Number(i.headers["x-total"]))),Z(i.data)&&(i.data=[]),i}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}async markRead(t){await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/mark_read"),{})}async batchMarkRead(){await ibiz.net.post("".concat(this.baseUrl,"/mark_all_read"),{})}async getUnreadNum(){const t=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),{page:0,size:1,sort:"timestamp,desc",searchconds:[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]});return t.headers["x-total"]?Number(t.headers["x-total"]):0}}),vo=t("MarkOpenDataService",class{constructor(){this.callbackMap=new Map,this.baseUrl="/portal/markopendata",ibiz.mc.command.markOpenData.on((t=>{const e=t.data,{entity:i,key:a}=e,n="".concat(i,"_").concat(a);this.callbackMap.has(n)&&this.callbackMap.get(n).forEach((t=>t(e)))}))}async action(t,e,i){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i))}async send(t,e,i,a){return await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i),a)}subscribe(t,e,i){const a="".concat(t,"_").concat(e),n=this.callbackMap.get(a)||[];n.push(i),this.callbackMap.set(a,n)}unsubscribe(t,e,i){const a="".concat(t,"_").concat(e),n=this.callbackMap.get(a)||[],s=n.indexOf(i);s>-1&&(n.splice(s,1),this.callbackMap.set(a,n))}}),Io=t("UtilService",class{constructor(t){this.appUtil=t,this.stoageAppDataEntity=null,this.appDEService=null}async getAppDEService(t){if(this.appDEService)return this.appDEService;const{appId:e,name:i,stoageAppDataEntityId:a}=this.appUtil;if(e&&a){const n=ibiz.hub.getApp(e);this.stoageAppDataEntity=await ibiz.hub.getAppDataEntity(a,e);const s=await n.deService.getService(t,a);if(s)return this.appDEService=s,s;throw new Error(ibiz.i18n.t("runtime.service.noFoundStorageEntity",{name:i,stoageAppDataEntityId:a}))}throw new Error(ibiz.i18n.t("runtime.service.noExist",{name:i}))}async load(t,e,i){const a=e.clone(),n=await this.getAppDEService(a);a[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{getAppDEActionId:s}=this.appUtil;try{const t=await n.exec(s||"get",a,i);return this.handleResponse(t)}catch(t){return{}}}async save(t,e,i,a){const n=await this.getAppDEService(e),{context:s,params:o,data:r}=this.handleRequestData(t,e,i,a);return n.exec("save",s,r,o)}handleRequestData(t,e,i,a){const{modelIdAppDEFieldId:n,modelAppDEFieldId:s,appIdAppDEFieldId:o,userIdAppDEFieldId:r,stoageAppDataEntityId:c}=this.appUtil;if(!this.stoageAppDataEntity)throw new Error(ibiz.i18n.t("runtime.service.noFoundEntity",{stoageAppDataEntityId:c}));const d=e.clone(),l={};d[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{keyAppDEFieldId:h}=this.stoageAppDataEntity;return l[h]=t,l[n]=null==i?void 0:i.modelId,l[s]=JSON.stringify(a),l[o]=d.srfappid,l[r]=d.srfpersonid,l.type=null==i?void 0:i.type,l.owner_type=null==i?void 0:i.ownerType,l.owner_id=null==i?void 0:i.ownerId,{context:d,params:i,data:l}}handleResponse(t){const{data:e}=t,{modelAppDEFieldId:i}=this.appUtil;return JSON.parse(e[i])}}),bo=t("TreeNodeData",class{constructor(t,e,i){this._uuid=ht(),this._leaf=!1,this._leaf=!0===i.leaf,this._parent=e,this._nodeType=t.treeNodeType,this._disableSelect=!0===t.disableSelect,this._changedOnly=!0===t.enableRowEditChangedOnly,this._parent&&(this._context={...this._parent._context}),i.navContext&&(this._context=Object.assign(this._context||{},i.navContext)),i.navParams&&(this._params={...i.navParams}),this._nodeId=t.id,Object.defineProperty(this,"srfnodeid",{get(){return this._id},enumerable:!0,configurable:!0})}calcIcon(t){const{sysImage:e}=t,i={};return e&&(e.cssClass&&(i.cssClass=e.cssClass),e.imagePath&&(i.imagePath=e.imagePath),e.rawContent&&(m(e.rawContent)?i.imagePath=e.rawContent:i.htmlStr=e.rawContent)),Object.values(i).length>0?i:void 0}getDiffData(){if(this._deData&&this._oldDeData){const t={};return Object.keys(this._deData).forEach((e=>{this._deData[e]===this._oldDeData[e]&&e!==this._deData.srfkeyfield||(t[e]=this._deData[e])})),t.srfkey=this._deData.srfkey,t}return this._deData}}),Do=t("TreeCodeListNodeData",class extends bo{constructor(t,e,i){super(t,e,i);const{data:a}=i;this._text=a.text,this._value=a.value;const n="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(n):n},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=Ae(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),Co=["_id","srfnodeid","_value","_text","_deData","clone"],Ao=t("TreeDataSetNodeData",class t extends bo{constructor(e,i,a){var n,s;super(e,i,a);const{data:o}=a;this._deData=o,this._oldDeData=o.clone();const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=Ae(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId?this._leaf=Ws(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!Ws(o[e.childCntAppDEFieldId]));const c=new Map,d=new Map;null==(n=e.detreeNodeDataItems)||n.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),i=t.appDEFieldId.toLowerCase();c.set(e,i),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(s=e.detreeNodeColumns)||s.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,i=t.dataItemName;e&&i?l.set(e,i):ibiz.log.error(ibiz.i18n.t("runtime.service.missingDetreeColumnId"),t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const i=it(this._deData),a=new t(e,this._parent,{data:i,leaf:this._leaf,navContext:this._context,navParams:this._params});return Object.keys(this).forEach((t=>{const e=u(t);Z(e)&&!Co.includes(t)&&(a[t]=this[t])})),a},new Proxy(this,{set(t,e,i){const a=u(e);return Z(a)?t[e]=i:t._deData[a]=i,!0},get(t,e,i){const a=u(e);return Z(a)?t[e]:Z(t._deData[a])?(n=e,l.has(n)?d.get(l.get(n)):d.has(n)?d.get(n):void 0):t._deData[a];var n},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return g(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:i,detreeNodeDataItems:a}=t;if(i&&this._deData[i]){const t=this._deData[i];-1!==t.indexOf("fa-")?e.cssClass=t:e.imagePath=t}e&&(this._icon=e);const n=null==a?void 0:a.find((t=>"icon"===t.id));return n&&(e.htmlStr=this.calcDataItemScript(n)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return ei.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:i}=t,a=null==i?void 0:i.find((t=>"text"===t.id));return a&&(e=this.calcDataItemScript(a)),e}}),Po=t("TreeStaticNodeData",class extends bo{constructor(t,e,i){var a,n;super(t,e,i);const s="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=s,e&&i.parentValueLevel){let t=e;for(let e=1;e<i.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=s||(null==t?void 0:t._value)}this.srfkey=(null==(a=this._deData)?void 0:a.srfkey)||this._value,this.srfmajortext=(null==(n=this._deData)?void 0:n.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),To=t("UIMapField",class{constructor(t,e,i={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,Z(i.isOriginField)||(this.isOriginField=i.isOriginField),Z(i.dataType)||(this.dataType=i.dataType)}convertVal(t){if(!this.dataType)return t;if(u.isNumber(this.dataType)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),No=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var So=["REGION","REGION2","REGION3","REGION4"],xo=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:i,itemStyle:a,longitudeAppDEFieldId:n,latitudeAppDEFieldId:s,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=i+t.srfkey,this._itemStyle=a,this._mapItemId=i,So.includes(this._itemStyle)?n&&l.set("_areaCode",n):(n&&l.set("_longitude",n),s&&l.set("_latitude",s)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:l.has(i)?t[l.get(i)]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:l.has(i)?t[l.get(i)]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,i),i}})}});var Lo=t("PanelData",class{constructor(t,e){const i=new ut,a={},n={};return t.forEach((t=>{var e;a[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(n[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,s,o)=>(Object.prototype.hasOwnProperty.call(a,s)?a[s]?e[a[s]]=o:t[s]=o:e[s]=o,i.emit("change",s),a[s]&&a[s]!==s&&i.emit("change",a[s]),n[s]&&n[s]!==s&&i.emit("change",n[s]),!0),get:(t,n,s)=>"_evt"===n?i:a[n]?e[a[n]]:Object.prototype.hasOwnProperty.call(e,n)?e[n]:t[n],ownKeys(t){const i=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,i),i}})}destroy(){this._evt.reset()}});var Mo=t("ChartData",class{constructor(t,e,i,a){return this._seriesModelId=null==e?void 0:e.id,this._catalog=i,this._groupName=a,this._uuid=ht(),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,i),i}})}}),Ro=(t,e,i={})=>{let a="";if(!t||!e.detreeNodeDataItems)return a;const n=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return n&&n.appDEFieldId&&(a=i[n.appDEFieldId.toLowerCase()]),a},Oo=t("GanttStaticNodeData",class extends Po{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=Ro(t.sndataItemName,e),this._beginDataItemValue=Ro(t.beginDataItemName,e),this._endDataItemValue=Ro(t.endDataItemName,e),this._prevDataItemValue=Ro(t.prevDataItemName,e),this._finishDataItemValue=Ro(t.finishDataItemName,e),this._totalDataItemValue=Ro(t.totalDataItemName,e)}}),_o=t("GanttDataSetNodeData",class extends Ao{constructor(t,e,i,a){super(e,i,a);const{data:n}=a;this._snDataItemValue=Ro(t.sndataItemName,e,n),this._beginDataItemValue=Ro(t.beginDataItemName,e,n),this._endDataItemValue=Ro(t.endDataItemName,e,n),this._prevDataItemValue=Ro(t.prevDataItemName,e,n),this._finishDataItemValue=Ro(t.finishDataItemName,e,n),this._totalDataItemValue=Ro(t.totalDataItemName,e,n)}}),Fo=t("GanttCodeListNodeData",class extends Do{constructor(t,e,i,a){super(e,i,a);const{data:n}=a;this._snDataItemValue=Ro(t.sndataItemName,e,n),this._beginDataItemValue=Ro(t.beginDataItemName,e,n),this._endDataItemValue=Ro(t.endDataItemName,e,n),this._prevDataItemValue=Ro(t.prevDataItemName,e,n),this._finishDataItemValue=Ro(t.finishDataItemName,e,n),this._totalDataItemValue=Ro(t.totalDataItemName,e,n)}}),zo=t("MqttService",class{constructor(t,e,i){this.mqttTopic=t,this.token=e,this.appId=i,this.evt=new ut,this.options={connectTimeout:6e3,clientId:ht(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),i=t.default?t.default:t,{location:a}=window;this.client=i.connect("ws://".concat(a.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),Vo=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,i){const a=e.srfsessionid||"applocation";this.cache.has(a)||this.cache.set(a,new Map);const n=this.cache.get(a);if(!n.has(i)){const e=await ibiz.hub.getAppDataEntity(i,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:i}));const s=t.constructorCache.get(i.toUpperCase());let r;r=s?await s(a,e):new to(a,e),n.set(i,r)}return n.get(i)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,i=[]){if(!0===i.includes(e))return;i.push(e);const a=t.srfsessionid;if(!this.cache.has(a))return;const n=this.cache.get(a).get(e);n&&n.local.clear();const s=ibiz.uiDomainManager.get(t.srfsessionid);if(s){s.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,i)}))}}async exec(t,e,i,a,s,o){const r=await this.getService(i,t);try{return await r.exec(e,i,a,s,o)}catch(t){throw t instanceof n&&(t.tag=i.srfviewid),t}}};Vo.constructorCache=new Map;var ko=t("DEServiceUtil",Vo),Uo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},n={}){const s=it(e);s.srfsimple&&delete s.srfsimple;const r=await ibiz.hub.config.view.get(t);if(!r)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t}));if((s.srfkey||0===i.srfuf)&&r.appDataEntityId){const t=Ae(r.appDataEntityId);s.srfkey&&(s[t]=s.srfkey,s.srfkey=void 0),0===i.srfuf&&(s[t]=void 0,delete i.srfuf)}if(r.redirectView){return Ke(await ibiz.hub.getAppView(t),s,i,n)}const{openMode:c="INDEXVIEWTAB"}=r,d=n.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&s.toRouteDepth&&(s.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return n.noWaitRoute?(this.openIndexViewTab(r,s,i),{ok:!0}):this.openIndexViewTab(r,s,i,n);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,s,i);case"POPUP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopup"));case"POPUPMODAL":return this.openModal(r,s,i);case"POPUPAPP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopupapp"));case"POPOVER":return this.openPopover(r,s,i,n);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,s,i);case"USER":return this.openUserCustom(r,s,i);default:return this.openIndexViewTab(r,s,i)}}openIndexViewTab(t,e,i={},a={}){return ibiz.openView.root(t.id,e,i,a)}openIndexViewTabByModal(t,e,i={}){return ibiz.openView.rootByModal(t.id,e,i)}async openModal(t,e,i={}){return ibiz.openView.modal(t.id,e,i)}async openPopover(t,e,i={},a={}){const{event:n,modalOption:s}=a;if(!n)throw new o(ibiz.i18n.t("runtime.command.app.missingEvent"));return ibiz.openView.popover(t.id,n,e,i,{...s})}async openDrawer(t,e,i={}){return ibiz.openView.drawer(t.id,e,i)}async openUserCustom(t,e,i={}){return ibiz.openView.custom(t.id,e,i)}};Uo.TAG="ibiz.app-view.open";var Bo=t("OpenAppViewCommand",Uo),Wo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},n={}){const s=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!s)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationFunction",{appFuncId:t}));const{navigateContexts:r,navigateParams:c,appFuncType:d}=s,l=e.clone();Object.assign(l,he(r,i,e));const h=he(c,i,e);switch(Object.assign(h,i),d){case"APPVIEW":return this.openAppView(s,l,h,n);case"OPENHTMLPAGE":return this.openHtmlPage(s);case"PDTAPPFUNC":return this.openPdAppFunc(s,l,h);case"JAVASCRIPT":return this.executeJavaScript(s,l,h);case"CUSTOM":return this.custom(s,l,h);default:throw new a(s,ibiz.i18n.t("runtime.command.app.noFindApplicationFunctionYype",{appFuncType:d}))}}async openAppView(t,e,i,a){if(!t.appViewId)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t.appViewId}));return ibiz.commands.execute(Bo.TAG,t.appViewId,e,i,a)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,i){throw ibiz.log.warn("openPdAppFunc",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}executeJavaScript(t,e,i){throw ibiz.log.warn("executeJavaScript",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}custom(t,e,i){throw ibiz.log.warn("custom",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}};Wo.TAG="ibiz.app-func.exec";var Go=t("AppFuncCommand",Wo);function jo(){new Go,new Bo}var Ko=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(this.appId)}),this.configCache=new Xs(this.appId,"PSSysApp",t.codeName),this.deService=new ko(t),this.codeList=new Hs(t),this.authority=new oo(t)}get appId(){return this.model.appId||ibiz.env.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}getAppUtil(t,e="DEFAULT"){const i=this.model.appUtils||[];let a;return a="CUSTOM"===e?i.find((e=>e.utilTag===t)):i.find((e=>e.id===t)),a}async getUIAction(t){const[,e]=t.split("@");if(e){const i=(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUIActions.find((e=>e.id===t));if(i)return i}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var i,a;let n=null==(i=this.model.deopprivs)?void 0:i.find((e=>e.name===t));if(!n&&e){n=null==(a=(await ibiz.hub.getAppDataEntity(e,this.appId)).deopprivs)?void 0:a.find((e=>e.name===t))}return n}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new zo(ibiz.appData.mqtttopic,y(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),Ho=class{parse(t){return t}},Xo=class{constructor(){this.appMenu=new Ho}},qo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}getCustomOption(t){var e;const{appViewParams:i,userParam:a}=t;let n=null==(e=null==i?void 0:i.find((t=>"modaloption"===t.id)))?void 0:e.value;!n&&a&&(n=a.modalOption);let s={};if(n)try{s=JSON.parse(n)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.hub.failedParse",{error:t}))}return{modalOption:s}}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const i=this.calcAppViewId(t);this.viewConfigs.set(i,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView,...this.getCustomOption(t)})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Yo=class{constructor(){this.view=new qo}},Qo=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Qo||{})),$o=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))($o||{})),Jo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Jo||{})),Zo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(Zo||{})),tr=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o(ibiz.i18n.t("runtime.controller.utils.counter.decrement"));this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),er=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new tr(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),ir=t("CTXState",class{}),ar=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new ut(3e3),this.controllersMap=new Map,this.state=new ir}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),nr=t("ActivityCounter",class extends tr{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),sr=t("UIActionButtonState",class{constructor(t,e,i){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=i,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await xe(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:i,actionTarget:a,uiactionMode:n,uiactionTag:s}=t;this.dataAccessAction=e,this.actionTarget=a,1===i?this.noPermissionHidden=!1:6===i&&(this.visible=!1),[2,6].includes(i)&&this.dataAccessAction&&(this.visible=!1),(a&&"NONE"!==a||"SYS"===n&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(s))&&(this.noDataDisabled=!0,"SINGLEKEY"!==a&&"MULTIKEY"!==a||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e,i){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.actionTarget&&"NONE"===this.actionTarget?this.permitted=await a.authority.calcByNoDataAccessAction(this.dataAccessAction,t,i):(this.appDeName&&i&&!i.includes(this.appDeName)&&ibiz.log.warn(ibiz.i18n.t("runtime.controller.utils.buttonState.isFinitenconsistency",{uiActionId:this.uiActionId,appDeName:this.appDeName,appDeId:i})),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e,i))}async update(t,e,i){this.isInit||await this.init(),await this.calcPermission(t,e,i),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!e||this.noKeyDisabled&&!e.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),or=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e,i){await Promise.all(this.children.map((a=>a.update(t,e,i))))}async init(){await Promise.all(this.children.map((t=>t.init())))}}),rr=t("QXEventEx",class extends ut{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((i=>{i(t,...e)}))}async asyncEmit(t,...e){const i=super.asyncEmit(t,...e),a=this.anyEventFns.map((i=>i(t,...e))),n=Promise.all(a),s=await i,o=await n;return s.concat(...o)}reset(){super.reset(),Et(this.anyEventFns)}}),cr=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new rr}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function dr(t){return window.location.hash.split("/").length>2*t+2}function lr(t,e){return(!Z(t)&&""!==t||!Z(e)&&""!==e)&&t!==e}function hr(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof io&&(e=e.getOrigin()),e}function ur(t,e,i){const a=[];return t.forEach((t=>{const{valueRuleType:n}=t,s=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===n&&s)"REG"===s.ruleType||"REGEX"===s.ruleType?a.push({pattern:new RegExp(s.regExCode),message:s.ruleInfo,trigger:"change blur"}):"SCRIPT"===s.ruleType&&a.push({validator:(t,e,i,a)=>{if(!e)return!0;try{ei.execScriptFn({rule:t,value:e,callback:i,source:a},s.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===n&&r){const t=i||e;a.push({validator:(e,i,a,n)=>{if(dt(n[t]))return!0;const{isPast:s,infoMessage:c}=ii(t,n,r.groupCond);return s||a(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),a}function pr(t){const e=[],{maxLength:i,minLength:a}=t,{maxValue:n,minValue:s}=t;return i&&e.push({validator:(t,e,a)=>{if(Z(e)||!(e.length>i))return!0;a(new Error(ibiz.i18n.t("runtime.controller.utils.valueRule.length",{maxLength:i,length:e.length})))}}),a&&e.push({validator:(t,e,i)=>{if(Z(e)||!(e.length<a))return!0;i(new Error("内容长度必须大于等于".concat(a,",当前长度为").concat(e.length)))}}),Z(n)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e>n))return!0;i(new Error("值必须小于等于".concat(n)))}}),Z(s)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e<s))return!0;i(new Error("值必须大于等于".concat(s)))}}),e}var mr=t("ValueExUtil",class{static mergeDefault(t){return st(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(Z(e)||""===e)return"";const{valueType:i,objectNameField:a,textSeparator:n}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(i)){if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.valueEx.objectNameField"));const t=a.toLowerCase();return"OBJECTS"===i?e.map((e=>e[t]||"---")).join(n):e[t]}return"SIMPLES"===i?e.join(n):"".concat(e)}});function gr(t,e){var i;const{name:n,valueType:s,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(Z(s)&&Z(r))return;if("RESET"===s)return null;const u=d[n];if(!ot(u)){if(!s&&r)return r;switch(s){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return Ct().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new o(ibiz.i18n.t("runtime.controller.utils.valueDefault.noExist"));return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return ht();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:s}))}}}var fr="asyncimportdata2",yr="importdata2";async function wr(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")});const n=new FormData;n.append("file",t);let s="/".concat(e.deapicodeName2,"/").concat(fr);if((null==i?void 0:i.codeName)&&(s+="?srfimporttag=".concat(i.codeName)),a){s=Us(a,e)+s}const o=await ibiz.net.request(s,{method:"post",data:n,headers:{"Content-Type":"multipart/form-data"}});var r;await(r=o.data.asyncacitonid,new Promise((t=>{const e=i=>{const a=i.messageid||i.data.asyncacitonid;if(r!==a)return;const n=i.data.actionstate;30!==n&&40!==n||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT")}async function Er(t,e,i,a){const n=new FormData;n.append("file",t);let s="/".concat(e.deapicodeName2,"/").concat(yr);if((null==i?void 0:i.codeName)&&(s+="?srfimporttag=".concat(i.codeName)),a){s=Us(a,e)+s}const o={isAsync:!1};try{const t=await ibiz.net.request(s,{method:"post",data:n,headers:{"Content-Type":"multipart/form-data"}});ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT"),Object.assign(o,t.data)}catch(t){t instanceof Error&&(o.errorMessage=t.message)}return o}async function vr(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)wr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await Er(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function Ir(t,e,i){if(!ibiz.util.getExcelUtil)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.noExist"));const a=await ibiz.util.getExcelUtil();if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.loadError"));try{return a.exportJsonToExcel({header:t,data:e,filename:i,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function br(t){var e;const i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),a=null==(e=i.appDEDataImports)?void 0:e.find((e=>e.id===t.deDataImportId));if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.importData"));return{deDataImport:a,appDataEntity:i}}async function Dr(t){const{deDataImportId:e,appDataEntityId:i,context:a,params:n}=t,s=t.dataImportViewId||"AppDataUploadView";let o=null;try{o=await ibiz.hub.config.view.get(s)}catch(e){if(t.dataImportViewId)throw e}if(o)return a.srfappdataentityid=i,a.srfdedataimportid=e,ibiz.commands.execute(Bo.TAG,o.id,a,n,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await br({deDataImportId:e,appDataEntityId:i,appId:a.srfappid}),d=r.enableCustomized?"DataImport2":"DataImport",l=ibiz.overlay.createModal(d,{dismiss:()=>l.dismiss(),dataImport:r,appDataEntity:c,context:a,params:n},{width:"auto",placement:"center"});l.present(),await l.onWillDismiss()}async function Cr(t,e,i){let a="/".concat(t.codeName2.toLowerCase(),"/importtemplate");if((null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName)),i){a=Us(i,t)+a}const n=await ibiz.net.request(a,{responseType:"blob"});if(200===n.status){const t=ibiz.util.file.getFileName(n),e=new Blob([n.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}async function Ar(t){return new Promise((e=>{E({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await vr({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Pr(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=Us(t.context,t.appDataEntity)+i}const a="".concat(i,"/asyncimportdata2"),n={srfossfileid:t.fileId,srfimportschemaid:t.schemaId},s=(null==(e=t.dataImport)?void 0:e.id)||t.appDataEntity.defaultAppDEDataImportId;s&&Object.assign(n,{srfimporttag:s}),await ibiz.net.request(a,{method:"get",params:n}),ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")})}function Tr(t){var e,i,a,n;let s={system_tag:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,data_entity_tag:null==(i=t.appDataEntity)?void 0:i.codeName,import_tag:(null==(a=t.dataImport)?void 0:a.id)||(null==(n=t.appDataEntity)?void 0:n.defaultAppDEDataImportId),owner_type:"PERSONAL"};return s=tt(s,t.data),s}async function Nr(t,e){const i=ibiz.hub.getApp(e.srfappid),a=await ibiz.hub.getAppDataEntity(t,e.srfappid);let n="/jsonschema/".concat(a.name);0===a.dynaSysMode&&ibiz.appData&&(n+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await i.net.get(n)).data}var Sr=t("VIEW_MSG_PREFIX","VIEW_MSG"),xr=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Sr,"_").concat(e)}async init(t){var e,i;const a=ibiz.hub.getApp(t.srfappid).model,n=null==(e=a.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!n)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.message",{msgGroupId:this.msgGroupId}));this.msgGroup=n;const s=n.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(i=a.appViewMsgs)||i.forEach((t=>{const e=s.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),s.splice(e,1))})),s.length)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound",{message:s.join(",")}))}getDeFieldName(t,e){var i,a;if(e)return null==(a=null==(i=Se(t,e))?void 0:i.name)?void 0:a.toLowerCase()}static async fetchDataSet(t,e,a){const{appDataEntityId:n,appDEDataSetId:s}=t;if(!s)throw new i(t,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfigured"));const o=await ibiz.hub.getApp(e.srfappid).deService.exec(n,s,e,a);return o.data.length?o.data:[]}getMsgRemoveModeStorage(t){return 1!==t.removeMode?null:localStorage.getItem(t.key)}setMsgRemoveModeStorage(t){1===t.removeMode&&localStorage.setItem(t.key,"1")}async calcViewMsgVisible(t,e,i,a){const{enableMode:n,dataAccessAction:s,appDataEntityId:o,appId:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===n&&s){const t=ibiz.hub.getApp(i.srfappid);return!!await t.authority.calcByDataAccessAction(s,i,e,o)}if("DELOGIC"===n&&o&&r&&c){const t=Te(c,await ibiz.hub.getAppDataEntity(o,r));if(t){return!!(await fn(t,i,e,a)).data}}if("SCRIPT"===n&&d){return!!ei.execScriptFn({data:e,context:i,params:a},d,{isAsync:!1,singleRowReturn:!0})}return!0}async calcViewMessages(t,e){const i=this.msgGroup.appViewMsgGroupDetails,a=[];return(null==i?void 0:i.length)&&await Promise.all(i.map((async i=>{const n=this.viewMsgMap.get(i.appViewMsgId);if(1===n.dynamicMode){const s=await this.calcDynaMsgs(i,t,e);await Promise.all(s.map((async i=>{i.visible=await this.calcViewMsgVisible(n,i.data||{},t,e)}))),a.push(...s)}else{const s=this.calcStaticMsg(i);s.visible=await this.calcViewMsgVisible(n,s.data||{},t,e),a.push(s)}}))),a.filter((t=>t.visible&&!this.getMsgRemoveModeStorage(t)))}calcStaticMsg(t){const{position:e}=t,i=this.viewMsgMap.get(t.appViewMsgId),{codeName:a,title:n,message:s,removeMode:o,position:r,messageType:c,layoutPanel:d,sysCss:l}=i,{userTag:h,userTag2:u,userTag3:p,userTag4:m}=i,g=e||r,f={key:"".concat(this.tag,"_").concat(a),title:n,message:s,position:g,messageType:c,removeMode:o,visible:!0,layoutPanel:d,sysCss:l,extraParams:{userTag:h,userTag2:u,userTag3:p,userTag4:m}};return f.data={env:f},f}async calcDynaMsgs(e,a,n){const s=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u,layoutPanel:p}=s;if(!o)throw new i(s,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));const m=await ibiz.hub.getAppDataEntity(o,a.srfappid),g={...n},f=this.getDeFieldName(m,r);f&&(g.sort="".concat(f,",asc"));const y=await t.fetchDataSet(s,a,g);if(!y.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),I=this.getDeFieldName(m,h),b=this.getDeFieldName(m,l),D=this.getDeFieldName(m,d);return y.map((t=>{const e={};v&&!Z(t[v])&&(e.position=t[v]),E&&!Z(t[E])&&(e.title=t[E]),I&&!Z(t[I])&&(e.message=t[I]),b&&!Z(t[b])&&(e.messageType=t[b]),D&&!Z(t[D])&&(e.removeMode=t[D]),Z(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=tt(w,e);return i.data={...t,env:i},i}))}}),Lr="__self",Mr=t("BaseController",class{constructor(t,e,i,a){this.model=t,this.params=i,this.ctx=a,this.id=ht(),this.state={},this.name="",this.evt=new cr(this.getEventArgs.bind(this)),this.mountCounter=new nr(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.state.context=e,this.preprocessModel(t),this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}get context(){return this.state.context}preprocessModel(t){}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Lr),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get(Lr)||this.mountCounter.attend(Lr)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),Rr=t("ViewController",class extends Mr{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),h.create({},e),i||{},new ar(a)),this.session={},this.modal=new vi({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new er,this.isCloseView=!1,a&&a.registerController(this.model.name,this),this.ctx.init(this),this.initEngines(),this.handleViewError=this.handleViewError.bind(this)}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewPause",{name:this.model.name,id:this.model.id}))}initEngines(){const t=ke(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn(ibiz.i18n.t("runtime.controller.common.view.noFoundViewEngine"),t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await qs.getCounterByRef(t,this.context,{...this.params});this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={},this.state.isClosing=!1,this.state.hasError=!1,this.state.isShortCut=!1}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ot(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await _n(t);this.providers[t.name]=e;const i=ze(this.model);i&&await Promise.all(i.map((async t=>{const e=await _n(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const a=Ve(this.model);a.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(a),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated()))),ibiz.mc.error.on(this.handleViewError)}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger(),await this.initShortCut()}async initShortCut(){const{model:t,context:e}=this,i=await ibiz.util.shortCut.calcShortCutKey({context:e,appViewId:t.id});this.state.isShortCut=ibiz.util.shortCut.isExist(i)}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewDestroy",{name:this.model.name,id:this.model.id})),ibiz.mc.error.off(this.handleViewError)}handleContextParams(){if(this.context.srfappid=this.model.appId||ibiz.env.appId,Z(this.context.srfsessionid)||et(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}this.context.srfviewid=this.id;const t=this.model.appViewNavContexts;let e={};ct(t)&&(e=he(t,this.params,this.context)),Object.assign(this.context,e),Object.prototype.hasOwnProperty.call(this.context,"srfreadonly")||Object.assign(this.context,{srfreadonly:!1});const i=this.model.appViewNavParams;let a={};ct(i)&&(a=he(i,this.params,this.context)),Object.assign(this.params,a),this.engines.forEach((t=>{t.handleContextParams()})),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let i;for(const a of this.engines)if(i=await a.call(t,e),void 0!==i)break;return i}async callUIAction(t,e){const i=this.call(t,e);if(void 0===i)throw new o(ibiz.i18n.t("runtime.controller.common.view.noSupportBehavior",{key:t}));return i}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t,codeName:e}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new xr(t,"".concat(e,"_").concat(this.modal.mode)),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){var e,i;const[a,...n]=t,s={title:a.title,desc:a.message,options:{showClose:0!==a.removeMode,showConfirmButton:0!==a.removeMode,customClass:(null==(e=a.sysCss)?void 0:e.cssName)||""}};if(a.layoutPanel&&s.options){const t=new v("view-message").m("alert");s.options.customClass="".concat(s.options.customClass||""," ").concat(t),s.options.message=()=>ibiz.render.renderCtrlShell(a.layoutPanel,this.context,this.params,{data:a.data})}a.extraParams.userTag&&Object.assign(s,{confirmButtonText:a.extraParams.userTag});try{"WARN"===a.messageType?await ibiz.modal.warning(s):"ERROR"===a.messageType?await ibiz.modal.error(s):await ibiz.modal.info(s)}finally{null==(i=this.viewMsgController)||i.setMsgRemoveModeStorage(a)}n.length&&this.alertViewMessage(n)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}handleViewError(t){const{type:e,data:i}=t;"ERROR"===e&&i instanceof n&&i.tag===this.id&&(this.error=i,this.state.hasError=!0)}}),Or=(t("AppDataUploadViewController",class extends Rr{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:n}=await br({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=n}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;Cr(t,e,this.context)}async selectAndImport(){const t=await Ar({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Pr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends Rr{}),t("WFStepTraceViewController",class extends Rr{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),i=null==(t=this.ctx.parent)?void 0:t.view;if(i&&i.model.appDataEntityId){const t=await e.deService.getService(i.context,i.model.appDataEntityId),a=Object.assign(this.context.clone(),this.params),n=await t.wf.getWFHistory(a);n.data&&(this.state.historyData=n.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.cssStyle){const t={};this.model.cssStyle.split(";").filter(Boolean).forEach((e=>{const[i,a]=e.split(":");i&&a&&(t[i.trim()]=a.trim()),Object.assign(this.style,t)}))}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,i){const{navigateContexts:a,navigateParams:n}=this.model;let s={};a&&t&&(s=he(a,t,i,e));const o=Object.assign(e.clone(),s);let r={};return n&&t&&(r=he(n,t,i,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return mr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(u.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),_r=(t("CodeListEditorController",class extends Or{async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await t.codeList.get(this.model.appCodeListId,e,a),i}throw new i(this.model,ibiz.i18n.t("runtime.controller.common.editor.editorNoConfigured",{editorType:this.model.editorType}))}}),t("ControlController",class extends Mr{constructor(t,e,i,a){if(super(t,h.create({},e),new I({},i),a),this.controlParams={},this.providers={},this.triggerKey="",this.awaitActiveCbs=new Map,this.delayCbs=new Map,this.registerToCtx(),this.controlPanel=Ee(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=it(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await _n(this.controlPanel);this.providers[this.controlPanel.name]=t}if(this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)})),this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);this.triggerKey="".concat(this.view.name,"@").concat(t,"@").concat(this.model.controlType,"@").concat(this.model.codeName)}this.onDEDataChange=this.onDEDataChange.bind(this),ibiz.mc.command.change.on(this.onDEDataChange)}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){ibiz.mc.command.change.off(this.onDEDataChange),await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:i}=this.model;let a={};ct(e)&&(a=he(e,this.params,this.context)),Object.assign(this.context,a);let n={};ct(i)&&(n=he(i,this.params,this.context)),Object.assign(this.params,n)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,this.awaitActiveCbs.size>0&&this.awaitActiveCbs.forEach((t=>{t()})),this.awaitActiveCbs.clear(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentPause",{name:this.model.name,id:this.model.id}))}handlerAbilityParams(t){const e=this.context.clone(),i={...this.params};let a=this.getData()||[];return(null==t?void 0:t.data)&&(a=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(i,t.viewParam),{context:e,params:i,data:a}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};ct(t)&&(e=he(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}findCtrlMsgByTag(t){let e;const{ctrlMsg:i}=this.model;return i&&i.ctrlMsgItems&&(e=i.ctrlMsgItems.find((e=>e.name===t))),e}actionNotification(t,e){let i,a="";if(this.findCtrlMsgByTag("".concat(t,"_HIDDEN")))return;const o=this.findCtrlMsgByTag(t);if(o&&o.content){i=Z(o.timeout)?void 0:o.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ei.execScriptFn(t,"`".concat(o.content,"`"),{isAsync:!1,singleRowReturn:!0})}if(!a&&ibiz.i18n){const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();a=ibiz.i18n.t(e,""),a===e&&(a="")}if(!a&&(null==e?void 0:e.default)&&(a=e.default),!a&&(null==e?void 0:e.error)&&(a=a||e.error.message),a){if(null==e?void 0:e.error){if(e.error instanceof n&&500!==e.error.status)throw e.error;throw ibiz.log.error(e.error),new s(a,i)}ibiz.message.success(a,i,0===i)}}onDEDataChange(t){ibiz.log.debug("onDEDataChange",t)}emitDEDataChange(t,e){const i=e instanceof io?e.$origin:e,a={triggerKey:this.triggerKey};switch(t){case"create":ibiz.mc.command.create.send(i,a);break;case"update":ibiz.mc.command.update.send(i,a);break;case"remove":ibiz.mc.command.remove.send(i,a);break;default:throw new o(ibiz.i18n.t("runtime.controller.common.control.unsupportedType",{type:t}))}}doNextActive(t,e){if(Z(e.delay)&&(e.delay=300),!1===this.state.activated)this.awaitActiveCbs.set(e.key,t);else if(e.delay){const i=this.delayCbs.get(e.key);clearTimeout(i);const a=setTimeout((()=>{t(),clearTimeout(this.delayCbs.get(e.key))}),e.delay);this.delayCbs.set(e.key,a)}else t()}})),Fr=t("MDControlController",class extends _r{constructor(){super(...arguments),this.isSetSort=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[]}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)})),this.isSetSort||this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const i=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:i,sortQuery:a,noSort:n}=this.state,s={...this.params};return i&&(s.page=e-1,s.size=i),!n&&a&&(s.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(s,{...this.state.searchParams}),t&&Object.assign(s,t),s}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,i=!0===t.isLoadMore;e?this.state.curPage=1:i&&(this.state.curPage+=1);const{context:a}=this.handlerAbilityParams(t),n=await this.getFetchParams(null==t?void 0:t.viewParam),s=await this.service.fetch(a,n);"number"==typeof s.total&&(this.state.total=s.total),"number"==typeof s.totalPages&&(this.state.totalPages=s.totalPages),i?this.state.items.push(...s.data):this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let n=!1;try{await Si(a.map((async t=>{n=await this.handleItemRemove(t,e,i),this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.control.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(e){throw await this._evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0),a.forEach((t=>{this.emitDEDataChange("remove",t)}))}async handleItemRemove(t,e,i){let a=!1;const n=Ae(this.model.appDataEntityId);if(0!==t.srfuf){const s=e.clone();s[n]=t.srfkey,await this.service.remove(s,i),a=!0}return a}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,i;const{selectedData:a}=this.state;b(a,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const n=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(n,this.model.appDataEntityId),null==(i=this.quickToolbarController)||i.calcButtonState(n,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.srfkey!==t.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){const{appDataEntityId:t,dedataImportId:e}=this.model;if(!t||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));await Dr({appDataEntityId:t,deDataImportId:e,context:this.context,params:this.params})}async exportData(t){}onDEDataChange(t){if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if(!t.data||t.data.srfdecodename!==this.dataEntity.codeName)return;let e=!1;const{srfkey:i}=t.data;switch(t.subtype){case"OBJECTCREATED":e=!0;break;case"OBJECTUPDATED":case"OBJECTREMOVED":-1!==this.state.items.findIndex((t=>t.srfkey===i))&&(e=!0)}e&&this.doNextActive((()=>this.load({isInitialLoad:!!ibiz.env.isMob})),{key:"refresh"})}}),zr=t("CustomAppMenuController",class{constructor(t,e){this.model=t,this.menu=e,this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init()}init(){var t;this.type="personal",this.ownerId=this.context.srfpersonid;const e=ibiz.hub.getApp(this.context.srfappid).getAppUtil("DYNAMENU","CUSTOM");e?this.util=new Io(e):this.config=new Xs(this.model.appId,"menu","menu_".concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase()))}getResourceTag(){var t;const e="".concat(this.context.srfappid,"_menu_").concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase());switch(this.type){case"personal":return"".concat(e,"_").concat(this.context.srfpersonid);case"data":return"".concat(e,"_").concat(this.ownerType,"_").concat(this.ownerId);default:return e}}async loadCustomModelData(){let t;if(t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t&&t.model){return JSON.parse(t.model)}return[]}async resetCustomModelData(){return this.saveCustomModelData([])}async saveCustomModelData(t,e={}){const i={model:JSON.stringify(t)};return this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},i):await this.config.save(i),t}}),Vr=t("AppMenuController",class extends _r{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.customController=null,this.saveConfigs=[],this.flattenAllItems(),t.enableCustomized&&(this.customController=new zr(t,this))}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)})),this.customController&&await this.loadCustomMenusModel()}async loadCustomMenusModel(){const t=await this.customController.loadCustomModelData();t&&0!==t.length?this.saveConfigs=t:this.saveConfigs=[]}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ds(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,n={}){const s=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));this.evt.emit("onClick",{eventArg:t,event:e});const r=this.itemProviders[t];if(r&&r.onClick)return r.onClick(s,e,this);if(!s.appFuncId)throw new i(s,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const c=this.context.clone();c.srfappid=s.appId||ibiz.env.appId,this.routeDepth&&a&&Object.assign(c,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(Go.TAG,s.appFuncId,c,this.params,n)}initMenuItemState(t){var e;const i={permitted:!0,visible:!0};if(t.hidden)i.visible=!1;else{let a=!0;t.accessKey&&(a=this.app.authority.calcByResCode(t.accessKey));let n=a;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));n=n&&e.includes(!0)}i.permitted=a,i.visible=n}return this.state.menuItemsState[t.id]=i,i}flattenAllItems(){const t=[],e=i=>{i.forEach((i=>{t.push(i),i.appMenuItems&&i.appMenuItems.length>0&&e(i.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var i;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(i=e.appMenuItems)?void 0:i.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),kr=(t("AppMenuIconViewController",class extends Vr{async onClickMenuItem(t,e){const a=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new i(a,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const n=this.context.clone();1===this.routeDepth&&Object.assign(n,{toRouteDepth:1}),await ibiz.commands.execute(Go.TAG,a.appFuncId,n,this.params)}}),t("CalendarService",class extends no{async search(t,e={}){const{sysCalendarItems:i}=this.model;if(!i)return[];const a=i.map((async i=>{const a=i.appDEDataSetId||"fetchdefault",n=t.clone(),s=it(e);return i.maxSize&&(s.size=i.maxSize),this.exec2(a,n,s,void 0,i.appDataEntityId)}));return(await Promise.all(a)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:i}=this.model;if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));const a=i[e];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));return t.map((t=>new No(a,t)))}async exec2(t,e,i={},a={},n=this.model.appDataEntityId){return await this.app.deService.exec(n,t,e,i,a)}}));t("CalendarController",class extends Fr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new kr(this.model),await this.service.init(this.context),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){return this.openData(t),this._evt.emit("onActive",{data:[t]})}async openData(t){var e,a;const n=this.context.clone();n[((null==(e=t.deData.srfdecodename)?void 0:e.toLowerCase())||Ae(this.model.appDataEntityId)).toLowerCase()]=t.deData.srfkey;const s=await(null==(a=this.viewScheduler)?void 0:a.triggerCustom("".concat(t.itemType.toLowerCase(),"_opendata"),{context:n,params:this.params,data:[t.deData],event:void 0,view:this.view,ctrl:this}));if(-1===s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:t.itemType.toLowerCase()}));return{cancel:!s||s.ok}}async load(t={}){const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let n;await this.startLoading();try{n=await this.service.search(i,a)}finally{await this.endLoading()}return await this.afterLoad(t,n),this.state.isLoaded=!0,this.state.items=n,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),n}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const i=t.beginTime,a=e.beginTime;let n=0;return Ct(i).isAfter(a)?n=-1:Ct(i).isBefore(a)&&(n=1),n}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:i,srfenddate:a}=t;if(!i||!a){const t=new Date(e.getFullYear(),e.getMonth(),1),i=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:Ct(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:Ct(i).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:i,srfenddate:a}}async getFetchParams(t={}){const{curPage:e,size:i,sortQuery:a,noSort:n}=this.state,s={...this.params};if(!n&&a&&(s.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(s,{...this.state.searchParams}),i&&(s.page=e-1,s.size=i),t&&Object.assign(s,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(s);Object.assign(s,t)}return s}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});Ct.extend(St),Ct.extend(Lt),Ct.extend(Rt),Ct.extend(_t),Ct.extend(zt);var Ur="$default_group",Br=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:a,caption:n,id:s,userParam:o}=t;if(!t.catalogField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingClassification"));if(!t.valueField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingValue"));this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=a||{};this.xAxisIndex=R(r),this.yAxisIndex=R(c),this.seriesName=n||s,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=Qr(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,i=!1){if(Z(e))return;if(Z(t))return e;const a=this.chartGenerator.codeListMap.get(t);if(null==a?void 0:a.length){const t=a.find((t=>t.value===e));return t?t.text:"未定义"}return i?void 0:e}prepareChartData(t,e,i,a){var n;this.groupField&&(e["".concat(this.groupField,"_value")]=e[this.groupField],Object.assign(e,{[this.groupField]:a})),this.catalogField&&(e["".concat(this.catalogField,"_value")]=e[this.catalogField],Object.assign(e,{[this.catalogField]:i}));const s=new Mo(e,this.model,i,a);t[a].get(i).chartData=s,null==(n=this.chartDataArr)||n.push(s)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:i,catalogCodeListId:a}=this.model;return t.forEach((t=>{let n=Ur;if(this.groupField){const e=this.translateVal(i,t[this.groupField]);if(Z(e))return;n=e}if(!e[n]&&(e[n]=new Map,a&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(a).forEach((t=>{e[n].set(t.text,{value:0})}))}const s=this.translateVal(a,t[this.catalogField],!0);if(s)e[n].get(s)||e[n].set(s,{value:0}),e[n].get(s).value=M(e[n].get(s).value,t[this.valueField]||0),e[n].get(s).chartData?this.prepareChartData(e,{[this.valueField]:e[n].get(s).value},s,n):this.prepareChartData(e,t,s,n);else if(a&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(a).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,n)}))}})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const i=t[e],a=this.calcSeriesData(i);let n={...this.staticOptions,data:a};return e!==Ur&&(n.name=e),this.seriesUserParam&&(n=rt(n,this.seriesUserParam)),n}))}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push([i,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),i=this.calcGroupData(e);return this.addTimeData(i),this.calcGroupSeries(i)}getChartDataByParams(t){var e,i,a;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[Ur].get(t.name))?void 0:e.chartData:null==(a=null==(i=this.groupData)?void 0:i[t.seriesName].get(t.name))?void 0:a.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(it(t))}));const{groupMode:i}=this.model;return i&&e.forEach((t=>{let e="";if("DAY"===i||"YEAR"===i||"MONTH"===i){if("DAY"===i?e="YYYY-MM-DD":"YEAR"===i?e="YYYY":"MONTH"===i&&(e="YYYY-MM"),t[this.catalogField]){const i=Ct(t[this.catalogField]).format(e);t[this.catalogField]=i}}else if("QUARTER"===i){if(t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===i&&t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((i=>{const a=t[i];let n=[];"DAY"===e||"YEAR"===e||"MONTH"===e?n=Array.from(a.keys()).sort(((t,e)=>Ct(t).diff(Ct(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(n=Array.from(a.keys()).sort(((t,e)=>{const[i,a]=t.split("-"),[n,s]=e.split("-");return i!==n?parseInt(i,10)-parseInt(n,10):parseInt(a,10)-parseInt(s,10)})));const s=new Map;n.forEach((t=>{s.set(t,a.get(t))})),t[i]=s}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const i=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{i.push(Ct(e))}))}));const a=Ct.max(i),n=Ct.min(i);if("DAY"===e){let e=n;const i=a;for(;null==e?void 0:e.isSameOrBefore(i,"day");){const i=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=n.year();const i=a.year();for(;e<=i;){const i=e.toString();Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e+=1}}else if("MONTH"===e){let e=n.clone().startOf("month");const i=a.clone().startOf("month");for(;e.isSameOrBefore(i);){const i=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[n]=i.split("-"),[s]=a.split("-");for(let e=parseInt(n,10);e<=parseInt(s,10);e++)for(let i=1;i<=4;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[n]=i.split("-"),[s]=a.split("-");for(let e=parseInt(n,10);e<=parseInt(s,10);e++){const i=Ct("".concat(e,"-12-31")).isoWeek();for(let a=1;a<=i;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}}this.sortTimeData(t)}},Wr=class extends Br{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:a}=this.model;return a&&(t.step="middle"),t}},Gr=class extends Br{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},jr=class extends Br{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Kr=class extends Br{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Hr=class extends Br{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},Xr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const i=this.indicator[t];(!i||i.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},qr=class extends Br{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Xr(this.chartGenerator.radarMap.size));const i=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{i.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,i=this.chartGenerator.radarMap.get(this.catalogField),a=Object.keys(e).map((t=>{const a=e[t],n=i.indicatorKeys.map((t=>a.has(t)?a.get(t).value:0));return{name:t===Ur?this.seriesName:t,value:n}}));let n={...this.staticOptions,data:a};return this.seriesUserParam&&(n=rt(n,this.seriesUserParam)),n}},Yr=t=>{const e=/function\s*\(\s*|\s*function\s*\(\s*/,i={};return Object.keys(t).forEach((a=>{if(It(t[a])&&e.test(t[a])){const e="return ".concat(t[a]);i[a]=new Function(e)()}else bt(t[a])?i[a]=Yr(t[a]):i[a]=t[a]})),i};function Qr(t){const e={};return t&&Object.keys(t).forEach((i=>{const a=i.indexOf(".");if(-1===a)return;const n=i.slice(a+1);if(n)try{e[n]=JSON.parse(t[i])}catch(a){e[n]=t[i]}})),Yr(e)}var $r=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:i,chartXAxises:a,chartYAxises:n,userParam:s}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),i&&(this.staticOptions.legend=this.calcLegendOption(i)),(null==a?void 0:a.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(a)),(null==n?void 0:n.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(n)),s&&(this.chartUserParam=Qr(s))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Wr(t,this);break;case"bar":e=new Gr(t,this);break;case"scatter":e=new Hr(t,this);break;case"pie":e=new Kr(t,this);break;case"funnel":e=new jr(t,this);break;case"radar":e=new qr(t,this);break;default:ibiz.log.error(ibiz.i18n.t("runtime.controller.control.chart.noSupportSequence",{seriesType:t.seriesType}))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:i,subTitle:a,titlePos:n}=t,s={show:e,text:i,subtext:a,left:"center"},o=null==n?void 0:n.toLowerCase();return"left"===o||"right"===o?s.left=o:"bottom"!==o&&"top"!==o||(s.top=o),s}calcLegendOption(t){const{showLegend:e,legendPos:i}=t,a={};a.show=e;const n=null==i?void 0:i.toLowerCase();return"left"===n||"right"===n?(a.left=n,a.top="middle",a.orient="vertical"):"bottom"===n&&(a.top=n),a}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:i,dataShowMode:a,userParam:n}=t;let s={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:i,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===a?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===a&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===a?45:0}};n&&(s=rt(s,Qr(n))),e.push(s)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var i;if(this.codeListMap.clear(),!(null==(i=this.model.dechartSerieses)?void 0:i.length))return;const a=ibiz.hub.getApp(t.srfappid),n=async i=>{if(!i||this.codeListMap.has(i))return;const n=await a.codeList.get(i,t,e);this.codeListMap.set(i,n)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:i}=t;await n(e),await n(i)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((i=>{const a=e.length,n=i.calcByData(t);n instanceof Array?e.push(...n):e.push(n);const s=e.length-1;for(let t=a;t<=s;t++)this.seriesGeneratorIndexMap.set(t,i)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=rt(this.staticOptions,this.options),this.chartUserParam&&(this.options=rt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noFindSequence",{seriesIndex:t.seriesIndex}));return e.getChartDataByParams(t)}},Jr=t("ChartService",class extends no{}),Zr=(t("ChartController",class extends Fr{initState(){super.initState(),this.state.size=1e3,this.state.showGrid=!1,this.state.gridHeaders=[],this.state.gridData=[],this.state.gridPosition="bottom"}async onCreated(){await super.onCreated(),this.service=new Jr(this.model),await this.service.init(this.context),this.generator=new $r(this.model),await this.generator.init(this.context,this.params),this.parseGridParam(),this.resizeChart=this.resizeChart.bind(this),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const i=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),i}parseGridParam(){this.model.dechartDataGrid&&(this.model.dechartDataGrid.dataGridPos?this.state.gridPosition=this.model.dechartDataGrid.dataGridPos.toLocaleLowerCase():this.state.gridPosition="bottom",!0===this.model.dechartDataGrid.showDataGrid&&(this.state.showGrid=!0))}computeTotal(t){let e=0;return this.state.items.forEach((i=>{const a=Number(i[t]);Number.isNaN(a)||(e+=Number(a))})),e}handleSingleSerieGridData(){const t=this.generator.seriesGenerators[0],{catalogField:e,valueField:i,groupData:a}=t,n=t.chartGenerator.entity.appDEFields,s=n.find((t=>t.id===e)),o=n.find((t=>t.id===i)),r=[{id:e,name:null==s?void 0:s.logicName},{id:i,name:null==o?void 0:o.logicName},{id:"srfpercent",name:"百分比"}];this.state.gridHeaders=r;const c=[],d=this.computeTotal(i);if(a&&a.$default_group){const t=a.$default_group;for(const[a,n]of t){const t=Number.isNaN(Number(n.value))?0:Number(n.value);let s="";s=0===d||Number.isNaN(Number(n.value))?"0%":"".concat(Math.round(t/d*100),"%");const o={[e]:a,[i]:t,srfpercent:s};c.push(o)}}this.state.gridData=c}handleMultipleSerieGridData(){const t=[],e=[];this.generator.seriesGenerators.forEach((i=>{const{catalogField:a,valueField:n,groupData:s}=i,o=i.chartGenerator.entity.appDEFields;if(t.findIndex((t=>t.id===a))<0){const e=o.find((t=>t.id===a.toLowerCase()));t.push({id:a,name:null==e?void 0:e.logicName})}const r=o.find((t=>t.id===n.toLowerCase()));if(t.push({id:n,name:null==r?void 0:r.logicName}),s&&s.$default_group){const t=s.$default_group;for(const[i,s]of t){const t=Number.isNaN(Number(s.value))?0:Number(s.value),o=e.findIndex((t=>t[a]===i));if(o<0){const s={[a]:i,[n]:t};e.push(s)}else Object.assign(e[o],{[n]:t})}}})),this.state.gridHeaders=t,this.state.gridData=e}computeGridData(){this.generator&&this.generator.seriesGenerators&&(1===this.generator.seriesGenerators.length?this.handleSingleSerieGridData():this.handleMultipleSerieGridData())}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.state.showGrid&&this.computeGridData(),this.updateChart()}updateChart(){if(!this.chart)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noInitialised"));if(!this.options)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noCalculated"));this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends _r{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):""),this.setBrowserTabTitle()}))}setBrowserTabTitle(){"ROUTE"!==this.view.modal.mode&&"ROUTE_MODAL"!==this.view.modal.mode||ibiz.util.setBrowserTitle(this.state.caption)}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.session={},this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),tc=class{};function ec(t,e){const{srcDEUILogicParamId:i,srcFieldName:n,srcValue:s}=e,o=e.srcValueType||"SRCDLPARAM",r=n;let c;switch(o){case"SRCDLPARAM":c=t.params[i];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(s);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=it(ibiz.env);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:o}))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:r}),c),t}return c}var ic=class extends tc{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,n){const s=ec(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.currentConditionValue"));const t=null!=n[this.value]?n[this.value]:e[this.value];r=t,o=qe(s,this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.sourceDataObjectAttribute"));const e=ec(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});r=e,o=qe(s,this.op,e);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.currentTime"));default:r=this.value,o=qe(s,this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditionalTypeName",{name:this.model.name,type:this.type,dstField:this.dstField}),s,ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},ac=class t extends tc{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new ic(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let n="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditional"));for(let i=0;i<this.conds.length;i++){const s=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===s){n=!1;break}if("OR"===this.op&&!0===s){n=!0;break}}const s=this.notMode?!n:n;return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.connectionConditionGroup",{name:this.model.name,id:this.model.id}),s),s}},nc=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:i}=this.model;0===(e||0)&&i&&(this.groupCond=new ac(i))}async exec(t){const{linkMode:e}=this.model,{context:i,data:n}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,i,n&&n.length>0?n[0]:{});case 1:return!0;case 2:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousTermination"));case 3:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousRejection"));case 9:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.exceptionHandling"));default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.logicalLinkTypes",{linkMode:e}))}}},sc=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new nc(t)))}},oc=class extends sc{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:n,retDEUILogicParamId:s}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[n],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[s]=c.data,t.setLastReturn(t.params[s])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDEUILogicParamId:s}),t.params[s])}},rc=class extends sc{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a,dstAppDataEntityId:n}=this.model,{data:s,parameters:o}=t;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceBehavior"));let r=[s];if(a){const e=t.params[a];r=e instanceof Array?e:[e]}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityInterfaceAction",{id:this.model.id,dstAppDEUIActionId:e,dstAppDataEntityId:n,dstDEUILogicParamId:a})),await xc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},cc=class extends sc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},dc=class extends sc{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:i,returnParamId:n}=this.model;if(e){switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(i);break;case"LOGICPARAM":t.result=t.params[n];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.unsupportedEndNode",{returnType:e}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEndNode",{id:this.model.id,returnType:e}),t.result)}}},lc=class extends sc{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const i of e){let e;switch(i.dstDEUILogicParamId&&"DEBUG"===ibiz.env.logLevel&&(e=it(t.params[i.dstDEUILogicParamId])),i.paramAction){case"SETPARAMVALUE":await this.setParamValue(i,t);break;case"RESETPARAM":await this.resetParam(i,t);break;case"COPYPARAM":await this.copyParam(i,t);break;case"BINDPARAM":await this.bindParam(i,t);break;case"RENEWPARAM":await this.renewParam(i,t);break;case"APPENDPARAM":await this.appendParam(i,t);break;case"SORTPARAM":await this.sortParam(i,t);break;default:throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:i.paramAction}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodePreparationParameter",{id:this.model.id,paramAction:i.paramAction,dstDEUILogicParamId:i.dstDEUILogicParamId}),e,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[i.dstDEUILogicParamId])}}setParamValue(t,e){const{dstFieldName:i,dstDEUILogicParamId:a}=t;if(!a)throw new o(ibiz.i18n.t("runtime.uiLogic.noTargetParameter"));let n=i;e.isEntityParam(a)&&(n=null==n?void 0:n.toLowerCase());const s=ec(e,t);if(n)try{ei.execScriptFn({srcVal:s,dstParam:e.params[a]},"dstParam.".concat(i," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.targetParameter",{dstFieldName:i}),e.params[a]),t}else e.params[a]=s}copyParam(t,e){const{dstDEUILogicParamId:i}=t,a=ec(e,t);e.params[i]=it(a)}bindParam(t,e){const i=ec(e,t);e.params[t.dstDEUILogicParamId]=i}resetParam(t,e){const{dstDEUILogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDEUILogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDEUILogicParamId:i,dstIndex:a,srcIndex:n,srcSize:s}=t,o=ec(e,t),r=a||0,c=n||0,d=s||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:i,dstFieldName:a,dstSortDir:n}=t,s=a;e.params[i].sort(((t,e)=>"ASC"===n?t[s]-e[s]:e[s]-t[s]))}},hc=class extends sc{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:n}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceObject"));if(!n)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredOperatingParameters"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredCallMethod"));const s=t.params[n];if(!s)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundOperationParameter",{invokeParamId:n}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInterfaceObject",{invokeCtrlId:a}));if(!r[e]||!$(r[e]))throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInvokeMethod",{invokeMethod:e}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetInvocation",{id:this.model.id,invokeCtrlId:a,invokeMethod:e}),s),await r[e](s)}},uc=class extends sc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const n=ec(t,this.model);t.params[e]=n,t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.bindingParameters",{id:this.model.id,dstDEUILogicParamId:e}),n)}},pc=class extends sc{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:n,msgBoxParamId:s}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingMessageTypeConfiguration"));if(!n)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingButtonTypeConfiguration"));let{title:o,message:r}=this.model;if(s){const e=t.params[s];e.title&&(o=e.title),e.message&&(r=e.message)}const c=this.typeMap[e],d={type:c,title:o||ibiz.i18n.t("runtime.uiLogic.message"),desc:r};let l=[];switch(n){case"YESNO":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.yes"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.no"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["yes","no"];break;case"OK":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.noSupportItem",{name:n}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeMessagePopup",{id:this.model.id,type:c,message:r}));const h=await ibiz.modal.confirm(d);t.setLastReturn(l[h?0:1])}},mc=class extends sc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await is(this.model);e&&await e.exec(this.model,t)}},gc=class extends sc{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));const n=t.params[e];ibiz.log.info(ibiz.i18n.t("runtime.uiLogic.logicalNodeOperation",{name:a}),n)}},fc=class extends sc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeResetParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},yc=class extends sc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const n=ec(t,this.model);t.params[e]=it(n),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.copyParameter",{id:this.model.id,dstDEUILogicParamId:e}),n)}},wc=class extends sc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:n,srcIndex:s,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const r=ec(t,this.model),c=n||0,d=s||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.appendedArray",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},Ec=class extends sc{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:n}=this.model;if(!e||!n)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const s=n,o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[s]-e[s]:e[s]-t[s])),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeSortedArrayParameters",{id:this.model.id,dstFieldName:n,dstSortDir:a,dstDEUILogicParamId:e}),o)}},vc=class extends sc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeRebuildParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},Ic=class extends sc{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:n,retDEUILogicParamId:s}=this.model;if(!n)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingfilter"));const o=t.params[n],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(a,e,t.context,o);c.ok&&(t.params[s]=c.data,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDataSet",{id:this.model.id,dstAppDataEntityId:a,dstAppDEDataSetId:e,retDEUILogicParamId:s}),t.params[s])}},bc=class extends sc{async exec(t){const{errorInfo:e}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeThrowingExceptions",{id:this.model.id,errorInfo:e})),new o(e)}},Dc=class extends sc{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:n}=this.model;if(!n)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredTriggerObject"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEvent"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEventParameters"));const s=t.params[n];if(!s)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundTriggerObject",{fireCtrlId:n}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundEventParameterObject",{eventParamId:a}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetEventTriggerLogic",{id:this.model.id,fireCtrlId:n,eventName:e}),r),await s.evt.emit(e,r)}},Cc=class extends sc{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:n,retDEUILogicParamId:s}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityConfigured"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityLogicConfigured"));if(!n)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noIncomingLogic"));const r=t.params[n];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.passedParameter",{dstDEUILogicParamId:n}));const c=await gn(e,a,t.context,r,t.params);s&&(t.params[s]=c,t.setLastReturn(t.params[s])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeExecutingEntityLogic",{id:this.model.id,dstAppDELogicId:e,dstAppDataEntityId:a,retDEUILogicParamId:s}),c)}},Ac=class extends sc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDirectCode",{id:this.model.id}),this.model.code),ei.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Pc=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{parameters:a}=t,{context:n,params:s,data:o}=a,r=ibiz.hub.getApp(i.appId);if("layoutPanel"!==i.codeName){if(i.default)i.entityListParam?t.params[e]=o||[]:t.params[e]=o&&o.length>0?o[0]:{};else if(i.activeContainerParam)t.params[e]=a.ctrl||a.view;else if(i.activeCtrlParam)t.params[e]=a.ctrl;else if(i.ctrlParam){const n=a.view.getController(i.codeName.toLowerCase());n?t.params[e]=n:ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.viewLogicInitializationParameter",{codeName:i.codeName}))}else if(i.activeViewParam)t.params[e]=a.view;else if(i.appGlobalParam){let a=ibiz.util.getGlobalParam();i.paramFieldName&&(a.hasOwnProperty(i.paramFieldName)||(a[i.paramFieldName]={}),a=a[i.paramFieldName]),t.params[e]=a}else if(i.applicationParam)t.params[e]=r;else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]=[];else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.navContextParam)t.params[e]=n;else if(i.navViewParamParam)t.params[e]=ibiz.util.getRouterParams();else if(i.routeViewSessionParam){let n=a.view.getTopView().state;i.paramFieldName&&(n.hasOwnProperty(i.paramFieldName)||(n[i.paramFieldName]={}),n=n[i.paramFieldName]),t.params[e]=n}else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=s;else if(i.viewSessionParam){let n=a.view.state;i.paramFieldName&&(n.hasOwnProperty(i.paramFieldName)||(n[i.paramFieldName]={}),n=n[i.paramFieldName]),t.params[e]=n}else i.filterParam?t.params[e]={}:i.envParam?t.params[e]=ibiz.env:i.sessionParam&&(t.params[e]=t.session);ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.calculateInterfaceLogicParameters",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),t.params[e])}else t.params[e]=a.view.layoutPanel.panelItems}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.restablishInterfaceLogic",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),t.params[e])}},Tc=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.uiLogic.noLogicalNodesConfigured"));t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new cc(t);break;case"END":i=new dc(t);break;case"DEACTION":i=new oc(t);break;case"DEUIACTION":i=new rc(t);break;case"PREPAREJSPARAM":i=new lc(t);break;case"RESETPARAM":i=new fc(t);break;case"COPYPARAM":i=new yc(t);break;case"BINDPARAM":i=new uc(t);break;case"VIEWCTRLINVOKE":i=new hc(t);break;case"MSGBOX":i=new pc(t);break;case"DEBUGPARAM":i=new gc(t);break;case"APPENDPARAM":i=new wc(t);break;case"SORTPARAM":i=new Ec(t);break;case"RENEWPARAM":i=new vc(t);break;case"DEDATASET":i=new Ic(t);break;case"THROWEXCEPTION":i=new bc(t);break;case"VIEWCTRLFIREEVENT":i=new Dc(t);break;case"DELOGIC":i=new Cc(t);break;case"PFPLUGIN":i=new mc(t);break;case"RAWJSCODE":i=new Ac(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Pc(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new Zr(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(!a||!this.nodes.has(a))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(a);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:i}=t;for(let a=0;a<i.length;a++){const n=i[a];if(await n.exec(e)&&n.dstNode&&(await this.deepExec(n.dstNode,e),!0!==t.model.parallelOutput))break}}},Nc=new Map;async function Sc(t,e,i){const a=ibiz.hub.getApp(i.context.srfappid),n=await a.getDEUILogic(t,e);if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.interfaceLogic",{appDataEntityId:e,deUILogicId:t}));Nc.has(n)||Nc.set(n,new Tc(n)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:n.name}));const s=Nc.get(n),r=await s.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:n.name})),r}var xc=t("UIActionUtil",class{static async exec(t,e,i){const a=await xe(t,i);if(!a)throw new o(ibiz.i18n.t("runtime.uiAction.noFoundBehaviorModel",{actionId:t}));if("SINGLEDATA"===a.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await ts(a)).exec(a,e)}static async execAndResolved(t,e,i){var a,n;const s=await this.exec(t,e,i);if(s.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(s.refresh)switch(s.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(a=e.view.parentView)||a.callUIAction("Refresh");break;case 3:null==(n=e.view.getTopView())||n.callUIAction("Refresh")}(await xe(t,i)).asyncAction&&!s.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),Lc=t("UIActionProviderBase",class{async exec(t,e){const a={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{view:n}=e;t.closeEditView&&(n.state.isClosing=!0);const{appDEUILogicId:s,appDataEntityId:o,uilogicAttachMode:r}=t;if("REPLACE"===r){if(!s)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return await Sc(s,o,e),a}if(!await this.isConfirm(t,e))return this.returnError(a,n);const c=await this.execAction(t,e);if(Object.assign(a,c),!0===a.cancel)return this.returnError(a,n);if("AFTER"===t.uilogicAttachMode){if(!s)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));await Sc(s,o,this.mergeArgsByResult(e,a))}const d=this.mergeArgsByResult(e,a);if(t.closeEditView)this.doNextAction(t,d,t.appId);else{const e=await this.doNextAction(t,d,t.appId);if(e&&(Object.assign(a,e),!0===e.cancel))return this.returnError(a,n)}return a}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t,e){return e.state.isClosing=!1,Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const i=this.calcMessage("confirm",t,e);return!t.enableConfirm||!i||ibiz.confirm.warning({title:ibiz.i18n.t("runtime.uiAction.operationConfirmation"),desc:i})}async doNextAction(t,e,i){const a=t.nextId;if(a)return xc.exec(a,e,i)}async handleParams(t,e,i,a){let n=[];const s=Ae(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":n=[];break;case"SINGLEDATA":n=[i[0]];break;case"MULTIDATA":n=i;break;case"MULTIKEY":n=s&&i.length>0?i.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=i[0]||{};n=s?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(s&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:i}=t,a=i||s,n=e||"srfkey";c.unshift({key:a,value:n,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&i.length>0,l=he(c,d?me(c,i):i[0]||{},a,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:n,resultParams:he(h,d?me(h,i):i[0]||{},a,r)}}calcMessage(t,e,i){let a,n;const{confirmMsg:s,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":a=s,n=o;break;case"success":a=r,n=c}if(n){const t=ibiz.i18n.t(n.lanResTag,n.defaultContent||a);t!==n.lanResTag&&(a=t)}if(a){const{data:t}=i,e={...i};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,ei.execScriptFn(e,"`".concat(a,"`"),{isAsync:!1,singleRowReturn:!0})}}handleViewOptionParams(t){if(t.modaloption)try{const e=JSON.parse(t.modaloption);return delete t.modaloption,{modalOption:e}}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.uiAction.viewParameterModalOption",{error:t}))}return{}}}),Mc=t("BackendUIActionProvider",class extends Lc{async execAction(t,e){const{context:a,params:n,data:s,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new i(t,ibiz.i18n.t("runtime.uiAction.noEntityOrBehavior"));const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,a,s,n),p={...h},m=t.frontAppViewId;if(m){const t=this.handleViewOptionParams(h),e=await ibiz.commands.execute(Bo.TAG,m,l,h,{event:o,...t});if(!(null==e?void 0:e.ok))return r.cancel=!0,r;if((null==e?void 0:e.ok)&&e.data){0===u.length&&u.push({});const t=e.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((e=>{e.srfactionparam=t}))}}const g=ibiz.hub.getApp(null==a?void 0:a.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),y=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await g.deService.exec(c,d,l,y?f:f[0],p);if(w.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:mt(w.data)?w.data:[w.data],nextContext:l,nextParams:p}),r}}),Rc=t("SysUIActionProvider",class extends Lc{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:i}=e,a=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===a)return{closeView:!0};return await i.callUIAction(a,e)||{}}}),Oc=t("FrontUIActionProvider",class extends Lc{async execAction(t,e){const{context:n,params:s,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=C.fill(t.htmlPageUrl,n,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new i(t,ibiz.i18n.t("runtime.uiAction.noConfiguredopenView"));const{resultContext:a,resultParams:l}=await this.handleParams(t,n,o,s),h=this.handleViewOptionParams(l),u=await ibiz.commands.execute(Bo.TAG,e,a,l,{event:r,noWaitRoute:c,...h});(null==u?void 0:u.ok)||(d.cancel=!0),(null==u?void 0:u.ok)&&u.data&&(d.data=u.data,d.nextContext=a,d.nextParams={...s,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=await this.doOther(t,e);break;case"EDITFORM":d=await this.openEditForm(t,e);break;default:throw new a(t,ibiz.i18n.t("runtime.uiAction.frontProcessingModes",{frontProcessType:t.frontProcessType}))}return d}async doOther(t,e){const{scriptCode:a,uiactionTag:n}=t,{context:s,params:o,data:r,event:c,view:d}=e;if("ShortCut"===n){return await d.callUIAction(n,e)||{}}if(a){return ei.execScriptFn({context:s,params:o,data:r,el:null==c?void 0:c.target,view:d},a)||{}}throw new i(t,ibiz.i18n.t("runtime.uiAction.missingConfigurationScriptCode"))}async executePrint(t,e){var i;const{resultContext:a,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(i=s.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!a||!a[s.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(s.deapicodeName2,"/printdata/").concat(a[s.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:r.codeName,...n}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(n&&n.srfcontenttype){const t=ibiz.util.file.getFileName(e),i=URL.createObjectURL(e.data),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){const{resultContext:a,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),{appDataEntityId:s,appDEDataImportId:o,frontAppViewId:r}=t;if(!s||!o)throw new i(t,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));return await Dr({appDataEntityId:s,deDataImportId:o,dataImportViewId:r,context:a,params:n}),{refresh:!0,refreshMode:1}}async executeDataExport(t,e){var i;const{resultParams:a}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),s=null==(i=n.appDEDataExports)?void 0:i.find((e=>e.id===t.appDEDataExportId));if(!s)throw new o(ibiz.i18n.t("runtime.uiAction.noEntityExportsFound"));{const t="/".concat(n.deapicodeName2,"/exportdata/fetchdefault?srfexporttag=").concat(s.codeName),i={page:0,size:s.maxRowCount?s.maxRowCount:1e3,...e.params,...a},r=await ibiz.net.request(t,{method:"post",data:i});if(200!==r.status)throw new o(ibiz.i18n.t("runtime.uiAction.exportRequestFailed"));{let t="".concat(n.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([r.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}}async openEditForm(t,e){const i={},{context:a,params:n,data:s,event:r}=e;if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.lackNativeEvent"));const{resultContext:c,resultParams:d}=await this.handleParams(t,a,s,n),l=this.handleViewOptionParams(d).modalOption||{},h=tt({autoClose:!0},l);let u=!1;const p=ibiz.overlay.createPopover("IBizControlShell",{context:c,params:d,modelData:t.deeditForm,onSaveSuccess:t=>{i.data=[t.args],p&&p.dismiss(),u=!0}},h);return p.present(r.target),await p.onWillDismiss(),u||(i.cancel=!0),i}}),_c=t("WFWithdrawUIActionProvider",class extends Lc{async execAction(t,e){const{view:i}=e;let a=!1;return await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.uiAction.withdrawalConfirmed")})&&i&&(await i.call("WFWithdraw",e),a=!0),{refresh:!1,closeView:a}}}),Fc=class extends Lc{async execAction(t,e){return await ibiz.confirm.info({title:ibiz.i18n.t("runtime.uiAction.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})&&await ibiz.hub.controller.logout(),{}}};function zc(){const t=new Oc;Jn("FRONT",(()=>t));const e=new Mc;Jn("BACKEND",(()=>e));const i=new Rc;Jn("SYS",(()=>i));const a=new _c;Jn("DEUIACTION_WFWithdraw",(()=>a));const n=new Fc;Jn("SYS_Logout",(()=>n))}var Vc=t("ToolbarController",class extends _r{constructor(){super(...arguments),this.allToolbarItems=[],this.itemProviders={}}get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new or,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,i={}){if("DEUIACTION"===t.itemType){const a=t.uiactionId,n=await xe(a,t.appId);if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.toolbar.noFound",{actionId:a}));const s=["SYS","BACKEND","WFBACKEND"].includes(n.uiactionMode)&&!1!==n.showBusyIndicator;s&&this.state.buttonsState.setLoading(t.id);try{const n=await this.ctx.view.call("GetData")||[],s=this.getEventArgs();s.params=Object.assign(i,s.params),await xc.execAndResolved(a,{...s,data:n,event:e},t.appId)}finally{s&&this.state.buttonsState.setLoading("")}}}async initToolbarItemProviders(){await Promise.all(this.allToolbarItems.map((async t=>{const e=await Ts(t);e&&(this.itemProviders[t.id]=e)})))}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(this.allToolbarItems.push(t),t.itemType){const e=t,i=new sr(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,i)}if(t.controlLogics)for(let e=0;e<t.controlLogics.length;e++){const i=t.controlLogics[e],a=this.state.buttonsState[t.id];if(i.itemName===t.id&&"ITEMVISIBLE"===i.triggerType&&a){a.visible=!1;break}}}),{childrenFields:["detoolbarItems"]}),await this.initToolbarItemProviders(),this.state.manualCalcButtonState?await this.state.buttonsState.init():await this.calcButtonState(void 0,this.model.appDataEntityId)}async onItemClick(t,e,i){const a="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:a?"extra":"deuiaction"}),a||await this.doUIAction(t,e,i)}async calcButtonState(t,e){let i=t;if(t&&t instanceof io&&(i=t.getOrigin()),await this.state.buttonsState.update(this.context,i,e),this.scheduler){const t={};i&&(t.data=[i]),r(this.model,(e=>{const i=this.state.buttonsState[e.id];if(i){if(i.visible){const a=this.scheduler.triggerItemVisible(e.id,t);void 0!==a&&(i.visible=a)}if(!i.disabled){const a=this.scheduler.triggerItemEnable(e.id,t);void 0!==a&&(i.disabled=!a)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),kc=t("ContextMenuController",class extends Vc{}),Uc=(t("DashboardController",class extends _r{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=hr(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const i=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var a;if(t.controlType&&i.includes(t.controlType))return;const n=await Qn(t);if(n){this.providers[t.id]=n;const i=await n.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async initPortletsConfig(t={}){Object.keys(t).forEach((e=>{const i=this.portlets[e];i&&(i.config=t[e],i.state.title=i.config.srftitle,Object.assign(i.params,i.config))}))}async resetPortlets(){Object.keys(this.portlets).forEach((t=>{this.portlets[t].resetConfig()})),this.evt.emit("onResetPortlet",void 0)}async dataChangeNotify(t){await Si(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t,e){this.model=t,this.dashboard=e,this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.portletConfig={},this.type="personal",this.ownerType="",this.ownerId="",this.multiMode=!1,this.context=e.context,this.params=e.params,this.init(e.controlParams)}init(t){var e,i;if(this.type="personal",this.ownerId=this.context.srfpersonid,t.type&&(this.type=t.type),t.owner_type&&(this.ownerType=t.owner_type),t.owner_id&&(this.ownerId=this.context[t.owner_id]),"true"===t.multimode&&(this.multiMode=!0,this.type="dynamic"),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new Io(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new Xs(this.model.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(i=this.model.codeName)?void 0:i.toLowerCase()))}getResourceTag(){var t,e;const i="".concat(this.context.srfappid,"_dashboard_").concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase());switch(this.type){case"personal":return"".concat(i,"_").concat(this.context.srfpersonid);case"data":return"".concat(i,"_").concat(this.ownerType,"_").concat(this.ownerId);case"dynamic":return"".concat(i,"_").concat(this.context.srfdynadashboardid);default:return i}}async loadCustomModelData(){let t;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),t.config&&(this.portletConfig=t.config),{model:this.customModelData,config:this.portletConfig}}async resetCustomModelData(){return this.portletConfig={},this.saveCustomModelData([])}async saveCustomModelData(t,e={}){let i;Object.assign(this.portletConfig,e);const a={model:t,colNum:this.layoutColNum,rowH:this.layoutRowH,config:this.portletConfig};return i=this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},a):await this.config.save(a),i&&(this.customModelData=t),{model:t,config:this.portletConfig}}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Bc=t("PortletPartController",class{constructor(t,e,i){this.config={},this.model=t,this.dashboard=e,this.parent=i,this.state=this.createState(),this.state.context=h.create({},this.dashboard.context),this.params=new I({},this.dashboard.params)}get context(){return this.state.context}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get contentController(){const{contentControlId:t}=this.model;if(t)return this.dashboard.getController(t)}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e,title:i,titleLanguageRes:a}=this.model;if(t){const{width:t,height:e}=Ie(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),this.state.title=a?ibiz.i18n.t(a.lanResTag,i):i,this.config={srftitle:this.state.title},Object.assign(this.params,this.config),await this.initActionStates()}createState(){return new Uc}refresh(){}async setConfig(t){this.config=t,t.srftitle&&(this.state.title=t.srftitle),k(this.params,t),this.dashboard.evt.emit("onConfigChange",{name:this.model.id,config:this.config})}resetConfig(){const{title:t,titleLanguageRes:e}=this.model;this.params=new I({},this.dashboard.params),this.state.title=e?ibiz.i18n.t(e.lanResTag,t):t,this.config={srftitle:this.state.title},Object.assign(this.params,this.config)}onDataChange(t){let e=t.data[0];e&&e instanceof io&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(this.context,e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.dashboard.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.dashboard.context),this.state.actionGroupState=i;const{appDataEntityId:a}=this.dashboard.view.model;a&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,i=[]){const a=t.uiactionId;await xc.execAndResolved(a,{context:this.context,params:this.params,data:i,view:this.dashboard.view,ctrl:this,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(this.context,t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),Wc=(t("ContainerPortletController",class extends Bc{}),t("ViewPortletController",class extends Bc{get contentController(){const{portletAppView:t}=this.model;if(t&&t.codeName)return this.dashboard.getController(t.codeName)}refresh(){this.contentController&&this.contentController.callUIAction("Refresh")}}),t("MenuPortletController",class extends Bc{}),t("ChartPortletController",class extends Bc{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends Bc{}),t("HtmlPortletController",class extends Bc{}),t("ListPortletController",class extends Bc{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends Bc{}),t("DataViewControlService",class extends no{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const n=i.toLowerCase();a=new To(e,n,{isOriginField:!0,dataType:t.dataType})}else a=new To(e,e);this.dataUIMap.set(e,a)}))}})),Gc=t("DataViewControlController",class extends Fr{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[]}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new Wc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context,void 0,this.model.appDataEntityId),t.groupActionGroupState=i}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:i}=this.model;if(i)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[i],a=this.state.groups.find((t=>t.key===e));a&&a.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var i,a;let n=t;-1!==e.selectedData.indexOf(n)?(n&&n instanceof io&&(n=n.getOrigin()),n&&(null==(i=e.groupActionGroupState)||i.update(this.context,n,this.model.appDataEntityId))):null==(a=e.groupActionGroupState)||a.update(this.context,void 0,this.model.appDataEntityId)}));else{const i=this.state.groups.find((e=>-1!==e.children.indexOf(t)));i&&(null==(e=i.groupActionGroupState)||e.update(this.context,i.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let i=0;i<e.length;i++)"ACTIONITEM"===e[i].itemType&&(t=e[i]);return t}getOptItemAction(t){var e;const a=new or,n=this.getOptItemModel();if(n){if(!n.deuiactionGroup)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroup"));if(!(null==(e=n.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroupAction")),a;n.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new sr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.getOrigin())}return a}async onActionClick(t,e,i){const a=t.uiactionId;await xc.execAndResolved(a,{context:this.context,params:this.params,data:[e],view:this.view,event:i},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,n=new Map;this.groupCodeListItems.forEach((t=>{n.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=n.get(i);a&&a.push(e)}));const s=[];n.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));s.push({caption:i.text,key:i.value,children:t})})),this.state.groups=s}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const i={...this.params,srfgroup:e};xc.execAndResolved("new",{context:this.context,params:i,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,i){const a=t.uiactionId,n={...this.params,srfgroup:i.key};await xc.execAndResolved(a,{context:this.context,params:n,data:i.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:a,minorSortDir:n}=this.model,s=a&&n;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new i(t,ibiz.i18n.t("runtime.controller.control.dataView.sortingItems"));const r={caption:o,key:t.appDEFieldId};s&&a===t.appDEFieldId&&(r.order=n.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),jc=t("ExpBarControlController",class extends _r{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const i=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),a=[];null==i||i.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){if(t.isInitialLoad)this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem();else{const t=this.xDataController.state.selectedData;t[0]&&this.xDataController.setActive(t[0])}}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&dr(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:i,params:a}=t,n=this.getNavViewMsg(e[0],i,a);this._evt.emit("onNavViewChange",{navViewMsg:n})}prepareParams(t,e,i,a){const{navDER:n,navFilter:s,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?Ae(c):void 0,navFilter:s,pickupDEFName:null==n?void 0:n.pickupDEFName,navContexts:o,navParams:r},l={context:i,params:a,data:e},{resultContext:h,resultParams:u}=ge(d,l),p=Object.assign(i.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o(ibiz.i18n.t("runtime.controller.control.expBar.multiNode"))}getNavViewMsg(t,e,i){const a=this.calcViewModelId(),n=this.prepareParams(this.XDataModel,t,e,i);return{key:t[this.navKeyName],context:n.context,params:n.params,viewId:a,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Kc=(t("CalendarExpBarController",class extends jc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const i=new Date(e.beginTime);this.xDataController.setSelectDate(i)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:i,params:a}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return i.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:i,params:a,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends jc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}async onMounted(){super.onMounted(),this.xDataController&&this.xDataController.evt.on("onAfterRefreshParent",(t=>{const e=this.xDataController.state.selectedData;e[0]&&this.xDataController.setActive(e[0])}))}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let i;return e&&e.forEach((e=>{e.id===t&&(i=e)})),i}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,i){const a=t._id,n=t._deData||t,s=this.getNodeModel(t._nodeId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.expBar.noFindNodeModel",{nodeId:t._nodeId}));const r=this.prepareParams(s,n,e,i);return r.context.currentSrfNav=a,this.state.srfnav=a,{key:a,viewId:s.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,i)=>{0===i?e.push(t):e.push("".concat(e[i-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends jc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,i,a){var n;const{context:s,params:o}=super.prepareParams(t,e,i,a);if(e._seriesModelId){const i=null==(n=t.dechartSerieses)?void 0:n.find((t=>t.id===e._seriesModelId));if(i){const{navigateContexts:t,navigateParams:n}=i,r=he(t,e,a,s),c=he(n,e,a,o);return{context:Object.assign(s.clone(),r),params:c}}}return{context:s,params:o}}getNavViewMsg(t,e,i){var a;let n;if(t._seriesModelId){const e=null==(a=this.XDataModel.dechartSerieses)?void 0:a.find((e=>e.id===t._seriesModelId));n=null==e?void 0:e.navAppViewId}const s=this.prepareParams(this.XDataModel,t,e,i);return{key:t._uuid,context:s.context,params:s.params,viewId:n,isCache:this.isCache}}}),t("FormController",class extends _r{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[],this.counters={}}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new io,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Si(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),await this.initCounter(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,a=void 0){await Promise.all(t.map((async t=>{const n=await Bn(t,this.model);if(!n)return;if(e.details[t.id])throw new i(t,ibiz.i18n.t("runtime.controller.control.form.initializationException",{id:t.id,detailType:t.detailType}));e.providers[t.id]=n;const s=await n.createController(t,e,a);if(e.details[t.id]=s,"FORMITEM"===t.detailType&&e.formItems.push(s),"MDCTRL"===t.detailType&&e.formMDCtrls.push(s),Fe(t))return;const o=_e(t);o.length&&await this.initDetailControllers(o,e,s)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||lr(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){if((null==e?void 0:e.error)&&e.error instanceof P){const{details:t}=e.error;t.forEach((t=>{this.setDetailError(t.name,t.errorInfo)}))}super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}async onDestroyed(){await super.onDestroyed(),Object.values(this.counters).forEach((t=>t.destroy()))}async initCounter(){this.counters={};const{appCounterRefs:t}=this.model;if(t&&t.length>0){const e=this.context[Ae(this.model.appDataEntityId)];try{await Promise.all(t.map((async t=>{const i=await qs.getCounterByRef(t,this.context,e?{srfcustomtag:e,...this.params}:{...this.params});this.counters[t.id]=i})))}catch(t){console.error(t)}}}setDetailError(t,e){const i=this.details[t],a=null==i?void 0:i.state;a&&(a.error=e)}})),Hc=class extends ao{setDefault(t,e,i,a){r(this.model,(n=>{if("FORMITEM"===n.detailType){const{createDVT:s,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=n,l="create"===a?s:r,h="create"===a?o:c,u=n.id.toLowerCase(),p=gr({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Xc=t("SearchFormService",class extends Hc{async getDraft(t,e={}){let i={ok:!0,status:200,data:this.getFilteredData({...e})};return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new To(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}}),qc=(t("SearchFormController",class extends Kc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new Xs(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new Xc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const i=this.state.data[e];null!=i&&""!==i&&(t[e]=i)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,i=!1;const a=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===a,i="BOTTOM"!==a,"NONE"===t&&(e=!0,i=!0);const n=t=>{let a,s="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(a=t[e],s=e,!0))),a&&a.length>0){const o=[];a.forEach((t=>{e&&"control_buttons_right"===t.id||i&&"control_buttons_bottom"===t.id||(o.push(t),n(t))})),o.length<a.length&&(t[s]=o)}};(i||e)&&n(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.searchTerms"));e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o(ibiz.i18n.t("runtime.controller.control.form.saveSearch"));this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0,this.readonly=!1;let e,i,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Yc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Yc||{})),Qc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Qc||{})),$c=t("FormDetailController",class{constructor(t,e,i){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=i,this.state=this.createState(),this.state.context=this.context}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:i,capLanguageRes:a}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName),a&&a.lanResTag&&(this.model.caption=ibiz.i18n.t(a.lanResTag,this.model.caption))}createState(){var t;return new qc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.defdgroupLogics)||i.forEach((i=>{const a=i.relatedDetailNames||[];if(e||T(a,t))try{const t=ni(this.data,i);switch(i.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=be(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Jc=t("FormButtonState",class extends qc{constructor(){super(...arguments),this.loading=!1}}),Zc=(t("FormButtonController",class extends $c{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new Jc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){const t=this.model.uiactionId;t&&(this.actionState=new sr(this.model.id,this.form.context.srfappid,t))}async formStateNotify(t){if(this.actionState){const t=Ae(this.form.model.appDataEntityId);await this.actionState.update(this.context,this.data,t)}await super.formStateNotify(t)}calcDetailDisabled(t){super.calcDetailDisabled(t),this.actionState&&(this.state.disabled=!(!this.state.disabled&&!this.actionState.disabled))}calcDetailVisible(t){super.calcDetailVisible(t),this.actionState&&(this.state.visible=!(!this.state.visible||!this.actionState.visible))}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await xc.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends qc{constructor(){super(...arguments),this.showMask=!1}})),td=(t("FormDRUIPartController",class extends $c{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Zc(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),T(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;ct(e)&&(t=Object.assign(t,he(e,this.data,this.form.params,this.form.context)));const i=he(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(i))this.navContext=t,this.navParams=i,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=ht(),this.navContext=t,this.navParams=i}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.relationshipInterface"),t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends qc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),ed=t("FormGroupPanelController",class extends $c{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new td(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await xc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),id=t("FormItemState",class extends qc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),ad=(t("FormItemController",class extends $c{constructor(t,e,i){super(t,e,i),this.rules=[]}createState(){var t;return new id(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){var t,e;await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:i}=this.model;i||(this.state.enableCondDisabled=!0),!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly&&(null==(t=this.model.editor)?void 0:t.readOnly)&&(this.state.readonly=(null==(e=this.model.editor)?void 0:e.readOnly)||!1),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Vn(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=Ii(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...ur(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...pr(this.model.editor)),this.rules.length>0&&(this.validator=new At({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&("string"==typeof this.data[this.name]?dt(this.data[this.name].trimEnd()):dt(this.data[this.name])))return this.state.error=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),class extends qc{constructor(){super(...arguments),this.actionGroupState=null}}),nd=t("FormMDCtrlController",class extends $c{createState(){var t;return new ad(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await xc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}}),sd=(t("FormMDCtrlMDController",class extends nd{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));"GRID"===t.controlType&&S(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await _n(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.form.multiDataAddData",{contentType:this.model.contentType}));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.mdControllerNoExist"))}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends ad{}),od=(t("FormMDCtrlFormController",class extends nd{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new sd(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await _n(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=Ae(a)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const i={...this.params};return{id:t.srfkey,context:e,params:i}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const i=e.data[0],a=this.state.items.find((e=>e.id===t));a&&a.context[this.deName]!==i.srfkey&&(a.context[this.deName]=i.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.noFoundFormController",{id:t}));await e.remove();const i=this.state.items.findIndex((e=>e.id===t));-1!==i&&this.state.items.splice(i,1)}create(t){const e=this.context.clone(),i={...this.params};this.state.items||(this.state.items=[]);const a={id:ht(),context:e,params:i};void 0!==t?this.state.items.splice(t,0,a):this.state.items.push(a)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends nd{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new a(this.model,ibiz.i18n.t("runtime.controller.control.form.repeaterNoSupported",{detailStyle:this.model.detailStyle}))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=it(e)}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,i)=>t!==i));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends td{})),rd=(t("FormPageController",class extends ed{createState(){var t;return new od(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends qc{})),cd=(t("FormRawItemController",class extends $c{createState(){var t;return new rd(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends qc{})),dd=(t("FormTabPageController",class extends $c{createState(){var t;return new cd(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends qc{constructor(){super(...arguments),this.activeTab=""}})),ld=(t("FormTabPanelController",class extends $c{createState(){var t;return new dd(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}getCounter(t){const{counters:e}=this.form;return e&&e[t]?e[t]:null}}),t("EditFormService",class extends Hc{async get(t,e={}){var i;let a=await this.exec((null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"update"),a}async getDraft(t,e={}){var i;let a=await this.exec((null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}async remove(t,e={}){var i;return await this.exec((null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var i;const a=e instanceof io?e.getOrigin():e,n=this.getFilteredData(a);let s=await this.exec((null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create",t,n);return s=this.handleResponse(s),s}async update(t,e){var i;const a=e instanceof io?e.getOrigin():e,n=this.getFilteredData(a);let s=await this.exec((null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update",t,n);return s=this.handleResponse(s),s}async goBack(t,e){var a;const n=null==(a=this.model.goBackControlAction)?void 0:a.appDEMethodId;if(!n)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.lackBehavior"));let s=await this.exec(n,t,e instanceof io?e.getOrigin():e);return s=this.handleResponse(s),s}async updateFormItem(t,e,i={},a={}){Object.assign(a,{srfupdateitem:!0});let n=await this.exec(t,e,i,a);return n=this.handleResponse(n),n}async wfStart(t,e,i){var a;const n=(null==(a=this.model.wfstartControlAction)?void 0:a.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,i instanceof io?i.getOrigin():i)}async wfSubmit(t,e,i){var a;const n=this.model;let s="";s=e.type?e.type:(null==(a=n.wfsubmitControlAction)?void 0:a.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,i instanceof io?i.getOrigin():i)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const i=e,a=i.id.toLowerCase(),n=i.fieldName||e.appDEFieldId;let s;s=n?new To(a,n,{isOriginField:!0,dataType:i.dataType}):new To(a,a,{isOriginField:t.includes(a)}),this.dataUIMap.set(a,s)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}})),hd=(t("EditFormController",class extends Kc{constructor(){super(...arguments),this.oldData=new io}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new ld(this.model),await this.service.init(this.context),this.autoSave=U(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:i}),a=await this.service.getDraft(e,i)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=a.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=it(this.context),e=it(this.params),i=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(i&&this.params[i]){t[Ae(this.model.appDataEntityId)]=this.params[i],delete e[i],delete this.params[i],delete e.srfcopymode,delete this.params.srfcopymode}let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:e}),a=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return a.data.srfkey=void 0,a.data.tempsrfkey=ht(),this.state.modified=!1,this.state.data=a.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:a.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Pe(this.context,Ae(this.model.appDataEntityId)))return this.loadDraft();const{context:e,params:i}=this.handlerAbilityParams(t),a=it(i);let n;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:a}),n=await this.service.get(e,a)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=n.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:n.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await x(500,this.save.bind(this),[t])}if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));e||await this.startLoading();const{context:i,data:a}=this.handlerAbilityParams(t),n=a[0],s=0===n.srfuf;let r;try{await this.evt.emit("onBeforeSave",{args:n}),r=s?await this.service.create(i,n):await this.service.update(i,n)}catch(t){throw await this.evt.emit("onSaveError",{args:t}),this.actionNotification("".concat(s?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):S(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",{args:r.data}),this.view.state.isClosing||this.formStateNotify("SAVE"),e||this.actionNotification("".concat(s?"CREATE":"UPDATE","SUCCESS"),{default:ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:this.data.srfmajortext||""})}),this.emitDEDataChange(s?"create":"update",r.data),this.data}async remove(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a,n=!1;if(await this.evt.emit("onBeforeRemove",{args:this.data}),1===this.data.srfuf){if(!0!==(null==t?void 0:t.silent)){if(n=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.controller.control.form.deletion")}),!n)return!1}await this.startLoading();try{a=await this.service.remove(e,i)}catch(e){throw await this.evt.emit("onRemoveError",{args:e}),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e}),e}finally{await this.endLoading()}n=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new io,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",{args:this.data}),this.actionNotification("REMOVESUCCESS"),n}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&S(this.data,t.data),this.data}async updateFormItem(t){var e;const i=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.form.itemUpdate",{formItemUpdateId:t}));const{appDEMethodId:a,defiupdateDetails:n,customCode:s,scriptCode:r,showBusyIndicator:c}=i,d=null==n?void 0:n.map((t=>t.id));try{let t;if(c&&this.startLoading(),s&&r)t=ei.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},i=await this.service.updateFormItem(a,this.context,e);t=i.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processStarted")})}async wfSubmit(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processSubmitted")})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=h.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}async immediateAutoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=h.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?b(t[i],this.oldData[i])||(e[i]=t[i]):t[i]===this.oldData[i]&&i!==t.srfkeyfield||(e[i]=t[i])})),e.srfuf=t.srfuf,new io(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}onDEDataChange(t){var e;if("OBJECTUPDATED"===t.subtype&&(Z(t.triggerKey)||t.triggerKey!==this.triggerKey)&&this.model.appDataEntityId){const i=Ae(this.model.appDataEntityId);if(!t.data||(null==(e=t.data.srfdecodename)?void 0:e.toLowerCase())!==i||t.data.srfkey!==this.data.srfkey)return;this.doNextActive((()=>this.load()),{key:"load"})}}}),t("GridColumnController",class{constructor(t,e){var i;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(i=this.deGridDataItem)?void 0:i.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return ei.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),ud=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,this.oldData=t.clone(),Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{let i;this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.fieldName],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})}))}getDiffData(){const t={};return Object.keys(this.data).forEach((e=>{this.data[e]===this.oldData[e]&&e!==this.data.srfkeyfield||(t[e]=this.data[e])})),t.srfuf=this.data.srfuf,t.srfkey=this.data.srfkey,new io(t,this.oldData.$dataUIMap)}}),pd=t("GridService",class extends no{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const a=t.id.toLowerCase(),n=t.appDEFieldId;let s;if(n){const o=n.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new i(t,ibiz.i18n.t("runtime.controller.control.grid.corresponding",{deField:n}));s=new To(a,o,{isOriginField:!0,dataType:r.dataType})}else s=new To(a,a);this.dataUIMap.set(a,s)}))}}async updateGridEditItem(t,e,i={},a={}){const n=await this.app.deService.getService(e,this.model.appDataEntityId);Object.assign(a,{srfupdateitem:!0});let s=await n.exec(t,e,i,a);return s=this.handleResponse(s),s}}),md={string:25,number:6,integer:9,date:5};var gd=t("GridController",class extends Fr{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计",this.dataExportParam={},this.allExportColumns=[],this.allExportCodelistMap=new Map,this.formatValue=(t,e="")=>{const i="".concat(e);if(!t)return i;if(Ct(i,t,!0).isValid()){return Ct(i).format(t)}return ibiz.util.text.format(i,t)}}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get enableRowEditOrder(){return!!this.model.enableRowEditOrder}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1;const{hideHeader:t,enablePagingBar:e}=this.model;this.state.hideHeader=t,this.state.enablePagingBar=e,this.state.hideNoDataImage=!1}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new pd(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup(),await this.initExportData()}calcShowMode(t){const{hideHeader:e,enablePagingBar:i}=this.model;this.state.hideNoDataImage=!1,this.state.hideHeader=e,this.state.enablePagingBar=i;const a=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===a&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===a&&0===t.length&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await Nr(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var i;if(!t.properties)return;const{properties:a}=t;if(!(Object.keys(a).length>0))return;const n=[];Object.keys(a).forEach((t=>{let e;switch(a[t].type){case"string":e="string","date-time"===a[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:a[t].type}))}n.push({key:t,description:a[t].description,type:e})}));const s={};null==(i=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||i.forEach((t=>{s[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return n.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:s[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:s[t.key],id:t.key,valueType:"SIMPLE",dataType:md[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:i}=e;this.model=it(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===i.findIndex((e=>e.id===t.id)))),...i]}}async initExportData(){var t;if(this.model.dedataExportId&&(this.dataExport=null==(t=this.dataEntity.appDEDataExports)?void 0:t.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport))),this.allExportColumns.length>0)this.allExportColumns.forEach((t=>{t.codeListItems&&this.allExportCodelistMap.set(t.appDEFieldId,t.codeListItems)})),this.dataExportParam.fields=this.allExportColumns.map((t=>t.appDEFieldId)),this.dataExportParam.header=this.allExportColumns.map((t=>t.caption));else{Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&this.allExportCodelistMap.set(t,this.fieldColumns[t].codeListItems)}));const{degridColumns:t=[]}=this.model;this.dataExportParam.fields=t.map((t=>t.id)),this.dataExportParam.header=t.map((t=>t.caption))}}async fillExportCodelistMap(){if(this.model.dedataExportId)return;const t=async(t,e)=>{const i=await e.loadCodeList();this.allExportCodelistMap.set(t,i)},e=[];for(const[i,a]of this.allExportCodelistMap)if(!a){const a=this.fieldColumns[i];a.codeListItems?this.allExportCodelistMap.set(i,a.codeListItems):e.push(t(i,a))}e.length>0&&await Promise.all(e)}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.attributeColumns"));const n=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new i(this.groupFieldColumn.model,ibiz.i18n.t("runtime.controller.control.grid.noCodeTable",{groupFieldName:n}));const s=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==s&&0!==s){if(this.isMultistageHeader)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.configureFirstColumn",{groupFieldName:n}));const t=this.state.columnStates.splice(s,1);this.state.columnStates.unshift(...t)}if("CODELIST"===a){if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.requiresCodeTable"));if(this.groupFieldColumn.model.appCodeListId!==e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.noMatchCodeTable",{groupFieldName:n}))}this.calcColumnFixed()}sortItems(t){const e=this.model.orderValueAppDEFieldId;e&&this.enableRowEditOrder&&(t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>t[e]-i[e])))}async afterLoad(t,e){return this.sortItems(this.state.items),await super.afterLoad(t,e),await Si(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new ud(t,this);return this.gridStateNotify(e,"LOAD"),e})),await this.updateRows(this.state.rows),this.calcGroupData(e),this.calcAggResult(e),this.calcShowMode(e),e}async updateRows(t){for(const e of t)await Promise.all([...Object.values(e.uaColStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId))),...Object.values(e.uiActionGroupStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId)))])}calcGroupData(t){const{enableGroup:e,groupMode:i}=this.model;if(e){const e=new Map,a="CODELIST"===i,n=this.groupFieldColumn.model.id;a&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const i=t[n];a||e.has(i)||e.set(i,[]),e.has(i)&&e.get(i).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==i?void 0:i.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if("ALL"!==t)return;if(!a||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.missingConfiguration"));const n=await this.getFetchParams(),s=ibiz.hub.getApp(this.context.srfappid),o=await s.deService.exec(e,a,this.context,void 0,n);o.data.length&&([this.state.remoteAggResult]=o.data)}async getFetchParams(t={}){return!0===this.model.enableItemPrivilege&&(t.srfdataaccessaction=!0),super.getFetchParams(t)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const i=e.calcFieldAgg(t);i&&(this.state.aggResult[e.model.id]=i)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const i=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==i&&e.children.splice(i,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:i}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(i))return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.newRows"));if("row"===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.md.firstComplete"))}const a={...this.params},n=this.calcDefaultValue({},!0);let s;Object.assign(a,n);try{s=await this.service.getDraft(this.context,a)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=s.data;L(r,n),this.state.items.unshift(r);const c=new ud(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===i&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,i=this.findRowState(t);if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.md.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.md.noChange"));if(i.processing)return void await x(500,this.save.bind(this),[t]);if(!await this.validate(i))throw new o(ibiz.i18n.t("runtime.controller.control.grid.saveCancel"));let a;this.model.enableRowEditChangedOnly&&(t=i.getDiffData());const n=Ae(this.model.appDataEntityId),s=this.context.clone();s[n]=t.srfkey;try{a=e?await this.service.create(s,t):await this.service.update(s,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:i.data,rowState:i}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,a.data),i.data=a.data,i.oldData=a.data.clone(),i.modified=!1,this.gridStateNotify(i,"SAVE"),await this._evt.emit("onSaveSuccess",void 0),this.emitDEDataChange(e?"create":"update",a.data)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await Si(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await jn(t,this.model);if(!i)return;this.providers[t.codeName]=i;const a=await i.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=a,t.enableRowEdit&&(this.editColumns[t.codeName]=a)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=a:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType,adaptive:"STAR"===t.widthUnit})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:i,frozenLastColumn:a}=this.model;this.hasAdaptiveColumn=!1,t.forEach(((t,n)=>{t.adaptive&&(this.hasAdaptiveColumn=!0),t.uaColumn?t.fixed=n+1<=Math.floor(e/2)?"left":"right":i&&n<i?t.fixed="left":a&&n>=e-a&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||lr(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Si(Object.values(this.editColumns).map((async i=>i.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((i=>{i.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o(ibiz.i18n.t("runtime.controller.control.grid.noSupportRowEditing"));this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let i;t&&(i=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(i,e)}async updateGridEditItem(t,e){var i;const a=null==(i=this.model.degridEditItemUpdates)?void 0:i.find((t=>t.id===e));if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.grid.updateColumns",{updateId:e}));const{appDEMethodId:n,degeiupdateDetails:s,customCode:r,scriptCode:c}=a,d=s.map((t=>t.id));let l;if(r&&c)l=ei.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},i=await this.service.updateGridEditItem(n,this.context,e);l=i.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let a;await this.startLoading();try{a=await this.service.fetch(e,i)}finally{await this.endLoading()}return a.data}async findAllExportColumns(t){var e;const i=ibiz.hub.getApp(this.context.srfappid),a=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=i.codeList.getCodeList(t.codeListId),e.codeListItems=await i.codeList.get(t.codeListId,this.context)),e}));return a?Promise.all(a):[]}formatExcelData(t){const{fields:e=[]}=this.dataExportParam,i=it(t.map((t=>e.reduce(((e,i)=>(e[i]=t[i],e)),{}))));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;let a=t[e];const n=this.allExportColumns.find((t=>t.appDEFieldId===e)),s=this.fieldColumns[e],o=(null==n?void 0:n.format)||(null==s?void 0:s.valueFormat),r=(null==s?void 0:s.model.unitName)||"";a=this.allExportCodelistMap.get(e)?(null==(i=this.allExportCodelistMap.get(e).find((i=>i.value===t[e])))?void 0:i.text)||a:this.formatValue(o,a)+r,t[e]=a}))})),i}async getExportData(t){var e;const{type:i}=t;let a=[];if(i&&"activatedPage"!==i)if("maxRowCount"===i||"customPage"===i){const{size:n}=this.state,{startPage:s,endPage:o}=t,r="customPage"===i?{page:0,offset:(s-1)*n,size:(o-s+1)*n}:{size:(null==(e=this.dataExport)?void 0:e.maxRowCount)||1e3,page:0};a=await this.loadData({viewParam:r})}else"selectedRows"===i&&(a=this.getData());else a=this.state.rows.map((t=>t.data));if(0===a.length)throw new o(ibiz.i18n.t("runtime.controller.control.grid.exported"));return a}async exportData(t){const{header:e}=this.dataExportParam;if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.grid.tabularColumns"));await this.fillExportCodelistMap();const i=await this.getExportData(t.params),a=this.formatExcelData(i).map((t=>Object.values(t)));await Ir(e,a,this.model.logicName)}calcDefaultValue(t,e){const i={};return Object.values(this.editColumns).forEach((a=>{const{createDV:n,createDVT:s,updateDV:o,updateDVT:r}=a.editItem,c=e?s:r,d=e?n:o,l=gr({name:a.fieldName,valueType:c,defaultValue:d,valueFormat:a.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(i[a.fieldName]=l)})),i}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((i=>i.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.calcColumnFixed(),this.saveColumnStates()}setGroupParams(t){t.sort?(this.state.sortQuery=t.sort,this.isSetSort=!0):this.state.sortQuery="",t.columnstates?(this.state.columnStates=t.columnstates,this.calcColumnFixed()):this.initColumnStates()}changeColumnStateSort(t,e,i){const a=this.state.columnStates.find((e=>e.key===t));a&&(this.state.columnStates.splice(i,1),this.state.columnStates.splice(e,0,a),this.calcColumnFixed(),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}actionNotification(t,e){if((null==e?void 0:e.error)&&(null==e?void 0:e.rowState)&&e.error instanceof P){const{details:t}=e.error,{errors:i}=e.rowState;t.forEach((t=>{i[t.name]=t.errorInfo}))}super.actionNotification(t,{...e||{}})}async onDragChange(){const t=this.model.orderValueAppDEFieldId,e=this.state.rows.map((t=>t.data));let i;const a=[];e.forEach((e=>{var n;void 0===i?(i=e[t]||100,e[t]||(e[t]=i,a.push(e))):((!e[t]||i>=e[t])&&(e[t]=(n=i)+(100-n%100),a.push(e)),i=e[t])})),this.updateChangedItems(a)}async updateChangedItems(t){try{await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.update(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{await this.afterLoad({},this.state.items)}}}),fd=t("GridFieldColumnController",class extends hd{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=U(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uiActionGroupStates[this.model.codeName]=i}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,i){const{userParam:a}=this.model;if(!a)return{context:e,params:i};const{navigateContexts:n,navigateParams:s}=we(a);let o={};n&&t&&(o=he(n,t,i,e));const r=Object.assign(e.clone(),o);let c={};s&&t&&(c=he(s,t,i,e));return{context:r,params:{...i,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const i=this.model.linkValueItem||"srfkey",n=t.data[i];if(null==n)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.pickedUpData",{valueItem:i}));const{linkAppViewId:s}=this.model;if(!s)return;const o=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:n,...o}),c=it(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Bo.TAG,s,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const i=this.model.deuiactionId;await xc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}calcFieldAgg(t){const{aggField:e,aggMode:i,aggValueFormat:n,unitName:s}=this.model;if(Z(i)||"NONE"===i)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!Z(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.remoteAggregation")):new a(this.grid.model,ibiz.i18n.t("runtime.controller.control.grid.aggregateMode",{aggMode:this.grid.model.aggMode}));switch(i){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.noSupportedMode",{aggMode:i}))}let c="".concat(r);if(n)try{c=ibiz.util.text.format("".concat(r),n)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.formattingError",{aggValue:r}))}return c&&s&&(c+=s),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return mr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(u.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,i){const a=t.uiactionId;await xc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),yd=(t("GridUAColumnController",class extends hd{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.behaviorGroup"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const n=new or;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new sr(t.id,this.grid.context.srfappid,e);n.addState(t.id,i)}})),t.uaColStates[this.model.codeName]=n}async onActionClick(t,e,i){const a=t.uiactionId;await xc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends fd{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Oe(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Vn(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=Ii(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...ur(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...pr(this.editItem.editor)),this.rules.length>0&&(this.validator=new At({[this.fieldName]:this.rules}))}async setRowValue(t,e,i){i=i||this.fieldName,await this.grid.setRowValue(t,i,e)}async dataChangeNotify(t,e){const{resetItemNames:i}=this.editItem;let a=!1;i&&i.length>0&&i.forEach((t=>{e.includes(t)&&(a=!0)})),a&&this.setRowValue(t,null),this.calcColumnDisabled(t);const n=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(n!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o(ibiz.i18n.t("runtime.controller.control.grid.checksumErrors",{codeName:this.editItem.codeName,fieldName:t.errors[this.fieldName]}))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const i=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);i&&(t.editColStates[this.fieldName].readonly=i)}calcEnableCond(t){const{enableCond:e}=this.editItem,i=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return i;case 2:return!i;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&!0===t.editColStates[e].required&&("string"==typeof t.data[e]?dt(t.data[e].trimEnd()):dt(t.data[e])))return t.errors[e]=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(i){const{errors:a}=i;return t.errors[e]=a[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends hd{}),t("ListService",class extends no{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const n=i.toLowerCase();a=new To(e,n,{isOriginField:!0,dataType:t.dataType})}else a=new To(e,e);this.dataUIMap.set(e,a)}))}})),wd=(t("ListController",class extends Fr{initState(){super.initState(),this.state.noSort=!0===this.model.noSort}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new yd(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}async afterLoad(t,e){return await this.handleDataGroup(),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=i.get(e[t])||[];a.push(e),i.set(e[t],a)}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:i}=this.state,a=[],n=ibiz.hub.getApp(this.context.srfappid),s=await n.codeList.get(e,this.context,this.params),o=[];s.forEach((e=>{const n=i.filter((i=>i[t]===e.value));a.push({caption:e.text,key:e.value,children:[...n]}),o.push(e.value)}));const r=i.filter((e=>-1===o.indexOf(e[t])));r.length>0&&a.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=a}}}),t("PanelController",class extends _r{constructor(t,e,i,a,n){super(t,e,i,a),this.hooks={validate:new lt},this.panelItems={},this.providers={},this.container=n}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),this.hooks.validate.clear(),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async validate(t){const e=[];return await this.hooks.validate.call({result:e,parentId:t}),e.every((t=>t))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,i=void 0){t&&await Promise.all(t.map((async t=>{var a,n;const s=await Xn(t,e.model,e.view.model);if(!s)return;e.providers[t.id]=s;const o=await s.createController(t,e,i);e.panelItems[t.id]=o,(null==(a=t.panelItems)?void 0:a.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(n=t.panelTabPages)?void 0:n.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const i=await this.prepareData();if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.panel.panelData"));const a=this.convertData(i);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=a,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Ge(this.model),i=e.map((t=>t.id)),a=new Lo(e,t);return a._evt.on("change",(t=>{i.includes(t)&&this.dataChangeNotify([t])})),a}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),Ed=(t("ViewLayoutPanelController",class extends wd{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const i=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=i(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=i(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.readonly=!1;let e,i,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),vd=(t("PanelItemController",class{constructor(t,e,i){this.model=t,this.panel=e,this.parent=i,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState(),this.state.context=this.panel.context}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){var t;!!(null==(t=this.model.panelItemGroupLogics)?void 0:t.find((t=>"PANELVISIBLE"===t.logicCat)))&&(this.state.visible=!1),this.panel.hooks.validate.tapPromise((async t=>{t.parentId&&t.parentId!==this.dataParent.model.id||t.result.push(await this.validate())})),await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:i}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName)}destroy(){}async validate(){return!0}createState(){var t;return new Ed(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.panelItemGroupLogics)||i.forEach((i=>{const a=i.relatedItemNames||[];if(e||T(a,t))try{const t=si(this.data,i);switch(i.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=be(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends _r{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,i=this.context.clone(),a={...this.params};t&&Object.assign(i,he(t,this.params,this.context)),e&&Object.assign(a,he(e,this.params,this.context)),this.state.context=i,this.state.params=a}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),t("ItemsValueOPs",["EXISTS","NOTEXISTS"])),Id=/^N_(.\w+)_(.\w+)$/;function bd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Dd(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Cd(t){const e=t.split("__")[1].match(Id);return{field:e[1],op:e[2]}}var Ad=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],Pd=/\$\{[^}]*\}/,Td=t("SearchBarFilterController",class{constructor(t,e,i,a){var n;let s;this.model=t,this.appDataEntity=e,this.context=i,this.params=a,this.noEditor=!1,this.type="FIELD",this.hidden=Dd(t),t.appDEFieldId&&(s=Se(this.appDataEntity,t.appDEFieldId)),this.fieldName=s?s.codeName.toLowerCase():t.id,this.key=this.fieldName,this.label=t.caption||(null==s?void 0:s.logicName)||t.id,this.valueOP=null==(n=t.defsearchMode)?void 0:n.valueOP,this.noEditor=this.valueOP?Ad.includes(this.valueOP):!this.model.editor}get valueItem(){return this.editor?this.editor.valueItem:void 0}async init(){if(!this.noEditor){if(!this.model.editor)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.searchBar.missingModel"));this.editorProvider=await Vn(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}calcEditorProps(t){const e={};let i=t.value;return t.disabled&&Pd.test(i)&&(i=i.replace("${context.srfpersonid}","当前用户"),i=i.replace("${context.srforgid}","当前组织")),this.valueItem&&(e[this.valueItem]=t.valueItem),{value:i,data:e}}onEditorChange(t,e,i){this.valueItem&&i===this.valueItem?t.valueItem=e:t.value=e}}),Nd=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[i]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),i)}async updateBatch(t){const e=this.convertFrontDataToBack(t),i=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(i),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Sd="",xd={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Ld={};function Md(t,e){if(t.enumSource)return{appId:Sd,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Ld["".concat(t.type,"_").concat(e)]}async function Rd(t,e,i){var a;if(!t.properties)return[];const{properties:n}=t;if(!(Object.keys(n).length>0))return[];const s=[];Object.keys(n).forEach((t=>{let e;switch(n[t].type){case"string":e="string","date-time"===n[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:n[t].type}))}s.push({key:t,description:n[t].description,type:e,enumSource:n[t].enumSource})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e,i)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const r=[];return s.forEach((t=>{const e=xd[t.type];e?e.forEach((e=>{t&&r.push({appId:Sd,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Sd,valueOP:e},editor:Md(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(xd).forEach((t=>{xd[t].forEach((e=>{if(Ad.includes(e))return;const i="".concat(t,"_").concat(e);Ld[i]||("date"!==t||["IN","NOTIN"].includes(e)?Ld[i]={appId:Sd,editorType:"TEXTBOX",id:i}:Ld[i]={appId:Sd,editorType:"DATEPICKER",id:i})}))}));var Od=/^N_(.\w+)_(.\w+)$/,_d=t("SearchBarFilterItemsController",class extends Td{constructor(t,e,i,a){super(t[0],e,i,a),this.filterModels=t,this.allFields=[],this.subFilterCMap=new Map,this.type="ITEMS"}calcKey(t,e){return"".concat(t.toUpperCase(),"_").concat(e.toUpperCase())}async initMinorAppDE(){var t;const e=this.filterModels[0].appDEFieldId;let i="";if(null==(t=this.appDataEntity.appDEMethodDTOs)||t.find((t=>{var a;const n=null==(a=t.appDEMethodDTOFields)?void 0:a.find((t=>t.appDEFieldId===e));return!!n&&(i=n.refAppDataEntityId,!0)})),!i)throw new o(ibiz.i18n.t("runtime.controller.control.searchBar.noFoundEntity",{targetField:e}));this.minorAppDE=await ibiz.hub.getAppDataEntity(i,this.context.srfappid)}async initAllFields(){var t;const e=new Map;this.filterModels.forEach((t=>{var i;const a=(null==(i=t.defsearchMode.codeName)?void 0:i.split("__")[1]).match(Od),n=a[1],s=a[2],o=it(t);o.defsearchMode.valueOP=s,o.id=n;const r=new Td(o,this.appDataEntity,this.context,this.params);this.subFilterCMap.set(this.calcKey(n,s),r),r.hidden||(e.has(n)||e.set(n,{name:n,label:"",valueOPs:[],fieldName:n}),e.get(n).valueOPs.push(s))})),null==(t=this.minorAppDE.appDEFields)||t.forEach((t=>{const i=t.codeName.toUpperCase();e.has(i)&&(e.get(i).label=t.logicName)})),this.allFields=Array.from(e.values()),await Promise.all(Array.from(this.subFilterCMap.values()).map((t=>t.init())))}async init(){await this.initMinorAppDE(),await this.initAllFields(),this.hidden=Array.from(this.subFilterCMap.values()).every((t=>t.hidden))}getSubFilterController(t,e){return this.subFilterCMap.get(this.calcKey(t,e))}});function Fd(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function zd(t){const e={pass:!1};let i=!1,a=!1;return r(t[0],(t=>{a||("FIELD"===t.nodeType?(i=!0,a=!t.field||!t.valueOP||!Ad.includes(t.valueOP)&&Z(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function Vd(t,e){let i;if("GROUP"===t.nodeType){const a={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(a.searchconds=t.children.map((t=>Vd(t,e)))),i=a,t.notMode&&(a.notmode=t.notMode)}else if("FIELD"===t.nodeType){const e={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(e.value=t.valueItem),i=e}else{const a={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(a.searchconds=t.children.map((t=>Vd(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function kd(t,e){const{pass:i}=zd(t);if(!i)return;return t.map((t=>Vd(t,e)))}function Ud(t){var e,i;let a;if("GROUP"===t.condtype){const i={logicType:t.condop,nodeType:"GROUP",children:[]};(null==(e=t.searchconds)?void 0:e.length)&&(i.children=t.searchconds.map((t=>Ud(t)))),a=i,t.notmode&&(i.notMode=t.notmode)}else if("DEFIELD"===t.condtype){const e={nodeType:"FIELD",field:t.fieldname,value:t.value,valueOP:t.condop};t.valueItem&&(e.valueItem=t.valueItem),a=e}else{const e={nodeType:"ITEMS",field:t.fieldname,valueOP:t.condop,children:[]};(null==(i=t.searchconds)?void 0:i.length)&&(e.children=t.searchconds.map((t=>Ud(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function Bd(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>Bd(t)))),e=i,t.notMode&&(i.notmode=t.notMode)}else if("FIELD"===t.nodeType){const i={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(i.valueItem=t.valueItem),e=i}else{const i={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(i.searchconds=t.children.map((t=>Bd(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function Wd(t){const{pass:e}=zd(t);if(!e)return;return t.map(Bd)}var Gd=t("SearchBarFilterSimpleItemsController",class extends Td{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const n=Cd(t.defsearchMode.codeName);this.subFieldName=n.field,this.subValueOP=n.op}addSimpleFilterNode(t){Object.assign(t,{simple:!0,field:this.fieldName,nodeType:"ITEMS",valueOP:this.valueOP,children:[{nodeType:"FIELD",field:this.subFieldName,valueOP:this.subValueOP,value:null}]})}}),jd=/\$\{[^}]*\}/,Kd=(t("SearchBarController",class extends _r{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1,this.enableStorage=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")||this.ctx.getController("treegrid")}setStorageKeyFn(t){this.storageKeyFn=t}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.state.advancedQuickSearch=!1,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.state.quickSearchPlaceHolder="",this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.enableStorage="true"===this.controlParams.storage;const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder(),this.initAdvancedQuickSearch()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new Nd(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await Nr(this.model.appDataEntityId,this.context);if(!e)return;const i=await Rd(e,this.model.appDataEntityId,this.model.appId),a=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===i.findIndex((e=>{var i;return e.appDEFieldId===t.appDEFieldId&&(!(null==(i=t.defsearchMode)?void 0:i.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&a.push(t)})),i.length>0&&(this.model=it(this.model),this.model.searchBarFilters=i.concat(...a),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"),this.state.quickSearchPlaceHolder=this.placeHolder)}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}findFilterController(t,e){return this.filterControllers.find((i=>i.fieldName===t&&(!i.valueOP||i.valueOP===e)))}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query,this.state.advancedQuickSearch&&this.state.quickSearchFieldNames.length&&(e.queryconds=this.state.quickSearchFieldNames.map((t=>"n_".concat(t,"_like"))))),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=he(ei.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const i=this.calcFilters();return i&&(e.searchconds=i),e}resetFilter(){this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;if(null==(t=this.searchBarFilters)?void 0:t.length){const t=new Map;this.searchBarFilters.forEach((e=>{var i;if((null==(i=e.defsearchMode)?void 0:i.valueOP)&&vd.includes(e.defsearchMode.valueOP)){if(bd(e))return void this.filterControllers.push(new Gd(e,this.appDataEntity,this.context,this.params));const i="".concat(e.appDEFieldId,"_").concat(e.defsearchMode.valueOP);return t.has(i)||t.set(i,[]),void t.get(i).push(e)}const a=new Td(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new _d(t,this.appDataEntity,this.context,this.params);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init())))}}calcFilters(){if(!this.enableFilter)return;return kd(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&F(t.value)&&jd.test(t.value)&&(e.value=ei.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){var e;if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const i={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(i.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(i.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(i.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(i.show="1"===e.valid_flag)}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.searchBar.JSONFormat",{data:t.data}),e)}return t.defaultGroup&&(i.defaultSelect=!0),i})));const i=await this.service.fetch();if(i.ok&&i.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)S(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,i)=>e.order>this.state.searchBarGroups[t].order?i:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const t=null==(e=this.storageKeyFn)?void 0:e.call(this);if(t){const e=localStorage.getItem(t);if(e){if(this.state.searchBarGroups.find((t=>t.name===e)))return void(this.hasDefaultSelect=!0)}}}this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){var t;if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const e=null==(t=this.storageKeyFn)?void 0:t.call(this);if(e){const t=localStorage.getItem(e);if(t){const e=this.state.searchBarGroups.find((e=>e.name===t));if(e)return void this.handleGroupClick(e)}}}const e=this.state.searchBarGroups.find((t=>t.defaultSelect));e&&this.handleGroupClick(e)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:Wd(this.state.filterNodes),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}));else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(S(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){var e;if(this.enableStorage){const i=null==(e=this.storageKeyFn)?void 0:e.call(this);i&&t.name&&localStorage.setItem(i,t.name)}if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(S(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Ud(t)));this.state.filterNodes=e}else this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}];r(this.state.filterNodes[0],(t=>{"FIELD"===t.nodeType&&t.field&&t.valueOP&&F(t.value)&&jd.test(t.value)&&(t.disabled=!0)})),this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}initAdvancedQuickSearch(){var t;2===this.model.quickSearchMode&&(null==(t=this.model.searchBarQuickSearchs)?void 0:t.length)&&(this.state.advancedQuickSearch=!0,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.model.searchBarQuickSearchs.forEach((t=>{const e=Se(this.appDataEntity,t.appDEFieldId),i=e.codeName.toLowerCase();this.state.quickSearchItems.push({fieldName:i,label:e.logicName}),this.state.quickSearchFieldNames.push(i)})),this.calcQuickSearchPlaceHolder())}calcQuickSearchPlaceHolder(){if(this.state.advancedQuickSearch)if(this.state.quickSearchFieldNames.length){const t=[];this.state.quickSearchItems.forEach((e=>{this.state.quickSearchFieldNames.includes(e.fieldName)&&t.push(e.label)})),this.state.quickSearchPlaceHolder=t.join("、")}else this.state.quickSearchPlaceHolder=this.placeHolder}}),t("TabExpPanelController",class extends _r{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName="",this.state.expViewParams={}}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&dr(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const i=this.getNavViewMsg(t);!0===e&&(i.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:i}),this.evt.emit("onTabChange",{tab:t})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:i,navigateContexts:a,navigateParams:n,appDataEntityId:s}=t,o={deName:Ae(s),navFilter:i,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:a,navParams:n},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ge(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d,...this.state.expViewParams}}}getNavViewMsg(t){const{context:e,params:i}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:i,viewId:t.embeddedAppDEViewId,isCache:this.isCache,modalOptions:{replace:!0}}}refresh(){const t=this.getNavViewMsg(this.activeTabViewPanelModel);t.key+=ht(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends no{async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const n=Re(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:i});if(0===n.length)return;(await Si(n.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,n){const s=0===Re(this.model,{parentId:t.id,hasQuery:n.hasQuery}).length,o={...n,leaf:s};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,i,o)];break;case"DE":r=await this.getDENodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.md.noSupport",{treeNodeType:t.treeNodeType}))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return s||await Promise.all(r.map((async(t,e)=>{var i;if(d&&(!c||c&&0===e)||(null==(i=n.defaultExpandedKeys)?void 0:i.length)&&n.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,n);t._children=e}}))),r}async getStaticNodeData(t,e,i,a){return new Po(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}getNodeRSFilterParams(t,e,i){const{parentValueLevel:a,navigateContexts:n,navigateParams:s,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...i.params},l={...i.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<a;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Me(this.model,h._nodeId);t.appDataEntityId&&(p=Ae(t.appDataEntityId)),u=h._value}const{resultContext:g,resultParams:f}=ge({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:s,navContexts:n},{derValue:u,context:l,params:d,data:m});return Object.assign(l,g),Object.assign(d,f),{context:l,params:d,navContext:g,navParams:f}}async getDENodeDatas(t,e,i,a){const{appDEDataSetId:n,appDataEntityId:s}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(s,n,o,r);if(l.data.length){return l.data.map((e=>new Ao(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}return[]}async getCodeListNodeDatas(t,e,i,a){const{context:n,params:s,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,n,s);if(c.length){return c.map((e=>new Do(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}return[]}async removeItem(t,e,i={}){var a;const n=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.execWithEntityId(t,n,e,void 0,i)}async execWithEntityId(t,e,i,a,n){const s=this.handleCustomRequestHeader();return await this.app.deService.exec(t,e,i,a,n,s)}})),Hd=t("TreeController",class extends Fr{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),i=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,i;(null==(i=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:i.length)&&(this.contextMenus[t.decontextMenu.id]=new kc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new Kd(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await qs.getCounterByRef(e,this.context,{...this.params}))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Re(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var i;if(null==(i=t.parentDER1N)?void 0:i.pickupDEFName){const i=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==i?void 0:i.treeNodeType)&&i.appDataEntityId&&e.push({minorEntityId:i.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const i=t.decontextMenu;if(null==(e=null==i?void 0:i.detoolbarItems)?void 0:e.length){let e=0;const a=[];r(i,(t=>{if("DEUIACTION"===t.itemType){e+=1;const i=t;200===i.actionLevel&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:a[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let i;e&&await this.startLoading();try{i=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),i}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),i=!!e.query;let a;this.state.isLoading=!0;try{a=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:i,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=a:this.state.rootNodes=a,await this.afterLoadNodes(a),a}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var i;const a=null==(i=this.contextMenuInfos[t._nodeId])?void 0:i.clickTBUIActionItem;if(a)return this.doUIAction(a.uiactionId,t,e,a.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect&&!t._disableSelect){const{selectedData:e}=this.state,i=e.filter((e=>e._id!==t._id));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const i=this.state.expandedKeys.includes(t._id);if(e&&!i)this.state.expandedKeys.push(t._id);else if(!e&&i){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),i=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(i)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,i,a){const n=this.getEventArgs(),s=this.parseTreeNodeData(e),o=await xc.exec(t,{...n,...s,event:i},a);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var i;(null==(i=t._children)?void 0:i.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const n=e?a._parent:a,s=await this.loadNodes(n);this._evt.emit("onAfterRefreshParent",{parentNode:n,children:s})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const i=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==i.length&&await Promise.all(i.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,i){var a,n;const s=this.getNodeModel(t._nodeId);if("inner"===i){const t=this.getNodeModel(e._nodeId);return!!this.findDropNodeRS(e._nodeId,s.appDataEntityId)&&!!(null==t?void 0:t.allowDrop)}if((null==(a=t._parent)?void 0:a._id)===(null==(n=e._parent)?void 0:n._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,s.appDataEntityId)}findDropNodeRS(t,e){const i=this.dropNodeRss.get(t);return null==i?void 0:i.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,a){var n,s,o;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===a?e:e._parent,l=(null==e?void 0:e._id)!==(null==(n=t._parent)?void 0:n._id);let h=this.getNodeModel(e._nodeId);if("inner"===a||(null==(s=e._parent)?void 0:s._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===a)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let i=d._children.indexOf(e);"next"===a&&(i+=1),d._children.splice(i,0,t)}("inner"===a||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:g}=h;if(!0===g){if(!p)throw new i(h,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=p.toLowerCase(),a="ASC"===m,n=[...d._children];a||n.reverse();const s=t=>t+(100-t%100),o=t=>t[e]||0;let c;n.forEach(((i,a)=>{const d=i._deData;void 0===c?i===t&&(c=0===a?100:s(o(n[a-1]._deData)),d[e]=c,-1===r.indexOf(i)&&r.push(i)):(c>=o(d)&&(d[e]=s(c),r.push(i)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const i=this.getNodeModel(t._nodeId);let a=t._deData;t._changedOnly&&(a=t.getDiffData());const n=Ae(i.appDataEntityId),s=this.context.clone();s[n]=a.srfkey;const o=await e.deService.exec(i.appDataEntityId,"update",s,a);o.data&&(t._deData=o.data,t._oldDeData=o.data.clone())})))}async modifyNodeText(t,e){const a=this.getNodeModel(t._nodeId);if(!a.allowEditText)throw new i(a,ibiz.i18n.t("runtime.controller.control.tree.editMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.tree.nodeData"));t._text=e,await this.updateDeNodeData([t]),this.emitDEDataChange("update",t._deData)}async handleItemRemove(t,e,i){let a=!1;const n=this.getNodeModel(t._nodeId);if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeNode"));const s=n.appDataEntityId;if(s){const n=Ae(s);if(0!==t.srfuf){const o=e.clone();o[n]=t.srfkey,await this.service.removeItem(s,o,i),a=!0}}return a}onDEDataChange(t){if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if("OBJECTCREATED"===t.subtype)return;const e=t.data,i=this.state.items.find((t=>"DE"===t._nodeType&&t._deData&&t._deData.srfdecodename===e.srfdecodename&&t._deData.srfkey===e.srfkey));i&&this.doNextActive((()=>this.refreshNodeChildren(i,!0)),{key:"refresh".concat(i._id)})}}),Xd=t("WizardPanelService",class extends ao{async initialize(t,e={},i={}){var a;const n=null==(a=this.model.initControlAction)?void 0:a.appDEMethodId;let s=await this.exec(n,t,e,i);return s=this.handleResponse(s),s}async finish(t,e={},i={}){var a;const n=null==(a=this.model.finishControlAction)?void 0:a.appDEMethodId;let s=await this.exec(n,t,e,i);return s=this.handleResponse(s),s}}),qd=(t("WizardPanelController",class extends _r{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}getData(){return[this.formData]}initState(){super.initState(),this.state.buttonsState=new or}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,i,a,n;t.firstForm&&(this.firstForm=t);const s="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(a=null==(i=this.model.dewizard)?void 0:i.dewizardSteps)?void 0:a.find((e=>e.id===t.dewizardStepId)),r=null==o?void 0:o.stepTag;this.stepTags[s]=r,null==(n=t.stepActions)||n.forEach((e=>{const i="".concat(t.formTag,"@").concat(e),a=new sr(i,this.context.srfappid);a.visible=!this.getStepScriptCode(t,e),this.state.buttonsState.addState(i,a)}))})),this.state.buttonsState.init(),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new Xd(this.model),await this.service.init(this.context);const{deeditForms:i}=this.model;i&&i.length>0&&await Promise.all(i.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const i=await _n(t);i&&(this.providers[e]=i)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardForm",{activeFormTag:t})),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.formController",{activeFormTag:t}));return e}async onFormMounted(t,e){const i=e.ctrl;this.formControllers.set(t,i),i.evt.on("onFormDataChange",(t=>{this.calcButtonState(t.data[0])}));const a=await i.load();this.calcButtonState(i.data),Object.assign(this.formData,a)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const i=Ae(this.model.appDataEntityId);!this.context[i]&&e&&e.srfkey&&(this.context[i]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noConfiguration"));const i=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardFormIdentifier",{tag:t}));return i}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){let t;try{t=await this.service.initialize(this.context,{},this.params)}catch(t){throw this.actionNotification("INITIALIZEERROR",{error:t}),t}const e=Ae(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){try{await this.service.finish(this.context,this.formData,this.params)}catch(t){throw this.actionNotification("FINISHERROR",{error:t}),t}this.evt.emit("onFinishSuccess",void 0),this.actionNotification("FINISHESUCCESS")}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noPreviousForm"));this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save({silent:!0});let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,i=this.model.dewizard.dewizardForms;if(t&&i){const i=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),a=t[i+1];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextStep"));const n=this.getWizardFormByTag(a.stepTag);n&&n.formTag&&(e=n.formTag)}}if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextForm"));this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save({silent:!0}),await this.finish()}getStepScriptCode(t,e){switch(e){case"PREV":return t.goPrevEnableScriptCode;case"NEXT":return t.goNextEnableScriptCode;case"FINISH":return t.goFinishEnableScriptCode}}async calcButtonState(t){var e;const{activeWizardForm:i}=this;if(i){let a=t;a&&a instanceof io&&(a=a.getOrigin()),null==(e=i.stepActions)||e.forEach((t=>{const e=this.state.buttonsState["".concat(i.formTag,"@").concat(t)],n=this.getStepScriptCode(i,t);e&&n&&(e.visible=!!ei.execScriptFn({view:this.view,context:this.context,params:this.params,data:a,env:ibiz.env},n,{isAsync:!1,singleRowReturn:!0}))}))}}}),t("MDCtrlService",class extends no{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const n=i.toLowerCase();a=new To(e,n,{isOriginField:!0,dataType:t.dataType})}else a=new To(e,e);this.dataUIMap.set(e,a)}))}})),Yd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),Qd=(t("MDCtrlController",class extends Fr{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new qd(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!0})),{key:"refresh"})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new Yd(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new Yd(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,i){const a=t.uiactionId;await xc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.view,event:i},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:i}=this.model;e&&this.initUIActionGroup(t,e),i&&this.initUIActionGroup(t,i)}initUIActionGroup(t,e){var i;(null==(i=e.uiactionGroupDetails)?void 0:i.length)||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new or;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new sr(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.data.getOrigin()),t.uaColStates[e.id]=a}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(new Yd(e,this)))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,n=new Map;this.groupCodeListItems.forEach((t=>{n.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=n.get(i);a&&a.push(new Yd(e,this))}));const s=[];n.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));s.push({caption:i.text,key:i.value,children:t})})),this.state.groups=s}}),t("KanbanService",class extends Wc{async updateGroup(t,e){var i;const a=(null==(i=this.model.updateGroupControlAction)?void 0:i.appDEMethodId)||"update";let n=await this.exec(a,t,e.getOrigin());return n=this.handleResponse(n),n}})),$d=(t("KanbanController",class extends Gc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new Qd(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.readonly=!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly),this.state.draggable=this.enableEditOrder||this.enableEditGroup,this.state.uaState={}}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortingProperties"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortDirection"));const n="ASC"===a;t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>n?t[e]-i[e]:i[e]-t[e]))}async afterLoad(t,e){var i;this.sortItems(this.state.items),super.afterLoad(t,e);const a=[];return null==(i=this.model.dedataViewItems)||i.forEach((t=>{"ACTIONITEM"===t.itemType&&t.deuiactionGroup&&t.deuiactionGroup.uiactionGroupDetails&&a.push(...t.deuiactionGroup.uiactionGroupDetails)})),a&&a.length>0&&e.forEach((t=>{const e=new or;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new sr(t.id,this.context.srfappid,i);e.addState(t.id,a)}})),this.state.uaState[t.srfkey]=e})),e.forEach((t=>{this.state.uaState[t.srfkey]&&Object.keys(this.state.uaState[t.srfkey]).length>0&&this.state.uaState[t.srfkey].update(this.context,t.getOrigin(),this.model.appDataEntityId)})),e}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,i){this.setSelectGroup(i.key),super.onGroupToolbarClick(t,e,i)}async onGroupActionClick(t,e,i,a){this.setSelectGroup(a.key);const n={...this.params,srfgroup:a},s=t.uiactionId;await xc.execAndResolved(s,{context:this.context,params:n,data:[e],view:this.view,event:i},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o(ibiz.i18n.t("runtime.controller.control.kanban.groupedOn"));return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));a.push({caption:i.text,color:i.color,key:i.value,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,n=new Map;this.groupCodeListItems.forEach((t=>{n.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=n.get(i);a&&a.push(e)}));const s=[];n.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));s.push({caption:i.text,color:i.color,key:i.value,children:t})})),this.state.groups=s}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.adjustmentsGroup"));const e="ASC"===this.model.minorSortDir,{from:i,to:a,fromIndex:n,toIndex:s}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===i)),l=this.state.groups.find((t=>t.key===a));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.noAllowReorder"));const e=d.children[n];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[n];t.from!==t.to?(m[o]=t.to,p.splice(s,0,m)):(p.splice(n,1),p.splice(s,0,m));const g=d.children.splice(n,1);let f;l.children.splice(s,0,...g),e||(u.reverse(),p.reverse());let y,w=[];p.forEach(((t,e)=>{void 0===f?t!==u[e]&&(f=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=f,c.push(t)):(f>=t[r]?(w.length>0&&(w.forEach((t=>{t[r]=h(y),c.push(t),y=t[r]})),f=y,y=0,w=[]),t[r]=h(f),c.push(t)):(0===w.length&&(y=f),w.push(t)),f=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.updateGroup(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,i){const a=this.state.groups.find((e=>e.key===t));a&&(a[e]=i)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const i=t.split("quicktoolbar_")[1];this.setGroupController(i,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const i=t.split("batchtoolbar_")[1];this.setGroupController(i,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Kd{})),Jd=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{let i;this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.name],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})})))}}),Zd=t("TreeGridExController",class extends Hd{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new $d(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await vs(t);if(!e)return;this.providers[t.codeName]=e;const i=await e.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=i:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=i)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,i)=>{t.uaColumn&&(t.fixed=i+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new Jd(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.md.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.md.noChange"));if(e.processing)return void await x(500,this.save.bind(this),[t]);const a=this.getNodeModel(t._nodeId),{appDataEntityId:n,updateAppDEActionId:s}=a,r=0===t._deData.srfuf;if(r)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noSupportCreation"));if(!s)throw new i(a,ibiz.i18n.t("runtime.controller.control.treeGridEx.updateBehavior"));const c=Ae(n),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(n,s,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await Si(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((i=>{i.gridStateNotify(t,e)}))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||lr(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Si(Object.values(this.columns).map((async i=>i.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const i={};return Object.values(this.fieldColumns).forEach((a=>{const n=a.nodeColumnControllerMap.get(t._nodeId);if(!n||!n.nodeEditItem)return;const{createDV:s,createDVT:o,updateDV:r,updateDVT:c}=n.nodeEditItem,d=e?o:c,l=e?s:r,h=gr({name:a.name,valueType:d,defaultValue:l,valueFormat:n.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(i[a.name]=h)})),i}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data._deData.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}}),tl=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),el=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:a,detreeNodeDataItems:n,detreeNodeEditItems:s}=e,o=null==a?void 0:a.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==n?void 0:n.find((t=>t.id===o.dataItemName));if(!o||!r)throw new i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.noConfigured",{name:this.fieldColumn.name}));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==s?void 0:s.find((t=>t.id===o.id));if(!t)throw new i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.editItem",{name:this.fieldColumn.name}));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Vn(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const i=new or;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new sr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.name]=i}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const i=this.nodeColumn.linkValueItem||"srfkey",a=t.data[i];if(null==a)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noPickedUp",{valueItem:i}));const{linkAppViewId:n}=this.nodeColumn;if(!n)return;const s=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:a,...s}),c=it(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:i}=we(d);let a={};e&&t.data&&(a=he(e,t.data,c,r)),Object.assign(r,a);let n={};i&&t.data&&(n=he(i,t.data,c,r)),Object.assign(c,n)}const l=await ibiz.commands.execute(Bo.TAG,n,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const i=this.nodeColumn.deuiactionId;await xc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return mr.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(u.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}async setRowValue(t,e,i){i=i||this.name,await this.treeGrid.setRowValue(t,i,e)}}),il=(t("TreeGridExFieldColumnController",class extends tl{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new el(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const i=this.nodeColumnControllerMap.get(t.data._nodeId);i&&i.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends tl{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const i=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));i&&this.nodeColumnMap.set(t.id,i)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const i=this.nodeColumnMap.get(t.data._nodeId);i.deuiactionGroup&&(e=i.deuiactionGroup)}return e}initActionStates(t){var e;const i=this.getUIActionGroup(t);if(!i)return void ibiz.log.warn(ibiz.i18n.t("runtime.controller.control.treeGridEx.behaviorGroup",{id:this.model.id}));if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new or;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new sr(t.id,this.treeGrid.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.model.id]=a}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}}),t("TreeGridController",class extends gd{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const a=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),n=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnsSchema"));if(!n)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnMode"));this.treeGridValueField=n.appDEFieldId.toLowerCase(),this.treeGridParentField=a.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends pd{}),t("MEditViewPanelService",class extends no{})),al=(t("MEditViewPanelController",class extends Fr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new il(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const i=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(i.appDataEntityId){const a=await ibiz.hub.getAppDataEntity(i.appDataEntityId,i.appId);this.parameters=i&&a?[{parameterName:null==(t=a.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=a.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const i=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,i),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===i.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,i={id:t[e]?t[e]:"mockId:".concat(ht()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:a,pathName:n}=e;t[a]&&!Object.is(t[a],"")&&Object.assign(i.context,{[n]:t[a]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(i,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(i,{srfmajortext:ibiz.i18n.t("runtime.controller.control.meditViewPanel.DraftNew")})})),i}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let i=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(i=!0),await this.handleDelete(t),i&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const i=this.state.panelUiItems.findIndex((t=>t.id===e));if(i<0)throw new o(ibiz.i18n.t("runtime.controller.control.meditViewPanel.dataExist"));const a=this.state.panelUiItems[i];a.id.startsWith("mockId:")?this.state.panelUiItems[i]=this.handlePanelItemParams(t):a.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[i].id)}}),t("MapService",class extends no{async init(t){await super.init(t)}async fetchAll(t,e={}){var i;const a=[];if(null==(i=this.model.sysMapItems)?void 0:i.length){const i=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async n=>{const{appDataEntityId:s,appDEDataSetId:o,customCond:r}=n,c=t.clone(),d={...e};if(r){const i=ei.execSingleLine(r);if(i){const{navigateContexts:a,navigateParams:n}=we(i);a&&Object.assign(c,he(a,e,t)),n&&Object.assign(d,he(a,e,t))}}const l=await i.deService.exec(s,o,c,d);l.data&&a.push(...l.data.map((t=>new xo(t,n))))})))}return new l(a,200)}})),nl=(t("MapController",class extends Fr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new al(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);i.srfareacode=this.state.areaCode;const n=await this.service.fetchAll(i,a);this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const i=await super.afterLoad(t,e),a=[],n=[];return i.forEach((t=>{"REGION"===t._itemStyle?a.push(t):"POINT"===t._itemStyle&&n.push(t)})),this.state.pointData=n,this.state.areaData=a,i}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const i=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=i;break;case"strareacode":this.state.strAreaCode="true"===i;break;case"jsonbaseurl":this.state.jsonBaseUrl=i}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends ao{async fetch(t,e={}){this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(this.dataEntity.deapicodeName2,"/report?srfreporttag=").concat(this.model.codeName);let a=await ibiz.net.request(i,{method:"post",data:e});return a=this.handleResponse(a),a}})),sl=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},ol=class extends sl{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},rl=class extends sl{},cl=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.reportType"));switch(t.appDEReport.reportType){case"USER":return new ol(t);case"USER2":return new rl(t);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},dl=(t("ReportPanelController",class extends _r{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=cl.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new nl(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam),a=await this.service.fetch(e,i);this.state.data=a.data,await this.afterLoad(t,a.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}}),t("GanttService",class extends Kd{async getNodeDraft(t,e,i,a){var n;const{appDataEntityId:s}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},l=await this.app.deService.exec(s,"getdraft",o,r),{data:h}=l;return(null==(n=null==e?void 0:e.parentDER1N)?void 0:n.pickupDEFName)&&i&&(h[e.parentDER1N.pickupDEFName]=i._value),new _o(this.model,t,i,{data:l.data,leaf:!0,navContext:c,navParams:d})}async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const n=Re(this.model,{parentId:t._nodeId,hasQuery:i});if(0===n.length)return;(await Si(n.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,n){const s=0===Re(this.model,{parentId:t.id,hasQuery:n.hasQuery}).length,o={...n,leaf:s};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,i,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.md.noSupport",{treeNodeType:t.treeNodeType}))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return s||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,n);t._children=e}}))),r}async getStaticGanttNodeData(t,e,i,a){return new Oo(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}async getDEGanttNodeDatas(t,e,i,a){const{appDEDataSetId:n,appDataEntityId:s}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(s,n,o,r);if(l.data.length){return l.data.map((e=>new _o(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}return[]}async getCodeListGanttNodeDatas(t,e,i,a){const{context:n,params:s,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,n,s);if(c.length){return c.map((e=>new Fo(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}return[]}})),ll=(t("GanttController",class extends Zd{initState(){super.initState(),this.state.ganttStyle={},this.state.sliderDraggable=!0}handleControlParams(){super.handleControlParams(),this.controlParams.sliderdraggable&&(this.state.sliderDraggable="true"===this.controlParams.sliderdraggable)}onDataChange(t){}async initService(){this.service=new dl(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}async onCreated(){await super.onCreated(),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){const e=this.parseTreeNodeData(t);return"DE"===t._nodeType&&await this.onNodeDataActive(e),this.evt.emit("onActive",{...e,nodeData:t})}async onNodeDataActive(t){(await this.openData(t)).cancel||this.refreshNodeChildren(t.data[0],!0)}async refresh(){this.doNextActive((async()=>{const t=await this.load({isInitialLoad:!1}),e=this.model.rootVisible?t:t[0]._children;e&&await this.handleDefaultExpandNodes(e)}),{key:"refresh"})}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.notFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const n=e?a._parent:a,s=await this.loadNodes(n);await this.handleDefaultExpandNodes(s),this.evt.emit("onAfterRefreshParent",{parentNode:n,children:s})}async handleDefaultExpandNodes(t){for(let e=0;e<t.length;e++){const i=t[e];if(this.state.expandedKeys.includes(i._id)){const t=i.srfkey?"srfkey":"_id",e=this.state.items.find((e=>e[t]===i[t])),a=await this.loadNodes(e);await this.handleDefaultExpandNodes(a)}}}async openData({data:t,context:e,params:a}){var n,s;const o=t[0],r=this.getNodeModel(o._nodeId),{appDataEntityId:c}=r;e[Ae(c).toLowerCase()]=null==(n=o._deData)?void 0:n.srfkey;const d=await(null==(s=this.viewScheduler)?void 0:s.triggerCustom("".concat(r.id.toLowerCase(),"_opendata"),{context:e,params:a,data:t,event:void 0,view:this.view,ctrl:this}));if(-1===d)throw new i(r,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:r.id.toLowerCase()}));return{cancel:!d.ok}}async setRowValue(t,e,i){const{beginDataItemName:a,endDataItemName:n}=this.model;if(!Object.prototype.hasOwnProperty.call(t.data,e)||lr(t.data[e],i)){t.data[e]=i,e===a?t.data._beginDataItemValue=i:e===n&&(t.data._endDataItemValue=i),t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async modifyNodeTime(t,{begin:e,end:i}){if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.md.noNode"));const a=this.getRowState(t._id);if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.md.rowData"));const{beginDataItemName:n,endDataItemName:s}=this.model;this.setRowValue(a,n,e),this.setRowValue(a,s,i),await this.save(a.data)}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.md.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.md.noChange"));if(e.processing)return void await x(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:a}=i,n=0===t._deData.srfuf,s=Ae(a),r=this.context.clone();r[s]=t._deData.srfkey;const c=ibiz.hub.getApp(this.context.srfappid);let d;try{d=await c.deService.exec(a,n?"create":"update",r,t._deData)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=d.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this.evt.emit("onBeforeRemove",void 0),await this.startLoading();let n,s=!1;try{const o=ibiz.hub.getApp(this.context.srfappid);await Si(a.map((async t=>{if("DE"===t._nodeType){const a=e.clone(),r=this.getNodeModel(t._nodeId);if(r&&0!==t._deData.srfuf){const{appDataEntityId:e}=r;if(a[Ae(e)]=t.srfkey,await o.deService.exec(e,"remove",a,i),!n&&t._parent){const e=this.getNodeData(t._parent._id);n=e}s=!0}this.afterRemove(t)}}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.control.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),s&&n&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(n)}catch(e){throw await this.evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this.evt.emit("onRemoveSuccess",void 0)}afterRemove(t){var e;const i=this.state.items.findIndex((e=>e._uuid===t._uuid));if(-1!==i&&this.state.items.splice(i,1),this.state.rows[t._uuid]&&delete this.state.rows[t._uuid],t._parent){const i=this.getNodeData(t._parent._id),a=i._children.findIndex((e=>e._uuid===t._uuid));-1!==a&&(null==(e=i._children)||e.splice(a,1))}}async newRow(t={}){var e;const{data:i}=t,{editShowMode:a}=ibiz.config.grid;if("row"===a){if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.md.firstComplete"))}let n,s;if(i){const t=Array.isArray(i)?i[0]:i;s=this.getNodeData(t._id),n=this.getNodeModel(s._nodeId)}else s=this.state.rootNodes[0],n=Le(this.model);if(n){let t,i;if(Re(this.model,{parentId:n.id,hasQuery:!1}).forEach((e=>{const a=this.getNodeModel(e.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&(t=e,i=a)})),i){let n;try{n=await this.service.getNodeDraft(i,t,s,{hasQuery:!1,context:this.context.clone(),params:this.params})}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const o=this.calcDefaultValue(n,!0);Object.assign(n,o);const r=this.getRowState(s._id);(null==(e=s._children)?void 0:e.length)?s._children.push(n):s._children=[n],this.state.items.push(n);const c=new Jd(n,this);this.state.rows[n._uuid]=c,this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(c,!0),this.evt.emit("onNewRow",{row:r}),this.actionNotification("GETDRAFTSUCCESS",{data:n})}}}async onNodeDrop(t,e,a){var n,s;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const o=[],r=this.getNodeModel(t._nodeId),c="inner"===a?e:e._parent;let d=this.getNodeModel(e._nodeId);if("inner"===a||(null==(n=e._parent)?void 0:n._id)!==(null==(s=t._parent)?void 0:s._id)){const e=this.findDropNodeRS(c._nodeId,r.appDataEntityId);e&&(t._deData[e.pickupDEFName]=c._value,o.push(t),d=this.getNodeModel(e.childDETreeNodeId)),t._parent=c,t._nodeId=d.id}const{sortAppDEFieldId:l,sortDir:h,allowOrder:u}=d;if(!0===u){if(!l)throw new i(d,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=l.toLowerCase(),a="ASC"===h,n=c._children;a||n.reverse();const s=t=>t+(100-t%100),r=t=>t[e]||0;let u;n.forEach(((i,a)=>{const c=i._deData;void 0===u?i===t&&(u=0===a?100:s(r(n[a-1]._deData)),c[e]=u,-1===o.indexOf(i)&&o.push(i)):(u>=r(c)&&(c[e]=s(u),o.push(i)),u=r(c))}))}await this.updateDeNodeData(o)}onDEDataChange(t){}}),t("HubController",class{constructor(){this.session={}}async login(t,e,i,a,n){return await ibiz.appUtil.login(t,e,i,a,n)}async logout(t){return await ibiz.appUtil.logout(t)}async changePwd(t,e,i){return await ibiz.appUtil.changePwd(t,e,i)}async switchOrg(t,e,i){return await ibiz.appUtil.switchOrg(t,e,i)}async switchTheme(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}async switchLanguage(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}})),hl=class{constructor(){this.evt=new ut,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new co}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;if(t.data.actiontype&&"ASYNCCHATCOMPLETION"===t.data.actiontype)return;const e=this.formatAsyncAction(t.data);-1===this.actions.findIndex((t=>t.asyncacitonid===e.asyncacitonid))?this.add(e):this.update(e)}))}formatAsyncAction(t){if(["begintime","endtime","createdate","updatedate"].forEach((e=>{J(t[e])&&(t[e]=Ct(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!_(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!_(t.completionrate)){const e=Number(t.completionrate);Number.isNaN(e)?t.completionrate=void 0:t.completionrate=e}return t}add(t){this.actions.unshift(t),this.finishedStates.includes(t.actionstate)?this.noticeResult(t):(this.doingNum+=1,ibiz.notice.showDoingNotice({num:this.doingNum})),this.evt.emit("add",it(t)),this.evt.emit("dataChange")}update(t){const e=this.actions.findIndex((e=>e.asyncacitonid===t.asyncacitonid));this.actions.splice(e,1,t),this.finishedStates.includes(t.actionstate)&&(this.doingNum-=1,this.doingNum<=0&&ibiz.notice.closeDoingNotice(),this.noticeResult(t)),this.evt.emit("change",it(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}};function ul(t){if(""===t)return!1;const e=(new DOMParser).parseFromString(t,"text/html");return Array.from(e.body.childNodes).some((t=>1===t.nodeType))}var pl=class{constructor(){this.evt=new ut,this.total=0,this.unreadCount=0,this.page=0,this.size=20,this.messages=[],this.unreadOnly=!1,this.service=new Eo,this.ns=null,this.provider=null}async init(){this.listenMqtt(),await this.refreshUnreadCount()}async load(){try{await this.fetch(!1)}catch(t){ibiz.log.error(t)}}async loadMore(){await this.fetch(!0)}async refreshUnreadCount(){try{this.unreadCount=await this.service.getUnreadNum(),this.evt.emit("unreadCountChange",this.unreadCount)}catch(t){ibiz.log.error(t)}}toggleUnReadOnly(t){const e=void 0===t?!this.unreadOnly:t;this.unreadOnly!==e&&(this.unreadOnly=e,this.evt.emit("unreadOnlyChange",this.unreadOnly),this.load())}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"timestamp,desc"};this.unreadOnly&&(e.searchconds=[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]);const i=await this.service.fetch(e);this.total=i.total,t?this.messages.push(...i.data):this.messages=i.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{var e;ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&(t.content&&ibiz.notification.default({isHtmlDesc:ul(t.content),desc:t.content,position:"bottom-right",class:null==(e=this.ns)?void 0:e.b("notice"),onClick:()=>{const e=ibiz.env.isMob?t.mobileurl:t.url;this.provider&&this.provider.openViewByUrl(e)}}),this.refreshUnreadCount())}))}async markRead(t){const e=this.messages.find((e=>e.id===t.id));e&&"RECEIVED"===e.status&&(await this.service.markRead(t.id),e.status="READ",this.unreadCount-=1,this.evt.emit("unreadCountChange",this.unreadCount),this.evt.emit("dataChange"))}async batchMarkRead(){await this.service.batchMarkRead(),await this.fetch(),this.unreadCount=0,this.evt.emit("unreadCountChange",this.unreadCount)}async get(t){return(await this.service.get(t)).data}},ml=class{constructor(){this.evt=new ut,this.total=0,this.asyncAction=new hl,this.internalMessage=new pl}async init(){this.internalMessage.evt.on("unreadCountChange",(()=>{this.total=this.internalMessage.unreadCount,this.evt.emit("totalChange",this.total)})),await this.internalMessage.init(),await this.asyncAction.init()}},gl=class{constructor(){this.convert=new Xo,this.controller=new ll,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.drcontrols=new Map,this.dataEntities=new Map,this.config=new Yo,this.notice=new ml,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerSubAppDrControls(t,e){this.drcontrols.has(t)||this.drcontrols.set(t,[]);const i=this.drcontrols.get(t);null==i||i.push(e)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,i=-1){i<=0&&(i=50);const a=this.calcAppViewId(t);if(this.view2appMap.has(a)){const t=this.view2appPriorityMap.get(a);if(t&&t<i)return}this.view2appMap.set(a,e),-1!==i&&this.view2appPriorityMap.set(a,i)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppView(t){const e=this.calcAppViewId(t),i=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(i,e);return this.registerAppView(t),t}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}getSubAppDrControl(t,e){if(!this.drcontrols.has(e))return;return this.drcontrols.get(e).find((e=>e.uniqueTag===t))}async loadAppView(t,e,i){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,i)}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const i=this.dataEntities.get(e);if(-1===t.indexOf(".")){const e=Array.from(i.values()).find((e=>e.codeName===t));if(e)return e}else if(i.has(t))return i.get(t)}if(this.modelLoaderProvider){let i;return i=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(i,e),i}throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o(ibiz.i18n.t("runtime.utils.firstregister"));const e=await this.modelLoaderProvider.getApp(t),i=new Ko(e);return this.appMap.set(t,i),await this.modelLoaderProvider.initApp(t),await i.init(),this.configCache||(this.configCache=new Xs(ibiz.env.appId,"PSSysHub","Global")),i}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,i){return(await this.getAppAsync(t)).deService.getService(i,e)}reset(){this.appMap.clear(),this.configCache=void 0}destroy(){ibiz.hub.getAllApps().forEach((t=>{t.destroy()}))}},fl=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:i,engineCat:a}=t,n="".concat(a,"_").concat(i),s=this.viewEngines.get(n);if(s)return s(...e);ibiz.log.error(ibiz.i18n.t("runtime.engine.correspondingEngine",{key:n}),t)}}),yl=t("ViewEngineBase",class{constructor(t){this.view=t,this.init(),this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}init(){}handleContextParams(){}async onCreated(){const{childNames:t,modal:e}=this.view;e.hooks.shouldDismiss.tapPromise((async t=>{this.view.state.isLoading&&(t.allowClose=!1)})),t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug(ibiz.i18n.t("runtime.engine.deleteModel",{codeName:this.view.model.codeName,name:t.join(";")})),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((i=>{ye(t,i)||e.push(i)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob?(this.calcViewFooterVisible()||e.push("view_footer"),this.isExistAndInLayout("lefttoolbar")||this.isExistAndInLayout("righttoolbar")||!1!==t.showCaptionBar||e.push("view_toolbar")):ye(t,"toolbar")||e.push("view_toolbar","toolbar"),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const i=e.rootPanelItems||e.panelItems||[],a=i.findIndex((e=>t.includes(e.id)));-1!==a&&i.splice(a,1),i.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug(ibiz.i18n.t("runtime.engine.childComponentsMounted",{id:t.id,childName:e.join(";")}))}async onDestroyed(){}async call(t,e){return"GetData"===t?this.getData():"ShortCut"===t?this.onShortCut(e):void 0}async onShortCut(t){const{data:e}=t,{context:i,model:a,params:n,modal:s}=this.view;if(["EMBED","POPOVER"].includes(s.mode))throw new Error(ibiz.i18n.t("runtime.engine.minimization",{mode:s.mode}));const o=await ibiz.util.shortCut.calcShortCutKey({context:i,appViewId:a.id});if(!ibiz.util.shortCut.isExist(o)){const t=e&&e[0].srfmajortext||a.caption;return ibiz.util.shortCut.addShortCut({key:o,caption:t,icon:a.sysImage,appViewId:a.id,context:h.create(i),params:{...n},openMode:s.mode,fullPath:window.location.hash}),this.view.state.isShortCut=!0,this.view.closeView(),null}return ibiz.util.shortCut.removeShortCut(o),this.view.state.isShortCut=!1,null}initViewState(){}getData(){return[]}calcViewHeaderVisible(){let t=!1;const{model:e}=this.view;return e.showCaptionBar&&(t=!0),ibiz.env.isMob?(this.isExistAndInLayout("lefttoolbar")&&(t=!0),this.isExistAndInLayout("righttoolbar")&&(t=!0)):this.isExistAndInLayout("toolbar")&&(t=!0),t}isExistAndInLayout(t){const e=this.view.model.viewLayoutPanel;if(!e)return!1;const i=D(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,n=ye(a,t);let s=!(!i||!n);if("TOOLBAR"===(null==n?void 0:n.controlType)){const t=n.detoolbarItems;s=!!(s&&t&&t.length>0)}return s}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:i,params:a}=this.view;if(!t)throw new o(ibiz.i18n.t("runtime.engine.loadEntityData"));const n=ibiz.hub.getApp(i.srfappid),s=await n.deService.exec(t,"get",i,a),{data:r}=s;r&&(this.view.state.srfactiveviewdata=r,r.srfreadonly&&(this.view.context.srfreadonly=!0),e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),wl=(t("MDViewEngine",class extends yl{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get tabToolbar(){return this.view.getController("tabtoolbar")}get tabSearchForm(){return this.view.getController("tabsearchform")}get tabSearchBar(){return this.view.getController("tabsearchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar","tabtoolbar","tabsearchform","tabsearchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e,i;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const i=!!this.searchForm;e.state.keepAlive=i,e.state.visible=i&&!!t.expandSearchForm}if(this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchForm&&this.tabSearchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchBar&&this.tabSearchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault){const t=this.searchBar||this.tabSearchBar;t&&t.hasDefaultSelect&&("grid"===this.xdataControlName||"treegrid"===this.xdataControlName)?t.setDefaultSelect():this.load()}}handleContextParams(){super.handleContextParams(),this.view.context.srfsimple||(this.view.context.srfsimple=!0)}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){if("ToggleFilter"===t)return this.toggleFilter(),null;if("Edit"===t||"View"===t)return this.openData(e);if("New"===t)return this.newData(e);if("Remove"===t)return await this.remove(e),null;if("Import"===t)return await this.importData(),null;if("Refresh"===t)return await this.refresh(),null;if("ExportExcel"===t)return await this.exportData(e),null;if("Search"===t){const t=this.searchForm||this.tabSearchForm;return await t.search(),null}if("Reset"===t){const t=this.searchForm||this.tabSearchForm;return await t.reset(),null}return"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):"GetAllData"===t?this.xdataControl.state.items:super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:n,event:s}=t,o=(t.context||this.view.context).clone();o.srfpaginationviewid=this.view.id;const r=t.params||this.view.params;o[((null==(e=n[0].srfdecodename)?void 0:e.toLowerCase())||Ae(this.xdataControl.model.appDataEntityId)).toLowerCase()]=n[0].srfkey;const c=await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:o,params:r,data:n,event:s,view:this.view}));if(-1===c)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicOpendata"));return{cancel:!c.ok}}async newData(t){var e,a,n;const{data:s,event:o,copyMode:r}=t;if(!(null==(a=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:a.find((t=>"newdata"===t.id))))throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));const c=it(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(n=this.view.scheduler)?void 0:n.triggerCustom("newdata",{context:this.view.context,params:c,data:s,event:o,view:this.view}));if(-1===d)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),this.tabSearchForm&&Object.assign(t,this.tabSearchForm.getFilterParams()),this.tabSearchBar&&Object.assign(t,this.tabSearchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){const t=super.calcViewHeaderVisible();return this.calcViewSearchBarVisible()||t}calcViewSearchBarVisible(){const{model:t}=this.view,e=this.isExistAndInLayout("searchbar");if(!e)return e;const i=ye(t,"searchbar");return!(!i.enableQuickSearch&&!i.enableGroup&&!0!==i.enableFilter)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return ye(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),El=class{constructor(){this.layoutPanel=new oi,this.theme=new Di,this.text=new bi,this.hbs=new de,this.rawValue=new Ti,this.action=xc,this.error=new Bt,this.viewStack=new Ni,this.anime=new Wa,this.shortCut=new ja,this.file=new Ga,this.error.register(new Ut)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}setBrowserTitle(t){const e=ibiz.hub.getApp();let i="";i=ibiz.env.AppTitle?ibiz.env.AppTitle:e.model.title?e.model.title:wl,document.title=t?"".concat(i," - ").concat(t):i}getGlobalParam(){throw new o(ibiz.i18n.t("runtime.global.noImplemented"))}getRouterParams(){throw new o(ibiz.i18n.t("runtime.global.noImplementedRouting"))}},vl=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}destroy(){}},Il=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const i=this.constructorMap.get(t.logicType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.logicType",{logicType:t.logicType}));return i(t,e)}},bl=class extends vl{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,i){this.convertScriptArgs=e;const a=this.logic.scriptCode;this.scriptFn=ei.createScriptFn(t,a,i),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Dl=class extends vl{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return Sc(e,a,t)}},Cl=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const i=this.createTrigger(t);this.triggers.set(t.id,i),i.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),st(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((i=>{i.match(t)&&e.push(i)})),e}triggerAndExecute(t,e={}){const i=this.getMatchTriggers(t);if(i.length>0){const t=this.getExecuteParams(e);return i.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,i){const a={itemName:t,triggerType:e},n=this.triggerAndExecute(a,i);if(null==n?void 0:n.length)return n.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const i=this.triggers.get(t);if(!i)return-1;const a=this.getExecuteParams(e);return i.execute(a)}triggerControlEvent(t,e,i){const a={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,i)}},Al=class extends Cl{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Pl=class extends Cl{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Tl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const i=this.constructorMap.get(t.triggerType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.trigger.noSupportedType",{triggerType:t.triggerType}));return i(t,e)}},Nl=class{constructor(){this.executorFactory=new Il,this.triggerFactory=new Tl}createViewScheduler(t){return new Pl(t)}createControlScheduler(t){return new Al(t)}},Sl=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.noExecutorBound",{id:this.logic.id}))}destroy(){this.executor=void 0}},xl=class extends Sl{},Ll=class extends Sl{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.triggerType"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env","view"],(t=>{const{context:e,params:i,data:a,view:n}=t;return{context:e,params:i,data:(null==a?void 0:a[0])||{},env:ibiz.env,view:n}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,i;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(i=this.logic.itemName)?void 0:i.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Ml=class extends Sl{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.trigger.timerLacks"));this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.parameterCallback"));const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Rl=class extends vl{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:a,params:n,...s}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noActionableData"));let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.defaultOpendataViewLogic"));const d=c.refAppViewId;if(!d)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noActuallyReference"));const l=c.navigateContexts||[],h=Object.assign(a,he(l,r[0],n,a));let u={};const p=c.navigateParams;return ct(p)&&(u=he(p,r[0],n,a)),ibiz.commands.execute(Bo.TAG,d,h,u,{...s,openMode:c.openMode})}async calcOpenViewRef(t,e){const a=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),n=a.formTypeAppDEFieldId||a.dataTypeAppDEFieldId;if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.attributeConfiguration",{codeName:a.codeName}));const{data:s}=e,r=s[0][n];if(!r)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.entityAttributeValues"));const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.editViews",{formTypeValue:r}));return d}async executeNewDataAppUILogic(t,e){const{context:n,params:s,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=Ae(c.parentView.model.appDataEntityId),a=t.batchAddAppViews;if(p=null==a?void 0:a.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.selectionView"))}else{if(h)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.noSupportedBatchAddOnly"));if(p=u,!p||!p.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.newdataViewLogic"))}let m={},g={};const f=(null==r?void 0:r[0])||{},y=p.navigateContexts;ct(y)&&(m=he(y,f,s,n)),m=Object.assign(n,m);const w=p.navigateParams;if(ct(w)&&(g=he(w,f,s,n)),s.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const E=await ibiz.commands.execute(Bo.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&E.data&&await this.doBatchAdd(t,E.data,n,p,e.view),E}async getWizardNewViewRef(t,e){var a;const{wizardAppView:n,newDataAppViews:s}=t,{context:r,params:c,...d}=e;if(!n||!n.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.indexEntity"));const l=await ibiz.commands.execute(Bo.TAG,n.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(a=l.data)?void 0:a[0];if(!h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.checkOne"));const u=h.srfkey,p=null==s?void 0:s.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.entitiesAssociated",{indexType:u}));return p}async doBatchAdd(t,e,a,n,s){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),d=c.minorAppDERSs,l=n.refMode.toLowerCase();if(!d)throw new i(c,ibiz.i18n.t("runtime.logicScheduler.executor.relationships"));let h="";if(null==d||d.forEach((t=>{const e=Ae(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.foreignKey",{pickParentDeName:l}));const u={srfkey:h},p=null==(r=s.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,i]=e.split(":");t&&i&&(u[t]=i)}}ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.mappingProperties"),u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((i=>{const a=u[i];e[a]=t[i]})),e}));ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.newCreationData"),m);const g=ibiz.hub.getApp(a.srfappid).deService;await g.exec(c.id,"Create",a,m)}}},Ol=class extends Sl{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>hi[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},_l=class extends Sl{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>pi[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},Fl=class extends vl{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));xc.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.urlReg=/^http[s]?:\/\/[^\s]*/,this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Pt.dirname(this.url.pathname)}dir(t){return this.urlReg.test(t)?t:this.url.origin+Pt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.urlReg.test(t)?t:this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,i)=>{const a=document.createElement("link");a.setAttribute("type","text/css"),a.setAttribute("rel","stylesheet"),a.setAttribute("href",e),a.onload=t,a.onerror=i,document.head.appendChild(a)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,i){this.tag=t,this.repo=e,this.config=i}}),t("en",{runtime:{common:{unrealized:"unrealized"},command:{app:{noFindApplicationFunction:"An app feature called {appFuncId} cannot be found",noFindApplicationFunctionYype:"Unsupported application function type: {appFuncType}",noFindApplicationView:"The application view [{appViewId}] does not exist",unsupportedPopup:"Unsupported view opening modes: POPUP",unsupportedPopupapp:"Unsupported view opening modes: POPUPAPP",missingEvent:"Bubble opening missing event"}},controller:{common:{control:{componentActivation:"Component [{name}] ({id}) is active",componentPause:"Component [{name}] ({id}) is pause",unsupportedType:"Unsupported entity data change type: {type}",uncheckedData:"Unchecked data",dataDeletion:"data deletion",confirmDataDeletion:"Confirm deletion of data?",noImportModel:"No import model is configured!"},editor:{editorNoConfigured:"Editor type [{editorType}], code table not configured"},view:{viewActivation:"View [{name}] ({id}) is active",viewPause:"View [{name}] ({id}) is pause",viewDestroy:"View [{name}] ({id}) is destroy",noFoundViewEngine:"The View Engine implementation was not found:",noSupportBehavior:"No engine support for pre-built interface behavior {key}"}},control:{menu:{noFindMenu:"Cannot find menu item named {id}",noConfigured:"No application functionality configured"},calendar:{missingViewLogic:"Missing {itemType}_opendata view logic",noFoundModel:"Calendar item model not found"},chart:{noConfiguredX:"Sequence is not configured with X-axis",noConfiguredY:"Sequence is not configured with Y-axis",missingClassification:"Missing classification attribute configuration",missingValue:"Missing value attribute configuration",noSupportSequence:"Charts do not support sequence types at this time {seriesType}",noFindSequence:"Cannot find generator for {seriesIndex} sequence!",noInitialised:"The chart object is not properly initialised",noCalculated:"Options have not been calculated."},dataView:{noBehaviourGroup:"No interface behaviour group is configured for the action",noBehaviourGroupAction:"No interface behaviour is configured for the action item interface behaviour group",propertiesNoConfigured:"Grouping properties are not configured",tableNoConfigured:"The grouping code table is not configured",sortingItems:"Items with sorting enabled must be associated with an entity attribute"},expBar:{unableMore:"Unable to get multiple data widgets [{xdataControlName}] controller",multiNode:"Multi-node views are implemented by subclasses",noFindNodeModel:"Cannot find node model for {nodeId}"},form:{formCompletion:"Please check the form completion!",savedSuccessfully:"{srfmajortext}Saved successfully!",prompt:"prompt",deletion:"Confirm deletion?",itemUpdate:"No {formItemUpdateId} form item update was found.",processStarted:"Process started successfully",processSubmitted:"Process submitted successfully",lackBehavior:"Lack of return operation entity behavior",initializationException:"Initialization Exception: Form member [{id}]({detailType}) already exists, duplicate form item identifier Please check configuration!",relationshipInterface:"Receive data change events from the relationship interface",fillIn:"Please fill in {caption} ",unconfiguredWidgets:"Multi-data widgets unconfigured content widgets",noFoundFormController:"No form controller corresponding to {id} found",multiDataAddData:"Multi-data widget type {contentType} does not support adding data at the moment",mdControllerNoExist:"mdController does not exist",repeaterNoSupported:"Repeater styles are not supported at this time {detailStyle}",searchTerms:"No search terms found to apply",saveSearch:"No saved search criteria found"},md:{noNode:"Not entity gantt node data",rowData:"Row data does not exist",simpleMode:"Simple mode, no saving",nonentity:"Non-entity node data cannot be saved",noChange:"The value has not changed",dataDeleted:"Data [{str}] deleted successfully!",firstComplete:"Please complete the current line in the line editor first",noSupport:"{treeNodeType} node type not supported"},grid:{unsupported:"Unsupported types {type}",attributeColumns:"Attribute columns with no grouping attributes configured",noCodeTable:"The attribute column {groupFieldName} of the grouping attribute does not have a configuration code table",configureFirstColumn:"Please configure the grouping attribute column {groupFieldName} as the first column",requiresCodeTable:"Code table grouping mode requires code table configuration",noMatchCodeTable:"The grouping code table does not match the code table for the attribute column {groupFieldName}",convertedValue:"The sort attribute of {srfmajortext} cannot be converted to a value",missingConfiguration:"Missing configuration of aggregated entities or aggregated datasets",newRows:"New rows are not supported",saveCancel:"Row data validation failed, save cancel",noSupportRowEditing:"The current form does not support row editing, and you cannot toggle on row editing.",lineEditing:"Only one line can be open for line editing at the same time",updateColumns:"No {updateId} edit columns found for update",exported:"No exported data",tabularColumns:"No tabular columns",corresponding:"Corresponding table data item not found [{deField}].",pickedUpData:"The value of {valueItem} is not picked up in the row data.",noSupportedMode:"Attribute column aggregation mode {aggMode} is not supported yet.",remoteAggregation:"Remote aggregation is not supported yet",aggregateMode:"Aggregate mode is not supported yet {aggMode}",formattingError:"{aggValue} value formatting error",checksumErrors:"{codeName}Checksum errors, {fieldName}",behaviorGroup:"The action column does not have an interface behavior group configured",interfaceBehavior:"No interface behavior is configured for the action column interface behavior group"},kanban:{sortingProperties:"Sorting properties are not configured",sortDirection:"Sort direction is not configured",groupedOn:"Kanban components must be grouped on",adjustmentsGroup:"The current Kanban does not allow adjustments to the grouping!",noAllowReorder:"Current Kanban does not allow reordering!"},meditViewPanel:{DraftNew:"Draft - New",dataExist:"Edit View Panel widget UI data does not exist"},panel:{panelData:"Panel data not captured"},reportPanel:{reportType:"Report panel generator factory parameter error, report panel does not specify report type",noImplemented:"Specify the report {reportType} type report panel generator not implemented yet"},searchBar:{noFoundEntity:"Cannot find the associated entity corresponding to the attribute {targetField}.",missingModel:"Missing editor model",JSONFormat:"{data} non-standard JSON format:"},toolbar:{noFound:"Interface behavior model {actionId} not found"},tree:{noFoundTreeData:"Cannot find corresponding tree node data",sortAttribute:"Missing Configuration Sort Attribute",editMode:"The tree node is not configured for edit mode: name",nodeData:"Not entity tree node data",noFoundTreeNode:"Tree node not found"},treeGrid:{columnsSchema:"TreeTable Unvalued Columns Schema",columnMode:"Tree table without parent column mode"},treeGridEx:{noConfigured:"The node is not configured with a data item that corresponds to the table column {name}",editItem:"Edit item model corresponding to table column {name} was not found",noPickedUp:"The value of {valueItem} is not picked up in the row data.",behaviorGroup:"The {id} action column does not have an interface behavior group configured.",noSupportCreation:"Does not support the creation of new",updateBehavior:"Tree nodes are not configured to update entity behavior"},wizardPanel:{wizardForm:"Cannot find the wizard form for {activeFormTag}.",formController:"Cannot find a form controller for {activeFormTag}.",noConfiguration:"There is no Configuration Wizard form collection",wizardFormIdentifier:"Cannot find the wizard form with the {tag} identifier.",noPreviousForm:"No previous form",nextStep:"Cannot find next wizard step",nextForm:"Cannot find the next wizard form"}},utils:{buttonState:{isFinitenconsistency:"Inconsistency between entity {appDeName} of {uiActionId} interface behavior and entity {appDeId} of data"},counter:{decrement:"Decrement cannot be called for a count of 0!"},dataFileUtil:{startImport:"Start importing. Please refer to the application notification for detailed progress and results",noExist:"ibiz.util.getExportExcel does not exist",loadError:"Export module loading error",importData:"No corresponding import data model was found"},valueDefault:{noExist:"appdata.context does not exist",nosupported:"Default value type [{valueType}] not supported"},valueEx:{objectNameField:"Missing objectNameField"},valueRule:{length:"The length of the content must be less than or equal to {maxLength}, the current length is {length}."},viewMsg:{message:"Cannot find model for view message group {msgGroupId}",noFound:"No {message} view message model found",unconfigured:"Unconfigured entity dataset",unconfiguredEntities:"Application entities not configured"}}},deLogic:{deLogicLink:{connectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",entityConnectionConditional:"Entity Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",missingConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataMissingConditionValue:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",noSupportedTime:"Conditional value type [current time] is not supported at this time",entityLogicalConnection:"Entity Logical Connection Condition Item: {name} - Condition Value Type: {type} - Source Attribute Name: {dstField} - Source Object Value:",comparisonCondition:"-comparison condition: {op}",comparisonValue:"-comparison value",compareResults:"-Compare and contrast results:"},deLogicNode:{missingTargetParameter:"Missing target parameter object or source parameter object configuration",additionalParameter:"Entity logic node (appended to the array): {id} - additional parameter:",addedValue:"-Added value:",logicNodeParameterName:"Entity Logic Node (Binding Parameters): {id} - Parameter Name: {dstDELogicParamId} - Value:",copyParameter:"Entity logic node (copy parameter): {id} - parameter name: {dstDELogicParamId} - value:",dataSet:"Entity Logic Node (Data Set): {id} - Dataset Entity Id: {dstAppDataEntityId} - Dataset Id: {dstAppDEDataSetId} - Parameter Name: {retDELogicParamId} - Value:",unspecifiedEntity:"Unspecified application entity",unspecifiedBehavior:"Behavior of unspecified entities",entityActions:"Entity Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDELogicParamId} - Value:",unsupportedReturnType:"Unsupported end node return type: {returnType}",endNode:"Entity logic node (end node): {id} - return value type: {returnType} - return value:",noSupportedLogic:"Logic handling of parameter actions {paramAction} is not supported at this time.",preparationParameter:"Entity Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDELogicParamId} - Source Parameter (value):",targetParameter:"-Target parameter (value):",missingConfiguration:"Missing target parameter object configuration",rebuildParameter:"Entity Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDELogicParamId}",resetParameter:"Entity logic node (reset parameter): {id} - reset parameter: {dstDELogicParamId}",missingParameterProperty:"Missing target parameter object or target property configuration",sortedArrayParameters:"Entity Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDELogicParamId} - Sorted Array:",startupNode:"Entity logical node (startup node): {id}",throwsException:"Entity Logic Node (throws exception): {id} - Error Code: {errorCode} - Error Message: {errorInfo}",environmentVariables:"Unsupported logical parameter types: system environment variables",fileObjectListVariable:"Unsupported logical parameter type: file object list variable",fileObjectVariables:"Unsupported logical parameter types: file object variables",filterObjectVariables:"Unsupported logical parameter types: filter object variables",finalDataVariables:"Unsupported logical parameter types: final data variables",rawDataObjects:"Unsupported logical parameter types: Raw Data Objects",operationSessionVariables:"Unsupported Logical Parameter Types: Operation Session Variables",calculateEntity:"Calculated entity logic parameter, identifier: {tag}",value:"-value:",recreatingVariables:"Unsupported logical parameter types recreating variables",reEstablish:"Re-establish the entity logic parameter, identifier: {tag}",expressionEmpty:"Expression is empty",sourceValueType:"The source value type {srcValueType} is not supported yet.",fetchingAttribute:"Fetching the attribute {srcField} from the source parameter reports an error, source parameter:",noScriptCode:"Script code mode has no script code configured",noConfigurationLogicNode:"The entity logic does not have a configuration logic node",unsupportedLogical:"Unsupported logical node types: {logicNodeType}",noSetStartNode:"No start node set",startExecuting:"Start executing entity logic, logic identifier: {id} - logic name: {name}",endExecution:"End execution entity logic, logic identifier: {id} - logic name: {name}",noFoundEntityLogic:"{dataEntityId} entity logic not found {deDELogicId}"}},engine:{correspondingEngine:"There is no {key} corresponding engine",logicOpendata:"Missing view logic for opendata",logicNewdata:"Missing view logic for newdata",deleteModel:"{codeName} Delete model: {name}",childComponentsMounted:"The child components of {id}: {childName} are mounted.",minimization:"The current view is opened in [{mode}], minimization is not supported!",loadEntityData:"The view has no entities and cannot load entity data"},global:{noImplemented:"Getting application global variables is not implemented",noImplementedRouting:"Getting view routing parameter variables is not implemented"},hub:{failedParse:"View parameter modalOption failed to parse: {error}",noExist:"View [{id}] does not exist"},logicScheduler:{executor:{noConfiguredLogic:"No entity interface logic is configured",missingTrigger:"Missing trigger application entity interface behavior id in logic",noActionableData:"There is no actionable data for opendata!",defaultOpendataViewLogic:"opendata view logic is not configured to open the view by default",noActuallyReference:"The default open view for opendata view logic does not actually reference the view",attributeConfiguration:"{codeName}[Multiple Form Entity] or [Index Entity] missing type attribute configuration",entityAttributeValues:"Data Source No Form Type Applied Entity Attribute Values",editViews:"No edit views were found for the entity associated with the form type {formTypeValue}.",selectionView:"Selection view that needs to be opened for batch add was not found",noSupportedBatchAddOnly:"batchAddOnly is not supported yet.",newdataViewLogic:"The newdata view logic is not configured to default to a new data view",indexEntity:"Missing Default Index Entity Selection View",checkOne:"Please check one piece of data",entitiesAssociated:"No edit view found for entities associated with index type {indexType}",relationships:"Entities do not have a collection of relationships from!",foreignKey:"No foreign key attribute found for {pickParentDeName} in the current entity",mappingProperties:"Batch New Conversion Mapping Properties",newCreationData:"Batch new creation data",logicType:"Logic type {logicType} Not supported yet!",noImplementedMethod:"Method not implemented."},trigger:{triggerType:"The trigger type for the predefined logical type {type} can only be a script",noSupportedType:"Trigger type {triggerType} Not supported yet!",noExecutorBound:"{id} No executor bound.",timerLacks:"Timer lacks timing intervals",parameterCallback:"Timer missing default parameter callback"}},model:{utils:{noFoundApplication:"Application not found",unconfiguredPlugins:"Apply unconfigured plug-ins",noFound:"Plugin not found {id}"},view:{engineClassifications:"Unsupported engine classifications: {engineType}"}},platform:{failedDownload:"Failed to download file",fileStreamData:"File stream data does not exist"},register:{helper:{adapter:"Cannot find the adapter corresponding to the system counter plugin {pluginKey}.",customizedSystemAdapter:"Cannot find the adapter corresponding to the customized system counter {codeName}.",noFoundSystemCounter:"Adapter for system counter type {counterType} is not found.",applicationMenu:"Cannot find the adapter corresponding to the application menu item plugin {pluginKey}.",asynchronousAction:"Find the adapter that does not correspond to the asynchronous action type {actiontype}.",matchedPlugin:"Not matched to plugin [{pluginId}] model",customRegistration:"Cannot find an adapter with a custom registration ID of [{registerKey}].",widgetPlugin:"Cannot find the adapter corresponding to the widget plugin {pluginKey}.",widgetStyleType:"Cannot find the adapter corresponding to the widget style: [{controlStyle}] for the widget type: [{controlType}].",widgetType:"Cannot find an adapter for widget type {controlType}.",entityBehaviorPlugin:"Cannot find the adapter corresponding to the entity behavior plugin {pluginKey}.",entityBehaviorMethod:"Find adapters that donnot have an entity behavior method type of {methodType}",editorPlugin:"Cannot find the adapter corresponding to the editor plugin {pluginKey}.",editorStyleType:"Cannot find the adapter corresponding to editor style: [{editorStyle}] for editor type: [{editorType}].",editorTypePredefinedType:"Cannot find an adapter corresponding to editorType: [{editorType}] for predefinedType: [{predefinedType}].",editorType:"Cannot find the adapter corresponding to editor type {editorType}.",formMemberPlugin:"Cannot find the adapter corresponding to the form member plugin {pluginKey}.",formMemberType:"Cannot find an adapter for form member type {detailType}.",tableColumnPlugin:"Cannot find the adapter corresponding to the table column plugin {pluginKey}.",tableColumnType:"Cannot find an adapter for table column type {key}.",messageType:"Cannot find the adapter corresponding to the message type {content_type}.",panelMemberPlugin:"The adapter corresponding to the panel member plugin {pluginKey} could not be found.",panelContainerPredefined:"Cannot find an adapter with panel container predefined type {predefinedType}, registered key {key}",panelMemberDirectContent:"Cannot find adapter with panel member direct content predefined type {predefinedType}, registered key {key}",panelMemberType:"The adapter corresponding to the panel member type {itemType} could not be found.",portalWidgetPlugin:"Cannot find the adapter corresponding to the portal widget plugin {pluginKey}.",portalWidgetMemberType:"Adapter corresponding to portal widget member type {portletType} not found",treeTableColumnPlugin:"Cannot find the adapter corresponding to the tree table column plugin {pluginKey}.",interfaceBehaviorPlugin:"Cannot find the adapter corresponding to the interface behavior plugin {pluginKey}.",interfaceBehaviorMode:"Find the adapter that does not correspond to the interface behavior mode {uiactionMode}.",frontEndPluginNode:"Cannot find interface logic front-end plugin node, plugin {pluginKey} corresponding adapter",viewPlugin:"Cannot find the adapter corresponding to the view plugin {pluginKey}.",correspondViewTypeStyle:"Cannot find an adapter for view type: [{viewType}] corresponding to view style: [{viewStyle}].",toolbarItem:"Cannot find the adapter corresponding to the toolbar item plugin {pluginKey}.",acItem:"Cannot find the adapter corresponding to the ac item plugin {pluginKey}."}},service:{noConfiguredPrimary:"Entity [{codeName}] is not configured with a primary key field",noConfiguredField:"Entity [{codeName}] is not configured with a primary text field",convertedNumber:"{value} cannot be converted to a number.",subRelationships:"Sub-relationships not configured with a nested relational dataset will result in a recursive query death loop, please configure it!",unsupportedMethod:"Unsupported application entity method input attribute type: {type}",noFoundUsernamePassword:"Anonymous login configuration username or password not found",loginFailure:"Login Failure",logoutFailure:"Logout failure",noFound:"Application entity not found [{id}]",masterState:"{codeName} entity does not exist or is enabled for master state, return true",operationIdentifier:"Operation identifier {dataAccessAction} main state calculation started",matchMasterState:"Match master state",masterStatePermissions:"Collection of allowed master state permissions",noMatchedState:"Returns false if the main state is not matched.",permissionCalculation:"Operation identifier {dataAccessAction} end of permission calculation: {result}",noFindCodeList:"Cannot find {tag} code list",noConfiguredCounters:"Application counters not configured!",lackEntityLogic:"Lack of entity handling logic",createBehavior:"The create behavior does not pass data",updateBehavior:"The update behavior does not pass data",deletionDeletion:"Currently, only [DER1N] relationship type association deletion deletion is supported.",unableDelete:"Unable to delete [{logicName}-{srfmajortext}], data referenced by [{modelLogicName}-{msg}].",noSupportedDataSource:"Data source type {dataSetType} not supported yet",sourceCodeTable:"No data is specified for the source code table",requestMethods:"Unsupported request methods: {requestMethod}",noConfiguredRequestMethod:"Request method not configured",unsupportedBehaviorTypes:"Unsupported Behavior Types [{actionType}]",noFoundServiceMethod:"Service method not found: {id}",UnsupportedServiceMethod:"Unsupported service method types: {methodType}",noSupportedMethod:"The 「{id}」 method is not supported by {codeName}.",noFoundStorageEntity:"Application function [{name}] storage entity not found [{stoageAppDataEntityId}]",noExist:"Application function [{name}] does not exist",noFoundEntity:"Storage Entity Not Found [{stoageAppDataEntityId}]",noImplemented:"「{methodName}」 is not implemented.",noImplementedCounter:"Counter loading method not implemented",noFoundCounterBehavior:"Get counter behavior not found!",createPrimaryKeyData:"Failed to create new joint primary key data with existing primary key {srfkey}",updatePrimaryKeyData:"Failed to update joint primary key data with existing primary key {srfkey}",noExistNoUpdated:"Data does not exist and cannot be updated!",dataNoExistNoUpdated:"Data [{srfdename}-{srfmajortext}({srfkey})] does not exist and cannot be updated!",noDeleted:"The following data 「{notRemoveKey}」 was not found and could not be deleted!",noAttributeName:"No attribute name is specified",noContextParameterName:"No context parameter name is specified",conditionalObjects:"Unrecognizable Conditional Objects",mustArray:"The value must be an array",unsupportedQueryTypes:"Unsupported query types: {condType}",predefinedType:"Predefined type {predefinedType} is not supported at this time.",dynamicCodeTable:"The return value of a dynamic code table data property is not an object-formatted string and cannot be converted!",unconfiguredDataset:"Unconfigured dataset",processedWithout:"Execution of 「{funcName}」 cannot be processed without 「srfkey」.",noExistProcessed:"Execution of 「{funcName}」 does not exist and 「srfsessionid」 cannot be processed.",missingDetreeColumnId:"Model exception missing detreeColumnId or dataItemName."},uiAction:{noEntityOrBehavior:"No entity or entity behavior configured",noConfiguredopenView:"Not configured to open the view",frontProcessingModes:"Unsupported front processing modes [{frontProcessType}]",missingConfigurationScriptCode:"Custom types are missing configuration script code",dataPrimaryKey:"Data primary key not found",printFailure:"print failure",physicalPrint:"No physical print items found",exportRequestFailed:"Export request failed",noEntityExportsFound:"No entity exports found",lackNativeEvent:"Lack of native JS event objects",wantLogout:"Are you sure you want to log out?",logout:"Logout",operationConfirmation:"Operation Confirmation",viewParameterModalOption:"View parameter modalOption failed to parse: {error}",withdrawalConfirmed:"Is the execution of the withdrawal confirmed?",noFoundBehaviorModel:"No interface behavior model found for {actionId}."},uiLogic:{interfaceConnectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",connectionConditionGroup:"Interface Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",currentConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataObjectAttribute:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",currentTime:"Conditional value type [current time] is not supported at this time",interfaceConnectionConditionalTypeName:"Interface Logic Connection Condition Item: {name} - Condition Value Type: {type} - Source Property Name: {dstField} - Source Object Value:",asynchronousTermination:"Unsupported logical connection type: asynchronous termination",asynchronousRejection:"Unsupported logical connection type: asynchronous rejection",exceptionHandling:"Unsupported Logical Connection Type: Exception Handling",logicalLinkTypes:"Unsupported logical link types:{linkMode}",missingTargetParameter:"Missing target parameter object or source parameter object configuration",appendedArray:"Interface logic node (appended to the array): {id} - additional parameter:",bindingParameters:"Interface Logic Node (Binding Parameters): {id} - Parameter Name: {dstDEUILogicParamId} - Value:",copyParameter:"Interface logic node (copy parameter): {id} - parameter name: {dstDEUILogicParamId} - value:",missingfilter:"Missing configuration filter parameters",interfaceLogicNodeDataSet:"Interface Logic Node (Data Set): {id} - Dataset Entity Identifier: {dstAppDataEntityId} - Dataset Identifier: {dstAppDEDataSetId} - Parameter Name: {retDEUILogicParamId} - Value:",interfaceLogicNodeEntityActions:"Interface Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDEUILogicParamId} - Value:",noConfiguredInterfaceBehavior:"Interface behavior not configured",interfaceLogicNodeEntityInterfaceAction:"Interface Logic Node (Entity Interface Action): {id} - Interface Action Identifier: {dstAppDEUIActionId} - Entity to which the Interface Action belongs: {dstAppDataEntityId} - Target Logic Parameter Object: {dstDEUILogicParamId}",logicalNodeOperation:"Logical node {name} operation parameter value:",unsupportedEndNode:"Unsupported end node return value types: {returnType}",interfaceLogicNodeEndNode:"Interface logic node (end node): {id} - return value type: {returnType} - return value:",noEntityConfigured:"No entity configured",noEntityLogicConfigured:"No entity logic configured",noIncomingLogic:"No incoming logic parameters are configured",passedParameter:"Passed parameter {dstDEUILogicParamId} not found",interfaceLogicNodeExecutingEntityLogic:"Interface logic node (executing entity logic): {id} - entity logic identifier: {dstAppDELogicId} - entity to which the entity logic belongs: {dstAppDataEntityId} - parameter name: {retDEUILogicParamId} - value:",missingMessageTypeConfiguration:"Missing message type configuration",missingButtonTypeConfiguration:"Missing button type configuration",interfaceLogicNodeMessagePopup:"Interface logic node (message popup): {id} - message type: {type} - message: {message}",message:"messages",yes:"yes",no:"no",determine:"Determine",cancel:"Cancel",noSupportItem:"{name} is currently not supported",interfaceLogicNodeFrontendPlugin:"Interface Logic Node (Frontend Plugin): {id} - Plugin Id: {sysPFPluginId}",interfaceLogicNodePreparationParameter:"Interface Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDEUILogicParamId} - Source Parameter (value):",noTargetParameter:"No target parameter object id",targetParameter:"Assigning a value to the target parameter attribute {dstFieldName} reports an error, target parameter:",interfaceLogicNodeDirectCode:"Interface logic node (direct code): {id}-direct code:",interfaceLogicNodeRebuildParameter:"Interface Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"Interface Logic Node (Reset Parameter): {id} - Reset Parameter: {dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"Interface Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDEUILogicParamId} - Sorted Array:",interfaceLogicNodeStartupNode:"Interface logic node (startup node): {id}",interfaceLogicNodeThrowingExceptions:"Interface Logic node (throwing exceptions): {id} - error message: {errorInfo}",noConfiguredTriggerObject:"No trigger object is configured",noConfiguredEvent:"The event name parameter is not configured",noConfiguredEventParameters:"No event parameters are configured",noFoundTriggerObject:"Trigger object not found {fireCtrlId}",noFoundEventParameterObject:"Event parameter object not found {eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"Interface logic node (view widget event trigger logic): {id} - name of the calling view widget: {fireCtrlId} - name of the triggering event: {eventName} - triggering parameters:",noConfiguredInterfaceObject:"No interface object is configured",noConfiguredOperatingParameters:"No operating parameters are configured",noConfiguredCallMethod:"No call method is configured",noFoundOperationParameter:"The operation parameter {invokeParamId} was not found.",noFoundInterfaceObject:"Interface object {invokeCtrlId} was not found.",noFoundInvokeMethod:"The invoke method {invokeMethod} was not found.",interfaceLogicNodeViewWidgetInvocation:"Interface logic node (view widget invocation): {id} - name of the invoking view widget: {invokeCtrlId} - name of the invoking method: {invokeMethod} - trigger parameter:",viewLogicInitializationParameter:"View logic initialization parameter, {codeName} specified widget object not found",calculateInterfaceLogicParameters:"Calculate interface logic parameters, identifier: {tag}",restablishInterfaceLogic:"Re-establish the interface logic parameters, identifying: {tag}",interfaceLogic:"Interface logic {deUILogicId} for entity {appDataEntityId} not found",startExecutingInterfaceLogic:"Start executing the interface logic, entity: {appDataEntityId} - logic name: {name}",endExecutionInterfaceLogic:"End execution interface logic, entity: {appDataEntityId} - logic name: {name}",noLogicalNodesConfigured:"The interface logic has no logical nodes configured"},utils:{anime:{noExistEndpointElement:"The endpoint element does not exist",noExistAnimationElement:"Animation element does not exist",noClone:"Cannot clone a null or undefined element."},errorHandler:{noPermissionless:"No permissionless error handler registered",noProcessor:"No processor was found that can handle this error"},fileUtil:{fileUploadFailed:"File upload failed"},handlebars:{noInitHandlebars:"handlebars not init"},modal:{externalClosureCapability:"External closure capability not registered",shouldDismissResult:"The result of shouldDismiss is false, closing the interrupt."},openRedirectView:{parseSrfnavctxParameter:"Failed to parse srfnavctx parameter in redirection [{urlStr}].",missingEntityName:"Entity name missing from redirection parameter",noFoundSpecifiedEntity:"CodeName not found for the specified entity: {deName}",unsupportedLinkUrl:"Unsupported linkUrl format: {linkUrl}",noConfiguredActualReference:"Actual reference view not configured",redirectingViewReferences:"Redirecting view references there:",redirectionIdentifier:"Redirection identifier [{rdTag}] or [{deRdTag}] or workflow [{wfRdTag}] corresponding to view not found",noMatchActualReferenceView:"Identifies that [{rdTag}] did not match the actual reference view",redirectionView:"Redirection view [{name}] custom category attribute [{typeFieldId}] value is null"},script:{errorReportingScript:"Error Reporting Script"},shortCut:{invalidIndexNewIndex:"Invalid index newIndex: {newIndex}, oldIndex: {oldIndex}, current array length {length}"},uiDomain:{transactionOpen:"Transaction has been opened, only one transaction can be opened for a single interface domain.",currentTransaction:"The current transaction has not been committed and cannot be closed directly."},uiDomainManager:{invalidInterfaceDomain:"Invalid interface domain identifier [{id}]"},verify:{contentConform:"Content must conform to value rules",scopeRules:"Content length must conform to scope rules",valueNull:"The value is null",regularRules:"The value must conform to the regular rules",rangeRules:"Values must conform to the value range rules",scriptRules:"The value must conform to the script rules",emptyLogicGroups:"Empty logic groups were found and the logic could not be executed properly!",unsupportedLogicTypes:"Unsupported logic types {logicType}",emptyLogicGroupsProperly:"Empty logic groups were found and the logic could not be executed properly!",valueOperations:"Value operations: {op}, not yet supported",noCompared:"{value} and {value2} cannot be compared.",conditionalValues:"Conditional values for range comparisons do not exist or are not strings"},firstregister:"Please register the model loading adapter first"}}}),t("zhCn",{runtime:{common:{unrealized:"未实现"},command:{app:{noFindApplicationFunction:"找不到叫{appFuncId}的应用功能",noFindApplicationFunctionYype:"未支持的应用功能类型:{appFuncType}",noFindApplicationView:"应用视图[{appViewId}]不存在",unsupportedPopup:"未支持的视图打开模式: POPUP",unsupportedPopupapp:"未支持的视图打开模式: POPUPAPP",missingEvent:"气泡打开缺少event"}},controller:{common:{control:{componentActivation:"部件[{name}]({id})激活",componentPause:"部件[{name}]({id})暂停",unsupportedType:"不支持的实体数据变更类型: {type}",uncheckedData:"未选中数据",dataDeletion:"数据删除",confirmDataDeletion:"确认删除数据?",noImportModel:"没有配置导入模型!"},editor:{editorNoConfigured:"编辑器类型[{editorType}],未配置代码表"},view:{viewActivation:"视图[{name}]({id})激活",viewPause:"视图[{name}]({id})暂停",viewDestroy:"视图[{name}]({id})销毁",noFoundViewEngine:"未找到视图引擎实现:",noSupportBehavior:"没有引擎支持预置界面行为{key}"}},control:{menu:{noFindMenu:"找不到名为{id}的菜单项",noConfigured:"没有配置应用功能"},calendar:{missingViewLogic:"缺少{itemType}_opendata的视图逻辑",noFoundModel:"未找到日历项模型"},chart:{noConfiguredX:"序列没有配置X坐标轴",noConfiguredY:"序列没有配置Y坐标轴",missingClassification:"缺少分类属性配置",missingValue:"缺少值属性配置",noSupportSequence:"图表暂未支持序列类型{seriesType}",noFindSequence:"找不到{seriesIndex}序列的generator!",noInitialised:"chart对象没有正确初始化",noCalculated:"options还没计算"},dataView:{noBehaviourGroup:"操作项没有配置界面行为组",noBehaviourGroupAction:"操作项界面行为组没有配置界面行为",propertiesNoConfigured:"分组属性没有配置",tableNoConfigured:"分组代码表没有配置",sortingItems:"启用排序的项必须关联实体属性"},expBar:{unableMore:"无法获取多数据部件[{xdataControlName}]控制器",multiNode:"多节点视图由子类实现",noFindNodeModel:"找不到{nodeId}的节点模型"},form:{formCompletion:"请检查表单填写!",savedSuccessfully:"{srfmajortext}保存成功",prompt:"提示",deletion:"确认删除吗?",itemUpdate:"没找到{formItemUpdateId}表单项更新",processStarted:"流程启动成功",processSubmitted:"流程提交成功",lackBehavior:"缺少返回操作实体行为",initializationException:"初始化异常: 表单成员[{id}]({detailType})已存在,表单项标识重复请检查配置",relationshipInterface:"接收到关系界面的数据变更事件",fillIn:"请填写{caption}",unconfiguredWidgets:"多数据部件未配置内容部件",noFoundFormController:"没有找到对应{id}的表单控制器",multiDataAddData:"多数据部件类型{contentType}暂不支持添加数据",mdControllerNoExist:"mdController不存在",repeaterNoSupported:"暂不支持重复器样式{detailStyle}",searchTerms:"没有找到可以应用的搜索条件",saveSearch:"没有找到保存的搜索条件"},md:{noNode:"不是实体甘特节点数据",rowData:"行数据不存在",simpleMode:"简单模式,不保存",nonentity:"非实体节点数据不能保存",noChange:"值没有发生改变",dataDeleted:"数据[{str}]删除成功!",firstComplete:"请先完成当前行编辑中的行的操作",noSupport:"{treeNodeType}节点类型未支持"},grid:{unsupported:"未支持的类型{type}",attributeColumns:"没有配置分组属性的属性列",noCodeTable:"分组属性的属性列{groupFieldName}没有配置代码表",configureFirstColumn:"请将分组属性列{groupFieldName}配置为第一列",requiresCodeTable:"代码表分组模式需要配置代码表",noMatchCodeTable:"分组代码表与属性列{groupFieldName}的代码表不一致",convertedValue:"{srfmajortext}的排序属性无法转换成数值",missingConfiguration:"缺少配置聚合实体或聚合数据集",newRows:"不支持新建行",saveCancel:"行数据校验不通过,保存取消",noSupportRowEditing:"当前表格不支持行编辑,无法切换开启行编辑",lineEditing:"同时只能有一行开启行编辑",updateColumns:"没找到{updateId}编辑列更新",exported:"无导出数据",tabularColumns:"无表格列",corresponding:"未找到对应的表格数据项[{deField}]",pickedUpData:"未在行数据中取到 {valueItem} 的值",noSupportedMode:"暂未支持属性列聚合模式{aggMode}",remoteAggregation:"远程聚合暂未支持",aggregateMode:"暂未支持聚合模式{aggMode}",formattingError:"{aggValue} 值格式化错误",checksumErrors:"{codeName}校验报错,{fieldName}",behaviorGroup:"操作列没有配置界面行为组",interfaceBehavior:"操作列界面行为组没有配置界面行为"},kanban:{sortingProperties:"排序属性没配置",sortDirection:"排序方向没配置",groupedOn:"看板部件必须开启分组",adjustmentsGroup:"当前看板不允许调整分组!",noAllowReorder:"当前看板不允许调整次序!"},meditViewPanel:{DraftNew:"草稿--新建",dataExist:"编辑视图面板部件UI数据不存在"},panel:{panelData:"未获取到面板数据"},reportPanel:{reportType:"报表面板生成器工厂参数错误,报表面板未指定报表类型",noImplemented:"指定报表{reportType}类型报表面板生成器暂未实现"},searchBar:{noFoundEntity:"找不到属性{targetField}对应的关联实体",missingModel:"缺少编辑器模型",JSONFormat:"{data}非标准JSON格式:"},toolbar:{noFound:"没有找到界面行为模型{actionId}"},tree:{noFoundTreeData:"找不到对应的树节点数据",sortAttribute:"缺少配置排序属性",editMode:"树节点没有配置编辑模式:名称",nodeData:"不是实体树节点数据",noFoundTreeNode:"未找到树节点"},treeGrid:{columnsSchema:"树表格无值列模式",columnMode:"树表格无父值列模式"},treeGridEx:{noConfigured:"节点没有配置对应表格列{name}的数据项",editItem:"没有找到对应表格列{name}的编辑项模型",noPickedUp:"未在行数据中取到 {valueItem} 的值",behaviorGroup:"{id}操作列没有配置界面行为组",noSupportCreation:"暂不支持新建",updateBehavior:"树节点没有配置更新实体行为"},wizardPanel:{wizardForm:"找不到{activeFormTag}的向导表单",formController:"找不到{activeFormTag}的表单控制器",noConfiguration:"没有配置向导表单集合",wizardFormIdentifier:"找不到标识为{tag}的向导表单",noPreviousForm:"没有上一个表单",nextStep:"找不到下一个向导步骤",nextForm:"找不到下一个向导表单"}},utils:{buttonState:{isFinitenconsistency:"{uiActionId}界面行为的实体{appDeName}和数据的实体{appDeId}不一致"},counter:{decrement:"错误的调用!decrement不能对count为0调用"},dataFileUtil:{startImport:"开始导入,详细进度和结果请看应用通知",noExist:"ibiz.util.getExportExcel不存在",loadError:"导出模块加载错误",importData:"没有找到对应的导入数据模型"},valueDefault:{noExist:"appdata.context不存在",nosupported:"默认值类型[{valueType}]未支持"},valueEx:{objectNameField:"缺少objectNameField"},valueRule:{length:"内容长度必须小于等于{maxLength},当前长度为{length}"},viewMsg:{message:"找不到视图消息组{msgGroupId}的模型",noFound:"没有找到{message}视图消息模型",unconfigured:"未配置实体数据集",unconfiguredEntities:"未配置应用实体"}}},deLogic:{deLogicLink:{connectionConditional:"界面连接条件逻辑组未配置逻辑项",entityConnectionConditional:"实体逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",missingConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataMissingConditionValue:"当前条件值类型为[源数据对象属性],缺少配置条件值",noSupportedTime:"暂未支持条件值类型为[当前时间]",entityLogicalConnection:"实体逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",comparisonCondition:"-对比条件:{op}",comparisonValue:"-对比值:",compareResults:"-对比结果:"},deLogicNode:{missingTargetParameter:"缺少目标参数对象或者源参数对象配置",additionalParameter:"实体逻辑节点(附加到数组):{id}-附加参数:",addedValue:"-附加值:",logicNodeParameterName:"实体逻辑节点(绑定参数):{id}-参数名称:{dstDELogicParamId}-值:",copyParameter:"实体逻辑节点(拷贝参数):{id}-参数名称:{dstDELogicParamId}-值:",dataSet:"实体逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDELogicParamId}-值:",unspecifiedEntity:"未指定应用实体",unspecifiedBehavior:"未指定实体行为",entityActions:"实体逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDELogicParamId}-值:",unsupportedReturnType:"暂未支持的结束节点返回值类型: {returnType}",endNode:"实体逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noSupportedLogic:"暂未支持逻辑处理参数操作{paramAction}",preparationParameter:"实体逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDELogicParamId}-源参数(值):",targetParameter:"-目标参数(值):",missingConfiguration:"缺少目标参数对象配置",rebuildParameter:"实体逻辑节点(重新建立参数):{id}-重建参数:{dstDELogicParamId}",resetParameter:"实体逻辑节点(重置参数):{id}-重置参数:{dstDELogicParamId}",missingParameterProperty:"缺少目标参数对象或目标属性配置",sortedArrayParameters:"实体逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDELogicParamId}-排序后数组:",startupNode:"实体逻辑节点(启动节点):{id}",throwsException:"实体逻辑节点(抛出异常):{id}-错误代码:{errorCode}-错误信息:{errorInfo}",environmentVariables:"未支持的逻辑参数类型: 系统环境变量",fileObjectListVariable:"未支持的逻辑参数类型: 文件对象列表变量",fileObjectVariables:"未支持的逻辑参数类型: 文件对象变量",filterObjectVariables:"未支持的逻辑参数类型: 过滤器对象变量",finalDataVariables:"未支持的逻辑参数类型: 最后数据变量",rawDataObjects:"未支持的逻辑参数类型: 原始数据对象",operationSessionVariables:"未支持的逻辑参数类型: 操作会话变量",calculateEntity:"计算实体逻辑参数,标识:{tag}",value:"-值:",recreatingVariables:"未支持的逻辑参数类型重新建立变量",reEstablish:"重新建立实体逻辑参数,标识:{tag}",expressionEmpty:"表达式为空",sourceValueType:"暂未支持源值类型{srcValueType}",fetchingAttribute:"从源参数取属性{srcField}报错,源参数:",noScriptCode:"脚本代码模式没有配置脚本代码",noConfigurationLogicNode:"实体逻辑没有配置逻辑节点",unsupportedLogical:"未支持的逻辑节点类型: {logicNodeType}",noSetStartNode:"未设置起始节点",startExecuting:"开始执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",endExecution:"结束执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",noFoundEntityLogic:"{dataEntityId}找不到实体逻辑{deDELogicId}"}},engine:{correspondingEngine:"没有{key}对应的引擎",logicOpendata:"缺少opendata的视图逻辑",logicNewdata:"缺少newdata的视图逻辑",deleteModel:"{codeName}删除模型:{name}",childComponentsMounted:"{id}的子组件:{childName}都已mounted",minimization:"当前视图打开方式为 [{mode}], 不支持最小化!",loadEntityData:"该视图没有实体,无法加载实体数据"},global:{noImplemented:"获取应用全局变量没有实现"},hub:{failedParse:"视图参数modalOption 解析失败:{error}",noExist:"视图[{id}]不存在"},logicScheduler:{executor:{noConfiguredLogic:"没有配置实体界面逻辑",missingTrigger:"逻辑中缺少触发应用实体界面行为id",noActionableData:"opendata没有可操作数据!",defaultOpendataViewLogic:"opendata视图逻辑没有配置默认打开视图",noActuallyReference:"opendata视图逻辑的默认打开视图没有实际引用视图",attributeConfiguration:"{codeName}[多表单实体] or [索引实体]缺少类型属性配置",entityAttributeValues:"数据源无表单类型应用实体属性值",editViews:"没有找到与表单类型{formTypeValue}相关的实体的编辑视图",selectionView:"没有找到批添加需要打开的选择视图",noSupportedBatchAddOnly:"batchAddOnly暂未支持",newdataViewLogic:"newdata视图逻辑没有配置默认新建数据视图",indexEntity:"缺少默认索引实体选择视图",checkOne:"请选中一条数据",entitiesAssociated:"没有找到与索引类型{indexType}相关的实体的编辑视图",relationships:"实体没有从关系集合!",foreignKey:"没有找到{pickParentDeName}在当前实体的外键属性",mappingProperties:"批量新建转换映射属性",newCreationData:"批量新建创建数据",logicType:"逻辑类型 {logicType} 暂未支持!",noImplementedMethod:"方法未执行。"},trigger:{triggerType:"预定义逻辑类型{type}的触发器类型只能是脚本",noSupportedType:"触发器类型 {triggerType} 暂未支持!",noExecutorBound:"{id}没有绑定executor",timerLacks:"定时器缺少定时间隔",parameterCallback:"定时器缺少默认参数回调"}},model:{utils:{noFoundApplication:"未找到应用",unconfiguredPlugins:"应用未配置插件",noFound:"未找到插件{id}"},view:{engineClassifications:"未支持的引擎分类:{engineType}"}},platform:{failedDownload:"下载文件失败",fileStreamData:"文件流数据不存在"},register:{helper:{adapter:"找不到系统计数器插件{pluginKey}对应的适配器",customizedSystemAdapter:"找不到自定义系统计数器{codeName}对应的适配器",noFoundSystemCounter:"找不系统计数器类型{counterType}对应的适配器",applicationMenu:"找不到应用菜单项插件{pluginKey}对应的适配器",asynchronousAction:"找不异步操作类型{actiontype}对应的适配器",matchedPlugin:"未匹配到插件[{pluginId}]模型",customRegistration:"找不到自定义注册标识为[{registerKey}]对应的适配器",widgetPlugin:"找不到部件插件{pluginKey}对应的适配器",widgetStyleType:"找不到部件类型:[{controlType}]的部件样式:[{controlStyle}]对应的适配器",widgetType:"找不到部件类型{controlType}对应的适配器",entityBehaviorPlugin:"找不到实体行为插件{pluginKey}对应的适配器",entityBehaviorMethod:"找不实体行为方法类型为{methodType}的适配器",editorPlugin:"找不到编辑器插件{pluginKey}对应的适配器",editorStyleType:"找不到编辑器类型:[{editorType}]的编辑器样式:[{editorStyle}]对应的适配器",editorTypePredefinedType:"找不到编辑器类型:[{editorType}]的预置类型:[{predefinedType}]对应的适配器",editorType:"找不到编辑器类型{editorType}对应的适配器",formMemberType:"找不到表单成员类型{detailType}对应的适配器",tableColumnPlugin:"找不到表格列插件{pluginKey}对应的适配器",tableColumnType:"找不到表格列类型{key}对应的适配器",messageType:"找不站内信类型{content_type}对应的适配器",panelMemberPlugin:"找不到面板成员插件{pluginKey}对应的适配器",panelContainerPredefined:"找不到面板容器预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberDirectContent:"找不到面板成员直接内容预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberType:"找不到面板成员类型{itemType}对应的适配器",portalWidgetPlugin:"找不到门户部件插件{pluginKey}对应的适配器",portalWidgetMemberType:"找不到门户部件成员类型{portletType}对应的适配器",treeTableColumnPlugin:"找不到树表格列插件{pluginKey}对应的适配器",interfaceBehaviorPlugin:"找不到界面行为插件{pluginKey}对应的适配器",interfaceBehaviorMode:"找不界面行为模式{uiactionMode}对应的适配器",frontEndPluginNode:"找不到界面逻辑前端插件节点,插件{pluginKey}对应的适配器",viewPlugin:"找不到视图插件{pluginKey}对应的适配器",correspondViewTypeStyle:"找不到视图类型:[{viewType}]的视图样式:[{viewStyle}]对应的适配器",toolbarItem:"找不到工具栏项插件{pluginKey}对应的适配器",acItem:"找不到自填列表项插件{pluginKey}对应的适配器"}},service:{noConfiguredPrimary:"实体[{codeName}]未配置主键字段",noConfiguredField:"实体[{codeName}]未配置主文本字段",convertedNumber:"{value}不能转换成数字",subRelationships:"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!",unsupportedMethod:"未支持的应用实体方法输入属性类型: {type}",noFoundUsernamePassword:"未找到匿名登录配置用户名或密码",loginFailure:"登录失败",logoutFailure:"登出失败",noFound:"未找到应用实体[{id}]",masterState:"{codeName}实体不存在或者为启用主状态,返回true",operationIdentifier:"操作标识{dataAccessAction}主状态计算开始",matchMasterState:"匹配主状态",masterStatePermissions:"允许的主状态权限集合",noMatchedState:"没匹配主状态,返回false",permissionCalculation:"操作标识{dataAccessAction}权限计算结束:{result}",noFindCodeList:"找不到{tag}代码表",noConfiguredCounters:"未配置应用计数器!",lackEntityLogic:"缺少实体处理逻辑",createBehavior:"create行为没有传data",updateBehavior:"update行为没有传data",deletionDeletion:"目前只支持[DER1N]关系类型关联删除删除",unableDelete:"无法删除[{logicName}-{srfmajortext}], 数据被[{modelLogicName}-{msg}]引用",noSupportedDataSource:"数据来源类型{dataSetType}暂未支持",sourceCodeTable:"没有指定数据来源代码表",requestMethods:"未支持的请求方式: {requestMethod}",noConfiguredRequestMethod:"未配置请求方式",unsupportedBehaviorTypes:"未支持的行为类型[{actionType}]",noFoundServiceMethod:"未找到服务方法: {id}",UnsupportedServiceMethod:"未支持的服务方法类型: {methodType}",noSupportedMethod:"{codeName}未支持「{id}」方法",noFoundStorageEntity:"应用功能[{name}]未找到存储实体[{stoageAppDataEntityId}]",noExist:"应用功能[{name}]不存在",noFoundEntity:"未找到存储实体[{stoageAppDataEntityId}]",noImplemented:"「{methodName}」未实现",noImplementedCounter:"未实现计数器加载方法",noFoundCounterBehavior:"未找到获取计数器行为!",createPrimaryKeyData:"新建联合主键数据失败,已有主键为{srfkey}的数据",updatePrimaryKeyData:"更新联合主键数据失败,已有主键为{srfkey}的数据",noExistNoUpdated:"数据不存在,无法更新!",dataNoExistNoUpdated:"数据[{srfdename}-{srfmajortext}({srfkey})]不存在,无法更新!",noDeleted:"未找到以下数据「{notRemoveKey}」,无法删除!",noAttributeName:"没有指定属性名称",noContextParameterName:"没有指定上下文参数名称",conditionalObjects:"无法识别的条件对象",mustArray:"值必须为数组",unsupportedQueryTypes:"暂未支持的查询条件类型: {condType}",predefinedType:"预定义类型{predefinedType}暂不支持",dynamicCodeTable:"动态代码表数据属性返回值不为对象格式的字符串,无法转换!",unconfiguredDataset:"未配置数据集",processedWithout:"执行「{funcName}」不存在「srfkey」无法处理",noExistProcessed:"执行「{funcName}」不存在「srfsessionid」无法处理",missingDetreeColumnId:"模型异常缺少detreeColumnId或者dataItemName"},uiAction:{noEntityOrBehavior:"未配置实体或实体行为",noConfiguredopenView:"未配置打开视图",frontProcessingModes:"未支持的前台处理模式[{frontProcessType}]",missingConfigurationScriptCode:"自定义类型缺少配置脚本代码",dataPrimaryKey:"没有找到数据主键",printFailure:"打印失败",physicalPrint:"没有找到实体打印项",exportRequestFailed:"导出请求失败",noEntityExportsFound:"没有找到实体导出项",lackNativeEvent:"缺少原生JS事件对象",logout:"退出登录",wantLogout:"您确定要退出登录吗?",operationConfirmation:"操作确认",viewParameterModalOption:"视图参数modalOption 解析失败:{error}",withdrawalConfirmed:"是否确认执行撤回操作?",noFoundBehaviorModel:"没找到{actionId}的界面行为模型"},uiLogic:{interfaceConnectionConditional:"界面连接条件逻辑组未配置逻辑项",connectionConditionGroup:"界面逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",currentConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataObjectAttribute:"当前条件值类型为[源数据对象属性],缺少配置条件值",currentTime:"暂未支持条件值类型为[当前时间]",interfaceConnectionConditionalTypeName:"界面逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",asynchronousTermination:"未支持的逻辑连接类型: 异步结束",asynchronousRejection:"未支持的逻辑连接类型: 异步拒绝",exceptionHandling:"未支持的逻辑连接类型: 异常处理",logicalLinkTypes:"未支持的逻辑连接类型:{linkMode}",missingTargetParameter:"缺少目标参数对象或者源参数对象配置",appendedArray:"界面逻辑节点(附加到数组):{id}-附加参数:",bindingParameters:"界面逻辑节点(绑定参数):{id}-参数名称:{dstDEUILogicParamId}-值:",copyParameter:"界面逻辑节点(拷贝参数):{id}-参数名称:{dstDEUILogicParamId}-值:",missingfilter:"缺少配置过滤参数",interfaceLogicNodeDataSet:"界面逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDEUILogicParamId}-值:",interfaceLogicNodeEntityActions:"界面逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDEUILogicParamId}-值:",noConfiguredInterfaceBehavior:"未配置界面行为",interfaceLogicNodeEntityInterfaceAction:"界面逻辑节点(实体界面行为):{id}-界面行为标识:{dstAppDEUIActionId}-界面行为所属实体:{dstAppDataEntityId}-目标逻辑参数对象:{dstDEUILogicParamId}",logicalNodeOperation:"逻辑节点{name}操作参数值:",unsupportedEndNode:"暂未支持的结束节点返回值类型: {returnType}",interfaceLogicNodeEndNode:"界面逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noEntityConfigured:"没有配置实体",noEntityLogicConfigured:"没有配置实体逻辑",noIncomingLogic:"没有配置传入逻辑参数",passedParameter:"没有找到传入参数{dstDEUILogicParamId}",interfaceLogicNodeExecutingEntityLogic:"界面逻辑节点(执行实体逻辑):{id}-实体逻辑标识:{dstAppDELogicId}-实体逻辑所属实体:{dstAppDataEntityId}-参数名称:{retDEUILogicParamId}-值:",missingMessageTypeConfiguration:"缺少消息类型的配置",missingButtonTypeConfiguration:"缺少按钮类型的配置",interfaceLogicNodeMessagePopup:"界面逻辑节点(消息弹窗):{id}-消息类型:{type}-消息:{message}",message:"消息",yes:"是",no:"否",determine:"确定",cancel:"取消",noSupportItem:"{name}暂未支持",interfaceLogicNodeFrontendPlugin:"界面逻辑节点(前端插件):{id}-插件标识:{sysPFPluginId}",interfaceLogicNodePreparationParameter:"界面逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDEUILogicParamId}-源参数(值):",noTargetParameter:"没有目标参数对象id",targetParameter:"给目标参数属性{dstFieldName}赋值报错,目标参数:",interfaceLogicNodeDirectCode:"界面逻辑节点(直接代码):{id}-直接代码:",interfaceLogicNodeRebuildParameter:"界面逻辑节点(重新建立参数):{id}-重建参数:{dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"界面逻辑节点(重置参数):{id}-重置参数:{dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"界面逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDEUILogicParamId}-排序后数组:",interfaceLogicNodeStartupNode:"界面逻辑节点(启动节点):{id}",interfaceLogicNodeThrowingExceptions:"界面逻辑节点(抛出异常):{id}-错误信息:{errorInfo}",noConfiguredTriggerObject:"没有配置触发对象",noConfiguredEvent:"没有配置事件名称参数",noConfiguredEventParameters:"没有配置事件参数",noFoundTriggerObject:"没有找到触发对象{fireCtrlId}",noFoundEventParameterObject:"没有找到事件参数对象{eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"界面逻辑节点(视图部件事件触发逻辑):{id}-调用视图部件名称:{fireCtrlId}-触发事件名称:{eventName}-触发参数:",noConfiguredInterfaceObject:"没有配置界面对象",noConfiguredOperatingParameters:"没有配置操作参数",noConfiguredCallMethod:"没有配置调用方法",noFoundOperationParameter:"没有找到操作参数{invokeParamId}",noFoundInterfaceObject:"没有找到界面对象{invokeCtrlId}",noFoundInvokeMethod:"没有找到调用方法{invokeMethod}",interfaceLogicNodeViewWidgetInvocation:"界面逻辑节点(视图部件调用):{id}-调用视图部件名称:{invokeCtrlId}-调用方法名称:{invokeMethod}-触发参数:",viewLogicInitializationParameter:"视图逻辑初始化参数,未找到{codeName}指定部件对象",calculateInterfaceLogicParameters:"计算界面逻辑参数,标识:{tag}",restablishInterfaceLogic:"重新建立界面逻辑参数,标识:{tag}",interfaceLogic:"找不到实体{appDataEntityId}的界面逻辑{deUILogicId}",startExecutingInterfaceLogic:"开始执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",endExecutionInterfaceLogic:"结束执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",noLogicalNodesConfigured:"界面逻辑没有配置逻辑节点"},utils:{anime:{noExistEndpointElement:"终点元素不存在",noExistAnimationElement:"动画元素不存在",noClone:"不能克隆空或未定义的元素"},errorHandler:{noPermissionless:"没有注册无权限错误处理器",noProcessor:"没有找到能处理该错误的处理器"},fileUtil:{fileUploadFailed:"文件上传失败"},handlebars:{noInitHandlebars:"handlebars未初始化"},modal:{externalClosureCapability:"外部关闭能力未注册",shouldDismissResult:"shouldDismiss结果为false,关闭中断"},openRedirectView:{parseSrfnavctxParameter:"重定向[{urlStr}] 中 srfnavctx 参数解析失败",missingEntityName:"重定向参数缺少实体名称",noFoundSpecifiedEntity:"未找到指定实体的codeName: {deName}",unsupportedLinkUrl:"未支持的linkUrl格式:{linkUrl}",noConfiguredActualReference:"未配置实际引用视图",redirectingViewReferences:"重定向视图引用有:",redirectionIdentifier:"未找到重定向标识[{rdTag}]或[{deRdTag}]或工作流[{wfRdTag}]对应视图",noMatchActualReferenceView:"标识[{rdTag}]未匹配到实际引用视图",redirectionView:"重定向视图[{name}]自定义类别属性[{typeFieldId}]值为空"},script:{errorReportingScript:"报错脚本"},shortCut:{invalidIndexNewIndex:"无效的索引 newIndex: {newIndex}, oldIndex: {oldIndex}, 当前数组长度为 {length}"},uiDomain:{transactionOpen:"事务已经开启, 单个界面域只能开启一个事务",currentTransaction:"当前事务未提交,不可以直接关闭事务"},uiDomainManager:{invalidInterfaceDomain:"无效的界面域标识[{id}]"},verify:{contentConform:"内容必须符合值规则",scopeRules:"内容长度必须符合范围规则",valueNull:"值为空",regularRules:"值必须符合正则规则",rangeRules:"值必须符合值范围规则",scriptRules:"值必须符合脚本规则",emptyLogicGroups:"发现空逻辑组,逻辑无法正常执行!",unsupportedLogicTypes:"未支持的逻辑类型{logicType}",emptyLogicGroupsProperly:"发现空逻辑组,逻辑无法正常执行!",valueOperations:"值操作:{op},暂未支持",noCompared:"{value} 和 {value2} 无法比较大小",conditionalValues:"范围比较的条件值不存或者不是字符串"},firstregister:"请先注册模型加载适配器"}}})}}}));
1
+ System.register(["@ibiz-template/core","lodash-es","ramda","qx-util","qs","dayjs","async-validator","path-browserify"],(function(t,e){"use strict";var i,a,s,n,o,r,c,d,l,h,u,p,m,g,f,y,w,E,v,I,b,D,C,A,P,T,N,x,S,L,M,R,O,_,F,z,V,k,U,B,W,G,j,K,H,X,q,Y,Q,$,J,Z,tt,et,it,at,st,nt,ot,rt,ct,dt,lt,ht,ut,pt,mt,gt,ft,yt,wt,Et,vt,It,bt,Dt,Ct,At,Pt;return{setters:[function(t){i=t.RuntimeModelError,a=t.ModelError,s=t.HttpError,n=t.NoticeError,o=t.RuntimeError,r=t.recursiveIterate,c=t.downloadFileFromBlob,d=t.IBizContext,l=t.DataTypes,h=t.clone,u=t.CoreConst,p=t.HttpResponse,m=t.isBase64Image,g=t.updateKeyDefine,f=t.Net,y=t.getToken,w=t.NOOP,E=t.selectFile,v=t.Namespace,I=t.IBizParams,b=t.isElementSame,D=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,N=t.BitMask,x=t.mergeInLeft,S=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.toNumberOrNil},function(t){O=t.isEmpty,_=t.isNil,F=t.isString,z=t.isArray,V=t.isObject,k=t.merge,U=t.debounce,B=t.camelCase,W=t.eq,G=t.gt,j=t.gte,K=t.findIndex,H=t.lt,X=t.lte,q=t.upperFirst,Y=t.snakeCase,Q=t.kebabCase,$=t.isFunction,J=t.isNumber},function(t){Z=t.isNil,tt=t.mergeRight,et=t.isEmpty,it=t.clone,at=t.equals,st=t.where,nt=t.mergeLeft,ot=t.isNotNil,rt=t.mergeDeepRight},function(t){ct=t.notNilEmpty,dt=t.isNilOrEmpty,lt=t.AsyncSeriesHook,ht=t.QXEvent,ut=t.createUUID,pt=t.isArray,mt=t.getCookie,gt=t.setCookie,ft=t.clearCookie,yt=t.ascSort,wt=t.descSort,Et=t.clearAll,vt=t.isNumber,It=t.isString,bt=t.isObject},function(t){Dt=t.default},function(t){Ct=t.default},function(t){At=t.default},function(t){Pt=t.default}],execute:function(){t({SearchCondEx2filterNode:Bd,asyncImportData:Er,asyncImportData2:Tr,calcContentAlignStyle:function(t){const{valignSelf:e,halignSelf:i}=t;let a;if(e||i){switch(a={display:"flex"},e){case"TOP":Object.assign(a,{"align-items":"flex-start"});break;case"MIDDLE":Object.assign(a,{"align-items":"center"});break;case"BOTTOM":Object.assign(a,{"align-items":"flex-end"})}switch(i){case"LEFT":Object.assign(a,{"justify-content":"flex-start"});break;case"CENTER":Object.assign(a,{"justify-content":"center"});break;case"RIGHT":Object.assign(a,{"justify-content":"flex-end"});break;case"JUSTIFY":Object.assign(a,{"justify-content":"space-between"})}}return a},calcDeCodeNameById:Ae,calcDynaClass:be,calcDynaSysParams:async function(t,e,i={}){const a=i.appId||e.srfappid,s=i.viewParams||{},n={},o=await ibiz.hub.getAppDataEntity(t,a);if(s.srfkey)n.srfkey=s.srfkey;else{const t=e[o.codeName.toLowerCase()];t&&(n.srfkey=t)}if(s.srfparentkey&&s.srfparentdename)n.srfparentkey=s.srfparentkey,n.srfparentdename=s.srfparentdename;else{const t=Ga(e,o);if(t&&t.keys.length>1){const i=t.keys[t.keys.length-2];n.srfparentkey=s.srfparentkey||e[i],n.srfparentdename=s.srfparentdename||i}}return n},calcFilterModelBySchema:Od,calcGridLayoutPos:function(t){const{layout:e,colXS:i,colXSOffset:a,colSM:s,colSMOffset:n,colMD:o,colMDOffset:r,colLG:c,colLGOffset:d}=t,l=(t,i)=>({span:(t&&-1!==t?t:"TABLE_24COL"===e?24:12)*("TABLE_24COL"===e?1:2),offset:i&&-1!==i?i:void 0});return{xs:l(i,a),sm:l(s,n),md:l(o,r),lg:l(c,d)}},calcImportSchemaData:Nr,calcItemVisible:async function(t,e,i,a,s,n){const{enableMode:o,dataAccessAction:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===o&&r){const t=ibiz.hub.getApp(e.srfappid);return!!await t.authority.calcByDataAccessAction(r,e,n,a)}if("DELOGIC"===o&&c&&a&&s){const t=Te(c,await ibiz.hub.getAppDataEntity(a,s));if(t){return!!(await Us(t,e,n,i)).data}}if("SCRIPT"===o&&d){return!!ei.execScriptFn({data:n,context:e,params:i},d,{isAsync:!1,singleRowReturn:!0})}},calcItemVisibleByCounter:function(t,e){const{enableMode:i,counterId:a}=t;if(!e||!a)return;if("COUNT_GTE_ZERO"===i)return e.getCounter(a)>=0;if("COUNT_GT_ZERO"===i)return e.getCounter(a)>0},calcLayoutHeightWidth:Ie,calcMainStateOPPrivsStrs:Ce,calcNavParams:ge,calcResPath:ja,calcSearchCondExs:Gd,calcSearchConds:Ud,compare:Ye,compareNumber:Qe,contains:$e,convertNavData:he,convertNavDataByArray:pe,convertObjectToNavParams:le,createImportSchema:async function(t){const e=Nr(t);return await ibiz.net.request("extension/import_schemas",{method:"post",data:e})},deleteImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"delete"})},downloadImportTemplate:Ar,execDELogic:Vs,execDELogicAction:Us,execDELogicById:ks,execFieldLogics:Ws,execUILogic:Sc,exportData:br,fetchImportSchemas:async function(t){var e;const i={n_import_tag_eq:t.appDataEntity.defaultAppDEDataImportId,n_system_tag_eq:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,n_data_entity_tag_eq:t.appDataEntity.codeName};return await ibiz.net.request("extension/import_schemas/fetch_cur_user",{method:"post",data:i})},fieldValueToBoolean:Ha,filterFieldLogics:Ne,filterNode2SearchCond:kd,filterNode2SearchCondEx:Wd,filterValueRules:Ii,findAppDEMethod:ve,findChildFormDetails:_e,findDELogic:Te,findEditItem:Oe,findFieldById:xe,findModelChild:fe,formatMultiData:me,generateEditorRules:mr,generateRules:pr,getAcItemProvider:async function(t){let e;const{itemSysPFPluginId:i,appId:a}=t;if(i){const t=await Li(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Ma,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.acItem",{pluginKey:t}))}var s;return e},getAllPanelField:Ge,getAppCounterProvider:_i,getAppMenuItemProvider:Ta,getAppViewRef:function(t,e){var i,a;let s=t.appViewRefs||[];(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.appViewRefs));return s.find((t=>t.name===e||t.id===e))},getAsyncActionProvider:function(t){const e=(i=t.actiontype||"DEFAULT",ibiz.register.get("".concat(da,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Re,getControl:ye,getControlPanel:Ee,getControlProvider:ki,getControlsByView:ze,getCtrlTeleportParams:function(t){var e,i,a,s;const n=null==(i=null==(e=t.controlParam)?void 0:e.ctrlParams)?void 0:i.TELEPORTTAG,o="true"===(null==(s=null==(a=t.controlParam)?void 0:a.ctrlParams)?void 0:s.TELEPORTFLAG);return{teleportTag:n,teleportFlag:o}},getDEMethodProvider:Ia,getDERedirectToView:Xe,getDataImportModels:Dr,getDeACMode:async function(t,e,i){var a;const s=await ibiz.hub.getAppDataEntity(e,i);return null==(a=s.appDEACModes)?void 0:a.find((e=>e.id===t))},getDefaultDataImport:function(t){var e;if(t.defaultAppDEDataImportId)return null==(e=t.appDEDataImports)?void 0:e.find((e=>e.id===t.defaultAppDEDataImportId))},getDefaultValue:fr,getEditorProvider:Wi,getEntitySchema:xr,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat(xa,"_").concat(i)));var i;return e},getFormDetailProvider:Ki,getGridColumnProvider:qi,getImportSchema:async function(t){const e="extension/import_schemas/".concat(t);return await ibiz.net.request(e,{method:"get"})},getInternalMessageProvider:function(t){const e=(i=t.content_type||"DEFAULT",ibiz.register.get("".concat(Na,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:Ga,getOriginData:ur,getOriginFilterNodes:zd,getPFPlugin:function(t,e){const a=ibiz.hub.getApp(e);if(!a)throw new i(a,ibiz.i18n.t("runtime.model.utils.noFoundApplication"));const{model:s}=a;if(!s.appPFPluginRefs)throw new i(s,ibiz.i18n.t("runtime.model.utils.unconfiguredPlugins"));const n=s.appPFPluginRefs.find((e=>e.pluginCode.toLowerCase()===t.toLowerCase()));if(!n)throw new Error(ibiz.i18n.t("runtime.model.utils.noFound",{id:t}));return n},getPanelItemProvider:$i,getPlatformProvider:ya,getPlatformType:pa,getPortletProvider:ta,getRootNode:Le,getToolbarItemProvider:La,getTreeGridExColumnProvider:Ca,getTreeNode:Me,getUIActionById:Se,getUIActionItemsByActionLevel:function(t,e){const i=[];return r(t,(t=>{if("DEUIACTION"===t.itemType){const a=t;a.actionLevel===e&&i.push(a)}}),{childrenFields:["detoolbarItems"]}),i},getUIActionProvider:sa,getUILogicNodeProvider:oa,getViewEngines:ke,getViewLogics:Ve,getViewProvider:async function(t){let e;const{viewType:i,viewStyle:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Li(s,n);if(t&&(e=ca(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=ca("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=ca(i));e||(e=ca("DEFAULT"));return e},getWFContext:ri,getWFSubmitViewId:function(t,e){var i;const{type:a,sequenceflowview:s,sequenceflowmobview:n}=e,o=(null==(i=t.viewLayoutPanel)?void 0:i.appViewRefs)||t.appViewRefs,r=a?"WFUTILACTION@".concat(a.toUpperCase()):"WFACTION@".concat(ibiz.env.isMob?n:s),c=null==o?void 0:o.find((t=>-1!==t.name.indexOf(r)));return null==c?void 0:c.refAppViewId},handleAllSettled:Cn,hasDeCodeName:Pe,hasSubRoute:lr,importData:vr,importData2:Ir,install:function(){const{ibiz:t}=window;t.util=new vl,t.hub=new fl,t.register=new kt,t.config=new Vt,t.auth=new hs,t.engine=new yl,t.uiDomainManager=new In,t.markOpenData=new Qs,Ko(),Vc(),qs(),Fa(),ibiz.scheduler=new xl,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Ml(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Ml(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Ml(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Rl(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Ll(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new _l(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Fl(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new Dl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new Cl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new Cl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Ol(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new zl(t,e))),function(){const t=new ha;ga("Browser",(()=>t))}(),t.platform=ya()},installCommand:Ko,isDataContainer:Ue,isFormDataContainer:Fe,isHiddenFilter:Cd,isSimpleItems:Dd,isValueChange:hr,matchMainState:De,openDataImport:Cr,openRedirectView:Ke,parseSubFieldInfo:Ad,parseUserParams:we,parseViewProtocol:je,presetAppCounterProvider:Fa,presetDEMethodProvider:qs,presetUIActionProvider:Vc,registerAcItemProvider:function(t,e){ibiz.register.register("".concat(Ma,"_").concat(t),e)},registerAppCounterProvider:Ri,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Aa,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(da,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(zi,"_").concat(t),e)},registerDEMethodProvider:Ea,registerEditorProvider:function(t,e){ibiz.register.register("".concat(Ui,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat(xa,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(Gi,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(Hi,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Na,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(Yi,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:ga,registerPortletProvider:function(t,e){ibiz.register.register("".concat(Ji,"_").concat(t),e)},registerToolbarItemProvider:function(t,e){ibiz.register.register("".concat(Sa,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(ba,"_").concat(t),e)},registerUIActionProvider:ia,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(na,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(ra,"_").concat(t),e)},selectAndImport:Pr,strContain:Je,testCond:qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await He(t,e,i);await ibiz.commands.execute(Wo.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=Nr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:Vd,verifyDeRules:ii,verifyFormGroupLogic:si,verifyPanelGroupLogic:ni});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Tt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nt={exports:{}};!function(t,e){t.exports=function(t,e,i){var a=function(t,e){if(!e||!e.length||1===e.length&&!e[0]||1===e.length&&Array.isArray(e[0])&&!e[0].length)return null;var i;1===e.length&&e[0].length>0&&(e=e[0]),i=(e=e.filter((function(t){return t})))[0];for(var a=1;a<e.length;a+=1)e[a].isValid()&&!e[a][t](i)||(i=e[a]);return i};i.max=function(){var t=[].slice.call(arguments,0);return a("isAfter",t)},i.min=function(){var t=[].slice.call(arguments,0);return a("isBefore",t)}}}(Nt);var xt=Tt(Nt.exports),St={exports:{}};!function(t,e){t.exports=function(t,e){e.prototype.isSameOrBefore=function(t,e){return this.isSame(t,e)||this.isBefore(t,e)}}}(St);var Lt=Tt(St.exports),Mt={exports:{}};!function(t,e){var i,a;t.exports=(i="month",a="quarter",function(t,e){var s=e.prototype;s.quarter=function(t){return this.$utils().u(t)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(t-1))};var n=s.add;s.add=function(t,e){return t=Number(t),this.$utils().p(e)===a?this.add(3*t,i):n.bind(this)(t,e)};var o=s.startOf;s.startOf=function(t,e){var s=this.$utils(),n=!!s.u(e)||e;if(s.p(t)===a){var r=this.quarter()-1;return n?this.month(3*r).startOf(i).startOf("day"):this.month(3*r+2).endOf(i).endOf("day")}return o.bind(this)(t,e)}})}(Mt);var Rt=Tt(Mt.exports),Ot={exports:{}};!function(t,e){var i,a;t.exports=(i="week",a="year",function(t,e,s){var n=e.prototype;n.week=function(t){if(void 0===t&&(t=null),null!==t)return this.add(7*(t-this.week()),"day");var e=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var n=s(this).startOf(a).add(1,a).date(e),o=s(this).endOf(i);if(n.isBefore(o))return 1}var r=s(this).startOf(a).date(e).startOf(i).subtract(1,"millisecond"),c=this.diff(r,i,!0);return c<0?s(this).startOf("week").week():Math.ceil(c)},n.weeks=function(t){return void 0===t&&(t=null),this.week(t)}})}(Ot);var _t=Tt(Ot.exports),Ft={exports:{}};!function(t,e){var i;t.exports=(i="day",function(t,e,a){var s=function(t){return t.add(4-t.isoWeekday(),i)},n=e.prototype;n.isoWeekYear=function(){return s(this).year()},n.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),i);var e,n,o,r=s(this),c=(e=this.isoWeekYear(),o=4-(n=(this.$u?a.utc:a)().year(e).startOf("year")).isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,i));return r.diff(c,"week")+1},n.isoWeekday=function(t){return this.$utils().u(t)?this.day()||7:this.day(this.day()%7?t:t-7)};var o=n.startOf;n.startOf=function(t,e){var i=this.$utils(),a=!!i.u(e)||e;return"isoweek"===i.p(t)?a?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):o.bind(this)(t,e)}})}(Ft);var zt=Tt(Ft.exports),Vt=class{constructor(){this.view={enableDataInfoBar:!0,expCacheMode:"TABEXPPANEL:",disableHomeTabs:!1},this.grid={editShowMode:"row",editSaveMode:"cell-blur",overflowMode:"wrap"},this.appMenu={enableEcho:!0},this.codeList={timeout:36e5},this.form={mdCtrlConfirmBeforeRemove:!0},this.pickerEditor={overflowMode:"auto"}}},kt=t("RegisterCenter",class{constructor(){this.providers=new Map}register(t,e){this.providers.set(t,e)}unRegister(t){this.providers.delete(t)}get(t,...e){const i=this.providers.get(t);if(i)return i(...e)}}),Ut=t("DefaultErrorHandler",class{handle(t){return t instanceof i||t instanceof a?ibiz.message.error(t.message,10,!0):t instanceof s?401===t.status?ibiz.message.error(ibiz.i18n.t("runtime.utils.errorHandler.noPermissionless")):404===t.status?ibiz.mc.error.send(t):ibiz.notification.error({title:"",desc:t.message,duration:10}):t instanceof n?ibiz.message.error(t.message,t.duration,0===t.duration):t instanceof o&&ibiz.message.error(t.message,10,!0),ibiz.log.error(t),!0}}),Bt=t("ErrorHandlerCenter",class{constructor(){this.handlers=[]}register(t){this.handlers.unshift(t)}handleSingle(t){this.handlers.find((e=>!!e.handle(t)))||ibiz.log.error(ibiz.i18n.t("runtime.utils.errorHandler.noProcessor"),t)}handle(t){t instanceof Array?t.forEach((t=>{this.handleSingle(t)})):this.handleSingle(t)}}),Wt=class{static isHelperName(t){return this.helperNames.includes(t)}static handleJudgmentExecute(t,e,i){return i.fn?e?i.fn(t):i.inverse(t):e?i.hash.yes=!0:i.hash.no=!1}};Wt.helperNames=["lookup","log","and","camelCase","concat","eq","gt","get","lowerCase","lt","lte","neq","not","or","pascalCase","pluralize","snakeCase","spinalCase","upperCase"];var Gt=class{constructor(t,e){t.registerHelper(e,this.onExecute)}},jt=class extends Gt{constructor(t){super(t,"and")}onExecute(...t){const e=t[t.length-1];t.pop();const i=t.filter((t=>!!t)).length===t.length;return Wt.handleJudgmentExecute(this,i,e)}},Kt=class extends Gt{constructor(t){super(t,"camelCase")}onExecute(t){return t?B(t):""}},Ht=class extends Gt{constructor(t){super(t,"concat")}onExecute(...t){return t.pop(),t.join("")}},Xt=class extends Gt{constructor(t){super(t,"eq")}onExecute(t,e,i){const a=W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},qt=class extends Gt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=G(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Yt=class extends Gt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=j(t,e);return Wt.handleJudgmentExecute(this,a,i)}},Qt=class extends Gt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let s=!1;return s=z(t)?!W(K(t,(t=>W(t[e],i))),-1):t.hasOwnProperty(e)&&(s=W(t[e],i)),Wt.handleJudgmentExecute(this,s,a)}},$t=class extends Gt{constructor(t){super(t,"jsonParse")}onExecute(t){return JSON.parse(t)}},Jt=class extends Gt{constructor(t){super(t,"jsonStringify")}onExecute(t,e){return JSON.stringify(t,null,"number"==typeof e?e:void 0)}},Zt=class extends Gt{constructor(t){super(t,"lowerCase")}onExecute(t){return t?t.toLowerCase():""}},te=class extends Gt{constructor(t){super(t,"lt")}onExecute(t,e,i){const a=H(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ee=class extends Gt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=X(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ie=class extends Gt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!W(t,e);return Wt.handleJudgmentExecute(this,a,i)}},ae=class extends Gt{constructor(t){super(t,"not")}onExecute(t,e){const i=et(t)||Z(t);return Wt.handleJudgmentExecute(this,i,e)}},se=class extends Gt{constructor(t){super(t,"or")}onExecute(...t){var e;const i=t[t.length-1];t.pop();const a=t.find((t=>!!t));if(i.fn){const t=(null==(e=i.data)?void 0:e.root)||{};return a?i.fn(t):i.inverse(t)}return a||""}},ne=class extends Gt{constructor(t){super(t,"pascalCase")}onExecute(t){return t?q(t):""}},oe=class extends Gt{constructor(t){super(t,"snakeCase")}onExecute(t){return t?Y(t):""}},re=class extends Gt{constructor(t){super(t,"spinalCase")}onExecute(t){return t?Q(t):""}},ce=class extends Gt{constructor(t){super(t,"upperCase")}onExecute(t){return t?t.toUpperCase():""}};var de=t("HandlebarsUtil",class{constructor(){this.p=null}get isInit(){return!!this.hsb}async init(){if(this.isInit)return;if(this.p)return this.p;this.p=e.import("handlebars");const t=await this.p;var i;return this.hsb=t.default||t,this.p=null,i=this.hsb,new jt(i),new Kt(i),new Ht(i),new Xt(i),new qt(i),new Yt(i),new $t(i),new Jt(i),new Zt(i),new te(i),new ee(i),new ie(i),new ae(i),new se(i),new ne(i),new oe(i),new re(i),new ce(i),new Qt(i),this.hsb}async render(t,e){this.hsb||await this.init();return this.hsb.compile(t)(e)}syncRender(t,e){if(!this.hsb)throw new Error(ibiz.i18n.t("runtime.utils.handlebars.noInitHandlebars"));return this.hsb.compile(t)(e)}});function le(t){const e=[],i=/^%(.+)%$/;for(const a in t){let s=!0,n=t[a];ct(t[a])&&i.test(t[a])&&(s=!1,n=t[a].substring(1,t[a].length-1)),e.push({key:a.toLowerCase(),rawValue:s,value:n})}return e}function he(t,...e){if(!t||O(t))return{};return pe(Array.isArray(t)?t:le(t),...e)}function ue(t,e){const i=e.split(".");let a;const s=t.find((t=>{if(dt(t))return!1;if(i.length>1){a=t;for(let t=0;t<i.length;t++){const e=i[t];if(!a||!a[e]&&!Object.prototype.hasOwnProperty.call(a,e)){a=void 0;break}a=a[e]}return void 0!==a}return t[e]||Object.prototype.hasOwnProperty.call(t,e)}));return{find:!!s,value:i.length>1?a:null==s?void 0:s[e]}}function pe(t,...e){const i=/\$\{[^}]*\}/g,a={};for(const s of t)if(s.rawValue)a[s.key.toLowerCase()]=s.value||null;else{const t=s.value.match(i);if(null!==t){let i=s.value;t.forEach((t=>{const{find:a,value:s}=ue(e,t.slice(2,-1).toLowerCase());a&&(i=i.replace(t,"".concat(_(s)?"":s)))})),a[s.key.toLowerCase()]=i}else{const{find:t,value:i}=ue(e,s.value.toLowerCase());t&&(a[s.key.toLowerCase()]=i)}}return a}function me(t,e){const i={};if(!t)return i;const a=Array.isArray(t)?t:le(t),s=e[0];return a.forEach((t=>{const{rawValue:a,value:n}=t;!a&&n&&Object.prototype.hasOwnProperty.call(s,n)&&(i[n]=e.map((t=>t[n])).join(";"))})),i}function ge(t,e){const{deName:i,navFilter:a,pickupDEFName:s,navContexts:n,navParams:o}=t,{context:r,params:c,data:d,derValue:l}=e,h={},u={},p=l||d.srfkey;p&&(i&&(h[i]=p),a&&(u[a]=p),s&&(u["n_".concat(s.toLowerCase(),"_eq")]=p));const m=he(n,d,c,r),g=he(o,d,c,r);return Object.assign(h,m),Object.assign(u,g),{resultContext:h,resultParams:u}}function fe(t,e){if(t&&e){const i=t.find((t=>!!t.id&&t.id.toLowerCase()===e.toLowerCase()));if(i)return i}return null}function ye(t,e){var i,a;let s=t.controls||[];return(null==(a=null==(i=t.viewLayoutPanel)?void 0:i.controls)?void 0:a.length)&&(s=s.concat(t.viewLayoutPanel.controls)),s.find((t=>t.name===e||t.codeName===e||t.id===e))}function we(t){const e={},i={},a={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=t[s];if(-1!==s.indexOf(".")){const t=s.split(".");switch(t[0]){case"SRFNAVPARAM":Object.assign(i,{[t[1]]:n});break;case"SRFNAVCTX":Object.assign(e,{[t[1]]:n});break;default:Object.assign(a,{key:n})}}}return{navigateContexts:e,navigateParams:i,other:a}}function Ee(t){let e;if(t.controlRenders){const i=t.controlRenders.find((t=>"LAYOUTPANEL"===t.renderType&&!!t.layoutPanel));e=null==i?void 0:i.layoutPanel}return e}function ve(t,e){const i=t.appDEMethods;if(i&&e){const t=fe(i,e);if(t)return t;const a=i.find((t=>{switch(t.methodType){case"DEACTION":{const{actionTag:i}=t;return(null==i?void 0:i.toLowerCase())===e.toLowerCase()}case"FETCH":{const{dataSetTag:i}=t;return"fetch".concat(null==i?void 0:i.toLowerCase())===e.toLowerCase()}default:return!1}}));if(a)return a}return null}function Ie(t){const{width:e,height:i,widthMode:a,heightMode:s}=t,n={width:"",height:""};return"FULL"===a?n.width="100%":e&&e>0&&(n.width=e>0&&e<=1?"".concat(100*e,"%"):"".concat(e,"PERCENTAGE"===a?"%":"px")),"FULL"===s?n.height="100%":i&&i>0&&(n.height=i>0&&i<=1?"".concat(100*i,"%"):"".concat(i,"PERCENTAGE"===s?"%":"px")),n}function be(t,e){const i=[],a=ei.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return F(a)?i.push(a):z(a)?i.push(...a):V(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function De(t,e){const{mainStateAppDEFieldIds:i,demainStates:a}=t;if(i&&a){const t=[];return i.forEach((i=>{t.push(e[i])})),a.find((e=>{const{stateValue:i,state2Value:a,state3Value:s}=e;let n=!0;const o=[i,a,s];for(let e=0;e<t.length;e++)if("".concat(t[e])!=="".concat(o[e])){n=!1;break}return n}))}}function Ce(t,e){const i=ibiz.hub.getApp(e.appId).model,{demainStateOPPrivs:a,opprivAllowMode:s}=t,n=(null==a?void 0:a.map((t=>t.name)))||[];let o=[];if(s)o=n;else{o=[...i.deopprivs,...e.deopprivs].filter((t=>!n.includes(t.name))).map((t=>t.name))}return o}function Ae(t){return t.split(".").pop()}function Pe(t,e){const i=Ae(e);return ct(t[i])}function Te(t,e){var i;return null==(i=e.appDELogics)?void 0:i.find((e=>e.id===t))}function Ne(t,e){var i,a;const s=[];return null==(i=t.appDEFields)||i.forEach((t=>{"compute"===e&&t.computeAppDEFLogicId?s.push(t.computeAppDEFLogicId):"change"===e&&t.onChangeAppDEFLogicId?s.push(t.onChangeAppDEFLogicId):"default"===e&&t.defaultValueAppDEFLogicId&&s.push(t.defaultValueAppDEFLogicId)})),(null==(a=t.appDELogics)?void 0:a.filter((t=>s.includes(t.id))))||[]}function xe(t,e){var i;return null==(i=t.appDEFields)?void 0:i.find((t=>t.id===e))}async function Se(t,e){return ibiz.hub.getApp(e).getUIAction(t)}function Le(t){return t.detreeNodes.find((t=>t.rootNode))}function Me(t,e){return t.detreeNodes.find((t=>t.id===e))}function Re(t,e){const i=e.parentId||Le(t).id;return t.detreeNodeRSs.filter((t=>{return t.parentDETreeNodeId===i&&(a=t.searchMode,s=e.hasQuery,3===a||(s?1===a:2===a));var a,s}))}function Oe(t,e){var i;return null==(i=t.degridEditItems)?void 0:i.find((t=>t.codeName===e))}function _e(t){let e;switch(t.detailType){case"TABPANEL":e=t.deformTabPages;break;case"FORMPAGE":case"TABPAGE":case"GROUPPANEL":e=t.deformDetails}return e||[]}function Fe(t){return"MDCTRL"===t.detailType}function ze(t){const{viewLayoutPanel:e}=t,i=t.controls||[];return e&&i.push(...e.controls||[]),i}function Ve(t){const{viewLayoutPanel:e}=t,i=t.appViewLogics||[];return e&&i.push(...e.appViewLogics||[]),i}function ke(t){const{viewLayoutPanel:e}=t,i=t.appViewEngines||[];return e&&i.push(...e.appViewEngines||[]),i.filter((t=>"CTRL"!==t.engineCat||(ibiz.log.warn(ibiz.i18n.t("runtime.model.view.engineClassifications",{engineType:t.engineType})),!1)))}function Ue(t){return"CONTAINER"===t.itemType&&["CONTAINER_MULTIDATA","CONTAINER_SINGLEDATA"].includes(t.predefinedType)}var Be=["panelItems","panelTabPages","rootPanelItems"];function We(t){let e=[];for(const i of Be)if(t[i]&&t[i].length&&t[i].length>0){e=t[i];break}const i=[];return e.length&&(i.push(...e.filter((t=>"FIELD"===t.itemType))),e.forEach((t=>{Ue(t)||i.push(...We(t))}))),i}function Ge(t){return We(t)}function je(t){const e=new URL(t),i={},a={};let s="";if(e.searchParams.size>0){const s=e.searchParams.get("srfnavctx");if(s){try{Object.assign(i,JSON.parse(s))}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.parseSrfnavctxParameter",{urlStr:t}),e)}e.searchParams.delete("srfnavctx")}e.searchParams.forEach(((t,e)=>{a[e]=t}))}const n=e.pathname.replace("//","").split("/"),[o,r]=n;return s=r||o,{context:i,params:a,viewId:s}}async function Ke(t,e,i={},a={}){return async function(t,e,i={},a={}){let s;try{s=await Xe(t,e,i,a)}catch(t){return ibiz.log.error(t),{ok:!1,data:[]}}if("url"===s.type){const t=s.url;return new Promise((e=>{const i=window.open(t,"_blank");i&&(i.callback=()=>{e({ok:!0,data:[]})})}))}return await ibiz.commands.execute(Wo.TAG,s.viewId,s.context,s.params,s.opts)||{ok:!0,data:[]}}(t,e,i,a)}async function He(t,e,i={}){const a=e.lastIndexOf("?"),s=decodeURIComponent(e.substring(a+1,e.length)),n=Dt.parse(s,{delimiter:";"}),r=n.srfdename||"";if(!r)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.missingEntityName"));const c=ibiz.hub.getApp(t.srfappid).deName2DeCodeName.get(r.toUpperCase());if(!c)throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.noFoundSpecifiedEntity",{deName:r}));n[c.toLowerCase()]=n[r.toLowerCase()];const d="".concat(c).concat(ibiz.env.isMob?"Mob":"","RedirectView"),l=await ibiz.hub.getAppView(d);if(delete n.srfdename,"undo"!==n.srfwf){const t=n.processDefinitionKey.split("-")[3],e=t.substring(0,t.lastIndexOf("v")),i=t.substring(t.lastIndexOf("v"));n.wf=e,n.wfVersion=i}return n.srfprocessinstanceid&&(t.srfprocessinstanceid=n.srfprocessinstanceid,delete n.srfprocessinstanceid),{context:t,params:n,opts:i,viewId:l.id}}async function Xe(t,e,a={},s={}){var n;const r=he(t.appViewNavContexts||[],a,e);e=Object.assign(e.clone(),r);const c=he(t.appViewNavParams||[],a,e);Object.assign(a,c);const d=t.appDataEntityId,l=Ae(d);let h=(null==(n=s.data)?void 0:n[0])||{};e[l]=h[l]||e[l]||a[l];const u=t.getDataAppDEActionId,p=ibiz.hub.getApp(t.appId),m=await p.deService.getService(e,d);ibiz.loading.showRedirect();try{const t=await m.exec(u||"get",e,a);if(t.ok){h=t.data;let i=h.linkurl;if(i){if(e.srfprocessinstanceid&&(i+=";srfprocessinstanceid=".concat(e.srfprocessinstanceid)),ibiz.env.dev&&-1!==i.indexOf("appredirectview?")&&(i=i.slice(i.indexOf("appredirectview?"))),i.startsWith("http://")||i.startsWith("https://"))return{type:"url",url:i};if(i.startsWith("appredirectview?")){return{type:"view",...await He(e,i,s)}}throw new o(ibiz.i18n.t("runtime.utils.openRedirectView.unsupportedLinkUrl",{linkUrl:i}))}}}finally{ibiz.loading.hideRedirect()}const g=await ibiz.hub.getAppDataEntity(d,t.appId),f=await async function(t,e,i,a){let s="";const n=e.typeAppDEFieldId;if(n){const{codeName:i}=xe(t,n),s=a[i.toLowerCase()];if(ct(s))return s.startsWith("view://")?s:"".concat(s.toUpperCase());ibiz.log.warn(ibiz.i18n.t("runtime.utils.openRedirectView.redirectionView",{name:e.name,typeFieldId:n}),a)}const o="".concat(ibiz.env.isMob?"MOB":"","EDITVIEW"),r=i.srfwf;if(ct(r))return ct(i.wf)?"".concat(o,":").concat(r.toUpperCase(),":").concat(i.wf.toUpperCase()):"".concat(o,":").concat(r.toUpperCase());let c="";if(t.indexTypeAppDEFieldId){const{codeName:e}=xe(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(dt(c)&&t.formTypeAppDEFieldId){const{codeName:e}=xe(t,t.formTypeAppDEFieldId);c=a[e.toLowerCase()]}s=ct(c)?"".concat(o,":").concat(c.toString().toUpperCase()):"".concat(o);return s}(g,t,a,h);let y="";if(!f.startsWith("view://")){const n=f.split(":"),o=2===n.length?f:n.slice(0,2).join(":"),r="".concat(g.name.toUpperCase(),":").concat(f),c=[];t.redirectAppViewRefs&&c.push(...t.redirectAppViewRefs),t.appViewRefs&&c.push(...t.appViewRefs);const d=c.find((t=>{const e=t.name||t.id;return e===r||e===f||e===o}));if(d){if(y=d.refAppViewId,d.openMode&&(s.openMode=d.openMode),y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(d,ibiz.i18n.t("runtime.utils.openRedirectView.noConfiguredActualReference"))}throw ibiz.log.error(ibiz.i18n.t("runtime.utils.openRedirectView.redirectingViewReferences"),null==c?void 0:c.map((({refAppViewId:t,name:e,realTitle:i})=>({viewId:t,tag:e,title:i})))),new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.redirectionIdentifier",{rdTag:f,deRdTag:r,wfRdTag:o}))}{const t=je(f);Object.assign(e,t.context),Object.assign(a,t.params),y=t.viewId}if(y)return{type:"view",viewId:y,context:e,params:a,opts:{...s,data:[h]}};throw new i(t,ibiz.i18n.t("runtime.utils.openRedirectView.noMatchActualReferenceView",{rdTag:f}))}function qe(t,e,i){if(Object.is(e,"IN"))return $e(t,i);if(Object.is(e,"NOTIN"))return!$e(t,i);switch(e){case"EQ":return"".concat(t)==="".concat(i);case"NOTEQ":return"".concat(t)!=="".concat(i);case"LT":return Ye(t,i)<0;case"LTANDEQ":return Ye(t,i)<=0;case"GT":return Ye(t,i)>0;case"GTANDEQ":return Ye(t,i)>=0;case"ISNULL":return dt(t);case"ISNOTNULL":return ct(t);case"TESTNULL":return Z(t);case"IN":return $e(t,i);case"NOTIN":return!$e(t,i);case"LIKE":return Je(t,i);case"LEFTLIKE":return Je(t,i,"start");case"RIGHTLIKE":return Je(t,i,"end");default:throw new o(ibiz.i18n.t("runtime.utils.verify.valueOperations",{op:e}))}}function Ye(t,e){const i=Number(t),a=Number(e);if(!Number.isNaN(i)&&!Number.isNaN(a))return Qe(i,a);const s=new Date(t).getTime(),n=new Date(e).getTime();if(!Number.isNaN(s)&&!Number.isNaN(n))return Qe(s,n);throw new o(ibiz.i18n.t("runtime.utils.verify.noCompared",{value:t,value2:e}))}function Qe(t,e){return Number.isNaN(t)&&(t=0),Number.isNaN(e)&&(e=0),t>e?1:t<e?-1:0}function $e(t,e){if(!e||"string"!=typeof e)throw new o(ibiz.i18n.t("runtime.utils.verify.conditionalValues"));if(t){return e.split(",").includes("".concat(t))}return!1}function Je(t,e,i){if(!t||!e)return!1;const a="".concat(t).toUpperCase(),s="".concat(e).toUpperCase(),n=a.indexOf(s);switch(i){case"start":return 0===n;case"end":return n+s.length===a.length;default:return-1!==n}}var Ze={singleRowReturn:!1,isAsync:!0},ti=t("ScriptFunction",class{constructor(t,e,i=Ze){this.argKeys=[],this.options=i;const a=this.formatCode(e,i);this.calcArgKeys(t,i);const s=new Function(...this.argKeys,a);this.scriptFn=function(...t){try{return s.apply({},t)}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.utils.script.errorReportingScript"),a),t}}}formatCode(t,e){let i=t;return e.singleRowReturn&&(i="return (".concat(i,")")),e.isAsync&&(i="return (async function() { ".concat(i,"} )();")),i}calcArgKeys(t,e){const i=e.presetParams?Object.keys(e.presetParams):[];i.push(...t);i.push("document","el","selector","env","appSession","topViewSession","viewSession","context","viewParam","activeData","data","app","topView","parentView","view","parent","util","ctrl"),this.argKeys=Array.from(new Set(i))}convertArgs(t){const{presetParams:e}=this.options,i=e?tt(e,t):t;i.document=document,i.selector=t=>document.getElementsByClassName(t);const a=[];return this.argKeys.forEach((t=>{void 0===i[t]&&this.fillDefaultParams(t,i),a.push(i[t])})),a}fillDefaultParams(t,e){switch(t){case"util":e.util={message:ibiz.message,notification:ibiz.notification,modal:ibiz.modal,confirm:ibiz.confirm,openView:ibiz.openView};break;case"viewParam":e.viewParam=e.params;break;case"env":e.env=ibiz.env;break;case"app":e.app=ibiz.hub.controller;break;case"appSession":e.appSession=ibiz.hub.controller.session}const i=e.view;if(i)switch(t){case"parent":e.parent=i.parentView;break;case"topView":e.topView=i.getTopView();break;case"parentView":e.parentView=i.parentView;break;case"topViewSession":e.topViewSession=i.getTopView().session;break;case"viewSession":e.viewSession=i.session}}exec(t){const e=this.convertArgs(t);return this.scriptFn(...e)}}),ei=t("ScriptFactory",class{static createScriptFn(t,e,i){return new ti(t,e,i)}static execScriptFn(t,e,i){return this.createScriptFn(Object.keys(t),e,i).exec(t)}static execSingleLine(t,e={}){return this.execScriptFn(e,t,{singleRowReturn:!0,isAsync:!1})}});function ii(t,e,i){const a={isPast:!0,infoMessage:i.ruleInfo};if(function(t){return"GROUP"===t.condType}(i)){const s=i.conds;s&&s.length>0&&(a.isPast=function(t,e,i="AND",a=!1){if(!((null==t?void 0:t.length)>0))return!1;let s="AND"===i;for(let a=0,n=t.length;a<n;a++){const n=e(t[a],a);if("AND"===i){if(!n){s=!1;break}}else if("OR"===i&&n){s=!0;break}}return a?!s:s}(s,(i=>{const{isPast:s,infoMessage:n}=ii(t,e,i);return a.infoMessage=n,s}),i.condOp,!!i.notMode),!a.isPast&&("AND"===i.condOp&&i.notMode||"OR"===i.condOp&&!i.notMode)&&(a.infoMessage=i.ruleInfo))}else{t=(null==i?void 0:i.defname.toLowerCase())||t;try{if(function(t){return"SIMPLE"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){Object.is(s,"CURTIME")&&(i="".concat(new Date));if(Object.is(s,"ENTITYFIELD")){i=n[i=i?i.toLowerCase():""]?n[i]:i}(Z(a)||et(a))&&(a=ibiz.i18n.t("runtime.utils.verify.contentConform"));const c=qe(t,e,i);if(!c&&r)throw new o(a);return!c}(e[t],i.condOp,i.paramValue,i.ruleInfo,i.paramType,e,i.keyCond);else if(function(t){return"VALUERANGE2"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){dt(n)&&(n=ibiz.i18n.t("runtime.utils.verify.rangeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(ai(t,/^-?\d*\.?\d+$/,"",r))return!0;const c=Number.parseFloat(t);if(null!==e)if(i){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!=a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"REGEX"===t.condType}(i))a.isPast=!ai(e[t],i.regExCode,i.ruleInfo,i.keyCond);else if(function(t){return"STRINGLENGTH"===t.condType}(i))a.isPast=!function(t,e,i,a,s,n,r){dt(n)&&(n=ibiz.i18n.t("runtime.utils.verify.scopeRules"));if(dt(t)){if(r)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return n=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}const c=t.length;if(null!==e)if(i){if(c<e){if(r)throw new o(n);return!0}}else if(c<=e){if(r)throw new o(n);return!0}if(null!==a)if(s){if(c>a){if(r)throw new o(n);return!0}}else if(c>=a){if(r)throw new o(n);return!0}return n="",!1}(e[t],i.minValue,i.includeMinValue,i.maxValue,i.includeMaxValue,i.ruleInfo,i.keyCond);else if(function(t){return"SYSVALUERULE"===t.condType}(i)&&(null==i?void 0:i.sysValueRule)){const{ruleType:s,regExCode:n,scriptCode:r,ruleInfo:c}=i.sysValueRule;if(a.infoMessage=i.ruleInfo||c,"REG"===s)a.isPast=!ai(e[t],n,a.infoMessage,i.keyCond);else if("SCRIPT"===s){const{isPast:s,infoMessage:n}=function(t,e,i,a,s){dt(a)&&(a=ibiz.i18n.t("runtime.utils.verify.scriptRules"));const n=e;let r="",c=!0;const d=t=>{c=!1,(null==t?void 0:t.length)>0?t.forEach((t=>{(null==t?void 0:t.message)&&(r+=t.message)})):(null==t?void 0:t.message)&&(r=t.message)};try{const e=ei.execScriptFn({value:t,data:n},i,{isAsync:!1});"boolean"==typeof e&&(c=e)}catch(t){ibiz.log.error(t),d(t)}if(a="",!c&&s)throw new o(a);return{isPast:c,infoMessage:r||a}}(e[t],e,r,a.infoMessage,i.keyCond);a.isPast=s,a.infoMessage=n||a.infoMessage}}}catch(t){a.isPast=!1}a.isPast=i.notMode?!a.isPast:a.isPast}return a}function ai(t,e,i,a){dt(i)&&(i=ibiz.i18n.t("runtime.utils.verify.regularRules"));if(dt(t)){if(a)throw new o(ibiz.i18n.t("runtime.utils.verify.valueNull"));return i=ibiz.i18n.t("runtime.utils.verify.valueNull"),!0}if(!new RegExp(e).test(t)){if(a)throw new o(i);return!0}return i="",!1}function si(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.defdlogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroups"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!si(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.defdlogics.find((e=>si(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.defdname.toLowerCase()],e.condOP,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}function ni(t,e){if(function(t){return"GROUP"===t.logicType}(e)){const a=e.panelItemLogics;if(!a||0===a.length)throw new i(e,ibiz.i18n.t("runtime.utils.verify.emptyLogicGroupsProperly"));let s=!0;if("AND"===e.groupOP){s=void 0===a.find((e=>!ni(t,e)))}else if("OR"===e.groupOP){s=void 0!==e.panelItemLogics.find((e=>ni(t,e)))}return e.notMode?!s:s}if(function(t){return"SINGLE"===t.logicType}(e))return qe(t[e.dstModelField.toLowerCase()],e.condOp,e.value);throw new a(e,ibiz.i18n.t("runtime.utils.verify.unsupportedLogicTypes",{logicType:e.logicType}))}var oi=t("LayoutPanelUtil",class{constructor(){this.cache=new Map}register(t,e){this.cache.set(t,e)}get(t){return this.cache.get(t)}fill(t){const{viewLayoutPanel:e}=t;if(!e||!0===e.useDefaultLayout){const e=this.calcLayoutTag(t);if(this.cache.has(e)){const i=it(this.cache.get(e));t.viewLayoutPanel=i,t.appCounterRefs&&(i.appCounterRefs=t.appCounterRefs,delete t.appCounterRefs),t.appViewEngines&&(i.appViewEngines=t.appViewEngines,delete t.appViewEngines),t.appViewLogics&&(i.appViewLogics=t.appViewLogics,delete t.appViewLogics),t.appViewRefs&&(i.appViewRefs=t.appViewRefs,delete t.appViewRefs),t.controls&&(i.controls=t.controls,delete t.controls)}}return t}calcLayoutTag(t){const{viewType:e,viewStyle:i}=t;return"APPINDEXVIEW"===e?this.calcIndexViewLayoutTag(t):"".concat(e,"_").concat(i)}calcIndexViewLayoutTag(t){const{viewType:e,viewStyle:i,blankMode:a,mainMenuAlign:s}=t;let n="";a?n="BLANK_MODE":s&&(n=s.toUpperCase());let o="";return o=""!==n?"".concat(e,"_").concat(i,"_").concat(n):"".concat(e,"_").concat(i),ibiz.config.view.disableHomeTabs&&["APPINDEXVIEW_DEFAULT","APPINDEXVIEW_DEFAULT_LEFT","APPINDEXVIEW_DEFAULT_TOP"].includes(o)&&(o+="_NO_NAV"),o}});function ri(t){const e={};return t.param09&&(e.srfprocessinstanceid=t.param09),e}var ci=t("ControlType",(t=>(t.APP_MENU="APPMENU",t.GRID="GRID",t.FORM="FORM",t.SEARCHFORM="SEARCHFORM",t.TOOLBAR="TOOLBAR",t.DRBAR="DRBAR",t.VIEWPANEL="VIEWPANEL",t.PICKUP_VIEW_PANEL="PICKUPVIEWPANEL",t.DATAVIEW="DATAVIEW",t.TREEGRID="TREEGRID",t.WF_EXPBAR="WFEXPBAR",t.TREEVIEW="TREEVIEW",t.TREE_EXP_BAR="TREEEXPBAR",t.TAB_VIEWPANEL="TABVIEWPANEL",t.DRTAB="DRTAB",t.CHART="CHART",t.REPORT_PANEL="REPORTPANEL",t.LIST="LIST",t.MOB_MDCTRL="MOBMDCTRL",t.MULTI_EDIT_VIEWPANEL="MULTIEDITVIEWPANEL",t.WIZARD_PANEL="WIZARDPANEL",t.UPDATE_PANEL="UPDATEPANEL",t.SEARCHBAR="SEARCHBAR",t.DASHBOARD="DASHBOARD",t.CALENDAR="CALENDAR",t.PANEL="PANEL",t.VIEW_LAYOUT_PANEL="VIEWLAYOUTPANEL",t.MAP="MAP",t.GANTT="GANTT",t.TREE_GRIDEX="TREEGRIDEX",t.KANBAN="KANBAN",t.CALENDAR_EXPBAR="CALENDAREXPBAR",t.CHART_EXPBAR="CHARTEXPBAR",t.DATA_VIEW_EXPBAR="DATAVIEWEXPBAR",t.GANTT_EXPBAR="GANTTEXPBAR",t.GRID_EXPBAR="GRIDEXPBAR",t.LIST_EXPBAR="LISTEXPBAR",t.MAP_EXPBAR="MAPEXPBAR",t.STATE_WIZARD_PANEL="STATEWIZARDPANEL",t.TAB_EXP_PANEL="TABEXPPANEL",t.CUSTOM="CUSTOM",t.CAPTIONBAR="CAPTIONBAR",t.CONTEXT_MENU="CONTEXTMENU",t))(ci||{})),di=t("PlatformType",(t=>(t.IOS="IOS",t.ANDROID="Android",t.WECHAT="WeChat",t.QQ="QQ",t.DINGTALK="DingTalk",t.BROWSER="Browser",t.WCMP="WeChatMiniProgram",t.DESKTOP="Desktop",t))(di||{})),li=t("RouteConst",(t=>(t.ROUTE_MODAL_TAG="route-modal",t))(li||{})),hi=t("StudioViewEvents",class{});hi.onViewMounted="onMounted",hi.onViewDestroyed="onDestroyed";var ui=t("StudioPanelEvents",class{});ui.onClick="onClick",ui.onChange="onChange",ui.onEnter="onEnter",ui.onLeave="onLeave";var pi=t("StudioControlEvents",class{});pi.onBeforeLoad="onBeforeLoad",pi.onLoadSuccess="onLoadSuccess",pi.onLoadError="onLoadError",pi.onBeforeLoadDraft="onBeforeLoadDraft",pi.onLoadDraftSuccess="onLoadDraftSuccess",pi.onLoadDraftError="onLoadDraftError",pi.onBeforeSave="onBeforeSave",pi.onSaveSuccess="onSaveSuccess",pi.onSaveError="onSaveError",pi.onBeforeRemove="onBeforeRemove",pi.onRemoveSuccess="onRemoveSuccess",pi.onRemoveError="onRemoveError",pi.CLICK="onClick";var mi=t("SysUIActionTag",(t=>(t.NEW="New",t.EDIT="Edit",t.REFRESH="Refresh",t.EXIT="Exit",t.SAVE_AND_EXIT="SaveAndExit",t.SAVE_AND_NEW="SaveAndNew",t.SAVE="Save",t.SAVE_ROW="SaveRow",t.REMOVE="Remove",t.REMOVE_AND_EXIT="RemoveAndExit",t.NEW_ROW="NewRow",t.TOGGLE_FILTER="ToggleFilter",t.IMPORT="Import",t.EXPORT_EXCEL="ExportExcel",t.SAVE_AND_START="SaveAndStart",t.VIEW_WF_STEP="ViewWFStep",t.NO="No",t.YES="Yes",t.CANCEL="Cancel",t.OK="Ok",t.SEARCH="Search",t.RESET="Reset",t.FINISH="Finish",t.NEXT_STEP="NextStep",t.PREV_STEP="PrevStep",t.ADD_SELECTION="AddSelection",t.REMOVE_SELECTION="RemoveSelection",t.REMOVE_ALL="RemoveAll",t.ADD_ALL="AddAll",t.LOGOUT="Logout",t.LOGIN="Login",t.CANCEL_CHANGES="CancelChanges",t.COPY="Copy",t.VIEW="View",t.TOGGLE_ROW_EDIT="ToggleRowEdit",t.REFRESH_ALL="RefreshAll",t.REFRESH_PARENT="RefreshParent",t.FIRST_RECORD="FirstRecord",t.LAST_RECORD="LastRecord",t.PREV_RECORD="PrevRecord",t.NEXT_RECORD="NextRecord",t.LOAD_MORE="LoadMore",t.SHOTR_CUT="ShortCut",t))(mi||{})),gi=t("ValueOP",(t=>(t.EQ="EQ",t.NOT_EQ="NOTEQ",t.GT="GT",t.GT_AND_EQ="GTANDEQ",t.LT="LT",t.LT_AND_EQ="LTANDEQ",t.IS_NULL="ISNULL",t.IS_NOT_NULL="ISNOTNULL",t.IN="IN",t.NOT_IN="NOTIN",t.LIKE="LIKE",t.LIFT_LIKE="LIFTLIKE",t.RIGHT_LIKE="RIGHT_LIKE",t.CHILD_OF="CHILDOF",t.USER_LIKE="USERLIKE",t.BIT_AND="BITAND",t.EXISTS="EXISTS",t.NOT_EXISTS="NOTEXISTS",t))(gi||{})),fi=t("ViewCallTag",(t=>(t.LOAD="Load",t.GET_DATA="GetData",t.GET_ALL_DATA="GetAllData",t.VALIDATE="Validate",t.TOGGLE_COLLAPSE="ToggleCollapse",t.WF_WITHDRAW="WFWithdraw",t))(fi||{})),yi=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(yi||{})),wi=t("ViewType",(t=>(t.APP_INDEX_VIEW="APPINDEXVIEW",t.DE_GRID_VIEW="DEGRIDVIEW",t.DE_EDIT_VIEW="DEEDITVIEW",t.APP_DATA_UPLOAD_VIEW="APPDATAUPLOADVIEW",t.APP_ERROR_VIEW="APPERRORVIEW",t.APP_FILE_UPLOAD_VIEW="APPFILEUPLOADVIEW",t.APP_FUN_PICKUP_VIEW="APPFUNCPICKUPVIEW",t.APP_LOGIN_VIEW="APPLOGINVIEW",t.APP_LOGOUT_VIEW="APPLOGOUTVIEW",t.APP_PANEL_VIEW="APPPANELVIEW",t.APP_PIC_UPLOAD_VIEW="APPPICUPLOADVIEW",t.APP_PORTAL_VIEW="APPPORTALVIEW",t.APP_REDIRECT_VIEW="APPREDIRECTVIEW",t.APP_START_VIEW="APPSTARTVIEW",t.APP_WELCOME_VIEW="APPWELCOMEVIEW",t.APP_WF_ADD_STEP_AFTER_VIEW="APPWFADDSTEPAFTERVIEW",t.APP_WF_ADD_STEP_BEFORE_VIEW="APPWFADDSTEPBEFOREVIEW",t.APP_WF_REDIRECT_VIEW="APPWFREDIRECTVIEW",t.APP_WF_SENDBAC_VIEW="APPWFSENDBACKVIEW",t.APP_WF_STEP_ACTOR_VIEW="APPWFSTEPACTORVIEW",t.APP_WF_STEP_DATA_VIEW="APPWFSTEPDATAVIEW",t.APP_WF_STEP_TRACE_VIEW="APPWFSTEPTRACEVIEW",t.APP_WF_SUPPLY_INFO_VIEW="APPWFSUPPLYINFOVIEW",t.APP_WF_TAKE_ADVICE_VIEW="APPWFTAKEADVICEVIEW",t.DE_CALENDAR_EXP_VIEW="DECALENDAREXPVIEW",t.DE_CALENDAR_VIEW="DECALENDARVIEW",t.DE_CHART_EXP_VIEW="DECHARTEXPVIEW",t.DE_CHART_VIEW="DECHARTVIEW",t.DE_CHART_VIEW9="DECHARTVIEW9",t.DE_CUSTOM_VIEW="DECUSTOMVIEW",t.DE_DATA_VIEW="DEDATAVIEW",t.DE_DATA_VIEW9="DEDATAVIEW9",t.DE_DATAVIEW_EXP_VIEW="DEDATAVIEWEXPVIEW",t.DE_EDIT_VIEW2="DEEDITVIEW2",t.DE_EDIT_VIEW3="DEEDITVIEW3",t.DE_EDIT_VIEW4="DEEDITVIEW4",t.DE_EDIT_VIEW9="DEEDITVIEW9",t.DE_FORM_PICKUP_DATA_VIEW="DEFORMPICKUPDATAVIEW",t.DE_GANTT_EXP_VIEW="DEGANTTEXPVIEW",t.DE_GANTT_VIEW="DEGANTTVIEW",t.DE_GANTT_VIEW9="DEGANTTVIEW9",t.DE_GRID_EXP_VIEW="DEGRIDEXPVIEW",t.DE_GRID_VIEW2="DEGRIDVIEW2",t.DE_GRID_VIEW4="DEGRIDVIEW4",t.DE_GRID_VIEW8="DEGRIDVIEW8",t.DE_GRID_VIEW9="DEGRIDVIEW9",t.DE_HTML_VIEW="DEHTMLVIEW",t.DE_INDEX_PICKUP_DATA_VIEW="DEINDEXPICKUPDATAVIEW",t.DE_INDEX_VIEW="DEINDEXVIEW",t.DE_KANBAN_VIEW="DEKANBANVIEW",t.DE_KANBAN_VIEW9="DEKANBANVIEW9",t.DE_LIST_EXP_VIEW="DELISTEXPVIEW",t.DE_LIST_VIEW="DELISTVIEW",t.DE_LIST_VIEW9="DELISTVIEW9",t.DE_MAP_EXP_VIEW="DEMAPEXPVIEW",t.DE_MAP_VIEW="DEMAPVIEW",t.DE_MAP_VIEW9="DEMAPVIEW9",t.DE_MD_CUSTOM_VIEW="DEMDCUSTOMVIEW",t.DE_MEDITVIEW9="DEMEDITVIEW9",t.DE_MOB_CALENDAR_EXP_VIEW="DEMOBCALENDAREXPVIEW",t.DE_MOB_CALENDAR_VIEW="DEMOBCALENDARVIEW",t.DE_MOB_CALENDAR_VIEW9="DEMOBCALENDARVIEW9",t.DE_MOB_CHART_EXP_VIEW="DEMOBCHARTEXPVIEW",t.DE_MO_BCHART_VIEW="DEMOBCHARTVIEW",t.D_EMOB_CHART_VIEW9="DEMOBCHARTVIEW9",t.DE_MOB_CUSTOM_VIEW="DEMOBCUSTOMVIEW",t.DE_MOB_DATA_VIEW="DEMOBDATAVIEW",t.DE_MOB_DATA_VIEW_EXP_VIEW="DEMOBDATAVIEWEXPVIEW",t.DE_MOB_EDIT_VIEW="DEMOBEDITVIEW",t.DE_MOB_EDIT_VIEW3="DEMOBEDITVIEW3",t.DE_MOB_EDITVIEW9="DEMOBEDITVIEW9",t.DE_MOB_FORM_PICKUP_MDVIEW="DEMOBFORMPICKUPMDVIEW",t.DE_MOB_GANTT_EXP_VIEW="DEMOBGANTTEXPVIEW",t.DE_MOB_GANTT_VIEW="DEMOBGANTTVIEW",t.DE_MOB_GANTT_VIEW9="DEMOBGANTTVIEW9",t.DE_MOB_HTML_VIEW="DEMOBHTMLVIEW",t.DE_MOB_INDEX_PICKUP_MDVIEW="DEMOBINDEXPICKUPMDVIEW",t.DE_MOB_LIST_EXP_VIEW="DEMOBLISTEXPVIEW",t.DE_MOB_LIST_VIEW="DEMOBLISTVIEW",t.DE_MOB_MAP_VIEW="DEMOBMAPVIEW",t.DE_MOB_MAP_VIEW9="DEMOBMAPVIEW9",t.DE_MOB_MDVIEW="DEMOBMDVIEW",t.DE_MOB_MDVIEW9="DEMOBMDVIEW9",t.DE_MOB_MEDIT_VIEW9="DEMOBMEDITVIEW9",t.DE_MOB_MPICKUP_VIEW="DEMOBMPICKUPVIEW",t.DE_MOB_OPT_VIEW="DEMOBOPTVIEW",t.DE_MOB_PANEL_VIEW="DEMOBPANELVIEW",t.DE_MOB_PANEL_VIEW9="DEMOBPANELVIEW9",t.DE_MOB_PICKUP_LIST_VIEW="DEMOBPICKUPLISTVIEW",t.DE_MOB_PICKUP_MDVIEW="DEMOBPICKUPMDVIEW",t.DE_MOB_PICKUP_TREE_VIEW="DEMOBPICKUPTREEVIEW",t.DE_MOB_PICKUP_VIEW="DEMOBPICKUPVIEW",t.DE_MOB_PORTAL_VIEW="DEMOBPORTALVIEW",t.DE_MOB_PORTAL_VIEW9="DEMOBPORTALVIEW9",t.DE_MOB_REDIRECT_VIEW="DEMOBREDIRECTVIEW",t.DE_MOB_REPORT_VIEW="DEMOBREPORTVIEW",t.DE_MOB_TAB_EXP_VIEW="DEMOBTABEXPVIEW",t.DE_MOB_TAB_EXP_VIEW9="DEMOBTABEXPVIEW9",t.DE_MOB_TAB_SEARCH_VIEW="DEMOBTABSEARCHVIEW",t.DE_MOB_TAB_SEARCH_VIEW9="DEMOBTABSEARCHVIEW9",t.DE_MOB_TREE_EXP_VIEW="DEMOBTREEEXPVIEW",t.DEMOBTREEEXPVIEW9="DEMOBTREEEXPVIEW9",t.DE_MOB_TREE_VIEW="DEMOBTREEVIEW",t.DE_MOB_WFACTION_VIEW="DEMOBWFACTIONVIEW",t.DE_MOB_WF_DATA_REDIRECT_VIEW="DEMOBWFDATAREDIRECTVIEW",t.DE_MOB_WF_DYNAACTIO_NVIEW="DEMOBWFDYNAACTIONVIEW",t.DE_MOB_WFDYNA_EDIT_VIEW="DEMOBWFDYNAEDITVIEW",t.DE_MOB_WF_DYNA_EDIT_VIEW3="DEMOBWFDYNAEDITVIEW3",t.DE_MOB_WF_DYNA_EXP_MDVIEW="DEMOBWFDYNAEXPMDVIEW",t.DE_MO_BWF_DYNA_START_VIEW="DEMOBWFDYNASTARTVIEW",t.DE_MOB_WF_EDIT_VIEW="DEMOBWFEDITVIEW",t.DE_MOB_WF_EDIT_VIEW3="DEMOBWFEDITVIEW3",t.DE_MOB_WF_MDVIEW="DEMOBWFMDVIEW",t.DE_MOB_WF_PROXY_RESULT_VIEW="DEMOBWFPROXYRESULTVIEW",t.DE_MOB_WF_PROXY_START_VIEW="DEMOBWFPROXYSTARTVIEW",t.DE_MOB_WF_START_VIEW="DEMOBWFSTARTVIEW",t.DE_MOB_WIZARD_VIEW="DEMOBWIZARDVIEW",t.DE_MPICKUP_VIEW="DEMPICKUPVIEW",t.DE_MPICKUP_VIEW2="DEMPICKUPVIEW2",t.DE_OPT_VIEW="DEOPTVIEW",t.DE_PANEL_VIEW="DEPANELVIEW",t.DE_PANEL_VIEW9="DEPANELVIEW9",t.DE_PICKUP_DATA_VIEW="DEPICKUPDATAVIEW",t.DE_PICKUP_GRID_VIEW="DEPICKUPGRIDVIEW",t.DE_PICKUP_TREE_VIEW="DEPICKUPTREEVIEW",t.DE_PICKUP_VIEW="DEPICKUPVIEW",t.DE_PICKUP_VIEW2="DEPICKUPVIEW2",t.DE_PICK_UP_VIEW3="DEPICKUPVIEW3",t.DE_PORTAL_VIEW="DEPORTALVIEW",t.DE_PORTAL_VIEW9="DEPORTALVIEW9",t.DE_REDIRECT_VIEW="DEREDIRECTVIEW",t.DE_REPORT_VIEW="DEREPORTVIEW",t.DE_TAB_EXP_VIEW="DETABEXPVIEW",t.DE_TAB_EXP_VIEW9="DETABEXPVIEW9",t.DE_TAB_SEARCH_VIEW="DETABSEARCHVIEW",t.DE_TAB_SEARCH_VIEW9="DETABSEARCHVIEW9",t.DE_TREE_EXP_VIEW="DETREEEXPVIEW",t.DE_TREE_EXP_VIEW2="DETREEEXPVIEW2",t.DE_TREE_EXP_VIEW3="DETREEEXPVIEW3",t.DE_TREE_GRID_EXVIEW="DETREEGRIDEXVIEW",t.DE_TREE_GRID_EXVIEW9="DETREEGRIDEXVIEW9",t.DE_TREE_GRID_VIEW="DETREEGRIDVIEW",t.DE_TREE_GRID_VIEW9="DETREEGRIDVIEW9",t.DE_TREE_VIEW="DETREEVIEW",t.DE_TREE_VIEW9="DETREEVIEW9",t.DE_WF_ACTION_VIEW="DEWFACTIONVIEW",t.DE_WF_DATA_REDIRECT_VIEW="DEWFDATAREDIRECTVIEW",t.DE_WF_DYNA_ACTION_VIEW="DEWFDYNAACTIONVIEW",t.DE_WF_DYNA_EDIT_VIEW="DEWFDYNAEDITVIEW",t.DE_WF_DYNA_EDIT_VIEW3="DEWFDYNAEDITVIEW3",t.DE_WF_DYNA_EXP_GRID_VIEW="DEWFDYNAEXPGRIDVIEW",t.DE_WF_DYNA_START_VIEW="DEWFDYNASTARTVIEW",t.DE_WF_EDIT_PROXY_DATA_VIEW="DEWFEDITPROXYDATAVIEW",t.DE_WF_EDIT_VIEW="DEWFEDITVIEW",t.DE_WF_EDIT_VIEW2="DEWFEDITVIEW2",t.DE_WF_EDIT_VIEW3="DEWFEDITVIEW3",t.DE_WF_EDIT_VIEW9="DEWFEDITVIEW9",t.DE_WF_EXP_VIEW="DEWFEXPVIEW",t.DE_WF_GRID_VIEW="DEWFGRIDVIEW",t.DE_WF_PROXY_DATA_VIEW="DEWFPROXYDATAVIEW",t.DE_WF_PROXY_RESULT_VIEW="DEWFPROXYRESULTVIEW",t.DE_WF_PROXY_START_VIEW="DEWFPROXYSTARTVIEW",t.DE_WF_START_VIEW="DEWFSTARTVIEW",t.DE_WIZARD_VIEW="DEWIZARDVIEW",t.DE_SUB_APP_REF_VIEW="DESUBAPPREFVIEW",t))(wi||{})),Ei=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(Ei||{})),vi=t("Modal",class{constructor(t){this.mode="EMBED",this.viewUsage=4,this.ignoreDismissCheck=!1,this.hooks={shouldDismiss:new lt,beforeDismiss:new lt},this._dismiss=t=>{ibiz.log.error(ibiz.i18n.t("runtime.utils.modal.externalClosureCapability"),t)},t.mode&&(this.mode=t.mode),t.routeDepth&&(this.routeDepth=t.routeDepth),t.viewUsage&&(this.viewUsage=t.viewUsage),t.dismiss&&(this._dismiss=t.dismiss)}injectDismiss(t){this._dismiss=t}async dismiss(t={ok:!1,data:[]}){const e={};return!0!==this.ignoreDismissCheck&&await this.hooks.shouldDismiss.call(e),!1===e.allowClose?(ibiz.log.debug(ibiz.i18n.t("runtime.utils.modal.shouldDismissResult")),!1):(await this.hooks.beforeDismiss.call(t),this._dismiss(t),this.destroy(),!0)}destroy(){this.hooks.shouldDismiss.clear(),this.hooks.beforeDismiss.clear()}});function Ii(t,e){return t.filter((t=>{const{checkMode:i}=t,a=t.deformItemName||t.degridEditItemName;return 2!==i&&a===e}))}var bi=t("TextUtil",class{constructor(){this.inputElement=null}format(t,e){return t}copy(t){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=t,this.inputElement.select(),document.execCommand("copy")}}),Di=class{constructor(){this.psModelGroupCondBase=null}parse(t){if(t instanceof Array){const e=this.createPSModelGroupCond();e.parse(t),this.psModelGroupCondBase=e}}testSingleCond(t,e,i){try{if("ISNULL"===t)return null==e;if("ISNOTNULL"===t)return null!=e;if("EQ"===t||"ABSEQ"===t||"GT"===t||"GTANDEQ"===t||"LT"===t||"LTANDEQ"===t||"NOTEQ"===t){if(null==e||null==i)return!1;let a=-1;if(e==i?a=0:e>i&&(a=1),"EQ"===t||"ABSEQ"===t)return 0===a;if("GT"===t)return a>0;if("GTANDEQ"===t)return a>=0;if("LT"===t)return a<0;if("LTANDEQ"===t)return a<=0;if("NOTEQ"===t)return 0!==a}if("LIKE"===t)return null!=e&&null!=i&&-1!==e.toString().toUpperCase().indexOf(i.toString().toUpperCase());if("LEFTLIKE"===t)return null!=e&&null!=i&&0===e.toString().toUpperCase().indexOf(i.toString().toUpperCase())}catch(t){ibiz.log.error(t)}return!1}getPSModelGroupCondBase(){return this.psModelGroupCondBase}},Ci=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Ai=class extends Ci{parse(t){const e=t.length;let i=!0,a=!1,s=!1;for(let n=0;n<e;n++)if(i){const e=t[n];this.setCondOp(e),i=!1,a=!0}else if(a){const e=t[n];this.setParam(e),a=!1,s=!0}else if(s){const e=t[n];if(e instanceof Object&&!(e instanceof Array)){const t=e;null!=t.type&&this.setValueType(t.type.toString()),null!=t.value&&this.setValue(t.value.toString())}else this.setValue(e);break}}getValueType(){return this.strValueType}setValueType(t){this.strValueType=t}getValue(){return this.strValue}setValue(t){this.strValue=t}getParamType(){return this.strParamType}setParamType(t){this.strParamType=t}getParam(){return this.strParam}setParam(t){this.strParam=t}},Pi=class t extends Ci{constructor(){super(...arguments),this.childCondList=[],this.bNotMode=!1}parse(e){const i=e.length;let a=!0,s=!0,n=!1;for(let r=0;r<i;r++){if(a&&s){if("!"===e[r]){this.setNotMode(!0),a=!1;continue}}if(s){const t=e[r];this.setCondOp(t),s=!1,a=!1,n=!0}else if(n){const i=e[r];if(!(i instanceof Array))throw new o(ibiz.i18n.t("runtime.service.mustArray"));i.forEach((e=>{if(e.length>0){const i=e[0].toString();if("!"===i||"OR"===i||"AND"===i){const i=new t;i.parse(e),this.childCondList.push(i)}else{const t=new Ai;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Ti=class extends Pi{},Ni=class extends Ai{},xi=class t extends Di{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof Pi){const t=e.getChildPSModelCondBases();if(null==t||et(t))return!e.isNotMode();const s="AND"===e.getCondOp();let n=s;for(let e=0;e<t.length;e++){const o=t[e];if(this.testCond(o,i,a)){if(!s){n=!0;break}}else if(s){n=!1;break}}return e.isNotMode()?!n:n}if(e instanceof Ai){et(e.getParam())&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noAttributeName"),e);const s=i[e.getParam().toLowerCase()];let n=null;const o=e.getValueType(),r=e.getValue();return null==o||et(o)?n=e.getValue():(et(r)&&ibiz.log.warn(ibiz.i18n.t("runtime.service.noContextParameterName")),t.PARAMTYPE_WEBCONTEXT===o?n=a.data[r.toLowerCase()]:t.PARAMTYPE_DATACONTEXT===o&&(n=a.getValue(r.toLowerCase()))),this.testSingleCond(e.getCondOp(),s,n)}return ibiz.log.warn(ibiz.log.warn(ibiz.i18n.t("runtime.service.conditionalObjects")),e),!1}createPSModelSingleCond(){return new Ni}createPSModelGroupCond(){return new Ti}};xi.PARAMTYPE_DATACONTEXT="DATACONTEXT",xi.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Si=t("PSDEDQCondEngine",xi);async function Li(t,e){var i;const a=null==(i=ibiz.hub.getApp(e).model.appPFPluginRefs)?void 0:i.find((e=>e.pluginCode.toLowerCase()===t));if(a)return await ibiz.plugin.loadPlugin(a),"".concat(a.pluginType,"_").concat(a.pluginCode);ibiz.log.error(ibiz.i18n.t("runtime.register.helper.matchedPlugin",{pluginId:t}))}var Mi=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function Ri(t,e){ibiz.register.register("".concat(Mi,"_").concat(t),e)}function Oi(t){return ibiz.register.get("".concat(Mi,"_").concat(t))}async function _i(t){let e;const{codeName:i,counterType:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Li(s,n);if(t&&(e=Oi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=Oi(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=Oi(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var Fi=class{static getRegisterKey(t,e){switch(t){case Yi:return this.calcKeyByView(e);case Gi:case Hi:case zi:return this.calcKeyByCtrl(e);default:return""}}static calcKeyByView(t){const{controlItemModel:e,controlModel:i,viewModel:a}=t;let s="";return(null==a?void 0:a.codeName)&&(s+="".concat(a.codeName.toUpperCase())),(null==i?void 0:i.codeName)&&(s+="@".concat(i.codeName.toUpperCase())),(null==e?void 0:e.id)&&(s+="@".concat(e.id.toUpperCase())),s}static calcKeyByCtrl(t){const{controlModel:e,controlItemModel:i}=t;let a="",s="APP";if(e){const{appDataEntityId:t,controlType:i,codeName:n}=e;t&&(s=Ae(t).toUpperCase()),i&&(a+="@".concat(i.toUpperCase())),n&&(a+="@".concat(n.toUpperCase()))}return(null==i?void 0:i.codeName)&&(a+="@".concat(i.codeName.toUpperCase())),a=s+a,a}},zi=t("CONTROL_PROVIDER_PREFIX","CONTROL");function Vi(t){return ibiz.register.get("".concat(zi,"_").concat(t))}async function ki(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:s,appId:n}=t,o=Fi.getRegisterKey(zi,{controlModel:t});if(e=Vi(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Li(s,n);if(t&&(e=Vi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Vi("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=Vi(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var Ui=t("EDITOR_PROVIDER_PREFIX","EDITOR");function Bi(t){return ibiz.register.get("".concat(Ui,"_").concat(t))}async function Wi(t){let e;const{editorType:i,editorStyle:a,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Li(n,o);if(t&&(e=Bi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Bi("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorStyleType",{editorType:i,editorStyle:a}),t)}if(s){let n="".concat(s,"_").concat(i);if(a&&"DEFAULT"!==a&&(n+="_".concat(a)),e=Bi(n),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:s}),t)}if(e=Bi(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var Gi=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function ji(t){return ibiz.register.get("".concat(Gi,"_").concat(t))}async function Ki(t,e){let i;const{detailType:a,sysPFPluginId:s,appId:n}=t,o=Fi.getRegisterKey(Gi,{controlItemModel:t,controlModel:e});if(i=ji(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Li(s,n);if(t&&(i=ji(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=ji(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var Hi=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function Xi(t){return ibiz.register.get("".concat(Hi,"_").concat(t))}async function qi(t,e){let i;const{columnType:a,enableRowEdit:s,sysPFPluginId:n,appId:o}=t,r=Fi.getRegisterKey(Hi,{controlItemModel:t,controlModel:e});if(i=Xi(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),n){const t=await Li(n,o);if(t&&(i=Xi(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnPlugin",{pluginKey:t}))}const c=s?"".concat(a,"_EDIT"):a;if(i=Xi(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var Yi=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Qi(t){return ibiz.register.get("".concat(Yi,"_").concat(t.toUpperCase()))}async function $i(t,e,i){var a;let s;const{itemType:n,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=Fi.getRegisterKey(Yi,{controlItemModel:t,controlModel:e,viewModel:i});if(s=Qi(d),s)return s;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Li(o,r);if(t&&(s=Qi(t)),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)s=Qi("PREDEFINE_RENDER");else{if("CONTAINER"===n){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(s=Qi(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelContainerPredefined",{predefinedType:e,key:i}))}if("RAWITEM"===n){const e=(null==(a=t.rawItem)?void 0:a.predefinedType)||"DEFAULT",i="RAWITEM_".concat(e);if(s=Qi(i),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberDirectContent",{predefinedType:e,key:i}))}if("FIELD"===n){const{editor:e}=t;if(e&&e.predefinedType){if(s=Qi("FIELD_".concat(e.predefinedType.toUpperCase())),s)return s}}s=Qi(n)}if(s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:n}))}var Ji=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Zi(t){return ibiz.register.get("".concat(Ji,"_").concat(t))}async function ta(t){let e;const{portletType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Li(a,s);if(t&&(e=Zi(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=Zi(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var ea=t("UIACTION_PROVIDER_PREFIX","UIACTION");function ia(t,e){ibiz.register.register("".concat(ea,"_").concat(t),e)}function aa(t){return ibiz.register.get("".concat(ea,"_").concat(t))}async function sa(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:s,uiactionTag:n}=t;if(a){const t=await Li(a,s);if(t&&(e=aa(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=aa("".concat(i,"_").concat(n)),e)return e;if(e=aa(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var na=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function oa(t){let e;const{sysPFPluginId:i,appId:a}=t,s=await Li(i,a);if(s){if(e=ibiz.register.get("".concat(na,"_").concat(s)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:s}))}}var ra=t("VIEW_PROVIDER_PREFIX","VIEW");function ca(t){return ibiz.register.get("".concat(ra,"_").concat(t))}var da=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var la=t("PlatformProviderBase",class{back(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}init(){throw new Error(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}async login(t,e,i){return ibiz.auth.login(t,e)}async download(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(i.data){const t=e;return c(i.data,t),Promise.resolve(!0)}throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"))}}),ha=t("BrowserPlatformProvider",class extends la{});var ua=window.navigator.userAgent.toLowerCase();function pa(){return/Android|Adr/i.test(ua)?"Android":/iPhone|iPod|iPad/i.test(ua)?"IOS":/MicroMessenger/i.test(ua)?"WeChat":/DingTalk/i.test(ua)?"DingTalk":/miniProgram/i.test(ua)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var ma=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function ga(t,e){ibiz.register.register("".concat(ma,"_").concat(t),e)}function fa(t){return ibiz.register.get("".concat(ma,"_").concat(t))}function ya(){const t=fa(pa());return t||fa("Browser")}var wa=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ea(t,e){ibiz.register.register("".concat(wa,"_").concat(t),e)}function va(t){return ibiz.register.get("".concat(wa,"_").concat(t))}async function Ia(t){let e;const{methodType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Li(a,s);if(t&&(e=va(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=va(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var ba=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Da(t){return ibiz.register.get("".concat(ba,"_").concat(t))}async function Ca(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:s}=t;if(s){const t=await Li(s,a);if(t&&(e=Da(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Da(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Aa=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function Pa(t){return ibiz.register.get("".concat(Aa,"_").concat(t))}async function Ta(t){let e;const{sysPFPluginId:i,appId:a,itemType:s}=t;if(i){const t=await Li(i,a);if(t&&(e=Pa(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=Pa(s),e}var Na=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var xa=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Sa=t("TOOLBAR_ITEM_PROVIDER_PREFIX","TOOLBAR_ITEM");async function La(t){let e;const{sysPFPluginId:i,appId:a}=t;if(i){const t=await Li(i,a);if(t&&(s=t,e=ibiz.register.get("".concat(Sa,"_").concat(s))),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.toolbarItem",{pluginKey:t}))}var s;return e}var Ma=t("AC_ITEM_PROVIDER_PREFIX","AC_ITEM");var Ra=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.create(),this.params={},this.evt=new ht,this.data={},this.countChange=this.countChange.bind(this)}get isDestroyed(){return this.destroyed}async init(t,e){this.setParams(t,e),this.interval(),await this.load(),this.model.appDataEntityId&&ibiz.mc.command.change.on(this.countChange)}countChange(t){const e=t.data;if(this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}setParams(t,e){t&&(this.context=it(t)),e&&(this.params=it(e))}interval(){this.destroyInterval(),this.model.timer&&(this.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer))}destroyInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}async load(){throw new o(ibiz.i18n.t("runtime.service.noImplementedCounter"))}refresh(t,e){return this.setParams(t,e),this.load()}onChange(t,e=!0){this.evt.on("change",t),e&&ct(this.data)&&t(this.data)}offChange(t){this.evt.off("change",t)}getCounter(t){return this.data[t.toLowerCase()]||0}destroy(){this.destroyed=!0,this.context.destroy(),this.destroyInterval(),this.evt.reset(),ibiz.mc.command.change.off(this.countChange)}}),Oa=t("AppDECounter",class extends Ra{async init(t,e){this.appDataEntityId=this.model.appDataEntityId;const a=this.model.getAppDEActionId;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundCounterBehavior"));this.action=a,await super.init(t,e)}async load(){const t=ibiz.hub.getApp(this.context.srfappid),e=await t.deService.exec(this.appDataEntityId,this.action,this.context,this.params);return e.ok&&(this.data=e.data,this.evt.emit("change",this.data)),this.data}}),_a=t("AppDECounterProvider",class{createCounter(t){return new Oa(t)}});function Fa(){Ri("DEDR",(()=>new _a))}var za=t("DEDQCondUtil",class{static getCond(t){if(this.map.has(t))return this.map.get(t);const e=t.dedqgroupConditions;if(e){const i=new Si;return 1===e.length?i.parse(this.calcCond(e)[0]):e.length>1&&i.parse(["AND",this.calcCond(e)][0]),this.map.set(t,i),i}return null}static calcCond(t){const e=[];return t.forEach((t=>{const i=[];if("GROUP"===t.condType){const e=t;e.notMode&&i.push("!"),i.push(t.condOp);const a=e.dedqconditions;if(a){const t=this.calcCond(a);i.push(t)}}else{if("SINGLE"!==t.condType)throw new a(t,ibiz.i18n.t("runtime.service.unsupportedQueryTypes",{condType:t.condType}));{const e=t;i.push(e.condOp),i.push(e.fieldName),e.condValue?e.vartypeId?i.push({type:e.vartypeId,value:e.condValue}):i.push(e.condValue):i.push("")}}e.push(i)})),e}});za.map=new WeakMap;var Va=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=d.create(),this.params={},this.evt=new ht,this.commonKeys=["query","queryconds","searchconds"],this.codeList=t,this.codeList.enableCache){this.codelistChange=this.codelistChange.bind(this);const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&ibiz.mc.command.change.on(this.codelistChange)}}setParams(t,e){t&&(this.context=d.create({},{...t})),e&&(this.params=it(e))}async init(){return this.initPromise=(async()=>{const{predefinedType:t}=this.codeList;if(t){if(this.isPredefined=!0,!["OPERATOR","RUNTIME","DEMAINSTATE"].includes(t))throw new a(this.codeList,ibiz.i18n.t("runtime.service.predefinedType",{predefinedType:t}))}else this.initPromise=void 0})(),this.initPromise}convertData(t){const e={},{valueAppDEFieldId:i,textAppDEFieldId:a,iconClsAppDEFieldId:s,iconClsXAppDEFieldId:n,iconPathAppDEFieldId:o,iconPathXAppDEFieldId:r,disableAppDEFieldId:c,dataAppDEFieldId:d,clsAppDEFieldId:l,colorAppDEFieldId:h}=this.codeList,u=i?t[i]:t.srfkey;if(e.id=u,e.value=u,e.text=a?t[a]:t.srfmajortext,(s||n||o||r)&&(e.sysImage={appId:this.codeList.appId},s&&(e.sysImage.cssClass=t[s]),n&&(e.sysImage.cssClassX=t[n]),o&&(e.sysImage.imagePath=t[o]),r&&(e.sysImage.imagePathX=t[r])),c&&(e.disableSelect=Ha(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=ei.execSingleLine(d,t)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.service.dynamicCodeTable"))}return e}presetconvertData(t){const e={},{color:i,bkcolor:a,disabled:s,id:n,text:o,value:r,cls:c}=t;return e.value=r,e.color=i,e.bkcolor=a,e.text=o,e.id=n,e.disableSelect=s,e.cls=c,e.data=t,e}sortShoworder(t){return t.forEach((t=>{"showorder"in t||Object.assign(t,{showorder:1e3})})),t.sort(((t,e)=>t.showorder-e.showorder))}async load(t,e={}){const a={...e};this.commonKeys.forEach((t=>{delete a[t]})),this.setParams(t,a);const s=ibiz.hub.getApp(t.srfappid),{appDataEntityId:n,appDEDataSetId:o,minorSortAppDEFieldId:r,minorSortDir:c,pvalueAppDEFieldId:d,customCond:l}=this.codeList;if(r&&c&&Object.assign(a,{sort:"".concat(r.toLowerCase(),",").concat(c.toLowerCase())}),l){const e=he(ei.execSingleLine(l),a,t);Object.assign(a,e)}if(a.size||(a.size=1e4),this.isPredefined&&this.codeList.codeName){let t=this.codeList.codeName;if("OPERATOR"===this.codeList.predefinedType){const e=this.codeList.codeName.indexOf("__");t=-1!==e?this.codeList.codeName.substring(e+2):this.codeList.codeName}const e=await s.net.get("/dictionaries/codelist/".concat(t),a),i=[],{items:n}=e.data;return this.sortShoworder(n).length&&n.forEach((t=>{i.push(this.presetconvertData(t))})),Object.freeze(i)}if(!n)throw new i(this.codeList,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));if(!o)throw new i(this.codeList,ibiz.i18n.t("runtime.service.unconfiguredDataset"));const h=await s.deService.exec(n,o,t,void 0,a);let u=[];if(h.data.length)if(d){const t=this.prepareTreeData(h.data);t&&(u=t)}else h.data.forEach((t=>{u.push(this.convertData(t))}));return Object.freeze(u)}prepareTreeData(t){const{valueAppDEFieldId:e,pvalueAppDEFieldId:i}=this.codeList,a={},s=[];return t.forEach((t=>{a[t[e]]=this.convertData(t)})),t.forEach((t=>{const n=a[t[i]];n?(n.children=n.children||[],n.children.push(a[t[e]])):s.push(a[t[e]])})),s}async get(t,e={}){if(this.initPromise&&await this.initPromise,!this.codeList.enableCache)return this.load(t,e);const i=JSON.stringify(t)+JSON.stringify(e);if(this.cache.has(i)){const t=this.cache.get(i);if(t.expirationTime>(new Date).getTime())return t.promise?t.promise:t.items;this.cache.delete(i)}const a=this.load(t,e),{cacheTimeout:s}=this.codeList,n=-1===s||Z(s)?ibiz.config.codeList.timeout:this.codeList.cacheTimeout,o={expirationTime:(new Date).getTime()+n,promise:a};this.cache.set(i,o);const r=await a;return o.items=r,delete o.promise,r}codelistChange(t){const e=t.data,{appDataEntityId:i}=this.codeList;if(i){const t=Ae(i);e&&e.srfdecodename&&e.srfdecodename.toLowerCase()===t&&this.refresh()}}async refresh(){const t=JSON.stringify(this.context)+JSON.stringify(this.params);this.cache.delete(t);const e=await this.get(this.context,this.params);this.evt.emit("change",e)}onChange(t,e=!0){this.evt.on("change",t);const i=JSON.stringify(this.context)+JSON.stringify(this.params),a=this.cache.get(i);e&&ct(a)&&t(a.items)}offChange(t){this.evt.off("change",t)}destroy(){const{appDataEntityId:t,appDEDataSetId:e}=this.codeList;t&&e&&this.codeList.enableCache&&ibiz.mc.command.change.off(this.codelistChange)}});function ka(t,e){if(null!=e){const{srfkey:t}=e;if(!Z(t)&&!et(t))return!0}throw new o(ibiz.i18n.t("runtime.service.processedWithout",{funcName:t}))}function Ua(t,e){const{srfsessionid:i}=e;if(!Z(i)&&!et(i))return!0;throw new o(ibiz.i18n.t("runtime.service.noExistProcessed",{funcName:t}))}var Ba=t("DECache",class{constructor(t){this.entity=t,this.cacheMap=new Map}get isUnionKey(){var t;return!!(null==(t=this.entity.unionKeyValueAppDEFieldIds)?void 0:t.length)}forceAdd(t,e){const i=this.cacheMap.get(e.srfkey);i&&(i.assign(e),ibiz.log.warn("forceAdd",e.srfkey,e))}forceUpdate(t,e){this.cacheMap.set(e.srfkey,it(e)),ibiz.log.warn("forceUpdate",e.srfkey,e)}forceDelete(t,e){this.cacheMap.delete(e),ibiz.log.warn("forceDelete",e)}add(t,e){if(this.isUnionKey&&(this.calcUnionKey(e),this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.createPrimaryKeyData",{srfkey:e.srfkey}));try{Ua("add",t),(Z(e.srfkey)||et(e.srfkey))&&(e.srfkey=ut()),e.srftempdate=(new Date).getTime();const i=()=>{this.cacheMap.set(e.srfkey,it(e)),ibiz.log.warn("add",e.srfkey,e)},a=this.getTransaction(t);return a?a.change(e.srfkey,(()=>{i()})):i(),e}catch(t){return ibiz.log.error(t),null}}get(t,e){try{Ua("get",t);const i=this.cacheMap.get(e);return ibiz.log.warn("get",e,i),it(i)}catch(t){return ibiz.log.error(t),null}}update(t,e){const i=e.srfkey;if(this.isUnionKey&&(this.calcUnionKey(e),i!==e.srfkey&&this.checkData(t,e.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:e.srfkey}));try{Ua("update",t),ka("update",e),e.srftempdate=(new Date).getTime();const a=this.cacheMap.get(i);if(a){const s=it(a);s.assign(e);const n=()=>{a.assign(e),i!==e.srfkey&&this.cacheMap.delete(i),this.cacheMap.set(e.srfkey,a),ibiz.log.warn("update",e.srfkey,e)},o=this.getTransaction(t);return o?o.change(e.srfkey,(()=>{n()})):n(),s}throw new Error(ibiz.i18n.t("runtime.service.noExistNoUpdated"))}catch(t){return ibiz.log.error(t),null}}delete(t,e){try{Ua("delete",t);const i=e;if(this.cacheMap.has(i)){const e=this.cacheMap.get(i),a=()=>{this.cacheMap.delete(i),ibiz.log.warn("delete",i)},s=this.getTransaction(t);return s?s.change(i,(()=>{a()})):a(),e}return null}catch(t){return ibiz.log.error(t),null}}createBatch(t,e){try{Ua("add",t);const i=t=>{this.cacheMap.set(t.srfkey,t),ibiz.log.warn("add",t.srfkey,t)},a=this.getTransaction(t);for(let t=0;t<e.length;t++){const s=e[t];(Z(s.srfkey)||et(s.srfkey))&&(s.srfkey=ut()),s.srftempdate=(new Date).getTime();const n=it(s);a?a.change(n.srfkey,(()=>{i(n)})):i(n)}return e}catch(t){ibiz.log.error(t)}return[]}updateBatch(t,e){try{Ua("update",t);const i=(t,e)=>{e!==t.srfkey&&this.cacheMap.delete(e),this.cacheMap.set(t.srfkey,t),ibiz.log.warn("update",t.srfkey,t)},a=this.getTransaction(t);for(let s=0;s<e.length;s++){const n=e[s];ka("update",n);const r=n.srfkey;if(this.isUnionKey&&(this.calcUnionKey(n),r!==n.srfkey&&this.checkData(t,n.srfkey)))throw new o(ibiz.i18n.t("runtime.service.updatePrimaryKeyData",{srfkey:n.srfkey}));n.srftempdate=(new Date).getTime();const c=this.cacheMap.get(n.srfkey);if(!c)throw new Error(ibiz.i18n.t("runtime.service.dataNoExistNoUpdated",{srfdename:n.srfdename,srfmajortext:n.srfmajortext,srfkey:n.srfkey}));{const t=it(c);t.assign(n),e[s]=t,a?a.change(n.srfkey,(()=>{c.assign(n),i(c,r)})):(c.assign(n),i(c,r))}}return e}catch(t){return ibiz.log.error(t),null}}deleteBatch(t,e){try{Ua("delete",t)}catch(t){return ibiz.log.error(t),e}const i=[];for(let t=0;t<e.length;t++){const a=e[t];this.cacheMap.has(a)||i.push(a)}if(i.length>0)throw new Error(ibiz.i18n.t("runtime.service.noDeleted",{notRemoveKey:i.join("、")}));const a=t=>{this.cacheMap.delete(t),ibiz.log.warn("delete",t)},s=this.getTransaction(t);for(let t=0;t<e.length;t++){const i=e[t];s?s.change(i,(()=>{a(i)})):a(i)}return[]}checkData(t,e){return!!this.cacheMap.get(e)}getList(){const t=this.cacheMap.values();return Array.from(t)}generatePred(t={}){const e={};t.srfkey&&(e.srfkey=at(t.srfkey)),delete t.srfkey;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e[i]=at(a)}return st(e)}clear(){this.cacheMap.clear()}calcUnionKey(t){const e=this.entity.unionKeyValueAppDEFieldIds.map((t=>fe(this.entity.appDEFields||[],t).codeName.toLowerCase())).map((e=>Z(t[e])?"__empty__":t[e]));t.srfkey=e.join("||")}getTransaction(t){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&!0===e.transaction.state.isOpen?e.transaction:null}}),Wa=/\$\{(.*?)\}/g;function Ga(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(Wa);return{path:t,keys:(null==e?void 0:e.map((t=>t.substring(2,t.length-1))))||[]}})).filter((e=>{const{keys:i}=e;return 0===i.length||i.every(((e,a)=>a===i.length-1||null!=t[e]))})).sort(((t,e)=>e.keys.length-t.keys.length));if(i.length>0)return i[0]}function ja(t,e){const i=Ga(t,e);if(i){if(i.keys.length>0){let{path:e}=i;return i.keys.forEach(((a,s)=>{e=s===i.keys.length-1?e.replace(new RegExp("/[^/]+/\\$\\{".concat(a,"\\}")),""):e.replace("${".concat(a,"}"),t[a])})),e}return i.path}return""}var Ka=t("SearchFilter",class{constructor(t,e){if(this.page=0,this.size=1e3,this.data={},this.sortField="srfordervalue",this.sortMode="ASC",this.context=t,e){if(Z(e.page)||et(e.page)||(this.page=e.page),Z(e.size)||et(e.size)||(this.size=e.size),Z(e.query)||et(e.query)||(this.query=e.query),!Z(e.sort)&&!et(e.sort)){const t=e.sort.split(",");t.length>=1&&([this.sortField]=t),t.length>=2&&(this.sortMode=t[1].toUpperCase())}this.data={...e},delete this.data.page,delete this.data.size,delete this.data.query,delete this.data.sort}}getValue(t){return this.data[t]?this.data[t]:this.context[t]}});function Ha(t){if("boolean"==typeof t)return t;if("number"==typeof t)return t>0;if("string"!=typeof t)return!!t;switch(t){case"true":return!0;case"false":return!1;default:{const e=Number(t);return!Number.isNaN(e)&&e>0}}}function Xa(t){const e={};if(!t)return e;const i=t.split(",");return i&&i.length>0&&i.forEach((t=>{const[i,a]=t.split(":");e[i]=parseInt(a,10)})),e}function qa(t){const e={};return t.forEach((t=>{e[t.srflistmapfield]=t,delete t.srflistmapfield})),e}function Ya(t){const e=[];return Object.keys(t).forEach((i=>{const a=t[i];a.srflistmapfield=i,e.push(a)})),e}var Qa=t("CodeListService",class{constructor(t){this.appModel=t,this.allCodeLists=new Map,this.cache=new Map}getStatic(t){const e=t.codeName;if(this.cache.has(e))return this.cache.get(e);const i=t.codeItems;let a=[];return(null==i?void 0:i.length)&&(a=this.formatStaticItems(i,t.codeItemValueNumber)),this.cache.set(e,Object.freeze(a)),a}setCodeList(t){const{id:e,codeName:i}=t;this.allCodeLists.set(e,t),this.allCodeLists.set(i,t)}getCodeList(t){return this.allCodeLists.get(t)}formatStaticItems(t,e){return t.map((t=>{var i;let a=t.text;t.textLanguageRes&&(a=ibiz.i18n.t(t.textLanguageRes.lanResTag,t.text));let{tooltip:s}=t;t.tooltipLanguageRes&&(s=ibiz.i18n.t(t.tooltipLanguageRes.lanResTag,t.tooltip));const n={text:a,value:e?Number(t.value):t.value,color:t.color,id:t.codeName,textCls:t.textCls,disableSelect:t.disableSelect,tooltip:s,data:t.data?ei.execSingleLine(t.data):void 0,sysImage:t.sysImage,userData:t.userData};return(null==(i=t.codeItems)?void 0:i.length)&&(n.children=this.formatStaticItems(t.codeItems,e)),Object.freeze(n)}))}async getDynamicCodeList(t,e,i={}){let a;const s=t.codeName;return this.cache.has(s)?a=this.cache.get(s):(a=new Va(t),this.cache.set(s,a),await a.init()),a.get(e,i)}async get(t,e,i){const a=this.allCodeLists.get(t);if(!a)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));return"STATIC"===a.codeListType?this.getStatic(a):"DYNAMIC"===a.codeListType?this.getDynamicCodeList(a,e,i):[]}async getCodeListInstance(t){let e;const i=this.allCodeLists.get(t);if(!i)throw new o(ibiz.i18n.t("runtime.service.noFindCodeList",{tag:t}));if("DYNAMIC"===i.codeListType){const t=i.codeName;this.cache.has(t)?e=this.cache.get(t):(e=new Va(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof Va&&t.destroy()}))}}),$a=t("ConfigService",class{constructor(t,e,i){this.appId=t,this.folder=e,this.tag=i,this.app=ibiz.hub.getApp(t)}async save(t){const e=await this.app.net.put("/configs/".concat(this.folder,"/").concat(this.tag),t);return!!e.ok&&e.data}async load(){const t=await this.app.net.get("/configs/".concat(this.folder,"/").concat(this.tag));return t.ok&&t.data||{}}}),Ja=t("CounterService",class{static async getCounter(t,e,i){let a=t.id;if(i&&i.srfcustomtag&&(a=i.srfcustomtag),this.counterMap.has(a)){const t=this.counterMap.get(a);if(!1===t.isDestroyed)return t;this.counterMap.delete(a)}const s=(await _i(t)).createCounter(t);return await s.init(e,i),this.counterMap.set(a,s),s}static async getCounterByRef(t,e,a){const{appCounter:s}=t;if(!s)throw new i(t,ibiz.i18n.t("runtime.service.noConfiguredCounters"));return this.getCounter(s,e,a)}});Ja.counterMap=new Map;var Za=t("WorkFlowService",class{constructor(t){this.model=t,this.commonBaseUrl="",this.app=ibiz.hub.getApp(t.appId);const e=ibiz.appData.context;this.commonBaseUrl="/wfcore/".concat(e.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase())}getBaseUrl(){return this.commonBaseUrl}getActiveData(t,e){return e.srfprocessinstanceid&&(t.srfprocessinstanceid=e.srfprocessinstanceid),t}getWFInstanceTag(t){return t.srfprocessinstanceid||"alls"}async getWFStep(t){const{processDefinitionKey:e,taskDefinitionKey:i}=t;return this.app.net.get("".concat(this.getBaseUrl(),"/process-definitions/").concat(e,"/usertasks/").concat(i))}async getWFLink(t,e){const i=t[this.model.codeName.toLowerCase()],{taskDefinitionKey:a}=t;return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(i,"/usertasks/").concat(a,"/ways"),{activedata:this.getActiveData(e,t)})}async getWFHistory(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.get("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/history"))}async getWFProcessDiagram(t){const e=t[this.model.codeName.toLowerCase()];return this.app.net.request("".concat(this.getBaseUrl(),"/").concat(e,"/process-instances/").concat(this.getWFInstanceTag(t),"/processdiagram"),{method:"post",data:{},responseType:"blob"})}async getWFVersion(t){return this.app.net.get("/wfcore/".concat(ibiz.appData.context.srfsystemid,"-app-").concat(this.app.model.codeName.toLowerCase(),"/").concat(this.model.name.toLowerCase()).concat(t?"-".concat(t):"","/process-definitions2"))}async wfStart(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/process-instances"),{...e,activedata:this.getActiveData(i,t)})}async wfSubmit(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId),{...e,activedata:this.getActiveData(i,t)})}async wfWithdraw(t,e,i){return this.app.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/withdraw"),{...e,activedata:this.getActiveData(i,t)})}async wfReassign(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/transfer"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepBefore(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/beforesign"),{...e,activedata:this.getActiveData(i,t)})}async wfAddStepAfter(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/aftersign"),{...e,activedata:this.getActiveData(i,t)})}async wfSendBack(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendback"),{...e,activedata:this.getActiveData(i,t)})}async wfSendCopy(t,e,i){return ibiz.net.post("".concat(this.getBaseUrl(),"/").concat(t[this.model.codeName.toLowerCase()],"/tasks/").concat(e.taskId,"/sendcopy"),{...e,activedata:this.getActiveData(i,t)})}async exec(t,e,i={},a={}){switch(t){case"wfstart":return this.wfStart(e,i,a);case"wfsubmit":return this.wfSubmit(e,i,a);case"reassign":return this.wfReassign(e,i,a);case"addstepbefore":return this.wfAddStepBefore(e,i,a);case"addstepafter":return this.wfAddStepAfter(e,i,a);case"sendback":return this.wfSendBack(e,i,a);case"sendcopy":return this.wfSendCopy(e,i,a);default:throw new o(ibiz.i18n.t("runtime.service.noImplemented",{methodName:t}))}}}),ts=class{constructor(t){this.model=t}exportData(t,e,i,a){const s=ja(i,this.model),n="".concat(s,"/").concat(this.model.deapicodeName2,"/exportdata/").concat(e.toLowerCase(),"/?srfexporttag=").concat(t.codeName);return ibiz.net.request(n,{method:"post",data:a,responseType:"blob"})}},es=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(es||{})),is=t("AppDataEntity",class t{get srfuf(){return this.srfkey===this.tempsrfkey?1:0}constructor(e,i={}){Object.defineProperty(this,"_entity",{enumerable:!1,configurable:!0,value:e}),Object.defineProperty(this,"_data",{enumerable:!1,configurable:!0,value:it(i instanceof t?i._data:i)}),Object.defineProperty(this,"srfdeid",{get:()=>e.id}),Object.defineProperty(this,"srfdecodename",{get:()=>e.codeName});const a=fe(e.appDEFields||[],e.keyAppDEFieldId);if(a){const t=a.codeName.toLowerCase();Object.defineProperty(this,"srfkeyfield",{get:()=>t}),Object.defineProperty(this,"srfkey",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn(ibiz.i18n.t("runtime.service.noConfiguredPrimary",{codeName:e.codeName}));const s=fe(e.appDEFields||[],e.majorAppDEFieldId);if(s){const t=s.codeName.toLowerCase();Object.defineProperty(this,"srfmajorfield",{get:()=>t}),Object.defineProperty(this,"srfmajortext",{set(e){this._data[t]=e},get(){return this._data[t]}})}else ibiz.log.warn(ibiz.i18n.t("runtime.service.noConfiguredField",{codeName:e.codeName}));Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:Z(this.srfkey)?ut():this.srfkey}),this.defineProperties()}defineProperties(){var t;const{_data:e,convertVal:i}=this,a={};Object.keys(e).forEach((t=>{a[t]={enumerable:!0,set(i){e[t]=i},get:()=>e[t]}})),null==(t=this._entity.appDEFields)||t.forEach((t=>{const s=t.codeName.toLowerCase();a[s]={enumerable:!0,set(a){e[s]=i(a,t.stdDataType)},get:()=>e[s]},e[s]=i(e[s],t.stdDataType)})),Object.defineProperties(this,a)}clone(){const e=new t(this._entity,this._data);return e.srfkey=this.srfkey,e}assign(e){let i={};return i=e instanceof t?e._data:e,Object.keys(i).forEach((t=>{void 0===i[t]&&delete i[t]})),Object.assign(this._data,i),this}convertVal(t,e){if(null==t)return t;if(Z(e))return t;if(l.isNumber(e)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),as=t("MethodDto",class{constructor(t,e,i,a){this.service=t,this.entity=e,this.isLocalMode=i,this.dto=a,this.dtoMap=new Map,a?(this.app=ibiz.hub.getApp(e.appId),this.fields=a.appDEMethodDTOFields||[]):this.fields=[]}async get(t,e,s=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return e=this.format(t,e);const n={},o=ibiz.uiDomainManager.get(t.srfsessionid);for(let r=0;r<this.fields.length;r++){const c=this.fields[r],d=c.codeName.toLowerCase();switch(c.type){case"SIMPLE":case"SIMPLES":case"DTO":break;case"DTOS":if(c.listMap)e[d]&&(n[d]=0===e[d].length?null:qa(e[d]));else{if(void 0!==e[d]&&!1===s)break;if(!c.refAppDataEntityId)break;const a=o.getDERConfig(c.refAppDataEntityId),r=await this.getFieldDto(t,c),l=await ibiz.hub.getAppDEService(r.entity.appId,c.refAppDataEntityId,t),h=a.find((t=>t.majorAppDataEntityId===this.entity.id));let u;if(h&&h.nestedAppDEDataSetId){const i=it(t);i[this.entity.codeName.toLowerCase()]=e.srfkey;const a={};h.parentAppDEFieldId&&(a[h.parentAppDEFieldId]=e.srfkey),u=await l.exec(h.nestedAppDEDataSetId,i,a)}else{if(r.entity.id===this.entity.id)throw new i(c,ibiz.i18n.t("runtime.service.subRelationships"));u=await l.exec("FetchDefault",t)}if(u.ok){const e=u.data,i=[];for(let a=0;a<e.length;a++)i.push(await r.get(t,e[a],!0));n[d]=i}}break;default:throw new a(c,ibiz.i18n.t("runtime.service.unsupportedMethod",{type:c.type}))}}return{...e,...n}}async sets(t,e){if(!0===t.srfsimple&&!1===this.isLocalMode){if(e&&e.length>0){for(let i=0;i<e.length;i++)e[i]=this.format(t,e[i]);return e.map((t=>this.service.createEntity(t)))}return[]}const i=ibiz.uiDomainManager.get(t.srfsessionid);return Promise.all(e.map((async e=>{const a=this.fields.filter((t=>"DTOS"===t.type)).map((async a=>{const s=a.codeName.toLowerCase();if(a.listMap&&"object"==typeof e[s])e[s]=Ya(e[s]);else{if(!a.refAppDataEntityId)return;const n=i.getDERConfig(a.refAppDataEntityId).find((t=>t.majorAppDataEntityId===this.entity.id)),o=await this.getFieldDto(t,a);n||o.service.local.clear();const r=e[s];if(r&&r.length>0){const i=e[this.entity.keyAppDEFieldId];a.refPickupAppDEFieldId&&r.forEach((t=>{t[a.refPickupAppDEFieldId]=i})),await o.sets(t,r)}else await o.sets(t,[])}}));for(let t=0;t<a.length;t++)await a[t];const s=this.service.createEntity(e);return this.isLocalMode&&await this.service.local.add(t,s),s})))}async calcRs(t,e=0){if(e>10)return;e+=1;const i=ibiz.uiDomainManager.get(t.srfsessionid),a=this.fields.filter((t=>"DTOS"===t.type));for(let s=0;s<a.length;s++){const n=a[s];if(!n.refAppDataEntityId)continue;if(0===i.getDERConfig(n.refAppDataEntityId).length){const a=await this.getFieldDto(t,n);a.entity.minorAppDERSs&&i.setDERConfig(n.refAppDataEntityId,a.entity.minorAppDERSs.filter((t=>1===t.rsmode))),await a.calcRs(t,e)}}}format(t,e){const i={};for(let t=0;t<this.fields.length;t++){const a=this.fields[t],s=a.codeName.toLowerCase();"DTOS"===a.type&&a.listMap&&("[object Object]"===Object.prototype.toString.call(e[s])&&(i[s]=Ya(e[s])),"[object Array]"===Object.prototype.toString.call(e[s])&&(i[s]=qa(e[s])))}return{...e,...i}}async getFieldDto(t,e){if(this.dtoMap.has(e.codeName))return this.dtoMap.get(e.codeName);const i=await ibiz.hub.getAppDataEntity(e.refAppDataEntityId,this.entity.appId),a=fe(i.appDEMethodDTOs||[],e.refAppDEMethodDTOId),s=await this.app.deService.getService(t,i.id);s.isLocalMode=!0;const n=s.createMethodDto(a,{isLocalMode:!0});return this.dtoMap.set(e.codeName,n),n}}),ss=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new Ba(e),this.configCache=new $a(e.appId,"PSAppDataEntity",e.codeName),this.wf=new Za(e),this.file=new ts(e)}async getMethod(t,e=!1){const s=e?"ac-".concat(t):t;if(this.methodMap.has(s))return this.methodMap.get(s);const n=ve(this.model,t);if(!n)throw new i(this.model,ibiz.i18n.t("runtime.service.noFoundServiceMethod",{id:t}));const o=await Ia(n);if(!o)throw new a(n,ibiz.i18n.t("runtime.service.UnsupportedServiceMethod",{methodType:n.methodType}));const r=o.create(this,this.model,n,{acMode:e,localMode:this.isLocalMode});return this.methodMap.set(s,r),r}async exec(t,e,i,a,s){const n=await this.getMethod(t);if(n)return n.exec(e,i,a,s);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}getDraft(t,e,i){return this.exec("GetDraft",t,e,i)}create(t,e,i){return this.exec("Create",t,e,i)}get(t,e,i){return this.exec("Get",t,e,i)}update(t,e,i){return this.exec("Update",t,e,i)}remove(t,e,i){return this.exec("Remove",t,e,i)}fetchDefault(t,e,i){return this.exec("FetchDefault",t,e,i)}getDraftTemp(t,e,i){return this.exec("GetDraftTemp",t,e,i)}createTemp(t,e,i){return this.exec("CreateTemp",t,e,i)}getTemp(t,e,i){return this.exec("GetTemp",t,e,i)}updateTemp(t,e,i){return this.exec("UpdateTemp",t,e,i)}removeTemp(t,e,i){return this.exec("RemoveTemp",t,e,i)}fetchTempDefault(t,e,i){return this.exec("FetchTempDefault",t,e,i)}async execAc(t,e,i,a={}){const s=await this.getMethod(t,!0);if(s)return s.exec(e,i,a);throw new o(ibiz.i18n.t("runtime.service.noSupportedMethod",{codeName:this.model.codeName,id:t}))}aiChatSse(t,e,i={},a={}){const s=ibiz.hub.getApp(this.model.appId),n=this.calcSsePath(e);return new Promise(((e,o)=>{s.net.sse("/".concat(n),{srfactag:"AIChat",...i},{headers:{"Content-Type":"application/json"},body:JSON.stringify(a),onmessage:e=>{if(e.data){const i=JSON.parse(e.data);t(i)}},onclose:()=>{e()},onerror:t=>{o(t)}})}))}aiChatHistory(t,e={},i={}){const a=ibiz.hub.getApp(this.model.appId),s=this.calcSsePath(t,!0);return a.net.post(s,i,{srfactag:"AIChat",...e})}calcSsePath(t,e=!1){const i=t[this.model.codeName.toLowerCase()],a="/".concat(this.model.deapicodeName2,"/ssechatcompletion").concat(e?"/histories":"").concat(i?"/".concat(i):"");return ja(t,this.model)+a}newEntity(t){return t instanceof is?t.clone():new is(this.model,t)}createEntity(t){return Array.isArray(t)?t.map((t=>this.newEntity(t))):this.newEntity(t)}async destroy(){this.local.clear()}createMethodDto(t,e){return new as(this,this.model,null==e?void 0:e.isLocalMode,t)}}),ns=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],os=t("ControlVO",class t{constructor(t={},e=new Map){Object.defineProperty(this,"$origin",{enumerable:!1,configurable:!0,value:t||{}}),Object.defineProperty(this,"$dataUIMap",{enumerable:!1,configurable:!0,value:e||new Map}),Object.defineProperty(this,"srfactionparam",{get(){return this.$origin.srfactionparam},set(t){this.$origin.srfactionparam=t},enumerable:!0,configurable:!0}),["srfkey","srfmajortext"].forEach((t=>{if(Object.prototype.hasOwnProperty.call(this.$origin,t))Object.defineProperty(this,t,{get(){return this.$origin[t]},set(e){this.$origin[t]=e},enumerable:!1,configurable:!0});else if(this.$dataUIMap.has(t)){const{dataKey:e}=this.$dataUIMap.get(t);Object.defineProperty(this,t,{get(){return this.$origin[e]},set(t){this.$origin[e]=t},enumerable:!1,configurable:!0})}else Object.defineProperty(this,t,{enumerable:!1,configurable:!0,writable:!0,value:null})})),Object.prototype.hasOwnProperty.call(this.$origin,"tempsrfkey")?Object.defineProperty(this,"tempsrfkey",{get(){return this.$origin.tempsrfkey},set(t){this.$origin.tempsrfkey=t},enumerable:!1,configurable:!0}):Object.defineProperty(this,"tempsrfkey",{enumerable:!1,configurable:!0,writable:!0,value:Z(this.srfkey)?ut():this.srfkey}),Object.defineProperty(this,"srfuf",{get(){return Object.prototype.hasOwnProperty.call(this.$origin,"srfuf")?this.$origin.srfuf:this.srfkey===this.tempsrfkey?1:0},enumerable:!1,configurable:!0}),["srfdeid","srfdecodename","srfkeyfield","srfmajorfield"].forEach((t=>{Object.defineProperty(this,t,{get(){return this.$origin[t]},enumerable:!1,configurable:!0})})),this.$dataUIMap.forEach(((t,e)=>{const i=t.dataKey;this.linkProperty(e,i,t)})),Object.keys(t).forEach((t=>{Object.prototype.hasOwnProperty.call(this,t)||this.linkProperty(t,t)}))}linkProperty(t,e,i){const a=!i||i.isOriginField;ns.includes(t)||(a||Object.prototype.hasOwnProperty.call(this.$origin,t)?Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get(){return this.$origin[e]},set(t){this.$origin[e]=t}}):Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:null}))}getOrigin(){return this.$origin}setOrigin(e){this.$origin=e instanceof t?e.getOrigin():e}clone(){const e=it(this.$origin),i=new t(e,this.$dataUIMap);return Object.keys(this).forEach((t=>{i[t]=this[t]})),i}}),rs=t("ControlService",class{constructor(t){this.dataUIMap=new Map,this.model=t}async init(t){this.app=ibiz.hub.getApp(this.model.appId),this.initUIDataMap()}initUIDataMap(){}async exec(t,e,i,a){const s=this.handleCustomRequestHeader(),n=await this.app.deService.exec(this.model.appDataEntityId,t,e,i,a,s);return await this.handleItemPrivilege(n.data,e),n}async handleItemPrivilege(t,e){const{enableItemPrivilege:i,appDataEntityId:a}=this.model;if(t&&i&&a){const i=await this.app.authority.getService(a);(Array.isArray(t)?t:[t]).forEach((t=>{i.setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}))}}handleCustomRequestHeader(){const t={},{enableItemPrivilege:e}=this.model;return e&&Object.assign(t,{srfdataaccaction:!0}),t}handleResponse(t){return h(t)}toUIData(t){return new os(t,this.dataUIMap)}}),cs=t("MDControlService",class extends rs{async fetch(t,e={}){var i;const a=(null==(i=this.model.fetchControlAction)?void 0:i.appDEMethodId)||"fetchdefault";let s=await this.exec(a,t,e);return s=this.handleResponse(s),s}async get(t,e={}){var i;const a=(null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async getDraft(t,e={}){var i;const a=(null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft";let s=await this.exec(a,t,void 0,e);return s=this.handleResponse(s),s}async remove(t,e={}){var i;const a=(null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove";return await this.exec(a,t,void 0,e)}async create(t,e){var i;const a=(null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async update(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}async updateBatch(t,e){var i;const a=(null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.map((t=>t.getOrigin())));return s=this.handleResponse(s),s}async exportData(t,e,i={}){throw new o("未实现")}handleResponse(t){const e=super.handleResponse(t);return e.headers&&(e.headers["x-page"]&&(e.page=Number(e.headers["x-page"])),e.headers["x-per-page"]&&(e.size=Number(e.headers["x-per-page"])),e.headers["x-total"]&&(e.total=Number(e.headers["x-total"])),e.headers["x-total-pages"]&&(e.totalPages=Number(e.headers["x-total-pages"]))),e.ok&&(pt(e.data)?e.data=e.data.map((t=>this.toUIData(t))):e.data=this.toUIData(e.data)),e}}),ds=t("DeAuthorityService",class{constructor(t){this.entityModel=t,this.dataAccActionMap=new Map}setDataAccAction(t,e){t.srfsessionid&&this.dataAccActionMap.set("".concat(t.srfsessionid,"-").concat(t.srfkey),e),this.dataAccActionMap.set(t.srfkey,e)}getDataAccAction(t){return this.dataAccActionMap.get(t)}async calcByDataAccessAction(t,e,i,a){if(a){if(!await this.calcDeDataAccAction(t,e,i))return!1}return!!await this.calcByDeMainState(t,e)}async calcMajorDataAccAction(t){const{minorAppDERSs:e}=this.entityModel;if(!e)return;const i=null==e?void 0:e.find((e=>{const i=Ae(e.majorAppDataEntityId);return Object.prototype.hasOwnProperty.call(t,i)&&t[i]}));if(!i)return;const a=await ibiz.hub.getApp(t.srfappid),s=await a.authority.getService(i.majorAppDataEntityId);if(!s)return;const n=Ae(i.majorAppDataEntityId);return s.getDataAccAction("".concat(t.srfsessionid,"-").concat(t[n]))||s.getDataAccAction("".concat(t[n]))}async calcDeDataAccAction(t,e,i){let a,s=!0;const{dataAccCtrlMode:n}=this.entityModel;switch(n){case 1:a=(null==e?void 0:e.srfdataaccaction)?Xa(e.srfdataaccaction):void 0;break;case 2:case 3:if(a=Xa(await this.calcMajorDataAccAction(i)),e&&e.srfdataaccaction){const t=Xa(e.srfdataaccaction);Object.assign(a,t)}}return a&&t&&!a[t]&&(s=!1),s}async calcByDeMainState(t,e={}){let i=!0;if(0===Object.keys(e).length)return i;const a=this.entityModel;if(!a.enableDEMainState)return ibiz.log.debug(ibiz.i18n.t("runtime.service.masterState",{codeName:a.codeName})),i;ibiz.log.debug(ibiz.i18n.t("runtime.service.operationIdentifier",{dataAccessAction:t}),e,a);const s=De(a,e);if(s){ibiz.log.debug(ibiz.i18n.t("runtime.service.matchMasterState"),s);const e=Ce(s,a);ibiz.log.debug(ibiz.i18n.t("runtime.service.masterStatePermissions"),e),i=e.includes(t)}else ibiz.log.debug(ibiz.i18n.t("runtime.service.noMatchedState")),i=!1;return ibiz.log.debug(ibiz.i18n.t("runtime.service.permissionCalculation",{dataAccessAction:t,result:i})),i}}),ls=t("AuthorityService",class{constructor(t){this.appModel=t,this.cache=new Map,this.constructorCache=new Map,this.resCodes=[],this.enablePermission=!1}register(t,e){this.constructorCache.set(t,e)}async getService(t){if(!this.cache.has(t)){const e=await ibiz.hub.getAppDataEntity(t,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}));const i=this.constructorCache.get(t);let a;a=i?await i(e):new ds(e),this.cache.set(t,a)}return this.cache.get(t)}async init(t=ibiz.appData){t&&(t.unires&&(this.resCodes=t.unires),!0===t.enablepermissionvalid&&ibiz.env.enablePermission&&(this.enablePermission=!0))}calcByResCode(t){return!this.enablePermission||this.resCodes.includes(t)}async calcByNoDataAccessAction(t,e,i){if(this.enablePermission){const a=await ibiz.hub.getApp(this.appModel.appId),s=await a.getOPPriv(t,i);if(this.enablePermission&&(null==s?void 0:s.mapSysUniResCode)){if(!this.calcByResCode(s.mapSysUniResCode))return!1}else if(i){const a=await this.getService(i),s=Xa(await a.calcMajorDataAccAction(e));if(s&&t&&!s[t])return!1}}return!0}async calcByDataAccessAction(t,e,i,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(this.enablePermission&&(null==i?void 0:i.mapSysUniResCode)&&!this.calcByResCode(i.mapSysUniResCode))return!1}if(a){return(await this.getService(a)).calcByDataAccessAction(t,i,e,this.enablePermission)}return!0}}),hs=t("V7AuthService",class{get isAnonymous(){return"1"===mt(u.IS_ANONYMOUS)}async anonymousLogin(){const{anonymousUser:t,anonymousPwd:e}=ibiz.env;if(!t||!e)return ibiz.log.error(ibiz.i18n.t("runtime.service.noFoundUsernamePassword")),!1;const i=await this.login(t,e);if(i){gt(u.IS_ANONYMOUS,"1",0,!0);const t=mt(u.TOKEN),e=mt(u.TOKEN_EXPIRES),i=mt(u.TOKEN_REMEMBER),a=mt(u.REFRESH_TOKEN);gt(u.TOKEN,t,0,!0),gt(u.TOKEN_EXPIRES,e,0,!0),gt(u.TOKEN_REMEMBER,i,0,!0),a&&gt(u.REFRESH_TOKEN,a,0,!0)}return i}async login(t,e,i,a){try{this.clearAuthData();const s=await ibiz.net.post("/v7/login",{loginname:t,password:e,rememberme:i},{},a),{data:n}=s;if(n&&n.token){const t=i?30:0;i&&gt(u.TOKEN_REMEMBER,"1",t,!0),gt(u.TOKEN,n.token,t,!0);const e=(new Date).getTime()+1e3*(n.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(e),t,!0),n.refresh_token&&gt(u.REFRESH_TOKEN,n.refresh_token,t,!0),ft(u.IS_ANONYMOUS)}return!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.loginFailure"),desc:t.message||""})}return!1}async logout(){try{return await ibiz.net.get("/v7/logout"),this.clearAuthData(),!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.logoutFailure"),desc:t.message||""})}return!1}async changePwd(t,e){try{return{ok:!0,result:await ibiz.net.post("/uaa/changepwd",{oldPwd:t,newPwd:e})}}catch(t){return{ok:!1,result:t}}}async extendLogin(){if(this.isAnonymous)return;const t=mt(u.TOKEN),e=mt(u.TOKEN_EXPIRES);if(t&&e){let t=Number(e)-(new Date).getTime();const i=3e5;t=t>i?t-i:0,setTimeout((async()=>{const t=mt(u.TOKEN_REMEMBER),e=mt(u.REFRESH_TOKEN),i=t?30:0;let a;if(a=null!=e&&""!==e?await ibiz.net.get("/uaa/refresh_token/".concat(e)):await ibiz.net.get("/uaa/refreshtoken2"),a.ok){t&&gt(u.TOKEN_REMEMBER,"1",i,!0),gt(u.TOKEN,a.data.token,i,!0);const e=(new Date).getTime()+1e3*(a.data.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(e),i,!0),a.data.refresh_token&&gt(u.REFRESH_TOKEN,a.data.refresh_token,i,!0),await this.loadAppData(),ibiz.hub.getAllApps().forEach((t=>{t.initMqtt()}))}this.extendLogin()}),t)}}async refreshToken(){const t=mt(u.TOKEN_REMEMBER),e=mt(u.REFRESH_TOKEN);if(null!=e&&""!==e){const i=await ibiz.net.get("/uaa/refresh_token/".concat(e));if(i.ok){const e=t?30:0;t&&gt(u.TOKEN_REMEMBER,"1",e,!0),gt(u.TOKEN,i.data.token,e,!0);const a=(new Date).getTime()+1e3*(i.data.expirein||7199);gt(u.TOKEN_EXPIRES,"".concat(a),e,!0),i.data.refresh_token&&gt(u.REFRESH_TOKEN,i.data.refresh_token,e,!0),ft(u.IS_ANONYMOUS)}}}getAuthInfo(){const t=mt(u.TOKEN),e=!!mt(u.IS_ANONYMOUS);return t?{token:t,isAnonymous:e}:void 0}async loadAppData(){const t=await ibiz.net.get("/appdata");t.ok&&(ibiz.appData=t.data)}clearAuthData(){ft(u.TOKEN),ft(u.TOKEN_EXPIRES),ft(u.TOKEN_REMEMBER),ft(u.REFRESH_TOKEN),ft(u.IS_ANONYMOUS),ibiz.appData=void 0,ibiz.orgData=void 0}}),us=t("AsyncActionService",class{async fetch(t={}){const e=await ibiz.net.post("/portal/asyncaction/all",t);return Z(e.data)&&(e.data=[]),e}async get(t){return await ibiz.net.get("/portal/asyncaction/".concat(t))}}),ps=t("MethodInput",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodInput;if(s){const i=fe(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){return this.dto?this.dto.get(t,e):e}async format(t,e){return this.dto?this.dto.format(t,e):e}}),ms=t("MethodReturn",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a;const s=i.appDEMethodReturn;if(s){const i=fe(e.appDEMethodDTOs||[],s.appDEMethodDTOId);i&&(this.dto=t.createMethodDto(i,{isLocalMode:this.isLocalMode}))}}async handle(t,e){if(this.dto){const i=ibiz.hub.getApp(this.entity.appId),a=ibiz.uiDomainManager.get(t.srfsessionid);a&&!0!==a.state.rsInit&&(await this.dto.calcRs(t),a.calcParentRs(),a.state.rsInit=!0),a.dataChangeCompleted(),i.deService.clearTempCacheByRs({srfappid:i.appId,srfsessionid:t.srfsessionid},this.entity.id);return(await this.dto.sets(t,[e]))[0]}return dt(e)&&(e={}),new is(this.entity,e)}async format(t,e){return this.dto?this.dto.format(t,e):e}}),gs=t("Method",class{constructor(t,e,i,a=!1){this.service=t,this.entity=e,this.method=i,this.isLocalMode=a,this.app=ibiz.hub.getApp(e.appId),this.input=new ps(t,e,i),this.result=new ms(t,e,i)}async request(t,e,a,s,n){const{actionType:o,requestMethod:r}=this.method;if("REMOTE"===o){const e=this.method.requestPath;let o=null;switch(r){case"POST":o=await this.app.net.post(this.mergeRequestPath(t,e),a||s||{},{},n);break;case"GET":o=await this.app.net.get(this.mergeRequestPath(t,e),a||s,n);break;case"PUT":o=await this.app.net.put(this.mergeRequestPath(t,e),a||s||{},n);break;case"DELETE":o=await this.app.net.delete(this.mergeRequestPath(t,e),a||s);break;default:throw new i(this.method,r?ibiz.i18n.t("runtime.service.requestMethods",{requestMethod:r}):ibiz.i18n.t("runtime.service.noConfiguredRequestMethod"))}return o}throw new i(this.method,ibiz.i18n.t("runtime.service.unsupportedBehaviorTypes",{actionType:o}))}mergeRequestPath(t,e){return e?"".concat(t).concat(e):"".concat(t)}calcPath(t){const e="/".concat(this.entity.deapicodeName2);return ja(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),fs=class{constructor(t,e,i,a){this.deLogicParams=t,this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default",this.parameters={context:e,data:z(i)?i:[i],params:a}}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}},ys=class{},ws=class extends ys{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName.toLowerCase()}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=t.params[this.dstParam];let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.missingConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=qe(n[this.dstField],this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.sourceDataMissingConditionValue"));const e=t.params[this.srcParam];r=e[this.value],o=qe(n[this.dstField],this.op,e[this.value]);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.noSupportedTime"));default:r=this.value,o=qe(n[this.dstField],this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityLogicalConnection",{name:this.model.name,type:this.type,dstField:this.dstField}),n[this.dstField],ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},Es=class t extends ys{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new ws(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicLink.connectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicLink.entityConnectionConditional",{name:this.model.name,id:this.model.id}),n),n}},vs=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Es(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},Is=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new vs(t)))}},bs=class extends Is{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDELogicParamId:s,retDELogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.entityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDELogicParamId:n}),t.params[n])}},Ds=class extends Is{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Cs=class extends Is{async exec(t){t.isEndNode=!0;const{returnParamId:e,returnType:i,rawValue:s}=this.model;if(i){switch(i){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(s);break;case"LOGICPARAM":t.result=t.params[e];break;default:throw new a(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedReturnType",{returnType:i}))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endNode",{id:this.model.id,returnType:i}),t.result)}}};function As(t,e){const{srcDELogicParamId:i,srcFieldName:s,srcValue:n,expression:o}=e,r=e.srcValueType||"SRCDLPARAM";let c,d=s;switch(r){case"SRCDLPARAM":c=t.params[i],t.isEntityParam(i)&&(d=null==d?void 0:d.toLowerCase());break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=it(ibiz.env);break;case"EXPRESSION":if(!o)throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.expressionEmpty"));c=ei.execScriptFn(t,o,{singleRowReturn:!0,isAsync:!1});break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:r}))}if(c&&d)try{c=Array.isArray(c)?c[Number(d)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(d),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:d}),c),t}return c}var Ps=class extends Is{async exec(t){const e=this.model.delogicNodeParams;(null==e?void 0:e.length)&&await Promise.all(e.map((e=>{let i,s;switch(e.dstDELogicParamId&&"DEBUG"===ibiz.env.logLevel&&(s=it(t.params[e.dstDELogicParamId])),e.paramAction){case"SETPARAMVALUE":i=this.setParamValue(e,t);break;case"RESETPARAM":i=this.resetParam(e,t);break;case"COPYPARAM":i=this.copyParam(e,t);break;case"BINDPARAM":i=this.bindParam(e,t);break;case"RENEWPARAM":i=this.renewParam(e,t);break;case"APPENDPARAM":i=this.appendParam(e,t);break;case"SORTPARAM":i=this.sortParam(e,t);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:e.paramAction}))}return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.preparationParameter",{id:this.model.id,paramAction:e.paramAction,dstDELogicParamId:e.dstDELogicParamId}),s,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[e.dstDELogicParamId]),i})))}copyParam(t,e){const{dstDELogicParamId:i}=t,a=As(e,t);e.params[i]=it(a)}bindParam(t,e){const i=As(e,t);e.params[t.dstDELogicParamId]=i}setParamValue(t,e){const{dstFieldName:i,dstDELogicParamId:a}=t;let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=As(e,t);s?e.params[a][s]=n:e.params[a]=n}resetParam(t,e){const{dstDELogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDELogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDELogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=As(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDELogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a.toLowerCase();e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},Ts=class extends Is{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:i,dstDELogicParamId:a,retDELogicParamId:s}=this.model,n=t.params[a],o=ibiz.hub.getApp(t.context.srfappid),r=await o.deService.exec(i,e,t.context,n);r.ok&&(t.params[s]=r.data),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.dataSet",{id:this.model.id,dstAppDataEntityId:i,dstAppDEDataSetId:e,retDELogicParamId:s}),t.params[s])}},Ns=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=As(t,this.model);t.params[e]=s,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),s)}},xs=class extends Is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.resetParameter",{id:this.model.id,dstDELogicParamId:e}))}},Ss=class extends Is{async exec(t){const{dstDELogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.rebuildParameter",{id:this.model.id,dstDELogicParamId:e}))}},Ls=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const s=As(t,this.model);t.params[e]=it(s),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.copyParameter",{id:this.model.id,dstDELogicParamId:e}),s)}},Ms=class extends Is{async exec(t){const{dstDELogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s.toLowerCase(),o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.sortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDELogicParamId:e}),o)}},Rs=class extends Is{async exec(t){const{dstDELogicParamId:e,srcDELogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingTargetParameter"));const r=As(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.additionalParameter",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},Os=class extends Is{async exec(t){const{errorCode:e,errorInfo:i}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.throwsException",{id:this.model.id,errorCode:e,errorInfo:i})),new s({response:{status:e,statusText:i}})}},_s=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model;if(i.default)i.entityListParam?t.params[e]=t.data||[]:t.params[e]=t.data[0]||{};else if(i.appGlobalParam)t.params[e]=it(ibiz.env);else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]={};else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.appContextParam)t.params[e]=t.parameters.context;else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.cloneParam)t.params[e]=it(t.data||{});else{if(i.envParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.environmentVariables"));if(i.fileListParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectListVariable"));if(i.fileParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.fileObjectVariables"));if(i.filterParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.filterObjectVariables"));if(i.lastParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.finalDataVariables"));if(i.originEntity)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.rawDataObjects"));if(i.sessionParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.operationSessionVariables"))}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.calculateEntity",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.reEstablish",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},Fs=class{constructor(t){var e,s;if(this.model=t,this.nodes=new Map,this.params=new Map,t.customCode){if(!t.scriptCode)throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noScriptCode"));this.scriptFn=ei.createScriptFn([],t.scriptCode,{isAsync:!0})}else{if(!(null==(e=t.delogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.noConfigurationLogicNode"));t.delogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new Ds(t);break;case"END":i=new Cs(t);break;case"DEACTION":i=new bs(t);break;case"PREPAREPARAM":i=new Ps(t);break;case"DEDATASET":i=new Ts(t);break;case"THROWEXCEPTION":i=new Os(t);break;case"BINDPARAM":i=new Ns(t);break;case"RESETPARAM":i=new xs(t);break;case"COPYPARAM":i=new Ls(t);break;case"RENEWPARAM":i=new Ss(t);break;case"APPENDPARAM":i=new Rs(t);break;case"SORTPARAM":i=new Ms(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),null==(s=t.delogicParams)||s.forEach((t=>{this.params.set(t.id,new _s(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.thenId)&&(e.dstNode=this.nodes.get(e.model.thenId))}))}))}}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t,e,a){if(this.scriptFn)return this.scriptFn.exec({context:t,data:e,params:a});const s=new fs(this.params,t,e,a);this.initLogicParams(s);const{startDELogicNodeId:n}=this.model;if(!n||!this.nodes.has(n))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(n);await this.deepExec(t,s)}return s.isEndNode?s.result:s.params[s.defaultParamName]?s.params[s.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},zs=new Map;async function Vs(t,e,i={},a={}){zs.has(t)||zs.set(t,new Fs(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const s=zs.get(t),n=await s.exec(e,i,a);return ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.endExecution",{id:t.id,name:t.name})),n}async function ks(t,e,i,a,s){const n=await async function(t,e,i){return Te(t,await ibiz.hub.getAppDataEntity(e,i))}(t,e,i.srfappid);if(!n)throw new o(ibiz.i18n.t("runtime.deLogic.deLogicNode.noFoundEntityLogic",{dataEntityId:e,deDELogicId:t}));return Vs(n,i,a,s)}async function Us(t,e,i,a){const n=it(e),o=i?it(i):i,r=a?it(a):a;try{const e=await Vs(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function Bs(t,e,i,a,s){const n=Ne(t,e);if(n.length){(await Promise.all(n.map((t=>Vs(t,i,a,s))))).forEach((t=>{Object.assign(a,t)}))}}async function Ws(t,e,i,a,s={}){if(a){if(!z(a))return Bs(t,e,i,a,s);await Promise.all(a.map((a=>Bs(t,e,i,a,s))))}}var Gs=t("DEActionMethod",class extends gs{async inputHandle(t,e){return z(e)?e:this.input.handle(t,e)}async inputFormat(t,e){const i=async e=>this.input.format(t,e);if(Array.isArray(e)){const t=[];for(let a=0;a<e.length;a++)t.push(await i(e[a]));return t}return i(e)}async exec(t,e,a,s){let n;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await Ws(this.entity,"change",t,e,a),"DELOGIC"===this.method.actionType){const s=Te(this.method.appDELogicId,this.entity);if(!s)throw new i(this.method,ibiz.i18n.t("runtime.service.lackEntityLogic"));n=await Us(s,t,e,a)}else{e&&(e=this.isLocalMode?await this.inputFormat(t,e):await this.inputHandle(t,e));switch(this.method.actionTag?this.method.actionTag.toUpperCase():this.method.codeName.toUpperCase()){case"CREATE":n=await this.create(t,e,a||{},s);break;case"GET":n=await this.get(t,a,s);break;case"GETDRAFT":n=await this.getDraft(t,a,s);break;case"REMOVE":n=await this.remove(t,a);break;case"UPDATE":n=await this.update(t,e,a,s);break;case"CREATETEMP":n=await this.createTemp(t,e);break;case"GETTEMP":n=await this.getTemp(t,e);break;case"GETDRAFTTEMP":n=await this.getDraftTemp(t,a);break;case"REMOVETEMP":n=await this.removeTemp(t,e);break;case"UPDATETEMP":n=await this.updateTemp(t,e);break;default:{let i=this.calcPath(t);if(this.method.needResourceKey){let a=t[this.entity.codeName.toLowerCase()];_(a)&&(a=z(e)?null:null==e?void 0:e[this.entity.keyAppDEFieldId]),i="".concat(i,"/").concat(a)}const o=await this.request(i,t,e,a,s);a&&a.srfupdateitem||(o.data=await this.result.handle(t,o.data)),n=o}}}return n.data&&await Ws(this.entity,"compute",t,n.data,a),n}async create(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.createBehavior"));if(this.isLocalMode)return this.createTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.post(s,e,i,a);return n.data=await this.result.handle(t,n.data),n}async remove(t,e,i){if(this.isLocalMode)return this.removeTemp(t,e);const a=this.calcPath(t);return await this.app.net.delete("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i)}async update(t,e,i,a){if(!e)throw new o(ibiz.i18n.t("runtime.service.updateBehavior"));if(this.isLocalMode)return this.updateTemp(t,this.createEntity(e));const s=this.calcPath(t),n=await this.app.net.put("".concat(s,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i,a);return n.data=await this.result.handle(t,n.data),n}async get(t,e={},i={}){if(this.isLocalMode)return this.getTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get("".concat(a,"/").concat(t[this.entity.codeName.toLowerCase()]),e,i);return s.data=await this.result.handle(t,s.data),s}async getDraft(t,e,i){if(this.isLocalMode)return this.getDraftTemp(t,e);const a=this.calcPath(t),s=await this.app.net.get(this.mergeRequestPath(a,this.method.requestPath),e,i);return s.data=await this.result.handle(t,s.data),s}async createTemp(t,e){try{const i=this.createEntity(e);let a;a=z(i)?await Promise.all(i.map((e=>this.service.local.add(t,this.attach(t,e))))):await this.service.local.add(t,this.attach(t,i));const s=ibiz.uiDomainManager.get(t.srfsessionid);return s&&s.dataChange(),new p(a)}catch(t){throw new s(t)}}async getDraftTemp(t,e){try{const t=this.createEntity({});return t?new p(t):new p(t,500)}catch(t){return new p(t,500)}}async removeTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);try{await this.associationDeletion(i,t,e)}catch(t){throw new s({response:new p(null,500,t.message)})}const a=this.service.local.delete(t,i);if(a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async associationDeletion(t,e,a){const s=ibiz.uiDomainManager.get(e.srfsessionid),n=s.transaction;let o=!1;!1===n.state.isOpen&&(n.open(),o=!0);try{let a=s.getDERConfigByMajor(this.entity.id);if(a.length>0){const s=this.service.local.get(e,t);a=yt(a,"removeOrder");for(const n of a){if("DER1N"!==n.rstype)throw new i(n,ibiz.i18n.t("runtime.service.deletionDeletion"));const{removeActionType:a,removeRejectMsg:o,minorAppDataEntityId:r,nestedAppDEDataSetId:c="FetchDefault"}=n,d=ibiz.hub.getApp(this.entity.appId),l=await d.deService.getService(e,r),h=it(e);h[this.entity.codeName.toLowerCase()]=t;const u=(await l.exec(c,h)).data||[];switch(a){case 1:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey;const i=await l.remove(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 2:for(let t=0;t<u.length;t++){const e=u[t];h[l.model.codeName.toLowerCase()]=e.srfkey,e[n.parentAppDEFieldId.toLowerCase()]=void 0;const i=await l.updateTemp(h,e);if(!1===i.ok)throw new Error(i.statusText)}break;case 3:if(u.length>0){const t=u.map((t=>t.srfmajortext)).join("、"),e=ibiz.i18n.t("runtime.service.unableDelete",{logicName:this.entity.logicName,srfmajortext:s.srfmajortext,modelLogicName:l.model.logicName,msg:t});throw new Error(o||e)}}}}o&&n.state.isOpen&&n.commit()}catch(t){throw o&&n.state.isOpen&&n.rollback(),t}finally{o&&n.state.isOpen&&n.close()}}async updateTemp(t,e){try{const i=this.createEntity(e);let a;if(a=z(i)?await Promise.all(i.map((e=>this.service.local.update(t,this.attach(t,e))))):await this.service.local.update(t,this.attach(t,i)),a){const e=ibiz.uiDomainManager.get(t.srfsessionid);return e&&e.dataChange(),new p(a)}return new p(a,500)}catch(t){throw new s(t)}}async getTemp(t,e){try{let i=null;e&&(i=e[this.entity.keyAppDEFieldId.toLowerCase()]),!i&&t&&(i=t[this.entity.codeName.toLowerCase()]);const a=this.service.local.get(t,i);return a?new p(a):new p(a,500)}catch(t){throw new s(t)}}async removeBatchTemp(t,e){return new p(!0)}attach(t,e){const i=t.srfsessionid,a=ibiz.uiDomainManager.get(i).getDERConfig(this.entity.id);return a.length>0&&a.forEach((i=>{if(i.parentAppDEFieldId){const{majorAppDataEntityId:a,parentAppDEFieldId:s}=i,n=Ae(a),o=s.toLowerCase(),r=t[n];r&&r!==e.srfkey&&(e[o]=r)}})),e}}),js=class{create(t,e,i,a){return new Gs(t,e,i,a.localMode)}},Ks=t("FetchMethod",class extends gs{async exec(t,e,i,s){const n=e&&!z(e)?e:i||{};let o;if(this.isLocalMode){const e=za.getCond(this.method),i=new Ka(t,n),a=await this.searchLocal(e,i);o=new p(a,200)}else{switch(this.method.dataSetType){case"INDEXDE":case"CODELIST":case"MULTIFORM":o=await this.fetchCodeListSet(t,n);break;case"REMOTE":{const a=this.calcPath(t);o=await this.request(a,t,e,i,s)}break;default:throw new a(this.method,ibiz.i18n.t("runtime.service.noSupportedDataSource",{dataSetType:this.method.dataSetType}))}const r=o.data||[];for(let e=0;e<r.length;e++)r[e]=await this.result.format(t,r[e]);o.data=r.map((t=>this.createEntity(t)))}return o.data&&await Ws(this.entity,"compute",t,o.data,n),o}async searchLocal(t,e,i=this.entity.quickSearchAppDEFieldIds){let a=this.service.local.getList();t?a.length>0&&(a=a.filter((i=>t.test(i,e)))):a.length>0&&e.query&&""!==e.query&&i&&(a=a.filter((t=>{const a=new RegExp(e.query);for(let e=0;e<i.length;e+=1){const s=t[i[e]];if(a.test(s))return!0}return!1}))),Z(e.sortField)||et(e.sortField)||(a="DESC"===e.sortMode?wt(a,e.sortField):yt(a,e.sortField));const{page:s,size:n}=e,o=s*n,r=(s+1)*n-1;return a.slice(o,r).map((t=>it(t)))}async fetchCodeListSet(t,e){const{appCodeListId:a}=this.method;if(!a)throw new i(this.method,ibiz.i18n.t("runtime.service.sourceCodeTable"));const s=await this.app.codeList.get(a,t,e),{keyAppDEFieldId:n,majorAppDEFieldId:o}=this.entity,r=s.map((t=>({[n]:t.value,[o]:t.text})));return new p(r,200)}}),Hs=t("AcFetchMethod",class extends Ks{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),Xs=class{create(t,e,i,a){return a.acMode?new Hs(t,e,i,a.localMode):new Ks(t,e,i,a.localMode)}};function qs(){const t=new js;Ea("DEACTION",(()=>t));const e=new Xs;Ea("FETCH",(()=>e)),Ea("FETCHTEMP",(()=>e))}var Ys=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"timestamp,desc"};Object.assign(e,t);const i=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),e);return i.headers&&(i.headers["x-page"]&&(i.page=Number(i.headers["x-page"])),i.headers["x-per-page"]&&(i.size=Number(i.headers["x-per-page"])),i.headers["x-total"]&&(i.total=Number(i.headers["x-total"]))),Z(i.data)&&(i.data=[]),i}async get(t){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t))}async markRead(t){await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/mark_read"),{})}async batchMarkRead(){await ibiz.net.post("".concat(this.baseUrl,"/mark_all_read"),{})}async getUnreadNum(){const t=await ibiz.net.post("".concat(this.baseUrl,"/fetch_cur_receiver"),{page:0,size:1,sort:"timestamp,desc",searchconds:[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]});return t.headers["x-total"]?Number(t.headers["x-total"]):0}}),Qs=t("MarkOpenDataService",class{constructor(){this.callbackMap=new Map,this.baseUrl="/portal/markopendata",ibiz.mc.command.markOpenData.on((t=>{const e=t.data,{entity:i,key:a}=e,s="".concat(i,"_").concat(a);this.callbackMap.has(s)&&this.callbackMap.get(s).forEach((t=>t(e)))}))}async action(t,e,i){return await ibiz.net.get("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i))}async send(t,e,i,a){return await ibiz.net.post("".concat(this.baseUrl,"/").concat(t,"/").concat(e,"/").concat(i),a)}subscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[];s.push(i),this.callbackMap.set(a,s)}unsubscribe(t,e,i){const a="".concat(t,"_").concat(e),s=this.callbackMap.get(a)||[],n=s.indexOf(i);n>-1&&(s.splice(n,1),this.callbackMap.set(a,s))}}),$s=t("UtilService",class{constructor(t){this.appUtil=t,this.stoageAppDataEntity=null,this.appDEService=null}async getAppDEService(t){if(this.appDEService)return this.appDEService;const{appId:e,name:i,stoageAppDataEntityId:a}=this.appUtil;if(e&&a){const s=ibiz.hub.getApp(e);this.stoageAppDataEntity=await ibiz.hub.getAppDataEntity(a,e);const n=await s.deService.getService(t,a);if(n)return this.appDEService=n,n;throw new Error(ibiz.i18n.t("runtime.service.noFoundStorageEntity",{name:i,stoageAppDataEntityId:a}))}throw new Error(ibiz.i18n.t("runtime.service.noExist",{name:i}))}async load(t,e,i){const a=e.clone(),s=await this.getAppDEService(a);a[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{getAppDEActionId:n}=this.appUtil;try{const t=await s.exec(n||"get",a,i);return this.handleResponse(t)}catch(t){return{}}}async save(t,e,i,a){const s=await this.getAppDEService(e),{context:n,params:o,data:r}=this.handleRequestData(t,e,i,a);return s.exec("save",n,r,o)}handleRequestData(t,e,i,a){const{modelIdAppDEFieldId:s,modelAppDEFieldId:n,appIdAppDEFieldId:o,userIdAppDEFieldId:r,stoageAppDataEntityId:c}=this.appUtil;if(!this.stoageAppDataEntity)throw new Error(ibiz.i18n.t("runtime.service.noFoundEntity",{stoageAppDataEntityId:c}));const d=e.clone(),l={};d[this.stoageAppDataEntity.codeName.toLowerCase()]=t;const{keyAppDEFieldId:h}=this.stoageAppDataEntity;return l[h]=t,l[s]=null==i?void 0:i.modelId,l[n]=JSON.stringify(a),l[o]=d.srfappid,l[r]=d.srfpersonid,l.type=null==i?void 0:i.type,l.owner_type=null==i?void 0:i.ownerType,l.owner_id=null==i?void 0:i.ownerId,{context:d,params:i,data:l}}handleResponse(t){const{data:e}=t,{modelAppDEFieldId:i}=this.appUtil;return JSON.parse(e[i])}}),Js=t("TreeNodeData",class{constructor(t,e,i){this._uuid=ut(),this._leaf=!1,this._defaultExpand=!1,this._leaf=!0===i.leaf,this._defaultExpand=!0===i.defaultExpand,this._parent=e,this._nodeType=t.treeNodeType,this._disableSelect=!0===t.disableSelect,this._changedOnly=!0===t.enableRowEditChangedOnly,this._parent&&(this._context={...this._parent._context}),i.navContext&&(this._context=Object.assign(this._context||{},i.navContext)),i.navParams&&(this._params={...i.navParams}),this._nodeId=t.id,Object.defineProperty(this,"srfnodeid",{get(){return this._id},enumerable:!0,configurable:!0})}calcIcon(t){const{sysImage:e}=t,i={};return e&&(e.cssClass&&(i.cssClass=e.cssClass),e.imagePath&&(i.imagePath=e.imagePath),e.rawContent&&(m(e.rawContent)?i.imagePath=e.rawContent:i.htmlStr=e.rawContent)),Object.values(i).length>0?i:void 0}getDiffData(){if(this._deData&&this._oldDeData){const t={};return Object.keys(this._deData).forEach((e=>{this._deData[e]===this._oldDeData[e]&&e!==this._deData.srfkeyfield||(t[e]=this._deData[e])})),t.srfkey=this._deData.srfkey,t}return this._deData}}),Zs=t("TreeCodeListNodeData",class extends Js{constructor(t,e,i){super(t,e,i);const{data:a}=i;this._text=a.text,this._value=a.value;const s="".concat(t.id,"@").concat(this._value).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(s):s},enumerable:!0,configurable:!0}),t.appDataEntityId){const e=Ae(t.appDataEntityId);this._context=Object.assign(this._context||{},{[e]:this._value})}this.srfkey=this._value,this.srfmajortext=this._text,this._icon=this.calcIcon(t)}}),tn=["_id","srfnodeid","_value","_text","_deData","clone"],en=t("TreeDataSetNodeData",class t extends Js{constructor(e,i,a){var s,n;super(e,i,a);const{data:o}=a;this._deData=o,this._oldDeData=o.clone();const r="".concat(e.id,"@").concat(o.srfkey).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(r):r},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_text",{get(){return e.textAppDEFieldId?this._deData[e.textAppDEFieldId]:this._deData.srfmajortext},set(t){e.textAppDEFieldId?this._deData[e.textAppDEFieldId]=t:this._deData.srfmajortext=t},enumerable:!0,configurable:!0}),Object.defineProperty(this,"_value",{get(){return e.idAppDEFieldId?this._deData[e.idAppDEFieldId]:this._deData.srfkey},set(t){e.idAppDEFieldId?this._deData[e.idAppDEFieldId]=t:this._deData.srfkey=t},enumerable:!0,configurable:!0}),e.appDataEntityId){const t=Ae(e.appDataEntityId);this._context=Object.assign(this._context||{},{[t]:o.srfkey})}this._icon=this.calcIcon(e),this._textHtml=this.calcTextHtml(e),e.leafFlagAppDEFieldId?this._leaf=Ha(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!Ha(o[e.childCntAppDEFieldId]));const c=new Map,d=new Map;null==(s=e.detreeNodeDataItems)||s.forEach((t=>{if(!t.appDEFieldId)return;const e=t.id.toLowerCase(),i=t.appDEFieldId.toLowerCase();c.set(e,i),t.defaultValue&&d.set(e,t.defaultValue)}));const l=new Map;null==(n=e.detreeNodeColumns)||n.forEach((t=>{if("DEFGRIDCOLUMN"!==t.columnType)return;const e=t.detreeColumnId,i=t.dataItemName;e&&i?l.set(e,i):ibiz.log.error(ibiz.i18n.t("runtime.service.missingDetreeColumnId"),t)}));const h=new Map;h.set("srfuf","srfuf");const u=t=>l.has(t)?c.get(l.get(t)):c.has(t)?c.get(t):Object.prototype.hasOwnProperty.call(this._deData,t)?t:h.has(t)?h.get(t):void 0;return this.clone=()=>{const i=it(this._deData),a=new t(e,this._parent,{data:i,leaf:this._leaf,navContext:this._context,navParams:this._params,defaultExpand:this._defaultExpand});return Object.keys(this).forEach((t=>{const e=u(t);Z(e)&&!tn.includes(t)&&(a[t]=this[t])})),a},new Proxy(this,{set(t,e,i){const a=u(e);return Z(a)?t[e]=i:t._deData[a]=i,!0},get(t,e,i){const a=u(e);return Z(a)?t[e]:Z(t._deData[a])?(s=e,l.has(s)?d.get(l.get(s)):d.has(s)?d.get(s):void 0):t._deData[a];var s},ownKeys(t){const e=[...new Set([...Object.keys(t),...c.keys(),...Object.keys(t._deData)])];return g(t,e),e}})}calcIcon(t){const e=super.calcIcon(t)||{},{iconAppDEFieldId:i,detreeNodeDataItems:a}=t;if(i&&this._deData[i]){const t=this._deData[i];-1!==t.indexOf("fa-")?e.cssClass=t:e.imagePath=t}e&&(this._icon=e);const s=null==a?void 0:a.find((t=>"icon"===t.id));return s&&(e.htmlStr=this.calcDataItemScript(s)),Object.values(e).length>0?e:void 0}calcDataItemScript(t){if(t.customCode&&t.scriptCode)return ei.execScriptFn({data:this._deData},t.scriptCode,{isAsync:!1})}calcTextHtml(t){let e;const{detreeNodeDataItems:i}=t,a=null==i?void 0:i.find((t=>"text"===t.id));return a&&(e=this.calcDataItemScript(a)),e}}),an=t("TreeStaticNodeData",class extends Js{constructor(t,e,i){var a,s;super(t,e,i);const n="root"===t.nodeValue?void 0:t.nodeValue,o="".concat(t.id).toLowerCase();if(Object.defineProperty(this,"_id",{get(){return this._parent?"".concat(this._parent._id,":").concat(o):o},enumerable:!0,configurable:!0}),this._text=t.text,this._value=n,e&&i.parentValueLevel){let t=e;for(let e=1;e<i.parentValueLevel;e++)t=null==t?void 0:t._parent;(null==t?void 0:t._deData)&&(this._deData=t._deData),this._value=n||(null==t?void 0:t._value)}this.srfkey=(null==(a=this._deData)?void 0:a.srfkey)||this._value,this.srfmajortext=(null==(s=this._deData)?void 0:s.srfmajortext)||this._text,this._icon=this.calcIcon(t)}}),sn=t("UIMapField",class{constructor(t,e,i={}){this.isOriginField=!1,this.isRequestNeed=!0,this.uiKey=t,this.dataKey=e,Z(i.isOriginField)||(this.isOriginField=i.isOriginField),Z(i.dataType)||(this.dataType=i.dataType)}convertVal(t){if(!this.dataType)return t;if(l.isNumber(this.dataType)){const e=Z(t)||""===t?t:Number(t);return Number.isNaN(e)?(ibiz.log.debug(ibiz.i18n.t("runtime.service.convertedNumber",{value:t})),t):e}return t}}),nn=t("CalendarItemData",class{constructor(t,e){this.model=t,this.data=e}get deData(){return this.data}get navId(){return"".concat(this.itemType,"@").concat(this.id)}get itemType(){return this.model.itemType}get bkColor(){const t=this.model.bkcolorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.bkcolor}get beginTime(){const t=this.model.beginTimeAppDEFieldId;return t?this.data[t]:void 0}get color(){const t=this.model.colorAppDEFieldId;return t&&this.data[t]?this.data[t]:this.model.color}get content(){const t=this.model.contentAppDEFieldId;return t?this.data[t]:void 0}get endTime(){const t=this.model.endTimeAppDEFieldId;return t?this.data[t]:void 0}get icon(){const t=this.model.iconAppDEFieldId;return t?this.data[t]:void 0}get id(){const t=this.model.idAppDEFieldId;return t&&this.data[t]?this.data[t]:this.data.srfkey}get level(){const t=this.model.levelAppDEFieldId;return t?this.data[t]:void 0}get tag2(){const t=this.model.tag2AppDEFieldId;return t?this.data[t]:void 0}get tag(){const t=this.model.tagAppDEFieldId;return t?this.data[t]:void 0}get text(){const t=this.model.textAppDEFieldId;return t?this.data[t]:void 0}get tips(){const t=this.model.tipsAppDEFieldId;return t?this.data[t]:void 0}});var on=["REGION","REGION2","REGION3","REGION4"],rn=t("MapData",class{constructor(t,e){this._longitude=void 0,this._latitude=void 0,this._areaCode=void 0,this._tooltip=void 0,this._value=void 0,this._text=void 0,this._symbol=void 0;const{id:i,itemStyle:a,longitudeAppDEFieldId:s,latitudeAppDEFieldId:n,textAppDEFieldId:o,dataAppDEFieldId:r,tipsAppDEFieldId:c,sysImage:d}=e,l=new Map;return this._id=i+t.srfkey,this._itemStyle=a,this._mapItemId=i,on.includes(this._itemStyle)?s&&l.set("_areaCode",s):(s&&l.set("_longitude",s),n&&l.set("_latitude",n)),c&&l.set("_tooltip",c),o&&l.set("_text",o),r&&l.set("_value",r),d&&(this._symbol=d.rawContent||d.imagePath),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:l.has(i)?t[l.get(i)]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:l.has(i)?t[l.get(i)]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,i),i}})}});var cn=t("PanelData",class{constructor(t,e){const i=new ht,a={},s={};return t.forEach((t=>{var e;a[t.id]=null==(e=t.viewFieldName)?void 0:e.toLowerCase(),t.viewFieldName&&(s[t.viewFieldName.toLowerCase()]=t.id)})),new Proxy(this,{set:(t,n,o)=>(Object.prototype.hasOwnProperty.call(a,n)?a[n]?e[a[n]]=o:t[n]=o:e[n]=o,i.emit("change",n),a[n]&&a[n]!==n&&i.emit("change",a[n]),s[n]&&s[n]!==n&&i.emit("change",s[n]),!0),get:(t,s,n)=>"_evt"===s?i:a[s]?e[a[s]]:Object.prototype.hasOwnProperty.call(e,s)?e[s]:t[s],ownKeys(t){const i=Object.keys(e);return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(t,i),i}})}destroy(){this._evt.reset()}});var dn=t("ChartData",class{constructor(t,e,i,a){return this._seriesModelId=null==e?void 0:e.id,this._catalog=i,this._groupName=a,this._uuid=ut(),new Proxy(this,{set:(e,i,a)=>(Object.prototype.hasOwnProperty.call(t,i)?t[i]=a:e[i]=a,!0),get:(e,i,a)=>void 0!==e[i]?e[i]:void 0!==t[i]?t[i]:void 0,ownKeys(e){const i=[...new Set([...Object.keys(e),...Object.keys(t)])];return function(t,e){e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,writable:!0,value:void 0})}))}(e,i),i}})}}),ln=(t,e,i={})=>{let a="";if(!t||!e.detreeNodeDataItems)return a;const s=e.detreeNodeDataItems.find((e=>e.detreeColumnId===t));return s&&s.appDEFieldId&&(a=i[s.appDEFieldId.toLowerCase()]),a},hn=t("GanttStaticNodeData",class extends an{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=ln(t.sndataItemName,e),this._beginDataItemValue=ln(t.beginDataItemName,e),this._endDataItemValue=ln(t.endDataItemName,e),this._prevDataItemValue=ln(t.prevDataItemName,e),this._finishDataItemValue=ln(t.finishDataItemName,e),this._totalDataItemValue=ln(t.totalDataItemName,e)}}),un=t("GanttDataSetNodeData",class extends en{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=ln(t.sndataItemName,e,s),this._beginDataItemValue=ln(t.beginDataItemName,e,s),this._endDataItemValue=ln(t.endDataItemName,e,s),this._prevDataItemValue=ln(t.prevDataItemName,e,s),this._finishDataItemValue=ln(t.finishDataItemName,e,s),this._totalDataItemValue=ln(t.totalDataItemName,e,s)}}),pn=t("GanttCodeListNodeData",class extends Zs{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=ln(t.sndataItemName,e,s),this._beginDataItemValue=ln(t.beginDataItemName,e,s),this._endDataItemValue=ln(t.endDataItemName,e,s),this._prevDataItemValue=ln(t.prevDataItemName,e,s),this._finishDataItemValue=ln(t.finishDataItemName,e,s),this._totalDataItemValue=ln(t.totalDataItemName,e,s)}}),mn=t("MqttService",class{constructor(t,e,i){this.mqttTopic=t,this.token=e,this.appId=i,this.evt=new ht,this.options={connectTimeout:6e3,clientId:ut(),username:"",password:"",keepalive:60,clean:!0},this.options.username=t,this.options.password=e}async connect(){const t=await e.import("mqtt/dist/mqtt.min"),i=t.default?t.default:t,{location:a}=window;this.client=i.connect("ws://".concat(a.host).concat(ibiz.env.baseUrl,"/").concat(this.appId).concat(ibiz.env.mqttUrl),this.options),this.client.on("connect",(()=>{this.client.subscribe(this.mqttTopic),ibiz.log.debug("mqtt connect")})),this.client.on("error",(t=>{ibiz.log.error("mqtt error",t)})),this.client.on("message",((t,e)=>{this.evt.emit("message",JSON.parse(e.toString())),ibiz.log.debug("mqtt message",t,e.toString())})),this.client.on("reconnect",(()=>{ibiz.log.warn("mqtt reconnect")})),this.client.on("close",(()=>{ibiz.log.warn("mqtt close")}))}close(){var t;null==(t=this.client)||t.end(),this.evt.reset()}}),gn=class t{constructor(t){this.appModel=t,this.cache=new Map}static register(t,e){this.constructorCache.set(t.toUpperCase(),e)}async getService(e,i){const a=e.srfsessionid||"applocation";this.cache.has(a)||this.cache.set(a,new Map);const s=this.cache.get(a);if(!s.has(i)){const e=await ibiz.hub.getAppDataEntity(i,this.appModel.appId);if(!e)throw new o(ibiz.i18n.t("runtime.service.noFound",{id:i}));const n=t.constructorCache.get(i.toUpperCase());let r;r=n?await n(a,e):new ss(a,e),s.set(i,r)}return s.get(i)}reset(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.destroy()})),this.cache.delete(e)}clearTempCache(t){const e=t.srfsessionid;if(!this.cache.has(e))return;this.cache.get(e).forEach((t=>{t.local.clear()}))}clearTempCacheByRs(t,e,i=[]){if(!0===i.includes(e))return;i.push(e);const a=t.srfsessionid;if(!this.cache.has(a))return;const s=this.cache.get(a).get(e);s&&s.local.clear();const n=ibiz.uiDomainManager.get(t.srfsessionid);if(n){n.getDERConfigByMajor(e).forEach((e=>{this.clearTempCacheByRs(t,e.minorAppDataEntityId,i)}))}}async exec(t,e,i,a,n,o){const r=await this.getService(i,t);try{return await r.exec(e,i,a,n,o)}catch(t){throw t instanceof s&&(t.tag=i.srfviewid),t}}};gn.constructorCache=new Map;var fn=t("DEServiceUtil",gn),yn=class{constructor(t){this.themeUtil=t,this.state={},this.state.themeTag=ibiz.util.theme.getTheme(),this.state.themeVars={};const{appData:e}=ibiz;if(!e)return;const i=ibiz.hub.getApp();this.config=new $a(i.appId,"customtheme","theme_config_".concat(e.context.srfuserid))}transCustomVars(t){let e="";for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const a=t[i];e+=".".concat(i,"{").concat(a,"}")}return e}setCustomThemeParams(t,e){const i=document.getElementById(t);i&&i.remove();const a={};let s=":root.".concat(t,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))if(2===t.split(":").length){const i=t.split(":")[0],s=t.split(":")[1],n=e[t];a[i]||(a[i]=""),a[i]+="".concat(s,": ").concat(n).concat(n.endsWith(";")?"":";")}else{const i=e[t];s+="".concat(t,": ").concat(i).concat(i.endsWith(";")?"":";")}s+="}",s+=this.transCustomVars(a);const n=document.createElement("style");n.id=t,n.type="text/css",n.innerHTML=s,document.head.appendChild(n)}clearCustomThemeParams(){this.state.themeVars={};const t=document.getElementById(this.state.themeTag);t&&t.remove()}async loadCustomTheme(){const t=await this.config.load();return t.themeTag&&(this.state.themeTag=t.themeTag,ibiz.util.theme.setTheme(this.state.themeTag)),ct(t.themeVars)&&(this.state.themeVars=t.themeVars,this.setCustomThemeParams(this.state.themeTag,t.themeVars)),t}previewCustomTheme(t,e){return t&&(this.state.themeTag=t,ibiz.util.theme.setTheme(this.state.themeTag)),ct(e)&&(this.state.themeVars=e,this.setCustomThemeParams(this.state.themeTag,e)),this.state}async saveCustomTheme(t,e){const i={themeTag:t,themeVars:e},a=await this.config.save(i);return a&&ibiz.message.success("保存自定义主题成功!"),a}async shareCustomTheme(t,e){const{appData:i}=ibiz;if(!i)return;const a={themeTag:t,themeVars:e},s=ibiz.hub.getApp(),n=Date.now(),o=new $a(s.appId,"customtheme","theme_share_".concat(i.context.srfuserid,"_").concat(n));if(await o.save(a)){const{origin:t,pathname:e}=window.location,a="shareThemeId=".concat(window.btoa(n.toString())),s="shareUserName=".concat(encodeURIComponent(i.context.srfusername)),o="shareUserId=".concat(encodeURIComponent(i.context.srfuserid)),r="/share?".concat(a,"&").concat(s,"&").concat(o);return"".concat(t).concat(e,"#").concat(r)}ibiz.message.error("分享自定义主题失败!")}async getShareTheme(t,e){const i=ibiz.hub.getApp();return new $a(i.appId,"customtheme","theme_share_".concat(t,"_").concat(e)).load()}},wn=t("ThemeUtil",class{constructor(){this.html=document.getElementsByTagName("html")[0],this.customUtil={}}async loadTheme(t){const e=it(t.themeParams||{}),i=e["theme-package-path"];delete e.appId,delete e["theme-package-path"],await ibiz.plugin.loadPlugin({runtimeObject:!0,rtobjectName:t.name,rtobjectRepo:i}),this.setThemeParams(t,e),this.setTheme(t.themeTag)}setThemeParams(t,e){if(document.getElementById(t.themeTag))return;let i=":root.".concat(t.themeTag,"{");for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const a=e[t];i+="".concat(t,": ").concat(a).concat(a.endsWith(";")?"":";")}i+="}";const a=document.createElement("style");a.id=t.themeTag,a.type="text/css",a.innerHTML=i,document.head.appendChild(a)}setTheme(t){const e=this.getTheme();this.html.classList.remove(e),this.html.setAttribute("theme",t),this.html.classList.add(t)}getTheme(){return this.html.getAttribute("theme")}customTheme(){ibiz.overlay.drawer("IBizCustomTheme",void 0,{width:30,placement:"right"})}async initCustomTheme(t=!0){this.customUtil=new yn(this),t&&await this.customUtil.loadCustomTheme()}getCustomTheme(){return this.customUtil.state}setCustomTheme(t){Object.assign(this.customUtil.state,t)}previewCustomTheme(t,e){return this.customUtil.previewCustomTheme(t,e)}resetCustomTheme(){return this.customUtil.clearCustomThemeParams()}async saveCustomTheme(t,e){return this.customUtil.saveCustomTheme(t,e)}async shareCustomTheme(t,e){return this.customUtil.shareCustomTheme(t,e)}async getShareTheme(t,e){return this.customUtil.getShareTheme(t,e)}}),En=class{constructor(){this.commitQueue=new Map,this.state={isOpen:!1,isChange:!1}}open(){this.state.isOpen?ibiz.log.warn(ibiz.i18n.t("runtime.utils.uiDomain.transactionOpen")):this.state.isOpen=!0}change(t,e){this.state.isChange=!0,this.commitQueue.set(t,e)}commit(){const t=Array.from(this.commitQueue.values()).reverse();for(const e of t)e();this.commitQueue.clear(),this.state.isChange=!1}rollback(){this.commitQueue.clear(),this.state.isChange=!1}close(){if(this.state.isChange)throw new Error(ibiz.i18n.t("runtime.utils.uiDomain.currentTransaction"));this.state.isOpen=!1}},vn=t("UIDomain",class{constructor(t){this.state={rsInit:!1},this.rsMap=new Map,this.rs2Map=new Map,this.transaction=new En,this.dataModification=!1,this.id=t||ut()}dataChange(){this.dataModification=!0}dataChangeCompleted(){this.dataModification=!1}setDERConfig(t,e){this.rsMap.set(t,e)}getDERConfig(t){return this.rsMap.has(t)?this.rsMap.get(t):[]}getDERConfigByMajor(t){return this.rs2Map.has(t)?this.rs2Map.get(t):[]}calcParentRs(){this.rs2Map.clear(),this.rsMap.forEach(((t,e)=>{t.forEach((t=>{t.minorAppDataEntityId=e;const i=t.majorAppDataEntityId;this.rs2Map.has(i)||this.rs2Map.set(i,[]),this.rs2Map.get(i).push(t)}))}))}destroy(){this.rsMap.clear();ibiz.hub.getAllApps().forEach((t=>{t.deService.reset({srfappid:t.appId,srfsessionid:this.id})}))}}),In=t("UIDomainManager",class{constructor(){this.domainMap=new Map}create(t){const e=new vn(t);return this.domainMap.set(e.id,e),e}get(t){if(this.domainMap.has(t))return this.domainMap.get(t);throw new Error(ibiz.i18n.t("runtime.utils.uiDomainManager.invalidInterfaceDomain",{id:t}))}destroy(t){this.domainMap.has(t)&&(this.domainMap.get(t).destroy(),this.domainMap.delete(t))}}),bn=t("RawValueUtil",class{isNumber(t){return/^-?\d+(\.\d+)?$/.test(t)}format(t){let e=t;return void 0!==t&&("true"===t||"false"===t?e="true"===t:this.isNumber(t)&&(e=parseFloat(t))),e}}),Dn=t("ViewStack",class{constructor(){this.stackMap=new Map,this.stack=[],this.activeStack=[],this.evt=new ht}add(t,e){this.stack.push(e),this.stackMap.set(t,e),this.recalculateActiveStack(),this.evt.emit("add",e),this.evt.emit("change",{type:"add",view:e})}remove(t){const e=this.stackMap.get(t);e&&(this.stack.splice(this.stack.indexOf(e),1),this.stackMap.delete(t),this.recalculateActiveStack(),this.evt.emit("remove",e),this.evt.emit("change",{type:"remove",view:e}))}getActives(){return this.activeStack}active(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("active",e),this.evt.emit("change",{type:"active",view:e}))}deactivate(t){const e=this.stackMap.get(t);e&&(this.recalculateActiveStack(),this.evt.emit("deactivate",e),this.evt.emit("change",{type:"deactivate",view:e}))}getView(t){return this.stackMap.get(t)}recalculateActiveStack(){this.activeStack=this.stack.filter((t=>!0===t.isActive))}});async function Cn(t,e=!0){const i=await Promise.allSettled(t),a=[],s=[];if(i.forEach((t=>{"fulfilled"===t.status?a.push(t.value):s.push(t.reason)})),s.length>0){const t=1===s.length?s[0]:s;if(e)throw t;ibiz.util.error.handle(t)}return a}var An={position:"fixed",zIndex:"10000"};function Pn(t,e=document.body,i=!0){const a=Nn(t);if(null==a)throw new Error(ibiz.i18n.t("runtime.utils.anime.noClone"));const s=a.cloneNode(!0);if(i)for(;s.firstChild;)s.removeChild(s.firstChild);return function(t,{width:e,height:i,boundingLeft:a,boundingTop:s}){t.style.left="".concat(a,"px"),t.style.top="".concat(s,"px"),t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px"),Object.assign(t.style,An)}(s,Tn(a)),e.appendChild(s),s}function Tn(t){const e=t.offsetWidth,i=t.offsetHeight,a=window.getComputedStyle(t),s=parseFloat(a.padding),{left:n,top:o}=t.getBoundingClientRect();return{width:e,height:i,padding:s,boundingLeft:n,boundingTop:o}}function Nn(t){return"string"==typeof t?document.querySelector(t):t}var xn={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},Sn={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Ln=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Mn={CSS:{},springs:{}};function Rn(t,e,i){return Math.min(Math.max(t,e),i)}function On(t,e){return t.indexOf(e)>-1}function _n(t,e){return t.apply(null,e)}var Fn={arr:function(t){return Array.isArray(t)},obj:function(t){return On(Object.prototype.toString.call(t),"Object")},pth:function(t){return Fn.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Fn.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Fn.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Fn.hex(t)||Fn.rgb(t)||Fn.hsl(t)},key:function(t){return!xn.hasOwnProperty(t)&&!Sn.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function zn(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Vn(t,e){var i=zn(t),a=Rn(Fn.und(i[0])?1:i[0],.1,100),s=Rn(Fn.und(i[1])?100:i[1],.1,100),n=Rn(Fn.und(i[2])?10:i[2],.1,100),o=Rn(Fn.und(i[3])?0:i[3],.1,100),r=Math.sqrt(s/a),c=n/(2*Math.sqrt(s*a)),d=c<1?r*Math.sqrt(1-c*c):0,l=1,h=c<1?(c*r-o)/d:-o+r;function u(t){var i=e?e*t/1e3:t;return i=c<1?Math.exp(-i*c*r)*(l*Math.cos(d*i)+h*Math.sin(d*i)):(l+h*i)*Math.exp(-i*r),0===t||1===t?t:1-i}return e?u:function(){var e=Mn.springs[t];if(e)return e;for(var i=1/6,a=0,s=0;;)if(1===u(a+=i)){if(++s>=16)break}else s=0;var n=a*i*1e3;return Mn.springs[t]=n,n}}function kn(t){return void 0===t&&(t=10),function(e){return Math.ceil(Rn(e,1e-6,1)*t)*(1/t)}}var Un,Bn,Wn=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function i(t,e){return 3*e-6*t}function a(t){return 3*t}function s(t,s,n){return((e(s,n)*t+i(s,n))*t+a(s))*t}function n(t,s,n){return 3*e(s,n)*t*t+2*i(s,n)*t+a(s)}return function(e,i,a,o){if(0<=e&&e<=1&&0<=a&&a<=1){var r=new Float32Array(11);if(e!==i||a!==o)for(var c=0;c<11;++c)r[c]=s(c*t,e,a);return function(t){return e===i&&a===o||0===t||1===t?t:s(d(t),i,o)}}function d(i){for(var o=0,c=1;10!==c&&r[c]<=i;++c)o+=t;--c;var d=o+(i-r[c])/(r[c+1]-r[c])*t,l=n(d,e,a);return l>=.001?function(t,e,i,a){for(var o=0;o<4;++o){var r=n(e,i,a);if(0===r)return e;e-=(s(e,i,a)-t)/r}return e}(i,d,e,a):0===l?d:function(t,e,i,a,n){var o,r,c=0;do{(o=s(r=e+(i-e)/2,a,n)-t)>0?i=r:e=r}while(Math.abs(o)>1e-7&&++c<10);return r}(i,o,o+t,e,a)}}}(),Gn=(Un={linear:function(){return function(t){return t}}},Bn={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=Rn(t,1,10),a=Rn(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/a)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Bn[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Bn).forEach((function(t){var e=Bn[t];Un["easeIn"+t]=e,Un["easeOut"+t]=function(t,i){return function(a){return 1-e(t,i)(1-a)}},Un["easeInOut"+t]=function(t,i){return function(a){return a<.5?e(t,i)(2*a)/2:1-e(t,i)(-2*a+2)/2}},Un["easeOutIn"+t]=function(t,i){return function(a){return a<.5?(1-e(t,i)(1-2*a))/2:(e(t,i)(2*a-1)+1)/2}}})),Un);function jn(t,e){if(Fn.fnc(t))return t;var i=t.split("(")[0],a=Gn[i],s=zn(t);switch(i){case"spring":return Vn(t,e);case"cubicBezier":return _n(Wn,s);case"steps":return _n(kn,s);default:return _n(a,s)}}function Kn(t){try{return document.querySelectorAll(t)}catch(t){return}}function Hn(t,e){for(var i=t.length,a=arguments.length>=2?arguments[1]:void 0,s=[],n=0;n<i;n++)if(n in t){var o=t[n];e.call(a,o,n,t)&&s.push(o)}return s}function Xn(t){return t.reduce((function(t,e){return t.concat(Fn.arr(e)?Xn(e):e)}),[])}function qn(t){return Fn.arr(t)?t:(Fn.str(t)&&(t=Kn(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Yn(t,e){return t.some((function(t){return t===e}))}function Qn(t){var e={};for(var i in t)e[i]=t[i];return e}function $n(t,e){var i=Qn(t);for(var a in t)i[a]=e.hasOwnProperty(a)?e[a]:t[a];return i}function Jn(t,e){var i=Qn(t);for(var a in e)i[a]=Fn.und(t[a])?e[a]:t[a];return i}function Zn(t){return Fn.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Fn.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,a){return e+e+i+i+a+a})),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(i[1],16)+","+parseInt(i[2],16)+","+parseInt(i[3],16)+",1)"}(t):Fn.hsl(t)?function(t){var e,i,a,s=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),n=parseInt(s[1],10)/360,o=parseInt(s[2],10)/100,r=parseInt(s[3],10)/100,c=s[4]||1;function d(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==o)e=i=a=r;else{var l=r<.5?r*(1+o):r+o-r*o,h=2*r-l;e=d(h,l,n+1/3),i=d(h,l,n),a=d(h,l,n-1/3)}return"rgba("+255*e+","+255*i+","+255*a+","+c+")"}(t):void 0;var e,i}function to(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function eo(t,e){return Fn.fnc(t)?t(e.target,e.id,e.total):t}function io(t,e){return t.getAttribute(e)}function ao(t,e,i){if(Yn([i,"deg","rad","turn"],to(e)))return e;var a=Mn.CSS[e+i];if(!Fn.und(a))return a;var s=document.createElement(t.tagName),n=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;n.appendChild(s),s.style.position="absolute",s.style.width=100+i;var o=100/s.offsetWidth;n.removeChild(s);var r=o*parseFloat(e);return Mn.CSS[e+i]=r,r}function so(t,e,i){if(e in t.style){var a=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?ao(t,s,i):s}}function no(t,e){return Fn.dom(t)&&!Fn.inp(t)&&(!Fn.nil(io(t,e))||Fn.svg(t)&&t[e])?"attribute":Fn.dom(t)&&Yn(Ln,e)?"transform":Fn.dom(t)&&"transform"!==e&&so(t,e)?"css":null!=t[e]?"object":void 0}function oo(t){if(Fn.dom(t)){for(var e,i=t.style.transform||"",a=/(\w+)\(([^)]*)\)/g,s=new Map;e=a.exec(i);)s.set(e[1],e[2]);return s}}function ro(t,e,i,a){var s=On(e,"scale")?1:0+function(t){return On(t,"translate")||"perspective"===t?"px":On(t,"rotate")||On(t,"skew")?"deg":void 0}(e),n=oo(t).get(e)||s;return i&&(i.transforms.list.set(e,n),i.transforms.last=e),a?ao(t,n,a):n}function co(t,e,i,a){switch(no(t,e)){case"transform":return ro(t,e,a,i);case"css":return so(t,e,i);case"attribute":return io(t,e);default:return t[e]||0}}function lo(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var a=to(t)||0,s=parseFloat(e),n=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return s+n+a;case"-":return s-n+a;case"*":return s*n+a}}function ho(t,e){if(Fn.col(t))return Zn(t);if(/\s/g.test(t))return t;var i=to(t),a=i?t.substr(0,t.length-i.length):t;return e?a+e:a}function uo(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function po(t){for(var e,i=t.points,a=0,s=0;s<i.numberOfItems;s++){var n=i.getItem(s);s>0&&(a+=uo(e,n)),e=n}return a}function mo(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*io(t,"r")}(t);case"rect":return function(t){return 2*io(t,"width")+2*io(t,"height")}(t);case"line":return function(t){return uo({x:io(t,"x1"),y:io(t,"y1")},{x:io(t,"x2"),y:io(t,"y2")})}(t);case"polyline":return po(t);case"polygon":return function(t){var e=t.points;return po(t)+uo(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function go(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Fn.svg(e)&&Fn.svg(e.parentNode);)e=e.parentNode;return e}(t),s=a.getBoundingClientRect(),n=io(a,"viewBox"),o=s.width,r=s.height,c=i.viewBox||(n?n.split(" "):[0,0,o,r]);return{el:a,viewBox:c,x:c[0]/1,y:c[1]/1,w:o,h:r,vW:c[2],vH:c[3]}}function fo(t,e,i){function a(i){void 0===i&&(i=0);var a=e+i>=1?e+i:0;return t.el.getPointAtLength(a)}var s=go(t.el,t.svg),n=a(),o=a(-1),r=a(1),c=i?1:s.w/s.vW,d=i?1:s.h/s.vH;switch(t.property){case"x":return(n.x-s.x)*c;case"y":return(n.y-s.y)*d;case"angle":return 180*Math.atan2(r.y-o.y,r.x-o.x)/Math.PI}}function yo(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=ho(Fn.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Fn.str(t)||e?a.split(i):[]}}function wo(t){return Hn(t?Xn(Fn.arr(t)?t.map(qn):qn(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function Eo(t){var e=wo(t);return e.map((function(t,i){return{target:t,id:i,total:e.length,transforms:{list:oo(t)}}}))}function vo(t,e){var i=Qn(e);if(/^spring/.test(i.easing)&&(i.duration=Vn(i.easing)),Fn.arr(t)){var a=t.length;2===a&&!Fn.obj(t[0])?t={value:t}:Fn.fnc(e.duration)||(i.duration=e.duration/a)}var s=Fn.arr(t)?t:[t];return s.map((function(t,i){var a=Fn.obj(t)&&!Fn.pth(t)?t:{value:t};return Fn.und(a.delay)&&(a.delay=i?0:e.delay),Fn.und(a.endDelay)&&(a.endDelay=i===s.length-1?e.endDelay:0),a})).map((function(t){return Jn(t,i)}))}function Io(t,e){var i=[],a=e.keyframes;for(var s in a&&(e=Jn(function(t){for(var e=Hn(Xn(t.map((function(t){return Object.keys(t)}))),(function(t){return Fn.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),i={},a=function(a){var s=e[a];i[s]=t.map((function(t){var e={};for(var i in t)Fn.key(i)?i==s&&(e.value=t[i]):e[i]=t[i];return e}))},s=0;s<e.length;s++)a(s);return i}(a),e)),e)Fn.key(s)&&i.push({name:s,tweens:vo(e[s],t)});return i}function bo(t,e){var i;return t.tweens.map((function(a){var s=function(t,e){var i={};for(var a in t){var s=eo(t[a],e);Fn.arr(s)&&1===(s=s.map((function(t){return eo(t,e)}))).length&&(s=s[0]),i[a]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(a,e),n=s.value,o=Fn.arr(n)?n[1]:n,r=to(o),c=co(e.target,t.name,r,e),d=i?i.to.original:c,l=Fn.arr(n)?n[0]:d,h=to(l)||to(c),u=r||h;return Fn.und(o)&&(o=d),s.from=yo(l,u),s.to=yo(lo(o,l),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=jn(s.easing,s.duration),s.isPath=Fn.pth(n),s.isPathTargetInsideSVG=s.isPath&&Fn.svg(e.target),s.isColor=Fn.col(s.from.original),s.isColor&&(s.round=1),i=s,s}))}var Do={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,a,s){if(a.list.set(e,i),e===a.last||s){var n="";a.list.forEach((function(t,e){n+=e+"("+t+") "})),t.style.transform=n}}};function Co(t,e){Eo(t).forEach((function(t){for(var i in e){var a=eo(e[i],t),s=t.target,n=to(a),o=co(s,i,n,t),r=lo(ho(a,n||to(o)),o),c=no(s,i);Do[c](s,i,r,t.transforms,!0)}}))}function Ao(t,e){return Hn(Xn(t.map((function(t){return e.map((function(e){return function(t,e){var i=no(t.target,e.name);if(i){var a=bo(e,t),s=a[a.length-1];return{type:i,property:e.name,animatable:t,tweens:a,duration:s.end,delay:a[0].delay,endDelay:s.endDelay}}}(t,e)}))}))),(function(t){return!Fn.und(t)}))}function Po(t,e){var i=t.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},s={};return s.duration=i?Math.max.apply(Math,t.map((function(t){return a(t)+t.duration}))):e.duration,s.delay=i?Math.min.apply(Math,t.map((function(t){return a(t)+t.delay}))):e.delay,s.endDelay=i?s.duration-Math.max.apply(Math,t.map((function(t){return a(t)+t.duration-t.endDelay}))):e.endDelay,s}var To=0;var No=[],xo=function(){var t;function e(i){for(var a=No.length,s=0;s<a;){var n=No[s];n.paused?(No.splice(s,1),a--):(n.tick(i),s++)}t=s>0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Lo.suspendWhenDocumentHidden&&(So()?t=cancelAnimationFrame(t):(No.forEach((function(t){return t._onDocumentVisibility()})),xo()))})),function(){t||So()&&Lo.suspendWhenDocumentHidden||!(No.length>0)||(t=requestAnimationFrame(e))}}();function So(){return!!document&&document.hidden}function Lo(t){void 0===t&&(t={});var e,i=0,a=0,s=0,n=0,o=null;function r(t){var e=window.Promise&&new Promise((function(t){return o=t}));return t.finished=e,e}var c=function(t){var e=$n(xn,t),i=$n(Sn,t),a=Io(i,t),s=Eo(t.targets),n=Ao(s,a),o=Po(n,i),r=To;return To++,Jn(e,{id:r,children:[],animatables:s,animations:n,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function d(){var t=c.direction;"alternate"!==t&&(c.direction="normal"!==t?"normal":"reverse"),c.reversed=!c.reversed,e.forEach((function(t){return t.reversed=c.reversed}))}function l(t){return c.reversed?c.duration-t:t}function h(){i=0,a=l(c.currentTime)*(1/Lo.speed)}function u(t,e){e&&e.seek(t-e.timelineOffset)}function p(t){for(var e=0,i=c.animations,a=i.length;e<a;){var s=i[e],n=s.animatable,o=s.tweens,r=o.length-1,d=o[r];r&&(d=Hn(o,(function(e){return t<e.end}))[0]||d);for(var l=Rn(t-d.start-d.delay,0,d.duration)/d.duration,h=isNaN(l)?1:d.easing(l),u=d.to.strings,p=d.round,m=[],g=d.to.numbers.length,f=void 0,y=0;y<g;y++){var w=void 0,E=d.to.numbers[y],v=d.from.numbers[y]||0;w=d.isPath?fo(d.value,h*E,d.isPathTargetInsideSVG):v+h*(E-v),p&&(d.isColor&&y>2||(w=Math.round(w*p)/p)),m.push(w)}var I=u.length;if(I){f=u[0];for(var b=0;b<I;b++){u[b];var D=u[b+1],C=m[b];isNaN(C)||(f+=D?C+D:C+" ")}}else f=m[0];Do[s.type](n.target,s.property,f,n.transforms),s.currentValue=f,e++}}function m(t){c[t]&&!c.passThrough&&c[t](c)}function g(t){var h=c.duration,g=c.delay,f=h-c.endDelay,y=l(t);c.progress=Rn(y/h*100,0,100),c.reversePlayback=y<c.currentTime,e&&function(t){if(c.reversePlayback)for(var i=n;i--;)u(t,e[i]);else for(var a=0;a<n;a++)u(t,e[a])}(y),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),y<=g&&0!==c.currentTime&&p(0),(y>=f&&c.currentTime!==h||!h)&&p(h),y>g&&y<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(y)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Rn(y,0,h),c.began&&m("update"),t>=h&&(a=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(i=s,m("loopComplete"),c.loopBegan=!1,"alternate"===c.direction&&d()):(c.paused=!0,c.completed||(c.completed=!0,m("loopComplete"),m("complete"),!c.passThrough&&"Promise"in window&&(o(),r(c)))))}return r(c),c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.loopBegan=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var i=n=e.length;i--;)c.children[i].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,p(c.reversed?c.duration:0)},c._onDocumentVisibility=h,c.set=function(t,e){return Co(t,e),c},c.tick=function(t){s=t,i||(i=s),g((s+(a-i))*Lo.speed)},c.seek=function(t){g(l(t))},c.pause=function(){c.paused=!0,h()},c.play=function(){c.paused&&(c.completed&&c.reset(),c.paused=!1,No.push(c),h(),xo())},c.reverse=function(){d(),c.completed=!c.reversed,h()},c.restart=function(){c.reset(),c.play()},c.remove=function(t){Ro(wo(t),c)},c.reset(),c.autoplay&&c.play(),c}function Mo(t,e){for(var i=e.length;i--;)Yn(t,e[i].animatable.target)&&e.splice(i,1)}function Ro(t,e){var i=e.animations,a=e.children;Mo(t,i);for(var s=a.length;s--;){var n=a[s],o=n.animations;Mo(t,o),o.length||n.children.length||a.splice(s,1)}i.length||a.length||e.pause()}Lo.version="3.2.1",Lo.speed=1,Lo.suspendWhenDocumentHidden=!0,Lo.running=No,Lo.remove=function(t){for(var e=wo(t),i=No.length;i--;){Ro(e,No[i])}},Lo.get=co,Lo.set=Co,Lo.convertPx=ao,Lo.path=function(t,e){var i=Fn.str(t)?Kn(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:go(i),totalLength:mo(i)*(a/100)}}},Lo.setDashoffset=function(t){var e=mo(t);return t.setAttribute("stroke-dasharray",e),e},Lo.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",a=e.easing?jn(e.easing):null,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Fn.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=to(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,y){if(r&&(o=0),c&&(o=(y-1)/2),d&&(o=y-1),!g.length){for(var w=0;w<y;w++){if(s){var E=c?(s[0]-1)/2:o%s[0],v=c?(s[1]-1)/2:Math.floor(o/s[0]),I=E-w%s[0],b=v-Math.floor(w/s[0]),D=Math.sqrt(I*I+b*b);"x"===n&&(D=-I),"y"===n&&(D=-b),g.push(D)}else g.push(Math.abs(o-w));f=Math.max.apply(Math,g)}a&&(g=g.map((function(t){return a(t/f)*f}))),"reverse"===i&&(g=g.map((function(t){return n?t<0?-1*t:-t:Math.abs(f-t)})))}return m+(l?(u-h)/f:h)*(Math.round(100*g[e])/100)+p}},Lo.timeline=function(t){void 0===t&&(t={});var e=Lo(t);return e.duration=0,e.add=function(i,a){var s=No.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&No.splice(s,1);for(var r=0;r<n.length;r++)o(n[r]);var c=Jn(i,$n(Sn,t));c.targets=c.targets||t.targets;var d=e.duration;c.autoplay=!1,c.direction=e.direction,c.timelineOffset=Fn.und(a)?d:lo(a,d),o(e),e.seek(c.timelineOffset);var l=Lo(c);o(l),n.push(l);var h=Po(n,t);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Lo.easing=jn,Lo.penner=Gn,Lo.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var Oo=Lo,_o={duration:1e3,loop:!1,easing:"easeInOutSine"};function Fo(t,e){const i={};if(e.complete&&t.complete){const a=e.complete,s=t.complete;i.complete=t=>{a(t),s(t)}}return{...t,...e,...i}}function zo(t,e,i={}){const{left:a,top:s}=t.getBoundingClientRect(),{left:n,top:o}=e.getBoundingClientRect(),r=n-a,c=o-s;return new Promise((e=>{const a=Fo({targets:t,translateX:r,translateY:c,..._o,complete:()=>{e(!0)}},i);Oo(a)}))}var Vo=t("AnimeUtil",class{async movePoint(t,e,i={}){const a=Nn(e);if(!a)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistEndpointElement")),!1;const s=Pn(t,document.body);if(!s)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:n,width:o,height:r}=Tn(s),c={borderRadius:["0%","50%"],maxWidth:[o,"6px"],maxHeight:[r,"6px"],minWidth:[o,"6px"],minHeight:[r,"6px"],padding:[n,"6px"],duration:700};Object.assign(c,i);const d=await zo(s,a,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,i={}){return zo(t,e,i)}resize(t,e={}){return function(t,e={}){return new Promise((i=>{const a=Fo({scale:[1,.8,1],targets:t,..._o,complete:()=>{i(!0)}},e);Oo(a)}))}(t,e)}async moveAndResize(t,e,i={}){const a=await this.movePoint(t,e,i);return a&&await this.resize(e,{duration:500}),a}}),ko=t("FileUtil",class{calcOSSCatUrl(t,e,i){var a;let s="".concat(ibiz.env.baseUrl,"/").concat(ibiz.env.appId).concat(t);const n=ibiz.hub.getApp(e.srfappid),o=i||n.model.defaultOSSCat||(null==(a=n.model.userParam)?void 0:a.DefaultOSSCat);return s=s.replace("/{cat}",o?"/".concat(o):""),s}calcFileUpDownUrl(t,e,i={},a={}){const{uploadParams:s,exportParams:n,osscat:o}=a;let r=this.calcOSSCatUrl(ibiz.env.uploadFileUrl,t,o),c=this.calcOSSCatUrl("".concat(ibiz.env.downloadFileUrl,"/%fileId%"),t,o),d={},l={};return s&&(d=he(s,i,e,t)),n&&(l=he(n,i,e,t)),r+=Dt.stringify(d,{addQueryPrefix:!0}),c+=Dt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){const i=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==i.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(!i.data)throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"));{let t=ibiz.util.file.getFileName(i);e&&(t=e),c(i.data,t)}}async fileUpload(t,e,i){const a=new FormData;a.append("file",e);const s=await ibiz.net.axios({url:t,method:"post",headers:i,data:a});if(200!==s.status)throw new o(ibiz.i18n.t("runtime.utils.fileUtil.fileUploadFailed"));return s.data}getFileName(t){let e="";const i=t.headers["content-disposition"];if(!i)return e;const a=Dt.parse(i,{delimiter:";"});return a&&a.filename&&(e=a.filename),e.startsWith('"')&&e.endsWith('"')&&(e=e.substring(1,e.length-1)),e}async chooseFileAndUpload(t,e,i,a={}){const{accept:s,multiple:n}=a,o=ibiz.util.file.calcFileUpDownUrl(t,e,i),r=await ibiz.util.file.chooseFile(s,n),c=[],d={Authorization:"Bearer ".concat(mt(u.TOKEN))};for(let t=0;t<r.length;t++){const e=await ibiz.util.file.fileUpload(o.uploadUrl,r[t],d);c.push(e)}return Promise.all(c)}chooseFile(t="",e=!1){return new Promise((i=>{const a=document.createElement("input");a.type="file",a.accept=t,a.multiple=e,a.webkitdirectory=!1,a.addEventListener("change",(t=>{i(t.target.files)})),document.body.appendChild(a),a.click(),document.body.removeChild(a)}))}}),Uo=t("ShortCutUtil",class{constructor(){this.$ShortCut={items:[],mode:"vertical"},this.evt=new ht,this.initShortCut()}get data(){return this.$ShortCut.items}get mode(){return this.$ShortCut.mode}initShortCut(){const t=window.localStorage.getItem("IBizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){this.evt.emit("change",[...this.$ShortCut.items]),window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}setShortCutMode(t){this.$ShortCut.mode=t,window.localStorage.setItem("IBizShortCut",JSON.stringify(this.$ShortCut))}onChange(t){this.evt.on("change",t)}offChange(t){this.evt.off("change",t)}async calcShortCutKey({context:t,appViewId:e}){const i=await ibiz.hub.config.view.get(e);let a="".concat(t.srfappid,"-").concat(t.srfuserid,"-").concat(e);if(i.appDataEntityId){const e=Ae(i.appDataEntityId);a+="-".concat(e,"-").concat(t[e])}return a}addShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.items.splice(e,1,t):this.$ShortCut.items.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.items.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.items.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut.items;if(e<0||e>=i||t<0||t>=i)throw new Error(ibiz.i18n.t("runtime.utils.shortCut.invalidIndexNewIndex",{newIndex:t,oldIndex:e,length:i}));const a=this.$ShortCut.items.splice(e,1)[0];this.$ShortCut.items.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.items.findIndex((e=>e.key===t))>=0}});var Bo=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=it(e);n.srfsimple&&delete n.srfsimple;const r=await ibiz.hub.config.view.get(t);if(!r)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t}));if((n.srfkey||0===i.srfuf)&&r.appDataEntityId){const t=Ae(r.appDataEntityId);n.srfkey&&(n[t]=n.srfkey,n.srfkey=void 0),0===i.srfuf&&(n[t]=void 0,delete i.srfuf)}if(r.redirectView){return Ke(await ibiz.hub.getAppView(t),n,i,s)}const{openMode:c="INDEXVIEWTAB"}=r,d=s.openMode||c;switch(void 0!==d&&"INDEXVIEWTAB"!==d&&n.toRouteDepth&&(n.toRouteDepth=void 0),d){case"INDEXVIEWTAB":case"INDEXVIEWTAB_POPUP":return s.noWaitRoute?(this.openIndexViewTab(r,n,i),{ok:!0}):this.openIndexViewTab(r,n,i,s);case"INDEXVIEWTAB_POPUPMODAL":return this.openIndexViewTabByModal(r,n,i);case"POPUP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopup"));case"POPUPMODAL":return this.openModal(r,n,i);case"POPUPAPP":throw new a(r,ibiz.i18n.t("runtime.command.app.unsupportedPopupapp"));case"POPOVER":return this.openPopover(r,n,i,s);case"DRAWER_LEFT":case"DRAWER_RIGHT":case"DRAWER_TOP":case"DRAWER_BOTTOM":return this.openDrawer(r,n,i);case"USER":return this.openUserCustom(r,n,i);default:return this.openIndexViewTab(r,n,i)}}openIndexViewTab(t,e,i={},a={}){return ibiz.openView.root(t.id,e,i,a)}openIndexViewTabByModal(t,e,i={}){return ibiz.openView.rootByModal(t.id,e,i)}async openModal(t,e,i={}){return ibiz.openView.modal(t.id,e,i)}async openPopover(t,e,i={},a={}){const{event:s,modalOption:n}=a;if(!s)throw new o(ibiz.i18n.t("runtime.command.app.missingEvent"));return ibiz.openView.popover(t.id,s,e,i,{...n})}async openDrawer(t,e,i={}){return ibiz.openView.drawer(t.id,e,i)}async openUserCustom(t,e,i={}){return ibiz.openView.custom(t.id,e,i)}};Bo.TAG="ibiz.app-view.open";var Wo=t("OpenAppViewCommand",Bo),Go=class t{constructor(){ibiz.commands.register(t.TAG,this.exec.bind(this))}async exec(t,e,i={},s={}){const n=(await ibiz.hub.getAppAsync(e.srfappid)).getAppFunc(t);if(!n)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationFunction",{appFuncId:t}));const{navigateContexts:r,navigateParams:c,appFuncType:d}=n,l=e.clone();Object.assign(l,he(r,i,e));const h=he(c,i,e);switch(Object.assign(h,i),d){case"APPVIEW":return this.openAppView(n,l,h,s);case"OPENHTMLPAGE":return this.openHtmlPage(n);case"PDTAPPFUNC":return this.openPdAppFunc(n,l,h);case"JAVASCRIPT":return this.executeJavaScript(n,l,h);case"CUSTOM":return this.custom(n,l,h);default:throw new a(n,ibiz.i18n.t("runtime.command.app.noFindApplicationFunctionYype",{appFuncType:d}))}}async openAppView(t,e,i,a){if(!t.appViewId)throw new o(ibiz.i18n.t("runtime.command.app.noFindApplicationView",{appViewId:t.appViewId}));return ibiz.commands.execute(Wo.TAG,t.appViewId,e,i,a)}openHtmlPage(t){const e=t.htmlPageUrl;window.open(e,"_blank")}openPdAppFunc(t,e,i){throw ibiz.log.warn("openPdAppFunc",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}executeJavaScript(t,e,i){throw ibiz.log.warn("executeJavaScript",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}custom(t,e,i){throw ibiz.log.warn("custom",t,e,i),new o(ibiz.i18n.t("runtime.common.unrealized"))}};Go.TAG="ibiz.app-func.exec";var jo=t("AppFuncCommand",Go);function Ko(){new jo,new Wo}var Ho=t("Application",class{constructor(t){this.model=t,this.deName2DeCodeName=new Map,this.appBISchemeMap=new Map,this.appBICubeMap=new Map,this.appBIReportMap=new Map,this.net=new f({baseURL:"".concat(ibiz.env.baseUrl,"/").concat(this.appId)}),this.configCache=new $a(this.appId,"PSSysApp",t.codeName),this.deService=new fn(t),this.codeList=new Qa(t),this.authority=new ls(t)}get appId(){return this.model.appId||ibiz.env.appId}async init(){await this.authority.init(),await this.loadAppModelStyle(),await this.initMqtt()}async loadAppModelStyle(){const t=await ibiz.hub.getAppStyle(this.appId);if(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.id=this.appId,e.innerHTML=t,document.head.appendChild(e)}}getAppFunc(t){return(this.model.appFuncs||[]).find((e=>e.id===t))||null}getAppUtil(t,e="DEFAULT"){const i=this.model.appUtils||[];let a;return a="CUSTOM"===e?i.find((e=>e.utilTag===t)):i.find((e=>e.id===t)),a}async getUIAction(t){const[,e]=t.split("@");if(e){const i=(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUIActions.find((e=>e.id===t));if(i)return i}return this.model.appDEUIActions.find((e=>e.id===t))}async getOPPriv(t,e){var i,a;let s=null==(i=this.model.deopprivs)?void 0:i.find((e=>e.name===t));if(!s&&e){s=null==(a=(await ibiz.hub.getAppDataEntity(e,this.appId)).deopprivs)?void 0:a.find((e=>e.name===t))}return s}async getDEUILogic(t,e){return(await ibiz.hub.getAppDataEntity(e,this.appId)).appDEUILogics.find((e=>e.id===t))}async initMqtt(){this.mqtt&&this.mqtt.close(),ibiz.env.enableMqtt&&ibiz.appData&&ibiz.appData.mqtttopic&&!0!==ibiz.auth.isAnonymous&&(this.mqtt=new mn(ibiz.appData.mqtttopic,y(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),Xo=class{parse(t){return t}},qo=class{constructor(){this.appMenu=new Xo}},Yo=class{constructor(){this.viewConfigs=new Map}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}getCustomOption(t){var e;const{appViewParams:i,userParam:a}=t;let s=null==(e=null==i?void 0:i.find((t=>"modaloption"===t.id)))?void 0:e.value;!s&&a&&(s=a.modalOption);let n={};if(s)try{n=JSON.parse(s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.hub.failedParse",{error:t}))}return{modalOption:n}}has(t){const e=this.calcAppViewId(t);return this.viewConfigs.has(e)}set(t,e){const i=this.calcAppViewId(t);this.viewConfigs.set(i,e)}async get(t){const e=this.calcAppViewId(t);if(!this.viewConfigs.has(e)){const t=await ibiz.hub.getAppView(e);if(!t)throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}));this.set(t.id,{id:t.id,appId:t.appId,codeName:t.codeName,openMode:t.openMode,viewType:t.viewType,width:t.width,height:t.height,appDataEntityId:t.appDataEntityId,redirectView:t.redirectView,...this.getCustomOption(t)})}return this.viewConfigs.get(e)}getSync(t){return this.viewConfigs.has(t)?this.viewConfigs.get(t):null}},Qo=class{constructor(){this.view=new Yo}},$o=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))($o||{})),Jo=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Jo||{})),Zo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Zo||{})),tr=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(tr||{})),er=t("Counter",class{constructor(t){this.callback=t,this.count=0,this.state="Unused",this.reusable=!0}increment(){return"Used"===this.state||(this.count+=1),this.count}decrement(t){if("Used"!==this.state){if(0===this.count)throw new o(ibiz.i18n.t("runtime.controller.utils.counter.decrement"));this.count-=1,0===this.count&&(t?t():this.callback&&this.callback(),this.reusable||(this.state="Used"))}}destroy(){this.callback=void 0}}),ir=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new er(w)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),ar=t("CTXState",class{}),sr=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new ht(3e3),this.controllersMap=new Map,this.state=new ar}async init(t){this.view=t,this.registerController(t.model.name,t)}destroy(){this.controllersMap.clear(),this.view=null,this.state=null,this.isDestroyed=!0}async setState(t){Object.assign(this.state,t)}startLoading(){this.view.startLoading()}endLoading(){this.isDestroyed||this.view.endLoading()}registerController(t,e){this.controllersMap.set(t,e),this.evt.emit("onRegister",t,e)}getController(t,e=!1){return this.controllersMap.has(t)?this.controllersMap.get(t):this.parent&&e?this.parent.getController(t):void 0}getTopView(){return this.parent?2===this.view.modal.routeDepth?this.view:this.parent.getTopView():this.view}}),nr=t("ActivityCounter",class extends er{constructor(){super(...arguments),this.reusable=!1,this.registration=new Map}enroll(t){"Unused"!==this.state||this.registration.has(t)||(this.registration.set(t,!1),this.increment())}attend(t){this.registration.has(t)&&!1===this.registration.get(t)&&(this.registration.set(t,!0),this.decrement())}}),or=t("UIActionButtonState",class{constructor(t,e,i){this.disabled=!1,this.visible=!0,this.loading=!1,this.permitted=!0,this.noPermissionHidden=!0,this.noDataDisabled=!1,this.noKeyDisabled=!1,this.isInit=!1,this.name=t,this.uiActionId=i,this.appId=e}async init(){if(!this.uiActionId)return void(this.isInit=!0);const t=await Se(this.uiActionId,this.appId);if([,this.appDeName]=this.uiActionId.split("@"),!t)return;const{dataAccessAction:e,noPrivDisplayMode:i,actionTarget:a,uiactionMode:s,uiactionTag:n}=t;this.dataAccessAction=e,this.actionTarget=a,1===i?this.noPermissionHidden=!1:6===i&&(this.visible=!1),[2,6].includes(i)&&this.dataAccessAction&&(this.visible=!1),(a&&"NONE"!==a||"SYS"===s&&["Save","SaveAndExit","SaveAndNew","Edit","Remove","RemoveAndExit"].includes(n))&&(this.noDataDisabled=!0,"SINGLEKEY"!==a&&"MULTIKEY"!==a||(this.noKeyDisabled=!0)),this.isInit=!0}async calcPermission(t,e,i){if(!this.dataAccessAction)return;const a=await ibiz.hub.getApp(this.appId);this.actionTarget&&"NONE"===this.actionTarget?this.permitted=await a.authority.calcByNoDataAccessAction(this.dataAccessAction,t,i):(this.appDeName&&i&&!i.includes(this.appDeName)&&ibiz.log.warn(ibiz.i18n.t("runtime.controller.utils.buttonState.isFinitenconsistency",{uiActionId:this.uiActionId,appDeName:this.appDeName,appDeId:i})),this.permitted=await a.authority.calcByDataAccessAction(this.dataAccessAction,t,e,i))}async update(t,e,i){this.isInit||await this.init(),await this.calcPermission(t,e,i),this.permitted?(this.visible=!0,this.disabled=this.noDataDisabled&&(!e||this.noKeyDisabled&&!e.srfkey)):(this.disabled=!0,this.visible=!this.noPermissionHidden)}}),rr=t("ButtonContainerState",class{constructor(){Object.defineProperty(this,"children",{enumerable:!1,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get:()=>0!==this.children.length&&!!this.children.find((t=>t.visible))})}addState(t,e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e}),this.children.push(e)}setLoading(t){this.children.forEach((e=>{e.setLoading?e.setLoading(t):e.loading=!!t&&e.name===t}))}async update(t,e,i){await Promise.all(this.children.map((a=>a.update(t,e,i))))}async init(){await Promise.all(this.children.map((t=>t.init())))}}),cr=t("QXEventEx",class extends ht{constructor(){super(...arguments),this.anyEventFns=[]}onAll(t){this.anyEventFns.includes(t)||this.anyEventFns.push(t)}emit(t,...e){super.emit(t,...e),this.anyEventFns.forEach((i=>{i(t,...e)}))}async asyncEmit(t,...e){const i=super.asyncEmit(t,...e),a=this.anyEventFns.map((i=>i(t,...e))),s=Promise.all(a),n=await i,o=await s;return n.concat(...o)}reset(){super.reset(),Et(this.anyEventFns)}}),dr=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new cr}async emit(t,e){this.isDestroyed||await this.evt.asyncEmit(t,{...this.getBaseArgs(),eventName:t,...e||{}})}on(t,e){this.isDestroyed||this.evt.on(t,e)}off(t,e){this.isDestroyed||this.evt.off(t,e)}onAll(t){this.isDestroyed||this.evt.onAll(t)}destroy(){this.getBaseArgs=void 0,this.evt.reset(),this.isDestroyed=!0}});function lr(t){return window.location.hash.split("/").length>2*t+2}function hr(t,e){return(!Z(t)&&""!==t||!Z(e)&&""!==e)&&t!==e}function ur(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof os&&(e=e.getOrigin()),e}function pr(t,e,i){const a=[];return t.forEach((t=>{const{valueRuleType:s}=t,n=t.sysValueRule,r=t.defvalueRule;if("SYSVALUERULE"===s&&n)"REG"===n.ruleType||"REGEX"===n.ruleType?a.push({pattern:new RegExp(n.regExCode),message:n.ruleInfo,trigger:"change blur"}):"SCRIPT"===n.ruleType&&a.push({validator:(t,e,i,a)=>{if(!e)return!0;try{ei.execScriptFn({rule:t,value:e,callback:i,source:a},n.scriptCode,{isAsync:!1})}catch(t){return console.error(t),!1}return!0},trigger:"change blur"});else if("DEFVALUERULE"===s&&r){const t=i||e;a.push({validator:(e,i,a,s)=>{if(dt(s[t]))return!0;const{isPast:n,infoMessage:c}=ii(t,s,r.groupCond);return n||a(new o(c||r.ruleInfo)),!0},trigger:"change blur"})}})),a}function mr(t){const e=[],{maxLength:i,minLength:a}=t,{maxValue:s,minValue:n}=t;return i&&e.push({validator:(t,e,a)=>{if(Z(e)||!(e.length>i))return!0;a(new Error(ibiz.i18n.t("runtime.controller.utils.valueRule.length",{maxLength:i,length:e.length})))}}),a&&e.push({validator:(t,e,i)=>{if(Z(e)||!(e.length<a))return!0;i(new Error("内容长度必须大于等于".concat(a,",当前长度为").concat(e.length)))}}),Z(s)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e>s))return!0;i(new Error("值必须小于等于".concat(s)))}}),Z(n)||e.push({validator:(t,e,i)=>{if(!(!Z(e)&&vt(e)&&e<n))return!0;i(new Error("值必须大于等于".concat(n)))}}),e}var gr=t("ValueExUtil",class{static mergeDefault(t){return nt(t,{textSeparator:",",valueSeparator:","})}static toText(t,e){if(Z(e)||""===e)return"";const{valueType:i,objectNameField:a,textSeparator:s}=this.mergeDefault(t);if(["OBJECTS","OBJECT"].includes(i)){if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.valueEx.objectNameField"));const t=a.toLowerCase();return"OBJECTS"===i?e.map((e=>e[t]||"---")).join(s):e[t]}return"SIMPLES"===i?e.join(s):"".concat(e)}});function fr(t,e){var i;const{name:s,valueType:n,defaultValue:r,valueFormat:c}=t,{data:d,context:l,params:h}=e;if(Z(n)&&Z(r))return;if("RESET"===n)return null;const u=d[s];if(!ot(u)){if(!n&&r)return r;switch(n){case"APPDATA":if(Object.prototype.hasOwnProperty.call(h,r))return h[r];if(Object.prototype.hasOwnProperty.call(l,r))return l[r];break;case"OPERATORNAME":return l.srfusername;case"OPERATOR":return l.srfuserid;case"CURTIME":return Ct().format(c);case"PARAM":return d[r];case"SESSION":case"APPLICATION":if(!(null==(i=ibiz.appData)?void 0:i.context))throw new o(ibiz.i18n.t("runtime.controller.utils.valueDefault.noExist"));return ibiz.appData.context[r];case"CONTEXT":return h[r];case"UNIQUEID":return ut();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:n}))}}}var yr="asyncimportdata2",wr="importdata2";async function Er(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")});const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(yr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ja(a,e)+n}const o=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});var r;await(r=o.data.asyncacitonid,new Promise((t=>{const e=i=>{const a=i.messageid||i.data.asyncacitonid;if(r!==a)return;const s=i.data.actionstate;30!==s&&40!==s||(t(),ibiz.mc.command.asyncAction.off(e))};ibiz.mc.command.asyncAction.on(e)}))),ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT")}async function vr(t,e,i,a){const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(wr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ja(a,e)+n}const o={isAsync:!1};try{const t=await ibiz.net.request(n,{method:"post",data:s,headers:{"Content-Type":"multipart/form-data"}});ibiz.mc.command.send({srfdecodename:e.codeName},"OBJECTCREATED","DATAIMPORT"),Object.assign(o,t.data)}catch(t){t instanceof Error&&(o.errorMessage=t.message)}return o}async function Ir(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)Er(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await vr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function br(t,e,i){if(!ibiz.util.getExcelUtil)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.noExist"));const a=await ibiz.util.getExcelUtil();if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.loadError"));try{return a.exportJsonToExcel({header:t,data:e,filename:i,autoWidth:!0}),{ok:!0}}catch(t){return{ok:!1}}}async function Dr(t){var e;const i=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),a=null==(e=i.appDEDataImports)?void 0:e.find((e=>e.id===t.deDataImportId));if(!a)throw new o(ibiz.i18n.t("runtime.controller.utils.dataFileUtil.importData"));return{deDataImport:a,appDataEntity:i}}async function Cr(t){const{deDataImportId:e,appDataEntityId:i,context:a,params:s}=t,n=t.dataImportViewId||"AppDataUploadView";let o=null;try{o=await ibiz.hub.config.view.get(n)}catch(e){if(t.dataImportViewId)throw e}if(o)return a.srfappdataentityid=i,a.srfdedataimportid=e,ibiz.commands.execute(Wo.TAG,o.id,a,s,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await Dr({deDataImportId:e,appDataEntityId:i,appId:a.srfappid}),d=r.enableCustomized?"DataImport2":"DataImport",l=ibiz.overlay.createModal(d,{dismiss:()=>l.dismiss(),dataImport:r,appDataEntity:c,context:a,params:s},{width:"auto",placement:"center"});l.present(),await l.onWillDismiss()}async function Ar(t,e,i){let a="/".concat(t.codeName2.toLowerCase(),"/importtemplate");if((null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName)),i){a=ja(i,t)+a}const s=await ibiz.net.request(a,{responseType:"blob"});if(200===s.status){const t=ibiz.util.file.getFileName(s),e=new Blob([s.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}async function Pr(t){return new Promise((e=>{E({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await Ir({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Tr(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=ja(t.context,t.appDataEntity)+i}const a="".concat(i,"/asyncimportdata2"),s={srfossfileid:t.fileId,srfimportschemaid:t.schemaId},n=(null==(e=t.dataImport)?void 0:e.id)||t.appDataEntity.defaultAppDEDataImportId;n&&Object.assign(s,{srfimporttag:n}),await ibiz.net.request(a,{method:"get",params:s}),ibiz.notification.info({desc:ibiz.i18n.t("runtime.controller.utils.dataFileUtil.startImport")})}function Nr(t){var e,i,a,s;let n={system_tag:null==(e=ibiz.appData)?void 0:e.context.srfsystemid,data_entity_tag:null==(i=t.appDataEntity)?void 0:i.codeName,import_tag:(null==(a=t.dataImport)?void 0:a.id)||(null==(s=t.appDataEntity)?void 0:s.defaultAppDEDataImportId),owner_type:"PERSONAL"};return n=tt(n,t.data),n}async function xr(t,e){const i=ibiz.hub.getApp(e.srfappid),a=await ibiz.hub.getAppDataEntity(t,e.srfappid);let s="/jsonschema/".concat(a.name);0===a.dynaSysMode&&ibiz.appData&&(s+="?dynamodeltag=".concat(ibiz.appData.dynamodeltag));return(await i.net.get(s)).data}var Sr=t("VIEW_MSG_PREFIX","VIEW_MSG"),Lr=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Sr,"_").concat(e)}async init(t){var e,i;const a=ibiz.hub.getApp(t.srfappid).model,s=null==(e=a.appViewMsgGroups)?void 0:e.find((t=>t.id===this.msgGroupId));if(!s)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.message",{msgGroupId:this.msgGroupId}));this.msgGroup=s;const n=s.appViewMsgGroupDetails.map((t=>t.appViewMsgId));if(null==(i=a.appViewMsgs)||i.forEach((t=>{const e=n.indexOf(t.id);-1!==e&&(this.viewMsgMap.set(t.id,t),n.splice(e,1))})),n.length)throw new o(ibiz.i18n.t("runtime.controller.utils.viewMsg.noFound",{message:n.join(",")}))}getDeFieldName(t,e){var i,a;if(e)return null==(a=null==(i=xe(t,e))?void 0:i.name)?void 0:a.toLowerCase()}static async fetchDataSet(t,e,a){const{appDataEntityId:s,appDEDataSetId:n}=t;if(!n)throw new i(t,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfigured"));const o=await ibiz.hub.getApp(e.srfappid).deService.exec(s,n,e,a);return o.data.length?o.data:[]}getMsgRemoveModeStorage(t){return 1!==t.removeMode?null:localStorage.getItem(t.key)}setMsgRemoveModeStorage(t){1===t.removeMode&&localStorage.setItem(t.key,"1")}async calcViewMsgVisible(t,e,i,a){const{enableMode:s,dataAccessAction:n,appDataEntityId:o,appId:r,testAppDELogicId:c,testScriptCode:d}=t;if("DEOPPRIV"===s&&n){const t=ibiz.hub.getApp(i.srfappid);return!!await t.authority.calcByDataAccessAction(n,i,e,o)}if("DELOGIC"===s&&o&&r&&c){const t=Te(c,await ibiz.hub.getAppDataEntity(o,r));if(t){return!!(await Us(t,i,e,a)).data}}if("SCRIPT"===s&&d){return!!ei.execScriptFn({data:e,context:i,params:a},d,{isAsync:!1,singleRowReturn:!0})}return!0}async calcViewMessages(t,e){const i=this.msgGroup.appViewMsgGroupDetails,a=[];return(null==i?void 0:i.length)&&await Promise.all(i.map((async i=>{const s=this.viewMsgMap.get(i.appViewMsgId);if(1===s.dynamicMode){const n=await this.calcDynaMsgs(i,t,e);await Promise.all(n.map((async i=>{i.visible=await this.calcViewMsgVisible(s,i.data||{},t,e)}))),a.push(...n)}else{const n=this.calcStaticMsg(i);n.visible=await this.calcViewMsgVisible(s,n.data||{},t,e),a.push(n)}}))),a.filter((t=>t.visible&&!this.getMsgRemoveModeStorage(t)))}calcStaticMsg(t){const{position:e}=t,i=this.viewMsgMap.get(t.appViewMsgId),{codeName:a,title:s,message:n,removeMode:o,position:r,messageType:c,layoutPanel:d,sysCss:l}=i,{userTag:h,userTag2:u,userTag3:p,userTag4:m}=i,g=e||r,f={key:"".concat(this.tag,"_").concat(a),title:s,message:n,position:g,messageType:c,removeMode:o,visible:!0,layoutPanel:d,sysCss:l,extraParams:{userTag:h,userTag2:u,userTag3:p,userTag4:m}};return f.data={env:f},f}async calcDynaMsgs(e,a,s){const n=this.viewMsgMap.get(e.appViewMsgId),{appDataEntityId:o,orderValueAppDEFieldId:r,titleAppDEFieldId:c,removeFlagAppDEFieldId:d,msgTypeAppDEFieldId:l,contentAppDEFieldId:h,msgPosAppDEFieldId:u,layoutPanel:p}=n;if(!o)throw new i(n,ibiz.i18n.t("runtime.controller.utils.viewMsg.unconfiguredEntities"));const m=await ibiz.hub.getAppDataEntity(o,a.srfappid),g={...s},f=this.getDeFieldName(m,r);f&&(g.sort="".concat(f,",asc"));const y=await t.fetchDataSet(n,a,g);if(!y.length)return[];const w=this.calcStaticMsg(e),E=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),I=this.getDeFieldName(m,h),b=this.getDeFieldName(m,l),D=this.getDeFieldName(m,d);return y.map((t=>{const e={};v&&!Z(t[v])&&(e.position=t[v]),E&&!Z(t[E])&&(e.title=t[E]),I&&!Z(t[I])&&(e.message=t[I]),b&&!Z(t[b])&&(e.messageType=t[b]),D&&!Z(t[D])&&(e.removeMode=t[D]),Z(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=tt(w,e);return i.data={...t,env:i},i}))}}),Mr="__self",Rr=t("BaseController",class{constructor(t,e,i,a){this.model=t,this.params=i,this.ctx=a,this.id=ut(),this.state={},this.name="",this.evt=new dr(this.getEventArgs.bind(this)),this.mountCounter=new nr(this.mounted.bind(this)),this.childNames=[],this.name=t.name||t.id,this.state.context=e,this.preprocessModel(t),this.initState(),this.convertMultipleLanguages()}get _evt(){return this.evt}get context(){return this.state.context}preprocessModel(t){}initState(){this.state.isCreated=!1,this.state.isMounted=!1,this.state.isDestroyed=!1}getEventArgs(){return{context:this.context,params:this.params,data:[],targetName:this.model.name,view:this.ctx.view}}async created(){this.mountCounter.enroll(Mr),await this.onCreated(),this.state.isCreated=!0,this.force((()=>{this.mountSelf()})),ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onCreated")),this._evt.emit("onCreated",void 0)}async onCreated(){this.ctx.evt.on("onForecast",(t=>{this.childNames.includes(t)&&this.mountCounter.enroll(t)})),this.ctx.evt.on("onRegister",((t,e)=>{this.childNames.includes(t)&&e.evt.on("onMounted",(()=>{this.mountCounter.attend(t)}))}))}async mountSelf(){this.mountCounter.registration.get(Mr)||this.mountCounter.attend(Mr)}async mounted(){await this.onMounted(),this.state.isMounted=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onMounted")),this._evt.emit("onMounted",void 0)}async onMounted(){}async destroyed(){await this.onDestroyed(),this.state.isDestroyed=!0,ibiz.log.debug("".concat(this.constructor.name,":").concat(this.name," onDestroyed")),await this._evt.emit("onDestroyed",void 0),this.evt.destroy()}async onDestroyed(){}force(t){}getController(t,e=!1){return this.ctx.getController(t,e)}getTopView(){return this.ctx.getTopView()}listenNewController(t){this.ctx.evt.on("onRegister",t)}convertMultipleLanguages(){}}),Or=t("ViewController",class extends Rr{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),d.create({},e),i||{},new sr(a)),this.session={},this.modal=new vi({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new ir,this.isCloseView=!1,a&&a.registerController(this.model.name,this),this.ctx.init(this),this.initEngines(),this.handleViewError=this.handleViewError.bind(this)}get _evt(){return this.evt}get parentView(){var t;return null==(t=this.ctx.parent)?void 0:t.view}get isActive(){return this.state.activated}onActivated(){this.state.activated=!0,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewPause",{name:this.model.name,id:this.model.id}))}initEngines(){const t=ke(this.model);if(t.length)t.forEach((t=>{const e=ibiz.engine.getEngine(t,this);e?this.engines.push(e):ibiz.log.warn(ibiz.i18n.t("runtime.controller.common.view.noFoundViewEngine"),t)}));else{const t=ibiz.engine.getEngine({engineCat:"VIEW",engineType:this.model.viewType,appId:this.model.appId},this);t&&this.engines.push(t)}}async initCounters(){const t=this.model.viewLayoutPanel,{appCounterRefs:e}=t;if(e&&e.length>0)try{await Promise.all(e.map((async t=>{const e=await Ja.getCounterByRef(t,this.context,{...this.params});this.counters[t.id]=e})))}catch(t){console.error(t)}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1,this.state.caption=this.model.caption,this.state.srfactiveviewdata=null,this.state.viewMessages={},this.state.isClosing=!1,this.state.hasError=!1,this.state.isShortCut=!1}async onCreated(){await super.onCreated(),this.modal.hooks.beforeDismiss.tapPromise((async t=>{ot(this.state.closeOK)&&(t.ok=this.state.closeOK),await this._evt.emit("onCloseView",{...t})})),this._evt.emit("onViewInfoChange",{caption:this.model.caption,title:this.model.title}),this.handleContextParams();const t=this.model.viewLayoutPanel;this.childNames.push(t.name);const e=await ki(t);this.providers[t.name]=e;const i=ze(this.model);i&&await Promise.all(i.map((async t=>{const e=await ki(t);this.providers[t.name||t.id]=e}))),await this.initCounters();const a=Ve(this.model);a.length&&(this.scheduler=ibiz.scheduler.createViewScheduler(a),this.scheduler.defaultParamsCb=()=>this.getEventArgs(),this.scheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.scheduler.triggerViewEvent(e)}))),this.initViewMsg(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onCreated()))),ibiz.mc.error.on(this.handleViewError)}async onMounted(){var t;await super.onMounted(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onMounted()))),null==(t=this.scheduler)||t.startTimerTrigger(),await this.initShortCut()}async initShortCut(){const{model:t,context:e}=this,i=await ibiz.util.shortCut.calcShortCutKey({context:e,appViewId:t.id});this.state.isShortCut=ibiz.util.shortCut.isExist(i)}async onDestroyed(){const t=this.context.srfsessionid;await super.onDestroyed(),this.engines.length&&await Promise.all(this.engines.map((t=>t.onDestroyed()))),Object.values(this.counters).forEach((t=>t.destroy())),this.ctx.destroy(),this.engines=[],this.scheduler&&this.scheduler.destroy(),this.id===t&&ibiz.uiDomainManager.destroy(t),this.context.destroy(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.view.viewDestroy",{name:this.model.name,id:this.model.id})),ibiz.mc.error.off(this.handleViewError)}handleContextParams(){if(this.context.srfappid=this.model.appId||ibiz.env.appId,Z(this.context.srfsessionid)||et(this.context.srfsessionid)){const t=ibiz.uiDomainManager.create(this.id);this.context.srfsessionid=t.id}this.context.srfviewid=this.id;const t=this.model.appViewNavContexts;let e={};ct(t)&&(e=he(t,this.params,this.context)),Object.assign(this.context,e),Object.prototype.hasOwnProperty.call(this.context,"srfreadonly")||Object.assign(this.context,{srfreadonly:!1});const i=this.model.appViewNavParams;let a={};ct(i)&&(a=he(i,this.params,this.context)),Object.assign(this.params,a),this.engines.forEach((t=>{t.handleContextParams()})),this.state.isMounted&&this.callUIAction("Refresh")}async call(t,e){let i;for(const a of this.engines)if(i=await a.call(t,e),void 0!==i)break;return i}async callUIAction(t,e){const i=this.call(t,e);if(void 0===i)throw new o(ibiz.i18n.t("runtime.controller.common.view.noSupportBehavior",{key:t}));return i}async closeView(t={ok:!1,data:[]}){await this.modal.dismiss(t)}startLoading(){this.viewLoading.begin(),this.state.isLoading=this.viewLoading.isLoading}endLoading(){this.viewLoading.end(),this.state.isLoading=this.viewLoading.isLoading}setLayoutPanel(t){var e;this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)})),(null==(e=this.scheduler)?void 0:e.hasControlEventTrigger)&&t.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}async initViewMsg(){const{appViewMsgGroupId:t,codeName:e}=this.model;if(t){this.state.viewMessages={TOP:[],BOTTOM:[],BODY:[],POPUP:[]},this.viewMsgController=new Lr(t,"".concat(e,"_").concat(this.modal.mode)),await this.viewMsgController.init(this.context);(await this.viewMsgController.calcViewMessages(this.context,this.params)).forEach((t=>{["TOP","BOTTOM","BODY","POPUP"].includes(t.position)&&this.state.viewMessages[t.position].push(t)})),this.state.viewMessages.POPUP.length&&this.alertViewMessage(this.state.viewMessages.POPUP)}}async alertViewMessage(t){var e,i;const[a,...s]=t,n={title:a.title,desc:a.message,options:{showClose:0!==a.removeMode,showConfirmButton:0!==a.removeMode,customClass:(null==(e=a.sysCss)?void 0:e.cssName)||""}};if(a.layoutPanel&&n.options){const t=new v("view-message").m("alert");n.options.customClass="".concat(n.options.customClass||""," ").concat(t),n.options.message=()=>ibiz.render.renderCtrlShell(a.layoutPanel,this.context,this.params,{data:a.data})}a.extraParams.userTag&&Object.assign(n,{confirmButtonText:a.extraParams.userTag});try{"WARN"===a.messageType?await ibiz.modal.warning(n):"ERROR"===a.messageType?await ibiz.modal.error(n):await ibiz.modal.info(n)}finally{null==(i=this.viewMsgController)||i.setMsgRemoveModeStorage(a)}s.length&&this.alertViewMessage(s)}convertMultipleLanguages(){this.model.capLanguageRes&&this.model.capLanguageRes.lanResTag&&(this.model.caption=ibiz.i18n.t(this.model.capLanguageRes.lanResTag,this.model.caption))}handleViewError(t){const{type:e,data:i}=t;"ERROR"===e&&i instanceof s&&i.tag===this.id&&(this.error=i,this.state.hasError=!0)}}),_r=(t("AppDataUploadViewController",class extends Or{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:s}=await Dr({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=s}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;Ar(t,e,this.context)}async selectAndImport(){const t=await Pr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Tr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends Or{}),t("WFStepTraceViewController",class extends Or{initState(){super.initState(),this.state.historyData=null}async onCreated(){var t;await super.onCreated();const e=ibiz.hub.getApp(this.context.srfappid),i=null==(t=this.ctx.parent)?void 0:t.view;if(i&&i.model.appDataEntityId){const t=await e.deService.getService(i.context,i.model.appDataEntityId),a=Object.assign(this.context.clone(),this.params),s=await t.wf.getWFHistory(a);s.data&&(this.state.historyData=s.data)}}}),t("EditorController",class{constructor(t,e){this.style={},this.placeHolder="",this.editorParams={},this.model=t,this.parent=e,this.context=e.context,this.params=e.params}get readonly(){return!!this.model.readOnly}get valueFormat(){return this.parent.valueFormat}get dataType(){return this.parent.dataType}async init(){await this.onInit()}async onInit(){if(this.model.placeHolder&&(this.placeHolder=this.model.placeHolder),this.model.editorParams&&Object.keys(this.model.editorParams).forEach((t=>{this.editorParams[t]=this.model.editorParams[t]})),this.model.editorWidth){const t=this.model.editorWidth;this.style.width=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.editorHeight){const t=this.model.editorHeight;this.style.height=t>0&&t<=1?"".concat(100*t,"%"):"".concat(t,"px")}if(this.model.cssStyle){const t={};this.model.cssStyle.split(";").filter(Boolean).forEach((e=>{const[i,a]=e.split(":");i&&a&&(t[i.trim()]=a.trim()),Object.assign(this.style,t)}))}this.model.editorItems&&(this.model.editorItems=this.model.editorItems.filter((t=>t.id!==this.model.id)))}handlePublicParams(t,e,i){const{navigateContexts:a,navigateParams:s}=this.model;let n={};a&&t&&(n=he(a,t,i,e));const o=Object.assign(e.clone(),n);let r={};return s&&t&&(r=he(s,t,i,e)),{context:o,params:r}}toObj(t){if(!t)return;return new Function("return (".concat(t,");"))()}toBoolean(t){return Object.is("true",t)}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return gr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}})),Fr=(t("CodeListEditorController",class extends _r{async loadCodeList(t){const{context:e,params:a}=this.handlePublicParams(t,this.context,this.params);if(this.model.appCodeListId){const t=await ibiz.hub.getApp(this.context.srfappid);let i=[];return i=await t.codeList.get(this.model.appCodeListId,e,a),i}throw new i(this.model,ibiz.i18n.t("runtime.controller.common.editor.editorNoConfigured",{editorType:this.model.editorType}))}}),t("ControlController",class extends Rr{constructor(t,e,i,a){if(super(t,d.create({},e),new I({},i),a),this.controlParams={},this.providers={},this.triggerKey="",this.awaitActiveCbs=new Map,this.delayCbs=new Map,this.registerToCtx(),this.controlPanel=Ee(t),!this.controlPanel){const e=ibiz.util.layoutPanel.get("".concat(t.controlType,"_DEFAULT"));e&&(this.controlPanel=it(e))}this.updateContextParams({})}get _evt(){return this.evt}get view(){return this.ctx.view}registerToCtx(){this.ctx.registerController(this.model.name||this.model.id,this)}getEventArgs(){return{...super.getEventArgs(),data:this.getData()||[],ctrl:this}}initState(){super.initState(),this.state.activated=!0,this.state.isLoading=!1}async onCreated(){var t;if(await super.onCreated(),this.controlPanel){this.childNames.push(this.controlPanel.name);const t=await ki(this.controlPanel);this.providers[this.controlPanel.name]=t}if(this.handleControlParams(),this.initControlScheduler(this.model.controlLogics),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.onAll(((t,e)=>{this.scheduler.triggerControlEvent(e.targetName,e.eventName,e)})),this.model.appDataEntityId){const t=Ae(this.model.appDataEntityId);this.triggerKey="".concat(this.view.name,"@").concat(t,"@").concat(this.model.controlType,"@").concat(this.model.codeName)}this.onDEDataChange=this.onDEDataChange.bind(this),ibiz.mc.command.change.on(this.onDEDataChange)}async onMounted(){var t;await super.onMounted(),null==(t=this.scheduler)||t.startTimerTrigger()}async onDestroyed(){ibiz.mc.command.change.off(this.onDEDataChange),await super.onDestroyed(),this.scheduler&&this.scheduler.destroy(),this.params.destroy()}updateContextParams(t){t.context&&this.context.reset({},t.context),t.params&&this.params.reset({},t.params);const{controlNavContexts:e,controlNavParams:i}=this.model;let a={};ct(e)&&(a=he(e,this.params,this.context)),Object.assign(this.context,a);let s={};ct(i)&&(s=he(i,this.params,this.context)),Object.assign(this.params,s)}getControlType(){return this.model.controlType}getData(){return null}async startLoading(){this.state.isLoading=!0,this.ctx.startLoading()}async endLoading(){this.state.isLoading=!1,this.ctx.endLoading()}onActivated(){this.state.activated=!0,this.awaitActiveCbs.size>0&&this.awaitActiveCbs.forEach((t=>{t()})),this.awaitActiveCbs.clear(),ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentActivation",{name:this.model.name,id:this.model.id}))}onDeactivated(){this.state.activated=!1,ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.control.componentPause",{name:this.model.name,id:this.model.id}))}handlerAbilityParams(t){const e=this.context.clone(),i={...this.params};let a=this.getData()||[];return(null==t?void 0:t.data)&&(a=Array.isArray(t.data)?t.data:[t.data]),(null==t?void 0:t.context)&&Object.assign(e,t.context),(null==t?void 0:t.viewParam)&&Object.assign(i,t.viewParam),{context:e,params:i,data:a}}setLayoutPanel(t){this.layoutPanel=t,this.layoutPanel.state.isMounted?this.mountCounter.attend(this.layoutPanel.model.name):this.layoutPanel.evt.on("onMounted",(()=>{this.mountCounter.attend(this.layoutPanel.model.name)}))}handleControlParams(){if(!this.model.controlParam)return;const{ctrlParams:t}=this.model.controlParam;let e={};ct(t)&&(e=he(t,this.params,this.context)),Object.assign(this.controlParams,e)}initControlScheduler(t=[]){0!==t.length&&(this.scheduler=ibiz.scheduler.createControlScheduler(t),this.scheduler.defaultParamsCb=()=>this.getEventArgs())}findCtrlMsgByTag(t){let e;const{ctrlMsg:i}=this.model;return i&&i.ctrlMsgItems&&(e=i.ctrlMsgItems.find((e=>e.name===t))),e}actionNotification(t,e){let i,a="";if(this.findCtrlMsgByTag("".concat(t,"_HIDDEN")))return;const o=this.findCtrlMsgByTag(t);if(o&&o.content){i=Z(o.timeout)?void 0:o.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ei.execScriptFn(t,"`".concat(o.content,"`"),{isAsync:!1,singleRowReturn:!0})}if(!a&&ibiz.i18n){const e="CONTROL.".concat(this.model.controlType,".").concat(t).toUpperCase();a=ibiz.i18n.t(e,""),a===e&&(a="")}if(!a&&(null==e?void 0:e.default)&&(a=e.default),!a&&(null==e?void 0:e.error)&&(a=a||e.error.message),a){if(null==e?void 0:e.error){if(e.error instanceof s&&500!==e.error.status)throw e.error;throw ibiz.log.error(e.error),new n(a,i)}ibiz.message.success(a,i,0===i)}}onDEDataChange(t){ibiz.log.debug("onDEDataChange",t)}emitDEDataChange(t,e){const i=e instanceof os?e.$origin:e,a={triggerKey:this.triggerKey};switch(t){case"create":ibiz.mc.command.create.send(i,a);break;case"update":ibiz.mc.command.update.send(i,a);break;case"remove":ibiz.mc.command.remove.send(i,a);break;default:throw new o(ibiz.i18n.t("runtime.controller.common.control.unsupportedType",{type:t}))}}doNextActive(t,e){if(Z(e.delay)&&(e.delay=300),!1===this.state.activated)this.awaitActiveCbs.set(e.key,t);else if(e.delay){const i=this.delayCbs.get(e.key);clearTimeout(i);const a=setTimeout((()=>{t(),clearTimeout(this.delayCbs.get(e.key))}),e.delay);this.delayCbs.set(e.key,a)}else t()}})),zr=t("MDControlController",class extends Fr{constructor(){super(...arguments),this.isSetSort=!1,this.fieldIdNameMap=new Map}get _evt(){return this.evt}initState(){super.initState(),this.state.items=[],this.state.selectedData=[],this.state.searchParams={},this.state.noSort=!1,this.state.sortQuery="",this.state.curPage=1,this.state.size=20,this.state.total=0,this.state.isLoaded=!1,this.state.singleSelect=!0,this.state.mdctrlActiveMode=0,this.state.groups=[],this.state.hideNoDataImage=!1}get batchToolbarController(){return this.view.getController("".concat(this.model.name,"_batchtoolbar"))}get quickToolbarController(){return this.view.getController("".concat(this.model.name,"_quicktoolbar"))}async onCreated(){var t;await super.onCreated(),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),null==(t=this.dataEntity.appDEFields)||t.forEach((t=>{this.fieldIdNameMap.set(t.id,t.name)})),this.isSetSort||this.setSort()}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}getSortModel(){return{minorSortAppDEFieldId:void 0,minorSortDir:void 0}}setSort(t,e){if(t&&e)this.state.sortQuery="".concat(t,",").concat(e);else if(t||e)this.state.sortQuery="";else{const{minorSortAppDEFieldId:t,minorSortDir:e}=this.getSortModel();if(this.view&&localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))this.state.sortQuery=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"));else if(t&&e){const i=this.fieldIdNameMap.get(t);this.state.sortQuery="".concat(i.toLowerCase(),",").concat(e.toLowerCase())}}this.view&&(this.state.sortQuery?localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".sort"),this.state.sortQuery):localStorage.removeItem("".concat(this.view.model.id,".").concat(this.model.name,".sort")))}async getFetchParams(t){const{curPage:e,size:i,sortQuery:a,noSort:s}=this.state,n={...this.params};return i&&(n.page=e-1,n.size=i),!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),t&&Object.assign(n,t),n}async load(t={}){if(this.state.isSimple)return[];const e=!0===t.silent;e||await this.startLoading();try{const e=!0===t.isInitialLoad,i=!0===t.isLoadMore;e?this.state.curPage=1:i&&(this.state.curPage+=1);const{context:a}=this.handlerAbilityParams(t),s=await this.getFetchParams(null==t?void 0:t.viewParam),n=await this.service.fetch(a,s);"number"==typeof n.total&&(this.state.total=n.total),"number"==typeof n.totalPages&&(this.state.totalPages=n.totalPages),i?this.state.items.push(...n.data):this.state.items=n.data,await this.afterLoad(t,n.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{e||await this.endLoading()}return this.state.items.forEach(((t,e)=>{t.srfserialnum=e+1})),this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){return e}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{await Cn(a.map((async t=>{s=await this.handleItemRemove(t,e,i),this.afterRemove(t)}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(e){throw await this._evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this._evt.emit("onRemoveSuccess",void 0),a.forEach((t=>{this.emitDEDataChange("remove",t)}))}async handleItemRemove(t,e,i){let a=!1;const s=Ae(this.model.appDataEntityId);if(0!==t.srfuf){const n=e.clone();n[s]=t.srfkey,await this.service.remove(n,i),a=!0}return a}afterRemove(t){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));-1!==e&&this.state.items.splice(e,1)}getData(){return this.state.selectedData||[]}setActive(t){return this._evt.emit("onActive",{data:[t]})}setSelection(t){var e,i;const{selectedData:a}=this.state;b(a,t)||(this.state.selectedData=t,this._evt.emit("onSelectionChange",{data:t}));const s=null==t?void 0:t[0];null==(e=this.batchToolbarController)||e.calcButtonState(s,this.model.appDataEntityId),null==(i=this.quickToolbarController)||i.calcButtonState(s,this.model.appDataEntityId)}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.srfkey!==t.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}async onDbRowClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}async importData(){const{appDataEntityId:t,dedataImportId:e}=this.model;if(!t||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));await Cr({appDataEntityId:t,deDataImportId:e,context:this.context,params:this.params})}async exportData(t){}onDEDataChange(t){if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if(!t.data||t.data.srfdecodename!==this.dataEntity.codeName)return;let e=!1;const{srfkey:i}=t.data;switch(t.subtype){case"OBJECTCREATED":e=!0;break;case"OBJECTUPDATED":case"OBJECTREMOVED":-1!==this.state.items.findIndex((t=>t.srfkey===i))&&(e=!0)}e&&this.doNextActive((()=>this.load({isInitialLoad:!!ibiz.env.isMob})),{key:"refresh"})}}),Vr=t("CustomAppMenuController",class{constructor(t,e){this.model=t,this.menu=e,this.type="personal",this.ownerType="",this.ownerId="",this.context=e.context,this.params=e.params,this.init()}init(){var t;this.type="personal",this.ownerId=this.context.srfpersonid;const e=ibiz.hub.getApp(this.context.srfappid).getAppUtil("DYNAMENU","CUSTOM");e?this.util=new $s(e):this.config=new $a(this.model.appId,"menu","menu_".concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase()))}getResourceTag(){var t;const e="".concat(this.context.srfappid,"_menu_").concat(this.menu.view.name.toLowerCase(),"_").concat(null==(t=this.model.codeName)?void 0:t.toLowerCase());switch(this.type){case"personal":return"".concat(e,"_").concat(this.context.srfpersonid);case"data":return"".concat(e,"_").concat(this.ownerType,"_").concat(this.ownerId);default:return e}}async loadCustomModelData(){let t;if(t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t&&t.model){return JSON.parse(t.model)}return[]}async resetCustomModelData(){return this.saveCustomModelData([])}async saveCustomModelData(t,e={}){const i={model:JSON.stringify(t)};return this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},i):await this.config.save(i),t}}),kr=t("AppMenuController",class extends Fr{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.customController=null,this.saveConfigs=[],this.flattenAllItems(),t.enableCustomized&&(this.customController=new Vr(t,this))}initState(){super.initState(),this.state.menuItemsState={}}get routeDepth(){return this.view.modal.routeDepth}async onCreated(){var t;await super.onCreated(),this.app=await ibiz.hub.getApp(this.context.srfappid),await this.initAppMenuItemProviders(),null==(t=this.model.appMenuItems)||t.forEach((t=>{this.initMenuItemState(t)})),this.customController&&await this.loadCustomMenusModel()}async loadCustomMenusModel(){const t=await this.customController.loadCustomModelData();t&&0!==t.length?this.saveConfigs=t:this.saveConfigs=[]}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ta(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,s={}){const n=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));this.evt.emit("onClick",{eventArg:t,event:e});const r=this.itemProviders[t];if(r&&r.onClick)return r.onClick(n,e,this);if(!n.appFuncId)throw new i(n,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const c=this.context.clone();c.srfappid=n.appId||ibiz.env.appId,this.routeDepth&&a&&Object.assign(c,{toRouteDepth:this.routeDepth+1}),await ibiz.commands.execute(jo.TAG,n.appFuncId,c,this.params,s)}initMenuItemState(t){var e;const i={permitted:!0,visible:!0};if(t.hidden)i.visible=!1;else{let a=!0;t.accessKey&&(a=this.app.authority.calcByResCode(t.accessKey));let s=a;if(null==(e=t.appMenuItems)?void 0:e.length){const e=t.appMenuItems.map((t=>this.initMenuItemState(t).visible));s=s&&e.includes(!0)}i.permitted=a,i.visible=s}return this.state.menuItemsState[t.id]=i,i}flattenAllItems(){const t=[],e=i=>{i.forEach((i=>{t.push(i),i.appMenuItems&&i.appMenuItems.length>0&&e(i.appMenuItems)}))};e(this.model.appMenuItems),this.allAppMenuItems=t}getAllItems(){return this.allAppMenuItems}getCounter(t){const{counters:e}=this.ctx.view;return e[t]?e[t]:null}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{var i;e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),(null==(i=e.appMenuItems)?void 0:i.length)&&t(e.appMenuItems)}))};this.model.appMenuItems&&this.model.appMenuItems.length>0&&t(this.model.appMenuItems)}}),Ur=(t("AppMenuIconViewController",class extends kr{async onClickMenuItem(t,e){const a=D(this.model,t,{compareField:"id",childrenFields:["appMenuItems"]});if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.menu.noFindMenu",{id:t}));if(this.evt.emit("onClick",{eventArg:t,event:e}),!a.appFuncId)throw new i(a,ibiz.i18n.t("runtime.controller.control.menu.noConfigured"));const s=this.context.clone();1===this.routeDepth&&Object.assign(s,{toRouteDepth:1}),await ibiz.commands.execute(jo.TAG,a.appFuncId,s,this.params)}}),t("CalendarService",class extends cs{async search(t,e={}){const{sysCalendarItems:i}=this.model;if(!i)return[];const a=i.map((async i=>{const a=i.appDEDataSetId||"fetchdefault",s=t.clone(),n=it(e);return i.maxSize&&(n.size=i.maxSize),this.exec2(a,s,n,void 0,i.appDataEntityId)}));return(await Promise.all(a)).map(((t,e)=>this.setCalendarConfigData(t.data,e))).flat()}setCalendarConfigData(t,e){const{sysCalendarItems:i}=this.model;if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));const a=i[e];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.calendar.noFoundModel"));return t.map((t=>new nn(a,t)))}async exec2(t,e,i={},a={},s=this.model.appDataEntityId){return await this.app.deService.exec(s,t,e,i,a)}}));t("CalendarController",class extends zr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Ur(this.model),await this.service.init(this.context),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){return this.openData(t),this._evt.emit("onActive",{data:[t]})}async openData(t){var e,a;const s=this.context.clone();s[((null==(e=t.deData.srfdecodename)?void 0:e.toLowerCase())||Ae(this.model.appDataEntityId)).toLowerCase()]=t.deData.srfkey;const n=await(null==(a=this.viewScheduler)?void 0:a.triggerCustom("".concat(t.itemType.toLowerCase(),"_opendata"),{context:s,params:this.params,data:[t.deData],event:void 0,view:this.view,ctrl:this}));if(-1===n)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:t.itemType.toLowerCase()}));return{cancel:!n||n.ok}}calcShowMode(t){this.state.hideNoDataImage=!1;const e=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===e&&0===t.length&&(this.state.hideNoDataImage=!0),"MIXIN"===e&&0===t.length&&(this.state.hideNoDataImage=!0)}async load(t={}){const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);let s;await this.startLoading();try{s=await this.service.search(i,a)}finally{await this.endLoading()}return await this.afterLoad(t,s),this.calcShowMode(s),this.state.isLoaded=!0,this.state.items=s,this.sortItems(),await this.evt.emit("onLoadSuccess",{isInitialLoad:e}),s}sortItems(){"TIMELINE"===this.model.calendarStyle&&this.state.items.sort(((t,e)=>{const i=t.beginTime,a=e.beginTime;let s=0;return Ct(i).isAfter(a)?s=-1:Ct(i).isBefore(a)&&(s=1),s}))}getCurSelectDate(t){const{selectedDate:e}=this.state,{srfstartdate:i,srfenddate:a}=t;if(!i||!a){const t=new Date(e.getFullYear(),e.getMonth(),1),i=new Date(e.getFullYear(),e.getMonth()+1,1);return{srfstartdate:Ct(t).format("YYYY-MM-DD HH:mm:ss"),srfenddate:Ct(i).format("YYYY-MM-DD HH:mm:ss")}}return{srfstartdate:i,srfenddate:a}}async getFetchParams(t={}){const{curPage:e,size:i,sortQuery:a,noSort:s}=this.state,n={...this.params};if(!s&&a&&(n.sort=a),await this._evt.emit("onBeforeLoad",void 0),Object.assign(n,{...this.state.searchParams}),i&&(n.page=e-1,n.size=i),t&&Object.assign(n,t),"TIMELINE"!==this.model.calendarStyle){const t=this.getCurSelectDate(n);Object.assign(n,t)}return n}async onRowClick(t){const{selectedData:e}=this.state,i=e.filter((e=>e.deData.srfkey!==t.deData.srfkey));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i),1===this.state.mdctrlActiveMode&&await this.setActive(t)}setSelectDate(t){this.state.selectedDate=t}});Ct.extend(xt),Ct.extend(Lt),Ct.extend(Rt),Ct.extend(_t),Ct.extend(zt);var Br="$default_group",Wr=class{constructor(t,e){this.model=t,this.chartGenerator=e,this.chartDataArr=[],this.staticOptions={},this.autoCompleteCategory=!0,this.model=t,this.chartGenerator=e;const{chartSeriesEncode:a,caption:s,id:n,userParam:o}=t;if(!t.catalogField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingClassification"));if(!t.valueField)throw new i(t,ibiz.i18n.t("runtime.controller.control.chart.missingValue"));this.catalogField=e.getFieldKey(t.catalogField),this.valueField=e.getFieldKey(t.valueField),this.groupField=t.seriesField?e.getFieldKey(t.seriesField):void 0;const{chartXAxisId:r,chartYAxisId:c}=a||{};this.xAxisIndex=R(r),this.yAxisIndex=R(c),this.seriesName=s||n,this.staticOptions=this.calcStaticOptions(),o&&(this.seriesUserParam=$r(o))}calcStaticOptions(){return{type:this.model.seriesType,name:this.seriesName,emphasis:{label:{fontSize:20,show:!0}},label:{position:"top",show:!0}}}translateVal(t,e,i=!1){if(Z(e))return;if(Z(t))return e;const a=this.chartGenerator.codeListMap.get(t);if(null==a?void 0:a.length){const t=a.find((t=>t.value===e));return t?t.text:"未定义"}return i?void 0:e}prepareChartData(t,e,i,a){var s;this.groupField&&(e["".concat(this.groupField,"_value")]=e[this.groupField],Object.assign(e,{[this.groupField]:a})),this.catalogField&&(e["".concat(this.catalogField,"_value")]=e[this.catalogField],Object.assign(e,{[this.catalogField]:i}));const n=new dn(e,this.model,i,a);t[a].get(i).chartData=n,null==(s=this.chartDataArr)||s.push(n)}calcGroupData(t){this.groupData={},this.chartDataArr=[];const e=this.groupData,{seriesCodeListId:i,catalogCodeListId:a}=this.model;return t.forEach((t=>{let s=Br;if(this.groupField){const e=this.translateVal(i,t[this.groupField]);if(Z(e))return;s=e}if(!e[s]&&(e[s]=new Map,a&&this.autoCompleteCategory)){this.chartGenerator.codeListMap.get(a).forEach((t=>{e[s].set(t.text,{value:0}),this.prepareChartData(e,{[this.valueField]:0,[this.catalogField]:t.value},t.text,s)}))}const n=this.translateVal(a,t[this.catalogField],!0);n&&(e[s].get(n)||e[s].set(n,{value:0}),e[s].get(n).value=M(e[s].get(n).value,t[this.valueField]||0),e[s].get(n).chartData?this.prepareChartData(e,{...t,[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s))})),e}calcGroupSeries(t){return Object.keys(t).map((e=>{const i=t[e],a=this.calcSeriesData(i);let s={...this.staticOptions,data:a};return e!==Br&&(s.name=e),this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}))}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push([i,t.value,t.chartData])})),e}calcByData(t){const e=this.dataPreprocess(t),i=this.calcGroupData(e);return this.addTimeData(i),this.calcGroupSeries(i)}getChartDataByParams(t){var e,i,a;return this.groupData&&1===Object.keys(this.groupData).length?null==(e=this.groupData[Br].get(t.name))?void 0:e.chartData:null==(a=null==(i=this.groupData)?void 0:i[t.seriesName].get(t.name))?void 0:a.chartData}dataPreprocess(t){const e=[];t.forEach((t=>{e.push(it(t))}));const{groupMode:i}=this.model;return i&&e.forEach((t=>{let e="";if("DAY"===i||"YEAR"===i||"MONTH"===i){if("DAY"===i?e="YYYY-MM-DD":"YEAR"===i?e="YYYY":"MONTH"===i&&(e="YYYY-MM"),t[this.catalogField]){const i=Ct(t[this.catalogField]).format(e);t[this.catalogField]=i}}else if("QUARTER"===i){if(t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).quarter());t[this.catalogField]=e}}else if("YEARWEEK"===i&&t[this.catalogField]){const e="".concat(Ct(t[this.catalogField]).format("YYYY"),"-").concat(Ct(t[this.catalogField]).week());t[this.catalogField]=e}})),e}sortTimeData(t){const{groupMode:e}=this.model;Object.keys(t).forEach((i=>{const a=t[i];let s=[];"DAY"===e||"YEAR"===e||"MONTH"===e?s=Array.from(a.keys()).sort(((t,e)=>Ct(t).diff(Ct(e)))):"QUARTER"!==e&&"YEARWEEK"!==e||(s=Array.from(a.keys()).sort(((t,e)=>{const[i,a]=t.split("-"),[s,n]=e.split("-");return i!==s?parseInt(i,10)-parseInt(s,10):parseInt(a,10)-parseInt(n,10)})));const n=new Map;s.forEach((t=>{n.set(t,a.get(t))})),t[i]=n}))}addTimeData(t){const{groupMode:e}=this.model;if(!e||"CODELIST"===e)return;const i=[];Object.keys(t).forEach((e=>{t[e].forEach(((t,e)=>{i.push(Ct(e))}))}));const a=Ct.max(i),s=Ct.min(i);if("DAY"===e){let e=s;const i=a;for(;null==e?void 0:e.isSameOrBefore(i,"day");){const i=e.format("YYYY-MM-DD");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"day")}}else if("YEAR"===e){let e=s.year();const i=a.year();for(;e<=i;){const i=e.toString();Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e+=1}}else if("MONTH"===e){let e=s.clone().startOf("month");const i=a.clone().startOf("month");for(;e.isSameOrBefore(i);){const i=e.format("YYYY-MM");Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})})),e=e.add(1,"month")}}else if("QUARTER"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++)for(let i=1;i<=4;i++){const a="".concat(e,"-").concat(i);Object.keys(t).forEach((e=>{t[e].get(a)||t[e].set(a,{value:0})}))}}else if("YEARWEEK"===e){const e=[];Object.keys(t).forEach((i=>{t[i].forEach(((t,i)=>{e.push(i)}))}));const i=e.reduce(((t,e)=>e<t?e:t),e[0]),a=e.reduce(((t,e)=>e>t?e:t),e[0]),[s]=i.split("-"),[n]=a.split("-");for(let e=parseInt(s,10);e<=parseInt(n,10);e++){const i=Ct("".concat(e,"-12-31")).isoWeek();for(let a=1;a<=i;a++){const i="".concat(e,"-").concat(a);Object.keys(t).forEach((e=>{t[e].get(i)||t[e].set(i,{value:0})}))}}}this.sortTimeData(t)}},Gr=class extends Wr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex;const{stack:e,step:a}=this.model;return a&&(t.step="middle"),t}},jr=class extends Wr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,this.model,t}},Kr=class extends Wr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outer",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Hr=class extends Wr{calcStaticOptions(){const t=super.calcStaticOptions();return t.label.formatter="{b}: {d}%",t.label.position="outside",t}calcSeriesData(t){const e=[];return t.forEach(((t,i)=>{e.push({name:i,value:[t.value,t.chartData]})})),e}},Xr=class extends Wr{calcStaticOptions(){if(void 0===this.xAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredX"));if(void 0===this.yAxisIndex)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.chart.noConfiguredY"));const t=super.calcStaticOptions();return t.xAxisIndex=this.xAxisIndex,t.yAxisIndex=this.yAxisIndex,t}},qr=class{constructor(t){this.indicator={},this.index=t}get indicatorKeys(){return this._indicatorKeys&&this._indicatorKeys.length===Object.keys(this.indicator).length||(this._indicatorKeys=Object.keys(this.indicator).sort()),this._indicatorKeys}updateIndicator(t,e){const i=this.indicator[t];(!i||i.max<e)&&(this.indicator[t]={max:e})}toOptions(){const t=Math.max(...Object.values(this.indicator).map((t=>t.max)));return{indicator:this.indicatorKeys.map((e=>({name:e,max:t})))}}},Yr=class extends Wr{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new qr(this.chartGenerator.radarMap.size));const i=this.chartGenerator.radarMap.get(this.catalogField);Object.values(e).forEach((t=>{t.forEach(((t,e)=>{i.updateIndicator(e,t.value)}))}))}calcByData(t){const e=this.groupData,i=this.chartGenerator.radarMap.get(this.catalogField),a=Object.keys(e).map((t=>{const a=e[t],s=i.indicatorKeys.map((t=>a.has(t)?a.get(t).value:0));return{name:t===Br?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:a};return this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}},Qr=t=>{const e=/function\s*\(\s*|\s*function\s*\(\s*/,i={};return Object.keys(t).forEach((a=>{if(It(t[a])&&e.test(t[a])){const e="return ".concat(t[a]);i[a]=new Function(e)()}else bt(t[a])?i[a]=Qr(t[a]):i[a]=t[a]})),i};function $r(t){const e={};return t&&Object.keys(t).forEach((i=>{const a=i.indexOf(".");if(-1===a)return;const s=i.slice(a+1);if(s)try{e[s]=JSON.parse(t[i])}catch(a){e[s]=t[i]}})),Qr(e)}var Jr=class{constructor(t){this.model=t,this.staticOptions={tooltip:{show:!0}},this.options={},this.seriesGenerators=[],this.radarMap=new Map,this.codeListMap=new Map,this.seriesGeneratorIndexMap=new Map;const{dechartTitle:e,dechartLegend:i,chartXAxises:a,chartYAxises:s,userParam:n}=t;e&&(this.staticOptions.title=this.calcTitleOption(e)),i&&(this.staticOptions.legend=this.calcLegendOption(i)),(null==a?void 0:a.length)&&(this.staticOptions.xAxis=this.calcXYAxisOption(a)),(null==s?void 0:s.length)&&(this.staticOptions.yAxis=this.calcXYAxisOption(s)),n&&(this.chartUserParam=$r(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new Gr(t,this);break;case"bar":e=new jr(t,this);break;case"scatter":e=new Xr(t,this);break;case"pie":e=new Hr(t,this);break;case"funnel":e=new Kr(t,this);break;case"radar":e=new Yr(t,this);break;default:ibiz.log.error(ibiz.i18n.t("runtime.controller.control.chart.noSupportSequence",{seriesType:t.seriesType}))}e&&this.seriesGenerators.push(e)}))}calcTitleOption(t){const{showTitle:e,title:i,subTitle:a,titlePos:s}=t,n={show:e,text:i,subtext:a,left:"center"},o=null==s?void 0:s.toLowerCase();return"left"===o||"right"===o?n.left=o:"bottom"!==o&&"top"!==o||(n.top=o),n}calcLegendOption(t){const{showLegend:e,legendPos:i}=t,a={};a.show=e;const s=null==i?void 0:i.toLowerCase();return"left"===s||"right"===s?(a.left=s,a.top="middle",a.orient="vertical"):"bottom"===s&&(a.top=s),a}calcXYAxisOption(t){const e=[];return t.forEach((t=>{const{position:i,dataShowMode:a,userParam:s}=t;let n={type:t.echartsType,name:t.caption,max:t.maxValue,min:t.minValue,position:i,axisLabel:{formatter:t=>("number"==typeof t&&(t=t.toString()),1===a?t.length>4?"".concat(t.slice(0,4).split("").join("\n"),"\n..."):t.split("").join("\n"):2===a&&t.length>4?"".concat(t.slice(0,4),"..."):t),rotate:3===a?45:0}};s&&(n=rt(n,$r(s))),e.push(n)})),e}async init(t,e){await this.loadCodeList(t,e),this.entity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.initSeriesGenerators()}getFieldKey(t){const e=this.entity.appDEFields.find((e=>e.name===t));return e?e.codeName.toLowerCase():t.toLowerCase()}async loadCodeList(t,e){var i;if(this.codeListMap.clear(),!(null==(i=this.model.dechartSerieses)?void 0:i.length))return;const a=ibiz.hub.getApp(t.srfappid),s=async i=>{if(!i||this.codeListMap.has(i))return;const s=await a.codeList.get(i,t,e);this.codeListMap.set(i,s)};await Promise.all(this.model.dechartSerieses.map((async t=>{const{seriesCodeListId:e,catalogCodeListId:i}=t;await s(e),await s(i)})))}calcOptionsByData(t){this.radarMap.clear(),this.options={series:[],radar:[]},this.seriesGenerators.forEach((e=>{"radar"===e.model.seriesType&&e.calcRadarCoordSystem(t)})),this.radarMap.size&&(this.options.radar=[...this.radarMap.values()].map((t=>t.toOptions())));const e=[];return this.seriesGenerators.forEach((i=>{const a=e.length,s=i.calcByData(t);s instanceof Array?e.push(...s):e.push(s);const n=e.length-1;for(let t=a;t<=n;t++)this.seriesGeneratorIndexMap.set(t,i)})),this.options.series=e,1===this.seriesGenerators.length&&this.seriesGenerators[0].groupData&&1===Object.keys(this.seriesGenerators[0].groupData).length&&e[0].type&&["bar","line","scatter"].includes(e[0].type)&&this.staticOptions.legend&&(this.staticOptions.legend.show=!1),this.options=rt(this.staticOptions,this.options),this.chartUserParam&&(this.options=rt(this.options,this.chartUserParam)),this.options}getChartDataByParams(t){const e=this.seriesGeneratorIndexMap.get(t.seriesIndex);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noFindSequence",{seriesIndex:t.seriesIndex}));return e.getChartDataByParams(t)}},Zr=t("ChartService",class extends cs{}),tc=(t("ChartController",class extends zr{initState(){super.initState(),this.state.size=1e3,this.state.showGrid=!1,this.state.gridHeaders=[],this.state.gridData=[],this.state.gridPosition="bottom"}async onCreated(){await super.onCreated(),this.service=new Zr(this.model),await this.service.init(this.context),this.generator=new Jr(this.model),await this.generator.init(this.context,this.params),this.parseGridParam(),this.resizeChart=this.resizeChart.bind(this),window.addEventListener("resize",this.resizeChart)}async afterLoad(t,e){const i=await super.afterLoad(t,e);return e.forEach((t=>{Object.assign(t,{srfcount:1})})),this.calcOptions(),i}parseGridParam(){this.model.dechartDataGrid&&(this.model.dechartDataGrid.dataGridPos?this.state.gridPosition=this.model.dechartDataGrid.dataGridPos.toLocaleLowerCase():this.state.gridPosition="bottom",!0===this.model.dechartDataGrid.showDataGrid&&(this.state.showGrid=!0))}computeTotal(t){let e=0;return this.state.items.forEach((i=>{const a=Number(i[t]);Number.isNaN(a)||(e+=Number(a))})),e}handleSingleSerieGridData(){const t=this.generator.seriesGenerators[0],{catalogField:e,valueField:i,groupData:a}=t,s=t.chartGenerator.entity.appDEFields,n=s.find((t=>t.id===e)),o=s.find((t=>t.id===i)),r=[{id:e,name:null==n?void 0:n.logicName},{id:i,name:null==o?void 0:o.logicName},{id:"srfpercent",name:"百分比"}];this.state.gridHeaders=r;const c=[],d=this.computeTotal(i);if(a&&a.$default_group){const t=a.$default_group;for(const[a,s]of t){const t=Number.isNaN(Number(s.value))?0:Number(s.value);let n="";n=0===d||Number.isNaN(Number(s.value))?"0%":"".concat(Math.round(t/d*100),"%");const o={[e]:a,[i]:t,srfpercent:n};c.push(o)}}this.state.gridData=c}handleMultipleSerieGridData(){const t=[],e=[];this.generator.seriesGenerators.forEach((i=>{const{catalogField:a,valueField:s,groupData:n}=i,o=i.chartGenerator.entity.appDEFields;if(t.findIndex((t=>t.id===a))<0){const e=o.find((t=>t.id===a.toLowerCase()));t.push({id:a,name:null==e?void 0:e.logicName})}const r=o.find((t=>t.id===s.toLowerCase()));if(t.push({id:s,name:null==r?void 0:r.logicName}),n&&n.$default_group){const t=n.$default_group;for(const[i,n]of t){const t=Number.isNaN(Number(n.value))?0:Number(n.value),o=e.findIndex((t=>t[a]===i));if(o<0){const n={[a]:i,[s]:t};e.push(n)}else Object.assign(e[o],{[s]:t})}}})),this.state.gridHeaders=t,this.state.gridData=e}computeGridData(){this.generator&&this.generator.seriesGenerators&&(1===this.generator.seriesGenerators.length?this.handleSingleSerieGridData():this.handleMultipleSerieGridData())}initChart(t){this.chart=t,this.chart.on("click",(t=>{const e=this.generator.getChartDataByParams(t);e&&this.setActive(e)}))}calcOptions(t=this.state.items){this.options=this.generator.calcOptionsByData(t),this.state.showGrid&&this.computeGridData(),this.updateChart()}updateChart(){if(!this.chart)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noInitialised"));if(!this.options)throw new o(ibiz.i18n.t("runtime.controller.control.chart.noCalculated"));this.chart.setOption(this.options,{notMerge:!0}),this.resizeChart()}resizeChart(){this.chart&&this.chart.resize()}async onDestroyed(){var t;window.removeEventListener("resize",this.resizeChart),await super.onDestroyed(),null==(t=this.chart)||t.dispose()}}),t("CaptionBarController",class extends Fr{initState(){super.initState(),this.state.caption=this.view.model.caption}async onCreated(){await super.onCreated(),this.view.evt.on("onViewInfoChange",(({caption:t,dataInfo:e})=>{this.state.caption="".concat(this.view.model.caption).concat(e?"-".concat(e):""),this.setBrowserTabTitle()}))}setBrowserTabTitle(){"ROUTE"!==this.view.modal.mode&&"ROUTE_MODAL"!==this.view.modal.mode||ibiz.util.setBrowserTitle(this.state.caption)}}),class{constructor(t,e){this.deLogicParams=t,this.parameters=e,this.session={},this.params={},this.result=null,this.isEndNode=!1,this.defaultParamName="Default"}get view(){return this.parameters.view}get context(){return Object.prototype.hasOwnProperty.call(this.params,"context")?this.params.context:this.parameters.context}get data(){return this.parameters.data}get viewParam(){return Object.prototype.hasOwnProperty.call(this.params,"viewParam")?this.params.viewParam:this.parameters.params}resetParam(t){var e;null==(e=this.deLogicParams.get(t))||e.calc(this)}renewParam(t){var e;null==(e=this.deLogicParams.get(t))||e.renew(this)}setLastReturn(t){this.lastReturn=t}initLastReturnParam(t){Object.defineProperty(this.params,t,{enumerable:!0,configurable:!0,get:()=>this.lastReturn})}isEntityParam(t){const e=this.deLogicParams.get(t);return!(!e||!e.model.entityParam)}}),ec=class{};function ic(t,e){const{srcDEUILogicParamId:i,srcFieldName:s,srcValue:n}=e,o=e.srcValueType||"SRCDLPARAM",r=s;let c;switch(o){case"SRCDLPARAM":c=t.params[i];break;case"NULLVALUE":return null;case"NONEVALUE":return;case"SRCVALUE":return ibiz.util.rawValue.format(n);case"WEBCONTEXT":case"VIEWPARAM":c=t.parameters.params;break;case"APPLICATION":case"SESSION":case"APPDATA":case"DATACONTEXT":c=t.parameters.context;break;case"ENVPARAM":c=it(ibiz.env);break;default:throw new a(e,ibiz.i18n.t("runtime.deLogic.deLogicNode.sourceValueType",{srcValueType:o}))}if(c&&r)try{c=Array.isArray(c)?c[Number(r)]:ei.execScriptFn({srcValue:c},"srcValue.".concat(r),{singleRowReturn:!0,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.deLogic.deLogicNode.fetchingAttribute",{srcField:r}),c),t}return c}var ac=class extends ec{constructor(t){super(),this.model=t,this.srcParam=t.srcLogicParamId,this.dstParam=t.dstLogicParamId}get dstField(){return this.model.dstFieldName}get op(){return this.model.condOP}get type(){return this.model.paramType}get value(){return this.model.paramValue}test(t,e,s){const n=ic(t,{srcDEUILogicParamId:this.dstParam,srcFieldName:this.dstField});let o,r;switch(this.type){case"ENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.currentConditionValue"));const t=null!=s[this.value]?s[this.value]:e[this.value];r=t,o=qe(n,this.op,t);break}case"SRCENTITYFIELD":{if(!this.value)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.sourceDataObjectAttribute"));const e=ic(t,{srcDEUILogicParamId:this.srcParam,srcFieldName:this.value});r=e,o=qe(n,this.op,e);break}case"CURTIME":throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.currentTime"));default:r=this.value,o=qe(n,this.op,this.value)}return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditionalTypeName",{name:this.model.name,type:this.type,dstField:this.dstField}),n,ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonCondition",{op:this.op}),ibiz.i18n.t("runtime.deLogic.deLogicLink.comparisonValue"),r,ibiz.i18n.t("runtime.deLogic.deLogicLink.compareResults"),o),o}},sc=class t extends ec{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new ac(e):new t(e)))}get op(){return this.model.groupOP}get notMode(){return!0===this.model.notMode}test(t,e,a){let s="OR"!==this.op;if(0===this.conds.length)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.interfaceConnectionConditional"));for(let i=0;i<this.conds.length;i++){const n=this.conds[i].test(t,e,a);if("AND"===this.op&&!1===n){s=!1;break}if("OR"===this.op&&!0===n){s=!0;break}}const n=this.notMode?!s:s;return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.connectionConditionGroup",{name:this.model.name,id:this.model.id}),n),n}},nc=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const{linkMode:e,deuilogicLinkGroupCond:i}=this.model;0===(e||0)&&i&&(this.groupCond=new sc(i))}async exec(t){const{linkMode:e}=this.model,{context:i,data:s}=t;switch(e||0){case 0:return!this.groupCond||this.groupCond.test(t,i,s&&s.length>0?s[0]:{});case 1:return!0;case 2:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousTermination"));case 3:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.asynchronousRejection"));case 9:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.exceptionHandling"));default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.logicalLinkTypes",{linkMode:e}))}}},oc=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new nc(t)))}},rc=class extends oc{async exec(t){const{dstAppDataEntityId:e,dstAppDEActionId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedEntity"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.unspecifiedBehavior"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(e,a,t.context,o,t.viewParam);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityActions",{id:this.model.id,dstAppDataEntityId:e,dstAppDEActionId:a,retDEUILogicParamId:n}),t.params[n])}},cc=class extends oc{async exec(t){const{dstAppDEUIActionId:e,dstDEUILogicParamId:a,dstAppDataEntityId:s}=this.model,{data:n,parameters:o}=t;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceBehavior"));let r=[n];if(a){const e=t.params[a];r=e instanceof Array?e:[e]}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEntityInterfaceAction",{id:this.model.id,dstAppDEUIActionId:e,dstAppDataEntityId:s,dstDEUILogicParamId:a})),await Lc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},dc=class extends oc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},lc=class extends oc{async exec(t){t.isEndNode=!0;const{returnType:e,rawValue:i,returnParamId:s}=this.model;if(e){switch(e){case"NONEVALUE":t.result=void 0;break;case"NULLVALUE":t.result=null;break;case"SRCVALUE":t.result=ibiz.util.rawValue.format(i);break;case"LOGICPARAM":t.result=t.params[s];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.unsupportedEndNode",{returnType:e}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeEndNode",{id:this.model.id,returnType:e}),t.result)}}},hc=class extends oc{async exec(t){const e=this.model.deuilogicNodeParams;if(null==e?void 0:e.length)for(const i of e){let e;switch(i.dstDEUILogicParamId&&"DEBUG"===ibiz.env.logLevel&&(e=it(t.params[i.dstDEUILogicParamId])),i.paramAction){case"SETPARAMVALUE":await this.setParamValue(i,t);break;case"RESETPARAM":await this.resetParam(i,t);break;case"COPYPARAM":await this.copyParam(i,t);break;case"BINDPARAM":await this.bindParam(i,t);break;case"RENEWPARAM":await this.renewParam(i,t);break;case"APPENDPARAM":await this.appendParam(i,t);break;case"SORTPARAM":await this.sortParam(i,t);break;default:throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSupportedLogic",{paramAction:i.paramAction}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodePreparationParameter",{id:this.model.id,paramAction:i.paramAction,dstDEUILogicParamId:i.dstDEUILogicParamId}),e,ibiz.i18n.t("runtime.deLogic.deLogicNode.targetParameter"),t.params[i.dstDEUILogicParamId])}}setParamValue(t,e){const{dstFieldName:i,dstDEUILogicParamId:a}=t;if(!a)throw new o(ibiz.i18n.t("runtime.uiLogic.noTargetParameter"));let s=i;e.isEntityParam(a)&&(s=null==s?void 0:s.toLowerCase());const n=ic(e,t);if(s)try{ei.execScriptFn({srcVal:n,dstParam:e.params[a]},"dstParam.".concat(i," = srcVal"),{singleRowReturn:!1,isAsync:!1})}catch(t){throw ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.targetParameter",{dstFieldName:i}),e.params[a]),t}else e.params[a]=n}copyParam(t,e){const{dstDEUILogicParamId:i}=t,a=ic(e,t);e.params[i]=it(a)}bindParam(t,e){const i=ic(e,t);e.params[t.dstDEUILogicParamId]=i}resetParam(t,e){const{dstDEUILogicParamId:i}=t;e.resetParam(i)}renewParam(t,e){const{dstDEUILogicParamId:i}=t;e.renewParam(i)}appendParam(t,e){const{dstDEUILogicParamId:i,dstIndex:a,srcIndex:s,srcSize:n}=t,o=ic(e,t),r=a||0,c=s||0,d=n||o.length;e.params[i].splice(r,0,...o.slice(c,d))}sortParam(t,e){const{dstDEUILogicParamId:i,dstFieldName:a,dstSortDir:s}=t,n=a;e.params[i].sort(((t,e)=>"ASC"===s?t[n]-e[n]:e[n]-t[n]))}},uc=class extends oc{async exec(t){t.isEndNode=!0;const{invokeMethod:e,invokeCtrlId:a,invokeParamId:s}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredInterfaceObject"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredOperatingParameters"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredCallMethod"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundOperationParameter",{invokeParamId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInterfaceObject",{invokeCtrlId:a}));if(!r[e]||!$(r[e]))throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundInvokeMethod",{invokeMethod:e}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetInvocation",{id:this.model.id,invokeCtrlId:a,invokeMethod:e}),n),await r[e](n)}},pc=class extends oc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=ic(t,this.model);t.params[e]=s,t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.bindingParameters",{id:this.model.id,dstDEUILogicParamId:e}),s)}},mc=class extends oc{constructor(){super(...arguments),this.typeMap={INFO:"info",QUESTION:"success",WARNING:"warning",ERROR:"error"}}async exec(t){const{msgBoxType:e,buttonsType:s,msgBoxParamId:n}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingMessageTypeConfiguration"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingButtonTypeConfiguration"));let{title:o,message:r}=this.model;if(n){const e=t.params[n];e.title&&(o=e.title),e.message&&(r=e.message)}const c=this.typeMap[e],d={type:c,title:o||ibiz.i18n.t("runtime.uiLogic.message"),desc:r};let l=[];switch(s){case"YESNO":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.yes"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.no"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["yes","no"];break;case"OK":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("runtime.uiLogic.determine"),d.cancelButtonText=ibiz.i18n.t("runtime.uiLogic.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("runtime.uiLogic.noSupportItem",{name:s}))}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeMessagePopup",{id:this.model.id,type:c,message:r}));const h=await ibiz.modal.confirm(d);t.setLastReturn(l[h?0:1])}},gc=class extends oc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await oa(this.model);e&&await e.exec(this.model,t)}},fc=class extends oc{async exec(t){const{dstDEUILogicParamId:e,name:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));const s=t.params[e];ibiz.log.info(ibiz.i18n.t("runtime.uiLogic.logicalNodeOperation",{name:a}),s)}},yc=class extends oc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.resetParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeResetParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},wc=class extends oc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const s=ic(t,this.model);t.params[e]=it(s),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.copyParameter",{id:this.model.id,dstDEUILogicParamId:e}),s)}},Ec=class extends oc{async exec(t){const{dstDEUILogicParamId:e,srcDEUILogicParamId:a,dstIndex:s,srcIndex:n,srcSize:o}=this.model;if(!e||!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingTargetParameter"));const r=ic(t,this.model),c=s||0,d=n||0,l=o||r.length;t.params[e].splice(c,0,...r.slice(d,l)),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.appendedArray",{id:this.model.id}),t.params,ibiz.i18n.t("runtime.deLogic.deLogicNode.addedValue"),r.slice(d,l))}},vc=class extends oc{async exec(t){const{dstDEUILogicParamId:e,dstSortDir:a,dstFieldName:s}=this.model;if(!e||!s)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingParameterProperty"));const n=s,o=t.params[e];o.sort(((t,e)=>"ASC"===a?t[n]-e[n]:e[n]-t[n])),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeSortedArrayParameters",{id:this.model.id,dstFieldName:s,dstSortDir:a,dstDEUILogicParamId:e}),o)}},Ic=class extends oc{async exec(t){const{dstDEUILogicParamId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.missingConfiguration"));t.renewParam(e),t.setLastReturn(t.params[e]),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeRebuildParameter",{id:this.model.id,dstDEUILogicParamId:e}))}},bc=class extends oc{async exec(t){const{dstAppDEDataSetId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.missingfilter"));const o=t.params[s],r=ibiz.hub.getApp(t.context.srfappid),c=await r.deService.exec(a,e,t.context,o);c.ok&&(t.params[n]=c.data,t.setLastReturn(t.params[s])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDataSet",{id:this.model.id,dstAppDataEntityId:a,dstAppDEDataSetId:e,retDEUILogicParamId:n}),t.params[n])}},Dc=class extends oc{async exec(t){const{errorInfo:e}=this.model;throw ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeThrowingExceptions",{id:this.model.id,errorInfo:e})),new o(e)}},Cc=class extends oc{async exec(t){t.isEndNode=!0;const{eventName:e,eventParamId:a,fireCtrlId:s}=this.model;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredTriggerObject"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEvent"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noConfiguredEventParameters"));const n=t.params[s];if(!n)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundTriggerObject",{fireCtrlId:s}));const r=t.params[a];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.noFoundEventParameterObject",{eventParamId:a}));ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeViewWidgetEventTriggerLogic",{id:this.model.id,fireCtrlId:s,eventName:e}),r),await n.evt.emit(e,r)}},Ac=class extends oc{async exec(t){const{dstAppDELogicId:e,dstAppDataEntityId:a,dstDEUILogicParamId:s,retDEUILogicParamId:n}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityConfigured"));if(!e)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noEntityLogicConfigured"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.uiLogic.noIncomingLogic"));const r=t.params[s];if(!r)throw new o(ibiz.i18n.t("runtime.uiLogic.passedParameter",{dstDEUILogicParamId:s}));const c=await ks(e,a,t.context,r,t.params);n&&(t.params[n]=c,t.setLastReturn(t.params[n])),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeExecutingEntityLogic",{id:this.model.id,dstAppDELogicId:e,dstAppDataEntityId:a,retDEUILogicParamId:n}),c)}},Pc=class extends oc{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeDirectCode",{id:this.model.id}),this.model.code),ei.execScriptFn({view:t.view,context:t.context,params:t.viewParam,uiLogic:t.params},this.model.code||"",{isAsync:!1})}},Tc=class{constructor(t){this.model=t}calc(t){const e=this.model.id,i=this.model,{parameters:a}=t,{context:s,params:n,data:o}=a,r=ibiz.hub.getApp(i.appId);if("layoutPanel"!==i.codeName){if(i.default)i.entityListParam?t.params[e]=o||[]:t.params[e]=o&&o.length>0?o[0]:{};else if(i.activeContainerParam)t.params[e]=a.ctrl||a.view;else if(i.activeCtrlParam)t.params[e]=a.ctrl;else if(i.ctrlParam){const s=a.view.getController(i.codeName.toLowerCase());s?t.params[e]=s:ibiz.log.error(ibiz.i18n.t("runtime.uiLogic.viewLogicInitializationParameter",{codeName:i.codeName}))}else if(i.activeViewParam)t.params[e]=a.view;else if(i.appGlobalParam){let a=ibiz.util.getGlobalParam();i.paramFieldName&&(a.hasOwnProperty(i.paramFieldName)||(a[i.paramFieldName]={}),a=a[i.paramFieldName]),t.params[e]=a}else if(i.applicationParam)t.params[e]=r;else if(i.entityListParam)t.params[e]=[];else if(i.entityPageParam)t.params[e]=[];else if(i.entityParam)t.params[e]={};else if(i.lastReturnParam)t.initLastReturnParam(e);else if(i.navContextParam)t.params[e]=s;else if(i.navViewParamParam)t.params[e]=ibiz.util.getRouterParams();else if(i.routeViewSessionParam){let s=a.view.getTopView().state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else if(i.simpleListParam)t.params[e]=[];else if(i.simpleParam)t.params[e]={};else if(i.viewNavDataParam)t.params[e]=n;else if(i.viewSessionParam){let s=a.view.state;i.paramFieldName&&(s.hasOwnProperty(i.paramFieldName)||(s[i.paramFieldName]={}),s=s[i.paramFieldName]),t.params[e]=s}else i.filterParam?t.params[e]={}:i.envParam?t.params[e]=ibiz.env:i.sessionParam&&(t.params[e]=t.session);ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.calculateInterfaceLogicParameters",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}else t.params[e]=a.view.layoutPanel.panelItems}renew(t){const e=this.model.id,i=this.model;if(i.entityListParam||i.simpleListParam||i.entityPageParam)t.params[e]=[];else{if(!i.simpleParam&&!i.entityParam)throw new a(i,ibiz.i18n.t("runtime.deLogic.deLogicNode.recreatingVariables"));t.params[e]={}}ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.restablishInterfaceLogic",{tag:e}),ibiz.i18n.t("runtime.deLogic.deLogicNode.value"),{...t.params[e]})}},Nc=class{constructor(t){var e;if(this.model=t,this.nodes=new Map,this.params=new Map,!(null==(e=t.deuilogicNodes)?void 0:e.length))throw new i(t,ibiz.i18n.t("runtime.uiLogic.noLogicalNodesConfigured"));t.deuilogicNodes.forEach((t=>{const{logicNodeType:e}=t;let i;switch(e){case"BEGIN":i=new dc(t);break;case"END":i=new lc(t);break;case"DEACTION":i=new rc(t);break;case"DEUIACTION":i=new cc(t);break;case"PREPAREJSPARAM":i=new hc(t);break;case"RESETPARAM":i=new yc(t);break;case"COPYPARAM":i=new wc(t);break;case"BINDPARAM":i=new pc(t);break;case"VIEWCTRLINVOKE":i=new uc(t);break;case"MSGBOX":i=new mc(t);break;case"DEBUGPARAM":i=new fc(t);break;case"APPENDPARAM":i=new Ec(t);break;case"SORTPARAM":i=new vc(t);break;case"RENEWPARAM":i=new Ic(t);break;case"DEDATASET":i=new bc(t);break;case"THROWEXCEPTION":i=new Dc(t);break;case"VIEWCTRLFIREEVENT":i=new Cc(t);break;case"DELOGIC":i=new Ac(t);break;case"PFPLUGIN":i=new gc(t);break;case"RAWJSCODE":i=new Pc(t);break;default:throw new a(t,ibiz.i18n.t("runtime.deLogic.deLogicNode.unsupportedLogical",{logicNodeType:e}))}this.nodes.set(t.id,i)})),t.deuilogicParams.forEach((t=>{this.params.set(t.id,new Tc(t))})),this.nodes.forEach((t=>{t.links.forEach((e=>{e.srcNode=t,this.nodes.has(e.model.dstDEUILogicNodeId)&&(e.dstNode=this.nodes.get(e.model.dstDEUILogicNodeId))}))}))}initLogicParams(t){this.params.forEach((e=>{e.model.default&&(t.defaultParamName=e.model.id),e.calc(t)}))}async exec(t){const e=new tc(this.params,t);this.initLogicParams(e);const{startDEUILogicNodeId:a}=this.model;if(!a||!this.nodes.has(a))throw new i(this.model,ibiz.i18n.t("runtime.deLogic.deLogicNode.noSetStartNode"));{const t=this.nodes.get(a);await this.deepExec(t,e)}return e.isEndNode?e.result:e.params[e.defaultParamName]?e.params[e.defaultParamName]:null}async deepExec(t,e){await t.exec(e);const{links:i}=t;for(let a=0;a<i.length;a++){const s=i[a];if(await s.exec(e)&&s.dstNode&&(await this.deepExec(s.dstNode,e),!0!==t.model.parallelOutput))break}}},xc=new Map;async function Sc(t,e,i){const a=ibiz.hub.getApp(i.context.srfappid),s=await a.getDEUILogic(t,e);if(!s)throw new o(ibiz.i18n.t("runtime.uiLogic.interfaceLogic",{appDataEntityId:e,deUILogicId:t}));xc.has(s)||xc.set(s,new Nc(s)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:s.name}));const n=xc.get(s),r=await n.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:s.name})),r}var Lc=t("UIActionUtil",class{static async exec(t,e,i){const a=await Se(t,i);if(!a)throw new o(ibiz.i18n.t("runtime.uiAction.noFoundBehaviorModel",{actionId:t}));if("SINGLEDATA"===a.actionTarget){if(!1===await e.view.call("Validate"))return{cancel:!0}}return(await sa(a)).exec(a,e)}static async execAndResolved(t,e,i){var a,s;const n=await this.exec(t,e,i);if(n.closeView)e.view.modal.ignoreDismissCheck=!0,e.view.closeView({ok:!0});else if(n.refresh)switch(n.refreshMode){case 1:e.view.callUIAction("Refresh");break;case 2:null==(a=e.view.parentView)||a.callUIAction("Refresh");break;case 3:null==(s=e.view.getTopView())||s.callUIAction("Refresh")}(await Se(t,i)).asyncAction&&!n.cancel&&this.handleAsyncAction(e.event)}static async handleAsyncAction(t){this.handleAsyncActionAnime(t)}static async handleAsyncActionAnime(t){t&&t.target&&await ibiz.util.anime.moveAndResize(t.target,"#".concat("preset-message"))}}),Mc=t("UIActionProviderBase",class{async exec(t,e){const a={refresh:t.reloadData,refreshMode:t.refreshMode,closeView:t.closeEditView},{view:s}=e;t.closeEditView&&(s.state.isClosing=!0);const{appDEUILogicId:n,appDataEntityId:o,uilogicAttachMode:r}=t;if("REPLACE"===r){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return await Sc(n,o,e),a}if(!await this.isConfirm(t,e))return this.returnError(a,s);const c=await this.execAction(t,e);if(Object.assign(a,c),!0===a.cancel)return this.returnError(a,s);if("AFTER"===t.uilogicAttachMode){if(!n)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));await Sc(n,o,this.mergeArgsByResult(e,a))}const d=this.mergeArgsByResult(e,a);if(t.closeEditView)this.doNextAction(t,d,t.appId);else{const e=await this.doNextAction(t,d,t.appId);if(e&&(Object.assign(a,e),!0===e.cancel))return this.returnError(a,s)}return a}mergeArgsByResult(t,e){return{...t,context:e.nextContext||t.context,data:e.data||t.data,params:e.nextParams||t.params}}returnError(t,e){return e.state.isClosing=!1,Object.assign(t,{refresh:!1,closeView:!1})}async isConfirm(t,e){const i=this.calcMessage("confirm",t,e);return!t.enableConfirm||!i||ibiz.confirm.warning({title:ibiz.i18n.t("runtime.uiAction.operationConfirmation"),desc:i})}async doNextAction(t,e,i){const a=t.nextId;if(a)return Lc.exec(a,e,i)}async handleParams(t,e,i,a){let s=[];const n=Ae(t.appDataEntityId),o=(await ibiz.hub.getAppDataEntity(t.appDataEntityId,e.srfappid)).keyAppDEFieldId;switch(t.actionTarget){case"NONE":s=[];break;case"SINGLEDATA":s=[i[0]];break;case"MULTIDATA":s=i;break;case"MULTIKEY":s=n&&i.length>0?i.map((t=>({[o]:t.srfkey||t[o]}))):[{}];break;case"SINGLEKEY":{const t=i[0]||{};s=n?[{[o]:t.srfkey||t[o]}]:[{}]}}const r=e.clone(),c=[...t.navigateContexts||[]];if(n&&"NONE"!==t.actionTarget){const{valueItem:e,paramItem:i}=t,a=i||n,s=e||"srfkey";c.unshift({key:a,value:s,rawValue:!1})}const d=["MULTIKEY","MULTIDATA"].includes(t.actionTarget)&&i.length>0,l=he(c,d?me(c,i):i[0]||{},a,e);Object.assign(r,l);const h=t.navigateParams;return{resultContext:r,resultData:s,resultParams:he(h,d?me(h,i):i[0]||{},a,r)}}calcMessage(t,e,i){let a,s;const{confirmMsg:n,cmlanguageRes:o,successMsg:r,smlanguageRes:c}=e;switch(t){case"confirm":a=n,s=o;break;case"success":a=r,s=c}if(s){const t=ibiz.i18n.t(s.lanResTag,s.defaultContent||a);t!==s.lanResTag&&(a=t)}if(a){const{data:t}=i,e={...i};return 1===t.length?[e.data]=t:0===t.length&&delete e.data,ei.execScriptFn(e,"`".concat(a,"`"),{isAsync:!1,singleRowReturn:!0})}}handleViewOptionParams(t){if(t.modaloption)try{const e=JSON.parse(t.modaloption);return delete t.modaloption,{modalOption:e}}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.uiAction.viewParameterModalOption",{error:t}))}return{}}}),Rc=t("BackendUIActionProvider",class extends Mc{async execAction(t,e){const{context:a,params:s,data:n,event:o}=e,r={},c=t.appDataEntityId,d=t.appDEMethodId;if(!c||!d)throw new i(t,ibiz.i18n.t("runtime.uiAction.noEntityOrBehavior"));const{resultContext:l,resultParams:h,resultData:u}=await this.handleParams(t,a,n,s),p={...h},m=t.frontAppViewId;if(m){const t=this.handleViewOptionParams(h),e=await ibiz.commands.execute(Wo.TAG,m,l,h,{event:o,...t});if(!(null==e?void 0:e.ok))return r.cancel=!0,r;if((null==e?void 0:e.ok)&&e.data){0===u.length&&u.push({});const t=e.data.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}}));u.forEach((e=>{e.srfactionparam=t}))}}const g=ibiz.hub.getApp(null==a?void 0:a.srfappid),f=u.map((t=>{var e;return(null==(e=t.getOrigin)?void 0:e.call(t))||t||{}})).map((t=>Object.assign(t,p))),y=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),w=await g.deService.exec(c,d,l,y?f:f[0],p);if(w.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:pt(w.data)?w.data:[w.data],nextContext:l,nextParams:p}),r}}),Oc=t("SysUIActionProvider",class extends Mc{constructor(){super(...arguments),this.predefinedActionMap=new Map([["EDITVIEW_EXITACTION","Exit"],["EDITVIEW_SAVEANDEXITACTION","SaveAndExit"],["TREEVIEW_REFRESHPARENTACTION","RefreshParent"],["GRIDVIEW_EXPORTXMLACTION","ExportModel"],["GRIDVIEW_EXPORTACTION","ExportExcel"],["EDITVIEW_REMOVEANDEXITACTION","RemoveAndExit"],["GRIDVIEW_PRINTACTION","Print"],["EDITVIEW_NEXTRECORDACTION","NextRecord"],["GRIDVIEW_NEWROWACTION","NewRow"],["EDITVIEW_LASTRECORDACTION","LastRecord"],["EDITVIEW_PREVRECORDACTION","PrevRecord"],["GRIDVIEW_SEARCHBAR","ToggleFilter"],["EDITVIEW_SAVEANDSTARTWFACTION","SaveAndStart"],["EDITVIEW_NEWACTION","New"],["EDITVIEW_PRINTACTION","Print"],["EDITVIEW_COPYACTION","Copy"],["EDITVIEW_HELPACTION","Help"],["EDITVIEW_FIRSTRECORDACTION","FirstRecord"],["GRIDVIEW_REFRESHACTION","Refresh"],["EDITVIEW_SAVEANDNEWACTION","SaveAndNew"],["EDITVIEW_VIEWWFSTEPACTORACTION","ViewWFStep"],["EDITVIEW_SAVEACTION","Save"],["TREEVIEW_REFRESHALLACTION","RefreshAll"],["GRIDVIEW_IMPORTBAR","Import"],["GRIDVIEW_ROWEDITACTION","ToggleRowEdit"],["GRIDVIEW_NEWACTION","New"],["GRIDVIEW_EDITACTION","Edit"],["GRIDVIEW_HELPACTION","Help"],["EDITVIEW_REFRESHACTION","Refresh"],["GRIDVIEW_REMOVEACTION","Remove"],["GRIDVIEW_COPYACTION","Copy"],["GRIDVIEW_VIEWACTION","View"],["GRIDVIEW_SAVEROWACTION","SaveRow"],["APP_LOGIN","Login"],["APP_LOGOUT","logout"],["UTIL_RESET","Reset"],["UTIL_SEARCH","Search"]])}async execAction(t,e){const{view:i}=e,a=this.predefinedActionMap.get(t.predefinedType)||t.uiactionTag;if("Exit"===a)return{closeView:!0};return await i.callUIAction(a,e)||{}}}),_c=t("FrontUIActionProvider",class extends Mc{async execAction(t,e){const{context:s,params:n,data:o,event:r,noWaitRoute:c}=e;let d={};switch(t.frontProcessType){case"OPENHTMLPAGE":{const e=C.fill(t.htmlPageUrl,s,null==o?void 0:o[0]);window.open(e,"_blank");break}case"TOP":case"WIZARD":{const e=t.frontAppViewId;if(!e)throw new i(t,ibiz.i18n.t("runtime.uiAction.noConfiguredopenView"));const{resultContext:a,resultParams:l}=await this.handleParams(t,s,o,n),h=this.handleViewOptionParams(l),u=await ibiz.commands.execute(Wo.TAG,e,a,l,{event:r,noWaitRoute:c,...h});(null==u?void 0:u.ok)||(d.cancel=!0),(null==u?void 0:u.ok)&&u.data&&(d.data=u.data,d.nextContext=a,d.nextParams={...n,...l});break}case"PRINT":await this.executePrint(t,e);break;case"DATAIMP":d=await this.executeDataImport(t,e);break;case"DATAEXP":await this.executeDataExport(t,e);break;case"OTHER":d=await this.doOther(t,e);break;case"EDITFORM":d=await this.openEditForm(t,e);break;default:throw new a(t,ibiz.i18n.t("runtime.uiAction.frontProcessingModes",{frontProcessType:t.frontProcessType}))}return d}async doOther(t,e){const{scriptCode:a,uiactionTag:s}=t,{context:n,params:o,data:r,event:c,view:d}=e;if("ShortCut"===s){return await d.callUIAction(s,e)||{}}if(a){return ei.execScriptFn({context:n,params:o,data:r,el:null==c?void 0:c.target,view:d},a)||{}}throw new i(t,ibiz.i18n.t("runtime.uiAction.missingConfigurationScriptCode"))}async executePrint(t,e){var i;const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),n=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),r=null==(i=n.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!a||!a[n.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(n.deapicodeName2,"/printdata/").concat(a[n.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:r.codeName,...s}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(s&&s.srfcontenttype){const t=ibiz.util.file.getFileName(e),i=URL.createObjectURL(e.data),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}else{const t=window.URL.createObjectURL(e.data);window.open(t,"_blank")}}}async executeDataImport(t,e){const{resultContext:a,resultParams:s}=await this.handleParams(t,e.context,e.data,e.params),{appDataEntityId:n,appDEDataImportId:o,frontAppViewId:r}=t;if(!n||!o)throw new i(t,ibiz.i18n.t("runtime.controller.common.control.noImportModel"));return await Cr({appDataEntityId:n,deDataImportId:o,dataImportViewId:r,context:a,params:s}),{refresh:!0,refreshMode:1}}async executeDataExport(t,e){var i;const{resultParams:a}=await this.handleParams(t,e.context,e.data,e.params),s=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),n=null==(i=s.appDEDataExports)?void 0:i.find((e=>e.id===t.appDEDataExportId));if(!n)throw new o(ibiz.i18n.t("runtime.uiAction.noEntityExportsFound"));{const t="/".concat(s.deapicodeName2,"/exportdata/fetchdefault?srfexporttag=").concat(n.codeName),i={page:0,size:n.maxRowCount?n.maxRowCount:1e3,...e.params,...a},r=await ibiz.net.request(t,{method:"post",data:i});if(200!==r.status)throw new o(ibiz.i18n.t("runtime.uiAction.exportRequestFailed"));{let t="".concat(s.logicName,"表.xlsx");t=decodeURIComponent(t);const e=new Blob([r.data],{type:"application/vnd.ms-excel"}),i=document.createElement("a");i.download=t,i.style.display="none",i.href=URL.createObjectURL(e),document.body.appendChild(i),i.click(),URL.revokeObjectURL(i.href),document.body.removeChild(i)}}}async openEditForm(t,e){const i={},{context:a,params:s,data:n,event:r}=e;if(!r)throw new o(ibiz.i18n.t("runtime.uiAction.lackNativeEvent"));const{resultContext:c,resultParams:d}=await this.handleParams(t,a,n,s),l=this.handleViewOptionParams(d).modalOption||{},h=tt({autoClose:!0},l);let u=!1;const p=ibiz.overlay.createPopover("IBizControlShell",{context:c,params:d,modelData:t.deeditForm,onSaveSuccess:t=>{i.data=[t.args],p&&p.dismiss(),u=!0}},h);return p.present(r.target),await p.onWillDismiss(),u||(i.cancel=!0),i}}),Fc=t("WFWithdrawUIActionProvider",class extends Mc{async execAction(t,e){const{view:i}=e;let a=!1;return await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.uiAction.withdrawalConfirmed")})&&i&&(await i.call("WFWithdraw",e),a=!0),{refresh:!1,closeView:a}}}),zc=class extends Mc{async execAction(t,e){return await ibiz.confirm.info({title:ibiz.i18n.t("runtime.uiAction.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})&&await ibiz.hub.controller.logout(),{}}};function Vc(){const t=new _c;ia("FRONT",(()=>t));const e=new Rc;ia("BACKEND",(()=>e));const i=new Oc;ia("SYS",(()=>i));const a=new Fc;ia("DEUIACTION_WFWithdraw",(()=>a));const s=new zc;ia("SYS_Logout",(()=>s))}var kc=t("ToolbarController",class extends Fr{constructor(){super(...arguments),this.allToolbarItems=[],this.itemProviders={}}get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new rr,this.state.viewMode="EMBED",this.state.extraButtons={}}async doUIAction(t,e,i={}){if("DEUIACTION"===t.itemType){const a=t.uiactionId,s=await Se(a,t.appId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.toolbar.noFound",{actionId:a}));const n=["SYS","BACKEND","WFBACKEND"].includes(s.uiactionMode)&&!1!==s.showBusyIndicator;n&&this.state.buttonsState.setLoading(t.id);try{const s=await this.ctx.view.call("GetData")||[],n=this.getEventArgs();n.params=Object.assign(i,n.params),await Lc.execAndResolved(a,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async initToolbarItemProviders(){await Promise.all(this.allToolbarItems.map((async t=>{const e=await La(t);e&&(this.itemProviders[t.id]=e)})))}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(this.allToolbarItems.push(t),t.itemType){const e=t,i=new or(e.id,this.context.srfappid,e.uiactionId);this.state.buttonsState.addState(e.id,i)}if(t.controlLogics)for(let e=0;e<t.controlLogics.length;e++){const i=t.controlLogics[e],a=this.state.buttonsState[t.id];if(i.itemName===t.id&&"ITEMVISIBLE"===i.triggerType&&a){a.visible=!1;break}}}),{childrenFields:["detoolbarItems"]}),await this.initToolbarItemProviders(),this.state.manualCalcButtonState?await this.state.buttonsState.init():await this.calcButtonState(void 0,this.model.appDataEntityId)}async onItemClick(t,e,i){const a="extra"===t.buttonType;await this._evt.emit("onClick",{event:e,eventArg:t.id,buttonType:a?"extra":"deuiaction"}),a||await this.doUIAction(t,e,i)}async calcButtonState(t,e){let i=t;if(t&&t instanceof os&&(i=t.getOrigin()),await this.state.buttonsState.update(this.context,i,e),this.scheduler){const t={};i&&(t.data=[i]),r(this.model,(e=>{const i=this.state.buttonsState[e.id];if(i){if(i.visible){const a=this.scheduler.triggerItemVisible(e.id,t);void 0!==a&&(i.visible=a)}if(!i.disabled){const a=this.scheduler.triggerItemEnable(e.id,t);void 0!==a&&(i.disabled=!a)}}}),{childrenFields:["detoolbarItems"]})}}setExtraButtons(t,e){this.state.extraButtons[t]||(this.state.extraButtons[t]=[]),this.state.extraButtons[t].push(...e)}clearExtraButtons(t){void 0===t?this.state.extraButtons={}:this.state.extraButtons[t]=[]}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["detoolbarItems"]}),super.initControlScheduler(e)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"ITEMS"===e.itemType&&e.detoolbarItems&&t(e.detoolbarItems)}))};this.model.detoolbarItems&&this.model.detoolbarItems.length>0&&t(this.model.detoolbarItems)}}),Uc=t("ContextMenuController",class extends kc{}),Bc=(t("DashboardController",class extends Fr{constructor(){super(...arguments),this.providers={},this.portlets={}}initState(){super.initState()}async onCreated(){await super.onCreated(),await this.initPortlets(this.model.controls);const{appDataEntityId:t}=this.view.model;t&&this.view.evt.on("onDataChange",(t=>{const e=ur(t.data);e&&this.dataChangeNotify(e)}))}async initPortlets(t,e){if(!(null==t?void 0:t.length))return;const i=["CHART","APPMENU","TOOLBAR","LIST"];await Promise.all(t.map((async t=>{var a;if(t.controlType&&i.includes(t.controlType))return;const s=await ta(t);if(s){this.providers[t.id]=s;const i=await s.createController(t,this,e);this.portlets[t.id]=i,(null==(a=t.controls)?void 0:a.length)&&await this.initPortlets(t.controls,i)}})))}async initPortletsConfig(t={}){Object.keys(t).forEach((e=>{const i=this.portlets[e];i&&(i.config=t[e],i.state.title=i.config.srftitle,Object.assign(i.params,i.config))}))}async resetPortlets(){Object.keys(this.portlets).forEach((t=>{this.portlets[t].resetConfig()})),this.evt.emit("onResetPortlet",void 0)}async dataChangeNotify(t){await Cn(Object.values(this.portlets).map((async e=>e.dataChangeNotify(t))))}}),t("CustomDashboardController",class{constructor(t,e){this.model=t,this.dashboard=e,this.customModelData=[],this.layoutColNum=12,this.layoutRowH=80,this.portletConfig={},this.type="personal",this.ownerType="",this.ownerId="",this.multiMode=!1,this.context=e.context,this.params=e.params,this.init(e.controlParams)}init(t){var e,i;if(this.type="personal",this.ownerId=this.context.srfpersonid,t.type&&(this.type=t.type),t.owner_type&&(this.ownerType=t.owner_type),t.owner_id&&(this.ownerId=this.context[t.owner_id]),"true"===t.multimode&&(this.multiMode=!0,this.type="dynamic"),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new $s(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new $a(this.model.appId,"dynadashboard","dashboard_".concat((null==(e=this.model.appDataEntityId)?void 0:e.toLowerCase())||"app","_").concat(null==(i=this.model.codeName)?void 0:i.toLowerCase()))}getResourceTag(){var t,e;const i="".concat(this.context.srfappid,"_dashboard_").concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase());switch(this.type){case"personal":return"".concat(i,"_").concat(this.context.srfpersonid);case"data":return"".concat(i,"_").concat(this.ownerType,"_").concat(this.ownerId);case"dynamic":return"".concat(i,"_").concat(this.context.srfdynadashboardid);default:return i}}async loadCustomModelData(){let t;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t.model&&(this.customModelData=t.model),t.colNum&&(this.layoutColNum=t.colNum),t.rowH&&(this.layoutRowH=t.rowH),t.config&&(this.portletConfig=t.config),{model:this.customModelData,config:this.portletConfig}}async resetCustomModelData(){return this.portletConfig={},this.saveCustomModelData([])}async saveCustomModelData(t,e={}){let i;Object.assign(this.portletConfig,e);const a={model:t,colNum:this.layoutColNum,rowH:this.layoutRowH,config:this.portletConfig};return i=this.util?await this.util.save(this.getResourceTag(),this.context,{...this.params,type:this.type,ownerType:this.ownerType,ownerId:this.ownerId,modelId:this.model.id},a):await this.config.save(a),i&&(this.customModelData=t),{model:t,config:this.portletConfig}}}),t("PortletPartState",class{constructor(){this.visible=!0,this.keepAlive=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[]},this.actionGroupState=null}})),Wc=t("PortletPartController",class{constructor(t,e,i){this.config={},this.model=t,this.dashboard=e,this.parent=i,this.state=this.createState(),this.state.context=d.create({},this.dashboard.context),this.params=new I({},this.dashboard.params)}get context(){return this.state.context}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get contentController(){const{contentControlId:t}=this.model;if(t)return this.dashboard.getController(t)}async init(){await this.onInit()}async onInit(){this.onDataChange=this.onDataChange.bind(this);const{layoutPos:t,sysCss:e,title:i,titleLanguageRes:a}=this.model;if(t){const{width:t,height:e}=Ie(this.model);this.state.layout.width="".concat(t),this.state.layout.height="".concat(e)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),this.state.title=a?ibiz.i18n.t(a.lanResTag,i):i,this.config={srftitle:this.state.title},Object.assign(this.params,this.config),await this.initActionStates()}createState(){return new Bc}refresh(){}async setConfig(t){this.config=t,t.srftitle&&(this.state.title=t.srftitle),k(this.params,t),this.dashboard.evt.emit("onConfigChange",{name:this.model.id,config:this.config})}resetConfig(){const{title:t,titleLanguageRes:e}=this.model;this.params=new I({},this.dashboard.params),this.state.title=e?ibiz.i18n.t(e.lanResTag,t):t,this.config={srftitle:this.state.title},Object.assign(this.params,this.config)}onDataChange(t){let e=t.data[0];e&&e instanceof os&&(e=e.getOrigin()),e&&this.state.actionGroupState.update(this.context,e,this.dashboard.view.model.appDataEntityId)}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.dashboard.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.dashboard.context),this.state.actionGroupState=i;const{appDataEntityId:a}=this.dashboard.view.model;a&&this.dashboard.view.evt.on("onDataChange",this.onDataChange)}async onActionClick(t,e,i=[]){const a=t.uiactionId;await Lc.execAndResolved(a,{context:this.context,params:this.params,data:i,view:this.dashboard.view,ctrl:this,event:e},t.appId)}async dataChangeNotify(t){if(this.state.actionGroupState){const{appDataEntityId:e}=this.dashboard.view.model;this.state.actionGroupState.update(this.context,t,e)}this.calcDynaClass(t)}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}}async destroyed(){ibiz.log.debug("".concat(this.model.codeName," onDestroyed")),this.dashboard.view.evt.off("onDataChange",this.onDataChange)}}),Gc=(t("ContainerPortletController",class extends Wc{}),t("ViewPortletController",class extends Wc{get contentController(){const{portletAppView:t}=this.model;if(t&&t.codeName)return this.dashboard.getController(t.codeName)}refresh(){this.contentController&&this.contentController.callUIAction("Refresh")}}),t("MenuPortletController",class extends Wc{}),t("ChartPortletController",class extends Wc{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends Wc{}),t("HtmlPortletController",class extends Wc{}),t("ListPortletController",class extends Wc{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends Wc{}),t("DataViewControlService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.dedataViewDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),jc=t("DataViewControlController",class extends zr{get enableNew(){return!0===this.model.enableCardNew}initState(){super.initState(),this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.sortItems=[];const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}async onCreated(){await super.onCreated(),await this.initControlService(),this.initSortItems()}async initControlService(){this.service=new Gc(this.model),await this.service.init(this.context)}async initGroupActionStates(){var t;const{groupUIActionGroup:e}=this.model;(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length)&&this.state.groups.forEach((async t=>{const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context,void 0,this.model.appDataEntityId),t.groupActionGroupState=i}))}async onRowClick(t){var e;super.onRowClick(t);const{groupAppDEFieldId:i}=this.model;if(i)if(this.state.groups.forEach((t=>{t.selectedData=[]})),this.state.selectedData.forEach((t=>{const e=t[i],a=this.state.groups.find((t=>t.key===e));a&&a.selectedData.push(t)})),this.state.singleSelect)this.state.groups.forEach((e=>{var i,a;let s=t;-1!==e.selectedData.indexOf(s)?(s&&s instanceof os&&(s=s.getOrigin()),s&&(null==(i=e.groupActionGroupState)||i.update(this.context,s,this.model.appDataEntityId))):null==(a=e.groupActionGroupState)||a.update(this.context,void 0,this.model.appDataEntityId)}));else{const i=this.state.groups.find((e=>-1!==e.children.indexOf(t)));i&&(null==(e=i.groupActionGroupState)||e.update(this.context,i.selectedData[0],this.model.appDataEntityId))}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.initGroupCodeListItems(),await this.handleDataGroup(),await this.initGroupActionStates(),this.calcShowMode(e),e}getOptItemModel(){let t=null;const{dedataViewItems:e}=this.model;if(e)for(let i=0;i<e.length;i++)"ACTIONITEM"===e[i].itemType&&(t=e[i]);return t}getOptItemAction(t){var e;const a=new rr,s=this.getOptItemModel();if(s){if(!s.deuiactionGroup)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroup"));if(!(null==(e=s.deuiactionGroup.uiactionGroupDetails)?void 0:e.length))return ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.dataView.noBehaviourGroupAction")),a;s.deuiactionGroup.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new or(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.getOrigin())}return a}async onActionClick(t,e,i){const a=t.uiactionId;await Lc.execAndResolved(a,{context:this.context,params:this.params,data:[e],view:this.view,event:i},t.appId)}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}onClickNew(t,e){const i={...this.params,srfgroup:e};Lc.execAndResolved("new",{context:this.context,params:i,data:[],view:this.view,event:t},this.view.model.appId)}async onGroupToolbarClick(t,e,i){const a=t.uiactionId,s={...this.params,srfgroup:i.key};await Lc.execAndResolved(a,{context:this.context,params:s,data:i.selectedData||[],view:this.view,event:e},t.appId)}initSortItems(){var t;if(!(null==(t=this.model.dedataViewItems)?void 0:t.length))return;const e=[],{minorSortAppDEFieldId:a,minorSortDir:s}=this.model,n=a&&s;this.model.dedataViewItems.forEach((t=>{if(!t.enableSort)return;let{caption:o}=t;if(t.capLanguageRes&&(o=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption)),!t.appDEFieldId)throw new i(t,ibiz.i18n.t("runtime.controller.control.dataView.sortingItems"));const r={caption:o,key:t.appDEFieldId};n&&a===t.appDEFieldId&&(r.order=s.toLowerCase()),e.push(r)})),e.length>0&&(this.state.sortItems=e)}}),Kc=t("ExpBarControlController",class extends Fr{constructor(){super(...arguments),this.navKeyName="srfkey"}get _evt(){return this.evt}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.query=""}load(){return this.xDataController.load({isInitialLoad:!0})}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}get toolbarController(){return this.view.getController("".concat(this.model.xdataControlName.split("_")[0],"_toolbar"))}get XDataModel(){var t;return null==(t=this.model.controls)?void 0:t.find((t=>t.name===this.model.xdataControlName))}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}async onCreated(){var t;await super.onCreated(),this.childNames.push(this.model.xdataControlName);const e=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);if(e){const i=null==(t=e.appDEFields)?void 0:t.filter((t=>t.enableQuickSearch)),a=[];null==i||i.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?a.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&a.push(t.logicName)})),a.length>0&&(this.state.placeHolder=a.join("、"))}}async onMounted(){super.onMounted(),this.xDataController&&(this.xDataController.evt.on("onActive",(t=>{this.xDataActive(t)})),this.xDataController.evt.on("onLoadSuccess",(t=>{this.xDataLoadSuccess(t)})),this.xDataController.evt.on("onRemoveSuccess",(()=>{this.navByFirstItem()}))),this.toolbarController&&this.xDataController.evt.on("onSelectionChange",(async t=>{this.toolbarController.calcButtonState(t.data[0],this.model.appDataEntityId)})),this.state.loadDefault&&this.load()}xDataLoadSuccess(t){if(t.isInitialLoad)this.state.srfnav&&this.routeDepth?this.navBySrfnav():this.navByFirstItem();else{const t=this.xDataController.state.selectedData;t[0]&&this.xDataController.setActive(t[0])}}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t[this.navKeyName]===this.state.srfnav));if(this.routeDepth&&lr(this.routeDepth))return e&&this.xDataController.setSelection([e]),void this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,isRoutePushed:!0,isCache:this.isCache},context:this.context});e?(this.xDataController.setActive(e),this.xDataController.setSelection([e])):this._evt.emit("onNavViewChange",{navViewMsg:{key:this.state.srfnav,is404:!0,isCache:this.isCache},context:this.context})}navByFirstItem(){const t=this.xDataController.state.items[0];if(!t)return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});this.xDataController.setActive(t),this.xDataController.setSelection([t])}xDataActive(t){const{data:e,context:i,params:a}=t,s=this.getNavViewMsg(e[0],i,a);this._evt.emit("onNavViewChange",{navViewMsg:s})}prepareParams(t,e,i,a){const{navDER:s,navFilter:n,navigateContexts:o,navigateParams:r,appDataEntityId:c}=t,d={deName:c?Ae(c):void 0,navFilter:n,pickupDEFName:null==s?void 0:s.pickupDEFName,navContexts:o,navParams:r},l={context:i,params:a,data:e},{resultContext:h,resultParams:u}=ge(d,l),p=Object.assign(i.clone(),h,{currentSrfNav:e[this.navKeyName]});this.state.srfnav=e[this.navKeyName];return{context:p,params:{...u}}}calcViewModelId(){var t;if(["GRID","DATAVIEW","LIST"].includes((null==(t=this.XDataModel)?void 0:t.controlType)||""))return this.XDataModel.navAppViewId;throw new o(ibiz.i18n.t("runtime.controller.control.expBar.multiNode"))}getNavViewMsg(t,e,i){const a=this.calcViewModelId(),s=this.prepareParams(this.XDataModel,t,e,i);return{key:t[this.navKeyName],context:s.context,params:s.params,viewId:a,isCache:this.isCache}}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)||!!this.model.enableSearch}setLayoutPanel(t){super.setLayoutPanel(t),t.evt.on("onMounted",(()=>{if(!this.calcControlHeaderVisible()){const t=this.layoutPanel.panelItems.control_header;t&&(t.state.visible=!1)}}))}async onRouterChange(t){this.state.srfnav!==t.srfnav&&(this.state.srfnav=t.srfnav,this.navBySrfnav())}}),Hc=(t("CalendarExpBarController",class extends Kc{constructor(){super(...arguments),this.navKeyName="navId"}getCalendarItemModel(t){const{sysCalendarItems:e}=this.XDataModel;if(e)return e.find((e=>e.itemType===t))}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}navBySrfnav(){var t;const e=null==(t=this.xDataController)?void 0:t.state.items.find((t=>t.navId===this.state.srfnav));if(super.navBySrfnav(),!e)return;const i=new Date(e.beginTime);this.xDataController.setSelectDate(i)}getNavViewMsg(t){const e=this.getCalendarItemModel(t.itemType);if(e){const{context:i,params:a}=this.prepareParams(e,t.deData?t.deData:t,this.context,this.params);return i.currentSrfNav=t.navId,this.state.srfnav=t.navId,{key:t.navId,context:i,params:a,viewId:e.navAppViewId}}return{key:t.navId,context:this.context,params:this.params}}}),t("TreeExpBarController",class extends Kc{constructor(){super(...arguments),this.navKeyName="_id",this.navNodeModelIds=[]}get xDataController(){const t=this.view.getController(this.model.xdataControlName);if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.expBar.unableMore",{xdataControlName:this.model.xdataControlName}));return t}async onMounted(){super.onMounted(),this.xDataController&&this.xDataController.evt.on("onAfterRefreshParent",(t=>{const e=this.xDataController.state.selectedData;e[0]&&this.xDataController.setActive(e[0])}))}getNodeModel(t){const{detreeNodes:e}=this.XDataModel;let i;return e&&e.forEach((e=>{e.id===t&&(i=e)})),i}xDataActive(t){const{nodeData:e}=t;super.xDataActive({...t,data:[e]})}getNavViewMsg(t,e,i){const a=t._id,s=t._deData||t,n=this.getNodeModel(t._nodeId);if(!n)throw new o(ibiz.i18n.t("runtime.controller.control.expBar.noFindNodeModel",{nodeId:t._nodeId}));const r=this.prepareParams(n,s,e,i);return r.context.currentSrfNav=a,this.state.srfnav=a,{key:a,viewId:n.navAppViewId,isCache:this.isCache,...r}}navByFirstItem(){const t=this.xDataController.state.items.find((t=>!(!this.xDataController.model.rootVisible&&this.xDataController.state.rootNodes.includes(t))&&(!!this.state.noNeedNavView||this.navNodeModelIds.includes(t._nodeId))));t&&(this.xDataController.setActive(t),this.xDataController.setSelection([t]))}async onCreated(){await super.onCreated();const{detreeNodes:t}=this.XDataModel;null==t||t.forEach((t=>{t.navAppViewId&&this.navNodeModelIds.push(t.id)})),this.state.srfnav&&(this.defaultExpandedKeys=this.calcExpandKeys(this.state.srfnav))}calcExpandKeys(t){const e=[];return t.split(":").forEach(((t,i)=>{0===i?e.push(t):e.push("".concat(e[i-1],":").concat(t))})),e.pop(),e}async onRouterChange(t){if(this.state.srfnav!==t.srfnav){const e=this.calcExpandKeys(t.srfnav);await this.xDataController.expandNodeByKey(e)}await super.onRouterChange(t)}calcControlHeaderVisible(){const t=!!this.toolbarController;if(!t&&this.layoutPanel){const t=this.layoutPanel.panelItems.control_toolbar;t&&(t.state.visible=!1)}return t||!(!this.model.showTitleBar||!this.model.title)}}),t("ChartExpBarController",class extends Kc{navByFirstItem(){if(!this.xDataController.state.items[0])return this.state.srfnav="",void this._evt.emit("onNavViewChange",{navViewMsg:{key:"",isCache:this.isCache}});const t=this.xDataController.generator.seriesGenerators.find((t=>t.chartDataArr.length>0&&t.model.navAppViewId));t&&this.xDataController.setActive(t.chartDataArr[0])}prepareParams(t,e,i,a){var s;const{context:n,params:o}=super.prepareParams(t,e,i,a);if(e._seriesModelId){const i=null==(s=t.dechartSerieses)?void 0:s.find((t=>t.id===e._seriesModelId));if(i){const{navigateContexts:t,navigateParams:s}=i,r=he(t,e,a,n),c=he(s,e,a,o);return{context:Object.assign(n.clone(),r),params:c}}}return{context:n,params:o}}getNavViewMsg(t,e,i){var a;let s;if(t._seriesModelId){const e=null==(a=this.XDataModel.dechartSerieses)?void 0:a.find((e=>e.id===t._seriesModelId));s=null==e?void 0:e.navAppViewId}const n=this.prepareParams(this.XDataModel,t,e,i);return{key:t._uuid,context:n.context,params:n.params,viewId:s,isCache:this.isCache}}}),t("FormController",class extends Fr{constructor(){super(...arguments),this.details={},this.providers={},this.formItems=[],this.formMDCtrls=[],this.counters={}}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data=new os,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Cn(Object.values(this.details).map((async e=>e.dataChangeNotify(t))))}formStateNotify(t){Object.values(this.details).forEach((e=>{e.formStateNotify(t)}))}async onCreated(){await super.onCreated(),await this.initDetailControllers(),await this.initCounter(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[Array.from(new Set([...t[0],...e[0]]))]),200),this._evt.on("onFormDetailEvent",(t=>{var e;null==(e=this.scheduler)||e.triggerControlEvent(t.formDetailName,t.formDetailEventName,t)}))}async initDetailControllers(t=this.model.deformPages,e=this,a=void 0){await Promise.all(t.map((async t=>{const s=await Ki(t,this.model);if(!s)return;if(e.details[t.id])throw new i(t,ibiz.i18n.t("runtime.controller.control.form.initializationException",{id:t.id,detailType:t.detailType}));e.providers[t.id]=s;const n=await s.createController(t,e,a);if(e.details[t.id]=n,"FORMITEM"===t.detailType&&e.formItems.push(n),"MDCTRL"===t.detailType&&e.formMDCtrls.push(n),Fe(t))return;const o=_e(t);o.length&&await this.initDetailControllers(o,e,n)})))}getData(){return[this.state.data]}async setDataValue(t,e){if(!Object.prototype.hasOwnProperty.call(this.state.data,t)||hr(this.state.data[t],e)){this.state.data[t]=e,this.state.processing=!0,this.state.modified=!0,await this._evt.emit("onFormDataChange",void 0);try{await this.dataChangeNotify([t])}finally{this.state.processing=!1}}}async updateFormItem(t){}async validate(){return-1===(await Promise.all([...this.formItems,...this.formMDCtrls].map((t=>t.validate())))).findIndex((t=>!t))}actionNotification(t,e){if((null==e?void 0:e.error)&&e.error instanceof P){const{details:t}=e.error;t.forEach((t=>{this.setDetailError(t.name,t.errorInfo)}))}super.actionNotification(t,{data:this.data,...e||{}})}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["deformPages","deformTabPages","deformDetails"]}),super.initControlScheduler(e)}async onDestroyed(){await super.onDestroyed(),Object.values(this.counters).forEach((t=>t.destroy()))}async initCounter(){this.counters={};const{appCounterRefs:t}=this.model;if(t&&t.length>0){const e=this.context[Ae(this.model.appDataEntityId)];try{await Promise.all(t.map((async t=>{const i=await Ja.getCounterByRef(t,this.context,e?{srfcustomtag:e,...this.params}:{...this.params});this.counters[t.id]=i})))}catch(t){console.error(t)}}}setDetailError(t,e){const i=this.details[t],a=null==i?void 0:i.state;a&&(a.error=e)}})),Xc=class extends rs{setDefault(t,e,i,a){r(this.model,(s=>{if("FORMITEM"===s.detailType){const{createDVT:n,createDV:o,updateDVT:r,updateDV:c,valueFormat:d}=s,l="create"===a?n:r,h="create"===a?o:c,u=s.id.toLowerCase(),p=fr({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},qc=t("SearchFormService",class extends Xc{async getDraft(t,e={}){let i={ok:!0,status:200,data:this.getFilteredData({...e})};return i=this.handleResponse(i),i.ok&&i.data&&this.setDefault(i.data,t,e,"create"),i}initUIDataMap(){r(this.model,(t=>{if("FORMITEM"===t.detailType){const e=t.id.toLowerCase();this.dataUIMap.set(e,new sn(e,e))}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}}),Yc=(t("SearchFormController",class extends Hc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new $a(this.model.appId,"dynafilter","searchform_".concat((null==(t=this.model.appDataEntityId)?void 0:t.toLowerCase())||"app","_").concat(null==(e=this.model.codeName)?void 0:e.toLowerCase())),this.preprocessLayoutPanel(),this.service=new qc(this.model),await this.service.init(this.context),await this.load(),await this.loadConfig()}async load(){const t={...this.params};let e;await this.evt.emit("onBeforeLoadDraft",{params:t});try{e=await this.service.getDraft(this.context,t)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}return this.state.data=e.data,this.state.isLoaded=!0,this.formStateNotify("DRAFT"),this.actionNotification("GETDRAFTSUCCESS"),this.data}getFilterParams(){const t={};return Object.keys(this.state.data).forEach((e=>{const i=this.state.data[e];null!=i&&""!==i&&(t[e]=i)})),t}async search(){await this.evt.emit("onSearch",void 0)}async onSearchButtonClick(){await this.search()}async reset(){await this.load(),await this.search()}async dataChangeNotify(t){await super.dataChangeNotify(t),this.model.enableAutoSearch&&this.search()}async onKeyUp(t){const e=t||window.event;e&&"Enter"===e.code&&await this.onSearchButtonClick()}preprocessLayoutPanel(){if(!this.controlPanel)return;const{searchButtonStyle:t}=this.model;let e=!1,i=!1;const a=this.model.searchButtonPos||"RIGHT";e="BOTTOM"===a,i="BOTTOM"!==a,"NONE"===t&&(e=!0,i=!0);const s=t=>{let a,n="";if(["rootPanelItems","panelItems"].find((e=>!!t[e]&&(a=t[e],n=e,!0))),a&&a.length>0){const o=[];a.forEach((t=>{e&&"control_buttons_right"===t.id||i&&"control_buttons_bottom"===t.id||(o.push(t),s(t))})),o.length<a.length&&(t[n]=o)}};(i||e)&&s(this.controlPanel)}async loadConfig(){const t=await this.config.load();t.model&&(this.state.storedFilters=t.model)}async saveConfig(){await this.config.save({model:this.state.storedFilters})}async storeFilter(t){this.state.storedFilters.push({name:t,data:{...this.data}}),await this.saveConfig()}applyStoredFilter(t){const e=this.state.storedFilters[t];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.searchTerms"));e.data&&Object.assign(this.data,e.data),this.search()}async removeStoredFilter(t){if(!this.state.storedFilters[t])throw new o(ibiz.i18n.t("runtime.controller.control.form.saveSearch"));this.state.storedFilters.splice(t,1),await this.saveConfig()}}),t("FormDetailState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.showMoreMode=0,this.readonly=!1;let e,i,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){if(this.parent){if(!1===this.parent.visible)return!1;if(1===this.showMoreMode&&!1===this.parent.isShowMore)return!1}return a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Qc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Qc||{})),$c=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))($c||{})),Jc=t("FormDetailController",class{constructor(t,e,i){this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.model=t,this.form=e,this.parent=i,this.state=this.createState(),this.state.context=this.context}get data(){return this.form.data}get context(){return this.form.context}get params(){return this.form.params}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){await this.onInit()}async onInit(){this.state.showMoreMode=this.model.showMoreMode;const{layoutPos:t,sysCss:e,labelSysCss:i,capLanguageRes:a}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName),a&&a.lanResTag&&(this.model.caption=ibiz.i18n.t(a.lanResTag,this.model.caption))}createState(){var t;return new Yc(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}async formStateNotify(t){this.calcDynamicLogic([],!0),this.calcDetailDisabled(this.data),this.calcDetailVisible(this.data),this.calcDetailRequired(this.data),this.calcDynaClass(this.data)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.defdgroupLogics)||i.forEach((i=>{const a=i.relatedDetailNames||[];if(e||T(a,t))try{const t=si(this.data,i);switch(i.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}force(t){}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=be(this.model.labelDynaClass,t);this.state.class.labelDyna=e}}calcDetailDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcDetailVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcDetailRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.form.scheduler){const i=this.form.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}async onClick(t){t&&t.stopPropagation(),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onClick",event:t})}}),Zc=t("FormButtonState",class extends Yc{constructor(){super(...arguments),this.loading=!1}}),td=(t("FormButtonController",class extends Jc{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new Zc(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){const t=this.model.uiactionId;t&&(this.actionState=new or(this.model.id,this.form.context.srfappid,t))}async formStateNotify(t){if(this.actionState){const t=Ae(this.form.model.appDataEntityId);await this.actionState.update(this.context,this.data,t)}await super.formStateNotify(t)}calcDetailDisabled(t){super.calcDetailDisabled(t),this.actionState&&(this.state.disabled=!(!this.state.disabled&&!this.actionState.disabled))}calcDetailVisible(t){super.calcDetailVisible(t),this.actionState&&(this.state.visible=!(!this.state.visible||!this.actionState.visible))}async onClick(t){this.state.loading=!0;try{"UIACTION"===this.model.actionType&&await this.doUIAction(t),await this.doFormItemUpdate()}finally{this.state.loading=!1}super.onClick(t)}async doUIAction(t){const e=this.model.uiactionId;await Lc.execAndResolved(e,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:t,noWaitRoute:!0},this.model.appId)}async doFormItemUpdate(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}}),t("FormDruipartState",class extends Yc{constructor(){super(...arguments),this.showMask=!1}})),ed=(t("FormDRUIPartController",class extends Jc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new td(null==(t=this.parent)?void 0:t.state)}async onInit(){if(await super.onInit(),Object.assign(this.state.layout.extraStyle,{overflow:"auto"}),this.model.refreshItems){let t=this.model.refreshItems.split(";");t=t.filter((t=>!!t)),this.refreshItems.push(...t)}this.model.paramItem&&(this.paramItem=this.model.paramItem)}async dataChangeNotify(t){await super.dataChangeNotify(t),T(this.refreshItems,t)&&this.calcViewParams()}async formStateNotify(t){await super.formStateNotify(t),this.isNewData="DRAFT"===t,0!==this.model.maskMode&&(this.state.showMask=this.isNewData),"LOAD"!==t&&"DRAFT"!==t&&"SAVE"!==t||this.calcViewParams()}calcViewParams(){let t=this.form.context.clone();const e=this.model.navigateContexts;ct(e)&&(t=Object.assign(t,he(e,this.data,this.form.params,this.form.context)));const i=he(this.model.navigateParams,this.data,this.form.params,this.form.context);if(this.state.viewComponentKey){if(JSON.stringify(this.navContext)!==JSON.stringify(t)||JSON.stringify(this.navParams)!==JSON.stringify(i))this.navContext=t,this.navParams=i,this.force();else if(this.embedView){if(this.isNewData)return;this.embedView.callUIAction("Refresh")}}else this.state.viewComponentKey=ut(),this.navContext=t,this.navParams=i}setEmbedView(t){this.embedView=t,this.embedView.evt.on("onMounted",(()=>{this.isNewData||this.embedView.call("Load")})),this.embedView.evt.on("onDataChange",(t=>{["LOAD","LOADDRAFT"].includes(t.actionType)||(ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.relationshipInterface"),t),this.model.deformItemUpdateId&&this.form.updateFormItem(this.model.deformItemUpdateId))}))}}),t("FormGroupPanelState",class extends Yc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),id=t("FormGroupPanelController",class extends Jc{get disableClose(){const{titleBarCloseMode:t}=this.model;return 0===t||void 0===t}get defaultExpansion(){const{titleBarCloseMode:t}=this.model;return this.disableClose||1===t}createState(){var t;return new ed(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit(),await this.initActionStates()}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Lc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),ad=t("FormItemState",class extends Yc{constructor(t){super(t),this.parent=t,this.error=null,this.enableCondDisabled=!1;let e=!1;Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,get(){return!!this.enableCondDisabled||e},set:t=>(e=t,!0)})}}),sd=(t("FormItemController",class extends Jc{constructor(t,e,i){super(t,e,i),this.rules=[]}createState(){var t;return new ad(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get value(){return this.data[this.name]}get valueItemName(){if(this.model.editor)return this.model.editor.valueItemName}get labelCaption(){const{captionItemName:t}=this.model;return t?this.data[t]:this.model.caption}get unitName(){return this.model.unitName}get valueFormat(){return this.model.valueFormat}get dataType(){return this.model.dataType}async onInit(){var t,e;await super.onInit(),this.state.required=!this.model.allowEmpty;const{enableCond:i}=this.model;i||(this.state.enableCondDisabled=!0),!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly&&(null==(t=this.model.editor)?void 0:t.readOnly)&&(this.state.readonly=(null==(e=this.model.editor)?void 0:e.readOnly)||!1),this.model.editor&&"HIDDEN"!==this.model.editor.editorType&&(this.editorProvider=await Wi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this),await this.initRules()))}async initRules(){this.rules=[];const t=Ii(this.form.model.deformItemVRs||[],this.name);t&&this.rules.push(...pr(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...mr(this.model.editor)),this.rules.length>0&&(this.validator=new At({[this.name]:this.rules}))}calcEnableCond(){const{enableCond:t}=this.model,e=0===this.data.srfuf;(e&&2===t||!e&&1===t)&&(this.state.enableCondDisabled=!0)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setDataValue(null,this.name),(t.includes(this.name)||t.includes(this.valueItemName))&&this.validate(),t.includes(this.name)&&this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){super.formStateNotify(t),this.calcEnableCond()}calcDynamicLogic(t,e=!1){this.model.hidden||super.calcDynamicLogic(t,e)}async validate(){if(!this.state.visible)return this.state.error=null,!0;if(this.state.required&&("string"==typeof this.data[this.name]?dt(this.data[this.name].trimEnd()):dt(this.data[this.name])))return this.state.error=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.validator)try{await this.validator.validate(this.data)}catch({errors:t,_fields:e}){return this.state.error=t[0].message,!1}return this.state.error=null,!0}async setDataValue(t,e){e=e||this.name,await this.form.setDataValue(e,t),this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onChange"})}onFocus(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onFocus",event:t})}onBlur(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onBlur",event:t})}onEnter(t){this.form.evt.emit("onFormDetailEvent",{formDetailName:this.model.id,formDetailEventName:"onEnter",event:t})}}),class extends Yc{constructor(){super(...arguments),this.actionGroupState=null}}),nd=t("FormMDCtrlController",class extends Jc{createState(){var t;return new sd(null==(t=this.parent)?void 0:t.state)}get name(){return this.model.id}get context(){return this.form.context}get params(){return this.form.params}get enableCreate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&N.checkPermission(this.model.buildInActions,4)}async updateFormItem(){this.model.deformItemUpdateId&&await this.form.updateFormItem(this.model.deformItemUpdateId)}async formStateNotify(t){if(super.formStateNotify(t),this.state.actionGroupState){const t=this.data.getOrigin?this.data.getOrigin():this.data;this.state.actionGroupState.update(this.form.context,t)}}async onInit(){super.onInit(),await this.initActionStates()}async initActionStates(){var t;const{uiactionGroup:e}=this.model;if(!(null==(t=null==e?void 0:e.uiactionGroupDetails)?void 0:t.length))return;const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.form.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.form.context),this.state.actionGroupState=i}async onActionClick(t,e){const i=t.uiactionId;await Lc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}async save(t){}}),od=(t("FormMDCtrlMDController",class extends nd{constructor(){super(...arguments),this.ignoreNextSelfChange=!1}get name(){return this.model.id}async onInit(){await super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));"GRID"===t.controlType&&x(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await ki(t);e&&(this.mdProvider=e)}setMDControl(t){this.mdController=t,t.evt.on("onSaveSuccess",(()=>{this.notifyFormDataChange()})),t.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}updateFormItem(){const t=this.mdController.state.items||[];return this.data[this.name]=t,super.updateFormItem()}remove(){this.mdController.remove()}create(){if("GRID"!==this.model.contentType)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.form.multiDataAddData",{contentType:this.model.contentType}));this.mdController.newRow()}refresh(){this.mdController?this.mdController.refresh():ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.form.mdControllerNoExist"))}async formStateNotify(t){await super.formStateNotify(t),this.refresh()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),class extends sd{}),rd=(t("FormMDCtrlFormController",class extends nd{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new od(null==(t=this.parent)?void 0:t.state)}async onInit(){super.onInit();const{contentControl:t}=this.model;if(!t)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.unconfiguredWidgets"));t.enableAutoSave=this.enableCreate||this.enableUpdate;const e=await ki(t);e&&(this.formProvider=e);const{appDataEntityId:a}=this.model.contentControl;this.deName=Ae(a)}async fetchData(){const{appDataEntityId:t}=this.model.contentControl,e=await ibiz.hub.getApp(this.model.appId).deService.exec(t,"fetchdefault",this.context,this.params);e.ok&&(this.state.items=e.data.map((t=>{const e=this.context.clone();e[this.deName]=t.srfkey;const i={...this.params};return{id:t.srfkey,context:e,params:i}})))}async formStateNotify(t){await super.formStateNotify(t),await this.refresh()}setFormController(t,e){this.formMap.set(t,e),e.evt.on("onSaveSuccess",(e=>{const i=e.data[0],a=this.state.items.find((e=>e.id===t));a&&a.context[this.deName]!==i.srfkey&&(a.context[this.deName]=i.srfkey),this.notifyFormDataChange()})),e.evt.on("onRemoveSuccess",(()=>{this.notifyFormDataChange()}))}async validate(){return-1===(await Promise.all(Array.from(this.formMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}async save(t){await Promise.all(Array.from(this.formMap.values()).map((e=>e.save(t))))}async remove(t){const e=this.formMap.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.form.noFoundFormController",{id:t}));await e.remove();const i=this.state.items.findIndex((e=>e.id===t));-1!==i&&this.state.items.splice(i,1)}create(t){const e=this.context.clone(),i={...this.params};this.state.items||(this.state.items=[]);const a={id:ut(),context:e,params:i};void 0!==t?this.state.items.splice(t,0,a):this.state.items.push(a)}refresh(){this.fetchData()}async dataChangeNotify(t){t.includes(this.model.id)&&this.ignoreNextSelfChange?this.ignoreNextSelfChange=!1:(await super.dataChangeNotify(t),t.includes(this.model.id)&&this.refresh())}notifyFormDataChange(){this.updateFormItem(),this.ignoreNextSelfChange=!0,this.form.dataChangeNotify([this.name])}}),t("FormMDCtrlRepeaterController",class extends nd{constructor(){super(...arguments),this.repeaterStyle="MultiForm",this.isSingleData=!1,this.repeaterMap=new Map}get value(){return this.data[this.model.id]}async onInit(){switch(await super.onInit(),this.model.detailStyle){case"DEFAULT":this.repeaterStyle="MultiForm",this.isSingleData=!1;break;case"STYLE2":this.repeaterStyle="Grid",this.isSingleData=!1;break;case"STYLE3":this.repeaterStyle="SingleForm",this.isSingleData=!0;break;default:throw new a(this.model,ibiz.i18n.t("runtime.controller.control.form.repeaterNoSupported",{detailStyle:this.model.detailStyle}))}this.prepareRepeatedForm()}prepareRepeatedForm(){const t="".concat(this.model.id,"repeatedform"),e={appId:this.model.appId,id:t,codeName:t,name:t,deformPages:[{appId:this.model.appId,id:"formpage1",deformDetails:this.model.deformDetails,detailType:"FORMPAGE",detailStyle:"DEFAULT",layout:this.model.layout}]};["appId","controlType","deformItemVRs"].forEach((t=>{e[t]=this.form.model[t]})),this.repeatedForm=it(e)}setRepeaterController(t,e){this.repeaterMap.set(t,e)}async validate(){return-1===(await Promise.all(Array.from(this.repeaterMap.values()).map((t=>t.validate())))).findIndex((t=>!t))}setValue(t){this.form.setDataValue(this.name,t)}create(t){if(this.isSingleData)this.setValue({});else{let e=this.value;e=e?[...e]:[],void 0!==t?e.splice(t,0,{}):e.push({}),this.setValue(e)}}remove(t){if(this.isSingleData)return void this.setValue(null);const e=this.value.filter(((e,i)=>t!==i));this.setValue(e)}async dataChangeNotify(t){await super.dataChangeNotify(t);const{resetItemNames:e}=this.model;let i=!1;e&&e.length>0&&e.forEach((e=>{t.includes(e)&&(i=!0)})),i&&this.setValue(null),t.includes(this.name)&&await this.updateFormItem()}}),t("FormPageState",class extends ed{})),cd=(t("FormPageController",class extends id{createState(){var t;return new rd(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Yc{})),dd=(t("FormRawItemController",class extends Jc{createState(){var t;return new cd(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Yc{})),ld=(t("FormTabPageController",class extends Jc{createState(){var t;return new dd(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends Yc{constructor(){super(...arguments),this.activeTab=""}})),hd=(t("FormTabPanelController",class extends Jc{createState(){var t;return new ld(null==(t=this.parent)?void 0:t.state)}async onInit(){var t;await super.onInit(),this.state.activeTab=(null==(t=this.model.deformTabPages)?void 0:t[0].id)||""}onTabChange(t){this.state.activeTab=t}getCounter(t){const{counters:e}=this.form;return e&&e[t]?e[t]:null}}),t("EditFormService",class extends Xc{async get(t,e={}){var i;let a=await this.exec((null==(i=this.model.getControlAction)?void 0:i.appDEMethodId)||"get",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"update"),a}async getDraft(t,e={}){var i;let a=await this.exec((null==(i=this.model.getDraftControlAction)?void 0:i.appDEMethodId)||"getdraft",t,void 0,e);return a=this.handleResponse(a),a.ok&&a.data&&this.setDefault(a.data,t,e,"create"),a}async remove(t,e={}){var i;return await this.exec((null==(i=this.model.removeControlAction)?void 0:i.appDEMethodId)||"remove",t,void 0,e)}async create(t,e){var i;const a=e instanceof os?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.createControlAction)?void 0:i.appDEMethodId)||"create",t,s);return n=this.handleResponse(n),n}async update(t,e){var i;const a=e instanceof os?e.getOrigin():e,s=this.getFilteredData(a);let n=await this.exec((null==(i=this.model.updateControlAction)?void 0:i.appDEMethodId)||"update",t,s);return n=this.handleResponse(n),n}async goBack(t,e){var a;const s=null==(a=this.model.goBackControlAction)?void 0:a.appDEMethodId;if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.form.lackBehavior"));let n=await this.exec(s,t,e instanceof os?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,i={},a={}){Object.assign(a,{srfupdateitem:!0});let s=await this.exec(t,e,i,a);return s=this.handleResponse(s),s}async wfStart(t,e,i){var a;const s=(null==(a=this.model.wfstartControlAction)?void 0:a.appDEMethodId)||"wfstart";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(s,t,e,i instanceof os?i.getOrigin():i)}async wfSubmit(t,e,i){var a;const s=this.model;let n="";n=e.type?e.type:(null==(a=s.wfsubmitControlAction)?void 0:a.appDEMethodId)||"wfsubmit";return(await this.app.deService.getService(t,this.model.appDataEntityId)).wf.exec(n,t,e,i instanceof os?i.getOrigin():i)}initUIDataMap(){super.initUIDataMap();const t=["srfwfmemo","srfwftransferor","srfactionparam","srffrontuf","srfnextform"];r(this.model,(e=>{if("FORMITEM"===e.detailType||"MDCTRL"===e.detailType){const i=e,a=i.id.toLowerCase(),s=i.fieldName||e.appDEFieldId;let n;n=s?new sn(a,s,{isOriginField:!0,dataType:i.dataType}):new sn(a,a,{isOriginField:t.includes(a)}),this.dataUIMap.set(a,n)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}handleResponse(t){const e=super.handleResponse(t);return e.ok&&e.data&&(e.data=this.toUIData(e.data)),e}getFilteredData(t){const e={};return this.dataUIMap.forEach((i=>{void 0!==t[i.dataKey]&&(e[i.dataKey]=t[i.dataKey])})),e}})),ud=(t("EditFormController",class extends Hc{constructor(){super(...arguments),this.oldData=new os}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new hd(this.model),await this.service.init(this.context),this.autoSave=U(this.autoSave.bind(this),500,{trailing:!0})}async onMounted(){await super.onMounted(),!this.state.isSimple&&this.state.loadDefault&&this.load()}async loadDraft(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoadDraft",{params:i}),a=await this.service.getDraft(e,i)}catch(t){throw await this.evt.emit("onLoadDraftError",void 0),this.actionNotification("GETDRAFTERROR",{error:t}),t}finally{await this.endLoading()}return this.state.data=a.data,this.formStateNotify("DRAFT"),await this.evt.emit("onLoadDraftSuccess",void 0),this.actionNotification("GETDRAFTSUCCESS"),this.state.isLoaded=!0,this.data}async copy(){const t=it(this.context),e=it(this.params),i=(await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId)).keyAppDEFieldId;if(i&&this.params[i]){t[Ae(this.model.appDataEntityId)]=this.params[i],delete e[i],delete this.params[i],delete e.srfcopymode,delete this.params.srfcopymode}let a;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:e}),a=await this.service.get(t,e)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return a.data.srfkey=void 0,a.data.tempsrfkey=ut(),this.state.modified=!1,this.state.data=a.data,this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:a.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async load(t){if(this.params.srfcopymode)return this.copy();if(!Pe(this.context,Ae(this.model.appDataEntityId)))return this.loadDraft();const{context:e,params:i}=this.handlerAbilityParams(t),a=it(i);let s;try{await this.startLoading(),await this.evt.emit("onBeforeLoad",{args:a}),s=await this.service.get(e,a)}catch(t){throw await this.evt.emit("onLoadError",{args:t}),this.actionNotification("GETERROR",{error:t}),t}finally{await this.endLoading()}return this.state.modified=!1,this.state.data=s.data,this.oldData=this.data.clone(),this.formStateNotify("LOAD"),await this.evt.emit("onLoadSuccess",{args:s.data}),this.actionNotification("GETSUCCESS"),this.state.isLoaded=!0,this.data}async save(t){const e=!0===(null==t?void 0:t.silent);if(this.state.processing){return await S(500,this.save.bind(this),[t])}await this.saveFormDetail();if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));e||await this.startLoading();const{context:i,data:a}=this.handlerAbilityParams(t),s=a[0],n=0===s.srfuf;let r;try{await this.evt.emit("onBeforeSave",{args:s}),r=n?await this.service.create(i,s):await this.service.update(i,s)}catch(t){throw await this.evt.emit("onSaveError",{args:t}),this.actionNotification("".concat(n?"CREATE":"UPDATE","ERROR"),{error:t}),t}finally{e||await this.endLoading()}const c=!0===(null==t?void 0:t.noFillBack);return r.data&&(c?(this.data.updatedate=r.data.updatedate,this.data.srfkey=r.data.srfkey):x(this.data,r.data),this.oldData=this.data.clone(),this.data.tempsrfkey=this.data.srfkey),this.state.modified=!1,await this.evt.emit("onSaveSuccess",{args:r.data}),this.view.state.isClosing||this.formStateNotify("SAVE"),e||this.actionNotification("".concat(n?"CREATE":"UPDATE","SUCCESS"),{default:ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:this.data.srfmajortext||""})}),this.emitDEDataChange(n?"create":"update",r.data),this.data}async remove(t){const{context:e,params:i}=this.handlerAbilityParams(t);let a,s=!1;if(await this.evt.emit("onBeforeRemove",{args:this.data}),1===this.data.srfuf){if(!0!==(null==t?void 0:t.silent)){if(s=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.modal.confirm({title:ibiz.i18n.t("runtime.controller.control.form.prompt"),desc:ibiz.i18n.t("runtime.controller.control.form.deletion")}),!s)return!1}await this.startLoading();try{a=await this.service.remove(e,i)}catch(e){throw await this.evt.emit("onRemoveError",{args:e}),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e}),e}finally{await this.endLoading()}s=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new os,this.state.modified=!1,await this.evt.emit("onRemoveSuccess",{args:this.data}),this.actionNotification("REMOVESUCCESS"),s}async goBack(){let t;await this.startLoading();try{t=await this.service.goBack(this.context,this.data)}finally{await this.endLoading()}return t.data&&x(this.data,t.data),this.data}async updateFormItem(t){var e;const i=null==(e=this.model.deformItemUpdates)?void 0:e.find((e=>e.id===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.form.itemUpdate",{formItemUpdateId:t}));const{appDEMethodId:a,defiupdateDetails:s,customCode:n,scriptCode:r,showBusyIndicator:c}=i,d=null==s?void 0:s.map((t=>t.id));try{let t;if(c&&this.startLoading(),n&&r)t=ei.execScriptFn({...this.getEventArgs(),data:this.data},r,{isAsync:!1});else{const e={...this.params,...this.data.getOrigin()},i=await this.service.updateFormItem(a,this.context,e);t=i.data}t&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setDataValue(e,t[e]))))}finally{c&&this.endLoading()}}async wfStart(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfStart(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSTARTERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSTARTSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processStarted")})}async wfSubmit(t){if(!await this.validate())throw new o(ibiz.i18n.t("runtime.controller.control.form.formCompletion"));await this.startLoading();const{context:e,params:i}=this.handlerAbilityParams(t);try{await this.service.wfSubmit(e,i,this.data),this.emitDEDataChange("update",this.data),this.emitDEDataChange("update",{srfdecodename:"SysTodo"})}catch(t){throw this.actionNotification("WFSUBMITERROR",{error:t}),t}finally{await this.endLoading()}this.actionNotification("WFSUBMITSUCCESS",{default:ibiz.i18n.t("runtime.controller.control.form.processSubmitted")})}async dataChangeNotify(t){await super.dataChangeNotify(t),this.autoSave()}async autoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}async immediateAutoSave(){if(!this.model.enableAutoSave)return;const{autoSaveMode:t}=this.model,e={silent:!0,noFillBack:!0};if(3===t)e.data=this.getDiffData(),e.context=d.create({srfsimple:!0});try{await this.save(e)}catch(t){ibiz.log.error(t)}}async saveFormDetail(){const t={silent:!0,noFillBack:!0};await Promise.all(this.formMDCtrls.map((e=>e.save(t))))}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?b(t[i],this.oldData[i])||(e[i]=t[i]):t[i]===this.oldData[i]&&i!==t.srfkeyfield||(e[i]=t[i])})),e.srfuf=t.srfuf,new os(e,this.oldData.$dataUIMap)}setSimpleData(t){const e=this.service.toUIData(t).clone();this.formItems.forEach((t=>{Object.prototype.hasOwnProperty.call(e,t.name)||(e[t.name]=null)})),this.state.modified=!1,this.state.data=e,this.state.isLoaded?this.dataChangeNotify(Object.keys(this.state.data)):(this.formStateNotify("LOAD"),this.state.isLoaded=!0)}onDEDataChange(t){var e;if("OBJECTUPDATED"===t.subtype&&(Z(t.triggerKey)||t.triggerKey!==this.triggerKey)&&this.model.appDataEntityId){const i=Ae(this.model.appDataEntityId);if(!t.data||(null==(e=t.data.srfdecodename)?void 0:e.toLowerCase())!==i||t.data.srfkey!==this.data.srfkey)return;this.doNextActive((()=>this.load()),{key:"load"})}}}),t("GridColumnController",class{constructor(t,e){var i;this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.grid=e,this.isAdaptiveColumn="STAR"===t.widthUnit,this.isAdaptiveColumn&&(this.grid.hasAdaptiveColumn=!0),(null==(i=this.deGridDataItem)?void 0:i.customCode)&&(this.isCustomCode=!0)}get context(){return this.grid.context}get params(){return this.grid.params}get enableRowEdit(){return!(!this.grid.model.enableRowEdit||!this.model.enableRowEdit)}get deGridDataItem(){var t;return null==(t=this.grid.model.degridDataItems)?void 0:t.find((t=>t.id===this.model.id))}get valueFormat(){var t;return null==(t=this.deGridDataItem)?void 0:t.format}get dataType(){var t;return null==(t=this.deGridDataItem)?void 0:t.dataType}async init(){await this.onInit()}async onInit(){}getCustomHtml(t){var e;if(null==(e=this.deGridDataItem)?void 0:e.scriptCode)return ei.execScriptFn({data:t.data},this.deGridDataItem.scriptCode,{singleRowReturn:!0,isAsync:!1})}})),pd=t("GridRowState",class{constructor(t,e){this.errors={},this.uaColStates={},this.editColStates={},this.uiActionGroupStates={},this.showRowEdit=!1,this.modified=!1,this.processing=!1,this.data=t,this.oldData=t.clone(),Object.keys(this.data).forEach((t=>{void 0===this.errors[t]&&(this.errors[t]=null)})),Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.editColumns).forEach((t=>{let i;this.editColStates[t.fieldName]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.fieldName],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})}))}getDiffData(){const t={};return Object.keys(this.data).forEach((e=>{this.data[e]===this.oldData[e]&&e!==this.data.srfkeyfield||(t[e]=this.data[e])})),t.srfuf=this.data.srfuf,t.srfkey=this.data.srfkey,new os(t,this.oldData.$dataUIMap)}}),md=t("GridService",class extends cs{initUIDataMap(){var t;if(super.initUIDataMap(),this.model.degridColumns){const e=this.model.degridDataItems||[];null==(t=this.model.degridColumns)||t.forEach((t=>{const a=t.id.toLowerCase(),s=t.appDEFieldId;let n;if(s){const o=s.toLowerCase(),r=e.find((e=>e.id===t.dataItemName));if(!r)throw new i(t,ibiz.i18n.t("runtime.controller.control.grid.corresponding",{deField:s}));n=new sn(a,o,{isOriginField:!0,dataType:r.dataType})}else n=new sn(a,a);this.dataUIMap.set(a,n)}))}}async updateGridEditItem(t,e,i={},a={}){const s=await this.app.deService.getService(e,this.model.appDataEntityId);Object.assign(a,{srfupdateitem:!0});let n=await s.exec(t,e,i,a);return n=this.handleResponse(n),n}}),gd={string:25,number:6,integer:9,date:5};var fd=t("GridController",class extends zr{constructor(){super(...arguments),this.hasAdaptiveColumn=!1,this.isMultistageHeader=!1,this.addSchemaColumn=!1,this.columns={},this.fieldColumns={},this.uaColumns={},this.editColumns={},this.providers={},this.aggTitle="合计",this.dataExportParam={},this.allExportColumns=[],this.allExportCodelistMap=new Map,this.formatValue=(t,e="")=>{const i="".concat(e);if(!t)return i;if(Ct(i,t,!0).isValid()){return Ct(i).format(t)}return ibiz.util.text.format(i,t)}}get _evt(){return this.evt}get groupCodeListItems(){var t;return null==(t=this.groupFieldColumn)?void 0:t.codeListItems}get enableAgg(){return"NONE"!==this.model.aggMode}get allowRowEdit(){return!!this.model.enableRowEdit&&this.state.rowEditOpen}get enableRowEditOrder(){return!!this.model.enableRowEditOrder}get overflowMode(){return ibiz.config.grid.overflowMode}initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.size=this.model.pagingSize||20,this.state.singleSelect=!0===this.model.singleSelect,this.state.columnStates=[],this.state.aggResult={},this.state.rowEditOpen=!1;const{hideHeader:t,enablePagingBar:e}=this.model;this.state.hideHeader=t,this.state.enablePagingBar=e}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new md(this.model),await this.service.init(this.context),this.initColumnStates(),await this.initGridColumns(),this.dataChangeNotify=A(this.dataChangeNotify.bind(this),((t,e)=>[t[0],Array.from(new Set([...t[1],...e[1]]))]),200),await this.initGroup(),await this.initExportData()}calcShowMode(t){const{hideHeader:e,enablePagingBar:i}=this.model;this.state.hideNoDataImage=!1,this.state.hideHeader=e,this.state.enablePagingBar=i;const a=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===a&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===a&&0===t.length&&(this.state.hideHeader=!0,this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await xr(this.model.appDataEntityId,this.context);if(!t)return;const e=await async function(t,e){var i;if(!t.properties)return;const{properties:a}=t;if(!(Object.keys(a).length>0))return;const s=[];Object.keys(a).forEach((t=>{let e;switch(a[t].type){case"string":e="string","date-time"===a[t].format&&(e="date");break;case"integer":e="integer";break;case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:a[t].type}))}s.push({key:t,description:a[t].description,type:e})}));const n={};null==(i=(await ibiz.hub.getAppDataEntity(e.model.appDataEntityId,e.model.appId)).appDEFields)||i.forEach((t=>{n[t.codeName.toLowerCase()]=t.id}));const o=[],r=[];return s.forEach((t=>{o.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,codeName:t.key,columnType:"DEFGRIDCOLUMN",width:150,widthUnit:"PX",valueType:"SIMPLE",caption:t.description,dataItemName:t.key}),r.push({appId:e.model.appId,appDEFieldId:n[t.key],id:t.key,valueType:"SIMPLE",dataType:gd[t.type]})})),{degridColumns:o,degridDataItems:r}}(t,this);if(e&&e.degridColumns.length>0){const{degridColumns:t,degridDataItems:i}=e;this.model=it(this.model),this.model.degridColumns=[...(this.model.degridColumns||[]).filter((e=>-1===t.findIndex((t=>t.id===e.id)))),...t],this.model.degridDataItems=[...(this.model.degridDataItems||[]).filter((t=>-1===i.findIndex((e=>e.id===t.id)))),...i]}}async initExportData(){var t;if(this.model.dedataExportId&&(this.dataExport=null==(t=this.dataEntity.appDEDataExports)?void 0:t.find((t=>t.id===this.model.dedataExportId)),this.dataExport&&(this.allExportColumns=await this.findAllExportColumns(this.dataExport))),this.allExportColumns.length>0)this.allExportColumns.forEach((t=>{t.codeListItems&&this.allExportCodelistMap.set(t.appDEFieldId,t.codeListItems)})),this.dataExportParam.fields=this.allExportColumns.map((t=>t.appDEFieldId)),this.dataExportParam.header=this.allExportColumns.map((t=>t.caption));else{Object.keys(this.fieldColumns).forEach((t=>{this.fieldColumns[t].codeList&&this.allExportCodelistMap.set(t,this.fieldColumns[t].codeListItems)}));const{degridColumns:t=[]}=this.model;this.dataExportParam.fields=t.map((t=>t.id)),this.dataExportParam.header=t.map((t=>t.caption))}}async fillExportCodelistMap(){if(this.model.dedataExportId)return;const t=async(t,e)=>{const i=await e.loadCodeList();this.allExportCodelistMap.set(t,i)},e=[];for(const[i,a]of this.allExportCodelistMap)if(!a){const a=this.fieldColumns[i];a.codeListItems?this.allExportCodelistMap.set(i,a.codeListItems):e.push(t(i,a))}e.length>0&&await Promise.all(e)}async initGroup(){if(!this.model.enableGroup)return;const{groupAppDEFieldId:t,groupCodeListId:e,groupMode:a}=this.model;if(this.groupFieldColumn=Object.values(this.fieldColumns).find((e=>e.model.appDEFieldId===t)),!this.groupFieldColumn)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.attributeColumns"));const s=this.groupFieldColumn.model.id;if(!this.groupFieldColumn.model.appCodeListId)throw new i(this.groupFieldColumn.model,ibiz.i18n.t("runtime.controller.control.grid.noCodeTable",{groupFieldName:s}));const n=this.state.columnStates.findIndex((t=>t.key===this.groupFieldColumn.model.codeName));if(-1!==n&&0!==n){if(this.isMultistageHeader)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.configureFirstColumn",{groupFieldName:s}));const t=this.state.columnStates.splice(n,1);this.state.columnStates.unshift(...t)}if("CODELIST"===a){if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.requiresCodeTable"));if(this.groupFieldColumn.model.appCodeListId!==e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.noMatchCodeTable",{groupFieldName:s}))}this.calcColumnFixed()}sortItems(t){const e=this.model.orderValueAppDEFieldId;e&&this.enableRowEditOrder&&(t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>t[e]-i[e])))}async afterLoad(t,e){return this.sortItems(this.state.items),await super.afterLoad(t,e),await Cn(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new pd(t,this);return this.gridStateNotify(e,"LOAD"),e})),await this.updateRows(this.state.rows),this.calcGroupData(e),this.calcAggResult(e),this.calcShowMode(e),e}async updateRows(t){for(const e of t)await Promise.all([...Object.values(e.uaColStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId))),...Object.values(e.uiActionGroupStates).map((t=>t.update(this.context,e.data.getOrigin(),this.model.appDataEntityId)))])}calcGroupData(t){const{enableGroup:e,groupMode:i}=this.model;if(e){const e=new Map,a="CODELIST"===i,s=this.groupFieldColumn.model.id;a&&this.groupCodeListItems.forEach((t=>{e.set(t.value,[])})),t.forEach((t=>{const i=t[s];a||e.has(i)||e.set(i,[]),e.has(i)&&e.get(i).push(t)})),this.state.groups=[],e.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));this.state.groups.push({caption:(null==i?void 0:i.text)||"".concat(e),key:e,children:t})}))}}async loadRemoteAgg(){const{aggMode:t,aggAppDataEntityId:e,aggAppDEDataSetId:a}=this.model;if("ALL"!==t)return;if(!a||!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.missingConfiguration"));const s=await this.getFetchParams(),n=ibiz.hub.getApp(this.context.srfappid),o=await n.deService.exec(e,a,this.context,void 0,s);o.data.length&&([this.state.remoteAggResult]=o.data)}async getFetchParams(t={}){return!0===this.model.enableItemPrivilege&&(t.srfdataaccessaction=!0),super.getFetchParams(t)}calcAggResult(t){Object.values(this.fieldColumns).forEach((e=>{const i=e.calcFieldAgg(t);i&&(this.state.aggResult[e.model.id]=i)}))}afterRemove(t){super.afterRemove(t);const e=this.findRowStateIndex(t);this.state.rows.splice(e,1),this.state.groups.forEach((e=>{if(e.children.length){const i=e.children.findIndex((e=>e.srfkey===t.srfkey));-1!==i&&e.children.splice(i,1)}}))}async newRow(){const{enableRowEdit:t,enableRowNew:e}=this.model,{editShowMode:i}=ibiz.config.grid;if(!t||!e||!["row","all"].includes(i))return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.newRows"));if("row"===i){if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}const a={...this.params},s=this.calcDefaultValue({},!0);let n;Object.assign(a,s);try{n=await this.service.getDraft(this.context,a)}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const r=n.data;L(r,s),this.state.items.unshift(r);const c=new pd(r,this);this.state.rows.unshift(c),this.gridStateNotify(c,"DRAFT"),"row"===i&&this.switchRowEdit(this.state.rows[0],!0),this.actionNotification("GETDRAFTSUCCESS",{data:r})}async save(t){if(this.state.isSimple)return;const e=0===t.srfuf,i=this.findRowState(t);if(!i)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(i.processing)return void await S(500,this.save.bind(this),[t]);if(!await this.validate(i))throw new o(ibiz.i18n.t("runtime.controller.control.grid.saveCancel"));let a;this.model.enableRowEditChangedOnly&&(t=i.getDiffData());const s=Ae(this.model.appDataEntityId),n=this.context.clone();n[s]=t.srfkey;try{a=e?await this.service.create(n,t):await this.service.update(n,t)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(e?"CREATE":"UPDATE","ERROR"),{error:t,data:i.data,rowState:i}),t}const r=this.findRowStateIndex(t);this.state.items.splice(r,1,a.data),i.data=a.data,i.oldData=a.data.clone(),i.modified=!1,this.gridStateNotify(i,"SAVE"),await this._evt.emit("onSaveSuccess",void 0),this.emitDEDataChange(e?"create":"update",a.data)}async saveAll(){const t=this.state.rows.filter((t=>t.modified)).map((t=>t.data));t.length&&await Cn(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await qi(t,this.model);if(!i)return;this.providers[t.codeName]=i;const a=await i.createController(t,this);this.columns[t.codeName]=a,"DEFGRIDCOLUMN"===t.columnType||"DEFTREEGRIDCOLUMN"===t.columnType?(this.fieldColumns[t.codeName]=a,t.enableRowEdit&&(this.editColumns[t.codeName]=a)):"UAGRIDCOLUMN"===t.columnType?this.uaColumns[t.codeName]=a:"GROUPGRIDCOLUMN"===t.columnType&&(this.isMultistageHeader=!0,await Promise.all((null==(e=t.degridColumns)?void 0:e.map((async t=>{await this.initColumnsController(t)})))||[]))}initColumnStates(){this.state.columnStates=[];const t=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));if(t){const e=JSON.parse(t);this.addSchemaColumn&&e.schemaColumnStates?this.state.columnStates=e.schemaColumnStates:!this.addSchemaColumn&&e.defaultColumnStates&&(this.state.columnStates=e.defaultColumnStates)}0===this.state.columnStates.length&&r(this.model,(t=>{"GROUPGRIDCOLUMN"!==t.columnType&&this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault||!!t.hiddenDataItem,uaColumn:"UAGRIDCOLUMN"===t.columnType,adaptive:"STAR"===t.widthUnit})}),{childrenFields:["degridColumns"]}),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length,{frozenFirstColumn:i,frozenLastColumn:a}=this.model;this.hasAdaptiveColumn=!1,t.forEach(((t,s)=>{t.adaptive&&(this.hasAdaptiveColumn=!0),t.uaColumn?t.fixed=s+1<=Math.floor(e/2)?"left":"right":i&&s<i?t.fixed="left":a&&s>=e-a&&(t.fixed="right")}))}async initGridColumns(){this.model.degridColumns&&await Promise.all(this.model.degridColumns.map((async t=>this.initColumnsController(t))))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||hr(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e]),await this._evt.emit("onGridDataChange",{data:this.state.rows.map((t=>t.data))})}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Cn(Object.values(this.editColumns).map((async i=>i.dataChangeNotify(t,e))))}gridStateNotify(t,e){Object.values(this.editColumns).forEach((i=>{i.gridStateNotify(t,e)}))}async validate(t){return-1===(await Promise.all(Object.values(this.editColumns).map((e=>e.validate(t))))).findIndex((t=>!t))}async toggleRowEdit(){if(!this.model.enableRowNew)throw new o(ibiz.i18n.t("runtime.controller.control.grid.noSupportRowEditing"));this.state.rowEditOpen=!this.state.rowEditOpen}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)await this.save(t.data);else{if(0===t.data.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(this.state.rows.find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.editColumns).forEach((e=>{t.editColStates[e.fieldName].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}setSort(t,e){let i;t&&(i=this.fieldIdNameMap.get(t).toLowerCase()),super.setSort(i,e)}async updateGridEditItem(t,e){var i;const a=null==(i=this.model.degridEditItemUpdates)?void 0:i.find((t=>t.id===e));if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.grid.updateColumns",{updateId:e}));const{appDEMethodId:s,degeiupdateDetails:n,customCode:r,scriptCode:c}=a,d=n.map((t=>t.id));let l;if(r&&c)l=ei.execScriptFn({...this.getEventArgs(),data:t.data},c,{isAsync:!1});else{const e={...this.params,...t.data.getOrigin()},i=await this.service.updateGridEditItem(s,this.context,e);l=i.data}l&&(null==d?void 0:d.length)&&await Promise.all(d.map((e=>this.setRowValue(t,e,l[e]))))}async loadData(t){const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam);let a;await this.startLoading();try{a=await this.service.fetch(e,i)}finally{await this.endLoading()}return a.data}async findAllExportColumns(t){var e;const i=ibiz.hub.getApp(this.context.srfappid),a=null==(e=t.dedataExportItems)?void 0:e.map((async t=>{const e={...t};return t.codeListId&&(e.codeList=i.codeList.getCodeList(t.codeListId),e.codeListItems=await i.codeList.get(t.codeListId,this.context)),e}));return a?Promise.all(a):[]}formatExcelData(t){const{fields:e=[]}=this.dataExportParam,i=it(t.map((t=>e.reduce(((e,i)=>(e[i]=t[i],e)),{}))));return i.forEach((t=>{Object.keys(t).forEach((e=>{var i;let a=t[e];const s=this.allExportColumns.find((t=>t.appDEFieldId===e)),n=this.fieldColumns[e],o=(null==s?void 0:s.format)||(null==n?void 0:n.valueFormat),r=(null==n?void 0:n.model.unitName)||"";a=this.allExportCodelistMap.get(e)?(null==(i=this.allExportCodelistMap.get(e).find((i=>i.value===t[e])))?void 0:i.text)||a:this.formatValue(o,a)+r,t[e]=a}))})),i}async getExportData(t){var e;const{type:i}=t;let a=[];if(i&&"activatedPage"!==i)if("maxRowCount"===i||"customPage"===i){const{size:s}=this.state,{startPage:n,endPage:o}=t,r="customPage"===i?{page:0,offset:(n-1)*s,size:(o-n+1)*s}:{size:(null==(e=this.dataExport)?void 0:e.maxRowCount)||1e3,page:0};a=await this.loadData({viewParam:r})}else"selectedRows"===i&&(a=this.getData());else a=this.state.rows.map((t=>t.data));if(0===a.length)throw new o(ibiz.i18n.t("runtime.controller.control.grid.exported"));return a}async exportData(t){const{header:e}=this.dataExportParam;if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.grid.tabularColumns"));await this.fillExportCodelistMap();const i=await this.getExportData(t.params),a=this.formatExcelData(i).map((t=>Object.values(t)));await br(e,a,this.model.logicName)}calcDefaultValue(t,e){const i={};return Object.values(this.editColumns).forEach((a=>{const{createDV:s,createDVT:n,updateDV:o,updateDVT:r}=a.editItem,c=e?n:r,d=e?s:o,l=fr({name:a.fieldName,valueType:c,defaultValue:d,valueFormat:a.valueFormat},{data:t,context:this.context,params:this.params});void 0!==l&&(i[a.fieldName]=l)})),i}findRowStateIndex(t){const e=0===t.srfuf?"tempsrfkey":"srfkey";return this.state.rows.findIndex((i=>i.data[e]===t[e]))}findRowState(t){const e=this.findRowStateIndex(t);return-1!==e?this.state.rows[e]:void 0}async onRowClick(t){this.setSelection([t]),1===this.state.mdctrlActiveMode&&await this.setActive(t)}convertMultipleLanguages(){const t=e=>{e.forEach((e=>{e.capLanguageRes&&e.capLanguageRes.lanResTag&&(e.caption=ibiz.i18n.t(e.capLanguageRes.lanResTag,e.caption)),"GROUPGRIDCOLUMN"===e.columnType&&e.degridColumns&&t(e.degridColumns)}))};this.model.degridColumns&&this.model.degridColumns.length>0&&t(this.model.degridColumns)}setColumnVisible(t){t.hidden=!t.hidden,this.calcColumnFixed(),this.saveColumnStates()}setGroupParams(t){t.sort?(this.state.sortQuery=t.sort,this.isSetSort=!0):this.state.sortQuery="",t.columnstates?(this.state.columnStates=t.columnstates,this.calcColumnFixed()):this.initColumnStates()}changeColumnStateSort(t,e,i){const a=this.state.columnStates.find((e=>e.key===t));a&&(this.state.columnStates.splice(i,1),this.state.columnStates.splice(e,0,a),this.calcColumnFixed(),this.saveColumnStates())}saveColumnStates(){let t={};const e=localStorage.getItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"));e&&(t=JSON.parse(e)),this.addSchemaColumn?t.schemaColumnStates=this.state.columnStates:t.defaultColumnStates=this.state.columnStates,localStorage.setItem("".concat(this.view.model.id,".").concat(this.model.name,".columnStates"),JSON.stringify(t))}actionNotification(t,e){if((null==e?void 0:e.error)&&(null==e?void 0:e.rowState)&&e.error instanceof P){const{details:t}=e.error,{errors:i}=e.rowState;t.forEach((t=>{i[t.name]=t.errorInfo}))}super.actionNotification(t,{...e||{}})}async onDragChange(){const t=this.model.orderValueAppDEFieldId,e=this.state.rows.map((t=>t.data));let i;const a=[];e.forEach((e=>{var s;void 0===i?(i=e[t]||100,e[t]||(e[t]=i,a.push(e))):((!e[t]||i>=e[t])&&(e[t]=(s=i)+(100-s%100),a.push(e)),i=e[t])})),this.updateChangedItems(a)}async updateChangedItems(t){try{await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.update(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{await this.afterLoad({},this.state.items)}}}),yd=t("GridFieldColumnController",class extends ud{constructor(){super(...arguments),this.codeList=void 0}get isLinkColumn(){return!!this.model.enableLinkView&&!!this.model.linkAppViewId}get hasAction(){return!!this.model.deuiactionId}get fieldName(){return this.model.id.toLowerCase()}async onInit(){await super.onInit(),this.loadCodeList=U(this.loadCodeList,300,{leading:!0,trailing:!1}),this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.model;if(e&&e.uiactionGroupDetails){const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.grid.context.srfappid,e);i.addState(t.id,a)}})),t.uiActionGroupStates[this.model.codeName]=i}}clickable(t){const e=t.data[this.fieldName];return(this.isLinkColumn||this.hasAction)&&e}handlePublicParams(t,e,i){const{userParam:a}=this.model;if(!a)return{context:e,params:i};const{navigateContexts:s,navigateParams:n}=we(a);let o={};s&&t&&(o=he(s,t,i,e));const r=Object.assign(e.clone(),o);let c={};n&&t&&(c=he(n,t,i,e));return{context:r,params:{...i,...c}}}async openLinkView(t,e){if(!t.data[this.fieldName])return;const i=this.model.linkValueItem||"srfkey",s=t.data[i];if(null==s)throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.pickedUpData",{valueItem:i}));const{linkAppViewId:n}=this.model;if(!n)return;const o=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:s,...o}),c=it(this.params),{context:d,params:l}=this.handlePublicParams(t.data,r,c),h=await ibiz.commands.execute(Wo.TAG,n,d,l,{event:e});(null==h?void 0:h.ok)&&this.grid.load()}async triggerAction(t,e){const i=this.model.deuiactionId;await Lc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.grid.view,event:e},this.model.appId)}async loadCodeList(){const t=this.model.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}calcFieldAgg(t){const{aggField:e,aggMode:i,aggValueFormat:s,unitName:n}=this.model;if(Z(i)||"NONE"===i)return;const o=e||this.model.id;let r;if(t=t.filter((t=>!Z(t[o]))),"PAGE"!==this.grid.model.aggMode)throw"ALL"===this.grid.model.aggMode?new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.remoteAggregation")):new a(this.grid.model,ibiz.i18n.t("runtime.controller.control.grid.aggregateMode",{aggMode:this.grid.model.aggMode}));switch(i){case"SUM":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0);break;case"AVG":r=t.map((t=>t[o])).reduce(((t,e)=>M(t,e)),0)/t.length;break;case"MAX":r=Math.max(...t.map((t=>t[o])));break;case"MIN":r=Math.min(...t.map((t=>t[o])));break;default:throw new a(this.model,ibiz.i18n.t("runtime.controller.control.grid.noSupportedMode",{aggMode:i}))}let c="".concat(r);if(s)try{c=ibiz.util.text.format("".concat(r),s)}catch(t){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.formattingError",{aggValue:r}))}return c&&n&&(c+=n),c}formatValue(t=""){if("SIMPLE"!==this.model.valueType)return gr.toText(this.model,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async onActionClick(t,e,i){const a=t.uiactionId;await Lc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),wd=(t("GridUAColumnController",class extends ud{initActionStates(t){var e;const{deuiactionGroup:a}=this.model;if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.grid.behaviorGroup"));if(!(null==(e=a.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const s=new rr;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new or(t.id,this.grid.context.srfappid,e);s.addState(t.id,i)}})),t.uaColStates[this.model.codeName]=s}async onActionClick(t,e,i){const a=t.uiactionId;await Lc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends yd{constructor(){super(...arguments),this.rules=[]}get unitName(){return this.editItem.unitName}get valueFormat(){return this.model.valueFormat}get valueItemName(){if(this.editItem.editor)return this.editItem.editor.valueItemName}async onInit(){await super.onInit();const t=Oe(this.grid.model,this.model.codeName);t&&(this.editItem=t,this.editItem.editor&&"HIDDEN"!==this.editItem.editor.editorType&&(this.editorProvider=await Wi(this.editItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.editItem.editor,this),await this.initRules())))}async initRules(){this.rules=[];const t=Ii(this.grid.model.degridEditItemVRs||[],this.fieldName);t&&this.rules.push(...pr(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...mr(this.editItem.editor)),this.rules.length>0&&(this.validator=new At({[this.fieldName]:this.rules}))}async setRowValue(t,e,i){i=i||this.fieldName,await this.grid.setRowValue(t,i,e)}async dataChangeNotify(t,e){const{resetItemNames:i}=this.editItem;let a=!1;i&&i.length>0&&i.forEach((t=>{e.includes(t)&&(a=!0)})),a&&this.setRowValue(t,null),this.calcColumnDisabled(t);const s=t.editColStates[this.fieldName].required;this.calcColumnRequired(t);if(s!==t.editColStates[this.fieldName].required||e.includes(this.fieldName)||e.includes(this.valueItemName)){if(!await this.validate(t))throw new o(ibiz.i18n.t("runtime.controller.control.grid.checksumErrors",{codeName:this.editItem.codeName,fieldName:t.errors[this.fieldName]}))}e.includes(this.fieldName)&&this.editItem.degridEditItemUpdateId&&await this.grid.updateGridEditItem(t,this.editItem.degridEditItemUpdateId)}gridStateNotify(t,e){this.calcColumnDisabled(t),this.calcColumnReadonly(t),this.calcColumnRequired(t)}calcColumnDisabled(t){let e=this.calcEnableCond(t);if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemEnable(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].disabled=!e}calcColumnRequired(t){let e=!1!==this.editItem.allowEmpty;if(e&&this.grid.scheduler){const i=this.grid.scheduler.triggerItemBlank(this.fieldName,{data:[t.data]});void 0!==i&&(e=i)}t.editColStates[this.fieldName].required=!e}calcColumnReadonly(t){var e;const i=!!(null==(e=this.editItem.editor)?void 0:e.readOnly);i&&(t.editColStates[this.fieldName].readonly=i)}calcEnableCond(t){const{enableCond:e}=this.editItem,i=0===t.data.srfuf;switch(e){case 0:return!1;case 1:return i;case 2:return!i;default:return!0}}async validate(t){const e=this.fieldName;if("cell"!==ibiz.config.grid.editShowMode&&!0===t.editColStates[e].required&&("string"==typeof t.data[e]?dt(t.data[e].trimEnd()):dt(t.data[e])))return t.errors[e]=ibiz.i18n.t("runtime.controller.control.form.fillIn",{caption:this.model.caption||""}),!1;if(this.rules.length&&this.validator)try{await this.validator.validate(t.data)}catch(i){const{errors:a}=i;return t.errors[e]=a[0].message,!1}return t.errors[e]=null,!0}}),t("GridGroupColumnController",class extends ud{}),t("ListService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),Ed=(t("ListController",class extends zr{initState(){super.initState(),this.state.noSort=!0===this.model.noSort;const{enablePagingBar:t}=this.model;this.state.enablePagingBar=t}async onCreated(){await super.onCreated(),this.state.size=this.model.pagingSize||20,this.service=new wd(this.model),await this.service.init(this.context)}getSortModel(){return{minorSortAppDEFieldId:this.model.minorSortAppDEFieldId,minorSortDir:this.model.minorSortDir}}async loadMore(){this.state.total>this.state.items.length&&await this.load({isLoadMore:!0})}calcShowMode(t){const{enablePagingBar:e}=this.model;this.state.hideNoDataImage=!1,this.state.enablePagingBar=e;const i=this.controlParams.showmode||"DEFAULT";"ONLYDATA"===i&&(this.state.enablePagingBar=!1,0===t.length&&(this.state.hideNoDataImage=!0)),"MIXIN"===i&&0===t.length&&(this.state.enablePagingBar=!1,this.state.hideNoDataImage=!0)}async afterLoad(t,e){return await this.handleDataGroup(),this.calcShowMode(e),e}setData(t){this.state.items=t}getAllData(){return this.state.items}async handleDataGroup(){const{enableGroup:t,groupMode:e}=this.model;t&&e&&("AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup())}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=i.get(e[t])||[];a.push(e),i.set(e[t],a)}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(t&&e){const{items:i}=this.state,a=[],s=ibiz.hub.getApp(this.context.srfappid),n=await s.codeList.get(e,this.context,this.params),o=[];n.forEach((e=>{const s=i.filter((i=>i[t]===e.value));a.push({caption:e.text,key:e.value,children:[...s]}),o.push(e.value)}));const r=i.filter((e=>-1===o.indexOf(e[t])));r.length>0&&a.push({caption:"其他",key:"其他",children:[...r]}),this.state.groups=a}}}),t("PanelController",class extends Fr{constructor(t,e,i,a,s){super(t,e,i,a),this.hooks={validate:new lt},this.panelItems={},this.providers={},this.container=s}get _evt(){return this.evt}get data(){return this.state.data}initState(){super.initState(),this.state.data={}}setInputData(t){this.inputData=t}getData(){return[this.data]}async onCreated(){var t;await super.onCreated(),await this.initPanelItemControllers(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this._evt.on("onPanelItemEvent",(t=>{this.scheduler.triggerControlEvent(t.panelItemName,t.panelItemEventName,t)}))}async onMounted(){this.load()}async onDestroyed(){var t,e;await super.onDestroyed(),null==(e=(t=this.data).destroy)||e.call(t),this.hooks.validate.clear(),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}async validate(t){const e=[];return await this.hooks.validate.call({result:e,parentId:t}),e.every((t=>t))}async initPanelItemControllers(t=this.model.rootPanelItems,e=this,i=void 0){t&&await Promise.all(t.map((async t=>{var a,s;const n=await $i(t,e.model,e.view.model);if(!n)return;e.providers[t.id]=n;const o=await n.createController(t,e,i);e.panelItems[t.id]=o,(null==(a=t.panelItems)?void 0:a.length)&&!o.isDataContainer&&await this.initPanelItemControllers(t.panelItems,e,o),(null==(s=t.panelTabPages)?void 0:s.length)&&await this.initPanelItemControllers(t.panelTabPages,e,o)})))}async load(){var t,e;const i=await this.prepareData();if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.panel.panelData"));const a=this.convertData(i);null==(e=(t=this.data).destroy)||e.call(t),this.state.data=a,this.panelStateNotify("LOAD")}async prepareData(){let t;if(1===this.model.dataMode)this.inputData&&(t=this.inputData);else t=this.inputData||{};return t}convertData(t){const e=Ge(this.model),i=e.map((t=>t.id)),a=new cn(e,t);return a._evt.on("change",(t=>{i.includes(t)&&this.dataChangeNotify([t])})),a}dataChangeNotify(t){Object.values(this.panelItems).forEach((e=>{e.dataChangeNotify(t)}))}panelStateNotify(t){Object.values(this.panelItems).forEach((e=>{e.panelStateNotify(t)}))}async setDataValue(t,e){Object.prototype.hasOwnProperty.call(this.state.data,t)&&this.state.data[t]===e||(this.state.data[t]=e)}initControlScheduler(t=[]){const e=[...t];r(this.model,(t=>{t.controlLogics&&e.push(...t.controlLogics)}),{childrenFields:["rootPanelItems","panelItems","panelTabPages"]}),super.initControlScheduler(e)}})),vd=(t("ViewLayoutPanelController",class extends Ed{async onCreated(){var t;this.preprocessModel(),await super.onCreated(),(null==(t=this.scheduler)?void 0:t.hasControlEventTrigger)&&this.evt.on("onControlEvent",(t=>{this.scheduler.triggerControlEvent(t.triggerControlName,t.triggerEventName,t.triggerEvent)}))}registerToCtx(){}preprocessModel(t){var e;const i=t=>{const e=[];return t.forEach((t=>{"CONTAINER"===t.itemType&&"PANELPART"===t.predefinedType?e.push(...t.panelItems||[]):e.push(t)})),e.forEach((t=>{"CONTAINER"===t.itemType&&this.preprocessModel(t)})),e};t?t.panelItems=i(t.panelItems||[]):(null==(e=this.model.rootPanelItems)?void 0:e.length)&&(this.model.rootPanelItems=i(this.model.rootPanelItems||[]))}}),t("PanelItemState",class{constructor(t){this.parent=t,this.disabled=!1,this.layout={width:"",height:"",extraStyle:{},extraClass:[],contentStyle:{}},this.class={container:[],containerDyna:[],label:[],labelDyna:[]},this.required=!1,this.readonly=!1;let e,i,a=!0;Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,get(){var t;return!1!==(null==(t=this.parent)?void 0:t.visible)&&a},set:t=>(a=t,!0)}),Object.defineProperty(this,"keepAlive",{enumerable:!0,configurable:!0,get(){return void 0!==e?e:!!this.parent&&this.parent.keepAlive},set:t=>(e=t,!0)}),Object.defineProperty(this,"readonly",{enumerable:!0,configurable:!0,get(){return void 0!==i?i:!!this.context&&!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly)},set:t=>(i=t,!0)})}})),Id=(t("PanelItemController",class{constructor(t,e,i){this.model=t,this.panel=e,this.parent=i,this.dynaLogicResult={visible:void 0,disabled:void 0,required:void 0},this.state=this.createState(),this.state.context=this.panel.context}get dataParent(){return this.findDataParent(this)}get data(){return this.dataParent.data}get containerClass(){return[...this.state.class.container,...this.state.class.containerDyna]}get labelClass(){return[...this.state.class.label,...this.state.class.labelDyna]}async init(){var t;!!(null==(t=this.model.panelItemGroupLogics)?void 0:t.find((t=>"PANELVISIBLE"===t.logicCat)))&&(this.state.visible=!1),this.panel.hooks.validate.tapPromise((async t=>{t.parentId&&t.parentId!==this.dataParent.model.id||t.result.push(await this.validate())})),await this.onInit()}async onInit(){const{layoutPos:t,sysCss:e,labelSysCss:i}=this.model;if(t){const{width:e,height:i}=Ie(t);this.state.layout.width="".concat(e),this.state.layout.height="".concat(i)}(null==e?void 0:e.cssName)&&this.state.class.container.push(e.cssName),(null==i?void 0:i.cssName)&&this.state.class.label.push(i.cssName)}destroy(){}async validate(){return!0}createState(){var t;return new vd(null==(t=this.parent)?void 0:t.state)}async dataChangeNotify(t){this.calcDynamicLogic(t),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}async panelStateNotify(t){this.calcDynamicLogic([],!0),this.calcItemDisabled(this.data),this.calcItemVisible(this.data),this.calcItemRequired(this.data),this.calcDynaClass(this.data)}calcItemDisabled(t){let{disabled:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemEnable(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.disabled=e)}calcItemVisible(t){let{visible:e}=this.dynaLogicResult;if(!1!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemVisible(this.model.id,{data:[t]});void 0!==i&&(e=i)}void 0!==e&&(this.state.visible=e)}calcItemRequired(t){let{required:e}=this.dynaLogicResult;if(!0!==e&&this.panel.scheduler){const i=this.panel.scheduler.triggerItemBlank(this.model.id,{data:[t]});void 0!==i&&(e=!i)}void 0!==e&&(this.state.required=e)}calcDynamicLogic(t,e=!1){var i;this.parent&&!this.parent.state.visible||null==(i=this.model.panelItemGroupLogics)||i.forEach((i=>{const a=i.relatedItemNames||[];if(e||T(a,t))try{const t=ni(this.data,i);switch(i.logicCat){case"ITEMBLANK":this.dynaLogicResult.required=!t;break;case"ITEMENABLE":this.dynaLogicResult.disabled=!t;break;case"PANELVISIBLE":this.dynaLogicResult.visible=t}}catch(t){ibiz.log.error(t)}}))}findDataParent(t){const{parent:e}=t;return e?e.isDataContainer?e:this.findDataParent(e):t.panel}calcDynaClass(t){if(this.model.dynaClass){const e=be(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=be(this.model.labelDynaClass,t);e.length&&(this.state.class.labelDyna=e)}}onClick(){this.panel.evt.emit("onPanelItemEvent",{panelItemName:this.model.id,panelItemEventName:"onClick"})}}),t("PickupViewPanelController",class extends Fr{async onCreated(){await super.onCreated(),this.mountCounter.enroll(this.model.embeddedAppDEViewId)}updateContextParams(t){super.updateContextParams(t),this.initNavParam()}initNavParam(){const{navigateContexts:t,navigateParams:e}=this.model,i=this.context.clone(),a={...this.params};t&&Object.assign(i,he(t,this.params,this.context)),e&&Object.assign(a,he(e,this.params,this.context)),this.state.context=i,this.state.params=a}setEmbedView(t){this.embedView=t,this.embedView.state.isMounted?this.mountCounter.attend(this.model.embeddedAppDEViewId):this.embedView.evt.on("onMounted",(()=>{this.mountCounter.attend(this.model.embeddedAppDEViewId)})),this.embedView.evt.on("onSelectionChange",(t=>{this.evt.emit("onSelectionChange",t)})),this.embedView.evt.on("onDataActive",(t=>{this.evt.emit("onDataActive",{data:t.data})}))}async getSelectedData(){return await this.embedView.call("GetData")}async getAllData(){return await this.embedView.call("GetAllData")}}),t("ItemsValueOPs",["EXISTS","NOTEXISTS"])),bd=/^N_(.\w+)_(.\w+)$/;function Dd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Cd(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Ad(t){const e=t.split("__")[1].match(bd);return{field:e[1],op:e[2]}}var Pd=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],Td=/\$\{[^}]*\}/,Nd=t("SearchBarFilterController",class{constructor(t,e,i,a){var s;let n;this.model=t,this.appDataEntity=e,this.context=i,this.params=a,this.noEditor=!1,this.type="FIELD",this.hidden=Cd(t),t.appDEFieldId&&(n=xe(this.appDataEntity,t.appDEFieldId)),this.fieldName=n?n.codeName.toLowerCase():t.id,this.key=this.fieldName,this.label=t.caption||(null==n?void 0:n.logicName)||t.id,this.valueOP=null==(s=t.defsearchMode)?void 0:s.valueOP,this.noEditor=this.valueOP?Pd.includes(this.valueOP):!this.model.editor}get valueItem(){return this.editor?this.editor.valueItem:void 0}async init(){if(!this.noEditor){if(!this.model.editor)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.searchBar.missingModel"));this.editorProvider=await Wi(this.model.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.model.editor,this))}}calcEditorProps(t){const e={};let i=t.value;return t.disabled&&Td.test(i)&&(i=i.replace("${context.srfpersonid}","当前用户"),i=i.replace("${context.srforgid}","当前组织")),this.valueItem&&(e[this.valueItem]=t.valueItem),{value:i,data:e}}onEditorChange(t,e,i){this.valueItem&&i===this.valueItem?t.valueItem=e:t.value=e}}),xd=class{constructor(t,e){this.themeUrl="/extension/app_view_themes",this.model=t,this.viewTag=e}async init(t){this.app=ibiz.hub.getApp(this.model.appId)}async fetch(){const t=[{condop:"EQ",condtype:"DEFIELD",fieldname:"app_view_tag",value:this.viewTag}],e=await this.app.net.post("".concat(this.themeUrl,"/fetch_cur_user_all"),{searchconds:t,sort:"create_time,asc"});return e.ok&&(e.data=this.convertBackDataToFront(e.data)),e}async get(t){const e=await this.app.net.get("".concat(this.themeUrl,"/").concat(t));return e.ok&&([e.data]=this.convertBackDataToFront([e.data])),e}async remove(t){return await this.app.net.delete("".concat(this.themeUrl,"/").concat(t))}async create(t){return await this.app.net.post("".concat(this.themeUrl),{name:"".concat(this.viewTag,"___").concat(t),caption:t,app_tag:this.model.appId,app_view_tag:this.viewTag})}async createWithParams(t,e){return await this.app.net.post("".concat(this.themeUrl),{name:t.name,caption:t.caption,app_tag:this.model.appId,app_view_tag:this.viewTag,theme_model:JSON.stringify(e),valid_flag:t.show?1:0})}async createBatch(t){const e=this.convertFrontDataToBack(t);return await this.app.net.post("".concat(this.themeUrl),e)}async update(t,e){const[i]=this.convertFrontDataToBack([e]);return await this.app.net.put("".concat(this.themeUrl,"/").concat(t),i)}async updateBatch(t){const e=this.convertFrontDataToBack(t),i=e.map((t=>t.id)).join(";");return await this.app.net.put("".concat(this.themeUrl,"/").concat(i),e)}convertBackDataToFront(t){return t.map((t=>{const e={...t};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.theme_model&&(e.searchGroupData=JSON.parse(t.theme_model)),"number"==typeof t.valid_flag&&(e.show=1===t.valid_flag),t.order_value&&(e.order=t.order_value),e}))}convertFrontDataToBack(t){return t.map((t=>{const e={app_tag:this.model.appId,app_view_tag:this.viewTag};return t.id&&(e.id=t.id),t.name&&(e.name=t.name),t.caption&&(e.caption=t.caption),t.searchGroupData&&Object.keys(t.searchGroupData).length>0&&(e.theme_model=JSON.stringify(t.searchGroupData)),"boolean"==typeof t.show&&(e.valid_flag=t.show?1:0),t.order&&(e.order_value=t.order),e}))}},Sd="",Ld={string:["EQ","NOTEQ","ISNULL","ISNOTNULL","USERLIKE","LIKE","LIFTLIKE","RIGHT_LIKE"],number:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"],date:["EQ","GT","GTANDEQ","LT","LTANDEQ","NOTEQ","ISNULL","ISNOTNULL","IN","NOTIN"]},Md={};function Rd(t,e){if(t.enumSource)return{appId:Sd,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Md["".concat(t.type,"_").concat(e)]}async function Od(t,e,i){var a;if(!t.properties)return[];const{properties:s}=t;if(!(Object.keys(s).length>0))return[];const n=[];Object.keys(s).forEach((t=>{let e;switch(s[t].type){case"string":e="string","date-time"===s[t].format&&(e="date");break;case"integer":case"number":e="number";break;default:return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:s[t].type}))}n.push({key:t,description:s[t].description,type:e,enumSource:s[t].enumSource})}));const o={};null==(a=(await ibiz.hub.getAppDataEntity(e,i)).appDEFields)||a.forEach((t=>{o[t.codeName.toLowerCase()]=t.id}));const r=[];return n.forEach((t=>{const e=Ld[t.type];e?e.forEach((e=>{t&&r.push({appId:Sd,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:Sd,valueOP:e},editor:Rd(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(Ld).forEach((t=>{Ld[t].forEach((e=>{if(Pd.includes(e))return;const i="".concat(t,"_").concat(e);Md[i]||("date"!==t||["IN","NOTIN"].includes(e)?Md[i]={appId:Sd,editorType:"TEXTBOX",id:i}:Md[i]={appId:Sd,editorType:"DATEPICKER",id:i})}))}));var _d=/^N_(.\w+)_(.\w+)$/,Fd=t("SearchBarFilterItemsController",class extends Nd{constructor(t,e,i,a){super(t[0],e,i,a),this.filterModels=t,this.allFields=[],this.subFilterCMap=new Map,this.type="ITEMS"}calcKey(t,e){return"".concat(t.toUpperCase(),"_").concat(e.toUpperCase())}async initMinorAppDE(){var t;const e=this.filterModels[0].appDEFieldId;let i="";if(null==(t=this.appDataEntity.appDEMethodDTOs)||t.find((t=>{var a;const s=null==(a=t.appDEMethodDTOFields)?void 0:a.find((t=>t.appDEFieldId===e));return!!s&&(i=s.refAppDataEntityId,!0)})),!i)throw new o(ibiz.i18n.t("runtime.controller.control.searchBar.noFoundEntity",{targetField:e}));this.minorAppDE=await ibiz.hub.getAppDataEntity(i,this.context.srfappid)}async initAllFields(){var t;const e=new Map;this.filterModels.forEach((t=>{var i;const a=(null==(i=t.defsearchMode.codeName)?void 0:i.split("__")[1]).match(_d),s=a[1],n=a[2],o=it(t);o.defsearchMode.valueOP=n,o.id=s;const r=new Nd(o,this.appDataEntity,this.context,this.params);this.subFilterCMap.set(this.calcKey(s,n),r),r.hidden||(e.has(s)||e.set(s,{name:s,label:"",valueOPs:[],fieldName:s}),e.get(s).valueOPs.push(n))})),null==(t=this.minorAppDE.appDEFields)||t.forEach((t=>{const i=t.codeName.toUpperCase();e.has(i)&&(e.get(i).label=t.logicName)})),this.allFields=Array.from(e.values()),await Promise.all(Array.from(this.subFilterCMap.values()).map((t=>t.init())))}async init(){await this.initMinorAppDE(),await this.initAllFields(),this.hidden=Array.from(this.subFilterCMap.values()).every((t=>t.hidden))}getSubFilterController(t,e){return this.subFilterCMap.get(this.calcKey(t,e))}});function zd(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function Vd(t){const e={pass:!1};let i=!1,a=!1;return r(t[0],(t=>{a||("FIELD"===t.nodeType?(i=!0,a=!t.field||!t.valueOP||!Pd.includes(t.valueOP)&&Z(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function kd(t,e){let i;if("GROUP"===t.nodeType){const a={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(a.searchconds=t.children.map((t=>kd(t,e)))),i=a,t.notMode&&(a.notmode=t.notMode)}else if("FIELD"===t.nodeType){const e={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(e.value=t.valueItem),i=e}else{const a={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(a.searchconds=t.children.map((t=>kd(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function Ud(t,e){const{pass:i}=Vd(t);if(!i)return;return t.map((t=>kd(t,e)))}function Bd(t){var e,i;let a;if("GROUP"===t.condtype){const i={logicType:t.condop,nodeType:"GROUP",children:[]};(null==(e=t.searchconds)?void 0:e.length)&&(i.children=t.searchconds.map((t=>Bd(t)))),a=i,t.notmode&&(i.notMode=t.notmode)}else if("DEFIELD"===t.condtype){const e={nodeType:"FIELD",field:t.fieldname,value:t.value,valueOP:t.condop};t.valueItem&&(e.valueItem=t.valueItem),a=e}else{const e={nodeType:"ITEMS",field:t.fieldname,valueOP:t.condop,children:[]};(null==(i=t.searchconds)?void 0:i.length)&&(e.children=t.searchconds.map((t=>Bd(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function Wd(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>Wd(t)))),e=i,t.notMode&&(i.notmode=t.notMode)}else if("FIELD"===t.nodeType){const i={condtype:"DEFIELD",fieldname:t.field,value:t.value,condop:t.valueOP};t.valueItem&&(i.valueItem=t.valueItem),e=i}else{const i={condop:t.valueOP,fieldname:t.field,condtype:"ITEMS"};t.children.length>0&&(i.searchconds=t.children.map((t=>Wd(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function Gd(t){const{pass:e}=Vd(t);if(!e)return;return t.map(Wd)}var jd=t("SearchBarFilterSimpleItemsController",class extends Nd{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const s=Ad(t.defsearchMode.codeName);this.subFieldName=s.field,this.subValueOP=s.op}addSimpleFilterNode(t){Object.assign(t,{simple:!0,field:this.fieldName,nodeType:"ITEMS",valueOP:this.valueOP,children:[{nodeType:"FIELD",field:this.subFieldName,valueOP:this.subValueOP,value:null}]})}}),Kd=/\$\{[^}]*\}/,Hd=(t("SearchBarController",class extends Fr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!1,this.enableStorage=!1}get enableFilter(){return!0===this.model.enableFilter}get searchBarFilters(){return this.model.searchBarFilters||[]}get grid(){return this.ctx.getController("grid")||this.ctx.getController("treegrid")}setStorageKeyFn(t){this.storageKeyFn=t}initState(){super.initState(),this.state.query="",this.state.selectedGroupItem=null,this.state.searchBarGroups=[],this.state.selectedSearchGroupItem=null,this.state.advancedQuickSearch=!1,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.state.quickSearchPlaceHolder="",this.resetFilter(),this.state.visible=!!(this.model.enableQuickSearch||this.model.enableGroup||this.enableFilter)}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.enableStorage="true"===this.controlParams.storage;const t=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.context.srfappid);t&&(this.appDataEntity=t,this.calcQuickSearchPlaceholder(),this.initAdvancedQuickSearch()),this.isBackendSearchGroup&&this.view.model.codeName&&(this.service=new xd(this.model,this.view.model.codeName.toLowerCase()),await this.service.init(this.context)),await this.initSearchBarFilters(),await this.initSearBarGroups(!0)}async initByEntitySchema(){var t;if(!this.addSchemaFilters)return;const e=await xr(this.model.appDataEntityId,this.context);if(!e)return;const i=await Od(e,this.model.appDataEntityId,this.model.appId),a=[];null==(t=this.model.searchBarFilters)||t.forEach((t=>{-1===i.findIndex((e=>{var i;return e.appDEFieldId===t.appDEFieldId&&(!(null==(i=t.defsearchMode)?void 0:i.valueOP)||e.defsearchMode.valueOP===t.defsearchMode.valueOP)}))&&a.push(t)})),i.length>0&&(this.model=it(this.model),this.model.searchBarFilters=i.concat(...a),this.model.enableFilter=!0)}calcQuickSearchPlaceholder(){if(!this.appDataEntity)return;const t=this.appDataEntity.appDEFields.filter((t=>t.enableQuickSearch));if(t.length){const e=[];t.forEach((t=>{t.lnlanguageRes&&t.lnlanguageRes.lanResTag?e.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):t.logicName&&e.push(t.logicName)})),e.length>0&&(this.placeHolder=e.join("、"),this.state.quickSearchPlaceHolder=this.placeHolder)}}handleInput(t){this.state.query=t}onSearch(){this.evt.emit("onSearch",void 0)}findFilterController(t,e){return this.filterControllers.find((i=>i.fieldName===t&&(!i.valueOP||i.valueOP===e)))}getFilterParams(){var t;const e={};if(this.state.query&&(e.query=this.state.query,this.state.advancedQuickSearch&&this.state.quickSearchFieldNames.length&&(e.queryconds=this.state.quickSearchFieldNames.map((t=>"n_".concat(t,"_like"))))),(null==(t=this.state.selectedGroupItem)?void 0:t.data)&&"string"==typeof this.state.selectedGroupItem.data&&!this.isBackendSearchGroup){const t=he(ei.execSingleLine(this.state.selectedGroupItem.data),this.params,this.context);Object.assign(e,t)}const i=this.calcFilters();return i&&(e.searchconds=i),e}resetFilter(){this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}],this.evt.emit("onSearch",void 0)}async initSearchBarFilters(){var t;if(null==(t=this.searchBarFilters)?void 0:t.length){const t=new Map;this.searchBarFilters.forEach((e=>{var i;if((null==(i=e.defsearchMode)?void 0:i.valueOP)&&Id.includes(e.defsearchMode.valueOP)){if(Dd(e))return void this.filterControllers.push(new jd(e,this.appDataEntity,this.context,this.params));const i="".concat(e.appDEFieldId,"_").concat(e.defsearchMode.valueOP);return t.has(i)||t.set(i,[]),void t.get(i).push(e)}const a=new Nd(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new Fd(t,this.appDataEntity,this.context,this.params);this.filterControllers.push(e)})),await Promise.all(this.filterControllers.map((t=>t.init())))}}calcFilters(){if(!this.enableFilter)return;return Ud(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&F(t.value)&&Kd.test(t.value)&&(e.value=ei.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){var e;if(this.state.searchBarGroups=[],this.isBackendSearchGroup){this.model.searchBarGroups&&this.model.searchBarGroups.length>0&&(this.state.searchBarGroups=this.model.searchBarGroups.map(((t,e)=>{const i={name:t.id,caption:t.caption,saved:!1,show:!0,searchGroupData:{},order:100*(e+1),defaultSelect:!1,noEdit:!0};if(t.data)try{const e=JSON.parse(t.data);e.theme_model&&(e.theme_model.sort&&(i.searchGroupData.sort=e.theme_model.sort),e.theme_model.columnstates&&(i.searchGroupData.columnstates=e.theme_model.columnstates),e.theme_model.searchconds&&(i.searchGroupData.searchconds=e.theme_model.searchconds)),e.valid_flag&&(i.show="1"===e.valid_flag)}catch(e){ibiz.log.error(ibiz.i18n.t("runtime.controller.control.searchBar.JSONFormat",{data:t.data}),e)}return t.defaultGroup&&(i.defaultSelect=!0),i})));const i=await this.service.fetch();if(i.ok&&i.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)x(e,t),e.saved=!0;else{const e=this.state.searchBarGroups.reduce(((t,e,i)=>e.order>this.state.searchBarGroups[t].order?i:t),0);this.state.searchBarGroups.push({saved:!0,show:!0,searchGroupData:{},order:100*(e+2),...t})}})),this.state.searchBarGroups.sort(((t,e)=>t.order-e.order)),this.state.searchBarGroups.forEach(((t,e)=>{t.order=100*(e+1)})),t&&this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const t=null==(e=this.storageKeyFn)?void 0:e.call(this);if(t){const e=localStorage.getItem(t);if(e){if(this.state.searchBarGroups.find((t=>t.name===e)))return void(this.hasDefaultSelect=!0)}}}this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){var t;if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){if(this.enableStorage){const e=null==(t=this.storageKeyFn)?void 0:t.call(this);if(e){const t=localStorage.getItem(e);if(t){const e=this.state.searchBarGroups.find((e=>e.name===t));if(e)return void this.handleGroupClick(e)}}}const e=this.state.searchBarGroups.find((t=>t.defaultSelect));e&&this.handleGroupClick(e)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:Gd(this.state.filterNodes),sort:this.grid.state.sortQuery,columnstates:this.grid.state.columnStates};if(this.state.selectedSearchGroupItem.saved)await this.service.update(this.state.selectedSearchGroupItem.id,{searchGroupData:t,show:this.state.selectedSearchGroupItem.show,order:this.state.selectedSearchGroupItem.order}),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}));else{const e=await this.service.createWithParams(this.state.selectedSearchGroupItem,t);if(e.ok){const t=this.state.searchBarGroups.find((t=>t.name===e.data.name));t&&(x(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){var e;if(this.enableStorage){const i=null==(e=this.storageKeyFn)?void 0:e.call(this);i&&t.name&&localStorage.setItem(i,t.name)}if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(x(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Bd(t)));this.state.filterNodes=e}else this.state.filterNodes=[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}];r(this.state.filterNodes[0],(t=>{"FIELD"===t.nodeType&&t.field&&t.valueOP&&F(t.value)&&Kd.test(t.value)&&(t.disabled=!0)})),this.grid&&t&&t.searchGroupData&&(this.grid.setGroupParams(t.searchGroupData),await this.grid.load({isInitialLoad:!0}))}initAdvancedQuickSearch(){var t;2===this.model.quickSearchMode&&(null==(t=this.model.searchBarQuickSearchs)?void 0:t.length)&&(this.state.advancedQuickSearch=!0,this.state.quickSearchItems=[],this.state.quickSearchFieldNames=[],this.model.searchBarQuickSearchs.forEach((t=>{const e=xe(this.appDataEntity,t.appDEFieldId),i=e.codeName.toLowerCase();this.state.quickSearchItems.push({fieldName:i,label:e.logicName}),this.state.quickSearchFieldNames.push(i)})),this.calcQuickSearchPlaceHolder())}calcQuickSearchPlaceHolder(){if(this.state.advancedQuickSearch)if(this.state.quickSearchFieldNames.length){const t=[];this.state.quickSearchItems.forEach((e=>{this.state.quickSearchFieldNames.includes(e.fieldName)&&t.push(e.label)})),this.state.quickSearchPlaceHolder=t.join("、")}else this.state.quickSearchPlaceHolder=this.placeHolder}}),t("TabExpPanelController",class extends Fr{constructor(){super(...arguments),this.isShowCaption=!0,this.isShowIcon=!1}get isCache(){return"CACHE"===this.controlParams.expcache||"NO_CACHE"!==this.controlParams.expcache&&ibiz.config.view.expCacheMode.includes(this.model.controlType)}get routeDepth(){return this.view.modal.routeDepth}initState(){super.initState(),this.state.tabPages=[],this.state.activeName="",this.state.expViewParams={}}async onCreated(){await super.onCreated(),this.layoutPanel=this.view.layoutPanel,this.initTabPages(),this.initIconCaption()}initTabPages(){const t=this.model.controls,e=[];t.forEach((t=>{e.push({caption:t.caption,tabTag:t.id,class:t.sysCss?[t.sysCss.cssName]:[],sysImage:t.sysImage})})),this.state.tabPages=e,e.length>0&&this.initDefaultPage()}initIconCaption(){if(this.params.showmode)switch(this.params.showmode){case"ICONANDSHORTWORD":this.isShowIcon=!0,this.isShowCaption=!0;break;case"ICON":this.isShowIcon=!0,this.isShowCaption=!1;break;case"SHORTWORD":this.isShowIcon=!1,this.isShowCaption=!0}}initDefaultPage(){if(this.state.defaultTabName){const t=this.state.tabPages.find((t=>t.tabTag===this.state.defaultTabName));if(t)return this.state.activeName=t.tabTag,void this.changeToTab(this.activeTabViewPanelModel,void 0!==this.routeDepth&&lr(this.routeDepth))}this.state.activeName=this.state.tabPages[0].tabTag,this.handleTabChange()}changeToTab(t=this.activeTabViewPanelModel,e=!1){const i=this.getNavViewMsg(t);!0===e&&(i.isRoutePushed=!0),this.evt.emit("onNavViewChange",{navViewMsg:i}),this.evt.emit("onTabChange",{tab:t})}get activeTabViewPanelModel(){const{activeName:t}=this.state;return this.model.controls.find((e=>e.id===t))}async handleTabChange(){this.activeTabViewPanelModel&&this.changeToTab()}prepareParams(t){const{navDER:e,navFilter:i,navigateContexts:a,navigateParams:s,appDataEntityId:n}=t,o={deName:Ae(n),navFilter:i,pickupDEFName:null==e?void 0:e.pickupDEFName,navContexts:a,navParams:s},r={context:this.context,params:this.params,data:{}},{resultContext:c,resultParams:d}=ge(o,r);return{context:Object.assign(this.context.clone(),c,{currentSrfNav:this.state.activeName}),params:{...d,...this.state.expViewParams}}}getNavViewMsg(t){const{context:e,params:i}=this.prepareParams(t);return{key:t.codeName.toLowerCase(),context:e,params:i,viewId:t.embeddedAppDEViewId,isCache:this.isCache,modalOptions:{replace:!0}}}refresh(){const t=this.getNavViewMsg(this.activeTabViewPanelModel);t.key+=ut(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends cs{async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Re(this.model,{parentId:null==t?void 0:t._nodeId,hasQuery:i});if(0===s.length)return;(await Cn(s.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Re(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];if(t.accessKey){if(!this.app.authority.calcByResCode(t.accessKey))return r}switch(t.treeNodeType){case"STATIC":r=[await this.getStaticNodeData(t,e,i,o)];break;case"DE":r=await this.getDENodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType:t.treeNodeType}))}const{rootNode:c}=t,d=c&&!this.model.rootVisible;return n||await Promise.all(r.map((async(e,i)=>{var a;if(this.calcExpand(t,i)||(null==(a=s.defaultExpandedKeys)?void 0:a.length)&&s.defaultExpandedKeys.includes(e._id)||d){const t=await this.fetchChildNodes(e,s);e._children=t}}))),r}async getStaticNodeData(t,e,i,a){const s=this.calcStaticExpand(t);return new an(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}getNodeRSFilterParams(t,e,i){const{parentValueLevel:a,navigateContexts:s,navigateParams:n,parentFilter:o,parentDER1N:r}=t,c=null==r?void 0:r.pickupDEFName,d={...i.params},l={...i.context,...(null==e?void 0:e._context)||{}};let h,u,p,m={};if(e){h=e;for(let t=1;t<a;t++)h=null==h?void 0:h._parent}if(h){m=h._deData||{};const t=Me(this.model,h._nodeId);t.appDataEntityId&&(p=Ae(t.appDataEntityId)),u=h._value}const{resultContext:g,resultParams:f}=ge({deName:p,navFilter:o?"n_".concat(o.toLowerCase(),"_eq"):void 0,pickupDEFName:c,navParams:n,navContexts:s},{derValue:u,context:l,params:d,data:m});return Object.assign(l,g),Object.assign(d,f),{context:l,params:d,navContext:g,navParams:f}}async getDENodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map(((e,s)=>{const n=this.calcExpand(t,s);return new en(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new Zs(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}async removeItem(t,e,i={}){var a;const s=(null==(a=this.model.removeControlAction)?void 0:a.appDEMethodId)||"remove";return await this.execWithEntityId(t,s,e,void 0,i)}async execWithEntityId(t,e,i,a,s){const n=this.handleCustomRequestHeader();return await this.app.deService.exec(t,e,i,a,s,n)}calcExpand(t,e){const{expandFirstOnly:i,expanded:a}=t;return!!a&&(!i||i&&0===e)}calcStaticExpand(t){const{expandFirstOnly:e,expanded:i}=t;return!!i||!!e}})),Xd=t("TreeController",class extends zr{constructor(){super(...arguments),this.contextMenus={},this.enableQuickSearch=!1,this.dropNodeRss=new Map,this.contextMenuInfos={}}get _evt(){return this.evt}initState(){super.initState(),this.state.defaultExpandedKeys=[],this.state.expandedKeys=[],this.state.navigational=!1,this.state.size=0,this.state.query=""}async onCreated(){var t,e;if(await super.onCreated(),this.state.expandedKeys=[...this.state.defaultExpandedKeys],(null==(t=this.model.detreeNodes)?void 0:t[0].enableQuickSearch)&&(this.enableQuickSearch=!0),this.dataEntity){const t=null==(e=this.dataEntity.appDEFields)?void 0:e.filter((t=>t.enableQuickSearch)),i=[];null==t||t.forEach((t=>{(null==t?void 0:t.lnlanguageRes)&&t.lnlanguageRes.lanResTag?i.push(ibiz.i18n.t(t.lnlanguageRes.lanResTag,t.logicName)):(null==t?void 0:t.logicName)&&i.push(t.logicName)})),i.length>0&&(this.state.placeHolder=i.join("、"))}this.initDropNodeRss(),this.initNodeClickTBUIActionItem(),await this.initService(),await this.initCounter(),this.model.detreeNodes.forEach((t=>{var e,i;(null==(i=null==(e=t.decontextMenu)?void 0:e.detoolbarItems)?void 0:i.length)&&(this.contextMenus[t.decontextMenu.id]=new Uc(t.decontextMenu,this.context,this.params,this.ctx))})),await Promise.all(Object.values(this.contextMenus).map((t=>t.created())))}async onDestroyed(){await super.onDestroyed(),this.counter&&this.counter.destroy()}async initService(){this.service=new Hd(this.model),await this.service.init(this.context)}async initCounter(){const{appCounterRefs:t}=this.model,e=null==t?void 0:t[0];e&&(this.counter=await Ja.getCounterByRef(e,this.context,{...this.params}))}initDropNodeRss(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{if(!t.allowDrop)return;const e=[];Re(this.model,{parentId:t.id,hasQuery:!1}).forEach((t=>{var i;if(null==(i=t.parentDER1N)?void 0:i.pickupDEFName){const i=this.getNodeModel(t.childDETreeNodeId);"DE"===(null==i?void 0:i.treeNodeType)&&i.appDataEntityId&&e.push({minorEntityId:i.appDataEntityId,pickupDEFName:t.parentDER1N.pickupDEFName.toLowerCase(),childDETreeNodeId:t.childDETreeNodeId})}})),e.length>0&&this.dropNodeRss.set(t.id,e)}))}initNodeClickTBUIActionItem(){var t;null==(t=this.model.detreeNodes)||t.forEach((t=>{var e;const i=t.decontextMenu;if(null==(e=null==i?void 0:i.detoolbarItems)?void 0:e.length){let e=0;const a=[];r(i,(t=>{if("DEUIACTION"===t.itemType){e+=1;const i=t;200===i.actionLevel&&a.push(i)}}),{childrenFields:["detoolbarItems"]}),this.contextMenuInfos[t.id]={onlyOneActionItem:1===e,clickTBUIActionItem:a[0]}}}))}async load(t={}){const e=!0===t.isInitialLoad;let i;e&&await this.startLoading();try{i=await this.loadNodes()}finally{e&&await this.endLoading()}return await this.afterLoad(t,i),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e}),i}async getFetchParams(t){const e=await super.getFetchParams(t);return this.state.query&&(e.query=this.state.query),e}async loadNodes(t){const e=await this.getFetchParams(),i=!!e.query;let a;this.state.isLoading=!0;try{a=await this.service.fetchChildNodes(t,{context:this.context.clone(),params:e,hasQuery:i,defaultExpandedKeys:this.state.expandedKeys})||[]}finally{this.state.isLoading=!1}return t?t._children=a:this.state.rootNodes=a,await this.afterLoadNodes(a),a}async afterLoadNodes(t){this.state.items=[],r({_children:this.state.rootNodes},(t=>{this.state.items.push(t)}),{childrenFields:["_children"]}),this.state.expandedKeys=this.calcExpandedKeys(t)}async onTreeNodeClick(t,e){var i;const a=null==(i=this.contextMenuInfos[t._nodeId])?void 0:i.clickTBUIActionItem;if(a)return this.doUIAction(a.uiactionId,t,e,a.appId);if(this.state.navigational){const e=this.getNodeModel(t._nodeId);if(!(null==e?void 0:e.navAppViewId))return}if(this.state.singleSelect&&!t._disableSelect){const{selectedData:e}=this.state,i=e.filter((e=>e._id!==t._id));i.length===e.length?this.setSelection(this.state.singleSelect?[t]:e.concat([t])):this.setSelection(i)}1===this.state.mdctrlActiveMode&&await this.setActive(t)}onExpandChange(t,e){const i=this.state.expandedKeys.includes(t._id);if(e&&!i)this.state.expandedKeys.push(t._id);else if(!e&&i){const e=this.state.expandedKeys.indexOf(t._id);-1!==e&&this.state.expandedKeys.splice(e,1)}}async onDbTreeNodeClick(t){2===this.state.mdctrlActiveMode&&await this.setActive(t)}setActive(t){const e=this.parseTreeNodeData(t);return this._evt.emit("onActive",{...e,nodeData:t})}setSelection(t){const e=t.map((t=>t._id)),i=this.state.items.filter((t=>e.includes(t._id)));super.setSelection(i)}getNodeModel(t){var e;return null==(e=this.model.detreeNodes)?void 0:e.find((e=>e.id===t))}getNodeData(t){const e=this.state.items.find((e=>e._id===t));return e||this.state.items.find((e=>e._uuid===t))}async doUIAction(t,e,i,a){const s=this.getEventArgs(),n=this.parseTreeNodeData(e),o=await Lc.exec(t,{...s,...n,event:i},a);if(o.closeView)this.view.closeView();else if(o.refresh)switch(o.refreshMode){case 1:this.refreshNodeChildren(e);break;case 2:this.refreshNodeChildren(e,!0);break;case 3:this.refresh()}}parseTreeNodeData(t){let e=null;return e="DE"===t._nodeType?t:{...t,...t._deData||{}},{data:[e],context:Object.assign(this.context.clone(),t._context||{}),params:{...this.params,...t._params||{}}}}calcExpandedKeys(t){let e=[...this.state.expandedKeys];return r({_children:t},(t=>{var i;(null==(i=t._children)?void 0:i.length)&&e.push(t._id)}),{childrenFields:["_children"]}),e=Array.from(new Set(e)),e}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,n=await this.loadNodes(s);this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async expandNodeByKey(t){const e=t.filter((t=>!this.state.expandedKeys.includes(t)));if(0===e.length)return;const i=this.state.items.filter((t=>e.includes(t._id)));this.state.expandedKeys.push(...e),0!==i.length&&await Promise.all(i.map((t=>this.loadNodes(t))))}calcAllowDrag(t){const e=this.getNodeModel(t._nodeId);return!0===(null==e?void 0:e.allowDrag)}calcAllowDrop(t,e,i){var a,s;const n=this.getNodeModel(t._nodeId);if("inner"===i){const t=this.getNodeModel(e._nodeId);return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId)&&!!(null==t?void 0:t.allowDrop)}if((null==(a=t._parent)?void 0:a._id)===(null==(s=e._parent)?void 0:s._id)){const t=this.getNodeModel(e._nodeId);return!0===(null==t?void 0:t.allowOrder)}return!!e._parent&&!!this.findDropNodeRS(e._parent._nodeId,n.appDataEntityId)}findDropNodeRS(t,e){const i=this.dropNodeRss.get(t);return null==i?void 0:i.find((t=>t.minorEntityId===e))}async onNodeDrop(t,e,a){var s,n,o;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const r=[],c=this.getNodeModel(t._nodeId),d="inner"===a?e:e._parent,l=(null==e?void 0:e._id)!==(null==(s=t._parent)?void 0:s._id);let h=this.getNodeModel(e._nodeId);if("inner"===a||(null==(n=e._parent)?void 0:n._id)!==(null==(o=t._parent)?void 0:o._id)){const e=this.findDropNodeRS(d._nodeId,c.appDataEntityId);e&&(t._deData[e.pickupDEFName]=d._value,r.push(t),h=this.getNodeModel(e.childDETreeNodeId))}const u=t._parent._children;if(u.splice(u.indexOf(t),1),"inner"===a)e._children||(e._children=[],e._leaf=!0,this.state.expandedKeys.push(e._id)),e._children.push(t);else{let i=d._children.indexOf(e);"next"===a&&(i+=1),d._children.splice(i,0,t)}("inner"===a||l)&&(t._parent=d,t._nodeId=h.id,this.state.expandedKeys=this.calcExpandedKeys([d]));const{sortAppDEFieldId:p,sortDir:m,allowOrder:g}=h;if(!0===g){if(!p)throw new i(h,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=p.toLowerCase(),a="ASC"===m,s=[...d._children];a||s.reverse();const n=t=>t+(100-t%100),o=t=>t[e]||0;let c;s.forEach(((i,a)=>{const d=i._deData;void 0===c?i===t&&(c=0===a?100:n(o(s[a-1]._deData)),d[e]=c,-1===r.indexOf(i)&&r.push(i)):(c>=o(d)&&(d[e]=n(c),r.push(i)),c=o(d))}))}await this.updateDeNodeData(r),this._evt.emit("onAfterNodeDrop",{isChangedParent:l})}async updateDeNodeData(t){const e=ibiz.hub.getApp(this.context.srfappid);await Promise.all(t.map((async t=>{const i=this.getNodeModel(t._nodeId);let a=t._deData;t._changedOnly&&(a=t.getDiffData());const s=Ae(i.appDataEntityId),n=this.context.clone();n[s]=a.srfkey;const o=await e.deService.exec(i.appDataEntityId,"update",n,a);o.data&&(t._deData=o.data,t._oldDeData=o.data.clone())})))}async modifyNodeText(t,e){const a=this.getNodeModel(t._nodeId);if(!a.allowEditText)throw new i(a,ibiz.i18n.t("runtime.controller.control.tree.editMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.tree.nodeData"));t._text=e,await this.updateDeNodeData([t]),this.emitDEDataChange("update",t._deData)}async handleItemRemove(t,e,i){let a=!1;const s=this.getNodeModel(t._nodeId);if(!s)throw new o(ibiz.i18n.t("runtime.controller.control.tree.noFoundTreeNode"));const n=s.appDataEntityId;if(n){const s=Ae(n);if(0!==t.srfuf){const o=e.clone();o[s]=t.srfkey,await this.service.removeItem(n,o,i),a=!0}}return a}onDEDataChange(t){if(!Z(t.triggerKey)&&t.triggerKey===this.triggerKey)return;if("OBJECTCREATED"===t.subtype)return;const e=t.data,i=this.state.items.find((t=>"DE"===t._nodeType&&t._deData&&t._deData.srfdecodename===e.srfdecodename&&t._deData.srfkey===e.srfkey));i&&this.doNextActive((()=>this.refreshNodeChildren(i,!0)),{key:"refresh".concat(i._id)})}}),qd=t("WizardPanelService",class extends rs{async initialize(t,e={},i={}){var a;const s=null==(a=this.model.initControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}async finish(t,e={},i={}){var a;const s=null==(a=this.model.finishControlAction)?void 0:a.appDEMethodId;let n=await this.exec(s,t,e,i);return n=this.handleResponse(n),n}}),Yd=(t("WizardPanelController",class extends Fr{constructor(){super(...arguments),this.tagHistory=[],this.providers={},this.firstForm=void 0,this.formControllers=new Map,this.steps=[],this.stepTags={},this.formData={}}getData(){return[this.formData]}initState(){super.initState(),this.state.buttonsState=new rr}async onCreated(){var t,e;await super.onCreated(),this.model.dewizard.dewizardForms.forEach((t=>{var e,i,a,s;t.firstForm&&(this.firstForm=t);const n="".concat(this.model.name,"_form_").concat(null==(e=t.formTag)?void 0:e.toLowerCase()),o=null==(a=null==(i=this.model.dewizard)?void 0:i.dewizardSteps)?void 0:a.find((e=>e.id===t.dewizardStepId)),r=null==o?void 0:o.stepTag;this.stepTags[n]=r,null==(s=t.stepActions)||s.forEach((e=>{const i="".concat(t.formTag,"@").concat(e),a=new or(i,this.context.srfappid);a.visible=!this.getStepScriptCode(t,e),this.state.buttonsState.addState(i,a)}))})),this.state.buttonsState.init(),null==(e=null==(t=this.model.dewizard)?void 0:t.dewizardSteps)||e.forEach((t=>{this.steps.push(t.stepTag)})),this.service=new qd(this.model),await this.service.init(this.context);const{deeditForms:i}=this.model;i&&i.length>0&&await Promise.all(i.map((async t=>{const{formTag:e}=t.dewizardForm;if(e){const i=await ki(t);i&&(this.providers[e]=i)}})))}get activeWizardForm(){const{activeFormTag:t}=this.state,e=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));return e||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardForm",{activeFormTag:t})),e}get activeFormController(){const{activeFormTag:t}=this.state,e=this.formControllers.get(t);if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.formController",{activeFormTag:t}));return e}async onFormMounted(t,e){const i=e.ctrl;this.formControllers.set(t,i),i.evt.on("onFormDataChange",(t=>{this.calcButtonState(t.data[0])}));const a=await i.load();this.calcButtonState(i.data),Object.assign(this.formData,a)}onFormSaved(t){const e=t.data[0];Object.assign(this.formData,e);const i=Ae(this.model.appDataEntityId);!this.context[i]&&e&&e.srfkey&&(this.context[i]=e.srfkey)}getWizardFormByTag(t){var e;if(!(null==(e=this.model.dewizard)?void 0:e.dewizardForms))throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noConfiguration"));const i=this.model.dewizard.dewizardForms.find((e=>e.formTag===t));if(!i)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.wizardFormIdentifier",{tag:t}));return i}async initialize(){var t;if(null==(t=this.model.initControlAction)?void 0:t.appDEMethodId){let t;try{t=await this.service.initialize(this.context,{},this.params)}catch(t){throw this.actionNotification("INITIALIZEERROR",{error:t}),t}const e=Ae(this.model.appDataEntityId);if(t.data&&t.data.srfkey&&(this.formData=t.data,this.context[e]=t.data.srfkey),t.data&&this.model.stateAppDEFieldId&&t.data[this.model.stateAppDEFieldId]){const e=this.getWizardFormByTag(t.data[this.model.stateAppDEFieldId]);e&&(this.state.activeFormTag=e.formTag)}}!this.state.activeFormTag&&this.firstForm&&(this.state.activeFormTag=this.firstForm.formTag,this.tagHistory.push(this.firstForm.formTag))}async finish(){try{await this.service.finish(this.context,this.formData,this.params)}catch(t){throw this.actionNotification("FINISHERROR",{error:t}),t}this.evt.emit("onFinishSuccess",void 0),this.actionNotification("FINISHESUCCESS")}async onPrevClick(){let t,e;if(this.activeFormController.model.goBackControlAction&&(t=await this.activeFormController.goBack()),this.model.stateAppDEFieldId&&t&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else this.tagHistory.pop(),e=this.tagHistory[this.tagHistory.length-1];if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.noPreviousForm"));this.state.activeFormTag=e}async onNextClick(){const t=await this.activeFormController.save({silent:!0});let e;if(t.srfnextform){this.getWizardFormByTag(t.srfnextform)&&(e=t.srfnextform,this.tagHistory.push(e))}else if(this.model.stateAppDEFieldId&&t[this.model.stateAppDEFieldId]){this.getWizardFormByTag(t[this.model.stateAppDEFieldId])&&(e=t[this.model.stateAppDEFieldId])}else{const t=this.model.dewizard.dewizardSteps,i=this.model.dewizard.dewizardForms;if(t&&i){const i=t.findIndex((t=>t.id===this.activeWizardForm.dewizardStepId)),a=t[i+1];if(!a)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextStep"));const s=this.getWizardFormByTag(a.stepTag);s&&s.formTag&&(e=s.formTag)}}if(!e)throw new o(ibiz.i18n.t("runtime.controller.control.wizardPanel.nextForm"));this.state.activeFormTag=e,this.tagHistory.push(e)}async onFinishClick(){await this.activeFormController.save({silent:!0}),await this.finish()}getStepScriptCode(t,e){switch(e){case"PREV":return t.goPrevEnableScriptCode;case"NEXT":return t.goNextEnableScriptCode;case"FINISH":return t.goFinishEnableScriptCode}}async calcButtonState(t){var e;const{activeWizardForm:i}=this;if(i){let a=t;a&&a instanceof os&&(a=a.getOrigin()),null==(e=i.stepActions)||e.forEach((t=>{const e=this.state.buttonsState["".concat(i.formTag,"@").concat(t)],s=this.getStepScriptCode(i,t);e&&s&&(e.visible=!!ei.execScriptFn({view:this.view,context:this.context,params:this.params,data:a,env:ibiz.env},s,{isAsync:!1,singleRowReturn:!0}))}))}}}),t("MDCtrlService",class extends cs{initUIDataMap(){var t;super.initUIDataMap(),null==(t=this.model.delistDataItems)||t.forEach((t=>{const e=t.id.toLowerCase(),i=t.appDEFieldId;let a;if(i){const s=i.toLowerCase();a=new sn(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new sn(e,e);this.dataUIMap.set(e,a)}))}})),Qd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),$d=(t("MDCtrlController",class extends zr{initState(){super.initState(),this.state.rows=[],this.state.noSort=!0===this.model.noSort,this.state.mdctrlActiveMode=1}async onCreated(){await super.onCreated(),this.service=new Yd(this.model),await this.service.init(this.context),this.setSort()}async loadMore(){this.state.total>this.state.items.length&&!this.state.isLoading&&await this.load({isLoadMore:!0,silent:!0})}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!0})),{key:"refresh"})}async afterLoad(t,e){return t.isInitialLoad&&(this.state.rows=[]),e&&e.length>0&&this.state.rows.push(...e.map((t=>{const e=new Qd(t,this);return this.initActionStates(e),e}))),await this.initGroupCodeListItems(),await this.handleDataGroup(),super.afterLoad(t,e)}setData(t){const e=t.map((t=>new Qd(t,this)));this.state.rows=e}getAllData(){return this.state.rows.map((t=>t.data))}async onActionClick(t,e,i){const a=t.uiactionId;await Lc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.view,event:i},t.appId)}initActionStates(t){const{deuiactionGroup:e,deuiactionGroup2:i}=this.model;e&&this.initUIActionGroup(t,e),i&&this.initUIActionGroup(t,i)}initUIActionGroup(t,e){var i;(null==(i=e.uiactionGroupDetails)?void 0:i.length)||ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new rr;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new or(t.id,this.context.srfappid,e);a.addState(t.id,i)}})),a.update(this.context,t.data.getOrigin()),t.uaColStates[e.id]=a}async handleDataGroup(){const{enableGroup:t,groupMode:e,groupAppDEFieldId:a}=this.model;if(t&&e){if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.propertiesNoConfigured"));"AUTO"===e?this.handleAutoGroup():"CODELIST"===e&&await this.handleCodeListGroup()}}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(new Qd(e,this)))}));const a=[];i.forEach(((t,e)=>{a.push({caption:e,key:e,children:[...t]})})),this.state.groups=a}}async initGroupCodeListItems(){const{groupCodeListId:t}=this.model;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.groupCodeListItems=await e.codeList.get(t,this.context,this.params)}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(new Qd(e,this))}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,key:i.value,children:t})})),this.state.groups=n}}),t("KanbanService",class extends Gc{async updateGroup(t,e){var i;const a=(null==(i=this.model.updateGroupControlAction)?void 0:i.appDEMethodId)||"update";let s=await this.exec(a,t,e.getOrigin());return s=this.handleResponse(s),s}})),Jd=(t("KanbanController",class extends jc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new $d(this.model),await this.service.init(this.context)}initState(){super.initState(),this.state.size=this.model.pagingSize||1e3,this.state.updating=!1,this.state.batching=!1,this.state.selectGroupKey="",this.state.readonly=!(!0!==this.context.srfreadonly&&"true"!==this.context.srfreadonly),this.state.draggable=this.enableEditOrder||this.enableEditGroup,this.state.uaState={}}async onCreated(){await super.onCreated(),this.setToolbarHooks()}sortItems(t){const e=this.model.minorSortAppDEFieldId,{minorSortDir:a}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortingProperties"));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.kanban.sortDirection"));const s="ASC"===a;t.forEach((t=>{const i=t[e];if(Z(i))t[e]=0;else{const e=Number(i);if(Number.isNaN(e))throw new o(ibiz.i18n.t("runtime.controller.control.grid.convertedValue",{srfmajortext:t.srfmajortext}))}})),t.sort(((t,i)=>s?t[e]-i[e]:i[e]-t[e]))}async afterLoad(t,e){var i;this.sortItems(this.state.items),super.afterLoad(t,e);const a=[];return null==(i=this.model.dedataViewItems)||i.forEach((t=>{"ACTIONITEM"===t.itemType&&t.deuiactionGroup&&t.deuiactionGroup.uiactionGroupDetails&&a.push(...t.deuiactionGroup.uiactionGroupDetails)})),a&&a.length>0&&e.forEach((t=>{const e=new rr;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new or(t.id,this.context.srfappid,i);e.addState(t.id,a)}})),this.state.uaState[t.srfkey]=e})),e.forEach((t=>{this.state.uaState[t.srfkey]&&Object.keys(this.state.uaState[t.srfkey]).length>0&&this.state.uaState[t.srfkey].update(this.context,t.getOrigin(),this.model.appDataEntityId)})),e}async onRowClick(t){const{groupAppDEFieldId:e}=this.model;if(this.state.batching&&e){if(t[e]!==this.state.selectGroupKey)return void(1===this.state.mdctrlActiveMode&&await this.setActive(t))}super.onRowClick(t)}onClickNew(t,e){this.setSelectGroup(e),super.onClickNew(t,e)}async onGroupToolbarClick(t,e,i){this.setSelectGroup(i.key),super.onGroupToolbarClick(t,e,i)}async onGroupActionClick(t,e,i,a){this.setSelectGroup(a.key);const s={...this.params,srfgroup:a},n=t.uiactionId;await Lc.execAndResolved(n,{context:this.context,params:s,data:[e],view:this.view,event:i},t.appId)}handleDataGroup(){if(!this.model.enableGroup||"NONE"===this.model.groupMode)throw new o(ibiz.i18n.t("runtime.controller.control.kanban.groupedOn"));return super.handleDataGroup()}handleAutoGroup(){const{groupAppDEFieldId:t}=this.model;if(t){const{items:e}=this.state,i=new Map;e.forEach((e=>{const a=e[t];Z(a)||(i.has(a)||i.set(a,[]),i.get(a).push(e))}));const a=[];i.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));a.push({caption:i.text,color:i.color,key:i.value,children:[...t]})})),this.state.groups=a}}async handleCodeListGroup(){const{groupAppDEFieldId:t,groupCodeListId:e}=this.model;if(!e)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.dataView.tableNoConfigured"));const{items:a}=this.state,s=new Map;this.groupCodeListItems.forEach((t=>{s.set(t.value,[])})),a.forEach((e=>{const i=e[t],a=s.get(i);a&&a.push(e)}));const n=[];s.forEach(((t,e)=>{const i=this.groupCodeListItems.find((t=>t.value===e));n.push({caption:i.text,color:i.color,key:i.value,children:t})})),this.state.groups=n}async onDragChange(t){if(!this.enableEditGroup&&t.from!==t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.adjustmentsGroup"));const e="ASC"===this.model.minorSortDir,{from:i,to:a,fromIndex:s,toIndex:n}=t,o=this.model.groupAppDEFieldId,r=this.model.minorSortAppDEFieldId,c=[],d=this.state.groups.find((t=>t.key===i)),l=this.state.groups.find((t=>t.key===a));if(!this.enableEditOrder){if(t.from===t.to)return void ibiz.message.warning(ibiz.i18n.t("runtime.controller.control.kanban.noAllowReorder"));const e=d.children[s];return e[o]=t.to,this.updateChangedItems([e])}const h=t=>t+(100-t%100),u=[...l.children],p=[...l.children],m=d.children[s];t.from!==t.to?(m[o]=t.to,p.splice(n,0,m)):(p.splice(s,1),p.splice(n,0,m));const g=d.children.splice(s,1);let f;l.children.splice(n,0,...g),e||(u.reverse(),p.reverse());let y,w=[];p.forEach(((t,e)=>{void 0===f?t!==u[e]&&(f=u[e]?u[e][r]||100:0===e?100:h(u[e-1][r]),t[r]=f,c.push(t)):(f>=t[r]?(w.length>0&&(w.forEach((t=>{t[r]=h(y),c.push(t),y=t[r]})),f=y,y=0,w=[]),t[r]=h(f),c.push(t)):(0===w.length&&(y=f),w.push(t)),f=t[r])})),this.updateChangedItems(c)}async updateChangedItems(t){try{this.state.updating=!0,await Promise.all(t.map((async t=>{const e=Ae(this.model.appDataEntityId),i=this.context.clone();i[e]=t.srfkey;const a=await this.service.updateGroup(i,t);if(a.data){const e=this.state.items.findIndex((e=>e.srfkey===t.srfkey));this.state.items.splice(e,1,a.data)}})))}finally{this.state.updating=!1,await this.afterLoad({},this.state.items)}}getFullscreen(){return document.isFullScreen||document.mozIsFullScreen||document.webkitIsFullScreen}onFullScreen(t){const e=this.getFullscreen();return e?document.documentElement.requestFullScreen?document.exitFullScreen():document.documentElement.webkitRequestFullScreen?document.webkitCancelFullScreen():document.documentElement.mozRequestFullScreen&&document.mozCancelFullScreen():t&&(t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.requestFullscreen&&t.requestFullscreen()),!e}setSelectGroup(t){this.state.batching||(this.state.selectGroupKey=t)}setGroupController(t,e,i){const a=this.state.groups.find((e=>e.key===t));a&&(a[e]=i)}setToolbarHooks(){this.listenNewController(((t,e)=>{(t.startsWith("".concat(this.model.name,"_quicktoolbar"))||t.startsWith("".concat(this.model.name,"_groupquicktoolbar")))&&this.setQuickToolbarClickHook(t,e),t.startsWith("".concat(this.model.name,"_batchtoolbar"))&&this.setBatchToolbarClickHook(t,e)}))}setQuickToolbarClickHook(t,e){const i=t.split("quicktoolbar_")[1];this.setGroupController(i,"quickToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("quicktoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}setBatchToolbarClickHook(t,e){const i=t.split("batchtoolbar_")[1];this.setGroupController(i,"batchToolbarController",e),e.evt.on("onClick",(t=>{const e=t.targetName.split("batchtoolbar_")[1];this.setSelectGroup(e),Object.assign(t.params,{srfgroup:e})}))}openBatch(t){this.state.selectGroupKey=t,this.state.batching=!0,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}closeBatch(){this.state.selectGroupKey="",this.state.batching=!1,this.state.selectedData=[],this.state.groups.forEach((t=>{t.selectedData=[]}))}}),t("TreeGridExService",class extends Hd{})),Zd=t("TreeGridExRowState",class{constructor(t,e){this.errors={},this.columnActionsStates={},this.editColStates={},this.modified=!1,this.showRowEdit=!1,this.processing=!1,this.data=t,"DE"===t._nodeType&&(Object.values(e.uaColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{t.initActionStates(this)})),Object.values(e.fieldColumns).forEach((t=>{let i;this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1},Object.defineProperty(this.editColStates[t.name],"readonly",{enumerable:!0,configurable:!0,get:()=>void 0!==i?i:!!e.context&&!(!0!==e.context.srfreadonly&&"true"!==e.context.srfreadonly),set:t=>(i=t,!0)})})))}}),tl=t("TreeGridExController",class extends Xd{constructor(){super(...arguments),this.providers={},this.columns={},this.fieldColumns={},this.uaColumns={}}get _evt(){return this.evt}get hasAdaptiveColumn(){return!!Object.values(this.columns).find((t=>t.isAdaptiveColumn))}get overflowMode(){return ibiz.config.grid.overflowMode}get allowRowEdit(){return this.state.rowEditOpen}initState(){super.initState(),this.state.columnStates=[],this.state.rootNodes=[],this.state.rows={},this.state.rowEditOpen=!0}async onCreated(){await super.onCreated(),await this.initGridColumns(),this.initColumnStates()}async initService(){this.service=new Jd(this.model),await this.service.init(this.context)}async initGridColumns(){this.model.detreeColumns&&await Promise.all(this.model.detreeColumns.map((async t=>this.initColumnsController(t))))}async initColumnsController(t){const e=await Ca(t);if(!e)return;this.providers[t.codeName]=e;const i=await e.createController(t,this);this.columns[t.codeName]=i,"DEFGRIDCOLUMN"===t.columnType?this.fieldColumns[t.codeName]=i:"UAGRIDCOLUMN"===t.columnType&&(this.uaColumns[t.codeName]=i)}initColumnStates(){var t;null==(t=this.model.detreeColumns)||t.forEach((t=>{this.state.columnStates.push({key:t.codeName,caption:t.caption,hidden:!!t.hideDefault,uaColumn:"UAGRIDCOLUMN"===t.columnType})})),this.calcColumnFixed()}calcColumnFixed(){const t=this.state.columnStates.filter((t=>!t.hidden)),e=t.length;t.forEach(((t,i)=>{t.uaColumn&&(t.fixed=i+1<=Math.floor(e/2)?"left":"right")}))}getRowState(t){const e=this.getNodeData(t);if(e)return this.state.rows[e._uuid]}async afterLoadNodes(t){await super.afterLoadNodes(t),r({_children:t},(t=>{this.state.rows[t._uuid]=new Zd(t,this)}),{childrenFields:["_children"]})}convertMultipleLanguages(){this.model.detreeColumns&&this.model.detreeColumns.length>0&&this.model.detreeColumns.forEach((t=>{t.capLanguageRes&&t.capLanguageRes.lanResTag&&(t.caption=ibiz.i18n.t(t.capLanguageRes.lanResTag,t.caption))}))}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const a=this.getNodeModel(t._nodeId),{appDataEntityId:s,updateAppDEActionId:n}=a,r=0===t._deData.srfuf;if(r)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noSupportCreation"));if(!n)throw new i(a,ibiz.i18n.t("runtime.controller.control.treeGridEx.updateBehavior"));const c=Ae(s),d=this.context.clone();d[c]=t._deData.srfkey;const l=ibiz.hub.getApp(this.context.srfappid);let h;try{h=await l.deService.exec(s,n,d,t._deData)}catch(t){throw await this._evt.emit("onSaveError",void 0),this.actionNotification("".concat(r?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=h.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this._evt.emit("onSaveSuccess",void 0)}async saveAll(){const t=Object.values(this.state.rows).filter((t=>t.modified)).map((t=>t.data));t.length&&await Cn(t.map((t=>this.save(t))))}gridStateNotify(t,e){Object.values(this.columns).forEach((i=>{i.gridStateNotify(t,e)}))}async setRowValue(t,e,i){if(!Object.prototype.hasOwnProperty.call(t.data,e)||hr(t.data[e],i)){t.data[e]=i,t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async dataChangeNotify(t,e){await Cn(Object.values(this.columns).map((async i=>i.dataChangeNotify(t,e))))}async toggleRowEdit(){this.state.rowEditOpen=!this.state.rowEditOpen}calcDefaultValue(t,e){const i={};return Object.values(this.fieldColumns).forEach((a=>{const s=a.nodeColumnControllerMap.get(t._nodeId);if(!s||!s.nodeEditItem)return;const{createDV:n,createDVT:o,updateDV:r,updateDVT:c}=s.nodeEditItem,d=e?o:c,l=e?n:r,h=fr({name:a.name,valueType:d,defaultValue:l,valueFormat:s.valueFormat},{data:t,context:this.context,params:this.params});void 0!==h&&(i[a.name]=h)})),i}async switchRowEdit(t,e,i=!0){if(!this.allowRowEdit)return;if("DE"!==t.data._nodeType)return;const a=void 0===e?!t.showRowEdit:e;if(t.showRowEdit!==a){if(!1===a)if(i)await this.save(t.data);else{if(0===t.data._deData.srfuf)return t.showRowEdit=!1,this._evt.emit("onRowEditChange",{row:t}),this.remove({data:[t.data],silent:!0});t.cacheData&&(t.data=t.cacheData,delete t.cacheData)}else{if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.control.grid.lineEditing"));if(1===t.data._deData.srfuf){t.cacheData=it(t.data);const e=this.calcDefaultValue(t.data,!1);Object.assign(t.data,e)}}t.showRowEdit=a,Object.values(this.fieldColumns).forEach((e=>{t.editColStates[e.name].editable=a})),this._evt.emit("onRowEditChange",{row:t})}}}),el=t("TreeGridExColumnController",class{constructor(t,e){this.isAdaptiveColumn=!1,this.isCustomCode=!1,this.model=t,this.treeGrid=e,this.isAdaptiveColumn="STAR"===t.widthUnit}get context(){return this.treeGrid.context}get params(){return this.treeGrid.params}get isFirstShowColumn(){const t=this.treeGrid.state.columnStates.find((t=>!t.hidden));return(null==t?void 0:t.key)===this.model.codeName}async init(){await this.onInit()}async onInit(){}gridStateNotify(t,e){}async dataChangeNotify(t,e){}}),il=t("TreeGridExNodeColumnController",class{constructor(t,e){this.fieldColumn=t,this.nodeModel=e,this.codeList=void 0;const{detreeNodeColumns:a,detreeNodeDataItems:s,detreeNodeEditItems:n}=e,o=null==a?void 0:a.find((t=>t.detreeColumnId===this.fieldColumn.model.id)),r=null==s?void 0:s.find((t=>t.id===o.dataItemName));if(!o||!r)throw new i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.noConfigured",{name:this.fieldColumn.name}));if(this.nodeColumn=o,this.nodeDataItem=r,o.enableRowEdit){const t=null==n?void 0:n.find((t=>t.id===o.id));if(!t)throw new i(e,ibiz.i18n.t("runtime.controller.control.treeGridEx.editItem",{name:this.fieldColumn.name}));this.nodeEditItem=t}}get unitName(){var t;return null==(t=this.nodeEditItem)?void 0:t.unitName}get valueFormat(){return this.nodeColumn.valueFormat}get context(){return this.fieldColumn.context}get params(){return this.fieldColumn.params}get dataType(){var t;return null==(t=this.nodeDataItem)?void 0:t.dataType}get name(){return this.fieldColumn.name}get treeGrid(){return this.fieldColumn.treeGrid}get isLinkColumn(){return!!this.nodeColumn.enableLinkView&&!!this.nodeColumn.linkAppViewId}get hasClickAction(){return!!this.nodeColumn.deuiactionId}get overflowMode(){return this.fieldColumn.treeGrid.overflowMode}async init(){var t;(null==(t=this.nodeEditItem)?void 0:t.editor)&&"HIDDEN"!==this.nodeEditItem.editor.editorType&&(this.editorProvider=await Wi(this.nodeEditItem.editor),this.editorProvider&&(this.editor=await this.editorProvider.createController(this.nodeEditItem.editor,this))),this.nodeEditItem||await this.loadCodeList()}initActionStates(t){const{deuiactionGroup:e}=this.nodeColumn;if(e&&e.uiactionGroupDetails){const i=new rr;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new or(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),t.columnActionsStates[this.name]=i}}onTextClick(t,e){this.isLinkColumn?(e.stopPropagation(),this.openLinkView(t,e)):this.hasClickAction&&(e.stopPropagation(),this.triggerAction(t,e))}async openLinkView(t,e){if(!t.data[this.fieldColumn.name])return;const i=this.nodeColumn.linkValueItem||"srfkey",a=t.data[i];if(null==a)throw new o(ibiz.i18n.t("runtime.controller.control.treeGridEx.noPickedUp",{valueItem:i}));const{linkAppViewId:s}=this.nodeColumn;if(!s)return;const n=ri(t.data),r=Object.assign(this.context.clone(),{srfkey:a,...n}),c=it(this.params),{userParam:d}=this.nodeColumn;if(d){const{navigateContexts:e,navigateParams:i}=we(d);let a={};e&&t.data&&(a=he(e,t.data,c,r)),Object.assign(r,a);let s={};i&&t.data&&(s=he(i,t.data,c,r)),Object.assign(c,s)}const l=await ibiz.commands.execute(Wo.TAG,s,r,c,{event:e});(null==l?void 0:l.ok)&&this.fieldColumn.treeGrid.refresh()}async triggerAction(t,e){const i=this.nodeColumn.deuiactionId;await Lc.execAndResolved(i,{context:this.context,params:this.params,data:[t.data],view:this.treeGrid.view,event:e},this.nodeColumn.appId)}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}formatValue(t=""){if("SIMPLE"!==this.nodeColumn.valueType)return gr.toText(this.nodeColumn,t);const e="".concat(t);if(!this.valueFormat)return e;if(l.isDate(this.dataType)||"createdate"===this.fieldColumn.name){const t=Ct(e).format(this.valueFormat);return"Invalid Date"!==t?t:e}return ibiz.util.text.format(e,this.valueFormat)}async loadCodeList(){const t=this.nodeColumn.appCodeListId;if(!t)return;const e=ibiz.hub.getApp(this.context.srfappid);this.codeList||(this.codeList=e.codeList.getCodeList(t));const i=await e.codeList.get(t,this.context,this.params);return this.codeListItems=i,i}gridStateNotify(t,e){if("LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.name];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}async setRowValue(t,e,i){i=i||this.name,await this.treeGrid.setRowValue(t,i,e)}}),al=(t("TreeGridExFieldColumnController",class extends el{constructor(){super(...arguments),this.nodeColumnControllerMap=new Map}get name(){return this.model.id}async init(){await this.onInit(),await this.initNodeColumnController()}async initNodeColumnController(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;(null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id)))&&this.nodeColumnControllerMap.set(t.id,new il(this,t))})),await Promise.all(Array.from(this.nodeColumnControllerMap.values()).map((t=>t.init())))}initActionStates(t){const e=this.nodeColumnControllerMap.get(t.data._nodeId);e&&e.initActionStates(t)}gridStateNotify(t,e){super.gridStateNotify(t,e);const i=this.nodeColumnControllerMap.get(t.data._nodeId);i&&i.gridStateNotify(t,e)}}),t("TreeGridExUAColumnController",class extends el{constructor(){super(...arguments),this.nodeColumnMap=new Map}async init(){await this.onInit(),await this.initNodeColumnMap()}initNodeColumnMap(){var t;null==(t=this.treeGrid.model.detreeNodes)||t.forEach((t=>{var e;if("DE"!==t.treeNodeType)return;const i=null==(e=t.detreeNodeColumns)?void 0:e.find((t=>t.detreeColumnId===this.model.id));i&&this.nodeColumnMap.set(t.id,i)}))}getUIActionGroup(t){let{deuiactionGroup:e}=this.model;if("DE"===t.data._nodeType&&this.nodeColumnMap.get(t.data._nodeId)){const i=this.nodeColumnMap.get(t.data._nodeId);i.deuiactionGroup&&(e=i.deuiactionGroup)}return e}initActionStates(t){var e;const i=this.getUIActionGroup(t);if(!i)return void ibiz.log.warn(ibiz.i18n.t("runtime.controller.control.treeGridEx.behaviorGroup",{id:this.model.id}));if(!(null==(e=i.uiactionGroupDetails)?void 0:e.length))return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.grid.interfaceBehavior"));const a=new rr;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new or(t.id,this.treeGrid.context.srfappid,e);a.addState(t.id,i)}})),t.columnActionsStates[this.model.id]=a}async onActionClick(t,e,i){const a=t.uiactionId;await this.treeGrid.doUIAction(a,e.data,i,t.appId)}gridStateNotify(t,e){if(super.gridStateNotify(t,e),"LOAD"===e||"SAVE"===e){const e=t.columnActionsStates[this.model.id];e&&"DE"===t.data._nodeType&&e.update(this.context,t.data._deData)}}}),t("TreeGridController",class extends fd{constructor(){super(...arguments),this.treeGridValueField="",this.treeGridParentField=""}initState(){super.initState(),this.state.showTreeGrid=!0}async onCreated(){await super.onCreated(),this.initTreeGridField()}initTreeGridField(){var t,e;const a=null==(t=this.model.degridColumns)?void 0:t.find((t=>4===t.treeColumnMode||12===t.treeColumnMode)),s=null==(e=this.model.degridColumns)?void 0:e.find((t=>2===t.treeColumnMode||3===t.treeColumnMode));if(!a)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnsSchema"));if(!s)throw new i(this.model,ibiz.i18n.t("runtime.controller.control.treeGrid.columnMode"));this.treeGridValueField=s.appDEFieldId.toLowerCase(),this.treeGridParentField=a.appDEFieldId.toLowerCase()}switchTreeGridShow(){this.state.showTreeGrid=!this.state.showTreeGrid}}),t("TreeGridService",class extends md{}),t("MEditViewPanelService",class extends cs{})),sl=(t("MEditViewPanelController",class extends zr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new al(this.model),await this.service.init(this.context),await this.initParameters()}initState(){super.initState(),this.state.panelUiItems=[],this.state.activeTab="",this.state.size=1e3,this.state.isNeedScroll=!1}async initParameters(){var t,e;if(this.model.embeddedAppViewId){const i=await ibiz.hub.getAppView(this.model.embeddedAppViewId);if(i.appDataEntityId){const a=await ibiz.hub.getAppDataEntity(i.appDataEntityId,i.appId);this.parameters=i&&a?[{parameterName:null==(t=a.keyAppDEFieldId)?void 0:t.toLowerCase(),pathName:null==(e=a.codeName)?void 0:e.toLowerCase()}]:[]}}}async afterLoad(t,e){await super.afterLoad(t,e);const i=this.state.panelUiItems.filter((t=>t.id.startsWith("mockId:")));return this.state.panelUiItems=[],this.doItems(e,i),"TAB_TOP"===this.model.panelStyle&&this.state.panelUiItems.length>0&&0===i.length&&(this.state.activeTab=this.state.panelUiItems[0].id),e}handlePanelItemParams(t){const[{parameterName:e}]=this.parameters,i={id:t[e]?t[e]:"mockId:".concat(ut()),context:this.context.clone(),params:{},data:t,srfmajortext:""};return this.parameters.forEach((e=>{const{parameterName:a,pathName:s}=e;t[a]&&!Object.is(t[a],"")&&Object.assign(i.context,{[s]:t[a]}),t.srfmajortext&&!Object.is(t.srfmajortext,"")?Object.assign(i,{srfmajortext:t.srfmajortext}):0===t.srfuf&&Object.assign(i,{srfmajortext:ibiz.i18n.t("runtime.controller.control.meditViewPanel.DraftNew")})})),i}doItems(t,e){t.forEach((t=>{const e=this.handlePanelItemParams(t);this.state.panelUiItems.push(e)})),e&&this.state.panelUiItems.push(...e)}async handleAdd(){this.state.isNeedScroll=!0,this.doItems([{srfuf:0}]),"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}async handleDelete(t){if(this.state.isNeedScroll=!1,0===t.data.srfuf){const e=this.state.panelUiItems.findIndex((e=>e===t));this.state.panelUiItems.splice(e,1)}else await this.remove({data:[t.data],notRefresh:!0})}async handleTabDelete(t,e){let i=!1;t.id===this.state.activeTab&&e===this.state.panelUiItems.length-1&&e>0&&(i=!0),await this.handleDelete(t),i&&(this.state.activeTab=this.state.panelUiItems[this.state.panelUiItems.length-1].id)}afterRemove(t){super.afterRemove(t);const e=this.state.panelUiItems.findIndex((e=>e.data.srfkey===t.srfkey));-1!==e&&this.state.panelUiItems.splice(e,1)}onViewDataChange(t,e){"onSaveSuccess"===t.eventName&&this.handleDataChange(t.data[0],e)}async handleDataChange(t,e){const i=this.state.panelUiItems.findIndex((t=>t.id===e));if(i<0)throw new o(ibiz.i18n.t("runtime.controller.control.meditViewPanel.dataExist"));const a=this.state.panelUiItems[i];a.id.startsWith("mockId:")?this.state.panelUiItems[i]=this.handlePanelItemParams(t):a.srfmajortext=t.srfmajortext,"TAB_TOP"===this.model.panelStyle&&(this.state.activeTab=this.state.panelUiItems[i].id)}}),t("MapService",class extends cs{async init(t){await super.init(t)}async fetchAll(t,e={}){var i;const a=[];if(null==(i=this.model.sysMapItems)?void 0:i.length){const i=ibiz.hub.getApp(t.srfappid);await Promise.all(this.model.sysMapItems.map((async s=>{const{appDataEntityId:n,appDEDataSetId:o,customCond:r}=s,c=t.clone(),d={...e};if(r){const i=ei.execSingleLine(r);if(i){const{navigateContexts:a,navigateParams:s}=we(i);a&&Object.assign(c,he(a,e,t)),s&&Object.assign(d,he(a,e,t))}}const l=await i.deService.exec(n,o,c,d);l.data&&a.push(...l.data.map((t=>new rn(t,s))))})))}return new p(a,200)}})),nl=(t("MapController",class extends zr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new sl(this.model),await this.service.init(this.context)}async load(t={}){if(this.state.isSimple)return[];await this.startLoading();try{const e=!0===t.isInitialLoad,{context:i}=this.handlerAbilityParams(t),a=await this.getFetchParams(null==t?void 0:t.viewParam);i.srfareacode=this.state.areaCode;const s=await this.service.fetchAll(i,a);this.state.items=s.data,await this.afterLoad(t,s.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",{isInitialLoad:e})}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.items}async afterLoad(t,e){const i=await super.afterLoad(t,e),a=[],s=[];return i.forEach((t=>{"REGION"===t._itemStyle?a.push(t):"POINT"===t._itemStyle&&s.push(t)})),this.state.pointData=s,this.state.areaData=a,i}calcDefaultOptions(){var t;if(this.state.strAreaCode=!1,this.state.defaultAreaCode=1e5,null==(t=this.model.controlParam)?void 0:t.ctrlParams){const{ctrlParams:t}=this.model.controlParam;Object.keys(t).forEach((e=>{const i=t[e];switch(e.toLowerCase()){case"defaultareacode":this.state.defaultAreaCode=i;break;case"strareacode":this.state.strAreaCode="true"===i;break;case"jsonbaseurl":this.state.jsonBaseUrl=i}}))}this.state.defaultAreaCode=this.state.strAreaCode?"".concat(this.state.defaultAreaCode):Number(this.state.defaultAreaCode),this.state.areaCode=this.state.defaultAreaCode}onMapChange(t){this.state.areaCode=t,this.load({}),this.evt.emit("onMapChange",{areaCode:t})}onAreaClick(t){this.evt.emit("onAreaClick",{data:[t]})}onPointClick(t){this.evt.emit("onPointClick",{data:[t]})}}),t("ReportPanelService",class extends rs{async fetch(t,e={}){this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId);const i="".concat(this.dataEntity.deapicodeName2,"/report?srfreporttag=").concat(this.model.codeName);let a=await ibiz.net.request(i,{method:"post",data:e});return a=this.handleResponse(a),a}})),ol=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},rl=class extends ol{setConfig(){this.config={CONFIG:{fitView:!0,minZoom:.002,layout:{type:"force",preventOverlap:!0,linkDistance:200,nodeSize:80,nodeSpacing:30}},NODELEGENDCONFIG:{valueField:"source_lables||target_lables",selected:"{{return Object.is(data.source_lables, 'NEO4J_ZT') || Object.is(data.target_lables, 'NEO4J_ZT')}}",codeListTag:"web.nodetype"},EDGELEGENDCONFIG:{valueField:"relationship_type",codeListTag:"web.relationshiptype"},PLUGINCONFIG:{gridConfig:{},miniMapConfig:{}},HOOKS:{g6Hooks:[{name:"afterrender",callBack:"{{ const nodes = data.controller.graph.getNodes(); if (nodes.length < 25) { data.controller.graph.zoomTo(1); data.controller.graph.fitCenter() } }}"}],nodeDataHook:"{{ data.forEach(node => { const type = node.data.source_lables || node.data.target_lables; Object.assign(node, { label: node.data.name, size: 66, style: { fill: node.color },donutAttrs: { prop1: 10000, prop2: 10 },donutColorMap: { prop1: node.color, prop2: node.color },icon: {show: true,img: type === 'NEO4J_ZT' ? resource.dir('assets/images/user-avatar.png') : resource.dir('assets/images/phone.png'),width: 40,height: 40}})})}}",edgeDataHook:"{{ data.forEach(edge => {Object.assign(edge, { label: edge.name })}) }}"}}}load(t){return this.protoRef&&this.protoRef.setData(t),Promise.resolve(t)}},cl=class extends ol{},dl=class{static getInstance(t){if(!t||!t.appDEReport||!t.appDEReport.reportType)throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.reportType"));switch(t.appDEReport.reportType){case"USER":return new rl(t);case"USER2":return new cl(t);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},ll=(t("ReportPanelController",class extends Fr{get _evt(){return this.evt}initState(){super.initState(),this.state.data={},this.state.searchParams={},this.state.reportType=this.model.appDEReport&&this.model.appDEReport.reportType||""}async onCreated(){await super.onCreated(),this.generator=dl.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new nl(this.model),await this.service.init(this.context)}async onMounted(){await super.onMounted(),this.state.loadDefault&&this.load({isInitialLoad:!0})}onDestroyed(){return super.onDestroyed()}async load(t={}){await this.startLoading();try{const{context:e}=this.handlerAbilityParams(t),i=await this.getFetchParams(null==t?void 0:t.viewParam),a=await this.service.fetch(e,i);this.state.data=a.data,await this.afterLoad(t,a.data),this.state.isLoaded=!0,await this._evt.emit("onLoadSuccess",void 0)}catch(t){throw await this._evt.emit("onLoadError",void 0),this.actionNotification("FETCHERROR",{error:t}),t}finally{await this.endLoading()}return this.actionNotification("FETCHSUCCESS"),this.state.data}async afterLoad(t,e){return e}async getFetchParams(t){const e={...this.params};return await this._evt.emit("onBeforeLoad",void 0),Object.assign(e,{...this.state.searchParams}),t&&Object.assign(e,t),e}getData(){return[this.state.data]}async refresh(){this.doNextActive((()=>this.load({isInitialLoad:!1})),{key:"refresh"})}}),t("GanttService",class extends Hd{async getNodeDraft(t,e,i,a){var s;const{appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},l=await this.app.deService.exec(n,"getdraft",o,r),{data:h}=l;return(null==(s=null==e?void 0:e.parentDER1N)?void 0:s.pickupDEFName)&&i&&(h[e.parentDER1N.pickupDEFName]=i._value),new un(this.model,t,i,{data:l.data,leaf:!0,navContext:c,navParams:d,defaultExpand:!1})}async fetchChildNodes(t,e){const{hasQuery:i}=e;let a=[];if(t){const s=Re(this.model,{parentId:t._nodeId,hasQuery:i});if(0===s.length)return;(await Cn(s.map((async i=>{const a=Me(this.model,i.childDETreeNodeId);return this.fetchNodeDatasByType(a,i,t,e)})),!1)).forEach((t=>{a.push(...t)}))}else{const t=Le(this.model);a=await this.fetchNodeDatasByType(t,void 0,void 0,e)}return a}async fetchNodeDatasByType(t,e,i,s){const n=0===Re(this.model,{parentId:t.id,hasQuery:s.hasQuery}).length,o={...s,leaf:n};let r=[];switch(t.treeNodeType){case"STATIC":r=[await this.getStaticGanttNodeData(t,e,i,o)];break;case"DE":r=await this.getDEGanttNodeDatas(t,e,i,o);break;case"CODELIST":r=await this.getCodeListGanttNodeDatas(t,e,i,o);break;default:throw new a(t,ibiz.i18n.t("runtime.controller.control.gantt.noSupport",{treeNodeType:t.treeNodeType}))}const{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{if(d&&(!c||c&&0===e)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticGanttNodeData(t,e,i,a){const s=this.calcStaticExpand(t);return new hn(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf,defaultExpand:s})}async getDEGanttNodeDatas(t,e,i,a){const{appDEDataSetId:s,appDataEntityId:n}=t,{context:o,params:r,navContext:c,navParams:d}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}};r.size=t.maxSize||1e3,t.sortAppDEFieldId&&Object.assign(r,{sort:"".concat(t.sortAppDEFieldId.toLowerCase(),",").concat(t.sortDir?t.sortDir.toLowerCase():"asc")});const l=await this.app.deService.exec(n,s,o,r);if(l.data.length){return l.data.map(((e,s)=>{const n=this.calcExpand(t,s);return new un(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d,defaultExpand:n})}))}return[]}async getCodeListGanttNodeDatas(t,e,i,a){const{context:s,params:n,navContext:o,navParams:r}=e?this.getNodeRSFilterParams(e,i,a):{context:a.context,params:a.params,navContext:{},navParams:{}},c=await this.app.codeList.get(t.codeListId,s,n);if(c.length){return c.map(((e,s)=>{const n=this.calcExpand(t,s);return new pn(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r,defaultExpand:n})}))}return[]}})),hl=(t("GanttController",class extends tl{initState(){super.initState(),this.state.ganttStyle={},this.state.sliderDraggable=!0}handleControlParams(){super.handleControlParams(),this.controlParams.sliderdraggable&&(this.state.sliderDraggable="true"===this.controlParams.sliderdraggable)}onDataChange(t){}async initService(){this.service=new ll(this.model),await this.service.init(this.context)}setGanttStyle(t){this.state.ganttStyle=t}async onCreated(){await super.onCreated(),this.initViewScheduler()}initViewScheduler(){const t=this.model.appViewLogics||[];0!==t.length&&(this.viewScheduler=ibiz.scheduler.createViewScheduler(t),this.viewScheduler.defaultParamsCb=()=>this.getEventArgs(),this.viewScheduler.hasViewEventTrigger&&this.evt.onAll(((t,e)=>{this.viewScheduler.triggerViewEvent(e)})))}async setActive(t){const e=this.parseTreeNodeData(t);return"DE"===t._nodeType&&await this.onNodeDataActive(e),this.evt.emit("onActive",{...e,nodeData:t})}async onNodeDataActive(t){(await this.openData(t)).cancel||this.refreshNodeChildren(t.data[0],!0)}async refresh(){this.doNextActive((async()=>{const t=await this.load({isInitialLoad:!1}),e=this.model.rootVisible?t:t[0]._children;e&&await this.handleDefaultExpandNodes(e)}),{key:"refresh"})}async refreshNodeChildren(t,e=!1){const i=t.srfkey?"srfkey":"_id",a=this.state.items.find((e=>e[i]===t[i]));if(!a)return void ibiz.log.error(ibiz.i18n.t("runtime.controller.control.tree.notFoundTreeData"),t);if(e){const{_parent:t}=a;if(!t||!this.model.rootVisible&&this.state.rootNodes.includes(t))return void await this.refresh()}const s=e?a._parent:a,n=await this.loadNodes(s);await this.handleDefaultExpandNodes(n),this.evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async handleDefaultExpandNodes(t){for(let e=0;e<t.length;e++){const i=t[e];if(this.state.expandedKeys.includes(i._id)){const t=i.srfkey?"srfkey":"_id",e=this.state.items.find((e=>e[t]===i[t])),a=await this.loadNodes(e);await this.handleDefaultExpandNodes(a)}}}async openData({data:t,context:e,params:a}){var s,n;const o=t[0],r=this.getNodeModel(o._nodeId),{appDataEntityId:c}=r;e[Ae(c).toLowerCase()]=null==(s=o._deData)?void 0:s.srfkey;const d=await(null==(n=this.viewScheduler)?void 0:n.triggerCustom("".concat(r.id.toLowerCase(),"_opendata"),{context:e,params:a,data:t,event:void 0,view:this.view,ctrl:this}));if(-1===d)throw new i(r,ibiz.i18n.t("runtime.controller.control.calendar.missingViewLogic",{itemType:r.id.toLowerCase()}));return{cancel:!d.ok}}async setRowValue(t,e,i){const{beginDataItemName:a,endDataItemName:s}=this.model;if(!Object.prototype.hasOwnProperty.call(t.data,e)||hr(t.data[e],i)){t.data[e]=i,e===a?t.data._beginDataItemValue=i:e===s&&(t.data._endDataItemValue=i),t.modified=!0,t.processing=!0;try{await this.dataChangeNotify(t,[e])}finally{t.processing=!1}}}async modifyNodeTime(t,{begin:e,end:i}){if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.noNode"));const a=this.getRowState(t._id);if(!a)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));const{beginDataItemName:s,endDataItemName:n}=this.model;this.setRowValue(a,s,e),this.setRowValue(a,n,i),await this.save(a.data)}async save(t){if(this.state.isSimple)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.simpleMode"));if("DE"!==t._nodeType)throw new o(ibiz.i18n.t("runtime.controller.control.gantt.nonentity"));const e=this.state.rows[t._uuid];if(!e)throw new o(ibiz.i18n.t("runtime.controller.common.md.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.common.md.noChange"));if(e.processing)return void await S(500,this.save.bind(this),[t]);const i=this.getNodeModel(t._nodeId),{appDataEntityId:a}=i,s=0===t._deData.srfuf,n=Ae(a),r=this.context.clone();r[n]=t._deData.srfkey;const c=ibiz.hub.getApp(this.context.srfappid);let d;try{d=await c.deService.exec(a,s?"create":"update",r,t._deData)}catch(t){throw await this.evt.emit("onSaveError",void 0),this.actionNotification("".concat(s?"CREATE":"UPDATE","ERROR"),{error:t,data:e.data}),t}e.data._deData=d.data,e.modified=!1,this.gridStateNotify(e,"SAVE"),await this.evt.emit("onSaveSuccess",void 0)}async remove(t){const{context:e,params:i,data:a}=this.handlerAbilityParams(t);if(!(null==a?void 0:a.length))throw new o(ibiz.i18n.t("runtime.controller.common.control.uncheckedData"));if(!0!==(null==t?void 0:t.silent)){let t=!1;if(t=!!this.findCtrlMsgByTag("BEFOREREMOVE_HIDDEN")||await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}),!t)return}await this.evt.emit("onBeforeRemove",void 0),await this.startLoading();let s,n=!1;try{const o=ibiz.hub.getApp(this.context.srfappid);await Cn(a.map((async t=>{if("DE"===t._nodeType){const a=e.clone(),r=this.getNodeModel(t._nodeId);if(r&&0!==t._deData.srfuf){const{appDataEntityId:e}=r;if(a[Ae(e)]=t.srfkey,await o.deService.exec(e,"remove",a,i),!s&&t._parent){const e=this.getNodeData(t._parent._id);s=e}n=!0}this.afterRemove(t)}}))),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVESUCCESS",{data:a,default:ibiz.i18n.t("runtime.controller.common.md.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&s&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(s)}catch(e){throw await this.evt.emit("onRemoveError",void 0),!0!==(null==t?void 0:t.silent)&&this.actionNotification("REMOVEERROR",{error:e,data:a}),e}finally{await this.endLoading()}this.state.selectedData=[],await this.evt.emit("onRemoveSuccess",void 0)}afterRemove(t){var e;const i=this.state.items.findIndex((e=>e._uuid===t._uuid));if(-1!==i&&this.state.items.splice(i,1),this.state.rows[t._uuid]&&delete this.state.rows[t._uuid],t._parent){const i=this.getNodeData(t._parent._id),a=i._children.findIndex((e=>e._uuid===t._uuid));-1!==a&&(null==(e=i._children)||e.splice(a,1))}}async newRow(t={}){var e;const{data:i}=t,{editShowMode:a}=ibiz.config.grid;if("row"===a){if(Object.values(this.state.rows).find((t=>t.showRowEdit)))throw new o(ibiz.i18n.t("runtime.controller.common.md.firstComplete"))}let s,n;if(i){const t=Array.isArray(i)?i[0]:i;n=this.getNodeData(t._id),s=this.getNodeModel(n._nodeId)}else n=this.state.rootNodes[0],s=Le(this.model);if(s){let t,i;if(Re(this.model,{parentId:s.id,hasQuery:!1}).forEach((e=>{const a=this.getNodeModel(e.childDETreeNodeId);"DE"===(null==a?void 0:a.treeNodeType)&&a.appDataEntityId&&(t=e,i=a)})),i){let s;try{s=await this.service.getNodeDraft(i,t,n,{hasQuery:!1,context:this.context.clone(),params:this.params})}catch(t){throw this.actionNotification("GETDRAFTERROR",{error:t}),t}const o=this.calcDefaultValue(s,!0);Object.assign(s,o);const r=this.getRowState(n._id);(null==(e=n._children)?void 0:e.length)?n._children.push(s):n._children=[s],this.state.items.push(s);const c=new Zd(s,this);this.state.rows[s._uuid]=c,this.gridStateNotify(c,"DRAFT"),"row"===a&&this.switchRowEdit(c,!0),this.evt.emit("onNewRow",{row:r}),this.actionNotification("GETDRAFTSUCCESS",{data:s})}}}async onNodeDrop(t,e,a){var s,n;"inner"!==a||e._leaf||void 0!==e._children||await this.expandNodeByKey([e._id]);const o=[],r=this.getNodeModel(t._nodeId),c="inner"===a?e:e._parent;let d=this.getNodeModel(e._nodeId);if("inner"===a||(null==(s=e._parent)?void 0:s._id)!==(null==(n=t._parent)?void 0:n._id)){const e=this.findDropNodeRS(c._nodeId,r.appDataEntityId);e&&(t._deData[e.pickupDEFName]=c._value,o.push(t),d=this.getNodeModel(e.childDETreeNodeId)),t._parent=c,t._nodeId=d.id}const{sortAppDEFieldId:l,sortDir:h,allowOrder:u}=d;if(!0===u){if(!l)throw new i(d,ibiz.i18n.t("runtime.controller.control.tree.sortAttribute"));const e=l.toLowerCase(),a="ASC"===h,s=c._children;a||s.reverse();const n=t=>t+(100-t%100),r=t=>t[e]||0;let u;s.forEach(((i,a)=>{const c=i._deData;void 0===u?i===t&&(u=0===a?100:n(r(s[a-1]._deData)),c[e]=u,-1===o.indexOf(i)&&o.push(i)):(u>=r(c)&&(c[e]=n(u),o.push(i)),u=r(c))}))}await this.updateDeNodeData(o)}onDEDataChange(t){}}),t("HubController",class{constructor(){this.session={}}async login(t,e,i,a,s){return await ibiz.appUtil.login(t,e,i,a,s)}async logout(t){return await ibiz.appUtil.logout(t)}async changePwd(t,e,i){return await ibiz.appUtil.changePwd(t,e,i)}async switchOrg(t,e,i){return await ibiz.appUtil.switchOrg(t,e,i)}async switchTheme(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}async switchLanguage(t,e,i){return await ibiz.appUtil.switchTheme(t,e,i)}})),ul=class{constructor(){this.evt=new ht,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new us}async init(){this.listenMessage()}listenMessage(){ibiz.mc.command.asyncAction.on((async t=>{if(!t.data||"ASYNCACTION"!==t.subtype)return;if(t.data.actiontype&&"ASYNCCHATCOMPLETION"===t.data.actiontype)return;const e=this.formatAsyncAction(t.data);-1===this.actions.findIndex((t=>t.asyncacitonid===e.asyncacitonid))?this.add(e):this.update(e)}))}formatAsyncAction(t){if(["begintime","endtime","createdate","updatedate"].forEach((e=>{J(t[e])&&(t[e]=Ct(t[e]).format("YYYY-MM-DD HH:mm:ss"))})),!_(t.actionresult))try{const e=JSON.parse(t.actionresult);t.actionresult=e}catch(t){}if(!_(t.completionrate)){const e=Number(t.completionrate);Number.isNaN(e)?t.completionrate=void 0:t.completionrate=e}return t}add(t){this.actions.unshift(t),this.finishedStates.includes(t.actionstate)?this.noticeResult(t):(this.doingNum+=1,ibiz.notice.showDoingNotice({num:this.doingNum})),this.evt.emit("add",it(t)),this.evt.emit("dataChange")}update(t){const e=this.actions.findIndex((e=>e.asyncacitonid===t.asyncacitonid));this.actions.splice(e,1,t),this.finishedStates.includes(t.actionstate)&&(this.doingNum-=1,this.doingNum<=0&&ibiz.notice.closeDoingNotice(),this.noticeResult(t)),this.evt.emit("change",it(t)),this.evt.emit("dataChange")}noticeResult(t){ibiz.notice.showAsyncAction(t)}};function pl(t){if(""===t)return!1;const e=(new DOMParser).parseFromString(t,"text/html");return Array.from(e.body.childNodes).some((t=>1===t.nodeType))}var ml=class{constructor(){this.evt=new ht,this.total=0,this.unreadCount=0,this.page=0,this.size=20,this.messages=[],this.unreadOnly=!1,this.service=new Ys,this.ns=null,this.provider=null}async init(){this.listenMqtt(),await this.refreshUnreadCount()}async load(){try{await this.fetch(!1)}catch(t){ibiz.log.error(t)}}async loadMore(){await this.fetch(!0)}async refreshUnreadCount(){try{this.unreadCount=await this.service.getUnreadNum(),this.evt.emit("unreadCountChange",this.unreadCount)}catch(t){ibiz.log.error(t)}}toggleUnReadOnly(t){const e=void 0===t?!this.unreadOnly:t;this.unreadOnly!==e&&(this.unreadOnly=e,this.evt.emit("unreadOnlyChange",this.unreadOnly),this.load())}async fetch(t=!1){!1===t?this.page=0:this.page+=1;const e={page:this.page,size:this.size,sort:"timestamp,desc"};this.unreadOnly&&(e.searchconds=[{condtype:"GROUP",condop:"AND",bnotmode:!1,searchconds:[{condop:"EQ",condtype:"DEFIELD",fieldname:"status",value:"RECEIVED"}]}]);const i=await this.service.fetch(e);this.total=i.total,t?this.messages.push(...i.data):this.messages=i.data,this.evt.emit("dataChange")}listenMqtt(){ibiz.mc.command.internalMessage.on((async t=>{var e;ibiz.log.debug("mqtt internalMessage: ",t),"INTERNALMESSAGE"===t.subtype&&(t.content&&ibiz.notification.default({isHtmlDesc:pl(t.content),desc:t.content,position:"bottom-right",class:null==(e=this.ns)?void 0:e.b("notice"),onClick:()=>{const e=ibiz.env.isMob?t.mobileurl:t.url;this.provider&&this.provider.openViewByUrl(e)}}),this.refreshUnreadCount())}))}async markRead(t){const e=this.messages.find((e=>e.id===t.id));e&&"RECEIVED"===e.status&&(await this.service.markRead(t.id),e.status="READ",this.unreadCount-=1,this.evt.emit("unreadCountChange",this.unreadCount),this.evt.emit("dataChange"))}async batchMarkRead(){await this.service.batchMarkRead(),await this.fetch(),this.unreadCount=0,this.evt.emit("unreadCountChange",this.unreadCount)}async get(t){return(await this.service.get(t)).data}},gl=class{constructor(){this.evt=new ht,this.total=0,this.asyncAction=new ul,this.internalMessage=new ml}async init(){this.internalMessage.evt.on("unreadCountChange",(()=>{this.total=this.internalMessage.unreadCount,this.evt.emit("totalChange",this.total)})),await this.internalMessage.init(),await this.asyncAction.init()}},fl=class{constructor(){this.convert=new qo,this.controller=new hl,this.appMap=new Map,this.view2appMap=new Map,this.view2appPriorityMap=new Map,this.views=new Map,this.drcontrols=new Map,this.dataEntities=new Map,this.config=new Qo,this.notice=new gl,this.defaultAppIndexViewName="Index"}calcAppViewId(t){let e="";if(-1!==t.indexOf(".")){const i=t.split(".");e=i[i.length-1]}else e=t.toLowerCase();return e}registerModelLoaderProvider(t){this.modelLoaderProvider=t}registerAppView(t){this.views.set(t.codeName.toLowerCase(),t)}registerSubAppDrControls(t,e){this.drcontrols.has(t)||this.drcontrols.set(t,[]);const i=this.drcontrols.get(t);null==i||i.push(e)}registerAppDataEntity(t,e=ibiz.env.appId){this.dataEntities.has(e)||this.dataEntities.set(e,new Map);this.dataEntities.get(e).set(t.id,t)}setAppView(t,e=ibiz.env.appId,i=-1){i<=0&&(i=50);const a=this.calcAppViewId(t);if(this.view2appMap.has(a)){const t=this.view2appPriorityMap.get(a);if(t&&t<i)return}this.view2appMap.set(a,e),-1!==i&&this.view2appPriorityMap.set(a,i)}hasAppView(t){const e=this.calcAppViewId(t);return this.view2appMap.has(e)}async getAppStyle(t){return this.modelLoaderProvider?this.modelLoaderProvider.getAppStyle(t):null}async getAppBISchemes(t=ibiz.env.appId,e=[]){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBISchemes(t,e):[]}async getAppAppBICubes(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppAppBICubes(e,t):[]}async getAppBIReports(t,e=ibiz.env.appId){return this.modelLoaderProvider?this.modelLoaderProvider.getAppBIReports(e,t):[]}async getAppView(t){const e=this.calcAppViewId(t),i=this.view2appMap.get(e)||ibiz.env.appId;if(this.appMap.has(i)||await this.createApp(i),this.views.has(e))return this.views.get(e);if(this.modelLoaderProvider){const t=await this.modelLoaderProvider.getAppView(i,e);return this.registerAppView(t),t}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}getSubAppDrControl(t,e){if(!this.drcontrols.has(e))return;return this.drcontrols.get(e).find((e=>e.uniqueTag===t))}async loadAppView(t,e,i){if(this.modelLoaderProvider){return await this.modelLoaderProvider.loadAppView(t,e,i)}throw new o(ibiz.i18n.t("runtime.hub.noExist",{id:e}))}async getAppDataEntity(t,e=ibiz.env.appId){if(this.dataEntities.has(e)){const i=this.dataEntities.get(e);if(-1===t.indexOf(".")){const e=Array.from(i.values()).find((e=>e.codeName===t));if(e)return e}else if(i.has(t))return i.get(t)}if(this.modelLoaderProvider){let i;return i=-1!==t.indexOf(".")?await this.modelLoaderProvider.getAppDataEntity(e,t):await this.modelLoaderProvider.getAppDataEntityByCodeName(e,t),this.registerAppDataEntity(i,e),i}throw new o(ibiz.i18n.t("runtime.service.noFound",{id:t}))}async createApp(t){if(this.appMap.has(t))return this.appMap.get(t);if(!this.modelLoaderProvider)throw new o(ibiz.i18n.t("runtime.utils.firstregister"));const e=await this.modelLoaderProvider.getApp(t),i=new Ho(e);return this.appMap.set(t,i),await this.modelLoaderProvider.initApp(t),await i.init(),this.configCache||(this.configCache=new $a(ibiz.env.appId,"PSSysHub","Global")),i}async getAppAsync(t=ibiz.env.appId){return this.createApp(t)}getApp(t){let e=null;return e=t?t instanceof Object?t.id:t:ibiz.env.appId,this.appMap.get(e)}getAllApps(){return this.appMap.size>0?Array.from(this.appMap.values()):[]}async getAppDEService(t,e,i){return(await this.getAppAsync(t)).deService.getService(i,e)}reset(){this.appMap.clear(),this.configCache=void 0}destroy(){ibiz.hub.getAllApps().forEach((t=>{t.destroy()}))}},yl=t("EngineFactory",class{constructor(){this.viewEngines=new Map}register(t,e){this.viewEngines.set(t,e)}unRegister(t){this.viewEngines.delete(t)}getEngine(t,...e){const{engineType:i,engineCat:a}=t,s="".concat(a,"_").concat(i),n=this.viewEngines.get(s);if(n)return n(...e);ibiz.log.error(ibiz.i18n.t("runtime.engine.correspondingEngine",{key:s}),t)}}),wl=t("ViewEngineBase",class{constructor(t){this.view=t,this.enabledDataAccAction=!1,this.init(),this.initViewState()}get toolbar(){return this.view.getController("toolbar")}get leftToolbar(){return this.view.getController("lefttoolbar")}get rightToolbar(){return this.view.getController("righttoolbar")}get footerToolbar(){return this.view.getController("footertoolbar")}get viewLayoutPanel(){return this.view.layoutPanel}init(){}handleContextParams(){this.view.params.srfdataaccaction&&(this.enabledDataAccAction=Ha(this.view.params.srfdataaccaction),delete this.view.params.srfdataaccaction)}async onCreated(){const{childNames:t,modal:e}=this.view;e.hooks.shouldDismiss.tapPromise((async t=>{this.view.state.isLoading&&(t.allowClose=!1)})),t.push("captionbar","toolbar"),this.calcDynamicLayout()}calcDynamicLayout(){const t=this.calcRemoveLayoutModel();ibiz.log.debug(ibiz.i18n.t("runtime.engine.deleteModel",{codeName:this.view.model.codeName,name:t.join(";")})),this.removeLayoutModel(t)}calcRemoveLayoutModel(){const{model:t}=this.view,e=[];!1===t.showCaptionBar&&e.push("view_captionbar");return["lefttoolbar","righttoolbar","footertoolbar"].forEach((i=>{ye(t,i)||e.push(i)})),this.calcViewHeaderVisible()||e.push("view_header"),ibiz.env.isMob?(this.calcViewFooterVisible()||e.push("view_footer"),this.isExistAndInLayout("lefttoolbar")||this.isExistAndInLayout("righttoolbar")||!1!==t.showCaptionBar||e.push("view_toolbar")):ye(t,"toolbar")||e.push("view_toolbar","toolbar"),e}removeLayoutModel(t,e=this.view.model.viewLayoutPanel){if(!e)return;const i=e.rootPanelItems||e.panelItems||[],a=i.findIndex((e=>t.includes(e.id)));-1!==a&&i.splice(a,1),i.forEach((e=>{"CONTAINER"===e.itemType&&this.removeLayoutModel(t,e)}))}async onMounted(){const{model:t,childNames:e}=this.view;ibiz.log.debug(ibiz.i18n.t("runtime.engine.childComponentsMounted",{id:t.id,childName:e.join(";")}))}async onDestroyed(){}async call(t,e){return"GetData"===t?this.getData():"ShortCut"===t?this.onShortCut(e):void 0}async onShortCut(t){const{data:e}=t,{context:i,model:a,params:s,modal:n}=this.view;if(["EMBED","POPOVER"].includes(n.mode))throw new Error(ibiz.i18n.t("runtime.engine.minimization",{mode:n.mode}));const o=await ibiz.util.shortCut.calcShortCutKey({context:i,appViewId:a.id});if(!ibiz.util.shortCut.isExist(o)){const t=e&&e[0].srfmajortext||a.caption;return ibiz.util.shortCut.addShortCut({key:o,caption:t,icon:a.sysImage,appViewId:a.id,context:d.create(i),params:{...s},openMode:n.mode,fullPath:window.location.hash}),this.view.state.isShortCut=!0,this.view.closeView(),null}return ibiz.util.shortCut.removeShortCut(o),this.view.state.isShortCut=!1,null}initViewState(){}getData(){return[]}calcViewHeaderVisible(){let t=!1;const{model:e}=this.view;return e.showCaptionBar&&(t=!0),ibiz.env.isMob?(this.isExistAndInLayout("lefttoolbar")&&(t=!0),this.isExistAndInLayout("righttoolbar")&&(t=!0)):this.isExistAndInLayout("toolbar")&&(t=!0),t}isExistAndInLayout(t){const e=this.view.model.viewLayoutPanel;if(!e)return!1;const i=D(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,s=ye(a,t);let n=!(!i||!s);if("TOOLBAR"===(null==s?void 0:s.controlType)){const t=s.detoolbarItems;n=!!(n&&t&&t.length>0)}return n}calcViewFooterVisible(){let t=!1;return this.isExistAndInLayout("footertoolbar")&&(t=!0),t}async loadEntityData(){const{appDataEntityId:t}=this.view.model,{evt:e,context:i,params:a}=this.view;if(!t)throw new o(ibiz.i18n.t("runtime.engine.loadEntityData"));const s=ibiz.hub.getApp(i.srfappid),n=await s.deService.exec(t,"get",i,a,void 0,{srfdataaccaction:this.enabledDataAccAction}),{data:r}=n;r&&(this.enabledDataAccAction&&await this.handleEntityPrivilege(r,this.view.context),this.view.state.srfactiveviewdata=r,r.srfreadonly&&(this.view.context.srfreadonly=!0),e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}async handleEntityPrivilege(t,e){const{appDataEntityId:i}=this.view.model;if(!t.srfdataaccaction)return;const a=ibiz.hub.getApp(e.srfappid);(await a.authority.getService(i)).setDataAccAction({srfkey:t.srfkey,srfsessionid:e.srfsessionid},t.srfdataaccaction)}}),El=(t("MDViewEngine",class extends wl{get xdataControlName(){return this.view.model.xdataControlName}get searchForm(){return this.view.getController("searchform")}get searchBar(){return this.view.getController("searchbar")}get tabToolbar(){return this.view.getController("tabtoolbar")}get tabSearchForm(){return this.view.getController("tabsearchform")}get tabSearchBar(){return this.view.getController("tabsearchbar")}get xdataControl(){return this.view.getController(this.xdataControlName)}async onCreated(){await super.onCreated();const{childNames:t}=this.view;t.push(this.xdataControlName,"searchform","searchbar","tabtoolbar","tabsearchform","tabsearchbar"),this.xdataControlName&&(this.view.slotProps[this.xdataControlName]||(this.view.slotProps[this.xdataControlName]={}),this.view.slotProps[this.xdataControlName].loadDefault=!1)}async onMounted(){await super.onMounted();const{model:t}=this.view;this.xdataControl.evt.on("onActive",this.onXDataActive.bind(this)),this.xdataControl.evt.on("onSelectionChange",(async t=>{var e,i;null==(e=this.toolbar)||e.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.calcButtonState(t.data[0],this.xdataControl.model.appDataEntityId)})),this.xdataControl.evt.on("onBeforeLoad",(()=>{this.xdataControl.state.searchParams=this.getSearchParams()})),this.xdataControl.evt.on("onLoadSuccess",(t=>{var e,i;null==(e=this.toolbar)||e.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),null==(i=this.tabToolbar)||i.calcButtonState(void 0,this.xdataControl.model.appDataEntityId),this.view.evt.emit("onDataChange",{...t,actionType:"LOAD"})})),this.xdataControl.evt.on("onRemoveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"REMOVE"})})),this.xdataControl.evt.on("onSaveSuccess",(t=>{this.view.evt.emit("onDataChange",{...t,actionType:"SAVE"})}));const e=this.viewLayoutPanel.panelItems.view_searchform;if(e){const i=!!this.searchForm;e.state.keepAlive=i,e.state.visible=i&&!!t.expandSearchForm}if(this.searchForm&&this.searchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.searchBar&&this.searchBar.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchForm&&this.tabSearchForm.evt.on("onSearch",(()=>{this.reLoad()})),this.tabSearchBar&&this.tabSearchBar.evt.on("onSearch",(()=>{this.reLoad()})),!this.view.state.noLoadDefault&&t.loadDefault){const t=this.searchBar||this.tabSearchBar;t&&t.hasDefaultSelect&&("grid"===this.xdataControlName||"treegrid"===this.xdataControlName)?t.setDefaultSelect():this.load()}}handleContextParams(){super.handleContextParams(),this.view.context.srfsimple||(this.view.context.srfsimple=!0)}async onXDataActive(t){(await this.openData(t)).cancel||this.refresh()}async call(t,e){if("ToggleFilter"===t)return this.toggleFilter(),null;if("Edit"===t||"View"===t)return this.openData(e);if("New"===t)return this.newData(e);if("Remove"===t)return await this.remove(e),null;if("Import"===t)return await this.importData(),null;if("Refresh"===t)return await this.refresh(),null;if("ExportExcel"===t)return await this.exportData(e),null;if("Search"===t){const t=this.searchForm||this.tabSearchForm;return await t.search(),null}if("Reset"===t){const t=this.searchForm||this.tabSearchForm;return await t.reset(),null}return"Copy"===t?(this.copy(e),null):"Load"===t?(this.load(e),null):"GetAllData"===t?this.xdataControl.state.items:super.call(t,e)}getData(){return this.xdataControl.getData()}async openData(t){var e,a;const{data:s,event:n}=t,o=(t.context||this.view.context).clone();o.srfpaginationviewid=this.view.id;const r=t.params||this.view.params;o[((null==(e=s[0].srfdecodename)?void 0:e.toLowerCase())||Ae(this.xdataControl.model.appDataEntityId)).toLowerCase()]=s[0].srfkey;const c=await(null==(a=this.view.scheduler)?void 0:a.triggerCustom("opendata",{context:o,params:r,data:s,event:n,view:this.view}));if(-1===c)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicOpendata"));return{cancel:!c.ok}}async newData(t){var e,a,s;const{data:n,event:o,copyMode:r}=t;if(!(null==(a=null==(e=this.view.model.viewLayoutPanel)?void 0:e.appViewLogics)?void 0:a.find((t=>"newdata"===t.id))))throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));const c=it(this.view.params);r&&(c.srfcopymode=r);const d=await(null==(s=this.view.scheduler)?void 0:s.triggerCustom("newdata",{context:this.view.context,params:c,data:n,event:o,view:this.view}));if(-1===d)throw new i(this.view.model,ibiz.i18n.t("runtime.engine.logicNewdata"));return{cancel:!d.ok}}async remove(t){await this.xdataControl.remove(t)}async load(t={}){await this.xdataControl.load({isInitialLoad:!0,...t})}async refresh(){await this.xdataControl.refresh()}async reLoad(){await this.xdataControl.load({isInitialLoad:!0})}getSearchParams(){const t={};return this.searchForm&&Object.assign(t,this.searchForm.getFilterParams()),this.searchBar&&Object.assign(t,this.searchBar.getFilterParams()),this.tabSearchForm&&Object.assign(t,this.tabSearchForm.getFilterParams()),this.tabSearchBar&&Object.assign(t,this.tabSearchBar.getFilterParams()),t}async importData(){await this.xdataControl.importData()}async exportData(t){await this.xdataControl.exportData(t)}async copy(t){this.newData(Object.assign(t,{copyMode:!0}))}calcViewHeaderVisible(){const t=super.calcViewHeaderVisible();return this.calcViewSearchBarVisible()||t}calcViewSearchBarVisible(){const{model:t}=this.view,e=this.isExistAndInLayout("searchbar");if(!e)return e;const i=ye(t,"searchbar");return!(!i.enableQuickSearch&&!i.enableGroup&&!0!==i.enableFilter)}toggleFilter(){if(this.searchForm){const t=this.viewLayoutPanel.panelItems.view_searchform;t&&(t.state.visible=!t.state.visible)}}calcRemoveLayoutModel(){const{model:t}=this.view,e=super.calcRemoveLayoutModel();return ye(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),vl=class{constructor(){this.layoutPanel=new oi,this.theme=new wn,this.text=new bi,this.hbs=new de,this.rawValue=new bn,this.action=Lc,this.error=new Bt,this.viewStack=new Dn,this.anime=new Vo,this.shortCut=new Uo,this.file=new ko,this.error.register(new Ut)}showAppLoading(){const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}hiddenAppLoading(){setTimeout((()=>{const t=document.getElementById("app-loading-x");t&&(t.style.display="none")}),300)}setBrowserTitle(t){const e=ibiz.hub.getApp();let i="";i=ibiz.env.AppTitle?ibiz.env.AppTitle:e.model.title?e.model.title:El,document.title=t?"".concat(i," - ").concat(t):i}getGlobalParam(){throw new o(ibiz.i18n.t("runtime.global.noImplemented"))}getRouterParams(){throw new o(ibiz.i18n.t("runtime.global.noImplementedRouting"))}},Il=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.logicType}execute(t){throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noImplementedMethod"))}destroy(){}},bl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createExecutor(t,e){const i=this.constructorMap.get(t.logicType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.logicType",{logicType:t.logicType}));return i(t,e)}},Dl=class extends Il{constructor(){super(...arguments),this.initialized=!1}convertScriptArgs(t){return t}init(t,e,i){this.convertScriptArgs=e;const a=this.logic.scriptCode;this.scriptFn=ei.createScriptFn(t,a,i),this.initialized=!0}execute(t){const e=this.convertScriptArgs(t);return this.scriptFn.exec(e)}},Cl=class extends Il{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return Sc(e,a,t)}},Al=class{constructor(t){this.triggers=new Map,this.executors=new Map,this.hasViewEventTrigger=!1,this.hasControlEventTrigger=!1,this.logics=t,t.forEach((t=>{try{const e=this.createExecutor(t);this.executors.set(t.id,e);const i=this.createTrigger(t);this.triggers.set(t.id,i),i.bindExecutor(e)}catch(t){ibiz.log.error(t.message)}}))}destroy(){this.triggers.forEach((t=>t.destroy())),this.executors.forEach((t=>t.destroy()))}getExecuteParams(t){let e={};return this.defaultParamsCb&&(e=this.defaultParamsCb()),nt(t,e)}createTrigger(t){switch(t.triggerType){case"VIEWEVENT":this.hasViewEventTrigger=!0;break;case"CTRLEVENT":this.hasControlEventTrigger=!0}return ibiz.scheduler.triggerFactory.createTrigger(t,this)}createExecutor(t){return ibiz.scheduler.executorFactory.createExecutor(t,this)}getMatchTriggers(t){const e=[];return this.triggers.forEach((i=>{i.match(t)&&e.push(i)})),e}triggerAndExecute(t,e={}){const i=this.getMatchTriggers(t);if(i.length>0){const t=this.getExecuteParams(e);return i.map((e=>e.execute(t)))}}triggerItemDynaLogic(t,e,i){const a={itemName:t,triggerType:e},s=this.triggerAndExecute(a,i);if(null==s?void 0:s.length)return s.pop()}triggerItemVisible(t,e){return this.triggerItemDynaLogic(t,"ITEMVISIBLE",e)}triggerItemEnable(t,e){return this.triggerItemDynaLogic(t,"ITEMENABLE",e)}triggerItemBlank(t,e){return this.triggerItemDynaLogic(t,"ITEMBLANK",e)}startTimerTrigger(){this.getMatchTriggers({triggerType:"TIMER"}).forEach((t=>t.start()))}triggerCustom(t,e){const i=this.triggers.get(t);if(!i)return-1;const a=this.getExecuteParams(e);return i.execute(a)}triggerControlEvent(t,e,i){const a={ctrlName:t,eventName:e,triggerType:"CTRLEVENT"};this.triggerAndExecute(a,i)}},Pl=class extends Al{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},Tl=class extends Al{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Nl=class{constructor(){this.constructorMap=new Map}register(t,e){this.constructorMap.set(t,e)}createTrigger(t,e){const i=this.constructorMap.get(t.triggerType);if(!i)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.trigger.noSupportedType",{triggerType:t.triggerType}));return i(t,e)}},xl=class{constructor(){this.executorFactory=new bl,this.triggerFactory=new Nl}createViewScheduler(t){return new Tl(t)}createControlScheduler(t){return new Pl(t)}},Sl=class{constructor(t,e){this.logic=t,this.scheduler=e,this.type=t.triggerType}bindExecutor(t){this.executor=t,"SCRIPT"===this.executor.type&&this.bindScriptExecutor(t)}bindScriptExecutor(t){t.initialized||t.init([],(t=>t),{isAsync:!0,singleRowReturn:!1})}match(t){return t.triggerType===this.type}execute(t){if(this.executor)return this.executor.execute(t);throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.noExecutorBound",{id:this.logic.id}))}destroy(){this.executor=void 0}},Ll=class extends Sl{},Ml=class extends Sl{bindExecutor(t){if(super.bindExecutor(t),"SCRIPT"!==this.executor.type)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.triggerType"))}bindScriptExecutor(t){t.init(["context","viewparams","data","env","view"],(t=>{const{context:e,params:i,data:a,view:s}=t;return{context:e,params:i,data:(null==a?void 0:a[0])||{},env:ibiz.env,view:s}}),{singleRowReturn:!0,isAsync:!1})}match(t){var e,i;return super.match(t)&&(null==(e=t.itemName)?void 0:e.toLowerCase())===(null==(i=this.logic.itemName)?void 0:i.toLowerCase())}execute(t){return!!this.executor.execute(t)}},Rl=class extends Sl{constructor(){super(...arguments),this.timer=null}start(){if(!this.logic.timer)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.trigger.timerLacks"));this.timer=setInterval((()=>{if(!this.scheduler.defaultParamsCb)throw new o(ibiz.i18n.t("runtime.logicScheduler.trigger.parameterCallback"));const t=this.scheduler.defaultParamsCb();this.executor.execute(t)}),this.logic.timer)}destroy(){super.destroy(),this.timer&&clearInterval(this.timer)}},Ol=class extends Il{async execute(t){let e;try{this.logic.builtinAppUILogic&&"APP_OPENDATA"===this.logic.builtinAppUILogic.viewLogicType?e=await this.executeOpenDataAppUILogic(this.logic.builtinAppUILogic,t):this.logic.builtinAppUILogic&&"APP_NEWDATA"===this.logic.builtinAppUILogic.viewLogicType&&(e=await this.executeNewDataAppUILogic(this.logic.builtinAppUILogic,t))}catch(t){ibiz.log.error(t)}return e}async executeOpenDataAppUILogic(t,e){const{context:a,params:s,...n}=e,{data:r}=e;if(!(null==r?void 0:r[0]))throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.noActionableData"));let c;if(t.openDataAppViews)c=await this.calcOpenViewRef(t,e);else if(c=t.openDataAppView,!c)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.defaultOpendataViewLogic"));const d=c.refAppViewId;if(!d)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.noActuallyReference"));const l=c.navigateContexts||[],h=Object.assign(a,he(l,r[0],s,a));let u={};const p=c.navigateParams;return ct(p)&&(u=he(p,r[0],s,a)),ibiz.commands.execute(Wo.TAG,d,h,u,{...n,openMode:c.openMode})}async calcOpenViewRef(t,e){const a=await ibiz.hub.getAppDataEntity(e.view.model.appDataEntityId,e.view.model.appId),s=a.formTypeAppDEFieldId||a.dataTypeAppDEFieldId;if(!s)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.attributeConfiguration",{codeName:a.codeName}));const{data:n}=e,r=n[0][s];if(!r)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.entityAttributeValues"));const c=t.openDataAppViews,d=null==c?void 0:c.find((t=>t.refMode===r));if(!d)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.editViews",{formTypeValue:r}));return d}async executeNewDataAppUILogic(t,e){const{context:s,params:n,...o}=e,{data:r,view:c}=e,{enableWizardAdd:d,enableBatchAdd:l,batchAddOnly:h,newDataAppView:u}=t;let p;if(d){if(p=await this.getWizardNewViewRef(t,e),!p)return{ok:!1}}else if(l){const e=Ae(c.parentView.model.appDataEntityId),a=t.batchAddAppViews;if(p=null==a?void 0:a.find((t=>t.refMode.toLowerCase()!==e)),!p)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.selectionView"))}else{if(h)throw new a(t,ibiz.i18n.t("runtime.logicScheduler.executor.noSupportedBatchAddOnly"));if(p=u,!p||!p.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.newdataViewLogic"))}let m={},g={};const f=(null==r?void 0:r[0])||{},y=p.navigateContexts;ct(y)&&(m=he(y,f,n,s)),m=Object.assign(s,m);const w=p.navigateParams;if(ct(w)&&(g=he(w,f,n,s)),n.srfcopymode){const t=(await ibiz.hub.getAppDataEntity(c.model.appDataEntityId,c.model.appId)).keyAppDEFieldId;t&&f&&(g[t]=f.srfkey,g.srfcopymode=!0)}g.srfuf=0;const E=await ibiz.commands.execute(Wo.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&E.data&&await this.doBatchAdd(t,E.data,s,p,e.view),E}async getWizardNewViewRef(t,e){var a;const{wizardAppView:s,newDataAppViews:n}=t,{context:r,params:c,...d}=e;if(!s||!s.refAppViewId)throw new i(t,ibiz.i18n.t("runtime.logicScheduler.executor.indexEntity"));const l=await ibiz.commands.execute(Wo.TAG,s.refAppViewId,r,c,{...d,openMode:"POPUPMODAL"});if(!l.ok)return;const h=null==(a=l.data)?void 0:a[0];if(!h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.checkOne"));const u=h.srfkey,p=null==n?void 0:n.find((t=>{var e;return(null==(e=t.refMode)?void 0:e.toUpperCase())===u.toUpperCase()}));if(!p)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.entitiesAssociated",{indexType:u}));return p}async doBatchAdd(t,e,a,s,n){var r;if(null==e?void 0:e.length){const c=await ibiz.hub.getAppDataEntity(t.appDataEntityId,a.srfappid),d=c.minorAppDERSs,l=s.refMode.toLowerCase();if(!d)throw new i(c,ibiz.i18n.t("runtime.logicScheduler.executor.relationships"));let h="";if(null==d||d.forEach((t=>{const e=Ae(t.majorAppDataEntityId);l===e&&(h=t.parentAppDEFieldId)})),void 0===h)throw new o(ibiz.i18n.t("runtime.logicScheduler.executor.foreignKey",{pickParentDeName:l}));const u={srfkey:h},p=null==(r=n.model.appViewParams)?void 0:r.find((t=>t.key.toLowerCase()==="PROPERTYMAP".toLowerCase()));if(p){const t=p.value.split(",");for(const e of t){const[t,i]=e.split(":");t&&i&&(u[t]=i)}}ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.mappingProperties"),u);const m=e.map((t=>{const e={};return Object.keys(u).forEach((i=>{const a=u[i];e[a]=t[i]})),e}));ibiz.log.debug(ibiz.i18n.t("runtime.logicScheduler.executor.newCreationData"),m);const g=ibiz.hub.getApp(a.srfappid).deService;await g.exec(c.id,"Create",a,m)}}},_l=class extends Sl{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>hi[t]||t))}match(t){return super.match(t)&&this.listenEventNames.includes(t.eventName)}},Fl=class extends Sl{constructor(t,e){super(t,e),this.logic=t,this.scheduler=e,this.listenEventNames=[];const i=t.eventNames.split(";");this.listenEventNames=i.map((t=>pi[t]||t))}match(t){return super.match(t)&&t.ctrlName.toLowerCase()===this.logic.ctrlName.toLowerCase()&&this.listenEventNames.includes(t.eventName)}},zl=class extends Il{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));Lc.execAndResolved(this.logic.appDEUIActionId,t,this.logic.appId)}};t("PluginStaticResource",class{constructor(t){this.urlReg=/^http[s]?:\/\/[^\s]*/,this.styleElementMap=new Map,this.url=new URL(t),this.baseDir=Pt.dirname(this.url.pathname)}dir(t){return this.urlReg.test(t)?t:this.url.origin+Pt.resolve(this.baseDir,t)}async loadStyle(t){const e=t.map((t=>{const e=this.urlReg.test(t)?t:this.dir(t);return!this.styleElementMap.has(e)&&(this.styleElementMap.set(e,null),new Promise(((t,i)=>{const a=document.createElement("link");a.setAttribute("type","text/css"),a.setAttribute("rel","stylesheet"),a.setAttribute("href",e),a.onload=t,a.onerror=i,document.head.appendChild(a)})))}));try{await Promise.all(e)}catch(t){ibiz.log.error(t)}}}),t("RemotePluginItem",class{constructor(t,e,i){this.tag=t,this.repo=e,this.config=i}}),t("en",{runtime:{common:{unrealized:"unrealized"},command:{app:{noFindApplicationFunction:"An app feature called {appFuncId} cannot be found",noFindApplicationFunctionYype:"Unsupported application function type: {appFuncType}",noFindApplicationView:"The application view [{appViewId}] does not exist",unsupportedPopup:"Unsupported view opening modes: POPUP",unsupportedPopupapp:"Unsupported view opening modes: POPUPAPP",missingEvent:"Bubble opening missing event"}},controller:{common:{control:{componentActivation:"Component [{name}] ({id}) is active",componentPause:"Component [{name}] ({id}) is pause",unsupportedType:"Unsupported entity data change type: {type}",uncheckedData:"Unchecked data",dataDeletion:"data deletion",confirmDataDeletion:"Confirm deletion of data?",noImportModel:"No import model is configured!"},md:{rowData:"Row data does not exist",simpleMode:"Simple mode, no saving",dataDeleted:"Data [{str}] deleted successfully!",noChange:"The value has not changed",firstComplete:"Please complete the current line in the line editor first"},editor:{editorNoConfigured:"Editor type [{editorType}], code table not configured"},view:{viewActivation:"View [{name}] ({id}) is active",viewPause:"View [{name}] ({id}) is pause",viewDestroy:"View [{name}] ({id}) is destroy",noFoundViewEngine:"The View Engine implementation was not found:",noSupportBehavior:"No engine support for pre-built interface behavior {key}"}},control:{menu:{noFindMenu:"Cannot find menu item named {id}",noConfigured:"No application functionality configured"},calendar:{missingViewLogic:"Missing {itemType}_opendata view logic",noFoundModel:"Calendar item model not found"},chart:{noConfiguredX:"Sequence is not configured with X-axis",noConfiguredY:"Sequence is not configured with Y-axis",missingClassification:"Missing classification attribute configuration",missingValue:"Missing value attribute configuration",noSupportSequence:"Charts do not support sequence types at this time {seriesType}",noFindSequence:"Cannot find generator for {seriesIndex} sequence!",noInitialised:"The chart object is not properly initialised",noCalculated:"Options have not been calculated."},dataView:{noBehaviourGroup:"No interface behaviour group is configured for the action",noBehaviourGroupAction:"No interface behaviour is configured for the action item interface behaviour group",propertiesNoConfigured:"Grouping properties are not configured",tableNoConfigured:"The grouping code table is not configured",sortingItems:"Items with sorting enabled must be associated with an entity attribute"},expBar:{unableMore:"Unable to get multiple data widgets [{xdataControlName}] controller",multiNode:"Multi-node views are implemented by subclasses",noFindNodeModel:"Cannot find node model for {nodeId}"},form:{formCompletion:"Please check the form completion!",savedSuccessfully:"{srfmajortext}Saved successfully!",prompt:"prompt",deletion:"Confirm deletion?",itemUpdate:"No {formItemUpdateId} form item update was found.",processStarted:"Process started successfully",processSubmitted:"Process submitted successfully",lackBehavior:"Lack of return operation entity behavior",initializationException:"Initialization Exception: Form member [{id}]({detailType}) already exists, duplicate form item identifier Please check configuration!",relationshipInterface:"Receive data change events from the relationship interface",fillIn:"Please fill in {caption} ",unconfiguredWidgets:"Multi-data widgets unconfigured content widgets",noFoundFormController:"No form controller corresponding to {id} found",multiDataAddData:"Multi-data widget type {contentType} does not support adding data at the moment",mdControllerNoExist:"mdController does not exist",repeaterNoSupported:"Repeater styles are not supported at this time {detailStyle}",searchTerms:"No search terms found to apply",saveSearch:"No saved search criteria found"},gantt:{noNode:"Not entity gantt node data",nonentity:"Non-entity node data cannot be saved",noSupport:"{treeNodeType} node type not supported"},grid:{unsupported:"Unsupported types {type}",attributeColumns:"Attribute columns with no grouping attributes configured",noCodeTable:"The attribute column {groupFieldName} of the grouping attribute does not have a configuration code table",configureFirstColumn:"Please configure the grouping attribute column {groupFieldName} as the first column",requiresCodeTable:"Code table grouping mode requires code table configuration",noMatchCodeTable:"The grouping code table does not match the code table for the attribute column {groupFieldName}",convertedValue:"The sort attribute of {srfmajortext} cannot be converted to a value",missingConfiguration:"Missing configuration of aggregated entities or aggregated datasets",newRows:"New rows are not supported",saveCancel:"Row data validation failed, save cancel",noSupportRowEditing:"The current form does not support row editing, and you cannot toggle on row editing.",lineEditing:"Only one line can be open for line editing at the same time",updateColumns:"No {updateId} edit columns found for update",exported:"No exported data",tabularColumns:"No tabular columns",corresponding:"Corresponding table data item not found [{deField}].",pickedUpData:"The value of {valueItem} is not picked up in the row data.",noSupportedMode:"Attribute column aggregation mode {aggMode} is not supported yet.",remoteAggregation:"Remote aggregation is not supported yet",aggregateMode:"Aggregate mode is not supported yet {aggMode}",formattingError:"{aggValue} value formatting error",checksumErrors:"{codeName}Checksum errors, {fieldName}",behaviorGroup:"The action column does not have an interface behavior group configured",interfaceBehavior:"No interface behavior is configured for the action column interface behavior group"},kanban:{sortingProperties:"Sorting properties are not configured",sortDirection:"Sort direction is not configured",groupedOn:"Kanban components must be grouped on",adjustmentsGroup:"The current Kanban does not allow adjustments to the grouping!",noAllowReorder:"Current Kanban does not allow reordering!"},meditViewPanel:{DraftNew:"Draft - New",dataExist:"Edit View Panel widget UI data does not exist"},panel:{panelData:"Panel data not captured"},reportPanel:{reportType:"Report panel generator factory parameter error, report panel does not specify report type",noImplemented:"Specify the report {reportType} type report panel generator not implemented yet"},searchBar:{noFoundEntity:"Cannot find the associated entity corresponding to the attribute {targetField}.",missingModel:"Missing editor model",JSONFormat:"{data} non-standard JSON format:"},toolbar:{noFound:"Interface behavior model {actionId} not found"},tree:{noFoundTreeData:"Cannot find corresponding tree node data",sortAttribute:"Missing Configuration Sort Attribute",editMode:"The tree node is not configured for edit mode: name",nodeData:"Not entity tree node data",noFoundTreeNode:"Tree node not found"},treeGrid:{columnsSchema:"TreeTable Unvalued Columns Schema",columnMode:"Tree table without parent column mode"},treeGridEx:{noConfigured:"The node is not configured with a data item that corresponds to the table column {name}",editItem:"Edit item model corresponding to table column {name} was not found",noPickedUp:"The value of {valueItem} is not picked up in the row data.",behaviorGroup:"The {id} action column does not have an interface behavior group configured.",noSupportCreation:"Does not support the creation of new",updateBehavior:"Tree nodes are not configured to update entity behavior"},wizardPanel:{wizardForm:"Cannot find the wizard form for {activeFormTag}.",formController:"Cannot find a form controller for {activeFormTag}.",noConfiguration:"There is no Configuration Wizard form collection",wizardFormIdentifier:"Cannot find the wizard form with the {tag} identifier.",noPreviousForm:"No previous form",nextStep:"Cannot find next wizard step",nextForm:"Cannot find the next wizard form"}},utils:{buttonState:{isFinitenconsistency:"Inconsistency between entity {appDeName} of {uiActionId} interface behavior and entity {appDeId} of data"},counter:{decrement:"Decrement cannot be called for a count of 0!"},dataFileUtil:{startImport:"Start importing. Please refer to the application notification for detailed progress and results",noExist:"ibiz.util.getExportExcel does not exist",loadError:"Export module loading error",importData:"No corresponding import data model was found"},valueDefault:{noExist:"appdata.context does not exist",nosupported:"Default value type [{valueType}] not supported"},valueEx:{objectNameField:"Missing objectNameField"},valueRule:{length:"The length of the content must be less than or equal to {maxLength}, the current length is {length}."},viewMsg:{message:"Cannot find model for view message group {msgGroupId}",noFound:"No {message} view message model found",unconfigured:"Unconfigured entity dataset",unconfiguredEntities:"Application entities not configured"}}},deLogic:{deLogicLink:{connectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",entityConnectionConditional:"Entity Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",missingConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataMissingConditionValue:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",noSupportedTime:"Conditional value type [current time] is not supported at this time",entityLogicalConnection:"Entity Logical Connection Condition Item: {name} - Condition Value Type: {type} - Source Attribute Name: {dstField} - Source Object Value:",comparisonCondition:"-comparison condition: {op}",comparisonValue:"-comparison value",compareResults:"-Compare and contrast results:"},deLogicNode:{missingTargetParameter:"Missing target parameter object or source parameter object configuration",additionalParameter:"Entity logic node (appended to the array): {id} - additional parameter:",addedValue:"-Added value:",logicNodeParameterName:"Entity Logic Node (Binding Parameters): {id} - Parameter Name: {dstDELogicParamId} - Value:",copyParameter:"Entity logic node (copy parameter): {id} - parameter name: {dstDELogicParamId} - value:",dataSet:"Entity Logic Node (Data Set): {id} - Dataset Entity Id: {dstAppDataEntityId} - Dataset Id: {dstAppDEDataSetId} - Parameter Name: {retDELogicParamId} - Value:",unspecifiedEntity:"Unspecified application entity",unspecifiedBehavior:"Behavior of unspecified entities",entityActions:"Entity Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDELogicParamId} - Value:",unsupportedReturnType:"Unsupported end node return type: {returnType}",endNode:"Entity logic node (end node): {id} - return value type: {returnType} - return value:",noSupportedLogic:"Logic handling of parameter actions {paramAction} is not supported at this time.",preparationParameter:"Entity Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDELogicParamId} - Source Parameter (value):",targetParameter:"-Target parameter (value):",missingConfiguration:"Missing target parameter object configuration",rebuildParameter:"Entity Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDELogicParamId}",resetParameter:"Entity logic node (reset parameter): {id} - reset parameter: {dstDELogicParamId}",missingParameterProperty:"Missing target parameter object or target property configuration",sortedArrayParameters:"Entity Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDELogicParamId} - Sorted Array:",startupNode:"Entity logical node (startup node): {id}",throwsException:"Entity Logic Node (throws exception): {id} - Error Code: {errorCode} - Error Message: {errorInfo}",environmentVariables:"Unsupported logical parameter types: system environment variables",fileObjectListVariable:"Unsupported logical parameter type: file object list variable",fileObjectVariables:"Unsupported logical parameter types: file object variables",filterObjectVariables:"Unsupported logical parameter types: filter object variables",finalDataVariables:"Unsupported logical parameter types: final data variables",rawDataObjects:"Unsupported logical parameter types: Raw Data Objects",operationSessionVariables:"Unsupported Logical Parameter Types: Operation Session Variables",calculateEntity:"Calculated entity logic parameter, identifier: {tag}",value:"-value:",recreatingVariables:"Unsupported logical parameter types recreating variables",reEstablish:"Re-establish the entity logic parameter, identifier: {tag}",expressionEmpty:"Expression is empty",sourceValueType:"The source value type {srcValueType} is not supported yet.",fetchingAttribute:"Fetching the attribute {srcField} from the source parameter reports an error, source parameter:",noScriptCode:"Script code mode has no script code configured",noConfigurationLogicNode:"The entity logic does not have a configuration logic node",unsupportedLogical:"Unsupported logical node types: {logicNodeType}",noSetStartNode:"No start node set",startExecuting:"Start executing entity logic, logic identifier: {id} - logic name: {name}",endExecution:"End execution entity logic, logic identifier: {id} - logic name: {name}",noFoundEntityLogic:"{dataEntityId} entity logic not found {deDELogicId}"}},engine:{correspondingEngine:"There is no {key} corresponding engine",logicOpendata:"Missing view logic for opendata",logicNewdata:"Missing view logic for newdata",deleteModel:"{codeName} Delete model: {name}",childComponentsMounted:"The child components of {id}: {childName} are mounted.",minimization:"The current view is opened in [{mode}], minimization is not supported!",loadEntityData:"The view has no entities and cannot load entity data"},global:{noImplemented:"Getting application global variables is not implemented",noImplementedRouting:"Getting view routing parameter variables is not implemented"},hub:{failedParse:"View parameter modalOption failed to parse: {error}",noExist:"View [{id}] does not exist"},logicScheduler:{executor:{noConfiguredLogic:"No entity interface logic is configured",missingTrigger:"Missing trigger application entity interface behavior id in logic",noActionableData:"There is no actionable data for opendata!",defaultOpendataViewLogic:"opendata view logic is not configured to open the view by default",noActuallyReference:"The default open view for opendata view logic does not actually reference the view",attributeConfiguration:"{codeName}[Multiple Form Entity] or [Index Entity] missing type attribute configuration",entityAttributeValues:"Data Source No Form Type Applied Entity Attribute Values",editViews:"No edit views were found for the entity associated with the form type {formTypeValue}.",selectionView:"Selection view that needs to be opened for batch add was not found",noSupportedBatchAddOnly:"batchAddOnly is not supported yet.",newdataViewLogic:"The newdata view logic is not configured to default to a new data view",indexEntity:"Missing Default Index Entity Selection View",checkOne:"Please check one piece of data",entitiesAssociated:"No edit view found for entities associated with index type {indexType}",relationships:"Entities do not have a collection of relationships from!",foreignKey:"No foreign key attribute found for {pickParentDeName} in the current entity",mappingProperties:"Batch New Conversion Mapping Properties",newCreationData:"Batch new creation data",logicType:"Logic type {logicType} Not supported yet!",noImplementedMethod:"Method not implemented."},trigger:{triggerType:"The trigger type for the predefined logical type {type} can only be a script",noSupportedType:"Trigger type {triggerType} Not supported yet!",noExecutorBound:"{id} No executor bound.",timerLacks:"Timer lacks timing intervals",parameterCallback:"Timer missing default parameter callback"}},model:{utils:{noFoundApplication:"Application not found",unconfiguredPlugins:"Apply unconfigured plug-ins",noFound:"Plugin not found {id}"},view:{engineClassifications:"Unsupported engine classifications: {engineType}"}},platform:{failedDownload:"Failed to download file",fileStreamData:"File stream data does not exist"},register:{helper:{adapter:"Cannot find the adapter corresponding to the system counter plugin {pluginKey}.",customizedSystemAdapter:"Cannot find the adapter corresponding to the customized system counter {codeName}.",noFoundSystemCounter:"Adapter for system counter type {counterType} is not found.",applicationMenu:"Cannot find the adapter corresponding to the application menu item plugin {pluginKey}.",asynchronousAction:"Find the adapter that does not correspond to the asynchronous action type {actiontype}.",matchedPlugin:"Not matched to plugin [{pluginId}] model",customRegistration:"Cannot find an adapter with a custom registration ID of [{registerKey}].",widgetPlugin:"Cannot find the adapter corresponding to the widget plugin {pluginKey}.",widgetStyleType:"Cannot find the adapter corresponding to the widget style: [{controlStyle}] for the widget type: [{controlType}].",widgetType:"Cannot find an adapter for widget type {controlType}.",entityBehaviorPlugin:"Cannot find the adapter corresponding to the entity behavior plugin {pluginKey}.",entityBehaviorMethod:"Find adapters that donnot have an entity behavior method type of {methodType}",editorPlugin:"Cannot find the adapter corresponding to the editor plugin {pluginKey}.",editorStyleType:"Cannot find the adapter corresponding to editor style: [{editorStyle}] for editor type: [{editorType}].",editorTypePredefinedType:"Cannot find an adapter corresponding to editorType: [{editorType}] for predefinedType: [{predefinedType}].",editorType:"Cannot find the adapter corresponding to editor type {editorType}.",formMemberPlugin:"Cannot find the adapter corresponding to the form member plugin {pluginKey}.",formMemberType:"Cannot find an adapter for form member type {detailType}.",tableColumnPlugin:"Cannot find the adapter corresponding to the table column plugin {pluginKey}.",tableColumnType:"Cannot find an adapter for table column type {key}.",messageType:"Cannot find the adapter corresponding to the message type {content_type}.",panelMemberPlugin:"The adapter corresponding to the panel member plugin {pluginKey} could not be found.",panelContainerPredefined:"Cannot find an adapter with panel container predefined type {predefinedType}, registered key {key}",panelMemberDirectContent:"Cannot find adapter with panel member direct content predefined type {predefinedType}, registered key {key}",panelMemberType:"The adapter corresponding to the panel member type {itemType} could not be found.",portalWidgetPlugin:"Cannot find the adapter corresponding to the portal widget plugin {pluginKey}.",portalWidgetMemberType:"Adapter corresponding to portal widget member type {portletType} not found",treeTableColumnPlugin:"Cannot find the adapter corresponding to the tree table column plugin {pluginKey}.",interfaceBehaviorPlugin:"Cannot find the adapter corresponding to the interface behavior plugin {pluginKey}.",interfaceBehaviorMode:"Find the adapter that does not correspond to the interface behavior mode {uiactionMode}.",frontEndPluginNode:"Cannot find interface logic front-end plugin node, plugin {pluginKey} corresponding adapter",viewPlugin:"Cannot find the adapter corresponding to the view plugin {pluginKey}.",correspondViewTypeStyle:"Cannot find an adapter for view type: [{viewType}] corresponding to view style: [{viewStyle}].",toolbarItem:"Cannot find the adapter corresponding to the toolbar item plugin {pluginKey}.",acItem:"Cannot find the adapter corresponding to the ac item plugin {pluginKey}."}},service:{noConfiguredPrimary:"Entity [{codeName}] is not configured with a primary key field",noConfiguredField:"Entity [{codeName}] is not configured with a primary text field",convertedNumber:"{value} cannot be converted to a number.",subRelationships:"Sub-relationships not configured with a nested relational dataset will result in a recursive query death loop, please configure it!",unsupportedMethod:"Unsupported application entity method input attribute type: {type}",noFoundUsernamePassword:"Anonymous login configuration username or password not found",loginFailure:"Login Failure",logoutFailure:"Logout failure",noFound:"Application entity not found [{id}]",masterState:"{codeName} entity does not exist or is enabled for master state, return true",operationIdentifier:"Operation identifier {dataAccessAction} main state calculation started",matchMasterState:"Match master state",masterStatePermissions:"Collection of allowed master state permissions",noMatchedState:"Returns false if the main state is not matched.",permissionCalculation:"Operation identifier {dataAccessAction} end of permission calculation: {result}",noFindCodeList:"Cannot find {tag} code list",noConfiguredCounters:"Application counters not configured!",lackEntityLogic:"Lack of entity handling logic",createBehavior:"The create behavior does not pass data",updateBehavior:"The update behavior does not pass data",deletionDeletion:"Currently, only [DER1N] relationship type association deletion deletion is supported.",unableDelete:"Unable to delete [{logicName}-{srfmajortext}], data referenced by [{modelLogicName}-{msg}].",noSupportedDataSource:"Data source type {dataSetType} not supported yet",sourceCodeTable:"No data is specified for the source code table",requestMethods:"Unsupported request methods: {requestMethod}",noConfiguredRequestMethod:"Request method not configured",unsupportedBehaviorTypes:"Unsupported Behavior Types [{actionType}]",noFoundServiceMethod:"Service method not found: {id}",UnsupportedServiceMethod:"Unsupported service method types: {methodType}",noSupportedMethod:"The 「{id}」 method is not supported by {codeName}.",noFoundStorageEntity:"Application function [{name}] storage entity not found [{stoageAppDataEntityId}]",noExist:"Application function [{name}] does not exist",noFoundEntity:"Storage Entity Not Found [{stoageAppDataEntityId}]",noImplemented:"「{methodName}」 is not implemented.",noImplementedCounter:"Counter loading method not implemented",noFoundCounterBehavior:"Get counter behavior not found!",createPrimaryKeyData:"Failed to create new joint primary key data with existing primary key {srfkey}",updatePrimaryKeyData:"Failed to update joint primary key data with existing primary key {srfkey}",noExistNoUpdated:"Data does not exist and cannot be updated!",dataNoExistNoUpdated:"Data [{srfdename}-{srfmajortext}({srfkey})] does not exist and cannot be updated!",noDeleted:"The following data 「{notRemoveKey}」 was not found and could not be deleted!",noAttributeName:"No attribute name is specified",noContextParameterName:"No context parameter name is specified",conditionalObjects:"Unrecognizable Conditional Objects",mustArray:"The value must be an array",unsupportedQueryTypes:"Unsupported query types: {condType}",predefinedType:"Predefined type {predefinedType} is not supported at this time.",dynamicCodeTable:"The return value of a dynamic code table data property is not an object-formatted string and cannot be converted!",unconfiguredDataset:"Unconfigured dataset",processedWithout:"Execution of 「{funcName}」 cannot be processed without 「srfkey」.",noExistProcessed:"Execution of 「{funcName}」 does not exist and 「srfsessionid」 cannot be processed.",missingDetreeColumnId:"Model exception missing detreeColumnId or dataItemName."},uiAction:{noEntityOrBehavior:"No entity or entity behavior configured",noConfiguredopenView:"Not configured to open the view",frontProcessingModes:"Unsupported front processing modes [{frontProcessType}]",missingConfigurationScriptCode:"Custom types are missing configuration script code",dataPrimaryKey:"Data primary key not found",printFailure:"print failure",physicalPrint:"No physical print items found",exportRequestFailed:"Export request failed",noEntityExportsFound:"No entity exports found",lackNativeEvent:"Lack of native JS event objects",wantLogout:"Are you sure you want to log out?",logout:"Logout",operationConfirmation:"Operation Confirmation",viewParameterModalOption:"View parameter modalOption failed to parse: {error}",withdrawalConfirmed:"Is the execution of the withdrawal confirmed?",noFoundBehaviorModel:"No interface behavior model found for {actionId}."},uiLogic:{interfaceConnectionConditional:"Interface Connection Conditional Logic Group Unconfigured Logic Item",connectionConditionGroup:"Interface Logic Connection Condition Group Name: {name} - Condition Group Identifier: {id} - Run Result:",currentConditionValue:"The current condition value type is [Data object attribute], and the configuration condition value is missing.",sourceDataObjectAttribute:"The current condition value type is [Source Data Object Attribute], and the configuration condition value is missing.",currentTime:"Conditional value type [current time] is not supported at this time",interfaceConnectionConditionalTypeName:"Interface Logic Connection Condition Item: {name} - Condition Value Type: {type} - Source Property Name: {dstField} - Source Object Value:",asynchronousTermination:"Unsupported logical connection type: asynchronous termination",asynchronousRejection:"Unsupported logical connection type: asynchronous rejection",exceptionHandling:"Unsupported Logical Connection Type: Exception Handling",logicalLinkTypes:"Unsupported logical link types:{linkMode}",missingTargetParameter:"Missing target parameter object or source parameter object configuration",appendedArray:"Interface logic node (appended to the array): {id} - additional parameter:",bindingParameters:"Interface Logic Node (Binding Parameters): {id} - Parameter Name: {dstDEUILogicParamId} - Value:",copyParameter:"Interface logic node (copy parameter): {id} - parameter name: {dstDEUILogicParamId} - value:",missingfilter:"Missing configuration filter parameters",interfaceLogicNodeDataSet:"Interface Logic Node (Data Set): {id} - Dataset Entity Identifier: {dstAppDataEntityId} - Dataset Identifier: {dstAppDEDataSetId} - Parameter Name: {retDEUILogicParamId} - Value:",interfaceLogicNodeEntityActions:"Interface Logic Node (Entity Actions): {id} - Entity to which the interface action belongs: {dstAppDataEntityId} - Entity Activity Identifier: {dstAppDEActionId} - Parameter Name: {retDEUILogicParamId} - Value:",noConfiguredInterfaceBehavior:"Interface behavior not configured",interfaceLogicNodeEntityInterfaceAction:"Interface Logic Node (Entity Interface Action): {id} - Interface Action Identifier: {dstAppDEUIActionId} - Entity to which the Interface Action belongs: {dstAppDataEntityId} - Target Logic Parameter Object: {dstDEUILogicParamId}",logicalNodeOperation:"Logical node {name} operation parameter value:",unsupportedEndNode:"Unsupported end node return value types: {returnType}",interfaceLogicNodeEndNode:"Interface logic node (end node): {id} - return value type: {returnType} - return value:",noEntityConfigured:"No entity configured",noEntityLogicConfigured:"No entity logic configured",noIncomingLogic:"No incoming logic parameters are configured",passedParameter:"Passed parameter {dstDEUILogicParamId} not found",interfaceLogicNodeExecutingEntityLogic:"Interface logic node (executing entity logic): {id} - entity logic identifier: {dstAppDELogicId} - entity to which the entity logic belongs: {dstAppDataEntityId} - parameter name: {retDEUILogicParamId} - value:",missingMessageTypeConfiguration:"Missing message type configuration",missingButtonTypeConfiguration:"Missing button type configuration",interfaceLogicNodeMessagePopup:"Interface logic node (message popup): {id} - message type: {type} - message: {message}",message:"messages",yes:"yes",no:"no",determine:"Determine",cancel:"Cancel",noSupportItem:"{name} is currently not supported",interfaceLogicNodeFrontendPlugin:"Interface Logic Node (Frontend Plugin): {id} - Plugin Id: {sysPFPluginId}",interfaceLogicNodePreparationParameter:"Interface Logic Node (Preparation Parameter): {id} - Parameter Processing Action: {paramAction} - Target Logic Parameter: {dstDEUILogicParamId} - Source Parameter (value):",noTargetParameter:"No target parameter object id",targetParameter:"Assigning a value to the target parameter attribute {dstFieldName} reports an error, target parameter:",interfaceLogicNodeDirectCode:"Interface logic node (direct code): {id}-direct code:",interfaceLogicNodeRebuildParameter:"Interface Logic Node (rebuild parameter): {id} - rebuild parameter: {dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"Interface Logic Node (Reset Parameter): {id} - Reset Parameter: {dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"Interface Logic Node (Sorted Array Parameters): {id} - Sort Attribute: {dstFieldName} - Sort Mode: {dstSortDir} - Parameter Name: {dstDEUILogicParamId} - Sorted Array:",interfaceLogicNodeStartupNode:"Interface logic node (startup node): {id}",interfaceLogicNodeThrowingExceptions:"Interface Logic node (throwing exceptions): {id} - error message: {errorInfo}",noConfiguredTriggerObject:"No trigger object is configured",noConfiguredEvent:"The event name parameter is not configured",noConfiguredEventParameters:"No event parameters are configured",noFoundTriggerObject:"Trigger object not found {fireCtrlId}",noFoundEventParameterObject:"Event parameter object not found {eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"Interface logic node (view widget event trigger logic): {id} - name of the calling view widget: {fireCtrlId} - name of the triggering event: {eventName} - triggering parameters:",noConfiguredInterfaceObject:"No interface object is configured",noConfiguredOperatingParameters:"No operating parameters are configured",noConfiguredCallMethod:"No call method is configured",noFoundOperationParameter:"The operation parameter {invokeParamId} was not found.",noFoundInterfaceObject:"Interface object {invokeCtrlId} was not found.",noFoundInvokeMethod:"The invoke method {invokeMethod} was not found.",interfaceLogicNodeViewWidgetInvocation:"Interface logic node (view widget invocation): {id} - name of the invoking view widget: {invokeCtrlId} - name of the invoking method: {invokeMethod} - trigger parameter:",viewLogicInitializationParameter:"View logic initialization parameter, {codeName} specified widget object not found",calculateInterfaceLogicParameters:"Calculate interface logic parameters, identifier: {tag}",restablishInterfaceLogic:"Re-establish the interface logic parameters, identifying: {tag}",interfaceLogic:"Interface logic {deUILogicId} for entity {appDataEntityId} not found",startExecutingInterfaceLogic:"Start executing the interface logic, entity: {appDataEntityId} - logic name: {name}",endExecutionInterfaceLogic:"End execution interface logic, entity: {appDataEntityId} - logic name: {name}",noLogicalNodesConfigured:"The interface logic has no logical nodes configured"},utils:{anime:{noExistEndpointElement:"The endpoint element does not exist",noExistAnimationElement:"Animation element does not exist",noClone:"Cannot clone a null or undefined element."},errorHandler:{noPermissionless:"No permissionless error handler registered",noProcessor:"No processor was found that can handle this error"},fileUtil:{fileUploadFailed:"File upload failed"},handlebars:{noInitHandlebars:"handlebars not init"},modal:{externalClosureCapability:"External closure capability not registered",shouldDismissResult:"The result of shouldDismiss is false, closing the interrupt."},openRedirectView:{parseSrfnavctxParameter:"Failed to parse srfnavctx parameter in redirection [{urlStr}].",missingEntityName:"Entity name missing from redirection parameter",noFoundSpecifiedEntity:"CodeName not found for the specified entity: {deName}",unsupportedLinkUrl:"Unsupported linkUrl format: {linkUrl}",noConfiguredActualReference:"Actual reference view not configured",redirectingViewReferences:"Redirecting view references there:",redirectionIdentifier:"Redirection identifier [{rdTag}] or [{deRdTag}] or workflow [{wfRdTag}] corresponding to view not found",noMatchActualReferenceView:"Identifies that [{rdTag}] did not match the actual reference view",redirectionView:"Redirection view [{name}] custom category attribute [{typeFieldId}] value is null"},script:{errorReportingScript:"Error Reporting Script"},shortCut:{invalidIndexNewIndex:"Invalid index newIndex: {newIndex}, oldIndex: {oldIndex}, current array length {length}"},uiDomain:{transactionOpen:"Transaction has been opened, only one transaction can be opened for a single interface domain.",currentTransaction:"The current transaction has not been committed and cannot be closed directly."},uiDomainManager:{invalidInterfaceDomain:"Invalid interface domain identifier [{id}]"},verify:{contentConform:"Content must conform to value rules",scopeRules:"Content length must conform to scope rules",valueNull:"The value is null",regularRules:"The value must conform to the regular rules",rangeRules:"Values must conform to the value range rules",scriptRules:"The value must conform to the script rules",emptyLogicGroups:"Empty logic groups were found and the logic could not be executed properly!",unsupportedLogicTypes:"Unsupported logic types {logicType}",emptyLogicGroupsProperly:"Empty logic groups were found and the logic could not be executed properly!",valueOperations:"Value operations: {op}, not yet supported",noCompared:"{value} and {value2} cannot be compared.",conditionalValues:"Conditional values for range comparisons do not exist or are not strings"},firstregister:"Please register the model loading adapter first"}}}),t("zhCn",{runtime:{common:{unrealized:"未实现"},command:{app:{noFindApplicationFunction:"找不到叫{appFuncId}的应用功能",noFindApplicationFunctionYype:"未支持的应用功能类型:{appFuncType}",noFindApplicationView:"应用视图[{appViewId}]不存在",unsupportedPopup:"未支持的视图打开模式: POPUP",unsupportedPopupapp:"未支持的视图打开模式: POPUPAPP",missingEvent:"气泡打开缺少event"}},controller:{common:{control:{componentActivation:"部件[{name}]({id})激活",componentPause:"部件[{name}]({id})暂停",unsupportedType:"不支持的实体数据变更类型: {type}",uncheckedData:"未选中数据",dataDeletion:"数据删除",confirmDataDeletion:"确认删除数据?",noImportModel:"没有配置导入模型!"},md:{rowData:"行数据不存在",simpleMode:"简单模式,不保存",dataDeleted:"数据[{str}]删除成功!",noChange:"值没有发生改变",firstComplete:"请先完成当前行编辑中的行的操作"},editor:{editorNoConfigured:"编辑器类型[{editorType}],未配置代码表"},view:{viewActivation:"视图[{name}]({id})激活",viewPause:"视图[{name}]({id})暂停",viewDestroy:"视图[{name}]({id})销毁",noFoundViewEngine:"未找到视图引擎实现:",noSupportBehavior:"没有引擎支持预置界面行为{key}"}},control:{menu:{noFindMenu:"找不到名为{id}的菜单项",noConfigured:"没有配置应用功能"},calendar:{missingViewLogic:"缺少{itemType}_opendata的视图逻辑",noFoundModel:"未找到日历项模型"},chart:{noConfiguredX:"序列没有配置X坐标轴",noConfiguredY:"序列没有配置Y坐标轴",missingClassification:"缺少分类属性配置",missingValue:"缺少值属性配置",noSupportSequence:"图表暂未支持序列类型{seriesType}",noFindSequence:"找不到{seriesIndex}序列的generator!",noInitialised:"chart对象没有正确初始化",noCalculated:"options还没计算"},dataView:{noBehaviourGroup:"操作项没有配置界面行为组",noBehaviourGroupAction:"操作项界面行为组没有配置界面行为",propertiesNoConfigured:"分组属性没有配置",tableNoConfigured:"分组代码表没有配置",sortingItems:"启用排序的项必须关联实体属性"},expBar:{unableMore:"无法获取多数据部件[{xdataControlName}]控制器",multiNode:"多节点视图由子类实现",noFindNodeModel:"找不到{nodeId}的节点模型"},form:{formCompletion:"请检查表单填写!",savedSuccessfully:"{srfmajortext}保存成功",prompt:"提示",deletion:"确认删除吗?",itemUpdate:"没找到{formItemUpdateId}表单项更新",processStarted:"流程启动成功",processSubmitted:"流程提交成功",lackBehavior:"缺少返回操作实体行为",initializationException:"初始化异常: 表单成员[{id}]({detailType})已存在,表单项标识重复请检查配置",relationshipInterface:"接收到关系界面的数据变更事件",fillIn:"请填写{caption}",unconfiguredWidgets:"多数据部件未配置内容部件",noFoundFormController:"没有找到对应{id}的表单控制器",multiDataAddData:"多数据部件类型{contentType}暂不支持添加数据",mdControllerNoExist:"mdController不存在",repeaterNoSupported:"暂不支持重复器样式{detailStyle}",searchTerms:"没有找到可以应用的搜索条件",saveSearch:"没有找到保存的搜索条件"},gantt:{noNode:"不是实体甘特节点数据",nonentity:"非实体节点数据不能保存",noSupport:"{treeNodeType}节点类型未支持"},grid:{unsupported:"未支持的类型{type}",attributeColumns:"没有配置分组属性的属性列",noCodeTable:"分组属性的属性列{groupFieldName}没有配置代码表",configureFirstColumn:"请将分组属性列{groupFieldName}配置为第一列",requiresCodeTable:"代码表分组模式需要配置代码表",noMatchCodeTable:"分组代码表与属性列{groupFieldName}的代码表不一致",convertedValue:"{srfmajortext}的排序属性无法转换成数值",missingConfiguration:"缺少配置聚合实体或聚合数据集",newRows:"不支持新建行",saveCancel:"行数据校验不通过,保存取消",noSupportRowEditing:"当前表格不支持行编辑,无法切换开启行编辑",lineEditing:"同时只能有一行开启行编辑",updateColumns:"没找到{updateId}编辑列更新",exported:"无导出数据",tabularColumns:"无表格列",corresponding:"未找到对应的表格数据项[{deField}]",pickedUpData:"未在行数据中取到 {valueItem} 的值",noSupportedMode:"暂未支持属性列聚合模式{aggMode}",remoteAggregation:"远程聚合暂未支持",aggregateMode:"暂未支持聚合模式{aggMode}",formattingError:"{aggValue} 值格式化错误",checksumErrors:"{codeName}校验报错,{fieldName}",behaviorGroup:"操作列没有配置界面行为组",interfaceBehavior:"操作列界面行为组没有配置界面行为"},kanban:{sortingProperties:"排序属性没配置",sortDirection:"排序方向没配置",groupedOn:"看板部件必须开启分组",adjustmentsGroup:"当前看板不允许调整分组!",noAllowReorder:"当前看板不允许调整次序!"},meditViewPanel:{DraftNew:"草稿--新建",dataExist:"编辑视图面板部件UI数据不存在"},panel:{panelData:"未获取到面板数据"},reportPanel:{reportType:"报表面板生成器工厂参数错误,报表面板未指定报表类型",noImplemented:"指定报表{reportType}类型报表面板生成器暂未实现"},searchBar:{noFoundEntity:"找不到属性{targetField}对应的关联实体",missingModel:"缺少编辑器模型",JSONFormat:"{data}非标准JSON格式:"},toolbar:{noFound:"没有找到界面行为模型{actionId}"},tree:{noFoundTreeData:"找不到对应的树节点数据",sortAttribute:"缺少配置排序属性",editMode:"树节点没有配置编辑模式:名称",nodeData:"不是实体树节点数据",noFoundTreeNode:"未找到树节点"},treeGrid:{columnsSchema:"树表格无值列模式",columnMode:"树表格无父值列模式"},treeGridEx:{noConfigured:"节点没有配置对应表格列{name}的数据项",editItem:"没有找到对应表格列{name}的编辑项模型",noPickedUp:"未在行数据中取到 {valueItem} 的值",behaviorGroup:"{id}操作列没有配置界面行为组",noSupportCreation:"暂不支持新建",updateBehavior:"树节点没有配置更新实体行为"},wizardPanel:{wizardForm:"找不到{activeFormTag}的向导表单",formController:"找不到{activeFormTag}的表单控制器",noConfiguration:"没有配置向导表单集合",wizardFormIdentifier:"找不到标识为{tag}的向导表单",noPreviousForm:"没有上一个表单",nextStep:"找不到下一个向导步骤",nextForm:"找不到下一个向导表单"}},utils:{buttonState:{isFinitenconsistency:"{uiActionId}界面行为的实体{appDeName}和数据的实体{appDeId}不一致"},counter:{decrement:"错误的调用!decrement不能对count为0调用"},dataFileUtil:{startImport:"开始导入,详细进度和结果请看应用通知",noExist:"ibiz.util.getExportExcel不存在",loadError:"导出模块加载错误",importData:"没有找到对应的导入数据模型"},valueDefault:{noExist:"appdata.context不存在",nosupported:"默认值类型[{valueType}]未支持"},valueEx:{objectNameField:"缺少objectNameField"},valueRule:{length:"内容长度必须小于等于{maxLength},当前长度为{length}"},viewMsg:{message:"找不到视图消息组{msgGroupId}的模型",noFound:"没有找到{message}视图消息模型",unconfigured:"未配置实体数据集",unconfiguredEntities:"未配置应用实体"}}},deLogic:{deLogicLink:{connectionConditional:"界面连接条件逻辑组未配置逻辑项",entityConnectionConditional:"实体逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",missingConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataMissingConditionValue:"当前条件值类型为[源数据对象属性],缺少配置条件值",noSupportedTime:"暂未支持条件值类型为[当前时间]",entityLogicalConnection:"实体逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",comparisonCondition:"-对比条件:{op}",comparisonValue:"-对比值:",compareResults:"-对比结果:"},deLogicNode:{missingTargetParameter:"缺少目标参数对象或者源参数对象配置",additionalParameter:"实体逻辑节点(附加到数组):{id}-附加参数:",addedValue:"-附加值:",logicNodeParameterName:"实体逻辑节点(绑定参数):{id}-参数名称:{dstDELogicParamId}-值:",copyParameter:"实体逻辑节点(拷贝参数):{id}-参数名称:{dstDELogicParamId}-值:",dataSet:"实体逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDELogicParamId}-值:",unspecifiedEntity:"未指定应用实体",unspecifiedBehavior:"未指定实体行为",entityActions:"实体逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDELogicParamId}-值:",unsupportedReturnType:"暂未支持的结束节点返回值类型: {returnType}",endNode:"实体逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noSupportedLogic:"暂未支持逻辑处理参数操作{paramAction}",preparationParameter:"实体逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDELogicParamId}-源参数(值):",targetParameter:"-目标参数(值):",missingConfiguration:"缺少目标参数对象配置",rebuildParameter:"实体逻辑节点(重新建立参数):{id}-重建参数:{dstDELogicParamId}",resetParameter:"实体逻辑节点(重置参数):{id}-重置参数:{dstDELogicParamId}",missingParameterProperty:"缺少目标参数对象或目标属性配置",sortedArrayParameters:"实体逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDELogicParamId}-排序后数组:",startupNode:"实体逻辑节点(启动节点):{id}",throwsException:"实体逻辑节点(抛出异常):{id}-错误代码:{errorCode}-错误信息:{errorInfo}",environmentVariables:"未支持的逻辑参数类型: 系统环境变量",fileObjectListVariable:"未支持的逻辑参数类型: 文件对象列表变量",fileObjectVariables:"未支持的逻辑参数类型: 文件对象变量",filterObjectVariables:"未支持的逻辑参数类型: 过滤器对象变量",finalDataVariables:"未支持的逻辑参数类型: 最后数据变量",rawDataObjects:"未支持的逻辑参数类型: 原始数据对象",operationSessionVariables:"未支持的逻辑参数类型: 操作会话变量",calculateEntity:"计算实体逻辑参数,标识:{tag}",value:"-值:",recreatingVariables:"未支持的逻辑参数类型重新建立变量",reEstablish:"重新建立实体逻辑参数,标识:{tag}",expressionEmpty:"表达式为空",sourceValueType:"暂未支持源值类型{srcValueType}",fetchingAttribute:"从源参数取属性{srcField}报错,源参数:",noScriptCode:"脚本代码模式没有配置脚本代码",noConfigurationLogicNode:"实体逻辑没有配置逻辑节点",unsupportedLogical:"未支持的逻辑节点类型: {logicNodeType}",noSetStartNode:"未设置起始节点",startExecuting:"开始执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",endExecution:"结束执行实体逻辑,逻辑标识:{id}-逻辑名称:{name}",noFoundEntityLogic:"{dataEntityId}找不到实体逻辑{deDELogicId}"}},engine:{correspondingEngine:"没有{key}对应的引擎",logicOpendata:"缺少opendata的视图逻辑",logicNewdata:"缺少newdata的视图逻辑",deleteModel:"{codeName}删除模型:{name}",childComponentsMounted:"{id}的子组件:{childName}都已mounted",minimization:"当前视图打开方式为 [{mode}], 不支持最小化!",loadEntityData:"该视图没有实体,无法加载实体数据"},global:{noImplemented:"获取应用全局变量没有实现"},hub:{failedParse:"视图参数modalOption 解析失败:{error}",noExist:"视图[{id}]不存在"},logicScheduler:{executor:{noConfiguredLogic:"没有配置实体界面逻辑",missingTrigger:"逻辑中缺少触发应用实体界面行为id",noActionableData:"opendata没有可操作数据!",defaultOpendataViewLogic:"opendata视图逻辑没有配置默认打开视图",noActuallyReference:"opendata视图逻辑的默认打开视图没有实际引用视图",attributeConfiguration:"{codeName}[多表单实体] or [索引实体]缺少类型属性配置",entityAttributeValues:"数据源无表单类型应用实体属性值",editViews:"没有找到与表单类型{formTypeValue}相关的实体的编辑视图",selectionView:"没有找到批添加需要打开的选择视图",noSupportedBatchAddOnly:"batchAddOnly暂未支持",newdataViewLogic:"newdata视图逻辑没有配置默认新建数据视图",indexEntity:"缺少默认索引实体选择视图",checkOne:"请选中一条数据",entitiesAssociated:"没有找到与索引类型{indexType}相关的实体的编辑视图",relationships:"实体没有从关系集合!",foreignKey:"没有找到{pickParentDeName}在当前实体的外键属性",mappingProperties:"批量新建转换映射属性",newCreationData:"批量新建创建数据",logicType:"逻辑类型 {logicType} 暂未支持!",noImplementedMethod:"方法未执行。"},trigger:{triggerType:"预定义逻辑类型{type}的触发器类型只能是脚本",noSupportedType:"触发器类型 {triggerType} 暂未支持!",noExecutorBound:"{id}没有绑定executor",timerLacks:"定时器缺少定时间隔",parameterCallback:"定时器缺少默认参数回调"}},model:{utils:{noFoundApplication:"未找到应用",unconfiguredPlugins:"应用未配置插件",noFound:"未找到插件{id}"},view:{engineClassifications:"未支持的引擎分类:{engineType}"}},platform:{failedDownload:"下载文件失败",fileStreamData:"文件流数据不存在"},register:{helper:{adapter:"找不到系统计数器插件{pluginKey}对应的适配器",customizedSystemAdapter:"找不到自定义系统计数器{codeName}对应的适配器",noFoundSystemCounter:"找不系统计数器类型{counterType}对应的适配器",applicationMenu:"找不到应用菜单项插件{pluginKey}对应的适配器",asynchronousAction:"找不异步操作类型{actiontype}对应的适配器",matchedPlugin:"未匹配到插件[{pluginId}]模型",customRegistration:"找不到自定义注册标识为[{registerKey}]对应的适配器",widgetPlugin:"找不到部件插件{pluginKey}对应的适配器",widgetStyleType:"找不到部件类型:[{controlType}]的部件样式:[{controlStyle}]对应的适配器",widgetType:"找不到部件类型{controlType}对应的适配器",entityBehaviorPlugin:"找不到实体行为插件{pluginKey}对应的适配器",entityBehaviorMethod:"找不实体行为方法类型为{methodType}的适配器",editorPlugin:"找不到编辑器插件{pluginKey}对应的适配器",editorStyleType:"找不到编辑器类型:[{editorType}]的编辑器样式:[{editorStyle}]对应的适配器",editorTypePredefinedType:"找不到编辑器类型:[{editorType}]的预置类型:[{predefinedType}]对应的适配器",editorType:"找不到编辑器类型{editorType}对应的适配器",formMemberType:"找不到表单成员类型{detailType}对应的适配器",tableColumnPlugin:"找不到表格列插件{pluginKey}对应的适配器",tableColumnType:"找不到表格列类型{key}对应的适配器",messageType:"找不站内信类型{content_type}对应的适配器",panelMemberPlugin:"找不到面板成员插件{pluginKey}对应的适配器",panelContainerPredefined:"找不到面板容器预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberDirectContent:"找不到面板成员直接内容预置类型为{predefinedType}的适配器,注册key为{key}",panelMemberType:"找不到面板成员类型{itemType}对应的适配器",portalWidgetPlugin:"找不到门户部件插件{pluginKey}对应的适配器",portalWidgetMemberType:"找不到门户部件成员类型{portletType}对应的适配器",treeTableColumnPlugin:"找不到树表格列插件{pluginKey}对应的适配器",interfaceBehaviorPlugin:"找不到界面行为插件{pluginKey}对应的适配器",interfaceBehaviorMode:"找不界面行为模式{uiactionMode}对应的适配器",frontEndPluginNode:"找不到界面逻辑前端插件节点,插件{pluginKey}对应的适配器",viewPlugin:"找不到视图插件{pluginKey}对应的适配器",correspondViewTypeStyle:"找不到视图类型:[{viewType}]的视图样式:[{viewStyle}]对应的适配器",toolbarItem:"找不到工具栏项插件{pluginKey}对应的适配器",acItem:"找不到自填列表项插件{pluginKey}对应的适配器"}},service:{noConfiguredPrimary:"实体[{codeName}]未配置主键字段",noConfiguredField:"实体[{codeName}]未配置主文本字段",convertedNumber:"{value}不能转换成数字",subRelationships:"子关系未配置嵌套关系数据集, 会导致递归查询死循环,请配置!",unsupportedMethod:"未支持的应用实体方法输入属性类型: {type}",noFoundUsernamePassword:"未找到匿名登录配置用户名或密码",loginFailure:"登录失败",logoutFailure:"登出失败",noFound:"未找到应用实体[{id}]",masterState:"{codeName}实体不存在或者为启用主状态,返回true",operationIdentifier:"操作标识{dataAccessAction}主状态计算开始",matchMasterState:"匹配主状态",masterStatePermissions:"允许的主状态权限集合",noMatchedState:"没匹配主状态,返回false",permissionCalculation:"操作标识{dataAccessAction}权限计算结束:{result}",noFindCodeList:"找不到{tag}代码表",noConfiguredCounters:"未配置应用计数器!",lackEntityLogic:"缺少实体处理逻辑",createBehavior:"create行为没有传data",updateBehavior:"update行为没有传data",deletionDeletion:"目前只支持[DER1N]关系类型关联删除删除",unableDelete:"无法删除[{logicName}-{srfmajortext}], 数据被[{modelLogicName}-{msg}]引用",noSupportedDataSource:"数据来源类型{dataSetType}暂未支持",sourceCodeTable:"没有指定数据来源代码表",requestMethods:"未支持的请求方式: {requestMethod}",noConfiguredRequestMethod:"未配置请求方式",unsupportedBehaviorTypes:"未支持的行为类型[{actionType}]",noFoundServiceMethod:"未找到服务方法: {id}",UnsupportedServiceMethod:"未支持的服务方法类型: {methodType}",noSupportedMethod:"{codeName}未支持「{id}」方法",noFoundStorageEntity:"应用功能[{name}]未找到存储实体[{stoageAppDataEntityId}]",noExist:"应用功能[{name}]不存在",noFoundEntity:"未找到存储实体[{stoageAppDataEntityId}]",noImplemented:"「{methodName}」未实现",noImplementedCounter:"未实现计数器加载方法",noFoundCounterBehavior:"未找到获取计数器行为!",createPrimaryKeyData:"新建联合主键数据失败,已有主键为{srfkey}的数据",updatePrimaryKeyData:"更新联合主键数据失败,已有主键为{srfkey}的数据",noExistNoUpdated:"数据不存在,无法更新!",dataNoExistNoUpdated:"数据[{srfdename}-{srfmajortext}({srfkey})]不存在,无法更新!",noDeleted:"未找到以下数据「{notRemoveKey}」,无法删除!",noAttributeName:"没有指定属性名称",noContextParameterName:"没有指定上下文参数名称",conditionalObjects:"无法识别的条件对象",mustArray:"值必须为数组",unsupportedQueryTypes:"暂未支持的查询条件类型: {condType}",predefinedType:"预定义类型{predefinedType}暂不支持",dynamicCodeTable:"动态代码表数据属性返回值不为对象格式的字符串,无法转换!",unconfiguredDataset:"未配置数据集",processedWithout:"执行「{funcName}」不存在「srfkey」无法处理",noExistProcessed:"执行「{funcName}」不存在「srfsessionid」无法处理",missingDetreeColumnId:"模型异常缺少detreeColumnId或者dataItemName"},uiAction:{noEntityOrBehavior:"未配置实体或实体行为",noConfiguredopenView:"未配置打开视图",frontProcessingModes:"未支持的前台处理模式[{frontProcessType}]",missingConfigurationScriptCode:"自定义类型缺少配置脚本代码",dataPrimaryKey:"没有找到数据主键",printFailure:"打印失败",physicalPrint:"没有找到实体打印项",exportRequestFailed:"导出请求失败",noEntityExportsFound:"没有找到实体导出项",lackNativeEvent:"缺少原生JS事件对象",logout:"退出登录",wantLogout:"您确定要退出登录吗?",operationConfirmation:"操作确认",viewParameterModalOption:"视图参数modalOption 解析失败:{error}",withdrawalConfirmed:"是否确认执行撤回操作?",noFoundBehaviorModel:"没找到{actionId}的界面行为模型"},uiLogic:{interfaceConnectionConditional:"界面连接条件逻辑组未配置逻辑项",connectionConditionGroup:"界面逻辑连接条件组名称:{name}-条件组标识:{id}-运行结果:",currentConditionValue:"当前条件值类型为[数据对象属性],缺少配置条件值",sourceDataObjectAttribute:"当前条件值类型为[源数据对象属性],缺少配置条件值",currentTime:"暂未支持条件值类型为[当前时间]",interfaceConnectionConditionalTypeName:"界面逻辑连接条件项:{name}-条件值类型:{type}-源属性名称:{dstField}-源对象值:",asynchronousTermination:"未支持的逻辑连接类型: 异步结束",asynchronousRejection:"未支持的逻辑连接类型: 异步拒绝",exceptionHandling:"未支持的逻辑连接类型: 异常处理",logicalLinkTypes:"未支持的逻辑连接类型:{linkMode}",missingTargetParameter:"缺少目标参数对象或者源参数对象配置",appendedArray:"界面逻辑节点(附加到数组):{id}-附加参数:",bindingParameters:"界面逻辑节点(绑定参数):{id}-参数名称:{dstDEUILogicParamId}-值:",copyParameter:"界面逻辑节点(拷贝参数):{id}-参数名称:{dstDEUILogicParamId}-值:",missingfilter:"缺少配置过滤参数",interfaceLogicNodeDataSet:"界面逻辑节点(数据集合):{id}-数据集实体标识:{dstAppDataEntityId}-数据集标识:{dstAppDEDataSetId}-参数名称:{retDEUILogicParamId}-值:",interfaceLogicNodeEntityActions:"界面逻辑节点(实体行为):{id}-界面行为所属实体:{dstAppDataEntityId}-实体行为标识:{dstAppDEActionId}-参数名称:{retDEUILogicParamId}-值:",noConfiguredInterfaceBehavior:"未配置界面行为",interfaceLogicNodeEntityInterfaceAction:"界面逻辑节点(实体界面行为):{id}-界面行为标识:{dstAppDEUIActionId}-界面行为所属实体:{dstAppDataEntityId}-目标逻辑参数对象:{dstDEUILogicParamId}",logicalNodeOperation:"逻辑节点{name}操作参数值:",unsupportedEndNode:"暂未支持的结束节点返回值类型: {returnType}",interfaceLogicNodeEndNode:"界面逻辑节点(结束节点):{id}-返回值类型:{returnType}-返回值:",noEntityConfigured:"没有配置实体",noEntityLogicConfigured:"没有配置实体逻辑",noIncomingLogic:"没有配置传入逻辑参数",passedParameter:"没有找到传入参数{dstDEUILogicParamId}",interfaceLogicNodeExecutingEntityLogic:"界面逻辑节点(执行实体逻辑):{id}-实体逻辑标识:{dstAppDELogicId}-实体逻辑所属实体:{dstAppDataEntityId}-参数名称:{retDEUILogicParamId}-值:",missingMessageTypeConfiguration:"缺少消息类型的配置",missingButtonTypeConfiguration:"缺少按钮类型的配置",interfaceLogicNodeMessagePopup:"界面逻辑节点(消息弹窗):{id}-消息类型:{type}-消息:{message}",message:"消息",yes:"是",no:"否",determine:"确定",cancel:"取消",noSupportItem:"{name}暂未支持",interfaceLogicNodeFrontendPlugin:"界面逻辑节点(前端插件):{id}-插件标识:{sysPFPluginId}",interfaceLogicNodePreparationParameter:"界面逻辑节点(准备参数):{id}-参数处理操作:{paramAction}-目标逻辑参数:{dstDEUILogicParamId}-源参数(值):",noTargetParameter:"没有目标参数对象id",targetParameter:"给目标参数属性{dstFieldName}赋值报错,目标参数:",interfaceLogicNodeDirectCode:"界面逻辑节点(直接代码):{id}-直接代码:",interfaceLogicNodeRebuildParameter:"界面逻辑节点(重新建立参数):{id}-重建参数:{dstDEUILogicParamId}",interfaceLogicNodeResetParameter:"界面逻辑节点(重置参数):{id}-重置参数:{dstDEUILogicParamId}",interfaceLogicNodeSortedArrayParameters:"界面逻辑节点(排序数组参数):{id}-排序属性:{dstFieldName}-排序模式:{dstSortDir}-参数名称:{dstDEUILogicParamId}-排序后数组:",interfaceLogicNodeStartupNode:"界面逻辑节点(启动节点):{id}",interfaceLogicNodeThrowingExceptions:"界面逻辑节点(抛出异常):{id}-错误信息:{errorInfo}",noConfiguredTriggerObject:"没有配置触发对象",noConfiguredEvent:"没有配置事件名称参数",noConfiguredEventParameters:"没有配置事件参数",noFoundTriggerObject:"没有找到触发对象{fireCtrlId}",noFoundEventParameterObject:"没有找到事件参数对象{eventParamId}",interfaceLogicNodeViewWidgetEventTriggerLogic:"界面逻辑节点(视图部件事件触发逻辑):{id}-调用视图部件名称:{fireCtrlId}-触发事件名称:{eventName}-触发参数:",noConfiguredInterfaceObject:"没有配置界面对象",noConfiguredOperatingParameters:"没有配置操作参数",noConfiguredCallMethod:"没有配置调用方法",noFoundOperationParameter:"没有找到操作参数{invokeParamId}",noFoundInterfaceObject:"没有找到界面对象{invokeCtrlId}",noFoundInvokeMethod:"没有找到调用方法{invokeMethod}",interfaceLogicNodeViewWidgetInvocation:"界面逻辑节点(视图部件调用):{id}-调用视图部件名称:{invokeCtrlId}-调用方法名称:{invokeMethod}-触发参数:",viewLogicInitializationParameter:"视图逻辑初始化参数,未找到{codeName}指定部件对象",calculateInterfaceLogicParameters:"计算界面逻辑参数,标识:{tag}",restablishInterfaceLogic:"重新建立界面逻辑参数,标识:{tag}",interfaceLogic:"找不到实体{appDataEntityId}的界面逻辑{deUILogicId}",startExecutingInterfaceLogic:"开始执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",endExecutionInterfaceLogic:"结束执行界面逻辑,实体:{appDataEntityId}-逻辑名称:{name}",noLogicalNodesConfigured:"界面逻辑没有配置逻辑节点"},utils:{anime:{noExistEndpointElement:"终点元素不存在",noExistAnimationElement:"动画元素不存在",noClone:"不能克隆空或未定义的元素"},errorHandler:{noPermissionless:"没有注册无权限错误处理器",noProcessor:"没有找到能处理该错误的处理器"},fileUtil:{fileUploadFailed:"文件上传失败"},handlebars:{noInitHandlebars:"handlebars未初始化"},modal:{externalClosureCapability:"外部关闭能力未注册",shouldDismissResult:"shouldDismiss结果为false,关闭中断"},openRedirectView:{parseSrfnavctxParameter:"重定向[{urlStr}] 中 srfnavctx 参数解析失败",missingEntityName:"重定向参数缺少实体名称",noFoundSpecifiedEntity:"未找到指定实体的codeName: {deName}",unsupportedLinkUrl:"未支持的linkUrl格式:{linkUrl}",noConfiguredActualReference:"未配置实际引用视图",redirectingViewReferences:"重定向视图引用有:",redirectionIdentifier:"未找到重定向标识[{rdTag}]或[{deRdTag}]或工作流[{wfRdTag}]对应视图",noMatchActualReferenceView:"标识[{rdTag}]未匹配到实际引用视图",redirectionView:"重定向视图[{name}]自定义类别属性[{typeFieldId}]值为空"},script:{errorReportingScript:"报错脚本"},shortCut:{invalidIndexNewIndex:"无效的索引 newIndex: {newIndex}, oldIndex: {oldIndex}, 当前数组长度为 {length}"},uiDomain:{transactionOpen:"事务已经开启, 单个界面域只能开启一个事务",currentTransaction:"当前事务未提交,不可以直接关闭事务"},uiDomainManager:{invalidInterfaceDomain:"无效的界面域标识[{id}]"},verify:{contentConform:"内容必须符合值规则",scopeRules:"内容长度必须符合范围规则",valueNull:"值为空",regularRules:"值必须符合正则规则",rangeRules:"值必须符合值范围规则",scriptRules:"值必须符合脚本规则",emptyLogicGroups:"发现空逻辑组,逻辑无法正常执行!",unsupportedLogicTypes:"未支持的逻辑类型{logicType}",emptyLogicGroupsProperly:"发现空逻辑组,逻辑无法正常执行!",valueOperations:"值操作:{op},暂未支持",noCompared:"{value} 和 {value2} 无法比较大小",conditionalValues:"范围比较的条件值不存或者不是字符串"},firstregister:"请先注册模型加载适配器"}}})}}}));