@gkd-kit/inspect 0.0.1740544362883 → 0.0.1740648815776
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-Ccgv5roI.js → ActionCard.vue_vue_type_script_setup_true_lang-Co-G9gZf.js} +2 -2
- package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-Ccgv5roI.js.map → ActionCard.vue_vue_type_script_setup_true_lang-Co-G9gZf.js.map} +1 -1
- package/dist/assets/{DevicePage-DKTBsFZZ.js → DevicePage-DXVg3LyJ.js} +2 -2
- package/dist/assets/{DevicePage-DKTBsFZZ.js.map → DevicePage-DXVg3LyJ.js.map} +1 -1
- package/dist/assets/{HomePage-C2kldyWC.js → HomePage-DiecouGG.js} +2 -2
- package/dist/assets/{HomePage-C2kldyWC.js.map → HomePage-DiecouGG.js.map} +1 -1
- package/dist/assets/{ImportPage-D4bRHBJI.js → ImportPage-CvSRDwhA.js} +2 -2
- package/dist/assets/{ImportPage-D4bRHBJI.js.map → ImportPage-CvSRDwhA.js.map} +1 -1
- package/dist/assets/{Input-BFKXTRdu.js → Input-9Xjd_8V6.js} +2 -2
- package/dist/assets/{Input-BFKXTRdu.js.map → Input-9Xjd_8V6.js.map} +1 -1
- package/dist/assets/SelectorPage-Dd-TFi8p.js +2 -0
- package/dist/assets/SelectorPage-Dd-TFi8p.js.map +1 -0
- package/dist/assets/{SnapshotPage-KPOEsvbW.js → SnapshotPage-DFmbkz-G.js} +10 -10
- package/dist/assets/{SnapshotPage-KPOEsvbW.js.map → SnapshotPage-DFmbkz-G.js.map} +1 -1
- package/dist/assets/{SvgPage-CzhnEJ-r.js → SvgPage-CUCH_yx9.js} +2 -2
- package/dist/assets/{SvgPage-CzhnEJ-r.js.map → SvgPage-CUCH_yx9.js.map} +1 -1
- package/dist/assets/{_404Page-Dy4SZGAS.js → _404Page-Dvm3LxV0.js} +2 -2
- package/dist/assets/{_404Page-Dy4SZGAS.js.map → _404Page-Dvm3LxV0.js.map} +1 -1
- package/dist/assets/chunk-BePjtIQl.js +3 -0
- package/dist/assets/{chunk-CVsGgHoi.js.map → chunk-BePjtIQl.js.map} +1 -1
- package/dist/assets/{dayjs.min-CdkzTcDU.js → dayjs.min-03zMqosd.js} +2 -2
- package/dist/assets/{dayjs.min-CdkzTcDU.js.map → dayjs.min-03zMqosd.js.map} +1 -1
- package/dist/assets/{error-CF7TTEeU.js → error-DlJzBwXC.js} +2 -2
- package/dist/assets/{error-CF7TTEeU.js.map → error-DlJzBwXC.js.map} +1 -1
- package/dist/assets/{import-BfOZ2HnX.js → import-BOmWE02u.js} +2 -2
- package/dist/assets/{import-BfOZ2HnX.js.map → import-BOmWE02u.js.map} +1 -1
- package/dist/assets/index-DjBfBJ3W.js +10 -0
- package/dist/assets/index-DjBfBJ3W.js.map +1 -0
- package/dist/assets/{index-DkVQX4Ub.js → index-DpGfQGGj.js} +51 -51
- package/dist/assets/{index-DkVQX4Ub.js.map → index-DpGfQGGj.js.map} +1 -1
- package/dist/assets/{index-BJdevrw_.css → index-dEdDuXZT.css} +1 -1
- package/dist/assets/{jszip.min-BN84A9eB.js → jszip.min-CjJPie7k.js} +2 -2
- package/dist/assets/{jszip.min-BN84A9eB.js.map → jszip.min-CjJPie7k.js.map} +1 -1
- package/dist/assets/{node-DJCu8s7C.js → node-UmLjKESN.js} +2 -2
- package/dist/assets/{node-DJCu8s7C.js.map → node-UmLjKESN.js.map} +1 -1
- package/dist/assets/{snapshot-CIRHwPKX.js → snapshot-BV3vRh6q.js} +2 -2
- package/dist/assets/{snapshot-CIRHwPKX.js.map → snapshot-BV3vRh6q.js.map} +1 -1
- package/dist/assets/{table-CpkC-fh7.js → table-D95BKlUD.js} +2 -2
- package/dist/assets/{table-CpkC-fh7.js.map → table-D95BKlUD.js.map} +1 -1
- package/dist/index.html +3 -3
- package/package.json +1 -1
- package/dist/assets/SelectorPage-BP09Pm4S.js +0 -2
- package/dist/assets/SelectorPage-BP09Pm4S.js.map +0 -1
- package/dist/assets/chunk-CVsGgHoi.js +0 -3
- package/dist/assets/index-BzKmOIqs.js +0 -10
- package/dist/assets/index-BzKmOIqs.js.map +0 -1
- /package/dist/assets/{SelectorPage-CdMJYWIX.css → index-CdMJYWIX.css} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{S as B,A as C,a as z,_ as L,d as f}from"./index-DjBfBJ3W.js";import{h as V,bI as q,bJ as E,aA as F,aB as D,A as H,aL as J,q as p,G as M,H as h,I as a,J as r,K as s,F as i,L as c,S as U,Q as G,M as d,U as K,O as t,ax as O,T as x,R as P}from"./index-DpGfQGGj.js";import{N as Q,b as W}from"./node-UmLjKESN.js";import{_ as $}from"./Input-9Xjd_8V6.js";const j={flex:"","items-center":"","gap-16px":"","pt-12px":"","px-12px":""},X={flex:"","flex-col":"","items-center":"","p-8px":"",text:"40px/52px"},Y={key:0,"overflow-x-scroll":"","scrollbar-hidden":""},Z={key:1,"whitespace-pre-wrap":""},ee={key:0},te={"bg-red":"",relative:""},oe={key:0},ne={key:1,"pl-20px":""},se={absolute:"","left-0":"","right-0":"","top--12px":"",flex:"","flex-col":"","items-center":"","animate-bounce":"","pointer-events-none":""},ae={key:1},re={key:0,"p-4px":"","bg-red-300":"",gkd_code:""},de=V({__name:"SelectorPage",setup(ie){q(),E();const k=F(),y=D(),T=()=>{const e=String(k.query.gkd||"");if(!e)return e;try{return f.decode(e)}catch{return m(""),""}},m=e=>{y.replace({query:{gkd:e?f.encode(e):void 0}})},u=H(T()),b=J(u,500),l=p(()=>(u.value&&b.value).trim());M(l,()=>{m(l.value)});const _=p(()=>{if(l.value)try{return B.Companion.parseAst(l.value)}catch(e){return e}}),g=p(()=>{if(_.value instanceof C)return _.value}),n=p(()=>{const e=_.value,o=l.value;if(e instanceof z)return{headText:o.substring(0,e.index),errorText:o.substring(e.index,e.index+1),tailText:o.substring(e.index+1),message:e.outMessage}});return(e,o)=>{const v=h("SvgIcon"),N=Q,R=h("RouterLink"),w=G,S=W,A=$;return r(),a(P,null,[s("div",j,[i(S,{placement:"right"},{trigger:c(()=>[i(w,{text:""},{icon:c(()=>[i(R,{to:"/",color:"inherit"},{default:c(()=>[i(N,{size:"24"},{default:c(()=>[i(v,{name:"home"})]),_:1})]),_:1})]),_:1})]),default:c(()=>[o[1]||(o[1]=U(" 回到首页 "))]),_:1}),o[2]||(o[2]=s("div",{flex:"","gap-16px":""},[s("div",{"text-18px":""},"测试选择器"),s("div",null,"语法高亮/错误解析")],-1))]),s("div",X,[i(A,{value:t(u),"onUpdate:value":o[0]||(o[0]=I=>K(u)?u.value=I:null),type:"textarea",placeholder:"请输入选择器",class:"gkd_code py-4px",style:{"--n-font-size":"20px","--n-line-height-textarea":"28px"},autosize:{minRows:3,maxRows:8}},null,8,["value"]),o[3]||(o[3]=s("div",{"h-20px":""},null,-1)),s("div",{"max-w-full":"","mb-8px":"","p-4px":"",gkd_code:"","transition-colors":"",class:O(t(n)?"bg-red-200":"bg-light-600")},[t(g)?(r(),a("div",Y,[i(L,{text:t(l),node:t(g)},null,8,["text","node"])])):t(n)?(r(),a("span",Z,[t(n).headText?(r(),a("span",ee,x(t(n).headText),1)):d("",!0),s("span",te,[t(n).errorText?(r(),a("span",oe,x(t(n).errorText),1)):(r(),a("span",ne)),s("div",se,[i(v,{name:"arrow",class:"text-18px color-dark"})])]),t(n).tailText?(r(),a("span",ae,x(t(n).tailText),1)):d("",!0)])):d("",!0)],2),t(n)?(r(),a("div",re,x(t(n).message),1)):d("",!0)])],64)}}});export{de as default};
|
|
2
|
+
//# sourceMappingURL=SelectorPage-Dd-TFi8p.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectorPage-Dd-TFi8p.js","sources":["../../src/views/SelectorPage.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SelectorText from '@/components/SelectorText.vue';\nimport { useAutoHeight, useAutoWidth } from '@/utils/others';\nimport {\n AstNode,\n Selector,\n GkdException,\n SyntaxException,\n} from '@gkd-kit/selector';\nimport * as base64url from 'universal-base64url';\n\nuseAutoHeight();\nuseAutoWidth();\n\nconst route = useRoute();\nconst router = useRouter();\n\nconst getTextFromRoute = () => {\n const t = String(route.query.gkd || '');\n if (!t) return t;\n try {\n return base64url.decode(t);\n } catch (e) {\n setTextToRoute('');\n return '';\n }\n};\nconst setTextToRoute = (t: string) => {\n router.replace({ query: { gkd: t ? base64url.encode(t) : undefined } });\n};\n\nconst inputText = shallowRef(getTextFromRoute());\nconst lazyText = useDebounce(inputText, 500);\nconst text = computed(() => {\n return (inputText.value && lazyText.value).trim();\n});\nwatch(text, () => {\n setTextToRoute(text.value);\n});\nconst result = computed(() => {\n if (!text.value) return;\n try {\n return Selector.Companion.parseAst(text.value);\n } catch (e) {\n return e as GkdException;\n }\n});\n\nconst ast = computed(() => {\n if (result.value instanceof AstNode) {\n return result.value;\n }\n return undefined;\n});\n\nconst error = computed(() => {\n const e = result.value;\n const t = text.value;\n if (e instanceof SyntaxException) {\n return {\n headText: t.substring(0, e.index),\n errorText: t.substring(e.index, e.index + 1),\n tailText: t.substring(e.index + 1),\n message: e.outMessage,\n };\n }\n return undefined;\n});\n</script>\n<template>\n <div flex items-center gap-16px pt-12px px-12px>\n <NTooltip placement=\"right\">\n <template #trigger>\n <NButton text>\n <template #icon>\n <RouterLink to=\"/\" color=\"inherit\">\n <NIcon size=\"24\">\n <SvgIcon name=\"home\" />\n </NIcon>\n </RouterLink>\n </template>\n </NButton>\n </template>\n 回到首页\n </NTooltip>\n <div flex gap-16px>\n <div text-18px>测试选择器</div>\n <div>语法高亮/错误解析</div>\n </div>\n </div>\n <div flex flex-col items-center p-8px text=\"40px/52px\">\n <NInput\n v-model:value=\"inputText\"\n type=\"textarea\"\n placeholder=\"请输入选择器\"\n class=\"gkd_code py-4px\"\n style=\"--n-font-size: 20px; --n-line-height-textarea: 28px\"\n :autosize=\"{\n minRows: 3,\n maxRows: 8,\n }\"\n />\n <div h-20px></div>\n <div\n max-w-full\n mb-8px\n p-4px\n gkd_code\n transition-colors\n :class=\"error ? `bg-red-200` : `bg-light-600`\"\n >\n <div v-if=\"ast\" overflow-x-scroll scrollbar-hidden>\n <SelectorText :text=\"text\" :node=\"ast\" />\n </div>\n <span v-else-if=\"error\" whitespace-pre-wrap>\n <span v-if=\"error.headText\">{{ error.headText }}</span>\n <span bg-red relative>\n <span v-if=\"error.errorText\">{{ error.errorText }}</span>\n <span v-else pl-20px></span>\n <div\n absolute\n left-0\n right-0\n top--12px\n flex\n flex-col\n items-center\n animate-bounce\n pointer-events-none\n >\n <SvgIcon name=\"arrow\" class=\"text-18px color-dark\" />\n </div>\n </span>\n <span v-if=\"error.tailText\">{{ error.tailText }}</span>\n </span>\n </div>\n <div v-if=\"error\" p-4px bg-red-300 gkd_code>\n {{ error.message }}\n </div>\n </div>\n</template>\n"],"names":["useAutoHeight","useAutoWidth","route","useRoute","router","useRouter","getTextFromRoute","t","base64url.decode","setTextToRoute","base64url.encode","inputText","shallowRef","lazyText","useDebounce","text","computed","watch","result","Selector","ast","AstNode","error","SyntaxException"],"mappings":"44BAWcA,EAAA,EACDC,EAAA,EAEb,MAAMC,EAAQC,EAAS,EACjBC,EAASC,EAAU,EAEnBC,EAAmB,IAAM,CAC7B,MAAMC,EAAI,OAAOL,EAAM,MAAM,KAAO,EAAE,EAClC,GAAA,CAACK,EAAU,OAAAA,EACX,GAAA,CACK,OAAAC,EAAAA,OAAiBD,CAAC,OACf,CACV,OAAAE,EAAe,EAAE,EACV,EAAA,CAEX,EACMA,EAAkBF,GAAc,CACpCH,EAAO,QAAQ,CAAE,MAAO,CAAE,IAAKG,EAAIG,EAAAA,OAAiBH,CAAC,EAAI,MAAU,EAAG,CACxE,EAEMI,EAAYC,EAAWN,GAAkB,EACzCO,EAAWC,EAAYH,EAAW,GAAG,EACrCI,EAAOC,EAAS,KACZL,EAAU,OAASE,EAAS,OAAO,KAAK,CACjD,EACDI,EAAMF,EAAM,IAAM,CAChBN,EAAeM,EAAK,KAAK,CAAA,CAC1B,EACK,MAAAG,EAASF,EAAS,IAAM,CACxB,GAACD,EAAK,MACN,GAAA,CACF,OAAOI,EAAS,UAAU,SAASJ,EAAK,KAAK,QACtC,EAAG,CACH,OAAA,CAAA,CACT,CACD,EAEKK,EAAMJ,EAAS,IAAM,CACrB,GAAAE,EAAO,iBAAiBG,EAC1B,OAAOH,EAAO,KAET,CACR,EAEKI,EAAQN,EAAS,IAAM,CAC3B,MAAM,EAAIE,EAAO,MACXX,EAAIQ,EAAK,MACf,GAAI,aAAaQ,EACR,MAAA,CACL,SAAUhB,EAAE,UAAU,EAAG,EAAE,KAAK,EAChC,UAAWA,EAAE,UAAU,EAAE,MAAO,EAAE,MAAQ,CAAC,EAC3C,SAAUA,EAAE,UAAU,EAAE,MAAQ,CAAC,EACjC,QAAS,EAAE,UACb,CAEK,CACR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft,a0 as Ot,a1 as mo,d as Mt,a2 as zt,o as
|
|
1
|
+
import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft,a0 as Ot,a1 as mo,d as Mt,a2 as zt,o as ie,q as F,p as st,m as ze,x as Ht,a3 as Ut,y as se,a4 as kn,a5 as wn,a6 as Cn,a7 as bo,t as V,a8 as tn,a9 as yo,aa as xo,ab as ue,ac as Oe,ad as ko,ae as Sn,af as De,ag as wo,ah as Co,ai as So,c as No,aj as _o,ak as Ro,al as $o,s as Kt,V as Po,am as Et,N as Do,l as Io,an as Ko,B as Ct,ao as Eo,v as Nn,i as Lo,ap as Lt,aq as nn,ar as on,w as it,D as $e,G as Te,as as Je,A as Z,C as jt,at as kt,au as re,J as U,av as _n,I as de,M as ve,O as d,aw as Fe,ax as wt,ay as To,R as Ie,K,az as Fo,aA as Rn,aB as $n,z as Ao,aC as Pn,aD as rn,aE as Bo,aF as Wt,aG as Me,H as ot,L as S,F as R,Q as ht,aH as dt,aI as Re,T as W,S as J,aJ as zo,aK as Oo,aL as Mo,U as tt,aM as Ho,aN as Uo,P as jo,aO as Tt,aP as Le,aQ as ln,W as Wo,aR as an,aS as Ft,aT as sn}from"./index-DpGfQGGj.js";import{g as Ne,l as qo,f as Vo,a as Go,b as qt,N as Dn,c as ct,d as nt,e as dn,h as cn}from"./node-UmLjKESN.js";import{e as Yo,f as Qo,g as Xo,_ as Zo}from"./ActionCard.vue_vue_type_script_setup_true_lang-Co-G9gZf.js";import{a as Jo,b as er,g as tr}from"./snapshot-BV3vRh6q.js";import{h as et,C as nr,e as or,V as rr,c as un,f as fn,b as lr,N as hn,u as ir,d as ar,a as In,g as Kn,i as sr,j as dr,_ as cr}from"./dayjs.min-03zMqosd.js";import{p as xt,w as ur,d as gn,_ as fr,F as At,G as hr}from"./index-DjBfBJ3W.js";import{l as En,e as vn,a as gr}from"./error-DlJzBwXC.js";import{_ as Ln}from"./Input-9Xjd_8V6.js";import"./chunk-BePjtIQl.js";function Tn(e){return typeof e=="string"?`s-${e}`:`n-${e}`}const vr=Q({name:"ChevronLeft",render(){return I("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I("path",{d:"M10.3536 3.14645C10.5488 3.34171 10.5488 3.65829 10.3536 3.85355L6.20711 8L10.3536 12.1464C10.5488 12.3417 10.5488 12.6583 10.3536 12.8536C10.1583 13.0488 9.84171 13.0488 9.64645 12.8536L5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L9.64645 3.14645C9.84171 2.95118 10.1583 2.95118 10.3536 3.14645Z",fill:"currentColor"}))}}),pr=Q({name:"Switcher",render(){return I("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},I("path",{d:"M12 8l10 8l-10 8z"}))}}),oe="0!important",Fn="-1px!important";function Xe(e){return H(`${e}-type`,[O("& +",[M("button",{},[H(`${e}-type`,[X("border",{borderLeftWidth:oe}),X("state-border",{left:Fn})])])])])}function Ze(e){return H(`${e}-type`,[O("& +",[M("button",[H(`${e}-type`,[X("border",{borderTopWidth:oe}),X("state-border",{top:Fn})])])])])}const mr=M("button-group",`
|
|
2
2
|
flex-wrap: nowrap;
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
position: relative;
|
|
@@ -29,7 +29,7 @@ import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft
|
|
|
29
29
|
`),O("&:not(:first-child):not(:last-child)",`
|
|
30
30
|
margin: ${oe};
|
|
31
31
|
border-radius: ${oe};
|
|
32
|
-
`),Ze("default"),H("ghost",[Ze("primary"),Ze("info"),Ze("success"),Ze("warning"),Ze("error")])])])]),
|
|
32
|
+
`),Ze("default"),H("ghost",[Ze("primary"),Ze("info"),Ze("success"),Ze("warning"),Ze("error")])])])]),br={size:{type:String,default:void 0},vertical:Boolean},yr=Q({name:"ButtonGroup",props:br,setup(e){const{mergedClsPrefixRef:t,mergedRtlRef:s}=ut(e);return po("-button-group",mr,t),Ot(mo,e),{rtlEnabled:ft("ButtonGroup",s,t),mergedClsPrefix:t}},render(){const{mergedClsPrefix:e}=this;return I("div",{class:[`${e}-button-group`,this.rtlEnabled&&`${e}-button-group--rtl`,this.vertical&&`${e}-button-group--vertical`],role:"group"},this.$slots)}});function xr(e){const{fontWeight:t,textColor1:s,textColor2:o,textColorDisabled:a,dividerColor:r,fontSize:u}=e;return{titleFontSize:u,titleFontWeight:t,dividerColor:r,titleTextColor:s,titleTextColorDisabled:a,fontSize:u,textColor:o,arrowColor:o,arrowColorDisabled:a,itemMargin:"16px 0 0 0",titlePadding:"16px 0 0 0"}}const kr={common:Mt,self:xr},wr=M("collapse","width: 100%;",[M("collapse-item",`
|
|
33
33
|
font-size: var(--n-font-size);
|
|
34
34
|
color: var(--n-text-color);
|
|
35
35
|
transition:
|
|
@@ -69,7 +69,7 @@ import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft
|
|
|
69
69
|
color .3s var(--n-bezier);
|
|
70
70
|
font-size: 18px;
|
|
71
71
|
color: var(--n-arrow-color);
|
|
72
|
-
`)])])]),
|
|
72
|
+
`)])])]),Cr=Object.assign(Object.assign({},ze.props),{defaultExpandedNames:{type:[Array,String],default:null},expandedNames:[Array,String],arrowPlacement:{type:String,default:"left"},accordion:{type:Boolean,default:!1},displayDirective:{type:String,default:"if"},triggerAreas:{type:Array,default:()=>["main","extra","arrow"]},onItemHeaderClick:[Function,Array],"onUpdate:expandedNames":[Function,Array],onUpdateExpandedNames:[Function,Array],onExpandedNamesChange:{type:[Function,Array],validator:()=>!0,default:void 0}}),An=Ut("n-collapse"),Sr=Q({name:"Collapse",props:Cr,slots:Object,setup(e,{slots:t}){const{mergedClsPrefixRef:s,inlineThemeDisabled:o,mergedRtlRef:a}=ut(e),r=ie(e.defaultExpandedNames),u=F(()=>e.expandedNames),l=st(u,r),g=ze("Collapse","-collapse",wr,kr,e,s);function x(k){const{"onUpdate:expandedNames":p,onUpdateExpandedNames:C,onExpandedNamesChange:N}=e;C&&se(C,k),p&&se(p,k),N&&se(N,k),r.value=k}function c(k){const{onItemHeaderClick:p}=e;p&&se(p,k)}function w(k,p,C){const{accordion:N}=e,{value:$}=l;if(N)k?(x([p]),c({name:p,expanded:!0,event:C})):(x([]),c({name:p,expanded:!1,event:C}));else if(!Array.isArray($))x([p]),c({name:p,expanded:!0,event:C});else{const v=$.slice(),i=v.findIndex(m=>p===m);~i?(v.splice(i,1),x(v),c({name:p,expanded:!1,event:C})):(v.push(p),x(v),c({name:p,expanded:!0,event:C}))}}Ot(An,{props:e,mergedClsPrefixRef:s,expandedNamesRef:l,slots:t,toggleItem:w});const f=ft("Collapse",a,s),P=F(()=>{const{common:{cubicBezierEaseInOut:k},self:{titleFontWeight:p,dividerColor:C,titlePadding:N,titleTextColor:$,titleTextColorDisabled:v,textColor:i,arrowColor:m,fontSize:_,titleFontSize:h,arrowColorDisabled:z,itemMargin:B}}=g.value;return{"--n-font-size":_,"--n-bezier":k,"--n-text-color":i,"--n-divider-color":C,"--n-title-padding":N,"--n-title-font-size":h,"--n-title-text-color":$,"--n-title-text-color-disabled":v,"--n-title-font-weight":p,"--n-arrow-color":m,"--n-arrow-color-disabled":z,"--n-item-margin":B}}),y=o?Ht("collapse",void 0,P,e):void 0;return{rtlEnabled:f,mergedTheme:g,mergedClsPrefix:s,cssVars:o?void 0:P,themeClass:y==null?void 0:y.themeClass,onRender:y==null?void 0:y.onRender}},render(){var e;return(e=this.onRender)===null||e===void 0||e.call(this),I("div",{class:[`${this.mergedClsPrefix}-collapse`,this.rtlEnabled&&`${this.mergedClsPrefix}-collapse--rtl`,this.themeClass],style:this.cssVars},this.$slots)}}),Nr=Q({name:"CollapseItemContent",props:{displayDirective:{type:String,required:!0},show:Boolean,clsPrefix:{type:String,required:!0}},setup(e){return{onceTrue:bo(V(e,"show"))}},render(){return I(kn,null,{default:()=>{const{show:e,displayDirective:t,onceTrue:s,clsPrefix:o}=this,a=t==="show"&&s,r=I("div",{class:`${o}-collapse-item__content-wrapper`},I("div",{class:`${o}-collapse-item__content-inner`},this.$slots));return a?wn(r,[[Cn,e]]):e?r:null}})}}),_r={title:String,name:[String,Number],disabled:Boolean,displayDirective:String},Rr=Q({name:"CollapseItem",props:_r,setup(e){const{mergedRtlRef:t}=ut(e),s=xo(),o=ue(()=>{var w;return(w=e.name)!==null&&w!==void 0?w:s}),a=Oe(An);a||ko("collapse-item","`n-collapse-item` must be placed inside `n-collapse`.");const{expandedNamesRef:r,props:u,mergedClsPrefixRef:l,slots:g}=a,x=F(()=>{const{value:w}=r;if(Array.isArray(w)){const{value:f}=o;return!~w.findIndex(P=>P===f)}else if(w){const{value:f}=o;return f!==w}return!0});return{rtlEnabled:ft("Collapse",t,l),collapseSlots:g,randomName:s,mergedClsPrefix:l,collapsed:x,triggerAreas:V(u,"triggerAreas"),mergedDisplayDirective:F(()=>{const{displayDirective:w}=e;return w||u.displayDirective}),arrowPlacement:F(()=>u.arrowPlacement),handleClick(w){let f="main";et(w,"arrow")&&(f="arrow"),et(w,"extra")&&(f="extra"),u.triggerAreas.includes(f)&&a&&!e.disabled&&a.toggleItem(x.value,o.value,w)}}},render(){const{collapseSlots:e,$slots:t,arrowPlacement:s,collapsed:o,mergedDisplayDirective:a,mergedClsPrefix:r,disabled:u,triggerAreas:l}=this,g=tn(t.header,{collapsed:o},()=>[this.title]),x=t["header-extra"]||e["header-extra"],c=t.arrow||e.arrow;return I("div",{class:[`${r}-collapse-item`,`${r}-collapse-item--${s}-arrow-placement`,u&&`${r}-collapse-item--disabled`,!o&&`${r}-collapse-item--active`,l.map(w=>`${r}-collapse-item--trigger-area-${w}`)]},I("div",{class:[`${r}-collapse-item__header`,!o&&`${r}-collapse-item__header--active`]},I("div",{class:`${r}-collapse-item__header-main`,onClick:this.handleClick},s==="right"&&g,I("div",{class:`${r}-collapse-item-arrow`,key:this.rtlEnabled?0:1,"data-arrow":!0},tn(c,{collapsed:o},()=>[I(Sn,{clsPrefix:r},{default:()=>this.rtlEnabled?I(vr,null):I(nr,null)})])),s==="left"&&g),yo(x,{collapsed:o},w=>I("div",{class:`${r}-collapse-item__header-extra`,onClick:this.handleClick,"data-extra":!0},w))),I(Nr,{clsPrefix:r,displayDirective:a,show:!o},t))}}),$r={thPaddingSmall:"6px",thPaddingMedium:"12px",thPaddingLarge:"12px",tdPaddingSmall:"6px",tdPaddingMedium:"12px",tdPaddingLarge:"12px"};function Pr(e){const{dividerColor:t,cardColor:s,modalColor:o,popoverColor:a,tableHeaderColor:r,tableColorStriped:u,textColor1:l,textColor2:g,borderRadius:x,fontWeightStrong:c,lineHeight:w,fontSizeSmall:f,fontSizeMedium:P,fontSizeLarge:y}=e;return Object.assign(Object.assign({},$r),{fontSizeSmall:f,fontSizeMedium:P,fontSizeLarge:y,lineHeight:w,borderRadius:x,borderColor:De(s,t),borderColorModal:De(o,t),borderColorPopover:De(a,t),tdColor:s,tdColorModal:o,tdColorPopover:a,tdColorStriped:De(s,u),tdColorStripedModal:De(o,u),tdColorStripedPopover:De(a,u),thColor:De(s,r),thColorModal:De(o,r),thColorPopover:De(a,r),thTextColor:l,tdTextColor:g,thFontWeight:c})}const Dr={common:Mt,self:Pr};function Ir(e){const{borderRadiusSmall:t,dividerColor:s,hoverColor:o,pressedColor:a,primaryColor:r,textColor3:u,textColor2:l,textColorDisabled:g,fontSize:x}=e;return{fontSize:x,lineHeight:"1.5",nodeHeight:"30px",nodeWrapperPadding:"3px 0",nodeBorderRadius:t,nodeColorHover:o,nodeColorPressed:a,nodeColorActive:No(r,{alpha:.1}),arrowColor:u,nodeTextColor:l,nodeTextColorDisabled:g,loadingColor:r,dropMarkColor:r,lineColor:s}}const Kr=wo({name:"Tree",common:Mt,peers:{Checkbox:So,Scrollbar:Co,Empty:or},self:Ir}),Er=Object.assign(Object.assign({},ze.props),{trigger:String,xScrollable:Boolean,onScroll:Function,contentClass:String,contentStyle:[Object,String],size:Number,yPlacement:{type:String,default:"right"},xPlacement:{type:String,default:"bottom"}}),Bn=Q({name:"Scrollbar",props:Er,setup(){const e=ie(null);return Object.assign(Object.assign({},{scrollTo:(...s)=>{var o;(o=e.value)===null||o===void 0||o.scrollTo(s[0],s[1])},scrollBy:(...s)=>{var o;(o=e.value)===null||o===void 0||o.scrollBy(s[0],s[1])}}),{scrollbarInstRef:e})},render(){return I(_o,Object.assign({ref:"scrollbarInstRef"},this.$props),this.$slots)}}),Lr=O([M("table",`
|
|
73
73
|
font-size: var(--n-font-size);
|
|
74
74
|
font-variant-numeric: tabular-nums;
|
|
75
75
|
line-height: var(--n-line-height);
|
|
@@ -144,7 +144,7 @@ import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft
|
|
|
144
144
|
background-color: var(--n-th-color-popover);
|
|
145
145
|
`),O("td",`
|
|
146
146
|
background-color: var(--n-td-color-popover);
|
|
147
|
-
`)]))]),Lr=Object.assign(Object.assign({},ze.props),{bordered:{type:Boolean,default:!0},bottomBordered:{type:Boolean,default:!0},singleLine:{type:Boolean,default:!0},striped:Boolean,singleColumn:Boolean,size:{type:String,default:"medium"}}),Tr=Q({name:"Table",props:Lr,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:s,mergedRtlRef:o}=ut(e),a=ze("Table","-table",Er,Pr,e,t),r=ft("Table",o,t),u=F(()=>{const{size:v}=e,{self:{borderColor:x,tdColor:c,tdColorModal:w,tdColorPopover:f,thColor:P,thColorModal:y,thColorPopover:k,thTextColor:m,tdTextColor:C,borderRadius:N,thFontWeight:$,lineHeight:p,borderColorModal:i,borderColorPopover:h,tdColorStriped:_,tdColorStripedModal:g,tdColorStripedPopover:z,[Kt("fontSize",v)]:B,[Kt("tdPadding",v)]:A,[Kt("thPadding",v)]:ee},common:{cubicBezierEaseInOut:Pe}}=a.value;return{"--n-bezier":Pe,"--n-td-color":c,"--n-td-color-modal":w,"--n-td-color-popover":f,"--n-td-text-color":C,"--n-border-color":x,"--n-border-color-modal":i,"--n-border-color-popover":h,"--n-border-radius":N,"--n-font-size":B,"--n-th-color":P,"--n-th-color-modal":y,"--n-th-color-popover":k,"--n-th-font-weight":$,"--n-th-text-color":m,"--n-line-height":p,"--n-td-padding":A,"--n-th-padding":ee,"--n-td-color-striped":_,"--n-td-color-striped-modal":g,"--n-td-color-striped-popover":z}}),l=s?Ht("table",F(()=>e.size[0]),u,e):void 0;return{rtlEnabled:r,mergedClsPrefix:t,cssVars:s?void 0:u,themeClass:l==null?void 0:l.themeClass,onRender:l==null?void 0:l.onRender}},render(){var e;const{mergedClsPrefix:t}=this;return(e=this.onRender)===null||e===void 0||e.call(this),I("table",{class:[`${t}-table`,this.themeClass,{[`${t}-table--rtl`]:this.rtlEnabled,[`${t}-table--bottom-bordered`]:this.bottomBordered,[`${t}-table--bordered`]:this.bordered,[`${t}-table--single-line`]:this.singleLine,[`${t}-table--single-column`]:this.singleColumn,[`${t}-table--striped`]:this.striped}],style:this.cssVars},this.$slots)}}),Fr=Q({name:"Tbody",render(){return I("tbody",null,this.$slots)}}),Ar=Q({name:"Td",render(){return I("td",null,this.$slots)}}),Br=Q({name:"Tr",render(){return I("tr",null,this.$slots)}}),zn=Ut("n-tree-select");function pn({position:e,offsetLevel:t,indent:s,el:o}){const a={position:"absolute",boxSizing:"border-box",right:0};if(e==="inside")a.left=0,a.top=0,a.bottom=0,a.borderRadius="inherit",a.boxShadow="inset 0 0 0 2px var(--n-drop-mark-color)";else{const r=e==="before"?"top":"bottom";a[r]=0,a.left=`${o.offsetLeft+6-t*s}px`,a.height="2px",a.backgroundColor="var(--n-drop-mark-color)",a.transformOrigin=r,a.borderRadius="1px",a.transform=e==="before"?"translateY(-4px)":"translateY(4px)"}return I("div",{style:a})}function zr({dropPosition:e,node:t}){return t.isLeaf===!1||t.children?!0:e!=="inside"}const gt=Ut("n-tree");function Or({props:e,fNodesRef:t,mergedExpandedKeysRef:s,mergedSelectedKeysRef:o,mergedCheckedKeysRef:a,handleCheck:r,handleSelect:u,handleSwitcherClick:l}){const{value:v}=o,x=Oe(zn,null),c=x?x.pendingNodeKeyRef:le(v.length?v[v.length-1]:null);function w(f){var P;if(!e.keyboard)return{enterBehavior:null};const{value:y}=c;let k=null;if(y===null){if((f.key==="ArrowDown"||f.key==="ArrowUp")&&f.preventDefault(),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(f.key)&&y===null){const{value:m}=t;let C=0;for(;C<m.length;){if(!m[C].disabled){c.value=m[C].key;break}C+=1}}}else{const{value:m}=t;let C=m.findIndex(N=>N.key===y);if(!~C)return{enterBehavior:null};if(f.key==="Enter"){const N=m[C];switch(k=((P=e.overrideDefaultNodeClickBehavior)===null||P===void 0?void 0:P.call(e,{option:N.rawNode}))||null,k){case"toggleCheck":r(N,!a.value.includes(N.key));break;case"toggleSelect":u(N);break;case"toggleExpand":l(N);break;case"none":break;case"default":default:k="default",u(N)}}else if(f.key==="ArrowDown")for(f.preventDefault(),C+=1;C<m.length;){if(!m[C].disabled){c.value=m[C].key;break}C+=1}else if(f.key==="ArrowUp")for(f.preventDefault(),C-=1;C>=0;){if(!m[C].disabled){c.value=m[C].key;break}C-=1}else if(f.key==="ArrowLeft"){const N=m[C];if(N.isLeaf||!s.value.includes(y)){const $=N.getParent();$&&(c.value=$.key)}else l(N)}else if(f.key==="ArrowRight"){const N=m[C];if(N.isLeaf)return{enterBehavior:null};if(!s.value.includes(y))l(N);else for(C+=1;C<m.length;){if(!m[C].disabled){c.value=m[C].key;break}C+=1}}}return{enterBehavior:k}}return{pendingNodeKeyRef:c,handleKeydown:w}}const Mr=Q({name:"NTreeNodeCheckbox",props:{clsPrefix:{type:String,required:!0},indent:{type:Number,required:!0},right:Boolean,focusable:Boolean,disabled:Boolean,checked:Boolean,indeterminate:Boolean,onCheck:Function},setup(e){const t=Oe(gt);function s(a){const{onCheck:r}=e;r&&r(a)}function o(a){s(a)}return{handleUpdateValue:o,mergedTheme:t.mergedThemeRef}},render(){const{clsPrefix:e,mergedTheme:t,checked:s,indeterminate:o,disabled:a,focusable:r,indent:u,handleUpdateValue:l}=this;return I("span",{class:[`${e}-tree-node-checkbox`,this.right&&`${e}-tree-node-checkbox--right`],style:{width:`${u}px`},"data-checkbox":!0},I(Po,{focusable:r,disabled:a,theme:t.peers.Checkbox,themeOverrides:t.peerOverrides.Checkbox,checked:s,indeterminate:o,onUpdateChecked:l}))}}),Hr=Q({name:"TreeNodeContent",props:{clsPrefix:{type:String,required:!0},disabled:Boolean,checked:Boolean,selected:Boolean,onClick:Function,onDragstart:Function,tmNode:{type:Object,required:!0},nodeProps:Object},setup(e){const{renderLabelRef:t,renderPrefixRef:s,renderSuffixRef:o,labelFieldRef:a}=Oe(gt),r=le(null);function u(v){const{onClick:x}=e;x&&x(v)}function l(v){u(v)}return{selfRef:r,renderLabel:t,renderPrefix:s,renderSuffix:o,labelField:a,handleClick:l}},render(){const{clsPrefix:e,labelField:t,nodeProps:s,checked:o=!1,selected:a=!1,renderLabel:r,renderPrefix:u,renderSuffix:l,handleClick:v,onDragstart:x,tmNode:{rawNode:c,rawNode:{prefix:w,suffix:f,[t]:P}}}=this;return I("span",Object.assign({},s,{ref:"selfRef",class:[`${e}-tree-node-content`,s==null?void 0:s.class],onClick:v,draggable:x===void 0?void 0:!0,onDragstart:x}),u||w?I("div",{class:`${e}-tree-node-content__prefix`},u?u({option:c,selected:a,checked:o}):Et(w)):null,I("div",{class:`${e}-tree-node-content__text`},r?r({option:c,selected:a,checked:o}):Et(P)),l||f?I("div",{class:`${e}-tree-node-content__suffix`},l?l({option:c,selected:a,checked:o}):Et(f)):null)}}),Ur=Q({name:"NTreeSwitcher",props:{clsPrefix:{type:String,required:!0},indent:{type:Number,required:!0},expanded:Boolean,selected:Boolean,hide:Boolean,loading:Boolean,onClick:Function,tmNode:{type:Object,required:!0}},setup(e){const{renderSwitcherIconRef:t}=Oe(gt,null);return()=>{const{clsPrefix:s,expanded:o,hide:a,indent:r,onClick:u}=e;return I("span",{"data-switcher":!0,class:[`${s}-tree-node-switcher`,o&&`${s}-tree-node-switcher--expanded`,a&&`${s}-tree-node-switcher--hide`],style:{width:`${r}px`},onClick:u},I("div",{class:`${s}-tree-node-switcher__icon`},I(Do,null,{default:()=>{if(e.loading)return I(Io,{clsPrefix:s,key:"loading",radius:85,strokeWidth:20});const{value:l}=t;return l?l({expanded:e.expanded,selected:e.selected,option:e.tmNode.rawNode}):I(Sn,{clsPrefix:s,key:"switcher"},{default:()=>I(vr,null)})}})))}}});function jr(e){return F(()=>e.leafOnly?"child":e.checkStrategy)}function Ke(e,t){return!!e.rawNode[t]}function On(e,t,s,o){e==null||e.forEach(a=>{s(a),On(a[t],t,s,o),o(a)})}function Wr(e,t,s,o,a){const r=new Set,u=new Set,l=[];return On(e,o,v=>{if(l.push(v),a(t,v)){u.add(v[s]);for(let x=l.length-2;x>=0;--x)if(!r.has(l[x][s]))r.add(l[x][s]);else return}},()=>{l.pop()}),{expandedKeys:Array.from(r),highlightKeySet:u}}if(Ko&&Image){const e=new Image;e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}function qr(e,t,s,o,a){const r=new Set,u=new Set,l=new Set,v=[],x=[],c=[];function w(P){P.forEach(y=>{if(c.push(y),t(s,y)){r.add(y[o]),l.add(y[o]);for(let m=c.length-2;m>=0;--m){const C=c[m][o];if(!u.has(C))u.add(C),r.has(C)&&r.delete(C);else break}}const k=y[a];k&&w(k),c.pop()})}w(e);function f(P,y){P.forEach(k=>{const m=k[o],C=r.has(m),N=u.has(m);if(!C&&!N)return;const $=k[a];if($)if(C)y.push(k);else{v.push(m);const p=Object.assign(Object.assign({},k),{[a]:[]});y.push(p),f($,p[a])}else y.push(k)})}return f(e,x),{filteredTree:x,highlightKeySet:l,expandedKeys:v}}const Mn=Q({name:"TreeNode",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(e){const t=Oe(gt),{droppingNodeParentRef:s,droppingMouseNodeRef:o,draggingNodeRef:a,droppingPositionRef:r,droppingOffsetLevelRef:u,nodePropsRef:l,indentRef:v,blockLineRef:x,checkboxPlacementRef:c,checkOnClickRef:w,disabledFieldRef:f,showLineRef:P,renderSwitcherIconRef:y,overrideDefaultNodeClickBehaviorRef:k}=t,m=ue(()=>!!e.tmNode.rawNode.checkboxDisabled),C=ue(()=>Ke(e.tmNode,f.value)),N=ue(()=>t.disabledRef.value||C.value),$=F(()=>{const{value:E}=l;if(E)return E({option:e.tmNode.rawNode})}),p=le(null),i={value:null};Ct(()=>{i.value=p.value.$el});function h(){const E=()=>{const{tmNode:q}=e;if(!q.isLeaf&&!q.shallowLoaded){if(!t.loadingKeysRef.value.has(q.key))t.loadingKeysRef.value.add(q.key);else return;const{onLoadRef:{value:te}}=t;te&&te(q.rawNode).then(re=>{re!==!1&&t.handleSwitcherClick(q)}).finally(()=>{t.loadingKeysRef.value.delete(q.key)})}else t.handleSwitcherClick(q)};y.value?setTimeout(E,0):E()}const _=ue(()=>!C.value&&t.selectableRef.value&&(t.internalTreeSelect?t.mergedCheckStrategyRef.value!=="child"||t.multipleRef.value&&t.cascadeRef.value||e.tmNode.isLeaf:!0)),g=ue(()=>t.checkableRef.value&&(t.cascadeRef.value||t.mergedCheckStrategyRef.value!=="child"||e.tmNode.isLeaf)),z=ue(()=>t.displayedCheckedKeysRef.value.includes(e.tmNode.key)),B=ue(()=>{const{value:E}=g;if(!E)return!1;const{value:q}=w,{tmNode:te}=e;return typeof q=="boolean"?!te.disabled&&q:q(e.tmNode.rawNode)});function A(E){const{value:q}=t.expandOnClickRef,{value:te}=_,{value:re}=B;if(!te&&!q&&!re||et(E,"checkbox")||et(E,"switcher"))return;const{tmNode:ge}=e;te&&t.handleSelect(ge),q&&!ge.isLeaf&&h(),re&&fe(!z.value)}function ee(E){var q,te;if(!(et(E,"checkbox")||et(E,"switcher"))){if(!N.value){const re=k.value;let ge=!1;if(re)switch(re({option:e.tmNode.rawNode})){case"toggleCheck":ge=!0,fe(!z.value);break;case"toggleSelect":ge=!0,t.handleSelect(e.tmNode);break;case"toggleExpand":ge=!0,h(),ge=!0;break;case"none":ge=!0,ge=!0;return}ge||A(E)}(te=(q=$.value)===null||q===void 0?void 0:q.onClick)===null||te===void 0||te.call(q,E)}}function Pe(E){x.value||ee(E)}function se(E){x.value&&ee(E)}function fe(E){t.handleCheck(e.tmNode,E)}function be(E){t.handleDragStart({event:E,node:e.tmNode})}function pe(E){E.currentTarget===E.target&&t.handleDragEnter({event:E,node:e.tmNode})}function ye(E){E.preventDefault(),t.handleDragOver({event:E,node:e.tmNode})}function j(E){t.handleDragEnd({event:E,node:e.tmNode})}function Ae(E){E.currentTarget===E.target&&t.handleDragLeave({event:E,node:e.tmNode})}function he(E){E.preventDefault(),r.value!==null&&t.handleDrop({event:E,node:e.tmNode,dropPosition:r.value})}const Ue=F(()=>{const{clsPrefix:E}=e,{value:q}=v;if(P.value){const te=[];let re=e.tmNode.parent;for(;re;)re.isLastChild?te.push(I("div",{class:`${E}-tree-node-indent`},I("div",{style:{width:`${q}px`}}))):te.push(I("div",{class:[`${E}-tree-node-indent`,`${E}-tree-node-indent--show-line`]},I("div",{style:{width:`${q}px`}}))),re=re.parent;return te.reverse()}else return Eo(e.tmNode.level,I("div",{class:`${e.clsPrefix}-tree-node-indent`},I("div",{style:{width:`${q}px`}})))});return{showDropMark:ue(()=>{const{value:E}=a;if(!E)return;const{value:q}=r;if(!q)return;const{value:te}=o;if(!te)return;const{tmNode:re}=e;return re.key===te.key}),showDropMarkAsParent:ue(()=>{const{value:E}=s;if(!E)return!1;const{tmNode:q}=e,{value:te}=r;return te==="before"||te==="after"?E.key===q.key:!1}),pending:ue(()=>t.pendingNodeKeyRef.value===e.tmNode.key),loading:ue(()=>t.loadingKeysRef.value.has(e.tmNode.key)),highlight:ue(()=>{var E;return(E=t.highlightKeySetRef.value)===null||E===void 0?void 0:E.has(e.tmNode.key)}),checked:z,indeterminate:ue(()=>t.displayedIndeterminateKeysRef.value.includes(e.tmNode.key)),selected:ue(()=>t.mergedSelectedKeysRef.value.includes(e.tmNode.key)),expanded:ue(()=>t.mergedExpandedKeysRef.value.includes(e.tmNode.key)),disabled:N,checkable:g,mergedCheckOnClick:B,checkboxDisabled:m,selectable:_,expandOnClick:t.expandOnClickRef,internalScrollable:t.internalScrollableRef,draggable:t.draggableRef,blockLine:x,nodeProps:$,checkboxFocusable:t.internalCheckboxFocusableRef,droppingPosition:r,droppingOffsetLevel:u,indent:v,checkboxPlacement:c,showLine:P,contentInstRef:p,contentElRef:i,indentNodes:Ue,handleCheck:fe,handleDrop:he,handleDragStart:be,handleDragEnter:pe,handleDragOver:ye,handleDragEnd:j,handleDragLeave:Ae,handleLineClick:se,handleContentClick:Pe,handleSwitcherClick:h}},render(){const{tmNode:e,clsPrefix:t,checkable:s,expandOnClick:o,selectable:a,selected:r,checked:u,highlight:l,draggable:v,blockLine:x,indent:c,indentNodes:w,disabled:f,pending:P,internalScrollable:y,nodeProps:k,checkboxPlacement:m}=this,C=v&&!f?{onDragenter:this.handleDragEnter,onDragleave:this.handleDragLeave,onDragend:this.handleDragEnd,onDrop:this.handleDrop,onDragover:this.handleDragOver}:void 0,N=y?Tn(e.key):void 0,$=m==="right",p=s?I(Mr,{indent:c,right:$,focusable:this.checkboxFocusable,disabled:f||this.checkboxDisabled,clsPrefix:t,checked:this.checked,indeterminate:this.indeterminate,onCheck:this.handleCheck}):null;return I("div",Object.assign({class:`${t}-tree-node-wrapper`},C),I("div",Object.assign({},x?k:void 0,{class:[`${t}-tree-node`,{[`${t}-tree-node--selected`]:r,[`${t}-tree-node--checkable`]:s,[`${t}-tree-node--highlight`]:l,[`${t}-tree-node--pending`]:P,[`${t}-tree-node--disabled`]:f,[`${t}-tree-node--selectable`]:a,[`${t}-tree-node--clickable`]:a||o||this.mergedCheckOnClick},k==null?void 0:k.class],"data-key":N,draggable:v&&x,onClick:this.handleLineClick,onDragstart:v&&x&&!f?this.handleDragStart:void 0}),w,e.isLeaf&&this.showLine?I("div",{class:[`${t}-tree-node-indent`,`${t}-tree-node-indent--show-line`,e.isLeaf&&`${t}-tree-node-indent--is-leaf`,e.isLastChild&&`${t}-tree-node-indent--last-child`]},I("div",{style:{width:`${c}px`}})):I(Ur,{clsPrefix:t,expanded:this.expanded,selected:r,loading:this.loading,hide:e.isLeaf,tmNode:this.tmNode,indent:c,onClick:this.handleSwitcherClick}),$?null:p,I(Hr,{ref:"contentInstRef",clsPrefix:t,checked:u,selected:r,onClick:this.handleContentClick,nodeProps:x?void 0:k,onDragstart:v&&!x&&!f?this.handleDragStart:void 0,tmNode:e}),v?this.showDropMark?pn({el:this.contentElRef.value,position:this.droppingPosition,offsetLevel:this.droppingOffsetLevel,indent:c}):this.showDropMarkAsParent?pn({el:this.contentElRef.value,position:"inside",offsetLevel:this.droppingOffsetLevel,indent:c}):null:null,$?p:null))}}),Vr=Q({name:"TreeMotionWrapper",props:{clsPrefix:{type:String,required:!0},height:Number,nodes:{type:Array,required:!0},mode:{type:String,required:!0},onAfterEnter:{type:Function,required:!0}},render(){const{clsPrefix:e}=this;return I(kn,{onAfterEnter:this.onAfterEnter,appear:!0,reverse:this.mode==="collapse"},{default:()=>I("div",{class:[`${e}-tree-motion-wrapper`,`${e}-tree-motion-wrapper--${this.mode}`],style:{height:Nn(this.height)}},this.nodes.map(t=>I(Mn,{clsPrefix:e,tmNode:t})))})}}),Bt=Lo(),Gr=M("tree",`
|
|
147
|
+
`)]))]),Tr=Object.assign(Object.assign({},ze.props),{bordered:{type:Boolean,default:!0},bottomBordered:{type:Boolean,default:!0},singleLine:{type:Boolean,default:!0},striped:Boolean,singleColumn:Boolean,size:{type:String,default:"medium"}}),Fr=Q({name:"Table",props:Tr,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:s,mergedRtlRef:o}=ut(e),a=ze("Table","-table",Lr,Dr,e,t),r=ft("Table",o,t),u=F(()=>{const{size:g}=e,{self:{borderColor:x,tdColor:c,tdColorModal:w,tdColorPopover:f,thColor:P,thColorModal:y,thColorPopover:k,thTextColor:p,tdTextColor:C,borderRadius:N,thFontWeight:$,lineHeight:v,borderColorModal:i,borderColorPopover:m,tdColorStriped:_,tdColorStripedModal:h,tdColorStripedPopover:z,[Kt("fontSize",g)]:B,[Kt("tdPadding",g)]:A,[Kt("thPadding",g)]:ee},common:{cubicBezierEaseInOut:Pe}}=a.value;return{"--n-bezier":Pe,"--n-td-color":c,"--n-td-color-modal":w,"--n-td-color-popover":f,"--n-td-text-color":C,"--n-border-color":x,"--n-border-color-modal":i,"--n-border-color-popover":m,"--n-border-radius":N,"--n-font-size":B,"--n-th-color":P,"--n-th-color-modal":y,"--n-th-color-popover":k,"--n-th-font-weight":$,"--n-th-text-color":p,"--n-line-height":v,"--n-td-padding":A,"--n-th-padding":ee,"--n-td-color-striped":_,"--n-td-color-striped-modal":h,"--n-td-color-striped-popover":z}}),l=s?Ht("table",F(()=>e.size[0]),u,e):void 0;return{rtlEnabled:r,mergedClsPrefix:t,cssVars:s?void 0:u,themeClass:l==null?void 0:l.themeClass,onRender:l==null?void 0:l.onRender}},render(){var e;const{mergedClsPrefix:t}=this;return(e=this.onRender)===null||e===void 0||e.call(this),I("table",{class:[`${t}-table`,this.themeClass,{[`${t}-table--rtl`]:this.rtlEnabled,[`${t}-table--bottom-bordered`]:this.bottomBordered,[`${t}-table--bordered`]:this.bordered,[`${t}-table--single-line`]:this.singleLine,[`${t}-table--single-column`]:this.singleColumn,[`${t}-table--striped`]:this.striped}],style:this.cssVars},this.$slots)}}),Ar=Q({name:"Tbody",render(){return I("tbody",null,this.$slots)}}),Br=Q({name:"Td",render(){return I("td",null,this.$slots)}}),zr=Q({name:"Tr",render(){return I("tr",null,this.$slots)}}),zn=Ut("n-tree-select");function pn({position:e,offsetLevel:t,indent:s,el:o}){const a={position:"absolute",boxSizing:"border-box",right:0};if(e==="inside")a.left=0,a.top=0,a.bottom=0,a.borderRadius="inherit",a.boxShadow="inset 0 0 0 2px var(--n-drop-mark-color)";else{const r=e==="before"?"top":"bottom";a[r]=0,a.left=`${o.offsetLeft+6-t*s}px`,a.height="2px",a.backgroundColor="var(--n-drop-mark-color)",a.transformOrigin=r,a.borderRadius="1px",a.transform=e==="before"?"translateY(-4px)":"translateY(4px)"}return I("div",{style:a})}function Or({dropPosition:e,node:t}){return t.isLeaf===!1||t.children?!0:e!=="inside"}const gt=Ut("n-tree");function Mr({props:e,fNodesRef:t,mergedExpandedKeysRef:s,mergedSelectedKeysRef:o,mergedCheckedKeysRef:a,handleCheck:r,handleSelect:u,handleSwitcherClick:l}){const{value:g}=o,x=Oe(zn,null),c=x?x.pendingNodeKeyRef:ie(g.length?g[g.length-1]:null);function w(f){var P;if(!e.keyboard)return{enterBehavior:null};const{value:y}=c;let k=null;if(y===null){if((f.key==="ArrowDown"||f.key==="ArrowUp")&&f.preventDefault(),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(f.key)&&y===null){const{value:p}=t;let C=0;for(;C<p.length;){if(!p[C].disabled){c.value=p[C].key;break}C+=1}}}else{const{value:p}=t;let C=p.findIndex(N=>N.key===y);if(!~C)return{enterBehavior:null};if(f.key==="Enter"){const N=p[C];switch(k=((P=e.overrideDefaultNodeClickBehavior)===null||P===void 0?void 0:P.call(e,{option:N.rawNode}))||null,k){case"toggleCheck":r(N,!a.value.includes(N.key));break;case"toggleSelect":u(N);break;case"toggleExpand":l(N);break;case"none":break;case"default":default:k="default",u(N)}}else if(f.key==="ArrowDown")for(f.preventDefault(),C+=1;C<p.length;){if(!p[C].disabled){c.value=p[C].key;break}C+=1}else if(f.key==="ArrowUp")for(f.preventDefault(),C-=1;C>=0;){if(!p[C].disabled){c.value=p[C].key;break}C-=1}else if(f.key==="ArrowLeft"){const N=p[C];if(N.isLeaf||!s.value.includes(y)){const $=N.getParent();$&&(c.value=$.key)}else l(N)}else if(f.key==="ArrowRight"){const N=p[C];if(N.isLeaf)return{enterBehavior:null};if(!s.value.includes(y))l(N);else for(C+=1;C<p.length;){if(!p[C].disabled){c.value=p[C].key;break}C+=1}}}return{enterBehavior:k}}return{pendingNodeKeyRef:c,handleKeydown:w}}const Hr=Q({name:"NTreeNodeCheckbox",props:{clsPrefix:{type:String,required:!0},indent:{type:Number,required:!0},right:Boolean,focusable:Boolean,disabled:Boolean,checked:Boolean,indeterminate:Boolean,onCheck:Function},setup(e){const t=Oe(gt);function s(a){const{onCheck:r}=e;r&&r(a)}function o(a){s(a)}return{handleUpdateValue:o,mergedTheme:t.mergedThemeRef}},render(){const{clsPrefix:e,mergedTheme:t,checked:s,indeterminate:o,disabled:a,focusable:r,indent:u,handleUpdateValue:l}=this;return I("span",{class:[`${e}-tree-node-checkbox`,this.right&&`${e}-tree-node-checkbox--right`],style:{width:`${u}px`},"data-checkbox":!0},I(Po,{focusable:r,disabled:a,theme:t.peers.Checkbox,themeOverrides:t.peerOverrides.Checkbox,checked:s,indeterminate:o,onUpdateChecked:l}))}}),Ur=Q({name:"TreeNodeContent",props:{clsPrefix:{type:String,required:!0},disabled:Boolean,checked:Boolean,selected:Boolean,onClick:Function,onDragstart:Function,tmNode:{type:Object,required:!0},nodeProps:Object},setup(e){const{renderLabelRef:t,renderPrefixRef:s,renderSuffixRef:o,labelFieldRef:a}=Oe(gt),r=ie(null);function u(g){const{onClick:x}=e;x&&x(g)}function l(g){u(g)}return{selfRef:r,renderLabel:t,renderPrefix:s,renderSuffix:o,labelField:a,handleClick:l}},render(){const{clsPrefix:e,labelField:t,nodeProps:s,checked:o=!1,selected:a=!1,renderLabel:r,renderPrefix:u,renderSuffix:l,handleClick:g,onDragstart:x,tmNode:{rawNode:c,rawNode:{prefix:w,suffix:f,[t]:P}}}=this;return I("span",Object.assign({},s,{ref:"selfRef",class:[`${e}-tree-node-content`,s==null?void 0:s.class],onClick:g,draggable:x===void 0?void 0:!0,onDragstart:x}),u||w?I("div",{class:`${e}-tree-node-content__prefix`},u?u({option:c,selected:a,checked:o}):Et(w)):null,I("div",{class:`${e}-tree-node-content__text`},r?r({option:c,selected:a,checked:o}):Et(P)),l||f?I("div",{class:`${e}-tree-node-content__suffix`},l?l({option:c,selected:a,checked:o}):Et(f)):null)}}),jr=Q({name:"NTreeSwitcher",props:{clsPrefix:{type:String,required:!0},indent:{type:Number,required:!0},expanded:Boolean,selected:Boolean,hide:Boolean,loading:Boolean,onClick:Function,tmNode:{type:Object,required:!0}},setup(e){const{renderSwitcherIconRef:t}=Oe(gt,null);return()=>{const{clsPrefix:s,expanded:o,hide:a,indent:r,onClick:u}=e;return I("span",{"data-switcher":!0,class:[`${s}-tree-node-switcher`,o&&`${s}-tree-node-switcher--expanded`,a&&`${s}-tree-node-switcher--hide`],style:{width:`${r}px`},onClick:u},I("div",{class:`${s}-tree-node-switcher__icon`},I(Do,null,{default:()=>{if(e.loading)return I(Io,{clsPrefix:s,key:"loading",radius:85,strokeWidth:20});const{value:l}=t;return l?l({expanded:e.expanded,selected:e.selected,option:e.tmNode.rawNode}):I(Sn,{clsPrefix:s,key:"switcher"},{default:()=>I(pr,null)})}})))}}});function Wr(e){return F(()=>e.leafOnly?"child":e.checkStrategy)}function Ee(e,t){return!!e.rawNode[t]}function On(e,t,s,o){e==null||e.forEach(a=>{s(a),On(a[t],t,s,o),o(a)})}function qr(e,t,s,o,a){const r=new Set,u=new Set,l=[];return On(e,o,g=>{if(l.push(g),a(t,g)){u.add(g[s]);for(let x=l.length-2;x>=0;--x)if(!r.has(l[x][s]))r.add(l[x][s]);else return}},()=>{l.pop()}),{expandedKeys:Array.from(r),highlightKeySet:u}}if(Ko&&Image){const e=new Image;e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}function Vr(e,t,s,o,a){const r=new Set,u=new Set,l=new Set,g=[],x=[],c=[];function w(P){P.forEach(y=>{if(c.push(y),t(s,y)){r.add(y[o]),l.add(y[o]);for(let p=c.length-2;p>=0;--p){const C=c[p][o];if(!u.has(C))u.add(C),r.has(C)&&r.delete(C);else break}}const k=y[a];k&&w(k),c.pop()})}w(e);function f(P,y){P.forEach(k=>{const p=k[o],C=r.has(p),N=u.has(p);if(!C&&!N)return;const $=k[a];if($)if(C)y.push(k);else{g.push(p);const v=Object.assign(Object.assign({},k),{[a]:[]});y.push(v),f($,v[a])}else y.push(k)})}return f(e,x),{filteredTree:x,highlightKeySet:l,expandedKeys:g}}const Mn=Q({name:"TreeNode",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(e){const t=Oe(gt),{droppingNodeParentRef:s,droppingMouseNodeRef:o,draggingNodeRef:a,droppingPositionRef:r,droppingOffsetLevelRef:u,nodePropsRef:l,indentRef:g,blockLineRef:x,checkboxPlacementRef:c,checkOnClickRef:w,disabledFieldRef:f,showLineRef:P,renderSwitcherIconRef:y,overrideDefaultNodeClickBehaviorRef:k}=t,p=ue(()=>!!e.tmNode.rawNode.checkboxDisabled),C=ue(()=>Ee(e.tmNode,f.value)),N=ue(()=>t.disabledRef.value||C.value),$=F(()=>{const{value:E}=l;if(E)return E({option:e.tmNode.rawNode})}),v=ie(null),i={value:null};Ct(()=>{i.value=v.value.$el});function m(){const E=()=>{const{tmNode:q}=e;if(!q.isLeaf&&!q.shallowLoaded){if(!t.loadingKeysRef.value.has(q.key))t.loadingKeysRef.value.add(q.key);else return;const{onLoadRef:{value:te}}=t;te&&te(q.rawNode).then(le=>{le!==!1&&t.handleSwitcherClick(q)}).finally(()=>{t.loadingKeysRef.value.delete(q.key)})}else t.handleSwitcherClick(q)};y.value?setTimeout(E,0):E()}const _=ue(()=>!C.value&&t.selectableRef.value&&(t.internalTreeSelect?t.mergedCheckStrategyRef.value!=="child"||t.multipleRef.value&&t.cascadeRef.value||e.tmNode.isLeaf:!0)),h=ue(()=>t.checkableRef.value&&(t.cascadeRef.value||t.mergedCheckStrategyRef.value!=="child"||e.tmNode.isLeaf)),z=ue(()=>t.displayedCheckedKeysRef.value.includes(e.tmNode.key)),B=ue(()=>{const{value:E}=h;if(!E)return!1;const{value:q}=w,{tmNode:te}=e;return typeof q=="boolean"?!te.disabled&&q:q(e.tmNode.rawNode)});function A(E){const{value:q}=t.expandOnClickRef,{value:te}=_,{value:le}=B;if(!te&&!q&&!le||et(E,"checkbox")||et(E,"switcher"))return;const{tmNode:ge}=e;te&&t.handleSelect(ge),q&&!ge.isLeaf&&m(),le&&fe(!z.value)}function ee(E){var q,te;if(!(et(E,"checkbox")||et(E,"switcher"))){if(!N.value){const le=k.value;let ge=!1;if(le)switch(le({option:e.tmNode.rawNode})){case"toggleCheck":ge=!0,fe(!z.value);break;case"toggleSelect":ge=!0,t.handleSelect(e.tmNode);break;case"toggleExpand":ge=!0,m(),ge=!0;break;case"none":ge=!0,ge=!0;return}ge||A(E)}(te=(q=$.value)===null||q===void 0?void 0:q.onClick)===null||te===void 0||te.call(q,E)}}function Pe(E){x.value||ee(E)}function ae(E){x.value&&ee(E)}function fe(E){t.handleCheck(e.tmNode,E)}function be(E){t.handleDragStart({event:E,node:e.tmNode})}function pe(E){E.currentTarget===E.target&&t.handleDragEnter({event:E,node:e.tmNode})}function ye(E){E.preventDefault(),t.handleDragOver({event:E,node:e.tmNode})}function j(E){t.handleDragEnd({event:E,node:e.tmNode})}function Ae(E){E.currentTarget===E.target&&t.handleDragLeave({event:E,node:e.tmNode})}function he(E){E.preventDefault(),r.value!==null&&t.handleDrop({event:E,node:e.tmNode,dropPosition:r.value})}const Ue=F(()=>{const{clsPrefix:E}=e,{value:q}=g;if(P.value){const te=[];let le=e.tmNode.parent;for(;le;)le.isLastChild?te.push(I("div",{class:`${E}-tree-node-indent`},I("div",{style:{width:`${q}px`}}))):te.push(I("div",{class:[`${E}-tree-node-indent`,`${E}-tree-node-indent--show-line`]},I("div",{style:{width:`${q}px`}}))),le=le.parent;return te.reverse()}else return Eo(e.tmNode.level,I("div",{class:`${e.clsPrefix}-tree-node-indent`},I("div",{style:{width:`${q}px`}})))});return{showDropMark:ue(()=>{const{value:E}=a;if(!E)return;const{value:q}=r;if(!q)return;const{value:te}=o;if(!te)return;const{tmNode:le}=e;return le.key===te.key}),showDropMarkAsParent:ue(()=>{const{value:E}=s;if(!E)return!1;const{tmNode:q}=e,{value:te}=r;return te==="before"||te==="after"?E.key===q.key:!1}),pending:ue(()=>t.pendingNodeKeyRef.value===e.tmNode.key),loading:ue(()=>t.loadingKeysRef.value.has(e.tmNode.key)),highlight:ue(()=>{var E;return(E=t.highlightKeySetRef.value)===null||E===void 0?void 0:E.has(e.tmNode.key)}),checked:z,indeterminate:ue(()=>t.displayedIndeterminateKeysRef.value.includes(e.tmNode.key)),selected:ue(()=>t.mergedSelectedKeysRef.value.includes(e.tmNode.key)),expanded:ue(()=>t.mergedExpandedKeysRef.value.includes(e.tmNode.key)),disabled:N,checkable:h,mergedCheckOnClick:B,checkboxDisabled:p,selectable:_,expandOnClick:t.expandOnClickRef,internalScrollable:t.internalScrollableRef,draggable:t.draggableRef,blockLine:x,nodeProps:$,checkboxFocusable:t.internalCheckboxFocusableRef,droppingPosition:r,droppingOffsetLevel:u,indent:g,checkboxPlacement:c,showLine:P,contentInstRef:v,contentElRef:i,indentNodes:Ue,handleCheck:fe,handleDrop:he,handleDragStart:be,handleDragEnter:pe,handleDragOver:ye,handleDragEnd:j,handleDragLeave:Ae,handleLineClick:ae,handleContentClick:Pe,handleSwitcherClick:m}},render(){const{tmNode:e,clsPrefix:t,checkable:s,expandOnClick:o,selectable:a,selected:r,checked:u,highlight:l,draggable:g,blockLine:x,indent:c,indentNodes:w,disabled:f,pending:P,internalScrollable:y,nodeProps:k,checkboxPlacement:p}=this,C=g&&!f?{onDragenter:this.handleDragEnter,onDragleave:this.handleDragLeave,onDragend:this.handleDragEnd,onDrop:this.handleDrop,onDragover:this.handleDragOver}:void 0,N=y?Tn(e.key):void 0,$=p==="right",v=s?I(Hr,{indent:c,right:$,focusable:this.checkboxFocusable,disabled:f||this.checkboxDisabled,clsPrefix:t,checked:this.checked,indeterminate:this.indeterminate,onCheck:this.handleCheck}):null;return I("div",Object.assign({class:`${t}-tree-node-wrapper`},C),I("div",Object.assign({},x?k:void 0,{class:[`${t}-tree-node`,{[`${t}-tree-node--selected`]:r,[`${t}-tree-node--checkable`]:s,[`${t}-tree-node--highlight`]:l,[`${t}-tree-node--pending`]:P,[`${t}-tree-node--disabled`]:f,[`${t}-tree-node--selectable`]:a,[`${t}-tree-node--clickable`]:a||o||this.mergedCheckOnClick},k==null?void 0:k.class],"data-key":N,draggable:g&&x,onClick:this.handleLineClick,onDragstart:g&&x&&!f?this.handleDragStart:void 0}),w,e.isLeaf&&this.showLine?I("div",{class:[`${t}-tree-node-indent`,`${t}-tree-node-indent--show-line`,e.isLeaf&&`${t}-tree-node-indent--is-leaf`,e.isLastChild&&`${t}-tree-node-indent--last-child`]},I("div",{style:{width:`${c}px`}})):I(jr,{clsPrefix:t,expanded:this.expanded,selected:r,loading:this.loading,hide:e.isLeaf,tmNode:this.tmNode,indent:c,onClick:this.handleSwitcherClick}),$?null:v,I(Ur,{ref:"contentInstRef",clsPrefix:t,checked:u,selected:r,onClick:this.handleContentClick,nodeProps:x?void 0:k,onDragstart:g&&!x&&!f?this.handleDragStart:void 0,tmNode:e}),g?this.showDropMark?pn({el:this.contentElRef.value,position:this.droppingPosition,offsetLevel:this.droppingOffsetLevel,indent:c}):this.showDropMarkAsParent?pn({el:this.contentElRef.value,position:"inside",offsetLevel:this.droppingOffsetLevel,indent:c}):null:null,$?v:null))}}),Gr=Q({name:"TreeMotionWrapper",props:{clsPrefix:{type:String,required:!0},height:Number,nodes:{type:Array,required:!0},mode:{type:String,required:!0},onAfterEnter:{type:Function,required:!0}},render(){const{clsPrefix:e}=this;return I(kn,{onAfterEnter:this.onAfterEnter,appear:!0,reverse:this.mode==="collapse"},{default:()=>I("div",{class:[`${e}-tree-motion-wrapper`,`${e}-tree-motion-wrapper--${this.mode}`],style:{height:Nn(this.height)}},this.nodes.map(t=>I(Mn,{clsPrefix:e,tmNode:t})))})}}),Bt=Lo(),Yr=M("tree",`
|
|
148
148
|
font-size: var(--n-font-size);
|
|
149
149
|
outline: none;
|
|
150
150
|
`,[O("ul, li",`
|
|
@@ -253,10 +253,10 @@ import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft
|
|
|
253
253
|
max-width: 100%;
|
|
254
254
|
`),X("suffix",`
|
|
255
255
|
display: inline-flex;
|
|
256
|
-
`)]),X("empty","margin: auto;")]);var Yr=function(e,t,s,o){function a(r){return r instanceof s?r:new s(function(u){u(r)})}return new(s||(s=Promise))(function(r,u){function l(c){try{x(o.next(c))}catch(w){u(w)}}function v(c){try{x(o.throw(c))}catch(w){u(w)}}function x(c){c.done?r(c.value):a(c.value).then(l,v)}x((o=o.apply(e,[])).next())})};function mn(e,t,s,o){return{getIsGroup(){return!1},getKey(r){return r[e]},getChildren:o||(r=>r[t]),getDisabled(r){return!!(r[s]||r.checkboxDisabled)}}}const Qr={allowCheckingNotLoaded:Boolean,filter:Function,defaultExpandAll:Boolean,expandedKeys:Array,keyField:{type:String,default:"key"},labelField:{type:String,default:"label"},childrenField:{type:String,default:"children"},disabledField:{type:String,default:"disabled"},defaultExpandedKeys:{type:Array,default:()=>[]},indeterminateKeys:Array,renderSwitcherIcon:Function,onUpdateIndeterminateKeys:[Function,Array],"onUpdate:indeterminateKeys":[Function,Array],onUpdateExpandedKeys:[Function,Array],"onUpdate:expandedKeys":[Function,Array],overrideDefaultNodeClickBehavior:Function},Xr=Object.assign(Object.assign(Object.assign(Object.assign({},ze.props),{accordion:Boolean,showIrrelevantNodes:{type:Boolean,default:!0},data:{type:Array,default:()=>[]},expandOnDragenter:{type:Boolean,default:!0},expandOnClick:Boolean,checkOnClick:{type:[Boolean,Function],default:!1},cancelable:{type:Boolean,default:!0},checkable:Boolean,draggable:Boolean,blockNode:Boolean,blockLine:Boolean,showLine:Boolean,disabled:Boolean,checkedKeys:Array,defaultCheckedKeys:{type:Array,default:()=>[]},selectedKeys:Array,defaultSelectedKeys:{type:Array,default:()=>[]},multiple:Boolean,pattern:{type:String,default:""},onLoad:Function,cascade:Boolean,selectable:{type:Boolean,default:!0},scrollbarProps:Object,indent:{type:Number,default:24},allowDrop:{type:Function,default:zr},animated:{type:Boolean,default:!0},checkboxPlacement:{type:String,default:"left"},virtualScroll:Boolean,watchProps:Array,renderLabel:Function,renderPrefix:Function,renderSuffix:Function,nodeProps:Function,keyboard:{type:Boolean,default:!0},getChildren:Function,onDragenter:[Function,Array],onDragleave:[Function,Array],onDragend:[Function,Array],onDragstart:[Function,Array],onDragover:[Function,Array],onDrop:[Function,Array],onUpdateCheckedKeys:[Function,Array],"onUpdate:checkedKeys":[Function,Array],onUpdateSelectedKeys:[Function,Array],"onUpdate:selectedKeys":[Function,Array]}),Qr),{internalTreeSelect:Boolean,internalScrollable:Boolean,internalScrollablePadding:String,internalRenderEmpty:Function,internalHighlightKeySet:Object,internalUnifySelectCheck:Boolean,internalCheckboxFocusable:{type:Boolean,default:!0},internalFocusable:{type:Boolean,default:!0},checkStrategy:{type:String,default:"all"},leafOnly:Boolean}),Zr=Q({name:"Tree",props:Xr,slots:Object,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:s,mergedRtlRef:o}=ut(e),a=ft("Tree",o,t),r=ze("Tree","-tree",Gr,Ir,e,t),u=le(null),l=le(null),v=le(null);function x(){var n;return(n=v.value)===null||n===void 0?void 0:n.listElRef}function c(){var n;return(n=v.value)===null||n===void 0?void 0:n.itemsElRef}const w=F(()=>{const{filter:n}=e;if(n)return n;const{labelField:b}=e;return(D,L)=>{if(!D.length)return!0;const T=L[b];return typeof T=="string"?T.toLowerCase().includes(D.toLowerCase()):!1}}),f=F(()=>{const{pattern:n}=e;return n?!n.length||!w.value?{filteredTree:e.data,highlightKeySet:null,expandedKeys:void 0}:qr(e.data,w.value,n,e.keyField,e.childrenField):{filteredTree:e.data,highlightKeySet:null,expandedKeys:void 0}}),P=F(()=>un(e.showIrrelevantNodes?e.data:f.value.filteredTree,mn(e.keyField,e.childrenField,e.disabledField,e.getChildren))),y=Oe(zn,null),k=e.internalTreeSelect?y.dataTreeMate:F(()=>e.showIrrelevantNodes?P.value:un(e.data,mn(e.keyField,e.childrenField,e.disabledField,e.getChildren))),{watchProps:m}=e,C=le([]);m!=null&&m.includes("defaultCheckedKeys")?$e(()=>{C.value=e.defaultCheckedKeys}):C.value=e.defaultCheckedKeys;const N=V(e,"checkedKeys"),$=st(N,C),p=F(()=>k.value.getCheckedKeys($.value,{cascade:e.cascade,allowNotLoaded:e.allowCheckingNotLoaded})),i=jr(e),h=F(()=>p.value.checkedKeys),_=F(()=>{const{indeterminateKeys:n}=e;return n!==void 0?n:p.value.indeterminateKeys}),g=le([]);m!=null&&m.includes("defaultSelectedKeys")?$e(()=>{g.value=e.defaultSelectedKeys}):g.value=e.defaultSelectedKeys;const z=V(e,"selectedKeys"),B=st(z,g),A=le([]),ee=n=>{A.value=e.defaultExpandAll?k.value.getNonLeafKeys():n===void 0?e.defaultExpandedKeys:n};m!=null&&m.includes("defaultExpandedKeys")?$e(()=>{ee(void 0)}):$e(()=>{ee(e.defaultExpandedKeys)});const Pe=V(e,"expandedKeys"),se=st(Pe,A),fe=F(()=>P.value.getFlattenedNodes(se.value)),{pendingNodeKeyRef:be,handleKeydown:pe}=Or({props:e,mergedCheckedKeysRef:$,mergedSelectedKeysRef:B,fNodesRef:fe,mergedExpandedKeysRef:se,handleCheck:Pt,handleSelect:Dt,handleSwitcherClick:Qt});let ye=null,j=null;const Ae=le(new Set),he=F(()=>e.internalHighlightKeySet||f.value.highlightKeySet),Ue=st(he,Ae),E=le(new Set),q=F(()=>se.value.filter(n=>!E.value.has(n)));let te=0;const re=le(null),ge=le(null),vt=le(null),pt=le(null),mt=le(0),jn=F(()=>{const{value:n}=ge;return n?n.parent:null});let Nt=!1;Le(V(e,"data"),()=>{Nt=!0,Je(()=>{Nt=!1}),E.value.clear(),be.value=null,lt()},{deep:!1});let _t=!1;const Rt=()=>{_t=!0,Je(()=>{_t=!1})};let rt;Le(V(e,"pattern"),(n,b)=>{if(e.showIrrelevantNodes)if(rt=void 0,n){const{expandedKeys:D,highlightKeySet:L}=Wr(e.data,e.pattern,e.keyField,e.childrenField,w.value);Ae.value=L,Rt(),We(D,xe(D),{node:null,action:"filter"})}else Ae.value=new Set;else if(!n.length)rt!==void 0&&(Rt(),We(rt,xe(rt),{node:null,action:"filter"}));else{b.length||(rt=se.value);const{expandedKeys:D}=f.value;D!==void 0&&(Rt(),We(D,xe(D),{node:null,action:"filter"}))}});function Gt(n){return Yr(this,void 0,void 0,function*(){const{onLoad:b}=e;if(!b){yield Promise.resolve();return}const{value:D}=E;if(!D.has(n.key)){D.add(n.key);try{(yield b(n.rawNode))===!1&&qe()}catch(L){console.error(L),qe()}D.delete(n.key)}})}$e(()=>{var n;const{value:b}=P;if(!b)return;const{getNode:D}=b;(n=se.value)===null||n===void 0||n.forEach(L=>{const T=D(L);T&&!T.shallowLoaded&&Gt(T)})});const je=le(!1),Ie=le([]);Le(q,(n,b)=>{if(!e.animated||_t){Je(bt);return}if(Nt)return;const D=it(r.value.self.nodeHeight),L=new Set(b);let T=null,ne=null;for(const Y of n)if(!L.has(Y)){if(T!==null)return;T=Y}const me=new Set(n);for(const Y of b)if(!me.has(Y)){if(ne!==null)return;ne=Y}if(T===null&&ne===null)return;const{virtualScroll:ke}=e,Ge=(ke?v.value.listElRef:u.value).offsetHeight,Ye=Math.ceil(Ge/D)+1;let we;if(T!==null&&(we=b),ne!==null&&(we===void 0?we=n:we=we.filter(Y=>Y!==ne)),je.value=!0,Ie.value=P.value.getFlattenedNodes(we),T!==null){const Y=Ie.value.findIndex(Ce=>Ce.key===T);if(~Y){const Ce=Ie.value[Y].children;if(Ce){const Se=fn(Ce,n);Ie.value.splice(Y+1,0,{__motion:!0,mode:"expand",height:ke?Se.length*D:void 0,nodes:ke?Se.slice(0,Ye):Se})}}}if(ne!==null){const Y=Ie.value.findIndex(Ce=>Ce.key===ne);if(~Y){const Ce=Ie.value[Y].children;if(!Ce)return;je.value=!0;const Se=fn(Ce,n);Ie.value.splice(Y+1,0,{__motion:!0,mode:"collapse",height:ke?Se.length*D:void 0,nodes:ke?Se.slice(0,Ye):Se})}}});const Wn=F(()=>lr(fe.value)),qn=F(()=>je.value?Ie.value:fe.value);function bt(){const{value:n}=l;n&&n.sync()}function Vn(){je.value=!1,e.virtualScroll&&Je(bt)}function xe(n){const{getNode:b}=k.value;return n.map(D=>{var L;return((L=b(D))===null||L===void 0?void 0:L.rawNode)||null})}function We(n,b,D){const{"onUpdate:expandedKeys":L,onUpdateExpandedKeys:T}=e;A.value=n,L&&ae(L,n,b,D),T&&ae(T,n,b,D)}function Yt(n,b,D){const{"onUpdate:checkedKeys":L,onUpdateCheckedKeys:T}=e;C.value=n,T&&ae(T,n,b,D),L&&ae(L,n,b,D)}function Gn(n,b){const{"onUpdate:indeterminateKeys":D,onUpdateIndeterminateKeys:L}=e;D&&ae(D,n,b),L&&ae(L,n,b)}function $t(n,b,D){const{"onUpdate:selectedKeys":L,onUpdateSelectedKeys:T}=e;g.value=n,T&&ae(T,n,b,D),L&&ae(L,n,b,D)}function Yn(n){const{onDragenter:b}=e;b&&ae(b,n)}function Qn(n){const{onDragleave:b}=e;b&&ae(b,n)}function Xn(n){const{onDragend:b}=e;b&&ae(b,n)}function Zn(n){const{onDragstart:b}=e;b&&ae(b,n)}function Jn(n){const{onDragover:b}=e;b&&ae(b,n)}function eo(n){const{onDrop:b}=e;b&&ae(b,n)}function lt(){to(),Be()}function to(){re.value=null}function Be(){mt.value=0,ge.value=null,vt.value=null,pt.value=null,qe()}function qe(){ye&&(window.clearTimeout(ye),ye=null),j=null}function Pt(n,b){if(e.disabled||Ke(n,e.disabledField))return;if(e.internalUnifySelectCheck&&!e.multiple){Dt(n);return}const D=b?"check":"uncheck",{checkedKeys:L,indeterminateKeys:T}=k.value[D](n.key,h.value,{cascade:e.cascade,checkStrategy:i.value,allowNotLoaded:e.allowCheckingNotLoaded});Yt(L,xe(L),{node:n.rawNode,action:D}),Gn(T,xe(T))}function no(n){if(e.disabled)return;const{key:b}=n,{value:D}=se,L=D.findIndex(T=>T===b);if(~L){const T=Array.from(D);T.splice(L,1),We(T,xe(T),{node:n.rawNode,action:"collapse"})}else{const T=P.value.getNode(b);if(!T||T.isLeaf)return;let ne;if(e.accordion){const me=new Set(n.siblings.map(({key:ke})=>ke));ne=D.filter(ke=>!me.has(ke)),ne.push(b)}else ne=D.concat(b);We(ne,xe(ne),{node:n.rawNode,action:"expand"})}}function Qt(n){e.disabled||je.value||no(n)}function Dt(n){if(!(e.disabled||!e.selectable)){if(be.value=n.key,e.internalUnifySelectCheck){const{value:{checkedKeys:b,indeterminateKeys:D}}=p;e.multiple?Pt(n,!(b.includes(n.key)||D.includes(n.key))):Yt([n.key],xe([n.key]),{node:n.rawNode,action:"check"})}if(e.multiple){const b=Array.from(B.value),D=b.findIndex(L=>L===n.key);~D?e.cancelable&&b.splice(D,1):~D||b.push(n.key),$t(b,xe(b),{node:n.rawNode,action:~D?"unselect":"select"})}else B.value.includes(n.key)?e.cancelable&&$t([],[],{node:n.rawNode,action:"unselect"}):$t([n.key],xe([n.key]),{node:n.rawNode,action:"select"})}}function oo(n){if(ye&&(window.clearTimeout(ye),ye=null),n.isLeaf)return;j=n.key;const b=()=>{if(j!==n.key)return;const{value:D}=vt;if(D&&D.key===n.key&&!se.value.includes(n.key)){const L=se.value.concat(n.key);We(L,xe(L),{node:n.rawNode,action:"expand"})}ye=null,j=null};n.shallowLoaded?ye=window.setTimeout(()=>{b()},1e3):ye=window.setTimeout(()=>{Gt(n).then(()=>{b()})},1e3)}function ro({event:n,node:b}){!e.draggable||e.disabled||Ke(b,e.disabledField)||(Xt({event:n,node:b},!1),Yn({event:n,node:b.rawNode}))}function lo({event:n,node:b}){!e.draggable||e.disabled||Ke(b,e.disabledField)||Qn({event:n,node:b.rawNode})}function io(n){n.target===n.currentTarget&&Be()}function ao({event:n,node:b}){lt(),!(!e.draggable||e.disabled||Ke(b,e.disabledField))&&Xn({event:n,node:b.rawNode})}function so({event:n,node:b}){!e.draggable||e.disabled||Ke(b,e.disabledField)||(te=n.clientX,re.value=b,Zn({event:n,node:b.rawNode}))}function Xt({event:n,node:b},D=!0){var L;if(!e.draggable||e.disabled||Ke(b,e.disabledField))return;const{value:T}=re;if(!T)return;const{allowDrop:ne,indent:me}=e;D&&Jn({event:n,node:b.rawNode});const ke=n.currentTarget,{height:Ge,top:Ye}=ke.getBoundingClientRect(),we=n.clientY-Ye;let Y;ne({node:b.rawNode,dropPosition:"inside",phase:"drag"})?we<=8?Y="before":we>=Ge-8?Y="after":Y="inside":we<=Ge/2?Y="before":Y="after";const{value:Se}=Wn;let G,de;const Qe=Se(b.key);if(Qe===null){Be();return}let yt=!1;Y==="inside"?(G=b,de="inside"):Y==="before"?b.isFirstChild?(G=b,de="before"):(G=fe.value[Qe-1],de="after"):(G=b,de="after"),!G.isLeaf&&se.value.includes(G.key)&&(yt=!0,de==="after"&&(G=fe.value[Qe+1],G?de="before":(G=b,de="inside")));const Jt=G;if(vt.value=Jt,!yt&&T.isLastChild&&T.key===G.key&&(de="after"),de==="after"){let en=te-n.clientX,It=0;for(;en>=me/2&&G.parent!==null&&G.isLastChild&&It<1;)en-=me,It+=1,G=G.parent;mt.value=It}else mt.value=0;if((T.contains(G)||de==="inside"&&((L=T.parent)===null||L===void 0?void 0:L.key)===G.key)&&!(T.key===Jt.key&&T.key===G.key)){Be();return}if(!ne({node:G.rawNode,dropPosition:de,phase:"drag"})){Be();return}if(T.key===G.key)qe();else if(j!==G.key)if(de==="inside"){if(e.expandOnDragenter){if(oo(G),!G.shallowLoaded&&j!==G.key){lt();return}}else if(!G.shallowLoaded){lt();return}}else qe();else de!=="inside"&&qe();pt.value=de,ge.value=G}function co({event:n,node:b,dropPosition:D}){if(!e.draggable||e.disabled||Ke(b,e.disabledField))return;const{value:L}=re,{value:T}=ge,{value:ne}=pt;if(!(!L||!T||!ne)&&e.allowDrop({node:T.rawNode,dropPosition:ne,phase:"drag"})&&L.key!==T.key){if(ne==="before"){const me=L.getNext({includeDisabled:!0});if(me&&me.key===T.key){Be();return}}if(ne==="after"){const me=L.getPrev({includeDisabled:!0});if(me&&me.key===T.key){Be();return}}eo({event:n,node:T.rawNode,dragNode:L.rawNode,dropPosition:D}),lt()}}function uo(){bt()}function fo(){bt()}function ho(n){var b;if(e.virtualScroll||e.internalScrollable){const{value:D}=l;if(!((b=D==null?void 0:D.containerRef)===null||b===void 0)&&b.contains(n.relatedTarget))return;be.value=null}else{const{value:D}=u;if(D!=null&&D.contains(n.relatedTarget))return;be.value=null}}Le(be,n=>{var b,D;if(n!==null){if(e.virtualScroll)(b=v.value)===null||b===void 0||b.scrollTo({key:n});else if(e.internalScrollable){const{value:L}=l;if(L===null)return;const T=(D=L.contentRef)===null||D===void 0?void 0:D.querySelector(`[data-key="${Tn(n)}"]`);if(!T)return;L.scrollTo({el:T})}}}),Ot(gt,{loadingKeysRef:E,highlightKeySetRef:Ue,displayedCheckedKeysRef:h,displayedIndeterminateKeysRef:_,mergedSelectedKeysRef:B,mergedExpandedKeysRef:se,mergedThemeRef:r,mergedCheckStrategyRef:i,nodePropsRef:V(e,"nodeProps"),disabledRef:V(e,"disabled"),checkableRef:V(e,"checkable"),selectableRef:V(e,"selectable"),expandOnClickRef:V(e,"expandOnClick"),onLoadRef:V(e,"onLoad"),draggableRef:V(e,"draggable"),blockLineRef:V(e,"blockLine"),indentRef:V(e,"indent"),cascadeRef:V(e,"cascade"),checkOnClickRef:V(e,"checkOnClick"),checkboxPlacementRef:e.checkboxPlacement,droppingMouseNodeRef:vt,droppingNodeParentRef:jn,draggingNodeRef:re,droppingPositionRef:pt,droppingOffsetLevelRef:mt,fNodesRef:fe,pendingNodeKeyRef:be,showLineRef:V(e,"showLine"),disabledFieldRef:V(e,"disabledField"),internalScrollableRef:V(e,"internalScrollable"),internalCheckboxFocusableRef:V(e,"internalCheckboxFocusable"),internalTreeSelect:e.internalTreeSelect,renderLabelRef:V(e,"renderLabel"),renderPrefixRef:V(e,"renderPrefix"),renderSuffixRef:V(e,"renderSuffix"),renderSwitcherIconRef:V(e,"renderSwitcherIcon"),labelFieldRef:V(e,"labelField"),multipleRef:V(e,"multiple"),overrideDefaultNodeClickBehaviorRef:V(e,"overrideDefaultNodeClickBehavior"),handleSwitcherClick:Qt,handleDragEnd:ao,handleDragEnter:ro,handleDragLeave:lo,handleDragStart:so,handleDrop:co,handleDragOver:Xt,handleSelect:Dt,handleCheck:Pt});function go(n,b){var D,L;typeof n=="number"?(D=v.value)===null||D===void 0||D.scrollTo(n,b||0):(L=v.value)===null||L===void 0||L.scrollTo(n)}const vo={handleKeydown:pe,scrollTo:go,getCheckedData:()=>{if(!e.checkable)return{keys:[],options:[]};const{checkedKeys:n}=p.value;return{keys:n,options:xe(n)}},getIndeterminateData:()=>{if(!e.checkable)return{keys:[],options:[]};const{indeterminateKeys:n}=p.value;return{keys:n,options:xe(n)}}},Zt=F(()=>{const{common:{cubicBezierEaseInOut:n},self:{fontSize:b,nodeBorderRadius:D,nodeColorHover:L,nodeColorPressed:T,nodeColorActive:ne,arrowColor:me,loadingColor:ke,nodeTextColor:Ge,nodeTextColorDisabled:Ye,dropMarkColor:we,nodeWrapperPadding:Y,nodeHeight:Ce,lineHeight:Se,lineColor:G}}=r.value,de=Lt(Y,"top"),Qe=Lt(Y,"bottom"),yt=Nn(it(Ce)-it(de)-it(Qe));return{"--n-arrow-color":me,"--n-loading-color":ke,"--n-bezier":n,"--n-font-size":b,"--n-node-border-radius":D,"--n-node-color-active":ne,"--n-node-color-hover":L,"--n-node-color-pressed":T,"--n-node-text-color":Ge,"--n-node-text-color-disabled":Ye,"--n-drop-mark-color":we,"--n-node-wrapper-padding":Y,"--n-line-offset-top":`-${de}`,"--n-line-offset-bottom":`-${Qe}`,"--n-node-content-height":yt,"--n-line-height":Se,"--n-line-color":G}}),Ve=s?Ht("tree",void 0,Zt,e):void 0;return Object.assign(Object.assign({},vo),{mergedClsPrefix:t,mergedTheme:r,rtlEnabled:a,fNodes:qn,aip:je,selfElRef:u,virtualListInstRef:v,scrollbarInstRef:l,handleFocusout:ho,handleDragLeaveTree:io,handleScroll:uo,getScrollContainer:x,getScrollContent:c,handleAfterEnter:Vn,handleResize:fo,cssVars:s?void 0:Zt,themeClass:Ve==null?void 0:Ve.themeClass,onRender:Ve==null?void 0:Ve.onRender})},render(){var e;const{fNodes:t,internalRenderEmpty:s}=this;if(!t.length&&s)return s();const{mergedClsPrefix:o,blockNode:a,blockLine:r,draggable:u,disabled:l,internalFocusable:v,checkable:x,handleKeydown:c,rtlEnabled:w,handleFocusout:f,scrollbarProps:P}=this,y=v&&!l,k=y?"0":void 0,m=[`${o}-tree`,w&&`${o}-tree--rtl`,x&&`${o}-tree--checkable`,(r||a)&&`${o}-tree--block-node`,r&&`${o}-tree--block-line`],C=$=>"__motion"in $?I(Vr,{height:$.height,nodes:$.nodes,clsPrefix:o,mode:$.mode,onAfterEnter:this.handleAfterEnter}):I(Mn,{key:$.key,tmNode:$,clsPrefix:o});if(this.virtualScroll){const{mergedTheme:$,internalScrollablePadding:p}=this,i=Lt(p||"0");return I(nn,Object.assign({},P,{ref:"scrollbarInstRef",onDragleave:u?this.handleDragLeaveTree:void 0,container:this.getScrollContainer,content:this.getScrollContent,class:m,theme:$.peers.Scrollbar,themeOverrides:$.peerOverrides.Scrollbar,tabindex:k,onKeydown:y?c:void 0,onFocusout:y?f:void 0}),{default:()=>{var h;return(h=this.onRender)===null||h===void 0||h.call(this),t.length?I(rr,{ref:"virtualListInstRef",items:this.fNodes,itemSize:it($.self.nodeHeight),ignoreItemResize:this.aip,paddingTop:i.top,paddingBottom:i.bottom,class:this.themeClass,style:[this.cssVars,{paddingLeft:i.left,paddingRight:i.right}],onScroll:this.handleScroll,onResize:this.handleResize,showScrollbar:!1,itemResizable:!0},{default:({item:_})=>C(_)}):on(this.$slots.empty,()=>[I(hn,{class:`${o}-tree__empty`,theme:this.mergedTheme.peers.Empty,themeOverrides:this.mergedTheme.peerOverrides.Empty})])}})}const{internalScrollable:N}=this;return m.push(this.themeClass),(e=this.onRender)===null||e===void 0||e.call(this),N?I(nn,Object.assign({},P,{class:m,tabindex:k,onKeydown:y?c:void 0,onFocusout:y?f:void 0,style:this.cssVars,contentStyle:{padding:this.internalScrollablePadding}}),{default:()=>I("div",{onDragleave:u?this.handleDragLeaveTree:void 0,ref:"selfElRef"},this.fNodes.map(C))}):I("div",{class:m,tabindex:k,ref:"selfElRef",style:this.cssVars,onKeydown:y?c:void 0,onFocusout:y?f:void 0,onDragleave:u?this.handleDragLeaveTree:void 0},t.length?t.map(C):on(this.$slots.empty,()=>[I(hn,{class:`${o}-tree__empty`,theme:this.mergedTheme.peers.Empty,themeOverrides:this.mergedTheme.peerOverrides.Empty})]))}}),bn=e=>{const t=Z(),s={x:0,y:0},o=jt({...s});let a;const r=c=>{a&&c.preventDefault()},u=c=>{a=c,s.x=o.x,s.y=o.y},l=c=>{if(!a||!t.value)return;const w=c.clientX-a.clientX,f=c.clientY-a.clientY;e(w)&&(o.x=s.x+w),o.y=s.y+f},v=()=>{a=void 0},x=()=>{if(!t.value||!a)return;v();const{top:c,bottom:w,left:f,right:P}=t.value.getBoundingClientRect();(P<0||f>window.innerWidth||w<0||c>window.innerHeight)&&(o.x=s.x,o.y=s.y)};return Ct(()=>{window.addEventListener("pointermove",l),window.addEventListener("pointerup",x),document.addEventListener("selectstart",r)}),kt(()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",x),document.removeEventListener("selectstart",r),v()}),Le(t,(c,w)=>{c&&(c.addEventListener("pointerdown",u),c.addEventListener("pointerup",v)),w&&(w.removeEventListener("pointerdown",u),w.removeEventListener("pointerup",v))}),kt(()=>{t.value&&(t.value.removeEventListener("pointerdown",u),t.value.removeEventListener("pointerup",v))}),{target:t,offset:o}};let at=1e3;const Jr=()=>{at++;const e=Z(at);return{zIndex:e,setTop:()=>{e.value!==at&&(at++,e.value=at)}}},yn="transition-top,bottom,left,right-500",St=Q({__name:"DraggableCard",props:{initialValue:{default:()=>({})},minWidth:{},sizeDraggable:{type:Boolean},show:{type:Boolean,default:!0},class:{}},setup(e){var i,h;const t=e,s=t.initialValue.left!==void 0,o=t.initialValue.top!==void 0,a={x:(i=s?t.initialValue.left:t.initialValue.right)!=null?i:0,y:(h=o?t.initialValue.top:t.initialValue.bottom)!=null?h:0},r=bn(_=>{const g=(t.initialValue.width||0)+u.offset.x+-r.offset.x-_;return(t.minWidth||0)<g}),u=bn(_=>{const g=(t.initialValue.width||0)+u.offset.x+_-r.offset.x;return(t.minWidth||0)<g}),l=jt({...a}),v=F(()=>{const _=(t.initialValue.width||0)+u.offset.x-r.offset.x,g=t.initialValue.width?`width:${_}px;`:"",z=o?`top:${l.y}px;`:`bottom:${l.y}px;`;return s?`left:${l.x-r.offset.x}px;`+z+g:`right:${l.x-u.offset.x}px;`+z+g});let x;const c=Z(!1),w=_=>{x=_,a.x=l.x,a.y=l.y,c.value=!1},f=_=>{if(!k.value||!x)return;const g=_.clientX-x.clientX,z=_.clientY-x.clientY;l.x=a.x+(s?g:-g),l.y=a.y+(o?z:-z),c.value=!0},P=()=>{x=void 0},y=Z(),k=Z(),m=_=>{x&&_.preventDefault()},C=()=>{if(!k.value||!x)return;P();const{top:_,bottom:g,left:z,right:B}=k.value.getBoundingClientRect();if(B<0||z>window.innerWidth||g<0||_>window.innerHeight){l.x=a.x,l.y=a.y;const A=y.value;A&&(A.classList.add(yn),setTimeout(()=>{A.classList.remove(yn)},550))}};Ct(()=>{window.addEventListener("pointermove",f),window.addEventListener("pointerup",C),document.addEventListener("selectstart",m)}),kt(()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",C),document.removeEventListener("selectstart",m),P()}),Le(k,(_,g)=>{_&&(_.addEventListener("pointerdown",w),_.addEventListener("pointerup",P)),g&&(g.removeEventListener("pointerdown",w),g.removeEventListener("pointerup",P))}),kt(()=>{k.value&&(k.value.removeEventListener("pointerdown",w),k.value.removeEventListener("pointerup",P))});const N=_=>{_ instanceof HTMLElement?k.value=_:k.value=void 0},{setTop:$,zIndex:p}=Jr();return Le(()=>t.show,()=>{t.show&&$()}),(_,g)=>(U(),ie(_n,{to:"body"},[_.show?(U(),ce("div",{key:0,fixed:"",ref_key:"box",ref:y,class:wt(["DraggableCard",t.class]),style:Fe([d(v),{zIndex:d(p)}]),onMousedown:g[0]||(g[0]=(...z)=>d($)&&d($)(...z))},[To(_.$slots,"default",{onRef:N,moved:d(c)}),_.sizeDraggable?(U(),ce(Te,{key:0},[K("div",{ref:d(r).target,absolute:"","right-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512),K("div",{ref:d(u).target,absolute:"","left-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512)],64)):ve("",!0)],38)):ve("",!0)]))}}),el=async e=>fetch("https://detect.gkd.li/api/getImportId?id="+e).then(t=>t.json()).catch(()=>0),He=Fo("snapshot",()=>{const e=Rn(),t=$n(),s=Ao(),o=Pn(),{snapshotImportId:a,snapshotImageId:r,importSnapshotId:u}=o,l=Z();rn(()=>e.params.snapshotId,A=>{l.value=Bo(A)});const v=F(()=>{if(l.value)return a[l.value]}),x=F(()=>{if(l.value)return r[l.value]}),c=Z();$e(()=>{c.value&&(document.title="快照-"+(Ne(c.value).name||c.value.appId))});const w=Z(),f=F(()=>{if(w.value)return URL.createObjectURL(new Blob([w.value],{type:"image/png"}))}),P=Z(!1),y=ir(async A=>{if(P.value=!1,!A){c.value=void 0,w.value=void 0;return}if(await Promise.all([Jo.getItem(A).then(ee=>{c.value=ee||void 0}),er.getItem(A).then(ee=>{w.value=ee||void 0})]),!c.value){const ee=a[A]||await el(A);if(ee&&Number.isSafeInteger(ee)){P.value=!0,t.replace({path:"/i/"+ee,query:e.query});return}}}),k=F(()=>y.loading);rn(()=>l.value,y.invoke),$e(()=>{v.value&&o.inited&&!u[v.value]&&l.value&&(u[v.value]=l.value,fetch("https://detect.gkd.li/api/detectSnapshot?importId="+v.value))});const m=F(()=>tr()&&s.inited&&s.autoUploadImport&&o.inited);$e(()=>{m.value&&c.value&&!x.value&&Yo(c.value),m.value&&c.value&&!v.value&&Qo(c.value),m.value&&c.value&&v.value&&Xo(c.value.id,v.value)});const C=F(()=>c.value&&s.inited?c.value.nodes.length<=s.maxShowNodeSize?structuredClone(c.value.nodes):structuredClone(c.value.nodes.slice(0,s.maxShowNodeSize)):[]),N=F(()=>{if(C.value.length)return qo(C.value)}),$=F(()=>c.value?c.value.nodes.length-s.maxShowNodeSize:0),p=Z(),i=Z(0),h=Z(),_=Z(),g=async A=>{p.value=A,i.value=Date.now(),await Je(),_.value&&!_.value.includes(A)&&(h.value=void 0,_.value=void 0)};$e(()=>{N.value&&g(N.value)});const z=A=>{h.value=A;const ee=Vo(C.value,h.value);ee.length&&g(ee[0]),ee.length>1&&(_.value=ee)},B=Z();return{snapshotId:l,snapshot:c,rootNode:N,screenshotUrl:f,loading:k,redirected:P,importId:v,imageId:x,focusNode:p,updateFocusNode:g,focusTime:i,overlapNodes:_,missNodeSize:$,focusPosition:h,updatePosition:z,track:B}}),tl={absolute:"","top-0":"","right-0":"","pt-4px":"","pr-8px":""},nl={key:0,flex:"","justify-between":"","items-center":""},ol={flex:"","items-center":"","h-24px":"","px-2px":""},rl={"max-w-500px":""},ll=Q({__name:"AttrCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const{focusNode:t}=Me(He()),s=F(()=>{const u=t.value;return u?{_id:{desc:"虚拟属性(真机不可用):生成快照访问节点顺序",type:"info",show:!0},_pid:{desc:"虚拟属性(真机不可用):父节点的 _id",type:"info",show:!0},_selector:{desc:"自动生成的选择器, 点击“_selector”可直接复制内容, 用于定位",type:"info",show:!0},depth:{desc:"使用此属性在某些应用上可能造成无限节点错误",type:"info",show:!0},id:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.idQf)&&u.attr.id)},vid:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.idQf)&&u.attr.vid)},text:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.textQf)&&u.attr.text)}}:{}}),o=["text","desc"],a=F(()=>t.value?Object.entries(t.value.attr).map(([u,l])=>{var x,c,w;const v={name:u,value:l,desc:JSON.stringify(l),tip:(x=s.value[u])!=null&&x.show?s.value[u]:void 0};return o.includes(u)?[v,{name:u+".length",value:(c=l==null?void 0:l.length)!=null?c:null,desc:JSON.stringify((w=l==null?void 0:l.length)!=null?w:null),tip:void 0}]:v}).flat():[]),r=F(()=>t.value?Go(t.value):"");return(u,l)=>{const v=ot("SvgIcon"),x=ht,c=Dn,w=qt,f=Ar,P=ar,y=Br,k=Fr,m=Tr;return U(),ie(St,{initialValue:{top:40,right:10},class:"box-shadow-dim",show:u.show&&!!d(t)},{default:S(({onRef:C})=>[K("div",tl,[R(x,{onClick:l[0]||(l[0]=N=>u.onUpdateShow(!u.show)),text:"",title:"最小化"},{icon:S(()=>[R(v,{name:"minus"})]),_:1})]),d(t)?(U(),ie(m,{key:0,size:"small",striped:"",singleLine:!1,class:"gkd_code",themeOverrides:{thPaddingSmall:"1px 3px",tdPaddingSmall:"0px 3px"}},{default:S(()=>[K("thead",null,[K("tr",{ref:C,"cursor-move":""},l[2]||(l[2]=[K("th",null,"Name",-1),K("th",null,"Value",-1)]),512)]),R(k,null,{default:S(()=>[(U(!0),ce(Te,null,dt(d(a),N=>(U(),ie(y,{key:N.name},{default:S(()=>[R(f,{onClick:$=>d(Re)(`${N.name}=${N.desc}`)},{default:S(()=>[N.tip?(U(),ce("div",nl,[K("div",null,W(N.name),1),R(w,null,{trigger:S(()=>[R(c,{size:"16"},{default:S(()=>[N.tip.type=="info"?(U(),ie(v,{key:0,name:"info"})):N.tip.type=="quickFind"?(U(),ie(v,{key:1,name:"ok"})):ve("",!0)]),_:2},1024)]),default:S(()=>[J(" "+W(N.tip.desc),1)]),_:2},1024)])):(U(),ce(Te,{key:1},[J(W(N.name),1)],64))]),_:2},1032,["onClick"]),R(f,null,{default:S(()=>[R(P,{class:wt(["w-[calc(var(--gkd-w)*0.12)]",{"text-left direction-rtl":N.name=="id","opacity-50":N.value===null}])},{default:S(()=>[J(W(N.desc),1)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024))),128)),R(y,null,{default:S(()=>[R(f,{colspan:"2"},{default:S(()=>[K("div",ol,[R(w,null,{trigger:S(()=>[R(x,{text:"",onClick:l[1]||(l[1]=N=>d(Re)(d(r)))},{icon:S(()=>[R(c,{size:"20"},{default:S(()=>[R(v,{name:"path"})]),_:1})]),_:1})]),default:S(()=>[K("div",rl,W(d(r)),1)]),_:1})])]),_:1})]),_:1})]),_:1})]),_:2},1024)):ve("",!0)]),_:1},8,["show"])}}}),il={bg:"#eee","px-2px":""},al=Q({__name:"OverlapCard",setup(e){const t=He(),{focusNode:s,overlapNodes:o,focusPosition:a}=Me(t),u=document.documentElement.scrollWidth/100*25.5;return(l,v)=>{const x=ht,c=In,w=zo;return U(),ie(St,{initialValue:{top:215,left:u},class:"box-shadow-dim w-420px",show:!!(d(o)&&d(a))},{default:S(({onRef:f})=>[d(o)&&d(a)?(U(),ie(w,{key:0,size:"small",closable:"",onClose:v[0]||(v[0]=P=>o.value=void 0)},{header:S(()=>[K("div",{ref:f,"cursor-move":""},[v[1]||(v[1]=J(" 位置 ")),K("span",il,W(`${d(a).x.toFixed(0)},${d(a).y.toFixed()}`),1),J(" 存在 "+W(d(o).length)+" 个层叠节点 ",1)],512)]),default:S(()=>[R(c,{style:{"max-height":"400px","overflow-y":"scroll","padding-bottom":"10px"},class:"scrollbar-hidden"},{default:S(()=>[(U(!0),ce(Te,null,dt(d(o),P=>(U(),ie(x,{key:P.id,onClick:y=>d(t).updateFocusNode(P),size:"small",style:Fe(d(ct)(P,d(s)))},{default:S(()=>[J(W(d(nt)(P)),1)]),_:2},1032,["onClick","style"]))),128))]),_:1})]),_:2},1024)):ve("",!0)]),_:1},8,["initialValue","show"])}}}),Vt=Oo(),Hn=F(()=>Vt.width.value/100),Un=F(()=>Math.max(1200,Vt.width.value));F(()=>Math.max(700,Vt.height.value));const sl={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},dl={flex:"","m-b-4px":"","pr-4px":""},cl={"min-h-24px":""},ul={key:0,"color-red":"","whitespace-pre":""},fl=Q({__name:"RuleCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const t=He(),s=Me(t),{rootNode:o,focusNode:a}=s,r=s.snapshot,u=Z(""),l=Mo(u,500),v=y=>{if(y==null)return[];if(typeof y=="string")return[y];if(Array.isArray(y)&&y.every(k=>typeof k=="string"))return y},x=y=>{const k=v(y.matches);if(!k)return"非法格式: matches";const m=v(y.anyMatches);if(!m)return"非法格式: anyMatches";const C=v(y.excludeMatches);if(!C)return"非法格式: excludeMatches";const N=[];for(let g=0;g<k.length;g++){const z=k[g];try{N.push(xt(z))}catch(B){const A=B instanceof Error?B.message:String(B);return`非法选择器: matches[${g}]
|
|
257
|
-
错误: ${A}`}}const $=N.map(
|
|
258
|
-
错误: ${A}`}}const i=
|
|
259
|
-
错误: ${A}`}}const _=
|
|
256
|
+
`)]),X("empty","margin: auto;")]);var Qr=function(e,t,s,o){function a(r){return r instanceof s?r:new s(function(u){u(r)})}return new(s||(s=Promise))(function(r,u){function l(c){try{x(o.next(c))}catch(w){u(w)}}function g(c){try{x(o.throw(c))}catch(w){u(w)}}function x(c){c.done?r(c.value):a(c.value).then(l,g)}x((o=o.apply(e,[])).next())})};function mn(e,t,s,o){return{getIsGroup(){return!1},getKey(r){return r[e]},getChildren:o||(r=>r[t]),getDisabled(r){return!!(r[s]||r.checkboxDisabled)}}}const Xr={allowCheckingNotLoaded:Boolean,filter:Function,defaultExpandAll:Boolean,expandedKeys:Array,keyField:{type:String,default:"key"},labelField:{type:String,default:"label"},childrenField:{type:String,default:"children"},disabledField:{type:String,default:"disabled"},defaultExpandedKeys:{type:Array,default:()=>[]},indeterminateKeys:Array,renderSwitcherIcon:Function,onUpdateIndeterminateKeys:[Function,Array],"onUpdate:indeterminateKeys":[Function,Array],onUpdateExpandedKeys:[Function,Array],"onUpdate:expandedKeys":[Function,Array],overrideDefaultNodeClickBehavior:Function},Zr=Object.assign(Object.assign(Object.assign(Object.assign({},ze.props),{accordion:Boolean,showIrrelevantNodes:{type:Boolean,default:!0},data:{type:Array,default:()=>[]},expandOnDragenter:{type:Boolean,default:!0},expandOnClick:Boolean,checkOnClick:{type:[Boolean,Function],default:!1},cancelable:{type:Boolean,default:!0},checkable:Boolean,draggable:Boolean,blockNode:Boolean,blockLine:Boolean,showLine:Boolean,disabled:Boolean,checkedKeys:Array,defaultCheckedKeys:{type:Array,default:()=>[]},selectedKeys:Array,defaultSelectedKeys:{type:Array,default:()=>[]},multiple:Boolean,pattern:{type:String,default:""},onLoad:Function,cascade:Boolean,selectable:{type:Boolean,default:!0},scrollbarProps:Object,indent:{type:Number,default:24},allowDrop:{type:Function,default:Or},animated:{type:Boolean,default:!0},checkboxPlacement:{type:String,default:"left"},virtualScroll:Boolean,watchProps:Array,renderLabel:Function,renderPrefix:Function,renderSuffix:Function,nodeProps:Function,keyboard:{type:Boolean,default:!0},getChildren:Function,onDragenter:[Function,Array],onDragleave:[Function,Array],onDragend:[Function,Array],onDragstart:[Function,Array],onDragover:[Function,Array],onDrop:[Function,Array],onUpdateCheckedKeys:[Function,Array],"onUpdate:checkedKeys":[Function,Array],onUpdateSelectedKeys:[Function,Array],"onUpdate:selectedKeys":[Function,Array]}),Xr),{internalTreeSelect:Boolean,internalScrollable:Boolean,internalScrollablePadding:String,internalRenderEmpty:Function,internalHighlightKeySet:Object,internalUnifySelectCheck:Boolean,internalCheckboxFocusable:{type:Boolean,default:!0},internalFocusable:{type:Boolean,default:!0},checkStrategy:{type:String,default:"all"},leafOnly:Boolean}),Jr=Q({name:"Tree",props:Zr,slots:Object,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:s,mergedRtlRef:o}=ut(e),a=ft("Tree",o,t),r=ze("Tree","-tree",Yr,Kr,e,t),u=ie(null),l=ie(null),g=ie(null);function x(){var n;return(n=g.value)===null||n===void 0?void 0:n.listElRef}function c(){var n;return(n=g.value)===null||n===void 0?void 0:n.itemsElRef}const w=F(()=>{const{filter:n}=e;if(n)return n;const{labelField:b}=e;return(D,L)=>{if(!D.length)return!0;const T=L[b];return typeof T=="string"?T.toLowerCase().includes(D.toLowerCase()):!1}}),f=F(()=>{const{pattern:n}=e;return n?!n.length||!w.value?{filteredTree:e.data,highlightKeySet:null,expandedKeys:void 0}:Vr(e.data,w.value,n,e.keyField,e.childrenField):{filteredTree:e.data,highlightKeySet:null,expandedKeys:void 0}}),P=F(()=>un(e.showIrrelevantNodes?e.data:f.value.filteredTree,mn(e.keyField,e.childrenField,e.disabledField,e.getChildren))),y=Oe(zn,null),k=e.internalTreeSelect?y.dataTreeMate:F(()=>e.showIrrelevantNodes?P.value:un(e.data,mn(e.keyField,e.childrenField,e.disabledField,e.getChildren))),{watchProps:p}=e,C=ie([]);p!=null&&p.includes("defaultCheckedKeys")?$e(()=>{C.value=e.defaultCheckedKeys}):C.value=e.defaultCheckedKeys;const N=V(e,"checkedKeys"),$=st(N,C),v=F(()=>k.value.getCheckedKeys($.value,{cascade:e.cascade,allowNotLoaded:e.allowCheckingNotLoaded})),i=Wr(e),m=F(()=>v.value.checkedKeys),_=F(()=>{const{indeterminateKeys:n}=e;return n!==void 0?n:v.value.indeterminateKeys}),h=ie([]);p!=null&&p.includes("defaultSelectedKeys")?$e(()=>{h.value=e.defaultSelectedKeys}):h.value=e.defaultSelectedKeys;const z=V(e,"selectedKeys"),B=st(z,h),A=ie([]),ee=n=>{A.value=e.defaultExpandAll?k.value.getNonLeafKeys():n===void 0?e.defaultExpandedKeys:n};p!=null&&p.includes("defaultExpandedKeys")?$e(()=>{ee(void 0)}):$e(()=>{ee(e.defaultExpandedKeys)});const Pe=V(e,"expandedKeys"),ae=st(Pe,A),fe=F(()=>P.value.getFlattenedNodes(ae.value)),{pendingNodeKeyRef:be,handleKeydown:pe}=Mr({props:e,mergedCheckedKeysRef:$,mergedSelectedKeysRef:B,fNodesRef:fe,mergedExpandedKeysRef:ae,handleCheck:Pt,handleSelect:Dt,handleSwitcherClick:Qt});let ye=null,j=null;const Ae=ie(new Set),he=F(()=>e.internalHighlightKeySet||f.value.highlightKeySet),Ue=st(he,Ae),E=ie(new Set),q=F(()=>ae.value.filter(n=>!E.value.has(n)));let te=0;const le=ie(null),ge=ie(null),vt=ie(null),pt=ie(null),mt=ie(0),jn=F(()=>{const{value:n}=ge;return n?n.parent:null});let Nt=!1;Te(V(e,"data"),()=>{Nt=!0,Je(()=>{Nt=!1}),E.value.clear(),be.value=null,lt()},{deep:!1});let _t=!1;const Rt=()=>{_t=!0,Je(()=>{_t=!1})};let rt;Te(V(e,"pattern"),(n,b)=>{if(e.showIrrelevantNodes)if(rt=void 0,n){const{expandedKeys:D,highlightKeySet:L}=qr(e.data,e.pattern,e.keyField,e.childrenField,w.value);Ae.value=L,Rt(),We(D,xe(D),{node:null,action:"filter"})}else Ae.value=new Set;else if(!n.length)rt!==void 0&&(Rt(),We(rt,xe(rt),{node:null,action:"filter"}));else{b.length||(rt=ae.value);const{expandedKeys:D}=f.value;D!==void 0&&(Rt(),We(D,xe(D),{node:null,action:"filter"}))}});function Gt(n){return Qr(this,void 0,void 0,function*(){const{onLoad:b}=e;if(!b){yield Promise.resolve();return}const{value:D}=E;if(!D.has(n.key)){D.add(n.key);try{(yield b(n.rawNode))===!1&&qe()}catch(L){console.error(L),qe()}D.delete(n.key)}})}$e(()=>{var n;const{value:b}=P;if(!b)return;const{getNode:D}=b;(n=ae.value)===null||n===void 0||n.forEach(L=>{const T=D(L);T&&!T.shallowLoaded&&Gt(T)})});const je=ie(!1),Ke=ie([]);Te(q,(n,b)=>{if(!e.animated||_t){Je(bt);return}if(Nt)return;const D=it(r.value.self.nodeHeight),L=new Set(b);let T=null,ne=null;for(const Y of n)if(!L.has(Y)){if(T!==null)return;T=Y}const me=new Set(n);for(const Y of b)if(!me.has(Y)){if(ne!==null)return;ne=Y}if(T===null&&ne===null)return;const{virtualScroll:ke}=e,Ge=(ke?g.value.listElRef:u.value).offsetHeight,Ye=Math.ceil(Ge/D)+1;let we;if(T!==null&&(we=b),ne!==null&&(we===void 0?we=n:we=we.filter(Y=>Y!==ne)),je.value=!0,Ke.value=P.value.getFlattenedNodes(we),T!==null){const Y=Ke.value.findIndex(Ce=>Ce.key===T);if(~Y){const Ce=Ke.value[Y].children;if(Ce){const Se=fn(Ce,n);Ke.value.splice(Y+1,0,{__motion:!0,mode:"expand",height:ke?Se.length*D:void 0,nodes:ke?Se.slice(0,Ye):Se})}}}if(ne!==null){const Y=Ke.value.findIndex(Ce=>Ce.key===ne);if(~Y){const Ce=Ke.value[Y].children;if(!Ce)return;je.value=!0;const Se=fn(Ce,n);Ke.value.splice(Y+1,0,{__motion:!0,mode:"collapse",height:ke?Se.length*D:void 0,nodes:ke?Se.slice(0,Ye):Se})}}});const Wn=F(()=>lr(fe.value)),qn=F(()=>je.value?Ke.value:fe.value);function bt(){const{value:n}=l;n&&n.sync()}function Vn(){je.value=!1,e.virtualScroll&&Je(bt)}function xe(n){const{getNode:b}=k.value;return n.map(D=>{var L;return((L=b(D))===null||L===void 0?void 0:L.rawNode)||null})}function We(n,b,D){const{"onUpdate:expandedKeys":L,onUpdateExpandedKeys:T}=e;A.value=n,L&&se(L,n,b,D),T&&se(T,n,b,D)}function Yt(n,b,D){const{"onUpdate:checkedKeys":L,onUpdateCheckedKeys:T}=e;C.value=n,T&&se(T,n,b,D),L&&se(L,n,b,D)}function Gn(n,b){const{"onUpdate:indeterminateKeys":D,onUpdateIndeterminateKeys:L}=e;D&&se(D,n,b),L&&se(L,n,b)}function $t(n,b,D){const{"onUpdate:selectedKeys":L,onUpdateSelectedKeys:T}=e;h.value=n,T&&se(T,n,b,D),L&&se(L,n,b,D)}function Yn(n){const{onDragenter:b}=e;b&&se(b,n)}function Qn(n){const{onDragleave:b}=e;b&&se(b,n)}function Xn(n){const{onDragend:b}=e;b&&se(b,n)}function Zn(n){const{onDragstart:b}=e;b&&se(b,n)}function Jn(n){const{onDragover:b}=e;b&&se(b,n)}function eo(n){const{onDrop:b}=e;b&&se(b,n)}function lt(){to(),Be()}function to(){le.value=null}function Be(){mt.value=0,ge.value=null,vt.value=null,pt.value=null,qe()}function qe(){ye&&(window.clearTimeout(ye),ye=null),j=null}function Pt(n,b){if(e.disabled||Ee(n,e.disabledField))return;if(e.internalUnifySelectCheck&&!e.multiple){Dt(n);return}const D=b?"check":"uncheck",{checkedKeys:L,indeterminateKeys:T}=k.value[D](n.key,m.value,{cascade:e.cascade,checkStrategy:i.value,allowNotLoaded:e.allowCheckingNotLoaded});Yt(L,xe(L),{node:n.rawNode,action:D}),Gn(T,xe(T))}function no(n){if(e.disabled)return;const{key:b}=n,{value:D}=ae,L=D.findIndex(T=>T===b);if(~L){const T=Array.from(D);T.splice(L,1),We(T,xe(T),{node:n.rawNode,action:"collapse"})}else{const T=P.value.getNode(b);if(!T||T.isLeaf)return;let ne;if(e.accordion){const me=new Set(n.siblings.map(({key:ke})=>ke));ne=D.filter(ke=>!me.has(ke)),ne.push(b)}else ne=D.concat(b);We(ne,xe(ne),{node:n.rawNode,action:"expand"})}}function Qt(n){e.disabled||je.value||no(n)}function Dt(n){if(!(e.disabled||!e.selectable)){if(be.value=n.key,e.internalUnifySelectCheck){const{value:{checkedKeys:b,indeterminateKeys:D}}=v;e.multiple?Pt(n,!(b.includes(n.key)||D.includes(n.key))):Yt([n.key],xe([n.key]),{node:n.rawNode,action:"check"})}if(e.multiple){const b=Array.from(B.value),D=b.findIndex(L=>L===n.key);~D?e.cancelable&&b.splice(D,1):~D||b.push(n.key),$t(b,xe(b),{node:n.rawNode,action:~D?"unselect":"select"})}else B.value.includes(n.key)?e.cancelable&&$t([],[],{node:n.rawNode,action:"unselect"}):$t([n.key],xe([n.key]),{node:n.rawNode,action:"select"})}}function oo(n){if(ye&&(window.clearTimeout(ye),ye=null),n.isLeaf)return;j=n.key;const b=()=>{if(j!==n.key)return;const{value:D}=vt;if(D&&D.key===n.key&&!ae.value.includes(n.key)){const L=ae.value.concat(n.key);We(L,xe(L),{node:n.rawNode,action:"expand"})}ye=null,j=null};n.shallowLoaded?ye=window.setTimeout(()=>{b()},1e3):ye=window.setTimeout(()=>{Gt(n).then(()=>{b()})},1e3)}function ro({event:n,node:b}){!e.draggable||e.disabled||Ee(b,e.disabledField)||(Xt({event:n,node:b},!1),Yn({event:n,node:b.rawNode}))}function lo({event:n,node:b}){!e.draggable||e.disabled||Ee(b,e.disabledField)||Qn({event:n,node:b.rawNode})}function io(n){n.target===n.currentTarget&&Be()}function ao({event:n,node:b}){lt(),!(!e.draggable||e.disabled||Ee(b,e.disabledField))&&Xn({event:n,node:b.rawNode})}function so({event:n,node:b}){!e.draggable||e.disabled||Ee(b,e.disabledField)||(te=n.clientX,le.value=b,Zn({event:n,node:b.rawNode}))}function Xt({event:n,node:b},D=!0){var L;if(!e.draggable||e.disabled||Ee(b,e.disabledField))return;const{value:T}=le;if(!T)return;const{allowDrop:ne,indent:me}=e;D&&Jn({event:n,node:b.rawNode});const ke=n.currentTarget,{height:Ge,top:Ye}=ke.getBoundingClientRect(),we=n.clientY-Ye;let Y;ne({node:b.rawNode,dropPosition:"inside",phase:"drag"})?we<=8?Y="before":we>=Ge-8?Y="after":Y="inside":we<=Ge/2?Y="before":Y="after";const{value:Se}=Wn;let G,ce;const Qe=Se(b.key);if(Qe===null){Be();return}let yt=!1;Y==="inside"?(G=b,ce="inside"):Y==="before"?b.isFirstChild?(G=b,ce="before"):(G=fe.value[Qe-1],ce="after"):(G=b,ce="after"),!G.isLeaf&&ae.value.includes(G.key)&&(yt=!0,ce==="after"&&(G=fe.value[Qe+1],G?ce="before":(G=b,ce="inside")));const Jt=G;if(vt.value=Jt,!yt&&T.isLastChild&&T.key===G.key&&(ce="after"),ce==="after"){let en=te-n.clientX,It=0;for(;en>=me/2&&G.parent!==null&&G.isLastChild&&It<1;)en-=me,It+=1,G=G.parent;mt.value=It}else mt.value=0;if((T.contains(G)||ce==="inside"&&((L=T.parent)===null||L===void 0?void 0:L.key)===G.key)&&!(T.key===Jt.key&&T.key===G.key)){Be();return}if(!ne({node:G.rawNode,dropPosition:ce,phase:"drag"})){Be();return}if(T.key===G.key)qe();else if(j!==G.key)if(ce==="inside"){if(e.expandOnDragenter){if(oo(G),!G.shallowLoaded&&j!==G.key){lt();return}}else if(!G.shallowLoaded){lt();return}}else qe();else ce!=="inside"&&qe();pt.value=ce,ge.value=G}function co({event:n,node:b,dropPosition:D}){if(!e.draggable||e.disabled||Ee(b,e.disabledField))return;const{value:L}=le,{value:T}=ge,{value:ne}=pt;if(!(!L||!T||!ne)&&e.allowDrop({node:T.rawNode,dropPosition:ne,phase:"drag"})&&L.key!==T.key){if(ne==="before"){const me=L.getNext({includeDisabled:!0});if(me&&me.key===T.key){Be();return}}if(ne==="after"){const me=L.getPrev({includeDisabled:!0});if(me&&me.key===T.key){Be();return}}eo({event:n,node:T.rawNode,dragNode:L.rawNode,dropPosition:D}),lt()}}function uo(){bt()}function fo(){bt()}function ho(n){var b;if(e.virtualScroll||e.internalScrollable){const{value:D}=l;if(!((b=D==null?void 0:D.containerRef)===null||b===void 0)&&b.contains(n.relatedTarget))return;be.value=null}else{const{value:D}=u;if(D!=null&&D.contains(n.relatedTarget))return;be.value=null}}Te(be,n=>{var b,D;if(n!==null){if(e.virtualScroll)(b=g.value)===null||b===void 0||b.scrollTo({key:n});else if(e.internalScrollable){const{value:L}=l;if(L===null)return;const T=(D=L.contentRef)===null||D===void 0?void 0:D.querySelector(`[data-key="${Tn(n)}"]`);if(!T)return;L.scrollTo({el:T})}}}),Ot(gt,{loadingKeysRef:E,highlightKeySetRef:Ue,displayedCheckedKeysRef:m,displayedIndeterminateKeysRef:_,mergedSelectedKeysRef:B,mergedExpandedKeysRef:ae,mergedThemeRef:r,mergedCheckStrategyRef:i,nodePropsRef:V(e,"nodeProps"),disabledRef:V(e,"disabled"),checkableRef:V(e,"checkable"),selectableRef:V(e,"selectable"),expandOnClickRef:V(e,"expandOnClick"),onLoadRef:V(e,"onLoad"),draggableRef:V(e,"draggable"),blockLineRef:V(e,"blockLine"),indentRef:V(e,"indent"),cascadeRef:V(e,"cascade"),checkOnClickRef:V(e,"checkOnClick"),checkboxPlacementRef:e.checkboxPlacement,droppingMouseNodeRef:vt,droppingNodeParentRef:jn,draggingNodeRef:le,droppingPositionRef:pt,droppingOffsetLevelRef:mt,fNodesRef:fe,pendingNodeKeyRef:be,showLineRef:V(e,"showLine"),disabledFieldRef:V(e,"disabledField"),internalScrollableRef:V(e,"internalScrollable"),internalCheckboxFocusableRef:V(e,"internalCheckboxFocusable"),internalTreeSelect:e.internalTreeSelect,renderLabelRef:V(e,"renderLabel"),renderPrefixRef:V(e,"renderPrefix"),renderSuffixRef:V(e,"renderSuffix"),renderSwitcherIconRef:V(e,"renderSwitcherIcon"),labelFieldRef:V(e,"labelField"),multipleRef:V(e,"multiple"),overrideDefaultNodeClickBehaviorRef:V(e,"overrideDefaultNodeClickBehavior"),handleSwitcherClick:Qt,handleDragEnd:ao,handleDragEnter:ro,handleDragLeave:lo,handleDragStart:so,handleDrop:co,handleDragOver:Xt,handleSelect:Dt,handleCheck:Pt});function go(n,b){var D,L;typeof n=="number"?(D=g.value)===null||D===void 0||D.scrollTo(n,b||0):(L=g.value)===null||L===void 0||L.scrollTo(n)}const vo={handleKeydown:pe,scrollTo:go,getCheckedData:()=>{if(!e.checkable)return{keys:[],options:[]};const{checkedKeys:n}=v.value;return{keys:n,options:xe(n)}},getIndeterminateData:()=>{if(!e.checkable)return{keys:[],options:[]};const{indeterminateKeys:n}=v.value;return{keys:n,options:xe(n)}}},Zt=F(()=>{const{common:{cubicBezierEaseInOut:n},self:{fontSize:b,nodeBorderRadius:D,nodeColorHover:L,nodeColorPressed:T,nodeColorActive:ne,arrowColor:me,loadingColor:ke,nodeTextColor:Ge,nodeTextColorDisabled:Ye,dropMarkColor:we,nodeWrapperPadding:Y,nodeHeight:Ce,lineHeight:Se,lineColor:G}}=r.value,ce=Lt(Y,"top"),Qe=Lt(Y,"bottom"),yt=Nn(it(Ce)-it(ce)-it(Qe));return{"--n-arrow-color":me,"--n-loading-color":ke,"--n-bezier":n,"--n-font-size":b,"--n-node-border-radius":D,"--n-node-color-active":ne,"--n-node-color-hover":L,"--n-node-color-pressed":T,"--n-node-text-color":Ge,"--n-node-text-color-disabled":Ye,"--n-drop-mark-color":we,"--n-node-wrapper-padding":Y,"--n-line-offset-top":`-${ce}`,"--n-line-offset-bottom":`-${Qe}`,"--n-node-content-height":yt,"--n-line-height":Se,"--n-line-color":G}}),Ve=s?Ht("tree",void 0,Zt,e):void 0;return Object.assign(Object.assign({},vo),{mergedClsPrefix:t,mergedTheme:r,rtlEnabled:a,fNodes:qn,aip:je,selfElRef:u,virtualListInstRef:g,scrollbarInstRef:l,handleFocusout:ho,handleDragLeaveTree:io,handleScroll:uo,getScrollContainer:x,getScrollContent:c,handleAfterEnter:Vn,handleResize:fo,cssVars:s?void 0:Zt,themeClass:Ve==null?void 0:Ve.themeClass,onRender:Ve==null?void 0:Ve.onRender})},render(){var e;const{fNodes:t,internalRenderEmpty:s}=this;if(!t.length&&s)return s();const{mergedClsPrefix:o,blockNode:a,blockLine:r,draggable:u,disabled:l,internalFocusable:g,checkable:x,handleKeydown:c,rtlEnabled:w,handleFocusout:f,scrollbarProps:P}=this,y=g&&!l,k=y?"0":void 0,p=[`${o}-tree`,w&&`${o}-tree--rtl`,x&&`${o}-tree--checkable`,(r||a)&&`${o}-tree--block-node`,r&&`${o}-tree--block-line`],C=$=>"__motion"in $?I(Gr,{height:$.height,nodes:$.nodes,clsPrefix:o,mode:$.mode,onAfterEnter:this.handleAfterEnter}):I(Mn,{key:$.key,tmNode:$,clsPrefix:o});if(this.virtualScroll){const{mergedTheme:$,internalScrollablePadding:v}=this,i=Lt(v||"0");return I(nn,Object.assign({},P,{ref:"scrollbarInstRef",onDragleave:u?this.handleDragLeaveTree:void 0,container:this.getScrollContainer,content:this.getScrollContent,class:p,theme:$.peers.Scrollbar,themeOverrides:$.peerOverrides.Scrollbar,tabindex:k,onKeydown:y?c:void 0,onFocusout:y?f:void 0}),{default:()=>{var m;return(m=this.onRender)===null||m===void 0||m.call(this),t.length?I(rr,{ref:"virtualListInstRef",items:this.fNodes,itemSize:it($.self.nodeHeight),ignoreItemResize:this.aip,paddingTop:i.top,paddingBottom:i.bottom,class:this.themeClass,style:[this.cssVars,{paddingLeft:i.left,paddingRight:i.right}],onScroll:this.handleScroll,onResize:this.handleResize,showScrollbar:!1,itemResizable:!0},{default:({item:_})=>C(_)}):on(this.$slots.empty,()=>[I(hn,{class:`${o}-tree__empty`,theme:this.mergedTheme.peers.Empty,themeOverrides:this.mergedTheme.peerOverrides.Empty})])}})}const{internalScrollable:N}=this;return p.push(this.themeClass),(e=this.onRender)===null||e===void 0||e.call(this),N?I(nn,Object.assign({},P,{class:p,tabindex:k,onKeydown:y?c:void 0,onFocusout:y?f:void 0,style:this.cssVars,contentStyle:{padding:this.internalScrollablePadding}}),{default:()=>I("div",{onDragleave:u?this.handleDragLeaveTree:void 0,ref:"selfElRef"},this.fNodes.map(C))}):I("div",{class:p,tabindex:k,ref:"selfElRef",style:this.cssVars,onKeydown:y?c:void 0,onFocusout:y?f:void 0,onDragleave:u?this.handleDragLeaveTree:void 0},t.length?t.map(C):on(this.$slots.empty,()=>[I(hn,{class:`${o}-tree__empty`,theme:this.mergedTheme.peers.Empty,themeOverrides:this.mergedTheme.peerOverrides.Empty})]))}}),bn=e=>{const t=Z(),s={x:0,y:0},o=jt({...s});let a;const r=c=>{a&&c.preventDefault()},u=c=>{a=c,s.x=o.x,s.y=o.y},l=c=>{if(!a||!t.value)return;const w=c.clientX-a.clientX,f=c.clientY-a.clientY;e(w)&&(o.x=s.x+w),o.y=s.y+f},g=()=>{a=void 0},x=()=>{if(!t.value||!a)return;g();const{top:c,bottom:w,left:f,right:P}=t.value.getBoundingClientRect();(P<0||f>window.innerWidth||w<0||c>window.innerHeight)&&(o.x=s.x,o.y=s.y)};return Ct(()=>{window.addEventListener("pointermove",l),window.addEventListener("pointerup",x),document.addEventListener("selectstart",r)}),kt(()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",x),document.removeEventListener("selectstart",r),g()}),Te(t,(c,w)=>{c&&(c.addEventListener("pointerdown",u),c.addEventListener("pointerup",g)),w&&(w.removeEventListener("pointerdown",u),w.removeEventListener("pointerup",g))}),kt(()=>{t.value&&(t.value.removeEventListener("pointerdown",u),t.value.removeEventListener("pointerup",g))}),{target:t,offset:o}};let at=1e3;const el=()=>{at++;const e=Z(at);return{zIndex:e,setTop:()=>{e.value!==at&&(at++,e.value=at)}}},yn="transition-top,bottom,left,right-500",St=Q({__name:"DraggableCard",props:{initialValue:{default:()=>({})},minWidth:{},sizeDraggable:{type:Boolean},show:{type:Boolean,default:!0},class:{}},setup(e){var i,m;const t=e,s=t.initialValue.left!==void 0,o=t.initialValue.top!==void 0,a={x:(i=s?t.initialValue.left:t.initialValue.right)!=null?i:0,y:(m=o?t.initialValue.top:t.initialValue.bottom)!=null?m:0},r=bn(_=>{const h=(t.initialValue.width||0)+u.offset.x+-r.offset.x-_;return(t.minWidth||0)<h}),u=bn(_=>{const h=(t.initialValue.width||0)+u.offset.x+_-r.offset.x;return(t.minWidth||0)<h}),l=jt({...a}),g=F(()=>{const _=(t.initialValue.width||0)+u.offset.x-r.offset.x,h=t.initialValue.width?`width:${_}px;`:"",z=o?`top:${l.y}px;`:`bottom:${l.y}px;`;return s?`left:${l.x-r.offset.x}px;`+z+h:`right:${l.x-u.offset.x}px;`+z+h});let x;const c=Z(!1),w=_=>{x=_,a.x=l.x,a.y=l.y,c.value=!1},f=_=>{if(!k.value||!x)return;const h=_.clientX-x.clientX,z=_.clientY-x.clientY;l.x=a.x+(s?h:-h),l.y=a.y+(o?z:-z),c.value=!0},P=()=>{x=void 0},y=Z(),k=Z(),p=_=>{x&&_.preventDefault()},C=()=>{if(!k.value||!x)return;P();const{top:_,bottom:h,left:z,right:B}=k.value.getBoundingClientRect();if(B<0||z>window.innerWidth||h<0||_>window.innerHeight){l.x=a.x,l.y=a.y;const A=y.value;A&&(A.classList.add(yn),setTimeout(()=>{A.classList.remove(yn)},550))}};Ct(()=>{window.addEventListener("pointermove",f),window.addEventListener("pointerup",C),document.addEventListener("selectstart",p)}),kt(()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",C),document.removeEventListener("selectstart",p),P()}),Te(k,(_,h)=>{_&&(_.addEventListener("pointerdown",w),_.addEventListener("pointerup",P)),h&&(h.removeEventListener("pointerdown",w),h.removeEventListener("pointerup",P))}),kt(()=>{k.value&&(k.value.removeEventListener("pointerdown",w),k.value.removeEventListener("pointerup",P))});const N=_=>{_ instanceof HTMLElement?k.value=_:k.value=void 0},{setTop:$,zIndex:v}=el();return Te(()=>t.show,()=>{t.show&&$()}),(_,h)=>(U(),re(_n,{to:"body"},[_.show?(U(),de("div",{key:0,fixed:"",ref_key:"box",ref:y,class:wt(["DraggableCard",t.class]),style:Fe([d(g),{zIndex:d(v)}]),onMousedown:h[0]||(h[0]=(...z)=>d($)&&d($)(...z))},[To(_.$slots,"default",{onRef:N,moved:d(c)}),_.sizeDraggable?(U(),de(Ie,{key:0},[K("div",{ref:d(r).target,absolute:"","right-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512),K("div",{ref:d(u).target,absolute:"","left-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512)],64)):ve("",!0)],38)):ve("",!0)]))}}),tl=async e=>fetch("https://detect.gkd.li/api/getImportId?id="+e).then(t=>t.json()).catch(()=>0),He=Fo("snapshot",()=>{const e=Rn(),t=$n(),s=Ao(),o=Pn(),{snapshotImportId:a,snapshotImageId:r,importSnapshotId:u}=o,l=Z();rn(()=>e.params.snapshotId,A=>{l.value=Bo(A)});const g=F(()=>{if(l.value)return a[l.value]}),x=F(()=>{if(l.value)return r[l.value]}),c=Z();$e(()=>{c.value&&(document.title="快照-"+(Ne(c.value).name||c.value.appId))});const w=Z(),f=F(()=>{if(w.value)return URL.createObjectURL(new Blob([w.value],{type:"image/png"}))}),P=Z(!1),y=ir(async A=>{if(P.value=!1,!A){c.value=void 0,w.value=void 0;return}if(await Promise.all([Jo.getItem(A).then(ee=>{c.value=ee||void 0}),er.getItem(A).then(ee=>{w.value=ee||void 0})]),!c.value){const ee=a[A]||await tl(A);if(ee&&Number.isSafeInteger(ee)){P.value=!0,t.replace({path:"/i/"+ee,query:e.query});return}}}),k=F(()=>y.loading);rn(()=>l.value,y.invoke),$e(()=>{g.value&&o.inited&&!u[g.value]&&l.value&&(u[g.value]=l.value,fetch("https://detect.gkd.li/api/detectSnapshot?importId="+g.value))});const p=F(()=>tr()&&s.inited&&s.autoUploadImport&&o.inited);$e(()=>{p.value&&c.value&&!x.value&&Yo(c.value),p.value&&c.value&&!g.value&&Qo(c.value),p.value&&c.value&&g.value&&Xo(c.value.id,g.value)});const C=F(()=>c.value&&s.inited?c.value.nodes.length<=s.maxShowNodeSize?structuredClone(c.value.nodes):structuredClone(c.value.nodes.slice(0,s.maxShowNodeSize)):[]),N=F(()=>{if(C.value.length)return qo(C.value)}),$=F(()=>c.value?c.value.nodes.length-s.maxShowNodeSize:0),v=Z(),i=Z(0),m=Z(),_=Z(),h=async A=>{v.value=A,i.value=Date.now(),await Je(),_.value&&!_.value.includes(A)&&(m.value=void 0,_.value=void 0)};$e(()=>{N.value&&h(N.value)});const z=A=>{m.value=A;const ee=Vo(C.value,m.value);ee.length&&h(ee[0]),ee.length>1&&(_.value=ee)},B=Z();return{snapshotId:l,snapshot:c,rootNode:N,screenshotUrl:f,loading:k,redirected:P,importId:g,imageId:x,focusNode:v,updateFocusNode:h,focusTime:i,overlapNodes:_,missNodeSize:$,focusPosition:m,updatePosition:z,track:B}}),nl={absolute:"","top-0":"","right-0":"","pt-4px":"","pr-8px":""},ol={key:0,flex:"","justify-between":"","items-center":""},rl={flex:"","items-center":"","h-24px":"","px-2px":""},ll={"max-w-500px":""},il=Q({__name:"AttrCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const{focusNode:t}=Me(He()),s=F(()=>{const u=t.value;return u?{_id:{desc:"虚拟属性(真机不可用):生成快照访问节点顺序",type:"info",show:!0},_pid:{desc:"虚拟属性(真机不可用):父节点的 _id",type:"info",show:!0},_selector:{desc:"自动生成的选择器, 点击“_selector”可直接复制内容, 用于定位",type:"info",show:!0},depth:{desc:"使用此属性在某些应用上可能造成无限节点错误",type:"info",show:!0},id:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.idQf)&&u.attr.id)},vid:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.idQf)&&u.attr.vid)},text:{desc:"可快速查找",type:"quickFind",show:!!((u.quickFind||u.textQf)&&u.attr.text)}}:{}}),o=["text","desc"],a=F(()=>t.value?Object.entries(t.value.attr).map(([u,l])=>{var x,c,w;const g={name:u,value:l,desc:JSON.stringify(l),tip:(x=s.value[u])!=null&&x.show?s.value[u]:void 0};return o.includes(u)?[g,{name:u+".length",value:(c=l==null?void 0:l.length)!=null?c:null,desc:JSON.stringify((w=l==null?void 0:l.length)!=null?w:null),tip:void 0}]:g}).flat():[]),r=F(()=>t.value?Go(t.value):"");return(u,l)=>{const g=ot("SvgIcon"),x=ht,c=Dn,w=qt,f=Br,P=ar,y=zr,k=Ar,p=Fr;return U(),re(St,{initialValue:{top:40,right:10},class:"box-shadow-dim",show:u.show&&!!d(t)},{default:S(({onRef:C})=>[K("div",nl,[R(x,{onClick:l[0]||(l[0]=N=>u.onUpdateShow(!u.show)),text:"",title:"最小化"},{icon:S(()=>[R(g,{name:"minus"})]),_:1})]),d(t)?(U(),re(p,{key:0,size:"small",striped:"",singleLine:!1,class:"gkd_code",themeOverrides:{thPaddingSmall:"1px 3px",tdPaddingSmall:"0px 3px"}},{default:S(()=>[K("thead",null,[K("tr",{ref:C,"cursor-move":""},l[2]||(l[2]=[K("th",null,"Name",-1),K("th",null,"Value",-1)]),512)]),R(k,null,{default:S(()=>[(U(!0),de(Ie,null,dt(d(a),N=>(U(),re(y,{key:N.name},{default:S(()=>[R(f,{onClick:$=>d(Re)(`${N.name}=${N.desc}`)},{default:S(()=>[N.tip?(U(),de("div",ol,[K("div",null,W(N.name),1),R(w,null,{trigger:S(()=>[R(c,{size:"16"},{default:S(()=>[N.tip.type=="info"?(U(),re(g,{key:0,name:"info"})):N.tip.type=="quickFind"?(U(),re(g,{key:1,name:"ok"})):ve("",!0)]),_:2},1024)]),default:S(()=>[J(" "+W(N.tip.desc),1)]),_:2},1024)])):(U(),de(Ie,{key:1},[J(W(N.name),1)],64))]),_:2},1032,["onClick"]),R(f,null,{default:S(()=>[R(P,{class:wt(["w-[calc(var(--gkd-w)*0.12)]",{"text-left direction-rtl":N.name=="id","opacity-50":N.value===null}])},{default:S(()=>[J(W(N.desc),1)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024))),128)),R(y,null,{default:S(()=>[R(f,{colspan:"2"},{default:S(()=>[K("div",rl,[R(w,null,{trigger:S(()=>[R(x,{text:"",onClick:l[1]||(l[1]=N=>d(Re)(d(r)))},{icon:S(()=>[R(c,{size:"20"},{default:S(()=>[R(g,{name:"path"})]),_:1})]),_:1})]),default:S(()=>[K("div",ll,W(d(r)),1)]),_:1})])]),_:1})]),_:1})]),_:1})]),_:2},1024)):ve("",!0)]),_:1},8,["show"])}}}),al={bg:"#eee","px-2px":""},sl=Q({__name:"OverlapCard",setup(e){const t=He(),{focusNode:s,overlapNodes:o,focusPosition:a}=Me(t),u=document.documentElement.scrollWidth/100*25.5;return(l,g)=>{const x=ht,c=In,w=zo;return U(),re(St,{initialValue:{top:215,left:u},class:"box-shadow-dim w-420px",show:!!(d(o)&&d(a))},{default:S(({onRef:f})=>[d(o)&&d(a)?(U(),re(w,{key:0,size:"small",closable:"",onClose:g[0]||(g[0]=P=>o.value=void 0)},{header:S(()=>[K("div",{ref:f,"cursor-move":""},[g[1]||(g[1]=J(" 位置 ")),K("span",al,W(`${d(a).x.toFixed(0)},${d(a).y.toFixed()}`),1),J(" 存在 "+W(d(o).length)+" 个层叠节点 ",1)],512)]),default:S(()=>[R(c,{style:{"max-height":"400px","overflow-y":"scroll","padding-bottom":"10px"},class:"scrollbar-hidden"},{default:S(()=>[(U(!0),de(Ie,null,dt(d(o),P=>(U(),re(x,{key:P.id,onClick:y=>d(t).updateFocusNode(P),size:"small",style:Fe(d(ct)(P,d(s)))},{default:S(()=>[J(W(d(nt)(P)),1)]),_:2},1032,["onClick","style"]))),128))]),_:1})]),_:2},1024)):ve("",!0)]),_:1},8,["initialValue","show"])}}}),Vt=Oo(),Hn=F(()=>Vt.width.value/100),Un=F(()=>Math.max(1200,Vt.width.value));F(()=>Math.max(700,Vt.height.value));const dl={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},cl={flex:"","m-b-4px":"","pr-4px":""},ul={"min-h-24px":""},fl={key:0,"color-red":"","whitespace-pre":""},hl=Q({__name:"RuleCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const t=He(),s=Me(t),{rootNode:o,focusNode:a}=s,r=s.snapshot,u=Z(""),l=Mo(u,500),g=y=>{if(y==null)return[];if(typeof y=="string")return[y];if(Array.isArray(y)&&y.every(k=>typeof k=="string"))return y},x=y=>{const k=g(y.matches);if(!k)return"非法格式: matches";const p=g(y.anyMatches);if(!p)return"非法格式: anyMatches";const C=g(y.excludeMatches);if(!C)return"非法格式: excludeMatches";const N=[];for(let h=0;h<k.length;h++){const z=k[h];try{N.push(xt(z))}catch(B){const A=B instanceof Error?B.message:String(B);return`非法选择器: matches[${h}]
|
|
257
|
+
错误: ${A}`}}const $=N.map(h=>h.querySelectorAll(o.value));if(N.length){const h=$.findIndex(z=>z.length===0);if(h>=0)return`无法匹配: matches[${h}] 查找结果为空`}const v=[];for(let h=0;h<p.length;h++){const z=p[h];try{v.push(xt(z))}catch(B){const A=B instanceof Error?B.message:String(B);return`非法选择器: anyMatches[${h}]
|
|
258
|
+
错误: ${A}`}}const i=v.map(h=>h.querySelectorAll(o.value));if(v.length&&i.every(h=>h.length===0))return"无法匹配: anyMatches 查找结果为空";if(!k.length&&!p.length)return"非法规则: matches 和 anyMatches 至少存在一个";const m=[];for(let h=0;h<C.length;h++){const z=C[h];try{m.push(xt(z))}catch(B){const A=B instanceof Error?B.message:String(B);return`非法选择器: excludeMatches[${h}]
|
|
259
|
+
错误: ${A}`}}const _=m.map(h=>h.querySelectorAll(o.value));if(m.length){const h=_.findIndex(z=>z.length!==0);if(h>=0)return`无法匹配: excludeMatches[${h}] 查找结果不为空`}return $.length?$.at(-1)[0]:i[0][0]},c=y=>typeof y=="object"&&y!==null&&!Array.isArray(y),w=F(()=>{if(!l.value)return"";const y=(()=>{try{return En.parse(l.value)}catch(k){return k}})();if(y instanceof Error)return`非法格式: ${y.message}`;if(!c(y))return"非法格式: 请使用对象格式";if(typeof y.id=="string"){if(y.id!==r.value.appId)return"非法格式: id 不匹配 appId";if(!Array.isArray(y.groups))return"非法格式: groups 不是数组";if(y.groups.length!==1)return"非法格式: groups 长度不为 1";const k=y.groups[0];if(!(k!=null&&k.rules))return"非法格式: groups[0].rules 非法";const p=Array.isArray(k.rules)?k.rules:[k.rules];if(p.length!==1)return"非法格式: groups[0].rules 长度不为 1";const C=typeof p[0]=="string"?{matches:p[0]}:p[0];return c(C)?x(C):"非法格式: rules[0] 非法"}if(y.rules){const k=Array.isArray(y.rules)?y.rules:[y.rules];if(k.length!==1)return"非法格式: rules 长度不为 1";const p=typeof k[0]=="string"?{matches:k[0]}:k[0];return c(p)?x(p):"非法格式: rules[0] 非法"}return x(y)}),f=F(()=>u.value&&l.value&&typeof w.value=="string"?w.value:""),P=F(()=>typeof w.value=="string"?null:w.value);return(y,k)=>{const p=ot("SvgIcon"),C=ht,N=Ln;return U(),re(St,{initialValue:{top:40,right:Math.max(315,12*d(Hn)+135),width:Math.max(480,d(Un)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:y.show},{default:S(({onRef:$})=>[K("div",dl,[K("div",cl,[k[3]||(k[3]=K("div",null,"测试规则",-1)),K("div",{"flex-1":"","cursor-move":"",ref:$},null,512),R(C,{onClick:k[0]||(k[0]=v=>y.onUpdateShow(!y.show)),text:"",title:"最小化"},{icon:S(()=>[R(p,{name:"minus"})]),_:1})]),R(N,{value:d(u),"onUpdate:value":k[1]||(k[1]=v=>tt(u)?u.value=v:null),type:"textarea",placeholder:"请输入单个规则测试",size:"small",class:"gkd_code m-b-4px",autosize:{minRows:10,maxRows:20}},null,8,["value"]),K("div",ul,[d(f)?(U(),de("div",fl,W(d(f)),1)):d(P)?(U(),re(C,{key:1,onClick:k[2]||(k[2]=v=>d(t).updateFocusNode(d(P))),size:"small",style:Fe(d(ct)(d(P),d(a)))},{default:S(()=>[J(W(d(nt)(d(P))),1)]),_:1},8,["style"])):ve("",!0)])])]),_:1},8,["initialValue","show"])}}}),gl=["src"],vl={absolute:"","left-2px":"","top-2px":"","p-1px":"","z-1":"","text-13px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]"},pl={key:0,absolute:"","left-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},ml={key:1,absolute:"","right-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},bl=Q({__name:"MiniHoverImg",props:{imgRef:{},imgHover:{type:Boolean},screenshotUrl:{},hoverPosition:{},hoverPositionStyle:{},boxHoverPosition:{},boxHoverPerPosition:{}},setup(e){const t=e,s=Ho(F(()=>t.imgRef));return(o,a)=>(U(),re(_n,{to:"body"},[wn(K("div",{style:Fe({left:d(s).right.value+4+"px",top:d(s).top.value+"px"}),"pointer-events-none":"",fixed:"","overflow-hidden":"","z-2":"","bg-white":"","h-200px":"","w-200px":"","border-1px":"","border-indigo-600":"","border-dashed":""},[K("img",{src:o.screenshotUrl,"object-contain":"",absolute:"","left-0":"","top-0":"",style:Fe(o.hoverPositionStyle),"w-1000px":""},null,12,gl),K("div",vl,W(`${o.hoverPosition.ox.toFixed(0)},${o.hoverPosition.oy.toFixed(0)}`),1),o.boxHoverPosition?(U(),de("div",pl,[K("div",null,W(o.boxHoverPosition.top.toFixed(0)),1),K("div",null,W(o.boxHoverPosition.left.toFixed(0)+","+o.boxHoverPosition.right.toFixed(0)),1),K("div",null,W(o.boxHoverPosition.bottom.toFixed(0)),1)])):ve("",!0),o.boxHoverPerPosition?(U(),de("div",ml,[K("div",null,W(o.boxHoverPerPosition.top),1),K("div",null,W(o.boxHoverPerPosition.left+","+o.boxHoverPerPosition.right),1),K("div",null,W(o.boxHoverPerPosition.bottom),1)])):ve("",!0),a[0]||(a[0]=K("div",{class:"top-[calc(50%-1px)] bg-[length:10px_1px]",absolute:"","left-0":"","right-0":"","h-1px":"","bg-repeat-x":"","mix-blend-difference":"",style:{"background-image":`linear-gradient(
|
|
260
260
|
to left,
|
|
261
261
|
transparent 0%,
|
|
262
262
|
transparent 50%,
|
|
@@ -268,5 +268,5 @@ import{h as Q,k as I,a as M,g as _e,f as H,e as O,b as X,u as ut,Z as po,$ as ft
|
|
|
268
268
|
transparent 50%,
|
|
269
269
|
#fff 50%,
|
|
270
270
|
#fff 100%
|
|
271
|
-
)`,"background-position-y":"1.5px"}},null,-1))],4),[[Cn,o.imgHover]])]))}}),bl={key:0,flex:"","flex-col":"",relative:"","h-full":"","p-2px":"","box-border":"","overflow-hidden":""},yl=["src"],xl={"pointer-events-none":"",absolute:"","left-2px":"","top-2px":"",size:"[calc(100%-4px)]"},kl={absolute:"","z-4":"","pointer-events-none":"","left-0":"","top-0":"","text-12px":"",leading:"100%",flex:"","gap-4px":""},wl={"p-1px":"",bg:"#ffffff70"},Cl={"p-1px":"",bg:"#ffffff70"},Sl=Q({__name:"ScreenshotCard",setup(e){const t=He(),{updatePosition:s}=t,o=Me(t),{focusNode:a,screenshotUrl:r}=o,u=F(()=>t.snapshot),l=Z(),v=Z(!1),x=$=>{const p=l.value;if(!p)return;const i=p.getBoundingClientRect(),h=i.width/p.naturalWidth*p.naturalHeight,_=(i.height-h)/2,g=($.clientX-i.left)/i.width*p.naturalWidth,z=($.clientY-i.top-_)/h*p.naturalHeight;s({x:g,y:z})},c=$=>`${$*100}%`,w=Uo(l),f=F(()=>{var g;const $=l.value,p=(g=a.value)==null?void 0:g.attr;if(!a.value||!$||!p||!v.value)return"";const i=w.width.value,h=w.height.value,_=i/$.naturalWidth*$.naturalHeight;return{left:`calc(${c(p.left/$.naturalWidth)} - 2px)`,width:`calc(${c((p.right-p.left)/$.naturalWidth)} + 2px)`,top:`calc(${c((p.top/$.naturalHeight*_+(h-_)/2)/h)} - 2px)`,height:`calc(${c((p.bottom-p.top)/$.naturalHeight*_/h)} + 2px)`}}),P=Z(!1),y=Z({ox:0,oy:0}),k=F(()=>{var h;const $=(h=a.value)==null?void 0:h.attr;if(!$)return;const{ox:p,oy:i}=y.value;return{left:p-$.left,right:$.right-p,top:i-$.top,bottom:$.bottom-i}}),m=F(()=>{var g;if(!((g=a.value)==null?void 0:g.attr)||!k.value)return;const{bottom:p,left:i,right:h,top:_}=k.value;return{left:(i/(h+i)).toFixed(3),right:(h/(h+i)).toFixed(3),top:(_/(_+p)).toFixed(3),bottom:(p/(_+p)).toFixed(3)}}),C=Z({left:"0",top:"0"}),N=$=>{const p=l.value;if(!p)return;const i=p.getBoundingClientRect(),h=i.width/p.naturalWidth*p.naturalHeight,_=(i.height-h)/2,g=($.clientX-i.left)/i.width*p.naturalWidth,z=($.clientY-i.top-_)/h*p.naturalHeight;y.value={ox:g,oy:z},C.value={left:-(g-.1*p.naturalWidth)/p.naturalWidth*1e3+"px",top:-(z-.1*p.naturalWidth)/p.naturalWidth*1e3+"px"}};return($,p)=>d(r)?(U(),ce("div",bl,[K("img",{ref_key:"imgRef",ref:l,src:d(r),onClick:x,"cursor-crosshair":"","object-contain":"","h-full":"",class:"max-w-[calc(var(--gkd-w)*0.35)]",onMouseover:p[0]||(p[0]=i=>P.value=!0),onMouseleave:p[1]||(p[1]=i=>P.value=!1),onMousemove:N,onLoad:p[2]||(p[2]=i=>v.value=!0)},null,40,yl),K("div",xl,[K("div",{style:Fe(d(f)),absolute:"","transition-all-300":"","b-1px":"","b-blue":"","b-solid":""},p[3]||(p[3]=[K("div",{absolute:"","left-0":"","top-0":"","bottom-0":"","right-0":"","b-solid":"","b-1px":"","b-red":""},null,-1)]),4)]),K("div",kl,[K("div",wl,W(`${d(u).screenWidth}x${d(u).screenHeight}`),1),K("div",Cl,W(d(Kn)(d(u).id).format("YYYY-MM-DD HH:mm:ss")),1)]),d(l)?(U(),ie(ml,{key:0,imgHover:d(P),imgRef:d(l),boxHoverPerPosition:d(m),boxHoverPosition:d(k),hoverPositionStyle:d(C),hoverPosition:d(y),screenshotUrl:d(r)},null,8,["imgHover","imgRef","boxHoverPerPosition","boxHoverPosition","hoverPositionStyle","hoverPosition","screenshotUrl"])):ve("",!0)])):ve("",!0)}}),Nl={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},_l={flex:"","m-b-4px":"","pr-4px":""},Rl={key:0,underline:"","leading-20px":"","decoration-1":"","m-r-4px":"",title:"查询数量"},$l=["title"],Pl={flex:"","gap-8px":"","flex-wrap":""},Dl=Q({__name:"SearchCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const t=Rn(),{snapshotImportId:s,snapshotImageId:o}=Pn(),a=He(),{updateFocusNode:r}=a,u=Me(a),l=u.snapshot,v=u.rootNode,{focusNode:x}=u,c=Z(""),w=jt([]),f=Z([]),P=i=>{const h=hr(()=>xt(i),g=>typeof g=="string"?g:g instanceof fr?"非法选择器:"+g.outMessage:"非法选择器:"+(g instanceof Error?g.message:g));if(w.find(g=>typeof g.selector=="object"&&g.selector.toString()==h.toString())){Ee.warning("不可重复选择");return}const _=h.querySelectorAll(v.value);if(_.length==0){Ee.success("没有选择到节点");return}return Ee.success(`选择到 ${_.length} 个节点`),w.unshift({selector:h,nodes:_,key:Date.now()}),_.length},y=i=>{if(w.find(g=>typeof g.selector=="string"&&g.selector.toString()==i)){Ee.warning("不可重复搜索");return}const h=[],_=[v.value];for(;_.length>0;){const g=_.pop();nt(g).includes(i)&&h.push(g),_.push(...[...g.children].reverse())}if(h.length==0){Ee.success("没有搜索到节点");return}return Ee.success(`搜索到 ${h.length} 个节点`),w.unshift({selector:i,nodes:h,key:Date.now()}),h.length},k=()=>{const i=w[0],h=i.nodes[0];Array.isArray(h)?typeof i.selector=="object"&&r(h):r(h);const _=new Set(w.map(z=>z.key)),g=f.value.filter(z=>_.has(z));g.push(i.key),f.value=g},m=vn(()=>{const i=c.value.trim();if(i){if(N.value){if(!P(i))return}else if(!y(i))return;k()}});Ct(async()=>{await ur;let i=0;t.query.gkd&&(i+=P(gn.decode(t.query.gkd))||0),t.query.str&&(i+=y(t.query.str)||0),i>0&&k()});const C=vn(async i=>{var se,fe,be;const h=o[l.value.id],_=s[l.value.id],g=_?ln(_):void 0,z=h?Wo(h):void 0,B=i.selector,A=i.nodes[0],ee=[((se=A.quickFind)!=null?se:A.idQf)&&A.attr.id&&B.fastQueryList.some(pe=>pe instanceof At.Id&&pe.value===A.attr.id),((fe=A.quickFind)!=null?fe:A.idQf)&&A.attr.vid&&B.fastQueryList.some(pe=>pe instanceof At.Vid&&pe.value===A.attr.vid),((be=A.quickFind)!=null?be:A.textQf)&&A.attr.text&&B.fastQueryList.some(pe=>pe instanceof At.Text&&pe.value===A.attr.text)].some(Boolean),Pe={id:l.value.appId,name:Ne(l.value).name,groups:[{key:1,name:`[ChangeMe]规则名称-${Kn().format("YYYY-MM-DD HH:mm:ss")}`,desc:"[ChangeMe]本规则由GKD网页端审查工具生成",rules:[{fastQuery:ee||void 0,activityIds:l.value.activityId,matches:B.toString(),exampleUrls:z,snapshotUrls:g}]}]};Re(En.stringify(Pe,void 0,2))}),N=Z(!0),$=F(()=>s[l.value.id]),p=i=>{if(!$.value)return;const h=new URL(ln(s[l.value.id]));typeof i.selector=="object"?h.searchParams.set("gkd",gn.encode(i.selector.toString())):h.searchParams.set("str",i.selector.toString()),Re(h.toString())};return(i,h)=>{const _=dr,g=In,z=sr,B=ot("SvgIcon"),A=ht,ee=Ln,Pe=cr,se=br,fe=Bn,be=_r,pe=Cr;return U(),ie(St,{initialValue:{top:40,right:Math.max(315,12*d(Hn)+135),width:Math.max(480,d(Un)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:i.show},{default:S(({onRef:ye})=>[K("div",Nl,[K("div",_l,[R(z,{value:d(N),"onUpdate:value":h[0]||(h[0]=j=>tt(N)?N.value=j:null)},{default:S(()=>[R(g,null,{default:S(()=>[R(_,{value:!1},{default:S(()=>h[4]||(h[4]=[J(" 字符搜索 ")])),_:1}),R(_,{value:!0},{default:S(()=>h[5]||(h[5]=[J(" 选择器查询 ")])),_:1})]),_:1})]),_:1},8,["value"]),K("div",{"flex-1":"","cursor-move":"",ref:ye},null,512),R(A,{onClick:h[1]||(h[1]=j=>i.onUpdateShow(!i.show)),text:"",title:"最小化"},{icon:S(()=>[R(B,{name:"minus"})]),_:1})]),R(Pe,null,{default:S(()=>[R(ee,{value:d(c),"onUpdate:value":h[2]||(h[2]=j=>tt(c)?c.value=j:null),placeholder:d(N)?"请输入选择器":"请输入字符",onKeyup:jo(d(m),["enter"]),inputProps:{class:"gkd_code"}},null,8,["value","placeholder","onKeyup"]),R(A,{onClick:d(m)},{icon:S(()=>[R(B,{name:"search"})]),_:1},8,["onClick"])]),_:1}),h[9]||(h[9]=K("div",{"p-5px":""},null,-1)),R(pe,{expandedNames:d(f),"onUpdate:expandedNames":h[3]||(h[3]=j=>tt(f)?f.value=j:null)},{default:S(()=>[(U(!0),ce(Te,null,dt(d(w),(j,Ae)=>(U(),ie(be,{key:j.key,name:j.key},{header:S(()=>[j.nodes.length>1?(U(),ce("span",Rl,W(j.nodes.length),1)):ve("",!0),K("span",{"break-all":"","px-4px":"","leading-20px":"",bg:"#eee",title:typeof j.selector=="object"?"选择器":"搜索字符"},W(j.selector.toString()),9,$l)]),"header-extra":S(()=>[typeof j.selector=="object"&&j.selector.canCopy?(U(),ie(A,{key:0,size:"small",onClick:Tt(he=>d(C)(j),["stop"]),title:"复制规则"},{icon:S(()=>[R(B,{name:"copy"})]),_:2},1032,["onClick"])):ve("",!0),h[6]||(h[6]=K("div",{"p-l-4px":""},null,-1)),d($)?(U(),ie(A,{key:1,size:"small",title:typeof j.selector=="object"?"复制查询链接":"复制搜索链接",onClick:Tt(he=>p(j),["stop"])},{icon:S(()=>[R(B,{name:"share"})]),_:2},1032,["title","onClick"])):ve("",!0),h[7]||(h[7]=K("div",{"p-l-4px":""},null,-1)),R(A,{size:"small",onClick:Tt(he=>d(w).splice(Ae,1),["stop"]),title:"删除记录"},{icon:S(()=>[R(B,{name:"delete"})]),_:2},1032,["onClick"])]),default:S(()=>[R(fe,{xScrollable:"",style:{"max-height":"400px"}},{default:S(()=>[K("div",Pl,[typeof j.selector=="string"||j.selector.connectKeys.length===0?(U(!0),ce(Te,{key:0},dt(j.nodes,he=>(U(),ie(A,{key:he.id,onClick:Ue=>d(r)(he),size:"small",style:Fe(d(ct)(he,d(x)))},{default:S(()=>[J(W(d(nt)(he)),1)]),_:2},1032,["onClick","style"]))),128)):(U(!0),ce(Te,{key:1},dt(j.nodes,(he,Ue)=>(U(),ie(se,{key:Ue},{default:S(()=>[R(A,{onClick:E=>d(r)(he),size:"small",style:Fe(d(ct)(he,d(x)))},{default:S(()=>[J(W(d(nt)(he)),1)]),_:2},1032,["onClick","style"])]),_:2},1024))),128))]),h[8]||(h[8]=K("div",{un:"h-10px"},null,-1))]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["expandedNames"])])]),_:1},8,["initialValue","show"])}}}),xn=[],Il=Q((e,t)=>{const s=F(()=>e.tag||"div");return()=>{var r,u,l,v;const o=(((u=(r=t.slots).default)==null?void 0:u.call(r))||xn).filter(x=>typeof x.type!="symbol"),a=[];if(o.length>0&&a.push(o[0]),o.length>1)for(let x=1;x<o.length;x++){const c=((v=(l=t.slots).gap)==null?void 0:v.call(l,{index:x-1}))||xn;a.push(...c),a.push(o[x])}return e.virtual?a:I(s.value,e,a)}},{props:["tag","virtual"]}),Kl={flex:"","flex-col":"","overflow-hidden":""},El={flex:"","items-center":"","px-8px":""},Ll={flex:"","items-center":"","gap-2px":"","max-w-120px":""},Tl=Q({__name:"WindowCard",setup(e){const t=$n(),s=He(),{updateFocusNode:o}=s,a=Me(s),r=a.snapshot,u=a.rootNode,{focusNode:l,focusTime:v}=a;let x=Number.NaN;const c=Z([]),w=Z([]);Le([()=>l.value,()=>v.value],async()=>{if(!l.value)return;const p=l.value.id;Je().then(async()=>{var _;if(await an(300),p===((_=l.value)==null?void 0:_.id)){if(x===p){x=Number.NaN;return}const g=document.querySelector(`[data-node-id="${p}"]`);if(!g)return;w.value=[p],g.scrollIntoView({behavior:"smooth",block:"center"})}});let i=l.value.parent;if(!i)return;const h=new Set(c.value);for(;i;)h.add(i.id),i=i.parent;h.size==c.value.length&&c.value.every(_=>h.has(_))||(c.value=[...h])});const f=Z(),P=(p,i)=>{var h;return i.id===((h=l.value)==null?void 0:h.id)},y=p=>{const i=ct(p.option,l.value);return{onClick:()=>{x=p.option.id,o(p.option)},style:{"--n-node-text-color":i.color,...i},class:"whitespace-nowrap","data-node-id":String(p.option.id)}},k=p=>nt(p.option),m=F(()=>`${dn(r.value).manufacturer} Android ${dn(r.value).release||""}`),C=F(()=>Ne(r.value).isSystem),N=F(()=>{const p=r.value.activityId,i=r.value.appId;return!p||!i?"":p.startsWith(i)&&p[i.length]==="."?p.substring(i.length):p}),$=async()=>{Ee.success("删除成功,即将回到首页"),await an(2e3),t.replace({path:"/"})};return(p,i)=>{const h=qt,_=ot("SvgIcon"),g=Zr,z=Bn;return U(),ce("div",Kl,[K("div",El,[R(d(Il),{flex:"","flex-wrap":"","items-center":"","gap-8px":"",gkd_code:""},{gap:S(()=>i[8]||(i[8]=[K("div",{"w-1px":"","bg-gray":"","h-12px":""},null,-1)])),default:S(()=>[R(h,null,{trigger:S(()=>[K("div",{onClick:i[0]||(i[0]=B=>d(Re)(d(m)))},W(d(m)),1)]),default:S(()=>[i[9]||(i[9]=J(" 设备名称 "))]),_:1}),R(h,null,{trigger:S(()=>[K("div",{class:wt({"opacity-50":!d(cn)(d(r)).versionName})},W(d(cn)(d(r)).versionName||"null"),3)]),default:S(()=>[i[10]||(i[10]=J(" GKD 版本 "))]),_:1}),K("div",Ll,[d(C)?(U(),ie(h,{key:0},{trigger:S(()=>[R(_,{name:"system"})]),default:S(()=>[J(" "+W(`${d(Ne)(d(r)).name} 是一个系统应用`),1)]),_:1})):ve("",!0),R(h,null,{trigger:S(()=>[K("div",{onClick:i[1]||(i[1]=B=>d(Re)(d(Ne)(d(r)).name))},W(d(Ne)(d(r)).name),1)]),default:S(()=>[i[11]||(i[11]=J(" 应用名称 "))]),_:1})]),R(h,null,{trigger:S(()=>[K("div",{onClick:i[2]||(i[2]=B=>d(Re)(d(Ne)(d(r)).versionName))},W(d(Ne)(d(r)).versionName),1)]),default:S(()=>[i[12]||(i[12]=J(" 版本名称 "))]),_:1}),R(h,null,{trigger:S(()=>[K("div",{onClick:i[3]||(i[3]=B=>d(Re)(d(Ne)(d(r)).versionCode.toString()))},W(d(Ne)(d(r)).versionCode),1)]),default:S(()=>[i[13]||(i[13]=J(" 版本代码 "))]),_:1}),R(h,null,{trigger:S(()=>[K("div",{onClick:i[4]||(i[4]=B=>d(Re)(d(r).appId))},W(d(r).appId),1)]),default:S(()=>[i[14]||(i[14]=J(" 应用ID "))]),_:1}),R(h,null,{trigger:S(()=>[K("div",{onClick:i[5]||(i[5]=B=>d(Re)(d(N))),class:wt({"opacity-50":!d(N)})},W(d(N)||"null"),3)]),default:S(()=>[i[15]||(i[15]=J(" 界面ID "))]),_:1})]),_:1}),i[16]||(i[16]=K("div",{"flex-1":""},null,-1)),R(Zo,{class:"ml-8px",snapshot:d(r),onDelete:$,showPreview:!1},null,8,["snapshot"])]),i[17]||(i[17]=K("div",{"h-1px":"","mt-4px":"",bg:"#efeff5"},null,-1)),R(z,{xScrollable:"",class:"flex-1"},{default:S(()=>[R(g,{class:"mb-24px mr-24px",ref_key:"treeRef",ref:f,virtualScroll:"",showLine:"",blockLine:"",keyField:"id",expandedKeys:d(c),"onUpdate:expandedKeys":i[6]||(i[6]=B=>tt(c)?c.value=B:null),selectedKeys:d(w),"onUpdate:selectedKeys":i[7]||(i[7]=B=>tt(w)?w.value=B:null),data:[d(u)],filter:P,nodeProps:y,renderLabel:k},null,8,["expandedKeys","selectedKeys","data","filter","nodeProps","renderLabel"])]),_:1})])}}}),Fl={"h-full":"",flex:"","gap-5px":""},Al={"w-28px":"","py-8px":"",flex:"","flex-col":"","gap-16px":""},Bl={flex:"","justify-center":"",href:"https://gkd.li/guide/snapshot#share-note",target:"_blank",rel:"noopener noreferrer"},zl={key:1,flex:"","justify-center":"","pt-80px":""},Yl=Q({__name:"SnapshotPage",setup(e){const t=He(),s=Me(t),{snapshot:o,rootNode:a,loading:r,redirected:u}=s;$e(()=>{r.value?sn.start():sn.finish()});const l=Ft("searchShow",!0,sessionStorage),v=Ft("ruleShow",!1,sessionStorage),x=Ft("attrShow",!0,sessionStorage),c=()=>{Ee.info("暂未实现")};return(w,f)=>{const P=ot("SvgIcon"),y=Dn,k=ot("RouterLink"),m=ht,C=qt;return d(o)&&d(a)?(U(),ce(Te,{key:0},[K("div",Fl,[K("div",Al,[R(C,{placement:"right"},{trigger:S(()=>[R(m,{text:""},{icon:S(()=>[R(k,{to:"/",title:"",color:"inherit"},{default:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"home"})]),_:1})]),_:1})]),_:1})]),default:S(()=>[f[6]||(f[6]=J(" 回到首页 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(m,{onClick:c,text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"settings"})]),_:1})]),_:1})]),default:S(()=>[f[7]||(f[7]=J(" 设置 "))]),_:1}),f[12]||(f[12]=K("div",null,null,-1)),R(C,{placement:"right"},{trigger:S(()=>[R(m,{text:"",onClick:f[0]||(f[0]=N=>l.value=!d(l))},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"search-list"})]),_:1})]),_:1})]),default:S(()=>[f[8]||(f[8]=J(" 搜索面板 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(m,{onClick:f[1]||(f[1]=N=>x.value=!d(x)),text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"prop"})]),_:1})]),_:1})]),default:S(()=>[f[9]||(f[9]=J(" 属性面板 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(m,{onClick:f[2]||(f[2]=N=>v.value=!d(v)),text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"test"})]),_:1})]),_:1})]),default:S(()=>[f[10]||(f[10]=J(" 测试规则 "))]),_:1}),f[13]||(f[13]=K("div",null,null,-1)),R(C,{placement:"right"},{trigger:S(()=>[K("a",Bl,[R(m,{text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"warn"})]),_:1})]),_:1})])]),default:S(()=>[f[11]||(f[11]=J(" 分享须知 "))]),_:1})]),R(Sl),R(Tl,{class:"flex-1"})]),R(Dl,{show:d(l),onUpdateShow:f[3]||(f[3]=N=>l.value=N)},null,8,["show"]),R(fl,{show:d(v),onUpdateShow:f[4]||(f[4]=N=>v.value=N)},null,8,["show"]),R(ll,{show:d(x),onUpdateShow:f[5]||(f[5]=N=>x.value=N)},null,8,["show"]),R(al)],64)):!d(r)&&!d(u)?(U(),ce("div",zl,f[14]||(f[14]=[K("div",null,"快照数据缺失",-1)]))):ve("",!0)}}});export{Yl as default};
|
|
272
|
-
//# sourceMappingURL=SnapshotPage-
|
|
271
|
+
)`,"background-position-y":"1.5px"}},null,-1))],4),[[Cn,o.imgHover]])]))}}),yl={key:0,flex:"","flex-col":"",relative:"","h-full":"","p-2px":"","box-border":"","overflow-hidden":""},xl=["src"],kl={"pointer-events-none":"",absolute:"","left-2px":"","top-2px":"",size:"[calc(100%-4px)]"},wl={absolute:"","z-4":"","pointer-events-none":"","left-0":"","top-0":"","text-12px":"",leading:"100%",flex:"","gap-4px":""},Cl={"p-1px":"",bg:"#ffffff70"},Sl={"p-1px":"",bg:"#ffffff70"},Nl=Q({__name:"ScreenshotCard",setup(e){const t=He(),{updatePosition:s}=t,o=Me(t),{focusNode:a,screenshotUrl:r}=o,u=F(()=>t.snapshot),l=Z(),g=Z(!1),x=$=>{const v=l.value;if(!v)return;const i=v.getBoundingClientRect(),m=i.width/v.naturalWidth*v.naturalHeight,_=(i.height-m)/2,h=($.clientX-i.left)/i.width*v.naturalWidth,z=($.clientY-i.top-_)/m*v.naturalHeight;s({x:h,y:z})},c=$=>`${$*100}%`,w=Uo(l),f=F(()=>{var h;const $=l.value,v=(h=a.value)==null?void 0:h.attr;if(!a.value||!$||!v||!g.value)return"";const i=w.width.value,m=w.height.value,_=i/$.naturalWidth*$.naturalHeight;return{left:`calc(${c(v.left/$.naturalWidth)} - 2px)`,width:`calc(${c((v.right-v.left)/$.naturalWidth)} + 2px)`,top:`calc(${c((v.top/$.naturalHeight*_+(m-_)/2)/m)} - 2px)`,height:`calc(${c((v.bottom-v.top)/$.naturalHeight*_/m)} + 2px)`}}),P=Z(!1),y=Z({ox:0,oy:0}),k=F(()=>{var m;const $=(m=a.value)==null?void 0:m.attr;if(!$)return;const{ox:v,oy:i}=y.value;return{left:v-$.left,right:$.right-v,top:i-$.top,bottom:$.bottom-i}}),p=F(()=>{var h;if(!((h=a.value)==null?void 0:h.attr)||!k.value)return;const{bottom:v,left:i,right:m,top:_}=k.value;return{left:(i/(m+i)).toFixed(3),right:(m/(m+i)).toFixed(3),top:(_/(_+v)).toFixed(3),bottom:(v/(_+v)).toFixed(3)}}),C=Z({left:"0",top:"0"}),N=$=>{const v=l.value;if(!v)return;const i=v.getBoundingClientRect(),m=i.width/v.naturalWidth*v.naturalHeight,_=(i.height-m)/2,h=($.clientX-i.left)/i.width*v.naturalWidth,z=($.clientY-i.top-_)/m*v.naturalHeight;y.value={ox:h,oy:z},C.value={left:-(h-.1*v.naturalWidth)/v.naturalWidth*1e3+"px",top:-(z-.1*v.naturalWidth)/v.naturalWidth*1e3+"px"}};return($,v)=>d(r)?(U(),de("div",yl,[K("img",{ref_key:"imgRef",ref:l,src:d(r),onClick:x,"cursor-crosshair":"","object-contain":"","h-full":"",class:"max-w-[calc(var(--gkd-w)*0.35)]",onMouseover:v[0]||(v[0]=i=>P.value=!0),onMouseleave:v[1]||(v[1]=i=>P.value=!1),onMousemove:N,onLoad:v[2]||(v[2]=i=>g.value=!0)},null,40,xl),K("div",kl,[K("div",{style:Fe(d(f)),absolute:"","transition-all-300":"","b-1px":"","b-blue":"","b-solid":""},v[3]||(v[3]=[K("div",{absolute:"","left-0":"","top-0":"","bottom-0":"","right-0":"","b-solid":"","b-1px":"","b-red":""},null,-1)]),4)]),K("div",wl,[K("div",Cl,W(`${d(u).screenWidth}x${d(u).screenHeight}`),1),K("div",Sl,W(d(Kn)(d(u).id).format("YYYY-MM-DD HH:mm:ss")),1)]),d(l)?(U(),re(bl,{key:0,imgHover:d(P),imgRef:d(l),boxHoverPerPosition:d(p),boxHoverPosition:d(k),hoverPositionStyle:d(C),hoverPosition:d(y),screenshotUrl:d(r)},null,8,["imgHover","imgRef","boxHoverPerPosition","boxHoverPosition","hoverPositionStyle","hoverPosition","screenshotUrl"])):ve("",!0)])):ve("",!0)}}),_l={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},Rl={flex:"","m-b-4px":"","pr-4px":""},$l={key:0,underline:"","leading-20px":"","decoration-1":"","m-r-4px":"",gkd_code:"",title:"查询数量"},Pl=["title"],Dl={flex:"","gap-8px":"","flex-wrap":""},Il=Q({__name:"SearchCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:Wt}},setup(e){const t=Rn(),{snapshotImportId:s,snapshotImageId:o}=Pn(),a=He(),{updateFocusNode:r}=a,u=Me(a),l=u.snapshot,g=u.rootNode,{focusNode:x}=u,c=Z(""),w=jt([]),f=Z([]),P=i=>{const m=gr(()=>xt(i),h=>typeof h=="string"?h:h instanceof hr?"非法选择器:"+h.outMessage:"非法选择器:"+(h instanceof Error?h.message:h));if(w.find(h=>typeof h.selector=="object"&&h.selector.toString()==m.toString())){Le.warning("不可重复选择");return}const _=m.querySelectorAll(g.value);if(_.length==0){Le.success("没有选择到节点");return}return Le.success(`选择到 ${_.length} 个节点`),w.unshift({selector:m,nodes:_,key:Date.now(),gkd:!0}),_.length},y=i=>{if(w.find(h=>typeof h.selector=="string"&&h.selector.toString()==i)){Le.warning("不可重复搜索");return}const m=[],_=[g.value];for(;_.length>0;){const h=_.pop();nt(h).includes(i)&&m.push(h),_.push(...[...h.children].reverse())}if(m.length==0){Le.success("没有搜索到节点");return}return Le.success(`搜索到 ${m.length} 个节点`),w.unshift({gkd:!1,selector:i,nodes:m,key:Date.now()}),m.length},k=()=>{const i=w[0],m=i.nodes[0];Array.isArray(m)?typeof i.selector=="object"&&r(m):r(m);const _=new Set(w.map(z=>z.key)),h=f.value.filter(z=>_.has(z));h.push(i.key),f.value=h},p=vn(()=>{const i=c.value.trim();if(i){if(N.value){if(!P(i))return}else if(!y(i))return;k()}});Ct(async()=>{await ur;let i=0;t.query.gkd&&(i+=P(gn.decode(t.query.gkd))||0),t.query.str&&(i+=y(t.query.str)||0),i>0&&k()});const C=vn(async i=>{var ae,fe,be;const m=o[l.value.id],_=s[l.value.id],h=_?ln(_):void 0,z=m?Wo(m):void 0,B=i.selector,A=i.nodes[0],ee=[((ae=A.quickFind)!=null?ae:A.idQf)&&A.attr.id&&B.fastQueryList.some(pe=>pe instanceof At.Id&&pe.value===A.attr.id),((fe=A.quickFind)!=null?fe:A.idQf)&&A.attr.vid&&B.fastQueryList.some(pe=>pe instanceof At.Vid&&pe.value===A.attr.vid),((be=A.quickFind)!=null?be:A.textQf)&&A.attr.text&&B.fastQueryList.some(pe=>pe instanceof At.Text&&pe.value===A.attr.text)].some(Boolean),Pe={id:l.value.appId,name:Ne(l.value).name,groups:[{key:1,name:`[ChangeMe]规则名称-${Kn().format("YYYY-MM-DD HH:mm:ss")}`,desc:"[ChangeMe]本规则由GKD网页端审查工具生成",rules:[{fastQuery:ee||void 0,activityIds:l.value.activityId,matches:B.toString(),exampleUrls:z,snapshotUrls:h}]}]};Re(En.stringify(Pe,void 0,2))}),N=Z(!0),$=F(()=>s[l.value.id]),v=i=>{if(!$.value)return;const m=new URL(ln(s[l.value.id]));typeof i.selector=="object"?m.searchParams.set("gkd",gn.encode(i.selector.toString())):m.searchParams.set("str",i.selector.toString()),Re(m.toString())};return(i,m)=>{const _=dr,h=In,z=sr,B=ot("SvgIcon"),A=ht,ee=Ln,Pe=cr,ae=yr,fe=Bn,be=Rr,pe=Sr;return U(),re(St,{initialValue:{top:40,right:Math.max(315,12*d(Hn)+135),width:Math.max(480,d(Un)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:i.show},{default:S(({onRef:ye})=>[K("div",_l,[K("div",Rl,[R(z,{value:d(N),"onUpdate:value":m[0]||(m[0]=j=>tt(N)?N.value=j:null)},{default:S(()=>[R(h,null,{default:S(()=>[R(_,{value:!1},{default:S(()=>m[4]||(m[4]=[J(" 字符搜索 ")])),_:1}),R(_,{value:!0},{default:S(()=>m[5]||(m[5]=[J(" 选择器查询 ")])),_:1})]),_:1})]),_:1},8,["value"]),K("div",{"flex-1":"","cursor-move":"",ref:ye},null,512),R(A,{onClick:m[1]||(m[1]=j=>i.onUpdateShow(!i.show)),text:"",title:"最小化"},{icon:S(()=>[R(B,{name:"minus"})]),_:1})]),R(Pe,null,{default:S(()=>[R(ee,{value:d(c),"onUpdate:value":m[2]||(m[2]=j=>tt(c)?c.value=j:null),placeholder:d(N)?"请输入选择器":"请输入字符",onKeyup:jo(d(p),["enter"]),inputProps:{class:"gkd_code"}},null,8,["value","placeholder","onKeyup"]),R(A,{onClick:d(p)},{icon:S(()=>[R(B,{name:"search"})]),_:1},8,["onClick"])]),_:1}),m[8]||(m[8]=K("div",{"p-5px":""},null,-1)),R(pe,{expandedNames:d(f),"onUpdate:expandedNames":m[3]||(m[3]=j=>tt(f)?f.value=j:null)},{default:S(()=>[(U(!0),de(Ie,null,dt(d(w),(j,Ae)=>(U(),re(be,{key:j.key,name:j.key},{header:S(()=>[j.nodes.length>1?(U(),de("span",$l,W(j.nodes.length),1)):ve("",!0),K("span",{"break-all":"","px-4px":"","leading-20px":"",bg:"#eee",gkd_code:"",title:j.gkd?"选择器":"搜索字符"},[j.gkd?(U(),re(fr,{key:0,node:j.selector.ast,text:j.selector.source},null,8,["node","text"])):(U(),de(Ie,{key:1},[J(W(j.selector),1)],64))],8,Pl),m[6]||(m[6]=K("span",{"pl-4px":""},null,-1))]),"header-extra":S(()=>[R(ae,null,{default:S(()=>[j.gkd&&j.selector.canCopy?(U(),re(A,{key:0,size:"small",onClick:Tt(he=>d(C)(j),["stop"]),title:"复制规则"},{icon:S(()=>[R(B,{name:"copy"})]),_:2},1032,["onClick"])):ve("",!0),d($)?(U(),re(A,{key:1,size:"small",title:j.gkd?"复制查询链接":"复制搜索链接",onClick:Tt(he=>v(j),["stop"])},{icon:S(()=>[R(B,{name:"share"})]),_:2},1032,["title","onClick"])):ve("",!0),R(A,{size:"small",onClick:Tt(he=>d(w).splice(Ae,1),["stop"]),title:"删除记录"},{icon:S(()=>[R(B,{name:"delete"})]),_:2},1032,["onClick"])]),_:2},1024)]),default:S(()=>[R(fe,{xScrollable:"",style:{"max-height":"400px"}},{default:S(()=>[K("div",Dl,[!j.gkd||j.selector.connectKeys.length===0?(U(!0),de(Ie,{key:0},dt(j.nodes,he=>(U(),re(A,{key:he.id,onClick:Ue=>d(r)(he),size:"small",style:Fe(d(ct)(he,d(x)))},{default:S(()=>[J(W(d(nt)(he)),1)]),_:2},1032,["onClick","style"]))),128)):(U(!0),de(Ie,{key:1},dt(j.nodes,(he,Ue)=>(U(),re(ae,{key:Ue},{default:S(()=>[R(A,{onClick:E=>d(r)(he),size:"small",style:Fe(d(ct)(he,d(x)))},{default:S(()=>[J(W(d(nt)(he)),1)]),_:2},1032,["onClick","style"])]),_:2},1024))),128))]),m[7]||(m[7]=K("div",{un:"h-10px"},null,-1))]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["expandedNames"])])]),_:1},8,["initialValue","show"])}}}),xn=[],Kl=Q((e,t)=>{const s=F(()=>e.tag||"div");return()=>{var r,u,l,g;const o=(((u=(r=t.slots).default)==null?void 0:u.call(r))||xn).filter(x=>typeof x.type!="symbol"),a=[];if(o.length>0&&a.push(o[0]),o.length>1)for(let x=1;x<o.length;x++){const c=((g=(l=t.slots).gap)==null?void 0:g.call(l,{index:x-1}))||xn;a.push(...c),a.push(o[x])}return e.virtual?a:I(s.value,e,a)}},{props:["tag","virtual"]}),El={flex:"","flex-col":"","overflow-hidden":""},Ll={flex:"","items-center":"","px-8px":""},Tl={flex:"","items-center":"","gap-2px":"","max-w-120px":""},Fl=Q({__name:"WindowCard",setup(e){const t=$n(),s=He(),{updateFocusNode:o}=s,a=Me(s),r=a.snapshot,u=a.rootNode,{focusNode:l,focusTime:g}=a;let x=Number.NaN;const c=Z([]),w=Z([]);Te([()=>l.value,()=>g.value],async()=>{if(!l.value)return;const v=l.value.id;Je().then(async()=>{var _;if(await an(300),v===((_=l.value)==null?void 0:_.id)){if(x===v){x=Number.NaN;return}const h=document.querySelector(`[data-node-id="${v}"]`);if(!h)return;w.value=[v],h.scrollIntoView({behavior:"smooth",block:"center"})}});let i=l.value.parent;if(!i)return;const m=new Set(c.value);for(;i;)m.add(i.id),i=i.parent;m.size==c.value.length&&c.value.every(_=>m.has(_))||(c.value=[...m])});const f=Z(),P=(v,i)=>{var m;return i.id===((m=l.value)==null?void 0:m.id)},y=v=>{const i=ct(v.option,l.value);return{onClick:()=>{x=v.option.id,o(v.option)},style:{"--n-node-text-color":i.color,...i},class:"whitespace-nowrap","data-node-id":String(v.option.id)}},k=v=>nt(v.option),p=F(()=>`${dn(r.value).manufacturer} Android ${dn(r.value).release||""}`),C=F(()=>Ne(r.value).isSystem),N=F(()=>{const v=r.value.activityId,i=r.value.appId;return!v||!i?"":v.startsWith(i)&&v[i.length]==="."?v.substring(i.length):v}),$=async()=>{Le.success("删除成功,即将回到首页"),await an(2e3),t.replace({path:"/"})};return(v,i)=>{const m=qt,_=ot("SvgIcon"),h=Jr,z=Bn;return U(),de("div",El,[K("div",Ll,[R(d(Kl),{flex:"","flex-wrap":"","items-center":"","gap-8px":"",gkd_code:""},{gap:S(()=>i[8]||(i[8]=[K("div",{"w-1px":"","bg-gray":"","h-12px":""},null,-1)])),default:S(()=>[R(m,null,{trigger:S(()=>[K("div",{onClick:i[0]||(i[0]=B=>d(Re)(d(p)))},W(d(p)),1)]),default:S(()=>[i[9]||(i[9]=J(" 设备名称 "))]),_:1}),R(m,null,{trigger:S(()=>[K("div",{class:wt({"opacity-50":!d(cn)(d(r)).versionName})},W(d(cn)(d(r)).versionName||"null"),3)]),default:S(()=>[i[10]||(i[10]=J(" GKD 版本 "))]),_:1}),K("div",Tl,[d(C)?(U(),re(m,{key:0},{trigger:S(()=>[R(_,{name:"system"})]),default:S(()=>[J(" "+W(`${d(Ne)(d(r)).name} 是一个系统应用`),1)]),_:1})):ve("",!0),R(m,null,{trigger:S(()=>[K("div",{onClick:i[1]||(i[1]=B=>d(Re)(d(Ne)(d(r)).name))},W(d(Ne)(d(r)).name),1)]),default:S(()=>[i[11]||(i[11]=J(" 应用名称 "))]),_:1})]),R(m,null,{trigger:S(()=>[K("div",{onClick:i[2]||(i[2]=B=>d(Re)(d(Ne)(d(r)).versionName))},W(d(Ne)(d(r)).versionName),1)]),default:S(()=>[i[12]||(i[12]=J(" 版本名称 "))]),_:1}),R(m,null,{trigger:S(()=>[K("div",{onClick:i[3]||(i[3]=B=>d(Re)(d(Ne)(d(r)).versionCode.toString()))},W(d(Ne)(d(r)).versionCode),1)]),default:S(()=>[i[13]||(i[13]=J(" 版本代码 "))]),_:1}),R(m,null,{trigger:S(()=>[K("div",{onClick:i[4]||(i[4]=B=>d(Re)(d(r).appId))},W(d(r).appId),1)]),default:S(()=>[i[14]||(i[14]=J(" 应用ID "))]),_:1}),R(m,null,{trigger:S(()=>[K("div",{onClick:i[5]||(i[5]=B=>d(Re)(d(N))),class:wt({"opacity-50":!d(N)})},W(d(N)||"null"),3)]),default:S(()=>[i[15]||(i[15]=J(" 界面ID "))]),_:1})]),_:1}),i[16]||(i[16]=K("div",{"flex-1":""},null,-1)),R(Zo,{class:"ml-8px",snapshot:d(r),onDelete:$,showPreview:!1},null,8,["snapshot"])]),i[17]||(i[17]=K("div",{"h-1px":"","mt-4px":"",bg:"#efeff5"},null,-1)),R(z,{xScrollable:"",class:"flex-1"},{default:S(()=>[R(h,{class:"mb-24px mr-24px",ref_key:"treeRef",ref:f,virtualScroll:"",showLine:"",blockLine:"",keyField:"id",expandedKeys:d(c),"onUpdate:expandedKeys":i[6]||(i[6]=B=>tt(c)?c.value=B:null),selectedKeys:d(w),"onUpdate:selectedKeys":i[7]||(i[7]=B=>tt(w)?w.value=B:null),data:[d(u)],filter:P,nodeProps:y,renderLabel:k},null,8,["expandedKeys","selectedKeys","data","filter","nodeProps","renderLabel"])]),_:1})])}}}),Al={"h-full":"",flex:"","gap-5px":""},Bl={"w-28px":"","py-8px":"",flex:"","flex-col":"","gap-16px":""},zl={flex:"","justify-center":"",href:"https://gkd.li/guide/snapshot#share-note",target:"_blank",rel:"noopener noreferrer"},Ol={key:1,flex:"","justify-center":"","pt-80px":""},Ql=Q({__name:"SnapshotPage",setup(e){const t=He(),s=Me(t),{snapshot:o,rootNode:a,loading:r,redirected:u}=s;$e(()=>{r.value?sn.start():sn.finish()});const l=Ft("searchShow",!0,sessionStorage),g=Ft("ruleShow",!1,sessionStorage),x=Ft("attrShow",!0,sessionStorage),c=()=>{Le.info("暂未实现")};return(w,f)=>{const P=ot("SvgIcon"),y=Dn,k=ot("RouterLink"),p=ht,C=qt;return d(o)&&d(a)?(U(),de(Ie,{key:0},[K("div",Al,[K("div",Bl,[R(C,{placement:"right"},{trigger:S(()=>[R(p,{text:""},{icon:S(()=>[R(k,{to:"/",title:"",color:"inherit"},{default:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"home"})]),_:1})]),_:1})]),_:1})]),default:S(()=>[f[6]||(f[6]=J(" 回到首页 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(p,{onClick:c,text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"settings"})]),_:1})]),_:1})]),default:S(()=>[f[7]||(f[7]=J(" 设置 "))]),_:1}),f[12]||(f[12]=K("div",null,null,-1)),R(C,{placement:"right"},{trigger:S(()=>[R(p,{text:"",onClick:f[0]||(f[0]=N=>l.value=!d(l))},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"search-list"})]),_:1})]),_:1})]),default:S(()=>[f[8]||(f[8]=J(" 搜索面板 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(p,{onClick:f[1]||(f[1]=N=>x.value=!d(x)),text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"prop"})]),_:1})]),_:1})]),default:S(()=>[f[9]||(f[9]=J(" 属性面板 "))]),_:1}),R(C,{placement:"right"},{trigger:S(()=>[R(p,{onClick:f[2]||(f[2]=N=>g.value=!d(g)),text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"test"})]),_:1})]),_:1})]),default:S(()=>[f[10]||(f[10]=J(" 测试规则 "))]),_:1}),f[13]||(f[13]=K("div",null,null,-1)),R(C,{placement:"right"},{trigger:S(()=>[K("a",zl,[R(p,{text:""},{icon:S(()=>[R(y,{size:"24"},{default:S(()=>[R(P,{name:"warn"})]),_:1})]),_:1})])]),default:S(()=>[f[11]||(f[11]=J(" 分享须知 "))]),_:1})]),R(Nl),R(Fl,{class:"flex-1"})]),R(Il,{show:d(l),onUpdateShow:f[3]||(f[3]=N=>l.value=N)},null,8,["show"]),R(hl,{show:d(g),onUpdateShow:f[4]||(f[4]=N=>g.value=N)},null,8,["show"]),R(il,{show:d(x),onUpdateShow:f[5]||(f[5]=N=>x.value=N)},null,8,["show"]),R(sl)],64)):!d(r)&&!d(u)?(U(),de("div",Ol,f[14]||(f[14]=[K("div",null,"快照数据缺失",-1)]))):ve("",!0)}}});export{Ql as default};
|
|
272
|
+
//# sourceMappingURL=SnapshotPage-DFmbkz-G.js.map
|