@nocobase/app 2.1.37 → 2.1.38
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/client/assets/{index-da051635.js → index-68721948.js} +8 -8
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.tpl +1 -1
- package/dist/client/v/assets/{index-c90a7249.js → index-5460cca0.js} +7 -7
- package/dist/client/v/index.html +1 -1
- package/package.json +7 -7
- /package/dist/client/assets/{index-da051635.js.LICENSE.txt → index-68721948.js.LICENSE.txt} +0 -0
- /package/dist/client/v/assets/{index-c90a7249.js.LICENSE.txt → index-5460cca0.js.LICENSE.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! For license information please see index-
|
|
1
|
+
/*! For license information please see index-5460cca0.js.LICENSE.txt */
|
|
2
2
|
export const __rspack_esm_id="8410";export const __rspack_esm_ids=["8410"];export const __webpack_modules__={65359(e,t,l){var n={"./en-nz":["35571","4096"],"./bi.js":["95944","5905"],"./id.js":["87420","557"],"./km":["36101","7318"],"./he.js":["92010","1463"],"./me":["80623","3028"],"./tk":["62544","9065"],"./ko.js":["88003","4784"],"./tet.js":["18928","1481"],"./es-do":["61219","448"],"./ku":["16605","9518"],"./hr":["15811","9248"],"./zh-tw.js":["31349","3526"],"./hy-am":["94309","1846"],"./am.js":["4736","192"],"./en-in":["60912","3977"],"./de-at":["32878","3283"],"./pt-br":["92218","1863"],"./ar-iq.js":["13309","3102"],"./en-sg":["12673","1434"],"./zh":["56007","828"],"./en-il.js":["97690","8087"],"./lo":["73860","7141"],"./tlh":["60321","3978"],"./mi.js":["32739","4672"],"./el":["54072","9217"],"./ur.js":["51750","5819"],"./sq":["95977","4930"],"./pa-in.js":["39252","8053"],"./ar-kw.js":["79865","242"],"./fr-ca.js":["86290","4223"],"./de-ch.js":["13672","1329"],"./ru":["62796","6093"],"./eo.js":["33713","7386"],"./nb":["7205","630"],"./br":["72745","1586"],"./fo":["17674","791"],"./zh.js":["56007","828"],"./vi":["96098","8269"],"./fr-ch.js":["73433","5122"],"./ms-my":["26400","8473"],"./es-pr":["3532","9021"],"./bo.js":["59294","5123"],"./ht.js":["8809","4594"],"./lo.js":["73860","7141"],"./my.js":["46803","8480"],"./et":["4288","5881"],"./br.js":["72745","1586"],"./gu":["57409","474"],"./it-ch":["19286","1179"],"./sv-fi":["9160","9953"],"./ne.js":["40880","553"],"./zh-cn.js":["16033"],"./gom-latn.js":["78660","7669"],"./bg.js":["39990","1979"],"./mr.js":["46462","5459"],"./cv.js":["4780","5933"],"./lt.js":["34485","406"],"./pt":["72369","9578"],"./th.js":["47081","2258"],"./cs.js":["9751","4076"],"./es.js":["47317","70"],"./bn.js":["92509","2110"],"./ar-tn":["54405","6870"],"./mi":["32739","4672"],"./sr.js":["45616","3641"],"./tr":["4895","5108"],"./bn-bd":["64608","6345"],"./fa.js":["90292","7413"],"./it":["33900","1469"],"./nl":["69423","8676"],"./zh-hk":["87741","2622"],"./fo.js":["17674","791"],"./bs.js":["25530","8295"],"./ja.js":["50952","4801"],"./my":["46803","8480"],"./es-do.js":["61219","448"],"./gl":["33562","7095"],"./nl-be.js":["60465","6346"],"./en-ca.js":["21995","4456"],"./tzm-latn.js":["58804","2613"],"./types.d.ts":["69224","929"],"./ru.js":["62796","6093"],"./sq.js":["95977","4930"],"./cv":["4780","5933"],"./km.js":["36101","7318"],"./fa":["90292","7413"],"./cs":["9751","4076"],"./ms":["79677","2446"],"./types.d":["69224","929"],"./ca":["25993","9170"],"./tr.js":["4895","5108"],"./x-pseudo":["5760","8217"],"./tzm-latn":["58804","2613"],"./kn":["6364","93"],"./jv":["77741","4686"],"./ms-my.js":["26400","8473"],"./ht":["8809","4594"],"./be":["51532","8349"],"./gd":["68418","3039"],"./en-au":["59881","5861"],"./ka":["46481","9274"],"./ka.js":["46481","9274"],"./ur":["51750","5819"],"./sv.js":["21340","3309"],"./zh-cn":["16033"],"./pl.js":["63225","6914"],"./hi":["52830","3859"],"./ug-cn":["79911","3260"],"./ar-kw":["79865","242"],"./dv.js":["82187","5640"],"./id":["87420","557"],"./dv":["82187","5640"],"./vi.js":["96098","8269"],"./de-ch":["13672","1329"],"./en-in.js":["60912","3977"],"./es-pr.js":["3532","9021"],"./es-us.js":["32498","335"],"./ar-iq":["13309","3102"],"./fi.js":["89964","9565"],"./ca.js":["25993","9170"],"./ms.js":["79677","2446"],"./zh-tw":["31349","3526"],"./bs":["25530","8295"],"./rw.js":["35414","9592"],"./fy":["59836","2301"],"./uz-latn":["80950","8635"],"./mt.js":["99464","6241"],"./fr.js":["813","6062"],"./hu":["38298","183"],"./lv.js":["76467","8624"],"./sr-cyrl.js":["27439","3396"],"./tzl":["3187","896"],"./mn":["12698","8631"],"./pa-in":["39252","8053"],"./nl-be":["60465","6346"],"./kk":["11335","300"],"./en-tt":["2619","7608"],"./ar-ly.js":["85592","2913"],"./hr.js":["15811","9248"],"./kk.js":["11335","300"],"./ar":["2338","5791"],"./ar-dz.js":["48361","2322"],"./ar-sa":["40539","1848"],"./nl.js":["69423","8676"],"./cy":["95681","5757"],"./en-ie":["17329","58"],"./lb.js":["88615","8252"],"./ar-ly":["85592","2913"],"./de.js":["50494","7507"],"./am":["4736","192"],"./lv":["76467","8624"],"./tg":["15012","2565"],"./de-at.js":["32878","3283"],"./sl":["39998","4195"],"./tg.js":["15012","2565"],"./ky.js":["34457","3458"],"./kn.js":["6364","93"],"./bo":["59294","5123"],"./da":["42706","4767"],"./ss.js":["52487","492"],"./uz":["54734","7555"],"./fr-ch":["73433","5122"],"./sk":["46847","6660"],"./hu.js":["38298","183"],"./sr":["45616","3641"],"./he":["92010","1463"],"./uk.js":["34173","2270"],"./es-mx":["64719","9204"],"./se.js":["55285","8294"],"./oc-lnc":["70225","5642"],"./pt-br.js":["92218","1863"],"./rw":["35414","9592"],"./ar-sa.js":["40539","1848"],"./nb.js":["7205","630"],"./fr-ca":["86290","4223"],"./hi.js":["52830","3859"],"./gl.js":["33562","7095"],"./en-ie.js":["17329","58"],"./me.js":["80623","3028"],"./fy.js":["59836","2301"],"./ar.js":["2338","5791"],"./az":["51130","9847"],"./lt":["34485","406"],"./en":["65826","5087"],"./ro.js":["24334","5139"],"./sw":["2979","9584"],"./te.js":["87406","4419"],"./tl-ph.js":["78142","1667"],"./es-mx.js":["64719","9204"],"./ky":["34457","3458"],"./it.js":["33900","1469"],"./zh-hk.js":["87741","2622"],"./da.js":["42706","4767"],"./te":["87406","4419"],"./mt":["99464","6241"],"./lb":["88615","8252"],"./uz-latn.js":["80950","8635"],"./ml.js":["75376","8729"],"./en-sg.js":["12673","1434"],"./uz.js":["54734","7555"],"./tzm.js":["95084","1101"],"./tet":["18928","1481"],"./oc-lnc.js":["70225","5642"],"./az.js":["51130","9847"],"./en-au.js":["59881","5861"],"./fr":["813","6062"],"./gd.js":["68418","3039"],"./yo.js":["87933","5870"],"./nn":["23473","5674"],"./bm":["71092","5701"],"./index.d.ts":["41213","9550"],"./sw.js":["2979","9584"],"./af":["65662","3523"],"./en-il":["97690","8087"],"./eu":["94007","1052"],"./et.js":["4288","5881"],"./rn":["34509","2606"],"./se":["55285","8294"],"./sv-fi.js":["9160","9953"],"./gu.js":["57409","474"],"./gom-latn":["78660","7669"],"./pl":["63225","6914"],"./ar-dz":["48361","2322"],"./ar-ma":["81289","1986"],"./eu.js":["94007","1052"],"./ss":["52487","492"],"./tk.js":["62544","9065"],"./es-us":["32498","335"],"./bi":["95944","5905"],"./ug-cn.js":["79911","3260"],"./mn.js":["12698","8631"],"./pt.js":["72369","9578"],"./cy.js":["95681","5757"],"./mr":["46462","5459"],"./ga.js":["54061","3646"],"./ko":["88003","4784"],"./ku.js":["16605","9518"],"./af.js":["65662","3523"],"./hy-am.js":["94309","1846"],"./es":["47317","70"],"./ml":["75376","8729"],"./en-ca":["21995","4456"],"./bn":["92509","2110"],"./ga":["54061","3646"],"./is.js":["15513","5506"],"./sd.js":["63222","1675"],"./sl.js":["39998","4195"],"./tlh.js":["60321","3978"],"./tl-ph":["78142","1667"],"./uk":["34173","2270"],"./x-pseudo.js":["5760","8217"],"./is":["15513","5506"],"./jv.js":["77741","4686"],"./el.js":["54072","9217"],"./fi":["89964","9565"],"./bn-bd.js":["64608","6345"],"./en-gb":["72026","8759"],"./en-gb.js":["72026","8759"],"./mk":["75877","4358"],"./ne":["40880","553"],"./ro":["24334","5139"],"./mk.js":["75877","4358"],"./si":["65665","3898"],"./tzm":["95084","1101"],"./be.js":["51532","8349"],"./de":["50494","7507"],"./rn.js":["34509","2606"],"./si.js":["65665","3898"],"./yo":["87933","5870"],"./bg":["39990","1979"],"./en.js":["65826","5087"],"./sv":["21340","3309"],"./th":["47081","2258"],"./bm.js":["71092","5701"],"./nn.js":["23473","5674"],"./ar-ma.js":["81289","1986"],"./index.d":["41213","9550"],"./ja":["50952","4801"],"./ta.js":["77250","1887"],"./ar-tn.js":["54405","6870"],"./sd":["63222","1675"],"./sk.js":["46847","6660"],"./tzl.js":["3187","896"],"./en-nz.js":["35571","4096"],"./eo":["33713","7386"],"./ta":["77250","1887"],"./en-tt.js":["2619","7608"],"./it-ch.js":["19286","1179"],"./sr-cyrl":["27439","3396"]};function r(e){if(!l.o(n,e))return Promise.resolve().then(function(){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=n[e],r=t[0];return Promise.all(t.slice(1).map(l.e)).then(function(){return l.t(r,23)})}r.keys=()=>Object.keys(n),r.id=65359,e.exports=r},35358(e,t,l){var n={"./af":"25177","./af.js":"25177","./ar":"61509","./ar-dz":"41488","./ar-dz.js":"41488","./ar-kw":"58676","./ar-kw.js":"58676","./ar-ly":"42353","./ar-ly.js":"42353","./ar-ma":"24496","./ar-ma.js":"24496","./ar-sa":"82682","./ar-sa.js":"82682","./ar-tn":"89756","./ar-tn.js":"89756","./ar.js":"61509","./az":"95533","./az.js":"95533","./be":"28959","./be.js":"28959","./bg":"47777","./bg.js":"47777","./bm":"54903","./bm.js":"54903","./bn":"61290","./bn-bd":"17357","./bn-bd.js":"17357","./bn.js":"61290","./bo":"31545","./bo.js":"31545","./br":"11470","./br.js":"11470","./bs":"44429","./bs.js":"44429","./ca":"7306","./ca.js":"7306","./cs":"56464","./cs.js":"56464","./cv":"73635","./cv.js":"73635","./cy":"64226","./cy.js":"64226","./da":"93601","./da.js":"93601","./de":"77853","./de-at":"26111","./de-at.js":"26111","./de-ch":"54697","./de-ch.js":"54697","./de.js":"77853","./dv":"60708","./dv.js":"60708","./el":"54691","./el.js":"54691","./en-au":"53872","./en-au.js":"53872","./en-ca":"28298","./en-ca.js":"28298","./en-gb":"56195","./en-gb.js":"56195","./en-ie":"66584","./en-ie.js":"66584","./en-il":"65543","./en-il.js":"65543","./en-in":"9033","./en-in.js":"9033","./en-nz":"79402","./en-nz.js":"79402","./en-sg":"43004","./en-sg.js":"43004","./eo":"32934","./eo.js":"32934","./es":"97650","./es-do":"20838","./es-do.js":"20838","./es-mx":"17730","./es-mx.js":"17730","./es-us":"56575","./es-us.js":"56575","./es.js":"97650","./et":"3035","./et.js":"3035","./eu":"3508","./eu.js":"3508","./fa":"119","./fa.js":"119","./fi":"90527","./fi.js":"90527","./fil":"95995","./fil.js":"95995","./fo":"52477","./fo.js":"52477","./fr":"85498","./fr-ca":"26435","./fr-ca.js":"26435","./fr-ch":"37892","./fr-ch.js":"37892","./fr.js":"85498","./fy":"37071","./fy.js":"37071","./ga":"41734","./ga.js":"41734","./gd":"70217","./gd.js":"70217","./gl":"77329","./gl.js":"77329","./gom-deva":"32124","./gom-deva.js":"32124","./gom-latn":"93383","./gom-latn.js":"93383","./gu":"95050","./gu.js":"95050","./he":"11713","./he.js":"11713","./hi":"43861","./hi.js":"43861","./hr":"26308","./hr.js":"26308","./hu":"90609","./hu.js":"90609","./hy-am":"17160","./hy-am.js":"17160","./id":"74063","./id.js":"74063","./is":"89374","./is.js":"89374","./it":"88383","./it-ch":"21827","./it-ch.js":"21827","./it.js":"88383","./ja":"23827","./ja.js":"23827","./jv":"89722","./jv.js":"89722","./ka":"41794","./ka.js":"41794","./kk":"27088","./kk.js":"27088","./km":"96870","./km.js":"96870","./kn":"84451","./kn.js":"84451","./ko":"63164","./ko.js":"63164","./ku":"98174","./ku.js":"98174","./ky":"78474","./ky.js":"78474","./lb":"79680","./lb.js":"79680","./lo":"15867","./lo.js":"15867","./lt":"45766","./lt.js":"45766","./lv":"69532","./lv.js":"69532","./me":"58076","./me.js":"58076","./mi":"41848","./mi.js":"41848","./mk":"30306","./mk.js":"30306","./ml":"73739","./ml.js":"73739","./mn":"99053","./mn.js":"99053","./mr":"86169","./mr.js":"86169","./ms":"73386","./ms-my":"92297","./ms-my.js":"92297","./ms.js":"73386","./mt":"77075","./mt.js":"77075","./my":"72264","./my.js":"72264","./nb":"22274","./nb.js":"22274","./ne":"8235","./ne.js":"8235","./nl":"92572","./nl-be":"43784","./nl-be.js":"43784","./nl.js":"92572","./nn":"54566","./nn.js":"54566","./oc-lnc":"69330","./oc-lnc.js":"69330","./pa-in":"29849","./pa-in.js":"29849","./pl":"94418","./pl.js":"94418","./pt":"79834","./pt-br":"48303","./pt-br.js":"48303","./pt.js":"79834","./ro":"24457","./ro.js":"24457","./ru":"82271","./ru.js":"82271","./sd":"1221","./sd.js":"1221","./se":"33478","./se.js":"33478","./si":"17538","./si.js":"17538","./sk":"5784","./sk.js":"5784","./sl":"46637","./sl.js":"46637","./sq":"86794","./sq.js":"86794","./sr":"45719","./sr-cyrl":"3322","./sr-cyrl.js":"3322","./sr.js":"45719","./ss":"56000","./ss.js":"56000","./sv":"41011","./sv.js":"41011","./sw":"40748","./sw.js":"40748","./ta":"11025","./ta.js":"11025","./te":"11885","./te.js":"11885","./tet":"28861","./tet.js":"28861","./tg":"86571","./tg.js":"86571","./th":"55802","./th.js":"55802","./tk":"59527","./tk.js":"59527","./tl-ph":"29231","./tl-ph.js":"29231","./tlh":"31052","./tlh.js":"31052","./tr":"85096","./tr.js":"85096","./tzl":"79846","./tzl.js":"79846","./tzm":"81765","./tzm-latn":"97711","./tzm-latn.js":"97711","./tzm.js":"81765","./ug-cn":"48414","./ug-cn.js":"48414","./uk":"16618","./uk.js":"16618","./ur":"57777","./ur.js":"57777","./uz":"57609","./uz-latn":"72475","./uz-latn.js":"72475","./uz.js":"57609","./vi":"21135","./vi.js":"21135","./x-pseudo":"64051","./x-pseudo.js":"64051","./yo":"82218","./yo.js":"82218","./zh-cn":"52648","./zh-cn.js":"52648","./zh-hk":"1632","./zh-hk.js":"1632","./zh-mo":"31541","./zh-mo.js":"31541","./zh-tw":"50304","./zh-tw.js":"50304"};function r(e){return l(i(e))}function i(e){if(!l.o(n,e)){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}r.keys=function(){return Object.keys(n)},r.resolve=i,e.exports=r,r.id=35358},35963(e,t,l){let n,r,i;var o,a,s,d,u,c,p,h,m,f={};l.r(f),l.d(f,{default:()=>iL,evaluators:()=>i$,getOptions:()=>iB});var g={};l.r(g),l.d(g,{array:()=>i7,bigField:()=>od,boolean:()=>oo,collection:()=>os,datetime:()=>ot,enumType:()=>or,id:()=>on,number:()=>ol,object:()=>oe,string:()=>i9,tableoid:()=>oa,time:()=>oi});var v={};l.r(v),l.d(v,{connectFields:()=>hD,customizeFilterRender:()=>hU,defaultOperator:()=>hq,operatorComponentProps:()=>hH});var y={};l.r(y),l.d(y,{ASSIGN_FIELD_VALUES_STEP_KEY:()=>uo.zL,ActionGroupModel:()=>sN,ActionModel:()=>sB.S0,ActionSceneEnum:()=>sB.s5,ActionWithoutPermission:()=>sB._T,AddChildActionModel:()=>uN,AddNewActionModel:()=>dW,AssignFormGridModel:()=>uV,AssignFormItemModel:()=>cl,AssignFormModel:()=>uB,AssociateActionModel:()=>d2,AssociationFieldGroupModel:()=>sL,AssociationFieldModel:()=>cy,BasePageTabModel:()=>d$,BlockGridModel:()=>dv,BlockModel:()=>dy.z,BlockSceneEnum:()=>dy.P,BulkDeleteActionModel:()=>d5,CascadeSelectFieldModel:()=>g4,CascadeSelectInnerFieldModel:()=>g2,CascadeSelectListFieldModel:()=>g8,CheckboxFieldModel:()=>vM,CheckboxGroupFieldModel:()=>vA,ChildPageModel:()=>dE,ChildPageTabModel:()=>dL,ClickableFieldModel:()=>gz,CollectionActionGroupModel:()=>sO,CollectionActionModel:()=>db.U,CollectionBlockModel:()=>dx.t,CollectionSelectorFieldModel:()=>vC,ColorFieldModel:()=>vE,CommonItemModel:()=>dw,CreateContent:()=>cK,CreateFormModel:()=>hG,CustomWidth:()=>mW,DataBlockModel:()=>dS.R,DateOnlyFieldModel:()=>vV,DateOnlyFilterFieldModel:()=>c8,DateOnlyPicker:()=>vq,DateTimeFilterFieldModel:()=>c5,DateTimeNoTzFieldModel:()=>vK,DateTimeNoTzFilterFieldModel:()=>c6,DateTimeNoTzPicker:()=>vz,DateTimeTzFieldModel:()=>vY,DateTimeTzFilterFieldModel:()=>c7,DateTimeTzPicker:()=>vH,DeleteActionModel:()=>d4,DetailsAssociationFieldGroupModel:()=>cn,DetailsBlockModel:()=>ca,DetailsCustomItemModel:()=>cd,DetailsGridModel:()=>cu,DetailsItemModel:()=>uX,DetailsJSFieldItemModel:()=>cf,DisassociateActionModel:()=>d8,DisplayCheckboxFieldModel:()=>b$,DisplayColorFieldModel:()=>ba,DisplayDateTimeFieldModel:()=>bu,DisplayEnumFieldModel:()=>bm,DisplayHtmlFieldModel:()=>bg,DisplayIconFieldModel:()=>bv,DisplayJSONFieldModel:()=>bx,DisplayNumberFieldModel:()=>bE,DisplayPasswordFieldModel:()=>bI,DisplayPercentFieldModel:()=>bT,DisplaySubItemFieldModel:()=>bl,DisplaySubListFieldModel:()=>bo,DisplaySubTableFieldModel:()=>bt,DisplayTextFieldModel:()=>b_,DisplayTimeFieldModel:()=>bN,DisplayTitleFieldModel:()=>y3,DisplayURLFieldModel:()=>bD,DividerItemModel:()=>yQ,EditActionModel:()=>d3,EditFormContent:()=>vo,EditFormModel:()=>uQ.EditFormModel,ExpandCollapseActionModel:()=>uT,FieldDeletePlaceholder:()=>mV,FieldModel:()=>aC.o,FieldModelSelect:()=>pp,FieldOperatorSelect:()=>pE,FilterActionModel:()=>d7,FilterBlockModel:()=>dM,FilterFormActionGroupModel:()=>pW,FilterFormActionModel:()=>pU,FilterFormBlockModel:()=>ha,FilterFormCollapseActionModel:()=>hp,FilterFormCustomFieldModel:()=>pN,FilterFormCustomItemModel:()=>pR,FilterFormCustomRecordSelectFieldModel:()=>pK,FilterFormFieldModel:()=>cg,FilterFormGridModel:()=>hP,FilterFormItemModel:()=>hC,FilterFormJSActionModel:()=>hj,FilterFormRecordSelectFieldModel:()=>c1,FilterFormResetActionModel:()=>hE,FilterFormSubmitActionModel:()=>hR,FilterManager:()=>s8,FormActionGroupModel:()=>uu,FormActionModel:()=>us,FormAssociationFieldGroupModel:()=>ml,FormAssociationItemModel:()=>ms,FormBlockContent:()=>u$.JU,FormBlockModel:()=>u$.F4,FormComponent:()=>u$.s2,FormCustomItemModel:()=>hJ,FormGridModel:()=>uL,FormItemModel:()=>u4,FormJSFieldItemModel:()=>hX,FormModel:()=>u$.mO,FormSubmitActionModel:()=>ud,GRID_FLOW_KEY:()=>ds,GRID_STEP:()=>dd,GridModel:()=>dc,IconFieldModel:()=>vZ,InputFieldModel:()=>v0.m,InputNumberField:()=>yl,JSActionModel:()=>ur,JSBlockModel:()=>mb,JSCollectionActionModel:()=>ui,JSColumnModel:()=>fP,JSEditableFieldModel:()=>yY,JSFieldModel:()=>yN,JSFormActionModel:()=>hQ,JSItemActionModel:()=>uf,JSItemModel:()=>y4,JSRecordActionModel:()=>ug,JsonFieldModel:()=>n,JsonInput:()=>v9,LinkActionModel:()=>uI,MainPageModel:()=>dT,MarkdownItemModel:()=>y5,NBColorPicker:()=>vj,NumberFieldModel:()=>yn,ObjectNester:()=>gk,PageModel:()=>dP,PageTabModel:()=>dq,PasswordFieldModel:()=>yr,PercentFieldModel:()=>ys,PercentInput:()=>ya,PluginSettingsTopbarActionModel:()=>nN,PopupActionModel:()=>dK,PopupCollectionActionModel:()=>uv,PopupSubTableActionGroupModel:()=>vg,PopupSubTableActionsColumnModel:()=>vb,PopupSubTableEditActionModel:()=>vs,PopupSubTableFieldModel:()=>vm,PopupSubTableFormActionGroupModel:()=>uh,PopupSubTableFormModel:()=>vx,PopupSubTableFormSubmitActionModel:()=>up,PopupSubTableRemoveActionModel:()=>vf,QUICK_EDIT_FORM_MAX_HEIGHT:()=>h0,QUICK_EDIT_MARKDOWN_HEIGHT:()=>h1,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>hZ,QuickEditFormModel:()=>mt,RadioGroupFieldModel:()=>yd,RecordActionGroupModel:()=>s$,RecordActionModel:()=>dU.L,RecordPickerContent:()=>f1,RecordPickerFieldModel:()=>f5,RecordSelectFieldModel:()=>cG,RefreshActionModel:()=>uy,RichTextField:()=>yy,RichTextFieldModel:()=>r,RootPageModel:()=>dV,RootPageTabModel:()=>dB,RouteModel:()=>em,SelectFieldModel:()=>yF,SourceCascader:()=>pT,SubFormFieldModel:()=>gC,SubFormListFieldModel:()=>gj,SubPageModel:()=>dz,SubTableColumnModel:()=>gm,SubTableFieldModel:()=>gM,SubTableRecordAction:()=>va,TABLE_COLUMN_MIN_WIDTH:()=>mK,TableActionsColumnModel:()=>m1,TableAssociationFieldGroupModel:()=>m2,TableBlockModel:()=>fy,TableColumnModel:()=>mY,TableCustomColumnModel:()=>mG,TableJSFieldItemModel:()=>fk,TableSelectModel:()=>fF,TextareaFieldModel:()=>i,TimeFieldModel:()=>yT,TopbarActionModel:()=>nE,UIEditorTopbarActionModel:()=>nD,USER_CENTER_ACTION_ID:()=>nO,UnitConversion:()=>bR,UpdateRecordActionModel:()=>uF,UserCenterActionItemModel:()=>nW,UserCenterItemModel:()=>nK,UserCenterSelectItemModel:()=>nH,UserCenterTextItemModel:()=>nU,UserCenterTopbarActionModel:()=>nZ,VariableFieldFormModel:()=>y_,ViewActionModel:()=>uk,applyAssociateAction:()=>dZ,applyClickToOpenProps:()=>gL,applyClickToOpenSetting:()=>gV,applyDisassociateAction:()=>dQ,buildDisplayPathFromValue:()=>gJ,buildRecordPickerParentItemContext:()=>fX,buildRecordPickerPopupContextInputArgs:()=>fZ,canRecordPickerSelectMultiple:()=>fK,collectAssociationHydrationCandidates:()=>cB,collectCascadeHydrationCandidate:()=>gY,connectFields:()=>hD,createAssignFieldValuesStep:()=>uo.KW,createAssignFormSubModelOptions:()=>uo.nF,customizeFilterRender:()=>hU,defaultOperator:()=>hq,findOptionPathByTk:()=>gX,formatNumber:()=>bP,getAllDataModels:()=>sZ,getAssignFieldValuesDefaultParams:()=>uo.Z1,getAssociationBlockResourceSettings:()=>dH,getAssociationHydrationNamePath:()=>cL,getAssociationHydrationSetterContext:()=>cq,getAssociationSelectAssociatedRecordsFilter:()=>fA,getAssociationSelectForeignKeyFilter:()=>fM,getAssociationSelectorContextInputArgs:()=>dJ,getAssociationTargetResourceSettings:()=>dG,getDefaultOperator:()=>sX,getDetailsItemValue:()=>uG,getDisplayNumber:()=>bj,getFilterFormOperatorList:()=>sG,getFilterFormOperatorMeta:()=>sJ,getQuickEditFieldProps:()=>h6,getRecordPickerClearedValue:()=>fY,getRecordPickerEmptyValue:()=>fH,getTopbarPluginSettingsItems:()=>nj,getValueWithIndex:()=>uY,injectRecordPickerPopupContext:()=>fQ,isAssociationBlockContext:()=>dY,isFilterValueEmpty:()=>sQ,joinUrlSearch:()=>uP,markCascadeHydrationDone:()=>gG,mergeAssignFieldValues:()=>uo.GO,normalizeRecordPickerSelectedRows:()=>fW,normalizeRecordPickerValue:()=>fG,normalizeTableColumnWidth:()=>mU,operatorComponentProps:()=>hH,recalculateGridSizes:()=>dh,refreshClickToOpenRuntime:()=>gq,resolveAssignFieldValues:()=>uo.eu,resolveCustomFieldOperatorList:()=>pC,resolveDefaultCustomFieldOperator:()=>pP,shouldClearRecordPickerValueOnMultipleChange:()=>fU,tableRowActionsClassName:()=>mQ,toOperatorSelectOptions:()=>pj,transformNestedData:()=>gN,transformRowsToSingleColumn:()=>dp});var b={};l.r(b),l.d(b,{aclCheck:()=>xC,aclCheckRefresh:()=>xI,actionLinkageRules:()=>SF,afterSuccess:()=>aA,blockHeight:()=>ww,blockLinkageRules:()=>SA,confirm:()=>aF,customVariable:()=>b8,dataLoadingMode:()=>xb,dataScope:()=>sT,dateRangeLimit:()=>xg,dateTimeFormat:()=>xh,detailsFieldLinkageRules:()=>Sj,displayFieldComponent:()=>xA,fieldComponent:()=>xF,fieldLinkageRules:()=>SC,filterFormDefaultValues:()=>wg,fixed:()=>xB,formAssignRules:()=>wm,layout:()=>xw,linkageAssignField:()=>Sv,linkageRulesRefresh:()=>wv,linkageRunjs:()=>Sb,linkageSetActionProps:()=>Sr,linkageSetBlockProps:()=>St,linkageSetDetailsFieldProps:()=>Ss,linkageSetFieldProps:()=>So,linkageSetMenuItemProps:()=>Si,menuLinkageRules:()=>Sk,navigateToURL:()=>b5,numberFormat:()=>ST,openView:()=>bG,overflowMode:()=>SR,pattern:()=>xN,refreshTargetBlocks:()=>xe,renderMode:()=>xx,required:()=>xS,runjs:()=>bJ,setTargetDataScope:()=>xo,showMessage:()=>bZ,showNotification:()=>b2,sortingRule:()=>xy,subFormFieldLinkageRules:()=>SP,subFormLinkageAssignField:()=>Sy,subFormLinkageSetFieldProps:()=>Sa,titleField:()=>xu,validation:()=>x$});var x={};l.r(x),l.d(x,{ACLContext:()=>ne.w0,ACLRolesCheckProvider:()=>ne.rR,ADMIN_LAYOUT_MODEL_UID:()=>tS,ADMIN_SETTINGS_KEY:()=>o6.w$,ADMIN_SETTINGS_LAYOUT_MODEL_UID:()=>nS.O,ADMIN_SETTINGS_PATH:()=>o6.wq,AIManager:()=>ei,APIClient:()=>k,ASSIGN_FIELD_VALUES_STEP_KEY:()=>uo.zL,ActionGroupModel:()=>sN,ActionModel:()=>sB.S0,ActionSceneEnum:()=>sB.s5,ActionWithoutPermission:()=>sB._T,AddChildActionModel:()=>uN,AddNewActionModel:()=>dW,AdminLayoutComponent:()=>rk,AdminLayoutContent:()=>l4,AdminLayoutMenuItemModel:()=>lV,AdminLayoutMenuItemRenderer:()=>lp,AdminLayoutMenuModelRenderer:()=>lf,AdminLayoutModel:()=>r$,AdminLayoutRouteCoordinator:()=>tw,AdminSettingsLayout:()=>Mx.AdminSettingsLayout,AdminSettingsLayoutModel:()=>Mw.C,AntdAppProvider:()=>W,AppError:()=>ea.uV,AppMaintaining:()=>ea.be,AppMaintainingDialog:()=>ea.tp,AppNotFound:()=>ea.bM,AppSpin:()=>ea.gv,Application:()=>aa,ApplicationContext:()=>as,ApplicationModel:()=>i3,AssignFormGridModel:()=>uV,AssignFormItemModel:()=>cl,AssignFormModel:()=>uB,AssociateActionModel:()=>d2,AssociationFieldGroupModel:()=>sL,AssociationFieldModel:()=>cy,BaseApplication:()=>i5,BaseLayoutModel:()=>eB,BaseLayoutRouteCoordinator:()=>eM,BasePageTabModel:()=>d$,BlankComponent:()=>ea.ct,BlockGridModel:()=>dv,BlockModel:()=>dy.z,BlockSceneEnum:()=>dy.P,BulkDeleteActionModel:()=>d5,CascadeSelectFieldModel:()=>g4,CascadeSelectInnerFieldModel:()=>g2,CascadeSelectListFieldModel:()=>g8,CheckboxFieldInterface:()=>M3,CheckboxFieldModel:()=>vM,CheckboxGroupFieldInterface:()=>M6,CheckboxGroupFieldModel:()=>vA,ChildPageModel:()=>dE,ChildPageTabModel:()=>dL,ClickableFieldModel:()=>gz,CodeEditor:()=>ul.BY,CodeEditorExtension:()=>ul.o8,CodeScanner:()=>ea.O5,CollectionActionGroupModel:()=>sO,CollectionActionModel:()=>db.U,CollectionBlockModel:()=>dx.t,CollectionFieldInterface:()=>M8,CollectionFieldInterfaceManager:()=>oH,CollectionFilter:()=>ea.px,CollectionFilterPanel:()=>ea.XO,CollectionSelect:()=>ob,CollectionSelectFieldInterface:()=>M9,CollectionSelectorFieldModel:()=>vC,ColorFieldInterface:()=>M7,ColorFieldModel:()=>vE,CommonItemModel:()=>dw,CreateContent:()=>cK,CreateFormModel:()=>hG,CreatedAtFieldInterface:()=>Ae,CreatedByFieldInterface:()=>At,CurrentUserContext:()=>MB,CustomWidth:()=>mW,DEFAULT_DATA_SOURCE_KEY:()=>tr.Ze,DEFAULT_PAGE_SIZE:()=>ea.yQ,DataBlockModel:()=>dS.R,DateFieldInterface:()=>AD,DateOnlyFieldModel:()=>vV,DateOnlyFilterFieldModel:()=>c8,DateOnlyPicker:()=>vq,DateTimeFilterFieldModel:()=>c5,DateTimeNoTzFieldModel:()=>vK,DateTimeNoTzFilterFieldModel:()=>c6,DateTimeNoTzPicker:()=>vz,DateTimeTzFieldModel:()=>vY,DateTimeTzFilterFieldModel:()=>c7,DateTimeTzPicker:()=>vH,DatetimeFieldInterface:()=>Al,DatetimeNoTzFieldInterface:()=>AN,DefaultToolsManager:()=>er,DeleteActionModel:()=>d4,DetailsAssociationFieldGroupModel:()=>cn,DetailsBlockModel:()=>ca,DetailsCustomItemModel:()=>cd,DetailsGridModel:()=>cu,DetailsItemModel:()=>uX,DetailsJSFieldItemModel:()=>cf,DialogFormLayout:()=>ea.xg,DisassociateActionModel:()=>d8,DisplayCheckboxFieldModel:()=>b$,DisplayColorFieldModel:()=>ba,DisplayDateTimeFieldModel:()=>bu,DisplayEnumFieldModel:()=>bm,DisplayHtmlFieldModel:()=>bg,DisplayIconFieldModel:()=>bv,DisplayJSONFieldModel:()=>bx,DisplayNumberFieldModel:()=>bE,DisplayPasswordFieldModel:()=>bI,DisplayPercentFieldModel:()=>bT,DisplaySubItemFieldModel:()=>bl,DisplaySubListFieldModel:()=>bo,DisplaySubTableFieldModel:()=>bt,DisplayTextFieldModel:()=>b_,DisplayTimeFieldModel:()=>bN,DisplayTitleFieldModel:()=>y3,DisplayURLFieldModel:()=>bD,DividerItemModel:()=>yQ,DragSortRowContext:()=>ea.c5,DrawerFormLayout:()=>ea.gh,EditActionModel:()=>d3,EditFormContent:()=>vo,EditFormModel:()=>uQ.EditFormModel,EmailFieldInterface:()=>An,EnvVariableInput:()=>ea.s9,ExpandCollapseActionModel:()=>uT,ExtendCollectionsProvider:()=>AL,FieldDeletePlaceholder:()=>mV,FieldFilterOperatorRegistry:()=>ou,FieldModel:()=>aC.o,FieldModelSelect:()=>pp,FieldOperatorSelect:()=>pE,FieldValidationConfigureRegistry:()=>oV,FileSizeInput:()=>ea.c,FilterActionModel:()=>d7,FilterBlockModel:()=>dM,FilterContent:()=>ak.oJ,FilterFormActionGroupModel:()=>pW,FilterFormActionModel:()=>pU,FilterFormBlockModel:()=>ha,FilterFormCollapseActionModel:()=>hp,FilterFormCustomFieldModel:()=>pN,FilterFormCustomItemModel:()=>pR,FilterFormCustomRecordSelectFieldModel:()=>pK,FilterFormFieldModel:()=>cg,FilterFormGridModel:()=>hP,FilterFormItemModel:()=>hC,FilterFormJSActionModel:()=>hj,FilterFormRecordSelectFieldModel:()=>c1,FilterFormResetActionModel:()=>hE,FilterFormSubmitActionModel:()=>hR,FilterGroup:()=>ak.I8,FilterItem:()=>ak.qi,FilterManager:()=>s8,FlowModelRepository:()=>S$,FlowPage:()=>bV,FlowRoute:()=>rX,FormActionGroupModel:()=>uu,FormActionModel:()=>us,FormAssociationFieldGroupModel:()=>ml,FormAssociationItemModel:()=>ms,FormBlockContent:()=>u$.JU,FormBlockModel:()=>u$.F4,FormComponent:()=>u$.s2,FormCustomItemModel:()=>hJ,FormGridModel:()=>uL,FormItemModel:()=>u4,FormJSFieldItemModel:()=>hX,FormModel:()=>u$.mO,FormSubmitActionModel:()=>ud,GRID_FLOW_KEY:()=>ds,GRID_STEP:()=>dd,GlobalThemeProvider:()=>el,GridModel:()=>dc,HeaderContext:()=>ll,Icon:()=>ea.In,IconFieldInterface:()=>Ar,IconFieldModel:()=>vZ,IdFieldInterface:()=>Ai,InputFieldInterface:()=>As,InputFieldModel:()=>v0.m,InputNumberField:()=>yl,IntegerFieldInterface:()=>Ad,InternalAdminSettingsLayout:()=>Mx.InternalAdminSettingsLayout,JSActionModel:()=>ur,JSBlockModel:()=>mb,JSCollectionActionModel:()=>ui,JSColumnModel:()=>fP,JSEditableFieldModel:()=>yY,JSFieldModel:()=>yN,JSFormActionModel:()=>hQ,JSItemActionModel:()=>uf,JSItemModel:()=>y4,JSRecordActionModel:()=>ug,JsonFieldInterface:()=>Au,JsonFieldModel:()=>n,JsonInput:()=>v9,JsonTextArea:()=>ea.V4,LayoutContent:()=>l8,LayoutContentRoute:()=>rZ,LayoutManager:()=>is,LayoutRoute:()=>r6,LinkActionModel:()=>uI,LinkageFilterItem:()=>ak.Ru,M2MFieldInterface:()=>Ac,M2OFieldInterface:()=>Ap,MAX_MESSAGE_CHARS:()=>ul.hP,MENU_TYPE_OPTIONS:()=>lP,MainPageModel:()=>dT,MarkdownFieldInterface:()=>Ah,MarkdownItemModel:()=>y5,MobileMenuControlContext:()=>lt,MockFlowModelRepository:()=>SO,MultipleSelectFieldInterface:()=>Am,NBColorPicker:()=>vj,NanoidFieldInterface:()=>AT,NocoBaseBuildInPlugin:()=>MU,NocoBaseBuildInPluginV2:()=>MU,NumberFieldInterface:()=>Af,NumberFieldModel:()=>yn,O2MFieldInterface:()=>Av,OBOFieldInterface:()=>Ag,OHOFieldInterface:()=>Ay,ObjectNester:()=>gk,OptionsEditor:()=>oB,PAGE_SIZE_OPTIONS:()=>ea.xp,PLUGIN_MANAGER_SETTING_NAME:()=>nS.Bm,PageModel:()=>dP,PageTabModel:()=>dq,PasswordFieldInterface:()=>Ab,PasswordFieldModel:()=>yr,PasswordInput:()=>ea.yA,PercentFieldInterface:()=>Ax,PercentFieldModel:()=>ys,PercentInput:()=>ya,PhoneFieldInterface:()=>Aw,PinnedPluginListContext:()=>nl,PinnedPluginListLite:()=>n2,Plugin:()=>am,PluginFlowEngine:()=>MA,PluginManager:()=>o3,PluginManagerPage:()=>MS.PluginManagerPage,PluginSettingsManager:()=>o6.mz,PluginSettingsTopbarActionModel:()=>nN,PopupActionModel:()=>dK,PopupCollectionActionModel:()=>uv,PopupSubTableActionGroupModel:()=>vg,PopupSubTableActionsColumnModel:()=>vb,PopupSubTableEditActionModel:()=>vs,PopupSubTableFieldModel:()=>vm,PopupSubTableFormActionGroupModel:()=>uh,PopupSubTableFormModel:()=>vx,PopupSubTableFormSubmitActionModel:()=>up,PopupSubTableRemoveActionModel:()=>vf,PoweredBy:()=>ea.G5,QUICK_EDIT_FORM_MAX_HEIGHT:()=>h0,QUICK_EDIT_MARKDOWN_HEIGHT:()=>h1,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>hZ,QuickEditFormModel:()=>mt,RadioGroupFieldInterface:()=>AS,RadioGroupFieldModel:()=>yd,RangeValidationItems:()=>oq,RecordActionGroupModel:()=>s$,RecordActionModel:()=>dU.L,RecordPickerContent:()=>f1,RecordPickerFieldModel:()=>f5,RecordSelectFieldModel:()=>cG,RefreshActionModel:()=>uy,RemoteFlowModelRenderer:()=>bz,RemoteSelect:()=>ea.lT,ResetThemeTokenAndKeepAlgorithm:()=>tE,RichTextField:()=>yy,RichTextFieldInterface:()=>AM,RichTextFieldModel:()=>r,RootPageModel:()=>dV,RootPageTabModel:()=>dB,RouteModel:()=>em,RouteRepository:()=>id,RouterContextCleaner:()=>ea.PK,RouterManager:()=>an,SNIPPET_PREFIX:()=>o6.tJ,SYSTEM_SETTINGS_SETTING_NAME:()=>nS.jm,ScanInput:()=>ea.E5,SelectFieldInterface:()=>AA,SelectFieldModel:()=>yF,SkeletonFallback:()=>r2,SnowflakeIdFieldInterface:()=>AF,SortHandle:()=>ea.vm,SortableRow:()=>ea.B7,SourceCascader:()=>pT,SubFormFieldModel:()=>gC,SubFormListFieldModel:()=>gj,SubPageModel:()=>dz,SubTableColumnModel:()=>gm,SubTableFieldModel:()=>gM,SubTableRecordAction:()=>va,SwitchLanguage:()=>ea.rw,SystemSettingsPage:()=>MM.SystemSettingsPage,SystemSettingsSource:()=>es.o,TABLE_COLUMN_MIN_WIDTH:()=>mK,Table:()=>ea.XI,TableActionsColumnModel:()=>m1,TableAssociationFieldGroupModel:()=>m2,TableBlockModel:()=>fy,TableColumnModel:()=>mY,TableCustomColumnModel:()=>mG,TableJSFieldItemModel:()=>fk,TableSelectModel:()=>fF,TableoidFieldInterface:()=>Ak,TextAreaWithContextSelector:()=>ag.n,TextareaFieldInterface:()=>AC,TextareaFieldModel:()=>i,TimeFieldInterface:()=>AP,TimeFieldModel:()=>yT,TopbarActionModel:()=>nE,TypedVariableInput:()=>ea.Pb,UIEditorTopbarActionModel:()=>nD,USER_CENTER_ACTION_ID:()=>nO,UUIDFieldInterface:()=>AI,UnitConversion:()=>bR,UnixTimestampFieldInterface:()=>A_,UpdateRecordActionModel:()=>uF,UpdatedAtFieldInterface:()=>Aj,UpdatedByFieldInterface:()=>AE,UrlFieldInterface:()=>AR,UserCenterActionItemModel:()=>nW,UserCenterItemModel:()=>nK,UserCenterSelectItemModel:()=>nH,UserCenterTextItemModel:()=>nU,UserCenterTopbarActionModel:()=>nZ,VariableFieldFormModel:()=>y_,VariableFilterItem:()=>ak.Et,VariableInput:()=>ea.P8,VariableJSON:()=>ea.hJ,VariableJsonTextArea:()=>ea.jr,VariableTextArea:()=>ea.hp,ViewActionModel:()=>uk,WebSocketClient:()=>iu,aclCheck:()=>xC,aclCheckRefresh:()=>xI,actionLinkageRules:()=>SF,addCustomAlgorithmToTheme:()=>Q,addFieldValidationConfiguresToGroup:()=>oW,afterSuccess:()=>aA,applyAssociateAction:()=>dZ,applyClickToOpenProps:()=>gL,applyClickToOpenSetting:()=>gV,applyDisassociateAction:()=>dQ,applyMobilePaginationProps:()=>ub.hO,array:()=>i7,bigField:()=>od,blockHeight:()=>ww,blockLinkageRules:()=>SA,boolean:()=>oo,buildDisplayPathFromValue:()=>gJ,buildInsertRouteSchema:()=>lB,buildLinkSettingSchema:()=>lF,buildMenuBasicSchema:()=>lj,buildMenuTitleWithIcon:()=>lv,buildRecordPickerParentItemContext:()=>fX,buildRecordPickerPopupContextInputArgs:()=>fZ,buildV2SigninHref:()=>tt,canRecordPickerSelectMultiple:()=>fK,collectAssociationHydrationCandidates:()=>cB,collectCascadeHydrationCandidate:()=>gY,collection:()=>os,compatOldTheme:()=>J,configurePropertiesToItems:()=>oP,confirm:()=>aF,connectFields:()=>hD,createAclSnippetAllow:()=>ne.rN,createAssignFieldValuesStep:()=>uo.KW,createAssignFormSubModelOptions:()=>uo.nF,createCompactSimpleItemRender:()=>ub.hH,createDefaultCollectionBlockTitle:()=>ub.lr,createFilterable:()=>ov,createFormRegistry:()=>ea.oV,createInsertMenuStep:()=>l_,createMockClient:()=>ah,createSettingsPathMap:()=>nS.nC,createTypedFilterable:()=>oy,customAlgorithm:()=>X,customVariable:()=>b8,customizeFilterRender:()=>hU,dataLoadingMode:()=>xb,dataScope:()=>sT,dateRangeLimit:()=>xg,dateTimeFormat:()=>xh,dateTimeFormatConfigureItems:()=>oN,datetime:()=>ot,defaultOperator:()=>hq,defaultTheme:()=>G,detailsFieldLinkageRules:()=>Sj,diagnoseRunJS:()=>ul.fL,dispatchEventDeep:()=>ub.Xi,displayFieldComponent:()=>xA,editMarkdownFlow:()=>y1,enumType:()=>or,escapeHTML:()=>ns.Z,evaluateFieldConfigureExpression:()=>oM,fieldComponent:()=>xF,fieldFilterOperatorPresets:()=>oh,fieldFilterOperators:()=>op,fieldLinkageRules:()=>SC,fieldValidationConfigureRegistry:()=>oz,filterFormDefaultValues:()=>wg,filterOperatorRegistry:()=>oc,filterRenderableSettings:()=>nS.Ui,filterVisibleSettings:()=>nS.eD,findFirstAccessiblePageRoute:()=>ty,findFirstInternalSettingsPage:()=>nS.X2,findFirstV2LandingRoute:()=>tv,findNextSiblingRoute:()=>lO,findOptionPathByTk:()=>gX,findPrevSiblingRoute:()=>lN,findSettingsByName:()=>nS.R0,fixed:()=>xB,formAssignRules:()=>wm,formatEnvPath:()=>ea.EM,formatNumber:()=>bP,formatRunJSPreviewMessage:()=>ul.by,formatVariablePath:()=>ea.X5,getAdminLayoutMenuInitializerButton:()=>lg,getAdminLayoutMenuMovePositionOptions:()=>ln,getAdminLayoutMenuVirtualPath:()=>tJ,getAdminLayoutModel:()=>rB,getAllDataModels:()=>sZ,getAppVersionHTML:()=>ns.p,getAssignFieldValuesDefaultParams:()=>uo.Z1,getAssociationBlockResourceSettings:()=>dH,getAssociationHydrationNamePath:()=>cL,getAssociationHydrationSetterContext:()=>cq,getAssociationSelectAssociatedRecordsFilter:()=>fA,getAssociationSelectForeignKeyFilter:()=>fM,getAssociationSelectorContextInputArgs:()=>dJ,getAssociationTargetResourceSettings:()=>dG,getCoreFieldConfigureState:()=>oT,getCurrentV2RedirectPath:()=>te,getDefaultOperator:()=>sX,getDefaultSettingsPath:()=>nS.C9,getDefaultV2AdminRedirectPath:()=>e7,getDetailsItemValue:()=>uG,getDisplayNumber:()=>bj,getFilterFormOperatorList:()=>sG,getFilterFormOperatorMeta:()=>sJ,getLayoutContentRouteNames:()=>ej,getLayoutModel:()=>eL,getLayoutPageRouteName:()=>eF,getLayoutPageTabRouteName:()=>ek,getLayoutPageTabViewRouteName:()=>eP,getLayoutPageViewRouteName:()=>eC,getMenuCreationDefaultParams:()=>lC,getMenuCreationUiSchema:()=>lI,getMenuEditDefaultParams:()=>lR,getMenuItems:()=>nS.gL,getMobileCompactPaginationClassName:()=>ub.NY,getModernClientPrefix:()=>e5,getPinnedPluginListKeys:()=>nt,getQuickEditFieldProps:()=>h6,getRecordPickerClearedValue:()=>fY,getRecordPickerEmptyValue:()=>fH,getSimpleModePaginationClassName:()=>ub.HZ,getTopbarPluginSettingsItems:()=>nj,getUniqueKeyFromCollection:()=>AO,getUnknownCountPaginationTotal:()=>ub.SM,getV2EffectiveBasePath:()=>e8,getValueWithIndex:()=>uY,hasIcon:()=>ea.cE,hasOwnSettingsPage:()=>nS.lv,icons:()=>ea.Pt,id:()=>on,indexConfigureItems:()=>oD,injectRecordPickerPopupContext:()=>fQ,insertRouteSchema:()=>lk,isAssociationBlockContext:()=>dY,isFilterValueEmpty:()=>sQ,isLayoutContentRouteName:()=>eE,isTitleField:()=>tr.ji,isTitleFieldInterface:()=>tr.w,isV2AdminRuntime:()=>td,isV2MenuRoute:()=>tg,joinUrlSearch:()=>uP,languageCodes:()=>af.A,layout:()=>xw,linkageAssignField:()=>Sv,linkageRulesRefresh:()=>wv,linkageRunjs:()=>Sb,linkageSetActionProps:()=>Sr,linkageSetBlockProps:()=>St,linkageSetDetailsFieldProps:()=>Ss,linkageSetFieldProps:()=>So,linkageSetMenuItemProps:()=>Si,makeFormatVariablePath:()=>ea.nW,makeParseVariablePath:()=>ea.Dx,makeVariableRegExp:()=>ea.at,markCascadeHydrationDone:()=>gG,matchSettingsRoute:()=>nS.CM,matchesRoutePath:()=>l$,menuLinkageRules:()=>Sk,mergeAssignFieldValues:()=>uo.GO,mergePaginationClassName:()=>ub.M6,navigateToURL:()=>b5,normalizeAdminLayoutMenuLegacyVariables:()=>t0,normalizeCollectionTemplateField:()=>A$,normalizeCollectionTemplateFields:()=>AB,normalizeFilterableOperators:()=>of,normalizeLayoutRoutePath:()=>io,normalizeRecordPickerSelectedRows:()=>fW,normalizeRecordPickerValue:()=>fG,normalizeTableColumnWidth:()=>mU,number:()=>ol,numberFormat:()=>ST,object:()=>oe,openAdminLayoutMenuLink:()=>t2,openView:()=>bG,openViewFlow:()=>ep,operatorComponentProps:()=>hH,overflowMode:()=>SR,parseEnvPath:()=>ea.uO,parseVariablePath:()=>ea.h7,pattern:()=>xN,previewRunJS:()=>ul.zA,recalculateGridSizes:()=>dh,reconcileAdminLayoutMenuItems:()=>li,redirectToV2Signin:()=>tl,refreshClickToOpenRuntime:()=>gq,refreshTargetBlocks:()=>xe,registerFieldValidationConfigure:()=>oK,registerFieldValidationConfigureGroup:()=>oU,registerIcon:()=>ea.pU,registerIcons:()=>ea.K1,removeMarkdownIframes:()=>Me.VC,renderMode:()=>xx,replaceRouteParams:()=>nS.uT,required:()=>xS,resolveAdminLayoutMenuDragMoveOptions:()=>lo,resolveAdminLayoutMenuDragMoveOptionsFromEvent:()=>la,resolveAdminLayoutMenuLink:()=>t1,resolveAdminRouteRuntimeTarget:()=>tx,resolveAssignFieldValues:()=>uo.eu,resolveCustomFieldOperatorList:()=>pC,resolveDefaultCustomFieldOperator:()=>pP,resolveDynamicNamePath:()=>aO.IJ,resolveFilterOperators:()=>om,resolveV2SigninRedirect:()=>tn,reverseFieldConfigureItem:()=>o$,reverseFieldConfigureItems:()=>oO,runCoreFieldConfigureEffects:()=>o_,runjs:()=>bJ,setTargetDataScope:()=>xo,shouldClearRecordPickerValueOnMultipleChange:()=>fU,shouldRenderIconInTitle:()=>lh,showMessage:()=>bZ,showNotification:()=>b2,sortTopLevelSettings:()=>nS.p$,sortingRule:()=>xy,string:()=>i9,stripMarkdownIframeTags:()=>Me.jR,stripMarkdownIframes:()=>Me.$P,stripModernClientPrefix:()=>e4,subFormFieldLinkageRules:()=>SP,subFormLinkageAssignField:()=>Sy,subFormLinkageSetFieldProps:()=>Sa,tableRowActionsClassName:()=>mQ,tableoid:()=>oa,time:()=>oi,titleField:()=>xu,toOperatorSelectOptions:()=>pj,toRouterNavigationPath:()=>tu,toToolsMap:()=>eo,toTreeSelectItems:()=>lD,toViewStack:()=>eA,transformNestedData:()=>gN,transformRowsToSingleColumn:()=>dp,useACLContext:()=>ne.bq,useACLRoleContext:()=>ne.v6,useAclSnippets:()=>ne.K3,useAdminLayoutRoutePage:()=>Mb,useApp:()=>V.n,useAppListRender:()=>n6,useApplications:()=>n5,useCurrentAppInfo:()=>ni.g,useCurrentRoleMode:()=>ne.GL,useCurrentRoles:()=>Mq,useCurrentUserContext:()=>ML,useFilterOptions:()=>ak.uw,useFilteredMetaTree:()=>ea.a7,useGlobalTheme:()=>et,useLayoutRoutePage:()=>rL,useMobileLayout:()=>My,usePlugin:()=>no.n,useRoleRecheck:()=>ne.N5,useRouter:()=>na,useSystemSettings:()=>es.e,useUIConfigurationPermissions:()=>ne.uM,validation:()=>x$}),l(70571);var w=l(50467),S=l(33329),M=l(65606);function A(e){let t=Math.floor(Math.abs(e)),l=Math.abs(e%1*60),n=String(t).padStart(2,"0"),r=String(l).padStart(2,"0"),i=e>=0?"+":"-";return`${i}${n}:${r}`}function F(){return A(-(new Date().getTimezoneOffset()/60))}class k extends S.Q9{getHostname(){var e,t;if(M.env.API_BASE_URL)try{return new URL(M.env.API_BASE_URL).hostname}catch{}return null==(t=window)||null==(e=t.location)?void 0:e.hostname}getHeaders(){let e=super.getHeaders();return this.appName&&(e["X-App"]=this.appName),e["X-Timezone"]=F(),e["X-Hostname"]=this.getHostname(),e}interceptors(){this.axios.interceptors.request.use(e=>{let t=this.getHeaders();return Object.keys(t).forEach(l=>{(0,S.bO)(e.headers,l)||(e.headers[l]=t[l])}),e}),super.interceptors()}constructor(e){super(e),(0,w._)(this,"appName",void 0),e&&"function"!=typeof e&&(this.appName=e.appName)}}var C=l(58587),P=l(18150),j=l(68238),E=l(74848),R=l(95243),I=l(11869),T=l(40098),_=l.n(T),D=l(96540),N=l(5338),O=l(52230),$=l(47665),B=l(84976),L=l(47767),q=l(44363),V=l(36098),z=l(88040);let K=(0,D.memo)(e=>{let{children:t}=e,l=(0,V.n)(),{notification:n}=z.A.useApp();return(0,D.useLayoutEffect)(()=>{l.context.defineProperty("notification",{value:n})},[l,n]),(0,E.jsx)(E.Fragment,{children:t})});K.displayName="AppInner";let U=e=>{let{children:t,className:l,style:n}=e;return(0,E.jsx)(z.A,{className:l,style:{height:"100%",...n},children:(0,E.jsx)(K,{children:t})})};U.displayName="AntdAppProvider";let W=U;var H=l(35710),Y=l(4888);let G={name:"",token:{colorPrimaryHeader:"#001529",colorBgHeader:"#001529",colorBgHeaderMenuHover:"#ffffff1a",colorBgHeaderMenuActive:"#ffffff1a",colorTextHeaderMenu:"#ffffffa6",colorTextHeaderMenuHover:"#ffffff",colorTextHeaderMenuActive:"#ffffff",colorSettings:"#F18B62",colorBgSettingsHover:"rgba(241, 139, 98, 0.06)",colorTemplateBgSettingsHover:"rgba(98, 200, 241, 0.06)",colorBorderSettingsHover:"rgba(241, 139, 98, 0.3)",motionUnit:.03}},J=function(e){var t;return(null==(t=e.token)?void 0:t.colorSettings)||(e.token={...e.token,...G.token}),e},X=(e,t)=>{var l,n,r,i,o,a,s,d,u,c,p,h;let m=t||H.A.defaultAlgorithm(e);return(l=m).paddingPageHorizontal??(l.paddingPageHorizontal=m.sizeLG),(n=m).paddingPageVertical??(n.paddingPageVertical=m.sizeLG),(r=m).paddingPopupHorizontal??(r.paddingPopupHorizontal=m.sizeLG),(i=m).paddingPopupVertical??(i.paddingPopupVertical=m.size),(o=m).marginBlock??(o.marginBlock=m.sizeLG),(a=m).borderRadiusBlock??(a.borderRadiusBlock=m.borderRadiusLG),(s=m).colorBgSider??(s.colorBgSider=m.colorBgElevated),(d=m).colorBgSiderMenuHover??(d.colorBgSiderMenuHover=m.colorBgTextHover||m.colorFillSecondary),(u=m).colorBgSiderMenuActive??(u.colorBgSiderMenuActive=m.colorPrimaryBg),(c=m).colorTextSiderMenu??(c.colorTextSiderMenu=m.colorText),(p=m).colorTextSiderMenuHover??(p.colorTextSiderMenuHover=m.colorText),(h=m).colorTextSiderMenuActive??(h.colorTextSiderMenuActive=m.colorPrimary),m},Q=e=>(Array.isArray(e.algorithm)?e.algorithm.includes(X)||e.algorithm.push(X):e.algorithm=[e.algorithm,X].filter(Boolean),e.algorithm=e.algorithm.filter(Boolean),e);var Z=l(22803);(0,Z.injectGlobal)`
|
|
3
3
|
.ant-form-item-label > label {
|
|
4
4
|
font-weight: 600;
|
|
@@ -478,7 +478,7 @@ if (!ctx.record) {
|
|
|
478
478
|
flex-shrink: 0;
|
|
479
479
|
flex: 1;
|
|
480
480
|
}
|
|
481
|
-
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":ag.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class uT extends sB.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),(0,w._)(this,"expandFlag",void 0),(0,w._)(this,"defaultProps",{type:"default",icon:"DownOutlined"})}}function u_(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];function r(e){if(Array.isArray(e))for(let i of e){let e=i[l];n.push(i[t]),Array.isArray(e)&&e.length>0&&r(e)}}return r(e),n}(0,w._)(uT,"scene",sB.s5.collection);let uD=e=>u_(e);uT.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),uT.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let n=e.blockModel.resource,{treeTable:r}=e.blockModel.props;if(r)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=uD(n.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),uT.define({label:(0,I.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class uN extends dK{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),(0,w._)(this,"defaultProps",{type:"link",title:(0,I.tExpr)("Add child"),icon:"PlusOutlined"})}}(0,w._)(uN,"capabilityActionName",null),uN.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),uN.define({label:(0,I.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),s$.registerActionModels({AddChildActionModel:uN});var uO=l(89013),u$=l(96491);class uB extends u$.F4{useHooksBeforeRender(){let[e]=uO.A.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,I.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,I.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new s8(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(I.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:n,labelWrap:r,layout:i}=this.props;return(0,E.jsx)(u$.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:n,labelWrap:r,layout:i},children:(0,E.jsx)(I.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,n]=e;l.addOrEnsureItem(t,n)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}uB.define({label:(0,I.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class uL extends dc{renderAddSubModelButton(){return(0,E.jsx)(I.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightModel,r=this.context.themeToken,i=super.render();return"defaultHeight"===n?i:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${r.marginLG}px`,marginRight:`-${r.marginLG}px`,paddingLeft:`${r.marginLG}px`,paddingRight:`${r.marginLG}px`,paddingTop:5},children:i})}constructor(...e){super(...e),(0,w._)(this,"itemFallback",(0,E.jsx)(r1.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}})),(0,w._)(this,"itemSettingsMenuLevel",2),(0,w._)(this,"itemFlowSettings",{showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}}),(0,w._)(this,"dragOverlayConfig",{columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}})}}uL.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});let uq=2;class uV extends uL{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,n=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],r=this.context.prefixFieldPath?this.context.prefixFieldPath.split(".").filter(Boolean).length:0,i="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,o=null==l?void 0:l.filterTargetKey,a=e=>!!e&&!!(i&&e===i||"string"==typeof o&&e===o||Array.isArray(o)&&o.includes(e)),s=n.filter(e=>!a(null==e?void 0:e.name)).filter(e=>{var t;return r<uq||!((null==e||null==(t=e.isAssociationField)?void 0:t.call(e))||(null==e?void 0:e.target)||(null==e?void 0:e.targetCollection))}).map(e=>{let t=e.name,n=e.title||e.name,r=I.EditableItemModel.getDefaultBindingByField(this.context,e);if(!r)return;let i=r.modelName;return{key:t,label:n,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:i,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,E.jsx)(I.AddSubModelButton,{subModelKey:"items",model:this,items:s,keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,n,r;let i=null==(l=this.context)?void 0:l.collection,o=((null==(n=this.subModels)?void 0:n.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(o){"function"==typeof(null==o?void 0:o.setStepParams)&&o.setStepParams("fieldSettings","assignValue",{value:t}),o.assignValue=t;return}let a=((null==i||null==(r=i.getFields)?void 0:r.call(i))||[]).find(t=>t.name===e),s=I.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.addSubModel("items",{use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e}}}}}}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}uV.define({label:(0,I.tExpr)("Assign grid")});var uz=l(44329);function uK(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function uU(e){var t,l;let n=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof n?n:void 0}async function uW(e){var t,l,n;let{parentModel:r,targetUse:i,defaultProps:o,pattern:a,fieldSettingsInit:s}=e,d=r.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=uK(uU(d)||(null==d?void 0:d.use))===i&&(null==d?void 0:d.stepParams)||{},h=s??(null==(n=r.getFieldSettingsInitParams)?void 0:n.call(r)),{fieldBinding:m,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:h}},v=r.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),v.removeModelWithSubModels(u));let y=r.setSubModel("field",{uid:u,use:i,props:{...o||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await y.dispatchEvent("beforeRender",void 0,{useCache:!1}),await r.save()}var uH=l(13940);function uY(e,t,l){let n=(0,T.castArray)(l).filter(e=>"string"==typeof e),r=t.split(".");if(null==n?void 0:n.length){let t=[],l=0,i=0;for(;l<r.length;){let e=r[l];if(t.push(e),i<n.length){let[l,r]=n[i].split(":");l===e&&(t.push(Number(r)),i++)}l++}return(0,T.get)(e,t)}return(0,T.get)(e,r)}function uG(e){let{record:t,currentObject:l,fieldPath:n,prefixFieldPath:r,idx:i}=e,o=uY(t,n,i);if(void 0!==o||null==l)return o;if(r&&n===r)return l;let a=r&&n.startsWith(`${r}.`)?n.slice(r.length+1):n;return a?(0,T.get)(l,a):l}function uJ(e,t){return!(0,uH.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class uX extends I.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let n=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!n)return null;let r=n.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===i},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:r,props:"function"==typeof n.defaultProps?n.defaultProps(e,l):n.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,n=this.context.currentObject,r=this.context.item,i=this.context.getPropertyOptions("item"),o=this.context.prefixFieldPath,a=null!=t?(()=>{let o=e.createFork({},`${t}`);o.context.defineProperty("fieldIndex",{get:()=>t}),o.context.defineProperty("record",{get:()=>l,cache:!1}),o.context.defineProperty("currentObject",{get:()=>n,cache:!1});let{value:a,...s}=i||{};return o.context.defineProperty("item",{...s,get:()=>r,cache:!1}),this.context.pattern&&o.context.defineProperty("pattern",{get:()=>this.context.pattern}),o})():e,s=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},d=uJ(this.collectionField,uG({record:l,currentObject:n,fieldPath:this.fieldPath,prefixFieldPath:o,idx:t}));return(0,E.jsx)(I.FormItem,{...s,value:d,children:(0,E.jsx)(I.FieldModelRenderer,{model:a})})}}uX.define({label:(0,I.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:100}),uX.registerFlow({key:"detailItemSettings",sort:300,title:(0,I.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,n)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,I.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,I.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var n,r;e.model.setProps({titleField:t.label,...null==(r=e.collectionField.targetCollection)||null==(n=r.getField(t.label))?void 0:n.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),i=I.DisplayItemModel.getDefaultBindingByField(e,l),o=i.modelName;await uW({parentModel:e.model,targetUse:o,defaultProps:"function"==typeof(null==i?void 0:i.defaultProps)?i.defaultProps(e,e.collectionField):null==i?void 0:i.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,n;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(l=n.getField(t.label))?void 0:l.getComponentProps()});let r=e.collectionField.targetCollection;if(r){let l=r.getField(t.label),n=I.DisplayItemModel.getDefaultBindingByField(e,l).modelName;n!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:n})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),uX.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var uQ=l(71616);function uZ(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function u0(e,t){var l;let n=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),r=uZ(e);return n&&!r&&Array.isArray(t)?t.length?t[0]:void 0:t}function u1(e,t){if(!(null==t?void 0:t.length))return e;let[l,n]=String(t[t.length-1]).split(":"),r=Number(n);if(!l||!Number.isFinite(r))return e;let i=0;for(let e of t){let[t]=String(e).split(":");t===l&&(i+=1)}let o=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===i){o=t;break}if(-1===o){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){o=t;break}}return -1===o?e:[r,...e.slice(o+1)]}let u2=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"],u5=2;class u4 extends I.EditableItemModel{static defineChildren(e){let t=e.collection,l=e.prefixFieldPath?e.prefixFieldPath.split(".").filter(Boolean).length:0;return t.getFields().map(n=>{var r;if(l>=u5&&((null==(r=n.isAssociationField)?void 0:r.call(n))||n.target||n.targetCollection))return;let i=this.getDefaultBindingByField(e,n);if(!i)return;let o=i.modelName,a=e.prefixFieldPath?`${e.prefixFieldPath}.${n.name}`:n.name;return{key:a,label:n.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,uH.pX)(e).some(e=>e===a),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:a}}},subModels:{field:{use:o,props:"function"==typeof i.defaultProps?i.defaultProps(e,n):i.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({..._().pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,n=this.context.fieldIndex,r=this.context.fieldKey,i=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],o=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=n||o?(()=>{let e=o?`${this.uid}:config-visible`:`${r}`,t=l.createFork({},e);if(null!=n){t.context.defineProperty("fieldIndex",{get:()=>n}),t.context.defineProperty("fieldKey",{get:()=>r}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...n}=e||{};t.context.defineProperty("item",{...n,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),o&&t.setProps({hidden:!1}),t})():l,{initialValue:s,hidden:d,...u}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,c=o?u:{hidden:d,...u},p=u1(this.props.name,n);this.context.defineProperty("fieldPathArray",{get:()=>[...i,..._().castArray(p)],cache:!1});let h=(null==(t=this.context.item)?void 0:t.value)||this.context.record,m=(0,E.jsx)(I.FormItem,{...c,name:p,validateFirst:!0,disabled:this.props.disabled||!_().isEmpty(h)&&!h.__is_new__&&this.props.aclDisabled||!_().isEmpty(h)&&h.__is_new__&&this.props.aclCreateDisabled,children:(0,E.jsx)(I.FieldModelRenderer,{model:a,name:p})});return o?(0,E.jsx)(tF.A,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,E.jsx)("div",{style:{opacity:.3},children:m})}):m}}u4.define({label:(0,I.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:100}),u4.registerFlow({key:"editItemSettings",sort:300,title:(0,I.tExpr)("Form item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,n)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,n,r,i,o,a,s,d,u,c,p,h,m;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(n=e.collectionField)?void 0:n.collectionName,fields:[null==(r=e.collectionField)?void 0:r.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(i=e.dataSource)?void 0:i.key,resourceName:null==(o=e.collectionField)?void 0:o.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(h=e.collectionField)?void 0:h.collectionName,fields:[e.collectionField.name],actionName:"update"}),n=(null==(m=e.item)?void 0:m.__is_stored__)??!1;g||n||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,I.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,n,r;if(e.model.parent.parent instanceof uQ.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let i=null==(n=e.model.collectionField)?void 0:n.interface;if(null==u2||null==(r=u2.includes)||!r.call(u2,i))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,uz.d_)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,n;let r=null==(l=e.model.collectionField)?void 0:l.interface;if(null==u2||null==(n=u2.includes)?void 0:n.call(u2,r))return;let i=u0(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:i})}},validation:{title:(0,I.tExpr)("Validation"),use:"validation"},required:{title:(0,I.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,I.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,n;return{titleField:e.model.props.titleField||(null==(n=e.model)||null==(l=n.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let n=t.titleField||t.label;if(n!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(n),r=uX.getDefaultBindingByField(e,l);if(r.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let i=e.model.setSubModel("field",{use:r.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:n}}}});await i.save()}e.model.setProps(e.collectionField.targetCollection.getField(n).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),u4.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u8=l(85352),u3=l(90199),u6=l(97510);function u9(e,t){var l,n,r;let i=null==e||null==(l=e.props)?void 0:l.fieldNames,o=null==e||null==(n=e.props)?void 0:n.titleField,a=null==e||null==(r=e.getStepParams)?void 0:r.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==i?{fieldNames:i}:{},...void 0!==o?{titleField:o}:{}}}}function u7(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function ce(e){var t,l,n;let r=null==e||null==(t=e.props)?void 0:t.fieldNames,i=null==e||null==(l=e.props)?void 0:l.titleField,o=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",u7(r),u7(i),u7(o)].join("|")}function ct(e){if(!e||"object"!=typeof e||!("target"in e))return e;let t=e.target;return t&&"value"in t?t.value:e}class cl extends u4{onInit(e){var t,l,n,r,i,o,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},n=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,r=null==(e=this.context)?void 0:e.dataSourceManager;return null==r||null==(t=r.getCollectionField)?void 0:t.call(r,n)}});let d=this.context,u=null==d?void 0:d.collection,c=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==u?void 0:u.getFields)){let e=(u.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==c?void 0:c.fieldPath));null==u||null==(r=u.getField)||r.call(u,null==c?void 0:c.fieldPath);let t=I.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(o=d.engine)||null==(i=o.createModel)||i.call(o,{use:l,stepParams:{fieldSettings:{init:c}},parentId:this.uid,subKey:"field"})}let p=null==(n=this.context)?void 0:n.collection,h=this.fieldPath;if(h){let e=null==p||null==(a=p.getField)?void 0:a.call(p,h),t=(null==e?void 0:e.title)||h,l=h.includes(".")?h.split("."):[h];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,n=l.collection,r=this.fieldInit,i=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),o=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,s=ce(a),d=()=>{var e,t,s,d,u;let[c,p]=D.useState(null);D.useEffect(()=>{var e,t,i,s,d,u,c,h,m,f,g,v,y,b,x,w,S,M,A,F,k;if(!o)return;let C=((null==n||null==(e=n.getFields)?void 0:e.call(n))||[]).find(e=>(null==e?void 0:e.name)===o);n.getField(o);let P=I.EditableItemModel.getDefaultBindingByField(l,C);if(!P)return;let j=P.modelName,E=u9(a,r),R=null==l||null==(i=l.engine)||null==(t=i.createModel)?void 0:t.call(i,{use:"VariableFieldFormModel",subModels:{fields:[{use:j,...E}]}});if(!R)return;null==(d=R.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:n});let T=null==l?void 0:l.dataSource;T&&(null==(c=R.context)||null==(u=c.defineProperty)||u.call(c,"dataSource",{value:T}));let _=null==n||null==(h=n.getField)?void 0:h.call(n,null==r?void 0:r.fieldPath);_&&(null==(f=R.context)||null==(m=f.defineProperty)||m.call(f,"collectionField",{value:_}));let D=null==l?void 0:l.blockModel;D&&(null==(v=R.context)||null==(g=v.defineProperty)||g.call(v,"blockModel",{value:D}));let N=l.form;N&&(null==(F=R.context)||null==(A=F.defineProperty)||A.call(F,"form",{value:N})),R.context&&Object.defineProperty(R.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==D?void 0:D.resource});let O=null==R||null==(b=R.subModels)||null==(y=b.fields)?void 0:y[0],$=null==n||null==(x=n.getField)?void 0:x.call(n,null==r?void 0:r.fieldPath),B=null==$?void 0:$.type,L=null==$?void 0:$.interface,q="belongsToMany"===B||"hasMany"===B||"belongsToArray"===B||"m2m"===L||"o2m"===L||"mbm"===L;if(null==O||null==(w=O.setProps)||w.call(O,{disabled:!1,readPretty:!1,updateAssociation:!1,multiple:q}),null==O||null==(S=O.dispatchEvent)||S.call(O,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,u8.NI)(O,$),!(null==O||null==(M=O.props)?void 0:M.fieldNames)&&(null==$?void 0:$.targetCollection)){let e=$.targetCollection,t=(null==$?void 0:$.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==O||null==(k=O.setProps)||k.call(O,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return p(R),()=>{var e,t,l,n;null==R||null==(l=R.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==R||null==(n=R.remove)||n.call(R)}},[]);let h=e=>(D.useEffect(()=>{var t,l,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let r=null==c||null==(n=c.subModels)||null==(l=n.fields)?void 0:l[0];if(r){var i,o=this;null==(i=r.setProps)||i.call(r,{value:null==e?void 0:e.value,onChange:function(){for(var t,l,n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];let s=ct(i&&i.length?i[0]:void 0);null==(t=r.setProps)||t.call(r,{value:s}),o.assignValue=s,null==e||null==(l=e.onChange)||l.call(e,s)}})}},[e]),c?(0,E.jsx)("div",{style:{width:"100%"},children:(0,E.jsx)(I.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),m=()=>{var e,t;return(0,E.jsx)(dn.A,{placeholder:`<${(null==(e=(t=this.context).t)?void 0:e.call(t,"Null"))??"Null"}>`,readOnly:!0,style:{width:"100%"}})},f=e=>(0,E.jsx)(u3.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),g=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree;return"function"==typeof t?await t():[]},v=null==n||null==(e=n.getField)?void 0:e.call(n,this.fieldPath),y=(0,u6.kB)(v),b=(0,u6.Ot)(v,null==(t=this.fieldPath)?void 0:t.split(".").slice(-1)[0]),x=b?(0,u6.cd)(v,y):u6.tS,w=(null==(s=this.props)?void 0:s.label)??this.fieldPath??"",S=null==n||null==(d=n.getField)?void 0:d.call(n,this.fieldPath);return w=(null==(u=this.props)?void 0:u.label)??(null==S?void 0:S.title)??w,(0,E.jsx)(I.FormItem,{...this.props,label:w,name:i,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:D.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,E.jsx)(u6.Wm,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},baseMetaTree:g,constantComponent:h,nullComponent:m,runJSComponent:f,isDateLikeField:b,dateComponentProps:x,clearValue:""})})})};return(0,E.jsx)(d,{},s)}constructor(e){super(e),(0,w._)(this,"assignValue",void 0),(0,R.define)(this,{assignValue:R.observable})}}cl.define({label:(0,I.tExpr)("Assign field")}),cl.registerFlow({key:"editItemSettings",sort:300,title:(0,I.tExpr)("Form item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,n=l.includes(".")?l.split("."):l;e.model.setProps({name:n})}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,I.tExpr)("Validation"),use:"validation"},required:{title:(0,I.tExpr)("Required"),use:"required"}}});class cn extends sL{}(0,w._)(cn,"itemModelName","DetailsItemModel"),cn.define({label:'{{t("Display association fields")}}'});var cr=l(58929);let ci=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,r=parseFloat(l.marginBottom)||0;return t.height+n+r},co=e=>{let{heightMode:t,containerRef:l,actionsRef:n,paginationRef:r,deps:i=[]}=e,[o,a]=(0,D.useState)(),s=(0,D.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let o=Math.max(0,Math.floor(i-ci(n.current)-ci(r.current)));a(e=>e===o?e:o)},[t,l,n,r]);return(0,D.useLayoutEffect)(()=>{s()},[s,...i]),(0,D.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=n.current,i=r.current,o=new ResizeObserver(()=>s());return o.observe(e),t&&o.observe(t),i&&o.observe(i),()=>o.disconnect()},[s,l,n,r,...i]),o};class ca extends dx.t{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(I.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(I.MultiRecordResource);return r.setPageSize(1),r}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let n=(0,I.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,I.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:n}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,ub.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,ub.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof I.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,E.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,E.jsx)("div",{style:{textAlign:"center"},children:(0,E.jsx)(cr.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,E.jsx)(I.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:r}=this.props,i=!!this.context.flowSettingsEnabled,o=!i&&!this.hasAvailableData(),{heightMode:a,height:s}=this.decoratorProps;return(0,E.jsx)(cs,{model:this,gridModel:this.subModels.grid,isConfigMode:i,heightMode:a,height:s,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:r},actions:(0,E.jsx)(I.DndProvider,{children:(0,E.jsx)("div",{style:o?{pointerEvents:"none",opacity:.45}:void 0,children:(0,E.jsxs)(s3.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||i)return(0,E.jsx)(I.Droppable,{model:e,children:(0,E.jsx)(I.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:I.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),(0,w._)(this,"hadSingleRecordData",!1),(0,w._)(this,"hasMultiRefreshDispatched",!1),(0,w._)(this,"_defaultCustomModelClasses",{RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"}),(0,w._)(this,"customModelClasses",{}),(0,w._)(this,"handlePageChange",async e=>{if(this.resource instanceof I.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}})}}(0,w._)(ca,"scene",dy.P.oam);let cs=e=>{let{model:t,gridModel:l,isConfigMode:n,heightMode:r,height:i,layoutProps:o,actions:a}=e,s=(0,D.useRef)(null),d=(0,D.useRef)(null),u=(0,D.useRef)(null),c="specifyValue"===r||"fullHeight"===r,p=co({heightMode:r,containerRef:s,actionsRef:d,paginationRef:u,deps:[i]});(0,D.useEffect)(()=>{var e,t;if(!l)return;let n=c?p:void 0;((null==(e=l.props)?void 0:e.height)!==n||(null==(t=l.props)?void 0:t.heightMode)!==r)&&l.setProps({height:n,heightMode:r})},[l,p,c,r]);let h=c?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,m=c?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,E.jsx)(u$.s2,{model:t,layoutProps:o,style:h,children:(0,E.jsxs)("div",{ref:s,style:m,children:[(0,E.jsx)("div",{ref:d,style:{textAlign:"right",lineHeight:"0px",paddingBottom:n&&t.context.themeToken.padding},children:a}),(0,E.jsx)(I.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${n?"design":"runtime"}`),(0,E.jsx)("div",{ref:u,children:t.renderPagination()})]})})};ca.registerFlow({key:"detailsSettings",title:(0,I.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,I.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,I.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),ca.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),ca.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),n="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!n&&await (0,ub.Xi)(e.model,"paginationChange")}}}}),ca.define({label:(0,I.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class cd extends I.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),n=t=>Array.from(t.entries()).map(t=>{var l,n,r,i,o;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(n=s.meta)?void 0:n.searchable),searchPlaceholder:null==(r=s.meta)?void 0:r.searchPlaceholder,hide:null==(i=s.meta)?void 0:i.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(o=s.meta)?void 0:o.createModelOptions)||{use:a},u});return _().sortBy([...n(t),...n(l)],"sort")}}(0,w._)(cd,"renderMode",I.ModelRenderMode.RenderFunction),cd.define({hide:!0,label:(0,I.tExpr)("Others")});class cu extends dc{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,E.jsx)(I.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightMode,r=this.context.themeToken,i=super.render();return"defaultHeight"===n?i:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${r.marginLG}px`,marginRight:`-${r.marginLG}px`,paddingLeft:`${r.marginLG}px`,paddingRight:`${r.marginLG}px`},children:i})}constructor(...e){super(...e),(0,w._)(this,"itemFallback",(0,E.jsx)(r1.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}})),(0,w._)(this,"itemSettingsMenuLevel",2),(0,w._)(this,"itemFlowSettings",{showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}}),(0,w._)(this,"dragOverlayConfig",{columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}})}}function cc(e,t){let{fieldUseModel:l,refreshTargets:n}=t,r=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>r(await e(t))}else Array.isArray(t.children)&&(t.children=r(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,n)=>{let r=await ("function"==typeof e?e(t,n):e);return r.subModels=r.subModels||{},r.subModels.field={...r.subModels.field||{},use:l},r},t.refreshTargets=t.refreshTargets||n}return t}):[];return r(e)}function cp(e,t,l){let{fieldUseModel:n,refreshTargets:r}=l,i=l.key??"js-association-fields",o=l.label??(0,I.tExpr)("Display association fields");return{key:i,type:"group",label:o,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,I.tExpr)("Search fields"),children:async e=>cc(await t(e),{fieldUseModel:n,refreshTargets:r})}}cu.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class ch extends sL{}async function cm(e,t){var l;let{useModel:n,fieldUseModel:r,refreshTargets:i,associationPathName:o,associationProvider:a}=t,s=(0,I.buildWrapperFieldChildren)(e,{useModel:n,fieldUseModel:r,associationPathName:o,refreshTargets:i}),d=[],u=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(u)&&(d=u),!a)return d;let c=await a(e);return Array.isArray(c)&&0!==c.length?[...d,cp(e,a,{fieldUseModel:r,refreshTargets:i})]:d}(0,w._)(ch,"itemModelName","FormItemModel");class cf extends cd{static defineChildren(e){return cm(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>cn.defineChildren(e)})}}cf.define({label:(0,I.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:110});class cg extends aC.o{}var cv=l(85196);class cy extends aC.o{constructor(...e){super(...e),(0,w._)(this,"operator","$eq"),(0,w._)(this,"updateAssociation",!1)}}cy.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,n;let t=e.model.context.blockModel,r=null==t||null==(l=t.context)?void 0:l.resource,i=null==(n=e.model.parent)?void 0:n.fieldPath;r&&i&&r.addUpdateAssociationValues(i)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let cb=(e,t)=>e===t,cx=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function cw(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function cS(e,t){var l;let n="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,r=cw(null==t?void 0:t.filterTargetKey)||"id",i="string"==typeof(null==e?void 0:e.value)&&e.value&&!cb(e.value,"value")?e.value:void 0,o="string"==typeof(null==e?void 0:e.label)&&e.label&&!cb(e.label,"label")?e.label:void 0,a=i||r;return{label:o||n||a,value:a}}function cM(e){var t,l,n,r,i,o;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let h=null==(r=e.view)||null==(n=r.inputArgs)?void 0:n.viewUid,m=null==(o=e.model.context)||null==(i=o.inputArgs)?void 0:i.viewUid;return[...p,"string"==typeof h&&h?h:"string"==typeof m&&m?m:e.model.uid].filter(Boolean)}function cA(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function cF(e){var t,l,n;let{option:r,fieldNames:i}=e,o=(0,I.useFlowModel)(),a=cx(r),s=cS(i,null==(t=o.context.collectionField)?void 0:t.targetCollection),d=o.subModels.field,u=cA(null==a?void 0:a[s.label])??cA(null==a?void 0:a.label)??cA(null==a?void 0:a[s.value]);if(!d)return(0,E.jsx)("span",{children:u??"N/A"});let c=String((null==a?void 0:a[s.value])??u??"association-option"),p=d.createFork({},c);p.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,I.createCurrentRecordMetaFactory)(p.context,()=>p.context.collection)});let h=null==(n=o.context.collectionField.targetCollection)||null==(l=n.getField)?void 0:l.call(n,s.label),m=h&&"function"==typeof h.getComponentProps?h.getComponentProps():{};p.setProps({value:u,clickToOpen:!1,...m});let f=null!=u&&""!==u?p.render():"N/A";return(0,E.jsx)("span",{style:{pointerEvents:"none"},children:f})}function ck(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:i}=t||{},o=e=>"object"==typeof e&&null!==e,a=e=>{if(o(e))return{label:(0,E.jsx)(cF,{option:e,fieldNames:t}),value:e[i]}};if("value"===n){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=r.find(t=>(null==t?void 0:t[i])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(o).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return o(t)?a(t):void 0}return o(e)?a(e):void 0}function cC(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,T.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}var cP=l(77577);let cj="calc(12px + env(safe-area-inset-bottom, 0px))",cE={paddingBottom:cj};function cR(e){return{maxHeight:"60vh",overflowY:"auto",paddingBottom:e?void 0:cj}}let cI=(0,Z.css)`
|
|
481
|
+
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":ag.n,"x-component-props":{rows:1}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":t("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}}}},handler(e,t){e.model.setProps({url:t.url,searchParams:t.searchParams,openInNewWindow:t.openInNewWindow})}}}});class uT extends sB.S0{setTitle(e){this.setProps({title:e})}setExpandFlag(e){this.expandFlag=e}getTitle(){return this.expandFlag?this.context.t("Collapse all"):this.context.t("Expand all")}getIcon(){return this.expandFlag?"NodeCollapseOutlined":"NodeExpandOutlined"}constructor(...e){super(...e),(0,w._)(this,"expandFlag",void 0),(0,w._)(this,"defaultProps",{type:"default",icon:"DownOutlined"})}}function u_(e){let{idKey:t="id",childrenKey:l="children"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];function r(e){if(Array.isArray(e))for(let i of e){let e=i[l];n.push(i[t]),Array.isArray(e)&&e.length>0&&r(e)}}return r(e),n}(0,w._)(uT,"scene",sB.s5.collection);let uD=e=>u_(e);uT.registerFlow({key:"expandCollapseSettingsInit",sort:200,steps:{init:{handler(e,t){e.blockModel.props.defaultExpandAllRows?e.model.setExpandFlag(!0):e.model.setExpandFlag(!1)}}}}),uT.registerFlow({key:"expandCollapseSettings",on:"click",steps:{expandCollapse:{async handler(e,t){var l;if(!(null==(l=e.blockModel)?void 0:l.resource))return;let n=e.blockModel.resource,{treeTable:r}=e.blockModel.props;if(r)if(e.model.expandFlag)e.blockModel.setProps({expandedRowKeys:[]}),e.model.setExpandFlag(!1);else{let t=uD(n.getData());e.blockModel.setProps({expandedRowKeys:t}),e.model.setExpandFlag(!0)}}}}}),uT.define({label:(0,I.escapeT)("Expand/Collapse"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.model.props.treeTable}});class uN extends dK{getAclActionName(){return"create"}onInit(e){super.onInit(e),this.context.defineProperty("association",{get:()=>this.context.blockModel.dataSource.getAssociation(`${this.context.blockModel.collection.name}.children`)})}constructor(...e){super(...e),(0,w._)(this,"defaultProps",{type:"link",title:(0,I.tExpr)("Add child"),icon:"PlusOutlined"})}}(0,w._)(uN,"capabilityActionName",null),uN.registerFlow({key:"addChildSettingsInit",steps:{addChildInit:{async handler(e,t){e.model.onClick=t=>{e.model.dispatchEvent("click",{event:t,...e.inputArgs,sourceId:e.record.id,filterByTk:null},{debounce:!0})}}}}}),uN.define({label:(0,I.tExpr)("Add child"),hide(e){var t;return(null==(t=e.collection)?void 0:t.template)!=="tree"||!1===e.blockModel.props.treeTable}}),s$.registerActionModels({AddChildActionModel:uN});var uO=l(89013),u$=l(96491);class uB extends u$.F4{useHooksBeforeRender(){let[e]=uO.A.useForm();this.context.defineProperty("form",{get:()=>e})}onInit(e){super.onInit(e);let t=(0,I.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)},cache:!1,resolveOnServer:(0,I.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>{var e,t;return null==(e=(t=this).getCurrentRecord)?void 0:e.call(t)}),meta:t}),this.context.defineProperty("filterManager",{once:!0,get:()=>new s8(this,null==e?void 0:e.filterManager)}),this.isManualRefresh=!0}createResource(e,t){let l=this.context.createResource(I.SingleRecordResource);return l.isNewRecord=!0,l}renderComponent(){var e;let{colon:t,labelAlign:l,labelWidth:n,labelWrap:r,layout:i}=this.props;return(0,E.jsx)(u$.s2,{model:this,layoutProps:{colon:t,labelAlign:l,labelWidth:n,labelWrap:r,layout:i},children:(0,E.jsx)(I.FlowModelRenderer,{model:null==(e=this.subModels)?void 0:e.grid,showFlowSettings:!1})})}setInitialAssignedValues(e){var t;let l=null==(t=this.subModels)?void 0:t.grid;Object.entries(e||{}).forEach(e=>{let[t,n]=e;l.addOrEnsureItem(t,n)})}getAssignedValues(){return this.subModels.grid.getAssignedValues()||{}}}uB.define({label:(0,I.tExpr)("Field assignments"),hide:!0,createModelOptions:{use:"AssignFormModel",subModels:{grid:{use:"AssignFormGridModel"}}}});class uL extends dc{serialize(){return{...super.serialize(),variableContractType:{type:"formGrid",use:this.use}}}renderAddSubModelButton(){return(0,E.jsx)(I.AddSubModelButton,{subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("FormItemModel"),this.context.getModelClassName("FormAssociationFieldGroupModel"),this.context.getModelClassName("FormCustomItemModel"),this.context.getModelClassName("FormJSFieldItemModel")].filter(Boolean),model:this,keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})})}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightModel,r=this.context.themeToken,i=super.render();return"defaultHeight"===n?i:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${r.marginLG}px`,marginRight:`-${r.marginLG}px`,paddingLeft:`${r.marginLG}px`,paddingRight:`${r.marginLG}px`,paddingTop:5},children:i})}constructor(...e){super(...e),(0,w._)(this,"itemFallback",(0,E.jsx)(r1.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}})),(0,w._)(this,"itemSettingsMenuLevel",2),(0,w._)(this,"itemFlowSettings",{showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}}),(0,w._)(this,"dragOverlayConfig",{columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}})}}uL.registerFlow({key:"formFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});let uq=2;class uV extends uL{renderAddSubModelButton(){var e,t;let l=null==(e=this.context)?void 0:e.collection,n=(null==l||null==(t=l.getFields)?void 0:t.call(l))||[],r=this.context.prefixFieldPath?this.context.prefixFieldPath.split(".").filter(Boolean).length:0,i="function"==typeof(null==l?void 0:l.getPrimaryKey)?l.getPrimaryKey():void 0,o=null==l?void 0:l.filterTargetKey,a=e=>!!e&&!!(i&&e===i||"string"==typeof o&&e===o||Array.isArray(o)&&o.includes(e)),s=n.filter(e=>!a(null==e?void 0:e.name)).filter(e=>{var t;return r<uq||!((null==e||null==(t=e.isAssociationField)?void 0:t.call(e))||(null==e?void 0:e.target)||(null==e?void 0:e.targetCollection))}).map(e=>{let t=e.name,n=e.title||e.name,r=I.EditableItemModel.getDefaultBindingByField(this.context,e);if(!r)return;let i=r.modelName;return{key:t,label:n,toggleable:e=>{let l=e.getStepParams("fieldSettings","init")||{};return(null==l?void 0:l.fieldPath)===t},useModel:"AssignFormItemModel",createModelOptions:()=>({use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}},subModels:{field:{use:i,stepParams:{fieldSettings:{init:{dataSourceKey:null==l?void 0:l.dataSourceKey,collectionName:null==l?void 0:l.name,fieldPath:t}}}}}})}}).filter(Boolean);return(0,E.jsx)(I.AddSubModelButton,{subModelKey:"items",model:this,items:s,keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})})}addOrEnsureItem(e,t){var l,n,r;let i=null==(l=this.context)?void 0:l.collection,o=((null==(n=this.subModels)?void 0:n.items)||[]).find(t=>{try{let l="function"==typeof(null==t?void 0:t.getStepParams)?t.getStepParams("fieldSettings","init"):null;return(null==l?void 0:l.fieldPath)===e}catch(e){return!1}});if(o){"function"==typeof(null==o?void 0:o.setStepParams)&&o.setStepParams("fieldSettings","assignValue",{value:t}),o.assignValue=t;return}let a=((null==i||null==(r=i.getFields)?void 0:r.call(i))||[]).find(t=>t.name===e),s=I.EditableItemModel.getDefaultBindingByField(this.context,a);if(!s)return;let d=s.modelName;this.addSubModel("items",{use:"AssignFormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e},assignValue:{value:t}}},subModels:{field:{use:d,stepParams:{fieldSettings:{init:{dataSourceKey:null==i?void 0:i.dataSourceKey,collectionName:null==i?void 0:i.name,fieldPath:e}}}}}}).assignValue=t}getAssignedValues(){var e;let t=(null==(e=this.subModels)?void 0:e.items)||[],l={};for(let e of t){let t="function"==typeof e.getAssignedEntry?e.getAssignedEntry():null;t&&Array.isArray(t)&&(l[t[0]]=t[1])}return l}}uV.define({label:(0,I.tExpr)("Assign grid")});var uz=l(44329);function uK(e){return"string"==typeof e?e:"function"==typeof e&&e.name?e.name:void 0}function uU(e){var t,l;let n=null==e||null==(l=e.stepParams)||null==(t=l.fieldBinding)?void 0:t.use;return"string"==typeof n?n:void 0}async function uW(e){var t,l,n;let{parentModel:r,targetUse:i,defaultProps:o,pattern:a,fieldSettingsInit:s}=e,d=r.subModels.field,u=null==d?void 0:d.uid,c=null==d||null==(l=d.serialize)||null==(t=l.call(d))?void 0:t.subModels;for(let e in c)!1===c[e].delegateToParent&&delete c[e];let p=uK(uU(d)||(null==d?void 0:d.use))===i&&(null==d?void 0:d.stepParams)||{},h=s??(null==(n=r.getFieldSettingsInitParams)?void 0:n.call(r)),{fieldBinding:m,...f}=p,g={...f,fieldSettings:{...f.fieldSettings||{},init:h}},v=r.flowEngine;u&&(null==d||d.invalidateFlowCache("beforeRender",!0),v.removeModelWithSubModels(u));let y=r.setSubModel("field",{uid:u,use:i,props:{...o||{},...a?{pattern:a}:{}},stepParams:g,subModels:c});await y.dispatchEvent("beforeRender",void 0,{useCache:!1}),await r.save()}var uH=l(13940);function uY(e,t,l){let n=(0,T.castArray)(l).filter(e=>"string"==typeof e),r=t.split(".");if(null==n?void 0:n.length){let t=[],l=0,i=0;for(;l<r.length;){let e=r[l];if(t.push(e),i<n.length){let[l,r]=n[i].split(":");l===e&&(t.push(Number(r)),i++)}l++}return(0,T.get)(e,t)}return(0,T.get)(e,r)}function uG(e){let{record:t,currentObject:l,fieldPath:n,prefixFieldPath:r,idx:i}=e,o=uY(t,n,i);if(void 0!==o||null==l)return o;if(r&&n===r)return l;let a=r&&n.startsWith(`${r}.`)?n.slice(r.length+1):n;return a?(0,T.get)(l,a):l}function uJ(e,t){return!(0,uH.E4)(e)||Array.isArray(t)?t:t&&"object"==typeof t&&Array.isArray(t.rows)?t.rows:null==t?[]:[t]}class uX extends I.DisplayItemModel{static defineChildren(e){let t=e.collection;return t.getFields().map(l=>{let n=this.getDefaultBindingByField(e,l,{fallbackToTargetTitleField:!0});if(!n)return null;let r=n.modelName,i=e.prefixFieldPath?`${e.prefixFieldPath}.${l.name}`:l.name;return{key:i,label:l.title,refreshTargets:["DetailsCustomItemModel/DetailsJSFieldItemModel"],toggleable:e=>{var t;return(null==(t=e.getStepParams("fieldSettings","init"))?void 0:t.fieldPath)===i},useModel:"DetailsItemModel",createModelOptions:()=>({use:"DetailsItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:i}}},subModels:{field:{use:r,props:"function"==typeof n.defaultProps?n.defaultProps(e,l):n.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.context.defineProperty("actionName",{get:()=>"view",cache:!1})}renderItem(){let e=this.subModels.field,t=this.context.fieldIndex,l=this.context.record,n=this.context.currentObject,r=this.context.item,i=this.context.getPropertyOptions("item"),o=this.context.prefixFieldPath,a=null!=t?(()=>{let o=e.createFork({},`${t}`);o.context.defineProperty("fieldIndex",{get:()=>t}),o.context.defineProperty("record",{get:()=>l,cache:!1}),o.context.defineProperty("currentObject",{get:()=>n,cache:!1});let{value:a,...s}=i||{};return o.context.defineProperty("item",{...s,get:()=>r,cache:!1}),this.context.pattern&&o.context.defineProperty("pattern",{get:()=>this.context.pattern}),o})():e,s=this.context.pattern?{...this.context.blockModel.props,...this.props,pattern:this.context.pattern,disabled:"readPretty"===this.context.pattern}:{...this.context.blockModel.props,...this.props},d=uJ(this.collectionField,uG({record:l,currentObject:n,fieldPath:this.fieldPath,prefixFieldPath:o,idx:t}));return(0,E.jsx)(I.FormItem,{...s,value:d,children:(0,E.jsx)(I.FieldModelRenderer,{model:a})})}}uX.define({label:(0,I.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:100}),uX.registerFlow({key:"detailItemSettings",sort:300,title:(0,I.tExpr)("Detail item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({title:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>{var t;return{title:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.title,n)})}},aclCheck:{use:"aclCheck"},init:{async handler(e){let{collectionField:t}=e.model;t&&e.model.setProps(t.getComponentProps())}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},model:{title:(0,I.tExpr)("Field component"),use:"displayFieldComponent"},fieldNames:{use:"titleField",title:(0,I.tExpr)("Title field"),beforeParamsSave:async(e,t,l)=>{if(!e.collectionField||!e.collectionField.isAssociationField())return null;if(t.label!==l.label){var n,r;e.model.setProps({titleField:t.label,...null==(r=e.collectionField.targetCollection)||null==(n=r.getField(t.label))?void 0:n.getComponentProps()});let l=e.collectionField.targetCollection.getField(t.label),i=I.DisplayItemModel.getDefaultBindingByField(e,l),o=i.modelName;await uW({parentModel:e.model,targetUse:o,defaultProps:"function"==typeof(null==i?void 0:i.defaultProps)?i.defaultProps(e,e.collectionField):null==i?void 0:i.defaultProps,pattern:e.model.getProps().pattern})}},async handler(e,t){var l,n;if(!e.collectionField||e.model.subModels.field.disableTitleField)return;e.model.setProps({titleField:t.label,...null==(n=e.collectionField.targetCollection)||null==(l=n.getField(t.label))?void 0:l.getComponentProps()});let r=e.collectionField.targetCollection;if(r){let l=r.getField(t.label),n=I.DisplayItemModel.getDefaultBindingByField(e,l).modelName;n!==e.model.subModels.field.use&&e.model.setStepParams(e.flowKey,"model",{use:n})}},hideInSettings:async e=>!e.collectionField||!e.collectionField.isAssociationField()||e.model.subModels.field.disableTitleField}}}),uX.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var uQ=l(71616);function uZ(e){if(!e)return!1;let t=null==e?void 0:e.type;return"belongsToMany"===t||"hasMany"===t||"belongsToArray"===t}function u0(e,t){var l;let n=!!(null==e||null==(l=e.isAssociationField)?void 0:l.call(e)),r=uZ(e);return n&&!r&&Array.isArray(t)?t.length?t[0]:void 0:t}function u1(e,t){if(!(null==t?void 0:t.length))return e;let[l,n]=String(t[t.length-1]).split(":"),r=Number(n);if(!l||!Number.isFinite(r))return e;let i=0;for(let e of t){let[t]=String(e).split(":");t===l&&(i+=1)}let o=-1,a=0;for(let t=0;t<e.length;t++)if(String(e[t])===l&&(a+=1)===i){o=t;break}if(-1===o){for(let t=e.length-1;t>=0;t--)if(String(e[t])===l){o=t;break}}return -1===o?e:[r,...e.slice(o+1)]}let u2=["o2o","oho","obo","o2m","attachment","expression","point","lineString","circle","polygon","sequence","formula"],u5=2;class u4 extends I.EditableItemModel{static defineChildren(e){let t=e.collection,l=e.prefixFieldPath?e.prefixFieldPath.split(".").filter(Boolean).length:0;return t.getFields().map(n=>{var r;if(l>=u5&&((null==(r=n.isAssociationField)?void 0:r.call(n))||n.target||n.targetCollection))return;let i=this.getDefaultBindingByField(e,n);if(!i)return;let o=i.modelName,a=e.prefixFieldPath?`${e.prefixFieldPath}.${n.name}`:n.name;return{key:a,label:n.title,refreshTargets:["FormJSFieldItemModel","FormItemModel/FormJSFieldItemModel"],toggleable:e=>(0,uH.pX)(e).some(e=>e===a),useModel:"FormItemModel",createModelOptions:()=>({use:"FormItemModel",stepParams:{fieldSettings:{init:{dataSourceKey:t.dataSourceKey,collectionName:e.model.context.blockModel.collection.name,fieldPath:a}}},subModels:{field:{use:o,props:"function"==typeof i.defaultProps?i.defaultProps(e,n):i.defaultProps}}})}}).filter(Boolean)}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{if(this.collectionField){let t=this.collectionField.getComponentProps();e.setProps(t),this.setProps({..._().pick(t,"rules")||{}})}})}renderItem(){var e,t;let l=this.subModels.field,n=this.context.fieldIndex,r=this.context.fieldKey,i=(null==(e=this.parent)?void 0:e.context.fieldPathArray)||[],o=!!this.context.flowSettingsEnabled&&!!this.props.hidden&&!this.hidden&&!this.forbidden,a=null!=n||o?(()=>{let e=o?`${this.uid}:config-visible`:`${r}`,t=l.createFork({},e);if(null!=n){t.context.defineProperty("fieldIndex",{get:()=>n}),t.context.defineProperty("fieldKey",{get:()=>r}),this.context.currentObject&&t.context.defineProperty("currentObject",{get:()=>this.context.currentObject});let e=this.context.getPropertyOptions("item");if(this.context.item){let{value:l,...n}=e||{};t.context.defineProperty("item",{...n,get:()=>this.context.item,cache:!1})}this.context.pattern&&t.context.defineProperty("pattern",{get:()=>this.context.pattern})}return t.context.defineProperty("fieldPathArray",{get:()=>this.context.fieldPathArray,cache:!1}),o&&t.setProps({hidden:!1}),t})():l,{initialValue:s,hidden:d,...u}=this.context.pattern?{...this.props,pattern:this.context.pattern}:this.props,c=o?u:{hidden:d,...u},p=u1(this.props.name,n);this.context.defineProperty("fieldPathArray",{get:()=>[...i,..._().castArray(p)],cache:!1});let h=(null==(t=this.context.item)?void 0:t.value)||this.context.record,m=(0,E.jsx)(I.FormItem,{...c,name:p,validateFirst:!0,disabled:this.props.disabled||!_().isEmpty(h)&&!h.__is_new__&&this.props.aclDisabled||!_().isEmpty(h)&&h.__is_new__&&this.props.aclCreateDisabled,children:(0,E.jsx)(I.FieldModelRenderer,{model:a,name:p})});return o?(0,E.jsx)(tF.A,{title:this.context.t("The field is hidden and only visible when the UI Editor is active"),children:(0,E.jsx)("div",{style:{opacity:.3},children:m})}):m}}u4.define({label:(0,I.tExpr)("Display fields"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:100}),u4.registerFlow({key:"editItemSettings",sort:300,title:(0,I.tExpr)("Form item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>{var t;return{label:null==(t=e.collectionField)?void 0:t.title}},handler(e,t){var l;let n={ns:"lm-flow-engine",compareWith:null==(l=e.collectionField)?void 0:l.title};e.model.setProps({label:e.t(t.label,n)})}},aclCheck:{use:"aclCheck",async handler(e,t){var l,n,r,i,o,a,s,d,u,c,p,h,m;if(!e.collectionField||!e.blockModel)return;let f=e.blockModel.context.actionName,g=await e.aclCheck({dataSourceKey:null==(l=e.dataSource)?void 0:l.key,resourceName:null==(n=e.collectionField)?void 0:n.collectionName,fields:[null==(r=e.collectionField)?void 0:r.name],actionName:f});if("update"===f){let t=await e.aclCheck({dataSourceKey:null==(i=e.dataSource)?void 0:i.key,resourceName:null==(o=e.collectionField)?void 0:o.collectionName,fields:[e.collectionField.name],actionName:"view"});e.prefixFieldPath&&e.item&&(await e.aclCheck({dataSourceKey:null==(s=e.dataSource)?void 0:s.key,resourceName:null==(d=e.collectionField)?void 0:d.collectionName,fields:[e.collectionField.name],actionName:"create"})||e.model.setProps({aclCreateDisabled:!0}));let l=(null==(a=e.item)?void 0:a.__is_new__)??!1;t||l||(e.model.hidden=!0,e.model.forbidden={actionName:"view"},e.exitAll()),g||e.model.setProps({aclDisabled:!0})}else if("create"===f){let t=await e.aclCheck({dataSourceKey:null==(u=e.dataSource)?void 0:u.key,resourceName:null==(c=e.collectionField)?void 0:c.collectionName,actionName:"update"}),l=await e.aclCheck({dataSourceKey:null==(p=e.dataSource)?void 0:p.key,resourceName:null==(h=e.collectionField)?void 0:h.collectionName,fields:[e.collectionField.name],actionName:"update"}),n=(null==(m=e.item)?void 0:m.__is_stored__)??!1;g||n||(e.model.hidden=!0,e.model.forbidden={actionName:f},e.exitAll()),t&&l||e.model.setProps({aclDisabled:!0})}}},init:{async handler(e){let t=e.model.fieldPath,l=t.includes(".")?t.split("."):t;e.model.setProps({name:l})}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem","x-component-props":{autoSize:!0}}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},initialValue:{title:(0,I.tExpr)("Default value"),disabledInSettings:!0,disabledReasonInSettings:e=>`${e.t("This setting has been moved to")}: ${e.t("Form block settings")} > ${e.t("Field values")}`,uiSchema:e=>{var t,l,n,r;if(e.model.parent.parent instanceof uQ.EditFormModel||(null==(l=e.model.subModels)||null==(t=l.field)?void 0:t.updateAssociation))return;let i=null==(n=e.model.collectionField)?void 0:n.interface;if(null==u2||null==(r=u2.includes)||!r.call(u2,i))return{defaultValue:{"x-component":"DefaultValue","x-decorator":"FormItem"}}},defaultParams:e=>{let t=e.model.collectionField;if("nanoid"===t.interface&&!1!==t.options.autoFill){let{size:e,customAlphabet:l}=t.options||{size:21};return{defaultValue:(0,uz.d_)(l,e)()}}return{defaultValue:t.defaultValue}},handler(e,t){var l,n;let r=null==(l=e.model.collectionField)?void 0:l.interface;if(null==u2||null==(n=u2.includes)?void 0:n.call(u2,r))return;let i=u0(e.model.collectionField,t.defaultValue);e.model.setProps({initialValue:i})}},validation:{title:(0,I.tExpr)("Validation"),use:"validation"},required:{title:(0,I.tExpr)("Required"),use:"required"},model:{use:"fieldComponent",title:(0,I.tExpr)("Field component")},pattern:{use:"pattern"},titleField:{use:"titleField",hideInSettings:e=>!(e.collectionField&&e.collectionField.isAssociationField()&&e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern),defaultParams:e=>{var t,l,n;return{titleField:e.model.props.titleField||(null==(n=e.model)||null==(l=n.context)||null==(t=l.collectionField)?void 0:t.targetCollectionTitleFieldName)}},beforeParamsSave:async(e,t,l)=>{if(!(e.collectionField.isAssociationField()&&"readPretty"===e.model.getProps().pattern))return null;let n=t.titleField||t.label;if(n!==l.titleField){let t=e.collectionField.targetCollection,l=t.getField(n),r=uX.getDefaultBindingByField(e,l);if(r.modelName!==e.model.subModels.field.use){let l=e.model.subModels.field.uid;await e.engine.destroyModel(l);let i=e.model.setSubModel("field",{use:r.modelName,stepParams:{fieldSettings:{init:{dataSourceKey:e.model.collectionField.dataSourceKey,collectionName:t.name,fieldPath:n}}}});await i.save()}e.model.setProps(e.collectionField.targetCollection.getField(n).getComponentProps())}},async handler(e,t){"readPretty"===e.model.props.pattern?e.model.setProps({titleField:null==t?void 0:t.label}):e.model.setProps({titleField:t.titleField})}}}}),u4.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh",defaultParams:{strategy:"formItem"}}}});var u8=l(85352),u3=l(90199),u6=l(97510);function u9(e,t){var l,n,r;let i=null==e||null==(l=e.props)?void 0:l.fieldNames,o=null==e||null==(n=e.props)?void 0:n.titleField,a=null==e||null==(r=e.getStepParams)?void 0:r.call(e,"selectSettings","fieldNames");return{stepParams:{fieldSettings:{init:t},...a?{selectSettings:{fieldNames:a}}:{}},props:{...void 0!==i?{fieldNames:i}:{},...void 0!==o?{titleField:o}:{}}}}function u7(e){try{return JSON.stringify(e)??""}catch{return String(e)}}function ce(e){var t,l,n;let r=null==e||null==(t=e.props)?void 0:t.fieldNames,i=null==e||null==(l=e.props)?void 0:l.titleField,o=null==e||null==(n=e.getStepParams)?void 0:n.call(e,"selectSettings","fieldNames");return[(null==e?void 0:e.uid)||"",u7(r),u7(i),u7(o)].join("|")}function ct(e){if(!e||"object"!=typeof e||!("target"in e))return e;let t=e.target;return t&&"value"in t?t.value:e}class cl extends u4{onInit(e){var t,l,n,r,i,o,a;let s=null==(t=this.getStepParams("fieldSettings","assignValue"))?void 0:t.value;void 0!==s&&(this.assignValue=s),this.context.defineProperty("collectionField",{get:()=>{var e,t;let l=this.getStepParams("fieldSettings","init")||{},n=`${null==l?void 0:l.dataSourceKey}.${null==l?void 0:l.collectionName}.${null==l?void 0:l.fieldPath}`,r=null==(e=this.context)?void 0:e.dataSourceManager;return null==r||null==(t=r.getCollectionField)?void 0:t.call(r,n)}});let d=this.context,u=null==d?void 0:d.collection,c=this.fieldInit;if(!(null==(l=this.subModels)?void 0:l.field)&&(null==u?void 0:u.getFields)){let e=(u.getFields()||[]).find(e=>(null==e?void 0:e.name)===(null==c?void 0:c.fieldPath));null==u||null==(r=u.getField)||r.call(u,null==c?void 0:c.fieldPath);let t=I.EditableItemModel.getDefaultBindingByField(d,e);if(!t)return;let l=t.modelName;null==d||null==(o=d.engine)||null==(i=o.createModel)||i.call(o,{use:l,stepParams:{fieldSettings:{init:c}},parentId:this.uid,subKey:"field"})}let p=null==(n=this.context)?void 0:n.collection,h=this.fieldPath;if(h){let e=null==p||null==(a=p.getField)?void 0:a.call(p,h),t=(null==e?void 0:e.title)||h,l=h.includes(".")?h.split("."):[h];this.setProps({label:t,name:l})}}get fieldInit(){return this.getStepParams("fieldSettings","init")||{}}get fieldPath(){var e;return null==(e=this.fieldInit)?void 0:e.fieldPath}getAssignedEntry(){let e=this.fieldPath;return e?[e,this.assignValue]:null}render(){var e,t;let l=this.context,n=l.collection,r=this.fieldInit,i=(null==(e=this.props)?void 0:e.name)||(this.fieldPath?[this.fieldPath]:void 0),o=this.fieldPath,a=null==(t=this.subModels)?void 0:t.field,s=ce(a),d=()=>{var e,t,s,d,u;let[c,p]=D.useState(null);D.useEffect(()=>{var e,t,i,s,d,u,c,h,m,f,g,v,y,b,x,w,S,M,A,F,k;if(!o)return;let C=((null==n||null==(e=n.getFields)?void 0:e.call(n))||[]).find(e=>(null==e?void 0:e.name)===o);n.getField(o);let P=I.EditableItemModel.getDefaultBindingByField(l,C);if(!P)return;let j=P.modelName,E=u9(a,r),R=null==l||null==(i=l.engine)||null==(t=i.createModel)?void 0:t.call(i,{use:"VariableFieldFormModel",subModels:{fields:[{use:j,...E}]}});if(!R)return;null==(d=R.context)||null==(s=d.defineProperty)||s.call(d,"collection",{value:n});let T=null==l?void 0:l.dataSource;T&&(null==(c=R.context)||null==(u=c.defineProperty)||u.call(c,"dataSource",{value:T}));let _=null==n||null==(h=n.getField)?void 0:h.call(n,null==r?void 0:r.fieldPath);_&&(null==(f=R.context)||null==(m=f.defineProperty)||m.call(f,"collectionField",{value:_}));let D=null==l?void 0:l.blockModel;D&&(null==(v=R.context)||null==(g=v.defineProperty)||g.call(v,"blockModel",{value:D}));let N=l.form;N&&(null==(F=R.context)||null==(A=F.defineProperty)||A.call(F,"form",{value:N})),R.context&&Object.defineProperty(R.context,"resource",{configurable:!0,enumerable:!0,get:()=>null==D?void 0:D.resource});let O=null==R||null==(b=R.subModels)||null==(y=b.fields)?void 0:y[0],$=null==n||null==(x=n.getField)?void 0:x.call(n,null==r?void 0:r.fieldPath),B=null==$?void 0:$.type,L=null==$?void 0:$.interface,q="belongsToMany"===B||"hasMany"===B||"belongsToArray"===B||"m2m"===L||"o2m"===L||"mbm"===L;if(null==O||null==(w=O.setProps)||w.call(O,{disabled:!1,readPretty:!1,updateAssociation:!1,multiple:q}),null==O||null==(S=O.dispatchEvent)||S.call(O,"beforeRender",void 0,{sequential:!0,useCache:!0}),(0,u8.NI)(O,$),!(null==O||null==(M=O.props)?void 0:M.fieldNames)&&(null==$?void 0:$.targetCollection)){let e=$.targetCollection,t=(null==$?void 0:$.targetKey)||(null==e?void 0:e.filterTargetKey)||"id";null==O||null==(k=O.setProps)||k.call(O,{fieldNames:{label:null==e?void 0:e.titleField,value:t}})}return p(R),()=>{var e,t,l,n;null==R||null==(l=R.subModels)||null==(t=l.fields)||null==(e=t.forEach)||e.call(t,e=>{var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),null==R||null==(n=R.remove)||n.call(R)}},[]);let h=e=>(D.useEffect(()=>{var t,l,n;if(!c)return;null==(t=c.setProps)||t.call(c,{...e});let r=null==c||null==(n=c.subModels)||null==(l=n.fields)?void 0:l[0];if(r){var i,o=this;null==(i=r.setProps)||i.call(r,{value:null==e?void 0:e.value,onChange:function(){for(var t,l,n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];let s=ct(i&&i.length?i[0]:void 0);null==(t=r.setProps)||t.call(r,{value:s}),o.assignValue=s,null==e||null==(l=e.onChange)||l.call(e,s)}})}},[e]),c?(0,E.jsx)("div",{style:{width:"100%"},children:(0,E.jsx)(I.FlowModelRenderer,{model:c,showFlowSettings:!1})}):null),m=()=>{var e,t;return(0,E.jsx)(dn.A,{placeholder:`<${(null==(e=(t=this.context).t)?void 0:e.call(t,"Null"))??"Null"}>`,readOnly:!0,style:{width:"100%"}})},f=e=>(0,E.jsx)(u3.h,{t:this.context.t,value:null==e?void 0:e.value,onChange:null==e?void 0:e.onChange,containerStyle:{width:"100%"}}),g=async()=>{var e;let t=null==(e=this.context)?void 0:e.getPropertyMetaTree;return"function"==typeof t?await t():[]},v=null==n||null==(e=n.getField)?void 0:e.call(n,this.fieldPath),y=(0,u6.kB)(v),b=(0,u6.Ot)(v,null==(t=this.fieldPath)?void 0:t.split(".").slice(-1)[0]),x=b?(0,u6.cd)(v,y):u6.tS,w=(null==(s=this.props)?void 0:s.label)??this.fieldPath??"",S=null==n||null==(d=n.getField)?void 0:d.call(n,this.fieldPath);return w=(null==(u=this.props)?void 0:u.label)??(null==S?void 0:S.title)??w,(0,E.jsx)(I.FormItem,{...this.props,label:w,name:i,initialValue:this.assignValue,valuePropName:"__assign_value__",trigger:"__assign_trigger__",validateTrigger:"__assign_trigger__",children:D.createElement(e=>{let t=null==e?void 0:e.__assign_value__,l=void 0===t?this.assignValue:t;return(0,E.jsx)(u6.Wm,{value:l,onChange:t=>{var l;this.assignValue=t,null==e||null==(l=e.__assign_trigger__)||l.call(e,t)},baseMetaTree:g,constantComponent:h,nullComponent:m,runJSComponent:f,isDateLikeField:b,dateComponentProps:x,clearValue:""})})})};return(0,E.jsx)(d,{},s)}constructor(e){super(e),(0,w._)(this,"assignValue",void 0),(0,R.define)(this,{assignValue:R.observable})}}cl.define({label:(0,I.tExpr)("Assign field")}),cl.registerFlow({key:"editItemSettings",sort:300,title:(0,I.tExpr)("Form item settings"),steps:{showLabel:{title:(0,I.tExpr)("Show label"),uiMode:{type:"switch",key:"showLabel"},defaultParams:{showLabel:!0},handler(e,t){e.model.setProps({showLabel:t.showLabel})}},label:{title:(0,I.tExpr)("Label"),uiSchema:e=>({label:{"x-component":"Input","x-decorator":"FormItem","x-reactions":t=>{var l;let n=e.model,r=null==(l=n.collectionField)?void 0:l.title;t.decoratorProps={...t.decoratorProps,extra:n.context.t("Original field title: ")+r}}}}),defaultParams:e=>({label:e.model.collectionField.title}),handler(e,t){var l;t.label&&t.label===(null==(l=e.model.collectionField)?void 0:l.title)?e.model.setProps({label:t.label}):e.model.setProps({label:e.t(t.label,{ns:"lm-flow-engine"})})}},init:{async handler(e){let t=e.model.collectionField;t&&e.model.setProps(t.getComponentProps());let l=e.model.fieldPath,n=l.includes(".")?l.split("."):l;e.model.setProps({name:n})}},tooltip:{title:(0,I.tExpr)("Tooltip"),uiSchema:{tooltip:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({tooltip:e.t(t.tooltip,{ns:"lm-flow-engine"})})}},description:{title:(0,I.tExpr)("Description"),uiSchema:{description:{"x-component":"Input.TextArea","x-decorator":"FormItem"}},handler(e,t){e.model.setProps({extra:e.t(t.description,{ns:"lm-flow-engine"})})}},validation:{title:(0,I.tExpr)("Validation"),use:"validation"},required:{title:(0,I.tExpr)("Required"),use:"required"}}});class cn extends sL{}(0,w._)(cn,"itemModelName","DetailsItemModel"),cn.define({label:'{{t("Display association fields")}}'});var cr=l(58929);let ci=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,r=parseFloat(l.marginBottom)||0;return t.height+n+r},co=e=>{let{heightMode:t,containerRef:l,actionsRef:n,paginationRef:r,deps:i=[]}=e,[o,a]=(0,D.useState)(),s=(0,D.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let o=Math.max(0,Math.floor(i-ci(n.current)-ci(r.current)));a(e=>e===o?e:o)},[t,l,n,r]);return(0,D.useLayoutEffect)(()=>{s()},[s,...i]),(0,D.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=n.current,i=r.current,o=new ResizeObserver(()=>s());return o.observe(e),t&&o.observe(t),i&&o.observe(i),()=>o.disconnect()},[s,l,n,r,...i]),o};class ca extends dx.t{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(I.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(I.MultiRecordResource);return r.setPageSize(1),r}onInit(e){var t,l;super.onInit(e),this.hadSingleRecordData=(null==(l=this.resource)||null==(t=l.hasData)?void 0:t.call(l))??!1,this.hasMultiRefreshDispatched=!1;let n=(0,I.createCurrentRecordMetaFactory)(this.context,()=>this.collection);this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1,resolveOnServer:(0,I.createRecordResolveOnServerWithLocal)(()=>this.collection,()=>this.getCurrentRecord()),meta:n}),this.resource.on("refresh",()=>{var e,t;if(this.isMultiRecordResource()){this.hasMultiRefreshDispatched=!0,(0,ub.Xi)(this,"paginationChange");return}let l=this.hadSingleRecordData;this.hadSingleRecordData=(null==(t=this.resource)||null==(e=t.hasData)?void 0:e.call(t))??!1,l&&(0,ub.Xi)(this,"paginationChange")})}isMultiRecordResource(){return this.resource instanceof I.MultiRecordResource}hasDispatchedMultiRefresh(){return this.hasMultiRefreshDispatched}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}async refresh(){await this.resource.refresh()}renderPagination(){if(!this.resource.loading&&!this.hasAvailableData()){var e,t;return(0,E.jsx)("div",{style:{textAlign:"center",color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")})}let l=this.resource;return!this.isMultiRecordResource()||!l.getPage()||1>=this.resource.getMeta("count")?null:(0,E.jsx)("div",{style:{textAlign:"center"},children:(0,E.jsx)(cr.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:l.getPage(),total:l.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})})}renderConfigureActions(){return(0,E.jsx)(I.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("RecordActionGroupModel"),afterSubModelInit:async e=>{e.setStepParams("buttonSettings","general",{type:"default"})},children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Actions")})},"details-actions-add")}renderComponent(){let{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:r}=this.props,i=!!this.context.flowSettingsEnabled,o=!i&&!this.hasAvailableData(),{heightMode:a,height:s}=this.decoratorProps;return(0,E.jsx)(cs,{model:this,gridModel:this.subModels.grid,isConfigMode:i,heightMode:a,height:s,layoutProps:{colon:e,labelAlign:t,labelWidth:l,labelWrap:n,layout:r},actions:(0,E.jsx)(I.DndProvider,{children:(0,E.jsx)("div",{style:o?{pointerEvents:"none",opacity:.45}:void 0,children:(0,E.jsxs)(s3.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||i)return(0,E.jsx)(I.Droppable,{model:e,children:(0,E.jsx)(I.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:I.DragHandler,sort:1}]})},e.uid)}),this.renderConfigureActions()]})})})})}constructor(...e){super(...e),(0,w._)(this,"hadSingleRecordData",!1),(0,w._)(this,"hasMultiRefreshDispatched",!1),(0,w._)(this,"_defaultCustomModelClasses",{RecordActionGroupModel:"RecordActionGroupModel",DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"}),(0,w._)(this,"customModelClasses",{}),(0,w._)(this,"handlePageChange",async e=>{if(this.resource instanceof I.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await this.refresh()}})}}(0,w._)(ca,"scene",dy.P.oam);let cs=e=>{let{model:t,gridModel:l,isConfigMode:n,heightMode:r,height:i,layoutProps:o,actions:a}=e,s=(0,D.useRef)(null),d=(0,D.useRef)(null),u=(0,D.useRef)(null),c="specifyValue"===r||"fullHeight"===r,p=co({heightMode:r,containerRef:s,actionsRef:d,paginationRef:u,deps:[i]});(0,D.useEffect)(()=>{var e,t;if(!l)return;let n=c?p:void 0;((null==(e=l.props)?void 0:e.height)!==n||(null==(t=l.props)?void 0:t.heightMode)!==r)&&l.setProps({height:n,heightMode:r})},[l,p,c,r]);let h=c?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,m=c?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,E.jsx)(u$.s2,{model:t,layoutProps:o,style:h,children:(0,E.jsxs)("div",{ref:s,style:m,children:[(0,E.jsx)("div",{ref:d,style:{textAlign:"right",lineHeight:"0px",paddingBottom:n&&t.context.themeToken.padding},children:a}),(0,E.jsx)(I.FlowModelRenderer,{model:l,showFlowSettings:!1},`${(null==l?void 0:l.uid)||"details-grid"}:${n?"design":"runtime"}`),(0,E.jsx)("div",{ref:u,children:t.renderPagination()})]})})};ca.registerFlow({key:"detailsSettings",title:(0,I.tExpr)("Details settings"),sort:150,steps:{refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");await e.model.applySubModelsBeforeRenderFlows("grid")}},layout:{use:"layout",title:(0,I.tExpr)("Layout")},dataScope:{use:"dataScope"},defaultSorting:{use:"sortingRule",title:(0,I.tExpr)("Default sorting")},linkageRules:{use:"detailsFieldLinkageRules"}}}),ca.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldslinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"detailsFieldLinkageRules",flowKey:"detailsSettings",stepKey:"linkageRules"}}}}),ca.registerFlow({key:"initialPaginationChangeRefresh",sort:10001,steps:{refreshPaginationRelatedStates:{async handler(e){if(e.model.hidden||!e.model.isMultiRecordResource()||e.model.hasDispatchedMultiRefresh())return;let t=e.model.resource;if(!t)return;let l="manual"===(t.dataLoadingMode??t.loadingMode),n="function"==typeof t.hasActiveFilters&&t.hasActiveFilters();l&&!n&&await (0,ub.Xi)(e.model,"paginationChange")}}}}),ca.define({label:(0,I.tExpr)("Details"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search"),createModelOptions:{use:"DetailsBlockModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});class cd extends I.FlowModel{static defineChildren(e){let t=e.engine.filterModelClassByParent("CommonItemModel"),l=e.engine.filterModelClassByParent("DetailsCustomItemModel"),n=t=>Array.from(t.entries()).map(t=>{var l,n,r,i,o;let[a,s]=t,d="function"==typeof s.defineChildren||!!(null==(l=s.meta)?void 0:l.children),u={key:a,label:e.t(s.meta.label),sort:s.meta.sort??999,searchable:!!(null==(n=s.meta)?void 0:n.searchable),searchPlaceholder:null==(r=s.meta)?void 0:r.searchPlaceholder,hide:null==(i=s.meta)?void 0:i.hide};return d?u.children=e=>{var t;return"function"==typeof s.defineChildren?s.defineChildren(e):(null==(t=s.meta)?void 0:t.children)||[]}:u.createModelOptions=(null==(o=s.meta)?void 0:o.createModelOptions)||{use:a},u});return _().sortBy([...n(t),...n(l)],"sort")}}(0,w._)(cd,"renderMode",I.ModelRenderMode.RenderFunction),cd.define({hide:!0,label:(0,I.tExpr)("Others")});class cu extends dc{renderAddSubModelButton(){return this.context.flowSettingsEnabled?(0,E.jsx)(I.AddSubModelButton,{model:this,subModelKey:"items",subModelBaseClasses:[this.context.getModelClassName("DetailsItemModel"),this.context.getModelClassName("DetailsAssociationFieldGroupModel"),this.context.getModelClassName("DetailsCustomItemModel")].filter(Boolean),keepDropdownOpen:!0,children:(0,E.jsx)(I.FlowSettingsButton,{icon:(0,E.jsx)(nx.A,{}),children:this.translate("Fields")})}):null}render(){var e,t;let l=null==(e=this.props)?void 0:e.height,n=null==(t=this.props)?void 0:t.heightMode,r=this.context.themeToken,i=super.render();return"defaultHeight"===n?i:(0,E.jsx)("div",{style:{height:l,overflowY:"auto",marginLeft:`-${r.marginLG}px`,marginRight:`-${r.marginLG}px`,paddingLeft:`${r.marginLG}px`,paddingRight:`${r.marginLG}px`},children:i})}constructor(...e){super(...e),(0,w._)(this,"itemFallback",(0,E.jsx)(r1.A.Input,{block:!0,size:"small",style:{marginBottom:"0.5rem"}})),(0,w._)(this,"itemSettingsMenuLevel",2),(0,w._)(this,"itemFlowSettings",{showBackground:!0,style:{top:-6,left:-6,right:-6,bottom:-6}}),(0,w._)(this,"dragOverlayConfig",{columnInsert:{before:{offsetTop:-6,height:24},after:{offsetTop:3,height:24}},columnEdge:{left:{offsetLeft:-5,width:24},right:{offsetLeft:8,width:24}},rowGap:{above:{offsetTop:-2,height:24},below:{offsetTop:-12,height:24}}})}}function cc(e,t){let{fieldUseModel:l,refreshTargets:n}=t,r=e=>Array.isArray(e)?e.map(e=>{let t={...e};if(t.children)if("function"==typeof t.children){let e=t.children;t.children=async t=>r(await e(t))}else Array.isArray(t.children)&&(t.children=r(t.children));if(t.createModelOptions){let e=t.createModelOptions;t.createModelOptions=async(t,n)=>{let r=await ("function"==typeof e?e(t,n):e);return r.subModels=r.subModels||{},r.subModels.field={...r.subModels.field||{},use:l},r},t.refreshTargets=t.refreshTargets||n}return t}):[];return r(e)}function cp(e,t,l){let{fieldUseModel:n,refreshTargets:r}=l,i=l.key??"js-association-fields",o=l.label??(0,I.tExpr)("Display association fields");return{key:i,type:"group",label:o,searchable:l.searchable??!0,searchPlaceholder:l.searchPlaceholder??(0,I.tExpr)("Search fields"),children:async e=>cc(await t(e),{fieldUseModel:n,refreshTargets:r})}}cu.registerFlow({key:"detailFieldGridSettings",steps:{grid:{handler(e,t){e.model.setProps("rowGap",0),e.model.setProps("colGap",16)}}}});class ch extends sL{}async function cm(e,t){var l;let{useModel:n,fieldUseModel:r,refreshTargets:i,associationPathName:o,associationProvider:a}=t,s=(0,I.buildWrapperFieldChildren)(e,{useModel:n,fieldUseModel:r,associationPathName:o,refreshTargets:i}),d=[],u=null==s||null==(l=s[0])?void 0:l.children;if(Array.isArray(u)&&(d=u),!a)return d;let c=await a(e);return Array.isArray(c)&&0!==c.length?[...d,cp(e,a,{fieldUseModel:r,refreshTargets:i})]:d}(0,w._)(ch,"itemModelName","FormItemModel");class cf extends cd{static defineChildren(e){return cm(e,{useModel:"DetailsItemModel",fieldUseModel:"JSFieldModel",refreshTargets:["DetailsItemModel"],associationProvider:e=>cn.defineChildren(e)})}}cf.define({label:(0,I.tExpr)("JS field"),searchable:!0,searchPlaceholder:(0,I.tExpr)("Search fields"),sort:110});class cg extends aC.o{}var cv=l(85196);class cy extends aC.o{constructor(...e){super(...e),(0,w._)(this,"operator","$eq"),(0,w._)(this,"updateAssociation",!1)}}cy.registerFlow({key:"AssociationFieldInit",sort:800,steps:{init:{async handler(e,t){if(e.model.updateAssociation){var l,n;let t=e.model.context.blockModel,r=null==t||null==(l=t.context)?void 0:l.resource,i=null==(n=e.model.parent)?void 0:n.fieldPath;r&&i&&r.addUpdateAssociationValues(i)}}},allowCreateCheck:{async handler(e){var t;let l=await e.aclCheck({dataSourceKey:e.collectionField.dataSourceKey,resourceName:null==(t=e.collectionField)?void 0:t.target,actionName:"create"});e.model.setProps({allowCreate:!!l})}}}});let cb=(e,t)=>e===t,cx=e=>{if(e&&"object"==typeof e){let t=e.data;return t&&"object"==typeof t?t:e}};function cw(e){return"string"==typeof e&&e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0}function cS(e,t){var l;let n="string"==typeof(null==t||null==(l=t.titleCollectionField)?void 0:l.name)?t.titleCollectionField.name:void 0,r=cw(null==t?void 0:t.filterTargetKey)||"id",i="string"==typeof(null==e?void 0:e.value)&&e.value&&!cb(e.value,"value")?e.value:void 0,o="string"==typeof(null==e?void 0:e.label)&&e.label&&!cb(e.label,"label")?e.label:void 0,a=i||r;return{label:o||n||a,value:a}}function cM(e){var t,l,n,r,i,o;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=!!a.navigation,d=e=>{if(Array.isArray(e))return e.filter(e=>"string"==typeof e&&!!e)},u=d(null==(l=e.view)||null==(t=l.inputArgs)?void 0:t.openerUids),c=d(a.openerUids),p=u||c||[];if(s)return(c||p).filter(Boolean);let h=null==(r=e.view)||null==(n=r.inputArgs)?void 0:n.viewUid,m=null==(o=e.model.context)||null==(i=o.inputArgs)?void 0:i.viewUid;return[...p,"string"==typeof h&&h?h:"string"==typeof m&&m?m:e.model.uid].filter(Boolean)}function cA(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.map(e=>{if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}).filter(e=>void 0!==e);return t.length?t.map(String).join(", "):void 0}if(e&&"object"==typeof e){let t=e.label??e.name;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t}}function cF(e){var t,l,n;let{option:r,fieldNames:i}=e,o=(0,I.useFlowModel)(),a=cx(r),s=cS(i,null==(t=o.context.collectionField)?void 0:t.targetCollection),d=o.subModels.field,u=cA(null==a?void 0:a[s.label])??cA(null==a?void 0:a.label)??cA(null==a?void 0:a[s.value]);if(!d)return(0,E.jsx)("span",{children:u??"N/A"});let c=String((null==a?void 0:a[s.value])??u??"association-option"),p=d.createFork({},c);p.context.defineProperty("record",{get:()=>a,cache:!1,meta:(0,I.createCurrentRecordMetaFactory)(p.context,()=>p.context.collection)});let h=null==(n=o.context.collectionField.targetCollection)||null==(l=n.getField)?void 0:l.call(n,s.label),m=h&&"function"==typeof h.getComponentProps?h.getComponentProps():{};p.setProps({value:u,clickToOpen:!1,...m});let f=null!=u&&""!==u?p.render():"N/A";return(0,E.jsx)("span",{style:{pointerEvents:"none"},children:f})}function ck(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"record",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];if(!e)return l?[]:void 0;let{value:i}=t||{},o=e=>"object"==typeof e&&null!==e,a=e=>{if(o(e))return{label:(0,E.jsx)(cF,{option:e,fieldNames:t}),value:e[i]}};if("value"===n){let t=e=>{if("object"==typeof e&&null!==e)return a(e);let t=r.find(t=>(null==t?void 0:t[i])===e);return t?a(t):{label:String(e),value:e}};return l?Array.isArray(e)?e.map(e=>t(e)).filter(Boolean):[]:Array.isArray(e)?t(e[0]):t(e)}if(l)return Array.isArray(e)?e.filter(o).map(a).filter(Boolean):[];if(Array.isArray(e)){let t=e[0];return o(t)?a(t):void 0}return o(e)?a(e):void 0}function cC(e,t,l){return(null==e?void 0:e.length)?e.map(e=>(0,T.omit)(e,"disabled","options","style")):l?Array.isArray(t)?t.filter(e=>"object"==typeof e&&null!==e):[]:t&&"object"==typeof t?[t]:[]}var cP=l(77577);let cj="calc(12px + env(safe-area-inset-bottom, 0px))",cE={paddingBottom:cj};function cR(e){return{maxHeight:"60vh",overflowY:"auto",paddingBottom:e?void 0:cj}}let cI=(0,Z.css)`
|
|
482
482
|
div {
|
|
483
483
|
white-space: nowrap !important;
|
|
484
484
|
overflow: hidden;
|
|
@@ -1257,7 +1257,7 @@ ${r}`,c)}}let n=R(e.issues.filter(e=>"runtime"===e.type)),r=n?`Key runtime issue
|
|
|
1257
1257
|
&:hover {
|
|
1258
1258
|
background-color: ${g.colorFillSecondary};
|
|
1259
1259
|
}
|
|
1260
|
-
`;return(0,n.jsxs)("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.map(e=>(0,n.jsx)("div",{role:"option",onClick:()=>x(e.value),className:l,children:f(e.label)},e.value)),(0,n.jsx)(o.A,{style:{margin:"4px 0"}}),t.map(e=>(0,n.jsx)("div",{role:"option",className:l,onClick:()=>x(e.value),title:f(e.label),children:f(e.label)},e.value))]})};return(0,n.jsxs)(a.A.Compact,{style:{...h.style,width:"100%"},children:[(0,n.jsx)(s.A,{options:b,open:v,onDropdownVisibleChange:y,...h,allowClear:!1,style:{width:"100%",minWidth:100,maxWidth:["past","next","exact",void 0].includes(null==t?void 0:t.type)?100:null},value:(null==t?void 0:t.type)||"exact",onChange:x,dropdownRender:w}),["past","next"].includes(null==t?void 0:t.type)&&[(0,n.jsx)(d.A,{style:{flex:1},value:null==t?void 0:t.number,onChange:e=>{l({...t,number:e})}},"number"),(0,n.jsx)(s.A,{value:null==t?void 0:t.unit,style:{minWidth:130,maxWidth:140},onChange:e=>{l({...t,unit:e})},options:[{value:"day",label:f("Day")},{value:"week",label:f("Calendar week")},{value:"month",label:f("Calendar Month")},{value:"year",label:f("Calendar Year")}],popupMatchSelectWidth:!0},"unit")],((null==t?void 0:t.type)==="exact"||!(null==t?void 0:t.type))&&(0,n.jsx)(A,{...h,value:t,onChange:l})]})}},32644(e,t,l){l.d(t,{S:()=>o});let n=new Set(["$match","$notMatch","$anyOf","$noneOf","$childIn","$childNotIn","$in","$notIn"]);function r(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"type"in e}function i(e){return null==e||"string"==typeof e&&""===e.trim()}function o(e,t){if(!e)return t;if("$dateBetween"===e){if(null==t||r(t))return t;if(Array.isArray(t)){if(0===t.length)return t;let e=t[0],l=t.length>1?t[1]:void 0,n=i(e),r=i(l);return(1!==t.length||n)&&(n||!r)?n&&!r?[l,l]:t:[e,e]}return[t,t]}return n.has(e)?null==t||Array.isArray(t)?t:"string"==typeof t&&""===t.trim()?[]:[t]:t}},71616(e,t,l){l.d(t,{EditFormModel:()=>p});var n=l(50467),r=l(74848),i=l(11869),o=l(58929),a=l(84626),s=l(40098);l(96540);var d=l(15892),u=l(96491),c=l(84759);class p extends u.F4{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(i.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(i.MultiRecordResource);return r.setPageSize(1),r}isMultiRecordResource(){return this.resource instanceof i.MultiRecordResource}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}getAclActionName(){return"update"}async submitHandler(e,t,n){let{submitHandler:r}=await Promise.resolve().then(l.bind(l,53831));await r(e,t,n)}async submit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,{submitHandler:n}=await Promise.resolve().then(l.bind(l,53831));await n(this.context,e,t)}renderComponent(){var e,t;let{colon:l,labelAlign:n,labelWidth:s,labelWrap:d,layout:c}=this.props,p=!!this.context.flowSettingsEnabled,h=this.hasAvailableData(),m=!p&&!h,{heightMode:f,height:g}=this.decoratorProps,v=this.resource.loading||h?this.isMultiRecordResource()&&this.resource.getMeta("count")>1?(0,r.jsx)("div",{style:{textAlign:"center",marginTop:16},children:(0,r.jsx)(o.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:this.resource.getPage(),total:this.resource.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})}):null:(0,r.jsx)("div",{style:{textAlign:"center",marginTop:16,color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")});return(0,r.jsx)(u.JU,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:l,labelAlign:n,labelWidth:s,labelWrap:d,layout:c},heightMode:f,height:g,grid:(0,r.jsx)(i.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1}),actions:(0,r.jsx)("div",{style:m?{pointerEvents:"none",opacity:.45}:void 0,children:(0,r.jsx)(i.DndProvider,{children:(0,r.jsxs)(a.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||p)return(0,r.jsx)(i.Droppable,{model:e,children:(0,r.jsx)(i.MemoFlowModelRenderer,{model:e,showFlowSettings:!!this.context.flowSettingsEnabled&&this.actionFlowSettings,extraToolbarItems:this.actionExtraToolbarItems},e.uid)},e.uid)}),this.renderConfigureActions()]})})}),footer:v})}constructor(...e){super(...e),(0,n._)(this,"actionFlowSettings",{showBackground:!1,showBorder:!1,toolbarPosition:"above"}),(0,n._)(this,"actionExtraToolbarItems",[{key:"drag-handler",component:i.DragHandler,sort:1}]),(0,n._)(this,"handlePageChange",async e=>{if(this.resource instanceof i.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await t.refresh(),await (0,c.Xi)(this,"paginationChange")}})}}(0,n._)(p,"scene",d.P.oam),(0,n._)(p,"blockCapabilityActionName","update"),p.registerFlow({key:"formSettings",title:(0,i.tExpr)("Edit form settings"),steps:{init:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");e.resource.on("refresh",async()=>{var t,l,n,r,i,o,a,d;let u=e.resource.getMeta("currentFilterByTk"),c={...e.model.getCurrentRecord()};if(!c)return;let p=null==(t=e.association)?void 0:t.targetKey;if(p&&(null==(l=e.association)?void 0:l.interface)!=="m2m"?e.resource.setMeta({currentFilterByTk:null==c?void 0:c[p]}):e.resource.setMeta({currentFilterByTk:e.collection.getFilterByTK(c)}),!e.form)return;let h=e.resource.getMeta("currentFilterByTk"),m=!(0,s.isEqual)(u,h),f=null==(n=(r=e.model).getUserModifiedFields)?void 0:n.call(r),g=!!(null==f?void 0:f.size),v=()=>{if(!(null==f?void 0:f.size))return;let t=e=>null!==e&&"object"==typeof e;for(let l of Array.from(f)){let n=e.form.getFieldValue(l),r=null==c?void 0:c[l];(Object.is(n,r)||t(n)&&t(r)&&(0,s.isEqual)(n,r))&&f.delete(l)}};if(!m&&g){let t={...c};for(let l of f)t[l]=e.form.getFieldValue(l);e.form.setFieldsValue(t),v();return}m&&(null==(i=(o=e.model).resetUserModifiedFields)||i.call(o),null==(a=(d=e.model).resetRuntimeUserEditedState)||a.call(d)),e.form.setFieldsValue(c),v()})}},dataScope:{use:"dataScope"},refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized")}}}}),p.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldsLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"fieldLinkageRules",flowKey:"eventSettings",stepKey:"linkageRules"}}}}),p.define({label:(0,i.tExpr)("Form (Edit)"),searchable:!0,searchPlaceholder:(0,i.tExpr)("Search"),createModelOptions:{use:"EditFormModel",subModels:{grid:{use:"FormGridModel"}}},sort:340})},96491(e,t,l){l.d(t,{JU:()=>z,s2:()=>B,F4:()=>$,mO:()=>K});var n=l(50467),r=l(74848),i=l(49655),o=l(22803),a=l(11869),s=l(89013),d=l(40098),u=l.n(d),c=l(40542),p=l(96540),h=l(2117),m=l(25359),f=l(52175),g=l(95243),v=l(29676),y=l(47632);function b(e){let t,l,n,r=()=>{let e=t;e&&(l&&(e.setFieldValue=l),n&&(e.setFieldsValue=n),t=void 0,l=void 0,n=void 0)};return{patch:i=>{if(t===i)return;r();let o="function"==typeof(null==i?void 0:i.setFieldValue)?i.setFieldValue.bind(i):void 0,a="function"==typeof(null==i?void 0:i.setFieldsValue)?i.setFieldsValue.bind(i):void 0;t=i,l=o,n=a,o&&(i.setFieldValue=(t,l)=>{e.isSuppressed()?o(t,l):e.setFormValues(e.getCallerContext(),[{path:t,value:l}],{source:"system"}).catch(()=>void 0)}),a&&(i.setFieldsValue=t=>{e.isSuppressed()?a(t):e.setFormValues(e.getCallerContext(),t,{source:"system"}).catch(()=>void 0)})},restore:r}}var x=l(12197),w=l(13939),S=l(65421),M=l(13940),A=l(26866);let F=Symbol("SKIP_RULE_VALUE"),k=Symbol("UNRESOLVED_ASSOCIATION_IDENTITY"),C=1e3;function P(e){return"default"===e?"default":"override"===e?"override":"assign"}function j(e){return"default"===e?"default":"override"===e?"override":"system"}class E{getAssignRuleBlockId(e){return`form-assign:${e}:block`}removeAssignRuleBlockInstance(e){let t=this.getAssignRuleBlockId(e);this.rules.has(t)&&this.removeRule(t)}removeRowGridAssignRuleInstances(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e),n=[];for(let[e,o]of this.rules.entries()){var r,i;if(!e.startsWith(t)||e===l)continue;let a=null==o||null==(i=o.rule)||null==(r=i.getContext)?void 0:r.call(i),s=null==a?void 0:a.model;s&&this.isRowGridModel(s)&&n.push(e)}for(let e of n)this.removeRule(e)}hasAnyNonBlockAssignRuleInstance(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e);for(let e of this.rules.keys())if(e.startsWith(t)&&e!==l)return!0;return!1}ensureBlockAssignRuleInstancesForTargetPath(e){if(this.options.isDisposed()||!e||!this.shouldCreateBlockLevelAssignRule(e))return;let t=this.assignTemplatesByTargetPath.get(e)||[];if(t.length)for(let l of t){let t=(null==l?void 0:l.__key)?String(l.__key):"";if(!t||this.hasAnyNonBlockAssignRuleInstance(t))continue;let n=j(P(null==l?void 0:l.mode)),r=(null==l?void 0:l.enable)!==!1,i=this.getAssignRuleBlockId(t);if(this.rules.has(i))continue;let o={id:i,source:n,priority:10+(l.__order||0),debounceMs:0,getEnabled:()=>r&&!!e,getTarget:()=>e,getValue:()=>null==l?void 0:l.value,getCondition:()=>null==l?void 0:l.condition,getContext:()=>this.options.getBlockContext()};this.rules.set(i,{rule:o,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}}getCollectionFromContext(e){var t,l;return(null==e?void 0:e.collection)??(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.collection)}getRootCollection(){let e=this.options.getBlockContext();return this.getCollectionFromContext(e)}shouldCreateBlockLevelAssignRule(e){let t=this.options.getBlockContext(),l=this.getCollectionFromContext(t);if(!(null==l?void 0:l.getField))return!0;let n=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(n.length<=1)return!0;for(let e=0;e<n.length-1;e++){var r,i;let t=n[e];if("string"!=typeof t)continue;let o=null==l||null==(r=l.getField)?void 0:r.call(l,t);if(!(null==o||null==(i=o.isAssociationField)?void 0:i.call(o)))break;if((0,M.E4)(o)){if("number"!=typeof n[e+1])return!1;e+=1}if(!(null==(l=null==o?void 0:o.targetCollection)?void 0:l.getField))break}return!0}collectAssociationPrefixPaths(e,t){let l=[],n=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==n?void 0:n.getField))return l;let r=[];for(let e=0;e<t.length-1;e++){var i,o;let a=t[e];if("string"!=typeof a)break;let s=null==n||null==(i=n.getField)?void 0:i.call(n,a);if(!(null==s||null==(o=s.isAssociationField)?void 0:o.call(s)))break;if(r.push(a),(0,M.E4)(s)){let l=t[e+1];if("number"!=typeof l)break;r.push(l),e+=1}if(l.push([...r]),!(null==(n=null==s?void 0:s.targetCollection)?void 0:n.getField))break}return l}shouldSkipToManyAssociationWriteWithoutIndex(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return!1;for(let e=0;e<t.length-1;e++){var n,r;let i=t[e];if("string"!=typeof i)continue;let o=null==l||null==(n=l.getField)?void 0:n.call(l,i);if(!(null==o||null==(r=o.isAssociationField)?void 0:r.call(o)))break;if((0,M.E4)(o)){if("number"!=typeof t[e+1])return!0;e+=1}if(!(null==(l=null==o?void 0:o.targetCollection)?void 0:l.getField))break}return!1}shouldSkipAssociationNestedWrite(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return!1;for(let n of l){let l=this.options.getFormValueAtPath(n);if(null==l){let l=n.filter(e=>"string"==typeof e).join(".");if(l&&this.getUpdateAssociationForTargetPath(l)||this.isAssociationTargetKeyWrite(e,t,n))continue;return!0}if("object"!=typeof l)return!0}return!1}getAssociationTargetKeyFields(e){var t,l;let n=(null==e?void 0:e.targetKey)??(null==e||null==(t=e.targetCollection)?void 0:t.filterTargetKey)??(null==e||null==(l=e.targetCollection)?void 0:l.filterByTk)??"id";return Array.isArray(n)?n.filter(e=>"string"==typeof e&&!!e):"string"==typeof n&&n?[n]:["id"]}resolveAssociationFieldByPrefixPath(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;let n=null;for(let e of t){var r,i;if("number"==typeof e)continue;if("string"!=typeof e||!e)break;let t=null==l||null==(r=l.getField)?void 0:r.call(l,e);if(!(null==t||null==(i=t.isAssociationField)?void 0:i.call(t))||(n=t,!(null==(l=null==t?void 0:t.targetCollection)?void 0:l.getField)))break}return n}isAssociationTargetKeyWrite(e,t,l){var n;if(!Array.isArray(t)||!Array.isArray(l)||t.length!==l.length+1)return!1;let r=t[l.length];if("string"!=typeof r||!r)return!1;let i=this.resolveAssociationFieldByPrefixPath(e,l);return!(!(null==i||null==(n=i.isAssociationField)?void 0:n.call(i))||(0,M.E4)(i))&&this.getAssociationTargetKeyFields(i).includes(r)}collectUpdateAssociationInitPatches(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return[];let n=[];for(let r of l){let l=this.options.getFormValueAtPath(r);if(null==l){let l=r.filter(e=>"string"==typeof e).join(".");if(!l)return null;if(this.getUpdateAssociationForTargetPath(l)){n.push({path:[...r,"__is_new__"],value:!0});continue}if(this.isAssociationTargetKeyWrite(e,t,r)){n.push({path:[...r],value:{}});continue}return null}if("object"!=typeof l)return null}let r=new Map;for(let e of n){let t=(0,x.Qc)(e.path);r.has(t)||r.set(t,e)}return Array.from(r.values())}dispose(){for(let{state:e}of this.rules.values())e.depDisposers.forEach(e=>e());for(let e of(this.rules.clear(),this.pendingRuleIds.clear(),this.assignTemplatesByTargetPath.clear(),this.defaultRuleMasterDisposers.values()))e();for(let e of(this.defaultRuleMasterDisposers.clear(),this.defaultRuleIdsByMasterUid.clear(),this.ruleDebounceTimersById.values()))clearTimeout(e);this.ruleDebounceTimersById.clear(),this.ruleDebounceUntilById.clear()}enable(){this.rulesEnabled=!0,this.pendingRuleIds.size&&!this.runningRules&&this.flushRules()}syncAssignRules(e){if(this.options.isDisposed())return;let t=(Array.isArray(e)?e:[]).map((e,t)=>({...e,key:(null==e?void 0:e.key)?String(e.key):`idx:${t}`})),l="form-assign:";for(let e of Array.from(this.rules.keys()))e.startsWith(l)&&this.removeRule(e);this.assignTemplatesByTargetPath.clear(),this.formItemTargetPaths.clear(),this.updateAssociationByTargetPath.clear();let n=0;for(let e of t){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=this.assignTemplatesByTargetPath.get(t)||[];n+=1,l.push({...e,__key:String(e.key),__order:n}),this.assignTemplatesByTargetPath.set(t,l)}let r=this.options.getEngine(),i=new Set;if(null==r?void 0:r.forEachModel){r.forEachModel(e=>{var t;if(!this.isModelInThisForm(e)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let l=this.getModelTargetPath(e);l&&this.formItemTargetPaths.add(l),this.cacheUpdateAssociationForModel(e)});let e=e=>{this.cacheUpdateAssociationForModel(e),this.tryRegisterAssignRuleInstancesForModel(e,i);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e,i)})};r.forEachModel(t=>{e(t)})}for(let[e,t]of this.assignTemplatesByTargetPath.entries())if(!i.has(e)&&this.shouldCreateBlockLevelAssignRule(e))for(let n of t){let t=j(P(null==n?void 0:n.mode)),r=(null==n?void 0:n.enable)!==!1,i=`${l}${n.__key}:block`;this.rules.has(i)&&this.removeRule(i);let o={id:i,source:t,priority:10+(n.__order||0),debounceMs:0,getEnabled:()=>r&&!!e,getTarget:()=>e,getValue:()=>null==n?void 0:n.value,getCondition:()=>null==n?void 0:n.condition,getContext:()=>this.options.getBlockContext()};this.rules.set(i,{rule:o,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}for(let e of Array.from(this.rules.keys()))e.startsWith("default:")&&this.scheduleRule(e)}onModelMounted(e){var t;if(this.isModelInThisForm(e)&&!(null==e?void 0:e.isFork)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);t&&this.formItemTargetPaths.add(t),this.cacheUpdateAssociationForModel(e)}this.tryRegisterDefaultRuleInstance(e),this.tryRegisterAssignRuleInstancesForModel(e)}onModelUnmounted(e){var t;if(this.tryUnregisterDefaultRuleInstance(e),this.tryUnregisterAssignRuleInstancesForModel(e),this.isModelInThisForm(e)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);if(t&&(this.ensureBlockAssignRuleInstancesForTargetPath(t),!(null==e?void 0:e.isFork))){this.updateAssociationByTargetPath.delete(t),this.formItemTargetPaths.delete(t);let e=`${t}.`;for(let t of this.assignTemplatesByTargetPath.keys())t.startsWith(e)&&this.ensureBlockAssignRuleInstancesForTargetPath(t);let l=this.options.getEngine();if(null==l?void 0:l.forEachModel){let e=e=>{this.tryRegisterAssignRuleInstancesForModel(e);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e)})};l.forEachModel(t=>e(t))}}}}isModelInThisForm(e){var t;let l=null==e||null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.options.getBlockModelUid())}cacheUpdateAssociationForModel(e){var t,l;if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e||(null==e?void 0:e.isFork)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let n=this.getModelTargetPath(e);if(!n)return;let r=null==e||null==(l=e.subModels)?void 0:l.field,i=!!(null==r?void 0:r.updateAssociation);!0!==this.updateAssociationByTargetPath.get(n)&&this.updateAssociationByTargetPath.set(n,i)}getUpdateAssociationForTargetPath(e){let t=String(e||"");if(!t)return!1;if(this.updateAssociationByTargetPath.has(t))return!!this.updateAssociationByTargetPath.get(t);let l=this.options.getEngine();return((null==l?void 0:l.forEachModel)&&l.forEachModel(e=>{this.cacheUpdateAssociationForModel(e)}),this.updateAssociationByTargetPath.has(t))?!!this.updateAssociationByTargetPath.get(t):(this.updateAssociationByTargetPath.set(t,!1),!1)}getDefaultRuleId(e){let t=(null==e?void 0:e.isFork)?String((null==e?void 0:e.forkId)??"fork"):"master",l=(null==e?void 0:e.uid)?String(e.uid):String(e);return`default:${l}:${t}`}getModelTargetNamePath(e){var t;let l=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(l)&&l.length)return l;let n="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,r=null==n?void 0:n.name;return Array.isArray(r)?r:"string"==typeof r?r.includes(".")?r.split("."):[r]:null}getAssignTemplateTargetPathForModel(e){let t=this.getModelTargetPath(e);if(t)return t;let l=this.getModelTargetNamePath(e);if(!(null==l?void 0:l.length))return"";let n=l.filter(e=>"number"!=typeof e);return n.length?(0,x.Qc)(n):""}hasAssignTemplateForTargetPath(e){let t=String(e||"");return!!t&&this.assignTemplatesByTargetPath.has(t)}tryRegisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(!t||"object"!=typeof t)return;let l=this.getModelTargetNamePath(e);if(!l)return;let n=this.getDefaultRuleId(e);if(this.rules.has(n))return;let r=e.master||e,i=this.getAssignTemplateTargetPathForModel(e);this.bindMasterInitialValue(r,n);let o=()=>{var e;let t=(null==r||null==(e=r.getProps)?void 0:e.call(r))??(null==r?void 0:r.props);return null==t?void 0:t.initialValue},a=o(),s=!1,d=()=>{let e=o();if(s||u().isEqual(e,a)||(s=!0),!this.hasAssignTemplateForTargetPath(i)||s||void 0===a)return e},c=()=>{if(!this.hasAssignTemplateForTargetPath(i))try{var e,t,l,n;let i=null==r||null==(t=r.getStepParams)||null==(e=t.call(r,"editItemSettings","initialValue"))?void 0:e.defaultValue;if(void 0!==i)return i;let o=null==r||null==(n=r.getStepParams)||null==(l=n.call(r,"formItemSettings","initialValue"))?void 0:l.defaultValue;if(void 0!==o)return o}catch{}},p={id:n,source:"default",priority:void 0!==d()?C:0,debounceMs:0,getEnabled:()=>void 0!==d()||void 0!==c(),getTarget:()=>this.getModelTargetNamePath(e)||l,getValue:()=>{let e=d();return void 0!==e?e:c()},getContext:()=>null==e?void 0:e.context};this.rules.set(n,{rule:p,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(n)}getModelTargetPath(e){try{var t;let l=null==e||null==(t=e.getStepParams)?void 0:t.call(e,"fieldSettings","init"),n=null==l?void 0:l.fieldPath;if(n)return String(n)}catch{}let l=null==e?void 0:e.fieldPath;if(l)return String(l);let n=this.getModelTargetNamePath(e);return(null==n?void 0:n.length)&&n.filter(e=>"string"==typeof e).join(".")||null}getAssignRuleInstanceId(e,t){let l=(null==t?void 0:t.isFork)?String((null==t?void 0:t.forkId)??"fork"):"master",n=(null==t?void 0:t.uid)?String(t.uid):String(t);return`form-assign:${e}:${n}:${l}`}getDeepestFieldIndexKey(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex),r=Array.isArray(n)?n:[];if(!r.length)return null;let i=r[r.length-1];if("string"!=typeof i)return null;let[o,a]=i.split(":");return!o||Number.isNaN(Number(a))?null:o}getDeepestToManyAssociationKey(e){let t=this.getRootCollection();if(!(null==t?void 0:t.getField))return null;let l=(0,x.EA)(String(e||"")).filter(e=>"object"!=typeof e);if(l.length<2)return null;let n=t,r=null;for(let e=0;e<l.length-1;e++){var i,o;let t=l[e];if("string"!=typeof t)continue;let a=null==n||null==(i=n.getField)?void 0:i.call(n,t);if(!(null==a||null==(o=a.isAssociationField)?void 0:o.call(a)))break;let s=(0,M.E4)(a);if(s&&(r=t),s&&"number"==typeof l[e+1]&&(e+=1),!(null==(n=null==a?void 0:a.targetCollection)?void 0:n.getField))break}return r}isRowGridModel(e){var t,l;if(!e||"object"!=typeof e||(null==e||null==(t=e.subModels)?void 0:t.field)||!(null==e||null==(l=e.subModels)?void 0:l.items))return!1;let n=null==e?void 0:e.context;return!!this.getDeepestFieldIndexKey(n)}tryRegisterAssignRuleInstancesForModel(e,t){var l,n,r,i;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let o=(l,n)=>{if(n&&0!==n.length)for(let i of(null==t||t.add(l),n)){var r;this.removeAssignRuleBlockInstance(i.__key),(null==e||null==(r=e.subModels)?void 0:r.field)&&this.removeRowGridAssignRuleInstances(i.__key);let t=j(P(null==i?void 0:i.mode)),n=(null==i?void 0:i.enable)!==!1,o=this.getAssignRuleInstanceId(i.__key,e);this.rules.has(o)&&this.removeRule(o);let a={id:o,source:t,priority:10+(i.__order||0),debounceMs:0,getEnabled:()=>n&&!!l,getTarget:()=>l,getValue:()=>null==i?void 0:i.value,getCondition:()=>null==i?void 0:i.condition,getContext:()=>null==e?void 0:e.context};this.rules.set(o,{rule:a,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(o)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(l)for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&o(e,t)}return}if(!(null==e||null==(l=e.subModels)?void 0:l.field))return;let a=this.getModelTargetPath(e);if(!a)return;let s=this.assignTemplatesByTargetPath.get(a)||[];s.length&&o(a,s);let d=null==e||null==(n=e.subModels)?void 0:n.field,u=null==d||null==(r=d.context)?void 0:r.collectionField,c=!!(null==u||null==(i=u.isAssociationField)?void 0:i.call(u)),p=(0,M.E4)(u);if(c&&!p){let e=`${a}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&o(t,l)}}tryUnregisterAssignRuleInstancesForModel(e){var t,l,n,r;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let i=t=>{for(let l of t||[]){let t=this.getAssignRuleInstanceId(l.__key,e);this.rules.has(t)&&this.removeRule(t)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(!l)return;for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&i(t)}return}if(!(null==e||null==(t=e.subModels)?void 0:t.field))return;let o=this.getModelTargetPath(e);if(!o)return;let a=this.assignTemplatesByTargetPath.get(o)||[];a.length&&i(a);let s=null==e||null==(l=e.subModels)?void 0:l.field,d=null==s||null==(n=s.context)?void 0:n.collectionField,u=!!(null==d||null==(r=d.isAssociationField)?void 0:r.call(d)),c=(0,M.E4)(d);if(u&&!c){let e=`${o}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&i(l)}}tryUnregisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let t=this.getDefaultRuleId(e);this.rules.has(t)&&this.removeRule(t)}bindMasterInitialValue(e,t){let l=(null==e?void 0:e.uid)?String(e.uid):t,n=this.defaultRuleIdsByMasterUid.get(l)||new Set;if(n.add(t),this.defaultRuleIdsByMasterUid.set(l,n),this.defaultRuleMasterDisposers.has(l))return;let r=(0,g.reaction)(()=>{var t;let l=(null==e||null==(t=e.getProps)?void 0:t.call(e))??(null==e?void 0:e.props);return null==l?void 0:l.initialValue},(t,n)=>{var r;if(u().isEqual(t,n))return;let i=this.defaultRuleIdsByMasterUid.get(l);if(!i)return;let o=(null==e||null==(r=e.getProps)?void 0:r.call(e))??(null==e?void 0:e.props),a=void 0!==(null==o?void 0:o.initialValue)?C:0;for(let e of i){let t=this.rules.get(e);t&&(t.rule.priority=a),this.scheduleRule(e)}});this.defaultRuleMasterDisposers.set(l,r)}removeRule(e){let t=this.rules.get(e);if(!t)return;try{let e=t.rule.getContext(),l=t.rule.getTarget(),n=this.options.tryResolveNamePath(e,l);if(n){let e=(0,x.Qc)(n),l=this.options.observableBindings.get(e);l&&l.source===t.rule.source&&(l.dispose(),this.options.observableBindings.delete(e))}}catch{}t.state.depDisposers.forEach(e=>e()),this.rules.delete(e),this.pendingRuleIds.delete(e);let l=this.ruleDebounceTimersById.get(e);for(let[t,n]of(l&&clearTimeout(l),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e),this.defaultRuleIdsByMasterUid.entries())){if(!n.has(e)||(n.delete(e),n.size>0))continue;this.defaultRuleIdsByMasterUid.delete(t);let l=this.defaultRuleMasterDisposers.get(t);l&&l(),this.defaultRuleMasterDisposers.delete(t)}}rescheduleAllRules(){if(!this.options.isDisposed()){for(let e of(this.lastRuleWriteByTargetKey.clear(),this.rules.values()))e.state.runSeq+=1;for(let e of this.rules.keys())this.scheduleRule(e)}}scheduleRule(e){if(this.options.isDisposed())return;let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.scheduledAtWriteSeq=this.options.getWriteSeq();let r=(null==l?void 0:l.debounceMs)??0;if(this.pendingRuleIds.add(e),r>0){let t=Date.now()+r;t>(this.ruleDebounceUntilById.get(e)||0)&&this.ruleDebounceUntilById.set(e,t);let l=this.ruleDebounceTimersById.get(e);l&&clearTimeout(l);let n=setTimeout(()=>{this.ruleDebounceTimersById.delete(e),!this.rulesEnabled||this.runningRules||this.pendingRuleIds.has(e)&&this.flushRules()},r);this.ruleDebounceTimersById.set(e,n)}else{let t=this.ruleDebounceTimersById.get(e);t&&clearTimeout(t),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e)}!this.rulesEnabled||this.runningRules||this.flushRules()}async flushRules(){if(this.runningRules)return;this.runningRules=!0;let e=this.currentRuleTxId||(0,S.ao)();this.currentRuleTxId=e;try{for(;this.pendingRuleIds.size;){let e=Date.now(),t=[];for(let l of this.pendingRuleIds)(this.ruleDebounceUntilById.get(l)||0)>e||t.push(l);if(!t.length)break;for(let e of t)this.pendingRuleIds.delete(e),this.ruleDebounceUntilById.delete(e);for(let e of(t.sort((e,t)=>{var l,n;let r=null==(l=this.rules.get(e))?void 0:l.rule,i=null==(n=this.rules.get(t))?void 0:n.rule,o=(null==r?void 0:r.priority)??0,a=(null==i?void 0:i.priority)??0;return o!==a?o-a:e.localeCompare(t)}),t))await this.runRule(e)}}finally{this.runningRules=!1,this.currentRuleTxId=null,this.options.txWriteCounts.delete(e)}}async runRule(e){let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.runSeq+=1;let r=n.runSeq,i=n.scheduledAtWriteSeq,o=this.prepareRuleContext(l),{baseCtx:a,targetNamePath:s,targetKey:d,clearDeps:u,disposeBinding:c}=o;if(!this.shouldRunRule(l,s,d,a)||!s||!d){u(n),c();return}let p=s,h=d,{collector:m,evalCtx:f}=this.createRuleCollectorAndContext(l,o);if(l.getCondition&&!await this.evaluateRuleCondition(l,n,r,f,m))return;let g=await this.resolveRuleValue(l,n,r,f,m);if(g===F||r!==n.runSeq)return;this.commitRuleDeps(l,n,m);let v=this.getToManyAggregateSourceInfo(a,l.getValue()),y=this.normalizeUnresolvedToManyAggregateForScalarTarget(a,p,g,v);if(y.skip)return;let b=y.hasValue?y.value:g,w=this.normalizeResolvedValueForTarget(a,b),S=this.normalizeResolvedValueForAssociationTarget(a,p,w),M=this.normalizeAggregateArrayForScalarTarget(a,p,S,v);if(M===F||this.shouldSkipEmptyArrayAggregateForScalarTarget(a,p,M)||this.shouldSkipMultiValueAggregateForScalarTarget(a,p,M,v)||"default"===l.source&&!this.checkDefaultRuleCanApply(M,p,h,u,c,n))return;if("override"===l.source&&this.options.findUserEditedHit(h))return void c();if("default"===l.source){let e=this.lastRuleWriteByTargetKey.get(h);if((null==e?void 0:e.source)==="default"&&e.priority>l.priority&&e.writeSeq>=i)return void c()}if("system"===l.source||"override"===l.source){let e=this.options.lastWriteMetaByPathKey.get(h);if((null==e?void 0:e.source)==="linkage"&&e.writeSeq>=i)return void c()}if(this.shouldSkipAssociationNestedWrite(a,p)||this.shouldSkipToManyAssociationWriteWithoutIndex(a,p))return;let A=M;if(this.isAssociationTargetSemanticallyEqual(a,p,this.options.getFormValueAtPath(p),A))return;let k=this.collectUpdateAssociationInitPatches(a,p);if(null==k)return;if("system"===l.source||"default"===l.source||"override"===l.source){var C,P;let e=null==a?void 0:a.model,t=null==e||null==(C=e.subModels)?void 0:C.field;if(t){let l=this.getModelTargetNamePath(e);l&&(0,x.Qc)(l)===h&&(e.setProps({value:M}),null==(P=t.setProps)||P.call(t,{value:M}))}}let j=this.options.getWriteSeq(),E=[...k,{path:p,value:M}];await this.options.setFormValues(f,E,{source:l.source,txId:this.currentRuleTxId||void 0});let R=this.options.getWriteSeq();R!==j&&this.lastRuleWriteByTargetKey.set(h,{source:l.source,priority:l.priority,writeSeq:R})}isTzAwareTargetInterface(e){return"string"==typeof e&&["datetime","createdAt","updatedAt","unixTimestamp"].includes(e)}normalizeDateOnlyToStartOfDayIso(e){let t=String(e||"").trim();if(!t||!/^\d{4}-\d{2}-\d{2}$/.test(t))return e;let l=(0,w.dayjs)(t,"YYYY-MM-DD",!0);return l.isValid()?l.startOf("day").toISOString():e}normalizeResolvedValueForTarget(e,t){var l,n,r;let i=null==e||null==(r=e.model)||null==(n=r.context)||null==(l=n.collectionField)?void 0:l.interface;return this.isTzAwareTargetInterface(i)?"string"==typeof t?this.normalizeDateOnlyToStartOfDayIso(t):Array.isArray(t)?t.map(e=>"string"==typeof e?this.normalizeDateOnlyToStartOfDayIso(e):e):t:t}isPrimitiveAssociationTargetValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}extractAssociationIdentity(e,t){let l=this.getAssociationTargetKeyFields(e),n=1===l.length?l[0]:null,r=e=>{if(null==e)return e;if(this.isPrimitiveAssociationTargetValue(e))return n?e:k;if(!e||"object"!=typeof e)return k;if(n)return void 0===e[n]?k:e[n];let t={};for(let n of l){if(void 0===e[n])return k;t[n]=e[n]}return t};if((0,M.E4)(e)){let e=Array.isArray(t)?t:[t],l=[];for(let t of e){if(null==t)continue;let e=r(t);if(e===k)return k;l.push(e)}return l}let i=Array.isArray(t)?t.find(e=>null!=e):t;return null==i?i:r(i)}isAssociationTargetSemanticallyEqual(e,t,l,n){var r;let i=this.resolveCollectionFieldByNamePath(e,t);if(!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i)))return u().isEqual(l,n);let o=this.extractAssociationIdentity(i,l),a=this.extractAssociationIdentity(i,n);return o===k||a===k?u().isEqual(l,n):u().isEqual(o,a)}resolveCollectionFieldByNamePath(e,t){if(!Array.isArray(t)||!t.length)return null;let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;for(let e=0;e<t.length;e++){var n,r;let i=t[e];if("string"!=typeof i||!i)break;let o=null==l||null==(n=l.getField)?void 0:n.call(l,i);if(!o)break;if(e===t.length-1)return o;if(!(null==o||null==(r=o.isAssociationField)?void 0:r.call(o))||!(null==o?void 0:o.targetCollection))break;if((0,M.E4)(o)){if("number"!=typeof t[e+1])return null;e+=1}if(!(null==(l=o.targetCollection)?void 0:l.getField))break}return null}normalizeResolvedValueForAssociationTarget(e,t,l){var n;let r=this.resolveCollectionFieldByNamePath(e,t);if(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r)))return l;let i=this.getAssociationTargetKeyFields(r),o=1===i.length?i[0]:null,a=e=>{if(null!=e)return o&&this.isPrimitiveAssociationTargetValue(e)?{[o]:e}:e};if((0,M.E4)(r))return(Array.isArray(l)?l:[l]).map(e=>a(e)).filter(e=>null!=e);let s=Array.isArray(l)?l.find(e=>null!=e):l;return null==s?s:a(s)}prepareRuleContext(e){let t=e.getContext(),l=e.getTarget(),n=this.options.tryResolveNamePath(t,l),r=n?(0,x.Qc)(n):null,i=()=>{if(!r)return;let t=this.options.observableBindings.get(r);t&&t.source===e.source&&(t.dispose(),this.options.observableBindings.delete(r))};return{baseCtx:t,targetNamePath:n,targetKey:r,clearDeps:e=>{e.depDisposers.forEach(e=>e()),e.depDisposers=[],e.deps=new Set},disposeBinding:i}}shouldApplyDefaultRuleInCurrentState(e){var t,l,n;return"update"!==(null==(t=(l=this.options).getActionName)?void 0:t.call(l))||(null==(n=this.getItemContext(e))?void 0:n.__is_new__)===!0}isStaleToManyItemContext(e){let t=this.getItemContext(e);return!!Number.isFinite(null==t?void 0:t.index)&&!!Number.isFinite(null==t?void 0:t.length)&&(t.index<0||t.index>=t.length)}getItemContext(e){try{return null==e?void 0:e.item}catch{return}}getRowTargetKey(e,t){var l,n,r,i;let o,a,s=this.getRootCollection()||this.getCollectionFromContext(e);for(let e of t)if("number"!=typeof e){if("string"!=typeof e||!e||!(null==s?void 0:s.getField)||(o=null==s||null==(r=s.getField)?void 0:r.call(s,e),!(null==o||null==(i=o.isAssociationField)?void 0:i.call(o))))break;a=o,s=null==o?void 0:o.targetCollection}let d=(null==a||null==(l=a.targetCollection)?void 0:l.filterTargetKey)??(null==a||null==(n=a.targetCollection)?void 0:n.filterByTk)??(null==a?void 0:a.targetKey);if(Array.isArray(d)){let e=d.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof d&&d?d:"id"}isMismatchedToManyItemContext(e,t){let l=this.getItemContext(e);if(!l)return!1;for(let n=t.length-1;n>=0;n--){if("number"!=typeof t[n])continue;let r=t.slice(0,n+1),i=this.getRowTargetKey(e,r),o=this.options.getFormValueAtPath(r),a=(0,A.r5)(o,i),s=(0,A.r5)(l.value,i);return!!a&&!!s&&a!==s}return!1}shouldRunRule(e,t,l,n){return!(!e.getEnabled()||!t||!l||this.isStaleToManyItemContext(n)||this.isMismatchedToManyItemContext(n,t)||"default"===e.source&&(!this.shouldApplyDefaultRuleInCurrentState(n)||this.options.findExplicitHit(l)))&&!("override"===e.source&&this.options.findUserEditedHit(l))}createRuleCollectorAndContext(e,t){let{baseCtx:l,targetNamePath:n}=t,r=e.getValue(),i=(0,a.isRunJSValue)(r),o={deps:new Set,wildcard:!1};if(e.getCondition&&(0,y.G)(e.getCondition(),o),i?(0,y.Wp)(r,o):(0,y.G)(r,o),n)for(let e of((0,y.Dd)(n,o),this.collectAssociationPrefixPaths(l,n)))(0,y.Dd)(e,o);let s=this.createRuleEvaluationContext(l,o,n);return{collector:o,evalCtx:s,rawValue:r,isRunJS:i}}async evaluateRuleCondition(e,t,l,n,r){let i=e.getCondition;if(!i)return!0;let o=i(),a=o;if(o)try{var s;a=await (null==n||null==(s=n.resolveJsonTemplate)?void 0:s.call(n,o))}catch{a=o}return l===t.runSeq&&(!o||!!(0,v.F)(n,a)||(this.commitRuleDeps(e,t,r),!1))}async resolveRuleValue(e,t,l,n,r){let i=e.getValue();return(0,a.isRunJSValue)(i)?this.resolveRunJSValue(i,t,l,n,r,e):this.resolveTemplateValue(i,t,l,n,r,e)}async resolveRunJSValue(e,t,l,n,r,i){try{let{code:o,version:s}=(0,a.normalizeRunJSValue)(e),d=await (0,a.runjsWithSafeGlobals)(n,o,{version:s});if(!(null==d?void 0:d.success)){if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}return d.value}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}}async resolveTemplateValue(e,t,l,n,r,i){try{var o;return await (null==n||null==(o=n.resolveJsonTemplate)?void 0:o.call(n,e))}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}}commitRuleDeps(e,t,l){let n=new Set(l.deps);l.wildcard&&n.add("fv:*"),this.updateRuleDeps(e,t,n)}isScalarValueTarget(e,t){var l;let n=this.resolveCollectionFieldByNamePath(e,t);return!((null==n||null==(l=n.isAssociationField)?void 0:l.call(n))&&(0,M.E4)(n)||this.isArrayValueCollectionField(n))&&(!!n||!Array.isArray(this.options.getFormValueAtPath(t)))}shouldSkipEmptyArrayAggregateForScalarTarget(e,t,l){return!!Array.isArray(l)&&!(l.length>0)&&this.isScalarValueTarget(e,t)}normalizeUnresolvedToManyAggregateForScalarTarget(e,t,l,n){return void 0===l&&n&&this.isScalarValueTarget(e,t)?Array.isArray(n.arrayValue)&&0===n.arrayValue.length?this.isUserClearedToManyAggregate(n)?{skip:!1,hasValue:!0,value:this.getClearedAggregateValueForScalarTarget(e,t)}:{skip:!0,hasValue:!1}:Array.isArray(n.arrayValue)&&n.arrayValue.length>0?{skip:!0,hasValue:!1}:{skip:!1,hasValue:!1}:{skip:!1,hasValue:!1}}isArrayValueCollectionField(e){var t,l;if(!e||"object"!=typeof e)return!1;let n=e;return!0===n.multiple||"array"===n.type||"array"===((null==(t=n.uiSchema)?void 0:t.type)??(null==(l=n.schema)?void 0:l.type))||["multipleSelect","checkboxGroup","json"].includes("string"==typeof n.interface?n.interface:"")}stringifyAggregateItem(e){if(e&&"object"==typeof e)try{return JSON.stringify(e)}catch{}return String(e)}normalizeAggregateArrayForScalarTarget(e,t,l,n){if(!Array.isArray(l)||!this.isScalarValueTarget(e,t)||!n)return l;let r=l.filter(e=>null!=e);return r.length?1===r.length?r[0]:this.isTextScalarTarget(e,t)?r.map(e=>this.stringifyAggregateItem(e)).join(", "):F:this.isUserClearedToManyAggregate(n)?this.getClearedAggregateValueForScalarTarget(e,t):F}shouldSkipMultiValueAggregateForScalarTarget(e,t,l,n){return!!n&&!!Array.isArray(l)&&!(l.length<=1)&&!!this.isScalarValueTarget(e,t)&&!this.isTextScalarTarget(e,t)}getClearedAggregateValueForScalarTarget(e,t){if(this.isTextScalarTarget(e,t))return""}isUserClearedToManyAggregate(e){var t;return(null==(t=e.lastWrite)?void 0:t.source)==="user"}isTextScalarTarget(e,t){var l,n,r;let i=this.resolveCollectionFieldByNamePath(e,t);if(!i){let e=this.options.getFormValueAtPath(t);return void 0===e||null==e||"string"==typeof e}if((null==i||null==(l=i.isAssociationField)?void 0:l.call(i))||this.isArrayValueCollectionField(i))return!1;let o=i,a=(null==(n=o.uiSchema)?void 0:n.type)??(null==(r=o.schema)?void 0:r.type);return"string"===o.type||"text"===o.type||"string"===a||["input","textarea","email","phone","url","uuid","nanoid","markdown","richText","vditor","password","color"].includes("string"==typeof o.interface?o.interface:"")}getLatestWriteMetaForPath(e){let t=(0,x.Qc)(e),l=this.options.lastWriteMetaByPathKey.get(t);for(let[e,n]of this.options.lastWriteMetaByPathKey.entries())(e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))&&(!l||n.writeSeq>l.writeSeq)&&(l=n);return l}getToManyAggregateSourceInfo(e,t){let l=this.extractSingleLocalFormValuesPath(t);if(!l)return null;let n=(0,x.EA)(l).filter(e=>"object"!=typeof e);if(n.length<2)return null;let r=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==r?void 0:r.getField))return null;let i=[];for(let t=0;t<n.length-1;t++){var o,a;let s=n[t];if("string"!=typeof s)break;let d=null==r||null==(o=r.getField)?void 0:o.call(r,s);if(!(null==d||null==(a=d.isAssociationField)?void 0:a.call(d)))break;if(i.push(s),(0,M.E4)(d)){let t=this.options.getFormValueAtPath(i),n=this.getLocalFormValuesSnapshot(e),r=n&&"object"==typeof n?u().get(n,i):void 0;return{subPath:l,arrayPath:[...i],arrayValue:void 0!==t?t:r,lastWrite:this.getLatestWriteMetaForPath(i)}}if(!(null==(r=d.targetCollection)?void 0:r.getField))break}return null}checkDefaultRuleCanApply(e,t,l,n,r,i){if(void 0===e)return!1;if(this.options.findExplicitHit(l))return n(i),r(),!1;let o=this.options.getFormValueAtPath(t),a=this.options.lastDefaultValueByPathKey.get(l),s=(0,S.Po)(o)||void 0!==a&&u().isEqual(o,a),d=(0,g.isObservable)(e)?(0,g.toJS)(e):e;return!s&&u().isEqual(o,d)?(this.options.lastDefaultValueByPathKey.set(l,d),!1):s}createRuleEvaluationContext(e,t,l){var n;let r,i=this.options.createTrackingFormValues(t),o=new a.FlowContext;try{o.delegate(e)}catch{}let s=null==e||null==(n=e.getPropertyOptions)?void 0:n.call(e,"formValues");s&&"object"==typeof s?o.defineProperty("formValues",{...s,get:()=>i,cache:!1}):o.defineProperty("formValues",{get:()=>i,cache:!1});let d="function"==typeof o.resolveJsonTemplate?o.resolveJsonTemplate.bind(o):void 0;o.defineMethod("resolveJsonTemplate",async l=>{let n=this.createLocalTemplateTokenStore(),r=this.resolveLocalFormValuesTemplates(e,l,t,n),i=r.matched?r.value:l,o=d?await d(i):i;return this.restoreLocalTemplateTokens(o,n)});let u=!1,c=()=>(u||(r=this.buildItemChainValue(e,i,l)??(null==e?void 0:e.item),u=!0),r);return o.defineProperty("item",{get:c,cache:!1}),o}getLocalFormValuesSnapshot(e){try{var t;let l=null==e||null==(t=e.getFormValues)?void 0:t.call(e);if(l&&"object"==typeof l)return l}catch{}let l=this.options.valuesMirror;return(0,g.isObservable)(l)?(0,g.toJS)(l):l}resolveLocalFormValuesPath(e,t){let l=this.getLocalFormValuesSnapshot(e);if(l&&"object"==typeof l)return(0,c.D)(l,t)}recordLocalFormValuesDep(e,t){let l=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(!l.length){t&&(t.wildcard=!0);return}(0,y.Dd)(l,t)}extractSingleLocalFormValuesPath(e){if("string"!=typeof e)return null;let t=e.match(/^\s*\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}\s*$/);return(null==t?void 0:t[1])??null}stringifyTemplateReplacement(e){if(void 0!==e)return e&&"object"==typeof e?JSON.stringify(e):String(e)}createLocalTemplateTokenStore(){let e=new Map,t=0;return{values:e,protect(l){let n=`__NOCObase_FORM_VALUE_LITERAL_${t}__`;return t+=1,e.set(n,l),n}}}restoreLocalTemplateTokens(e,t){if(!t.values.size)return e;if("string"==typeof e){if(t.values.has(e))return t.values.get(e);let l=e;for(let[e,n]of t.values.entries())l.includes(e)&&(l=l.split(e).join(this.stringifyTemplateReplacement(n)??""));return l}if(Array.isArray(e))return e.map(e=>this.restoreLocalTemplateTokens(e,t));if(u().isPlainObject(e)){let l={};for(let[n,r]of Object.entries(e))l[n]=this.restoreLocalTemplateTokens(r,t);return l}return e}resolveLocalFormValuesTemplates(e,t,l,n){if("string"==typeof t){let r=this.extractSingleLocalFormValuesPath(t);if(r){this.recordLocalFormValuesDep(r,l);let i=this.resolveLocalFormValuesPath(e,r);return void 0!==i?{matched:!0,value:n?n.protect(i):i}:{matched:!1,value:t}}let i=!1,o=t.replace(/\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}/g,(t,r)=>{this.recordLocalFormValuesDep(r,l);let o=this.resolveLocalFormValuesPath(e,r),a=this.stringifyTemplateReplacement(o);return void 0===a?t:(i=!0,n?n.protect(a):a)});return{matched:i,value:o}}if(Array.isArray(t)){let r=!1,i=t.map(t=>{let i=this.resolveLocalFormValuesTemplates(e,t,l,n);return i.matched&&(r=!0),i.value});return r?{matched:r,value:i}:{matched:!1,value:t}}if(u().isPlainObject(t)){let r=!1,i={};for(let[o,a]of Object.entries(t)){let t=this.resolveLocalFormValuesTemplates(e,a,l,n);t.matched&&(r=!0),i[o]=t.value}return r?{matched:r,value:i}:{matched:!1,value:t}}return{matched:!1,value:t}}buildItemChainValue(e,t,l){let n=this.getRootCollection()||this.getCollectionFromContext(e),r=(e,t,l,n)=>({index:t,length:l,__is_new__:null==e?void 0:e.__is_new__,__is_stored__:null==e?void 0:e.__is_stored__,value:e,parentItem:n}),i=this.options.getBlockContext(),o=(()=>{try{let e=null==i?void 0:i.item;if(!e||"object"!=typeof e)return;return e.value===(null==i?void 0:i.formValues)?e:void 0}catch{return}})(),a={...r(t,null==o?void 0:o.index,null==o?void 0:o.length,null==o?void 0:o.parentItem),__is_new__:(null==o?void 0:o.__is_new__)??(null==t?void 0:t.__is_new__),__is_stored__:(null==o?void 0:o.__is_stored__)??(null==t?void 0:t.__is_stored__)};if(!l||!Array.isArray(l)||!l.length||!(null==n?void 0:n.getField))return;let s=[],d=[],c=n;for(let e=0;e<l.length;e++){var p,h;let t=l[e];if("string"!=typeof t)break;let n=null==c||null==(p=c.getField)?void 0:p.call(c,t);if(!(null==n||null==(h=n.isAssociationField)?void 0:h.call(n)))break;let r=(0,M.E4)(n);if(d.push(t),r){let t=l[e+1];if("number"==typeof t)d.push(t),e+=1;else if(e!==l.length-1)break}let i=null==n?void 0:n.targetCollection;if(!i)break;s.push({path:[...d],toMany:r}),c=i}let m=e=>{if(e<0)return a;let l=s[e],n=u().get(t,l.path),i=l.path[l.path.length-1],o=l.toMany&&"number"==typeof i,d=o?i:void 0,c=(()=>{if(!l.toMany)return;if(!o)return Array.isArray(n)?n.length:void 0;let e=l.path.slice(0,-1),r=u().get(t,e);return Array.isArray(r)?r.length:void 0})();return r(n,d,c,m(e-1))};return s.length?m(s.length-1):void 0}getFieldIndexSignature(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex);return(Array.isArray(n)?n:[]).filter(e=>"string"==typeof e).join("|")}updateRuleDeps(e,t,l){var n,r;if(t.depDisposers.forEach(e=>e()),t.depDisposers=[],t.deps=l,l.has("fv:*")){let l=(0,g.reaction)(()=>this.options.changeTick.value,()=>this.scheduleRule(e.id));t.depDisposers.push(l)}let i=(()=>{try{return e.getContext()}catch{return}})(),o=(null==i||null==(r=i.model)||null==(n=r.context)?void 0:n.fieldIndex)??(null==i?void 0:i.fieldIndex);if(Array.isArray(o)&&o.some(e=>"string"==typeof e)){let l=(0,g.reaction)(()=>this.getFieldIndexSignature(i),()=>this.scheduleRule(e.id));t.depDisposers.push(l)}for(let n of l){if("fv:*"===n)continue;if(!n.startsWith("fv:")&&!n.startsWith("ctx:")){let l=(0,x.c1)(n),r=(0,g.reaction)(()=>u().get(this.options.valuesMirror,l),()=>this.scheduleRule(e.id));t.depDisposers.push(r);continue}if(n.startsWith("fv:")){let l=n.slice(3),r=(0,x.c1)(l),i=(0,g.reaction)(()=>u().get(this.options.valuesMirror,r),()=>this.scheduleRule(e.id));t.depDisposers.push(i);continue}let l=n.slice(4),r=l.indexOf(":"),o=r>=0?l.slice(0,r):l,a=r>=0?l.slice(r+1):"",s=a?(0,x.EA)(a).filter(e=>"object"!=typeof e):[];if("item"===o){if(s.length){let l=this.options.createTrackingFormValues({deps:new Set,wildcard:!1}),n=(0,g.reaction)(()=>{var t;let n=null==(t=e.getTarget)?void 0:t.call(e),r=n?this.options.tryResolveNamePath(i,n):null,o=this.buildItemChainValue(i,l,r)??(null==i?void 0:i.item);return u().get(o,s)},()=>this.scheduleRule(e.id));t.depDisposers.push(n)}continue}let d=(0,g.reaction)(()=>{let e=i?i[o]:void 0;return s.length?u().get(e,s):e},()=>this.scheduleRule(e.id));t.depDisposers.push(d)}}constructor(e){(0,n._)(this,"options",void 0),(0,n._)(this,"rules",new Map),(0,n._)(this,"lastRuleWriteByTargetKey",new Map),(0,n._)(this,"assignTemplatesByTargetPath",new Map),(0,n._)(this,"formItemTargetPaths",new Set),(0,n._)(this,"updateAssociationByTargetPath",new Map),(0,n._)(this,"pendingRuleIds",new Set),(0,n._)(this,"ruleDebounceUntilById",new Map),(0,n._)(this,"ruleDebounceTimersById",new Map),(0,n._)(this,"defaultRuleIdsByMasterUid",new Map),(0,n._)(this,"defaultRuleMasterDisposers",new Map),(0,n._)(this,"runningRules",!1),(0,n._)(this,"rulesEnabled",!1),(0,n._)(this,"currentRuleTxId",null),this.options=e}}class R{syncAssignRules(e){this.ruleEngine.syncAssignRules(e)}get formValues(){return this.disposed||this.formPatcher.patch(this.getForm()),this.formValuesProxy}getFormValuesSnapshot(){if(!this.disposed){let e=this.getForm();this.formPatcher.patch(e)}return this.getForm().getFieldsValue(!0)}toMirrorSnapshot(e){let t=e=>u().cloneDeepWith(e,e=>{if((0,g.isObservable)(e)){let l=(0,g.toJS)(e);if(l!==e)return t(l)}if(Array.isArray(e)&&"function"!=typeof e.constructor){let l=Array(e.length);for(let n=0;n<e.length;n++)Object.hasOwn(e,n)&&(l[n]=t(e[n]));return l}if(e&&"object"==typeof e&&!(Array.isArray(e)||u().isPlainObject(e)))return e});return t(e)}canApplyDefaultValuePatch(e,t){if(!(null==e?void 0:e.length)||void 0===t)return!1;let l=(0,x.Qc)(e),n=this.getFormValueAtPath(e),r=this.lastDefaultValueByPathKey.get(l),i=(0,g.isObservable)(t)?(0,g.toJS)(t):t,o=(0,g.isObservable)(n)?(0,g.toJS)(n):n,a=void 0!==r&&u().isEqual(o,r);if(this.findExplicitHit(l)&&!a)return!1;let s=(0,S.Po)(n)||a;return!s&&u().isEqual(n,i)?(this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(i)),!1):s}canApplyOverrideValuePatch(e){return!!(null==e?void 0:e.length)&&!this.findUserEditedHit((0,x.Qc)(e))}recordDefaultValuePatch(e,t){if(!(null==e?void 0:e.length))return;let l=(0,x.Qc)(e),n=arguments.length>=2?(0,g.isObservable)(t)?(0,g.toJS)(t):t:this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(n));let r=this.getFormValueAtPath(e),i=(0,g.isObservable)(r)?(0,g.toJS)(r):r;u().isEqual(i,n)&&this.clearExplicitForDefaultPatch(l)}getFormValueAtPath(e){var t,l;let n=null==(t=(l=this).getForm)?void 0:t.call(l);if(n&&"function"==typeof n.getFieldValue)return n.getFieldValue(e);if(n&&"function"==typeof n.getFieldsValue){let t=n.getFieldsValue(!0);return u().get(t,e)}}mount(e){var t,l;if(this.disposed)return;this.formPatcher.patch(this.getForm());let n=null==(l=this.model)||null==(t=l.flowEngine)?void 0:t.emitter;if(n&&(this.mountedListener||this.unmountedListener||(this.mountedListener=e=>{let{model:t}=e;this.indexMountedFieldModelTree(t),this.ruleEngine.onModelMounted(t)},this.unmountedListener=e=>{let{model:t}=e;this.unindexMountedFieldModelTree(t),this.ruleEngine.onModelUnmounted(t)},n.on("model:mounted",this.mountedListener),n.on("model:unmounted",this.unmountedListener)),this.rebuildMountedFieldModelIndex(),null==e?void 0:e.sync)){let e=this.getFormValuesSnapshot();e&&"object"==typeof e&&(u().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.bumpChangeTick()),this.ruleEngine.enable()}}dispose(){var e,t;if(this.disposed)return;this.disposed=!0,this.formPatcher.restore();let l=null==(t=this.model)||null==(e=t.flowEngine)?void 0:e.emitter;for(let e of(l&&this.mountedListener&&this.unmountedListener&&(l.off("model:mounted",this.mountedListener),l.off("model:unmounted",this.unmountedListener)),this.ruleEngine.dispose(),this.mountedFieldModelsByPathKey.clear(),this.observableBindings.values()))e.dispose();this.observableBindings.clear(),this.txWriteCounts.clear()}resetAfterFormReset(){if(this.disposed)return;for(let e of(this.explicitSet.clear(),this.userEditedSet.clear(),this.lastDefaultValueByPathKey.clear(),this.lastWriteMetaByPathKey.clear(),this.txWriteCounts.clear(),this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken+=1,this.observableBindings.values()))e.dispose();this.observableBindings.clear();let e=this.getFormValuesSnapshot();for(let e of Object.keys(this.valuesMirror))delete this.valuesMirror[e];e&&"object"==typeof e&&u().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.writeSeq+=1,this.bumpChangeTick(),this.ruleEngine.rescheduleAllRules()}resetUserEditedState(){this.disposed||(this.userEditedSet.clear(),this.ruleEngine.rescheduleAllRules())}isSuppressed(){return this.suppressFormCallbackDepth>0}handleFormFieldsChange(e){if(this.disposed)return;let t=this.getForm();if(!t.getFieldValue)return;let l=[],n=new Set,r=!1,i=!1;for(let o of e||[]){let e=null==o?void 0:o.name,a=this.normalizeObservedNamePath(e);if(!(null==a?void 0:a.length))continue;let s=t.getFieldValue(a),d=u().get(this.valuesMirror,a);if(!u().isEqual(s,d)&&(i||(this.writeSeq+=1,i=!0),u().set(this.valuesMirror,a,this.toMirrorSnapshot(s)),l.push(a),(null==o?void 0:o.touched)===!0&&!this.shouldIgnoreSyntheticTouchedInit(a,d,s))){let e=(0,x.Qc)(a);this.shouldKeepDefaultPathValueEnabled(a,s)||(n.add(e),r=!0)}}if(!l.length)return;let o=this.isSuppressed();if(!o&&n.size)for(let e of n)this.markExplicit(e),this.markUserEdited(e);if(this.bumpChangeTick(),o)return;let a=r?"user":"system",s=this.writeSeq;for(let e of l)this.lastWriteMetaByPathKey.set((0,x.Qc)(e),{source:a,writeSeq:s});this.lastObservedChangedPaths=l,this.lastObservedSource=a;let d=++this.lastObservedToken;queueMicrotask(()=>{this.disposed||this.lastObservedToken===d&&(this.lastObservedChangedPaths=null,this.lastObservedSource=null)})}shouldIgnoreSyntheticTouchedInit(e,t,l){if(!(null==e?void 0:e.length)||void 0!==t||!(0,S.Po)(l))return!1;for(let t=e.length-1;t>=0;t--){if("number"!=typeof e[t])continue;let l=e.slice(0,t+1),n=this.getFormValueAtPath(l);return!!(null==n?void 0:n.__is_new__)}return!1}isDeletedArrayItemPath(e,t){let l=Array.isArray(e)?e:(0,x.c1)(e);if(!(null==l?void 0:l.length))return!1;for(let e=l.length-1;e>=0;e--){if("number"!=typeof l[e])continue;let n=l.slice(0,e+1);return void 0===u().get(t,n)}return!1}pruneDeletedArrayItemState(e){for(let t of Array.from(this.explicitSet))this.isDeletedArrayItemPath(t,e)&&this.explicitSet.delete(t);for(let t of Array.from(this.userEditedSet))this.isDeletedArrayItemPath(t,e)&&this.userEditedSet.delete(t);for(let t of Array.from(this.lastDefaultValueByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastDefaultValueByPathKey.delete(t);for(let t of Array.from(this.lastWriteMetaByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastWriteMetaByPathKey.delete(t);for(let[t,l]of Array.from(this.observableBindings.entries()))this.isDeletedArrayItemPath(t,e)&&(l.dispose(),this.observableBindings.delete(t))}getArrayItemTargetKey(e){var t,l,n,r,i,o;let a,s,d=null==(l=this.model)||null==(t=l.context)?void 0:t.collection;for(let t of e||[])if("number"!=typeof t){if("string"!=typeof t||!(null==d?void 0:d.getField)||(a=null==d||null==(i=d.getField)?void 0:i.call(d,t),!(null==a||null==(o=a.isAssociationField)?void 0:o.call(a))))break;s=a,d=null==a?void 0:a.targetCollection}let u=(null==s||null==(n=s.targetCollection)?void 0:n.filterTargetKey)??(null==s||null==(r=s.targetCollection)?void 0:r.filterByTk)??(null==s?void 0:s.targetKey);if(Array.isArray(u)){let e=u.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof u&&u?u:"id"}getArrayItemIdentity(e,t){return(0,A.r5)(e,this.getArrayItemTargetKey(t))}reconcileArrayItemState(e,t,l){let n=new Set;for(let r of e||[]){if(!(null==r?void 0:r.length))continue;let e=(0,x.Qc)(r);if(n.has(e))continue;n.add(e);let i=u().get(this.valuesMirror,r),o=this.getObservedChangedValue(r,t,l);if(!Array.isArray(i)||!Array.isArray(o))continue;let a=new Map;o.forEach((e,t)=>{let l=this.getArrayItemIdentity(e,r);l&&a.set(l,t)}),a.size&&(this.reconcileArrayItemSet(this.explicitSet,r,i,a),this.reconcileArrayItemSet(this.userEditedSet,r,i,a),this.reconcileArrayItemMap(this.lastDefaultValueByPathKey,r,i,a),this.reconcileArrayItemMap(this.lastWriteMetaByPathKey,r,i,a),this.reconcileObservableBindings(r,i,a))}}getReconciledArrayItemPath(e,t,l,n){let r=(0,x.c1)(e);if(r.length<=t.length)return{action:"keep"};for(let e=0;e<t.length;e++)if(r[e]!==t[e])return{action:"keep"};let i=r[t.length];if("number"!=typeof i)return{action:"keep"};let o=this.getArrayItemIdentity(l[i],t);if(!o)return{action:"keep"};let a=n.get(o);if(null==a)return{action:"delete"};if(a===i)return{action:"keep"};let s=[...r];return s[t.length]=a,{action:"move",key:(0,x.Qc)(s)}}reconcileArrayItemSet(e,t,l,n){let r=new Set,i=!1;for(let o of e){let e=this.getReconciledArrayItemPath(o,t,l,n);if("delete"===e.action){i=!0;continue}if("move"===e.action){i=!0,r.add(e.key);continue}r.add(o)}if(i)for(let t of(e.clear(),r))e.add(t)}reconcileArrayItemMap(e,t,l,n){let r=new Map,i=!1;for(let[o,a]of e){let e=this.getReconciledArrayItemPath(o,t,l,n);if("delete"===e.action){i=!0;continue}if("move"===e.action){i=!0,r.set(e.key,a);continue}r.set(o,a)}if(i)for(let[t,l]of(e.clear(),r))e.set(t,l)}reconcileObservableBindings(e,t,l){let n=new Map,r=!1;for(let[i,o]of this.observableBindings){let a=this.getReconciledArrayItemPath(i,e,t,l);if("delete"===a.action){r=!0,o.dispose();continue}if("move"===a.action){r=!0,o.pathKey=a.key,n.set(a.key,o);continue}n.set(i,o)}if(r)for(let[e,t]of(this.observableBindings.clear(),n))this.observableBindings.set(e,t)}getObservedChangedValue(e,t,l){if(u().has(l,e))return u().get(l,e);if((null==e?void 0:e.length)===1){let l=e[0];if(("string"==typeof l||"number"==typeof l)&&t&&Object.prototype.hasOwnProperty.call(t,l))return t[l]}return u().get(l,e)}getObservedSnapshot(e,t){if(!e||"object"!=typeof e)return t;if(!t||"object"!=typeof t)return e;let l=t;for(let n of Object.keys(e))u().has(l,[n])||(l===t&&(l=Array.isArray(t)?[...t]:{...t}),u().set(l,[n],e[n]));return l}handleFormValuesChange(e,t){if(this.disposed||this.isSuppressed())return;let l=Object.keys(e||{}).map(e=>[e]),n=this.lastObservedChangedPaths&&this.lastObservedChangedPaths.length?this.lastObservedChangedPaths:l,r=this.lastObservedSource??"user";this.lastObservedChangedPaths=null,this.lastObservedSource=null;let i=this.getFormValuesSnapshot(),o=i&&"object"==typeof i?i:t&&"object"==typeof t?t:e,a=this.getObservedSnapshot(e,o);this.reconcileArrayItemState([...n,...l],e,a),this.pruneDeletedArrayItemState(a);let s=this.deriveExplicitPaths(n,e,a,this.valuesMirror).filter(e=>!this.isDeletedArrayItemPath(e,a)),d=!1,c=!1,p=[];for(let t of n){if(!(null==t?void 0:t.length))continue;let l=this.getObservedChangedValue(t,e,a),n=u().get(this.valuesMirror,t);u().isEqual(n,l)||(c||(this.writeSeq+=1,c=!0),u().set(this.valuesMirror,t,this.toMirrorSnapshot(l)),d=!0,p.push(t))}d&&this.bumpChangeTick();let h=[];for(let e of s)this.shouldKeepDefaultPathEnabled(e,a)||h.push(e);for(let e of h){let t=(0,x.Qc)(e);this.markExplicit(t),"user"===r&&this.markUserEdited(t)}if(d){let e=this.writeSeq;for(let t of p)(null==t?void 0:t.length)&&this.lastWriteMetaByPathKey.set((0,x.Qc)(t),{source:r,writeSeq:e})}let m=(0,S.ao)();this.emitFormValuesChange({source:r,txId:m,changedPaths:n,changedValues:e,allValues:a,allValuesSnapshot:a})}deriveExplicitPaths(e,t,l,n){let r=[],i=new Set;for(let o of e||[]){if(!(null==o?void 0:o.length))continue;let e=u().get(n,o),a=this.getObservedChangedValue(o,t,l);this.collectExplicitDiffPaths(e,a,o,r,i)}return r}collectExplicitDiffPaths(e,t,l,n,r){if(u().isEqual(e,t))return 0;let i=Array.isArray(e),o=Array.isArray(t);if(i||o){if(i&&o){let i=Math.min(e.length,t.length),o=0;for(let a=0;a<i;a++)o+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,r);return e.length!==t.length?o+ +!!this.pushExplicitPath(l,n,r):o}return+!!this.pushExplicitPath(l,n,r)}let a=this.isPlainObjectValue(e),s=this.isPlainObjectValue(t);if(a||s){if(a&&s){let i=new Set([...Object.keys(e),...Object.keys(t)]),o=0;for(let a of i)o+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,r);return 0===o&&this.isObjectCleared(e,t)?+!!this.pushExplicitPath(l,n,r):o}this.isObjectCleared(e,t)}return+!!this.pushExplicitPath(l,n,r)}pushExplicitPath(e,t,l){if(!(null==e?void 0:e.length))return!1;let n=(0,x.Qc)(e);return!(!n||l.has(n))&&(l.add(n),t.push([...e]),!0)}isPlainObjectValue(e){return u().isPlainObject(e)}isObjectCleared(e,t){return!!this.isPlainObjectValue(e)&&!!(null==t||this.isPlainObjectValue(t)&&0===Object.keys(t).length)}async setFormValues(e,t,l){var n,r,i,o;if(this.disposed)return;let a=null==(n=(r=this).getForm)?void 0:n.call(r);if(!a)return;let s=(null==l?void 0:l.source)??"system",d=(null==l?void 0:l.triggerEvent)!==!1,c=(null==l?void 0:l.txId)??(0,S.ao)(),p=(null==l?void 0:l.markExplicit)??("default"!==s&&"linkage"!==s),h=void 0===(null==l?void 0:l.txId),m="linkage"===s&&Number.isFinite(Number(null==l?void 0:l.linkageScopeDepth))?Number(null==l?void 0:l.linkageScopeDepth):0,f="linkage"===s&&"string"==typeof(null==l?void 0:l.linkageTxId)&&l.linkageTxId?String(l.linkageTxId):void 0,y=e=>{if("linkage"!==s||!f)return!1;let t=this.lastWriteMetaByPathKey.get(e);return!!t&&"linkage"===t.source&&!!t.linkageTxId&&t.linkageTxId===f&&(Number.isFinite(Number(t.linkageScopeDepth))?Number(t.linkageScopeDepth):0)>m},b=e=>"linkage"===s?{source:s,writeSeq:e,linkageScopeDepth:m,linkageTxId:f}:{source:s,writeSeq:e},w=e=>"linkage"===s&&f?{...e,linkageTxId:f}:e;try{let l=[];if(!Array.isArray(t)){let e=Object.entries(t||{}).map(e=>{let[t,l]=e;return[t,this.toMirrorSnapshot(l)]}).filter(e=>{let[t,l]=e;return!y(t)&&!u().isEqual(this.getFormValueAtPath([t]),l)}),l=Object.fromEntries(e),n=e.map(e=>{let[t]=e;return t});if(!n.length)return;n.length&&(this.writeSeq+=1),this.suppressFormCallbackDepth++;try{for(let[t,l]of e)"function"==typeof a.setFieldValue?a.setFieldValue(t,l):"function"==typeof a.setFields?a.setFields([{name:t,value:l}]):null==(i=a.setFieldsValue)||i.call(a,{[t]:l}),u().set(this.valuesMirror,[t],this.toMirrorSnapshot(l)),this.syncMountedFieldModelValue([t],l);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let r=this.writeSeq;for(let e of n)this.lastWriteMetaByPathKey.set(e,b(r));if(p)for(let e of n)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if(d){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(w({source:s,txId:c,changedPaths:n.map(e=>[e]),changedValues:l,allValues:e,allValuesSnapshot:e}))}return}let n=new Map,r=0;for(let l of t){let t=null==l?void 0:l.condition;if(t&&!(0,v.F)(e,t))continue;let i=this.resolveNamePath(e,l.path),o=(0,x.Qc)(i),a=l.value,s=this.toMirrorSnapshot(a);if(y(o))continue;let d=this.getFormValueAtPath(i);u().isEqual(d,s)||(r+=1,n.set(o,{order:r,namePath:i,value:s,rawValue:a,pathKey:o}))}let h=Array.from(n.values()).sort((e,t)=>e.order-t.order).map(e=>({namePath:e.namePath,value:e.value,rawValue:e.rawValue,pathKey:e.pathKey}));if(!h.length)return;let M=this.txWriteCounts.get(c)||new Map;this.txWriteCounts.set(c,M);let A=[];for(let e of h){let t=(M.get(e.pathKey)||0)+1;M.set(e.pathKey,t),t>S.li||A.push(e)}if(!A.length)return;this.writeSeq+=1;let F=this.writeSeq;for(let{pathKey:e,rawValue:t}of A)if(!(0,g.isObservable)(t)){let t=this.observableBindings.get(e);t&&(t.dispose(),this.observableBindings.delete(e))}this.suppressFormCallbackDepth++;try{for(let{namePath:e,value:t}of A)null==(o=a.setFieldValue)||o.call(a,e,t),u().set(this.valuesMirror,e,this.toMirrorSnapshot(t)),this.syncMountedFieldModelValue(e,t),l.push(e);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}for(let{pathKey:e}of A)this.lastWriteMetaByPathKey.set(e,b(F));if(p)for(let{pathKey:e}of A)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if("default"===s)for(let{namePath:e,pathKey:t}of A){let l=this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(t,this.toMirrorSnapshot(l))}for(let{rawValue:t,pathKey:l}of A){if(!(0,g.isObservable)(t))continue;let n=t,r={source:s,pathKey:l,dispose:()=>{}},i=(0,g.observe)(n,()=>{let t=r.pathKey;this.applyBoundValue(e,(0,x.c1)(t),t,(0,g.toJS)(n),s,m,f)});r.dispose=i;let o=this.observableBindings.get(l);o&&o.dispose(),this.observableBindings.set(l,r)}if(d){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(w({source:s,txId:c,changedPaths:l,changedValues:{},allValues:e,allValuesSnapshot:e}))}}finally{h&&this.txWriteCounts.delete(c)}}applyBoundValue(e,t,l,n,r,i,o){var a,s,d;if(this.disposed)return;let c=null==(a=(s=this).getForm)?void 0:a.call(s);if(!c||"override"===r&&this.findUserEditedHit(l))return;let p=this.toMirrorSnapshot(n),h=u().get(this.valuesMirror,t);if(u().isEqual(h,p))return;this.writeSeq+=1;let m=this.writeSeq;this.suppressFormCallbackDepth++;try{null==(d=c.setFieldValue)||d.call(c,t,p),u().set(this.valuesMirror,t,this.toMirrorSnapshot(p)),this.syncMountedFieldModelValue(t,p),this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let f="linkage"===r?{source:r,writeSeq:m,linkageScopeDepth:Number.isFinite(Number(i))?Number(i):0,linkageTxId:"string"==typeof o&&o?o:void 0}:{source:r,writeSeq:m};this.lastWriteMetaByPathKey.set(l,f);let g=(0,S.ao)(),v=this.getFormValuesSnapshot(),y={source:r,txId:g,changedPaths:[t],changedValues:{},allValues:v,allValuesSnapshot:v};if("linkage"===r&&o&&(y.linkageTxId=o),this.emitFormValuesChange(y),"default"===r&&this.isExplicit(l)||"override"===r&&this.findUserEditedHit(l)){let e=this.observableBindings.get(l);e&&(e.dispose(),this.observableBindings.delete(l))}"default"===r&&this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(this.getFormValueAtPath(t)))}resolveNamePath(e,t){let l=this.tryResolveNamePath(e,t);if(!l)throw Error(`Failed to resolve path '${String(t)}'`);return l}tryResolveNamePath(e,t){var l,n;let r=(null==e||null==(n=e.model)||null==(l=n.context)?void 0:l.fieldIndex)??(null==e?void 0:e.fieldIndex);return(0,x.IJ)(t,r)}bumpChangeTick(){this.changeTick.value+=1}emitFormValuesChange(e){var t,l,n,r;null==(t=(l=this.model).dispatchEvent)||t.call(l,"formValuesChange",e,{debounce:!0}),null==(r=this.model.emitter)||null==(n=r.emit)||n.call(r,"formValuesChange",e)}syncMountedFieldModelValue(e,t){let l=(0,x.Qc)(e);if(!l)return;let n=this.mountedFieldModelsByPathKey.get(l);if(!(null==n?void 0:n.size))return;let r=new Set;for(let e of Array.from(n))this.syncMountedFieldModelValueForModel(e,t,r)}syncMountedFieldModelValueForModel(e,t,l){var n,r,i;if(!e||l.has(e)||(l.add(e),!this.isMountedModelInThisForm(e)))return;let o={value:t};null==(n=e.setProps)||n.call(e,o);let a=null==(r=e.subModels)?void 0:r.field;null==a||null==(i=a.setProps)||i.call(a,o)}rebuildMountedFieldModelIndex(){var e,t;this.mountedFieldModelsByPathKey.clear();let l=null==(t=this.model)||null==(e=t.context)?void 0:e.engine;l&&"function"==typeof l.forEachModel&&l.forEachModel(e=>{this.indexMountedFieldModelTree(e)})}indexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.indexMountedFieldModel(e))}unindexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.unindexMountedFieldModel(e))}visitModelAndForks(e,t){if(!e)return;let l=new Set,n=e=>{var r;if(!e||l.has(e))return;l.add(e),t(e);let i=e.forks;null==i||null==(r=i.forEach)||r.call(i,e=>n(e))};n(e)}indexMountedFieldModel(e){if(!this.isMountedModelInThisForm(e))return;let t=new Set;for(let l of this.getMountedModelNamePaths(e)){let e=(0,x.Qc)(l);e&&t.add(e)}if(t.size)for(let l of(this.unindexMountedFieldModel(e),this.mountedFieldModelPathKeys.set(e,t),t)){let t=this.mountedFieldModelsByPathKey.get(l)||new Set;t.add(e),this.mountedFieldModelsByPathKey.set(l,t)}}unindexMountedFieldModel(e){let t=this.mountedFieldModelPathKeys.get(e);if(t){for(let l of t){let t=this.mountedFieldModelsByPathKey.get(l);t&&(t.delete(e),t.size||this.mountedFieldModelsByPathKey.delete(l))}this.mountedFieldModelPathKeys.delete(e)}}isMountedModelInThisForm(e){var t;let l=null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.model.uid)}getMountedModelNamePaths(e){var t,l;let n=[],r=e=>{let t=this.normalizeNamePathValue(e);(null==t?void 0:t.length)&&n.push(t)};r(null==(t=e.context)?void 0:t.fieldPathArray);let i="function"==typeof e.getProps?e.getProps():e.props;i&&"object"==typeof i&&r(i.name);try{let t=null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init");t&&"object"==typeof t&&r(t.fieldPath)}catch{}let o=new Set;return n.filter(e=>{let t=(0,x.Qc)(e);return!(!t||o.has(t))&&(o.add(t),!0)})}normalizeNamePathValue(e){if(Array.isArray(e)){let t=e.filter(e=>"string"==typeof e||"number"==typeof e);return t.length===e.length?t:null}return"number"==typeof e?[e]:"string"==typeof e&&e?(0,x.c1)(e):null}markExplicit(e){if(this.explicitSet.has(e))return;this.explicitSet.add(e);let t=this.shouldPreserveDescendantDefaultsOnExplicit(e);for(let l of Array.from(this.lastDefaultValueByPathKey.keys())){let n=l.startsWith(`${e}.`)||l.startsWith(`${e}[`);(l===e||!t&&n)&&this.lastDefaultValueByPathKey.delete(l)}for(let[e,t]of Array.from(this.observableBindings.entries()))"default"===t.source&&this.isExplicit(e)&&(t.dispose(),this.observableBindings.delete(e))}markUserEdited(e){if(!this.userEditedSet.has(e))for(let[t,l]of(this.userEditedSet.add(e),Array.from(this.observableBindings.entries())))"override"===l.source&&this.findUserEditedHit(t)&&(l.dispose(),this.observableBindings.delete(t))}normalizeObservedNamePath(e){if(Array.isArray(e))return e;if("number"==typeof e)return[e];if("string"!=typeof e||!e)return null;let t=(0,x.c1)(e);return t.length?t:[e]}clearExplicitForDefaultPatch(e){for(let t of Array.from(this.explicitSet))(t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`))&&this.explicitSet.delete(t)}shouldPreserveDescendantDefaultsOnExplicit(e){return Array.isArray(this.getFormValueAtPath((0,x.c1)(e)))}shouldKeepDefaultPathEnabled(e,t){return this.shouldKeepDefaultPathValueEnabled(e,u().get(t,e))}shouldKeepDefaultPathValueEnabled(e,t){let l=(0,x.Qc)(e),n=this.lastDefaultValueByPathKey.get(l);if(void 0===n)return!1;let r=(0,g.isObservable)(t)?(0,g.toJS)(t):t;return u().isEqual(r,n)}isExplicit(e){return!!this.findExplicitHit(e)}findExplicitHit(e){if(this.explicitSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.explicitSet.has(n)&&"number"!=typeof t[e+1])return n}return null}findUserEditedHit(e){if(this.userEditedSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.userEditedSet.has(n)&&"number"!=typeof t[e+1])return n}for(let t of this.userEditedSet)if(this.isDescendantPathKey(t,e))return t;return null}isDescendantPathKey(e,t){if(!e||!t||e===t)return!1;let l=(0,x.c1)(e),n=(0,x.c1)(t);return!(l.length<=n.length)&&n.every((e,t)=>l[t]===e)}constructor(e){(0,n._)(this,"model",void 0),(0,n._)(this,"getForm",void 0),(0,n._)(this,"valuesMirror",(0,g.observable)({})),(0,n._)(this,"explicitSet",new Set),(0,n._)(this,"userEditedSet",new Set),(0,n._)(this,"lastDefaultValueByPathKey",new Map),(0,n._)(this,"lastWriteMetaByPathKey",new Map),(0,n._)(this,"observableBindings",new Map),(0,n._)(this,"changeTick",g.observable.ref(0)),(0,n._)(this,"txWriteCounts",new Map),(0,n._)(this,"writeSeq",0),(0,n._)(this,"disposed",!1),(0,n._)(this,"suppressFormCallbackDepth",0),(0,n._)(this,"lastObservedChangedPaths",null),(0,n._)(this,"lastObservedSource",null),(0,n._)(this,"lastObservedToken",0),(0,n._)(this,"formValuesProxy",void 0),(0,n._)(this,"mountedFieldModelsByPathKey",new Map),(0,n._)(this,"mountedFieldModelPathKeys",new WeakMap),(0,n._)(this,"mountedListener",void 0),(0,n._)(this,"unmountedListener",void 0),(0,n._)(this,"formPatcher",void 0),(0,n._)(this,"ruleEngine",void 0),this.model=e.model,this.getForm=e.getForm,this.formPatcher=b({isSuppressed:()=>this.isSuppressed(),getCallerContext:()=>{var e;return null==(e=this.model)?void 0:e.context},setFormValues:this.setFormValues.bind(this)}),this.ruleEngine=new E({getBlockModelUid:()=>{var e;return String(null==(e=this.model)?void 0:e.uid)},getActionName:()=>{var e,t,l,n;return(null==(t=this.model)||null==(e=t.getAclActionName)?void 0:e.call(t))??(null==(n=this.model)||null==(l=n.context)?void 0:l.actionName)},getBlockContext:()=>{var e;return null==(e=this.model)?void 0:e.context},getEngine:()=>{var e,t;return null==(t=this.model)||null==(e=t.context)?void 0:e.engine},getEngineModel:e=>{var t,l,n,r;return(null==(r=this.model)||null==(n=r.context)||null==(l=n.engine)||null==(t=l.getModel)?void 0:t.call(l,e))??null},isDisposed:()=>this.disposed,valuesMirror:this.valuesMirror,changeTick:this.changeTick,getWriteSeq:()=>this.writeSeq,txWriteCounts:this.txWriteCounts,createTrackingFormValues:e=>(0,y.x3)({valuesMirror:this.valuesMirror,basePath:[],collector:e,getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)}),tryResolveNamePath:(e,t)=>this.tryResolveNamePath(e,t),getFormValueAtPath:e=>this.getFormValueAtPath(e),setFormValues:(e,t,l)=>this.setFormValues(e,t,l),findExplicitHit:e=>this.findExplicitHit(e),findUserEditedHit:e=>this.findUserEditedHit(e),lastDefaultValueByPathKey:this.lastDefaultValueByPathKey,lastWriteMetaByPathKey:this.lastWriteMetaByPathKey,observableBindings:this.observableBindings}),this.formValuesProxy=(0,y.x3)({valuesMirror:this.valuesMirror,basePath:[],getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)})}}function I(e,t){let l=Array.isArray(e)?e:[],n=new Set,r=e=>{var l,n,r;if(!t||"function"!=typeof t.getField||"string"!=typeof e||!e.includes("."))return null;let i=e.split(".").filter(Boolean);if(i.length<2)return null;let o=t,a=[],s=null,d=null;for(let e=0;e<i.length-1;e++){let t=i[e],r=null==o||null==(l=o.getField)?void 0:l.call(o,t);if(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r))||!(null==r?void 0:r.targetCollection))break;a.push(t),s=a.join("."),d=r,o=r.targetCollection}if(s&&d){let e=i[i.length-1],t=(null==d?void 0:d.targetKey)??(null==d||null==(r=d.targetCollection)?void 0:r.filterTargetKey)??"id",l=Array.isArray(t)?t.filter(e=>"string"==typeof e&&!!e):"string"==typeof t&&t?[t]:["id"];if("string"==typeof e&&l.includes(e))return null}return s};for(let e of l){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=r(t);l&&n.add(l)}return Array.from(n)}var T=l(71712);let _={formModelSettings:new Set(["layout","assignRules"]),eventSettings:new Set(["linkageRules"])},D="nb-flow-keep-mobile-horizontal",N=(0,o.css)`
|
|
1260
|
+
`;return(0,n.jsxs)("div",{style:{maxHeight:300,overflowY:"auto"},children:[e.map(e=>(0,n.jsx)("div",{role:"option",onClick:()=>x(e.value),className:l,children:f(e.label)},e.value)),(0,n.jsx)(o.A,{style:{margin:"4px 0"}}),t.map(e=>(0,n.jsx)("div",{role:"option",className:l,onClick:()=>x(e.value),title:f(e.label),children:f(e.label)},e.value))]})};return(0,n.jsxs)(a.A.Compact,{style:{...h.style,width:"100%"},children:[(0,n.jsx)(s.A,{options:b,open:v,onDropdownVisibleChange:y,...h,allowClear:!1,style:{width:"100%",minWidth:100,maxWidth:["past","next","exact",void 0].includes(null==t?void 0:t.type)?100:null},value:(null==t?void 0:t.type)||"exact",onChange:x,dropdownRender:w}),["past","next"].includes(null==t?void 0:t.type)&&[(0,n.jsx)(d.A,{style:{flex:1},value:null==t?void 0:t.number,onChange:e=>{l({...t,number:e})}},"number"),(0,n.jsx)(s.A,{value:null==t?void 0:t.unit,style:{minWidth:130,maxWidth:140},onChange:e=>{l({...t,unit:e})},options:[{value:"day",label:f("Day")},{value:"week",label:f("Calendar week")},{value:"month",label:f("Calendar Month")},{value:"year",label:f("Calendar Year")}],popupMatchSelectWidth:!0},"unit")],((null==t?void 0:t.type)==="exact"||!(null==t?void 0:t.type))&&(0,n.jsx)(A,{...h,value:t,onChange:l})]})}},32644(e,t,l){l.d(t,{S:()=>o});let n=new Set(["$match","$notMatch","$anyOf","$noneOf","$childIn","$childNotIn","$in","$notIn"]);function r(e){return!!e&&"object"==typeof e&&!Array.isArray(e)&&"type"in e}function i(e){return null==e||"string"==typeof e&&""===e.trim()}function o(e,t){if(!e)return t;if("$dateBetween"===e){if(null==t||r(t))return t;if(Array.isArray(t)){if(0===t.length)return t;let e=t[0],l=t.length>1?t[1]:void 0,n=i(e),r=i(l);return(1!==t.length||n)&&(n||!r)?n&&!r?[l,l]:t:[e,e]}return[t,t]}return n.has(e)?null==t||Array.isArray(t)?t:"string"==typeof t&&""===t.trim()?[]:[t]:t}},71616(e,t,l){l.d(t,{EditFormModel:()=>p});var n=l(50467),r=l(74848),i=l(11869),o=l(58929),a=l(84626),s=l(40098);l(96540);var d=l(15892),u=l(96491),c=l(84759);class p extends u.F4{createResource(e,t){var l,n;if((null==(l=this.association)?void 0:l.type)==="hasOne"||(null==(n=this.association)?void 0:n.type)==="belongsTo"||Object.keys(t).includes("filterByTk")){let e=this.context.createResource(i.SingleRecordResource);return e.isNewRecord=!1,e}let r=this.context.createResource(i.MultiRecordResource);return r.setPageSize(1),r}isMultiRecordResource(){return this.resource instanceof i.MultiRecordResource}getCurrentRecord(){let e=this.resource.getData();return Array.isArray(e)?e[0]:e}hasAvailableData(){return this.resource.hasData()}getAclActionName(){return"update"}async submitHandler(e,t,n){let{submitHandler:r}=await Promise.resolve().then(l.bind(l,53831));await r(e,t,n)}async submit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,{submitHandler:n}=await Promise.resolve().then(l.bind(l,53831));await n(this.context,e,t)}renderComponent(){var e,t;let{colon:l,labelAlign:n,labelWidth:s,labelWrap:d,layout:c}=this.props,p=!!this.context.flowSettingsEnabled,h=this.hasAvailableData(),m=!p&&!h,{heightMode:f,height:g}=this.decoratorProps,v=this.resource.loading||h?this.isMultiRecordResource()&&this.resource.getMeta("count")>1?(0,r.jsx)("div",{style:{textAlign:"center",marginTop:16},children:(0,r.jsx)(o.A,{simple:!0,pageSize:1,showSizeChanger:!1,defaultCurrent:this.resource.getPage(),total:this.resource.getTotalPage(),onChange:this.handlePageChange,style:{display:"inline-block"}})}):null:(0,r.jsx)("div",{style:{textAlign:"center",marginTop:16,color:null==(t=this.context)||null==(e=t.themeToken)?void 0:e.colorTextDescription},children:this.translate("No available data currently")});return(0,r.jsx)(u.JU,{model:this,gridModel:this.subModels.grid,layoutProps:{colon:l,labelAlign:n,labelWidth:s,labelWrap:d,layout:c},heightMode:f,height:g,grid:(0,r.jsx)(i.FlowModelRenderer,{model:this.subModels.grid,showFlowSettings:!1}),actions:(0,r.jsx)("div",{style:m?{pointerEvents:"none",opacity:.45}:void 0,children:(0,r.jsx)(i.DndProvider,{children:(0,r.jsxs)(a.A,{wrap:!0,children:[this.mapSubModels("actions",e=>{if(!e.hidden||p)return(0,r.jsx)(i.Droppable,{model:e,children:(0,r.jsx)(i.MemoFlowModelRenderer,{model:e,showFlowSettings:!!this.context.flowSettingsEnabled&&this.actionFlowSettings,extraToolbarItems:this.actionExtraToolbarItems},e.uid)},e.uid)}),this.renderConfigureActions()]})})}),footer:v})}constructor(...e){super(...e),(0,n._)(this,"actionFlowSettings",{showBackground:!1,showBorder:!1,toolbarPosition:"above"}),(0,n._)(this,"actionExtraToolbarItems",[{key:"drag-handler",component:i.DragHandler,sort:1}]),(0,n._)(this,"handlePageChange",async e=>{if(this.resource instanceof i.MultiRecordResource){let t=this.resource;t.setPage(e),t.loading=!0,await t.refresh(),await (0,c.Xi)(this,"paginationChange")}})}}(0,n._)(p,"scene",d.P.oam),(0,n._)(p,"blockCapabilityActionName","update"),p.registerFlow({key:"formSettings",title:(0,i.tExpr)("Edit form settings"),steps:{init:{async handler(e){if(!e.resource)throw Error("Resource is not initialized");e.resource.on("refresh",async()=>{var t,l,n,r,i,o,a,d;let u=e.resource.getMeta("currentFilterByTk"),c={...e.model.getCurrentRecord()};if(!c)return;let p=null==(t=e.association)?void 0:t.targetKey;if(p&&(null==(l=e.association)?void 0:l.interface)!=="m2m"?e.resource.setMeta({currentFilterByTk:null==c?void 0:c[p]}):e.resource.setMeta({currentFilterByTk:e.collection.getFilterByTK(c)}),!e.form)return;let h=e.resource.getMeta("currentFilterByTk"),m=!(0,s.isEqual)(u,h),f=null==(n=(r=e.model).getUserModifiedFields)?void 0:n.call(r),g=!!(null==f?void 0:f.size),v=()=>{if(!(null==f?void 0:f.size))return;let t=e=>null!==e&&"object"==typeof e;for(let l of Array.from(f)){let n=e.form.getFieldValue(l),r=null==c?void 0:c[l];(Object.is(n,r)||t(n)&&t(r)&&(0,s.isEqual)(n,r))&&f.delete(l)}};if(!m&&g){let t={...c};for(let l of f)t[l]=e.form.getFieldValue(l);e.form.setFieldsValue(t),v();return}m&&(null==(i=(o=e.model).resetUserModifiedFields)||i.call(o),null==(a=(d=e.model).resetRuntimeUserEditedState)||a.call(d)),e.form.setFieldsValue(c),v()})}},dataScope:{use:"dataScope"},refresh:{async handler(e){if(!e.resource)throw Error("Resource is not initialized")}}}}),p.registerFlow({key:"paginationChange",on:"paginationChange",steps:{blockLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}},fieldsLinkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"fieldLinkageRules",flowKey:"eventSettings",stepKey:"linkageRules"}}}}),p.define({label:(0,i.tExpr)("Form (Edit)"),searchable:!0,searchPlaceholder:(0,i.tExpr)("Search"),createModelOptions:{use:"EditFormModel",subModels:{grid:{use:"FormGridModel"}}},sort:340})},96491(e,t,l){l.d(t,{JU:()=>z,s2:()=>B,F4:()=>$,mO:()=>K});var n=l(50467),r=l(74848),i=l(49655),o=l(22803),a=l(11869),s=l(89013),d=l(40098),u=l.n(d),c=l(40542),p=l(96540),h=l(2117),m=l(25359),f=l(52175),g=l(95243),v=l(29676),y=l(47632);function b(e){let t,l,n,r=()=>{let e=t;e&&(l&&(e.setFieldValue=l),n&&(e.setFieldsValue=n),t=void 0,l=void 0,n=void 0)};return{patch:i=>{if(t===i)return;r();let o="function"==typeof(null==i?void 0:i.setFieldValue)?i.setFieldValue.bind(i):void 0,a="function"==typeof(null==i?void 0:i.setFieldsValue)?i.setFieldsValue.bind(i):void 0;t=i,l=o,n=a,o&&(i.setFieldValue=(t,l)=>{e.isSuppressed()?o(t,l):e.setFormValues(e.getCallerContext(),[{path:t,value:l}],{source:"system"}).catch(()=>void 0)}),a&&(i.setFieldsValue=t=>{e.isSuppressed()?a(t):e.setFormValues(e.getCallerContext(),t,{source:"system"}).catch(()=>void 0)})},restore:r}}var x=l(12197),w=l(13939),S=l(65421),M=l(13940),A=l(26866);let F=Symbol("SKIP_RULE_VALUE"),k=Symbol("UNRESOLVED_ASSOCIATION_IDENTITY"),C=1e3;function P(e){return"default"===e?"default":"override"===e?"override":"assign"}function j(e){return"default"===e?"default":"override"===e?"override":"system"}class E{getAssignRuleBlockId(e){return`form-assign:${e}:block`}removeAssignRuleBlockInstance(e){let t=this.getAssignRuleBlockId(e);this.rules.has(t)&&this.removeRule(t)}removeRowGridAssignRuleInstances(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e),n=[];for(let[e,o]of this.rules.entries()){var r,i;if(!e.startsWith(t)||e===l)continue;let a=null==o||null==(i=o.rule)||null==(r=i.getContext)?void 0:r.call(i),s=null==a?void 0:a.model;s&&this.isRowGridModel(s)&&n.push(e)}for(let e of n)this.removeRule(e)}hasAnyNonBlockAssignRuleInstance(e){let t=`form-assign:${e}:`,l=this.getAssignRuleBlockId(e);for(let e of this.rules.keys())if(e.startsWith(t)&&e!==l)return!0;return!1}ensureBlockAssignRuleInstancesForTargetPath(e){if(this.options.isDisposed()||!e||!this.shouldCreateBlockLevelAssignRule(e))return;let t=this.assignTemplatesByTargetPath.get(e)||[];if(t.length)for(let l of t){let t=(null==l?void 0:l.__key)?String(l.__key):"";if(!t||this.hasAnyNonBlockAssignRuleInstance(t))continue;let n=j(P(null==l?void 0:l.mode)),r=(null==l?void 0:l.enable)!==!1,i=this.getAssignRuleBlockId(t);if(this.rules.has(i))continue;let o={id:i,source:n,priority:10+(l.__order||0),debounceMs:0,getEnabled:()=>r&&!!e,getTarget:()=>e,getValue:()=>null==l?void 0:l.value,getCondition:()=>null==l?void 0:l.condition,getContext:()=>this.options.getBlockContext(),getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(i,{rule:o,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}}getCollectionFromContext(e){var t,l;return(null==e?void 0:e.collection)??(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.collection)}getRootCollection(){let e=this.options.getBlockContext();return this.getCollectionFromContext(e)}shouldCreateBlockLevelAssignRule(e){let t=this.options.getBlockContext(),l=this.getCollectionFromContext(t);if(!(null==l?void 0:l.getField))return!0;let n=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(n.length<=1)return!0;for(let e=0;e<n.length-1;e++){var r,i;let t=n[e];if("string"!=typeof t)continue;let o=null==l||null==(r=l.getField)?void 0:r.call(l,t);if(!(null==o||null==(i=o.isAssociationField)?void 0:i.call(o)))break;if((0,M.E4)(o)){if("number"!=typeof n[e+1])return!1;e+=1}if(!(null==(l=null==o?void 0:o.targetCollection)?void 0:l.getField))break}return!0}collectAssociationPrefixPaths(e,t){let l=[],n=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==n?void 0:n.getField))return l;let r=[];for(let e=0;e<t.length-1;e++){var i,o;let a=t[e];if("string"!=typeof a)break;let s=null==n||null==(i=n.getField)?void 0:i.call(n,a);if(!(null==s||null==(o=s.isAssociationField)?void 0:o.call(s)))break;if(r.push(a),(0,M.E4)(s)){let l=t[e+1];if("number"!=typeof l)break;r.push(l),e+=1}if(l.push([...r]),!(null==(n=null==s?void 0:s.targetCollection)?void 0:n.getField))break}return l}shouldSkipToManyAssociationWriteWithoutIndex(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return!1;for(let e=0;e<t.length-1;e++){var n,r;let i=t[e];if("string"!=typeof i)continue;let o=null==l||null==(n=l.getField)?void 0:n.call(l,i);if(!(null==o||null==(r=o.isAssociationField)?void 0:r.call(o)))break;if((0,M.E4)(o)){if("number"!=typeof t[e+1])return!0;e+=1}if(!(null==(l=null==o?void 0:o.targetCollection)?void 0:l.getField))break}return!1}shouldSkipAssociationNestedWrite(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return!1;for(let n of l){let l=this.options.getFormValueAtPath(n);if(null==l){let l=n.filter(e=>"string"==typeof e).join(".");if(l&&this.getUpdateAssociationForTargetPath(l)||this.isAssociationTargetKeyWrite(e,t,n))continue;return!0}if("object"!=typeof l)return!0}return!1}getAssociationTargetKeyFields(e){var t,l;let n=(null==e?void 0:e.targetKey)??(null==e||null==(t=e.targetCollection)?void 0:t.filterTargetKey)??(null==e||null==(l=e.targetCollection)?void 0:l.filterByTk)??"id";return Array.isArray(n)?n.filter(e=>"string"==typeof e&&!!e):"string"==typeof n&&n?[n]:["id"]}resolveAssociationFieldByPrefixPath(e,t){let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;let n=null;for(let e of t){var r,i;if("number"==typeof e)continue;if("string"!=typeof e||!e)break;let t=null==l||null==(r=l.getField)?void 0:r.call(l,e);if(!(null==t||null==(i=t.isAssociationField)?void 0:i.call(t))||(n=t,!(null==(l=null==t?void 0:t.targetCollection)?void 0:l.getField)))break}return n}isAssociationTargetKeyWrite(e,t,l){var n;if(!Array.isArray(t)||!Array.isArray(l)||t.length!==l.length+1)return!1;let r=t[l.length];if("string"!=typeof r||!r)return!1;let i=this.resolveAssociationFieldByPrefixPath(e,l);return!(!(null==i||null==(n=i.isAssociationField)?void 0:n.call(i))||(0,M.E4)(i))&&this.getAssociationTargetKeyFields(i).includes(r)}collectUpdateAssociationInitPatches(e,t){let l=this.collectAssociationPrefixPaths(e,t);if(!l.length)return[];let n=[];for(let r of l){let l=this.options.getFormValueAtPath(r);if(null==l){let l=r.filter(e=>"string"==typeof e).join(".");if(!l)return null;if(this.getUpdateAssociationForTargetPath(l)){n.push({path:[...r,"__is_new__"],value:!0});continue}if(this.isAssociationTargetKeyWrite(e,t,r)){n.push({path:[...r],value:{}});continue}return null}if("object"!=typeof l)return null}let r=new Map;for(let e of n){let t=(0,x.Qc)(e.path);r.has(t)||r.set(t,e)}return Array.from(r.values())}dispose(){for(let{state:e}of this.rules.values())e.depDisposers.forEach(e=>e());for(let e of(this.rules.clear(),this.pendingRuleIds.clear(),this.assignTemplatesByTargetPath.clear(),this.defaultRuleMasterDisposers.values()))e();for(let e of(this.defaultRuleMasterDisposers.clear(),this.defaultRuleIdsByMasterUid.clear(),this.ruleDebounceTimersById.values()))clearTimeout(e);this.ruleDebounceTimersById.clear(),this.ruleDebounceUntilById.clear()}enable(){this.rulesEnabled=!0,this.pendingRuleIds.size&&!this.runningRules&&this.flushRules()}syncAssignRules(e){if(this.options.isDisposed())return;let t=(Array.isArray(e)?e:[]).map((e,t)=>({...e,key:(null==e?void 0:e.key)?String(e.key):`idx:${t}`})),l="form-assign:";for(let e of Array.from(this.rules.keys()))e.startsWith(l)&&this.removeRule(e);this.assignTemplatesByTargetPath.clear(),this.formItemTargetPaths.clear(),this.updateAssociationByTargetPath.clear();let n=0;for(let e of t){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=this.assignTemplatesByTargetPath.get(t)||[];n+=1,l.push({...e,__key:String(e.key),__order:n}),this.assignTemplatesByTargetPath.set(t,l)}let r=this.options.getEngine(),i=new Set;if(null==r?void 0:r.forEachModel){r.forEachModel(e=>{var t;if(!this.isModelInThisForm(e)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let l=this.getModelTargetPath(e);l&&this.formItemTargetPaths.add(l),this.cacheUpdateAssociationForModel(e)});let e=e=>{this.cacheUpdateAssociationForModel(e),this.tryRegisterAssignRuleInstancesForModel(e,i);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e,i)})};r.forEachModel(t=>{e(t)})}for(let[e,t]of this.assignTemplatesByTargetPath.entries())if(!i.has(e)&&this.shouldCreateBlockLevelAssignRule(e))for(let n of t){let t=j(P(null==n?void 0:n.mode)),r=(null==n?void 0:n.enable)!==!1,i=`${l}${n.__key}:block`;this.rules.has(i)&&this.removeRule(i);let o={id:i,source:t,priority:10+(n.__order||0),debounceMs:0,getEnabled:()=>r&&!!e,getTarget:()=>e,getValue:()=>null==n?void 0:n.value,getCondition:()=>null==n?void 0:n.condition,getContext:()=>this.options.getBlockContext(),getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(i,{rule:o,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(i)}for(let e of Array.from(this.rules.keys()))e.startsWith("default:")&&this.scheduleRule(e)}onModelMounted(e){var t;if(this.isModelInThisForm(e)&&!(null==e?void 0:e.isFork)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);t&&this.formItemTargetPaths.add(t),this.cacheUpdateAssociationForModel(e)}this.tryRegisterDefaultRuleInstance(e),this.tryRegisterAssignRuleInstancesForModel(e)}onModelUnmounted(e){var t;if(this.tryUnregisterDefaultRuleInstance(e),this.tryUnregisterAssignRuleInstancesForModel(e),this.isModelInThisForm(e)&&(null==e||null==(t=e.subModels)?void 0:t.field)){let t=this.getModelTargetPath(e);if(t&&(this.ensureBlockAssignRuleInstancesForTargetPath(t),!(null==e?void 0:e.isFork))){this.updateAssociationByTargetPath.delete(t),this.formItemTargetPaths.delete(t);let e=`${t}.`;for(let t of this.assignTemplatesByTargetPath.keys())t.startsWith(e)&&this.ensureBlockAssignRuleInstancesForTargetPath(t);let l=this.options.getEngine();if(null==l?void 0:l.forEachModel){let e=e=>{this.tryRegisterAssignRuleInstancesForModel(e);let t=null==e?void 0:e.forks;t&&"function"==typeof t.forEach&&t.forEach(e=>{e&&(null==e||!e.disposed)&&this.tryRegisterAssignRuleInstancesForModel(e)})};l.forEachModel(t=>e(t))}}}}isModelInThisForm(e){var t;let l=null==e||null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.options.getBlockModelUid())}cacheUpdateAssociationForModel(e){var t,l;if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e||(null==e?void 0:e.isFork)||!(null==e||null==(t=e.subModels)?void 0:t.field))return;let n=this.getModelTargetPath(e);if(!n)return;let r=null==e||null==(l=e.subModels)?void 0:l.field,i=!!(null==r?void 0:r.updateAssociation);!0!==this.updateAssociationByTargetPath.get(n)&&this.updateAssociationByTargetPath.set(n,i)}getUpdateAssociationForTargetPath(e){let t=String(e||"");if(!t)return!1;if(this.updateAssociationByTargetPath.has(t))return!!this.updateAssociationByTargetPath.get(t);let l=this.options.getEngine();return((null==l?void 0:l.forEachModel)&&l.forEachModel(e=>{this.cacheUpdateAssociationForModel(e)}),this.updateAssociationByTargetPath.has(t))?!!this.updateAssociationByTargetPath.get(t):(this.updateAssociationByTargetPath.set(t,!1),!1)}getDefaultRuleId(e){let t=(null==e?void 0:e.isFork)?String((null==e?void 0:e.forkId)??"fork"):"master",l=(null==e?void 0:e.uid)?String(e.uid):String(e);return`default:${l}:${t}`}getModelTargetNamePath(e){var t;let l=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(l)&&l.length)return l;let n="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,r=null==n?void 0:n.name;return Array.isArray(r)?r:"string"==typeof r?r.includes(".")?r.split("."):[r]:null}getAssignTemplateTargetPathForModel(e){let t=this.getModelTargetPath(e);if(t)return t;let l=this.getModelTargetNamePath(e);if(!(null==l?void 0:l.length))return"";let n=l.filter(e=>"number"!=typeof e);return n.length?(0,x.Qc)(n):""}hasAssignTemplateForTargetPath(e){let t=String(e||"");return!!t&&this.assignTemplatesByTargetPath.has(t)}tryRegisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e)||!e||"object"!=typeof e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(!t||"object"!=typeof t)return;let l=this.getModelTargetNamePath(e);if(!l)return;let n=this.getDefaultRuleId(e);if(this.rules.has(n))return;let r=e.master||e,i=this.getAssignTemplateTargetPathForModel(e);this.bindMasterInitialValue(r,n);let o=()=>{var e;let t=(null==r||null==(e=r.getProps)?void 0:e.call(r))??(null==r?void 0:r.props);return null==t?void 0:t.initialValue},a=o(),s=!1,d=()=>{let e=o();if(s||u().isEqual(e,a)||(s=!0),!this.hasAssignTemplateForTargetPath(i)||s||void 0===a)return e},c=()=>{if(!this.hasAssignTemplateForTargetPath(i))try{var e,t,l,n;let i=null==r||null==(t=r.getStepParams)||null==(e=t.call(r,"editItemSettings","initialValue"))?void 0:e.defaultValue;if(void 0!==i)return i;let o=null==r||null==(n=r.getStepParams)||null==(l=n.call(r,"formItemSettings","initialValue"))?void 0:l.defaultValue;if(void 0!==o)return o}catch{}},p={id:n,source:"default",priority:void 0!==d()?C:0,debounceMs:0,getEnabled:()=>void 0!==d()||void 0!==c(),getTarget:()=>this.getModelTargetNamePath(e)||l,getValue:()=>{let e=d();return void 0!==e?e:c()},getContext:()=>null==e?void 0:e.context};this.rules.set(n,{rule:p,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(n)}getModelTargetPath(e){try{var t;let l=null==e||null==(t=e.getStepParams)?void 0:t.call(e,"fieldSettings","init"),n=null==l?void 0:l.fieldPath;if(n)return String(n)}catch{}let l=null==e?void 0:e.fieldPath;if(l)return String(l);let n=this.getModelTargetNamePath(e);return(null==n?void 0:n.length)&&n.filter(e=>"string"==typeof e).join(".")||null}getAssignRuleInstanceId(e,t){let l=(null==t?void 0:t.isFork)?String((null==t?void 0:t.forkId)??"fork"):"master",n=(null==t?void 0:t.uid)?String(t.uid):String(t);return`form-assign:${e}:${n}:${l}`}getDeepestFieldIndexKey(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex),r=Array.isArray(n)?n:[];if(!r.length)return null;let i=r[r.length-1];if("string"!=typeof i)return null;let[o,a]=i.split(":");return!o||Number.isNaN(Number(a))?null:o}getDeepestToManyAssociationKey(e){let t=this.getRootCollection();if(!(null==t?void 0:t.getField))return null;let l=(0,x.EA)(String(e||"")).filter(e=>"object"!=typeof e);if(l.length<2)return null;let n=t,r=null;for(let e=0;e<l.length-1;e++){var i,o;let t=l[e];if("string"!=typeof t)continue;let a=null==n||null==(i=n.getField)?void 0:i.call(n,t);if(!(null==a||null==(o=a.isAssociationField)?void 0:o.call(a)))break;let s=(0,M.E4)(a);if(s&&(r=t),s&&"number"==typeof l[e+1]&&(e+=1),!(null==(n=null==a?void 0:a.targetCollection)?void 0:n.getField))break}return r}isRowGridModel(e){var t,l;if(!e||"object"!=typeof e||(null==e||null==(t=e.subModels)?void 0:t.field)||!(null==e||null==(l=e.subModels)?void 0:l.items))return!1;let n=null==e?void 0:e.context;return!!this.getDeepestFieldIndexKey(n)}tryRegisterAssignRuleInstancesForModel(e,t){var l,n,r,i;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let o=(l,n)=>{if(n&&0!==n.length)for(let i of(null==t||t.add(l),n)){var r;this.removeAssignRuleBlockInstance(i.__key),(null==e||null==(r=e.subModels)?void 0:r.field)&&this.removeRowGridAssignRuleInstances(i.__key);let t=j(P(null==i?void 0:i.mode)),n=(null==i?void 0:i.enable)!==!1,o=this.getAssignRuleInstanceId(i.__key,e);this.rules.has(o)&&this.removeRule(o);let a={id:o,source:t,priority:10+(i.__order||0),debounceMs:0,getEnabled:()=>n&&!!l,getTarget:()=>l,getValue:()=>null==i?void 0:i.value,getCondition:()=>null==i?void 0:i.condition,getContext:()=>null==e?void 0:e.context,getContractModelUid:this.options.getAssignRulesModelUid};this.rules.set(o,{rule:a,state:{deps:new Set,depDisposers:[],runSeq:0,scheduledAtWriteSeq:0}}),this.scheduleRule(o)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(l)for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&o(e,t)}return}if(!(null==e||null==(l=e.subModels)?void 0:l.field))return;let a=this.getModelTargetPath(e);if(!a)return;let s=this.assignTemplatesByTargetPath.get(a)||[];s.length&&o(a,s);let d=null==e||null==(n=e.subModels)?void 0:n.field,u=null==d||null==(r=d.context)?void 0:r.collectionField,c=!!(null==u||null==(i=u.isAssociationField)?void 0:i.call(u)),p=(0,M.E4)(u);if(c&&!p){let e=`${a}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&o(t,l)}}tryUnregisterAssignRuleInstancesForModel(e){var t,l,n,r;if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let i=t=>{for(let l of t||[]){let t=this.getAssignRuleInstanceId(l.__key,e);this.rules.has(t)&&this.removeRule(t)}};if(this.isRowGridModel(e)){let t=null==e?void 0:e.context,l=this.getDeepestFieldIndexKey(t);if(!l)return;for(let[e,t]of this.assignTemplatesByTargetPath.entries()){if(this.formItemTargetPaths.has(e))continue;let n=this.getDeepestToManyAssociationKey(e);n&&n===l&&i(t)}return}if(!(null==e||null==(t=e.subModels)?void 0:t.field))return;let o=this.getModelTargetPath(e);if(!o)return;let a=this.assignTemplatesByTargetPath.get(o)||[];a.length&&i(a);let s=null==e||null==(l=e.subModels)?void 0:l.field,d=null==s||null==(n=s.context)?void 0:n.collectionField,u=!!(null==d||null==(r=d.isAssociationField)?void 0:r.call(d)),c=(0,M.E4)(d);if(u&&!c){let e=`${o}.`;for(let[t,l]of this.assignTemplatesByTargetPath.entries())t&&"string"==typeof t&&t.startsWith(e)&&i(l)}}tryUnregisterDefaultRuleInstance(e){if(this.options.isDisposed()||!this.isModelInThisForm(e))return;let t=this.getDefaultRuleId(e);this.rules.has(t)&&this.removeRule(t)}bindMasterInitialValue(e,t){let l=(null==e?void 0:e.uid)?String(e.uid):t,n=this.defaultRuleIdsByMasterUid.get(l)||new Set;if(n.add(t),this.defaultRuleIdsByMasterUid.set(l,n),this.defaultRuleMasterDisposers.has(l))return;let r=(0,g.reaction)(()=>{var t;let l=(null==e||null==(t=e.getProps)?void 0:t.call(e))??(null==e?void 0:e.props);return null==l?void 0:l.initialValue},(t,n)=>{var r;if(u().isEqual(t,n))return;let i=this.defaultRuleIdsByMasterUid.get(l);if(!i)return;let o=(null==e||null==(r=e.getProps)?void 0:r.call(e))??(null==e?void 0:e.props),a=void 0!==(null==o?void 0:o.initialValue)?C:0;for(let e of i){let t=this.rules.get(e);t&&(t.rule.priority=a),this.scheduleRule(e)}});this.defaultRuleMasterDisposers.set(l,r)}removeRule(e){let t=this.rules.get(e);if(!t)return;try{let e=t.rule.getContext(),l=t.rule.getTarget(),n=this.options.tryResolveNamePath(e,l);if(n){let e=(0,x.Qc)(n),l=this.options.observableBindings.get(e);l&&l.source===t.rule.source&&(l.dispose(),this.options.observableBindings.delete(e))}}catch{}t.state.depDisposers.forEach(e=>e()),this.rules.delete(e),this.pendingRuleIds.delete(e);let l=this.ruleDebounceTimersById.get(e);for(let[t,n]of(l&&clearTimeout(l),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e),this.defaultRuleIdsByMasterUid.entries())){if(!n.has(e)||(n.delete(e),n.size>0))continue;this.defaultRuleIdsByMasterUid.delete(t);let l=this.defaultRuleMasterDisposers.get(t);l&&l(),this.defaultRuleMasterDisposers.delete(t)}}rescheduleAllRules(){if(!this.options.isDisposed()){for(let e of(this.lastRuleWriteByTargetKey.clear(),this.rules.values()))e.state.runSeq+=1;for(let e of this.rules.keys())this.scheduleRule(e)}}scheduleRule(e){if(this.options.isDisposed())return;let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.scheduledAtWriteSeq=this.options.getWriteSeq();let r=(null==l?void 0:l.debounceMs)??0;if(this.pendingRuleIds.add(e),r>0){let t=Date.now()+r;t>(this.ruleDebounceUntilById.get(e)||0)&&this.ruleDebounceUntilById.set(e,t);let l=this.ruleDebounceTimersById.get(e);l&&clearTimeout(l);let n=setTimeout(()=>{this.ruleDebounceTimersById.delete(e),!this.rulesEnabled||this.runningRules||this.pendingRuleIds.has(e)&&this.flushRules()},r);this.ruleDebounceTimersById.set(e,n)}else{let t=this.ruleDebounceTimersById.get(e);t&&clearTimeout(t),this.ruleDebounceTimersById.delete(e),this.ruleDebounceUntilById.delete(e)}!this.rulesEnabled||this.runningRules||this.flushRules()}async flushRules(){if(this.runningRules)return;this.runningRules=!0;let e=this.currentRuleTxId||(0,S.ao)();this.currentRuleTxId=e;try{for(;this.pendingRuleIds.size;){let e=Date.now(),t=[];for(let l of this.pendingRuleIds)(this.ruleDebounceUntilById.get(l)||0)>e||t.push(l);if(!t.length)break;for(let e of t)this.pendingRuleIds.delete(e),this.ruleDebounceUntilById.delete(e);for(let e of(t.sort((e,t)=>{var l,n;let r=null==(l=this.rules.get(e))?void 0:l.rule,i=null==(n=this.rules.get(t))?void 0:n.rule,o=(null==r?void 0:r.priority)??0,a=(null==i?void 0:i.priority)??0;return o!==a?o-a:e.localeCompare(t)}),t))await this.runRule(e)}}finally{this.runningRules=!1,this.currentRuleTxId=null,this.options.txWriteCounts.delete(e)}}async runRule(e){let t=this.rules.get(e);if(!t)return;let{rule:l,state:n}=t;n.runSeq+=1;let r=n.runSeq,i=n.scheduledAtWriteSeq,o=this.prepareRuleContext(l),{baseCtx:a,targetNamePath:s,targetKey:d,clearDeps:u,disposeBinding:c}=o;if(!this.shouldRunRule(l,s,d,a)||!s||!d){u(n),c();return}let p=s,h=d,{collector:m,evalCtx:f}=this.createRuleCollectorAndContext(l,o);if(l.getCondition&&!await this.evaluateRuleCondition(l,n,r,f,m))return;let g=await this.resolveRuleValue(l,n,r,f,m);if(g===F||r!==n.runSeq)return;this.commitRuleDeps(l,n,m);let v=this.getToManyAggregateSourceInfo(a,l.getValue()),y=this.normalizeUnresolvedToManyAggregateForScalarTarget(a,p,g,v);if(y.skip)return;let b=y.hasValue?y.value:g,w=this.normalizeResolvedValueForTarget(a,b),S=this.normalizeResolvedValueForAssociationTarget(a,p,w),M=this.normalizeAggregateArrayForScalarTarget(a,p,S,v);if(M===F||this.shouldSkipEmptyArrayAggregateForScalarTarget(a,p,M)||this.shouldSkipMultiValueAggregateForScalarTarget(a,p,M,v)||"default"===l.source&&!this.checkDefaultRuleCanApply(M,p,h,u,c,n))return;if("override"===l.source&&this.options.findUserEditedHit(h))return void c();if("default"===l.source){let e=this.lastRuleWriteByTargetKey.get(h);if((null==e?void 0:e.source)==="default"&&e.priority>l.priority&&e.writeSeq>=i)return void c()}if("system"===l.source||"override"===l.source){let e=this.options.lastWriteMetaByPathKey.get(h);if((null==e?void 0:e.source)==="linkage"&&e.writeSeq>=i)return void c()}if(this.shouldSkipAssociationNestedWrite(a,p)||this.shouldSkipToManyAssociationWriteWithoutIndex(a,p))return;let A=M;if(this.isAssociationTargetSemanticallyEqual(a,p,this.options.getFormValueAtPath(p),A))return;let k=this.collectUpdateAssociationInitPatches(a,p);if(null==k)return;if("system"===l.source||"default"===l.source||"override"===l.source){var C,P;let e=null==a?void 0:a.model,t=null==e||null==(C=e.subModels)?void 0:C.field;if(t){let l=this.getModelTargetNamePath(e);l&&(0,x.Qc)(l)===h&&(e.setProps({value:M}),null==(P=t.setProps)||P.call(t,{value:M}))}}let j=this.options.getWriteSeq(),E=[...k,{path:p,value:M}];await this.options.setFormValues(f,E,{source:l.source,txId:this.currentRuleTxId||void 0});let R=this.options.getWriteSeq();R!==j&&this.lastRuleWriteByTargetKey.set(h,{source:l.source,priority:l.priority,writeSeq:R})}isTzAwareTargetInterface(e){return"string"==typeof e&&["datetime","createdAt","updatedAt","unixTimestamp"].includes(e)}normalizeDateOnlyToStartOfDayIso(e){let t=String(e||"").trim();if(!t||!/^\d{4}-\d{2}-\d{2}$/.test(t))return e;let l=(0,w.dayjs)(t,"YYYY-MM-DD",!0);return l.isValid()?l.startOf("day").toISOString():e}normalizeResolvedValueForTarget(e,t){var l,n,r;let i=null==e||null==(r=e.model)||null==(n=r.context)||null==(l=n.collectionField)?void 0:l.interface;return this.isTzAwareTargetInterface(i)?"string"==typeof t?this.normalizeDateOnlyToStartOfDayIso(t):Array.isArray(t)?t.map(e=>"string"==typeof e?this.normalizeDateOnlyToStartOfDayIso(e):e):t:t}isPrimitiveAssociationTargetValue(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}extractAssociationIdentity(e,t){let l=this.getAssociationTargetKeyFields(e),n=1===l.length?l[0]:null,r=e=>{if(null==e)return e;if(this.isPrimitiveAssociationTargetValue(e))return n?e:k;if(!e||"object"!=typeof e)return k;if(n)return void 0===e[n]?k:e[n];let t={};for(let n of l){if(void 0===e[n])return k;t[n]=e[n]}return t};if((0,M.E4)(e)){let e=Array.isArray(t)?t:[t],l=[];for(let t of e){if(null==t)continue;let e=r(t);if(e===k)return k;l.push(e)}return l}let i=Array.isArray(t)?t.find(e=>null!=e):t;return null==i?i:r(i)}isAssociationTargetSemanticallyEqual(e,t,l,n){var r;let i=this.resolveCollectionFieldByNamePath(e,t);if(!(null==i||null==(r=i.isAssociationField)?void 0:r.call(i)))return u().isEqual(l,n);let o=this.extractAssociationIdentity(i,l),a=this.extractAssociationIdentity(i,n);return o===k||a===k?u().isEqual(l,n):u().isEqual(o,a)}resolveCollectionFieldByNamePath(e,t){if(!Array.isArray(t)||!t.length)return null;let l=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==l?void 0:l.getField))return null;for(let e=0;e<t.length;e++){var n,r;let i=t[e];if("string"!=typeof i||!i)break;let o=null==l||null==(n=l.getField)?void 0:n.call(l,i);if(!o)break;if(e===t.length-1)return o;if(!(null==o||null==(r=o.isAssociationField)?void 0:r.call(o))||!(null==o?void 0:o.targetCollection))break;if((0,M.E4)(o)){if("number"!=typeof t[e+1])return null;e+=1}if(!(null==(l=o.targetCollection)?void 0:l.getField))break}return null}normalizeResolvedValueForAssociationTarget(e,t,l){var n;let r=this.resolveCollectionFieldByNamePath(e,t);if(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r)))return l;let i=this.getAssociationTargetKeyFields(r),o=1===i.length?i[0]:null,a=e=>{if(null!=e)return o&&this.isPrimitiveAssociationTargetValue(e)?{[o]:e}:e};if((0,M.E4)(r))return(Array.isArray(l)?l:[l]).map(e=>a(e)).filter(e=>null!=e);let s=Array.isArray(l)?l.find(e=>null!=e):l;return null==s?s:a(s)}prepareRuleContext(e){let t=e.getContext(),l=e.getTarget(),n=this.options.tryResolveNamePath(t,l),r=n?(0,x.Qc)(n):null,i=()=>{if(!r)return;let t=this.options.observableBindings.get(r);t&&t.source===e.source&&(t.dispose(),this.options.observableBindings.delete(r))};return{baseCtx:t,targetNamePath:n,targetKey:r,clearDeps:e=>{e.depDisposers.forEach(e=>e()),e.depDisposers=[],e.deps=new Set},disposeBinding:i}}shouldApplyDefaultRuleInCurrentState(e){var t,l,n;return"update"!==(null==(t=(l=this.options).getActionName)?void 0:t.call(l))||(null==(n=this.getItemContext(e))?void 0:n.__is_new__)===!0}isStaleToManyItemContext(e){let t=this.getItemContext(e);return!!Number.isFinite(null==t?void 0:t.index)&&!!Number.isFinite(null==t?void 0:t.length)&&(t.index<0||t.index>=t.length)}getItemContext(e){try{return null==e?void 0:e.item}catch{return}}getRowTargetKey(e,t){var l,n,r,i;let o,a,s=this.getRootCollection()||this.getCollectionFromContext(e);for(let e of t)if("number"!=typeof e){if("string"!=typeof e||!e||!(null==s?void 0:s.getField)||(o=null==s||null==(r=s.getField)?void 0:r.call(s,e),!(null==o||null==(i=o.isAssociationField)?void 0:i.call(o))))break;a=o,s=null==o?void 0:o.targetCollection}let d=(null==a||null==(l=a.targetCollection)?void 0:l.filterTargetKey)??(null==a||null==(n=a.targetCollection)?void 0:n.filterByTk)??(null==a?void 0:a.targetKey);if(Array.isArray(d)){let e=d.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof d&&d?d:"id"}isMismatchedToManyItemContext(e,t){let l=this.getItemContext(e);if(!l)return!1;for(let n=t.length-1;n>=0;n--){if("number"!=typeof t[n])continue;let r=t.slice(0,n+1),i=this.getRowTargetKey(e,r),o=this.options.getFormValueAtPath(r),a=(0,A.r5)(o,i),s=(0,A.r5)(l.value,i);return!!a&&!!s&&a!==s}return!1}shouldRunRule(e,t,l,n){return!(!e.getEnabled()||!t||!l||this.isStaleToManyItemContext(n)||this.isMismatchedToManyItemContext(n,t)||"default"===e.source&&(!this.shouldApplyDefaultRuleInCurrentState(n)||this.options.findExplicitHit(l)))&&!("override"===e.source&&this.options.findUserEditedHit(l))}createRuleCollectorAndContext(e,t){var l;let{baseCtx:n,targetNamePath:r}=t,i=e.getValue(),o=(0,a.isRunJSValue)(i),s={deps:new Set,wildcard:!1};if(e.getCondition&&(0,y.G)(e.getCondition(),s),o?(0,y.Wp)(i,s):(0,y.G)(i,s),r)for(let e of((0,y.Dd)(r,s),this.collectAssociationPrefixPaths(n,r)))(0,y.Dd)(e,s);let d=this.createRuleEvaluationContext(n,s,r,null==(l=e.getContractModelUid)?void 0:l.call(e));return{collector:s,evalCtx:d,rawValue:i,isRunJS:o}}async evaluateRuleCondition(e,t,l,n,r){let i=e.getCondition;if(!i)return!0;let o=i(),a=o;if(o)try{var s;a=await (null==n||null==(s=n.resolveJsonTemplate)?void 0:s.call(n,o))}catch{a=o}return l===t.runSeq&&(!o||!!(0,v.F)(n,a)||(this.commitRuleDeps(e,t,r),!1))}async resolveRuleValue(e,t,l,n,r){let i=e.getValue();return(0,a.isRunJSValue)(i)?this.resolveRunJSValue(i,t,l,n,r,e):this.resolveTemplateValue(i,t,l,n,r,e)}async resolveRunJSValue(e,t,l,n,r,i){try{let{code:o,version:s}=(0,a.normalizeRunJSValue)(e),d=await (0,a.runjsWithSafeGlobals)(n,o,{version:s});if(!(null==d?void 0:d.success)){if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}return d.value}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}}async resolveTemplateValue(e,t,l,n,r,i){try{var o;return await (null==n||null==(o=n.resolveJsonTemplate)?void 0:o.call(n,e))}catch{if(l!==t.runSeq)return F;return this.commitRuleDeps(i,t,r),F}}commitRuleDeps(e,t,l){let n=new Set(l.deps);l.wildcard&&n.add("fv:*"),this.updateRuleDeps(e,t,n)}isScalarValueTarget(e,t){var l;let n=this.resolveCollectionFieldByNamePath(e,t);return!((null==n||null==(l=n.isAssociationField)?void 0:l.call(n))&&(0,M.E4)(n)||this.isArrayValueCollectionField(n))&&(!!n||!Array.isArray(this.options.getFormValueAtPath(t)))}shouldSkipEmptyArrayAggregateForScalarTarget(e,t,l){return!!Array.isArray(l)&&!(l.length>0)&&this.isScalarValueTarget(e,t)}normalizeUnresolvedToManyAggregateForScalarTarget(e,t,l,n){return void 0===l&&n&&this.isScalarValueTarget(e,t)?Array.isArray(n.arrayValue)&&0===n.arrayValue.length?this.isUserClearedToManyAggregate(n)?{skip:!1,hasValue:!0,value:this.getClearedAggregateValueForScalarTarget(e,t)}:{skip:!0,hasValue:!1}:Array.isArray(n.arrayValue)&&n.arrayValue.length>0?{skip:!0,hasValue:!1}:{skip:!1,hasValue:!1}:{skip:!1,hasValue:!1}}isArrayValueCollectionField(e){var t,l;if(!e||"object"!=typeof e)return!1;let n=e;return!0===n.multiple||"array"===n.type||"array"===((null==(t=n.uiSchema)?void 0:t.type)??(null==(l=n.schema)?void 0:l.type))||["multipleSelect","checkboxGroup","json"].includes("string"==typeof n.interface?n.interface:"")}stringifyAggregateItem(e){if(e&&"object"==typeof e)try{return JSON.stringify(e)}catch{}return String(e)}normalizeAggregateArrayForScalarTarget(e,t,l,n){if(!Array.isArray(l)||!this.isScalarValueTarget(e,t)||!n)return l;let r=l.filter(e=>null!=e);return r.length?1===r.length?r[0]:this.isTextScalarTarget(e,t)?r.map(e=>this.stringifyAggregateItem(e)).join(", "):F:this.isUserClearedToManyAggregate(n)?this.getClearedAggregateValueForScalarTarget(e,t):F}shouldSkipMultiValueAggregateForScalarTarget(e,t,l,n){return!!n&&!!Array.isArray(l)&&!(l.length<=1)&&!!this.isScalarValueTarget(e,t)&&!this.isTextScalarTarget(e,t)}getClearedAggregateValueForScalarTarget(e,t){if(this.isTextScalarTarget(e,t))return""}isUserClearedToManyAggregate(e){var t;return(null==(t=e.lastWrite)?void 0:t.source)==="user"}isTextScalarTarget(e,t){var l,n,r;let i=this.resolveCollectionFieldByNamePath(e,t);if(!i){let e=this.options.getFormValueAtPath(t);return void 0===e||null==e||"string"==typeof e}if((null==i||null==(l=i.isAssociationField)?void 0:l.call(i))||this.isArrayValueCollectionField(i))return!1;let o=i,a=(null==(n=o.uiSchema)?void 0:n.type)??(null==(r=o.schema)?void 0:r.type);return"string"===o.type||"text"===o.type||"string"===a||["input","textarea","email","phone","url","uuid","nanoid","markdown","richText","vditor","password","color"].includes("string"==typeof o.interface?o.interface:"")}getLatestWriteMetaForPath(e){let t=(0,x.Qc)(e),l=this.options.lastWriteMetaByPathKey.get(t);for(let[e,n]of this.options.lastWriteMetaByPathKey.entries())(e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`))&&(!l||n.writeSeq>l.writeSeq)&&(l=n);return l}getToManyAggregateSourceInfo(e,t){let l=this.extractSingleLocalFormValuesPath(t);if(!l)return null;let n=(0,x.EA)(l).filter(e=>"object"!=typeof e);if(n.length<2)return null;let r=this.getRootCollection()||this.getCollectionFromContext(e);if(!(null==r?void 0:r.getField))return null;let i=[];for(let t=0;t<n.length-1;t++){var o,a;let s=n[t];if("string"!=typeof s)break;let d=null==r||null==(o=r.getField)?void 0:o.call(r,s);if(!(null==d||null==(a=d.isAssociationField)?void 0:a.call(d)))break;if(i.push(s),(0,M.E4)(d)){let t=this.options.getFormValueAtPath(i),n=this.getLocalFormValuesSnapshot(e),r=n&&"object"==typeof n?u().get(n,i):void 0;return{subPath:l,arrayPath:[...i],arrayValue:void 0!==t?t:r,lastWrite:this.getLatestWriteMetaForPath(i)}}if(!(null==(r=d.targetCollection)?void 0:r.getField))break}return null}checkDefaultRuleCanApply(e,t,l,n,r,i){if(void 0===e)return!1;if(this.options.findExplicitHit(l))return n(i),r(),!1;let o=this.options.getFormValueAtPath(t),a=this.options.lastDefaultValueByPathKey.get(l),s=(0,S.Po)(o)||void 0!==a&&u().isEqual(o,a),d=(0,g.isObservable)(e)?(0,g.toJS)(e):e;return!s&&u().isEqual(o,d)?(this.options.lastDefaultValueByPathKey.set(l,d),!1):s}createRuleEvaluationContext(e,t,l,n){var r;let i,o=this.options.createTrackingFormValues(t),s=new a.FlowContext;try{s.delegate(e)}catch{}let d=null==e||null==(r=e.getPropertyOptions)?void 0:r.call(e,"formValues");d&&"object"==typeof d?s.defineProperty("formValues",{...d,get:()=>o,cache:!1}):s.defineProperty("formValues",{get:()=>o,cache:!1});let u="function"==typeof s.resolveJsonTemplate?s.resolveJsonTemplate.bind(s):void 0;s.defineMethod("resolveJsonTemplate",async l=>{let r=this.createLocalTemplateTokenStore(),i=this.resolveLocalFormValuesTemplates(e,l,t,r),o=i.matched?i.value:l,a=u?await u(o,n?{contractModelUid:n}:void 0):o;return this.restoreLocalTemplateTokens(a,r)});let c=!1,p=()=>(c||(i=this.buildItemChainValue(e,o,l)??(null==e?void 0:e.item),c=!0),i);return s.defineProperty("item",{get:p,cache:!1}),s}getLocalFormValuesSnapshot(e){try{var t;let l=null==e||null==(t=e.getFormValues)?void 0:t.call(e);if(l&&"object"==typeof l)return l}catch{}let l=this.options.valuesMirror;return(0,g.isObservable)(l)?(0,g.toJS)(l):l}resolveLocalFormValuesPath(e,t){let l=this.getLocalFormValuesSnapshot(e);if(l&&"object"==typeof l)return(0,c.D)(l,t)}recordLocalFormValuesDep(e,t){let l=(0,x.EA)(e).filter(e=>"object"!=typeof e);if(!l.length){t&&(t.wildcard=!0);return}(0,y.Dd)(l,t)}extractSingleLocalFormValuesPath(e){if("string"!=typeof e)return null;let t=e.match(/^\s*\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}\s*$/);return(null==t?void 0:t[1])??null}stringifyTemplateReplacement(e){if(void 0!==e)return e&&"object"==typeof e?JSON.stringify(e):String(e)}createLocalTemplateTokenStore(){let e=new Map,t=0;return{values:e,protect(l){let n=`__NOCObase_FORM_VALUE_LITERAL_${t}__`;return t+=1,e.set(n,l),n}}}restoreLocalTemplateTokens(e,t){if(!t.values.size)return e;if("string"==typeof e){if(t.values.has(e))return t.values.get(e);let l=e;for(let[e,n]of t.values.entries())l.includes(e)&&(l=l.split(e).join(this.stringifyTemplateReplacement(n)??""));return l}if(Array.isArray(e))return e.map(e=>this.restoreLocalTemplateTokens(e,t));if(u().isPlainObject(e)){let l={};for(let[n,r]of Object.entries(e))l[n]=this.restoreLocalTemplateTokens(r,t);return l}return e}resolveLocalFormValuesTemplates(e,t,l,n){if("string"==typeof t){let r=this.extractSingleLocalFormValuesPath(t);if(r){this.recordLocalFormValuesDep(r,l);let i=this.resolveLocalFormValuesPath(e,r);return void 0!==i?{matched:!0,value:n?n.protect(i):i}:{matched:!1,value:t}}let i=!1,o=t.replace(/\{\{\s*ctx\.formValues\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*)\s*\}\}/g,(t,r)=>{this.recordLocalFormValuesDep(r,l);let o=this.resolveLocalFormValuesPath(e,r),a=this.stringifyTemplateReplacement(o);return void 0===a?t:(i=!0,n?n.protect(a):a)});return{matched:i,value:o}}if(Array.isArray(t)){let r=!1,i=t.map(t=>{let i=this.resolveLocalFormValuesTemplates(e,t,l,n);return i.matched&&(r=!0),i.value});return r?{matched:r,value:i}:{matched:!1,value:t}}if(u().isPlainObject(t)){let r=!1,i={};for(let[o,a]of Object.entries(t)){let t=this.resolveLocalFormValuesTemplates(e,a,l,n);t.matched&&(r=!0),i[o]=t.value}return r?{matched:r,value:i}:{matched:!1,value:t}}return{matched:!1,value:t}}buildItemChainValue(e,t,l){let n=this.getRootCollection()||this.getCollectionFromContext(e),r=(e,t,l,n)=>({index:t,length:l,__is_new__:null==e?void 0:e.__is_new__,__is_stored__:null==e?void 0:e.__is_stored__,value:e,parentItem:n}),i=this.options.getBlockContext(),o=(()=>{try{let e=null==i?void 0:i.item;if(!e||"object"!=typeof e)return;return e.value===(null==i?void 0:i.formValues)?e:void 0}catch{return}})(),a={...r(t,null==o?void 0:o.index,null==o?void 0:o.length,null==o?void 0:o.parentItem),__is_new__:(null==o?void 0:o.__is_new__)??(null==t?void 0:t.__is_new__),__is_stored__:(null==o?void 0:o.__is_stored__)??(null==t?void 0:t.__is_stored__)};if(!l||!Array.isArray(l)||!l.length||!(null==n?void 0:n.getField))return;let s=[],d=[],c=n;for(let e=0;e<l.length;e++){var p,h;let t=l[e];if("string"!=typeof t)break;let n=null==c||null==(p=c.getField)?void 0:p.call(c,t);if(!(null==n||null==(h=n.isAssociationField)?void 0:h.call(n)))break;let r=(0,M.E4)(n);if(d.push(t),r){let t=l[e+1];if("number"==typeof t)d.push(t),e+=1;else if(e!==l.length-1)break}let i=null==n?void 0:n.targetCollection;if(!i)break;s.push({path:[...d],toMany:r}),c=i}let m=e=>{if(e<0)return a;let l=s[e],n=u().get(t,l.path),i=l.path[l.path.length-1],o=l.toMany&&"number"==typeof i,d=o?i:void 0,c=(()=>{if(!l.toMany)return;if(!o)return Array.isArray(n)?n.length:void 0;let e=l.path.slice(0,-1),r=u().get(t,e);return Array.isArray(r)?r.length:void 0})();return r(n,d,c,m(e-1))};return s.length?m(s.length-1):void 0}getFieldIndexSignature(e){var t,l;let n=(null==e||null==(l=e.model)||null==(t=l.context)?void 0:t.fieldIndex)??(null==e?void 0:e.fieldIndex);return(Array.isArray(n)?n:[]).filter(e=>"string"==typeof e).join("|")}updateRuleDeps(e,t,l){var n,r;if(t.depDisposers.forEach(e=>e()),t.depDisposers=[],t.deps=l,l.has("fv:*")){let l=(0,g.reaction)(()=>this.options.changeTick.value,()=>this.scheduleRule(e.id));t.depDisposers.push(l)}let i=(()=>{try{return e.getContext()}catch{return}})(),o=(null==i||null==(r=i.model)||null==(n=r.context)?void 0:n.fieldIndex)??(null==i?void 0:i.fieldIndex);if(Array.isArray(o)&&o.some(e=>"string"==typeof e)){let l=(0,g.reaction)(()=>this.getFieldIndexSignature(i),()=>this.scheduleRule(e.id));t.depDisposers.push(l)}for(let n of l){if("fv:*"===n)continue;if(!n.startsWith("fv:")&&!n.startsWith("ctx:")){let l=(0,x.c1)(n),r=(0,g.reaction)(()=>u().get(this.options.valuesMirror,l),()=>this.scheduleRule(e.id));t.depDisposers.push(r);continue}if(n.startsWith("fv:")){let l=n.slice(3),r=(0,x.c1)(l),i=(0,g.reaction)(()=>u().get(this.options.valuesMirror,r),()=>this.scheduleRule(e.id));t.depDisposers.push(i);continue}let l=n.slice(4),r=l.indexOf(":"),o=r>=0?l.slice(0,r):l,a=r>=0?l.slice(r+1):"",s=a?(0,x.EA)(a).filter(e=>"object"!=typeof e):[];if("item"===o){if(s.length){let l=this.options.createTrackingFormValues({deps:new Set,wildcard:!1}),n=(0,g.reaction)(()=>{var t;let n=null==(t=e.getTarget)?void 0:t.call(e),r=n?this.options.tryResolveNamePath(i,n):null,o=this.buildItemChainValue(i,l,r)??(null==i?void 0:i.item);return u().get(o,s)},()=>this.scheduleRule(e.id));t.depDisposers.push(n)}continue}let d=(0,g.reaction)(()=>{let e=i?i[o]:void 0;return s.length?u().get(e,s):e},()=>this.scheduleRule(e.id));t.depDisposers.push(d)}}constructor(e){(0,n._)(this,"options",void 0),(0,n._)(this,"rules",new Map),(0,n._)(this,"lastRuleWriteByTargetKey",new Map),(0,n._)(this,"assignTemplatesByTargetPath",new Map),(0,n._)(this,"formItemTargetPaths",new Set),(0,n._)(this,"updateAssociationByTargetPath",new Map),(0,n._)(this,"pendingRuleIds",new Set),(0,n._)(this,"ruleDebounceUntilById",new Map),(0,n._)(this,"ruleDebounceTimersById",new Map),(0,n._)(this,"defaultRuleIdsByMasterUid",new Map),(0,n._)(this,"defaultRuleMasterDisposers",new Map),(0,n._)(this,"runningRules",!1),(0,n._)(this,"rulesEnabled",!1),(0,n._)(this,"currentRuleTxId",null),this.options=e}}class R{syncAssignRules(e){this.ruleEngine.syncAssignRules(e)}get formValues(){return this.disposed||this.formPatcher.patch(this.getForm()),this.formValuesProxy}getFormValuesSnapshot(){if(!this.disposed){let e=this.getForm();this.formPatcher.patch(e)}return this.getForm().getFieldsValue(!0)}toMirrorSnapshot(e){let t=e=>u().cloneDeepWith(e,e=>{if((0,g.isObservable)(e)){let l=(0,g.toJS)(e);if(l!==e)return t(l)}if(Array.isArray(e)&&"function"!=typeof e.constructor){let l=Array(e.length);for(let n=0;n<e.length;n++)Object.hasOwn(e,n)&&(l[n]=t(e[n]));return l}if(e&&"object"==typeof e&&!(Array.isArray(e)||u().isPlainObject(e)))return e});return t(e)}canApplyDefaultValuePatch(e,t){if(!(null==e?void 0:e.length)||void 0===t)return!1;let l=(0,x.Qc)(e),n=this.getFormValueAtPath(e),r=this.lastDefaultValueByPathKey.get(l),i=(0,g.isObservable)(t)?(0,g.toJS)(t):t,o=(0,g.isObservable)(n)?(0,g.toJS)(n):n,a=void 0!==r&&u().isEqual(o,r);if(this.findExplicitHit(l)&&!a)return!1;let s=(0,S.Po)(n)||a;return!s&&u().isEqual(n,i)?(this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(i)),!1):s}canApplyOverrideValuePatch(e){return!!(null==e?void 0:e.length)&&!this.findUserEditedHit((0,x.Qc)(e))}recordDefaultValuePatch(e,t){if(!(null==e?void 0:e.length))return;let l=(0,x.Qc)(e),n=arguments.length>=2?(0,g.isObservable)(t)?(0,g.toJS)(t):t:this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(n));let r=this.getFormValueAtPath(e),i=(0,g.isObservable)(r)?(0,g.toJS)(r):r;u().isEqual(i,n)&&this.clearExplicitForDefaultPatch(l)}getFormValueAtPath(e){var t,l;let n=null==(t=(l=this).getForm)?void 0:t.call(l);if(n&&"function"==typeof n.getFieldValue)return n.getFieldValue(e);if(n&&"function"==typeof n.getFieldsValue){let t=n.getFieldsValue(!0);return u().get(t,e)}}mount(e){var t,l;if(this.disposed)return;this.formPatcher.patch(this.getForm());let n=null==(l=this.model)||null==(t=l.flowEngine)?void 0:t.emitter;if(n&&(this.mountedListener||this.unmountedListener||(this.mountedListener=e=>{let{model:t}=e;this.indexMountedFieldModelTree(t),this.ruleEngine.onModelMounted(t)},this.unmountedListener=e=>{let{model:t}=e;this.unindexMountedFieldModelTree(t),this.ruleEngine.onModelUnmounted(t)},n.on("model:mounted",this.mountedListener),n.on("model:unmounted",this.unmountedListener)),this.rebuildMountedFieldModelIndex(),null==e?void 0:e.sync)){let e=this.getFormValuesSnapshot();e&&"object"==typeof e&&(u().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.bumpChangeTick()),this.ruleEngine.enable()}}dispose(){var e,t;if(this.disposed)return;this.disposed=!0,this.formPatcher.restore();let l=null==(t=this.model)||null==(e=t.flowEngine)?void 0:e.emitter;for(let e of(l&&this.mountedListener&&this.unmountedListener&&(l.off("model:mounted",this.mountedListener),l.off("model:unmounted",this.unmountedListener)),this.ruleEngine.dispose(),this.mountedFieldModelsByPathKey.clear(),this.observableBindings.values()))e.dispose();this.observableBindings.clear(),this.txWriteCounts.clear()}resetAfterFormReset(){if(this.disposed)return;for(let e of(this.explicitSet.clear(),this.userEditedSet.clear(),this.lastDefaultValueByPathKey.clear(),this.lastWriteMetaByPathKey.clear(),this.txWriteCounts.clear(),this.lastObservedChangedPaths=null,this.lastObservedSource=null,this.lastObservedToken+=1,this.observableBindings.values()))e.dispose();this.observableBindings.clear();let e=this.getFormValuesSnapshot();for(let e of Object.keys(this.valuesMirror))delete this.valuesMirror[e];e&&"object"==typeof e&&u().merge(this.valuesMirror,this.toMirrorSnapshot(e)),this.writeSeq+=1,this.bumpChangeTick(),this.ruleEngine.rescheduleAllRules()}resetUserEditedState(){this.disposed||(this.userEditedSet.clear(),this.ruleEngine.rescheduleAllRules())}isSuppressed(){return this.suppressFormCallbackDepth>0}handleFormFieldsChange(e){if(this.disposed)return;let t=this.getForm();if(!t.getFieldValue)return;let l=[],n=new Set,r=!1,i=!1;for(let o of e||[]){let e=null==o?void 0:o.name,a=this.normalizeObservedNamePath(e);if(!(null==a?void 0:a.length))continue;let s=t.getFieldValue(a),d=u().get(this.valuesMirror,a);if(!u().isEqual(s,d)&&(i||(this.writeSeq+=1,i=!0),u().set(this.valuesMirror,a,this.toMirrorSnapshot(s)),l.push(a),(null==o?void 0:o.touched)===!0&&!this.shouldIgnoreSyntheticTouchedInit(a,d,s))){let e=(0,x.Qc)(a);this.shouldKeepDefaultPathValueEnabled(a,s)||(n.add(e),r=!0)}}if(!l.length)return;let o=this.isSuppressed();if(!o&&n.size)for(let e of n)this.markExplicit(e),this.markUserEdited(e);if(this.bumpChangeTick(),o)return;let a=r?"user":"system",s=this.writeSeq;for(let e of l)this.lastWriteMetaByPathKey.set((0,x.Qc)(e),{source:a,writeSeq:s});this.lastObservedChangedPaths=l,this.lastObservedSource=a;let d=++this.lastObservedToken;queueMicrotask(()=>{this.disposed||this.lastObservedToken===d&&(this.lastObservedChangedPaths=null,this.lastObservedSource=null)})}shouldIgnoreSyntheticTouchedInit(e,t,l){if(!(null==e?void 0:e.length)||void 0!==t||!(0,S.Po)(l))return!1;for(let t=e.length-1;t>=0;t--){if("number"!=typeof e[t])continue;let l=e.slice(0,t+1),n=this.getFormValueAtPath(l);return!!(null==n?void 0:n.__is_new__)}return!1}isDeletedArrayItemPath(e,t){let l=Array.isArray(e)?e:(0,x.c1)(e);if(!(null==l?void 0:l.length))return!1;for(let e=l.length-1;e>=0;e--){if("number"!=typeof l[e])continue;let n=l.slice(0,e+1);return void 0===u().get(t,n)}return!1}pruneDeletedArrayItemState(e){for(let t of Array.from(this.explicitSet))this.isDeletedArrayItemPath(t,e)&&this.explicitSet.delete(t);for(let t of Array.from(this.userEditedSet))this.isDeletedArrayItemPath(t,e)&&this.userEditedSet.delete(t);for(let t of Array.from(this.lastDefaultValueByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastDefaultValueByPathKey.delete(t);for(let t of Array.from(this.lastWriteMetaByPathKey.keys()))this.isDeletedArrayItemPath(t,e)&&this.lastWriteMetaByPathKey.delete(t);for(let[t,l]of Array.from(this.observableBindings.entries()))this.isDeletedArrayItemPath(t,e)&&(l.dispose(),this.observableBindings.delete(t))}getArrayItemTargetKey(e){var t,l,n,r,i,o;let a,s,d=null==(l=this.model)||null==(t=l.context)?void 0:t.collection;for(let t of e||[])if("number"!=typeof t){if("string"!=typeof t||!(null==d?void 0:d.getField)||(a=null==d||null==(i=d.getField)?void 0:i.call(d,t),!(null==a||null==(o=a.isAssociationField)?void 0:o.call(a))))break;s=a,d=null==a?void 0:a.targetCollection}let u=(null==s||null==(n=s.targetCollection)?void 0:n.filterTargetKey)??(null==s||null==(r=s.targetCollection)?void 0:r.filterByTk)??(null==s?void 0:s.targetKey);if(Array.isArray(u)){let e=u.filter(e=>"string"==typeof e&&!!e);return e.length?e:"id"}return"string"==typeof u&&u?u:"id"}getArrayItemIdentity(e,t){return(0,A.r5)(e,this.getArrayItemTargetKey(t))}reconcileArrayItemState(e,t,l){let n=new Set;for(let r of e||[]){if(!(null==r?void 0:r.length))continue;let e=(0,x.Qc)(r);if(n.has(e))continue;n.add(e);let i=u().get(this.valuesMirror,r),o=this.getObservedChangedValue(r,t,l);if(!Array.isArray(i)||!Array.isArray(o))continue;let a=new Map;o.forEach((e,t)=>{let l=this.getArrayItemIdentity(e,r);l&&a.set(l,t)}),a.size&&(this.reconcileArrayItemSet(this.explicitSet,r,i,a),this.reconcileArrayItemSet(this.userEditedSet,r,i,a),this.reconcileArrayItemMap(this.lastDefaultValueByPathKey,r,i,a),this.reconcileArrayItemMap(this.lastWriteMetaByPathKey,r,i,a),this.reconcileObservableBindings(r,i,a))}}getReconciledArrayItemPath(e,t,l,n){let r=(0,x.c1)(e);if(r.length<=t.length)return{action:"keep"};for(let e=0;e<t.length;e++)if(r[e]!==t[e])return{action:"keep"};let i=r[t.length];if("number"!=typeof i)return{action:"keep"};let o=this.getArrayItemIdentity(l[i],t);if(!o)return{action:"keep"};let a=n.get(o);if(null==a)return{action:"delete"};if(a===i)return{action:"keep"};let s=[...r];return s[t.length]=a,{action:"move",key:(0,x.Qc)(s)}}reconcileArrayItemSet(e,t,l,n){let r=new Set,i=!1;for(let o of e){let e=this.getReconciledArrayItemPath(o,t,l,n);if("delete"===e.action){i=!0;continue}if("move"===e.action){i=!0,r.add(e.key);continue}r.add(o)}if(i)for(let t of(e.clear(),r))e.add(t)}reconcileArrayItemMap(e,t,l,n){let r=new Map,i=!1;for(let[o,a]of e){let e=this.getReconciledArrayItemPath(o,t,l,n);if("delete"===e.action){i=!0;continue}if("move"===e.action){i=!0,r.set(e.key,a);continue}r.set(o,a)}if(i)for(let[t,l]of(e.clear(),r))e.set(t,l)}reconcileObservableBindings(e,t,l){let n=new Map,r=!1;for(let[i,o]of this.observableBindings){let a=this.getReconciledArrayItemPath(i,e,t,l);if("delete"===a.action){r=!0,o.dispose();continue}if("move"===a.action){r=!0,o.pathKey=a.key,n.set(a.key,o);continue}n.set(i,o)}if(r)for(let[e,t]of(this.observableBindings.clear(),n))this.observableBindings.set(e,t)}getObservedChangedValue(e,t,l){if(u().has(l,e))return u().get(l,e);if((null==e?void 0:e.length)===1){let l=e[0];if(("string"==typeof l||"number"==typeof l)&&t&&Object.prototype.hasOwnProperty.call(t,l))return t[l]}return u().get(l,e)}getObservedSnapshot(e,t){if(!e||"object"!=typeof e)return t;if(!t||"object"!=typeof t)return e;let l=t;for(let n of Object.keys(e))u().has(l,[n])||(l===t&&(l=Array.isArray(t)?[...t]:{...t}),u().set(l,[n],e[n]));return l}handleFormValuesChange(e,t){if(this.disposed||this.isSuppressed())return;let l=Object.keys(e||{}).map(e=>[e]),n=this.lastObservedChangedPaths&&this.lastObservedChangedPaths.length?this.lastObservedChangedPaths:l,r=this.lastObservedSource??"user";this.lastObservedChangedPaths=null,this.lastObservedSource=null;let i=this.getFormValuesSnapshot(),o=i&&"object"==typeof i?i:t&&"object"==typeof t?t:e,a=this.getObservedSnapshot(e,o);this.reconcileArrayItemState([...n,...l],e,a),this.pruneDeletedArrayItemState(a);let s=this.deriveExplicitPaths(n,e,a,this.valuesMirror).filter(e=>!this.isDeletedArrayItemPath(e,a)),d=!1,c=!1,p=[];for(let t of n){if(!(null==t?void 0:t.length))continue;let l=this.getObservedChangedValue(t,e,a),n=u().get(this.valuesMirror,t);u().isEqual(n,l)||(c||(this.writeSeq+=1,c=!0),u().set(this.valuesMirror,t,this.toMirrorSnapshot(l)),d=!0,p.push(t))}d&&this.bumpChangeTick();let h=[];for(let e of s)this.shouldKeepDefaultPathEnabled(e,a)||h.push(e);for(let e of h){let t=(0,x.Qc)(e);this.markExplicit(t),"user"===r&&this.markUserEdited(t)}if(d){let e=this.writeSeq;for(let t of p)(null==t?void 0:t.length)&&this.lastWriteMetaByPathKey.set((0,x.Qc)(t),{source:r,writeSeq:e})}let m=(0,S.ao)();this.emitFormValuesChange({source:r,txId:m,changedPaths:n,changedValues:e,allValues:a,allValuesSnapshot:a})}deriveExplicitPaths(e,t,l,n){let r=[],i=new Set;for(let o of e||[]){if(!(null==o?void 0:o.length))continue;let e=u().get(n,o),a=this.getObservedChangedValue(o,t,l);this.collectExplicitDiffPaths(e,a,o,r,i)}return r}collectExplicitDiffPaths(e,t,l,n,r){if(u().isEqual(e,t))return 0;let i=Array.isArray(e),o=Array.isArray(t);if(i||o){if(i&&o){let i=Math.min(e.length,t.length),o=0;for(let a=0;a<i;a++)o+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,r);return e.length!==t.length?o+ +!!this.pushExplicitPath(l,n,r):o}return+!!this.pushExplicitPath(l,n,r)}let a=this.isPlainObjectValue(e),s=this.isPlainObjectValue(t);if(a||s){if(a&&s){let i=new Set([...Object.keys(e),...Object.keys(t)]),o=0;for(let a of i)o+=this.collectExplicitDiffPaths(e[a],t[a],[...l,a],n,r);return 0===o&&this.isObjectCleared(e,t)?+!!this.pushExplicitPath(l,n,r):o}this.isObjectCleared(e,t)}return+!!this.pushExplicitPath(l,n,r)}pushExplicitPath(e,t,l){if(!(null==e?void 0:e.length))return!1;let n=(0,x.Qc)(e);return!(!n||l.has(n))&&(l.add(n),t.push([...e]),!0)}isPlainObjectValue(e){return u().isPlainObject(e)}isObjectCleared(e,t){return!!this.isPlainObjectValue(e)&&!!(null==t||this.isPlainObjectValue(t)&&0===Object.keys(t).length)}async setFormValues(e,t,l){var n,r,i,o;if(this.disposed)return;let a=null==(n=(r=this).getForm)?void 0:n.call(r);if(!a)return;let s=(null==l?void 0:l.source)??"system",d=(null==l?void 0:l.triggerEvent)!==!1,c=(null==l?void 0:l.txId)??(0,S.ao)(),p=(null==l?void 0:l.markExplicit)??("default"!==s&&"linkage"!==s),h=void 0===(null==l?void 0:l.txId),m="linkage"===s&&Number.isFinite(Number(null==l?void 0:l.linkageScopeDepth))?Number(null==l?void 0:l.linkageScopeDepth):0,f="linkage"===s&&"string"==typeof(null==l?void 0:l.linkageTxId)&&l.linkageTxId?String(l.linkageTxId):void 0,y=e=>{if("linkage"!==s||!f)return!1;let t=this.lastWriteMetaByPathKey.get(e);return!!t&&"linkage"===t.source&&!!t.linkageTxId&&t.linkageTxId===f&&(Number.isFinite(Number(t.linkageScopeDepth))?Number(t.linkageScopeDepth):0)>m},b=e=>"linkage"===s?{source:s,writeSeq:e,linkageScopeDepth:m,linkageTxId:f}:{source:s,writeSeq:e},w=e=>"linkage"===s&&f?{...e,linkageTxId:f}:e;try{let l=[];if(!Array.isArray(t)){let e=Object.entries(t||{}).map(e=>{let[t,l]=e;return[t,this.toMirrorSnapshot(l)]}).filter(e=>{let[t,l]=e;return!y(t)&&!u().isEqual(this.getFormValueAtPath([t]),l)}),l=Object.fromEntries(e),n=e.map(e=>{let[t]=e;return t});if(!n.length)return;n.length&&(this.writeSeq+=1),this.suppressFormCallbackDepth++;try{for(let[t,l]of e)"function"==typeof a.setFieldValue?a.setFieldValue(t,l):"function"==typeof a.setFields?a.setFields([{name:t,value:l}]):null==(i=a.setFieldsValue)||i.call(a,{[t]:l}),u().set(this.valuesMirror,[t],this.toMirrorSnapshot(l)),this.syncMountedFieldModelValue([t],l);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let r=this.writeSeq;for(let e of n)this.lastWriteMetaByPathKey.set(e,b(r));if(p)for(let e of n)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if(d){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(w({source:s,txId:c,changedPaths:n.map(e=>[e]),changedValues:l,allValues:e,allValuesSnapshot:e}))}return}let n=new Map,r=0;for(let l of t){let t=null==l?void 0:l.condition;if(t&&!(0,v.F)(e,t))continue;let i=this.resolveNamePath(e,l.path),o=(0,x.Qc)(i),a=l.value,s=this.toMirrorSnapshot(a);if(y(o))continue;let d=this.getFormValueAtPath(i);u().isEqual(d,s)||(r+=1,n.set(o,{order:r,namePath:i,value:s,rawValue:a,pathKey:o}))}let h=Array.from(n.values()).sort((e,t)=>e.order-t.order).map(e=>({namePath:e.namePath,value:e.value,rawValue:e.rawValue,pathKey:e.pathKey}));if(!h.length)return;let M=this.txWriteCounts.get(c)||new Map;this.txWriteCounts.set(c,M);let A=[];for(let e of h){let t=(M.get(e.pathKey)||0)+1;M.set(e.pathKey,t),t>S.li||A.push(e)}if(!A.length)return;this.writeSeq+=1;let F=this.writeSeq;for(let{pathKey:e,rawValue:t}of A)if(!(0,g.isObservable)(t)){let t=this.observableBindings.get(e);t&&(t.dispose(),this.observableBindings.delete(e))}this.suppressFormCallbackDepth++;try{for(let{namePath:e,value:t}of A)null==(o=a.setFieldValue)||o.call(a,e,t),u().set(this.valuesMirror,e,this.toMirrorSnapshot(t)),this.syncMountedFieldModelValue(e,t),l.push(e);this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}for(let{pathKey:e}of A)this.lastWriteMetaByPathKey.set(e,b(F));if(p)for(let{pathKey:e}of A)this.markExplicit(e),"user"===s&&this.markUserEdited(e);if("default"===s)for(let{namePath:e,pathKey:t}of A){let l=this.getFormValueAtPath(e);this.lastDefaultValueByPathKey.set(t,this.toMirrorSnapshot(l))}for(let{rawValue:t,pathKey:l}of A){if(!(0,g.isObservable)(t))continue;let n=t,r={source:s,pathKey:l,dispose:()=>{}},i=(0,g.observe)(n,()=>{let t=r.pathKey;this.applyBoundValue(e,(0,x.c1)(t),t,(0,g.toJS)(n),s,m,f)});r.dispose=i;let o=this.observableBindings.get(l);o&&o.dispose(),this.observableBindings.set(l,r)}if(d){let e=this.getFormValuesSnapshot();this.emitFormValuesChange(w({source:s,txId:c,changedPaths:l,changedValues:{},allValues:e,allValuesSnapshot:e}))}}finally{h&&this.txWriteCounts.delete(c)}}applyBoundValue(e,t,l,n,r,i,o){var a,s,d;if(this.disposed)return;let c=null==(a=(s=this).getForm)?void 0:a.call(s);if(!c||"override"===r&&this.findUserEditedHit(l))return;let p=this.toMirrorSnapshot(n),h=u().get(this.valuesMirror,t);if(u().isEqual(h,p))return;this.writeSeq+=1;let m=this.writeSeq;this.suppressFormCallbackDepth++;try{null==(d=c.setFieldValue)||d.call(c,t,p),u().set(this.valuesMirror,t,this.toMirrorSnapshot(p)),this.syncMountedFieldModelValue(t,p),this.bumpChangeTick()}finally{this.suppressFormCallbackDepth--}let f="linkage"===r?{source:r,writeSeq:m,linkageScopeDepth:Number.isFinite(Number(i))?Number(i):0,linkageTxId:"string"==typeof o&&o?o:void 0}:{source:r,writeSeq:m};this.lastWriteMetaByPathKey.set(l,f);let g=(0,S.ao)(),v=this.getFormValuesSnapshot(),y={source:r,txId:g,changedPaths:[t],changedValues:{},allValues:v,allValuesSnapshot:v};if("linkage"===r&&o&&(y.linkageTxId=o),this.emitFormValuesChange(y),"default"===r&&this.isExplicit(l)||"override"===r&&this.findUserEditedHit(l)){let e=this.observableBindings.get(l);e&&(e.dispose(),this.observableBindings.delete(l))}"default"===r&&this.lastDefaultValueByPathKey.set(l,this.toMirrorSnapshot(this.getFormValueAtPath(t)))}resolveNamePath(e,t){let l=this.tryResolveNamePath(e,t);if(!l)throw Error(`Failed to resolve path '${String(t)}'`);return l}tryResolveNamePath(e,t){var l,n;let r=(null==e||null==(n=e.model)||null==(l=n.context)?void 0:l.fieldIndex)??(null==e?void 0:e.fieldIndex);return(0,x.IJ)(t,r)}bumpChangeTick(){this.changeTick.value+=1}emitFormValuesChange(e){var t,l,n,r;null==(t=(l=this.model).dispatchEvent)||t.call(l,"formValuesChange",e,{debounce:!0}),null==(r=this.model.emitter)||null==(n=r.emit)||n.call(r,"formValuesChange",e)}syncMountedFieldModelValue(e,t){let l=(0,x.Qc)(e);if(!l)return;let n=this.mountedFieldModelsByPathKey.get(l);if(!(null==n?void 0:n.size))return;let r=new Set;for(let e of Array.from(n))this.syncMountedFieldModelValueForModel(e,t,r)}syncMountedFieldModelValueForModel(e,t,l){var n,r,i;if(!e||l.has(e)||(l.add(e),!this.isMountedModelInThisForm(e)))return;let o={value:t};null==(n=e.setProps)||n.call(e,o);let a=null==(r=e.subModels)?void 0:r.field;null==a||null==(i=a.setProps)||i.call(a,o)}rebuildMountedFieldModelIndex(){var e,t;this.mountedFieldModelsByPathKey.clear();let l=null==(t=this.model)||null==(e=t.context)?void 0:e.engine;l&&"function"==typeof l.forEachModel&&l.forEachModel(e=>{this.indexMountedFieldModelTree(e)})}indexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.indexMountedFieldModel(e))}unindexMountedFieldModelTree(e){this.visitModelAndForks(e,e=>this.unindexMountedFieldModel(e))}visitModelAndForks(e,t){if(!e)return;let l=new Set,n=e=>{var r;if(!e||l.has(e))return;l.add(e),t(e);let i=e.forks;null==i||null==(r=i.forEach)||r.call(i,e=>n(e))};n(e)}indexMountedFieldModel(e){if(!this.isMountedModelInThisForm(e))return;let t=new Set;for(let l of this.getMountedModelNamePaths(e)){let e=(0,x.Qc)(l);e&&t.add(e)}if(t.size)for(let l of(this.unindexMountedFieldModel(e),this.mountedFieldModelPathKeys.set(e,t),t)){let t=this.mountedFieldModelsByPathKey.get(l)||new Set;t.add(e),this.mountedFieldModelsByPathKey.set(l,t)}}unindexMountedFieldModel(e){let t=this.mountedFieldModelPathKeys.get(e);if(t){for(let l of t){let t=this.mountedFieldModelsByPathKey.get(l);t&&(t.delete(e),t.size||this.mountedFieldModelsByPathKey.delete(l))}this.mountedFieldModelPathKeys.delete(e)}}isMountedModelInThisForm(e){var t;let l=null==(t=e.context)?void 0:t.blockModel;return!!l&&String(l.uid)===String(this.model.uid)}getMountedModelNamePaths(e){var t,l;let n=[],r=e=>{let t=this.normalizeNamePathValue(e);(null==t?void 0:t.length)&&n.push(t)};r(null==(t=e.context)?void 0:t.fieldPathArray);let i="function"==typeof e.getProps?e.getProps():e.props;i&&"object"==typeof i&&r(i.name);try{let t=null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init");t&&"object"==typeof t&&r(t.fieldPath)}catch{}let o=new Set;return n.filter(e=>{let t=(0,x.Qc)(e);return!(!t||o.has(t))&&(o.add(t),!0)})}normalizeNamePathValue(e){if(Array.isArray(e)){let t=e.filter(e=>"string"==typeof e||"number"==typeof e);return t.length===e.length?t:null}return"number"==typeof e?[e]:"string"==typeof e&&e?(0,x.c1)(e):null}markExplicit(e){if(this.explicitSet.has(e))return;this.explicitSet.add(e);let t=this.shouldPreserveDescendantDefaultsOnExplicit(e);for(let l of Array.from(this.lastDefaultValueByPathKey.keys())){let n=l.startsWith(`${e}.`)||l.startsWith(`${e}[`);(l===e||!t&&n)&&this.lastDefaultValueByPathKey.delete(l)}for(let[e,t]of Array.from(this.observableBindings.entries()))"default"===t.source&&this.isExplicit(e)&&(t.dispose(),this.observableBindings.delete(e))}markUserEdited(e){if(!this.userEditedSet.has(e))for(let[t,l]of(this.userEditedSet.add(e),Array.from(this.observableBindings.entries())))"override"===l.source&&this.findUserEditedHit(t)&&(l.dispose(),this.observableBindings.delete(t))}normalizeObservedNamePath(e){if(Array.isArray(e))return e;if("number"==typeof e)return[e];if("string"!=typeof e||!e)return null;let t=(0,x.c1)(e);return t.length?t:[e]}clearExplicitForDefaultPatch(e){for(let t of Array.from(this.explicitSet))(t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`))&&this.explicitSet.delete(t)}shouldPreserveDescendantDefaultsOnExplicit(e){return Array.isArray(this.getFormValueAtPath((0,x.c1)(e)))}shouldKeepDefaultPathEnabled(e,t){return this.shouldKeepDefaultPathValueEnabled(e,u().get(t,e))}shouldKeepDefaultPathValueEnabled(e,t){let l=(0,x.Qc)(e),n=this.lastDefaultValueByPathKey.get(l);if(void 0===n)return!1;let r=(0,g.isObservable)(t)?(0,g.toJS)(t):t;return u().isEqual(r,n)}isExplicit(e){return!!this.findExplicitHit(e)}findExplicitHit(e){if(this.explicitSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.explicitSet.has(n)&&"number"!=typeof t[e+1])return n}return null}findUserEditedHit(e){if(this.userEditedSet.has(e))return e;let t=(0,x.c1)(e),l=[];for(let e=0;e<t.length;e++){l.push(t[e]);let n=(0,x.Qc)(l);if(this.userEditedSet.has(n)&&"number"!=typeof t[e+1])return n}for(let t of this.userEditedSet)if(this.isDescendantPathKey(t,e))return t;return null}isDescendantPathKey(e,t){if(!e||!t||e===t)return!1;let l=(0,x.c1)(e),n=(0,x.c1)(t);return!(l.length<=n.length)&&n.every((e,t)=>l[t]===e)}constructor(e){(0,n._)(this,"model",void 0),(0,n._)(this,"getForm",void 0),(0,n._)(this,"valuesMirror",(0,g.observable)({})),(0,n._)(this,"explicitSet",new Set),(0,n._)(this,"userEditedSet",new Set),(0,n._)(this,"lastDefaultValueByPathKey",new Map),(0,n._)(this,"lastWriteMetaByPathKey",new Map),(0,n._)(this,"observableBindings",new Map),(0,n._)(this,"changeTick",g.observable.ref(0)),(0,n._)(this,"txWriteCounts",new Map),(0,n._)(this,"writeSeq",0),(0,n._)(this,"disposed",!1),(0,n._)(this,"suppressFormCallbackDepth",0),(0,n._)(this,"lastObservedChangedPaths",null),(0,n._)(this,"lastObservedSource",null),(0,n._)(this,"lastObservedToken",0),(0,n._)(this,"formValuesProxy",void 0),(0,n._)(this,"mountedFieldModelsByPathKey",new Map),(0,n._)(this,"mountedFieldModelPathKeys",new WeakMap),(0,n._)(this,"mountedListener",void 0),(0,n._)(this,"unmountedListener",void 0),(0,n._)(this,"formPatcher",void 0),(0,n._)(this,"ruleEngine",void 0),this.model=e.model,this.getForm=e.getForm,this.formPatcher=b({isSuppressed:()=>this.isSuppressed(),getCallerContext:()=>{var e;return null==(e=this.model)?void 0:e.context},setFormValues:this.setFormValues.bind(this)}),this.ruleEngine=new E({getBlockModelUid:()=>{var e;return String(null==(e=this.model)?void 0:e.uid)},getAssignRulesModelUid:()=>{var e,t;let l=null==(t=this.model)||null==(e=t.subModels)?void 0:e.grid;return!Array.isArray(l)&&(null==l?void 0:l.uid)?String(l.uid):void 0},getActionName:()=>{var e,t,l,n;return(null==(t=this.model)||null==(e=t.getAclActionName)?void 0:e.call(t))??(null==(n=this.model)||null==(l=n.context)?void 0:l.actionName)},getBlockContext:()=>{var e;return null==(e=this.model)?void 0:e.context},getEngine:()=>{var e,t;return null==(t=this.model)||null==(e=t.context)?void 0:e.engine},getEngineModel:e=>{var t,l,n,r;return(null==(r=this.model)||null==(n=r.context)||null==(l=n.engine)||null==(t=l.getModel)?void 0:t.call(l,e))??null},isDisposed:()=>this.disposed,valuesMirror:this.valuesMirror,changeTick:this.changeTick,getWriteSeq:()=>this.writeSeq,txWriteCounts:this.txWriteCounts,createTrackingFormValues:e=>(0,y.x3)({valuesMirror:this.valuesMirror,basePath:[],collector:e,getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)}),tryResolveNamePath:(e,t)=>this.tryResolveNamePath(e,t),getFormValueAtPath:e=>this.getFormValueAtPath(e),setFormValues:(e,t,l)=>this.setFormValues(e,t,l),findExplicitHit:e=>this.findExplicitHit(e),findUserEditedHit:e=>this.findUserEditedHit(e),lastDefaultValueByPathKey:this.lastDefaultValueByPathKey,lastWriteMetaByPathKey:this.lastWriteMetaByPathKey,observableBindings:this.observableBindings}),this.formValuesProxy=(0,y.x3)({valuesMirror:this.valuesMirror,basePath:[],getFormValuesSnapshot:()=>this.getFormValuesSnapshot(),getFormValueAtPath:e=>this.getFormValueAtPath(e)})}}function I(e,t){let l=Array.isArray(e)?e:[],n=new Set,r=e=>{var l,n,r;if(!t||"function"!=typeof t.getField||"string"!=typeof e||!e.includes("."))return null;let i=e.split(".").filter(Boolean);if(i.length<2)return null;let o=t,a=[],s=null,d=null;for(let e=0;e<i.length-1;e++){let t=i[e],r=null==o||null==(l=o.getField)?void 0:l.call(o,t);if(!(null==r||null==(n=r.isAssociationField)?void 0:n.call(r))||!(null==r?void 0:r.targetCollection))break;a.push(t),s=a.join("."),d=r,o=r.targetCollection}if(s&&d){let e=i[i.length-1],t=(null==d?void 0:d.targetKey)??(null==d||null==(r=d.targetCollection)?void 0:r.filterTargetKey)??"id",l=Array.isArray(t)?t.filter(e=>"string"==typeof e&&!!e):"string"==typeof t&&t?[t]:["id"];if("string"==typeof e&&l.includes(e))return null}return s};for(let e of l){let t=(null==e?void 0:e.targetPath)?String(e.targetPath):"";if(!t)continue;let l=r(t);l&&n.add(l)}return Array.from(n)}var T=l(71712);let _={formModelSettings:new Set(["layout","assignRules"]),eventSettings:new Set(["linkageRules"])},D="nb-flow-keep-mobile-horizontal",N=(0,o.css)`
|
|
1261
1261
|
&.${D} {
|
|
1262
1262
|
@media (max-width: 575px) {
|
|
1263
1263
|
.ant-form-item {
|
|
@@ -1276,7 +1276,7 @@ ${r}`,c)}}let n=R(e.issues.filter(e=>"runtime"===e.type)),r=n?`Key runtime issue
|
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
`;function O(e,t){var l;return!!(null==(l=_[e])?void 0:l.has(t))}class $ extends f.t{get form(){return this.context.form}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let n=this.getStepParams("formModelSettings","assignRules"),r=(null==n?void 0:n.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(r)?r:[]);let i=null==(l=this.context)?void 0:l.resource,o=I(r,this.collection);(null==i?void 0:i.addUpdateAssociationValues)&&o.length&&i.addUpdateAssociationValues(o)}renderConfigureActions(){return(0,r.jsx)(a.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,r.jsx)(a.FlowSettingsButton,{icon:(0,r.jsx)(i.A,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var n;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(n=super.onDispatchEventStart)?void 0:n.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&O(e,t)&&l){let n=l.getStepParams(e,t);return void 0!==n?n:super.getStepParams(e,t)}if(e&&!t&&_[e]&&l){let t=super.getStepParams(e)||{},n=l.getStepParams(e)||{};for(let l of _[e])Object.prototype.hasOwnProperty.call(n,l)&&void 0!==n[l]&&(t[l]=n[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let n=this.subModels.grid,r=(e,t)=>{let l=_[e];if(!l||!n)return t;let r={};for(let[i,o]of Object.entries(t))l.has(i)?n.setStepParams(e,i,o):r[i]=o;return r};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(O(e,t)&&n?n.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=r(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,n]of Object.entries(e)){if("object"!=typeof n||null===n){t[l]=n;continue}let e=r(l,n);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,m.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,a.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=s.A.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new R({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,n,r,i,o,s,d,u,p,h,m,f,g;if(!e)return!1;let v=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!v||!(null==(n=this.collection)||null==(l=n.getField)?void 0:l.call(n,v)))return!1;if((()=>{var e,t,l,n;let r=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],i=new Set;for(let e of r){let t=null==e||null==(n=e.getStepParams)||null==(l=n.call(e,"fieldSettings","init"))?void 0:l.fieldPath,r=null==t?void 0:t.toString().split(".")[0];r&&i.add(r)}return i})().has(v)){let l=null==(i=this.form)||null==(r=i.getFieldValue)?void 0:r.call(i,v);if(null==l||Array.isArray(l)&&0===l.length)return!1;let n=t.getFormValuesSnapshot();return(!n||"object"!=typeof n||void 0===(0,c.D)(n,e))&&(0,a.createAssociationSubpathResolver)(()=>this.collection,()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(d=this.context)||null==(s=d.resource)||null==(o=s.getMeta)?void 0:o.call(s,"currentFilterByTk"))??(null==(h=this.context)||null==(p=h.resource)||null==(u=p.getFilterByTk)?void 0:u.call(p))??(null==(g=this.collection)||null==(f=g.getFilterByTK)?void 0:f.call(g,null==(m=this.context)?void 0:m.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,n){return t.setFormValues(this,[{path:e,value:l}],n)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),(0,n._)(this,"formValueRuntime",void 0),(0,n._)(this,"userModifiedTopLevelFields",new Set),(0,n._)(this,"_defaultCustomModelClasses",{FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"}),(0,n._)(this,"customModelClasses",{})}}function B(e){var t,l,n,i;let{model:o,children:a,layoutProps:u={},initialValues:c,...p}=e,h=!!((null==o||null==(t=o.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),m=[p.className,h?D:"",h?N:""].filter(Boolean).join(" ");return(0,r.jsx)(s.A,{form:o.form,initialValues:(null==(i=o.context)||null==(n=i.view)||null==(l=n.inputArgs)?void 0:l.formData)||o.context.record||c,...(0,d.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=o.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=o.markUserModifiedFields)||l.call(o,e);let n=o.formValueRuntime;n?n.handleFormValuesChange(e,t):(o.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),o.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:m||void 0,children:a})}let L=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,r=parseFloat(l.marginBottom)||0;return t.height+n+r},q=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},V=e=>{let{heightMode:t,containerRef:l,actionsRef:n,footerRef:r,deps:i=[]}=e,[o,a]=(0,p.useState)(),s=(0,p.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let o=Math.max(0,Math.floor(i-L((null==n?void 0:n.current)||null)-L((null==r?void 0:r.current)||null)));a(e=>e===o?e:o)},[t,l,n,r]);return(0,p.useLayoutEffect)(()=>{s()},[s,...i]),(0,p.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==n?void 0:n.current)||null,i=(null==r?void 0:r.current)||null,o=new ResizeObserver(()=>s());return o.observe(e),t&&o.observe(t),i&&o.observe(i),()=>o.disconnect()},[s,l,n,r,...i]),o},z=e=>{var t,l;let{model:n,gridModel:i,layoutProps:o,onFinish:a,grid:s,actions:d,footer:u,heightMode:c,height:h}=e,m=(0,p.useRef)(null),f=(0,p.useRef)(null),g=(0,p.useRef)(null),v="specifyValue"===c||"fullHeight"===c,y={paddingTop:null==(l=n.context)||null==(t=l.themeToken)?void 0:t.padding},b=(null==o?void 0:o.layout)==="horizontal"?q(null==o?void 0:o.labelWidth):void 0;b&&(y.marginInlineStart=b);let x=V({heightMode:c,containerRef:m,actionsRef:d?f:void 0,footerRef:u?g:void 0,deps:[h]});(0,p.useEffect)(()=>{var e;if(!i)return;let t=v?x:void 0;(null==(e=i.props)?void 0:e.height)!==t&&i.setProps({height:t})},[i,x,v]);let w=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,S=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,r.jsx)(B,{model:n,layoutProps:o,onFinish:a,style:w,children:(0,r.jsxs)("div",{ref:m,style:S,children:[s,d?(0,r.jsx)("div",{style:y,ref:f,children:d}):null,u?(0,r.jsx)("div",{ref:g,children:u}):null]})})};$.define({hide:!0}),$.registerFlow({key:"formModelSettings",title:(0,a.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,a.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,a.tExpr)("Field values"),beforeParamsSave(e){let t=(0,T.Fp)(e.model);Array.isArray(t)&&t.length&&(0,m.jI)(e.model)},afterParamsSave(e){var t,l,n,r,i,o;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(n=e.model)||null==(l=n.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(i=e.model)||null==(r=i.context)?void 0:r.resource,u=I(s,null==(o=e.model)?void 0:o.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),$.registerFlow({key:"eventSettings",title:(0,a.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),$.registerEvents({formValuesChange:{title:(0,a.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,a.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":h.H}},handler:h.b}});class K extends ${}K.define({hide:!0})},71712(e,t,l){l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>n.S2});var n=l(50314);let r=["editItemSettings","formItemSettings"],i=(0,n.li)(r),o=(0,n.u4)(r);function a(e){return(0,n.TE)(e,i)}function s(e){return(0,n.Co)(e,i,o)}},53831(e,t,l){l.d(t,{submitHandler:()=>a});var n=l(11869),r=l(58428),i=l(18357);function o(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,h,m,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,71616)),b=v instanceof y;await (0,i.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,i.go)(null==e?void 0:e.model)});let x=v.form.getFieldsValue(!0),w=(0,i.xT)(x,v),S=await (0,r.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!S){null==(s=e.exit)||s.call(e);return}let M=(0,r.GO)(w,S);if(g instanceof n.SingleRecordResource){if(b){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=o(a?await a(M):await g.save(M,t.requestConfig));return b?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(h=v.formValueRuntime)||null==(p=h.resetAfterFormReset)||p.call(h),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof n.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let n=a?await a(M,l):await g.update(l,M,t.requestConfig);return null==(m=v.resetUserModifiedFields)||m.call(v),o(n)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},18357(e,t,l){l.d(t,{D9:()=>v,go:()=>g,xT:()=>y});var n=l(40098),r=l.n(n),i=l(12197);function o(e,t){var l,n;let r=null==e||null==(n=e.context)||null==(l=n.blockModel)?void 0:l.uid,i=null==t?void 0:t.uid;return!!r&&!!i&&String(r)===String(i)}function a(e){var t,l;let n=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(n)&&n.length)return n;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),n=null==t?void 0:t.fieldPath;if("string"==typeof n&&n)return n}catch{}let r=null==e?void 0:e.fieldPath;if("string"==typeof r&&r)return r;let i="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,o=null==i?void 0:i.name;return"string"==typeof o&&o||Array.isArray(o)&&o.length?o:null}function s(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function d(e){var t;let l=a(e);return l?s((0,i.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function u(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let i=r().get(e,n);r().isPlainObject(i)&&0===Object.keys(i).length&&r().unset(e,n)}}function c(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function p(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],n=new Set;return c(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!o(t,e))return;let r=d(t);if(!r)return;let i=JSON.stringify(r);n.has(i)||(n.add(i),l.push(r))}),l}function h(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?s(e):null}function m(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function f(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let n=[],r=new Set;for(let e of l){let t=h(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);r.has(l)||(r.add(l),n.push(t))}if(!n.length)return null;let i=p(e);return i.length?n.filter(e=>!i.some(t=>m(t,e))):n}function g(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function v(e){let{form:t,blockModel:l,flowSettingsEnabled:n,skipValidator:r}=e;if(r||!t||"function"!=typeof t.validateFields)return;let i=n&&l?f(l):null;if(Array.isArray(i)){i.length&&await t.validateFields(i);return}await t.validateFields()}function y(e,t){if(!e||"object"!=typeof e)return e;let l=p(t);if(!l.length)return e;let n=r().cloneDeep(e);for(let e of l)r().unset(n,e),u(n,e);return n}},29676(e,t,l){l.d(t,{F:()=>r});var n=l(13939);function r(e,t){let l=(t,l,n)=>{var r,i,o;return!l||(null==e||null==(o=e.app)||null==(i=o.jsonLogic)||null==(r=i.apply)?void 0:r.call(i,{[l]:[t,n]}))};try{return(0,n.evaluateConditions)((0,n.removeInvalidFilterItems)(t),l)}catch{return!1}}},47632(e,t,l){l.d(t,{Dd:()=>d,G:()=>c,Wp:()=>p,x3:()=>u});var n=l(95243),r=l(11869),i=l(40098),o=l.n(i),a=l(12197);function s(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||o().isPlainObject(e))}function d(e,t){if(t)for(let l of(0,a.ef)(e))t.deps.add(`fv:${l}`)}function u(e){let{valuesMirror:t,collector:l,basePath:r,getFormValuesSnapshot:i,getFormValueAtPath:a}=e,c=()=>r.length?o().get(t,r):t,p=c(),h=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},m=e=>u({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:i,getFormValueAtPath:a});return new Proxy(h,{get(e,u){if("toJSON"===u)return(l&&(l.wildcard=!0),0===r.length)?()=>i():()=>(0,n.toJS)(c());if("symbol"==typeof u){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[u]}let p=c();if(null==p)return;if("__raw"===u)return p;if("__proto__"===u||"prototype"===u||"constructor"===u){l&&(l.wildcard=!0);return}let h=Array.isArray(p),f=h&&("number"==typeof u&&Number.isInteger(u)||"string"==typeof u&&/^\d+$/.test(u));if(h&&!f){l&&(l.wildcard=!0);let e=p[u];return"function"==typeof e?e.bind(p):e}let g=[...r,f?Number(u):u];d(g,l);let v=p[u];if(void 0===v){let e=a(g);o().isEqual(e,v)||(o().set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:s(v)?m(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function c(e,t){try{let l=(0,r.extractUsedVariablePaths)(e)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function p(e,t){if((0,r.isRunJSValue)(e))try{let l=(0,r.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},12197(e,t,l){function n(e){let t=[],l=0,n=e.length,r=()=>{let r=l;for(;l<n&&"."!==e[l]&&"["!==e[l];)l++;let i=e.slice(r,l);i&&t.push(i)};for(;l<n;){let i=e[l];if("."===i){l++;continue}if("["===i){let r=++l;for(;l<n&&"]"!==e[l];)l++;let i=e.slice(r,l);l++,/^\d+$/.test(i)?t.push(Number(i)):i&&t.push({placeholder:i});continue}r()}return t}function r(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,n]=e.split(":"),r=Number(n);!t||Number.isNaN(r)||l.push({name:t,index:r})}return l}function i(e,t){let l=Array.isArray(e)?[...e]:n(e),i=r(t),o=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=o[o.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<i.length&&i[a].name!==t;)a++;if(a>=i.length)return null;o.push(i[a].index),a++;continue}if(o.push(t),"string"==typeof t&&a<i.length&&i[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(o.push(i[a].index),a++)}}return o}function o(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return n(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let n of e)l.push(n),t.push(o(l));return t}l.d(t,{EA:()=>n,IJ:()=>i,Qc:()=>o,c1:()=>a,ef:()=>s})},65421(e,t,l){l.d(t,{Po:()=>o,ao:()=>a,li:()=>i});var n=l(40098),r=l.n(n);let i=20;function o(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!r().isPlainObject(e)&&0===Object.keys(e).length)}function a(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},50314(e,t,l){l.d(t,{Co:()=>f,PP:()=>o,S2:()=>m,TE:()=>h,li:()=>d,u4:()=>p});var n=l(40098),r=l.n(n);function i(){return{logic:"$and",items:[]}}function o(e,t,l){var n;let r=null==e||null==(n=e.getStepParams)?void 0:n.call(e,t,l);return!!r&&Object.prototype.hasOwnProperty.call(r,"value")}function a(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function s(e,t){var l,n;if(e)return null==(n=e.getStepParams)||null==(l=n.call(e,t,"initialValue"))?void 0:l.defaultValue}function d(e){return t=>{if(!t)return;let l=a(t);if(void 0!==l)return l;for(let l of e){let e=s(t,l);if(void 0!==e)return e}}}function u(e,t,l){var n,i,o;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],r().isEmpty(a)&&delete e.stepParams[t],null==(o=e.emitter)||null==(i=o.emit)||i.call(o,"onStepParamsChanged"))}function c(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let n=null==(l=e._options)?void 0:l.props;n&&Object.prototype.hasOwnProperty.call(n,"initialValue")&&delete n.initialValue}function p(e){return t=>{if(t)for(let l of(c(t),e))u(t,l,"initialValue")}}function h(e,t){var l,n,r,o,a;let s=null==e||null==(r=e.subModels)||null==(n=r.grid)||null==(l=n.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(o=a.call(e,"fieldSettings","init"))?void 0:o.fieldPath)||(null==e?void 0:e.fieldPath),n=l?String(l):"";if(!n)continue;let r=t(e);void 0!==r&&u.push({key:`legacy-default:${n}`,enable:!0,targetPath:n,mode:"default",condition:i(),value:r})}return u}function m(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let r=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){r.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&r.add(t)}}let i=new Set(l.map(e=>String(e.key??""))),o=[];for(let e of n){let t=e.targetPath?String(e.targetPath):"";if(!t||r.has(t))continue;let l={...e},n=String(l.key??"");n&&i.has(n)&&(l.key=`${n}:${t}`),o.push(l)}return o.length?[...l,...o]:l}function f(e,t,l){var n,r,i;let o=null==e||null==(i=e.subModels)||null==(r=i.grid)||null==(n=r.subModels)?void 0:n.items,a=Array.isArray(o)?o:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},26866(e,t,l){l.d(t,{$4:()=>a,r5:()=>o});var n=l(27253);let r="__index__";function i(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function o(e,t){let l=null==e?void 0:e[r];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let n=i(e,t);return null!=n?`pk:${n}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[r];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[r]:(0,n.uid)()}):e});return t?l:e}},69586(e,t,l){l.d(t,{m:()=>p});var n=l(74848),r=l(11869),i=l(95725),o=l(96540),a=l(44329),s=l(81486),d=l(16860);function u(e){let{value:t,onChange:l,onCompositionStart:r,onCompositionEnd:a,...s}=e,[d,u]=(0,o.useState)(()=>c(t));(0,o.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,n.jsx)(i.A,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==r||r(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,n.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,n.jsx)(u,{...l})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,n;null==(n=e.blockModel)||null==(l=n.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.d_)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,r.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,r.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,r.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let n=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(n||{},"enableScan")?!!(null==n?void 0:n.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,r.tExpr)("Input")}),r.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),r.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},95267(e,t,l){l.d(t,{o:()=>r,e:()=>d});var n=l(50467);class r{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){(0,n._)(this,"apiClient",void 0),(0,n._)(this,"loading",void 0),(0,n._)(this,"data",void 0),(0,n._)(this,"error",void 0),(0,n._)(this,"pending",void 0),(0,n._)(this,"listeners",void 0),this.apiClient=e,this.loading=!1,this.listeners=new Set}}var i=l(11869),o=l(2077),a=l(84256),s=l(96540);let d=()=>{var e,t;let l=(0,o.nm)().systemSettings,n=(0,i.useFlowEngine)({throwError:!1}),[,r]=(0,s.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,s.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>a.A[e]).map(e=>({label:a.A[e].label,value:e})),[d]);return(0,s.useEffect)(()=>(l.load(),l.subscribe(()=>{r(e=>e+1)})),[l]),(0,s.useEffect)(()=>{n&&n.context.defineProperty("locale",{get:e=>{var t,l,n;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(n=e.i18n)?void 0:n.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[n,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},94130(e,t,l){l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let n={view:"get"},r=e=>e?n[e]||e:null,i=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>r(e)).filter(Boolean)}},o=(e,t)=>{let l=r(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:n,unavailableActions:i}=e.options;return Array.isArray(n)?n.includes(l):!Array.isArray(i)||!i.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>o(e,t)),s=e=>{var t;let l=i(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let n=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof n)return null;try{let e=n.call({}),t=r(e);return t?[t]:null}catch{return null}},d=e=>i(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},42632(e,t,l){l.d(t,{l:()=>n});function n(e){let{blockLabel:t,dsName:l,dsCount:n,collectionTitle:r,sourceCollectionTitle:i,associationTitle:o}=e,a=n>1&&!!l,s=r;if(i&&o){let e=`${i} > ${o} (${r})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${r}`;return`
|
|
1279
|
+
`;function O(e,t){var l;return!!(null==(l=_[e])?void 0:l.has(t))}class $ extends f.t{serialize(){return{...super.serialize(),variableContractType:{type:"form",use:this.use}}}get form(){return this.context.form}syncRuntimeAssignRules(){var e,t,l;arguments.length>0&&void 0!==arguments[0]&&arguments[0];let n=this.getStepParams("formModelSettings","assignRules"),r=(null==n?void 0:n.value)||[];null==(t=this.formValueRuntime)||null==(e=t.syncAssignRules)||e.call(t,Array.isArray(r)?r:[]);let i=null==(l=this.context)?void 0:l.resource,o=I(r,this.collection);(null==i?void 0:i.addUpdateAssociationValues)&&o.length&&i.addUpdateAssociationValues(o)}renderConfigureActions(){return(0,r.jsx)(a.AddSubModelButton,{model:this,subModelKey:"actions",subModelBaseClass:this.getModelClassName("FormActionGroupModel"),children:(0,r.jsx)(a.FlowSettingsButton,{icon:(0,r.jsx)(i.A,{}),children:this.translate("Actions")})})}setFieldsValue(e){let t=this.context;"function"==typeof t.setFormValues?t.setFormValues(e,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form values via ctx.setFormValues",e)}):this.form.setFieldsValue(e)}setFieldValue(e,t){let l=this.context;"function"==typeof l.setFormValue?l.setFormValue(e,t,{source:"system"}).catch(e=>{console.warn("[FormBlockModel] Failed to set form value via ctx.setFormValue",e)}):this.form.setFieldValue(e,t)}markUserModifiedFields(e){if(e&&"object"==typeof e&&!Array.isArray(e))for(let t of Object.keys(e))t&&this.userModifiedTopLevelFields.add(t)}getUserModifiedFields(){return this.userModifiedTopLevelFields}resetUserModifiedFields(){this.userModifiedTopLevelFields.clear()}resetRuntimeUserEditedState(){var e,t;null==(t=this.formValueRuntime)||null==(e=t.resetUserEditedState)||e.call(t)}async onDispatchEventStart(e,t,l){var n;if("beforeRender"===e){let e=this.subModels.grid;e&&await e.dispatchEvent("beforeRender",l,{useCache:null==t?void 0:t.useCache})}await (null==(n=super.onDispatchEventStart)?void 0:n.call(this,e,t,l))}getStepParams(e,t){let l=this.subModels.grid;if(e&&t&&O(e,t)&&l){let n=l.getStepParams(e,t);return void 0!==n?n:super.getStepParams(e,t)}if(e&&!t&&_[e]&&l){let t=super.getStepParams(e)||{},n=l.getStepParams(e)||{};for(let l of _[e])Object.prototype.hasOwnProperty.call(n,l)&&void 0!==n[l]&&(t[l]=n[l]);return t}return super.getStepParams(e,t)}setStepParams(e,t,l){let n=this.subModels.grid,r=(e,t)=>{let l=_[e];if(!l||!n)return t;let r={};for(let[i,o]of Object.entries(t))l.has(i)?n.setStepParams(e,i,o):r[i]=o;return r};if("string"==typeof e&&"string"==typeof t&&void 0!==l)return void(O(e,t)&&n?n.setStepParams(e,t,l):super.setStepParams(e,t,l));if("string"==typeof e&&"object"==typeof t&&null!==t){let l=r(e,t);Object.keys(l).length>0&&super.setStepParams(e,l);return}if("object"==typeof e&&null!==e){let t={};for(let[l,n]of Object.entries(e)){if("object"!=typeof n||null===n){t[l]=n;continue}let e=r(l,n);Object.keys(e).length>0&&(t[l]=e)}Object.keys(t).length>0&&super.setStepParams(t)}}async saveStepParams(){return await (0,m.ON)(this,async()=>{let e=await super.saveStepParams(),t=this.subModels.grid;return await (null==t?void 0:t.saveStepParams()),e})}createFormValuesMetaFactory(){return(0,a.createAssociationAwareObjectMetaFactory)(()=>this.collection,this.translate("Current form"),()=>{var e,t;return(null==(t=this.form)||null==(e=t.getFieldsValue)?void 0:e.call(t))||{}})}useHooksBeforeRender(){let[e]=s.A.useForm();this.context.defineProperty("form",{get:()=>e}),this.formValueRuntime||(this.formValueRuntime=new R({model:this,getForm:()=>this.context.form}));let t=this.formValueRuntime;t.mount();let l=this.createFormValuesMetaFactory();this.context.defineProperty("formValues",{get:()=>t.formValues,cache:!1,meta:l,resolveOnServer:e=>{var l,n,r,i,o,s,d,u,p,h,m,f,g;if(!e)return!1;let v=(e=>{let t=String(e||"").match(/^([^.[]+)/);return null==t?void 0:t[1]})(e);if(!v||!(null==(n=this.collection)||null==(l=n.getField)?void 0:l.call(n,v)))return!1;if((()=>{var e,t,l,n;let r=(null==(t=this.subModels.grid)||null==(e=t.subModels)?void 0:e.items)??[],i=new Set;for(let e of r){let t=null==e||null==(n=e.getStepParams)||null==(l=n.call(e,"fieldSettings","init"))?void 0:l.fieldPath,r=null==t?void 0:t.toString().split(".")[0];r&&i.add(r)}return i})().has(v)){let l=null==(i=this.form)||null==(r=i.getFieldValue)?void 0:r.call(i,v);if(null==l||Array.isArray(l)&&0===l.length)return!1;let n=t.getFormValuesSnapshot();return(!n||"object"!=typeof n||void 0===(0,c.D)(n,e))&&(0,a.createAssociationSubpathResolver)(()=>this.collection,()=>t.getFormValuesSnapshot())(e)}try{let e=(null==(d=this.context)||null==(s=d.resource)||null==(o=s.getMeta)?void 0:o.call(s,"currentFilterByTk"))??(null==(h=this.context)||null==(p=h.resource)||null==(u=p.getFilterByTk)?void 0:u.call(p))??(null==(g=this.collection)||null==(f=g.getFilterByTK)?void 0:f.call(g,null==(m=this.context)?void 0:m.record));if(null==e)return!1}catch(e){return!1}return!0},serverOnlyWhenContextParams:!0}),this.context.defineMethod("getFormValues",function(){return t.getFormValuesSnapshot()}),this.context.defineMethod("setFormValues",function(e,l){return t.setFormValues(this,e,l)}),this.context.defineMethod("setFormValue",function(e,l,n){return t.setFormValues(this,[{path:e,value:l}],n)})}onInit(e){super.onInit(e),this.emitter.on("onSubModelAdded",e=>{e===this.subModels.grid&&queueMicrotask(()=>this.syncRuntimeAssignRules("onSubModelAdded:grid"))}),this.context.defineProperty("record",{get:()=>this.getCurrentRecord(),cache:!1}),this.context.resource.on("saved",()=>{this.dispatchEvent("formSubmitSuccess",{})})}onMount(){var e;super.onMount(),null==(e=this.formValueRuntime)||e.mount({sync:!0}),this.syncRuntimeAssignRules("onMount"),setTimeout(()=>{this.applyFlow("eventSettings")},100)}onUnmount(){var e;null==(e=this.formValueRuntime)||e.dispose(),this.formValueRuntime=void 0,super.onUnmount()}getCurrentRecord(){return{}}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of FormModel")}constructor(...e){super(...e),(0,n._)(this,"formValueRuntime",void 0),(0,n._)(this,"userModifiedTopLevelFields",new Set),(0,n._)(this,"_defaultCustomModelClasses",{FormActionGroupModel:"FormActionGroupModel",FormItemModel:"FormItemModel",FormAssociationFieldGroupModel:"FormAssociationFieldGroupModel"}),(0,n._)(this,"customModelClasses",{})}}function B(e){var t,l,n,i;let{model:o,children:a,layoutProps:u={},initialValues:c,...p}=e,h=!!((null==o||null==(t=o.context)?void 0:t.isMobileLayout)&&(null==u?void 0:u.layout)==="horizontal"),m=[p.className,h?D:"",h?N:""].filter(Boolean).join(" ");return(0,r.jsx)(s.A,{form:o.form,initialValues:(null==(i=o.context)||null==(n=i.view)||null==(l=n.inputArgs)?void 0:l.formData)||o.context.record||c,...(0,d.omit)(u,"labelWidth"),labelCol:{style:{width:null==u?void 0:u.labelWidth}},onFieldsChange:e=>{let t=o.formValueRuntime;t&&t.handleFormFieldsChange(e)},onValuesChange:(e,t)=>{var l;null==(l=o.markUserModifiedFields)||l.call(o,e);let n=o.formValueRuntime;n?n.handleFormValuesChange(e,t):(o.dispatchEvent("formValuesChange",{changedValues:e,allValues:t},{debounce:!0}),o.emitter.emit("formValuesChange",{changedValues:e,allValues:t}))},...p,className:m||void 0,children:a})}let L=e=>{if(!e)return 0;let t=e.getBoundingClientRect(),l=window.getComputedStyle(e),n=parseFloat(l.marginTop)||0,r=parseFloat(l.marginBottom)||0;return t.height+n+r},q=e=>{if(null!=e&&""!==e)return"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?`${e}px`:e},V=e=>{let{heightMode:t,containerRef:l,actionsRef:n,footerRef:r,deps:i=[]}=e,[o,a]=(0,p.useState)(),s=(0,p.useCallback)(()=>{if("specifyValue"!==t&&"fullHeight"!==t)return void a(e=>void 0===e?e:void 0);let e=l.current;if(!e)return;let i=e.getBoundingClientRect().height;if(!i)return;let o=Math.max(0,Math.floor(i-L((null==n?void 0:n.current)||null)-L((null==r?void 0:r.current)||null)));a(e=>e===o?e:o)},[t,l,n,r]);return(0,p.useLayoutEffect)(()=>{s()},[s,...i]),(0,p.useEffect)(()=>{if(!l.current||"u"<typeof ResizeObserver)return;let e=l.current,t=(null==n?void 0:n.current)||null,i=(null==r?void 0:r.current)||null,o=new ResizeObserver(()=>s());return o.observe(e),t&&o.observe(t),i&&o.observe(i),()=>o.disconnect()},[s,l,n,r,...i]),o},z=e=>{var t,l;let{model:n,gridModel:i,layoutProps:o,onFinish:a,grid:s,actions:d,footer:u,heightMode:c,height:h}=e,m=(0,p.useRef)(null),f=(0,p.useRef)(null),g=(0,p.useRef)(null),v="specifyValue"===c||"fullHeight"===c,y={paddingTop:null==(l=n.context)||null==(t=l.themeToken)?void 0:t.padding},b=(null==o?void 0:o.layout)==="horizontal"?q(null==o?void 0:o.labelWidth):void 0;b&&(y.marginInlineStart=b);let x=V({heightMode:c,containerRef:m,actionsRef:d?f:void 0,footerRef:u?g:void 0,deps:[h]});(0,p.useEffect)(()=>{var e;if(!i)return;let t=v?x:void 0;(null==(e=i.props)?void 0:e.height)!==t&&i.setProps({height:t})},[i,x,v]);let w=v?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0,S=v?{display:"flex",flexDirection:"column",minHeight:0,flex:1}:void 0;return(0,r.jsx)(B,{model:n,layoutProps:o,onFinish:a,style:w,children:(0,r.jsxs)("div",{ref:m,style:S,children:[s,d?(0,r.jsx)("div",{style:y,ref:f,children:d}):null,u?(0,r.jsx)("div",{ref:g,children:u}):null]})})};$.define({hide:!0}),$.registerFlow({key:"formModelSettings",title:(0,a.tExpr)("Form settings"),steps:{layout:{use:"layout",title:(0,a.tExpr)("Layout")},assignRules:{use:"formAssignRules",title:(0,a.tExpr)("Field values"),beforeParamsSave(e){let t=(0,T.Fp)(e.model);Array.isArray(t)&&t.length&&(0,m.jI)(e.model)},afterParamsSave(e){var t,l,n,r,i,o;let a=e.model.getStepParams("formModelSettings","assignRules"),s=(null==a?void 0:a.value)||[];null==(n=e.model)||null==(l=n.formValueRuntime)||null==(t=l.syncAssignRules)||t.call(l,Array.isArray(s)?s:[]);let d=null==(i=e.model)||null==(r=i.context)?void 0:r.resource,u=I(s,null==(o=e.model)?void 0:o.collection);(null==d?void 0:d.addUpdateAssociationValues)&&u.length&&d.addUpdateAssociationValues(u)}}}}),$.registerFlow({key:"eventSettings",title:(0,a.tExpr)("Event settings"),on:"formValuesChange",steps:{linkageRules:{use:"fieldLinkageRules",afterParamsSave(e){setTimeout(()=>{var t;e.model.applyFlow("eventSettings",{changedValues:{},allValues:null==(t=e.form)?void 0:t.getFieldsValue(!0)})},0)}}}}),$.registerEvents({formValuesChange:{title:(0,a.tExpr)("Form values change"),name:"formValuesChange",uiSchema:{condition:{type:"object",title:(0,a.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":h.H}},handler:h.b}});class K extends ${}K.define({hide:!0})},71712(e,t,l){l.d(t,{Fp:()=>s,K7:()=>a,S2:()=>n.S2});var n=l(50314);let r=["editItemSettings","formItemSettings"],i=(0,n.li)(r),o=(0,n.u4)(r);function a(e){return(0,n.TE)(e,i)}function s(e){return(0,n.Co)(e,i,o)}},53831(e,t,l){l.d(t,{submitHandler:()=>a});var n=l(11869),r=l(58428),i=l(18357);function o(e){return e&&"object"==typeof e&&"data"in e?e.data:e}async function a(e,t,a){var s,d,u,c,p,h,m,f;let g=e.resource,v=e.blockModel,{EditFormModel:y}=await Promise.resolve().then(l.bind(l,71616)),b=v instanceof y;await (0,i.D9)({form:null==v?void 0:v.form,blockModel:v,flowSettingsEnabled:null==e?void 0:e.flowSettingsEnabled,skipValidator:(0,i.go)(null==e?void 0:e.model)});let x=v.form.getFieldsValue(!0),w=(0,i.xT)(x,v),S=await (0,r.eu)(e,null==t?void 0:t.assignedValues,"FormSubmitAction");if(!S){null==(s=e.exit)||s.call(e);return}let M=(0,r.GO)(w,S);if(g instanceof n.SingleRecordResource){if(b){let e=g.getMeta("currentFilterByTk");e?g.setFilterByTk(e):g.isNewRecord=!0}let l=o(a?await a(M):await g.save(M,t.requestConfig));return b?(g.isNewRecord=!1,null==(d=v.resetUserModifiedFields)||d.call(v),await g.refresh(),l=l??(null==(u=g.getData)?void 0:u.call(g))):(v.form.resetFields(),v.emitter.emit("onFieldReset"),null==(c=v.resetUserModifiedFields)||c.call(v),null==(h=v.formValueRuntime)||null==(p=h.resetAfterFormReset)||p.call(h),e.view.inputArgs.collectionName===v.collection.name&&e.view.inputArgs.onChange&&e.view.inputArgs.onChange(l)),l}if(g instanceof n.MultiRecordResource){let l=g.getMeta("currentFilterByTk");if(!l)return void e.message.error(e.t("No filterByTk found for multi-record resource."));let n=a?await a(M,l):await g.update(l,M,t.requestConfig);return null==(m=v.resetUserModifiedFields)||m.call(v),o(n)??(null==(f=v.getCurrentRecord)?void 0:f.call(v))}}},18357(e,t,l){l.d(t,{D9:()=>v,go:()=>g,xT:()=>y});var n=l(40098),r=l.n(n),i=l(12197);function o(e,t){var l,n;let r=null==e||null==(n=e.context)||null==(l=n.blockModel)?void 0:l.uid,i=null==t?void 0:t.uid;return!!r&&!!i&&String(r)===String(i)}function a(e){var t,l;let n=null==e||null==(t=e.context)?void 0:t.fieldPathArray;if(Array.isArray(n)&&n.length)return n;try{let t=null==e||null==(l=e.getStepParams)?void 0:l.call(e,"fieldSettings","init"),n=null==t?void 0:t.fieldPath;if("string"==typeof n&&n)return n}catch{}let r=null==e?void 0:e.fieldPath;if("string"==typeof r&&r)return r;let i="function"==typeof(null==e?void 0:e.getProps)?e.getProps():null==e?void 0:e.props,o=null==i?void 0:i.name;return"string"==typeof o&&o||Array.isArray(o)&&o.length?o:null}function s(e){return Array.isArray(e)&&e.length&&"string"==typeof e[0]?e:null}function d(e){var t;let l=a(e);return l?s((0,i.IJ)(l,null==e||null==(t=e.context)?void 0:t.fieldIndex)):null}function u(e,t){if(e&&"object"==typeof e&&Array.isArray(t)&&!(t.length<2))for(let l=t.length-1;l>=1;l--){let n=t.slice(0,l);if("number"==typeof n[n.length-1])continue;let i=r().get(e,n);r().isPlainObject(i)&&0===Object.keys(i).length&&r().unset(e,n)}}function c(e,t){(null==e?void 0:e.forEachModel)&&e.forEachModel(e=>{t(e);let l=null==e?void 0:e.forks;l&&"function"==typeof l.forEach&&l.forEach(e=>{e&&!e.disposed&&t(e)})})}function p(e){let t=null==e?void 0:e.flowEngine;if(!(null==t?void 0:t.forEachModel))return[];let l=[],n=new Set;return c(t,t=>{if(!t||"object"!=typeof t||!t.hidden||!o(t,e))return;let r=d(t);if(!r)return;let i=JSON.stringify(r);n.has(i)||(n.add(i),l.push(r))}),l}function h(e){return"string"==typeof e?e?[e]:null:Array.isArray(e)?s(e):null}function m(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length>t.length)return!1;for(let l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}function f(e){let t=null==e?void 0:e.form;if(!t||"function"!=typeof t.getFieldsError)return null;let l=t.getFieldsError();if(!Array.isArray(l))return null;let n=[],r=new Set;for(let e of l){let t=h(null==e?void 0:e.name);if(!t)continue;let l=JSON.stringify(t);r.has(l)||(r.add(l),n.push(t))}if(!n.length)return null;let i=p(e);return i.length?n.filter(e=>!i.some(t=>m(t,e))):n}function g(e){var t,l;return(null==e||null==(l=e.getStepParams)||null==(t=l.call(e,"submitSettings","skipRequiredValidation"))?void 0:t.skipValidator)===!0}async function v(e){let{form:t,blockModel:l,flowSettingsEnabled:n,skipValidator:r}=e;if(r||!t||"function"!=typeof t.validateFields)return;let i=n&&l?f(l):null;if(Array.isArray(i)){i.length&&await t.validateFields(i);return}await t.validateFields()}function y(e,t){if(!e||"object"!=typeof e)return e;let l=p(t);if(!l.length)return e;let n=r().cloneDeep(e);for(let e of l)r().unset(n,e),u(n,e);return n}},29676(e,t,l){l.d(t,{F:()=>r});var n=l(13939);function r(e,t){let l=(t,l,n)=>{var r,i,o;return!l||(null==e||null==(o=e.app)||null==(i=o.jsonLogic)||null==(r=i.apply)?void 0:r.call(i,{[l]:[t,n]}))};try{return(0,n.evaluateConditions)((0,n.removeInvalidFilterItems)(t),l)}catch{return!1}}},47632(e,t,l){l.d(t,{Dd:()=>d,G:()=>c,Wp:()=>p,x3:()=>u});var n=l(95243),r=l(11869),i=l(40098),o=l.n(i),a=l(12197);function s(e){return!!e&&"object"==typeof e&&(Array.isArray(e)||o().isPlainObject(e))}function d(e,t){if(t)for(let l of(0,a.ef)(e))t.deps.add(`fv:${l}`)}function u(e){let{valuesMirror:t,collector:l,basePath:r,getFormValuesSnapshot:i,getFormValueAtPath:a}=e,c=()=>r.length?o().get(t,r):t,p=c(),h=p&&("object"==typeof p||"function"==typeof p)?p:Array.isArray(p)?[]:{},m=e=>u({valuesMirror:t,basePath:e,collector:l,getFormValuesSnapshot:i,getFormValueAtPath:a});return new Proxy(h,{get(e,u){if("toJSON"===u)return(l&&(l.wildcard=!0),0===r.length)?()=>i():()=>(0,n.toJS)(c());if("symbol"==typeof u){l&&(l.wildcard=!0);let e=c();return null==e?void 0:e[u]}let p=c();if(null==p)return;if("__raw"===u)return p;if("__proto__"===u||"prototype"===u||"constructor"===u){l&&(l.wildcard=!0);return}let h=Array.isArray(p),f=h&&("number"==typeof u&&Number.isInteger(u)||"string"==typeof u&&/^\d+$/.test(u));if(h&&!f){l&&(l.wildcard=!0);let e=p[u];return"function"==typeof e?e.bind(p):e}let g=[...r,f?Number(u):u];d(g,l);let v=p[u];if(void 0===v){let e=a(g);o().isEqual(e,v)||(o().set(t,g,e),v=e)}return null==v||"object"!=typeof v?v:s(v)?m(g):v},ownKeys(){l&&(l.wildcard=!0);let e=c();return e?Reflect.ownKeys(e):[]},getOwnPropertyDescriptor(e,t){let l=c();if(l)return Object.getOwnPropertyDescriptor(l,t)},has(e,t){let l=c();return!!l&&t in l}})}function c(e,t){try{let l=(0,r.extractUsedVariablePaths)(e)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}function p(e,t){if((0,r.isRunJSValue)(e))try{let l=(0,r.extractUsedVariablePathsFromRunJS)(e.code)||{};for(let[e,n]of Object.entries(l)){let l=Array.isArray(n)?n:[];for(let n of l.length?l:[""]){if("formValues"===e){if(!n){t.wildcard=!0;continue}let e=(0,a.EA)(String(n)).filter(e=>"object"!=typeof e);d(e,t);continue}let l=n?`ctx:${e}:${String(n)}`:`ctx:${e}`;t.deps.add(l)}}}catch{}}},12197(e,t,l){function n(e){let t=[],l=0,n=e.length,r=()=>{let r=l;for(;l<n&&"."!==e[l]&&"["!==e[l];)l++;let i=e.slice(r,l);i&&t.push(i)};for(;l<n;){let i=e[l];if("."===i){l++;continue}if("["===i){let r=++l;for(;l<n&&"]"!==e[l];)l++;let i=e.slice(r,l);l++,/^\d+$/.test(i)?t.push(Number(i)):i&&t.push({placeholder:i});continue}r()}return t}function r(e){let t=Array.isArray(e)?e:[],l=[];for(let e of t){if("string"!=typeof e)continue;let[t,n]=e.split(":"),r=Number(n);!t||Number.isNaN(r)||l.push({name:t,index:r})}return l}function i(e,t){let l=Array.isArray(e)?[...e]:n(e),i=r(t),o=[],a=0;for(let e=0;e<l.length;e++){let t=l[e];if("object"==typeof t&&t&&"placeholder"in t){let e=o[o.length-1],t="string"==typeof e?e:void 0;if(!t)return null;for(;a<i.length&&i[a].name!==t;)a++;if(a>=i.length)return null;o.push(i[a].index),a++;continue}if(o.push(t),"string"==typeof t&&a<i.length&&i[a].name===t){let t=l[e+1];"number"==typeof t?a++:"object"==typeof t&&t&&"placeholder"in t||(o.push(i[a].index),a++)}}return o}function o(e){let t="";for(let l of e){if("number"==typeof l){t+=`[${l}]`;continue}t?t+=`.${l}`:t=l}return t}function a(e){return n(e).filter(e=>"object"!=typeof e)}function s(e){let t=[],l=[];for(let n of e)l.push(n),t.push(o(l));return t}l.d(t,{EA:()=>n,IJ:()=>i,Qc:()=>o,c1:()=>a,ef:()=>s})},65421(e,t,l){l.d(t,{Po:()=>o,ao:()=>a,li:()=>i});var n=l(40098),r=l.n(n);let i=20;function o(e){return null==e||("string"==typeof e||Array.isArray(e)?0===e.length:!!r().isPlainObject(e)&&0===Object.keys(e).length)}function a(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}},50314(e,t,l){l.d(t,{Co:()=>f,PP:()=>o,S2:()=>m,TE:()=>h,li:()=>d,u4:()=>p});var n=l(40098),r=l.n(n);function i(){return{logic:"$and",items:[]}}function o(e,t,l){var n;let r=null==e||null==(n=e.getStepParams)?void 0:n.call(e,t,l);return!!r&&Object.prototype.hasOwnProperty.call(r,"value")}function a(e){if(!e)return;let t="function"==typeof e.getProps?e.getProps():e.props;if(t&&void 0!==t.initialValue)return t.initialValue}function s(e,t){var l,n;if(e)return null==(n=e.getStepParams)||null==(l=n.call(e,t,"initialValue"))?void 0:l.defaultValue}function d(e){return t=>{if(!t)return;let l=a(t);if(void 0!==l)return l;for(let l of e){let e=s(t,l);if(void 0!==e)return e}}}function u(e,t,l){var n,i,o;if(!(null==e||null==(n=e.stepParams)?void 0:n[t]))return;let a=e.stepParams[t];!a||"object"!=typeof a||Object.prototype.hasOwnProperty.call(a,l)&&(delete a[l],r().isEmpty(a)&&delete e.stepParams[t],null==(o=e.emitter)||null==(i=o.emit)||i.call(o,"onStepParamsChanged"))}function c(e){var t,l;if(!e)return;null==(t=e.setProps)||t.call(e,{initialValue:void 0}),e.props&&Object.prototype.hasOwnProperty.call(e.props,"initialValue")&&delete e.props.initialValue;let n=null==(l=e._options)?void 0:l.props;n&&Object.prototype.hasOwnProperty.call(n,"initialValue")&&delete n.initialValue}function p(e){return t=>{if(t)for(let l of(c(t),e))u(t,l,"initialValue")}}function h(e,t){var l,n,r,o,a;let s=null==e||null==(r=e.subModels)||null==(n=r.grid)||null==(l=n.subModels)?void 0:l.items,d=Array.isArray(s)?s:[],u=[];for(let e of d){let l=(null==e||null==(a=e.getStepParams)||null==(o=a.call(e,"fieldSettings","init"))?void 0:o.fieldPath)||(null==e?void 0:e.fieldPath),n=l?String(l):"";if(!n)continue;let r=t(e);void 0!==r&&u.push({key:`legacy-default:${n}`,enable:!0,targetPath:n,mode:"default",condition:i(),value:r})}return u}function m(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let r=new Set;for(let e of l){if(!e||"object"!=typeof e)continue;let t=e.targetPath?String(e.targetPath):"";if(t){if("default"===e.mode){r.add(t);continue}String(e.key??"").startsWith("legacy-default:")&&r.add(t)}}let i=new Set(l.map(e=>String(e.key??""))),o=[];for(let e of n){let t=e.targetPath?String(e.targetPath):"";if(!t||r.has(t))continue;let l={...e},n=String(l.key??"");n&&i.has(n)&&(l.key=`${n}:${t}`),o.push(l)}return o.length?[...l,...o]:l}function f(e,t,l){var n,r,i;let o=null==e||null==(i=e.subModels)||null==(r=i.grid)||null==(n=r.subModels)?void 0:n.items,a=Array.isArray(o)?o:[],s=[];for(let e of a)void 0!==t(e)&&(l(e),s.push(e));return s}},26866(e,t,l){l.d(t,{$4:()=>a,r5:()=>o});var n=l(27253);let r="__index__";function i(e,t){if(!t)return null;if(Array.isArray(t)){let l=t.map(t=>null==e?void 0:e[t]);return l.some(e=>null==e)?null:l.map(e=>String(e)).join("__")}let l=null==e?void 0:e[t];return null==l?null:String(l)}function o(e,t){let l=null==e?void 0:e[r];if((null==e?void 0:e.__is_new__)&&null!=l&&""!==l)return`tmp:${String(l)}`;let n=i(e,t);return null!=n?`pk:${n}`:null!=l&&""!==l?`tmp:${String(l)}`:null}function a(e){if(!e.length)return e;let t=!1,l=e.map(e=>{let l=null==e?void 0:e[r];return e.__is_new__&&(null==l||""===l)?(t=!0,{...e,[r]:(0,n.uid)()}):e});return t?l:e}},69586(e,t,l){l.d(t,{m:()=>p});var n=l(74848),r=l(11869),i=l(95725),o=l(96540),a=l(44329),s=l(81486),d=l(16860);function u(e){let{value:t,onChange:l,onCompositionStart:r,onCompositionEnd:a,...s}=e,[d,u]=(0,o.useState)(()=>c(t));(0,o.useEffect)(()=>{u(c(t))},[t]);let p=e=>e.currentTarget.value;return(0,n.jsx)(i.A,{...s,value:d,onChange:e=>{u(p(e)),null==l||l(e)},onCompositionStart:e=>{u(p(e)),null==r||r(e)},onCompositionEnd:e=>{u(p(e)),null==a||a(e)}})}function c(e){return"bigint"==typeof e?String(e):null==e?"":e}class p extends s.o{render(){if(this.props.enableScan)return(0,n.jsx)(d.E,{...this.props});let{enableScan:e,disableManualInput:t,...l}=this.props;return(0,n.jsx)(u,{...l})}}p.registerFlow({key:"defaultValueForNanoid",steps:{generateNanoid:{handler(e,t){var l,n;null==(n=e.blockModel)||null==(l=n.emitter)||l.on("onFieldReset",()=>{if("nanoid"===e.collectionField.interface&&!1!==e.collectionField.options.autoFill){let{size:t,customAlphabet:l}=e.collectionField.options||{size:21};e.model.props.onChange((0,a.d_)(l,t)())}})}}}}),p.registerFlow({key:"scanInputSettings",sort:800,title:(0,r.tExpr)("Scan input settings"),steps:{enableScan:{title:(0,r.tExpr)("Enable Scan"),uiMode:{type:"switch",key:"enableScan"},hideInSettings:e=>"readPretty"===e.model.getProps().pattern||e.model.getProps().disabled,defaultParams:e=>({enableScan:!!e.model.props.enableScan}),handler(e,t){e.model.setProps({enableScan:!!t.enableScan,disableManualInput:!!t.enableScan&&e.model.props.disableManualInput})}},disableManualInput:{title:(0,r.tExpr)("Disable manual input"),uiMode:{type:"switch",key:"disableManualInput"},hideInSettings(e){var t,l;let n=null==(t=(l=e.model).getStepParams)?void 0:t.call(l,"scanInputSettings","enableScan");return!(Object.prototype.hasOwnProperty.call(n||{},"enableScan")?!!(null==n?void 0:n.enableScan):!!e.model.props.enableScan)||"readPretty"===e.model.getProps().pattern||!!e.model.getProps().disabled},defaultParams:e=>({disableManualInput:!!e.model.props.disableManualInput}),handler(e,t){e.model.setProps({disableManualInput:!!e.model.props.enableScan&&!!t.disableManualInput})}}}}),p.define({label:(0,r.tExpr)("Input")}),r.EditableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid"],{isDefault:!0}),r.FilterableItemModel.bindModelToInterface("InputFieldModel",["input","email","phone","uuid","url","nanoid","textarea","markdown","vditor","richText","password","color"],{isDefault:!0})},95267(e,t,l){l.d(t,{o:()=>r,e:()=>d});var n=l(50467);class r{subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){return this.data&&!this.error?this.data:(this.pending||(this.loading=!0,this.notify(),this.pending=this.apiClient.request({url:"systemSettings:get"}).then(e=>(this.data=e.data,this.error=void 0,this.data)).catch(e=>{throw this.error=e,e}).finally(()=>{this.loading=!1,this.pending=void 0,this.notify()})),this.pending)}async refresh(){return this.pending=void 0,this.data=void 0,this.load()}setData(e){this.data=e,this.error=void 0,this.loading=!1,this.notify()}setError(e){this.error=e,this.loading=!1,this.notify()}notify(){for(let e of this.listeners)e()}constructor(e){(0,n._)(this,"apiClient",void 0),(0,n._)(this,"loading",void 0),(0,n._)(this,"data",void 0),(0,n._)(this,"error",void 0),(0,n._)(this,"pending",void 0),(0,n._)(this,"listeners",void 0),this.apiClient=e,this.loading=!1,this.listeners=new Set}}var i=l(11869),o=l(2077),a=l(84256),s=l(96540);let d=()=>{var e,t;let l=(0,o.nm)().systemSettings,n=(0,i.useFlowEngine)({throwError:!1}),[,r]=(0,s.useState)(0),d=null==(t=l.data)||null==(e=t.data)?void 0:e.enabledLanguages,u=(0,s.useMemo)(()=>(Array.isArray(d)?d:[]).filter(e=>a.A[e]).map(e=>({label:a.A[e].label,value:e})),[d]);return(0,s.useEffect)(()=>(l.load(),l.subscribe(()=>{r(e=>e+1)})),[l]),(0,s.useEffect)(()=>{n&&n.context.defineProperty("locale",{get:e=>{var t,l,n;return(null==(l=e.api)||null==(t=l.auth)?void 0:t.locale)||(null==(n=e.i18n)?void 0:n.language)},cache:!1,meta:{type:"string",title:'{{t("Current language")}}',sort:970,interface:"select",uiSchema:{enum:u,"x-component":"Select"}}})},[n,u]),{loading:l.loading,data:l.data,error:l.error,refresh:()=>l.refresh(),mutate:e=>{Object.prototype.hasOwnProperty.call(e||{},"data")&&l.setData(null==e?void 0:e.data),Object.prototype.hasOwnProperty.call(e||{},"error")&&l.setError(null==e?void 0:e.error)}}}},94130(e,t,l){l.d(t,{F3:()=>a,GX:()=>s,b1:()=>d});let n={view:"get"},r=e=>e?n[e]||e:null,i=(e,t)=>{for(let l of t){if(!(l in e))continue;let t=e[l];if(null==t)return null;return(Array.isArray(t)?t:[t]).map(e=>r(e)).filter(Boolean)}},o=(e,t)=>{let l=r(t);if(!l||!(null==e?void 0:e.options))return!0;let{availableActions:n,unavailableActions:i}=e.options;return Array.isArray(n)?n.includes(l):!Array.isArray(i)||!i.includes(l)},a=(e,t)=>null==t||!t.length||t.every(t=>o(e,t)),s=e=>{var t;let l=i(e,["capabilityActionNames","capabilityActionName"]);if(void 0!==l)return l;let n=null==e||null==(t=e.prototype)?void 0:t.getAclActionName;if("function"!=typeof n)return null;try{let e=n.call({}),t=r(e);return t?[t]:null}catch{return null}},d=e=>i(e,["blockCapabilityActionNames","blockCapabilityActionName"])??null},42632(e,t,l){l.d(t,{l:()=>n});function n(e){let{blockLabel:t,dsName:l,dsCount:n,collectionTitle:r,sourceCollectionTitle:i,associationTitle:o}=e,a=n>1&&!!l,s=r;if(i&&o){let e=`${i} > ${o} (${r})`;s=`${a?`${l} > `:""}${e}`}else s=`${a?`${l} > `:""}${r}`;return`
|
|
1280
1280
|
${t}:
|
|
1281
1281
|
${s}`}},84759(e,t,l){l.d(t,{SM:()=>s,M6:()=>p,Xi:()=>i,hH:()=>h,NY:()=>c,hO:()=>m,lr:()=>n.l,HZ:()=>d});var n=l(42632),r=l(11869);async function i(e,t,l,n,i){let o=(null==i?void 0:i.includeSelf)??!0,a=(null==i?void 0:i.includeForks)??!0,s=new Set,d=[e],u=[],c=e=>{e&&"function"==typeof e.dispatchEvent&&u.push(e.dispatchEvent(t,l,n))};for(;d.length;){let t=d.pop();if(!t||s.has(t))continue;if(s.add(t),o||t!==e){var p;c(t),a&&(null==(p=t.forks)?void 0:p.size)&&t.forks.forEach(e=>{null!=e&&e.disposed||c(e)})}let l=t.subModels;if(l)for(let e of Object.values(l))if(Array.isArray(e))for(let t of e)t instanceof r.FlowModel&&d.push(t);else e instanceof r.FlowModel&&d.push(e)}await Promise.all(u)}var o=l(22803),a=l(96540);let s=e=>{let t=e.dataLength||0,l=e.pageSize||10,n=e.current||1;return t<l||!e.hasNext?l*n:l*n+1},d=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,o.css)`
|
|
1282
1282
|
.ant-pagination-simple-pager {
|
|
@@ -1347,7 +1347,7 @@ ${r}`,c)}}let n=R(e.issues.filter(e=>"runtime"===e.type)),r=n?`Key runtime issue
|
|
|
1347
1347
|
throw e;
|
|
1348
1348
|
}
|
|
1349
1349
|
})()`,n=new Compartment(this.globals);try{let e=n.evaluate(l),t=new Promise((e,t)=>setTimeout(()=>t(Error("Execution timed out")),this.timeoutMs)),r=await Promise.race([e,t]);return{success:!0,value:r}}catch(n){if(n instanceof r.sy||n instanceof r.zz)throw n;let t=a(e),l=s(n,t)&&t?d(n,t):n;return console.error(l),{success:!1,error:l,timeout:(null==l?void 0:l.message)==="Execution timed out"}}}constructor(e={}){var t,l;(0,n._)(this,"globals",void 0),(0,n._)(this,"timeoutMs",void 0);let r=e=>{if("u">typeof window&&"function"==typeof window[e])return window[e].bind(window);let t=globalThis[e];return"function"==typeof t?t.bind(globalThis):t},i=e.globals||{},o={};if(!Object.prototype.hasOwnProperty.call(i,"Blob"))try{let e=null==(t=i.window)?void 0:t.Blob;void 0!==e&&(o.Blob=e)}catch{}if(!Object.prototype.hasOwnProperty.call(i,"URL"))try{let e=null==(l=i.window)?void 0:l.URL;void 0!==e&&(o.URL=e)}catch{}this.globals={console,setTimeout:r("setTimeout"),clearTimeout:r("clearTimeout"),setInterval:r("setInterval"),clearInterval:r("clearInterval"),...o,...i},this.timeoutMs=e.timeoutMs??5e3}}},47451(e,t,l){l.d(t,{_:()=>i});var n=l(48910),r=l(16639);function i(e){let t=new n.$;Object.defineProperty(t,r.i6,{value:"view",configurable:!0}),e.modelRepository&&t.setModelRepository(e.modelRepository),t.context.addDelegate(e.context);let l=t.unlinkFromStack.bind(t);t.unlinkFromStack=function(){var e;return null==(e=t.disposeScheduler)||e.call(t),l()};let i=new Set(["_modelInstances","_applyFlowCache","executor","context",r.i6,"previousEngine","nextEngine","emitter","_modelOperationScheduler","getScheduler","scheduleModelOperation","disposeScheduler","unlinkFromStack","linkAfter","_previousEngine","_nextEngine","getModel","_destroyView","setDestroyView","destroyView"]),o={get(t,l,n){if(i.has(l))return Reflect.get(t,l,n);let r=Reflect.get(e,l,n);return"registerModels"===l&&"function"==typeof r?r.bind(e):r},set:(t,l,n)=>i.has(l)?Reflect.set(t,l,n):Reflect.set(e,l,n),has:(t,l)=>l in t||l in e};return t.linkAfter(e),new Proxy(t,o)}},64171(e,t,l){l.d(t,{Z:()=>r});var n=l(50467);class r{onActionRegistered(){}registerActions(e){for(let[,t]of Object.entries(e||{}))this.registerAction(t)}registerAction(e){if(!(null==e?void 0:e.name))throw Error("Action must have a name.");this.actions.has(e.name)&&console.warn(`Action '${e.name}' is already registered. It will be overwritten.`),this.actions.set(e.name,e),this.onActionRegistered()}constructor(){(0,n._)(this,"actions",new Map)}}},31102(e,t,l){l.d(t,{FC:()=>a,eI:()=>u,jP:()=>s});var n=l(74848),r=l(96540),i=l(42443),o=l(89013);let a={paddingBottom:0},s={marginBottom:12},d=["colon","dependencies","extra","getValueFromEvent","getValueProps","hasFeedback","help","htmlFor","initialValue","label","labelAlign","labelCol","messageVariables","name","normalize","noStyle","preserve","rules","tooltip","trigger","validateStatus","validateTrigger","valuePropName","wrapperCol","labelWidth","labelWrap","layout","required","showLabel"],u=e=>{let{children:t,showLabel:l=!0,labelWidth:u,...c}=e,p=Object.fromEntries(Object.entries(c).filter(e=>{let[t]=e;return!d.includes(t)})),h="function"==typeof t?t:r.Children.map(t,e=>r.isValidElement(e)?r.cloneElement(e,{...p}):e),{label:m,labelWrap:f,colon:g=!0,layout:v}=c,y=!v||"vertical"===v||f,b="vertical"===v?{width:u,...a}:{width:u},x=()=>l?y?(0,n.jsxs)("div",{style:{width:"100%",whiteSpace:"normal",wordBreak:"break-word",display:"flex",alignItems:"center",justifyContent:"flex-start",fontWeight:600},children:[(0,n.jsx)("span",{style:{flex:1},children:m}),g&&(0,n.jsx)("span",{style:{marginLeft:4,flexShrink:0},children:":"})]}):(0,n.jsx)(i.A,{title:m,children:(0,n.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",maxWidth:("number"==typeof u?u:120)-20,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"middle",fontWeight:600},children:[(0,n.jsx)("span",{style:{flexShrink:1,overflow:"hidden",textOverflow:"ellipsis"},children:m}),g&&(0,n.jsx)("span",{style:{marginLeft:4,flexShrink:0},children:":"})]})}):null;return(0,n.jsx)(o.A.Item,{...c,style:{...s,...c.style},labelCol:{style:b},layout:v,label:x(),colon:!1,extra:c.extra&&(0,n.jsx)("span",{style:{whiteSpace:"pre-wrap"},children:c.extra}),tooltip:c.tooltip&&{title:c.tooltip,overlayInnerStyle:{whiteSpace:"pre-line"}},children:h})}},61793(e,t,l){let n,r;l.d(t,{D:()=>S});var i=l(74848),o=l(4888),a=l(96540),s=l(42524),d=l(27253),u=l(35710);let c=(e,t)=>{let{getPrefixCls:l}=(0,a.useContext)(o.Ay.ConfigContext)||{};if("ConfigContext"in o.Ay)return(null==l?void 0:l(e,null==t?void 0:t.prefixCls))||"";{let l=(null==t?void 0:t.prefixCls)??"ant-";return`${l}${e??""}`}},{ConfigContext:p}=o.Ay,h=()=>(0,a.useContext)(p),m=u.A.useToken,f=(e,t)=>{let{fontFamily:l,fontSize:n}=e,r=`[class^="${t}"], [class*=" ${t}"]`;return{[r]:{fontFamily:l,fontSize:n,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[r]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}},g=(n="nb-mobile-action-drawer",r=e=>{let{componentCls:t}=e;return{[t]:{".nb-mobile-action-drawer-header":{height:"var(--nb-mobile-page-header-height)",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${e.colorSplit}`,position:"sticky",top:0,backgroundColor:e.colorBgContainer,zIndex:1e3,"& + .nb-grid-container > .nb-grid > .nb-grid-warp > .ant-btn":{margin:12}},".nb-mobile-action-drawer-placeholder":{display:"inline-block",padding:12,flex:"0 0 auto",visibility:"hidden"},".nb-mobile-action-drawer-title":{flex:"1 1 auto",minWidth:0,overflow:"hidden",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},".nb-mobile-action-drawer-close-icon":{display:"inline-block",padding:12,flex:"0 0 auto",cursor:"pointer"},".nb-mobile-action-drawer-body":{borderTopLeftRadius:8,borderTopRightRadius:8,maxHeight:"calc(100% - var(--nb-mobile-page-header-height))",overflowY:"auto",overflowX:"hidden",backgroundColor:e.colorBgLayout,"& > .nb-grid-container":{padding:`${e.paddingPageVertical}px ${e.paddingPageHorizontal}px`},".ant-tabs-nav":{marginBottom:"0px !important",padding:`0 ${e.paddingPageHorizontal+e.borderRadiusBlock/2}px`,backgroundColor:e.colorBgContainer},"& > .nb-grid-container > .nb-grid > .nb-grid-warp > .nb-grid-row:nth-last-child(2) .noco-card-item":{marginBottom:0,"& > .ant-card":{marginBottom:"0 !important"}}},".nb-mobile-action-drawer-footer":{padding:"8px var(--nb-mobile-page-tabs-content-padding)",display:"flex",alignItems:"center",justifyContent:"flex-end",position:"sticky",bottom:0,left:0,right:0,zIndex:1e3,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgLayout,".ant-btn":{marginLeft:8}}}}},e=>{let{theme:t,token:l,hashId:i}=m(),{getPrefixCls:o,iconPrefixCls:u}=h(),p=c(n),g=o(),v=(0,s.useStyleRegister)({theme:t,token:l,hashId:i,path:["formily-antd",n,p,u]},()=>{let t=`.${p}`,n=r((0,d.merge)(l,{componentCls:t,prefixCls:p,iconCls:`.${u}`,antCls:`.${g}`}),e,{hashId:i,prefixCls:p,rootPrefixCls:g,iconPrefixCls:u});return[f(l,p),n]});return{wrapSSR:(0,a.useMemo)(()=>v,[v]),hashId:i,componentCls:p,rootPrefixCls:g}});var v=l(18492),y=l(22505);let{Popup:b}=(0,y.R)(()=>Promise.resolve().then(l.bind(l,77577)),"Popup"),{CloseOutline:x}=(0,y.R)(()=>l.e("3279").then(l.bind(l,38370)),"CloseOutline"),w=()=>{var e,t;return"u">typeof CSS&&(null==(e=(t=CSS).supports)?void 0:e.call(t,"height","100dvh"))?"calc(100dvh - var(--nb-mobile-page-header-height, 46px))":"calc(100vh - var(--nb-mobile-page-header-height, 46px))"},S=e=>{var t;let{title:l,visible:n,onClose:r,children:s,minHeight:d,className:u,footer:c}=e,{t:p}=(0,v.B)(),{componentCls:h,hashId:m}=g(),f=null==(t=e.styles)?void 0:t.body,y=w(),S=(0,a.useMemo)(()=>({minHeight:(null==f?void 0:f.minHeight)??d,height:null==f?void 0:f.height,maxHeight:(null==f?void 0:f.maxHeight)??y}),[null==f?void 0:f.height,null==f?void 0:f.maxHeight,null==f?void 0:f.minHeight,y,d]),M=(0,a.useMemo)(()=>({padding:0,maxHeight:y,overflowY:"auto",overflowX:"hidden",...f}),[f,y]),A=(0,a.useCallback)(e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),r())},[r]),F=(0,a.useMemo)(()=>({token:{paddingPageHorizontal:8,paddingPageVertical:8,marginBlock:12,borderRadiusBlock:8,fontSize:14}}),[]);return(0,i.jsx)(o.Ay,{theme:F,children:(0,i.jsxs)(b,{className:`${h} ${m} ${u||""}`,visible:n,onClose:r,onMaskClick:r,bodyClassName:"nb-mobile-action-drawer-body",bodyStyle:M,style:S,destroyOnClose:!0,children:[(0,i.jsxs)("div",{className:"nb-mobile-action-drawer-header",children:[(0,i.jsx)("span",{className:"nb-mobile-action-drawer-placeholder",children:(0,i.jsx)(x,{})}),(0,i.jsx)("span",{className:"nb-mobile-action-drawer-title",children:l}),(0,i.jsx)("span",{className:"nb-mobile-action-drawer-close-icon",onClick:r,role:"button",tabIndex:0,"aria-label":p("Close"),onKeyDown:A,children:(0,i.jsx)(x,{})})]}),s,c&&(0,i.jsx)("div",{className:"nb-mobile-action-drawer-footer",children:c})]})})}},96332(e,t,l){l.d(t,{openRequiredParamsStepFormDialog:()=>m});var n=l(74848),r=l(18220),i=l(95243),o=l(87959),a=l(71021),s=l(96540),d=l(29007),u=l(16296),c=l(60182);let p=(0,r.createSchemaField)(),h=e=>{let{model:t,requiredSteps:l,formStep:r,children:i}=e,o=l[(null==r?void 0:r.current)??0],a=s.useMemo(()=>{let{flowKey:e,step:l}=o,n=t.getFlow(e),r=new d.W5(t,e,"settings");return(0,c.wx)(r,(null==n?void 0:n.steps)||{},t,e),r.defineProperty("currentStep",{value:l}),r},[t,o]);return(0,n.jsx)(u.u,{value:a,children:i})},m=async e=>{let{model:t,dialogWidth:s=800,dialogTitle:m}=e,f=(0,c.lW)(t);if(m||f("Step parameter configuration"),!t)throw o.Ay.error(f("Invalid model provided")),Error(f("Invalid model provided"));return new Promise((e,o)=>{(async()=>{try{var g,v,y;let o=t.getFlows(),b=[];for(let[e,l]of o)for(let n in l.steps){let r=l.steps[n];if(r.paramsRequired||r.preset){let i=await (0,c.o7)(t,l,r);if(i){t.getStepParams(e,n);let o=!1;console.log(`Flow: ${e}, Step: ${n}, hasAllRequiredParams:`,o),o||b.push({flowKey:e,stepKey:n,step:r,uiSchema:i,title:r.title||n,flowTitle:l.title||e})}}}if(console.log("Required steps:",b),0===b.length)return void e({});let x={};for(let{flowKey:e,stepKey:l,step:n}of b){let r=t.getStepParams(e,l)||{},o={};n.use&&(o=(null==(y=t.flowEngine)||null==(v=y.getAction)?void 0:v.call(y,n.use)).defaultParams||{});let a=new d.W5(t,e,"settings"),s=t.getFlow(e);s&&(0,c.wx)(a,s.steps,t,e),a.defineProperty("currentStep",{value:n});let u=await (0,c.gG)(o,a),p=await (0,c.gG)(n.defaultParams,a),h={...(0,i.toJS)(u),...(0,i.toJS)(p),...(0,i.toJS)(r)};Object.keys(h).length>0&&(x[e]||(x[e]={}),x[e][l]=h)}let w={};b.forEach(e=>{let{flowKey:t,stepKey:l,uiSchema:n,title:r,flowTitle:i}=e;w[`${t}_${l}`]={type:"void","x-component":"FormStep.StepPane","x-component-props":{title:`${r}`,description:`Flow: ${i}`},properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"vertical"},properties:{[t]:{type:"object",properties:{[l]:{type:"object",properties:n}}}}}}}});let S=1===b.length?{type:"object",properties:{...Object.values(w)[0].properties}}:{type:"object",properties:{step:{type:"void","x-component":"FormStep","x-component-props":{formStep:"{{formStep}}"},properties:w}}},{FormDialog:M,FormStep:A}=await Promise.resolve().then(l.bind(l,20419)),F=b.length>1?A.createFormStep(0):null,k=t.flowEngine,C={formStep:F,totalSteps:b.length,requiredSteps:b,useFlowSettingsContext:u.s,...null==(g=k.flowSettings)?void 0:g.scopes},P=M({title:m||f("Step parameter configuration"),width:s,footer:null,destroyOnClose:!0},l=>{var i;let o=async()=>{try{await l.submit();let n=l.values;b.forEach(e=>{var l;let{flowKey:r,stepKey:i}=e,o=null==(l=n[r])?void 0:l[i];o&&t.setStepParams(r,i,o)}),await t.saveStepParams(),e(n),P.close()}catch(e){console.error(f("Error submitting form"),":",e)}},s=()=>{P.close(),e({})},d={...C,closeDialog:s,handleNext:()=>{l.validate().then(()=>{F&&F.next()}).catch(e=>{console.log(f("Form validation failed"),":",e)})}},u=(0,c.ln)(d,S);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h,{model:t,requiredSteps:b,formStep:F,children:(0,n.jsx)(p,{schema:u,components:{FormStep:A,...null==(i=k.flowSettings)?void 0:i.components},scope:d})}),(0,n.jsx)(r.FormConsumer,{children:()=>(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:24,paddingTop:16,borderTop:"1px solid #f0f0f0"},children:1===b.length?(0,n.jsx)(a.Ay,{type:"primary",onClick:o,children:f("Complete configuration")}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Ay,{disabled:!(null==F?void 0:F.allowBack),onClick:()=>{F&&F.back()},children:f("Previous step")}),(0,n.jsx)(a.Ay,{disabled:!(null==F?void 0:F.allowNext),type:"primary",onClick:()=>{l.validate().then(()=>{F&&F.next()}).catch(e=>{console.log(f("Form validation failed"),":",e)})},style:{display:((null==F?void 0:F.current)??0)<b.length-1?"inline-block":"none"},children:f("Next step")}),(0,n.jsx)(a.Ay,{disabled:null==F?void 0:F.allowNext,type:"primary",onClick:o,style:{display:((null==F?void 0:F.current)??0)>=b.length-1?"inline-block":"none"},children:f("Complete configuration")})]})})})]})});P.open({initialValues:(0,c.ln)(C,x)})}catch(e){o(Error(`${f("Failed to import FormDialog or FormStep")}: ${e.message}`))}})()}).catch(e=>{console.error(e)})}},23183(e,t,l){l.d(t,{openStepSettingsDialog:()=>f});var n=l(74848),r=l(78880),i=l(18220),o=l(95243),a=l(84626),s=l(71021),d=l(96540),u=l(16296),c=l(60182),p=l(31108),h=l(52847);let m=(0,i.createSchemaField)(),f=async e=>{var t,l,f,g,v,y,b,x;let{model:w,flowKey:S,stepKey:M,dialogWidth:A=600,dialogTitle:F,mode:k="dialog",ctx:C,uiModeProps:P,cleanup:j}=e,E=(0,c.lW)(w),R=w.context.message;if(!w)throw R.error(E("Invalid model provided")),Error(E("Invalid model provided"));let I=w.getFlow(S),T=null==I||null==(t=I.steps)?void 0:t[M];if(!I)throw R.error(E("Flow with key {{flowKey}} not found",{flowKey:S})),Error(E("Flow with key {{flowKey}} not found",{flowKey:S}));if(!T)throw R.error(E("Step with key {{stepKey}} not found",{stepKey:M})),Error(E("Step with key {{stepKey}} not found",{stepKey:M}));let _=T.title,D=T.beforeParamsSave,N=T.afterParamsSave,O={};if(T.use){let e=null==(x=w.flowEngine)||null==(b=x.getAction)?void 0:b.call(x,T.use);e&&(O=e.defaultParams||{},_=_||e.title,D=D||e.beforeParamsSave,N=N||e.afterParamsSave)}let $=w.getFlow(S),B=await (0,c.o7)(w,$,T);if(!B)return R.info(E("This step has no configurable parameters")),{};let L=C;L.currentStep&&L.currentStep===T||L.defineProperty("currentStep",{value:T});let q=w.flowEngine,V={useFlowSettingsContext:u.s,...null==(l=q.flowSettings)?void 0:l.scopes},z=w.getStepParams(S,M)||{},K=await (0,c.gG)(T.defaultParams,L),U=await (0,c.gG)(O,L),W={...(0,o.toJS)(U),...(0,o.toJS)(K),...(0,o.toJS)(z)},H={...(0,o.toJS)(z)},Y={type:"object",properties:{layout:{type:"void","x-component":"FormLayout","x-component-props":{layout:"vertical"},properties:B}}},G=w.context.viewer[k].bind(w.context.viewer),{zIndex:J,...X}=(0,o.toJS)(P)||{},Q=e=>{var t,l;return Math.max("function"==typeof(null==(t=w.context.viewer)?void 0:t.getNextZIndex)?w.context.viewer.getNextZIndex():((null==(l=w.context.themeToken)?void 0:l.zIndexPopupBase)||1e3)+1,Number(e)||0)},Z=Q(J),ee=(0,r.createForm)({initialValues:(0,c.ln)(V,W)}),et=(null==(f=w.context.view)?void 0:f.inputArgs)||{},el=(null==C||null==(g=C.view)?void 0:g.navigation)??(null==(v=w.context.view)?void 0:v.navigation),en={...et,...el?{navigation:el}:{},...(null==(y=(0,o.toJS)(P))?void 0:y.inputArgs)||{},__isSettingsPopup:!0};G({title:F||E(_),width:A,destroyOnClose:!0,...X,zIndex:Z,inputArgs:en,onClose:()=>{j&&j()},content:e=>{let t=(0,h.PA)(()=>{var t;(0,d.useEffect)(()=>(0,o.autorun)(()=>{let{zIndex:t,...l}=(0,o.toJS)(P)||{};e.update({...l,zIndex:Q(t)})}),[]);let l=(0,c.ln)(V,Y);return(0,n.jsx)(i.FormProvider,{form:ee,children:(0,n.jsxs)(u.u,{value:L,children:[(0,n.jsx)(m,{schema:l,components:{...null==(t=q.flowSettings)?void 0:t.components},scope:V}),(0,n.jsx)(e.Footer,{children:(0,n.jsxs)(a.A,{align:"end",children:[(0,n.jsx)(s.Ay,{type:"default",onClick:()=>{e.close()},children:E("Cancel")}),(0,n.jsx)(s.Ay,{type:"primary",onClick:async()=>{try{await ee.submit();let t=ee.values;w.setStepParams(S,M,t),D&&await D(L,t,H),e.close(),await w.saveStepParams(),R.success(E("Configuration saved")),N&&await N(L,t,H)}catch(t){if(t instanceof c.VD)return;if(t instanceof c.sy||t instanceof p.zz)return void e.close();console.error(E("Error saving configuration"),":",t),R.error(E("Error saving configuration, please check console"))}},children:E("OK")})]})})]})})});return(0,n.jsx)(t,{})}})}},41594(e,t,l){l.d(t,{Ls:()=>a,Qp:()=>c,jx:()=>p,yG:()=>u,z5:()=>d});var n=l(2543),r=l.n(n),i=l(60182);async function o(e,t){return"function"==typeof e?await e(t):e}async function a(e,t){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=e.meta??{};if(await o(n.hide,t)&&!l)return;let r={key:e.name,label:n.label||e.name,searchable:!!n.searchable,searchPlaceholder:n.searchPlaceholder,toggleable:n.toggleable,useModel:e.name,sort:n.sort||1e3,children:s(e,t)};return r.createModelOptions=n.createModelOptions||{use:e.name},r}function s(e,t){let l,n=e.meta??{};if(!1===n.children)return!1;if(n.children&&(l=n.children),e.defineChildren&&(l=e.defineChildren.bind(e)),"function"==typeof l){let e=l;l=async()=>{let l=await e(t),o=e=>null==e?void 0:e.map(e=>{let l={...e};if(l.children)l.children=Array.isArray(l.children)?o(l.children):l.children;else if(l.createModelOptions){let e=l.createModelOptions;l.createModelOptions=async function(){for(var l=arguments.length,o=Array(l),a=0;a<l;a++)o[a]=arguments[a];let s=o&&o.length>0?o[o.length-1]:void 0,d=await (0,i.mv)(null==n?void 0:n.createModelOptions,t,s),u=await (0,i.mv)(e,t,s);return r().merge({},r().cloneDeep(d),u)}}return l});return o(l)}}return l}function d(e){return async t=>{let l=await c([e])(t);if(0===l.length)return[];let n=l.shift().children;return"function"==typeof n?n(t):n}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return async l=>{var n,r;let s=l.engine.getSubclassesOf(e),d=[];for(let e of Array.from(s.values()))await o(null==(n=e.meta)?void 0:n.hide,l)||d.push(e);if(0===(d=d.filter(e=>{for(let l of t)if("string"==typeof l){if(e.name===l)return!1}else if(e===l||(0,i.FA)(e,l))return!1;return!0}).sort((e,t)=>{var l,n;return((null==(l=e.meta)?void 0:l.sort)??1e3)-((null==(n=t.meta)?void 0:n.sort)??1e3)})).length){let t="string"==typeof e?l.engine.getModelClass(e):e;t&&!await o(null==(r=t.meta)?void 0:r.hide,l)&&(d=[t])}let u=[];for(let e of d){let t=await a(e,l);t&&u.push(t)}return u}}function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return async t=>{let l=[],n=[];for(let c of e){var r,i,o,a,d;let e="string"==typeof c?t.engine.getModelClass(c):c;if(!e)continue;let p=s(e,t);p||(p=await u(c,n)(t)),n.push(e);let h=!1;if("function"==typeof p)try{let e=await p(t);h=Array.isArray(e)?e.length>0:!!e}catch(e){h=!1}else h=Array.isArray(p)?p.length>0:!!p;if(!h)continue;let m=(null==e||null==(r=e.meta)?void 0:r.label)||("string"==typeof c?c:e.name),f="string"==typeof c?c:e.name,g=(null==e||null==(i=e.meta)?void 0:i.menuType)||"group",v=(null==e||null==(o=e.meta)?void 0:o.sort)??1e3,y=!!(null==e||null==(a=e.meta)?void 0:a.searchable),b=null==e||null==(d=e.meta)?void 0:d.searchPlaceholder;"submenu"===g?l.push({key:f,label:m,sort:v,searchable:y,searchPlaceholder:b,children:p}):l.push({key:f,type:"group",label:m,sort:v,searchable:y,searchPlaceholder:b,children:p})}return l.sort((e,t)=>((null==e?void 0:e.sort)??1e3)-((null==t?void 0:t.sort)??1e3))}}function p(e,t){let{useModel:l,fieldUseModel:n,associationPathName:r,refreshTargets:i,maxAssociationFieldDepth:o=2}=t,a=t.collection||e.model.collection||e.collection,s=a.getFields(),d=[],u=r?r.split(".").filter(Boolean).length:0;for(let e of s){var c,p;if(!(null==e||null==(c=e.options)?void 0:c.interface)||u>=o&&((null==(p=e.isAssociationField)?void 0:p.call(e))||e.target||e.targetCollection))continue;let t=r?`${r}.${e.name}`:e.name,s="function"==typeof n?n(e):n??"FieldModel";if(s){let n={dataSourceKey:a.dataSourceKey,collectionName:a.name,fieldPath:e.name,associationPathName:r};d.push({key:t,label:e.title,toggleable:e=>{let{associationPathName:l,fieldPath:n}=e.getStepParams("fieldSettings","init")||{};return(l?`${l}.${n}`:n)===t},useModel:l,refreshTargets:i,createModelOptions:()=>({use:l,stepParams:{fieldSettings:{init:n}},subModels:{field:{use:s,stepParams:{fieldSettings:{init:n}}}}})})}}return[{key:`addField_${a.name}`,label:"",type:"group",searchable:!0,searchPlaceholder:e.t("Search fields"),children:d.filter(Boolean)}]}},76546(e,t,l){l.d(t,{pM:()=>v,qG:()=>g,qS:()=>f,Ns:()=>d,zA:()=>c,U1:()=>p,JL:()=>y,Xk:()=>b});var n=l(50467),r=l(95243),i=l(2543),o=l.n(i),a=l(16075),s=l.n(a);function d(e){var t;let l;switch(e.type){case"string":l=s().string();break;case"number":l=s().number();break;case"array":l=s().array();break;case"boolean":l=s().boolean();break;default:l=s().any()}let n=(e,t)=>{if(!t||0===Object.keys(t).length)return[];if(Array.isArray(t))return t;if("email"===e){var l;let e={...t};return(null==(l=e.tlds)?void 0:l.allow)===!0?e.tlds.allow=!1:e.tlds||(e.tlds={allow:!1}),[e]}if(["length","min","max"].includes(e))return[t.limit];if("pattern"===e){let e=null==t?void 0:t.regex;return e instanceof RegExp?[e]:[new RegExp(e)]}let n=Object.values(t);return n.length?n:[]},r=!1;return null==(t=e.rules)||t.forEach(e=>{let{name:t,args:i}=e;if("required"===t&&(r=!0),"function"==typeof l[t])try{l=l[t](...n(t,i))}catch(e){console.warn(`调用 Joi 方法 ${t} 失败:`,e)}else console.warn(`Joi schema 上不存在方法: ${t}`)}),r||(l=(l=l.optional().allow("")).optional().allow(null)),l}function u(e){let t=[],l=new Set,n=new Set,r=new Map;e.forEach(e=>{r.set(e.name,e)});let i=e=>{if(n.has(e.name))throw Error(`Circular dependency detected: ${e.name} inherits from itself through a chain`);if(!l.has(e.name)){for(let t of(n.add(e.name),e.inherits||[])){let l=r.get(t);if(!l){console.warn(`Warning: Collection ${t}, inherited by ${e.name}, not found.`);continue}i(l)}n.delete(e.name),l.add(e.name),t.push(e)}};for(let t of e)i(t);return t}class c{setFlowEngine(e){this.flowEngine=e}setRequester(e){this.requester=e}setCollectionFieldInterfaceManager(e){this.collectionFieldInterfaceManager=e}addFieldInterfaces(){var e,t;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];null==(t=this.collectionFieldInterfaceManager)||null==(e=t.addFieldInterfaces)||e.call(t,l)}addFieldInterfaceGroups(e){var t,l;null==(l=this.collectionFieldInterfaceManager)||null==(t=l.addFieldInterfaceGroups)||t.call(l,e)}addFieldInterfaceComponentOption(e,t){var l,n;null==(n=this.collectionFieldInterfaceManager)||null==(l=n.addFieldInterfaceComponentOption)||l.call(n,e,t)}addFieldInterfaceOperator(e,t){var l,n;null==(n=this.collectionFieldInterfaceManager)||null==(l=n.addFieldInterfaceOperator)||l.call(n,e,t)}registerFieldFilterOperator(e){var t,l;null==(l=this.collectionFieldInterfaceManager)||null==(t=l.registerFieldFilterOperator)||t.call(l,e)}registerFieldFilterOperatorGroup(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];null==(l=this.collectionFieldInterfaceManager)||null==(t=l.registerFieldFilterOperatorGroup)||t.call(l,e,n)}addFieldFilterOperatorsToGroup(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];null==(l=this.collectionFieldInterfaceManager)||null==(t=l.addFieldFilterOperatorsToGroup)||t.call(l,e,n)}registerLoader(e,t){this.loaders.set(e,t)}removeLoader(e){this.loaders.delete(e)}addDataSource(e){if(this.dataSources.has(e.key))throw Error(`DataSource with name ${e.key} already exists`);e instanceof f||(e=new(e.use||f)(e)),this.dataSources.set(e.key,e),e.setDataSourceManager(this)}upsertDataSource(e){if(this.dataSources.has(e.key)){var t;null==(t=this.dataSources.get(e.key))||t.patchOptions(e)}else this.addDataSource(e)}removeDataSource(e){this.dataSources.delete(e)}clearDataSources(){this.dataSources.clear()}getDataSources(){return Array.from(this.dataSources.values())}getDataSource(e){return this.dataSources.get(e)}getCollection(e,t){let l=this.getDataSource(e);if(l)return l.collectionManager.getCollection(t)}getCollectionField(e){let[t,...l]=e.split("."),n=this.getDataSource(t);if(n)return n.getCollectionField(l.join("."))}async ensureLoaded(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{force:t=!1}=e,l=this.resolveLoadKeys(e.keys),n=t?l:l.filter(e=>!this.loadedKeys.has(e));if(n.length)return this.loadingPromise||(this.loadingPromise=(async()=>{try{for(let e of n)await this.loadKey(e,{initial:!this.loadedKeys.has(e),force:t})}finally{this.loadingPromise=null}})()),this.loadingPromise}async reload(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.resolveLoadKeys(e.keys);if(t.length)return this.loadingPromise||(this.loadingPromise=(async()=>{try{for(let e of t)await this.loadKey(e,{initial:!1,force:!0})}finally{this.loadingPromise=null}})()),this.loadingPromise}async reloadDataSource(e){return this.loadingKeys.has(e)&&this.loadingPromise?this.loadingPromise:!this.loaders.has(e)&&this.loaders.has("*")?this.reload({keys:["*"]}):this.reload({keys:[e]})}resolveLoadKeys(e){let t=(null==e?void 0:e.length)?e:["main"],l=t.filter(e=>this.loaders.has(e));return this.loaders.has("*")?o().uniq(["*",...l]):l.length?l:t}getApp(){var e,t;return null==(t=this.flowEngine)||null==(e=t.context)?void 0:e.app}dispatchDataSourceEvent(e,t){var l,n;null==(n=this.getApp())||null==(l=n.eventBus)||l.dispatchEvent(new CustomEvent(e,{detail:t}))}setDataSourceState(e,t){let l=this.getDataSource(e);l&&l.patchOptions(t)}applyDataSourceLoadResult(e,t){if("*"===e)return void((null==t?void 0:t.dataSources)||[]).forEach(e=>{let{collections:t,...l}=e;if(this.upsertDataSource(l),t){var n;null==(n=this.getDataSource(l.key))||n.setCollections(t,{clearFields:!0})}});let l=this.getDataSource(e);l&&l.setCollections((null==t?void 0:t.collections)||[],{clearFields:!0})}async loadKey(e,t){let l=this.loaders.get(e);if(!l)return;this.getDataSource(e)||"*"===e||this.addDataSource({key:e});let{initial:n}=t;this.loadingKeys.add(e),"*"!==e&&this.setDataSourceState(e,{status:n?"loading":"reloading",errorMessage:void 0}),this.loadErrors.set(e,null);try{let t=await l({key:e,manager:this})||{};this.applyDataSourceLoadResult(e,t),this.loadedKeys.add(e),"*"!==e&&this.setDataSourceState(e,{status:"loaded",errorMessage:void 0}),this.dispatchDataSourceEvent("dataSource:loaded",{dataSourceKey:e,initial:n})}catch(l){let t=l instanceof Error?l:Error(String(l));throw this.loadErrors.set(e,t),"*"!==e&&this.setDataSourceState(e,{status:n?"loading-failed":"reloading-failed",errorMessage:t.message}),this.dispatchDataSourceEvent("dataSource:loadFailed",{dataSourceKey:e,initial:n,error:t}),t}finally{this.loadingKeys.delete(e)}}constructor(){(0,n._)(this,"dataSources",void 0),(0,n._)(this,"flowEngine",void 0),(0,n._)(this,"requester",void 0),(0,n._)(this,"collectionFieldInterfaceManager",void 0),(0,n._)(this,"loaders",new Map),(0,n._)(this,"loadedKeys",new Set),(0,n._)(this,"loadingKeys",new Set),(0,n._)(this,"loadErrors",new Map),(0,n._)(this,"loadingPromise",null),this.dataSources=r.observable.shallow(new Map)}}function p(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(e)for(let t of l){let l=null==t?void 0:t.collectionFieldInterfaceManager,n=null==l?void 0:l.getFieldInterface;if("function"==typeof n)return n.call(l,e)}}function h(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function m(e,t,l){return h(t)?e.translate(t,l):t}class f{get flowEngine(){return this.dataSourceManager.flowEngine}get displayName(){return this.flowEngine.translate(this.options.displayName,{ns:"lm-collections"})||this.key}get key(){return this.options.key}get name(){return this.options.key}get status(){return this.options.status}get errorMessage(){return this.options.errorMessage}setDataSourceManager(e){this.dataSourceManager=e}getCollections(){return this.collectionManager.getCollections()}getCollection(e){return this.collectionManager.getCollection(e)}getAssocation(e){return this.getAssociation(e)}getAssociation(e){return this.collectionManager.getAssociation(e)}addCollection(e){return this.collectionManager.addCollection(e)}updateCollection(e){return this.collectionManager.updateCollection(e)}upsertCollection(e){return this.collectionManager.upsertCollection(e)}upsertCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.collectionManager.upsertCollections(e,t)}setCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.collectionManager.setCollections(e,t)}removeCollection(e){return this.collectionManager.removeCollection(e)}clearCollections(){this.collectionManager.clearCollections()}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e)}patchOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this.options,e)}reload(){return this.dataSourceManager.reloadDataSource(this.key)}getCollectionField(e){let[t,...l]=e.split("."),n=l.join("."),r=this.getCollection(t);if(!r)return;let i=r.getFieldByPath(n);if(i)return i}constructor(e={}){(0,n._)(this,"dataSourceManager",void 0),(0,n._)(this,"collectionManager",void 0),(0,n._)(this,"options",void 0),this.options=(0,r.observable)({...e}),this.collectionManager=new g(this)}}class g{resetCaches(){this.childrenCollectionsName={},this.allCollectionsInheritChain=void 0}get flowEngine(){return this.dataSource.flowEngine}addCollection(e){let t;(t=e instanceof v?e:new v(e)).setDataSource(this.dataSource),t.initInherits(),this.collections.set(t.name,t),this.resetCaches()}removeCollection(e){this.collections.delete(e),this.resetCaches()}updateCollection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=this.getCollection(e.name);if(!l)throw Error(`Collection ${e.name} not found`);l.setOptions(e,t),this.resetCaches()}upsertCollection(e){return this.collections.has(e.name)?this.updateCollection(e):this.addCollection(e),this.getCollection(e.name)}upsertCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(let l of u(e))this.collections.has(l.name)?this.updateCollection(l,t):this.addCollection(l);this.resetCaches()}setCollections(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.clearCollections(),this.upsertCollections(e,t)}sortCollectionsByInherits(e){let t=new Map;for(let l of e)t.set(l.name,l);let l={},n={};for(let t of e)l[t.name]=new Set,n[t.name]=0;for(let t of e)for(let e of t.inherits||[])l[e]||(l[e]=new Set),l[e].add(t.name),n[t.name]=(n[t.name]||0)+1;let r=[];for(let e in n)0===n[e]&&r.push(e);let i=[];for(;r.length;){let e=r.shift();for(let o of(t.has(e)&&i.push(t.get(e)),l[e]||[]))n[o]--,0===n[o]&&r.push(o)}if(i.length!==e.length)throw Error("Collection inherits has circular dependency!");return i}getCollection(e){if(e.includes(".")){let[t,l]=e.split("."),n=this.getCollection(t);if(!n)throw Error(`Collection ${t} not found in data source ${this.dataSource.key}`);let r=n.getField(l);if(!r)throw Error(`Field ${l} not found in collection ${t}`);return r.targetCollection}return this.collections.get(e)}getCollections(){return o().sortBy(Array.from(this.collections.values()).filter(e=>!e.hidden),"sort")}clearCollections(){this.collections.clear(),this.resetCaches()}getAssociation(e){let[t,l]=e.split("."),n=this.getCollection(t);if(!n)throw Error(`Collection ${t} not found in data source ${this.dataSource.key}`);return n.getField(l)}getChildrenCollections(e){let t=[],l=Array.from(this.collections.values()),n=e=>(l.filter(t=>{var l;return null==(l=t.options.inherits)?void 0:l.includes(e)}).forEach(e=>{let l=e.name;return t.push(e),n(l)}),t);return n(e)}getChildrenCollectionsName(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=t?"supportView":"notSupportView";if(this.childrenCollectionsName[l])return this.childrenCollectionsName[l].slice();let n=[],r=[...this.getCollections()],i=e=>(r.filter(t=>{var l;return l=[...t.inherits],l.includes(e)}).forEach(e=>{let t=e.name;return n.push(t),i(t)}),t&&r.filter(t=>{var l;return l=[...t.sources],l.length===1&&(null==t?void 0:t.sources[0])===e}).forEach(e=>{let t=e.name;return n.push(e.name),i(t)}),o().uniq(n));return this.childrenCollectionsName[l]=i(e),this.childrenCollectionsName[l]}getAllCollectionsInheritChain(e){if(this.allCollectionsInheritChain)return this.allCollectionsInheritChain.slice();let t=[e],l=e=>{let n=this.getCollection(e);if(n){let{inherits:r}=n,i=this.getChildrenCollectionsName(e);if(r)for(let e=0;e<r.length;e++){let n=r[e];t.includes(n)||(t.push(n),l(n))}if(i)for(let e=0;e<i.length;e++){let n=this.getCollection(i[e]).name;t.includes(n)||(t.push(n),l(n))}}return t};return this.allCollectionsInheritChain=l(e),this.allCollectionsInheritChain||[]}constructor(e){(0,n._)(this,"dataSource",void 0),(0,n._)(this,"collections",void 0),(0,n._)(this,"allCollectionsInheritChain",void 0),(0,n._)(this,"childrenCollectionsName",void 0),this.dataSource=e,this.childrenCollectionsName={},this.collections=r.observable.shallow(new Map)}}class v{clone(){let e=new v(o().cloneDeep(this.options));return e.setDataSource(this.dataSource),e}getFilterByTK(e){if(!e)throw Error("Record is required to get filterByTk");if(Array.isArray(e))return e.map(e=>this.getFilterByTK(e));if(!this.filterTargetKey)throw Error(`filterTargetKey is not defined for collection ${this.name}`);return"string"==typeof this.filterTargetKey?e[this.filterTargetKey]:Array.isArray(this.filterTargetKey)&&1===this.filterTargetKey.length?e[this.filterTargetKey[0]]:o().pick(e,this.filterTargetKey)}get titleableFields(){return this.getFields().filter(e=>e.titleable)}get hidden(){return this.options.hidden||!1}get flowEngine(){return this.dataSource.flowEngine}get collectionManager(){return this.dataSource.collectionManager}get sort(){return this.options.sort||0}get filterTargetKey(){return this.options.filterTargetKey}get dataSourceKey(){return this.dataSource.key}get name(){return this.options.name}get template(){return this.options.template}get storage(){return this.options.storage||"local"}get title(){return this.flowEngine.translate(this.options.title,{ns:"lm-collections"})||this.name}get titleCollectionField(){let e=this.options.titleField||this.filterTargetKey;if(Array.isArray(e)){if(1!==e.length)return;return this.getField(e[0])}return this.getField(e)}initInherits(){for(let e of(this.inherits.clear(),this.options.inherits||[])){let t=this.collectionManager.getCollection(e);if(!t){console.warn(`Warning: Collection ${e} not found for collection ${this.name}`);continue}this.inherits.set(e,t)}}setDataSource(e){this.dataSource=e}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e),this.initInherits(),t.clearFields&&this.clearFields(),this.upsertFields(this.options.fields||[])}setOption(e,t){this.options[e]=t}getFields(){let e=new Map;for(let t of this.inherits.values())if(t&&"function"==typeof t.getFields)for(let l of t.getFields())e.set(l.name,l);for(let[t,l]of this.fields.entries())e.set(t,l);return Array.from(e.values())}getToOneAssociationFields(){return this.getAssociationFields(["one"])}getAssociationFields(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.includes("new")?this.getFields().filter(e=>["hasMany","belongsToMany","belongsToArray"].includes(e.type)):e.includes("many")&&e.includes("one")?this.getFields().filter(e=>e.isAssociationField()):e.includes("many")?this.getFields().filter(e=>["hasMany","belongsToMany","belongsToArray"].includes(e.type)):e.includes("one")?this.getFields().filter(e=>["hasOne","belongsTo"].includes(e.type)):this.getFields().filter(e=>e.isAssociationField())}mapFields(e){return this.getFields().map(e)}setFields(e){for(let t of(this.fields.clear(),e))this.addField(t)}upsertFields(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(let t of e)this.fields.has(t.name)?this.fields.get(t.name).setOptions(t):this.addField(t)}getFieldByPath(e){let[t,...l]=e.split("."),n=this.getField(t);return 0===l.length?n:(null==n?void 0:n.targetCollection)?n.targetCollection.getFieldByPath(l.join(".")):null}getField(e){return this.fields.get(e)}getFullFieldPath(e){return this.dataSource.key+"."+this.name+"."+e}addField(e){if(e.name&&this.fields.has(e.name))throw Error(`Field with name ${e.name} already exists in collection ${this.name}`);if(e instanceof y)e.setCollection(this),this.fields.set(e.name,e);else{let t=new y(e);t.setCollection(this),this.fields.set(t.name,t)}}removeField(e){return this.fields.delete(e)}clearFields(){return this.fields.clear()}refresh(){}getRelationshipFields(){let e=["o2o","oho","obo","m2o","createdBy","updatedBy","o2m","m2m","linkTo","chinaRegion","mbm"];return this.getFields().filter(t=>e.includes(t.interface))}getRelatedCollections(){let e=this.getRelationshipFields(),t=[],l=new Set;for(let n of e)if(n.target&&!l.has(n.target)){let e=this.collectionManager.getCollection(n.target);e&&e.name!==this.name&&(t.push(e),l.add(n.target))}return t}hasRelationshipFields(){return this.getRelationshipFields().length>0}constructor(e={}){(0,n._)(this,"fields",void 0),(0,n._)(this,"options",void 0),(0,n._)(this,"inherits",void 0),(0,n._)(this,"dataSource",void 0),this.options=(0,r.observable)({...e}),this.fields=r.observable.shallow(new Map),this.inherits=r.observable.shallow(new Map),this.setFields(e.fields||[])}}class y{setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(this.options).forEach(e=>delete this.options[e]),Object.assign(this.options,e)}setCollection(e){this.collection=e}get targetCollectionTitleFieldName(){var e,t;return null==(t=this.targetCollection)||null==(e=t.titleCollectionField)?void 0:e.name}get targetCollectionTitleField(){var e;return null==(e=this.targetCollection)?void 0:e.titleCollectionField}get flowEngine(){return this.collection.flowEngine}get dataSourceKey(){var e;return null==(e=this.collection)?void 0:e.dataSourceKey}get resourceName(){return`${this.collection.name}.${this.name}`}get collectionName(){var e;return(null==(e=this.collection)?void 0:e.name)||this.options.collectionName}get readonly(){var e;return this.options.readonly||(null==(e=this.options.uiSchema)?void 0:e["x-read-pretty"])||!1}get titleable(){return!!(this.options.titleable??this.options.titleUsable)}get fullpath(){return this.collection.dataSource.key+"."+this.collection.name+"."+this.name}get name(){return this.options.name}get type(){return this.options.type}get dataType(){return this.options.dataType}get foreignKey(){return this.options.foreignKey}get targetKey(){return this.options.targetKey||this.targetCollection.filterTargetKey}get sourceKey(){return this.options.sourceKey}get target(){return this.options.target}get title(){var e,t,l;let n=(null==(t=this.options)||null==(e=t.uiSchema)?void 0:e.title)||(null==(l=this.options)?void 0:l.title);return this.flowEngine.translate(n,{ns:"lm-collections"})||this.options.name}set title(e){this.options.title=e}get enum(){var e;let t=(null==(e=this.options.uiSchema)?void 0:e.enum)||[];return"integer"===this.type?t.map(e=>"object"!=typeof e||null===e.value||void 0===e.value?e:{...e,label:m(this.flowEngine,e.label,{ns:"lm-collections"}),value:Number(e.value)}):t.map(e=>({...e,label:m(this.flowEngine,e.label,{ns:"lm-collections"})}))}get defaultValue(){return null==this.options.defaultValue?void 0:this.options.defaultValue}get interface(){return this.options.interface}get filterable(){var e;return this.options.filterable||(null==(e=this.getInterfaceOptions())?void 0:e.filterable)}get inputable(){return this.options.inputable}get uiSchema(){return this.options.uiSchema||{}}get targetCollection(){var e;return this.options.target&&(null==(e=this.collection)?void 0:e.collectionManager.getCollection(this.options.target))}get validation(){return this.options.validation}getComponentProps(){var e,t;let{type:l,target:n}=this.options,r=o().omitBy({...o().omit((null==(e=this.options.uiSchema)?void 0:e["x-component-props"])||{},"fieldNames"),options:this.enum.length?this.enum:void 0,mode:"multipleSelect"===this.interface?"multiple":void 0,multiple:n?["belongsToMany","hasMany","belongsToArray"].includes(l):void 0,maxCount:n&&!["belongsToMany","hasMany","belongsToArray"].includes(l)?1:void 0,target:n,template:null==(t=this.targetCollection)?void 0:t.template},o().isUndefined);if(this.validation){let e=[],t=d(this.validation),l=this.title;e.push({validator:(e,n)=>{let{error:r}=t.validate(n,{context:{label:l},abortEarly:!1});return r?Promise.reject(r.details.map(e=>{let t=this.flowEngine.translate(e.type,{...e.context,ns:"data-source-main",label:l});return t&&t!==e.type?t:e.message.replace(/"value"/g,`"${l}"`)}).join(", ")):Promise.resolve()}}),r.rules=e}return r}getFields(){if(!this.options.target)return[];if(!this.targetCollection)throw Error(`Target collection ${this.options.target} not found for field ${this.name}`);return this.targetCollection.getFields()}getInterfaceOptions(){var e,t,l;let n=this.flowEngine.context;return p(this.interface,null==(t=this.collection)||null==(e=t.dataSource)?void 0:e.dataSourceManager,n.dataSourceManager,null==(l=n.app)?void 0:l.dataSourceManager)}getFilterOperators(){var e;let t=this.getInterfaceOptions();return(null==t||null==(e=t.filterable)?void 0:e.operators)||[]}getSubclassesOf(e){return this.flowEngine.getSubclassesOf(e,(e,t)=>b(e.supportedFieldInterfaces,this.interface))}getFirstSubclassNameOf(e){for(let[t,l]of this.getSubclassesOf(e))if("*"!==l.supportedFieldInterfaces)return t}isAssociationField(){return["belongsToMany","belongsTo","hasMany","hasOne","belongsToArray"].includes(this.type)}isRelationshipField(){return["o2o","oho","obo","m2o","createdBy","updatedBy","o2m","m2m","linkTo","chinaRegion","mbm"].includes(this.interface)}constructor(e){(0,n._)(this,"options",void 0),(0,n._)(this,"collection",void 0),this.options=(0,r.observable)({...e})}}function b(e,t){return!!e&&("*"===e||("string"==typeof e?e===t:!!Array.isArray(e)&&(e.includes("*")||e.includes(t))))}},48036(e,t,l){l.d(t,{v:()=>r});var n=l(50467);class r{setPaused(e){this.paused=e}on(e,t){var l,n;((l=this.events)[n=e]||(l[n]=[])).push(t)}off(e,t){this.events[e]=(this.events[e]||[]).filter(e=>e!==t)}emit(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];this.paused||(this.events[e]||[]).forEach(e=>e(...l))}async emitAsync(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];if(!this.paused)for(let t of(this.events[e]||[]).slice())await t(...l)}constructor(){(0,n._)(this,"events",{}),(0,n._)(this,"paused",!1)}}},26955(e,t,l){l.d(t,{L:()=>r});var n=l(50467);class r{onEventRegistered(){}registerEvents(e){for(let[,t]of Object.entries(e||{}))this.registerEvent(t)}registerEvent(e){if(!(null==e?void 0:e.name))throw Error("Event must have a name.");this.events.has(e.name)&&console.warn(`Event '${e.name}' is already registered. It will be overwritten.`),this.events.set(e.name,e),this.onEventRegistered()}constructor(){(0,n._)(this,"events",new Map)}}},84471(e,t,l){l.d(t,{j:()=>o});var n=l(50467),r=l(68161),i=l(95243);class o{addFlows(e){for(let[t,l]of Object.entries(e||{}))this.addFlow(t,l)}addFlow(e,t){let l=new r.G({...t,key:e},this);return this.flows.set(e,l),l}hasFlow(e){return!!this.flows.get(e)}getFlow(e){return this.flows.get(e)}getFlows(){return this.flows}removeFlow(e){this.flows.delete(e)}mapFlows(e){return[...this.getFlows().values()].map(t=>e(t))}moveStep(e,t,l){let n=this.getFlow(e);if(!n)throw Error(`Flow '${e}' not found`);n.moveStep(t,l)}constructor(){(0,n._)(this,"flows",void 0),this.flows=i.observable.shallow(new Map)}}},98837(e,t,l){l.d(t,{r:()=>o});var n=l(50467),r=l(33954),i=l(84471);class o extends i.j{removeFlow(e){console.warn(`GlobalFlowRegistry.removeFlow: removing static flow '${e}' is not supported.`)}getFlow(e){if(this.flows.has(e))return this.flows.get(e);let t=Object.getPrototypeOf(this.target);if(t!==Function.prototype&&t!==Object.prototype&&(null==t?void 0:t.globalFlowRegistry))return t.globalFlowRegistry.getFlow(e)}getFlows(){let e=new Map(this.flows),t=Object.getPrototypeOf(this.target);if(t!==Function.prototype&&t!==Object.prototype&&(null==t?void 0:t.globalFlowRegistry))for(let[l,n]of t.globalFlowRegistry.getFlows().entries())e.has(l)||e.set(l,n);let l=e=>{let t=0,l=e;for(;l&&l!==r.WD&&l!==Function.prototype&&l!==Object.prototype;)l=Object.getPrototypeOf(l),t+=1;return t};return new Map(Array.from(e.entries()).sort((e,t)=>{let[,n]=e,[,r]=t,i=n.sort??0,o=r.sort??0;if(i!==o)return i-o;let a=n.flowRegistry,s=r.flowRegistry,d=l(a.target),u=l(s.target);return d!==u?d-u:0}))}saveFlow(e){}destroyFlow(e){}constructor(e){super(),(0,n._)(this,"target",void 0),this.target=e}}(0,n._)(o,"_type","global")},96321(e,t,l){l.d(t,{R:()=>i});var n=l(50467),r=l(84471);class i extends r.j{async save(){await this.model.saveStepParams()}async saveFlow(e){await this.model.saveStepParams()}async destroyFlow(e){this.removeFlow(e),await this.model.saveStepParams()}async moveStep(e,t,l){super.moveStep(e,t,l),await this.model.saveStepParams()}constructor(e){super(),(0,n._)(this,"model",void 0),this.model=e}}(0,n._)(i,"_type","instance")},29007(e,t,l){l.d(t,{W5:()=>e_,uk:()=>eX,Hl:()=>eT,o0:()=>eR,d6:()=>eI,cB:()=>ev,Bt:()=>eW});var n=l(58587),r=l(18150),i=l(68238),o=l(88243),a=l(16213),s=l(50467),d=l(95243),u=l(88909),c=l(74172),p=l(2543),h=l.n(p),m=l(55373),f=l.n(m),g=l(96540),v=l(5338),y=l.t(v,2),b=l(63128);class x{setData(e){this.data=h().cloneDeep(e)}setMeta(e){this.meta=h().cloneDeep(e)}async load(){var e,t,l,n;let r=(null==(n=this.flowEngine)||null==(l=n.context)||null==(t=l.api)||null==(e=t.auth)?void 0:e.token)||"";this.loaded&&this.lastToken!==r&&(this.loaded=!1,this.loadingPromise=null,this.data={},this.meta={});let{data:i}=await this.flowEngine.context.api.request({url:"roles:check"});this.data=(null==i?void 0:i.data)||{},this.meta=(null==i?void 0:i.meta)||{},this.loaded=!0,this.lastToken=r,await this.loadingPromise}getActionAlias(e){var t;return(null==(t=this.data.actionAlias)?void 0:t[e])||e}inResources(e,t){var l,n,r;let{dataSources:i}=(null==(l=this)?void 0:l.meta)||{};return null==(r=({...this.data,...(0,p.omit)(null==i?void 0:i[t],"snippets")}).resources)||null==(n=r.includes)?void 0:n.call(r,e)}getResourceActionParams(e,t,l){var n,r,i;let o=this.getActionAlias(t),{dataSources:a}=(null==(n=this)?void 0:n.meta)||{},s={...this.data,...(0,p.omit)(null==a?void 0:a[l],"snippets")};return(null==(r=s.actions)?void 0:r[`${e}:${o}`])||(null==(i=s.actions)?void 0:i[t])}getStrategyActionParams(e,t){var l,n,r;let i=this.getActionAlias(e),{dataSources:o}=(null==(l=this)?void 0:l.meta)||{},a={...this.data,...(0,p.omit)(null==o?void 0:o[t],"snippets")};return(null==a||null==(r=a.strategy)||null==(n=r.actions)?void 0:n.find(e=>{let[t]=e.split(":");return t===i}))?{}:null}parseAction(e){var t;let{resourceName:l,actionName:n,dataSourceKey:r="main",recordPkValue:i,allowedActions:o}=e,a=(null==l?void 0:l.includes("."))&&(null==(t=this.flowEngine.context.dataSourceManager.getDataSource(r).collectionManager.getAssociation(l))?void 0:t.target);return this.getIgnoreScope(e)||this.verifyScope(n,i,o)?this.inResources(a,r)?this.getResourceActionParams(a,n,r):this.inResources(l,r)?this.getResourceActionParams(l,n,r):this.getStrategyActionParams(n,r):null}parseField(e){let{fields:t}=e,l=this.parseAction(e),n=[].concat((null==l?void 0:l.whitelist)||[]).concat((null==l?void 0:l.fields)||[]).concat((null==l?void 0:l.appends)||[]);return!!l&&!Object.keys(l).length||n.includes(t[0])}can(e){var t;let{allowAll:l}=this.data;if(l)return!0;let{actionName:n,allowedActions:r,recordPkValue:i}=e,o=null!=i,a=o&&r?this.verifyScope(n,i,r):null;if(o&&r&&!0!==a)return!1;let s=this.parseAction(e);if(!s||!h().isEmpty(s.filter)&&!0!==a)return!1;if(!(null==(t=e.fields)?void 0:t.length))return!0;let d=[].concat(s.whitelist||[]).concat(s.fields||[]).concat(s.appends||[]);return!d.length||e.fields.every(e=>d.includes(e))}async aclCheck(e){let{allowAll:t}=this.data;return!!t||(e.fields?this.parseField(e):this.parseAction(e))}constructor(e){(0,s._)(this,"flowEngine",void 0),(0,s._)(this,"data",void 0),(0,s._)(this,"meta",void 0),(0,s._)(this,"loaded",void 0),(0,s._)(this,"loadingPromise",void 0),(0,s._)(this,"lastToken",void 0),(0,s._)(this,"getIgnoreScope",void 0),(0,s._)(this,"verifyScope",void 0),this.flowEngine=e,this.data={},this.meta={},this.loaded=!1,this.loadingPromise=null,this.lastToken=null,this.getIgnoreScope=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{recordPkValue:t,allowedActions:l,actionName:n}=e,r=!1;return e.ignoreScope&&(r=!0),"create"===n&&(r=!0),t&&l||(r=!0),r},this.verifyScope=(e,t,l)=>{let n=this.getActionAlias(e),r=null==l?void 0:l[n];return Array.isArray(r)?r.map(e=>String(e)).includes(String(t)):null}}}let w=Symbol.toPrimitive;class S{toString(){return`{{${this.path.join(".")}}}`}valueOf(){return this.toString()}[w](){return this.toString()}static create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["ctx"];return new Proxy(new S(e),{get(t,l,n){if("symbol"==typeof l)return;if(l in t){let e=t[l];return"function"==typeof e?e.bind(t):e}let r=[...e,l.toString()];return S.create(r)}})}constructor(e){(0,s._)(this,"path",void 0),this.path=e}}var M=l(76546),A=l(48910);class F{translate(e,t){return!e||"string"!=typeof e||(null==t?void 0:t.compareWith)&&e===t.compareWith?e:this.isTemplate(e)?this.compileTemplate(e):this.translateKey(e,t)}translateKey(e,t){var l,n;if(null==(n=this.context)||null==(l=n.i18n)?void 0:l.t){let l=this.context.i18n.t(e,t);return null==l||""===l?e:l}return e}isTemplate(e){return/\{\{\s*t\s*\(\s*["'`].*?["'`]\s*(?:,\s*.*?)?\s*\)\s*\}\}/g.test(e)}compileTemplate(e){return e.replace(/\{\{\s*t\s*\(\s*["'`](.*?)["'`]\s*(?:,\s*((?:[^{}]|\{[^}]*\})*?))?\s*\)\s*\}\}/g,(e,t,l)=>{try{let n={};if(l&&(l=l.trim()).startsWith("{")&&l.endsWith("}"))try{n=Function("$root",`with($root) { return (${l}); }`)({})}catch(t){return e}return this.translateKey(t,n)}catch(t){return console.warn(`FlowEngine: Failed to compile template "${e}":`,t),e}})}constructor(e){(0,s._)(this,"context",void 0),this.context=e}}var k=l(91013),C=l(27667),P=l(60182),j=l(31108),E=l(81982),R=l(22928),I=l(9297),T=l(73398),_=l(37966),D=l(62572),N=l(74353),O=l.n(N),$=l(98192),B=l(47684),L=l(51143);function q(e){try{if(!e||"object"!=typeof e&&"function"!=typeof e)return[];return Object.getOwnPropertyNames(e)}catch(e){return[]}}function V(e,t){if(!e.length)return[];if(!t.length)return[...e];let l=new Set(t),n=[];for(let t of e)l.has(t)||n.push(t);return n}async function z(e){let t,l=globalThis;l.__nocobaseRunjsModuleLoadLock=(l.__nocobaseRunjsModuleLoadLock||Promise.resolve()).catch(()=>{});let n=l.__nocobaseRunjsModuleLoadLock,r=new Promise(e=>{t=e});l.__nocobaseRunjsModuleLoadLock=n.then(()=>r),await n;try{return await e()}finally{null==t||t()}}function K(){let e=globalThis,t=null==e?void 0:e.define,l=null==t?void 0:t.amd;if(!t||!l)return()=>{};let n=Object.getOwnPropertyDescriptor(t,"amd"),r=!!n,i=l;try{(null==n?void 0:n.writable)?t.amd=void 0:(null==n?void 0:n.configurable)?delete t.amd:t.amd=void 0}catch(e){}return()=>{try{if(r&&n)return void Object.defineProperty(t,"amd",n);t.amd=i}catch(e){}}}function U(){var e,t;let l=globalThis,n=null==l||null==(e=l.requirejs)?void 0:e.requirejs,r=null==n||null==(t=n.s)?void 0:t.contexts;if(!r||"object"!=typeof r)return!1;for(let e of Object.keys(r)){let t=r[e],l=null==t?void 0:t.registry;if(l&&"object"==typeof l)for(let e of Object.keys(l)){let t=l[e];if(!t||"object"!=typeof t||!t.enabled||t.error)continue;let n=t.map;if(n&&"object"==typeof n&&!t.inited&&t.fetched&&n.isDefine)return!0}}return!1}async function W(e){let t=Math.max(0,(null==e?void 0:e.timeoutMs)??1500),l=Math.max(10,(null==e?void 0:e.pollMs)??30);if(0===t)return;let n=Date.now();for(;U();){if(Date.now()-n>=t)return;await new Promise(e=>setTimeout(e,l))}}async function H(e,t){let l="string"==typeof e?e.trim():"";if(!l)return;let n=globalThis;n.__nocobaseImportAsyncPrefetchCache=n.__nocobaseImportAsyncPrefetchCache||new Map;let r=n.__nocobaseImportAsyncPrefetchCache;if(r.has(l))return await r.get(l);let i=Math.max(0,(null==t?void 0:t.timeoutMs)??5e3),o=(async()=>{try{var e,t,n;if("u">typeof document&&(null==(e=document)?void 0:e.createElement)){let e=new URL(l,(null==(n=globalThis)||null==(t=n.location)?void 0:t.href)||void 0).toString(),r=document.head||document.getElementsByTagName("head")[0];if(r){let t=`link[rel="modulepreload"][href="${e}"]`;if(!document.querySelector(t)){let t=document.createElement("link");return t.rel="modulepreload",t.href=e,t.crossOrigin="anonymous",await new Promise(e=>{let l=!1,n=()=>{l||(l=!0,t.onload=null,t.onerror=null,e())},o=i>0?setTimeout(()=>{n()},i):void 0;t.onload=()=>{o&&clearTimeout(o),n()},t.onerror=()=>{o&&clearTimeout(o),n()},r.appendChild(t)})}}}}catch(e){}try{if("function"!=typeof fetch)return;let e="function"==typeof AbortController?new AbortController:void 0,t=e&&i>0?setTimeout(()=>{try{e.abort()}catch(e){}},i):void 0,n=await fetch(l,{method:"GET",mode:"cors",credentials:"omit",cache:"force-cache",signal:null==e?void 0:e.signal});if(t&&clearTimeout(t),n&&n.ok&&"function"==typeof n.arrayBuffer)try{await n.arrayBuffer()}catch(e){}}catch(e){}})().catch(()=>{});return r.set(l,o),await o}async function Y(e,t){return await z(async()=>{let l,n,r="u">typeof window?q(window):[],i="u">typeof document?q(document):[];try{l=await new Promise((l,n)=>{e?e([t],function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];l(t[0])},n):n(Error("requirejs is not available"))})}catch(e){n=e}finally{let e="u">typeof window?q(window):[],t="u">typeof document?q(document):[],l=V(e,r),n=V(t,i);(0,L.Vm)(l),(0,L.yz)(n)}if(n)throw n;return l})}async function G(e){var t,l;if(!e||"string"!=typeof e)throw Error("invalid url");let n=e.trim(),r=!!(null==(l=globalThis)||null==(t=l.define)?void 0:t.amd);return r&&await H(n),await z(async()=>{await W();let e=r?K():()=>{};try{let e=()=>import(n),t=()=>(0,eval)("u => import(u)")(n);try{return await e()}catch(e){try{return await t()}catch(t){throw t||e}}}finally{e()}})}function J(e){let t=e.indexOf("?"),l=e.indexOf("#"),n=t>=0&&l>=0?Math.min(t,l):t>=0?t:l;return n>=0?e.slice(0,n):e}function X(e){if(!e||"string"!=typeof e)return null;let t=J(e).trim();if(!t||t.startsWith("http://")||t.startsWith("https://"))return null;let l=t.replace(/^\//,"");if(!l)return null;if(l.startsWith("@")){let e=l.match(/^(@[^/]+\/[^/]+?)(?:@([^/]+))?(?:\/(.*))?$/);return e?{name:e[1],version:e[2],subpath:e[3]}:null}let n=l.match(/^([^/]+?)(?:@([^/]+))?(?:\/(.*))?$/);return n?{name:n[1],version:n[2],subpath:n[3]}:null}function Q(e,t){if(!e||"string"!=typeof e)return e;let l=e.trim(),n=l.indexOf("#"),r=n>=0?l.slice(0,n):l,i=n>=0?l.slice(n):"",o=r.indexOf("?"),a=o>=0?r.slice(0,o):r,s=new URLSearchParams(o>=0?r.slice(o+1):"");for(let[e,l]of Object.entries(t))e&&(s.has(e)||s.set(e,l));let d=s.toString();return d?`${a}?${d}${i}`:`${a}${i}`}function Z(){let e=globalThis;if("string"==typeof(null==e?void 0:e.__esm_cdn_base_url__))return e.__esm_cdn_base_url__;let t="u">typeof window?window:null==e?void 0:e.window;return"string"==typeof(null==t?void 0:t.__esm_cdn_base_url__)?t.__esm_cdn_base_url__:"https://esm.sh"}function ee(e){if(e&&"object"==typeof e&&"default"in e){let t=Object.keys(e);if(1===t.length&&"default"===t[0])return e.default}return e}async function et(e,t,l){if(!t||"string"!=typeof t)throw Error("invalid url");let n=t,r=X(t);if((null==r?void 0:r.name)==="antd"&&!r.subpath&&"string"==typeof Z()){let t={bundle:"1"},l=null==e?void 0:e.__runjsExternalReact,r=null==l?void 0:l.version;r&&"string"==typeof r&&(t.deps=`react@${r},react-dom@${r}`),n=Q(n,t)}let i=(0,B.i)(n,{addSuffix:(null==l?void 0:l.addSuffix)??!0}),o=(null==l?void 0:l.importer)||G,a=globalThis;a.__nocobaseImportAsyncCache=a.__nocobaseImportAsyncCache||new Map;let s=a.__nocobaseImportAsyncCache,d=s.get(i)||(async()=>ee(await o(i)))();s.set(i,d);let u=await d,c=null==e?void 0:e.libs;if(!c||"object"!=typeof c)return u;let p=X(n);if(!p)return u;let h=p.subpath||"";if("react"!==p.name||h)"react-dom"===p.name&&("client"===h||h.startsWith("client/"))?((0,$.qf)(e,"ReactDOM",u),e.__runjsExternalReactDOM={specifier:t,version:p.version,url:i}):"antd"!==p.name||h?"@ant-design/icons"!==p.name||h||((0,$.qf)(e,"antdIcons",u,{topLevelKey:!1}),e.__runjsExternalAntdIcons={specifier:t,version:p.version,url:i}):((0,$.qf)(e,"antd",u),e.__runjsExternalAntd={specifier:t,version:p.version,url:i});else{(0,$.qf)(e,"React",u),e.__runjsExternalReact={specifier:t,version:p.version,url:i};let l=p.version?`react-dom@${p.version}/client`:"react-dom/client";try{await e.importAsync(l)}catch(n){let e=Error(`External React has been loaded via ctx.importAsync("${t}"), but auto-loading "${l}" failed.
|
|
1350
|
-
Please run: await ctx.importAsync("${l}") to ensure ctx.render uses a matching ReactDOM.`);throw e.cause=n,e}}return u}function el(e){return e.endsWith("/")?e:`${e}/`}function en(e,t){try{let l=new URL(e);if(!["http:","https:"].includes(l.protocol))return!1;if(!(null==t?void 0:t.getApiUrl))return!0;let n=new URL(t.getApiUrl()),r=el(n.pathname),i=el(l.pathname);return l.origin!==n.origin||!i.startsWith(r)}catch{return!1}}function er(e){return!!(e&&"object"==typeof e&&"collection"in e&&"filterByTk"in e)}function ei(e,t){if(t&&0!==t.length){if(er(e))return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l={};for(let[n,r]of Object.entries(e))t.some(e=>e===n||e.startsWith(`${n}.`)||e.startsWith(`${n}[`))&&(l[n]=r);return l}}}function eo(e){if(!e)return;let t=String(e).match(/^([^.[]+)/);return null==t?void 0:t[1]}function ea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!Array.isArray(e)||0===e.length)return{generatedAppends:void 0,generatedFields:void 0};let t=new Set,l=new Set,n=e=>{if(!e)return"";let t=String(e);return(t=(t=(t=t.replace(/\[(?:\d+)\]/g,"")).replace(/\[(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)')\]/g,(e,t,l)=>`.${t||l}`)).replace(/\.\.+/g,".")).replace(/^\./,"").replace(/\.$/,"")};for(let r of e){if(!r)continue;for(;/^\[(\d+)\](\.|$)/.test(r);)r=r.replace(/^\[(\d+)\]\.?/,"");let e=n(r);if(!e)continue;let i=e.split(".").filter(Boolean);if(0!==i.length){if(1===i.length){l.add(i[0]);continue}for(let e=0;e<i.length-1;e++)t.add(i.slice(0,e+1).join("."));l.add(i.join("."))}}return{generatedAppends:t.size?Array.from(t):void 0,generatedFields:l.size?Array.from(l):void 0}}var es=new WeakMap,ed=new WeakSet,eu=new WeakSet,ec=new WeakSet,ep=new WeakSet,eh=new WeakSet,em=new WeakSet,ef=new WeakSet,eg=new WeakSet;class ev{createProxy(){return(0,n._)(this,es)||(0,i._)(this,es,new Proxy(this,{get:(e,t,l)=>{if("string"==typeof t){if(Reflect.has(e,t)){let n=Reflect.get(e,t,l);return"function"==typeof n?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e._props,t))return e._getOwnProperty(t,this.createProxy());if(Object.prototype.hasOwnProperty.call(e._methods,t))return e._getOwnMethod(t,this.createProxy());let n=this._findInDelegates(e._delegates,t);return void 0!==n?n.result:void 0}return Reflect.get(e,t,l)},has:(e,t)=>!!("string"==typeof t&&(Reflect.has(e,t)||Object.prototype.hasOwnProperty.call(e._props,t)||Object.prototype.hasOwnProperty.call(e._methods,t)||this._hasInDelegates(e._delegates,t)))||Reflect.has(e,t)})),(0,n._)(this,es)}defineProperty(e,t){var l;if(this._props[e]&&(null==(l=this._props[e])?void 0:l.once))return;let n=this._props[e];(null==n?void 0:n.meta)&&this._clearMetaNodeCacheFor(n.meta),this._props[e]=t,delete this._observableCache[e],delete this._cache[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:()=>this._getOwnProperty(e,this.createProxy())})}defineMethod(e,t,l){this._methods[e]=t,"string"==typeof l?this._methodInfos[e]={description:l}:l&&"object"==typeof l?this._methodInfos[e]=l:delete this._methodInfos[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!1,writable:!1,value:t.bind(this.createProxy())})}removeCache(e){if(e in this._observableCache)return delete this._observableCache[e],!0;if(e in this._cache)return delete this._cache[e],!0;if(e in this._pending)return delete this._pending[e],!0;for(let t of this._delegates)if(t.removeCache(e))return!0}delegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)?console.warn(`[FlowContext] delegate - skip duplicate delegate: ${this._delegates.length}`):this._delegates.unshift(e)}addDelegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)||this._delegates.unshift(e)}clearDelegates(){this._delegates=[],this._metaNodeCache=new WeakMap}removeDelegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");let t=this._delegates.indexOf(e);-1!==t&&this._delegates.splice(t,1)}_clearMetaNodeCacheFor(e){this._metaNodeCache.delete(e)}has(e){return!!this._props[e]}getPropertyMetaTree(e,t){let l=this._getPropertiesMeta();if(e){let l=(0,P.YB)(e);if(l&&l.length>0){let e=async(e,t,l)=>{try{let l="function"==typeof e?await e():e;if(!(null==l?void 0:l.properties))return[];let n=l.properties;if("function"==typeof n){let e=await n();l.properties=e,n=e}let r=(0,o._)(this,ed,ey).call(this,n,t,[],l);return Array.isArray(r)?r:await r()}catch(e){return console.warn(`Failed to load meta for ${l}:`,e),[]}},n=(0,o._)(this,eu,eb).call(this,l);if(n){let[r,i,a]=n;if(1===l.length){if("function"==typeof i)return()=>e(i,a,r);if(i.properties){if("function"==typeof i.properties)return()=>e(i,a,r);let t=(0,o._)(this,ed,ey).call(this,i.properties,a,[],i);return Array.isArray(t)?t:[]}return[]}if("function"==typeof i){if(null==t?void 0:t.flatten)return()=>e(i,a,r);let l=(0,o._)(this,ef,eM).call(this,a);return[(0,o._)(this,eg,eA).call(this,r,i,a,l)]}if(i.properties){let e=[...(0,o._)(this,ef,eM).call(this,a),i.title],t=(0,o._)(this,ed,ey).call(this,i.properties,a,e,i);return Array.isArray(t)?t:[]}}return[]}if(null===l)return console.warn(`[FlowContext] getPropertyMetaTree - unsupported value format: "${e}". Only "{{ ctx.propertyName }}" format is supported. Returning empty meta tree.`),[]}return Object.entries(l).sort((e,t)=>{let[,l]=e,[,n]=t,r=("function"==typeof l?l.sort:null==l?void 0:l.sort)??0;return(("function"==typeof n?n.sort:null==n?void 0:n.sort)??0)-r}).map(e=>{let[t,l]=e;return(0,o._)(this,eg,eA).call(this,t,l,[t],[])})}async getApiInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.version||"v1",l=!!e.includeCompletion,n=this.createProxy(),r=e=>"string"==typeof e&&e.startsWith("_"),i=e=>"record"===e||"formValues"===e||"popup"===e,o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=(()=>{var e,l,n,r,i,o,a,s;let d=(0,_.B)(this),u=_.F.resolve(t,d)||_.F.resolve(t,"*");if(!u)return{};let c=(null==(n=this)||null==(l=n.api)||null==(e=l.auth)?void 0:e.locale)||(null==(i=this)||null==(r=i.i18n)?void 0:r.language)||(null==(o=this)?void 0:o.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})(),s=eB(null==a?void 0:a.methods)?a.methods:{},d=eB(null==a?void 0:a.properties)?a.properties:{},u=e=>"string"==typeof e?{description:e}:eB(e)?e:void 0,c=(e,t)=>{let l="string"==typeof t?t:eB(t)&&"string"==typeof t.description?String(t.description):void 0;return l&&l.includes(`ctx.libs.${e}`)?`libs.${e}`:e},p=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},h=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["title","type","interface","description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},m=e=>{let t=new WeakSet,l=n=>{if(!n||"object"!=typeof n||t.has(n))return;if(t.add(n),Object.prototype.hasOwnProperty.call(n._methodInfos||{},e)){var r;return null==(r=n._methodInfos)?void 0:r[e]}let i=n._delegates;if(Array.isArray(i))for(let e of i){let t=l(e);if(t)return t}};return l(this)},f=async e=>{let t=this.getPropertyOptions(e);if(null==t?void 0:t.info)try{let e="function"==typeof t.info?t.info.call(n,n):t.info;return(o(e)?await e:e)??void 0}catch(e){return}},g=new Set,v=new Set;for(let e of Object.keys(d))g.add(e);for(let e of Object.keys(s))v.add(e);let y=(e,t)=>{if(e&&"object"==typeof e&&!t.has(e)){t.add(e);try{let t=e._props;if(t&&"object"==typeof t)for(let[e,l]of Object.entries(t))(null==l?void 0:l.info)&&g.add(e)}catch(e){}try{let t=e._methodInfos;if(t&&"object"==typeof t)for(let e of Object.keys(t))v.add(e)}catch(e){}try{let l=e._delegates;if(Array.isArray(l))for(let e of l)y(e,t)}catch(e){}}};y(this,new WeakSet);let b={};for(let e of g){if(r(e)||i(e))continue;let t=d[e],n=await f(e);if(void 0===t&&void 0===n)continue;let o=u(t),a=u(n),s={};if(s={...s={...s,...h(o)},...h(a)},delete s.properties,l||delete s.completion,!Object.keys(s).length)continue;let p=c(e,t);b[p]=b[p]?{...b[p]||{},...s||{}}:s}for(let e of v){if(r(e))continue;let t=s[e],n=m(e);if(void 0===t&&void 0===n)continue;let i=u(t),o={};o={...o={...o,...p(i)},...p(n)},delete o.properties,l||delete o.completion,Object.keys(o).length&&(o.type="function",b[e]?b[e]={...b[e]||{},...o||{}}:b[e]=o)}let x=u(d.libs),w=eB(null==x?void 0:x.properties)?x.properties:void 0;if(w)for(let[e,t]of Object.entries(w)){if(r(e))continue;let n=`libs.${e}`;if(b[n])continue;let i=u(t),o={};o={...o,...h(i)},delete o.properties,l||delete o.completion,o.description&&String(o.description).trim()&&(b[n]=o)}return b}async getEnvInfos(){var e,t,l;let n=this.createProxy(),r=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,i={},o=e=>{try{return e()}catch(e){return}},a=e=>null!=e&&("string"==typeof e?e.trim().length>0:!Array.isArray(e)||e.length>0),s=e=>{var t,l,n,r,i;let o={};if(!e)return o;let s=e;for(let e of["dataSourceKey","collectionName","associationName","filterByTk","sourceId"]){let t=null==s?void 0:s[e];a(t)&&(o[e]=t)}if(!("dataSourceKey"in o)){let e=null==(t=s.getDataSourceKey)?void 0:t.call(s);a(e)&&(o.dataSourceKey=e)}if(!("filterByTk"in o)){let e=null==(l=s.getFilterByTk)?void 0:l.call(s);a(e)&&(o.filterByTk=e)}if(!("filterByTk"in o)){let e=null==(n=s.getMeta)?void 0:n.call(s,"currentFilterByTk");a(e)&&(o.filterByTk=e)}if(!("sourceId"in o)){let e=null==(r=s.getSourceId)?void 0:r.call(s);a(e)&&(o.sourceId=e)}if(!("collectionName"in o)||!("associationName"in o)){let e=null==(i=s.getResourceName)?void 0:i.call(s),t="string"==typeof e?e.trim():"";if(t){let e=t.split(".").map(e=>e.trim()).filter(Boolean);1===e.length?"collectionName"in o||(o.collectionName=e[0]):e.length>=2&&("collectionName"in o||(o.collectionName=e[0]),"associationName"in o||(o.associationName=e.slice(1).join(".")))}}return o},d=await (async()=>{try{let e=n.popup;return r(e)?await e:e}catch(e){return}})(),u=o(()=>n.model),c=o(()=>n.blockModel),p=o(()=>{var e;return null==(e=n.view)?void 0:e.inputArgs}),h=o(()=>n.resource),m=s(null==d?void 0:d.resource),f=c,g=c?"ctx.blockModel":void 0,v=g?`${g}.resource`:void 0,y=s(null==f?void 0:f.resource),b=s(p),x=s(h),w=e=>{for(let t of e)if(a(t.value))return{value:t.value,getVar:t.getVar}},S=e=>a(e.collectionName)||a(e.dataSourceKey)||a(e.associationName),M=S(m)?"ctx.popup.resource":S(y)?v:S(b)?"ctx.view.inputArgs":S(x)?"ctx.resource":void 0,A=w([{value:null==m?void 0:m.collectionName,getVar:"ctx.popup.resource.collectionName"},{value:null==y?void 0:y.collectionName,getVar:`${v}.collectionName`},{value:null==b?void 0:b.collectionName,getVar:"ctx.view.inputArgs.collectionName"},{value:null==x?void 0:x.collectionName,getVar:"ctx.resource.collectionName"}]),F=w([{value:null==m?void 0:m.dataSourceKey,getVar:"ctx.popup.resource.dataSourceKey"},{value:null==y?void 0:y.dataSourceKey,getVar:`${v}.dataSourceKey`},{value:null==b?void 0:b.dataSourceKey,getVar:"ctx.view.inputArgs.dataSourceKey"},{value:null==x?void 0:x.dataSourceKey,getVar:"ctx.resource.dataSourceKey"}]),k=w([{value:null==m?void 0:m.associationName,getVar:"ctx.popup.resource.associationName"},{value:null==y?void 0:y.associationName,getVar:`${v}.associationName`},{value:null==b?void 0:b.associationName,getVar:"ctx.view.inputArgs.associationName"},{value:null==x?void 0:x.associationName,getVar:"ctx.resource.associationName"}]),C=w([{value:null==m?void 0:m.filterByTk,getVar:"ctx.popup.resource.filterByTk"},{value:null==y?void 0:y.filterByTk,getVar:`${v}.filterByTk`},{value:null==b?void 0:b.filterByTk,getVar:"ctx.view.inputArgs.filterByTk"},{value:null==x?void 0:x.filterByTk,getVar:"ctx.resource.filterByTk"}]),P=w([{value:null==m?void 0:m.sourceId,getVar:"ctx.popup.resource.sourceId"},{value:null==y?void 0:y.sourceId,getVar:`${v}.sourceId`},{value:null==b?void 0:b.sourceId,getVar:"ctx.view.inputArgs.sourceId"},{value:null==x?void 0:x.sourceId,getVar:"ctx.resource.sourceId"}]),j={},E=!1,R=null==A?void 0:A.value;a(R)&&(j.collectionName={description:"Collection name",getVar:(null==A?void 0:A.getVar)||(M?`${M}.collectionName`:void 0),value:R},E=!0);let I=null==F?void 0:F.value;a(I)&&(j.dataSourceKey={description:"Data source key",getVar:(null==F?void 0:F.getVar)||(M?`${M}.dataSourceKey`:void 0),value:I},E=!0);let T=null==k?void 0:k.value;a(T)&&(j.associationName={description:"Association name",getVar:(null==k?void 0:k.getVar)||(M?`${M}.associationName`:void 0),value:T},E=!0),E&&(a(null==C?void 0:C.value)&&(j.filterByTk={description:"Record filterByTk",getVar:(null==C?void 0:C.getVar)||(M?`${M}.filterByTk`:void 0)}),a(null==P?void 0:P.value)&&(j.sourceId={description:"Source record ID (sourceId)",getVar:(null==P?void 0:P.getVar)||(M?`${M}.sourceId`:void 0)}),i.resource={description:"Resource information",getVar:M,properties:j}),a(null==C?void 0:C.value)&&(i.record={description:"Current record",getVar:"ctx.record"});let _=e=>{try{let t=null==e?void 0:e.title;if("string"==typeof t&&t.trim())return t}catch(e){}try{var t,l;let n=null==e||null==(l=e.constructor)||null==(t=l.meta)?void 0:t.label;if("string"==typeof n&&n.trim())return n}catch(e){}};if(u){let t=_(u),l=u.uid,n=null==(e=u.constructor)?void 0:e.name,r=s(u.resource),o={},d=!1,c=r.collectionName;a(c)&&(o.collectionName={description:"Collection name",getVar:"ctx.model.resource.collectionName",value:c},d=!0);let p=r.dataSourceKey;a(p)&&(o.dataSourceKey={description:"Data source key",getVar:"ctx.model.resource.dataSourceKey",value:p},d=!0);let h=r.associationName;a(h)&&(o.associationName={description:"Association name",getVar:"ctx.model.resource.associationName",value:h},d=!0),i.flowModel={description:"Current FlowModel information",getVar:"ctx.model",properties:{...a(t)?{label:{description:"Flow model label",value:t}}:{},...a(n)?{modelClass:{description:"Flow model class name",value:n}}:{},...a(l)?{uid:{description:"Flow model uid",getVar:"ctx.model.uid",value:l}}:{},...d?{resource:{description:"Flow model resource",getVar:"ctx.model.resource",properties:o}}:{}}}}if((null==d?void 0:d.uid)&&(i.popup={description:"Current popup information",getVar:"ctx.popup",properties:{uid:{description:"Popup uid",getVar:"ctx.popup.uid",value:d.uid},...(null==d?void 0:d.record)?{record:{description:"Popup record",getVar:"ctx.popup.record"}}:{},...(null==d?void 0:d.sourceRecord)?{sourceRecord:{description:"Popup source record",getVar:"ctx.popup.sourceRecord"}}:{}}}),f){let e=_(f),l=f.uid,n=null==(t=f.constructor)?void 0:t.name,r={},o=!1,s=y.collectionName;a(s)&&(r.collectionName={description:"Collection name",getVar:`${v}.collectionName`,value:s},o=!0);let d=y.dataSourceKey;a(d)&&(r.dataSourceKey={description:"Data source key",getVar:`${v}.dataSourceKey`,value:d},o=!0);let u=y.associationName;a(u)&&(r.associationName={description:"Association name",getVar:`${v}.associationName`,value:u},o=!0),i.block={description:"Current block information",getVar:g,properties:{...a(e)?{label:{description:"Block label",value:e}}:{},...a(n)?{modelClass:{description:"Block model class name",value:n}}:{},...a(l)?{uid:{description:"Block uid",getVar:`${g}.uid`,value:l}}:{},...o?{resource:{description:"Block resource",getVar:v,properties:r}}:{}}}}let D=(()=>{let e=null==d?void 0:d.uid;if(a(e))return String(e).trim();let t=null==p?void 0:p.viewUid;if(a(t))return String(t).trim()})(),N=o(()=>n.engine),O=D?null==N?void 0:N.getModel(D,!0):void 0,$=e=>{var t;return(null==(t=e.context)?void 0:t.blockModel)===e};if(O){let e=[O],t=[];for(let n=0;n<e.length;n++){let r=e[n];if($(r)){let e=(null==(l=r.constructor)?void 0:l.name)||r.uid,n=_(r)||e||r.uid,i=s(r.resource),o={};a(i.dataSourceKey)&&(o.dataSourceKey=i.dataSourceKey),a(i.collectionName)&&(o.collectionName=i.collectionName),a(i.associationName)&&(o.associationName=i.associationName);let d={uid:r.uid,label:n,modelClass:e,...Object.keys(o).length>0?{resource:o}:{}};t.push(d)}let i=r.subModels;if(i&&"object"==typeof i)for(let t of Object.values(i))t&&(Array.isArray(t)?e.push(...t):e.push(t))}t.length&&(i.currentViewBlocks={description:"Current view blocks",value:t})}return i}async getVarInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxDepth??3,l=Number.isFinite(t)?Math.max(1,Math.floor(t)):3,n="v1",r=this.createProxy(),i=e=>"string"==typeof e&&e.startsWith("_"),o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=new WeakMap,s=async e=>{if(!e)return;if("function"!=typeof e)return e;let t=a.get(e);return t||(t=(async()=>{let t=e.call(r,r);return(o(t)?await t:t)||null})(),a.set(e,t)),await t||void 0},d=e=>{if("string"!=typeof e)return;let t=e.trim();if(!t)return;let l=(0,P.YB)(t);return Array.isArray(l)&&l.length>0?l.join("."):"ctx"===t?"":t.startsWith("ctx.")?t.slice(4).trim():t},u=(()=>{let t=e.path;return("string"==typeof t?[t]:Array.isArray(t)?t:[]).map(e=>d(String(e))).filter(e=>"string"==typeof e&&e.length>0)})(),c=(()=>{let t=e.path;return"string"==typeof t?""===d(t):!!Array.isArray(t)&&t.some(e=>""===d(String(e)))})(),p=(()=>{var e,t,l,r,i,o,a,s;let d=(0,_.B)(this),u=_.F.resolve(n,d)||_.F.resolve(n,"*");if(!u)return{};let c=(null==(l=this)||null==(t=l.api)||null==(e=t.auth)?void 0:e.locale)||(null==(i=this)||null==(r=i.i18n)?void 0:r.language)||(null==(o=this)?void 0:o.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})();eB(null==p?void 0:p.methods)&&p.methods,eB(null==p?void 0:p.properties)&&p.properties;let h=e=>"string"==typeof e?{description:e}:eB(e)?e:void 0,m=async(e,t)=>{if(void 0!==e){if("boolean"==typeof e)return e;if("function"==typeof e)try{let l=t(e);return o(l)?!!await l:!!l}catch(e){return!1}return!!e}},f=async(e,t)=>{if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)try{let l=t(e),n=o(l)?await l:l;if("string"==typeof n)return n;return null==n?void 0:String(n)}catch(e){return}return String(e)}},g=async e=>{let t=!1,l=[];try{if("boolean"==typeof e)t=e;else if(Array.isArray(e))l=e;else if("function"==typeof e){let n=e(r),i=o(n)?await n:n;"boolean"==typeof i?t=i:Array.isArray(i)&&(l=i)}}catch(e){t=!1,l=[]}let n=[];if(Array.isArray(l))for(let e of l){if("string"!=typeof e)continue;let t=e.trim();!(!t||"ctx"===t||t.startsWith("ctx."))&&(/\s/.test(t)||n.push(t))}return{hideSelf:!!t,hideSubpaths:n}},v=(e,t)=>{if(!e)return!1;let l=e.split(".").filter(Boolean);for(;l.length;){if(t.has(l.join(".")))return!0;l.pop()}return!1},y=e=>{let t=h(e);if(!t)return{};let l={};for(let e of["title","type","interface","description","examples","completion","ref","params","returns"]){let n=t[e];void 0!==n&&(l[e]=n)}return Array.isArray(l.examples)&&(l.examples=l.examples.filter(e=>"string"==typeof e&&e.trim())),l},b=async e=>{let t,n,{docNode:o,metaNode:a,infoNode:d,depth:u,pathFromRoot:c,hiddenPrefixes:p}=e,x=c.join(".");if(v(x,p))return;let w=h(o),S=h(d),M=await g(null==w?void 0:w.hidden);if(M.hideSelf)return;let A=await g(null==S?void 0:S.hidden);if(A.hideSelf)return;let F=await s(a);if(await m(null==F?void 0:F.hidden,e=>e.call(F,r)))return;let k=new Set(p);for(let e of[...M.hideSubpaths,...A.hideSubpaths]){let t=e.trim();if(!t)continue;let l="ctx"===t?"":t.startsWith("ctx.")?t.slice(4):t;if(!l)continue;let n=x?`${x}.${l}`:l;k.add(n)}let C=await m(null==w?void 0:w.disabled,e=>e(r)),P=await f(null==w?void 0:w.disabledReason,e=>e(r)),j=await m(null==F?void 0:F.disabled,e=>e.call(F,r)),E=await f(null==F?void 0:F.disabledReason,e=>e.call(F,r)),R=await m(null==S?void 0:S.disabled,e=>e(r)),I=await f(null==S?void 0:S.disabledReason,e=>e(r)),T=void 0!==R?R:void 0!==j?j:C,_=void 0!==I?I:void 0!==E?E:P,D={};if(D={...D={...D={...D,...y(w)},...y(F)},...y(S)},void 0!==T&&(D.disabled=!!T),void 0!==_&&(D.disabledReason=_),u>=l)return Object.keys(D).length?D:void 0;let N=eB(null==w?void 0:w.properties)?w.properties:void 0;if(null==F?void 0:F.properties)try{let e=F.properties;if("function"==typeof e){let l=await e.call(F,r);F.properties=l,t=l}else eB(e)&&(t=e)}catch(e){t=void 0}if(eB(S)&&(null==S?void 0:S.properties))try{let e=S.properties;if("function"==typeof e){let t=await e.call(S,r);S.properties=t,n=t}else eB(e)&&(n=e)}catch(e){n=void 0}let O=new Set;if(N)for(let e of Object.keys(N))O.add(e);if(t)for(let e of Object.keys(t))O.add(e);if(n)for(let e of Object.keys(n))O.add(e);if(!O.size)return Object.keys(D).length?D:void 0;let $={};for(let e of O){if(i(e))continue;let l=await b({docNode:null==N?void 0:N[e],metaNode:null==t?void 0:t[e],infoNode:null==n?void 0:n[e],depth:u+1,pathFromRoot:[...c,e],hiddenPrefixes:k});l&&($[e]=l)}if(Object.keys($).length&&(D.properties=$),Object.keys(D).length)return D},x=async e=>{if(!e.length)return;let[t,...l]=e,n=this.getPropertyOptions(t);if(null==n?void 0:n.meta)try{if(!l.length)return n.meta;let e=await s(n.meta);if(!e)return;for(let t=0;t<l.length;t++){let n=l[t],i=null==e?void 0:e.properties;if(!i)break;if("function"==typeof i){let t=await i.call(e,r);e.properties=t,i=t}if(!i||"object"!=typeof i)break;let o=null==i?void 0:i[n];if(!o)break;if(t===l.length-1)return o;let a=await s(o);if(!a)break;e=a}return}catch(e){return}};if(!c&&u.length){let e={};for(let t of u){let l=t.split(".").map(e=>e.trim()).filter(Boolean);if(l.some(e=>i(e))||!l.length)continue;let n=await x(l),r=await b({docNode:void 0,metaNode:n,infoNode:void 0,depth:1,pathFromRoot:[],hiddenPrefixes:new Set});r&&(e[t]=r)}return e}let w=this._getPropertiesMeta(),S={};for(let[e,t]of Object.entries(w)){if(i(e))continue;let l=await b({docNode:void 0,metaNode:t,infoNode:void 0,depth:1,pathFromRoot:[e],hiddenPrefixes:new Set});l&&(S[e]=l)}return S}_getPropertiesMeta(){let e={};for(let t of this._delegates)Object.assign(e,t._getPropertiesMeta());for(let[t,l]of Object.entries(this._props))l.meta&&(e[t]=(l.meta,l.meta));return e}_getOwnProperty(e,t){let l=this._props[e];if(l){if("value"in l)return"api"===e?(0,I.k)(l.value,t):l.value;if(l.get){if(!1===l.cache){let n=l.get(t);return"api"===e?(0,I.k)(n,t):n}let n=l.observable?"_observableCache":"_cache";if(e in this[n])return"api"===e?(0,I.k)(this[n][e],t):this[n][e];if(this._pending[e])return this._pending[e];let r=l.get(this.createProxy());return"object"==typeof r&&null!==r&&"function"==typeof r.then||"function"==typeof r&&"function"==typeof r.then?(this._pending[e]=r.then(l=>(this[n][e]=l,delete this._pending[e],"api"===e?(0,I.k)(l,t):l),t=>{throw delete this._pending[e],t}),this._pending[e]):(this[n][e]=r,"api"===e?(0,I.k)(r,t):r)}}}_getOwnMethod(e,t){let l=this._methods[e];return"function"==typeof l?l.bind(t):l}_findPropertyInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return l._props[t];let e=this._findPropertyInDelegates(l._delegates,t);if(void 0!==e)return e}}_findInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return{result:l._getOwnProperty(t,this.createProxy())};if(Object.prototype.hasOwnProperty.call(l._methods,t))return{result:l._getOwnMethod(t,this.createProxy())};let e=this._findInDelegates(l._delegates,t);if(void 0!==e)return e}}_hasInDelegates(e,t){for(let l of e)if(Object.prototype.hasOwnProperty.call(l._props,t)||Object.prototype.hasOwnProperty.call(l._methods,t)||this._hasInDelegates(l._delegates,t))return!0;return!1}getPropertyOptions(e){return Object.prototype.hasOwnProperty.call(this._props,e)?this._props[e]:this._findPropertyInDelegates(this._delegates,e)}constructor(){return(0,a._)(this,ed),(0,a._)(this,eu),(0,a._)(this,ec),(0,a._)(this,ep),(0,a._)(this,eh),(0,a._)(this,em),(0,a._)(this,ef),(0,a._)(this,eg),(0,s._)(this,"_props",{}),(0,s._)(this,"_methods",{}),(0,s._)(this,"_methodInfos",{}),(0,s._)(this,"_cache",{}),(0,s._)(this,"_observableCache",d.observable.shallow({})),(0,s._)(this,"_delegates",[]),(0,s._)(this,"_pending",{}),(0,r._)(this,es,{writable:!0,value:null}),(0,s._)(this,"_metaNodeCache",new WeakMap),this.createProxy()}}function ey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0;return"function"==typeof e?async()=>{let r=await e();n&&(n.properties=r);let i=Object.entries(r);return i.sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}),i.map(e=>{let[n,r]=e;return(0,o._)(this,eg,eA).call(this,n,r,[...t,n],l)})}:Object.entries(e).sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}).map(e=>{let[n,r]=e;return(0,o._)(this,eg,eA).call(this,n,r,[...t,n],l)})}function eb(e){if(0===e.length)return null;let[t,...l]=e,n=this._props[t];if(null==n?void 0:n.meta)return(0,o._)(this,ep,ew).call(this,t,n.meta,l,[t]);let r=(0,o._)(this,ec,ex).call(this,this._delegates,t);return r?(0,o._)(this,ep,ew).call(this,t,r,l,[t]):null}function ex(e,t){for(let l of e){let e=l._props[t];if(null==e?void 0:e.meta)return e.meta;let n=(0,o._)(this,ec,ex).call(this,l._delegates,t);if(n)return n}return null}function ew(e,t,l,n){if(0===l.length)return[e,t,n];if("function"==typeof t)return[l[l.length-1],async()=>{let e=await t();return await (0,o._)(this,em,eS).call(this,e,l)},[...n,...l]];if(t.properties){let[e,...r]=l,i=[...n,e];if("function"==typeof t.properties)return[l[l.length-1],async()=>{let l=t.properties,n=await l();t.properties=n;let i=n[e];if(!i)throw Error(`Property ${e} not found in resolved properties`);return await (0,o._)(this,em,eS).call(this,i,r)},[...n,...l]];let a=t.properties[e];if(a)return(0,o._)(this,ep,ew).call(this,e,a,r,i)}return null}async function eS(e,t){if(0===t.length)return e;let l=e;for(let e of t){let n=h().get(l,"properties");if(!n)throw Error(`Property path not found: ${t.join(".")}`);if("function"==typeof n){let e=await n();l.properties=e,n=e}let r=n[e];if(!r)throw Error(`Property ${e} not found while resolving path: ${t.join(".")}`);l=r}return l}function eM(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(0===e.length)return[];let l=t?e.slice(0,-1):e;if(0===l.length)return[];let n=[],r=this._getPropertiesMeta();for(let e=0;e<l.length;e++){let t=l[e],i=r[t];if(!i||"function"==typeof i){n.push(t);break}if(n.push(i.title||t),e<l.length-1&&i.properties&&"function"!=typeof i.properties)r=i.properties;else if(e<l.length-1){for(let t=e+1;t<l.length;t++)n.push(l[t]);break}}return n}function eA(e,t){let l,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[e],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=this._metaNodeCache.get(t);if(i)return i.paths=n,i.parentTitles=r.length>0?r:void 0,i;let a=e=>{if(!e)return{disabled:!1,hidden:!1};let t="function"==typeof e.disabled?e.disabled():e.disabled,l="function"==typeof e.disabledReason?e.disabledReason():e.disabledReason,n="function"==typeof e.hidden?e.hidden():e.hidden;return{disabled:!(t&&"function"==typeof t.then)&&!!t,reason:l&&"function"==typeof l.then?void 0:l,hidden:!(n&&"function"==typeof n.then)&&!!n}};if("function"==typeof t){let i=e,s=t.hasChildren;l={name:e,title:t.title||i,type:"object",interface:void 0,options:void 0,uiSchema:void 0,paths:n,parentTitles:r.length>0?r:void 0,disabled:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).disabled},disabledReason:()=>{let e=t();if(!e||"function"!=typeof e.then)return a(e).reason},hidden:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).hidden},children:!1===s?void 0:async()=>{try{let i=await t(),a=(null==i?void 0:i.title)||e;if(l.title=a,l.type=null==i?void 0:i.type,l.interface=null==i?void 0:i.interface,l.options=null==i?void 0:i.options,l.uiSchema=null==i?void 0:i.uiSchema,!(null==i?void 0:i.properties))return[];let s=(0,o._)(this,ed,ey).call(this,i.properties,n,[...r,a],i),d=Array.isArray(s)?s:await s();return l.children=d,d}catch(t){return console.warn(`Failed to load meta for ${e}:`,t),[]}}}}else{let i=t.title,{disabled:s,reason:d,hidden:u}=a(t);l={name:e,title:i,type:t.type,interface:t.interface,options:t.options,uiSchema:t.uiSchema,paths:n,parentTitles:r.length>0?r:void 0,disabled:s,disabledReason:d,hidden:u,children:t.properties?(0,o._)(this,ed,ey).call(this,t.properties,n,[...r,i],t):void 0}}return this._metaNodeCache.set(t,l),l}class eF extends ev{constructor(){super(),this.defineMethod("getModel",(e,t)=>this.engine.getModel(e,t)),this.defineMethod("request",function(e){let t=this.app;return"string"==typeof(null==e?void 0:e.url)&&en(e.url,t)?u.A.request(e):this.api.request(e)}),this.defineMethod("runjs",async function(e,t,l){let{preprocessTemplates:n,...r}=l||{},i={...(null==r?void 0:r.globals)||{},...t||{}},o=await this.createJSRunner({...r||{},globals:i}),a=(0,k.R)({version:null==r?void 0:r.version,preprocessTemplates:n}),s=await (0,P.ji)(String(e??""),{preprocessTemplates:a});return o.run(s)},{description:"Execute a RunJS code string in the current Flow context.",detail:"(code: string, variables?: Record<string, any>, options?: JSRunnerOptions) => Promise<RunJSResult>",params:[{name:"code",type:"string",description:"RunJS code to execute."},{name:"variables",type:"Record<string, any>",optional:!0,description:"Additional globals."},{name:"options",type:"JSRunnerOptions",optional:!0,description:"Runner options."}],returns:{type:"Promise<{ success: boolean; value?: any; error?: any; timeout?: boolean }>"},completion:{insertText:"await ctx.runjs('return 1')"}})}}class ek extends eF{}let eC=["dataSourceKey","collectionName","associationName","filterByTk","sourceId","tabUid"];function eP(e,t){let l={};for(let n of t)void 0!==(null==e?void 0:e[n])&&(l[n]=e[n]);return l}function ej(e){return eP(e,eC)}function eE(e,t){for(let[l,n]of Object.entries(t))void 0===e[l]&&(e[l]=n)}class eR extends eF{constructor(e){if(!(e instanceof A.$))throw Error("Invalid FlowEngine instance");super(),(0,s._)(this,"engine",void 0),this.engine=e,this.engine=e;let t=new M.zA;t.setFlowEngine(this.engine);let n=new M.qS({key:"main",displayName:"Main"});t.addDataSource(n),this.defineProperty("engine",{value:this.engine,info:{description:"FlowEngine instance.",detail:"FlowEngine"}}),this.defineProperty("sql",{get:e=>new C.tP(e),cache:!1,info:{description:"SQL helper (FlowSQLRepository).",detail:"FlowSQLRepository"}}),this.defineProperty("dataSourceManager",{value:t,info:{description:"DataSourceManager instance.",detail:"DataSourceManager"}});let r=new F(this);this.defineMethod("t",(e,t)=>r.translate(e,t)),this.defineProperty("locale",{get:()=>{var e,t,l;return(null==(t=this.api)||null==(e=t.auth)?void 0:e.locale)||(null==(l=this.i18n)?void 0:l.language)},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current language"),sort:970}),{title:(0,P.MI)("Current language"),sort:970,hasChildren:!1})}),this.defineMethod("renderJson",function(e){return this.resolveJsonTemplate(e)}),this.defineMethod("resolveJsonTemplate",async function(e){let t=(0,P.nN)(e),l=Object.keys(t||{});if(!l.length)return(0,P.M)(e,this);let n={};for(let e of l){let l=t[e]||[],r=this.getPropertyOptions(e),i=null==r?void 0:r.resolveOnServer;if(!0===i)n[e]=l;else if("function"==typeof i){let t=l.filter(e=>{try{return!!i(e)}catch(e){return!1}});t.length&&(n[e]=t)}}let r=Object.keys(n).length>0,i=e;if(r){let t=e=>{let t=(0,T.XU)(e);if(t)return t;try{var l,n,r,i,o,a,s,d,u,c,p,h,m;let t=null==e||null==(n=e.resource)||null==(l=n.getMeta)?void 0:l.call(n,"currentFilterByTk");if(null==t)return;let f=(null==e||null==(r=e.collection)?void 0:r.name)||(null==e||null==(c=e.resource)||null==(u=c.getResourceName)||null==(d=u.call(c))||null==(s=d.split)||null==(a=s.call(d,"."))||null==(o=a.slice)||null==(i=o.call(a,-1))?void 0:i[0]);if(!f)return;let g=(null==e||null==(p=e.collection)?void 0:p.dataSourceKey)||(null==e||null==(m=e.resource)||null==(h=m.getDataSourceKey)?void 0:h.call(m));return{collection:f,dataSourceKey:g,filterByTk:t}}catch(e){return}},l=async()=>{let e={};try{var t,l;let r=null==(t=(l=this)._getPropertiesMeta)?void 0:t.call(l);if(!r||"object"!=typeof r)return e;for(let[t,l]of Object.entries(r))if(n[t])try{let r;if("function"==typeof l){let e=l;r=await e()}else r=l;if(!r||"object"!=typeof r)continue;let i=r.buildVariablesParams;if("function"!=typeof i)continue;let o=await i(this);if(!o)continue;let a=n[t]||[],s=ei(o,a);s&&("object"!=typeof s||Object.keys(s).length)&&(e[t]=s)}catch(e){}}catch(e){}return e},r=await l(),d={...r},u=n.view||[];if(!d.view&&u.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let e=(0,T.Cg)(this);e&&(d.view={record:e})}try{let e="formValues",l=n[e]||[];if(l.length){let n=new Set;for(let e of l){let t=eo(e);t&&n.add(t)}let i=null==r?void 0:r[e],o=new Set;if(!i||"object"!=typeof i||Array.isArray(i)||er(i)||Object.keys(i).forEach(e=>o.add(e)),[...n].filter(e=>!o.has(e)).length){let n=t(this);if(n){let{generatedFields:t,generatedAppends:r}=ea(l),i={...n,fields:t,appends:r},o=d[e];if(o&&"object"==typeof o&&!Array.isArray(o)&&!er(o)){for(let[t,l]of Object.entries(o))d[`${e}.${t}`]=l;delete d[e]}d[e]=i}}}}catch(e){}let c=Object.keys(d).length?(0,R.d)(this,d):void 0;if(!c){let t=Object.keys(n);if(t.length>0&&t.every(e=>{var t;return null==(t=this.getPropertyOptions(e))?void 0:t.serverOnlyWhenContextParams}))return(0,P.M)(e,this)}if(this.api){var o,a,s;try{i=await (0,E.o4)(this,{rd:(0,E.pk)(this,null==(o=this.model)?void 0:o.uid),template:e,contextParams:c||{}})}catch(t){null==(s=this.logger)||null==(a=s.warn)||a.call(s,{err:t},"variables:resolve failed, fallback to client-only"),i=e}}}return(0,P.M)(i,this)}),this.defineMethod("getVar",async function(e){let t=("string"==typeof e?e:String(e??"")).trim();if(t){if("ctx"!==t&&!t.startsWith("ctx."))throw Error(`ctx.getVar(path) expects an expression starting with "ctx.", got: "${t}"`);return this.resolveJsonTemplate(`{{ ${t} }}`)}},'Resolve a ctx expression value by path (expression starts with "ctx.").'),this.defineProperty("requirejs",{get:()=>{var e,t;return null==(t=this.app)||null==(e=t.requirejs)?void 0:e.requirejs}}),this.defineProperty("token",{get:()=>{var e,t;return null==(t=this.api)||null==(e=t.auth)?void 0:e.token},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("API Token"),sort:980}),{title:"API Token",sort:980,hasChildren:!1})}),this.defineProperty("role",{get:()=>{var e,t,l;let n=null==(t=this.api)||null==(e=t.auth)?void 0:e.role;if("__union__"!==n)return n;let r=null==(l=this.user)?void 0:l.roles;return Array.isArray(r)?r.map(e=>null==e?void 0:e.name).filter(e=>!!e):[]},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current role"),sort:990}),{title:(0,P.MI)("Current role"),sort:990,hasChildren:!1})}),this.defineProperty("urlSearchParams",{cache:!1,get:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return f().parse(l)||{}},meta:Object.assign(()=>({type:"object",title:this.t("URL search params"),sort:970,disabled:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return 0===Object.keys(f().parse(l)||{}).length},disabledReason:()=>this.t("The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string."),properties:async()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t,n=f().parse(l)||{},r={};for(let e of Object.keys(n))r[e]={type:"string",title:e};return r}}),{title:(0,P.MI)("URL search params"),sort:970,hasChildren:!0})}),this.defineProperty("logger",{get:()=>this.engine.logger.child({module:"flow-engine"})}),this.defineProperty("auth",{get:()=>{var e,t,l,n,r,i;return{roleName:null==(t=this.api)||null==(e=t.auth)?void 0:e.role,locale:null==(n=this.api)||null==(l=n.auth)?void 0:l.locale,token:null==(i=this.api)||null==(r=i.auth)?void 0:r.token,user:this.user}},cache:!1}),this.defineProperty("date",{get:()=>{let e=t=>new Proxy({},{get:(l,n)=>{if("string"!=typeof n)return;let r=[...t,n];if(!(0,P.JE)(r))return;let i=(0,P.Vv)(r);return void 0!==i?i:e(r)}});return e(["date"])},cache:!1}),this.defineMethod("loadCSS",async e=>{let t=(0,P.i)(e);return new Promise((e,l)=>{if(document.querySelector(`link[href="${t}"]`))return void e(null);let n=document.createElement("link");n.rel="stylesheet",n.href=t,n.onload=()=>e(null),n.onerror=()=>l(Error(`Failed to load CSS: ${t}`)),document.head.appendChild(n)})},{description:"Load a CSS file by URL (browser only).",params:[{name:"href",type:"string",description:"CSS URL."}],returns:{type:"Promise<void>"},completion:{insertText:"await ctx.loadCSS('https://example.com/style.css')"},examples:["await ctx.loadCSS('https://example.com/style.css');"]}),this.defineMethod("requireAsync",async e=>{if((0,P.yp)(e))return this.loadCSS(e);let t=(0,P.i)(e,{raw:!0});return await Y(this.requirejs,t)}),this.defineMethod("importAsync",async function(e){return(0,P.yp)(e)?this.loadCSS(e):await et(this,e,{importer:G})}),this.defineMethod("createJSRunner",async function(e){try{let e=await Promise.resolve().then(l.bind(l,88828));"function"==typeof(null==e?void 0:e.setupRunJSContexts)&&await e.setupRunJSContexts()}catch(e){}let t=(null==e?void 0:e.version)||"v1",n=(0,_.B)(this),r=_.F.resolve(t,n)||eX,i=new r(this);i.defineMethod("t",(e,t)=>this.t(e,{ns:"runjs",...t}));let o={};try{var a,s,d,u,c,p,h,m;let e=(null==(d=this)||null==(s=d.api)||null==(a=s.auth)?void 0:a.locale)||(null==(c=this)||null==(u=c.i18n)?void 0:u.language)||(null==(p=this)?void 0:p.locale);o=(null==r||null==(h=r.getDoc)?void 0:h.length)?r.getDoc(e)||{}:(null==r||null==(m=r.getDoc)?void 0:m.call(r))||{}}catch(e){o={}}let f={ctx:eW(i,{doc:o}),...(null==e?void 0:e.globals)||{}},{timeoutMs:g}=e||{};return new k.I({globals:f,timeoutMs:g})}),this.defineMethod("buildServerContextParams",function(e){return(0,R.d)(this,e)}),this.defineMethod("getAction",function(e){return this.engine.getAction(e)}),this.defineMethod("getActions",function(){return this.engine.getActions()}),this.defineMethod("getEvents",function(){return this.engine.getEvents()}),this.defineMethod("runAction",async function(e,t){let l=this.engine.getAction(e),n=await (0,D.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let r={...await (0,P.gG)(l.defaultParams,n)||{},...t||{}},i=l.useRawParams;if("function"==typeof i&&(i=await i(n)),i||(r=await n.resolveJsonTemplate(r)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,r)}),this.defineProperty("acl",{get:()=>new x(this.engine)}),this.defineMethod("aclCheck",function(e){return!!this.skipAclCheck||this.acl.aclCheck(e)}),this.defineMethod("createResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("makeResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("initResource",function(e){return this.has("resource")||this.defineProperty("resource",{get:()=>this.createResource(e)}),this.resource}),this.defineMethod("useResource",function(e){return this.initResource(e)})}}class eI extends ek{constructor(e){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.addDelegate(e.flowEngine.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{value:e,info:{description:"Current FlowModel instance.",detail:"FlowModel"}});let t=(0,g.createRef)();this.defineProperty("ref",{get:()=>(this.model._refCreated=!0,t),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}}),this.defineMethod("openView",async function(e,t){var l,n,r,i;let o={..."function"==typeof(null==(l=this.model)?void 0:l.getInputArgs)?ej(this.model.getInputArgs()):{},...ej(this.inputArgs)},a={...t||{}};eE(a,o),(a.defineProperties||a.defineMethods)&&(a.navigation=!1);let s=null;(s=await this.engine.loadModel({uid:e}))||(s=this.engine.createModel({uid:e,use:"PopupActionModel",parentId:this.model.uid,subType:"object",subKey:e,stepParams:{popupSettings:{openView:{...eP(a,["dataSourceKey","collectionName","associationName","mode","size"])}}}}),await s.save()),s.setParent(this.model);let d=(null==a?void 0:a.routeViewUid)??(null==a?void 0:a.viewUid)??((null==(r=s.stepParams)||null==(n=r.popupSettings)?void 0:n.openView)?s.uid:this.model.uid),u=this.view,c={type:(null==a?void 0:a.isMobileLayout)?"embed":(null==a?void 0:a.mode)||"drawer",inputArgs:{...a,viewUid:d,navigation:a.navigation},navigation:null==u?void 0:u.navigation,preventClose:!!(null==a?void 0:a.preventClose),engineCtx:this.engine.context};s.context.defineProperty("view",{value:c});let p=null==(i=s.getFlow)?void 0:i.call(s,"popupSettings"),h=null==p?void 0:p.on,m="click";"string"==typeof h&&h?m=h:h&&"object"==typeof h&&"string"==typeof h.eventName&&h.eventName&&(m=h.eventName),await s.dispatchEvent(m,{...a})}),this.defineMethod("getEvents",function(){return this.model.getEvents()}),this.defineMethod("getAction",function(e){return this.model.getAction(e)}),this.defineMethod("getActions",function(){return this.model.getActions()}),this.defineMethod("runAction",async function(e,t){let l=this.model.getAction(e),n=await (0,D.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let r={...await (0,P.gG)(l.defaultParams,n)||{},...t||{}},i=l.useRawParams;if("function"==typeof i&&(i=await i(n)),i||(r=await n.resolveJsonTemplate(r)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,r)})}}class eT extends ek{constructor(e,t){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),(0,s._)(this,"master",void 0),(0,s._)(this,"fork",void 0),this.master=e,this.fork=t,this.addDelegate(this.master.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{get:()=>this.fork,info:{description:"Current ForkFlowModel instance (as model).",detail:"ForkFlowModel"}});let l=(0,g.createRef)();this.defineProperty("ref",{get:()=>(this.fork._refCreated=!0,l),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}})}}class e_ extends ek{_getOwnProperty(e){if("runtime"===this.mode)return super._getOwnProperty(e,this.createProxy());let t=this._props[e];if(t){if("value"in t)return S.create()[e];if(t.get){if(!1===t.cache)return S.create()[e];let l=t.observable?"_observableCache":"_cache";return e in this[l]||(this[l][e]=S.create()[e]),this[l][e]}}}exit(){throw new j.zz(this.flowKey,this.model.uid)}exitAll(){throw new j.zz(this.flowKey,this.model.uid)}get mode(){return this._mode}constructor(e,t,l="runtime"){super(),(0,s._)(this,"model",void 0),(0,s._)(this,"flowKey",void 0),(0,s._)(this,"_mode",void 0),(0,s._)(this,"stepResults",void 0),this.model=e,this.flowKey=t,this._mode=l,this.stepResults={},this.addDelegate(this.model.context),this.defineMethod("getStepParams",l=>e.getStepParams(t,l)||{}),this.defineMethod("setStepParams",(l,n)=>e.setStepParams(t,l,n)),this.defineMethod("getStepResults",e=>h().get(this.steps,[e,"result"])),this.defineMethod("initResource",t=>{e.context.has("resource")?console.log(`[FlowRuntimeContext] useResource - resource already defined in context: ${t}`):(e.context.defineProperty("resource",{get:()=>this.makeResource(t)}),e.resource||(e.resource=e.context.resource))}),this.defineMethod("useResource",e=>this.initResource(e)),this.defineProperty("resource",{get:()=>e.resource||e.context.resource,cache:!1}),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)})}}let eD=new WeakMap,eN=new WeakMap,eO=new WeakMap;function e$(e,t){if(null===t)return;if(Array.isArray(e)||Array.isArray(t)||"object"!=typeof e||"object"!=typeof t)return t??e;let l={...e};for(let n of Object.keys(t)){let r=e$(null==e?void 0:e[n],t[n]);void 0===r?delete l[n]:l[n]=r}return l}function eB(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eL(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function eq(e){return!0===e||(e&&eB(e)?e:void 0)}function eV(e,t,l){if(!Array.isArray(t)||!t.length)return;let n=e;for(let e of t){if(!e)return;n.children=n.children||{},n.children[e]=n.children[e]||{},n=n.children[e]}n.deprecated=l}function ez(e,t){void 0!==t.deprecated&&(e.deprecated=t.deprecated);let l=t.children||{},n=Object.keys(l);if(n.length)for(let t of(e.children=e.children||{},n))e.children[t]=e.children[t]||{},ez(e.children[t],l[t])}function eK(e){let t={};if(!e)return t;let l=(e,n)=>{if(eB(e))for(let[r,i]of Object.entries(e)){if(!r||!i||"object"!=typeof i||Array.isArray(i))continue;let e=i,o=eq(e.deprecated);o&&eV(t,[...n,r],o),eB(e.properties)&&l(e.properties,[...n,r])}},n=e=>{if(eB(e))for(let[l,n]of Object.entries(e)){if(!l||!n||"object"!=typeof n||Array.isArray(n))continue;let e=eq(n.deprecated);e&&eV(t,[l],e)}};return l(e.properties,[]),n(e.methods),t}function eU(e){let t={},l=new WeakSet,n=(e,l)=>{if(eB(l))for(let[r,i]of Object.entries(l)){if(!r||"string"==typeof i||!i||"object"!=typeof i||Array.isArray(i))continue;let l=i,o=eq(l.deprecated);o&&eV(t,[...e,r],o),eB(l.properties)&&n([...e,r],l.properties)}},r=e=>{if(!e||"object"!=typeof e&&"function"!=typeof e||l.has(e))return;l.add(e);let i=e._methodInfos;if(eB(i))for(let[e,l]of Object.entries(i)){if(!e||!l||"object"!=typeof l||Array.isArray(l))continue;let n=eq(l.deprecated);n&&eV(t,[e],n)}let o=e._props;if(eB(o))for(let[e,l]of Object.entries(o)){if(!e)continue;let r=null==l?void 0:l.info;if(!r||"object"!=typeof r||Array.isArray(r))continue;let i=eq(r.deprecated);i&&eV(t,[e],i),eB(r.properties)&&n([e],r.properties)}let a=e._delegates;if(Array.isArray(a))for(let e of a)r(e)};return r(e),t}function eW(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=eK(t.doc);ez(l,eU(e));let n=new Set,r=new WeakMap,i=new WeakMap,o=new WeakMap,a=e=>{if(!e||"string"!=typeof e)return{};let t=2;for(let l of e.split("\n")){if(!l)continue;let e=l.match(/<anonymous>:(\d+):(\d+)/);if(!e)continue;let n=Number(e[1]),r=Number(e[2]);return{line:Number.isFinite(n)&&n>t?n-t:n,column:Number.isFinite(r)?r:void 0,rawLine:n,rawColumn:r}}return{}},s=(e,t)=>{if(eB(t))for(let[n,r]of Object.entries(t)){if(!n||"string"==typeof r||!r||"object"!=typeof r||Array.isArray(r))continue;let t=r,i=eq(t.deprecated);i&&eV(l,[...e,n],i),eB(t.properties)&&s([...e,n],t.properties)}},d=(e,t)=>{if(!e)return;let n=null==t?void 0:t.info;if(!n||"object"!=typeof n||Array.isArray(n))return;let r=eq(n.deprecated);r&&eV(l,[e],r),eB(n.properties)&&s([e],n.properties)},u=(e,t)=>{if(!e||!t||"object"!=typeof t||Array.isArray(t))return;let n=eq(t.deprecated);n&&eV(l,[e],n)},c=e=>{let t=e;for(;t&&("object"==typeof t||"function"==typeof t);){let e=r.get(t);if(!e)break;t=e}return t},p=e=>{if(e){if("string"==typeof e)return e.trim()||void 0;if(Array.isArray(e)){let t=e.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);return t.length?t.join(", "):void 0}}},h=(t,l,r)=>{if(!t||n.has(t))return;n.add(t);let i=null==e?void 0:e.logger,o="function"==typeof(null==e?void 0:e.t)?(t,l)=>e.t(t,{ns:[P.u4,"client"],nsMode:"fallback",...l}):(e,t)=>{let l=(null==t?void 0:t.defaultValue)??e;return"string"==typeof l&&t?l.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,l)=>{let n=null==t?void 0:t[l];return"string"==typeof n||"number"==typeof n?String(n):""}):l},s="object"==typeof l&&l?l:{},d=p(s.replacedBy),u="string"==typeof s.since?String(s.since):void 0,c="string"==typeof s.removedIn?String(s.removedIn):void 0,h="string"==typeof s.message?String(s.message):"",m=a(r),f=m.line?`(line ${m.line}${m.column?`:${m.column}`:""})`:"",g=h.trim(),v=g?o("RunJS deprecated warning with message",{defaultValue:"[RunJS][Deprecated] {{api}} {{message}}{{location}}",api:t,message:g,location:f}):o("RunJS deprecated warning",{defaultValue:"[RunJS][Deprecated] {{api}} is deprecated{{location}}",api:t,location:f}),y=o("RunJS deprecated separator",{defaultValue:"; "}),b=[v];d&&b.push(o("RunJS deprecated replacedBy",{defaultValue:"Use {{replacedBy}} instead",replacedBy:d})),u&&b.push(o("RunJS deprecated since",{defaultValue:"since {{since}}",since:u})),c&&b.push(o("RunJS deprecated removedIn",{defaultValue:"will be removed in {{removedIn}}",removedIn:c}));let x=b.filter(Boolean).join(y);try{i&&"function"==typeof i.warn?i.warn(x):console.warn(x)}catch(e){}},m=(e,t,l)=>{let r=t.deprecated;if(!r)return e;let i=o.get(e)||new Map;if(o.set(e,i),i.has(l))return i.get(l);let a=new Proxy(e,{apply(e,t,i){let o=n.has(l)?void 0:Error().stack;return h(l,r,o),Reflect.apply(e,c(t),i)},get:(e,t,l)=>Reflect.get(e,t,l)});return i.set(l,a),a},f=(e,t,l)=>{if(!e||"object"!=typeof e&&"function"!=typeof e||eL(e)||!(t.children&&Object.keys(t.children).length>0)&&"ctx"!==l)return e;let o=i.get(e)||new Map;if(i.set(e,o),o.has(l))return o.get(l);let a=new Proxy(e,{get(e,r,i){var o;if("symbol"==typeof r)return Reflect.get(e,r,c(i));let a=String(r),s=Reflect.get(e,r,c(i));if("ctx"===l&&"defineProperty"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{d(String((null==t?void 0:t[0])??""),null==t?void 0:t[1])}catch(e){}return n};if("ctx"===l&&"defineMethod"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{u(String((null==t?void 0:t[0])??""),null==t?void 0:t[2])}catch(e){}return n};let p=null==(o=t.children)?void 0:o[a];if(!p)return s;let g=`${l}.${a}`;if("function"==typeof s&&p.deprecated)return m(s,p,g);if(p.deprecated){let e=n.has(g)?void 0:Error().stack;h(g,p.deprecated,e)}return s&&("object"==typeof s||"function"==typeof s)&&p.children?f(s,p,g):s},has:(e,t)=>Reflect.has(e,t)});return r.set(a,e),o.set(l,a),a};return f(e,l,"ctx")}function eH(e,t,l){if(!eB(t))return e;if(!eB(e))return t;let n={...e};for(let r of Object.keys(t)){let i=t[r];if(null===i){delete n[r];continue}let o=l(eB(e)?e[r]:void 0,i);void 0===o?delete n[r]:n[r]=o}return n}function eY(e,t){if(null===t)return;let l=eB(e),n=eB(t),r="string"==typeof e;if("string"==typeof t)return l?eY(e,{description:t}):t;if(n){let n=l?e:r?{description:e}:void 0,i={...n||{}};for(let e of Object.keys(t)){if("properties"===e){let e=t.properties;if(null===e){delete i.properties;continue}let l=eH(null==n?void 0:n.properties,e,eY);void 0===l?delete i.properties:i.properties=l;continue}let l=e$(null==n?void 0:n[e],t[e]);void 0===l?delete i[e]:i[e]=l}return i}return t??e}function eG(e,t){if(null===t)return;let l=eB(e),n=eB(t),r="string"==typeof e;if("string"==typeof t)return l?eG(e,{description:t}):t;if(n){let n=l?e:r?{description:e}:void 0,i={...n||{}};for(let e of Object.keys(t)){let l=e$(null==n?void 0:n[e],t[e]);void 0===l?delete i[e]:i[e]=l}return i}return t??e}function eJ(e,t){let l=eB(e)?e:{},n=eB(t)?t:{},r={...l};for(let e of Object.keys(n)){if("properties"===e){let e=eH(l.properties,n.properties,eY);void 0===e?delete r.properties:r.properties=e;continue}if("methods"===e){let e=eH(l.methods,n.methods,eG);void 0===e?delete r.methods:r.methods=e;continue}let t=e$(l[e],n[e]);void 0===t?delete r[e]:r[e]=t}return r}class eX extends ev{exit(){var e;throw new j.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}exitAll(){var e;throw new j.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}static define(e,t){let l=null==t?void 0:t.locale;if(l){let t=eN.get(this)||new Map,n=t.get(l)||{};t.set(l,eJ(n,e)),eN.set(this,t)}else{let t=eD.get(this)||{};eD.set(this,eJ(t,e))}eO.delete(this)}static getDoc(e){let t=this,l=eO.get(t),n=String(e||"default");if(l&&l.has(n))return l.get(n);let r=[],i=t;for(;i&&i.prototype;)r.unshift(i),i=Object.getPrototypeOf(i);let o={};for(let e of r)o=eJ(o,eD.get(e)||{});if(e)for(let t of r){let l=eN.get(t);l&&l.has(e)&&(o=eJ(o,l.get(e)))}return l||(l=new Map,eO.set(t,l)),l.set(n,o),o}constructor(e){super(),this.addDelegate(e),this.defineProperty("React",{value:g}),this.defineProperty("antd",{value:c}),this.defineProperty("dayjs",{value:O()});let t={...y,createRoot:(e,t)=>{let l=(null==e?void 0:e.__el)||e;return this.engine.reactView.createRoot(l,t)}};t.__nbRunjsInternalShim=!0,this.defineProperty("ReactDOM",{value:t}),(0,$.oJ)(this),this.defineMethod("openView",async function(t,l){let n=e.openView;if("function"!=typeof n)throw Error("ctx.openView is not available in current context.");let r=(0,P.cg)(l);return n(t,r?{...l||{},[P.sU]:r}:l)}),this.defineMethod("render",function(e,t){let l=t||this.element;if(!l)throw Error("ctx.render: container not provided and ctx.element is not available");let n=(null==l?void 0:l.__el)||l,r=globalThis;r.__nbRunjsRoots=r.__nbRunjsRoots||new WeakMap;let i=r.__nbRunjsRoots,o=e=>{if(!e)return;if(e.disposeTheme&&"function"==typeof e.disposeTheme){try{e.disposeTheme()}catch(e){}e.disposeTheme=void 0}let t=e.root||e;if(t&&"function"==typeof t.unmount)try{t.unmount()}catch(e){}},a=()=>{let e=i.get(n);e&&(o(e),i.delete(n))};if("string"==typeof e)return a(),new b.x(n).innerHTML=String(e??""),null;if(e&&e.nodeType&&(1===e.nodeType||3===e.nodeType||11===e.nodeType)){for(a();n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(e),null}let s=this.ReactDOM,d=this,u=i.get(n);return u&&u.rendererKey===s&&u.ownerKey===d||(u&&(o(u),i.delete(n)),u={rendererKey:s,ownerKey:d,root:this.ReactDOM.createRoot(n),disposeTheme:void 0,lastVnode:void 0},i.set(n,u)),(0,$.$B)({ctx:this,entry:u,vnode:e,containerEl:n,rootMap:i,unmountContainerRoot:a,internalReact:g,internalAntd:c})})}}},48910(e,t,l){l.d(t,{$:()=>eD});var n=l(88243),r=l(16213),i=l(50467),o=l(95243),a=l(2543),s=l.n(a),d=l(81318),u=l.n(d),c=l(64171);class p extends c.Z{getAction(e){return this.actions.get(e)}getActions(){return new Map(this.actions)}}var h=l(26955);class m extends h.L{getEvent(e){return this.events.get(e)}getEvents(){return new Map(this.events)}}var f=l(29007),g=l(60182),v=l(31108),y=l(88439),b=l(62572);class x{async emitModelEventIf(e,t,l){e&&await this.engine.emitter.emitAsync(`model:event:${e}:${t}`,l)}async withApplyFlowCache(e,t){if(!e||!this.engine)return await t();let l=this.engine.applyFlowCache.get(e);if(l){if("resolved"===l.status)return l.data;if("rejected"===l.status)throw l.error;if("pending"===l.status)return await l.promise}let n=t().then(t=>(this.engine.applyFlowCache.set(e,{status:"resolved",data:t,promise:Promise.resolve(t)}),t)).catch(t=>{throw this.engine.applyFlowCache.set(e,{status:"rejected",error:t,promise:Promise.reject(t)}),t});return this.engine.applyFlowCache.set(e,{status:"pending",promise:n}),await n}async runFlow(e,t,l,n,r){var i;let o,a=e.getFlow(t);if(!a)return e.context.logger.error(`BaseModel.applyFlow: Flow with key '${t}' not found.`),Promise.reject(Error(`Flow '${t}' not found.`));let d=new f.W5(e,t);d.defineProperty("reactView",{value:e.reactView}),d.defineProperty("inputArgs",{value:{...l}}),d.defineProperty("runId",{value:n||`run-${Date.now()}`});let u=d.stepResults,c=e.getEvent("string"==typeof a.on?a.on:null==(i=a.on)?void 0:i.eventName);c&&((c={...c}).defaultParams={...s().get(a,"on.defaultParams",{}),...c.defaultParams});let p=c?{eventStep:c,...a.steps}:a.steps;(0,y.w)(d,p,e,t);let h=d.steps,m={uid:e.uid,model:e,runId:d.runId,inputArgs:l,flowKey:t};for(let[l,n]of(await this.emitModelEventIf(r,`flow:${t}:start`,m),Object.entries(p))){let i,a,s={},c=n.useRawParams;if(n.use){let r=e.getAction(n.use);if(!r){d.logger.error(`BaseModel.applyFlow: Action '${n.use}' not found for step '${l}' in flow '${t}'. Skipping.`);continue}a=await (0,b.v)(d,{...r,...n}),i=n.handler||r.handler,c=c??r.useRawParams;let o=await (0,g.gG)(r.defaultParams,a),u=await (0,g.gG)(n.defaultParams,a);s={...o,...u}}else{if(!n.handler)continue;a=await (0,b.v)(d,n),i=n.handler,s={...await (0,g.gG)(n.defaultParams,a)}}let p=e.getStepParams(t,l);void 0!==p&&(s={...s,...p}),"function"==typeof c&&(c=await c(a)),c||(s=await a.resolveJsonTemplate(s));try{if(!i){d.logger.error(`BaseModel.applyFlow: No handler available for step '${l}' in flow '${t}'. Skipping.`);continue}await this.emitModelEventIf(r,`flow:${t}:step:${l}:start`,{...m,stepKey:l});let e=i(a,s);o=!1!==n.isAwait?await e:e,u[l]=o,h[l].result=u[l],await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,result:o,stepKey:l})}catch(e){if(e instanceof g.sy||e instanceof v.zz||await this.emitModelEventIf(r,`flow:${t}:step:${l}:error`,{...m,error:e,stepKey:l}),e instanceof g.sy)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,stepKey:l}),await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:u}),Promise.resolve(u);if(e instanceof v.zz)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,stepKey:l,aborted:!0}),await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:e,aborted:!0}),Promise.resolve(e);return await this.emitModelEventIf(r,`flow:${t}:error`,{...m,error:e}),d.logger.error({err:e},`BaseModel.applyFlow: Error executing step '${l}' in flow '${t}':`),Promise.reject(e)}}return await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:u}),Promise.resolve(u)}async dispatchEvent(e,t,l,n){var r,i,o,a;let s="beforeRender"===t,d=!!(null==n?void 0:n.sequential),u=!!(null==n?void 0:n.useCache),c=s,p=`${e.uid}-${t}-${Date.now()}`,h=e.context.logger,m={uid:e.uid,model:e,runId:p,inputArgs:l};try{await this.emitModelEventIf(t,"start",m),await (null==(r=e.onDispatchEventStart)?void 0:r.call(e,t,n,l))}catch(r){if(s&&r instanceof g.sy)return h.debug(`[FlowModel.dispatchEvent] ${r.message}`),[];try{await (null==(i=e.onDispatchEventError)?void 0:i.call(e,t,n,l,r))}finally{h.error({err:r},`BaseModel.dispatchEvent: Start hook error for event '${t}'`)}if(c)throw r;return}let f=s?e.getEventFlows("beforeRender"):Array.from(e.getFlows().values()).filter(e=>{let l=e.on;return!!l&&("string"==typeof l?l===t:"object"==typeof l&&l.eventName===t)}),y="click"===t&&(null==l?void 0:l.triggerByRouter)===!0?f.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}):f,b=[],x=async()=>{let n=!1;if(d){let r=y.map((e,t)=>({f:e,i:t})).slice().sort((e,t)=>{var l,n;let r=e.f.flowRegistry,i=t.f.flowRegistry,o=null==r||null==(l=r.constructor)?void 0:l._type,a=null==i||null==(n=i.constructor)?void 0:n._type,s=+("instance"!==o),d=+("instance"!==a);if(s!==d)return s-d;let u=e.f.sort??0,c=t.f.sort??0;return u!==c?u-c:e.i-t.i}).map(e=>e.f),i=[],o=new Map(r.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}).map(e=>[e.key,e])),a=new Set,s=new Map;for(let[n,d]of(r.forEach((e,l)=>{let n=e.on,r="object"==typeof n?n:void 0;if(!r)return;let i=r.phase,d=r.flowKey,u=r.stepKey;if(!i||"beforeAllFlows"===i)return;let c=null;if("afterAllFlows"===i)c=`event:${t}:end`;else if("beforeFlow"===i||"afterFlow"===i)if(d)if(o.get(String(d))){let e="beforeFlow"===i?"start":"end";c=`event:${t}:flow:${String(d)}:${e}`}else c=`event:${t}:end`;else c=`event:${t}:end`;else if("beforeStep"!==i&&"afterStep"!==i)return;else if(d&&u){var p;let e=o.get(String(d)),l=!!(null==e||null==(p=e.hasStep)?void 0:p.call(e,String(u)));if(e&&l){let e="beforeStep"===i?"start":"end";c=`event:${t}:flow:${String(d)}:step:${String(u)}:${e}`}else c=`event:${t}:end`}else c=`event:${t}:end`;if(!c)return;let h=c===`event:${t}:end`||"afterFlow"===i||"afterStep"===i;a.add(e.key);let m=s.get(c)||[];m.push({flow:e,order:l,shouldSkipOnAborted:h}),s.set(c,m)}),s.entries()))for(let r of d.slice().sort((e,t)=>{let l=e.flow.sort??0,n=t.flow.sort??0;return l!==n?l-n:e.order-t.order})){let o=r.shouldSkipOnAborted?Object.assign(e=>e.type===n&&!0!==e.aborted,{__eventType:n}):n,a=e.scheduleModelOperation(e.uid,async e=>{let n=await this.runFlow(e,r.flow.key,l,p,t);if(n instanceof v.zz)throw n;i.push(n)},{when:o});b.push(a)}for(let o of r)if(!a.has(o.key))try{h.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${o.key}' (sequential).`);let r=await this.runFlow(e,o.key,l,p,t);if(r instanceof v.zz){h.debug(`[FlowEngine.dispatchEvent] ${r.message}`),n=!0;break}i.push(r)}catch(e){if(e instanceof v.zz){h.debug(`[FlowEngine.dispatchEvent] ${e.message}`),n=!0;break}throw h.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${o.key}' for event '${t}' (sequential):`),e}return{result:i,abortedByExitAll:n}}let r=(await Promise.all(y.map(async n=>{h.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${n.key}'.`);try{return await this.runFlow(e,n.key,l,p,t)}catch(e){if(h.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${n.key}' for event '${t}':`),c)throw e;return}}))).filter(e=>void 0!==e);return r.some(e=>e instanceof v.zz)&&(n=!0),{result:r,abortedByExitAll:n}},w=u?JSON.stringify(l??{}):"",S=u?eD.generateApplyFlowCacheKey(`event:${e.getFlowCacheScope(t)}:${w}`,t,e.uid):null;try{let{result:r,abortedByExitAll:i}=await this.withApplyFlowCache(S,x);try{await (null==(o=e.onDispatchEventEnd)?void 0:o.call(e,t,n,l,r))}catch(e){h.error({err:e},`BaseModel.dispatchEvent: End hook error for event '${t}'`)}return await this.emitModelEventIf(t,"end",{...m,result:r,...i?{aborted:!0}:{}}),r&&"object"==typeof r&&Object.defineProperty(r,"__abortedByExitAll",{value:i,configurable:!0}),r}catch(r){try{await (null==(a=e.onDispatchEventError)?void 0:a.call(e,t,n,l,r))}catch(e){}if(e.context.logger.error({err:r},`BaseModel.dispatchEvent: Error executing event '${t}' for model '${e.uid}':`),await this.emitModelEventIf(t,"error",{...m,error:r}),c)throw r}finally{for(let e of b)e()}}constructor(e){(0,i._)(this,"engine",void 0),this.engine=e}}var w=l(58587),S=l(18150),M=l(68238),A=l(78880),F=l(18220),k=l(47674),C=l(21637),P=l(71021),j=l(84626),E=l(96540),R=l(74848),I=l(53619),T=l(92034),_=l(98393),D=l(22803),N=l(42443),O=l(88040),$=l(35710),B=l(18182),L=l(98892),q=l(33954),V=l(57084),z=l(94313),K=l(20616),U=l(52847);let W={marginLeft:32},H=(0,U.PA)(e=>{let{title:t,onChange:l,getDefaultValue:n,disabled:r,itemKey:i,...o}=e,[a,s]=(0,E.useState)(!1),d=(0,K.Db)();(0,E.useEffect)(()=>{let e=!1;return(async()=>{if(n)try{let t=await n();if(e||!t)return;let l=Object.entries(t);if(!l.length)return;let[r,i]=l[0];s(!!i)}catch(e){console.error(e)}})(),()=>{e=!0}},[n]);let u=e=>{s(e),null==l||l({[i]:e})},c=e=>{e.stopPropagation(),r||u(!a)};return(0,R.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between",cursor:r?"not-allowed":"pointer"},onClick:c,children:[t,(0,R.jsx)(z.A,{size:"small",...o,checkedChildren:o.checkedChildren?d.t(o.checkedChildren):void 0,unCheckedChildren:o.unCheckedChildren?d.t(o.unCheckedChildren):void 0,checked:a,style:W,disabled:r})]})});var Y=l(36492);let G=(e,t)=>{for(let n of e){var l;if(String((null==n?void 0:n.key)??"")===t)return n;if(null==(l=n.children)?void 0:l.length){let e=G(n.children,t);if(e)return e}}},J=(e,t,l)=>{let n=t.maxDepth,r="number"==typeof t.arrayLimit?t.arrayLimit:1/0,i=t.mode??"stack",o=new Set,a=new Set,s=(e,t,d)=>{if(!e||t>n)return;let u=()=>{l(e,{depth:t,modelKey:d}),t>=n||Object.entries(e.subModels||{}).forEach(e=>{let[l,n]=e;if(Array.isArray(n)){let e=Number.isFinite(r)?Math.min(n.length,r):n.length;for(let r=0;r<e;r++){let e=n[r];e instanceof q.WD&&s(e,t+1,`${l}[${r}]`)}return}n instanceof q.WD&&s(n,t+1,l)})};if("visited"===i){if(o.has(e))return;o.add(e),u();return}let c=e.uid||`temp-${Date.now()}`;if(!a.has(c)){a.add(c);try{u()}finally{a.delete(c)}}};s(e,1)},X=(e,t)=>{var l;if(!e||!t||"string"!=typeof t)return console.warn("Invalid input parameters"),null;let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\[(\d+)\])?$/);if(!n)return console.warn(`Invalid subModelKey format: ${t}`),null;let[,r,i]=n,o=null==(l=e.subModels)?void 0:l[r];if(!o)return console.warn(`SubModel '${r}' not found`),null;if(void 0!==i){let e=parseInt(i,10);return Array.isArray(o)?e<0||e>=o.length?(console.warn(`Array index ${e} out of bounds for '${r}'`),null):o[e]instanceof q.WD?o[e]:null:(console.warn(`Expected array for '${r}', got ${typeof o}`),null)}return Array.isArray(o)?(console.warn(`Expected object for '${r}', got array`),null):o instanceof q.WD?o:null},Q={switch:H,select:function(e){let{title:t,getDefaultValue:l,onChange:n,options:r,fieldNames:i,itemKey:o,tooltip:a,...s}=e,[d,u]=(0,E.useState)(!1),[c,p]=(0,E.useState)(""),h=(0,K.Db)();(0,E.useEffect)(()=>{let e=!1;return(async()=>{if(l)try{let t=await l();if(e||!t)return;let n=Object.entries(t);if(!n.length)return;let[r,i]=n[0];p(i)}catch(e){console.error(e)}})(),()=>{e=!0}},[l]);let m=(0,E.useRef)(null),f=e=>{p(e),null==n||n({[o]:e})},g=(0,R.jsx)("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:t});return(0,R.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},onClick:e=>{e.stopPropagation(),u(e=>!e)},onMouseLeave:()=>{m.current=setTimeout(()=>{u(!1)},200)},children:[a?(0,R.jsx)(N.A,{title:a,placement:"top",destroyTooltipOnHide:!0,children:g}):g,(0,R.jsx)(Y.A,{...s,open:d,popupMatchSelectWidth:!1,bordered:!1,value:c,onChange:f,popupClassName:`select-popup-${t.replaceAll(" ","-")}`,fieldNames:i,options:r,labelRender:e=>h.t(e.label),optionRender:e=>h.t(e.label),style:{textAlign:"right",minWidth:100},onMouseEnter:()=>{clearTimeout(m.current)},dropdownRender:e=>s.dropdownRender?s.dropdownRender(e,u,f):e})]})}},Z=e=>{let{title:t,uiMode:l,itemProps:n}=e,r=(null==l?void 0:l.type)||l,i=r?Q[r]:null,o=!!(null==n?void 0:n.disabled),a=null==n?void 0:n.disabledReason,s=null==n?void 0:n.disabledIconColor,d=i?(0,R.jsx)(i,{title:t,...n}):(0,R.jsx)(R.Fragment,{children:t});return o?(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,R.jsx)(N.A,{title:a,placement:"right",destroyTooltipOnHide:!0,children:(0,R.jsx)(I.A,{style:{color:s}})})]}):d},ee=".nb-toolbar-container-icons",et=".nb-toolbar-container",el=(0,D.css)`
|
|
1350
|
+
Please run: await ctx.importAsync("${l}") to ensure ctx.render uses a matching ReactDOM.`);throw e.cause=n,e}}return u}function el(e){return e.endsWith("/")?e:`${e}/`}function en(e,t){try{let l=new URL(e);if(!["http:","https:"].includes(l.protocol))return!1;if(!(null==t?void 0:t.getApiUrl))return!0;let n=new URL(t.getApiUrl()),r=el(n.pathname),i=el(l.pathname);return l.origin!==n.origin||!i.startsWith(r)}catch{return!1}}function er(e){return!!(e&&"object"==typeof e&&"collection"in e&&"filterByTk"in e)}function ei(e,t){if(t&&0!==t.length){if(er(e))return e;if(e&&"object"==typeof e&&!Array.isArray(e)){let l={};for(let[n,r]of Object.entries(e))t.some(e=>e===n||e.startsWith(`${n}.`)||e.startsWith(`${n}[`))&&(l[n]=r);return l}}}function eo(e){if(!e)return;let t=String(e).match(/^([^.[]+)/);return null==t?void 0:t[1]}function ea(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!Array.isArray(e)||0===e.length)return{generatedAppends:void 0,generatedFields:void 0};let t=new Set,l=new Set,n=e=>{if(!e)return"";let t=String(e);return(t=(t=(t=t.replace(/\[(?:\d+)\]/g,"")).replace(/\[(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)')\]/g,(e,t,l)=>`.${t||l}`)).replace(/\.\.+/g,".")).replace(/^\./,"").replace(/\.$/,"")};for(let r of e){if(!r)continue;for(;/^\[(\d+)\](\.|$)/.test(r);)r=r.replace(/^\[(\d+)\]\.?/,"");let e=n(r);if(!e)continue;let i=e.split(".").filter(Boolean);if(0!==i.length){if(1===i.length){l.add(i[0]);continue}for(let e=0;e<i.length-1;e++)t.add(i.slice(0,e+1).join("."));l.add(i.join("."))}}return{generatedAppends:t.size?Array.from(t):void 0,generatedFields:l.size?Array.from(l):void 0}}var es=new WeakMap,ed=new WeakSet,eu=new WeakSet,ec=new WeakSet,ep=new WeakSet,eh=new WeakSet,em=new WeakSet,ef=new WeakSet,eg=new WeakSet;class ev{createProxy(){return(0,n._)(this,es)||(0,i._)(this,es,new Proxy(this,{get:(e,t,l)=>{if("string"==typeof t){if(Reflect.has(e,t)){let n=Reflect.get(e,t,l);return"function"==typeof n?n.bind(e):n}if(Object.prototype.hasOwnProperty.call(e._props,t))return e._getOwnProperty(t,this.createProxy());if(Object.prototype.hasOwnProperty.call(e._methods,t))return e._getOwnMethod(t,this.createProxy());let n=this._findInDelegates(e._delegates,t);return void 0!==n?n.result:void 0}return Reflect.get(e,t,l)},has:(e,t)=>!!("string"==typeof t&&(Reflect.has(e,t)||Object.prototype.hasOwnProperty.call(e._props,t)||Object.prototype.hasOwnProperty.call(e._methods,t)||this._hasInDelegates(e._delegates,t)))||Reflect.has(e,t)})),(0,n._)(this,es)}defineProperty(e,t){var l;if(this._props[e]&&(null==(l=this._props[e])?void 0:l.once))return;let n=this._props[e];(null==n?void 0:n.meta)&&this._clearMetaNodeCacheFor(n.meta),this._props[e]=t,delete this._observableCache[e],delete this._cache[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:()=>this._getOwnProperty(e,this.createProxy())})}defineMethod(e,t,l){this._methods[e]=t,"string"==typeof l?this._methodInfos[e]={description:l}:l&&"object"==typeof l?this._methodInfos[e]=l:delete this._methodInfos[e],Object.defineProperty(this,e,{configurable:!0,enumerable:!1,writable:!1,value:t.bind(this.createProxy())})}removeCache(e){if(e in this._observableCache)return delete this._observableCache[e],!0;if(e in this._cache)return delete this._cache[e],!0;if(e in this._pending)return delete this._pending[e],!0;for(let t of this._delegates)if(t.removeCache(e))return!0}delegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)?console.warn(`[FlowContext] delegate - skip duplicate delegate: ${this._delegates.length}`):this._delegates.unshift(e)}addDelegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");this._delegates.includes(e)||this._delegates.unshift(e)}clearDelegates(){this._delegates=[],this._metaNodeCache=new WeakMap}removeDelegate(e){if(!(e instanceof ev))throw Error("Delegate must be an instance of FlowContext");let t=this._delegates.indexOf(e);-1!==t&&this._delegates.splice(t,1)}_clearMetaNodeCacheFor(e){this._metaNodeCache.delete(e)}has(e){return!!this._props[e]}getPropertyMetaTree(e,t){let l=this._getPropertiesMeta();if(e){let l=(0,P.YB)(e);if(l&&l.length>0){let e=async(e,t,l)=>{try{let l="function"==typeof e?await e():e;if(!(null==l?void 0:l.properties))return[];let n=l.properties;if("function"==typeof n){let e=await n();l.properties=e,n=e}let r=(0,o._)(this,ed,ey).call(this,n,t,[],l);return Array.isArray(r)?r:await r()}catch(e){return console.warn(`Failed to load meta for ${l}:`,e),[]}},n=(0,o._)(this,eu,eb).call(this,l);if(n){let[r,i,a]=n;if(1===l.length){if("function"==typeof i)return()=>e(i,a,r);if(i.properties){if("function"==typeof i.properties)return()=>e(i,a,r);let t=(0,o._)(this,ed,ey).call(this,i.properties,a,[],i);return Array.isArray(t)?t:[]}return[]}if("function"==typeof i){if(null==t?void 0:t.flatten)return()=>e(i,a,r);let l=(0,o._)(this,ef,eM).call(this,a);return[(0,o._)(this,eg,eA).call(this,r,i,a,l)]}if(i.properties){let e=[...(0,o._)(this,ef,eM).call(this,a),i.title],t=(0,o._)(this,ed,ey).call(this,i.properties,a,e,i);return Array.isArray(t)?t:[]}}return[]}if(null===l)return console.warn(`[FlowContext] getPropertyMetaTree - unsupported value format: "${e}". Only "{{ ctx.propertyName }}" format is supported. Returning empty meta tree.`),[]}return Object.entries(l).sort((e,t)=>{let[,l]=e,[,n]=t,r=("function"==typeof l?l.sort:null==l?void 0:l.sort)??0;return(("function"==typeof n?n.sort:null==n?void 0:n.sort)??0)-r}).map(e=>{let[t,l]=e;return(0,o._)(this,eg,eA).call(this,t,l,[t],[])})}async getApiInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.version||"v1",l=!!e.includeCompletion,n=this.createProxy(),r=e=>"string"==typeof e&&e.startsWith("_"),i=e=>"record"===e||"formValues"===e||"popup"===e,o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=(()=>{var e,l,n,r,i,o,a,s;let d=(0,_.B)(this),u=_.F.resolve(t,d)||_.F.resolve(t,"*");if(!u)return{};let c=(null==(n=this)||null==(l=n.api)||null==(e=l.auth)?void 0:e.locale)||(null==(i=this)||null==(r=i.i18n)?void 0:r.language)||(null==(o=this)?void 0:o.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})(),s=eB(null==a?void 0:a.methods)?a.methods:{},d=eB(null==a?void 0:a.properties)?a.properties:{},u=e=>"string"==typeof e?{description:e}:eB(e)?e:void 0,c=(e,t)=>{let l="string"==typeof t?t:eB(t)&&"string"==typeof t.description?String(t.description):void 0;return l&&l.includes(`ctx.libs.${e}`)?`libs.${e}`:e},p=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},h=e=>{let t=u(e);if(!t)return{};let n={};for(let e of["title","type","interface","description","examples",...l?["completion"]:[],"ref","params","returns"]){let l=t[e];void 0!==l&&(n[e]=l)}return Array.isArray(n.examples)&&(n.examples=n.examples.filter(e=>"string"==typeof e&&e.trim())),n},m=e=>{let t=new WeakSet,l=n=>{if(!n||"object"!=typeof n||t.has(n))return;if(t.add(n),Object.prototype.hasOwnProperty.call(n._methodInfos||{},e)){var r;return null==(r=n._methodInfos)?void 0:r[e]}let i=n._delegates;if(Array.isArray(i))for(let e of i){let t=l(e);if(t)return t}};return l(this)},f=async e=>{let t=this.getPropertyOptions(e);if(null==t?void 0:t.info)try{let e="function"==typeof t.info?t.info.call(n,n):t.info;return(o(e)?await e:e)??void 0}catch(e){return}},g=new Set,v=new Set;for(let e of Object.keys(d))g.add(e);for(let e of Object.keys(s))v.add(e);let y=(e,t)=>{if(e&&"object"==typeof e&&!t.has(e)){t.add(e);try{let t=e._props;if(t&&"object"==typeof t)for(let[e,l]of Object.entries(t))(null==l?void 0:l.info)&&g.add(e)}catch(e){}try{let t=e._methodInfos;if(t&&"object"==typeof t)for(let e of Object.keys(t))v.add(e)}catch(e){}try{let l=e._delegates;if(Array.isArray(l))for(let e of l)y(e,t)}catch(e){}}};y(this,new WeakSet);let b={};for(let e of g){if(r(e)||i(e))continue;let t=d[e],n=await f(e);if(void 0===t&&void 0===n)continue;let o=u(t),a=u(n),s={};if(s={...s={...s,...h(o)},...h(a)},delete s.properties,l||delete s.completion,!Object.keys(s).length)continue;let p=c(e,t);b[p]=b[p]?{...b[p]||{},...s||{}}:s}for(let e of v){if(r(e))continue;let t=s[e],n=m(e);if(void 0===t&&void 0===n)continue;let i=u(t),o={};o={...o={...o,...p(i)},...p(n)},delete o.properties,l||delete o.completion,Object.keys(o).length&&(o.type="function",b[e]?b[e]={...b[e]||{},...o||{}}:b[e]=o)}let x=u(d.libs),w=eB(null==x?void 0:x.properties)?x.properties:void 0;if(w)for(let[e,t]of Object.entries(w)){if(r(e))continue;let n=`libs.${e}`;if(b[n])continue;let i=u(t),o={};o={...o,...h(i)},delete o.properties,l||delete o.completion,o.description&&String(o.description).trim()&&(b[n]=o)}return b}async getEnvInfos(){var e,t,l;let n=this.createProxy(),r=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,i={},o=e=>{try{return e()}catch(e){return}},a=e=>null!=e&&("string"==typeof e?e.trim().length>0:!Array.isArray(e)||e.length>0),s=e=>{var t,l,n,r,i;let o={};if(!e)return o;let s=e;for(let e of["dataSourceKey","collectionName","associationName","filterByTk","sourceId"]){let t=null==s?void 0:s[e];a(t)&&(o[e]=t)}if(!("dataSourceKey"in o)){let e=null==(t=s.getDataSourceKey)?void 0:t.call(s);a(e)&&(o.dataSourceKey=e)}if(!("filterByTk"in o)){let e=null==(l=s.getFilterByTk)?void 0:l.call(s);a(e)&&(o.filterByTk=e)}if(!("filterByTk"in o)){let e=null==(n=s.getMeta)?void 0:n.call(s,"currentFilterByTk");a(e)&&(o.filterByTk=e)}if(!("sourceId"in o)){let e=null==(r=s.getSourceId)?void 0:r.call(s);a(e)&&(o.sourceId=e)}if(!("collectionName"in o)||!("associationName"in o)){let e=null==(i=s.getResourceName)?void 0:i.call(s),t="string"==typeof e?e.trim():"";if(t){let e=t.split(".").map(e=>e.trim()).filter(Boolean);1===e.length?"collectionName"in o||(o.collectionName=e[0]):e.length>=2&&("collectionName"in o||(o.collectionName=e[0]),"associationName"in o||(o.associationName=e.slice(1).join(".")))}}return o},d=await (async()=>{try{let e=n.popup;return r(e)?await e:e}catch(e){return}})(),u=o(()=>n.model),c=o(()=>n.blockModel),p=o(()=>{var e;return null==(e=n.view)?void 0:e.inputArgs}),h=o(()=>n.resource),m=s(null==d?void 0:d.resource),f=c,g=c?"ctx.blockModel":void 0,v=g?`${g}.resource`:void 0,y=s(null==f?void 0:f.resource),b=s(p),x=s(h),w=e=>{for(let t of e)if(a(t.value))return{value:t.value,getVar:t.getVar}},S=e=>a(e.collectionName)||a(e.dataSourceKey)||a(e.associationName),M=S(m)?"ctx.popup.resource":S(y)?v:S(b)?"ctx.view.inputArgs":S(x)?"ctx.resource":void 0,A=w([{value:null==m?void 0:m.collectionName,getVar:"ctx.popup.resource.collectionName"},{value:null==y?void 0:y.collectionName,getVar:`${v}.collectionName`},{value:null==b?void 0:b.collectionName,getVar:"ctx.view.inputArgs.collectionName"},{value:null==x?void 0:x.collectionName,getVar:"ctx.resource.collectionName"}]),F=w([{value:null==m?void 0:m.dataSourceKey,getVar:"ctx.popup.resource.dataSourceKey"},{value:null==y?void 0:y.dataSourceKey,getVar:`${v}.dataSourceKey`},{value:null==b?void 0:b.dataSourceKey,getVar:"ctx.view.inputArgs.dataSourceKey"},{value:null==x?void 0:x.dataSourceKey,getVar:"ctx.resource.dataSourceKey"}]),k=w([{value:null==m?void 0:m.associationName,getVar:"ctx.popup.resource.associationName"},{value:null==y?void 0:y.associationName,getVar:`${v}.associationName`},{value:null==b?void 0:b.associationName,getVar:"ctx.view.inputArgs.associationName"},{value:null==x?void 0:x.associationName,getVar:"ctx.resource.associationName"}]),C=w([{value:null==m?void 0:m.filterByTk,getVar:"ctx.popup.resource.filterByTk"},{value:null==y?void 0:y.filterByTk,getVar:`${v}.filterByTk`},{value:null==b?void 0:b.filterByTk,getVar:"ctx.view.inputArgs.filterByTk"},{value:null==x?void 0:x.filterByTk,getVar:"ctx.resource.filterByTk"}]),P=w([{value:null==m?void 0:m.sourceId,getVar:"ctx.popup.resource.sourceId"},{value:null==y?void 0:y.sourceId,getVar:`${v}.sourceId`},{value:null==b?void 0:b.sourceId,getVar:"ctx.view.inputArgs.sourceId"},{value:null==x?void 0:x.sourceId,getVar:"ctx.resource.sourceId"}]),j={},E=!1,R=null==A?void 0:A.value;a(R)&&(j.collectionName={description:"Collection name",getVar:(null==A?void 0:A.getVar)||(M?`${M}.collectionName`:void 0),value:R},E=!0);let I=null==F?void 0:F.value;a(I)&&(j.dataSourceKey={description:"Data source key",getVar:(null==F?void 0:F.getVar)||(M?`${M}.dataSourceKey`:void 0),value:I},E=!0);let T=null==k?void 0:k.value;a(T)&&(j.associationName={description:"Association name",getVar:(null==k?void 0:k.getVar)||(M?`${M}.associationName`:void 0),value:T},E=!0),E&&(a(null==C?void 0:C.value)&&(j.filterByTk={description:"Record filterByTk",getVar:(null==C?void 0:C.getVar)||(M?`${M}.filterByTk`:void 0)}),a(null==P?void 0:P.value)&&(j.sourceId={description:"Source record ID (sourceId)",getVar:(null==P?void 0:P.getVar)||(M?`${M}.sourceId`:void 0)}),i.resource={description:"Resource information",getVar:M,properties:j}),a(null==C?void 0:C.value)&&(i.record={description:"Current record",getVar:"ctx.record"});let _=e=>{try{let t=null==e?void 0:e.title;if("string"==typeof t&&t.trim())return t}catch(e){}try{var t,l;let n=null==e||null==(l=e.constructor)||null==(t=l.meta)?void 0:t.label;if("string"==typeof n&&n.trim())return n}catch(e){}};if(u){let t=_(u),l=u.uid,n=null==(e=u.constructor)?void 0:e.name,r=s(u.resource),o={},d=!1,c=r.collectionName;a(c)&&(o.collectionName={description:"Collection name",getVar:"ctx.model.resource.collectionName",value:c},d=!0);let p=r.dataSourceKey;a(p)&&(o.dataSourceKey={description:"Data source key",getVar:"ctx.model.resource.dataSourceKey",value:p},d=!0);let h=r.associationName;a(h)&&(o.associationName={description:"Association name",getVar:"ctx.model.resource.associationName",value:h},d=!0),i.flowModel={description:"Current FlowModel information",getVar:"ctx.model",properties:{...a(t)?{label:{description:"Flow model label",value:t}}:{},...a(n)?{modelClass:{description:"Flow model class name",value:n}}:{},...a(l)?{uid:{description:"Flow model uid",getVar:"ctx.model.uid",value:l}}:{},...d?{resource:{description:"Flow model resource",getVar:"ctx.model.resource",properties:o}}:{}}}}if((null==d?void 0:d.uid)&&(i.popup={description:"Current popup information",getVar:"ctx.popup",properties:{uid:{description:"Popup uid",getVar:"ctx.popup.uid",value:d.uid},...(null==d?void 0:d.record)?{record:{description:"Popup record",getVar:"ctx.popup.record"}}:{},...(null==d?void 0:d.sourceRecord)?{sourceRecord:{description:"Popup source record",getVar:"ctx.popup.sourceRecord"}}:{}}}),f){let e=_(f),l=f.uid,n=null==(t=f.constructor)?void 0:t.name,r={},o=!1,s=y.collectionName;a(s)&&(r.collectionName={description:"Collection name",getVar:`${v}.collectionName`,value:s},o=!0);let d=y.dataSourceKey;a(d)&&(r.dataSourceKey={description:"Data source key",getVar:`${v}.dataSourceKey`,value:d},o=!0);let u=y.associationName;a(u)&&(r.associationName={description:"Association name",getVar:`${v}.associationName`,value:u},o=!0),i.block={description:"Current block information",getVar:g,properties:{...a(e)?{label:{description:"Block label",value:e}}:{},...a(n)?{modelClass:{description:"Block model class name",value:n}}:{},...a(l)?{uid:{description:"Block uid",getVar:`${g}.uid`,value:l}}:{},...o?{resource:{description:"Block resource",getVar:v,properties:r}}:{}}}}let D=(()=>{let e=null==d?void 0:d.uid;if(a(e))return String(e).trim();let t=null==p?void 0:p.viewUid;if(a(t))return String(t).trim()})(),N=o(()=>n.engine),O=D?null==N?void 0:N.getModel(D,!0):void 0,$=e=>{var t;return(null==(t=e.context)?void 0:t.blockModel)===e};if(O){let e=[O],t=[];for(let n=0;n<e.length;n++){let r=e[n];if($(r)){let e=(null==(l=r.constructor)?void 0:l.name)||r.uid,n=_(r)||e||r.uid,i=s(r.resource),o={};a(i.dataSourceKey)&&(o.dataSourceKey=i.dataSourceKey),a(i.collectionName)&&(o.collectionName=i.collectionName),a(i.associationName)&&(o.associationName=i.associationName);let d={uid:r.uid,label:n,modelClass:e,...Object.keys(o).length>0?{resource:o}:{}};t.push(d)}let i=r.subModels;if(i&&"object"==typeof i)for(let t of Object.values(i))t&&(Array.isArray(t)?e.push(...t):e.push(t))}t.length&&(i.currentViewBlocks={description:"Current view blocks",value:t})}return i}async getVarInfos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.maxDepth??3,l=Number.isFinite(t)?Math.max(1,Math.floor(t)):3,n="v1",r=this.createProxy(),i=e=>"string"==typeof e&&e.startsWith("_"),o=e=>!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then,a=new WeakMap,s=async e=>{if(!e)return;if("function"!=typeof e)return e;let t=a.get(e);return t||(t=(async()=>{let t=e.call(r,r);return(o(t)?await t:t)||null})(),a.set(e,t)),await t||void 0},d=e=>{if("string"!=typeof e)return;let t=e.trim();if(!t)return;let l=(0,P.YB)(t);return Array.isArray(l)&&l.length>0?l.join("."):"ctx"===t?"":t.startsWith("ctx.")?t.slice(4).trim():t},u=(()=>{let t=e.path;return("string"==typeof t?[t]:Array.isArray(t)?t:[]).map(e=>d(String(e))).filter(e=>"string"==typeof e&&e.length>0)})(),c=(()=>{let t=e.path;return"string"==typeof t?""===d(t):!!Array.isArray(t)&&t.some(e=>""===d(String(e)))})(),p=(()=>{var e,t,l,r,i,o,a,s;let d=(0,_.B)(this),u=_.F.resolve(n,d)||_.F.resolve(n,"*");if(!u)return{};let c=(null==(l=this)||null==(t=l.api)||null==(e=t.auth)?void 0:e.locale)||(null==(i=this)||null==(r=i.i18n)?void 0:r.language)||(null==(o=this)?void 0:o.locale);try{if(null==u||null==(a=u.getDoc)?void 0:a.length)return u.getDoc(c)||{};return(null==u||null==(s=u.getDoc)?void 0:s.call(u))||{}}catch(e){return{}}})();eB(null==p?void 0:p.methods)&&p.methods,eB(null==p?void 0:p.properties)&&p.properties;let h=e=>"string"==typeof e?{description:e}:eB(e)?e:void 0,m=async(e,t)=>{if(void 0!==e){if("boolean"==typeof e)return e;if("function"==typeof e)try{let l=t(e);return o(l)?!!await l:!!l}catch(e){return!1}return!!e}},f=async(e,t)=>{if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)try{let l=t(e),n=o(l)?await l:l;if("string"==typeof n)return n;return null==n?void 0:String(n)}catch(e){return}return String(e)}},g=async e=>{let t=!1,l=[];try{if("boolean"==typeof e)t=e;else if(Array.isArray(e))l=e;else if("function"==typeof e){let n=e(r),i=o(n)?await n:n;"boolean"==typeof i?t=i:Array.isArray(i)&&(l=i)}}catch(e){t=!1,l=[]}let n=[];if(Array.isArray(l))for(let e of l){if("string"!=typeof e)continue;let t=e.trim();!(!t||"ctx"===t||t.startsWith("ctx."))&&(/\s/.test(t)||n.push(t))}return{hideSelf:!!t,hideSubpaths:n}},v=(e,t)=>{if(!e)return!1;let l=e.split(".").filter(Boolean);for(;l.length;){if(t.has(l.join(".")))return!0;l.pop()}return!1},y=e=>{let t=h(e);if(!t)return{};let l={};for(let e of["title","type","interface","description","examples","completion","ref","params","returns"]){let n=t[e];void 0!==n&&(l[e]=n)}return Array.isArray(l.examples)&&(l.examples=l.examples.filter(e=>"string"==typeof e&&e.trim())),l},b=async e=>{let t,n,{docNode:o,metaNode:a,infoNode:d,depth:u,pathFromRoot:c,hiddenPrefixes:p}=e,x=c.join(".");if(v(x,p))return;let w=h(o),S=h(d),M=await g(null==w?void 0:w.hidden);if(M.hideSelf)return;let A=await g(null==S?void 0:S.hidden);if(A.hideSelf)return;let F=await s(a);if(await m(null==F?void 0:F.hidden,e=>e.call(F,r)))return;let k=new Set(p);for(let e of[...M.hideSubpaths,...A.hideSubpaths]){let t=e.trim();if(!t)continue;let l="ctx"===t?"":t.startsWith("ctx.")?t.slice(4):t;if(!l)continue;let n=x?`${x}.${l}`:l;k.add(n)}let C=await m(null==w?void 0:w.disabled,e=>e(r)),P=await f(null==w?void 0:w.disabledReason,e=>e(r)),j=await m(null==F?void 0:F.disabled,e=>e.call(F,r)),E=await f(null==F?void 0:F.disabledReason,e=>e.call(F,r)),R=await m(null==S?void 0:S.disabled,e=>e(r)),I=await f(null==S?void 0:S.disabledReason,e=>e(r)),T=void 0!==R?R:void 0!==j?j:C,_=void 0!==I?I:void 0!==E?E:P,D={};if(D={...D={...D={...D,...y(w)},...y(F)},...y(S)},void 0!==T&&(D.disabled=!!T),void 0!==_&&(D.disabledReason=_),u>=l)return Object.keys(D).length?D:void 0;let N=eB(null==w?void 0:w.properties)?w.properties:void 0;if(null==F?void 0:F.properties)try{let e=F.properties;if("function"==typeof e){let l=await e.call(F,r);F.properties=l,t=l}else eB(e)&&(t=e)}catch(e){t=void 0}if(eB(S)&&(null==S?void 0:S.properties))try{let e=S.properties;if("function"==typeof e){let t=await e.call(S,r);S.properties=t,n=t}else eB(e)&&(n=e)}catch(e){n=void 0}let O=new Set;if(N)for(let e of Object.keys(N))O.add(e);if(t)for(let e of Object.keys(t))O.add(e);if(n)for(let e of Object.keys(n))O.add(e);if(!O.size)return Object.keys(D).length?D:void 0;let $={};for(let e of O){if(i(e))continue;let l=await b({docNode:null==N?void 0:N[e],metaNode:null==t?void 0:t[e],infoNode:null==n?void 0:n[e],depth:u+1,pathFromRoot:[...c,e],hiddenPrefixes:k});l&&($[e]=l)}if(Object.keys($).length&&(D.properties=$),Object.keys(D).length)return D},x=async e=>{if(!e.length)return;let[t,...l]=e,n=this.getPropertyOptions(t);if(null==n?void 0:n.meta)try{if(!l.length)return n.meta;let e=await s(n.meta);if(!e)return;for(let t=0;t<l.length;t++){let n=l[t],i=null==e?void 0:e.properties;if(!i)break;if("function"==typeof i){let t=await i.call(e,r);e.properties=t,i=t}if(!i||"object"!=typeof i)break;let o=null==i?void 0:i[n];if(!o)break;if(t===l.length-1)return o;let a=await s(o);if(!a)break;e=a}return}catch(e){return}};if(!c&&u.length){let e={};for(let t of u){let l=t.split(".").map(e=>e.trim()).filter(Boolean);if(l.some(e=>i(e))||!l.length)continue;let n=await x(l),r=await b({docNode:void 0,metaNode:n,infoNode:void 0,depth:1,pathFromRoot:[],hiddenPrefixes:new Set});r&&(e[t]=r)}return e}let w=this._getPropertiesMeta(),S={};for(let[e,t]of Object.entries(w)){if(i(e))continue;let l=await b({docNode:void 0,metaNode:t,infoNode:void 0,depth:1,pathFromRoot:[e],hiddenPrefixes:new Set});l&&(S[e]=l)}return S}_getPropertiesMeta(){let e={};for(let t of this._delegates)Object.assign(e,t._getPropertiesMeta());for(let[t,l]of Object.entries(this._props))l.meta&&(e[t]=(l.meta,l.meta));return e}_getOwnProperty(e,t){let l=this._props[e];if(l){if("value"in l)return"api"===e?(0,I.k)(l.value,t):l.value;if(l.get){if(!1===l.cache){let n=l.get(t);return"api"===e?(0,I.k)(n,t):n}let n=l.observable?"_observableCache":"_cache";if(e in this[n])return"api"===e?(0,I.k)(this[n][e],t):this[n][e];if(this._pending[e])return this._pending[e];let r=l.get(this.createProxy());return"object"==typeof r&&null!==r&&"function"==typeof r.then||"function"==typeof r&&"function"==typeof r.then?(this._pending[e]=r.then(l=>(this[n][e]=l,delete this._pending[e],"api"===e?(0,I.k)(l,t):l),t=>{throw delete this._pending[e],t}),this._pending[e]):(this[n][e]=r,"api"===e?(0,I.k)(r,t):r)}}}_getOwnMethod(e,t){let l=this._methods[e];return"function"==typeof l?l.bind(t):l}_findPropertyInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return l._props[t];let e=this._findPropertyInDelegates(l._delegates,t);if(void 0!==e)return e}}_findInDelegates(e,t){for(let l of e){if(Object.prototype.hasOwnProperty.call(l._props,t))return{result:l._getOwnProperty(t,this.createProxy())};if(Object.prototype.hasOwnProperty.call(l._methods,t))return{result:l._getOwnMethod(t,this.createProxy())};let e=this._findInDelegates(l._delegates,t);if(void 0!==e)return e}}_hasInDelegates(e,t){for(let l of e)if(Object.prototype.hasOwnProperty.call(l._props,t)||Object.prototype.hasOwnProperty.call(l._methods,t)||this._hasInDelegates(l._delegates,t))return!0;return!1}getPropertyOptions(e){return Object.prototype.hasOwnProperty.call(this._props,e)?this._props[e]:this._findPropertyInDelegates(this._delegates,e)}constructor(){return(0,a._)(this,ed),(0,a._)(this,eu),(0,a._)(this,ec),(0,a._)(this,ep),(0,a._)(this,eh),(0,a._)(this,em),(0,a._)(this,ef),(0,a._)(this,eg),(0,s._)(this,"_props",{}),(0,s._)(this,"_methods",{}),(0,s._)(this,"_methodInfos",{}),(0,s._)(this,"_cache",{}),(0,s._)(this,"_observableCache",d.observable.shallow({})),(0,s._)(this,"_delegates",[]),(0,s._)(this,"_pending",{}),(0,r._)(this,es,{writable:!0,value:null}),(0,s._)(this,"_metaNodeCache",new WeakMap),this.createProxy()}}function ey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0;return"function"==typeof e?async()=>{let r=await e();n&&(n.properties=r);let i=Object.entries(r);return i.sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}),i.map(e=>{let[n,r]=e;return(0,o._)(this,eg,eA).call(this,n,r,[...t,n],l)})}:Object.entries(e).sort((e,t)=>{let[,l]=e,[,n]=t;return((null==n?void 0:n.sort)??0)-((null==l?void 0:l.sort)??0)}).map(e=>{let[n,r]=e;return(0,o._)(this,eg,eA).call(this,n,r,[...t,n],l)})}function eb(e){if(0===e.length)return null;let[t,...l]=e,n=this._props[t];if(null==n?void 0:n.meta)return(0,o._)(this,ep,ew).call(this,t,n.meta,l,[t]);let r=(0,o._)(this,ec,ex).call(this,this._delegates,t);return r?(0,o._)(this,ep,ew).call(this,t,r,l,[t]):null}function ex(e,t){for(let l of e){let e=l._props[t];if(null==e?void 0:e.meta)return e.meta;let n=(0,o._)(this,ec,ex).call(this,l._delegates,t);if(n)return n}return null}function ew(e,t,l,n){if(0===l.length)return[e,t,n];if("function"==typeof t)return[l[l.length-1],async()=>{let e=await t();return await (0,o._)(this,em,eS).call(this,e,l)},[...n,...l]];if(t.properties){let[e,...r]=l,i=[...n,e];if("function"==typeof t.properties)return[l[l.length-1],async()=>{let l=t.properties,n=await l();t.properties=n;let i=n[e];if(!i)throw Error(`Property ${e} not found in resolved properties`);return await (0,o._)(this,em,eS).call(this,i,r)},[...n,...l]];let a=t.properties[e];if(a)return(0,o._)(this,ep,ew).call(this,e,a,r,i)}return null}async function eS(e,t){if(0===t.length)return e;let l=e;for(let e of t){let n=h().get(l,"properties");if(!n)throw Error(`Property path not found: ${t.join(".")}`);if("function"==typeof n){let e=await n();l.properties=e,n=e}let r=n[e];if(!r)throw Error(`Property ${e} not found while resolving path: ${t.join(".")}`);l=r}return l}function eM(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(0===e.length)return[];let l=t?e.slice(0,-1):e;if(0===l.length)return[];let n=[],r=this._getPropertiesMeta();for(let e=0;e<l.length;e++){let t=l[e],i=r[t];if(!i||"function"==typeof i){n.push(t);break}if(n.push(i.title||t),e<l.length-1&&i.properties&&"function"!=typeof i.properties)r=i.properties;else if(e<l.length-1){for(let t=e+1;t<l.length;t++)n.push(l[t]);break}}return n}function eA(e,t){let l,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[e],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=this._metaNodeCache.get(t);if(i)return i.paths=n,i.parentTitles=r.length>0?r:void 0,i;let a=e=>{if(!e)return{disabled:!1,hidden:!1};let t="function"==typeof e.disabled?e.disabled():e.disabled,l="function"==typeof e.disabledReason?e.disabledReason():e.disabledReason,n="function"==typeof e.hidden?e.hidden():e.hidden;return{disabled:!(t&&"function"==typeof t.then)&&!!t,reason:l&&"function"==typeof l.then?void 0:l,hidden:!(n&&"function"==typeof n.then)&&!!n}};if("function"==typeof t){let i=e,s=t.hasChildren;l={name:e,title:t.title||i,type:"object",interface:void 0,options:void 0,uiSchema:void 0,paths:n,parentTitles:r.length>0?r:void 0,disabled:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).disabled},disabledReason:()=>{let e=t();if(!e||"function"!=typeof e.then)return a(e).reason},hidden:()=>{let e=t();return(!e||"function"!=typeof e.then)&&a(e).hidden},children:!1===s?void 0:async()=>{try{let i=await t(),a=(null==i?void 0:i.title)||e;if(l.title=a,l.type=null==i?void 0:i.type,l.interface=null==i?void 0:i.interface,l.options=null==i?void 0:i.options,l.uiSchema=null==i?void 0:i.uiSchema,!(null==i?void 0:i.properties))return[];let s=(0,o._)(this,ed,ey).call(this,i.properties,n,[...r,a],i),d=Array.isArray(s)?s:await s();return l.children=d,d}catch(t){return console.warn(`Failed to load meta for ${e}:`,t),[]}}}}else{let i=t.title,{disabled:s,reason:d,hidden:u}=a(t);l={name:e,title:i,type:t.type,interface:t.interface,options:t.options,uiSchema:t.uiSchema,paths:n,parentTitles:r.length>0?r:void 0,disabled:s,disabledReason:d,hidden:u,children:t.properties?(0,o._)(this,ed,ey).call(this,t.properties,n,[...r,i],t):void 0}}return this._metaNodeCache.set(t,l),l}class eF extends ev{constructor(){super(),this.defineMethod("getModel",(e,t)=>this.engine.getModel(e,t)),this.defineMethod("request",function(e){let t=this.app;return"string"==typeof(null==e?void 0:e.url)&&en(e.url,t)?u.A.request(e):this.api.request(e)}),this.defineMethod("runjs",async function(e,t,l){let{preprocessTemplates:n,...r}=l||{},i={...(null==r?void 0:r.globals)||{},...t||{}},o=await this.createJSRunner({...r||{},globals:i}),a=(0,k.R)({version:null==r?void 0:r.version,preprocessTemplates:n}),s=await (0,P.ji)(String(e??""),{preprocessTemplates:a});return o.run(s)},{description:"Execute a RunJS code string in the current Flow context.",detail:"(code: string, variables?: Record<string, any>, options?: JSRunnerOptions) => Promise<RunJSResult>",params:[{name:"code",type:"string",description:"RunJS code to execute."},{name:"variables",type:"Record<string, any>",optional:!0,description:"Additional globals."},{name:"options",type:"JSRunnerOptions",optional:!0,description:"Runner options."}],returns:{type:"Promise<{ success: boolean; value?: any; error?: any; timeout?: boolean }>"},completion:{insertText:"await ctx.runjs('return 1')"}})}}class ek extends eF{}let eC=["dataSourceKey","collectionName","associationName","filterByTk","sourceId","tabUid"];function eP(e,t){let l={};for(let n of t)void 0!==(null==e?void 0:e[n])&&(l[n]=e[n]);return l}function ej(e){return eP(e,eC)}function eE(e,t){for(let[l,n]of Object.entries(t))void 0===e[l]&&(e[l]=n)}class eR extends eF{constructor(e){if(!(e instanceof A.$))throw Error("Invalid FlowEngine instance");super(),(0,s._)(this,"engine",void 0),this.engine=e,this.engine=e;let t=new M.zA;t.setFlowEngine(this.engine);let n=new M.qS({key:"main",displayName:"Main"});t.addDataSource(n),this.defineProperty("engine",{value:this.engine,info:{description:"FlowEngine instance.",detail:"FlowEngine"}}),this.defineProperty("sql",{get:e=>new C.tP(e),cache:!1,info:{description:"SQL helper (FlowSQLRepository).",detail:"FlowSQLRepository"}}),this.defineProperty("dataSourceManager",{value:t,info:{description:"DataSourceManager instance.",detail:"DataSourceManager"}});let r=new F(this);this.defineMethod("t",(e,t)=>r.translate(e,t)),this.defineProperty("locale",{get:()=>{var e,t,l;return(null==(t=this.api)||null==(e=t.auth)?void 0:e.locale)||(null==(l=this.i18n)?void 0:l.language)},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current language"),sort:970}),{title:(0,P.MI)("Current language"),sort:970,hasChildren:!1})}),this.defineMethod("renderJson",function(e){return this.resolveJsonTemplate(e)});let i=async function(e,t){let l=(0,P.nN)(e),n=Object.keys(l||{});if(!n.length)return(0,P.M)(e,this);let r={};for(let e of n){let t=l[e]||[],n=this.getPropertyOptions(e),i=null==n?void 0:n.resolveOnServer;if(!0===i)r[e]=t;else if("function"==typeof i){let l=t.filter(e=>{try{return!!i(e)}catch(e){return!1}});l.length&&(r[e]=l)}}let i=Object.keys(r).length>0,o=e;if(i){let l=e=>{let t=(0,T.XU)(e);if(t)return t;try{var l,n,r,i,o,a,s,d,u,c,p,h,m;let t=null==e||null==(n=e.resource)||null==(l=n.getMeta)?void 0:l.call(n,"currentFilterByTk");if(null==t)return;let f=(null==e||null==(r=e.collection)?void 0:r.name)||(null==e||null==(c=e.resource)||null==(u=c.getResourceName)||null==(d=u.call(c))||null==(s=d.split)||null==(a=s.call(d,"."))||null==(o=a.slice)||null==(i=o.call(a,-1))?void 0:i[0]);if(!f)return;let g=(null==e||null==(p=e.collection)?void 0:p.dataSourceKey)||(null==e||null==(m=e.resource)||null==(h=m.getDataSourceKey)?void 0:h.call(m));return{collection:f,dataSourceKey:g,filterByTk:t}}catch(e){return}},n=async()=>{let e={};try{var t,l;let n=null==(t=(l=this)._getPropertiesMeta)?void 0:t.call(l);if(!n||"object"!=typeof n)return e;for(let[t,l]of Object.entries(n))if(r[t])try{let n;if("function"==typeof l){let e=l;n=await e()}else n=l;if(!n||"object"!=typeof n)continue;let i=n.buildVariablesParams;if("function"!=typeof i)continue;let o=await i(this);if(!o)continue;let a=r[t]||[],s=ei(o,a);s&&("object"!=typeof s||Object.keys(s).length)&&(e[t]=s)}catch(e){}}catch(e){}return e},i=await n(),u={...i},c=r.view||[];if(!u.view&&c.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let e=(0,T.Cg)(this);e&&(u.view={record:e})}try{let e="formValues",t=r[e]||[];if(t.length){let n=new Set;for(let e of t){let t=eo(e);t&&n.add(t)}let r=null==i?void 0:i[e],o=new Set;if(!r||"object"!=typeof r||Array.isArray(r)||er(r)||Object.keys(r).forEach(e=>o.add(e)),[...n].filter(e=>!o.has(e)).length){let n=l(this);if(n){let{generatedFields:l,generatedAppends:r}=ea(t),i={...n,fields:l,appends:r},o=u[e];if(o&&"object"==typeof o&&!Array.isArray(o)&&!er(o)){for(let[t,l]of Object.entries(o))u[`${e}.${t}`]=l;delete u[e]}u[e]=i}}}}catch(e){}let p=Object.keys(u).length?(0,R.d)(this,u):void 0;if(!p){let t=Object.keys(r);if(t.length>0&&t.every(e=>{var t;return null==(t=this.getPropertyOptions(e))?void 0:t.serverOnlyWhenContextParams}))return(0,P.M)(e,this)}if(this.api){var a,s,d;try{let l=(0,E.pk)(this,null==t?void 0:t.contractModelUid);o=await (0,E.o4)(this,{...l?{contractRd:l}:{},rd:(0,E.pk)(this,null==(a=this.model)?void 0:a.uid),template:e,contextParams:p||{}})}catch(t){null==(d=this.logger)||null==(s=d.warn)||s.call(d,{err:t},"variables:resolve failed, fallback to client-only"),o=e}}}return(0,P.M)(o,this)};this.defineMethod("resolveJsonTemplate",i),this.defineMethod("getVar",async function(e){let t=("string"==typeof e?e:String(e??"")).trim();if(t){if("ctx"!==t&&!t.startsWith("ctx."))throw Error(`ctx.getVar(path) expects an expression starting with "ctx.", got: "${t}"`);return this.resolveJsonTemplate(`{{ ${t} }}`)}},'Resolve a ctx expression value by path (expression starts with "ctx.").'),this.defineProperty("requirejs",{get:()=>{var e,t;return null==(t=this.app)||null==(e=t.requirejs)?void 0:e.requirejs}}),this.defineProperty("token",{get:()=>{var e,t;return null==(t=this.api)||null==(e=t.auth)?void 0:e.token},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("API Token"),sort:980}),{title:"API Token",sort:980,hasChildren:!1})}),this.defineProperty("role",{get:()=>{var e,t,l;let n=null==(t=this.api)||null==(e=t.auth)?void 0:e.role;if("__union__"!==n)return n;let r=null==(l=this.user)?void 0:l.roles;return Array.isArray(r)?r.map(e=>null==e?void 0:e.name).filter(e=>!!e):[]},cache:!1,meta:Object.assign(()=>({type:"string",title:this.t("Current role"),sort:990}),{title:(0,P.MI)("Current role"),sort:990,hasChildren:!1})}),this.defineProperty("urlSearchParams",{cache:!1,get:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return f().parse(l)||{}},meta:Object.assign(()=>({type:"object",title:this.t("URL search params"),sort:970,disabled:()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t;return 0===Object.keys(f().parse(l)||{}).length},disabledReason:()=>this.t("The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string."),properties:async()=>{var e;let t=(null==(e=this.location)?void 0:e.search)||"",l=t.startsWith("?")?t.slice(1):t,n=f().parse(l)||{},r={};for(let e of Object.keys(n))r[e]={type:"string",title:e};return r}}),{title:(0,P.MI)("URL search params"),sort:970,hasChildren:!0})}),this.defineProperty("logger",{get:()=>this.engine.logger.child({module:"flow-engine"})}),this.defineProperty("auth",{get:()=>{var e,t,l,n,r,i;return{roleName:null==(t=this.api)||null==(e=t.auth)?void 0:e.role,locale:null==(n=this.api)||null==(l=n.auth)?void 0:l.locale,token:null==(i=this.api)||null==(r=i.auth)?void 0:r.token,user:this.user}},cache:!1}),this.defineProperty("date",{get:()=>{let e=t=>new Proxy({},{get:(l,n)=>{if("string"!=typeof n)return;let r=[...t,n];if(!(0,P.JE)(r))return;let i=(0,P.Vv)(r);return void 0!==i?i:e(r)}});return e(["date"])},cache:!1}),this.defineMethod("loadCSS",async e=>{let t=(0,P.i)(e);return new Promise((e,l)=>{if(document.querySelector(`link[href="${t}"]`))return void e(null);let n=document.createElement("link");n.rel="stylesheet",n.href=t,n.onload=()=>e(null),n.onerror=()=>l(Error(`Failed to load CSS: ${t}`)),document.head.appendChild(n)})},{description:"Load a CSS file by URL (browser only).",params:[{name:"href",type:"string",description:"CSS URL."}],returns:{type:"Promise<void>"},completion:{insertText:"await ctx.loadCSS('https://example.com/style.css')"},examples:["await ctx.loadCSS('https://example.com/style.css');"]}),this.defineMethod("requireAsync",async e=>{if((0,P.yp)(e))return this.loadCSS(e);let t=(0,P.i)(e,{raw:!0});return await Y(this.requirejs,t)}),this.defineMethod("importAsync",async function(e){return(0,P.yp)(e)?this.loadCSS(e):await et(this,e,{importer:G})}),this.defineMethod("createJSRunner",async function(e){try{let e=await Promise.resolve().then(l.bind(l,88828));"function"==typeof(null==e?void 0:e.setupRunJSContexts)&&await e.setupRunJSContexts()}catch(e){}let t=(null==e?void 0:e.version)||"v1",n=(0,_.B)(this),r=_.F.resolve(t,n)||eX,i=new r(this);i.defineMethod("t",(e,t)=>this.t(e,{ns:"runjs",...t}));let o={};try{var a,s,d,u,c,p,h,m;let e=(null==(d=this)||null==(s=d.api)||null==(a=s.auth)?void 0:a.locale)||(null==(c=this)||null==(u=c.i18n)?void 0:u.language)||(null==(p=this)?void 0:p.locale);o=(null==r||null==(h=r.getDoc)?void 0:h.length)?r.getDoc(e)||{}:(null==r||null==(m=r.getDoc)?void 0:m.call(r))||{}}catch(e){o={}}let f={ctx:eW(i,{doc:o}),...(null==e?void 0:e.globals)||{}},{timeoutMs:g}=e||{};return new k.I({globals:f,timeoutMs:g})}),this.defineMethod("buildServerContextParams",function(e){return(0,R.d)(this,e)}),this.defineMethod("getAction",function(e){return this.engine.getAction(e)}),this.defineMethod("getActions",function(){return this.engine.getActions()}),this.defineMethod("getEvents",function(){return this.engine.getEvents()}),this.defineMethod("runAction",async function(e,t){let l=this.engine.getAction(e),n=await (0,D.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let r={...await (0,P.gG)(l.defaultParams,n)||{},...t||{}},i=l.useRawParams;if("function"==typeof i&&(i=await i(n)),i||(r=await n.resolveJsonTemplate(r)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,r)}),this.defineProperty("acl",{get:()=>new x(this.engine)}),this.defineMethod("aclCheck",function(e){return!!this.skipAclCheck||this.acl.aclCheck(e)}),this.defineMethod("createResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("makeResource",function(e){return this.engine.createResource(e,{context:this.createProxy()})}),this.defineMethod("initResource",function(e){return this.has("resource")||this.defineProperty("resource",{get:()=>this.createResource(e)}),this.resource}),this.defineMethod("useResource",function(e){return this.initResource(e)})}}class eI extends ek{constructor(e){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),this.addDelegate(e.flowEngine.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{value:e,info:{description:"Current FlowModel instance.",detail:"FlowModel"}});let t=(0,g.createRef)();this.defineProperty("ref",{get:()=>(this.model._refCreated=!0,t),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}}),this.defineMethod("openView",async function(e,t){var l,n,r,i;let o={..."function"==typeof(null==(l=this.model)?void 0:l.getInputArgs)?ej(this.model.getInputArgs()):{},...ej(this.inputArgs)},a={...t||{}};eE(a,o),(a.defineProperties||a.defineMethods)&&(a.navigation=!1);let s=null;(s=await this.engine.loadModel({uid:e}))||(s=this.engine.createModel({uid:e,use:"PopupActionModel",parentId:this.model.uid,subType:"object",subKey:e,stepParams:{popupSettings:{openView:{...eP(a,["dataSourceKey","collectionName","associationName","mode","size"])}}}}),await s.save()),s.setParent(this.model);let d=(null==a?void 0:a.routeViewUid)??(null==a?void 0:a.viewUid)??((null==(r=s.stepParams)||null==(n=r.popupSettings)?void 0:n.openView)?s.uid:this.model.uid),u=this.view,c={type:(null==a?void 0:a.isMobileLayout)?"embed":(null==a?void 0:a.mode)||"drawer",inputArgs:{...a,viewUid:d,navigation:a.navigation},navigation:null==u?void 0:u.navigation,preventClose:!!(null==a?void 0:a.preventClose),engineCtx:this.engine.context};s.context.defineProperty("view",{value:c});let p=null==(i=s.getFlow)?void 0:i.call(s,"popupSettings"),h=null==p?void 0:p.on,m="click";"string"==typeof h&&h?m=h:h&&"object"==typeof h&&"string"==typeof h.eventName&&h.eventName&&(m=h.eventName),await s.dispatchEvent(m,{...a})}),this.defineMethod("getEvents",function(){return this.model.getEvents()}),this.defineMethod("getAction",function(e){return this.model.getAction(e)}),this.defineMethod("getActions",function(){return this.model.getActions()}),this.defineMethod("runAction",async function(e,t){let l=this.model.getAction(e),n=await (0,D.v)(this,l);if(!l)throw Error(`Action '${e}' not found.`);let r={...await (0,P.gG)(l.defaultParams,n)||{},...t||{}},i=l.useRawParams;if("function"==typeof i&&(i=await i(n)),i||(r=await n.resolveJsonTemplate(r)),!l.handler)throw Error(`Action '${e}' has no handler.`);return l.handler(n,r)})}}class eT extends ek{constructor(e,t){if(!e||"object"!=typeof e)throw Error("Invalid FlowModel instance");super(),(0,s._)(this,"master",void 0),(0,s._)(this,"fork",void 0),this.master=e,this.fork=t,this.addDelegate(this.master.context),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)}),this.defineProperty("model",{get:()=>this.fork,info:{description:"Current ForkFlowModel instance (as model).",detail:"ForkFlowModel"}});let l=(0,g.createRef)();this.defineProperty("ref",{get:()=>(this.fork._refCreated=!0,l),info:{description:"Stable React ref for the view container.",detail:"React.RefObject<HTMLDivElement>"}})}}class e_ extends ek{_getOwnProperty(e){if("runtime"===this.mode)return super._getOwnProperty(e,this.createProxy());let t=this._props[e];if(t){if("value"in t)return S.create()[e];if(t.get){if(!1===t.cache)return S.create()[e];let l=t.observable?"_observableCache":"_cache";return e in this[l]||(this[l][e]=S.create()[e]),this[l][e]}}}exit(){throw new j.zz(this.flowKey,this.model.uid)}exitAll(){throw new j.zz(this.flowKey,this.model.uid)}get mode(){return this._mode}constructor(e,t,l="runtime"){super(),(0,s._)(this,"model",void 0),(0,s._)(this,"flowKey",void 0),(0,s._)(this,"_mode",void 0),(0,s._)(this,"stepResults",void 0),this.model=e,this.flowKey=t,this._mode=l,this.stepResults={},this.addDelegate(this.model.context),this.defineMethod("getStepParams",l=>e.getStepParams(t,l)||{}),this.defineMethod("setStepParams",(l,n)=>e.setStepParams(t,l,n)),this.defineMethod("getStepResults",e=>h().get(this.steps,[e,"result"])),this.defineMethod("initResource",t=>{e.context.has("resource")?console.log(`[FlowRuntimeContext] useResource - resource already defined in context: ${t}`):(e.context.defineProperty("resource",{get:()=>this.makeResource(t)}),e.resource||(e.resource=e.context.resource))}),this.defineMethod("useResource",e=>this.initResource(e)),this.defineProperty("resource",{get:()=>e.resource||e.context.resource,cache:!1}),this.defineMethod("onRefReady",(e,t,l)=>{this.engine.reactView.onRefReady(e,t,l)})}}let eD=new WeakMap,eN=new WeakMap,eO=new WeakMap;function e$(e,t){if(null===t)return;if(Array.isArray(e)||Array.isArray(t)||"object"!=typeof e||"object"!=typeof t)return t??e;let l={...e};for(let n of Object.keys(t)){let r=e$(null==e?void 0:e[n],t[n]);void 0===r?delete l[n]:l[n]=r}return l}function eB(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eL(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function eq(e){return!0===e||(e&&eB(e)?e:void 0)}function eV(e,t,l){if(!Array.isArray(t)||!t.length)return;let n=e;for(let e of t){if(!e)return;n.children=n.children||{},n.children[e]=n.children[e]||{},n=n.children[e]}n.deprecated=l}function ez(e,t){void 0!==t.deprecated&&(e.deprecated=t.deprecated);let l=t.children||{},n=Object.keys(l);if(n.length)for(let t of(e.children=e.children||{},n))e.children[t]=e.children[t]||{},ez(e.children[t],l[t])}function eK(e){let t={};if(!e)return t;let l=(e,n)=>{if(eB(e))for(let[r,i]of Object.entries(e)){if(!r||!i||"object"!=typeof i||Array.isArray(i))continue;let e=i,o=eq(e.deprecated);o&&eV(t,[...n,r],o),eB(e.properties)&&l(e.properties,[...n,r])}},n=e=>{if(eB(e))for(let[l,n]of Object.entries(e)){if(!l||!n||"object"!=typeof n||Array.isArray(n))continue;let e=eq(n.deprecated);e&&eV(t,[l],e)}};return l(e.properties,[]),n(e.methods),t}function eU(e){let t={},l=new WeakSet,n=(e,l)=>{if(eB(l))for(let[r,i]of Object.entries(l)){if(!r||"string"==typeof i||!i||"object"!=typeof i||Array.isArray(i))continue;let l=i,o=eq(l.deprecated);o&&eV(t,[...e,r],o),eB(l.properties)&&n([...e,r],l.properties)}},r=e=>{if(!e||"object"!=typeof e&&"function"!=typeof e||l.has(e))return;l.add(e);let i=e._methodInfos;if(eB(i))for(let[e,l]of Object.entries(i)){if(!e||!l||"object"!=typeof l||Array.isArray(l))continue;let n=eq(l.deprecated);n&&eV(t,[e],n)}let o=e._props;if(eB(o))for(let[e,l]of Object.entries(o)){if(!e)continue;let r=null==l?void 0:l.info;if(!r||"object"!=typeof r||Array.isArray(r))continue;let i=eq(r.deprecated);i&&eV(t,[e],i),eB(r.properties)&&n([e],r.properties)}let a=e._delegates;if(Array.isArray(a))for(let e of a)r(e)};return r(e),t}function eW(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=eK(t.doc);ez(l,eU(e));let n=new Set,r=new WeakMap,i=new WeakMap,o=new WeakMap,a=e=>{if(!e||"string"!=typeof e)return{};let t=2;for(let l of e.split("\n")){if(!l)continue;let e=l.match(/<anonymous>:(\d+):(\d+)/);if(!e)continue;let n=Number(e[1]),r=Number(e[2]);return{line:Number.isFinite(n)&&n>t?n-t:n,column:Number.isFinite(r)?r:void 0,rawLine:n,rawColumn:r}}return{}},s=(e,t)=>{if(eB(t))for(let[n,r]of Object.entries(t)){if(!n||"string"==typeof r||!r||"object"!=typeof r||Array.isArray(r))continue;let t=r,i=eq(t.deprecated);i&&eV(l,[...e,n],i),eB(t.properties)&&s([...e,n],t.properties)}},d=(e,t)=>{if(!e)return;let n=null==t?void 0:t.info;if(!n||"object"!=typeof n||Array.isArray(n))return;let r=eq(n.deprecated);r&&eV(l,[e],r),eB(n.properties)&&s([e],n.properties)},u=(e,t)=>{if(!e||!t||"object"!=typeof t||Array.isArray(t))return;let n=eq(t.deprecated);n&&eV(l,[e],n)},c=e=>{let t=e;for(;t&&("object"==typeof t||"function"==typeof t);){let e=r.get(t);if(!e)break;t=e}return t},p=e=>{if(e){if("string"==typeof e)return e.trim()||void 0;if(Array.isArray(e)){let t=e.map(e=>"string"==typeof e?e.trim():"").filter(Boolean);return t.length?t.join(", "):void 0}}},h=(t,l,r)=>{if(!t||n.has(t))return;n.add(t);let i=null==e?void 0:e.logger,o="function"==typeof(null==e?void 0:e.t)?(t,l)=>e.t(t,{ns:[P.u4,"client"],nsMode:"fallback",...l}):(e,t)=>{let l=(null==t?void 0:t.defaultValue)??e;return"string"==typeof l&&t?l.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(e,l)=>{let n=null==t?void 0:t[l];return"string"==typeof n||"number"==typeof n?String(n):""}):l},s="object"==typeof l&&l?l:{},d=p(s.replacedBy),u="string"==typeof s.since?String(s.since):void 0,c="string"==typeof s.removedIn?String(s.removedIn):void 0,h="string"==typeof s.message?String(s.message):"",m=a(r),f=m.line?`(line ${m.line}${m.column?`:${m.column}`:""})`:"",g=h.trim(),v=g?o("RunJS deprecated warning with message",{defaultValue:"[RunJS][Deprecated] {{api}} {{message}}{{location}}",api:t,message:g,location:f}):o("RunJS deprecated warning",{defaultValue:"[RunJS][Deprecated] {{api}} is deprecated{{location}}",api:t,location:f}),y=o("RunJS deprecated separator",{defaultValue:"; "}),b=[v];d&&b.push(o("RunJS deprecated replacedBy",{defaultValue:"Use {{replacedBy}} instead",replacedBy:d})),u&&b.push(o("RunJS deprecated since",{defaultValue:"since {{since}}",since:u})),c&&b.push(o("RunJS deprecated removedIn",{defaultValue:"will be removed in {{removedIn}}",removedIn:c}));let x=b.filter(Boolean).join(y);try{i&&"function"==typeof i.warn?i.warn(x):console.warn(x)}catch(e){}},m=(e,t,l)=>{let r=t.deprecated;if(!r)return e;let i=o.get(e)||new Map;if(o.set(e,i),i.has(l))return i.get(l);let a=new Proxy(e,{apply(e,t,i){let o=n.has(l)?void 0:Error().stack;return h(l,r,o),Reflect.apply(e,c(t),i)},get:(e,t,l)=>Reflect.get(e,t,l)});return i.set(l,a),a},f=(e,t,l)=>{if(!e||"object"!=typeof e&&"function"!=typeof e||eL(e)||!(t.children&&Object.keys(t.children).length>0)&&"ctx"!==l)return e;let o=i.get(e)||new Map;if(i.set(e,o),o.has(l))return o.get(l);let a=new Proxy(e,{get(e,r,i){var o;if("symbol"==typeof r)return Reflect.get(e,r,c(i));let a=String(r),s=Reflect.get(e,r,c(i));if("ctx"===l&&"defineProperty"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{d(String((null==t?void 0:t[0])??""),null==t?void 0:t[1])}catch(e){}return n};if("ctx"===l&&"defineMethod"===a&&"function"==typeof s)return function(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];let n=s(...t);try{u(String((null==t?void 0:t[0])??""),null==t?void 0:t[2])}catch(e){}return n};let p=null==(o=t.children)?void 0:o[a];if(!p)return s;let g=`${l}.${a}`;if("function"==typeof s&&p.deprecated)return m(s,p,g);if(p.deprecated){let e=n.has(g)?void 0:Error().stack;h(g,p.deprecated,e)}return s&&("object"==typeof s||"function"==typeof s)&&p.children?f(s,p,g):s},has:(e,t)=>Reflect.has(e,t)});return r.set(a,e),o.set(l,a),a};return f(e,l,"ctx")}function eH(e,t,l){if(!eB(t))return e;if(!eB(e))return t;let n={...e};for(let r of Object.keys(t)){let i=t[r];if(null===i){delete n[r];continue}let o=l(eB(e)?e[r]:void 0,i);void 0===o?delete n[r]:n[r]=o}return n}function eY(e,t){if(null===t)return;let l=eB(e),n=eB(t),r="string"==typeof e;if("string"==typeof t)return l?eY(e,{description:t}):t;if(n){let n=l?e:r?{description:e}:void 0,i={...n||{}};for(let e of Object.keys(t)){if("properties"===e){let e=t.properties;if(null===e){delete i.properties;continue}let l=eH(null==n?void 0:n.properties,e,eY);void 0===l?delete i.properties:i.properties=l;continue}let l=e$(null==n?void 0:n[e],t[e]);void 0===l?delete i[e]:i[e]=l}return i}return t??e}function eG(e,t){if(null===t)return;let l=eB(e),n=eB(t),r="string"==typeof e;if("string"==typeof t)return l?eG(e,{description:t}):t;if(n){let n=l?e:r?{description:e}:void 0,i={...n||{}};for(let e of Object.keys(t)){let l=e$(null==n?void 0:n[e],t[e]);void 0===l?delete i[e]:i[e]=l}return i}return t??e}function eJ(e,t){let l=eB(e)?e:{},n=eB(t)?t:{},r={...l};for(let e of Object.keys(n)){if("properties"===e){let e=eH(l.properties,n.properties,eY);void 0===e?delete r.properties:r.properties=e;continue}if("methods"===e){let e=eH(l.methods,n.methods,eG);void 0===e?delete r.methods:r.methods=e;continue}let t=e$(l[e],n[e]);void 0===t?delete r[e]:r[e]=t}return r}class eX extends ev{exit(){var e;throw new j.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}exitAll(){var e;throw new j.zz(this.flowKey,(null==(e=this.model)?void 0:e.uid)||"runjs")}static define(e,t){let l=null==t?void 0:t.locale;if(l){let t=eN.get(this)||new Map,n=t.get(l)||{};t.set(l,eJ(n,e)),eN.set(this,t)}else{let t=eD.get(this)||{};eD.set(this,eJ(t,e))}eO.delete(this)}static getDoc(e){let t=this,l=eO.get(t),n=String(e||"default");if(l&&l.has(n))return l.get(n);let r=[],i=t;for(;i&&i.prototype;)r.unshift(i),i=Object.getPrototypeOf(i);let o={};for(let e of r)o=eJ(o,eD.get(e)||{});if(e)for(let t of r){let l=eN.get(t);l&&l.has(e)&&(o=eJ(o,l.get(e)))}return l||(l=new Map,eO.set(t,l)),l.set(n,o),o}constructor(e){super(),this.addDelegate(e),this.defineProperty("React",{value:g}),this.defineProperty("antd",{value:c}),this.defineProperty("dayjs",{value:O()});let t={...y,createRoot:(e,t)=>{let l=(null==e?void 0:e.__el)||e;return this.engine.reactView.createRoot(l,t)}};t.__nbRunjsInternalShim=!0,this.defineProperty("ReactDOM",{value:t}),(0,$.oJ)(this),this.defineMethod("openView",async function(t,l){let n=e.openView;if("function"!=typeof n)throw Error("ctx.openView is not available in current context.");let r=(0,P.cg)(l);return n(t,r?{...l||{},[P.sU]:r}:l)}),this.defineMethod("render",function(e,t){let l=t||this.element;if(!l)throw Error("ctx.render: container not provided and ctx.element is not available");let n=(null==l?void 0:l.__el)||l,r=globalThis;r.__nbRunjsRoots=r.__nbRunjsRoots||new WeakMap;let i=r.__nbRunjsRoots,o=e=>{if(!e)return;if(e.disposeTheme&&"function"==typeof e.disposeTheme){try{e.disposeTheme()}catch(e){}e.disposeTheme=void 0}let t=e.root||e;if(t&&"function"==typeof t.unmount)try{t.unmount()}catch(e){}},a=()=>{let e=i.get(n);e&&(o(e),i.delete(n))};if("string"==typeof e)return a(),new b.x(n).innerHTML=String(e??""),null;if(e&&e.nodeType&&(1===e.nodeType||3===e.nodeType||11===e.nodeType)){for(a();n.firstChild;)n.removeChild(n.firstChild);return n.appendChild(e),null}let s=this.ReactDOM,d=this,u=i.get(n);return u&&u.rendererKey===s&&u.ownerKey===d||(u&&(o(u),i.delete(n)),u={rendererKey:s,ownerKey:d,root:this.ReactDOM.createRoot(n),disposeTheme:void 0,lastVnode:void 0},i.set(n,u)),(0,$.$B)({ctx:this,entry:u,vnode:e,containerEl:n,rootMap:i,unmountContainerRoot:a,internalReact:g,internalAntd:c})})}}},48910(e,t,l){l.d(t,{$:()=>eD});var n=l(88243),r=l(16213),i=l(50467),o=l(95243),a=l(2543),s=l.n(a),d=l(81318),u=l.n(d),c=l(64171);class p extends c.Z{getAction(e){return this.actions.get(e)}getActions(){return new Map(this.actions)}}var h=l(26955);class m extends h.L{getEvent(e){return this.events.get(e)}getEvents(){return new Map(this.events)}}var f=l(29007),g=l(60182),v=l(31108),y=l(88439),b=l(62572);class x{async emitModelEventIf(e,t,l){e&&await this.engine.emitter.emitAsync(`model:event:${e}:${t}`,l)}async withApplyFlowCache(e,t){if(!e||!this.engine)return await t();let l=this.engine.applyFlowCache.get(e);if(l){if("resolved"===l.status)return l.data;if("rejected"===l.status)throw l.error;if("pending"===l.status)return await l.promise}let n=t().then(t=>(this.engine.applyFlowCache.set(e,{status:"resolved",data:t,promise:Promise.resolve(t)}),t)).catch(t=>{throw this.engine.applyFlowCache.set(e,{status:"rejected",error:t,promise:Promise.reject(t)}),t});return this.engine.applyFlowCache.set(e,{status:"pending",promise:n}),await n}async runFlow(e,t,l,n,r){var i;let o,a=e.getFlow(t);if(!a)return e.context.logger.error(`BaseModel.applyFlow: Flow with key '${t}' not found.`),Promise.reject(Error(`Flow '${t}' not found.`));let d=new f.W5(e,t);d.defineProperty("reactView",{value:e.reactView}),d.defineProperty("inputArgs",{value:{...l}}),d.defineProperty("runId",{value:n||`run-${Date.now()}`});let u=d.stepResults,c=e.getEvent("string"==typeof a.on?a.on:null==(i=a.on)?void 0:i.eventName);c&&((c={...c}).defaultParams={...s().get(a,"on.defaultParams",{}),...c.defaultParams});let p=c?{eventStep:c,...a.steps}:a.steps;(0,y.w)(d,p,e,t);let h=d.steps,m={uid:e.uid,model:e,runId:d.runId,inputArgs:l,flowKey:t};for(let[l,n]of(await this.emitModelEventIf(r,`flow:${t}:start`,m),Object.entries(p))){let i,a,s={},c=n.useRawParams;if(n.use){let r=e.getAction(n.use);if(!r){d.logger.error(`BaseModel.applyFlow: Action '${n.use}' not found for step '${l}' in flow '${t}'. Skipping.`);continue}a=await (0,b.v)(d,{...r,...n}),i=n.handler||r.handler,c=c??r.useRawParams;let o=await (0,g.gG)(r.defaultParams,a),u=await (0,g.gG)(n.defaultParams,a);s={...o,...u}}else{if(!n.handler)continue;a=await (0,b.v)(d,n),i=n.handler,s={...await (0,g.gG)(n.defaultParams,a)}}let p=e.getStepParams(t,l);void 0!==p&&(s={...s,...p}),"function"==typeof c&&(c=await c(a)),c||(s=await a.resolveJsonTemplate(s));try{if(!i){d.logger.error(`BaseModel.applyFlow: No handler available for step '${l}' in flow '${t}'. Skipping.`);continue}await this.emitModelEventIf(r,`flow:${t}:step:${l}:start`,{...m,stepKey:l});let e=i(a,s);o=!1!==n.isAwait?await e:e,u[l]=o,h[l].result=u[l],await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,result:o,stepKey:l})}catch(e){if(e instanceof g.sy||e instanceof v.zz||await this.emitModelEventIf(r,`flow:${t}:step:${l}:error`,{...m,error:e,stepKey:l}),e instanceof g.sy)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,stepKey:l}),await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:u}),Promise.resolve(u);if(e instanceof v.zz)return d.logger.info(`[FlowEngine] ${e.message}`),await this.emitModelEventIf(r,`flow:${t}:step:${l}:end`,{...m,stepKey:l,aborted:!0}),await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:e,aborted:!0}),Promise.resolve(e);return await this.emitModelEventIf(r,`flow:${t}:error`,{...m,error:e}),d.logger.error({err:e},`BaseModel.applyFlow: Error executing step '${l}' in flow '${t}':`),Promise.reject(e)}}return await this.emitModelEventIf(r,`flow:${t}:end`,{...m,result:u}),Promise.resolve(u)}async dispatchEvent(e,t,l,n){var r,i,o,a;let s="beforeRender"===t,d=!!(null==n?void 0:n.sequential),u=!!(null==n?void 0:n.useCache),c=s,p=`${e.uid}-${t}-${Date.now()}`,h=e.context.logger,m={uid:e.uid,model:e,runId:p,inputArgs:l};try{await this.emitModelEventIf(t,"start",m),await (null==(r=e.onDispatchEventStart)?void 0:r.call(e,t,n,l))}catch(r){if(s&&r instanceof g.sy)return h.debug(`[FlowModel.dispatchEvent] ${r.message}`),[];try{await (null==(i=e.onDispatchEventError)?void 0:i.call(e,t,n,l,r))}finally{h.error({err:r},`BaseModel.dispatchEvent: Start hook error for event '${t}'`)}if(c)throw r;return}let f=s?e.getEventFlows("beforeRender"):Array.from(e.getFlows().values()).filter(e=>{let l=e.on;return!!l&&("string"==typeof l?l===t:"object"==typeof l&&l.eventName===t)}),y="click"===t&&(null==l?void 0:l.triggerByRouter)===!0?f.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}):f,b=[],x=async()=>{let n=!1;if(d){let r=y.map((e,t)=>({f:e,i:t})).slice().sort((e,t)=>{var l,n;let r=e.f.flowRegistry,i=t.f.flowRegistry,o=null==r||null==(l=r.constructor)?void 0:l._type,a=null==i||null==(n=i.constructor)?void 0:n._type,s=+("instance"!==o),d=+("instance"!==a);if(s!==d)return s-d;let u=e.f.sort??0,c=t.f.sort??0;return u!==c?u-c:e.i-t.i}).map(e=>e.f),i=[],o=new Map(r.filter(e=>{var t;let l=e.flowRegistry;return"instance"!==(null==l||null==(t=l.constructor)?void 0:t._type)}).map(e=>[e.key,e])),a=new Set,s=new Map;for(let[n,d]of(r.forEach((e,l)=>{let n=e.on,r="object"==typeof n?n:void 0;if(!r)return;let i=r.phase,d=r.flowKey,u=r.stepKey;if(!i||"beforeAllFlows"===i)return;let c=null;if("afterAllFlows"===i)c=`event:${t}:end`;else if("beforeFlow"===i||"afterFlow"===i)if(d)if(o.get(String(d))){let e="beforeFlow"===i?"start":"end";c=`event:${t}:flow:${String(d)}:${e}`}else c=`event:${t}:end`;else c=`event:${t}:end`;else if("beforeStep"!==i&&"afterStep"!==i)return;else if(d&&u){var p;let e=o.get(String(d)),l=!!(null==e||null==(p=e.hasStep)?void 0:p.call(e,String(u)));if(e&&l){let e="beforeStep"===i?"start":"end";c=`event:${t}:flow:${String(d)}:step:${String(u)}:${e}`}else c=`event:${t}:end`}else c=`event:${t}:end`;if(!c)return;let h=c===`event:${t}:end`||"afterFlow"===i||"afterStep"===i;a.add(e.key);let m=s.get(c)||[];m.push({flow:e,order:l,shouldSkipOnAborted:h}),s.set(c,m)}),s.entries()))for(let r of d.slice().sort((e,t)=>{let l=e.flow.sort??0,n=t.flow.sort??0;return l!==n?l-n:e.order-t.order})){let o=r.shouldSkipOnAborted?Object.assign(e=>e.type===n&&!0!==e.aborted,{__eventType:n}):n,a=e.scheduleModelOperation(e.uid,async e=>{let n=await this.runFlow(e,r.flow.key,l,p,t);if(n instanceof v.zz)throw n;i.push(n)},{when:o});b.push(a)}for(let o of r)if(!a.has(o.key))try{h.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${o.key}' (sequential).`);let r=await this.runFlow(e,o.key,l,p,t);if(r instanceof v.zz){h.debug(`[FlowEngine.dispatchEvent] ${r.message}`),n=!0;break}i.push(r)}catch(e){if(e instanceof v.zz){h.debug(`[FlowEngine.dispatchEvent] ${e.message}`),n=!0;break}throw h.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${o.key}' for event '${t}' (sequential):`),e}return{result:i,abortedByExitAll:n}}let r=(await Promise.all(y.map(async n=>{h.debug(`BaseModel '${e.uid}' dispatching event '${t}' to flow '${n.key}'.`);try{return await this.runFlow(e,n.key,l,p,t)}catch(e){if(h.error({err:e},`BaseModel.dispatchEvent: Error executing event-triggered flow '${n.key}' for event '${t}':`),c)throw e;return}}))).filter(e=>void 0!==e);return r.some(e=>e instanceof v.zz)&&(n=!0),{result:r,abortedByExitAll:n}},w=u?JSON.stringify(l??{}):"",S=u?eD.generateApplyFlowCacheKey(`event:${e.getFlowCacheScope(t)}:${w}`,t,e.uid):null;try{let{result:r,abortedByExitAll:i}=await this.withApplyFlowCache(S,x);try{await (null==(o=e.onDispatchEventEnd)?void 0:o.call(e,t,n,l,r))}catch(e){h.error({err:e},`BaseModel.dispatchEvent: End hook error for event '${t}'`)}return await this.emitModelEventIf(t,"end",{...m,result:r,...i?{aborted:!0}:{}}),r&&"object"==typeof r&&Object.defineProperty(r,"__abortedByExitAll",{value:i,configurable:!0}),r}catch(r){try{await (null==(a=e.onDispatchEventError)?void 0:a.call(e,t,n,l,r))}catch(e){}if(e.context.logger.error({err:r},`BaseModel.dispatchEvent: Error executing event '${t}' for model '${e.uid}':`),await this.emitModelEventIf(t,"error",{...m,error:r}),c)throw r}finally{for(let e of b)e()}}constructor(e){(0,i._)(this,"engine",void 0),this.engine=e}}var w=l(58587),S=l(18150),M=l(68238),A=l(78880),F=l(18220),k=l(47674),C=l(21637),P=l(71021),j=l(84626),E=l(96540),R=l(74848),I=l(53619),T=l(92034),_=l(98393),D=l(22803),N=l(42443),O=l(88040),$=l(35710),B=l(18182),L=l(98892),q=l(33954),V=l(57084),z=l(94313),K=l(20616),U=l(52847);let W={marginLeft:32},H=(0,U.PA)(e=>{let{title:t,onChange:l,getDefaultValue:n,disabled:r,itemKey:i,...o}=e,[a,s]=(0,E.useState)(!1),d=(0,K.Db)();(0,E.useEffect)(()=>{let e=!1;return(async()=>{if(n)try{let t=await n();if(e||!t)return;let l=Object.entries(t);if(!l.length)return;let[r,i]=l[0];s(!!i)}catch(e){console.error(e)}})(),()=>{e=!0}},[n]);let u=e=>{s(e),null==l||l({[i]:e})},c=e=>{e.stopPropagation(),r||u(!a)};return(0,R.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between",cursor:r?"not-allowed":"pointer"},onClick:c,children:[t,(0,R.jsx)(z.A,{size:"small",...o,checkedChildren:o.checkedChildren?d.t(o.checkedChildren):void 0,unCheckedChildren:o.unCheckedChildren?d.t(o.unCheckedChildren):void 0,checked:a,style:W,disabled:r})]})});var Y=l(36492);let G=(e,t)=>{for(let n of e){var l;if(String((null==n?void 0:n.key)??"")===t)return n;if(null==(l=n.children)?void 0:l.length){let e=G(n.children,t);if(e)return e}}},J=(e,t,l)=>{let n=t.maxDepth,r="number"==typeof t.arrayLimit?t.arrayLimit:1/0,i=t.mode??"stack",o=new Set,a=new Set,s=(e,t,d)=>{if(!e||t>n)return;let u=()=>{l(e,{depth:t,modelKey:d}),t>=n||Object.entries(e.subModels||{}).forEach(e=>{let[l,n]=e;if(Array.isArray(n)){let e=Number.isFinite(r)?Math.min(n.length,r):n.length;for(let r=0;r<e;r++){let e=n[r];e instanceof q.WD&&s(e,t+1,`${l}[${r}]`)}return}n instanceof q.WD&&s(n,t+1,l)})};if("visited"===i){if(o.has(e))return;o.add(e),u();return}let c=e.uid||`temp-${Date.now()}`;if(!a.has(c)){a.add(c);try{u()}finally{a.delete(c)}}};s(e,1)},X=(e,t)=>{var l;if(!e||!t||"string"!=typeof t)return console.warn("Invalid input parameters"),null;let n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\[(\d+)\])?$/);if(!n)return console.warn(`Invalid subModelKey format: ${t}`),null;let[,r,i]=n,o=null==(l=e.subModels)?void 0:l[r];if(!o)return console.warn(`SubModel '${r}' not found`),null;if(void 0!==i){let e=parseInt(i,10);return Array.isArray(o)?e<0||e>=o.length?(console.warn(`Array index ${e} out of bounds for '${r}'`),null):o[e]instanceof q.WD?o[e]:null:(console.warn(`Expected array for '${r}', got ${typeof o}`),null)}return Array.isArray(o)?(console.warn(`Expected object for '${r}', got array`),null):o instanceof q.WD?o:null},Q={switch:H,select:function(e){let{title:t,getDefaultValue:l,onChange:n,options:r,fieldNames:i,itemKey:o,tooltip:a,...s}=e,[d,u]=(0,E.useState)(!1),[c,p]=(0,E.useState)(""),h=(0,K.Db)();(0,E.useEffect)(()=>{let e=!1;return(async()=>{if(l)try{let t=await l();if(e||!t)return;let n=Object.entries(t);if(!n.length)return;let[r,i]=n[0];p(i)}catch(e){console.error(e)}})(),()=>{e=!0}},[l]);let m=(0,E.useRef)(null),f=e=>{p(e),null==n||n({[o]:e})},g=(0,R.jsx)("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:t});return(0,R.jsxs)("div",{style:{alignItems:"center",display:"flex",justifyContent:"space-between"},onClick:e=>{e.stopPropagation(),u(e=>!e)},onMouseLeave:()=>{m.current=setTimeout(()=>{u(!1)},200)},children:[a?(0,R.jsx)(N.A,{title:a,placement:"top",destroyTooltipOnHide:!0,children:g}):g,(0,R.jsx)(Y.A,{...s,open:d,popupMatchSelectWidth:!1,bordered:!1,value:c,onChange:f,popupClassName:`select-popup-${t.replaceAll(" ","-")}`,fieldNames:i,options:r,labelRender:e=>h.t(e.label),optionRender:e=>h.t(e.label),style:{textAlign:"right",minWidth:100},onMouseEnter:()=>{clearTimeout(m.current)},dropdownRender:e=>s.dropdownRender?s.dropdownRender(e,u,f):e})]})}},Z=e=>{let{title:t,uiMode:l,itemProps:n}=e,r=(null==l?void 0:l.type)||l,i=r?Q[r]:null,o=!!(null==n?void 0:n.disabled),a=null==n?void 0:n.disabledReason,s=null==n?void 0:n.disabledIconColor,d=i?(0,R.jsx)(i,{title:t,...n}):(0,R.jsx)(R.Fragment,{children:t});return o?(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,R.jsx)(N.A,{title:a,placement:"right",destroyTooltipOnHide:!0,children:(0,R.jsx)(I.A,{style:{color:s}})})]}):d},ee=".nb-toolbar-container-icons",et=".nb-toolbar-container",el=(0,D.css)`
|
|
1351
1351
|
width: max-content;
|
|
1352
1352
|
min-width: max-content;
|
|
1353
1353
|
|
|
@@ -1702,5 +1702,5 @@ ${i.join("\n")}`:""}function k(e){let t=String((null==e?void 0:e.message)||"");i
|
|
|
1702
1702
|
${o.join("\n")}`:""}function j(e,t){let l=Error(t);l.cause=e;try{let t="string"==typeof(null==e?void 0:e.name)?e.name:"";t&&(l.name=t)}catch(e){}try{let n="string"==typeof(null==e?void 0:e.stack)?e.stack:"";if(n){let e=String(n).split("\n");e.length&&(e[0]=`${l.name}: ${t}`,l.stack=e.join("\n"))}}catch(e){}return l}function E(e){if(!e)return null;let t=u.get(e);if(t)return t;if("function"!=typeof e.createElement)return null;let l=e.Component;if("function"!=typeof l)return null;class r extends l{static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){try{var t,l,n;let r=null==(t=this.props)?void 0:t.enhanceReactError,i="function"==typeof r?r(e):e,o=String((null==i?void 0:i.message)||"");if(o&&/\[RunJS Hint\]/.test(o)){console.error(o);let e=null==(n=this.props)||null==(l=n.ctx)?void 0:l.logger;e&&"function"==typeof e.error&&e.error(o)}}catch(e){}}componentDidUpdate(e){var t,l;(null==e?void 0:e.resetKey)!==(null==(t=this.props)?void 0:t.resetKey)&&(null==(l=this.state)?void 0:l.error)&&this.setState({error:void 0})}render(){var t,l;let n=null==(t=this.state)?void 0:t.error;if(!n)return this.props.children;let r="";try{let e=null==(l=this.props)?void 0:l.enhanceReactError,t="function"==typeof e?e(n):n;r=String((null==t?void 0:t.message)||t||(null==n?void 0:n.message)||n||"")}catch(e){r=String((null==n?void 0:n.message)||n||"")}let i={boxSizing:"border-box",padding:12,borderRadius:6,border:"1px solid #ffccc7",background:"#fff2f0",color:"#a8071a",fontSize:12,lineHeight:1.5,maxWidth:"100%",overflow:"auto"},o={margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},a={fontWeight:600,marginBottom:8};return e.createElement("div",{style:i},e.createElement("div",{style:a},"RunJS render error"),e.createElement("pre",{style:o},r))}constructor(...e){super(...e),(0,n._)(this,"state",{})}}return u.set(e,r),r}function R(e){let{ctx:t,vnode:l,enhanceReactError:n,resetKey:r}=e,i=null==t?void 0:t.React,o=E(i);return o?i.createElement(o,{ctx:t,enhanceReactError:n,resetKey:r},l):l}function I(e){var t;let{ctx:l,entry:n,containerEl:r,rootMap:o,unmountContainerRoot:a,enhanceReactError:s,internalReact:d,internalAntd:u}=e;if(!(!(null==(t=l.ReactDOM)?void 0:t.__nbRunjsInternalShim)&&l.React&&l.React!==d&&l.antd&&l.antd!==u&&void 0!==l.antd.ConfigProvider)){if(n.disposeTheme){try{n.disposeTheme()}catch(e){}n.disposeTheme=void 0}return!1}let c=()=>{var e,t,r,i,o,a,s;null==l||null==(t=l.engine)||null==(e=t.context)||e.themeToken;let d=null==l||null==(i=l.engine)||null==(r=i.context)?void 0:r.antdConfig,u=(null==l||null==(s=l.engine)||null==(a=s.context)||null==(o=a.locales)?void 0:o.antd)||(null==d?void 0:d.locale),c=l.antd.ConfigProvider,p=l.antd.App,h={popupMatchSelectWidth:!1,locale:u||{}};d&&"object"==typeof d&&(void 0!==d.direction&&(h.direction=d.direction),"string"==typeof d.prefixCls&&(h.prefixCls=d.prefixCls),"string"==typeof d.iconPrefixCls&&(h.iconPrefixCls=d.iconPrefixCls),"function"==typeof d.getPopupContainer&&(h.getPopupContainer=d.getPopupContainer),d.theme&&"object"==typeof d.theme&&(h.theme=d.theme));let m=n.lastVnode,f=p?l.React.createElement(c,h,l.React.createElement(p,null,m)):l.React.createElement(c,h,m);n.root.render(f)};return n.disposeTheme?c():n.disposeTheme=(0,i.autorun)(()=>{try{if(r&&1===r.nodeType&&"boolean"==typeof r.isConnected&&!r.isConnected&&n.wasConnected)return void queueMicrotask(()=>{o.get(r)===n&&a()});r&&1===r.nodeType&&"boolean"==typeof r.isConnected&&r.isConnected&&(n.wasConnected=!0),c()}catch(e){throw s(e)}}),!0}function T(e){let{ctx:t,entry:l,vnode:n,containerEl:r,rootMap:i,unmountContainerRoot:o,internalReact:a,internalAntd:s}=e,d=e=>{let l=String((null==e?void 0:e.message)||e||"");if(!l||/\[RunJS Hint\]/.test(l))return e;let n=/invalid hook call/i.test(l),r=k(e);if(!n&&!r)return e;let i=F({ctx:t,internalReact:a,internalAntd:s})||P({ctx:t,internalReact:a,internalAntd:s,err:e});return i?j(e,`${l}${i}`):e};try{return l.__nbRunjsRenderSeq=(l.__nbRunjsRenderSeq||0)+1,l.lastVnode=R({ctx:t,vnode:n,enhanceReactError:d,resetKey:l.__nbRunjsRenderSeq}),I({ctx:t,entry:l,containerEl:r,rootMap:i,unmountContainerRoot:o,enhanceReactError:d,internalReact:a,internalAntd:s})||l.root.render(l.lastVnode),l.root}catch(e){throw d(e)}}},44476(e,t,l){l.d(t,{Hi:()=>d,KC:()=>s,af:()=>u});var n=l(2543),r=l.n(n),i=l(35846);function o(e){if(!e)return;let t=e.match(/^([^.[]+)/);return null==t?void 0:t[1]}function a(e,t){var l;if(!e||!t)return;let n=e.getField(t);return n||((null==(l=e.getFields)?void 0:l.call(e))||[]).find(e=>e.name===t)}function s(e,t){if(null!=e){if(Array.isArray(t)){if("object"!=typeof e||!e)return;let l=e,n={};for(let e of t){let t=l[e];if(null==t)return;n[e]=t}return n}if("string"==typeof e||"number"==typeof e)return e;if("object"==typeof e)return e[t]}}function d(e,t){return l=>{if(!l||!l.includes("."))return!1;let n=o(l);if(!n)return!1;let i=a(e(),n);if(!(null==i?void 0:i.isAssociationField()))return!1;if("function"==typeof t){let e=t();if(e&&"object"==typeof e&&void 0!==r().get(e,l))return!1}return!0}}function u(e,t,l){let n=(0,i.H)(e,t,!0),r=async()=>{let t=await n();return t?{...t,buildVariablesParams:t=>{var n;let r=e(),i=l(t);if(!r||!i||"object"!=typeof i)return{};let o={};for(let e of(null==(n=r.getFields)?void 0:n.call(r))||[]){let t=e.name;if(!t||!e.isAssociationField())continue;let l=e.target,n=e.targetCollection;if(!l||!n)continue;let r=n.filterTargetKey,a=i[t];if(null!=a)if(Array.isArray(a)){let e=a.map(e=>s(e,r)).filter(e=>null!=e);e.length&&(o[t]={collection:l,dataSourceKey:n.dataSourceKey,filterByTk:e})}else{let e=s(a,r);null!=e&&(o[t]={collection:l,dataSourceKey:n.dataSourceKey,filterByTk:e})}}return o}}:null};return r.title=t,r}},35846(e,t,l){l.d(t,{H:()=>d});let n=["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"],r=["integer","float","double","decimal"];function i(e,t){return!!(e.interface&&(t||e.filterable))}function o(e,t){let l=s(e);if(e.isAssociationField()){let n=e.targetCollection;return n?{type:"object",...l,properties:async()=>{let e={};return n.fields.forEach(l=>{i(l,t)&&(e[l.name]=o(l,t))}),e}}:{type:"object",...l}}return{type:a(e),...l}}function a(e){let t=e.type;if(n.includes(t))return"object";if(r.includes(t))return"number";switch(t){case"boolean":return"boolean";case"json":return"object";case"array":return"array";default:return"string"}}function s(e){return{title:e.title||e.name,interface:e.interface,options:e.options,uiSchema:e.uiSchema||{}}}function d(e,t,l){let n=async()=>{let n="function"==typeof e?e():e;return n?{type:"object",title:t||n.title||n.name,properties:async()=>{let e={};return n.fields.forEach(t=>{i(t,l)&&(e[t.name]=o(t,l))}),e}}:null};return n.title=t,n}},62572(e,t,l){l.d(t,{v:()=>r});var n=l(29007);async function r(e,t){if(null==t||!t.defineProperties&&!t.defineMethods)return e;let l=new n.cB;l.addDelegate(e);let r=l.createProxy(),i=r,o=e,a=t=>{let l=Reflect.get(o,t,o);return"function"==typeof l?l.bind(e):l},s=e=>"defineProperty"===e||"defineMethod"===e||Reflect.has(i,e)||Reflect.has(o,e),d=new Proxy(r,{get:(e,t,n)=>"string"==typeof t?"defineProperty"===t?(e,t)=>l.defineProperty(e,t):"defineMethod"===t?(e,t,n)=>l.defineMethod(e,t,n):Reflect.has(i,t)?Reflect.get(i,t,n):a(t):Reflect.get(i,t,n),set:(e,t,l)=>Reflect.set(o,t,l),has:(e,t)=>s(t),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(i,t)||Object.getOwnPropertyDescriptor(o,t)});if(t)for(let e of Array.isArray(t)?t:[t]){if(!e)continue;let t=e.defineProperties;if(t){let e="function"==typeof t?await t(d):t;if(!e||"object"!=typeof e)throw TypeError("defineProperties must return an object of PropertyOptions");for(let[t,n]of Object.entries(e)){if(!n||"object"!=typeof n)throw TypeError(`defineProperties['${t}'] must be a PropertyOptions object`);l.defineProperty(t,n)}}let n=e.defineMethods;if(n){let e="function"==typeof n?await n(d):n;if(!e||"object"!=typeof e)throw TypeError("defineMethods must return an object of functions");for(let[t,n]of Object.entries(e)){if("function"!=typeof n)throw TypeError(`defineMethods['${t}'] must be a function`);l.defineMethod(t,n)}}}return new Proxy(r,{get:(t,l,n)=>"string"==typeof l?"defineProperty"===l?(t,l)=>e.defineProperty(t,l):"defineMethod"===l?(t,l,n)=>e.defineMethod(t,l,n):Reflect.has(i,l)?Reflect.get(i,l,n):a(l):Reflect.get(i,l,n),set:(e,t,l)=>Reflect.set(o,t,l),has:(e,t)=>s(t),getOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(i,t)||Object.getOwnPropertyDescriptor(o,t)})}},44951(e,t,l){l.d(t,{BL:()=>s,T$:()=>i});var n=l(16639);function r(e,t){if(!e||"object"!=typeof e)return;let l=e;if("function"==typeof l.get){let e=l.get(t);if(null!=e&&""!==e)return e}let n=t.toLowerCase();for(let[t,l]of Object.entries(e))if(t.toLowerCase()===n)return l}function i(e){let t=r(e,"x-data-source");return Array.isArray(t)?String(t[0]||"main"):null==t||""===t?"main":String(t)}function o(e){let t=String(e||"").trim();if(!t)return[];let l=new Set([t]);return t.includes(".")&&l.add(t.split(".")[0]),Array.from(l)}function a(e,t){if(!t)return[e];let l=[],n=new Set,r=e,i=0;for(;r&&i++<50;)n.has(r)||(l.push(r),n.add(r)),r=r.previousEngine;return l}function s(e){var t,l,r,i;let{engine:s,resourceName:d,includePreviousEngines:u}=e;if(!(null==s?void 0:s.markDataSourceDirty))return[];let c=o(d);if(!c.length)return[];let p=String(e.dataSourceKey||"main"),h=a(s,u),m=new Map;for(let e of h){let t=new Map;for(let l of(m.set(e,t),c))t.set(l,(null==(r=e.getDataSourceDirtyVersion)?void 0:r.call(e,p,l))||0)}for(let e of h){let t=m.get(e);for(let l of c){let n=(null==t?void 0:t.get(l))||0;((null==(i=e.getDataSourceDirtyVersion)?void 0:i.call(e,p,l))||0)===n&&e.markDataSourceDirty(p,l)}}return null==(l=s.emitter)||null==(t=l.emit)||t.call(l,n.HK,{dataSourceKey:p,resourceNames:c}),c}},9297(e,t,l){l.d(t,{k:()=>O,q:()=>i});var n=l(33329),r=l(44951);let i="__nocobaseSkipDataSourceDirty",o=Symbol("nocobaseDirtyDispatchToken"),a=new WeakMap,s=new WeakSet,d=["add","bulkdestroy","bulkupdate","create","delete","destroy","execute","firstorcreate","import","move","remove","save","saveastemplate","set","setfields","submit","update","updateorcreate","upsert"];function u(e){if(!e||"object"!=typeof e)return!1;let t=e;return"function"==typeof t.resource&&"function"==typeof t.request}function c(e){let t=String(e||"").trim();if(!t)return!1;let l=t.split("/")[0],n=l.toLowerCase();return d.some(e=>{if(n===e)return!0;if(!n.startsWith(e)||l.length<=e.length)return!1;let t=l[e.length];return"-"===t||"_"===t||t>="A"&&t<="Z"})}function p(){var e;return"u"<typeof window||null==(e=window.location)?void 0:e.origin}function h(e,t){try{return new URL(e,t)}catch{return}}function m(e){let t=e.search(/[?#]/);return -1===t?e:e.slice(0,t)}function f(e){let t=m(e).trim();if(!t)return;let l=t.replace(/^\/+/,"");if(l&&"api"!==l)return l.startsWith("api/")?l.slice(4):l}function g(e){return e.endsWith("/")?e:`${e}/`}function v(e){if(null==e?void 0:e.getApiUrl)try{return h(e.getApiUrl(),p())}catch{return}}function y(e,t){let l=m(e).trim();if(!l.startsWith("/"))return;let n=g(t);if(!g(l).startsWith(n))return;let r=n.replace(/\/$/,"");return l.slice(r.length).replace(/^\/+/,"")||void 0}function b(e,t){if(!["http:","https:"].includes(e.protocol))return;if(null==t?void 0:t.getApiUrl){let l=v(t);if(!l||e.origin!==l.origin)return;return y(e.pathname,l.pathname)}let l=p();if(l&&e.origin===l)return f(e.pathname)}function x(e,t){if("string"!=typeof e)return;let l=e.trim();if(!l||l.startsWith("//"))return;if(/^https?:\/\//i.test(l)){let e=h(l);if(!e)return;return b(e,t.app)}let n=v(t.app),r=n?y(l,n.pathname):void 0;return r||f(l)}function w(e){try{return decodeURIComponent(e)}catch{return e}}function S(e){return String(e??"").trim()||void 0}function M(e){let t,l=[],n=-1;for(let r=0;r<e.length;r+=2){let i=e[r],o=i.lastIndexOf(":"),a=-1===o?i:i.slice(0,o);if(!a)return;if(l.push(w(a)),-1!==o){t=w(i.slice(o+1)).trim(),n=r;break}}if(t&&l.length&&!(e.length>n+2))return{resourceName:l.join("."),actionName:t}}function A(e,t){let l=x(e,t);if(!l)return;let n=m(l).split("/").filter(Boolean);if("dataSources"===w(n[0]||"")&&n.length>=3){let e=S(w(n[1])),t=M(n.slice(2));if(e&&t)return{...t,dataSourceKey:e}}return M(n)}function F(e,t,l,n){let r=e.trim(),i=l.trim();if(!r||!i)return;if(r.includes("/")){let e=A(`${r}:${i}`,n);if(e)return e}let o="dataSources.";if(r.startsWith(o)){let e=S(t),l=r.slice(o.length).trim();if(e&&l)return{dataSourceKey:e,resourceName:l,actionName:i}}return{resourceName:r,actionName:i}}function k(e,t){let l="string"==typeof(null==e?void 0:e.resource)?e.resource:void 0,n="string"==typeof(null==e?void 0:e.action)?e.action:void 0;return l&&n?F(l,e.resourceOf,n,t):A(null==e?void 0:e.url,t)}function C(e,t){if(e)return JSON.stringify([e.dataSourceKey||(0,r.T$)(t),e.resourceName,e.actionName])}function P(e,t){return C(k(e,t),e.headers)}function j(e,t,l){let n=String(e??"").trim();if(n)return JSON.stringify([n,String(t??""),(0,r.T$)(l)])}function E(e,t){if(e&&t&&(!e.requestKey||e.requestKey===t))return e}function R(e,t){if(e&&t&&(!e.resourceKey||e.resourceKey===t))return e}function I(e,t,l){(0,r.BL)({engine:e.engine,dataSourceKey:t.dataSourceKey||(0,r.T$)(l),resourceName:t.resourceName,includePreviousEngines:!0})}function T(e,t,l,n){!e.skip&&!e.marked&&l&&c(l.actionName)&&(e.marked=!0,I(t,l,n))}function _(e){return!!e&&"object"==typeof e}function D(e,t,l,n,r,a,s){return new Proxy(t,{get(t,d,u){let p=Reflect.get(t,d,u);if("string"!=typeof d||"function"!=typeof p||!c(d))return p;let h=p;return async function(){let t;for(var c,p,m=arguments.length,f=Array(m),g=0;g<m;g++)f[g]=arguments[g];let v=_(f[1])?f[1]:void 0,y=F(l,n,d,e),b=C(y,r),x=j(l,n,r),w=E(null==v?void 0:v[o],b)||E(s,b),S=w||{marked:!1,skip:!1},M=!w;(c=S).requestKey||(c.requestKey=b),(p=S).resourceKey||(p.resourceKey=x),(null==v?void 0:v[i])&&(S.skip=!0);let A=v||null==f[1]?[f[0],{...v,[o]:S}]:f;a.push({key:b,token:S});try{t=Reflect.apply(h,u,A)}finally{a.pop()}let k=await t;return M&&T(S,e,y,r),k}}})}function N(e,t){let l,r,a=e.resource,d=e.request,u=a===n.Q9.prototype.resource,p=d===n.Q9.prototype.request,h=[],m=[],f=!1,g=!1,v=()=>f?l:w,y=()=>g?r:S,b=(e,t)=>{let l=j(t[0],t[1],t[2]),n=R(e,l),r=!!n&&f;if(n){var i;(i=n).resourceKey||(i.resourceKey=l),h.push({key:l,token:n})}try{let e=Reflect.apply(v(),A,t);if(!r||!n)return e;return new Proxy(e,{get(e,t,r){let i=Reflect.get(e,t,r);if("string"!=typeof t||"function"!=typeof i||!c(t))return i;let a=i;return function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];let s=_(t[1])?t[1]:void 0,d=s||null==t[1]?[t[0],{...s,[o]:n}]:t;h.push({key:l,token:n}),m.push({key:n.requestKey,token:n});try{return Reflect.apply(a,r,d)}finally{m.pop(),h.pop()}}}})}finally{n&&h.pop()}},x=l=>{let n=Object.create(e);return Object.defineProperties(n,{request:{configurable:!0,value:e=>{let n=e,r=P(n,t),i=m.at(-1),a=E(null==n?void 0:n[o],r)||(r&&(null==i?void 0:i.key)===r?i.token:void 0)||E(l,r),{[o]:s,...d}=n,u=a?{...d,[o]:a}:d;if(a){var c;(c=a).requestKey||(c.requestKey=r),m.push({key:r,token:a})}try{return Reflect.apply(y(),A,[u])}finally{a&&m.pop()}}},resource:{configurable:!0,value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=j(t[0],t[1],t[2]),i=h.at(-1);return b(R(l,r)||(r&&(null==i?void 0:i.key)===r?i.token:void 0),t)}}}),n},w=(l,n,r,i)=>{let o=j(l,n,r),s=h.at(-1),d=o&&(null==s?void 0:s.key)===o?s.token:void 0,c=x(d);return D(t,Reflect.apply(a,u?c:e,[l,n,r,i]),l,n,r,m,d)},S=l=>{var n,r;let a=l,s=P(a,t),u=m.at(-1),c=E(null==a?void 0:a[o],s)||(s&&(null==u?void 0:u.key)===s?u.token:void 0),h=c||{marked:!1,skip:!1},f=!c;(n=h).requestKey||(n.requestKey=s),"string"==typeof a.resource&&((r=h).resourceKey||(r.resourceKey=j(a.resource,a.resourceOf,a.headers))),(null==a?void 0:a[i])&&(h.skip=!0);let g=k(a,t),{[o]:v,[i]:y,...b}=a,w=x(h);return Reflect.apply(d,p?w:e,[b]).then(e=>(f&&T(h,t,g,a.headers),e))},M=(e,t)=>{let l=Reflect.getOwnPropertyDescriptor(e,t);return!!l&&!l.configurable},A=new Proxy(e,{get:(e,t,n)=>"resource"===t?M(e,t)?Reflect.get(e,t,n):f?l:w:"request"===t?M(e,t)?Reflect.get(e,t,n):g?r:S:Reflect.get(e,t,n),set(e,t,n,i){if("resource"===t){let r=Reflect.getOwnPropertyDescriptor(e,t);return(!r||!!r.configurable&&!!Reflect.isExtensible(e))&&(f=!0,l=n,!0)}if("request"===t){let l=Reflect.getOwnPropertyDescriptor(e,t);return(!l||!!l.configurable&&!!Reflect.isExtensible(e))&&(g=!0,r=n,!0)}return Reflect.set(e,t,n,i)},deleteProperty(e,t){if("resource"!==t&&"request"!==t)return Reflect.deleteProperty(e,t);let n=Reflect.getOwnPropertyDescriptor(e,t);return(!n||!!n.configurable&&!!Reflect.isExtensible(e))&&("resource"===t?(f=!1,l=void 0):(g=!1,r=void 0),!0)},defineProperty:(e,t,l)=>"resource"!==t&&"request"!==t&&Reflect.defineProperty(e,t,l)});return s.add(A),A}function O(e,t){if(!u(e)||s.has(e))return e;let l=e,n=a.get(l);n||(n=new WeakMap,a.set(l,n));let r=n.get(t);if(r)return r;let i=N(e,t);return n.set(t,i),i}},31108(e,t,l){l.d(t,{VD:()=>o,sy:()=>r,zz:()=>i});var n=l(50467);class r extends Error{constructor(e,t,l){super(l||`Flow '${e}' on model '${t}' exited via ctx.exit().`),(0,n._)(this,"flowKey",void 0),(0,n._)(this,"modelUid",void 0),this.name="FlowExitException",this.flowKey=e,this.modelUid=t}}class i extends Error{constructor(e,t,l){super(l||`Flow '${e}' on model '${t}' exited via ctx.exitAll().`),(0,n._)(this,"flowKey",void 0),(0,n._)(this,"modelUid",void 0),this.name="FlowExitAllException",this.flowKey=e,this.modelUid=t}}class o extends Error{constructor(e="Flow settings save cancelled."){super(e),this.name="FlowCancelSaveException"}}},60182(e,t,l){l.d(t,{pM:()=>tm,te:()=>ek,ju:()=>P.ju,Fv:()=>o,MI:()=>d,vq:()=>th.v,yz:()=>_,M5:()=>eA,X4:()=>eF,Vv:()=>eE,E2:()=>eT,lW:()=>a,n2:()=>R,FA:()=>p,J3:()=>e_,vP:()=>P.vP,ME:()=>y,H9:()=>k.H,ey:()=>eR.ey,KB:()=>ee,JE:()=>ep,kl:()=>r,u4:()=>n,UX:()=>P.UX,XM:()=>F,Kh:()=>eC,AP:()=>E,mP:()=>eL,zz:()=>u.zz,D1:()=>eR.D1,gG:()=>h.gG,I2:()=>eR.I2,af:()=>C.af,mv:()=>h.mv,QP:()=>c,pk:()=>h.pk,Xh:()=>eR.Xh,$S:()=>P.$S,EI:()=>tf,_:()=>eR._,qI:()=>M,sU:()=>L,ln:()=>w,Z8:()=>D,cg:()=>z,zE:()=>ty,wx:()=>g.w,yp:()=>tg.y,y4:()=>eM,dN:()=>Y,ye:()=>J,$n:()=>eB,VD:()=>u.VD,ji:()=>tp,WJ:()=>i,i:()=>tg.i,hz:()=>eP,MZ:()=>s,sy:()=>u.sy,YB:()=>j,xI:()=>P.xI,KC:()=>C.KC,$X:()=>eS,o7:()=>S,mH:()=>tc,M:()=>h.M,nN:()=>P.nN,GZ:()=>T,Hi:()=>C.Hi,pc:()=>P.pc,_3:()=>A,Gu:()=>G,DX:()=>ew,XU:()=>P.XU});let n="flow-engine",r={DATA:"dataBlocks",FILTER:"filterBlocks",OTHER:"otherBlocks"},i={data:{key:r.DATA,label:"Data blocks",type:"group",hasCurrentFlowContext:!0},filter:{key:r.FILTER,label:"Filter blocks",type:"group",hasCurrentFlowContext:!1},other:{key:r.OTHER,label:"Other blocks",type:"group",hasCurrentFlowContext:!1}},o={CURRENT_RECORD:"currentRecord",ASSOCIATION_RECORDS:"associationRecords",OTHER_RECORDS:"otherRecords",OTHER_COLLECTIONS:"otherCollections",CURRENT_COLLECTIONS:"currentCollections"};function a(e){var t;return(null==(t=e.flowEngine)?void 0:t.translate)?(t,l)=>e.flowEngine.translate(t,{ns:[n,"client"],nsMode:"fallback",...l}):e=>e}function s(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}function d(e,t){return s(e,t)}var u=l(31108);function c(e){return e}function p(e,t){if(e===t)return!1;if(e.prototype instanceof t)return!0;let l=Object.getPrototypeOf(e.prototype);for(;l&&l!==Object.prototype;){if(l.constructor===t)return!0;l=Object.getPrototypeOf(l)}return!1}var h=l(81982),m=l(27153),f=l(29007),g=l(88439);async function v(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving uiSchema function:",e),{}}return e}async function y(e,t){if(!e)return"dialog";if("function"==typeof e)try{return await e(t)||"dialog"}catch(e){return console.error("Error resolving uiMode function:",e),"dialog"}return e}let b={},x=e=>{if("function"==typeof e)return!0;if(!e||"object"!=typeof e)return!1;let t=new WeakSet,l=e=>{if("function"==typeof e)return!0;if(!e||"object"!=typeof e||t.has(e))return!1;if(t.add(e),Array.isArray(e)){for(let t of e)if(l(t))return!0;return!1}for(let t of Object.keys(e))if(l(e[t]))return!0;return!1};return l(e)};function w(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{noCache:n=!1}=l,r=e=>/\{\{.*?\}\}/g.test(e);return(t=>{let l,i=!1;if("string"==typeof t&&t.startsWith("{{")&&(i=!0,l=t),t&&"object"==typeof t&&!Array.isArray(t)){try{l=JSON.stringify(t)}catch(e){return console.warn("Failed to stringify:",e),t}let o=!!(i=r(l))&&!n&&x(t);if(b[l]&&!n&&!o)return b[l];if(o)try{return m.S.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}}if(Array.isArray(t)){try{l=JSON.stringify(t)}catch(e){return console.warn("Failed to stringify:",e),t}let o=!!(i=r(l))&&!n&&x(t);if(b[l]&&!n&&!o)return b[l];if(o)try{return m.S.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}}if(i){if(!l)try{return m.S.compile(t,e)}catch(e){return console.warn("Failed to compile with Formily Schema.compile:",e),t}try{if(n)return m.S.compile(t,e);return b[l]=b[l]||m.S.compile(t,e),b[l]}catch(l){console.log("compileUiSchema error",t,l);try{return m.S.compile(t,e)}catch(e){}}}return t})(t)}async function S(e,t,l){let n=new f.W5(e,t.key,"settings");(0,g.w)(n,t.steps,e,t.key),n.defineProperty("currentStep",{value:l});let r=l.uiSchema;if(l.use)try{var i;let t=null==(i=e.getAction)?void 0:i.call(e,l.use);t&&t.uiSchema&&(r=r||t.uiSchema)}catch(e){console.warn(`Failed to get action ${l.use}:`,e)}let o=await v(r||{},n);return 0===Object.keys(o).length?null:o}async function M(e,t,l){if(!l)return!0;let{hideInSettings:n}=l;if("function"==typeof n)try{let l=new f.W5(e,t.key,"settings");return(0,g.w)(l,t.steps||{},e,t.key),!!await n(l)}catch(e){return console.warn(`Error evaluating hideInSettings for event '${l.name||""}' in flow '${t.key}':`,e),!1}return!!n}async function A(e,t,l){if(!l)return!0;let n=l.hideInSettings;if(void 0===n&&l.use){var r;let t=null==(r=e.getAction)?void 0:r.call(e,l.use);n=null==t?void 0:t.hideInSettings}if("function"==typeof n)try{let r=new f.W5(e,t.key,"settings");return(0,g.w)(r,t.steps,e,t.key),r.defineProperty("currentStep",{value:l}),!!await n(r)}catch(e){return console.warn(`Error evaluating hideInSettings for step '${l.key||""}' in flow '${t.key}':`,e),!1}return!!n}async function F(e,t,l){let n;if(!l)return{disabled:!1};let r=l.disabledInSettings,i=l.disabledReasonInSettings;if((void 0===r||void 0===i)&&l.use)try{var o;let t=null==(o=e.getAction)?void 0:o.call(e,l.use);void 0===r&&(r=null==t?void 0:t.disabledInSettings),void 0===i&&(i=null==t?void 0:t.disabledReasonInSettings)}catch(e){console.warn(`Failed to get action ${l.use}:`,e)}let a=null,s=()=>(a||(a=new f.W5(e,t.key,"settings"),(0,g.w)(a,t.steps,e,t.key),a.defineProperty("currentStep",{value:l})),a),d=!1;if("function"==typeof r)try{d=!!await r(s())}catch(e){return console.warn(`Error evaluating disabledInSettings for step '${l.key||""}' in flow '${t.key}':`,e),{disabled:!1}}else d=!!r;if(!d)return{disabled:!1};if("function"==typeof i)try{let e=await i(s());null!=e&&""!==e&&(n=String(e))}catch(e){console.warn(`Error evaluating disabledReasonInSettings for step '${l.key||""}' in flow '${t.key}':`,e)}else null!=i&&""!==i&&(n=String(i));return{disabled:!0,reason:n}}var k=l(35846),C=l(44476),P=l(73398);function j(e){if("string"!=typeof e)return null;let t=e.trim(),l=/^\{\{\s*ctx(?:\.(.+?))?\s*\}\}$/,n=t.match(l);if(!n)return null;let r=n[1];return r?r.split(".").map(e=>e.trim()).filter(e=>e.length>0):[]}function E(e){return 0===e.length?"{{ ctx }}":`{{ ctx.${e.join(".")} }}`}function R(e){if("string"!=typeof e)return!1;let t=e.trim();return/^\{\{\s*ctx(?:\..+?)?\s*\}\}$/.test(t)}let I=new WeakMap;function T(e,t){I.set(e,t??null)}function _(e){return I.get(e)??null}function D(e){I.delete(e)}let N=["drawer","dialog","embed"],O=["small","medium","large"],$="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",B=8,L=Symbol.for("nocobase.runjs.openViewRouteState");function q(e){return"string"==typeof e&&N.includes(e)}function V(e){return"string"==typeof e&&O.includes(e)}function z(e){let t={};return q(null==e?void 0:e.mode)&&(t.mode=e.mode),V(null==e?void 0:e.size)&&(t.size=e.size),t.mode||t.size?t:void 0}function K(e){let t=0x811c9dc5;for(let l=0;l<e.length;l++)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return t>>>0}function U(e){let t=4*(e.mode?N.indexOf(e.mode)+1:0)+(e.size?O.indexOf(e.size)+1:0);return t>0?t:void 0}function W(e){let t=Math.floor(e/4),l=e%4;return z({mode:t?N[t-1]:void 0,size:l?O[l-1]:void 0})}function H(e,t){let l=K(`${e}:${t}`),n="";for(let e=0;e<B;e++)n+=$[(l=Math.imul(l^t+17*e,0x1000193)>>>0)%$.length];return n}function Y(e){return"string"==typeof e&&e.length===B&&[...e].every(e=>$.includes(e))}function G(e,t){let l=z(t),n=l?U(l):void 0;return n?H(e,n):void 0}function J(e,t){if(Y(t)){for(let l=1;l<16;l++)if(H(e,l)===t)return W(l)}}let X=e=>e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:"/",Q=e=>`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`,Z=(e,t)=>{let l=X(e),n=Q(t);return l===n?"":l.startsWith(`${n}/`)?l.slice(n.length+1):""},ee=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||"/"===e)return[];let l=t.rootPrefix||"admin",n=t.basePath?Z(e,t.basePath):"",r=(t.basePath?n:e).replace(/^\/+/,"").split("/").filter(Boolean);if(r.length<(t.basePath?1:2))return[];let i=[],o=null,a=0;for(t.basePath&&(o={viewUid:r[0]},a=1);a<r.length;){let e=r[a];if(e===l||"view"===e)if(o&&i.push(o),a+1<r.length)o={viewUid:r[a+1]},a+=2;else break;else if(o){if("opts"===e){if(a+1<r.length){let e=J(o.viewUid,r[a+1]);e&&(o.openViewRouteState=e),a+=2}else a++;continue}if(a+1>=r.length){a++;continue}let t=r[a+1],l=t;try{l=decodeURIComponent(t)}catch(e){}switch(e){case"tab":o.tabUid=l;break;case"filterbytk":{let e=e=>{let t={};return e.split("&").forEach(e=>{let[l,n=""]=e.split("=");if(l)try{let e=decodeURIComponent(l),r=decodeURIComponent(n);t[e]=r}catch(e){t[l]=n}}),t},t=l;if(l&&(l.startsWith("{")||l.startsWith("[")))try{let e=JSON.parse(l);t=e&&"object"==typeof e&&!Array.isArray(e)?e:l}catch(e){t=l}else l&&/^[^=&]+=[^=&]*(?:&[^=&]+=[^=&]*)*$/.test(l)&&(t=e(l));o.filterByTk=t;break}case"sourceid":o.sourceId=l}a+=2}else a++}return o&&i.push(o),i};var et=l(74353),el=l.n(et);let en=/^\{\{\s*ctx\.date(?:\.(.+?))?\s*\}\}$/,er=new Set(["today","now","yesterday","tomorrow","thisWeek","lastWeek","nextWeek","thisMonth","lastMonth","nextMonth","thisQuarter","lastQuarter","nextQuarter","thisYear","lastYear","nextYear"]),ei=new Set(["next","past"]),eo=new Set(["day","week","month","year"]),ea=128;function es(e){if("string"!=typeof e)return null;let t=e.trim().match(en);if(!t)return null;let l=String(t[1]||"");return l?l.split(".").map(e=>e.trim()).filter(Boolean):[]}function ed(e){if("date"!==e[0])return!1;if(1===e.length)return!0;if("preset"===e[1])return 2===e.length||3===e.length&&er.has(e[2]);if("relative"===e[1])return 2===e.length||(3===e.length?ei.has(e[2]):4===e.length?ei.has(e[2])&&eo.has(e[3]):5===e.length&&ei.has(e[2])&&eo.has(e[3])&&"number"==typeof ey(e[4]));if("exact"===e[1]){if(2===e.length)return!0;if("single"===e[2])return 3===e.length||(4===e.length?"date"===e[3]:5===e.length&&"date"===e[3]&&/^v.+/.test(e[4]));if("range"===e[2]){if(3===e.length)return!0;if(4===e.length)return"date"===e[3];if(5===e.length)return"date"===e[3]&&/^v.+/.test(e[4]);if(6===e.length)return"date"===e[3]&&/^v.+/.test(e[4])&&/^v.+/.test(e[5])}}return!1}function eu(e){let t=String(e||"");if(!t.startsWith("v"))return;let l=eS(t.slice(1));if(l&&!(l.length>ea))return l}function ec(e){if("date"!==e[0])return null;if("format"!==e[1])return{baseSegments:e};if(e.length<4)return null;let t=eu(e[2]);return t?{baseSegments:["date",...e.slice(3)],format:t}:null}function ep(e){let t=eh((e||[]).map(e=>String(e)));if("date"!==t[0])return!1;if(1===t.length)return!0;if("format"!==t[1])return ed(t);if(2===t.length)return!0;if(3===t.length)return"string"==typeof eu(t[2]);let l=ec(t);return!!l&&ed(l.baseSegments)}function eh(e){return"date"===e[0]?e:["date",...e]}function em(e){let t=eh(e);return`{{ ctx.${t.join(".")} }}`}function ef(e){var t;let l=null==(t=globalThis)?void 0:t.Buffer;if(l&&"function"==typeof l.from)return l.from(e,"utf8").toString("base64");if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))));throw Error("No base64 encoder available")}function eg(e){var t;let l=null==(t=globalThis)?void 0:t.Buffer;if(l&&"function"==typeof l.from)return l.from(e,"base64").toString("utf8");if("function"==typeof atob)return decodeURIComponent(Array.from(atob(e)).map(e=>`%${e.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""));throw Error("No base64 decoder available")}function ev(e){if(null!=e){if("string"==typeof e){let t=e.trim();return t.length?t:void 0}if(el().isDayjs(e))return e.toISOString();if(e instanceof Date)return el()(e).toISOString();if("number"==typeof e||"boolean"==typeof e)return String(e)}}function ey(e){let t=String(e||"").match(/^n(\d+)$/);if(!t)return;let l=Number(t[1]);if(Number.isFinite(l)&&!(l<=0))return l}function eb(e){let t=e.day(),l=0===t?-6:1-t;return e.add(l,"day").startOf("day")}function ex(e){let t=3*Math.floor(e.month()/3);return e.month(t).startOf("month")}function ew(e){return ef(String(e||"")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function eS(e){try{let t=String(e||"").replace(/=+$/g,"");if(!t||!/^[A-Za-z0-9_-]+$/.test(t))return;let l=t.replace(/-/g,"+").replace(/_/g,"/"),n=l.length%4==0?0:4-l.length%4,r=`${l}${"=".repeat(n)}`,i=eg(r);if(ew(i)!==t)return;return i}catch(e){return}}function eM(e){return"string"==typeof e&&en.test(e.trim())}function eA(e){if(!ep(e))return!1;let t=ec(eh((e||[]).map(e=>String(e))));if(!t)return!1;let l=t.baseSegments;return"preset"===l[1]?3===l.length&&er.has(l[2]):"relative"===l[1]?5===l.length&&ei.has(l[2])&&eo.has(l[3])&&"number"==typeof ey(l[4]):"exact"===l[1]&&"single"===l[2]&&"date"===l[3]?5===l.length&&/^v.+/.test(l[4]):"exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length&&/^v.+/.test(l[4])&&/^v.+/.test(l[5])}function eF(e){if(!eM(e))return;let t=ec(eh(es(e)||[]));if(!t)return;let l=t.baseSegments;if("preset"===l[1]&&3===l.length&&er.has(l[2]))return{type:l[2]};if("relative"===l[1]&&5===l.length&&ei.has(l[2])&&eo.has(l[3])){let e=ey(l[4]);return"number"==typeof e?{type:l[2],unit:l[3],number:e}:void 0}if("exact"===l[1]&&"single"===l[2]&&"date"===l[3]&&5===l.length){let e=String(l[4]||"");if(!e.startsWith("v"))return;return eS(e.slice(1))}if("exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length){let e=String(l[4]||""),t=String(l[5]||"");if(!e.startsWith("v")||!t.startsWith("v"))return;let n=eS(e.slice(1)),r=eS(t.slice(1));if(void 0===n||void 0===r)return;return[n,r]}}function ek(e){if(!eM(e))return;let t=ec(eh(es(e)||[]));if(!t)return;let l=eF(e),n=t.format?{format:t.format}:{};if("string"==typeof l)return{kind:"exact",value:l,...n};if(Array.isArray(l)&&2===l.length&&"string"==typeof l[0]&&"string"==typeof l[1])return{kind:"exact",value:[l[0],l[1]],...n};if(!l||"object"!=typeof l)return;let r=l;if("past"===r.type||"next"===r.type){if("string"!=typeof r.unit||!eo.has(r.unit)||"number"!=typeof r.number)return;return{kind:"relative",direction:r.type,amount:r.number,unit:r.unit,...n}}if("string"==typeof r.type&&er.has(r.type))return{kind:"preset",preset:r.type,...n}}function eC(e){let t;if("preset"===e.kind){if(!er.has(e.preset))return;t={type:e.preset}}else if("relative"===e.kind){if(!ei.has(e.direction)||!eo.has(e.unit))return;let l=Math.floor(Number(e.amount));if(!Number.isFinite(l)||l<=0)return;t={type:e.direction,unit:e.unit,number:l}}else t=e.value;let l=eP(t);if(!l||!e.format)return l;let n=String(e.format);if(!n.trim()||n.length>ea)return;let r=eh(es(l)||[]);return em(["date","format",`v${ew(n)}`,...r.slice(1)])}function eP(e){if(eM(e))return String(e).trim();if(null==e||""===e)return;if(Array.isArray(e)){let t=ev(e[0]),l=ev(e[1]);return t&&l?em(["date","exact","range","date",`v${ew(t)}`,`v${ew(l)}`]):t?em(["date","exact","single","date",`v${ew(t)}`]):void 0}if("object"==typeof e&&e){let t=e,l="string"==typeof t.type?t.type:"";if("past"===l||"next"===l){let e="string"==typeof t.unit&&eo.has(t.unit)?t.unit:"day",n=Number(t.number),r=Number.isFinite(n)&&n>0?Math.floor(n):1;return em(["date","relative",l,e,`n${r}`])}if(er.has(l))return em(["date","preset",l])}let t=ev(e);if(t)return em(["date","exact","single","date",`v${ew(t)}`])}function ej(e,t){let l=e=>{if("string"!=typeof e)return e;let l=el()(e);return l.isValid()?l.format(t):e};return Array.isArray(e)?e.map(l):l(e)}function eE(e){let t=ec(eh((e||[]).map(e=>String(e))));if(!t)return;if(t.format)return ej(eE(t.baseSegments),t.format);let l=t.baseSegments;if("date"===l[0]){if("preset"===l[1]&&3===l.length){let e=l[2];if("now"===e)return el()().toISOString();let t=el()();return"today"===e?t.format("YYYY-MM-DD"):"yesterday"===e?t.add(-1,"day").format("YYYY-MM-DD"):"tomorrow"===e?t.add(1,"day").format("YYYY-MM-DD"):"thisWeek"===e?eb(t).format("YYYY-MM-DD"):"lastWeek"===e?eb(t.add(-1,"week")).format("YYYY-MM-DD"):"nextWeek"===e?eb(t.add(1,"week")).format("YYYY-MM-DD"):"thisMonth"===e?t.startOf("month").format("YYYY-MM-DD"):"lastMonth"===e?t.add(-1,"month").startOf("month").format("YYYY-MM-DD"):"nextMonth"===e?t.add(1,"month").startOf("month").format("YYYY-MM-DD"):"thisQuarter"===e?ex(t).format("YYYY-MM-DD"):"lastQuarter"===e?ex(t.add(-3,"month")).format("YYYY-MM-DD"):"nextQuarter"===e?ex(t.add(3,"month")).format("YYYY-MM-DD"):"thisYear"===e?t.startOf("year").format("YYYY-MM-DD"):"lastYear"===e?t.add(-1,"year").startOf("year").format("YYYY-MM-DD"):"nextYear"===e?t.add(1,"year").startOf("year").format("YYYY-MM-DD"):void 0}if("relative"===l[1]&&5===l.length&&ei.has(l[2])&&eo.has(l[3])){let e=ey(l[4]);if("number"!=typeof e)return;let t="past"===l[2]?-1:1,n=l[3];return el()().add(t*e,n).format("YYYY-MM-DD")}if("exact"===l[1]&&"single"===l[2]&&"date"===l[3]&&5===l.length){let e=String(l[4]||"");if(!e.startsWith("v"))return;return eS(e.slice(1))}if("exact"===l[1]&&"range"===l[2]&&"date"===l[3]&&6===l.length){let e=String(l[4]||""),t=String(l[5]||"");if(!e.startsWith("v")||!t.startsWith("v"))return;let n=eS(e.slice(1)),r=eS(t.slice(1));if(void 0===n||void 0===r)return;return[n,r]}}}var eR=l(51143);let eI=new Set(["code","version"]);function eT(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.keys(e);if(!t.includes("code")||"string"!=typeof e.code||"version"in e&&null!=e.version&&"string"!=typeof e.version)return!1;for(let e of t)if(!eI.has(e))return!1;return!0}function e_(e){return{code:String((null==e?void 0:e.code)??""),version:String((null==e?void 0:e.version)??"v1")}}function eD(e){let t="",l="code";for(let n=0;n<e.length;n++){let r=e[n],i=n+1<e.length?e[n+1]:"";if("code"===l){if("/"===r&&"/"===i){t+=" ",n++,l="line";continue}if("/"===r&&"*"===i){t+=" ",n++,l="block";continue}if("'"===r){t+=" ",l="single";continue}if('"'===r){t+=" ",l="double";continue}t+=r;continue}if("line"===l){"\n"===r?(t+="\n",l="code"):t+=" ";continue}if("block"===l){"*"===r&&"/"===i?(t+=" ",n++,l="code"):t+="\n"===r?"\n":" ";continue}if("single"===l){if("\\"===r){t+=" ",n++;continue}"'"===r?(t+=" ",l="code"):t+="\n"===r?"\n":" ";continue}if("\\"===r){t+=" ",n++;continue}'"'===r?(t+=" ",l="code"):t+="\n"===r?"\n":" "}return t}function eN(e){let t="",l="code";for(let n=0;n<e.length;n++){let r=e[n],i=n+1<e.length?e[n+1]:"";if("code"===l){if("/"===r&&"/"===i){t+=" ",n++,l="line";continue}if("/"===r&&"*"===i){t+=" ",n++,l="block";continue}if("'"===r){t+=r,l="single";continue}if('"'===r){t+=r,l="double";continue}t+=r;continue}if("line"===l){"\n"===r?(t+="\n",l="code"):t+=" ";continue}if("block"===l){"*"===r&&"/"===i?(t+=" ",n++,l="code"):t+="\n"===r?"\n":" ";continue}if("single"===l){if(t+=r,"\\"===r){let l=n+1<e.length?e[n+1]:"";l&&(t+=l,n++);continue}"'"===r&&(l="code");continue}if(t+=r,"\\"===r){let l=n+1<e.length?e[n+1]:"";l&&(t+=l,n++);continue}'"'===r&&(l="code")}return t}function eO(e){let t;if(!e)return{subPath:"",wildcard:!1};let l=e;l=l.replace(/\[['"]([a-zA-Z_$][a-zA-Z0-9_$]*)['"]\]/g,".$1");let n=/\[([^\]]+)\]/g;for(;t=n.exec(l);){let e=String(t[1]??"").trim();if(!(/^\d+$/.test(e)||/^['"][a-zA-Z_$][a-zA-Z0-9_$]*['"]$/.test(e)))return{subPath:l.startsWith(".")?l.slice(1):l,wildcard:!0}}return l.startsWith(".")&&(l=l.slice(1)),{subPath:l,wildcard:!1}}function e$(e){let t=String(e||"").trim();if(!t||"ctx"===t)return null;let l=t.match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([\s\S]*)$/);if(l){let e=l[1]||"",t=eO(l[2]||"");return{varName:e,subPath:t.subPath,wildcard:t.wildcard}}let n=t.match(/^ctx\s*\[\s*(['"])([a-zA-Z_$][a-zA-Z0-9_$]*)\1\s*\]([\s\S]*)$/);if(n){let e=n[2]||"",t=eO(n[3]||"");return{varName:e,subPath:t.subPath,wildcard:t.wildcard}}return null}function eB(e){let t;if("string"!=typeof e||!e.trim())return{};let l=eD(e),n=eN(e),r=new Map,i=(e,t)=>{if(!e)return;let l=r.get(e)||new Set;l.add(t||""),r.set(e,l)},o=e=>{let t=e$(e);(null==t?void 0:t.varName)&&i(t.varName,t.wildcard?"":t.subPath)},a=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g;for(;t=a.exec(l);)o(`ctx.${t[1]||""}`);let s=/ctx\s*\[\s*(['"])([a-zA-Z_$][a-zA-Z0-9_$]*)\1\s*\]((?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g;for(;t=s.exec(n);)o(`ctx['${t[2]||""}']${t[3]||""}`);let d=/ctx\.getVar\s*\(\s*(['"])((?:\\.|(?!\1)[\s\S])*)\1\s*\)/g;for(;t=d.exec(n);){let e=String(t[2]||"").replace(/\\'/g,"'").replace(/\\"/g,'"').trim();e.startsWith("ctx")&&o(e)}let u={};for(let[e,t]of r.entries())u[e]=Array.from(t);return u}async function eL(e,t){let l={};if(!t||"object"!=typeof t||Array.isArray(t))return l;for(let[n,r]of Object.entries(t))if(void 0!==r){if(eT(r)){let{code:t,version:i}=e_(r);if(!t.trim())continue;let o=await (0,eR._)(e,t,{version:i});if(!(null==o?void 0:o.success))throw Error(`RunJS execution failed for "${n}"`);void 0!==o.value&&(l[n]=o.value);continue}l[n]=r}return l}var eq=l(49773);let eV="ctx.resolveJsonTemplate",ez=/\{\{\s*ctx(?:\.|\[|\?\.)/,eK=/\bctx(?:\?\.|\.)libs\b/,eU="__runjs_templateValueToString",eW=/\b__runjs_ctx_tpl_\d+\b/,eH=/\b__runjs_templateValueToString(?:_\d+)?\b/,eY=/\b__runjs_ctx_tpl_\d+\b|\b__runjs_templateValueToString(?:_\d+)?\b/,eG=/\b__runjs_ensure_libs\b/,eJ=256,eX={withTemplates:new Map,withoutTemplates:new Map};function eQ(e,t){let l=e.get(t);if(void 0!==l)return e.delete(t),e.set(t,l),l}function eZ(e,t,l,n){if(e.has(t)&&e.delete(t),e.set(t,l),e.size<=n)return;let r=e.keys().next().value;void 0!==r&&e.delete(r)}function e0(e){return!!e&&/[A-Za-z0-9_$]/.test(e)}function e1(e){if(!e.startsWith("{{")||!e.endsWith("}}"))return!1;let t=e.slice(2,-2).trim();return t.startsWith("ctx.")||t.startsWith("ctx[")||t.startsWith("ctx?.")}function e2(e,t){if(!e.startsWith(eV,t))return!1;let l=t>0?e[t-1]:"",n=e[t+eV.length]||"";return!(e0(l)||e0(n))}function e5(e,t){let l=t+2;for(;l<e.length;){let t=e[l];if(l+=1,"\n"===t)break}return l}function e4(e,t){let l=t+2;for(;l<e.length;){let t=e[l],n=e[l+1];if("*"===t&&"/"===n)return l+2;l+=1}return l}function e8(e,t,l){let n=t+1;for(;n<e.length;){let t=e[n];if("\\"===t){n+=2;continue}if(n+=1,t===l)break}return n}function e3(e,t){let l=t+1;for(;l<e.length;){let t=e[l];if("\\"===t){l+=2;continue}if("`"===t)return l+1;if("$"===t&&"{"===e[l+1]){l+=2;let t=1;for(;l<e.length&&t>0;){let n=e[l],r=e[l+1];if("'"===n||'"'===n){l=e8(e,l,n);continue}if("`"===n){l=e3(e,l);continue}if("/"===n&&"/"===r){l=e5(e,l);continue}if("/"===n&&"*"===r){l=e4(e,l);continue}"{"===n?t+=1:"}"===n&&(t-=1),l+=1}continue}l+=1}return l}function e6(e){if(!ez.test(e))return[];let t=[],l=0;for(;l<e.length;){let n=e.indexOf("{{",l);if(-1===n)break;let r=e.indexOf("}}",n+2);if(-1===r)break;let i=e.slice(n,r+2);e1(i)&&t.push(i),l=r+2}return t}function e9(e,t){let l=t;for(;l<e.length&&/\s/.test(e[l]);)l+=1;return l}function e7(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]);)l-=1;return l}function te(e,t){let l=t;for(;;){l=e9(e,l);let t=e[l],n=e[l+1];if("/"===t&&"/"===n){l=e5(e,l);continue}if("/"===t&&"*"===n){l=e4(e,l);continue}return l}}function tt(e){return!!e&&/[A-Za-z_$]/.test(e)}function tl(e,t){if(!tt(e[t]))return null;let l=t+1;for(;l<e.length&&e0(e[l]);)l+=1;return{name:e.slice(t,l),end:l}}function tn(e,t,l){if(e[t]!==l)return null;let n=t+1,r="";for(;n<e.length;){let t=e[n];if("\\"===t){let t=e[n+1];if(void 0===t)break;r+=t,n+=2;continue}if(t===l)return{value:r,end:n+1};r+=t,n+=1}return null}function tr(e,t){if(!e.startsWith("ctx",t))return null;let l=t>0?e[t-1]:"",n=e[t+3]||"";if(e0(l)||e0(n))return null;let r=e.slice(t+3);return r.startsWith(".libs")?t+3+5:r.startsWith("?.libs")?t+3+6:null}function ti(e,t){let l=tr(e,t);if(null===l)return null;let n=te(e,l),r=e[n],i=e[n+1],o=e[n+2];if("?"===r&&"."===i&&"["===o){n=te(e,n+3);let t=e[n];if("'"===t||'"'===t){let l=tn(e,n,t);if(!l)return{end:n+1};let r=te(e,l.end);return"]"===e[r]&&(r+=1),{end:r,key:l.value}}return{end:n}}if("["===r){n=te(e,n+1);let t=e[n];if("'"===t||'"'===t){let l=tn(e,n,t);if(!l)return{end:n+1};let r=te(e,l.end);return"]"===e[r]&&(r+=1),{end:r,key:l.value}}return{end:n}}if("?"===r&&"."===i){n=te(e,n+2);let t=tl(e,n);return t?{end:t.end,key:t.name}:{end:n}}if("."===r){n=te(e,n+1);let t=tl(e,n);return t?{end:t.end,key:t.name}:{end:n}}return{end:l}}function to(e){let t=[],l=String(e??""),n=0,r=0,i=0,o=0,a=e=>{let l=String(e??"").trim();if(!l||l.startsWith("..."))return;let n=l,r=0,i=0,o=0,a=0;for(;r<l.length;){let e=l[r],t=l[r+1];if("/"===e&&"/"===t)break;if("/"===e&&"*"===t){let e=l.indexOf("*/",r+2);r=-1===e?l.length:e+2;continue}if("'"===e||'"'===e){let t=r+1;for(;t<l.length;){let n=l[t];if("\\"===n){t+=2;continue}if(t+=1,n===e)break}r=t;continue}if("`"===e){let e=r+1;for(;e<l.length;){let t=l[e];if("\\"===t){e+=2;continue}if(e+=1,"`"===t)break}r=e;continue}if("{"===e?i+=1:"}"===e?i-=1:"["===e?o+=1:"]"===e?o-=1:"("===e?a+=1:")"===e&&(a-=1),0===i&&0===o&&0===a&&(":"===e||"="===e)){n=l.slice(0,r).trim();break}r+=1}if(!n)return;if(n.startsWith("'")||n.startsWith('"')){let e=n[0],l=tn(n,0,e);l&&t.push(l.value);return}let s=n.match(/^[A-Za-z_$][A-Za-z0-9_$]*/);s&&t.push(s[0])},s=0;for(;s<l.length;){let e=l[s],t=l[s+1];if("/"===e&&"/"===t)break;if("/"===e&&"*"===t){let e=l.indexOf("*/",s+2);s=-1===e?l.length:e+2;continue}if("'"===e||'"'===e){s=e8(l,s,e);continue}if("`"===e){s=e3(l,s);continue}"{"===e?r+=1:"}"===e?r-=1:"["===e?i+=1:"]"===e?i-=1:"("===e?o+=1:")"===e&&(o-=1),0===r&&0===i&&0===o&&","===e&&(a(l.slice(n,s)),n=s+1),s+=1}return a(l.slice(n)),t}function ta(e){if(!eK.test(e))return[];let t=new Set,l=l=>{let r=l,i=1;for(;r<e.length&&i>0;){let l=e[r],o=e[r+1];if("/"===l&&"/"===o){r=e5(e,r);continue}if("/"===l&&"*"===o){r=e4(e,r);continue}if("'"===l||'"'===l){r=e8(e,r,l);continue}if("`"===l){r=n(r+1);continue}let a=ti(e,r);if(a){a.key&&t.add(a.key),r=a.end;continue}"{"===l?i+=1:"}"===l&&(i-=1),r+=1}return r},n=t=>{let n=t;for(;n<e.length;){let t=e[n],r=e[n+1];if("\\"===t){n+=2;continue}if("`"===t)return n+1;if("$"===t&&"{"===r){n=l(n+2);continue}n+=1}return n},r=0;for(;r<e.length;){let l=e[r],i=e[r+1];if("/"===l&&"/"===i){r=e5(e,r);continue}if("/"===l&&"*"===i){r=e4(e,r);continue}if("'"===l||'"'===l){r=e8(e,r,l);continue}if("`"===l){r=n(r+1);continue}let o=ti(e,r);if(o){o.key&&t.add(o.key),r=o.end;continue}if("="===l&&"="!==i&&">"!==i&&"<"!==i){let l=te(e,r+1);if(null!==tr(e,l)){let l=e7(e,r-1);if("}"===e[l]){let n=0,r=l;for(;r>=0;){let t=e[r];if("}"===t)n+=1;else if("{"===t&&0==(n-=1))break;r-=1}if(r>=0&&"{"===e[r])for(let n of to(e.slice(r+1,l)))t.add(n)}}}r+=1}return Array.from(t)}function ts(e){if(eG.test(e)||!eK.test(e))return e;let t=ta(e);return t.length?`/* __runjs_ensure_libs */
|
|
1703
1703
|
await ctx.__ensureLibs(${JSON.stringify(t)});
|
|
1704
1704
|
${e}`:e}function td(e,t,l){let n=e9(e,l);if(":"!==e[n])return!1;let r=e7(e,t-1),i=r>=0?e[r]:"";return"{"===i||","===i}function tu(e,t,l,n){let r=Array.from(new Set(t));if(!r.length)return e;let i=e;for(let e of r){let t=l(e);i=`(${i}).split(${JSON.stringify(e)}).join(${n}(${t}, ${JSON.stringify(e)}))`}return i}function tc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ez.test(e))return e;let l=!1!==t.processBarePlaceholders,n=!1!==t.processStringLiterals;if(l&&n&&eY.test(e)||l&&!n&&eW.test(e)||!l&&n&&eH.test(e))return e;let r=new Map,i=[],o=!1,a=new Set,s=(t=>{if(!e.includes(t)&&!a.has(t))return a.add(t),t;let l=1;for(;e.includes(`${t}_${l}`)||a.has(`${t}_${l}`);)l+=1;let n=`${t}_${l}`;return a.add(n),n})(eU),d=0,u=()=>{for(;;){let t=`__runjs_ctx_tpl_${d}`;if(d+=1,!(e.includes(t)||a.has(t)))return a.add(t),t}},c=e=>{let t=r.get(e);if(t)return t;let l=u();return r.set(e,l),i.push(`const ${l} = await ctx.resolveJsonTemplate(${JSON.stringify(e)});`),l},p="",h=0,m=!1,f=0;for(;h<e.length;){let t=e[h],r=e[h+1];if("/"===t&&"/"===r){let t=e5(e,h);p+=e.slice(h,t),h=t;continue}if("/"===t&&"*"===r){let t=e4(e,h);p+=e.slice(h,t),h=t;continue}if("'"===t||'"'===t){let l=e8(e,h,t),r=e.slice(h,l);if(n&&0===f){let t=e6(r);if(t.length){o=!0;let n=tu(r,t,c,s);p+=td(e,h,l)?`[${n}]`:n}else p+=r}else p+=r;h=l;continue}if("`"===t){let t=e3(e,h),l=e.slice(h,t);if(n&&0===f){let n=e6(l);if(n.length){o=!0;let r=tu(l,n,c,s);p+=td(e,h,t)?`[${r}]`:r}else p+=l}else p+=l;h=t;continue}if(0===f&&!m&&e2(e,h)){p+=eV,h+=eV.length,m=!0;continue}if(m){if(/\s/.test(t)){p+=t,h+=1;continue}if("("===t){p+=t,h+=1,m=!1,f=1;continue}m=!1;continue}if(f>0){"("===t?f+=1:")"===t&&(f-=1),p+=t,h+=1;continue}if(l&&"{"===t&&"{"===r){let t=e.indexOf("}}",h+2);if(-1!==t){let l=e.slice(h,t+2);if(e1(l)){p+=c(l),h=t+2;continue}}}p+=t,h+=1}if(!i.length)return p;let g=[];return o&&g.push(`const ${s} = (value, placeholder) => {`," if (typeof value === 'undefined') return placeholder;"," if (typeof value === 'object' && value !== null) {"," try {"," return JSON.stringify(value);"," } catch (e) {"," return String(value);"," }"," }"," return String(value);","};"),g.push(...i),`${g.join("\n")}
|
|
1705
|
-
${p}`}async function tp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,r=n?eX.withTemplates:eX.withoutTemplates,i=eQ(r,l);if(i)return await i;let o=(async()=>{if(!n)return ts(await (0,eq.W)(l));let e=tc(l,{processStringLiterals:!1});return ts(tc(await (0,eq.W)(e),{processBarePlaceholders:!1}))})();eZ(r,l,o,eJ);try{return await o}catch(e){throw r.delete(l),e}}var th=l(62572);function tm(e){if(Array.isArray(e)){let t=e.map(e=>tm(e)).filter(e=>void 0!==e);return t.length?t:void 0}if(e&&"object"==typeof e){let t={};return Object.keys(e).forEach(l=>{let n=tm(e[l]);void 0!==n&&(t[l]=n)}),Object.keys(t).length?t:void 0}return null==e||"string"==typeof e&&""===e?void 0:e}let tf=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var tg=l(47684);let tv="0123456789abcdefghijklmnopqrstuvwxyz";function ty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:11,l="";for(let e=0;e<t;e++)l+=tv[Math.random()*tv.length|0];return`${e}${l}`}},49773(e,t,l){l.d(t,{W:()=>n});async function n(e){if(!/<[A-Za-z]|<\//.test(e))return e;try{var t;let n=await l.e("7761").then(l.bind(l,1608)),r=(null==n?void 0:n.transform)||(null==n||null==(t=n.default)?void 0:t.transform);if("function"!=typeof r)return e;let i=r(e,{transforms:["jsx"],jsxPragma:"ctx.React.createElement",jsxFragmentPragma:"ctx.React.Fragment",disableESTransforms:!0,production:!0});return(i&&(i.code||(null==i?void 0:i.output)))??e}catch(t){return e}}},81982(e,t,l){l.d(t,{M:()=>f,gG:()=>a,mv:()=>s,o4:()=>h,pk:()=>m});var n=l(40542),r=l(13939),i=l(2543),o=l.n(i);async function a(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving defaultParams function:",e),{}}return e}async function s(e,t,l){if(!e)return{};if("function"==typeof e)try{return await e(t,l)||{}}catch(e){return console.error("Error resolving createModelOptions function:",e),{}}return e}let d={queue:[],timer:null,inflightByRun:new Map},u=10;function c(e){if(Array.isArray(e))return e.map(c);if(o().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,c(l)]});return Object.fromEntries(o().sortBy(t,e=>{let[t]=e;return t}))}return e}function p(e){try{return JSON.stringify(c(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function h(e,t){let l,n,r=d,i=e.runId||"GLOBAL",o=p(t),a=r.inflightByRun.get(i);a||(a=new Map,r.inflightByRun.set(i,a));let s=a.get(o);if(s)return s;let c=new Promise((e,t)=>{l=e,n=t});a.set(o,c);let h={id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,ctx:e,payload:t,resolve:l,reject:n,runId:i,dedupKey:o};r.queue.push(h);let m=async()=>{var t,l,n,i,o,a;let s=r.queue.splice(0,r.queue.length);if(r.timer=null,!s.length)return;let d=null==(t=s[0].ctx)?void 0:t.api;if(!d){for(let e of s)try{e.resolve(e.payload.template)}catch(t){e.reject(t)}finally{null==(l=r.inflightByRun.get(e.runId))||l.delete(e.dedupKey)}return}try{let e=s.map(e=>({id:e.id,rd:e.payload.rd,template:e.payload.template,contextParams:e.payload.contextParams||{}})),t=await d.request({method:"POST",url:"variables:resolve",data:{values:{batch:e}}}),l=t.data??t,i=l.data??l,o=null==i?void 0:i.results,a=Array.isArray(o)?o:Array.isArray(i)?i:[],u=new Map;for(let e of a){let t=(null==e?void 0:e.id)!=null?String(e.id):"";t&&u.set(t,null==e?void 0:e.data)}for(let e of s)try{let t=String(e.id),l=u.has(t)?u.get(t):e.payload.template;e.resolve(l)}catch(t){e.reject(t)}finally{null==(n=r.inflightByRun.get(e.runId))||n.delete(e.dedupKey)}}catch(t){for(let l of s)try{null==e||null==(o=e.logger)||null==(i=o.warn)||i.call(o,{err:t},"variables:resolve(batch) failed, fallback"),l.resolve(l.payload.template)}catch(e){l.reject(e)}finally{null==(a=r.inflightByRun.get(l.runId))||a.delete(l.dedupKey)}}};return r.timer||(r.timer=setTimeout(m,u)),c}function m(e,t){var l,n;return(0,r.generateFlowModelRdFromToken)(t,null==e||null==(n=e.api)||null==(l=n.auth)?void 0:l.token)}async function f(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await y(e,t);if(Array.isArray(e))return Promise.all(e.map(l));if(e&&"object"==typeof e){let t={};for(let[n,r]of Object.entries(e))t[n]=await l(r);return t}return e};return l(e)}async function g(e,t){let l=await v(e.trim(),t),n=await t.runjs(`return ${l}`,{t:t.t});return(null==n?void 0:n.success)?n.value:void 0}async function v(e,t){let l,n=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g,r=[],i=new Set;for(;null!==(l=n.exec(e));){let e=l[0],t=l[1],n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);if(n){let l=n[1],o=t.substring(l.length);r.push({fullPath:e,firstKey:l,restPath:o}),i.add(l)}}if(0===r.length)return e;let o=new Map;for(let e of i)try{let l=await t[e],n=l&&!0===l.__isRecordProxy__;o.set(e,n)}catch(t){o.set(e,!1)}r.sort((e,t)=>t.fullPath.length-e.fullPath.length);let a=e;for(let{fullPath:e,firstKey:t,restPath:l}of r){let n,r=o.get(t)||!1;n=""===l?`await ctx.${t}`:r?`await (await ctx.${t})${l}`:`(await ctx.${t})${l}`;let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=RegExp(`\\b${i}\\b`,"g");a=a.replace(s,n)}return a}async function y(e,t){let l=e=>{let t=e.trim().match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*))?$/);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:null},r=async e=>{let l=e.split("."),r=l.shift();if(!r)return;let i=await t[r];return 0===l.length?i:(0,n.D)(i,l.join("."))},i=async e=>{let n=l(e);if(n){let l=await r(n);return void 0===l&&n.includes("-")?await g(e,t):l}return await g(e,t)},o=e.match(/^\s*\{\{\s*([^{}]+?)\s*\}\}\s*$/);if(o){let e=o[1];return await i(e)}let a=[...e.matchAll(/\{\{\s*(.+?)\s*\}\}/g)],s=e;for(let[e,t]of a){let l=await i(t);if(void 0!==l){let t="object"==typeof l&&null!==l?JSON.stringify(l):String(l);s=s.replace(e,t)}}return s}},47684(e,t,l){function n(e,t){if(!e||"string"!=typeof e)throw Error("invalid url");let l=e.trim();if(l.startsWith("http://")||l.startsWith("https://"))return l;let n=window.__esm_cdn_base_url__||"https://esm.sh",r=(null==t?void 0:t.addSuffix)&&window.__esm_cdn_suffix__||"",i=n.replace(/\/$/,""),o=l.replace(/^\//,"");if(null==t?void 0:t.raw){let e=o.includes("?")?"&":"?";return`${i}/${o}${e}raw`}return`${i}/${o}${r}`}function r(e){return!!e&&"string"==typeof e&&e.split("?")[0].split("#")[0].endsWith(".css")}l.d(t,{i:()=>n,y:()=>r})},51143(e,t,l){function n(){var e,t;let l=globalThis;if((null==(e=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:e.windowAllow)&&(null==(t=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:t.documentAllow))return l.__nocobaseRunJSSafeGlobalsRegistry;let n={windowAllow:new Set,documentAllow:new Set};return l.__nocobaseRunJSSafeGlobalsRegistry=n,n}function r(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.windowAllow.add(e)}}function i(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.documentAllow.add(e)}}function o(e){return n().windowAllow.has(e)}function a(e){return n().documentAllow.has(e)}function s(e){let t=()=>`${window.location.origin}${window.location.pathname}`,l=(e,l,n)=>{if(!(e=>{try{let l=new URL(e,t()),n=l.protocol.toLowerCase();if("about:"===n)return"about:blank"===l.href;return"http:"===n||"https:"===n}catch{return!1}})(e))throw Error("Unsafe URL: window.open only allows http/https/about:blank.");let r="_blank",i=(e=>{let t=new Set;return e&&e.split(",").map(e=>e.trim()).filter(Boolean).forEach(e=>{let l=e.split("=")[0].trim().toLowerCase();"noopener"!==l&&"noreferrer"!==l&&t.add(e)}),t.add("noopener"),t.add("noreferrer"),Array.from(t).join(",")})(n),o=window.open.call(window,e,r,i);if(o&&"opener"in o)try{o.opener=null}catch{}return o},n=(e,n)=>{let r=new URL(e,t()),i=r.protocol.toLowerCase(),o="about:"===i&&"about:blank"===r.href;if("http:"!==i&&"https:"!==i&&!o)throw Error("Unsafe URL: only http/https/about:blank are allowed.");if(o)return(null==n?void 0:n.replace)?window.location.replace("about:blank"):window.location.assign("about:blank");if(r.protocol===window.location.protocol&&r.hostname===window.location.hostname&&r.port===window.location.port)return(null==n?void 0:n.replace)?window.location.replace(r.href):window.location.assign(r.href);if(!l(r.href))throw Error("Popup blocked: cross-origin navigation is opened in a new tab.")},r=new Proxy({},{get(e,t){switch(t){case"origin":return window.location.origin;case"protocol":return window.location.protocol;case"host":return window.location.host;case"hostname":return window.location.hostname;case"port":return window.location.port;case"pathname":return window.location.pathname;case"assign":return e=>n(e,{replace:!1});case"replace":return e=>n(e,{replace:!0});case"reload":return window.location.reload.bind(window.location);case"href":throw Error("Reading location.href is not allowed.");default:throw Error(`Access to location property "${t}" is not allowed.`)}},set(e,t,l){if("href"===t)return n(String(l),{replace:!1}),!0;throw Error("Mutation on location is not allowed.")}}),i={setTimeout:window.setTimeout.bind(window),clearTimeout:window.clearTimeout.bind(window),setInterval:window.setInterval.bind(window),clearInterval:window.clearInterval.bind(window),console,Math,Date,FormData,..."u">typeof Blob?{Blob}:{},..."u">typeof URL?{URL}:{},addEventListener:addEventListener.bind(window),open:l,location:r,...e||{}};return new Proxy(Object.create(null),{get(e,t){if("string"!=typeof t)return Reflect.get(e,t);if(t in i)return i[t];if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(o(t)){let e=window[t];return"function"==typeof e?e.bind(window):e}throw Error(`Access to global property "${t}" is not allowed.`)},set(e,t,l){if("string"!=typeof t)return Reflect.set(e,t,l),!0;if(t in i)throw Error(`Mutation of global property "${t}" is not allowed.`);return e[t]=l,!0},has:(e,t)=>"string"!=typeof t?Reflect.has(e,t):!!(t in i||Object.prototype.hasOwnProperty.call(e,t)||o(t))})}function d(e){let t={createElement:document.createElement.bind(document),querySelector:document.querySelector.bind(document),querySelectorAll:document.querySelectorAll.bind(document),...e||{}};return new Proxy(Object.create(null),{get(e,l){if("string"!=typeof l)return Reflect.get(e,l);if(l in t)return t[l];if(Object.prototype.hasOwnProperty.call(e,l))return e[l];if(a(l)){let e=document[l];return"function"==typeof e?e.bind(document):e}throw Error(`Access to document property "${l}" is not allowed.`)},set(e,l,n){if("string"!=typeof l)return Reflect.set(e,l,n),!0;if(l in t)throw Error(`Mutation of document property "${l}" is not allowed.`);return e[l]=n,!0},has:(e,l)=>"string"!=typeof l?Reflect.has(e,l):!!(l in t||Object.prototype.hasOwnProperty.call(e,l)||a(l))})}function u(e){var t;let l="u">typeof window&&window.navigator||void 0,n={},r=null==l||null==(t=l.clipboard)?void 0:t.writeText;"function"==typeof r&&(n.writeText=r.bind(l.clipboard));let i={clipboard:n};return Object.defineProperty(i,"onLine",{get:()=>!!(null==l?void 0:l.onLine),enumerable:!0,configurable:!1}),Object.defineProperty(i,"language",{get:()=>null==l?void 0:l.language,enumerable:!0,configurable:!1}),Object.defineProperty(i,"languages",{get:()=>(null==l?void 0:l.languages)?[...l.languages]:void 0,enumerable:!0,configurable:!1}),Object.assign(i,e||{}),new Proxy({},{get(e,t){if(t in i)return i[t];throw Error(`Access to navigator property "${String(t)}" is not allowed.`)}})}function c(e){let t={};try{let e=u();t.navigator=e;try{t.window=s({navigator:e})}catch{}}catch{}try{t.document=d()}catch{}return e?{...t,...e}:t}async function p(e,t,l,n){if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.runjs)return e.runjs(t,c(n),l)}l.d(t,{D1:()=>u,I2:()=>c,Vm:()=>r,Xh:()=>d,_:()=>p,ey:()=>s,yz:()=>i})},22928(e,t,l){function n(e){let t={};return Object.entries(e||{}).forEach(e=>{let[l,n]=e;null!=n&&(t[l]=n)}),t}function r(e,t,l){try{var n,r,i,o,a;let s=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,t||"main"),d=null==s||null==(o=s.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,l);return(null==d||null==(a=d.getPrimaryKey)?void 0:a.call(d))||"id"}catch(e){return"id"}}function i(e,t){var l,i;if(!t)return;let o=t.dataSourceKey||"main",a=t.collection||(null==(l=t.record)?void 0:l.__collectionName);if(!a)return;let s=r(e,o,a)||"id",d=void 0!==t.filterByTk?t.filterByTk:void 0!==t.id?t.id:null==(i=t.record)?void 0:i[s];if(void 0!==d)return n({collection:a,filterByTk:d,dataSourceKey:o,associationName:t.associationName,sourceId:t.sourceId,fields:t.fields,appends:t.appends})}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e=>!!e&&"object"==typeof e&&"string"==typeof e.collection&&(void 0!==e.filterByTk||void 0!==e.id||e.record),n={},r=(t,o)=>{if(l(t)){let l=i(e,t);l&&(n[o.join(".")]=l);return}if(Array.isArray(t)){for(let e=0;e<t.length;e++)r(t[e],[...o,String(e)]);return}if(t&&"object"==typeof t){for(let[e,l]of Object.entries(t))r(l,[...o,e]);return}};return r(t,[]),Object.keys(n).length?n:void 0}l.d(t,{d:()=>o})},88439(e,t,l){l.d(t,{w:()=>n});function n(e,t,l,n){let r={},i={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let s=t[a],d={};if(s.uiSchema&&"object"==typeof s.uiSchema){for(let[e,t]of Object.entries(s.uiSchema))if(t&&"object"==typeof t){var o;let l=t;d[e]={type:l.type||"any",title:l.title||(null==(o=l["x-decorator-props"])?void 0:o.label)||e,interface:l["x-component"],uiSchema:l}}}let u=Object.keys(d).length>0;i[a]={type:"object",title:e.t(s.title)||a,display:u?"default":"none",properties:u?{params:{type:"object",title:"Parameters",display:"flatten",properties:d}}:void 0},r[a]={get params(){return l.getStepParams(n,a)||{}},get uiSchema(){return s.uiSchema},result:void 0}}e.defineProperty("steps",{get:()=>r})}},73398(e,t,l){function n(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function r(e){return!!e&&/[a-zA-Z_$]/.test(e)}function i(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function o(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function a(e,t){let l=o(e,t);for(;"!"===e[l];)l=o(e,l+1);return l}function s(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function d(e,t){let l=s(e,t-1);if("("!==e[l])return!1;let n=s(e,l-1);if(n<0)return!0;let r=e[n];return!i(r)&&")"!==r&&"]"!==r}function u(e,t){let l=o(e,t);if(")"!==e[l])return!1;let n=o(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function c(e,t){if(!r(e[t]))return null;let l=t+1;for(;i(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function p(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function h(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,r="";for(;n<e.length;){let t=e[n];if("\\"===t){r+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:r,next:n+1};r+=t,n+=1}return null}function m(e,t){let l=o(e,t+1),n=h(e,l);if(n)return(l=o(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let r=p(e,l);return r?(l=o(e,r.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:r.value}:{dynamic:!0}}function f(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function g(e,t){let l=a(e,t);if("["===e[l])return m(e,l);if(e.startsWith("?.",l)){let t=o(e,l+2);if("["===e[t])return m(e,t);let n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=o(e,l+1),n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function v(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function y(e,t){if("ctx"!==e.slice(t,t+3)||i(e[t-1])||i(e[t+3]))return null;if(d(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=g(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],r=l.next,o=!1,s=!1;for(;r<e.length;){let t=a(e,r);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){o=!0,r=t;break}let l=g(e,r);if(!l){r=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(s=!0);break}if(l.dynamic){s=!0,r=t;break}f(n,l.kind,l.value),r=l.next}let c=n.join(".");return{next:Math.max(r,l.next),reference:{methodCall:o,path:c||void 0,unsupportedDynamicPath:s||u(e,r),varName:l.value}}}function b(e){let t=v(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=y(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function x(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function w(e){let t={},l=!1,r=e=>{for(let n of b(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&x(t,n.varName,n.path,n.methodCall)}},i=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)r(t[1]);return}Array.isArray(e)?e.forEach(i):n(e)&&Object.values(e).forEach(i)};return i(e),{unsupportedDynamicPath:l,usage:t}}function S(e){return new Set(Object.keys(w(e).usage))}function M(e){return w(e).usage}l.d(t,{xI:()=>T,vP:()=>O,$S:()=>_,pc:()=>D,Cg:()=>E,nN:()=>$,ju:()=>B,Xx:()=>I,vE:()=>R,XU:()=>j,UX:()=>N});var A=l(22928),F=l(35846),k=l(44476),C=l(2543),P=l.n(C);function j(e){var t,l,n,r;let i=e.resource,o=e.collection,a=e.record,s=(null==o?void 0:o.name)||(null==i||null==(t=i.getResourceName)?void 0:t.call(i)),d=(null==o?void 0:o.dataSourceKey)||(null==i||null==(l=i.getDataSourceKey)?void 0:l.call(i)),u=(null==i||null==(n=i.getFilterByTk)?void 0:n.call(i))??(null==o||null==(r=o.getFilterByTK)?void 0:r.call(o,a));if(!s||null==u)return;let c=String(s).split(".");return{collection:c[c.length-1],dataSourceKey:d,filterByTk:u}}function E(e){var t,l,n;let r=e.view;if(!r)return;let i=(null==r?void 0:r.inputArgs)||{},o=(null==i?void 0:i.collectionName)||(null==r||null==(t=r.record)?void 0:t.collection),a=(null==i?void 0:i.dataSourceKey)||(null==r||null==(l=r.record)?void 0:l.dataSourceKey)||"main",s=(null==i?void 0:i.filterByTk)||(null==r||null==(n=r.record)?void 0:n.filterByTk),d=null==i?void 0:i.associationName,u=null==i?void 0:i.sourceId;if(o&&null!=s)return{collection:o,dataSourceKey:a,filterByTk:s,sourceId:u,associationName:d}}function R(e,t){var l,n,r;let i=null==(l=e.inputArgs)?void 0:l.record,o=null==(n=e.collection)?void 0:n.filterTargetKey;if(!i||!o)return;let a=t.view,s=null==a||null==(r=a.inputArgs)?void 0:r.filterByTk,d=i[o];if(null!=s&&null!=d&&s===d)return P().cloneDeep(i)}function I(e,t){return l=>{var n,r,i,o;if(!("record"===l||l.startsWith("record.")))return!1;let a=t();if(!a)return!0;if("record"===l)return!1;let s=E(e),d=null==s?void 0:s.collection,u=(null==s?void 0:s.dataSourceKey)||"main";if(!d)return!0;let c=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,u),p=null==c||null==(o=c.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,d);if(!p)return!0;let h=(0,k.Hi)(()=>p,()=>a),m=l.startsWith("record.")?l.slice(7):"";return!!m&&h(m)}}function T(e,t){let l=(0,k.Hi)(e,()=>t());return n=>{let r=t();if(!r)return!0;if(!n)return!1;let i=e();if(!n.includes(".")){var o;let e,t=n;return i&&("function"==typeof i.getField&&(e=i.getField(t)),e||"function"!=typeof i.getFields||(e=(i.getFields()||[]).find(e=>(null==e?void 0:e.name)===t))),!!(null==e||null==(o=e.isAssociationField)?void 0:o.call(e))&&null==(null==r?void 0:r[t])}return l(n)}}async function _(e,t,l){let n=await (0,F.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):j(e)}:null}function D(e,t,l){let n=async()=>_(e,t,l);return n.title=t,n}function N(e,t,l){var n,r;return D(t,(null==l?void 0:l.title)?(null==(n=e.t)?void 0:n.call(e,l.title))||l.title:(null==(r=e.t)?void 0:r.call(e,"Current record"))||"Current record",e=>j(e))}let O=S,$=M;async function B(e,t){let l=M(t)||{},n=Object.keys(l);if(!n.length)return;let r={};for(let t of n){var i;let l,n=null==(i=e.getPropertyOptions)?void 0:i.call(e,t),o=null==n?void 0:n.meta;if(o){try{let t="function"==typeof o?await o():o,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(r[t]=l)}}let o=l.view||[];if(!r.view&&o.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let t=E(e);t&&(r.view={record:t})}return(0,A.d)(e,r)}},67778(e,t,l){l.d(t,{sp:()=>j,bt:()=>T,U:()=>en,N5:()=>U,xB:()=>L,mW:()=>B,fP:()=>G});var n=l(74848),r=l(96540),i=l(99418),o=l(11869),a=l(29007),s=l(52568),d=l(73398);function u(e){if((null==e?void 0:e.sourceId)==null||""===e.sourceId||"string"!=typeof e.associationName)return;let t=e.associationName.split(".")[0];if(t)return{collection:t,dataSourceKey:e.dataSourceKey||"main",filterByTk:e.sourceId}}function c(e){return null!=e}function p(e,t){if(e===t)return!0;if(!c(e)||!c(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function h(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function m(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h(e);if(!l.length)return -1;let n=(null==e?void 0:e.inputArgs)||{},r=(null==e||null==(t=e.navigation)?void 0:t.viewParams)||{},i=n.viewUid??r.viewUid;if(!i)return l.length-1;let o=l.map((e,t)=>({item:e,index:t})).filter(e=>{let{item:t}=e;return(null==t?void 0:t.viewUid)===i});if(!o.length)return l.length-1;let a=["filterByTk","sourceId","tabUid"],s=o[o.length-1].index,d=-1;for(let{item:e,index:t}of o){let l=0,r=!0;for(let t of a)if(c(n[t])){if(!p(null==e?void 0:e[t],n[t])){r=!1;break}l+=1}r&&l>=d&&(s=t,d=l)}return s}function f(e,t){return t??e.view}function g(e){var t;if(!e)return!1;let l=h(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,r=Array.isArray(n)&&n.length>0;return m(e,l)>=1||r}function v(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return g(f(l,t))},r=async e=>{let l=f(e,t);if(!l||!g(l))return;let n=await y(e,l),r=null==n?void 0:n.resource;return(null==r?void 0:r.collectionName)&&null!=r.filterByTk?{collection:r.collectionName,dataSourceKey:r.dataSourceKey||"main",filterByTk:r.filterByTk,associationName:r.associationName,sourceId:r.sourceId}:(0,d.Cg)(e)},i=async()=>{var t,l,n,i;let o=await r(e);if(!(null==o?void 0:o.collection))return null;let a=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,o.dataSourceKey||"main");return(null==a||null==(i=a.collectionManager)||null==(n=i.getCollection)?void 0:n.call(i,o.collection))||null},o=async(l,n)=>{var r,i,o,a,s,d;try{let s=n||e,d=f(s,t),u=h(d),c=m(d,u);if(c<1||l<1)return;let p=c-l;if(p<1)return;let g=u[p];if(!(null==g?void 0:g.viewUid))return;let v=null==(r=s.engine)?void 0:r.getModel(g.viewUid,!0);if(!v)try{v=await s.engine.loadModel({uid:g.viewUid})}catch(t){null==(a=s.logger||e.logger)||null==(o=a.warn)||o.call(a,{err:t},"[FlowEngine] popup.getParentRecordRef loadModel failed")}let y=(null==v||null==(i=v.getStepParams)?void 0:i.call(v,"popupSettings","openView"))||{},b=null==y?void 0:y.collectionName,x=(null==y?void 0:y.dataSourceKey)||"main",w=(null==g?void 0:g.filterByTk)??(null==g?void 0:g.sourceId);if(!b||null==w)return;return{collection:b,dataSourceKey:x,filterByTk:w,sourceId:null==g?void 0:g.sourceId,associationName:null==y?void 0:y.associationName}}catch(t){null==(d=(null==n?void 0:n.logger)||e.logger)||null==(s=d.warn)||s.call(d,{err:t},"[FlowEngine] popup.getParentRecordRef failed");return}},a=l=>{try{let n=f(e,t),r=h(n);return m(n,r)-l>=1}catch(e){return!1}},s=t=>{let n=()=>({type:"object",title:l("Parent popup"),disabled:()=>!a(t),disabledReason:()=>a(t)?void 0:l("No parent popup"),hidden:()=>!a(t),properties:async()=>{let n=await o(t),r={};if(r.uid={type:"string",title:l("Popup uid")},n){let t=(()=>{try{var t,l,r,i;let o=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,n.dataSourceKey||"main");return(null==o||null==(i=o.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,n.collection||""))||null}catch(e){return null}})();r.record=await (0,d.$S)(()=>t,l("Popup record"),()=>n)||{type:"object",title:l("Popup record")}}else r.record={type:"object",title:l("Popup record")};return r.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},r}});return n.title=l("Parent popup"),n},c=()=>({type:"object",title:l("Current popup"),disabled:()=>!n(),hidden:()=>!n(),buildVariablesParams:async e=>{var l,i,a,s;if(!n(e))return;let d=await r(e),c=f(e,t),p=null==c?void 0:c.inputArgs,g={};if(d){let e={...d};!e.associationName&&(null==p?void 0:p.associationName)&&(e.associationName=p.associationName),void 0===e.sourceId&&void 0!==(null==p?void 0:p.sourceId)&&(e.sourceId=null==p?void 0:p.sourceId),g.record=e}try{let t=h(c);if(m(c,t)>=2){let t=g,l=1,n=await o(l,e);for(;n;){let r={record:n},i=u(n);i&&(r.sourceRecord=i),t.parent=r,t=r,l+=1,n=await o(l,e)}}}catch(t){null==(i=e.logger)||null==(l=i.debug)||l.call(i,{err:t},"[FlowEngine] buildVariablesParams: build parent-chain failed")}try{let e=u({sourceId:null==p?void 0:p.sourceId,associationName:null==p?void 0:p.associationName,dataSourceKey:null==p?void 0:p.dataSourceKey});e&&(g.sourceRecord=e)}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return g},properties:async()=>{var n,a,u,c;let p={};if(p.uid={type:"string",title:l("Popup uid")},await r(e)){let e=async()=>{let e=await i();return e?await (0,d.$S)(()=>e,l("Current popup record"),e=>r(e)):null};e.title=l("Current popup record"),e.hasChildren=!0,p.record=e}try{let r=f(e,t),i=null==r?void 0:r.inputArgs,o=null==i?void 0:i.sourceId,s=null==i?void 0:i.associationName,u=(null==i?void 0:i.dataSourceKey)||"main";if(!s||"string"!=typeof s||!s.includes(".")){let t=h(r),l=m(r,t),i=l>=0?null==t?void 0:t[l]:void 0;if(null==i?void 0:i.viewUid){let t=null==e||null==(n=e.engine)?void 0:n.getModel(i.viewUid,!0);t||(t=await e.engine.loadModel({uid:i.viewUid}));let l=(null==t||null==(a=t.getStepParams)?void 0:a.call(t,"popupSettings","openView"))||{};s=(null==l?void 0:l.associationName)||s,u=(null==l?void 0:l.dataSourceKey)||u}}if(null!=o&&""!==o&&s&&"string"==typeof s){let t=String(s).includes(".")?String(s).split(".")[0]:void 0;if(t){let n=()=>{try{var l,n,r,i;let o=null==(n=e.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);return(null==o||null==(i=o.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,t))||null}catch(e){return null}},r=await (0,d.$S)(n,l("Current popup parent record"),()=>({collection:t,dataSourceKey:u,filterByTk:o}));r&&(p.sourceRecord=r)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return p.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},await o(1)&&(p.parent=s(1)),p}});return c.title=l("Current popup"),c.sort=975,c}async function y(e,t){var l,n,r;let i=h(t),o=m(t,i),a=null==t||null==(n=t.inputArgs)||null==(l=n.parentItem)?void 0:l.value,s=null==t||null==(r=t.inputArgs)?void 0:r.openerUids,d=Array.isArray(s)&&s.length>0;if(!(o>=1||d))return;if(!i.length){let e=(null==t?void 0:t.inputArgs)||{};if(!(e.collectionName||null!=e.filterByTk||null!=e.sourceId||e.associationName||e.viewUid))return;return{uid:e.viewUid,resource:{dataSourceKey:e.dataSourceKey||"main",collectionName:e.collectionName,associationName:e.associationName,filterByTk:e.filterByTk,sourceId:e.sourceId},...void 0!==a?{sourceRecord:a}:{}}}let u=async t=>{var l,n,r,o,a,s;if(t<0||!(null==(l=i[t])?void 0:l.viewUid))return;let d=i[t].viewUid,c=null==(n=e.engine)?void 0:n.getModel(d,!0);c||(c=await (null==(s=e.engine)?void 0:s.loadModel({uid:d})));let p=(null==c||null==(r=c.getStepParams)?void 0:r.call(c,"popupSettings","openView"))||{},h=null==p?void 0:p.collectionName,m={uid:d,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:h,associationName:null==p?void 0:p.associationName,filterByTk:null==(o=i[t])?void 0:o.filterByTk,sourceId:null==(a=i[t])?void 0:a.sourceId}},f=await u(t-1);return f&&(m.parent=f),m},c=await u(o);return c&&void 0!==a&&(c.sourceRecord=a),c}function b(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/,n=e=>{var l,n;if("sourceRecord"!==e&&!e.startsWith("sourceRecord."))return!1;let r=null==t||null==(l=t.inputArgs)?void 0:l.parentItem;if(void 0===(null==r?void 0:r.value))return!0;let i="sourceRecord"===e?"":e.slice(13);if(!i)return!1;let o=null==t||null==(n=t.inputArgs)?void 0:n.parentItemResolver;if("function"==typeof o)return o(`value.${i}`);let a=i.split(".").filter(Boolean),s=r.value;for(let e of a){if(null===s||"object"!=typeof s||!(e in s))return!0;s=s[e]}return!1};e.defineProperty("popup",{get:async()=>y(e,t),meta:v(e,t),resolveOnServer:e=>{try{if("sourceRecord"===e||e.startsWith("sourceRecord."))return n(e);return!!e&&l.test(e)}catch(e){return!1}}})}var x=l(18182);let w=(0,r.forwardRef)((e,t)=>{let{afterClose:l,footer:i,header:o,hidden:a,...s}=e,[d,u]=(0,r.useState)(!0),[c,p]=(0,r.useState)(s),[h,m]=(0,r.useState)(()=>i),[f,g]=(0,r.useState)(o);(0,r.useImperativeHandle)(t,()=>({destroy:()=>{u(!1),null==l||l()},update:e=>p(t=>({...t,...e})),setFooter:e=>{m(e)},setHeader:e=>{0===Object.values(e||{}).length?g(null):g(e)}}));let v={...c,title:(null==f?void 0:f.title)||c.title,extra:null==f?void 0:f.extra,footer:void 0!==h?h:c.footer??null},y=r.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return(0,n.jsx)(x.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function S(){let[e,t]=r.useState([]);return[e,r.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var M=l(16639),A=l(20616),F=l(47451);async function k(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function C(e,t){var l;let n=null==t?void 0:t.layoutContext,r=null==t||null==(l=t.engine)?void 0:l.context;n instanceof a.cB&&n!==t&&n!==r&&e.addDelegate(n)}let P=0;function j(){let e=r.useRef(null),t=(t,l)=>{var u,c,p;let h,m,f=null==l?void 0:l.engine;P+=1;let g=r.createRef(),v=new Promise(e=>{m=e}),y=null,x=null,S=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return y=t,null==(e=g.current)||e.setFooter(t),()=>{var e;y=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},j=e=>(r.useEffect(()=>{var t;return x=e,null==(t=g.current)||t.setHeader(e),()=>{var e;x=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),E=new a.cB,R=(0,F._)(l.engine),I=(0,M.eX)(f,R);E.defineProperty("engine",{value:R}),E.addDelegate(R.context),!1!==t.inheritContext?E.addDelegate(l):(E.addDelegate(l.engine.context),C(E,l));let T=!1,_={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(T)return;T=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==h||h(),null==m||m(e);let o=null==I?void 0:I.emitter;(0,M.Z8)(o),null==o||null==(i=o.emit)||i.call(o,M.B9,{type:"dialog",viewUid:null==_||null==(r=_.inputArgs)?void 0:r.viewUid}),R.unlinkFromStack()},update:e=>{var t;return null==(t=g.current)?void 0:t.update(e)},close:async(e,l)=>{var n,r;return(!t.preventClose||!!l)&&!!await k(_,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():_.destroy(e),!0)},Footer:S,Header:j,setFooter:e=>{var t;y=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;x=e,null==(t=g.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,E)}};E.defineProperty("view",{get:()=>_,resolveOnServer:(0,d.Xx)(E,()=>(0,d.vE)(l,E))}),R.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),_.destroy()}),b(E,_);let D=(0,o.observer)(()=>{var e,l,o,a;let s=r.useRef(!1),d="function"==typeof t.content?t.content(_,E):t.content,u="string"==typeof d?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(d)}}):d;return(r.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,_,E)},[]),(null==(l=t.inputArgs)||null==(e=l.hidden)?void 0:e.value)&&!s.current)?null:(s.current=!0,(0,n.jsx)(w,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(o=a.hidden)?void 0:o.value,footer:y,header:x,...t,onCancel:()=>{_.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),N=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${P}`,O=(0,n.jsx)(A.I6,{engine:R,children:(0,n.jsx)(s.YQ,{context:E,children:(0,n.jsx)(D,{})})},N);return h=null==(p=e.current)?void 0:p.patchElement(O),Object.assign(v,_)},l=r.useMemo(()=>({open:t}),[]),u=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(u,{ref:e},"dialog-holder")]}var E=l(97134),R=l(61793);let I=r.forwardRef((e,t)=>{var l;let{children:i,footer:o,title:a,extra:s,hidden:d,isMobile:u,...c}=e,[p,h]=r.useState(!0),[m,f]=r.useState(()=>o),[g,v]=r.useState({title:a,extra:s,...c.header});r.useImperativeHandle(t,()=>({destroy:()=>{h(!1)},update:e=>{Object.assign(c,e)},setFooter:e=>{f(e)},setHeader:e=>{0===Object.values(e||{}).length?v(null):v(e)}}),[]);let y=r.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return u?(0,n.jsx)(R.D,{className:d?"nb-hidden":"",visible:p,...c,footer:m,...g,onClose:c.onClose,children:i}):(0,n.jsx)(E.A,{rootClassName:d?"nb-hidden":"",closable:!1,getContainer:y,...c,open:p,footer:m,styles:{...c.styles,footer:{display:"flex",justifyContent:"flex-end",...null==(l=c.styles)?void 0:l.footer}},...g,onClose:c.onClose,children:i})});function T(){let e=r.useRef(null),t=r.useMemo(()=>o.observable.shallow({value:[]}),[]),l=r.memo(e=>{let{index:i}=e,[a,s]=r.useState(null);return(r.useEffect(()=>{(0,o.autorun)(()=>{let e=t.value;e[i]&&a!==e[i]&&s(e[i]),e[i]||s(null)})},[a,i]),a)?(0,n.jsx)(a,{children:(0,n.jsx)(l,{index:i+1})}):null});l.displayName="RenderNestedDrawer";let u=(t,l)=>{var u,c;let p,h,m=l.engine,f=r.createRef(),g=new Promise(e=>{h=e}),v=null,y=null,x=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return v=t,null==(e=f.current)||e.setFooter(t),()=>{var e;v=null,null==(e=f.current)||e.setFooter(null)}},[t]),null},w=e=>(r.useEffect(()=>{var t;return y=e,null==(t=f.current)||t.setHeader(e),()=>{var e;y=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),S=new a.cB,P=(0,F._)(l.engine),j=(0,M.eX)(m,P);S.defineProperty("engine",{value:P}),S.addDelegate(P.context),!1!==t.inheritContext?S.addDelegate(l):(S.addDelegate(l.engine.context),C(S,l));let E=!1,R={type:"drawer",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(E)return;E=!0,null==(l=t.onClose)||l.call(t),null==(n=f.current)||n.destroy(),null==p||p(),null==h||h(e);let o=null==j?void 0:j.emitter;(0,M.Z8)(o),null==o||null==(i=o.emit)||i.call(o,M.B9,{type:"drawer",viewUid:null==R||null==(r=R.inputArgs)?void 0:r.viewUid}),P.unlinkFromStack()},update:e=>{var t;return null==(t=f.current)?void 0:t.update(e)},close:async(e,l)=>{var n,r;return(!t.preventClose||!!l)&&!!await k(R,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():R.destroy(e),!0)},Footer:x,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;y=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,S)}};S.defineProperty("view",{get:()=>R,resolveOnServer:(0,d.Xx)(S,()=>(0,d.vE)(l,S))}),P.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),R.destroy()}),b(S,R);let T=r.memo((0,o.observer)(e=>{var l,o,a,s;let d=r.useRef(!1),u="function"==typeof t.content?t.content(R,S):t.content,c="string"==typeof u?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(u)}}):u;return(r.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,R,S)},[]),(null==(o=t.inputArgs)||null==(l=o.hidden)?void 0:l.value)&&!d.current)?(0,n.jsx)(n.Fragment,{children:e.children}):(d.current=!0,(0,n.jsxs)(I,{ref:f,...t,footer:v,header:t.header||y,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{R.close(t.result)},isMobile:S.isMobileLayout,children:[c,e.children]}))}));T.displayName="DrawerWithContext";let _=r.memo(e=>{let{children:t}=e;return(0,n.jsx)(A.I6,{engine:P,children:(0,n.jsx)(s.YQ,{context:S,children:(0,n.jsx)(T,{children:t})})})});return _.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(_),Object.assign(g,R)},c=r.useMemo(()=>({open:u}),[]),p=r.memo(r.forwardRef((e,i)=>{let[o,a]=S();return r.useImperativeHandle(i,()=>({patchElement:a}),[a]),r.useEffect(()=>{t.value=o},[o]),(0,n.jsx)(l,{index:0})}));return[c,(0,n.jsx)(p,{ref:e},"drawer-holder")]}var _=l(40961),D=l(31333),N=l(71021);let O=(0,r.forwardRef)((e,t)=>{let[l,i]=r.useState({}),{visible:o=!0,footer:a=null,header:s=null,children:d,hidden:u,title:c,styles:p={},zIndex:h=4,onClose:m}={...e,...l},f=(0,r.useRef)(!1),g=(0,A.uf)(),[v,y]=(0,r.useState)(()=>a),[b,x]=(0,r.useState)(s);(0,r.useImperativeHandle)(t,()=>({destroy:()=>{f.current||(f.current=!0)},update:e=>{i(e)},setFooter:e=>{y(e)},setHeader:e=>{0===Object.values(e||{}).length?x(null):x(e)}}));let w=(0,r.useMemo)(()=>({display:u?"none":"flex",flexDirection:"column",height:"100%",zIndex:h}),[u,h]),S=(0,r.useMemo)(()=>{if(!b&&!c)return null;let{title:e=c,extra:t}=b||{},l=g.context.themeToken;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:`${l.paddingSM}px ${l.padding}px`,borderBottom:`1px solid ${l.colorSplit}`,backgroundColor:l.colorBgContainer,...p.header},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:l.marginXS},children:[(0,n.jsx)(N.Ay,{type:"text",size:"small",icon:(0,n.jsx)(D.A,{}),onClick:async()=>{f.current||!1!==await (null==m?void 0:m())&&(f.current=!0)},style:{color:l.colorTextTertiary}}),e&&(0,n.jsx)("div",{style:{fontSize:l.fontSizeLG,fontWeight:l.fontWeightStrong,color:l.colorText},children:e})]}),t&&(0,n.jsx)("div",{children:t})]})},[b,c,g.context.themeToken,p.header,m]),M=(0,r.useMemo)(()=>{if(!v)return null;let e=g.context.themeToken;return(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:`${e.paddingXS}px ${e.padding}px`,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgContainer,...p.footer},children:v})},[v,g.context.themeToken,p.footer]);return o?(0,n.jsxs)("div",{style:{...w,...p.content},children:[S,(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",...p.body},children:d}),M]}):null}),$=0,B="nocobase-embed-container",L="nocobaseEmbedReplacing";function q(e){return!!e&&"function"==typeof e.then}function V(e,t){e.dataset[L]="1";try{let l=t.close();if(q(l))return Promise.resolve(l).finally(()=>{delete e.dataset[L]});return delete e.dataset[L],l}catch(t){throw delete e.dataset[L],t}}function z(e,t,l){let n,r={},i=e.then(e=>{let{page:t}=e;return(n=t)&&("beforeClose"in r&&(n.beforeClose=r.beforeClose),"update"in r&&n.update(r.update),"footer"in r&&n.setFooter(r.footer),"header"in r&&n.setHeader(r.header),r.destroyed&&n.destroy(r.destroyed.result)),{page:t}});return Object.assign(i.then(e=>{let{page:t}=e;return!!t&&t}),{type:"embed",inputArgs:t,preventClose:l,Header:null,Footer:null,get beforeClose(){return(null==n?void 0:n.beforeClose)??r.beforeClose},set beforeClose(value){n?n.beforeClose=value:r.beforeClose=value},close:(e,t)=>i.then(l=>{let{page:n}=l;return!!n&&n.close(e,t)}),destroy:e=>{n?n.destroy(e):r.destroyed={result:e}},update:e=>{n?n.update(e):r.update={...r.update,...e}},setFooter:e=>{n?n.setFooter(e):r.footer=e},setHeader:e=>{n?n.setHeader(e):r.header=e}})}let K=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));function U(){let e=r.useRef(null),t=r.useRef(null),l=r.useRef(0),i=(i,u)=>{let{target:c,content:p,preventClose:h,inheritContext:m=!0,inputArgs:f={},onOpenCancelled:g,...v}=i,y=c instanceof HTMLElement&&c.id===B,x=()=>{var l,g,x;let w,S,P,j=null==u?void 0:u.engine;$+=1;let E=r.createRef(),R=new Promise(e=>{S=e}),I=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return null==(e=E.current)||e.setFooter(t),()=>{var e;null==(e=E.current)||e.setFooter(null)}},[t]),null},T=e=>(r.useEffect(()=>{var t;return null==(t=E.current)||t.setHeader(e),()=>{var e;null==(e=E.current)||e.setHeader(null)}},[e]),null),D=new a.cB,N=(0,F._)(u.engine),B=(0,M.eX)(j,N);D.defineProperty("engine",{value:N}),D.addDelegate(N.context),m?D.addDelegate(u):(D.addDelegate(u.engine.context),C(D,u));let q=!1,V={type:"embed",inputArgs:f,preventClose:!!i.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,o,a;if(!q){if(q=!0,null==(l=i.onClose)||l.call(i),null==S||S(e),null==(n=E.current)||n.destroy(),null==w||w(),y&&t.current===V&&(t.current=null),!(y&&c instanceof HTMLElement&&(null==(r=c.dataset)?void 0:r[L])==="1")){let e=null==B?void 0:B.emitter;(0,M.Z8)(e),null==e||null==(a=e.emit)||a.call(e,M.B9,{type:"embed",viewUid:null==V||null==(o=V.inputArgs)?void 0:o.viewUid})}N.unlinkFromStack()}},update:e=>{var t;return null==(t=E.current)?void 0:t.update(e)},close:(e,t)=>q?Promise.resolve(!0):P||(P=(async()=>{try{var l,n;if(h&&!t)return P=void 0,!1;let r=await k(V,{result:e,force:t});if(q)return!0;if(!r)return P=void 0,!1;if(i.triggerByRouter&&(null==(n=i.inputArgs)||null==(l=n.navigation)?void 0:l.back))return i.inputArgs.navigation.back(),!0;return V.destroy(e),!0}catch(e){throw q||(P=void 0),e}})()),Header:T,Footer:I,setFooter:e=>{var t;null==(t=E.current)||t.setFooter(e)},setHeader:e=>{var t;null==(t=E.current)||t.setHeader(e)},navigation:null==(l=i.inputArgs)?void 0:l.navigation,get record(){return(0,d.vE)(u,D)}};D.defineProperty("view",{get:()=>V,resolveOnServer:(0,d.Xx)(D,()=>(0,d.vE)(u,D))}),b(D,V);let z=(0,o.observer)(()=>{var e,t,l,o;let a=r.useRef(!1),s=r.useMemo(()=>"function"==typeof p?p(V,D):p,[]);return(D.themeToken,r.useEffect(()=>{var e;null==(e=i.onOpen)||e.call(i,V,D)},[]),(null==(t=i.inputArgs)||null==(e=t.hidden)?void 0:e.value)&&!a.current)?null:(a.current=!0,(0,n.jsx)(O,{ref:E,hidden:null==(o=i.inputArgs)||null==(l=o.hidden)?void 0:l.value,...v,onClose:()=>V.close(i.result),children:s}))},{displayName:"PageWithContext"}),K=(null==f?void 0:f.viewUid)||`page-${$}`,U=(0,n.jsx)(A.I6,{engine:N,children:(0,n.jsx)(s.YQ,{context:D,children:(0,n.jsx)(z,{})})},K);return w=c&&c instanceof HTMLElement?null==(g=e.current)?void 0:g.patchElement(_.createPortal(U,c,K)):null==(x=e.current)?void 0:x.patchElement(U),y&&(t.current=V),Object.assign(R,V)};if(y&&t.current){let e,n=l.current+=1,r=()=>null==g?void 0:g();try{e=V(c,t.current)}catch(e){throw r(),e}if(q(e))return z(Promise.resolve(e).then(e=>!1===e||n!==l.current?(r(),{page:null}):{page:x()},e=>{throw r(),e}),f,!!i.preventClose);if(!1===e)return r(),z(Promise.resolve({page:null}),f,!!i.preventClose)}return x()};return[r.useMemo(()=>({open:i}),[]),(0,n.jsx)(K,{ref:e},"page-holder")]}var W=l(28073);let H=0,Y=r.forwardRef((e,t)=>{var l,i;let{afterClose:o,content:a,placement:s,rect:d,...u}=e,[c,p]=r.useState(!0),[h,m]=r.useState({content:a,placement:s,rect:d,...u});return r.useImperativeHandle(t,()=>({destroy:()=>p(!1),update:e=>m(t=>({...t,...e})),close:(e,t)=>p(!1)})),r.useEffect(()=>{c||null==o||o()},[c,o]),(0,n.jsx)(W.A,{arrow:!1,open:c,trigger:["click"],destroyTooltipOnHide:!0,content:h.content,placement:h.placement,getPopupContainer:()=>document.querySelector("#nocobase-app-container")||document.body,onOpenChange:e=>{(e||!h.preventClose)&&(p(e),e||null==o||o())},...h,children:(0,n.jsx)("span",{style:{position:"absolute",top:((null==(l=h.rect)?void 0:l.top)??0)+window.scrollY,left:((null==(i=h.rect)?void 0:i.left)??0)+window.scrollX,width:0,height:0}})})});function G(){let e=r.useRef(null),t=t=>{var l,o;let a,s;H+=1;let{target:d,placement:u="rightTop",content:c,...p}=t,h=r.createRef(),m=(null==d||null==(l=d.getBoundingClientRect)?void 0:l.call(d))??{top:0,left:0},f=new Promise(e=>{s=e}),g={type:"popover",destroy:()=>{var e;return null==(e=h.current)?void 0:e.destroy()},update:e=>{var t;return null==(t=h.current)?void 0:t.update(e)},close:e=>{var t;null==s||s(e),null==(t=h.current)||t.close(e)}},v="function"==typeof c?c(g):c,y="string"==typeof v?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(v)}}):v,b=(0,n.jsx)(Y,{ref:h,content:y,placement:u,rect:m,afterClose:()=>{var e;null==a||a(),null==(e=t.onClose)||e.call(t),null==s||s(t.result)},...p},`popover-${H}`);return a=null==(o=e.current)?void 0:o.patchElement(b),Object.assign(f,g)},l=r.useMemo(()=>({open:t}),[]),o=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(o,{ref:e},"popover-holder")]}var J=l(50467),X=l(52847),Q=l(60182);function Z(e){return null==e?"":e&&"object"==typeof e&&!Array.isArray(e)?encodeURIComponent(Object.entries(e).map(e=>{let[t,l]=e;return`${encodeURIComponent(String(t))}=${encodeURIComponent(String(l))}`}).join("&")):encodeURIComponent(String(e))}function ee(e){return null!=e&&""!==String(e)}function et(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function el(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=et(t.basePath||t.prefix);if(!e||0===e.length)return l;let n=l.replace(/^\/+/,"").split("/").filter(Boolean);return e.forEach((e,t)=>{t>0&&n.push("view"),n.push(e.viewUid);let l=(0,Q.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Z(e.filterByTk);t&&n.push("filterbytk",t)}ee(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class en{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=el(this.viewStack.map((t,l)=>l===this.viewStack.length-1?{...t,...e}:{...t}),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(t,{replace:!0})}navigateTo(e,t){let l=el([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=el(this.viewStack.slice(0,-1),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(e,{replace:!0})}getLayoutBasePath(){var e,t;let l=null==(e=this.ctx.layout)?void 0:e.routePath;return this.basePath||(null==(t=this.ctx.layoutRoute)?void 0:t.basePathname)||((null==l?void 0:l.startsWith("/"))?l:"/admin")}constructor(e,t,l={}){(0,J._)(this,"viewStack",void 0),(0,J._)(this,"ctx",void 0),(0,J._)(this,"viewParams",void 0),(0,J._)(this,"basePath",void 0),this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,X.E8)(this,{viewParams:X.sH})}}},16639(e,t,l){l.d(t,{B9:()=>r,FH:()=>s,HK:()=>i,Z8:()=>d,eX:()=>p,i6:()=>o,tb:()=>n});let n=Symbol.for("__NOCOBASE_VIEW_ACTIVATED_VERSION__"),r="view:activated",i="dataSource:dirty",o="__NOCOBASE_ENGINE_SCOPE__",a="view";function s(e){let t=Reflect.get(e,n),l="number"==typeof t?t:Number(t);return Number.isFinite(l)&&l>0?l:0}function d(e){let t=s(e);if(!Object.isExtensible(e))return t;let l=t+1;return Reflect.set(e,n,l),l}function u(e){return Reflect.get(e,o)===a}function c(e){let t=e,l=0;for(;t&&l++<50;){if(u(t))return t;t=t.previousEngine}}function p(e,t){if(!e)return;let l=c(e);return l||c(null==t?void 0:t.previousEngine)||e}},33329(e,t,l){l.d(t,{xW:()=>f,bO:()=>s,Q9:()=>m});var n=l(50467),r=l(88909),i=l(55373),o=l.n(i);let a=(e,t)=>{if(!e)return;let l="function"==typeof e.toJSON?e.toJSON():e,n=Object.keys(l||{}).find(e=>e.toLowerCase()===t.toLowerCase());return n?l[n]:void 0},s=(e,t)=>{let l=a(e,t);return null!=l&&""!==l};class d{get storagePrefix(){return this.api.storagePrefix}get locale(){return this.getLocale()}set locale(e){this.setLocale(e)}get role(){return this.getRole()}set role(e){this.setRole(e)}get token(){return this.getToken()}set token(e){this.setToken(e)}get authenticator(){return this.getAuthenticator()}set authenticator(e){this.setAuthenticator(e)}getOption(e){return this.api.storage.getItem(e)}setOption(e,t){return this.options[e]=t,this.api.storage.setItem(e,t||"")}getLocale(){return this.getOption("locale")}setLocale(e){this.setOption("locale",e)}getRole(){return this.getOption("role")}setRole(e){this.setOption("role",e)}getToken(){return this.getOption("token")}setToken(e){this.setOption("token",e),this.api.app&&this.api.app.eventBus.dispatchEvent(new CustomEvent("auth:tokenChanged",{detail:{token:e,authenticator:this.authenticator}}))}getAuthenticator(){return this.getOption("auth")}setAuthenticator(e){this.setOption("auth",e)}middleware(e){return this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!s(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!s(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`),e}async signIn(e,t){var l;let n=await this.api.request({method:"post",url:"auth:signIn",data:e,headers:{"X-Authenticator":t}}),r=null==n||null==(l=n.data)?void 0:l.data;return this.setAuthenticator(t),this.setToken(null==r?void 0:r.token),n}async signUp(e,t){return await this.api.request({method:"post",url:"auth:signUp",data:e,headers:{"X-Authenticator":t}})}async signOut(){let e=await this.api.request({method:"post",url:"auth:signOut"});return this.setToken(null),this.setRole(null),this.setAuthenticator(null),e}async lostPassword(e){let t=Object.fromEntries(new URLSearchParams(window.location.search).entries());return await this.api.request({method:"post",url:"auth:lostPassword",data:{...e,baseURL:window.location.href.split("/forgot-password")[0]},headers:{"X-Authenticator":t.name}})}async resetPassword(e){return await this.api.request({method:"post",url:"auth:resetPassword",data:e})}async checkResetToken(e){return await this.api.request({method:"post",url:"auth:checkResetToken",data:e})}constructor(e){(0,n._)(this,"api",void 0),(0,n._)(this,"options",{locale:null,role:null,authenticator:null,token:null}),this.api=e,this.api.axios.interceptors.request.use(this.middleware.bind(this))}}class u{toUpperCase(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];return e.toUpperCase()+l.map(e=>e.toUpperCase()).join("_")}constructor(){(0,n._)(this,"storagePrefix",void 0)}}class c extends u{clear(){this.items.clear()}getItem(e){return this.items.get(e)}setItem(e,t){return this.items.set(e,t)}removeItem(e){return this.items.delete(e)}constructor(...e){super(...e),(0,n._)(this,"items",new Map)}}class p extends u{clear(){return this.items.clear()}getItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.getItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.getItem(this.toUpperCase(this.storagePrefix,e))}setItem(e,t){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.setItem(this.toUpperCase(this.baseStoragePrefix,e),t):this.items.setItem(this.toUpperCase(this.storagePrefix,e),t)}removeItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.removeItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.removeItem(this.toUpperCase(this.storagePrefix,e))}constructor(e,t="",l=!1){super(),(0,n._)(this,"storagePrefix",void 0),(0,n._)(this,"baseStoragePrefix",void 0),(0,n._)(this,"shareToken",void 0),(0,n._)(this,"items",void 0),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.localStorage}}class h extends p{constructor(e,t="",l=!1){super(e,t,l),(0,n._)(this,"storagePrefix",void 0),(0,n._)(this,"baseStoragePrefix",void 0),(0,n._)(this,"shareToken",void 0),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.sessionStorage}}class m{toErrMessages(e){var t,l,n,r,i,o,a,s,d,u,c;if("u">typeof document&&"string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(i=e.response)||null==(r=i.data)?void 0:r.errors)||(null==e||null==(a=e.response)||null==(o=a.data)?void 0:o.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}getHeaders(){let e={};return this.auth.locale&&(e["X-Locale"]=this.auth.locale),this.auth.role&&(e["X-Role"]=this.auth.role),this.auth.authenticator&&(e["X-Authenticator"]=this.auth.authenticator),this.auth.token&&(e.Authorization=`Bearer ${this.auth.token}`),e}createStorage(e){return"localStorage"===e&&"u">typeof localStorage?new p(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new h(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new c}initStorage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"localStorage";if(e){this.storage=new e(this);return}this.storage=this.createStorage(t)}interceptors(){this.axios.interceptors.request.use(e=>(e.paramsSerializer=e=>o().stringify(e,{strictNullHandling:!0,arrayFormat:"brackets"}),e))}request(e){let{resource:t,resourceOf:l,action:n,params:r,headers:i}=e;return t?this.resource(t,l,i)[n](r):this.axios.request(e)}resource(e,t,l,n){return new Proxy({},{get:(r,i)=>{if(n)return;let o=e.split(".").join(`/${encodeURIComponent(t)||"_"}/`),a={url:o+=`:${i.toString()}`};return["get","list"].includes(i)?a.method="get":a.method="post",async(e,t)=>{let{values:n,filter:r,...i}=e||{};return a.params=i,r&&("string"==typeof r?a.params.filter=r:(r["*"]&&delete r["*"],a.params.filter=JSON.stringify(r))),"get"!==a.method&&(a.data=n||{}),await this.request({...a,...t,headers:l})}}})}constructor(e){if((0,n._)(this,"options",void 0),(0,n._)(this,"axios",void 0),(0,n._)(this,"auth",void 0),(0,n._)(this,"storage",void 0),(0,n._)(this,"storagePrefix","NOCOBASE_"),(0,n._)(this,"baseStoragePrefix","NOCOBASE_"),(0,n._)(this,"shareToken",!1),this.options=e,"function"==typeof e)this.axios=e;else{let{appName:t,authClass:l,storageType:n,storageClass:i,storagePrefix:o="NOCOBASE_",shareToken:a=!1,...s}=e||{};this.shareToken=a,this.baseStoragePrefix=o,this.storagePrefix=t?`${o}${t.toUpperCase()}_`:o,this.axios=r.A.create(s),this.initStorage(i,n),l&&(this.auth=new l(this))}this.storage||this.initStorage(),this.auth||(this.auth=new d(this)),this.interceptors()}}let f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";if("u"<typeof window||!window.location.pathname)return;let t=`${e}apps/`;if(window.location.pathname.startsWith(t))return window.location.pathname.substring(t.length).split("/",1)[0]||""}},40542(e,t,l){l.d(t,{D:()=>n});let n=(e,t,l)=>{if(!e)return l;let r=t.split("."),i=[],o=e,a=!1;for(let e=0;e<r.length;e++){let t=r[e];if(Array.isArray(o)){for(let t of(a=!0,o)){let o=n(t,r.slice(e).join("."),l);i=i.concat(o)}break}if((null==o?void 0:o[t])===void 0)break;o=o[t],e===r.length-1&&i.push(o)}return 0===(i=i.filter(e=>void 0!==e)).length?l:a?i.filter(e=>null!==e):i[0]}},13939(e,t,l){l.r(t),l.d(t,{getDayRange:()=>th,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>ty,str2moment:()=>eg,unflatten:()=>to,sortTree:()=>ea,generateFlowModelRdFromToken:()=>eO,forEach:()=>ek,utc2unit:()=>tf,extractUsedVariablePaths:()=>t3,getValuesByPath:()=>e$,isArray:()=>et,moment2str:()=>eb,transformLiquidContext:()=>t9,isURL:()=>tD,isPortalInBody:()=>tE,extractUsedVariableNames:()=>t8,parseHTML:()=>tR,toGmt:()=>ep,isPlainObject:()=>en,lockdownSes:()=>tC,splitPathToTwoParts:()=>tb,transformFilter:()=>G,parseSQLBindParams:()=>lt,getPickerFormat:()=>eM,nextTick:()=>ei,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eK,evaluateConditions:()=>Z,toUnit:()=>tg,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>eF,BASE_BLOCKED_IDENTIFIERS:()=>tA,toLocal:()=>eh,getDayRangeByParams:()=>L,getDefaultFormat:()=>ec,transformMultiColumnToSingleColumn:()=>t$,treeFind:()=>eo,transformSQL:()=>ll,parseFilter:()=>tp,flatten:()=>ti,isEmpty:()=>el,getOffsetRangeByParams:()=>N,offsetFromString:()=>ex,tval:()=>tP,error:()=>eQ,extractVariableUsage:()=>t4,Registry:()=>tw,lodash:()=>r(),parse:()=>eY,hasEmptyValue:()=>er,toFixedByStep:()=>e6,getDateTimeFormat:()=>eA,showToast:()=>e4,Handlebars:()=>eq(),getLiquidContext:()=>t7,merge:()=>e2,dayjs:()=>o(),parseLiquidContext:()=>le,uid:()=>t_,isString:()=>ee});var n=l(2543),r=l.n(n),i=l(74353),o=l.n(i),a=l(97375),s=l.n(a),d=l(90445),u=l.n(d),c=l(43522),p=l.n(c),h=l(37872),m=l.n(h),f=l(98867),g=l.n(f),v=l(8906),y=l.n(v),b=l(68313),x=l.n(b),w=l(21840),S=l.n(w),M=l(41816),A=l.n(M),F=l(88569),k=l.n(F),C=l(83826),P=l.n(C),j=l(8134),E=l.n(j),R=l(28623),I=l.n(R),T=l(46986),_=l.n(T);o().extend(_()),o().extend(S()),o().extend(k()),o().extend(P()),o().extend(A()),o().extend(x()),o().extend(m()),o().extend(g()),o().extend(y()),o().extend(E()),o().extend(I()),o().extend(u()),o().extend(s()),o().extend(p());let D=e=>{if(!e)return o()();if(/^[+-]\d{2}:\d{2}$/.test(e)){let[t,l,n]=e.match(/([+-])(\d{2}):(\d{2})/).slice(1),r=(60*parseInt(l)+parseInt(n))*("+"===t?1:-1);return o()().utcOffset(r)}return o()().tz(e)},N=e=>{let t,l,{type:n,unit:r="day",number:i=1,timezone:o}=e,a=D(o),s="week"===r?"isoWeek":r;if("past"===n){let e=a.startOf(s);t=e.subtract(i,r).startOf(s),l=e.subtract(1,r).endOf(s)}else if("next"===n)l=(t=a.startOf(s).add(1,r).startOf(s)).add(i-1,r).endOf(s);else throw Error(`Unsupported type: ${n}`);return[t.format("YYYY-MM-DD HH:mm:ss"),l.format("YYYY-MM-DD HH:mm:ss")]},O=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).startOf(t)},$=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).endOf(t)},B={today:e=>[O(0,"day",null==e?void 0:e.timezone),$(0,"day",null==e?void 0:e.timezone)],yesterday:e=>[O(-1,"day",null==e?void 0:e.timezone),$(-1,"day",null==e?void 0:e.timezone)],tomorrow:e=>[O(1,"day",null==e?void 0:e.timezone),$(1,"day",null==e?void 0:e.timezone)],thisWeek:e=>[O(0,"isoWeek",null==e?void 0:e.timezone),$(0,"isoWeek",null==e?void 0:e.timezone)],lastWeek:e=>[O(-1,"isoWeek",null==e?void 0:e.timezone),$(-1,"isoWeek",null==e?void 0:e.timezone)],nextWeek:e=>[O(1,"isoWeek",null==e?void 0:e.timezone),$(1,"isoWeek",null==e?void 0:e.timezone)],thisMonth:e=>[O(0,"month",null==e?void 0:e.timezone),$(0,"month",null==e?void 0:e.timezone)],lastMonth:e=>[O(-1,"month",null==e?void 0:e.timezone),$(-1,"month",null==e?void 0:e.timezone)],nextMonth:e=>[O(1,"month",null==e?void 0:e.timezone),$(1,"month",null==e?void 0:e.timezone)],thisQuarter:e=>[O(0,"quarter",null==e?void 0:e.timezone),$(0,"quarter",null==e?void 0:e.timezone)],lastQuarter:e=>[O(-1,"quarter",null==e?void 0:e.timezone),$(-1,"quarter",null==e?void 0:e.timezone)],nextQuarter:e=>[O(1,"quarter",null==e?void 0:e.timezone),$(1,"quarter",null==e?void 0:e.timezone)],thisYear:e=>[O(0,"year",null==e?void 0:e.timezone),$(0,"year",null==e?void 0:e.timezone)],lastYear:e=>[O(-1,"year",null==e?void 0:e.timezone),$(-1,"year",null==e?void 0:e.timezone)],nextYear:e=>[O(1,"year",null==e?void 0:e.timezone),$(1,"year",null==e?void 0:e.timezone)]},L=e=>{if("past"===e.type||"next"===e.type)return N(e);let t=B[e.type];if(!t)throw Error(`Unsupported type: ${e.type}`);let[l,n]=t(e);return[l.format("YYYY-MM-DD HH:mm:ss"),n.format("YYYY-MM-DD HH:mm:ss")]};var q=l(38362);class V{static graphlib(){return q}static connectedNodes(e){let t=(0,n.castArray)(e.nodes),l=(0,n.castArray)(e.excludes||[]),r=V.build(e),i=new Set;for(let e of t)for(let t of q.alg.preorder(r,e))l.includes(t)||i.add(t);return Array.from(i)}static preOrder(e){return V.graphlib().alg.preorder(V.build(e),e.node)}static build(e){let t=e.collections,l="forward"===((null==e?void 0:e.direction)||"forward"),n=new q.Graph;for(let e of t)n.setNode(e.name);for(let e of t){for(let t of e.inherits||[])l?n.setEdge(e.name,t):n.setEdge(t,e.name);for(let t of e.fields||[])if(("hasMany"===t.type||"belongsTo"===t.type||"hasOne"===t.type)&&(l?n.setEdge(e.name,t.target):n.setEdge(t.target,e.name)),"belongsToMany"===t.type){let r=t.through;l?(n.setEdge(e.name,r),n.setEdge(r,t.target)):(n.setEdge(t.target,r),n.setEdge(r,e.name))}}return n}}var z=l(81814),K=l.n(z);function U(e){return"path"in e&&"operator"in e}function W(e){return"logic"in e&&"items"in e}function H(e){let{path:t,operator:l,value:n}=e;return{[t]:{[l]:n}}}function Y(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return Y(e);throw Error("Invalid filter item type")})}}function G(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return eu(Y(e))}function J(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return e.items=e.items.filter(e=>U(e)?!!e.operator:!!W(e)&&J(e)),{...e}}function X(e,t){let{path:l,operator:n,value:r}=e;return t(l,n,r)}function Q(e,t){let{logic:l,items:n}=e;if(!n||0===n.length)return!0;let r=n.map(e=>{if(U(e))return X(e,t);if(W(e))return Q(e,t);throw Error("Invalid filter item type")});if("$and"===l)return r.every(e=>!0===e);if("$or"===l)return r.some(e=>!0===e);throw Error(`Unsupported logic operator: ${l}`)}function Z(e,t){if(!e||"object"!=typeof e)throw Error("Invalid conditions: conditions must be an object");if(!W(e))throw Error("Invalid conditions: conditions must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid conditions: items must be an array");if("function"!=typeof t)throw Error("Invalid evaluator: evaluator must be a function");return Q(e,t)}let ee=e=>"string"==typeof e,et=e=>Array.isArray(e),el=e=>en(e)?0===Object.keys(e).length:!!Array.isArray(e)&&0===e.length,en=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},er=e=>{let t=!0;for(let l in e){if(t=!1,et(e[l])&&0===e[l].length||!e[l])return!0;if(en(e[l])||et(e[l]))return er(e[l])}return t},ei=e=>{setTimeout(e)};function eo(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return;let{childrenKey:n="children"}=l;for(let r of Array.isArray(e)?[...e]:[e]){if(t(r))return r;let e="function"==typeof n?n(r):r[n];if(Array.isArray(e)&&e.length>0){let n=eo(e,t,l);if(void 0!==n)return n}}}function ea(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"children",n=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return e&&Array.isArray(e)&&0!==e.length?r().orderBy(e,t,n?"asc":"desc").map(e=>e[l]&&e[l].length>0?{...e,[l]:ea(e[l],t,l,n)}:e):e}function es(e){return new Promise(t=>{setTimeout(t,e)})}function ed(e){return!!(!e||"$and"in e&&r().isEmpty(e.$and)||"$or"in e&&r().isEmpty(e.$or))}let eu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K(),l=t(e||{}),n={};for(let e in l){let t=l[e];null==t||el(t)||""===t||(n[e]=t)}let i=t.unflatten(n);for(let e in i)Array.isArray(i[e])&&(i[e]=i[e].filter(e=>null!=e));return r().isEmpty(i)?void 0:i},ec=e=>e.format?e.format:e.dateFormat?e.showTime?`${e.dateFormat} ${e.timeFormat||"HH:mm:ss"}`:e.dateFormat:"month"===e.picker?"YYYY-MM":"quarter"===e.picker?"YYYY-\\QQ":"year"===e.picker?"YYYY":"week"===e.picker?"YYYY[W]W":e.showTime?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD",ep=e=>e&&o().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,eh=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):o().isDayjs(e)?e.startOf("second").toISOString():void 0:e,em=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return o()().quarter(l).year(t)}catch(e){return null}},ef=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:r,utc:i=!0,dateOnly:a}=t;if(!o()(e).isValid())return em(e);if(a){let t=o()(e);if(!t.isValid())return e;let l=t.format("YYYY-MM-DD");return o().utc(l,"YYYY-MM-DD")}return i?o().isDayjs(e)?l?e.utcOffset(ex(l)):e:n?o()(e).utcOffset(0):l?o()(e).utcOffset(ex(l)):o()(e):o()(e)},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ef(e,t)):e?ef(e,t):e},ev=(e,t)=>"year"===t?e.format("YYYY")+"-01-01T00:00:00.000Z":"month"===t||"quarter"===t?e.format("YYYY-MM")+"-01T00:00:00.000Z":e.format("YYYY-MM-DD")+"T00:00:00.000Z",ey=(e,t)=>e?Array.isArray(e)?e.map(e=>ev(e,t)):o().isDayjs(e)?ev(e,t):void 0:e,eb=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:r}=t;return e?l?n?ep(e):eh(e):ey(e,r):e};function ex(e){if(!r().isString(e))return e;let t=/([+-]|\d\d)/gi,l=/Z|[+-]\d\d(?::?\d\d)?/gi,n=/[+-]?\d+(\.\d{1,3})?/,i=(e||"").match(l);if(null===i&&(i=(e||"").match(n)),null===i)return null;let o=((i[i.length-1]||[])+"").match(t)||["-",0,0],a=+(60*Number(o[1]))+ew(o[2]);return 0===a?0:"+"===o[0]?a:-a}function ew(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eS(t)),l}function eS(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eM=e=>{switch(e){case"week":return"YYYY[W]W";case"month":return"YYYY-MM";case"quarter":return"YYYY[Q]Q";case"year":return"YYYY";default:return"YYYY-MM-DD"}},eA=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function eF(e){return/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?"YYYY-MM-DD HH:mm:ss":/^\d{4}-\d{2}-\d{2}$/.test(e)?"YYYY-MM-DD":/^\d{4}-\d{2}$/.test(e)?"YYYY-MM":/^\d{4}$/.test(e)?"YYYY":/^\d{4}Q[1-4]$/.test(e)?"YYYY[Q]Q":/^\d{4}-\d{2}-\d{2}T/.test(e)?"YYYY-MM-DDTHH:mm:ss.SSSZ":null}let ek=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})};var eC=l(48287).Buffer;let eP=new Map;function ej(e){return"function"==typeof btoa?btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):eC.from(e,"binary").toString("base64url")}function eE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),l=t.padEnd(t.length+(4-t.length%4)%4,"=");return"function"==typeof atob?atob(l):eC.from(l,"base64").toString("binary")}function eR(e){let t=0x811c9dc5;for(let l=0;l<e.length;l+=1)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}function eI(e,t){if(!t)return"";let l="";for(let n=0;n<e.length;n+=1)l+=String.fromCharCode(e.charCodeAt(n)^t.charCodeAt(n%t.length));return l}function eT(e){if(!e||"string"!=typeof e)return null;let t=e.split(".");if(t.length<2)return null;try{return JSON.parse(eE(t[1]))}catch{return null}}function e_(e){let t=null==e?void 0:e.userId,l=(null==e?void 0:e.signInTime)||(null==e?void 0:e.jti);return"string"!=typeof t&&"number"!=typeof t||"string"!=typeof l&&"number"!=typeof l?"":`${t}:${l}`}function eD(e){return e_(eT(e))}function eN(e,t){if("string"!=typeof e&&"number"!=typeof e||!t)return;let l=String(e),n=`${t}
|
|
1706
|
-
${l}`,r=eP.get(n);if(r)return r;let i=ej(eI(l,eR(`mask:v1:${t}`))),o=eR(`check:v1:${t}:${l}`),a=`v1.${i}.${o}`;return eP.set(n,a),a}function eO(e,t){return eN(e,eD(t))}let e$=(e,t,l)=>{if(!e)return l;let n=t.split("."),r=[],i=e,o=!1;for(let e=0;e<n.length;e++){let t=n[e];if(Array.isArray(i)){for(let t of(o=!0,i)){let i=e$(t,n.slice(e).join("."),l);r=r.concat(i)}break}if((null==i?void 0:i[t])===void 0)break;i=i[t],e===n.length-1&&r.push(i)}return 0===(r=r.filter(e=>void 0!==e)).length?l:o?r.filter(e=>null!==e):r[0]};var eB=l(88835),eL=l(60639),eq=l.n(eL),eV=l(79441);let ez=l.n(eV)()();function eK(e){if(!e)return!1;let t=[e.$and,e.$or].filter(Boolean);return 0==t.length?Object.keys(e).length>0:t.some(e=>{if(Array.isArray(e))return e.some(eK);if(e.$and||e.$or)return eK(e);let[t]=Object.keys(e);if(!t||!e[t])return!1;let[l]=Object.keys(e[t]);return!!l&&void 0!==e[t][l]})}function eU(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eW(e){let t=e.substr(2,e.length-4).trim(),l=t.indexOf(":");return -1!==l?{key:t.substr(0,l),defaultValue:t.substr(l+1)}:{key:t}}function eH(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eY(e){switch(eU(e)){case"string":return eG(e);case"object":return eJ(e);case"array":return eX(e);default:return eH(function(){return e},[])}}Object.keys(ez).forEach(function(e){eq().registerHelper(e,ez[e])}),eq().registerHelper("json",function(e){return JSON.stringify(e)}),eq().registerHelper("urlParse",function(e){try{return JSON.stringify(eB.parse(e))}catch(t){return`Invalid URL: ${e}`}}),eq().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?o()(e).tz(l).format(t):o()(e).format(t)),eq().registerHelper("isNull",e=>r().isNull(e));let eG=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],r=e=>t,i=t.match(e);return i&&(l=i.map(eW),r=e=>(e=e||{},i.reduce((r,o,a)=>{let s=l[a],d=(0,n.get)(e,s.key);return(void 0===d&&(d=s.defaultValue),"function"==typeof d&&(d=d()),1===i.length&&t.startsWith("{{")&&t.endsWith("}}"))?d:(d instanceof Date&&(d=d.toISOString()),r.replace(o,null==d?"":d))},t))),eH(r,l)}})();function eJ(e){let t=Object.keys(e).map(t=>({keyTemplate:eG(t),valueTemplate:eY(e[t])}));return eH(e=>t.reduce((t,l)=>(t[l.keyTemplate(e)]=l.valueTemplate(e),t),{}),t.reduce((e,t)=>e.concat(t.valueTemplate.parameters,t.keyTemplate.parameters),[]))}function eX(e){let t=e.map(eY);return eH(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let eQ=function(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];console.error(e,...l)};var eZ=l(14744),e0=l.n(eZ);let e1=(e,t,l)=>t;function e2(e,t,l){return e0()(e,t,{arrayMerge:e1,...l})}var e5=l(76511);let e4=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;e5.Ay[t]({message:e,duration:l})};var e8=l(5062),e3=l(85738);function e6(e,t){if(null==e||""===e)return"";let l=(0,e8.i5)(t);return(0,e3.Mg)(String(e),".",l)}var e9=l(63560),e7=l.n(e9),te=l(95093),tt=l.n(te);let tl=/^\s*\{\{([\s\S]*)\}\}\s*$/;function tn(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function tr(e){return e}function ti(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,i=t.transformKey||tr,o=t.transformValue||tr,a={};function s(e,d,u){u=u||1,r().isObjectLike(e)&&Object.keys(e).forEach(function(r){var c;let p=e[r],h=t.safe&&Array.isArray(p),m=Object.prototype.toString.call(p),f=tn(p),g="[object Object]"===m||"[object Array]"===m,v=d?d+l+i(r):i(r);if(null==(c=t.breakOn)?void 0:c.call(t,{key:r,value:p,path:v})){a[v]=o(p,v);return}if(!h&&!f&&g&&Object.keys(p).length&&(!t.maxDepth||u<n))return s(p,v,u+1);a[v]=o(p,v)})}return s(e),a}function to(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||tr;for(let t of Object.keys(e))e7()(l,t,n(e[t],t));return l}let ta=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},ts=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function td(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tu(e){return(null==e?void 0:e.type)==="dateOnly"||(null==e?void 0:e.type)==="datetimeNoTz"||(null==e?void 0:e.constructor.name)==="DateOnlyField"||(null==e?void 0:e.constructor.name)==="DatetimeNoTzField"}let tc=(e,t)=>e?(e.type&&(e=L({...e,timezone:t})),Array.isArray(e))?(2===e.length?e.push("[]",t):3===e.length&&e.push(t),e):"string"==typeof e?!t||/(\+|-)\d\d:\d\d$/.test(e)?e:e+t:td(e)?e.toISOString():void 0:null,tp=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=new Set,n=t.vars||{},r=t.timezone,i=t.now,o=t.getField,a=ti(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=tl.exec(e);if(t){let e=t[1].trim();e.startsWith("$user")&&l.add(e.substring(6))}return e}});if(l.size>0){let e=await n.$user({fields:[...l.values()]});Object.assign(n,{$user:e})}return to(a,{transformValue(e,t){let{operator:l}=ta(t);if("string"==typeof e){let a=tl.exec(e);if(a){let s=e$(n,a[1].trim(),null),d=null==o?void 0:o(t);e="function"==typeof s?null==s?void 0:s({field:d,operator:l,timezone:r,now:i}):s}}if(ts(l)){let l=null==o?void 0:o(t);return tu(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||r}):e:tc(e,(null==l?void 0:l.timezone)||r)}return e}})};function th(e){let{now:t,timezone:l="+00:00",offset:n}=e,r=tm(t).utcOffset(ex(l));return n>0?[(r=r.add(1,"day").startOf("day")).format("YYYY-MM-DD"),r.clone().add(n,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]:[r.clone().subtract(-1*n-1,"day").startOf("day").format("YYYY-MM-DD"),r.clone().add(1,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]}function tm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?o().isDayjs(e)?e:t?tt()(e):o()(e):t?tt()():o()()}function tf(e){var t;let{now:l,unit:n,timezone:r="+00:00",offset:i}=e,o=tm(l,"isoWeek"===n);o=(o=o.utcOffset(ex(r))).startOf(n),i>0?o=o.add(i,n):i<0&&(o=o.subtract(-1*i,n));let a={year:()=>o.format("YYYY"),quarter:()=>o.format("YYYY[Q]Q"),month:()=>o.format("YYYY-MM"),week:()=>o.format("gggg[w]ww"),isoWeek:()=>o.format("GGGG[W]WW"),day:()=>o.format("YYYY-MM-DD")},s=null==(t=a[n])?void 0:t.call(a);return r?s+r:s}let tg=(e,t)=>l=>{let{now:n,timezone:r,field:i}=l;return(null==i?void 0:i.timezone)&&(r=null==i?void 0:i.timezone),tf({now:n,timezone:r,unit:e,offset:t})},tv=e=>t=>{let{now:l,timezone:n,field:r}=t;return(null==r?void 0:r.timezone)&&(n=null==r?void 0:r.timezone),th({now:l,timezone:n,offset:e})};function ty(){return{now:new Date().toISOString(),today:tg("day"),yesterday:tg("day",-1),tomorrow:tg("day",1),thisWeek:tg("week"),lastWeek:tg("week",-1),nextWeek:tg("week",1),thisIsoWeek:tg("isoWeek"),lastIsoWeek:tg("isoWeek",-1),nextIsoWeek:tg("isoWeek",1),thisMonth:tg("month"),lastMonth:tg("month",-1),nextMonth:tg("month",1),thisQuarter:tg("quarter"),lastQuarter:tg("quarter",-1),nextQuarter:tg("quarter",1),thisYear:tg("year"),lastYear:tg("year",-1),nextYear:tg("year",1),last7Days:tv(-7),next7Days:tv(7),last30Days:tv(-30),next30Days:tv(30),last90Days:tv(-90),next90Days:tv(90)}}function tb(e){let t=e.split(".");return[t.shift(),t.join(".")]}var tx=l(50467);class tw{register(e,t){if(!this.options.override&&this.map.has(e))throw Error(`this registry does not allow to override existing keys: "${e}"`);this.map.set(e,t)}get(e){return this.map.get(e)}getKeys(){return this.map.keys()}getValues(){return this.map.values()}getEntities(){return this.map.entries()}constructor(e={override:!1}){(0,tx._)(this,"map",new Map),(0,tx._)(this,"options",void 0),this.options=e}}l(67980);let tS=Symbol.for("nocobase.utils.sesLockdown"),tM=Symbol.for("nocobase.utils.bufferOverrides"),tA=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tF(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tk(){let e=globalThis;if(e[tM])return;let t=e.Buffer;if(!t||!t.prototype)return;let l=t.prototype;for(let e of Reflect.ownKeys(l)){let t=Object.getOwnPropertyDescriptor(l,e);if(!t||"function"!=typeof t.value||!t.configurable)continue;let n=t.value,r=function(){return n},i=function(t){if(this===l)throw TypeError(`Cannot assign to read only property '${String(e)}' of object 'Buffer.prototype'`);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,writable:!0,value:t})};Object.defineProperty(r,"originalValue",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(l,e,{configurable:t.configurable,enumerable:t.enumerable,get:r,set:i})}e[tM]=!0}function tC(e){tk();let t=globalThis;if(!t[tS]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tF(e))throw e}t[tS]=!0}}function tP(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tj=l(65606);let tE=e=>{for(;e;){var t;if("root"===e.id||(null==(t=e.classList)?void 0:t.contains("nb-action")))return!1;e=e.parentNode}return!tj.env.__TEST__};function tR(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tI=36,tT="";for(;tI--;)tT+=tI.toString(36);function t_(e){let t="",l=e||11;for(;l--;)t+=tT[36*Math.random()|0];return t}function tD(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tN=l(27153),tO="2.1.37";let t$=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=t$(e.properties[l],t)}),e;let l=e.parent;e=e.toJSON?e.toJSON():r().cloneDeep(e);let n={},{properties:i={}}=e,o=0;if(Object.keys(i).forEach((e,l)=>{let a=i[e];if("Grid.Row"!==a["x-component"]){a["x-index"]=++o,n[e]=a;return}if(a.properties){if(1===Object.keys(a.properties).length){a["x-index"]=++o,n[e]=a;return}Object.keys(a.properties).forEach((l,i)=>{let s=a.properties[l];if(r().set(s,"x-component-props.width",100),0===i){a["x-index"]=++o,n[e]=a;return}null!=t&&t(s)||(delete a.properties[l],n[`${t_()}_${l}`]=tB(s,l,++o))})}}),e.properties=n,l){let t=new tN.S(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tB(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tO,"x-uid":t_(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tL(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function tq(e){return!!e&&/[a-zA-Z_$]/.test(e)}function tV(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function tz(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function tK(e,t){let l=tz(e,t);for(;"!"===e[l];)l=tz(e,l+1);return l}function tU(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function tW(e,t){let l=tU(e,t-1);if("("!==e[l])return!1;let n=tU(e,l-1);if(n<0)return!0;let r=e[n];return!tV(r)&&")"!==r&&"]"!==r}function tH(e,t){let l=tz(e,t);if(")"!==e[l])return!1;let n=tz(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function tY(e,t){if(!tq(e[t]))return null;let l=t+1;for(;tV(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function tG(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function tJ(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,r="";for(;n<e.length;){let t=e[n];if("\\"===t){r+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:r,next:n+1};r+=t,n+=1}return null}function tX(e,t){let l=tz(e,t+1),n=tJ(e,l);if(n)return(l=tz(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let r=tG(e,l);return r?(l=tz(e,r.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:r.value}:{dynamic:!0}}function tQ(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function tZ(e,t){let l=tK(e,t);if("["===e[l])return tX(e,l);if(e.startsWith("?.",l)){let t=tz(e,l+2);if("["===e[t])return tX(e,t);let n=tY(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=tz(e,l+1),n=tY(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function t0(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function t1(e,t){if("ctx"!==e.slice(t,t+3)||tV(e[t-1])||tV(e[t+3]))return null;if(tW(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=tZ(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],r=l.next,i=!1,o=!1;for(;r<e.length;){let t=tK(e,r);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){i=!0,r=t;break}let l=tZ(e,r);if(!l){r=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(o=!0);break}if(l.dynamic){o=!0,r=t;break}tQ(n,l.kind,l.value),r=l.next}let a=n.join(".");return{next:Math.max(r,l.next),reference:{methodCall:i,path:a||void 0,unsupportedDynamicPath:o||tH(e,r),varName:l.value}}}function t2(e){let t=t0(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=t1(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function t5(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function t4(e){let t={},l=!1,n=e=>{for(let n of t2(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&t5(t,n.varName,n.path,n.methodCall)}},r=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)n(t[1]);return}Array.isArray(e)?e.forEach(r):tL(e)&&Object.values(e).forEach(r)};return r(e),{unsupportedDynamicPath:l,usage:t}}function t8(e){return new Set(Object.keys(t4(e).usage))}function t3(e){return t4(e).usage}let t6=new(l(23155)).HX;function t9(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={};for(let l of e){let e=l.replace(/^ctx\./,"").split("."),n=t;for(let t=0;t<e.length;t++){let r=e[t];t===e.length-1?n[r]=`{{${l}}}`:(n[r]=n[r]||{},n=n[r])}}return t}async function t7(e){return t9(await t6.fullVariables(e))}async function le(e,t){return await t6.parseAndRender(e,{ctx:t})}function lt(e){let t=1,l={};return{sql:e.replace(/{{\s*([^}]+)\s*}}/g,(e,n)=>{let r=`__var${t}`;return l[r]=`{{${n.trim()}}}`,t++,`$${r}`}),bind:l}}async function ll(e){let{sql:t,bind:l}=lt(e),n=await t7(t);return{sql:t,bind:l,liquidContext:n}}},59598(){},23005(){},14892(){},2813(){},9845(){}};import{__webpack_require__}from"./runtime-72080663.js";var __webpack_exec__=function(e){return __webpack_require__(__webpack_require__.s=e)};import*as __rspack_chunk_1 from"./vendor-antd-ecosystem-de737eca.js";__webpack_require__.C(__rspack_chunk_1);import*as __rspack_chunk_2 from"./vendor-moment-84b317dc.js";__webpack_require__.C(__rspack_chunk_2);import*as __rspack_chunk_3 from"./vendor-lodash-905dd3b8.js";__webpack_require__.C(__rspack_chunk_3);import*as __rspack_chunk_4 from"./vendor-ses-b7bccbcd.js";__webpack_require__.C(__rspack_chunk_4);import*as __rspack_chunk_5 from"./vendor-antd-icons-97ed2369.js";__webpack_require__.C(__rspack_chunk_5);import*as __rspack_chunk_6 from"./vendor-antd-e1ec510b.js";__webpack_require__.C(__rspack_chunk_6);import*as __rspack_chunk_7 from"./8384-1634db4d.js";__webpack_require__.C(__rspack_chunk_7);import*as __rspack_chunk_8 from"./index-c90a7249.js";__webpack_require__.C(__rspack_chunk_8),__webpack_exec__(35963);
|
|
1705
|
+
${p}`}async function tp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,r=n?eX.withTemplates:eX.withoutTemplates,i=eQ(r,l);if(i)return await i;let o=(async()=>{if(!n)return ts(await (0,eq.W)(l));let e=tc(l,{processStringLiterals:!1});return ts(tc(await (0,eq.W)(e),{processBarePlaceholders:!1}))})();eZ(r,l,o,eJ);try{return await o}catch(e){throw r.delete(l),e}}var th=l(62572);function tm(e){if(Array.isArray(e)){let t=e.map(e=>tm(e)).filter(e=>void 0!==e);return t.length?t:void 0}if(e&&"object"==typeof e){let t={};return Object.keys(e).forEach(l=>{let n=tm(e[l]);void 0!==n&&(t[l]=n)}),Object.keys(t).length?t:void 0}return null==e||"string"==typeof e&&""===e?void 0:e}let tf=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var tg=l(47684);let tv="0123456789abcdefghijklmnopqrstuvwxyz";function ty(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:11,l="";for(let e=0;e<t;e++)l+=tv[Math.random()*tv.length|0];return`${e}${l}`}},49773(e,t,l){l.d(t,{W:()=>n});async function n(e){if(!/<[A-Za-z]|<\//.test(e))return e;try{var t;let n=await l.e("7761").then(l.bind(l,1608)),r=(null==n?void 0:n.transform)||(null==n||null==(t=n.default)?void 0:t.transform);if("function"!=typeof r)return e;let i=r(e,{transforms:["jsx"],jsxPragma:"ctx.React.createElement",jsxFragmentPragma:"ctx.React.Fragment",disableESTransforms:!0,production:!0});return(i&&(i.code||(null==i?void 0:i.output)))??e}catch(t){return e}}},81982(e,t,l){l.d(t,{M:()=>f,gG:()=>a,mv:()=>s,o4:()=>h,pk:()=>m});var n=l(40542),r=l(13939),i=l(2543),o=l.n(i);async function a(e,t){if(!e)return{};if("function"==typeof e)try{return await e(t)||{}}catch(e){return console.error("Error resolving defaultParams function:",e),{}}return e}async function s(e,t,l){if(!e)return{};if("function"==typeof e)try{return await e(t,l)||{}}catch(e){return console.error("Error resolving createModelOptions function:",e),{}}return e}let d={queue:[],timer:null,inflightByRun:new Map},u=10;function c(e){if(Array.isArray(e))return e.map(c);if(o().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,c(l)]});return Object.fromEntries(o().sortBy(t,e=>{let[t]=e;return t}))}return e}function p(e){try{return JSON.stringify(c(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function h(e,t){let l,n,r=d,i=e.runId||"GLOBAL",o=p(t),a=r.inflightByRun.get(i);a||(a=new Map,r.inflightByRun.set(i,a));let s=a.get(o);if(s)return s;let c=new Promise((e,t)=>{l=e,n=t});a.set(o,c);let h={id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,ctx:e,payload:t,resolve:l,reject:n,runId:i,dedupKey:o};r.queue.push(h);let m=async()=>{var t,l,n,i,o,a;let s=r.queue.splice(0,r.queue.length);if(r.timer=null,!s.length)return;let d=null==(t=s[0].ctx)?void 0:t.api;if(!d){for(let e of s)try{e.resolve(e.payload.template)}catch(t){e.reject(t)}finally{null==(l=r.inflightByRun.get(e.runId))||l.delete(e.dedupKey)}return}try{let e=s.map(e=>({id:e.id,contractRd:e.payload.contractRd,rd:e.payload.rd,template:e.payload.template,contextParams:e.payload.contextParams||{}})),t=await d.request({method:"POST",url:"variables:resolve",data:{values:{batch:e}}}),l=t.data??t,i=l.data??l,o=null==i?void 0:i.results,a=Array.isArray(o)?o:Array.isArray(i)?i:[],u=new Map;for(let e of a){let t=(null==e?void 0:e.id)!=null?String(e.id):"";t&&u.set(t,null==e?void 0:e.data)}for(let e of s)try{let t=String(e.id),l=u.has(t)?u.get(t):e.payload.template;e.resolve(l)}catch(t){e.reject(t)}finally{null==(n=r.inflightByRun.get(e.runId))||n.delete(e.dedupKey)}}catch(t){for(let l of s)try{null==e||null==(o=e.logger)||null==(i=o.warn)||i.call(o,{err:t},"variables:resolve(batch) failed, fallback"),l.resolve(l.payload.template)}catch(e){l.reject(e)}finally{null==(a=r.inflightByRun.get(l.runId))||a.delete(l.dedupKey)}}};return r.timer||(r.timer=setTimeout(m,u)),c}function m(e,t){var l,n;return(0,r.generateFlowModelRdFromToken)(t,null==e||null==(n=e.api)||null==(l=n.auth)?void 0:l.token)}async function f(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await y(e,t);if(Array.isArray(e))return Promise.all(e.map(l));if(e&&"object"==typeof e){let t={};for(let[n,r]of Object.entries(e))t[n]=await l(r);return t}return e};return l(e)}async function g(e,t){let l=await v(e.trim(),t),n=await t.runjs(`return ${l}`,{t:t.t});return(null==n?void 0:n.success)?n.value:void 0}async function v(e,t){let l,n=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*(?:(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)|(?:\[[^\]]+\]))*)(?!\s*\()/g,r=[],i=new Set;for(;null!==(l=n.exec(e));){let e=l[0],t=l[1],n=t.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);if(n){let l=n[1],o=t.substring(l.length);r.push({fullPath:e,firstKey:l,restPath:o}),i.add(l)}}if(0===r.length)return e;let o=new Map;for(let e of i)try{let l=await t[e],n=l&&!0===l.__isRecordProxy__;o.set(e,n)}catch(t){o.set(e,!1)}r.sort((e,t)=>t.fullPath.length-e.fullPath.length);let a=e;for(let{fullPath:e,firstKey:t,restPath:l}of r){let n,r=o.get(t)||!1;n=""===l?`await ctx.${t}`:r?`await (await ctx.${t})${l}`:`(await ctx.${t})${l}`;let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=RegExp(`\\b${i}\\b`,"g");a=a.replace(s,n)}return a}async function y(e,t){let l=e=>{let t=e.trim().match(/^ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\.([a-zA-Z_$][a-zA-Z0-9_$-]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$-]*)*))?$/);return t?t[2]?`${t[1]}.${t[2]}`:t[1]:null},r=async e=>{let l=e.split("."),r=l.shift();if(!r)return;let i=await t[r];return 0===l.length?i:(0,n.D)(i,l.join("."))},i=async e=>{let n=l(e);if(n){let l=await r(n);return void 0===l&&n.includes("-")?await g(e,t):l}return await g(e,t)},o=e.match(/^\s*\{\{\s*([^{}]+?)\s*\}\}\s*$/);if(o){let e=o[1];return await i(e)}let a=[...e.matchAll(/\{\{\s*(.+?)\s*\}\}/g)],s=e;for(let[e,t]of a){let l=await i(t);if(void 0!==l){let t="object"==typeof l&&null!==l?JSON.stringify(l):String(l);s=s.replace(e,t)}}return s}},47684(e,t,l){function n(e,t){if(!e||"string"!=typeof e)throw Error("invalid url");let l=e.trim();if(l.startsWith("http://")||l.startsWith("https://"))return l;let n=window.__esm_cdn_base_url__||"https://esm.sh",r=(null==t?void 0:t.addSuffix)&&window.__esm_cdn_suffix__||"",i=n.replace(/\/$/,""),o=l.replace(/^\//,"");if(null==t?void 0:t.raw){let e=o.includes("?")?"&":"?";return`${i}/${o}${e}raw`}return`${i}/${o}${r}`}function r(e){return!!e&&"string"==typeof e&&e.split("?")[0].split("#")[0].endsWith(".css")}l.d(t,{i:()=>n,y:()=>r})},51143(e,t,l){function n(){var e,t;let l=globalThis;if((null==(e=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:e.windowAllow)&&(null==(t=l.__nocobaseRunJSSafeGlobalsRegistry)?void 0:t.documentAllow))return l.__nocobaseRunJSSafeGlobalsRegistry;let n={windowAllow:new Set,documentAllow:new Set};return l.__nocobaseRunJSSafeGlobalsRegistry=n,n}function r(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.windowAllow.add(e)}}function i(e){if(!e)return;let t=n();for(let l of e){if("string"!=typeof l)continue;let e=l.trim();e&&t.documentAllow.add(e)}}function o(e){return n().windowAllow.has(e)}function a(e){return n().documentAllow.has(e)}function s(e){let t=()=>`${window.location.origin}${window.location.pathname}`,l=(e,l,n)=>{if(!(e=>{try{let l=new URL(e,t()),n=l.protocol.toLowerCase();if("about:"===n)return"about:blank"===l.href;return"http:"===n||"https:"===n}catch{return!1}})(e))throw Error("Unsafe URL: window.open only allows http/https/about:blank.");let r="_blank",i=(e=>{let t=new Set;return e&&e.split(",").map(e=>e.trim()).filter(Boolean).forEach(e=>{let l=e.split("=")[0].trim().toLowerCase();"noopener"!==l&&"noreferrer"!==l&&t.add(e)}),t.add("noopener"),t.add("noreferrer"),Array.from(t).join(",")})(n),o=window.open.call(window,e,r,i);if(o&&"opener"in o)try{o.opener=null}catch{}return o},n=(e,n)=>{let r=new URL(e,t()),i=r.protocol.toLowerCase(),o="about:"===i&&"about:blank"===r.href;if("http:"!==i&&"https:"!==i&&!o)throw Error("Unsafe URL: only http/https/about:blank are allowed.");if(o)return(null==n?void 0:n.replace)?window.location.replace("about:blank"):window.location.assign("about:blank");if(r.protocol===window.location.protocol&&r.hostname===window.location.hostname&&r.port===window.location.port)return(null==n?void 0:n.replace)?window.location.replace(r.href):window.location.assign(r.href);if(!l(r.href))throw Error("Popup blocked: cross-origin navigation is opened in a new tab.")},r=new Proxy({},{get(e,t){switch(t){case"origin":return window.location.origin;case"protocol":return window.location.protocol;case"host":return window.location.host;case"hostname":return window.location.hostname;case"port":return window.location.port;case"pathname":return window.location.pathname;case"assign":return e=>n(e,{replace:!1});case"replace":return e=>n(e,{replace:!0});case"reload":return window.location.reload.bind(window.location);case"href":throw Error("Reading location.href is not allowed.");default:throw Error(`Access to location property "${t}" is not allowed.`)}},set(e,t,l){if("href"===t)return n(String(l),{replace:!1}),!0;throw Error("Mutation on location is not allowed.")}}),i={setTimeout:window.setTimeout.bind(window),clearTimeout:window.clearTimeout.bind(window),setInterval:window.setInterval.bind(window),clearInterval:window.clearInterval.bind(window),console,Math,Date,FormData,..."u">typeof Blob?{Blob}:{},..."u">typeof URL?{URL}:{},addEventListener:addEventListener.bind(window),open:l,location:r,...e||{}};return new Proxy(Object.create(null),{get(e,t){if("string"!=typeof t)return Reflect.get(e,t);if(t in i)return i[t];if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(o(t)){let e=window[t];return"function"==typeof e?e.bind(window):e}throw Error(`Access to global property "${t}" is not allowed.`)},set(e,t,l){if("string"!=typeof t)return Reflect.set(e,t,l),!0;if(t in i)throw Error(`Mutation of global property "${t}" is not allowed.`);return e[t]=l,!0},has:(e,t)=>"string"!=typeof t?Reflect.has(e,t):!!(t in i||Object.prototype.hasOwnProperty.call(e,t)||o(t))})}function d(e){let t={createElement:document.createElement.bind(document),querySelector:document.querySelector.bind(document),querySelectorAll:document.querySelectorAll.bind(document),...e||{}};return new Proxy(Object.create(null),{get(e,l){if("string"!=typeof l)return Reflect.get(e,l);if(l in t)return t[l];if(Object.prototype.hasOwnProperty.call(e,l))return e[l];if(a(l)){let e=document[l];return"function"==typeof e?e.bind(document):e}throw Error(`Access to document property "${l}" is not allowed.`)},set(e,l,n){if("string"!=typeof l)return Reflect.set(e,l,n),!0;if(l in t)throw Error(`Mutation of document property "${l}" is not allowed.`);return e[l]=n,!0},has:(e,l)=>"string"!=typeof l?Reflect.has(e,l):!!(l in t||Object.prototype.hasOwnProperty.call(e,l)||a(l))})}function u(e){var t;let l="u">typeof window&&window.navigator||void 0,n={},r=null==l||null==(t=l.clipboard)?void 0:t.writeText;"function"==typeof r&&(n.writeText=r.bind(l.clipboard));let i={clipboard:n};return Object.defineProperty(i,"onLine",{get:()=>!!(null==l?void 0:l.onLine),enumerable:!0,configurable:!1}),Object.defineProperty(i,"language",{get:()=>null==l?void 0:l.language,enumerable:!0,configurable:!1}),Object.defineProperty(i,"languages",{get:()=>(null==l?void 0:l.languages)?[...l.languages]:void 0,enumerable:!0,configurable:!1}),Object.assign(i,e||{}),new Proxy({},{get(e,t){if(t in i)return i[t];throw Error(`Access to navigator property "${String(t)}" is not allowed.`)}})}function c(e){let t={};try{let e=u();t.navigator=e;try{t.window=s({navigator:e})}catch{}}catch{}try{t.document=d()}catch{}return e?{...t,...e}:t}async function p(e,t,l,n){if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.runjs)return e.runjs(t,c(n),l)}l.d(t,{D1:()=>u,I2:()=>c,Vm:()=>r,Xh:()=>d,_:()=>p,ey:()=>s,yz:()=>i})},22928(e,t,l){function n(e){let t={};return Object.entries(e||{}).forEach(e=>{let[l,n]=e;null!=n&&(t[l]=n)}),t}function r(e,t,l){try{var n,r,i,o,a;let s=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,t||"main"),d=null==s||null==(o=s.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,l);return(null==d||null==(a=d.getPrimaryKey)?void 0:a.call(d))||"id"}catch(e){return"id"}}function i(e,t){var l,i;if(!t)return;let o=t.dataSourceKey||"main",a=t.collection||(null==(l=t.record)?void 0:l.__collectionName);if(!a)return;let s=r(e,o,a)||"id",d=void 0!==t.filterByTk?t.filterByTk:void 0!==t.id?t.id:null==(i=t.record)?void 0:i[s];if(void 0!==d)return n({collection:a,filterByTk:d,dataSourceKey:o,associationName:t.associationName,sourceId:t.sourceId,fields:t.fields,appends:t.appends})}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e=>!!e&&"object"==typeof e&&"string"==typeof e.collection&&(void 0!==e.filterByTk||void 0!==e.id||e.record),n={},r=(t,o)=>{if(l(t)){let l=i(e,t);l&&(n[o.join(".")]=l);return}if(Array.isArray(t)){for(let e=0;e<t.length;e++)r(t[e],[...o,String(e)]);return}if(t&&"object"==typeof t){for(let[e,l]of Object.entries(t))r(l,[...o,e]);return}};return r(t,[]),Object.keys(n).length?n:void 0}l.d(t,{d:()=>o})},88439(e,t,l){l.d(t,{w:()=>n});function n(e,t,l,n){let r={},i={};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let s=t[a],d={};if(s.uiSchema&&"object"==typeof s.uiSchema){for(let[e,t]of Object.entries(s.uiSchema))if(t&&"object"==typeof t){var o;let l=t;d[e]={type:l.type||"any",title:l.title||(null==(o=l["x-decorator-props"])?void 0:o.label)||e,interface:l["x-component"],uiSchema:l}}}let u=Object.keys(d).length>0;i[a]={type:"object",title:e.t(s.title)||a,display:u?"default":"none",properties:u?{params:{type:"object",title:"Parameters",display:"flatten",properties:d}}:void 0},r[a]={get params(){return l.getStepParams(n,a)||{}},get uiSchema(){return s.uiSchema},result:void 0}}e.defineProperty("steps",{get:()=>r})}},73398(e,t,l){function n(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function r(e){return!!e&&/[a-zA-Z_$]/.test(e)}function i(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function o(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function a(e,t){let l=o(e,t);for(;"!"===e[l];)l=o(e,l+1);return l}function s(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function d(e,t){let l=s(e,t-1);if("("!==e[l])return!1;let n=s(e,l-1);if(n<0)return!0;let r=e[n];return!i(r)&&")"!==r&&"]"!==r}function u(e,t){let l=o(e,t);if(")"!==e[l])return!1;let n=o(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function c(e,t){if(!r(e[t]))return null;let l=t+1;for(;i(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function p(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function h(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,r="";for(;n<e.length;){let t=e[n];if("\\"===t){r+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:r,next:n+1};r+=t,n+=1}return null}function m(e,t){let l=o(e,t+1),n=h(e,l);if(n)return(l=o(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let r=p(e,l);return r?(l=o(e,r.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:r.value}:{dynamic:!0}}function f(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function g(e,t){let l=a(e,t);if("["===e[l])return m(e,l);if(e.startsWith("?.",l)){let t=o(e,l+2);if("["===e[t])return m(e,t);let n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=o(e,l+1),n=c(e,t)||p(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function v(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function y(e,t){if("ctx"!==e.slice(t,t+3)||i(e[t-1])||i(e[t+3]))return null;if(d(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=g(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],r=l.next,o=!1,s=!1;for(;r<e.length;){let t=a(e,r);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){o=!0,r=t;break}let l=g(e,r);if(!l){r=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(s=!0);break}if(l.dynamic){s=!0,r=t;break}f(n,l.kind,l.value),r=l.next}let c=n.join(".");return{next:Math.max(r,l.next),reference:{methodCall:o,path:c||void 0,unsupportedDynamicPath:s||u(e,r),varName:l.value}}}function b(e){let t=v(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=y(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function x(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function w(e){let t={},l=!1,r=e=>{for(let n of b(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&x(t,n.varName,n.path,n.methodCall)}},i=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)r(t[1]);return}Array.isArray(e)?e.forEach(i):n(e)&&Object.values(e).forEach(i)};return i(e),{unsupportedDynamicPath:l,usage:t}}function S(e){return new Set(Object.keys(w(e).usage))}function M(e){return w(e).usage}l.d(t,{xI:()=>T,vP:()=>O,$S:()=>_,pc:()=>D,Cg:()=>E,nN:()=>$,ju:()=>B,Xx:()=>I,vE:()=>R,XU:()=>j,UX:()=>N});var A=l(22928),F=l(35846),k=l(44476),C=l(2543),P=l.n(C);function j(e){var t,l,n,r;let i=e.resource,o=e.collection,a=e.record,s=(null==o?void 0:o.name)||(null==i||null==(t=i.getResourceName)?void 0:t.call(i)),d=(null==o?void 0:o.dataSourceKey)||(null==i||null==(l=i.getDataSourceKey)?void 0:l.call(i)),u=(null==i||null==(n=i.getFilterByTk)?void 0:n.call(i))??(null==o||null==(r=o.getFilterByTK)?void 0:r.call(o,a));if(!s||null==u)return;let c=String(s).split(".");return{collection:c[c.length-1],dataSourceKey:d,filterByTk:u}}function E(e){var t,l,n;let r=e.view;if(!r)return;let i=(null==r?void 0:r.inputArgs)||{},o=(null==i?void 0:i.collectionName)||(null==r||null==(t=r.record)?void 0:t.collection),a=(null==i?void 0:i.dataSourceKey)||(null==r||null==(l=r.record)?void 0:l.dataSourceKey)||"main",s=(null==i?void 0:i.filterByTk)||(null==r||null==(n=r.record)?void 0:n.filterByTk),d=null==i?void 0:i.associationName,u=null==i?void 0:i.sourceId;if(o&&null!=s)return{collection:o,dataSourceKey:a,filterByTk:s,sourceId:u,associationName:d}}function R(e,t){var l,n,r;let i=null==(l=e.inputArgs)?void 0:l.record,o=null==(n=e.collection)?void 0:n.filterTargetKey;if(!i||!o)return;let a=t.view,s=null==a||null==(r=a.inputArgs)?void 0:r.filterByTk,d=i[o];if(null!=s&&null!=d&&s===d)return P().cloneDeep(i)}function I(e,t){return l=>{var n,r,i,o;if(!("record"===l||l.startsWith("record.")))return!1;let a=t();if(!a)return!0;if("record"===l)return!1;let s=E(e),d=null==s?void 0:s.collection,u=(null==s?void 0:s.dataSourceKey)||"main";if(!d)return!0;let c=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,u),p=null==c||null==(o=c.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,d);if(!p)return!0;let h=(0,k.Hi)(()=>p,()=>a),m=l.startsWith("record.")?l.slice(7):"";return!!m&&h(m)}}function T(e,t){let l=(0,k.Hi)(e,()=>t());return n=>{let r=t();if(!r)return!0;if(!n)return!1;let i=e();if(!n.includes(".")){var o;let e,t=n;return i&&("function"==typeof i.getField&&(e=i.getField(t)),e||"function"!=typeof i.getFields||(e=(i.getFields()||[]).find(e=>(null==e?void 0:e.name)===t))),!!(null==e||null==(o=e.isAssociationField)?void 0:o.call(e))&&null==(null==r?void 0:r[t])}return l(n)}}async function _(e,t,l){let n=await (0,F.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):j(e)}:null}function D(e,t,l){let n=async()=>_(e,t,l);return n.title=t,n}function N(e,t,l){var n,r;return D(t,(null==l?void 0:l.title)?(null==(n=e.t)?void 0:n.call(e,l.title))||l.title:(null==(r=e.t)?void 0:r.call(e,"Current record"))||"Current record",e=>j(e))}let O=S,$=M;async function B(e,t){let l=M(t)||{},n=Object.keys(l);if(!n.length)return;let r={};for(let t of n){var i;let l,n=null==(i=e.getPropertyOptions)?void 0:i.call(e,t),o=null==n?void 0:n.meta;if(o){try{let t="function"==typeof o?await o():o,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(r[t]=l)}}let o=l.view||[];if(!r.view&&o.some(e=>"record"===e||e.startsWith("record.")||e.startsWith("record["))){let t=E(e);t&&(r.view={record:t})}return(0,A.d)(e,r)}},67778(e,t,l){l.d(t,{sp:()=>j,bt:()=>T,U:()=>en,N5:()=>U,xB:()=>L,mW:()=>B,fP:()=>G});var n=l(74848),r=l(96540),i=l(99418),o=l(11869),a=l(29007),s=l(52568),d=l(73398);function u(e){if((null==e?void 0:e.sourceId)==null||""===e.sourceId||"string"!=typeof e.associationName)return;let t=e.associationName.split(".")[0];if(t)return{collection:t,dataSourceKey:e.dataSourceKey||"main",filterByTk:e.sourceId}}function c(e){return null!=e}function p(e,t){if(e===t)return!0;if(!c(e)||!c(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function h(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function m(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h(e);if(!l.length)return -1;let n=(null==e?void 0:e.inputArgs)||{},r=(null==e||null==(t=e.navigation)?void 0:t.viewParams)||{},i=n.viewUid??r.viewUid;if(!i)return l.length-1;let o=l.map((e,t)=>({item:e,index:t})).filter(e=>{let{item:t}=e;return(null==t?void 0:t.viewUid)===i});if(!o.length)return l.length-1;let a=["filterByTk","sourceId","tabUid"],s=o[o.length-1].index,d=-1;for(let{item:e,index:t}of o){let l=0,r=!0;for(let t of a)if(c(n[t])){if(!p(null==e?void 0:e[t],n[t])){r=!1;break}l+=1}r&&l>=d&&(s=t,d=l)}return s}function f(e,t){return t??e.view}function g(e){var t;if(!e)return!1;let l=h(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,r=Array.isArray(n)&&n.length>0;return m(e,l)>=1||r}function v(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return g(f(l,t))},r=async e=>{let l=f(e,t);if(!l||!g(l))return;let n=await y(e,l),r=null==n?void 0:n.resource;return(null==r?void 0:r.collectionName)&&null!=r.filterByTk?{collection:r.collectionName,dataSourceKey:r.dataSourceKey||"main",filterByTk:r.filterByTk,associationName:r.associationName,sourceId:r.sourceId}:(0,d.Cg)(e)},i=async()=>{var t,l,n,i;let o=await r(e);if(!(null==o?void 0:o.collection))return null;let a=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,o.dataSourceKey||"main");return(null==a||null==(i=a.collectionManager)||null==(n=i.getCollection)?void 0:n.call(i,o.collection))||null},o=async(l,n)=>{var r,i,o,a,s,d;try{let s=n||e,d=f(s,t),u=h(d),c=m(d,u);if(c<1||l<1)return;let p=c-l;if(p<1)return;let g=u[p];if(!(null==g?void 0:g.viewUid))return;let v=null==(r=s.engine)?void 0:r.getModel(g.viewUid,!0);if(!v)try{v=await s.engine.loadModel({uid:g.viewUid})}catch(t){null==(a=s.logger||e.logger)||null==(o=a.warn)||o.call(a,{err:t},"[FlowEngine] popup.getParentRecordRef loadModel failed")}let y=(null==v||null==(i=v.getStepParams)?void 0:i.call(v,"popupSettings","openView"))||{},b=null==y?void 0:y.collectionName,x=(null==y?void 0:y.dataSourceKey)||"main",w=(null==g?void 0:g.filterByTk)??(null==g?void 0:g.sourceId);if(!b||null==w)return;return{collection:b,dataSourceKey:x,filterByTk:w,sourceId:null==g?void 0:g.sourceId,associationName:null==y?void 0:y.associationName}}catch(t){null==(d=(null==n?void 0:n.logger)||e.logger)||null==(s=d.warn)||s.call(d,{err:t},"[FlowEngine] popup.getParentRecordRef failed");return}},a=l=>{try{let n=f(e,t),r=h(n);return m(n,r)-l>=1}catch(e){return!1}},s=t=>{let n=()=>({type:"object",title:l("Parent popup"),disabled:()=>!a(t),disabledReason:()=>a(t)?void 0:l("No parent popup"),hidden:()=>!a(t),properties:async()=>{let n=await o(t),r={};if(r.uid={type:"string",title:l("Popup uid")},n){let t=(()=>{try{var t,l,r,i;let o=null==(l=e.dataSourceManager)||null==(t=l.getDataSource)?void 0:t.call(l,n.dataSourceKey||"main");return(null==o||null==(i=o.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,n.collection||""))||null}catch(e){return null}})();r.record=await (0,d.$S)(()=>t,l("Popup record"),()=>n)||{type:"object",title:l("Popup record")}}else r.record={type:"object",title:l("Popup record")};return r.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},r}});return n.title=l("Parent popup"),n},c=()=>({type:"object",title:l("Current popup"),disabled:()=>!n(),hidden:()=>!n(),buildVariablesParams:async e=>{var l,i,a,s;if(!n(e))return;let d=await r(e),c=f(e,t),p=null==c?void 0:c.inputArgs,g={};if(d){let e={...d};!e.associationName&&(null==p?void 0:p.associationName)&&(e.associationName=p.associationName),void 0===e.sourceId&&void 0!==(null==p?void 0:p.sourceId)&&(e.sourceId=null==p?void 0:p.sourceId),g.record=e}try{let t=h(c);if(m(c,t)>=2){let t=g,l=1,n=await o(l,e);for(;n;){let r={record:n},i=u(n);i&&(r.sourceRecord=i),t.parent=r,t=r,l+=1,n=await o(l,e)}}}catch(t){null==(i=e.logger)||null==(l=i.debug)||l.call(i,{err:t},"[FlowEngine] buildVariablesParams: build parent-chain failed")}try{let e=u({sourceId:null==p?void 0:p.sourceId,associationName:null==p?void 0:p.associationName,dataSourceKey:null==p?void 0:p.dataSourceKey});e&&(g.sourceRecord=e)}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return g},properties:async()=>{var n,a,u,c;let p={};if(p.uid={type:"string",title:l("Popup uid")},await r(e)){let e=async()=>{let e=await i();return e?await (0,d.$S)(()=>e,l("Current popup record"),e=>r(e)):null};e.title=l("Current popup record"),e.hasChildren=!0,p.record=e}try{let r=f(e,t),i=null==r?void 0:r.inputArgs,o=null==i?void 0:i.sourceId,s=null==i?void 0:i.associationName,u=(null==i?void 0:i.dataSourceKey)||"main";if(!s||"string"!=typeof s||!s.includes(".")){let t=h(r),l=m(r,t),i=l>=0?null==t?void 0:t[l]:void 0;if(null==i?void 0:i.viewUid){let t=null==e||null==(n=e.engine)?void 0:n.getModel(i.viewUid,!0);t||(t=await e.engine.loadModel({uid:i.viewUid}));let l=(null==t||null==(a=t.getStepParams)?void 0:a.call(t,"popupSettings","openView"))||{};s=(null==l?void 0:l.associationName)||s,u=(null==l?void 0:l.dataSourceKey)||u}}if(null!=o&&""!==o&&s&&"string"==typeof s){let t=String(s).includes(".")?String(s).split(".")[0]:void 0;if(t){let n=()=>{try{var l,n,r,i;let o=null==(n=e.dataSourceManager)||null==(l=n.getDataSource)?void 0:l.call(n,u);return(null==o||null==(i=o.collectionManager)||null==(r=i.getCollection)?void 0:r.call(i,t))||null}catch(e){return null}},r=await (0,d.$S)(n,l("Current popup parent record"),()=>({collection:t,dataSourceKey:u,filterByTk:o}));r&&(p.sourceRecord=r)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return p.resource={type:"object",title:l("Data source"),properties:async()=>({dataSourceKey:{type:"string",title:l("Data source key")},collectionName:{type:"string",title:l("Collection name")},associationName:{type:"string",title:l("Association name")},filterByTk:{type:"string",title:l("filterByTk")},sourceId:{type:"string",title:l("sourceId")}})},await o(1)&&(p.parent=s(1)),p}});return c.title=l("Current popup"),c.sort=975,c}async function y(e,t){var l,n,r;let i=h(t),o=m(t,i),a=null==t||null==(n=t.inputArgs)||null==(l=n.parentItem)?void 0:l.value,s=null==t||null==(r=t.inputArgs)?void 0:r.openerUids,d=Array.isArray(s)&&s.length>0;if(!(o>=1||d))return;if(!i.length){let e=(null==t?void 0:t.inputArgs)||{};if(!(e.collectionName||null!=e.filterByTk||null!=e.sourceId||e.associationName||e.viewUid))return;return{uid:e.viewUid,resource:{dataSourceKey:e.dataSourceKey||"main",collectionName:e.collectionName,associationName:e.associationName,filterByTk:e.filterByTk,sourceId:e.sourceId},...void 0!==a?{sourceRecord:a}:{}}}let u=async t=>{var l,n,r,o,a,s;if(t<0||!(null==(l=i[t])?void 0:l.viewUid))return;let d=i[t].viewUid,c=null==(n=e.engine)?void 0:n.getModel(d,!0);c||(c=await (null==(s=e.engine)?void 0:s.loadModel({uid:d})));let p=(null==c||null==(r=c.getStepParams)?void 0:r.call(c,"popupSettings","openView"))||{},h=null==p?void 0:p.collectionName,m={uid:d,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:h,associationName:null==p?void 0:p.associationName,filterByTk:null==(o=i[t])?void 0:o.filterByTk,sourceId:null==(a=i[t])?void 0:a.sourceId}},f=await u(t-1);return f&&(m.parent=f),m},c=await u(o);return c&&void 0!==a&&(c.sourceRecord=a),c}function b(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/,n=e=>{var l,n;if("sourceRecord"!==e&&!e.startsWith("sourceRecord."))return!1;let r=null==t||null==(l=t.inputArgs)?void 0:l.parentItem;if(void 0===(null==r?void 0:r.value))return!0;let i="sourceRecord"===e?"":e.slice(13);if(!i)return!1;let o=null==t||null==(n=t.inputArgs)?void 0:n.parentItemResolver;if("function"==typeof o)return o(`value.${i}`);let a=i.split(".").filter(Boolean),s=r.value;for(let e of a){if(null===s||"object"!=typeof s||!(e in s))return!0;s=s[e]}return!1};e.defineProperty("popup",{get:async()=>y(e,t),meta:v(e,t),resolveOnServer:e=>{try{if("sourceRecord"===e||e.startsWith("sourceRecord."))return n(e);return!!e&&l.test(e)}catch(e){return!1}}})}var x=l(18182);let w=(0,r.forwardRef)((e,t)=>{let{afterClose:l,footer:i,header:o,hidden:a,...s}=e,[d,u]=(0,r.useState)(!0),[c,p]=(0,r.useState)(s),[h,m]=(0,r.useState)(()=>i),[f,g]=(0,r.useState)(o);(0,r.useImperativeHandle)(t,()=>({destroy:()=>{u(!1),null==l||l()},update:e=>p(t=>({...t,...e})),setFooter:e=>{m(e)},setHeader:e=>{0===Object.values(e||{}).length?g(null):g(e)}}));let v={...c,title:(null==f?void 0:f.title)||c.title,extra:null==f?void 0:f.extra,footer:void 0!==h?h:c.footer??null},y=r.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return(0,n.jsx)(x.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function S(){let[e,t]=r.useState([]);return[e,r.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var M=l(16639),A=l(20616),F=l(47451);async function k(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function C(e,t){var l;let n=null==t?void 0:t.layoutContext,r=null==t||null==(l=t.engine)?void 0:l.context;n instanceof a.cB&&n!==t&&n!==r&&e.addDelegate(n)}let P=0;function j(){let e=r.useRef(null),t=(t,l)=>{var u,c,p;let h,m,f=null==l?void 0:l.engine;P+=1;let g=r.createRef(),v=new Promise(e=>{m=e}),y=null,x=null,S=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return y=t,null==(e=g.current)||e.setFooter(t),()=>{var e;y=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},j=e=>(r.useEffect(()=>{var t;return x=e,null==(t=g.current)||t.setHeader(e),()=>{var e;x=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),E=new a.cB,R=(0,F._)(l.engine),I=(0,M.eX)(f,R);E.defineProperty("engine",{value:R}),E.addDelegate(R.context),!1!==t.inheritContext?E.addDelegate(l):(E.addDelegate(l.engine.context),C(E,l));let T=!1,_={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(T)return;T=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==h||h(),null==m||m(e);let o=null==I?void 0:I.emitter;(0,M.Z8)(o),null==o||null==(i=o.emit)||i.call(o,M.B9,{type:"dialog",viewUid:null==_||null==(r=_.inputArgs)?void 0:r.viewUid}),R.unlinkFromStack()},update:e=>{var t;return null==(t=g.current)?void 0:t.update(e)},close:async(e,l)=>{var n,r;return(!t.preventClose||!!l)&&!!await k(_,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():_.destroy(e),!0)},Footer:S,Header:j,setFooter:e=>{var t;y=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;x=e,null==(t=g.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,E)}};E.defineProperty("view",{get:()=>_,resolveOnServer:(0,d.Xx)(E,()=>(0,d.vE)(l,E))}),R.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),_.destroy()}),b(E,_);let D=(0,o.observer)(()=>{var e,l,o,a;let s=r.useRef(!1),d="function"==typeof t.content?t.content(_,E):t.content,u="string"==typeof d?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(d)}}):d;return(r.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,_,E)},[]),(null==(l=t.inputArgs)||null==(e=l.hidden)?void 0:e.value)&&!s.current)?null:(s.current=!0,(0,n.jsx)(w,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(o=a.hidden)?void 0:o.value,footer:y,header:x,...t,onCancel:()=>{_.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),N=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${P}`,O=(0,n.jsx)(A.I6,{engine:R,children:(0,n.jsx)(s.YQ,{context:E,children:(0,n.jsx)(D,{})})},N);return h=null==(p=e.current)?void 0:p.patchElement(O),Object.assign(v,_)},l=r.useMemo(()=>({open:t}),[]),u=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(u,{ref:e},"dialog-holder")]}var E=l(97134),R=l(61793);let I=r.forwardRef((e,t)=>{var l;let{children:i,footer:o,title:a,extra:s,hidden:d,isMobile:u,...c}=e,[p,h]=r.useState(!0),[m,f]=r.useState(()=>o),[g,v]=r.useState({title:a,extra:s,...c.header});r.useImperativeHandle(t,()=>({destroy:()=>{h(!1)},update:e=>{Object.assign(c,e)},setFooter:e=>{f(e)},setHeader:e=>{0===Object.values(e||{}).length?v(null):v(e)}}),[]);let y=r.useMemo(()=>document.querySelector("#nocobase-app-container"),[]);return u?(0,n.jsx)(R.D,{className:d?"nb-hidden":"",visible:p,...c,footer:m,...g,onClose:c.onClose,children:i}):(0,n.jsx)(E.A,{rootClassName:d?"nb-hidden":"",closable:!1,getContainer:y,...c,open:p,footer:m,styles:{...c.styles,footer:{display:"flex",justifyContent:"flex-end",...null==(l=c.styles)?void 0:l.footer}},...g,onClose:c.onClose,children:i})});function T(){let e=r.useRef(null),t=r.useMemo(()=>o.observable.shallow({value:[]}),[]),l=r.memo(e=>{let{index:i}=e,[a,s]=r.useState(null);return(r.useEffect(()=>{(0,o.autorun)(()=>{let e=t.value;e[i]&&a!==e[i]&&s(e[i]),e[i]||s(null)})},[a,i]),a)?(0,n.jsx)(a,{children:(0,n.jsx)(l,{index:i+1})}):null});l.displayName="RenderNestedDrawer";let u=(t,l)=>{var u,c;let p,h,m=l.engine,f=r.createRef(),g=new Promise(e=>{h=e}),v=null,y=null,x=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return v=t,null==(e=f.current)||e.setFooter(t),()=>{var e;v=null,null==(e=f.current)||e.setFooter(null)}},[t]),null},w=e=>(r.useEffect(()=>{var t;return y=e,null==(t=f.current)||t.setHeader(e),()=>{var e;y=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),S=new a.cB,P=(0,F._)(l.engine),j=(0,M.eX)(m,P);S.defineProperty("engine",{value:P}),S.addDelegate(P.context),!1!==t.inheritContext?S.addDelegate(l):(S.addDelegate(l.engine.context),C(S,l));let E=!1,R={type:"drawer",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(E)return;E=!0,null==(l=t.onClose)||l.call(t),null==(n=f.current)||n.destroy(),null==p||p(),null==h||h(e);let o=null==j?void 0:j.emitter;(0,M.Z8)(o),null==o||null==(i=o.emit)||i.call(o,M.B9,{type:"drawer",viewUid:null==R||null==(r=R.inputArgs)?void 0:r.viewUid}),P.unlinkFromStack()},update:e=>{var t;return null==(t=f.current)?void 0:t.update(e)},close:async(e,l)=>{var n,r;return(!t.preventClose||!!l)&&!!await k(R,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():R.destroy(e),!0)},Footer:x,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;y=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,S)}};S.defineProperty("view",{get:()=>R,resolveOnServer:(0,d.Xx)(S,()=>(0,d.vE)(l,S))}),P.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),R.destroy()}),b(S,R);let T=r.memo((0,o.observer)(e=>{var l,o,a,s;let d=r.useRef(!1),u="function"==typeof t.content?t.content(R,S):t.content,c="string"==typeof u?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(u)}}):u;return(r.useEffect(()=>{var e;null==(e=t.onOpen)||e.call(t,R,S)},[]),(null==(o=t.inputArgs)||null==(l=o.hidden)?void 0:l.value)&&!d.current)?(0,n.jsx)(n.Fragment,{children:e.children}):(d.current=!0,(0,n.jsxs)(I,{ref:f,...t,footer:v,header:t.header||y,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{R.close(t.result)},isMobile:S.isMobileLayout,children:[c,e.children]}))}));T.displayName="DrawerWithContext";let _=r.memo(e=>{let{children:t}=e;return(0,n.jsx)(A.I6,{engine:P,children:(0,n.jsx)(s.YQ,{context:S,children:(0,n.jsx)(T,{children:t})})})});return _.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(_),Object.assign(g,R)},c=r.useMemo(()=>({open:u}),[]),p=r.memo(r.forwardRef((e,i)=>{let[o,a]=S();return r.useImperativeHandle(i,()=>({patchElement:a}),[a]),r.useEffect(()=>{t.value=o},[o]),(0,n.jsx)(l,{index:0})}));return[c,(0,n.jsx)(p,{ref:e},"drawer-holder")]}var _=l(40961),D=l(31333),N=l(71021);let O=(0,r.forwardRef)((e,t)=>{let[l,i]=r.useState({}),{visible:o=!0,footer:a=null,header:s=null,children:d,hidden:u,title:c,styles:p={},zIndex:h=4,onClose:m}={...e,...l},f=(0,r.useRef)(!1),g=(0,A.uf)(),[v,y]=(0,r.useState)(()=>a),[b,x]=(0,r.useState)(s);(0,r.useImperativeHandle)(t,()=>({destroy:()=>{f.current||(f.current=!0)},update:e=>{i(e)},setFooter:e=>{y(e)},setHeader:e=>{0===Object.values(e||{}).length?x(null):x(e)}}));let w=(0,r.useMemo)(()=>({display:u?"none":"flex",flexDirection:"column",height:"100%",zIndex:h}),[u,h]),S=(0,r.useMemo)(()=>{if(!b&&!c)return null;let{title:e=c,extra:t}=b||{},l=g.context.themeToken;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:`${l.paddingSM}px ${l.padding}px`,borderBottom:`1px solid ${l.colorSplit}`,backgroundColor:l.colorBgContainer,...p.header},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:l.marginXS},children:[(0,n.jsx)(N.Ay,{type:"text",size:"small",icon:(0,n.jsx)(D.A,{}),onClick:async()=>{f.current||!1!==await (null==m?void 0:m())&&(f.current=!0)},style:{color:l.colorTextTertiary}}),e&&(0,n.jsx)("div",{style:{fontSize:l.fontSizeLG,fontWeight:l.fontWeightStrong,color:l.colorText},children:e})]}),t&&(0,n.jsx)("div",{children:t})]})},[b,c,g.context.themeToken,p.header,m]),M=(0,r.useMemo)(()=>{if(!v)return null;let e=g.context.themeToken;return(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",padding:`${e.paddingXS}px ${e.padding}px`,borderTop:`1px solid ${e.colorSplit}`,backgroundColor:e.colorBgContainer,...p.footer},children:v})},[v,g.context.themeToken,p.footer]);return o?(0,n.jsxs)("div",{style:{...w,...p.content},children:[S,(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",...p.body},children:d}),M]}):null}),$=0,B="nocobase-embed-container",L="nocobaseEmbedReplacing";function q(e){return!!e&&"function"==typeof e.then}function V(e,t){e.dataset[L]="1";try{let l=t.close();if(q(l))return Promise.resolve(l).finally(()=>{delete e.dataset[L]});return delete e.dataset[L],l}catch(t){throw delete e.dataset[L],t}}function z(e,t,l){let n,r={},i=e.then(e=>{let{page:t}=e;return(n=t)&&("beforeClose"in r&&(n.beforeClose=r.beforeClose),"update"in r&&n.update(r.update),"footer"in r&&n.setFooter(r.footer),"header"in r&&n.setHeader(r.header),r.destroyed&&n.destroy(r.destroyed.result)),{page:t}});return Object.assign(i.then(e=>{let{page:t}=e;return!!t&&t}),{type:"embed",inputArgs:t,preventClose:l,Header:null,Footer:null,get beforeClose(){return(null==n?void 0:n.beforeClose)??r.beforeClose},set beforeClose(value){n?n.beforeClose=value:r.beforeClose=value},close:(e,t)=>i.then(l=>{let{page:n}=l;return!!n&&n.close(e,t)}),destroy:e=>{n?n.destroy(e):r.destroyed={result:e}},update:e=>{n?n.update(e):r.update={...r.update,...e}},setFooter:e=>{n?n.setFooter(e):r.footer=e},setHeader:e=>{n?n.setHeader(e):r.header=e}})}let K=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));function U(){let e=r.useRef(null),t=r.useRef(null),l=r.useRef(0),i=(i,u)=>{let{target:c,content:p,preventClose:h,inheritContext:m=!0,inputArgs:f={},onOpenCancelled:g,...v}=i,y=c instanceof HTMLElement&&c.id===B,x=()=>{var l,g,x;let w,S,P,j=null==u?void 0:u.engine;$+=1;let E=r.createRef(),R=new Promise(e=>{S=e}),I=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return null==(e=E.current)||e.setFooter(t),()=>{var e;null==(e=E.current)||e.setFooter(null)}},[t]),null},T=e=>(r.useEffect(()=>{var t;return null==(t=E.current)||t.setHeader(e),()=>{var e;null==(e=E.current)||e.setHeader(null)}},[e]),null),D=new a.cB,N=(0,F._)(u.engine),B=(0,M.eX)(j,N);D.defineProperty("engine",{value:N}),D.addDelegate(N.context),m?D.addDelegate(u):(D.addDelegate(u.engine.context),C(D,u));let q=!1,V={type:"embed",inputArgs:f,preventClose:!!i.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,o,a;if(!q){if(q=!0,null==(l=i.onClose)||l.call(i),null==S||S(e),null==(n=E.current)||n.destroy(),null==w||w(),y&&t.current===V&&(t.current=null),!(y&&c instanceof HTMLElement&&(null==(r=c.dataset)?void 0:r[L])==="1")){let e=null==B?void 0:B.emitter;(0,M.Z8)(e),null==e||null==(a=e.emit)||a.call(e,M.B9,{type:"embed",viewUid:null==V||null==(o=V.inputArgs)?void 0:o.viewUid})}N.unlinkFromStack()}},update:e=>{var t;return null==(t=E.current)?void 0:t.update(e)},close:(e,t)=>q?Promise.resolve(!0):P||(P=(async()=>{try{var l,n;if(h&&!t)return P=void 0,!1;let r=await k(V,{result:e,force:t});if(q)return!0;if(!r)return P=void 0,!1;if(i.triggerByRouter&&(null==(n=i.inputArgs)||null==(l=n.navigation)?void 0:l.back))return i.inputArgs.navigation.back(),!0;return V.destroy(e),!0}catch(e){throw q||(P=void 0),e}})()),Header:T,Footer:I,setFooter:e=>{var t;null==(t=E.current)||t.setFooter(e)},setHeader:e=>{var t;null==(t=E.current)||t.setHeader(e)},navigation:null==(l=i.inputArgs)?void 0:l.navigation,get record(){return(0,d.vE)(u,D)}};D.defineProperty("view",{get:()=>V,resolveOnServer:(0,d.Xx)(D,()=>(0,d.vE)(u,D))}),b(D,V);let z=(0,o.observer)(()=>{var e,t,l,o;let a=r.useRef(!1),s=r.useMemo(()=>"function"==typeof p?p(V,D):p,[]);return(D.themeToken,r.useEffect(()=>{var e;null==(e=i.onOpen)||e.call(i,V,D)},[]),(null==(t=i.inputArgs)||null==(e=t.hidden)?void 0:e.value)&&!a.current)?null:(a.current=!0,(0,n.jsx)(O,{ref:E,hidden:null==(o=i.inputArgs)||null==(l=o.hidden)?void 0:l.value,...v,onClose:()=>V.close(i.result),children:s}))},{displayName:"PageWithContext"}),K=(null==f?void 0:f.viewUid)||`page-${$}`,U=(0,n.jsx)(A.I6,{engine:N,children:(0,n.jsx)(s.YQ,{context:D,children:(0,n.jsx)(z,{})})},K);return w=c&&c instanceof HTMLElement?null==(g=e.current)?void 0:g.patchElement(_.createPortal(U,c,K)):null==(x=e.current)?void 0:x.patchElement(U),y&&(t.current=V),Object.assign(R,V)};if(y&&t.current){let e,n=l.current+=1,r=()=>null==g?void 0:g();try{e=V(c,t.current)}catch(e){throw r(),e}if(q(e))return z(Promise.resolve(e).then(e=>!1===e||n!==l.current?(r(),{page:null}):{page:x()},e=>{throw r(),e}),f,!!i.preventClose);if(!1===e)return r(),z(Promise.resolve({page:null}),f,!!i.preventClose)}return x()};return[r.useMemo(()=>({open:i}),[]),(0,n.jsx)(K,{ref:e},"page-holder")]}var W=l(28073);let H=0,Y=r.forwardRef((e,t)=>{var l,i;let{afterClose:o,content:a,placement:s,rect:d,...u}=e,[c,p]=r.useState(!0),[h,m]=r.useState({content:a,placement:s,rect:d,...u});return r.useImperativeHandle(t,()=>({destroy:()=>p(!1),update:e=>m(t=>({...t,...e})),close:(e,t)=>p(!1)})),r.useEffect(()=>{c||null==o||o()},[c,o]),(0,n.jsx)(W.A,{arrow:!1,open:c,trigger:["click"],destroyTooltipOnHide:!0,content:h.content,placement:h.placement,getPopupContainer:()=>document.querySelector("#nocobase-app-container")||document.body,onOpenChange:e=>{(e||!h.preventClose)&&(p(e),e||null==o||o())},...h,children:(0,n.jsx)("span",{style:{position:"absolute",top:((null==(l=h.rect)?void 0:l.top)??0)+window.scrollY,left:((null==(i=h.rect)?void 0:i.left)??0)+window.scrollX,width:0,height:0}})})});function G(){let e=r.useRef(null),t=t=>{var l,o;let a,s;H+=1;let{target:d,placement:u="rightTop",content:c,...p}=t,h=r.createRef(),m=(null==d||null==(l=d.getBoundingClientRect)?void 0:l.call(d))??{top:0,left:0},f=new Promise(e=>{s=e}),g={type:"popover",destroy:()=>{var e;return null==(e=h.current)?void 0:e.destroy()},update:e=>{var t;return null==(t=h.current)?void 0:t.update(e)},close:e=>{var t;null==s||s(e),null==(t=h.current)||t.close(e)}},v="function"==typeof c?c(g):c,y="string"==typeof v?(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:i.A.sanitize(v)}}):v,b=(0,n.jsx)(Y,{ref:h,content:y,placement:u,rect:m,afterClose:()=>{var e;null==a||a(),null==(e=t.onClose)||e.call(t),null==s||s(t.result)},...p},`popover-${H}`);return a=null==(o=e.current)?void 0:o.patchElement(b),Object.assign(f,g)},l=r.useMemo(()=>({open:t}),[]),o=r.memo(r.forwardRef((e,t)=>{let[l,i]=S();return r.useImperativeHandle(t,()=>({patchElement:i}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(o,{ref:e},"popover-holder")]}var J=l(50467),X=l(52847),Q=l(60182);function Z(e){return null==e?"":e&&"object"==typeof e&&!Array.isArray(e)?encodeURIComponent(Object.entries(e).map(e=>{let[t,l]=e;return`${encodeURIComponent(String(t))}=${encodeURIComponent(String(l))}`}).join("&")):encodeURIComponent(String(e))}function ee(e){return null!=e&&""!==String(e)}function et(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function el(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=et(t.basePath||t.prefix);if(!e||0===e.length)return l;let n=l.replace(/^\/+/,"").split("/").filter(Boolean);return e.forEach((e,t)=>{t>0&&n.push("view"),n.push(e.viewUid);let l=(0,Q.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Z(e.filterByTk);t&&n.push("filterbytk",t)}ee(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class en{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=el(this.viewStack.map((t,l)=>l===this.viewStack.length-1?{...t,...e}:{...t}),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(t,{replace:!0})}navigateTo(e,t){let l=el([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=el(this.viewStack.slice(0,-1),{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(e,{replace:!0})}getLayoutBasePath(){var e,t;let l=null==(e=this.ctx.layout)?void 0:e.routePath;return this.basePath||(null==(t=this.ctx.layoutRoute)?void 0:t.basePathname)||((null==l?void 0:l.startsWith("/"))?l:"/admin")}constructor(e,t,l={}){(0,J._)(this,"viewStack",void 0),(0,J._)(this,"ctx",void 0),(0,J._)(this,"viewParams",void 0),(0,J._)(this,"basePath",void 0),this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,X.E8)(this,{viewParams:X.sH})}}},16639(e,t,l){l.d(t,{B9:()=>r,FH:()=>s,HK:()=>i,Z8:()=>d,eX:()=>p,i6:()=>o,tb:()=>n});let n=Symbol.for("__NOCOBASE_VIEW_ACTIVATED_VERSION__"),r="view:activated",i="dataSource:dirty",o="__NOCOBASE_ENGINE_SCOPE__",a="view";function s(e){let t=Reflect.get(e,n),l="number"==typeof t?t:Number(t);return Number.isFinite(l)&&l>0?l:0}function d(e){let t=s(e);if(!Object.isExtensible(e))return t;let l=t+1;return Reflect.set(e,n,l),l}function u(e){return Reflect.get(e,o)===a}function c(e){let t=e,l=0;for(;t&&l++<50;){if(u(t))return t;t=t.previousEngine}}function p(e,t){if(!e)return;let l=c(e);return l||c(null==t?void 0:t.previousEngine)||e}},33329(e,t,l){l.d(t,{xW:()=>f,bO:()=>s,Q9:()=>m});var n=l(50467),r=l(88909),i=l(55373),o=l.n(i);let a=(e,t)=>{if(!e)return;let l="function"==typeof e.toJSON?e.toJSON():e,n=Object.keys(l||{}).find(e=>e.toLowerCase()===t.toLowerCase());return n?l[n]:void 0},s=(e,t)=>{let l=a(e,t);return null!=l&&""!==l};class d{get storagePrefix(){return this.api.storagePrefix}get locale(){return this.getLocale()}set locale(e){this.setLocale(e)}get role(){return this.getRole()}set role(e){this.setRole(e)}get token(){return this.getToken()}set token(e){this.setToken(e)}get authenticator(){return this.getAuthenticator()}set authenticator(e){this.setAuthenticator(e)}getOption(e){return this.api.storage.getItem(e)}setOption(e,t){return this.options[e]=t,this.api.storage.setItem(e,t||"")}getLocale(){return this.getOption("locale")}setLocale(e){this.setOption("locale",e)}getRole(){return this.getOption("role")}setRole(e){this.setOption("role",e)}getToken(){return this.getOption("token")}setToken(e){this.setOption("token",e),this.api.app&&this.api.app.eventBus.dispatchEvent(new CustomEvent("auth:tokenChanged",{detail:{token:e,authenticator:this.authenticator}}))}getAuthenticator(){return this.getOption("auth")}setAuthenticator(e){this.setOption("auth",e)}middleware(e){return this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!s(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!s(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`),e}async signIn(e,t){var l;let n=await this.api.request({method:"post",url:"auth:signIn",data:e,headers:{"X-Authenticator":t}}),r=null==n||null==(l=n.data)?void 0:l.data;return this.setAuthenticator(t),this.setToken(null==r?void 0:r.token),n}async signUp(e,t){return await this.api.request({method:"post",url:"auth:signUp",data:e,headers:{"X-Authenticator":t}})}async signOut(){let e=await this.api.request({method:"post",url:"auth:signOut"});return this.setToken(null),this.setRole(null),this.setAuthenticator(null),e}async lostPassword(e){let t=Object.fromEntries(new URLSearchParams(window.location.search).entries());return await this.api.request({method:"post",url:"auth:lostPassword",data:{...e,baseURL:window.location.href.split("/forgot-password")[0]},headers:{"X-Authenticator":t.name}})}async resetPassword(e){return await this.api.request({method:"post",url:"auth:resetPassword",data:e})}async checkResetToken(e){return await this.api.request({method:"post",url:"auth:checkResetToken",data:e})}constructor(e){(0,n._)(this,"api",void 0),(0,n._)(this,"options",{locale:null,role:null,authenticator:null,token:null}),this.api=e,this.api.axios.interceptors.request.use(this.middleware.bind(this))}}class u{toUpperCase(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];return e.toUpperCase()+l.map(e=>e.toUpperCase()).join("_")}constructor(){(0,n._)(this,"storagePrefix",void 0)}}class c extends u{clear(){this.items.clear()}getItem(e){return this.items.get(e)}setItem(e,t){return this.items.set(e,t)}removeItem(e){return this.items.delete(e)}constructor(...e){super(...e),(0,n._)(this,"items",new Map)}}class p extends u{clear(){return this.items.clear()}getItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.getItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.getItem(this.toUpperCase(this.storagePrefix,e))}setItem(e,t){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.setItem(this.toUpperCase(this.baseStoragePrefix,e),t):this.items.setItem(this.toUpperCase(this.storagePrefix,e),t)}removeItem(e){return this.shareToken&&"token"===e&&this.baseStoragePrefix?this.items.removeItem(this.toUpperCase(this.baseStoragePrefix,e)):this.items.removeItem(this.toUpperCase(this.storagePrefix,e))}constructor(e,t="",l=!1){super(),(0,n._)(this,"storagePrefix",void 0),(0,n._)(this,"baseStoragePrefix",void 0),(0,n._)(this,"shareToken",void 0),(0,n._)(this,"items",void 0),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.localStorage}}class h extends p{constructor(e,t="",l=!1){super(e,t,l),(0,n._)(this,"storagePrefix",void 0),(0,n._)(this,"baseStoragePrefix",void 0),(0,n._)(this,"shareToken",void 0),this.storagePrefix=e,this.baseStoragePrefix=t,this.shareToken=l,this.items=window.sessionStorage}}class m{toErrMessages(e){var t,l,n,r,i,o,a,s,d,u,c;if("u">typeof document&&"string"==typeof(null==e||null==(t=e.response)?void 0:t.data)){let t=document.createElement("div");t.innerHTML=null==e||null==(d=e.response)?void 0:d.data;let l=t.textContent||t.innerText;return l.includes("Error occurred while trying")||l.includes("502 Bad Gateway")?[{code:"APP_WARNING",message:l="The application may be starting up. Please try again later."}]:[{message:l}]}return(null==e||null==(n=e.response)||null==(l=n.data)?void 0:l.error)?[null==e||null==(c=e.response)||null==(u=c.data)?void 0:u.error]:(null==e||null==(i=e.response)||null==(r=i.data)?void 0:r.errors)||(null==e||null==(a=e.response)||null==(o=a.data)?void 0:o.messages)||(null==e||null==(s=e.response)?void 0:s.error)||[{message:e.message||"Server error"}]}getHeaders(){let e={};return this.auth.locale&&(e["X-Locale"]=this.auth.locale),this.auth.role&&(e["X-Role"]=this.auth.role),this.auth.authenticator&&(e["X-Authenticator"]=this.auth.authenticator),this.auth.token&&(e.Authorization=`Bearer ${this.auth.token}`),e}createStorage(e){return"localStorage"===e&&"u">typeof localStorage?new p(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new h(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new c}initStorage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"localStorage";if(e){this.storage=new e(this);return}this.storage=this.createStorage(t)}interceptors(){this.axios.interceptors.request.use(e=>(e.paramsSerializer=e=>o().stringify(e,{strictNullHandling:!0,arrayFormat:"brackets"}),e))}request(e){let{resource:t,resourceOf:l,action:n,params:r,headers:i}=e;return t?this.resource(t,l,i)[n](r):this.axios.request(e)}resource(e,t,l,n){return new Proxy({},{get:(r,i)=>{if(n)return;let o=e.split(".").join(`/${encodeURIComponent(t)||"_"}/`),a={url:o+=`:${i.toString()}`};return["get","list"].includes(i)?a.method="get":a.method="post",async(e,t)=>{let{values:n,filter:r,...i}=e||{};return a.params=i,r&&("string"==typeof r?a.params.filter=r:(r["*"]&&delete r["*"],a.params.filter=JSON.stringify(r))),"get"!==a.method&&(a.data=n||{}),await this.request({...a,...t,headers:l})}}})}constructor(e){if((0,n._)(this,"options",void 0),(0,n._)(this,"axios",void 0),(0,n._)(this,"auth",void 0),(0,n._)(this,"storage",void 0),(0,n._)(this,"storagePrefix","NOCOBASE_"),(0,n._)(this,"baseStoragePrefix","NOCOBASE_"),(0,n._)(this,"shareToken",!1),this.options=e,"function"==typeof e)this.axios=e;else{let{appName:t,authClass:l,storageType:n,storageClass:i,storagePrefix:o="NOCOBASE_",shareToken:a=!1,...s}=e||{};this.shareToken=a,this.baseStoragePrefix=o,this.storagePrefix=t?`${o}${t.toUpperCase()}_`:o,this.axios=r.A.create(s),this.initStorage(i,n),l&&(this.auth=new l(this))}this.storage||this.initStorage(),this.auth||(this.auth=new d(this)),this.interceptors()}}let f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";if("u"<typeof window||!window.location.pathname)return;let t=`${e}apps/`;if(window.location.pathname.startsWith(t))return window.location.pathname.substring(t.length).split("/",1)[0]||""}},40542(e,t,l){l.d(t,{D:()=>n});let n=(e,t,l)=>{if(!e)return l;let r=t.split("."),i=[],o=e,a=!1;for(let e=0;e<r.length;e++){let t=r[e];if(Array.isArray(o)){for(let t of(a=!0,o)){let o=n(t,r.slice(e).join("."),l);i=i.concat(o)}break}if((null==o?void 0:o[t])===void 0)break;o=o[t],e===r.length-1&&i.push(o)}return 0===(i=i.filter(e=>void 0!==e)).length?l:a?i.filter(e=>null!==e):i[0]}},13939(e,t,l){l.r(t),l.d(t,{getDayRange:()=>th,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>ty,str2moment:()=>eg,unflatten:()=>to,sortTree:()=>ea,generateFlowModelRdFromToken:()=>eO,forEach:()=>ek,utc2unit:()=>tf,extractUsedVariablePaths:()=>t3,getValuesByPath:()=>e$,isArray:()=>et,moment2str:()=>eb,transformLiquidContext:()=>t9,isURL:()=>tD,isPortalInBody:()=>tE,extractUsedVariableNames:()=>t8,parseHTML:()=>tR,toGmt:()=>ep,isPlainObject:()=>en,lockdownSes:()=>tC,splitPathToTwoParts:()=>tb,transformFilter:()=>G,parseSQLBindParams:()=>lt,getPickerFormat:()=>eM,nextTick:()=>ei,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eK,evaluateConditions:()=>Z,toUnit:()=>tg,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>eF,BASE_BLOCKED_IDENTIFIERS:()=>tA,toLocal:()=>eh,getDayRangeByParams:()=>L,getDefaultFormat:()=>ec,transformMultiColumnToSingleColumn:()=>t$,treeFind:()=>eo,transformSQL:()=>ll,parseFilter:()=>tp,flatten:()=>ti,isEmpty:()=>el,getOffsetRangeByParams:()=>N,offsetFromString:()=>ex,tval:()=>tP,error:()=>eQ,extractVariableUsage:()=>t4,Registry:()=>tw,lodash:()=>r(),parse:()=>eY,hasEmptyValue:()=>er,toFixedByStep:()=>e6,getDateTimeFormat:()=>eA,showToast:()=>e4,Handlebars:()=>eq(),getLiquidContext:()=>t7,merge:()=>e2,dayjs:()=>o(),parseLiquidContext:()=>le,uid:()=>t_,isString:()=>ee});var n=l(2543),r=l.n(n),i=l(74353),o=l.n(i),a=l(97375),s=l.n(a),d=l(90445),u=l.n(d),c=l(43522),p=l.n(c),h=l(37872),m=l.n(h),f=l(98867),g=l.n(f),v=l(8906),y=l.n(v),b=l(68313),x=l.n(b),w=l(21840),S=l.n(w),M=l(41816),A=l.n(M),F=l(88569),k=l.n(F),C=l(83826),P=l.n(C),j=l(8134),E=l.n(j),R=l(28623),I=l.n(R),T=l(46986),_=l.n(T);o().extend(_()),o().extend(S()),o().extend(k()),o().extend(P()),o().extend(A()),o().extend(x()),o().extend(m()),o().extend(g()),o().extend(y()),o().extend(E()),o().extend(I()),o().extend(u()),o().extend(s()),o().extend(p());let D=e=>{if(!e)return o()();if(/^[+-]\d{2}:\d{2}$/.test(e)){let[t,l,n]=e.match(/([+-])(\d{2}):(\d{2})/).slice(1),r=(60*parseInt(l)+parseInt(n))*("+"===t?1:-1);return o()().utcOffset(r)}return o()().tz(e)},N=e=>{let t,l,{type:n,unit:r="day",number:i=1,timezone:o}=e,a=D(o),s="week"===r?"isoWeek":r;if("past"===n){let e=a.startOf(s);t=e.subtract(i,r).startOf(s),l=e.subtract(1,r).endOf(s)}else if("next"===n)l=(t=a.startOf(s).add(1,r).startOf(s)).add(i-1,r).endOf(s);else throw Error(`Unsupported type: ${n}`);return[t.format("YYYY-MM-DD HH:mm:ss"),l.format("YYYY-MM-DD HH:mm:ss")]},O=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).startOf(t)},$=(e,t,l)=>{let n="isoWeek"===t?"week":t;return D(l).add(e,n).endOf(t)},B={today:e=>[O(0,"day",null==e?void 0:e.timezone),$(0,"day",null==e?void 0:e.timezone)],yesterday:e=>[O(-1,"day",null==e?void 0:e.timezone),$(-1,"day",null==e?void 0:e.timezone)],tomorrow:e=>[O(1,"day",null==e?void 0:e.timezone),$(1,"day",null==e?void 0:e.timezone)],thisWeek:e=>[O(0,"isoWeek",null==e?void 0:e.timezone),$(0,"isoWeek",null==e?void 0:e.timezone)],lastWeek:e=>[O(-1,"isoWeek",null==e?void 0:e.timezone),$(-1,"isoWeek",null==e?void 0:e.timezone)],nextWeek:e=>[O(1,"isoWeek",null==e?void 0:e.timezone),$(1,"isoWeek",null==e?void 0:e.timezone)],thisMonth:e=>[O(0,"month",null==e?void 0:e.timezone),$(0,"month",null==e?void 0:e.timezone)],lastMonth:e=>[O(-1,"month",null==e?void 0:e.timezone),$(-1,"month",null==e?void 0:e.timezone)],nextMonth:e=>[O(1,"month",null==e?void 0:e.timezone),$(1,"month",null==e?void 0:e.timezone)],thisQuarter:e=>[O(0,"quarter",null==e?void 0:e.timezone),$(0,"quarter",null==e?void 0:e.timezone)],lastQuarter:e=>[O(-1,"quarter",null==e?void 0:e.timezone),$(-1,"quarter",null==e?void 0:e.timezone)],nextQuarter:e=>[O(1,"quarter",null==e?void 0:e.timezone),$(1,"quarter",null==e?void 0:e.timezone)],thisYear:e=>[O(0,"year",null==e?void 0:e.timezone),$(0,"year",null==e?void 0:e.timezone)],lastYear:e=>[O(-1,"year",null==e?void 0:e.timezone),$(-1,"year",null==e?void 0:e.timezone)],nextYear:e=>[O(1,"year",null==e?void 0:e.timezone),$(1,"year",null==e?void 0:e.timezone)]},L=e=>{if("past"===e.type||"next"===e.type)return N(e);let t=B[e.type];if(!t)throw Error(`Unsupported type: ${e.type}`);let[l,n]=t(e);return[l.format("YYYY-MM-DD HH:mm:ss"),n.format("YYYY-MM-DD HH:mm:ss")]};var q=l(38362);class V{static graphlib(){return q}static connectedNodes(e){let t=(0,n.castArray)(e.nodes),l=(0,n.castArray)(e.excludes||[]),r=V.build(e),i=new Set;for(let e of t)for(let t of q.alg.preorder(r,e))l.includes(t)||i.add(t);return Array.from(i)}static preOrder(e){return V.graphlib().alg.preorder(V.build(e),e.node)}static build(e){let t=e.collections,l="forward"===((null==e?void 0:e.direction)||"forward"),n=new q.Graph;for(let e of t)n.setNode(e.name);for(let e of t){for(let t of e.inherits||[])l?n.setEdge(e.name,t):n.setEdge(t,e.name);for(let t of e.fields||[])if(("hasMany"===t.type||"belongsTo"===t.type||"hasOne"===t.type)&&(l?n.setEdge(e.name,t.target):n.setEdge(t.target,e.name)),"belongsToMany"===t.type){let r=t.through;l?(n.setEdge(e.name,r),n.setEdge(r,t.target)):(n.setEdge(t.target,r),n.setEdge(r,e.name))}}return n}}var z=l(81814),K=l.n(z);function U(e){return"path"in e&&"operator"in e}function W(e){return"logic"in e&&"items"in e}function H(e){let{path:t,operator:l,value:n}=e;return{[t]:{[l]:n}}}function Y(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return Y(e);throw Error("Invalid filter item type")})}}function G(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return eu(Y(e))}function J(e){if(!e||"object"!=typeof e)throw Error("Invalid filter: filter must be an object");if(!W(e))throw Error("Invalid filter: filter must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid filter: items must be an array");return e.items=e.items.filter(e=>U(e)?!!e.operator:!!W(e)&&J(e)),{...e}}function X(e,t){let{path:l,operator:n,value:r}=e;return t(l,n,r)}function Q(e,t){let{logic:l,items:n}=e;if(!n||0===n.length)return!0;let r=n.map(e=>{if(U(e))return X(e,t);if(W(e))return Q(e,t);throw Error("Invalid filter item type")});if("$and"===l)return r.every(e=>!0===e);if("$or"===l)return r.some(e=>!0===e);throw Error(`Unsupported logic operator: ${l}`)}function Z(e,t){if(!e||"object"!=typeof e)throw Error("Invalid conditions: conditions must be an object");if(!W(e))throw Error("Invalid conditions: conditions must have logic and items properties");if(!Array.isArray(e.items))throw Error("Invalid conditions: items must be an array");if("function"!=typeof t)throw Error("Invalid evaluator: evaluator must be a function");return Q(e,t)}let ee=e=>"string"==typeof e,et=e=>Array.isArray(e),el=e=>en(e)?0===Object.keys(e).length:!!Array.isArray(e)&&0===e.length,en=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;let t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},er=e=>{let t=!0;for(let l in e){if(t=!1,et(e[l])&&0===e[l].length||!e[l])return!0;if(en(e[l])||et(e[l]))return er(e[l])}return t},ei=e=>{setTimeout(e)};function eo(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return;let{childrenKey:n="children"}=l;for(let r of Array.isArray(e)?[...e]:[e]){if(t(r))return r;let e="function"==typeof n?n(r):r[n];if(Array.isArray(e)&&e.length>0){let n=eo(e,t,l);if(void 0!==n)return n}}}function ea(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"children",n=!(arguments.length>3)||void 0===arguments[3]||arguments[3];return e&&Array.isArray(e)&&0!==e.length?r().orderBy(e,t,n?"asc":"desc").map(e=>e[l]&&e[l].length>0?{...e,[l]:ea(e[l],t,l,n)}:e):e}function es(e){return new Promise(t=>{setTimeout(t,e)})}function ed(e){return!!(!e||"$and"in e&&r().isEmpty(e.$and)||"$or"in e&&r().isEmpty(e.$or))}let eu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:K(),l=t(e||{}),n={};for(let e in l){let t=l[e];null==t||el(t)||""===t||(n[e]=t)}let i=t.unflatten(n);for(let e in i)Array.isArray(i[e])&&(i[e]=i[e].filter(e=>null!=e));return r().isEmpty(i)?void 0:i},ec=e=>e.format?e.format:e.dateFormat?e.showTime?`${e.dateFormat} ${e.timeFormat||"HH:mm:ss"}`:e.dateFormat:"month"===e.picker?"YYYY-MM":"quarter"===e.picker?"YYYY-\\QQ":"year"===e.picker?"YYYY":"week"===e.picker?"YYYY[W]W":e.showTime?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD",ep=e=>e&&o().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,eh=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):o().isDayjs(e)?e.startOf("second").toISOString():void 0:e,em=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return o()().quarter(l).year(t)}catch(e){return null}},ef=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:r,utc:i=!0,dateOnly:a}=t;if(!o()(e).isValid())return em(e);if(a){let t=o()(e);if(!t.isValid())return e;let l=t.format("YYYY-MM-DD");return o().utc(l,"YYYY-MM-DD")}return i?o().isDayjs(e)?l?e.utcOffset(ex(l)):e:n?o()(e).utcOffset(0):l?o()(e).utcOffset(ex(l)):o()(e):o()(e)},eg=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ef(e,t)):e?ef(e,t):e},ev=(e,t)=>"year"===t?e.format("YYYY")+"-01-01T00:00:00.000Z":"month"===t||"quarter"===t?e.format("YYYY-MM")+"-01T00:00:00.000Z":e.format("YYYY-MM-DD")+"T00:00:00.000Z",ey=(e,t)=>e?Array.isArray(e)?e.map(e=>ev(e,t)):o().isDayjs(e)?ev(e,t):void 0:e,eb=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:r}=t;return e?l?n?ep(e):eh(e):ey(e,r):e};function ex(e){if(!r().isString(e))return e;let t=/([+-]|\d\d)/gi,l=/Z|[+-]\d\d(?::?\d\d)?/gi,n=/[+-]?\d+(\.\d{1,3})?/,i=(e||"").match(l);if(null===i&&(i=(e||"").match(n)),null===i)return null;let o=((i[i.length-1]||[])+"").match(t)||["-",0,0],a=+(60*Number(o[1]))+ew(o[2]);return 0===a?0:"+"===o[0]?a:-a}function ew(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eS(t)),l}function eS(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eM=e=>{switch(e){case"week":return"YYYY[W]W";case"month":return"YYYY-MM";case"quarter":return"YYYY[Q]Q";case"year":return"YYYY";default:return"YYYY-MM-DD"}},eA=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function eF(e){return/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(e)?"YYYY-MM-DD HH:mm:ss":/^\d{4}-\d{2}-\d{2}$/.test(e)?"YYYY-MM-DD":/^\d{4}-\d{2}$/.test(e)?"YYYY-MM":/^\d{4}$/.test(e)?"YYYY":/^\d{4}Q[1-4]$/.test(e)?"YYYY[Q]Q":/^\d{4}-\d{2}-\d{2}T/.test(e)?"YYYY-MM-DDTHH:mm:ss.SSSZ":null}let ek=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})};var eC=l(48287).Buffer;let eP=new Map;function ej(e){return"function"==typeof btoa?btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):eC.from(e,"binary").toString("base64url")}function eE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),l=t.padEnd(t.length+(4-t.length%4)%4,"=");return"function"==typeof atob?atob(l):eC.from(l,"base64").toString("binary")}function eR(e){let t=0x811c9dc5;for(let l=0;l<e.length;l+=1)t^=e.charCodeAt(l),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)}function eI(e,t){if(!t)return"";let l="";for(let n=0;n<e.length;n+=1)l+=String.fromCharCode(e.charCodeAt(n)^t.charCodeAt(n%t.length));return l}function eT(e){if(!e||"string"!=typeof e)return null;let t=e.split(".");if(t.length<2)return null;try{return JSON.parse(eE(t[1]))}catch{return null}}function e_(e){let t=null==e?void 0:e.userId,l=(null==e?void 0:e.signInTime)||(null==e?void 0:e.jti);return"string"!=typeof t&&"number"!=typeof t||"string"!=typeof l&&"number"!=typeof l?"":`${t}:${l}`}function eD(e){return e_(eT(e))}function eN(e,t){if("string"!=typeof e&&"number"!=typeof e||!t)return;let l=String(e),n=`${t}
|
|
1706
|
+
${l}`,r=eP.get(n);if(r)return r;let i=ej(eI(l,eR(`mask:v1:${t}`))),o=eR(`check:v1:${t}:${l}`),a=`v1.${i}.${o}`;return eP.set(n,a),a}function eO(e,t){return eN(e,eD(t))}let e$=(e,t,l)=>{if(!e)return l;let n=t.split("."),r=[],i=e,o=!1;for(let e=0;e<n.length;e++){let t=n[e];if(Array.isArray(i)){for(let t of(o=!0,i)){let i=e$(t,n.slice(e).join("."),l);r=r.concat(i)}break}if((null==i?void 0:i[t])===void 0)break;i=i[t],e===n.length-1&&r.push(i)}return 0===(r=r.filter(e=>void 0!==e)).length?l:o?r.filter(e=>null!==e):r[0]};var eB=l(88835),eL=l(60639),eq=l.n(eL),eV=l(79441);let ez=l.n(eV)()();function eK(e){if(!e)return!1;let t=[e.$and,e.$or].filter(Boolean);return 0==t.length?Object.keys(e).length>0:t.some(e=>{if(Array.isArray(e))return e.some(eK);if(e.$and||e.$or)return eK(e);let[t]=Object.keys(e);if(!t||!e[t])return!1;let[l]=Object.keys(e[t]);return!!l&&void 0!==e[t][l]})}function eU(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eW(e){let t=e.substr(2,e.length-4).trim(),l=t.indexOf(":");return -1!==l?{key:t.substr(0,l),defaultValue:t.substr(l+1)}:{key:t}}function eH(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eY(e){switch(eU(e)){case"string":return eG(e);case"object":return eJ(e);case"array":return eX(e);default:return eH(function(){return e},[])}}Object.keys(ez).forEach(function(e){eq().registerHelper(e,ez[e])}),eq().registerHelper("json",function(e){return JSON.stringify(e)}),eq().registerHelper("urlParse",function(e){try{return JSON.stringify(eB.parse(e))}catch(t){return`Invalid URL: ${e}`}}),eq().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?o()(e).tz(l).format(t):o()(e).format(t)),eq().registerHelper("isNull",e=>r().isNull(e));let eG=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],r=e=>t,i=t.match(e);return i&&(l=i.map(eW),r=e=>(e=e||{},i.reduce((r,o,a)=>{let s=l[a],d=(0,n.get)(e,s.key);return(void 0===d&&(d=s.defaultValue),"function"==typeof d&&(d=d()),1===i.length&&t.startsWith("{{")&&t.endsWith("}}"))?d:(d instanceof Date&&(d=d.toISOString()),r.replace(o,null==d?"":d))},t))),eH(r,l)}})();function eJ(e){let t=Object.keys(e).map(t=>({keyTemplate:eG(t),valueTemplate:eY(e[t])}));return eH(e=>t.reduce((t,l)=>(t[l.keyTemplate(e)]=l.valueTemplate(e),t),{}),t.reduce((e,t)=>e.concat(t.valueTemplate.parameters,t.keyTemplate.parameters),[]))}function eX(e){let t=e.map(eY);return eH(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let eQ=function(e){for(var t=arguments.length,l=Array(t>1?t-1:0),n=1;n<t;n++)l[n-1]=arguments[n];console.error(e,...l)};var eZ=l(14744),e0=l.n(eZ);let e1=(e,t,l)=>t;function e2(e,t,l){return e0()(e,t,{arrayMerge:e1,...l})}var e5=l(76511);let e4=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;e5.Ay[t]({message:e,duration:l})};var e8=l(5062),e3=l(85738);function e6(e,t){if(null==e||""===e)return"";let l=(0,e8.i5)(t);return(0,e3.Mg)(String(e),".",l)}var e9=l(63560),e7=l.n(e9),te=l(95093),tt=l.n(te);let tl=/^\s*\{\{([\s\S]*)\}\}\s*$/;function tn(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function tr(e){return e}function ti(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,i=t.transformKey||tr,o=t.transformValue||tr,a={};function s(e,d,u){u=u||1,r().isObjectLike(e)&&Object.keys(e).forEach(function(r){var c;let p=e[r],h=t.safe&&Array.isArray(p),m=Object.prototype.toString.call(p),f=tn(p),g="[object Object]"===m||"[object Array]"===m,v=d?d+l+i(r):i(r);if(null==(c=t.breakOn)?void 0:c.call(t,{key:r,value:p,path:v})){a[v]=o(p,v);return}if(!h&&!f&&g&&Object.keys(p).length&&(!t.maxDepth||u<n))return s(p,v,u+1);a[v]=o(p,v)})}return s(e),a}function to(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||tr;for(let t of Object.keys(e))e7()(l,t,n(e[t],t));return l}let ta=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},ts=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function td(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tu(e){return(null==e?void 0:e.type)==="dateOnly"||(null==e?void 0:e.type)==="datetimeNoTz"||(null==e?void 0:e.constructor.name)==="DateOnlyField"||(null==e?void 0:e.constructor.name)==="DatetimeNoTzField"}let tc=(e,t)=>e?(e.type&&(e=L({...e,timezone:t})),Array.isArray(e))?(2===e.length?e.push("[]",t):3===e.length&&e.push(t),e):"string"==typeof e?!t||/(\+|-)\d\d:\d\d$/.test(e)?e:e+t:td(e)?e.toISOString():void 0:null,tp=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=new Set,n=t.vars||{},r=t.timezone,i=t.now,o=t.getField,a=ti(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=tl.exec(e);if(t){let e=t[1].trim();e.startsWith("$user")&&l.add(e.substring(6))}return e}});if(l.size>0){let e=await n.$user({fields:[...l.values()]});Object.assign(n,{$user:e})}return to(a,{transformValue(e,t){let{operator:l}=ta(t);if("string"==typeof e){let a=tl.exec(e);if(a){let s=e$(n,a[1].trim(),null),d=null==o?void 0:o(t);e="function"==typeof s?null==s?void 0:s({field:d,operator:l,timezone:r,now:i}):s}}if(ts(l)){let l=null==o?void 0:o(t);return tu(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||r}):e:tc(e,(null==l?void 0:l.timezone)||r)}return e}})};function th(e){let{now:t,timezone:l="+00:00",offset:n}=e,r=tm(t).utcOffset(ex(l));return n>0?[(r=r.add(1,"day").startOf("day")).format("YYYY-MM-DD"),r.clone().add(n,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]:[r.clone().subtract(-1*n-1,"day").startOf("day").format("YYYY-MM-DD"),r.clone().add(1,"day").startOf("day").format("YYYY-MM-DD"),"[)",l]}function tm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?o().isDayjs(e)?e:t?tt()(e):o()(e):t?tt()():o()()}function tf(e){var t;let{now:l,unit:n,timezone:r="+00:00",offset:i}=e,o=tm(l,"isoWeek"===n);o=(o=o.utcOffset(ex(r))).startOf(n),i>0?o=o.add(i,n):i<0&&(o=o.subtract(-1*i,n));let a={year:()=>o.format("YYYY"),quarter:()=>o.format("YYYY[Q]Q"),month:()=>o.format("YYYY-MM"),week:()=>o.format("gggg[w]ww"),isoWeek:()=>o.format("GGGG[W]WW"),day:()=>o.format("YYYY-MM-DD")},s=null==(t=a[n])?void 0:t.call(a);return r?s+r:s}let tg=(e,t)=>l=>{let{now:n,timezone:r,field:i}=l;return(null==i?void 0:i.timezone)&&(r=null==i?void 0:i.timezone),tf({now:n,timezone:r,unit:e,offset:t})},tv=e=>t=>{let{now:l,timezone:n,field:r}=t;return(null==r?void 0:r.timezone)&&(n=null==r?void 0:r.timezone),th({now:l,timezone:n,offset:e})};function ty(){return{now:new Date().toISOString(),today:tg("day"),yesterday:tg("day",-1),tomorrow:tg("day",1),thisWeek:tg("week"),lastWeek:tg("week",-1),nextWeek:tg("week",1),thisIsoWeek:tg("isoWeek"),lastIsoWeek:tg("isoWeek",-1),nextIsoWeek:tg("isoWeek",1),thisMonth:tg("month"),lastMonth:tg("month",-1),nextMonth:tg("month",1),thisQuarter:tg("quarter"),lastQuarter:tg("quarter",-1),nextQuarter:tg("quarter",1),thisYear:tg("year"),lastYear:tg("year",-1),nextYear:tg("year",1),last7Days:tv(-7),next7Days:tv(7),last30Days:tv(-30),next30Days:tv(30),last90Days:tv(-90),next90Days:tv(90)}}function tb(e){let t=e.split(".");return[t.shift(),t.join(".")]}var tx=l(50467);class tw{register(e,t){if(!this.options.override&&this.map.has(e))throw Error(`this registry does not allow to override existing keys: "${e}"`);this.map.set(e,t)}get(e){return this.map.get(e)}getKeys(){return this.map.keys()}getValues(){return this.map.values()}getEntities(){return this.map.entries()}constructor(e={override:!1}){(0,tx._)(this,"map",new Map),(0,tx._)(this,"options",void 0),this.options=e}}l(67980);let tS=Symbol.for("nocobase.utils.sesLockdown"),tM=Symbol.for("nocobase.utils.bufferOverrides"),tA=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tF(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tk(){let e=globalThis;if(e[tM])return;let t=e.Buffer;if(!t||!t.prototype)return;let l=t.prototype;for(let e of Reflect.ownKeys(l)){let t=Object.getOwnPropertyDescriptor(l,e);if(!t||"function"!=typeof t.value||!t.configurable)continue;let n=t.value,r=function(){return n},i=function(t){if(this===l)throw TypeError(`Cannot assign to read only property '${String(e)}' of object 'Buffer.prototype'`);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,writable:!0,value:t})};Object.defineProperty(r,"originalValue",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(l,e,{configurable:t.configurable,enumerable:t.enumerable,get:r,set:i})}e[tM]=!0}function tC(e){tk();let t=globalThis;if(!t[tS]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tF(e))throw e}t[tS]=!0}}function tP(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tj=l(65606);let tE=e=>{for(;e;){var t;if("root"===e.id||(null==(t=e.classList)?void 0:t.contains("nb-action")))return!1;e=e.parentNode}return!tj.env.__TEST__};function tR(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tI=36,tT="";for(;tI--;)tT+=tI.toString(36);function t_(e){let t="",l=e||11;for(;l--;)t+=tT[36*Math.random()|0];return t}function tD(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tN=l(27153),tO="2.1.38";let t$=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=t$(e.properties[l],t)}),e;let l=e.parent;e=e.toJSON?e.toJSON():r().cloneDeep(e);let n={},{properties:i={}}=e,o=0;if(Object.keys(i).forEach((e,l)=>{let a=i[e];if("Grid.Row"!==a["x-component"]){a["x-index"]=++o,n[e]=a;return}if(a.properties){if(1===Object.keys(a.properties).length){a["x-index"]=++o,n[e]=a;return}Object.keys(a.properties).forEach((l,i)=>{let s=a.properties[l];if(r().set(s,"x-component-props.width",100),0===i){a["x-index"]=++o,n[e]=a;return}null!=t&&t(s)||(delete a.properties[l],n[`${t_()}_${l}`]=tB(s,l,++o))})}}),e.properties=n,l){let t=new tN.S(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tB(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tO,"x-uid":t_(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tL(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function tq(e){return!!e&&/[a-zA-Z_$]/.test(e)}function tV(e){return!!e&&/[a-zA-Z0-9_$]/.test(e)}function tz(e,t){let l=t;for(;/\s/.test(e[l]||"");)l+=1;return l}function tK(e,t){let l=tz(e,t);for(;"!"===e[l];)l=tz(e,l+1);return l}function tU(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]||"");)l-=1;return l}function tW(e,t){let l=tU(e,t-1);if("("!==e[l])return!1;let n=tU(e,l-1);if(n<0)return!0;let r=e[n];return!tV(r)&&")"!==r&&"]"!==r}function tH(e,t){let l=tz(e,t);if(")"!==e[l])return!1;let n=tz(e,l+1);return"."===e[n]||"["===e[n]||e.startsWith("?.",n)}function tY(e,t){if(!tq(e[t]))return null;let l=t+1;for(;tV(e[l]);)l+=1;return{value:e.slice(t,l),next:l}}function tG(e,t){let l=e.slice(t).match(/^\d+/);return l?{value:l[0],next:t+l[0].length}:null}function tJ(e,t){let l=e[t];if('"'!==l&&"'"!==l)return null;let n=t+1,r="";for(;n<e.length;){let t=e[n];if("\\"===t){r+=e.slice(n,n+2),n+=2;continue}if(t===l)return{value:r,next:n+1};r+=t,n+=1}return null}function tX(e,t){let l=tz(e,t+1),n=tJ(e,l);if(n)return(l=tz(e,n.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"property",next:l+1,value:n.value};let r=tG(e,l);return r?(l=tz(e,r.next),"]"!==e[l])?{dynamic:!0}:{dynamic:!1,kind:"index",next:l+1,value:r.value}:{dynamic:!0}}function tQ(e,t,l){if("property"===t)return void e.push(l);if(e.length){e[e.length-1]=`${e[e.length-1]}[${l}]`;return}e.push(`[${l}]`)}function tZ(e,t){let l=tK(e,t);if("["===e[l])return tX(e,l);if(e.startsWith("?.",l)){let t=tz(e,l+2);if("["===e[t])return tX(e,t);let n=tY(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}if("."===e[l]){let t=tz(e,l+1),n=tY(e,t)||tG(e,t);return n?{dynamic:!1,kind:"property",next:n.next,value:n.value}:null}return null}function t0(e){let t=e.trim(),l="(?:[a-zA-Z_$][a-zA-Z0-9_$-]*|\\d+)",n=t.match(RegExp(`^ctx\\.([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\\.(${l}(?:\\.${l})*))?$`));return n?{methodCall:!1,path:n[2]||void 0,unsupportedDynamicPath:!1,varName:n[1]}:null}function t1(e,t){if("ctx"!==e.slice(t,t+3)||tV(e[t-1])||tV(e[t+3]))return null;if(tW(e,t))return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};let l=tZ(e,t+3);if(!l)return null;if(l.dynamic)return{next:t+3,reference:{methodCall:!1,unsupportedDynamicPath:!0,varName:""}};if("property"!==l.kind)return null;let n=[],r=l.next,i=!1,o=!1;for(;r<e.length;){let t=tK(e,r);if(("("===e[t]||e.startsWith("?.(",t))&&!n.length){i=!0,r=t;break}let l=tZ(e,r);if(!l){r=t,("["===e[t]||"."===e[t]||e.startsWith("?.",t))&&(o=!0);break}if(l.dynamic){o=!0,r=t;break}tQ(n,l.kind,l.value),r=l.next}let a=n.join(".");return{next:Math.max(r,l.next),reference:{methodCall:i,path:a||void 0,unsupportedDynamicPath:o||tH(e,r),varName:l.value}}}function t2(e){let t=t0(e);if(t)return[t];let l=[];for(let t=0;t<e.length;t+=1){if("ctx"!==e.slice(t,t+3))continue;let n=t1(e,t);n&&(l.push(n.reference),t=Math.max(t,n.next-1))}return l}function t5(e,t,l,n){e[t]=e[t]||[],l?e[t].push(l):n&&!e[t].includes("")&&e[t].push("")}function t4(e){let t={},l=!1,n=e=>{for(let n of t2(e)){if(n.unsupportedDynamicPath){l=!0;continue}n.varName&&t5(t,n.varName,n.path,n.methodCall)}},r=e=>{if("string"==typeof e){let t,l=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(t=l.exec(e));)n(t[1]);return}Array.isArray(e)?e.forEach(r):tL(e)&&Object.values(e).forEach(r)};return r(e),{unsupportedDynamicPath:l,usage:t}}function t8(e){return new Set(Object.keys(t4(e).usage))}function t3(e){return t4(e).usage}let t6=new(l(23155)).HX;function t9(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={};for(let l of e){let e=l.replace(/^ctx\./,"").split("."),n=t;for(let t=0;t<e.length;t++){let r=e[t];t===e.length-1?n[r]=`{{${l}}}`:(n[r]=n[r]||{},n=n[r])}}return t}async function t7(e){return t9(await t6.fullVariables(e))}async function le(e,t){return await t6.parseAndRender(e,{ctx:t})}function lt(e){let t=1,l={};return{sql:e.replace(/{{\s*([^}]+)\s*}}/g,(e,n)=>{let r=`__var${t}`;return l[r]=`{{${n.trim()}}}`,t++,`$${r}`}),bind:l}}async function ll(e){let{sql:t,bind:l}=lt(e),n=await t7(t);return{sql:t,bind:l,liquidContext:n}}},59598(){},23005(){},14892(){},2813(){},9845(){}};import{__webpack_require__}from"./runtime-72080663.js";var __webpack_exec__=function(e){return __webpack_require__(__webpack_require__.s=e)};import*as __rspack_chunk_1 from"./vendor-antd-ecosystem-de737eca.js";__webpack_require__.C(__rspack_chunk_1);import*as __rspack_chunk_2 from"./vendor-moment-84b317dc.js";__webpack_require__.C(__rspack_chunk_2);import*as __rspack_chunk_3 from"./vendor-lodash-905dd3b8.js";__webpack_require__.C(__rspack_chunk_3);import*as __rspack_chunk_4 from"./vendor-ses-b7bccbcd.js";__webpack_require__.C(__rspack_chunk_4);import*as __rspack_chunk_5 from"./vendor-antd-icons-97ed2369.js";__webpack_require__.C(__rspack_chunk_5);import*as __rspack_chunk_6 from"./vendor-antd-e1ec510b.js";__webpack_require__.C(__rspack_chunk_6);import*as __rspack_chunk_7 from"./8384-1634db4d.js";__webpack_require__.C(__rspack_chunk_7);import*as __rspack_chunk_8 from"./index-5460cca0.js";__webpack_require__.C(__rspack_chunk_8),__webpack_exec__(35963);
|