@weaveui/web 0.0.1 → 0.0.2
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/LICENSE +12 -12
- package/README.md +4 -6
- package/THIRD_PARTY_NOTICES +2 -2
- package/dist/apm-log.umd.cjs +1 -1
- package/dist/business/apm-log/types.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +118 -118
- package/dist/index.umd.cjs +1 -1
- package/dist/monitor.es.js +14 -14
- package/dist/monitor.umd.cjs +1 -1
- package/dist/permission.umd.cjs +1 -1
- package/dist/upload-cos.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(W,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(W=typeof globalThis<"u"?globalThis:W||self,e(W.ElementCustomUI={},W.Vue,W.ElementPlus))})(this,function(W,e,We){"use strict";const Xe="Element Custom UI",At="ElementCustomUI",Je="element-custom-ui",Ye=new WeakMap;function se(t,g){const i=t,o=t,a=g??o.name??o.__name;if(!a)throw new Error(`${Xe} component requires an explicit install name.`);let l=Ye.get(t);return l||(l=new Set,Ye.set(t,l),i.install=p=>{l==null||l.forEach(b=>{p.component(b,t)})}),l.add(a),i}/*! Element Plus Icons Vue v2.3.2 */var Lt=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),Ze=Lt,Mt=e.defineComponent({name:"ArrowLeft",__name:"arrow-left",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"})]))}}),Dt=Mt,zt=e.defineComponent({name:"ArrowRight",__name:"arrow-right",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"})]))}}),Pt=zt,Kt=e.defineComponent({name:"Check",__name:"check",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),Fe=Kt,It=e.defineComponent({name:"CircleClose",__name:"circle-close",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),Ft=It,Ut=e.defineComponent({name:"Close",__name:"close",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Ee=Ut,Rt=e.defineComponent({name:"Document",__name:"document",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}}),ve=Rt,Ot=e.defineComponent({name:"Download",__name:"download",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),jt=Ot,Ht=e.defineComponent({name:"FolderOpened",__name:"folder-opened",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M878.08 448H241.92l-96 384h636.16zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 0 1 216.96 384zm-24.96 512H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h287.872l128.384 128H864a32 32 0 0 1 32 32v96h23.04a32 32 0 0 1 31.04 39.744l-112 448A32 32 0 0 1 807.04 896"})]))}}),et=Ht,Qt=e.defineComponent({name:"FullScreen",__name:"full-screen",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"})]))}}),qt=Qt,Gt=e.defineComponent({name:"Minus",__name:"minus",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"})]))}}),Wt=Gt,Xt=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Ue=Xt,Jt=e.defineComponent({name:"RefreshLeft",__name:"refresh-left",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"})]))}}),Yt=Jt,Zt=e.defineComponent({name:"RefreshRight",__name:"refresh-right",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88"})]))}}),tt=Zt,vt=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),eo=vt,to=e.defineComponent({name:"Search",__name:"search",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),ot=to,oo=e.defineComponent({name:"Select",__name:"select",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M77.248 415.04a64 64 0 0 1 90.496 0l226.304 226.304L846.528 188.8a64 64 0 1 1 90.56 90.496l-543.04 543.04-316.8-316.8a64 64 0 0 1 0-90.496"})]))}}),lo=oo,no=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),ao=no,io=e.defineComponent({name:"UploadFilled",__name:"upload-filled",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M544 864V672h128L512 480 352 672h128v192H320v-1.6c-5.376.32-10.496 1.6-16 1.6A240 240 0 0 1 64 624c0-123.136 93.12-223.488 212.608-237.248A239.81 239.81 0 0 1 512 192a239.87 239.87 0 0 1 235.456 194.752c119.488 13.76 212.48 114.112 212.48 237.248a240 240 0 0 1-240 240c-5.376 0-10.56-1.28-16-1.6v1.6z"})]))}}),ro=io,so=e.defineComponent({name:"User",__name:"user",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 512a192 192 0 1 0 0-384 192 192 0 0 0 0 384m0 64a256 256 0 1 1 0-512 256 256 0 0 1 0 512m320 320v-96a96 96 0 0 0-96-96H288a96 96 0 0 0-96 96v96a32 32 0 1 1-64 0v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 1 1-64 0"})]))}}),lt=so,co=e.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),mo=co,uo=e.defineComponent({name:"ZoomOut",__name:"zoom-out",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"})]))}}),po=uo;const fo=["aria-disabled"],_o=["disabled","aria-pressed","onClick"],go={class:"wui-checkbox__label"},ho={class:"wui-checkbox__indicator","aria-hidden":"true"},yo=e.defineComponent({name:"Checkbox",__name:"index",props:{data:{default:()=>[]},modelValue:{default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:g}){const i=t,o=g,a=e.computed(()=>i.modelValue);function l(p){if(i.disabled)return;const b=[...i.modelValue],y=b.indexOf(p.value);y>=0?b.splice(y,1):b.push(p.value),o("update:modelValue",b)}return(p,b)=>{const y=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:"wui-checkbox","aria-disabled":t.disabled},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,$=>(e.openBlock(),e.createElementBlock("button",{key:$.value,type:"button",class:e.normalizeClass(["wui-checkbox__item",{"is-checked":a.value.includes($.value),"is-disabled":t.disabled}]),disabled:t.disabled,"aria-pressed":a.value.includes($.value),onClick:I=>l($)},[e.createElementVNode("span",go,e.toDisplayString($.label),1),e.createElementVNode("span",ho,[e.createVNode(y,{size:12},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe))]),_:1})])],10,_o))),128))],8,fo)}}}),de=(t,g)=>{const i=t.__vccOpts||t;for(const[o,a]of g)i[o]=a;return i},nt=de(yo,[["__scopeId","data-v-9fb203e3"]]),at=se(nt,"Checkbox"),wo=se(nt,"YyCheckbox"),ko=["type","disabled","aria-busy"],bo={key:0,class:"wui-button__spinner","aria-hidden":"true"},it=se(de(e.defineComponent({name:"Button",__name:"index",props:{type:{default:"primary"},size:{default:"medium"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},nativeType:{default:"button"}},emits:["click"],setup(t,{emit:g}){const i=g;function o(a){i("click",a)}return(a,l)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["wui-button",[`wui-button--${t.type}`,`wui-button--${t.size}`]]),type:t.nativeType,disabled:t.disabled||t.loading,"aria-busy":t.loading,onClick:o},[t.loading?(e.openBlock(),e.createElementBlock("span",bo)):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.loading?"处理中":"按钮"),1)],!0)],10,ko))}}),[["__scopeId","data-v-b1dd8b3e"]]),"Button"),Co={class:"wui-cat-image"},xo={class:"wui-cat-image__toolbar"},Bo=["src","alt"],Vo={key:0,class:"wui-cat-image__navigation"},Re=se(de(e.defineComponent({name:"CatImage",__name:"index",props:{modelValue:{type:Boolean},files:{default:()=>[]},fileImgList:{default:()=>[]},imgIndex:{default:0},modal:{type:Boolean},visible:{type:Boolean},previewUrl:{default:""},previewUrlResolver:{},title:{default:"图片预览"},showTrigger:{type:Boolean,default:!0}},emits:["update:modelValue","update:imgIndex","change","cancel"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(null),p=e.getCurrentInstance(),b=e.ref(!1),y=e.ref(X("modelValue")),$=e.ref(X("modal")),I=e.ref(X("visible")),h=e.ref(0),_=e.ref(!1),N=e.ref(1),T=e.ref(0),E=e.ref(0),R=e.ref(0),q=e.ref(!1);let A,z=0,x=0,r=0,n=0;const d=e.computed(()=>o.files.length?o.files:o.fileImgList),m=e.computed(()=>y.value?!!o.modelValue:b.value),k=e.computed(()=>$.value?!!o.modal:I.value?!!o.visible:!0),U=e.computed(()=>d.value[h.value]),O=e.computed(()=>{var M;return String(((M=U.value)==null?void 0:M.name)??"")}),f=e.computed(()=>_e(U.value,h.value)),P=e.computed(()=>({transform:`translate(${E.value}px, ${R.value}px) scale(${N.value}) rotate(${T.value}deg)`}));function X(M){const G=p==null?void 0:p.vnode.props;if(!G)return!1;const ne=M.replace(/[A-Z]/g,me=>`-${me.toLowerCase()}`);return Object.prototype.hasOwnProperty.call(G,M)||Object.prototype.hasOwnProperty.call(G,ne)}function v(){y.value=X("modelValue"),$.value=X("modal"),I.value=X("visible")}function le(M){y.value||(b.value=M),a("update:modelValue",M)}function re(M){return Math.min(Math.max(0,M),Math.max(0,d.value.length-1))}function _e(M,G){var me;return M?((me=o.previewUrlResolver)==null?void 0:me.call(o,M,G))||o.previewUrl||(typeof M.url=="string"?M.url:""):""}function ue(){N.value=1,T.value=0,E.value=0,R.value=0}function ye(M=o.imgIndex){d.value.length&&(h.value=re(M),ue(),a("update:imgIndex",h.value),le(!0))}function fe(){_.value=!1,q.value=!1,le(!1),a("cancel")}function V(M){M||fe()}function B(M){const G=re(M);if(G===h.value)return;h.value=G,ue(),a("update:imgIndex",G);const ne=U.value;ne&&a("change",ne,G)}function F(){N.value=Math.min(4,Number((N.value+.1).toFixed(2)))}function D(){N.value=Math.max(.1,Number((N.value-.1).toFixed(2)))}function J(){T.value-=90}function Y(){T.value+=90}function j(M){M.deltaY<0?F():D()}function we(M){var G;!f.value||M.button!==0||(A=M.pointerId,z=M.clientX,x=M.clientY,r=E.value,n=R.value,q.value=!0,(G=l.value)==null||G.setPointerCapture(M.pointerId))}function be(M){!q.value||M.pointerId!==A||(E.value=r+M.clientX-z,R.value=n+M.clientY-x)}function ke(M){var G;M.pointerId===A&&((G=l.value)!=null&&G.hasPointerCapture(M.pointerId)&&l.value.releasePointerCapture(M.pointerId),q.value=!1,A=void 0)}return e.onBeforeUpdate(()=>{v()}),e.watch(m,M=>{M&&(h.value=re(o.imgIndex),_.value=!1,ue())},{immediate:!0}),e.watch(()=>o.imgIndex,M=>{m.value&&B(M)}),e.watch(d,()=>{const M=re(h.value);M!==h.value&&(h.value=M,a("update:imgIndex",M)),m.value&&ue()},{deep:!0}),g({open:ye,close:fe,reset:ue,changeImage:B}),(M,G)=>{const ne=e.resolveComponent("el-button"),me=e.resolveComponent("el-empty"),Se=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Co,[M.$slots.default?e.renderSlot(M.$slots,"default",{key:0,open:ye,files:d.value,activeFile:U.value,visible:m.value},void 0,!0):t.showTrigger?(e.openBlock(),e.createBlock(ne,{key:1,link:"",type:"primary",disabled:!d.value.length,onClick:G[0]||(G[0]=u=>ye())},{default:e.withCtx(()=>[...G[4]||(G[4]=[e.createTextVNode(" 预览图片 ",-1)])]),_:1},8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(Se,{"model-value":m.value,fullscreen:_.value,modal:k.value,title:O.value||t.title,width:"min(1080px, 92vw)","append-to-body":"",class:"wui-cat-image__dialog","onUpdate:modelValue":V},{default:e.withCtx(()=>[e.createElementVNode("div",xo,[e.createVNode(ne,{circle:"",text:"","aria-label":"缩小",onClick:D},{default:e.withCtx(()=>[e.createVNode(e.unref(po),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"放大",onClick:F},{default:e.withCtx(()=>[e.createVNode(e.unref(mo),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"向左旋转",onClick:J},{default:e.withCtx(()=>[e.createVNode(e.unref(Yt),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"向右旋转",onClick:Y},{default:e.withCtx(()=>[e.createVNode(e.unref(tt),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"恢复原始大小",onClick:ue},{default:e.withCtx(()=>[e.createVNode(e.unref(eo),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":_.value?"退出全屏":"全屏",onClick:G[1]||(G[1]=u=>_.value=!_.value)},{default:e.withCtx(()=>[e.createVNode(e.unref(qt),{class:"wui-cat-image__tool-icon"})]),_:1},8,["aria-label"])]),e.createElementVNode("div",{ref_key:"viewportRef",ref:l,class:e.normalizeClass(["wui-cat-image__viewport",{"is-dragging":q.value}]),onPointerdown:we,onPointermove:be,onPointerup:ke,onPointercancel:ke,onWheel:e.withModifiers(j,["prevent"])},[f.value?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wui-cat-image__image",src:f.value,alt:O.value,style:e.normalizeStyle(P.value),draggable:"false"},null,12,Bo)):(e.openBlock(),e.createBlock(me,{key:1,description:"暂无可预览的图片"}))],34),d.value.length>1?(e.openBlock(),e.createElementBlock("div",Vo,[e.createVNode(ne,{disabled:h.value<=0,onClick:G[2]||(G[2]=u=>B(h.value-1))},{default:e.withCtx(()=>[e.createVNode(e.unref(Dt),{class:"wui-cat-image__button-icon"}),G[5]||(G[5]=e.createTextVNode("上一张 ",-1))]),_:1},8,["disabled"]),e.createElementVNode("span",null,e.toDisplayString(h.value+1)+" / "+e.toDisplayString(d.value.length),1),e.createVNode(ne,{disabled:h.value>=d.value.length-1,onClick:G[3]||(G[3]=u=>B(h.value+1))},{default:e.withCtx(()=>[G[6]||(G[6]=e.createTextVNode(" 下一张",-1)),e.createVNode(e.unref(Pt),{class:"wui-cat-image__button-icon"})]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),_:1},8,["model-value","fullscreen","modal","title"])])}}}),[["__scopeId","data-v-98a1fd7f"]]),"CatImage"),Eo=["disabled","title"],No={key:0,class:"wui-copy-text__icon","aria-hidden":"true"},So={key:1,class:"wui-copy-text__label"},rt=se(de(e.defineComponent({name:"CopyText",__name:"index",props:{text:{default:""},label:{default:"复制"},successText:{default:"已复制"},title:{default:""},trigger:{default:"button"},disabled:{type:Boolean,default:!1},resetDelay:{default:1600}},emits:["success","error"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(!1);let p;const b=e.computed(()=>String(o.text??""));async function y(_){var N;if(!((N=navigator.clipboard)!=null&&N.writeText))throw new Error("Clipboard API is unavailable");return await navigator.clipboard.writeText(_),"clipboard"}function $(_){const N=document.createElement("textarea");N.value=_,N.setAttribute("readonly","readonly"),N.style.position="fixed",N.style.left="-9999px",N.style.top="0",document.body.appendChild(N),N.select();const T=document.execCommand("copy");if(document.body.removeChild(N),!T)throw new Error("Fallback copy failed");return"fallback"}function I(){l.value=!0,window.clearTimeout(p),p=window.setTimeout(()=>{l.value=!1},Math.max(0,o.resetDelay))}async function h(){if(o.disabled)return;const _=b.value;try{let N;try{N=await y(_)}catch{N=$(_)}I(),a("success",{text:_,source:N})}catch(N){a("error",N)}}return e.onBeforeUnmount(()=>{window.clearTimeout(p)}),g({copy:h}),(_,N)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["wui-copy-text",[`wui-copy-text--${t.trigger}`,{"is-copied":l.value,"is-disabled":t.disabled}]]),type:"button",disabled:t.disabled,title:t.title||b.value,onClick:h},[e.renderSlot(_.$slots,"default",{copied:l.value,copy:h,text:b.value},()=>[t.trigger==="icon"?(e.openBlock(),e.createElementBlock("span",No,e.toDisplayString(l.value?"✓":"⧉"),1)):(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(l.value?t.successText:t.label),1))],!0)],10,Eo))}}),[["__scopeId","data-v-2791f53b"]]),"CopyText"),To={class:"custom-table"},$o={key:0,class:"custom-table__toolbar"},Ao={class:"custom-table__toolbar-start"},Lo={class:"custom-table__toolbar-end"},Mo={key:1,class:"custom-table__error",role:"alert"},Do={class:"custom-table__surface"},st=se(de(e.defineComponent({name:"CustomTable",inheritAttrs:!1,__name:"index",props:{columns:{},rows:{},loader:{type:Function},filters:{},page:{},pageSize:{},pagination:{type:Boolean},pageSizes:{},visibleColumnKeys:{},showRefresh:{type:Boolean},showColumnSettings:{type:Boolean},columnPersistenceKey:{},storageAdapter:{},autoLoad:{type:Boolean},exporter:{type:Function},rowKey:{type:[String,Function]},emptyText:{}},emits:["update:filters","update:page","update:pageSize","update:visibleColumnKeys","sort-change","reload","load-success","load-error","export-error","persistence-error"],setup(t,{expose:g,emit:i}){const o=[10,20,50,100],a=t,l=i,p=e.getCurrentInstance(),b=e.ref(ne("pagination")),y=e.ref(ne("showRefresh")),$=e.ref(ne("showColumnSettings")),I=e.ref(ne("autoLoad")),h=e.useSlots(),_=e.ref(null),N=e.shallowRef([]),T=e.ref(0),E=e.ref(!1),R=e.ref(!1),q=e.ref(null),A=e.ref(a.filters??{}),z=e.ref(me(a.page,1)),x=e.ref(me(a.pageSize,o[0])),r=e.ref([]),n=e.ref({key:null,order:null});let d,m=0,k=!1,U=!1,O=new Set,f=!1,P=Promise.resolve();const X=e.computed(()=>{const c=new Set;return a.columns.map((w,K)=>{const H=w.key||w.prop||`column-${K}`,ae=c.has(H)?`${H}-${K}`:H;return c.add(ae),{...w,key:ae,sourceIndex:K}})}),v=e.computed(()=>a.filters??A.value),le=e.computed(()=>a.page===void 0?z.value:me(a.page,1)),re=e.computed(()=>a.pageSize===void 0?x.value:me(a.pageSize,o[0])),_e=e.computed(()=>b.value?a.pagination:!0),ue=e.computed(()=>{const c=(a.pageSizes??o).filter(w=>w>0);return c.length?c:[...o]}),ye=e.computed(()=>a.emptyText??"暂无数据"),fe=e.computed(()=>!!a.loader),V=e.computed(()=>y.value?a.showRefresh:!0),B=e.computed(()=>$.value?a.showColumnSettings:!0);e.watch(X,c=>{const w=new Set(c.map(ie=>ie.key)),K=c.filter(ie=>ie.visible!==!1).map(ie=>ie.key);if(!U){r.value=K,U=!0,O=w;return}const H=r.value.filter(ie=>w.has(ie)),ae=new Set(H);c.forEach(ie=>{!O.has(ie.key)&&ie.visible!==!1&&!ae.has(ie.key)&&H.push(ie.key)}),r.value=H,O=w},{immediate:!0});const F=e.computed(()=>{const c=a.visibleColumnKeys??r.value;return u(c)}),D=e.computed(()=>{const c=new Set(F.value);return X.value.filter(w=>c.has(w.key))}),J=e.computed(()=>X.value.filter(c=>Se(c))),Y=e.computed({get:()=>{const c=new Set(F.value);return J.value.filter(w=>c.has(w.key)).map(w=>w.key)},set:c=>{const w=X.value.filter(K=>!Se(K)).filter(K=>F.value.includes(K.key)).map(K=>K.key);ge([...w,...c])}}),j=e.computed(()=>a.rows??[]),we=e.computed(()=>{const c=j.value.map((ae,ie)=>({row:ae,index:ie})),w=n.value;if(!w.key||!w.order)return c.map(({row:ae})=>ae);const K=X.value.find(ae=>ae.key===w.key);if(!K)return c.map(({row:ae})=>ae);const H=w.order==="ascending"?1:-1;return c.sort((ae,ie)=>(K.sortMethod?K.sortMethod(ae.row,ie.row):s(xe(ae.row,K,ae.index),xe(ie.row,K,ie.index)))*H).map(({row:ae})=>ae)}),be=e.computed(()=>{if(fe.value)return N.value;if(!_e.value)return we.value;const c=(le.value-1)*re.value;return we.value.slice(c,c+re.value)}),ke=e.computed(()=>fe.value?T.value:j.value.length),M=e.computed(()=>!!(h.toolbar||h["toolbar-left"]||h["toolbar-right"]||V.value||a.exporter||B.value&&J.value.length)),G=e.computed(()=>({filters:v.value,page:le.value,pageSize:re.value,visibleColumnKeys:F.value,loading:E.value,exporting:R.value,reload:L,setFilters:oe,setVisibleColumnKeys:ge,exportRows:pe}));e.watch(()=>a.filters,c=>{c!==void 0&&(A.value=c)},{deep:!0}),e.watch(()=>a.page,c=>{c!==void 0&&(z.value=me(c,1))}),e.watch(()=>a.pageSize,c=>{c!==void 0&&(x.value=me(c,o[0]))}),e.watch(v,()=>{if(!(!k||!fe.value)){if(le.value!==1){S(1);return}L()}},{deep:!0}),e.watch(le,()=>{k&&fe.value&&L()}),e.watch(re,()=>{if(!(!k||!fe.value)){if(le.value!==1){S(1);return}L()}}),e.watch(()=>a.loader,(c,w)=>{if(!c){d==null||d.abort();return}k&&c!==w&&L()}),e.watch(F,c=>{Te(c)},{deep:!0}),e.onMounted(async()=>{k=!0,await he(),fe.value&&(!I.value||a.autoLoad)&&await L()}),e.onBeforeUpdate(()=>{b.value=ne("pagination"),y.value=ne("showRefresh"),$.value=ne("showColumnSettings"),I.value=ne("autoLoad")});function ne(c){const w=p==null?void 0:p.vnode.props;if(!w)return!1;const K=c.replace(/[A-Z]/g,H=>`-${H.toLowerCase()}`);return Object.prototype.hasOwnProperty.call(w,c)||Object.prototype.hasOwnProperty.call(w,K)}e.onBeforeUnmount(()=>{m+=1,d==null||d.abort()});function me(c,w){return!Number.isFinite(c)||!c||c<1?w:Math.floor(c)}function Se(c){return c.hideable!==void 0?c.hideable:c.type===void 0||c.type==="default"}function u(c){const w=new Set(X.value.map(H=>H.key)),K=[];return c.forEach(H=>{w.has(H)&&!K.includes(H)&&K.push(H)}),K}function S(c){const w=me(c,1);a.page===void 0&&(z.value=w),l("update:page",w)}function Z(c){const w=me(c,o[0]);a.pageSize===void 0&&(x.value=w),l("update:pageSize",w),S(1)}function oe(c){a.filters===void 0&&(A.value=c),l("update:filters",c),le.value!==1&&S(1)}function ge(c){const w=u(c);a.visibleColumnKeys===void 0&&(r.value=w),l("update:visibleColumnKeys",w)}function Ce(c){return c.cellSlot??c.slot??`cell:${c.key}`}function Me(c){return c.headerSlot??c.header??`header:${c.key}`}function xe(c,w,K){return w.value?w.value(c,K):w.prop?Ve(c,w.prop):void 0}function Ve(c,w){return w.split(".").reduce((K,H)=>{if(K!==null&&typeof K=="object"&&H in K)return K[H]},c)}function ce(c,w,K){var ie;const H=xe(c,w,K),ae=(ie=w.formatter)==null?void 0:ie.call(w,{row:c,column:w,index:K,value:H});return Ie(ae??H)}function Ie(c){return c==null||c===""?"-":c instanceof Date?c.toLocaleString():typeof c=="object"?JSON.stringify(c):String(c)}function s(c,w){return c===w?0:c==null?-1:w==null?1:typeof c=="number"&&typeof w=="number"?c-w:String(c).localeCompare(String(w),void 0,{numeric:!0,sensitivity:"base"})}function C(c){const w=X.value.find(K=>K.prop===c.prop||K.key===c.prop);n.value={key:(w==null?void 0:w.key)??null,order:c.order},l("sort-change",{...n.value}),fe.value&&L()}async function L(){l("reload");const c=a.loader;if(!c)return;d==null||d.abort();const w=new AbortController,K=++m;d=w,E.value=!0,q.value=null;try{const H=await c({filters:v.value,page:le.value,pageSize:re.value,sort:{...n.value},signal:w.signal});if(w.signal.aborted||K!==m)return;const ae=Number.isFinite(H.total)?Math.max(0,H.total):H.rows.length,ie={rows:[...H.rows],total:ae};N.value=[...ie.rows],T.value=ie.total,l("load-success",ie)}catch(H){if(w.signal.aborted||K!==m||De(H))return;q.value=Ge(H),l("load-error",H)}finally{K===m&&(E.value=!1,d=void 0)}}function Q(){var c;(c=_.value)==null||c.clearSelection()}function ee(){return _.value}async function pe(){const c=a.exporter;if(!(!c||R.value)){R.value=!0;try{const w={rows:[...be.value],columns:[...D.value],filters:v.value,page:le.value,pageSize:re.value,total:ke.value,sort:{...n.value}};await c(w)}catch(w){l("export-error",w)}finally{R.value=!1}}}async function he(){const c=a.storageAdapter,w=a.columnPersistenceKey;if(!c||!w||a.visibleColumnKeys!==void 0){f=!0;return}try{const K=await c.getItem(w);if(K){const H=JSON.parse(K);Array.isArray(H)&&H.every(ae=>typeof ae=="string")&&(r.value=u(H),l("update:visibleColumnKeys",r.value))}}catch(K){l("persistence-error",K)}finally{f=!0}}function Te(c){const w=a.storageAdapter,K=a.columnPersistenceKey;if(!f||!w||!K)return;const H=JSON.stringify(c);P=P.then(()=>w.setItem(K,H)).catch(ae=>{l("persistence-error",ae)})}function De(c){return c instanceof Error&&c.name==="AbortError"}function Ge(c){return c instanceof Error&&c.message?c.message:typeof c=="string"&&c?c:"加载失败,请稍后重试。"}return g({reload:L,clearSelection:Q,setFilters:oe,setVisibleColumnKeys:ge,getTableInstance:ee}),(c,w)=>{const K=e.resolveComponent("el-button"),H=e.resolveComponent("el-tooltip"),ae=e.resolveComponent("el-checkbox"),ie=e.resolveComponent("el-checkbox-group"),$t=e.resolveComponent("el-popover"),Yn=e.resolveComponent("el-table-column"),Zn=e.resolveComponent("el-empty"),vn=e.resolveComponent("el-table"),ea=e.resolveComponent("el-pagination"),ta=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("section",To,[M.value?(e.openBlock(),e.createElementBlock("div",$o,[e.renderSlot(c.$slots,"toolbar",e.normalizeProps(e.guardReactiveProps(G.value)),()=>[e.createElementVNode("div",Ao,[e.renderSlot(c.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(G.value)),void 0,!0)]),e.createElementVNode("div",Lo,[e.renderSlot(c.$slots,"toolbar-right",e.normalizeProps(e.guardReactiveProps(G.value)),void 0,!0),V.value?(e.openBlock(),e.createBlock(H,{key:0,content:"刷新",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"刷新",circle:"",disabled:E.value,onClick:L},{default:e.withCtx(()=>[e.createVNode(e.unref(tt),{class:"custom-table__tool-icon"})]),_:1},8,["disabled"])]),_:1})):e.createCommentVNode("",!0),a.exporter?(e.openBlock(),e.createBlock(H,{key:1,content:"导出",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"导出",circle:"",loading:R.value,onClick:pe},{default:e.withCtx(()=>[e.createVNode(e.unref(jt),{class:"custom-table__tool-icon"})]),_:1},8,["loading"])]),_:1})):e.createCommentVNode("",!0),B.value&&J.value.length?(e.openBlock(),e.createBlock($t,{key:2,placement:"bottom-end",trigger:"click",width:"220"},{reference:e.withCtx(()=>[e.createVNode(H,{content:"列设置",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"列设置",circle:""},{default:e.withCtx(()=>[e.createVNode(e.unref(ao),{class:"custom-table__tool-icon"})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(ie,{modelValue:Y.value,"onUpdate:modelValue":w[0]||(w[0]=te=>Y.value=te),class:"custom-table__column-settings"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,te=>(e.openBlock(),e.createBlock(ae,{key:te.key,label:te.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(te.label||te.prop||te.key),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})):e.createCommentVNode("",!0)])],!0)])):e.createCommentVNode("",!0),q.value?(e.openBlock(),e.createElementBlock("div",Mo,[e.createElementVNode("span",null,e.toDisplayString(q.value),1),e.createVNode(K,{link:"",type:"primary",onClick:L},{default:e.withCtx(()=>[...w[1]||(w[1]=[e.createTextVNode("重试",-1)])]),_:1})])):e.createCommentVNode("",!0),e.createElementVNode("div",Do,[e.withDirectives((e.openBlock(),e.createBlock(vn,e.mergeProps({ref_key:"tableRef",ref:_,data:be.value,"row-key":a.rowKey,onSortChange:C},c.$attrs),{empty:e.withCtx(()=>[e.createVNode(Zn,{description:ye.value,"image-size":80},null,8,["description"])]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,te=>(e.openBlock(),e.createBlock(Yn,{key:te.key,align:te.align,"class-name":te.className,"column-key":te.key,fixed:te.fixed,"header-align":te.headerAlign,label:te.label,"label-class-name":te.labelClassName,"min-width":te.minWidth,prop:te.prop,"show-overflow-tooltip":te.showOverflowTooltip,sortable:te.sortable?"custom":!1,type:te.type,width:te.width,index:te.index},{header:e.withCtx(()=>[e.renderSlot(c.$slots,Me(te),{column:te,index:te.sourceIndex},()=>[e.createTextVNode(e.toDisplayString(te.label),1)],!0)]),default:e.withCtx($e=>[e.renderSlot(c.$slots,Ce(te),{column:te,index:$e.$index,row:$e.row,value:xe($e.row,te,$e.$index)},()=>[e.createTextVNode(e.toDisplayString(ce($e.row,te,$e.$index)),1)],!0)]),_:2},1032,["align","class-name","column-key","fixed","header-align","label","label-class-name","min-width","prop","show-overflow-tooltip","sortable","type","width","index"]))),128))]),_:3},16,["data","row-key"])),[[ta,E.value]])]),_e.value?(e.openBlock(),e.createBlock(ea,{key:2,class:"custom-table__pagination",background:"","current-page":le.value,layout:"total, sizes, prev, pager, next, jumper","page-size":re.value,"page-sizes":ue.value,total:ke.value,onCurrentChange:S,onSizeChange:Z},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-324d7221"]]),"CustomTable"),zo={id:"id",label:"label",children:"children",type:"type",disabled:"disabled"};function ze(t){return`${typeof t}:${String(t)}`}function ct(t){return typeof t=="string"||typeof t=="number"}function Po(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ae(t,g,i){const o=g??zo[i];return typeof o=="function"?o(t):t[o]}function Ko(t,g){const i=Ae(t,g.children,"children");return Array.isArray(i)?i.filter(Po):[]}function dt(t,g){const i={nodes:[],nodeByToken:new Map,rootKeys:[],maxDepth:0},o=new WeakSet,a=(l,p,b)=>{if(o.has(l))return;const y=Ae(l,g.id,"id");if(!ct(y)||i.nodeByToken.has(ze(y)))return;const $=Ae(l,g.label,"label"),I=Ae(l,g.type,"type"),h=Ae(l,g.disabled,"disabled"),_={key:y,label:$==null?String(y):String($),type:typeof I=="string"?I:void 0,disabled:h===!0,source:l,parentKey:p,childKeys:[],depth:b};return i.nodes.push(_),i.nodeByToken.set(ze(_.key),_),i.maxDepth=Math.max(i.maxDepth,b),o.add(l),Ko(l,g).forEach(N=>{const T=a(N,_.key,b+1);T&&_.childKeys.push(T.key)}),o.delete(l),_};return t.forEach(l=>{const p=a(l,void 0,0);p&&i.rootKeys.push(p.key)}),i}const Io={key:1,class:"wui-custom-tree__nodes",role:"tree"},Fo=["title","onClick"],Uo={class:"wui-custom-tree__node-label"},Ro={key:2,class:"wui-custom-tree__empty"},Oo={key:0,class:"wui-custom-tree__selected"},jo={key:0,class:"wui-custom-tree__selected-list"},Ho=["aria-label","onClick"],Qo={key:1,class:"wui-custom-tree__empty"},mt=se(de(e.defineComponent({name:"CustomTree",__name:"index",props:{data:{default:()=>[]},modelValue:{default:()=>[]},fields:{default:()=>({})},maxColumns:{default:0},selectionStrategy:{default:"parent"},isSelectable:{},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},searchColumns:{},showSelected:{type:Boolean,default:!0},maxHeight:{},emptyText:{default:"暂无数据"}},emits:["update:modelValue","change"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(new Set),p=e.ref([]),b=e.ref([]),y=e.computed(()=>dt(o.data,o.fields)),$=e.computed(()=>{const V=y.value.maxDepth+1;return o.maxColumns>0?Math.min(V,o.maxColumns):V}),I=e.computed(()=>Array.from({length:Math.max($.value,1)},(V,B)=>B)),h=e.computed(()=>({"--wui-custom-tree-max-height":N(o.maxHeight,"420px")})),_=e.computed(()=>le(l.value));function N(V,B){return typeof V=="number"?`${V}px`:V||B}function T(V){return ze(V)}function E(V){return y.value.nodeByToken.get(T(V))}function R(V){const B=y.value.nodes.find(F=>F.source===V);return(B==null?void 0:B.key)??""}function q(V){const B=y.value.nodes.find(F=>F.source===V);return(B==null?void 0:B.label)??""}function A(V){var J,Y;const B=V===0?void 0:p.value[V-1],F=B===void 0?y.value.rootKeys:((J=E(B))==null?void 0:J.childKeys)??[],D=(Y=b.value[V])==null?void 0:Y.trim().toLocaleLowerCase();return F.map(E).filter(j=>j!==void 0).filter(j=>!D||j.label.toLocaleLowerCase().includes(D))}function z(V){return o.searchable?o.searchColumns===void 0?!0:(Array.isArray(o.searchColumns)?o.searchColumns:[o.searchColumns]).includes(V):!1}function x(V,B){return p.value[V]===B}function r(V,B){const F=p.value.slice(0,V);F[V]=B.key,p.value=F,b.value=b.value.slice(0,V+1)}function n(V){var B;return!V.disabled&&(((B=o.isSelectable)==null?void 0:B.call(o,V.source))??!0)}function d(V){const B=[],F=D=>{n(D)&&B.push(T(D.key)),D.childKeys.forEach(J=>{const Y=E(J);Y&&F(Y)})};return F(V),B}function m(V){return l.value.has(T(V))}function k(V){const B=E(V);if(!B)return!1;const F=d(B),D=F.filter(J=>l.value.has(J)).length;return D>0&&D<F.length}function U(V){if(o.disabled||!n(V))return;const B=new Set(l.value),F=d(V),D=!m(V.key);F.forEach(J=>{D?B.add(J):B.delete(J)}),re(B)}function O(V){const B=y.value.nodes.find(F=>F.source===V);B&&U(B)}function f(V){return y.value.nodes.filter(B=>V.has(T(B.key))&&n(B)).map(B=>B.key)}function P(V){return y.value.nodes.filter(B=>!V.has(T(B.key))||!n(B)?!1:!B.childKeys.some(F=>{const D=E(F);return D?d(D).length>0:!1})).map(B=>B.key)}function X(V){if(o.selectionStrategy==="all")return f(V);if(o.selectionStrategy==="leaf")return P(V);const B=[],F=D=>{const J=d(D);if(J.length){if(n(D)&&J.every(Y=>V.has(Y))){B.push(T(D.key));return}if(n(D)&&V.has(T(D.key))&&D.childKeys.length===0){B.push(T(D.key));return}D.childKeys.forEach(Y=>{const j=E(Y);j&&F(j)})}};return y.value.rootKeys.forEach(D=>{const J=E(D);J&&F(J)}),B.map(D=>{var J;return(J=y.value.nodeByToken.get(D))==null?void 0:J.key}).filter(D=>D!==void 0)}function v(V){return V.map(E).filter(B=>B!==void 0).map(B=>B.source)}function le(V){const B=f(V),F=X(V),D=P(V);return{checkedKeys:B,selectedKeys:F,selectedNodes:v(F),leafNodes:v(D)}}function re(V){l.value=V;const B=le(V);a("update:modelValue",B.selectedKeys),a("change",B)}function _e(){const V=new Set;o.modelValue.forEach(B=>{const F=E(B);F&&d(F).forEach(D=>V.add(D))}),l.value=V,ue()}function ue(){const V=X(l.value)[0],B=[];let F=V===void 0?void 0:E(V);for(;(F==null?void 0:F.parentKey)!==void 0;){const D=E(F.parentKey);if(!D)break;B.unshift(D.key),F=D}p.value=B}function ye(){o.disabled||l.value.size===0||re(new Set)}return g({clear:ye,getSelection:()=>le(l.value)}),e.watch([y,()=>o.modelValue],()=>{_e()},{deep:!0,immediate:!0}),(V,B)=>{const F=e.resolveComponent("el-input"),D=e.resolveComponent("el-icon"),J=e.resolveComponent("el-checkbox");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wui-custom-tree",{"is-disabled":t.disabled}])},[e.createElementVNode("div",{class:"wui-custom-tree__columns",style:e.normalizeStyle(h.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,Y=>(e.openBlock(),e.createElementBlock("section",{key:Y,class:"wui-custom-tree__column"},[z(Y)?(e.openBlock(),e.createBlock(F,{key:0,modelValue:b.value[Y],"onUpdate:modelValue":j=>b.value[Y]=j,clearable:"","prefix-icon":e.unref(ot),placeholder:"搜索",class:"wui-custom-tree__search"},null,8,["modelValue","onUpdate:modelValue","prefix-icon"])):e.createCommentVNode("",!0),A(Y).length?(e.openBlock(),e.createElementBlock("div",Io,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A(Y),j=>(e.openBlock(),e.createElementBlock("div",{key:T(j.key),class:e.normalizeClass(["wui-custom-tree__node",{"is-active":x(Y,j.key),"is-selected":m(j.key),"is-not-selectable":!n(j)}])},[e.createElementVNode("button",{type:"button",class:"wui-custom-tree__node-main",title:j.label,onClick:we=>r(Y,j)},[e.createVNode(D,{class:"wui-custom-tree__node-icon"},{default:e.withCtx(()=>[j.childKeys.length&&x(Y,j.key)?(e.openBlock(),e.createBlock(e.unref(Wt),{key:0})):j.childKeys.length?(e.openBlock(),e.createBlock(e.unref(Ue),{key:1})):e.createCommentVNode("",!0)]),_:2},1024),e.createElementVNode("span",Uo,e.toDisplayString(j.label),1)],8,Fo),n(j)?(e.openBlock(),e.createBlock(J,{key:0,"model-value":m(j.key),indeterminate:k(j.key),disabled:t.disabled||!n(j),"aria-label":`选择 ${j.label}`,onClick:B[0]||(B[0]=e.withModifiers(()=>{},["stop"])),onChange:we=>U(j)},null,8,["model-value","indeterminate","disabled","aria-label","onChange"])):e.createCommentVNode("",!0)],2))),128))])):(e.openBlock(),e.createElementBlock("p",Ro,e.toDisplayString(Y===0?t.emptyText:"请先选择上级节点"),1))]))),128))],4),t.showSelected?(e.openBlock(),e.createElementBlock("aside",Oo,[B[1]||(B[1]=e.createElementVNode("div",{class:"wui-custom-tree__selected-title"},"当前选择",-1)),_.value.selectedNodes.length?(e.openBlock(),e.createElementBlock("div",jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value.selectedNodes,Y=>(e.openBlock(),e.createElementBlock("div",{key:T(R(Y)),class:"wui-custom-tree__selected-item"},[e.createElementVNode("span",null,e.toDisplayString(q(Y)),1),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wui-custom-tree__remove","aria-label":`移除 ${q(Y)}`,onClick:j=>O(Y)},[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(e.unref(Ee))]),_:1})],8,Ho))]))),128))])):(e.openBlock(),e.createElementBlock("p",Qo,"尚未选择节点"))])):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-ef3417d1"]]),"CustomTree"),qo=["disabled"],Oe="1990-01-01",je="2099-12-31",ut=de(e.defineComponent({name:"DaterangePicker",__name:"index",props:{modelValue:{default:null},disabled:{type:Boolean,default:!1},type:{default:"end"}},emits:["update:modelValue","change"],setup(t,{emit:g}){const i=t,o=g,a=e.ref(null),l=e.ref(!1),p=e.ref(null),b=e.computed(()=>l.value),y=[{text:"长期",value:()=>(l.value=!0,[new Date(Oe),new Date(je)])}];function $(E){return Array.isArray(E)&&E[0]===Oe&&E[1]===je}function I(E){if($(E)){l.value=!0,a.value=E;return}l.value=!1,a.value=E}function h(E){o("update:modelValue",E),o("change",E)}function _(E){if(l.value){const R=[Oe,je];a.value=R,h(R);return}l.value=!1,h(E)}function N(){var E;i.disabled||(l.value=!1,(E=p.value)==null||E.focus())}function T(){i.disabled||(l.value=!1,a.value=null,h(null))}return e.watch(()=>i.modelValue,E=>I(E),{immediate:!0}),(E,R)=>{const q=e.resolveComponent("el-date-picker"),A=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wui-daterange",{"is-disabled":t.disabled}])},[e.createVNode(q,{ref_key:"datePickerRef",ref:p,modelValue:a.value,"onUpdate:modelValue":R[0]||(R[0]=z=>a.value=z),class:"wui-daterange__picker",type:"daterange","value-format":"YYYY-MM-DD","start-placeholder":"开始时间","end-placeholder":"结束时间","range-separator":"至",shortcuts:y,disabled:t.disabled,onChange:_},null,8,["modelValue","disabled"]),b.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wui-daterange__long-term",type:"button",disabled:t.disabled,onClick:N},[R[1]||(R[1]=e.createElementVNode("span",null,"长期",-1)),e.createVNode(A,{class:"wui-daterange__clear",onClick:e.withModifiers(T,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(Ft))]),_:1})],8,qo)):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-1211364c"]]),pt=se(ut,"DaterangePicker"),Go=se(ut,"DateRangePicker"),Wo={key:0,class:"wui-dialog__navigation"},Xo=["disabled","onClick"],Jo={class:"wui-dialog__content"},Yo={key:2,class:"wui-dialog__sections"},Zo=["disabled","aria-expanded","onClick"],vo={class:"wui-dialog__section-icon"},el={class:"wui-dialog__section-body"},tl={class:"wui-dialog__footer"},ol={key:0,class:"wui-dialog__step-actions"},ft=se(de(e.defineComponent({name:"Dialog",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},width:{default:"900px"},mode:{default:"default"},items:{default:()=>[]},activeKey:{},expandedKeys:{default:()=>[]},showClose:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},showStepActions:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!0}},emits:["update:modelValue","update:activeKey","update:expandedKeys","change","close"],setup(t,{emit:g}){const i=t,o=g,a=e.useSlots(),l=e.computed(()=>i.items.filter(m=>!m.hidden)),p=e.computed(()=>l.value.filter(m=>!m.disabled)),b=e.computed(()=>{const m=l.value.find(k=>k.key===i.activeKey);return m&&!m.disabled?m:p.value[0]}),y=e.computed(()=>{var m;return(m=b.value)==null?void 0:m.key}),$=e.computed(()=>i.mode==="steps"&&i.showNavigation&&l.value.length>0),I=e.computed(()=>i.mode==="steps"&&i.showStepActions&&p.value.length>1),h=e.computed(()=>p.value.findIndex(m=>m.key===y.value)),_=e.computed(()=>h.value>0?p.value[h.value-1]:void 0),N=e.computed(()=>h.value>=0&&h.value<p.value.length-1?p.value[h.value+1]:void 0),T=e.computed(()=>i.mode==="steps"&&p.value.length>0&&!N.value),E=e.computed(()=>!!a.footer&&(i.mode!=="steps"||T.value)),R=e.computed(()=>I.value||E.value);function q(m){o("update:modelValue",m)}function A(){o("close")}function z(){o("update:modelValue",!1)}function x(m){m.disabled||(o("update:activeKey",m.key),o("change",m))}function r(m){const k=m===1?N.value:_.value;k&&x(k)}function n(m){return i.expandedKeys.includes(m)}function d(m){if(m.disabled)return;const k=n(m.key)?i.expandedKeys.filter(U=>U!==m.key):[...i.expandedKeys,m.key];o("update:expandedKeys",k)}return(m,k)=>{const U=e.resolveComponent("el-button"),O=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(O,e.mergeProps(m.$attrs,{"model-value":t.modelValue,title:t.title,width:t.width,"show-close":t.showClose,"destroy-on-close":t.destroyOnClose,class:"wui-dialog","onUpdate:modelValue":q,onClose:A}),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["wui-dialog__layout",{"wui-dialog__layout--with-nav":$.value}])},[$.value?(e.openBlock(),e.createElementBlock("aside",Wo,[e.renderSlot(m.$slots,"navigation",{items:l.value,activeKey:y.value,select:x},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createElementBlock("button",{key:f.key,type:"button",class:e.normalizeClass(["wui-dialog__nav-item",{"is-active":f.key===y.value,"is-disabled":f.disabled}]),disabled:f.disabled,onClick:P=>x(f)},e.toDisplayString(f.label),11,Xo))),128))],!0)])):e.createCommentVNode("",!0),e.createElementVNode("main",Jo,[t.mode==="default"?e.renderSlot(m.$slots,"default",{key:0},void 0,!0):t.mode==="steps"?e.renderSlot(m.$slots,"panel",{key:1,item:b.value,activeKey:y.value},void 0,!0):(e.openBlock(),e.createElementBlock("div",Yo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.key,class:"wui-dialog__section"},[e.createElementVNode("button",{type:"button",class:"wui-dialog__section-header",disabled:f.disabled,"aria-expanded":n(f.key),onClick:P=>d(f)},[e.createElementVNode("span",null,e.toDisplayString(f.label),1),e.createElementVNode("span",vo,e.toDisplayString(n(f.key)?"收起":"展开"),1)],8,Zo),e.withDirectives(e.createElementVNode("div",el,[e.renderSlot(m.$slots,"section",{item:f,expanded:n(f.key)},void 0,!0)],512),[[e.vShow,n(f.key)]])]))),128))]))])],2)]),_:2},[R.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",tl,[I.value?(e.openBlock(),e.createElementBlock("div",ol,[_.value?(e.openBlock(),e.createBlock(U,{key:0,onClick:k[0]||(k[0]=f=>r(-1))},{default:e.withCtx(()=>[...k[2]||(k[2]=[e.createTextVNode("上一步",-1)])]),_:1})):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createBlock(U,{key:1,type:"primary",onClick:k[1]||(k[1]=f=>r(1))},{default:e.withCtx(()=>[...k[3]||(k[3]=[e.createTextVNode("下一步",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),E.value?e.renderSlot(m.$slots,"footer",{key:1,item:b.value,activeKey:y.value,close:z},void 0,!0):e.createCommentVNode("",!0)])]),key:"0"}:void 0]),1040,["model-value","title","width","show-close","destroy-on-close"])}}}),[["__scopeId","data-v-1e7710fa"]]),"Dialog"),ll=["contenteditable","data-placeholder","aria-multiline","aria-disabled"],nl={key:0,class:"editable-box__counter","aria-live":"polite"},al={key:0,class:"editable-box__module-panel"},il={key:0,class:"editable-box__module-group"},rl={class:"editable-box__module-list"},sl=["disabled","onClick"],cl={class:"editable-box__module-list"},dl=["disabled","onClick"],Pe="",_t=se(de(e.defineComponent({__name:"EditableBox",props:{modelValue:{default:()=>[]},fixedModules:{default:()=>[]},moduleGroups:{default:()=>[]},fixedGroupTitle:{default:"固定变量"},textLimit:{default:0},moduleLimit:{default:0},width:{default:"100%"},height:{},textType:{default:"text"},placeholder:{default:"请输入内容"},showCounter:{type:Boolean,default:!0},draggable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},allowLineBreak:{type:Boolean,default:!0}},emits:["update:modelValue","change","blur","limit-exceed"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(null),p=e.ref([]),b=e.ref(0),y=e.ref(!1),$=e.ref(!1),I=e.ref(!1);let h=null,_=null,N=null,T="";const E=new RegExp(Pe,"g"),R=e.computed(()=>[...o.fixedModules,...o.moduleGroups.flatMap(s=>s.modules)]),q=e.computed(()=>new Map(R.value.map(s=>[String(s.id),s]))),A=e.computed(()=>o.fixedModules.length>0||o.moduleGroups.some(s=>s.modules.length>0));function z(s){if(!(s===void 0||s===""))return typeof s=="number"?`${s}px`:s}const x=e.computed(()=>({width:z(o.width)})),r=e.computed(()=>({height:z(o.height),minHeight:o.height===void 0?void 0:"0px"})),n=s=>s>0?s:"不限",d=s=>String(s),m=s=>String(s),k=s=>Array.from(s).length,U=s=>p.value.includes(d(s));function O(s){return!!(l.value&&l.value.contains(s.commonAncestorContainer))}function f(){const s=window.getSelection();if(!s||s.rangeCount===0)return;const C=s.getRangeAt(0);O(C)&&(h=C.cloneRange())}function P(){const s=document.createRange();return l.value&&(s.selectNodeContents(l.value),s.collapse(!1)),s}function X(){return h&&O(h)?h.cloneRange():P()}function v(s){const C=window.getSelection();C&&(C.removeAllRanges(),C.addRange(s),h=s.cloneRange())}function le(){var C;(C=l.value)==null||C.focus();const s=X();v(s)}function re(s){const C=document.createElement("span");return C.className="editable-box__tag",C.textContent=s.label,C.contentEditable="false",C.draggable=o.draggable&&!o.disabled&&!s.disabled,C.setAttribute("role","button"),C.setAttribute("aria-label",`变量:${s.label}`),C.dataset.id=d(s.id),C.dataset.type=m(s.type??"module"),C.addEventListener("dragstart",ge),C.addEventListener("dragend",Ce),C}function _e(){return document.createTextNode(Pe)}function ue(s){return!!(s&&s.nodeType===Node.TEXT_NODE&&s.textContent===Pe)}function ye(s){return s.replace(E,"")}function fe(){if(!l.value)return[];const s=document.createTreeWalker(l.value,NodeFilter.SHOW_TEXT,{acceptNode(Q){var ee;return(ee=Q.parentElement)!=null&&ee.closest(".editable-box__tag")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),C=[];let L=s.nextNode();for(;L;)C.push(L),L=s.nextNode();return C}function V(){if(!l.value)return"";let s="";function C(L){if(L.nodeType===Node.TEXT_NODE){s+=ye(L.textContent||"");return}if(L.nodeType!==Node.ELEMENT_NODE)return;const Q=L;if(!Q.classList.contains("editable-box__tag")){if(Q.tagName==="BR"){s+=`
|
|
1
|
+
(function(W,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(W=typeof globalThis<"u"?globalThis:W||self,e(W.WeaveUI={},W.Vue,W.ElementPlus))})(this,function(W,e,We){"use strict";const Xe="Weave UI",At="WeaveUI",Je="weave-ui",Ye=new WeakMap;function se(t,g){const i=t,o=t,a=g??o.name??o.__name;if(!a)throw new Error(`${Xe} component requires an explicit install name.`);let l=Ye.get(t);return l||(l=new Set,Ye.set(t,l),i.install=p=>{l==null||l.forEach(b=>{p.component(b,t)})}),l.add(a),i}/*! Element Plus Icons Vue v2.3.2 */var Lt=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),Ze=Lt,Mt=e.defineComponent({name:"ArrowLeft",__name:"arrow-left",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"})]))}}),Dt=Mt,zt=e.defineComponent({name:"ArrowRight",__name:"arrow-right",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"})]))}}),Pt=zt,Kt=e.defineComponent({name:"Check",__name:"check",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"})]))}}),Fe=Kt,It=e.defineComponent({name:"CircleClose",__name:"circle-close",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),e.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),Ft=It,Ut=e.defineComponent({name:"Close",__name:"close",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),Ee=Ut,Rt=e.defineComponent({name:"Document",__name:"document",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"})]))}}),ve=Rt,Ot=e.defineComponent({name:"Download",__name:"download",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),jt=Ot,Ht=e.defineComponent({name:"FolderOpened",__name:"folder-opened",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M878.08 448H241.92l-96 384h636.16zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 0 1 216.96 384zm-24.96 512H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h287.872l128.384 128H864a32 32 0 0 1 32 32v96h23.04a32 32 0 0 1 31.04 39.744l-112 448A32 32 0 0 1 807.04 896"})]))}}),et=Ht,Qt=e.defineComponent({name:"FullScreen",__name:"full-screen",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"})]))}}),qt=Qt,Gt=e.defineComponent({name:"Minus",__name:"minus",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"})]))}}),Wt=Gt,Xt=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Ue=Xt,Jt=e.defineComponent({name:"RefreshLeft",__name:"refresh-left",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"})]))}}),Yt=Jt,Zt=e.defineComponent({name:"RefreshRight",__name:"refresh-right",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88"})]))}}),tt=Zt,vt=e.defineComponent({name:"Refresh",__name:"refresh",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})]))}}),eo=vt,to=e.defineComponent({name:"Search",__name:"search",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),ot=to,oo=e.defineComponent({name:"Select",__name:"select",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M77.248 415.04a64 64 0 0 1 90.496 0l226.304 226.304L846.528 188.8a64 64 0 1 1 90.56 90.496l-543.04 543.04-316.8-316.8a64 64 0 0 1 0-90.496"})]))}}),lo=oo,no=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),ao=no,io=e.defineComponent({name:"UploadFilled",__name:"upload-filled",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M544 864V672h128L512 480 352 672h128v192H320v-1.6c-5.376.32-10.496 1.6-16 1.6A240 240 0 0 1 64 624c0-123.136 93.12-223.488 212.608-237.248A239.81 239.81 0 0 1 512 192a239.87 239.87 0 0 1 235.456 194.752c119.488 13.76 212.48 114.112 212.48 237.248a240 240 0 0 1-240 240c-5.376 0-10.56-1.28-16-1.6v1.6z"})]))}}),ro=io,so=e.defineComponent({name:"User",__name:"user",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 512a192 192 0 1 0 0-384 192 192 0 0 0 0 384m0 64a256 256 0 1 1 0-512 256 256 0 0 1 0 512m320 320v-96a96 96 0 0 0-96-96H288a96 96 0 0 0-96 96v96a32 32 0 1 1-64 0v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 1 1-64 0"})]))}}),lt=so,co=e.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),mo=co,uo=e.defineComponent({name:"ZoomOut",__name:"zoom-out",setup(t){return(g,i)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"})]))}}),po=uo;const fo=["aria-disabled"],_o=["disabled","aria-pressed","onClick"],go={class:"wui-checkbox__label"},ho={class:"wui-checkbox__indicator","aria-hidden":"true"},yo=e.defineComponent({name:"Checkbox",__name:"index",props:{data:{default:()=>[]},modelValue:{default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:g}){const i=t,o=g,a=e.computed(()=>i.modelValue);function l(p){if(i.disabled)return;const b=[...i.modelValue],y=b.indexOf(p.value);y>=0?b.splice(y,1):b.push(p.value),o("update:modelValue",b)}return(p,b)=>{const y=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:"wui-checkbox","aria-disabled":t.disabled},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,$=>(e.openBlock(),e.createElementBlock("button",{key:$.value,type:"button",class:e.normalizeClass(["wui-checkbox__item",{"is-checked":a.value.includes($.value),"is-disabled":t.disabled}]),disabled:t.disabled,"aria-pressed":a.value.includes($.value),onClick:I=>l($)},[e.createElementVNode("span",go,e.toDisplayString($.label),1),e.createElementVNode("span",ho,[e.createVNode(y,{size:12},{default:e.withCtx(()=>[e.createVNode(e.unref(Fe))]),_:1})])],10,_o))),128))],8,fo)}}}),de=(t,g)=>{const i=t.__vccOpts||t;for(const[o,a]of g)i[o]=a;return i},nt=de(yo,[["__scopeId","data-v-9fb203e3"]]),at=se(nt,"Checkbox"),wo=se(nt,"YyCheckbox"),ko=["type","disabled","aria-busy"],bo={key:0,class:"wui-button__spinner","aria-hidden":"true"},it=se(de(e.defineComponent({name:"Button",__name:"index",props:{type:{default:"primary"},size:{default:"medium"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},nativeType:{default:"button"}},emits:["click"],setup(t,{emit:g}){const i=g;function o(a){i("click",a)}return(a,l)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["wui-button",[`wui-button--${t.type}`,`wui-button--${t.size}`]]),type:t.nativeType,disabled:t.disabled||t.loading,"aria-busy":t.loading,onClick:o},[t.loading?(e.openBlock(),e.createElementBlock("span",bo)):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.loading?"处理中":"按钮"),1)],!0)],10,ko))}}),[["__scopeId","data-v-b1dd8b3e"]]),"Button"),Co={class:"wui-cat-image"},xo={class:"wui-cat-image__toolbar"},Bo=["src","alt"],Vo={key:0,class:"wui-cat-image__navigation"},Re=se(de(e.defineComponent({name:"CatImage",__name:"index",props:{modelValue:{type:Boolean},files:{default:()=>[]},fileImgList:{default:()=>[]},imgIndex:{default:0},modal:{type:Boolean},visible:{type:Boolean},previewUrl:{default:""},previewUrlResolver:{},title:{default:"图片预览"},showTrigger:{type:Boolean,default:!0}},emits:["update:modelValue","update:imgIndex","change","cancel"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(null),p=e.getCurrentInstance(),b=e.ref(!1),y=e.ref(X("modelValue")),$=e.ref(X("modal")),I=e.ref(X("visible")),h=e.ref(0),_=e.ref(!1),N=e.ref(1),T=e.ref(0),E=e.ref(0),R=e.ref(0),q=e.ref(!1);let A,z=0,x=0,r=0,n=0;const d=e.computed(()=>o.files.length?o.files:o.fileImgList),m=e.computed(()=>y.value?!!o.modelValue:b.value),k=e.computed(()=>$.value?!!o.modal:I.value?!!o.visible:!0),U=e.computed(()=>d.value[h.value]),O=e.computed(()=>{var M;return String(((M=U.value)==null?void 0:M.name)??"")}),f=e.computed(()=>_e(U.value,h.value)),P=e.computed(()=>({transform:`translate(${E.value}px, ${R.value}px) scale(${N.value}) rotate(${T.value}deg)`}));function X(M){const G=p==null?void 0:p.vnode.props;if(!G)return!1;const ne=M.replace(/[A-Z]/g,me=>`-${me.toLowerCase()}`);return Object.prototype.hasOwnProperty.call(G,M)||Object.prototype.hasOwnProperty.call(G,ne)}function v(){y.value=X("modelValue"),$.value=X("modal"),I.value=X("visible")}function le(M){y.value||(b.value=M),a("update:modelValue",M)}function re(M){return Math.min(Math.max(0,M),Math.max(0,d.value.length-1))}function _e(M,G){var me;return M?((me=o.previewUrlResolver)==null?void 0:me.call(o,M,G))||o.previewUrl||(typeof M.url=="string"?M.url:""):""}function ue(){N.value=1,T.value=0,E.value=0,R.value=0}function ye(M=o.imgIndex){d.value.length&&(h.value=re(M),ue(),a("update:imgIndex",h.value),le(!0))}function fe(){_.value=!1,q.value=!1,le(!1),a("cancel")}function V(M){M||fe()}function B(M){const G=re(M);if(G===h.value)return;h.value=G,ue(),a("update:imgIndex",G);const ne=U.value;ne&&a("change",ne,G)}function F(){N.value=Math.min(4,Number((N.value+.1).toFixed(2)))}function D(){N.value=Math.max(.1,Number((N.value-.1).toFixed(2)))}function J(){T.value-=90}function Y(){T.value+=90}function j(M){M.deltaY<0?F():D()}function we(M){var G;!f.value||M.button!==0||(A=M.pointerId,z=M.clientX,x=M.clientY,r=E.value,n=R.value,q.value=!0,(G=l.value)==null||G.setPointerCapture(M.pointerId))}function be(M){!q.value||M.pointerId!==A||(E.value=r+M.clientX-z,R.value=n+M.clientY-x)}function ke(M){var G;M.pointerId===A&&((G=l.value)!=null&&G.hasPointerCapture(M.pointerId)&&l.value.releasePointerCapture(M.pointerId),q.value=!1,A=void 0)}return e.onBeforeUpdate(()=>{v()}),e.watch(m,M=>{M&&(h.value=re(o.imgIndex),_.value=!1,ue())},{immediate:!0}),e.watch(()=>o.imgIndex,M=>{m.value&&B(M)}),e.watch(d,()=>{const M=re(h.value);M!==h.value&&(h.value=M,a("update:imgIndex",M)),m.value&&ue()},{deep:!0}),g({open:ye,close:fe,reset:ue,changeImage:B}),(M,G)=>{const ne=e.resolveComponent("el-button"),me=e.resolveComponent("el-empty"),Se=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",Co,[M.$slots.default?e.renderSlot(M.$slots,"default",{key:0,open:ye,files:d.value,activeFile:U.value,visible:m.value},void 0,!0):t.showTrigger?(e.openBlock(),e.createBlock(ne,{key:1,link:"",type:"primary",disabled:!d.value.length,onClick:G[0]||(G[0]=u=>ye())},{default:e.withCtx(()=>[...G[4]||(G[4]=[e.createTextVNode(" 预览图片 ",-1)])]),_:1},8,["disabled"])):e.createCommentVNode("",!0),e.createVNode(Se,{"model-value":m.value,fullscreen:_.value,modal:k.value,title:O.value||t.title,width:"min(1080px, 92vw)","append-to-body":"",class:"wui-cat-image__dialog","onUpdate:modelValue":V},{default:e.withCtx(()=>[e.createElementVNode("div",xo,[e.createVNode(ne,{circle:"",text:"","aria-label":"缩小",onClick:D},{default:e.withCtx(()=>[e.createVNode(e.unref(po),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"放大",onClick:F},{default:e.withCtx(()=>[e.createVNode(e.unref(mo),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"向左旋转",onClick:J},{default:e.withCtx(()=>[e.createVNode(e.unref(Yt),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"向右旋转",onClick:Y},{default:e.withCtx(()=>[e.createVNode(e.unref(tt),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":"恢复原始大小",onClick:ue},{default:e.withCtx(()=>[e.createVNode(e.unref(eo),{class:"wui-cat-image__tool-icon"})]),_:1}),e.createVNode(ne,{circle:"",text:"","aria-label":_.value?"退出全屏":"全屏",onClick:G[1]||(G[1]=u=>_.value=!_.value)},{default:e.withCtx(()=>[e.createVNode(e.unref(qt),{class:"wui-cat-image__tool-icon"})]),_:1},8,["aria-label"])]),e.createElementVNode("div",{ref_key:"viewportRef",ref:l,class:e.normalizeClass(["wui-cat-image__viewport",{"is-dragging":q.value}]),onPointerdown:we,onPointermove:be,onPointerup:ke,onPointercancel:ke,onWheel:e.withModifiers(j,["prevent"])},[f.value?(e.openBlock(),e.createElementBlock("img",{key:0,class:"wui-cat-image__image",src:f.value,alt:O.value,style:e.normalizeStyle(P.value),draggable:"false"},null,12,Bo)):(e.openBlock(),e.createBlock(me,{key:1,description:"暂无可预览的图片"}))],34),d.value.length>1?(e.openBlock(),e.createElementBlock("div",Vo,[e.createVNode(ne,{disabled:h.value<=0,onClick:G[2]||(G[2]=u=>B(h.value-1))},{default:e.withCtx(()=>[e.createVNode(e.unref(Dt),{class:"wui-cat-image__button-icon"}),G[5]||(G[5]=e.createTextVNode("上一张 ",-1))]),_:1},8,["disabled"]),e.createElementVNode("span",null,e.toDisplayString(h.value+1)+" / "+e.toDisplayString(d.value.length),1),e.createVNode(ne,{disabled:h.value>=d.value.length-1,onClick:G[3]||(G[3]=u=>B(h.value+1))},{default:e.withCtx(()=>[G[6]||(G[6]=e.createTextVNode(" 下一张",-1)),e.createVNode(e.unref(Pt),{class:"wui-cat-image__button-icon"})]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),_:1},8,["model-value","fullscreen","modal","title"])])}}}),[["__scopeId","data-v-98a1fd7f"]]),"CatImage"),Eo=["disabled","title"],No={key:0,class:"wui-copy-text__icon","aria-hidden":"true"},So={key:1,class:"wui-copy-text__label"},rt=se(de(e.defineComponent({name:"CopyText",__name:"index",props:{text:{default:""},label:{default:"复制"},successText:{default:"已复制"},title:{default:""},trigger:{default:"button"},disabled:{type:Boolean,default:!1},resetDelay:{default:1600}},emits:["success","error"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(!1);let p;const b=e.computed(()=>String(o.text??""));async function y(_){var N;if(!((N=navigator.clipboard)!=null&&N.writeText))throw new Error("Clipboard API is unavailable");return await navigator.clipboard.writeText(_),"clipboard"}function $(_){const N=document.createElement("textarea");N.value=_,N.setAttribute("readonly","readonly"),N.style.position="fixed",N.style.left="-9999px",N.style.top="0",document.body.appendChild(N),N.select();const T=document.execCommand("copy");if(document.body.removeChild(N),!T)throw new Error("Fallback copy failed");return"fallback"}function I(){l.value=!0,window.clearTimeout(p),p=window.setTimeout(()=>{l.value=!1},Math.max(0,o.resetDelay))}async function h(){if(o.disabled)return;const _=b.value;try{let N;try{N=await y(_)}catch{N=$(_)}I(),a("success",{text:_,source:N})}catch(N){a("error",N)}}return e.onBeforeUnmount(()=>{window.clearTimeout(p)}),g({copy:h}),(_,N)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["wui-copy-text",[`wui-copy-text--${t.trigger}`,{"is-copied":l.value,"is-disabled":t.disabled}]]),type:"button",disabled:t.disabled,title:t.title||b.value,onClick:h},[e.renderSlot(_.$slots,"default",{copied:l.value,copy:h,text:b.value},()=>[t.trigger==="icon"?(e.openBlock(),e.createElementBlock("span",No,e.toDisplayString(l.value?"✓":"⧉"),1)):(e.openBlock(),e.createElementBlock("span",So,e.toDisplayString(l.value?t.successText:t.label),1))],!0)],10,Eo))}}),[["__scopeId","data-v-2791f53b"]]),"CopyText"),To={class:"custom-table"},$o={key:0,class:"custom-table__toolbar"},Ao={class:"custom-table__toolbar-start"},Lo={class:"custom-table__toolbar-end"},Mo={key:1,class:"custom-table__error",role:"alert"},Do={class:"custom-table__surface"},st=se(de(e.defineComponent({name:"CustomTable",inheritAttrs:!1,__name:"index",props:{columns:{},rows:{},loader:{type:Function},filters:{},page:{},pageSize:{},pagination:{type:Boolean},pageSizes:{},visibleColumnKeys:{},showRefresh:{type:Boolean},showColumnSettings:{type:Boolean},columnPersistenceKey:{},storageAdapter:{},autoLoad:{type:Boolean},exporter:{type:Function},rowKey:{type:[String,Function]},emptyText:{}},emits:["update:filters","update:page","update:pageSize","update:visibleColumnKeys","sort-change","reload","load-success","load-error","export-error","persistence-error"],setup(t,{expose:g,emit:i}){const o=[10,20,50,100],a=t,l=i,p=e.getCurrentInstance(),b=e.ref(ne("pagination")),y=e.ref(ne("showRefresh")),$=e.ref(ne("showColumnSettings")),I=e.ref(ne("autoLoad")),h=e.useSlots(),_=e.ref(null),N=e.shallowRef([]),T=e.ref(0),E=e.ref(!1),R=e.ref(!1),q=e.ref(null),A=e.ref(a.filters??{}),z=e.ref(me(a.page,1)),x=e.ref(me(a.pageSize,o[0])),r=e.ref([]),n=e.ref({key:null,order:null});let d,m=0,k=!1,U=!1,O=new Set,f=!1,P=Promise.resolve();const X=e.computed(()=>{const c=new Set;return a.columns.map((w,K)=>{const H=w.key||w.prop||`column-${K}`,ae=c.has(H)?`${H}-${K}`:H;return c.add(ae),{...w,key:ae,sourceIndex:K}})}),v=e.computed(()=>a.filters??A.value),le=e.computed(()=>a.page===void 0?z.value:me(a.page,1)),re=e.computed(()=>a.pageSize===void 0?x.value:me(a.pageSize,o[0])),_e=e.computed(()=>b.value?a.pagination:!0),ue=e.computed(()=>{const c=(a.pageSizes??o).filter(w=>w>0);return c.length?c:[...o]}),ye=e.computed(()=>a.emptyText??"暂无数据"),fe=e.computed(()=>!!a.loader),V=e.computed(()=>y.value?a.showRefresh:!0),B=e.computed(()=>$.value?a.showColumnSettings:!0);e.watch(X,c=>{const w=new Set(c.map(ie=>ie.key)),K=c.filter(ie=>ie.visible!==!1).map(ie=>ie.key);if(!U){r.value=K,U=!0,O=w;return}const H=r.value.filter(ie=>w.has(ie)),ae=new Set(H);c.forEach(ie=>{!O.has(ie.key)&&ie.visible!==!1&&!ae.has(ie.key)&&H.push(ie.key)}),r.value=H,O=w},{immediate:!0});const F=e.computed(()=>{const c=a.visibleColumnKeys??r.value;return u(c)}),D=e.computed(()=>{const c=new Set(F.value);return X.value.filter(w=>c.has(w.key))}),J=e.computed(()=>X.value.filter(c=>Se(c))),Y=e.computed({get:()=>{const c=new Set(F.value);return J.value.filter(w=>c.has(w.key)).map(w=>w.key)},set:c=>{const w=X.value.filter(K=>!Se(K)).filter(K=>F.value.includes(K.key)).map(K=>K.key);ge([...w,...c])}}),j=e.computed(()=>a.rows??[]),we=e.computed(()=>{const c=j.value.map((ae,ie)=>({row:ae,index:ie})),w=n.value;if(!w.key||!w.order)return c.map(({row:ae})=>ae);const K=X.value.find(ae=>ae.key===w.key);if(!K)return c.map(({row:ae})=>ae);const H=w.order==="ascending"?1:-1;return c.sort((ae,ie)=>(K.sortMethod?K.sortMethod(ae.row,ie.row):s(xe(ae.row,K,ae.index),xe(ie.row,K,ie.index)))*H).map(({row:ae})=>ae)}),be=e.computed(()=>{if(fe.value)return N.value;if(!_e.value)return we.value;const c=(le.value-1)*re.value;return we.value.slice(c,c+re.value)}),ke=e.computed(()=>fe.value?T.value:j.value.length),M=e.computed(()=>!!(h.toolbar||h["toolbar-left"]||h["toolbar-right"]||V.value||a.exporter||B.value&&J.value.length)),G=e.computed(()=>({filters:v.value,page:le.value,pageSize:re.value,visibleColumnKeys:F.value,loading:E.value,exporting:R.value,reload:L,setFilters:oe,setVisibleColumnKeys:ge,exportRows:pe}));e.watch(()=>a.filters,c=>{c!==void 0&&(A.value=c)},{deep:!0}),e.watch(()=>a.page,c=>{c!==void 0&&(z.value=me(c,1))}),e.watch(()=>a.pageSize,c=>{c!==void 0&&(x.value=me(c,o[0]))}),e.watch(v,()=>{if(!(!k||!fe.value)){if(le.value!==1){S(1);return}L()}},{deep:!0}),e.watch(le,()=>{k&&fe.value&&L()}),e.watch(re,()=>{if(!(!k||!fe.value)){if(le.value!==1){S(1);return}L()}}),e.watch(()=>a.loader,(c,w)=>{if(!c){d==null||d.abort();return}k&&c!==w&&L()}),e.watch(F,c=>{Te(c)},{deep:!0}),e.onMounted(async()=>{k=!0,await he(),fe.value&&(!I.value||a.autoLoad)&&await L()}),e.onBeforeUpdate(()=>{b.value=ne("pagination"),y.value=ne("showRefresh"),$.value=ne("showColumnSettings"),I.value=ne("autoLoad")});function ne(c){const w=p==null?void 0:p.vnode.props;if(!w)return!1;const K=c.replace(/[A-Z]/g,H=>`-${H.toLowerCase()}`);return Object.prototype.hasOwnProperty.call(w,c)||Object.prototype.hasOwnProperty.call(w,K)}e.onBeforeUnmount(()=>{m+=1,d==null||d.abort()});function me(c,w){return!Number.isFinite(c)||!c||c<1?w:Math.floor(c)}function Se(c){return c.hideable!==void 0?c.hideable:c.type===void 0||c.type==="default"}function u(c){const w=new Set(X.value.map(H=>H.key)),K=[];return c.forEach(H=>{w.has(H)&&!K.includes(H)&&K.push(H)}),K}function S(c){const w=me(c,1);a.page===void 0&&(z.value=w),l("update:page",w)}function Z(c){const w=me(c,o[0]);a.pageSize===void 0&&(x.value=w),l("update:pageSize",w),S(1)}function oe(c){a.filters===void 0&&(A.value=c),l("update:filters",c),le.value!==1&&S(1)}function ge(c){const w=u(c);a.visibleColumnKeys===void 0&&(r.value=w),l("update:visibleColumnKeys",w)}function Ce(c){return c.cellSlot??c.slot??`cell:${c.key}`}function Me(c){return c.headerSlot??c.header??`header:${c.key}`}function xe(c,w,K){return w.value?w.value(c,K):w.prop?Ve(c,w.prop):void 0}function Ve(c,w){return w.split(".").reduce((K,H)=>{if(K!==null&&typeof K=="object"&&H in K)return K[H]},c)}function ce(c,w,K){var ie;const H=xe(c,w,K),ae=(ie=w.formatter)==null?void 0:ie.call(w,{row:c,column:w,index:K,value:H});return Ie(ae??H)}function Ie(c){return c==null||c===""?"-":c instanceof Date?c.toLocaleString():typeof c=="object"?JSON.stringify(c):String(c)}function s(c,w){return c===w?0:c==null?-1:w==null?1:typeof c=="number"&&typeof w=="number"?c-w:String(c).localeCompare(String(w),void 0,{numeric:!0,sensitivity:"base"})}function C(c){const w=X.value.find(K=>K.prop===c.prop||K.key===c.prop);n.value={key:(w==null?void 0:w.key)??null,order:c.order},l("sort-change",{...n.value}),fe.value&&L()}async function L(){l("reload");const c=a.loader;if(!c)return;d==null||d.abort();const w=new AbortController,K=++m;d=w,E.value=!0,q.value=null;try{const H=await c({filters:v.value,page:le.value,pageSize:re.value,sort:{...n.value},signal:w.signal});if(w.signal.aborted||K!==m)return;const ae=Number.isFinite(H.total)?Math.max(0,H.total):H.rows.length,ie={rows:[...H.rows],total:ae};N.value=[...ie.rows],T.value=ie.total,l("load-success",ie)}catch(H){if(w.signal.aborted||K!==m||De(H))return;q.value=Ge(H),l("load-error",H)}finally{K===m&&(E.value=!1,d=void 0)}}function Q(){var c;(c=_.value)==null||c.clearSelection()}function ee(){return _.value}async function pe(){const c=a.exporter;if(!(!c||R.value)){R.value=!0;try{const w={rows:[...be.value],columns:[...D.value],filters:v.value,page:le.value,pageSize:re.value,total:ke.value,sort:{...n.value}};await c(w)}catch(w){l("export-error",w)}finally{R.value=!1}}}async function he(){const c=a.storageAdapter,w=a.columnPersistenceKey;if(!c||!w||a.visibleColumnKeys!==void 0){f=!0;return}try{const K=await c.getItem(w);if(K){const H=JSON.parse(K);Array.isArray(H)&&H.every(ae=>typeof ae=="string")&&(r.value=u(H),l("update:visibleColumnKeys",r.value))}}catch(K){l("persistence-error",K)}finally{f=!0}}function Te(c){const w=a.storageAdapter,K=a.columnPersistenceKey;if(!f||!w||!K)return;const H=JSON.stringify(c);P=P.then(()=>w.setItem(K,H)).catch(ae=>{l("persistence-error",ae)})}function De(c){return c instanceof Error&&c.name==="AbortError"}function Ge(c){return c instanceof Error&&c.message?c.message:typeof c=="string"&&c?c:"加载失败,请稍后重试。"}return g({reload:L,clearSelection:Q,setFilters:oe,setVisibleColumnKeys:ge,getTableInstance:ee}),(c,w)=>{const K=e.resolveComponent("el-button"),H=e.resolveComponent("el-tooltip"),ae=e.resolveComponent("el-checkbox"),ie=e.resolveComponent("el-checkbox-group"),$t=e.resolveComponent("el-popover"),Yn=e.resolveComponent("el-table-column"),Zn=e.resolveComponent("el-empty"),vn=e.resolveComponent("el-table"),ea=e.resolveComponent("el-pagination"),ta=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("section",To,[M.value?(e.openBlock(),e.createElementBlock("div",$o,[e.renderSlot(c.$slots,"toolbar",e.normalizeProps(e.guardReactiveProps(G.value)),()=>[e.createElementVNode("div",Ao,[e.renderSlot(c.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(G.value)),void 0,!0)]),e.createElementVNode("div",Lo,[e.renderSlot(c.$slots,"toolbar-right",e.normalizeProps(e.guardReactiveProps(G.value)),void 0,!0),V.value?(e.openBlock(),e.createBlock(H,{key:0,content:"刷新",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"刷新",circle:"",disabled:E.value,onClick:L},{default:e.withCtx(()=>[e.createVNode(e.unref(tt),{class:"custom-table__tool-icon"})]),_:1},8,["disabled"])]),_:1})):e.createCommentVNode("",!0),a.exporter?(e.openBlock(),e.createBlock(H,{key:1,content:"导出",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"导出",circle:"",loading:R.value,onClick:pe},{default:e.withCtx(()=>[e.createVNode(e.unref(jt),{class:"custom-table__tool-icon"})]),_:1},8,["loading"])]),_:1})):e.createCommentVNode("",!0),B.value&&J.value.length?(e.openBlock(),e.createBlock($t,{key:2,placement:"bottom-end",trigger:"click",width:"220"},{reference:e.withCtx(()=>[e.createVNode(H,{content:"列设置",placement:"top"},{default:e.withCtx(()=>[e.createVNode(K,{"aria-label":"列设置",circle:""},{default:e.withCtx(()=>[e.createVNode(e.unref(ao),{class:"custom-table__tool-icon"})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(ie,{modelValue:Y.value,"onUpdate:modelValue":w[0]||(w[0]=te=>Y.value=te),class:"custom-table__column-settings"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.value,te=>(e.openBlock(),e.createBlock(ae,{key:te.key,label:te.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(te.label||te.prop||te.key),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1})):e.createCommentVNode("",!0)])],!0)])):e.createCommentVNode("",!0),q.value?(e.openBlock(),e.createElementBlock("div",Mo,[e.createElementVNode("span",null,e.toDisplayString(q.value),1),e.createVNode(K,{link:"",type:"primary",onClick:L},{default:e.withCtx(()=>[...w[1]||(w[1]=[e.createTextVNode("重试",-1)])]),_:1})])):e.createCommentVNode("",!0),e.createElementVNode("div",Do,[e.withDirectives((e.openBlock(),e.createBlock(vn,e.mergeProps({ref_key:"tableRef",ref:_,data:be.value,"row-key":a.rowKey,onSortChange:C},c.$attrs),{empty:e.withCtx(()=>[e.createVNode(Zn,{description:ye.value,"image-size":80},null,8,["description"])]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,te=>(e.openBlock(),e.createBlock(Yn,{key:te.key,align:te.align,"class-name":te.className,"column-key":te.key,fixed:te.fixed,"header-align":te.headerAlign,label:te.label,"label-class-name":te.labelClassName,"min-width":te.minWidth,prop:te.prop,"show-overflow-tooltip":te.showOverflowTooltip,sortable:te.sortable?"custom":!1,type:te.type,width:te.width,index:te.index},{header:e.withCtx(()=>[e.renderSlot(c.$slots,Me(te),{column:te,index:te.sourceIndex},()=>[e.createTextVNode(e.toDisplayString(te.label),1)],!0)]),default:e.withCtx($e=>[e.renderSlot(c.$slots,Ce(te),{column:te,index:$e.$index,row:$e.row,value:xe($e.row,te,$e.$index)},()=>[e.createTextVNode(e.toDisplayString(ce($e.row,te,$e.$index)),1)],!0)]),_:2},1032,["align","class-name","column-key","fixed","header-align","label","label-class-name","min-width","prop","show-overflow-tooltip","sortable","type","width","index"]))),128))]),_:3},16,["data","row-key"])),[[ta,E.value]])]),_e.value?(e.openBlock(),e.createBlock(ea,{key:2,class:"custom-table__pagination",background:"","current-page":le.value,layout:"total, sizes, prev, pager, next, jumper","page-size":re.value,"page-sizes":ue.value,total:ke.value,onCurrentChange:S,onSizeChange:Z},null,8,["current-page","page-size","page-sizes","total"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-324d7221"]]),"CustomTable"),zo={id:"id",label:"label",children:"children",type:"type",disabled:"disabled"};function ze(t){return`${typeof t}:${String(t)}`}function ct(t){return typeof t=="string"||typeof t=="number"}function Po(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ae(t,g,i){const o=g??zo[i];return typeof o=="function"?o(t):t[o]}function Ko(t,g){const i=Ae(t,g.children,"children");return Array.isArray(i)?i.filter(Po):[]}function dt(t,g){const i={nodes:[],nodeByToken:new Map,rootKeys:[],maxDepth:0},o=new WeakSet,a=(l,p,b)=>{if(o.has(l))return;const y=Ae(l,g.id,"id");if(!ct(y)||i.nodeByToken.has(ze(y)))return;const $=Ae(l,g.label,"label"),I=Ae(l,g.type,"type"),h=Ae(l,g.disabled,"disabled"),_={key:y,label:$==null?String(y):String($),type:typeof I=="string"?I:void 0,disabled:h===!0,source:l,parentKey:p,childKeys:[],depth:b};return i.nodes.push(_),i.nodeByToken.set(ze(_.key),_),i.maxDepth=Math.max(i.maxDepth,b),o.add(l),Ko(l,g).forEach(N=>{const T=a(N,_.key,b+1);T&&_.childKeys.push(T.key)}),o.delete(l),_};return t.forEach(l=>{const p=a(l,void 0,0);p&&i.rootKeys.push(p.key)}),i}const Io={key:1,class:"wui-custom-tree__nodes",role:"tree"},Fo=["title","onClick"],Uo={class:"wui-custom-tree__node-label"},Ro={key:2,class:"wui-custom-tree__empty"},Oo={key:0,class:"wui-custom-tree__selected"},jo={key:0,class:"wui-custom-tree__selected-list"},Ho=["aria-label","onClick"],Qo={key:1,class:"wui-custom-tree__empty"},mt=se(de(e.defineComponent({name:"CustomTree",__name:"index",props:{data:{default:()=>[]},modelValue:{default:()=>[]},fields:{default:()=>({})},maxColumns:{default:0},selectionStrategy:{default:"parent"},isSelectable:{},disabled:{type:Boolean,default:!1},searchable:{type:Boolean,default:!1},searchColumns:{},showSelected:{type:Boolean,default:!0},maxHeight:{},emptyText:{default:"暂无数据"}},emits:["update:modelValue","change"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(new Set),p=e.ref([]),b=e.ref([]),y=e.computed(()=>dt(o.data,o.fields)),$=e.computed(()=>{const V=y.value.maxDepth+1;return o.maxColumns>0?Math.min(V,o.maxColumns):V}),I=e.computed(()=>Array.from({length:Math.max($.value,1)},(V,B)=>B)),h=e.computed(()=>({"--wui-custom-tree-max-height":N(o.maxHeight,"420px")})),_=e.computed(()=>le(l.value));function N(V,B){return typeof V=="number"?`${V}px`:V||B}function T(V){return ze(V)}function E(V){return y.value.nodeByToken.get(T(V))}function R(V){const B=y.value.nodes.find(F=>F.source===V);return(B==null?void 0:B.key)??""}function q(V){const B=y.value.nodes.find(F=>F.source===V);return(B==null?void 0:B.label)??""}function A(V){var J,Y;const B=V===0?void 0:p.value[V-1],F=B===void 0?y.value.rootKeys:((J=E(B))==null?void 0:J.childKeys)??[],D=(Y=b.value[V])==null?void 0:Y.trim().toLocaleLowerCase();return F.map(E).filter(j=>j!==void 0).filter(j=>!D||j.label.toLocaleLowerCase().includes(D))}function z(V){return o.searchable?o.searchColumns===void 0?!0:(Array.isArray(o.searchColumns)?o.searchColumns:[o.searchColumns]).includes(V):!1}function x(V,B){return p.value[V]===B}function r(V,B){const F=p.value.slice(0,V);F[V]=B.key,p.value=F,b.value=b.value.slice(0,V+1)}function n(V){var B;return!V.disabled&&(((B=o.isSelectable)==null?void 0:B.call(o,V.source))??!0)}function d(V){const B=[],F=D=>{n(D)&&B.push(T(D.key)),D.childKeys.forEach(J=>{const Y=E(J);Y&&F(Y)})};return F(V),B}function m(V){return l.value.has(T(V))}function k(V){const B=E(V);if(!B)return!1;const F=d(B),D=F.filter(J=>l.value.has(J)).length;return D>0&&D<F.length}function U(V){if(o.disabled||!n(V))return;const B=new Set(l.value),F=d(V),D=!m(V.key);F.forEach(J=>{D?B.add(J):B.delete(J)}),re(B)}function O(V){const B=y.value.nodes.find(F=>F.source===V);B&&U(B)}function f(V){return y.value.nodes.filter(B=>V.has(T(B.key))&&n(B)).map(B=>B.key)}function P(V){return y.value.nodes.filter(B=>!V.has(T(B.key))||!n(B)?!1:!B.childKeys.some(F=>{const D=E(F);return D?d(D).length>0:!1})).map(B=>B.key)}function X(V){if(o.selectionStrategy==="all")return f(V);if(o.selectionStrategy==="leaf")return P(V);const B=[],F=D=>{const J=d(D);if(J.length){if(n(D)&&J.every(Y=>V.has(Y))){B.push(T(D.key));return}if(n(D)&&V.has(T(D.key))&&D.childKeys.length===0){B.push(T(D.key));return}D.childKeys.forEach(Y=>{const j=E(Y);j&&F(j)})}};return y.value.rootKeys.forEach(D=>{const J=E(D);J&&F(J)}),B.map(D=>{var J;return(J=y.value.nodeByToken.get(D))==null?void 0:J.key}).filter(D=>D!==void 0)}function v(V){return V.map(E).filter(B=>B!==void 0).map(B=>B.source)}function le(V){const B=f(V),F=X(V),D=P(V);return{checkedKeys:B,selectedKeys:F,selectedNodes:v(F),leafNodes:v(D)}}function re(V){l.value=V;const B=le(V);a("update:modelValue",B.selectedKeys),a("change",B)}function _e(){const V=new Set;o.modelValue.forEach(B=>{const F=E(B);F&&d(F).forEach(D=>V.add(D))}),l.value=V,ue()}function ue(){const V=X(l.value)[0],B=[];let F=V===void 0?void 0:E(V);for(;(F==null?void 0:F.parentKey)!==void 0;){const D=E(F.parentKey);if(!D)break;B.unshift(D.key),F=D}p.value=B}function ye(){o.disabled||l.value.size===0||re(new Set)}return g({clear:ye,getSelection:()=>le(l.value)}),e.watch([y,()=>o.modelValue],()=>{_e()},{deep:!0,immediate:!0}),(V,B)=>{const F=e.resolveComponent("el-input"),D=e.resolveComponent("el-icon"),J=e.resolveComponent("el-checkbox");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wui-custom-tree",{"is-disabled":t.disabled}])},[e.createElementVNode("div",{class:"wui-custom-tree__columns",style:e.normalizeStyle(h.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,Y=>(e.openBlock(),e.createElementBlock("section",{key:Y,class:"wui-custom-tree__column"},[z(Y)?(e.openBlock(),e.createBlock(F,{key:0,modelValue:b.value[Y],"onUpdate:modelValue":j=>b.value[Y]=j,clearable:"","prefix-icon":e.unref(ot),placeholder:"搜索",class:"wui-custom-tree__search"},null,8,["modelValue","onUpdate:modelValue","prefix-icon"])):e.createCommentVNode("",!0),A(Y).length?(e.openBlock(),e.createElementBlock("div",Io,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A(Y),j=>(e.openBlock(),e.createElementBlock("div",{key:T(j.key),class:e.normalizeClass(["wui-custom-tree__node",{"is-active":x(Y,j.key),"is-selected":m(j.key),"is-not-selectable":!n(j)}])},[e.createElementVNode("button",{type:"button",class:"wui-custom-tree__node-main",title:j.label,onClick:we=>r(Y,j)},[e.createVNode(D,{class:"wui-custom-tree__node-icon"},{default:e.withCtx(()=>[j.childKeys.length&&x(Y,j.key)?(e.openBlock(),e.createBlock(e.unref(Wt),{key:0})):j.childKeys.length?(e.openBlock(),e.createBlock(e.unref(Ue),{key:1})):e.createCommentVNode("",!0)]),_:2},1024),e.createElementVNode("span",Uo,e.toDisplayString(j.label),1)],8,Fo),n(j)?(e.openBlock(),e.createBlock(J,{key:0,"model-value":m(j.key),indeterminate:k(j.key),disabled:t.disabled||!n(j),"aria-label":`选择 ${j.label}`,onClick:B[0]||(B[0]=e.withModifiers(()=>{},["stop"])),onChange:we=>U(j)},null,8,["model-value","indeterminate","disabled","aria-label","onChange"])):e.createCommentVNode("",!0)],2))),128))])):(e.openBlock(),e.createElementBlock("p",Ro,e.toDisplayString(Y===0?t.emptyText:"请先选择上级节点"),1))]))),128))],4),t.showSelected?(e.openBlock(),e.createElementBlock("aside",Oo,[B[1]||(B[1]=e.createElementVNode("div",{class:"wui-custom-tree__selected-title"},"当前选择",-1)),_.value.selectedNodes.length?(e.openBlock(),e.createElementBlock("div",jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value.selectedNodes,Y=>(e.openBlock(),e.createElementBlock("div",{key:T(R(Y)),class:"wui-custom-tree__selected-item"},[e.createElementVNode("span",null,e.toDisplayString(q(Y)),1),t.disabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wui-custom-tree__remove","aria-label":`移除 ${q(Y)}`,onClick:j=>O(Y)},[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(e.unref(Ee))]),_:1})],8,Ho))]))),128))])):(e.openBlock(),e.createElementBlock("p",Qo,"尚未选择节点"))])):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-ef3417d1"]]),"CustomTree"),qo=["disabled"],Oe="1990-01-01",je="2099-12-31",ut=de(e.defineComponent({name:"DaterangePicker",__name:"index",props:{modelValue:{default:null},disabled:{type:Boolean,default:!1},type:{default:"end"}},emits:["update:modelValue","change"],setup(t,{emit:g}){const i=t,o=g,a=e.ref(null),l=e.ref(!1),p=e.ref(null),b=e.computed(()=>l.value),y=[{text:"长期",value:()=>(l.value=!0,[new Date(Oe),new Date(je)])}];function $(E){return Array.isArray(E)&&E[0]===Oe&&E[1]===je}function I(E){if($(E)){l.value=!0,a.value=E;return}l.value=!1,a.value=E}function h(E){o("update:modelValue",E),o("change",E)}function _(E){if(l.value){const R=[Oe,je];a.value=R,h(R);return}l.value=!1,h(E)}function N(){var E;i.disabled||(l.value=!1,(E=p.value)==null||E.focus())}function T(){i.disabled||(l.value=!1,a.value=null,h(null))}return e.watch(()=>i.modelValue,E=>I(E),{immediate:!0}),(E,R)=>{const q=e.resolveComponent("el-date-picker"),A=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wui-daterange",{"is-disabled":t.disabled}])},[e.createVNode(q,{ref_key:"datePickerRef",ref:p,modelValue:a.value,"onUpdate:modelValue":R[0]||(R[0]=z=>a.value=z),class:"wui-daterange__picker",type:"daterange","value-format":"YYYY-MM-DD","start-placeholder":"开始时间","end-placeholder":"结束时间","range-separator":"至",shortcuts:y,disabled:t.disabled,onChange:_},null,8,["modelValue","disabled"]),b.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"wui-daterange__long-term",type:"button",disabled:t.disabled,onClick:N},[R[1]||(R[1]=e.createElementVNode("span",null,"长期",-1)),e.createVNode(A,{class:"wui-daterange__clear",onClick:e.withModifiers(T,["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(Ft))]),_:1})],8,qo)):e.createCommentVNode("",!0)],2)}}}),[["__scopeId","data-v-1211364c"]]),pt=se(ut,"DaterangePicker"),Go=se(ut,"DateRangePicker"),Wo={key:0,class:"wui-dialog__navigation"},Xo=["disabled","onClick"],Jo={class:"wui-dialog__content"},Yo={key:2,class:"wui-dialog__sections"},Zo=["disabled","aria-expanded","onClick"],vo={class:"wui-dialog__section-icon"},el={class:"wui-dialog__section-body"},tl={class:"wui-dialog__footer"},ol={key:0,class:"wui-dialog__step-actions"},ft=se(de(e.defineComponent({name:"Dialog",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},width:{default:"900px"},mode:{default:"default"},items:{default:()=>[]},activeKey:{},expandedKeys:{default:()=>[]},showClose:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},showStepActions:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!0}},emits:["update:modelValue","update:activeKey","update:expandedKeys","change","close"],setup(t,{emit:g}){const i=t,o=g,a=e.useSlots(),l=e.computed(()=>i.items.filter(m=>!m.hidden)),p=e.computed(()=>l.value.filter(m=>!m.disabled)),b=e.computed(()=>{const m=l.value.find(k=>k.key===i.activeKey);return m&&!m.disabled?m:p.value[0]}),y=e.computed(()=>{var m;return(m=b.value)==null?void 0:m.key}),$=e.computed(()=>i.mode==="steps"&&i.showNavigation&&l.value.length>0),I=e.computed(()=>i.mode==="steps"&&i.showStepActions&&p.value.length>1),h=e.computed(()=>p.value.findIndex(m=>m.key===y.value)),_=e.computed(()=>h.value>0?p.value[h.value-1]:void 0),N=e.computed(()=>h.value>=0&&h.value<p.value.length-1?p.value[h.value+1]:void 0),T=e.computed(()=>i.mode==="steps"&&p.value.length>0&&!N.value),E=e.computed(()=>!!a.footer&&(i.mode!=="steps"||T.value)),R=e.computed(()=>I.value||E.value);function q(m){o("update:modelValue",m)}function A(){o("close")}function z(){o("update:modelValue",!1)}function x(m){m.disabled||(o("update:activeKey",m.key),o("change",m))}function r(m){const k=m===1?N.value:_.value;k&&x(k)}function n(m){return i.expandedKeys.includes(m)}function d(m){if(m.disabled)return;const k=n(m.key)?i.expandedKeys.filter(U=>U!==m.key):[...i.expandedKeys,m.key];o("update:expandedKeys",k)}return(m,k)=>{const U=e.resolveComponent("el-button"),O=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(O,e.mergeProps(m.$attrs,{"model-value":t.modelValue,title:t.title,width:t.width,"show-close":t.showClose,"destroy-on-close":t.destroyOnClose,class:"wui-dialog","onUpdate:modelValue":q,onClose:A}),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["wui-dialog__layout",{"wui-dialog__layout--with-nav":$.value}])},[$.value?(e.openBlock(),e.createElementBlock("aside",Wo,[e.renderSlot(m.$slots,"navigation",{items:l.value,activeKey:y.value,select:x},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createElementBlock("button",{key:f.key,type:"button",class:e.normalizeClass(["wui-dialog__nav-item",{"is-active":f.key===y.value,"is-disabled":f.disabled}]),disabled:f.disabled,onClick:P=>x(f)},e.toDisplayString(f.label),11,Xo))),128))],!0)])):e.createCommentVNode("",!0),e.createElementVNode("main",Jo,[t.mode==="default"?e.renderSlot(m.$slots,"default",{key:0},void 0,!0):t.mode==="steps"?e.renderSlot(m.$slots,"panel",{key:1,item:b.value,activeKey:y.value},void 0,!0):(e.openBlock(),e.createElementBlock("div",Yo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createElementBlock("section",{key:f.key,class:"wui-dialog__section"},[e.createElementVNode("button",{type:"button",class:"wui-dialog__section-header",disabled:f.disabled,"aria-expanded":n(f.key),onClick:P=>d(f)},[e.createElementVNode("span",null,e.toDisplayString(f.label),1),e.createElementVNode("span",vo,e.toDisplayString(n(f.key)?"收起":"展开"),1)],8,Zo),e.withDirectives(e.createElementVNode("div",el,[e.renderSlot(m.$slots,"section",{item:f,expanded:n(f.key)},void 0,!0)],512),[[e.vShow,n(f.key)]])]))),128))]))])],2)]),_:2},[R.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",tl,[I.value?(e.openBlock(),e.createElementBlock("div",ol,[_.value?(e.openBlock(),e.createBlock(U,{key:0,onClick:k[0]||(k[0]=f=>r(-1))},{default:e.withCtx(()=>[...k[2]||(k[2]=[e.createTextVNode("上一步",-1)])]),_:1})):e.createCommentVNode("",!0),N.value?(e.openBlock(),e.createBlock(U,{key:1,type:"primary",onClick:k[1]||(k[1]=f=>r(1))},{default:e.withCtx(()=>[...k[3]||(k[3]=[e.createTextVNode("下一步",-1)])]),_:1})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),E.value?e.renderSlot(m.$slots,"footer",{key:1,item:b.value,activeKey:y.value,close:z},void 0,!0):e.createCommentVNode("",!0)])]),key:"0"}:void 0]),1040,["model-value","title","width","show-close","destroy-on-close"])}}}),[["__scopeId","data-v-1e7710fa"]]),"Dialog"),ll=["contenteditable","data-placeholder","aria-multiline","aria-disabled"],nl={key:0,class:"editable-box__counter","aria-live":"polite"},al={key:0,class:"editable-box__module-panel"},il={key:0,class:"editable-box__module-group"},rl={class:"editable-box__module-list"},sl=["disabled","onClick"],cl={class:"editable-box__module-list"},dl=["disabled","onClick"],Pe="",_t=se(de(e.defineComponent({__name:"EditableBox",props:{modelValue:{default:()=>[]},fixedModules:{default:()=>[]},moduleGroups:{default:()=>[]},fixedGroupTitle:{default:"固定变量"},textLimit:{default:0},moduleLimit:{default:0},width:{default:"100%"},height:{},textType:{default:"text"},placeholder:{default:"请输入内容"},showCounter:{type:Boolean,default:!0},draggable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},allowLineBreak:{type:Boolean,default:!0}},emits:["update:modelValue","change","blur","limit-exceed"],setup(t,{expose:g,emit:i}){const o=t,a=i,l=e.ref(null),p=e.ref([]),b=e.ref(0),y=e.ref(!1),$=e.ref(!1),I=e.ref(!1);let h=null,_=null,N=null,T="";const E=new RegExp(Pe,"g"),R=e.computed(()=>[...o.fixedModules,...o.moduleGroups.flatMap(s=>s.modules)]),q=e.computed(()=>new Map(R.value.map(s=>[String(s.id),s]))),A=e.computed(()=>o.fixedModules.length>0||o.moduleGroups.some(s=>s.modules.length>0));function z(s){if(!(s===void 0||s===""))return typeof s=="number"?`${s}px`:s}const x=e.computed(()=>({width:z(o.width)})),r=e.computed(()=>({height:z(o.height),minHeight:o.height===void 0?void 0:"0px"})),n=s=>s>0?s:"不限",d=s=>String(s),m=s=>String(s),k=s=>Array.from(s).length,U=s=>p.value.includes(d(s));function O(s){return!!(l.value&&l.value.contains(s.commonAncestorContainer))}function f(){const s=window.getSelection();if(!s||s.rangeCount===0)return;const C=s.getRangeAt(0);O(C)&&(h=C.cloneRange())}function P(){const s=document.createRange();return l.value&&(s.selectNodeContents(l.value),s.collapse(!1)),s}function X(){return h&&O(h)?h.cloneRange():P()}function v(s){const C=window.getSelection();C&&(C.removeAllRanges(),C.addRange(s),h=s.cloneRange())}function le(){var C;(C=l.value)==null||C.focus();const s=X();v(s)}function re(s){const C=document.createElement("span");return C.className="editable-box__tag",C.textContent=s.label,C.contentEditable="false",C.draggable=o.draggable&&!o.disabled&&!s.disabled,C.setAttribute("role","button"),C.setAttribute("aria-label",`变量:${s.label}`),C.dataset.id=d(s.id),C.dataset.type=m(s.type??"module"),C.addEventListener("dragstart",ge),C.addEventListener("dragend",Ce),C}function _e(){return document.createTextNode(Pe)}function ue(s){return!!(s&&s.nodeType===Node.TEXT_NODE&&s.textContent===Pe)}function ye(s){return s.replace(E,"")}function fe(){if(!l.value)return[];const s=document.createTreeWalker(l.value,NodeFilter.SHOW_TEXT,{acceptNode(Q){var ee;return(ee=Q.parentElement)!=null&&ee.closest(".editable-box__tag")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),C=[];let L=s.nextNode();for(;L;)C.push(L),L=s.nextNode();return C}function V(){if(!l.value)return"";let s="";function C(L){if(L.nodeType===Node.TEXT_NODE){s+=ye(L.textContent||"");return}if(L.nodeType!==Node.ELEMENT_NODE)return;const Q=L;if(!Q.classList.contains("editable-box__tag")){if(Q.tagName==="BR"){s+=`
|
|
2
2
|
`;return}Q.childNodes.forEach(C),(Q.tagName==="DIV"||Q.tagName==="P")&&Q.nextSibling&&(s+=`
|
|
3
3
|
`)}}return l.value.childNodes.forEach(C),s}function B(){if(!l.value)return;const s=Array.from(l.value.querySelectorAll(".editable-box__tag")).map(C=>C.dataset.id).filter(C=>!!C);p.value=Array.from(new Set(s))}function F(s,C){const L=ye(C);if(!L)return;const Q=s[s.length-1];if(Q&&m(Q.type)===m(o.textType)){Q.val=`${Q.val}${L}`;return}s.push({type:o.textType,val:L})}function D(){var L;const s=[];function C(Q){if(Q.nodeType===Node.TEXT_NODE){F(s,Q.textContent||"");return}if(Q.nodeType!==Node.ELEMENT_NODE)return;const ee=Q;if(ee.classList.contains("editable-box__tag")){const pe=ee.dataset.id,he=ee.dataset.type;pe&&he&&s.push({type:he,val:pe});return}if(ee.tagName==="BR"){F(s,`
|
|
4
4
|
`);return}ee.childNodes.forEach(C),(ee.tagName==="DIV"||ee.tagName==="P")&&ee.nextSibling&&F(s,`
|
package/dist/monitor.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var N = Object.defineProperty;
|
|
2
2
|
var q = (r, t, e) => t in r ? N(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
3
|
var o = (r, t, e) => q(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
const I = "
|
|
4
|
+
const I = "weave-ui", O = {
|
|
5
5
|
fetch: !1,
|
|
6
6
|
xhr: !1,
|
|
7
7
|
includeSuccessful: !1
|
|
@@ -13,7 +13,7 @@ function b(r) {
|
|
|
13
13
|
function U(r) {
|
|
14
14
|
return typeof URL < "u" && r instanceof URL;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function m(r) {
|
|
17
17
|
if (typeof r == "string") return r;
|
|
18
18
|
if (r === null) return "null";
|
|
19
19
|
if (r === void 0) return "undefined";
|
|
@@ -88,7 +88,7 @@ function B(r) {
|
|
|
88
88
|
...r.stack ? { stack: r.stack } : {}
|
|
89
89
|
};
|
|
90
90
|
if (b(r)) {
|
|
91
|
-
const t = typeof r.name == "string" ? r.name : "Error", e = typeof r.message == "string" ? r.message :
|
|
91
|
+
const t = typeof r.name == "string" ? r.name : "Error", e = typeof r.message == "string" ? r.message : m(r), n = typeof r.stack == "string" ? r.stack : void 0;
|
|
92
92
|
return {
|
|
93
93
|
name: t,
|
|
94
94
|
message: e,
|
|
@@ -97,7 +97,7 @@ function B(r) {
|
|
|
97
97
|
}
|
|
98
98
|
return {
|
|
99
99
|
name: "Error",
|
|
100
|
-
message:
|
|
100
|
+
message: m(r)
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
function _(r = {}) {
|
|
@@ -546,7 +546,7 @@ class X {
|
|
|
546
546
|
if (t instanceof Date)
|
|
547
547
|
return Number.isNaN(t.getTime()) ? "Invalid Date" : t.toISOString();
|
|
548
548
|
if (U(t)) return this.redactUrl(t.href);
|
|
549
|
-
if (!b(t)) return
|
|
549
|
+
if (!b(t)) return m(t);
|
|
550
550
|
if (n.has(t)) return "[Circular]";
|
|
551
551
|
if (n.add(t), Array.isArray(t))
|
|
552
552
|
return t.map((s) => this.sanitizeUnknown(s, "", n));
|
|
@@ -696,7 +696,7 @@ class G {
|
|
|
696
696
|
url: i,
|
|
697
697
|
duration: l,
|
|
698
698
|
ok: !1,
|
|
699
|
-
error:
|
|
699
|
+
error: m(u)
|
|
700
700
|
}), u;
|
|
701
701
|
}
|
|
702
702
|
);
|
|
@@ -708,7 +708,7 @@ class G {
|
|
|
708
708
|
url: i,
|
|
709
709
|
duration: u,
|
|
710
710
|
ok: !1,
|
|
711
|
-
error:
|
|
711
|
+
error: m(h)
|
|
712
712
|
}), h;
|
|
713
713
|
}
|
|
714
714
|
}
|
|
@@ -737,8 +737,8 @@ class G {
|
|
|
737
737
|
...u,
|
|
738
738
|
startedAt: f(s.browserWindow),
|
|
739
739
|
monitors: l
|
|
740
|
-
},
|
|
741
|
-
this.removeEventListener("loadend",
|
|
740
|
+
}, g = () => {
|
|
741
|
+
this.removeEventListener("loadend", g), s.xhrListeners.delete(this), s.notifyRequest(d.monitors, {
|
|
742
742
|
kind: "xhr",
|
|
743
743
|
method: d.method,
|
|
744
744
|
url: this.responseURL || d.url,
|
|
@@ -748,17 +748,17 @@ class G {
|
|
|
748
748
|
...this.status === 0 ? { error: "Network request failed" } : {}
|
|
749
749
|
});
|
|
750
750
|
};
|
|
751
|
-
this.addEventListener("loadend",
|
|
751
|
+
this.addEventListener("loadend", g), s.xhrListeners.set(this, g);
|
|
752
752
|
try {
|
|
753
753
|
h === void 0 ? i.call(this) : i.call(this, h);
|
|
754
754
|
} catch (y) {
|
|
755
|
-
throw this.removeEventListener("loadend",
|
|
755
|
+
throw this.removeEventListener("loadend", g), s.xhrListeners.delete(this), s.notifyRequest(d.monitors, {
|
|
756
756
|
kind: "xhr",
|
|
757
757
|
method: d.method,
|
|
758
758
|
url: d.url,
|
|
759
759
|
duration: f(s.browserWindow) - d.startedAt,
|
|
760
760
|
ok: !1,
|
|
761
|
-
error:
|
|
761
|
+
error: m(y)
|
|
762
762
|
}), y;
|
|
763
763
|
}
|
|
764
764
|
};
|
|
@@ -776,11 +776,11 @@ class G {
|
|
|
776
776
|
installHistoryPatch() {
|
|
777
777
|
if (this.historyCleanup) return;
|
|
778
778
|
const t = this.browserWindow.history, e = t.pushState, n = t.replaceState, i = this, s = (h, u) => function(l, p, d) {
|
|
779
|
-
const
|
|
779
|
+
const g = i.browserWindow.location.href, y = f(i.browserWindow);
|
|
780
780
|
h.call(this, l, p, d), i.notifyNavigation({
|
|
781
781
|
source: "history",
|
|
782
782
|
method: u,
|
|
783
|
-
from:
|
|
783
|
+
from: g,
|
|
784
784
|
to: i.browserWindow.location.href,
|
|
785
785
|
duration: f(i.browserWindow) - y
|
|
786
786
|
});
|
package/dist/monitor.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(l=typeof globalThis<"u"?globalThis:l||self,d(l.ElementCustomUIMonitor={}))})(this,function(l){"use strict";var ut=Object.defineProperty;var ht=(l,d,g)=>d in l?ut(l,d,{enumerable:!0,configurable:!0,writable:!0,value:g}):l[d]=g;var o=(l,d,g)=>ht(l,typeof d!="symbol"?d+"":d,g);const d="element-custom-ui",g={fetch:!1,xhr:!1,includeSuccessful:!1},O="[REDACTED]",v=()=>{};function C(r){return typeof r=="object"&&r!==null}function E(r){return typeof URL<"u"&&r instanceof URL}function y(r){if(typeof r=="string")return r;if(r===null)return"null";if(r===void 0)return"undefined";if(r instanceof Error)return r.message||r.name;try{const t=JSON.stringify(r);if(typeof t=="string")return t}catch{}try{return String(r)}catch{return"Unknown error"}}function S(r){return typeof r=="number"&&Number.isFinite(r)?r:void 0}function U(r){return(r==null?void 0:r.trim().toUpperCase())||"GET"}function F(){return typeof window>"u"?void 0:window}function m(r){var e;const t=(e=r.performance)==null?void 0:e.now;return typeof t=="function"?t.call(r.performance):Date.now()}function k(r,t){try{return new URL(r,t.location.href).href}catch{return r}}function W(r,t){return typeof r=="string"?k(r,t):E(r)?r.href:r.url}function H(r,t){return t!=null&&t.method?U(t.method):typeof r=="string"||E(r)?"GET":U(r.method)}function j(r,t){return typeof t=="string"?r.toLowerCase()===t.toLowerCase():(t.lastIndex=0,t.test(r))}function M(r,t){return(t==null?void 0:t.some(e=>j(r,e)))??!1}function z(r,t){if(!t.startsWith("/"))return r.includes(t);try{const e=new URL(r,`https://${d}.invalid`),n=`${e.pathname}${e.search}`;return t.includes("?")?n===t:e.pathname===t}catch{return r.includes(t)}}function R(r){return r.XMLHttpRequest}function D(r){if(!r||!C(r))return;const t=typeof r.tagName=="string"?r.tagName.toLowerCase():"",e=typeof r.currentSrc=="string"?r.currentSrc:typeof r.src=="string"?r.src:typeof r.href=="string"?r.href:"";return t&&e?{element:t,url:e}:void 0}function A(r){if(r instanceof Error)return{name:r.name||"Error",message:r.message||r.name||"Unknown error",...r.stack?{stack:r.stack}:{}};if(C(r)){const t=typeof r.name=="string"?r.name:"Error",e=typeof r.message=="string"?r.message:y(r),n=typeof r.stack=="string"?r.stack:void 0;return{name:t,message:e,...n?{stack:n}:{}}}return{name:"Error",message:y(r)}}function B(r={}){return new _(r)}class _{constructor(t){o(this,"active",!1);o(this,"destroyed",!1);o(this,"recorderActive",!1);o(this,"lastNavigationUrl","");o(this,"browserCleanups",[]);o(this,"vueCleanups",[]);o(this,"installedVueApps",new WeakSet);o(this,"start",()=>{if(this.destroyed||this.active)return!1;const t=this.getBrowserWindow();if(!t)return!1;this.active=!0,this.lastNavigationUrl=t.location.href;try{if((this.shouldCaptureGlobalErrors()||this.shouldCaptureResourceErrors())&&this.installErrorListener(t),this.shouldCaptureUnhandledRejections()&&this.installUnhandledRejectionListener(t),this.shouldCaptureNavigation()&&this.installNavigationListeners(t),this.shouldCapturePerformance()&&this.installPerformanceListener(t),this.requiresInstrumentationHub()){const e=L(t).subscribe(this);this.browserCleanups.push(e)}return this.startRecorder(),!0}catch{return this.active=!1,this.runBrowserCleanups(),this.stopRecorder(),!1}});o(this,"stop",()=>{this.active&&(this.active=!1,this.runBrowserCleanups(),this.stopRecorder())});o(this,"destroy",()=>{if(!this.destroyed){this.stop(),this.destroyed=!0;for(const t of this.vueCleanups.splice(0).reverse())this.runSafely(t)}});o(this,"captureException",(t,e)=>{this.captureExceptionFromSource(t,"manual",e)});o(this,"captureMessage",(t,e="info",n)=>{this.emit({type:"message",level:e,timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(n),tags:this.getTags(),data:{message:t}})});o(this,"createVuePlugin",(t={})=>({install:e=>{if(this.destroyed||this.installedVueApps.has(e))return;this.installedVueApps.add(e);const n=e.config.errorHandler,i=this,s=(a,c,h)=>{i.captureExceptionFromSource(a,"vue",{vue:{component:(c==null?void 0:c.$options.name)??(c==null?void 0:c.$options.__name)??"anonymous",info:h}}),n==null||n(a,c,h)};e.config.errorHandler=s,this.vueCleanups.push(()=>{e.config.errorHandler===s&&(e.config.errorHandler=n)}),t.startOnInstall===!0&&this.start()}}));o(this,"needsFetchInstrumentation",()=>this.active&&this.getRequestOptions().fetch);o(this,"needsXhrInstrumentation",()=>this.active&&this.getRequestOptions().xhr);o(this,"needsHistoryInstrumentation",()=>this.active&&this.shouldCaptureNavigation());o(this,"shouldMonitorRequest",(t,e)=>{const n=this.getRequestOptions(),i=t==="fetch"?n.fetch:n.xhr;return this.active&&i&&!this.isIgnoredUrl(e)});o(this,"handleInstrumentedRequest",t=>{if(!this.active||this.isIgnoredUrl(t.url))return;const e=this.getRequestOptions(),n=e.slowThreshold!==void 0&&t.duration>=e.slowThreshold;(e.includeSuccessful||!t.ok||n)&&this.emit({type:"request",level:t.ok?"info":"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:t})});o(this,"handleInstrumentedNavigation",t=>{!this.active||!this.shouldCaptureNavigation()||(this.lastNavigationUrl=t.to,this.emit({type:"navigation",level:"info",timestamp:this.getTimestamp(),url:t.to,context:this.getContext(),tags:this.getTags(),data:t}))});this.options=t}get started(){return this.active}getBrowserWindow(){return this.options.window??F()}createTransportContext(){return{fetch:(t,e)=>this.fetchForTransport(t,e),createXMLHttpRequest:()=>this.createXhrForTransport()}}fetchForTransport(t,e){const n=this.getBrowserWindow();return!n||typeof n.fetch!="function"?Promise.reject(new Error("Monitor transport fetch is unavailable outside a browser.")):L(n).fetchForTransport(t,e)}createXhrForTransport(){const t=this.getBrowserWindow();if(!t||!R(t))throw new Error("Monitor transport XMLHttpRequest is unavailable outside a browser.");return L(t).createXhrForTransport()}getTimestamp(){var t,e;try{const n=((e=(t=this.options).now)==null?void 0:e.call(t))??Date.now();return Number.isFinite(n)?n:Date.now()}catch{return Date.now()}}getCurrentUrl(){var e;const t=this.getBrowserWindow();return((e=t==null?void 0:t.location)==null?void 0:e.href)??""}getContext(t){var n,i;let e;try{e=(i=(n=this.options).getContext)==null?void 0:i.call(n)}catch{e=void 0}return{...this.options.context??{},...e??{},...t??{}}}getTags(){return{...this.options.tags??{},...this.options.release?{release:this.options.release}:{},...this.options.environment?{environment:this.options.environment}:{}}}getRequestOptions(){const t=this.options.captureRequests;if(!t)return g;if(t===!0)return{fetch:!0,xhr:!0,includeSuccessful:!1};const e=t.slowThreshold;return{fetch:t.fetch===!0,xhr:t.xhr===!0,includeSuccessful:t.includeSuccessful===!0,...typeof e=="number"&&Number.isFinite(e)&&e>=0?{slowThreshold:e}:{}}}shouldCaptureGlobalErrors(){return this.options.captureGlobalErrors!==!1}shouldCaptureResourceErrors(){return this.options.captureResourceErrors!==!1}shouldCaptureUnhandledRejections(){return this.options.captureUnhandledRejections!==!1}shouldCaptureNavigation(){return this.options.captureNavigation!==!1}shouldCapturePerformance(){return this.options.capturePerformance!==!1}requiresInstrumentationHub(){const t=this.getRequestOptions();return t.fetch||t.xhr||this.shouldCaptureNavigation()}isIgnoredUrl(t){var e;return((e=this.options.ignoreUrls)==null?void 0:e.some(n=>{try{return typeof n=="function"?n(t):typeof n=="string"?z(t,n):(n.lastIndex=0,n.test(t))}catch{return!1}}))??!1}installErrorListener(t){const e=n=>{if(!this.active)return;const i=D(n.target);if(i){this.shouldCaptureResourceErrors()&&this.emit({type:"resource",level:"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:i});return}if(!this.shouldCaptureGlobalErrors())return;const s=n,a={...typeof s.filename=="string"?{filename:s.filename}:{},...S(s.lineno)!==void 0?{line:S(s.lineno)}:{},...S(s.colno)!==void 0?{column:S(s.colno)}:{}},c=s.error??new Error(typeof s.message=="string"?s.message:"Unknown window error");this.captureExceptionFromSource(c,"window.error",void 0,a)};t.addEventListener("error",e,!0),this.browserCleanups.push(()=>{t.removeEventListener("error",e,!0)})}installUnhandledRejectionListener(t){const e=n=>{this.active&&this.captureExceptionFromSource(n.reason,"unhandledrejection")};t.addEventListener("unhandledrejection",e),this.browserCleanups.push(()=>{t.removeEventListener("unhandledrejection",e)})}installNavigationListeners(t){const e=()=>{const i=t.location.href;this.handleInstrumentedNavigation({source:"popstate",from:this.lastNavigationUrl,to:i,duration:0})},n=i=>{this.handleInstrumentedNavigation({source:"hashchange",from:i.oldURL,to:i.newURL,duration:0})};t.addEventListener("popstate",e),t.addEventListener("hashchange",n),this.browserCleanups.push(()=>{t.removeEventListener("popstate",e),t.removeEventListener("hashchange",n)})}installPerformanceListener(t){const e=()=>{if(!this.active)return;const n=G(t);n&&this.emit({type:"performance",level:"info",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:n})};if(t.document.readyState==="complete"){e();return}t.addEventListener("load",e,{once:!0}),this.browserCleanups.push(()=>{t.removeEventListener("load",e)})}captureExceptionFromSource(t,e,n,i={}){const s={...A(t),source:e,...i};this.emit({type:e==="unhandledrejection"?"unhandledrejection":"exception",level:"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(n),tags:this.getTags(),data:s})}emit(t){var i;if(this.destroyed||!this.isSampled())return;const e=this.sanitizeEvent(t);if(!e)return;const n=this.createTransportContext();this.options.transport&&this.runSafely(()=>{var s,a;return(a=(s=this.options).transport)==null?void 0:a.call(s,e,n)}),this.active&&((i=this.options.recorder)!=null&&i.capture)&&this.runSafely(()=>{var s,a;return(a=(s=this.options.recorder)==null?void 0:s.capture)==null?void 0:a.call(s,e,n)})}isSampled(){var n,i;const t=this.options.sampleRate,e=typeof t=="number"&&Number.isFinite(t)?Math.min(Math.max(t,0),1):1;if(e===0)return!1;if(e===1)return!0;try{return(((i=(n=this.options).random)==null?void 0:i.call(n))??Math.random())<e}catch{return!0}}sanitizeEvent(t){let e;switch(t.type){case"exception":case"unhandledrejection":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,name:this.redactText(t.data.name,"name"),message:this.redactText(t.data.message,"message"),...t.data.stack?{stack:this.redactText(t.data.stack,"stack")}:{},...t.data.filename?{filename:this.redactUrl(t.data.filename)}:{}}};break;case"message":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{message:this.redactText(t.data.message,"message")}};break;case"resource":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{element:this.redactText(t.data.element,"element"),url:this.redactUrl(t.data.url)}};break;case"navigation":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,from:this.redactUrl(t.data.from),to:this.redactUrl(t.data.to)}};break;case"performance":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data}};break;case"request":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,method:this.redactText(t.data.method,"method"),url:this.redactUrl(t.data.url),...t.data.error?{error:this.redactText(t.data.error,"error")}:{}}};break}try{return this.options.sanitize?this.options.sanitize(e):e}catch{return null}}sanitizeContext(t){const e=new WeakSet,n=this.sanitizeUnknown(t,"",e);return C(n)?n:{}}sanitizeUnknown(t,e,n){if(e&&this.shouldRedactKey(e))return this.getRedactionReplacement();if(t==null)return t;switch(typeof t){case"string":return this.redactText(t,e);case"number":case"boolean":return t;case"bigint":return t.toString();case"symbol":return t.toString();case"function":return`[Function ${t.name||"anonymous"}]`}if(t instanceof Error)return{name:this.redactText(t.name||"Error","name"),message:this.redactText(t.message||t.name||"Unknown error","message"),...t.stack?{stack:this.redactText(t.stack,"stack")}:{}};if(t instanceof Date)return Number.isNaN(t.getTime())?"Invalid Date":t.toISOString();if(E(t))return this.redactUrl(t.href);if(!C(t))return y(t);if(n.has(t))return"[Circular]";if(n.add(t),Array.isArray(t))return t.map(s=>this.sanitizeUnknown(s,"",n));const i={};try{for(const[s,a]of Object.entries(t))i[s]=this.sanitizeUnknown(a,s,n)}catch{return"[Unserializable object]"}return i}sanitizeTags(t){const e={};for(const[n,i]of Object.entries(t))typeof i=="string"?e[n]=this.redactText(i,n):e[n]=i;return e}shouldRedactKey(t){var e;return M(t,(e=this.options.redact)==null?void 0:e.keys)}getRedactionReplacement(){var t;return((t=this.options.redact)==null?void 0:t.replacement)??O}redactText(t,e){return e&&this.shouldRedactKey(e)?this.getRedactionReplacement():t}redactUrl(t){var e,n;if(this.shouldRedactKey("url"))return this.getRedactionReplacement();if(!((n=(e=this.options.redact)==null?void 0:e.queryParams)!=null&&n.length))return t;try{const i=/^[a-z][a-z\d+.-]*:/i.test(t),s=new URL(t,`https://${d}.invalid`);for(const a of Array.from(s.searchParams.keys()))M(a,this.options.redact.queryParams)&&s.searchParams.set(a,this.getRedactionReplacement());return i?s.toString():`${s.pathname}${s.search}${s.hash}`}catch{return t}}startRecorder(){var t;!((t=this.options.recorder)!=null&&t.start)||this.recorderActive||(this.recorderActive=!0,this.runSafely(()=>{var e,n;return(n=(e=this.options.recorder)==null?void 0:e.start)==null?void 0:n.call(e,this.createTransportContext())}))}stopRecorder(){var t;!((t=this.options.recorder)!=null&&t.stop)||!this.recorderActive||(this.recorderActive=!1,this.runSafely(()=>{var e,n;return(n=(e=this.options.recorder)==null?void 0:e.stop)==null?void 0:n.call(e,this.createTransportContext())}))}runBrowserCleanups(){for(const t of this.browserCleanups.splice(0).reverse())this.runSafely(t)}runSafely(t){try{const e=t();Promise.resolve(e).catch(v)}catch{}}}class X{constructor(t){o(this,"monitors",new Set);o(this,"xhrMetadata",new WeakMap);o(this,"transportXhrs",new WeakSet);o(this,"xhrListeners",new Map);o(this,"nativeFetch");o(this,"fetchCleanup");o(this,"xhrCleanup");o(this,"historyCleanup");this.browserWindow=t}subscribe(t){return this.monitors.add(t),this.sync(),()=>{this.monitors.delete(t),this.sync(),this.monitors.size===0&&T.delete(this.browserWindow)}}fetchForTransport(t,e){return(this.nativeFetch??this.browserWindow.fetch).call(this.browserWindow,t,e)}createXhrForTransport(){const t=R(this.browserWindow);if(!t)throw new Error("Monitor transport XMLHttpRequest is unavailable outside a browser.");const e=new t;return this.transportXhrs.add(e),e}sync(){this.someMonitor(t=>t.needsFetchInstrumentation())?this.installFetchPatch():this.removeFetchPatch(),this.someMonitor(t=>t.needsXhrInstrumentation())?this.installXhrPatch():this.removeXhrPatch(),this.someMonitor(t=>t.needsHistoryInstrumentation())?this.installHistoryPatch():this.removeHistoryPatch()}someMonitor(t){for(const e of this.monitors)if(t(e))return!0;return!1}getRequestMonitors(t,e){return Array.from(this.monitors).filter(n=>n.shouldMonitorRequest(t,e))}installFetchPatch(){if(this.fetchCleanup||typeof this.browserWindow.fetch!="function")return;const t=this.browserWindow.fetch;this.nativeFetch=t;const e=this,n=function(i,s){return e.performFetch(i,s)};this.browserWindow.fetch=n,this.fetchCleanup=()=>{this.browserWindow.fetch===n&&(this.browserWindow.fetch=t),this.nativeFetch===t&&(this.nativeFetch=void 0)}}performFetch(t,e){const n=this.nativeFetch??this.browserWindow.fetch,i=W(t,this.browserWindow),s=this.getRequestMonitors("fetch",i);if(s.length===0)return n.call(this.browserWindow,t,e);const a=H(t,e),c=m(this.browserWindow);try{return n.call(this.browserWindow,t,e).then(u=>{const p=m(this.browserWindow)-c;return this.notifyRequest(s,{kind:"fetch",method:a,url:u.url||i,status:u.status,duration:p,ok:u.ok}),u},u=>{const p=m(this.browserWindow)-c;throw this.notifyRequest(s,{kind:"fetch",method:a,url:i,duration:p,ok:!1,error:y(u)}),u})}catch(h){const u=m(this.browserWindow)-c;throw this.notifyRequest(s,{kind:"fetch",method:a,url:i,duration:u,ok:!1,error:y(h)}),h}}removeFetchPatch(){var t;(t=this.fetchCleanup)==null||t.call(this),this.fetchCleanup=void 0}installXhrPatch(){if(this.xhrCleanup)return;const t=R(this.browserWindow);if(!t)return;const e=t.prototype,n=e.open,i=e.send,s=this,a=function(h,u,p,w,f){s.xhrMetadata.set(this,{method:U(h),url:k(String(u),s.browserWindow)}),n.call(this,h,u,p??!0,w,f)},c=function(h){const u=s.xhrMetadata.get(this),p=u&&!s.transportXhrs.has(this)?s.getRequestMonitors("xhr",u.url):[];if(!u||p.length===0){h===void 0?i.call(this):i.call(this,h);return}const w=s.xhrListeners.get(this);w&&(this.removeEventListener("loadend",w),s.xhrListeners.delete(this));const f={...u,startedAt:m(s.browserWindow),monitors:p},b=()=>{this.removeEventListener("loadend",b),s.xhrListeners.delete(this),s.notifyRequest(f.monitors,{kind:"xhr",method:f.method,url:this.responseURL||f.url,status:this.status,duration:m(s.browserWindow)-f.startedAt,ok:this.status>=200&&this.status<400,...this.status===0?{error:"Network request failed"}:{}})};this.addEventListener("loadend",b),s.xhrListeners.set(this,b);try{h===void 0?i.call(this):i.call(this,h)}catch(x){throw this.removeEventListener("loadend",b),s.xhrListeners.delete(this),s.notifyRequest(f.monitors,{kind:"xhr",method:f.method,url:f.url,duration:m(s.browserWindow)-f.startedAt,ok:!1,error:y(x)}),x}};e.open=a,e.send=c,this.xhrCleanup=()=>{e.open===a&&(e.open=n),e.send===c&&(e.send=i);for(const[h,u]of this.xhrListeners)h.removeEventListener("loadend",u);this.xhrListeners.clear()}}removeXhrPatch(){var t;(t=this.xhrCleanup)==null||t.call(this),this.xhrCleanup=void 0}installHistoryPatch(){if(this.historyCleanup)return;const t=this.browserWindow.history,e=t.pushState,n=t.replaceState,i=this,s=(h,u)=>function(p,w,f){const b=i.browserWindow.location.href,x=m(i.browserWindow);h.call(this,p,w,f),i.notifyNavigation({source:"history",method:u,from:b,to:i.browserWindow.location.href,duration:m(i.browserWindow)-x})},a=s(e,"pushState"),c=s(n,"replaceState");t.pushState=a,t.replaceState=c,this.historyCleanup=()=>{t.pushState===a&&(t.pushState=e),t.replaceState===c&&(t.replaceState=n)}}removeHistoryPatch(){var t;(t=this.historyCleanup)==null||t.call(this),this.historyCleanup=void 0}notifyRequest(t,e){for(const n of t)n.handleInstrumentedRequest(e)}notifyNavigation(t){for(const e of this.monitors)e.handleInstrumentedNavigation(t)}}const T=new WeakMap;function L(r){let t=T.get(r);return t||(t=new X(r),T.set(r,t)),t}function G(r){const t=r.performance;if(!(t!=null&&t.getEntriesByType))return;const e=t.getEntriesByType("navigation").find(n=>"domContentLoadedEventEnd"in n&&"loadEventEnd"in n);if(e)return{navigationType:e.type,duration:e.duration,redirect:e.redirectEnd-e.redirectStart,dns:e.domainLookupEnd-e.domainLookupStart,connection:e.connectEnd-e.connectStart,request:e.responseStart-e.requestStart,response:e.responseEnd-e.responseStart,domInteractive:e.domInteractive,domContentLoaded:e.domContentLoadedEventEnd-e.startTime,load:e.loadEventEnd-e.startTime}}const P="__easyOilLegacyMonitorLog",N="easyOilLegacyMonitorSessionId",K={silentWhiteScreen:"Legacy white-screen detection is not included. Use a project-owned detector and report through transport instead.",whiteBoxElements:"Legacy white-screen container configuration is not supported because white-screen detection is not included.",skeletonProject:"Legacy skeleton-screen detection is not supported because white-screen detection is not included.",silentRecordScreen:"Legacy rrweb screen recording is not bundled. Keep the project-owned recording implementation when this capability is required.",recordScreentime:"Legacy rrweb recording duration is not supported because screen recording is not included.",recordScreenTypeList:"Legacy rrweb recording trigger types are not supported because screen recording is not included.",useImgUpload:"Legacy image-beacon reporting is not supported. The compatibility transport uses the monitor transport context instead.",silentClick:"Legacy click breadcrumb collection is not supported by this compatibility layer.",throttleDelayTime:"Legacy click throttling is not supported because click breadcrumb collection is not included.",maxBreadcrumbs:"Legacy breadcrumb buffering is not supported by this compatibility layer.",beforePushBreadcrumb:"Legacy breadcrumb hooks are not supported because breadcrumb collection is not included.",overTime:"Legacy request timeout handling is not supported. Configure timeouts in the application HTTP client.",handleHttpStatus:"Legacy response-body status inspection is not supported by this compatibility layer.",defHttp:"Legacy defHttp interception is not supported. Enable browser request capture with silentXhr or silentFetch instead.",router:"Legacy router-instance instrumentation is not supported. Enable history or hash capture with the corresponding legacy flags instead.",recordScreenPlugin:"Legacy RecordScreen plugins require rrweb and are not supported by this compatibility layer."};function q(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function $(){return!1}function V(r){if(typeof r=="string")return r;if(r instanceof Error)return r.message||r.name||"Unknown error";try{const t=JSON.stringify(r);if(typeof t=="string")return t}catch{}try{return String(r)}catch{return"Unknown message"}}function I(r){if(typeof r.getUserId=="function")try{const t=r.getUserId();if(typeof t=="string"||typeof t=="number")return t}catch{return typeof r.userId=="string"||typeof r.userId=="number"?r.userId:void 0}return typeof r.userId=="string"||typeof r.userId=="number"?r.userId:void 0}function J(){if(typeof sessionStorage>"u")return"";try{const r=sessionStorage.getItem(N);if(r)return r;const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return sessionStorage.setItem(N,t),t}catch{return""}}function Y(r){switch(r.type){case"exception":return"error";case"navigation":return r.data.source==="hashchange"?"hashchange":"history";case"request":return r.data.kind;default:return r.type}}function Q(r){switch(r.type){case"exception":case"unhandledrejection":case"resource":return"client_debug";default:return"user_behavior"}}function Z(r){switch(r.type){case"exception":case"unhandledrejection":return{message:r.data.message,name:r.data.name,...r.data.stack?{stack:r.data.stack}:{},...r.data.filename?{fileName:r.data.filename}:{},...r.data.line!==void 0?{line:r.data.line}:{},...r.data.column!==void 0?{column:r.data.column}:{}};case"request":return{method:r.data.method,url:r.data.url,Status:r.data.status,status:r.data.ok?"ok":"error",elapsedTime:r.data.duration,...r.data.error?{message:r.data.error}:{}};case"navigation":return{from:r.data.from,to:r.data.to,duration:r.data.duration,source:r.data.source};case"performance":return{...r.data};case"resource":return{name:r.data.element,message:r.data.url};case"message":return{message:r.data.message}}}function tt(r){if(r.type!=="message")return;const t=r.context[P];return q(t)?t:void 0}function et(r,t){const e=I(t),n={moduleId:Q(r),type:Y(r),status:r.level==="error"||r.level==="fatal"?"error":"ok",time:r.timestamp,pageUrl:r.url,...t.appChannelId?{appChannelId:t.appChannelId}:{},...t.dataChannelId?{dataChannelId:t.dataChannelId}:{},...t.version?{version:t.version}:{},...e!==void 0?{userId:e}:{},message:r.type==="message"?r.data.message:void 0,data:Z(r)},i=tt(r);if(!i)return n;const s=i.type,a=i.moduleId,c=i.data;return{...n,...i,type:typeof s=="string"?s:n.type,moduleId:typeof a=="string"?a:n.moduleId,data:q(c)?c:{...n.data,...i}}}function rt(r,t){return r.type!=="navigation"?!0:r.data.source==="hashchange"?t.silentHashchange===!0:t.silentHistory===!0}function nt(r){const t=[];return r.dsn&&t.push(r.dsn),r.filterXhrUrlRegExp&&t.push(r.filterXhrUrlRegExp),{captureRequests:{xhr:r.silentXhr===!0,fetch:r.silentFetch===!0},captureGlobalErrors:r.silentError===!0,captureUnhandledRejections:r.silentUnhandledrejection===!0,captureNavigation:r.silentHistory===!0||r.silentHashchange===!0,capturePerformance:r.silentPerformance===!0,ignoredUrls:t}}function st(r,t){const e=I(t),n={...r,data:r.data??{}},i={moduleId:r.moduleId??"user_behavior",type:r.type,message:r.message,identityID:e??"",userIdentity:e??"",sessionId:J(),extraContent:JSON.stringify(n)};return{content:[JSON.stringify(i)]}}async function it(r,t){if(!r)return t;try{const e=await r(t);return e===!1?void 0:e??t}catch{return}}class ot{constructor(t={}){o(this,"currentMonitor");o(this,"currentOptions");o(this,"currentMapping");o(this,"plugins",new Set);o(this,"reportedErrorKeys",new Set);o(this,"dsnWarningShown",!1);o(this,"init",(t=this.defaultOptions)=>{const e=this.configure(t);return e==null||e.start(),this});o(this,"install",(t,e=this.defaultOptions)=>{const n=this.configure(e);n&&(t.use(n.createVuePlugin()),n.start())});o(this,"log",t=>{const e=this.currentMonitor;if(!e)return!1;if(typeof t=="string")return e.captureMessage(t),!0;const n=V(t.message??t);return e.captureMessage(n,"info",{[P]:t}),!0});o(this,"errorBoundary",t=>{const e=this.currentMonitor;return e?(e.captureException(t,{framework:"react"}),!0):!1});o(this,"use",(t,e)=>{let n;try{n=new t(e)}catch{return}return this.plugins.add(n),n.type==="recordScreen"&&this.notifyUnsupported("recordScreenPlugin",n.type),this.runPluginCore(n),n});o(this,"stop",()=>{var t;(t=this.currentMonitor)==null||t.stop()});o(this,"destroy",()=>{var t;(t=this.currentMonitor)==null||t.destroy(),this.currentMonitor=void 0,this.currentMapping=void 0,this.reportedErrorKeys.clear()});this.defaultOptions=t}get monitor(){return this.currentMonitor}get started(){var t;return((t=this.currentMonitor)==null?void 0:t.started)??!1}get options(){return this.currentOptions}configure(t){if(this.destroy(),this.currentOptions={...t},this.dsnWarningShown=!1,this.reportUnsupportedOptions(t),t.disabled===!0)return;const e=nt(t);this.currentMapping=e;const n=B({transport:(i,s)=>this.handleMonitorEvent(i,s),captureRequests:{xhr:e.captureRequests.xhr,fetch:e.captureRequests.fetch,includeSuccessful:!0},captureGlobalErrors:e.captureGlobalErrors,captureResourceErrors:e.captureGlobalErrors,captureUnhandledRejections:e.captureUnhandledRejections,captureNavigation:e.captureNavigation,capturePerformance:e.capturePerformance,ignoreUrls:e.ignoredUrls,context:{legacyMonitor:!0,...t.appChannelId?{appChannelId:t.appChannelId}:{},...t.dataChannelId?{dataChannelId:t.dataChannelId}:{},...t.context??{}},getContext:()=>this.getDynamicContext(t),tags:t.tags,release:t.version,environment:t.environment,redact:t.redact,window:t.window,sampleRate:t.sampleRate,random:t.random,now:t.now});this.currentMonitor=n;for(const i of this.plugins)i.type==="recordScreen"&&this.notifyUnsupported("recordScreenPlugin",i.type),this.runPluginCore(i);return n}getDynamicContext(t){const e=I(t);return e===void 0?{}:{userId:e}}async handleMonitorEvent(t,e){const n=this.currentOptions;if(!n||!rt(t,n)||!this.shouldReportEvent(t,n))return;const i=et(t,n),s=await it(n.beforeDataReport,i);if(s){if(this.runPluginTransforms(s),n.transport){await n.transport(s,t,e);return}if(!n.dsn){this.warnMissingDsn();return}await e.fetch(n.dsn,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",...n.appChannelId?{"x-app_channel_id":n.appChannelId}:{},...n.dataChannelId?{"x-data_channel_id":n.dataChannelId}:{}},body:JSON.stringify(st(s,n))})}}shouldReportEvent(t,e){if(e.repeatCodeError!==!0||t.type!=="exception"&&t.type!=="unhandledrejection")return!0;const n=[t.type,t.data.name,t.data.message,t.data.filename??"",t.data.line??"",t.data.column??""].join("|");return this.reportedErrorKeys.has(n)?!1:(this.reportedErrorKeys.add(n),!0)}runPluginCore(t){const e=this.currentOptions;if(!(!e||typeof t.core!="function"))try{t.core(this.createPluginContext(e))}catch{}}createPluginContext(t){return{options:t,transportData:{send:this.log},breadcrumb:{push:this.log},notify:(e,n)=>this.log({type:e,...typeof n=="string"?{message:n}:n??{}})}}runPluginTransforms(t){for(const e of this.plugins)if(!(typeof e.transform!="function"||e.type&&e.type!==t.type&&e.type!=="*"))try{e.transform(t)}catch{}}reportUnsupportedOptions(t){var e;t.silentWhiteScreen===!0&&this.notifyUnsupported("silentWhiteScreen",t.silentWhiteScreen),t.whiteBoxElements!==void 0&&this.notifyUnsupported("whiteBoxElements",t.whiteBoxElements),t.skeletonProject===!0&&this.notifyUnsupported("skeletonProject",t.skeletonProject),t.silentRecordScreen===!0&&this.notifyUnsupported("silentRecordScreen",t.silentRecordScreen),t.recordScreentime!==void 0&&this.notifyUnsupported("recordScreentime",t.recordScreentime),(e=t.recordScreenTypeList)!=null&&e.length&&this.notifyUnsupported("recordScreenTypeList",t.recordScreenTypeList),t.useImgUpload===!0&&this.notifyUnsupported("useImgUpload",t.useImgUpload),t.silentClick===!0&&this.notifyUnsupported("silentClick",t.silentClick),t.throttleDelayTime!==void 0&&this.notifyUnsupported("throttleDelayTime",t.throttleDelayTime),t.maxBreadcrumbs!==void 0&&this.notifyUnsupported("maxBreadcrumbs",t.maxBreadcrumbs),typeof t.beforePushBreadcrumb=="function"&&this.notifyUnsupported("beforePushBreadcrumb",t.beforePushBreadcrumb),t.overTime!==void 0&&this.notifyUnsupported("overTime",t.overTime),typeof t.handleHttpStatus=="function"&&this.notifyUnsupported("handleHttpStatus",t.handleHttpStatus),t.defHttp!==void 0&&this.notifyUnsupported("defHttp",t.defHttp),t.router!==void 0&&this.notifyUnsupported("router",t.router)}notifyUnsupported(t,e){var i,s,a;const n={option:t,value:e,message:K[t]};try{(s=(i=this.currentOptions)==null?void 0:i.onUnsupportedOption)==null||s.call(i,n)}catch{}!((a=this.currentOptions)!=null&&a.onUnsupportedOption)&&$()}warnMissingDsn(){this.dsnWarningShown}}function at(r={}){return new ot(r)}const ct=at();l.default=ct,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(l,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(l=typeof globalThis<"u"?globalThis:l||self,d(l.WeaveUIMonitor={}))})(this,function(l){"use strict";var ut=Object.defineProperty;var ht=(l,d,m)=>d in l?ut(l,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[d]=m;var o=(l,d,m)=>ht(l,typeof d!="symbol"?d+"":d,m);const d="weave-ui",m={fetch:!1,xhr:!1,includeSuccessful:!1},O="[REDACTED]",v=()=>{};function C(r){return typeof r=="object"&&r!==null}function E(r){return typeof URL<"u"&&r instanceof URL}function y(r){if(typeof r=="string")return r;if(r===null)return"null";if(r===void 0)return"undefined";if(r instanceof Error)return r.message||r.name;try{const t=JSON.stringify(r);if(typeof t=="string")return t}catch{}try{return String(r)}catch{return"Unknown error"}}function S(r){return typeof r=="number"&&Number.isFinite(r)?r:void 0}function U(r){return(r==null?void 0:r.trim().toUpperCase())||"GET"}function F(){return typeof window>"u"?void 0:window}function g(r){var e;const t=(e=r.performance)==null?void 0:e.now;return typeof t=="function"?t.call(r.performance):Date.now()}function k(r,t){try{return new URL(r,t.location.href).href}catch{return r}}function W(r,t){return typeof r=="string"?k(r,t):E(r)?r.href:r.url}function H(r,t){return t!=null&&t.method?U(t.method):typeof r=="string"||E(r)?"GET":U(r.method)}function j(r,t){return typeof t=="string"?r.toLowerCase()===t.toLowerCase():(t.lastIndex=0,t.test(r))}function M(r,t){return(t==null?void 0:t.some(e=>j(r,e)))??!1}function z(r,t){if(!t.startsWith("/"))return r.includes(t);try{const e=new URL(r,`https://${d}.invalid`),n=`${e.pathname}${e.search}`;return t.includes("?")?n===t:e.pathname===t}catch{return r.includes(t)}}function R(r){return r.XMLHttpRequest}function D(r){if(!r||!C(r))return;const t=typeof r.tagName=="string"?r.tagName.toLowerCase():"",e=typeof r.currentSrc=="string"?r.currentSrc:typeof r.src=="string"?r.src:typeof r.href=="string"?r.href:"";return t&&e?{element:t,url:e}:void 0}function A(r){if(r instanceof Error)return{name:r.name||"Error",message:r.message||r.name||"Unknown error",...r.stack?{stack:r.stack}:{}};if(C(r)){const t=typeof r.name=="string"?r.name:"Error",e=typeof r.message=="string"?r.message:y(r),n=typeof r.stack=="string"?r.stack:void 0;return{name:t,message:e,...n?{stack:n}:{}}}return{name:"Error",message:y(r)}}function B(r={}){return new _(r)}class _{constructor(t){o(this,"active",!1);o(this,"destroyed",!1);o(this,"recorderActive",!1);o(this,"lastNavigationUrl","");o(this,"browserCleanups",[]);o(this,"vueCleanups",[]);o(this,"installedVueApps",new WeakSet);o(this,"start",()=>{if(this.destroyed||this.active)return!1;const t=this.getBrowserWindow();if(!t)return!1;this.active=!0,this.lastNavigationUrl=t.location.href;try{if((this.shouldCaptureGlobalErrors()||this.shouldCaptureResourceErrors())&&this.installErrorListener(t),this.shouldCaptureUnhandledRejections()&&this.installUnhandledRejectionListener(t),this.shouldCaptureNavigation()&&this.installNavigationListeners(t),this.shouldCapturePerformance()&&this.installPerformanceListener(t),this.requiresInstrumentationHub()){const e=L(t).subscribe(this);this.browserCleanups.push(e)}return this.startRecorder(),!0}catch{return this.active=!1,this.runBrowserCleanups(),this.stopRecorder(),!1}});o(this,"stop",()=>{this.active&&(this.active=!1,this.runBrowserCleanups(),this.stopRecorder())});o(this,"destroy",()=>{if(!this.destroyed){this.stop(),this.destroyed=!0;for(const t of this.vueCleanups.splice(0).reverse())this.runSafely(t)}});o(this,"captureException",(t,e)=>{this.captureExceptionFromSource(t,"manual",e)});o(this,"captureMessage",(t,e="info",n)=>{this.emit({type:"message",level:e,timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(n),tags:this.getTags(),data:{message:t}})});o(this,"createVuePlugin",(t={})=>({install:e=>{if(this.destroyed||this.installedVueApps.has(e))return;this.installedVueApps.add(e);const n=e.config.errorHandler,i=this,s=(a,c,h)=>{i.captureExceptionFromSource(a,"vue",{vue:{component:(c==null?void 0:c.$options.name)??(c==null?void 0:c.$options.__name)??"anonymous",info:h}}),n==null||n(a,c,h)};e.config.errorHandler=s,this.vueCleanups.push(()=>{e.config.errorHandler===s&&(e.config.errorHandler=n)}),t.startOnInstall===!0&&this.start()}}));o(this,"needsFetchInstrumentation",()=>this.active&&this.getRequestOptions().fetch);o(this,"needsXhrInstrumentation",()=>this.active&&this.getRequestOptions().xhr);o(this,"needsHistoryInstrumentation",()=>this.active&&this.shouldCaptureNavigation());o(this,"shouldMonitorRequest",(t,e)=>{const n=this.getRequestOptions(),i=t==="fetch"?n.fetch:n.xhr;return this.active&&i&&!this.isIgnoredUrl(e)});o(this,"handleInstrumentedRequest",t=>{if(!this.active||this.isIgnoredUrl(t.url))return;const e=this.getRequestOptions(),n=e.slowThreshold!==void 0&&t.duration>=e.slowThreshold;(e.includeSuccessful||!t.ok||n)&&this.emit({type:"request",level:t.ok?"info":"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:t})});o(this,"handleInstrumentedNavigation",t=>{!this.active||!this.shouldCaptureNavigation()||(this.lastNavigationUrl=t.to,this.emit({type:"navigation",level:"info",timestamp:this.getTimestamp(),url:t.to,context:this.getContext(),tags:this.getTags(),data:t}))});this.options=t}get started(){return this.active}getBrowserWindow(){return this.options.window??F()}createTransportContext(){return{fetch:(t,e)=>this.fetchForTransport(t,e),createXMLHttpRequest:()=>this.createXhrForTransport()}}fetchForTransport(t,e){const n=this.getBrowserWindow();return!n||typeof n.fetch!="function"?Promise.reject(new Error("Monitor transport fetch is unavailable outside a browser.")):L(n).fetchForTransport(t,e)}createXhrForTransport(){const t=this.getBrowserWindow();if(!t||!R(t))throw new Error("Monitor transport XMLHttpRequest is unavailable outside a browser.");return L(t).createXhrForTransport()}getTimestamp(){var t,e;try{const n=((e=(t=this.options).now)==null?void 0:e.call(t))??Date.now();return Number.isFinite(n)?n:Date.now()}catch{return Date.now()}}getCurrentUrl(){var e;const t=this.getBrowserWindow();return((e=t==null?void 0:t.location)==null?void 0:e.href)??""}getContext(t){var n,i;let e;try{e=(i=(n=this.options).getContext)==null?void 0:i.call(n)}catch{e=void 0}return{...this.options.context??{},...e??{},...t??{}}}getTags(){return{...this.options.tags??{},...this.options.release?{release:this.options.release}:{},...this.options.environment?{environment:this.options.environment}:{}}}getRequestOptions(){const t=this.options.captureRequests;if(!t)return m;if(t===!0)return{fetch:!0,xhr:!0,includeSuccessful:!1};const e=t.slowThreshold;return{fetch:t.fetch===!0,xhr:t.xhr===!0,includeSuccessful:t.includeSuccessful===!0,...typeof e=="number"&&Number.isFinite(e)&&e>=0?{slowThreshold:e}:{}}}shouldCaptureGlobalErrors(){return this.options.captureGlobalErrors!==!1}shouldCaptureResourceErrors(){return this.options.captureResourceErrors!==!1}shouldCaptureUnhandledRejections(){return this.options.captureUnhandledRejections!==!1}shouldCaptureNavigation(){return this.options.captureNavigation!==!1}shouldCapturePerformance(){return this.options.capturePerformance!==!1}requiresInstrumentationHub(){const t=this.getRequestOptions();return t.fetch||t.xhr||this.shouldCaptureNavigation()}isIgnoredUrl(t){var e;return((e=this.options.ignoreUrls)==null?void 0:e.some(n=>{try{return typeof n=="function"?n(t):typeof n=="string"?z(t,n):(n.lastIndex=0,n.test(t))}catch{return!1}}))??!1}installErrorListener(t){const e=n=>{if(!this.active)return;const i=D(n.target);if(i){this.shouldCaptureResourceErrors()&&this.emit({type:"resource",level:"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:i});return}if(!this.shouldCaptureGlobalErrors())return;const s=n,a={...typeof s.filename=="string"?{filename:s.filename}:{},...S(s.lineno)!==void 0?{line:S(s.lineno)}:{},...S(s.colno)!==void 0?{column:S(s.colno)}:{}},c=s.error??new Error(typeof s.message=="string"?s.message:"Unknown window error");this.captureExceptionFromSource(c,"window.error",void 0,a)};t.addEventListener("error",e,!0),this.browserCleanups.push(()=>{t.removeEventListener("error",e,!0)})}installUnhandledRejectionListener(t){const e=n=>{this.active&&this.captureExceptionFromSource(n.reason,"unhandledrejection")};t.addEventListener("unhandledrejection",e),this.browserCleanups.push(()=>{t.removeEventListener("unhandledrejection",e)})}installNavigationListeners(t){const e=()=>{const i=t.location.href;this.handleInstrumentedNavigation({source:"popstate",from:this.lastNavigationUrl,to:i,duration:0})},n=i=>{this.handleInstrumentedNavigation({source:"hashchange",from:i.oldURL,to:i.newURL,duration:0})};t.addEventListener("popstate",e),t.addEventListener("hashchange",n),this.browserCleanups.push(()=>{t.removeEventListener("popstate",e),t.removeEventListener("hashchange",n)})}installPerformanceListener(t){const e=()=>{if(!this.active)return;const n=G(t);n&&this.emit({type:"performance",level:"info",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(),tags:this.getTags(),data:n})};if(t.document.readyState==="complete"){e();return}t.addEventListener("load",e,{once:!0}),this.browserCleanups.push(()=>{t.removeEventListener("load",e)})}captureExceptionFromSource(t,e,n,i={}){const s={...A(t),source:e,...i};this.emit({type:e==="unhandledrejection"?"unhandledrejection":"exception",level:"error",timestamp:this.getTimestamp(),url:this.getCurrentUrl(),context:this.getContext(n),tags:this.getTags(),data:s})}emit(t){var i;if(this.destroyed||!this.isSampled())return;const e=this.sanitizeEvent(t);if(!e)return;const n=this.createTransportContext();this.options.transport&&this.runSafely(()=>{var s,a;return(a=(s=this.options).transport)==null?void 0:a.call(s,e,n)}),this.active&&((i=this.options.recorder)!=null&&i.capture)&&this.runSafely(()=>{var s,a;return(a=(s=this.options.recorder)==null?void 0:s.capture)==null?void 0:a.call(s,e,n)})}isSampled(){var n,i;const t=this.options.sampleRate,e=typeof t=="number"&&Number.isFinite(t)?Math.min(Math.max(t,0),1):1;if(e===0)return!1;if(e===1)return!0;try{return(((i=(n=this.options).random)==null?void 0:i.call(n))??Math.random())<e}catch{return!0}}sanitizeEvent(t){let e;switch(t.type){case"exception":case"unhandledrejection":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,name:this.redactText(t.data.name,"name"),message:this.redactText(t.data.message,"message"),...t.data.stack?{stack:this.redactText(t.data.stack,"stack")}:{},...t.data.filename?{filename:this.redactUrl(t.data.filename)}:{}}};break;case"message":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{message:this.redactText(t.data.message,"message")}};break;case"resource":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{element:this.redactText(t.data.element,"element"),url:this.redactUrl(t.data.url)}};break;case"navigation":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,from:this.redactUrl(t.data.from),to:this.redactUrl(t.data.to)}};break;case"performance":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data}};break;case"request":e={...t,url:this.redactUrl(t.url),context:this.sanitizeContext(t.context),tags:this.sanitizeTags(t.tags),data:{...t.data,method:this.redactText(t.data.method,"method"),url:this.redactUrl(t.data.url),...t.data.error?{error:this.redactText(t.data.error,"error")}:{}}};break}try{return this.options.sanitize?this.options.sanitize(e):e}catch{return null}}sanitizeContext(t){const e=new WeakSet,n=this.sanitizeUnknown(t,"",e);return C(n)?n:{}}sanitizeUnknown(t,e,n){if(e&&this.shouldRedactKey(e))return this.getRedactionReplacement();if(t==null)return t;switch(typeof t){case"string":return this.redactText(t,e);case"number":case"boolean":return t;case"bigint":return t.toString();case"symbol":return t.toString();case"function":return`[Function ${t.name||"anonymous"}]`}if(t instanceof Error)return{name:this.redactText(t.name||"Error","name"),message:this.redactText(t.message||t.name||"Unknown error","message"),...t.stack?{stack:this.redactText(t.stack,"stack")}:{}};if(t instanceof Date)return Number.isNaN(t.getTime())?"Invalid Date":t.toISOString();if(E(t))return this.redactUrl(t.href);if(!C(t))return y(t);if(n.has(t))return"[Circular]";if(n.add(t),Array.isArray(t))return t.map(s=>this.sanitizeUnknown(s,"",n));const i={};try{for(const[s,a]of Object.entries(t))i[s]=this.sanitizeUnknown(a,s,n)}catch{return"[Unserializable object]"}return i}sanitizeTags(t){const e={};for(const[n,i]of Object.entries(t))typeof i=="string"?e[n]=this.redactText(i,n):e[n]=i;return e}shouldRedactKey(t){var e;return M(t,(e=this.options.redact)==null?void 0:e.keys)}getRedactionReplacement(){var t;return((t=this.options.redact)==null?void 0:t.replacement)??O}redactText(t,e){return e&&this.shouldRedactKey(e)?this.getRedactionReplacement():t}redactUrl(t){var e,n;if(this.shouldRedactKey("url"))return this.getRedactionReplacement();if(!((n=(e=this.options.redact)==null?void 0:e.queryParams)!=null&&n.length))return t;try{const i=/^[a-z][a-z\d+.-]*:/i.test(t),s=new URL(t,`https://${d}.invalid`);for(const a of Array.from(s.searchParams.keys()))M(a,this.options.redact.queryParams)&&s.searchParams.set(a,this.getRedactionReplacement());return i?s.toString():`${s.pathname}${s.search}${s.hash}`}catch{return t}}startRecorder(){var t;!((t=this.options.recorder)!=null&&t.start)||this.recorderActive||(this.recorderActive=!0,this.runSafely(()=>{var e,n;return(n=(e=this.options.recorder)==null?void 0:e.start)==null?void 0:n.call(e,this.createTransportContext())}))}stopRecorder(){var t;!((t=this.options.recorder)!=null&&t.stop)||!this.recorderActive||(this.recorderActive=!1,this.runSafely(()=>{var e,n;return(n=(e=this.options.recorder)==null?void 0:e.stop)==null?void 0:n.call(e,this.createTransportContext())}))}runBrowserCleanups(){for(const t of this.browserCleanups.splice(0).reverse())this.runSafely(t)}runSafely(t){try{const e=t();Promise.resolve(e).catch(v)}catch{}}}class X{constructor(t){o(this,"monitors",new Set);o(this,"xhrMetadata",new WeakMap);o(this,"transportXhrs",new WeakSet);o(this,"xhrListeners",new Map);o(this,"nativeFetch");o(this,"fetchCleanup");o(this,"xhrCleanup");o(this,"historyCleanup");this.browserWindow=t}subscribe(t){return this.monitors.add(t),this.sync(),()=>{this.monitors.delete(t),this.sync(),this.monitors.size===0&&T.delete(this.browserWindow)}}fetchForTransport(t,e){return(this.nativeFetch??this.browserWindow.fetch).call(this.browserWindow,t,e)}createXhrForTransport(){const t=R(this.browserWindow);if(!t)throw new Error("Monitor transport XMLHttpRequest is unavailable outside a browser.");const e=new t;return this.transportXhrs.add(e),e}sync(){this.someMonitor(t=>t.needsFetchInstrumentation())?this.installFetchPatch():this.removeFetchPatch(),this.someMonitor(t=>t.needsXhrInstrumentation())?this.installXhrPatch():this.removeXhrPatch(),this.someMonitor(t=>t.needsHistoryInstrumentation())?this.installHistoryPatch():this.removeHistoryPatch()}someMonitor(t){for(const e of this.monitors)if(t(e))return!0;return!1}getRequestMonitors(t,e){return Array.from(this.monitors).filter(n=>n.shouldMonitorRequest(t,e))}installFetchPatch(){if(this.fetchCleanup||typeof this.browserWindow.fetch!="function")return;const t=this.browserWindow.fetch;this.nativeFetch=t;const e=this,n=function(i,s){return e.performFetch(i,s)};this.browserWindow.fetch=n,this.fetchCleanup=()=>{this.browserWindow.fetch===n&&(this.browserWindow.fetch=t),this.nativeFetch===t&&(this.nativeFetch=void 0)}}performFetch(t,e){const n=this.nativeFetch??this.browserWindow.fetch,i=W(t,this.browserWindow),s=this.getRequestMonitors("fetch",i);if(s.length===0)return n.call(this.browserWindow,t,e);const a=H(t,e),c=g(this.browserWindow);try{return n.call(this.browserWindow,t,e).then(u=>{const p=g(this.browserWindow)-c;return this.notifyRequest(s,{kind:"fetch",method:a,url:u.url||i,status:u.status,duration:p,ok:u.ok}),u},u=>{const p=g(this.browserWindow)-c;throw this.notifyRequest(s,{kind:"fetch",method:a,url:i,duration:p,ok:!1,error:y(u)}),u})}catch(h){const u=g(this.browserWindow)-c;throw this.notifyRequest(s,{kind:"fetch",method:a,url:i,duration:u,ok:!1,error:y(h)}),h}}removeFetchPatch(){var t;(t=this.fetchCleanup)==null||t.call(this),this.fetchCleanup=void 0}installXhrPatch(){if(this.xhrCleanup)return;const t=R(this.browserWindow);if(!t)return;const e=t.prototype,n=e.open,i=e.send,s=this,a=function(h,u,p,w,f){s.xhrMetadata.set(this,{method:U(h),url:k(String(u),s.browserWindow)}),n.call(this,h,u,p??!0,w,f)},c=function(h){const u=s.xhrMetadata.get(this),p=u&&!s.transportXhrs.has(this)?s.getRequestMonitors("xhr",u.url):[];if(!u||p.length===0){h===void 0?i.call(this):i.call(this,h);return}const w=s.xhrListeners.get(this);w&&(this.removeEventListener("loadend",w),s.xhrListeners.delete(this));const f={...u,startedAt:g(s.browserWindow),monitors:p},b=()=>{this.removeEventListener("loadend",b),s.xhrListeners.delete(this),s.notifyRequest(f.monitors,{kind:"xhr",method:f.method,url:this.responseURL||f.url,status:this.status,duration:g(s.browserWindow)-f.startedAt,ok:this.status>=200&&this.status<400,...this.status===0?{error:"Network request failed"}:{}})};this.addEventListener("loadend",b),s.xhrListeners.set(this,b);try{h===void 0?i.call(this):i.call(this,h)}catch(x){throw this.removeEventListener("loadend",b),s.xhrListeners.delete(this),s.notifyRequest(f.monitors,{kind:"xhr",method:f.method,url:f.url,duration:g(s.browserWindow)-f.startedAt,ok:!1,error:y(x)}),x}};e.open=a,e.send=c,this.xhrCleanup=()=>{e.open===a&&(e.open=n),e.send===c&&(e.send=i);for(const[h,u]of this.xhrListeners)h.removeEventListener("loadend",u);this.xhrListeners.clear()}}removeXhrPatch(){var t;(t=this.xhrCleanup)==null||t.call(this),this.xhrCleanup=void 0}installHistoryPatch(){if(this.historyCleanup)return;const t=this.browserWindow.history,e=t.pushState,n=t.replaceState,i=this,s=(h,u)=>function(p,w,f){const b=i.browserWindow.location.href,x=g(i.browserWindow);h.call(this,p,w,f),i.notifyNavigation({source:"history",method:u,from:b,to:i.browserWindow.location.href,duration:g(i.browserWindow)-x})},a=s(e,"pushState"),c=s(n,"replaceState");t.pushState=a,t.replaceState=c,this.historyCleanup=()=>{t.pushState===a&&(t.pushState=e),t.replaceState===c&&(t.replaceState=n)}}removeHistoryPatch(){var t;(t=this.historyCleanup)==null||t.call(this),this.historyCleanup=void 0}notifyRequest(t,e){for(const n of t)n.handleInstrumentedRequest(e)}notifyNavigation(t){for(const e of this.monitors)e.handleInstrumentedNavigation(t)}}const T=new WeakMap;function L(r){let t=T.get(r);return t||(t=new X(r),T.set(r,t)),t}function G(r){const t=r.performance;if(!(t!=null&&t.getEntriesByType))return;const e=t.getEntriesByType("navigation").find(n=>"domContentLoadedEventEnd"in n&&"loadEventEnd"in n);if(e)return{navigationType:e.type,duration:e.duration,redirect:e.redirectEnd-e.redirectStart,dns:e.domainLookupEnd-e.domainLookupStart,connection:e.connectEnd-e.connectStart,request:e.responseStart-e.requestStart,response:e.responseEnd-e.responseStart,domInteractive:e.domInteractive,domContentLoaded:e.domContentLoadedEventEnd-e.startTime,load:e.loadEventEnd-e.startTime}}const P="__easyOilLegacyMonitorLog",N="easyOilLegacyMonitorSessionId",K={silentWhiteScreen:"Legacy white-screen detection is not included. Use a project-owned detector and report through transport instead.",whiteBoxElements:"Legacy white-screen container configuration is not supported because white-screen detection is not included.",skeletonProject:"Legacy skeleton-screen detection is not supported because white-screen detection is not included.",silentRecordScreen:"Legacy rrweb screen recording is not bundled. Keep the project-owned recording implementation when this capability is required.",recordScreentime:"Legacy rrweb recording duration is not supported because screen recording is not included.",recordScreenTypeList:"Legacy rrweb recording trigger types are not supported because screen recording is not included.",useImgUpload:"Legacy image-beacon reporting is not supported. The compatibility transport uses the monitor transport context instead.",silentClick:"Legacy click breadcrumb collection is not supported by this compatibility layer.",throttleDelayTime:"Legacy click throttling is not supported because click breadcrumb collection is not included.",maxBreadcrumbs:"Legacy breadcrumb buffering is not supported by this compatibility layer.",beforePushBreadcrumb:"Legacy breadcrumb hooks are not supported because breadcrumb collection is not included.",overTime:"Legacy request timeout handling is not supported. Configure timeouts in the application HTTP client.",handleHttpStatus:"Legacy response-body status inspection is not supported by this compatibility layer.",defHttp:"Legacy defHttp interception is not supported. Enable browser request capture with silentXhr or silentFetch instead.",router:"Legacy router-instance instrumentation is not supported. Enable history or hash capture with the corresponding legacy flags instead.",recordScreenPlugin:"Legacy RecordScreen plugins require rrweb and are not supported by this compatibility layer."};function q(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function $(){return!1}function V(r){if(typeof r=="string")return r;if(r instanceof Error)return r.message||r.name||"Unknown error";try{const t=JSON.stringify(r);if(typeof t=="string")return t}catch{}try{return String(r)}catch{return"Unknown message"}}function I(r){if(typeof r.getUserId=="function")try{const t=r.getUserId();if(typeof t=="string"||typeof t=="number")return t}catch{return typeof r.userId=="string"||typeof r.userId=="number"?r.userId:void 0}return typeof r.userId=="string"||typeof r.userId=="number"?r.userId:void 0}function J(){if(typeof sessionStorage>"u")return"";try{const r=sessionStorage.getItem(N);if(r)return r;const t=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return sessionStorage.setItem(N,t),t}catch{return""}}function Y(r){switch(r.type){case"exception":return"error";case"navigation":return r.data.source==="hashchange"?"hashchange":"history";case"request":return r.data.kind;default:return r.type}}function Q(r){switch(r.type){case"exception":case"unhandledrejection":case"resource":return"client_debug";default:return"user_behavior"}}function Z(r){switch(r.type){case"exception":case"unhandledrejection":return{message:r.data.message,name:r.data.name,...r.data.stack?{stack:r.data.stack}:{},...r.data.filename?{fileName:r.data.filename}:{},...r.data.line!==void 0?{line:r.data.line}:{},...r.data.column!==void 0?{column:r.data.column}:{}};case"request":return{method:r.data.method,url:r.data.url,Status:r.data.status,status:r.data.ok?"ok":"error",elapsedTime:r.data.duration,...r.data.error?{message:r.data.error}:{}};case"navigation":return{from:r.data.from,to:r.data.to,duration:r.data.duration,source:r.data.source};case"performance":return{...r.data};case"resource":return{name:r.data.element,message:r.data.url};case"message":return{message:r.data.message}}}function tt(r){if(r.type!=="message")return;const t=r.context[P];return q(t)?t:void 0}function et(r,t){const e=I(t),n={moduleId:Q(r),type:Y(r),status:r.level==="error"||r.level==="fatal"?"error":"ok",time:r.timestamp,pageUrl:r.url,...t.appChannelId?{appChannelId:t.appChannelId}:{},...t.dataChannelId?{dataChannelId:t.dataChannelId}:{},...t.version?{version:t.version}:{},...e!==void 0?{userId:e}:{},message:r.type==="message"?r.data.message:void 0,data:Z(r)},i=tt(r);if(!i)return n;const s=i.type,a=i.moduleId,c=i.data;return{...n,...i,type:typeof s=="string"?s:n.type,moduleId:typeof a=="string"?a:n.moduleId,data:q(c)?c:{...n.data,...i}}}function rt(r,t){return r.type!=="navigation"?!0:r.data.source==="hashchange"?t.silentHashchange===!0:t.silentHistory===!0}function nt(r){const t=[];return r.dsn&&t.push(r.dsn),r.filterXhrUrlRegExp&&t.push(r.filterXhrUrlRegExp),{captureRequests:{xhr:r.silentXhr===!0,fetch:r.silentFetch===!0},captureGlobalErrors:r.silentError===!0,captureUnhandledRejections:r.silentUnhandledrejection===!0,captureNavigation:r.silentHistory===!0||r.silentHashchange===!0,capturePerformance:r.silentPerformance===!0,ignoredUrls:t}}function st(r,t){const e=I(t),n={...r,data:r.data??{}},i={moduleId:r.moduleId??"user_behavior",type:r.type,message:r.message,identityID:e??"",userIdentity:e??"",sessionId:J(),extraContent:JSON.stringify(n)};return{content:[JSON.stringify(i)]}}async function it(r,t){if(!r)return t;try{const e=await r(t);return e===!1?void 0:e??t}catch{return}}class ot{constructor(t={}){o(this,"currentMonitor");o(this,"currentOptions");o(this,"currentMapping");o(this,"plugins",new Set);o(this,"reportedErrorKeys",new Set);o(this,"dsnWarningShown",!1);o(this,"init",(t=this.defaultOptions)=>{const e=this.configure(t);return e==null||e.start(),this});o(this,"install",(t,e=this.defaultOptions)=>{const n=this.configure(e);n&&(t.use(n.createVuePlugin()),n.start())});o(this,"log",t=>{const e=this.currentMonitor;if(!e)return!1;if(typeof t=="string")return e.captureMessage(t),!0;const n=V(t.message??t);return e.captureMessage(n,"info",{[P]:t}),!0});o(this,"errorBoundary",t=>{const e=this.currentMonitor;return e?(e.captureException(t,{framework:"react"}),!0):!1});o(this,"use",(t,e)=>{let n;try{n=new t(e)}catch{return}return this.plugins.add(n),n.type==="recordScreen"&&this.notifyUnsupported("recordScreenPlugin",n.type),this.runPluginCore(n),n});o(this,"stop",()=>{var t;(t=this.currentMonitor)==null||t.stop()});o(this,"destroy",()=>{var t;(t=this.currentMonitor)==null||t.destroy(),this.currentMonitor=void 0,this.currentMapping=void 0,this.reportedErrorKeys.clear()});this.defaultOptions=t}get monitor(){return this.currentMonitor}get started(){var t;return((t=this.currentMonitor)==null?void 0:t.started)??!1}get options(){return this.currentOptions}configure(t){if(this.destroy(),this.currentOptions={...t},this.dsnWarningShown=!1,this.reportUnsupportedOptions(t),t.disabled===!0)return;const e=nt(t);this.currentMapping=e;const n=B({transport:(i,s)=>this.handleMonitorEvent(i,s),captureRequests:{xhr:e.captureRequests.xhr,fetch:e.captureRequests.fetch,includeSuccessful:!0},captureGlobalErrors:e.captureGlobalErrors,captureResourceErrors:e.captureGlobalErrors,captureUnhandledRejections:e.captureUnhandledRejections,captureNavigation:e.captureNavigation,capturePerformance:e.capturePerformance,ignoreUrls:e.ignoredUrls,context:{legacyMonitor:!0,...t.appChannelId?{appChannelId:t.appChannelId}:{},...t.dataChannelId?{dataChannelId:t.dataChannelId}:{},...t.context??{}},getContext:()=>this.getDynamicContext(t),tags:t.tags,release:t.version,environment:t.environment,redact:t.redact,window:t.window,sampleRate:t.sampleRate,random:t.random,now:t.now});this.currentMonitor=n;for(const i of this.plugins)i.type==="recordScreen"&&this.notifyUnsupported("recordScreenPlugin",i.type),this.runPluginCore(i);return n}getDynamicContext(t){const e=I(t);return e===void 0?{}:{userId:e}}async handleMonitorEvent(t,e){const n=this.currentOptions;if(!n||!rt(t,n)||!this.shouldReportEvent(t,n))return;const i=et(t,n),s=await it(n.beforeDataReport,i);if(s){if(this.runPluginTransforms(s),n.transport){await n.transport(s,t,e);return}if(!n.dsn){this.warnMissingDsn();return}await e.fetch(n.dsn,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",...n.appChannelId?{"x-app_channel_id":n.appChannelId}:{},...n.dataChannelId?{"x-data_channel_id":n.dataChannelId}:{}},body:JSON.stringify(st(s,n))})}}shouldReportEvent(t,e){if(e.repeatCodeError!==!0||t.type!=="exception"&&t.type!=="unhandledrejection")return!0;const n=[t.type,t.data.name,t.data.message,t.data.filename??"",t.data.line??"",t.data.column??""].join("|");return this.reportedErrorKeys.has(n)?!1:(this.reportedErrorKeys.add(n),!0)}runPluginCore(t){const e=this.currentOptions;if(!(!e||typeof t.core!="function"))try{t.core(this.createPluginContext(e))}catch{}}createPluginContext(t){return{options:t,transportData:{send:this.log},breadcrumb:{push:this.log},notify:(e,n)=>this.log({type:e,...typeof n=="string"?{message:n}:n??{}})}}runPluginTransforms(t){for(const e of this.plugins)if(!(typeof e.transform!="function"||e.type&&e.type!==t.type&&e.type!=="*"))try{e.transform(t)}catch{}}reportUnsupportedOptions(t){var e;t.silentWhiteScreen===!0&&this.notifyUnsupported("silentWhiteScreen",t.silentWhiteScreen),t.whiteBoxElements!==void 0&&this.notifyUnsupported("whiteBoxElements",t.whiteBoxElements),t.skeletonProject===!0&&this.notifyUnsupported("skeletonProject",t.skeletonProject),t.silentRecordScreen===!0&&this.notifyUnsupported("silentRecordScreen",t.silentRecordScreen),t.recordScreentime!==void 0&&this.notifyUnsupported("recordScreentime",t.recordScreentime),(e=t.recordScreenTypeList)!=null&&e.length&&this.notifyUnsupported("recordScreenTypeList",t.recordScreenTypeList),t.useImgUpload===!0&&this.notifyUnsupported("useImgUpload",t.useImgUpload),t.silentClick===!0&&this.notifyUnsupported("silentClick",t.silentClick),t.throttleDelayTime!==void 0&&this.notifyUnsupported("throttleDelayTime",t.throttleDelayTime),t.maxBreadcrumbs!==void 0&&this.notifyUnsupported("maxBreadcrumbs",t.maxBreadcrumbs),typeof t.beforePushBreadcrumb=="function"&&this.notifyUnsupported("beforePushBreadcrumb",t.beforePushBreadcrumb),t.overTime!==void 0&&this.notifyUnsupported("overTime",t.overTime),typeof t.handleHttpStatus=="function"&&this.notifyUnsupported("handleHttpStatus",t.handleHttpStatus),t.defHttp!==void 0&&this.notifyUnsupported("defHttp",t.defHttp),t.router!==void 0&&this.notifyUnsupported("router",t.router)}notifyUnsupported(t,e){var i,s,a;const n={option:t,value:e,message:K[t]};try{(s=(i=this.currentOptions)==null?void 0:i.onUnsupportedOption)==null||s.call(i,n)}catch{}!((a=this.currentOptions)!=null&&a.onUnsupportedOption)&&$()}warnMissingDsn(){this.dsnWarningShown}}function at(r={}){return new ot(r)}const ct=at();l.default=ct,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|