@uploadcare/file-uploader 1.20.0-rc.2 → 1.20.0
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/abstract/Block.d.ts +2 -11
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +3 -29
- package/abstract/CTX.d.ts +2 -2
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +1 -1
- package/abstract/{managers/LocaleManager.d.ts → LocaleManager.d.ts} +8 -8
- package/abstract/{managers/LocaleManager.d.ts.map → LocaleManager.d.ts.map} +1 -1
- package/abstract/{managers/LocaleManager.js → LocaleManager.js} +8 -8
- package/abstract/{managers/ModalManager.d.ts → ModalManager.d.ts} +7 -7
- package/abstract/{managers/ModalManager.d.ts.map → ModalManager.d.ts.map} +1 -1
- package/abstract/{managers/ModalManager.js → ModalManager.js} +3 -3
- package/abstract/SecureUploadsManager.d.ts +22 -0
- package/abstract/{managers/SecureUploadsManager.d.ts.map → SecureUploadsManager.d.ts.map} +1 -1
- package/abstract/{managers/SecureUploadsManager.js → SecureUploadsManager.js} +5 -5
- package/abstract/SolutionBlock.d.ts +1 -1
- package/abstract/UploaderBlock.d.ts +3 -3
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +10 -3
- package/abstract/{managers/ValidationManager.d.ts → ValidationManager.d.ts} +7 -7
- package/abstract/{managers/ValidationManager.d.ts.map → ValidationManager.d.ts.map} +1 -1
- package/abstract/{managers/ValidationManager.js → ValidationManager.js} +14 -14
- package/abstract/{managers/a11y.d.ts → a11y.d.ts} +2 -2
- package/abstract/a11y.d.ts.map +1 -0
- package/abstract/{managers/a11y.js → a11y.js} +1 -1
- package/abstract/l10nProcessor.js +1 -1
- package/blocks/CameraSource/CameraSource.d.ts +1 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +1 -0
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +19 -5
- package/blocks/CloudImageEditor/src/CropFrame.js +3 -3
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +11 -0
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.js +130 -0
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +2 -8
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +1 -7
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +2 -3
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +1 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.js +3 -9
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +15 -8
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +68 -25
- package/blocks/CloudImageEditor/src/css/common.css +39 -7
- package/blocks/CloudImageEditor/src/index.d.ts +1 -0
- package/blocks/CloudImageEditor/src/index.js +1 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +2 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +74 -8
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +2 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.js +35 -0
- package/blocks/CloudImageEditor/src/state.d.ts +1 -1
- package/blocks/CloudImageEditor/src/state.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/state.js +2 -2
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts +1 -1
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/svg-sprite.js +1 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.js +0 -2
- package/blocks/CloudImageEditor/src/types.d.ts +2 -0
- package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/types.js +9 -1
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +0 -2
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +0 -2
- package/blocks/DropArea/DropArea.d.ts +1 -1
- package/blocks/ExternalSource/ExternalSource.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +0 -16
- package/blocks/Modal/Modal.d.ts +6 -6
- package/blocks/Modal/Modal.d.ts.map +1 -1
- package/blocks/Modal/Modal.js +12 -10
- package/blocks/SimpleBtn/SimpleBtn.d.ts +1 -1
- package/blocks/SourceBtn/SourceBtn.d.ts +1 -1
- package/blocks/Thumb/Thumb.d.ts +1 -1
- package/blocks/UploadCtxProvider/EventEmitter.d.ts +4 -17
- package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
- package/blocks/UploadCtxProvider/EventEmitter.js +2 -14
- package/blocks/UploadList/UploadList.d.ts +1 -1
- package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
- package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
- package/blocks/themes/uc-basic/svg-sprite.js +1 -1
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.ssr.d.ts +17 -3
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +35 -11
- package/locales/file-uploader/ar.d.ts +4 -0
- package/locales/file-uploader/ar.js +5 -0
- package/locales/file-uploader/az.d.ts +4 -0
- package/locales/file-uploader/az.js +5 -0
- package/locales/file-uploader/ca.d.ts +4 -0
- package/locales/file-uploader/ca.js +6 -0
- package/locales/file-uploader/cs.d.ts +4 -0
- package/locales/file-uploader/cs.js +6 -0
- package/locales/file-uploader/da.d.ts +4 -0
- package/locales/file-uploader/da.js +6 -0
- package/locales/file-uploader/de.d.ts +4 -0
- package/locales/file-uploader/de.js +6 -0
- package/locales/file-uploader/el.d.ts +4 -0
- package/locales/file-uploader/el.js +6 -0
- package/locales/file-uploader/en.d.ts +4 -0
- package/locales/file-uploader/en.js +5 -0
- package/locales/file-uploader/es.d.ts +4 -0
- package/locales/file-uploader/es.js +6 -0
- package/locales/file-uploader/et.d.ts +4 -0
- package/locales/file-uploader/et.js +6 -0
- package/locales/file-uploader/fi.d.ts +4 -0
- package/locales/file-uploader/fi.js +6 -0
- package/locales/file-uploader/fr.d.ts +4 -0
- package/locales/file-uploader/fr.js +6 -0
- package/locales/file-uploader/he.d.ts +4 -0
- package/locales/file-uploader/he.js +6 -0
- package/locales/file-uploader/hy.d.ts +4 -0
- package/locales/file-uploader/hy.js +5 -0
- package/locales/file-uploader/is.d.ts +4 -0
- package/locales/file-uploader/is.js +6 -0
- package/locales/file-uploader/it.d.ts +4 -0
- package/locales/file-uploader/it.js +6 -0
- package/locales/file-uploader/ja.d.ts +4 -0
- package/locales/file-uploader/ja.js +6 -0
- package/locales/file-uploader/ka.d.ts +4 -0
- package/locales/file-uploader/ka.js +6 -0
- package/locales/file-uploader/kk.d.ts +4 -0
- package/locales/file-uploader/kk.js +6 -0
- package/locales/file-uploader/ko.d.ts +4 -0
- package/locales/file-uploader/ko.js +6 -0
- package/locales/file-uploader/lv.d.ts +4 -0
- package/locales/file-uploader/lv.js +6 -0
- package/locales/file-uploader/nb.d.ts +4 -0
- package/locales/file-uploader/nb.js +6 -0
- package/locales/file-uploader/nl.d.ts +4 -0
- package/locales/file-uploader/nl.js +6 -0
- package/locales/file-uploader/pl.d.ts +4 -0
- package/locales/file-uploader/pl.js +6 -0
- package/locales/file-uploader/pt.d.ts +4 -0
- package/locales/file-uploader/pt.js +6 -0
- package/locales/file-uploader/ro.d.ts +4 -0
- package/locales/file-uploader/ro.js +6 -0
- package/locales/file-uploader/ru.d.ts +4 -0
- package/locales/file-uploader/ru.js +6 -0
- package/locales/file-uploader/sk.d.ts +4 -0
- package/locales/file-uploader/sk.js +6 -0
- package/locales/file-uploader/sr.d.ts +4 -0
- package/locales/file-uploader/sr.js +6 -0
- package/locales/file-uploader/sv.d.ts +4 -0
- package/locales/file-uploader/sv.js +6 -0
- package/locales/file-uploader/tr.d.ts +4 -0
- package/locales/file-uploader/tr.js +6 -0
- package/locales/file-uploader/uk.d.ts +4 -0
- package/locales/file-uploader/uk.js +6 -0
- package/locales/file-uploader/vi.d.ts +4 -0
- package/locales/file-uploader/vi.js +6 -0
- package/locales/file-uploader/zh-TW.d.ts +4 -0
- package/locales/file-uploader/zh-TW.js +6 -0
- package/locales/file-uploader/zh.d.ts +4 -0
- package/locales/file-uploader/zh.js +6 -0
- package/package.json +2 -5
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -34
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -1
- package/solutions/cloud-image-editor/CloudImageEditor.js +0 -12
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +1 -2
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
- package/solutions/file-uploader/inline/FileUploaderInline.js +0 -4
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +9 -10
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +3 -7
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +0 -4
- package/types/events.d.ts +1 -1
- package/types/exported.d.ts +52 -54
- package/types/jsx.d.ts +2 -0
- package/utils/parseCdnUrl.d.ts.map +1 -1
- package/utils/parseCdnUrl.js +4 -1
- package/utils/parseCdnUrl.test.js +13 -0
- package/utils/validators/collection/validateCollectionUploadError.d.ts +2 -2
- package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -1
- package/utils/validators/collection/validateCollectionUploadError.js +1 -1
- package/utils/validators/collection/validateMultiple.d.ts +2 -2
- package/utils/validators/collection/validateMultiple.d.ts.map +1 -1
- package/utils/validators/collection/validateMultiple.js +1 -1
- package/utils/validators/file/validateFileType.d.ts +2 -2
- package/utils/validators/file/validateFileType.d.ts.map +1 -1
- package/utils/validators/file/validateFileType.js +1 -1
- package/utils/validators/file/validateIsImage.d.ts +2 -2
- package/utils/validators/file/validateIsImage.d.ts.map +1 -1
- package/utils/validators/file/validateIsImage.js +1 -1
- package/utils/validators/file/validateMaxSizeLimit.d.ts +2 -2
- package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -1
- package/utils/validators/file/validateMaxSizeLimit.js +1 -1
- package/utils/validators/file/validateUploadError.d.ts +2 -2
- package/utils/validators/file/validateUploadError.d.ts.map +1 -1
- package/utils/validators/file/validateUploadError.js +1 -1
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +1 -1
- package/web/uc-cloud-image-editor.min.css +1 -1
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +1 -1
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.css +1 -1
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
- package/abstract/managers/SecureUploadsManager.d.ts +0 -22
- package/abstract/managers/TelemetryManager.d.ts +0 -66
- package/abstract/managers/TelemetryManager.d.ts.map +0 -1
- package/abstract/managers/TelemetryManager.js +0 -202
- package/abstract/managers/a11y.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -11
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +0 -11
package/web/uc-img.min.js
CHANGED
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
*/
|
|
26
26
|
var ot=Object.defineProperty;var at=(t,s,e)=>s in t?ot(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var w=(t,s,e)=>at(t,typeof s!="symbol"?s+"":s,e);var lt=t=>t,ht="{{",ut="}}";function j(t,s,e={}){var o;let{openToken:r=ht,closeToken:i=ut,transform:n=lt}=e;for(let l in s){let u=(o=s[l])==null?void 0:o.toString();t=t.replaceAll(r+l+i,typeof u=="string"?n(u):u)}return t}var ct=t=>{if(typeof t!="string"||!t)return"";let s=t.trim();return s.startsWith("-/")?s=s.slice(2):s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")&&(s=s.slice(0,s.length-1)),s},dt=(...t)=>t.filter(s=>typeof s=="string"&&s).map(s=>ct(s)).join("/-/"),W=(...t)=>{let s=dt(...t);return s?`-/${s}/`:""};function K(t){let s=new URL(t),e=s.pathname+s.search+s.hash,r=e.lastIndexOf("http"),i=e.lastIndexOf("/"),n="";return r>=0?n=e.slice(r):i>=0&&(n=e.slice(i+1)),n}function _t(t){let s=new URL(t),e=K(t),r=z(e)?H(e).pathname:e;return s.pathname=s.pathname.replace(r,""),s.search="",s.hash="",s.toString()}function z(t){return t.startsWith("http")}function H(t){let s=new URL(t);return{pathname:s.origin+s.pathname||"",search:s.search||"",hash:s.hash||""}}var m=(t,s,e)=>{let r=new URL(_t(t));if(e=e||K(t),r.pathname.startsWith("//")&&(r.pathname=r.pathname.replace("//","/")),z(e)){let i=H(e);r.pathname=r.pathname+(s||"")+(i.pathname||""),r.search=i.search,r.hash=i.hash}else r.pathname=r.pathname+(s||"")+(e||"");return r.toString()},D=(t,s)=>{let e=new URL(t);return e.pathname=s+"/",e.toString()};var q=(t,s=",")=>t.trim().split(s).map(e=>e.trim()).filter(e=>e.length>0);var V=t=>[...new Set(t)];var G=t=>Object.entries(t).filter(([s,e])=>e!==void 0&&e!=="").map(([s,e])=>s==="cdn-operations"||s==="analytics"?e:`${s}/${e}`);var pt=Object.defineProperty,ft=(t,s,e)=>s in t?pt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,L=(t,s,e)=>(ft(t,typeof s!="symbol"?s+"":s,e),e);function mt(t){let s=e=>{var r;for(let i in e)((r=e[i])==null?void 0:r.constructor)===Object&&(e[i]=s(e[i]));return{...e}};return s(t)}var c=class{constructor(t){t.constructor===Object?this.store=mt(t):(this._storeIsProxy=!0,this.store=t),this.callbackMap=Object.create(null)}static warn(t,s){console.warn(`Symbiote Data: cannot ${t}. Prop name: `+s)}read(t){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(c.warn("read",t),null):this.store[t]}has(t){return this._storeIsProxy?this.store[t]!==void 0:this.store.hasOwnProperty(t)}add(t,s,e=!1){!e&&Object.keys(this.store).includes(t)||(this.store[t]=s,this.notify(t))}pub(t,s){if(!this._storeIsProxy&&!this.store.hasOwnProperty(t)){c.warn("publish",t);return}this.store[t]=s,this.notify(t)}multiPub(t){for(let s in t)this.pub(s,t[s])}notify(t){this.callbackMap[t]&&this.callbackMap[t].forEach(s=>{s(this.store[t])})}sub(t,s,e=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(t)?(c.warn("subscribe",t),null):(this.callbackMap[t]||(this.callbackMap[t]=new Set),this.callbackMap[t].add(s),e&&s(this.store[t]),{remove:()=>{this.callbackMap[t].delete(s),this.callbackMap[t].size||delete this.callbackMap[t]},callback:s})}static registerCtx(t,s=Symbol()){let e=c.globalStore.get(s);return e?console.warn('State: context UID "'+s+'" already in use'):(e=new c(t),c.globalStore.set(s,e)),e}static deleteCtx(t){c.globalStore.delete(t)}static getCtx(t,s=!0){return c.globalStore.get(t)||(s&&console.warn('State: wrong context UID - "'+t+'"'),null)}};c.globalStore=new Map;var a=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),Q="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",gt=Q.length-1,bt=class{static generate(t="XXXXXXXXX-XXX"){let s="";for(let e=0;e<t.length;e++)s+=t[e]==="-"?t[e]:Q.charAt(Math.random()*gt);return s}};function Z(t,s,e){let r=!0,i,n=s.split(".");return n.forEach((o,l)=>{l<n.length-1?t=t[o]:i=o}),t?t[i]=e:r=!1,r}function Tt(t){return t.split("-").map((s,e)=>s&&e?s[0].toUpperCase()+s.slice(1):s).join("").split("_").map((s,e)=>s&&e?s.toUpperCase():s).join("")}function Et(t,s){[...t.querySelectorAll(`[${a.REPEAT_ATTR}]`)].forEach(e=>{let r=e.getAttribute(a.REPEAT_ITEM_TAG_ATTR),i;if(r&&(i=window.customElements.get(r)),!i){i=class extends s.BaseComponent{constructor(){super(),r||(this.style.display="contents")}};let o=e.innerHTML;i.template=o,i.reg(r)}for(;e.firstChild;)e.firstChild.remove();let n=e.getAttribute(a.REPEAT_ATTR);s.sub(n,o=>{if(!o){for(;e.firstChild;)e.firstChild.remove();return}let l=[...e.children],u,C=d=>{d.forEach((h,A)=>{if(l[A])if(l[A].set$)setTimeout(()=>{l[A].set$(h)});else for(let E in h)l[A][E]=h[E];else{u||(u=new DocumentFragment);let E=new i;Object.assign(E.init$,h),u.appendChild(E)}}),u&&e.appendChild(u);let _=l.slice(d.length,l.length);for(let h of _)h.remove()};if(o.constructor===Array)C(o);else if(o.constructor===Object){let d=[];for(let _ in o){let h=o[_];Object.defineProperty(h,"_KEY_",{value:_,enumerable:!0}),d.push(h)}C(d)}else console.warn("Symbiote repeat data type error:"),console.log(o)}),e.removeAttribute(a.REPEAT_ATTR),e.removeAttribute(a.REPEAT_ITEM_TAG_ATTR)})}var Y="__default__";function wt(t,s){if(s.shadowRoot)return;let e=[...t.querySelectorAll("slot")];if(!e.length)return;let r={};e.forEach(i=>{let n=i.getAttribute("name")||Y;r[n]={slot:i,fr:document.createDocumentFragment()}}),s.initChildren.forEach(i=>{var n;let o=Y;i instanceof Element&&i.hasAttribute("slot")&&(o=i.getAttribute("slot"),i.removeAttribute("slot")),(n=r[o])==null||n.fr.appendChild(i)}),Object.values(r).forEach(i=>{if(i.fr.childNodes.length)i.slot.parentNode.replaceChild(i.fr,i.slot);else if(i.slot.childNodes.length){let n=document.createDocumentFragment();n.append(...i.slot.childNodes),i.slot.parentNode.replaceChild(n,i.slot)}else i.slot.remove()})}function vt(t,s){[...t.querySelectorAll(`[${a.EL_REF_ATTR}]`)].forEach(e=>{let r=e.getAttribute(a.EL_REF_ATTR);s.ref[r]=e,e.removeAttribute(a.EL_REF_ATTR)})}function yt(t,s){[...t.querySelectorAll(`[${a.BIND_ATTR}]`)].forEach(e=>{let i=e.getAttribute(a.BIND_ATTR).split(";");[...e.attributes].forEach(n=>{if(n.name.startsWith("-")&&n.value){let o=Tt(n.name.replace("-",""));i.push(o+":"+n.value),e.removeAttribute(n.name)}}),i.forEach(n=>{if(!n)return;let o=n.split(":").map(d=>d.trim()),l=o[0],u;l.indexOf(a.ATTR_BIND_PRFX)===0&&(u=!0,l=l.replace(a.ATTR_BIND_PRFX,""));let C=o[1].split(",").map(d=>d.trim());for(let d of C){let _;d.startsWith("!!")?(_="double",d=d.replace("!!","")):d.startsWith("!")&&(_="single",d=d.replace("!","")),s.sub(d,h=>{_==="double"?h=!!h:_==="single"&&(h=!h),u?(h==null?void 0:h.constructor)===Boolean?h?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,h):Z(e,l,h)||(e[a.SET_LATER_KEY]||(e[a.SET_LATER_KEY]=Object.create(null)),e[a.SET_LATER_KEY][l]=h)})}}),e.removeAttribute(a.BIND_ATTR)})}var x="{{",v="}}",Ct="skip-text";function At(t){let s,e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:i=>{var n;return!((n=i.parentElement)!=null&&n.hasAttribute(Ct))&&i.textContent.includes(x)&&i.textContent.includes(v)&&1}});for(;s=r.nextNode();)e.push(s);return e}var xt=function(t,s){At(t).forEach(r=>{let i=[],n;for(;r.textContent.includes(v);)r.textContent.startsWith(x)?(n=r.textContent.indexOf(v)+v.length,r.splitText(n),i.push(r)):(n=r.textContent.indexOf(x),r.splitText(n)),r=r.nextSibling;i.forEach(o=>{let l=o.textContent.replace(x,"").replace(v,"");o.textContent="",s.sub(l,u=>{o.textContent=u})})})},St=[Et,wt,vt,yt,xt],S="'",b='"',Pt=/\\([0-9a-fA-F]{1,6} ?)/g;function $t(t){return(t[0]===b||t[0]===S)&&(t[t.length-1]===b||t[t.length-1]===S)}function Rt(t){return(t[0]===b||t[0]===S)&&(t=t.slice(1)),(t[t.length-1]===b||t[t.length-1]===S)&&(t=t.slice(0,-1)),t}function Ot(t){let s="",e="";for(var r=0;r<t.length;r++){let i=t[r+1];t[r]==="\\"&&i==='"'?(s+='\\"',r++):t[r]==='"'&&e!=="\\"?s+='\\"':s+=t[r],e=t[r]}return s}function It(t){let s=t;$t(t)&&(s=Rt(s),s=s.replace(Pt,(e,r)=>String.fromCodePoint(parseInt(r.trim(),16))),s=s.replaceAll(`\\
|
|
27
27
|
`,"\\n"),s=Ot(s),s=b+s+b);try{return JSON.parse(s)}catch{throw new Error(`Failed to parse CSS property value: ${s}. Original input: ${t}`)}}var J=0,g=null,p=null,f=class extends HTMLElement{constructor(){super(),L(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=this.__boundCssProps)==null||t.forEach(s=>{let e=this.getCssData(this.__extractCssName(s),!0);e!==null&&this.$[s]!==e&&(this.$[s]=e)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return f}initCallback(){}__initCallback(){var t;this.__initialized||(this.__initialized=!0,(t=this.initCallback)==null||t.call(this))}render(t,s=this.renderShadow){let e;if((s||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let i=this.getAttribute(a.USE_TPL);if(i){let n=this.getRootNode(),o=(n==null?void 0:n.querySelector(i))||document.querySelector(i);o?t=o.content.cloneNode(!0):console.warn(`Symbiote template "${i}" is not found...`)}}if(this.processInnerHtml)for(let i of this.tplProcessors)i(this,this);if(t||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(t==null?void 0:t.constructor)===DocumentFragment)e=t;else if((t==null?void 0:t.constructor)===String){let i=document.createElement("template");i.innerHTML=t,e=i.content.cloneNode(!0)}else this.constructor.__tpl&&(e=this.constructor.__tpl.content.cloneNode(!0));for(let i of this.tplProcessors)i(e,this)}let r=()=>{e&&(s&&this.shadowRoot.appendChild(e)||this.appendChild(e)),this.__initCallback()};if(this.constructor.__shadowStylesUrl){s=!0;let i=document.createElement("link");i.rel="stylesheet",i.href=this.constructor.__shadowStylesUrl,i.onload=r,this.shadowRoot.prepend(i)}else r()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=bt.generate(),this.style.setProperty(a.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(a.CSS_CTX_PROP,!0)}get ctxName(){var t;let s=((t=this.getAttribute(a.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=s,s}get localCtx(){return this.__localCtx||(this.__localCtx=c.registerCtx({},this)),this.__localCtx}get nodeCtx(){return c.getCtx(this.ctxName,!1)||c.registerCtx({},this.ctxName)}static __parseProp(t,s){let e,r;if(t.startsWith(a.EXT_DATA_CTX_PRFX))e=s.nodeCtx,r=t.replace(a.EXT_DATA_CTX_PRFX,"");else if(t.includes(a.NAMED_DATA_CTX_SPLTR)){let i=t.split(a.NAMED_DATA_CTX_SPLTR);e=c.getCtx(i[0]),r=i[1]}else e=s.localCtx,r=t;return{ctx:e,name:r}}sub(t,s,e=!0){let r=n=>{this.isConnected&&s(n)},i=f.__parseProp(t,this);i.ctx.has(i.name)?this.allSubs.add(i.ctx.sub(i.name,r,e)):window.setTimeout(()=>{this.allSubs.add(i.ctx.sub(i.name,r,e))})}notify(t){let s=f.__parseProp(t,this);s.ctx.notify(s.name)}has(t){let s=f.__parseProp(t,this);return s.ctx.has(s.name)}add(t,s,e=!1){let r=f.__parseProp(t,this);r.ctx.add(r.name,s,e)}add$(t,s=!1){for(let e in t)this.add(e,t[e],s)}get $(){if(!this.__stateProxy){let t=Object.create(null);this.__stateProxy=new Proxy(t,{set:(s,e,r)=>{let i=f.__parseProp(e,this);return i.ctx.pub(i.name,r),!0},get:(s,e)=>{let r=f.__parseProp(e,this);return r.ctx.read(r.name)}})}return this.__stateProxy}set$(t,s=!1){for(let e in t){let r=t[e];s||![String,Number,Boolean].includes(r==null?void 0:r.constructor)?this.$[e]=r:this.$[e]!==r&&(this.$[e]=r)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(a.CTX_OWNER_ATTR)&&this.getAttribute(a.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let t=this.constructor.__attrDesc;if(t)for(let s of Object.values(t))Object.keys(this.init$).includes(s)||(this.init$[s]="");for(let s in this.init$)if(s.startsWith(a.EXT_DATA_CTX_PRFX))this.nodeCtx.add(s.replace(a.EXT_DATA_CTX_PRFX,""),this.init$[s],this.__ctxOwner);else if(s.includes(a.NAMED_DATA_CTX_SPLTR)){let e=s.split(a.NAMED_DATA_CTX_SPLTR),r=e[0].trim(),i=e[1].trim();if(r&&i){let n=c.getCtx(r,!1);n||(n=c.registerCtx({},r)),n.add(i,this.init$[s])}}else this.localCtx.add(s,this.init$[s]);for(let s in this.cssInit$)this.bindCssData(s,this.cssInit$[s]);this.__dataCtxInitialized=!0}connectedCallback(){var t;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let s=(t=this.getAttribute(a.CTX_NAME_ATTR))==null?void 0:t.trim();if(s&&this.style.setProperty(a.CSS_CTX_PROP,`'${s}'`),this.__initDataCtx(),this[a.SET_LATER_KEY]){for(let e in this[a.SET_LATER_KEY])Z(this,e,this[a.SET_LATER_KEY][e]);delete this[a.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let e of St)this.addTemplateProcessor(e);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let e=this.getRootNode();if(!e)return;if(e==null?void 0:e.querySelector(`link[${a.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let i=this.constructor.__rootStylesLink.cloneNode(!0);i.setAttribute(a.ROOT_STYLE_ATTR_NAME,this.constructor.is),i.onload=()=>{this.render()},e.nodeType===Node.DOCUMENT_NODE?e.head.appendChild(i):e.prepend(i)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);for(let t of this.tplProcessors)this.tplProcessors.delete(t);p==null||p.delete(this.updateCssData),p!=null&&p.size||(g==null||g.disconnect(),g=null,p=null)},100)))}static reg(t,s=!1){t||(J++,t=`${a.AUTO_TAG_PRFX}-${J}`),this.__tag=t;let e=window.customElements.get(t);if(e){!s&&e!==this&&console.warn([`Element with tag name "${t}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
|
|
28
|
-
`));return}window.customElements.define(t,s?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,s,e){var r;if(s===e)return;let i=(r=this.constructor.__attrDesc)==null?void 0:r[t];i?this.__dataCtxInitialized?this.$[i]=e:this.init$[i]=e:this[t]=e}getCssData(t,s=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let e=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=It(e)}catch{!s&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((s,e)=>e===0?"":s).join("--")}__initStyleAttrObserver(){p||(p=new Set),p.add(this.updateCssData),g||(g=new MutationObserver(t=>{t[0].type==="attributes"&&p.forEach(s=>{s()})}),g.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,s=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let e=this.getCssData(this.__extractCssName(t),!0);e===null&&(e=s),this.add(t,e),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,s,e){let r="__"+t;this[r]=this[t],Object.defineProperty(this,t,{set:i=>{this[r]=i,e?window.setTimeout(()=>{s==null||s(i)}):s==null||s(i)},get:()=>this[r]}),this[t]=this[r]}static set shadowStyles(t){let s=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(s)}static set rootStyles(t){if(!this.__rootStylesLink){let s=new Blob([t],{type:"text/css"}),e=URL.createObjectURL(s),r=document.createElement("link");r.href=e,r.rel="stylesheet",this.__rootStylesLink=r}}},U=f;L(U,"template");var N=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let s in this.appMap)!this.defaultRoute&&this.appMap[s].default===!0?this.defaultRoute=s:!this.errorRoute&&this.appMap[s].error===!0&&(this.errorRoute=s)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(e=>{if(e.includes("?"))t.route=e.replace("?","");else if(e.includes("=")){let r=e.split("=");t.options[r[0]]=decodeURI(r[1])}else t.options[e]=!0}),t}static notify(){let t=this.readAddressBar(),s=this.appMap[t.route];if(s&&s.title&&(document.title=s.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!s&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!s&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!s){this._print(`Route "${t.route}" not found...`);return}let e=new CustomEvent(N.routingEventName,{detail:{route:t.route,options:Object.assign(s||{},t.options)}});window.dispatchEvent(e)}static reflect(t,s={}){let e=this.appMap[t];if(!e){this._print("Wrong route: "+t);return}let r="?"+t;for(let n in s)s[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${s[n]}`;let i=e.title||this.defaultTitle||"";window.history.pushState(null,i,r),document.title=i}static applyRoute(t,s={}){this.reflect(t,s),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,s){this.setRoutingMap(s);let e=c.registerCtx({route:null,options:null,title:null},t);return window.addEventListener(this.routingEventName,r=>{var i;e.multiPub({route:r.detail.route,options:r.detail.options,title:((i=r.detail.options)==null?void 0:i.title)||this.defaultTitle||""})}),N.notify(),this.initPopstateListener(),e}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};N.appMap=Object.create(null);var tt="idb-store-ready",Dt="symbiote-db",Nt="symbiote-idb-update_",Lt=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(tt,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return Nt+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,s){this.name=t,this.storeName=s,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=e=>{this.db=e.target.result,this.objStore=this.db.createObjectStore(s,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=e=>{this.db=e.target.result,this._notifyWhenReady(e)},this.request.onerror=e=>{console.error(e)},this._subscriptionsMap={},this._updateHandler=e=>{e.key===this.name&&this._subscriptionsMap[e.newValue]&&this._subscriptionsMap[e.newValue].forEach(async i=>{i(await this.read(e.newValue))})},this._localUpdateHandler=e=>{this._updateHandler(e.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(t){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((r,i)=>{e.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${t}"`))},e.onerror=n=>{i(n)}})}write(t,s,e=!1){let r={_key:t,_value:s},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((o,l)=>{n.onsuccess=u=>{e||this._notifySubscribers(t),o(u.target.result)},n.onerror=u=>{l(u)}})}delete(t,s=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((i,n)=>{r.onsuccess=o=>{s||this._notifySubscribers(t),i(o)},r.onerror=o=>{n(o)}})}getAll(){let s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((e,r)=>{s.onsuccess=i=>{let n=i.target.result;e(n.map(o=>o._value))},s.onerror=i=>{r(i)}})}subscribe(t,s){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let e=this._subscriptionsMap[t];return e.add(s),{remove:()=>{e.delete(s),e.size||delete this._subscriptionsMap[t]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,et.clear(this.name)}},et=class{static get readyEventName(){return tt}static open(t=Dt,s="store"){let e=t+"/"+s;return this._reg[e]||(this._reg[e]=new Lt(t,s)),this._reg[e]}static clear(t){window.indexedDB.deleteDatabase(t);for(let s in this._reg)s.split("/")[0]===t&&delete this._reg[s]}};L(et,"_reg",Object.create(null));var Ut="https://ucarecdn.com",y=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ut},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var T="--uc-img-",M="unresolved";var k=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),X=3e3,B=5e3,F=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var st="blocks",rt="1.19.4";var nt=Object.create(null),it;for(let t in y)nt[T+t]=((it=y[t])==null?void 0:it.default)||"";var P=class extends U{constructor(){super(...arguments);w(this,"cssInit$",nt)}$$(e){return this.$[T+e]}set$$(e){for(let r in e)this.$[T+r]=e[r]}sub$$(e,r){this.sub(T+e,i=>{i===null||i===""||r(i)})}analyticsParams(){return`-/@clib/${st}/${rt}/uc-img/`}initAttributes(e){[...this.attributes].forEach(r=>{y[r.name]||e.setAttribute(r.name,r.value)})}initIntersection(e,r){let i={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(r(),this._isnObserver.unobserve(e))})},i),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),c.deleteCtx(this)}static get observedAttributes(){return Object.keys(y)}attributeChangedCallback(e,r,i){window.setTimeout(()=>{this.$[T+e]=i})}};var O=class extends P{constructor(){super(...arguments);w(this,"_img",new Image);w(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!k&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let r=e.match(/\d+/)[0],i=e.match(/[a-zA-Z]+/)[0],n=parseInt(r,10);if(Number(n)>B&&this.hasFormatJPG)return B+i;if(Number(n)>X&&!this.hasFormatJPG)return X+i}return e}_getCdnModifiers(e,r){let i={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:r,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return W(...G(i))}_getUrlBase(e="",r=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(k&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let i=this._getCdnModifiers(e,r);if(this.$$("src").startsWith(this.$$("cdn-cname")))return m(this.$$("src"),i);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(m(D(this.$$("cdn-cname"),this.$$("uuid")),i));if(this.$$("uuid"))return this._proxyUrl(m(D(this.$$("cdn-cname"),this.$$("uuid")),i));if(this.$$("proxy-cname"))return this._proxyUrl(m(this.$$("proxy-cname"),i,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(m(`https://${this.$$("pubkey")}.ucr.io/`,i,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?j(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}_getElSize(e,r=1,i=!0){let n=e.getBoundingClientRect(),o=r*Math.round(n.width),l=i?"":r*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(e){let r=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},i=["load","error"];for(let n of i)e.addEventListener(n,r)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:F.PREVIEW,img:this._imgPreview}:{type:F.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=q(this.$$("breakpoints"));return V(e.map(r=>parseInt(r,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let r=new Set;r.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&r.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&r.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let i=`image-set(${[...r].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image","-webkit-"+i)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(r=>{e.add(this._getUrlBase(r+"x")+` ${this._validateSize(r+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(r*2+"x")+` ${this._validateSize(r*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(r*3+"x")+` ${this._validateSize(r*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:r,srcset:i}){r&&(e.src=r),i&&(e.srcset=i)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:r,elNode:i}){return new Promise((n,o)=>{this._setupConfigForImage({elNode:i}),i.setAttribute(M,""),i.addEventListener("load",()=>{i.removeAttribute(M),n(i)}),i.addEventListener("error",()=>{o(!1)}),this._appendURL({elNode:i,src:e,srcset:r})})}async renderImage(){var e,r;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var i;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var I=class extends O{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",s=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=s?"lazy":"eager")})}};I.reg("uc-img");export{I as Img};
|
|
28
|
+
`));return}window.customElements.define(t,s?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=Object.keys(t),this.__attrDesc=t}attributeChangedCallback(t,s,e){var r;if(s===e)return;let i=(r=this.constructor.__attrDesc)==null?void 0:r[t];i?this.__dataCtxInitialized?this.$[i]=e:this.init$[i]=e:this[t]=e}getCssData(t,s=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(t)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let e=this.__computedStyle.getPropertyValue(t).trim();try{this.__cssDataCache[t]=It(e)}catch{!s&&console.warn(`CSS Data error: ${t}`),this.__cssDataCache[t]=null}}return this.__cssDataCache[t]}__extractCssName(t){return t.split("--").map((s,e)=>e===0?"":s).join("--")}__initStyleAttrObserver(){p||(p=new Set),p.add(this.updateCssData),g||(g=new MutationObserver(t=>{t[0].type==="attributes"&&p.forEach(s=>{s()})}),g.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(t,s=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(t);let e=this.getCssData(this.__extractCssName(t),!0);e===null&&(e=s),this.add(t,e),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(t,s,e){let r="__"+t;this[r]=this[t],Object.defineProperty(this,t,{set:i=>{this[r]=i,e?window.setTimeout(()=>{s==null||s(i)}):s==null||s(i)},get:()=>this[r]}),this[t]=this[r]}static set shadowStyles(t){let s=new Blob([t],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(s)}static set rootStyles(t){if(!this.__rootStylesLink){let s=new Blob([t],{type:"text/css"}),e=URL.createObjectURL(s),r=document.createElement("link");r.href=e,r.rel="stylesheet",this.__rootStylesLink=r}}},U=f;L(U,"template");var N=class{static _print(t){console.warn(t)}static setDefaultTitle(t){this.defaultTitle=t}static setRoutingMap(t){Object.assign(this.appMap,t);for(let s in this.appMap)!this.defaultRoute&&this.appMap[s].default===!0?this.defaultRoute=s:!this.errorRoute&&this.appMap[s].error===!0&&(this.errorRoute=s)}static set routingEventName(t){this.__routingEventName=t}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let t={route:null,options:{}};return window.location.search.split(this.separator).forEach(e=>{if(e.includes("?"))t.route=e.replace("?","");else if(e.includes("=")){let r=e.split("=");t.options[r[0]]=decodeURI(r[1])}else t.options[e]=!0}),t}static notify(){let t=this.readAddressBar(),s=this.appMap[t.route];if(s&&s.title&&(document.title=s.title),t.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!s&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!s&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!s){this._print(`Route "${t.route}" not found...`);return}let e=new CustomEvent(N.routingEventName,{detail:{route:t.route,options:Object.assign(s||{},t.options)}});window.dispatchEvent(e)}static reflect(t,s={}){let e=this.appMap[t];if(!e){this._print("Wrong route: "+t);return}let r="?"+t;for(let n in s)s[n]===!0?r+=this.separator+n:r+=this.separator+n+`=${s[n]}`;let i=e.title||this.defaultTitle||"";window.history.pushState(null,i,r),document.title=i}static applyRoute(t,s={}){this.reflect(t,s),this.notify()}static setSeparator(t){this._separator=t}static get separator(){return this._separator||"&"}static createRouterData(t,s){this.setRoutingMap(s);let e=c.registerCtx({route:null,options:null,title:null},t);return window.addEventListener(this.routingEventName,r=>{var i;e.multiPub({route:r.detail.route,options:r.detail.options,title:((i=r.detail.options)==null?void 0:i.title)||this.defaultTitle||""})}),N.notify(),this.initPopstateListener(),e}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}};N.appMap=Object.create(null);var tt="idb-store-ready",Dt="symbiote-db",Nt="symbiote-idb-update_",Lt=class{_notifyWhenReady(t=null){window.dispatchEvent(new CustomEvent(tt,{detail:{dbName:this.name,storeName:this.storeName,event:t}}))}get _updEventName(){return Nt+this.name}_getUpdateEvent(t){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:t}})}_notifySubscribers(t){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,t),window.dispatchEvent(this._getUpdateEvent(t))}constructor(t,s){this.name=t,this.storeName=s,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=e=>{this.db=e.target.result,this.objStore=this.db.createObjectStore(s,{keyPath:"_key"}),this.objStore.transaction.oncomplete=r=>{this._notifyWhenReady(r)}},this.request.onsuccess=e=>{this.db=e.target.result,this._notifyWhenReady(e)},this.request.onerror=e=>{console.error(e)},this._subscriptionsMap={},this._updateHandler=e=>{e.key===this.name&&this._subscriptionsMap[e.newValue]&&this._subscriptionsMap[e.newValue].forEach(async i=>{i(await this.read(e.newValue))})},this._localUpdateHandler=e=>{this._updateHandler(e.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(t){let e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(t);return new Promise((r,i)=>{e.onsuccess=n=>{var o;(o=n.target.result)!=null&&o._value?r(n.target.result._value):(r(null),console.warn(`IDB: cannot read "${t}"`))},e.onerror=n=>{i(n)}})}write(t,s,e=!1){let r={_key:t,_value:s},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(r);return new Promise((o,l)=>{n.onsuccess=u=>{e||this._notifySubscribers(t),o(u.target.result)},n.onerror=u=>{l(u)}})}delete(t,s=!1){let r=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(t);return new Promise((i,n)=>{r.onsuccess=o=>{s||this._notifySubscribers(t),i(o)},r.onerror=o=>{n(o)}})}getAll(){let s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((e,r)=>{s.onsuccess=i=>{let n=i.target.result;e(n.map(o=>o._value))},s.onerror=i=>{r(i)}})}subscribe(t,s){this._subscriptionsMap[t]||(this._subscriptionsMap[t]=new Set);let e=this._subscriptionsMap[t];return e.add(s),{remove:()=>{e.delete(s),e.size||delete this._subscriptionsMap[t]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,et.clear(this.name)}},et=class{static get readyEventName(){return tt}static open(t=Dt,s="store"){let e=t+"/"+s;return this._reg[e]||(this._reg[e]=new Lt(t,s)),this._reg[e]}static clear(t){window.indexedDB.deleteDatabase(t);for(let s in this._reg)s.split("/")[0]===t&&delete this._reg[s]}};L(et,"_reg",Object.create(null));var Ut="https://ucarecdn.com",y=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:Ut},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var T="--uc-img-",M="unresolved";var k=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),X=3e3,B=5e3,F=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var st="blocks",rt="1.20.0";var nt=Object.create(null),it;for(let t in y)nt[T+t]=((it=y[t])==null?void 0:it.default)||"";var P=class extends U{constructor(){super(...arguments);w(this,"cssInit$",nt)}$$(e){return this.$[T+e]}set$$(e){for(let r in e)this.$[T+r]=e[r]}sub$$(e,r){this.sub(T+e,i=>{i===null||i===""||r(i)})}analyticsParams(){return`-/@clib/${st}/${rt}/uc-img/`}initAttributes(e){[...this.attributes].forEach(r=>{y[r.name]||e.setAttribute(r.name,r.value)})}initIntersection(e,r){let i={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&(r(),this._isnObserver.unobserve(e))})},i),this._isnObserver.observe(e),this._observed||(this._observed=new Set),this._observed.add(e)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(e=>{this._isnObserver.unobserve(e)}),this._isnObserver=null),c.deleteCtx(this)}static get observedAttributes(){return Object.keys(y)}attributeChangedCallback(e,r,i){window.setTimeout(()=>{this.$[T+e]=i})}};var O=class extends P{constructor(){super(...arguments);w(this,"_img",new Image);w(this,"_imgPreview",new Image)}_fmtAbs(e){return!e.includes("//")&&!k&&(e=new URL(e,document.baseURI).href),e}_validateSize(e){if((e==null?void 0:e.trim())!==""){let r=e.match(/\d+/)[0],i=e.match(/[a-zA-Z]+/)[0],n=parseInt(r,10);if(Number(n)>B&&this.hasFormatJPG)return B+i;if(Number(n)>X&&!this.hasFormatJPG)return X+i}return e}_getCdnModifiers(e,r){let i={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(e),blur:r,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return W(...G(i))}_getUrlBase(e="",r=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(k&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let i=this._getCdnModifiers(e,r);if(this.$$("src").startsWith(this.$$("cdn-cname")))return m(this.$$("src"),i);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(m(D(this.$$("cdn-cname"),this.$$("uuid")),i));if(this.$$("uuid"))return this._proxyUrl(m(D(this.$$("cdn-cname"),this.$$("uuid")),i));if(this.$$("proxy-cname"))return this._proxyUrl(m(this.$$("proxy-cname"),i,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(m(`https://${this.$$("pubkey")}.ucr.io/`,i,this._fmtAbs(this.$$("src"))))}_proxyUrl(e){return this.$$("secure-delivery-proxy")?j(this.$$("secure-delivery-proxy"),{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}_getElSize(e,r=1,i=!0){let n=e.getBoundingClientRect(),o=r*Math.round(n.width),l=i?"":r*Math.round(n.height);return o||l?`${o||""}x${l||""}`:null}_setupEventProxy(e){let r=n=>{n.stopPropagation();let o=new Event(n.type,n);this.dispatchEvent(o)},i=["load","error"];for(let n of i)e.addEventListener(n,r)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:F.PREVIEW,img:this._imgPreview}:{type:F.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let e=q(this.$$("breakpoints"));return V(e.map(r=>parseInt(r,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(e){let r=new Set;r.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`),this.$$("hi-res-support")&&r.add(`url("${this._getUrlBase(this._getElSize(e,2))}") ${2}x`),this.$$("ultra-res-support")&&r.add(`url("${this._getUrlBase(this._getElSize(e,3))}") ${3}x`);let i=`image-set(${[...r].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image","-webkit-"+i)}getSrcset(){let e=new Set;return this.breakpoints?this.breakpoints.forEach(r=>{e.add(this._getUrlBase(r+"x")+` ${this._validateSize(r+"w")}`),this.$$("hi-res-support")&&e.add(this._getUrlBase(r*2+"x")+` ${this._validateSize(r*2+"w")}`),this.$$("ultra-res-support")&&e.add(this._getUrlBase(r*3+"x")+` ${this._validateSize(r*3+"w")}`)}):(e.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&e.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...e].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:e,src:r,srcset:i}){r&&(e.src=r),i&&(e.srcset=i)}_setupConfigForImage({elNode:e}){this._setupEventProxy(e),this.initAttributes(e)}loaderImage({src:e,srcset:r,elNode:i}){return new Promise((n,o)=>{this._setupConfigForImage({elNode:i}),i.setAttribute(M,""),i.addEventListener("load",()=>{i.removeAttribute(M),n(i)}),i.addEventListener("error",()=>{o(!1)}),this._appendURL({elNode:i,src:e,srcset:r})})}async renderImage(){var e,r;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var i;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((i=this._imgPreview)==null?void 0:i.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((r=this._imgPreview)==null?void 0:r.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var I=class extends O{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",s=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=s?"lazy":"eager")})}};I.reg("uc-img");export{I as Img};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class SecureUploadsManager {
|
|
2
|
-
/** @param {import('../UploaderBlock.js').UploaderBlock} block */
|
|
3
|
-
constructor(block: import("../UploaderBlock.js").UploaderBlock);
|
|
4
|
-
/**
|
|
5
|
-
* @private
|
|
6
|
-
* @type {import('../UploaderBlock.js').UploaderBlock}
|
|
7
|
-
*/
|
|
8
|
-
private _block;
|
|
9
|
-
/**
|
|
10
|
-
* @private
|
|
11
|
-
* @type {import('../../types/index.js').SecureUploadsSignatureAndExpire | null}
|
|
12
|
-
*/
|
|
13
|
-
private _secureToken;
|
|
14
|
-
/**
|
|
15
|
-
* @private
|
|
16
|
-
* @param {unknown[]} args
|
|
17
|
-
*/
|
|
18
|
-
private _debugPrint;
|
|
19
|
-
/** @returns {Promise<import('../../types/index.js').SecureUploadsSignatureAndExpire | null>} */
|
|
20
|
-
getSecureToken(): Promise<import("../../types/index.js").SecureUploadsSignatureAndExpire | null>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=SecureUploadsManager.d.ts.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/** @typedef {import('@uploadcare/quality-insights').TelemetryRequest & { eventTimestamp: number }} TelemetryState */
|
|
2
|
-
export class TelemetryManager {
|
|
3
|
-
/** @param {import('../Block.js').Block} block */
|
|
4
|
-
constructor(block: import("../Block.js").Block);
|
|
5
|
-
/** @type {ReturnType<Crypto['randomUUID']>} */
|
|
6
|
-
_sessionId: ReturnType<Crypto["randomUUID"]>;
|
|
7
|
-
/** @type {TelemetryAPIService | null} */
|
|
8
|
-
_telemetryInstance: TelemetryAPIService | null;
|
|
9
|
-
/** @type {import('../Block.js').Block | null} */
|
|
10
|
-
_block: import("../Block.js").Block | null;
|
|
11
|
-
_config: import("../../types").ConfigType;
|
|
12
|
-
/** @type {boolean} */
|
|
13
|
-
_initialized: boolean;
|
|
14
|
-
/** @type {TelemetryState | null} */
|
|
15
|
-
_lastPayload: TelemetryState | null;
|
|
16
|
-
/** @type {import('@uploadcare/upload-client').Queue | null} */
|
|
17
|
-
_queue: import("@uploadcare/upload-client").Queue | null;
|
|
18
|
-
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
19
|
-
_init(type: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload | undefined): void;
|
|
20
|
-
/**
|
|
21
|
-
* @template {keyof import('../../types').ConfigType} T
|
|
22
|
-
* @param {T} key
|
|
23
|
-
* @param {import('../../types').ConfigType[T]} value
|
|
24
|
-
*/
|
|
25
|
-
_setConfig<T extends keyof import("../../types").ConfigType>(key: T, value: import("../../types").ConfigType[T]): void;
|
|
26
|
-
/**
|
|
27
|
-
* @param {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} body
|
|
28
|
-
* @returns {TelemetryState}
|
|
29
|
-
*/
|
|
30
|
-
_formattingPayload(body: Pick<TelemetryState, "eventType" | "payload" | "config">): TelemetryState;
|
|
31
|
-
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
32
|
-
_excludedEvents(type: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload | undefined): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @param {Partial<Pick<TelemetryState, 'eventType' | 'payload'>> & {
|
|
35
|
-
* modalId?: string;
|
|
36
|
-
* eventType?: keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload;
|
|
37
|
-
* }} body
|
|
38
|
-
*/
|
|
39
|
-
sendEvent(body: Partial<Pick<TelemetryState, "eventType" | "payload">> & {
|
|
40
|
-
modalId?: string;
|
|
41
|
-
eventType?: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload;
|
|
42
|
-
}): null | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Method to send telemetry event for Cloud Image Editor.
|
|
45
|
-
*
|
|
46
|
-
* @param {MouseEvent} e
|
|
47
|
-
* @param {string} tabId
|
|
48
|
-
* @param {Record<string, unknown>} options
|
|
49
|
-
*/
|
|
50
|
-
sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
|
|
51
|
-
/**
|
|
52
|
-
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
53
|
-
*
|
|
54
|
-
* @param {any} last
|
|
55
|
-
* @param {any} current
|
|
56
|
-
*/
|
|
57
|
-
_checkObj(last: any, current: any): boolean;
|
|
58
|
-
get _timestamp(): number;
|
|
59
|
-
get _solution(): any;
|
|
60
|
-
get _activity(): any;
|
|
61
|
-
}
|
|
62
|
-
export type TelemetryState = import("@uploadcare/quality-insights").TelemetryRequest & {
|
|
63
|
-
eventTimestamp: number;
|
|
64
|
-
};
|
|
65
|
-
import { TelemetryAPIService } from '@uploadcare/quality-insights';
|
|
66
|
-
//# sourceMappingURL=TelemetryManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TelemetryManager.d.ts","sourceRoot":"","sources":["TelemetryManager.js"],"names":[],"mappings":"AAQA,qHAAqH;AAErH;IAqBE,iDAAiD;IACjD,mBADY,OAAO,aAAa,EAAE,KAAK,EAiBtC;IArCD,+CAA+C;IAC/C,YADW,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CACV;IAEjC,yCAAyC;IACzC,oBADW,mBAAmB,GAAG,IAAI,CACX;IAE1B,iDAAiD;IACjD,QADW,OAAO,aAAa,EAAE,KAAK,GAAG,IAAI,CAC/B;IAEd,0CAAwB;IAExB,sBAAsB;IACtB,cADW,OAAO,CACG;IAErB,oCAAoC;IACpC,cADW,cAAc,GAAG,IAAI,CACZ;IAEpB,+DAA+D;IAC/D,QADW,OAAO,2BAA2B,EAAE,KAAK,GAAG,IAAI,CAC7C;IAqBd,4GAA4G;IAC5G,YADY,MAAM,OAAO,gDAAgD,EAAE,YAAY,GAAG,SAAS,QAKlG;IAED;;;;OAIG;IACH,WAJsD,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,OAC1C,CAAC,SACD,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,QAQ7C;IAED;;;OAGG;IACH,yBAHW,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC,GACtD,cAAc,CA4B1B;IAED,4GAA4G;IAC5G,sBADY,MAAM,OAAO,gDAAgD,EAAE,YAAY,GAAG,SAAS,WAqBlG;IAED;;;;;OAKG;IACH,gBALW,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC,GAAG;QAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,OAAO,gDAAgD,EAAE,YAAY,CAAC;KACzF,oBAmBH;IAED;;;;;;OAMG;IACH,6BAJW,UAAU,SACV,MAAM,YACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAajC;IAED;;;;;OAKG;IACH,gBAHW,GAAG,WACH,GAAG,WAcb;IAED,yBAEC;IAED,qBAEC;IAED,qBAEC;CACF;6BAjMa,OAAO,8BAA8B,EAAE,gBAAgB,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE;oCAP9D,8BAA8B"}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { TelemetryAPIService } from '@uploadcare/quality-insights';
|
|
3
|
-
|
|
4
|
-
import { Queue } from '@uploadcare/upload-client';
|
|
5
|
-
import { PACKAGE_VERSION, PACKAGE_NAME } from '../../env.js';
|
|
6
|
-
import { initialConfig } from '../../blocks/Config/initialConfig.js';
|
|
7
|
-
import { EventType } from '../../blocks/UploadCtxProvider/EventEmitter.js';
|
|
8
|
-
|
|
9
|
-
/** @typedef {import('@uploadcare/quality-insights').TelemetryRequest & { eventTimestamp: number }} TelemetryState */
|
|
10
|
-
|
|
11
|
-
export class TelemetryManager {
|
|
12
|
-
/** @type {ReturnType<Crypto['randomUUID']>} */
|
|
13
|
-
_sessionId = crypto.randomUUID();
|
|
14
|
-
|
|
15
|
-
/** @type {TelemetryAPIService | null} */
|
|
16
|
-
_telemetryInstance = null;
|
|
17
|
-
|
|
18
|
-
/** @type {import('../Block.js').Block | null} */
|
|
19
|
-
_block = null;
|
|
20
|
-
|
|
21
|
-
_config = initialConfig;
|
|
22
|
-
|
|
23
|
-
/** @type {boolean} */
|
|
24
|
-
_initialized = false;
|
|
25
|
-
|
|
26
|
-
/** @type {TelemetryState | null} */
|
|
27
|
-
_lastPayload = null;
|
|
28
|
-
|
|
29
|
-
/** @type {import('@uploadcare/upload-client').Queue | null} */
|
|
30
|
-
_queue = null;
|
|
31
|
-
|
|
32
|
-
/** @param {import('../Block.js').Block} block */
|
|
33
|
-
constructor(block) {
|
|
34
|
-
this._block = block;
|
|
35
|
-
|
|
36
|
-
this._telemetryInstance = new TelemetryAPIService();
|
|
37
|
-
|
|
38
|
-
this._queue = new Queue(10);
|
|
39
|
-
|
|
40
|
-
for (const key of /** @type {(keyof import('../../types/exported').ConfigType)[]} */ (Object.keys(initialConfig))) {
|
|
41
|
-
block.subConfigValue(key, (value) => {
|
|
42
|
-
if (this._initialized && this._config[key] !== value) {
|
|
43
|
-
this._block?.emit(EventType.CHANGE_CONFIG, undefined);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this._setConfig(key, value);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
52
|
-
_init(type) {
|
|
53
|
-
if (type === EventType.INIT_SOLUTION && !this._initialized) {
|
|
54
|
-
this._initialized = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @template {keyof import('../../types').ConfigType} T
|
|
60
|
-
* @param {T} key
|
|
61
|
-
* @param {import('../../types').ConfigType[T]} value
|
|
62
|
-
*/
|
|
63
|
-
_setConfig(key, value) {
|
|
64
|
-
if (this._config[key] === value) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this._config[key] = value;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @param {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} body
|
|
73
|
-
* @returns {TelemetryState}
|
|
74
|
-
*/
|
|
75
|
-
_formattingPayload(body) {
|
|
76
|
-
const payload = body.payload ? { ...body.payload } : {};
|
|
77
|
-
if (payload.activity) payload.activity = undefined;
|
|
78
|
-
|
|
79
|
-
const result = { ...body };
|
|
80
|
-
if (body.eventType === EventType.INIT_SOLUTION || body.eventType === EventType.CHANGE_CONFIG) {
|
|
81
|
-
result.config = this._config;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
...result,
|
|
86
|
-
|
|
87
|
-
appVersion: PACKAGE_VERSION,
|
|
88
|
-
appName: PACKAGE_NAME,
|
|
89
|
-
sessionId: this._sessionId,
|
|
90
|
-
component: this._solution,
|
|
91
|
-
activity: this._activity,
|
|
92
|
-
projectPubkey: this._config?.pubkey,
|
|
93
|
-
userAgent: navigator.userAgent,
|
|
94
|
-
eventType: result.eventType ?? '',
|
|
95
|
-
eventTimestamp: this._timestamp,
|
|
96
|
-
|
|
97
|
-
payload: {
|
|
98
|
-
...payload,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
104
|
-
_excludedEvents(type) {
|
|
105
|
-
if (
|
|
106
|
-
type &&
|
|
107
|
-
[
|
|
108
|
-
EventType.CHANGE,
|
|
109
|
-
EventType.COMMON_UPLOAD_PROGRESS,
|
|
110
|
-
EventType.FILE_ADDED,
|
|
111
|
-
EventType.FILE_REMOVED,
|
|
112
|
-
EventType.FILE_UPLOAD_START,
|
|
113
|
-
EventType.FILE_UPLOAD_PROGRESS,
|
|
114
|
-
EventType.FILE_UPLOAD_SUCCESS,
|
|
115
|
-
EventType.FILE_UPLOAD_FAILED,
|
|
116
|
-
EventType.FILE_URL_CHANGED,
|
|
117
|
-
EventType.GROUP_CREATED,
|
|
118
|
-
].includes(type)
|
|
119
|
-
) {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @param {Partial<Pick<TelemetryState, 'eventType' | 'payload'>> & {
|
|
128
|
-
* modalId?: string;
|
|
129
|
-
* eventType?: keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload;
|
|
130
|
-
* }} body
|
|
131
|
-
*/
|
|
132
|
-
sendEvent(body) {
|
|
133
|
-
const payload = this._formattingPayload(
|
|
134
|
-
/** @type {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} */ (body),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
this._init(body.eventType);
|
|
138
|
-
|
|
139
|
-
const hasExcludedEvents = this._excludedEvents(body.eventType);
|
|
140
|
-
if (hasExcludedEvents) return null;
|
|
141
|
-
|
|
142
|
-
const hasDataSame = this._lastPayload && this._checkObj(this._lastPayload, payload);
|
|
143
|
-
if (hasDataSame) return null;
|
|
144
|
-
|
|
145
|
-
this._queue?.add(async () => {
|
|
146
|
-
this._lastPayload = payload;
|
|
147
|
-
await this._telemetryInstance?.sendEvent(/** @type {TelemetryState} */ (payload));
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Method to send telemetry event for Cloud Image Editor.
|
|
153
|
-
*
|
|
154
|
-
* @param {MouseEvent} e
|
|
155
|
-
* @param {string} tabId
|
|
156
|
-
* @param {Record<string, unknown>} options
|
|
157
|
-
*/
|
|
158
|
-
sendEventCloudImageEditor(e, tabId, options = {}) {
|
|
159
|
-
this.sendEvent({
|
|
160
|
-
payload: {
|
|
161
|
-
metadata: {
|
|
162
|
-
tabId,
|
|
163
|
-
node: /** @type {HTMLElement} */ (e.currentTarget)?.tagName,
|
|
164
|
-
event: e.type,
|
|
165
|
-
...options,
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
173
|
-
*
|
|
174
|
-
* @param {any} last
|
|
175
|
-
* @param {any} current
|
|
176
|
-
*/
|
|
177
|
-
_checkObj(last, current) {
|
|
178
|
-
if (JSON.stringify(last) === JSON.stringify(current)) return true;
|
|
179
|
-
if (typeof last !== 'object' || typeof current !== 'object' || last == null || current == null) return false;
|
|
180
|
-
const lastKeys = Object.keys(last);
|
|
181
|
-
const currentKeys = Object.keys(current);
|
|
182
|
-
if (lastKeys.length !== currentKeys.length) return false;
|
|
183
|
-
for (const key of lastKeys) {
|
|
184
|
-
if (!Object.prototype.hasOwnProperty.call(current, key)) return false;
|
|
185
|
-
if (!this._checkObj(last[key], current[key])) return false;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
get _timestamp() {
|
|
192
|
-
return Date.now();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
get _solution() {
|
|
196
|
-
return this._block?.has('*solution') ? this._block?.$['*solution'].toLowerCase() : null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
get _activity() {
|
|
200
|
-
return this._block?.has('*currentActivity') ? this._block?.$['*currentActivity'] : null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["a11y.js"],"names":[],"mappings":"AAqFA;IACE;;;OAGG;IACH,sBAAc;IAEd;;;OAGG;IACH,sBAAc;IAYd,iDAAiD;IACjD,qBADY,OAAO,aAAa,EAAE,KAAK,QAGtC;IAED,gBAGC;CACF;;;;4BA/GY,UAAU,CAAC,OAAO,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a string like "iothari 100" into an object { filter: "iothari", value: 100 }
|
|
3
|
-
*
|
|
4
|
-
* @param {string} str
|
|
5
|
-
* @returns {{ filter: string; value: number } | null}
|
|
6
|
-
*/
|
|
7
|
-
export function parseFilterValue(str: string): {
|
|
8
|
-
filter: string;
|
|
9
|
-
value: number;
|
|
10
|
-
} | null;
|
|
11
|
-
//# sourceMappingURL=parseFilterValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseFilterValue.d.ts","sourceRoot":"","sources":["parseFilterValue.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sCAHW,MAAM,GACJ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMpD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a string like "iothari 100" into an object { filter: "iothari", value: 100 }
|
|
3
|
-
*
|
|
4
|
-
* @param {string} str
|
|
5
|
-
* @returns {{ filter: string; value: number } | null}
|
|
6
|
-
*/
|
|
7
|
-
export function parseFilterValue(str) {
|
|
8
|
-
const match = str.match(/^(\w+)\s+(\d+)$/);
|
|
9
|
-
if (!match) return null;
|
|
10
|
-
return { filter: match[1], value: Number(match[2]) };
|
|
11
|
-
}
|