@nocobase/app 3.0.0-alpha.4 → 3.0.0-alpha.6

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.
@@ -1,4 +1,4 @@
1
- /*! For license information please see index-8ecef45a.js.LICENSE.txt */
1
+ /*! For license information please see index-97731b94.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},38835(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:()=>oh,evaluators:()=>oc,getOptions:()=>op});var g={};l.r(g),l.d(g,{array:()=>oN,bigField:()=>oW,boolean:()=>oz,collection:()=>oU,datetime:()=>o$,enumType:()=>oq,id:()=>oL,number:()=>oB,object:()=>oO,string:()=>oD,tableoid:()=>oK,time:()=>oV});var v={};l.r(v),l.d(v,{connectFields:()=>mk,customizeFilterRender:()=>mN,defaultOperator:()=>mT,operatorComponentProps:()=>m$});var y={};l.r(y),l.d(y,{ASSIGN_FIELD_VALUES_STEP_KEY:()=>u7.zL,ActionGroupModel:()=>dA,ActionModel:()=>dk.S0,ActionSceneEnum:()=>dk.s5,ActionWithoutPermission:()=>dk._T,AddChildActionModel:()=>cP,AddNewActionModel:()=>uB,AssignFormGridModel:()=>c_,AssignFormItemModel:()=>c5,AssignFormModel:()=>cR,AssociateActionModel:()=>uY,AssociationFieldGroupModel:()=>dC,AssociationFieldModel:()=>pd,BasePageTabModel:()=>uR,BlockGridModel:()=>ui,BlockModel:()=>uo.z,BlockSceneEnum:()=>uo.P,BulkDeleteActionModel:()=>uJ,CascadeSelectFieldModel:()=>vJ,CascadeSelectInnerFieldModel:()=>vG,CascadeSelectListFieldModel:()=>vX,CheckboxFieldModel:()=>yf,CheckboxGroupFieldModel:()=>yg,ChildPageModel:()=>uw,ChildPageTabModel:()=>uI,ClickableFieldModel:()=>vD,CollectionActionGroupModel:()=>dM,CollectionActionModel:()=>ua.U,CollectionBlockModel:()=>us.t,CollectionSelectorFieldModel:()=>yb,ColorFieldModel:()=>yS,CommonItemModel:()=>ud,CreateContent:()=>pD,CreateFormModel:()=>mL,CustomWidth:()=>fO,DataBlockModel:()=>uu.R,DateOnlyFieldModel:()=>y_,DateOnlyFilterFieldModel:()=>pJ,DateOnlyPicker:()=>yI,DateTimeFilterFieldModel:()=>pG,DateTimeNoTzFieldModel:()=>yN,DateTimeNoTzFilterFieldModel:()=>pQ,DateTimeNoTzPicker:()=>yD,DateTimeTzFieldModel:()=>yL,DateTimeTzFilterFieldModel:()=>p0,DateTimeTzPicker:()=>yB,DeleteActionModel:()=>uX,DetailsAssociationFieldGroupModel:()=>c4,DetailsBlockModel:()=>c9,DetailsCustomItemModel:()=>pe,DetailsGridModel:()=>pt,DetailsItemModel:()=>cz,DetailsJSFieldItemModel:()=>po,DisassociateActionModel:()=>uQ,DisplayCheckboxFieldModel:()=>xE,DisplayColorFieldModel:()=>b7,DisplayDateTimeFieldModel:()=>xl,DisplayEnumFieldModel:()=>xo,DisplayHtmlFieldModel:()=>xs,DisplayIconFieldModel:()=>xd,DisplayJSONFieldModel:()=>xp,DisplayNumberFieldModel:()=>xS,DisplayPasswordFieldModel:()=>xM,DisplayPercentFieldModel:()=>xF,DisplaySubItemFieldModel:()=>b4,DisplaySubListFieldModel:()=>b9,DisplaySubTableFieldModel:()=>b5,DisplayTextFieldModel:()=>xk,DisplayTimeFieldModel:()=>xP,DisplayTitleFieldModel:()=>bQ,DisplayURLFieldModel:()=>xC,DividerItemModel:()=>bK,EditActionModel:()=>uZ,EditFormContent:()=>v9,EditFormModel:()=>cK.EditFormModel,ExpandCollapseActionModel:()=>cF,FieldDeletePlaceholder:()=>fI,FieldModel:()=>sh.o,FieldModelSelect:()=>hn,FieldOperatorSelect:()=>hw,FilterActionModel:()=>u2,FilterBlockModel:()=>uc,FilterFormActionGroupModel:()=>hO,FilterFormActionModel:()=>hN,FilterFormBlockModel:()=>h9,FilterFormCollapseActionModel:()=>mn,FilterFormCustomFieldModel:()=>hC,FilterFormCustomItemModel:()=>hS,FilterFormCustomRecordSelectFieldModel:()=>hD,FilterFormFieldModel:()=>pa,FilterFormGridModel:()=>mb,FilterFormItemModel:()=>my,FilterFormJSActionModel:()=>mx,FilterFormRecordSelectFieldModel:()=>pW,FilterFormResetActionModel:()=>mw,FilterFormSubmitActionModel:()=>mS,FilterManager:()=>dW,FormActionGroupModel:()=>cn,FormActionModel:()=>ct,FormAssociationFieldGroupModel:()=>m5,FormAssociationItemModel:()=>m7,FormBlockContent:()=>cE.JU,FormBlockModel:()=>cE.F4,FormComponent:()=>cE.s2,FormCustomItemModel:()=>mq,FormGridModel:()=>cT,FormItemModel:()=>cJ,FormJSFieldItemModel:()=>mV,FormModel:()=>cE.mO,FormSubmitActionModel:()=>cl,GRID_FLOW_KEY:()=>d4,GRID_STEP:()=>d8,GridModel:()=>d7,IconFieldModel:()=>yU,InputFieldModel:()=>yW.m,InputNumberField:()=>y4,JSActionModel:()=>u6,JSBlockModel:()=>fu,JSCollectionActionModel:()=>u9,JSColumnModel:()=>gx,JSEditableFieldModel:()=>bL,JSFieldModel:()=>bP,JSFormActionModel:()=>mz,JSItemActionModel:()=>cs,JSItemModel:()=>bJ,JSRecordActionModel:()=>cd,JsonFieldModel:()=>n,JsonInput:()=>y0,LinkActionModel:()=>cM,MainPageModel:()=>uM,MarkdownItemModel:()=>bY,NBColorPicker:()=>yw,NumberFieldModel:()=>y8,ObjectNester:()=>vy,PageModel:()=>ub,PageTabModel:()=>u_,PasswordFieldModel:()=>y3,PercentFieldModel:()=>be,PercentInput:()=>y7,PluginSettingsTopbarActionModel:()=>rl,PopupActionModel:()=>uO,PopupCollectionActionModel:()=>cu,PopupSubTableActionGroupModel:()=>ys,PopupSubTableActionsColumnModel:()=>yc,PopupSubTableEditActionModel:()=>ye,PopupSubTableFieldModel:()=>yo,PopupSubTableFormActionGroupModel:()=>co,PopupSubTableFormModel:()=>yp,PopupSubTableFormSubmitActionModel:()=>ci,PopupSubTableRemoveActionModel:()=>ya,QUICK_EDIT_FORM_MAX_HEIGHT:()=>mU,QUICK_EDIT_MARKDOWN_HEIGHT:()=>mW,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>mK,QuickEditFormModel:()=>m2,RadioGroupFieldModel:()=>bt,RecordActionGroupModel:()=>dF,RecordActionModel:()=>u$.L,RecordPickerContent:()=>gH,RecordPickerFieldModel:()=>gY,RecordSelectFieldModel:()=>pL,RefreshActionModel:()=>cc,RichTextField:()=>bu,RichTextFieldModel:()=>r,RootPageModel:()=>uD,RootPageTabModel:()=>uT,RouteModel:()=>eg,SelectFieldModel:()=>bv,SourceCascader:()=>hM,SubFormFieldModel:()=>vb,SubFormListFieldModel:()=>vw,SubPageModel:()=>uN,SubTableColumnModel:()=>vo,SubTableFieldModel:()=>vf,SubTableRecordAction:()=>v7,TABLE_COLUMN_MIN_WIDTH:()=>fD,TableActionsColumnModel:()=>fW,TableAssociationFieldGroupModel:()=>fH,TableBlockModel:()=>gu,TableColumnModel:()=>fB,TableCustomColumnModel:()=>fL,TableJSFieldItemModel:()=>gy,TableSelectModel:()=>gv,TextareaFieldModel:()=>i,TimeFieldModel:()=>bF,TopbarActionModel:()=>n3,UIEditorTopbarActionModel:()=>rt,USER_CENTER_ACTION_ID:()=>rn,UnitConversion:()=>xA,UpdateRecordActionModel:()=>cv,UserCenterActionItemModel:()=>rp,UserCenterItemModel:()=>ru,UserCenterSelectItemModel:()=>rh,UserCenterTextItemModel:()=>rc,UserCenterTopbarActionModel:()=>rb,VariableFieldFormModel:()=>bk,ViewActionModel:()=>cy,applyAssociateAction:()=>uW,applyClickToOpenProps:()=>vT,applyClickToOpenSetting:()=>v_,applyDisassociateAction:()=>uU,buildDisplayPathFromValue:()=>vV,buildRecordPickerParentItemContext:()=>gz,buildRecordPickerPopupContextInputArgs:()=>gU,canRecordPickerSelectMultiple:()=>gN,collectAssociationHydrationCandidates:()=>pE,collectCascadeHydrationCandidate:()=>vL,connectFields:()=>mk,createAssignFieldValuesStep:()=>u7.KW,createAssignFormSubModelOptions:()=>u7.nF,customizeFilterRender:()=>mN,defaultOperator:()=>mT,findOptionPathByTk:()=>vz,formatNumber:()=>xx,getAllDataModels:()=>dL,getAssignFieldValuesDefaultParams:()=>u7.Z1,getAssociationBlockResourceSettings:()=>uL,getAssociationHydrationNamePath:()=>pR,getAssociationHydrationSetterContext:()=>pT,getAssociationSelectAssociatedRecordsFilter:()=>gg,getAssociationSelectForeignKeyFilter:()=>gf,getAssociationSelectorContextInputArgs:()=>uz,getAssociationTargetResourceSettings:()=>uV,getDefaultOperator:()=>d$,getDetailsItemValue:()=>cq,getDisplayNumber:()=>xw,getFilterFormOperatorList:()=>dN,getFilterFormOperatorMeta:()=>dO,getQuickEditFieldProps:()=>mQ,getRecordPickerClearedValue:()=>gL,getRecordPickerEmptyValue:()=>gB,getTopbarPluginSettingsItems:()=>n8,getValueWithIndex:()=>cL,injectRecordPickerPopupContext:()=>gK,isAssociationBlockContext:()=>uq,isFilterValueEmpty:()=>dB,joinUrlSearch:()=>cx,markCascadeHydrationDone:()=>vq,mergeAssignFieldValues:()=>u7.GO,normalizeRecordPickerSelectedRows:()=>g$,normalizeRecordPickerValue:()=>gq,normalizeTableColumnWidth:()=>fN,operatorComponentProps:()=>m$,recalculateGridSizes:()=>ut,refreshClickToOpenRuntime:()=>vI,resolveAssignFieldValues:()=>u7.eu,resolveCustomFieldOperatorList:()=>hy,resolveDefaultCustomFieldOperator:()=>hb,shouldClearRecordPickerValueOnMultipleChange:()=>gO,tableRowActionsClassName:()=>fz,toOperatorSelectOptions:()=>hx,transformNestedData:()=>vP,transformRowsToSingleColumn:()=>ue});var b={};l.r(b),l.d(b,{aclCheck:()=>wb,aclCheckRefresh:()=>wM,actionLinkageRules:()=>Ag,afterSuccess:()=>su,blockHeight:()=>Sh,blockLinkageRules:()=>Af,confirm:()=>sc,customVariable:()=>xX,dataLoadingMode:()=>wc,dataScope:()=>dx,dateRangeLimit:()=>ws,dateTimeFormat:()=>wi,detailsFieldLinkageRules:()=>Aw,displayFieldComponent:()=>wg,fieldComponent:()=>wv,fieldLinkageRules:()=>Ab,filterFormDefaultValues:()=>Ss,fixed:()=>wR,formAssignRules:()=>So,layout:()=>wh,linkageAssignField:()=>As,linkageRulesRefresh:()=>Sd,linkageRunjs:()=>Au,linkageSetActionProps:()=>S4,linkageSetBlockProps:()=>S5,linkageSetDetailsFieldProps:()=>S7,linkageSetFieldProps:()=>S6,linkageSetMenuItemProps:()=>S8,linkageSetTabProps:()=>S3,menuLinkageRules:()=>Av,navigateToURL:()=>xY,numberFormat:()=>AF,openView:()=>xq,overflowMode:()=>AA,pattern:()=>wP,refreshTargetBlocks:()=>x2,renderMode:()=>wp,required:()=>wm,runjs:()=>xV,setTargetDataScope:()=>x9,showMessage:()=>xU,showNotification:()=>xG,sortingRule:()=>wu,subFormFieldLinkageRules:()=>Ax,subFormLinkageAssignField:()=>Ad,subFormLinkageSetFieldProps:()=>S9,tabLinkageRules:()=>Ay,titleField:()=>wl,validation:()=>wE});var x={};l.r(x),l.d(x,{ACLContext:()=>nx.w0,ACLRolesCheckProvider:()=>nx.rR,ADMIN_LAYOUT_MODEL_UID:()=>tK,ADMIN_SETTINGS_KEY:()=>a_,ADMIN_SETTINGS_LAYOUT_MODEL_UID:()=>nJ.O,ADMIN_SETTINGS_PATH:()=>aD,AIManager:()=>eo,APIClient:()=>F,APP_SWITCHER_ACTION_PANEL_MODEL_UID:()=>rA,ASSIGN_FIELD_VALUES_STEP_KEY:()=>u7.zL,ActionGroupModel:()=>dA,ActionModel:()=>dk.S0,ActionSceneEnum:()=>dk.s5,ActionWithoutPermission:()=>dk._T,AddChildActionModel:()=>cP,AddNewActionModel:()=>uB,AdminLayoutComponent:()=>r8,AdminLayoutContent:()=>nm,AdminLayoutMenuItemModel:()=>no,AdminLayoutMenuItemRenderer:()=>l$,AdminLayoutMenuModelRenderer:()=>lq,AdminLayoutModel:()=>id,AdminLayoutRouteCoordinator:()=>tz,AdminSettingsLayout:()=>Mx.AdminSettingsLayout,AdminSettingsLayoutModel:()=>Mw.C,AntdAppProvider:()=>W,AppError:()=>es.uV,AppMaintaining:()=>es.be,AppMaintainingDialog:()=>es.tp,AppNotFound:()=>es.bM,AppSpin:()=>es.gv,AppSwitcherActionPanelModel:()=>Mg,Application:()=>a5,ApplicationContext:()=>a4,ApplicationModel:()=>oI,AssignFormGridModel:()=>c_,AssignFormItemModel:()=>c5,AssignFormModel:()=>cR,AssociateActionModel:()=>uY,AssociationFieldGroupModel:()=>dC,AssociationFieldModel:()=>pd,AttachmentUpload:()=>es.PJ,BaseApplication:()=>oE,BaseLayoutModel:()=>eV,BaseLayoutRouteCoordinator:()=>eF,BasePageTabModel:()=>uR,BlankComponent:()=>es.ct,BlockGridModel:()=>ui,BlockModel:()=>uo.z,BlockSceneEnum:()=>uo.P,BulkDeleteActionModel:()=>uJ,CascadeSelectFieldModel:()=>vJ,CascadeSelectInnerFieldModel:()=>vG,CascadeSelectListFieldModel:()=>vX,CheckboxFieldInterface:()=>Fh,CheckboxFieldModel:()=>yf,CheckboxGroupFieldInterface:()=>Fm,CheckboxGroupFieldModel:()=>yg,ChildPageModel:()=>uw,ChildPageTabModel:()=>uI,ClickableFieldModel:()=>vD,CodeEditor:()=>u8.BY,CodeEditorExtension:()=>F4.o,CodeScanner:()=>es.O5,CollectionActionGroupModel:()=>dM,CollectionActionModel:()=>ua.U,CollectionBlockModel:()=>us.t,CollectionFieldInterface:()=>Fp,CollectionFieldInterfaceManager:()=>ax,CollectionFilter:()=>es.px,CollectionFilterItem:()=>es.Ql,CollectionFilterPanel:()=>es.XO,CollectionSelect:()=>o2,CollectionSelectFieldInterface:()=>Ff,CollectionSelectorFieldModel:()=>yb,ColorFieldInterface:()=>Fg,ColorFieldModel:()=>yS,CommonItemModel:()=>ud,CreateContent:()=>pD,CreateFormModel:()=>mL,CreatedAtFieldInterface:()=>Fv,CreatedByFieldInterface:()=>Fy,CurrentUserContext:()=>MK,CustomWidth:()=>fO,DEFAULT_ADMIN_LAYOUT_ROUTE_PATH:()=>tF,DEFAULT_DATA_SOURCE_KEY:()=>eC.Ze,DEFAULT_PAGE_SIZE:()=>es.yQ,DataBlockModel:()=>uu.R,DateFieldInterface:()=>FQ,DateOnlyFieldModel:()=>y_,DateOnlyFilterFieldModel:()=>pJ,DateOnlyPicker:()=>yI,DateTimeFilterFieldModel:()=>pG,DateTimeNoTzFieldModel:()=>yN,DateTimeNoTzFilterFieldModel:()=>pQ,DateTimeNoTzPicker:()=>yD,DateTimeTzFieldModel:()=>yL,DateTimeTzFilterFieldModel:()=>p0,DateTimeTzPicker:()=>yB,DatetimeFieldInterface:()=>Fb,DatetimeNoTzFieldInterface:()=>FZ,DefaultToolsManager:()=>ei,DeleteActionModel:()=>uX,DetailsAssociationFieldGroupModel:()=>c4,DetailsBlockModel:()=>c9,DetailsCustomItemModel:()=>pe,DetailsGridModel:()=>pt,DetailsItemModel:()=>cz,DetailsJSFieldItemModel:()=>po,DialogFormLayout:()=>es.xg,DisassociateActionModel:()=>uQ,DisplayCheckboxFieldModel:()=>xE,DisplayColorFieldModel:()=>b7,DisplayDateTimeFieldModel:()=>xl,DisplayEnumFieldModel:()=>xo,DisplayHtmlFieldModel:()=>xs,DisplayIconFieldModel:()=>xd,DisplayJSONFieldModel:()=>xp,DisplayNumberFieldModel:()=>xS,DisplayPasswordFieldModel:()=>xM,DisplayPercentFieldModel:()=>xF,DisplaySubItemFieldModel:()=>b4,DisplaySubListFieldModel:()=>b9,DisplaySubTableFieldModel:()=>b5,DisplayTextFieldModel:()=>xk,DisplayTimeFieldModel:()=>xP,DisplayTitleFieldModel:()=>bQ,DisplayURLFieldModel:()=>xC,DividerItemModel:()=>bK,DragSortRowContext:()=>es.c5,DrawerFormLayout:()=>es.gh,EditActionModel:()=>uZ,EditFormContent:()=>v9,EditFormModel:()=>cK.EditFormModel,EmailFieldInterface:()=>Fx,EntryActionManager:()=>ed,EnvVariableInput:()=>es.s9,ExpandCollapseActionModel:()=>cF,ExtendCollectionsProvider:()=>F5,FieldAssignValueInput:()=>wo.zv,FieldDeletePlaceholder:()=>fI,FieldFilterOperatorRegistry:()=>oH,FieldModel:()=>sh.o,FieldModelSelect:()=>hn,FieldOperatorSelect:()=>hw,FieldValidationConfigureRegistry:()=>af,FileSizeInput:()=>es.c,FilterActionModel:()=>u2,FilterBlockModel:()=>uc,FilterContent:()=>sp.oJ,FilterFormActionGroupModel:()=>hO,FilterFormActionModel:()=>hN,FilterFormBlockModel:()=>h9,FilterFormCollapseActionModel:()=>mn,FilterFormCustomFieldModel:()=>hC,FilterFormCustomItemModel:()=>hS,FilterFormCustomRecordSelectFieldModel:()=>hD,FilterFormFieldModel:()=>pa,FilterFormGridModel:()=>mb,FilterFormItemModel:()=>my,FilterFormJSActionModel:()=>mx,FilterFormRecordSelectFieldModel:()=>pW,FilterFormResetActionModel:()=>mw,FilterFormSubmitActionModel:()=>mS,FilterGroup:()=>sp.I8,FilterItem:()=>sp.qi,FilterManager:()=>dW,FlowModelRepository:()=>AE,FlowPage:()=>x_,FlowRoute:()=>ik,FormActionGroupModel:()=>cn,FormActionModel:()=>ct,FormAssociationFieldGroupModel:()=>m5,FormAssociationItemModel:()=>m7,FormBlockContent:()=>cE.JU,FormBlockModel:()=>cE.F4,FormComponent:()=>cE.s2,FormCustomItemModel:()=>mq,FormGridModel:()=>cT,FormItemModel:()=>cJ,FormJSFieldItemModel:()=>mV,FormModel:()=>cE.mO,FormSubmitActionModel:()=>cl,GRID_FLOW_KEY:()=>d4,GRID_STEP:()=>d8,GlobalThemeProvider:()=>en,GridModel:()=>d7,HeaderContext:()=>lP,Icon:()=>es.In,IconFieldInterface:()=>Fw,IconFieldModel:()=>yU,IconPicker:()=>eC.ar,IdFieldInterface:()=>FS,InputFieldInterface:()=>FF,InputFieldModel:()=>yW.m,InputNumberField:()=>y4,IntegerFieldInterface:()=>Fk,InternalAdminSettingsLayout:()=>Mx.InternalAdminSettingsLayout,JSActionModel:()=>u6,JSBlockModel:()=>fu,JSCollectionActionModel:()=>u9,JSColumnModel:()=>gx,JSEditableFieldModel:()=>bL,JSFieldModel:()=>bP,JSFormActionModel:()=>mz,JSItemActionModel:()=>cs,JSItemModel:()=>bJ,JSRecordActionModel:()=>cd,JsonFieldInterface:()=>FC,JsonFieldModel:()=>n,JsonInput:()=>y0,JsonTextArea:()=>es.V4,KeepAlive:()=>es.PR,KeepAliveProvider:()=>es.cn,LayoutContent:()=>nf,LayoutContentRoute:()=>iP,LayoutManager:()=>iW,LayoutRoute:()=>iN,LinkActionModel:()=>cM,LinkageFilterItem:()=>sp.Ru,M2MFieldInterface:()=>FP,M2OFieldInterface:()=>Fj,MAX_MESSAGE_CHARS:()=>u8.hP,MENU_TYPE_OPTIONS:()=>l0,MINIMAL_THEME_UID:()=>kf,MULTI_PORTAL_SETTING_NAME:()=>nJ.on,MainPageModel:()=>uM,MarkdownFieldInterface:()=>FE,MarkdownItemModel:()=>bY,MobileMenuControlContext:()=>lC,MockFlowModelRepository:()=>Aj,MultipleSelectFieldInterface:()=>FR,NBColorPicker:()=>yw,NanoidFieldInterface:()=>FJ,NocoBaseBuildInPlugin:()=>MX,NocoBaseBuildInPluginV2:()=>MX,NocoBaseDesktopRouteType:()=>eC.q2,NumberFieldInterface:()=>FT,NumberFieldModel:()=>y8,O2MFieldInterface:()=>F_,OBOFieldInterface:()=>FI,OHOFieldInterface:()=>FD,ObjectNester:()=>vy,OptionsEditor:()=>ap,PAGE_SIZE_OPTIONS:()=>es.xp,PLUGIN_MANAGER_SETTING_NAME:()=>nJ.Bm,PageModel:()=>ub,PageTabModel:()=>u_,PasswordFieldInterface:()=>FN,PasswordFieldModel:()=>y3,PasswordInput:()=>es.yA,PercentFieldInterface:()=>FO,PercentFieldModel:()=>be,PercentInput:()=>y7,PhoneFieldInterface:()=>F$,PinnedPluginListContext:()=>nS,PinnedPluginListLite:()=>rS,Plugin:()=>se,PluginFlowEngine:()=>MM,PluginManager:()=>aI,PluginManagerPage:()=>MS.PluginManagerPage,PluginSettingsManager:()=>aO,PluginSettingsTopbarActionModel:()=>rl,PopupActionModel:()=>uO,PopupCollectionActionModel:()=>cu,PopupSubTableActionGroupModel:()=>ys,PopupSubTableActionsColumnModel:()=>yc,PopupSubTableEditActionModel:()=>ye,PopupSubTableFieldModel:()=>yo,PopupSubTableFormActionGroupModel:()=>co,PopupSubTableFormModel:()=>yp,PopupSubTableFormSubmitActionModel:()=>ci,PopupSubTableRemoveActionModel:()=>ya,PoweredBy:()=>es.G5,QUICK_EDIT_FORM_MAX_HEIGHT:()=>mU,QUICK_EDIT_MARKDOWN_HEIGHT:()=>mW,QUICK_EDIT_POPOVER_MAX_HEIGHT:()=>mK,QuickEditFormModel:()=>m2,RadioGroupFieldInterface:()=>FB,RadioGroupFieldModel:()=>bt,RangeValidationItems:()=>am,RecordActionGroupModel:()=>dF,RecordActionModel:()=>u$.L,RecordPickerContent:()=>gH,RecordPickerFieldModel:()=>gY,RecordSelectFieldModel:()=>pL,RefreshActionModel:()=>cc,RemoteFlowModelRenderer:()=>xD,RemoteSelect:()=>es.lT,ResetThemeTokenAndKeepAlgorithm:()=>tQ,RichTextField:()=>bu,RichTextFieldInterface:()=>FL,RichTextFieldModel:()=>r,RootPageModel:()=>uD,RootPageTabModel:()=>uT,RouteModel:()=>eg,RouteRepository:()=>iH,RouterContextCleaner:()=>es.PK,RouterManager:()=>aZ,SNIPPET_PREFIX:()=>aN,SYSTEM_SETTINGS_SETTING_NAME:()=>nJ.jm,ScanInput:()=>es.E5,SelectFieldInterface:()=>Fq,SelectFieldModel:()=>bv,SkeletonFallback:()=>iR,SnowflakeIdFieldInterface:()=>FV,SortHandle:()=>es.vm,SortableCategoryTabs:()=>es.pO,SortableRow:()=>es.B7,SourceCascader:()=>hM,SubFormFieldModel:()=>vb,SubFormListFieldModel:()=>vw,SubPageModel:()=>uN,SubTableColumnModel:()=>vo,SubTableFieldModel:()=>vf,SubTableRecordAction:()=>v7,SwitchLanguage:()=>es.rw,SystemSettingsPage:()=>MA.SystemSettingsPage,SystemSettingsSource:()=>eu.o,TABLE_COLUMN_MIN_WIDTH:()=>fD,Table:()=>es.XI,TableActionsColumnModel:()=>fW,TableAssociationFieldGroupModel:()=>fH,TableBlockModel:()=>gu,TableColumnModel:()=>fB,TableCustomColumnModel:()=>fL,TableJSFieldItemModel:()=>gy,TableSelectModel:()=>gv,TableoidFieldInterface:()=>Fz,TextAreaWithContextSelector:()=>sl.n,TextareaFieldInterface:()=>FK,TextareaFieldModel:()=>i,TimeFieldInterface:()=>FU,TimeFieldModel:()=>bF,TopbarActionModel:()=>n3,TypedVariableInput:()=>es.Pb,UIEditorTopbarActionModel:()=>rt,UI_OPERATION_QUERY_KEY:()=>F8,USER_CENTER_ACTION_ID:()=>rn,UUIDFieldInterface:()=>FY,UnitConversion:()=>xA,UnixTimestampFieldInterface:()=>FX,UpdateRecordActionModel:()=>cv,UpdatedAtFieldInterface:()=>FW,UpdatedByFieldInterface:()=>FH,UrlFieldInterface:()=>FG,UserCenterActionItemModel:()=>rp,UserCenterItemModel:()=>ru,UserCenterSelectItemModel:()=>rh,UserCenterTextItemModel:()=>rc,UserCenterTopbarActionModel:()=>rb,VariableFieldFormModel:()=>bk,VariableFilterItem:()=>sp.Et,VariableInput:()=>es.P8,VariableJSON:()=>es.hJ,VariableJsonTextArea:()=>es.jr,VariableTextArea:()=>es.hp,ViewActionModel:()=>cy,WebSocketClient:()=>iG,aclCheck:()=>wb,aclCheckRefresh:()=>wM,actionLinkageRules:()=>Ag,addCustomAlgorithmToTheme:()=>Q,addFieldValidationConfiguresToGroup:()=>ab,afterSuccess:()=>su,applyAssociateAction:()=>uW,applyClickToOpenProps:()=>vT,applyClickToOpenSetting:()=>v_,applyDisassociateAction:()=>uU,applyMobilePaginationProps:()=>cp.hO,array:()=>oN,bigField:()=>oW,blockHeight:()=>Sh,blockLinkageRules:()=>Af,boolean:()=>oz,browserUIOperationCodec:()=>ku,buildDisplayPathFromValue:()=>vV,buildInsertRouteSchema:()=>nt,buildLinkSettingSchema:()=>lX,buildMenuBasicSchema:()=>l1,buildMenuTitleWithIcon:()=>lz,buildRecordPickerParentItemContext:()=>gz,buildRecordPickerPopupContextInputArgs:()=>gU,buildV2SigninHref:()=>tw,canRecordPickerSelectMultiple:()=>gN,collectAssociationHydrationCandidates:()=>pE,collectCascadeHydrationCandidate:()=>vL,collection:()=>oU,compatOldTheme:()=>J,configurePropertiesToItems:()=>at,confirm:()=>sc,connectFields:()=>mk,createAclSnippetAllow:()=>nx.rN,createAssignFieldValuesStep:()=>u7.KW,createAssignFormSubModelOptions:()=>u7.nF,createCompactSimpleItemRender:()=>cp.hH,createDefaultCollectionBlockTitle:()=>cp.lr,createFilterable:()=>o0,createFormRegistry:()=>es.oV,createInsertMenuStep:()=>l3,createMockClient:()=>a7,createSettingsPathMap:()=>nJ.nC,createTypedFilterable:()=>o1,customAlgorithm:()=>X,customVariable:()=>xX,customizeFilterRender:()=>mN,dataLoadingMode:()=>wc,dataScope:()=>dx,dateRangeLimit:()=>ws,dateTimeFormat:()=>wi,dateTimeFormatConfigureItems:()=>ad,datetime:()=>o$,decodeUIOperation:()=>kp,defaultOperator:()=>mT,defaultTheme:()=>Y,detailsFieldLinkageRules:()=>Aw,diagnoseRunJS:()=>u8.fL,dispatchEventDeep:()=>cp.Xi,displayFieldComponent:()=>wg,editMarkdownFlow:()=>bH,encodeUIOperation:()=>kh,enumType:()=>oq,escapeHTML:()=>nP.Z,evaluateFieldConfigureExpression:()=>o3,fieldComponent:()=>wv,fieldFilterOperatorPresets:()=>oJ,fieldFilterOperators:()=>oY,fieldLinkageRules:()=>Ab,fieldValidationConfigureRegistry:()=>ag,filterFormDefaultValues:()=>Ss,filterOperatorRegistry:()=>oG,filterRenderableSettings:()=>nJ.Ui,filterVisibleSettings:()=>nJ.eD,findFirstAccessiblePageRoute:()=>tL,findFirstInternalSettingsPage:()=>nJ.X2,findFirstV2LandingRoute:()=>tB,findNextSiblingRoute:()=>l7,findOptionPathByTk:()=>vz,findPrevSiblingRoute:()=>l9,findSettingsByName:()=>nJ.R0,fixed:()=>wR,formAssignRules:()=>So,formatEnvPath:()=>es.EM,formatNumber:()=>xx,formatRunJSPreviewMessage:()=>u8.by,formatVariablePath:()=>es.X5,getAdminLayoutMenuInitializerButton:()=>lV,getAdminLayoutMenuMovePositionOptions:()=>lj,getAdminLayoutMenuVirtualPath:()=>ls,getAdminLayoutModel:()=>iu,getAdminLayoutRoutePath:()=>tP,getAllDataModels:()=>dL,getAppVersionHTML:()=>nP.p,getAssignFieldValuesDefaultParams:()=>u7.Z1,getAssociationBlockResourceSettings:()=>uL,getAssociationHydrationNamePath:()=>pR,getAssociationHydrationSetterContext:()=>pT,getAssociationSelectAssociatedRecordsFilter:()=>gg,getAssociationSelectForeignKeyFilter:()=>gf,getAssociationSelectorContextInputArgs:()=>uz,getAssociationTargetResourceSettings:()=>uV,getCoreFieldConfigureState:()=>ao,getCurrentV2RedirectPath:()=>tx,getDefaultOperator:()=>d$,getDefaultSettingsPath:()=>nJ.C9,getDefaultV2AdminRedirectPath:()=>tg,getDetailsItemValue:()=>cq,getDisplayNumber:()=>xw,getFilterFormOperatorList:()=>dN,getFilterFormOperatorMeta:()=>dO,getItemActiveColors:()=>ee,getLayoutContentRouteNames:()=>eT,getLayoutModel:()=>ez,getLayoutPageRouteName:()=>eP,getLayoutPageTabRouteName:()=>ej,getLayoutPageTabViewRouteName:()=>eR,getLayoutPageViewRouteName:()=>eE,getMenuCreationDefaultParams:()=>lZ,getMenuCreationUiSchema:()=>l4,getMenuEditDefaultParams:()=>l5,getMenuItems:()=>nJ.gL,getMobileCompactPaginationClassName:()=>cp.NY,getModernClientPrefix:()=>tr,getPinnedPluginListKeys:()=>nw,getQuickEditFieldProps:()=>mQ,getRecordPickerClearedValue:()=>gL,getRecordPickerEmptyValue:()=>gB,getRouteRuntimeVersion:()=>M9,getSidebarMenuItems:()=>nJ.IA,getSidebarSelectedKey:()=>nJ.xD,getSimpleModePaginationClassName:()=>cp.HZ,getTopbarPluginSettingsItems:()=>n8,getUniqueKeyFromCollection:()=>F0,getUnknownCountPaginationTotal:()=>cp.SM,getV2EffectiveBasePath:()=>to,getValueWithIndex:()=>cL,hasIcon:()=>es.cE,hasOwnSettingsPage:()=>nJ.lv,icons:()=>es.Pt,id:()=>oL,indexConfigureItems:()=>as,injectRecordPickerPopupContext:()=>gK,insertRouteSchema:()=>lQ,isAssociationBlockContext:()=>uq,isFilterValueEmpty:()=>dB,isLayoutContentRouteName:()=>eI,isSettingsApp:()=>km,isTitleField:()=>eC.ji,isTitleFieldInterface:()=>eC.w,isV2AdminRuntime:()=>tR,isV2MenuRoute:()=>t$,joinAdminLayoutRoutePath:()=>tj,joinUrlSearch:()=>cx,languageCodes:()=>st.A,layout:()=>wh,linkageAssignField:()=>As,linkageRulesRefresh:()=>Sd,linkageRunjs:()=>Au,linkageSetActionProps:()=>S4,linkageSetBlockProps:()=>S5,linkageSetDetailsFieldProps:()=>S7,linkageSetFieldProps:()=>S6,linkageSetMenuItemProps:()=>S8,linkageSetTabProps:()=>S3,makeFormatVariablePath:()=>es.nW,makeParseVariablePath:()=>es.Dx,makeVariableRegExp:()=>es.at,markCascadeHydrationDone:()=>vq,matchSettingsRoute:()=>nJ.CM,matchesRoutePath:()=>ne,menuLinkageRules:()=>Av,mergeAssignFieldValues:()=>u7.GO,mergePaginationClassName:()=>cp.M6,navigateToURL:()=>xY,normalizeAdminLayoutMenuLegacyVariables:()=>lh,normalizeCollectionTemplateField:()=>F1,normalizeCollectionTemplateFields:()=>F2,normalizeFilterableOperators:()=>oQ,normalizeLayoutRoutePath:()=>iK,normalizeRecordPickerSelectedRows:()=>g$,normalizeRecordPickerValue:()=>gq,normalizeTableColumnWidth:()=>fN,normalizeV2RedirectPath:()=>tb,number:()=>oB,numberFormat:()=>AF,object:()=>oO,openAdminLayoutMenuLink:()=>ly,openView:()=>xq,openViewFlow:()=>em,operatorComponentProps:()=>m$,overflowMode:()=>AA,parseEnvPath:()=>es.uO,parseUIOperation:()=>kc,parseVariablePath:()=>es.h7,pattern:()=>wP,previewRunJS:()=>u8.zA,recalculateGridSizes:()=>ut,reconcileAdminLayoutMenuItems:()=>lR,redirectToV2Signin:()=>tS,refreshClickToOpenRuntime:()=>vI,refreshTargetBlocks:()=>x2,registerFieldValidationConfigure:()=>av,registerFieldValidationConfigureGroup:()=>ay,registerIcon:()=>es.pU,registerIcons:()=>es.K1,removeMarkdownIframes:()=>A2.VC,removeUIOperation:()=>kn,renderMode:()=>wp,replaceRouteParams:()=>nJ.uT,required:()=>wm,resolveAdminLayoutMenuDragMoveOptions:()=>lT,resolveAdminLayoutMenuDragMoveOptionsFromEvent:()=>lI,resolveAdminLayoutMenuLink:()=>lm,resolveAdminRouteRuntimeTarget:()=>tV,resolveAssignFieldValues:()=>u7.eu,resolveCustomFieldOperatorList:()=>hy,resolveDefaultCustomFieldOperator:()=>hb,resolveDynamicNamePath:()=>sA.IJ,resolveFilterOperators:()=>oX,resolveUnauthenticatedSignInRoute:()=>MG,resolveV2SigninRedirect:()=>tA,reverseFieldConfigureItem:()=>ac,reverseFieldConfigureItems:()=>au,runCoreFieldConfigureEffects:()=>aa,runjs:()=>xV,setTargetDataScope:()=>x9,shouldClearRecordPickerValueOnMultipleChange:()=>gO,shouldOpenAdminRouteInNewWindow:()=>aX,shouldRenderIconInTitle:()=>lB,showMessage:()=>xU,showNotification:()=>xG,sortTopLevelSettings:()=>nJ.p$,sortingRule:()=>wu,string:()=>oD,stripMarkdownIframeTags:()=>A2.jR,stripMarkdownIframes:()=>A2.$P,stripModernClientPrefix:()=>ti,subFormFieldLinkageRules:()=>Ax,subFormLinkageAssignField:()=>Ad,subFormLinkageSetFieldProps:()=>S9,tabLinkageRules:()=>Ay,tableRowActionsClassName:()=>fz,tableoid:()=>oK,time:()=>oV,titleField:()=>wl,toOperatorSelectOptions:()=>hx,toRouterNavigationPath:()=>tT,toToolsMap:()=>ea,toTreeSelectItems:()=>l6,toViewStack:()=>ek,transformNestedData:()=>vP,transformRowsToSingleColumn:()=>ue,useACLContext:()=>nx.bq,useACLRoleContext:()=>nx.v6,useACLSnippets:()=>nx.MK,useAclSnippets:()=>nx.K3,useAdminLayoutRoutePage:()=>Mb,useApp:()=>V.n,useAppListRender:()=>rE,useApplications:()=>rF,useAttachmentStorageRules:()=>es.j1,useCurrentAppInfo:()=>nF.g,useCurrentRoleMode:()=>nx.GL,useCurrentRoles:()=>MW,useCurrentUserContext:()=>MU,useFilterOptions:()=>sp.uw,useFilteredMetaTree:()=>es.a7,useGlobalTheme:()=>el,useKeepAlive:()=>es.Y,useLayoutRoutePage:()=>ic,useMobileLayout:()=>My,usePlugin:()=>nk.n,useRoleRecheck:()=>nx.N5,useRouter:()=>nC,useSettingsThemeConfig:()=>ky,useSystemSettings:()=>eu.e,useUIConfigurationPermissions:()=>nx.uM,validation:()=>wE}),l(70571);var w=l(12039),S=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 M(){return A(-(new Date().getTimezoneOffset()/60))}class F extends w.Q9{getHostname(){var e,t;if(S.env.API_BASE_URL)try{return new URL(S.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"]=M(),e["X-Hostname"]=this.getHostname(),e}interceptors(){this.axios.interceptors.request.use(e=>{let t=this.getHeaders();return Object.keys(t).forEach(l=>{(0,w.bO)(e.headers,l)||(e.headers[l]=t[l])}),e}),super.interceptors()}}var k=l(58587),C=l(18150),P=l(68238),j=l(50467),E=l(74848),R=l(95243),T=l(11869),I=l(40098),_=l.n(I),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),G=l(4888);let Y={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,...Y.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);function ee(e){let t=e;return{bg:t.colorBgItemActive||e.controlItemBgActive,color:t.colorTextItemActive||void 0}}(0,Z.injectGlobal)`
3
3
  .ant-form-item-label > label {
4
4
  font-weight: 600;
@@ -13,7 +13,7 @@ export const __rspack_esm_id="8410";export const __rspack_esm_ids=["8410"];expor
13
13
  overflow: hidden;
14
14
  }
15
15
  }
16
- `;let et=(0,D.createContext)(null);et.displayName="GlobalThemeContext";let el=()=>D.useContext(et)||{theme:{},isDarkTheme:!1},en=e=>{let{children:t,theme:l}=e,[n,r]=D.useState(l||Y),i=(0,D.useRef)(null),o=(0,D.useRef)(null),a=(0,D.useMemo)(()=>{let e=null==n?void 0:n.algorithm;return Array.isArray(e)?e.includes(H.A.darkAlgorithm):e===H.A.darkAlgorithm},[null==n?void 0:n.algorithm]),s=(0,D.useCallback)(e=>{o.current=e?_().cloneDeep(e):e},[]),d=(0,D.useCallback)(()=>o.current,[]),u=(0,D.useCallback)(e=>{i.current=e?_().cloneDeep(e):e},[]),c=(0,D.useCallback)(()=>i.current,[]),p=(0,D.useMemo)(()=>({theme:Q(n),setTheme:r,setCurrentSettingTheme:u,getCurrentSettingTheme:c,setCurrentEditingTheme:s,getCurrentEditingTheme:d,isDarkTheme:a}),[d,c,a,s,u,n]);return(0,E.jsx)(et.Provider,{value:p,children:(0,E.jsx)(G.Ay,{theme:J(p.theme),children:t})})};var er=l(4198);class ei{async listTools(e){let{data:t}=await this.app.apiClient.resource("aiTools").list({filter:e}),l=null==t?void 0:t.data;return l?l.map(e=>({...e,...this.tools.get(e.definition.name)??{}})):[]}useTools(){let e=new er.Registry;for(let[l,n]of this.tools.getEntities()){var t;e.register(l,{...(null==(t=n.useHooks)?void 0:t.call(n))??n})}return e}registerTools(e,t){this.tools.register(e,{...t})}constructor(e,t=new er.Registry){(0,j._)(this,"app",void 0),(0,j._)(this,"tools",void 0),this.app=e,this.tools=t}}class eo{constructor(e){(0,j._)(this,"app",void 0),(0,j._)(this,"toolsManager",void 0),this.app=e,this.toolsManager=new ei(this.app)}}let ea=e=>new Map(e.map(e=>[e.definition.name,e]));var es=l(84884);class ed{register(e,t){this.providers.set(e,{name:e,scope:t.scope,provider:t.provider,sort:t.sort??0}),this.invalidate()}unregister(e){this.providers.delete(e),this.invalidate()}invalidate(){this.revision+=1}getItems(e){return async t=>{let l=[...this.providers.values()].filter(t=>t.scope===e).sort((e,t)=>e.sort-t.sort);return(await Promise.all(l.map(async e=>{try{return await e.provider(t)}catch(t){return console.error(`[NocoBase] Failed to load entry action provider "${e.name}".`,t),[]}}))).flat()}}constructor(){(0,j._)(this,"providers",new Map),(0,j._)(this,"revision",0),(0,T.define)(this,{revision:T.observable.ref})}}var eu=l(95267);let ec=e=>null==e?"":"object"==typeof e?Array.isArray(e)?"["+e.map(ec).join(",")+"]":"{"+Object.keys(e).sort().map(t=>`${t}:${ec(e[t])}`).join(",")+"}":String(e),ep=e=>{let{params:t,index:l}=e;return[ec(t.viewUid),ec(t.sourceId),ec(t.filterByTk),ec(t.openViewRouteState),String(l)].join("_")};function eh(e,t){let l=new Map,n=new Map;e.forEach(e=>{let t=ep(e);l.set(t,e)}),t.forEach(e=>{n.set(ep(e),e)});let r=[];l.forEach((e,t)=>{n.has(t)?n.get(t).hidden=e.hidden:r.push(e)});let i=[];return n.forEach((e,t)=>{l.has(t)||i.push(e)}),{viewsToClose:r,viewsToOpen:i}}let em=(0,T.defineFlow)({key:"popupSettings",title:(0,T.tExpr)("Popup settings"),on:"click",sort:300,steps:{openView:{use:"openView",hideInSettings:async e=>{var t,l,n,r;let i=null==(l=(n=e.model).getStepParams)||null==(t=l.call(n,"displayFieldSettings","clickToOpen"))?void 0:t.clickToOpen;return!!e.collectionField&&(void 0===i?!(null==(r=e.collectionField)?void 0:r.isAssociationField())||e.disableFieldClickToOpen:!1===i)}}},defaultParams:e=>{var t,l,n,r,i,o,a,s;let d,u,c,p=e.collectionField,h=e.blockModel,m=null==(l=e.model)||null==(t=l.parent)?void 0:t.associationPathName,f=e.collection||(null==h?void 0:h.collection),g=e=>{var t;return!!(null==e||null==(t=e.isAssociationField)?void 0:t.call(e))},v=!g(p)&&m?null==f||null==(n=f.getFieldByPath)?void 0:n.call(f,m):void 0,y=g(p)?p:v;if(g(y)){let e=y.targetCollection;null==h||h.collection,d=null==e?void 0:e.name,u=null==e?void 0:e.dataSourceKey,c=null==y?void 0:y.resourceName}else p?(d=null==(r=e.collection)?void 0:r.name,u=null==(i=e.collection)?void 0:i.dataSourceKey,c=null==p?void 0:p.target):(d=null==(o=e.collection)?void 0:o.name,u=null==(a=e.collection)?void 0:a.dataSourceKey,c=null==(s=e.association)?void 0:s.resourceName);return{openView:{collectionName:d,associationName:c,dataSourceKey:u}}}}),ef=e=>e.getStepParams("popupSettings","openView");class eg extends T.FlowModel{}function ev(e,t,l){return t.map((t,n)=>{let r,i=t.viewUid;return 0===n?(r=l,i=l.uid):r=e.getModel(t.viewUid,!0),{params:t,modelUid:i,model:r,hidden:T.observable.ref(!1),index:n}})}function ey(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=!1;for(let n=e.length-1;n>=0;n--){let r=e[n];"embed"!==eb(r,t)||l?r.hidden.value=l:(l=!0,r.hidden.value=!1)}}function eb(e){var t;let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.model instanceof eg||l&&e.index>0)return"embed";if(!e.model)return"drawer";if(null==(t=e.params.openViewRouteState)?void 0:t.mode)return e.params.openViewRouteState.mode;let n=e.model.getStepParams("popupSettings","openView");return(null==n?void 0:n.mode)||"drawer"}eg.registerFlow({key:"popupSettings",on:"click",steps:{openView:{use:"openView",defaultParams(e){var t;return{mode:"embed",preventClose:!0,pageModelClass:(null==(t=e.layout)?void 0:t.rootPageModelClass)||"RootPageModel"}}}}});let ex="__nocobaseOpenViewInputArgs",ew=(e,t)=>{var l,n;if(!t||!e||"object"!=typeof e)return{};let r=e,i=null==(l=r[ex]||(null==(n=r.usr)?void 0:n[ex]))?void 0:l[t];return i&&"object"==typeof i?i:{}},eS=e=>null!=e&&""!==String(e),eA=e=>`/${(e||"/admin").replace(/^\/+/,"").replace(/\/+$/,"")}`,eM=e=>(null==e?void 0:e.startsWith("/"))?eA(e):"";class eF{setLayoutContentElement(e){let t=this.layoutContentElement||this.lastNonNullLayoutContentElement;if(this.layoutContentElement=e,!e)return;let l=!!t&&t!==e;this.lastNonNullLayoutContentElement=e,l&&this.replayActiveRuntimeViewsAfterLayoutContentElementChange()}registerPage(e,t){let l=this.getOrCreateRouteModel(e),n={pageUid:e,routeModel:l,meta:{active:!!t.active,refreshDesktopRoutes:t.refreshDesktopRoutes,layoutContentElement:t.layoutContentElement||null},viewState:{},prevViewList:[],pendingOpenViewKeys:new Set,hasStepNavigated:!1,forceStop:!1,viewGeneration:0};return this.ensureRouteModelContext(n),this.runtimes.set(e,n),this.syncPageMeta(e,t),n.routeModel}syncPageMeta(e,t){let l=this.runtimes.get(e);if(!l)return;let n="boolean"==typeof t.active?t.active:void 0;l.meta={...l.meta,...t,active:l.meta.active,layoutContentElement:t.layoutContentElement??l.meta.layoutContentElement},"boolean"==typeof n&&this.setRuntimeActive(l,n)}unregisterPage(e){this.cleanupPage(e),this.runtimes.delete(e)}syncRoute(e){var t,l,n,r;if((null==e?void 0:e.layoutRouteName)&&(null==(t=this.layout)?void 0:t.routeName)&&e.layoutRouteName!==this.layout.routeName){this.runtimes.forEach(e=>{this.setRuntimeActive(e,!1)}),this.invalidatePendingRuntimeViewOpens();return}let i=(null==e?void 0:e.pageUid)||(null==e||null==(l=e.layoutRoute)?void 0:l.pageUid)||(null==e||null==(n=e.params)?void 0:n.name),o=null==e?void 0:e.pathname,a=(null==e?void 0:e.layoutBasePathname)||(null==e||null==(r=e.layoutRoute)?void 0:r.basePathname);if(a&&(this.basePathname=eA(a)),this.runtimes.forEach(e=>{this.setRuntimeActive(e,e.pageUid===i)}),!i||!o)return void this.invalidatePendingRuntimeViewOpens();this.runtimes.forEach(e=>{e.pageUid!==i&&(e.forceStop||(e.viewGeneration+=1,e.pendingOpenViewKeys.clear()),e.forceStop=!0)});let s=this.runtimes.get(i);s&&(s.forceStop=!1,s.currentPathname&&s.currentPathname!==o&&(s.viewGeneration+=1,s.pendingOpenViewKeys.clear()),s.currentPathname=o,s.currentRouteState=e.state,this.syncRuntimeWithPathname(s,o,{routeState:e.state}))}cleanupPage(e){let t=this.runtimes.get(e);t&&(t.forceStop=!0,t.viewGeneration+=1,t.pendingOpenViewKeys.clear(),t.prevViewList.forEach(e=>{var l,n;this.flowEngine.removeModelWithSubModels(e.params.viewUid),null==(n=t.viewState[ep(e)])||null==(l=n.destroy)||l.call(n),delete t.viewState[ep(e)]}),t.prevViewList=[],t.hasStepNavigated=!1,t.currentPathname=void 0,t.currentRouteState=void 0)}destroy(){Array.from(this.runtimes.keys()).forEach(e=>{this.cleanupPage(e),this.runtimes.delete(e)})}getCurrentRouteByPageUid(e){var t,l;return(null==(l=this.flowEngine.context.routeRepository)||null==(t=l.getRouteBySchemaUid)?void 0:t.call(l,e))||{}}setRuntimeActive(e,t){var l;let n=!!e.meta.active;e.meta.active=t,(null==(l=e.routeModel.context.pageActive)?void 0:l.value)!==t&&(e.routeModel.context.pageActive.value=t),this.syncViewListVisibility(e),n!==t&&this.notifyRuntimeActiveChange(e,t)}notifyRuntimeActiveChange(e,t){var l,n;let r=e.prevViewList[0];if(!r)return;let i=e.viewState[ep(r)];if(t){null==i||null==(n=i.activate)||n.call(i,!0);return}null==i||null==(l=i.deactivate)||l.call(i)}syncRuntimeWithPathname(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var n,r;if(!this.basePathname)return;let i=(0,T.parsePathnameToViewParams)(t,{basePath:this.basePathname}),o=ev(this.flowEngine,i,e.routeModel),a=l.routeState;if(!l.skipInitialStepNavigation&&this.shouldStepNavigate(e,o)){this.stepNavigate(o,0,a),e.hasStepNavigated=!0,this.scheduleInitialDeepLinkReplay(e,t,a);return}let{viewsToClose:s,viewsToOpen:d}=eh(e.prevViewList,o),u=new Set(d.map(e=>ep(e))),c=o.filter(t=>{let l=ep(t);return!e.pendingOpenViewKeys.has(l)&&(u.has(l)||!e.viewState[l])});if(s.length&&(s.forEach(t=>{var l,n;e.pendingOpenViewKeys.delete(ep(t)),null==(n=e.viewState[ep(t)])||null==(l=n.destroy)||l.call(n,!0),delete e.viewState[ep(t)]}),ey(o,!!(null==(n=this.layoutContext)?void 0:n.isMobileLayout))),c.length&&(this.markPendingOpenViews(e,c),this.handleOpenViews(e,o,c,e.viewGeneration,a).catch(e=>{console.error("[NocoBase] Failed to open route-managed views:",e)})),0===s.length&&0===c.length){let t=o.at(-1);t&&(null==(r=e.viewState[ep(t)])||r.navigation.setViewStack(o.map(e=>e.params)))}e.prevViewList=[...o],this.syncViewListVisibility(e)}catch(e){console.error("[NocoBase] Failed to resolve view params to view list:",e)}}syncViewListVisibility(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.prevViewList;if(t.length){if(e.meta.active){var l;ey(t,!!(null==(l=this.layoutContext)?void 0:l.isMobileLayout));return}t.forEach(e=>{e.hidden.value=!0})}}shouldStepNavigate(e,t){return 0===e.prevViewList.length&&t.length>1&&!e.hasStepNavigated}scheduleInitialDeepLinkReplay(e,t,l){let n=e.viewGeneration;Promise.resolve().then(()=>{e.forceStop||e.viewGeneration!==n||e.currentPathname!==t||e.prevViewList.length>0||this.syncRuntimeWithPathname(e,t,{routeState:l})}).catch(()=>{})}stepNavigate(e,t,l){if(!e[t])return;let n=l?{state:l}:void 0;0===t?new T.ViewNavigation(this.flowEngine.context,[],{basePath:this.basePathname}).navigateTo(e[t].params,{replace:!0,...n}):new T.ViewNavigation(this.flowEngine.context,e.slice(0,t).map(e=>e.params),{basePath:this.basePathname}).navigateTo(e[t].params,n),this.stepNavigate(e,t+1,l)}replayActiveRuntimeViewsAfterLayoutContentElementChange(){this.runtimes.forEach(e=>{e.currentPathname&&0!==e.prevViewList.length&&(this.resetRuntimeViewStateForLayoutContentElementChange(e),e.meta.active&&this.syncRuntimeWithPathname(e,e.currentPathname,{skipInitialStepNavigation:!0,routeState:e.currentRouteState}))})}invalidatePendingRuntimeViewOpens(){this.runtimes.forEach(e=>{e.forceStop=!0,e.viewGeneration+=1,e.pendingOpenViewKeys.clear()})}resetRuntimeViewStateForLayoutContentElementChange(e){e.viewGeneration+=1,e.pendingOpenViewKeys.clear(),e.prevViewList.forEach((t,l)=>{var n,r;null==(r=e.viewState[ep(t)])||null==(n=r.destroy)||n.call(r,!0),delete e.viewState[ep(t)],l>0&&this.flowEngine.removeModelWithSubModels(t.params.viewUid)}),e.prevViewList=[],e.hasStepNavigated=!1}markPendingOpenViews(e,t){t.forEach(t=>{e.pendingOpenViewKeys.add(ep(t))})}clearPendingOpenViews(e,t){t.forEach(t=>{e.pendingOpenViewKeys.delete(ep(t))})}async handleOpenViews(e,t,l,n,r){let i=l.filter(e=>!e.model);i.length>0&&await Promise.all(i.map(async e=>{try{e.model=await this.flowEngine.loadModel({uid:e.modelUid})}catch(t){console.error(`[NocoBase] Failed to load model ${e.modelUid}:`,t)}})),e.forceStop||e.viewGeneration!==n||(this.syncViewListVisibility(e,t),this.openViews(e,t,l,0,n,r))}openViews(e,t,l,n,r,i){if(e.forceStop||e.viewGeneration!==r||!l[n])return;let o=l[n];if(!o.model)return void this.clearPendingOpenViews(e,l.slice(n));let a=ep(o),s=D.createRef(),d=D.createRef(),u=D.createRef(),c=D.createRef(),p=ef(o.model),h=(null==p?void 0:p.associationName)&&!eS(o.params.sourceId)?null:null==p?void 0:p.associationName,m=o.params.openViewRouteState,f=t.slice(0,o.index).map(e=>e.params.viewUid),g=ew(i,o.params.viewUid),v=new T.ViewNavigation(this.flowEngine.context,t.slice(0,o.index+1).map(e=>e.params),{basePath:this.basePathname});try{var y;o.model.dispatchEvent("click",{target:this.layoutContentElement||e.meta.layoutContentElement,collectionName:null==p?void 0:p.collectionName,associationName:h,dataSourceKey:null==p?void 0:p.dataSourceKey,destroyRef:s,updateRef:d,activateRef:u,deactivateRef:c,openerUids:f,...o.params,...g,...(null==m?void 0:m.mode)?{mode:m.mode}:{},...(null==m?void 0:m.size)?{size:m.size}:{},pageActive:e.meta.active,activationControlledByLayout:!0,navigation:v,onOpen:()=>{this.openViews(e,t,l,n+1,r,i)},hidden:o.hidden,isMobileLayout:!!(null==(y=this.layoutContext)?void 0:y.isMobileLayout),triggerByRouter:!0})}catch(t){this.clearPendingOpenViews(e,l.slice(n)),console.error("[NocoBase] Failed to dispatch route-managed view open:",t);return}e.viewState[a]={destroy:e=>{var t;return null==(t=s.current)?void 0:t.call(s)},update:e=>{var t;return null==(t=d.current)?void 0:t.call(d,e)},activate:e=>{var t;return null==(t=u.current)?void 0:t.call(u,e)},deactivate:()=>{var e;return null==(e=c.current)?void 0:e.call(c)},navigation:v},e.pendingOpenViewKeys.delete(a)}ensureRouteModelContext(e){this.layoutContext&&e.routeModel.context.addDelegate(this.layoutContext),e.routeModel.context.pageActive||e.routeModel.context.defineProperty("pageActive",{value:T.observable.ref(!1),info:{description:"Whether current page route is active (keep-alive). This is an observable.ref<boolean> (use ctx.pageActive.value to read/write).",detail:"observable.ref<boolean>"}}),e.routeModel.context.defineProperty("currentRoute",{get:()=>this.getCurrentRouteByPageUid(e.pageUid),cache:!1}),e.routeModel.context.defineProperty("refreshDesktopRoutes",{get:()=>e.meta.refreshDesktopRoutes,cache:!1}),e.routeModel.context.defineProperty("layout",{get:()=>{var e;return this.layout||(null==(e=this.layoutContext)?void 0:e.layout)},cache:!1}),e.routeModel.context.defineProperty("layoutRoute",{get:()=>{var e;return null==(e=this.layoutContext)?void 0:e.layoutRoute},cache:!1}),e.routeModel.context.defineProperty("layoutContext",{get:()=>this.layoutContext,cache:!1})}getOrCreateRouteModel(e){let t=this.flowEngine.getModel(e);return t instanceof eg?t:(t&&this.flowEngine.removeModelWithSubModels(e),this.flowEngine.createModel({uid:e,use:"RouteModel"}))}constructor(e,t={}){var l;(0,j._)(this,"flowEngine",void 0),(0,j._)(this,"layout",void 0),(0,j._)(this,"layoutContext",void 0),(0,j._)(this,"basePathname",void 0),(0,j._)(this,"runtimes",new Map),(0,j._)(this,"layoutContentElement",null),(0,j._)(this,"lastNonNullLayoutContentElement",null),this.flowEngine=e,this.layout=t.layout,this.layoutContext=t.layoutContext,this.basePathname=t.basePathname||eM(null==(l=t.layout)?void 0:l.routePath)||(t.layout?"":eA())}}function ek(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.basePathname||eM(null==(t=l.layout)?void 0:t.routePath);return n?(0,T.parsePathnameToViewParams)(e,{basePath:n}):[]}var eC=l(2077);function eP(e){return`${e}.__page`}function ej(e){return`${e}.__pageTab`}function eE(e){return`${e}.__pageView`}function eR(e){return`${e}.__pageTabView`}function eT(e){return[eP(e),ej(e),eE(e),eR(e)]}function eI(e,t){return!!t&&eT(e).includes(t)}let e_={routeName:"admin",routePath:"/admin",rootRouteName:"admin",uid:"admin-layout-model",layoutModelClass:"AdminLayoutModel",rootPageModelClass:"RootPageModel",childPageModelClass:"ChildPageModel",authCheck:!0},eD=e=>`/${(e||"/admin").replace(/^\/+/,"").replace(/\/+$/,"")}`,eN=e=>e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:"/",eO=(e,t)=>{let l=eN(e),n=eD(t);return l===n?"":l.startsWith(`${n}/`)?l.slice(n.length+1):null},e$=e=>(null==e?void 0:e.startsWith("/"))?eD(e):"",eB=e=>["tab","filterbytk","sourceid"].includes(e),eL=(e,t)=>!!t&&["page","page.tabs","page.tabs.popups","page.tab","page.view","page.tab.view"].some(l=>t===`${e}.${l}`),eq=e=>{if(!e)return!0;let t=e.split("/").filter(Boolean);if(!t.length)return!0;let l=1,n=t[0];for(;l<t.length;){let e=t[l];if("view"===e){if(!t[l+1])return!1;n=t[l+1],l+=2;continue}if("opts"===e){if(!t[l+1]||!(0,T.decodeOpenViewRouteState)(n,t[l+1]))return!1;l+=2;continue}if(eB(e)&&t[l+1]){l+=2;continue}return!t[l+1],!1}return!0};class eV extends T.FlowModel{registerRoutePage(e,t){this.routePageMetaMap.set(e,t),this.restoreCurrentLayoutRouteFromRouterContext(e);let l=this.getCoordinator().registerPage(e,t);return this.getCoordinator().syncRoute(this.getCurrentCoordinatorRouteLike()),l}updateRoutePage(e,t){let l=this.routePageMetaMap.get(e)||{active:!1},n={...l,...t,active:"boolean"==typeof t.active?t.active:l.active};this.routePageMetaMap.set(e,n),this.getCoordinator().syncPageMeta(e,t)}unregisterRoutePage(e){this.routePageMetaMap.delete(e),this.activePageUid===e&&(this.activePageUid=""),this.getCoordinator().unregisterPage(e)}setLayoutContentElement(e){this.layoutContentElement=e,this.getCoordinator().setLayoutContentElement(e)}setIsMobileLayout(e){this.isMobileLayout=!!e}getCurrentRouteByPageUid(e){var t,l;return(null==(l=this.flowEngine.context.routeRepository)||null==(t=l.getRouteBySchemaUid)?void 0:t.call(l,e))||{}}get layout(){return this.props.layout||{...e_,uid:this.uid||e_.uid}}getCoordinator(){return this.routeCoordinator||(this.routeCoordinator=this.createRouteCoordinator()),this.routeCoordinator}createRouteCoordinator(){return new eF(this.flowEngine,this.getRouteCoordinatorOptions())}getRouteCoordinatorOptions(){return{layout:this.layout,layoutContext:this.context}}getPageUidFromRoute(e){var t,l;return(null==e?void 0:e.pageUid)?e.pageUid:(null==e||null==(t=e.layoutRoute)?void 0:t.type)==="page"?e.layoutRoute.pageUid:(null==e||null==(l=e.params)?void 0:l.name)||""}isLayoutContentRoute(e){if(null==e?void 0:e.layoutRouteName)return e.layoutRouteName===this.layout.routeName;let t=(null==e?void 0:e.name)||(null==e?void 0:e.id);return eI(this.layout.routeName,t)}resolveLayoutRoute(e){var t,l,n,r;let i=eN(null==e?void 0:e.pathname),o=e.layoutBasePathname||e$(this.layout.routePath),a=o?eD(o):"";if(!a)return{type:"notFound",pathname:i,basePathname:"",relativePath:""};let s=eO(i,a);if(null===s)return{type:"notFound",pathname:i,basePathname:a,relativePath:""};if(!s)return{type:"root",pathname:i,basePathname:a,relativePath:s};if(!eq(s))return{type:"notFound",pathname:i,basePathname:a,relativePath:s};let d=(0,T.parsePathnameToViewParams)(i,{basePath:a}),u=null==(t=d[0])?void 0:t.viewUid;if(!u)return{type:"notFound",pathname:i,basePathname:a,relativePath:s};let c=this.flowEngine.context.routeRepository,p=null==c||null==(l=c.getRouteBySchemaUid)?void 0:l.call(c,u),h=p||null==c||null==(n=c.getRouteById)?void 0:n.call(c,u);return p||(null==h?void 0:h.type)!==eC.q2.group?{type:"page",pathname:i,basePathname:a,relativePath:s,pageUid:u,tabUid:null==(r=d[0])?void 0:r.tabUid,viewStack:d}:{type:"root",pathname:i,basePathname:a,relativePath:s}}getPageUidFromLayoutRoute(e){return(null==e?void 0:e.type)==="page"?e.pageUid:""}syncLayoutRoute(e){if(!this.isLayoutContentRoute(e))return this.clearLayoutRoute(),null;let t=this.resolveLayoutRoute(e);return this.currentLayoutRoute=t,this.currentRouteState=e.state,this.activePageUid=this.getPageUidFromLayoutRoute(t),this.getCoordinator().syncRoute({...e,layoutRouteName:this.layout.routeName,pageUid:this.activePageUid,pathname:t.pathname,layoutBasePathname:t.basePathname,layoutRoute:t}),t}clearLayoutRoute(e){var t,l;let n=(null==e?void 0:e.pathname)?eN(e.pathname):"";n&&(null==(t=this.currentLayoutRoute)?void 0:t.pathname)&&n!==this.currentLayoutRoute.pathname||this.shouldIgnoreStaleLayoutRouteCleanup(e)||(this.currentLayoutRoute=null,this.currentRouteState=void 0,this.activePageUid="",null==(l=this.routeCoordinator)||l.syncRoute({}))}onMount(){super.onMount(),this.setupContextBindings()}onUnmount(){this.teardownRuntime(),super.onUnmount()}setupContextBindings(){this.contextBindingsActive=!0,this.context.defineProperty("layoutContext",{get:()=>this.contextBindingsActive?this.context:void 0,cache:!1}),this.context.defineProperty("currentRoute",{get:()=>this.contextBindingsActive?this.getCurrentRouteByActivePage():{},cache:!1}),this.context.defineProperty("layoutContentElement",{get:()=>this.contextBindingsActive?this.layoutContentElement:null,cache:!1}),this.context.defineProperty("isMobileLayout",{get:()=>!!this.contextBindingsActive&&this.isMobileLayout,observable:!0,cache:!1}),this.context.defineProperty("layout",{get:()=>this.contextBindingsActive?this.layout:void 0,cache:!1}),this.context.defineProperty("layoutRoute",{get:()=>this.contextBindingsActive?this.currentLayoutRoute:void 0,observable:!0,cache:!1})}teardownRuntime(){var e;this.contextBindingsActive=!1,null==(e=this.routeCoordinator)||e.destroy(),this.routeCoordinator=void 0,this.routePageMetaMap.clear(),this.activePageUid="",this.currentLayoutRoute=null,this.layoutContentElement=null}getCurrentRouteByActivePage(){return this.activePageUid?this.getCurrentRouteByPageUid(this.activePageUid):{}}getCurrentCoordinatorRouteLike(){var e;return(null==(e=this.currentLayoutRoute)?void 0:e.type)==="page"?{layoutRouteName:this.layout.routeName,pageUid:this.currentLayoutRoute.pageUid,pathname:this.currentLayoutRoute.pathname,state:this.currentRouteState,layoutBasePathname:this.currentLayoutRoute.basePathname,layoutRoute:this.currentLayoutRoute}:{}}restoreCurrentLayoutRouteFromRouterContext(e){var t;if((null==(t=this.currentLayoutRoute)?void 0:t.type)==="page")return;let l=this.getRouterContextRouteLike();if(!l||!this.isRouteLikeOwnedByCurrentLayout(l))return;let n=this.resolveLayoutRoute({...l,layoutRouteName:l.layoutRouteName||this.layout.routeName});"page"===n.type&&n.pageUid===e&&(this.currentLayoutRoute=n,this.activePageUid=n.pageUid)}shouldIgnoreStaleLayoutRouteCleanup(e){var t;if(!(null==e?void 0:e.pathname)||(null==(t=this.currentLayoutRoute)?void 0:t.type)!=="page")return!1;let l=this.currentLayoutRoute;if(!this.routePageMetaMap.has(l.pageUid)||eN(e.pathname)!==l.pathname)return!1;let n=this.getRouterContextRouteLike();if(!n||!this.isRouteLikeOwnedByCurrentLayout(n))return!1;let r=this.resolveLayoutRoute({...n,layoutRouteName:n.layoutRouteName||this.layout.routeName});return"page"===r.type&&r.pageUid===l.pageUid&&r.pathname===l.pathname}getRouterContextRouteLike(){let e=this.flowEngine.context.route;return(null==e?void 0:e.pathname)?{id:e.id,name:e.name||e.id,pathname:e.pathname,params:e.params,layoutRouteName:e.layoutRouteName,layoutBasePathname:e.layoutBasePathname}:null}isRouteLikeOwnedByCurrentLayout(e){if(e.layoutRouteName)return e.layoutRouteName===this.layout.routeName;let t=e$(this.layout.routePath);if(e.layoutBasePathname&&t)return eD(e.layoutBasePathname)===eD(t);let l=e.name||e.id;return this.isLayoutContentRoute(e)||eL(this.layout.routeName,l)}constructor(e){super(e),(0,j._)(this,"isMobileLayout",!1),(0,j._)(this,"currentLayoutRoute",null),(0,j._)(this,"routeCoordinator",void 0),(0,j._)(this,"activePageUid",""),(0,j._)(this,"currentRouteState",void 0),(0,j._)(this,"layoutContentElement",null),(0,j._)(this,"routePageMetaMap",new Map),(0,j._)(this,"contextBindingsActive",!1),(0,R.define)(this,{isMobileLayout:R.observable.ref,currentLayoutRoute:R.observable.ref})}}function ez(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{required:n=!1,create:r=!1,props:i,use:o}=l,a=e.getModel(t);if(!a&&r){let l=o;if(!l)throw Error(`[NocoBase] Cannot create layout model ${t} without model class.`);a=e.createModel({uid:t,use:l,props:i})}if(a&&i&&a.setProps(i),!a&&n)throw Error(`[NocoBase] FlowRoute requires layout model ${t}. Please render FlowRoute under Layout.`);return a}var eK=l(92275),eU=l(71021),eW=l(18492);function eH(e){return e.startsWith("/")?e:`/${e}`}function eG(e){let t=eH(String(e||"/").trim()||"/").replace(/\/{2,}/g,"/");return t.endsWith("/")?t:`${t}/`}function eY(e){let t=/\/(apps|_app)\/([^/?#]+)(?=\/|[?#]|$)/.exec(eH(String(e||"/")));return t?`/${t[1]}/${t[2]}`:""}function eJ(e,t){let l=eG(e).replace(/\/+$/,""),n=eH(String(t||"/").split(/[?#]/)[0]).replace(/\/{2,}/g,"/"),r=l&&(n===l||n.startsWith(`${l}/`))?n.slice(l.length)||"/":n,i=/^\/(?:settings\/)?(apps|_app)\/([^/]+)(?=\/|$)/.exec(r);return i?`/${i[1]}/${i[2]}`:""}function eX(e){let t=eH(String(e||"/settings")).replace(/\/{2,}/g,"/");return"/"===t?"/settings":t.replace(/\/+$/,"")}function eQ(e){return"/settings"===e?"":e.replace(/^\/settings(?=\/|$)/,"")}function eZ(e,t,l){let n=eG(e),r="/"===n?"":n.replace(/\/+$/,""),i=eX(l);return t?`${r}/settings${t}${eQ(i)}`:`${r}${i}`}function e0(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("/")?e:`/${e}`:"/"}function e1(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.endsWith("/")?e:`${e}/`:"/"}function e2(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.replace(/\/+$/g,"")}function e5(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.replace(/^\/+/,"")}function e4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function e8(e){return e1(e0(String(e||"/").trim()||"/"))}function e3(e){let t=new URL(e0(String(e||"/").trim()||"/"),"http://nocobase.local").pathname.replace(/\/{2,}/g,"/");return"/"!==t&&t.endsWith("/")?e2(t):t}function e6(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("?")?e:`?${e}`:""}function e9(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("#")?e:`#${e}`:""}function e7(e){if("string"!=typeof e)return{pathname:(null==e?void 0:e.pathname)||"/",search:(null==e?void 0:e.search)||"",hash:(null==e?void 0:e.hash)||""};let t=e.indexOf("#"),l=e.indexOf("?"),n=l>=0,r=t>=0,i=n?l:r?t:e.length,o=r?t:e.length;return{pathname:e.slice(0,i)||"/",search:n?e.slice(l,o):"",hash:r?e.slice(t):""}}function te(e,t){if(!t||"/"===t)return e;let l=e4(t),n=RegExp(`^${l.replace(/\/?$/,"")}(\\/|$)`);return e.replace(n,"/")||e}function tt(e){return e8(e.getPublicPath())}function tl(e){return e2(tt(e))||"/"}function tn(){return"u">typeof window?window:void 0}function tr(){let e=tn(),t=null==e?void 0:e.__nocobase_modern_client_prefix__;if("string"==typeof t&&t.trim())return e5(e2(t.trim()));let l=null==e?void 0:e.__nocobase_public_path__;if("string"==typeof l&&l.trim()){let e=e2(l.trim()).split("/"),t=e[e.length-1];if(t)return t}return"v"}function ti(e){let t=e8(e),l=tr(),n=RegExp(`/${e4(l)}/?$`);return e8(t.replace(n,"/"))}function to(e){var t,l;let n=null==(l=e.router)||null==(t=l.getBasename)?void 0:t.call(l);return n?e8(n):tt(e)}function ta(e,t){let l=e8(e),n=e3(t);return"/"===l?n:"/"===n?e2(l)||"/":e3(`/${e5(l)}/${e5(n)}`)}function ts(e){var t,l;return(null==(l=e.pluginSettingsManager)||null==(t=l.getRouteName)?void 0:t.call(l,""))==="settings."}function td(e){let t=e8(e.getPublicPath());if(ts(e))return t;let l=e2(t).split("/");return l.pop(),e8(l.join("/")||"/")}function tu(e){var t,l;return eJ(e.getPublicPath(),null==(l=e.router)||null==(t=l.getBasename)?void 0:t.call(l))||(e.name&&"main"!==e.name?eY(`/apps/${e.name}`):"")}function tc(e){return eZ(td(e),tu(e),"/settings")}function tp(e,t){let l=e3(t),n=e3(tc(e));return l===n||l.startsWith(`${n}/`)}function th(e,t){let l=e3(t),n=e2(td(e))||"",r=n&&l.startsWith(`${n}/`)?l.slice(n.length):l;return/^\/settings(?:\/|$)/.test(r)}function tm(e){return ts(e)?ta(tc(e),"/signin"):ta(to(e),"/signin")}function tf(e,t){var l,n;let r=e3(t);for(let t of[null==(n=e.router)||null==(l=n.getBasename)?void 0:l.call(n),tl(e)]){if(!t)continue;let e=e3(te(r,t));if(e!==r)return e}return r}function tg(e){return ta(to(e),"/admin")}function tv(e){return!!e&&e.startsWith("/")&&!e.startsWith("//")&&!e.startsWith("/\\")}function ty(e,t){return"/"!==e&&e.endsWith("/")&&!t.endsWith("/")?`${t}/`:t}function tb(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/admin/",n=e2(to(e))||"/",r=tv(l)?l:"/admin/",{pathname:i,search:o,hash:a}=e7(tv(t)?t:r),s=e3(i);if(tp(e,s)||"/"===n||s===n||s.startsWith(`${n}/`))return`${ty(i,s)}${e6(o)}${e9(a)}`;let d=e2(tt(e))||"/";"/"!==d&&(s===d||s.startsWith(`${d}/`))&&({pathname:i,search:o,hash:a}=e7(r),s=e3(i)),th(e,s)&&({pathname:i,search:o,hash:a}=e7(r),s=e3(i));let u=ty(i,ta(n,s));return`${u}${e6(o)}${e9(a)}`}function tx(e,t){let l=tf(e,(null==t?void 0:t.pathname)||"/"),n=e6((null==t?void 0:t.search)||""),r=e9((null==t?void 0:t.hash)||"");return`${ta(to(e),l)}${n}${r}`}function tw(e,t){return`${tm(e)}?redirect=${encodeURIComponent(t)}`}function tS(e,t,l){let n=tw(e,t);if((null==l?void 0:l.replace)===!1){window.location.href=n;return}window.location.replace(n)}function tA(e,t){let l;if(!e)return null;try{l=new URL(e,window.location.origin)}catch(e){return null}return l.origin===window.location.origin&&new Set(ts(t)?[tm(t)]:["/signin",tm(t)]).has(l.pathname)?l.toString():null}let tM="[NocoBase] Admin route runtime target:",tF="/admin",tk={runtimePath:null,navigationMode:"spa",isLegacy:!1,reason:"unsupportedRouteType"};function tC(e){let t=`/${String(e||"/").trim()||"/"}`.replace(/\/{2,}/g,"/");return"/"!==t&&t.endsWith("/")?t.replace(/\/+$/g,""):t}function tP(e){let t="string"==typeof(null==e?void 0:e.routePath)?e.routePath.trim():"";return t.startsWith("/")?tC(t):tF}function tj(e,t){let l=tP(e),n=null==t?"":String(t).replace(/^\/+/,"");return n?tC(`${l}/${n}`):l}function tE(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=tC(e||"/");return t.endsWith("/")?t:`${t}/`}function tR(e){return!!(null==e?void 0:e.getPublicPath)&&tE(e.getPublicPath()).endsWith(`/${tr()}/`)}function tT(e,t){let l=tC(e),n=t&&"/"!==t?tC(t):"";return n?l===n?"/":l.startsWith(`${n}/`)?tC(l.slice(n.length)):l:l}function tI(e,t){let l=tE(e),n=tC(t);return"/"===l?n:"/"===n?l.replace(/\/+$/g,"")||"/":tC(`${l}${n.slice(1)}`)}function t_(e,t,l){return tI(to(e),tj(l,t))}function tD(e,t){let l=(null==t?void 0:t.search)?t.search.startsWith("?")?t.search:`?${t.search}`:"",n=(null==t?void 0:t.hash)?t.hash.startsWith("#")?t.hash:`#${t.hash}`:"";return`${e}${l}${n}`}function tN(e,t,l){null==e||e(tM,t,l)}function tO(e){return!!e&&(e.type===eC.q2.tabs||!0===e.hideInMenu||!0===e.hidden)}function t$(e){return!!e&&!0!==e.hidden&&!0!==e.hideInMenu&&(e.type===eC.q2.flowPage||e.type===eC.q2.link||e.type===eC.q2.group&&Array.isArray(e.children)&&e.children.some(e=>t$(e)))}function tB(e){if(Array.isArray(e)){for(let t of e)if(t&&!0!==t.hidden&&!0!==t.hideInMenu&&t.type!==eC.q2.tabs){if(t.type===eC.q2.flowPage)return t;if(t.type===eC.q2.group){let e=tB(t.children);if(e)return e}}}}function tL(e){if(Array.isArray(e)){for(let t of e)if(!tO(t)){if(t.type===eC.q2.page||t.type===eC.q2.flowPage)return t;if(t.type===eC.q2.group){let e=tL(t.children);if(e)return e}}}}function tq(e,t){let{app:l,preserveLocationState:n,location:r,log:i=console.warn}=e;return t.schemaUid?t.type===eC.q2.flowPage?{runtimePath:t_(l,t.schemaUid,e.layout),navigationMode:"spa",isLegacy:!1,reason:"ok"}:tR(l)?{...tk,reason:"unsupportedV2Runtime"}:{runtimePath:n&&r?tD(t_(l,t.schemaUid,e.layout),r):t_(l,t.schemaUid,e.layout),navigationMode:"spa",isLegacy:!1,reason:"ok"}:(tN(i,"Missing schemaUid.",t),{...tk,reason:"missingSchemaUid"})}function tV(e){let{route:t,log:l=console.warn}=e;if(!t)return tk;if(t.type===eC.q2.page||t.type===eC.q2.flowPage)return tq(e,t);if(t.type===eC.q2.group){let l=tR(e.app)?tB(t.children):tL(t.children);return l?tV({...e,route:l}):{...tk,reason:"emptyGroup"}}return t.type!==eC.q2.link&&tN(l,"Unsupported route type.",t),tk}class tz extends eF{constructor(e,t={}){super(e,{basePathname:"/admin",...t})}}let tK="admin-layout-model";var tU=l(18853),tW=l(16362),tH=l(42443),tG=l(55373),tY=l.n(tG);let tJ=220,tX=e=>{let{isMobile:t,closeMobileMenu:l,callback:n,delayMs:r=tJ}=e;t?(l(),window.setTimeout(n,r)):n()},tQ=e=>{let{theme:t}=el();return(0,E.jsx)(G.Ay,{theme:{...t,inherit:!1},children:e.children})};var tZ=l(53619);let t0=(0,D.createContext)(null);t0.displayName="NocoBaseRouteContext";let t1=(0,D.createContext)(null);t1.displayName="ParentRouteContext";let t2=(0,D.createContext)(null);t2.displayName="NavigateNoUpdateContext";let t5=()=>{let e=(0,D.useContext)(t2),t=(0,L.useNavigate)();return e||t},t4=()=>(0,L.useHref)("/");function t8(e,t){if(!t)return e;let l=e.indexOf("#"),n=l>=0,r=n?e.slice(0,l):e,i=n?e.slice(l+1):"",o=i.startsWith("/")||i.startsWith("!/");if(n&&o){let e=i.includes("?")?"&":"?";return`${r}#${i}${e}${t}`}let a=r.includes("?")?"&":"?";return n?`${r}${a}${t}#${i}`:`${r}${a}${t}`}function t3(e){if(_().isPlainObject(e)){let t={};return Object.keys(e).forEach(l=>{_().isPlainObject(e[l])||_().isArray(e[l])||_().isString(e[l])&&e[l].length>100||(t[l]=e[l])}),t}return _().isArray(e)?e.map(e=>_().isPlainObject(e)||_().isArray(e)?t3(e):e):e}function t6(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.origin;return e?(0,er.isURL)(e)?e:e.startsWith("/")?`${t}${e}`:`${t}/${e}`:""}function t9(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.origin;return _().isString(e)?(0,er.isURL)(e)?void(e.startsWith(l)?t(t6(e.replace(l,""),"")):window.open(e,"_self")):void t(t6(e,"")):console.error("link should be a string")}let t7={display:"flex",alignItems:"center",gap:4},le=e=>t=>{let{tooltip:l}=t;return l?(0,E.jsxs)("div",{style:t7,children:[(0,E.jsx)(e,{...t}),(0,E.jsx)(tH.A,{title:l,children:(0,E.jsx)(tZ.A,{style:{zIndex:1}})})]}):(0,E.jsx)(e,{...t})},lt=(0,D.createContext)({scopeId:"",type:""}),ll=e=>{let t=(0,D.useContext)(lt),l=(0,D.useMemo)(()=>({scopeId:e.scopeId,type:e.type,parent:t}),[t,e.scopeId,e.type]);return(0,E.jsx)(lt.Provider,{value:l,children:e.children})},ln=/^\s*\{\{\s*([\p{L}0-9_$-.]+?)\s*\}\}\s*$/u,lr=e=>"string"==typeof e&&ln.test(e),li=(e,t)=>{let[l,n]=(0,D.useState)();return(0,D.useEffect)(()=>{let l=!0;return(async()=>{if(null==e||""===e){l&&n(void 0);return}if(!(null==t?void 0:t.resolveJsonTemplate)){l&&n(e);return}try{let r=await t.resolveJsonTemplate(e);if(!l)return;if("string"==typeof r&&""!==r.trim()&&Number.isFinite(Number(r)))return void n(Number(r));n(r)}catch(e){console.error(e)}})(),()=>{l=!1}},[t,e]),l};function lo(e){let{pageSchemaUid:t,tabSchemaUid:l,tabSchemaName:n}=e;return{type:"void","x-component":"Page",properties:{[n]:{type:"void","x-component":"Grid","x-initializer":"page:addBlock",properties:{},"x-uid":l,"x-async":!0}},"x-uid":t}}function la(e){let{pageSchemaUid:t}=e;return{type:"void","x-component":"FlowRoute","x-uid":t}}let ls=(e,t,l)=>tj(l,`__admin_layout__/${e}/${encodeURIComponent(String(t))}`),ld=e=>{let t=e.context.layout;if(null==t?void 0:t.routePath)return t;let l=e;for(;l;){var n;let e=null==(n=l.props)?void 0:n.layout;if(null==e?void 0:e.routePath)return e;l=l.parent}},lu={display:"flex",alignItems:"center",justifyContent:"space-between"},lc={display:"inline-flex",alignItems:"center",justifyContent:"center",marginLeft:8,color:"inherit"},lp=[{pattern:/^\$user(?:\.(.+))?$/,resolve:e=>`ctx.user${e[1]?`.${e[1]}`:""}`},{pattern:/^currentUser(?:\.(.+))?$/,resolve:e=>`ctx.user${e[1]?`.${e[1]}`:""}`},{pattern:/^\$nRole$/,resolve:()=>"ctx.role"},{pattern:/^\$nToken$/,resolve:()=>"ctx.token"},{pattern:/^\$nURLSearchParams(?:\.(.+))?$/,resolve:e=>`ctx.urlSearchParams${e[1]?`.${e[1]}`:""}`}],lh=e=>"string"==typeof e&&e.includes("{{")?e.replace(/\{\{\s*([\s\S]*?)\s*\}\}/g,(e,t)=>{let l=String(t||"").trim();for(let e of lp){let t=l.match(e.pattern);if(t)return`{{ ${e.resolve(t)} }}`}return e}):e,lm=async e=>{let{context:t,href:l,params:n=[]}=e,r="string"==typeof l?lh(l):l,i=await t.resolveJsonTemplate(r),o={};for(let{name:e,value:l}of n)if(e)try{let n="string"==typeof l?await t.resolveJsonTemplate(lh(l)):l;if(null==n)continue;o[e]=t3(n)}catch(e){console.error(e)}return t8(String(i??l??""),tY().stringify(o))};function lf(e){return e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:""}function lg(e){return/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("?")}function lv(e,t){if(!e||lg(e))return e;let l=lf(t);if(!l)return e;let n=e.startsWith("/")?e:`/${e}`;return n===l||n.startsWith(`${l}/`)||n.startsWith(`${l}?`)||n.startsWith(`${l}#`)?n:`${l}${n}`}let ly=async e=>{let{context:t,href:l,params:n,openInNewWindow:r,isMobile:i,closeMobileMenu:o,navigate:a,basenameOfCurrentRouter:s}=e;try{let e=await lm({context:t,href:l,params:n||[]});if(!1!==r){i&&o(),window.open(lv(e,s),"_blank","noopener,noreferrer");return}tX({isMobile:!!i,closeMobileMenu:o,callback:()=>{t9(e,a,window.location.origin+s)}})}catch(e){console.error(e),i&&o(),window.open(lv(l,s),"_blank","noopener,noreferrer")}},lb=e=>!!e&&"function"==typeof e.getRoute,lx=(e,t)=>"function"==typeof e.context.t?e.context.t(t):t,lw=[{key:"group",label:"Group",menuType:"group"},{key:"flow-page",label:"Page",menuType:"flowPage"},{key:"link",label:"Link",menuType:"link"}],lS=(e,t)=>({uid:`${e.uid}-menu-creation-${(0,er.uid)()}`,use:"AdminLayoutMenuItemModel",props:{creationMeta:t}}),lA=(e,t)=>{let l=t=>lx(e,t),n=t?"sider":"header";return lw.map(r=>({key:r.key,label:l(r.label),createModelOptions:()=>lS(e,{menuType:r.menuType,source:n,parentRoute:t})}))},lM=e=>{let t=t=>lx(e.launcherModel,t);return(0,E.jsx)(T.AddSubModelButton,{model:e.launcherModel,subModelKey:"menuItems",items:lA(e.launcherModel,e.parentRoute),children:(0,E.jsx)(T.FlowSettingsButton,{"data-testid":e.testId,style:{background:"none"},icon:(0,E.jsx)(tU.A,{}),children:t("Add menu item")})})},lF=e=>e.icon?(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,E.jsx)(eC.In,{type:e.icon}),(0,E.jsx)("span",{children:e.title})]}):(0,E.jsx)(E.Fragment,{children:e.title}),lk=le(e=>(0,E.jsx)(E.Fragment,{children:e.children})),lC=D.createContext({closeMobileMenu:()=>{}}),lP=D.createContext({inHeader:!1}),lj=(e,t,l)=>{var n;let[r,i]=(null==e||null==(n=e.split)?void 0:n.call(e,"||"))||[],o=[{label:l("Before"),value:"beforeBegin"},{label:l("After"),value:"afterEnd"}];return i!==eC.q2.group?o:[...o,{label:l("Inner"),value:"beforeEnd",disabled:void 0!==t&&String(t)===r}]};function lE(e,t,l){let n=t.id??t.schemaUid??t.menuSchemaUid??t.pageSchemaUid??t.title??`${t.type}-${l}`;return`${e}-menu-item-${t.type||"unknown"}-${n}`}function lR(e,t,l){let n=[...e.subModels.menuItems||[]],r=new Map(n.map(e=>[e.uid,e])),i=[],o=new Set;t.forEach((t,n)=>{let a=lE(e.uid,t,n),s=r.get(a),d=!!s;if(s||(s=e.addSubModel("menuItems",{uid:a,use:"AdminLayoutMenuItemModel",props:{route:t,parentRoute:l}})),s.sortIndex=n+1,d){var u;null==(u=s.syncFromRoute)||u.call(s,t,l)}i.push(s),o.add(a)}),n.forEach(t=>{o.has(t.uid)||e.flowEngine.removeModelWithSubModels(t.uid)}),e.subModels.menuItems=i}function lT(e,t){var l,n;if(!lb(e)||!lb(t))return;let r=null==(l=e.getRoute)?void 0:l.call(e),i=null==(n=t.getRoute)?void 0:n.call(t);if((null==r?void 0:r.id)&&(null==i?void 0:i.id)&&r.id!==i.id)return{sourceId:r.id,targetId:i.id,sortField:"sort"}}function lI(e,t){var l,n;if((null==(l=t.active)?void 0:l.id)&&(null==(n=t.over)?void 0:n.id))return lT(e.getModel(String(t.active.id)),e.getModel(String(t.over.id)))}let l_=e=>{var t,l,n,r,i,o,a,s,d;let{item:u}=e,c=li(null==(l=u._route.options)||null==(t=l.badge)?void 0:t.count,null==(n=u._model)?void 0:n.context),p=t5(),h=t4(),{closeMobileMenu:m}=(0,D.useContext)(lC),f="string"==typeof u.name||"number"==typeof u.name?String(u.name):"string"==typeof(null==(r=u._route)?void 0:r.title)||"number"==typeof(null==(i=u._route)?void 0:i.title)?String(u._route.title):void 0,g=u._runtimePath,v=g?tT(g,h):g,y=(0,D.useCallback)(t=>{var l,n;if(!g){t.preventDefault(),t.stopPropagation();return}let r=0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented;if("document"===u._navigationMode){if(r)return;t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(n=e.options)?void 0:n.isMobile),closeMobileMenu:m,callback:()=>{window.location.assign(g)}});return}t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(l=e.options)?void 0:l.isMobile),closeMobileMenu:m,callback:()=>{v&&p(v)}})},[m,u,p,null==(o=e.options)?void 0:o.isMobile,g,v]),b=f?`${f}-landing-entry`:"group-landing-entry",x=e.children,w=g?"document"===u._navigationMode?(0,E.jsx)("a",{href:g,"aria-label":b,onClick:y,style:lc}):(0,E.jsx)(B.Link,{to:v||g,"aria-label":b,onClick:y,style:lc}):null;return(0,E.jsx)(t1.Provider,{value:u._parentRoute,children:(0,E.jsx)(t0.Provider,{value:u._route,children:(0,E.jsxs)("div",{"aria-label":f,role:"none",style:lu,children:[x,w,null!=c&&(0,E.jsx)(tW.A,{...null==(a=u._route.options)?void 0:a.badge,count:c,style:{marginLeft:4,color:null==(d=u._route.options)||null==(s=d.badge)?void 0:s.textColor,maxWidth:"10em"},dot:!1})]})})})},lD=e=>{let{inHeader:t}=(0,D.useContext)(lP);return e.hidden||t?e.children:(0,E.jsx)(tH.A,{title:e.title,placement:"right",children:(0,E.jsx)(tW.A,{...e.badgeProps,style:{transform:"none",maxWidth:"10em"},dot:!1,children:e.children})})},lN=e=>{var t,l,n,r,i,o,a,s,d,u,c,p,h;let{item:m}=e,f=(0,L.useLocation)(),g=li(null==(l=m._route.options)||null==(t=l.badge)?void 0:t.count,null==(n=m._model)?void 0:n.context),v=t5(),y=t4(),{closeMobileMenu:b}=(0,D.useContext)(lC),x=m.redirect||m.path,w=m._runtimePath||x,S=w?tT(w,y):w,A="document"===m._navigationMode,M={...null==(r=m._route.options)?void 0:r.badge,count:g},F=!!w&&A,k=e=>!e.defaultPrevented&&0===e.button&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,C=(0,D.useCallback)(async t=>{var l,n,r,i,o;let a=null==(l=m._route.options)?void 0:l.href,s=null==(n=m._route.options)?void 0:n.params,d=null==(r=m._route.options)?void 0:r.openInNewWindow;t.preventDefault(),t.stopPropagation(),await ly({context:null==(i=m._model)?void 0:i.context,href:a,params:s,openInNewWindow:d,isMobile:!!(null==(o=e.options)?void 0:o.isMobile),closeMobileMenu:b,navigate:v,basenameOfCurrentRouter:y})},[m,null==(i=e.options)?void 0:i.isMobile,b,v,y]),P=(0,D.useCallback)(t=>{var l,n,r;if(!w){t.preventDefault(),t.stopPropagation();return}if(A){if(!k(t))return;t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(r=e.options)?void 0:r.isMobile),closeMobileMenu:b,callback:()=>{window.location.assign(w)}});return}if(t.preventDefault(),t.stopPropagation(),!(null==(l=e.options)?void 0:l.isMobile)){S&&v(S);return}tX({isMobile:!!(null==(n=e.options)?void 0:n.isMobile),closeMobileMenu:b,callback:()=>{S&&v(S)}})},[null==(o=e.options)?void 0:o.isMobile,b,A,v,w,S]);if((null==(a=m._route)?void 0:a.type)===eC.q2.link)return(0,E.jsx)(t1.Provider,{value:m._parentRoute,children:(0,E.jsx)(t0.Provider,{value:m._route,children:(0,E.jsxs)("div",{role:"none",style:lu,children:[(0,E.jsx)("div",{onClick:C,children:(0,E.jsx)(B.Link,{to:f.pathname,"aria-label":"string"==typeof m.name?m.name:void 0,children:e.children})}),null!=g&&(0,E.jsx)(tW.A,{...null==(c=m._route.options)?void 0:c.badge,count:g,style:{marginLeft:4,color:null==(h=m._route.options)||null==(p=h.badge)?void 0:p.textColor,maxWidth:"10em"},dot:!1})]})})});let j=(0,E.jsx)(lD,{title:m.name,hidden:m._route.type===eC.q2.group||(m._depth||0)>0||!(null==(s=e.options)?void 0:s.collapsed),badgeProps:M,children:F?(0,E.jsx)("a",{href:w,"aria-label":"string"==typeof m.name?m.name:void 0,onClick:P,children:e.children}):w?(0,E.jsx)(B.Link,{to:S,"aria-label":"string"==typeof m.name?m.name:void 0,onClick:P,children:e.children}):(0,E.jsx)("span",{"aria-label":"string"==typeof m.name?m.name:void 0,children:e.children})});return(0,E.jsx)(t1.Provider,{value:m._parentRoute,children:(0,E.jsx)(t0.Provider,{value:m._route,children:(0,E.jsxs)("div",{role:"none",style:lu,children:[j,null!=g&&(0,E.jsx)(tW.A,{...M,style:{marginLeft:4,color:null==(u=m._route.options)||null==(d=u.badge)?void 0:d.textColor,maxWidth:"10em"},dot:!1})]})})})},lO=e=>{var t;let{model:l}=e;if(!lb(l))return null;let n=null==(t=l.getRoute)?void 0:t.call(l);return(null==n?void 0:n.id)?(0,E.jsx)(T.DragHandler,{model:l}):null},l$=e=>{var t;let{item:l,dom:n,options:r,renderType:i}=e;if(!l||!i)return null;let o=(0,E.jsx)(lk,{tooltip:null==(t=l._route)?void 0:t.tooltip,children:n});return"group"===i?(0,E.jsx)(ll,{scopeId:l._route.schemaUid,type:"groupItem",children:(0,E.jsx)(l_,{item:l,options:r,children:o})}):(0,E.jsx)(ll,{scopeId:l._route.schemaUid,type:"menuItem",children:(0,E.jsx)(lN,{item:l,options:r,children:o})})},lB=e=>{let{depth:t,isMobile:l}=e;return t>1||l&&t>0},lL=()=>(0,E.jsx)("span",{"data-nb-hidden-menu-item":"true"}),lq=(0,T.observer)(e=>{let{model:t,item:l,dom:n,renderType:r,options:i}=e,o=t.context.themeToken;return((0,D.useEffect)(()=>{t.setProps({item:l,dom:n,renderType:r,options:i})},[n,l,t,i,r]),!t.context.flowSettingsEnabled&&t.hidden)?(0,E.jsx)(lL,{}):(0,E.jsx)(tQ,{children:(0,E.jsx)(T.Droppable,{model:t,children:(0,E.jsx)(T.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1,style:{left:-o.padding,right:-o.padding}},extraToolbarItems:[{key:"menu-drag-handler",component:lO,sort:1}]})})})});function lV(e,t,l,n){let r=(null==l?void 0:l.id)??(null==l?void 0:l.schemaUid)??(null==l?void 0:l.menuSchemaUid)??(null==l?void 0:l.title)??t.uid,i=n||ld(t);return{key:"x-designer-button",name:(0,E.jsx)(lM,{testId:e,launcherModel:t,parentRoute:l}),path:ls("designer",r,i),disabled:!0,_route:{},_parentRoute:l,_launcherModel:t,icon:(0,E.jsx)(eC.In,{type:"setting"})}}let lz=(e,t,l)=>({name:l?(0,E.jsx)(lF,{icon:e.icon,title:t(e.title)}):t(e.title),icon:l?null:e.icon?(0,E.jsx)(eC.In,{type:e.icon}):null});var lK=l(12723),lU=l(73940),lW=l(98668),lH=l(87276),lG=l(28073),lY=l(95803),lJ=l(40961);let lX=e=>({href:{title:e("URL"),type:"string","x-decorator":"FormItem","x-component":"FlowSettingsVariableTextArea","x-component-props":{placeholder:e("https://www.example.com"),rows:1,maxRows:1},description:e("Do not concatenate search params in the URL")},params:{type:"array",title:e("Search parameters"),"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:e("Name")}},value:{type:"string","x-decorator":"FormItem","x-component":"FlowSettingsVariableTextArea","x-component-props":{placeholder:e("Value"),rows:1,maxRows:1,useTypedConstant:!0,changeOnSelect:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:e("Add parameter"),"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":e("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox"}}),lQ=async(e,t)=>{await e.request({method:"POST",url:"/uiSchemas:insert",data:t})},lZ=e=>e&&"link"===e.menuType&&"insert"!==e.source?{openInNewWindow:!0}:{},l0=[{label:"Group",value:"group"},{label:"Page",value:"flowPage"},{label:"Link",value:"link"}],l1=e=>({title:{title:e("Menu item title"),required:!0,"x-decorator":"FormItem","x-component":"Input"},icon:{title:e("Icon"),"x-decorator":"FormItem","x-component":"IconPicker"}}),l2=(e,t)=>Object.fromEntries(Object.entries(lX(e)).map(e=>{let[l,n]=e;return[l,{...n,"x-reactions":{dependencies:[t],fulfill:{state:{hidden:'{{$deps[0] !== "link"}}'}}}}]})),l5=e=>{var t,l,n;return{title:null==e?void 0:e.title,icon:null==e?void 0:e.icon,href:null==e||null==(t=e.options)?void 0:t.href,params:null==e||null==(l=e.options)?void 0:l.params,openInNewWindow:(null==e||null==(n=e.options)?void 0:n.openInNewWindow)!==!1}},l4=(e,t)=>{let l=l1(e);return(null==t?void 0:t.menuType)==="link"&&Object.assign(l,lX(e)),l},l8=e=>({menuType:{title:e("Menu type"),required:!0,enum:l0.map(t=>({label:e(t.label),value:t.value})),"x-decorator":"FormItem","x-component":"Radio.Group"},...l1(e),...l2(e,"menuType")}),l3=e=>({title:e.title,hideInSettings:e.hideInSettings,defaultParams:async()=>({menuType:"flowPage"}),uiSchema:async e=>l8(e.t),beforeParamsSave:async(t,l)=>{let n=t.model,r=n.getRoute();if(!r||e.canCreate&&!e.canCreate(r))return;let i=e.resolveParentRoute(t,r);await n.createMenuFromMeta({menuType:l.menuType,source:"insert",insertPosition:e.insertPosition,targetRoute:r,parentRoute:i},l)}}),l6=async(e,t)=>Promise.all((e||[]).filter(e=>e.type!==eC.q2.tabs).map(async e=>{var l,n;return{label:"string"==typeof e.title&&lr(e.title)?await (null==(l=t.resolveJsonTemplate)?void 0:l.call(t,e.title))??e.title:t.t(e.title),value:`${e.id}||${e.type}`,children:(null==(n=e.children)?void 0:n.length)?await l6(e.children,t):void 0}})),l9=(e,t)=>{if(t)for(let n=0;n<e.length;n++){var l;let r=e[n];if(r.id===t.id)return e[n-1];if(null==(l=r.children)?void 0:l.length){let e=l9(r.children,t);if(e)return e}}},l7=(e,t)=>{if(t)for(let n=0;n<e.length;n++){var l;let r=e[n];if(r.id===t.id)return e[n+1];if(null==(l=r.children)?void 0:l.length){let e=l7(r.children,t);if(e)return e}}},ne=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",n=arguments.length>3?arguments[3]:void 0;if(!e)return!1;let r=l&&"/"!==l?l.replace(/\/$/,""):"",i=r&&t.startsWith(r)?t.slice(r.length)||"/":t;return!![null!=e.id?tj(n,e.id):null,e.schemaUid?tj(n,e.schemaUid):null].filter(Boolean).some(e=>i===e||i.startsWith(`${e}/`))||!!Array.isArray(e.children)&&e.children.some(e=>ne(e,i,"/",n))},nt=(e,t,l,n)=>"flowPage"===e?la({pageSchemaUid:t}):lo({pageSchemaUid:t,tabSchemaUid:l,tabSchemaName:n}),nl={beforeBegin:"insertBefore",afterEnd:"insertAfter"},nn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={...e};return delete t.item,delete t.dom,delete t.options,delete t.renderType,t};function nr(e){return"function"==typeof(null==e?void 0:e.refreshMenuRouteTree)}function ni(e){let t=e.parent;for(;t;){if(nr(t))return t;t=t.parent}}class no extends T.FlowModel{onInit(e){super.onInit(e),this.syncFromRoute(this.props.route,this.props.parentRoute),this.shouldHydratePersistedState()&&this.hydratePersistedState()}syncFromRoute(e,t){(this.setProps({route:e,parentRoute:t}),(null==e?void 0:e.type)===eC.q2.group)?lR(this,Array.isArray(e.children)?e.children:[],e):((this.subModels.menuItems||[]).forEach(e=>{this.flowEngine.removeModelWithSubModels(e.uid)}),delete this.subModels.menuItems)}getRoute(){return this.props.route}getParentRoute(){return this.props.parentRoute}getCreationMeta(){return this.props.creationMeta}isCreationSession(){var e;return!!(null==(e=this.getCreationMeta())?void 0:e.menuType)}shouldHydratePersistedState(){return!this.isCreationSession()&&(!!this.context.flowSettingsEnabled||this.hasPersistedMenuInstanceFlowFlag())}getRouteRepository(){return this.context.routeRepository}getLayout(){let e=this.context.layout;if(null==e?void 0:e.routePath)return e;let t=this;for(;t;){var l;let e=null==(l=t.props)?void 0:l.layout;if(null==e?void 0:e.routePath)return e;t=t.parent}}hasPersistedMenuInstanceFlowFlag(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getRoute();return(null==t||null==(e=t.options)?void 0:e.hasPersistedMenuInstanceFlow)===!0}getCurrentPersistedInstanceFlowCount(){return this.flowRegistry.getFlows().size}hasPersistableMenuLinkageRules(){let e=this.getStepParams("menuSettings","linkageRules");return Array.isArray(null==e?void 0:e.value)&&e.value.length>0}hasCurrentPersistedMenuState(){return this.getCurrentPersistedInstanceFlowCount()>0||this.hasPersistableMenuLinkageRules()}buildRouteOptionsWithPersistedFlowFlag(e){let t=this.getRoute(),l={...(null==t?void 0:t.options)||{}};return e?l.hasPersistedMenuInstanceFlow=!0:delete l.hasPersistedMenuInstanceFlow,Object.keys(l).length>0?l:void 0}async syncPersistedFlowRouteFlag(){if(this.isCreationSession())return;let e=this.getRoute();if((null==e?void 0:e.id)==null)return;let t=this.hasCurrentPersistedMenuState();if(this.hasPersistedMenuInstanceFlowFlag(e)===t)return;let l=this.buildRouteOptionsWithPersistedFlowFlag(t);await this.getRouteRepository().updateRoute(e.id,{options:l}),this.setProps({route:{...e,options:l}})}async destroyPersistedState(){var e,t;this.isCreationSession()||await (null==(t=this.flowEngine.modelRepository)||null==(e=t.destroy)?void 0:e.call(t,this.uid))}async hydratePersistedState(){if(!this.persistedStateHydrated)return this.persistedStateHydrating||(this.persistedStateHydrating=(async()=>{if(this.isCreationSession())return;let e=!1,t=this.flowEngine.modelRepository;if(!(null==t?void 0:t.findOne))return;let l=await t.findOne({uid:this.uid});if(null==l?void 0:l.uid){if(l.stepParams&&"object"==typeof l.stepParams&&(this.setStepParams(l.stepParams),e=this.hasPersistableMenuLinkageRules()),l.flowRegistry&&"object"==typeof l.flowRegistry){for(let e of[...this.flowRegistry.getFlows().keys()])this.flowRegistry.removeFlow(e);this.flowRegistry.addFlows(l.flowRegistry);let t=Object.values(l.flowRegistry).some(e=>{var t;return!!e&&!0!==e.manual&&(!e.on||("string"==typeof e.on?"beforeRender"===e.on:(null==(t=e.on)?void 0:t.eventName)==="beforeRender"))});e=e||t}e&&this.rerender()}})().finally(()=>{this.persistedStateHydrated=!0,this.persistedStateHydrating=void 0})),await this.persistedStateHydrating}hasPersistableInstanceFlows(){var e;let t=this.flowRegistry.getFlows().size,l=Object.keys((null==(e=this._options)?void 0:e.flowRegistry)||{}).length;return t>0||l>0}serialize(){let e=super.serialize();return e.props=nn(e.props),e}setHidden(e){let t=this.hidden;if(super.setHidden(e),t!==this.hidden){var l,n,r;let e=null==(l=(n=this.flowEngine).getModel)?void 0:l.call(n,tK),t=ni(this)||(nr(e)?e:void 0);null==t||null==(r=t.refreshMenuRouteTree)||r.call(t)}}renderHiddenInConfig(){let{item:e,dom:t,options:l,renderType:n}=this.props;return e&&n?(0,E.jsx)("div",{style:{opacity:.3},children:(0,E.jsx)(l$,{item:e,dom:t,options:l,renderType:n})}):null}async createMenuRoute(e,t){let{parentId:l,refreshAfterMutation:n=!0}=t||{},r={...e,parentId:l??e.parentId??void 0},i=n?void 0:{refreshAfterMutation:!1},{data:o}=await this.getRouteRepository().createRoute(r,i);return null==o?void 0:o.data}async createRouteForInsert(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(()=>{var e;return(null==(e=this.getCreationMeta())?void 0:e.targetRoute)||this.getRoute()})(),n=await this.createMenuRoute(e,{parentId:"beforeEnd"===t?(null==l?void 0:l.id)||void 0:(null==l?void 0:l.parentId)||void 0,refreshAfterMutation:!1}),r=nl[t];if(r){try{await this.getRouteRepository().moveRoute({sourceId:null==n?void 0:n.id,targetId:null==l?void 0:l.id,sortField:"sort",method:r})}catch(e){throw await this.getRouteRepository().refreshAccessible(),e}return null==n?void 0:n.id}return await this.getRouteRepository().refreshAccessible(),null==n?void 0:n.id}async createMenuFromMeta(e,t){let l="flowPage"===e.menuType?eC.q2.flowPage:"page"===e.menuType?eC.q2.page:"group"===e.menuType?eC.q2.group:eC.q2.link,n=async t=>{var l;return e.insertPosition?this.createRouteForInsert(t,e.insertPosition,e.targetRoute):this.createMenuRoute(t,{parentId:null==(l=e.parentRoute)?void 0:l.id})};if("group"===e.menuType)return void await n({type:l,title:t.title,icon:t.icon,schemaUid:(0,er.uid)()});if("link"===e.menuType)return void await n({type:l,title:t.title,icon:t.icon,schemaUid:(0,er.uid)(),options:{href:t.href,params:t.params,openInNewWindow:t.openInNewWindow}});let r=(0,er.uid)(),i=(0,er.uid)(),o=(0,er.uid)(),a=(0,er.uid)();await n({type:l,title:t.title,icon:t.icon,schemaUid:r,menuSchemaUid:i,enableTabs:!1,children:[{type:eC.q2.tabs,schemaUid:o,tabSchemaName:a,hidden:!0}]})}async persistMenuCreation(e){let t=this.getCreationMeta();t&&await this.createMenuFromMeta(t,e)}async updateMenuRoute(e){let t=this.getRoute();if((null==t?void 0:t.id)==null)return;let l={...e};e.options&&this.hasPersistedMenuInstanceFlowFlag(t)&&(l.options={...e.options,hasPersistedMenuInstanceFlow:!0}),await this.getRouteRepository().updateRoute(t.id,l),this.setProps({route:{...t,...l}})}async moveMenuRoute(e,t){var l,n,r,i,o;let a=this.getRoute(),[s,d]=(null==e||null==(l=e.split)?void 0:l.call(e,"||"))||[];if(s&&(null==a?void 0:a.id)!=null){if("beforeEnd"===t&&d!==eC.q2.group)throw Error((null==(r=this.context)||null==(n=r.t)?void 0:n.call(r,"Only groups support inner moves"))||"Only groups support inner moves");if("beforeEnd"===t&&String(a.id)===s)throw Error((null==(o=this.context)||null==(i=o.t)?void 0:i.call(o,"A menu group cannot be moved inside itself"))||"A menu group cannot be moved inside itself");await this.getRouteRepository().moveRoute({sourceId:a.id,sortField:"sort",method:"beforeEnd"===t?void 0:nl[t],..."beforeEnd"===t?{targetScope:{parentId:s}}:{targetId:s}})}}async saveStepParams(){if(this.isCreationSession()){if(this.creationPersisted)return!0;let e=this.getStepParams("menuCreation","basic");return await this.persistMenuCreation(e||{}),this.creationPersisted=!0,!0}return this.hasCurrentPersistedMenuState()?await super.saveStepParams():this.hasPersistedMenuInstanceFlowFlag()?await this.destroyPersistedState():this.hasPersistableInstanceFlows()&&await super.saveStepParams(),await this.syncPersistedFlowRouteFlag(),!0}async save(){if(this.isCreationSession()){if(!this.creationPersisted){let e=this.getStepParams("menuCreation","basic");await this.persistMenuCreation(e||{}),this.creationPersisted=!0}return this.remove(),!0}return await super.save(),await this.syncPersistedFlowRouteFlag(),!0}async destroy(){var e,t,l;if(this.isCreationSession())return this.remove();let n=this.getRoute();if(!(null==n?void 0:n.id))return!1;let r=this.getLayout(),i=this.getRouteRepository().listAccessible(),o=ne(n,(null==(e=this.context.location)?void 0:e.pathname)||window.location.pathname,null==(t=this.context.router)?void 0:t.basename,r),a=l9(i,n),s=l7(i,n);if(await this.getRouteRepository().deleteRoute(n.id),!o)return!0;let d=a||s;if(!d)return this.context.router.navigate("/"),!0;let u=tV({app:this.context.app,route:d,layout:r});return!u.runtimePath||("document"===u.navigationMode?window.location.assign(u.runtimePath):this.context.router.navigate(tT(u.runtimePath,null==(l=this.context.router)?void 0:l.basename)),!0)}toProLayoutRoute(e){let t=this.props.route,l=this.props.parentRoute,n=e.depth||0;if(!t||"object"!=typeof t||!e.designable&&this.hidden)return null;let r=lB({depth:n,isMobile:e.isMobile}),{name:i,icon:o}=lz(t,e.t,r),a=this.getLayout();if(t.type===eC.q2.link)return{name:i,icon:o,path:ls("link",t.id??t.schemaUid??t.menuSchemaUid??t.title??this.uid,a),hideInMenu:t.hideInMenu,_route:t,_parentRoute:l,_depth:n,_model:this};if(t.type===eC.q2.page||t.type===eC.q2.flowPage){let e=tV({app:this.context.app,route:t,layout:a});return"unsupportedV2Runtime"===e.reason?null:{name:i,icon:o,path:t.schemaUid?tj(a,t.schemaUid):ls("link",`${this.uid}-invalid`,a),redirect:t.schemaUid?tj(a,t.schemaUid):void 0,hideInMenu:t.hideInMenu,disabled:!e.runtimePath,_runtimePath:e.runtimePath,_navigationMode:e.navigationMode,_isLegacy:e.isLegacy,_route:t,_parentRoute:l,_depth:n,_model:this}}if(t.type===eC.q2.group){var s;let r=Array.isArray(t.children)?t.children:[],d=(this.subModels.menuItems||[]).map(t=>t.toProLayoutRoute({...e,depth:n+1})).filter(Boolean)||[];e.designable&&0===n&&d.push(lV("schema-initializer-Menu-side",this,t,a));let u=tR(this.context.app)?tB(r):tL(r),c=tV({app:this.context.app,route:tR(this.context.app)&&u?u:t,layout:a}),p={name:i,icon:o,path:tj(a,t.id),redirect:(null==(s=d[0])?void 0:s.key)==="x-designer-button"?void 0:tj(a,(null==u?void 0:u.schemaUid)||t.id),hideInMenu:t.hideInMenu,_runtimePath:c.runtimePath,_navigationMode:c.navigationMode,_isLegacy:c.isLegacy,_route:t,_parentRoute:l,_depth:n,_model:this};return d.length>0&&(p.routes=d),p}return null}render(){return(0,E.jsx)(l$,{item:this.props.item,dom:this.props.dom,options:this.props.options,renderType:this.props.renderType})}constructor(...e){super(...e),(0,j._)(this,"creationPersisted",!1),(0,j._)(this,"persistedStateHydrated",!1),(0,j._)(this,"persistedStateHydrating",void 0)}}no.registerFlow({key:"menuCreation",title:"Add menu item",manual:!0,steps:{basic:{title:"Add menu item",preset:!0,hideInSettings:!0,defaultParams:async e=>lZ(e.model.getCreationMeta()),uiSchema:async e=>l4(e.t,e.model.getCreationMeta())}}}),no.registerFlow({key:"menuSettings",title:"Menu settings",steps:{edit:{title:"Edit",defaultParams:async e=>l5(e.model.getRoute()),uiSchema:async e=>{let t=e.model.getRoute(),l=l1(e.t);return(null==t?void 0:t.type)===eC.q2.link&&Object.assign(l,lX(e.t)),l},beforeParamsSave:async(e,t)=>{var l;await e.model.updateMenuRoute({title:t.title,icon:t.icon,options:(null==(l=e.model.getRoute())?void 0:l.type)===eC.q2.link?{href:t.href,params:t.params,openInNewWindow:t.openInNewWindow}:void 0})}},editTooltip:{title:"Edit tooltip",defaultParams:async e=>{var t;return{tooltip:null==(t=e.model.getRoute())?void 0:t.tooltip}},uiSchema:async e=>({tooltip:{title:e.t("Tooltip"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}),beforeParamsSave:async(e,t)=>{await e.model.updateMenuRoute({tooltip:t.tooltip})}},linkageRules:{use:"menuLinkageRules",hideInSettings:async e=>e.model.isCreationSession()},moveTo:{title:"Move to",defaultParams:async()=>({position:"afterEnd"}),uiSchema:async e=>{var t;let l=await l6(e.routeRepository.listAccessible(),e),n=null==(t=e.model.getRoute())?void 0:t.id,r=lj(void 0,n,e.t);return{target:{title:e.t("Target"),enum:l,required:!0,"x-decorator":"FormItem","x-component":"TreeSelect"},position:{title:e.t("Position"),required:!0,enum:r,"x-decorator":"FormItem","x-component":"Radio.Group","x-reactions":[t=>{var l;let r=lj(null==(l=t.form.values)?void 0:l.target,n,e.t);t.dataSource=r,r.some(e=>e.value===t.value&&!e.disabled)||(t.value="afterEnd")}]}}},beforeParamsSave:async(e,t)=>{await e.model.moveMenuRoute(t.target,t.position)}},insertBefore:l3({title:"Insert before",insertPosition:"beforeBegin",resolveParentRoute:e=>e.model.getParentRoute()}),insertAfter:l3({title:"Insert after",insertPosition:"afterEnd",resolveParentRoute:e=>e.model.getParentRoute()}),insertInner:l3({title:"Insert inner",hideInSettings:async e=>{var t;return(null==(t=e.model.getRoute())?void 0:t.type)!==eC.q2.group},canCreate:e=>e.type===eC.q2.group,insertPosition:"beforeEnd",resolveParentRoute:(e,t)=>t.type===eC.q2.group?t:void 0})}});var na=l(54829),ns=l(3876);let nd=(0,Z.css)`
16
+ `;let et=(0,D.createContext)(null);et.displayName="GlobalThemeContext";let el=()=>D.useContext(et)||{theme:{},isDarkTheme:!1},en=e=>{let{children:t,theme:l}=e,[n,r]=D.useState(l||Y),i=(0,D.useRef)(null),o=(0,D.useRef)(null),a=(0,D.useMemo)(()=>{let e=null==n?void 0:n.algorithm;return Array.isArray(e)?e.includes(H.A.darkAlgorithm):e===H.A.darkAlgorithm},[null==n?void 0:n.algorithm]),s=(0,D.useCallback)(e=>{o.current=e?_().cloneDeep(e):e},[]),d=(0,D.useCallback)(()=>o.current,[]),u=(0,D.useCallback)(e=>{i.current=e?_().cloneDeep(e):e},[]),c=(0,D.useCallback)(()=>i.current,[]),p=(0,D.useMemo)(()=>({theme:Q(n),setTheme:r,setCurrentSettingTheme:u,getCurrentSettingTheme:c,setCurrentEditingTheme:s,getCurrentEditingTheme:d,isDarkTheme:a}),[d,c,a,s,u,n]);return(0,E.jsx)(et.Provider,{value:p,children:(0,E.jsx)(G.Ay,{theme:J(p.theme),children:t})})};var er=l(4198);class ei{async listTools(e){let{data:t}=await this.app.apiClient.resource("aiTools").list({filter:e}),l=null==t?void 0:t.data;return l?l.map(e=>({...e,...this.tools.get(e.definition.name)??{}})):[]}useTools(){let e=new er.Registry;for(let[l,n]of this.tools.getEntities()){var t;e.register(l,{...(null==(t=n.useHooks)?void 0:t.call(n))??n})}return e}registerTools(e,t){this.tools.register(e,{...t})}constructor(e,t=new er.Registry){(0,j._)(this,"app",void 0),(0,j._)(this,"tools",void 0),this.app=e,this.tools=t}}class eo{constructor(e){(0,j._)(this,"app",void 0),(0,j._)(this,"toolsManager",void 0),this.app=e,this.toolsManager=new ei(this.app)}}let ea=e=>new Map(e.map(e=>[e.definition.name,e]));var es=l(84884);class ed{register(e,t){this.providers.set(e,{name:e,scope:t.scope,provider:t.provider,sort:t.sort??0}),this.invalidate()}unregister(e){this.providers.delete(e),this.invalidate()}invalidate(){this.revision+=1}getItems(e){return async t=>{let l=[...this.providers.values()].filter(t=>t.scope===e).sort((e,t)=>e.sort-t.sort);return(await Promise.all(l.map(async e=>{try{return await e.provider(t)}catch(t){return console.error(`[NocoBase] Failed to load entry action provider "${e.name}".`,t),[]}}))).flat()}}constructor(){(0,j._)(this,"providers",new Map),(0,j._)(this,"revision",0),(0,T.define)(this,{revision:T.observable.ref})}}var eu=l(95267);let ec=e=>null==e?"":"object"==typeof e?Array.isArray(e)?"["+e.map(ec).join(",")+"]":"{"+Object.keys(e).sort().map(t=>`${t}:${ec(e[t])}`).join(",")+"}":String(e),ep=e=>{let{params:t,index:l}=e;return[ec(t.viewUid),ec(t.sourceId),ec(t.filterByTk),ec(t.openViewRouteState),String(l)].join("_")};function eh(e,t){let l=new Map,n=new Map;e.forEach(e=>{let t=ep(e);l.set(t,e)}),t.forEach(e=>{n.set(ep(e),e)});let r=[];l.forEach((e,t)=>{n.has(t)?n.get(t).hidden=e.hidden:r.push(e)});let i=[];return n.forEach((e,t)=>{l.has(t)||i.push(e)}),{viewsToClose:r,viewsToOpen:i}}let em=(0,T.defineFlow)({key:"popupSettings",title:(0,T.tExpr)("Popup settings"),on:"click",sort:300,steps:{openView:{use:"openView",hideInSettings:async e=>{var t,l,n,r;let i=null==(l=(n=e.model).getStepParams)||null==(t=l.call(n,"displayFieldSettings","clickToOpen"))?void 0:t.clickToOpen;return!!e.collectionField&&(void 0===i?!(null==(r=e.collectionField)?void 0:r.isAssociationField())||e.disableFieldClickToOpen:!1===i)}}},defaultParams:e=>{var t,l,n,r,i,o,a,s;let d,u,c,p=e.collectionField,h=e.blockModel,m=null==(l=e.model)||null==(t=l.parent)?void 0:t.associationPathName,f=e.collection||(null==h?void 0:h.collection),g=e=>{var t;return!!(null==e||null==(t=e.isAssociationField)?void 0:t.call(e))},v=!g(p)&&m?null==f||null==(n=f.getFieldByPath)?void 0:n.call(f,m):void 0,y=g(p)?p:v;if(g(y)){let e=y.targetCollection;null==h||h.collection,d=null==e?void 0:e.name,u=null==e?void 0:e.dataSourceKey,c=null==y?void 0:y.resourceName}else p?(d=null==(r=e.collection)?void 0:r.name,u=null==(i=e.collection)?void 0:i.dataSourceKey,c=null==p?void 0:p.target):(d=null==(o=e.collection)?void 0:o.name,u=null==(a=e.collection)?void 0:a.dataSourceKey,c=null==(s=e.association)?void 0:s.resourceName);return{openView:{collectionName:d,associationName:c,dataSourceKey:u}}}}),ef=e=>e.getStepParams("popupSettings","openView");class eg extends T.FlowModel{}function ev(e,t,l){return t.map((t,n)=>{let r,i=t.viewUid;return 0===n?(r=l,i=l.uid):r=e.getModel(t.viewUid,!0),{params:t,modelUid:i,model:r,hidden:T.observable.ref(!1),index:n}})}function ey(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=!1;for(let n=e.length-1;n>=0;n--){let r=e[n];"embed"!==eb(r,t)||l?r.hidden.value=l:(l=!0,r.hidden.value=!1)}}function eb(e){var t;let l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.model instanceof eg||l&&e.index>0)return"embed";if(!e.model)return"drawer";if(null==(t=e.params.openViewRouteState)?void 0:t.mode)return e.params.openViewRouteState.mode;let n=e.model.getStepParams("popupSettings","openView");return(null==n?void 0:n.mode)||"drawer"}eg.registerFlow({key:"popupSettings",on:"click",steps:{openView:{use:"openView",defaultParams(e){var t;return{mode:"embed",preventClose:!0,pageModelClass:(null==(t=e.layout)?void 0:t.rootPageModelClass)||"RootPageModel"}}}}});let ex="__nocobaseOpenViewInputArgs",ew=(e,t)=>{var l,n;if(!t||!e||"object"!=typeof e)return{};let r=e,i=null==(l=r[ex]||(null==(n=r.usr)?void 0:n[ex]))?void 0:l[t];return i&&"object"==typeof i?i:{}},eS=e=>null!=e&&""!==String(e),eA=e=>`/${(e||"/admin").replace(/^\/+/,"").replace(/\/+$/,"")}`,eM=e=>(null==e?void 0:e.startsWith("/"))?eA(e):"";class eF{setLayoutContentElement(e){let t=this.layoutContentElement||this.lastNonNullLayoutContentElement;if(this.layoutContentElement=e,!e)return;let l=!!t&&t!==e;this.lastNonNullLayoutContentElement=e,l&&this.replayActiveRuntimeViewsAfterLayoutContentElementChange()}registerPage(e,t){let l=this.getOrCreateRouteModel(e),n={pageUid:e,routeModel:l,meta:{active:!!t.active,refreshDesktopRoutes:t.refreshDesktopRoutes,layoutContentElement:t.layoutContentElement||null},viewState:{},prevViewList:[],pendingOpenViewKeys:new Set,hasStepNavigated:!1,forceStop:!1,viewGeneration:0};return this.ensureRouteModelContext(n),this.runtimes.set(e,n),this.syncPageMeta(e,t),n.routeModel}syncPageMeta(e,t){let l=this.runtimes.get(e);if(!l)return;let n="boolean"==typeof t.active?t.active:void 0;l.meta={...l.meta,...t,active:l.meta.active,layoutContentElement:t.layoutContentElement??l.meta.layoutContentElement},"boolean"==typeof n&&this.setRuntimeActive(l,n)}unregisterPage(e){this.cleanupPage(e),this.runtimes.delete(e)}syncRoute(e){var t,l,n,r;if((null==e?void 0:e.layoutRouteName)&&(null==(t=this.layout)?void 0:t.routeName)&&e.layoutRouteName!==this.layout.routeName){this.runtimes.forEach(e=>{this.setRuntimeActive(e,!1)}),this.invalidatePendingRuntimeViewOpens();return}let i=(null==e?void 0:e.pageUid)||(null==e||null==(l=e.layoutRoute)?void 0:l.pageUid)||(null==e||null==(n=e.params)?void 0:n.name),o=null==e?void 0:e.pathname,a=(null==e?void 0:e.layoutBasePathname)||(null==e||null==(r=e.layoutRoute)?void 0:r.basePathname);if(a&&(this.basePathname=eA(a)),this.runtimes.forEach(e=>{this.setRuntimeActive(e,e.pageUid===i)}),!i||!o)return void this.invalidatePendingRuntimeViewOpens();this.runtimes.forEach(e=>{e.pageUid!==i&&(e.forceStop||(e.viewGeneration+=1,e.pendingOpenViewKeys.clear()),e.forceStop=!0)});let s=this.runtimes.get(i);s&&(s.forceStop=!1,s.currentPathname&&s.currentPathname!==o&&(s.viewGeneration+=1,s.pendingOpenViewKeys.clear()),s.currentPathname=o,s.currentRouteState=e.state,this.syncRuntimeWithPathname(s,o,{routeState:e.state}))}cleanupPage(e){let t=this.runtimes.get(e);t&&(t.forceStop=!0,t.viewGeneration+=1,t.pendingOpenViewKeys.clear(),t.prevViewList.forEach(e=>{var l,n;this.flowEngine.removeModelWithSubModels(e.params.viewUid),null==(n=t.viewState[ep(e)])||null==(l=n.destroy)||l.call(n),delete t.viewState[ep(e)]}),t.prevViewList=[],t.hasStepNavigated=!1,t.currentPathname=void 0,t.currentRouteState=void 0)}destroy(){Array.from(this.runtimes.keys()).forEach(e=>{this.cleanupPage(e),this.runtimes.delete(e)})}getCurrentRouteByPageUid(e){var t,l;return(null==(l=this.flowEngine.context.routeRepository)||null==(t=l.getRouteBySchemaUid)?void 0:t.call(l,e))||{}}setRuntimeActive(e,t){var l;let n=!!e.meta.active;e.meta.active=t,(null==(l=e.routeModel.context.pageActive)?void 0:l.value)!==t&&(e.routeModel.context.pageActive.value=t),this.syncViewListVisibility(e),n!==t&&this.notifyRuntimeActiveChange(e,t)}notifyRuntimeActiveChange(e,t){var l,n;let r=e.prevViewList[0];if(!r)return;let i=e.viewState[ep(r)];if(t){null==i||null==(n=i.activate)||n.call(i,!0);return}null==i||null==(l=i.deactivate)||l.call(i)}syncRuntimeWithPathname(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var n,r;if(!this.basePathname)return;let i=(0,T.parsePathnameToViewParams)(t,{basePath:this.basePathname}),o=ev(this.flowEngine,i,e.routeModel),a=l.routeState;if(!l.skipInitialStepNavigation&&this.shouldStepNavigate(e,o)){this.stepNavigate(o,0,a),e.hasStepNavigated=!0,this.scheduleInitialDeepLinkReplay(e,t,a);return}let{viewsToClose:s,viewsToOpen:d}=eh(e.prevViewList,o),u=new Set(d.map(e=>ep(e))),c=o.filter(t=>{let l=ep(t);return!e.pendingOpenViewKeys.has(l)&&(u.has(l)||!e.viewState[l])});if(s.length&&(s.forEach(t=>{var l,n;e.pendingOpenViewKeys.delete(ep(t)),null==(n=e.viewState[ep(t)])||null==(l=n.destroy)||l.call(n,!0),delete e.viewState[ep(t)]}),ey(o,!!(null==(n=this.layoutContext)?void 0:n.isMobileLayout))),c.length&&(this.markPendingOpenViews(e,c),this.handleOpenViews(e,o,c,e.viewGeneration,a).catch(e=>{console.error("[NocoBase] Failed to open route-managed views:",e)})),0===s.length&&0===c.length){let t=o.at(-1);t&&(null==(r=e.viewState[ep(t)])||r.navigation.setViewStack(o.map(e=>e.params)))}e.prevViewList=[...o],this.syncViewListVisibility(e)}catch(e){console.error("[NocoBase] Failed to resolve view params to view list:",e)}}syncViewListVisibility(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.prevViewList;if(t.length){if(e.meta.active){var l;ey(t,!!(null==(l=this.layoutContext)?void 0:l.isMobileLayout));return}t.forEach(e=>{e.hidden.value=!0})}}shouldStepNavigate(e,t){return 0===e.prevViewList.length&&t.length>1&&!e.hasStepNavigated}scheduleInitialDeepLinkReplay(e,t,l){let n=e.viewGeneration;Promise.resolve().then(()=>{e.forceStop||e.viewGeneration!==n||e.currentPathname!==t||e.prevViewList.length>0||this.syncRuntimeWithPathname(e,t,{routeState:l})}).catch(()=>{})}stepNavigate(e,t,l){if(!e[t])return;let n=l?{state:l}:void 0;0===t?new T.ViewNavigation(this.flowEngine.context,[],{basePath:this.basePathname}).navigateTo(e[t].params,{replace:!0,...n}):new T.ViewNavigation(this.flowEngine.context,e.slice(0,t).map(e=>e.params),{basePath:this.basePathname}).navigateTo(e[t].params,n),this.stepNavigate(e,t+1,l)}replayActiveRuntimeViewsAfterLayoutContentElementChange(){this.runtimes.forEach(e=>{e.currentPathname&&0!==e.prevViewList.length&&(this.resetRuntimeViewStateForLayoutContentElementChange(e),e.meta.active&&this.syncRuntimeWithPathname(e,e.currentPathname,{skipInitialStepNavigation:!0,routeState:e.currentRouteState}))})}invalidatePendingRuntimeViewOpens(){this.runtimes.forEach(e=>{e.forceStop=!0,e.viewGeneration+=1,e.pendingOpenViewKeys.clear()})}resetRuntimeViewStateForLayoutContentElementChange(e){e.viewGeneration+=1,e.pendingOpenViewKeys.clear(),e.prevViewList.forEach((t,l)=>{var n,r;null==(r=e.viewState[ep(t)])||null==(n=r.destroy)||n.call(r,!0),delete e.viewState[ep(t)],l>0&&this.flowEngine.removeModelWithSubModels(t.params.viewUid)}),e.prevViewList=[],e.hasStepNavigated=!1}markPendingOpenViews(e,t){t.forEach(t=>{e.pendingOpenViewKeys.add(ep(t))})}clearPendingOpenViews(e,t){t.forEach(t=>{e.pendingOpenViewKeys.delete(ep(t))})}async handleOpenViews(e,t,l,n,r){let i=l.filter(e=>!e.model);i.length>0&&await Promise.all(i.map(async e=>{try{e.model=await this.flowEngine.loadModel({uid:e.modelUid})}catch(t){console.error(`[NocoBase] Failed to load model ${e.modelUid}:`,t)}})),e.forceStop||e.viewGeneration!==n||(this.syncViewListVisibility(e,t),this.openViews(e,t,l,0,n,r))}openViews(e,t,l,n,r,i){if(e.forceStop||e.viewGeneration!==r||!l[n])return;let o=l[n];if(!o.model)return void this.clearPendingOpenViews(e,l.slice(n));let a=ep(o),s=D.createRef(),d=D.createRef(),u=D.createRef(),c=D.createRef(),p=ef(o.model),h=(null==p?void 0:p.associationName)&&!eS(o.params.sourceId)?null:null==p?void 0:p.associationName,m=o.params.openViewRouteState,f=t.slice(0,o.index).map(e=>e.params.viewUid),g=ew(i,o.params.viewUid),v=new T.ViewNavigation(this.flowEngine.context,t.slice(0,o.index+1).map(e=>e.params),{basePath:this.basePathname});try{var y;o.model.dispatchEvent("click",{target:this.layoutContentElement||e.meta.layoutContentElement,collectionName:null==p?void 0:p.collectionName,associationName:h,dataSourceKey:null==p?void 0:p.dataSourceKey,destroyRef:s,updateRef:d,activateRef:u,deactivateRef:c,openerUids:f,...o.params,...g,...(null==m?void 0:m.mode)?{mode:m.mode}:{},...(null==m?void 0:m.size)?{size:m.size}:{},pageActive:e.meta.active,activationControlledByLayout:!0,navigation:v,onOpen:()=>{this.openViews(e,t,l,n+1,r,i)},hidden:o.hidden,isMobileLayout:!!(null==(y=this.layoutContext)?void 0:y.isMobileLayout),triggerByRouter:!0})}catch(t){this.clearPendingOpenViews(e,l.slice(n)),console.error("[NocoBase] Failed to dispatch route-managed view open:",t);return}e.viewState[a]={destroy:e=>{var t;return null==(t=s.current)?void 0:t.call(s)},update:e=>{var t;return null==(t=d.current)?void 0:t.call(d,e)},activate:e=>{var t;return null==(t=u.current)?void 0:t.call(u,e)},deactivate:()=>{var e;return null==(e=c.current)?void 0:e.call(c)},navigation:v},e.pendingOpenViewKeys.delete(a)}ensureRouteModelContext(e){this.layoutContext&&e.routeModel.context.addDelegate(this.layoutContext),e.routeModel.context.pageActive||e.routeModel.context.defineProperty("pageActive",{value:T.observable.ref(!1),info:{description:"Whether current page route is active (keep-alive). This is an observable.ref<boolean> (use ctx.pageActive.value to read/write).",detail:"observable.ref<boolean>"}}),e.routeModel.context.defineProperty("currentRoute",{get:()=>this.getCurrentRouteByPageUid(e.pageUid),cache:!1}),e.routeModel.context.defineProperty("refreshDesktopRoutes",{get:()=>e.meta.refreshDesktopRoutes,cache:!1}),e.routeModel.context.defineProperty("layout",{get:()=>{var e;return this.layout||(null==(e=this.layoutContext)?void 0:e.layout)},cache:!1}),e.routeModel.context.defineProperty("layoutRoute",{get:()=>{var e;return null==(e=this.layoutContext)?void 0:e.layoutRoute},cache:!1}),e.routeModel.context.defineProperty("layoutContext",{get:()=>this.layoutContext,cache:!1})}getOrCreateRouteModel(e){let t=this.flowEngine.getModel(e);return t instanceof eg?t:(t&&this.flowEngine.removeModelWithSubModels(e),this.flowEngine.createModel({uid:e,use:"RouteModel"}))}constructor(e,t={}){var l;(0,j._)(this,"flowEngine",void 0),(0,j._)(this,"layout",void 0),(0,j._)(this,"layoutContext",void 0),(0,j._)(this,"basePathname",void 0),(0,j._)(this,"runtimes",new Map),(0,j._)(this,"layoutContentElement",null),(0,j._)(this,"lastNonNullLayoutContentElement",null),this.flowEngine=e,this.layout=t.layout,this.layoutContext=t.layoutContext,this.basePathname=t.basePathname||eM(null==(l=t.layout)?void 0:l.routePath)||(t.layout?"":eA())}}function ek(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.basePathname||eM(null==(t=l.layout)?void 0:t.routePath);return n?(0,T.parsePathnameToViewParams)(e,{basePath:n}):[]}var eC=l(2077);function eP(e){return`${e}.__page`}function ej(e){return`${e}.__pageTab`}function eE(e){return`${e}.__pageView`}function eR(e){return`${e}.__pageTabView`}function eT(e){return[eP(e),ej(e),eE(e),eR(e)]}function eI(e,t){return!!t&&eT(e).includes(t)}let e_={routeName:"admin",routePath:"/admin",rootRouteName:"admin",uid:"admin-layout-model",layoutModelClass:"AdminLayoutModel",rootPageModelClass:"RootPageModel",childPageModelClass:"ChildPageModel",authCheck:!0},eD=e=>`/${(e||"/admin").replace(/^\/+/,"").replace(/\/+$/,"")}`,eN=e=>e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:"/",eO=(e,t)=>{let l=eN(e),n=eD(t);return l===n?"":l.startsWith(`${n}/`)?l.slice(n.length+1):null},e$=e=>(null==e?void 0:e.startsWith("/"))?eD(e):"",eB=e=>["tab","filterbytk","sourceid"].includes(e),eL=(e,t)=>!!t&&["page","page.tabs","page.tabs.popups","page.tab","page.view","page.tab.view"].some(l=>t===`${e}.${l}`),eq=e=>{if(!e)return!0;let t=e.split("/").filter(Boolean);if(!t.length)return!0;let l=1,n=t[0];for(;l<t.length;){let e=t[l];if("view"===e){if(!t[l+1])return!1;n=t[l+1],l+=2;continue}if("opts"===e){if(!t[l+1]||!(0,T.decodeOpenViewRouteState)(n,t[l+1]))return!1;l+=2;continue}if(eB(e)&&t[l+1]){l+=2;continue}return!t[l+1],!1}return!0};class eV extends T.FlowModel{registerRoutePage(e,t){this.routePageMetaMap.set(e,t),this.restoreCurrentLayoutRouteFromRouterContext(e);let l=this.getCoordinator().registerPage(e,t);return this.getCoordinator().syncRoute(this.getCurrentCoordinatorRouteLike()),l}updateRoutePage(e,t){let l=this.routePageMetaMap.get(e)||{active:!1},n={...l,...t,active:"boolean"==typeof t.active?t.active:l.active};this.routePageMetaMap.set(e,n),this.getCoordinator().syncPageMeta(e,t)}unregisterRoutePage(e){this.routePageMetaMap.delete(e),this.activePageUid===e&&(this.activePageUid=""),this.getCoordinator().unregisterPage(e)}setLayoutContentElement(e){this.layoutContentElement=e,this.getCoordinator().setLayoutContentElement(e)}setIsMobileLayout(e){this.isMobileLayout=!!e}getCurrentRouteByPageUid(e){var t,l;return(null==(l=this.flowEngine.context.routeRepository)||null==(t=l.getRouteBySchemaUid)?void 0:t.call(l,e))||{}}get layout(){return this.props.layout||{...e_,uid:this.uid||e_.uid}}getCoordinator(){return this.routeCoordinator||(this.routeCoordinator=this.createRouteCoordinator()),this.routeCoordinator}createRouteCoordinator(){return new eF(this.flowEngine,this.getRouteCoordinatorOptions())}getRouteCoordinatorOptions(){return{layout:this.layout,layoutContext:this.context}}getPageUidFromRoute(e){var t,l;return(null==e?void 0:e.pageUid)?e.pageUid:(null==e||null==(t=e.layoutRoute)?void 0:t.type)==="page"?e.layoutRoute.pageUid:(null==e||null==(l=e.params)?void 0:l.name)||""}isLayoutContentRoute(e){if(null==e?void 0:e.layoutRouteName)return e.layoutRouteName===this.layout.routeName;let t=(null==e?void 0:e.name)||(null==e?void 0:e.id);return eI(this.layout.routeName,t)}resolveLayoutRoute(e){var t,l,n,r;let i=eN(null==e?void 0:e.pathname),o=e.layoutBasePathname||e$(this.layout.routePath),a=o?eD(o):"";if(!a)return{type:"notFound",pathname:i,basePathname:"",relativePath:""};let s=eO(i,a);if(null===s)return{type:"notFound",pathname:i,basePathname:a,relativePath:""};if(!s)return{type:"root",pathname:i,basePathname:a,relativePath:s};if(!eq(s))return{type:"notFound",pathname:i,basePathname:a,relativePath:s};let d=(0,T.parsePathnameToViewParams)(i,{basePath:a}),u=null==(t=d[0])?void 0:t.viewUid;if(!u)return{type:"notFound",pathname:i,basePathname:a,relativePath:s};let c=this.flowEngine.context.routeRepository,p=null==c||null==(l=c.getRouteBySchemaUid)?void 0:l.call(c,u),h=p||null==c||null==(n=c.getRouteById)?void 0:n.call(c,u);return p||(null==h?void 0:h.type)!==eC.q2.group?{type:"page",pathname:i,basePathname:a,relativePath:s,pageUid:u,tabUid:null==(r=d[0])?void 0:r.tabUid,viewStack:d}:{type:"root",pathname:i,basePathname:a,relativePath:s}}getPageUidFromLayoutRoute(e){return(null==e?void 0:e.type)==="page"?e.pageUid:""}syncLayoutRoute(e){if(!this.isLayoutContentRoute(e))return this.clearLayoutRoute(),null;let t=this.resolveLayoutRoute(e);return this.currentLayoutRoute=t,this.currentRouteState=e.state,this.activePageUid=this.getPageUidFromLayoutRoute(t),this.getCoordinator().syncRoute({...e,layoutRouteName:this.layout.routeName,pageUid:this.activePageUid,pathname:t.pathname,layoutBasePathname:t.basePathname,layoutRoute:t}),t}clearLayoutRoute(e){var t,l;let n=(null==e?void 0:e.pathname)?eN(e.pathname):"";n&&(null==(t=this.currentLayoutRoute)?void 0:t.pathname)&&n!==this.currentLayoutRoute.pathname||this.shouldIgnoreStaleLayoutRouteCleanup(e)||(this.currentLayoutRoute=null,this.currentRouteState=void 0,this.activePageUid="",null==(l=this.routeCoordinator)||l.syncRoute({}))}onMount(){super.onMount(),this.setupContextBindings()}onUnmount(){this.teardownRuntime(),super.onUnmount()}setupContextBindings(){this.contextBindingsActive=!0,this.context.defineProperty("layoutContext",{get:()=>this.contextBindingsActive?this.context:void 0,cache:!1}),this.context.defineProperty("currentRoute",{get:()=>this.contextBindingsActive?this.getCurrentRouteByActivePage():{},cache:!1}),this.context.defineProperty("layoutContentElement",{get:()=>this.contextBindingsActive?this.layoutContentElement:null,cache:!1}),this.context.defineProperty("isMobileLayout",{get:()=>!!this.contextBindingsActive&&this.isMobileLayout,observable:!0,cache:!1}),this.context.defineProperty("layout",{get:()=>this.contextBindingsActive?this.layout:void 0,cache:!1}),this.context.defineProperty("layoutRoute",{get:()=>this.contextBindingsActive?this.currentLayoutRoute:void 0,observable:!0,cache:!1})}teardownRuntime(){var e;this.contextBindingsActive=!1,null==(e=this.routeCoordinator)||e.destroy(),this.routeCoordinator=void 0,this.routePageMetaMap.clear(),this.activePageUid="",this.currentLayoutRoute=null,this.layoutContentElement=null}getCurrentRouteByActivePage(){return this.activePageUid?this.getCurrentRouteByPageUid(this.activePageUid):{}}getCurrentCoordinatorRouteLike(){var e;return(null==(e=this.currentLayoutRoute)?void 0:e.type)==="page"?{layoutRouteName:this.layout.routeName,pageUid:this.currentLayoutRoute.pageUid,pathname:this.currentLayoutRoute.pathname,state:this.currentRouteState,layoutBasePathname:this.currentLayoutRoute.basePathname,layoutRoute:this.currentLayoutRoute}:{}}restoreCurrentLayoutRouteFromRouterContext(e){var t;if((null==(t=this.currentLayoutRoute)?void 0:t.type)==="page")return;let l=this.getRouterContextRouteLike();if(!l||!this.isRouteLikeOwnedByCurrentLayout(l))return;let n=this.resolveLayoutRoute({...l,layoutRouteName:l.layoutRouteName||this.layout.routeName});"page"===n.type&&n.pageUid===e&&(this.currentLayoutRoute=n,this.activePageUid=n.pageUid)}shouldIgnoreStaleLayoutRouteCleanup(e){var t;if(!(null==e?void 0:e.pathname)||(null==(t=this.currentLayoutRoute)?void 0:t.type)!=="page")return!1;let l=this.currentLayoutRoute;if(!this.routePageMetaMap.has(l.pageUid)||eN(e.pathname)!==l.pathname)return!1;let n=this.getRouterContextRouteLike();if(!n||!this.isRouteLikeOwnedByCurrentLayout(n))return!1;let r=this.resolveLayoutRoute({...n,layoutRouteName:n.layoutRouteName||this.layout.routeName});return"page"===r.type&&r.pageUid===l.pageUid&&r.pathname===l.pathname}getRouterContextRouteLike(){let e=this.flowEngine.context.route;return(null==e?void 0:e.pathname)?{id:e.id,name:e.name||e.id,pathname:e.pathname,params:e.params,layoutRouteName:e.layoutRouteName,layoutBasePathname:e.layoutBasePathname}:null}isRouteLikeOwnedByCurrentLayout(e){if(e.layoutRouteName)return e.layoutRouteName===this.layout.routeName;let t=e$(this.layout.routePath);if(e.layoutBasePathname&&t)return eD(e.layoutBasePathname)===eD(t);let l=e.name||e.id;return this.isLayoutContentRoute(e)||eL(this.layout.routeName,l)}constructor(e){super(e),(0,j._)(this,"isMobileLayout",!1),(0,j._)(this,"currentLayoutRoute",null),(0,j._)(this,"routeCoordinator",void 0),(0,j._)(this,"activePageUid",""),(0,j._)(this,"currentRouteState",void 0),(0,j._)(this,"layoutContentElement",null),(0,j._)(this,"routePageMetaMap",new Map),(0,j._)(this,"contextBindingsActive",!1),(0,R.define)(this,{isMobileLayout:R.observable.ref,currentLayoutRoute:R.observable.ref})}}function ez(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{required:n=!1,create:r=!1,props:i,use:o}=l,a=e.getModel(t);if(!a&&r){let l=o;if(!l)throw Error(`[NocoBase] Cannot create layout model ${t} without model class.`);a=e.createModel({uid:t,use:l,props:i})}if(a&&i&&a.setProps(i),!a&&n)throw Error(`[NocoBase] FlowRoute requires layout model ${t}. Please render FlowRoute under Layout.`);return a}var eK=l(92275),eU=l(71021),eW=l(18492);function eH(e){return e.startsWith("/")?e:`/${e}`}function eG(e){let t=eH(String(e||"/").trim()||"/").replace(/\/{2,}/g,"/");return t.endsWith("/")?t:`${t}/`}function eY(e){let t=/\/(apps|_app)\/([^/?#]+)(?=\/|[?#]|$)/.exec(eH(String(e||"/")));return t?`/${t[1]}/${t[2]}`:""}function eJ(e,t){let l=eG(e).replace(/\/+$/,""),n=eH(String(t||"/").split(/[?#]/)[0]).replace(/\/{2,}/g,"/"),r=l&&(n===l||n.startsWith(`${l}/`))?n.slice(l.length)||"/":n,i=/^\/(?:settings\/)?(apps|_app)\/([^/]+)(?=\/|$)/.exec(r);return i?`/${i[1]}/${i[2]}`:""}function eX(e){let t=eH(String(e||"/settings")).replace(/\/{2,}/g,"/");return"/"===t?"/settings":t.replace(/\/+$/,"")}function eQ(e){return"/settings"===e?"":e.replace(/^\/settings(?=\/|$)/,"")}function eZ(e,t,l){let n=eG(e),r="/"===n?"":n.replace(/\/+$/,""),i=eX(l);return t?`${r}/settings${t}${eQ(i)}`:`${r}${i}`}function e0(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("/")?e:`/${e}`:"/"}function e1(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.endsWith("/")?e:`${e}/`:"/"}function e2(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.replace(/\/+$/g,"")}function e5(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.replace(/^\/+/,"")}function e4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function e8(e){return e1(e0(String(e||"/").trim()||"/"))}function e3(e){let t=new URL(e0(String(e||"/").trim()||"/"),"http://nocobase.local").pathname.replace(/\/{2,}/g,"/");return"/"!==t&&t.endsWith("/")?e2(t):t}function e6(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("?")?e:`?${e}`:""}function e9(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?e.startsWith("#")?e:`#${e}`:""}function e7(e){if("string"!=typeof e)return{pathname:(null==e?void 0:e.pathname)||"/",search:(null==e?void 0:e.search)||"",hash:(null==e?void 0:e.hash)||""};let t=e.indexOf("#"),l=e.indexOf("?"),n=l>=0,r=t>=0,i=n?l:r?t:e.length,o=r?t:e.length;return{pathname:e.slice(0,i)||"/",search:n?e.slice(l,o):"",hash:r?e.slice(t):""}}function te(e,t){if(!t||"/"===t)return e;let l=e4(t),n=RegExp(`^${l.replace(/\/?$/,"")}(\\/|$)`);return e.replace(n,"/")||e}function tt(e){return e8(e.getPublicPath())}function tl(e){return e2(tt(e))||"/"}function tn(){return"u">typeof window?window:void 0}function tr(){let e=tn(),t=null==e?void 0:e.__nocobase_modern_client_prefix__;if("string"==typeof t&&t.trim())return e5(e2(t.trim()));let l=null==e?void 0:e.__nocobase_public_path__;if("string"==typeof l&&l.trim()){let e=e2(l.trim()).split("/"),t=e[e.length-1];if(t)return t}return"v"}function ti(e){let t=e8(e),l=tr(),n=RegExp(`/${e4(l)}/?$`);return e8(t.replace(n,"/"))}function to(e){var t,l;let n=null==(l=e.router)||null==(t=l.getBasename)?void 0:t.call(l);return n?e8(n):tt(e)}function ta(e,t){let l=e8(e),n=e3(t);return"/"===l?n:"/"===n?e2(l)||"/":e3(`/${e5(l)}/${e5(n)}`)}function ts(e){var t,l;return(null==(l=e.pluginSettingsManager)||null==(t=l.getRouteName)?void 0:t.call(l,""))==="settings."}function td(e){let t=e8(e.getPublicPath());if(ts(e))return t;let l=e2(t).split("/");return l.pop(),e8(l.join("/")||"/")}function tu(e){var t,l;return eJ(e.getPublicPath(),null==(l=e.router)||null==(t=l.getBasename)?void 0:t.call(l))||(e.name&&"main"!==e.name?eY(`/apps/${e.name}`):"")}function tc(e){return eZ(td(e),tu(e),"/settings")}function tp(e,t){let l=e3(t),n=e3(tc(e));return l===n||l.startsWith(`${n}/`)}function th(e,t){let l=e3(t),n=e2(td(e))||"",r=n&&l.startsWith(`${n}/`)?l.slice(n.length):l;return/^\/settings(?:\/|$)/.test(r)}function tm(e){return ts(e)?ta(tc(e),"/signin"):ta(to(e),"/signin")}function tf(e,t){var l,n;let r=e3(t);for(let t of[null==(n=e.router)||null==(l=n.getBasename)?void 0:l.call(n),tl(e)]){if(!t)continue;let e=e3(te(r,t));if(e!==r)return e}return r}function tg(e){return ta(to(e),"/admin")}function tv(e){return!!e&&e.startsWith("/")&&!e.startsWith("//")&&!e.startsWith("/\\")}function ty(e,t){return"/"!==e&&e.endsWith("/")&&!t.endsWith("/")?`${t}/`:t}function tb(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/admin/",n=e2(to(e))||"/",r=tv(l)?l:"/admin/",{pathname:i,search:o,hash:a}=e7(tv(t)?t:r),s=e3(i);if(tp(e,s)||"/"===n||s===n||s.startsWith(`${n}/`))return`${ty(i,s)}${e6(o)}${e9(a)}`;let d=e2(tt(e))||"/";"/"!==d&&(s===d||s.startsWith(`${d}/`))&&({pathname:i,search:o,hash:a}=e7(r),s=e3(i)),th(e,s)&&({pathname:i,search:o,hash:a}=e7(r),s=e3(i));let u=ty(i,ta(n,s));return`${u}${e6(o)}${e9(a)}`}function tx(e,t){let l=tf(e,(null==t?void 0:t.pathname)||"/"),n=e6((null==t?void 0:t.search)||""),r=e9((null==t?void 0:t.hash)||"");return`${ta(to(e),l)}${n}${r}`}function tw(e,t,l){let n=(null==l?void 0:l.signInRoutePath)?tb(e,l.signInRoutePath,l.signInRoutePath):tm(e);return`${n}?redirect=${encodeURIComponent(t)}`}function tS(e,t,l){let n=tw(e,t,l);if((null==l?void 0:l.replace)===!1){window.location.href=n;return}window.location.replace(n)}function tA(e,t){let l;if(!e)return null;try{l=new URL(e,window.location.origin)}catch(e){return null}return l.origin===window.location.origin&&new Set(ts(t)?[tm(t)]:["/signin",tm(t)]).has(l.pathname)?l.toString():null}let tM="[NocoBase] Admin route runtime target:",tF="/admin",tk={runtimePath:null,navigationMode:"spa",isLegacy:!1,reason:"unsupportedRouteType"};function tC(e){let t=`/${String(e||"/").trim()||"/"}`.replace(/\/{2,}/g,"/");return"/"!==t&&t.endsWith("/")?t.replace(/\/+$/g,""):t}function tP(e){let t="string"==typeof(null==e?void 0:e.routePath)?e.routePath.trim():"";return t.startsWith("/")?tC(t):tF}function tj(e,t){let l=tP(e),n=null==t?"":String(t).replace(/^\/+/,"");return n?tC(`${l}/${n}`):l}function tE(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",t=tC(e||"/");return t.endsWith("/")?t:`${t}/`}function tR(e){return!!(null==e?void 0:e.getPublicPath)&&tE(e.getPublicPath()).endsWith(`/${tr()}/`)}function tT(e,t){let l=tC(e),n=t&&"/"!==t?tC(t):"";return n?l===n?"/":l.startsWith(`${n}/`)?tC(l.slice(n.length)):l:l}function tI(e,t){let l=tE(e),n=tC(t);return"/"===l?n:"/"===n?l.replace(/\/+$/g,"")||"/":tC(`${l}${n.slice(1)}`)}function t_(e,t,l){return tI(to(e),tj(l,t))}function tD(e,t){let l=(null==t?void 0:t.search)?t.search.startsWith("?")?t.search:`?${t.search}`:"",n=(null==t?void 0:t.hash)?t.hash.startsWith("#")?t.hash:`#${t.hash}`:"";return`${e}${l}${n}`}function tN(e,t,l){null==e||e(tM,t,l)}function tO(e){return!!e&&(e.type===eC.q2.tabs||!0===e.hideInMenu||!0===e.hidden)}function t$(e){return!!e&&!0!==e.hidden&&!0!==e.hideInMenu&&(e.type===eC.q2.flowPage||e.type===eC.q2.link||e.type===eC.q2.group&&Array.isArray(e.children)&&e.children.some(e=>t$(e)))}function tB(e){if(Array.isArray(e)){for(let t of e)if(t&&!0!==t.hidden&&!0!==t.hideInMenu&&t.type!==eC.q2.tabs){if(t.type===eC.q2.flowPage)return t;if(t.type===eC.q2.group){let e=tB(t.children);if(e)return e}}}}function tL(e){if(Array.isArray(e)){for(let t of e)if(!tO(t)){if(t.type===eC.q2.page||t.type===eC.q2.flowPage)return t;if(t.type===eC.q2.group){let e=tL(t.children);if(e)return e}}}}function tq(e,t){let{app:l,preserveLocationState:n,location:r,log:i=console.warn}=e;return t.schemaUid?t.type===eC.q2.flowPage?{runtimePath:t_(l,t.schemaUid,e.layout),navigationMode:"spa",isLegacy:!1,reason:"ok"}:tR(l)?{...tk,reason:"unsupportedV2Runtime"}:{runtimePath:n&&r?tD(t_(l,t.schemaUid,e.layout),r):t_(l,t.schemaUid,e.layout),navigationMode:"spa",isLegacy:!1,reason:"ok"}:(tN(i,"Missing schemaUid.",t),{...tk,reason:"missingSchemaUid"})}function tV(e){let{route:t,log:l=console.warn}=e;if(!t)return tk;if(t.type===eC.q2.page||t.type===eC.q2.flowPage)return tq(e,t);if(t.type===eC.q2.group){let l=tR(e.app)?tB(t.children):tL(t.children);return l?tV({...e,route:l}):{...tk,reason:"emptyGroup"}}return t.type!==eC.q2.link&&tN(l,"Unsupported route type.",t),tk}class tz extends eF{constructor(e,t={}){super(e,{basePathname:"/admin",...t})}}let tK="admin-layout-model";var tU=l(18853),tW=l(16362),tH=l(42443),tG=l(55373),tY=l.n(tG);let tJ=220,tX=e=>{let{isMobile:t,closeMobileMenu:l,callback:n,delayMs:r=tJ}=e;t?(l(),window.setTimeout(n,r)):n()},tQ=e=>{let{theme:t}=el();return(0,E.jsx)(G.Ay,{theme:{...t,inherit:!1},children:e.children})};var tZ=l(53619);let t0=(0,D.createContext)(null);t0.displayName="NocoBaseRouteContext";let t1=(0,D.createContext)(null);t1.displayName="ParentRouteContext";let t2=(0,D.createContext)(null);t2.displayName="NavigateNoUpdateContext";let t5=()=>{let e=(0,D.useContext)(t2),t=(0,L.useNavigate)();return e||t},t4=()=>(0,L.useHref)("/");function t8(e,t){if(!t)return e;let l=e.indexOf("#"),n=l>=0,r=n?e.slice(0,l):e,i=n?e.slice(l+1):"",o=i.startsWith("/")||i.startsWith("!/");if(n&&o){let e=i.includes("?")?"&":"?";return`${r}#${i}${e}${t}`}let a=r.includes("?")?"&":"?";return n?`${r}${a}${t}#${i}`:`${r}${a}${t}`}function t3(e){if(_().isPlainObject(e)){let t={};return Object.keys(e).forEach(l=>{_().isPlainObject(e[l])||_().isArray(e[l])||_().isString(e[l])&&e[l].length>100||(t[l]=e[l])}),t}return _().isArray(e)?e.map(e=>_().isPlainObject(e)||_().isArray(e)?t3(e):e):e}function t6(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.location.origin;return e?(0,er.isURL)(e)?e:e.startsWith("/")?`${t}${e}`:`${t}/${e}`:""}function t9(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.location.origin;return _().isString(e)?(0,er.isURL)(e)?void(e.startsWith(l)?t(t6(e.replace(l,""),"")):window.open(e,"_self")):void t(t6(e,"")):console.error("link should be a string")}let t7={display:"flex",alignItems:"center",gap:4},le=e=>t=>{let{tooltip:l}=t;return l?(0,E.jsxs)("div",{style:t7,children:[(0,E.jsx)(e,{...t}),(0,E.jsx)(tH.A,{title:l,children:(0,E.jsx)(tZ.A,{style:{zIndex:1}})})]}):(0,E.jsx)(e,{...t})},lt=(0,D.createContext)({scopeId:"",type:""}),ll=e=>{let t=(0,D.useContext)(lt),l=(0,D.useMemo)(()=>({scopeId:e.scopeId,type:e.type,parent:t}),[t,e.scopeId,e.type]);return(0,E.jsx)(lt.Provider,{value:l,children:e.children})},ln=/^\s*\{\{\s*([\p{L}0-9_$-.]+?)\s*\}\}\s*$/u,lr=e=>"string"==typeof e&&ln.test(e),li=(e,t)=>{let[l,n]=(0,D.useState)();return(0,D.useEffect)(()=>{let l=!0;return(async()=>{if(null==e||""===e){l&&n(void 0);return}if(!(null==t?void 0:t.resolveJsonTemplate)){l&&n(e);return}try{let r=await t.resolveJsonTemplate(e);if(!l)return;if("string"==typeof r&&""!==r.trim()&&Number.isFinite(Number(r)))return void n(Number(r));n(r)}catch(e){console.error(e)}})(),()=>{l=!1}},[t,e]),l};function lo(e){let{pageSchemaUid:t,tabSchemaUid:l,tabSchemaName:n}=e;return{type:"void","x-component":"Page",properties:{[n]:{type:"void","x-component":"Grid","x-initializer":"page:addBlock",properties:{},"x-uid":l,"x-async":!0}},"x-uid":t}}function la(e){let{pageSchemaUid:t}=e;return{type:"void","x-component":"FlowRoute","x-uid":t}}let ls=(e,t,l)=>tj(l,`__admin_layout__/${e}/${encodeURIComponent(String(t))}`),ld=e=>{let t=e.context.layout;if(null==t?void 0:t.routePath)return t;let l=e;for(;l;){var n;let e=null==(n=l.props)?void 0:n.layout;if(null==e?void 0:e.routePath)return e;l=l.parent}},lu={display:"flex",alignItems:"center",justifyContent:"space-between"},lc={display:"inline-flex",alignItems:"center",justifyContent:"center",marginLeft:8,color:"inherit"},lp=[{pattern:/^\$user(?:\.(.+))?$/,resolve:e=>`ctx.user${e[1]?`.${e[1]}`:""}`},{pattern:/^currentUser(?:\.(.+))?$/,resolve:e=>`ctx.user${e[1]?`.${e[1]}`:""}`},{pattern:/^\$nRole$/,resolve:()=>"ctx.role"},{pattern:/^\$nToken$/,resolve:()=>"ctx.token"},{pattern:/^\$nURLSearchParams(?:\.(.+))?$/,resolve:e=>`ctx.urlSearchParams${e[1]?`.${e[1]}`:""}`}],lh=e=>"string"==typeof e&&e.includes("{{")?e.replace(/\{\{\s*([\s\S]*?)\s*\}\}/g,(e,t)=>{let l=String(t||"").trim();for(let e of lp){let t=l.match(e.pattern);if(t)return`{{ ${e.resolve(t)} }}`}return e}):e,lm=async e=>{let{context:t,href:l,params:n=[]}=e,r="string"==typeof l?lh(l):l,i=await t.resolveJsonTemplate(r),o={};for(let{name:e,value:l}of n)if(e)try{let n="string"==typeof l?await t.resolveJsonTemplate(lh(l)):l;if(null==n)continue;o[e]=t3(n)}catch(e){console.error(e)}return t8(String(i??l??""),tY().stringify(o))};function lf(e){return e&&"/"!==e?`/${e.replace(/^\/+/,"").replace(/\/+$/,"")}`:""}function lg(e){return/^[a-z][a-z\d+\-.]*:/i.test(e)||e.startsWith("//")||e.startsWith("#")||e.startsWith("?")}function lv(e,t){if(!e||lg(e))return e;let l=lf(t);if(!l)return e;let n=e.startsWith("/")?e:`/${e}`;return n===l||n.startsWith(`${l}/`)||n.startsWith(`${l}?`)||n.startsWith(`${l}#`)?n:`${l}${n}`}let ly=async e=>{let{context:t,href:l,params:n,openInNewWindow:r,isMobile:i,closeMobileMenu:o,navigate:a,basenameOfCurrentRouter:s}=e;try{let e=await lm({context:t,href:l,params:n||[]});if(!1!==r){i&&o(),window.open(lv(e,s),"_blank","noopener,noreferrer");return}tX({isMobile:!!i,closeMobileMenu:o,callback:()=>{t9(e,a,window.location.origin+s)}})}catch(e){console.error(e),i&&o(),window.open(lv(l,s),"_blank","noopener,noreferrer")}},lb=e=>!!e&&"function"==typeof e.getRoute,lx=(e,t)=>"function"==typeof e.context.t?e.context.t(t):t,lw=[{key:"group",label:"Group",menuType:"group"},{key:"flow-page",label:"Page",menuType:"flowPage"},{key:"link",label:"Link",menuType:"link"}],lS=(e,t)=>({uid:`${e.uid}-menu-creation-${(0,er.uid)()}`,use:"AdminLayoutMenuItemModel",props:{creationMeta:t}}),lA=(e,t)=>{let l=t=>lx(e,t),n=t?"sider":"header";return lw.map(r=>({key:r.key,label:l(r.label),createModelOptions:()=>lS(e,{menuType:r.menuType,source:n,parentRoute:t})}))},lM=e=>{let t=t=>lx(e.launcherModel,t);return(0,E.jsx)(T.AddSubModelButton,{model:e.launcherModel,subModelKey:"menuItems",items:lA(e.launcherModel,e.parentRoute),children:(0,E.jsx)(T.FlowSettingsButton,{"data-testid":e.testId,style:{background:"none"},icon:(0,E.jsx)(tU.A,{}),children:t("Add menu item")})})},lF=e=>e.icon?(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,E.jsx)(eC.In,{type:e.icon}),(0,E.jsx)("span",{children:e.title})]}):(0,E.jsx)(E.Fragment,{children:e.title}),lk=le(e=>(0,E.jsx)(E.Fragment,{children:e.children})),lC=D.createContext({closeMobileMenu:()=>{}}),lP=D.createContext({inHeader:!1}),lj=(e,t,l)=>{var n;let[r,i]=(null==e||null==(n=e.split)?void 0:n.call(e,"||"))||[],o=[{label:l("Before"),value:"beforeBegin"},{label:l("After"),value:"afterEnd"}];return i!==eC.q2.group?o:[...o,{label:l("Inner"),value:"beforeEnd",disabled:void 0!==t&&String(t)===r}]};function lE(e,t,l){let n=t.id??t.schemaUid??t.menuSchemaUid??t.pageSchemaUid??t.title??`${t.type}-${l}`;return`${e}-menu-item-${t.type||"unknown"}-${n}`}function lR(e,t,l){let n=[...e.subModels.menuItems||[]],r=new Map(n.map(e=>[e.uid,e])),i=[],o=new Set;t.forEach((t,n)=>{let a=lE(e.uid,t,n),s=r.get(a),d=!!s;if(s||(s=e.addSubModel("menuItems",{uid:a,use:"AdminLayoutMenuItemModel",props:{route:t,parentRoute:l}})),s.sortIndex=n+1,d){var u;null==(u=s.syncFromRoute)||u.call(s,t,l)}i.push(s),o.add(a)}),n.forEach(t=>{o.has(t.uid)||e.flowEngine.removeModelWithSubModels(t.uid)}),e.subModels.menuItems=i}function lT(e,t){var l,n;if(!lb(e)||!lb(t))return;let r=null==(l=e.getRoute)?void 0:l.call(e),i=null==(n=t.getRoute)?void 0:n.call(t);if((null==r?void 0:r.id)&&(null==i?void 0:i.id)&&r.id!==i.id)return{sourceId:r.id,targetId:i.id,sortField:"sort"}}function lI(e,t){var l,n;if((null==(l=t.active)?void 0:l.id)&&(null==(n=t.over)?void 0:n.id))return lT(e.getModel(String(t.active.id)),e.getModel(String(t.over.id)))}let l_=e=>{var t,l,n,r,i,o,a,s,d;let{item:u}=e,c=li(null==(l=u._route.options)||null==(t=l.badge)?void 0:t.count,null==(n=u._model)?void 0:n.context),p=t5(),h=t4(),{closeMobileMenu:m}=(0,D.useContext)(lC),f="string"==typeof u.name||"number"==typeof u.name?String(u.name):"string"==typeof(null==(r=u._route)?void 0:r.title)||"number"==typeof(null==(i=u._route)?void 0:i.title)?String(u._route.title):void 0,g=u._runtimePath,v=g?tT(g,h):g,y=(0,D.useCallback)(t=>{var l,n;if(!g){t.preventDefault(),t.stopPropagation();return}let r=0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented;if("document"===u._navigationMode){if(r)return;t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(n=e.options)?void 0:n.isMobile),closeMobileMenu:m,callback:()=>{window.location.assign(g)}});return}t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(l=e.options)?void 0:l.isMobile),closeMobileMenu:m,callback:()=>{v&&p(v)}})},[m,u,p,null==(o=e.options)?void 0:o.isMobile,g,v]),b=f?`${f}-landing-entry`:"group-landing-entry",x=e.children,w=g?"document"===u._navigationMode?(0,E.jsx)("a",{href:g,"aria-label":b,onClick:y,style:lc}):(0,E.jsx)(B.Link,{to:v||g,"aria-label":b,onClick:y,style:lc}):null;return(0,E.jsx)(t1.Provider,{value:u._parentRoute,children:(0,E.jsx)(t0.Provider,{value:u._route,children:(0,E.jsxs)("div",{"aria-label":f,role:"none",style:lu,children:[x,w,null!=c&&(0,E.jsx)(tW.A,{...null==(a=u._route.options)?void 0:a.badge,count:c,style:{marginLeft:4,color:null==(d=u._route.options)||null==(s=d.badge)?void 0:s.textColor,maxWidth:"10em"},dot:!1})]})})})},lD=e=>{let{inHeader:t}=(0,D.useContext)(lP);return e.hidden||t?e.children:(0,E.jsx)(tH.A,{title:e.title,placement:"right",children:(0,E.jsx)(tW.A,{...e.badgeProps,style:{transform:"none",maxWidth:"10em"},dot:!1,children:e.children})})},lN=e=>{var t,l,n,r,i,o,a,s,d,u,c,p,h;let{item:m}=e,f=(0,L.useLocation)(),g=li(null==(l=m._route.options)||null==(t=l.badge)?void 0:t.count,null==(n=m._model)?void 0:n.context),v=t5(),y=t4(),{closeMobileMenu:b}=(0,D.useContext)(lC),x=m.redirect||m.path,w=m._runtimePath||x,S=w?tT(w,y):w,A="document"===m._navigationMode,M={...null==(r=m._route.options)?void 0:r.badge,count:g},F=!!w&&A,k=e=>!e.defaultPrevented&&0===e.button&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,C=(0,D.useCallback)(async t=>{var l,n,r,i,o;let a=null==(l=m._route.options)?void 0:l.href,s=null==(n=m._route.options)?void 0:n.params,d=null==(r=m._route.options)?void 0:r.openInNewWindow;t.preventDefault(),t.stopPropagation(),await ly({context:null==(i=m._model)?void 0:i.context,href:a,params:s,openInNewWindow:d,isMobile:!!(null==(o=e.options)?void 0:o.isMobile),closeMobileMenu:b,navigate:v,basenameOfCurrentRouter:y})},[m,null==(i=e.options)?void 0:i.isMobile,b,v,y]),P=(0,D.useCallback)(t=>{var l,n,r;if(!w){t.preventDefault(),t.stopPropagation();return}if(A){if(!k(t))return;t.preventDefault(),t.stopPropagation(),tX({isMobile:!!(null==(r=e.options)?void 0:r.isMobile),closeMobileMenu:b,callback:()=>{window.location.assign(w)}});return}if(t.preventDefault(),t.stopPropagation(),!(null==(l=e.options)?void 0:l.isMobile)){S&&v(S);return}tX({isMobile:!!(null==(n=e.options)?void 0:n.isMobile),closeMobileMenu:b,callback:()=>{S&&v(S)}})},[null==(o=e.options)?void 0:o.isMobile,b,A,v,w,S]);if((null==(a=m._route)?void 0:a.type)===eC.q2.link)return(0,E.jsx)(t1.Provider,{value:m._parentRoute,children:(0,E.jsx)(t0.Provider,{value:m._route,children:(0,E.jsxs)("div",{role:"none",style:lu,children:[(0,E.jsx)("div",{onClick:C,children:(0,E.jsx)(B.Link,{to:f.pathname,"aria-label":"string"==typeof m.name?m.name:void 0,children:e.children})}),null!=g&&(0,E.jsx)(tW.A,{...null==(c=m._route.options)?void 0:c.badge,count:g,style:{marginLeft:4,color:null==(h=m._route.options)||null==(p=h.badge)?void 0:p.textColor,maxWidth:"10em"},dot:!1})]})})});let j=(0,E.jsx)(lD,{title:m.name,hidden:m._route.type===eC.q2.group||(m._depth||0)>0||!(null==(s=e.options)?void 0:s.collapsed),badgeProps:M,children:F?(0,E.jsx)("a",{href:w,"aria-label":"string"==typeof m.name?m.name:void 0,onClick:P,children:e.children}):w?(0,E.jsx)(B.Link,{to:S,"aria-label":"string"==typeof m.name?m.name:void 0,onClick:P,children:e.children}):(0,E.jsx)("span",{"aria-label":"string"==typeof m.name?m.name:void 0,children:e.children})});return(0,E.jsx)(t1.Provider,{value:m._parentRoute,children:(0,E.jsx)(t0.Provider,{value:m._route,children:(0,E.jsxs)("div",{role:"none",style:lu,children:[j,null!=g&&(0,E.jsx)(tW.A,{...M,style:{marginLeft:4,color:null==(u=m._route.options)||null==(d=u.badge)?void 0:d.textColor,maxWidth:"10em"},dot:!1})]})})})},lO=e=>{var t;let{model:l}=e;if(!lb(l))return null;let n=null==(t=l.getRoute)?void 0:t.call(l);return(null==n?void 0:n.id)?(0,E.jsx)(T.DragHandler,{model:l}):null},l$=e=>{var t;let{item:l,dom:n,options:r,renderType:i}=e;if(!l||!i)return null;let o=(0,E.jsx)(lk,{tooltip:null==(t=l._route)?void 0:t.tooltip,children:n});return"group"===i?(0,E.jsx)(ll,{scopeId:l._route.schemaUid,type:"groupItem",children:(0,E.jsx)(l_,{item:l,options:r,children:o})}):(0,E.jsx)(ll,{scopeId:l._route.schemaUid,type:"menuItem",children:(0,E.jsx)(lN,{item:l,options:r,children:o})})},lB=e=>{let{depth:t,isMobile:l}=e;return t>1||l&&t>0},lL=()=>(0,E.jsx)("span",{"data-nb-hidden-menu-item":"true"}),lq=(0,T.observer)(e=>{let{model:t,item:l,dom:n,renderType:r,options:i}=e,o=t.context.themeToken;return((0,D.useEffect)(()=>{t.setProps({item:l,dom:n,renderType:r,options:i})},[n,l,t,i,r]),!t.context.flowSettingsEnabled&&t.hidden)?(0,E.jsx)(lL,{}):(0,E.jsx)(tQ,{children:(0,E.jsx)(T.Droppable,{model:t,children:(0,E.jsx)(T.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1,style:{left:-o.padding,right:-o.padding}},extraToolbarItems:[{key:"menu-drag-handler",component:lO,sort:1}]})})})});function lV(e,t,l,n){let r=(null==l?void 0:l.id)??(null==l?void 0:l.schemaUid)??(null==l?void 0:l.menuSchemaUid)??(null==l?void 0:l.title)??t.uid,i=n||ld(t);return{key:"x-designer-button",name:(0,E.jsx)(lM,{testId:e,launcherModel:t,parentRoute:l}),path:ls("designer",r,i),disabled:!0,_route:{},_parentRoute:l,_launcherModel:t,icon:(0,E.jsx)(eC.In,{type:"setting"})}}let lz=(e,t,l)=>({name:l?(0,E.jsx)(lF,{icon:e.icon,title:t(e.title)}):t(e.title),icon:l?null:e.icon?(0,E.jsx)(eC.In,{type:e.icon}):null});var lK=l(12723),lU=l(73940),lW=l(98668),lH=l(87276),lG=l(28073),lY=l(95803),lJ=l(40961);let lX=e=>({href:{title:e("URL"),type:"string","x-decorator":"FormItem","x-component":"FlowSettingsVariableTextArea","x-component-props":{placeholder:e("https://www.example.com"),rows:1,maxRows:1},description:e("Do not concatenate search params in the URL")},params:{type:"array",title:e("Search parameters"),"x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:e("Name")}},value:{type:"string","x-decorator":"FormItem","x-component":"FlowSettingsVariableTextArea","x-component-props":{placeholder:e("Value"),rows:1,maxRows:1,useTypedConstant:!0,changeOnSelect:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:e("Add parameter"),"x-component":"ArrayItems.Addition"}}},openInNewWindow:{type:"boolean","x-content":e("Open in new window"),"x-decorator":"FormItem","x-component":"Checkbox"}}),lQ=async(e,t)=>{await e.request({method:"POST",url:"/uiSchemas:insert",data:t})},lZ=e=>e&&"link"===e.menuType&&"insert"!==e.source?{openInNewWindow:!0}:{},l0=[{label:"Group",value:"group"},{label:"Page",value:"flowPage"},{label:"Link",value:"link"}],l1=e=>({title:{title:e("Menu item title"),required:!0,"x-decorator":"FormItem","x-component":"Input"},icon:{title:e("Icon"),"x-decorator":"FormItem","x-component":"IconPicker"}}),l2=(e,t)=>Object.fromEntries(Object.entries(lX(e)).map(e=>{let[l,n]=e;return[l,{...n,"x-reactions":{dependencies:[t],fulfill:{state:{hidden:'{{$deps[0] !== "link"}}'}}}}]})),l5=e=>{var t,l,n;return{title:null==e?void 0:e.title,icon:null==e?void 0:e.icon,href:null==e||null==(t=e.options)?void 0:t.href,params:null==e||null==(l=e.options)?void 0:l.params,openInNewWindow:(null==e||null==(n=e.options)?void 0:n.openInNewWindow)!==!1}},l4=(e,t)=>{let l=l1(e);return(null==t?void 0:t.menuType)==="link"&&Object.assign(l,lX(e)),l},l8=e=>({menuType:{title:e("Menu type"),required:!0,enum:l0.map(t=>({label:e(t.label),value:t.value})),"x-decorator":"FormItem","x-component":"Radio.Group"},...l1(e),...l2(e,"menuType")}),l3=e=>({title:e.title,hideInSettings:e.hideInSettings,defaultParams:async()=>({menuType:"flowPage"}),uiSchema:async e=>l8(e.t),beforeParamsSave:async(t,l)=>{let n=t.model,r=n.getRoute();if(!r||e.canCreate&&!e.canCreate(r))return;let i=e.resolveParentRoute(t,r);await n.createMenuFromMeta({menuType:l.menuType,source:"insert",insertPosition:e.insertPosition,targetRoute:r,parentRoute:i},l)}}),l6=async(e,t)=>Promise.all((e||[]).filter(e=>e.type!==eC.q2.tabs).map(async e=>{var l,n;return{label:"string"==typeof e.title&&lr(e.title)?await (null==(l=t.resolveJsonTemplate)?void 0:l.call(t,e.title))??e.title:t.t(e.title),value:`${e.id}||${e.type}`,children:(null==(n=e.children)?void 0:n.length)?await l6(e.children,t):void 0}})),l9=(e,t)=>{if(t)for(let n=0;n<e.length;n++){var l;let r=e[n];if(r.id===t.id)return e[n-1];if(null==(l=r.children)?void 0:l.length){let e=l9(r.children,t);if(e)return e}}},l7=(e,t)=>{if(t)for(let n=0;n<e.length;n++){var l;let r=e[n];if(r.id===t.id)return e[n+1];if(null==(l=r.children)?void 0:l.length){let e=l7(r.children,t);if(e)return e}}},ne=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/",n=arguments.length>3?arguments[3]:void 0;if(!e)return!1;let r=l&&"/"!==l?l.replace(/\/$/,""):"",i=r&&t.startsWith(r)?t.slice(r.length)||"/":t;return!![null!=e.id?tj(n,e.id):null,e.schemaUid?tj(n,e.schemaUid):null].filter(Boolean).some(e=>i===e||i.startsWith(`${e}/`))||!!Array.isArray(e.children)&&e.children.some(e=>ne(e,i,"/",n))},nt=(e,t,l,n)=>"flowPage"===e?la({pageSchemaUid:t}):lo({pageSchemaUid:t,tabSchemaUid:l,tabSchemaName:n}),nl={beforeBegin:"insertBefore",afterEnd:"insertAfter"},nn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={...e};return delete t.item,delete t.dom,delete t.options,delete t.renderType,t};function nr(e){return"function"==typeof(null==e?void 0:e.refreshMenuRouteTree)}function ni(e){let t=e.parent;for(;t;){if(nr(t))return t;t=t.parent}}class no extends T.FlowModel{onInit(e){super.onInit(e),this.syncFromRoute(this.props.route,this.props.parentRoute),this.shouldHydratePersistedState()&&this.hydratePersistedState()}syncFromRoute(e,t){(this.setProps({route:e,parentRoute:t}),(null==e?void 0:e.type)===eC.q2.group)?lR(this,Array.isArray(e.children)?e.children:[],e):((this.subModels.menuItems||[]).forEach(e=>{this.flowEngine.removeModelWithSubModels(e.uid)}),delete this.subModels.menuItems)}getRoute(){return this.props.route}getParentRoute(){return this.props.parentRoute}getCreationMeta(){return this.props.creationMeta}isCreationSession(){var e;return!!(null==(e=this.getCreationMeta())?void 0:e.menuType)}shouldHydratePersistedState(){return!this.isCreationSession()&&(!!this.context.flowSettingsEnabled||this.hasPersistedMenuInstanceFlowFlag())}getRouteRepository(){return this.context.routeRepository}getLayout(){let e=this.context.layout;if(null==e?void 0:e.routePath)return e;let t=this;for(;t;){var l;let e=null==(l=t.props)?void 0:l.layout;if(null==e?void 0:e.routePath)return e;t=t.parent}}hasPersistedMenuInstanceFlowFlag(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getRoute();return(null==t||null==(e=t.options)?void 0:e.hasPersistedMenuInstanceFlow)===!0}getCurrentPersistedInstanceFlowCount(){return this.flowRegistry.getFlows().size}hasPersistableMenuLinkageRules(){let e=this.getStepParams("menuSettings","linkageRules");return Array.isArray(null==e?void 0:e.value)&&e.value.length>0}hasCurrentPersistedMenuState(){return this.getCurrentPersistedInstanceFlowCount()>0||this.hasPersistableMenuLinkageRules()}buildRouteOptionsWithPersistedFlowFlag(e){let t=this.getRoute(),l={...(null==t?void 0:t.options)||{}};return e?l.hasPersistedMenuInstanceFlow=!0:delete l.hasPersistedMenuInstanceFlow,Object.keys(l).length>0?l:void 0}async syncPersistedFlowRouteFlag(){if(this.isCreationSession())return;let e=this.getRoute();if((null==e?void 0:e.id)==null)return;let t=this.hasCurrentPersistedMenuState();if(this.hasPersistedMenuInstanceFlowFlag(e)===t)return;let l=this.buildRouteOptionsWithPersistedFlowFlag(t);await this.getRouteRepository().updateRoute(e.id,{options:l}),this.setProps({route:{...e,options:l}})}async destroyPersistedState(){var e,t;this.isCreationSession()||await (null==(t=this.flowEngine.modelRepository)||null==(e=t.destroy)?void 0:e.call(t,this.uid))}async hydratePersistedState(){if(!this.persistedStateHydrated)return this.persistedStateHydrating||(this.persistedStateHydrating=(async()=>{if(this.isCreationSession())return;let e=!1,t=this.flowEngine.modelRepository;if(!(null==t?void 0:t.findOne))return;let l=await t.findOne({uid:this.uid});if(null==l?void 0:l.uid){if(l.stepParams&&"object"==typeof l.stepParams&&(this.setStepParams(l.stepParams),e=this.hasPersistableMenuLinkageRules()),l.flowRegistry&&"object"==typeof l.flowRegistry){for(let e of[...this.flowRegistry.getFlows().keys()])this.flowRegistry.removeFlow(e);this.flowRegistry.addFlows(l.flowRegistry);let t=Object.values(l.flowRegistry).some(e=>{var t;return!!e&&!0!==e.manual&&(!e.on||("string"==typeof e.on?"beforeRender"===e.on:(null==(t=e.on)?void 0:t.eventName)==="beforeRender"))});e=e||t}e&&this.rerender()}})().finally(()=>{this.persistedStateHydrated=!0,this.persistedStateHydrating=void 0})),await this.persistedStateHydrating}hasPersistableInstanceFlows(){var e;let t=this.flowRegistry.getFlows().size,l=Object.keys((null==(e=this._options)?void 0:e.flowRegistry)||{}).length;return t>0||l>0}serialize(){let e=super.serialize();return e.props=nn(e.props),e}setHidden(e){let t=this.hidden;if(super.setHidden(e),t!==this.hidden){var l,n,r;let e=null==(l=(n=this.flowEngine).getModel)?void 0:l.call(n,tK),t=ni(this)||(nr(e)?e:void 0);null==t||null==(r=t.refreshMenuRouteTree)||r.call(t)}}renderHiddenInConfig(){let{item:e,dom:t,options:l,renderType:n}=this.props;return e&&n?(0,E.jsx)("div",{style:{opacity:.3},children:(0,E.jsx)(l$,{item:e,dom:t,options:l,renderType:n})}):null}async createMenuRoute(e,t){let{parentId:l,refreshAfterMutation:n=!0}=t||{},r={...e,parentId:l??e.parentId??void 0},i=n?void 0:{refreshAfterMutation:!1},{data:o}=await this.getRouteRepository().createRoute(r,i);return null==o?void 0:o.data}async createRouteForInsert(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(()=>{var e;return(null==(e=this.getCreationMeta())?void 0:e.targetRoute)||this.getRoute()})(),n=await this.createMenuRoute(e,{parentId:"beforeEnd"===t?(null==l?void 0:l.id)||void 0:(null==l?void 0:l.parentId)||void 0,refreshAfterMutation:!1}),r=nl[t];if(r){try{await this.getRouteRepository().moveRoute({sourceId:null==n?void 0:n.id,targetId:null==l?void 0:l.id,sortField:"sort",method:r})}catch(e){throw await this.getRouteRepository().refreshAccessible(),e}return null==n?void 0:n.id}return await this.getRouteRepository().refreshAccessible(),null==n?void 0:n.id}async createMenuFromMeta(e,t){let l="flowPage"===e.menuType?eC.q2.flowPage:"page"===e.menuType?eC.q2.page:"group"===e.menuType?eC.q2.group:eC.q2.link,n=async t=>{var l;return e.insertPosition?this.createRouteForInsert(t,e.insertPosition,e.targetRoute):this.createMenuRoute(t,{parentId:null==(l=e.parentRoute)?void 0:l.id})};if("group"===e.menuType)return void await n({type:l,title:t.title,icon:t.icon,schemaUid:(0,er.uid)()});if("link"===e.menuType)return void await n({type:l,title:t.title,icon:t.icon,schemaUid:(0,er.uid)(),options:{href:t.href,params:t.params,openInNewWindow:t.openInNewWindow}});let r=(0,er.uid)(),i=(0,er.uid)(),o=(0,er.uid)(),a=(0,er.uid)();await n({type:l,title:t.title,icon:t.icon,schemaUid:r,menuSchemaUid:i,enableTabs:!1,children:[{type:eC.q2.tabs,schemaUid:o,tabSchemaName:a,hidden:!0}]})}async persistMenuCreation(e){let t=this.getCreationMeta();t&&await this.createMenuFromMeta(t,e)}async updateMenuRoute(e){let t=this.getRoute();if((null==t?void 0:t.id)==null)return;let l={...e};e.options&&this.hasPersistedMenuInstanceFlowFlag(t)&&(l.options={...e.options,hasPersistedMenuInstanceFlow:!0}),await this.getRouteRepository().updateRoute(t.id,l),this.setProps({route:{...t,...l}})}async moveMenuRoute(e,t){var l,n,r,i,o;let a=this.getRoute(),[s,d]=(null==e||null==(l=e.split)?void 0:l.call(e,"||"))||[];if(s&&(null==a?void 0:a.id)!=null){if("beforeEnd"===t&&d!==eC.q2.group)throw Error((null==(r=this.context)||null==(n=r.t)?void 0:n.call(r,"Only groups support inner moves"))||"Only groups support inner moves");if("beforeEnd"===t&&String(a.id)===s)throw Error((null==(o=this.context)||null==(i=o.t)?void 0:i.call(o,"A menu group cannot be moved inside itself"))||"A menu group cannot be moved inside itself");await this.getRouteRepository().moveRoute({sourceId:a.id,sortField:"sort",method:"beforeEnd"===t?void 0:nl[t],..."beforeEnd"===t?{targetScope:{parentId:s}}:{targetId:s}})}}async saveStepParams(){if(this.isCreationSession()){if(this.creationPersisted)return!0;let e=this.getStepParams("menuCreation","basic");return await this.persistMenuCreation(e||{}),this.creationPersisted=!0,!0}return this.hasCurrentPersistedMenuState()?await super.saveStepParams():this.hasPersistedMenuInstanceFlowFlag()?await this.destroyPersistedState():this.hasPersistableInstanceFlows()&&await super.saveStepParams(),await this.syncPersistedFlowRouteFlag(),!0}async save(){if(this.isCreationSession()){if(!this.creationPersisted){let e=this.getStepParams("menuCreation","basic");await this.persistMenuCreation(e||{}),this.creationPersisted=!0}return this.remove(),!0}return await super.save(),await this.syncPersistedFlowRouteFlag(),!0}async destroy(){var e,t,l;if(this.isCreationSession())return this.remove();let n=this.getRoute();if(!(null==n?void 0:n.id))return!1;let r=this.getLayout(),i=this.getRouteRepository().listAccessible(),o=ne(n,(null==(e=this.context.location)?void 0:e.pathname)||window.location.pathname,null==(t=this.context.router)?void 0:t.basename,r),a=l9(i,n),s=l7(i,n);if(await this.getRouteRepository().deleteRoute(n.id),!o)return!0;let d=a||s;if(!d)return this.context.router.navigate("/"),!0;let u=tV({app:this.context.app,route:d,layout:r});return!u.runtimePath||("document"===u.navigationMode?window.location.assign(u.runtimePath):this.context.router.navigate(tT(u.runtimePath,null==(l=this.context.router)?void 0:l.basename)),!0)}toProLayoutRoute(e){let t=this.props.route,l=this.props.parentRoute,n=e.depth||0;if(!t||"object"!=typeof t||!e.designable&&this.hidden)return null;let r=lB({depth:n,isMobile:e.isMobile}),{name:i,icon:o}=lz(t,e.t,r),a=this.getLayout();if(t.type===eC.q2.link)return{name:i,icon:o,path:ls("link",t.id??t.schemaUid??t.menuSchemaUid??t.title??this.uid,a),hideInMenu:t.hideInMenu,_route:t,_parentRoute:l,_depth:n,_model:this};if(t.type===eC.q2.page||t.type===eC.q2.flowPage){let e=tV({app:this.context.app,route:t,layout:a});return"unsupportedV2Runtime"===e.reason?null:{name:i,icon:o,path:t.schemaUid?tj(a,t.schemaUid):ls("link",`${this.uid}-invalid`,a),redirect:t.schemaUid?tj(a,t.schemaUid):void 0,hideInMenu:t.hideInMenu,disabled:!e.runtimePath,_runtimePath:e.runtimePath,_navigationMode:e.navigationMode,_isLegacy:e.isLegacy,_route:t,_parentRoute:l,_depth:n,_model:this}}if(t.type===eC.q2.group){var s;let r=Array.isArray(t.children)?t.children:[],d=(this.subModels.menuItems||[]).map(t=>t.toProLayoutRoute({...e,depth:n+1})).filter(Boolean)||[];e.designable&&0===n&&d.push(lV("schema-initializer-Menu-side",this,t,a));let u=tR(this.context.app)?tB(r):tL(r),c=tV({app:this.context.app,route:tR(this.context.app)&&u?u:t,layout:a}),p={name:i,icon:o,path:tj(a,t.id),redirect:(null==(s=d[0])?void 0:s.key)==="x-designer-button"?void 0:tj(a,(null==u?void 0:u.schemaUid)||t.id),hideInMenu:t.hideInMenu,_runtimePath:c.runtimePath,_navigationMode:c.navigationMode,_isLegacy:c.isLegacy,_route:t,_parentRoute:l,_depth:n,_model:this};return d.length>0&&(p.routes=d),p}return null}render(){return(0,E.jsx)(l$,{item:this.props.item,dom:this.props.dom,options:this.props.options,renderType:this.props.renderType})}constructor(...e){super(...e),(0,j._)(this,"creationPersisted",!1),(0,j._)(this,"persistedStateHydrated",!1),(0,j._)(this,"persistedStateHydrating",void 0)}}no.registerFlow({key:"menuCreation",title:"Add menu item",manual:!0,steps:{basic:{title:"Add menu item",preset:!0,hideInSettings:!0,defaultParams:async e=>lZ(e.model.getCreationMeta()),uiSchema:async e=>l4(e.t,e.model.getCreationMeta())}}}),no.registerFlow({key:"menuSettings",title:"Menu settings",steps:{edit:{title:"Edit",defaultParams:async e=>l5(e.model.getRoute()),uiSchema:async e=>{let t=e.model.getRoute(),l=l1(e.t);return(null==t?void 0:t.type)===eC.q2.link&&Object.assign(l,lX(e.t)),l},beforeParamsSave:async(e,t)=>{var l;await e.model.updateMenuRoute({title:t.title,icon:t.icon,options:(null==(l=e.model.getRoute())?void 0:l.type)===eC.q2.link?{href:t.href,params:t.params,openInNewWindow:t.openInNewWindow}:void 0})}},editTooltip:{title:"Edit tooltip",defaultParams:async e=>{var t;return{tooltip:null==(t=e.model.getRoute())?void 0:t.tooltip}},uiSchema:async e=>({tooltip:{title:e.t("Tooltip"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}),beforeParamsSave:async(e,t)=>{await e.model.updateMenuRoute({tooltip:t.tooltip})}},linkageRules:{use:"menuLinkageRules",hideInSettings:async e=>e.model.isCreationSession()},moveTo:{title:"Move to",defaultParams:async()=>({position:"afterEnd"}),uiSchema:async e=>{var t;let l=await l6(e.routeRepository.listAccessible(),e),n=null==(t=e.model.getRoute())?void 0:t.id,r=lj(void 0,n,e.t);return{target:{title:e.t("Target"),enum:l,required:!0,"x-decorator":"FormItem","x-component":"TreeSelect"},position:{title:e.t("Position"),required:!0,enum:r,"x-decorator":"FormItem","x-component":"Radio.Group","x-reactions":[t=>{var l;let r=lj(null==(l=t.form.values)?void 0:l.target,n,e.t);t.dataSource=r,r.some(e=>e.value===t.value&&!e.disabled)||(t.value="afterEnd")}]}}},beforeParamsSave:async(e,t)=>{await e.model.moveMenuRoute(t.target,t.position)}},insertBefore:l3({title:"Insert before",insertPosition:"beforeBegin",resolveParentRoute:e=>e.model.getParentRoute()}),insertAfter:l3({title:"Insert after",insertPosition:"afterEnd",resolveParentRoute:e=>e.model.getParentRoute()}),insertInner:l3({title:"Insert inner",hideInSettings:async e=>{var t;return(null==(t=e.model.getRoute())?void 0:t.type)!==eC.q2.group},canCreate:e=>e.type===eC.q2.group,insertPosition:"beforeEnd",resolveParentRoute:(e,t)=>t.type===eC.q2.group?t:void 0})}});var na=l(54829),ns=l(3876);let nd=(0,Z.css)`
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  position: relative;
@@ -1356,7 +1356,7 @@ ctx.render(<JsItem />);
1356
1356
  ... (stack truncated)`}function M(e){let t=String(e||"").split("\n"),l=new Set;for(let e=0;e<t.length;e++){let n=t[e];(g.test(n)||v.test(n))&&l.add(e)}if(0===l.size)return()=>!1;let n=[0];for(let e=1;e<t.length;e++)n[e]=n[e-1]+t[e-1].length+1;let r=e=>{let t=0,l=n.length-1,r=0;for(;t<=l;){let i=t+l>>1;n[i]<=e?(r=i,t=i+1):l=i-1}return r};return e=>l.has(r(e))}function F(e,t){let l=Math.max(0,Math.min(e.length,Math.floor(t))),n=e.lineAt(l);return{line:n.number,column:l-n.from+1}}function k(e){return[...e].sort((e,t)=>{var l,n,r,i,o,a,s,d;let u=+("lint"!==e.type),c=+("lint"!==t.type);if(u!==c)return u-c;let p=(null==(n=e.location)||null==(l=n.start)?void 0:l.line)??Number.MAX_SAFE_INTEGER,h=(null==(i=t.location)||null==(r=i.start)?void 0:r.line)??Number.MAX_SAFE_INTEGER;if(p!==h)return p-h;let m=(null==(a=e.location)||null==(o=a.start)?void 0:o.column)??Number.MAX_SAFE_INTEGER,f=(null==(d=t.location)||null==(s=d.start)?void 0:s.column)??Number.MAX_SAFE_INTEGER;return m!==f?m-f:String(e.ruleId||"").localeCompare(String(t.ruleId||""))})}function C(e){let t={error:0,warn:1,info:2,log:3};return e.map((e,t)=>({log:e,index:t})).sort((e,l)=>{let n=t[e.log.level]??Number.MAX_SAFE_INTEGER,r=t[l.log.level]??Number.MAX_SAFE_INTEGER;return n!==r?n-r:e.index-l.index}).map(e=>e.log)}function P(e){let t,l=String(e||"");if(!l.trim())return[];let n=r.EY.of(l.split("\n")),i=M(l);try{t=f.parse(l).cursor()}catch(e){return[{type:"lint",ruleId:"parse-error",message:`Syntax error: ${y((null==e?void 0:e.message)||e)}`,location:{start:{line:1,column:1}}}]}let o=[],a=new Set,s=e=>{let t=Math.max(0,Math.min(l.length,e));if(i(t)||a.has(t))return;a.add(t);let r=F(n,t),s=l.slice(t,Math.min(l.length,t+24)).replace(/\s+/g," ").trim(),d=s?` near "${s}"`:"";o.push({type:"lint",ruleId:"parse-error",message:`Syntax error${d}.`,location:{start:r}})};do t.type.isError&&s(t.from);while(t.next());return o}function j(e){let t,l=String(e||"");if(!l.trim())return[];let n=M(l),o=r.EY.of(l.split("\n")),c=[],p=(e,t,r)=>{let i=Math.max(0,Math.min(l.length,e));if(n(i))return;let a=F(o,i);c.push({type:"lint",ruleId:t,message:r,location:{start:a}})},h=()=>{let e="no-noncallable-call",t=new Set,r=r=>{let i=Math.max(0,Math.min(l.length,r));n(i)||t.has(i)||(t.add(i),p(i,e,"This expression is not callable."))},i=l.length,o=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122||95===t||36===t},a=e=>{if(!e)return!1;let t=e.charCodeAt(0);return o(e)||t>=48&&t<=57},s=e=>{let t=e;for(;t<i&&/\s/.test(l[t]);)t++;return t},d=e=>!(e>=i)&&("("===l[e]||"?"===l[e]&&"."===l[e+1]&&"("===l[e+2]),u=e=>{let t=1,n="code";for(let r=e+1;r<i;r++){let e=l[r],o=r+1<i?l[r+1]:"";if("lineComment"===n){"\n"===e&&(n="code");continue}if("blockComment"===n){"*"===e&&"/"===o&&(n="code",r+=1);continue}if("single"===n){if("\\"===e){r+=1;continue}"'"===e&&(n="code");continue}if("double"===n){if("\\"===e){r+=1;continue}'"'===e&&(n="code");continue}if("template"===n){if("\\"===e){r+=1;continue}"`"===e&&(n="code");continue}if("/"===e&&"/"===o){n="lineComment",r+=1;continue}if("/"===e&&"*"===o){n="blockComment",r+=1;continue}if("'"===e){n="single";continue}if('"'===e){n="double";continue}if("`"===e){n="template";continue}if("("===e)t++;else if(")"===e&&0==--t)return r}return -1},c=e=>"true"===e||"false"===e||"null"===e,h="code";for(let e=0;e<i;e++){let t=l[e],n=e+1<i?l[e+1]:"";if("lineComment"===h){"\n"===t&&(h="code");continue}if("blockComment"===h){"*"===t&&"/"===n&&(h="code",e+=1);continue}if("/"===t&&"/"===n){h="lineComment",e+=1;continue}if("/"===t&&"*"===n){h="blockComment",e+=1;continue}if("'"===t||'"'===t){let n=t,o=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if(t===n)break;e+=1}d(s(Math.min(i,e+1)))&&r(o);continue}if("`"===t){let t=e;for(e+=1;e<i;){let t=l[e];if("\\"===t){e+=2;continue}if("`"===t)break;e+=1}d(s(Math.min(i,e+1)))&&r(t);continue}if(t>="0"&&t<="9"){let t=e;for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("."===l[e])for(e+=1;e<i&&l[e]>="0"&&l[e]<="9";)e++;if("e"===l[e]||"E"===l[e]){let t=l[e+1],n=e+1;if(("+"===t||"-"===t)&&(n+=1),l[n]>="0"&&l[n]<="9")for(e=n+1;e<i&&l[e]>="0"&&l[e]<="9";)e++}"n"===l[e]&&(e+=1),d(s(e))&&r(t),e-=1;continue}if(o(t)){let t=e;for(e+=1;e<i&&a(l[e]);)e++;c(l.slice(t,e))&&d(s(e))&&r(t),e-=1;continue}if("("===t){let t=s(e+1),n=t,p=!1;("+"===l[t]||"-"===l[t])&&(n=t,t=s(t+1));let h=l[t];if("{"===h||"["===h||"'"===h||'"'===h||"`"===h)p=!0;else if(h>="0"&&h<="9")p=!0;else if(o(h)){let e=t+1;for(;e<i&&a(l[e]);)e++;c(l.slice(t,e))&&(p=!0)}if(p){let t=u(e);t>e&&d(s(t+1))&&r(n)}}}};try{let e=i.Parser||i;t=("function"==typeof a()?e.extend(a()()):e).parse(l,{ecmaVersion:2022,sourceType:"script",allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,locations:!0})}catch(e){return h(),c}let m=new Set(d.RUNJS_ALLOWED_BARE_GLOBAL_NAMES),f=e=>{e&&"string"==typeof e.name&&m.add(e.name)},g=e=>{if(!e)return;let t=[e];for(;t.length;){let e=t.pop();e&&("Identifier"===e.type?f(e):"AssignmentPattern"===e.type?t.push(e.left):"ArrayPattern"===e.type?(e.elements||[]).forEach(e=>e&&t.push(e)):"ObjectPattern"===e.type&&(e.properties||[]).forEach(e=>e&&t.push(e.value||e)))}};try{s.a2(t,e=>{switch(null==e?void 0:e.type){case"VariableDeclarator":g(e.id);break;case"FunctionDeclaration":case"FunctionExpression":f(e.id),(e.params||[]).forEach(g);break;case"ArrowFunctionExpression":(e.params||[]).forEach(g);break;case"CatchClause":g(e.param);break;case"ClassDeclaration":f(e.id)}},u)}catch(e){}try{s.a2(t,e=>{if(!e||"string"!=typeof e.type||"CallExpression"!==e.type)return;let t=e.callee;if(!(t&&("Identifier"===t.type||"MemberExpression"===t.type||"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type||"CallExpression"===t.type||"ChainExpression"===t.type))){let l=(null==t?void 0:t.start)??e.start??0;p(l,"no-noncallable-call","This expression is not callable.")}},u)}catch(e){}try{let e=new Set,l=new Set(["t"]);s.a2(t,t=>{var n,r,i;if(!t||"string"!=typeof t.type||"CallExpression"!==t.type)return;let o=t.callee;if((null==o?void 0:o.type)==="ChainExpression"&&(o=o.expression),!o||"MemberExpression"!==o.type)return;let a=o.object;if(!a||"Identifier"!==a.type||"ctx"!==a.name)return;let s=null;if(o.computed||(null==(n=o.property)?void 0:n.type)!=="Identifier"?o.computed&&(null==(r=o.property)?void 0:r.type)==="Literal"&&"string"==typeof o.property.value&&(s=o.property.value):s=o.property.name,!s||"string"!=typeof s)return;let d=s.trim();if(!d||d.startsWith("_")||d.length>2||l.has(d)||e.has(d))return;let u=(null==(i=o.property)?void 0:i.start)??o.start??t.start??0;p(u,"possible-undefined-ctx-member-call",`Possible undefined ctx method call: ctx.${d}(). This may be a typo or not available in the current ctx API.`),e.add(d)},u)}catch(e){}try{let e=new Set;s.ai(t,{Identifier(t,l){let n=null==t?void 0:t.name;if(!n||m.has(n)||e.has(n))return;let r=l[l.length-2];if(!r||"VariableDeclarator"===r.type&&r.id===t||"FunctionDeclaration"===r.type&&r.id===t||"FunctionExpression"===r.type&&r.id===t||"ClassDeclaration"===r.type&&r.id===t||"ClassExpression"===r.type&&r.id===t||"Property"===r.type&&r.key===t&&!0!==r.computed||"MemberExpression"===r.type&&r.property===t&&!0!==r.computed||"LabeledStatement"===r.type&&r.label===t||"BreakStatement"===r.type&&r.label===t||"ContinueStatement"===r.type&&r.label===t)return;let i=t.start??0;p(i,"possible-undefined-variable",`Possible undefined variable: ${n}`),e.add(n)}},u)}catch(e){}return c}function E(e){let t=(t,l)=>{let n=l.map(e=>y(e)).join(" ").trim();e.push({level:t,message:n})},l={trace:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("log",l)},debug:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("error",l)},fatal:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("error",l)},child:()=>l};return{consoleCapture:{log:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("log",l)},info:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("info",l)},warn:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("warn",l)},error:function(){for(var e=arguments.length,l=Array(e),n=0;n<e;n++)l[n]=arguments[n];return t("error",l)}},loggerCapture:l}}function R(e){if(!e.length)return;let t={timeout:0,internal:1,"preview-start-failed":2};return[...e].sort((e,l)=>{let n=t[String(e.ruleId||"")]??10,r=t[String(l.ruleId||"")]??10;return n!==r?n-r:0})[0]}function T(e){var t;let l=null==(t=e.location)?void 0:t.start,n=l?`line ${l.line}:${l.column} `:"",r=e.ruleId?`(${e.ruleId}) `:"";return`${n}${r}${e.message}`.trim()}function I(e){if(!e)return"Preview execution: unknown";let t="number"==typeof e.durationMs?`${Math.round(e.durationMs)}ms`:"unknown";return`Preview execution: started=${e.started}, finished=${e.finished}, timeout=${e.timeout}, duration=${t}`}function _(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",n=String(e||"");return n.length<=t?n:`${n.slice(0,Math.max(0,t-l.length))}${l}`}function D(e,t){let{issues:l,logs:n,execution:r}=e,i=l.filter(e=>"lint"===e.type),o=l.filter(e=>"runtime"===e.type),a=C(n),s=R(o),d=[],u=l.length,c=i.length,p=o.length,h=a.length,m=e=>{e.length&&(d.push("Key logs:"),e.forEach(e=>{d.push(`[${e.level}] ${_(e.message,t.maxLogChars)}`)}),a.length>e.length&&d.push(`... ${a.length-e.length} more logs not shown`))};if(0===u){let e=a.some(e=>"warn"===e.level||"error"===e.level);d.push(e?`RunJS preview completed with warning/error logs: no diagnostic issues found. Logs: ${h}.`:`RunJS preview succeeded: no issues found. Logs: ${h}.`),d.push(I(r));let l=a.slice(0,Math.max(0,t.maxLogs));l.length&&(d.push(""),m(l));let n=d.join("\n").trimEnd();return{message:_(n,t.maxChars),truncated:n.length>t.maxChars}}d.push(`RunJS preview failed: ${u} issues (lint ${c} / runtime ${p}), logs: ${h}.`),d.push(I(r)),d.push("");let f=(e,l)=>{if(!l.length)return;d.push(`${e}:`);let n=l.slice(0,Math.max(0,t.maxIssues));n.forEach((e,l)=>{let n=`${l+1}) ${T(e)}`;if(d.push(n),t.includeStack&&e.stack){let l=_(String(e.stack),t.maxStackChars);d.push(_(l,t.maxStackChars))}}),l.length>n.length&&d.push(`... ${l.length-n.length} more not shown`),d.push("")},g=s&&o.length>1?[s,...o.filter(e=>e!==s)]:o;f("Static issues",i),f("Runtime issues",g);let v=a.slice(0,Math.max(0,t.maxLogs));v.length&&m(v);let y=d.join("\n").trimEnd(),b=y.length>t.maxChars;return{message:b?_(y,t.maxChars):y,truncated:b}}function N(e){let t=`(issues total ${e.issues.length}, logs total ${e.logs.length})`,l=!1;for(let n of[{maxLogs:40,maxLogChars:220,maxIssues:12,includeStack:!0,maxStackChars:800},{maxLogs:20,maxLogChars:160,maxIssues:10,includeStack:!0,maxStackChars:400},{maxLogs:12,maxLogChars:140,maxIssues:8,includeStack:!1,maxStackChars:0},{maxLogs:8,maxLogChars:120,maxIssues:5,includeStack:!1,maxStackChars:0},{maxLogs:3,maxLogChars:100,maxIssues:3,includeStack:!1,maxStackChars:0}]){let{message:r,truncated:i}=D(e,{...n,maxChars:c});if(l=l||i,!i){if(!l)return r;return _(`RunJS preview output was truncated.
1357
1357
  ${t}
1358
1358
 
1359
- ${r}`,c)}}let n=R(e.issues.filter(e=>"runtime"===e.type)),r=n?`Key runtime issue: ${T(n)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,r||void 0].filter(Boolean).join("\n").trim();return i.length<=c?i:_(i,c-1)+"\n"}function O(e){return N(e)}async function $(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="string"==typeof e?e:String(e??""),r=[],i=[],o=null==l?void 0:l.version,a=(0,d.shouldPreprocessRunJSTemplates)({version:o});i.push(...P(n)),i.push(...j(n));let s="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=E(r),s={console:e};"u">typeof window&&(s.window=window,"u">typeof navigator&&(s.navigator=navigator)),"u">typeof document&&(s.document=document);let c=n;try{c=await (0,d.prepareRunJsCode)(n,{preprocessTemplates:a})}catch(n){let e=String((null==n?void 0:n.name)||""),t=y((null==n?void 0:n.message)||n),l=n instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:A(n)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:r,execution:u}}let h=await t.createJSRunner({globals:s,timeoutMs:p,version:o});h.globals.ctx.defineProperty("logger",{value:l});let m=await h.run(c);if(u.finished=!0,u.timeout=!!(null==m?void 0:m.timeout),!(null==m?void 0:m.success)){let e=null==m?void 0:m.error,t=(null==m?void 0:m.timeout)?"Execution timed out":y((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==m?void 0:m.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:A(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${y((null==e?void 0:e.message)||e)}`,stack:A(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-s);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:r,execution:u}}function B(e){let t=new d.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function L(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=B(t),r=await $(e,n,l),i=0===r.issues.length,o=O(r);return{success:i,message:o.length>c?_(o,c):o}}},68669(e,t,l){l.d(t,{a:()=>a});var n=l(74848),r=l(84626),i=l(71021);l(96540);var o=l(7521);let a=(0,l(11869).observer)(e=>{var t;let{value:l,FilterItem:a,ctx:s}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let d=()=>{var e;(null==s||null==(e=s.model)?void 0:e.dispatchEvent)&&s.model.dispatchEvent("reset")},u=()=>{var e;(null==s||null==(e=s.model)?void 0:e.dispatchEvent)&&s.model.dispatchEvent("submit")},c=(null==s||null==(t=s.model)?void 0:t.translate)||(e=>e);return(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),u()},children:[(0,n.jsx)(o.I,{value:l,FilterItem:a}),(0,n.jsxs)(r.A,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,n.jsx)(i.Ay,{htmlType:"button",onClick:d,children:c("Reset")}),(0,n.jsx)(i.Ay,{type:"primary",htmlType:"submit",children:c("Submit")})]})]})},{displayName:"FilterContent"})},7521(e,t,l){l.d(t,{I:()=>f});var n=l(74848),r=l(97373),i=l(18853),o=l(35710),a=l(36492),s=l(84626),d=l(71021),u=l(18492);l(96540);var c=l(11869);let p=new WeakMap,h=0,m=e=>{let t=p.get(e);return t||(h+=1,t=`filter-item-${h}`,p.set(e,t)),t},f=(0,c.observer)(e=>{let{token:t}=o.A.useToken(),{value:l={logic:"$and",items:[]},FilterItem:c,disabled:p=!1,showBorder:h=!1,onRemove:g,onChange:v,closeIcon:y=(0,n.jsx)(r.A,{style:{color:t.colorIcon}})}=e,{t:b}=(0,u.B)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:x,items:w}=l,S=h?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},A=e=>{p||(l.logic=e,null==v||v(l))},M=()=>{p||(w.push({path:"",operator:"",value:""}),null==v||v(l))},F=()=>{p||(w.push({logic:"$and",items:[]}),null==v||v(l))},k=e=>{p||(w.splice(e,1),null==v||v(l))},C=e=>"path"in e||"operator"in e||"value"in e,P=e=>"logic"in e&&"items"in e;return(0,n.jsxs)("div",{style:S,children:[h&&g&&(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{position:"absolute",right:10,top:10,cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:g,children:y}),(0,n.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,n.jsxs)("span",{children:[b("Meet")," ",(0,n.jsxs)(a.A,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:x,disabled:p,onChange:A,children:[(0,n.jsx)(a.A.Option,{value:"$and",children:b("All")}),(0,n.jsx)(a.A.Option,{value:"$or",children:b("Any")})]})," ",b("conditions in the group")]})}),(0,n.jsx)("div",{children:w.map((e,r)=>P(e)?(0,n.jsx)(f,{value:e,FilterItem:c,disabled:p,showBorder:!0,onRemove:()=>k(r),onChange:e=>{w[r]=e,null==v||v(l)}},m(e)):C(e)?c?(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsx)(c,{value:e}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)):(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)):(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)))}),(0,n.jsxs)(s.A,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,n.jsx)(d.Ay,{style:{padding:0},type:"link",size:"small",icon:(0,n.jsx)(i.A,{}),onClick:M,disabled:p,children:b("Add condition")}),(0,n.jsx)(d.Ay,{style:{padding:0},type:"link",size:"small",icon:(0,n.jsx)(i.A,{}),onClick:F,disabled:p,children:b("Add condition group")})]})]})},{displayName:"FilterGroup"})},44e3(e,t,l){l.d(t,{H:()=>n});let n=(e,t,l,n)=>e.map(e=>r(e,t,l,n)).filter(Boolean),r=(e,t,l,r)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let o=e.getInterfaceOptions();if(!(null==o?void 0:o.filterable))return;let{nested:a,children:s,operators:d}=o.filterable,u={name:e.name,type:e.type,target:e.target,title:r(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:r(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=[];try{i=e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface)}catch{i=[]}let o=n(i,t+1,l,r).filter(Boolean);u.children=u.children||[],u.children.push(...o)}return u}}},58528(e,t,l){l.d(t,{Ru:()=>G,I8:()=>r.I,qi:()=>p,oJ:()=>n.a,Et:()=>D,uw:()=>Y.u});var n=l(68669),r=l(7521),i=l(74848),o=l(11869),a=l(84626),s=l(36492),d=l(95725),u=l(96540),c=l(44e3);let p=(0,o.observer)(e=>{var t;let{path:l,operator:n,value:r}=e.value,o=e.model,p=(null==(t=o.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],m=h(o.props.filterableFieldNames||[],p.map(e=>e.name)),f=o.translate,g=(0,c.H)(p.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:m,f).filter(Boolean),v=(0,u.useMemo)(()=>{let e=g.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[g,l]),y=t=>{var l;e.value.path=t;let n=g.find(e=>e.name===t);(null==n||null==(l=n.operators)?void 0:l.length)>0?e.value.operator=n.operators[0].value:e.value.operator="",e.value.value=""},b=t=>{e.value.operator=t},x=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.A,{children:[(0,i.jsx)(s.A,{style:{width:200},placeholder:f("Select field"),value:l||void 0,onChange:y,children:g.map(e=>(0,i.jsx)(s.A.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(s.A,{style:{width:120},placeholder:f("Select operator"),value:n||void 0,onChange:b,disabled:!l||0===v.length,children:v.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(d.A,{style:{width:200},placeholder:f("Enter value"),value:r,onChange:x})]})},{displayName:"FilterItem"});function h(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var m=l(63718),f=l(94313),g=l(60518),v=l(51643),y=l(60209),b=l(2077),x=l(18451),w=l.n(x),S=l(40098),A=l.n(S),M=l(20419),F=l(85352),k=l(53869),C=l(10925);let{DateFilterDynamicComponent:P}=(0,b.RZ)(()=>Promise.resolve().then(l.bind(l,13595)),"DateFilterDynamicComponent");async function j(e){var t,l,n,r;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(r=e.getPropertyMetaTree)?void 0:r.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,o.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,o.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(n=s.getPropertyMetaTree)?void 0:n.call(s,"{{ ctx.collection }}");return await i(d)}function E(e,t){if(!e||!t.length)return null;let l="collection"===t[0]?t.slice(1):t;if(!l.length)return null;let n=[],r=e,i=null;for(let e of l){var o,a,s,d,u;let t=(null==r||null==(o=r.getField)?void 0:o.call(r,e))??(null==r||null==(d=r.getFields)||null==(s=d.call(r))||null==(a=s.find)?void 0:a.call(s,t=>(null==t?void 0:t.name)===e));if(!t)return null;let c=t.title||(null==(u=t.uiSchema)?void 0:u.title)||t.name||e;i={name:t.name||e,title:c,type:t.type,interface:t.interface,uiSchema:t.uiSchema,options:t.options,paths:["collection",...l.slice(0,n.length+1)],parentTitles:[...n]},t.targetCollection?(n.push(c),r=t.targetCollection):r=null}return i}function R(e,t){return"number"!=typeof t?e:(0,C.W)(e,{maxAssociationDepth:t})}function T(e,t,l,n){var r;let o=null==e?void 0:e["x-component"],a=(null==t||null==(r=t.uiSchema)?void 0:r["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=w()({},a,u),p=(0,F.di)(null==e?void 0:e.enum,l)||[],h={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c},b=e=>{if("number"==typeof e||(null==c?void 0:c.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...r}=e||{};if("InputNumber"===o)return(0,i.jsx)(m.A,{...h,...r,value:b(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===o)return(0,i.jsx)(M.NumberPicker,{...h,...r,value:b(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===o)return(0,i.jsx)(f.A,{...h,...r,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===o)return(0,i.jsx)(s.A,{options:p,...h,...r,value:(0,F.xO)(t,h),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===o)return(0,i.jsx)(g.A,{...h,...r,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===o)return(0,i.jsx)(g.A.Group,{...h,...r,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===o)return(0,i.jsx)(v.Ay.Group,{...h,...r,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===o)return(0,i.jsx)(y.A,{...h,...r,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===o||"TextArea"===o)return(0,i.jsx)(d.A.TextArea,{...h,...r,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===o)return(0,i.jsx)(P,{...h,...r,value:t,onChange:e=>null==l?void 0:l(e)});if(o&&(null==n?void 0:n.getComponent)){let e=n.getComponent(o);if(e)return(0,i.jsx)(e,{...h,...r,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...h.style||{},...null==r?void 0:r.style}})}return(0,i.jsx)(d.A,{...h,...r,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function I(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let n=null==(t=l.target)?void 0:t.value;return void 0!==n?n:e}}return e}function _(e,t){if(!Array.isArray(e)||!t.length)return null;let l=(e,t)=>{if(!t.length)return null;let[n,...r]=t,i=e.find(e=>String(e.name)===String(n));return i?r.length?Array.isArray(i.children)?l(i.children,r):null:i:null},n=l(e,t);return n||(new Set(e.map(e=>String(e.name))).has(String(t[0]))?null:l(e,t.slice(1)))}let D=(0,o.observer)(e=>{let{value:t,model:l,disabled:n=!1,rightAsVariable:r,rightMetaTree:c,rightVariableConverters:p,ignoreFieldNames:h,maxAssociationFieldDepth:m}=e,f=(0,o.useFlowViewContext)(),g=l.translate,{path:v,operator:y,value:x}=t,[S,M]=(0,u.useState)(null),C=(0,u.useCallback)(e=>{var t;return(0,b.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),P=(0,u.useMemo)(()=>{var e,t;if(!S)return[];let l=S.interface?C(S.interface):void 0,n=null==S||null==(e=S.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(n)&&n.length?n:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(S))},[C,S]);(0,u.useEffect)(()=>{if(!P.length)return;let e=A().find(P,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=P[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[P,t]);let D=(0,u.useMemo)(()=>P.map(e=>({value:e.value,label:"string"==typeof e.label?g(e.label):e.label})),[P,g]),N=(0,u.useCallback)((e,l)=>{if(n)return;let r=t.path||"",i=e||"",o=i!==r;t.path=i,o&&r&&(t.operator="",t.value=void 0,t.noValue=!1),l&&M(l)},[n,t]),O=(0,u.useMemo)(()=>({resolveValueFromPath:e=>(M(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),$=(0,u.useCallback)(e=>{if(n)return;t.operator=e;let l=P.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[n,P,t]),B=(0,u.useMemo)(()=>P.find(e=>e.value===y),[P,y]),L=(0,u.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),q=(0,u.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),V=(0,u.useMemo)(()=>{let e=(null==S?void 0:S.uiSchema)||{},t=(null==B?void 0:B.schema)||{},l=w()({},e,t);if((null==S?void 0:S.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":q(L(S)),"x-component-props":{...l["x-component-props"]}};return w()({},l,e)}return l},[S,B,q,L]),z=u.useRef(null==V?void 0:V["x-component"]),K=null==V?void 0:V["x-component"],U=(0,u.useMemo)(()=>{let e=z.current;z.current=K;let l=void 0!==e&&e!==K;if(null==B?void 0:B.noValue)return x;if(l&&null!=x){t.value=void 0;return}return x},[K,x,t,B]),W=(0,u.useCallback)(e=>{n||(t.value=I(e))},[n,t]),H=u.useRef(g);u.useEffect(()=>{H.current=g},[g]);let G=u.useCallback(e=>{var t;return(null==(t=H.current)?void 0:t.call(H,e))??e},[]),Y=(0,u.useMemo)(()=>(0,F.di)(null==V?void 0:V.enum,G)||[],[V,G]),J=(0,u.useMemo)(()=>T(V,S,G,l.context.app),[V,S,G,l.context.app]),X=(0,u.useCallback)(()=>{let e=(0,k._H)(l.context.app,y,P),t="$in"===y||"$notIn"===y;if(e&&t){let{Comp:t,props:l}=e,r={...l},o=Array.isArray(r.options)?r.options:void 0;(!o||0===o.length)&&(null==Y?void 0:Y.length)&&(r.options=Y);let a={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(0,k.VS)(r.style)},s=Array.isArray(U)&&U.every(e=>"string"==typeof e||"number"==typeof e)?U:"string"==typeof U?U.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:a,children:(0,i.jsx)(t,{...r,style:{width:"100%",...(0,k.VS)(r.style)},value:s,disabled:n,onChange:e=>W(e)})})}let r=J;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(r,{value:U,onChange:e=>W(e),disabled:n})})},[n,y,P,U,J,l.context.app,W,Y]),Q=(0,u.useMemo)(()=>function(){return(0,i.jsx)(d.A,{placeholder:`<${g("Null")}>`,readOnly:!0})},[g]),Z=(0,u.useMemo)(()=>async()=>{let e="function"==typeof c?await c():c??f.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return R([{title:g("Constant"),name:"constant",type:"string",paths:["constant"],render:J},{title:g("Null"),name:"null",type:"object",paths:["null"],render:Q},...t],m)},[c,f,J,Q,g,m]),ee=(0,u.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?J:"null"===l?Q:null},resolveValueFromPath:e=>{var t,l;let n=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===n?"":"null"===n?null:null==p||null==(l=p.resolveValueFromPath)?void 0:l.call(p,e)},resolvePathFromValue:e=>{var t;if(null===e)return["null"];let l=(null==p||null==(t=p.resolvePathFromValue)?void 0:t.call(p,e))??("string"==typeof e?(0,o.parseValueToPath)(e):void 0);return l||["constant"]}}),[Q,p,J]),et=(0,u.useMemo)(()=>async()=>{let e=await j(l.context),t=async e=>{let t=e.interface?C(e.interface):void 0,n=[],r=null==t?void 0:t.filterable,i=null==r?void 0:r.children;if(Array.isArray(i)&&i.length)for(let t of i){var o,a,s;let r=t.title||t.name,i=(null==(o=l.context)?void 0:o.t)?l.context.t(r):r;n.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...n];return A().uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...n];return{...e,children:d.length?d:e.children}},n=[];for(let l of e)n.push(await t(l));return R(n,m)},[C,l,m]);return(0,u.useEffect)(()=>{if(S||!t.path)return;let e=!1;return(async()=>{let n=await et();if(e)return;let r=O.resolvePathFromValue(t.path);if(!(null==r?void 0:r.length))return;let i=_(n,r)||E(l.context.collection,r);i&&M(i)})(),()=>{e=!0}},[O,et,S,l.context.collection,t.path]),(0,i.jsxs)(a.A,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(o.VariableInput,{value:v,metaTree:et,onChange:N,converters:O,disabled:n,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:g("Select field"),ignoreFieldNames:h}),(0,i.jsx)(s.A,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:g("Comparison"),value:y||void 0,disabled:n,onChange:$,children:D.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),!(null==B?void 0:B.noValue)&&(r?(0,i.jsx)(o.VariableInput,{value:U,onChange:e=>W(e),metaTree:Z,converters:ee,disabled:n,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:g("Enter value")}):X())]})});var N=l(68827),O=l.n(N),$=l(97456);let{DateFilterDynamicComponent:B}=(0,b.RZ)(()=>Promise.resolve().then(l.bind(l,13595)),"DateFilterDynamicComponent");function L(e,t){return"number"!=typeof t?e:(0,C.W)(e,{maxAssociationDepth:t})}function q(e,t,l){var n,r,o;let a=null==e?void 0:e["x-component"],u=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},c=(null==e?void 0:e["x-component-props"])||{},p=w()({},u,c),h=Array.isArray(null==t||null==(r=t.uiSchema)?void 0:r.enum)?null==t||null==(o=t.uiSchema)?void 0:o.enum:void 0,g=(0,F.di)(h,l),v={style:{width:200,...(null==p?void 0:p.style)||{}},placeholder:(null==p?void 0:p.placeholder)||l("Enter value"),...p};return e=>{let{value:t,onChange:n,...r}=e||{};if("InputNumber"===a)return(0,i.jsx)(m.A,{...v,...r,value:t,onChange:n});if("NumberPicker"===a)return(0,i.jsx)(M.NumberPicker,{...v,...r,value:t,onChange:n});if("Switch"===a)return(0,i.jsx)(f.A,{...v,...r,checked:!!t,onChange:n});if("Select"===a){let e=v;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,F.ZY)(e.options,l)}:g&&(e={...e,options:g}),(0,i.jsx)(s.A,{...e,...r,value:(0,F.xO)(t,e),onChange:n})}return"DateFilterDynamicComponent"===a?(0,i.jsx)(B,{...v,...r,value:t,onChange:n}):(0,i.jsx)(d.A,{...v,...r,value:t,onChange:e=>{var t;return null==n?void 0:n(null==e||null==(t=e.target)?void 0:t.value)}})}}let V=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],z=new Set(["$in","$notIn"]);function K(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let r=n.find(e=>(null==e?void 0:e.name)==="item");if(!r)return[...n,...l];let i=(0,$.mD)(l,[r]);return[...n.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function U(e,t){var l,n;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(n=t.schema)?void 0:n["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function W(e,t){var l,n;let r=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==r||null==(l=r.filterable)?void 0:l.children)?null==r||null==(n=r.filterable)?void 0:n.children:[]).map(t=>U(e,t)),o=async e=>{let l=[...await Promise.all(e.map(e=>W(e,t))),...i];return O()(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await o(l)}}}return Array.isArray(e.children)?{...e,children:await o(e.children)}:i.length?{...e,children:i}:e}async function H(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>W(e,t)))}let G=(0,o.observer)(e=>{var t;let{value:l,model:n,extraMetaTree:r,maxAssociationFieldDepth:c}=e,p=(0,o.useFlowViewContext)(),h=n.translate,{path:m,operator:f,value:g}=l||{},[v,y]=(0,u.useState)(null),x=(0,u.useRef)(!1),S=(0,u.useMemo)(()=>{if(v){var e,t,l;let r=v.interface?(0,b.w6)(v.interface,n.context.dataSourceManager,null==(e=n.context.app)?void 0:e.dataSourceManager):void 0,i=null==v||null==(t=v.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==r||null==(l=r.filterable)?void 0:l.operators)||V).filter(e=>!e.visible||e.visible(v)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[v,n]),A=(0,u.useMemo)(()=>S.map(e=>({value:e.value,label:"string"==typeof e.label?h(e.label):e.label})),[S,h]);(0,u.useEffect)(()=>{if(0!==S.length){if(!f){if(x.current){let e=S.find(e=>e.selected)||S[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,x.current=!1}return}if(!S.some(e=>e.value===f)){let e=S.find(e=>e.selected)||S[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[S,f,l]);let M=(0,u.useMemo)(()=>S.find(e=>e.value===f),[S,f]),C=(0,u.useMemo)(()=>{let e=(null==v?void 0:v.uiSchema)||{},t=(null==M?void 0:M.schema)||{};return w()({},e,t)},[v,M]),P=(0,u.useRef)(h);(0,u.useEffect)(()=>{P.current=h},[h]);let j=(0,u.useCallback)(e=>{var t;return(null==(t=P.current)?void 0:t.call(P,e))??e},[]),E=(0,u.useMemo)(()=>q(C,v,j),[C,v,j]),R=(0,u.useMemo)(()=>(0,F.di)(null==C?void 0:C.enum,j)||[],[C,j]),T=(0,u.useMemo)(()=>{let e=(0,k._H)(n.context.app,f,S),t=z.has(f);if(!e||!t)return E;let{Comp:l,props:r}=e;return e=>{let{value:t,onChange:n,...o}=e||{},a={...r},s=Array.isArray(a.options)?a.options:void 0;(!s||0===s.length)&&R.length>0&&(a.options=R);let d=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...o,value:d,onChange:n,style:{width:200,...(0,k.VS)(a.style),...(0,k.VS)(null==o?void 0:o.style)}})}},[R,n.context.app,S,f,E]),I=(0,u.useMemo)(()=>function(){return(0,i.jsx)(d.A,{placeholder:`<${h("Null")}>`,readOnly:!0})},[h]),_=(0,u.useMemo)(()=>async()=>{let e=K((null==n?void 0:n.context.getPropertyMetaTree())||p.getPropertyMetaTree(),r);return L([{title:h("Constant"),name:"constant",type:"string",paths:["constant"]},{title:h("Null"),name:"null",type:"object",paths:["null"]},...e],c)},[p,n,h,r,c]),D=(0,u.useCallback)(async()=>{var e,t;let l=(null==n||null==(t=n.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||p.getPropertyMetaTree(),i=K(Array.isArray(l)?l:[],r),o=e=>{var t;return(0,b.w6)(e,n.context.dataSourceManager,null==(t=n.context.app)?void 0:t.dataSourceManager)};return L(await H(i,o),c)},[p,n,r,c]),N=(0,u.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?T:"null"===l?I:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,o.parseValueToPath)(e);return t||["constant"]}}),[I,T]),O=(0,u.useCallback)((e,t)=>{let n=l.path||"",r=e||"",i=r!==n;l.path=r,i&&n&&(l.operator="",l.value="",x.current=!0),n||!r||l.operator||(x.current=!0),t&&y(t)},[l]),$=(0,u.useCallback)(e=>{let t=l.operator;l.operator=e;let n=S.find(t=>t.value===e);(null==n?void 0:n.noValue)?(l.value=!0,l.noValue=!0):(z.has(t)&&!z.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,S]);return(0,i.jsxs)(a.A,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(o.VariableInput,{value:m,onChange:O,metaTree:D,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:h("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(s.A,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:h("Comparison"),value:f||void 0,onChange:$,children:A.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=S.find(e=>e.value===f))?void 0:t.noValue)&&(0,i.jsx)(o.VariableInput,{value:g,onChange:e=>l.value=e,metaTree:_,converters:N,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:h("Enter value"),clearValue:""})]})});var Y=l(17669)},10925(e,t,l){l.d(t,{W:()=>o});let n=new Set(["m2o","o2o","oho","obo","o2m","m2m","linkTo"]);function r(e){let t=(null==e?void 0:e.options)||{};return!!(t.target||t.targetCollection||t.foreignKey||t.through||n.has(String((null==e?void 0:e.interface)||"")))}function i(e,t,l){let n=r(e),i=t+ +!!n;if(n&&i>l)return null;let a=e=>Array.isArray(e)?o(e,{associationDepth:i,maxAssociationDepth:l}):async()=>{let t=await e();return o(Array.isArray(t)?t:[],{associationDepth:i,maxAssociationDepth:l})};return{...e,children:e.children?a(e.children):void 0}}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{associationDepth:l=0,maxAssociationDepth:n=2}=t;return Array.isArray(e)?e.map(e=>i(e,l,n)).filter(Boolean):[]}},17669(e,t,l){l.d(t,{u:()=>o});var n=l(96540),r=l(44e3);let i=e=>e;function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:o,noIgnore:a=!1,t:s=i}=t,d=(0,n.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,n.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=o??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,o,a]);return(0,n.useMemo)(()=>(0,r.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},39580(e,t,l){l.d(t,{b2:()=>r.b,tn:()=>n.t,S5:()=>r.S});var n=l(27941);l(74848),l(98668),l(43627),l(11869),l(96540),l(74979),l(21335);var r=l(36869);l(89378),l(47785)},51612(e,t,l){l.d(t,{g:()=>v});var n=l(74848),r=l(96540),i=l(40098),o=l.n(i),a=l(70413);let s=o().memoize(async e=>{if(!e)return e;let t=await Promise.all([l.e("2512"),l.e("32")]).then(l.bind(l,86419));return(0,a.$P)(t.default.render(e))});function d(e){let[t,l]=(0,r.useState)(""),[n,i]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{i(!0),s(e).then(e=>{l(e),i(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:n}}function u(e){let t=e,l=document.createElement("div");l.innerHTML=t;let n=l.innerText;return l=null,(null==n?void 0:n.replace(/[\n\r]/g,""))||""}var c=l(24978),p=l(22803),h=l(11869),m=l(35710);let f=()=>{let e=(0,h.useFlowContext)(),{token:t}=m.A.useToken(),l=!!e.isDarkTheme,n=new c.q(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),r={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:n,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},i={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:n,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,p.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?i:r})};var g=l(42443);let v=e=>{let{textOnly:t,overflowMode:l,style:i}=e,o=f(),{html:a=""}=d(e.value),s=u(a),c="ellipsis"===l,p=(0,r.useRef)(null),[h,m]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(p.current){let e=p.current;m(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[a,i,l]);let v={...i||{},...c?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},y=(0,n.jsx)("div",{ref:p,className:`${o} nb-markdown`,dangerouslySetInnerHTML:{__html:t?s:a},style:v});return c&&h?(0,n.jsx)(g.A,{title:(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:a},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:y}):y}},85352(e,t,l){function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,n=void 0!==t.value,r=l?t.label:String(t.value??""),i=n?t.value:r,o={label:r,value:i};return t.color&&(o.color=t.color),t.icon&&(o.icon=t.icon),o}return{label:String(e),value:e}}):[]}function r(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function i(e,t){return r(e)?t(e):e}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>({...e,label:i(null==e?void 0:e.label,t)})):[]}function a(e,t){if(e&&Array.isArray(e)&&0!==e.length)return o(n(e),t)}function s(e,t){let l=null==t?void 0:t.mode,n="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?n?[]:void 0:e}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let n=t.find(t=>(null==t?void 0:t.value)===e);return n?{value:e,label:n.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function u(e,t){var l,r,i,o;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(r=i.options)?void 0:r.length)>0)return!1;let a=null==(o=t.uiSchema)?void 0:o.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=n(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>u,OL:()=>i,ZY:()=>o,di:()=>a,xO:()=>s,yg:()=>d})},13940(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>n,eo:()=>p,pX:()=>s,w7:()=>o});let n="__custom__";function r(e){return`${n}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let n=l.type,r=l.interface;return"belongsToMany"===n||"hasMany"===n||"belongsToArray"===n||"m2m"===r||"o2m"===r||"mbm"===r}function o(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,n=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,o=i&&"object"==typeof i?i:void 0,s=(null==n?void 0:n.fieldPath)??t.fieldPath,d=(null==n?void 0:n.associationPathName)??t.associationPathName,u=null==o?void 0:o.name,c=a(s),p=a(d),h=a(u),m=new Set;return c&&m.add(c),p&&(c?c.startsWith(`${p}.`)?m.add(c):m.add(`${p}.${c}`):m.add(p)),h&&m.add(r(h)),Array.from(m)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let n=t.grid;if(!n||"object"!=typeof n)return[];let r=n.subModels;if(!r||"object"!=typeof r)return[];let i=r.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let n=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=n(c(t));if(e)return e}return null};return n(u(e))}},53869(e,t,l){l.d(t,{VS:()=>a,_H:()=>u,i2:()=>c,sI:()=>h});var n=l(96540),r=l(13595),i=l(85352);function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){return o(e)?e:void 0}function s(e){return e}function d(e){var t;let l=s(e);l._reactiveWrapperCache=void 0,null==(t=l.setupReactiveRender)||t.call(l)}function u(e,t,l){let n;if(!l||!Array.isArray(l))return null;let i=l.find(e=>(null==e?void 0:e.value)===t),a=null==i?void 0:i.schema,s=null==a?void 0:a["x-component"];if(!s)return null;if("DateFilterDynamicComponent"===s)n=r.DateFilterDynamicComponent;else{var d;n=null==e||null==(d=e.getComponent)?void 0:d.call(e,s)}return n?{Comp:n,props:o(null==a?void 0:a["x-component-props"])?a["x-component-props"]:{}}:null}function c(e){let t=s(e);return!!t&&"function"==typeof t.__originalRender&&(t.render=t.__originalRender,d(t),!0)}function p(e,t){return Array.isArray(e.options)&&"function"==typeof t?{...e,options:(0,i.ZY)(e.options,t)}:e}function h(e){let{app:t,fieldModel:l,operator:r,operators:i,propsPriority:o="field",style:h}=e,m=s(l),f=u(t,r,i);if(!f)return c(m),!1;m.__originalRender||"function"!=typeof m.render||(m.__originalRender=m.render);let{Comp:g,props:v}=f,y=a(v.style);return m.render=()=>{let e=m.props||{},t=a(e.style),l=p("operator"===o?{...e,...v}:{...v,...e},m.translate),r="operator"===o?{...t,...y}:{...y,...t},i={...h||{},...r};return n.createElement(g,{...l,...Object.keys(i).length>0?{style:i}:{},onCompositionStart:null,onCompositionEnd:null})},d(m),!0}},25359(e,t,l){l.d(t,{ON:()=>i,jI:()=>r});let n="__saveStepParamsWithSubModels";function r(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[n]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[n])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[n]}}},14252(e,t,l){l.d(t,{S0:()=>o.S0,_T:()=>o._T,s5:()=>o.s5});var n=l(11869),r=l(2077);l(96540);var i=l(2117),o=l(52717);function a(e){let t=e.model.defaultProps||{};return e.isMobileLayout&&t.icon&&!1!==e.model.enableEditIconOnly?{...t,iconOnly:!0}:t}o.S0.registerFlow({key:"buttonSettings",title:(0,n.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,n.tExpr)("Edit button"),uiSchema(e){var t,l;return{title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,n.tExpr)("Button title"),description:null==(t=(l=e.model).getTitleFieldDescription)?void 0:t.call(l)}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,n.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,n.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon&&!1!==e.model.enableEditIconOnly?{"x-decorator":"FormItem","x-component":"Switch",title:(0,n.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,n.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,n.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":r.sk,title:(0,n.tExpr)("Color")}:void 0}},defaultParams(e){var t,l;let n=a(e);return e.model.enableEditColor?{...n,color:(null==(t=e.model.props)?void 0:t.color)??n.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:n},handler(e,t){let{title:l,tooltip:n,...r}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(n,{ns:"lm-flow-engine"}),...r})}},linkageRules:{use:"actionLinkageRules"}}}),o.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),o.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),o.S0.registerEvents({click:{title:(0,n.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,n.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},52717(e,t,l){l.d(t,{S0:()=>f,_T:()=>h,s5:()=>m});var n=l(50467),r=l(74848),i=l(11869),o=l(84884),a=l(42443),s=l(71021),d=l(40098),u=l.n(d),c=l(96540),p=l(18492);function h(e){let{t}=(0,p.B)(),l=(0,i.useFlowModel)(),n=l.context.blockModel,o=e.collection||n.collection,s=o.dataSource,d=(0,c.useMemo)(()=>{let e=`${t(s.displayName||s.key)} > `,l=o?`${t(o.title)||o.name||o.tableName} `:"";return`${e}${l}`},[o,s.displayName,s.key,t]),{actionName:h}=(null==e?void 0:e.forbidden)||l.forbidden,m=(0,c.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:d,actionName:t(u().capitalize(h))}).replaceAll("&gt;",">"),[h,d,t]);return(0,r.jsx)(a.A,{title:e.message||m,children:e.children})}let m={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class f extends i.FlowModel{static _getScene(){return u().castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),delete this.props.disabled,this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}serialize(){let e=super.serialize();return delete e.props.disabled,e}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getTitleFieldDescription(){}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,r.jsx)(o.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,children:n})}render(){return this.props.tooltip?(0,r.jsx)(a.A,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,r.jsx)(o.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return this.forbidden?(0,r.jsx)(h,{children:(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})}):(0,r.jsx)(a.A,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})})}constructor(...e){super(...e),(0,n._)(this,"defaultProps",{type:"default",title:(0,i.tExpr)("Action"),iconOnly:!1}),(0,n._)(this,"enableEditTooltip",!0),(0,n._)(this,"enableEditTitle",!0),(0,n._)(this,"enableEditIcon",!0),(0,n._)(this,"enableEditIconOnly",!0),(0,n._)(this,"enableEditType",!0),(0,n._)(this,"enableEditDanger",!0),(0,n._)(this,"enableEditColor",!1),(0,n._)(this,"buttonTypeOptions",[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}])}}},15892(e,t,l){l.d(t,{P:()=>w,z:()=>S});var n=l(50467),r=l(74848),i=l(95243),o=l(11869),a=l(40098),s=l.n(a),d=l(96540),u=l(42443),c=l(39580),p=l(2117),h=l(92275),m=l(18492),f=l(27941);function g(e){return"function"==typeof(null==e?void 0:e.getResourceSettingsInitParams)?e.getResourceSettingsInitParams():"function"==typeof(null==e?void 0:e.getStepParams)?e.getStepParams("resourceSettings","init"):void 0}function v(e,t){var l,n,r,i,o,a,s;let d=(null==e||null==(l=e.context)?void 0:l.blockModel)||e,u=g(d)||{},c=(null==d||null==(n=d.context)?void 0:n.collection)||(null==d?void 0:d.collection)||(null==e||null==(r=e.context)?void 0:r.collection),p=(null==c?void 0:c.dataSource)||(null==d||null==(i=d.context)?void 0:i.dataSource)||(null==d?void 0:d.dataSource)||(null==e?void 0:e.dataSource),h=(null==p?void 0:p.key)||(null==c?void 0:c.dataSourceKey)||u.dataSourceKey,m=(null==c?void 0:c.title)||(null==c?void 0:c.name)||(null==c?void 0:c.tableName)||(null==e||null==(o=e.resource)?void 0:o.resourceName)||(null==e||null==(s=e.resource)||null==(a=s.getResourceName)?void 0:a.call(s))||u.associationName||u.collectionName,f=p?t(p.displayName||p.key):h,v=m?`${t(m)||m}`:"",y=f?`${t(f)} > `:"";return{dataSourceName:f,nameValue:`${y}${v}`,isDataSourceUnavailable:!!(h&&!p)}}function y(e){let{dataSourceName:t}=e,{t:l}=(0,m.B)(),n=t?l('The data source "{{name}}" used by this block is disabled or unavailable. Enable the data source to display this block.',{name:t}):l("The data source used by this block is disabled or unavailable. Enable the data source to display this block.");return(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"403",subTitle:n})})}let b=()=>{let{t:e}=(0,m.B)(),t=(0,o.useFlowModel)(),{dataSourceName:l,isDataSourceUnavailable:n,nameValue:i}=(0,d.useMemo)(()=>v(t,e),[t,e]),{actionName:a}=t.forbidden||{},u=(0,d.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:i,actionName:e(s().capitalize(a))}).replaceAll("&gt;",">"),[a,i,e]);return n?t.context.flowSettingsEnabled?(0,r.jsx)(y,{dataSourceName:l}):null:(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"403",subTitle:u})})};function x(){let{t:e}=(0,m.B)(),t=(0,o.useFlowModel)(),{dataSourceName:l,isDataSourceUnavailable:n,nameValue:i}=(0,d.useMemo)(()=>v(t,e),[t,e]),a=(0,d.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:i,blockType:e("Block")}).replaceAll("&gt;",">"),[i,e]);return n?t.context.flowSettingsEnabled?(0,r.jsx)(y,{dataSourceName:l}):null:(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"404",subTitle:a})})}let w={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class S extends o.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return s().castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,r.jsx)(b,{}):(0,r.jsx)(u.A,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,r.jsx)(c.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,r.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,o.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,r.jsx)(x,{}):(0,r.jsx)(c.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,r.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),(0,n._)(this,"decoratorProps",(0,i.observable)({})),(0,n._)(this,"_defaultCustomModelClasses",{}),(0,n._)(this,"customModelClasses",{}),(0,n._)(this,"collectionRequired",!1),(0,n._)(this,"ObservedRenderComponent",null),(0,n._)(this,"activeFilterSources",new Map)}}(0,n._)(S,"scene",void 0),S.registerFlow({key:"cardSettings",title:(0,o.tExpr)("Card settings"),steps:{titleDescription:{title:(0,o.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,o.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,o.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),n=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:n})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),S.define({hide:!0,label:(0,o.tExpr)("Other blocks")}),o.FlowModel.registerEvents({beforeRender:{title:(0,o.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":p.H}},handler:p.b}})},72380(e,t,l){l.d(t,{U:()=>i});var n=l(11869),r=l(14252);class i extends r.S0{}i.define({children:async e=>(await (0,n.buildSubModelItems)(r.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(r.s5.collection))})},52175(e,t,l){l.d(t,{t:()=>u});var n=l(50467),r=l(11869),i=l(40098),o=l.n(i),a=l(42632),s=l(94130),d=l(5679);class u extends d.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,n){var r;let i=new Set,o=(null==l||null==(r=l.getResourceName)?void 0:r.call(l))||n.associationName||n.collectionName;o&&i.add(String(o)),n.associationName&&i.add(String(n.associationName)),n.collectionName&&i.add(String(n.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),n=t.getDataSourceKey()||l.dataSourceKey||"main",r=this.context.engine,i=this.getDirtyTrackingVersion(r,n,t,l);if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(r,n,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&i===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(r,n,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,s.b1)(this);return(0,s.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return o().merge({},l,t)}return o().merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:n,collectionName:i,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,r.tExpr)("Search"),children:n=>e.getCollections().map(n=>{if(!this.filterCollection(n)||!this.isCollectionAvailable(n))return null;let r={dataSourceKey:n.dataSourceKey,collectionName:n.name};return{key:l(`ds-${e.key}.${n.name}`),label:n.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!i)return u(e);if(this._isScene("select")){let r={dataSourceKey:n,collectionName:i};a&&(r.associationName=a,r.sourceId="{{ctx.view.inputArgs.sourceId}}");let o=e.dataSourceManager.getCollection(n,i),s=[];return this.isCollectionAvailable(o)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let r={dataSourceKey:n,collectionName:i};a&&(r.associationName=a,r.sourceId="{{ctx.view.inputArgs.sourceId}}");let o=[],d=e.dataSourceManager.getCollection(n,i);return this.isCollectionAvailable(d)&&o.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}),null!=s&&o.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(n,i).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let r=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(r="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:n,collectionName:e.target,associationName:e.resourceName,sourceId:r};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)}),o.push({key:l("others-collections"),label:"Other collections",children:u(e)}),o}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(n,i).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let r=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(r="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:n,collectionName:e.target,associationName:e.resourceName,sourceId:r};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let r=e.dataSourceManager.getCollection(n,i);if(!r||!this.filterCollection(r)||!this.isCollectionAvailable(r))return c;let o={dataSourceKey:n,collectionName:i,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let n=this.context.engine;if(!(null==n?void 0:n.getDataSourceDirtyVersion))return;let r=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,r,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}defaultBlockTitle(){var e,t,l,n;let r=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),i=this.getResourceSettingsInitParams(),o=this.dataSource,s=this.collection,d=(null==o?void 0:o.displayName)||(null==o?void 0:o.key)||(null==i?void 0:i.dataSourceKey),u=(null==(n=this.context)||null==(l=n.dataSourceManager)||null==(t=l.getDataSources)?void 0:t.call(l).length)||0,c=(null==s?void 0:s.title)||(null==s?void 0:s.name)||(null==i?void 0:i.collectionName)||"",p=o?this.association:void 0;if(p){let e=this.resource.getResourceName(),t=o.getCollection(e.split(".")[0]);return(0,a.l)({blockLabel:r,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:null==t?void 0:t.title,associationTitle:p.title})}return(0,a.l)({blockLabel:r,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let l=this.collection;if(!l)return;let[r,i]=e.split("."),o=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${l.name}.${r}`);if(!o)return;let a=o.target;if(!a)return;let s=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${a}.${i}`);if(s&&s.isAssociationField()){if(this.resource.addAppends(e),(null==(t=s.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;s.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}n&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),n&&this.resource.refresh())}}constructor(...e){super(...e),(0,n._)(this,"isManualRefresh",!1),(0,n._)(this,"collectionRequired",!0),(0,n._)(this,"previousBeforeRenderHash",void 0),(0,n._)(this,"lastSeenDirtyVersion",null),(0,n._)(this,"dirtyRefreshing",!1)}}u.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),u.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,n=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),o=t.resource;if(o instanceof r.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){o.setData([]),o.setMeta({count:0,hasNext:!1,page:1}),o.loading=!1;return}null==n||n.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh?e.model.resource.loading=!1:await e.model.resource.refresh()}}}}),u.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,r.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),u.define({hide:!0})},5679(e,t,l){l.d(t,{R:()=>i});var n=l(11869),r=l(15892);class i extends r.z{}i.define({hide:!0,label:(0,n.tExpr)("Data blocks"),async children(e){let t=await (0,n.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:r,scene:o}=e.view.inputArgs;return t.filter(t=>{var n,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===o?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===o?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===o?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===o||l&&!r?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(n=p._isScene)?void 0:n.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},81486(e,t,l){l.d(t,{o:()=>r});var n=l(11869);class r extends n.FlowModel{static resolveUse(e,t,l){var n,r;let i=null==e||null==(r=e.stepParams)||null==(n=r.fieldBinding)?void 0:n.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},33297(e,t,l){l.d(t,{L:()=>i});var n=l(11869),r=l(14252);class i extends r.S0{}i.define({children:async e=>(await (0,n.buildSubModelItems)(r.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(r.s5.record))})},58428(e,t,l){l.d(t,{GO:()=>x,KW:()=>S,Z1:()=>y,eu:()=>b,nF:()=>v,zL:()=>s});var n=l(74848),r=l(11869),i=l(96540),o=l(72380),a=l(33297);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,n=null==t?void 0:t.name;return l&&n?{dataSourceKey:l,collectionName:n}:void 0}function c(e,t){let l=(null==e?void 0:e.collection)||d(t),n=null==l?void 0:l.dataSourceKey,r=null==l?void 0:l.name;return n&&r?{dataSourceKey:n,collectionName:r}:void 0}function p(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.dataSourceKey&&!!t.dataSourceKey&&"string"==typeof t.collectionName&&!!t.collectionName}function h(e){return e&&"object"==typeof e?e:void 0}function m(e,t){var l,n,r;let i=h(e);i&&(null==(l=i._observableCache)||delete l[t],null==(n=i._cache)||delete n[t],null==(r=i._pending)||delete r[t])}function f(e){m(null==e?void 0:e.context,"dataSource"),m(null==e?void 0:e.context,"collection"),m(null==e?void 0:e.context,"resource"),m(null==e?void 0:e.context,"association")}function g(e){var t,l,n,r,i;if(e.model.assignFormUid){let t=null==(r=(i=e.engine).getModel)?void 0:r.call(i,e.model.assignFormUid,!0);if(t)return t}let o=null==(t=e.model.subModels)?void 0:t.assignForm;return o||(null==(l=(n=e.engine).findModelByParentId)?void 0:l.call(n,e.model.uid,"assignForm"))||void 0}function v(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function y(e,t){var l,n;let r=(null==(l=(n=e.model).getStepParams)?void 0:l.call(n,t,s))||{};return{assignedValues:(null==r?void 0:r.assignedValues)||{}}}async function b(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,r.resolveRunJSObjectValues)(e,t)}catch(t){var n,i,o;return console.error(`[${l}] RunJS execution failed`,t),null==(o=e.message)||null==(i=o.error)||i.call(o,(null==(n=e.t)?void 0:n.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function x(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function w(e){let{model:t,blockModel:l}=(0,r.useFlowSettingsContext)(),d=t,u=(0,r.useFlowEngine)(),[h,m]=i.useState(null);return(0,i.useEffect)(()=>{let n=!1;return(async()=>{var r,i,h,g,v;let y=c(l,null==d?void 0:d.context),b=await u.loadOrCreateModel(y?{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel",stepParams:{resourceSettings:{init:y}}}:{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});if(n)return;if(p(y)){let e=null==(h=b.getStepParams)?void 0:h.call(b,"resourceSettings","init");p(e)&&e.dataSourceKey===y.dataSourceKey&&e.collectionName===y.collectionName||null==(v=b.setStepParams)||v.call(b,"resourceSettings","init",y),f(b),f(null==(g=b.subModels)?void 0:g.grid)}let x=(null==(r=d.getStepParams)?void 0:r.call(d,e.settingsFlowKey,s))||{};b.setInitialAssignedValues((null==x?void 0:x.assignedValues)||{});let w=t instanceof o.U&&!(t instanceof a.L);(e.clearRecordContext||w)&&(null==(i=b.context)?void 0:i.defineProperty)&&b.context.defineProperty("record",{get:()=>void 0,cache:!1}),m(b),d.assignFormUid=(null==b?void 0:b.uid)||d.assignFormUid})(),()=>{n=!0}},[d,l,u,t,t.context.flowSettingsEnabled,e.clearRecordContext,e.settingsFlowKey]),h?(0,n.jsx)(r.FlowModelRenderer,{model:h,showFlowSettings:!1}):null}function S(e){return{title:e.title||(0,r.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,n.jsx)(w,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t,l,n){var r,i,o,a,d,u,c;let p=g(t);if(!p){let r=(null==l?void 0:l.assignedValues)||(null==n?void 0:n.assignedValues)||{};null==(a=(d=t.model).setStepParams)||a.call(d,e.settingsFlowKey,s,{assignedValues:r});return}e.validateBeforeSave&&await (null==(c=p.form)||null==(u=c.validateFields)?void 0:u.call(c));let h=(null==(r=p.getAssignedValues)?void 0:r.call(p))||{};null==(i=(o=t.model).setStepParams)||i.call(o,e.settingsFlowKey,s,{assignedValues:h})},handler(){}}}},13595(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>F});var n=l(74848),r=l(96540),i=l(35710),o=l(71500),a=l(84626),s=l(36492),d=l(63718),u=l(22803),c=l(11869),p=l(2077),h=l(4198),m=l(37985),f=l(40098),g=l.n(f);let v=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,y=(e,t)=>{if(!e)return null;if(h.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,h.dayjs)(e).format(t),n=(0,h.dayjs)(l,t);return n.isValid()?n:(0,h.dayjs)(e)}let l=(0,h.dayjs)(e,t);if(l.isValid())return l;let n=(0,h.dayjs)(e);return n.isValid()?n:null},b=e=>{let{value:t,picker:l="date",format:i,showTime:o,timeFormat:a}=e,s=(0,c.useFlowEngine)(),d=s.translate.bind(s),u=(0,p.fD)(),f=[{label:d("Today"),value:u.today},{label:d("Last week"),value:u.lastWeek},{label:d("This week"),value:u.thisWeek},{label:d("Next week"),value:u.nextWeek},{label:d("Last month"),value:u.lastMonth},{label:d("This month"),value:u.thisMonth},{label:d("Next month"),value:u.nextMonth},{label:d("Last quarter"),value:u.lastQuarter},{label:d("This quarter"),value:u.thisQuarter},{label:d("Next quarter"),value:u.nextQuarter},{label:d("Last year"),value:u.lastYear},{label:d("This year"),value:u.thisYear},{label:d("Next year"),value:u.nextYear},{label:d("Last 7 days"),value:u.last7Days},{label:d("Next 7 days"),value:u.next7Days},{label:d("Last 30 days"),value:u.last30Days},{label:d("Next 30 days"),value:u.next30Days},{label:d("Last 90 days"),value:u.last90Days},{label:d("Next 90 days"),value:u.next90Days}],b=t?(0,p.Pn)(null==t?void 0:t[0],l):l,x=b===l&&i?i:(0,h.getPickerFormat)(b),w="date"===b?v(x):x,S=(0,h.getDateTimeFormat)(b,w,o,a),A={utc:!0,presets:f,...e,format:S,picker:b,showTime:!!o&&{defaultValue:[(0,h.dayjs)("00:00:00","HH:mm:ss"),(0,h.dayjs)("23:59:59","HH:mm:ss")]}},M=(0,r.useMemo)(()=>g().castArray(e.value).map(e=>y(e,S)),[e.value,S]);return(0,n.jsx)(m.A.RangePicker,{...A,style:{flex:1,...null==A?void 0:A.style},value:M})},x=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,w=(e,t)=>{if(!e)return null;if(h.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,h.dayjs)(e).format(t),n=(0,h.dayjs)(l,t);return n.isValid()?n:(0,h.dayjs)(e)}let l=(0,h.dayjs)(e,t);if(l.isValid())return l;let n=(0,h.dayjs)(e);return n.isValid()?n:null},S=e=>{let{picker:t="date",format:l,showTime:i,timeFormat:o,onChange:d}=e,u=(0,c.useFlowContext)(),f=Array.isArray(e.value)?e.value[0]:e.value,g=f?(0,p.Pn)(f,t):t,[v,y]=(0,r.useState)(g),b=u.model.translate.bind(u.model),S=e=>{let n=e===t&&l?l:(0,h.getPickerFormat)(e),r="date"===e?x(n):n;return(0,h.getDateTimeFormat)(e,r,i,o)},A=(0,r.useMemo)(()=>S(v),[l,t,i,v,o]),M=(0,r.useMemo)(()=>w(f,A),[f,A]),F={utc:!0,inputReadOnly:u.isMobileLayout,...e,underFilter:!0,showTime:!!i&&{defaultValue:(0,h.dayjs)("00:00:00","HH:mm:ss")},format:A,picker:v};return(0,n.jsxs)(a.A.Compact,{style:{width:"100%"},children:[(0,n.jsx)(s.A,{style:{width:"100px"},popupMatchSelectWidth:!1,value:v,options:[{label:b("Date"),value:"date"},{label:b("Month"),value:"month"},{label:b("Quarter"),value:"quarter"},{label:b("Year"),value:"year"}],onChange:e=>{let t=S(e),l=A;if(y(e),!f||!d)return;let n=w(f,l);n&&n.isValid()&&d(n,n.format(t))}}),(0,n.jsx)(m.A,{...F,style:{flex:1,...null==F?void 0:F.style},value:M})]})},A=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},M=e=>{let{isRange:t,defaultValue:l,onChange:i,...o}=e,a=(0,r.useCallback)((e,t)=>i(t),[i]);return t?(0,n.jsx)(b,{...o,onChange:a}):(0,n.jsx)(S,{...o,onChange:a})},F=e=>{let{value:t,onChange:l,includeNow:p=!1,...h}=e,m=(0,c.useFlowEngine)(),f=m.translate.bind(m),{token:g}=i.A.useToken(),[v,y]=(0,r.useState)(!1),b=(0,r.useMemo)(()=>A(f,p),[f,p]),x=e=>{if(y(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},w=()=>{let e=b.slice(0,3),t=b.slice(3),l=(0,u.css)`
1359
+ ${r}`,c)}}let n=R(e.issues.filter(e=>"runtime"===e.type)),r=n?`Key runtime issue: ${T(n)}`:"",i=["RunJS preview output was truncated.",t,e.execution?I(e.execution):void 0,r||void 0].filter(Boolean).join("\n").trim();return i.length<=c?i:_(i,c-1)+"\n"}function O(e){return N(e)}async function $(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="string"==typeof e?e:String(e??""),r=[],i=[],o=null==l?void 0:l.version,a=(0,d.shouldPreprocessRunJSTemplates)({version:o});i.push(...P(n)),i.push(...j(n));let s="u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now(),u={started:!1,finished:!1,timeout:!1,durationMs:void 0};try{u.started=!0;let{consoleCapture:e,loggerCapture:l}=E(r),s={console:e};"u">typeof window&&(s.window=window,"u">typeof navigator&&(s.navigator=navigator)),"u">typeof document&&(s.document=document);let c=n;try{c=await (0,d.prepareRunJsCode)(n,{preprocessTemplates:a})}catch(n){let e=String((null==n?void 0:n.name)||""),t=y((null==n?void 0:n.message)||n),l=n instanceof SyntaxError||/^SyntaxError\b/i.test(e)||/SyntaxError\b/i.test(t);return i.push({type:"runtime",ruleId:l?"preview-start-failed":"internal",message:l?t:`Preview internal failure: ${t}`,stack:A(n)}),u.finished=!0,u.timeout=!1,{issues:k(i),logs:r,execution:u}}let h=await t.createJSRunner({globals:s,timeoutMs:p,version:o});h.globals.ctx.defineProperty("logger",{value:l});let m=await h.run(c);if(u.finished=!0,u.timeout=!!(null==m?void 0:m.timeout),!(null==m?void 0:m.success)){let e=null==m?void 0:m.error,t=(null==m?void 0:m.timeout)?"Execution timed out":y((null==e?void 0:e.message)||e||"Unknown error"),l=e instanceof SyntaxError||/^SyntaxError\b/i.test(String((null==e?void 0:e.name)||""));i.push({type:"runtime",ruleId:(null==m?void 0:m.timeout)?"timeout":l?"preview-start-failed":"runtime-error",message:t,stack:A(e)})}}catch(e){u.finished=!0,u.timeout=!1,i.push({type:"runtime",ruleId:"internal",message:`Preview internal failure: ${y((null==e?void 0:e.message)||e)}`,stack:A(e)})}finally{let e=Math.max(0,("u">typeof performance&&"function"==typeof performance.now?performance.now():Date.now())-s);u.durationMs=Number.isFinite(e)?e:void 0}return{issues:k(i),logs:r,execution:u}}function B(e){let t=new d.FlowContext;if(t.addDelegate(e),"u">typeof document&&"function"==typeof document.createElement&&!e.element)try{let e=document.createElement("div");t.defineProperty("element",{value:e})}catch(e){}return t}async function L(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=B(t),r=await $(e,n,l),i=0===r.issues.length,o=O(r);return{success:i,message:o.length>c?_(o,c):o}}},68669(e,t,l){l.d(t,{a:()=>a});var n=l(74848),r=l(84626),i=l(71021);l(96540);var o=l(7521);let a=(0,l(11869).observer)(e=>{var t;let{value:l,FilterItem:a,ctx:s}=e;l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let d=()=>{var e;(null==s||null==(e=s.model)?void 0:e.dispatchEvent)&&s.model.dispatchEvent("reset")},u=()=>{var e;(null==s||null==(e=s.model)?void 0:e.dispatchEvent)&&s.model.dispatchEvent("submit")},c=(null==s||null==(t=s.model)?void 0:t.translate)||(e=>e);return(0,n.jsxs)("form",{onSubmit:e=>{e.preventDefault(),u()},children:[(0,n.jsx)(o.I,{value:l,FilterItem:a}),(0,n.jsxs)(r.A,{style:{width:"100%",display:"flex",justifyContent:"flex-end"},children:[(0,n.jsx)(i.Ay,{htmlType:"button",onClick:d,children:c("Reset")}),(0,n.jsx)(i.Ay,{type:"primary",htmlType:"submit",children:c("Submit")})]})]})},{displayName:"FilterContent"})},7521(e,t,l){l.d(t,{I:()=>f});var n=l(74848),r=l(97373),i=l(18853),o=l(35710),a=l(36492),s=l(84626),d=l(71021),u=l(18492);l(96540);var c=l(11869);let p=new WeakMap,h=0,m=e=>{let t=p.get(e);return t||(h+=1,t=`filter-item-${h}`,p.set(e,t)),t},f=(0,c.observer)(e=>{let{token:t}=o.A.useToken(),{value:l={logic:"$and",items:[]},FilterItem:c,disabled:p=!1,showBorder:h=!1,onRemove:g,onChange:v,closeIcon:y=(0,n.jsx)(r.A,{style:{color:t.colorIcon}})}=e,{t:b}=(0,u.B)();l.logic||(l.logic="$and"),Array.isArray(l.items)||(l.items=[]);let{logic:x,items:w}=l,S=h?{position:"relative",border:`1px dashed ${t.colorBorder}`,padding:t.paddingSM,marginBottom:t.marginXS,borderRadius:t.borderRadius}:{position:"relative",marginBottom:t.marginXS},A=e=>{p||(l.logic=e,null==v||v(l))},M=()=>{p||(w.push({path:"",operator:"",value:""}),null==v||v(l))},F=()=>{p||(w.push({logic:"$and",items:[]}),null==v||v(l))},k=e=>{p||(w.splice(e,1),null==v||v(l))},C=e=>"path"in e||"operator"in e||"value"in e,P=e=>"logic"in e&&"items"in e;return(0,n.jsxs)("div",{style:S,children:[h&&g&&(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{position:"absolute",right:10,top:10,cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:g,children:y}),(0,n.jsx)("div",{style:{marginBottom:8,color:t.colorText},children:(0,n.jsxs)("span",{children:[b("Meet")," ",(0,n.jsxs)(a.A,{"data-testid":"filter-select-all-or-any",style:{width:"auto"},value:x,disabled:p,onChange:A,children:[(0,n.jsx)(a.A.Option,{value:"$and",children:b("All")}),(0,n.jsx)(a.A.Option,{value:"$or",children:b("Any")})]})," ",b("conditions in the group")]})}),(0,n.jsx)("div",{children:w.map((e,r)=>P(e)?(0,n.jsx)(f,{value:e,FilterItem:c,disabled:p,showBorder:!0,onRemove:()=>k(r),onChange:e=>{w[r]=e,null==v||v(l)}},m(e)):C(e)?c?(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsx)(c,{value:e}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)):(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsxs)("span",{children:[e.path," ",e.operator," ",String(e.value)]}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)):(0,n.jsx)("div",{style:{marginBottom:8,display:"flex",alignItems:"flex-end"},children:(0,n.jsxs)(s.A,{style:{flex:1,minWidth:0},children:[(0,n.jsx)("span",{style:{color:t.colorTextTertiary},children:"Invalid filter item"}),(0,n.jsx)("button",{type:"button","aria-label":"icon-close",disabled:p,style:{marginLeft:8,marginRight:8,flex:"0 0 auto",cursor:p?"not-allowed":"pointer",background:"transparent",border:0,padding:0},onClick:()=>k(r),children:y})]})},m(e)))}),(0,n.jsxs)(s.A,{size:16,style:{marginTop:8,marginBottom:8},children:[(0,n.jsx)(d.Ay,{style:{padding:0},type:"link",size:"small",icon:(0,n.jsx)(i.A,{}),onClick:M,disabled:p,children:b("Add condition")}),(0,n.jsx)(d.Ay,{style:{padding:0},type:"link",size:"small",icon:(0,n.jsx)(i.A,{}),onClick:F,disabled:p,children:b("Add condition group")})]})]})},{displayName:"FilterGroup"})},44e3(e,t,l){l.d(t,{H:()=>n});let n=(e,t,l,n)=>e.map(e=>r(e,t,l,n)).filter(Boolean),r=(e,t,l,r)=>{var i;if(l.length&&1===t&&l.includes(e.name)||!e.interface||!1===e.filterable)return;let o=e.getInterfaceOptions();if(!(null==o?void 0:o.filterable))return;let{nested:a,children:s,operators:d}=o.filterable,u={name:e.name,type:e.type,target:e.target,title:r(e.title),schema:null==e?void 0:e.uiSchema,operators:((null==d||null==(i=d.filter)?void 0:i.call(d,t=>!(null==t?void 0:t.visible)||t.visible(e)))||[]).map(e=>({...e,label:r(e.label)}))};if(!e.target||!(t>2)){if(t>2)return u;if((null==s?void 0:s.length)&&(u.children=s),a){let i=[];try{i=e.getFields().filter(e=>"attachments"!==e.target&&"formula"!==e.interface)}catch{i=[]}let o=n(i,t+1,l,r).filter(Boolean);u.children=u.children||[],u.children.push(...o)}return u}}},58528(e,t,l){l.d(t,{Ru:()=>G,I8:()=>r.I,qi:()=>p,oJ:()=>n.a,Et:()=>D,uw:()=>Y.u});var n=l(68669),r=l(7521),i=l(74848),o=l(11869),a=l(84626),s=l(36492),d=l(95725),u=l(96540),c=l(44e3);let p=(0,o.observer)(e=>{var t;let{path:l,operator:n,value:r}=e.value,o=e.model,p=(null==(t=o.context.blockModel.collection)?void 0:t.getFields().filter(e=>"attachments"!==e.target))||[],m=h(o.props.filterableFieldNames||[],p.map(e=>e.name)),f=o.translate,g=(0,c.H)(p.filter(e=>"attachments"!==e.target&&"formula"!==e.interface&&!["belongsTo","belongsToMany","hasOne","hasMany","oho","obo","m2o","o2m","m2m"].includes(e.type)),1,e.noIgnore?[]:m,f).filter(Boolean),v=(0,u.useMemo)(()=>{let e=g.find(e=>e.name===l);return(null==e?void 0:e.operators)||[]},[g,l]),y=t=>{var l;e.value.path=t;let n=g.find(e=>e.name===t);(null==n||null==(l=n.operators)?void 0:l.length)>0?e.value.operator=n.operators[0].value:e.value.operator="",e.value.value=""},b=t=>{e.value.operator=t},x=t=>{e.value.value=t.target.value};return(0,i.jsxs)(a.A,{children:[(0,i.jsx)(s.A,{style:{width:200},placeholder:f("Select field"),value:l||void 0,onChange:y,children:g.map(e=>(0,i.jsx)(s.A.Option,{value:e.name,children:e.title},e.name))}),(0,i.jsx)(s.A,{style:{width:120},placeholder:f("Select operator"),value:n||void 0,onChange:b,disabled:!l||0===v.length,children:v.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),(0,i.jsx)(d.A,{style:{width:200},placeholder:f("Enter value"),value:r,onChange:x})]})},{displayName:"FilterItem"});function h(e,t){return null==t?void 0:t.filter(t=>!e.includes(t))}var m=l(63718),f=l(94313),g=l(60518),v=l(51643),y=l(60209),b=l(2077),x=l(18451),w=l.n(x),S=l(40098),A=l.n(S),M=l(20419),F=l(85352),k=l(53869),C=l(10925);let{DateFilterDynamicComponent:P}=(0,b.RZ)(()=>Promise.resolve().then(l.bind(l,13595)),"DateFilterDynamicComponent");async function j(e){var t,l,n,r;let i=async e=>Array.isArray(e)?e:"function"==typeof e?await e():[];if(null==(l=e.getPropertyOptions)||null==(t=l.call(e,"collection"))?void 0:t.meta){let t=null==(r=e.getPropertyMetaTree)?void 0:r.call(e,"{{ ctx.collection }}");return await i(t)}let a=()=>(null==e?void 0:e.collection)??null,s=await (0,o.createEphemeralContext)(e,{defineProperties:{collection:{get:a,meta:(0,o.createCollectionContextMeta)(a,"Current collection")}}}),d=null==(n=s.getPropertyMetaTree)?void 0:n.call(s,"{{ ctx.collection }}");return await i(d)}function E(e,t){if(!e||!t.length)return null;let l="collection"===t[0]?t.slice(1):t;if(!l.length)return null;let n=[],r=e,i=null;for(let e of l){var o,a,s,d,u;let t=(null==r||null==(o=r.getField)?void 0:o.call(r,e))??(null==r||null==(d=r.getFields)||null==(s=d.call(r))||null==(a=s.find)?void 0:a.call(s,t=>(null==t?void 0:t.name)===e));if(!t)return null;let c=t.title||(null==(u=t.uiSchema)?void 0:u.title)||t.name||e;i={name:t.name||e,title:c,type:t.type,interface:t.interface,uiSchema:t.uiSchema,options:t.options,paths:["collection",...l.slice(0,n.length+1)],parentTitles:[...n]},t.targetCollection?(n.push(c),r=t.targetCollection):r=null}return i}function R(e,t){return"number"!=typeof t?e:(0,C.W)(e,{maxAssociationDepth:t})}function T(e,t,l,n){var r;let o=null==e?void 0:e["x-component"],a=(null==t||null==(r=t.uiSchema)?void 0:r["x-component-props"])||{},u=(null==e?void 0:e["x-component-props"])||{},c=w()({},a,u),p=(0,F.di)(null==e?void 0:e.enum,l)||[],h={style:{width:200,...(null==c?void 0:c.style)||{}},placeholder:(null==c?void 0:c.placeholder)||l("Enter value"),...c},b=e=>{if("number"==typeof e||(null==c?void 0:c.stringMode)===!0&&"string"==typeof e)return e};return e=>{let{value:t,onChange:l,...r}=e||{};if("InputNumber"===o)return(0,i.jsx)(m.A,{...h,...r,value:b(t),onChange:e=>null==l?void 0:l(e)});if("NumberPicker"===o)return(0,i.jsx)(M.NumberPicker,{...h,...r,value:b(t),onChange:e=>null==l?void 0:l(e)});if("Switch"===o)return(0,i.jsx)(f.A,{...h,...r,checked:!!t,onChange:e=>null==l?void 0:l(e)});if("Select"===o)return(0,i.jsx)(s.A,{options:p,...h,...r,value:(0,F.xO)(t,h),onChange:e=>null==l?void 0:l(e)});if("Checkbox"===o)return(0,i.jsx)(g.A,{...h,...r,checked:!!t,onChange:e=>null==l?void 0:l(e.target.checked)});if("Checkbox.Group"===o)return(0,i.jsx)(g.A.Group,{...h,...r,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Radio.Group"===o)return(0,i.jsx)(v.Ay.Group,{...h,...r,value:Array.isArray(t)||"string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:void 0,onChange:e=>null==l?void 0:l(e.target.value)});if("Cascader"===o)return(0,i.jsx)(y.A,{...h,...r,value:Array.isArray(t)?t:void 0,onChange:e=>null==l?void 0:l(e)});if("Input.TextArea"===o||"TextArea"===o)return(0,i.jsx)(d.A.TextArea,{...h,...r,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)});if("DateFilterDynamicComponent"===o)return(0,i.jsx)(P,{...h,...r,value:t,onChange:e=>null==l?void 0:l(e)});if(o&&(null==n?void 0:n.getComponent)){let e=n.getComponent(o);if(e)return(0,i.jsx)(e,{...h,...r,value:t,onChange:e=>null==l?void 0:l(e),style:{width:200,...h.style||{},...null==r?void 0:r.style}})}return(0,i.jsx)(d.A,{...h,...r,value:"string"==typeof t?t:null==t?"":String(t),onChange:e=>null==l?void 0:l(e.target.value)})}}function I(e){if(e&&"object"==typeof e){let l=e;if("function"==typeof l.preventDefault||l.nativeEvent||"target"in l){var t;let n=null==(t=l.target)?void 0:t.value;return void 0!==n?n:e}}return e}function _(e,t){if(!Array.isArray(e)||!t.length)return null;let l=(e,t)=>{if(!t.length)return null;let[n,...r]=t,i=e.find(e=>String(e.name)===String(n));return i?r.length?Array.isArray(i.children)?l(i.children,r):null:i:null},n=l(e,t);return n||(new Set(e.map(e=>String(e.name))).has(String(t[0]))?null:l(e,t.slice(1)))}let D=(0,o.observer)(e=>{let{value:t,model:l,disabled:n=!1,rightAsVariable:r,rightMetaTree:c,rightVariableConverters:p,ignoreFieldNames:h,maxAssociationFieldDepth:m}=e,f=(0,o.useFlowViewContext)(),g=l.translate,{path:v,operator:y,value:x}=t,[S,M]=(0,u.useState)(null),C=(0,u.useCallback)(e=>{var t;return(0,b.w6)(e,l.context.dataSourceManager,null==(t=l.context.app)?void 0:t.dataSourceManager)},[l]),P=(0,u.useMemo)(()=>{var e,t;if(!S)return[];let l=S.interface?C(S.interface):void 0,n=null==S||null==(e=S.uiSchema)?void 0:e["x-filter-operators"];return((Array.isArray(n)&&n.length?n:null==l||null==(t=l.filterable)?void 0:t.operators)||[]).filter(e=>!e.visible||e.visible(S))},[C,S]);(0,u.useEffect)(()=>{if(!P.length)return;let e=A().find(P,e=>e.value===t.operator);if(e)t.noValue=!!e.noValue;else{let e=P[0];t.operator=e.value,t.value=!!e.noValue||void 0,t.noValue=!!e.noValue}},[P,t]);let D=(0,u.useMemo)(()=>P.map(e=>({value:e.value,label:"string"==typeof e.label?g(e.label):e.label})),[P,g]),N=(0,u.useCallback)((e,l)=>{if(n)return;let r=t.path||"",i=e||"",o=i!==r;t.path=i,o&&r&&(t.operator="",t.value=void 0,t.noValue=!1),l&&M(l)},[n,t]),O=(0,u.useMemo)(()=>({resolveValueFromPath:e=>(M(e),(null==e?void 0:e.paths.slice(1).join("."))||null),resolvePathFromValue(e){if(null==e)return;let t=String(e).trim();if(t)return["collection",...t.split(".")]}}),[]),$=(0,u.useCallback)(e=>{if(n)return;t.operator=e;let l=P.find(t=>t.value===e);(null==l?void 0:l.noValue)?(t.value=!0,t.noValue=!0):(t.value=void 0,t.noValue=!1)},[n,P,t]),B=(0,u.useMemo)(()=>P.find(e=>e.value===y),[P,y]),L=(0,u.useCallback)(e=>{var t,l;return(null==e||null==(t=e.options)?void 0:t.dataType)||(null==e?void 0:e.dataType)||(null==e?void 0:e.type)||(null==e||null==(l=e.uiSchema)?void 0:l.type)||"double"},[]),q=(0,u.useCallback)(e=>{switch(e){case"boolean":return"Switch";case"date":return"DateFilterDynamicComponent";case"integer":case"bigInt":case"double":case"decimal":case"number":return"InputNumber";default:return"Input"}},[]),V=(0,u.useMemo)(()=>{let e=(null==S?void 0:S.uiSchema)||{},t=(null==B?void 0:B.schema)||{},l=w()({},e,t);if((null==S?void 0:S.interface)==="formula"){let e={"x-read-pretty":!1,"x-component":q(L(S)),"x-component-props":{...l["x-component-props"]}};return w()({},l,e)}return l},[S,B,q,L]),z=u.useRef(null==V?void 0:V["x-component"]),K=null==V?void 0:V["x-component"],U=(0,u.useMemo)(()=>{let e=z.current;z.current=K;let l=void 0!==e&&e!==K;if(null==B?void 0:B.noValue)return x;if(l&&null!=x){t.value=void 0;return}return x},[K,x,t,B]),W=(0,u.useCallback)(e=>{n||(t.value=I(e))},[n,t]),H=u.useRef(g);u.useEffect(()=>{H.current=g},[g]);let G=u.useCallback(e=>{var t;return(null==(t=H.current)?void 0:t.call(H,e))??e},[]),Y=(0,u.useMemo)(()=>(0,F.di)(null==V?void 0:V.enum,G)||[],[V,G]),J=(0,u.useMemo)(()=>T(V,S,G,l.context.app),[V,S,G,l.context.app]),X=(0,u.useCallback)(()=>{let e=(0,k._H)(l.context.app,y,P),t="$in"===y||"$notIn"===y;if(e&&t){let{Comp:t,props:l}=e,r={...l},o=Array.isArray(r.options)?r.options:void 0;(!o||0===o.length)&&(null==Y?void 0:Y.length)&&(r.options=Y);let a={flex:"1 1 40%",minWidth:160,maxWidth:"100%",...(0,k.VS)(r.style)},s=Array.isArray(U)&&U.every(e=>"string"==typeof e||"number"==typeof e)?U:"string"==typeof U?U.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)("div",{style:a,children:(0,i.jsx)(t,{...r,style:{width:"100%",...(0,k.VS)(r.style)},value:s,disabled:n,onChange:e=>W(e)})})}let r=J;return(0,i.jsx)("div",{style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},children:(0,i.jsx)(r,{value:U,onChange:e=>W(e),disabled:n})})},[n,y,P,U,J,l.context.app,W,Y]),Q=(0,u.useMemo)(()=>function(){return(0,i.jsx)(d.A,{placeholder:`<${g("Null")}>`,readOnly:!0})},[g]),Z=(0,u.useMemo)(()=>async()=>{let e="function"==typeof c?await c():c??f.getPropertyMetaTree(),t=Array.isArray(e)?e:await e();return R([{title:g("Constant"),name:"constant",type:"string",paths:["constant"],render:J},{title:g("Null"),name:"null",type:"object",paths:["null"],render:Q},...t],m)},[c,f,J,Q,g,m]),ee=(0,u.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?J:"null"===l?Q:null},resolveValueFromPath:e=>{var t,l;let n=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===n?"":"null"===n?null:null==p||null==(l=p.resolveValueFromPath)?void 0:l.call(p,e)},resolvePathFromValue:e=>{var t;if(null===e)return["null"];let l=(null==p||null==(t=p.resolvePathFromValue)?void 0:t.call(p,e))??("string"==typeof e?(0,o.parseValueToPath)(e):void 0);return l||["constant"]}}),[Q,p,J]),et=(0,u.useMemo)(()=>async()=>{let e=await j(l.context),t=async e=>{let t=e.interface?C(e.interface):void 0,n=[],r=null==t?void 0:t.filterable,i=null==r?void 0:r.children;if(Array.isArray(i)&&i.length)for(let t of i){var o,a,s;let r=t.title||t.name,i=(null==(o=l.context)?void 0:o.t)?l.context.t(r):r;n.push({name:t.name,title:i,type:(null==(a=t.schema)?void 0:a.type)||"string",interface:(null==(s=t.schema)?void 0:s["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]})}if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=[...Array.isArray(e)?e:[],...n];return A().uniqBy(l,"name")}}}let d=[...Array.isArray(e.children)?e.children:[],...n];return{...e,children:d.length?d:e.children}},n=[];for(let l of e)n.push(await t(l));return R(n,m)},[C,l,m]);return(0,u.useEffect)(()=>{if(S||!t.path)return;let e=!1;return(async()=>{let n=await et();if(e)return;let r=O.resolvePathFromValue(t.path);if(!(null==r?void 0:r.length))return;let i=_(n,r)||E(l.context.collection,r);i&&M(i)})(),()=>{e=!0}},[O,et,S,l.context.collection,t.path]),(0,i.jsxs)(a.A,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(o.VariableInput,{value:v,metaTree:et,onChange:N,converters:O,disabled:n,showValueComponent:!1,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},onlyLeafSelectable:!0,placeholder:g("Select field"),ignoreFieldNames:h}),(0,i.jsx)(s.A,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:g("Comparison"),value:y||void 0,disabled:n,onChange:$,children:D.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),!(null==B?void 0:B.noValue)&&(r?(0,i.jsx)(o.VariableInput,{value:U,onChange:e=>W(e),metaTree:Z,converters:ee,disabled:n,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:g("Enter value")}):X())]})});var N=l(68827),O=l.n(N),$=l(97456);let{DateFilterDynamicComponent:B}=(0,b.RZ)(()=>Promise.resolve().then(l.bind(l,13595)),"DateFilterDynamicComponent");function L(e,t){return"number"!=typeof t?e:(0,C.W)(e,{maxAssociationDepth:t})}function q(e,t,l){var n,r,o;let a=null==e?void 0:e["x-component"],u=(null==t||null==(n=t.uiSchema)?void 0:n["x-component-props"])||{},c=(null==e?void 0:e["x-component-props"])||{},p=w()({},u,c),h=Array.isArray(null==t||null==(r=t.uiSchema)?void 0:r.enum)?null==t||null==(o=t.uiSchema)?void 0:o.enum:void 0,g=(0,F.di)(h,l),v={style:{width:200,...(null==p?void 0:p.style)||{}},placeholder:(null==p?void 0:p.placeholder)||l("Enter value"),...p};return e=>{let{value:t,onChange:n,...r}=e||{};if("InputNumber"===a)return(0,i.jsx)(m.A,{...v,...r,value:t,onChange:n});if("NumberPicker"===a)return(0,i.jsx)(M.NumberPicker,{...v,...r,value:t,onChange:n});if("Switch"===a)return(0,i.jsx)(f.A,{...v,...r,checked:!!t,onChange:n});if("Select"===a){let e=v;return Array.isArray(null==e?void 0:e.options)&&e.options.length>0?e={...e,options:(0,F.ZY)(e.options,l)}:g&&(e={...e,options:g}),(0,i.jsx)(s.A,{...e,...r,value:(0,F.xO)(t,e),onChange:n})}return"DateFilterDynamicComponent"===a?(0,i.jsx)(B,{...v,...r,value:t,onChange:n}):(0,i.jsx)(d.A,{...v,...r,value:t,onChange:e=>{var t;return null==n?void 0:n(null==e||null==(t=e.target)?void 0:t.value)}})}}let V=[{value:"$includes",label:"contains",selected:!0},{value:"$notIncludes",label:"does not contain"},{value:"$eq",label:"is"},{value:"$ne",label:"is not"},{value:"$empty",label:"is empty",noValue:!0},{value:"$notEmpty",label:"is not empty",noValue:!0}],z=new Set(["$in","$notIn"]);function K(e,t){let l=Array.isArray(e)?e:[],n=Array.isArray(t)?t:[];if(!n.length)return l;let r=n.find(e=>(null==e?void 0:e.name)==="item");if(!r)return[...n,...l];let i=(0,$.mD)(l,[r]);return[...n.filter(e=>(null==e?void 0:e.name)!=="item"),...i]}function U(e,t){var l,n;return{name:t.name,title:t.title||t.name,type:(null==(l=t.schema)?void 0:l.type)||"string",interface:(null==(n=t.schema)?void 0:n["x-component"])==="Select"?"select":"input",uiSchema:{...t.schema||{},"x-filter-operators":t.operators},paths:[...e.paths||[],t.name],parentTitles:[...e.parentTitles||[],e.title]}}async function W(e,t){var l,n;let r=e.interface&&t?t(e.interface):void 0,i=(Array.isArray(null==r||null==(l=r.filterable)?void 0:l.children)?null==r||null==(n=r.filterable)?void 0:n.children:[]).map(t=>U(e,t)),o=async e=>{let l=[...await Promise.all(e.map(e=>W(e,t))),...i];return O()(l,e=>e.name)};if("function"==typeof e.children){let t=e.children;return{...e,children:async()=>{let e=await t(),l=Array.isArray(e)?e:[];return await o(l)}}}return Array.isArray(e.children)?{...e,children:await o(e.children)}:i.length?{...e,children:i}:e}async function H(e,t){let l=Array.isArray(e)?e:[];return await Promise.all(l.map(e=>W(e,t)))}let G=(0,o.observer)(e=>{var t;let{value:l,model:n,extraMetaTree:r,maxAssociationFieldDepth:c}=e,p=(0,o.useFlowViewContext)(),h=n.translate,{path:m,operator:f,value:g}=l||{},[v,y]=(0,u.useState)(null),x=(0,u.useRef)(!1),S=(0,u.useMemo)(()=>{if(v){var e,t,l;let r=v.interface?(0,b.w6)(v.interface,n.context.dataSourceManager,null==(e=n.context.app)?void 0:e.dataSourceManager):void 0,i=null==v||null==(t=v.uiSchema)?void 0:t["x-filter-operators"];return((Array.isArray(i)&&i.length?i:null==r||null==(l=r.filterable)?void 0:l.operators)||V).filter(e=>!e.visible||e.visible(v)).map(e=>({value:e.value,label:e.label,noValue:!!e.noValue,schema:e.schema,selected:!!e.selected}))}return[]},[v,n]),A=(0,u.useMemo)(()=>S.map(e=>({value:e.value,label:"string"==typeof e.label?h(e.label):e.label})),[S,h]);(0,u.useEffect)(()=>{if(0!==S.length){if(!f){if(x.current){let e=S.find(e=>e.selected)||S[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1,x.current=!1}return}if(!S.some(e=>e.value===f)){let e=S.find(e=>e.selected)||S[0];l.operator=(null==e?void 0:e.value)||"",(null==e?void 0:e.noValue)?(l.value=!0,l.noValue=!0):l.noValue=!1}}},[S,f,l]);let M=(0,u.useMemo)(()=>S.find(e=>e.value===f),[S,f]),C=(0,u.useMemo)(()=>{let e=(null==v?void 0:v.uiSchema)||{},t=(null==M?void 0:M.schema)||{};return w()({},e,t)},[v,M]),P=(0,u.useRef)(h);(0,u.useEffect)(()=>{P.current=h},[h]);let j=(0,u.useCallback)(e=>{var t;return(null==(t=P.current)?void 0:t.call(P,e))??e},[]),E=(0,u.useMemo)(()=>q(C,v,j),[C,v,j]),R=(0,u.useMemo)(()=>(0,F.di)(null==C?void 0:C.enum,j)||[],[C,j]),T=(0,u.useMemo)(()=>{let e=(0,k._H)(n.context.app,f,S),t=z.has(f);if(!e||!t)return E;let{Comp:l,props:r}=e;return e=>{let{value:t,onChange:n,...o}=e||{},a={...r},s=Array.isArray(a.options)?a.options:void 0;(!s||0===s.length)&&R.length>0&&(a.options=R);let d=Array.isArray(t)?t:"string"==typeof t?t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean):[];return(0,i.jsx)(l,{...a,...o,value:d,onChange:n,style:{width:200,...(0,k.VS)(a.style),...(0,k.VS)(null==o?void 0:o.style)}})}},[R,n.context.app,S,f,E]),I=(0,u.useMemo)(()=>function(){return(0,i.jsx)(d.A,{placeholder:`<${h("Null")}>`,readOnly:!0})},[h]),_=(0,u.useMemo)(()=>async()=>{let e=K((null==n?void 0:n.context.getPropertyMetaTree())||p.getPropertyMetaTree(),r);return L([{title:h("Constant"),name:"constant",type:"string",paths:["constant"]},{title:h("Null"),name:"null",type:"object",paths:["null"]},...e],c)},[p,n,h,r,c]),D=(0,u.useCallback)(async()=>{var e,t;let l=(null==n||null==(t=n.context)||null==(e=t.getPropertyMetaTree)?void 0:e.call(t))||p.getPropertyMetaTree(),i=K(Array.isArray(l)?l:[],r),o=e=>{var t;return(0,b.w6)(e,n.context.dataSourceManager,null==(t=n.context.app)?void 0:t.dataSourceManager)};return L(await H(i,o),c)},[p,n,r,c]),N=(0,u.useMemo)(()=>({renderInputComponent:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?T:"null"===l?I:null},resolveValueFromPath:e=>{var t;let l=null==e||null==(t=e.paths)?void 0:t[0];return"constant"===l?"":"null"===l?null:void 0},resolvePathFromValue:e=>{if(null===e)return["null"];let t=(0,o.parseValueToPath)(e);return t||["constant"]}}),[I,T]),O=(0,u.useCallback)((e,t)=>{let n=l.path||"",r=e||"",i=r!==n;l.path=r,i&&n&&(l.operator="",l.value="",x.current=!0),n||!r||l.operator||(x.current=!0),t&&y(t)},[l]),$=(0,u.useCallback)(e=>{let t=l.operator;l.operator=e;let n=S.find(t=>t.value===e);(null==n?void 0:n.noValue)?(l.value=!0,l.noValue=!0):(z.has(t)&&!z.has(e)&&Array.isArray(l.value)&&(l.value=l.value.join("\n")),l.noValue=!1)},[l,S]);return(0,i.jsxs)(a.A,{wrap:!0,style:{width:"100%"},children:[(0,i.jsx)(o.VariableInput,{value:m,onChange:O,metaTree:D,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:h("Select variable"),onlyLeafSelectable:!0}),(0,i.jsx)(s.A,{style:{flex:"0 0 140px",minWidth:120,maxWidth:"100%"},placeholder:h("Comparison"),value:f||void 0,onChange:$,children:A.map(e=>(0,i.jsx)(s.A.Option,{value:e.value,children:e.label},e.value))}),!(null==(t=S.find(e=>e.value===f))?void 0:t.noValue)&&(0,i.jsx)(o.VariableInput,{value:g,onChange:e=>l.value=e,metaTree:_,converters:N,showValueComponent:!0,style:{flex:"1 1 40%",minWidth:160,maxWidth:"100%"},placeholder:h("Enter value"),clearValue:""})]})});var Y=l(17669)},10925(e,t,l){l.d(t,{W:()=>o});let n=new Set(["m2o","o2o","oho","obo","o2m","m2m","linkTo"]);function r(e){let t=(null==e?void 0:e.options)||{};return!!(t.target||t.targetCollection||t.foreignKey||t.through||n.has(String((null==e?void 0:e.interface)||"")))}function i(e,t,l){let n=r(e),i=t+ +!!n;if(n&&i>l)return null;let a=e=>Array.isArray(e)?o(e,{associationDepth:i,maxAssociationDepth:l}):async()=>{let t=await e();return o(Array.isArray(t)?t:[],{associationDepth:i,maxAssociationDepth:l})};return{...e,children:e.children?a(e.children):void 0}}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{associationDepth:l=0,maxAssociationDepth:n=2}=t;return Array.isArray(e)?e.map(e=>i(e,l,n)).filter(Boolean):[]}},17669(e,t,l){l.d(t,{u:()=>o});var n=l(96540),r=l(44e3);let i=e=>e;function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{filterableFieldNames:l,nonfilterableFieldNames:o,noIgnore:a=!1,t:s=i}=t,d=(0,n.useMemo)(()=>(null==e?void 0:e.getFields())||[],[e]),u=(0,n.useMemo)(()=>{let e=!a&&(null==l?void 0:l.length)?d.map(e=>e.name).filter(e=>!l.includes(e)):[],t=o??[];return t.length?Array.from(new Set([...e,...t])):e},[d,l,o,a]);return(0,n.useMemo)(()=>(0,r.H)(d.filter(e=>"attachments"!==e.target&&"formula"!==e.interface),1,u,s).filter(Boolean),[d,u,s])}},39580(e,t,l){l.d(t,{b2:()=>r.b,tn:()=>n.t,S5:()=>r.S});var n=l(27941);l(74848),l(98668),l(43627),l(11869),l(96540),l(74979),l(21335);var r=l(36869);l(89378),l(47785)},51612(e,t,l){l.d(t,{g:()=>v});var n=l(74848),r=l(96540),i=l(40098),o=l.n(i),a=l(70413);let s=o().memoize(async e=>{if(!e)return e;let t=await Promise.all([l.e("2512"),l.e("32")]).then(l.bind(l,86419));return(0,a.$P)(t.default.render(e))});function d(e){let[t,l]=(0,r.useState)(""),[n,i]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{i(!0),s(e).then(e=>{l(e),i(!1)}).catch(e=>console.log(e))},[e]),{html:t,loading:n}}function u(e){let t=e,l=document.createElement("div");l.innerHTML=t;let n=l.innerText;return l=null,(null==n?void 0:n.replace(/[\n\r]/g,""))||""}var c=l(24978),p=l(22803),h=l(11869),m=l(35710);let f=()=>{let e=(0,h.useFlowContext)(),{token:t}=m.A.useToken(),l=!!e.isDarkTheme,n=new c.q(t.colorFillAlter).onBackground(t.colorBgContainer).toHexShortString(),r={lineHeight:"inherit","&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},blockquote:{borderLeft:"4px solid #ccc",paddingLeft:"20px",marginLeft:"0",color:"#666",fontStyle:"italic"},img:{maxWidth:"100%"},".hljs":{background:"#f8f8f8",color:"#444"},".hljs-comment":{color:"#697070"},".hljs-punctuation,.hljs-tag":{color:"#444a"},".hljs-tag .hljs-attr,.hljs-tag .hljs-name":{color:"#444"},".hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag":{fontWeight:700},".hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type":{color:"#800"},".hljs-section,.hljs-title":{color:"#800",fontWeight:700},".hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable":{color:"#ab5656"},".hljs-literal":{color:"#695"},".hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code":{color:"#397300"},".hljs-meta":{color:"#1f7199"},".hljs-meta .hljs-string":{color:"#38a"},".hljs-emphasis":{fontStyle:"italic"},".hljs-strong":{fontWeight:700}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:n,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}},i={"&.nb-markdown-default":{"pre code.hljs":{display:"block",overflowX:"auto",padding:"1em"},"code.hljs":{padding:"3px 5px"},":not(pre) code":{padding:"2px 5px",color:"#d56161",background:t.colorFillQuaternary,border:`1px solid ${t.colorBorder}`,borderRadius:t.borderRadiusSM},".hljs":{color:"#adbac7",background:"#22272e"},".hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_":{color:"#f47067"},".hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_":{color:"#dcbdfb"},".hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable":{color:"#6cb6ff"},".hljs-meta .hljs-string,.hljs-regexp,.hljs-string":{color:"#96d0ff"},".hljs-built_in,.hljs-symbol":{color:"#f69d50"},".hljs-code,.hljs-comment,.hljs-formula":{color:"#768390"},".hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag":{color:"#8ddb8c"},".hljs-subst":{color:"#adbac7"},".hljs-section":{color:"#316dca",fontWeight:700},".hljs-bullet":{color:"#eac55f"},".hljs-emphasis":{color:"#adbac7",fontStyle:"italic"},".hljs-strong":{color:"#adbac7",fontWeight:700},".hljs-addition":{color:"#b4f1b4",backgroundColor:"#1b4721"},".hljs-deletion":{color:"#ffd8d3",backgroundColor:"#78191b"}},"&.nb-markdown-table":{table:{borderCollapse:"collapse",width:"100%",fontFamily:"Arial, sans-serif",marginBottom:"1.5rem"},"th, td":{borderBottom:`1px solid ${t.colorBorderSecondary}`,padding:`${t.paddingContentVertical}px ${t.paddingContentHorizontal}px`,textAlign:"left"},th:{backgroundColor:n,fontWeight:"bold",color:t.colorText},"tr:hover":{backgroundColor:t.colorFillTertiary},"tr:last-child td":{borderBottom:"none"},"tr:first-child th":{borderTop:"none"}}};return(0,p.css)({lineHeight:t.lineHeight,"& > *:last-child":{marginBottom:"0"},".ant-description-textarea, .ant-description-input":{lineHeight:t.lineHeight},".field-interface-datetime":{minWidth:"100px"},img:{maxWidth:"100%"},...l?i:r})};var g=l(42443);let v=e=>{let{textOnly:t,overflowMode:l,style:i}=e,o=f(),{html:a=""}=d(e.value),s=u(a),c="ellipsis"===l,p=(0,r.useRef)(null),[h,m]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if(p.current){let e=p.current;m(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)}},[a,i,l]);let v={...i||{},...c?{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",wordBreak:"break-word",cursor:"default"}:{}},y=(0,n.jsx)("div",{ref:p,className:`${o} nb-markdown`,dangerouslySetInnerHTML:{__html:t?s:a},style:v});return c&&h?(0,n.jsx)(g.A,{title:(0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:a},style:{maxHeight:500,overflowY:"auto",padding:10,color:"#000"}}),overlayInnerStyle:{background:"#fff",color:"#000",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},color:"#fff",children:y}):y}},85352(e,t,l){function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)?e.map(e=>{if(e&&"object"==typeof e&&!Array.isArray(e)){let t=e,l=void 0!==t.label,n=void 0!==t.value,r=l?t.label:String(t.value??""),i=n?t.value:r,o={label:r,value:i};return t.color&&(o.color=t.color),t.icon&&(o.icon=t.icon),o}return{label:String(e),value:e}}):[]}function r(e){return"string"==typeof e&&/\{\{\s*t\s*\(/.test(e)}function i(e,t){return r(e)?t(e):e}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return Array.isArray(e)?e.map(e=>({...e,label:i(null==e?void 0:e.label,t)})):[]}function a(e,t){if(e&&Array.isArray(e)&&0!==e.length)return o(n(e),t)}function s(e,t){let l=null==t?void 0:t.mode,n="multiple"===l||"tags"===l||(null==t?void 0:t.multiple)===!0;return Array.isArray(e)?e.filter(e=>""!==e&&null!=e):""===e||null==e?n?[]:void 0:e}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(Array.isArray(e)?e:null==e?[]:[e]).map(e=>{var l;let n=t.find(t=>(null==t?void 0:t.value)===e);return n?{value:e,label:n.label}:{value:e,label:(null==e||null==(l=e.toString)?void 0:l.call(e))??e}})}function u(e,t){var l,r,i,o;if(!["radioGroup","checkboxGroup","select","multipleSelect"].includes(null==t?void 0:t.interface)||Array.isArray(null==(l=e.props)?void 0:l.options)&&(null==(i=e.props)||null==(r=i.options)?void 0:r.length)>0)return!1;let a=null==(o=t.uiSchema)?void 0:o.enum;if(!Array.isArray(a)||0===a.length)return!1;let s=n(a);return!!s.length&&(e.setProps({options:s}),!0)}l.d(t,{NI:()=>u,OL:()=>i,ZY:()=>o,di:()=>a,xO:()=>s,yg:()=>d})},13940(e,t,l){l.d(t,{E4:()=>i,Gj:()=>d,a_:()=>n,eo:()=>p,pX:()=>s,w7:()=>o});let n="__custom__";function r(e){return`${n}:${e}`}function i(e){var t;if(!e||"object"!=typeof e)return!1;let l=e;if(!(null==(t=l.isAssociationField)?void 0:t.call(l)))return!1;let n=l.type,r=l.interface;return"belongsToMany"===n||"hasMany"===n||"belongsToArray"===n||"m2m"===r||"o2m"===r||"mbm"===r}function o(e){var t;if(!e||"object"!=typeof e)return;let l=e;return l.collection||(null==(t=l.context)?void 0:t.collection)||void 0}function a(e){return"string"==typeof e?e.trim():""}function s(e){if(!e||"object"!=typeof e)return[];let t=e,l="function"==typeof t.getStepParams?t.getStepParams("fieldSettings","init"):void 0,n=l&&"object"==typeof l?l:void 0,i="function"==typeof t.getStepParams?t.getStepParams("formItemSettings","fieldSettings"):void 0,o=i&&"object"==typeof i?i:void 0,s=(null==n?void 0:n.fieldPath)??t.fieldPath,d=(null==n?void 0:n.associationPathName)??t.associationPathName,u=null==o?void 0:o.name,c=a(s),p=a(d),h=a(u),m=new Set;return c&&m.add(c),p&&(c?c.startsWith(`${p}.`)?m.add(c):m.add(`${p}.${c}`):m.add(p)),h&&m.add(r(h)),Array.from(m)}function d(e){return s(e)[0]}function u(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;if(!t||"object"!=typeof t)return[];let l=t.items;if(Array.isArray(l))return l;let n=t.grid;if(!n||"object"!=typeof n)return[];let r=n.subModels;if(!r||"object"!=typeof r)return[];let i=r.items;return Array.isArray(i)?i:[]}function c(e){if(!e||"object"!=typeof e)return[];let t=e.subModels;return t&&"object"==typeof t?u(t.field):[]}function p(e,t){let l=a(t);if(!l)return null;let n=e=>{if(!Array.isArray(e))return null;for(let t of e){if(s(t).some(e=>e===l))return t;let e=n(c(t));if(e)return e}return null};return n(u(e))}},53869(e,t,l){l.d(t,{VS:()=>a,_H:()=>u,i2:()=>c,sI:()=>h});var n=l(96540),r=l(13595),i=l(85352);function o(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function a(e){return o(e)?e:void 0}function s(e){return e}function d(e){var t;let l=s(e);l._reactiveWrapperCache=void 0,null==(t=l.setupReactiveRender)||t.call(l)}function u(e,t,l){let n;if(!l||!Array.isArray(l))return null;let i=l.find(e=>(null==e?void 0:e.value)===t),a=null==i?void 0:i.schema,s=null==a?void 0:a["x-component"];if(!s)return null;if("DateFilterDynamicComponent"===s)n=r.DateFilterDynamicComponent;else{var d;n=null==e||null==(d=e.getComponent)?void 0:d.call(e,s)}return n?{Comp:n,props:o(null==a?void 0:a["x-component-props"])?a["x-component-props"]:{}}:null}function c(e){let t=s(e);return!!t&&"function"==typeof t.__originalRender&&(t.render=t.__originalRender,d(t),!0)}function p(e,t){return Array.isArray(e.options)&&"function"==typeof t?{...e,options:(0,i.ZY)(e.options,t)}:e}function h(e){let{app:t,fieldModel:l,operator:r,operators:i,propsPriority:o="field",style:h}=e,m=s(l),f=u(t,r,i);if(!f)return c(m),!1;m.__originalRender||"function"!=typeof m.render||(m.__originalRender=m.render);let{Comp:g,props:v}=f,y=a(v.style);return m.render=()=>{let e=m.props||{},t=a(e.style),l=p("operator"===o?{...e,...v}:{...v,...e},m.translate),r="operator"===o?{...t,...y}:{...y,...t},i={...h||{},...r};return n.createElement(g,{...l,...Object.keys(i).length>0?{style:i}:{},onCompositionStart:null,onCompositionEnd:null})},d(m),!0}},25359(e,t,l){l.d(t,{ON:()=>i,jI:()=>r});let n="__saveStepParamsWithSubModels";function r(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");e[n]=!0}async function i(e,t){if(!e||"object"!=typeof e&&"function"!=typeof e)throw Error("[saveStepParamsWithSubModels] model is not an object");let l=e;if(!0!==l[n])return await t();if("function"!=typeof l.save)throw Error("[saveStepParamsWithSubModels] model.save is not a function");try{return await l.save()}finally{delete l[n]}}},14252(e,t,l){l.d(t,{S0:()=>o.S0,_T:()=>o._T,s5:()=>o.s5});var n=l(11869),r=l(2077);l(96540);var i=l(2117),o=l(52717);function a(e){let t=e.model.defaultProps||{};return e.isMobileLayout&&t.icon&&!1!==e.model.enableEditIconOnly?{...t,iconOnly:!0}:t}o.S0.registerFlow({key:"buttonSettings",title:(0,n.tExpr)("Button settings"),sort:-999,steps:{general:{title:(0,n.tExpr)("Edit button"),uiSchema(e){var t,l;return{title:e.model.enableEditTitle?{"x-decorator":"FormItem","x-component":"Input",title:(0,n.tExpr)("Button title"),description:null==(t=(l=e.model).getTitleFieldDescription)?void 0:t.call(l)}:void 0,tooltip:e.model.enableEditTooltip?{"x-decorator":"FormItem","x-component":"Input",title:(0,n.tExpr)("Button tooltip")}:void 0,icon:e.model.enableEditIcon?{"x-decorator":"FormItem","x-component":"IconPicker",title:(0,n.tExpr)("Button icon")}:void 0,iconOnly:e.model.enableEditIcon&&!1!==e.model.enableEditIconOnly?{"x-decorator":"FormItem","x-component":"Switch",title:(0,n.tExpr)("Icon only")}:void 0,type:e.model.enableEditType?{"x-decorator":"FormItem","x-component":"Radio.Group",title:(0,n.tExpr)("Button type"),enum:e.model.buttonTypeOptions}:void 0,danger:e.model.enableEditDanger?{"x-decorator":"FormItem","x-component":"Switch",title:(0,n.tExpr)("Danger action")}:void 0,color:e.model.enableEditColor?{"x-decorator":"FormItem","x-component":r.sk,title:(0,n.tExpr)("Color")}:void 0}},defaultParams(e){var t,l;let n=a(e);return e.model.enableEditColor?{...n,color:(null==(t=e.model.props)?void 0:t.color)??n.color??(null==(l=e.themeToken)?void 0:l.colorPrimary)}:n},handler(e,t){let{title:l,tooltip:n,...r}=t;e.model.setProps({title:e.t(l,{ns:"lm-flow-engine"}),tooltip:e.t(n,{ns:"lm-flow-engine"}),...r})}},linkageRules:{use:"actionLinkageRules"}}}),o.S0.registerFlow({key:"buttonAclSettings",steps:{aclCheck:{use:"aclCheck"}}}),o.S0.registerFlow({key:"paginationChange",on:"paginationChange",steps:{aclCheckRefresh:{use:"aclCheckRefresh"},linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"actionLinkageRules",flowKey:"buttonSettings",stepKey:"linkageRules"}}}}),o.S0.registerEvents({click:{title:(0,n.tExpr)("Click"),name:"click",uiSchema:{condition:{type:"object",title:(0,n.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":i.H}},handler:i.b}})},52717(e,t,l){l.d(t,{S0:()=>f,_T:()=>h,s5:()=>m});var n=l(50467),r=l(74848),i=l(11869),o=l(84884),a=l(42443),s=l(71021),d=l(40098),u=l.n(d),c=l(96540),p=l(18492);function h(e){let{t}=(0,p.B)(),l=(0,i.useFlowModel)(),n=l.context.blockModel,o=e.collection||n.collection,s=o.dataSource,d=(0,c.useMemo)(()=>{let e=`${t(s.displayName||s.key)} > `,l=o?`${t(o.title)||o.name||o.tableName} `:"";return`${e}${l}`},[o,s.displayName,s.key,t]),{actionName:h}=(null==e?void 0:e.forbidden)||l.forbidden,m=(0,c.useMemo)(()=>t('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:d,actionName:t(u().capitalize(h))}).replaceAll("&gt;",">"),[h,d,t]);return(0,r.jsx)(a.A,{title:e.message||m,children:e.children})}let m={collection:"collection",record:"record",all:["collection","record"],both:["collection","record"]};class f extends i.FlowModel{static _getScene(){return u().castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getAclActionName(){return null}onInit(e){super.onInit(e),delete this.props.disabled,this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1})}serialize(){let e=super.serialize();return delete e.props.disabled,e}getInputArgs(){let e={},t=[];if(this.context.resource){let l=this.context.resource.getSourceId();l&&(e.sourceId=l,t.push("sourceId"))}if(this.context.collection&&this.context.record){let l=this.context.collection.getFilterByTK(this.context.record);l&&(e.filterByTk=l,t.push("filterByTk"))}return t.length&&(e.defaultInputKeys=t),e}onClick(e){this.dispatchEvent("click",{event:e,...this.getInputArgs()},{debounce:!0})}getTitle(){return this.props.title}getTitleFieldDescription(){}getIcon(){return this.props.icon}renderButton(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,r.jsx)(o.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,children:n})}render(){return this.props.tooltip?(0,r.jsx)(a.A,{title:this.props.tooltip,children:this.renderButton()}):this.renderButton()}renderHiddenInConfig(){let{iconOnly:e,...t}=this.props,l=this.getIcon()?(0,r.jsx)(o.In,{type:this.getIcon()}):void 0,n=e&&l?null:t.children||this.getTitle();return this.forbidden?(0,r.jsx)(h,{children:(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})}):(0,r.jsx)(a.A,{title:this.context.t("The button is hidden and only visible when the UI Editor is active"),children:(0,r.jsx)(s.Ay,{...t,onClick:this.onClick.bind(this),icon:l,style:{opacity:"0.3"},children:n})})}constructor(...e){super(...e),(0,n._)(this,"defaultProps",{type:"default",title:(0,i.tExpr)("Action"),iconOnly:!1}),(0,n._)(this,"enableEditTooltip",!0),(0,n._)(this,"enableEditTitle",!0),(0,n._)(this,"enableEditIcon",!0),(0,n._)(this,"enableEditIconOnly",!0),(0,n._)(this,"enableEditType",!0),(0,n._)(this,"enableEditDanger",!0),(0,n._)(this,"enableEditColor",!1),(0,n._)(this,"buttonTypeOptions",[{value:"default",label:'{{t("Default")}}'},{value:"primary",label:'{{t("Primary")}}'},{value:"dashed",label:'{{t("Dashed")}}'},{value:"link",label:'{{t("Link")}}'},{value:"text",label:'{{t("Text")}}'}])}}},15892(e,t,l){l.d(t,{P:()=>w,z:()=>S});var n=l(50467),r=l(74848),i=l(95243),o=l(11869),a=l(40098),s=l.n(a),d=l(96540),u=l(42443),c=l(39580),p=l(2117),h=l(92275),m=l(18492),f=l(27941);function g(e){return"function"==typeof(null==e?void 0:e.getResourceSettingsInitParams)?e.getResourceSettingsInitParams():"function"==typeof(null==e?void 0:e.getStepParams)?e.getStepParams("resourceSettings","init"):void 0}function v(e,t){var l,n,r,i,o,a,s;let d=(null==e||null==(l=e.context)?void 0:l.blockModel)||e,u=g(d)||{},c=(null==d||null==(n=d.context)?void 0:n.collection)||(null==d?void 0:d.collection)||(null==e||null==(r=e.context)?void 0:r.collection),p=(null==c?void 0:c.dataSource)||(null==d||null==(i=d.context)?void 0:i.dataSource)||(null==d?void 0:d.dataSource)||(null==e?void 0:e.dataSource),h=(null==p?void 0:p.key)||(null==c?void 0:c.dataSourceKey)||u.dataSourceKey,m=(null==c?void 0:c.title)||(null==c?void 0:c.name)||(null==c?void 0:c.tableName)||(null==e||null==(o=e.resource)?void 0:o.resourceName)||(null==e||null==(s=e.resource)||null==(a=s.getResourceName)?void 0:a.call(s))||u.associationName||u.collectionName,f=p?t(p.displayName||p.key):h,v=m?`${t(m)||m}`:"",y=f?`${t(f)} > `:"";return{dataSourceName:f,nameValue:`${y}${v}`,isDataSourceUnavailable:!!(h&&!p)}}function y(e){let{dataSourceName:t}=e,{t:l}=(0,m.B)(),n=t?l('The data source "{{name}}" used by this block is disabled or unavailable. Enable the data source to display this block.',{name:t}):l("The data source used by this block is disabled or unavailable. Enable the data source to display this block.");return(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"403",subTitle:n})})}let b=()=>{let{t:e}=(0,m.B)(),t=(0,o.useFlowModel)(),{dataSourceName:l,isDataSourceUnavailable:n,nameValue:i}=(0,d.useMemo)(()=>v(t,e),[t,e]),{actionName:a}=t.forbidden||{},u=(0,d.useMemo)(()=>e('The current user only has the UI configuration permission, but don\'t have "{{actionName}}" permission for collection "{{name}}"',{name:i,actionName:e(s().capitalize(a))}).replaceAll("&gt;",">"),[a,i,e]);return n?t.context.flowSettingsEnabled?(0,r.jsx)(y,{dataSourceName:l}):null:(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"403",subTitle:u})})};function x(){let{t:e}=(0,m.B)(),t=(0,o.useFlowModel)(),{dataSourceName:l,isDataSourceUnavailable:n,nameValue:i}=(0,d.useMemo)(()=>v(t,e),[t,e]),a=(0,d.useMemo)(()=>e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.',{type:e("Collection"),name:i,blockType:e("Block")}).replaceAll("&gt;",">"),[i,e]);return n?t.context.flowSettingsEnabled?(0,r.jsx)(y,{dataSourceName:l}):null:(0,r.jsx)(f.t,{children:(0,r.jsx)(h.Ay,{status:"404",subTitle:a})})}let w={new:"new",one:"one",many:"many",select:"select",filter:"filter",oam:["one","many"],subForm:"subForm",bulkEditForm:"bulkEditForm"};class S extends o.FlowModel{setFilterActive(e,t){this.activeFilterSources.set(e,t)}hasActiveFilters(){let e=this.resource;if(e&&e.filter&&Object.keys(e.filter).length>0)return!0;for(let[,e]of this.activeFilterSources)if(e)return!0;return!1}removeFilterSource(e){this.activeFilterSources.delete(e)}getDataLoadingMode(){var e;let t=this.getStepParams("dataLoadingModeSettings");return(null==t||null==(e=t.dataLoadingMode)?void 0:e.mode)||"auto"}static _getScene(){return s().castArray(this.scene||[])}static _isScene(e){return this._getScene().includes(e)}getModelClassName(e){return Object.keys(this.customModelClasses).includes(e)?this.customModelClasses[e]:this._defaultCustomModelClasses[e]||e}renderHiddenInConfig(){return this.forbidden?(0,r.jsx)(b,{}):(0,r.jsx)(u.A,{title:this.context.t("The block is hidden and only visible when the UI Editor is active"),children:(0,r.jsx)(c.tn,{ref:this.context.ref,...this.decoratorProps,style:{opacity:"0.3"},children:(0,r.jsx)(this.ObservedRenderComponent,{})})})}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineMethod("getModelClassName",e=>this.getModelClassName(e)),this.ObservedRenderComponent=(0,o.observer)(()=>this.renderComponent(),{displayName:"ObservedRenderComponent"})}setDecoratorProps(e){Object.assign(this.decoratorProps,e)}get title(){return this._title||(this._title=this.defaultBlockTitle()),this._title}defaultBlockTitle(){var e;return`${this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name)}`}renderComponent(){throw Error("renderComponent method must be implemented in subclasses of BlockModel")}render(){return this.collectionRequired&&!this.context.collection?(0,r.jsx)(x,{}):(0,r.jsx)(c.tn,{ref:this.context.ref,...this.decoratorProps,children:(0,r.jsx)(this.ObservedRenderComponent,{})})}constructor(...e){super(...e),(0,n._)(this,"decoratorProps",(0,i.observable)({})),(0,n._)(this,"_defaultCustomModelClasses",{}),(0,n._)(this,"customModelClasses",{}),(0,n._)(this,"collectionRequired",!1),(0,n._)(this,"ObservedRenderComponent",null),(0,n._)(this,"activeFilterSources",new Map)}}(0,n._)(S,"scene",void 0),S.registerFlow({key:"cardSettings",title:(0,o.tExpr)("Card settings"),steps:{titleDescription:{title:(0,o.tExpr)("Title & description"),uiSchema:{title:{"x-component":"Input","x-decorator":"FormItem",title:(0,o.tExpr)("Title")},description:{"x-component":"Input.TextArea","x-decorator":"FormItem",title:(0,o.tExpr)("Description")}},handler(e,t){let l=e.t(t.title,{ns:"lm-flow-engine"}),n=e.t(t.description,{ns:"lm-flow-engine"});e.model.setDecoratorProps({title:l,description:n})}},linkageRules:{use:"blockLinkageRules"},blockHeight:{use:"blockHeight"}}}),S.define({hide:!0,label:(0,o.tExpr)("Other blocks")}),o.FlowModel.registerEvents({beforeRender:{title:(0,o.tExpr)("Before render"),name:"beforeRender",uiSchema:{condition:{type:"object",title:(0,o.tExpr)("Trigger condition"),"x-decorator":"FormItem","x-component":p.H}},handler:p.b}})},72380(e,t,l){l.d(t,{U:()=>i});var n=l(11869),r=l(14252);class i extends r.S0{}i.define({children:async e=>(await (0,n.buildSubModelItems)(r.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(r.s5.collection))})},52175(e,t,l){l.d(t,{t:()=>u});var n=l(50467),r=l(11869),i=l(40098),o=l.n(i),a=l(42632),s=l(94130),d=l(5679);class u extends d.R{onMount(){super.onMount(),this.previousBeforeRenderHash=this.context.location.search}getDirtyTrackingVersion(e,t,l,n){var r;let i=new Set,o=(null==l||null==(r=l.getResourceName)?void 0:r.call(l))||n.associationName||n.collectionName;o&&i.add(String(o)),n.associationName&&i.add(String(n.associationName)),n.collectionName&&i.add(String(n.collectionName));let a=0;for(let l of i)a+=e.getDataSourceDirtyVersion(t,l);return a}onActive(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.hidden&&this.previousBeforeRenderHash!==this.context.location.search&&(this.rerender(),!e)||this.hidden)return;let t=this.context.resource;if(!t)return;let l=this.getResourceSettingsInitParams(),n=t.getDataSourceKey()||l.dataSourceKey||"main",i=this.context.engine,o=this.getDirtyTrackingVersion(i,n,t,l);if(t instanceof r.MultiRecordResource&&"manual"===this.getDataLoadingMode()&&!this.hasActiveFilters()){t.setData([]),t.setMeta({count:0,hasNext:!1}),t.setPage(1),t.loading=!1,this.lastSeenDirtyVersion=o;return}if(e){if(this.dirtyRefreshing)return;this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,n,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1});return}this.isManualRefresh||null!==this.lastSeenDirtyVersion&&o===this.lastSeenDirtyVersion||this.dirtyRefreshing||(this.dirtyRefreshing=!0,t.refresh().then(()=>{this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(i,n,t,l)}).catch(()=>{}).finally(()=>{this.dirtyRefreshing=!1}))}static filterCollection(e){return!!e.filterTargetKey}static isCollectionAvailable(e){if(!e)return!1;let t=(0,s.b1)(this);return(0,s.F3)(e,t)}static async defineChildren(e){let t=t=>{var l;if(!(null==(l=this.meta)?void 0:l.createModelOptions))return t||{};if("function"==typeof this.meta.createModelOptions){let l=this.meta.createModelOptions(e);return o().merge({},l,t)}return o().merge({},this.meta.createModelOptions,t)},l=e=>this.name+e,{dataSourceKey:n,collectionName:i,associationName:a,filterByTk:s}=e.view.inputArgs,d=e.dataSourceManager.getDataSources().map(e=>0===e.getCollections().length?null:{key:l(`ds-${e.key}`),label:e.displayName,searchable:!0,searchPlaceholder:(0,r.tExpr)("Search"),children:n=>e.getCollections().map(n=>{if(!this.filterCollection(n)||!this.isCollectionAvailable(n))return null;let r={dataSourceKey:n.dataSourceKey,collectionName:n.name};return{key:l(`ds-${e.key}.${n.name}`),label:n.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}}).filter(Boolean)}).filter(Boolean),u=e=>1===d.length?d[0].children(e):d;if(!i)return u(e);if(this._isScene("select")){let r={dataSourceKey:n,collectionName:i};a&&(r.associationName=a,r.sourceId="{{ctx.view.inputArgs.sourceId}}");let o=e.dataSourceManager.getCollection(n,i),s=[];return this.isCollectionAvailable(o)&&s.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}),s.push({key:l("others-collections"),label:"Other collections",children:u(e)}),s}if(this._isScene("new")){let r={dataSourceKey:n,collectionName:i};a&&(r.associationName=a,r.sourceId="{{ctx.view.inputArgs.sourceId}}");let o=[],d=e.dataSourceManager.getCollection(n,i);return this.isCollectionAvailable(d)&&o.push({key:l("current-collection"),label:"Current collection",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:r}}})}),null!=s&&o.push({key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(n,i).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let r=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(r="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:n,collectionName:e.target,associationName:e.resourceName,sourceId:r};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)}),o.push({key:l("others-collections"),label:"Other collections",children:u(e)}),o}let c=[{key:l("associated"),label:"Associated records",children:()=>e.dataSourceManager.getCollection(n,i).getAssociationFields(this._getScene()).map(e=>{if(!e.targetCollection||"belongsToArray"===e.type||!this.filterCollection(e.targetCollection)||!this.isCollectionAvailable(e.targetCollection))return null;let r=`{{ctx.popup.record.${e.sourceKey||e.collection.filterTargetKey}}}`;e.sourceKey===e.collection.filterTargetKey&&(r="{{ctx.view.inputArgs.filterByTk}}");let i={dataSourceKey:n,collectionName:e.target,associationName:e.resourceName,sourceId:r};return{key:l(`associated-${e.name}`),label:e.title,useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:i}}})}}).filter(Boolean)},{key:l("others-records"),label:"Other records",children:u(e)}];if(this._isScene("one")){let r=e.dataSourceManager.getCollection(n,i);if(!r||!this.filterCollection(r)||!this.isCollectionAvailable(r))return c;let o={dataSourceKey:n,collectionName:i,filterByTk:"{{ctx.view.inputArgs.filterByTk}}"};a&&(o.associationName=a,o.sourceId="{{ctx.view.inputArgs.sourceId}}"),c.unshift({key:l("current-record"),label:"Current record",useModel:this.name,createModelOptions:t({stepParams:{resourceSettings:{init:o}}})})}return c}get dataSource(){return this.context.dataSource}get collection(){return this.context.collection}get resource(){return this.context.resource}get association(){return this.context.association}get associationField(){return this.context.association}getAclActionName(){return"view"}async getFilterFields(){return this.collection.getFields().filter(e=>e.filterable)}getResourceSettingsInitParams(){return this.getStepParams("resourceSettings","init")}onInit(e){super.onInit(e),this.context.defineProperty("blockModel",{value:this}),this.context.defineProperty("actionName",{get:()=>this.getAclActionName(),cache:!1}),this.context.defineProperty("resourceName",{get:()=>this.resource.getResourceName(),cache:!1}),this.context.defineProperty("dataSource",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getDataSource(e.dataSourceKey)}}),this.context.defineProperty("collection",{get:()=>{let e=this.getResourceSettingsInitParams();return this.context.dataSourceManager.getCollection(e.dataSourceKey,e.collectionName)}}),this.context.defineProperty("resource",{get:()=>{let e=this.getResourceSettingsInitParams(),t=this.createResource(this.context,e);t.setDataSourceKey(e.dataSourceKey),t.setResourceName(e.associationName||e.collectionName);let l=()=>{var l;let n=this.context.engine;if(!(null==n?void 0:n.getDataSourceDirtyVersion))return;let r=(null==(l=t.getDataSourceKey)?void 0:l.call(t))||e.dataSourceKey||"main";this.lastSeenDirtyVersion=this.getDirtyTrackingVersion(n,r,t,e)};return l(),t.on("refresh",()=>{l(),this.invalidateFlowCache("beforeRender")}),t}}),this.context.defineProperty("association",{get:()=>{let e=this.getResourceSettingsInitParams();if(e.associationName)return this.dataSource.getAssociation(e.associationName)}})}createResource(e,t){throw Error("createResource method must be implemented in subclasses of CollectionBlockModel")}refresh(){return this.resource?this.resource.refresh():super.refresh()}defaultBlockTitle(){var e,t,l,n;let r=this.translate((null==(e=this.constructor.meta)?void 0:e.label)||this.constructor.name),i=this.getResourceSettingsInitParams(),o=this.dataSource,s=this.collection,d=(null==o?void 0:o.displayName)||(null==o?void 0:o.key)||(null==i?void 0:i.dataSourceKey),u=(null==(n=this.context)||null==(l=n.dataSourceManager)||null==(t=l.getDataSources)?void 0:t.call(l).length)||0,c=(null==s?void 0:s.title)||(null==s?void 0:s.name)||(null==i?void 0:i.collectionName)||"",p=o?this.association:void 0;if(p){let e=this.resource.getResourceName(),t=o.getCollection(e.split(".")[0]);return(0,a.l)({blockLabel:r,dsName:d,dsCount:u,collectionTitle:c,sourceCollectionTitle:null==t?void 0:t.title,associationTitle:p.title})}return(0,a.l)({blockLabel:r,dsName:d,dsCount:u,collectionTitle:c})}addAppends(e){var t,l;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)if(e.includes(".")){let l=this.collection;if(!l)return;let[r,i]=e.split("."),o=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${l.name}.${r}`);if(!o)return;let a=o.target;if(!a)return;let s=this.context.dataSourceManager.getCollectionField(`${l.dataSourceKey}.${a}.${i}`);if(s&&s.isAssociationField()){if(this.resource.addAppends(e),(null==(t=s.targetCollection)?void 0:t.template)==="tree"){let t=e.includes(".")?e.slice(e.lastIndexOf(".")+1):e;s.name===t&&this.resource.addAppends(`${e}.parent(recursively=true)`)}n&&this.resource.refresh()}}else{if(!this.collection)return;let t=this.context.dataSourceManager.getCollectionField(`${this.collection.dataSourceKey}.${this.collection.name}.${e}`);if(!t)return;t.isAssociationField()&&(this.resource.addAppends(t.name),(null==(l=t.targetCollection)?void 0:l.template)==="tree"&&this.resource.addAppends(`${t.name}.parent(recursively=true)`),n&&this.resource.refresh())}}constructor(...e){super(...e),(0,n._)(this,"isManualRefresh",!1),(0,n._)(this,"collectionRequired",!0),(0,n._)(this,"previousBeforeRenderHash",void 0),(0,n._)(this,"lastSeenDirtyVersion",null),(0,n._)(this,"dirtyRefreshing",!1)}}u.registerFlow({key:"resourceSettings",sort:-999,steps:{collectionCheck:{handler(e){e.collection||e.exitAll()}},aclCheck:{use:"aclCheck"},init:{handler(e,t){if(!t.dataSourceKey)throw Error("dataSourceKey is required");if(!t.collectionName)throw Error("collectionName is required");Object.keys(t).includes("sourceId")&&e.resource.setSourceId(t.sourceId),Object.keys(t).includes("filterByTk")&&e.resource.setFilterByTk(t.filterByTk)}}}}),u.registerFlow({key:"refreshSettings",sort:1e4,steps:{refresh:{async handler(e){let t=e.model,l=e.model.context.filterManager,n=(null==l?void 0:l.prepareFiltersForTarget)?await l.prepareFiltersForTarget(e.model.uid):void 0;l&&l.bindToTarget(e.model.uid);let i=t.getDataLoadingMode(),o=t.resource;if(o instanceof r.MultiRecordResource&&"manual"===i&&!t.hasActiveFilters()){o.setData([]),o.setMeta({count:0,hasNext:!1,page:1}),o.loading=!1;return}null==n||n.forEach(t=>{var l;null==t||null==(l=t.markInitialTargetRefreshHandled)||l.call(t,e.model.uid)}),e.model.isManualRefresh?e.model.resource.loading=!1:await e.model.resource.refresh()}}}}),u.registerFlow({key:"dataLoadingModeSettings",sort:800,title:(0,r.tExpr)("Set data loading mode"),steps:{dataLoadingMode:{use:"dataLoadingMode"}}}),u.define({hide:!0})},5679(e,t,l){l.d(t,{R:()=>i});var n=l(11869),r=l(15892);class i extends r.z{}i.define({hide:!0,label:(0,n.tExpr)("Data blocks"),async children(e){let t=await (0,n.buildSubModelItems)(i)(e),{collectionName:l,filterByTk:r,scene:o}=e.view.inputArgs;return t.filter(t=>{var n,i,a,s,d,u,c;let p=e.engine.getModelClass(t.useModel);return"select"===o?null==(s=p._isScene)?void 0:s.call(p,"select"):"subForm"===o?null==(d=p._isScene)?void 0:d.call(p,"subForm"):"bulkEditForm"===o?null==(u=p._isScene)?void 0:u.call(p,"bulkEditForm"):"new"===o||l&&!r?null==(c=p._isScene)?void 0:c.call(p,"new"):!p._isScene||!(null==(n=p._isScene)?void 0:n.call(p,"select"))&&!(null==(i=p._isScene)?void 0:i.call(p,"subForm"))&&!(null==(a=p._isScene)?void 0:a.call(p,"bulkEditForm"))})}})},81486(e,t,l){l.d(t,{o:()=>r});var n=l(11869);class r extends n.FlowModel{static resolveUse(e,t,l){var n,r;let i=null==e||null==(r=e.stepParams)||null==(n=r.fieldBinding)?void 0:n.use;return i&&i!==(null==e?void 0:e.use)?i:null==e?void 0:e.use}}},33297(e,t,l){l.d(t,{L:()=>i});var n=l(11869),r=l(14252);class i extends r.S0{}i.define({children:async e=>(await (0,n.buildSubModelItems)(r.S0)(e)).filter(t=>e.engine.getModelClass(t.useModel)._isScene(r.s5.record))})},58428(e,t,l){l.d(t,{GO:()=>x,KW:()=>S,Z1:()=>y,eu:()=>b,nF:()=>v,zL:()=>s});var n=l(74848),r=l(11869),i=l(96540),o=l(72380),a=l(33297);let s="assignFieldValues";function d(e){let t=null==e?void 0:e.collection;return t&&"object"==typeof t?t:void 0}function u(e){let t=d(e),l=null==t?void 0:t.dataSourceKey,n=null==t?void 0:t.name;return l&&n?{dataSourceKey:l,collectionName:n}:void 0}function c(e,t){let l=(null==e?void 0:e.collection)||d(t),n=null==l?void 0:l.dataSourceKey,r=null==l?void 0:l.name;return n&&r?{dataSourceKey:n,collectionName:r}:void 0}function p(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.dataSourceKey&&!!t.dataSourceKey&&"string"==typeof t.collectionName&&!!t.collectionName}function h(e){return e&&"object"==typeof e?e:void 0}function m(e,t){var l,n,r;let i=h(e);i&&(null==(l=i._observableCache)||delete l[t],null==(n=i._cache)||delete n[t],null==(r=i._pending)||delete r[t])}function f(e){m(null==e?void 0:e.context,"dataSource"),m(null==e?void 0:e.context,"collection"),m(null==e?void 0:e.context,"resource"),m(null==e?void 0:e.context,"association")}function g(e){var t,l,n,r,i;if(e.model.assignFormUid){let t=null==(r=(i=e.engine).getModel)?void 0:r.call(i,e.model.assignFormUid,!0);if(t)return t}let o=null==(t=e.model.subModels)?void 0:t.assignForm;return o||(null==(l=(n=e.engine).findModelByParentId)?void 0:l.call(n,e.model.uid,"assignForm"))||void 0}function v(e){return{async:!0,use:"AssignFormModel",stepParams:{resourceSettings:{init:u(e)}}}}function y(e,t){var l,n;let r=(null==(l=(n=e.model).getStepParams)?void 0:l.call(n,t,s))||{};return{assignedValues:(null==r?void 0:r.assignedValues)||{}}}async function b(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AssignFieldValues";try{return await (0,r.resolveRunJSObjectValues)(e,t)}catch(t){var n,i,o;return console.error(`[${l}] RunJS execution failed`,t),null==(o=e.message)||null==(i=o.error)||i.call(o,(null==(n=e.t)?void 0:n.call(e,"RunJS execution failed"))||"RunJS execution failed"),null}}function x(e,t){return t&&"object"==typeof t&&Object.keys(t).length?{...e,...t}:e}function w(e){let{model:t,blockModel:l}=(0,r.useFlowSettingsContext)(),d=t,u=(0,r.useFlowEngine)(),[h,m]=i.useState(null);return(0,i.useEffect)(()=>{let n=!1;return(async()=>{var r,i,h,g,v;let y=c(l,null==d?void 0:d.context),b=await u.loadOrCreateModel(y?{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel",stepParams:{resourceSettings:{init:y}}}:{parentId:d.uid,subKey:"assignForm",use:"AssignFormModel"},{skipSave:!t.context.flowSettingsEnabled});if(n)return;if(p(y)){let e=null==(h=b.getStepParams)?void 0:h.call(b,"resourceSettings","init");p(e)&&e.dataSourceKey===y.dataSourceKey&&e.collectionName===y.collectionName||null==(v=b.setStepParams)||v.call(b,"resourceSettings","init",y),f(b),f(null==(g=b.subModels)?void 0:g.grid)}let x=(null==(r=d.getStepParams)?void 0:r.call(d,e.settingsFlowKey,s))||{};b.setInitialAssignedValues((null==x?void 0:x.assignedValues)||{});let w=t instanceof o.U&&!(t instanceof a.L);(e.clearRecordContext||w)&&(null==(i=b.context)?void 0:i.defineProperty)&&b.context.defineProperty("record",{get:()=>void 0,cache:!1}),m(b),d.assignFormUid=(null==b?void 0:b.uid)||d.assignFormUid})(),()=>{n=!0}},[d,l,u,t,t.context.flowSettingsEnabled,e.clearRecordContext,e.settingsFlowKey]),h?(0,n.jsx)(r.FlowModelRenderer,{model:h,showFlowSettings:!1}):null}function S(e){return{title:e.title||(0,r.tExpr)("Assign field values"),uiSchema:()=>({tip:e.tipComponent?{"x-decorator":"FormItem","x-component":e.tipComponent}:void 0,editor:{"x-decorator":"FormItem","x-component":()=>(0,n.jsx)(w,{settingsFlowKey:e.settingsFlowKey,clearRecordContext:e.clearRecordContext})}}),async beforeParamsSave(t,l,n){var r,i,o,a,d,u,c;let p=g(t);if(!p){let r=(null==l?void 0:l.assignedValues)||(null==n?void 0:n.assignedValues)||{};null==(a=(d=t.model).setStepParams)||a.call(d,e.settingsFlowKey,s,{assignedValues:r});return}e.validateBeforeSave&&await (null==(c=p.form)||null==(u=c.validateFields)?void 0:u.call(c));let h=(null==(r=p.getAssignedValues)?void 0:r.call(p))||{};null==(i=(o=t.model).setStepParams)||i.call(o,e.settingsFlowKey,s,{assignedValues:h})},handler(){}}}},13595(e,t,l){l.r(t),l.d(t,{DateFilterDynamicComponent:()=>F});var n=l(74848),r=l(96540),i=l(35710),o=l(71500),a=l(84626),s=l(36492),d=l(63718),u=l(22803),c=l(11869),p=l(2077),h=l(4198),m=l(37985),f=l(40098),g=l.n(f);let v=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,y=(e,t)=>{if(!e)return null;if(h.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,h.dayjs)(e).format(t),n=(0,h.dayjs)(l,t);return n.isValid()?n:(0,h.dayjs)(e)}let l=(0,h.dayjs)(e,t);if(l.isValid())return l;let n=(0,h.dayjs)(e);return n.isValid()?n:null},b=e=>{let{value:t,picker:l="date",format:i,showTime:o,timeFormat:a}=e,s=(0,c.useFlowEngine)(),d=s.translate.bind(s),u=(0,p.fD)(),f=[{label:d("Today"),value:u.today},{label:d("Last week"),value:u.lastWeek},{label:d("This week"),value:u.thisWeek},{label:d("Next week"),value:u.nextWeek},{label:d("Last month"),value:u.lastMonth},{label:d("This month"),value:u.thisMonth},{label:d("Next month"),value:u.nextMonth},{label:d("Last quarter"),value:u.lastQuarter},{label:d("This quarter"),value:u.thisQuarter},{label:d("Next quarter"),value:u.nextQuarter},{label:d("Last year"),value:u.lastYear},{label:d("This year"),value:u.thisYear},{label:d("Next year"),value:u.nextYear},{label:d("Last 7 days"),value:u.last7Days},{label:d("Next 7 days"),value:u.next7Days},{label:d("Last 30 days"),value:u.last30Days},{label:d("Next 30 days"),value:u.next30Days},{label:d("Last 90 days"),value:u.last90Days},{label:d("Next 90 days"),value:u.next90Days}],b=t?(0,p.Pn)(null==t?void 0:t[0],l):l,x=b===l&&i?i:(0,h.getPickerFormat)(b),w="date"===b?v(x):x,S=(0,h.getDateTimeFormat)(b,w,o,a),A={utc:!0,presets:f,...e,format:S,picker:b,showTime:!!o&&{defaultValue:[(0,h.dayjs)("00:00:00","HH:mm:ss"),(0,h.dayjs)("23:59:59","HH:mm:ss")]}},M=(0,r.useMemo)(()=>g().castArray(e.value).map(e=>y(e,S)),[e.value,S]);return(0,n.jsx)(m.A.RangePicker,{...A,style:{flex:1,...null==A?void 0:A.style},value:M})},x=e=>e?e.replace(/\s*HH?:mm(?::ss)?(?:\.SSS)?/g,"").trim():e,w=(e,t)=>{if(!e)return null;if(h.dayjs.isDayjs(e))return e;if("string"==typeof e&&e.endsWith("Z")){let l=(0,h.dayjs)(e).format(t),n=(0,h.dayjs)(l,t);return n.isValid()?n:(0,h.dayjs)(e)}let l=(0,h.dayjs)(e,t);if(l.isValid())return l;let n=(0,h.dayjs)(e);return n.isValid()?n:null},S=e=>{let{picker:t="date",format:l,showTime:i,timeFormat:o,onChange:d}=e,u=(0,c.useFlowContext)(),f=Array.isArray(e.value)?e.value[0]:e.value,g=f?(0,p.Pn)(f,t):t,[v,y]=(0,r.useState)(g),b=u.model.translate.bind(u.model),S=e=>{let n=e===t&&l?l:(0,h.getPickerFormat)(e),r="date"===e?x(n):n;return(0,h.getDateTimeFormat)(e,r,i,o)},A=(0,r.useMemo)(()=>S(v),[l,t,i,v,o]),M=(0,r.useMemo)(()=>w(f,A),[f,A]),F={utc:!0,inputReadOnly:u.isMobileLayout,...e,underFilter:!0,showTime:!!i&&{defaultValue:(0,h.dayjs)("00:00:00","HH:mm:ss")},format:A,picker:v};return(0,n.jsxs)(a.A.Compact,{style:{width:"100%"},children:[(0,n.jsx)(s.A,{style:{width:"100px"},popupMatchSelectWidth:!1,value:v,options:[{label:b("Date"),value:"date"},{label:b("Month"),value:"month"},{label:b("Quarter"),value:"quarter"},{label:b("Year"),value:"year"}],onChange:e=>{let t=S(e),l=A;if(y(e),!f||!d)return;let n=w(f,l);n&&n.isValid()&&d(n,n.format(t))}}),(0,n.jsx)(m.A,{...F,style:{flex:1,...null==F?void 0:F.style},value:M})]})},A=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=[{value:"exact",label:e("Exact day")},{value:"past",label:e("Past")},{value:"next",label:e("Next")},{value:"today",label:e("Today")},{value:"yesterday",label:e("Yesterday")},{value:"tomorrow",label:e("Tomorrow")},{value:"thisWeek",label:e("This Week")},{value:"lastWeek",label:e("Last Week")},{value:"nextWeek",label:e("Next Week")},{value:"thisMonth",label:e("This Month")},{value:"lastMonth",label:e("Last Month")},{value:"nextMonth",label:e("Next Month")},{value:"thisQuarter",label:e("This Quarter")},{value:"lastQuarter",label:e("Last Quarter")},{value:"nextQuarter",label:e("Next Quarter")},{value:"thisYear",label:e("This Year")},{value:"lastYear",label:e("Last Year")},{value:"nextYear",label:e("Next Year")}];return t&&l.splice(3,0,{value:"now",label:e("Now")}),l},M=e=>{let{isRange:t,defaultValue:l,onChange:i,...o}=e,a=(0,r.useCallback)((e,t)=>i(t),[i]);return t?(0,n.jsx)(b,{...o,onChange:a}):(0,n.jsx)(S,{...o,onChange:a})},F=e=>{let{value:t,onChange:l,includeNow:p=!1,...h}=e,m=(0,c.useFlowEngine)(),f=m.translate.bind(m),{token:g}=i.A.useToken(),[v,y]=(0,r.useState)(!1),b=(0,r.useMemo)(()=>A(f,p),[f,p]),x=e=>{if(y(!1),"exact"===e)return l(void 0);let t={type:e};["past","next"].includes(e)&&(t.number=1,t.unit="day"),l(t)},w=()=>{let e=b.slice(0,3),t=b.slice(3),l=(0,u.css)`
1360
1360
  padding: 3px 10px;
1361
1361
  cursor: pointer;
1362
1362
  white-space: nowrap;
@@ -1851,4 +1851,4 @@ ${i.join("\n")}`:""}function k(e){let t=String((null==e?void 0:e.message)||"");i
1851
1851
  ${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 T(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 I(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}),T({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,{H:()=>d,a:()=>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={};for(let n of t){let t=e[n];if(null==t)return;l[n]=t}return l}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(12039),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 A(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 M(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=A(n.slice(2));if(e&&t)return{...t,dataSourceKey:e}}return A(n)}function F(e,t,l,n){let r=e.trim(),i=l.trim();if(!r||!i)return;if(r.includes("/")){let e=M(`${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):M(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 T(e,t,l){(0,r.BL)({engine:e.engine,dataSourceKey:t.dataSourceKey||(0,r.T$)(l),resourceName:t.resourceName,includePreviousEngines:!0})}function I(e,t,l,n){!e.skip&&!e.marked&&l&&c(l.actionName)&&(e.marked=!0,T(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},A=!w;(c=S).requestKey||(c.requestKey=b),(p=S).resourceKey||(p.resourceKey=x),(null==v?void 0:v[i])&&(S.skip=!0);let M=v||null==f[1]?[f[0],{...v,[o]:S}]:f;a.push({key:b,token:S});try{t=Reflect.apply(h,u,M)}finally{a.pop()}let k=await t;return A&&I(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(),M,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(),M,[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&&I(h,t,g,a.headers),e))},A=(e,t)=>{let l=Reflect.getOwnPropertyDescriptor(e,t);return!!l&&!l.configurable},M=new Proxy(e,{get:(e,t,n)=>"resource"===t?A(e,t)?Reflect.get(e,t,n):f?l:w:"request"===t?A(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(M),M}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:()=>to,Fv:()=>o,ju:()=>P.ju,MI:()=>d,vq:()=>ti.v,yz:()=>_,M5:()=>ex,X4:()=>ew,Vv:()=>eA,E2:()=>eF,lW:()=>a,n2:()=>R,FA:()=>p,J3:()=>ek,vP:()=>P.vP,ME:()=>y,H9:()=>k.H,KB:()=>ee,JE:()=>es,kl:()=>r,u4:()=>n,UX:()=>P.UX,XM:()=>F,AP:()=>E,mP:()=>eT,zz:()=>u.zz,gG:()=>h.gG,af:()=>C.a,mv:()=>h.mv,QP:()=>c,$S:()=>P.$S,EI:()=>ta,qI:()=>A,sU:()=>L,ln:()=>w,Z8:()=>D,cg:()=>z,zE:()=>tu,wx:()=>g.w,yp:()=>ts.y,y4:()=>eb,dN:()=>G,ye:()=>J,$n:()=>eR,VD:()=>u.VD,ji:()=>tr,WJ:()=>i,i:()=>ts.i,hz:()=>eS,MZ:()=>s,sy:()=>u.sy,YB:()=>j,xI:()=>P.xI,$X:()=>ey,o7:()=>S,mH:()=>tn,M:()=>h.M,nN:()=>P.nN,GZ:()=>I,Hi:()=>C.H,pc:()=>P.pc,_3:()=>M,Gu:()=>Y,DX:()=>ev,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 A(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 M(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 T=new WeakMap;function I(e,t){T.set(e,t??null)}function _(e){return T.get(e)??null}function D(e){T.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 G(e){return"string"==typeof e&&e.length===B&&[...e].every(e=>$.includes(e))}function Y(e,t){let l=z(t),n=l?U(l):void 0;return n?H(e,n):void 0}function J(e,t){if(G(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"]);function ea(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 es(e){let t=ed((e||[]).map(e=>String(e)));if("date"!==t[0])return!1;if(1===t.length)return!0;if("preset"===t[1])return 2===t.length||3===t.length&&er.has(t[2]);if("relative"===t[1])return 2===t.length||(3===t.length?ei.has(t[2]):4===t.length?ei.has(t[2])&&eo.has(t[3]):5===t.length&&ei.has(t[2])&&eo.has(t[3])&&"number"==typeof em(t[4]));if("exact"===t[1]){if(2===t.length)return!0;if("single"===t[2])return 3===t.length||(4===t.length?"date"===t[3]:5===t.length&&"date"===t[3]&&/^v.+/.test(t[4]));if("range"===t[2]){if(3===t.length)return!0;if(4===t.length)return"date"===t[3];if(5===t.length)return"date"===t[3]&&/^v.+/.test(t[4]);if(6===t.length)return"date"===t[3]&&/^v.+/.test(t[4])&&/^v.+/.test(t[5])}}return!1}function ed(e){return"date"===e[0]?e:["date",...e]}function eu(e){let t=ed(e);return`{{ ctx.${t.join(".")} }}`}function ec(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 ep(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 eh(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 em(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 ef(e){let t=e.day(),l=0===t?-6:1-t;return e.add(l,"day").startOf("day")}function eg(e){let t=3*Math.floor(e.month()/3);return e.month(t).startOf("month")}function ev(e){return ec(String(e||"")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function ey(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=ep(r);if(ev(i)!==t)return;return i}catch(e){return}}function eb(e){return"string"==typeof e&&en.test(e.trim())}function ex(e){if(!es(e))return!1;let t=ed((e||[]).map(e=>String(e)));return"date"===t[0]&&("preset"===t[1]?3===t.length&&er.has(t[2]):"relative"===t[1]?5===t.length&&ei.has(t[2])&&eo.has(t[3])&&"number"==typeof em(t[4]):"exact"===t[1]&&"single"===t[2]&&"date"===t[3]?5===t.length&&/^v.+/.test(t[4]):"exact"===t[1]&&"range"===t[2]&&"date"===t[3]&&6===t.length&&/^v.+/.test(t[4])&&/^v.+/.test(t[5]))}function ew(e){if(!eb(e))return;let t=ed(ea(e)||[]);if("preset"===t[1]&&3===t.length&&er.has(t[2]))return{type:t[2]};if("relative"===t[1]&&5===t.length&&ei.has(t[2])&&eo.has(t[3])){let e=em(t[4]);return"number"==typeof e?{type:t[2],unit:t[3],number:e}:void 0}if("exact"===t[1]&&"single"===t[2]&&"date"===t[3]&&5===t.length){let e=String(t[4]||"");if(!e.startsWith("v"))return;return ey(e.slice(1))}if("exact"===t[1]&&"range"===t[2]&&"date"===t[3]&&6===t.length){let e=String(t[4]||""),l=String(t[5]||"");if(!e.startsWith("v")||!l.startsWith("v"))return;let n=ey(e.slice(1)),r=ey(l.slice(1));if(void 0===n||void 0===r)return;return[n,r]}}function eS(e){if(eb(e))return String(e).trim();if(null==e||""===e)return;if(Array.isArray(e)){let t=eh(e[0]),l=eh(e[1]);return t&&l?eu(["date","exact","range","date",`v${ev(t)}`,`v${ev(l)}`]):t?eu(["date","exact","single","date",`v${ev(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 eu(["date","relative",l,e,`n${r}`])}if(er.has(l))return eu(["date","preset",l])}let t=eh(e);if(t)return eu(["date","exact","single","date",`v${ev(t)}`])}function eA(e){let t=ed((e||[]).map(e=>String(e)));if("date"===t[0]){if("preset"===t[1]&&3===t.length){let e=t[2];if("now"===e)return el()().toISOString();let l=el()();return"today"===e?l.format("YYYY-MM-DD"):"yesterday"===e?l.add(-1,"day").format("YYYY-MM-DD"):"tomorrow"===e?l.add(1,"day").format("YYYY-MM-DD"):"thisWeek"===e?ef(l).format("YYYY-MM-DD"):"lastWeek"===e?ef(l.add(-1,"week")).format("YYYY-MM-DD"):"nextWeek"===e?ef(l.add(1,"week")).format("YYYY-MM-DD"):"thisMonth"===e?l.startOf("month").format("YYYY-MM-DD"):"lastMonth"===e?l.add(-1,"month").startOf("month").format("YYYY-MM-DD"):"nextMonth"===e?l.add(1,"month").startOf("month").format("YYYY-MM-DD"):"thisQuarter"===e?eg(l).format("YYYY-MM-DD"):"lastQuarter"===e?eg(l.add(-3,"month")).format("YYYY-MM-DD"):"nextQuarter"===e?eg(l.add(3,"month")).format("YYYY-MM-DD"):"thisYear"===e?l.startOf("year").format("YYYY-MM-DD"):"lastYear"===e?l.add(-1,"year").startOf("year").format("YYYY-MM-DD"):"nextYear"===e?l.add(1,"year").startOf("year").format("YYYY-MM-DD"):void 0}if("relative"===t[1]&&5===t.length&&ei.has(t[2])&&eo.has(t[3])){let e=em(t[4]);if("number"!=typeof e)return;let l="past"===t[2]?-1:1,n=t[3];return el()().add(l*e,n).format("YYYY-MM-DD")}if("exact"===t[1]&&"single"===t[2]&&"date"===t[3]&&5===t.length){let e=String(t[4]||"");if(!e.startsWith("v"))return;return ey(e.slice(1))}if("exact"===t[1]&&"range"===t[2]&&"date"===t[3]&&6===t.length){let e=String(t[4]||""),l=String(t[5]||"");if(!e.startsWith("v")||!l.startsWith("v"))return;let n=ey(e.slice(1)),r=ey(l.slice(1));if(void 0===n||void 0===r)return;return[n,r]}}}let eM=new Set(["code","version"]);function eF(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(!eM.has(e))return!1;return!0}function ek(e){return{code:String((null==e?void 0:e.code)??""),version:String((null==e?void 0:e.version)??"v1")}}function eC(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 eP(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 ej(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 eE(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=ej(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=ej(n[3]||"");return{varName:e,subPath:t.subPath,wildcard:t.wildcard}}return null}function eR(e){let t;if("string"!=typeof e||!e.trim())return{};let l=eC(e),n=eP(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=eE(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 eT(e,t){let l={};if(!t||"object"!=typeof t||Array.isArray(t))return l;for(let[r,i]of Object.entries(t))if(void 0!==i){if(eF(i)){var n;let{code:t,version:o}=ek(i);if(!t.trim())continue;let a=e,s=await (null==a||null==(n=a.runjs)?void 0:n.call(a,t,void 0,{version:o}));if(!(null==s?void 0:s.success))throw Error(`RunJS execution failed for "${r}"`);void 0!==s.value&&(l[r]=s.value);continue}l[r]=i}return l}var eI=l(49773);let e_="ctx.resolveJsonTemplate",eD=/\{\{\s*ctx(?:\.|\[|\?\.)/,eN=/\bctx(?:\?\.|\.)libs\b/,eO="__runjs_templateValueToString",e$=/\b__runjs_ctx_tpl_\d+\b/,eB=/\b__runjs_templateValueToString(?:_\d+)?\b/,eL=/\b__runjs_ctx_tpl_\d+\b|\b__runjs_templateValueToString(?:_\d+)?\b/,eq=/\b__runjs_ensure_libs\b/,eV=256,ez={withTemplates:new Map,withoutTemplates:new Map};function eK(e,t){let l=e.get(t);if(void 0!==l)return e.delete(t),e.set(t,l),l}function eU(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 eW(e){return!!e&&/[A-Za-z0-9_$]/.test(e)}function eH(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 eG(e,t){if(!e.startsWith(e_,t))return!1;let l=t>0?e[t-1]:"",n=e[t+e_.length]||"";return!(eW(l)||eW(n))}function eY(e,t){let l=t+2;for(;l<e.length;){let t=e[l];if(l+=1,"\n"===t)break}return l}function eJ(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 eX(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 eQ(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=eX(e,l,n);continue}if("`"===n){l=eQ(e,l);continue}if("/"===n&&"/"===r){l=eY(e,l);continue}if("/"===n&&"*"===r){l=eJ(e,l);continue}"{"===n?t+=1:"}"===n&&(t-=1),l+=1}continue}l+=1}return l}function eZ(e){if(!eD.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);eH(i)&&t.push(i),l=r+2}return t}function e0(e,t){let l=t;for(;l<e.length&&/\s/.test(e[l]);)l+=1;return l}function e1(e,t){let l=t;for(;l>=0&&/\s/.test(e[l]);)l-=1;return l}function e2(e,t){let l=t;for(;;){l=e0(e,l);let t=e[l],n=e[l+1];if("/"===t&&"/"===n){l=eY(e,l);continue}if("/"===t&&"*"===n){l=eJ(e,l);continue}return l}}function e5(e){return!!e&&/[A-Za-z_$]/.test(e)}function e4(e,t){if(!e5(e[t]))return null;let l=t+1;for(;l<e.length&&eW(e[l]);)l+=1;return{name:e.slice(t,l),end:l}}function e8(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 e3(e,t){if(!e.startsWith("ctx",t))return null;let l=t>0?e[t-1]:"",n=e[t+3]||"";if(eW(l)||eW(n))return null;let r=e.slice(t+3);return r.startsWith(".libs")?t+3+5:r.startsWith("?.libs")?t+3+6:null}function e6(e,t){let l=e3(e,t);if(null===l)return null;let n=e2(e,l),r=e[n],i=e[n+1],o=e[n+2];if("?"===r&&"."===i&&"["===o){n=e2(e,n+3);let t=e[n];if("'"===t||'"'===t){let l=e8(e,n,t);if(!l)return{end:n+1};let r=e2(e,l.end);return"]"===e[r]&&(r+=1),{end:r,key:l.value}}return{end:n}}if("["===r){n=e2(e,n+1);let t=e[n];if("'"===t||'"'===t){let l=e8(e,n,t);if(!l)return{end:n+1};let r=e2(e,l.end);return"]"===e[r]&&(r+=1),{end:r,key:l.value}}return{end:n}}if("?"===r&&"."===i){n=e2(e,n+2);let t=e4(e,n);return t?{end:t.end,key:t.name}:{end:n}}if("."===r){n=e2(e,n+1);let t=e4(e,n);return t?{end:t.end,key:t.name}:{end:n}}return{end:l}}function e9(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=e8(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=eX(l,s,e);continue}if("`"===e){s=eQ(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 e7(e){if(!eN.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=eY(e,r);continue}if("/"===l&&"*"===o){r=eJ(e,r);continue}if("'"===l||'"'===l){r=eX(e,r,l);continue}if("`"===l){r=n(r+1);continue}let a=e6(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=eY(e,r);continue}if("/"===l&&"*"===i){r=eJ(e,r);continue}if("'"===l||'"'===l){r=eX(e,r,l);continue}if("`"===l){r=n(r+1);continue}let o=e6(e,r);if(o){o.key&&t.add(o.key),r=o.end;continue}if("="===l&&"="!==i&&">"!==i&&"<"!==i){let l=e2(e,r+1);if(null!==e3(e,l)){let l=e1(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 e9(e.slice(r+1,l)))t.add(n)}}}r+=1}return Array.from(t)}function te(e){if(eq.test(e)||!eN.test(e))return e;let t=e7(e);return t.length?`/* __runjs_ensure_libs */
1852
1852
  await ctx.__ensureLibs(${JSON.stringify(t)});
1853
1853
  ${e}`:e}function tt(e,t,l){let n=e0(e,l);if(":"!==e[n])return!1;let r=e1(e,t-1),i=r>=0?e[r]:"";return"{"===i||","===i}function tl(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 tn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!eD.test(e))return e;let l=!1!==t.processBarePlaceholders,n=!1!==t.processStringLiterals;if(l&&n&&eL.test(e)||l&&!n&&e$.test(e)||!l&&n&&eB.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})(eO),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=eY(e,h);p+=e.slice(h,t),h=t;continue}if("/"===t&&"*"===r){let t=eJ(e,h);p+=e.slice(h,t),h=t;continue}if("'"===t||'"'===t){let l=eX(e,h,t),r=e.slice(h,l);if(n&&0===f){let t=eZ(r);if(t.length){o=!0;let n=tl(r,t,c,s);p+=tt(e,h,l)?`[${n}]`:n}else p+=r}else p+=r;h=l;continue}if("`"===t){let t=eQ(e,h),l=e.slice(h,t);if(n&&0===f){let n=eZ(l);if(n.length){o=!0;let r=tl(l,n,c,s);p+=tt(e,h,t)?`[${r}]`:r}else p+=l}else p+=l;h=t;continue}if(0===f&&!m&&eG(e,h)){p+=e_,h+=e_.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(eH(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")}
1854
- ${p}`}async function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,r=n?ez.withTemplates:ez.withoutTemplates,i=eK(r,l);if(i)return await i;let o=(async()=>{if(!n)return te(await (0,eI.W)(l));let e=tn(l,{processStringLiterals:!1});return te(tn(await (0,eI.W)(e),{processBarePlaceholders:!1}))})();eU(r,l,o,eV);try{return await o}catch(e){throw r.delete(l),e}}var ti=l(62572);function to(e){if(Array.isArray(e)){let t=e.map(e=>to(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=to(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 ta=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var ts=l(47684);let td="0123456789abcdefghijklmnopqrstuvwxyz";function tu(){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+=td[Math.random()*td.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:()=>h,gG:()=>o,mv:()=>a,o4:()=>p});var n=l(40542),r=l(2543),i=l.n(r);async function o(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 a(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 s={queue:[],timer:null,inflightByRun:new Map},d=10;function u(e){if(Array.isArray(e))return e.map(u);if(i().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,u(l)]});return Object.fromEntries(i().sortBy(t,e=>{let[t]=e;return t}))}return e}function c(e){try{return JSON.stringify(u(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function p(e,t){let l,n,r=s,i=e.runId||"GLOBAL",o=c(t),a=r.inflightByRun.get(i);a||(a=new Map,r.inflightByRun.set(i,a));let u=a.get(o);if(u)return u;let p=new Promise((e,t)=>{l=e,n=t});a.set(o,p);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,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,d)),p}async function h(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await g(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 m(e,t){let l=await f(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 f(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 g(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 m(e,t):l}return await m(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})},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){let t=new Set,l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g;for(;null!==(e=i.exec(r));)t.add(e[1]);let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]/g;for(;null!==(n=o.exec(r));)t.add(n[2])}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}function r(e){let t={},l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([^\s)]*)/g;for(;null!==(e=i.exec(r));){let l=e[1],n=e[2]||"";if(t[l]=t[l]||[],n.startsWith("."))t[l].push(n.slice(1));else if(n.startsWith("[")){let e=n.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(e){let n=e[2],r=e[3]||"";t[l].push(`${n}${r}`)}else{let e=n.match(/^\[(\d+)\](.*)$/);if(e){let n=e[1],r=e[2]||"";t[l].push(`[${n}]${r}`)}}}else n.startsWith("(")&&!t[l].length&&t[l].push("")}let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]([^\s)]*)/g;for(;null!==(n=o.exec(r));){let e=n[2],l=n[3]||"";if(t[e]=t[e]||[],l.startsWith("."))t[e].push(l.slice(1));else if(l.startsWith("[")){let n=l.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(n){let l=n[2],r=n[3]||"";t[e].push(`${l}${r}`)}else{let n=l.match(/^\[(\d+)\](.*)$/);if(n){let l=n[1],r=n[2]||"";t[e].push(`[${l}]${r}`)}}}else l.startsWith("(")&&!t[e].length&&t[e].push("")}}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}l.d(t,{xI:()=>m,vP:()=>y,$S:()=>f,pc:()=>g,Cg:()=>c,nN:()=>b,ju:()=>x,Xx:()=>h,vE:()=>p,XU:()=>u,UX:()=>v});var i=l(22928),o=l(35846),a=l(44476),s=l(2543),d=l.n(s);function u(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 c(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 p(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,u=i[o];if(null!=s&&null!=u&&s===u)return d().cloneDeep(i)}function h(e,t){return l=>{var n,r,i,o;if(!("record"===l||l.startsWith("record.")))return!1;let s=t();if(!s)return!0;if("record"===l)return!1;let d=c(e),u=null==d?void 0:d.collection,p=(null==d?void 0:d.dataSourceKey)||"main";if(!u)return!0;let h=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,p),m=null==h||null==(o=h.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,u);if(!m)return!0;let f=(0,a.H)(()=>m,()=>s),g=l.startsWith("record.")?l.slice(7):"";return!!g&&f(g)}}function m(e,t){let l=(0,a.H)(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 f(e,t,l){let n=await (0,o.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):u(e)}:null}function g(e,t,l){let n=async()=>f(e,t,l);return n.title=t,n}function v(e,t,l){var n,r;return g(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=>u(e))}let y=n,b=r;async function x(e,t){let l=Object.keys(r(t)||{});if(!l.length)return;let n={};for(let t of l){var o;let l,r=null==(o=e.getPropertyOptions)?void 0:o.call(e,t),i=null==r?void 0:r.meta;if(i){try{let t="function"==typeof i?await i():i,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(n[t]=l)}}return(0,i.d)(e,n)}},67778(e,t,l){l.d(t,{sp:()=>P,bt:()=>T,U:()=>el,N5:()=>K,xB:()=>B,mW:()=>$,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){return null!=e}function c(e,t){if(e===t)return!0;if(!u(e)||!u(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function p(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function h(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p(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(u(n[t])){if(!c(null==e?void 0:e[t],n[t])){r=!1;break}l+=1}r&&l>=d&&(s=t,d=l)}return s}function m(e,t){return t??e.view}function f(e){var t;if(!e)return!1;let l=p(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,r=Array.isArray(n)&&n.length>0;return h(e,l)>=1||r}function g(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return f(m(l,t))},r=async e=>{let l=m(e,t);if(!l||!f(l))return;let n=await v(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=m(s,t),u=p(d),c=h(d,u);if(c<1||l<1)return;let f=c-l;if(f<1)return;let g=u[f];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=m(e,t),r=p(n);return h(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},u=()=>({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),u=m(e,t),c=null==u?void 0:u.inputArgs,f={};if(d){let e={...d};!e.associationName&&(null==c?void 0:c.associationName)&&(e.associationName=c.associationName),void 0===e.sourceId&&void 0!==(null==c?void 0:c.sourceId)&&(e.sourceId=null==c?void 0:c.sourceId),f.record=e}try{let t=p(u);if(h(u,t)>=2){let t=f,l=1,n=await o(l,e);for(;n;)t.parent||(t.parent={}),t.parent.record=n,t=t.parent,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=null==c?void 0:c.sourceId,t=null==c?void 0:c.associationName,l=(null==c?void 0:c.dataSourceKey)||"main";if(null!=e&&""!==e&&t&&"string"==typeof t){let n=String(t).split(".")[0];n&&(f.sourceRecord={collection:n,dataSourceKey:l,filterByTk:e})}}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return f},properties:async()=>{var n,a,u,c;let f={};if(f.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,f.record=e}try{let r=m(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=p(r),l=h(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&&(f.sourceRecord=r)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return f.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)&&(f.parent=s(1)),f}});return u.title=l("Current popup"),u.sort=975,u}async function v(e,t){var l;let n=p(t),r=h(t,n),i=null==t||null==(l=t.inputArgs)?void 0:l.openerUids,o=Array.isArray(i)&&i.length>0;if(!(r>=1||o))return;if(!n.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}}}let a=async t=>{var l,r,i,o,s,d;if(t<0||!(null==(l=n[t])?void 0:l.viewUid))return;let u=n[t].viewUid,c=null==(r=e.engine)?void 0:r.getModel(u,!0);c||(c=await (null==(d=e.engine)?void 0:d.loadModel({uid:u})));let p=(null==c||null==(i=c.getStepParams)?void 0:i.call(c,"popupSettings","openView"))||{},h=null==p?void 0:p.collectionName,m={uid:u,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:h,associationName:null==p?void 0:p.associationName,filterByTk:null==(o=n[t])?void 0:o.filterByTk,sourceId:null==(s=n[t])?void 0:s.sourceId}},f=await a(t-1);return f&&(m.parent=f),m};return await a(r)}function y(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/;e.defineProperty("popup",{get:async()=>v(e,t),meta:g(e,t),resolveOnServer:e=>{try{return!!e&&l.test(e)}catch(e){return!1}}})}var b=l(18182);let x=(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)(b.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function w(){let[e,t]=r.useState([]);return[e,r.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var S=l(16639),A=l(20616),M=l(47451);async function F(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function k(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 C=0;function P(){let e=r.useRef(null),t=(t,l)=>{var u,c,p;let h,m,f=null==l?void 0:l.engine;C+=1;let g=r.createRef(),v=new Promise(e=>{m=e}),b=null,w=null,P=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return b=t,null==(e=g.current)||e.setFooter(t),()=>{var e;b=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},j=e=>(r.useEffect(()=>{var t;return w=e,null==(t=g.current)||t.setHeader(e),()=>{var e;w=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),E=new a.cB,R=(0,M._)(l.engine),T=(0,S.eX)(f,R);E.defineProperty("engine",{value:R}),E.addDelegate(R.context),!1!==t.inheritContext?E.addDelegate(l):(E.addDelegate(l.engine.context),k(E,l));let I=!1,_={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(I)return;I=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==h||h(),null==m||m(e);let o=null==T?void 0:T.emitter;(0,S.Z8)(o),null==o||null==(i=o.emit)||i.call(o,S.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 F(_,{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:P,Header:j,setFooter:e=>{var t;b=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;w=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()}),y(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)(x,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(o=a.hidden)?void 0:o.value,footer:b,header:w,...t,onCancel:()=>{_.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),N=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${C}`,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]=w();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 j=l(97134),E=l(61793);let R=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)(E.D,{className:d?"nb-hidden":"",visible:p,...c,footer:m,...g,onClose:c.onClose,children:i}):(0,n.jsx)(j.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,b=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 b=e,null==(t=f.current)||t.setHeader(e),()=>{var e;b=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),C=new a.cB,P=(0,M._)(l.engine),j=(0,S.eX)(m,P);C.defineProperty("engine",{value:P}),C.addDelegate(P.context),!1!==t.inheritContext?C.addDelegate(l):(C.addDelegate(l.engine.context),k(C,l));let E=!1,T={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,S.Z8)(o),null==o||null==(i=o.emit)||i.call(o,S.B9,{type:"drawer",viewUid:null==T||null==(r=T.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 F(T,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():T.destroy(e),!0)},Footer:x,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;b=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,C)}};C.defineProperty("view",{get:()=>T,resolveOnServer:(0,d.Xx)(C,()=>(0,d.vE)(l,C))}),P.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),T.destroy()}),y(C,T);let I=r.memo((0,o.observer)(e=>{var l,o,a,s;let d=r.useRef(!1),u="function"==typeof t.content?t.content(T,C):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,T,C)},[]),(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)(R,{ref:f,...t,footer:v,header:t.header||b,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{T.close(t.result)},isMobile:C.isMobileLayout,children:[c,e.children]}))}));I.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:C,children:(0,n.jsx)(I,{children:t})})})});return _.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(_),Object.assign(g,T)},c=r.useMemo(()=>({open:u}),[]),p=r.memo(r.forwardRef((e,i)=>{let[o,a]=w();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 I=l(40961),_=l(31333),D=l(71021);let N=(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)(D.Ay,{type:"text",size:"small",icon:(0,n.jsx)(_.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}),O=0,$="nocobase-embed-container",B="nocobaseEmbedReplacing";function L(e){return!!e&&"function"==typeof e.then}function q(e,t){e.dataset[B]="1";try{let l=t.close();if(L(l))return Promise.resolve(l).finally(()=>{delete e.dataset[B]});return delete e.dataset[B],l}catch(t){throw delete e.dataset[B],t}}function V(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 z=r.memo(r.forwardRef((e,t)=>{let[l,i]=w();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));function K(){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,b=c instanceof HTMLElement&&c.id===$,x=()=>{var l,g,x;let w,C,P,j=null==u?void 0:u.engine;O+=1;let E=r.createRef(),R=new Promise(e=>{C=e}),T=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},_=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,$=(0,M._)(u.engine),L=(0,S.eX)(j,$);D.defineProperty("engine",{value:$}),D.addDelegate($.context),m?D.addDelegate(u):(D.addDelegate(u.engine.context),k(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==C||C(e),null==(n=E.current)||n.destroy(),null==w||w(),b&&t.current===V&&(t.current=null),!(b&&c instanceof HTMLElement&&(null==(r=c.dataset)?void 0:r[B])==="1")){let e=null==L?void 0:L.emitter;(0,S.Z8)(e),null==e||null==(a=e.emit)||a.call(e,S.B9,{type:"embed",viewUid:null==V||null==(o=V.inputArgs)?void 0:o.viewUid})}$.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 F(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:_,Footer:T,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))}),y(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)(N,{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-${O}`,U=(0,n.jsx)(A.I6,{engine:$,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(I.createPortal(U,c,K)):null==(x=e.current)?void 0:x.patchElement(U),b&&(t.current=V),Object.assign(R,V)};if(b&&t.current){let e,n=l.current+=1,r=()=>null==g?void 0:g();try{e=q(c,t.current)}catch(e){throw r(),e}if(L(e))return V(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(),V(Promise.resolve({page:null}),f,!!i.preventClose)}return x()};return[r.useMemo(()=>({open:i}),[]),(0,n.jsx)(z,{ref:e},"page-holder")]}var U=l(28073);let W=0,H=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)(U.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;W+=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)(H,{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-${W}`);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]=w();return r.useImperativeHandle(t,()=>({patchElement:i}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(o,{ref:e},"popover-holder")]}var Y=l(50467),J=l(52847),X=l(60182);function Q(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 Z(e){return null!=e&&""!==String(e)}function ee(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function et(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=ee(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,X.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Q(e.filterByTk);t&&n.push("filterbytk",t)}Z(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class el{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=et(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=et([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=et(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,Y._)(this,"viewStack",void 0),(0,Y._)(this,"ctx",void 0),(0,Y._)(this,"viewParams",void 0),(0,Y._)(this,"basePath",void 0),this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,J.E8)(this,{viewParams:J.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}},12039(e,t,l){l.d(t,{xW:()=>b,bO:()=>c,Q9:()=>y});var n=l(50467),r=l(88909),i=l(55373),o=l.n(i),a=l(4198);function s(e,t){var l,n;if("u"<typeof document)return;let r=(0,a.getAuthCookieName)("role",e),i=t?"":"; Max-Age=0",o=t?encodeURIComponent(t):"",s=(null==(l=globalThis.location)?void 0:l.protocol)==="https:"?"; Secure":"",d=(null==(n=window.__nocobase_public_path__)?void 0:n.replace(/\/+$/g,""))||"/";document.cookie=`${r}=${o}; Path=${d||"/"}; SameSite=Lax${s}${i}`}function d(e,t){var l;if("u"<typeof document)return;let n=`${(0,a.getAuthCookieName)(e,t)}=`;return null==(l=document.cookie.split(";").map(e=>e.trim()).find(e=>e.startsWith(n)))?void 0:l.slice(n.length)}let u=(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},c=(e,t)=>{let l=u(e,t);return null!=l&&""!==l},p=new Set(["get","head","options"]);class h{get storagePrefix(){return this.api.storagePrefix}getCookieAppName(){var e;return"function"!=typeof this.api.options&&(null==(e=this.api.options)?void 0:e.appName)||this.api.appName||"main"}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),s(this.getCookieAppName(),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){this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!c(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!c(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`);let t=(e.method||"get").toLowerCase(),l=d("csrfToken",this.getCookieAppName());return!p.has(t)&&l&&!c(e.headers,"X-CSRF-Token")&&e.headers&&(e.headers["X-CSRF-Token"]=l),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 syncCookies(){if(this.token)return await this.api.request({method:"post",url:"auth:syncCookies",skipNotify:!0})}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 m{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 f extends m{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 g extends m{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 v extends g{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 y{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 g(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new v(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new f}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),(0,n._)(this,"appName",void 0),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.appName=t,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 h(this)),this.interceptors()}}let b=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]}},4198(e,t,l){l.r(t),l.d(t,{getDayRange:()=>tr,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>td,str2moment:()=>ey,unflatten:()=>e6,sortTree:()=>ea,forEach:()=>eP,utc2unit:()=>to,extractUsedVariablePaths:()=>tT,getValuesByPath:()=>ej,isArray:()=>et,moment2str:()=>ew,transformLiquidContext:()=>t_,isURL:()=>tk,isPortalInBody:()=>tw,extractUsedVariableNames:()=>tR,parseHTML:()=>tS,toGmt:()=>em,isPlainObject:()=>en,lockdownSes:()=>ty,splitPathToTwoParts:()=>tu,transformFilter:()=>Y,parseSQLBindParams:()=>tO,getPickerFormat:()=>eF,nextTick:()=>ei,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eD,evaluateConditions:()=>Z,toUnit:()=>ta,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>eC,BASE_BLOCKED_IDENTIFIERS:()=>tf,toLocal:()=>ef,getDayRangeByParams:()=>L,getDefaultFormat:()=>eh,transformMultiColumnToSingleColumn:()=>tj,treeFind:()=>eo,transformSQL:()=>t$,parseFilter:()=>tn,flatten:()=>e3,isEmpty:()=>el,getOffsetRangeByParams:()=>N,offsetFromString:()=>eS,getAuthCookieName:()=>ep,error:()=>ez,tval:()=>tb,Registry:()=>tp,lodash:()=>r(),parse:()=>eB,hasEmptyValue:()=>er,toFixedByStep:()=>eQ,getDateTimeFormat:()=>ek,showToast:()=>eY,Handlebars:()=>eT(),getLiquidContext:()=>tD,merge:()=>eH,dayjs:()=>o(),parseLiquidContext:()=>tN,uid:()=>tF,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),A=l(41816),M=l.n(A),F=l(88569),k=l.n(F),C=l(83826),P=l.n(C),j=l(8134),E=l.n(j),R=l(28623),T=l.n(R),I=l(46986),_=l.n(I);o().extend(_()),o().extend(S()),o().extend(k()),o().extend(P()),o().extend(M()),o().extend(x()),o().extend(m()),o().extend(g()),o().extend(y()),o().extend(E()),o().extend(T()),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 G(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return G(e);throw Error("Invalid filter item type")})}}function Y(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(G(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={authToken:"nb_auth_token",authenticator:"nb_authenticator",role:"nb_role",csrfToken:"nb_csrf_token"};function ep(e,t){return`${ec[e]}_${t||"main"}`}let eh=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",em=e=>e&&o().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,ef=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):o().isDayjs(e)?e.startOf("second").toISOString():void 0:e,eg=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return o()().quarter(l).year(t)}catch(e){return null}},ev=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:r,utc:i=!0,dateOnly:a}=t;if(!o()(e).isValid())return eg(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(eS(l)):e:n?o()(e).utcOffset(0):l?o()(e).utcOffset(eS(l)):o()(e):o()(e)},ey=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ev(e,t)):e?ev(e,t):e},eb=(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",ex=(e,t)=>e?Array.isArray(e)?e.map(e=>eb(e,t)):o().isDayjs(e)?eb(e,t):void 0:e,ew=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:r}=t;return e?l?n?em(e):ef(e):ex(e,r):e};function eS(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]))+eA(o[2]);return 0===a?0:"+"===o[0]?a:-a}function eA(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eM(t)),l}function eM(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eF=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"}},ek=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function eC(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 eP=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})},ej=(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=ej(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 eE=l(88835),eR=l(60639),eT=l.n(eR),eI=l(79441);let e_=l.n(eI)()();function eD(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(eD);if(e.$and||e.$or)return eD(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 eN(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eO(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 e$(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eB(e){switch(eN(e)){case"string":return eL(e);case"object":return eq(e);case"array":return eV(e);default:return e$(function(){return e},[])}}Object.keys(e_).forEach(function(e){eT().registerHelper(e,e_[e])}),eT().registerHelper("json",function(e){return JSON.stringify(e)}),eT().registerHelper("urlParse",function(e){try{return JSON.stringify(eE.parse(e))}catch(t){return`Invalid URL: ${e}`}}),eT().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?o()(e).tz(l).format(t):o()(e).format(t)),eT().registerHelper("isNull",e=>r().isNull(e));let eL=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],r=e=>t,i=t.match(e);return i&&(l=i.map(eO),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))),e$(r,l)}})();function eq(e){let t=Object.keys(e).map(t=>({keyTemplate:eL(t),valueTemplate:eB(e[t])}));return e$(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 eV(e){let t=e.map(eB);return e$(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let ez=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 eK=l(14744),eU=l.n(eK);let eW=(e,t,l)=>t;function eH(e,t,l){return eU()(e,t,{arrayMerge:eW,...l})}var eG=l(76511);let eY=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;eG.Ay[t]({message:e,duration:l})};var eJ=l(5062),eX=l(85738);function eQ(e,t){if(null==e||""===e)return"";let l=(0,eJ.i5)(t);return(0,eX.Mg)(String(e),".",l)}var eZ=l(63560),e0=l.n(eZ),e1=l(95093),e2=l.n(e1);let e5=/^\s*\{\{([\s\S]*)\}\}\s*$/;function e4(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function e8(e){return e}function e3(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,i=t.transformKey||e8,o=t.transformValue||e8,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=e4(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 e6(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||e8;for(let t of Object.keys(e))e0()(l,t,n(e[t],t));return l}let e9=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},e7=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function te(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tt(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 tl=(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:te(e)?e.toISOString():void 0:null,tn=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=e3(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=e5.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 e6(a,{transformValue(e,t){let{operator:l}=e9(t);if("string"==typeof e){let a=e5.exec(e);if(a){let s=ej(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(e7(l)){let l=null==o?void 0:o(t);return tt(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||r}):e:tl(e,(null==l?void 0:l.timezone)||r)}return e}})};function tr(e){let{now:t,timezone:l="+00:00",offset:n}=e,r=ti(t).utcOffset(eS(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 ti(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?o().isDayjs(e)?e:t?e2()(e):o()(e):t?e2()():o()()}function to(e){var t;let{now:l,unit:n,timezone:r="+00:00",offset:i}=e,o=ti(l,"isoWeek"===n);o=(o=o.utcOffset(eS(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 ta=(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),to({now:n,timezone:r,unit:e,offset:t})},ts=e=>t=>{let{now:l,timezone:n,field:r}=t;return(null==r?void 0:r.timezone)&&(n=null==r?void 0:r.timezone),tr({now:l,timezone:n,offset:e})};function td(){return{now:new Date().toISOString(),today:ta("day"),yesterday:ta("day",-1),tomorrow:ta("day",1),thisWeek:ta("week"),lastWeek:ta("week",-1),nextWeek:ta("week",1),thisIsoWeek:ta("isoWeek"),lastIsoWeek:ta("isoWeek",-1),nextIsoWeek:ta("isoWeek",1),thisMonth:ta("month"),lastMonth:ta("month",-1),nextMonth:ta("month",1),thisQuarter:ta("quarter"),lastQuarter:ta("quarter",-1),nextQuarter:ta("quarter",1),thisYear:ta("year"),lastYear:ta("year",-1),nextYear:ta("year",1),last7Days:ts(-7),next7Days:ts(7),last30Days:ts(-30),next30Days:ts(30),last90Days:ts(-90),next90Days:ts(90)}}function tu(e){let t=e.split(".");return[t.shift(),t.join(".")]}var tc=l(50467);class tp{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,tc._)(this,"map",new Map),(0,tc._)(this,"options",void 0),this.options=e}}l(67980);let th=Symbol.for("nocobase.utils.sesLockdown"),tm=Symbol.for("nocobase.utils.bufferOverrides"),tf=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tg(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tv(){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 ty(e){tv();let t=globalThis;if(!t[th]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tg(e))throw e}t[th]=!0}}function tb(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tx=l(65606);let tw=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!tx.env.__TEST__};function tS(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tA=36,tM="";for(;tA--;)tM+=tA.toString(36);function tF(e){let t="",l=e||11;for(;l--;)t+=tM[36*Math.random()|0];return t}function tk(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tC=l(27153),tP=JSON.parse('{"rE":"3.0.0-alpha.4"}');let tj=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=tj(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[`${tF()}_${l}`]=tE(s,l,++o))})}}),e.properties=n,l){let t=new tC.S(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tE(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tP.rE,"x-uid":tF(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tR(e){let t=new Set,l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g;for(;null!==(e=i.exec(r));)t.add(e[1]);let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]/g;for(;null!==(n=o.exec(r));)t.add(n[2])}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}function tT(e){let t={},l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([^\s)]*)/g;for(;null!==(e=i.exec(r));){let l=e[1],n=e[2]||"";if(t[l]=t[l]||[],n.startsWith("."))t[l].push(n.slice(1));else if(n.startsWith("[")){let e=n.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(e){let n=e[2],r=e[3]||"";t[l].push(`${n}${r}`)}else{let e=n.match(/^\[(\d+)\](.*)$/);if(e){let n=e[1],r=e[2]||"";t[l].push(`[${n}]${r}`)}}}else n.startsWith("(")&&!t[l].length&&t[l].push("")}let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]([^\s)]*)/g;for(;null!==(n=o.exec(r));){let e=n[2],l=n[3]||"";if(t[e]=t[e]||[],l.startsWith("."))t[e].push(l.slice(1));else if(l.startsWith("[")){let n=l.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(n){let l=n[2],r=n[3]||"";t[e].push(`${l}${r}`)}else{let n=l.match(/^\[(\d+)\](.*)$/);if(n){let l=n[1],r=n[2]||"";t[e].push(`[${l}]${r}`)}}}else l.startsWith("(")&&!t[e].length&&t[e].push("")}}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}let tI=new(l(23155)).HX;function t_(){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 tD(e){return t_(await tI.fullVariables(e))}async function tN(e,t){return await tI.parseAndRender(e,{ctx:t})}function tO(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 t$(e){let{sql:t,bind:l}=tO(e),n=await tD(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-155a4c9b.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-8ecef45a.js";__webpack_require__.C(__rspack_chunk_8),__webpack_exec__(38835);
1854
+ ${p}`}async function tr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="string"==typeof e?e:String(e??""),n=!!t.preprocessTemplates,r=n?ez.withTemplates:ez.withoutTemplates,i=eK(r,l);if(i)return await i;let o=(async()=>{if(!n)return te(await (0,eI.W)(l));let e=tn(l,{processStringLiterals:!1});return te(tn(await (0,eI.W)(e),{processBarePlaceholders:!1}))})();eU(r,l,o,eV);try{return await o}catch(e){throw r.delete(l),e}}var ti=l(62572);function to(e){if(Array.isArray(e)){let t=e.map(e=>to(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=to(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 ta=e=>"string"==typeof e.on?"beforeRender"===e.on:"object"==typeof e.on?"beforeRender"===e.on.eventName:!e.on&&!0!==e.manual;var ts=l(47684);let td="0123456789abcdefghijklmnopqrstuvwxyz";function tu(){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+=td[Math.random()*td.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:()=>h,gG:()=>o,mv:()=>a,o4:()=>p});var n=l(40542),r=l(2543),i=l.n(r);async function o(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 a(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 s={queue:[],timer:null,inflightByRun:new Map},d=10;function u(e){if(Array.isArray(e))return e.map(u);if(i().isPlainObject(e)){let t=Object.entries(e).map(e=>{let[t,l]=e;return[t,u(l)]});return Object.fromEntries(i().sortBy(t,e=>{let[t]=e;return t}))}return e}function c(e){try{return JSON.stringify(u(e))}catch{try{return JSON.stringify(e)}catch{return String(e)}}}function p(e,t){let l,n,r=s,i=e.runId||"GLOBAL",o=c(t),a=r.inflightByRun.get(i);a||(a=new Map,r.inflightByRun.set(i,a));let u=a.get(o);if(u)return u;let p=new Promise((e,t)=>{l=e,n=t});a.set(o,p);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,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,d)),p}async function h(e,t){let l=async e=>{if("string"==typeof e&&/\{\{.*?\}\}/.test(e))return await g(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 m(e,t){let l=await f(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 f(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 g(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 m(e,t):l}return await m(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})},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){let t=new Set,l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g;for(;null!==(e=i.exec(r));)t.add(e[1]);let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]/g;for(;null!==(n=o.exec(r));)t.add(n[2])}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}function r(e){let t={},l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([^\s)]*)/g;for(;null!==(e=i.exec(r));){let l=e[1],n=e[2]||"";if(t[l]=t[l]||[],n.startsWith("."))t[l].push(n.slice(1));else if(n.startsWith("[")){let e=n.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(e){let n=e[2],r=e[3]||"";t[l].push(`${n}${r}`)}else{let e=n.match(/^\[(\d+)\](.*)$/);if(e){let n=e[1],r=e[2]||"";t[l].push(`[${n}]${r}`)}}}else n.startsWith("(")&&!t[l].length&&t[l].push("")}let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]([^\s)]*)/g;for(;null!==(n=o.exec(r));){let e=n[2],l=n[3]||"";if(t[e]=t[e]||[],l.startsWith("."))t[e].push(l.slice(1));else if(l.startsWith("[")){let n=l.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(n){let l=n[2],r=n[3]||"";t[e].push(`${l}${r}`)}else{let n=l.match(/^\[(\d+)\](.*)$/);if(n){let l=n[1],r=n[2]||"";t[e].push(`[${l}]${r}`)}}}else l.startsWith("(")&&!t[e].length&&t[e].push("")}}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}l.d(t,{xI:()=>m,vP:()=>y,$S:()=>f,pc:()=>g,Cg:()=>c,nN:()=>b,ju:()=>x,Xx:()=>h,vE:()=>p,XU:()=>u,UX:()=>v});var i=l(22928),o=l(35846),a=l(44476),s=l(2543),d=l.n(s);function u(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 c(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 p(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,u=i[o];if(null!=s&&null!=u&&s===u)return d().cloneDeep(i)}function h(e,t){return l=>{var n,r,i,o;if(!("record"===l||l.startsWith("record.")))return!1;let s=t();if(!s)return!0;if("record"===l)return!1;let d=c(e),u=null==d?void 0:d.collection,p=(null==d?void 0:d.dataSourceKey)||"main";if(!u)return!0;let h=null==(r=e.dataSourceManager)||null==(n=r.getDataSource)?void 0:n.call(r,p),m=null==h||null==(o=h.collectionManager)||null==(i=o.getCollection)?void 0:i.call(o,u);if(!m)return!0;let f=(0,a.H)(()=>m,()=>s),g=l.startsWith("record.")?l.slice(7):"";return!!g&&f(g)}}function m(e,t){let l=(0,a.H)(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 f(e,t,l){let n=await (0,o.H)(e,t,!0)();return n?{...n,buildVariablesParams:e=>l?l(e):u(e)}:null}function g(e,t,l){let n=async()=>f(e,t,l);return n.title=t,n}function v(e,t,l){var n,r;return g(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=>u(e))}let y=n,b=r;async function x(e,t){let l=Object.keys(r(t)||{});if(!l.length)return;let n={};for(let t of l){var o;let l,r=null==(o=e.getPropertyOptions)?void 0:o.call(e,t),i=null==r?void 0:r.meta;if(i){try{let t="function"==typeof i?await i():i,n=null==t?void 0:t.buildVariablesParams;"function"==typeof n&&(l=await n(e))}catch(e){continue}l&&(n[t]=l)}}return(0,i.d)(e,n)}},67778(e,t,l){l.d(t,{sp:()=>P,bt:()=>T,U:()=>el,N5:()=>K,xB:()=>B,mW:()=>$,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){return null!=e}function c(e,t){if(e===t)return!0;if(!u(e)||!u(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch(l){return String(e)===String(t)}}function p(e){var t;let l=null==e||null==(t=e.navigation)?void 0:t.viewStack;return Array.isArray(l)?l:[]}function h(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p(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(u(n[t])){if(!c(null==e?void 0:e[t],n[t])){r=!1;break}l+=1}r&&l>=d&&(s=t,d=l)}return s}function m(e,t){return t??e.view}function f(e){var t;if(!e)return!1;let l=p(e),n=null==e||null==(t=e.inputArgs)?void 0:t.openerUids,r=Array.isArray(n)&&n.length>0;return h(e,l)>=1||r}function g(e,t){let l=t=>e.t(t),n=function(){let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return f(m(l,t))},r=async e=>{let l=m(e,t);if(!l||!f(l))return;let n=await v(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=m(s,t),u=p(d),c=h(d,u);if(c<1||l<1)return;let f=c-l;if(f<1)return;let g=u[f];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=m(e,t),r=p(n);return h(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},u=()=>({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),u=m(e,t),c=null==u?void 0:u.inputArgs,f={};if(d){let e={...d};!e.associationName&&(null==c?void 0:c.associationName)&&(e.associationName=c.associationName),void 0===e.sourceId&&void 0!==(null==c?void 0:c.sourceId)&&(e.sourceId=null==c?void 0:c.sourceId),f.record=e}try{let t=p(u);if(h(u,t)>=2){let t=f,l=1,n=await o(l,e);for(;n;)t.parent||(t.parent={}),t.parent.record=n,t=t.parent,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=null==c?void 0:c.sourceId,t=null==c?void 0:c.associationName,l=(null==c?void 0:c.dataSourceKey)||"main";if(null!=e&&""!==e&&t&&"string"==typeof t){let n=String(t).split(".")[0];n&&(f.sourceRecord={collection:n,dataSourceKey:l,filterByTk:e})}}catch(t){null==(s=e.logger)||null==(a=s.debug)||a.call(s,{err:t},"[FlowEngine] buildVariablesParams: infer sourceRecord failed")}return f},properties:async()=>{var n,a,u,c;let f={};if(f.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,f.record=e}try{let r=m(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=p(r),l=h(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&&(f.sourceRecord=r)}}}catch(t){null==(c=e.logger)||null==(u=c.debug)||u.call(c,{err:t},"[FlowEngine] popup.properties: build sourceRecord failed")}return f.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)&&(f.parent=s(1)),f}});return u.title=l("Current popup"),u.sort=975,u}async function v(e,t){var l;let n=p(t),r=h(t,n),i=null==t||null==(l=t.inputArgs)?void 0:l.openerUids,o=Array.isArray(i)&&i.length>0;if(!(r>=1||o))return;if(!n.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}}}let a=async t=>{var l,r,i,o,s,d;if(t<0||!(null==(l=n[t])?void 0:l.viewUid))return;let u=n[t].viewUid,c=null==(r=e.engine)?void 0:r.getModel(u,!0);c||(c=await (null==(d=e.engine)?void 0:d.loadModel({uid:u})));let p=(null==c||null==(i=c.getStepParams)?void 0:i.call(c,"popupSettings","openView"))||{},h=null==p?void 0:p.collectionName,m={uid:u,resource:{dataSourceKey:(null==p?void 0:p.dataSourceKey)||"main",collectionName:h,associationName:null==p?void 0:p.associationName,filterByTk:null==(o=n[t])?void 0:o.filterByTk,sourceId:null==(s=n[t])?void 0:s.sourceId}},f=await a(t-1);return f&&(m.parent=f),m};return await a(r)}function y(e,t){let l=/^(?:record|sourceRecord)(?:\.|$)|^parent(?:\.parent)*(?:\.(?:record|sourceRecord))(?:\.|$)/;e.defineProperty("popup",{get:async()=>v(e,t),meta:g(e,t),resolveOnServer:e=>{try{return!!e&&l.test(e)}catch(e){return!1}}})}var b=l(18182);let x=(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)(b.A,{closable:!1,rootClassName:a?"nb-hidden":"",getContainer:y,...v,open:d,onCancel:c.onCancel,afterClose:()=>{null==l||l()},children:c.children})});function w(){let[e,t]=r.useState([]);return[e,r.useCallback(e=>(t(t=>[...t,e]),()=>{t(t=>t.filter(t=>t!==e))}),[])]}var S=l(16639),A=l(20616),M=l(47451);async function F(e,t){var l;return!!t.force||!1!==await (null==(l=e.beforeClose)?void 0:l.call(e,t))}function k(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 C=0;function P(){let e=r.useRef(null),t=(t,l)=>{var u,c,p;let h,m,f=null==l?void 0:l.engine;C+=1;let g=r.createRef(),v=new Promise(e=>{m=e}),b=null,w=null,P=e=>{let{children:t}=e;return r.useEffect(()=>{var e;return b=t,null==(e=g.current)||e.setFooter(t),()=>{var e;b=null,null==(e=g.current)||e.setFooter(null)}},[t]),null},j=e=>(r.useEffect(()=>{var t;return w=e,null==(t=g.current)||t.setHeader(e),()=>{var e;w=null,null==(e=g.current)||e.setHeader(null)}},[e]),null),E=new a.cB,R=(0,M._)(l.engine),T=(0,S.eX)(f,R);E.defineProperty("engine",{value:R}),E.addDelegate(R.context),!1!==t.inheritContext?E.addDelegate(l):(E.addDelegate(l.engine.context),k(E,l));let I=!1,_={type:"dialog",inputArgs:t.inputArgs||{},preventClose:!!t.preventClose,beforeClose:void 0,destroy:e=>{var l,n,r,i;if(I)return;I=!0,null==(l=t.onClose)||l.call(t),null==(n=g.current)||n.destroy(),null==h||h(),null==m||m(e);let o=null==T?void 0:T.emitter;(0,S.Z8)(o),null==o||null==(i=o.emit)||i.call(o,S.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 F(_,{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:P,Header:j,setFooter:e=>{var t;b=e,null==(t=g.current)||t.setFooter(e)},setHeader:e=>{var t;w=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()}),y(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)(x,{className:"nb-dialog-overflow-hidden",ref:g,hidden:null==(a=t.inputArgs)||null==(o=a.hidden)?void 0:o.value,footer:b,header:w,...t,onCancel:()=>{_.close(t.result)},children:u}))},{displayName:"DialogWithContext"}),N=(null==t||null==(c=t.inputArgs)?void 0:c.viewUid)||`page-${C}`,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]=w();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 j=l(97134),E=l(61793);let R=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)(E.D,{className:d?"nb-hidden":"",visible:p,...c,footer:m,...g,onClose:c.onClose,children:i}):(0,n.jsx)(j.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,b=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 b=e,null==(t=f.current)||t.setHeader(e),()=>{var e;b=null,null==(e=f.current)||e.setHeader(null)}},[e]),null),C=new a.cB,P=(0,M._)(l.engine),j=(0,S.eX)(m,P);C.defineProperty("engine",{value:P}),C.addDelegate(P.context),!1!==t.inheritContext?C.addDelegate(l):(C.addDelegate(l.engine.context),k(C,l));let E=!1,T={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,S.Z8)(o),null==o||null==(i=o.emit)||i.call(o,S.B9,{type:"drawer",viewUid:null==T||null==(r=T.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 F(T,{result:e,force:l})&&(t.triggerByRouter&&(null==(r=t.inputArgs)||null==(n=r.navigation)?void 0:n.back)?t.inputArgs.navigation.back():T.destroy(e),!0)},Footer:x,Header:w,setFooter:e=>{var t;v=e,null==(t=f.current)||t.setFooter(e)},setHeader:e=>{var t;b=e,null==(t=f.current)||t.setHeader(e)},navigation:null==(u=t.inputArgs)?void 0:u.navigation,get record(){return(0,d.vE)(l,C)}};C.defineProperty("view",{get:()=>T,resolveOnServer:(0,d.Xx)(C,()=>(0,d.vE)(l,C))}),P.setDestroyView(()=>{var e,l;t.triggerByRouter&&(null==(l=t.inputArgs)||null==(e=l.navigation)?void 0:e.back)&&t.inputArgs.navigation.back(),T.destroy()}),y(C,T);let I=r.memo((0,o.observer)(e=>{var l,o,a,s;let d=r.useRef(!1),u="function"==typeof t.content?t.content(T,C):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,T,C)},[]),(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)(R,{ref:f,...t,footer:v,header:t.header||b,hidden:null==(s=t.inputArgs)||null==(a=s.hidden)?void 0:a.value,onClose:()=>{T.close(t.result)},isMobile:C.isMobileLayout,children:[c,e.children]}))}));I.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:C,children:(0,n.jsx)(I,{children:t})})})});return _.displayName="RenderDrawer",p=null==(c=e.current)?void 0:c.patchElement(_),Object.assign(g,T)},c=r.useMemo(()=>({open:u}),[]),p=r.memo(r.forwardRef((e,i)=>{let[o,a]=w();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 I=l(40961),_=l(31333),D=l(71021);let N=(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)(D.Ay,{type:"text",size:"small",icon:(0,n.jsx)(_.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}),O=0,$="nocobase-embed-container",B="nocobaseEmbedReplacing";function L(e){return!!e&&"function"==typeof e.then}function q(e,t){e.dataset[B]="1";try{let l=t.close();if(L(l))return Promise.resolve(l).finally(()=>{delete e.dataset[B]});return delete e.dataset[B],l}catch(t){throw delete e.dataset[B],t}}function V(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 z=r.memo(r.forwardRef((e,t)=>{let[l,i]=w();return r.useImperativeHandle(t,()=>({patchElement:i}),[i]),(0,n.jsx)(n.Fragment,{children:l})}));function K(){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,b=c instanceof HTMLElement&&c.id===$,x=()=>{var l,g,x;let w,C,P,j=null==u?void 0:u.engine;O+=1;let E=r.createRef(),R=new Promise(e=>{C=e}),T=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},_=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,$=(0,M._)(u.engine),L=(0,S.eX)(j,$);D.defineProperty("engine",{value:$}),D.addDelegate($.context),m?D.addDelegate(u):(D.addDelegate(u.engine.context),k(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==C||C(e),null==(n=E.current)||n.destroy(),null==w||w(),b&&t.current===V&&(t.current=null),!(b&&c instanceof HTMLElement&&(null==(r=c.dataset)?void 0:r[B])==="1")){let e=null==L?void 0:L.emitter;(0,S.Z8)(e),null==e||null==(a=e.emit)||a.call(e,S.B9,{type:"embed",viewUid:null==V||null==(o=V.inputArgs)?void 0:o.viewUid})}$.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 F(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:_,Footer:T,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))}),y(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)(N,{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-${O}`,U=(0,n.jsx)(A.I6,{engine:$,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(I.createPortal(U,c,K)):null==(x=e.current)?void 0:x.patchElement(U),b&&(t.current=V),Object.assign(R,V)};if(b&&t.current){let e,n=l.current+=1,r=()=>null==g?void 0:g();try{e=q(c,t.current)}catch(e){throw r(),e}if(L(e))return V(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(),V(Promise.resolve({page:null}),f,!!i.preventClose)}return x()};return[r.useMemo(()=>({open:i}),[]),(0,n.jsx)(z,{ref:e},"page-holder")]}var U=l(28073);let W=0,H=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)(U.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;W+=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)(H,{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-${W}`);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]=w();return r.useImperativeHandle(t,()=>({patchElement:i}),[]),(0,n.jsx)(n.Fragment,{children:l})}));return[l,(0,n.jsx)(o,{ref:e},"popover-holder")]}var Y=l(50467),J=l(52847),X=l(60182);function Q(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 Z(e){return null!=e&&""!==String(e)}function ee(e){let t=e||"/admin";return`/${t.replace(/^\/+/,"").replace(/\/+$/,"")}`}function et(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=ee(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,X.Gu)(e.viewUid,e.openViewRouteState);if(l&&n.push("opts",l),e.tabUid&&n.push("tab",e.tabUid),null!=e.filterByTk){let t=Q(e.filterByTk);t&&n.push("filterbytk",t)}Z(e.sourceId)&&n.push("sourceid",String(e.sourceId))}),"/"+n.join("/")}class el{setViewStack(e){this.viewStack=Object.freeze([...e]),this.viewParams=this.viewStack[this.viewStack.length-1]||{}}changeTo(e){let t=et(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=et([...this.viewStack,e],{basePath:this.getLayoutBasePath()});this.ctx.router.navigate(l,t)}back(){let e=et(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,Y._)(this,"viewStack",void 0),(0,Y._)(this,"ctx",void 0),(0,Y._)(this,"viewParams",void 0),(0,Y._)(this,"basePath",void 0),this.setViewStack(t),this.ctx=e,this.basePath=l.basePath||l.layoutBasePath,(0,J.E8)(this,{viewParams:J.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}},12039(e,t,l){l.d(t,{xW:()=>b,bO:()=>c,Q9:()=>y});var n=l(50467),r=l(88909),i=l(55373),o=l.n(i),a=l(4198);function s(e,t){var l,n;if("u"<typeof document)return;let r=(0,a.getAuthCookieName)("role",e),i=t?"":"; Max-Age=0",o=t?encodeURIComponent(t):"",s=(null==(l=globalThis.location)?void 0:l.protocol)==="https:"?"; Secure":"",d=(null==(n=window.__nocobase_public_path__)?void 0:n.replace(/\/+$/g,""))||"/";document.cookie=`${r}=${o}; Path=${d||"/"}; SameSite=Lax${s}${i}`}function d(e,t){var l;if("u"<typeof document)return;let n=`${(0,a.getAuthCookieName)(e,t)}=`;return null==(l=document.cookie.split(";").map(e=>e.trim()).find(e=>e.startsWith(n)))?void 0:l.slice(n.length)}let u=(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},c=(e,t)=>{let l=u(e,t);return null!=l&&""!==l},p=new Set(["get","head","options"]);class h{get storagePrefix(){return this.api.storagePrefix}getCookieAppName(){var e;return"function"!=typeof this.api.options&&(null==(e=this.api.options)?void 0:e.appName)||this.api.appName||"main"}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),s(this.getCookieAppName(),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){this.locale&&e.headers&&(e.headers["X-Locale"]=this.locale),this.role&&e.headers&&(e.headers["X-Role"]=this.role),this.authenticator&&!c(e.headers,"X-Authenticator")&&e.headers&&(e.headers["X-Authenticator"]=this.authenticator),this.token&&!c(e.headers,"Authorization")&&e.headers&&(e.headers.Authorization=`Bearer ${this.token}`);let t=(e.method||"get").toLowerCase(),l=d("csrfToken",this.getCookieAppName());return!p.has(t)&&l&&!c(e.headers,"X-CSRF-Token")&&e.headers&&(e.headers["X-CSRF-Token"]=l),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 syncCookies(){if(this.token)return await this.api.request({method:"post",url:"auth:syncCookies",skipNotify:!0})}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 m{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 f extends m{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 g extends m{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 v extends g{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 y{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 g(this.storagePrefix,this.baseStoragePrefix,this.shareToken):"sessionStorage"===e&&"u">typeof sessionStorage?new v(this.storagePrefix,this.baseStoragePrefix,this.shareToken):new f}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),(0,n._)(this,"appName",void 0),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.appName=t,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 h(this)),this.interceptors()}}let b=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]}},4198(e,t,l){l.r(t),l.d(t,{getDayRange:()=>tr,isEmptyFilter:()=>ed,sleep:()=>es,getDateVars:()=>td,str2moment:()=>ey,unflatten:()=>e6,sortTree:()=>ea,forEach:()=>eP,utc2unit:()=>to,extractUsedVariablePaths:()=>tT,getValuesByPath:()=>ej,isArray:()=>et,moment2str:()=>ew,transformLiquidContext:()=>t_,isURL:()=>tk,isPortalInBody:()=>tw,extractUsedVariableNames:()=>tR,parseHTML:()=>tS,toGmt:()=>em,isPlainObject:()=>en,lockdownSes:()=>ty,splitPathToTwoParts:()=>tu,transformFilter:()=>Y,parseSQLBindParams:()=>tO,getPickerFormat:()=>eF,nextTick:()=>ei,removeNullCondition:()=>eu,CollectionsGraph:()=>V,isValidFilter:()=>eD,evaluateConditions:()=>Z,toUnit:()=>ta,removeInvalidFilterItems:()=>J,getFormatFromDateStr:()=>eC,BASE_BLOCKED_IDENTIFIERS:()=>tf,toLocal:()=>ef,getDayRangeByParams:()=>L,getDefaultFormat:()=>eh,transformMultiColumnToSingleColumn:()=>tj,treeFind:()=>eo,transformSQL:()=>t$,parseFilter:()=>tn,flatten:()=>e3,isEmpty:()=>el,getOffsetRangeByParams:()=>N,offsetFromString:()=>eS,getAuthCookieName:()=>ep,error:()=>ez,tval:()=>tb,Registry:()=>tp,lodash:()=>r(),parse:()=>eB,hasEmptyValue:()=>er,toFixedByStep:()=>eQ,getDateTimeFormat:()=>ek,showToast:()=>eY,Handlebars:()=>eT(),getLiquidContext:()=>tD,merge:()=>eH,dayjs:()=>o(),parseLiquidContext:()=>tN,uid:()=>tF,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),A=l(41816),M=l.n(A),F=l(88569),k=l.n(F),C=l(83826),P=l.n(C),j=l(8134),E=l.n(j),R=l(28623),T=l.n(R),I=l(46986),_=l.n(I);o().extend(_()),o().extend(S()),o().extend(k()),o().extend(P()),o().extend(M()),o().extend(x()),o().extend(m()),o().extend(g()),o().extend(y()),o().extend(E()),o().extend(T()),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 G(e){let{logic:t,items:l}=e;return{[t]:l.map(e=>{if(U(e))return H(e);if(W(e))return G(e);throw Error("Invalid filter item type")})}}function Y(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(G(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={authToken:"nb_auth_token",authenticator:"nb_authenticator",role:"nb_role",csrfToken:"nb_csrf_token"};function ep(e,t){return`${ec[e]}_${t||"main"}`}let eh=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",em=e=>e&&o().isDayjs(e)?`${e.format("YYYY-MM-DD")}T${e.format("HH:mm:ss.SSS")}Z`:e,ef=e=>e?Array.isArray(e)?e.map(e=>e.startOf("second").toISOString()):o().isDayjs(e)?e.startOf("second").toISOString():void 0:e,eg=e=>{try{let t=parseInt(e.slice(0,4)),l=parseInt(e.slice(-1));return o()().quarter(l).year(t)}catch(e){return null}},ev=(e,t)=>{if(!e)return;let l=t.utcOffset,{gmt:n,picker:r,utc:i=!0,dateOnly:a}=t;if(!o()(e).isValid())return eg(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(eS(l)):e:n?o()(e).utcOffset(0):l?o()(e).utcOffset(eS(l)):o()(e):o()(e)},ey=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?e.map(e=>ev(e,t)):e?ev(e,t):e},eb=(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",ex=(e,t)=>e?Array.isArray(e)?e.map(e=>eb(e,t)):o().isDayjs(e)?eb(e,t):void 0:e,ew=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{showTime:l,gmt:n,picker:r}=t;return e?l?n?em(e):ef(e):ex(e,r):e};function eS(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]))+eA(o[2]);return 0===a?0:"+"===o[0]?a:-a}function eA(e){let t=+e,l=0;return 0!==t&&isFinite(t)&&(l=eM(t)),l}function eM(e){return e<0?Math.ceil(e)||0:Math.floor(e)}let eF=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"}},ek=(e,t,l,n)=>"date"===e&&l?`${t} ${n||"HH:mm:ss"}`:t;function eC(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 eP=(e,t)=>{Array.isArray(e)?e.forEach(t):Object.keys(e).forEach(l=>{t(e[l],l)})},ej=(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=ej(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 eE=l(88835),eR=l(60639),eT=l.n(eR),eI=l(79441);let e_=l.n(eI)()();function eD(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(eD);if(e.$and||e.$or)return eD(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 eN(e){let t=typeof e;return Array.isArray(e)?t="array":e instanceof Date?t="date":null===e&&(t="null"),t}function eO(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 e$(e,t){return e.parameters=Array.from(new Map(t.map(e=>[e.key,e])).values()),e}function eB(e){switch(eN(e)){case"string":return eL(e);case"object":return eq(e);case"array":return eV(e);default:return e$(function(){return e},[])}}Object.keys(e_).forEach(function(e){eT().registerHelper(e,e_[e])}),eT().registerHelper("json",function(e){return JSON.stringify(e)}),eT().registerHelper("urlParse",function(e){try{return JSON.stringify(eE.parse(e))}catch(t){return`Invalid URL: ${e}`}}),eT().registerHelper("dateFormat",(e,t,l)=>"string"==typeof l?o()(e).tz(l).format(t):o()(e).format(t)),eT().registerHelper("isNull",e=>r().isNull(e));let eL=(()=>{let e=/{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;return t=>{let l=[],r=e=>t,i=t.match(e);return i&&(l=i.map(eO),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))),e$(r,l)}})();function eq(e){let t=Object.keys(e).map(t=>({keyTemplate:eL(t),valueTemplate:eB(e[t])}));return e$(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 eV(e){let t=e.map(eB);return e$(e=>t.map(t=>t(e)),t.reduce((e,t)=>e.concat(t.parameters),[]))}let ez=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 eK=l(14744),eU=l.n(eK);let eW=(e,t,l)=>t;function eH(e,t,l){return eU()(e,t,{arrayMerge:eW,...l})}var eG=l(76511);let eY=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;eG.Ay[t]({message:e,duration:l})};var eJ=l(5062),eX=l(85738);function eQ(e,t){if(null==e||""===e)return"";let l=(0,eJ.i5)(t);return(0,eX.Mg)(String(e),".",l)}var eZ=l(63560),e0=l.n(eZ),e1=l(95093),e2=l.n(e1);let e5=/^\s*\{\{([\s\S]*)\}\}\s*$/;function e4(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function e8(e){return e}function e3(e,t){let l=(t=t||{}).delimiter||".",n=t.maxDepth,i=t.transformKey||e8,o=t.transformValue||e8,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=e4(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 e6(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l={},n=t.transformValue||e8;for(let t of Object.keys(e))e0()(l,t,n(e[t],t));return l}let e9=e=>{let t=e.split(".").pop()||"";return t.startsWith("$")||(t=""),{operator:t}},e7=e=>["$dateOn","$dateNotOn","$dateBefore","$dateAfter","$dateNotBefore","$dateNotAfter","$dateBetween"].includes(e);function te(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function tt(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 tl=(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:te(e)?e.toISOString():void 0:null,tn=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=e3(e,{breakOn(e){let{key:t}=e;return t.startsWith("$")&&"$and"!==t&&"$or"!==t},transformValue(e){if("string"!=typeof e)return e;let t=e5.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 e6(a,{transformValue(e,t){let{operator:l}=e9(t);if("string"==typeof e){let a=e5.exec(e);if(a){let s=ej(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(e7(l)){let l=null==o?void 0:o(t);return tt(l)?e.type?L({...e,timezone:(null==l?void 0:l.timezone)||r}):e:tl(e,(null==l?void 0:l.timezone)||r)}return e}})};function tr(e){let{now:t,timezone:l="+00:00",offset:n}=e,r=ti(t).utcOffset(eS(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 ti(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?o().isDayjs(e)?e:t?e2()(e):o()(e):t?e2()():o()()}function to(e){var t;let{now:l,unit:n,timezone:r="+00:00",offset:i}=e,o=ti(l,"isoWeek"===n);o=(o=o.utcOffset(eS(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 ta=(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),to({now:n,timezone:r,unit:e,offset:t})},ts=e=>t=>{let{now:l,timezone:n,field:r}=t;return(null==r?void 0:r.timezone)&&(n=null==r?void 0:r.timezone),tr({now:l,timezone:n,offset:e})};function td(){return{now:new Date().toISOString(),today:ta("day"),yesterday:ta("day",-1),tomorrow:ta("day",1),thisWeek:ta("week"),lastWeek:ta("week",-1),nextWeek:ta("week",1),thisIsoWeek:ta("isoWeek"),lastIsoWeek:ta("isoWeek",-1),nextIsoWeek:ta("isoWeek",1),thisMonth:ta("month"),lastMonth:ta("month",-1),nextMonth:ta("month",1),thisQuarter:ta("quarter"),lastQuarter:ta("quarter",-1),nextQuarter:ta("quarter",1),thisYear:ta("year"),lastYear:ta("year",-1),nextYear:ta("year",1),last7Days:ts(-7),next7Days:ts(7),last30Days:ts(-30),next30Days:ts(30),last90Days:ts(-90),next90Days:ts(90)}}function tu(e){let t=e.split(".");return[t.shift(),t.join(".")]}var tc=l(50467);class tp{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,tc._)(this,"map",new Map),(0,tc._)(this,"options",void 0),this.options=e}}l(67980);let th=Symbol.for("nocobase.utils.sesLockdown"),tm=Symbol.for("nocobase.utils.bufferOverrides"),tf=["globalThis","global","self","Function","AsyncFunction","GeneratorFunction","eval","Compartment","lockdown","harden","assert"];function tg(e){return!!e&&"object"==typeof e&&(e.message||"").includes("(SES_ALREADY_LOCKED_DOWN)")}function tv(){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 ty(e){tv();let t=globalThis;if(!t[th]){if("function"!=typeof lockdown)throw Error("SES lockdown is unavailable in the current runtime environment.");try{lockdown(e)}catch(e){if(!tg(e))throw e}t[th]=!0}}function tb(e,t){return t?`{{t(${JSON.stringify(e)}, ${JSON.stringify(t)})}}`:`{{t(${JSON.stringify(e)})}}`}var tx=l(65606);let tw=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!tx.env.__TEST__};function tS(e,t){return e.replace(/\{\{(\w+)\}\}/g,function(e,l){return void 0!==t[l]?t[l]:e})}let tA=36,tM="";for(;tA--;)tM+=tA.toString(36);function tF(e){let t="",l=e||11;for(;l--;)t+=tM[36*Math.random()|0];return t}function tk(e){let t;try{t=new URL(e)}catch(e){return!1}return"http:"===t.protocol||"https:"===t.protocol}var tC=l(27153),tP=JSON.parse('{"rE":"3.0.0-alpha.6"}');let tj=(e,t)=>{if(!e)return e;if("Grid"!==e["x-component"])return Object.keys(e.properties||{}).forEach(l=>{e.properties[l]=tj(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[`${tF()}_${l}`]=tE(s,l,++o))})}}),e.properties=n,l){let t=new tC.S(e,l);return l.properties&&Object.keys(l.properties).forEach(n=>{n===e.name&&(l.properties[n]=t)}),t}return e};function tE(e,t,l){return{type:"void",version:"2.0","x-component":"Grid.Row","x-app-version":tP.rE,"x-uid":tF(),"x-async":!1,"x-index":l,_isJSONSchemaObject:!0,properties:{[t]:e}}}function tR(e){let t=new Set,l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)/g;for(;null!==(e=i.exec(r));)t.add(e[1]);let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]/g;for(;null!==(n=o.exec(r));)t.add(n[2])}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}function tT(e){let t={},l=e=>{if("string"==typeof e){let l,n=/\{\{\s*([^}]+?)\s*\}\}/g;for(;null!==(l=n.exec(e));){let e,n,r=l[1],i=/ctx\.([a-zA-Z_$][a-zA-Z0-9_$]*)([^\s)]*)/g;for(;null!==(e=i.exec(r));){let l=e[1],n=e[2]||"";if(t[l]=t[l]||[],n.startsWith("."))t[l].push(n.slice(1));else if(n.startsWith("[")){let e=n.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(e){let n=e[2],r=e[3]||"";t[l].push(`${n}${r}`)}else{let e=n.match(/^\[(\d+)\](.*)$/);if(e){let n=e[1],r=e[2]||"";t[l].push(`[${n}]${r}`)}}}else n.startsWith("(")&&!t[l].length&&t[l].push("")}let o=/ctx\[\s*(["'])\s*([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\1\s*\]([^\s)]*)/g;for(;null!==(n=o.exec(r));){let e=n[2],l=n[3]||"";if(t[e]=t[e]||[],l.startsWith("."))t[e].push(l.slice(1));else if(l.startsWith("[")){let n=l.match(/^\[\s*(["'])\s*([^'"\]]+)\s*\1\s*\](.*)$/);if(n){let l=n[2],r=n[3]||"";t[e].push(`${l}${r}`)}else{let n=l.match(/^\[(\d+)\](.*)$/);if(n){let l=n[1],r=n[2]||"";t[e].push(`[${l}]${r}`)}}}else l.startsWith("(")&&!t[e].length&&t[e].push("")}}}else Array.isArray(e)?e.forEach(l):e&&"object"==typeof e&&Object.values(e).forEach(l)};return l(e),t}let tI=new(l(23155)).HX;function t_(){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 tD(e){return t_(await tI.fullVariables(e))}async function tN(e,t){return await tI.parseAndRender(e,{ctx:t})}function tO(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 t$(e){let{sql:t,bind:l}=tO(e),n=await tD(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-155a4c9b.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-97731b94.js";__webpack_require__.C(__rspack_chunk_8),__webpack_exec__(38835);