@ibiz-template/runtime 0.7.12 → 0.7.13
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.
- package/dist/index.esm.js +317 -51
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +8 -1
- package/out/controller/common/index.d.ts +1 -0
- package/out/controller/common/index.d.ts.map +1 -1
- package/out/controller/common/index.js +1 -0
- package/out/controller/common/view/app-login-view.controller.d.ts +54 -0
- package/out/controller/common/view/app-login-view.controller.d.ts.map +1 -0
- package/out/controller/common/view/app-login-view.controller.js +62 -0
- package/out/controller/hub.controller.d.ts +73 -2
- package/out/controller/hub.controller.d.ts.map +1 -1
- package/out/controller/hub.controller.js +88 -12
- package/out/controller/notification/internal-message.controller.js +1 -1
- package/out/engine/view-base.engine.d.ts +8 -1
- package/out/engine/view-base.engine.d.ts.map +1 -1
- package/out/engine/view-base.engine.js +14 -3
- package/out/interface/controller/app.d.ts +55 -7
- package/out/interface/controller/app.d.ts.map +1 -1
- package/out/interface/controller/controller/view/i-app-login-view.controller.d.ts +40 -0
- package/out/interface/controller/controller/view/i-app-login-view.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/view/i-app-login-view.controller.js +1 -0
- package/out/interface/controller/controller/view/index.d.ts +1 -0
- package/out/interface/controller/controller/view/index.d.ts.map +1 -1
- package/out/interface/service/service/i-auth.service.d.ts +11 -0
- package/out/interface/service/service/i-auth.service.d.ts.map +1 -1
- package/out/interface/util/i-app-util/i-app-util.d.ts +77 -0
- package/out/interface/util/i-app-util/i-app-util.d.ts.map +1 -0
- package/out/interface/util/i-app-util/i-app-util.js +1 -0
- package/out/interface/util/i-short-cut/i-short-cut.d.ts +11 -3
- package/out/interface/util/i-short-cut/i-short-cut.d.ts.map +1 -1
- package/out/interface/util/index.d.ts +1 -0
- package/out/interface/util/index.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.d.ts +64 -0
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +85 -7
- package/out/service/service/authority/authority.service.d.ts.map +1 -1
- package/out/service/service/authority/authority.service.js +5 -3
- package/out/service/service/internal-message/internal-message.service.js +2 -2
- package/out/types.d.ts +9 -1
- package/out/types.d.ts.map +1 -1
- package/out/ui-action/provider/loginout-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/loginout-ui-action-provider.js +1 -4
- package/out/utils/file-util/file-util.d.ts +1 -1
- package/out/utils/file-util/file-util.d.ts.map +1 -1
- package/out/utils/file-util/file-util.js +14 -1
- package/out/utils/index.d.ts +1 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -1
- package/out/utils/short-cut/short-cut-util.d.ts +24 -0
- package/out/utils/short-cut/short-cut-util.d.ts.map +1 -1
- package/out/utils/short-cut/short-cut-util.js +27 -0
- package/package.json +1 -1
- package/out/utils/short-cut/index.d.ts +0 -2
- package/out/utils/short-cut/index.d.ts.map +0 -1
- package/out/utils/short-cut/index.js +0 -1
package/dist/index.system.min.js
CHANGED
|
@@ -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,s,n,o,r,c,d,l,h,u,p,m,g,f,w,E,y,v,I,D,b,C,A,P,T,x,N,S,L,M,R,O,_,z,F,V,k,U,W,B,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,wt,Et,yt,vt,It,Dt,bt,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,w=t.getToken,E=t.NOOP,y=t.selectFile,v=t.Namespace,I=t.IBizParams,D=t.isElementSame,b=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,x=t.BitMask,N=t.mergeInLeft,S=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.toNumberOrNil},function(t){O=t.isEmpty,_=t.isNil,z=t.isString,F=t.isArray,V=t.isObject,k=t.merge,U=t.debounce,W=t.camelCase,B=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.createUUID,ut=t.QXEvent,pt=t.isArray,mt=t.getCookie,gt=t.setCookie,ft=t.clearCookie,wt=t.ascSort,Et=t.descSort,yt=t.clearAll,vt=t.isNumber,It=t.isString,Dt=t.isObject},function(t){bt=t.default},function(t){Ct=t.default},function(t){At=t.default},function(t){Pt=t.default}],execute:function(){t({SearchCondEx2filterNode:Od,asyncImportData:pr,asyncImportData2:Ir,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:De,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=dn(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:Td,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:Dr,calcLayoutHeightWidth:Ie,calcMainStateOPPrivsStrs:Ce,calcNavParams:ge,calcResPath:ln,calcSearchCondExs:zd,calcSearchConds:Rd,compare:Ye,compareNumber:Qe,contains:$e,convertNavData:he,convertNavDataByArray:pe,convertObjectToNavParams:le,createImportSchema:async function(t){const e=Dr(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:yr,execDELogic:io,execDELogicAction:so,execDELogicById:ao,execFieldLogics:oo,execUILogic:bc,exportData:fr,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:un,filterFieldLogics:xe,filterNode2SearchCond:Md,filterNode2SearchCondEx:_d,filterValueRules:Ii,findAppDEMethod:ve,findChildFormDetails:_e,findDELogic:Te,findEditItem:Oe,findFieldById:Ne,findModelChild:fe,formatMultiData:me,generateEditorRules:cr,generateRules:rr,getAllPanelField:Ge,getAppCounterProvider:as,getAppMenuItemProvider:Ys,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(Ls,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Re,getControl:we,getControlPanel:ye,getControlProvider:rs,getControlsByView:Fe,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:Gs,getDERedirectToView:Xe,getDataImportModels:wr,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:lr,getEditorProvider:ls,getEntitySchema:br,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat($s,"_").concat(i)));var i;return e},getFormDetailProvider:ps,getGridColumnProvider:fs,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(Qs,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:dn,getOriginData:or,getOriginFilterNodes:Sd,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:ys,getPlatformProvider:ks,getPlatformType:_s,getPortletProvider:Ds,getRootNode:Le,getTreeGridExColumnProvider:Hs,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:Ps,getUILogicNodeProvider:xs,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 Za(s,n);if(t&&(e=Ss(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Ss("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=Ss(i));e||(e=Ss("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:Ni,hasDeCodeName:Pe,hasSubRoute:sr,importData:mr,importData2:gr,install:function(){const{ibiz:t}=window;t.util=new pl,t.hub=new dl,t.register=new kt,t.config=new Vt,t.auth=new Nn,t.engine=new ll,t.uiDomainManager=new Pi,t.markOpenData=new go,ko(),Lc(),po(),en(),ibiz.scheduler=new Dl,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Pl(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Cl(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new xl(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Nl(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new fl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new wl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new wl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Tl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Sl(t,e))),function(){const t=new Rs;Fs("Browser",(()=>t))}(),t.platform=ks()},installCommand:ko,isDataContainer:Ue,isFormDataContainer:ze,isHiddenFilter:wd,isSimpleItems:fd,isValueChange:nr,matchMainState:be,openDataImport:Er,openRedirectView:Ke,parseSubFieldInfo:Ed,parseUserParams:Ee,parseViewProtocol:je,presetAppCounterProvider:en,presetDEMethodProvider:po,presetUIActionProvider:Lc,registerAppCounterProvider:es,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Xs,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(Ls,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(ns,"_").concat(t),e)},registerDEMethodProvider:Ws,registerEditorProvider:function(t,e){ibiz.register.register("".concat(cs,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat($s,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(hs,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(ms,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Qs,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(ws,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:Fs,registerPortletProvider:function(t,e){ibiz.register.register("".concat(vs,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(js,"_").concat(t),e)},registerUIActionProvider:Cs,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Ts,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)},selectAndImport:vr,strContain:Je,testCond:qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await He(t,e,i);await ibiz.commands.execute(zo.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=Dr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:Ld,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 xt={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)}}}(xt);var Nt=Tt(xt.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),zt={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)}})}(zt);var Ft=Tt(zt.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}}),Wt=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)}}),Bt=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}};Bt.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 Bt.handleJudgmentExecute(this,i,e)}},Kt=class extends Gt{constructor(t){super(t,"camelCase")}onExecute(t){return t?W(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=B(t,e);return Bt.handleJudgmentExecute(this,a,i)}},qt=class extends Gt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=G(t,e);return Bt.handleJudgmentExecute(this,a,i)}},Yt=class extends Gt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=j(t,e);return Bt.handleJudgmentExecute(this,a,i)}},Qt=class extends Gt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let s=!1;return s=F(t)?!B(K(t,(t=>B(t[e],i))),-1):t.hasOwnProperty(e)&&(s=B(t[e],i)),Bt.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 Bt.handleJudgmentExecute(this,a,i)}},ee=class extends Gt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=X(t,e);return Bt.handleJudgmentExecute(this,a,i)}},ie=class extends Gt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!B(t,e);return Bt.handleJudgmentExecute(this,a,i)}},ae=class extends Gt{constructor(t){super(t,"not")}onExecute(t,e){const i=et(t)||Z(t);return Bt.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 we(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 Ee(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 ye(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 De(t,e){const i=[],a=ei.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return z(a)?i.push(a):F(a)?i.push(...a):V(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function be(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 xe(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 Ne(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 ze(t){return"MDCTRL"===t.detailType}function Fe(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 We=["panelItems","panelTabPages","rootPanelItems"];function Be(t){let e=[];for(const i of We)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(...Be(t))}))),i}function Ge(t){return Be(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(zo.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=bt.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}=Ne(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}=Ne(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(dt(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Ne(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 w="";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(w=d.refAppViewId,d.openMode&&(s.openMode=d.openMode),w)return{type:"view",viewId:w,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),w=t.viewId}if(w)return{type:"view",viewId:w,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||{})),wi=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(wi||{})),Ei=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))(Ei||{})),yi=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(yi||{})),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 Di=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")}}),bi=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}}),xi=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 Ni(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 Si={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 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,Si)}(s,Mi(a)),e.appendChild(s),s}function Mi(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 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},zi=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Fi={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 Wi={arr:function(t){return Array.isArray(t)},obj:function(t){return ki(Object.prototype.toString.call(t),"Object")},pth:function(t){return Wi.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||Wi.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 Wi.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 Wi.hex(t)||Wi.rgb(t)||Wi.hsl(t)},key:function(t){return!Oi.hasOwnProperty(t)&&!_i.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function Bi(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Gi(t,e){var i=Bi(t),a=Vi(Wi.und(i[0])?1:i[0],.1,100),s=Vi(Wi.und(i[1])?100:i[1],.1,100),n=Vi(Wi.und(i[2])?10:i[2],.1,100),o=Vi(Wi.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=Fi.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 Fi.springs[t]=n,n}}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 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)}}}(),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(Wi.fnc(t))return t;var i=t.split("(")[0],a=qi[i],s=Bi(t);switch(i){case"spring":return Gi(t,e);case"cubicBezier":return Ui(Xi,s);case"steps":return Ui(ji,s);default:return Ui(a,s)}}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,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 Ji(t){return t.reduce((function(t,e){return t.concat(Wi.arr(e)?Ji(e):e)}),[])}function Zi(t){return Wi.arr(t)?t:(Wi.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]=Wi.und(t[a])?e[a]:t[a];return i}function sa(t){return Wi.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Wi.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):Wi.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 na(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 Wi.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"],na(e)))return e;var a=Fi.CSS[e+i];if(!Wi.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 Fi.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(),s=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?ca(t,s,i):s}}function la(t,e){return Wi.dom(t)&&!Wi.inp(t)&&(!Wi.nil(ra(t,e))||Wi.svg(t)&&t[e])?"attribute":Wi.dom(t)&&ta(zi,e)?"transform":Wi.dom(t)&&"transform"!==e&&da(t,e)?"css":null!=t[e]?"object":void 0}function ha(t){if(Wi.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 ua(t,e,i,a){var s=ki(e,"scale")?1:0+function(t){return ki(t,"translate")||"perspective"===t?"px":ki(t,"rotate")||ki(t,"skew")?"deg":void 0}(e),n=ha(t).get(e)||s;return i&&(i.transforms.list.set(e,n),i.transforms.last=e),a?ca(t,n,a):n}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=na(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 ga(t,e){if(Wi.col(t))return sa(t);if(/\s/g.test(t))return t;var i=na(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 wa(t){for(var e,i=t.points,a=0,s=0;s<i.numberOfItems;s++){var n=i.getItem(s);s>0&&(a+=fa(e,n)),e=n}return a}function Ea(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 wa(t);case"polygon":return function(t){var e=t.points;return wa(t)+fa(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function ya(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Wi.svg(e)&&Wi.svg(e.parentNode);)e=e.parentNode;return e}(t),s=a.getBoundingClientRect(),n=ra(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 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 s=ya(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 Ia(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=ga(Wi.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Wi.str(t)||e?a.split(i):[]}}function Da(t){return $i(t?Ji(Wi.arr(t)?t.map(Zi):Zi(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function ba(t){var e=Da(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)),Wi.arr(t)){var a=t.length;2===a&&!Wi.obj(t[0])?t={value:t}:Wi.fnc(e.duration)||(i.duration=e.duration/a)}var s=Wi.arr(t)?t:[t];return s.map((function(t,i){var a=Wi.obj(t)&&!Wi.pth(t)?t:{value:t};return Wi.und(a.delay)&&(a.delay=i?0:e.delay),Wi.und(a.endDelay)&&(a.endDelay=i===s.length-1?e.endDelay:0),a})).map((function(t){return aa(t,i)}))}function Aa(t,e){var i=[],a=e.keyframes;for(var s in a&&(e=aa(function(t){for(var e=$i(Ji(t.map((function(t){return Object.keys(t)}))),(function(t){return Wi.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)Wi.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)Wi.key(s)&&i.push({name:s,tweens:Ca(e[s],t)});return i}function Pa(t,e){var i;return t.tweens.map((function(a){var s=function(t,e){var i={};for(var a in t){var s=oa(t[a],e);Wi.arr(s)&&1===(s=s.map((function(t){return oa(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=Wi.arr(n)?n[1]:n,r=na(o),c=pa(e.target,t.name,r,e),d=i?i.to.original:c,l=Wi.arr(n)?n[0]:d,h=na(l)||na(c),u=r||h;return Wi.und(o)&&(o=d),s.from=Ia(l,u),s.to=Ia(ma(o,l),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Yi(s.easing,s.duration),s.isPath=Wi.pth(n),s.isPathTargetInsideSVG=s.isPath&&Wi.svg(e.target),s.isColor=Wi.col(s.from.original),s.isColor&&(s.round=1),i=s,s}))}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,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 xa(t,e){ba(t).forEach((function(t){for(var i in e){var a=oa(e[i],t),s=t.target,n=na(a),o=pa(s,i,n,t),r=ma(ga(a,n||na(o)),o),c=la(s,i);Ta[c](s,i,r,t.transforms,!0)}}))}function Na(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),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!Wi.und(t)}))}function Sa(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 La=0;var Ma=[],Ra=function(){var t;function e(i){for(var a=Ma.length,s=0;s<a;){var n=Ma[s];n.paused?(Ma.splice(s,1),a--):(n.tick(i),s++)}t=s>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,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=ia(Oi,t),i=ia(_i,t),a=Aa(i,t),s=ba(t.targets),n=Na(s,a),o=Sa(n,i),r=La;return La++,aa(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/_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 s=i[e],n=s.animatable,o=s.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,w=0;w<g;w++){var E=void 0,y=d.to.numbers[w],v=d.from.numbers[w]||0;E=d.isPath?va(d.value,h*y,d.isPathTargetInsideSVG):v+h*(y-v),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){f=u[0];for(var D=0;D<I;D++){u[D];var b=u[D+1],C=m[D];isNaN(C)||(f+=b?C+b:C+" ")}}else f=m[0];Ta[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,w=l(t);c.progress=Vi(w/h*100,0,100),c.reversePlayback=w<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])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=g&&0!==c.currentTime&&p(0),(w>=f&&c.currentTime!==h||!h)&&p(h),w>g&&w<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Vi(w,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 xa(t,e),c},c.tick=function(t){s=t,i||(i=s),g((s+(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){Fa(Da(t),c)},c.reset(),c.autoplay&&c.play(),c}function za(t,e){for(var i=e.length;i--;)ta(t,e[i].animatable.target)&&e.splice(i,1)}function Fa(t,e){var i=e.animations,a=e.children;za(t,i);for(var s=a.length;s--;){var n=a[s],o=n.animations;za(t,o),o.length||n.children.length||a.splice(s,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=Da(t),i=Ma.length;i--;){Fa(e,Ma[i])}},_a.get=pa,_a.set=xa,_a.convertPx=ca,_a.path=function(t,e){var i=Wi.str(t)?Qi(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:ya(i),totalLength:Ea(i)*(a/100)}}},_a.setDashoffset=function(t){var e=Ea(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,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Wi.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=na(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!g.length){for(var E=0;E<w;E++){if(s){var y=c?(s[0]-1)/2:o%s[0],v=c?(s[1]-1)/2:Math.floor(o/s[0]),I=y-E%s[0],D=v-Math.floor(E/s[0]),b=Math.sqrt(I*I+D*D);"x"===n&&(b=-I),"y"===n&&(b=-D),g.push(b)}else g.push(Math.abs(o-E));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}},_a.timeline=function(t){void 0===t&&(t={});var e=_a(t);return e.duration=0,e.add=function(i,a){var s=Ma.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Ma.splice(s,1);for(var r=0;r<n.length;r++)o(n[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=Wi.und(a)?d:ma(a,d),o(e),e.seek(c.timelineOffset);var l=_a(c);o(l),n.push(l);var h=Sa(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},_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,s=t.complete;i.complete=t=>{a(t),s(t)}}return{...t,...e,...i}}function Wa(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=Ua({targets:t,translateX:r,translateY:c,...ka,complete:()=>{e(!0)}},i);Va(a)}))}var Ba=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 s=Li(t,document.body);if(!s)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:n,width:o,height:r}=Mi(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 Wa(s,a,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,i={}){return Wa(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 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+=bt.stringify(d,{addQueryPrefix:!0}),c+=bt.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"));{const 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}}),ja=t("ShortCutUtil",class{constructor(){this.$ShortCut=[],this.initShortCut()}get data(){return this.$ShortCut}initShortCut(){const t=window.localStorage.getItem("IbizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){window.localStorage.setItem("IbizShortCut",JSON.stringify(this.$ShortCut))}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.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.splice(e,1,t):this.$ShortCut.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut;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.splice(e,1)[0];this.$ShortCut.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.findIndex((e=>e.key===t))>=0}}),Ka=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}},Ha=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Xa=class extends Ha{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}},qa=class t extends Ha{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 Xa;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Ya=class extends qa{},Qa=class extends Xa{},$a=class t extends Ka{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof qa){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 Xa){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 Qa}createPSModelGroupCond(){return new Ya}};$a.PARAMTYPE_DATACONTEXT="DATACONTEXT",$a.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Ja=t("PSDEDQCondEngine",$a);async function Za(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 ts=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function es(t,e){ibiz.register.register("".concat(ts,"_").concat(t),e)}function is(t){return ibiz.register.get("".concat(ts,"_").concat(t))}async function as(t){let e;const{codeName:i,counterType:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Za(s,n);if(t&&(e=is(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=is(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=is(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var ss=class{static getRegisterKey(t,e){switch(t){case ws:return this.calcKeyByView(e);case hs:case ms:case ns: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}},ns=t("CONTROL_PROVIDER_PREFIX","CONTROL");function os(t){return ibiz.register.get("".concat(ns,"_").concat(t))}async function rs(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:s,appId:n}=t,o=ss.getRegisterKey(ns,{controlModel:t});if(e=os(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Za(s,n);if(t&&(e=os(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=os("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=os(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var cs=t("EDITOR_PROVIDER_PREFIX","EDITOR");function ds(t){return ibiz.register.get("".concat(cs,"_").concat(t))}async function ls(t){let e;const{editorType:i,editorStyle:a,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Za(n,o);if(t&&(e=ds(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=ds("".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=ds(n),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:s}),t)}if(e=ds(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var hs=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function us(t){return ibiz.register.get("".concat(hs,"_").concat(t))}async function ps(t,e){let i;const{detailType:a,sysPFPluginId:s,appId:n}=t,o=ss.getRegisterKey(hs,{controlItemModel:t,controlModel:e});if(i=us(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Za(s,n);if(t&&(i=us(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=us(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var ms=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function gs(t){return ibiz.register.get("".concat(ms,"_").concat(t))}async function fs(t,e){let i;const{columnType:a,enableRowEdit:s,sysPFPluginId:n,appId:o}=t,r=ss.getRegisterKey(ms,{controlItemModel:t,controlModel:e});if(i=gs(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),n){const t=await Za(n,o);if(t&&(i=gs(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=gs(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var ws=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Es(t){return ibiz.register.get("".concat(ws,"_").concat(t.toUpperCase()))}async function ys(t,e,i){var a;let s;const{itemType:n,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=ss.getRegisterKey(ws,{controlItemModel:t,controlModel:e,viewModel:i});if(s=Es(d),s)return s;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Za(o,r);if(t&&(s=Es(t)),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)s=Es("PREDEFINE_RENDER");else{if("CONTAINER"===n){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(s=Es(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=Es(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=Es("FIELD_".concat(e.predefinedType.toUpperCase())),s)return s}}s=Es(n)}if(s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:n}))}var vs=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Is(t){return ibiz.register.get("".concat(vs,"_").concat(t))}async function Ds(t){let e;const{portletType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Za(a,s);if(t&&(e=Is(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=Is(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var bs=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Cs(t,e){ibiz.register.register("".concat(bs,"_").concat(t),e)}function As(t){return ibiz.register.get("".concat(bs,"_").concat(t))}async function Ps(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:s,uiactionTag:n}=t;if(a){const t=await Za(a,s);if(t&&(e=As(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=As("".concat(i,"_").concat(n)),e)return e;if(e=As(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var Ts=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function xs(t){let e;const{sysPFPluginId:i,appId:a}=t,s=await Za(i,a);if(s){if(e=ibiz.register.get("".concat(Ts,"_").concat(s)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:s}))}}var Ns=t("VIEW_PROVIDER_PREFIX","VIEW");function Ss(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}var Ls=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var Ms=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 Ms{});var Os=window.navigator.userAgent.toLowerCase();function _s(){return/Android|Adr/i.test(Os)?"Android":/iPhone|iPod|iPad/i.test(Os)?"IOS":/MicroMessenger/i.test(Os)?"WeChat":/DingTalk/i.test(Os)?"DingTalk":/miniProgram/i.test(Os)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var zs=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Fs(t,e){ibiz.register.register("".concat(zs,"_").concat(t),e)}function Vs(t){return ibiz.register.get("".concat(zs,"_").concat(t))}function ks(){const t=Vs(_s());return t||Vs("Browser")}var Us=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ws(t,e){ibiz.register.register("".concat(Us,"_").concat(t),e)}function Bs(t){return ibiz.register.get("".concat(Us,"_").concat(t))}async function Gs(t){let e;const{methodType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Za(a,s);if(t&&(e=Bs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=Bs(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var js=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Ks(t){return ibiz.register.get("".concat(js,"_").concat(t))}async function Hs(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:s}=t;if(s){const t=await Za(s,a);if(t&&(e=Ks(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Ks(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Xs=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function qs(t){return ibiz.register.get("".concat(Xs,"_").concat(t))}async function Ys(t){let e;const{sysPFPluginId:i,appId:a,itemType:s}=t;if(i){const t=await Za(i,a);if(t&&(e=qs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=qs(s),e}var Qs=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var $s=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Js=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.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.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}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)}}),Zs=t("AppDECounter",class extends Js{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}}),tn=t("AppDECounterProvider",class{createCounter(t){return new Zs(t)}});function en(){es("DEDR",(()=>new tn))}var an=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 Ja;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}});an.map=new WeakMap;var sn=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=d.create(),this.params={},this.evt=new ut,this.commonKeys=["query","queryconds"],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=un(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=ei.execSingleLine(t[d])}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 nn(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 on(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 rn=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{on("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{on("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{on("update",t),nn("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{on("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{on("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=ht()),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{on("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];nn("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{on("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}}),cn=/\$\{(.*?)\}/g;function dn(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(cn);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 ln(t,e){const i=dn(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 hn=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 un(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 pn(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}var mn=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 sn(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 sn(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof sn&&t.destroy()}))}}),gn=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||{}}}),fn=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 as(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)}});fn.counterMap=new Map;var wn=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}))}}}),En=class{constructor(t){this.model=t}exportData(t,e,i,a){const s=ln(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"})}},yn=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(yn||{})),vn=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)?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 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}}),In=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=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,i)=>{e[i+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((i=>{const a=parseInt(i,10);e[a-1]=t[a]})),e}async get(t,e,s=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return 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:this.convertArrayToListMap(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)return e&&e.length>0?e.map((t=>this.service.createEntity(t))):[];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]=this.convertListMapToArray(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)}}}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}}),Dn=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new rn(e),this.configCache=new gn(e.appId,"PSAppDataEntity",e.codeName),this.wf=new wn(e),this.file=new En(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 Gs(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 ln(t,this.model)+a}newEntity(t){return t instanceof vn?t.clone():new vn(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 In(this,this.model,null==e?void 0:e.isLocalMode,t)}}),bn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],Cn=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;bn.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}}),An=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 Cn(t,this.dataUIMap)}}),Pn=t("MDControlService",class extends An{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}}),Tn=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)?pn(e.srfdataaccaction):void 0;break;case 2:a=pn(await this.calcMajorDataAccAction(i));break;case 3:a=pn(await this.calcMajorDataAccAction(i)),!Object.prototype.hasOwnProperty.call(a,t)&&e&&e.srfdataaccaction&&(a=pn(e.srfdataaccaction))}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=be(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}}),xn=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 Tn(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 calcByDataAccessAction(t,e,i,a){if(this.enablePermission){const e=await ibiz.hub.getApp(this.appModel.appId),i=await e.getOPPriv(t,a);if(i&&i.mapSysUniResMode&&i.mapSysUniResCode)return!!this.calcByResCode(i.mapSysUniResCode)}if(a){return(await this.getService(a)).calcByDataAccessAction(t,i,e,this.enablePermission)}return!0}}),Nn=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&>(u.REFRESH_TOKEN,a,0,!0)}return i}async login(t,e,i,a){try{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&>(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&>(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"),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,!0}catch(t){ibiz.notification.error({title:ibiz.i18n.t("runtime.service.logoutFailure"),desc:t.message||""})}return!1}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&>(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&>(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&>(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&>(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)}}),Sn=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))}}),Ln=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}}),Mn=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 vn(this.entity,e)}}),Rn=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 Ln(t,e,i),this.result=new Mn(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 ln(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),On=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:F(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)}},_n=class{},zn=class extends _n{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}},Fn=class t extends _n{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new zn(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}},Vn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Fn(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},kn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new Vn(t)))}},Un=class extends kn{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])}},Wn=class extends kn{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Bn=class extends kn{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 Gn(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 jn=class extends kn{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=Gn(e,t);e.params[i]=it(a)}bindParam(t,e){const i=Gn(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=Gn(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=Gn(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]))}},Kn=class extends kn{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])}},Hn=class extends kn{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=Gn(t,this.model);t.params[e]=s,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),s)}},Xn=class extends kn{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}))}},qn=class extends kn{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}))}},Yn=class extends kn{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=Gn(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)}},Qn=class extends kn{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)}},$n=class extends kn{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=Gn(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))}},Jn=class extends kn{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}})}},Zn=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])}},to=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 Wn(t);break;case"END":i=new Bn(t);break;case"DEACTION":i=new Un(t);break;case"PREPAREPARAM":i=new jn(t);break;case"DEDATASET":i=new Kn(t);break;case"THROWEXCEPTION":i=new Jn(t);break;case"BINDPARAM":i=new Hn(t);break;case"RESETPARAM":i=new Xn(t);break;case"COPYPARAM":i=new Yn(t);break;case"RENEWPARAM":i=new qn(t);break;case"APPENDPARAM":i=new $n(t);break;case"SORTPARAM":i=new Qn(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 Zn(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 On(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}}},eo=new Map;async function io(t,e,i={},a={}){eo.has(t)||eo.set(t,new to(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const s=eo.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 ao(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 io(n,i,a,s)}async function so(t,e,i,a){const n=it(e),o=i?it(i):i,r=a?it(a):a;try{const e=await io(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function no(t,e,i,a,s){const n=xe(t,e);if(n.length){(await Promise.all(n.map((t=>io(t,i,a,s))))).forEach((t=>{Object.assign(a,t)}))}}async function oo(t,e,i,a,s={}){if(a){if(!F(a))return no(t,e,i,a,s);await Promise.all(a.map((a=>no(t,e,i,a,s))))}}var ro=t("DEActionMethod",class extends Rn{async inputHandle(t,e){return F(e)?e:this.input.handle(t,e)}async exec(t,e,a,s){let n;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await oo(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 so(s,t,e,a)}else{e&&!this.isLocalMode&&(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=F(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);o.data=await this.result.handle(t,o.data),n=o}}}return n.data&&await oo(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=F(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=wt(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=F(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}}),co=class{create(t,e,i,a){return new ro(t,e,i,a.localMode)}},lo=t("FetchMethod",class extends Rn{async exec(t,e,i,s){const n=e&&!F(e)?e:i||{};let o;if(this.isLocalMode){const e=an.getCond(this.method),i=new hn(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||[];o.data=r.map((t=>this.createEntity(t)))}return o.data&&await oo(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?Et(a,e.sortField):wt(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)}}),ho=t("AcFetchMethod",class extends lo{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),uo=class{create(t,e,i,a){return a.acMode?new ho(t,e,i,a.localMode):new lo(t,e,i,a.localMode)}};function po(){const t=new co;Ws("DEACTION",(()=>t));const e=new uo;Ws("FETCH",(()=>e)),Ws("FETCHTEMP",(()=>e))}var mo=t("InternalMessageService",class{constructor(){this.baseUrl="/extension/internal_messages"}async fetch(t={}){const e={page:0,size:20,sort:"update_time,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:"update_time,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}}),go=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))}}),fo=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])}}),wo=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}}),Eo=t("TreeCodeListNodeData",class extends wo{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)}}),yo=["_id","srfnodeid","_value","_text","_deData","clone"],vo=t("TreeDataSetNodeData",class t extends wo{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=un(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!un(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});return Object.keys(this).forEach((t=>{const e=u(t);Z(e)&&!yo.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}}),Io=t("TreeStaticNodeData",class extends wo{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)}}),Do=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}}),bo=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 Co=["REGION","REGION2","REGION3","REGION4"],Ao=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,Co.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 Po=t("PanelData",class{constructor(t,e){const i=new ut,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 To=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}})}}),xo=(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},No=t("GanttStaticNodeData",class extends Io{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=xo(t.sndataItemName,e),this._beginDataItemValue=xo(t.beginDataItemName,e),this._endDataItemValue=xo(t.endDataItemName,e),this._prevDataItemValue=xo(t.prevDataItemName,e),this._finishDataItemValue=xo(t.finishDataItemName,e),this._totalDataItemValue=xo(t.totalDataItemName,e)}}),So=t("GanttDataSetNodeData",class extends vo{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=xo(t.sndataItemName,e,s),this._beginDataItemValue=xo(t.beginDataItemName,e,s),this._endDataItemValue=xo(t.endDataItemName,e,s),this._prevDataItemValue=xo(t.prevDataItemName,e,s),this._finishDataItemValue=xo(t.finishDataItemName,e,s),this._totalDataItemValue=xo(t.totalDataItemName,e,s)}}),Lo=t("GanttCodeListNodeData",class extends Eo{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=xo(t.sndataItemName,e,s),this._beginDataItemValue=xo(t.beginDataItemName,e,s),this._endDataItemValue=xo(t.endDataItemName,e,s),this._prevDataItemValue=xo(t.prevDataItemName,e,s),this._finishDataItemValue=xo(t.finishDataItemName,e,s),this._totalDataItemValue=xo(t.totalDataItemName,e,s)}}),Mo=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()}}),Ro=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 Dn(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}}};Ro.constructorCache=new Map;var Oo=t("DEServiceUtil",Ro),_o=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)}};_o.TAG="ibiz.app-view.open";var zo=t("OpenAppViewCommand",_o),Fo=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(zo.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"))}};Fo.TAG="ibiz.app-func.exec";var Vo=t("AppFuncCommand",Fo);function ko(){new Vo,new zo}var Uo=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 gn(this.appId,"PSSysApp",t.codeName),this.deService=new Oo(t),this.codeList=new mn(t),this.authority=new xn(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 Mo(ibiz.appData.mqtttopic,w(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),Wo=class{parse(t){return t}},Bo=class{constructor(){this.appMenu=new Wo}},Go=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}},jo=class{constructor(){this.view=new Go}},Ko=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ko||{})),Ho=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ho||{})),Xo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Xo||{})),qo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(qo||{})),Yo=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}}),Qo=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Yo(E)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),$o=t("CTXState",class{}),Jo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new ut(3e3),this.controllersMap=new Map,this.state=new $o}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}}),Zo=t("ActivityCounter",class extends Yo{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())}}),tr=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,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.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)}}),er=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())))}}),ir=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))),s=Promise.all(a),n=await i,o=await s;return n.concat(...o)}reset(){super.reset(),yt(this.anyEventFns)}}),ar=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new ir}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 sr(t){return window.location.hash.split("/").length>2*t+2}function nr(t,e){return(!Z(t)&&""!==t||!Z(e)&&""!==e)&&t!==e}function or(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof Cn&&(e=e.getOrigin()),e}function rr(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 cr(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 dr=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 lr(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 ht();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:n}))}}}var hr="asyncimportdata2",ur="importdata2";async function pr(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("component.dataImport.startImport")});const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(hr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ln(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 mr(t,e,i,a){const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(ur);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ln(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 gr(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)pr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await mr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function fr(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 wr(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 Er(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(zo.TAG,o.id,a,s,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await wr({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 yr(t,e){var i;let a="".concat(t.codeName2.toLowerCase(),"/importtemplate");(null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName));const s=await ibiz.net.request(a,{responseType:"blob"});if(200===s.status){let t=(null==(i=s.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:i.slice(9))||"";t=decodeURIComponent(t);const e=new Blob([s.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}async function vr(t){return new Promise((e=>{y({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await gr({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Ir(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=ln(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("component.dataImport.startImport")})}function Dr(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 br(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 Cr=t("VIEW_MSG_PREFIX","VIEW_MSG"),Ar=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Cr,"_").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=Ne(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 so(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 w=await t.fetchDataSet(n,a,g);if(!w.length)return[];const E=this.calcStaticMsg(e),y=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),I=this.getDeFieldName(m,h),D=this.getDeFieldName(m,l),b=this.getDeFieldName(m,d);return w.map((t=>{const e={};v&&!Z(t[v])&&(e.position=t[v]),y&&!Z(t[y])&&(e.title=t[y]),I&&!Z(t[I])&&(e.message=t[I]),D&&!Z(t[D])&&(e.messageType=t[D]),b&&!Z(t[b])&&(e.removeMode=t[b]),Z(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=tt(E,e);return i.data={...t,env:i},i}))}}),Pr="__self",Tr=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 ar(this.getEventArgs.bind(this)),this.mountCounter=new Zo(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(Pr),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(Pr)||this.mountCounter.attend(Pr)}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(){}}),xr=t("ViewController",class extends Tr{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),d.create({},e),i||{},new Jo(a)),this.session={},this.modal=new vi({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new Qo,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 fn.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 rs(t);this.providers[t.name]=e;const i=Fe(this.model);i&&await Promise.all(i.map((async t=>{const e=await rs(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 Ar(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)}}),Nr=(t("AppDataUploadViewController",class extends xr{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:s}=await wr({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=s}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;yr(t,e)}async selectAndImport(){const t=await vr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Ir({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends xr{}),t("WFStepTraceViewController",class extends xr{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 dr.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)}})),Sr=(t("CodeListEditorController",class extends Nr{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 Tr{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=ye(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 rs(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())}actionNotification(t,e){let i,a="";const{ctrlMsg:o}=this.model;if(o&&o.ctrlMsgItems){if(o.ctrlMsgItems.find((e=>e.name==="".concat(t,"_HIDDEN"))))return;const s=o.ctrlMsgItems.find((e=>e.name===t));if(s&&s.content){i=Z(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ei.execScriptFn(t,"`".concat(s.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 Cn?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()}})),Lr=t("MDControlController",class extends Sr{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: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)){if(!await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{await Ni(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:"数据[".concat(a.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:a}),t}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;D(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 Er({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"})}}),Mr=t("AppMenuController",class extends Sr{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.flattenAllItems()}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)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ys(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,s={}){const n=b(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(Vo.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)}}),Rr=(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 fo(e):this.config=new gn(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;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t}async resetCustomModelData(){return{}}async saveCustomModelData(t,e={}){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},t):await this.config.save(t),t}}),t("AppMenuIconViewController",class extends Mr{async onClickMenuItem(t,e){const a=b(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(Vo.TAG,a.appFuncId,s,this.params)}}),t("CalendarService",class extends Pn{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 bo(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 Lr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Rr(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}}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.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(Nt),Ct.extend(Lt),Ct.extend(Rt),Ct.extend(_t),Ct.extend(Ft);var Or="$default_group",_r=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=jr(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&&Object.assign(e,{[this.groupField]:a}),this.catalogField&&Object.assign(e,{[this.catalogField]:i});const n=new To(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=Or;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})}))}const n=this.translateVal(a,t[this.catalogField],!0);if(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,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(a&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(a).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,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!==Or&&(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[Or].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)}},zr=class extends _r{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}},Fr=class extends _r{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}},Vr=class extends _r{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 _r{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}},Ur=class extends _r{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}},Wr=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})))}}},Br=class extends _r{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Wr(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===Or?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:a};return this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}},Gr=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 Dt(t[a])?i[a]=Gr(t[a]):i[a]=t[a]})),i};function jr(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]}})),Gr(e)}var Kr=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=jr(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new zr(t,this);break;case"bar":e=new Fr(t,this);break;case"scatter":e=new Ur(t,this);break;case"pie":e=new kr(t,this);break;case"funnel":e=new Vr(t,this);break;case"radar":e=new Br(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,jr(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)}},Hr=t("ChartService",class extends Pn{}),Xr=(t("ChartController",class extends Lr{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 Hr(this.model),await this.service.init(this.context),this.generator=new Kr(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 Sr{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)}}),qr=class{};function Yr(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 Qr=class extends qr{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=Yr(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=Yr(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}},$r=class t extends qr{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new Qr(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}},Jr=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 $r(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}))}}},Zr=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new Jr(t)))}},tc=class extends Zr{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])}},ec=class extends Zr{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 Cc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},ic=class extends Zr{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},ac=class extends Zr{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)}}},sc=class extends Zr{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=Yr(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=Yr(e,t);e.params[i]=it(a)}bindParam(t,e){const i=Yr(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=Yr(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]))}},nc=class extends Zr{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)}},oc=class extends Zr{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=Yr(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)}},rc=class extends Zr{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("control.common.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("control.common.determine"),d.cancelButtonText=ibiz.i18n.t("app.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("control.common.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])}},cc=class extends Zr{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await xs(this.model);e&&await e.exec(this.model,t)}},dc=class extends Zr{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)}},lc=class extends Zr{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}))}},hc=class extends Zr{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=Yr(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)}},uc=class extends Zr{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=Yr(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))}},pc=class extends Zr{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)}},mc=class extends Zr{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}))}},gc=class extends Zr{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])}},fc=class extends Zr{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)}},wc=class extends Zr{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)}},Ec=class extends Zr{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 ao(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)}},yc=class extends Zr{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})}},vc=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])}},Ic=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 ic(t);break;case"END":i=new ac(t);break;case"DEACTION":i=new tc(t);break;case"DEUIACTION":i=new ec(t);break;case"PREPAREJSPARAM":i=new sc(t);break;case"RESETPARAM":i=new lc(t);break;case"COPYPARAM":i=new hc(t);break;case"BINDPARAM":i=new oc(t);break;case"VIEWCTRLINVOKE":i=new nc(t);break;case"MSGBOX":i=new rc(t);break;case"DEBUGPARAM":i=new dc(t);break;case"APPENDPARAM":i=new uc(t);break;case"SORTPARAM":i=new pc(t);break;case"RENEWPARAM":i=new mc(t);break;case"DEDATASET":i=new gc(t);break;case"THROWEXCEPTION":i=new fc(t);break;case"VIEWCTRLFIREEVENT":i=new wc(t);break;case"DELOGIC":i=new Ec(t);break;case"PFPLUGIN":i=new cc(t);break;case"RAWJSCODE":i=new yc(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 vc(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 Xr(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}}},Dc=new Map;async function bc(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}));Dc.has(s)||Dc.set(s,new Ic(s)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:s.name}));const n=Dc.get(s),r=await n.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:s.name})),r}var Cc=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 Ps(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"))}}),Ac=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 bc(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 bc(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 Cc.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{}}}),Pc=t("BackendUIActionProvider",class extends Ac{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(zo.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))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await g.deService.exec(c,d,l,w?f:f[0],p);if(E.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:pt(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),Tc=t("SysUIActionProvider",class extends Ac{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)||{}}}),xc=t("FrontUIActionProvider",class extends Ac{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(zo.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,a;const{resultContext:s,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),c=null==(i=r.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!c)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!s||!s[r.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(r.deapicodeName2,"/printdata/").concat(s[r.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:c.codeName,...n}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(n&&n.srfcontenttype){const t=null==(a=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:a.slice(9),i=URL.createObjectURL(e.data),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),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 Er({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}}),Nc=t("WFWithdrawUIActionProvider",class extends Ac{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}}}),Sc=class extends Ac{async execAction(t,e){if(await ibiz.confirm.info({title:ibiz.i18n.t("app.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})){await ibiz.hub.controller.logout()&&window.location.reload()}return{}}};function Lc(){const t=new xc;Cs("FRONT",(()=>t));const e=new Pc;Cs("BACKEND",(()=>e));const i=new Tc;Cs("SYS",(()=>i));const a=new Nc;Cs("DEUIACTION_WFWithdraw",(()=>a));const s=new Sc;Cs("SYS_Logout",(()=>s))}var Mc=t("ToolbarController",class extends Sr{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new er,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 Cc.execAndResolved(a,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(t.itemType){const e=t,i=new tr(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"]}),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 Cn&&(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)}}),Rc=t("ContextMenuController",class extends Mc{}),Oc=(t("DashboardController",class extends Sr{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=or(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 Ds(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 Ni(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.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]),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new fo(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new gn(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);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}})),_c=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 Oc}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 Cn&&(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.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=De(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)}}),zc=(t("ContainerPortletController",class extends _c{}),t("ViewPortletController",class extends _c{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 _c{}),t("ChartPortletController",class extends _c{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends _c{}),t("HtmlPortletController",class extends _c{}),t("ListPortletController",class extends _c{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends _c{}),t("DataViewControlService",class extends Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),Fc=t("DataViewControlController",class extends Lr{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 zc(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context),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 Cn&&(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})}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 er,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 tr(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 Cc.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};Cc.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 Cc.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)}}),Vc=t("ExpBarControlController",class extends Sr{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&&sr(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())}}),kc=(t("CalendarExpBarController",class extends Vc{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 Vc{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 Vc{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 Sr{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 Cn,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Ni(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 ps(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),ze(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)||nr(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 fn.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)}})),Uc=class extends An{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=lr({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Wc=t("SearchFormService",class extends Uc{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 Do(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}}),Bc=(t("SearchFormController",class extends kc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new gn(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 Wc(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)})}})),Gc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Gc||{})),jc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(jc||{})),Kc=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 Bc(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=De(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=De(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})}}),Hc=t("FormButtonState",class extends Bc{constructor(){super(...arguments),this.loading=!1}}),Xc=(t("FormButtonController",class extends Kc{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new Hc(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 tr(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 Cc.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 Bc{constructor(){super(...arguments),this.showMask=!1}})),qc=(t("FormDRUIPartController",class extends Kc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Xc(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 Bc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Yc=t("FormGroupPanelController",class extends Kc{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 qc(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Qc=t("FormItemState",class extends Bc{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)})}}),$c=(t("FormItemController",class extends Kc{constructor(t,e,i){super(t,e,i),this.rules=[]}createState(){var t;return new Qc(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 ls(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(...rr(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...cr(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 Bc{constructor(){super(...arguments),this.actionGroupState=null}}),Jc=t("FormMDCtrlController",class extends Kc{createState(){var t;return new $c(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&&x.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&x.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&x.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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}}),Zc=(t("FormMDCtrlMDController",class extends Jc{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&&N(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await rs(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 $c{}),td=(t("FormMDCtrlFormController",class extends Jc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new Zc(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 rs(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 Jc{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 qc{})),ed=(t("FormPageController",class extends Yc{createState(){var t;return new td(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Bc{})),id=(t("FormRawItemController",class extends Kc{createState(){var t;return new ed(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Bc{})),ad=(t("FormTabPageController",class extends Kc{createState(){var t;return new id(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends Bc{constructor(){super(...arguments),this.activeTab=""}})),sd=(t("FormTabPanelController",class extends Kc{createState(){var t;return new ad(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 Uc{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 Cn?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 Cn?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 Cn?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,i={}){let a=await this.exec(t,e,i);return a=this.handleResponse(a),a}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 Cn?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 Cn?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 Do(a,s,{isOriginField:!0,dataType:i.dataType}):new Do(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}})),nd=(t("EditFormController",class extends kc{constructor(){super(...arguments),this.oldData=new Cn}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new sd(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 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])}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):N(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(s=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(t){throw await this.evt.emit("onRemoveError",{args:t}),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new Cn,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&&N(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)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?D(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 Cn(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})}})),od=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 Cn(t,this.oldData.$dataUIMap)}}),rd=t("GridService",class extends Pn{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 Do(a,o,{isOriginField:!0,dataType:r.dataType})}else n=new Do(a,a);this.dataUIMap.set(a,n)}))}}async updateGridEditItem(t,e,i={}){const a=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await a.exec(t,e,i);return s=this.handleResponse(s),s}}),cd={string:25,number:6,integer:9,date:5};var dd=t("GridController",class extends Lr{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}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new rd(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()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await br(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:cd[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 Ni(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new od(t,this);return this.gridStateNotify(e,"LOAD"),e})),await this.updateRows(this.state.rows),this.calcGroupData(e),this.calcAggResult(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.control.gantt.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 od(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.gantt.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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 Ni(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await fs(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)||nr(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 Ni(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 fr(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=lr({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)}}}),ld=t("GridFieldColumnController",class extends nd{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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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}=Ee(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(zo.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 Cc.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 dr.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 Cc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),hd=(t("GridUAColumnController",class extends nd{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 er;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 Cc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends ld{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 ls(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(...rr(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...cr(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 nd{}),t("ListService",class extends Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),ud=(t("ListController",class extends Lr{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 hd(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=[],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 Sr{constructor(t,e,i,a,s){super(t,e,i,a),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),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}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 ys(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 Po(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)}})),pd=(t("ViewLayoutPanelController",class extends ud{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)})}})),md=(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),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(){}createState(){var t;return new pd(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=De(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=De(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 Sr{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"])),gd=/^N_(.\w+)_(.\w+)$/;function fd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function wd(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Ed(t){const e=t.split("__")[1].match(gd);return{field:e[1],op:e[2]}}var yd=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],vd=/\$\{[^}]*\}/,Id=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=wd(t),t.appDEFieldId&&(n=Ne(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?yd.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 ls(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&&vd.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}}),Dd=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}))}},bd="",Cd={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"]},Ad={};function Pd(t,e){if(t.enumSource)return{appId:bd,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Ad["".concat(t.type,"_").concat(e)]}async function Td(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=Cd[t.type];e?e.forEach((e=>{t&&r.push({appId:bd,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:bd,valueOP:e},editor:Pd(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(Cd).forEach((t=>{Cd[t].forEach((e=>{if(yd.includes(e))return;const i="".concat(t,"_").concat(e);Ad[i]||("date"!==t||["IN","NOTIN"].includes(e)?Ad[i]={appId:bd,editorType:"TEXTBOX",id:i}:Ad[i]={appId:bd,editorType:"DATEPICKER",id:i})}))}));var xd=/^N_(.\w+)_(.\w+)$/,Nd=t("SearchBarFilterItemsController",class extends Id{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(xd),s=a[1],n=a[2],o=it(t);o.defsearchMode.valueOP=n,o.id=s;const r=new Id(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 Sd(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function Ld(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||Z(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function Md(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=>Md(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=>Md(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function Rd(t,e){const{pass:i}=Ld(t);if(!i)return;return t.map((t=>Md(t,e)))}function Od(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=>Od(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=>Od(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function _d(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>_d(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=>_d(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function zd(t){const{pass:e}=Ld(t);if(!e)return;return t.map(_d)}var Fd=t("SearchBarFilterSimpleItemsController",class extends Id{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const s=Ed(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}]})}}),Vd=/\$\{[^}]*\}/,kd=(t("SearchBarController",class extends Sr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!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")}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();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 Dd(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 br(this.model.appDataEntityId,this.context);if(!e)return;const i=await Td(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)&&md.includes(e.defsearchMode.valueOP)){if(fd(e))return void this.filterControllers.push(new Fd(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 Id(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new Nd(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 Rd(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&z(t.value)&&Vd.test(t.value)&&(e.value=ei.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){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 e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)N(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){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:zd(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&&(N(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(N(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Od(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&&z(t.value)&&Vd.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=Ne(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 Sr{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&&sr(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+=ht(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends Pn{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 Ni(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{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var i;if(d&&(!c||c&&0===e)||(null==(i=s.defaultExpandedKeys)?void 0:i.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,i,a){return new Io(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}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=>new vo(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}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=>new Eo(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}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)}})),Ud=t("TreeController",class extends Lr{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 Rc(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 fn.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 Cc.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)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);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)})}}),Wd=t("WizardPanelService",class extends An{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}}),Bd=(t("WizardPanelController",class extends Sr{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 er}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 tr(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 Wd(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 rs(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){const t=await this.service.initialize(this.context,{},this.params),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(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}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(),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 Cn&&(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 Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),Gd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),jd=(t("MDCtrlController",class extends Lr{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 Bd(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 Gd(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 Gd(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 Cc.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 er;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 Gd(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 Gd(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 zc{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}})),Kd=(t("KanbanController",class extends Fc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new jd(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.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 er;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new tr(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 Cc.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 w,E=[];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]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),f=w,w=0,E=[]),t[r]=h(f),c.push(t)):(0===E.length&&(w=f),E.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{})),Hd=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=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),Xd=t("TreeGridExController",class extends Ud{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 Kd(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 Hs(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 Hd(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.gantt.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.control.gantt.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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 Ni(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)||nr(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 Ni(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=lr({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})}}}),qd=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){}}),Yd=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 ls(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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}=Ee(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(zo.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 Cc.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 dr.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)}}),Qd=(t("TreeGridExFieldColumnController",class extends qd{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 Yd(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 qd{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 er;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 dd{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 rd{}),t("MEditViewPanelService",class extends Pn{})),$d=(t("MEditViewPanelController",class extends Lr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new Qd(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: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 Pn{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}=Ee(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 Ao(t,s))))})))}return new p(a,200)}})),Jd=(t("MapController",class extends Lr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new $d(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 An{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}})),Zd=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},tl=class extends Zd{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)}},el=class extends Zd{},il=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 tl(t);case"USER2":return new el(t);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},al=(t("ReportPanelController",class extends Sr{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=il.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Jd(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 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 So(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 s=Re(this.model,{parentId:t._nodeId,hasQuery:i});if(0===s.length)return;(await Ni(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){return new No(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}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=>new So(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}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=>new Lo(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}return[]}})),sl=(t("GanttController",class extends Xd{get _evt(){return this.evt}initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new al(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;if(e){await this.handleDefaultExpandNodes(e)&&this._evt.emit("onDefaultExpand",{nodes: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("onDefaultExpand",{nodes:n}),this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async handleDefaultExpandNodes(t){let e=!1;for(let i=0;i<t.length;i++){const a=t[i];if(this.state.expandedKeys.includes(a._id)){e=!0;const t=await this.loadNodes(a);await this.handleDefaultExpandNodes(t)}}return e}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)||nr(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.control.gantt.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.control.gantt.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.control.gantt.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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)){if(!await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}))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 Ni(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.control.gantt.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&s&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(s)}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:a}),t}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.gantt.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 Hd(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})}}}onDEDataChange(t){}}),t("HubController",class{constructor(){this.session={}}login(t,e){return ibiz.auth.login(t,e)}async logout(){const t=await ibiz.auth.logout();if(t){const t=window.location;if(-1!==t.search.indexOf("isAnonymous=true")){const e="".concat(t.origin).concat(t.pathname).concat(t.hash);window.history.replaceState({},"",e)}}return t}})),nl=class{constructor(){this.evt=new ut,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new Sn}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 ol(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 rl=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 mo,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:"update_time,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:ol(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}},cl=class{constructor(){this.evt=new ut,this.total=0,this.asyncAction=new nl,this.internalMessage=new rl}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()}},dl=class{constructor(){this.convert=new Bo,this.controller=new sl,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 jo,this.notice=new cl,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(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 Uo(e);return this.appMap.set(t,i),await this.modelLoaderProvider.initApp(t),await i.init(),this.configCache||(this.configCache=new gn(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()}))}},ll=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)}}),hl=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=>{we(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")):we(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(!["ROUTE_MODAL","MODAL","DRAWER"].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});return ibiz.util.shortCut.isExist(o)?(ibiz.util.shortCut.removeShortCut(o),this.view.state.isShortCut=!1,null):(ibiz.util.shortCut.addShortCut({key:o,name:e&&e[0].srfmajortext,appViewId:a.id,context:d.create(i),params:{...s},openMode:n.mode}),this.view.state.isShortCut=!0,{closeView:!0})}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=b(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,s=we(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),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),ul=(t("MDViewEngine",class extends hl{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: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=we(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 we(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),pl=class{constructor(){this.layoutPanel=new oi,this.theme=new bi,this.text=new Di,this.hbs=new de,this.rawValue=new Ti,this.action=Cc,this.error=new Wt,this.viewStack=new xi,this.anime=new Ba,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:ul,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"))}},ml=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(){}},gl=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)}},fl=class extends ml{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)}},wl=class extends ml{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return bc(e,a,t)}},El=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)}},yl=class extends El{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},vl=class extends El{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Il=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)}},Dl=class{constructor(){this.executorFactory=new gl,this.triggerFactory=new Il}createViewScheduler(t){return new vl(t)}createControlScheduler(t){return new yl(t)}},bl=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}},Cl=class extends bl{},Al=class extends bl{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)}},Pl=class extends bl{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)}},Tl=class extends ml{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(zo.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])||{},w=p.navigateContexts;ct(w)&&(m=he(w,f,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(ct(E)&&(g=he(E,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 y=await ibiz.commands.execute(zo.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&y.data&&await this.doBatchAdd(t,y.data,s,p,e.view),y}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(zo.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)}}},xl=class extends bl{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)}},Nl=class extends bl{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)}},Sl=class extends ml{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));Cc.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}})}}}));
|
|
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,w,E,y,v,I,D,b,C,A,P,T,x,N,S,L,M,R,O,_,z,F,V,k,U,W,B,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,wt,Et,yt,vt,It,Dt,bt,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,w=t.getToken,E=t.NOOP,y=t.selectFile,v=t.Namespace,I=t.IBizParams,D=t.isElementSame,b=t.findRecursiveChild,C=t.StringUtil,A=t.debounceAndAsyncMerge,P=t.EntityError,T=t.isOverlap,x=t.BitMask,N=t.mergeInLeft,S=t.awaitTimeout,L=t.mergeDefaultInLeft,M=t.plus,R=t.toNumberOrNil},function(t){O=t.isEmpty,_=t.isNil,z=t.isString,F=t.isArray,V=t.isObject,k=t.merge,U=t.debounce,W=t.camelCase,B=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.createUUID,ut=t.QXEvent,pt=t.isArray,mt=t.getCookie,gt=t.setCookie,ft=t.clearCookie,wt=t.ascSort,Et=t.descSort,yt=t.clearAll,vt=t.isNumber,It=t.isString,Dt=t.isObject},function(t){bt=t.default},function(t){Ct=t.default},function(t){At=t.default},function(t){Pt=t.default}],execute:function(){t({SearchCondEx2filterNode:Od,asyncImportData:pr,asyncImportData2:Ir,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:De,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=dn(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:Td,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:Dr,calcLayoutHeightWidth:Ie,calcMainStateOPPrivsStrs:Ce,calcNavParams:ge,calcResPath:ln,calcSearchCondExs:zd,calcSearchConds:Rd,compare:Ye,compareNumber:Qe,contains:$e,convertNavData:he,convertNavDataByArray:pe,convertObjectToNavParams:le,createImportSchema:async function(t){const e=Dr(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:yr,execDELogic:io,execDELogicAction:so,execDELogicById:ao,execFieldLogics:oo,execUILogic:bc,exportData:fr,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:un,filterFieldLogics:xe,filterNode2SearchCond:Md,filterNode2SearchCondEx:_d,filterValueRules:Ii,findAppDEMethod:ve,findChildFormDetails:_e,findDELogic:Te,findEditItem:Oe,findFieldById:Ne,findModelChild:fe,formatMultiData:me,generateEditorRules:cr,generateRules:rr,getAllPanelField:Ge,getAppCounterProvider:as,getAppMenuItemProvider:Ys,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(Ls,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.asynchronousAction",{actiontype:t.actiontype}))},getChildNodeRSs:Re,getControl:we,getControlPanel:ye,getControlProvider:rs,getControlsByView:Fe,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:Gs,getDERedirectToView:Xe,getDataImportModels:wr,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:lr,getEditorProvider:ls,getEntitySchema:br,getErrorViewProvider:function(t){let e;e||(i=t,e=ibiz.register.get("".concat($s,"_").concat(i)));var i;return e},getFormDetailProvider:ps,getGridColumnProvider:fs,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(Qs,"_").concat(i)));var i;if(e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.messageType",{content_type:t.content_type}))},getMatchResPath:dn,getOriginData:or,getOriginFilterNodes:Sd,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:ys,getPlatformProvider:ks,getPlatformType:_s,getPortletProvider:Ds,getRootNode:Le,getTreeGridExColumnProvider:Hs,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:Ps,getUILogicNodeProvider:xs,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 Za(s,n);if(t&&(e=Ss(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.viewPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=Ss("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.correspondViewTypeStyle",{viewType:i,viewStyle:a}),t)}e||(e=Ss(i));e||(e=Ss("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:Ni,hasDeCodeName:Pe,hasSubRoute:sr,importData:mr,importData2:gr,install:function(){const{ibiz:t}=window;t.util=new pl,t.hub=new dl,t.register=new kt,t.config=new Vt,t.auth=new Nn,t.engine=new ll,t.uiDomainManager=new Pi,t.markOpenData=new go,ko(),Lc(),po(),en(),ibiz.scheduler=new Dl,ibiz.scheduler.triggerFactory.register("ITEMVISIBLE",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("ITEMENABLE",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("ITEMBLANK",((t,e)=>new Al(t,e))),ibiz.scheduler.triggerFactory.register("TIMER",((t,e)=>new Pl(t,e))),ibiz.scheduler.triggerFactory.register("CUSTOM",((t,e)=>new Cl(t,e))),ibiz.scheduler.triggerFactory.register("VIEWEVENT",((t,e)=>new xl(t,e))),ibiz.scheduler.triggerFactory.register("CTRLEVENT",((t,e)=>new Nl(t,e))),ibiz.scheduler.executorFactory.register("SCRIPT",((t,e)=>new fl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUILOGIC",((t,e)=>new wl(t,e))),ibiz.scheduler.executorFactory.register("DEUILOGIC",((t,e)=>new wl(t,e))),ibiz.scheduler.executorFactory.register("APPUILOGIC",((t,e)=>new Tl(t,e))),ibiz.scheduler.executorFactory.register("APPDEUIACTION",((t,e)=>new Sl(t,e))),function(){const t=new Rs;Fs("Browser",(()=>t))}(),t.platform=ks()},installCommand:ko,isDataContainer:Ue,isFormDataContainer:ze,isHiddenFilter:wd,isSimpleItems:fd,isValueChange:nr,matchMainState:be,openDataImport:Er,openRedirectView:Ke,parseSubFieldInfo:Ed,parseUserParams:Ee,parseViewProtocol:je,presetAppCounterProvider:en,presetDEMethodProvider:po,presetUIActionProvider:Lc,registerAppCounterProvider:es,registerAppMenuItemProvider:function(t,e){ibiz.register.register("".concat(Xs,"_").concat(t),e)},registerAsyncActionProvider:function(t,e){ibiz.register.register("".concat(Ls,"_").concat(t),e)},registerControlProvider:function(t,e){ibiz.register.register("".concat(ns,"_").concat(t),e)},registerDEMethodProvider:Ws,registerEditorProvider:function(t,e){ibiz.register.register("".concat(cs,"_").concat(t),e)},registerErrorViewProvider:function(t,e){ibiz.register.register("".concat($s,"_").concat(t),e)},registerFormDetailProvider:function(t,e){ibiz.register.register("".concat(hs,"_").concat(t),e)},registerGridColumnProvider:function(t,e){ibiz.register.register("".concat(ms,"_").concat(t),e)},registerInternalMessageProvider:function(t,e){ibiz.register.register("".concat(Qs,"_").concat(t),e)},registerPanelItemProvider:function(t,e){ibiz.register.register("".concat(ws,"_").concat(t.toUpperCase()),e)},registerPlatformProvider:Fs,registerPortletProvider:function(t,e){ibiz.register.register("".concat(vs,"_").concat(t),e)},registerTreeGridExColumnProvider:function(t,e){ibiz.register.register("".concat(js,"_").concat(t),e)},registerUIActionProvider:Cs,registerUILogicNodeProvider:function(t,e){ibiz.register.register("".concat(Ts,"_").concat(t),e)},registerViewProvider:function(t,e){ibiz.register.register("".concat(Ns,"_").concat(t),e)},selectAndImport:vr,strContain:Je,testCond:qe,toLocalOpenWFRedirectView:async function(t,e,i={}){const a=await He(t,e,i);await ibiz.commands.execute(zo.TAG,a.viewId,a.context,a.params,a.opts)},updateImportSchema:async function(t){const e=Dr(t),i="extension/import_schemas/".concat(e.id);return await ibiz.net.request(i,{method:"put",data:e})},validateFilterNodes:Ld,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 xt={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)}}}(xt);var Nt=Tt(xt.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),zt={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)}})}(zt);var Ft=Tt(zt.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}}),Wt=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)}}),Bt=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}};Bt.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 Bt.handleJudgmentExecute(this,i,e)}},Kt=class extends Gt{constructor(t){super(t,"camelCase")}onExecute(t){return t?W(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=B(t,e);return Bt.handleJudgmentExecute(this,a,i)}},qt=class extends Gt{constructor(t){super(t,"gt")}onExecute(t,e,i){const a=G(t,e);return Bt.handleJudgmentExecute(this,a,i)}},Yt=class extends Gt{constructor(t){super(t,"gte")}onExecute(t,e,i){const a=j(t,e);return Bt.handleJudgmentExecute(this,a,i)}},Qt=class extends Gt{constructor(t){super(t,"eqPropertyValue")}onExecute(t,e,i,a){let s=!1;return s=F(t)?!B(K(t,(t=>B(t[e],i))),-1):t.hasOwnProperty(e)&&(s=B(t[e],i)),Bt.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 Bt.handleJudgmentExecute(this,a,i)}},ee=class extends Gt{constructor(t){super(t,"lte")}onExecute(t,e,i){const a=X(t,e);return Bt.handleJudgmentExecute(this,a,i)}},ie=class extends Gt{constructor(t){super(t,"neq")}onExecute(t,e,i){const a=!B(t,e);return Bt.handleJudgmentExecute(this,a,i)}},ae=class extends Gt{constructor(t){super(t,"not")}onExecute(t,e){const i=et(t)||Z(t);return Bt.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 we(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 Ee(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 ye(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 De(t,e){const i=[],a=ei.execScriptFn({data:e},t,{singleRowReturn:!0,isAsync:!1});return z(a)?i.push(a):F(a)?i.push(...a):V(a)&&Object.keys(a).forEach((t=>{a[t]&&i.push(t)})),i}function be(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 xe(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 Ne(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 ze(t){return"MDCTRL"===t.detailType}function Fe(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 We=["panelItems","panelTabPages","rootPanelItems"];function Be(t){let e=[];for(const i of We)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(...Be(t))}))),i}function Ge(t){return Be(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(zo.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=bt.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}=Ne(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}=Ne(t,t.indexTypeAppDEFieldId);c=a[e.toLowerCase()]}if(dt(c)&&t.formTypeAppDEFieldId){const{codeName:e}=Ne(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 w="";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(w=d.refAppViewId,d.openMode&&(s.openMode=d.openMode),w)return{type:"view",viewId:w,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),w=t.viewId}if(w)return{type:"view",viewId:w,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||{})),wi=t("ViewMode",(t=>(t.ROUTE="ROUTE",t.ROUTE_MODAL="ROUTE_MODAL",t.MODAL="MODAL",t.DRAWER="DRAWER",t.EMBED="EMBED",t.POPOVER="POPOVER",t))(wi||{})),Ei=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))(Ei||{})),yi=t("PresetIdentifier",(t=>(t.MESSAGE="preset-message",t))(yi||{})),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 Di=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")}}),bi=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}}),xi=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 Ni(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 Si={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 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,Si)}(s,Mi(a)),e.appendChild(s),s}function Mi(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 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},zi=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Fi={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 Wi={arr:function(t){return Array.isArray(t)},obj:function(t){return ki(Object.prototype.toString.call(t),"Object")},pth:function(t){return Wi.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||Wi.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 Wi.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 Wi.hex(t)||Wi.rgb(t)||Wi.hsl(t)},key:function(t){return!Oi.hasOwnProperty(t)&&!_i.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function Bi(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Gi(t,e){var i=Bi(t),a=Vi(Wi.und(i[0])?1:i[0],.1,100),s=Vi(Wi.und(i[1])?100:i[1],.1,100),n=Vi(Wi.und(i[2])?10:i[2],.1,100),o=Vi(Wi.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=Fi.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 Fi.springs[t]=n,n}}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 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)}}}(),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(Wi.fnc(t))return t;var i=t.split("(")[0],a=qi[i],s=Bi(t);switch(i){case"spring":return Gi(t,e);case"cubicBezier":return Ui(Xi,s);case"steps":return Ui(ji,s);default:return Ui(a,s)}}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,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 Ji(t){return t.reduce((function(t,e){return t.concat(Wi.arr(e)?Ji(e):e)}),[])}function Zi(t){return Wi.arr(t)?t:(Wi.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]=Wi.und(t[a])?e[a]:t[a];return i}function sa(t){return Wi.rgb(t)?(i=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e=t))?"rgba("+i[1]+",1)":e:Wi.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):Wi.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 na(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 Wi.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"],na(e)))return e;var a=Fi.CSS[e+i];if(!Wi.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 Fi.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(),s=t.style[e]||getComputedStyle(t).getPropertyValue(a)||"0";return i?ca(t,s,i):s}}function la(t,e){return Wi.dom(t)&&!Wi.inp(t)&&(!Wi.nil(ra(t,e))||Wi.svg(t)&&t[e])?"attribute":Wi.dom(t)&&ta(zi,e)?"transform":Wi.dom(t)&&"transform"!==e&&da(t,e)?"css":null!=t[e]?"object":void 0}function ha(t){if(Wi.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 ua(t,e,i,a){var s=ki(e,"scale")?1:0+function(t){return ki(t,"translate")||"perspective"===t?"px":ki(t,"rotate")||ki(t,"skew")?"deg":void 0}(e),n=ha(t).get(e)||s;return i&&(i.transforms.list.set(e,n),i.transforms.last=e),a?ca(t,n,a):n}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=na(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 ga(t,e){if(Wi.col(t))return sa(t);if(/\s/g.test(t))return t;var i=na(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 wa(t){for(var e,i=t.points,a=0,s=0;s<i.numberOfItems;s++){var n=i.getItem(s);s>0&&(a+=fa(e,n)),e=n}return a}function Ea(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 wa(t);case"polygon":return function(t){var e=t.points;return wa(t)+fa(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function ya(t,e){var i=e||{},a=i.el||function(t){for(var e=t.parentNode;Wi.svg(e)&&Wi.svg(e.parentNode);)e=e.parentNode;return e}(t),s=a.getBoundingClientRect(),n=ra(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 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 s=ya(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 Ia(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=ga(Wi.pth(t)?t.totalLength:t,e)+"";return{original:a,numbers:a.match(i)?a.match(i).map(Number):[0],strings:Wi.str(t)||e?a.split(i):[]}}function Da(t){return $i(t?Ji(Wi.arr(t)?t.map(Zi):Zi(t)):[],(function(t,e,i){return i.indexOf(t)===e}))}function ba(t){var e=Da(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)),Wi.arr(t)){var a=t.length;2===a&&!Wi.obj(t[0])?t={value:t}:Wi.fnc(e.duration)||(i.duration=e.duration/a)}var s=Wi.arr(t)?t:[t];return s.map((function(t,i){var a=Wi.obj(t)&&!Wi.pth(t)?t:{value:t};return Wi.und(a.delay)&&(a.delay=i?0:e.delay),Wi.und(a.endDelay)&&(a.endDelay=i===s.length-1?e.endDelay:0),a})).map((function(t){return aa(t,i)}))}function Aa(t,e){var i=[],a=e.keyframes;for(var s in a&&(e=aa(function(t){for(var e=$i(Ji(t.map((function(t){return Object.keys(t)}))),(function(t){return Wi.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)Wi.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)Wi.key(s)&&i.push({name:s,tweens:Ca(e[s],t)});return i}function Pa(t,e){var i;return t.tweens.map((function(a){var s=function(t,e){var i={};for(var a in t){var s=oa(t[a],e);Wi.arr(s)&&1===(s=s.map((function(t){return oa(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=Wi.arr(n)?n[1]:n,r=na(o),c=pa(e.target,t.name,r,e),d=i?i.to.original:c,l=Wi.arr(n)?n[0]:d,h=na(l)||na(c),u=r||h;return Wi.und(o)&&(o=d),s.from=Ia(l,u),s.to=Ia(ma(o,l),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=Yi(s.easing,s.duration),s.isPath=Wi.pth(n),s.isPathTargetInsideSVG=s.isPath&&Wi.svg(e.target),s.isColor=Wi.col(s.from.original),s.isColor&&(s.round=1),i=s,s}))}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,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 xa(t,e){ba(t).forEach((function(t){for(var i in e){var a=oa(e[i],t),s=t.target,n=na(a),o=pa(s,i,n,t),r=ma(ga(a,n||na(o)),o),c=la(s,i);Ta[c](s,i,r,t.transforms,!0)}}))}function Na(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),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!Wi.und(t)}))}function Sa(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 La=0;var Ma=[],Ra=function(){var t;function e(i){for(var a=Ma.length,s=0;s<a;){var n=Ma[s];n.paused?(Ma.splice(s,1),a--):(n.tick(i),s++)}t=s>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,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=ia(Oi,t),i=ia(_i,t),a=Aa(i,t),s=ba(t.targets),n=Na(s,a),o=Sa(n,i),r=La;return La++,aa(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/_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 s=i[e],n=s.animatable,o=s.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,w=0;w<g;w++){var E=void 0,y=d.to.numbers[w],v=d.from.numbers[w]||0;E=d.isPath?va(d.value,h*y,d.isPathTargetInsideSVG):v+h*(y-v),p&&(d.isColor&&w>2||(E=Math.round(E*p)/p)),m.push(E)}var I=u.length;if(I){f=u[0];for(var D=0;D<I;D++){u[D];var b=u[D+1],C=m[D];isNaN(C)||(f+=b?C+b:C+" ")}}else f=m[0];Ta[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,w=l(t);c.progress=Vi(w/h*100,0,100),c.reversePlayback=w<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])}(w),!c.began&&c.currentTime>0&&(c.began=!0,m("begin")),!c.loopBegan&&c.currentTime>0&&(c.loopBegan=!0,m("loopBegin")),w<=g&&0!==c.currentTime&&p(0),(w>=f&&c.currentTime!==h||!h)&&p(h),w>g&&w<f?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,m("changeBegin")),m("change"),p(w)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,m("changeComplete")),c.currentTime=Vi(w,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 xa(t,e),c},c.tick=function(t){s=t,i||(i=s),g((s+(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){Fa(Da(t),c)},c.reset(),c.autoplay&&c.play(),c}function za(t,e){for(var i=e.length;i--;)ta(t,e[i].animatable.target)&&e.splice(i,1)}function Fa(t,e){var i=e.animations,a=e.children;za(t,i);for(var s=a.length;s--;){var n=a[s],o=n.animations;za(t,o),o.length||n.children.length||a.splice(s,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=Da(t),i=Ma.length;i--;){Fa(e,Ma[i])}},_a.get=pa,_a.set=xa,_a.convertPx=ca,_a.path=function(t,e){var i=Wi.str(t)?Qi(t)[0]:t,a=e||100;return function(t){return{property:t,el:i,svg:ya(i),totalLength:Ea(i)*(a/100)}}},_a.setDashoffset=function(t){var e=Ea(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,s=e.grid,n=e.axis,o=e.from||0,r="first"===o,c="center"===o,d="last"===o,l=Wi.arr(t),h=l?parseFloat(t[0]):parseFloat(t),u=l?parseFloat(t[1]):0,p=na(l?t[1]:t)||0,m=e.start||0+(l?h:0),g=[],f=0;return function(t,e,w){if(r&&(o=0),c&&(o=(w-1)/2),d&&(o=w-1),!g.length){for(var E=0;E<w;E++){if(s){var y=c?(s[0]-1)/2:o%s[0],v=c?(s[1]-1)/2:Math.floor(o/s[0]),I=y-E%s[0],D=v-Math.floor(E/s[0]),b=Math.sqrt(I*I+D*D);"x"===n&&(b=-I),"y"===n&&(b=-D),g.push(b)}else g.push(Math.abs(o-E));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}},_a.timeline=function(t){void 0===t&&(t={});var e=_a(t);return e.duration=0,e.add=function(i,a){var s=Ma.indexOf(e),n=e.children;function o(t){t.passThrough=!0}s>-1&&Ma.splice(s,1);for(var r=0;r<n.length;r++)o(n[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=Wi.und(a)?d:ma(a,d),o(e),e.seek(c.timelineOffset);var l=_a(c);o(l),n.push(l);var h=Sa(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},_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,s=t.complete;i.complete=t=>{a(t),s(t)}}return{...t,...e,...i}}function Wa(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=Ua({targets:t,translateX:r,translateY:c,...ka,complete:()=>{e(!0)}},i);Va(a)}))}var Ba=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 s=Li(t,document.body);if(!s)return ibiz.log.debug(ibiz.i18n.t("runtime.utils.anime.noExistAnimationElement")),!1;const{padding:n,width:o,height:r}=Mi(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 Wa(s,a,c);var l;return(l=s)&&l.remove(),d}moveToTarget(t,e,i={}){return Wa(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 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+=bt.stringify(d,{addQueryPrefix:!0}),c+=bt.stringify(l,{addQueryPrefix:!0}),{uploadUrl:r,downloadUrl:c}}async fileDownload(t,e){var i;const a=await ibiz.net.request(t,{method:"get",responseType:"blob",baseURL:""});if(200!==a.status)throw new o(ibiz.i18n.t("runtime.platform.failedDownload"));if(!a.data)throw new o(ibiz.i18n.t("runtime.platform.fileStreamData"));{let t="";const s=null==(i=bt.parse(a.headers["content-disposition"],{delimiter:";"}))?void 0:i.filename;s&&s.startsWith('"')&&s.endsWith('"')&&(t=s.substring(1,s.length-1)),e&&(t=e),c(a.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}}),ja=t("ShortCutUtil",class{constructor(){this.$ShortCut=[],this.evt=new ut,this.initShortCut()}get data(){return this.$ShortCut}initShortCut(){const t=window.localStorage.getItem("IbizShortCut");t&&(this.$ShortCut=JSON.parse(t))}saveShortCut(){this.evt.emit("change",this.$ShortCut),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.findIndex((e=>e.key===t.key));e>-1?this.$ShortCut.splice(e,1,t):this.$ShortCut.push(t),this.saveShortCut()}removeShortCut(t){const e=this.$ShortCut.findIndex((e=>e.key===t));e>-1&&(this.$ShortCut.splice(e,1),this.saveShortCut())}changeIndex(t,e){const{length:i}=this.$ShortCut;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.splice(e,1)[0];this.$ShortCut.splice(t,0,a),this.saveShortCut()}isExist(t){return this.$ShortCut.findIndex((e=>e.key===t))>=0}}),Ka=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}},Ha=class{constructor(){this.strCondOp=null}getCondOp(){return this.strCondOp}setCondOp(t){this.strCondOp=t}},Xa=class extends Ha{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}},qa=class t extends Ha{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 Xa;t.parse(e),this.childCondList.push(t)}}}))}}}setNotMode(t){this.bNotMode=t}isNotMode(){return this.bNotMode}getChildPSModelCondBases(){return this.childCondList}},Ya=class extends qa{},Qa=class extends Xa{},$a=class t extends Ka{test(t,e){return this.testCond(this.getPSModelGroupCondBase(),t,e)}testCond(e,i,a){if(e instanceof qa){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 Xa){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 Qa}createPSModelGroupCond(){return new Ya}};$a.PARAMTYPE_DATACONTEXT="DATACONTEXT",$a.PARAMTYPE_WEBCONTEXT="WEBCONTEXT";var Ja=t("PSDEDQCondEngine",$a);async function Za(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 ts=t("APP_COUNTER_PROVIDER_PREFIX","APPCOUNTER");function es(t,e){ibiz.register.register("".concat(ts,"_").concat(t),e)}function is(t){return ibiz.register.get("".concat(ts,"_").concat(t))}async function as(t){let e;const{codeName:i,counterType:a,sysPFPluginId:s,appId:n}=t;if(s){const t=await Za(s,n);if(t&&(e=is(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.adapter",{pluginKey:t}))}if("CUSTOM"===a){if(e=is(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.customizedSystemAdapter",{codeName:i}))}if(e=is(a),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.noFoundSystemCounter",{counterType:a}))}var ss=class{static getRegisterKey(t,e){switch(t){case ws:return this.calcKeyByView(e);case hs:case ms:case ns: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}},ns=t("CONTROL_PROVIDER_PREFIX","CONTROL");function os(t){return ibiz.register.get("".concat(ns,"_").concat(t))}async function rs(t){let e;const{controlType:i,controlStyle:a,sysPFPluginId:s,appId:n}=t,o=ss.getRegisterKey(ns,{controlModel:t});if(e=os(o),e)return e;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Za(s,n);if(t&&(e=os(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=os("".concat(i,"_").concat(a)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetStyleType",{controlType:i,controlStyle:a}),t)}if(e=os(i),e)return e;"DATAINFOBAR"!==i&&ibiz.log.error(ibiz.i18n.t("runtime.register.helper.widgetType",{controlType:i}))}var cs=t("EDITOR_PROVIDER_PREFIX","EDITOR");function ds(t){return ibiz.register.get("".concat(cs,"_").concat(t))}async function ls(t){let e;const{editorType:i,editorStyle:a,predefinedType:s,sysPFPluginId:n,appId:o}=t;if(n){const t=await Za(n,o);if(t&&(e=ds(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorPlugin",{pluginKey:t}))}if(a&&"DEFAULT"!==a){if(e=ds("".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=ds(n),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorTypePredefinedType",{editorType:i,predefinedType:s}),t)}if(e=ds(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.editorType",{editorType:i}))}var hs=t("FORMDETAIL_PROVIDER_PREFIX","FORMDETAIL");function us(t){return ibiz.register.get("".concat(hs,"_").concat(t))}async function ps(t,e){let i;const{detailType:a,sysPFPluginId:s,appId:n}=t,o=ss.getRegisterKey(hs,{controlItemModel:t,controlModel:e});if(i=us(o),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:o})),s){const t=await Za(s,n);if(t&&(i=us(t)),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberPlugin",{pluginKey:t}))}if(i=us(a),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.formMemberType",{detailType:a}))}var ms=t("GRIDCOLUMN_PROVIDER_PREFIX","GRIDCOLUMN");function gs(t){return ibiz.register.get("".concat(ms,"_").concat(t))}async function fs(t,e){let i;const{columnType:a,enableRowEdit:s,sysPFPluginId:n,appId:o}=t,r=ss.getRegisterKey(ms,{controlItemModel:t,controlModel:e});if(i=gs(r),i)return i;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:r})),n){const t=await Za(n,o);if(t&&(i=gs(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=gs(c),i)return i;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:c}))}var ws=t("PANELITEM_PROVIDER_PREFIX","PANELITEM");function Es(t){return ibiz.register.get("".concat(ws,"_").concat(t.toUpperCase()))}async function ys(t,e,i){var a;let s;const{itemType:n,sysPFPluginId:o,appId:r,controlRenders:c}=t,d=ss.getRegisterKey(ws,{controlItemModel:t,controlModel:e,viewModel:i});if(s=Es(d),s)return s;if(ibiz.log.debug(ibiz.i18n.t("runtime.register.helper.customRegistration",{registerKey:d})),o){const t=await Za(o,r);if(t&&(s=Es(t)),s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberPlugin",{pluginKey:t}))}if(c&&c.length>0)s=Es("PREDEFINE_RENDER");else{if("CONTAINER"===n){const e=t.predefinedType||"DEFAULT",i="CONTAINER_".concat(e);if(s=Es(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=Es(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=Es("FIELD_".concat(e.predefinedType.toUpperCase())),s)return s}}s=Es(n)}if(s)return s;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.panelMemberType",{itemType:n}))}var vs=t("PORTLET_PROVIDER_PREFIX","PORTLET");function Is(t){return ibiz.register.get("".concat(vs,"_").concat(t))}async function Ds(t){let e;const{portletType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Za(a,s);if(t&&(e=Is(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetPlugin",{pluginKey:t}))}if(e=Is(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.portalWidgetMemberType",{portletType:i}))}var bs=t("UIACTION_PROVIDER_PREFIX","UIACTION");function Cs(t,e){ibiz.register.register("".concat(bs,"_").concat(t),e)}function As(t){return ibiz.register.get("".concat(bs,"_").concat(t))}async function Ps(t){let e;const{uiactionMode:i,sysPFPluginId:a,appId:s,uiactionTag:n}=t;if(a){const t=await Za(a,s);if(t&&(e=As(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorPlugin",{pluginKey:t}))}if(e=As("".concat(i,"_").concat(n)),e)return e;if(e=As(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.interfaceBehaviorMode",{uiactionMode:i}))}var Ts=t("UILOGINNODE_PROVIDER_PREFIX","UI_LOGIN_NODE");async function xs(t){let e;const{sysPFPluginId:i,appId:a}=t,s=await Za(i,a);if(s){if(e=ibiz.register.get("".concat(Ts,"_").concat(s)),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.frontEndPluginNode",{pluginKey:s}))}}var Ns=t("VIEW_PROVIDER_PREFIX","VIEW");function Ss(t){return ibiz.register.get("".concat(Ns,"_").concat(t))}var Ls=t("ASYNC_ACTION_PROVIDER_PREFIX","ASYNC_ACTION");var Ms=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 Ms{});var Os=window.navigator.userAgent.toLowerCase();function _s(){return/Android|Adr/i.test(Os)?"Android":/iPhone|iPod|iPad/i.test(Os)?"IOS":/MicroMessenger/i.test(Os)?"WeChat":/DingTalk/i.test(Os)?"DingTalk":/miniProgram/i.test(Os)||"miniprogram"===window.__wxjs_environment?"WeChatMiniProgram":"Browser"}var zs=t("PLATFORM_PROVIDER_PREFIX","PLATFORM");function Fs(t,e){ibiz.register.register("".concat(zs,"_").concat(t),e)}function Vs(t){return ibiz.register.get("".concat(zs,"_").concat(t))}function ks(){const t=Vs(_s());return t||Vs("Browser")}var Us=t("DEMETHOD_PROVIDER_PREFIX","DEMETHOD");function Ws(t,e){ibiz.register.register("".concat(Us,"_").concat(t),e)}function Bs(t){return ibiz.register.get("".concat(Us,"_").concat(t))}async function Gs(t){let e;const{methodType:i,sysPFPluginId:a,appId:s}=t;if(a){const t=await Za(a,s);if(t&&(e=Bs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.entityBehaviorPlugin",{pluginKey:t}))}if(e=Bs(i),e)return e;throw new o(ibiz.i18n.t("runtime.register.helper.entityBehaviorMethod",{methodType:i}))}var js=t("TREEGRIDEX_COLUMN_PROVIDER_PREFIX","TREEGRIDEX_COLUMN");function Ks(t){return ibiz.register.get("".concat(js,"_").concat(t))}async function Hs(t){let e;const{columnType:i,appId:a,renderSysPFPluginId:s}=t;if(s){const t=await Za(s,a);if(t&&(e=Ks(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.treeTableColumnPlugin",{pluginKey:t}))}if(e=Ks(i),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.tableColumnType",{key:i}))}var Xs=t("APPMENUITEM_PROVIDER_PREFIX","APPMENUITEM");function qs(t){return ibiz.register.get("".concat(Xs,"_").concat(t))}async function Ys(t){let e;const{sysPFPluginId:i,appId:a,itemType:s}=t;if(i){const t=await Za(i,a);if(t&&(e=qs(t)),e)return e;ibiz.log.error(ibiz.i18n.t("runtime.register.helper.applicationMenu",{pluginKey:t}))}return e=qs(s),e}var Qs=t("INTERNAL_MESSAGE_PROVIDER_PREFIX","INTERNAL_MESSAGE");var $s=t("ERROR_VIEW_PROVIDER_PREFIX","ERROR_VIEW");var Js=t("AppCounter",class{constructor(t){this.model=t,this.destroyed=!1,this.context=d.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.intervalTimer=setInterval((()=>{this.evt.getSize("change")>0&&this.load()}),this.model.timer||6e3)}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)}}),Zs=t("AppDECounter",class extends Js{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}}),tn=t("AppDECounterProvider",class{createCounter(t){return new Zs(t)}});function en(){es("DEDR",(()=>new tn))}var an=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 Ja;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}});an.map=new WeakMap;var sn=t("DynamicCodeListCache",class{constructor(t){if(this.cache=new Map,this.isPredefined=!1,this.context=d.create(),this.params={},this.evt=new ut,this.commonKeys=["query","queryconds"],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=un(t[c])),l&&(e.textCls=t[l]),h&&(e.color=t[h]),d&&t[d])try{e.data=ei.execSingleLine(t[d])}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 nn(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 on(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 rn=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{on("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{on("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{on("update",t),nn("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{on("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{on("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=ht()),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{on("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];nn("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{on("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}}),cn=/\$\{(.*?)\}/g;function dn(t,e){const i=(e.requestPaths||[]).map((t=>{const e=t.match(cn);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 ln(t,e){const i=dn(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 hn=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 un(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 pn(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}var mn=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 sn(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 sn(i),this.cache.set(t,e),await e.init())}return e}destroy(){Array.from(this.cache.values()).forEach((t=>{t instanceof sn&&t.destroy()}))}}),gn=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||{}}}),fn=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 as(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)}});fn.counterMap=new Map;var wn=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}))}}}),En=class{constructor(t){this.model=t}exportData(t,e,i,a){const s=ln(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"})}},yn=t("Srfuf",(t=>(t[t.CREATE=0]="CREATE",t[t.UPDATE=1]="UPDATE",t))(yn||{})),vn=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)?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 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}}),In=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=[]}convertArrayToListMap(t){const e={};return t.forEach(((t,i)=>{e[i+1]=t})),e}convertListMapToArray(t){const e=[];return Object.keys(t).forEach((i=>{const a=parseInt(i,10);e[a-1]=t[a]})),e}async get(t,e,s=!1){if(!0===t.srfsimple&&!1===this.isLocalMode)return 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:this.convertArrayToListMap(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)return e&&e.length>0?e.map((t=>this.service.createEntity(t))):[];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]=this.convertListMapToArray(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)}}}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}}),Dn=t("DEService",class{constructor(t,e){this.srfSessionId=t,this.model=e,this.methodMap=new Map,this.isLocalMode=!1,this.local=new rn(e),this.configCache=new gn(e.appId,"PSAppDataEntity",e.codeName),this.wf=new wn(e),this.file=new En(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 Gs(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 ln(t,this.model)+a}newEntity(t){return t instanceof vn?t.clone():new vn(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 In(this,this.model,null==e?void 0:e.isLocalMode,t)}}),bn=["srfkey","srfmajortext","srfmajorfield","srfkeyfield","tempsrfkey","srfuf","srfdeid","srfdecodename"],Cn=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;bn.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}}),An=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 Cn(t,this.dataUIMap)}}),Pn=t("MDControlService",class extends An{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}}),Tn=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)?pn(e.srfdataaccaction):void 0;break;case 2:a=pn(await this.calcMajorDataAccAction(i));break;case 3:a=pn(await this.calcMajorDataAccAction(i)),!Object.prototype.hasOwnProperty.call(a,t)&&e&&e.srfdataaccaction&&(a=pn(e.srfdataaccaction))}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=be(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}}),xn=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 Tn(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 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}}),Nn=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&>(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&>(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&>(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 await ibiz.net.post("/uaa/changepwd",{oldPwd:t,newPwd:e}),!0}catch(t){return!1}}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&>(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&>(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&>(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&>(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}}),Sn=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))}}),Ln=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}}),Mn=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 vn(this.entity,e)}}),Rn=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 Ln(t,e,i),this.result=new Mn(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 ln(t,this.entity)+e}createEntity(t){return this.service.createEntity(t)}}),On=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:F(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)}},_n=class{},zn=class extends _n{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}},Fn=class t extends _n{constructor(e){super(),this.model=e;const i=e.conds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new zn(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}},Vn=class{constructor(t){this.model=t,this.srcNode=null,this.dstNode=null,this.groupCond=null;const e=this.model.delogicLinkGroupCond;e&&(this.groupCond=new Fn(e))}async exec(t){const{defaultLink:e}=this.model;return!(!e&&this.groupCond)||this.groupCond.test(t,t.context,t.data[0]||{})}},kn=class{constructor(t){var e;this.model=t,this.links=null==(e=t.links||[])?void 0:e.map((t=>new Vn(t)))}},Un=class extends kn{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])}},Wn=class extends kn{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startupNode",{id:this.model.id}))}},Bn=class extends kn{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 Gn(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 jn=class extends kn{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=Gn(e,t);e.params[i]=it(a)}bindParam(t,e){const i=Gn(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=Gn(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=Gn(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]))}},Kn=class extends kn{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])}},Hn=class extends kn{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=Gn(t,this.model);t.params[e]=s,ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.logicNodeParameterName",{id:this.model.id,dstDELogicParamId:e}),s)}},Xn=class extends kn{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}))}},qn=class extends kn{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}))}},Yn=class extends kn{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=Gn(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)}},Qn=class extends kn{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)}},$n=class extends kn{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=Gn(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))}},Jn=class extends kn{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}})}},Zn=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])}},to=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 Wn(t);break;case"END":i=new Bn(t);break;case"DEACTION":i=new Un(t);break;case"PREPAREPARAM":i=new jn(t);break;case"DEDATASET":i=new Kn(t);break;case"THROWEXCEPTION":i=new Jn(t);break;case"BINDPARAM":i=new Hn(t);break;case"RESETPARAM":i=new Xn(t);break;case"COPYPARAM":i=new Yn(t);break;case"RENEWPARAM":i=new qn(t);break;case"APPENDPARAM":i=new $n(t);break;case"SORTPARAM":i=new Qn(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 Zn(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 On(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}}},eo=new Map;async function io(t,e,i={},a={}){eo.has(t)||eo.set(t,new to(t)),ibiz.log.debug(ibiz.i18n.t("runtime.deLogic.deLogicNode.startExecuting",{id:t.id,name:t.name}));const s=eo.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 ao(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 io(n,i,a,s)}async function so(t,e,i,a){const n=it(e),o=i?it(i):i,r=a?it(a):a;try{const e=await io(t,n,o,r);return new p(e)}catch(t){if(t instanceof s)return new p(t,500);throw t}}async function no(t,e,i,a,s){const n=xe(t,e);if(n.length){(await Promise.all(n.map((t=>io(t,i,a,s))))).forEach((t=>{Object.assign(a,t)}))}}async function oo(t,e,i,a,s={}){if(a){if(!F(a))return no(t,e,i,a,s);await Promise.all(a.map((a=>no(t,e,i,a,s))))}}var ro=t("DEActionMethod",class extends Rn{async inputHandle(t,e){return F(e)?e:this.input.handle(t,e)}async exec(t,e,a,s){let n;if(e&&!["READ","GETDRAFT"].includes(this.method.actionMode)&&await oo(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 so(s,t,e,a)}else{e&&!this.isLocalMode&&(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=F(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);o.data=await this.result.handle(t,o.data),n=o}}}return n.data&&await oo(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=F(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=wt(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=F(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}}),co=class{create(t,e,i,a){return new ro(t,e,i,a.localMode)}},lo=t("FetchMethod",class extends Rn{async exec(t,e,i,s){const n=e&&!F(e)?e:i||{};let o;if(this.isLocalMode){const e=an.getCond(this.method),i=new hn(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||[];o.data=r.map((t=>this.createEntity(t)))}return o.data&&await oo(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?Et(a,e.sortField):wt(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)}}),ho=t("AcFetchMethod",class extends lo{mergeRequestPath(t,e){return"".concat(t,"/ac/").concat(e,"?srfac=ac")}}),uo=class{create(t,e,i,a){return a.acMode?new ho(t,e,i,a.localMode):new lo(t,e,i,a.localMode)}};function po(){const t=new co;Ws("DEACTION",(()=>t));const e=new uo;Ws("FETCH",(()=>e)),Ws("FETCHTEMP",(()=>e))}var mo=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}}),go=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))}}),fo=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])}}),wo=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}}),Eo=t("TreeCodeListNodeData",class extends wo{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)}}),yo=["_id","srfnodeid","_value","_text","_deData","clone"],vo=t("TreeDataSetNodeData",class t extends wo{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=un(o[e.leafFlagAppDEFieldId]):e.childCntAppDEFieldId&&(this._leaf=!un(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});return Object.keys(this).forEach((t=>{const e=u(t);Z(e)&&!yo.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}}),Io=t("TreeStaticNodeData",class extends wo{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)}}),Do=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}}),bo=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 Co=["REGION","REGION2","REGION3","REGION4"],Ao=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,Co.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 Po=t("PanelData",class{constructor(t,e){const i=new ut,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 To=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}})}}),xo=(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},No=t("GanttStaticNodeData",class extends Io{constructor(t,e,i,a){super(e,i,a),this._snDataItemValue=xo(t.sndataItemName,e),this._beginDataItemValue=xo(t.beginDataItemName,e),this._endDataItemValue=xo(t.endDataItemName,e),this._prevDataItemValue=xo(t.prevDataItemName,e),this._finishDataItemValue=xo(t.finishDataItemName,e),this._totalDataItemValue=xo(t.totalDataItemName,e)}}),So=t("GanttDataSetNodeData",class extends vo{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=xo(t.sndataItemName,e,s),this._beginDataItemValue=xo(t.beginDataItemName,e,s),this._endDataItemValue=xo(t.endDataItemName,e,s),this._prevDataItemValue=xo(t.prevDataItemName,e,s),this._finishDataItemValue=xo(t.finishDataItemName,e,s),this._totalDataItemValue=xo(t.totalDataItemName,e,s)}}),Lo=t("GanttCodeListNodeData",class extends Eo{constructor(t,e,i,a){super(e,i,a);const{data:s}=a;this._snDataItemValue=xo(t.sndataItemName,e,s),this._beginDataItemValue=xo(t.beginDataItemName,e,s),this._endDataItemValue=xo(t.endDataItemName,e,s),this._prevDataItemValue=xo(t.prevDataItemName,e,s),this._finishDataItemValue=xo(t.finishDataItemName,e,s),this._totalDataItemValue=xo(t.totalDataItemName,e,s)}}),Mo=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()}}),Ro=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 Dn(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}}};Ro.constructorCache=new Map;var Oo=t("DEServiceUtil",Ro),_o=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)}};_o.TAG="ibiz.app-view.open";var zo=t("OpenAppViewCommand",_o),Fo=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(zo.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"))}};Fo.TAG="ibiz.app-func.exec";var Vo=t("AppFuncCommand",Fo);function ko(){new Vo,new zo}var Uo=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 gn(this.appId,"PSSysApp",t.codeName),this.deService=new Oo(t),this.codeList=new mn(t),this.authority=new xn(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 Mo(ibiz.appData.mqtttopic,w(),this.appId),this.mqtt.evt.on("message",(t=>{ibiz.mc.command.next(t)})),await this.mqtt.connect())}destroy(){this.codeList.destroy()}}),Wo=class{parse(t){return t}},Bo=class{constructor(){this.appMenu=new Wo}},Go=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}},jo=class{constructor(){this.view=new Go}},Ko=t("FormNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ko||{})),Ho=t("GridNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Ho||{})),Xo=t("PanelNotifyState",(t=>(t.LOAD="LOAD",t.DRAFT="DRAFT",t.SAVE="SAVE",t))(Xo||{})),qo=t("TreeGridExNotifyState",(t=>(t.LOAD="LOAD",t.SAVE="SAVE",t.DRAFT="DRAFT",t))(qo||{})),Yo=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}}),Qo=t("LoadingState",class{constructor(){this.isLoading=!1,this.counter=new Yo(E)}begin(){this.isLoading=!0,this.counter.increment()}end(){this.counter.decrement((()=>{this.isLoading=!1}))}}),$o=t("CTXState",class{}),Jo=t("CTX",class{constructor(t){this.parent=t,this.isDestroyed=!1,this.evt=new ut(3e3),this.controllersMap=new Map,this.state=new $o}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}}),Zo=t("ActivityCounter",class extends Yo{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())}}),tr=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,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.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)}}),er=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())))}}),ir=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))),s=Promise.all(a),n=await i,o=await s;return n.concat(...o)}reset(){super.reset(),yt(this.anyEventFns)}}),ar=t("ControllerEvent",class{constructor(t){this.getBaseArgs=t,this.isDestroyed=!1,this.evt=new ir}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 sr(t){return window.location.hash.split("/").length>2*t+2}function nr(t,e){return(!Z(t)&&""!==t||!Z(e)&&""!==e)&&t!==e}function or(t){let e=Array.isArray(t)?t[0]:t;return e&&e instanceof Cn&&(e=e.getOrigin()),e}function rr(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 cr(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 dr=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 lr(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 ht();default:throw new a({},ibiz.i18n.t("runtime.controller.utils.valueDefault.nosupported",{valueType:n}))}}}var hr="asyncimportdata2",ur="importdata2";async function pr(t,e,i,a){ibiz.notification.info({desc:ibiz.i18n.t("component.dataImport.startImport")});const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(hr);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ln(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 mr(t,e,i,a){const s=new FormData;s.append("file",t);let n="/".concat(e.deapicodeName2,"/").concat(ur);if((null==i?void 0:i.codeName)&&(n+="?srfimporttag=".concat(i.codeName)),a){n=ln(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 gr(t){const e={isAsync:ibiz.env.enableMqtt};if(ibiz.env.enableMqtt)pr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);else{const i=await mr(t.selectedFile,t.appDataEntity,t.dataImport,t.context);Object.assign(e,i)}return e}async function fr(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 wr(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 Er(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(zo.TAG,o.id,a,s,{openMode:"POPUPMODAL"});const{deDataImport:r,appDataEntity:c}=await wr({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 yr(t,e){var i;let a="".concat(t.codeName2.toLowerCase(),"/importtemplate");(null==e?void 0:e.codeName)&&(a+="?srfimporttag=".concat(e.codeName));const s=await ibiz.net.request(a,{responseType:"blob"});if(200===s.status){let t=(null==(i=s.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:i.slice(9))||"";t=decodeURIComponent(t);const e=new Blob([s.data],{type:"application/vnd.ms-excel"}),a=document.createElement("a");a.download=t,a.style.display="none",a.href=URL.createObjectURL(e),document.body.appendChild(a),a.click(),URL.revokeObjectURL(a.href),document.body.removeChild(a)}}async function vr(t){return new Promise((e=>{y({accept:".xlsx, .xls",multiple:!1,onSelected:async i=>{const a=await gr({selectedFile:i[0],appDataEntity:t.appDataEntity,dataImport:t.dataImport,context:t.context});e(a)},onCancel:()=>{e({cancel:!0})}})}))}async function Ir(t){var e;let i="/".concat(t.appDataEntity.codeName2.toLowerCase());if(t.context){i=ln(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("component.dataImport.startImport")})}function Dr(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 br(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 Cr=t("VIEW_MSG_PREFIX","VIEW_MSG"),Ar=t("ViewMsgController",class t{constructor(t,e=""){this.msgGroupId=t,this.viewMsgMap=new Map,this.tag="",this.tag="".concat(Cr,"_").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=Ne(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 so(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 w=await t.fetchDataSet(n,a,g);if(!w.length)return[];const E=this.calcStaticMsg(e),y=this.getDeFieldName(m,c),v=this.getDeFieldName(m,u),I=this.getDeFieldName(m,h),D=this.getDeFieldName(m,l),b=this.getDeFieldName(m,d);return w.map((t=>{const e={};v&&!Z(t[v])&&(e.position=t[v]),y&&!Z(t[y])&&(e.title=t[y]),I&&!Z(t[I])&&(e.message=t[I]),D&&!Z(t[D])&&(e.messageType=t[D]),b&&!Z(t[b])&&(e.removeMode=t[b]),Z(t.srfkey)||(e.key="".concat(this.tag,"_").concat(t.srfkey)),p&&(e.layoutPanel=p);const i=tt(E,e);return i.data={...t,env:i},i}))}}),Pr="__self",Tr=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 ar(this.getEventArgs.bind(this)),this.mountCounter=new Zo(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(Pr),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(Pr)||this.mountCounter.attend(Pr)}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(){}}),xr=t("ViewController",class extends Tr{constructor(t,e,i,a){super(ibiz.util.layoutPanel.fill(t),d.create({},e),i||{},new Jo(a)),this.session={},this.modal=new vi({}),this.providers={},this.engines=[],this.error={},this.slotProps={},this.counters={},this.viewLoading=new Qo,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 fn.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 rs(t);this.providers[t.name]=e;const i=Fe(this.model);i&&await Promise.all(i.map((async t=>{const e=await rs(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 Ar(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)}}),Nr=(t("AppDataUploadViewController",class extends xr{initState(){super.initState()}async onCreated(){await super.onCreated();const{srfappdataentityid:t,srfdedataimportid:e,srfappid:i}=this.context,{appDataEntity:a,deDataImport:s}=await wr({appDataEntityId:t,deDataImportId:e,appId:i});this.state.appDataEntity=a,this.state.deDataImport=s}downloadTemplate(){const{appDataEntity:t,deDataImport:e}=this.state;yr(t,e)}async selectAndImport(){const t=await vr({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context});return!0===t.isAsync&&this.closeView(),t}async asyncImportData2(t){return Ir({appDataEntity:this.state.appDataEntity,dataImport:this.state.deDataImport,context:this.context,...t})}}),t("MobViewController",class extends xr{}),t("AppLoginViewController",class extends xr{constructor(){super(...arguments),this.hooks={beforeLogin:new lt,afterLogin:new lt}}async validate(t){const e={validate:!0,parentId:t};return await this.hooks.beforeLogin.call(e),e.validate}destroyHooks(){this.hooks.beforeLogin.clear(),this.hooks.afterLogin.clear()}async onDestroyed(){await super.onDeactivated(),this.destroyHooks()}}),t("WFStepTraceViewController",class extends xr{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 dr.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)}})),Sr=(t("CodeListEditorController",class extends Nr{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 Tr{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=ye(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 rs(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())}actionNotification(t,e){let i,a="";const{ctrlMsg:o}=this.model;if(o&&o.ctrlMsgItems){if(o.ctrlMsgItems.find((e=>e.name==="".concat(t,"_HIDDEN"))))return;const s=o.ctrlMsgItems.find((e=>e.name===t));if(s&&s.content){i=Z(s.timeout)?void 0:s.timeout/1e3;const t={...this.getEventArgs()};(null==e?void 0:e.data)&&(t.data=e.data),a=ei.execScriptFn(t,"`".concat(s.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 Cn?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()}})),Lr=t("MDControlController",class extends Sr{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: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)){if(!await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}))return}await this._evt.emit("onBeforeRemove",void 0),await this.startLoading();let s=!1;try{await Ni(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:"数据[".concat(a.map((t=>t.srfmajortext)).join("、"),"]删除成功!")}),s&&!(null==t?void 0:t.notRefresh)&&await this.refresh()}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:a}),t}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;D(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 Er({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"})}}),Mr=t("AppMenuController",class extends Sr{constructor(t,e,i,a){super(t,e,i,a),this.itemProviders={},this.flattenAllItems()}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)}))}async initAppMenuItemProviders(){await Promise.all(this.allAppMenuItems.map((async t=>{const e=await Ys(t);e&&(this.itemProviders[t.id]=e)})))}async onClickMenuItem(t,e,a=!0,s={}){const n=b(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(Vo.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)}}),Rr=(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 fo(e):this.config=new gn(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;return t=this.util?await this.util.load(this.getResourceTag(),this.context,this.params):await this.config.load(),t}async resetCustomModelData(){return{}}async saveCustomModelData(t,e={}){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},t):await this.config.save(t),t}}),t("AppMenuIconViewController",class extends Mr{async onClickMenuItem(t,e){const a=b(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(Vo.TAG,a.appFuncId,s,this.params)}}),t("CalendarService",class extends Pn{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 bo(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 Lr{initState(){super.initState(),this.state.selectedDate=new Date,this.state.size=1e3}async onCreated(){await super.onCreated(),this.service=new Rr(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}}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.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(Nt),Ct.extend(Lt),Ct.extend(Rt),Ct.extend(_t),Ct.extend(Ft);var Or="$default_group",_r=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=jr(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&&Object.assign(e,{[this.groupField]:a}),this.catalogField&&Object.assign(e,{[this.catalogField]:i});const n=new To(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=Or;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})}))}const n=this.translateVal(a,t[this.catalogField],!0);if(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,{[this.valueField]:e[s].get(n).value},n,s):this.prepareChartData(e,t,n,s);else if(a&&this.autoCompleteCategory){this.chartGenerator.codeListMap.get(a).forEach((t=>{this.prepareChartData(e,{[this.valueField]:0},t.text,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!==Or&&(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[Or].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)}},zr=class extends _r{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}},Fr=class extends _r{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}},Vr=class extends _r{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 _r{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}},Ur=class extends _r{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}},Wr=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})))}}},Br=class extends _r{calcStaticOptions(){return super.calcStaticOptions()}calcRadarCoordSystem(t){const e=this.calcGroupData(t);this.chartGenerator.radarMap.has(this.catalogField)||this.chartGenerator.radarMap.set(this.catalogField,new Wr(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===Or?this.seriesName:t,value:s}}));let s={...this.staticOptions,data:a};return this.seriesUserParam&&(s=rt(s,this.seriesUserParam)),s}},Gr=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 Dt(t[a])?i[a]=Gr(t[a]):i[a]=t[a]})),i};function jr(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]}})),Gr(e)}var Kr=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=jr(n))}initSeriesGenerators(){var t;null==(t=this.model.dechartSerieses)||t.forEach((t=>{let e;switch(t.seriesType){case"line":e=new zr(t,this);break;case"bar":e=new Fr(t,this);break;case"scatter":e=new Ur(t,this);break;case"pie":e=new kr(t,this);break;case"funnel":e=new Vr(t,this);break;case"radar":e=new Br(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,jr(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)}},Hr=t("ChartService",class extends Pn{}),Xr=(t("ChartController",class extends Lr{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 Hr(this.model),await this.service.init(this.context),this.generator=new Kr(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 Sr{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)}}),qr=class{};function Yr(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 Qr=class extends qr{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=Yr(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=Yr(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}},$r=class t extends qr{constructor(e){super(),this.model=e;const i=e.deuilogicLinkConds||[];this.conds=i.map((e=>"SINGLE"===e.logicType?new Qr(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}},Jr=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 $r(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}))}}},Zr=class{constructor(t){this.model=t,this.links=(t.deuilogicLinks||[]).map((t=>new Jr(t)))}},tc=class extends Zr{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])}},ec=class extends Zr{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 Cc.execAndResolved(e,{...o,context:t.context,params:t.viewParam,data:r},this.model.appId)}},ic=class extends Zr{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeStartupNode",{id:this.model.id}))}},ac=class extends Zr{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)}}},sc=class extends Zr{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=Yr(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=Yr(e,t);e.params[i]=it(a)}bindParam(t,e){const i=Yr(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=Yr(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]))}},nc=class extends Zr{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)}},oc=class extends Zr{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=Yr(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)}},rc=class extends Zr{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("control.common.determine"),d.showConfirmButton=!0,d.showCancelButton=!1,l=["ok"];break;case"OKCANCEL":d.confirmButtonText=ibiz.i18n.t("control.common.determine"),d.cancelButtonText=ibiz.i18n.t("app.cancel"),d.showConfirmButton=!0,d.showCancelButton=!0,l=["ok","cancel"];break;default:throw new a(this.model,ibiz.i18n.t("control.common.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])}},cc=class extends Zr{async exec(t){ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.interfaceLogicNodeFrontendPlugin",{id:this.model.id,sysPFPluginId:this.model.sysPFPluginId}));const e=await xs(this.model);e&&await e.exec(this.model,t)}},dc=class extends Zr{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)}},lc=class extends Zr{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}))}},hc=class extends Zr{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=Yr(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)}},uc=class extends Zr{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=Yr(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))}},pc=class extends Zr{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)}},mc=class extends Zr{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}))}},gc=class extends Zr{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])}},fc=class extends Zr{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)}},wc=class extends Zr{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)}},Ec=class extends Zr{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 ao(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)}},yc=class extends Zr{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})}},vc=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])}},Ic=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 ic(t);break;case"END":i=new ac(t);break;case"DEACTION":i=new tc(t);break;case"DEUIACTION":i=new ec(t);break;case"PREPAREJSPARAM":i=new sc(t);break;case"RESETPARAM":i=new lc(t);break;case"COPYPARAM":i=new hc(t);break;case"BINDPARAM":i=new oc(t);break;case"VIEWCTRLINVOKE":i=new nc(t);break;case"MSGBOX":i=new rc(t);break;case"DEBUGPARAM":i=new dc(t);break;case"APPENDPARAM":i=new uc(t);break;case"SORTPARAM":i=new pc(t);break;case"RENEWPARAM":i=new mc(t);break;case"DEDATASET":i=new gc(t);break;case"THROWEXCEPTION":i=new fc(t);break;case"VIEWCTRLFIREEVENT":i=new wc(t);break;case"DELOGIC":i=new Ec(t);break;case"PFPLUGIN":i=new cc(t);break;case"RAWJSCODE":i=new yc(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 vc(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 Xr(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}}},Dc=new Map;async function bc(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}));Dc.has(s)||Dc.set(s,new Ic(s)),ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.startExecutingInterfaceLogic",{appDataEntityId:e,name:s.name}));const n=Dc.get(s),r=await n.exec(i);return ibiz.log.debug(ibiz.i18n.t("runtime.uiLogic.endExecutionInterfaceLogic",{appDataEntityId:e,name:s.name})),r}var Cc=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 Ps(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"))}}),Ac=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 bc(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 bc(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 Cc.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{}}}),Pc=t("BackendUIActionProvider",class extends Ac{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(zo.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))),w=["MULTIKEY","MULTIDATA"].includes(t.actionTarget),E=await g.deService.exec(c,d,l,w?f:f[0],p);if(E.ok){const i=this.calcMessage("success",t,e);i&&ibiz.message.success(i)}return Object.assign(r,{data:pt(E.data)?E.data:[E.data],nextContext:l,nextParams:p}),r}}),Tc=t("SysUIActionProvider",class extends Ac{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)||{}}}),xc=t("FrontUIActionProvider",class extends Ac{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(zo.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,a;const{resultContext:s,resultParams:n}=await this.handleParams(t,e.context,e.data,e.params),r=await ibiz.hub.getAppDataEntity(t.appDataEntityId,t.appId),c=null==(i=r.appDEPrints)?void 0:i.find((e=>e.id===t.appDEPrintId));if(!c)throw new o(ibiz.i18n.t("runtime.uiAction.physicalPrint"));{let t="";if(!s||!s[r.codeName.toLowerCase()])throw new o(ibiz.i18n.t("runtime.uiAction.dataPrimaryKey"));t+="/".concat(r.deapicodeName2,"/printdata/").concat(s[r.codeName.toLowerCase()]);const e=await ibiz.net.request(t,{method:"get",responseType:"blob",params:{srfprinttag:c.codeName,...n}});if(!e.ok)throw new o(ibiz.i18n.t("runtime.uiAction.printFailure"));if(n&&n.srfcontenttype){const t=null==(a=e.headers["content-disposition"].split(";").find((t=>-1!==t.indexOf("filename="))))?void 0:a.slice(9),i=URL.createObjectURL(e.data),s=document.createElement("a");s.href=i,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),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 Er({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}}),Nc=t("WFWithdrawUIActionProvider",class extends Ac{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}}}),Sc=class extends Ac{async execAction(t,e){return await ibiz.confirm.info({title:ibiz.i18n.t("app.logout"),desc:ibiz.i18n.t("runtime.uiAction.wantLogout")})&&await ibiz.hub.controller.logout(),{}}};function Lc(){const t=new xc;Cs("FRONT",(()=>t));const e=new Pc;Cs("BACKEND",(()=>e));const i=new Tc;Cs("SYS",(()=>i));const a=new Nc;Cs("DEUIACTION_WFWithdraw",(()=>a));const s=new Sc;Cs("SYS_Logout",(()=>s))}var Mc=t("ToolbarController",class extends Sr{get _evt(){return this.evt}initState(){super.initState(),this.state.buttonsState=new er,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 Cc.execAndResolved(a,{...n,data:s,event:e},t.appId)}finally{n&&this.state.buttonsState.setLoading("")}}}async onCreated(){await super.onCreated(),this.state.viewMode=this.ctx.view.modal.mode,r(this.model,(t=>{if(t.itemType){const e=t,i=new tr(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"]}),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 Cn&&(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)}}),Rc=t("ContextMenuController",class extends Mc{}),Oc=(t("DashboardController",class extends Sr{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=or(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 Ds(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 Ni(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.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]),this.model.appDynaDashboardUtilId){const t=ibiz.hub.getApp(this.context.srfappid);this.util=new fo(t.getAppUtil(this.model.appDynaDashboardUtilId))}else this.config=new gn(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);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}})),_c=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 Oc}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 Cn&&(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.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=De(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)}}),zc=(t("ContainerPortletController",class extends _c{}),t("ViewPortletController",class extends _c{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 _c{}),t("ChartPortletController",class extends _c{refresh(){this.contentController&&this.contentController.refresh()}}),t("ActionBarPortletController",class extends _c{}),t("HtmlPortletController",class extends _c{}),t("ListPortletController",class extends _c{refresh(){this.contentController&&this.contentController.refresh()}}),t("RawItemPortletController",class extends _c{}),t("DataViewControlService",class extends Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),Fc=t("DataViewControlController",class extends Lr{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 zc(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(t.id,this.context.srfappid,e);i.addState(t.id,a)}})),await i.update(this.context),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 Cn&&(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})}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 er,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 tr(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 Cc.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};Cc.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 Cc.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)}}),Vc=t("ExpBarControlController",class extends Sr{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&&sr(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())}}),kc=(t("CalendarExpBarController",class extends Vc{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 Vc{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 Vc{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 Sr{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 Cn,this.state.isLoaded=!1,this.state.processing=!1,this.state.modified=!1}async dataChangeNotify(t){await Ni(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 ps(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),ze(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)||nr(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 fn.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)}})),Uc=class extends An{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=lr({name:u,valueType:l,defaultValue:h,valueFormat:d},{data:t,context:e,params:i});void 0!==p&&(t[u]=p)}}),{childrenFields:["deformPages","deformTabPages","deformDetails"]})}},Wc=t("SearchFormService",class extends Uc{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 Do(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}}),Bc=(t("SearchFormController",class extends kc{initState(){super.initState(),this.state.storedFilters=[]}async onCreated(){var t,e;await super.onCreated(),this.config=new gn(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 Wc(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)})}})),Gc=t("FormDetailEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(Gc||{})),jc=t("PanelItemEventName",(t=>(t.CLICK="onClick",t.FOCUS="onFocus",t.BLUR="onBlur",t.CHANGE="onChange",t.ENTER="onEnter",t))(jc||{})),Kc=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 Bc(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=De(this.model.dynaClass,t);this.state.class.containerDyna=e}if(this.model.labelDynaClass){const e=De(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})}}),Hc=t("FormButtonState",class extends Bc{constructor(){super(...arguments),this.loading=!1}}),Xc=(t("FormButtonController",class extends Kc{constructor(){super(...arguments),this.actionState=null}createState(){var t;return new Hc(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 tr(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 Cc.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 Bc{constructor(){super(...arguments),this.showMask=!1}})),qc=(t("FormDRUIPartController",class extends Kc{constructor(){super(...arguments),this.refreshItems=["srfkey"],this.paramItem="srfkey",this.isNewData=!1}createState(){var t;return new Xc(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 Bc{constructor(){super(...arguments),this.isShowMore=!1,this.actionGroupState=null}})),Yc=t("FormGroupPanelController",class extends Kc{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 qc(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.execAndResolved(i,{context:this.form.context,params:this.form.params,data:[this.data],view:this.form.view,event:e},t.appId)}}),Qc=t("FormItemState",class extends Bc{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)})}}),$c=(t("FormItemController",class extends Kc{constructor(t,e,i){super(t,e,i),this.rules=[]}createState(){var t;return new Qc(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 ls(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(...rr(t,this.name,this.valueItemName)),this.model.editor&&this.rules.push(...cr(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 Bc{constructor(){super(...arguments),this.actionGroupState=null}}),Jc=t("FormMDCtrlController",class extends Kc{createState(){var t;return new $c(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&&x.checkPermission(this.model.buildInActions,1)}get enableUpdate(){return!this.state.readonly&&x.checkPermission(this.model.buildInActions,2)}get enableDelete(){return!this.state.readonly&&x.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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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 Cc.execAndResolved(i,{context:this.context,params:this.params,data:[this.data],view:this.form.view,event:e},t.appId)}refresh(){}async validate(){return!0}}),Zc=(t("FormMDCtrlMDController",class extends Jc{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&&N(t,{enableRowEdit:this.enableCreate||this.enableUpdate,enableRowNew:this.enableCreate});const e=await rs(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 $c{}),td=(t("FormMDCtrlFormController",class extends Jc{constructor(){super(...arguments),this.ignoreNextSelfChange=!1,this.formMap=new Map}createState(){var t;return new Zc(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 rs(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 Jc{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 qc{})),ed=(t("FormPageController",class extends Yc{createState(){var t;return new td(null==(t=this.parent)?void 0:t.state)}}),t("FormRawItemState",class extends Bc{})),id=(t("FormRawItemController",class extends Kc{createState(){var t;return new ed(null==(t=this.parent)?void 0:t.state)}}),t("FormTabPageState",class extends Bc{})),ad=(t("FormTabPageController",class extends Kc{createState(){var t;return new id(null==(t=this.parent)?void 0:t.state)}get isActive(){return this.parent.state.activeTab===this.model.id}}),t("FormTabPanelState",class extends Bc{constructor(){super(...arguments),this.activeTab=""}})),sd=(t("FormTabPanelController",class extends Kc{createState(){var t;return new ad(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 Uc{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 Cn?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 Cn?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 Cn?e.getOrigin():e);return n=this.handleResponse(n),n}async updateFormItem(t,e,i={}){let a=await this.exec(t,e,i);return a=this.handleResponse(a),a}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 Cn?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 Cn?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 Do(a,s,{isOriginField:!0,dataType:i.dataType}):new Do(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}})),nd=(t("EditFormController",class extends kc{constructor(){super(...arguments),this.oldData=new Cn}get view(){return this.ctx.view}async onCreated(){await super.onCreated(),this.service=new sd(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 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])}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):N(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(s=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(t){throw await this.evt.emit("onRemoveError",{args:t}),this.actionNotification("REMOVEERROR",{error:t}),t}finally{await this.endLoading()}s=a.ok}return this.emitDEDataChange("remove",this.data),this.state.data=new Cn,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&&N(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)}}getDiffData(){const{data:t}=this.state,e={};return Object.keys(t).forEach((i=>{Array.isArray(t[i])?D(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 Cn(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})}})),od=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 Cn(t,this.oldData.$dataUIMap)}}),rd=t("GridService",class extends Pn{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 Do(a,o,{isOriginField:!0,dataType:r.dataType})}else n=new Do(a,a);this.dataUIMap.set(a,n)}))}}async updateGridEditItem(t,e,i={}){const a=await this.app.deService.getService(e,this.model.appDataEntityId);let s=await a.exec(t,e,i);return s=this.handleResponse(s),s}}),cd={string:25,number:6,integer:9,date:5};var dd=t("GridController",class extends Lr{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}async onCreated(){await this.initByEntitySchema(),await super.onCreated(),this.service=new rd(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()}async initByEntitySchema(){if(!this.addSchemaColumn)return;const t=await br(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:cd[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 Ni(Object.values(this.fieldColumns).map((async t=>{await t.loadCodeList()})),!1),this.state.rows=e.map((t=>{const e=new od(t,this);return this.gridStateNotify(e,"LOAD"),e})),await this.updateRows(this.state.rows),this.calcGroupData(e),this.calcAggResult(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.control.gantt.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 od(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.gantt.rowData"));if(!i.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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 Ni(t.map((t=>this.save(t))))}async initColumnsController(t){var e;const i=await fs(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)||nr(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 Ni(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 fr(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=lr({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)}}}),ld=t("GridFieldColumnController",class extends nd{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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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}=Ee(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(zo.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 Cc.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 dr.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 Cc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),hd=(t("GridUAColumnController",class extends nd{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 er;a.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 Cc.execAndResolved(a,{context:this.context,params:this.params,data:[e.data],view:this.grid.view,event:i},t.appId)}}),t("GridFieldEditColumnController",class extends ld{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 ls(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(...rr(t,this.fieldName,this.valueItemName)),this.editItem.editor&&this.rules.push(...cr(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 nd{}),t("ListService",class extends Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),ud=(t("ListController",class extends Lr{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 hd(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=[],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 Sr{constructor(t,e,i,a,s){super(t,e,i,a),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),Object.values(this.panelItems).forEach((t=>{t.destroy()}))}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 ys(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 Po(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)}})),pd=(t("ViewLayoutPanelController",class extends ud{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)})}})),md=(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),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(){}createState(){var t;return new pd(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=De(this.model.dynaClass,t);e.length&&(this.state.class.containerDyna=e)}if(this.model.labelDynaClass){const e=De(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 Sr{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"])),gd=/^N_(.\w+)_(.\w+)$/;function fd(t){var e;return"SIMPLE"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function wd(t){var e;return"HIDDEN"===(null==(e=t.userParam)?void 0:e.ITEMTYPE)}function Ed(t){const e=t.split("__")[1].match(gd);return{field:e[1],op:e[2]}}var yd=["ISNULL","ISNOTNULL","EXISTS","NOTEXISTS"],vd=/\$\{[^}]*\}/,Id=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=wd(t),t.appDEFieldId&&(n=Ne(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?yd.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 ls(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&&vd.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}}),Dd=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}))}},bd="",Cd={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"]},Ad={};function Pd(t,e){if(t.enumSource)return{appId:bd,editorType:"DROPDOWNLIST",singleSelect:!0,valueType:"SIMPLE",appCodeListId:t.enumSource,id:"".concat(t.key,"_").concat(e)};return Ad["".concat(t.type,"_").concat(e)]}async function Td(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=Cd[t.type];e?e.forEach((e=>{t&&r.push({appId:bd,appDEFieldId:o[t.key],id:t.key,caption:t.description,defsearchMode:{appId:bd,valueOP:e},editor:Pd(t,e)})})):ibiz.log.error(ibiz.i18n.t("runtime.controller.control.grid.unsupported",{type:""}),t.type)})),r}Object.keys(Cd).forEach((t=>{Cd[t].forEach((e=>{if(yd.includes(e))return;const i="".concat(t,"_").concat(e);Ad[i]||("date"!==t||["IN","NOTIN"].includes(e)?Ad[i]={appId:bd,editorType:"TEXTBOX",id:i}:Ad[i]={appId:bd,editorType:"DATEPICKER",id:i})}))}));var xd=/^N_(.\w+)_(.\w+)$/,Nd=t("SearchBarFilterItemsController",class extends Id{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(xd),s=a[1],n=a[2],o=it(t);o.defsearchMode.valueOP=n,o.id=s;const r=new Id(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 Sd(){return[{nodeType:"GROUP",logicType:"AND",children:[{nodeType:"FIELD",field:null,valueOP:null,value:null}]}]}function Ld(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||Z(t.value)):a="ITEMS"===t.nodeType?!t.field||!t.valueOP:!t.logicType)})),i&&!a&&(e.pass=!0),e}function Md(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=>Md(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=>Md(t,e)))),i=a}return(null==e?void 0:e.after)&&e.after(t,i),i}function Rd(t,e){const{pass:i}=Ld(t);if(!i)return;return t.map((t=>Md(t,e)))}function Od(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=>Od(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=>Od(t)))),t.simple&&(e.simple=t.simple),a=e}return!0===t.hidden&&(a.hidden=!0),a}function _d(t){let e;if("GROUP"===t.nodeType){const i={condop:t.logicType,condtype:"GROUP"};t.children.length>0&&(i.searchconds=t.children.map((t=>_d(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=>_d(t)))),t.simple&&(i.simple=t.simple),e=i}return!0===t.hidden&&(e.hidden=!0),e}function zd(t){const{pass:e}=Ld(t);if(!e)return;return t.map(_d)}var Fd=t("SearchBarFilterSimpleItemsController",class extends Id{constructor(t,e,i,a){super(t,e,i,a),this.noEditor=!1,this.key=this.model.id,this.type="SIMPLE_ITEMS";const s=Ed(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}]})}}),Vd=/\$\{[^}]*\}/,kd=(t("SearchBarController",class extends Sr{constructor(){super(...arguments),this.placeHolder="",this.filterControllers=[],this.currentEditGroup=null,this.isBackendSearchGroup="SEARCHBAR2"===this.model.searchBarStyle,this.hasDefaultSelect=!1,this.addSchemaFilters=!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")}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();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 Dd(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 br(this.model.appDataEntityId,this.context);if(!e)return;const i=await Td(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)&&md.includes(e.defsearchMode.valueOP)){if(fd(e))return void this.filterControllers.push(new Fd(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 Id(e,this.appDataEntity,this.context,this.params);this.filterControllers.push(a)})),t.size>0&&t.forEach((t=>{const e=new Nd(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 Rd(this.state.filterNodes,{after:(t,e)=>{"FIELD"===t.nodeType&&z(t.value)&&Vd.test(t.value)&&(e.value=ei.execSingleLine("`".concat(t.value,"`"),{...this.getEventArgs()}))}})}async initSearBarGroups(t=!1){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 e=await this.service.fetch();if(e.ok&&e.data.forEach((t=>{const e=this.state.searchBarGroups.find((e=>e.name===t.name));if(e)N(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){this.state.searchBarGroups.find((t=>t.defaultSelect))&&(this.hasDefaultSelect=!0)}}}setDefaultSelect(){if(this.state.searchBarGroups&&this.state.searchBarGroups.length>0){const t=this.state.searchBarGroups.find((t=>t.defaultSelect));t&&this.handleGroupClick(t)}}async handleSave(){if(this.grid&&this.state.selectedSearchGroupItem){const t={searchconds:zd(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&&(N(t,e.data),t.saved=!0),ibiz.message.success(ibiz.i18n.t("runtime.controller.control.form.savedSuccessfully",{srfmajortext:""}))}}}}async handleGroupClick(t){if(this.state.selectedSearchGroupItem=t,t.saved){const e=await this.service.get(t.id);e.ok&&(N(t,e.data),t.show=!0)}if(t.searchGroupData&&t.searchGroupData.searchconds&&t.searchGroupData.searchconds.length>0){const e=t.searchGroupData.searchconds.map((t=>Od(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&&z(t.value)&&Vd.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=Ne(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 Sr{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&&sr(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+=ht(),this.evt.emit("onNavViewChange",{navViewMsg:t})}}),t("TreeService",class extends Pn{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 Ni(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{expandFirstOnly:c,expanded:d,rootNode:l}=t,h=l&&!this.model.rootVisible;return n||await Promise.all(r.map((async(t,e)=>{var i;if(d&&(!c||c&&0===e)||(null==(i=s.defaultExpandedKeys)?void 0:i.length)&&s.defaultExpandedKeys.includes(t._id)||h){const e=await this.fetchChildNodes(t,s);t._children=e}}))),r}async getStaticNodeData(t,e,i,a){return new Io(t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}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=>new vo(t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}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=>new Eo(t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}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)}})),Ud=t("TreeController",class extends Lr{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 Rc(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 fn.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 Cc.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)return!!this.findDropNodeRS(e._nodeId,n.appDataEntityId);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)})}}),Wd=t("WizardPanelService",class extends An{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}}),Bd=(t("WizardPanelController",class extends Sr{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 er}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 tr(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 Wd(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 rs(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){const t=await this.service.initialize(this.context,{},this.params),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(){await this.service.finish(this.context,this.formData,this.params),this.evt.emit("onFinishSuccess",void 0)}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(),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 Cn&&(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 Pn{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 Do(e,s,{isOriginField:!0,dataType:t.dataType})}else a=new Do(e,e);this.dataUIMap.set(e,a)}))}})),Gd=t("MobMDCtrlRowState",class{constructor(t,e){this.data=t,this.controller=e,this.uaColStates={},this.data=t}}),jd=(t("MDCtrlController",class extends Lr{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 Bd(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 Gd(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 Gd(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 Cc.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 er;(e.uiactionGroupDetails||[]).forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 Gd(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 Gd(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 zc{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}})),Kd=(t("KanbanController",class extends Fc{get enableEditOrder(){return!0===this.model.enableCardEditOrder}get enableEditGroup(){return!0===this.model.enableCardEditGroup}async initControlService(){this.service=new jd(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.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 er;a.forEach((t=>{const i=t.uiactionId;if(i){const a=new tr(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 Cc.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 w,E=[];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]?(E.length>0&&(E.forEach((t=>{t[r]=h(w),c.push(t),w=t[r]})),f=w,w=0,E=[]),t[r]=h(f),c.push(t)):(0===E.length&&(w=f),E.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{})),Hd=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=>{this.editColStates[t.name]={disabled:!1,readonly:!1,editable:"all"===ibiz.config.grid.editShowMode,required:!1}})))}}),Xd=t("TreeGridExController",class extends Ud{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 Kd(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 Hs(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 Hd(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.gantt.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.control.gantt.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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 Ni(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)||nr(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 Ni(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=lr({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})}}}),qd=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){}}),Yd=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 ls(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 er;e.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const a=new tr(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}=Ee(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(zo.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 Cc.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 dr.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)}}),Qd=(t("TreeGridExFieldColumnController",class extends qd{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 Yd(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 qd{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 er;i.uiactionGroupDetails.forEach((t=>{const e=t.uiactionId;if(e){const i=new tr(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 dd{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 rd{}),t("MEditViewPanelService",class extends Pn{})),$d=(t("MEditViewPanelController",class extends Lr{constructor(){super(...arguments),this.parameters=[]}async onCreated(){await super.onCreated(),this.service=new Qd(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: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 Pn{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}=Ee(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 Ao(t,s))))})))}return new p(a,200)}})),Jd=(t("MapController",class extends Lr{initState(){super.initState(),this.state.size=1e3,this.state.pointData=[],this.state.areaData=[],this.calcDefaultOptions()}async onCreated(){await super.onCreated(),this.service=new $d(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 An{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}})),Zd=class{constructor(t){this.config={},this.model=t,this.setConfig()}setConfig(){}init(t){this.protoRef=t}load(t){return Promise.resolve(t)}},tl=class extends Zd{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)}},el=class extends Zd{},il=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 tl(t);case"USER2":return new el(t);default:throw new Error(ibiz.i18n.t("runtime.controller.control.reportPanel.noImplemented",{reportType:t.appDEReport.reportType}))}}},al=(t("ReportPanelController",class extends Sr{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=il.getInstance(this.model),this.dataEntity=await ibiz.hub.getAppDataEntity(this.model.appDataEntityId,this.model.appId),this.service=new Jd(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 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 So(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 s=Re(this.model,{parentId:t._nodeId,hasQuery:i});if(0===s.length)return;(await Ni(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){return new No(this.model,t,i,{parentValueLevel:null==e?void 0:e.parentValueLevel,leaf:!!a.leaf})}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=>new So(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:c,navParams:d})))}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=>new Lo(this.model,t,i,{data:e,leaf:!!a.leaf,navContext:o,navParams:r})))}return[]}})),sl=(t("GanttController",class extends Xd{get _evt(){return this.evt}initState(){super.initState(),this.state.ganttStyle={}}onDataChange(t){}async initService(){this.service=new al(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;if(e){await this.handleDefaultExpandNodes(e)&&this._evt.emit("onDefaultExpand",{nodes: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("onDefaultExpand",{nodes:n}),this._evt.emit("onAfterRefreshParent",{parentNode:s,children:n})}async handleDefaultExpandNodes(t){let e=!1;for(let i=0;i<t.length;i++){const a=t[i];if(this.state.expandedKeys.includes(a._id)){e=!0;const t=await this.loadNodes(a);await this.handleDefaultExpandNodes(t)}}return e}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)||nr(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.control.gantt.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.control.gantt.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.control.gantt.rowData"));if(!e.modified)return void ibiz.log.debug(ibiz.i18n.t("runtime.controller.control.gantt.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)){if(!await ibiz.confirm.error({title:ibiz.i18n.t("runtime.controller.common.control.dataDeletion"),desc:ibiz.i18n.t("runtime.controller.common.control.confirmDataDeletion")}))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 Ni(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.control.gantt.dataDeleted",{str:a.map((t=>t.srfmajortext)).join("、")})}),n&&s&&!(null==t?void 0:t.notRefresh)&&await this.refreshNodeChildren(s)}catch(t){throw await this._evt.emit("onRemoveError",void 0),this.actionNotification("REMOVEERROR",{error:t,data:a}),t}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.gantt.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 Hd(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})}}}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)}})),nl=class{constructor(){this.evt=new ut,this.total=0,this.actions=[],this.doingNum=0,this.finishedStates=[30,40],this.service=new Sn}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 ol(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 rl=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 mo,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:ol(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}},cl=class{constructor(){this.evt=new ut,this.total=0,this.asyncAction=new nl,this.internalMessage=new rl}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()}},dl=class{constructor(){this.convert=new Bo,this.controller=new sl,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 jo,this.notice=new cl,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 Uo(e);return this.appMap.set(t,i),await this.modelLoaderProvider.initApp(t),await i.init(),this.configCache||(this.configCache=new gn(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()}))}},ll=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)}}),hl=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=>{we(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")):we(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=b(e,t,{compareField:"id",childrenFields:["panelItems","rootPanelItems"]}),{model:a}=this.view,s=we(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),{data:r}=n;r&&(this.view.state.srfactiveviewdata=r,e.emit("onDataChange",{actionType:"LOAD",data:[r]}),r.srfkey&&e.emit("onViewInfoChange",{dataInfo:r.srfmajortext||""}))}}),ul=(t("MDViewEngine",class extends hl{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: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=we(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 we(t,"searchform")||e.push("searchform"),this.calcViewSearchBarVisible()||e.push("view_searchbar"),e}}),document.title),pl=class{constructor(){this.layoutPanel=new oi,this.theme=new bi,this.text=new Di,this.hbs=new de,this.rawValue=new Ti,this.action=Cc,this.error=new Wt,this.viewStack=new xi,this.anime=new Ba,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:ul,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"))}},ml=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(){}},gl=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)}},fl=class extends ml{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)}},wl=class extends ml{execute(t){const{appDEUILogicId:e,appDataEntityId:a}=this.logic;if(!e)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.noConfiguredLogic"));return bc(e,a,t)}},El=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)}},yl=class extends El{constructor(t){const e=t.filter((t=>"APPVIEWENGINE"!==t.triggerType));e.forEach((t=>{"CTRLEVENT"===t.triggerType&&(t.ctrlName=t.itemName||t.logicTag)})),super(e)}},vl=class extends El{constructor(t){t.forEach((t=>{t.triggerType=t.logicTrigger})),super(t)}triggerViewEvent(t){const e={eventName:t.eventName,triggerType:"VIEWEVENT"};this.triggerAndExecute(e,t)}},Il=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)}},Dl=class{constructor(){this.executorFactory=new gl,this.triggerFactory=new Il}createViewScheduler(t){return new vl(t)}createControlScheduler(t){return new yl(t)}},bl=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}},Cl=class extends bl{},Al=class extends bl{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)}},Pl=class extends bl{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)}},Tl=class extends ml{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(zo.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])||{},w=p.navigateContexts;ct(w)&&(m=he(w,f,n,s)),m=Object.assign(s,m);const E=p.navigateParams;if(ct(E)&&(g=he(E,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 y=await ibiz.commands.execute(zo.TAG,p.refAppViewId,m,g,{...o,openMode:p.openMode});return l&&y.data&&await this.doBatchAdd(t,y.data,s,p,e.view),y}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(zo.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)}}},xl=class extends bl{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)}},Nl=class extends bl{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)}},Sl=class extends ml{execute(t){if(!this.logic.appDEUIActionId)throw new i(this.logic,ibiz.i18n.t("runtime.logicScheduler.executor.missingTrigger"));Cc.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}})}}}));
|