@volverjs/ui-vue 0.0.10 → 0.0.12
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/bin/icons.js +1 -93
- package/dist/components/VvAccordion/VvAccordion.es.js +1 -366
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +2 -702
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +3 -2
- package/dist/components/VvAction/VvAction.es.js +1 -302
- package/dist/components/VvAction/VvAction.vue.d.ts +2 -1
- package/dist/components/VvAlert/VvAlert.es.js +1 -527
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +2 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +1 -730
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +2 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -132
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +2 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +1 -250
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +2 -1
- package/dist/components/VvBadge/VvBadge.es.js +1 -131
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +1 -410
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -1
- package/dist/components/VvButton/VvButton.es.js +1 -882
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +2 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -214
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -1
- package/dist/components/VvCard/VvCard.es.js +1 -152
- package/dist/components/VvCard/VvCard.vue.d.ts +2 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +1 -741
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +3 -2
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +1 -981
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +1 -3463
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +263 -317
- package/dist/components/VvDialog/VvDialog.es.js +1 -317
- package/dist/components/VvDialog/VvDialog.vue.d.ts +2 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +1 -750
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -1
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +5 -4
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +2 -1
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +10 -2
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +1 -448
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +1 -149
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +1 -104
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -281
- package/dist/components/VvIcon/VvIcon.es.js +1 -143
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +2 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +1 -1704
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +2 -1
- package/dist/components/VvInputText/VvInputText.es.js +4 -2790
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +2 -1
- package/dist/components/VvNav/VvNav.es.js +1 -438
- package/dist/components/VvNav/VvNav.vue.d.ts +2 -1
- package/dist/components/VvNav/VvNavItem.vue.d.ts +2 -1
- package/dist/components/VvNav/VvNavSeparator.vue.d.ts +2 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +1 -337
- package/dist/components/VvNavSeparator/VvNavSeparator.es.js +1 -24
- package/dist/components/VvProgress/VvProgress.es.js +1 -163
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -1
- package/dist/components/VvRadio/VvRadio.es.js +1 -661
- package/dist/components/VvRadio/VvRadio.vue.d.ts +3 -2
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +1 -901
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -1
- package/dist/components/VvSelect/VvSelect.es.js +1 -1103
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +130 -71
- package/dist/components/VvTab/VvTab.es.js +1 -558
- package/dist/components/VvTab/VvTab.vue.d.ts +2 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +2 -1989
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +2 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +1 -154
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +2 -1
- package/dist/components/index.es.js +6 -8558
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/index.es.js +2 -247
- package/dist/composables/index.umd.js +1 -1
- package/dist/directives/index.es.js +2 -311
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +2 -142
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +1 -172
- package/dist/icons.es.js +1 -39
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +1 -219
- package/dist/resolvers/unplugin.es.js +1 -187
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +14 -14
- package/package.json +37 -37
|
@@ -1,311 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import "pica";
|
|
4
|
-
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
5
|
-
StorageType2["local"] = "local";
|
|
6
|
-
StorageType2["session"] = "session";
|
|
7
|
-
return StorageType2;
|
|
8
|
-
})(StorageType || {});
|
|
9
|
-
var Side = /* @__PURE__ */ ((Side2) => {
|
|
10
|
-
Side2["left"] = "left";
|
|
11
|
-
Side2["right"] = "right";
|
|
12
|
-
Side2["top"] = "top";
|
|
13
|
-
Side2["bottom"] = "bottom";
|
|
14
|
-
return Side2;
|
|
15
|
-
})(Side || {});
|
|
16
|
-
var Position = /* @__PURE__ */ ((Position2) => {
|
|
17
|
-
Position2["before"] = "before";
|
|
18
|
-
Position2["after"] = "after";
|
|
19
|
-
return Position2;
|
|
20
|
-
})(Position || {});
|
|
21
|
-
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
22
|
-
ButtonType2["button"] = "button";
|
|
23
|
-
ButtonType2["submit"] = "submit";
|
|
24
|
-
ButtonType2["reset"] = "reset";
|
|
25
|
-
return ButtonType2;
|
|
26
|
-
})(ButtonType || {});
|
|
27
|
-
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
28
|
-
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
29
|
-
ActionTag2["routerLink"] = "router-link";
|
|
30
|
-
ActionTag2["a"] = "a";
|
|
31
|
-
ActionTag2["button"] = "button";
|
|
32
|
-
return ActionTag2;
|
|
33
|
-
})(ActionTag || {});
|
|
34
|
-
const DEFAULT_ALERT_GROUP = "default";
|
|
35
|
-
reactive(
|
|
36
|
-
/* @__PURE__ */ new Map([
|
|
37
|
-
[DEFAULT_ALERT_GROUP, /* @__PURE__ */ new Map()]
|
|
38
|
-
])
|
|
39
|
-
);
|
|
40
|
-
function useDropdownContextmenu(dropdownEl, targetEl) {
|
|
41
|
-
const { x, y, getBoundingClientRect, onScroll } = useDropdownVirtualElement(dropdownEl);
|
|
42
|
-
const onContextmenu = (event) => {
|
|
43
|
-
x.value = event.clientX;
|
|
44
|
-
y.value = event.clientY;
|
|
45
|
-
event.preventDefault();
|
|
46
|
-
dropdownEl.value.show();
|
|
47
|
-
};
|
|
48
|
-
const target = computed(() => unref(targetEl));
|
|
49
|
-
if (target && getCurrentInstance()) {
|
|
50
|
-
onMounted(() => {
|
|
51
|
-
target.value?.addEventListener("contextmenu", onContextmenu, false);
|
|
52
|
-
});
|
|
53
|
-
onUnmounted(() => {
|
|
54
|
-
target.value?.removeEventListener("contextmenu", onContextmenu);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return { x, y, getBoundingClientRect, onContextmenu, onScroll };
|
|
58
|
-
}
|
|
59
|
-
function findScrollContainer(element) {
|
|
60
|
-
if (!element) {
|
|
61
|
-
return void 0;
|
|
62
|
-
}
|
|
63
|
-
let parent = element.parentElement;
|
|
64
|
-
while (parent) {
|
|
65
|
-
const { overflow } = window.getComputedStyle(parent);
|
|
66
|
-
if (overflow.split(" ").every((item) => item === "auto" || item === "scroll")) {
|
|
67
|
-
return parent;
|
|
68
|
-
}
|
|
69
|
-
parent = parent.parentElement;
|
|
70
|
-
}
|
|
71
|
-
return document.documentElement;
|
|
72
|
-
}
|
|
73
|
-
function useDropdownVirtualElement(dropdownEl) {
|
|
74
|
-
const x = ref(0);
|
|
75
|
-
const y = ref(0);
|
|
76
|
-
const scrollContainerEl = ref();
|
|
77
|
-
let scrollXDelta = 0;
|
|
78
|
-
let scrollYDelta = 0;
|
|
79
|
-
let lastScrollTop = 0;
|
|
80
|
-
let lastScrollLeft = 0;
|
|
81
|
-
const onScroll = (event) => {
|
|
82
|
-
const scrollEl = event.target;
|
|
83
|
-
scrollXDelta = scrollEl.scrollLeft - lastScrollLeft;
|
|
84
|
-
scrollYDelta = scrollEl.scrollTop - lastScrollTop;
|
|
85
|
-
y.value = y.value - scrollYDelta;
|
|
86
|
-
x.value = x.value - scrollXDelta;
|
|
87
|
-
lastScrollLeft = scrollEl.scrollLeft;
|
|
88
|
-
lastScrollTop = scrollEl.scrollTop;
|
|
89
|
-
};
|
|
90
|
-
const getBoundingClientRect = () => ({
|
|
91
|
-
width: 0,
|
|
92
|
-
height: 0,
|
|
93
|
-
x: x.value,
|
|
94
|
-
y: y.value,
|
|
95
|
-
top: y.value,
|
|
96
|
-
left: x.value,
|
|
97
|
-
right: x.value,
|
|
98
|
-
bottom: y.value
|
|
99
|
-
});
|
|
100
|
-
if (getCurrentInstance()) {
|
|
101
|
-
onMounted(() => {
|
|
102
|
-
if (dropdownEl.value) {
|
|
103
|
-
dropdownEl.value.init({
|
|
104
|
-
getBoundingClientRect
|
|
105
|
-
});
|
|
106
|
-
scrollContainerEl.value = findScrollContainer(dropdownEl.value.$el);
|
|
107
|
-
if (scrollContainerEl.value) {
|
|
108
|
-
scrollContainerEl.value.addEventListener("scroll", onScroll);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
onUnmounted(() => {
|
|
113
|
-
if (scrollContainerEl.value) {
|
|
114
|
-
scrollContainerEl.value.removeEventListener("scroll", onScroll);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
return { x, y, getBoundingClientRect, onScroll };
|
|
119
|
-
}
|
|
120
|
-
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n';
|
|
121
|
-
const blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
122
|
-
function WorkerWrapper(options) {
|
|
123
|
-
let objURL;
|
|
124
|
-
try {
|
|
125
|
-
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
126
|
-
if (!objURL) throw "";
|
|
127
|
-
const worker = new Worker(objURL, {
|
|
128
|
-
name: options?.name
|
|
129
|
-
});
|
|
130
|
-
worker.addEventListener("error", () => {
|
|
131
|
-
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
132
|
-
});
|
|
133
|
-
return worker;
|
|
134
|
-
} catch (e) {
|
|
135
|
-
return new Worker(
|
|
136
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
137
|
-
{
|
|
138
|
-
name: options?.name
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
wrap(new WorkerWrapper());
|
|
144
|
-
const contextmenu = {
|
|
145
|
-
beforeUpdate(el, binding) {
|
|
146
|
-
const { onContextmenu, onScroll, getBoundingClientRect } = useDropdownContextmenu(binding);
|
|
147
|
-
binding.value.init({
|
|
148
|
-
getBoundingClientRect
|
|
149
|
-
});
|
|
150
|
-
el.addEventListener(
|
|
151
|
-
"contextmenu",
|
|
152
|
-
onContextmenu,
|
|
153
|
-
false
|
|
154
|
-
);
|
|
155
|
-
const scrollContainerEl = findScrollContainer(binding.value.$el);
|
|
156
|
-
if (scrollContainerEl) {
|
|
157
|
-
scrollContainerEl.addEventListener("scroll", onScroll);
|
|
158
|
-
}
|
|
159
|
-
el.additionalData = { onContextmenu, onScroll, scrollContainerEl };
|
|
160
|
-
},
|
|
161
|
-
beforeUnmount(el) {
|
|
162
|
-
if (el?.additionalData?.onContextmenu) {
|
|
163
|
-
el.removeEventListener("contextmenu", el.additionalData.onContextmenu);
|
|
164
|
-
}
|
|
165
|
-
if (el?.additionalData?.onScroll && el?.additionalData?.scrollContainerEl) {
|
|
166
|
-
el.additionalData.scrollContainerEl.removeEventListener("scroll", el.additionalData.onScroll);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const ModifiersProps = {
|
|
171
|
-
/**
|
|
172
|
-
* Component BEM modifiers
|
|
173
|
-
*/
|
|
174
|
-
modifiers: {
|
|
175
|
-
type: [String, Array],
|
|
176
|
-
default: void 0
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
({
|
|
180
|
-
/**
|
|
181
|
-
* VvIcon position
|
|
182
|
-
*/
|
|
183
|
-
iconPosition: {
|
|
184
|
-
default: Position.before
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
({
|
|
188
|
-
/**
|
|
189
|
-
* Dropdown placement
|
|
190
|
-
*/
|
|
191
|
-
placement: {
|
|
192
|
-
default: Side.bottom
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
({
|
|
196
|
-
/**
|
|
197
|
-
* Button type
|
|
198
|
-
*/
|
|
199
|
-
type: {
|
|
200
|
-
default: ButtonType.button
|
|
201
|
-
},
|
|
202
|
-
/**
|
|
203
|
-
* Default tag for the action
|
|
204
|
-
*/
|
|
205
|
-
defaultTag: {
|
|
206
|
-
default: ActionTag.button
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
({
|
|
210
|
-
storageType: {
|
|
211
|
-
default: StorageType.local
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
const VvTooltipProps = {
|
|
215
|
-
...ModifiersProps,
|
|
216
|
-
/**
|
|
217
|
-
* Define the tooltip position
|
|
218
|
-
* @default Side.bottom
|
|
219
|
-
*/
|
|
220
|
-
position: {
|
|
221
|
-
type: String,
|
|
222
|
-
default: Side.bottom
|
|
223
|
-
},
|
|
224
|
-
value: {
|
|
225
|
-
type: String
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
function useModifiers(prefix, modifiers, others) {
|
|
229
|
-
return computed(() => {
|
|
230
|
-
const toReturn = {
|
|
231
|
-
[prefix]: true
|
|
232
|
-
};
|
|
233
|
-
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
234
|
-
if (modifiersArray) {
|
|
235
|
-
if (Array.isArray(modifiersArray)) {
|
|
236
|
-
modifiersArray.forEach((modifier) => {
|
|
237
|
-
if (modifier) {
|
|
238
|
-
toReturn[`${prefix}--${modifier}`] = true;
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (others) {
|
|
244
|
-
Object.keys(others.value).forEach((key) => {
|
|
245
|
-
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
return toReturn;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
const __default__ = {
|
|
252
|
-
name: "VvTooltip"
|
|
253
|
-
};
|
|
254
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
255
|
-
...__default__,
|
|
256
|
-
props: VvTooltipProps,
|
|
257
|
-
setup(__props) {
|
|
258
|
-
const props = __props;
|
|
259
|
-
const { modifiers } = toRefs(props);
|
|
260
|
-
const bemCssClasses = useModifiers(
|
|
261
|
-
"vv-tooltip",
|
|
262
|
-
modifiers,
|
|
263
|
-
computed(() => ({
|
|
264
|
-
[props.position]: true
|
|
265
|
-
}))
|
|
266
|
-
);
|
|
267
|
-
return (_ctx, _cache) => {
|
|
268
|
-
return openBlock(), createElementBlock(
|
|
269
|
-
"span",
|
|
270
|
-
{
|
|
271
|
-
class: normalizeClass(unref(bemCssClasses)),
|
|
272
|
-
role: "tooltip",
|
|
273
|
-
inert: ""
|
|
274
|
-
},
|
|
275
|
-
[
|
|
276
|
-
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
277
|
-
createTextVNode(
|
|
278
|
-
toDisplayString(_ctx.value),
|
|
279
|
-
1
|
|
280
|
-
/* TEXT */
|
|
281
|
-
)
|
|
282
|
-
])
|
|
283
|
-
],
|
|
284
|
-
2
|
|
285
|
-
/* CLASS */
|
|
286
|
-
);
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
const tooltip = /* @__PURE__ */ (() => {
|
|
291
|
-
return {
|
|
292
|
-
beforeMount(el, binding) {
|
|
293
|
-
const tooltip2 = h(_sfc_main, {
|
|
294
|
-
value: binding.value,
|
|
295
|
-
position: binding.arg
|
|
296
|
-
});
|
|
297
|
-
render(tooltip2, el);
|
|
298
|
-
},
|
|
299
|
-
updated(el, binding) {
|
|
300
|
-
const tooltip2 = h(_sfc_main, {
|
|
301
|
-
value: binding.value,
|
|
302
|
-
position: binding.arg
|
|
303
|
-
});
|
|
304
|
-
render(tooltip2, el);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
})();
|
|
308
|
-
export {
|
|
309
|
-
contextmenu as vContextmenu,
|
|
310
|
-
tooltip as vTooltip
|
|
311
|
-
};
|
|
1
|
+
import{reactive as t,computed as e,unref as n,getCurrentInstance as r,onMounted as a,onUnmounted as o,ref as l,defineComponent as i,toRefs as s,createElementBlock as c,openBlock as u,normalizeClass as h,renderSlot as f,createTextVNode as m,toDisplayString as p,h as d,render as v}from"vue";import{wrap as g}from"comlink";import"pica";var b=/* @__PURE__ */(t=>(t.local="local",t.session="session",t))(b||{}),M=/* @__PURE__ */(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(M||{}),y=/* @__PURE__ */(t=>(t.before="before",t.after="after",t))(y||{}),w=/* @__PURE__ */(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(w||{}),E=/* @__PURE__ */(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(E||{});function L(t,i){const{x:s,y:c,getBoundingClientRect:u,onScroll:h}=function(t){const e=l(0),n=l(0),i=l();let s=0,c=0,u=0,h=0;const f=t=>{const r=t.target;s=r.scrollLeft-h,c=r.scrollTop-u,n.value=n.value-c,e.value=e.value-s,h=r.scrollLeft,u=r.scrollTop},m=()=>({width:0,height:0,x:e.value,y:n.value,top:n.value,left:e.value,right:e.value,bottom:n.value});r()&&(a(()=>{t.value&&(t.value.init({getBoundingClientRect:m}),i.value=x(t.value.$el),i.value&&i.value.addEventListener("scroll",f))}),o(()=>{i.value&&i.value.removeEventListener("scroll",f)}));return{x:e,y:n,getBoundingClientRect:m,onScroll:f}}(t),f=e=>{s.value=e.clientX,c.value=e.clientY,e.preventDefault(),t.value.show()},m=e(()=>n(i));return m&&r()&&(a(()=>{m.value?.addEventListener("contextmenu",f,!1)}),o(()=>{m.value?.removeEventListener("contextmenu",f)})),{x:s,y:c,getBoundingClientRect:u,onContextmenu:f,onScroll:h}}function x(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}t(
|
|
2
|
+
/* @__PURE__ */new Map([["default",/* @__PURE__ */new Map]]));const R='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};const p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',k="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",R],{type:"text/javascript;charset=utf-8"});g(new function(t){let e;try{if(e=k&&(self.URL||self.webkitURL).createObjectURL(k),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(R),{name:t?.name})}});const S={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:a}=L(e);e.value.init({getBoundingClientRect:a}),t.addEventListener("contextmenu",n,!1);const o=x(e.value.$el);o&&o.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:o}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}},C={modifiers:{type:[String,Array],default:void 0}};y.before,M.bottom,w.button,E.button,b.local;const O=/* @__PURE__ */i({name:"VvTooltip",props:{...C,position:{type:String,default:M.bottom},value:{type:String}},setup(t){const r=t,{modifiers:a}=s(r),o=function(t,r,a){return e(()=>{const e={[t]:!0},o="string"==typeof r?.value?r.value.split(" "):r?.value;return o&&Array.isArray(o)&&o.forEach(n=>{n&&(e[`${t}--${n}`]=!0)}),a&&Object.keys(a.value).forEach(r=>{e[`${t}--${r}`]=n(a.value[r])}),e})}("vv-tooltip",a,e(()=>({[r.position]:!0})));return(t,e)=>(u(),c("span",{class:h(n(o)),role:"tooltip",inert:""},[f(t.$slots,"default",{},()=>[m(p(t.value),1)])],2))}}),T=/* @__PURE__ */(()=>({beforeMount(t,e){const n=d(O,{value:e.value,position:e.arg});v(n,t)},updated(t,e){const n=d(O,{value:e.value,position:e.arg});v(n,t)}}))();export{S as vContextmenu,T as vTooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).directives={},t.vue,t.comlink)}(this,function(t,e,n){"use strict";var r=(t=>(t.local="local",t.session="session",t))(r||{}),o=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(o||{}),a=(t=>(t.before="before",t.after="after",t))(a||{}),l=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(l||{}),i=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(i||{});function s(t,n){const{x:r,y:o,getBoundingClientRect:a,onScroll:l}=function(t){const n=e.ref(0),r=e.ref(0),o=e.ref();let a=0,l=0,i=0,s=0;const u=t=>{const e=t.target;a=e.scrollLeft-s,l=e.scrollTop-i,r.value=r.value-l,n.value=n.value-a,s=e.scrollLeft,i=e.scrollTop},f=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});e.getCurrentInstance()&&(e.onMounted(()=>{t.value&&(t.value.init({getBoundingClientRect:f}),o.value=c(t.value.$el),o.value&&o.value.addEventListener("scroll",u))}),e.onUnmounted(()=>{o.value&&o.value.removeEventListener("scroll",u)}));return{x:n,y:r,getBoundingClientRect:f,onScroll:u}}(t),i=e=>{r.value=e.clientX,o.value=e.clientY,e.preventDefault(),t.value.show()},s=e.computed(()=>e.unref(n));return s&&e.getCurrentInstance()&&(e.onMounted(()=>{s.value?.addEventListener("contextmenu",i,!1)}),e.onUnmounted(()=>{s.value?.removeEventListener("contextmenu",i)})),{x:r,y:o,getBoundingClientRect:a,onContextmenu:i,onScroll:l}}function c(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}e.reactive(new Map([["default",new Map]]));const u='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',f="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",u],{type:"text/javascript;charset=utf-8"});n.wrap(new function(t){let e;try{if(e=f&&(self.URL||self.webkitURL).createObjectURL(f),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(u),{name:t?.name})}});const h={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:o}=s(e);e.value.init({getBoundingClientRect:o}),t.addEventListener("contextmenu",n,!1);const a=c(e.value.$el);a&&a.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:a}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}},p={modifiers:{type:[String,Array],default:void 0}};a.before,o.bottom,l.button,i.button,r.local;const m={...p,position:{type:String,default:o.bottom},value:{type:String}};const d=e.defineComponent({name:"VvTooltip",props:m,setup(t){const n=t,{modifiers:r}=e.toRefs(n),o=function(t,n,r){return e.computed(()=>{const o={[t]:!0},a="string"==typeof n?.value?n.value.split(" "):n?.value;return a&&Array.isArray(a)&&a.forEach(e=>{e&&(o[`${t}--${e}`]=!0)}),r&&Object.keys(r.value).forEach(n=>{o[`${t}--${n}`]=e.unref(r.value[n])}),o})}("vv-tooltip",r,e.computed(()=>({[n.position]:!0})));return(t,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(o)),role:"tooltip",inert:""},[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.value),1)])],2))}}),g=(()=>({beforeMount(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)},updated(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)}}))();t.vContextmenu=h,t.vTooltip=g,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("comlink"),require("pica")):"function"==typeof define&&define.amd?define(["exports","vue","comlink","pica"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).directives={},t.vue,t.comlink)}(this,function(t,e,n){"use strict";var r=(t=>(t.local="local",t.session="session",t))(r||{}),o=(t=>(t.left="left",t.right="right",t.top="top",t.bottom="bottom",t))(o||{}),a=(t=>(t.before="before",t.after="after",t))(a||{}),l=(t=>(t.button="button",t.submit="submit",t.reset="reset",t))(l||{}),i=(t=>(t.nuxtLink="nuxt-link",t.routerLink="router-link",t.a="a",t.button="button",t))(i||{});function s(t,n){const{x:r,y:o,getBoundingClientRect:a,onScroll:l}=function(t){const n=e.ref(0),r=e.ref(0),o=e.ref();let a=0,l=0,i=0,s=0;const c=t=>{const e=t.target;a=e.scrollLeft-s,l=e.scrollTop-i,r.value=r.value-l,n.value=n.value-a,s=e.scrollLeft,i=e.scrollTop},f=()=>({width:0,height:0,x:n.value,y:r.value,top:r.value,left:n.value,right:n.value,bottom:r.value});e.getCurrentInstance()&&(e.onMounted(()=>{t.value&&(t.value.init({getBoundingClientRect:f}),o.value=u(t.value.$el),o.value&&o.value.addEventListener("scroll",c))}),e.onUnmounted(()=>{o.value&&o.value.removeEventListener("scroll",c)}));return{x:n,y:r,getBoundingClientRect:f,onScroll:c}}(t),i=e=>{r.value=e.clientX,o.value=e.clientY,e.preventDefault(),t.value.show()},s=e.computed(()=>e.unref(n));return s&&e.getCurrentInstance()&&(e.onMounted(()=>{s.value?.addEventListener("contextmenu",i,!1)}),e.onUnmounted(()=>{s.value?.removeEventListener("contextmenu",i)})),{x:r,y:o,getBoundingClientRect:a,onContextmenu:i,onScroll:l}}function u(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}e.reactive(new Map([["default",new Map]]));const c='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};const p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',f="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",c],{type:"text/javascript;charset=utf-8"});n.wrap(new function(t){let e;try{if(e=f&&(self.URL||self.webkitURL).createObjectURL(f),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{name:t?.name})}});const h={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:o}=s(e);e.value.init({getBoundingClientRect:o}),t.addEventListener("contextmenu",n,!1);const a=u(e.value.$el);a&&a.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:a}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}},p={modifiers:{type:[String,Array],default:void 0}};a.before,o.bottom,l.button,i.button,r.local;const m={...p,position:{type:String,default:o.bottom},value:{type:String}};const d=e.defineComponent({name:"VvTooltip",props:m,setup(t){const n=t,{modifiers:r}=e.toRefs(n),o=function(t,n,r){return e.computed(()=>{const o={[t]:!0},a="string"==typeof n?.value?n.value.split(" "):n?.value;return a&&Array.isArray(a)&&a.forEach(e=>{e&&(o[`${t}--${e}`]=!0)}),r&&Object.keys(r.value).forEach(n=>{o[`${t}--${n}`]=e.unref(r.value[n])}),o})}("vv-tooltip",r,e.computed(()=>({[n.position]:!0})));return(t,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(e.unref(o)),role:"tooltip",inert:""},[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.value),1)])],2))}}),v=(()=>({beforeMount(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)},updated(t,n){const r=e.h(d,{value:n.value,position:n.arg});e.render(r,t)}}))();t.vContextmenu=h,t.vTooltip=v,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,142 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import "pica";
|
|
4
|
-
const DEFAULT_ALERT_GROUP = "default";
|
|
5
|
-
reactive(
|
|
6
|
-
/* @__PURE__ */ new Map([
|
|
7
|
-
[DEFAULT_ALERT_GROUP, /* @__PURE__ */ new Map()]
|
|
8
|
-
])
|
|
9
|
-
);
|
|
10
|
-
function useDropdownContextmenu(dropdownEl, targetEl) {
|
|
11
|
-
const { x, y, getBoundingClientRect, onScroll } = useDropdownVirtualElement(dropdownEl);
|
|
12
|
-
const onContextmenu = (event) => {
|
|
13
|
-
x.value = event.clientX;
|
|
14
|
-
y.value = event.clientY;
|
|
15
|
-
event.preventDefault();
|
|
16
|
-
dropdownEl.value.show();
|
|
17
|
-
};
|
|
18
|
-
const target = computed(() => unref(targetEl));
|
|
19
|
-
if (target && getCurrentInstance()) {
|
|
20
|
-
onMounted(() => {
|
|
21
|
-
target.value?.addEventListener("contextmenu", onContextmenu, false);
|
|
22
|
-
});
|
|
23
|
-
onUnmounted(() => {
|
|
24
|
-
target.value?.removeEventListener("contextmenu", onContextmenu);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return { x, y, getBoundingClientRect, onContextmenu, onScroll };
|
|
28
|
-
}
|
|
29
|
-
function findScrollContainer(element) {
|
|
30
|
-
if (!element) {
|
|
31
|
-
return void 0;
|
|
32
|
-
}
|
|
33
|
-
let parent = element.parentElement;
|
|
34
|
-
while (parent) {
|
|
35
|
-
const { overflow } = window.getComputedStyle(parent);
|
|
36
|
-
if (overflow.split(" ").every((item) => item === "auto" || item === "scroll")) {
|
|
37
|
-
return parent;
|
|
38
|
-
}
|
|
39
|
-
parent = parent.parentElement;
|
|
40
|
-
}
|
|
41
|
-
return document.documentElement;
|
|
42
|
-
}
|
|
43
|
-
function useDropdownVirtualElement(dropdownEl) {
|
|
44
|
-
const x = ref(0);
|
|
45
|
-
const y = ref(0);
|
|
46
|
-
const scrollContainerEl = ref();
|
|
47
|
-
let scrollXDelta = 0;
|
|
48
|
-
let scrollYDelta = 0;
|
|
49
|
-
let lastScrollTop = 0;
|
|
50
|
-
let lastScrollLeft = 0;
|
|
51
|
-
const onScroll = (event) => {
|
|
52
|
-
const scrollEl = event.target;
|
|
53
|
-
scrollXDelta = scrollEl.scrollLeft - lastScrollLeft;
|
|
54
|
-
scrollYDelta = scrollEl.scrollTop - lastScrollTop;
|
|
55
|
-
y.value = y.value - scrollYDelta;
|
|
56
|
-
x.value = x.value - scrollXDelta;
|
|
57
|
-
lastScrollLeft = scrollEl.scrollLeft;
|
|
58
|
-
lastScrollTop = scrollEl.scrollTop;
|
|
59
|
-
};
|
|
60
|
-
const getBoundingClientRect = () => ({
|
|
61
|
-
width: 0,
|
|
62
|
-
height: 0,
|
|
63
|
-
x: x.value,
|
|
64
|
-
y: y.value,
|
|
65
|
-
top: y.value,
|
|
66
|
-
left: x.value,
|
|
67
|
-
right: x.value,
|
|
68
|
-
bottom: y.value
|
|
69
|
-
});
|
|
70
|
-
if (getCurrentInstance()) {
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
if (dropdownEl.value) {
|
|
73
|
-
dropdownEl.value.init({
|
|
74
|
-
getBoundingClientRect
|
|
75
|
-
});
|
|
76
|
-
scrollContainerEl.value = findScrollContainer(dropdownEl.value.$el);
|
|
77
|
-
if (scrollContainerEl.value) {
|
|
78
|
-
scrollContainerEl.value.addEventListener("scroll", onScroll);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
onUnmounted(() => {
|
|
83
|
-
if (scrollContainerEl.value) {
|
|
84
|
-
scrollContainerEl.value.removeEventListener("scroll", onScroll);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
return { x, y, getBoundingClientRect, onScroll };
|
|
89
|
-
}
|
|
90
|
-
const jsContent = '!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n';
|
|
91
|
-
const blob = typeof self !== "undefined" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
92
|
-
function WorkerWrapper(options) {
|
|
93
|
-
let objURL;
|
|
94
|
-
try {
|
|
95
|
-
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
96
|
-
if (!objURL) throw "";
|
|
97
|
-
const worker = new Worker(objURL, {
|
|
98
|
-
name: options?.name
|
|
99
|
-
});
|
|
100
|
-
worker.addEventListener("error", () => {
|
|
101
|
-
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
102
|
-
});
|
|
103
|
-
return worker;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
return new Worker(
|
|
106
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
107
|
-
{
|
|
108
|
-
name: options?.name
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
wrap(new WorkerWrapper());
|
|
114
|
-
const contextmenu = {
|
|
115
|
-
beforeUpdate(el, binding) {
|
|
116
|
-
const { onContextmenu, onScroll, getBoundingClientRect } = useDropdownContextmenu(binding);
|
|
117
|
-
binding.value.init({
|
|
118
|
-
getBoundingClientRect
|
|
119
|
-
});
|
|
120
|
-
el.addEventListener(
|
|
121
|
-
"contextmenu",
|
|
122
|
-
onContextmenu,
|
|
123
|
-
false
|
|
124
|
-
);
|
|
125
|
-
const scrollContainerEl = findScrollContainer(binding.value.$el);
|
|
126
|
-
if (scrollContainerEl) {
|
|
127
|
-
scrollContainerEl.addEventListener("scroll", onScroll);
|
|
128
|
-
}
|
|
129
|
-
el.additionalData = { onContextmenu, onScroll, scrollContainerEl };
|
|
130
|
-
},
|
|
131
|
-
beforeUnmount(el) {
|
|
132
|
-
if (el?.additionalData?.onContextmenu) {
|
|
133
|
-
el.removeEventListener("contextmenu", el.additionalData.onContextmenu);
|
|
134
|
-
}
|
|
135
|
-
if (el?.additionalData?.onScroll && el?.additionalData?.scrollContainerEl) {
|
|
136
|
-
el.additionalData.scrollContainerEl.removeEventListener("scroll", el.additionalData.onScroll);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
export {
|
|
141
|
-
contextmenu as default
|
|
142
|
-
};
|
|
1
|
+
import{reactive as t,computed as e,unref as n,getCurrentInstance as r,onMounted as a,onUnmounted as o,ref as l}from"vue";import{wrap as i}from"comlink";import"pica";function s(t,i){const{x:s,y:u,getBoundingClientRect:h,onScroll:f}=function(t){const e=l(0),n=l(0),i=l();let s=0,u=0,h=0,f=0;const m=t=>{const r=t.target;s=r.scrollLeft-f,u=r.scrollTop-h,n.value=n.value-u,e.value=e.value-s,f=r.scrollLeft,h=r.scrollTop},p=()=>({width:0,height:0,x:e.value,y:n.value,top:n.value,left:e.value,right:e.value,bottom:n.value});r()&&(a(()=>{t.value&&(t.value.init({getBoundingClientRect:p}),i.value=c(t.value.$el),i.value&&i.value.addEventListener("scroll",m))}),o(()=>{i.value&&i.value.removeEventListener("scroll",m)}));return{x:e,y:n,getBoundingClientRect:p,onScroll:m}}(t),m=e=>{s.value=e.clientX,u.value=e.clientY,e.preventDefault(),t.value.show()},p=e(()=>n(i));return p&&r()&&(a(()=>{p.value?.addEventListener("contextmenu",m,!1)}),o(()=>{p.value?.removeEventListener("contextmenu",m)})),{x:s,y:u,getBoundingClientRect:h,onContextmenu:m,onScroll:f}}function c(t){if(!t)return;let e=t.parentElement;for(;e;){const{overflow:t}=window.getComputedStyle(e);if(t.split(" ").every(t=>"auto"===t||"scroll"===t))return e;e=e.parentElement}return document.documentElement}t(
|
|
2
|
+
/* @__PURE__ */new Map([["default",/* @__PURE__ */new Map]]));const u='!function(){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],e=e=>{let n=0;for(let r=0;r<e.length;r++){let a=e[r];n=83*n+t.indexOf(a)}return n},n=(e,n)=>{var r="";for(let a=1;a<=n;a++){let o=Math.floor(e)/Math.pow(83,n-a)%83;r+=t[Math.floor(o)]}return r},r=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},a=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},o=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),s=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},i=t=>{if(!t||t.length<6)throw new s("The blurhash string must be at least 6 characters");let n=e(t[0]),r=Math.floor(n/9)+1,a=n%9+1;if(t.length!==4+2*a*r)throw new s(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*a*r}`)},l=t=>{let e=t>>8&255,n=255&t;return[r(t>>16),r(e),r(n)]},c=(t,e)=>{let n=Math.floor(t/361),r=Math.floor(t/19)%19,a=t%19;return[o((n-9)/9,2)*e,o((r-9)/9,2)*e,o((a-9)/9,2)*e]},h=(t,n,r,o)=>{i(t),o|=1;let s=e(t[0]),h=Math.floor(s/9)+1,u=s%9+1,f=(e(t[1])+1)/166,p=new Array(u*h);for(let a=0;a<p.length;a++)if(0===a){let n=e(t.substring(2,6));p[a]=l(n)}else{let n=e(t.substring(4+2*a,6+2*a));p[a]=c(n,f*o)}let m=4*n,g=new Uint8ClampedArray(m*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++){let o=0,s=0,i=0;for(let a=0;a<h;a++)for(let l=0;l<u;l++){let c=Math.cos(Math.PI*t*l/n)*Math.cos(Math.PI*e*a/r),h=p[l+a*u];o+=h[0]*c,s+=h[1]*c,i+=h[2]*c}let l=a(o),c=a(s),f=a(i);g[4*t+0+e*m]=l,g[4*t+1+e*m]=c,g[4*t+2+e*m]=f,g[4*t+3+e*m]=255}return g},u=(t,e,n,a)=>{let o=0,s=0,i=0,l=4*e;for(let h=0;h<e;h++){let e=4*h;for(let c=0;c<n;c++){let n=e+c*l,u=a(h,c);o+=u*r(t[n]),s+=u*r(t[n+1]),i+=u*r(t[n+2])}}let c=1/(e*n);return[o*c,s*c,i*c]},f=(t,e,r,i,l)=>{if(i<1||i>9||l<1||l>9)throw new s("BlurHash must have between 1 and 9 components");if(e*r*4!==t.length)throw new s("Width and height must match the pixels array");let c=[];for(let n=0;n<l;n++)for(let a=0;a<i;a++){let o=0==a&&0==n?1:2,s=u(t,e,r,(t,s)=>o*Math.cos(Math.PI*a*t/e)*Math.cos(Math.PI*n*s/r));c.push(s)}let h,f=c[0],p=c.slice(1),m="";if(m+=n(i-1+9*(l-1),1),p.length>0){let t=Math.max(...p.map(t=>Math.max(...t))),e=Math.floor(Math.max(0,Math.min(82,Math.floor(166*t-.5))));h=(e+1)/166,m+=n(e,1)}else h=1,m+=n(0,1);return m+=n((t=>(a(t[0])<<16)+(a(t[1])<<8)+a(t[2]))(f),4),p.forEach(t=>{m+=n(((t,e)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[0]/e,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[1]/e,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*o(t[2]/e,.5)+9.5)))))(t,h),2)}),m};const p=Symbol("Comlink.proxy"),m=Symbol("Comlink.endpoint"),g=Symbol("Comlink.releaseProxy"),M=Symbol("Comlink.finalizer"),d=Symbol("Comlink.thrown"),y=t=>"object"==typeof t&&null!==t||"function"==typeof t,w=new Map([["proxy",{canHandle:t=>y(t)&&t[p],serialize(t){const{port1:e,port2:n}=new MessageChannel;return b(t,e),[n,[n]]},deserialize:t=>(t.start(),function(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),P(t,n,[],e)}(t))}],["throw",{canHandle:t=>y(t)&&d in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function b(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin \'${a.origin}\' for comlink proxy`);const{id:o,type:s,path:i}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(L);let c;try{const e=i.slice(0,-1).reduce((t,e)=>t[e],t),n=i.reduce((t,e)=>t[e],t);switch(s){case"GET":c=n;break;case"SET":e[i.slice(-1)[0]]=L(a.data.value),c=!0;break;case"APPLY":c=n.apply(e,l);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[p]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;b(t,n),c=function(t,e){return T.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[d]:0}}Promise.resolve(c).catch(t=>({value:t,[d]:0})).then(n=>{const[a,i]=R(n);e.postMessage(Object.assign(Object.assign({},a),{id:o}),i),"RELEASE"===s&&(e.removeEventListener("message",r),E(e),M in t&&"function"==typeof t[M]&&t[M]())}).catch(t=>{const[n,r]=R({value:new TypeError("Unserializable return value"),[d]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function E(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function v(t){if(t)throw new Error("Proxy has been released and is not useable")}function S(t){return O(t,new Map,{type:"RELEASE"}).then(()=>{E(t)})}const x=new WeakMap,k="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(x.get(t)||0)-1;x.set(t,e),0===e&&S(t)});function P(t,e,n=[],r=function(){}){let a=!1;const o=new Proxy(r,{get(r,s){if(v(a),s===g)return()=>{!function(t){k&&k.unregister(t)}(o),S(t),e.clear(),a=!0};if("then"===s){if(0===n.length)return{then:()=>o};const r=O(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(L);return r.then.bind(r)}return P(t,e,[...n,s])},set(r,o,s){v(a);const[i,l]=R(s);return O(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:i},l).then(L)},apply(r,o,s){v(a);const i=n[n.length-1];if(i===m)return O(t,e,{type:"ENDPOINT"}).then(L);if("bind"===i)return P(t,e,n.slice(0,-1));const[l,c]=A(s);return O(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:l},c).then(L)},construct(r,o){v(a);const[s,i]=A(o);return O(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:s},i).then(L)}});return function(t,e){const n=(x.get(e)||0)+1;x.set(e,n),k&&k.register(t,e,t)}(o,t),o}function A(t){const e=t.map(R);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const T=new WeakMap;function R(t){for(const[e,n]of w)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},T.get(t)||[]]}function L(t){switch(t.type){case"HANDLER":return w.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,n,r){return new Promise(a=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,a),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}b({ValidationError:s,encode:f,decode:h,isBlurhashValid:t=>{try{i(t)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}}})}();\n',h="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",u],{type:"text/javascript;charset=utf-8"});i(new function(t){let e;try{if(e=h&&(self.URL||self.webkitURL).createObjectURL(h),!e)throw"";const n=new Worker(e,{name:t?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(u),{name:t?.name})}});const f={beforeUpdate(t,e){const{onContextmenu:n,onScroll:r,getBoundingClientRect:a}=s(e);e.value.init({getBoundingClientRect:a}),t.addEventListener("contextmenu",n,!1);const o=c(e.value.$el);o&&o.addEventListener("scroll",r),t.additionalData={onContextmenu:n,onScroll:r,scrollContainerEl:o}},beforeUnmount(t){t?.additionalData?.onContextmenu&&t.removeEventListener("contextmenu",t.additionalData.onContextmenu),t?.additionalData?.onScroll&&t?.additionalData?.scrollContainerEl&&t.additionalData.scrollContainerEl.removeEventListener("scroll",t.additionalData.onScroll)}};export{f as default};
|