diff --git a/www/js/zui3/zui.zentao.js b/www/js/zui3/zui.zentao.js index f63d5be09b..dcd1fc08a0 100644 --- a/www/js/zui3/zui.zentao.js +++ b/www/js/zui3/zui.zentao.js @@ -9,4 +9,4 @@ var bu=(I,tt,It)=>{if(!tt.has(I))throw TypeError("Cannot "+It)};var Dt=(I,tt,It) `)}};wp.defaultProps={autoInit:!0};let ib=wp;y.registerLib("zeneditor",{src:"zen-editor/zen-editor.esm.js",type:"module"});let nr=class extends pe{render(e){const{avatar:t,account:n,realname:s,user:r,...o}=e,a={code:r?r.account:n,text:r?r.realname??r.account:s??n,src:r?r.avatar:t,...o};return b(Bi,{...a})}};nr.defaultProps={size:24,circle:!0};function Cp(i,e="yyyy年M月d日 hh:mm",t="M月d日 hh:mm"){const n=je(i);return Ds(n,new Date)?rt(n,t):rt(n,e)}const sb=i=>{const e=[];for(const t of i)e.includes(t.account)||e.push(t.account);return e},rb=i=>i.length<=3?i:[i[0],"more",i[i.length-1]];function xp(i){const{createDate:e,app:t,editors:n,creator:s}=i,r=t.getUserInfo(s),o=n&&sb(n).map(l=>t.getUserInfo(l)),a=o&&rb(o);return b("div",{className:"doc-users-bar flex flex-nowrap gap-2"},b("div",{className:"flex flex-nowrap gap-1"},b("div",{title:e?t.getLang("createdByUserAt",[{name:r.realname,time:Cp(e)}],"由 {name} 创建于 {time}"):r.realname},b(nr,{size:"xs",user:r})),b("span",null,r.realname),b("span",null,t.getLang("created"))),a!=null&&a.length?b("div",{className:"flex flex-nowrap gap-1"},b("div",{className:"avatar-group",title:o==null?void 0:o.map(l=>l.realname).join("、")},a.map(l=>typeof l=="string"?b(nr,{size:"xs",className:"rotate-90",icon:"ellipsis-v"}):b(nr,{size:"xs",user:l}))),b("span",null,t.getLang("edited"))):null)}function ca(){return b("span",{className:"inline-block w-px h-3 bg-gray-400"})}const ob=()=>document.documentElement.lang.includes("zh"),kp=i=>{const e=je(i);if(ob())return Cp(e,"yyyy年MM月dd日","MM月dd日");const[,t,n,s]=e.toDateString().split(" "),r=new Date().getFullYear();return e.getFullYear()===r?`${t} ${n} `:`${t} ${n} ${s} `};function ab(i){const{doc:e,app:t}=i;return e.status?b("div",{className:"doc-editor-info flex text-gray gap-2 items-center py-2.5"},b(xp,{app:t,createDate:e.addedDate,editors:e.editors,creator:e.addedBy}),b(ca,null),b("span",null,e.status==="draft"?t.getLang("draft"):t.getLang("released")),b(ca,null),b("span",{className:"hint","data-hint":je(e.addedDate).toLocaleString()},kp(e.addedDate),t.getLang("created")),e.editedDate?b("span",{className:"hint","data-hint":je(e.editedDate).toLocaleString()},kp(e.editedDate),t.getLang("edited")):null,b(ca,null),b("div",{key:"views",className:"text-sm hint flex items-center gap-1","data-hint":t.getLang("viewsCount","阅读次数")},b(Ie,{icon:"eye"}),e.views||0),e.api?null:b("div",{key:"star",className:`text-sm hint cursor-pointer ${e.isCollector?"text-warning":"text-gray"} flex items-center gap-1`,"data-hint":t.getLang(e.isCollector?"cancelCollection":"collect"),"zui-command":`collectDoc/${e.id}`},b(ke,{size:"xs",type:"ghost",icon:e.isCollector?"star":"star-empty",text:e.collects||0}))):b("div",{className:"doc-editor-info flex text-gray gap-2 items-center py-2.5"},b(xp,{app:t,createDate:e.addedDate,editors:e.editors,creator:e.addedBy}),b(ca,null),b("span",null,t.getLang("notSaved")))}class lb extends pe{constructor(e){super(e),this._editor=de(),this._titleEle=de(),this._isLoadingLib=Qe(!1),this._convertedToNewDoc=Qe(0),this._gid=ss(),this._saveTimer=0,this._dataTime=0,this._cacheDataTime=0,this._handleChange=t=>{const n=t.content;n!==this._data.content&&(this._data.content=n,this._data.contentType=t.contentType,this._data.html=t.html,this._dataTime=Date.now(),this._callChange()),this.trySaveCache()},this._handleKeywordsChange=t=>{const s=t.target.value.split(/,|,/).map(r=>r.trim()).filter(Boolean).join(", ");s!==this._data.keywords&&(this._data.keywords=s,this._callChange())},this._handleTitleChange=t=>{var s;const n=t.target.value;if(n!==this._data.title){this._data.title=n;const{editor:r}=this;r instanceof ls&&((s=r.$)==null||s.updateTitle(n)),this._callChange()}},this._handleConvertDoc=()=>{const{app:t,doc:n}=this.props;We.confirm({title:t.getLang("convertToNewDoc","转换文档"),content:t.getLang("convertToNewDocConfirm","确定要将此文档转换为新文档格式吗?")}).then(s=>{s&&(this._convertedToNewDoc.value=n.id)})},this._switchToOldDoc=async()=>{const t=this.props.doc.$html;t&&this.triggerChange({content:t,contentType:"html",html:t}),await ai(100),this._convertedToNewDoc.value=0},this._handleLoadingLibChange=t=>{this._isLoadingLib.value=t},this._data={title:e.doc.title,content:e.doc.content??""},this._convertedToNewDoc.value=e.doc.$convert?e.doc.id:0}get gid(){return this._gid}get editor(){return this._editor.current}get cacheID(){return`doc-${this.props.mode==="edit"?this.props.doc.id:"new"}-${this._gid}`}async getData(){const e=this._editor.current;return e instanceof ls?{...await e.getData(),contentType:"doc"}:e==null?void 0:e.getData()}focusTitle(){var e;(e=this._titleEle.current)==null||e.focus()}setTitle(e){this._data.title=e;const t=this._titleEle.current;t&&(t.value=e,this.triggerChange())}async triggerChange(e){var n;const t=await this.getData();!t||!e||((n=this._handleChange)==null||n.call(this,{...t,...e}),this.saveCache())}saveCache(){this._cacheDataTime!==this._dataTime&&(y.db.setCacheData(this.cacheID,this._data,0,"docAppCache"),this._cacheDataTime=this._dataTime)}trySaveCache(){this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=window.setTimeout(()=>{this.saveCache(),this._saveTimer=0},1e3)}removeCache(){y.db.deleteCacheData(this.cacheID,"docAppCache")}_callChange(){var t,n;const{doc:e}=this.props;(n=(t=this.props).onChange)==null||n.call(t,{id:e.id,...this._data})}_renderTitle(e){const{doc:{title:t,deleted:n},mode:s,app:r}=e;return s==="view"?n?b("div",{class:"flex gap-2 items-center"},b("h1",{key:"title",class:"doc-editor-title",style:"font-size: 40px"},t),b("span",{class:"label danger"},r.getLang("deleted","已删除"))):b("h1",{key:"title",class:"doc-editor-title",style:"font-size: 40px"},t):b("input",{key:"title",ref:this._titleEle,type:"text",class:"doc-editor-title w-full font-bold",style:"font-size: 40px",defaultValue:t,onChange:this._handleTitleChange,placeholder:r.getLang("docTitlePlaceholder","请输入文档标题")})}_renderInfo(e){return b(ab,{...e})}_renderKeywords(e){const{doc:{keywords:t},mode:n,app:s}=e,r=(t==null?void 0:t.split(/,|,/).map(a=>a.trim()).filter(Boolean))??[];if(n==="view")return b("div",{key:"kw",title:s.getLang("keywords","关键字"),class:`doc-editor-keywords row gap-2 px-1 my-2${r.length?"":" hidden"}`},r.map(a=>b("span",{className:"label label-sm secondary-outline"},a.trim())));const o=`doc-app-kw-${this._gid}`;return b("div",{key:"kw",className:"input-control has-prefix-icon my-2 doc-editor-keywords"},b("input",{key:"kw",type:"text",id:o,class:"form-control ring-0 shadow-none",defaultValue:r.join(", "),onChange:this._handleKeywordsChange,placeholder:s.getLang("keywordsPlaceholder","关键字,使用逗号分隔")}),b("label",{for:o,class:"input-control-prefix"},b("i",{className:"icon icon-tag"})))}componentDidMount(){this.props.mode==="edit"&&this.focusTitle()}render(e){const{className:t,doc:n,belowTitle:s,mode:r,uploadUrl:o,downloadUrl:a,app:l}=e,c=n.contentType==="doc"?"doc":n.contentType==="markdown"?"markdown":"html",d=c==="doc"&&!n.$convert,u=c==="markdown",p=r==="view",g=this._convertedToNewDoc.value,_=r==="edit",C=_&&(n.contentType==="html"||n.contentType==="attachment"||n.$convert),x=!(n.content??"").trim().length,k=x&&r==="view",$=_&&C&&g===n.id,E=u||d||$||x,z=E?ls:ib,H=n.content===void 0||n.content===null,Y=this._isLoadingLib.value,G=H||Y;return b("div",{class:V("doc-editor load-indicator col",t,G?"loading":"",p?"is-readonly":"is-editing",k?"is-empty":"flex-auto"),"data-loading":H?l.getLang("loadingDocTip","正在加载文档内容..."):l.getLang("loadingEditorTip","正在加载编辑器...")},this._renderTitle(e),this._renderInfo(e),this._renderKeywords(e),$&&E&&_?b("div",{className:"center mb-3"},b("div",{class:"row gap-2 items-center primary-pale pl-2 rounded-full"},b("p",{className:"text-gray"},l.getLang("oldDocEditingTip","此文档为旧版本编辑器创建,已启用新版编辑器编辑,保存后将转换为新版文档")),b(ke,{text:l.getLang("switchToOldEditor","切换回旧编辑器"),size:"sm",type:"ghost",rounded:"full",className:"underline",onClick:this._switchToOldDoc}))):null,s,!G&&!k&&b(z,{ref:this._editor,key:`editor-${n.id}-${r}-${n.currentVersion||n.version}`,className:"doc-editor-control flex-auto",mode:d?"full":"page",autoInit:!0,readonly:p,uploadUrl:o,downloadUrl:a,uid:n.uid??`doc${n.id}`,content:n.content??"",title:n.title,contentType:c,placeholder:o?l.getLang("pasteImageTip","可以在编辑器直接贴图。"):"",onChange:this._handleChange,onLoadingLibChange:this._handleLoadingLibChange},C&&!$?b("div",{className:"absolute right-0 top-1"},b(ke,{type:"primary-pale",size:"md",onClick:this._handleConvertDoc},l.getLang("convertToNewDoc","转换为新文档格式"))):null))}}let rh=class extends He{get actions(){return this.state.actions||this.props.actions||[]}getDefaultState(e){e=e||this.props;let{preserve:t,defaultReversed:n}=e;return t===!0&&(t=""),n===void 0&&typeof t=="string"&&(this._preserveID=`HistoryPanel.reversed${t.length?`:${t}`:""}`,n=Ye.get(this._preserveID)),{actions:e.actions,expandMap:{},reversed:n}}resetState(e,t){const n=this.getDefaultState(e);t?this.state=n:this.changeState(n)}componentDidMount(){y.on(`load.HistoryPanel.${this.gid}.zt`,(e,{objectType:t,objectID:n})=>{t===this.props.objectType&&String(n)===String(this.props.objectID)&&this.load()}),this.state.actions||this.load()}componentWillUnmount(){y.off(`.HistoryPanel.${this.gid}.zt`)}componentDidUpdate(){(!this.state.actions||this._currentLoadID!==[this.props.objectType,this.props.objectID].join())&&!this.state.loading&&this.load()}async load(){const{objectType:e,objectID:t,fetcher:n=Rt("action","ajaxGetList",`objectType=${e}&objectID=${t}`)}=this.props,s=[e,t].join();if(this.state.loading)return;await this.changeState({loading:!0});const o={actions:await mt(n,[{objectType:e,objectID:t}])||[],loading:!1},a=[this.props.objectType,this.props.objectID].join();a!==s?delete o.actions:this._currentLoadID=a,await this.changeState(o)}reverse(e){return e===void 0&&(e=!this.state.reversed),this.changeState({reversed:e},()=>{typeof this._preserveID=="string"&&Ye.set(this._preserveID,e)})}toggle(e,t){return this.changeState(n=>{const{expandMap:s}=n;return t===void 0&&(t=!s[e]),{expandMap:{...s,[e]:t}}})}isAllExpanded(){const{expandMap:e}=this.state;return this.actions.every(t=>{const{history:n,historyChanges:s}=t;return!(n&&n.length||typeof s=="string"&&s.length)||e[t.id]})}toggleAll(e){return e===void 0&&(e=!this.isAllExpanded()),this.changeState({expandMap:e?this.actions.reduce((t,n)=>({...t,[n.id]:e}),{}):{}})}_getClassName(e){return[super._getClassName(e),"history-panel",e.panel?"panel":""]}_getChildren(e){const t=this._buildHeader(e),n=this._buildBody(e);return e.panel?[t?b("div",{key:"heading",className:"panel-heading"},t):null,b("div",{key:"body",className:"panel-body"},n)]:[t,n]}_buildAction(e,t,n,s){const{history:r,historyChanges:o}=e,a=r&&r.length||typeof o=="string"&&o.length,l=typeof e.comment=="string"&&e.comment.length,c=`${t+1}`,d={component:"li",key:String(e.id),"data-id":e.id,"data-action":e.action,className:["history-panel-action list-item item",a?n?"is-expanded":"is-collapsed":""],innerClass:"item-inner list-item-inner",avatar:{className:"text-gray ring canvas",background:"",size:16,circle:!0,...e.action==="finished"?{icon:{icon:"check",className:"text-success"}}:{children:b("span",{style:c.length>1?{transform:`scale(${1-c.length*.1})`}:void 0},c)}},title:{html:e.content},text:a?b(ke,{icon:n?"minus":"plus",type:"ghost",size:"xs",className:"history-panel-action-toggle ring text-gray scale-75",onClick:this.toggle.bind(this,e.id,void 0)}):null,children:a&&n||l?b("div",{className:"history-panel-action-content pl-6 col gap-1 mb-1"},a&&n?typeof o=="string"&&o.length?b("div",{key:"history",className:"history-panel-action-history pl-1",dangerouslySetInnerHTML:{__html:o}}):b("ul",{key:"history",className:"history-panel-action-history col pl-1"},r.map(u=>b("li",{key:u.id,className:"history-panel-history-item",dangerouslySetInnerHTML:{__html:u.content}}))):null,e.comment?b("div",{key:"comment",className:"article-content history-panel-action-comment px-3 py-2 surface relative"},e.commentEditable?b(ke,{key:"btn",type:"ghost",icon:"pencil",size:"sm",className:"comment-btn hover:text-primary absolute top-1 right-1","data-toggle":"comment","data-action-ID":e.id,url:s.editCommentUrl?s.editCommentUrl.replace("{actionID}",String(e.id)):void 0}):null,b("div",{key:"comment",dangerouslySetInnerHTML:{__html:e.comment}})):null):null};return b(tn,{...d})}_buildBody(e){const{actions:t}=this,{loading:n,expandMap:s,reversed:r}=this.state;return b("ul",{key:"actions",className:V("list history-panel-body load-indicator",{loading:n},r?"col-reverse":"col",e.bodyClass)},t.map((o,a)=>this._buildAction(o,a,s[o.id],e)))}_buildHeader(e){let{header:t}=e;if(!t)return null;const{title:n="History",toolbar:s=!0,commentBtn:r=!0}=e,o=[];if(s){const{reversed:a}=this.state,l=this.isAllExpanded(),{actions:c}=this,d={key:"toolbar",className:"history-panel-toolbar",gap:1,items:[c.length>1?{icon:a?"arrow-down":"arrow-up",type:"ghost",size:"xs",className:"ring text-gray scale-75",onClick:this.reverse.bind(this,void 0)}:null,c.some(u=>{const{history:p,historyChanges:g}=u;return p&&p.length||typeof g=="string"&&g.length})?{icon:l?"minus":"plus",type:"ghost",size:"xs",className:"ring text-gray scale-75",onClick:this.toggleAll.bind(this,void 0)}:null].filter(Boolean)};typeof s=="object"&&Object.assign(d,s),d.items&&(!Array.isArray(d.items)||d.items.length)&&o.push(b(Oe,{...d}))}if(r){const a={key:"commentBtn",type:"ghost",className:"comment-btn text-gray",size:"sm",url:e.commentUrl,icon:{icon:"message",className:"icon-sm text-primary"},"data-toggle":"comment","data-object-ID":e.objectID,"data-object-type":e.objectType};typeof r=="object"?Object.assign(a,r):typeof r=="string"&&(a.text=r),o.push(b(ke,{...a}))}return t={key:"header",className:"history-panel-header",title:n,titleClass:"font-bold mr-1",content:o,contentClass:"flex items-center flex-auto gap-2",...typeof t=="object"?t:{}},b(tn,{...t})}};rh.defaultProps={header:!0,panel:!0,preserve:!0};class ir extends pe{constructor(){super(...arguments),this._ref=de(),this._timer=0,this._editorSelector="page-editor,affine-page-root,zen-editor,.doc-editor-content",this.state={},this._getItem=e=>{var t;return e.innerClass=(t=e.text)!=null&&t.length?"":"hidden",e},this._handleClickItem=e=>{this.scrollIntoDoc(e.item)}}update(){var l,c;const e=this.props.container||((l=this._ref.current)==null?void 0:l.closest(".doc-view"));if(!e)return;this._container!==e&&(this._container&&y(this._container).off(".doc-outline"),this._container=e,y(e).on("docChange.doc-outline",()=>{this.tryUpdate()}));const n=y(e).find(this._editorSelector)[0];if(!n)return;const s=n.tagName.toLowerCase(),r=s==="zen-editor"?"zen":s==="page-editor"||s==="affine-page-root"?"blocksuite":"html";this._editorType=r;const o=r==="blocksuite"?ir.getBlocksuiteHeadings(n):ir.getEditorHeadings(n),a=ir.formHeadings(o);this._lastDocID=(c=this.props.doc)==null?void 0:c.id,this.setState({items:a})}tryUpdate(){var e;this._timer&&clearTimeout(this._timer),this._lastDocID!==((e=this.props.doc)==null?void 0:e.id)&&this.setState({items:void 0}),this._timer=window.setTimeout(()=>{this.update(),this._timer=0},1e3)}scrollIntoDoc(e){var s,r,o,a;const t=this._container;if(!t)return;const n=y(t).find(this._editorSelector)[0];if(n)if(this._editorType==="blocksuite")(s=n.querySelector(`affine-paragraph[data-block-id="${e.id}"]`))==null||s.scrollIntoView({behavior:"smooth",block:"start"});else{const c=(((a=(o=(r=n.shadowRoot)==null?void 0:r.querySelector("zen-editor-core"))==null?void 0:o.shadowRoot)==null?void 0:a.querySelector("zen-editor-content"))||n).querySelectorAll("h1,h2,h3,h4,h5,h6");if(!c)return;const{text:d,level:u}=e;let p=e.index!==void 0?c[e.index]:void 0;(!p||p.textContent!==d||p.tagName!==`H${u}`)&&(p=Array.from(c).find(g=>g.textContent===d&&g.tagName===`H${u}`)),p&&p.scrollIntoView({behavior:"smooth",block:"start"})}}componentDidMount(){this.tryUpdate()}componentDidUpdate(e){this.props.doc!==e.doc&&this.tryUpdate()}componentWillUnmount(){this._container&&y(this._container).off(".doc-outline"),this._timer&&clearTimeout(this._timer)}render(e,t){const{items:n}=t;return b("div",{className:"doc-outline",ref:this._ref},n?n.length?b(xt,{items:n,defaultNestedShow:!0,getItem:this._getItem,nestedToggle:".tree-toggle",onClickItem:this._handleClickItem}):b("div",{className:"text-gray p-2"},e.app.getLang("noOutline","没有大纲")):b("div",{className:"text-gray p-1"},e.app.getLang("loading","加载中...")))}static formHeadings(e){let t,n=e.reduce((s,r)=>{r.text=r.text.trim();const{level:o}=r;if(!r.text.length&&(o===1||t&&t.level===o))return s;if(o>1){t||(t={level:1,text:"",id:""},s.push(t));let a;if(t.level===o-1)a=t;else if(t.level>=o){for(;t.level>=o;)t.parent&&(t=t.parent);a=t}else{for(;t.level{var a;const o=((a=s.querySelector("v-text"))==null?void 0:a.textContent)??"";t.push({id:s.closest("affine-paragraph").dataset.blockId??`${r}_${o}`,text:o,level:r})};return e.querySelectorAll(".affine-paragraph-rich-text-wrapper").forEach(s=>{const r=s.classList;let o=0;r.contains("h1")?o=1:r.contains("h2")?o=2:r.contains("h3")?o=3:r.contains("h4")?o=4:r.contains("h5")?o=5:r.contains("h6")&&(o=6),o&&n(s,o)}),t}static getEditorHeadings(e){var s,r,o;const t=[],n=((o=(r=(s=e.shadowRoot)==null?void 0:s.querySelector("zen-editor-core"))==null?void 0:r.shadowRoot)==null?void 0:o.querySelector("zen-editor-content"))||e;return n&&n.querySelectorAll("h1,h2,h3,h4,h5,h6").forEach(a=>{const l=a.textContent||"",c=a.id,d=parseInt(a.tagName[1]);l.length&&d<7&&t.push({index:t.length,level:d,text:l,id:c})}),t}}class cb extends pe{constructor(e){super(e),this._ref=de(),this.handleHistoryClick=()=>{this._status.value==="history"?this._status.value=!1:this._status.value="history"},this.handleOutlineClick=()=>{this._status.value==="outline"?this._status.value=!1:this._status.value="outline"},this._handleNavClick=n=>{var o;const r=(o=n.target.closest("[z-type]"))==null?void 0:o.getAttribute("z-type");r&&(this._status.value=this._status.value===r?!1:r)};const{defaultStatus:t="info"}=e;this._status=e.status||Qe(t),this.close=this.close.bind(this)}componentDidMount(){y(document).on("click",".doc-app-toolbar .history-btn",this.handleHistoryClick),y(document).on("click",".doc-app-toolbar .outline-btn",this.handleOutlineClick)}componentWillUnmount(){y(document).off("click",".doc-app-toolbar .history-btn",this.handleHistoryClick),y(document).off("click",".doc-app-toolbar .outline-btn",this.handleOutlineClick)}close(){this._status.value=!1}_renderContent(e,t,n){var o;if(!e||!n)return null;const{doc:s,app:r}=t;if(n.render)return b(me,{content:n.render(s)});if(e==="info"){const{creator:a,modifier:l}=t,c=[{label:r.getLang("docStatus","状态"),content:s.status==="draft"?b("div",{key:"status",className:"label special-pale size-sm rounded-full ml-1"},r.getLang("draft","草稿")):r.getLang("released","已发布")},{label:r.getLang("creator","创建者"),content:a.realname},{label:r.getLang("createDate","创建时间"),content:rt(s.addedDate)},{label:r.getLang("modifier","修改者"),content:l==null?void 0:l.realname},s.editedDate?{label:r.getLang("editDate","修改时间"),content:rt(s.editedDate)}:null,{label:r.getLang("viewsCount","阅读次数"),content:s.views},{label:r.getLang("collectCount","收藏次数"),content:[s.collects,s.isCollector?b("span",{className:"label side-sm rounded-full warning-pale"},r.getLang("collected","已收藏")):null]}].filter(Boolean);return b("div",{className:"col gap-2"},b("div",{className:"font-bold px-1"},r.getLang("docInfo","文档信息")),b(Gf,{items:c}))}if(e==="outline")return b("div",{className:"col gap-2"},b("div",{className:"font-bold px-1"},n.title??r.getLang("docOutline","文档大纲")),b(ir,{app:r,container:(o=this._ref.current)==null?void 0:o.closest(".doc-view"),doc:s}));if(e==="history")return gp(s.rawID)?null:b("div",{style:"margin-top: -6px"},b(rh,{panel:!1,title:n.title??r.getLang("history","历史记录"),objectType:s.api?"api":"doc",objectID:s.rawID,fetcher:t.historyFetcher}))}_renderNav(e,t,n){const{app:s}=t;return b("menu",{key:"nav",className:"doc-view-sidebar-nav nav nav-stacked gap-1 p-1 flex-none rounded-lg",onClick:this._handleNavClick},n.map(({icon:r,title:o,key:a})=>["history","outline"].includes(a)?null:b("li",{className:V({hidden:a==="relateObject"},"nav-item item hint-left"),"data-hint":o,key:a},b("a",{className:`rounded-lg${e===a?" active":""}`,"z-type":a},b(Ie,{icon:r})))),n.filter(Boolean).length&&e?b("li",{key:"divider",class:"nav-divider divider"}):null,e?b("li",{class:"nav-item item hint-left","data-hint":s.getLang("collapse","收起")},b("a",{className:"rounded-lg",onClick:this.close},b(Ie,{icon:"icon-menu-arrow-right"}))):null)}render(e){var c;const{className:t,app:n,doc:s}=e;let r=this._status.value;const o=gp(+s.id);r&&o&&(r="outline");const a=((c=n.props.getDocViewSidebarTabs)==null?void 0:c.call(n,s,{isNewDoc:o,mode:n.mode}))||[{icon:"list-box",title:n.getLang("docOutline","文档大纲"),key:"outline"}],l=a==null?void 0:a.find(d=>d.key===r);return l||(r=""),b("div",{className:V("doc-view-sidebar flex-none z-50 sticky top-3 right-1 self-start",t,`is-${r?"opened":"closed"}`,`is-${r}`),ref:this._ref},b("div",{className:"doc-view-sidebar-container border shadow rounded-lg row items-stretch mb-3"},b("div",{key:"content",className:"doc-view-sidebar-content p-2 border-r flex-auto overflow-y-auto scrollbar-hover"},this._renderContent(r,e,l)),this._renderNav(r,e,a)))}}class hb extends pe{constructor(e){super(e),this._editorRef=de(),this._ref=de(),this._currentDocID=Qe(""),this._modeChangeEffect=en(()=>{this.props.app.mode!=="view"&&(this._currentDocID.value="")}),this._docChangeEffect=en(()=>{const{docID:s,docVersion:r}=this.props.app.signals,o=[s,r].join();o!==this._currentDocID.value&&(this._currentDocID.value=o,this.tryLoadDoc())}),this._handleChange=s=>{const{doc:r,mode:o="view",onChange:a}=this.props;a==null||a(s,o,r),y(this.element).trigger("docChange",[s,o,r])};const{preserve:t}=e,n=t?`${t}-expanded`:null;this._status=Qe(n?Ye.get(n,!1):!1),n&&this._status.subscribe(s=>{Ye.set(n,s)})}get editor(){return this._editorRef.current}get element(){return this._ref.current}tryLoadDoc(){const e=this._currentDocID.value;if(e){const[t,n]=e.split(",").map(as);this.props.app.loadDoc(t,n)}}componentWillUnmount(){this._modeChangeEffect(),this._docChangeEffect()}_renderEditor(e){const{doc:t,mode:n="view",uploadUrl:s,downloadUrl:r,app:o}=e,a=o.renderCustom("editor");return a!==void 0?a:b(lb,{app:o,ref:this._editorRef,mode:n,doc:t,uploadUrl:s?be(s,{objectID:n==="create"?0:t.id,objectType:"doc",api:t.contentType==="doc"?"true":"",extra:t.contentType==="doc"?"editor":""}):void 0,downloadUrl:r?be(r,{id:t.id,objectID:0,objectType:"doc"}):void 0,onChange:this._handleChange})}render(e){var g;const{doc:t,fileActions:n,fileIcon:s,fileUrl:r,creator:o,modifier:a,onGetUser:l,historyFetcher:c,highlight:d,app:u}=e,p=this._status.value;return b("div",{className:V("doc-view absolute inset-0 overflow-auto scrollbar-hover canvas z-10 row",`is-sidebar-${p?"opened":"closed"}`,d?"highlight":""),ref:this._ref},b("div",{class:"doc-view-content mx-auto col gap-4 flex-auto"},this._renderEditor(e),(g=t.files)!=null&&g.length?b(oa,{className:"doc-files my-4 px-3 py-2 surface rounded-lg",heading:{icon:"paper-clip",title:u.getLang("attachment","附件")},items:t.files,fileActions:n,fileIcon:s,fileUrl:r,itemProps:{target:"_blank"},hoverItemActions:!0}):null),b(cb,{app:u,doc:t,creator:o,modifier:a,status:this._status,historyFetcher:c,onGetUser:l}))}}function Sp(i,e){const{page:t,recPerPage:n}={page:1,recTotal:i.length,pageTotal:Math.ceil(i.length/20),recPerPage:20,...e},s=(t-1)*n,r=t*n;return i.slice(s,r)}class ub extends pe{constructor(e){var n;super(e),this._libsMap=Qe({}),this._filterType=Qe(),this._loading=Qe(!1),this._currentFilterType=Be(()=>{const{app:s}=this.props,r=this._filterType.value,o=s.spaceType;return r||(o==="product"||o==="project"?"mine":"all")}),this._spaceList=Be(()=>{const{app:s}=this.props;let r=s.signals.spaces.value;const o=this._currentFilterType.value,a=s.spaceType,l=s.props.isMatchFilter;return o&&l&&(r=r.filter(c=>l.call(s,a,o,c))),r.sort((c,d)=>c.order-d.order)}),this._pagedSpaceList=Be(()=>{const s=this._spaceList.value;return Sp(s,this.props.app.signals.pager.value)}),this._autoLoadLibs=en(()=>{const s=this._spaceList.value;this.loadLibs(s.map(r=>r.id))}),this._handleFilterTypeClick=s=>{const o=s.target.getAttribute("data-type");o&&(this._filterType.value=o)},this._handleLibClick=s=>{const r=y(s.target);if(r.closest(".toolbar").length)return;const o=r.closest("[z-lib]").z("lib"),a=r.closest("[z-space]").z("space");!o||!a||this.props.app.selectSpace(a,+o)},this._handleChangePager=s=>{this.props.app.resetPager("home",{...s})};const t=e.app.getFilterTypes("home")||[];this._filterType.value=(n=t[0])==null?void 0:n[0]}get app(){return this.props.app}async loadLibs(e){e=e||this._spaceList.value.map(r=>r.id);const{libSummariesFetcher:t}=this.app.props;if(!t)return;const n=typeof t=="object"&&(t.method||"").toLowerCase()==="post"?{data:JSON.stringify(e.join(",")),processData:!1}:void 0;this._loading.value=!0;const s=await mt(t,[{spaceList:e,spaceType:this.app.spaceType}],n);Ms(()=>{this._libsMap.value={...this._libsMap.value,...e.reduce((r,o)=>(r[o]=[],r),{}),...s},this._loading.value=!1})}_getToolbarActions(e){return e.app.getActions("home",{ui:"toolbar"})}_renderHeader(e){const{app:t}=e,s=this._spaceList.value.length,r=t.getFilterTypes("home")||[],o=this._currentFilterType.value;return b("div",{key:"header",class:"doc-app-header flex-none surface-light row items-center border-b py-2 pl-1 pr-2 flex-none"},b("menu",{className:"nav nav-compact ml-2",style:"--nav-active-bg: var(--color-primary-100); --nav-active-color: var(--color-fore); --nav-item-height: 24px; --nav-divider-margin: 8px",onClick:this._handleFilterTypeClick},r.map(([a,l])=>b("li",{key:a,className:"nav-item item"},b("a",{className:a===o?"active rounded":"rounded","data-type":a},l,a===o&&s?b("span",{className:"label size-sm canvas ring-0 rounded-md"},s):null)))),b("div",{className:"flex-auto"}),b(Oe,{className:"doc-app-toolbar",gap:2,size:"md",items:this._getToolbarActions(e)}))}_getSpaceLibs(e){const{app:t}=this.props,s=this._libsMap.value[e];if(s)return s;const r=[],o=t.signals.docs.value,a=t.signals.libs.value,{maxHomeLibsOfSpace:l=5}=t.props,c=new Map;for(const d of o){const u=d.lib,p=c.get(u)||0;c.set(u,p+1)}for(let d=0;d=l))break}return r}_renderSpace(e,t){var c;const{app:n}=t,s=n.getItemActions("space",e,"space-card"),r=[{text:n.getLang("enterSpace","进入空间"),textClass:"text-primary",command:`selectSpace/${e.id}/true`},...s];let o=this._getSpaceLibs(e.id);const a=n.props.libColors;let l;return o?o.length?(o.length>5&&(o=o.slice(0,5)),l=b("div",{class:"row flex-wrap"},o.map(d=>{const u=n.getItemActions("lib",d,"space-card");return b("div",{className:"doc-space-card-lib p-1.5 w-1/5 group"},b("div",{class:"canvas border rounded py-2 px-3 col gap-1 hover:shadow-lg hover:border-primary relative cursor-pointer",onClick:this._handleLibClick,"z-lib":d.id,"z-space":e.id},b(Ie,{icon:"doclib text-2xl",style:a?{color:a[d.id%a.length]}:null}),b("div",{class:"font-bold text-clip",title:d.name},d.name),b("div",{class:"text-gray text-sm"},d.docs?n.getLang("docsTotalInfo",[d.docs],"共 {0} 个文档"):n.getLang("noDocs","没有文档")),u!=null&&u.length?Oe.render({items:u},[],{size:"sm",type:"ghost",className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100"}):null))}))):l=b("div",{className:"center gap-4 py-3"},b("div",{className:"text-gray"},n.getLang("noLibs","没有文档库")),(c=n.props.privs)!=null&&c.createLib?b(ke,{type:"primary-pale",icon:"plus",command:`createLib/${e.id}`},n.getLang("createLib","创建文档库")):null):l=b("div",{className:"relative load-indicator loading center gap-4 h-4 py-3"}),b("div",{class:"doc-space-card ring rounded surface-light",key:e.id},b("header",{class:"row items-center justify-between gap-2 px-2.5 py-1 border-b"},b("div",{class:"row items-center gap-2 flex-none cursor-pointer hover:text-primary","zui-command":`selectSpace/${e.id}/true`},b(Ie,{icon:"docspace",className:"w-4 h-4 center rounded-md text-gray-600 flex-none"}),b("div",{className:"min-w-0 flex-auto"},b("strong",null,e.name))),b(Oe,{size:"md",items:r})),b("div",{class:"doc-space-card-libs p-1.5",style:"min-height: 118px"},l))}_renderBody(e){const t=this._pagedSpaceList.value;return b("div",{key:"body",class:"doc-app-body flex-auto min-h-0 col gap-4 p-4 items-stretch overflow-auto scrollbar-hover"},t.map(n=>this._renderSpace(n,e)),t.length===0?b("div",{className:"center text-gray h-full"},e.app.getLang("noDataYet","暂无数据")):null)}_renderFooter(e){const t=e.app.getPagerOptions({className:"flex-none",...e.app.signals.pager.value,recTotal:this._spaceList.value.length,onChangePageInfo:this._handleChangePager},{type:"home"});return b("div",{key:"footer",class:"doc-app-footer surface-light row items-center border-t py-1.5 px-2"},b("div",{class:"flex-auto"}),b(Qs,{...t}))}componentDidMount(){this.props.app.resetPager("home",{recTotal:this._spaceList.value.length})}componentWillUnmount(){this._autoLoadLibs()}render(e){return this._loading.value?b("div",{key:"loading",class:"doc-loading relative center h-full load-indicator loading tex-gray","data-loading":e.app.getLang("loadingDocsData","正在加载文档数据...")}):[this._renderHeader(e),this._renderBody(e),this._renderFooter(e)]}}const db=i=>{var t,n;i=JSON.parse(JSON.stringify(i));const e=new Map;for(const s of i){const r=String(s.id);e.has(r)?s.items&&((n=(t=e.get(r))==null?void 0:t.items)==null||n.push(...s.items)):e.set(r,s)}return Array.from(e.values())};class fb extends pe{constructor(e){super(e),this._libsMap=Qe({}),this._filterType=Qe(),this._programData=Qe(),this._hasDocsOnly=Qe(!1),this._showClosed=Qe(!1),this._otherPrograms=Be(()=>{var n;if(!this._programData.value)return[];const t=[];if(t.push(...this._programData.value.data.other),this._showClosed.value){const s=this._programData.value.data.closed;for(const r of s){const o={...r,items:(n=r.items)==null?void 0:n.filter(a=>!a.isPO&&!a.involved)};t.push(o)}}return t}),this._myPrograms=Be(()=>{var n;if(!this._programData.value)return[];const t=[];if(t.push(...this._programData.value.data.my),this._showClosed.value){const s=this._programData.value.data.closed;for(const r of s){const o={...r,items:(n=r.items)==null?void 0:n.filter(a=>a.isPO||a.involved)};t.push(o)}}return t}),this._currentFilterType=Be(()=>{const t=this._filterType.value;return t||"mine"}),this._programList=Be(()=>{const n=this._currentFilterType.value==="mine"?this._myPrograms.value:this._otherPrograms.value;return db(n)}),this._pagedProgramList=Be(()=>{const t=this._programList.value;return Sp(t,this.app.signals.pager.value)}),this._spaceList=Be(()=>{const{app:t}=this.props;let n=t.signals.spaces.value;const s=this._currentFilterType.value,r=t.spaceType,o=t.props.isMatchFilter;return s&&o&&(n=n.filter(a=>o.call(t,r,s,a))),n.sort((a,l)=>a.order-l.order)}),this._autoLoadLibs=en(()=>{const t=this._spaceList.value;this.loadLibs(t.map(n=>n.id))}),this._handleFilterTypeClick=t=>{const s=t.target.getAttribute("data-type");s&&(this._filterType.value=s)},this._handleSpaceClick=t=>{const n=y(t.target);if(n.closest(".toolbar").length)return;const s=n.closest("[z-space]").z("space");s!=null&&this.props.app.selectSpace(s,!0)},this._handleChangePager=t=>{this.props.app.resetPager("home",{...t})},this._filterType.value="mine"}get app(){return this.props.app}async loadLibs(e){e=e||this._spaceList.value.map(r=>r.id);const{libSummariesFetcher:t}=this.app.props;if(!t)return;const n=typeof t=="object"&&(t.method||"").toLowerCase()==="post"?{data:JSON.stringify(e.join(",")),processData:!1}:void 0,s=await mt(t,[{spaceList:e,spaceType:this.app.spaceType}],n);this._libsMap.value={...this._libsMap.value,...e.reduce((r,o)=>(r[o]=[],r),{}),...s}}_getToolbarActions(e){return e.app.getActions("home",{ui:"toolbar"})}_renderHeader(e){const{app:t}=e,n=this._programList.value.length,s=t.spaceType==="product"?[["mine",t.getLang("productMine")],["other",t.getLang("productOther")]]:[["mine",t.getLang("projectMine")],["other",t.getLang("projectOther")]],r=this._currentFilterType.value;return b("div",{key:"header",class:"doc-app-header flex-none surface-light row gap-2 items-center border-b py-2 pl-1 pr-2 flex-none"},b("menu",{className:"nav nav-compact ml-2",style:"--nav-active-bg: var(--color-primary-100); --nav-active-color: var(--color-fore); --nav-item-height: 24px; --nav-divider-margin: 8px",onClick:this._handleFilterTypeClick},s.map(([o,a])=>b("li",{key:o,className:"nav-item item"},b("a",{className:o===r?"active rounded":"rounded","data-type":o},a,o===r&&n?b("span",{className:"label size-sm canvas ring-0 rounded-md"},n):null)))),b(Hi,{id:"show-no-doc",name:"show-no-doc",defaultChecked:this._hasDocsOnly.value,label:t.getLang(t.spaceType==="product"?"showHasDocsOnlyProduct":"showHasDocsOnlyProject"),onChange:(o,a)=>{typeof a=="boolean"&&(this._hasDocsOnly.value=a)}}),b(Hi,{id:"show-closed",name:"show-closed",defaultChecked:this._showClosed.value,label:t.getLang(t.spaceType==="product"?"showClosedProduct":"showClosedProject"),onChange:(o,a)=>{typeof a=="boolean"&&(this._showClosed.value=a)}}),b("div",{className:"flex-auto"}),b(Oe,{className:"doc-app-toolbar",gap:2,size:"md",items:this._getToolbarActions(e)}))}_getSpaceLibs(e){const{app:t}=this.props,s=this._libsMap.value[e];if(s)return s;const r=[],o=t.signals.docs.value,a=t.signals.libs.value,{maxHomeLibsOfSpace:l=5}=t.props,c=new Map;for(const d of o){const u=d.lib,p=c.get(u)||0;c.set(u,p+1)}for(let d=0;d=l))break}return r}_getSpaceDocSum(e){var t;return((t=this._getSpaceLibs(e))==null?void 0:t.map(n=>n.docs).reduce((n,s)=>n+s,0))||0}_renderProgram(e,t){var a;const{app:n}=t,s=this._hasDocsOnly.value?(a=e.items)==null?void 0:a.filter(l=>this._getSpaceDocSum(Number(l.id))>0):e.items,r=n.props.libColors;let o;return e?s!=null&&s.length?o=b("div",{class:"row flex-wrap"},s.map(l=>{const c=this._getSpaceDocSum(l.id);return b("div",{className:"doc-space-card-lib p-1.5 w-1/5 group",key:l.id},b("div",{class:"canvas border rounded py-2 px-3 col gap-1 hover:shadow-lg hover:border-primary relative cursor-pointer",onClick:this._handleSpaceClick,"z-space":l.id},b(Ie,{icon:"doclib text-2xl",style:r?{color:r[Number(l.id)%r.length]}:null}),b("div",{class:"font-bold text-clip",title:l.text},l.text),b("div",{class:"text-gray text-sm"},c?n.getLang("docsTotalInfo",[c],"共 {0} 个文档"):n.getLang("noDocs","没有文档"))))})):o=b("div",{className:"center gap-4 py-3"},b("div",{className:"text-gray"},n.getLang(n.spaceType==="product"?"noProducts":"noProjects"))):o=b("div",{className:"relative load-indicator loading center gap-4 h-4 py-3"}),b("div",{class:"doc-space-card ring rounded surface-light",key:e.id},b("header",{class:"row items-center justify-between gap-2 px-2.5 py-1 border-b"},b("div",{class:"row items-center gap-2 flex-none cursor-pointer hover:text-primary","zui-command":`selectSpace/${e.id}/true`},b(Ie,{icon:"docspace",className:"w-4 h-4 center rounded-md text-gray-600 flex-none"}),b("div",{className:"min-w-0 flex-auto"},b("strong",null,e.text)))),b("div",{class:"doc-space-card-libs p-1.5",style:"min-height: 118px"},o))}_renderBody(e){const t=this._pagedProgramList.value;return b("div",{key:"body",class:"doc-app-body flex-auto min-h-0 col gap-4 p-4 items-stretch overflow-auto scrollbar-hover"},t.map(n=>this._renderProgram(n,e)),t.length===0?b("div",{className:"center text-gray h-full"},e.app.getLang("noDataYet","暂无数据")):null)}_renderFooter(e){const t=e.app.getPagerOptions({className:"flex-none",...e.app.signals.pager.value,recTotal:this._programList.value.length,onChangePageInfo:this._handleChangePager},{type:"home"});return b("div",{key:"footer",class:"doc-app-footer surface-light row items-center border-t py-1.5 px-2"},b("div",{class:"flex-auto"}),b(Qs,{...t}))}componentDidMount(){var t,n;this.props.app.resetPager("home",{recTotal:this._programList.value.length,recPerPage:5});const e=(n=(t=this.props.app.props).getSpaceFetcher)==null?void 0:n.call(t,this.props.app.spaceType);e&&mt(e).then(s=>void(this._programData.value=s))}componentWillUnmount(){this._autoLoadLibs()}render(e){return[this._renderHeader(e),this._renderBody(e),this._renderFooter(e)]}}class pb extends pe{constructor(){super(...arguments),this._dtable=de(),this._handleCellClick=(e,t)=>{var s;const n=(s=t.rowInfo)==null?void 0:s.data;this.props.app.selectDoc(n)}}_getCols(){return[{name:"title",onRenderCell:function(e,t){const n=t.row.data;return[{className:`api-list-item row items-center my-0.5 mx-1 gap-2 flex-auto is-${n.method} cursor-pointer rounded`,html:[`
${n.method}
`,`
${n.path}
`,`
${n.originTitle}
`].join("")}]}}]}_getTableOptions(e){var d;const{app:t,docs:n}=e,s=t.lib,r=s==null?void 0:s.data.orderBy;let o="",a="";typeof r=="string"&&r&&([o,a]=r.split("_"));const l=n.map(u=>u.data);["order","id"].includes(o)&&a&&(a==="asc"?l.sort((u,p)=>u.order-p.order):l.sort((u,p)=>p.order-u.order));const c={width:"100%",height(u){var g;const p=(g=this.element)==null?void 0:g.parentElement;return p?Math.min(u,p.clientHeight):u},cols:this._getCols(),data:l,header:!1,checkable:!1,footer:["flex","pager"],localPager:!0,emptyTip:b("div",{className:"center gap-4"},b("div",{className:"text-gray"},t.getLang("noApi","没有 API")),Oe.render({items:t.getActions("doc-list",{ui:"doc-list-empty"})},[])),footPager:{items:t.getPagerItems()},onCellClick:this._handleCellClick};return((d=t.getTableOptions)==null?void 0:d.call(t,c,{type:"api-list"}))??c}render(e){return b("div",{class:V("doc-list doc-api-list h-full col",e.className)},b(rs,{ref:this._dtable,...this._getTableOptions(e)}))}}const dx="";let oh=class extends Vl{constructor(e){super(e),this._loadingDocs=new Map,this._viewRef=de(),this._homeRef=de(),this._treeMap=Be(()=>{const{spaceID:t,libs:n,modules:s,docs:r}=this.signals;return U_(t.value,{libs:n.value,modules:s.value,docs:r.value},!!this.props.noSpace)}),this._space=Be(()=>{const{spaces:t,spaceID:n}=this.signals,s=n.value;return t.value.find(r=>r.id===s)}),this._spaceList=Be(()=>{const{spaces:t,spaceType:n}=this.signals,s=n.value;return t.value.filter(r=>!r.deleted&&r.type===s)}),this._libList=Be(()=>this._treeMap.value.libList),this._docList=Be(()=>{const{lib:t,module:n}=this;return t||n?this._filterDocs(pp(t||n,[],!0),{api:(t==null?void 0:t.data.type)==="api"}):this._filterDocs(void 0,{api:!1})}),this._doc=Be(()=>this._treeMap.value.docs.get(this.signals.docID.value)),this._viewingDoc=Be(()=>{const t=this._doc.value,n=this.signals.docVersion.value;return!t||!n||n===t.data.version||!t.data.versions?t:{...t,data:{...t.data,...t.data.versions[n]||{content:null},currentVersion:n}}}),this._module=Be(()=>{var n;const t=((n=this._doc.value)==null?void 0:n.data.module)||this.signals.moduleID.value;return this._treeMap.value.modules.get(t)}),this._lib=Be(()=>{var n;const t=((n=this._module.value)==null?void 0:n.data.lib)||this.signals.libID.value;return this._treeMap.value.libs.get(t)}),this._viewType=Be(()=>this._viewInfo.value[0]),this._viewInfo=Be(()=>{var o;const t=this.signals.mode.value;let n;const s=this.signals.creatingDoc.value,r=this.signals.editingDoc.value;if(t==="create")n=s;else if(t==="edit"){const a=this.getDoc(r==null?void 0:r.id);n=r,a&&n&&(n={...n,collects:a.collects,isCollector:a.isCollector,views:a.views})}else t==="view"&&(n=((o=this._viewingDoc.value)==null?void 0:o.data)||this._getLocalDoc(this.signals.docID.value));return[t,n]}),this._docUsers=Be(()=>{const t=this._doc.value;if(!t)return[];const{addedBy:n,editedBy:s}=t.data;return[this.getUserInfo(n),s?this.getUserInfo(s):void 0]}),this._hasEditingDoc=Be(()=>{const[t,n]=this._viewInfo.value;return n&&(t==="edit"||t==="create")}),this._canShowLibFiles=Be(()=>{const t=this.signals.spaceType.value;let{showLibFiles:n}=this.props;return typeof n=="function"?n=n.call(this,t):Array.isArray(n)&&(n=n.includes(t)),n}),this._location=Be(()=>{var p;const{spaceType:t,spaceID:n,libID:s,moduleID:r,docID:o,pager:a,searchKeys:l,docVersion:c,mode:d,params:u}=this.signals;return{mode:d.value,spaceType:t.value,spaceID:n.value,libID:s.value,moduleID:r.value,docID:o.value,docVersion:c.value,search:(p=l.value)==null?void 0:p.join(" "),filterType:this.filterType,pager:a.value,noSpace:this.props.noSpace,orderBy:"",params:u.value}}),this._filterType=Be(()=>this.signals.filterType.value[this.signals.mode.value]??"all"),this._viewEffect=en(()=>{var l,c,d,u;const{libID:t,moduleID:n,docID:s}=this.signals,r=s.value?"doc":n.value?"module":t.value?"lib":"space",o=s.value?(l=this._doc.value)==null?void 0:l.data:n.value?(c=this._module.value)==null?void 0:c.data:t.value?(d=this._lib.value)==null?void 0:d.data:this._space.value,a=this.signals.mode.value;(u=this.props.onSwitchView)==null||u.call(this,a,this._location.value,{type:r,title:o?r==="doc"?o.title:o.name:"",data:o})}),this._handleDocChange=(t,n)=>{if(n==="create"){const s=this.signals.creatingDoc.value;s&&(s.title!==t.title||s.content!==t.content||s.keywords!==t.keywords)&&(this.signals.creatingDoc.value={...s,...t,changed:!0,contentType:t.contentType||s.contentType})}else if(n==="edit"){const s=this.signals.editingDoc.value;s&&(s.title!==t.title||s.content!==t.content||s.keywords!==t.keywords)&&(this.signals.editingDoc.value={...s,...t,changed:!0,contentType:t.contentType||s.contentType})}},this._getFileActions=t=>{var n;return this.getActions("file",{ui:"doc-view",data:t,doc:(n=this.doc)==null?void 0:n.data})},this._handleSearch=t=>{this.signals.searchKeys.value=at.getSearchKeys(t)},this._handleFilterTypeClick=t=>{const n=t.target,s=n.getAttribute("data-type");if(s){const r=n.getAttribute("data-view");this.setFilterType(s,r)}},this.selectSpace=this.selectSpace.bind(this),this.selectDoc=this.selectDoc.bind(this),this.selectLib=this.selectLib.bind(this),this.selectModule=this.selectModule.bind(this),this.getUserInfo=this.getUserInfo.bind(this),this.selectDocVersion=this.selectDocVersion.bind(this),this.showFiles=this.showFiles.bind(this),this.getActions=this.getActions.bind(this),this.getItemActions=this.getItemActions.bind(this),this.executeCommand=this.executeCommand.bind(this),this.getTableOptions=this.getTableOptions.bind(this)}get spaceType(){return this.signals.spaceType.value}get spaceID(){return this.signals.spaceID.value}get libID(){return this.signals.libID.value}get moduleID(){return this.signals.moduleID.value}get docID(){return this.signals.docID.value}get docVersion(){return this.signals.docVersion.value}get space(){return this._space.value}get lib(){return this._lib.value}get module(){return this._module.value}get doc(){return this._doc.value}get treeMap(){return this._treeMap.value}get docList(){return this._docList.value}get docUsers(){return this._docUsers.value}get viewInfo(){return this._viewInfo.value}get libList(){return this._libList.value}get spaceList(){return this._spaceList.value}get mode(){return this.signals.mode.value}get canShowLibFiles(){return this._canShowLibFiles.value}get hasEditingDoc(){return this._hasEditingDoc.value}get location(){return this._location.value}get filterType(){return this._filterType.value}get editor(){var e,t;return(t=(e=this._viewRef.current)==null?void 0:e.editor)==null?void 0:t.editor}get fullscreen(){return this.signals.fullscreen.value}_filterDocs(e,t){if(e=e||this.signals.docs.value,e.length){const n=t==null?void 0:t.api,s=this.signals.searchKeys.value||[],r=this.filterType,o="key"in e[0],{currentUser:a,isMatchFilter:l,noSpace:c}=this.props,d=l?l.bind(this,"doc",r):_=>r==="createdByMe"?_.addedBy===a:r==="editedByMe"?_.editedBy===a:r==="draft"?_.status==="draft":r==="collected"?_.isCollector:!0;if(o&&!s.length)return r!=="all"&&r?e.filter(_=>d(_.data)):e;const u=this.signals.spaceID.value,p=this._treeMap.value,g=["id","title","keywords","addedBy","editedBy",_=>this.getUserInfo(_.addedBy).realname,_=>{const C=_.editedBy;return C?this.getUserInfo(C).realname:void 0}];return e.reduce((_,C)=>{const x=o?C.data:C;if(x.deleted||n!==void 0&&!!x.api!==n||r&&!d(x)||s.length&&!at.isItemMatch(x,s,g))return _;const k=p.libs.get(x.lib);return(c||x.lib===u||k&&k.data.space===u)&&_.push(o?C:p.docs.get(x.id)),_},[])}return[]}_getLocalDoc(e){if(e)return{id:e,rawID:fp(e),contentType:"doc",content:"",title:"",addedBy:"",lib:this.libID,module:this.moduleID,addedDate:rt(new Date),order:0,local:!0}}loadHomeLibs(){var e;(e=this._homeRef.current)==null||e.loadLibs()}toggleFullscreen(){y.toggleFullscreen({target:document.body,afterEnter:()=>{this.signals.fullscreen.value=!0,y("body").addClass("has-doc-app-fullscreen")},afterExit:()=>{y("body").removeClass("has-doc-app-fullscreen"),this.signals.fullscreen.value=!1}})}getDefaultState(e){e=e||this.props;const{data:t,fetcher:n,mode:s="home",filterType:r="all",pager:o,search:a,docVersion:l=0,defaultState:c,params:d}=e,u=this.formatData({libTypes:e.libTypes||[],...t},e);return{loading:!!(!t&&n),editingDoc:void 0,creatingDoc:void 0,searchKeys:at.getSearchKeys(a),fullscreen:!1,filterType:{[s]:r},docVersion:l,mode:s,highlightView:!1,pager:o,params:d,...c,...u}}resetState(e){super.resetState(e),requestAnimationFrame(()=>this._afterReset())}getDataSignal(e){const{signals:t}=this;return e==="doc"?t.docs:e==="module"?t.modules:e==="lib"?t.libs:t.spaces}getCurrentItem(e){var t,n,s;return e==="doc"?(t=this._doc.value)==null?void 0:t.data:e==="module"?(n=this._module.value)==null?void 0:n.data:e==="lib"?(s=this._lib.value)==null?void 0:s.data:this._space.value}getSpace(e){return e?this.signals.spaces.value.find(t=>t.id===e):this._space.value}getLib(e){return e?this.treeMap.libs.get(e):this._lib.value}getDoc(e){var t,n;return e=e||((t=this._doc.value)==null?void 0:t.data),typeof e!="object"&&(e=e?(n=this._treeMap.value.docs.get(e))==null?void 0:n.data:void 0),e}getUserInfo(e){const{userMap:t={}}=this.props,n=t[e];return n?typeof n=="string"?{account:e,realname:n}:{...n,account:e}:{account:e,realname:e}}async switchView(e,t){if(!await this.checkEditingDoc())return;t=t||this.mode;const{spaceType:n,spaceID:s,libID:r,moduleID:o,docID:a,params:l,filterType:c,pager:d}=e,{fetchOnChangeSpace:u,fetcher:p}=this.props,g=n&&this.signals.spaceType.value!==n||s!==void 0&&this.signals.spaceID.value!==s,_=u&&p&&g,C={...n?{spaceType:n}:null,...s!==void 0?{spaceID:s}:null,...r!==void 0?{libID:r}:null,...o!==void 0?{moduleID:o}:null,...a!==void 0?{docID:a}:null,...l!==void 0?{params:l}:null,...c!==void 0?{filterType:{...this.signals.filterType.value,[t]:c}}:null,...d!==void 0?{pager:{...this.signals.pager.value,...d}}:null,mode:t};return this.changeState(C,async()=>{_&&await this.load(p,this.signals.spaceType.value,s),a&&t==="edit"?this.startEditDoc(a):t==="create"?this.startCreateDoc():t==="files"?this.showFiles():t==="home"&&this.goHome()})}setFilterType(e,t){this.signals.filterType.value={...this.signals.filterType.value,[t||this.mode]:e}}exportDoc(e="pdf",t){var s;const n=this.editor;if(n instanceof ls)return(s=n.$)==null?void 0:s.export(e,t)}importDoc(e,t,n){var r,o,a;const s=this.editor;s instanceof ls&&((r=s.$)==null||r.updateDoc(e,t!=="markdown"?"snapshot":t,n),n!==void 0&&((a=(o=this._viewRef.current)==null?void 0:o.editor)==null||a.setTitle(n)))}getLang(e,t=[],n){const{langData:s}=this.props;let r;if(typeof t=="string"?(n=t,r=[]):r=Array.isArray(t)?t:[t],!s)return n??(Array.isArray(e)?e.join("."):e);const o=Array.isArray(e)?Cs(s,e):s[e]??n;return typeof o=="function"?o.call(this,...r):typeof o=="string"&&r.length?be(o,...r):o}getActions(e,t){const{getActions:n}=this.props,s=n?n.call(this,e,t):[];return s!=null&&s.length&&t.ui?s.filter(r=>r&&(!r.ui||r.ui.split(",").includes(t.ui))):s||[]}getFilterTypes(e){const{getFilterTypes:t}=this.props;return t?t.call(this,e)||[]:[["all","All"]]}getTableOptions(e,t){const{getTableOptions:n}=this.props;return n?n.call(this,e,t):e}getPagerItems(){return[{type:"info",text:this.getLang("recTotalFormat","共 {recTotal} 项")},{type:"size-menu",text:this.getLang("recPerPageFormat","每页 {recPerPage} 项"),placement:"top",caret:"up"},{type:"link",page:"first",hint:this.getLang("firstPage","第一页"),icon:"icon-first-page"},{type:"link",page:"prev",hint:this.getLang("prevPage","上一页"),icon:"icon-angle-left"},{type:"info",text:"{page}/{pageTotal}"},{type:"link",page:"next",hint:this.getLang("nextPage","icon-angle-right"),icon:"icon-angle-right"},{type:"link",page:"last",hint:this.getLang("lastPage","最后一页"),icon:"icon-last-page"}]}getPagerOptions(e,t){const{getPagerOptions:n}=this.props,s=n?n.call(this,e,t):e;return s.items||(s.items=this.getPagerItems()),s}getSortableOptions(e){const{getSortableOptions:t}=this.props;return t==null?void 0:t.call(this,e)}getItemActions(e,t,n){const s=t==="current"?this.getCurrentItem(e):typeof t=="number"?this.getDataSignal(e).value.find(r=>r.id===t):t;return s?this.getActions(e,{ui:n,data:s}):(console.warn(`[ZUI] getItemActions: ${e} data with ID "${t}" not found.`),[])}async selectSpace(e,t,n){var a,l;if(!await this.checkEditingDoc())return;e==="_first"&&(e=((a=this.spaceList[0])==null?void 0:a.id)??0);const{fetchOnChangeSpace:s,fetcher:r,autoSelectLib:o}=this.props;if(n===void 0&&(n=!!(s&&r&&(this.signals.spaceID.value!==e||typeof t=="number"&&t!==this.signals.libID.value))),!(this.signals.spaceID.value===e&&!t))return this.changeState({spaceID:e,mode:"list",...t?{libID:typeof t=="number"?t:o&&!n?((l=this.libList[0])==null?void 0:l.data.id)??0:0,moduleID:0,docID:0}:null,...n?{data:void 0,loading:!0}:null},()=>{n&&this.load(r,this.signals.spaceType.value,e)})}async selectDoc(e){if(!await this.checkEditingDoc())return;typeof e!="object"&&(e=this.getDoc(e));const t=e?e.id:0;return this.changeState({mode:"view",docID:t,...t!==this.signals.docID.value?{docVersion:0}:null,...e?{libID:e.lib,moduleID:e.module}:null})}goHome(){return this.changeState({libID:0,moduleID:0,docID:0,mode:"home"})}getDefaultPager(e){const{getDefaultPager:t,preserve:n}=this.props,s=n?Ye.get(`${n}:pager:${e}`):null;return t?t.call(this,e):{page:1,recTotal:0,recPerPage:typeof s=="number"?s:20,pageTotal:0}}resetPager(e,t){const n={...this.getDefaultPager(e),...this.signals.pager.value,...t};this.signals.pager.value=n;const{preserve:s}=this.props;s&&Ye.set(`${s}:pager:${e}`,n.recPerPage)}async showFiles(){if(this.canShowLibFiles&&await this.checkEditingDoc())return this.changeState({libID:0,moduleID:0,docID:0,mode:"files",pager:this.getDefaultPager("files")})}async selectLib(e,t){if(!await this.checkEditingDoc())return;const n=this._module.value;n&&t===void 0&&n.data.lib!==e&&(t=0),t===void 0&&(t=this.signals.moduleID.value);const s=e?this.treeMap.libs.get(e):null;if(!(e&&!s||t&&!this.treeMap.modules.get(t)))return this.changeState({libID:e,moduleID:t,mode:"list",docID:0})}selectDocVersion(e,t){const n=this.signals.docID.value;t=t||n;const s=this.getDoc(t);s&&(e=Math.max(0,Math.min(e,s.version??0)),!(t===n&&e===this.signals.docVersion.value)&&this.changeState({docID:t,docVersion:e}))}async selectModule(e,t){if(!await this.checkEditingDoc())return;const n=this._doc.value;return this.changeState({moduleID:e,...t||n&&e!==n.data.id?{docID:0,mode:"list"}:null})}setData(e,t){var r;const{signals:n}=this,s=this.formatData(e,{spaceType:n.spaceType.value,spaceID:n.spaceID.value,libID:n.libID.value,moduleID:n.moduleID.value,docID:n.docID.value});return this.changeState({...s,...t,libTypes:(r=s.libTypes)!=null&&r.length?s.libTypes:n.libTypes.value})}async checkEditingDoc(){if(this._hasEditingDoc.value){const[,e]=this._viewInfo.value;if(e!=null&&e.changed){this.signals.highlightView.value=!0;const t=await We.confirm(this.getLang("leaveEditingConfirm","文档编辑中,确定要离开吗?"));if(this.signals.highlightView.value=!1,!t)return!1}await this.changeState({editingDoc:void 0,creatingDoc:void 0,docVersion:0})}return!0}async load(e,t,n,s){var r,o;if(e=e||this.props.fetcher,e){const{signals:a}=this;t=t||a.spaceType.value,n=n||a.spaceID.value;const{noLoading:l=!1,picks:c=[]}=s||{},d=typeof c=="string"?[c]:c;await this.changeState({loading:!l,spaceType:t,spaceID:n});const u=await mt(e,[{spaceType:t,spaceID:n,picks:d,noSpace:!!this.props.noSpace}],void 0,this);await this.setData(d?{spaces:a.spaces.value,libs:a.libs.value,modules:a.modules.value,docs:a.docs.value,spaceID:a.spaceID.value,libTypes:a.libTypes.value,...this.props.autoSelectLib?{libID:((o=(r=u.libs)==null?void 0:r[0])==null?void 0:o.id)??0}:{},...u}:u,l?void 0:{loading:!1})}}async loadDoc(e,t,n){var l;n=n||this.props.docFetcher,n||(n=()=>({content:""}));let s=this.getDoc(e)||this._getLocalDoc(e);if(!s||((l=this.props.privs)==null?void 0:l.view)===!1)return;const r=this._loadingDocs;if(r.has(e))return new Promise(c=>{r.get(e).push(c)});r.set(e,[]),t=t||s.version||0;const o=!t||t===s.version||!s.version,a=await mt(n,[{docID:e,version:t}],void 0,this);if(a){const c=o?{...s,...a,id:e,local:!1}:{...s,versions:{...s.versions,[t]:this.formatDataItem("doc",a)},local:!1};if(a.contentType==="html"&&c.content&&s.$convert===void 0){const d=await an.htmlToSnap(c.content);c.$convert=!!d}else c.$convert=!1;s=this.update("doc",c,{keepDeleted:!0})}return r.get(e).forEach(c=>c(s)),r.delete(e),s}formatDataItem(e,t,n,s){if(e==="module")t.lib=+(t.lib??t.root),t.parent=+(t.parent??0);else if(e==="lib"){const o=t;o.space=o.space??n,o.space=String(+o.space)===String(o.space)?+o.space:o.space}else e==="space"&&(t.type=t.type??s);if(t.id=as(t.id),t.deleted=typeof t.deleted=="string"?!!JSON.parse(t.deleted):t.deleted,e==="doc"){const o=t;if(o.files){!Array.isArray(o.files)&&typeof o.files=="object"&&(o.files=Object.values(o.files));for(const a of o.files)a.id=+a.id,a.size=+a.size,a.downloads=a.downloads?+a.downloads:0,a.deleted=typeof a.deleted=="string"?!!JSON.parse(a.deleted):a.deleted}o.api===void 0&&(o.api=typeof t.id=="string"&&t.id.startsWith("api.")),o.rawID=fp(t.id),o.product=+(o.product??0),o.project=+(o.project??0),o.execution=+(o.execution??0),o.version=+(o.version??0),o.views=+(o.views??0),o.module=+(o.module??0),o.lib=+(o.lib??0),o.collects=+(o.collects??0),o.rawContent&&(o.content=o.rawContent,delete o.rawContent),!o.collects&&o.isCollector&&(o.collects=1),o.editedBy===o.addedBy&&o.editedDate===o.addedDate&&(delete o.editedBy,delete o.editedDate)}typeof t.order!="number"&&typeof t.id=="number"&&(t.order=t.id);const{formatDataItem:r}=this.props;return r?r.call(this,e,t,n,s):t}formatData(e,t){let{libID:n=0,moduleID:s=0,docID:r,spaceID:o=0}=t;n&&(n=+n),s&&(s=+s),r&&(r=as(r));const{spaceType:a}=t,{libs:l=[],modules:c=[],docs:d=[],spaces:u=[],spaceID:p,libTypes:g=[]}=e||{};let _,C,x,k;return p&&(o=p),o=as(o),l.forEach($=>{this.formatDataItem("lib",$,p)}),l.sort(($,E)=>$.order-E.order),u.forEach($=>{this.formatDataItem("space",$,p,a)}),c.forEach($=>{this.formatDataItem("module",$,p)}),d.forEach($=>{this.formatDataItem("doc",$,p)}),r?_=d.find($=>$.id===r):r=0,_&&!s&&(s=_.module),s&&(C=c.find($=>$.id===s)),n=C?C.lib:n,!n&&this.props.autoSelectLib&&(x=l[0],n=x?x.id:0),n&&(!x||x.id!==n)&&(x=l.find($=>$.id===n)),o=x?x.space:o,!this.props.noSpace&&u.length&&(k=u.find($=>$.id===o)),o||(k=u[0],o=k?k.id:o),!o&&l.length&&(o=l[0].space),{spaceType:(k?k.type:a)||"mine",libs:l,modules:c,docs:d,spaces:u,spaceID:o,libID:n,moduleID:s,docID:r,libTypes:g}}batchUpdate(e,t){Ms(()=>{Object.keys(e).forEach(n=>{const s=e[n];this.update(n,s)}),t&&this.changeState(t)})}update(e,t,n){const s=!Array.isArray(t),r=s?[t]:t,o=this.getDataSignal(e),a=[],l=o.value,c=this.signals.spaceID.value,d=n==null?void 0:n.keepDeleted;return r.forEach(u=>{const p=as(u.id),g=l.findIndex(C=>C.id===p),_=g>=0?{...l[g],...u}:u;this.formatDataItem(e,_,c),_.deleted&&!d?g>=0&&(l[g]=_):g>=0?l[g]=_:l.push(_),a.push(_)}),o.value=[...l],s?a[0]:a}delete(e,t){Array.isArray(t)||(t=[t]);const n=new Set(t);if(!n.size)return!1;const s=this.getDataSignal(e),r=s.value;return!r||!Array.isArray(r)||!r.length?!1:(Ms(()=>{const o=new Set;(e==="module"||e==="lib")&&t.forEach(a=>{const l=e==="module"?this.treeMap.modules.get(a):this.treeMap.libs.get(a);l&&l.docs.forEach(c=>o.add(c.data.id))}),s.value=r.filter(a=>!n.has(a.id)),o.size&&this.delete("doc",[...o])}),!0)}startCreateDoc(e,t,n){e=e??this.signals.libID.value,t=t??this.signals.moduleID.value;const s=this.signals.creatingDoc.value;if(!(s&&s.lib===e&&s.module===t))return this.changeState({creatingDoc:this._getCreatingDoc(n),mode:"create"})}cancelCreateDoc(){return this.changeState({creatingDoc:void 0,mode:"list"})}async saveNewDoc(e){var c,d,u,p,g,_,C;await((d=(c=this._viewRef.current)==null?void 0:c.editor)==null?void 0:d.triggerChange());const{signals:t}=this,n=t.creatingDoc.value;if(!n)return;if(n.title.trim()===""){await We.alert(this.getLang("docTitleRequired","文档标题不能为空。")),(p=(u=this._viewRef.current)==null?void 0:u.editor)==null||p.focusTitle();return}const s=t.spaceID.value,r=t.libID.value,o=t.moduleID.value,a=await((g=this.props.onCreateDoc)==null?void 0:g.call(this,{...n,status:e||"normal",lib:t.libID.value,module:t.moduleID.value},s,r,o));if(!a)return We.alert(this.getLang("saveDocFailed","文档保存失败,请稍后重试"));const l=+a.space.split(".")[1];return l!==s&&l===l?(await this.changeState({creatingDoc:void 0}),await this.selectSpace(l,a.lib),this.selectDoc(a)):(a.rawContent&&(a.content=a.rawContent),(C=(_=this._viewRef.current)==null?void 0:_.editor)==null||C.removeCache(),this.changeState({docs:[...t.docs.value,a],docID:a.id,libID:a.lib,moduleID:a.module,creatingDoc:void 0,mode:"view"}))}async startEditDoc(e,t){var s;if(e=e||((s=this._doc.value)==null?void 0:s.data),typeof e!="object"&&(e=this.getDoc(e)),!e||(e.content===void 0||e.content===null)&&(e=await this.loadDoc(e.id),!e))return;const n=!!((t==null?void 0:t.convert)??e.$convert);await this.changeState({docID:e.id,libID:e.lib,moduleID:e.module,editingDoc:{...e,changed:!1,$convert:n,$html:n?e.content:void 0},mode:"edit"})}cancelEditDoc(e){this.changeState({mode:"view",editingDoc:void 0,docVersion:0,...e})}async saveDoc(e){var o,a,l,c,d;await((a=(o=this._viewRef.current)==null?void 0:o.editor)==null?void 0:a.triggerChange());const t=this.signals.editingDoc.value;if(!t)return this.cancelEditDoc();const n=this.getDoc(t.id);let s={...n,...t,status:e||"normal"};s.contentType==="doc"&&(s.$convert=!1);const r=await((l=this.props.onSaveDoc)==null?void 0:l.call(this,s));if(r!==!1){if((d=(c=this._viewRef.current)==null?void 0:c.editor)==null||d.removeCache(),r&&(r!==!0&&Object.assign(s,r),s=this.update("doc",s),s.lib!==(n==null?void 0:n.lib))){this.cancelEditDoc(),this.selectDoc(s);return}this.cancelEditDoc()}}_afterReset(){const{fetcher:e,data:t,mode:n,docID:s}=this.props,r=()=>{n==="edit"&&s?this.startEditDoc(s):n==="create"?this.startCreateDoc():n==="files"&&this.showFiles()};e&&!t?this.load().then(r):r()}componentDidMount(){var e;super.componentDidMount(),this._afterReset(),(e=this.props.onMounted)==null||e.call(this)}componentDidUpdate(e){var o;const{fetcher:t,data:n,spaceID:s,spaceType:r}=this.props;t&&!n&&(e.spaceType!==r||e.spaceID!==s)&&this.load(),(o=this.props.onUpdated)==null||o.call(this)}componentWillUnmount(){var e;this._viewEffect(),(e=this.props.onUnmounted)==null||e.call(this)}_getCreatingDoc(e="doc"){const t=K_();return{id:t,rawID:t,lib:this.signals.libID.value,module:this.signals.moduleID.value,title:"",content:"",contentType:e,addedBy:this.props.currentUser||"",addedDate:rt(new Date,"yyyy-MM-dd HH:mm:ss"),uid:ss(13).replaceAll("-","_"),order:0}}_getClassName(e){return["doc-app",e.className,this._viewType.value!=="list"?"has-show-view":"",this.signals.fullscreen.value?"is-enter-fullscreen":"",`doc-app-mode-${this.mode}`]}_getProps(e){var t;return{...super._getProps(e),style:{width:Ve(e.width),height:Ve(e.height)},"data-view":this._viewType.value,"data-lib-type":(t=this._lib.value)==null?void 0:t.data.type,"data-space-type":this.spaceType}}_renderSidebar(e){var c,d;const{libIcon:t,apiLibIcon:n,preserve:s,moduleIcon:r,docIcon:o,currentUser:a}=e,l=this.spaceType;return b(H_,{key:"sidebar",app:this,className:"surface-light",preserve:s?`${s}-sidebar`:void 0,currentUser:a,libIcon:t,apiLibIcon:n,moduleIcon:r,docIcon:o,spaceType:l,space:this._space.value,libs:this._libList.value,lib:this._lib.value,libTypes:this.signals.libTypes.value,showFiles:this.signals.mode.value==="files",moduleID:((c=this._module.value)==null?void 0:c.data.id)||0,docID:((d=this._doc.value)==null?void 0:d.data.id)||0,getActions:this.getItemActions,onSelectDoc:this.selectDoc,onSelectLib:this.selectLib,onShowFiles:this.canShowLibFiles?this.showFiles:void 0})}_renderFiles(){const e=this.renderCustom("files");if(e!==void 0)return e;const{currentUser:t,fileUrl:n,filesFetcher:s,userMap:r}=this.props;return b(th,{key:"files",app:this,userMap:r,objectType:this.spaceType,objectID:this.spaceID,filterType:this.filterType,currentUser:t,onGetUser:this.getUserInfo,fileUrl:n,searchKeys:this.signals.searchKeys.value,filesFetcher:s})}_renderList(e){var c,d;if(this.signals.mode.value==="files")return this._renderFiles();const t=this.renderCustom("list");if(t!==void 0)return t;if(((c=this.lib)==null?void 0:c.data.type)==="api")return b(pb,{app:this,docs:this._docList.value});const{libIcon:n,moduleIcon:s,docIcon:r,userMap:o,canMoveDoc:a}=e,l=this.signals.searchKeys.value;return b(B_,{key:"list",app:this,libIcon:n,moduleIcon:s,docIcon:r,userMap:o,searchKeys:l,docs:this._docList.value,canMoveDoc:a,getActions:this.getActions,getTableOptions:this.getTableOptions,orderBy:(d=this._lib.value)==null?void 0:d.data.orderBy})}_renderView(e){const t=this.renderCustom("view");if(t!==void 0)return t;const[n,s]=this._viewInfo.value;if(!s)return null;const{fileIcon:r,fileUrl:o,preserve:a,historyFetcher:l,uploadUrl:c,downloadUrl:d}=e,[u,p]=this._docUsers.value;return b(hb,{ref:this._viewRef,app:this,key:n,doc:s,mode:n,onChange:this._handleDocChange,fileIcon:r,fileActions:this._getFileActions,fileUrl:o,creator:u,modifier:p,uploadUrl:c,downloadUrl:d,preserve:a?`${a}-view`:void 0,onGetUser:this.getUserInfo,historyFetcher:l,highlight:this.signals.highlightView.value})}_renderMain(e){const t=this._renderView(e);return b("div",{key:"main",className:`doc-main flex-auto relative min-w-0${t?" show-view":""}`},this._renderList(e),t)}_renderSearchBox(e){let t={rootClass:"doc-app-search w-40 ml-1 mr-3",defaultValue:(this.signals.searchKeys.value||[]).join(" "),onChange:this._handleSearch};const{getSearchBoxOptions:n}=this.props;return n&&(t=n.call(this,t,{type:e})),b(di,{...t})}_renderFilters(){var a;const e=this.renderCustom("filters");if(e!==void 0)return e;const t=this._viewType.value;if(t!=="list"&&t!=="files")return null;const n=this.getFilterTypes(t),s=t==="list",r=this.filterType,o=s?(a=this._docList.value)==null?void 0:a.length:0;return b("div",{className:"row items-center flex-auto justify-end"},n.length?b("menu",{className:"nav nav-compact",style:"--nav-active-bg: var(--color-primary-100); --nav-active-color: var(--color-fore); --nav-item-height: 24px; --nav-divider-margin: 8px",onClick:this._handleFilterTypeClick},n.map(([l,c])=>b("li",{key:l,className:"nav-item item"},b("a",{className:l===r?"active rounded-full":"rounded-full","data-type":l,"data-view":t},c,l===r&&o?b("span",{className:"label size-sm canvas ring-0 rounded-full"},o):null)))):null,this._renderSearchBox(t))}mergeSidebarItems(e,t){if(!["create","edit","view"].includes(t))return;const n=this.fullscreen?{icon:"fullscreen-exit",hint:this.getLang("exitFullscreen","退出全屏"),onClick:this.toggleFullscreen.bind(this)}:{icon:"fullscreen",hint:this.getLang("enterFullscreen","进入全屏"),onClick:this.toggleFullscreen.bind(this)},s={icon:"list-box",className:"outline-btn",hint:this.getLang("docOutline","文档大纲")},r={icon:"history",className:"history-btn",hint:this.getLang("history","历史记录")},o=[];o.push(s),t!=="create"&&o.push(r),e.unshift(n);const a=e.findIndex(l=>l.icon==="edit");return a===-1?e.splice(1,0,...o):e.splice(a+1,0,...o),e}_renderToolbar(){var s;const e=this.renderCustom("toolbar");if(e!==void 0)return e;const t=this._viewType.value,n=[];if(t==="list")n.push(...this.getActions("doc-list",{ui:"toolbar"}));else if(t==="view"){const r=(s=this._doc.value)==null?void 0:s.data;r&&(r.deleted||n.push(...this.getActions("doc",{ui:"toolbar",data:r})))}else t==="edit"?n.push(...this.getActions("doc-edit",{ui:"toolbar",data:this.signals.editingDoc.value})):t==="create"&&n.push(...this.getActions("doc-create",{ui:"toolbar",data:this.signals.creatingDoc.value}));return this.mergeSidebarItems(n,t),b(Oe,{className:"doc-app-toolbar",gap:2,size:"md",items:n})}_renderHeader(e){const t=this.renderCustom("header");return t!==void 0?t:b("div",{key:"header",class:"doc-app-header surface-light row items-center border-b py-1.5 pl-1 pr-2"},b(X_,{app:this,spaceIcon:e.spaceIcon,libIcon:e.libIcon,apiLibIcon:e.apiLibIcon,moduleIcon:e.moduleIcon,libFilesIcon:e.libFilesIcon,noSpace:e.noSpace,docIcon:e.docIcon,spaces:this._spaceList.value,space:this._space.value,libs:this._libList.value,lib:this._lib.value,doc:this._doc.value,docVersion:this.signals.docVersion.value,creatingDoc:this.signals.creatingDoc.value,editingDoc:this.signals.editingDoc.value,showFiles:this.signals.mode.value==="files",module:this._module.value,libPlaceholder:"所有库",onSelectDocVersion:this.selectDocVersion,onSelectLib:this.selectLib,onSelectSpace:this.selectSpace,onSelectModule:this.selectModule,onSelectDoc:this.selectDoc,homeName:e.homeName,getSpaceFetcher:e.getSpaceFetcher,spaceType:this.spaceType,spaceID:this.spaceID},this._renderFilters()),this._renderToolbar())}_renderBody(e){return b("div",{key:"body",class:"doc-app-body flex-auto min-h-0 row items-stretch"},this._renderSidebar(e),this._renderMain(e))}_renderHome(){const e=this.renderCustom("home");return e!==void 0?e:this.spaceType==="product"||this.spaceType==="project"?b(fb,{ref:this._homeRef,app:this}):b(ub,{ref:this._homeRef,app:this})}_getChildren(e){return this.signals.mode.value==="home"?this._renderHome():this.signals.loading.value?b("div",{key:"loading",class:"doc-loading relative center h-full load-indicator loading tex-gray","data-loading":this.getLang("loadingDocsData","正在加载文档数据...")}):this._space.value?[this._renderHeader(e),this._renderBody(e)]:b("div",{key:"empty-tip",class:"doc-empty-tip center h-full gap-8"},b("div",{className:"relative text-primary"},b(Ie,{icon:"file-alt",className:"opacity-10",style:"font-size: 72px; transform: rotate(-30deg); transform-origin: 0 72px;"}),b(Ie,{icon:"file-alt",className:"opacity-30 absolute left-0 top-0",style:"font-size: 72px; transform: rotate(-15deg); transform-origin: 0 72px;"}),b(Ie,{icon:"file-text",className:"absolute left-0 top-0",style:"font-size: 72px; transform: rotate(0deg); transform-origin: 0 72px;"})),b("div",{className:"text-gray text-lg"},this.getLang("noSpaceTip","这里什么也没有,先创建一个空间再使用吧!")),Oe.render({size:"lg",items:this.getActions("home",{ui:"home-no-space"})},[]))}getCustomRender(e){var t;return(t=this.props.customRenders)==null?void 0:t[e]}renderCustom(e,...t){let n=this.getCustomRender(e);if(typeof n=="function"&&(n=n.call(this,...t)),n!==void 0)return typeof n=="string"?n:b(me,{key:e,content:n,generatorArgs:t,generatorThis:this})}};oh.NAME="DocApp",oh.defaultProps={spaceIcon:"docspace",libIcon:"doclib",apiLibIcon:"interface-lib",moduleIcon:"folder-o",docIcon:"doc",libFilesIcon:"annex-lib",fetchOnChangeSpace:!0,preserve:"doc-app",commands:{},showLibFiles:["product","project","execution"],libColors:["secondary","primary","warning","success","special"].map(i=>`var(--color-${i}-500)`)};async function Tp(i,e){const t=await mt(e.docFetcher,[{docID:i,version:0}]);if(!(t!=null&&t.content))return!1;let n="";if(e.type==="html"){if(!await an.htmlToSnap(t.content))return!1}else try{n=await an.convertToHtml(t.content,void 0,e.downloadUrl)}catch(o){console.warn("[ZUI] Convert doc to html failed:",o)}const s={content:n};let r;return await y.post(be(e.migrateUrl,{docID:i}),s,o=>{const a=o;r=a.result==="success"?!0:a.message},"json"),r}async function $p(i){try{i=i||Rt("doc","ajaxGetMigrateDocs");const e=await mt(i);return Array.isArray(e)?{doc:e,html:[]}:e}catch{return{}}}async function Dp(i,e){await an.loadModule();const{onProgress:t,migrateUrl:n=Rt("doc","ajaxMigrateDoc","docID={docID}"),docFetcher:s=Rt("doc","ajaxGetDoc","docID={docID}"),downloadUrl:r=Rt("file","ajaxQuery","fileID={gid}")}=e||{},o={migrateUrl:n,docFetcher:s,downloadUrl:r};let a=0;const l=i.doc.length+i.html.length,c=["doc","html"];for(const d of c)for(const u of i[d])t==null||t(a,l),await Tp(u,{...o,type:d}),await ai(50),a++;return t==null||t(a,l),i}class ah extends pe{constructor(){super(...arguments),this._current=Qe(0)}migrate(){const{idList:e,docFetcher:t,downloadUrl:n,migrateUrl:s}=this.props;return Dp(e,{docFetcher:t,downloadUrl:n,migrateUrl:s,onProgress:r=>{this._current.value=r}})}componentDidMount(){this.migrate()}render(e){var o;const t=this._current.value,n=e.idList,s=n.doc.length+n.html.length,r=t===s;return b("div",{className:"col gap-4 p-6"},b("div",{class:"row gap-2 items-center"},b("div",{class:`progress progress-striped flex-auto ${r?"":"active"}`},b("div",{class:"progress-bar",style:`width: ${Math.floor(t*100/s)}%`})),b("div",{class:"text-gray"},Math.floor(t*100/s),"%")),r?b("div",{className:"text-center mt-2"},b("button",{type:"button",class:"btn primary",onClick:(o=e.onFinish)==null?void 0:o.bind(this,n)},e.finishText)):b("div",null,be(e.progressTip,{current:t,total:s})))}static async open(e){let t;const n=de();return await We.open({type:"custom",ref:n,size:400,content:b(ah,{...e,onFinish:s=>{var r;t=s,(r=n.current)==null||r.hide()}}),custom:{closeBtn:!1}}),t}}async function mb(i){const{preserve:e="DocApp:migratedDocs:v2"}=i||{};if(Ye.get(e))return;const{doc:t=[],html:n=[]}=await $p(i==null?void 0:i.migrateUrl),s=t.length+n.length;if(!s)return;const r={zh_cn:{confirm:"检查到有 {0} 个文档数据需要迁移,是否进行迁移操作?你也可以下次进入文档应用时再进行迁移。",progressTip:"正在迁移文档数据...({current}/{total})",finish:"迁移完成"},zh_tw:{confirm:"檢查到有 {0} 个文檔數據需要遷移,是否進行遷移操作?你也可以下次進入文檔應用時再進行遷移。",progressTip:"正在遷移文檔數據...({current}/{total})",finish:"遷移完成"},en:{confirm:"There are {0} documents need to be migrated, do you want to migrate them now? You can also migrate them next time when you enter the document application.",progressTip:"Migrating documents...({current}/{total})",finish:"Migrate finished"}},o=r[Qu()]||r.en,a=(i==null?void 0:i.confirm)||o.confirm;if(a&&!await We.confirm(be(a,s)))return;const l=(i==null?void 0:i.progressTip)||o.progressTip,c=(i==null?void 0:i.finishText)||o.finish,d=await ah.open({idList:{doc:t,html:n},...i,progressTip:l,finishText:c});return d&&Ye.set(e,Date.now()),d}const gb=Object.freeze(Object.defineProperty({__proto__:null,getMigrateDocs:$p,migrateDoc:Tp,migrateDocs:Dp,tryMigrateDocs:mb},Symbol.toStringTag,{value:"Module"}));class sr extends ye{}sr.NAME="DocApp",sr.Component=oh,Object.assign(sr,gb),sr.register();const fx="",px="",mx="",gx="",yx="",vx="",_x="",bx="";class lh extends ye{}lh.NAME="Dropmenu",lh.Component=er;class Ip extends Fe{init(){const{echarts:e}=window;if(!e){console.warn("ZUI: ECharts is not loaded.");return}const{responsive:t=!0,theme:n,...s}=this.options,r=e.init(this.element,n);r.setOption(s),t&&y(window).on(`resize.${this.gid}.ECharts.zt`,r.resize),this.chart=r}destroy(){var n;const{echarts:e}=window;if(!e){super.destroy();return}const{responsive:t=!0}=this.options;t&&y(window).off(`resize.${this.gid}.ECharts.zt`),(n=this.chart)==null||n.dispose(),super.destroy()}}Ip.NAME="ECharts";let ch=class extends ye{};ch.NAME="FileList",ch.Component=oa;const wx="",Np=i=>i.replace(/([[\]])/g,"\\$1");class ha extends Fe{constructor(){super(...arguments),this._disabled=!1,this._timer=0}init(){this.$element.on("submit",this.onSubmit.bind(this)).on("input mousedown change",this.onInput.bind(this))}enable(e=!0,t=0){if(this._resetTimer(),t){this._timer=window.setTimeout(()=>{this.enable(e),this._timer=0},t);return}this.$element.toggleClass("loading",!e),this.$element.find('.btn-submit,button[type="submit"]').toggleClass("disabled",!e).prop("disabled",!e),this._disabled=!e}disable(){this.enable(!1)}onInput(e){const t=y(e.target).closest(".has-error");if(!t.length)return;let n=t.attr("name");n||(n=t.find(".pick-value").attr("name"));const s=n?`#${n.split("[")[0]}Tip,#${Np(n)}Tip`:".form-tip";t.removeClass("has-error"),t.closest(".form-group,.form-batch-control").find(s).remove()}onSubmit(e){var o;if(e.preventDefault(),this._disabled)return;const{element:t}=this,n=y.extend({},this.options);this.emit("before",e,t,n);const s=()=>{this.$element.find(".ajax-form-tip").each(function(){const l=y(this);l.closest(".form-group,.form-batch-control").find(".has-error").removeClass("has-error"),l.remove()}),this.disable();const a=this._processData();this._send(a)},r=(o=n.beforeSubmit)==null?void 0:o.call(n,e,t,n);if(r!==!1){if(r instanceof Promise){r.then(a=>a&&s());return}s()}}submit(){this.element.submit()}reset(){this.element.reset()}destroy(){this._resetTimer()}_resetTimer(){this._timer&&(window.clearTimeout(this._timer),this._timer=0)}_processData(){const{$element:e,options:t}=this;let n=new FormData(this.element),{submitEmptySelectValue:s="",submitNoValueChecks:r}=t;const{submitDisabledValue:o=!0}=t;s!==!1&&(typeof s!="boolean"&&(s=""),e.find("select").each((l,c)=>{const d=y(c),u=d.attr("name");d.is("[disabled]")&&!o||n.has(u)||n.append(u,typeof s=="object"?s[u]:s)})),o&&e.find("[disabled][name]").each((l,c)=>{const d=y(c);if(d.hasClass("not-submit-disabled-value"))return;const u=d.attr("name");n.has(u)||n.append(u,d.val())}),r&&(r=typeof r=="string"?r:"",e.find('[type="checkbox"],[type="radio"]').not(":checked").each((l,c)=>{const d=y(c),u=d.attr("name");n.has(u)||d.is("[disabled]")&&!o||n.append(u,d.data("notCheckedValue")??r)}));const{beforeSend:a}=t;if(a){const l=a(n);l instanceof FormData&&(n=l)}return this.emit("send",n),n}_send(e){const{$element:t,options:n}=this;let s,r;const o=n.url||t.attr("action"),a={method:t.attr("method")||"POST",data:e,headers:t.closest(".modal").length?{"X-ZUI-Modal":"true"}:void 0,dataType:"json",jsonParser:JSON.parse},{optionsModifiers:l}=this.constructor;l.length&&l.forEach(d=>{const u=d.call(this,a);u&&u!==a&&y.extend(!0,a,u)});const c=y.ajax(o,a).success((d,u,p)=>{var g,_,C;d instanceof Blob?(Ts(d,(C=(_=(g=p.headers.get("Content-Disposition"))==null?void 0:g.split(";")[1])==null?void 0:_.split("=")[1])==null?void 0:C.replace(/"/g,"")),r={result:"success"}):(r=d,(!r||typeof r!="object")&&(s=new Error("Invalid json format")))}).fail(d=>{s=d}).complete(()=>{var d,u;if(s)this.emit("error",s),console.warn("ZUI: send ajax form failed",s),n.onError?n.onError(s):We.showError({size:"lg",error:[`POST: ${o}`,`Error: ${s.message.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}`,`Response: ${c.data}`].join("
")});else{const p=(d=n.onResult)==null?void 0:d.call(this,r);if(p===!1)return;p&&(r=y.extend(r,p)),this._handleResult(r)}this.emit("complete",r,s),(u=n.onComplete)==null||u.call(n,r,s),this.enable(!0,s||(r==null?void 0:r.result)!=="success"?0:5e3)})}_showValidateMessage(e){var n;let t;Object.entries(e).forEach(([s,r])=>{Array.isArray(r)&&(r=r.join(""));const o=Np(s),{$element:a}=this;let l=a.find(`#${o}`);if(l.length||(l=a.find(`[name="${o}"]`)),!l.length&&!s.includes("[")&&(l=a.find(`[name="${o}[]"]`)),!l.length){We.alert(r);return}l.hasClass("pick-value")&&(l=l.closest(".pick")),l.addClass("has-error");const c=l.closest(".form-group,.form-batch-control,td");if(c.length){let d=c.find(`#${o}Tip`);d.length||(d=y(`
`).appendTo(c)),d.empty().text(r)}else We.alert(r);t||(t=l)}),t&&((n=t[0])==null||n.focus())}_handleResult(e){var l,c;const{options:t}=this;let{message:n}=e;const s=e.result==="success";if(s){if(this.emit("success",e),((l=t.onSuccess)==null?void 0:l.call(t,e))===!1)return;typeof n=="string"&&n.length&&Rn.show({content:n,type:"success"})}else{if(this.emit("fail",e),((c=t.onFail)==null?void 0:c.call(t,e))===!1)return;n&&(Array.isArray(n)&&(n=n.join(` `)),typeof n=="string"&&n.length?We.alert(n):typeof n=="object"&&this._showValidateMessage(n))}const r=t.closeModal??e.closeModal;r&&(r!=="onlySuccess"||s)&&We.hide(typeof r=="string"&&r!=="onlySuccess"?r:void 0);const o=t.callback??e.callback;if(o){const d=[["options",t],["result",e]];if(typeof o=="string"){const u=y.runJS(o,...d);typeof u=="function"&&!o.endsWith(";")&&u(e)}else if(typeof o=="object"){const u=y.runJS(o.name,...d);typeof u=="function"&&u.apply(this,Array.isArray(o.params)?o.params:[o.params])}}const a=t.load??e.load??e.locate;a&&this.$element.trigger("locate.zt",a)}}ha.NAME="AjaxForm",ha.optionsModifiers=[];function hh(i,e){var a,l;const t=i.result==="success";if(t){if(((a=e.onSuccess)==null?void 0:a.call(e,i))===!1)return}else if(((l=e.onFail)==null?void 0:l.call(e,i))===!1)return;const{message:n}=i;n&&(e.onMessage?e.onMessage(n,i):typeof n=="string"&&n.length&&(t?Rn.show({content:n,type:"success"}):We.alert(n)));const s=e.closeModal??i.closeModal;s&&We.hide(typeof s=="string"?s:void 0);const r=e.callback??i.callback;if(r){const c=[["options",e],["result",i]];if(typeof r=="string"){const d=y.runJS(r,...c);typeof d=="function"&&!r.endsWith(";")&&d(i)}else if(typeof r=="object"){const d=y.runJS(r.name,...c);typeof d=="function"&&d.apply(null,Array.isArray(r.params)?r.params:[r.params])}}const o=e.load??i.load??i.locate;o&&y(e.element||document).trigger("locate.zt",o)}function Mp(i){return typeof i=="string"&&(i=i.split(",").reduce((e,t)=>{const[n,s]=t.trim().split(":");return e[n.trim()]=s.trim(),e},{})),Object.keys(i).reduce((e,t)=>{const n=t.endsWith("?"),s=n?t.substring(0):t;let r=i[s];if(typeof r=="string"){const[o,a]=r.split("~"),l=y(o);if(!l.length)return e;a==="checkedIDList"?r=l.closest("[data-zui-dtable]").dtable("getChecks"):l[0].hasAttribute("data-map-value")?r=l.dataset("mapValue"):l.closest(".pick").length?r=l.closest(".pick").find(".pick-value").val():l.is("input,select,textarea")?r=l.val():r=l.text()}return(n||r!=null&&r!==""&&(!Array.isArray(r)||r.length))&&(e[s]=r),e},{})}async function vi(i){if(i.confirm)return await We.confirm(i.confirm)?vi({...i,confirm:void 0}):[void 0,new Error("canceled")];if(i={...ha.DEFAULT,...i},i.beforeSubmit&&await i.beforeSubmit(i)===!1)return[void 0,new Error("canceled")];const{loadingClass:e,element:t}=i;t&&e&&y(t).addClass(e);const{data:n,dataMap:s}=i;let r;n&&(r=Ur(n)),s&&(r=Ur(Mp(s),r));const{beforeSend:o}=i;if(o){const d=o(r);d instanceof FormData&&(r=d)}let a,l;return await new xs({url:i.url,method:i.method||"POST",body:r,headers:i.headers,dataType:"json"}).success(d=>{l=d,(!l||typeof l!="object")&&(a=new Error("Invalid json format"))}).fail(d=>{a=d,console.warn("ZUI: cannot submit ajax form",d)}).complete(()=>{var d,u,p;if(a)(d=i.onError)==null||d.call(i,a);else{const g=(u=i.onResult)==null?void 0:u.call(null,l);if(g===!1)return;g&&(l=y.extend(l,g)),hh(l,i)}(p=i.onComplete)==null||p.call(i,l,a),t&&e&&y(t).removeClass(e)}).send(),[l,a]}y.extend(y,{ajaxSubmit:vi}),y(document).on("click.ajaxSubmit.zui",".ajax-submit",function(i){i.preventDefault();const e=y(this);if(e.is("[disabled],.disabled"))return;const t=e.data();!t.url&&e.is("a")&&(t.url=e.attr("href")||""),t.url&&(t.element=this[0],vi(t))});class yb extends pe{constructor(e){super(e),this.state={pinnedList:e.pinnedList||[]}}_handlePinnedChange(e){const{pinnedList:t}=this.state;t.includes(e)?t.splice(t.indexOf(e),1):t.push(e),this.setState({pinnedList:t})}_handleSave(){var e,t;(t=(e=this.props).onSave)==null||t.call(e,this.state.pinnedList)}render(e,t){const{tip:n,items:s,saveText:r=Ne.getLang("save"),resetText:o=Ne.getLang("reset"),cancelText:a=Ne.getLang("cancel"),pinnedIcon:l="pinned",unpinnedIcon:c="unpinned"}=e,{pinnedList:d}=t,u=new Set(d);return b("form",{className:"form-setting-form w-80 col gap-3"},b("div",{className:"text-gray mt-2"},n),b("div",{className:"divider opacity-5"}),b("div",{className:"row flex-wrap"},s.map(({text:p,value:g})=>{const _=u.has(g);return b("label",{className:"state size-sm ghost w-1/2 pl-1 pr-2 py-1 flex flex-nowrap gap-2 items-center rounded",onClick:this._handlePinnedChange.bind(this,g)},b(Ie,{icon:_?l:c,className:_?"text-primary":"text-gray-400"}),b("div",{className:`flex-auto text-clip${_?"":" text-gray"}`},p))})),b("div",{className:"row flex-nowrap gap-4 mt-2"},b(ke,{size:"md",className:"btn-wide",type:"primary",onClick:this._handleSave.bind(this)},r),b(ke,{size:"md",className:"btn-wide","data-dismiss":"popover"},a),b(ke,{size:"md",type:"primary-ghost",disabled:!d.length,onClick:()=>this.setState({pinnedList:[]})},o)))}}class Ep extends Pt{_getFormItems(){const e=this.$element.closest("form"),t=[],n=[];return e.find(".form-group.is-foldable[data-name]").each((s,r)=>{if(y(r).hasClass("hidden"))return;const o=y(r),a=o.data("name"),l=o.find(".form-label").first();let c=o.data("label");if(c===void 0){const d=l.find(".text");d.length&&(c=d.text())}c===void 0&&(c=l.text().trim()),t.push({value:a,text:c||a}),o.hasClass("is-pinned")&&n.push(a)}),{items:t,pinnedList:n}}_handleSave(e){const{customUrl:t,onSave:n}=this.options,s=()=>{(n==null?void 0:n(e))!==!1&&this.hide();const r=this.$element.closest("form");r.find(".form-group.is-foldable[data-name]").each((o,a)=>{const l=y(a),c=l.data("name");l.toggleClass("is-pinned",e.includes(c))}),r.toggleClass("no-foldable-items",!r.find(".form-group.is-foldable").not(".is-pinned,.hidden").length)};t?vi({url:t,data:{"fields[]":e},onSuccess:r=>{delete r.callback,s()}}):s()}_getRenderOptions(){const{title:e,tip:t,className:n,saveText:s,resetText:r,cancelText:o}=this.options,{items:a,pinnedList:l}=this._getFormItems();return{...super._getRenderOptions(),title:e,headingClass:"popover-heading transparent px-4 pt-4",contentClass:"px-4 pb-4",titleClass:"text-lg font-bold",content:b(yb,{tip:t,saveText:s,resetText:r,cancelText:o,items:a,pinnedList:l,onSave:this._handleSave.bind(this),onCancel:this.hide.bind(this)}),className:V("form-setting-popover",n)}}}Ep.NAME="FormSetting";class Ap extends Fe{get mode(){return this.$container.hasClass("is-full")?"full":"lite"}get shownFoldItems(){return this.$container.hasClass("show-fold-items")}get $container(){let e=this._$container;if(!e){const{$element:t}=this;e=t.closest(".panel-form,.page-form"),e.length||(e=t),this._$container=e}return e}afterInit(){super.afterInit();const e=[],{$element:t}=this;t.children(".form-group[data-name]").each((a,l)=>{e.push(y(l).attr("data-name"))}),this._fields=e;const{fullModeOrders:n}=this.options;this._fullModefields=typeof n=="string"?[n]:n;let{preserve:s}=this.options;(s===!0||s===void 0)&&(s=t.attr("id")),this._preserveID=s||!1;const r=this.options.mode||(this._preserveID?Ye.get(`FormGrid:${this._preserveID}:mode`,this.mode):this.mode);this.toggleMode(r,!1,!0);const{namespace:o}=this;this.$container.on(`click${o}`,".btn-full-form",()=>this.toggleMode("full")).on(`click${o}`,".btn-lite-form",()=>this.toggleMode("lite")).on(`click${o}`,".btn-toggle-fold",()=>this.toggleFold()),t.on(`change${o}`,"[name]",this._handleChange.bind(this)),t.toggleClass("no-foldable-items",!t.find(".form-group.is-foldable").not(".is-pinned,.hidden").length)}getField(e){const{$element:t}=this;let n=t.children(`.form-group[data-name="${e}"]`);if(!n.length)return;const s=t.children(`[data-wrap-before="${e}"]`),r=t.children(`[data-wrap-after="${e}"]`);let o=y();return s.length&&(o=o.add(s)),n.find("script").remove(),n=t.children(`.form-group[data-name="${e}"]`),o=o.add(n),r.length&&(o=o.add(r)),{name:e,wrapBefore:!!s.length,wrapAfter:!!r.length,foldable:n.hasClass("is-foldable"),$ele:n,$group:o}}destroy(){super.destroy(),this.$container.off(this.namespace)}toggleFold(e){e=e??!this.shownFoldItems,this.$container.toggleClass("show-fold-items",e)}openSetting(){this.$container.find(".btn-custom-form").trigger("click")}toggleMode(e,t,n){const s=this.mode;e=e||(s==="full"?"lite":"full"),!(s===e&&!t)&&(this.$container.toggleClass("is-full",e==="full").toggleClass("is-lite",e==="lite"),!n&&this._preserveID&&Ye.set(`FormGrid:${this._preserveID}:mode`,e),this.updateOrders())}updateOrders(e,t){e&&(this._fields=e),t&&(this._fullModefields=typeof t=="string"?[t]:t);const{mode:n}=this;n==="full"?(t=this._fullModefields,Array.isArray(t)&&t.forEach(s=>{this.sortFields(s)})):this.sortFields()}sortFields(e){e=e||this._fields,typeof e=="string"&&(e=e.split(","));let t;e.forEach(r=>{const o=this.getField(r);if(o){if(t){const a=t.$group.last();if(o.$group.first()[0]===a[0])return;o.$group.insertAfter(a)}t=o}});const n=this.$element.children(".form-group.is-foldable").first(),s=this.$element.children(`[data-wrap-before="${n.attr("data-name")}"]`);this.$element.children(".panel-form-divider").insertBefore(s.length?s:n)}_handleChange(e){const{autoLoad:t,loadUrl:n}=this.options;if(!t)return;const s=y(e.target).closest("[name]");Object.keys(t).forEach(r=>{const o=t[r];".[#".includes(r[0])||(r=`[name="${r}"]`),s.closest(r).length&&window.loadForm(y.extend({url:n,target:s},typeof o=="string"?{items:o}:o))})}}Ap.NAME="FormGrid";const Cx="";class Pp extends Fe{init(){const{initGantt:e}=this.options;typeof e=="function"&&e()}destroy(){const{destroyGantt:e}=this.options;typeof e=="function"&&e(),super.destroy()}}Pp.NAME="Gantt";const xx="";Ze(M_);const kx="";let Lp=class extends lt{constructor(){super(...arguments),this._searchBox=de(),this._menu=de(),this._handleChange=e=>{this.setState({value:e.trim()})},this._handleFocus=()=>{this.toggle(!0)},this._handleEenter=()=>{var t;const e=(t=this._menu.current)==null?void 0:t.getActiveKey();e&&this.search(e)},this._handleClickItem=e=>{this.search(e.item.key)}}search(e){var t,n;(t=this.props.onSearch)==null||t.call(this,e,this.state.value),this.toggle(!1,{value:""}),(n=this._searchBox.current)==null||n.blur()}componentDidUpdate(e,t){var s;super.componentDidUpdate(e,t);const n=this._menu.current;this.state.open&&n&&!((s=this._types)!=null&&s.has(n.getActiveKey()))&&n.activeNext()}_getHotkeys(){return this._hotkeys||(this._hotkeys={activeNext:{keys:"ArrowDown",handler:()=>{var e;return(e=this._menu.current)==null?void 0:e.activeNext()}},activePrev:{keys:"ArrowUp",handler:()=>{var e;return(e=this._menu.current)==null?void 0:e.activePrev()}},enter:!0}),this._hotkeys}_renderTrigger(e){return b(di,{delay:0,ref:this._searchBox,placeholder:e.searchHint,onChange:this._handleChange,onFocus:this._handleFocus,hotkeys:this._getHotkeys(),onEnter:this._handleEenter,...e.searchBox})}_getItems(e,t){const{items:n,getObjectID:s,getSearchType:r}=e,{value:o}=t;let a=r==null?void 0:r.call(this,o);const l=a&&a[0]==="!";l&&(a=a.slice(1));const c=s?s.call(this,o):Number.isInteger(+o)?+o:!1,d=Number.isInteger(c),u=[],p=n.reduce((C,x)=>(C.set(x.key,x),C),new Map),g="search",_=C=>{var x;return{html:((x=C.text)==null?void 0:x.replace("{0}",o))??o}};if(a&&d){const C=p.get(a);C&&u.push({...C,className:V(C.className,"w-full"),text:_(C)})}if(!l){const C=p.get(g);u.push({...C,className:V(C==null?void 0:C.className,"w-full"),text:C?_(C):o})}return d&&n.forEach(C=>{C.key===g||C.key===a||l||u.push({...C,className:V(C.className,"w-1/2"),text:_(C)})}),this._types=new Set(u.map(C=>C.key)),u}_renderPop(e,t){return b(Tt,{className:"row flex-wrap overflow-auto scrollbar-hover",items:this._getItems(e,t),onClickItem:this._handleClickItem,ref:this._menu,activeOnHover:!0,...e.menu})}};Lp.defaultProps={...lt.defaultProps,pickerName:"global-search",hidePopWhenEmpty:!0};class ua extends ye{}ua.NAME="GlobalSearch",ua.Component=Lp,ua.replace=!0;function vb(i,e=1e3){let t=null;return(...n)=>{t&&clearTimeout(t),t=setTimeout(()=>{i(...n),t=null},e)}}const Rp=class kg extends Fe{static async loadModule(){return this.Module||(this.Module=await y.getLib("g6")),this.Module}async afterInit(){const e=await kg.loadModule();if(this.destroyed)return;const{type:t="TreeGraph",width:n=this.$element.width(),height:s=this.$element.height()||500,responsive:r=!1,data:o,nodeFn:a,edgeFn:l,comboFn:c,...d}=this.options,u=new e[t]({container:this.element,width:n,height:s,...d});a&&u.node(a),l&&u.edge(l),c&&u.combo(c),u.data(o),u.render(),this.instance=u,r&&this.initResizeObserver()}initResizeObserver(){const e=vb(()=>{this.instance.changeSize(this.$element.width(),this.$element.height()),this.instance.render()},500);this.resizeObserver=new ResizeObserver(()=>{e()}),this.resizeObserver.observe(this.element)}destroy(){var e;this.options.responsive&&((e=this.resizeObserver)==null||e.disconnect()),this.instance.destroy(),super.destroy()}};Rp.NAME="Graph";let Op=Rp;y.registerLib("g6",{src:"graph/g6.min.js",check:"G6"}),Op.register();class rr extends ye{static update(e){y.trigger("load.HistoryPanel",e)}}rr.NAME="HistoryPanel",rr.Component=rh,rr.replace=!0,rr.register();function uh(i){const{objectType:e,objectID:t,actionID:n,url:s,...r}=i;let o=s;return!o&&(n||e&&t)&&(o=Rt("action",n?"editComment":"comment",n?`actionID=${n}`:`objectType=${e}&objectID=${t}`)),We.open({id:`modal-comment-${n?`edit-${n}`:`${e}-${t}`}`,url:o,hideOthers:!1,...r})}y(document).on("click.zt",'[data-toggle="comment"]',i=>{i.preventDefault();const e=y(i.currentTarget);if(e.is(".disabled,:disabled"))return;const t=e.data();if(e.is("a")){const n=e.attr("href");n&&(t.url=n)}t.objectId?(t.objectID=+t.objectId,delete t.objectId):t.actionId&&(t.actionID=+t.actionId,delete t.actionId),delete t.toggle,uh(t)}),Object.assign(We,{comment:uh});const Sx="",Tx="";class dh extends Fe{init(){this.clipWidth=this.options.defaultWidth,this.clipHeight=this.options.defaultHeight,this.initDom(),this.initSize(),this.bindEvents()}initDom(){this.$canvas=this.$element.find(".canvas"),this.$img=this.$canvas.find("img"),this.$btn=this.$element.find("button");const e=this.$img.prop("src"),{coverColor:t,coverOpacity:n}=this.options;this.$canvas.append([`
`,`
`,["top","right","bottom","left","top-left","top-right","bottom-left","bottom-right"].map(s=>`
`).join(""),"
",'
',``,"
"].join("")),this.$controller=this.$canvas.find(".controller"),this.$cliper=this.$canvas.find(".cliper"),this.$chipImg=this.$cliper.find("img")}resetImage(e){this.$img.prop("src",e),this.$chipImg.prop("src",e),this.imgWidth=0,this.left=-1,this.initSize()}initSize(){const{minWidth:e,minHeight:t,ready:n,onSizeError:s}=this.options;if(this.imgWidth)return;const r=a=>{this.imgWidth=a.width,this.imgHeight=a.height,(a.width{r(o)}}refreshSize(e){const{minWidth:t,minHeight:n,fixedRatio:s,defaultWidth:r,defaultHeight:o}=this.options;this.clipWidth=Math.max(t,Math.min(this.width,this.clipWidth)),this.clipHeight=Math.max(n,Math.min(this.height,this.clipHeight)),s&&(e&&e==="height"?(this.clipWidth=Math.max(t,Math.min(this.width,this.clipHeight*r/o)),this.clipHeight=this.clipWidth*o/r):(this.clipHeight=Math.max(n,Math.min(this.height,this.clipWidth*o/r)),this.clipWidth=this.clipHeight*r/o)),this.left=Math.min(this.width-this.clipWidth,Math.max(0,this.left)),this.top=Math.min(this.height-this.clipHeight,Math.max(0,this.top)),this.right=this.left+this.clipWidth,this.bottom=this.top+this.clipHeight,this.$controller.css({left:this.left,top:this.top,width:this.clipWidth,height:this.clipHeight}),this.$cliper.css("clip",`rect(${this.top}px, ${this.left+this.clipWidth}px, ${this.top+this.clipHeight}px, ${this.left}px)`)}getData(){return{originWidth:this.imgWidth,originHeight:this.imgHeight,scaleWidth:this.width,scaleHeight:this.height,width:this.right-this.left,height:this.bottom-this.top,left:this.left,top:this.top,right:this.right,bottom:this.bottom,scaled:this.imgWidth!==this.width||this.imgHeight!==this.height}}bindEvents(){this.$element.on("resize",this.initSize.bind(this)),this.$btn.on("click",e=>{var t,n;(n=(t=this.options).handleBtnClick)==null||n.call(t,e,this.getData())}),this.moveable=new Bs(this.$controller,{selector:".control,.controller",move:!1,onMoveStart:()=>{this.startLeft=this.left,this.startTop=this.top,this.startClipWidth=this.clipWidth,this.startClipHeight=this.clipHeight},onMove:(e,t)=>{const n=y(t.target);if(n.is(".controller"))this.left=this.startLeft+t.deltaX,this.top=this.startTop+t.deltaY,this.refreshSize();else{const s=n.data("type");let r=!1;const{minWidth:o,minHeight:a}=this.options;switch(s){case"left":case"top-left":case"bottom-left":this.left=Math.min(this.right-o,Math.max(0,this.startLeft+t.deltaX)),this.clipWidth=this.right-this.left;break;case"right":case"top-right":case"bottom-right":this.clipWidth=Math.min(this.width-this.left,Math.max(o,this.startClipWidth+t.deltaX));break}switch(s){case"top":case"top-left":case"top-right":this.top=Math.min(this.bottom-a,Math.max(0,this.startTop+t.deltaY)),this.clipHeight=this.bottom-this.top,r=!0;break;case"bottom":case"bottom-left":case"bottom-right":this.clipHeight=Math.min(this.height-this.top,Math.max(a,this.startClipHeight+t.deltaY)),r=!0;break}this.refreshSize(r)}}})}destroy(){var e;(e=this.moveable)==null||e.destroy(),super.destroy()}}dh.NAME="ImgCutter",dh.DEFAULT={coverColor:"#000",coverOpacity:.6,defaultWidth:128,defaultHeight:128,minWidth:48,minHeight:48,fixedRatio:!0};const _i=class{static get images(){var e;return(e=this.Module)==null?void 0:e.images}static async loadModule(){return this.Module||(this.Module=await y.getLib("mammoth")),this.Module}};_i.convertToHtml=async function(i,e){const{convertToHtml:t}=await _i.loadModule();return t(i,e)},_i.extractRawText=async function(i){const{extractRawText:e}=await _i.loadModule();return e(i)},_i.embedStyleMap=async function(i,e){const{embedStyleMap:t}=await _i.loadModule();return t(i,e)};let _b=_i;y.registerLib("mammoth",{src:["mammoth/mammoth.browser.min.js"],check:"mammoth",type:"module"});const $x="";Object.assign(Rn.TypeOptions,{success:{key:"zt-messager-success",icon:"check-circle",type:"success",close:!1},danger:{icon:"exclamation-sign",type:"danger",close:!1}}),Object.assign(Rn,{success(i){return Rn.show(i,"success")},fail(i){return Rn.show(i,"danger")}}),Object.assign(Rn.DEFAULT,{time:3e3,className:"messager-lite"});const Dx="";function bb(i){return We.confirm({iconClass:"warning rounded-full center w-8 h-8 flex-none",type:"custom",custom:{className:"modal-reconfirm",closeBtn:!1},...i})}async function wb(i){const{sortable:e={},onSort:t,items:n,itemProps:s={icon:"move muted",innerClass:"border rounded px-2 canvas cursor-move hover:shadow"},list:r,header:o,message:a,footer:l,...c}=i;let d;const u=(g,_)=>{d=_,t==null||t(g,_)};if(await We.confirm({type:"custom",content:b("div",{className:"modal-body sort-view col gap-2"},b(me,{className:"sort-view-header",content:o}),b(me,{className:"sort-view-message muted",content:a}),b(Hs,{className:"space-y-2",sortable:e,items:n,itemProps:s,onSort:u,...r}),b(me,{className:"sort-view-footer",content:l})),...c}))return d}Ne.addLang({zh_cn:{occurredError:"发生了错误"},zh_tw:{occurredError:"發生了錯誤"},en:{occurredError:"An error occurred"}});async function Cb(i){const{title:e,mono:t,html:n=!0,copyBtn:s=!0,basePath:r,contentClass:o,error:a,...l}=i;let c=typeof a=="string"?a:(a==null?void 0:a.message)??"",d=t,u=e;n&&(r&&(c=c.split(r).join('/')),c.startsWith(`
`)&&(c=c.replace(`
-`,"")),c.startsWith("{const _=p.current;if(navigator.clipboard)navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([_.innerText],{type:"text/plain"}),"text/html":new Blob([_.innerHTML],{type:"text/html"})})]);else{const C=document.createRange();C.selectNode(_),window.getSelection().removeAllRanges(),window.getSelection().addRange(C),document.execCommand("copy"),window.getSelection().removeAllRanges()}}}:null,{key:"cancel",text:Ne.getLang("close")}].filter(Boolean),...l})}Object.assign(We,{reconfirm:bb,sortView:wb,showError:Cb}),We.DEFAULT.backdrop="static",We.DEFAULT.request={dataFilter:i=>{if(i[0]==="{")try{const e=JSON.parse(i);if(e.result)return hh(e,{closeModal:!0}),setTimeout(()=>{y(".modal").each(function(){const t=y(this);t.text().trim().length||t.modal("hide")})},200),""}catch{}return i}},Cc.defaultProps.iframeBodyClass="body-modal";function zp({pri:i="",text:e,className:t}){return i=`${i}`.trim(),e===void 0&&(e=i==="0"||i===""?"":i),b("span",{className:V(`pri-${i}`,t)},e)}let or=class extends lt{constructor(){super(...arguments),this._handleClearBtnClick=e=>{this.setValue(""),e.preventDefault()}}getDefaultState(e){const t=super.getDefaultState(e);if(t.value===void 0&&(e||this.props).required){const n=this._getItems().shift();n&&(t.value=n.value)}return t}_getTriggerProps(e,t){const n=super._getTriggerProps(e,t);return e.disabled&&(n.className=V(n.className,"disabled")),n}_renderTrigger(e,t){var l;const{value:n}=t,{placeholder:s,required:r}=e,o=n===void 0||n==="",a=!o&&!r;return[b("div",{className:"text"},o?b("span",{class:"placeholder"},s):this._renderItem(t.value,(l=this._getItems().find(({value:c})=>c===n))==null?void 0:l.text,"pri")),a?b(ke,{type:"button",class:"btn square btn-close size-xs ghost rounded-full",onClick:this._handleClearBtnClick},b("span",{class:"close"})):null,a?null:b("span",{key:"caret",class:"caret"})]}_getItems(){let{items:e=["",1,2,3,4]}=this.props;return Array.isArray(e)?e=e.map((t,n)=>typeof t=="object"?t:t?{text:`${t}`,value:`${n}`}:{text:"",value:""}):typeof e=="object"&&(e=Object.keys(e).map(t=>({value:t,text:e[t]}))),e=e.filter(({value:t})=>t!==""),e.sort((t,n)=>+t.value-+n.value),e}_renderItem(e,t,n){return b(zp,{key:n,pri:e,text:t})}_renderPop(){const{value:e}=this.state;return b("div",{className:"pick-pri-list"},this._getItems().map(({value:t,text:n})=>b("button",{key:t,type:"button",class:`btn w-full ${e===t?"primary-pale":"ghost"}`,"data-pick-value":t},this._renderItem(t,n))))}};or.defaultProps={...lt.defaultProps,items:["",1,2,3,4],className:"pick-pri form-control",popClass:"pick-pri-pop popup",popWidth:"auto",popMinWidth:56};function Fp({severity:i="",text:e,className:t}){i=`${i}`.trim(),e===void 0&&(e=i==="0"||i===""?"":i);const n=`${+e}`!=`${i}`;return b("span",{className:V(`severity${n?" severity-label":""}`,t),"data-severity":i},n?e:"")}let fh=class extends or{_renderItem(e,t,n){return b(Fp,{key:n,severity:e,text:t})}};fh.defaultProps={...or.defaultProps,items:["",1,2,3,4]};class ph extends ye{}ph.NAME="PriPicker",ph.Component=or;class mh extends ye{}mh.NAME="SeverityPicker",mh.Component=fh;const Ix="",Nx="";let jp=class extends He{constructor(e){super(e),this._syncPickerData=()=>{const n=this.getFormData();y(this.element).find(".pick-value[name]").each((s,r)=>{const o=y(r),a=o.attr("name"),l=n[a];o.val(l).trigger("syncValue")})},this._handleDeleteQueryClick=(n,s)=>{s.stopPropagation(),this.deleteQuery(n)},this._handleChange=n=>{const s=y(n.target),r=s.attr("name");r&&this.changeData(r,s.val())},this._handleSubmit=n=>{n.preventDefault(),this.submit()};const{setting:t}=e;this.state={showQueryPanel:!1,setting:t&&t.conditions?t:void 0},this.submit=this.submit.bind(this),this.reset=this.reset.bind(this)}get showMore(){var e;return this.state.more??((e=this.state.setting)==null?void 0:e.more)}get isShow(){return this.state.show??this.props.show}get loaded(){return!!this.state.setting}get groupItemCount(){var e;return((e=this.state.setting)==null?void 0:e.groupItemCount)||3}componentDidMount(){this.props.show&&this.show(),y.on("update.SearchForm.zt",(e,t)=>{t&&t.module===this.props.module&&this.load(t.reset??!0)}),y.on("addQuery.SearchForm.zt",(e,t)=>{t&&t.module===this.props.module&&this.addQuery(t.id,t.text)})}componentDidUpdate(e,t){const{container:n}=this.props;if(n){const s=y(n),r=this.state.show!==t.show;r&&s.toggleClass("show-search-form",this.state.show),(r||this.state.more!==t.more)&&s.trigger("layout.SearchForm.zt",this)}}componentWillUnmount(){y.off(".SearchForm.zt")}async load(e){if(this.state.loading)return;await this.changeState({loading:!0,...e?{data:void 0}:null});const t=this.props.url||Rt("search","buildForm",`module=${this.props.module}`);try{const n=await mt(t);await this.changeState({setting:n,loading:!1,clickedReset:!1})}catch{await this.changeState({loading:!1,clickedReset:!1})}e&&this._syncPickerData()}async show(){await this.changeState({show:!0}),this.loaded||await this.load()}toggleQueryPanel(e){return e===void 0&&(e=!this.state.showQueryPanel),this.changeState({showQueryPanel:e})}toggle(e){return e===void 0&&(e=!this.isShow),e?this.show():this.hide()}toggleMore(e){return e===void 0&&(e=!this.showMore),this.changeState({more:e})}hide(){return this.changeState({show:!1})}getFormData(e){var s;e=e||this.state.setting;const t={groupAndOr:"or"},n=this.groupItemCount*2;for(let r=1;r<=n;r++)t[`field${r}`]=((s=this._conditionList[r-1])==null?void 0:s.value)??"",t[`operator${r}`]="=",t[`value${r}`]="",t[`andOr${r}`]="and";return{...t,...e.defaultData,...this.state.data}}getSubmitData(){const e=this._data;return{module:this.props.module,actionURL:this.state.setting.actionURL,groupItems:this.groupItemCount,formType:this.showMore?"more":"lite",...e}}submit(){var n;let e=this.getSubmitData();if(!e)return;const t=(n=this.props.beforeSearch)==null?void 0:n.call(this,e);t!==!1&&(t&&(e=t),vi({url:this.props.searchUrl||Rt("search","buildQuery"),data:e,onSuccess:s=>{var r;return((r=this.props.onSearch)==null?void 0:r.call(this,s))===!1||this._handleSearch(y.extend({success:()=>this.load()},typeof s.load=="string"?{url:s.load}:s.load)),!1}}))}reset(){return this.changeState(e=>{const t=new Array(this.groupItemCount*2).fill(0).reduce((n,s,r)=>(n[`value${r+1}`]="",n),{});return{clickedReset:!0,data:{...e.data,...t}}},this._syncPickerData)}applyQuery(e){var s;const{actionURL:t}=this.state.setting,n=t.replace("myQueryID",String(e));((s=this.props.onSearch)==null?void 0:s.call(this,{result:"success",load:n}))!==!1&&this._handleSearch({url:n,success:()=>this.load(!0)})}deleteQuery(e,t){const{deleteQueryConfirm:n,canDeleteQuery:s}=this.state.setting;if(!t&&n){We.confirm(n).then(o=>{o&&this.deleteQuery(e,!0)});return}const r=typeof s=="string"?s.replace("{id}",`${e}`):Rt("search","deleteQuery",`queryID=${e}`);vi({url:r,onSuccess:()=>{const o=this.state.setting,{savedQueryList:a=[]}=o;return this.changeState({setting:{...o,savedQueryList:a.filter(l=>l.id!==e)}}),!1}})}addQuery(e,t){const n=this.state.setting,{savedQueryList:s=[]}=n;s.some(r=>r.id===e)||this.changeState({showQueryPanel:!0,setting:{...n,savedQueryList:[{id:e,text:t},...s]}})}changeData(e,t){const n={[e]:t};if(e.startsWith("field")){const s=t,r=+e.substring(5),{defaultOperator:o,defaultValue:a=""}=this._conditionMap[s];o&&(n[`operator${r}`]=o),n[`value${r}`]=a}else if(e.startsWith("value")){const s=this.getFormData(),r=+e.substring(5),o=s[`field${r}`],{control:a}=this._conditionMap[o];if(a==="date"){const l=t.startsWith("$"),c=s[`operator${r}`];l&&c!=="between"?n[`operator${r}`]="between":!l&&c==="between"&&(n[`operator${r}`]="<=")}}this.changeState(s=>({data:{...s.data,...n}}),this._syncPickerData)}_handleSearch(e){const t=this.element.closest(".modal");let{searchLoader:n=t?{load:"modal",target:t}:"table"}=this.props;const s=y(this.element);let r=s.closest(".tab-pane");typeof n=="string"?(n={load:n},r.length||(r=s.closest("#main"))):t&&(r.length||(r=y(t)));const o=r.find("[data-zui-dtable]");return o.length&&(n.load="table",n.target=o.children(".dtable").attr("id")),typeof e=="string"?n.url=e:typeof e=="object"&&(n={...n,...e}),y.trigger("locate.zt",n),!1}_renderOperators(e,t){var s;const n=this._operatorList;return b(Gt,{name:e,items:n,required:!0,defaultValue:t??((s=n[0])==null?void 0:s.value),search:!1,maxItemsCount:0})}_renderControl(e,t,n,s){const r=this._conditionMap[e]||{},{control:o="text"}=r,{controlRenders:a}=this.constructor,l=a[o]||a.text;return o==="date"&&r.datePeriods===void 0&&s.datePeriods&&(r.datePeriods=s.datePeriods),l.call(this,r,t,n??"")}_renderField(e,t,n,s,r){var d;const{conditions:o}=s,a=t*n+e+1,l=!e;this._conditionList||(this._conditionList=o.map(({text:u,name:p})=>({text:u??p,value:p})));const c=r[`field${a}`]??((d=o[a])==null?void 0:d.name);return b("tr",{key:a,className:"search-form-field"},b("td",{className:V("is-andOr",l?"font-bold text-right nowrap":void 0)},l?(s.groupTitles||[])[t]:this._renderAndOrSelect(`andOr${a}`,r[`andOr${a}`],s)),b("td",{className:"is-condition"},b(Gt,{name:`field${a}`,items:this._conditionList,required:!0,defaultValue:c,popMinWidth:"100%",popWidth:"auto",maxItemsCount:0})),b("td",{className:"is-operator"},this._renderOperators(`operator${a}`,r[`operator${a}`])),b("td",{className:"is-control",key:`${c}:${a}`},this._renderControl(c,`value${a}`,r[`value${a}`],s)))}_renderGroup(e,t,n){const{groupItemCount:s}=this,{showMore:r}=this,o=[],a=r?s:1;for(let l=0;l{const{name:p,text:g}=u;return this._conditionMap[p]=u,{text:g??p,value:p}});const{showMore:n}=this;this._operatorList=(e.operators||"=,!=,>,>=,<,<=".split(",")).map(u=>typeof u=="string"?{text:u,value:u}:u);const s=this.getFormData(e);this._data=s;const{searchBtnText:r="Search",resetBtnText:o="Reset",saveQueryBtnText:a="Save",canSaveQuery:l}=e,{simple:c,noMore:d}=t;return b("form",{key:"form",className:"search-form-wrapper flex-auto py-3 px-2",onSubmit:this._handleSubmit},b("div",{className:"row items-center",onChange:this._handleChange},this._renderGroup(0,e,s),b("div",{className:"col flex-none items-center justify-center px-4 w-24"},this._renderAndOrSelect("groupAndOr",s.groupAndOr,e)),this._renderGroup(1,e,s)),b("div",{className:`toolbar gap-4 justify-center flex-nowrap ${c?"ml-4":"mt-3"}`},b(ke,{key:"submit",type:"primary",btnType:"submit"},r),c?null:b(ke,{key:"reset",onClick:this.reset},o),c&&d?null:b("div",{className:c?"":"absolute top-0 right-0"},c?null:b(ke,{key:"saveQuery",type:"ghost",className:"text-primary","data-toggle":"modal",disabled:!l||this.state.clickedReset,url:l?typeof l=="string"?l:Rt("search","saveQuery",`module=${t.module}`):void 0,"data-title":a},a),d?null:b(ke,{key:"toggle",type:"ghost",className:"text-primary",icon:n?"chevron-double-up":"chevron-double-down",onClick:this.toggleMore.bind(this,void 0)}))))}_renderQueryPanel(e,t){const{savedQueryList:n=[],saveQueryPanelWidth:s=200,saveQueryPanelTitle:r="Saved queries",canDeleteQuery:o}=t;return b("div",{key:"panel",className:V("search-form-query sidebar sidebar-right pt-3 transition-none",e?"is-expanded":"is-collapsed"),style:{minHeight:100,width:e?Ve(s):0,transition:"none"}},b("div",{class:"sidebar-gutter gutter gutter-border gutter-horz border-default",onClick:this.toggleQueryPanel.bind(this,void 0)},b("button",{class:"gutter-toggle",type:"button"},b("span",{class:"chevron-right"}))),e?b("div",{className:"search-form-query-panel pl-3 h-full col"},b("div",{className:"search-form-query-title font-bold mb-1.5 flex-none"},r),b("ul",{className:"search-form-query-list col items-start gap-1 overflow-auto scrollbar-hover pr-3 pb-2 pt-px pl-0"},n.map(({id:a,text:l,noDelete:c})=>b("li",{key:a,className:`search-form-query-item label gray-pale rounded-full state pl-2 hover:text-primary hover:primary-pale inline-flex gap-1 max-w-full ${o&&!c?"pr-0":"pr-2"}`,onClick:this.applyQuery.bind(this,a)},b("span",{className:"min-w-0 flex-auto overflow-hidden nowrap"},l),o&&!c?b(ke,{type:"ghost",className:"size-xs rounded-full flex-none"},b("i",{className:"close",onClick:this._handleDeleteQueryClick.bind(this,a)})):null)))):null)}_getProps(e){return{...super._getProps(e),"data-module":e.module}}_getClassName(e){const t=super._getClassName(e);if(!this.isShow)return[t,"search-form","hidden"];const{setting:n,showQueryPanel:s}=this.state,{showMore:r}=this,o=n==null?void 0:n.savedQueryList;return[t,"search-form",n?"is-loaded":"is-empty",{"is-lite":!r,"is-more":r,"is-simple":e.simple,"show-save-query":o&&s}]}_getChildren(e){if(!this.isShow)return null;const{setting:t,showQueryPanel:n,loading:s}=this.state,r=!e.simple&&t&&t.savedQueryList;return b("div",{className:V(`search-form-container row gap-3 load-indicator${s?" loading":""}`,e.innerClass),style:`max-height: ${76+44*(this.showMore?this.groupItemCount:1)}px`},t?this._renderForm(t,e):null,r?this._renderQueryPanel(n,t):null)}};jp.controlRenders={text:(i,e,t)=>b("input",{className:"form-control",type:"text",name:e,value:t,placeholder:i.placeholder,...i.controlProps}),select:(i,e,t)=>{const{items:n=[]}=i;return b(Gt,{name:e,items:n,defaultValue:t,placeholder:i.placeholder,popMinWidth:"100%",popWidth:"auto",maxItemsCount:0,...i.controlProps})},date:(i,e,t)=>{const{datePeriods:n}=i,s={};return n&&(s.menu=[...n],s.allowInvalid=!0,s.display=r=>{const o=n.find(a=>a.value===r);return o?o.text:r}),b(Qi,{name:e,defaultValue:t,placeholder:i.placeholder,...s,...i.controlProps})},time:(i,e,t)=>b(Ao,{name:e,defaultValue:t,placeholder:i.placeholder,...i.controlProps}),datetime:(i,e,t)=>b(bc,{name:e,defaultValue:t,placeholder:i.placeholder,...i.controlProps})};class Bt extends ye{}Bt.NAME="SearchForm",Bt.Component=jp,Bt.replace=!0,Bt.toggleForm=gh,Bt.update=Bp,Bt.addQuery=Hp,Bt.toggle={convertHref:!0,getOptions(i,e){const t=y(i);if(t.is("a")){const n=t.attr("href");n&&(!e.target&&"#.".includes(n[0])?e.target=n:e.url||(e.url=n))}return e},handler(i,e){gh({container:y(i).closest(e.container||".modal,#main"),...e})}},Bt.register();function gh(i){typeof i=="string"?i={module:i}:i||(i={module:window.config.currentModule});const e=y(i.container||".modal,#main").first();if(!e.length)return;i.module||(i.module=window.config.currentModule);let t;if(i.target?t=y(i.target,e):(t=e.find(`[${Bt.DATA_KEY}],.search-form`),i.module&&(t=t.filter(`[data-module="${i.module}"]`))),!t.length){let s=e.closest(".modal").find(".modal-body");s.length||(s=e.find(".main-content-cell")),s.length||(s=e.find("#mainContent")),t=y("
").attr({"zui-key":"searchForm","data-module":i.module}).prependTo(s.length?s.first():e)}let n=t.zui(Bt.NAME);return n?n.$.toggle(i.show):n=new Bt(t,{container:e,show:!0,...i}),n}function Bp(i,e){y.trigger("update.SearchForm.zt",{module:i,reset:e})}function Hp(i){y.trigger("addQuery.SearchForm.zt",i)}const Mx="";class da extends ye{}da.NAME="UserAvatar",da.Component=nr,da.register();const xb={1:"error",2:"warning",4:"parse",8:"notice",16:"core-error",32:"core-warning",64:"compile-error",128:"compile-warning",256:"user-error",512:"user-warning",1024:"user-notice",2048:"strict",4096:"recoverable-error",8192:"deprecated",16384:"user-deprecated",32767:"all"};function Wp(i){return typeof i=="number"&&(i=xb[i]),i}function Up(i){return i=Wp(i),i.includes("error")?"error":i.includes("warning")?"warning":"info"}function kb({errors:i,...e}){const t=i.reduce((n,s)=>(n[Up(s.level)]++,n),{error:0,warning:0,info:0});return b("div",{class:"row items-stretch text-sm","data-hint":"PHP errors",...e},t.error?b("button",{type:"button",class:"state font-bold px-0.5 danger"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"ERR"),t.error):null,t.warning?b("button",{type:"button",class:"state font-bold px-0.5 danger bg-opacity-90"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"WAR"),t.warning):null,t.info?b("button",{type:"button",class:"state font-bold px-0.5 danger bg-opacity-80"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"INF"),t.info):null)}function Ot(i,e,t,n){console.groupCollapsed(`%c${i} %c${e}`,"color: #fff; background-color: #9333ea; padding: 0 0.1em 0 0.25em; border-radius: 0.25em 0 0 0.25em;","color: #9333ea; background-color: #e9d5ff; padding: 0 0.5em; border-radius: 0 0.25em 0.25em 0;",n),console.table(t),console.groupEnd()}function Hn(i,e=400,t=100){return i{g.Duration>.3&&u++,g.Duration>p.Duration&&(p=g)}),s.push(b("div",{class:`px-0.5 state text-${Hn(u,3,1)}`,"data-hint":"服务器最慢SQL数 (好<3≤正常<1≤差)",onClick:Ot.bind(null,"SQL Query",`${d.length} SQL profiles`,d,i.id)},b("span",{class:"scale-95 font-bold inline-block"},"LQ"),u)),p.Duration){const g=p.Duration*1e3;s.push(b("div",{class:`px-0.5 state text-${Hn(g,600,300)}`,"data-hint":"服务器最慢SQL耗时 (好<600≤正常<300≤差)",onClick:Ot.bind(null,"SQL Query",`Slowest SQL query: ${g}ms`,p,i.id)},b("span",{class:"scale-95 font-bold inline-block"},"MLQ"),Yt(g)))}}}else s.push(b("div",{class:"muted px-0.5"},"loading..."));return b("div",{class:"zin-perf-btn-list row items-center bg-black text-sm"},b("div",{class:"px-1 bg-canvas bg-opacity-20 self-stretch flex items-center","data-hint":`请求 ${i.id} URL: ${i.url}`},b("span",{class:"muted"},n)),s,o?b("a",{class:"state text-secondary px-0.5",href:o,target:"_blank","data-hint":"打开 xhprof 报告"},"XHP"):null)}function Sb(i){Ot("Trace","Error",i,i.message),navigator.clipboard.writeText(`vim +${i.line} ${i.file}`)}function Tb({errors:i=[],show:e,basePath:t}){i.length||(e=!1);const n=i.map(s=>{const r=Wp(s.level),o=Up(r),a=o==="error"?"danger":o==="info"?"important":"warning";return b("div",{class:`zin-error-item state ${a}-pale text-fore px-2 py-1 ring ring-darker`,onClick:Sb.bind(null,s)},b("div",{class:"zin-error-msg font-bold text-base"},b("strong",{class:`text-${a}`,style:"text-transform: uppercase;"},r)," ",s.message),b("div",{class:"zin-error-info text-sm opacity-60 break-all"},b("strong",null,"vim +",s.line)," ",b("span",{className:"underline"},t?s.file.substring(t.length):s.file)))});return b("div",{class:`zin-errors-panel canvas absolute bottom-full left-0 mono shadow-xl ring rounded fade-from-bottom ${e?"in":"events-none"}`},n)}const Ex="";function $b(){const i=navigator.userAgent;let e="Unknown",t="Unknown";return i.indexOf("Chrome")>-1?(e="Chrome",t=i.substring(i.indexOf("Chrome")+7)):i.indexOf("Firefox")>-1?(e="Firefox",t=i.substring(i.indexOf("Firefox")+8)):i.indexOf("Safari")>-1?(e="Safari",t=i.substring(i.indexOf("Safari")+7),i.indexOf("Version")>-1&&(t=i.substring(i.indexOf("Version")+8))):window.StyleMedia&&(e="Edge",t=i.substring(i.indexOf("Edge")+5)),t=t.split(" ")[0],t=t.split(";")[0],t=t.split(")")[0],{name:e,version:t}}let Db=class extends pe{constructor(e){var t,n;super(e),this._timer=0,this._browser=$b(),this._guardData={},this.state={showPanel:e.defaultShow??!0,showZinbar:!!((n=(t=e.defaultData)==null?void 0:t.errors)!=null&&n.length||!Ye.get("Zinbar:hidden")),...e.defaultData},this.togglePanel=this.togglePanel.bind(this),this.sendGuardData=this.sendGuardData.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this)}componentDidMount(){document.addEventListener("click",this.handleClickOutside)}componentDidUpdate(){var o,a,l,c;const{pagePerf:e}=this.state;let t="",n="";const s=(a=(o=e==null?void 0:e.trace)==null?void 0:o.sqlQuery)==null?void 0:a.length,r=(c=(l=e==null?void 0:e.trace)==null?void 0:l.request)==null?void 0:c.timeUsed;if(r&&e.renderEnd){const d=e.renderEnd-e.renderBegin,u=r+d,p=[];let g="",_="";u>=500?(g="danger",p.push(`处理时间${Yt(u)}超过500ms(后端${Yt(r)},前端${Yt(d)})`)):u>=300&&(g="warning",p.push(`处理时间${Yt(u)}超过300ms(后端${Yt(r)},前端${Yt(d)})`)),s&&(s>=60?(_="danger",p.push(`SQL查询超过60次(实际${s})`)):s>=40&&(_="warning",p.push(`SQL查询超过40次(实际${s})`))),(g||_)&&(t=g==="danger"||_==="danger"?"danger":"warning",n=[t==="danger"?"页面有性能问题":"页面有优化空间",...p].join(","))}y("body").z({perf:t,perfMessage:n})}componentWillUnmount(){document.removeEventListener("click",this.handleClickOutside)}handleClickOutside(e){const t=e.target;this.state.showPanel&&!t.closest(".zinbar")&&this.setState({showPanel:!1})}async sendGuardData(e=180){var g,_,C;const{guardApi:t}=this.props;if(!t)return;this._timer&&clearTimeout(this._timer);const{pagePerf:n}=this.state;if(!(n!=null&&n.renderEnd))return;if(e){this._timer=window.setTimeout(()=>{this.sendGuardData(0)},e);return}const s=dp(n.url);if(!(s!=null&&s.moduleName))return;this.setState({guardState:"sending"});const{author:r="anonymous",email:o,host:a=location.origin}=this.props,{profiles:l=[],sqlQuery:c=[],request:d}=n.trace||{};l.forEach(x=>{x.DurationOriginal||(x.DurationOriginal=x.Duration,x.Duration=1e3*x.Duration)});const u=c.findIndex(x=>x.includes("SET profiling = ")),p=u>=0?c.length-u-1:c.length;this._guardData={timestamp:Date.now(),identifier:r,email:o,requestId:ss(),dataVer:3,request:{host:a,url:/https?:/.test(n.url)?n.url:`${a}${n.url}`,module:s.moduleName,method:s.methodName,xhprof:n.xhprof?/https?:/.test(n.xhprof)?n.xhprof:`${a}${n.xhprof}`:null,php:d==null?void 0:d.php,errorCount:((g=this.state.errors)==null?void 0:g.length)||0,errors:this.state.errors??[]},userEnv:{system:navigator.userAgentData?navigator.userAgentData.platform:navigator.platform,userAgent:navigator.userAgent,browser:[this._browser.name,this._browser.version].join(" ")},metrics:{frontend:{renderTime:Math.round(n.renderEnd-n.renderBegin),downloadSize:n.dataSize},backend:{totalTime:d==null?void 0:d.timeUsed,sqlTime:l.reduce((x,k)=>x+k.Duration,0),sqlCount:Math.max(l.length||0,p),sqlDetails:l,phpFileLoaded:((_=n.trace)==null?void 0:_.files.length)||0,phpFiles:(C=n.trace)==null?void 0:C.files,requestMemory:d==null?void 0:d.memory}}};try{const x=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this._guardData),mode:"no-cors"});this._guardData.$response=await x.text(),this.setState({guardState:!0})}catch(x){this._guardData.$error=x,console.error("[ZUI] Send guard data failed:",x,this),this.setState({guardState:"error"})}}update(e,t,n){this.setState(s=>{const r=!(e!=null&&e.id)||e.id==="page",o={};return r?(e&&(o.pagePerf={...s.pagePerf,...e}),t&&(o.errors=t),e!=null&&e.requestEnd||(o.guardState=!1)):(e&&(o.partPerf={...s.partPerf,...e}),t&&(o.errors=[...s.errors??[],...t??[]])),n&&(o.basePath=n),o},this.props.guardApi?this.sendGuardData:void 0)}togglePanel(){this.setState({showPanel:!this.state.showPanel})}toggleZinbar(){const e=!this.state.showZinbar;this.setState({showZinbar:e},()=>{Ye.set("Zinbar:hidden",!e)})}render(){const{errors:e,pagePerf:t,partPerf:n,showZinbar:s,basePath:r,guardState:o}=this.state,{fixed:a}=this.props,l=e==null?void 0:e.length;return b("div",{className:V("zinbar row h-5 items-stretch gap-px inverse bg-opacity-50",a?"relative":"fixed right-0 bottom-0",{collapse:!s}),style:{zIndex:9999}},b("button",{type:"button","data-hint":s?"折叠":"展开",className:`w-4 ${l&&!s?"danger":"bg-inverse"} flex items-center justify-center`,style:{marginLeft:-15},onClick:this.toggleZinbar.bind(this)},b("span",{class:s?"caret-right":"caret-left"})),l?b(kb,{errors:e,onClick:this.togglePanel}):null,t?b(Vp,{perf:t,guardState:o,guardData:this._guardData}):null,n?b(Vp,{perf:n}):null,b(Tb,{show:this.state.showPanel,basePath:r,errors:e}))}};class yh extends ye{}yh.NAME="Zinbar",yh.Component=Db;let Kp=class extends He{_renderContent(e){const{subtitle:t,subtitleClass:n,content:s,contentClass:r}=e;if(!(!t&&!s))return[S("div",{className:V("card-content",r),children:[t?S("div",{className:V("card-subtitle",n),children:S(me,{content:t})},"subtitle"):null,s?S(me,{content:s},"extraContent"):null]},"content")]}_renderHeading(e){const{icon:t,prefix:n,prefixClass:s,title:r,titleClass:o,titleUrl:a,titleAttrs:l,suffix:c,suffixClass:d,heading:u,headingClass:p}=e;if(!t&&!n&&!r&&!c&&!u)return;const g=a?"a":"span";return S("div",{className:V("card-heading",p),children:[t?S(Ie,{className:"card-icon",icon:t},"icon"):null,n?S(me,{className:V("card-prefix",s),content:n},"prefix"):null,r?S(g,{className:V("card-title",o),href:a,...l,children:S(me,{content:r})},"title"):null,c?S(me,{className:V("card-suffix",d),content:c},"suffix"):null,u?S(me,{content:u},"extraHeading"):null]})}_renderHeader(e){const{header:t,headerClass:n}=e;if(t)return S("div",{className:V("card-header",n),children:S(me,{content:t},"header")})}_renderFooter(e){const{footer:t,footerClass:n,footActions:s}=e;if(t||s)return S("div",{className:V("card-footer",n),children:[S(me,{content:t},"footer"),Oe.render(s,[e],{key:"foot-actions",relativeTarget:e,className:"card-foot-actions",size:"sm"},this)]})}_renderActions(e){return Oe.render(e.actions,[e],{key:"actions",relativeTarget:e,className:"card-actions",size:"sm"},this)}_renderList(e){const{items:t}=e;if(!t)return;const n=xe({key:"list",className:"card-list"},typeof t=="object"?t:{items:t});return S(ft,{...n})}_renderAvatar(e){const{avatar:t}=e;if(t){const n=typeof t=="function"?t.call(this,e):t;if(n)return n.className=V("item-avatar",n.className),S(Bi,{...n},"avatar")}}_getClassName(e){return["card",e.className,e.selected?"selected":""]}_getChildren(e){return[this._renderActions(e),this._renderHeader(e),this._renderAvatar(e),this._renderHeading(e),this._renderContent(e),this._renderList(e),this._renderFooter(e),e.children]}};class qp extends Kp{_getClassName(e){return e.className}_getChildren(e){const{innerAttrs:t,innerClass:n,selected:s,innerComponent:r="div"}=e,o=xe({className:V("card",n,s?"selected":"")},t);return S(r,{...o,children:super._getChildren(e)})}}let cs=class extends ft{_getClassName(e){return[super._getClassName(e),e.countPerRow?"card-grid":""]}_getProps(e){const{gap:t,countPerRow:n}=e;return xe({style:{"--list-gap":t?Ve(t):void 0,"--list-count-per-row":n}},super._getProps(e))}_getRenderedItem(e,t){return t}};cs.NAME="card-list",cs.TAG="div",cs.ItemComponents={...ft.ItemComponents,default:qp,item:qp},cs.defaultItemProps={component:"div"};class fa extends ye{}fa.NAME="Card",fa.Component=Kp,fa.replace=!0;class vh extends ye{}vh.NAME="CardList",vh.Component=cs;const Ax="",Px="";class hs extends on{_getLayoutOptions(){const e=super._getLayoutOptions();return this.options.element||(e[0]={getBoundingClientRect:this._getClickBounding}),e}}hs.NAME="ContextMenu",hs.DEFAULT={...on.DEFAULT,name:"contextmenu",trigger:"contextmenu"},hs.register();const Lx="",Rx="";function Ib(i){const{left:e,className:t,top:n,id:s,onMenuBtnClick:r,title:o,width:a,height:l,content:c,loading:d,draggable:u=!0}=i;return S("div",{class:"dashboard-block-cell",style:{left:e,top:n,width:a,height:l},children:S("div",{className:V("dashboard-block load-indicator",d&&!c?"loading":"",r?"has-more-menu":"",t),draggable:u,"data-id":s,children:[S("div",{class:"dashboard-block-header",children:[S("div",{class:"dashboard-block-title",children:o}),r?S("div",{class:"dashboard-block-actions toolbar",children:S("button",{class:"toolbar-item dashboard-block-action btn square ghost rounded size-sm","data-type":"more",onClick:r,children:S("div",{class:"more-vert"})})}):null]}),y.isPlainObject(c)&&c.html?S(vn,{className:"dashboard-block-body",executeScript:!0,...c}):S("div",{class:"dashboard-block-body",children:c})]})})}const Ox="",zx="",_h=([i,e,t,n],[s,r,o,a])=>!(i+t<=s||s+o<=i||e+n<=r||r+a<=e),Gp=(i,e)=>i[1]===e[1]?i[0]-e[0]:i[1]-e[1],pa="Dashboard:Block.cache:";let Yp=class extends pe{constructor(e){super(e),this._ref=de(),this._loadTimer=0,this._map=new Map,this._oldMap=new Map,this.tryLoadNext=()=>{clearTimeout(this._loadTimer),this._loadTimer=window.setTimeout(()=>this.loadNext(),100)},this._checkLayout=()=>{const{onLayoutChange:t}=this.props;if(!t)return;const{blocks:n}=this.state,s={};let r=!1;n.forEach(o=>{const[a,l,c,d]=this._map.get(o.id),u=this._oldMap.get(o.id);(!u||u[0]!==a||u[1]!==l||u[2]!==c||u[3]!==d)&&(r=!0,s[o.id]={left:a,top:l,width:c,height:d},this._oldMap.set(o.id,[a,l,c,d]))}),r&&t(s)},this._handleMenuClick=t=>{const n=t.target.closest(".dashboard-block");if(!n)return;const s=n.dataset.id;if(!s)return;const r=this.getBlock(s);if(!r||!r.menu)return;const{menu:o}=r,{onClickMenu:a}=this.props;hs.show({triggerEvent:t,element:t.currentTarget,placement:"bottom-end",menu:{onClickItem:l=>{var c;((c=l.item.data)==null?void 0:c.type)==="refresh"&&this.load(s),a&&a.call(this,l,r)},...o}})},this.state={blocks:this._initBlocks(e.blocks)}}getBlock(e){return this.state.blocks.find(t=>t.id===e)}update(e,t){const{id:n}=e,{blocks:s}=this.state,r=s.findIndex(a=>a.id===n);if(r<0)return;const o=s[r];e.fetch&&e.fetch!==o.fetch&&e.needLoad===void 0&&(e.needLoad=!0),s[r]={...o,...e},this.setState({blocks:s},t)}delete(e){const{blocks:t}=this.state,n=t.findIndex(s=>s.id===e);n<0||(t.splice(n,1),this.setState({blocks:t}))}add(e){e=Array.isArray(e)?e:[e],this.setState({blocks:[...this.state.blocks,...this._initBlocks(e)]})}load(e,t){const n=this.getBlock(e);!n||n.loading||(t=t||n.fetch,t&&this.update({id:e,loading:!0,needLoad:!1},async()=>{try{const s=await y.fetch(t,[e,n],({url:r})=>({url:be(r,n),dataType:"html"}));this.update({id:e,loading:!1,content:{html:s}},()=>{var r;this._setCache(e,s),(r=this.props.onLoad)==null||r.call(this,n)})}catch(s){const r=S("div",{class:"panel center text-danger p-5",children:["Error: ",s.message]});this.update({id:e,loading:!1,content:r},()=>{var o;(o=this.props.onLoadFail)==null||o.call(this,s,n)})}}))}reset(e){this.setState({blocks:this._initBlocks(e)})}loadNext(){const{blocks:e}=this.state;let t="";for(const n of e){if(n.loading)return;if(!n.visible&&this._isVisible(n.id))return this.update({id:n.id,visible:!0});if(n.needLoad&&n.visible){t=n.id;break}}t.length&&requestAnimationFrame(()=>this.load(t))}_isVisible(e){return!this.props.onlyLoadVisible||!!y(this._ref.current).find(`.dashboard-block[data-id="${e}"]`).isVisible()}_setCache(e,t){const{cache:n}=this.props;if(n)try{typeof n=="string"?Ye.set(`${pa}${n}:${e}`,t):Ye.session.set(`${pa}${e}`,t)}catch(s){console.warn("ZUI: Failed to cache block content.",{id:e,html:t,error:s})}}_getCache(e){const{cache:t}=this.props;if(!t)return;const n=typeof t=="string"?Ye.get(`${pa}${t}:${e}`):Ye.session.get(`${pa}${e}`);if(n)return{html:n}}_initBlocks(e){const{blockFetch:t,blockMenu:n,grid:s}=this.props;return e.map(o=>{const{id:a,size:l,width:c,height:d,left:u=-1,top:p=-1,fetch:g=t,menu:_=n,content:C,...x}=o,[k,$]=this._getBlockSize(c&&d?{width:c,height:d}:l);return{id:`${a}`,width:k,height:$,left:Math.min(u,s-k),top:p,fetch:g,menu:_,content:C??this._getCache(`${a}`),loading:!1,needLoad:!!g,...x}})}_getBlockSize(e){const{blockDefaultSize:t,blockSizeMap:n}=this.props;return e=e??t,typeof e=="string"&&(e=n[e]),e=e||t,Array.isArray(e)||(e=[e.width,e.height]),e}_layout(){const{blocks:e,dragging:t,dropping:n}=this.state,s=this._map;if(s.size){const a=[0,0,0,0];e.sort((l,c)=>Gp(s.get(l.id)||a,s.get(c.id)||a))}s.clear(),t&&n&&s.set(t,n),e.forEach(a=>{a.id!==t&&this._layoutBlock(a)});const r=Array.from(s.entries());r.sort((a,l)=>Gp(a[1],l[1]));let o=0;return r.forEach(([a,l])=>{let c=l[1]-1;for(;c>=0&&this._canMove([l[0],c,l[2],l[3]],a);)c--;c++,l[1]=c,o=Math.max(o,c+l[3])}),n&&(o=Math.max(o,n[1]+n[3])),{blocks:e,height:o}}_initDraggable(){const e=this._ref.current;this._draggable=new js(e,{selector:".dashboard-block",target:()=>e,beforeDrag:(t,n)=>{const s=n.getBoundingClientRect();if(t.clientY-s.top>48)return t.preventDefault(),!1;this._dragOffset=[t.clientX-s.left,t.clientY-s.top]},onDragStart:(t,n)=>{const s=n.dataset.id;s!==void 0&&(this._dragging=this._map.get(s),this.setState({dragging:s}))},onDragOver:t=>{const{cellHeight:n,grid:s}=this.props,r=e.getBoundingClientRect(),[,,o,a]=this._dragging,[l,c]=this._dragOffset,d=Math.min(s-o,Math.max(0,Math.round((t.clientX-r.left-l)/(r.width/s)))),u=Math.max(0,Math.round((t.clientY-r.top-c)/n)),p=this.state.dropping;p&&p[0]===d&&p[1]===u||this.setState({dropping:[d,u,o,a]})},onDragEnd:()=>{const{dragging:t,dropping:n}=this.state,s={dragging:void 0,dropping:void 0},r={};if(t&&n){const{blocks:o}=this.state;o.forEach((a,l)=>{const[c,d]=t===a.id?n:this._map.get(a.id);(a.left!==c||a.top!==d)&&(o[l]={...a,left:c,top:d},r[a.id]={left:c,top:d})}),s.blocks=o}this.setState(s,this._checkLayout),this._dragging=void 0,this._dragOffset=void 0}})}_layoutBlock(e){const{id:t,left:n,top:s,width:r,height:o}=e,a=[n,s,r,o];n<0||s<0?this._appendBlock(t,a):this._insertBlock(t,a)}_canMove(e,t){const{dropping:n}=this.state;if(n&&_h(e,n))return!1;for(const[s,r]of this._map.entries())if(s!==t&&_h(r,e))return!1;return!0}_canPlace(e){const{dragging:t}=this.state;return this._canMove(e,t)}_insertBlock(e,t){const{dropping:n}=this.state;for(n&&_h(t,n)&&(t[1]=n[1]+n[3]);!this._canPlace(t);)t[1]=t[1]+1;this._map.set(e,t)}_appendBlock(e,t){const[n,s,r,o]=t;let a=s;if(n>=0&&s>=0){if(this._canPlace(t)){this._map.set(e,[n,s,r,o]);return}a=-1}let l=n<0?0:n,c=a<0?0:a,d=!1;const u=this.props.grid;for(;!d;){if(this._canPlace([l,c,r,o])){d=!0;break}n<0?(l+=1,l+r>u&&(l=0,c+=1)):c+=1}this._map.set(e,[l,c,r,o])}componentDidMount(){this.loadNext(),y(window).on("scroll",this.tryLoadNext),this._initDraggable();for(const[e,t]of this._map.entries())this._oldMap.set(e,[...t])}componentDidUpdate(e){e.blocks!==this.props.blocks?this.setState({blocks:this._initBlocks(this.props.blocks)}):this.loadNext()}componentWillUnmount(){clearTimeout(this._loadTimer),y(window).off("scroll",this.tryLoadNext),this._draggable.destroy()}render(){const{blocks:e,height:t}=this._layout(),{cellHeight:n,grid:s,emptyBlockContent:r}=this.props,{dropping:o,dragging:a}=this.state,l=this._map;return S("div",{class:"dashboard",children:S("div",{class:"dashboard-blocks",style:{height:t*n},ref:this._ref,children:[o?S("div",{className:"dashboard-drop-shadow",style:{left:`${100*o[0]/s}%`,top:n*o[1],width:`${100*o[2]/s}%`,height:n*o[3]}},"dropping"):null,e.map((c,d)=>{const{id:u,menu:p,content:g,title:_}=c,[C,x,k,$]=u===a&&o?o:l.get(u)||[0,0,c.width,c.height];return S(Ib,{id:u,index:d,left:`${100*C/s}%`,top:n*x,width:`${100*k/s}%`,height:n*$,content:g??r,title:_,className:V(c.needLoad?"need-load":"",g?"has-content":""),onMenuBtnClick:p?this._handleMenuClick:void 0},c.id)})]})})}};Yp.defaultProps={responsive:!1,cache:!0,blocks:[],grid:3,gap:16,cellHeight:64,blockDefaultSize:[1,3],blockMenu:{items:[{text:"Refresh",data:{type:"refresh"}}]},onlyLoadVisible:!0,blockSizeMap:{xs:[1,3],sm:[1,4],md:[1,5],lg:[1,6],xl:[1,8],xsWide:[2,3],smWide:[2,4],mdWide:[2,5],lgWide:[2,6],xlWide:[2,8],xsLong:[3,3],smLong:[3,4],mdLong:[3,5],lgLong:[3,6],xlLong:[3,8]}};class bh extends ye{}bh.NAME="Dashboard",bh.Component=Yp;function wh(i,e,t,n){if(typeof i=="function"&&(i=i.call(this,e)),typeof i=="string"&&i.length&&(i={url:i}),!i)return Array.isArray(t)?S(yn,{children:t}):t;const{url:s,...r}=i,{setting:o}=e.col,a={};return o&&Object.keys(o).forEach(l=>{l.startsWith("data-")&&(a[l]=o[l])}),S("a",{href:be(s,e.row.data),...n,...r,...a,children:t})}function Ch(i,e,t){if(i==null)return;const n=e.row.data;return t=t??(n==null?void 0:n[e.col.name]),typeof i=="function"?i.call(this,t,e):be(i,{...n,0:t})}function Qp(i,e,t,n){var s;return t?(t=t??((s=e.row.data)==null?void 0:s[e.col.name]),t==="0000-00-00 00:00:00"||t==="0000-00-00"?n??"":i===!1?t:(i===!0&&(i="[yyyy-]MM-dd hh:mm"),typeof i=="function"&&(i=i.call(this,t,e)),rt(t,i,n??t))):n??t}function Jp(i,e){const{link:t}=e.col.setting,n=wh.call(this,t,e,i[0]);return n&&(i[0]=n),i}function Xp(i,e){const{format:t,digits:n}=e.col.setting;let s=i[0];return typeof n=="number"&&!Number.isNaN(Number(s))&&(s=Number(s),n>=0&&(s=s.toFixed(n))),t&&(s=Ch.call(this,t,e,s)),i[0]=s,i}function Zp(i,e){const{map:t,mapSplitter:n=",",mapJoiner:s}=e.col.setting;if(t){let r=i[0];typeof r=="string"&&n&&(r=r.split(n)),typeof t=="function"?i[0]=t.call(this,r,e):typeof t=="object"&&(Array.isArray(r)||(r=[r]),i[0]=r.map(o=>t[o]??o).join(s??n))}return i}function em(i,e,t){const n={};return typeof i=="function"?Object.assign(n,i.call(this,t)):Object.keys(i).forEach(s=>{var o;const r=(o=t.row.data)==null?void 0:o[i[s]];r!==void 0&&(n[s]=r)}),Object.keys(n).length&&e.push({style:n}),e}function tm(i,e,t="[yyyy-]MM-dd hh:mm"){const{formatDate:n=t,invalidDate:s}=e.col.setting;return i[0]=Qp.call(this,n,e,i[0],s),i}function xh(i,e,t=!1){const{html:n=t}=e.col.setting;if(n===!1)return i;const s=i[0],r=n===!0?s:Ch.call(this,n,e,s);return i[0]={html:r},i}const Nb=qe({name:"rich",colTypes:{html:{onRenderCell(i,e){return xh.call(this,i,e,!0)}},progress:{align:"center",onRenderCell(i,{col:e}){const{progressType:t,barColor:n,barBgColor:s,barHeight:r=6,barWidth:o=64,circleSize:a=24,circleBorderSize:l=1,circleBgColor:c="var(--color-border)",circleColor:d="var(--color-success-500)"}=e.setting,u=i[0];return i[0]=t==="bar"?S(yo,{className:"rounded-full",width:o,height:r,color:n||d,background:s,percent:u}):S(vo,{percent:u,size:a,circleWidth:l,circleBg:c,circleColor:d,text:!0}),i}},datetime:{formatDate:"[yyyy-]MM-dd hh:mm"},date:{formatDate:"yyyy-MM-dd"},time:{formatDate:"hh:mm"}},onRenderCell(i,e){const{formatDate:t,html:n,hint:s,styleMap:r}=e.col.setting;if(t&&(i=tm.call(this,i,e,t)),i=Zp.call(this,i,e),i=Xp.call(this,i,e),n?i=xh.call(this,i,e):i=Jp.call(this,i,e),s){let o=e.value;typeof s=="function"?o=s.call(this,e):typeof s=="string"?o=be(s,e.row.data):typeof i[0]=="string"&&(o=i[0]),i.push({attrs:{title:o}})}return r&&(i=em.call(this,r,i,e)),i}},{buildIn:!0}),Mb={default:(i,e,t)=>{var r,o;const n=(r=i.data)==null?void 0:r[t.name],s=(o=e.data)==null?void 0:o[t.name];return n===s?0:n==null?1:String(n).localeCompare(String(s))},date:(i,e,t)=>{var r,o;const n=je(((r=i.data)==null?void 0:r[t.name])??0),s=je(((o=e.data)==null?void 0:o[t.name])??0);return n.getTime()-s.getTime()},number:(i,e,t)=>{var r,o;const n=(r=i.data)==null?void 0:r[t.name],s=(o=e.data)==null?void 0:o[t.name];return Number.parseFloat(n)-Number.parseFloat(s)}},Eb=qe({name:"sort",defaultOptions:{sort:!1},when:i=>!!i.sort,onCreate(){const{sortBy:i}=this.options;i&&(this.state.sortBy=Array.isArray(i)?i:[i])},onAddRows(i,e){const{sortBy:t}=this.state;if(!t||!t.length)return;const{sort:n}=this.options,s={...Mb,...typeof n=="function"?{default:n}:typeof n=="object"?n:{}};return[...i].sort((r,o)=>{for(const{name:a,order:l}of t){const c=e.map[a];if(!c)continue;let d=c.setting.sort;if(d===!0?d=s.default:typeof d=="string"&&(d=s[d]),!d)continue;const u=d.call(this,r,o,c);if(u)return l==="asc"?u:-u}return 0})},onHeaderCellClick(i,e){if(!i.target.closest(".dtable-sort-link"))return;const t=this.getColInfo(e.colName);if(!t||!t.setting.sort)return;const{sortBy:n=[]}=this.state,s=n.findIndex(a=>a.name===t.name),{multiSort:r}=this.options;let o="asc";if(s>=0){const a=n[s].order;a==="asc"?o="desc":a==="desc"&&(o="none"),r&&n.splice(s,1)}r||(n.length=0),this.update({dirtyType:"layout",state:{sortBy:[{name:e.colName,order:o},...n].filter(a=>a.order!=="none")}})},onRenderHeaderCell(i,e){var l;const{col:t}=e,{sortBy:n}=this.state;if(!t.setting.sort)return i;const o=((l=n==null?void 0:n.find(c=>c.name===t.name))==null?void 0:l.order)||"none",a=S("div",{className:`dtable-sort dtable-sort-${o}`});return i[0]=S("a",{className:"dtable-sort-link",href:"javascript:;",children:[i[0],a]}),i.push({outer:!0,attrs:{"data-sort":o}}),i}},{buildIn:!0}),Ab={html:{component:vn}},nm=qe({name:"custom",onRenderCell(i,e){const{col:t}=e;let{custom:n}=t.setting;if(typeof n=="function"&&(n=n.call(this,e)),!n)return i;const s=Array.isArray(n)?n:[n],{customMap:r}=this.options;return s.forEach(o=>{let a;typeof o=="string"?a=o.startsWith("<")?{component:vn,props:{html:be(o,{value:e.value,...e.row.data,$value:e.value})}}:{component:o}:a=o;let{component:l}=a;const c=[a];typeof l=="string"&&c.unshift(Ab[l],r==null?void 0:r[l]);const d={};c.forEach(p=>{if(p){const{props:g}=p;g&&y.extend(d,typeof g=="function"?g.call(this,e):g),l=p.component||l}},{props:{}});const u=l;i[0]={outer:!0,className:"dtable-custom-cell",children:S(u,{...d})}}),i}}),Hx="";function Pb(i,e){var a,l;typeof i=="boolean"&&(e=i,i=void 0);const t=this.state.checkedRows,n={},{canRowCheckable:s,allowCheckDisabled:r}=this.options,o=(c,d)=>{const u=s?s.call(this,c):!0;!u||!r&&u==="disabled"||!!t[c]===d||(d?t[c]=!0:delete t[c],n[c]=d)};if(i===void 0?(e===void 0&&(e=!im.call(this)),(a=this.layout)==null||a.allRows.forEach(({id:c})=>{o(c,!!e)})):(Array.isArray(i)||(i=[i]),i.forEach(c=>{o(c,e??!t[c])})),Object.keys(n).length){const c=(l=this.options.beforeCheckRows)==null?void 0:l.call(this,i,n,t);c&&Object.keys(c).forEach(d=>{const u=s?s.call(this,d):!0;!u||!r&&u==="disabled"||(c[d]?t[d]=!0:delete t[d])}),this.setState({checkedRows:{...t}},()=>{var d;(d=this.options.onCheckChange)==null||d.call(this,n)})}return n}function Lb(i){return this.state.checkedRows[i]??!1}function im(){var s,r;const i=(s=this.layout)==null?void 0:s.allRows.length;if(!i)return!1;const e=this.getChecks().length,{canRowCheckable:t,allowCheckDisabled:n}=this.options;return t?e===((r=this.layout)==null?void 0:r.allRows.reduce((o,a)=>{const l=t?t.call(this,a.id):!0;return o+(!l||!n&&l==="disabled"?0:1)},0)):e===i}function Rb(){var e;const i=new Set((e=this.layout)==null?void 0:e.allRows.map(t=>t.id));return Object.keys(this.state.checkedRows).filter(t=>i.has(t))}function Ob(i){const{checkable:e}=this.options;i===void 0&&(i=!e),e!==i&&this.setState({forceCheckable:i})}function sm(i,e,t=!1,n=void 0){return S(Hi,{className:"dtable-checkbox",checked:i,disabled:t,label:n})}const rm='input[type="checkbox"],.dtable-checkbox',zb=qe({name:"checkable",defaultOptions:{checkable:"auto",checkboxRender:sm},when:i=>!!i.checkable,options(i){const{forceCheckable:e}=this.state;return e!==void 0?i.checkable=e:i.checkable==="auto"&&(i.checkable=!!i.cols.some(t=>t.checkbox)),i},state(){return{checkedRows:{}}},methods:{toggleCheckRows:Pb,isRowChecked:Lb,isAllRowChecked:im,getChecks:Rb,toggleCheckable:Ob},i18n:{zh_cn:{checkedCountInfo:"已选择 {selected} 项",totalCountInfo:"共 {total} 项"},zh_tw:{checkedCountInfo:"已選擇 {selected} 項",totalCountInfo:"共 {total} 項"},en:{checkedCountInfo:"Selected {selected} items",totalCountInfo:"Total {total} items"}},footer:{checkbox(){const i=this.isAllRowChecked();return[S("div",{style:{paddingRight:"calc(3*var(--space))",display:"flex",alignItems:"center"},onClick:()=>this.toggleCheckRows(),children:sm(i,void 0,!1,this.options.checkboxLabel)})]},checkedInfo(i,e){const t=this.getChecks(),{checkInfo:n}=this.options;if(n)return[S(me,{className:"dtable-check-info",content:n.call(this,t)})];const s=t.length,r=[];return s&&r.push(this.i18n("checkedCountInfo",{selected:s})),r.push(this.i18n("totalCountInfo",{total:e.allRows.length})),[S("div",{className:"dtable-check-info",children:r.join(", ")})]}},onCreate(){const{checkedRows:i}=this.options;i&&this.setState(e=>({checkedRows:{...e.checkedRows,...i.reduce((t,n)=>(t[n]=!0,t),{})}}))},onRenderCell(i,{row:e,col:t}){var c;const{id:n}=e,{canRowCheckable:s}=this.options,r=s?s.call(this,n):!0;if(!r)return i;const{checkbox:o}=t.setting,a=typeof o=="function"?o.call(this,n):o,l=this.isRowChecked(n);if(a){const d=(c=this.options.checkboxRender)==null?void 0:c.call(this,l,n,r==="disabled");i.push(d,{outer:!0,className:"has-checkbox"})}return l&&i.push({outer:!0,className:"is-checked"}),i},onRenderHeaderCell(i,{row:e,col:t}){var o;const{id:n}=e,{checkbox:s}=t.setting;if(typeof s=="function"?s.call(this,n):s){const a=this.isAllRowChecked(),l=(o=this.options.checkboxRender)==null?void 0:o.call(this,a,n);i.push(l,{outer:!0,className:"has-checkbox"})}return i},onHeaderCellClick(i){if(this.data.disableCheckable)return;const e=i.target;if(!e)return;const t=e.closest(rm);t&&this.toggleCheckRows(t.checked)},onCellClick(i,{rowID:e}){if(this.data.disableCheckable)return;const t=y(i.target);if(!t.length||t.closest("btn,a,button.not-checkable,.form-control,.btn").length)return;(t.closest(rm).not(".disabled").length||this.options.checkOnClickRow)&&this.toggleCheckRows(e)}}),Fb=qe({name:"store",defaultOptions:{store:!0},when:i=>!!i.store,data(){return{store:new Ls(`DTable:${this.id}`)}}}),Vx="",Kx="";var om=(i=>(i.unknown="",i.collapsed="collapsed",i.expanded="expanded",i.hidden="hidden",i.normal="normal",i))(om||{});function ma(i){const e=this.data.nestedMap.get(i);if(!e||e.state!=="")return e??{state:"normal",level:-1};if(!e.parent&&!e.children)return e.state="normal",e;const t=e.children&&this.state.nestedState[i];let n=!1,{parent:s}=e;for(;s;){const r=ma.call(this,s);if(r.state!=="expanded"){n=!0;break}s=r.parent}return e.state=n?"hidden":t?"collapsed":e.children?"expanded":"normal",e.level=e.parent?ma.call(this,e.parent).level+1:0,e}function jb(i){return i!==void 0?ma.call(this,i):this.data.nestedMap}function Bb(i,e){let{nestedState:t}=this.state;const{nestedMap:n}=this.data;if(i==="HEADER")if(e===void 0&&(e=!am.call(this)),e){const s=n.entries();for(const[r,o]of s)o.state==="expanded"&&(t[r]=!0)}else t={};else{const s=Array.isArray(i)?i:[i];e===void 0&&(e=!t[s[0]]),s.forEach(r=>{const o=n.get(r);e&&(o!=null&&o.children)?t[r]=!0:delete t[r]})}this.update({dirtyType:"layout",state:{nestedState:{...t}}},()=>{const{onNestedChange:s,preserveNested:r}=this.options;s==null||s.call(this),r&&this.data.store.set("nestedState",t)})}function am(){const i=this.data.nestedMap.values();for(const e of i)if(e.state==="expanded")return!1;return!0}function lm(i,e=1,t,n=0){var s;t||(t=[...i.keys()]);for(const r of t){const o=i.get(r);o&&(o.level===n&&(o.order=e++),(s=o.children)!=null&&s.length&&(e=lm(i,e,o.children,n+1)))}return e}function cm(i,e,t,n){const s=i.getNestedRowInfo(e);return!s||s.state===""||!s.children||s.children.forEach(r=>{n[r]=t,cm(i,r,t,n)}),s}function hm(i,e,t,n,s){var a;const r=i.getNestedRowInfo(e);if(!r||r.state==="")return;((a=r.children)==null?void 0:a.every(l=>{const c=!!(n[l]!==void 0?n[l]:s[l]);return t===c}))&&(n[e]=t),r.parent&&hm(i,r.parent,t,n,s)}const ga="dtable-nested-toggle",Hb=qe({name:"nested",plugins:[Fb],requireAfter:["sortable"],defaultOptions:{nested:"auto",nestedParentKey:"parent",asParentKey:"asParent",nestedIndent:20,canSortTo(i,e){const{nestedMap:t}=this.data,n=t.get(i.id),s=t.get(e.id);return(n==null?void 0:n.parent)===(s==null?void 0:s.parent)},beforeCheckRows(i,e,t){if(!this.options.checkable||!(i!=null&&i.length)||this.options.noNestedCheck)return;const n={};return Object.entries(e).forEach(([s,r])=>{const o=cm(this,s,r,n);o!=null&&o.parent&&hm(this,o.parent,r,n,t)}),n}},options(i){return i.nested==="auto"&&(i.nested=!!i.cols.some(e=>e.nestedToggle)),i},when:i=>!!i.nested,data(){return{nestedMap:new Map,nestedRowMap:new Map}},state(){return{nestedState:{}}},methods:{getNestedInfo:jb,toggleRow:Bb,isAllCollapsed:am,getNestedRowInfo:ma},onCreate(){let{defaultNestedState:i}=this.options;if(this.options.preserveNested){const e=this.data.store.get("nestedState");e&&(i=e)}if(i===!0){const{data:e,rowKey:t="id"}=this.options;Array.isArray(e)&&(i=e.reduce((n,s)=>(n[typeof s=="string"?s:s[t]]=!0,n),{}))}this.state.nestedState=i||{}},onMounted(){this.options.defaultNestedState===!0&&!this.options.preserveNested&&this.toggleRow("HEADER",!0)},beforeLayout(){this.data.nestedMap.clear(),this.data.nestedRowMap.clear()},onAddRow(i){this.data.nestedRowMap.set(i.id,i)},onAddRows(i){const{nestedMap:e,nestedRowMap:t}=this.data;i.forEach(r=>{var c,d;const o=e.get(r.id)??{state:"",level:0};let a=((c=r.data)==null?void 0:c[this.options.nestedParentKey??"parent"])??[];Array.isArray(a)||(a=[a]);let l;for(a=[...a];a.length;){let u=a.pop();if(u===void 0)continue;if(u=String(u),t.get(u)){l=u;break}}if(o.parent=l==="0"?void 0:l,(d=r.data)!=null&&d[this.options.asParentKey??"asParent"]&&(o.children=[]),e.set(r.id,o),l){let u=e.get(l);u||(u={state:"",level:0},e.set(l,u)),u.children||(u.children=[]),u.children.push(r.id)}});const n=new Map,s=i.length*100;return i=i.filter(r=>{const o=this.getNestedRowInfo(r.id);return n.set(r.id,o),o.state!=="hidden"}),lm(n),i.sort((r,o)=>{const a=n.get(r.id),l=n.get(o.id);return((a==null?void 0:a.order)??s+r.index)-((l==null?void 0:l.order)??s+o.index)}),i},onRenderCell(i,e){var c;const{row:t,col:n}=e,{id:s,data:r}=t,{nestedToggle:o,childLabel:a}=n.setting,l=this.getNestedRowInfo(s);if(a){const d=Number(r[this.options.nestedParentKey||"parent"]);if(!Number.isNaN(d)&&d>0){let u;typeof a=="string"?u=S("span",{className:"dtable-child-label label rounded-full size-sm gray-pale",children:be(a,r)}):u=S(me,{className:"dtable-child-label",content:a,generatorThis:e}),i.unshift(u)}}if(o&&(l.children||l.parent)&&i.push(((c=this.options.onRenderNestedToggle)==null?void 0:c.call(this,l,s,n,r))??S("a",{className:`${ga} state${l.children?"":" is-no-child"}`,children:S("span",{className:"toggle-icon"})}),{outer:!0,className:`is-${l.state}`}),l.level){let{nestedIndent:d=o}=n.setting;d&&(d===!0&&(d=this.options.nestedIndent??12),i.push(S("div",{className:"dtable-nested-indent",style:{width:d*l.level+"px"}})))}return i},onRenderHeaderCell(i,{row:e,col:t}){var s;const{id:n}=e;return t.setting.nestedToggle&&i.push(((s=this.options.onRenderNestedToggle)==null?void 0:s.call(this,void 0,n,t,void 0))??S("a",{className:`${ga} state`,children:S("span",{className:"toggle-icon"})}),{outer:!0,className:`is-${this.isAllCollapsed()?"collapsed":"expanded"}`}),i},onHeaderCellClick(i){const e=i.target;if(!(!e||!e.closest(`.${ga}`)))return this.toggleRow("HEADER"),!0},onCellClick(i,{rowID:e}){const t=i.target;if(!(!t||!this.getNestedRowInfo(e).children||!t.closest(`.${ga}`)))return this.toggleRow(e),!0}});function kh(i,{row:e,col:t}){const{data:n}=e,s=n?n[t.name]:void 0;if(!(s!=null&&s.length))return i;const{avatarClass:r="rounded-full",avatarKey:o=`${t.name}Avatar`,avatarCodeKey:a,avatarNameKey:l=`${t.name}Name`}=t.setting;let{avatarProps:c={}}=t.setting;typeof c=="function"&&(c=c(t,e));const d=(n?n[l]:s)||i[0],u={size:"xs",src:n?n[o]:void 0,text:d,code:a?n?n[a]:void 0:s,...c,className:V(r,c.className,"flex-none")};if(i[0]=S(Bi,{...u}),t.type==="avatarBtn"){const{avatarBtnProps:p}=t.setting,g=typeof p=="function"?p(t,e):p;i[0]=S("button",{type:"button",className:"btn btn-avatar",...g,children:[i[0],S("div",{children:d})]})}else t.type==="avatarName"&&(i[0]=S("div",{className:"flex items-center gap-1",children:[i[0],S("span",{children:d})]}));return i}const Wb=qe({name:"avatar",colTypes:{avatar:{onRenderCell:kh},avatarBtn:{onRenderCell:kh},avatarName:{onRenderCell:kh}}},{buildIn:!0}),Ub=qe({name:"sort-type",defaultOptions:{sortType:!0},when:i=>!!i.sortType&&!i.sort,onRenderHeaderCell(i,e){const{col:t}=e,{setting:n}=t;let{sortType:s}=n;if(t.setting.sort!==void 0||s===!1)return i;const{sortLink:r,orderBy:o}=this.options;if(o&&o[t.name]!==void 0&&(s=o[t.name]),s){const a=s===!0?"none":s,l=S("div",{className:`dtable-sort dtable-sort-${a}`});i.push({outer:!0,attrs:{"data-sort":a}});let{sortLink:c=r}=n;if(c){const d=a==="asc"?"desc":"asc";typeof c=="function"&&(c=c.call(this,t,d,a)),typeof c=="string"&&(c={url:c});const{url:u,...p}=c;i[0]=S("a",{className:"dtable-sort-link",href:be(u,{...n,sortType:d}),...p,children:[typeof i[0]!="object"||I.isValidElement(i[0])?i[0]:t.name,l]})}else i.push(l)}return i}},{buildIn:!0}),Sh=i=>{i.length!==1&&i.forEach((e,t)=>{!t||e.border!==void 0||e.setting.group===i[t-1].setting.group||(e.border="left")})},Vb=qe({name:"group",defaultOptions:{groupDivider:!0},when:i=>!!i.groupDivider,onLayout(i){if(!this.options.groupDivider)return;const{cols:e}=i;Sh(e.left.list),Sh(e.center.list),Sh(e.right.list)}}),Jx="",Kb=qe({name:"header-group",defaultOptions:{headerGroup:!0},data(){return{headerGroups:new Map}},when:i=>!!i.headerGroup,beforeLayout(i){const{headerGroups:e}=this.data;e.clear();const{cols:t}=i;if(!(t!=null&&t.length))return;const n={};return t.forEach((s,r)=>{const{headerGroup:o}=s;if(!o){n[s.name]=r;return}let a=e.get(o);a?a.cols.push(s.name):(a={cols:[s.name],index:r},e.set(o,a)),n[s.name]=a.index+a.cols.length/t.length}),t.sort((s,r)=>n[s.name]-n[r.name]),{headerHeight:!i.headerHeight&&i.rowHeight?i.rowHeight*2:void 0,cols:t}},onRenderHeaderCell(i,{col:e}){const{headerGroup:t}=e.setting;if(t){const n=this.data.headerGroups.get(t),s=this.layout.headerHeight/2;if(e.name===n.cols[0]){const r=n.cols.reduce((a,l)=>{var c;return a+(((c=this.getColInfo(l))==null?void 0:c.realWidth)??0)},0),o={height:s-1,width:r-1};i.push(S("div",{class:"dtable-header-group",style:o,children:t}))}i.push({className:"dtable-header-as-group",style:{paddingTop:s}})}return i}}),qb=qe({name:"cellspan",when:i=>!!i.getCellSpan,data(){return{cellSpanMap:new Map,overlayedCellSet:new Set}},onLayout(i){const{getCellSpan:e}=this.options;if(!e)return;const{cellSpanMap:t,overlayedCellSet:n}=this.data,{rows:s,cols:r,rowHeight:o}=i;t.clear(),n.clear();const a=(l,c,d)=>{const{index:u}=c;l.forEach((p,g)=>{const{index:_}=p,C=`C${_}R${u}`;if(n.has(C))return;const x=e.call(this,{row:c,col:p});if(!x)return;const k=Math.min(x.colSpan||1,l.length-g),$=Math.min(x.rowSpan||1,s.length-d);if(k<=1&&$<=1)return;let E=0;for(let z=0;z{["left","center","right"].forEach(d=>{a(r[d].list,l,c)})})},onRenderCell(i,{row:e,col:t}){const n=`C${t.index}R${e.index}`;if(this.data.overlayedCellSet.has(n))i.push({outer:!0,style:{display:"none",className:"cellspan-overlayed-cell"}});else{const s=this.data.cellSpanMap.get(n);s&&i.push({outer:!0,style:{width:s.width,height:s.height}})}return i}}),ya=qe({name:"mousemove",events:{click(i){this.data.ignoreNextClick&&(i.preventDefault(),this.data.ignoreNextClick=void 0)},mousedown(){this.data.ignoreNextClick&&clearTimeout(this.data.ignoreNextClick)},mousemove(i){this.data.mmRafID&&cancelAnimationFrame(this.data.mmRafID),this.data.mmRafID=requestAnimationFrame(()=>{this.emitCustomEvent("mousemovesmooth",i),this.data.mmRafID=0}),i.preventDefault()},document_mousemove(i){this.data.dmmRafID&&cancelAnimationFrame(this.data.dmmRafID),this.data.dmmRafID=requestAnimationFrame(()=>{this.emitCustomEvent("document_mousemovesmooth",i),this.data.mmRafID=0})}},methods:{ignoreNextClick(i=10){this.data.ignoreNextClick&&clearTimeout(this.data.ignoreNextClick),this.data.ignoreNextClick=window.setTimeout(()=>{this.data.ignoreNextClick=void 0},i)}}});function Gb(){var E,z,H,Y;const{scrollToMouse:i}=this.data;if(!i)return this.stopScrollToMouse();const{position:e,startTime:t,delay:n}=i;if(!e||Date.now()-tC-a&&(x=Math.max(o,d-(C-a)));let k=0;if(ug-a&&(k=Math.max(o,u-(g-a))),c){const G=new Set((Array.isArray(c)?c:[c]).reduce((X,ee)=>(ee==="x"?X.push("left","right"):ee==="y"?X.push("top","bottom"):X.push(ee),X),[]));(!G.has("left")&&x<0||!G.has("right")&&x>0)&&(x=0),(!G.has("top")&&k<0||!G.has("bottom")&&k>0)&&(k=0)}const $={};x!==0&&($.scrollLeft=this.layout.scrollLeft+l*x),k!==0&&($.scrollTop=this.layout.scrollTop+l*k),this.scroll($)}const um=qe({name:"autoscroll",plugins:[ya],events:{document_mousemovesmooth(i){if(!this.data.scrollToMouse)return;const{clientX:e,clientY:t}=i;this.data.scrollToMouse.position={x:e,y:t}}},methods:{scrollTo({col:i,row:e,extra:t=2}){const n=this.getColInfo(i),s=this.getRowInfo(e);if(!n&&!s)return!1;const r={},{layout:o}=this;if(n){const{scrollLeft:a,cols:l}=o,c=n.left+n.realWidth;n.leftl.center.width+a&&(r.scrollLeft=c-l.center.width+t)}if(s){const{scrollTop:a,rowHeight:l,rowsHeight:c}=o,d=s.top+l;s.topc+a&&(r.scrollTop=d-c+t)}return this.scroll(r),!0},startScrollToMouse(i){const e={interval:60,speed:.5,delay:200,maxStep:this.options.rowHeight,onlyInside:!1,detectPadding:30,startTime:Date.now(),...i};this.data.scrollToMouse=e,clearInterval(this.data.scrollToTimer),this.data.scrollToTimer=window.setInterval(Gb.bind(this),e.interval)},stopScrollToMouse(){clearInterval(this.data.scrollToTimer),this.data.scrollToMouse=void 0}},onUnmounted(){clearInterval(this.data.scrollToTimer)}}),nk="",Yb=qe({name:"sortable",defaultOptions:{sortable:!0},when:i=>!!i.sortable,plugins:[ya,um],resetState:!0,state(){return{rowOrders:void 0,sortingFrom:void 0,sortingPos:void 0,sortingTo:void 0,sortingSide:void 0}},events:{click(i){i.target.closest(".dtable-sort-link")&&(this.state.rowOrders=void 0)},mousedown(i){var a;if(this.data.disableSortable)return;const{sortHandler:e=".dtable-cell"}=this.options;if(!y(i.target).closest(e).length)return;const s=this.getPointerInfo(i);if(!s||s.rowID==="HEADER")return;const r=this.getRowInfo(s.rowID);if(!r||((a=this.options.onSortStart)==null?void 0:a.call(this,r,i))===!1)return;i.preventDefault();const o=i.clientY;this.data.sortableInfo={from:r,offset:o-s.cellElement.getBoundingClientRect().top,startMouseY:o,lastMouseY:o}},document_mouseup(i){var n;const{sortableInfo:e}=this.data;if(!e)return;this.stopScrollToMouse();const t=this.getSortingState(i);if(t){let s,r;const{sortingFrom:o,sortingTo:a,sortingSide:l}=t;if(a&&l){const c=this.layout.rows.map(g=>g.id),d=[...c],u=o.index,p=a.index;if(!(u===p+1&&l==="after")&&!(u===p-1&&l==="before")){const g=c.splice(u,1);c.splice(p,0,g[0]),s={},r=[],c.forEach((_,C)=>{s[_]=C,r.push(_)}),(d.join()===r.join()||((n=this.options.onSort)==null?void 0:n.call(this,o,a,l,r))===!1)&&(s=void 0,r=void 0)}}(a||Math.abs(e.lastMouseY-e.startMouseY)>4)&&this.ignoreNextClick(),this.disableAnimation(),this.update({dirtyType:"layout",state:c=>y.extend({sortingFrom:void 0,sortingPos:void 0,sortingTo:void 0,sortingSide:void 0},s?{rowOrders:{...c.rowOrders,...s}}:null)},()=>{var c;(c=this.options.onSortEnd)==null||c.call(this,o,a,l,r),setTimeout(()=>{this.data.disableCheckable=void 0},50)})}this.data.sortableInfo=void 0},document_mousemovesmooth(i){const{sortableInfo:e}=this.data;if(!e)return;const t=this.getSortingState(i);t&&(e.state||(this.startScrollToMouse({side:"y"}),this.data.disableCheckable=!0),e.lastMouseY=i.clientY,e.state=t,this.setState(t))}},methods:{getSortingState(i){var Y;const{disableSortable:e,sortableInfo:t}=this.data;if(e||!t)return;const{headerHeight:n,footerHeight:s,visibleRows:r,scrollTop:o,rowHeight:a}=this.layout,l=this.element.getBoundingClientRect(),c=l.width,d=l.height-n-s,u=i.clientX-l.left,p=i.clientY-l.top-n;if(u<0||u>c||p<0||p>d)return t.state;const g=p+o,_=r.find(G=>G.top<=g&&G.top+a>g);if(!_)return t.state;const C=t.from,x=_.id!==C.id?_.id:void 0,k=x?this.getRowInfo(x):void 0,$=p,E=g<_.top+a/2?"before":"after";return k&&((Y=this.options.canSortTo)==null?void 0:Y.call(this,C,k,E))!==!1?{sortingFrom:C,sortingPos:$,sortingTo:k,sortingSide:E}:{sortingFrom:C,sortingPos:$,sortingTo:void 0,sortingSide:void 0}}},onAddRows(i){const{rowOrders:e}=this.state;if(!e)return;const t=i.length*100;return i=i.sort((n,s)=>{const r=e[n.id]??t+n.index,o=e[s.id]??t+s.index;return r-o}),i},beforeRender(i){const{sortingFrom:e}=this.state,{visibleRows:t}=i;e&&(t.some(n=>n.id===e.id)||(i.visibleRows=[...t,e]),i.className=V(i.className,"dtable-sorting"))},onRenderCell(i,e,t){const{sortingFrom:n,sortingPos:s,sortingTo:r,sortingSide:o}=this.state;if(!n)return i;const a=e.row,l={},c=[];if(n.id===a.id)l.top=s-this.data.sortableInfo.offset+((t.top??a.top)-(a.top-this.layout.scrollTop)),c.push("is-sorting-from");else if(r){const d=r.id===a.id;d&&c.push(`text-primary is-sorting-to is-sorting-to-${o}`),n.index>a.index&&(d&&o==="before"||a.index>r.index)?c.push("is-sorting-before"):n.index{t.type==="size-menu"&&t.caret===void 0&&(t.caret="up")}),this.options.localPager&&(Object.assign(i,{...typeof e=="object"?e:null,...this.state.pager,recTotal:this.layout.allRows.length,useState:!0}),i.onChangePageInfo=t=>{this.update({dirtyType:"layout",state:n=>({pager:{...n.pager,...t}})})}),[S(Qs,{...i})]):[]}},onAddRows(i){const{localPager:e}=this.options;if(e){const{page:t=1,recPerPage:n=20}={...typeof e=="object"?e:null,...this.state.pager},s=(t-1)*n,r=Math.min(t*n,i.length);return i.slice(s,r)}}}),Qb=Object.freeze(Object.defineProperty({__proto__:null,NestedRowState:om,avatar:Wb,cellspan:qb,checkable:zb,custom:nm,group:Vb,headerGroup:Kb,nested:Hb,pager:dm,renderDatetime:Qp,renderDatetimeCell:tm,renderFormat:Ch,renderFormatCell:Xp,renderHtmlCell:xh,renderLink:wh,renderLinkCell:Jp,renderMapCell:Zp,renderStyleMapCell:em,rich:Nb,sort:Eb,sortType:Ub,sortable:Yb},Symbol.toStringTag,{value:"Module"}));class us extends ye{setOptions(e,t){return e=super.setOptions(e,t),e.parent||(e.parent=this.element),e}}us.NAME="DTable",us.Component=rs,us.definePlugin=qe,us.removePlugin=Jf,us.plugins=Qb;const rk="",ok="",ak="",lk="",ck="",hk="",uk="";class Th extends He{_getClassName(e){return["kanban-header-col",e.className,e.subCols?"has-subs":"",e.parentName!==void 0?"is-sub":""]}_getProps(e){const{width:t,color:n,name:s,gapLeft:r,gapRight:o}=e;return xe(super._getProps(e),{style:{"--kanban-col-color":n,"--kanban-col-width":Ve(t),"--kanban-col-gap-left":Ve(r),"--kanban-col-gap-right":Ve(o)},"z-col":s})}_getChildren(e){const{prefix:t,prefixClass:n,title:s,titleClass:r,titleAlign:o="center",subtitle:a,subtitleClass:l,icon:c,trailingIcon:d,actions:u,subCols:p}=e;return[S("div",{className:`kanban-header-col-wrapper is-align-${o}`,children:[S("div",{className:"kanban-header-title",children:[c?S(Ie,{className:"as-leading-icon",icon:c},"icon"):null,t?S("span",{className:V("as-prefix",n),children:S(me,{content:t})},"prefix"):null,s?S("span",{className:V("as-title",r),title:typeof s=="string"?s:void 0,children:S(me,{content:s})},"title"):null,a?S("span",{className:V("as-subtitle",l),children:S(me,{content:a})},"subtitle"):null,d?S(Ie,{className:"as-trailing-icon",icon:d},"trailingIcon"):null]},"title"),Oe.render(u,[e],{key:"actions",className:"kanban-header-col-actions",size:"sm"},this)]},"wrapper"),p?S("div",{className:"kanban-header-sub-cols",children:p.map((g,_)=>S(Th,{index:_,...g},g.name))},"subs"):null]}}class Jb extends pe{constructor(){super(...arguments),this._ref=de()}componentDidMount(){this._ref.current&&(this._sticky=no.ensure(this._ref.current,{scrollContainer:".kanban-list"}))}componentWillUnmount(){var e;(e=this._sticky)==null||e.destroy()}render(e){return S("div",{className:"kanban-header",ref:this._ref,children:[S("div",{className:"kanban-header-lane-name"},"name"),S("div",{className:"kanban-header-cols",children:e.cols.map((t,n)=>S(Th,{index:n,...t},t.name))},"cols")]})}}class fm extends pe{constructor(){super(...arguments),this._listRef=de(),this._renderItem=e=>{const{itemRender:t,lane:n,name:s}=this.props;return t.call(this,{item:e,lane:n,col:s})},this._handleScroll=e=>{const{current:t}=this._listRef;t&&y(t).trigger("laneColScroll",e)}}componentDidMount(){const{current:e}=this._listRef;e&&(this._ob=new ResizeObserver(t=>{y(this._listRef.current).trigger("laneColResize",t[0])}),this._ob.observe(e))}componentWillUnmount(){var e;(e=this._ob)==null||e.disconnect()}render(e){const{items:t}=e,{width:n,color:s,content:r,contentClass:o,itemRender:a,itemGap:l,watchSize:c,name:d,lane:u,itemCountPerRow:p,gapLeft:g,gapRight:_,laneColClass:C}=e,x={"--kanban-col-color":s,"--kanban-col-width":Ve(n),"--kanban-col-gap-left":Ve(g),"--kanban-col-gap-right":Ve(_)};return S("div",{className:V("kanban-lane-col",C),style:x,"z-lane":u,"z-col":d,children:[r?S("div",{className:V("kanban-col-content",o),children:S(me,{content:r,generatorThis:this,generatorArgs:[e]})}):null,S("div",{className:"kanban-items scrollbar-thin scrollbar-hover",onScroll:this._handleScroll,children:S(cs,{forwardRef:c?this._listRef:void 0,itemProps:{className:"kanban-item card-list-item"},items:t,itemRender:a?this._renderItem:void 0,countPerRow:p,gap:l},"list")})]})}}fm.defaultProps={watchSize:!0};class Xb extends He{_getClassName(e){const{className:t,index:n,maxHeight:s,height:r}=e;return["kanban-lane",t,{"is-first":!n,"is-auto-height":!s&&(!r||r==="auto")}]}_getProps(e){const{height:t,minHeight:n,maxHeight:s,color:r,name:o,gapTop:a,gapBottom:l}=e;return xe(super._getProps(e),{style:{"--kanban-lane-color":r,height:Ve(t),minHeight:Ve(n),maxHeight:Ve(s),"--kanban-col-gap-top":Ve(a),"--kanban-col-gap-bottom":Ve(l)},"z-lane":o})}_renderCol(e,t,n,s,r){if(r){const o=r(e,t);o&&(t={...t,...o})}return S(fm,{itemRender:n,lane:e.name,items:s[t.name],...t},t.name)}_getChildren(e){const{title:t,titleClass:n,actions:s,cols:r,items:o={},hideName:a,itemRender:l,getLaneCol:c}=e;return[a?null:S("div",{className:"kanban-lane-name",children:[Oe.render(s,[e],{key:"actions",className:"kanban-lane-actions",size:"sm"},this),S("div",{className:V("kanban-lane-title",n),title:typeof t=="string"?t:void 0,children:S(me,{content:t})},"title")]},"name"),S("div",{className:"kanban-lane-cols",children:r.reduce((d,u)=>(u.subCols?u.subCols.forEach(p=>{d.push(this._renderCol(e,p,l,o,c))}):d.push(this._renderCol(e,u,l,o,c)),d),[])},"cols")]}}function Zb(i){const{lanes:e,cols:t,items:n={},itemRender:s,hideLaneName:r,getLaneCol:o}=i;return S("div",{className:"kanban-body",children:e.map((a,l)=>S(Xb,{index:l,cols:t,items:n[a.name],hideName:r,itemRender:s,getLaneCol:o,...a},a.name))})}const zt=12,ew={left:"right",right:"left",top:"bottom",bottom:"top","":""},Wn=({from:i,to:e,fromKanban:t,toKanban:n})=>`${t?`${t}_`:""}${i}-${n?`${n}_`:""}${e}`;function pm(i,e){return e==="top"?{x:i.x+i.width/2,y:i.y}:e==="left"?{x:i.x,y:i.y+i.height/2}:e==="right"?{x:i.x+i.width,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height}}function tw(i,e){return(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)}function nw(i,e,t,n){const s=t?[t]:["left","right","top","bottom"],r=n?[n]:["left","right","top","bottom"];let o=Number.MAX_SAFE_INTEGER,a={x:0,y:0},l={x:0,y:0};return s.forEach(c=>{r.forEach(d=>{const u=pm(i,c),p=pm(e,d),g=tw(u,p)*(ew[c]===d?1:2);g{this.setState({hover:e.type==="mouseenter"})},this._onDelete=()=>{var e;(e=this.props.onDelete)==null||e.call(this,this.props)}}render(e,t){const{text:n,textSize:s,color:r,onDelete:o,weight:a=1.5,from:l,to:c}=e,{hover:d}=t,{x:u,y:p,padding:g,width:_,height:C,svgProps:x,markers:k,svgPathProps:$,svgPathBackProps:E,fromPos:z}=rw(e);return S("div",{className:V("kanban-link",d?"is-hover":""),style:{left:u,top:p,width:_,height:C,color:r,"--kanban-link-weight":a},"z-from":l,"z-to":c,onMouseEnter:o?this._handleMouseHover:void 0,onMouseLeave:o?this._handleMouseHover:void 0,children:[S("svg",{...x,xmlns:"http://www.w3.org/2000/svg",version:"1.1",children:[k.length?S("defs",{children:k.map(({path:H,id:Y,...G})=>S("marker",{...G,id:Y,children:S("path",{...H})},Y))}):null,S("path",{...E}),S("path",{...$})]}),S("div",{className:"kanban-link-start-point",style:{left:z.x-g,top:z.y-g}}),o?S("div",{className:"kanban-link-delete-btn",children:S("button",{type:"button",className:"btn rounded-full size-sm square primary",onClick:this._onDelete,children:S("i",{className:"close"})})}):null,n?S("div",{className:"kanban-link-text",style:{fontSize:`${s||12}px`},children:n}):null]})}}const ar=".kanban";class ow extends pe{constructor(){super(...arguments),this._ref=de(),this.state={}}componentDidMount(){const e=this._ref.current,{container:t=".kanban"}=this.props,n=e.closest(t),s=y(n);this._container=n,this._multiKanban=s.find(".kanban").length>1;const r=".kanban-item,.kanban-link-editor-from";s.on(`mouseenter${ar}`,r,o=>{if(this.state.dragPos)return;clearTimeout(this._leaveTimer);const a=y(o.target).closest(r),l=a.z("key");this.state.from===l||a.hasClass("is-dragging")||this.setState({from:l,fromKanban:this._multiKanban?a.closest(".kanban").z("key"):void 0,to:void 0,fromRect:this._getRect(a.children()[0]),dragPos:void 0})}).on(`mouseleave${ar}`,r,()=>{this.state.dragPos||(clearTimeout(this._leaveTimer),this._leaveTimer=window.setTimeout(()=>{this._cancelHover(),this._leaveTimer=0},200))}).on(`dragstart${ar}`,".kanban-item",()=>{this.state.dragPos||this._cancelHover()}).on(`laneColScroll${ar}`,o=>{const{from:a}=this.state;a&&this.setState({fromRect:this._getRect(y(o.target).find(`.kanban-item[z-key="${a}"]`).children()[0])})}),this._moveable=new Bs(e,{selector:".kanban-link-editor-point",move:"none",onMoveStart:()=>{if(!this.state.from)return!1;s.addClass("is-adding-link")},onMove:o=>{const{top:a,left:l}=n.getBoundingClientRect(),c={left:o.clientX-l+n.scrollLeft,top:o.clientY-a+n.scrollTop};let d,u,p;const g=y(o.target).closest(r);g.length&&d!==this.state.from&&(d=g.attr("z-key"),p=this._multiKanban?g.closest(".kanban").z("key"):void 0,u=this._getRect(g.children()[0])),this.setState({dragPos:c,to:d,toKanban:p,toRect:u})},onMoveEnd:()=>{const{from:o,fromKanban:a,to:l,toKanban:c}=this.state,{onAddLink:d}=this.props;(o!==l||a!==c)&&d&&o!==void 0&&l!==void 0&&(d==null||d.call(this,{from:o,fromKanban:a,to:l,toKanban:c})),this._cancelHover(),s.removeClass("is-adding-link")}})}componentWillUnmount(){var t;const e=(t=this._ref.current)==null?void 0:t.closest(".kanban");e&&y(e).off(ar),this._raf&&cancelAnimationFrame(this._raf)}_getRect(e){const t=e.getBoundingClientRect(),n=this._container,{top:s,left:r}=n.getBoundingClientRect();return{left:t.left-r+n.scrollLeft,top:t.top-s+n.scrollTop,width:t.width,height:t.height}}_cancelHover(){this.setState({from:void 0,to:void 0,fromRect:void 0,dragPos:void 0})}_renderLink(e){const{fromRect:t,toRect:n,from:s,to:r="",dragPos:o}=e;if(!t||!s||!o)return null;const a=n?{left:n.left,top:n.top,right:n.left+n.width,bottom:n.top+n.height}:{left:o.left,top:o.top,right:o.left,bottom:o.top};return S(ym,{from:s,to:r,lineStyle:"dotted",color:"var(--color-primary-500)",fromRect:{left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height},toRect:a},"link")}render(e,t){const{from:n,fromRect:s,to:r,toRect:o}=t;let a,l;return n&&s&&(a=S("div",{className:"kanban-link-editor-from not-moveable","z-key":n,style:s,children:[S("div",{className:"kanban-link-editor-point is-left"}),S("div",{className:"kanban-link-editor-point is-top"}),S("div",{className:"kanban-link-editor-point is-right"}),S("div",{className:"kanban-link-editor-point is-bottom"})]})),r&&o&&(l=S("div",{className:"kanban-link-editor-to","z-key":r,style:o})),S("div",{className:V("kanban-link-editor"),ref:this._ref,children:[a,l,this._renderLink(t)]})}}const $h=".kanban";class vm extends pe{constructor(){super(...arguments),this._ref=de(),this._watchSet=new Set,this.state={layout:{},scrollTop:0,scrollLeft:0}}componentDidMount(){var s;const{container:e=".kanban"}=this.props,t=(s=this._ref.current)==null?void 0:s.closest(e),n=y(t);this._multiKanban=n.find(".kanban").length>1,n.on(`laneColResize${$h} laneColScroll${$h}`,()=>{this._tryUpdateLayout()}),this._container=t,this._tryUpdateLayout()}componentWillUnmount(){const e=this._container;e&&y(e).off($h),this._raf&&cancelAnimationFrame(this._raf)}componentDidUpdate(e){(e.links!==this.props.links||e.filters!==this.props.filters)&&this._tryUpdateLayout()}_tryUpdateLayout(){this._raf&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._updateLayout(),this._raf=0})}_updateLayout(){const e=[...this._watchSet],t=this._container,n=y(t),{top:s,left:r}=t.getBoundingClientRect(),o=t.scrollTop-s,a=t.scrollLeft-r,l={};e.forEach(c=>{const[d,u]=c.split("_"),p=n.find(`${this._multiKanban?`.kanban[z-key="${d}"] `:""}.kanban-item[z-key="${u}"]`).children()[0];if(p&&Ns(p,{container:".kanban-lane-col"})){const{top:g,left:_,bottom:C,right:x}=p.getBoundingClientRect();l[c]={top:g+o,left:_+a,bottom:C+o,right:x+a}}}),this.setState({layout:l})}_renderLink(e){const{layout:t}=this.state,{from:n,fromKanban:s="",to:r,toKanban:o=""}=e,a=`${s}_${n}`,l=`${o}_${r}`,c=t[a],d=t[l];return this._watchSet.add(a),this._watchSet.add(l),!c||!d?null:S(ym,{...e,fromRect:c,toRect:d,onDelete:this.props.onDeleteLink},`${n}-${r}`)}_renderLinks(e){const{links:t,filters:n}=e,s=new Set(n),r=o=>{const{from:a,to:l,fromKanban:c="",toKanban:d=""}=o;return this._multiKanban?s.has(`${c}_${a}`)||s.has(`${d}_${l}`)||s.has(c)||s.has(d)||s.has(Wn(o)):s.has(a)||s.has(l)||s.has(`${a}-${l}`)};return t.reduce((o,a)=>{if(!n||r(a)){const l=this._renderLink(a);l&&o.push(l)}return o},[])}_renderEditor(e){const{editLinks:t,onAddLink:n,container:s}=e;return t?S(ow,{container:s,onAddLink:n},"editor"):null}render(e){return this._watchSet.clear(),S("div",{className:"kanban-links",ref:this._ref,children:[this._renderLinks(e),this._renderEditor(e)]})}}function aw(i,e,t){if(!i||!i.length)return[];const{getCol:n,colProps:s,itemCountPerRow:r,itemGap:o}=e;let a=!1;const l=[],c=new Map;return i=i.reduce((d,u,p)=>{if(u=xe({itemGap:o,itemCountPerRow:r},s,u),n){const g=n.call(this,u);g!==!1&&(u=g||u)}return u.deleted||(typeof u.order=="number"?a=!0:u.order=p,typeof u.name!="string"&&(u.name=String(u.name)),t==null||t.call(this,u),u.parentName!==void 0?(u.parentName=String(u.parentName),l.push(u)):(c.set(u.name,u),d.push(u))),d},[]),l.forEach(d=>{const u=c.get(d.parentName);u&&(u.subCols=xn(u.subCols,[d],"name"))}),a&&(i.sort(lr),[...c.values()].forEach(d=>{d.subCols&&d.subCols.sort(lr)})),i}function lw(i,e,t){if(!i||!i.length)return[];const{getLane:n,laneProps:s}=e;let r=!1;return i=i.reduce((o,a,l)=>{if(s&&(a=xe({},s,a)),n){const c=n.call(this,a);c!==!1&&(a=c||a)}return a.deleted||(typeof a.order=="number"?r=!0:a.order=l,a.color===void 0&&(a.color=`hsl(${43*Rl(a.name)%360}deg 40% 50%)`),typeof a.name!="string"&&(a.name=String(a.name)),t==null||t.call(this,a),o.push(a)),o},[]),r&&i.sort(lr),i}function _m(i,e,t,n,s){if(!(i!=null&&i.length))return[];const{itemProps:r,getItem:o}=n;let a=!1;return i=i.reduce((l,c)=>{r&&(c=xe({},r,c));const d=(o==null?void 0:o.call(this,{col:t.name,lane:e.name,item:c,laneInfo:e,colInfo:t}))??c;return d!==!1&&!d.deleted&&(typeof d.order=="number"?a=!0:d.order=l.length-1,l.push(d),s==null||s.call(this,d)),l},[]),a&&i.sort(lr),i}function lr(i,e){return i.order-e.order}function xn(i,e,t="key"){if(!i)return e?[...e]:[];const n=[...i];if(e){let s=0;const r=n.reduce((o,a,l)=>(o.set(String(a[t]??l),l),s=Math.max(a.order??l,s),o),new Map);e.forEach(o=>{const a=String(o[t]);r.has(a)?n[r.get(a)]={...n[r.get(a)],...o}:n.push({order:s++,...o})})}return n}function bm(i,e){return Array.isArray(i)?i.map(t=>({...t,[e]:String(t[e])})):Object.keys(i).reduce((t,n)=>{const s=i[n];return Object.keys(s).forEach(r=>{t.push(...(s[r]||[]).map(o=>({...o,lane:n,col:r,[e]:String(o[e])})))}),t},[])}function wm(i,e){const{items:t=[],...n}=i;return{items:bm(t,e),...n}}function Dh(i,e,t){var a;const n=xn(i.lanes,e.lanes,"name"),s=xn(i.cols,e.cols,"name"),r=xn(i.links,(a=e.links)==null?void 0:a.map(l=>(l[t]===void 0&&(l[t]=Wn(l)),l)),t),o=xn(i.items,bm(e.items||[],t),t);return{lanes:n,cols:s,items:o,links:r}}let cr=class extends He{constructor(){super(...arguments),this._ref=de(),this._raf=0,this._data=new ri(this._getData.bind(this),()=>{const{getCol:e,colProps:t,itemCountPerRow:n,itemGap:s,getLane:r,laneProps:o,itemProps:a,getItem:l,getLink:c,linkProps:d,responsive:u}=this.props;return[this._kanbanData,e,t,n,s,r,o,a,l,d,c,u]}),this._kanbanData=new ri(()=>{const{itemKey:e,props:t}=this,{data:n}=t,{data:s,changes:r}=this.state,o=(s||ml(n)?s:wm(n,e))||{};return r?Dh(o,r,e):o},()=>{const{data:e,changes:t,selected:n}=this.state;return[e,t,n,this.props.data]}),this._handleGlobalClick=e=>{y(e.target).closest(".kanban-item").length||this.select([])},this._onAddLink=async e=>{const{onAddLink:t}=this.props;e[this.itemKey]=Wn(e),await(t==null?void 0:t.call(this,e))!==!1&&this.addLink(e)},this._onDeleteLink=async e=>{const{onDeleteLink:t}=this.props;await(t==null?void 0:t.call(this,e))!==!1&&this.deleteLink(e)},this._handleMouseMove=e=>{this._hoverTimer&&clearTimeout(this._hoverTimer);const t=this._getElementInfo(e.target),n=(t==null?void 0:t.type)==="item"?t.key:void 0;this._hoverTimer=window.setTimeout(()=>{n!==this.state.hover&&this.setState({hover:n},()=>{y(this._ref.current).trigger("kanbanItemHover",{kanban:this.props.key,hover:n})}),this._hoverTimer=0},!n&&this.state.hover?0:20)},this._handleClick=e=>{if(e.target.closest("a,button"))return;const{onClickItem:t,selectable:n}=this.props,s=this._getElementInfo(e.target);t&&(s==null?void 0:s.type)==="item"&&t.call(this,e,s)===!1||n&&(s==null?void 0:s.type)==="item"&&this.select(s.key,!0)}}get data(){return this._data.cache}get itemKey(){return this.props.itemKey||"id"}componentDidMount(){this._afterRender(!0),this.tryLoad(),this._initDraggable();const{responsive:e,selectable:t}=this.props,n=this._ref.current;if(n&&e){const s=new ResizeObserver(this.updateLayout.bind(this));y(typeof e!="boolean"?e:n.closest(".kanban-list")||n.parentElement).each((o,a)=>{s.observe(a)}),this._rob=s,this.state.containerWidth||this.updateLayout()}t&&y(document).on("click.kanban",this._handleGlobalClick)}componentDidUpdate(){this._afterRender(!1),this.tryLoad()}componentWillUnmount(){var e,t,n;(e=this.props.beforeDestroy)==null||e.call(this),(t=this._draggable)==null||t.destroy(),(n=this._rob)==null||n.disconnect(),this.props.selectable&&y(document).off("click.kanban",this._handleGlobalClick)}getDefaultState(e){return{loading:!1,selected:(e||this.props).defaultSelected,data:void 0,changes:void 0,loadFailed:void 0}}load(){const{data:e,onLoad:t,onLoadFail:n}=this.props;this._loadedSetting=e,this.setState({loading:!0},async()=>{const s={loading:!1};try{const r=wm(await mt(e,[this],{throws:!0}),this.itemKey);s.data=(t==null?void 0:t.call(this,r))||r}catch(r){s.loadFailed=(typeof n=="function"?n.call(this,r):n)||String(r)}this.setState(s)})}updateLayout(){this._raf&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._raf=0;const e=this._ref.current;if(e){const{responsive:t,laneNameWidth:n=20}=this.props,s=y(typeof t!="boolean"?t:e.closest(".kanban-list")||e.parentElement),r=s[0];let o=s.width()-n-(r.offsetWidth-r.clientWidth);const a=e.closest(".kanban-region");a&&(o-=a.clientWidth-y(a).width()),this.setState({containerWidth:o})}})}tryLoad(){const{loading:e}=this.state,{data:t}=this.props;e||!t||!ml(t)||t===this._loadedSetting||this.load()}getCol(e){return this.data.colMap.get(String(e))}getLane(e){return e=String(e),this.data.lanes.find(t=>t.name===e)}getItem(e){return this.data.map.get(String(e))}update(e){return this.changeState(t=>({changes:Dh({...t.changes},e,this.itemKey)}))}createSnap(){return{date:Date.now(),kanban:this,data:y.extend(!0,{},this._data),restore(){this.kanban.changeState({changes:this.data})}}}addItem(e,t,n){return this.updateItem(e,t,n)}updateItem(e,t,n){const s=Array.isArray(e)?e:[e];return this.update({items:t||n?s.map(r=>({...r,lane:t??r.lane,col:n??r.col})):s})}deleteItem(e){return this.updateItem(Array.isArray(e)?e.map(t=>({[this.props.itemKey||"id"]:t,deleted:!0})):{[this.itemKey]:e,deleted:!0})}updateLane(e){return this.update({lanes:Array.isArray(e)?e:[e]})}addLane(e){return this.updateLane(e)}deleteLane(e){return this.updateLane(Array.isArray(e)?e.map(t=>({name:t,deleted:!0})):{name:e,deleted:!0})}updateCol(e){return this.update({cols:Array.isArray(e)?e:[e]})}addCol(e){return this.updateCol(e)}deleteCol(e){return this.updateCol(Array.isArray(e)?e.map(t=>({name:t,deleted:!0})):{name:e,deleted:!0})}updateLink(e,t){return this.update({links:(Array.isArray(e)?e:[e]).map(n=>({deleted:!1,...n,...t,[this.itemKey]:Wn(n)}))})}addLink(e){return this.updateLink(e)}deleteLink(e){return this.updateLink(e,{deleted:!0})}select(e,t){let n=Array.isArray(e)?e:e?[e]:[],s=this.state.selected||[];const{onSelect:r}=this.props;return this.changeState(o=>{if(s=o.selected||[],t){const a=new Set(s),l=new Set;return n.forEach(c=>{a.has(c)?a.delete(c):l.add(c)}),n=[...a,...l],{selected:n}}return{selected:n}},()=>{r==null||r(n,s),y(this._ref.current).trigger("kanbanItemSelected",{kanban:this.props.key,selected:n,oldSelected:s})})}_getElementInfo(e){const t=y(e),n=t.closest(".kanban-item");if(n.length){const a=n.attr("z-key");if(a){const l=this.getItem(a);if(l)return{type:"item",key:a,element:e,item:l,lane:l.lane,col:l.col}}}if(t.closest(".kanban-new-item").length)return{type:"newItem",element:e};const r=t.closest(".kanban-header-col,.kanban-lane-col");if(r.length)return{type:"col",element:e,col:r.attr("z-col"),lane:r.attr("z-lane")};const o=t.closest(".kanban-lane").attr("z-lane");if(o!==void 0)return{type:"lane",element:e,lane:o}}_getDropInfo(e,t,n){const s=this._getElementInfo(t);if(!s)return;const r=this._getElementInfo(n);if(!r||r.element.closest(".kanban")!==this.element)return;let o;if(s.type==="item"&&r.type==="col")o="inside";else{const a=n.getBoundingClientRect();s.type==="col"?o=e.clientX$[o]===l[o]);x>=0&&d.splice(x,1);const k=d.findIndex($=>$[o]===C[o]);d.splice(e.side==="before"?k:k+1,0,u),_=!0}if(_){r.items=[];let C=-1;d.forEach((x,k)=>{const $=Math.max(0,C+1,x.order??k),E=c[k];C=$,(E!==x||$!==E.order)&&(x={...x,order:$}),x!==E&&r.items.push(x),a.list.push(x[o])})}}else if(t.type==="newItem"){const{onDropNewItem:l}=this.props;let c;if(l?c=l.call(this,e):(c=y(t.element).data(),c!=null&&c.item&&(c=c.item)),c={lane:n.lane,col:n.col,...c},c!=null&&c[o]){const u=[...s.items[n.lane][n.col]];u.push(c),r.items=u,a.list.push(c[o])}}return{changes:r,data:a}}_initDraggable(){const{draggable:e}=this.props,t=this._ref.current;if(!e||!t)return;const{dragTypes:n=["item","newItem"],onDragStart:s,onDrop:r,canDrop:o,dropRules:a}=this.props,l=typeof n=="string"?n.split(","):n,c={item:".kanban-item",lane:".kanban-lane-name",col:".kanban-header-col",newItem:".kanban-new-item"},d=typeof e=="object"?e:{},u=(g,_)=>{y(g).attr({"z-drag-type":_?_.drag.type:null,"z-drop-type":_?_.drop.type:null,"z-drop-side":_?_.side:null})},p={...d,selector:d.selector||l.map(g=>c[g]||"").filter(Boolean).join(","),target:d.target||(g=>{const _=this._getElementInfo(g);if(!_)return;const C={lane:".kanban-lane",col:".kanban-header-col",item:".kanban-item,.kanban-items",newItem:".kanban-item,.kanban-items"}[_.type];return y(t).find(C)}),canDrop:d.canDrop||o||a?(g,_,C)=>{const x=this._getElementInfo(_);if(!x)return!1;const k=this._getElementInfo(C);if(!k||k.element.closest(".kanban")!==this.element)return!1;if(x.type==="item"&&a){const $=x.col,E=k.col,z=x.lane,H=k.lane,Y=a[`${z}:${$}`]??a[$];return typeof Y=="boolean"?Y:!Y||Y.includes(E)||Y.includes(`${H}:${E}`)||Y.includes(`${H}:`)}if(o)return o.call(this,x,k)}:void 0,onDragStart:(g,_)=>{var x;const C=this._getElementInfo(_);return C?s?s.call(this,{event:g,drag:C}):(x=d.onDragStart)==null?void 0:x.call(this,g,_):!1},onDragOver:(g,_,C)=>{const x=this._getDropInfo(g,_,C);x&&u(C,x)},onDragLeave:(g,_,C)=>{u(C)},onDrop:(g,_,C)=>{var k;u(C);const x=this._getDropInfo(g,_,C);if(!x)return!1;if(r){const{changes:$,data:E}=this._getDropChanges(x);if(Object.keys($).length){x.data=E;const z=this.createSnap();r.call(this,$,x,z.restore)!==!1&&this.update($)}}return(k=d.onDrop)==null?void 0:k.call(this,g,_,C)}};this._draggable=new js(t,p)}_afterRender(e){var t;(t=this.props.afterRender)==null||t.call(this,e)}_getData(){const{itemKey:e,props:t}=this,n=this._kanbanData.value;let s=!1;const{items:r=[]}=n,o={},a=new Map,l=aw.call(this,n.cols,t,x=>{x.parentName!==void 0&&(s=!0),a.set(x.name,x)}),c=lw.call(this,n.lanes,t,x=>{o[x.name]=l.reduce((k,$)=>($.subCols?$.subCols.forEach(E=>{k[E.name]=[]}):k[$.name]=[],k),{})}),d=new Set,u=r.reduce((x,k)=>{if(k.deleted)return d.add(k[e]),x;x.set(k[e],k);const $=o[k.lane];if($){const E=$[k.col];E&&E.push(k)}return x},new Map),{selected:p=[]}=this.state,g=new Set(p),_=x=>{x.selected=g.has(x[e])};c.forEach(x=>{const k=o[x.name];k&&l.forEach($=>{var E;k[$.name]=_m.call(this,k[$.name],x,$,t,_),(E=$.subCols)==null||E.forEach(z=>{k[z.name]=_m.call(this,k[z.name],x,z,t,_)})})});let{links:C=[]}=n;return C=C.reduce((x,k)=>{var $;if(!k.deleted&&u.has(k.from)&&u.has(k.to)&&!d.has(k.from)&&!d.has(k.to)){k[e]===void 0&&(k[e]=Wn(k));const E=(($=t.getLink)==null?void 0:$.call(this,k))??k;E!==!1&&!E.deleted&&x.push(E)}return x},[]),{cols:l,lanes:c,items:o,map:u,colMap:a,links:C,hasSubCols:s}}_layoutCols(e,t){const{containerWidth:n=0}=this.state,{colsGap:s=8,minColWidth:r=150,maxColWidth:o=600,colWidth:a=200}=t,l=[];let c=0;const d=u=>{const{minWidth:p=r,maxWidth:g=o}=u;let{width:_=a}=u;typeof _=="function"&&(_=_.call(this,u));const C=_==="auto";if(C)_=p;else{const[x,k]=hi(_);k==="%"?_=n*x/100:_=x}return _=Math.min(g,Math.max(p,_)),c+=_+(c?s:0),u={...u,width:_,maxWidth:g,minWidth:p},C&&l.push(u),u};if(e=e.map(u=>u.subCols?{...u,subCols:u.subCols.map(d)}:d(u)),l.length&&c{p.width=Math.min(p.maxWidth,Math.max(p.minWidth,p.width+u))})}return e}_layoutLanes(e,t){const{laneHeight:n,maxLaneHeight:s,minLaneHeight:r}=t;return!n&&!s&&!r?e:e.map(o=>({height:typeof n=="function"?n.call(this,o):n,maxHeight:s,minHeight:r,...o}))}_getClassName(e){return["kanban",e.className,e.sticky?"kanban-sticky":"",this.data.hasSubCols?"has-sub-cols":""]}_getProps(e){const{laneNameWidth:t,colsGap:n,lanesGap:s,selectable:r,onClickItem:o,showLinkOnHover:a}=e;return xe(super._getProps(e),{ref:this._ref,style:{"--kanban-lane-name-width":t,"--kanban-cols-gap":Ve(n),"--kanban-lanes-gap":Ve(s)},onClick:o||r?this._handleClick:void 0,onMouseMove:a?this._handleMouseMove:void 0})}_renderLinks(e){const{links:t=[]}=this.data,{editLinks:n}=e;if(!n&&!t.length)return;const{showLinkOnHover:s,showLinkOnSelected:r}=e;let o;if(r||s){o=[];const{selected:a,hover:l}=this.state;r&&a&&o.push(...a),s&&l&&o.push(l),o=[...new Set(o)]}return S(vm,{links:t,filters:o,editLinks:n,onDeleteLink:n?this._onDeleteLink:void 0,onAddLink:n?this._onAddLink:void 0},"links")}_getChildren(e){const t=this._data.value,{cols:n,lanes:s,items:r}=t,{laneNameWidth:o}=e,a=this._layoutCols(n,e),l=this._layoutLanes(s,e);return[S(Jb,{cols:a},"header"),S(Zb,{itemRender:e.itemRender,getLaneCol:e.getLaneCol,cols:a,lanes:l,items:r,hideLaneName:o===0},"body"),this._renderLinks(e),e.children]}};cr.defaultProps={draggable:!0,sticky:!0,responsive:!0,itemKey:"id",colWidth:200,colsGap:8},cr.customProps=["onDrop","onDragStart"];class Cm extends He{constructor(){super(...arguments),this._kanbanRefs=new Map,this._needUpdateData=new Map,this._handleClickHeading=e=>{y(e.target).closest("a,.btn,button").not(".kanban-region-toggle").length||this.setState(t=>({collapsed:!t.collapsed}))}}componentDidUpdate(){if(this.state.collapsed)return;const e=this._needUpdateData;[...e.keys()].forEach(t=>{const n=this.getKanban(t);n&&(n.update(e.get(t)),e.delete(t))})}getDefaultState(e){return{collapsed:(e||this.props).collapsed,heading:void 0,items:void 0}}resetState(e,t){this._kanbanRefs.forEach(n=>{var s;return(s=n.current)==null?void 0:s.resetState()}),super.resetState(e,t)}getKanban(e){var t;return(t=this._kanbanRefs.get(String(e)))==null?void 0:t.current}toggle(e){this.setState(t=>({collapsed:e===void 0?!t.collapsed:!e}))}update(e){const{items:t}=e;return t&&(e={...e},e.items=t.map((n,s)=>{const r=String(n.key||s);return n.deleted?{key:r,deleted:!0}:(n.data&&typeof n.data=="object"&&this.getKanban(r)&&(this._needUpdateKanban(r,n.data),n={...n},delete n.data),n)})),new Promise(n=>{this.setState(e.items?s=>({...e,items:xn(s.items,e.items)}):e,n)})}_needUpdateKanban(e,t){const n=this._needUpdateData,s=n.get(e),{kanbanItemKey:r="key"}=this.props;n.set(e,Dh(s||{},t,r))}_buildItems(e){const{items:t=[],kanbanProps:n,kanbanItemKey:s="key"}=e;let{items:r}=this.state;r?(r=xn(t,r,s).filter(c=>!c.deleted),r.sort(lr)):r=t;const o=this._kanbanRefs,a=new Set(o.keys()),l=r.map((c,d)=>{if(c.deleted)return null;const u=xe({className:"kanban-region-item",key:d},typeof n=="function"?n.call(this,c,d):n,c),p=String(u.key);let g=o.get(p);return g||(g=de(),o.set(p,g)),u.ref=g,a.delete(p),S(cr,{"z-key":p,...u})});return a.forEach(c=>{o.delete(c)}),l}_getClassName(e){return["kanban-region",e.className,this.state.collapsed?"is-collapsed":"is-expanded",e.heading?"has-heading":""]}_getChildren(e){const{heading:t,toggleFromHeading:n}=e,{collapsed:s,heading:r}=this.state,o=xe({className:"kanban-heading",onClick:n?this._handleClickHeading:void 0},typeof t=="function"?t.call(this):t,r);return[t&&S(tn,{...o},"heading"),s?null:this._buildItems(e)]}}const Ih=".kanban";let xm=class extends He{constructor(){super(...arguments),this.state={},this._ref=de(),this._kanbanRefs=new Map,this._onAddLink=async e=>{const{onAddLink:t,linkItemKey:n}=this.props;e[n]=Wn(e),await(t==null?void 0:t.call(this,e))!==!1&&this.addLink(e)},this._onDeleteLink=async e=>{const{onDeleteLink:t}=this.props;await(t==null?void 0:t.call(this,e))!==!1&&this.deleteLink(e)}}componentDidMount(){const e=this._ref.current;if(e){const{moveable:t,responsive:n,showLinkOnSelected:s,showLinkOnHover:r}=this.props;if(t&&(this._moveable=new Bs(e,y.extend({selector:"self",move:"scroll",onMoveStart:(o,a)=>{const{bottom:l,right:c}=a.getBoundingClientRect();return o.clientYl-20||o.clientXc-20?!1:!y(o.target).closest("a,input,.btn,.state,.kanban-item,.not-moveable").length}},typeof t=="object"?t:null))),s&&y(e).on(`kanbanItemSelected${Ih}`,(o,a)=>{this.setState(l=>({selected:{...l.selected,[a.kanban]:a.selected}}))}),r&&y(e).on(`kanbanItemHover${Ih}`,(o,{kanban:a,hover:l})=>{this.setState({hover:l===void 0?l:`${a}_${l}`})}),n){const o=new ResizeObserver(this._tryUpdateLayout.bind(this));(typeof n!="boolean"?y(n):y(e).parent()).each((l,c)=>{o.observe(c)}),this._rob=o}}}componentWillUnmount(){var t,n;(t=this._moveable)==null||t.destroy(),(n=this._rob)==null||n.disconnect();const e=this._ref.current;e&&y(e).off(Ih)}getDefaultState(e){return{linkChanges:void 0}}resetState(e,t){this._kanbanRefs.forEach(n=>{var s;(s=n.current)==null||s.resetState()}),super.resetState(e,t)}getKanban(e){const t=String(e),n=this._kanbanRefs;if(n.has(t))return n.get(t).current;let s=null;const r=Array.from(n.values());for(const o of r){const a=o.current;if(a instanceof Cm&&(s=a.getKanban(e),s))break}return s||null}updateKanban(e,t){const n=this.getKanban(e);return n?n.update(t):Promise.reject(new Error(`[ZUI] Kanban not found: ${e}`))}updateLayout(){const e=this._ref.current;if(!e)return;const t=y(e),n=t.width(),s=t.height();this.setState({width:n,height:s})}updateLink(e,t){return this.changeState(n=>{let s=Array.isArray(e)?e:[e];return t&&(s=s.map(r=>({...r,...t}))),{linkChanges:xn(n.linkChanges,s,this.props.linkItemKey)}})}addLink(e){return this.updateLink(e)}deleteLink(e){return this.updateLink(e,{deleted:!0})}_tryUpdateLayout(){this._layoutTimer&&cancelAnimationFrame(this._layoutTimer),this._layoutTimer=requestAnimationFrame(()=>{this.updateLayout(),this._layoutTimer=0})}_getClassName(e){return["kanban-list",e.className,e.sticky?"has-sticky":"",e.moveable?"is-moveable":"",e.scrollbarHover?"scrollbar-hover":""]}_getProps(e){const{width:t,height:n}=e,s=typeof t=="function"?t.call(this):t,r=typeof n=="function"?n.call(this):n,{width:o,height:a}=this.state??{};return xe(super._getProps(e),{ref:this._ref,style:{width:s,height:r,"--kanban-list-width":`${o||t}px`,"--kanban-list-height":`${a||n}px`}})}_getLinks(e){const{linkChanges:t=[]}=this.state,{links:n=[],getLink:s,linkItemKey:r}=e;return xn(n,t,this.props.linkItemKey).reduce((o,a)=>{const l=s==null?void 0:s.call(this,a);return l!==!1&&(a=l||a,a.deleted||(a[r]||(a[r]=Wn(a)),o.push(a))),o},[])}_renderLinks(e){const t=this._getLinks(e),{editLinks:n}=e;if(!n&&!t.length)return;const{showLinkOnHover:s,showLinkOnSelected:r}=e;let o;if(t.length&&(r||s)){o=[];const{selected:a={},hover:l}=this.state;r&&a&&Object.keys(a).forEach(c=>{const d=a[c];d.length&&o.push(...d.map(u=>`${c}_${u}`))}),s&&l&&o.push(l),o=[...new Set(o)]}return S(vm,{container:".kanban-list",links:t,filters:o,editLinks:n,onDeleteLink:n?this._onDeleteLink:void 0,onAddLink:n?this._onAddLink:void 0},"links")}_getChildren(e){const{items:t=[],kanbanProps:n,showLinkOnSelected:s,showLinkOnHover:r,selectable:o,editLinks:a}=e,l=this._kanbanRefs,c=new Set(l.keys()),d=[...t.map((p,g)=>{n&&(p=typeof n=="function"?n.call(this,p,g):y.extend({},n,p));const _=String(p.key??g);let C=l.get(_);C||(C=de(),l.set(_,C)),c.delete(_);const x=p.heading!==void 0||p.items;return(s||r||o)&&(x?p.kanbanProps={showLinkOnSelected:s,showLinkOnHover:r,selectable:o,...p.kanbanProps}:p={showLinkOnSelected:s,showLinkOnHover:r,selectable:o,...p}),a&&(x?p.items=(p.items||[]).map($=>({...$,editLinks:!1})):p={...p,editLinks:!1}),S(x?Cm:cr,{ref:C,sticky:e.sticky,...p,"z-key":_},_)}),e.children];c.forEach(p=>{l.delete(p)});const u=this._renderLinks(e);return u&&d.push(u),d}};xm.defaultProps={moveable:!0,sticky:!0,responsive:!0,scrollbarHover:!0,linkItemKey:"id"};class hr extends ye{}hr.NAME="Kanban",hr.replace=!0,hr.Component=cr,hr.register();class ur extends ye{update(e,t){if(e=Array.isArray(e)?e:[e],t)return this.render({items:e});const n=this.options.items||[],s=new Map(n.map((o,a)=>[o.key,a])),r=[...n];return e.forEach(o=>{if(s.has(o.key)){const a=s.get(o.key);r[a]={...n[a],...o}}else r.push(o)}),this.render({items:r.filter(o=>!o.deleted)})}}ur.NAME="KanbanList",ur.replace=!0,ur.Component=xm,ur.register();const dk="",fk="",pk="",mk="",gk="",yk="",vk="",_k="",bk="",wk="",cw="nav",Nh='[data-toggle="tab"]',hw="active";class dr extends Fe{constructor(){super(...arguments),this._timer=0}active(e){const t=this.$element,n=t.find(Nh);let s=e?y(e).closest(Nh):n.filter(`.${hw}`);if(!s.length&&(s=t.find(Nh).first(),!s.length))return;n.removeClass("active"),s.addClass("active");const r=s.attr("href")||s.data("target"),o=s.data("name")||r,a=t.closest(".tabs"),l=a.length?a.find(r):y(r);l.length&&(l.parent().children(".tab-pane").removeClass("active in"),l.addClass("active").trigger("show",[o]),this.emit("show",o),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{l.addClass("in").trigger("shown",[o]),this.emit("shown",o),this._timer=0},10))}}dr.NAME="Tabs",dr.toggle={name:"tab",handler(i,e){const t=y(i),n=t.closest(`.${cw}`);n.length&&dr.ensure(n,e).active(t)}},dr.register();function uw(i){const[e,t]=i.split(":"),n=e[0]==="-"?{name:e.substring(1),disabled:!0}:{name:e};return t!=null&&t.length&&(n.type="dropdown",n.items=t.split(",").reduce((s,r)=>(r=r.trim(),r.length&&s.push(r[0]==="-"?{name:r.substring(1),disabled:!0}:{name:r}),s),[])),n}const dw=(i,e)=>{var s;i.url&&(i.url=be(i.url,e.row.data));const t={row:e.row.id,col:e.col.name},n=((s=i.dropdown)==null?void 0:s.items)||i.items;return n&&n.forEach(r=>(r.url&&(r.url=be(r.url,e.row.data)),r.data=t,r)),i.data=t,i},km=i=>i?(typeof i=="string"&&(i=i.split("|")),i.map(e=>typeof e=="string"?uw(e):e).filter(Boolean)):[],fw=qe({name:"actions",colTypes:{actions:{onRenderCell(i,e){var d;const{row:t,col:n}=e,s=km(((d=t.data)==null?void 0:d[n.name])||n.setting.actions);if(!s.length)return i;const{actionsSetting:r,actionsMap:o,actionsCreator:a=this.options.actionsCreator,actionItemCreator:l=this.options.actionItemCreator||dw}=n.setting,c={items:(a==null?void 0:a(e))??s.map(u=>{const{name:p,...g}=u;if(o&&p){Object.assign(g,o[p],{...g});const{buildProps:C}=g;typeof C=="function"&&(delete g.buildProps,Object.assign(g,C(i,e)))}const{items:_}=g;if(g.disabled&&(delete g.url,delete g["data-toggle"]),_&&g.type==="dropdown"){const{dropdown:C={placement:"bottom-end"}}=g;C.menu={className:"menu-dtable-actions"},C.items=_.map(x=>{const k=typeof x=="string"?{name:x}:{...x};return k.name&&o&&o[k.name]&&Object.assign(k,o[k.name],{...k}),k.disabled?(delete k.url,delete k["data-toggle"]):k.url&&(k.url=be(k.url,t.data)),k}),g.dropdown=C,delete g.items}return l?l(g,e):g}),btnProps:{btnType:"ghost",size:"sm",className:"text-primary"},...r};return i[0]=S(Oe,{...c}),i}}},beforeLayout(i){!Array.isArray(i.data)||!i.data.length||i.cols.forEach((e,t)=>{if(e.type!=="actions"||e.width)return;const{actionsMap:n={}}=e,r=km(i.data[0][e.name]).reduce((o,a)=>{const l=a.name?n[a.name]:null;return l&&l.type==="dropdown"&&l.caret&&!l.text?o+16:o+24},24);i.cols[t]={...e,width:r}})}}),pw=qe({name:"toolbar",footer:{toolbar(){const{footToolbar:i,showToolbarOnChecked:e}=this.options;return e&&!this.getChecks().length?[]:[i?Oe.render(i,[this],{gap:2}):null]}}}),kk="",Sm=function(i,e){var s,r;const{col:t}=e,{sortColFrom:n}=this.state;if(n){n.name===t.name&&i.push({outer:!0,className:"is-sorting-from-col"});const o=(r=(s=this.data.sortColInfo)==null?void 0:s.colOffsetMap)==null?void 0:r[t.name];typeof o=="number"&&i.push({outer:!0,className:"is-sorting-col-move",style:{left:t.left+o}})}return i},mw=qe({name:"sort-col",when:i=>!!i.sortCol,plugins:[ya,um],resetState:!0,state(){return{colOrders:{},sortColFrom:void 0,sortingColPos:void 0,sortingColTo:void 0,sortingColSide:void 0}},events:{mousedown(i){var r;if(this.data.disableSortCol)return;const e=this.getPointerInfo(i);if(!e||e.rowID!=="HEADER")return;const t=this.getColInfo(e.colName);if(!t||((r=this.options.onSortColStart)==null?void 0:r.call(this,t,i))===!1)return;y(i.target).closest("a,button,img").attr("draggable","false").length&&i.preventDefault(),i.preventDefault();const n=i.clientX,{cellElement:s}=e;this.data.sortColInfo={from:t,element:s,offset:n-s.getBoundingClientRect().left,startMouseX:n,lastMouseX:n},y(s).zuiCall("ContextMenu.hide")},document_mouseup(i){var n;const{sortColInfo:e}=this.data;if(!e)return;this.stopScrollToMouse();const t=this.getSortingColState(i);if(t){let s,r;const{from:o,to:a,side:l}=t;if(a){if(o.name===a.name)s={};else if(l){const c=this.layout.cols[o.side].list,d=o.sideIndex,u=a.sideIndex,p=c.splice(d,1);c.splice(u+(l==="after"?1:0),0,p[0]),s={},r=[],c.forEach(({name:g},_)=>{s[g]=_+1,r.push(g)}),((n=this.options.onSortCol)==null?void 0:n.call(this,o,a,l,r))===!1&&(s=void 0,r=void 0)}Math.abs(e.lastMouseX-e.startMouseX)>4&&this.ignoreNextClick()}this.disableAnimation(),this.update({dirtyType:"layout",state:y.extend({sortColFrom:void 0,sortingColPos:void 0,sortingColTo:void 0,sortingColSide:void 0},s?{colOrders:{...this.state.colOrders,...s}}:null)},()=>{var c;(c=this.options.onSortColEnd)==null||c.call(this,o,a,l,r)})}this.data.sortColInfo=void 0},document_mousemovesmooth(i){const{sortColInfo:e}=this.data;if(!e)return;const t=this.getSortingColState(i);t&&(e.state||this.startScrollToMouse({side:"x"}),e.lastMouseX=i.clientX,e.state=t,this.setState({sortColFrom:t.from,sortingColPos:t.pos,sortingColTo:t.to,sortingColSide:t.side}))}},methods:{getSortingColState(i){var x;const{disableSortCol:e,sortColInfo:t}=this.data;if(e||!t)return;const{from:n,element:s}=t,o=y(s).closest(".dtable-cells")[0].getBoundingClientRect(),a=i.clientX-o.left,{cols:l,scrollLeft:c}=this.layout,d=l[n.side].list;if(d.length<=1)return t.state;const u=c+a,p=d.find(k=>k.visible&&k.left<=u&&k.left+k.width>u);if(!p)return t.state;const g=u{const u=l-d.left;u&&(c[d.name]=u),l+=d.realWidth}),this.data.sortColInfo.colOffsetMap=c}},onRenderHeaderCell(i,e,t,n){const{sortCol:s}=this.options;return s&&(this.layout.cols[e.col.side].list.length>1&&(s===!0||Array.isArray(s)&&s.includes(e.col.name)||typeof s=="function"&&s.call(this,e.col))&&i.push({outer:!0,className:"is-sortable-col"}),i=Sm.call(this,i,e,t,n)),i},onRenderCell:Sm}),Tk="";function Tm(i,e,t){const{colResizing:n}=i.state;if(!n)return;const s=Math.round(e.clientX-n.startX);if(!s&&!t)return;const r={};t&&(r.colResizing=void 0);const{colName:o}=n;let a=i.getColInfo(o);if(!a)return i.update({dirtyType:"layout",state:r});r.colsSizes={...i.state.colsSizes,[o]:n.startSize+s},i.update({dirtyType:"layout",state:r},t?()=>{var l;if(a=i.getColInfo(o),a){const c=i.data.colOriginSize.get(o);(l=i.options.onColResize)==null||l.call(i,o,a.width-c,a)}}:void 0),e.stopPropagation(),e.preventDefault()}const gw=qe({name:"resize",when:i=>!!i.colResize,plugins:[ya],resetState(i){var e;return{colsSizes:(e=i.cols)==null?void 0:e.reduce((t,n)=>(n.extraWidth!==void 0&&(t[n.name]=n.extraWidth),t),{})}},state(){var i;return{colsSizes:(i=this.props.cols)==null?void 0:i.reduce((e,t)=>(t.extraWidth!==void 0&&(e[t.name]=t.extraWidth),e),{})}},data(){return{colOriginSize:new Map}},events:{mousedown(i){const e=i.target.closest(".dtable-col-splitter");if(!e)return;const t=e.closest(".dtable-cell"),n=t==null?void 0:t.dataset.col;if(n)return this.setState({colResizing:{colName:n,startSize:this.state.colsSizes[n]??0,startX:i.clientX}},()=>{y(t).zuiCall("ContextMenu.hide")}),!1},dblclick(i){var s;const e=i.target.closest(".dtable-col-splitter");if(!e)return;const t=(s=e.closest(".dtable-cell"))==null?void 0:s.dataset.col;if(!t)return;const{colsSizes:n}=this.state;n[t]&&(delete n[t],this.update({dirtyType:"layout",state:{colResizing:void 0,colsSizes:{...n}}},()=>{var r;(r=this.options.onColResize)==null||r.call(this,t,0,this.getColInfo(t))}))},document_mouseup(i){if(this.state.colResizing)return Tm(this,i,!0),!1},document_mousemovesmooth(i){if(this.state.colResizing)return Tm(this,i),!1}},methods:{isColResizable(i){if(typeof i=="string"&&(i=this.getColInfo(i)),!i||i.side!=="left"&&i.sideIndex===this.layout.cols[i.side].list.length-1)return;let e=i.setting.colResize??this.options.colResize;return typeof e=="function"&&(e=e.call(this,i.name)),!!e}},onRenderHeaderCell(i,{col:e}){var t;return this.isColResizable(e)&&(i.push({className:"has-col-splitter",children:S("div",{className:"dtable-col-splitter no-cell-event"}),outer:!0}),((t=this.state.colResizing)==null?void 0:t.colName)===e.name&&i.push({className:"has-col-resizing",outer:!0})),i},onRenderCell(i,{col:e}){var t;return((t=this.state.colResizing)==null?void 0:t.colName)===e.name&&i.push({className:"is-col-resizing",outer:!0}),i},onAddCol(i){const e=this.state.colsSizes[i.name]??i.setting.extraWidth;typeof e=="number"&&(this.data.colOriginSize.set(i.name,i.width),i.width=ep(i.width+e,i.setting.minWidth,i.setting.maxWidth))},onRender(){if(this.state.colResizing)return{className:"has-col-resizing"}}}),Dk="",yw=qe({name:"contextmenu",when:i=>!!i.contextmenu,events:{contextmenu(i){const e=this.getPointerInfo(i);if(!e)return;const t=this.getContextMenuItems(i,e);if(!t||!t.length)return;i.preventDefault();const n=y(e.cellElement).addClass("has-contextmenu-show");e.cellElement.classList.add("active"),hs.show({items:t,key:`dtable-ctx-${this.id}`,triggerEvent:i,hideOthers:!0,onHide(){n.removeClass("has-contextmenu-show")}})}},methods:{getContextMenuItems(i,e){const{contextmenu:t}=this.options;if(typeof t=="function")return t.call(this,i,e);if(!t||Array.isArray(t))return t;const{header:n,cell:s}=t;return e.rowID==="HEADER"?typeof n=="function"?n.call(this,i,e):n:typeof s=="function"?s.call(this,i,e):s}}});function $m(i,e){if(typeof e=="string"&&(e=i.getColInfo.call(i,e)),!e)return{};const{colBorders:t}=i.state,{side:n,sideIndex:s}=e,r=i.layout.cols[n].list,o=s>0?r[s-1]:null,a=r[s+1];return{prevName:o==null?void 0:o.name,nextName:a==null?void 0:a.name,prev:o?t[o.name]??o.setting.border:void 0,next:a?t[a.name]??a.setting.border:void 0}}function ds(i,e){return i===e||i===!0}const vw=qe({name:"custom-col",when:i=>!!i.customCol,plugins:[yw],resetState:!0,options(i){return i.customCol&&!i.contextmenu&&(i.contextmenu={header:(e,t)=>{var o,a;const n=this.getColBorder(t.colName),s=l=>{const c={width:"12px",margin:"0 2px",height:"12px",border:"1px dotted var(--color-border-strong)"},d="2px solid var(--color-border-strong)";return l==="left"?c.borderLeft=d:l==="right"?c.borderRight=d:l===!0&&(c.borderLeft=d,c.borderRight=d),S("span",{style:c})},r=((o=this.getColInfo(t.colName))==null?void 0:o.setting.required)||!((a=this.options.canSetColVisibility)!=null&&a.call(this,t.colName,!1));return[{icon:s(n),text:this.i18n("setDivider"),items:[{text:this.i18n("leftDivider"),icon:s("left"),selected:n==="left",onClick:()=>this.setColBorder(t.colName,"left")},{text:this.i18n("rightDivider"),icon:s("right"),selected:n==="right",onClick:()=>this.setColBorder(t.colName,"right")},{text:this.i18n("allDivider"),icon:s(!0),selected:n===!0,onClick:()=>this.setColBorder(t.colName,!0)},{text:this.i18n("noDivider"),icon:s(!1),selected:!n,onClick:()=>this.setColBorder(t.colName,!1)}]},{text:this.i18n("hideCol"),icon:"eye-off",disabled:r,onClick:r?void 0:()=>this.setColVisibility(t.colName,!1)}]}}),i},state(){return{colBorders:{},colVisibility:{}}},methods:{getColBorder(i,e=!0){const t=this.getColInfo(i);if(!t)return!1;const{colBorders:n}=this.state,s=n[i]??t.setting.border;if(s===!0||!e)return s;const{prev:r,next:o}=$m(this,t),a=s==="left"||ds(r,"right"),l=s==="right"||ds(o,"left");return a&&l?!0:a?"left":l?"right":!1},setColBorder(i,e){if(this.getColBorder(i,!1)===e)return;const{onSetColBorder:n}=this.options,{prev:s,next:r,prevName:o,nextName:a}=$m(this,i);this.update({dirtyType:"layout",state:l=>{const c={...l.colBorders,[i]:e};return!ds(e,"left")&&ds(s,"right")&&(c[o]=!1),!ds(e,"right")&&ds(r,"left")&&(c[a]=!1),{colBorders:c}}},n?()=>{n.call(this,i,e,this.state.colBorders)}:void 0)},setColVisibility(i,e){const{onSetColVisibility:t}=this.options;this.update({dirtyType:"options",state:n=>({colVisibility:{...n.colVisibility,[i]:e}})},t?()=>{t.call(this,i,e)}:void 0)}},onAddCol(i){const{colBorders:e}=this.state;e[i.name]!==void 0&&(i.border=e[i.name])},beforeLayout(i){const{colVisibility:e}=this.state;Object.keys(e).length&&i.cols&&(i.cols=i.cols.map(t=>(e[t.name]!==void 0&&(t={...t,hidden:!e[t.name]}),t)))},i18n:{zh_cn:{setDivider:"设置分割线",leftDivider:"左侧",rightDivider:"右侧",allDivider:"两侧",noDivider:"无",hideCol:"隐藏此列"},zh_tw:{setDivider:"設置分割線",leftDivider:"左側",rightDivider:"右側",allDivider:"兩側",noDivider:"無",hideCol:"隱藏此列"},en:{setDivider:"Set divider",leftDivider:"Left Side",rightDivider:"Right Side",allDivider:"Both Sides",noDivider:"No Divider",hideCol:"Hide this column"}}}),Mk="";function Mh(i,e,t){if(t){if(typeof t=="object"){const n=t[i];return typeof n=="string"?n:typeof n=="object"&&n?n.realname:void 0}if(typeof t=="function")return t(i,e)}}function Dm(i,e,t){let n;if(typeof i=="function"?n=i(e,t):typeof i=="object"&&(n=i[e]),n)return b(Ie,{className:"dtable-cell-icon",icon:n})}const Im={name:"zentao",plugins:["group","checkable","nested",fw,pw,dm,mw,gw,vw],defaultOptions:{colHover:"header",rowHeight:36,striped:!1,responsive:"window,parent,.search-form,~document_layout",checkable:"auto",nested:"auto",width:"100%",footer:void 0,showToolbarOnChecked:!0,checkOnClickRow:!0,groupDivider:!0,preserveNested:!0,extraHeight:"+",height(i){var r;const e=(r=this.element)==null?void 0:r.closest(".modal-dialog"),t=y(e||"body");let n=this.options.extraHeight;typeof n=="string"&&(n[0]==="+"&&(n=(e?".modal-header,.modal-footer,.search-form,36,#featureBar,":"#header,#mainMenu,#mainNavbar,.search-form,")+n.slice(1)),n=n.split(",")),Array.isArray(n)||(n=[n]);const s=n.reduce((o,a)=>a?typeof a=="number"||/^\d+$/.test(a)?o+Number(a):o+(t.find(a).outerHeight()||0):o,0);return Math.min(i,window.innerHeight-(e?64:1)-s)}},options(i){var l;const{checkable:e,footToolbar:t,footPager:n,footer:s}=i;if(s===void 0){const c=[];if(e&&c.push("checkbox"),t){const d=Array.isArray(t)?{items:t}:t;c.push("toolbar"),d.btnProps=y.extend({btnType:"primary",size:"sm"},d.btnProps),typeof d=="object"&&Array.isArray(d.items)&&d.items.forEach(u=>{if((u==null?void 0:u.type)==="dropdown"){const p=u.menu||u["data-menu"];p&&p.searchBox&&(p.searchPlacement===void 0&&(p.searchPlacement="bottom"),p.maxHeight||(p.maxHeight=480))}}),i.footToolbar=d}e&&c.push("checkedInfo"),n&&c.push("flex","pager"),c.length&&(i.footer=c)}const r={"data-load":"table","data-selector":"dtable","data-target":i.id,...i.loadOptions},o=i.loadPartial||((l=this.parent||this.element)==null?void 0:l.closest(".modal"));o&&(r["data-partial"]=!0),n&&(n.btnProps=y.extend({type:"ghost",size:"sm"},n.btnProps),n.items&&n.items.forEach(c=>{c.type==="size-menu"?y.extend(!0,c,{itemProps:o?{...r,...c.itemProps}:{"data-app":"current",...c.itemProps},placement:"top"}):c.type==="link"&&y.extend(c,r)}));let{sortLink:a}=i;if(a&&(typeof a=="string"&&(a={url:a}),typeof a=="object"&&(a=y.extend(r,a)),i.sortLink=a),i.customCols){i.colResize===void 0&&(i.colResize=!0),i.sortCol===void 0&&(i.sortCol=!0);const c=()=>{this.trySaveColsSetting()};i.sortCol&&!i.onSortColEnd&&(i.onSortColEnd=c),i.colResize&&!i.on&&(i.onColResize=c),i.customCol===void 0&&(i.customCol=!0),i.customCol&&(i.onSetColBorder||(i.onSetColBorder=c),i.onSetColVisibility||(i.onSetColVisibility=c),i.canSetColVisibility||(i.canSetColVisibility=d=>{const u=this.getColInfo(d);return!u||u.side!=="center"?!1:this.layout.cols[u.side].list.length>1}))}return i},i18n:{zh_cn:{unassigned:"未指派"},zh_tw:{unassigned:"未指派"},en:{unassigned:"Unassigned"}},colTypes:{id:{width:60,fixed:"left",align:"center",sortType:!0,maxWidth:120},checkID:{width:80,fixed:"left",align:"left",sortType:!0,checkbox:!0,maxWidth:160},title:{width:.44,fixed:"left",align:"left",sortType:!0,flex:1,hint:!0,maxWidth:600},shortTitle:{width:.2,align:"left",sortType:!0,fixed:"left",checkbox:!0,flex:1,hint:!0,maxWidth:250},nestedTitle:{width:.5,align:"left",sortType:!0,fixed:"left",flex:1,nestedToggle:!0,nestedIndent:20,hint:!0,maxWidth:650},shortNestedTitle:{width:.33,align:"left",sortType:!0,fixed:"left",flex:1,nestedToggle:!0,nestedIndent:20,hint:!0,maxWidth:300},status:{width:80,align:"center",sortType:!0,onRenderCell(i,{col:e,row:t}){var o,a;const n=(o=t.data)==null?void 0:o[e.name];let s,r;return typeof n=="string"?(s=n,r=(a=e.setting.statusMap)==null?void 0:a[n]):typeof n=="object"&&n&&({name:s,label:r}=n),i[0]=b("span",{class:`${e.setting.statusClassPrefix??"status-"}${s}`},r??s),i}},user:{width:80,align:"center",sortType:!0,onRenderCell(i,{col:e,row:t,value:n}){const{userMap:s=this.options.userMap,userJoiner:r=" "}=e.setting;if(Array.isArray(n))i[0]=n.map(o=>Mh(o,t,s)).filter(Boolean).join(r);else{const o=Mh(n,t,s);o!==void 0&&(i[0]=o)}return i}},assign:{width:108,align:"left",sortType:!0,cellClass:"px-1.5",onRenderCell(i,e){const{col:t,row:n,value:s}=e,{options:r}=this,{userMap:o=r.userMap,currentUser:a=r.currentUser,assignLink:l,unassignedText:c=r.unassignedText||this.i18n("unassigned")}=t.setting,d=!s,u=s==="closed",p=d?c:Mh(s,n,o)??s;return i[0]=l?wh(l,e,[b("i",{className:"icon icon-hand-right"}),b("span",null,p)],{"data-toggle":u?void 0:"modal",className:`dtable-assign-btn${a===s?" is-me":""}${d?" is-unassigned":""}${u?" disabled":""}`}):p,i}},avatar:{width:44,align:"center",sortType:!0},avatarName:{width:108,align:"left",sortType:!0},avatarBtn:{width:108,align:"left",sortType:!0},category:{width:80,align:"center",flex:1,hint:!0},desc:{width:160,align:"left",flex:1,hint:!0},text:{width:136,align:"left",flex:1,hint:!0},icon:{width:52,align:"center",cellClass:"px-1",onRenderCell(i,{row:e,col:t,value:n}){const{iconRender:s}=t.setting,r=Dm(s,n,e);return r&&(i[0]=r),i}},pri:{width:68,align:"center",cellClass:"px-1",sortType:!0,onRenderCell(i,{col:e,value:t}){const{priList:n=this.options.priList||{}}=e.setting,s=n[t]??t;return i[0]=b(zp,{pri:t,text:s}),i}},severity:{width:92,align:"center",cellClass:"px-1",sortType:!0,onRenderCell(i,{col:e,value:t}){const{severityList:n=this.options.severityList||{}}=e.setting,s=n[t]??t;return i[0]=b(Fp,{severity:t,text:s}),i}},burn:{width:88,align:"center",onRenderCell(i,{col:e}){const t=i[0];if(!t)return i;const{burn:n}=e.setting,s={data:t,className:"border-b",width:64,height:24,responsive:!1,...n};return i[0]=b(zc,{...s}),i}},date:{width:96,align:"center",sortType:!0},time:{width:64,align:"center",sortType:!0},datetime:{width:128,align:"center",sortType:!0},progress:{width:64,align:"center",sortType:!0},money:{width:96,align:"right",sortType:!0},count:{width:92,align:"right",sortType:!0},number:{width:64,align:"center",sortType:!0,digits:-1},percent:{width:64,align:"center",sortType:!0,format(i){return typeof i=="string"&&i.endsWith("%")?i:`${i}%`}},actions:{minWidth:120,align:"left",fixed:"right"}},methods:{trySaveColsSetting(){this.data.saveColsSettingTimer&&clearTimeout(this.data.saveColsSettingTimer),this.data.saveColsSettingTimer=window.setTimeout(()=>{this.saveColsSetting(),this.data.saveColsSettingTimer=0},200)},getColsSetting(){const{colOrders:i,colsSizes:e,colBorders:t,colVisibility:n}=this.state,s={},r=(o,a)=>{const l=s[o];l?Object.assign(l,a):s[o]={id:o,...a}};return i&&Object.keys(i).forEach(o=>{r(o,{order:i[o]})}),e&&Object.keys(e).forEach(o=>{r(o,{extraWidth:e[o]})}),t&&Object.keys(t).forEach(o=>{r(o,{border:t[o]})}),n&&Object.keys(n).forEach(o=>{r(o,{show:n[o]})}),Object.values(s)},async saveColsSetting(){const i=this.getColsSetting();if(!i.length)return;const{saveFieldsUrl:e}=this.options.customCols||{};if(!e)return;const t=JSON.stringify(i);t!==this.data.lastSavedColsSetting&&(this.data.lastSavedColsSetting=t,await y.post(e,{fields:t}))}},onRenderCell(i,{row:e,col:t,value:n}){const{iconRender:s}=t.setting;if(s&&t.type!=="icon"){const r=Dm(s,n,e);r&&i.push(r)}return i},onRender(){const{customCols:i}=this.options;if(!i)return;const{custom:e,setGlobal:t,reset:n,resetGlobal:s}=i;return{children:b("div",{className:"absolute gap-1.5 pr-1.5 top-0 right-0 z-20 row items-center",style:"background:var(--dtable-header-bg);height: calc(var(--dtable-header-height) - 2px)"},b("div",{className:"w-px border-l h-5"}),b("a",{className:"btn ghost square size-sm rounded","data-toggle":"dropdown","data-placement":"bottom-end"},b("i",{class:"icon icon-cog-outline"})),b("menu",{class:"dropdown-menu menu"},e&&b("li",{class:"menu-item"},b("a",{href:e.url,"data-toggle":"modal"},e.text)),t&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:t.url},t.text)),n&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:n.url},n.text)),s&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:s.url},s.text))))}},onUpdated(){const{updateCheckedRows:i}=this.options;i&&i!==this.data.updateCheckedRows&&(this.data.updateCheckedRows=i,this.toggleCheckRows(i,!0))}},_w=qe(Im,{buildIn:!0}),Ek="",fr=i=>`${i.col.name}[${i.row.id}]`,pr=(i,e,t,n="value")=>{const s=fr(e),r=i.data.formData[s]??e.value;return{[n]:r,className:"form-control",onChange:o=>i.setFormData(s,o instanceof Event?o.currentTarget.value:o),...t}};function Eh(i){const e=fr(i);let t=this.data.pickRefs.get(e);return t||(t=de(),this.data.pickRefs.set(e,t)),pr(this,i,{ref:t},"defaultValue")}const bw={input:{component:"input",props(i){return pr(this,i,{type:"text"})}},select:{component:function(i){const{items:e,defaultValue:t,...n}=i;return b("select",{...n},e.map(s=>b("option",{key:s.value,value:s.value},s.text)))},props(i){return pr(this,i)}},picker:{component:Gt,props:Eh},datePicker:{component:Qi,props(i){return pr(this,i,{className:"flex-auto",icon:"calendar"},"defaultValue")}},timePicker:{component:Ao,props(i){return pr(this,i,{className:"flex-auto",icon:"time"},"defaultValue")}},priPicker:{component:or,props:Eh},severityPicker:{component:fh,props:Eh}},ww=qe({name:"form",plugins:[nm],data(){return{formData:{},pickRefs:new Map}},colTypes:{control:{custom(i){let{control:e}=i.col.setting;if(typeof e=="function"&&(e=e.call(this,i)),!e)return;typeof e=="string"&&(e={type:e});const{controlMap:t}=this.options,{type:n}=e,s={name:fr(i)};let r;if([bw[n],t==null?void 0:t[n],e].forEach(o=>{if(o){const{props:a}=o;a&&y.extend(s,typeof a=="function"?a.call(this,i):a),r=o.component||r}}),!!r)return{component:r,props:s}}}},methods:{setFormData(i,e,t){var r,o;const{formData:n}=this.data;n[i]=e,t||(r=this.options.onFormChange)==null||r.call(this,i,e,n);const s=this.data.pickRefs.get(i);s&&((o=s.current)==null||o.setValue(e))},getFormData(i=!0){let{formData:e}=this.data;if(!i)return e;const{rows:t,cols:n}=this.layout,s=t.reduce((r,o)=>(n.list.forEach(a=>{var l;a.setting.control&&(r[fr({col:a,row:o})]=(l=o.data)==null?void 0:l[a.name])}),r),{});return e=y.extend(s,e),i===!0?e:e[i]},resetFormData(){this.data.formData={};const{rows:i,cols:e}=this.layout;i.forEach(t=>{e.list.forEach(n=>{var r,o;if(!n.setting.control)return;const s=this.data.pickRefs.get(fr({col:n,row:t}));s&&((o=s.current)==null||o.setValue(((r=t.data)==null?void 0:r[n.name])??""))})})}}}),Pk="",Lk="",Rk="",Ok="",zk="",Fk="",jk="",Bk="",Hk="",Wk="",Uk="",Vk="",Kk="",qk="",Gk="",Yk="";var Nm=11;function Cw(i,e){var t=e.attributes,n,s,r,o,a;if(!(e.nodeType===Nm||i.nodeType===Nm)){for(var l=t.length-1;l>=0;l--)n=t[l],s=n.name,r=n.namespaceURI,o=n.value,r?(s=n.localName||s,a=i.getAttributeNS(r,s),a!==o&&(n.prefix==="xmlns"&&(s=n.name),i.setAttributeNS(r,s,o))):(a=i.getAttribute(s),a!==o&&i.setAttribute(s,o));for(var c=i.attributes,d=c.length-1;d>=0;d--)n=c[d],s=n.name,r=n.namespaceURI,r?(s=n.localName||s,e.hasAttributeNS(r,s)||i.removeAttributeNS(r,s)):e.hasAttribute(s)||i.removeAttribute(s)}}var va,xw="http://www.w3.org/1999/xhtml",$t=typeof document>"u"?void 0:document,kw=!!$t&&"content"in $t.createElement("template"),Sw=!!$t&&$t.createRange&&"createContextualFragment"in $t.createRange();function Tw(i){var e=$t.createElement("template");return e.innerHTML=i,e.content.childNodes[0]}function $w(i){va||(va=$t.createRange(),va.selectNode($t.body));var e=va.createContextualFragment(i);return e.childNodes[0]}function Dw(i){var e=$t.createElement("body");return e.innerHTML=i,e.childNodes[0]}function Iw(i){return i=i.trim(),kw?Tw(i):Sw?$w(i):Dw(i)}function _a(i,e){var t=i.nodeName,n=e.nodeName,s,r;return t===n?!0:(s=t.charCodeAt(0),r=n.charCodeAt(0),s<=90&&r>=97?t===n.toUpperCase():r<=90&&s>=97?n===t.toUpperCase():!1)}function Nw(i,e){return!e||e===xw?$t.createElement(i):$t.createElementNS(e,i)}function Mw(i,e){for(var t=i.firstChild;t;){var n=t.nextSibling;e.appendChild(t),t=n}return e}function Ah(i,e,t){i[t]!==e[t]&&(i[t]=e[t],i[t]?i.setAttribute(t,""):i.removeAttribute(t))}var Mm={OPTION:function(i,e){var t=i.parentNode;if(t){var n=t.nodeName.toUpperCase();n==="OPTGROUP"&&(t=t.parentNode,n=t&&t.nodeName.toUpperCase()),n==="SELECT"&&!t.hasAttribute("multiple")&&(i.hasAttribute("selected")&&!e.selected&&(i.setAttribute("selected","selected"),i.removeAttribute("selected")),t.selectedIndex=-1)}Ah(i,e,"selected")},INPUT:function(i,e){Ah(i,e,"checked"),Ah(i,e,"disabled"),i.value!==e.value&&(i.value=e.value),e.hasAttribute("value")||i.removeAttribute("value")},TEXTAREA:function(i,e){var t=e.value;i.value!==t&&(i.value=t);var n=i.firstChild;if(n){var s=n.nodeValue;if(s==t||!t&&s==i.placeholder)return;n.nodeValue=t}},SELECT:function(i,e){if(!e.hasAttribute("multiple")){for(var t=-1,n=0,s=i.firstChild,r,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")r=s,s=r.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){t=n;break}n++}s=s.nextSibling,!s&&r&&(s=r.nextSibling,r=null)}i.selectedIndex=t}}},mr=1,Em=11,Am=3,Pm=8;function Un(){}function Ew(i){if(i)return i.getAttribute&&i.getAttribute("id")||i.id}function Aw(i){return function(t,n,s){if(s||(s={}),typeof n=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var r=n;n=$t.createElement("html"),n.innerHTML=r}else n=Iw(n);else n.nodeType===Em&&(n=n.firstElementChild);var o=s.getNodeKey||Ew,a=s.onBeforeNodeAdded||Un,l=s.onNodeAdded||Un,c=s.onBeforeElUpdated||Un,d=s.onElUpdated||Un,u=s.onBeforeNodeDiscarded||Un,p=s.onNodeDiscarded||Un,g=s.onBeforeElChildrenUpdated||Un,_=s.skipFromChildren||Un,C=s.addChild||function(ce,Z){return ce.appendChild(Z)},x=s.childrenOnly===!0,k=Object.create(null),$=[];function E(ce){$.push(ce)}function z(ce,Z){if(ce.nodeType===mr)for(var Ce=ce.firstChild;Ce;){var _e=void 0;Z&&(_e=o(Ce))?E(_e):(p(Ce),Ce.firstChild&&z(Ce,Z)),Ce=Ce.nextSibling}}function H(ce,Z,Ce){u(ce)!==!1&&(Z&&Z.removeChild(ce),p(ce),z(ce,Ce))}function Y(ce){if(ce.nodeType===mr||ce.nodeType===Em)for(var Z=ce.firstChild;Z;){var Ce=o(Z);Ce&&(k[Ce]=Z),Y(Z),Z=Z.nextSibling}}Y(t);function G(ce){l(ce);for(var Z=ce.firstChild;Z;){var Ce=Z.nextSibling,_e=o(Z);if(_e){var Ee=k[_e];Ee&&_a(Z,Ee)?(Z.parentNode.replaceChild(Ee,Z),ee(Ee,Z)):G(Z)}else G(Z);Z=Ce}}function X(ce,Z,Ce){for(;Z;){var _e=Z.nextSibling;(Ce=o(Z))?E(Ce):H(Z,ce,!0),Z=_e}}function ee(ce,Z,Ce){var _e=o(Z);if(_e&&delete k[_e],!Ce){var Ee=c(ce,Z);if(Ee===!1||(Ee instanceof HTMLElement&&(ce=Ee),i(ce,Z),d(ce),g(ce,Z)===!1))return}ce.nodeName!=="TEXTAREA"?he(ce,Z):Mm.TEXTAREA(ce,Z)}function he(ce,Z){var Ce=_(ce,Z),_e=Z.firstChild,Ee=ce.firstChild,qn,gt,kn,Sn,kt;e:for(;_e;){for(Sn=_e.nextSibling,qn=o(_e);!Ce&&Ee;){if(kn=Ee.nextSibling,_e.isSameNode&&_e.isSameNode(Ee)){_e=Sn,Ee=kn;continue e}gt=o(Ee);var Gn=Ee.nodeType,ln=void 0;if(Gn===_e.nodeType&&(Gn===mr?(qn?qn!==gt&&((kt=k[qn])?kn===kt?ln=!1:(ce.insertBefore(kt,Ee),gt?E(gt):H(Ee,ce,!0),Ee=kt,gt=o(Ee)):ln=!1):gt&&(ln=!1),ln=ln!==!1&&_a(Ee,_e),ln&&ee(Ee,_e)):(Gn===Am||Gn==Pm)&&(ln=!0,Ee.nodeValue!==_e.nodeValue&&(Ee.nodeValue=_e.nodeValue))),ln){_e=Sn,Ee=kn;continue e}gt?E(gt):H(Ee,ce,!0),Ee=kn}if(qn&&(kt=k[qn])&&_a(kt,_e))Ce||C(ce,kt),ee(kt,_e);else{var fe=a(_e);fe!==!1&&(fe&&(_e=fe),_e.actualize&&(_e=_e.actualize(ce.ownerDocument||$t)),C(ce,_e),G(_e))}_e=Sn,Ee=kn}X(ce,Ee,gt);var Cr=Mm[ce.nodeName];Cr&&Cr(ce,Z)}var J=t,se=J.nodeType,ge=n.nodeType;if(!x){if(se===mr)ge===mr?_a(t,n)||(p(t),J=Mw(t,Nw(n.nodeName,n.namespaceURI))):J=n;else if(se===Am||se===Pm){if(ge===se)return J.nodeValue!==n.nodeValue&&(J.nodeValue=n.nodeValue),J;J=n}}if(J===n)p(t);else{if(n.isSameNode&&n.isSameNode(J))return;if(ee(J,n,x),$)for(var we=0,Me=$.length;we{const{name:$,value:E}=k;$==="class"?C.addClass(E):p.getAttribute($)!==E&&(($==="zui-create"||$.startsWith("zui-create-"))&&(x=!1),p.setAttribute($,E))}),x&&u.add(p)}return!1}return!0},onBeforeElChildrenUpdated(p,g){const _=l==null?void 0:l(p,g);return _!==void 0?_:p.classList.contains("no-morph")?!1:!p.tagName.includes("-")},onElUpdated(p){if(o==null||o(p),p.tagName!=="SCRIPT"){p.hasAttribute(s)&&p.removeAttribute(s);const g=ks(p);Object.values(g).forEach(_=>{if(_ instanceof Fe){const{ATTR_KEY:C,DATA_KEY:x}=_.constructor;p.setAttribute(C,""),p.setAttribute(x,`${_.gid}`)}})}}}),n.zuiInit({update:"reset",beforeCreate:p=>!u.has(p)}),u.forEach(p=>{y(p).trigger("skipMorph")}),c&&n.find("script:not(.zui-js-run)").each((p,g)=>{const _=g.textContent;_&&n.runJS(_)})}y.fn.morph=function(i,e){return this.each((t,n)=>{Ph(n,i,e)})},y.fn.morphInner=function(i,e){return this.each((t,n)=>{Ph(n,i,{...e,childrenOnly:!0})})};function Lh(i){const e=y(i);e.css({minHeight:0}).css({minHeight:Math.max(32,e[0].scrollHeight)})}y.fn.autoHeight=function(){return this.each(function(){const i=y(this);i.data("auto-height")||i.on("input paste change",function(){Lh(this)}).data("auto-height",!0),Lh(i),setTimeout(()=>Lh(i),100)})},y.fn._append=y.fn.append,y.fn._prepend=y.fn.prepend,y.fn._before=y.fn.before,y.fn._after=y.fn.after,y.fn._html=y.fn.html;function ba(i,e){return typeof e=="string"&&(e.includes("zui-create")||e.includes("zui-init"))&&i.zuiInit(),i}function Lw(i){return!!i&&i.nodeType===1}y.extend(y.fn,{append(...i){return ba(this._append(...i),i.join(""))},prepend(...i){return ba(this._prepend(...i),i.join(""))},before(...i){const e=this.parent();return this._before(...i),ba(e,i.join("")),this},after(...i){const e=this.parent();return this._after(...i),ba(e,i.join("")),this},html(i,e){if(!arguments.length)return this[0]&&this[0].innerHTML;if(i===void 0)return this;const t=/]/.test(i);return typeof e=="boolean"&&(e={zuiInit:e}),this.each((n,s)=>{Lw(s)&&(t?y(s).empty()._append(i):s.innerHTML=i,(e==null?void 0:e.zuiInit)!==!1&&y(s).zuiInit())})}});const Rw=Object.freeze(Object.defineProperty({__proto__:null,createLink:Rt,parseLink:dp,parseUrlParams:up},Symbol.toStringTag,{value:"Module"}));window.$&&Object.assign(window.$,{...Rw,parseRawData:yl}),I.$=y,I.Ajax=xs,I.AjaxForm=ha,I.Avatar=nc,I.BUILD=1736926000471,I.BUILD_MODE=Tg,I.BatchForm=P_,I.BtnGroup=ic,I.Burn=Fc,I.Bus=md,I.Card=fa,I.CardList=vh,I.ColorPicker=Eo,I.CommonList=Ps,I.Component=Fe,I.ComponentFromReact=ye,I.Computed=ri,I.ContextMenu=hs,I.Custom=fo,I.CustomContent=me,I.CustomContentClass=Jd,I.CustomRender=Kl,I.DTable=us,I.Dashboard=bh,I.DataHub=hf,I.DatePicker=Lo,I.DatetimePicker=Ro,I.Dexie=Ws,I.DocApp=sr,I.Draggable=js,I.Dropdown=on,I.Dropmenu=lh,I.ECharts=Ip,I.Editor=an,I.Entity=Av,I.FileList=ch,I.FileSelector=Bo,I.FormGrid=Ap,I.FormSetting=Ep,I.Gantt=Pp,I.GlobalSearch=ua,I.Graph=Op,I.HElement=He,I.HElementSignals=Vl,I.HistoryPanel=rr,I.HtmlContent=vn,I.Icon=Ie,I.ImageSelector=Ho,I.ImgCutter=dh,I.Kanban=hr,I.KanbanList=ur,I.List=Rs,I.Mammoth=_b,I.Menu=mo,I.Messager=Rn,I.Modal=We,I.ModalBase=Xi,I.ModalTrigger=es,I.Moveable=Bs,I.Nav=Dc,I.NestedList=Os,I.PageEditor=la,I.Pager=Ic,I.Pick=Ko,I.Picker=qo,I.Popover=Pt,I.PopoverPanel=Wo,I.Portal=ql,I.PriPicker=ph,I.ProgressCircle=_o,I.PropModSymbol=Pv,I.PropModification=Lv,I.RangeSet=Mv,I.ReactComponent=pe,I.SearchBox=Go,I.SearchForm=Bt,I.SearchMenu=go,I.SearchTree=Pc,I.SeverityPicker=mh,I.Sidebar=Qo,I.Signal=ot,I.Sortable=bo,I.SortableList=wo,I.SortableTree=Co,I.Sticky=no,I.TIME_DAY=Ri,I.Tabs=dr,I.TimePicker=Po,I.Toolbar=Ac,I.Tooltip=is,I.Tree=Jo,I.Upload=Xo,I.UploadImgs=Lc,I.UserAvatar=da,I.VERSION=Sg,I.Zinbar=yh,I.addDate=Cd,I.addQueryToSearchForm=Hp,I.ajaxSubmit=vi,I.batch=Ms,I.bindCommands=so,I.bindHotkeys=Il,I.bus=Zt,I.cash=y,I.classes=V,I.clearData=yy,I.cmp=Ev,I.computed=Be,I.convertBytes=mn,I.cookie=rf,I.create=eo,I.createDate=je,I.createFormData=Ur,I.createPortal=Zd,I.createRef=de,I.deepCall=Mn,I.deepGet=Cs,I.deepGetPath=Yu,I.defineFn=Ay,I.delay=ai,I.disableScroll=fd,I.dom=Gy,I.downloadFile=Ts,I.effect=en,I.enterFullscreen=_d,I.evalValue=oi,I.executeCommand=Ol,I.executeCommands=kd,I.fetchData=mt,I.form=ww,I.formatBytes=pt,I.formatDate=rt,I.formatDateSpan=Hy,I.formatString=be,I.getClassList=gl,I.getComponent=$s,I.getFullscreenElement=Zr,I.getHotkeysMap=Dl,I.getReactComponent=Yd,I.getUniqueCode=Rl,I.getZData=Pi,I.h=b,I.hotkeys=My,I.i18n=Ne,I.init=Al,I.initGlobalComponents=El,I.isDiff=Vr,I.isFetchSetting=ml,I.isSameDay=Pn,I.isSameMonth=Pl,I.isSameWeek=zy,I.isSameYear=Ds,I.isToday=Fy,I.isTomorrow=By,I.isValidDate=Ll,I.isYesterday=jy,I.jsRaw=vy,I.liveQuery=Dv,I.mapFormData=Mp,I.mergeProps=xe,I.mergeRanges=Iv,I.morph=Ph,I.nextGid=wt,I.parseCommand=io,I.parseCommands=xd,I.parseRawData=yl,I.parseSize=hi,I.processSubmitResult=hh,I.rangesOverlap=Nv,I.reactComponents=Ul,I.readFile=Ky,I.registerComponent=bd,I.registerGlobalListener=pd,I.registerReactComponent=Ze,I.removeUndefinedProps=Sl,I.render=ci,I.renderCustomContent=uo,I.renderCustomResult=Qd,I.replacePrefix=Rv,I.runJS=Is,I.selectFile=Vy,I.setZData=vl,I.shareData=Zu,I.showCommentModal=uh,I.signal=Qe,I.store=Ye,I.storeData=Kr,I.takeData=ks,I.toCssSize=Ve,I.toggleFullscreen=Ml,I.toggleSearchForm=gh,I.uid=ss,I.unbindCommands=ro,I.unbindHotkeys=Nl,I.untracked=ev,I.updateSearchForm=Bp,I.zentao=_w,I.zentaoPlugin=Im,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}); +`,"")),c.startsWith("{const _=p.current;if(navigator.clipboard)navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([_.innerText],{type:"text/plain"}),"text/html":new Blob([_.innerHTML],{type:"text/html"})})]);else{const C=document.createRange();C.selectNode(_),window.getSelection().removeAllRanges(),window.getSelection().addRange(C),document.execCommand("copy"),window.getSelection().removeAllRanges()}}}:null,{key:"cancel",text:Ne.getLang("close")}].filter(Boolean),...l})}Object.assign(We,{reconfirm:bb,sortView:wb,showError:Cb}),We.DEFAULT.backdrop="static",We.DEFAULT.request={dataFilter:i=>{if(i[0]==="{")try{const e=JSON.parse(i);if(e.result)return hh(e,{closeModal:!0}),setTimeout(()=>{y(".modal").each(function(){const t=y(this);t.text().trim().length||t.modal("hide")})},200),""}catch{}return i}},Cc.defaultProps.iframeBodyClass="body-modal";function zp({pri:i="",text:e,className:t}){return i=`${i}`.trim(),e===void 0&&(e=i==="0"||i===""?"":i),b("span",{className:V(`pri-${i}`,t)},e)}let or=class extends lt{constructor(){super(...arguments),this._handleClearBtnClick=e=>{this.setValue(""),e.preventDefault()}}getDefaultState(e){const t=super.getDefaultState(e);if(t.value===void 0&&(e||this.props).required){const n=this._getItems().shift();n&&(t.value=n.value)}return t}_getTriggerProps(e,t){const n=super._getTriggerProps(e,t);return e.disabled&&(n.className=V(n.className,"disabled")),n}_renderTrigger(e,t){var l;const{value:n}=t,{placeholder:s,required:r}=e,o=n===void 0||n==="",a=!o&&!r;return[b("div",{className:"text"},o?b("span",{class:"placeholder"},s):this._renderItem(t.value,(l=this._getItems().find(({value:c})=>c===n))==null?void 0:l.text,"pri")),a?b(ke,{type:"button",class:"btn square btn-close size-xs ghost rounded-full",onClick:this._handleClearBtnClick},b("span",{class:"close"})):null,a?null:b("span",{key:"caret",class:"caret"})]}_getItems(){let{items:e=["",1,2,3,4]}=this.props;return Array.isArray(e)?e=e.map((t,n)=>typeof t=="object"?t:t?{text:`${t}`,value:`${n}`}:{text:"",value:""}):typeof e=="object"&&(e=Object.keys(e).map(t=>({value:t,text:e[t]}))),e=e.filter(({value:t})=>t!==""),e.sort((t,n)=>+t.value-+n.value),e}_renderItem(e,t,n){return b(zp,{key:n,pri:e,text:t})}_renderPop(){const{value:e}=this.state;return b("div",{className:"pick-pri-list"},this._getItems().map(({value:t,text:n})=>b("button",{key:t,type:"button",class:`btn w-full ${e===t?"primary-pale":"ghost"}`,"data-pick-value":t},this._renderItem(t,n))))}};or.defaultProps={...lt.defaultProps,items:["",1,2,3,4],className:"pick-pri form-control",popClass:"pick-pri-pop popup",popWidth:"auto",popMinWidth:56};function Fp({severity:i="",text:e,className:t}){i=`${i}`.trim(),e===void 0&&(e=i==="0"||i===""?"":i);const n=`${+e}`!=`${i}`;return b("span",{className:V(`severity${n?" severity-label":""}`,t),"data-severity":i},n?e:"")}let fh=class extends or{_renderItem(e,t,n){return b(Fp,{key:n,severity:e,text:t})}};fh.defaultProps={...or.defaultProps,items:["",1,2,3,4]};class ph extends ye{}ph.NAME="PriPicker",ph.Component=or;class mh extends ye{}mh.NAME="SeverityPicker",mh.Component=fh;const Ix="",Nx="";let jp=class extends He{constructor(e){super(e),this._syncPickerData=()=>{const n=this.getFormData();y(this.element).find(".pick-value[name]").each((s,r)=>{const o=y(r),a=o.attr("name"),l=n[a];o.val(l).trigger("syncValue")})},this._handleDeleteQueryClick=(n,s)=>{s.stopPropagation(),this.deleteQuery(n)},this._handleChange=n=>{const s=y(n.target),r=s.attr("name");r&&this.changeData(r,s.val())},this._handleSubmit=n=>{n.preventDefault(),this.submit()};const{setting:t}=e;this.state={showQueryPanel:!1,setting:t&&t.conditions?t:void 0},this.submit=this.submit.bind(this),this.reset=this.reset.bind(this)}get showMore(){var e;return this.state.more??((e=this.state.setting)==null?void 0:e.more)}get isShow(){return this.state.show??this.props.show}get loaded(){return!!this.state.setting}get groupItemCount(){var e;return((e=this.state.setting)==null?void 0:e.groupItemCount)||3}componentDidMount(){this.props.show&&this.show(),y.on("update.SearchForm.zt",(e,t)=>{t&&t.module===this.props.module&&this.load(t.reset??!0)}),y.on("addQuery.SearchForm.zt",(e,t)=>{t&&t.module===this.props.module&&this.addQuery(t.id,t.text)})}componentDidUpdate(e,t){const{container:n}=this.props;if(n){const s=y(n),r=this.state.show!==t.show;r&&s.toggleClass("show-search-form",this.state.show),(r||this.state.more!==t.more)&&s.trigger("layout.SearchForm.zt",this)}}componentWillUnmount(){y.off(".SearchForm.zt")}async load(e){if(this.state.loading)return;await this.changeState({loading:!0,...e?{data:void 0}:null});const t=this.props.url||Rt("search","buildForm",`module=${this.props.module}`);try{const n=await mt(t);await this.changeState({setting:n,loading:!1,clickedReset:!1})}catch{await this.changeState({loading:!1,clickedReset:!1})}e&&this._syncPickerData()}async show(){await this.changeState({show:!0}),this.loaded||await this.load()}toggleQueryPanel(e){return e===void 0&&(e=!this.state.showQueryPanel),this.changeState({showQueryPanel:e})}toggle(e){return e===void 0&&(e=!this.isShow),e?this.show():this.hide()}toggleMore(e){return e===void 0&&(e=!this.showMore),this.changeState({more:e})}hide(){return this.changeState({show:!1})}getFormData(e){var s;e=e||this.state.setting;const t={groupAndOr:"or"},n=this.groupItemCount*2;for(let r=1;r<=n;r++)t[`field${r}`]=((s=this._conditionList[r-1])==null?void 0:s.value)??"",t[`operator${r}`]="=",t[`value${r}`]="",t[`andOr${r}`]="and";return{...t,...e.defaultData,...this.state.data}}getSubmitData(){const e=this._data;return{module:this.props.module,actionURL:this.state.setting.actionURL,groupItems:this.groupItemCount,formType:this.showMore?"more":"lite",...e}}submit(){var n;let e=this.getSubmitData();if(!e)return;const t=(n=this.props.beforeSearch)==null?void 0:n.call(this,e);t!==!1&&(t&&(e=t),vi({url:this.props.searchUrl||Rt("search","buildQuery"),data:e,onSuccess:s=>{var r;return((r=this.props.onSearch)==null?void 0:r.call(this,s))===!1||this._handleSearch(y.extend({success:()=>this.load()},typeof s.load=="string"?{url:s.load}:s.load)),!1}}))}reset(){return this.changeState(e=>{const t=new Array(this.groupItemCount*2).fill(0).reduce((n,s,r)=>(n[`value${r+1}`]="",n),{});return{clickedReset:!0,data:{...e.data,...t}}},this._syncPickerData)}applyQuery(e){var s;const{actionURL:t}=this.state.setting,n=t.replace("myQueryID",String(e));((s=this.props.onSearch)==null?void 0:s.call(this,{result:"success",load:n}))!==!1&&this._handleSearch({url:n,success:()=>this.load(!0)})}deleteQuery(e,t){const{deleteQueryConfirm:n,canDeleteQuery:s}=this.state.setting;if(!t&&n){We.confirm(n).then(o=>{o&&this.deleteQuery(e,!0)});return}const r=typeof s=="string"?s.replace("{id}",`${e}`):Rt("search","deleteQuery",`queryID=${e}`);vi({url:r,onSuccess:()=>{const o=this.state.setting,{savedQueryList:a=[]}=o;return this.changeState({setting:{...o,savedQueryList:a.filter(l=>l.id!==e)}}),!1}})}addQuery(e,t){const n=this.state.setting,{savedQueryList:s=[]}=n;s.some(r=>r.id===e)||this.changeState({showQueryPanel:!0,setting:{...n,savedQueryList:[{id:e,text:t},...s]}})}changeData(e,t){const n={[e]:t};if(e.startsWith("field")){const s=t,r=+e.substring(5),{defaultOperator:o,defaultValue:a=""}=this._conditionMap[s];o&&(n[`operator${r}`]=o),n[`value${r}`]=a}else if(e.startsWith("value")){const s=this.getFormData(),r=+e.substring(5),o=s[`field${r}`],{control:a}=this._conditionMap[o];if(a==="date"){const l=t.startsWith("$"),c=s[`operator${r}`];l&&c!=="between"?n[`operator${r}`]="between":!l&&c==="between"&&(n[`operator${r}`]="<=")}}this.changeState(s=>({data:{...s.data,...n}}),this._syncPickerData)}_handleSearch(e){const t=this.element.closest(".modal");let{searchLoader:n=t?{load:"modal",target:t}:"table"}=this.props;const s=y(this.element);let r=s.closest(".tab-pane");typeof n=="string"?(n={load:n},r.length||(r=s.closest("#main"))):t&&(r.length||(r=y(t)));const o=r.find("[data-zui-dtable]");return o.length&&(n.load="table",n.target=o.children(".dtable").attr("id")),typeof e=="string"?n.url=e:typeof e=="object"&&(n={...n,...e}),y.trigger("locate.zt",n),!1}_renderOperators(e,t){var s;const n=this._operatorList;return b(Gt,{name:e,items:n,required:!0,defaultValue:t??((s=n[0])==null?void 0:s.value),search:!1,maxItemsCount:0})}_renderControl(e,t,n,s){const r=this._conditionMap[e]||{},{control:o="text"}=r,{controlRenders:a}=this.constructor,l=a[o]||a.text;return o==="date"&&r.datePeriods===void 0&&s.datePeriods&&(r.datePeriods=s.datePeriods),l.call(this,r,t,n??"")}_renderField(e,t,n,s,r){var d;const{conditions:o}=s,a=t*n+e+1,l=!e;this._conditionList||(this._conditionList=o.map(({text:u,name:p})=>({text:u??p,value:p})));const c=r[`field${a}`]??((d=o[a])==null?void 0:d.name);return b("tr",{key:a,className:"search-form-field"},b("td",{className:V("is-andOr",l?"font-bold text-right nowrap":void 0)},l?(s.groupTitles||[])[t]:this._renderAndOrSelect(`andOr${a}`,r[`andOr${a}`],s)),b("td",{className:"is-condition"},b(Gt,{name:`field${a}`,items:this._conditionList,required:!0,defaultValue:c,popMinWidth:"100%",popWidth:"auto",maxItemsCount:0})),b("td",{className:"is-operator"},this._renderOperators(`operator${a}`,r[`operator${a}`])),b("td",{className:"is-control",key:`${c}:${a}`},this._renderControl(c,`value${a}`,r[`value${a}`],s)))}_renderGroup(e,t,n){const{groupItemCount:s}=this,{showMore:r}=this,o=[],a=r?s:1;for(let l=0;l{const{name:p,text:g}=u;return this._conditionMap[p]=u,{text:g??p,value:p}});const{showMore:n}=this;this._operatorList=(e.operators||"=,!=,>,>=,<,<=".split(",")).map(u=>typeof u=="string"?{text:u,value:u}:u);const s=this.getFormData(e);this._data=s;const{searchBtnText:r="Search",resetBtnText:o="Reset",saveQueryBtnText:a="Save",canSaveQuery:l}=e,{simple:c,noMore:d}=t;return b("form",{key:"form",className:"search-form-wrapper flex-auto py-3 px-2",onSubmit:this._handleSubmit},b("div",{className:"row items-center",onChange:this._handleChange},this._renderGroup(0,e,s),b("div",{className:"col flex-none items-center justify-center px-4 w-24"},this._renderAndOrSelect("groupAndOr",s.groupAndOr,e)),this._renderGroup(1,e,s)),b("div",{className:`toolbar gap-4 justify-center flex-nowrap ${c?"ml-4":"mt-3"}`},b(ke,{key:"submit",type:"primary",btnType:"submit"},r),c?null:b(ke,{key:"reset",onClick:this.reset},o),c&&d?null:b("div",{className:c?"":"absolute top-0 right-0"},c?null:b(ke,{key:"saveQuery",type:"ghost",className:"text-primary","data-toggle":"modal",disabled:!l||this.state.clickedReset,url:l?typeof l=="string"?l:Rt("search","saveQuery",`module=${t.module}`):void 0,"data-title":a},a),d?null:b(ke,{key:"toggle",type:"ghost",className:"text-primary",icon:n?"chevron-double-up":"chevron-double-down",onClick:this.toggleMore.bind(this,void 0)}))))}_renderQueryPanel(e,t){const{savedQueryList:n=[],saveQueryPanelWidth:s=200,saveQueryPanelTitle:r="Saved queries",canDeleteQuery:o}=t;return b("div",{key:"panel",className:V("search-form-query sidebar sidebar-right pt-3 transition-none",e?"is-expanded":"is-collapsed"),style:{minHeight:100,width:e?Ve(s):0,transition:"none"}},b("div",{class:"sidebar-gutter gutter gutter-border gutter-horz border-default",onClick:this.toggleQueryPanel.bind(this,void 0)},b("button",{class:"gutter-toggle",type:"button"},b("span",{class:"chevron-right"}))),e?b("div",{className:"search-form-query-panel pl-3 h-full col"},b("div",{className:"search-form-query-title font-bold mb-1.5 flex-none"},r),b("ul",{className:"search-form-query-list col items-start gap-1 overflow-auto scrollbar-hover pr-3 pb-2 pt-px pl-0"},n.map(({id:a,text:l,noDelete:c})=>b("li",{key:a,className:`search-form-query-item label gray-pale rounded-full state pl-2 hover:text-primary hover:primary-pale inline-flex gap-1 max-w-full ${o&&!c?"pr-0":"pr-2"}`,onClick:this.applyQuery.bind(this,a)},b("span",{className:"min-w-0 flex-auto overflow-hidden nowrap"},l),o&&!c?b(ke,{type:"ghost",className:"size-xs rounded-full flex-none"},b("i",{className:"close",onClick:this._handleDeleteQueryClick.bind(this,a)})):null)))):null)}_getProps(e){return{...super._getProps(e),"data-module":e.module}}_getClassName(e){const t=super._getClassName(e);if(!this.isShow)return[t,"search-form","hidden"];const{setting:n,showQueryPanel:s}=this.state,{showMore:r}=this,o=n==null?void 0:n.savedQueryList;return[t,"search-form",n?"is-loaded":"is-empty",{"is-lite":!r,"is-more":r,"is-simple":e.simple,"show-save-query":o&&s}]}_getChildren(e){if(!this.isShow)return null;const{setting:t,showQueryPanel:n,loading:s}=this.state,r=!e.simple&&t&&t.savedQueryList;return b("div",{className:V(`search-form-container row gap-3 load-indicator${s?" loading":""}`,e.innerClass),style:`max-height: ${76+44*(this.showMore?this.groupItemCount:1)}px`},t?this._renderForm(t,e):null,r?this._renderQueryPanel(n,t):null)}};jp.controlRenders={text:(i,e,t)=>b("input",{className:"form-control",type:"text",name:e,value:t,placeholder:i.placeholder,...i.controlProps}),select:(i,e,t)=>{const{items:n=[]}=i;return b(Gt,{name:e,items:n,defaultValue:t,placeholder:i.placeholder,popMinWidth:"100%",popWidth:"auto",maxItemsCount:0,...i.controlProps})},date:(i,e,t)=>{const{datePeriods:n}=i,s={};return n&&(s.menu=[...n],s.allowInvalid=!0,s.display=r=>{const o=n.find(a=>a.value===r);return o?o.text:r}),b(Qi,{name:e,defaultValue:t,placeholder:i.placeholder,...s,...i.controlProps})},time:(i,e,t)=>b(Ao,{name:e,defaultValue:t,placeholder:i.placeholder,...i.controlProps}),datetime:(i,e,t)=>b(bc,{name:e,defaultValue:t,placeholder:i.placeholder,...i.controlProps})};class Bt extends ye{}Bt.NAME="SearchForm",Bt.Component=jp,Bt.replace=!0,Bt.toggleForm=gh,Bt.update=Bp,Bt.addQuery=Hp,Bt.toggle={convertHref:!0,getOptions(i,e){const t=y(i);if(t.is("a")){const n=t.attr("href");n&&(!e.target&&"#.".includes(n[0])?e.target=n:e.url||(e.url=n))}return e},handler(i,e){gh({container:y(i).closest(e.container||".modal,#main"),...e})}},Bt.register();function gh(i){typeof i=="string"?i={module:i}:i||(i={module:window.config.currentModule});const e=y(i.container||".modal,#main").first();if(!e.length)return;i.module||(i.module=window.config.currentModule);let t;if(i.target?t=y(i.target,e):(t=e.find(`[${Bt.DATA_KEY}],.search-form`),i.module&&(t=t.filter(`[data-module="${i.module}"]`))),!t.length){let s=e.closest(".modal").find(".modal-body");s.length||(s=e.find(".main-content-cell")),s.length||(s=e.find("#mainContent")),t=y("
").attr({"zui-key":"searchForm","data-module":i.module}).prependTo(s.length?s.first():e)}let n=t.zui(Bt.NAME);return n?n.$.toggle(i.show):n=new Bt(t,{container:e,show:!0,...i}),n}function Bp(i,e){y.trigger("update.SearchForm.zt",{module:i,reset:e})}function Hp(i){y.trigger("addQuery.SearchForm.zt",i)}const Mx="";class da extends ye{}da.NAME="UserAvatar",da.Component=nr,da.register();const xb={1:"error",2:"warning",4:"parse",8:"notice",16:"core-error",32:"core-warning",64:"compile-error",128:"compile-warning",256:"user-error",512:"user-warning",1024:"user-notice",2048:"strict",4096:"recoverable-error",8192:"deprecated",16384:"user-deprecated",32767:"all"};function Wp(i){return typeof i=="number"&&(i=xb[i]),i}function Up(i){return i=Wp(i),i.includes("error")?"error":i.includes("warning")?"warning":"info"}function kb({errors:i,...e}){const t=i.reduce((n,s)=>(n[Up(s.level)]++,n),{error:0,warning:0,info:0});return b("div",{class:"row items-stretch text-sm","data-hint":"PHP errors",...e},t.error?b("button",{type:"button",class:"state font-bold px-0.5 danger"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"ERR"),t.error):null,t.warning?b("button",{type:"button",class:"state font-bold px-0.5 danger bg-opacity-90"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"WAR"),t.warning):null,t.info?b("button",{type:"button",class:"state font-bold px-0.5 danger bg-opacity-80"},b("span",{class:"scale-95 font-bold inline-block text-opacity-70 text-canvas"},"INF"),t.info):null)}function Ot(i,e,t,n){console.groupCollapsed(`%c${i} %c${e}`,"color: #fff; background-color: #9333ea; padding: 0 0.1em 0 0.25em; border-radius: 0.25em 0 0 0.25em;","color: #9333ea; background-color: #e9d5ff; padding: 0 0.5em; border-radius: 0 0.25em 0.25em 0;",n),console.table(t),console.groupEnd()}function Hn(i,e=400,t=100){return i{g.Duration>.3&&u++,g.Duration>p.Duration&&(p=g)}),s.push(b("div",{class:`px-0.5 state text-${Hn(u,3,1)}`,"data-hint":"服务器最慢SQL数 (好<3≤正常<1≤差)",onClick:Ot.bind(null,"SQL Query",`${d.length} SQL profiles`,d,i.id)},b("span",{class:"scale-95 font-bold inline-block"},"LQ"),u)),p.Duration){const g=p.Duration*1e3;s.push(b("div",{class:`px-0.5 state text-${Hn(g,600,300)}`,"data-hint":"服务器最慢SQL耗时 (好<600≤正常<300≤差)",onClick:Ot.bind(null,"SQL Query",`Slowest SQL query: ${g}ms`,p,i.id)},b("span",{class:"scale-95 font-bold inline-block"},"MLQ"),Yt(g)))}}}else s.push(b("div",{class:"muted px-0.5"},"loading..."));return b("div",{class:"zin-perf-btn-list row items-center bg-black text-sm"},b("div",{class:"px-1 bg-canvas bg-opacity-20 self-stretch flex items-center","data-hint":`请求 ${i.id} URL: ${i.url}`},b("span",{class:"muted"},n)),s,o?b("a",{class:"state text-secondary px-0.5",href:o,target:"_blank","data-hint":"打开 xhprof 报告"},"XHP"):null)}function Sb(i){Ot("Trace","Error",i,i.message),navigator.clipboard.writeText(`vim +${i.line} ${i.file}`)}function Tb({errors:i=[],show:e,basePath:t}){i.length||(e=!1);const n=i.map(s=>{const r=Wp(s.level),o=Up(r),a=o==="error"?"danger":o==="info"?"important":"warning";return b("div",{class:`zin-error-item state ${a}-pale text-fore px-2 py-1 ring ring-darker`,onClick:Sb.bind(null,s)},b("div",{class:"zin-error-msg font-bold text-base"},b("strong",{class:`text-${a}`,style:"text-transform: uppercase;"},r)," ",s.message),b("div",{class:"zin-error-info text-sm opacity-60 break-all"},b("strong",null,"vim +",s.line)," ",b("span",{className:"underline"},t?s.file.substring(t.length):s.file)))});return b("div",{class:`zin-errors-panel canvas absolute bottom-full left-0 mono shadow-xl ring rounded fade-from-bottom ${e?"in":"events-none"}`},n)}const Ex="";function $b(){const i=navigator.userAgent;let e="Unknown",t="Unknown";return i.indexOf("Chrome")>-1?(e="Chrome",t=i.substring(i.indexOf("Chrome")+7)):i.indexOf("Firefox")>-1?(e="Firefox",t=i.substring(i.indexOf("Firefox")+8)):i.indexOf("Safari")>-1?(e="Safari",t=i.substring(i.indexOf("Safari")+7),i.indexOf("Version")>-1&&(t=i.substring(i.indexOf("Version")+8))):window.StyleMedia&&(e="Edge",t=i.substring(i.indexOf("Edge")+5)),t=t.split(" ")[0],t=t.split(";")[0],t=t.split(")")[0],{name:e,version:t}}let Db=class extends pe{constructor(e){var t,n;super(e),this._timer=0,this._browser=$b(),this._guardData={},this.state={showPanel:e.defaultShow??!0,showZinbar:!!((n=(t=e.defaultData)==null?void 0:t.errors)!=null&&n.length||!Ye.get("Zinbar:hidden")),...e.defaultData},this.togglePanel=this.togglePanel.bind(this),this.sendGuardData=this.sendGuardData.bind(this),this.handleClickOutside=this.handleClickOutside.bind(this)}componentDidMount(){document.addEventListener("click",this.handleClickOutside)}componentDidUpdate(){var o,a,l,c;const{pagePerf:e}=this.state;let t="",n="";const s=(a=(o=e==null?void 0:e.trace)==null?void 0:o.sqlQuery)==null?void 0:a.length,r=(c=(l=e==null?void 0:e.trace)==null?void 0:l.request)==null?void 0:c.timeUsed;if(r&&e.renderEnd){const d=e.renderEnd-e.renderBegin,u=r+d,p=[];let g="",_="";u>=500?(g="danger",p.push(`处理时间${Yt(u)}超过500ms(后端${Yt(r)},前端${Yt(d)})`)):u>=300&&(g="warning",p.push(`处理时间${Yt(u)}超过300ms(后端${Yt(r)},前端${Yt(d)})`)),s&&(s>=60?(_="danger",p.push(`SQL查询超过60次(实际${s})`)):s>=40&&(_="warning",p.push(`SQL查询超过40次(实际${s})`))),(g||_)&&(t=g==="danger"||_==="danger"?"danger":"warning",n=[t==="danger"?"页面有性能问题":"页面有优化空间",...p].join(","))}y("body").z({perf:t,perfMessage:n})}componentWillUnmount(){document.removeEventListener("click",this.handleClickOutside)}handleClickOutside(e){const t=e.target;this.state.showPanel&&!t.closest(".zinbar")&&this.setState({showPanel:!1})}async sendGuardData(e=180){var g,_,C;const{guardApi:t}=this.props;if(!t)return;this._timer&&clearTimeout(this._timer);const{pagePerf:n}=this.state;if(!(n!=null&&n.renderEnd))return;if(e){this._timer=window.setTimeout(()=>{this.sendGuardData(0)},e);return}const s=dp(n.url);if(!(s!=null&&s.moduleName))return;this.setState({guardState:"sending"});const{author:r="anonymous",email:o,host:a=location.origin}=this.props,{profiles:l=[],sqlQuery:c=[],request:d}=n.trace||{};l.forEach(x=>{x.DurationOriginal||(x.DurationOriginal=x.Duration,x.Duration=1e3*x.Duration)});const u=c.findIndex(x=>x.includes("SET profiling = ")),p=u>=0?c.length-u-1:c.length;this._guardData={timestamp:Date.now(),identifier:r,email:o,requestId:ss(),dataVer:3,request:{host:a,url:/https?:/.test(n.url)?n.url:`${a}${n.url}`,module:s.moduleName,method:s.methodName,xhprof:n.xhprof?/https?:/.test(n.xhprof)?n.xhprof:`${a}${n.xhprof}`:null,php:d==null?void 0:d.php,errorCount:((g=this.state.errors)==null?void 0:g.length)||0,errors:this.state.errors??[]},userEnv:{system:navigator.userAgentData?navigator.userAgentData.platform:navigator.platform,userAgent:navigator.userAgent,browser:[this._browser.name,this._browser.version].join(" ")},metrics:{frontend:{renderTime:Math.round(n.renderEnd-n.renderBegin),downloadSize:n.dataSize},backend:{totalTime:d==null?void 0:d.timeUsed,sqlTime:l.reduce((x,k)=>x+k.Duration,0),sqlCount:Math.max(l.length||0,p),sqlDetails:l,phpFileLoaded:((_=n.trace)==null?void 0:_.files.length)||0,phpFiles:(C=n.trace)==null?void 0:C.files,requestMemory:d==null?void 0:d.memory}}};try{const x=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this._guardData),mode:"no-cors"});this._guardData.$response=await x.text(),this.setState({guardState:!0})}catch(x){this._guardData.$error=x,console.error("[ZUI] Send guard data failed:",x,this),this.setState({guardState:"error"})}}update(e,t,n){this.setState(s=>{const r=!(e!=null&&e.id)||e.id==="page",o={};return r?(e&&(o.pagePerf={...s.pagePerf,...e}),t&&(o.errors=t),e!=null&&e.requestEnd||(o.guardState=!1)):(e&&(o.partPerf={...s.partPerf,...e}),t&&(o.errors=[...s.errors??[],...t??[]])),n&&(o.basePath=n),o},this.props.guardApi?this.sendGuardData:void 0)}togglePanel(){this.setState({showPanel:!this.state.showPanel})}toggleZinbar(){const e=!this.state.showZinbar;this.setState({showZinbar:e},()=>{Ye.set("Zinbar:hidden",!e)})}render(){const{errors:e,pagePerf:t,partPerf:n,showZinbar:s,basePath:r,guardState:o}=this.state,{fixed:a}=this.props,l=e==null?void 0:e.length;return b("div",{className:V("zinbar row h-5 items-stretch gap-px inverse bg-opacity-50",a?"relative":"fixed right-0 bottom-0",{collapse:!s}),style:{zIndex:9999}},b("button",{type:"button","data-hint":s?"折叠":"展开",className:`w-4 ${l&&!s?"danger":"bg-inverse"} flex items-center justify-center`,style:{marginLeft:-15},onClick:this.toggleZinbar.bind(this)},b("span",{class:s?"caret-right":"caret-left"})),l?b(kb,{errors:e,onClick:this.togglePanel}):null,t?b(Vp,{perf:t,guardState:o,guardData:this._guardData}):null,n?b(Vp,{perf:n}):null,b(Tb,{show:this.state.showPanel,basePath:r,errors:e}))}};class yh extends ye{}yh.NAME="Zinbar",yh.Component=Db;let Kp=class extends He{_renderContent(e){const{subtitle:t,subtitleClass:n,content:s,contentClass:r}=e;if(!(!t&&!s))return[S("div",{className:V("card-content",r),children:[t?S("div",{className:V("card-subtitle",n),children:S(me,{content:t})},"subtitle"):null,s?S(me,{content:s},"extraContent"):null]},"content")]}_renderHeading(e){const{icon:t,prefix:n,prefixClass:s,title:r,titleClass:o,titleUrl:a,titleAttrs:l,suffix:c,suffixClass:d,heading:u,headingClass:p}=e;if(!t&&!n&&!r&&!c&&!u)return;const g=a?"a":"span";return S("div",{className:V("card-heading",p),children:[t?S(Ie,{className:"card-icon",icon:t},"icon"):null,n?S(me,{className:V("card-prefix",s),content:n},"prefix"):null,r?S(g,{className:V("card-title",o),href:a,...l,children:S(me,{content:r})},"title"):null,c?S(me,{className:V("card-suffix",d),content:c},"suffix"):null,u?S(me,{content:u},"extraHeading"):null]})}_renderHeader(e){const{header:t,headerClass:n}=e;if(t)return S("div",{className:V("card-header",n),children:S(me,{content:t},"header")})}_renderFooter(e){const{footer:t,footerClass:n,footActions:s}=e;if(t||s)return S("div",{className:V("card-footer",n),children:[S(me,{content:t},"footer"),Oe.render(s,[e],{key:"foot-actions",relativeTarget:e,className:"card-foot-actions",size:"sm"},this)]})}_renderActions(e){return Oe.render(e.actions,[e],{key:"actions",relativeTarget:e,className:"card-actions",size:"sm"},this)}_renderList(e){const{items:t}=e;if(!t)return;const n=xe({key:"list",className:"card-list"},typeof t=="object"?t:{items:t});return S(ft,{...n})}_renderAvatar(e){const{avatar:t}=e;if(t){const n=typeof t=="function"?t.call(this,e):t;if(n)return n.className=V("item-avatar",n.className),S(Bi,{...n},"avatar")}}_getClassName(e){return["card",e.className,e.selected?"selected":""]}_getChildren(e){return[this._renderActions(e),this._renderHeader(e),this._renderAvatar(e),this._renderHeading(e),this._renderContent(e),this._renderList(e),this._renderFooter(e),e.children]}};class qp extends Kp{_getClassName(e){return e.className}_getChildren(e){const{innerAttrs:t,innerClass:n,selected:s,innerComponent:r="div"}=e,o=xe({className:V("card",n,s?"selected":"")},t);return S(r,{...o,children:super._getChildren(e)})}}let cs=class extends ft{_getClassName(e){return[super._getClassName(e),e.countPerRow?"card-grid":""]}_getProps(e){const{gap:t,countPerRow:n}=e;return xe({style:{"--list-gap":t?Ve(t):void 0,"--list-count-per-row":n}},super._getProps(e))}_getRenderedItem(e,t){return t}};cs.NAME="card-list",cs.TAG="div",cs.ItemComponents={...ft.ItemComponents,default:qp,item:qp},cs.defaultItemProps={component:"div"};class fa extends ye{}fa.NAME="Card",fa.Component=Kp,fa.replace=!0;class vh extends ye{}vh.NAME="CardList",vh.Component=cs;const Ax="",Px="";class hs extends on{_getLayoutOptions(){const e=super._getLayoutOptions();return this.options.element||(e[0]={getBoundingClientRect:this._getClickBounding}),e}}hs.NAME="ContextMenu",hs.DEFAULT={...on.DEFAULT,name:"contextmenu",trigger:"contextmenu"},hs.register();const Lx="",Rx="";function Ib(i){const{left:e,className:t,top:n,id:s,onMenuBtnClick:r,title:o,width:a,height:l,content:c,loading:d,draggable:u=!0}=i;return S("div",{class:"dashboard-block-cell",style:{left:e,top:n,width:a,height:l},children:S("div",{className:V("dashboard-block load-indicator",d&&!c?"loading":"",r?"has-more-menu":"",t),draggable:u,"data-id":s,children:[S("div",{class:"dashboard-block-header",children:[S("div",{class:"dashboard-block-title",children:o}),r?S("div",{class:"dashboard-block-actions toolbar",children:S("button",{class:"toolbar-item dashboard-block-action btn square ghost rounded size-sm","data-type":"more",onClick:r,children:S("div",{class:"more-vert"})})}):null]}),y.isPlainObject(c)&&c.html?S(vn,{className:"dashboard-block-body",executeScript:!0,...c}):S("div",{class:"dashboard-block-body",children:c})]})})}const Ox="",zx="",_h=([i,e,t,n],[s,r,o,a])=>!(i+t<=s||s+o<=i||e+n<=r||r+a<=e),Gp=(i,e)=>i[1]===e[1]?i[0]-e[0]:i[1]-e[1],pa="Dashboard:Block.cache:";let Yp=class extends pe{constructor(e){super(e),this._ref=de(),this._loadTimer=0,this._map=new Map,this._oldMap=new Map,this.tryLoadNext=()=>{clearTimeout(this._loadTimer),this._loadTimer=window.setTimeout(()=>this.loadNext(),100)},this._checkLayout=()=>{const{onLayoutChange:t}=this.props;if(!t)return;const{blocks:n}=this.state,s={};let r=!1;n.forEach(o=>{const[a,l,c,d]=this._map.get(o.id),u=this._oldMap.get(o.id);(!u||u[0]!==a||u[1]!==l||u[2]!==c||u[3]!==d)&&(r=!0,s[o.id]={left:a,top:l,width:c,height:d},this._oldMap.set(o.id,[a,l,c,d]))}),r&&t(s)},this._handleMenuClick=t=>{const n=t.target.closest(".dashboard-block");if(!n)return;const s=n.dataset.id;if(!s)return;const r=this.getBlock(s);if(!r||!r.menu)return;const{menu:o}=r,{onClickMenu:a}=this.props;hs.show({triggerEvent:t,element:t.currentTarget,placement:"bottom-end",menu:{onClickItem:l=>{var c;((c=l.item.data)==null?void 0:c.type)==="refresh"&&this.load(s),a&&a.call(this,l,r)},...o}})},this.state={blocks:this._initBlocks(e.blocks)}}getBlock(e){return this.state.blocks.find(t=>t.id===e)}update(e,t){const{id:n}=e,{blocks:s}=this.state,r=s.findIndex(a=>a.id===n);if(r<0)return;const o=s[r];e.fetch&&e.fetch!==o.fetch&&e.needLoad===void 0&&(e.needLoad=!0),s[r]={...o,...e},this.setState({blocks:s},t)}delete(e){const{blocks:t}=this.state,n=t.findIndex(s=>s.id===e);n<0||(t.splice(n,1),this.setState({blocks:t}))}add(e){e=Array.isArray(e)?e:[e],this.setState({blocks:[...this.state.blocks,...this._initBlocks(e)]})}load(e,t){const n=this.getBlock(e);!n||n.loading||(t=t||n.fetch,t&&this.update({id:e,loading:!0,needLoad:!1},async()=>{try{const s=await y.fetch(t,[e,n],({url:r})=>({url:be(r,n),dataType:"html"}));this.update({id:e,loading:!1,content:{html:s}},()=>{var r;this._setCache(e,s),(r=this.props.onLoad)==null||r.call(this,n)})}catch(s){const r=S("div",{class:"panel center text-danger p-5",children:["Error: ",s.message]});this.update({id:e,loading:!1,content:r},()=>{var o;(o=this.props.onLoadFail)==null||o.call(this,s,n)})}}))}reset(e){this.setState({blocks:this._initBlocks(e)})}loadNext(){const{blocks:e}=this.state;let t="";for(const n of e){if(n.loading)return;if(!n.visible&&this._isVisible(n.id))return this.update({id:n.id,visible:!0});if(n.needLoad&&n.visible){t=n.id;break}}t.length&&requestAnimationFrame(()=>this.load(t))}_isVisible(e){return!this.props.onlyLoadVisible||!!y(this._ref.current).find(`.dashboard-block[data-id="${e}"]`).isVisible()}_setCache(e,t){const{cache:n}=this.props;if(n)try{typeof n=="string"?Ye.set(`${pa}${n}:${e}`,t):Ye.session.set(`${pa}${e}`,t)}catch(s){console.warn("ZUI: Failed to cache block content.",{id:e,html:t,error:s})}}_getCache(e){const{cache:t}=this.props;if(!t)return;const n=typeof t=="string"?Ye.get(`${pa}${t}:${e}`):Ye.session.get(`${pa}${e}`);if(n)return{html:n}}_initBlocks(e){const{blockFetch:t,blockMenu:n,grid:s}=this.props;return e.map(o=>{const{id:a,size:l,width:c,height:d,left:u=-1,top:p=-1,fetch:g=t,menu:_=n,content:C,...x}=o,[k,$]=this._getBlockSize(c&&d?{width:c,height:d}:l);return{id:`${a}`,width:k,height:$,left:Math.min(u,s-k),top:p,fetch:g,menu:_,content:C??this._getCache(`${a}`),loading:!1,needLoad:!!g,...x}})}_getBlockSize(e){const{blockDefaultSize:t,blockSizeMap:n}=this.props;return e=e??t,typeof e=="string"&&(e=n[e]),e=e||t,Array.isArray(e)||(e=[e.width,e.height]),e}_layout(){const{blocks:e,dragging:t,dropping:n}=this.state,s=this._map;if(s.size){const a=[0,0,0,0];e.sort((l,c)=>Gp(s.get(l.id)||a,s.get(c.id)||a))}s.clear(),t&&n&&s.set(t,n),e.forEach(a=>{a.id!==t&&this._layoutBlock(a)});const r=Array.from(s.entries());r.sort((a,l)=>Gp(a[1],l[1]));let o=0;return r.forEach(([a,l])=>{let c=l[1]-1;for(;c>=0&&this._canMove([l[0],c,l[2],l[3]],a);)c--;c++,l[1]=c,o=Math.max(o,c+l[3])}),n&&(o=Math.max(o,n[1]+n[3])),{blocks:e,height:o}}_initDraggable(){const e=this._ref.current;this._draggable=new js(e,{selector:".dashboard-block",target:()=>e,beforeDrag:(t,n)=>{const s=n.getBoundingClientRect();if(t.clientY-s.top>48)return t.preventDefault(),!1;this._dragOffset=[t.clientX-s.left,t.clientY-s.top]},onDragStart:(t,n)=>{const s=n.dataset.id;s!==void 0&&(this._dragging=this._map.get(s),this.setState({dragging:s}))},onDragOver:t=>{const{cellHeight:n,grid:s}=this.props,r=e.getBoundingClientRect(),[,,o,a]=this._dragging,[l,c]=this._dragOffset,d=Math.min(s-o,Math.max(0,Math.round((t.clientX-r.left-l)/(r.width/s)))),u=Math.max(0,Math.round((t.clientY-r.top-c)/n)),p=this.state.dropping;p&&p[0]===d&&p[1]===u||this.setState({dropping:[d,u,o,a]})},onDragEnd:()=>{const{dragging:t,dropping:n}=this.state,s={dragging:void 0,dropping:void 0},r={};if(t&&n){const{blocks:o}=this.state;o.forEach((a,l)=>{const[c,d]=t===a.id?n:this._map.get(a.id);(a.left!==c||a.top!==d)&&(o[l]={...a,left:c,top:d},r[a.id]={left:c,top:d})}),s.blocks=o}this.setState(s,this._checkLayout),this._dragging=void 0,this._dragOffset=void 0}})}_layoutBlock(e){const{id:t,left:n,top:s,width:r,height:o}=e,a=[n,s,r,o];n<0||s<0?this._appendBlock(t,a):this._insertBlock(t,a)}_canMove(e,t){const{dropping:n}=this.state;if(n&&_h(e,n))return!1;for(const[s,r]of this._map.entries())if(s!==t&&_h(r,e))return!1;return!0}_canPlace(e){const{dragging:t}=this.state;return this._canMove(e,t)}_insertBlock(e,t){const{dropping:n}=this.state;for(n&&_h(t,n)&&(t[1]=n[1]+n[3]);!this._canPlace(t);)t[1]=t[1]+1;this._map.set(e,t)}_appendBlock(e,t){const[n,s,r,o]=t;let a=s;if(n>=0&&s>=0){if(this._canPlace(t)){this._map.set(e,[n,s,r,o]);return}a=-1}let l=n<0?0:n,c=a<0?0:a,d=!1;const u=this.props.grid;for(;!d;){if(this._canPlace([l,c,r,o])){d=!0;break}n<0?(l+=1,l+r>u&&(l=0,c+=1)):c+=1}this._map.set(e,[l,c,r,o])}componentDidMount(){this.loadNext(),y(window).on("scroll",this.tryLoadNext),this._initDraggable();for(const[e,t]of this._map.entries())this._oldMap.set(e,[...t])}componentDidUpdate(e){e.blocks!==this.props.blocks?this.setState({blocks:this._initBlocks(this.props.blocks)}):this.loadNext()}componentWillUnmount(){clearTimeout(this._loadTimer),y(window).off("scroll",this.tryLoadNext),this._draggable.destroy()}render(){const{blocks:e,height:t}=this._layout(),{cellHeight:n,grid:s,emptyBlockContent:r}=this.props,{dropping:o,dragging:a}=this.state,l=this._map;return S("div",{class:"dashboard",children:S("div",{class:"dashboard-blocks",style:{height:t*n},ref:this._ref,children:[o?S("div",{className:"dashboard-drop-shadow",style:{left:`${100*o[0]/s}%`,top:n*o[1],width:`${100*o[2]/s}%`,height:n*o[3]}},"dropping"):null,e.map((c,d)=>{const{id:u,menu:p,content:g,title:_}=c,[C,x,k,$]=u===a&&o?o:l.get(u)||[0,0,c.width,c.height];return S(Ib,{id:u,index:d,left:`${100*C/s}%`,top:n*x,width:`${100*k/s}%`,height:n*$,content:g??r,title:_,className:V(c.needLoad?"need-load":"",g?"has-content":""),onMenuBtnClick:p?this._handleMenuClick:void 0},c.id)})]})})}};Yp.defaultProps={responsive:!1,cache:!0,blocks:[],grid:3,gap:16,cellHeight:64,blockDefaultSize:[1,3],blockMenu:{items:[{text:"Refresh",data:{type:"refresh"}}]},onlyLoadVisible:!0,blockSizeMap:{xs:[1,3],sm:[1,4],md:[1,5],lg:[1,6],xl:[1,8],xsWide:[2,3],smWide:[2,4],mdWide:[2,5],lgWide:[2,6],xlWide:[2,8],xsLong:[3,3],smLong:[3,4],mdLong:[3,5],lgLong:[3,6],xlLong:[3,8]}};class bh extends ye{}bh.NAME="Dashboard",bh.Component=Yp;function wh(i,e,t,n){if(typeof i=="function"&&(i=i.call(this,e)),typeof i=="string"&&i.length&&(i={url:i}),!i)return Array.isArray(t)?S(yn,{children:t}):t;const{url:s,...r}=i,{setting:o}=e.col,a={};return o&&Object.keys(o).forEach(l=>{l.startsWith("data-")&&(a[l]=o[l])}),S("a",{href:be(s,e.row.data),...n,...r,...a,children:t})}function Ch(i,e,t){if(i==null)return;const n=e.row.data;return t=t??(n==null?void 0:n[e.col.name]),typeof i=="function"?i.call(this,t,e):be(i,{...n,0:t})}function Qp(i,e,t,n){var s;return t?(t=t??((s=e.row.data)==null?void 0:s[e.col.name]),t==="0000-00-00 00:00:00"||t==="0000-00-00"?n??"":i===!1?t:(i===!0&&(i="[yyyy-]MM-dd hh:mm"),typeof i=="function"&&(i=i.call(this,t,e)),rt(t,i,n??t))):n??t}function Jp(i,e){const{link:t}=e.col.setting,n=wh.call(this,t,e,i[0]);return n&&(i[0]=n),i}function Xp(i,e){const{format:t,digits:n}=e.col.setting;let s=i[0];return typeof n=="number"&&!Number.isNaN(Number(s))&&(s=Number(s),n>=0&&(s=s.toFixed(n))),t&&(s=Ch.call(this,t,e,s)),i[0]=s,i}function Zp(i,e){const{map:t,mapSplitter:n=",",mapJoiner:s}=e.col.setting;if(t){let r=i[0];typeof r=="string"&&n&&(r=r.split(n)),typeof t=="function"?i[0]=t.call(this,r,e):typeof t=="object"&&(Array.isArray(r)||(r=[r]),i[0]=r.map(o=>t[o]??o).join(s??n))}return i}function em(i,e,t){const n={};return typeof i=="function"?Object.assign(n,i.call(this,t)):Object.keys(i).forEach(s=>{var o;const r=(o=t.row.data)==null?void 0:o[i[s]];r!==void 0&&(n[s]=r)}),Object.keys(n).length&&e.push({style:n}),e}function tm(i,e,t="[yyyy-]MM-dd hh:mm"){const{formatDate:n=t,invalidDate:s}=e.col.setting;return i[0]=Qp.call(this,n,e,i[0],s),i}function xh(i,e,t=!1){const{html:n=t}=e.col.setting;if(n===!1)return i;const s=i[0],r=n===!0?s:Ch.call(this,n,e,s);return i[0]={html:r},i}const Nb=qe({name:"rich",colTypes:{html:{onRenderCell(i,e){return xh.call(this,i,e,!0)}},progress:{align:"center",onRenderCell(i,{col:e}){const{progressType:t,barColor:n,barBgColor:s,barHeight:r=6,barWidth:o=64,circleSize:a=24,circleBorderSize:l=1,circleBgColor:c="var(--color-border)",circleColor:d="var(--color-success-500)"}=e.setting,u=i[0];return i[0]=t==="bar"?S(yo,{className:"rounded-full",width:o,height:r,color:n||d,background:s,percent:u}):S(vo,{percent:u,size:a,circleWidth:l,circleBg:c,circleColor:d,text:!0}),i}},datetime:{formatDate:"[yyyy-]MM-dd hh:mm"},date:{formatDate:"yyyy-MM-dd"},time:{formatDate:"hh:mm"}},onRenderCell(i,e){const{formatDate:t,html:n,hint:s,styleMap:r}=e.col.setting;if(t&&(i=tm.call(this,i,e,t)),i=Zp.call(this,i,e),i=Xp.call(this,i,e),n?i=xh.call(this,i,e):i=Jp.call(this,i,e),s){let o=e.value;typeof s=="function"?o=s.call(this,e):typeof s=="string"?o=be(s,e.row.data):typeof i[0]=="string"&&(o=i[0]),i.push({attrs:{title:o}})}return r&&(i=em.call(this,r,i,e)),i}},{buildIn:!0}),Mb={default:(i,e,t)=>{var r,o;const n=(r=i.data)==null?void 0:r[t.name],s=(o=e.data)==null?void 0:o[t.name];return n===s?0:n==null?1:String(n).localeCompare(String(s))},date:(i,e,t)=>{var r,o;const n=je(((r=i.data)==null?void 0:r[t.name])??0),s=je(((o=e.data)==null?void 0:o[t.name])??0);return n.getTime()-s.getTime()},number:(i,e,t)=>{var r,o;const n=(r=i.data)==null?void 0:r[t.name],s=(o=e.data)==null?void 0:o[t.name];return Number.parseFloat(n)-Number.parseFloat(s)}},Eb=qe({name:"sort",defaultOptions:{sort:!1},when:i=>!!i.sort,onCreate(){const{sortBy:i}=this.options;i&&(this.state.sortBy=Array.isArray(i)?i:[i])},onAddRows(i,e){const{sortBy:t}=this.state;if(!t||!t.length)return;const{sort:n}=this.options,s={...Mb,...typeof n=="function"?{default:n}:typeof n=="object"?n:{}};return[...i].sort((r,o)=>{for(const{name:a,order:l}of t){const c=e.map[a];if(!c)continue;let d=c.setting.sort;if(d===!0?d=s.default:typeof d=="string"&&(d=s[d]),!d)continue;const u=d.call(this,r,o,c);if(u)return l==="asc"?u:-u}return 0})},onHeaderCellClick(i,e){if(!i.target.closest(".dtable-sort-link"))return;const t=this.getColInfo(e.colName);if(!t||!t.setting.sort)return;const{sortBy:n=[]}=this.state,s=n.findIndex(a=>a.name===t.name),{multiSort:r}=this.options;let o="asc";if(s>=0){const a=n[s].order;a==="asc"?o="desc":a==="desc"&&(o="none"),r&&n.splice(s,1)}r||(n.length=0),this.update({dirtyType:"layout",state:{sortBy:[{name:e.colName,order:o},...n].filter(a=>a.order!=="none")}})},onRenderHeaderCell(i,e){var l;const{col:t}=e,{sortBy:n}=this.state;if(!t.setting.sort)return i;const o=((l=n==null?void 0:n.find(c=>c.name===t.name))==null?void 0:l.order)||"none",a=S("div",{className:`dtable-sort dtable-sort-${o}`});return i[0]=S("a",{className:"dtable-sort-link",href:"javascript:;",children:[i[0],a]}),i.push({outer:!0,attrs:{"data-sort":o}}),i}},{buildIn:!0}),Ab={html:{component:vn}},nm=qe({name:"custom",onRenderCell(i,e){const{col:t}=e;let{custom:n}=t.setting;if(typeof n=="function"&&(n=n.call(this,e)),!n)return i;const s=Array.isArray(n)?n:[n],{customMap:r}=this.options;return s.forEach(o=>{let a;typeof o=="string"?a=o.startsWith("<")?{component:vn,props:{html:be(o,{value:e.value,...e.row.data,$value:e.value})}}:{component:o}:a=o;let{component:l}=a;const c=[a];typeof l=="string"&&c.unshift(Ab[l],r==null?void 0:r[l]);const d={};c.forEach(p=>{if(p){const{props:g}=p;g&&y.extend(d,typeof g=="function"?g.call(this,e):g),l=p.component||l}},{props:{}});const u=l;i[0]={outer:!0,className:"dtable-custom-cell",children:S(u,{...d})}}),i}}),Hx="";function Pb(i,e){var a,l;typeof i=="boolean"&&(e=i,i=void 0);const t=this.state.checkedRows,n={},{canRowCheckable:s,allowCheckDisabled:r}=this.options,o=(c,d)=>{const u=s?s.call(this,c):!0;!u||!r&&u==="disabled"||!!t[c]===d||(d?t[c]=!0:delete t[c],n[c]=d)};if(i===void 0?(e===void 0&&(e=!im.call(this)),(a=this.layout)==null||a.allRows.forEach(({id:c})=>{o(c,!!e)})):(Array.isArray(i)||(i=[i]),i.forEach(c=>{o(c,e??!t[c])})),Object.keys(n).length){const c=(l=this.options.beforeCheckRows)==null?void 0:l.call(this,i,n,t);c&&Object.keys(c).forEach(d=>{const u=s?s.call(this,d):!0;!u||!r&&u==="disabled"||(c[d]?t[d]=!0:delete t[d])}),this.setState({checkedRows:{...t}},()=>{var d;(d=this.options.onCheckChange)==null||d.call(this,n)})}return n}function Lb(i){return this.state.checkedRows[i]??!1}function im(){var s,r;const i=(s=this.layout)==null?void 0:s.allRows.length;if(!i)return!1;const e=this.getChecks().length,{canRowCheckable:t,allowCheckDisabled:n}=this.options;return t?e===((r=this.layout)==null?void 0:r.allRows.reduce((o,a)=>{const l=t?t.call(this,a.id):!0;return o+(!l||!n&&l==="disabled"?0:1)},0)):e===i}function Rb(){var e;const i=new Set((e=this.layout)==null?void 0:e.allRows.map(t=>t.id));return Object.keys(this.state.checkedRows).filter(t=>i.has(t))}function Ob(i){const{checkable:e}=this.options;i===void 0&&(i=!e),e!==i&&this.setState({forceCheckable:i})}function sm(i,e,t=!1,n=void 0){return S(Hi,{className:"dtable-checkbox",checked:i,disabled:t,label:n})}const rm='input[type="checkbox"],.dtable-checkbox',zb=qe({name:"checkable",defaultOptions:{checkable:"auto",checkboxRender:sm},when:i=>!!i.checkable,options(i){const{forceCheckable:e}=this.state;return e!==void 0?i.checkable=e:i.checkable==="auto"&&(i.checkable=!!i.cols.some(t=>t.checkbox)),i},state(){return{checkedRows:{}}},methods:{toggleCheckRows:Pb,isRowChecked:Lb,isAllRowChecked:im,getChecks:Rb,toggleCheckable:Ob},i18n:{zh_cn:{checkedCountInfo:"已选择 {selected} 项",totalCountInfo:"共 {total} 项"},zh_tw:{checkedCountInfo:"已選擇 {selected} 項",totalCountInfo:"共 {total} 項"},en:{checkedCountInfo:"Selected {selected} items",totalCountInfo:"Total {total} items"}},footer:{checkbox(){const i=this.isAllRowChecked();return[S("div",{style:{paddingRight:"calc(3*var(--space))",display:"flex",alignItems:"center"},onClick:()=>this.toggleCheckRows(),children:sm(i,void 0,!1,this.options.checkboxLabel)})]},checkedInfo(i,e){const t=this.getChecks(),{checkInfo:n}=this.options;if(n)return[S(me,{className:"dtable-check-info",content:n.call(this,t)})];const s=t.length,r=[];return s&&r.push(this.i18n("checkedCountInfo",{selected:s})),r.push(this.i18n("totalCountInfo",{total:e.allRows.length})),[S("div",{className:"dtable-check-info",children:r.join(", ")})]}},onCreate(){const{checkedRows:i}=this.options;i&&this.setState(e=>({checkedRows:{...e.checkedRows,...i.reduce((t,n)=>(t[n]=!0,t),{})}}))},onRenderCell(i,{row:e,col:t}){var c;const{id:n}=e,{canRowCheckable:s}=this.options,r=s?s.call(this,n):!0;if(!r)return i;const{checkbox:o}=t.setting,a=typeof o=="function"?o.call(this,n):o,l=this.isRowChecked(n);if(a){const d=(c=this.options.checkboxRender)==null?void 0:c.call(this,l,n,r==="disabled");i.push(d,{outer:!0,className:"has-checkbox"})}return l&&i.push({outer:!0,className:"is-checked"}),i},onRenderHeaderCell(i,{row:e,col:t}){var o;const{id:n}=e,{checkbox:s}=t.setting;if(typeof s=="function"?s.call(this,n):s){const a=this.isAllRowChecked(),l=(o=this.options.checkboxRender)==null?void 0:o.call(this,a,n);i.push(l,{outer:!0,className:"has-checkbox"})}return i},onHeaderCellClick(i){if(this.data.disableCheckable)return;const e=i.target;if(!e)return;const t=e.closest(rm);t&&this.toggleCheckRows(t.checked)},onCellClick(i,{rowID:e}){if(this.data.disableCheckable)return;const t=y(i.target);if(!t.length||t.closest("btn,a,button.not-checkable,.form-control,.btn").length)return;(t.closest(rm).not(".disabled").length||this.options.checkOnClickRow)&&this.toggleCheckRows(e)}}),Fb=qe({name:"store",defaultOptions:{store:!0},when:i=>!!i.store,data(){return{store:new Ls(`DTable:${this.id}`)}}}),Vx="",Kx="";var om=(i=>(i.unknown="",i.collapsed="collapsed",i.expanded="expanded",i.hidden="hidden",i.normal="normal",i))(om||{});function ma(i){const e=this.data.nestedMap.get(i);if(!e||e.state!=="")return e??{state:"normal",level:-1};if(!e.parent&&!e.children)return e.state="normal",e;const t=e.children&&this.state.nestedState[i];let n=!1,{parent:s}=e;for(;s;){const r=ma.call(this,s);if(r.state!=="expanded"){n=!0;break}s=r.parent}return e.state=n?"hidden":t?"collapsed":e.children?"expanded":"normal",e.level=e.parent?ma.call(this,e.parent).level+1:0,e}function jb(i){return i!==void 0?ma.call(this,i):this.data.nestedMap}function Bb(i,e){let{nestedState:t}=this.state;const{nestedMap:n}=this.data;if(i==="HEADER")if(e===void 0&&(e=!am.call(this)),e){const s=n.entries();for(const[r,o]of s)o.state==="expanded"&&(t[r]=!0)}else t={};else{const s=Array.isArray(i)?i:[i];e===void 0&&(e=!t[s[0]]),s.forEach(r=>{const o=n.get(r);e&&(o!=null&&o.children)?t[r]=!0:delete t[r]})}this.update({dirtyType:"layout",state:{nestedState:{...t}}},()=>{const{onNestedChange:s,preserveNested:r}=this.options;s==null||s.call(this),r&&this.data.store.set("nestedState",t)})}function am(){const i=this.data.nestedMap.values();for(const e of i)if(e.state==="expanded")return!1;return!0}function lm(i,e=1,t,n=0){var s;t||(t=[...i.keys()]);for(const r of t){const o=i.get(r);o&&(o.level===n&&(o.order=e++),(s=o.children)!=null&&s.length&&(e=lm(i,e,o.children,n+1)))}return e}function cm(i,e,t,n){const s=i.getNestedRowInfo(e);return!s||s.state===""||!s.children||s.children.forEach(r=>{n[r]=t,cm(i,r,t,n)}),s}function hm(i,e,t,n,s){var a;const r=i.getNestedRowInfo(e);if(!r||r.state==="")return;((a=r.children)==null?void 0:a.every(l=>{const c=!!(n[l]!==void 0?n[l]:s[l]);return t===c}))&&(n[e]=t),r.parent&&hm(i,r.parent,t,n,s)}const ga="dtable-nested-toggle",Hb=qe({name:"nested",plugins:[Fb],requireAfter:["sortable"],defaultOptions:{nested:"auto",nestedParentKey:"parent",asParentKey:"asParent",nestedIndent:20,canSortTo(i,e){const{nestedMap:t}=this.data,n=t.get(i.id),s=t.get(e.id);return(n==null?void 0:n.parent)===(s==null?void 0:s.parent)},beforeCheckRows(i,e,t){if(!this.options.checkable||!(i!=null&&i.length)||this.options.noNestedCheck)return;const n={};return Object.entries(e).forEach(([s,r])=>{const o=cm(this,s,r,n);o!=null&&o.parent&&hm(this,o.parent,r,n,t)}),n}},options(i){return i.nested==="auto"&&(i.nested=!!i.cols.some(e=>e.nestedToggle)),i},when:i=>!!i.nested,data(){return{nestedMap:new Map,nestedRowMap:new Map}},state(){return{nestedState:{}}},methods:{getNestedInfo:jb,toggleRow:Bb,isAllCollapsed:am,getNestedRowInfo:ma},onCreate(){let{defaultNestedState:i}=this.options;if(this.options.preserveNested){const e=this.data.store.get("nestedState");e&&(i=e)}if(i===!0){const{data:e,rowKey:t="id"}=this.options;Array.isArray(e)&&(i=e.reduce((n,s)=>(n[typeof s=="string"?s:s[t]]=!0,n),{}))}this.state.nestedState=i||{}},onMounted(){this.options.defaultNestedState===!0&&!this.options.preserveNested&&this.toggleRow("HEADER",!0)},beforeLayout(){this.data.nestedMap.clear(),this.data.nestedRowMap.clear()},onAddRow(i){this.data.nestedRowMap.set(i.id,i)},onAddRows(i){const{nestedMap:e,nestedRowMap:t}=this.data;i.forEach(r=>{var c,d;const o=e.get(r.id)??{state:"",level:0};let a=((c=r.data)==null?void 0:c[this.options.nestedParentKey??"parent"])??[];Array.isArray(a)||(a=[a]);let l;for(a=[...a];a.length;){let u=a.pop();if(u===void 0)continue;if(u=String(u),t.get(u)){l=u;break}}if(o.parent=l==="0"?void 0:l,(d=r.data)!=null&&d[this.options.asParentKey??"asParent"]&&(o.children=[]),e.set(r.id,o),l){let u=e.get(l);u||(u={state:"",level:0},e.set(l,u)),u.children||(u.children=[]),u.children.push(r.id)}});const n=new Map,s=i.length*100;return i=i.filter(r=>{const o=this.getNestedRowInfo(r.id);return n.set(r.id,o),o.state!=="hidden"}),lm(n),i.sort((r,o)=>{const a=n.get(r.id),l=n.get(o.id);return((a==null?void 0:a.order)??s+r.index)-((l==null?void 0:l.order)??s+o.index)}),i},onRenderCell(i,e){var c;const{row:t,col:n}=e,{id:s,data:r}=t,{nestedToggle:o,childLabel:a}=n.setting,l=this.getNestedRowInfo(s);if(a){const d=Number(r[this.options.nestedParentKey||"parent"]);if(!Number.isNaN(d)&&d>0){let u;typeof a=="string"?u=S("span",{className:"dtable-child-label label rounded-full size-sm gray-pale",children:be(a,r)}):u=S(me,{className:"dtable-child-label",content:a,generatorThis:e}),i.unshift(u)}}if(o&&(l.children||l.parent)&&i.push(((c=this.options.onRenderNestedToggle)==null?void 0:c.call(this,l,s,n,r))??S("a",{className:`${ga} state${l.children?"":" is-no-child"}`,children:S("span",{className:"toggle-icon"})}),{outer:!0,className:`is-${l.state}`}),l.level){let{nestedIndent:d=o}=n.setting;d&&(d===!0&&(d=this.options.nestedIndent??12),i.push(S("div",{className:"dtable-nested-indent",style:{width:d*l.level+"px"}})))}return i},onRenderHeaderCell(i,{row:e,col:t}){var s;const{id:n}=e;return t.setting.nestedToggle&&i.push(((s=this.options.onRenderNestedToggle)==null?void 0:s.call(this,void 0,n,t,void 0))??S("a",{className:`${ga} state`,children:S("span",{className:"toggle-icon"})}),{outer:!0,className:`is-${this.isAllCollapsed()?"collapsed":"expanded"}`}),i},onHeaderCellClick(i){const e=i.target;if(!(!e||!e.closest(`.${ga}`)))return this.toggleRow("HEADER"),!0},onCellClick(i,{rowID:e}){const t=i.target;if(!(!t||!this.getNestedRowInfo(e).children||!t.closest(`.${ga}`)))return this.toggleRow(e),!0}});function kh(i,{row:e,col:t}){const{data:n}=e,s=n?n[t.name]:void 0;if(!(s!=null&&s.length))return i;const{avatarClass:r="rounded-full",avatarKey:o=`${t.name}Avatar`,avatarCodeKey:a,avatarNameKey:l=`${t.name}Name`}=t.setting;let{avatarProps:c={}}=t.setting;typeof c=="function"&&(c=c(t,e));const d=(n?n[l]:s)||i[0],u={size:"xs",src:n?n[o]:void 0,text:d,code:a?n?n[a]:void 0:s,...c,className:V(r,c.className,"flex-none")};if(i[0]=S(Bi,{...u}),t.type==="avatarBtn"){const{avatarBtnProps:p}=t.setting,g=typeof p=="function"?p(t,e):p;i[0]=S("button",{type:"button",className:"btn btn-avatar",...g,children:[i[0],S("div",{children:d})]})}else t.type==="avatarName"&&(i[0]=S("div",{className:"flex items-center gap-1",children:[i[0],S("span",{children:d})]}));return i}const Wb=qe({name:"avatar",colTypes:{avatar:{onRenderCell:kh},avatarBtn:{onRenderCell:kh},avatarName:{onRenderCell:kh}}},{buildIn:!0}),Ub=qe({name:"sort-type",defaultOptions:{sortType:!0},when:i=>!!i.sortType&&!i.sort,onRenderHeaderCell(i,e){const{col:t}=e,{setting:n}=t;let{sortType:s}=n;if(t.setting.sort!==void 0||s===!1)return i;const{sortLink:r,orderBy:o}=this.options;if(o&&o[t.name]!==void 0&&(s=o[t.name]),s){const a=s===!0?"none":s,l=S("div",{className:`dtable-sort dtable-sort-${a}`});i.push({outer:!0,attrs:{"data-sort":a}});let{sortLink:c=r}=n;if(c){const d=a==="asc"?"desc":"asc";typeof c=="function"&&(c=c.call(this,t,d,a)),typeof c=="string"&&(c={url:c});const{url:u,...p}=c;i[0]=S("a",{className:"dtable-sort-link",href:be(u,{...n,sortType:d}),...p,children:[typeof i[0]!="object"||I.isValidElement(i[0])?i[0]:t.name,l]})}else i.push(l)}return i}},{buildIn:!0}),Sh=i=>{i.length!==1&&i.forEach((e,t)=>{!t||e.border!==void 0||e.setting.group===i[t-1].setting.group||(e.border="left")})},Vb=qe({name:"group",defaultOptions:{groupDivider:!0},when:i=>!!i.groupDivider,onLayout(i){if(!this.options.groupDivider)return;const{cols:e}=i;Sh(e.left.list),Sh(e.center.list),Sh(e.right.list)}}),Jx="",Kb=qe({name:"header-group",defaultOptions:{headerGroup:!0},data(){return{headerGroups:new Map}},when:i=>!!i.headerGroup,beforeLayout(i){const{headerGroups:e}=this.data;e.clear();const{cols:t}=i;if(!(t!=null&&t.length))return;const n={};return t.forEach((s,r)=>{const{headerGroup:o}=s;if(!o){n[s.name]=r;return}let a=e.get(o);a?a.cols.push(s.name):(a={cols:[s.name],index:r},e.set(o,a)),n[s.name]=a.index+a.cols.length/t.length}),t.sort((s,r)=>n[s.name]-n[r.name]),{headerHeight:!i.headerHeight&&i.rowHeight?i.rowHeight*2:void 0,cols:t}},onRenderHeaderCell(i,{col:e}){const{headerGroup:t}=e.setting;if(t){const n=this.data.headerGroups.get(t),s=this.layout.headerHeight/2;if(e.name===n.cols[0]){const r=n.cols.reduce((a,l)=>{var c;return a+(((c=this.getColInfo(l))==null?void 0:c.realWidth)??0)},0),o={height:s-1,width:r-1};i.push(S("div",{class:"dtable-header-group",style:o,children:t}))}i.push({className:"dtable-header-as-group",style:{paddingTop:s}})}return i}}),qb=qe({name:"cellspan",when:i=>!!i.getCellSpan,data(){return{cellSpanMap:new Map,overlayedCellSet:new Set}},onLayout(i){const{getCellSpan:e}=this.options;if(!e)return;const{cellSpanMap:t,overlayedCellSet:n}=this.data,{rows:s,cols:r,rowHeight:o}=i;t.clear(),n.clear();const a=(l,c,d)=>{const{index:u}=c;l.forEach((p,g)=>{const{index:_}=p,C=`C${_}R${u}`;if(n.has(C))return;const x=e.call(this,{row:c,col:p});if(!x)return;const k=Math.min(x.colSpan||1,l.length-g),$=Math.min(x.rowSpan||1,s.length-d);if(k<=1&&$<=1)return;let E=0;for(let z=0;z{["left","center","right"].forEach(d=>{a(r[d].list,l,c)})})},onRenderCell(i,{row:e,col:t}){const n=`C${t.index}R${e.index}`;if(this.data.overlayedCellSet.has(n))i.push({outer:!0,style:{display:"none",className:"cellspan-overlayed-cell"}});else{const s=this.data.cellSpanMap.get(n);s&&i.push({outer:!0,style:{width:s.width,height:s.height}})}return i}}),ya=qe({name:"mousemove",events:{click(i){this.data.ignoreNextClick&&(i.preventDefault(),this.data.ignoreNextClick=void 0)},mousedown(){this.data.ignoreNextClick&&clearTimeout(this.data.ignoreNextClick)},mousemove(i){this.data.mmRafID&&cancelAnimationFrame(this.data.mmRafID),this.data.mmRafID=requestAnimationFrame(()=>{this.emitCustomEvent("mousemovesmooth",i),this.data.mmRafID=0}),i.preventDefault()},document_mousemove(i){this.data.dmmRafID&&cancelAnimationFrame(this.data.dmmRafID),this.data.dmmRafID=requestAnimationFrame(()=>{this.emitCustomEvent("document_mousemovesmooth",i),this.data.mmRafID=0})}},methods:{ignoreNextClick(i=10){this.data.ignoreNextClick&&clearTimeout(this.data.ignoreNextClick),this.data.ignoreNextClick=window.setTimeout(()=>{this.data.ignoreNextClick=void 0},i)}}});function Gb(){var E,z,H,Y;const{scrollToMouse:i}=this.data;if(!i)return this.stopScrollToMouse();const{position:e,startTime:t,delay:n}=i;if(!e||Date.now()-tC-a&&(x=Math.max(o,d-(C-a)));let k=0;if(ug-a&&(k=Math.max(o,u-(g-a))),c){const G=new Set((Array.isArray(c)?c:[c]).reduce((X,ee)=>(ee==="x"?X.push("left","right"):ee==="y"?X.push("top","bottom"):X.push(ee),X),[]));(!G.has("left")&&x<0||!G.has("right")&&x>0)&&(x=0),(!G.has("top")&&k<0||!G.has("bottom")&&k>0)&&(k=0)}const $={};x!==0&&($.scrollLeft=this.layout.scrollLeft+l*x),k!==0&&($.scrollTop=this.layout.scrollTop+l*k),this.scroll($)}const um=qe({name:"autoscroll",plugins:[ya],events:{document_mousemovesmooth(i){if(!this.data.scrollToMouse)return;const{clientX:e,clientY:t}=i;this.data.scrollToMouse.position={x:e,y:t}}},methods:{scrollTo({col:i,row:e,extra:t=2}){const n=this.getColInfo(i),s=this.getRowInfo(e);if(!n&&!s)return!1;const r={},{layout:o}=this;if(n){const{scrollLeft:a,cols:l}=o,c=n.left+n.realWidth;n.leftl.center.width+a&&(r.scrollLeft=c-l.center.width+t)}if(s){const{scrollTop:a,rowHeight:l,rowsHeight:c}=o,d=s.top+l;s.topc+a&&(r.scrollTop=d-c+t)}return this.scroll(r),!0},startScrollToMouse(i){const e={interval:60,speed:.5,delay:200,maxStep:this.options.rowHeight,onlyInside:!1,detectPadding:30,startTime:Date.now(),...i};this.data.scrollToMouse=e,clearInterval(this.data.scrollToTimer),this.data.scrollToTimer=window.setInterval(Gb.bind(this),e.interval)},stopScrollToMouse(){clearInterval(this.data.scrollToTimer),this.data.scrollToMouse=void 0}},onUnmounted(){clearInterval(this.data.scrollToTimer)}}),nk="",Yb=qe({name:"sortable",defaultOptions:{sortable:!0},when:i=>!!i.sortable,plugins:[ya,um],resetState:!0,state(){return{rowOrders:void 0,sortingFrom:void 0,sortingPos:void 0,sortingTo:void 0,sortingSide:void 0}},events:{click(i){i.target.closest(".dtable-sort-link")&&(this.state.rowOrders=void 0)},mousedown(i){var a;if(this.data.disableSortable)return;const{sortHandler:e=".dtable-cell"}=this.options;if(!y(i.target).closest(e).length)return;const s=this.getPointerInfo(i);if(!s||s.rowID==="HEADER")return;const r=this.getRowInfo(s.rowID);if(!r||((a=this.options.onSortStart)==null?void 0:a.call(this,r,i))===!1)return;i.preventDefault();const o=i.clientY;this.data.sortableInfo={from:r,offset:o-s.cellElement.getBoundingClientRect().top,startMouseY:o,lastMouseY:o}},document_mouseup(i){var n;const{sortableInfo:e}=this.data;if(!e)return;this.stopScrollToMouse();const t=this.getSortingState(i);if(t){let s,r;const{sortingFrom:o,sortingTo:a,sortingSide:l}=t;if(a&&l){const c=this.layout.rows.map(g=>g.id),d=[...c],u=o.index,p=a.index;if(!(u===p+1&&l==="after")&&!(u===p-1&&l==="before")){const g=c.splice(u,1);c.splice(p,0,g[0]),s={},r=[],c.forEach((_,C)=>{s[_]=C,r.push(_)}),(d.join()===r.join()||((n=this.options.onSort)==null?void 0:n.call(this,o,a,l,r))===!1)&&(s=void 0,r=void 0)}}(a||Math.abs(e.lastMouseY-e.startMouseY)>4)&&this.ignoreNextClick(),this.disableAnimation(),this.update({dirtyType:"layout",state:c=>y.extend({sortingFrom:void 0,sortingPos:void 0,sortingTo:void 0,sortingSide:void 0},s?{rowOrders:{...c.rowOrders,...s}}:null)},()=>{var c;(c=this.options.onSortEnd)==null||c.call(this,o,a,l,r),setTimeout(()=>{this.data.disableCheckable=void 0},50)})}this.data.sortableInfo=void 0},document_mousemovesmooth(i){const{sortableInfo:e}=this.data;if(!e)return;const t=this.getSortingState(i);t&&(e.state||(this.startScrollToMouse({side:"y"}),this.data.disableCheckable=!0),e.lastMouseY=i.clientY,e.state=t,this.setState(t))}},methods:{getSortingState(i){var Y;const{disableSortable:e,sortableInfo:t}=this.data;if(e||!t)return;const{headerHeight:n,footerHeight:s,visibleRows:r,scrollTop:o,rowHeight:a}=this.layout,l=this.element.getBoundingClientRect(),c=l.width,d=l.height-n-s,u=i.clientX-l.left,p=i.clientY-l.top-n;if(u<0||u>c||p<0||p>d)return t.state;const g=p+o,_=r.find(G=>G.top<=g&&G.top+a>g);if(!_)return t.state;const C=t.from,x=_.id!==C.id?_.id:void 0,k=x?this.getRowInfo(x):void 0,$=p,E=g<_.top+a/2?"before":"after";return k&&((Y=this.options.canSortTo)==null?void 0:Y.call(this,C,k,E))!==!1?{sortingFrom:C,sortingPos:$,sortingTo:k,sortingSide:E}:{sortingFrom:C,sortingPos:$,sortingTo:void 0,sortingSide:void 0}}},onAddRows(i){const{rowOrders:e}=this.state;if(!e)return;const t=i.length*100;return i=i.sort((n,s)=>{const r=e[n.id]??t+n.index,o=e[s.id]??t+s.index;return r-o}),i},beforeRender(i){const{sortingFrom:e}=this.state,{visibleRows:t}=i;e&&(t.some(n=>n.id===e.id)||(i.visibleRows=[...t,e]),i.className=V(i.className,"dtable-sorting"))},onRenderCell(i,e,t){const{sortingFrom:n,sortingPos:s,sortingTo:r,sortingSide:o}=this.state;if(!n)return i;const a=e.row,l={},c=[];if(n.id===a.id)l.top=s-this.data.sortableInfo.offset+((t.top??a.top)-(a.top-this.layout.scrollTop)),c.push("is-sorting-from");else if(r){const d=r.id===a.id;d&&c.push(`text-primary is-sorting-to is-sorting-to-${o}`),n.index>a.index&&(d&&o==="before"||a.index>r.index)?c.push("is-sorting-before"):n.index{t.type==="size-menu"&&t.caret===void 0&&(t.caret="up")}),this.options.localPager&&(Object.assign(i,{...typeof e=="object"?e:null,...this.state.pager,recTotal:this.layout.allRows.length,useState:!0}),i.onChangePageInfo=t=>{this.update({dirtyType:"layout",state:n=>({pager:{...n.pager,...t}})})}),[S(Qs,{...i})]):[]}},onAddRows(i){const{localPager:e}=this.options;if(e){const{page:t=1,recPerPage:n=20}={...typeof e=="object"?e:null,...this.state.pager},s=(t-1)*n,r=Math.min(t*n,i.length);return i.slice(s,r)}}}),Qb=Object.freeze(Object.defineProperty({__proto__:null,NestedRowState:om,avatar:Wb,cellspan:qb,checkable:zb,custom:nm,group:Vb,headerGroup:Kb,nested:Hb,pager:dm,renderDatetime:Qp,renderDatetimeCell:tm,renderFormat:Ch,renderFormatCell:Xp,renderHtmlCell:xh,renderLink:wh,renderLinkCell:Jp,renderMapCell:Zp,renderStyleMapCell:em,rich:Nb,sort:Eb,sortType:Ub,sortable:Yb},Symbol.toStringTag,{value:"Module"}));class us extends ye{setOptions(e,t){return e=super.setOptions(e,t),e.parent||(e.parent=this.element),e}}us.NAME="DTable",us.Component=rs,us.definePlugin=qe,us.removePlugin=Jf,us.plugins=Qb;const rk="",ok="",ak="",lk="",ck="",hk="",uk="";class Th extends He{_getClassName(e){return["kanban-header-col",e.className,e.subCols?"has-subs":"",e.parentName!==void 0?"is-sub":""]}_getProps(e){const{width:t,color:n,name:s,gapLeft:r,gapRight:o}=e;return xe(super._getProps(e),{style:{"--kanban-col-color":n,"--kanban-col-width":Ve(t),"--kanban-col-gap-left":Ve(r),"--kanban-col-gap-right":Ve(o)},"z-col":s})}_getChildren(e){const{prefix:t,prefixClass:n,title:s,titleClass:r,titleAlign:o="center",subtitle:a,subtitleClass:l,icon:c,trailingIcon:d,actions:u,subCols:p}=e;return[S("div",{className:`kanban-header-col-wrapper is-align-${o}`,children:[S("div",{className:"kanban-header-title",children:[c?S(Ie,{className:"as-leading-icon",icon:c},"icon"):null,t?S("span",{className:V("as-prefix",n),children:S(me,{content:t})},"prefix"):null,s?S("span",{className:V("as-title",r),title:typeof s=="string"?s:void 0,children:S(me,{content:s})},"title"):null,a?S("span",{className:V("as-subtitle",l),children:S(me,{content:a})},"subtitle"):null,d?S(Ie,{className:"as-trailing-icon",icon:d},"trailingIcon"):null]},"title"),Oe.render(u,[e],{key:"actions",className:"kanban-header-col-actions",size:"sm"},this)]},"wrapper"),p?S("div",{className:"kanban-header-sub-cols",children:p.map((g,_)=>S(Th,{index:_,...g},g.name))},"subs"):null]}}class Jb extends pe{constructor(){super(...arguments),this._ref=de()}componentDidMount(){this._ref.current&&(this._sticky=no.ensure(this._ref.current,{scrollContainer:".kanban-list"}))}componentWillUnmount(){var e;(e=this._sticky)==null||e.destroy()}render(e){return S("div",{className:"kanban-header",ref:this._ref,children:[S("div",{className:"kanban-header-lane-name"},"name"),S("div",{className:"kanban-header-cols",children:e.cols.map((t,n)=>S(Th,{index:n,...t},t.name))},"cols")]})}}class fm extends pe{constructor(){super(...arguments),this._listRef=de(),this._renderItem=e=>{const{itemRender:t,lane:n,name:s}=this.props;return t.call(this,{item:e,lane:n,col:s})},this._handleScroll=e=>{const{current:t}=this._listRef;t&&y(t).trigger("laneColScroll",e)}}componentDidMount(){const{current:e}=this._listRef;e&&(this._ob=new ResizeObserver(t=>{y(this._listRef.current).trigger("laneColResize",t[0])}),this._ob.observe(e))}componentWillUnmount(){var e;(e=this._ob)==null||e.disconnect()}render(e){const{items:t}=e,{width:n,color:s,content:r,contentClass:o,itemRender:a,itemGap:l,watchSize:c,name:d,lane:u,itemCountPerRow:p,gapLeft:g,gapRight:_,laneColClass:C}=e,x={"--kanban-col-color":s,"--kanban-col-width":Ve(n),"--kanban-col-gap-left":Ve(g),"--kanban-col-gap-right":Ve(_)};return S("div",{className:V("kanban-lane-col",C),style:x,"z-lane":u,"z-col":d,children:[r?S("div",{className:V("kanban-col-content",o),children:S(me,{content:r,generatorThis:this,generatorArgs:[e]})}):null,S("div",{className:"kanban-items scrollbar-thin scrollbar-hover",onScroll:this._handleScroll,children:S(cs,{forwardRef:c?this._listRef:void 0,itemProps:{className:"kanban-item card-list-item"},items:t,itemRender:a?this._renderItem:void 0,countPerRow:p,gap:l},"list")})]})}}fm.defaultProps={watchSize:!0};class Xb extends He{_getClassName(e){const{className:t,index:n,maxHeight:s,height:r}=e;return["kanban-lane",t,{"is-first":!n,"is-auto-height":!s&&(!r||r==="auto")}]}_getProps(e){const{height:t,minHeight:n,maxHeight:s,color:r,name:o,gapTop:a,gapBottom:l}=e;return xe(super._getProps(e),{style:{"--kanban-lane-color":r,height:Ve(t),minHeight:Ve(n),maxHeight:Ve(s),"--kanban-col-gap-top":Ve(a),"--kanban-col-gap-bottom":Ve(l)},"z-lane":o})}_renderCol(e,t,n,s,r){if(r){const o=r(e,t);o&&(t={...t,...o})}return S(fm,{itemRender:n,lane:e.name,items:s[t.name],...t},t.name)}_getChildren(e){const{title:t,titleClass:n,actions:s,cols:r,items:o={},hideName:a,itemRender:l,getLaneCol:c}=e;return[a?null:S("div",{className:"kanban-lane-name",children:[Oe.render(s,[e],{key:"actions",className:"kanban-lane-actions",size:"sm"},this),S("div",{className:V("kanban-lane-title",n),title:typeof t=="string"?t:void 0,children:S(me,{content:t})},"title")]},"name"),S("div",{className:"kanban-lane-cols",children:r.reduce((d,u)=>(u.subCols?u.subCols.forEach(p=>{d.push(this._renderCol(e,p,l,o,c))}):d.push(this._renderCol(e,u,l,o,c)),d),[])},"cols")]}}function Zb(i){const{lanes:e,cols:t,items:n={},itemRender:s,hideLaneName:r,getLaneCol:o}=i;return S("div",{className:"kanban-body",children:e.map((a,l)=>S(Xb,{index:l,cols:t,items:n[a.name],hideName:r,itemRender:s,getLaneCol:o,...a},a.name))})}const zt=12,ew={left:"right",right:"left",top:"bottom",bottom:"top","":""},Wn=({from:i,to:e,fromKanban:t,toKanban:n})=>`${t?`${t}_`:""}${i}-${n?`${n}_`:""}${e}`;function pm(i,e){return e==="top"?{x:i.x+i.width/2,y:i.y}:e==="left"?{x:i.x,y:i.y+i.height/2}:e==="right"?{x:i.x+i.width,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height}}function tw(i,e){return(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)}function nw(i,e,t,n){const s=t?[t]:["left","right","top","bottom"],r=n?[n]:["left","right","top","bottom"];let o=Number.MAX_SAFE_INTEGER,a={x:0,y:0},l={x:0,y:0};return s.forEach(c=>{r.forEach(d=>{const u=pm(i,c),p=pm(e,d),g=tw(u,p)*(ew[c]===d?1:2);g{this.setState({hover:e.type==="mouseenter"})},this._onDelete=()=>{var e;(e=this.props.onDelete)==null||e.call(this,this.props)}}render(e,t){const{text:n,textSize:s,color:r,onDelete:o,weight:a=1.5,from:l,to:c}=e,{hover:d}=t,{x:u,y:p,padding:g,width:_,height:C,svgProps:x,markers:k,svgPathProps:$,svgPathBackProps:E,fromPos:z}=rw(e);return S("div",{className:V("kanban-link",d?"is-hover":""),style:{left:u,top:p,width:_,height:C,color:r,"--kanban-link-weight":a},"z-from":l,"z-to":c,onMouseEnter:o?this._handleMouseHover:void 0,onMouseLeave:o?this._handleMouseHover:void 0,children:[S("svg",{...x,xmlns:"http://www.w3.org/2000/svg",version:"1.1",children:[k.length?S("defs",{children:k.map(({path:H,id:Y,...G})=>S("marker",{...G,id:Y,children:S("path",{...H})},Y))}):null,S("path",{...E}),S("path",{...$})]}),S("div",{className:"kanban-link-start-point",style:{left:z.x-g,top:z.y-g}}),o?S("div",{className:"kanban-link-delete-btn",children:S("button",{type:"button",className:"btn rounded-full size-sm square primary",onClick:this._onDelete,children:S("i",{className:"close"})})}):null,n?S("div",{className:"kanban-link-text",style:{fontSize:`${s||12}px`},children:n}):null]})}}const ar=".kanban";class ow extends pe{constructor(){super(...arguments),this._ref=de(),this.state={}}componentDidMount(){const e=this._ref.current,{container:t=".kanban"}=this.props,n=e.closest(t),s=y(n);this._container=n,this._multiKanban=s.find(".kanban").length>1;const r=".kanban-item,.kanban-link-editor-from";s.on(`mouseenter${ar}`,r,o=>{if(this.state.dragPos)return;clearTimeout(this._leaveTimer);const a=y(o.target).closest(r),l=a.z("key");this.state.from===l||a.hasClass("is-dragging")||this.setState({from:l,fromKanban:this._multiKanban?a.closest(".kanban").z("key"):void 0,to:void 0,fromRect:this._getRect(a.children()[0]),dragPos:void 0})}).on(`mouseleave${ar}`,r,()=>{this.state.dragPos||(clearTimeout(this._leaveTimer),this._leaveTimer=window.setTimeout(()=>{this._cancelHover(),this._leaveTimer=0},200))}).on(`dragstart${ar}`,".kanban-item",()=>{this.state.dragPos||this._cancelHover()}).on(`laneColScroll${ar}`,o=>{const{from:a}=this.state;a&&this.setState({fromRect:this._getRect(y(o.target).find(`.kanban-item[z-key="${a}"]`).children()[0])})}),this._moveable=new Bs(e,{selector:".kanban-link-editor-point",move:"none",onMoveStart:()=>{if(!this.state.from)return!1;s.addClass("is-adding-link")},onMove:o=>{const{top:a,left:l}=n.getBoundingClientRect(),c={left:o.clientX-l+n.scrollLeft,top:o.clientY-a+n.scrollTop};let d,u,p;const g=y(o.target).closest(r);g.length&&d!==this.state.from&&(d=g.attr("z-key"),p=this._multiKanban?g.closest(".kanban").z("key"):void 0,u=this._getRect(g.children()[0])),this.setState({dragPos:c,to:d,toKanban:p,toRect:u})},onMoveEnd:()=>{const{from:o,fromKanban:a,to:l,toKanban:c}=this.state,{onAddLink:d}=this.props;(o!==l||a!==c)&&d&&o!==void 0&&l!==void 0&&(d==null||d.call(this,{from:o,fromKanban:a,to:l,toKanban:c})),this._cancelHover(),s.removeClass("is-adding-link")}})}componentWillUnmount(){var t;const e=(t=this._ref.current)==null?void 0:t.closest(".kanban");e&&y(e).off(ar),this._raf&&cancelAnimationFrame(this._raf)}_getRect(e){const t=e.getBoundingClientRect(),n=this._container,{top:s,left:r}=n.getBoundingClientRect();return{left:t.left-r+n.scrollLeft,top:t.top-s+n.scrollTop,width:t.width,height:t.height}}_cancelHover(){this.setState({from:void 0,to:void 0,fromRect:void 0,dragPos:void 0})}_renderLink(e){const{fromRect:t,toRect:n,from:s,to:r="",dragPos:o}=e;if(!t||!s||!o)return null;const a=n?{left:n.left,top:n.top,right:n.left+n.width,bottom:n.top+n.height}:{left:o.left,top:o.top,right:o.left,bottom:o.top};return S(ym,{from:s,to:r,lineStyle:"dotted",color:"var(--color-primary-500)",fromRect:{left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height},toRect:a},"link")}render(e,t){const{from:n,fromRect:s,to:r,toRect:o}=t;let a,l;return n&&s&&(a=S("div",{className:"kanban-link-editor-from not-moveable","z-key":n,style:s,children:[S("div",{className:"kanban-link-editor-point is-left"}),S("div",{className:"kanban-link-editor-point is-top"}),S("div",{className:"kanban-link-editor-point is-right"}),S("div",{className:"kanban-link-editor-point is-bottom"})]})),r&&o&&(l=S("div",{className:"kanban-link-editor-to","z-key":r,style:o})),S("div",{className:V("kanban-link-editor"),ref:this._ref,children:[a,l,this._renderLink(t)]})}}const $h=".kanban";class vm extends pe{constructor(){super(...arguments),this._ref=de(),this._watchSet=new Set,this.state={layout:{},scrollTop:0,scrollLeft:0}}componentDidMount(){var s;const{container:e=".kanban"}=this.props,t=(s=this._ref.current)==null?void 0:s.closest(e),n=y(t);this._multiKanban=n.find(".kanban").length>1,n.on(`laneColResize${$h} laneColScroll${$h}`,()=>{this._tryUpdateLayout()}),this._container=t,this._tryUpdateLayout()}componentWillUnmount(){const e=this._container;e&&y(e).off($h),this._raf&&cancelAnimationFrame(this._raf)}componentDidUpdate(e){(e.links!==this.props.links||e.filters!==this.props.filters)&&this._tryUpdateLayout()}_tryUpdateLayout(){this._raf&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._updateLayout(),this._raf=0})}_updateLayout(){const e=[...this._watchSet],t=this._container,n=y(t),{top:s,left:r}=t.getBoundingClientRect(),o=t.scrollTop-s,a=t.scrollLeft-r,l={};e.forEach(c=>{const[d,u]=c.split("_"),p=n.find(`${this._multiKanban?`.kanban[z-key="${d}"] `:""}.kanban-item[z-key="${u}"]`).children()[0];if(p&&Ns(p,{container:".kanban-lane-col"})){const{top:g,left:_,bottom:C,right:x}=p.getBoundingClientRect();l[c]={top:g+o,left:_+a,bottom:C+o,right:x+a}}}),this.setState({layout:l})}_renderLink(e){const{layout:t}=this.state,{from:n,fromKanban:s="",to:r,toKanban:o=""}=e,a=`${s}_${n}`,l=`${o}_${r}`,c=t[a],d=t[l];return this._watchSet.add(a),this._watchSet.add(l),!c||!d?null:S(ym,{...e,fromRect:c,toRect:d,onDelete:this.props.onDeleteLink},`${n}-${r}`)}_renderLinks(e){const{links:t,filters:n}=e,s=new Set(n),r=o=>{const{from:a,to:l,fromKanban:c="",toKanban:d=""}=o;return this._multiKanban?s.has(`${c}_${a}`)||s.has(`${d}_${l}`)||s.has(c)||s.has(d)||s.has(Wn(o)):s.has(a)||s.has(l)||s.has(`${a}-${l}`)};return t.reduce((o,a)=>{if(!n||r(a)){const l=this._renderLink(a);l&&o.push(l)}return o},[])}_renderEditor(e){const{editLinks:t,onAddLink:n,container:s}=e;return t?S(ow,{container:s,onAddLink:n},"editor"):null}render(e){return this._watchSet.clear(),S("div",{className:"kanban-links",ref:this._ref,children:[this._renderLinks(e),this._renderEditor(e)]})}}function aw(i,e,t){if(!i||!i.length)return[];const{getCol:n,colProps:s,itemCountPerRow:r,itemGap:o}=e;let a=!1;const l=[],c=new Map;return i=i.reduce((d,u,p)=>{if(u=xe({itemGap:o,itemCountPerRow:r},s,u),n){const g=n.call(this,u);g!==!1&&(u=g||u)}return u.deleted||(typeof u.order=="number"?a=!0:u.order=p,typeof u.name!="string"&&(u.name=String(u.name)),t==null||t.call(this,u),u.parentName!==void 0?(u.parentName=String(u.parentName),l.push(u)):(c.set(u.name,u),d.push(u))),d},[]),l.forEach(d=>{const u=c.get(d.parentName);u&&(u.subCols=xn(u.subCols,[d],"name"))}),a&&(i.sort(lr),[...c.values()].forEach(d=>{d.subCols&&d.subCols.sort(lr)})),i}function lw(i,e,t){if(!i||!i.length)return[];const{getLane:n,laneProps:s}=e;let r=!1;return i=i.reduce((o,a,l)=>{if(s&&(a=xe({},s,a)),n){const c=n.call(this,a);c!==!1&&(a=c||a)}return a.deleted||(typeof a.order=="number"?r=!0:a.order=l,a.color===void 0&&(a.color=`hsl(${43*Rl(a.name)%360}deg 40% 50%)`),typeof a.name!="string"&&(a.name=String(a.name)),t==null||t.call(this,a),o.push(a)),o},[]),r&&i.sort(lr),i}function _m(i,e,t,n,s){if(!(i!=null&&i.length))return[];const{itemProps:r,getItem:o}=n;let a=!1;return i=i.reduce((l,c)=>{r&&(c=xe({},r,c));const d=(o==null?void 0:o.call(this,{col:t.name,lane:e.name,item:c,laneInfo:e,colInfo:t}))??c;return d!==!1&&!d.deleted&&(typeof d.order=="number"?a=!0:d.order=l.length-1,l.push(d),s==null||s.call(this,d)),l},[]),a&&i.sort(lr),i}function lr(i,e){return i.order-e.order}function xn(i,e,t="key"){if(!i)return e?[...e]:[];const n=[...i];if(e){let s=0;const r=n.reduce((o,a,l)=>(o.set(String(a[t]??l),l),s=Math.max(a.order??l,s),o),new Map);e.forEach(o=>{const a=String(o[t]);r.has(a)?n[r.get(a)]={...n[r.get(a)],...o}:n.push({order:s++,...o})})}return n}function bm(i,e){return Array.isArray(i)?i.map(t=>({...t,[e]:String(t[e])})):Object.keys(i).reduce((t,n)=>{const s=i[n];return Object.keys(s).forEach(r=>{t.push(...(s[r]||[]).map(o=>({...o,lane:n,col:r,[e]:String(o[e])})))}),t},[])}function wm(i,e){const{items:t=[],...n}=i;return{items:bm(t,e),...n}}function Dh(i,e,t){var a;const n=xn(i.lanes,e.lanes,"name"),s=xn(i.cols,e.cols,"name"),r=xn(i.links,(a=e.links)==null?void 0:a.map(l=>(l[t]===void 0&&(l[t]=Wn(l)),l)),t),o=xn(i.items,bm(e.items||[],t),t);return{lanes:n,cols:s,items:o,links:r}}let cr=class extends He{constructor(){super(...arguments),this._ref=de(),this._raf=0,this._data=new ri(this._getData.bind(this),()=>{const{getCol:e,colProps:t,itemCountPerRow:n,itemGap:s,getLane:r,laneProps:o,itemProps:a,getItem:l,getLink:c,linkProps:d,responsive:u}=this.props;return[this._kanbanData,e,t,n,s,r,o,a,l,d,c,u]}),this._kanbanData=new ri(()=>{const{itemKey:e,props:t}=this,{data:n}=t,{data:s,changes:r}=this.state,o=(s||ml(n)?s:wm(n,e))||{};return r?Dh(o,r,e):o},()=>{const{data:e,changes:t,selected:n}=this.state;return[e,t,n,this.props.data]}),this._handleGlobalClick=e=>{y(e.target).closest(".kanban-item").length||this.select([])},this._onAddLink=async e=>{const{onAddLink:t}=this.props;e[this.itemKey]=Wn(e),await(t==null?void 0:t.call(this,e))!==!1&&this.addLink(e)},this._onDeleteLink=async e=>{const{onDeleteLink:t}=this.props;await(t==null?void 0:t.call(this,e))!==!1&&this.deleteLink(e)},this._handleMouseMove=e=>{this._hoverTimer&&clearTimeout(this._hoverTimer);const t=this._getElementInfo(e.target),n=(t==null?void 0:t.type)==="item"?t.key:void 0;this._hoverTimer=window.setTimeout(()=>{n!==this.state.hover&&this.setState({hover:n},()=>{y(this._ref.current).trigger("kanbanItemHover",{kanban:this.props.key,hover:n})}),this._hoverTimer=0},!n&&this.state.hover?0:20)},this._handleClick=e=>{if(e.target.closest("a,button"))return;const{onClickItem:t,selectable:n}=this.props,s=this._getElementInfo(e.target);t&&(s==null?void 0:s.type)==="item"&&t.call(this,e,s)===!1||n&&(s==null?void 0:s.type)==="item"&&this.select(s.key,!0)}}get data(){return this._data.cache}get itemKey(){return this.props.itemKey||"id"}componentDidMount(){this._afterRender(!0),this.tryLoad(),this._initDraggable();const{responsive:e,selectable:t}=this.props,n=this._ref.current;if(n&&e){const s=new ResizeObserver(this.updateLayout.bind(this));y(typeof e!="boolean"?e:n.closest(".kanban-list")||n.parentElement).each((o,a)=>{s.observe(a)}),this._rob=s,this.state.containerWidth||this.updateLayout()}t&&y(document).on("click.kanban",this._handleGlobalClick)}componentDidUpdate(){this._afterRender(!1),this.tryLoad()}componentWillUnmount(){var e,t,n;(e=this.props.beforeDestroy)==null||e.call(this),(t=this._draggable)==null||t.destroy(),(n=this._rob)==null||n.disconnect(),this.props.selectable&&y(document).off("click.kanban",this._handleGlobalClick)}getDefaultState(e){return{loading:!1,selected:(e||this.props).defaultSelected,data:void 0,changes:void 0,loadFailed:void 0}}load(){const{data:e,onLoad:t,onLoadFail:n}=this.props;this._loadedSetting=e,this.setState({loading:!0},async()=>{const s={loading:!1};try{const r=wm(await mt(e,[this],{throws:!0}),this.itemKey);s.data=(t==null?void 0:t.call(this,r))||r}catch(r){s.loadFailed=(typeof n=="function"?n.call(this,r):n)||String(r)}this.setState(s)})}updateLayout(){this._raf&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._raf=0;const e=this._ref.current;if(e){const{responsive:t,laneNameWidth:n=20}=this.props,s=y(typeof t!="boolean"?t:e.closest(".kanban-list")||e.parentElement),r=s[0];let o=s.width()-n-(r.offsetWidth-r.clientWidth);const a=e.closest(".kanban-region");a&&(o-=a.clientWidth-y(a).width()),this.setState({containerWidth:o})}})}tryLoad(){const{loading:e}=this.state,{data:t}=this.props;e||!t||!ml(t)||t===this._loadedSetting||this.load()}getCol(e){return this.data.colMap.get(String(e))}getLane(e){return e=String(e),this.data.lanes.find(t=>t.name===e)}getItem(e){return this.data.map.get(String(e))}update(e){return this.changeState(t=>({changes:Dh({...t.changes},e,this.itemKey)}))}createSnap(){return{date:Date.now(),kanban:this,data:y.extend(!0,{},this._data),restore(){this.kanban.changeState({changes:this.data})}}}addItem(e,t,n){return this.updateItem(e,t,n)}updateItem(e,t,n){const s=Array.isArray(e)?e:[e];return this.update({items:t||n?s.map(r=>({...r,lane:t??r.lane,col:n??r.col})):s})}deleteItem(e){return this.updateItem(Array.isArray(e)?e.map(t=>({[this.props.itemKey||"id"]:t,deleted:!0})):{[this.itemKey]:e,deleted:!0})}updateLane(e){return this.update({lanes:Array.isArray(e)?e:[e]})}addLane(e){return this.updateLane(e)}deleteLane(e){return this.updateLane(Array.isArray(e)?e.map(t=>({name:t,deleted:!0})):{name:e,deleted:!0})}updateCol(e){return this.update({cols:Array.isArray(e)?e:[e]})}addCol(e){return this.updateCol(e)}deleteCol(e){return this.updateCol(Array.isArray(e)?e.map(t=>({name:t,deleted:!0})):{name:e,deleted:!0})}updateLink(e,t){return this.update({links:(Array.isArray(e)?e:[e]).map(n=>({deleted:!1,...n,...t,[this.itemKey]:Wn(n)}))})}addLink(e){return this.updateLink(e)}deleteLink(e){return this.updateLink(e,{deleted:!0})}select(e,t){let n=Array.isArray(e)?e:e?[e]:[],s=this.state.selected||[];const{onSelect:r}=this.props;return this.changeState(o=>{if(s=o.selected||[],t){const a=new Set(s),l=new Set;return n.forEach(c=>{a.has(c)?a.delete(c):l.add(c)}),n=[...a,...l],{selected:n}}return{selected:n}},()=>{r==null||r(n,s),y(this._ref.current).trigger("kanbanItemSelected",{kanban:this.props.key,selected:n,oldSelected:s})})}_getElementInfo(e){const t=y(e),n=t.closest(".kanban-item");if(n.length){const a=n.attr("z-key");if(a){const l=this.getItem(a);if(l)return{type:"item",key:a,element:e,item:l,lane:l.lane,col:l.col}}}if(t.closest(".kanban-new-item").length)return{type:"newItem",element:e};const r=t.closest(".kanban-header-col,.kanban-lane-col");if(r.length)return{type:"col",element:e,col:r.attr("z-col"),lane:r.attr("z-lane")};const o=t.closest(".kanban-lane").attr("z-lane");if(o!==void 0)return{type:"lane",element:e,lane:o}}_getDropInfo(e,t,n){const s=this._getElementInfo(t);if(!s)return;const r=this._getElementInfo(n);if(!r||r.element.closest(".kanban")!==this.element)return;let o;if(s.type==="item"&&r.type==="col")o="inside";else{const a=n.getBoundingClientRect();s.type==="col"?o=e.clientX$[o]===l[o]);x>=0&&d.splice(x,1);const k=d.findIndex($=>$[o]===C[o]);d.splice(e.side==="before"?k:k+1,0,u),_=!0}if(_){r.items=[];let C=-1;d.forEach((x,k)=>{const $=Math.max(0,C+1,x.order??k),E=c[k];C=$,(E!==x||$!==E.order)&&(x={...x,order:$}),x!==E&&r.items.push(x),a.list.push(x[o])})}}else if(t.type==="newItem"){const{onDropNewItem:l}=this.props;let c;if(l?c=l.call(this,e):(c=y(t.element).data(),c!=null&&c.item&&(c=c.item)),c={lane:n.lane,col:n.col,...c},c!=null&&c[o]){const u=[...s.items[n.lane][n.col]];u.push(c),r.items=u,a.list.push(c[o])}}return{changes:r,data:a}}_initDraggable(){const{draggable:e}=this.props,t=this._ref.current;if(!e||!t)return;const{dragTypes:n=["item","newItem"],onDragStart:s,onDrop:r,canDrop:o,dropRules:a}=this.props,l=typeof n=="string"?n.split(","):n,c={item:".kanban-item",lane:".kanban-lane-name",col:".kanban-header-col",newItem:".kanban-new-item"},d=typeof e=="object"?e:{},u=(g,_)=>{y(g).attr({"z-drag-type":_?_.drag.type:null,"z-drop-type":_?_.drop.type:null,"z-drop-side":_?_.side:null})},p={...d,selector:d.selector||l.map(g=>c[g]||"").filter(Boolean).join(","),target:d.target||(g=>{const _=this._getElementInfo(g);if(!_)return;const C={lane:".kanban-lane",col:".kanban-header-col",item:".kanban-item,.kanban-items",newItem:".kanban-item,.kanban-items"}[_.type];return y(t).find(C)}),canDrop:d.canDrop||o||a?(g,_,C)=>{const x=this._getElementInfo(_);if(!x)return!1;const k=this._getElementInfo(C);if(!k||k.element.closest(".kanban")!==this.element)return!1;if(x.type==="item"&&a){const $=x.col,E=k.col,z=x.lane,H=k.lane,Y=a[`${z}:${$}`]??a[$];return typeof Y=="boolean"?Y:!Y||Y.includes(E)||Y.includes(`${H}:${E}`)||Y.includes(`${H}:`)}if(o)return o.call(this,x,k)}:void 0,onDragStart:(g,_)=>{var x;const C=this._getElementInfo(_);return C?s?s.call(this,{event:g,drag:C}):(x=d.onDragStart)==null?void 0:x.call(this,g,_):!1},onDragOver:(g,_,C)=>{const x=this._getDropInfo(g,_,C);x&&u(C,x)},onDragLeave:(g,_,C)=>{u(C)},onDrop:(g,_,C)=>{var k;u(C);const x=this._getDropInfo(g,_,C);if(!x)return!1;if(r){const{changes:$,data:E}=this._getDropChanges(x);if(Object.keys($).length){x.data=E;const z=this.createSnap();r.call(this,$,x,z.restore)!==!1&&this.update($)}}return(k=d.onDrop)==null?void 0:k.call(this,g,_,C)}};this._draggable=new js(t,p)}_afterRender(e){var t;(t=this.props.afterRender)==null||t.call(this,e)}_getData(){const{itemKey:e,props:t}=this,n=this._kanbanData.value;let s=!1;const{items:r=[]}=n,o={},a=new Map,l=aw.call(this,n.cols,t,x=>{x.parentName!==void 0&&(s=!0),a.set(x.name,x)}),c=lw.call(this,n.lanes,t,x=>{o[x.name]=l.reduce((k,$)=>($.subCols?$.subCols.forEach(E=>{k[E.name]=[]}):k[$.name]=[],k),{})}),d=new Set,u=r.reduce((x,k)=>{if(k.deleted)return d.add(k[e]),x;x.set(k[e],k);const $=o[k.lane];if($){const E=$[k.col];E&&E.push(k)}return x},new Map),{selected:p=[]}=this.state,g=new Set(p),_=x=>{x.selected=g.has(x[e])};c.forEach(x=>{const k=o[x.name];k&&l.forEach($=>{var E;k[$.name]=_m.call(this,k[$.name],x,$,t,_),(E=$.subCols)==null||E.forEach(z=>{k[z.name]=_m.call(this,k[z.name],x,z,t,_)})})});let{links:C=[]}=n;return C=C.reduce((x,k)=>{var $;if(!k.deleted&&u.has(k.from)&&u.has(k.to)&&!d.has(k.from)&&!d.has(k.to)){k[e]===void 0&&(k[e]=Wn(k));const E=(($=t.getLink)==null?void 0:$.call(this,k))??k;E!==!1&&!E.deleted&&x.push(E)}return x},[]),{cols:l,lanes:c,items:o,map:u,colMap:a,links:C,hasSubCols:s}}_layoutCols(e,t){const{containerWidth:n=0}=this.state,{colsGap:s=8,minColWidth:r=150,maxColWidth:o=600,colWidth:a=200}=t,l=[];let c=0;const d=u=>{const{minWidth:p=r,maxWidth:g=o}=u;let{width:_=a}=u;typeof _=="function"&&(_=_.call(this,u));const C=_==="auto";if(C)_=p;else{const[x,k]=hi(_);k==="%"?_=n*x/100:_=x}return _=Math.min(g,Math.max(p,_)),c+=_+(c?s:0),u={...u,width:_,maxWidth:g,minWidth:p},C&&l.push(u),u};if(e=e.map(u=>u.subCols?{...u,subCols:u.subCols.map(d)}:d(u)),l.length&&c{p.width=Math.min(p.maxWidth,Math.max(p.minWidth,p.width+u))})}return e}_layoutLanes(e,t){const{laneHeight:n,maxLaneHeight:s,minLaneHeight:r}=t;return!n&&!s&&!r?e:e.map(o=>({height:typeof n=="function"?n.call(this,o):n,maxHeight:s,minHeight:r,...o}))}_getClassName(e){return["kanban",e.className,e.sticky?"kanban-sticky":"",this.data.hasSubCols?"has-sub-cols":""]}_getProps(e){const{laneNameWidth:t,colsGap:n,lanesGap:s,selectable:r,onClickItem:o,showLinkOnHover:a}=e;return xe(super._getProps(e),{ref:this._ref,style:{"--kanban-lane-name-width":t,"--kanban-cols-gap":Ve(n),"--kanban-lanes-gap":Ve(s)},onClick:o||r?this._handleClick:void 0,onMouseMove:a?this._handleMouseMove:void 0})}_renderLinks(e){const{links:t=[]}=this.data,{editLinks:n}=e;if(!n&&!t.length)return;const{showLinkOnHover:s,showLinkOnSelected:r}=e;let o;if(r||s){o=[];const{selected:a,hover:l}=this.state;r&&a&&o.push(...a),s&&l&&o.push(l),o=[...new Set(o)]}return S(vm,{links:t,filters:o,editLinks:n,onDeleteLink:n?this._onDeleteLink:void 0,onAddLink:n?this._onAddLink:void 0},"links")}_getChildren(e){const t=this._data.value,{cols:n,lanes:s,items:r}=t,{laneNameWidth:o}=e,a=this._layoutCols(n,e),l=this._layoutLanes(s,e);return[S(Jb,{cols:a},"header"),S(Zb,{itemRender:e.itemRender,getLaneCol:e.getLaneCol,cols:a,lanes:l,items:r,hideLaneName:o===0},"body"),this._renderLinks(e),e.children]}};cr.defaultProps={draggable:!0,sticky:!0,responsive:!0,itemKey:"id",colWidth:200,colsGap:8},cr.customProps=["onDrop","onDragStart"];class Cm extends He{constructor(){super(...arguments),this._kanbanRefs=new Map,this._needUpdateData=new Map,this._handleClickHeading=e=>{y(e.target).closest("a,.btn,button").not(".kanban-region-toggle").length||this.setState(t=>({collapsed:!t.collapsed}))}}componentDidUpdate(){if(this.state.collapsed)return;const e=this._needUpdateData;[...e.keys()].forEach(t=>{const n=this.getKanban(t);n&&(n.update(e.get(t)),e.delete(t))})}getDefaultState(e){return{collapsed:(e||this.props).collapsed,heading:void 0,items:void 0}}resetState(e,t){this._kanbanRefs.forEach(n=>{var s;return(s=n.current)==null?void 0:s.resetState()}),super.resetState(e,t)}getKanban(e){var t;return(t=this._kanbanRefs.get(String(e)))==null?void 0:t.current}toggle(e){this.setState(t=>({collapsed:e===void 0?!t.collapsed:!e}))}update(e){const{items:t}=e;return t&&(e={...e},e.items=t.map((n,s)=>{const r=String(n.key||s);return n.deleted?{key:r,deleted:!0}:(n.data&&typeof n.data=="object"&&this.getKanban(r)&&(this._needUpdateKanban(r,n.data),n={...n},delete n.data),n)})),new Promise(n=>{this.setState(e.items?s=>({...e,items:xn(s.items,e.items)}):e,n)})}_needUpdateKanban(e,t){const n=this._needUpdateData,s=n.get(e),{kanbanItemKey:r="key"}=this.props;n.set(e,Dh(s||{},t,r))}_buildItems(e){const{items:t=[],kanbanProps:n,kanbanItemKey:s="key"}=e;let{items:r}=this.state;r?(r=xn(t,r,s).filter(c=>!c.deleted),r.sort(lr)):r=t;const o=this._kanbanRefs,a=new Set(o.keys()),l=r.map((c,d)=>{if(c.deleted)return null;const u=xe({className:"kanban-region-item",key:d},typeof n=="function"?n.call(this,c,d):n,c),p=String(u.key);let g=o.get(p);return g||(g=de(),o.set(p,g)),u.ref=g,a.delete(p),S(cr,{"z-key":p,...u})});return a.forEach(c=>{o.delete(c)}),l}_getClassName(e){return["kanban-region",e.className,this.state.collapsed?"is-collapsed":"is-expanded",e.heading?"has-heading":""]}_getChildren(e){const{heading:t,toggleFromHeading:n}=e,{collapsed:s,heading:r}=this.state,o=xe({className:"kanban-heading",onClick:n?this._handleClickHeading:void 0},typeof t=="function"?t.call(this):t,r);return[t&&S(tn,{...o},"heading"),s?null:this._buildItems(e)]}}const Ih=".kanban";let xm=class extends He{constructor(){super(...arguments),this.state={},this._ref=de(),this._kanbanRefs=new Map,this._onAddLink=async e=>{const{onAddLink:t,linkItemKey:n}=this.props;e[n]=Wn(e),await(t==null?void 0:t.call(this,e))!==!1&&this.addLink(e)},this._onDeleteLink=async e=>{const{onDeleteLink:t}=this.props;await(t==null?void 0:t.call(this,e))!==!1&&this.deleteLink(e)}}componentDidMount(){const e=this._ref.current;if(e){const{moveable:t,responsive:n,showLinkOnSelected:s,showLinkOnHover:r}=this.props;if(t&&(this._moveable=new Bs(e,y.extend({selector:"self",move:"scroll",onMoveStart:(o,a)=>{const{bottom:l,right:c}=a.getBoundingClientRect();return o.clientYl-20||o.clientXc-20?!1:!y(o.target).closest("a,input,.btn,.state,.kanban-item,.not-moveable").length}},typeof t=="object"?t:null))),s&&y(e).on(`kanbanItemSelected${Ih}`,(o,a)=>{this.setState(l=>({selected:{...l.selected,[a.kanban]:a.selected}}))}),r&&y(e).on(`kanbanItemHover${Ih}`,(o,{kanban:a,hover:l})=>{this.setState({hover:l===void 0?l:`${a}_${l}`})}),n){const o=new ResizeObserver(this._tryUpdateLayout.bind(this));(typeof n!="boolean"?y(n):y(e).parent()).each((l,c)=>{o.observe(c)}),this._rob=o}}}componentWillUnmount(){var t,n;(t=this._moveable)==null||t.destroy(),(n=this._rob)==null||n.disconnect();const e=this._ref.current;e&&y(e).off(Ih)}getDefaultState(e){return{linkChanges:void 0}}resetState(e,t){this._kanbanRefs.forEach(n=>{var s;(s=n.current)==null||s.resetState()}),super.resetState(e,t)}getKanban(e){const t=String(e),n=this._kanbanRefs;if(n.has(t))return n.get(t).current;let s=null;const r=Array.from(n.values());for(const o of r){const a=o.current;if(a instanceof Cm&&(s=a.getKanban(e),s))break}return s||null}updateKanban(e,t){const n=this.getKanban(e);return n?n.update(t):Promise.reject(new Error(`[ZUI] Kanban not found: ${e}`))}updateLayout(){const e=this._ref.current;if(!e)return;const t=y(e),n=t.width(),s=t.height();this.setState({width:n,height:s})}updateLink(e,t){return this.changeState(n=>{let s=Array.isArray(e)?e:[e];return t&&(s=s.map(r=>({...r,...t}))),{linkChanges:xn(n.linkChanges,s,this.props.linkItemKey)}})}addLink(e){return this.updateLink(e)}deleteLink(e){return this.updateLink(e,{deleted:!0})}_tryUpdateLayout(){this._layoutTimer&&cancelAnimationFrame(this._layoutTimer),this._layoutTimer=requestAnimationFrame(()=>{this.updateLayout(),this._layoutTimer=0})}_getClassName(e){return["kanban-list",e.className,e.sticky?"has-sticky":"",e.moveable?"is-moveable":"",e.scrollbarHover?"scrollbar-hover":""]}_getProps(e){const{width:t,height:n}=e,s=typeof t=="function"?t.call(this):t,r=typeof n=="function"?n.call(this):n,{width:o,height:a}=this.state??{};return xe(super._getProps(e),{ref:this._ref,style:{width:s,height:r,"--kanban-list-width":`${o||t}px`,"--kanban-list-height":`${a||n}px`}})}_getLinks(e){const{linkChanges:t=[]}=this.state,{links:n=[],getLink:s,linkItemKey:r}=e;return xn(n,t,this.props.linkItemKey).reduce((o,a)=>{const l=s==null?void 0:s.call(this,a);return l!==!1&&(a=l||a,a.deleted||(a[r]||(a[r]=Wn(a)),o.push(a))),o},[])}_renderLinks(e){const t=this._getLinks(e),{editLinks:n}=e;if(!n&&!t.length)return;const{showLinkOnHover:s,showLinkOnSelected:r}=e;let o;if(t.length&&(r||s)){o=[];const{selected:a={},hover:l}=this.state;r&&a&&Object.keys(a).forEach(c=>{const d=a[c];d.length&&o.push(...d.map(u=>`${c}_${u}`))}),s&&l&&o.push(l),o=[...new Set(o)]}return S(vm,{container:".kanban-list",links:t,filters:o,editLinks:n,onDeleteLink:n?this._onDeleteLink:void 0,onAddLink:n?this._onAddLink:void 0},"links")}_getChildren(e){const{items:t=[],kanbanProps:n,showLinkOnSelected:s,showLinkOnHover:r,selectable:o,editLinks:a}=e,l=this._kanbanRefs,c=new Set(l.keys()),d=[...t.map((p,g)=>{n&&(p=typeof n=="function"?n.call(this,p,g):y.extend({},n,p));const _=String(p.key??g);let C=l.get(_);C||(C=de(),l.set(_,C)),c.delete(_);const x=p.heading!==void 0||p.items;return(s||r||o)&&(x?p.kanbanProps={showLinkOnSelected:s,showLinkOnHover:r,selectable:o,...p.kanbanProps}:p={showLinkOnSelected:s,showLinkOnHover:r,selectable:o,...p}),a&&(x?p.items=(p.items||[]).map($=>({...$,editLinks:!1})):p={...p,editLinks:!1}),S(x?Cm:cr,{ref:C,sticky:e.sticky,...p,"z-key":_},_)}),e.children];c.forEach(p=>{l.delete(p)});const u=this._renderLinks(e);return u&&d.push(u),d}};xm.defaultProps={moveable:!0,sticky:!0,responsive:!0,scrollbarHover:!0,linkItemKey:"id"};class hr extends ye{}hr.NAME="Kanban",hr.replace=!0,hr.Component=cr,hr.register();class ur extends ye{update(e,t){if(e=Array.isArray(e)?e:[e],t)return this.render({items:e});const n=this.options.items||[],s=new Map(n.map((o,a)=>[o.key,a])),r=[...n];return e.forEach(o=>{if(s.has(o.key)){const a=s.get(o.key);r[a]={...n[a],...o}}else r.push(o)}),this.render({items:r.filter(o=>!o.deleted)})}}ur.NAME="KanbanList",ur.replace=!0,ur.Component=xm,ur.register();const dk="",fk="",pk="",mk="",gk="",yk="",vk="",_k="",bk="",wk="",cw="nav",Nh='[data-toggle="tab"]',hw="active";class dr extends Fe{constructor(){super(...arguments),this._timer=0}active(e){const t=this.$element,n=t.find(Nh);let s=e?y(e).closest(Nh):n.filter(`.${hw}`);if(!s.length&&(s=t.find(Nh).first(),!s.length))return;n.removeClass("active"),s.addClass("active");const r=s.attr("href")||s.data("target"),o=s.data("name")||r,a=t.closest(".tabs"),l=a.length?a.find(r):y(r);l.length&&(l.parent().children(".tab-pane").removeClass("active in"),l.addClass("active").trigger("show",[o]),this.emit("show",o),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(()=>{l.addClass("in").trigger("shown",[o]),this.emit("shown",o),this._timer=0},10))}}dr.NAME="Tabs",dr.toggle={name:"tab",handler(i,e){const t=y(i),n=t.closest(`.${cw}`);n.length&&dr.ensure(n,e).active(t)}},dr.register();function uw(i){const[e,t]=i.split(":"),n=e[0]==="-"?{name:e.substring(1),disabled:!0}:{name:e};return t!=null&&t.length&&(n.type="dropdown",n.items=t.split(",").reduce((s,r)=>(r=r.trim(),r.length&&s.push(r[0]==="-"?{name:r.substring(1),disabled:!0}:{name:r}),s),[])),n}const dw=(i,e)=>{var s;i.url&&(i.url=be(i.url,e.row.data));const t={row:e.row.id,col:e.col.name},n=((s=i.dropdown)==null?void 0:s.items)||i.items;return n&&n.forEach(r=>(r.url&&(r.url=be(r.url,e.row.data)),r.data=t,r)),i.data=t,i},km=i=>i?(typeof i=="string"&&(i=i.split("|")),i.map(e=>typeof e=="string"?uw(e):e).filter(Boolean)):[],fw=qe({name:"actions",colTypes:{actions:{onRenderCell(i,e){var d;const{row:t,col:n}=e,s=km(((d=t.data)==null?void 0:d[n.name])||n.setting.actions);if(!s.length)return i;const{actionsSetting:r,actionsMap:o,actionsCreator:a=this.options.actionsCreator,actionItemCreator:l=this.options.actionItemCreator||dw}=n.setting,c={items:(a==null?void 0:a(e))??s.map(u=>{const{name:p,...g}=u;if(o&&p){Object.assign(g,o[p],{...g});const{buildProps:C}=g;typeof C=="function"&&(delete g.buildProps,Object.assign(g,C(i,e)))}const{items:_}=g;if(g.disabled&&(delete g.url,delete g["data-toggle"]),_&&g.type==="dropdown"){const{dropdown:C={placement:"bottom-end"}}=g;C.menu={className:"menu-dtable-actions"},C.items=_.map(x=>{const k=typeof x=="string"?{name:x}:{...x};return k.name&&o&&o[k.name]&&Object.assign(k,o[k.name],{...k}),k.disabled?(delete k.url,delete k["data-toggle"]):k.url&&(k.url=be(k.url,t.data)),k}),g.dropdown=C,delete g.items}return l?l(g,e):g}),btnProps:{btnType:"ghost",size:"sm",className:"text-primary"},...r};return i[0]=S(Oe,{...c}),i}}},beforeLayout(i){!Array.isArray(i.data)||!i.data.length||i.cols.forEach((e,t)=>{if(e.type!=="actions"||e.width)return;const{actionsMap:n={}}=e,r=km(i.data[0][e.name]).reduce((o,a)=>{const l=a.name?n[a.name]:null;return l&&l.type==="dropdown"&&l.caret&&!l.text?o+16:o+24},24);i.cols[t]={...e,width:r}})}}),pw=qe({name:"toolbar",footer:{toolbar(){const{footToolbar:i,showToolbarOnChecked:e}=this.options;return e&&!this.getChecks().length?[]:[i?Oe.render(i,[this],{gap:2}):null]}}}),kk="",Sm=function(i,e){var s,r;const{col:t}=e,{sortColFrom:n}=this.state;if(n){n.name===t.name&&i.push({outer:!0,className:"is-sorting-from-col"});const o=(r=(s=this.data.sortColInfo)==null?void 0:s.colOffsetMap)==null?void 0:r[t.name];typeof o=="number"&&i.push({outer:!0,className:"is-sorting-col-move",style:{left:t.left+o}})}return i},mw=qe({name:"sort-col",when:i=>!!i.sortCol,plugins:[ya,um],resetState:!0,state(){return{colOrders:{},sortColFrom:void 0,sortingColPos:void 0,sortingColTo:void 0,sortingColSide:void 0}},events:{mousedown(i){var r;if(this.data.disableSortCol)return;const e=this.getPointerInfo(i);if(!e||e.rowID!=="HEADER")return;const t=this.getColInfo(e.colName);if(!t||((r=this.options.onSortColStart)==null?void 0:r.call(this,t,i))===!1)return;y(i.target).closest("a,button,img").attr("draggable","false").length&&i.preventDefault(),i.preventDefault();const n=i.clientX,{cellElement:s}=e;this.data.sortColInfo={from:t,element:s,offset:n-s.getBoundingClientRect().left,startMouseX:n,lastMouseX:n},y(s).zuiCall("ContextMenu.hide")},document_mouseup(i){var n;const{sortColInfo:e}=this.data;if(!e)return;this.stopScrollToMouse();const t=this.getSortingColState(i);if(t){let s,r;const{from:o,to:a,side:l}=t;if(a){if(o.name===a.name)s={};else if(l){const c=this.layout.cols[o.side].list,d=o.sideIndex,u=a.sideIndex,p=c.splice(d,1);c.splice(u+(l==="after"?1:0),0,p[0]),s={},r=[],c.forEach(({name:g},_)=>{s[g]=_+1,r.push(g)}),((n=this.options.onSortCol)==null?void 0:n.call(this,o,a,l,r))===!1&&(s=void 0,r=void 0)}Math.abs(e.lastMouseX-e.startMouseX)>4&&this.ignoreNextClick()}this.disableAnimation(),this.update({dirtyType:"layout",state:y.extend({sortColFrom:void 0,sortingColPos:void 0,sortingColTo:void 0,sortingColSide:void 0},s?{colOrders:{...this.state.colOrders,...s}}:null)},()=>{var c;(c=this.options.onSortColEnd)==null||c.call(this,o,a,l,r)})}this.data.sortColInfo=void 0},document_mousemovesmooth(i){const{sortColInfo:e}=this.data;if(!e)return;const t=this.getSortingColState(i);t&&(e.state||this.startScrollToMouse({side:"x"}),e.lastMouseX=i.clientX,e.state=t,this.setState({sortColFrom:t.from,sortingColPos:t.pos,sortingColTo:t.to,sortingColSide:t.side}))}},methods:{getSortingColState(i){var x;const{disableSortCol:e,sortColInfo:t}=this.data;if(e||!t)return;const{from:n,element:s}=t,o=y(s).closest(".dtable-cells")[0].getBoundingClientRect(),a=i.clientX-o.left,{cols:l,scrollLeft:c}=this.layout,d=l[n.side].list;if(d.length<=1)return t.state;const u=c+a,p=d.find(k=>k.visible&&k.left<=u&&k.left+k.width>u);if(!p)return t.state;const g=u{const u=l-d.left;u&&(c[d.name]=u),l+=d.realWidth}),this.data.sortColInfo.colOffsetMap=c}},onRenderHeaderCell(i,e,t,n){const{sortCol:s}=this.options;return s&&(this.layout.cols[e.col.side].list.length>1&&(s===!0||Array.isArray(s)&&s.includes(e.col.name)||typeof s=="function"&&s.call(this,e.col))&&i.push({outer:!0,className:"is-sortable-col"}),i=Sm.call(this,i,e,t,n)),i},onRenderCell:Sm}),Tk="";function Tm(i,e,t){const{colResizing:n}=i.state;if(!n)return;const s=Math.round(e.clientX-n.startX);if(!s&&!t)return;const r={};t&&(r.colResizing=void 0);const{colName:o}=n;let a=i.getColInfo(o);if(!a)return i.update({dirtyType:"layout",state:r});r.colsSizes={...i.state.colsSizes,[o]:n.startSize+s},i.update({dirtyType:"layout",state:r},t?()=>{var l;if(a=i.getColInfo(o),a){const c=i.data.colOriginSize.get(o);(l=i.options.onColResize)==null||l.call(i,o,a.width-c,a)}}:void 0),e.stopPropagation(),e.preventDefault()}const gw=qe({name:"resize",when:i=>!!i.colResize,plugins:[ya],resetState(i){var e;return{colsSizes:(e=i.cols)==null?void 0:e.reduce((t,n)=>(n.extraWidth!==void 0&&(t[n.name]=n.extraWidth),t),{})}},state(){var i;return{colsSizes:(i=this.props.cols)==null?void 0:i.reduce((e,t)=>(t.extraWidth!==void 0&&(e[t.name]=t.extraWidth),e),{})}},data(){return{colOriginSize:new Map}},events:{mousedown(i){const e=i.target.closest(".dtable-col-splitter");if(!e)return;const t=e.closest(".dtable-cell"),n=t==null?void 0:t.dataset.col;if(n)return this.setState({colResizing:{colName:n,startSize:this.state.colsSizes[n]??0,startX:i.clientX}},()=>{y(t).zuiCall("ContextMenu.hide")}),!1},dblclick(i){var s;const e=i.target.closest(".dtable-col-splitter");if(!e)return;const t=(s=e.closest(".dtable-cell"))==null?void 0:s.dataset.col;if(!t)return;const{colsSizes:n}=this.state;n[t]&&(delete n[t],this.update({dirtyType:"layout",state:{colResizing:void 0,colsSizes:{...n}}},()=>{var r;(r=this.options.onColResize)==null||r.call(this,t,0,this.getColInfo(t))}))},document_mouseup(i){if(this.state.colResizing)return Tm(this,i,!0),!1},document_mousemovesmooth(i){if(this.state.colResizing)return Tm(this,i),!1}},methods:{isColResizable(i){if(typeof i=="string"&&(i=this.getColInfo(i)),!i||i.side!=="left"&&i.sideIndex===this.layout.cols[i.side].list.length-1)return;let e=i.setting.colResize??this.options.colResize;return typeof e=="function"&&(e=e.call(this,i.name)),!!e}},onRenderHeaderCell(i,{col:e}){var t;return this.isColResizable(e)&&(i.push({className:"has-col-splitter",children:S("div",{className:"dtable-col-splitter no-cell-event"}),outer:!0}),((t=this.state.colResizing)==null?void 0:t.colName)===e.name&&i.push({className:"has-col-resizing",outer:!0})),i},onRenderCell(i,{col:e}){var t;return((t=this.state.colResizing)==null?void 0:t.colName)===e.name&&i.push({className:"is-col-resizing",outer:!0}),i},onAddCol(i){const e=this.state.colsSizes[i.name]??i.setting.extraWidth;typeof e=="number"&&(this.data.colOriginSize.set(i.name,i.width),i.width=ep(i.width+e,i.setting.minWidth,i.setting.maxWidth))},onRender(){if(this.state.colResizing)return{className:"has-col-resizing"}}}),Dk="",yw=qe({name:"contextmenu",when:i=>!!i.contextmenu,events:{contextmenu(i){const e=this.getPointerInfo(i);if(!e)return;const t=this.getContextMenuItems(i,e);if(!t||!t.length)return;i.preventDefault();const n=y(e.cellElement).addClass("has-contextmenu-show");e.cellElement.classList.add("active"),hs.show({items:t,key:`dtable-ctx-${this.id}`,triggerEvent:i,hideOthers:!0,onHide(){n.removeClass("has-contextmenu-show")}})}},methods:{getContextMenuItems(i,e){const{contextmenu:t}=this.options;if(typeof t=="function")return t.call(this,i,e);if(!t||Array.isArray(t))return t;const{header:n,cell:s}=t;return e.rowID==="HEADER"?typeof n=="function"?n.call(this,i,e):n:typeof s=="function"?s.call(this,i,e):s}}});function $m(i,e){if(typeof e=="string"&&(e=i.getColInfo.call(i,e)),!e)return{};const{colBorders:t}=i.state,{side:n,sideIndex:s}=e,r=i.layout.cols[n].list,o=s>0?r[s-1]:null,a=r[s+1];return{prevName:o==null?void 0:o.name,nextName:a==null?void 0:a.name,prev:o?t[o.name]??o.setting.border:void 0,next:a?t[a.name]??a.setting.border:void 0}}function ds(i,e){return i===e||i===!0}const vw=qe({name:"custom-col",when:i=>!!i.customCol,plugins:[yw],resetState:!0,options(i){return i.customCol&&!i.contextmenu&&(i.contextmenu={header:(e,t)=>{var o,a;const n=this.getColBorder(t.colName),s=l=>{const c={width:"12px",margin:"0 2px",height:"12px",border:"1px dotted var(--color-border-strong)"},d="2px solid var(--color-border-strong)";return l==="left"?c.borderLeft=d:l==="right"?c.borderRight=d:l===!0&&(c.borderLeft=d,c.borderRight=d),S("span",{style:c})},r=((o=this.getColInfo(t.colName))==null?void 0:o.setting.required)||!((a=this.options.canSetColVisibility)!=null&&a.call(this,t.colName,!1));return[{icon:s(n),text:this.i18n("setDivider"),items:[{text:this.i18n("leftDivider"),icon:s("left"),selected:n==="left",onClick:()=>this.setColBorder(t.colName,"left")},{text:this.i18n("rightDivider"),icon:s("right"),selected:n==="right",onClick:()=>this.setColBorder(t.colName,"right")},{text:this.i18n("allDivider"),icon:s(!0),selected:n===!0,onClick:()=>this.setColBorder(t.colName,!0)},{text:this.i18n("noDivider"),icon:s(!1),selected:!n,onClick:()=>this.setColBorder(t.colName,!1)}]},{text:this.i18n("hideCol"),icon:"eye-off",disabled:r,onClick:r?void 0:()=>this.setColVisibility(t.colName,!1)}]}}),i},state(){return{colBorders:{},colVisibility:{}}},methods:{getColBorder(i,e=!0){const t=this.getColInfo(i);if(!t)return!1;const{colBorders:n}=this.state,s=n[i]??t.setting.border;if(s===!0||!e)return s;const{prev:r,next:o}=$m(this,t),a=s==="left"||ds(r,"right"),l=s==="right"||ds(o,"left");return a&&l?!0:a?"left":l?"right":!1},setColBorder(i,e){if(this.getColBorder(i,!1)===e)return;const{onSetColBorder:n}=this.options,{prev:s,next:r,prevName:o,nextName:a}=$m(this,i);this.update({dirtyType:"layout",state:l=>{const c={...l.colBorders,[i]:e};return!ds(e,"left")&&ds(s,"right")&&(c[o]=!1),!ds(e,"right")&&ds(r,"left")&&(c[a]=!1),{colBorders:c}}},n?()=>{n.call(this,i,e,this.state.colBorders)}:void 0)},setColVisibility(i,e){const{onSetColVisibility:t}=this.options;this.update({dirtyType:"options",state:n=>({colVisibility:{...n.colVisibility,[i]:e}})},t?()=>{t.call(this,i,e)}:void 0)}},onAddCol(i){const{colBorders:e}=this.state;e[i.name]!==void 0&&(i.border=e[i.name])},beforeLayout(i){const{colVisibility:e}=this.state;Object.keys(e).length&&i.cols&&(i.cols=i.cols.map(t=>(e[t.name]!==void 0&&(t={...t,hidden:!e[t.name]}),t)))},i18n:{zh_cn:{setDivider:"设置分割线",leftDivider:"左侧",rightDivider:"右侧",allDivider:"两侧",noDivider:"无",hideCol:"隐藏此列"},zh_tw:{setDivider:"設置分割線",leftDivider:"左側",rightDivider:"右側",allDivider:"兩側",noDivider:"無",hideCol:"隱藏此列"},en:{setDivider:"Set divider",leftDivider:"Left Side",rightDivider:"Right Side",allDivider:"Both Sides",noDivider:"No Divider",hideCol:"Hide this column"}}}),Mk="";function Mh(i,e,t){if(t){if(typeof t=="object"){const n=t[i];return typeof n=="string"?n:typeof n=="object"&&n?n.realname:void 0}if(typeof t=="function")return t(i,e)}}function Dm(i,e,t){let n;if(typeof i=="function"?n=i(e,t):typeof i=="object"&&(n=i[e]),n)return b(Ie,{className:"dtable-cell-icon",icon:n})}const Im={name:"zentao",plugins:["group","checkable","nested",fw,pw,dm,mw,gw,vw],defaultOptions:{colHover:"header",rowHeight:36,striped:!1,responsive:"window,parent,.search-form,~document_layout",checkable:"auto",nested:"auto",width:"100%",footer:void 0,showToolbarOnChecked:!0,checkOnClickRow:!0,groupDivider:!0,preserveNested:!0,extraHeight:"+",height(i){var r;const e=(r=this.element)==null?void 0:r.closest(".modal-dialog"),t=y(e||"body");let n=this.options.extraHeight;typeof n=="string"&&(n[0]==="+"&&(n=(e?".modal-header,.modal-footer,.search-form,36,#featureBar,":"#header,#mainMenu,#mainNavbar,.search-form,")+n.slice(1)),n=n.split(",")),Array.isArray(n)||(n=[n]);const s=n.reduce((o,a)=>a?typeof a=="number"||/^\d+$/.test(a)?o+Number(a):o+(t.find(a).outerHeight()||0):o,0);return Math.min(i,window.innerHeight-(e?64:1)-s)}},options(i){var l;const{checkable:e,footToolbar:t,footPager:n,footer:s}=i;if(s===void 0){const c=[];if(e&&c.push("checkbox"),t){const d=Array.isArray(t)?{items:t}:t;c.push("toolbar"),d.btnProps=y.extend({btnType:"primary",size:"sm"},d.btnProps),typeof d=="object"&&Array.isArray(d.items)&&d.items.forEach(u=>{if((u==null?void 0:u.type)==="dropdown"){const p=u.menu||u["data-menu"];p&&p.searchBox&&(p.searchPlacement===void 0&&(p.searchPlacement="bottom"),p.maxHeight||(p.maxHeight=480))}}),i.footToolbar=d}e&&c.push("checkedInfo"),n&&c.push("flex","pager"),c.length&&(i.footer=c)}const r={"data-load":"table","data-selector":"dtable","data-target":i.id,...i.loadOptions},o=i.loadPartial||((l=this.parent||this.element)==null?void 0:l.closest(".modal"));o&&(r["data-partial"]=!0),n&&(n.btnProps=y.extend({type:"ghost",size:"sm"},n.btnProps),n.items&&n.items.forEach(c=>{c.type==="size-menu"?y.extend(!0,c,{itemProps:o?{...r,...c.itemProps}:{"data-app":"current",...c.itemProps},placement:"top"}):c.type==="link"&&y.extend(c,r)}));let{sortLink:a}=i;if(a&&(typeof a=="string"&&(a={url:a}),typeof a=="object"&&(a=y.extend(r,a)),i.sortLink=a),i.customCols){i.colResize===void 0&&(i.colResize=!0),i.sortCol===void 0&&(i.sortCol=!0);const c=()=>{this.trySaveColsSetting()};i.sortCol&&!i.onSortColEnd&&(i.onSortColEnd=c),i.colResize&&!i.on&&(i.onColResize=c),i.customCol===void 0&&(i.customCol=!0),i.customCol&&(i.onSetColBorder||(i.onSetColBorder=c),i.onSetColVisibility||(i.onSetColVisibility=c),i.canSetColVisibility||(i.canSetColVisibility=d=>{const u=this.getColInfo(d);return!u||u.side!=="center"?!1:this.layout.cols[u.side].list.length>1}))}return i},i18n:{zh_cn:{unassigned:"未指派"},zh_tw:{unassigned:"未指派"},en:{unassigned:"Unassigned"}},colTypes:{id:{width:60,fixed:"left",align:"center",sortType:!0,maxWidth:120},checkID:{width:80,fixed:"left",align:"left",sortType:!0,checkbox:!0,maxWidth:160},title:{width:.44,fixed:"left",align:"left",sortType:!0,flex:1,hint:!0,maxWidth:600},shortTitle:{width:.2,align:"left",sortType:!0,fixed:"left",checkbox:!0,flex:1,hint:!0,maxWidth:250},nestedTitle:{width:.5,align:"left",sortType:!0,fixed:"left",flex:1,nestedToggle:!0,nestedIndent:20,hint:!0,maxWidth:650},shortNestedTitle:{width:.33,align:"left",sortType:!0,fixed:"left",flex:1,nestedToggle:!0,nestedIndent:20,hint:!0,maxWidth:300},status:{width:80,align:"center",sortType:!0,onRenderCell(i,{col:e,row:t}){var o,a;const n=(o=t.data)==null?void 0:o[e.name];let s,r;return typeof n=="string"?(s=n,r=(a=e.setting.statusMap)==null?void 0:a[n]):typeof n=="object"&&n&&({name:s,label:r}=n),i[0]=b("span",{class:`${e.setting.statusClassPrefix??"status-"}${s}`},r??s),i}},user:{width:80,align:"center",sortType:!0,onRenderCell(i,{col:e,row:t,value:n}){const{userMap:s=this.options.userMap,userJoiner:r=" "}=e.setting;if(Array.isArray(n))i[0]=n.map(o=>Mh(o,t,s)).filter(Boolean).join(r);else{const o=Mh(n,t,s);o!==void 0&&(i[0]=o)}return i}},assign:{width:108,align:"left",sortType:!0,cellClass:"px-1.5",onRenderCell(i,e){const{col:t,row:n,value:s}=e,{options:r}=this,{userMap:o=r.userMap,currentUser:a=r.currentUser,assignLink:l,unassignedText:c=r.unassignedText||this.i18n("unassigned")}=t.setting,d=!s,u=s==="closed",p=d?c:Mh(s,n,o)??s;return i[0]=l?wh(l,e,[b("i",{className:"icon icon-hand-right"}),b("span",null,p)],{"data-toggle":u?void 0:"modal",className:`dtable-assign-btn${a===s?" is-me":""}${d?" is-unassigned":""}${u?" disabled":""}`}):p,i}},avatar:{width:44,align:"center",sortType:!0},avatarName:{width:108,align:"left",sortType:!0},avatarBtn:{width:108,align:"left",sortType:!0},category:{width:80,align:"center",flex:1,hint:!0},desc:{width:160,align:"left",flex:1,hint:!0},text:{width:136,align:"left",flex:1,hint:!0},icon:{width:52,align:"center",cellClass:"px-1",onRenderCell(i,{row:e,col:t,value:n}){const{iconRender:s}=t.setting,r=Dm(s,n,e);return r&&(i[0]=r),i}},pri:{width:68,align:"center",cellClass:"px-1",sortType:!0,onRenderCell(i,{col:e,value:t}){const{priList:n=this.options.priList||{}}=e.setting,s=n[t]??t;return i[0]=b(zp,{pri:t,text:s}),i}},severity:{width:92,align:"center",cellClass:"px-1",sortType:!0,onRenderCell(i,{col:e,value:t}){const{severityList:n=this.options.severityList||{}}=e.setting,s=n[t]??t;return i[0]=b(Fp,{severity:t,text:s}),i}},burn:{width:88,align:"center",onRenderCell(i,{col:e}){const t=i[0];if(!t)return i;const{burn:n}=e.setting,s={data:t,className:"border-b",width:64,height:24,responsive:!1,...n};return i[0]=b(zc,{...s}),i}},date:{width:96,align:"center",sortType:!0},time:{width:64,align:"center",sortType:!0},datetime:{width:128,align:"center",sortType:!0},progress:{width:64,align:"center",sortType:!0},money:{width:96,align:"right",sortType:!0},count:{width:92,align:"right",sortType:!0},number:{width:64,align:"center",sortType:!0,digits:-1},percent:{width:64,align:"center",sortType:!0,format(i){return typeof i=="string"&&i.endsWith("%")?i:`${i}%`}},actions:{minWidth:120,align:"left",fixed:"right"}},methods:{trySaveColsSetting(){this.data.saveColsSettingTimer&&clearTimeout(this.data.saveColsSettingTimer),this.data.saveColsSettingTimer=window.setTimeout(()=>{this.saveColsSetting(),this.data.saveColsSettingTimer=0},200)},getColsSetting(){const{colOrders:i,colsSizes:e,colBorders:t,colVisibility:n}=this.state,s={},r=(o,a)=>{const l=s[o];l?Object.assign(l,a):s[o]={id:o,...a}};return i&&Object.keys(i).forEach(o=>{r(o,{order:i[o]})}),e&&Object.keys(e).forEach(o=>{r(o,{extraWidth:e[o]})}),t&&Object.keys(t).forEach(o=>{r(o,{border:t[o]})}),n&&Object.keys(n).forEach(o=>{r(o,{show:n[o]})}),Object.values(s)},async saveColsSetting(){const i=this.getColsSetting();if(!i.length)return;const{saveFieldsUrl:e}=this.options.customCols||{};if(!e)return;const t=JSON.stringify(i);t!==this.data.lastSavedColsSetting&&(this.data.lastSavedColsSetting=t,await y.post(e,{fields:t}))}},onRenderCell(i,{row:e,col:t,value:n}){const{iconRender:s}=t.setting;if(s&&t.type!=="icon"){const r=Dm(s,n,e);r&&i.push(r)}return i},onRender(){const{customCols:i}=this.options;if(!i)return;const{custom:e,setGlobal:t,reset:n,resetGlobal:s}=i;return{children:b("div",{className:"absolute gap-1.5 pr-1.5 top-0 right-0 z-20 row items-center",style:"background:var(--dtable-header-bg);height: calc(var(--dtable-header-height) - 2px)"},b("div",{className:"w-px border-l h-5"}),b("a",{className:"btn ghost square size-sm rounded","data-toggle":"dropdown","data-placement":"bottom-end"},b("i",{class:"icon icon-cog-outline"})),b("menu",{class:"dropdown-menu menu"},e&&b("li",{class:"menu-item"},b("a",{href:e.url,"data-toggle":"modal"},e.text)),t&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:t.url},t.text)),n&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:n.url},n.text)),s&&b("li",{class:"menu-item"},b("a",{class:"ajax-submit",href:s.url},s.text))))}},onUpdated(){const{updateCheckedRows:i}=this.options;i&&i!==this.data.updateCheckedRows&&(this.data.updateCheckedRows=i,this.toggleCheckRows(i,!0))}},_w=qe(Im,{buildIn:!0}),Ek="",fr=i=>`${i.col.name}[${i.row.id}]`,pr=(i,e,t,n="value")=>{const s=fr(e),r=i.data.formData[s]??e.value;return{[n]:r,className:"form-control",onChange:o=>i.setFormData(s,o instanceof Event?o.currentTarget.value:o),...t}};function Eh(i){const e=fr(i);let t=this.data.pickRefs.get(e);return t||(t=de(),this.data.pickRefs.set(e,t)),pr(this,i,{ref:t},"defaultValue")}const bw={input:{component:"input",props(i){return pr(this,i,{type:"text"})}},select:{component:function(i){const{items:e,defaultValue:t,...n}=i;return b("select",{...n},e.map(s=>b("option",{key:s.value,value:s.value},s.text)))},props(i){return pr(this,i)}},picker:{component:Gt,props:Eh},datePicker:{component:Qi,props(i){return pr(this,i,{className:"flex-auto",icon:"calendar"},"defaultValue")}},timePicker:{component:Ao,props(i){return pr(this,i,{className:"flex-auto",icon:"time"},"defaultValue")}},priPicker:{component:or,props:Eh},severityPicker:{component:fh,props:Eh}},ww=qe({name:"form",plugins:[nm],data(){return{formData:{},pickRefs:new Map}},colTypes:{control:{custom(i){let{control:e}=i.col.setting;if(typeof e=="function"&&(e=e.call(this,i)),!e)return;typeof e=="string"&&(e={type:e});const{controlMap:t}=this.options,{type:n}=e,s={name:fr(i)};let r;if([bw[n],t==null?void 0:t[n],e].forEach(o=>{if(o){const{props:a}=o;a&&y.extend(s,typeof a=="function"?a.call(this,i):a),r=o.component||r}}),!!r)return{component:r,props:s}}}},methods:{setFormData(i,e,t){var r,o;const{formData:n}=this.data;n[i]=e,t||(r=this.options.onFormChange)==null||r.call(this,i,e,n);const s=this.data.pickRefs.get(i);s&&((o=s.current)==null||o.setValue(e))},getFormData(i=!0){let{formData:e}=this.data;if(!i)return e;const{rows:t,cols:n}=this.layout,s=t.reduce((r,o)=>(n.list.forEach(a=>{var l;a.setting.control&&(r[fr({col:a,row:o})]=(l=o.data)==null?void 0:l[a.name])}),r),{});return e=y.extend(s,e),i===!0?e:e[i]},resetFormData(){this.data.formData={};const{rows:i,cols:e}=this.layout;i.forEach(t=>{e.list.forEach(n=>{var r,o;if(!n.setting.control)return;const s=this.data.pickRefs.get(fr({col:n,row:t}));s&&((o=s.current)==null||o.setValue(((r=t.data)==null?void 0:r[n.name])??""))})})}}}),Pk="",Lk="",Rk="",Ok="",zk="",Fk="",jk="",Bk="",Hk="",Wk="",Uk="",Vk="",Kk="",qk="",Gk="",Yk="";var Nm=11;function Cw(i,e){var t=e.attributes,n,s,r,o,a;if(!(e.nodeType===Nm||i.nodeType===Nm)){for(var l=t.length-1;l>=0;l--)n=t[l],s=n.name,r=n.namespaceURI,o=n.value,r?(s=n.localName||s,a=i.getAttributeNS(r,s),a!==o&&(n.prefix==="xmlns"&&(s=n.name),i.setAttributeNS(r,s,o))):(a=i.getAttribute(s),a!==o&&i.setAttribute(s,o));for(var c=i.attributes,d=c.length-1;d>=0;d--)n=c[d],s=n.name,r=n.namespaceURI,r?(s=n.localName||s,e.hasAttributeNS(r,s)||i.removeAttributeNS(r,s)):e.hasAttribute(s)||i.removeAttribute(s)}}var va,xw="http://www.w3.org/1999/xhtml",$t=typeof document>"u"?void 0:document,kw=!!$t&&"content"in $t.createElement("template"),Sw=!!$t&&$t.createRange&&"createContextualFragment"in $t.createRange();function Tw(i){var e=$t.createElement("template");return e.innerHTML=i,e.content.childNodes[0]}function $w(i){va||(va=$t.createRange(),va.selectNode($t.body));var e=va.createContextualFragment(i);return e.childNodes[0]}function Dw(i){var e=$t.createElement("body");return e.innerHTML=i,e.childNodes[0]}function Iw(i){return i=i.trim(),kw?Tw(i):Sw?$w(i):Dw(i)}function _a(i,e){var t=i.nodeName,n=e.nodeName,s,r;return t===n?!0:(s=t.charCodeAt(0),r=n.charCodeAt(0),s<=90&&r>=97?t===n.toUpperCase():r<=90&&s>=97?n===t.toUpperCase():!1)}function Nw(i,e){return!e||e===xw?$t.createElement(i):$t.createElementNS(e,i)}function Mw(i,e){for(var t=i.firstChild;t;){var n=t.nextSibling;e.appendChild(t),t=n}return e}function Ah(i,e,t){i[t]!==e[t]&&(i[t]=e[t],i[t]?i.setAttribute(t,""):i.removeAttribute(t))}var Mm={OPTION:function(i,e){var t=i.parentNode;if(t){var n=t.nodeName.toUpperCase();n==="OPTGROUP"&&(t=t.parentNode,n=t&&t.nodeName.toUpperCase()),n==="SELECT"&&!t.hasAttribute("multiple")&&(i.hasAttribute("selected")&&!e.selected&&(i.setAttribute("selected","selected"),i.removeAttribute("selected")),t.selectedIndex=-1)}Ah(i,e,"selected")},INPUT:function(i,e){Ah(i,e,"checked"),Ah(i,e,"disabled"),i.value!==e.value&&(i.value=e.value),e.hasAttribute("value")||i.removeAttribute("value")},TEXTAREA:function(i,e){var t=e.value;i.value!==t&&(i.value=t);var n=i.firstChild;if(n){var s=n.nodeValue;if(s==t||!t&&s==i.placeholder)return;n.nodeValue=t}},SELECT:function(i,e){if(!e.hasAttribute("multiple")){for(var t=-1,n=0,s=i.firstChild,r,o;s;)if(o=s.nodeName&&s.nodeName.toUpperCase(),o==="OPTGROUP")r=s,s=r.firstChild;else{if(o==="OPTION"){if(s.hasAttribute("selected")){t=n;break}n++}s=s.nextSibling,!s&&r&&(s=r.nextSibling,r=null)}i.selectedIndex=t}}},mr=1,Em=11,Am=3,Pm=8;function Un(){}function Ew(i){if(i)return i.getAttribute&&i.getAttribute("id")||i.id}function Aw(i){return function(t,n,s){if(s||(s={}),typeof n=="string")if(t.nodeName==="#document"||t.nodeName==="HTML"||t.nodeName==="BODY"){var r=n;n=$t.createElement("html"),n.innerHTML=r}else n=Iw(n);else n.nodeType===Em&&(n=n.firstElementChild);var o=s.getNodeKey||Ew,a=s.onBeforeNodeAdded||Un,l=s.onNodeAdded||Un,c=s.onBeforeElUpdated||Un,d=s.onElUpdated||Un,u=s.onBeforeNodeDiscarded||Un,p=s.onNodeDiscarded||Un,g=s.onBeforeElChildrenUpdated||Un,_=s.skipFromChildren||Un,C=s.addChild||function(ce,Z){return ce.appendChild(Z)},x=s.childrenOnly===!0,k=Object.create(null),$=[];function E(ce){$.push(ce)}function z(ce,Z){if(ce.nodeType===mr)for(var Ce=ce.firstChild;Ce;){var _e=void 0;Z&&(_e=o(Ce))?E(_e):(p(Ce),Ce.firstChild&&z(Ce,Z)),Ce=Ce.nextSibling}}function H(ce,Z,Ce){u(ce)!==!1&&(Z&&Z.removeChild(ce),p(ce),z(ce,Ce))}function Y(ce){if(ce.nodeType===mr||ce.nodeType===Em)for(var Z=ce.firstChild;Z;){var Ce=o(Z);Ce&&(k[Ce]=Z),Y(Z),Z=Z.nextSibling}}Y(t);function G(ce){l(ce);for(var Z=ce.firstChild;Z;){var Ce=Z.nextSibling,_e=o(Z);if(_e){var Ee=k[_e];Ee&&_a(Z,Ee)?(Z.parentNode.replaceChild(Ee,Z),ee(Ee,Z)):G(Z)}else G(Z);Z=Ce}}function X(ce,Z,Ce){for(;Z;){var _e=Z.nextSibling;(Ce=o(Z))?E(Ce):H(Z,ce,!0),Z=_e}}function ee(ce,Z,Ce){var _e=o(Z);if(_e&&delete k[_e],!Ce){var Ee=c(ce,Z);if(Ee===!1||(Ee instanceof HTMLElement&&(ce=Ee),i(ce,Z),d(ce),g(ce,Z)===!1))return}ce.nodeName!=="TEXTAREA"?he(ce,Z):Mm.TEXTAREA(ce,Z)}function he(ce,Z){var Ce=_(ce,Z),_e=Z.firstChild,Ee=ce.firstChild,qn,gt,kn,Sn,kt;e:for(;_e;){for(Sn=_e.nextSibling,qn=o(_e);!Ce&&Ee;){if(kn=Ee.nextSibling,_e.isSameNode&&_e.isSameNode(Ee)){_e=Sn,Ee=kn;continue e}gt=o(Ee);var Gn=Ee.nodeType,ln=void 0;if(Gn===_e.nodeType&&(Gn===mr?(qn?qn!==gt&&((kt=k[qn])?kn===kt?ln=!1:(ce.insertBefore(kt,Ee),gt?E(gt):H(Ee,ce,!0),Ee=kt,gt=o(Ee)):ln=!1):gt&&(ln=!1),ln=ln!==!1&&_a(Ee,_e),ln&&ee(Ee,_e)):(Gn===Am||Gn==Pm)&&(ln=!0,Ee.nodeValue!==_e.nodeValue&&(Ee.nodeValue=_e.nodeValue))),ln){_e=Sn,Ee=kn;continue e}gt?E(gt):H(Ee,ce,!0),Ee=kn}if(qn&&(kt=k[qn])&&_a(kt,_e))Ce||C(ce,kt),ee(kt,_e);else{var fe=a(_e);fe!==!1&&(fe&&(_e=fe),_e.actualize&&(_e=_e.actualize(ce.ownerDocument||$t)),C(ce,_e),G(_e))}_e=Sn,Ee=kn}X(ce,Ee,gt);var Cr=Mm[ce.nodeName];Cr&&Cr(ce,Z)}var J=t,se=J.nodeType,ge=n.nodeType;if(!x){if(se===mr)ge===mr?_a(t,n)||(p(t),J=Mw(t,Nw(n.nodeName,n.namespaceURI))):J=n;else if(se===Am||se===Pm){if(ge===se)return J.nodeValue!==n.nodeValue&&(J.nodeValue=n.nodeValue),J;J=n}}if(J===n)p(t);else{if(n.isSameNode&&n.isSameNode(J))return;if(ee(J,n,x),$)for(var we=0,Me=$.length;we{const{name:$,value:E}=k;$==="class"?C.addClass(E):p.getAttribute($)!==E&&(($==="zui-create"||$.startsWith("zui-create-"))&&(x=!1),p.setAttribute($,E))}),x&&u.add(p)}return!1}return!0},onBeforeElChildrenUpdated(p,g){const _=l==null?void 0:l(p,g);return _!==void 0?_:p.classList.contains("no-morph")?!1:!p.tagName.includes("-")},onElUpdated(p){if(o==null||o(p),p.tagName!=="SCRIPT"){p.hasAttribute(s)&&p.removeAttribute(s);const g=ks(p);Object.values(g).forEach(_=>{if(_ instanceof Fe){const{ATTR_KEY:C,DATA_KEY:x}=_.constructor;p.setAttribute(C,""),p.setAttribute(x,`${_.gid}`)}})}}}),n.zuiInit({update:"reset",beforeCreate:p=>!u.has(p)}),u.forEach(p=>{y(p).trigger("skipMorph")}),c&&n.find("script:not(.zui-js-run)").each((p,g)=>{const _=g.textContent;_&&n.runJS(_)})}y.fn.morph=function(i,e){return this.each((t,n)=>{Ph(n,i,e)})},y.fn.morphInner=function(i,e){return this.each((t,n)=>{Ph(n,i,{...e,childrenOnly:!0})})};function Lh(i){const e=y(i);e.css({minHeight:0}).css({minHeight:Math.max(32,e[0].scrollHeight)})}y.fn.autoHeight=function(){return this.each(function(){const i=y(this);i.data("auto-height")||i.on("input paste change",function(){Lh(this)}).data("auto-height",!0),Lh(i),setTimeout(()=>Lh(i),100)})},y.fn._append=y.fn.append,y.fn._prepend=y.fn.prepend,y.fn._before=y.fn.before,y.fn._after=y.fn.after,y.fn._html=y.fn.html;function ba(i,e){return typeof e=="string"&&(e.includes("zui-create")||e.includes("zui-init"))&&i.zuiInit(),i}function Lw(i){return!!i&&i.nodeType===1}y.extend(y.fn,{append(...i){return ba(this._append(...i),i.join(""))},prepend(...i){return ba(this._prepend(...i),i.join(""))},before(...i){const e=this.parent();return this._before(...i),ba(e,i.join("")),this},after(...i){const e=this.parent();return this._after(...i),ba(e,i.join("")),this},html(i,e){if(!arguments.length)return this[0]&&this[0].innerHTML;if(i===void 0)return this;const t=/]/.test(i);return typeof e=="boolean"&&(e={zuiInit:e}),this.each((n,s)=>{Lw(s)&&(t?y(s).empty()._append(i):s.innerHTML=i,(e==null?void 0:e.zuiInit)!==!1&&y(s).zuiInit())})}});const Rw=Object.freeze(Object.defineProperty({__proto__:null,createLink:Rt,parseLink:dp,parseUrlParams:up},Symbol.toStringTag,{value:"Module"}));window.$&&Object.assign(window.$,{...Rw,parseRawData:yl}),I.$=y,I.Ajax=xs,I.AjaxForm=ha,I.Avatar=nc,I.BUILD=1736927705512,I.BUILD_MODE=Tg,I.BatchForm=P_,I.BtnGroup=ic,I.Burn=Fc,I.Bus=md,I.Card=fa,I.CardList=vh,I.ColorPicker=Eo,I.CommonList=Ps,I.Component=Fe,I.ComponentFromReact=ye,I.Computed=ri,I.ContextMenu=hs,I.Custom=fo,I.CustomContent=me,I.CustomContentClass=Jd,I.CustomRender=Kl,I.DTable=us,I.Dashboard=bh,I.DataHub=hf,I.DatePicker=Lo,I.DatetimePicker=Ro,I.Dexie=Ws,I.DocApp=sr,I.Draggable=js,I.Dropdown=on,I.Dropmenu=lh,I.ECharts=Ip,I.Editor=an,I.Entity=Av,I.FileList=ch,I.FileSelector=Bo,I.FormGrid=Ap,I.FormSetting=Ep,I.Gantt=Pp,I.GlobalSearch=ua,I.Graph=Op,I.HElement=He,I.HElementSignals=Vl,I.HistoryPanel=rr,I.HtmlContent=vn,I.Icon=Ie,I.ImageSelector=Ho,I.ImgCutter=dh,I.Kanban=hr,I.KanbanList=ur,I.List=Rs,I.Mammoth=_b,I.Menu=mo,I.Messager=Rn,I.Modal=We,I.ModalBase=Xi,I.ModalTrigger=es,I.Moveable=Bs,I.Nav=Dc,I.NestedList=Os,I.PageEditor=la,I.Pager=Ic,I.Pick=Ko,I.Picker=qo,I.Popover=Pt,I.PopoverPanel=Wo,I.Portal=ql,I.PriPicker=ph,I.ProgressCircle=_o,I.PropModSymbol=Pv,I.PropModification=Lv,I.RangeSet=Mv,I.ReactComponent=pe,I.SearchBox=Go,I.SearchForm=Bt,I.SearchMenu=go,I.SearchTree=Pc,I.SeverityPicker=mh,I.Sidebar=Qo,I.Signal=ot,I.Sortable=bo,I.SortableList=wo,I.SortableTree=Co,I.Sticky=no,I.TIME_DAY=Ri,I.Tabs=dr,I.TimePicker=Po,I.Toolbar=Ac,I.Tooltip=is,I.Tree=Jo,I.Upload=Xo,I.UploadImgs=Lc,I.UserAvatar=da,I.VERSION=Sg,I.Zinbar=yh,I.addDate=Cd,I.addQueryToSearchForm=Hp,I.ajaxSubmit=vi,I.batch=Ms,I.bindCommands=so,I.bindHotkeys=Il,I.bus=Zt,I.cash=y,I.classes=V,I.clearData=yy,I.cmp=Ev,I.computed=Be,I.convertBytes=mn,I.cookie=rf,I.create=eo,I.createDate=je,I.createFormData=Ur,I.createPortal=Zd,I.createRef=de,I.deepCall=Mn,I.deepGet=Cs,I.deepGetPath=Yu,I.defineFn=Ay,I.delay=ai,I.disableScroll=fd,I.dom=Gy,I.downloadFile=Ts,I.effect=en,I.enterFullscreen=_d,I.evalValue=oi,I.executeCommand=Ol,I.executeCommands=kd,I.fetchData=mt,I.form=ww,I.formatBytes=pt,I.formatDate=rt,I.formatDateSpan=Hy,I.formatString=be,I.getClassList=gl,I.getComponent=$s,I.getFullscreenElement=Zr,I.getHotkeysMap=Dl,I.getReactComponent=Yd,I.getUniqueCode=Rl,I.getZData=Pi,I.h=b,I.hotkeys=My,I.i18n=Ne,I.init=Al,I.initGlobalComponents=El,I.isDiff=Vr,I.isFetchSetting=ml,I.isSameDay=Pn,I.isSameMonth=Pl,I.isSameWeek=zy,I.isSameYear=Ds,I.isToday=Fy,I.isTomorrow=By,I.isValidDate=Ll,I.isYesterday=jy,I.jsRaw=vy,I.liveQuery=Dv,I.mapFormData=Mp,I.mergeProps=xe,I.mergeRanges=Iv,I.morph=Ph,I.nextGid=wt,I.parseCommand=io,I.parseCommands=xd,I.parseRawData=yl,I.parseSize=hi,I.processSubmitResult=hh,I.rangesOverlap=Nv,I.reactComponents=Ul,I.readFile=Ky,I.registerComponent=bd,I.registerGlobalListener=pd,I.registerReactComponent=Ze,I.removeUndefinedProps=Sl,I.render=ci,I.renderCustomContent=uo,I.renderCustomResult=Qd,I.replacePrefix=Rv,I.runJS=Is,I.selectFile=Vy,I.setZData=vl,I.shareData=Zu,I.showCommentModal=uh,I.signal=Qe,I.store=Ye,I.storeData=Kr,I.takeData=ks,I.toCssSize=Ve,I.toggleFullscreen=Ml,I.toggleSearchForm=gh,I.uid=ss,I.unbindCommands=ro,I.unbindHotkeys=Nl,I.untracked=ev,I.updateSearchForm=Bp,I.zentao=_w,I.zentaoPlugin=Im,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})});