@uploadcare/file-uploader 1.3.0-alpha.3 → 1.3.0-alpha.5
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 +1 -4
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +2 -23
- package/abstract/TypedCollection.js +1 -1
- package/abstract/TypedData.js +1 -1
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +1 -1
- package/abstract/UploaderPublicApi.js +1 -1
- package/blocks/CameraSource/CameraSource.js +9 -9
- package/blocks/CloudImageEditor/src/CropFrame.js +1 -1
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +2 -2
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +2 -2
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +1 -1
- package/blocks/CloudImageEditor/src/EditorScroller.js +1 -1
- package/blocks/CloudImageEditor/src/EditorSlider.js +2 -2
- package/blocks/CloudImageEditor/src/EditorToolbar.js +12 -12
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +3 -3
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +1 -1
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +1 -1
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +2 -2
- package/blocks/CloudImageEditor/src/template.js +4 -4
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +1 -1
- package/blocks/Copyright/Copyright.js +1 -1
- package/blocks/DropArea/DropArea.d.ts.map +1 -1
- package/blocks/DropArea/DropArea.js +3 -3
- package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
- package/blocks/ExternalSource/ExternalSource.js +7 -7
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +10 -10
- package/blocks/FormInput/FormInput.js +1 -1
- package/blocks/Icon/Icon.js +2 -2
- package/blocks/Img/ImgConfig.d.ts +1 -1
- package/blocks/Img/ImgConfig.d.ts.map +1 -1
- package/blocks/Img/ImgConfig.js +1 -1
- package/blocks/Modal/Modal.js +1 -1
- package/blocks/ProgressBar/ProgressBar.js +1 -1
- package/blocks/ProgressBarCommon/ProgressBarCommon.js +2 -2
- package/blocks/Select/Select.js +2 -2
- package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -1
- package/blocks/SimpleBtn/SimpleBtn.js +3 -3
- package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
- package/blocks/SourceBtn/SourceBtn.js +2 -2
- package/blocks/SourceList/SourceList.js +1 -1
- package/blocks/StartFrom/StartFrom.js +1 -1
- package/blocks/UploadList/UploadList.d.ts.map +1 -1
- package/blocks/UploadList/UploadList.js +8 -8
- package/blocks/UrlSource/UrlSource.js +5 -5
- 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 +1 -1
- package/index.ssr.js +73 -73
- package/package.json +5 -6
- package/solutions/file-uploader/inline/FileUploaderInline.js +1 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.js +2 -4
- package/symbiote.js +19 -0
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
- package/abstract/bindCompatibilityFallbackProcessor.d.ts +0 -3
- package/abstract/bindCompatibilityFallbackProcessor.d.ts.map +0 -1
- package/abstract/bindCompatibilityFallbackProcessor.js +0 -16
package/web/uc-img.min.js
CHANGED
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
var
|
|
27
|
-
`,"\\n"),i=
|
|
28
|
-
`));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,s){var a;if(e===s)return;let o=(a=h(this,m).__attrDesc)==null?void 0:a[t];o?h(this,G)?this.$[o]=s:this.init$[o]=s:this[t]=s}getCssData(t,e=!1){if(h(this,y)||p(this,y,Object.create(null)),!Object.keys(h(this,y)).includes(t)){h(this,X)||p(this,X,window.getComputedStyle(this));let s=h(this,X).getPropertyValue(t).trim();try{h(this,y)[t]=Xt(s)}catch{!e&&console.warn(`CSS Data error: ${t}`),h(this,y)[t]=null}}return h(this,y)[t]}bindCssData(t,e=""){h(this,L)||p(this,L,new Set),h(this,L).add(t);let s=this.getCssData(f(this,J,_t).call(this,t),!0);s===null&&(s=e),t.startsWith(n.CSS_DATA_PX)?this.localCtx.add(t,s):this.add(t,s)}dropCssDataCache(){p(this,y,null),p(this,X,null)}defineAccessor(t,e,s){let o="#"+t;this[o]=this[t],Object.defineProperty(this,t,{set:a=>{this[o]=a,s?window.setTimeout(()=>{e==null||e(a)}):e==null||e(a)},get:()=>this[o]}),this[t]=this[o]}static addRootStyles(t){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(ft(t))}static addShadowStyles(t){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(ft(t))}static set rootStyles(t){this.rootStyleSheets=[],this.addRootStyles(t)}static set shadowStyles(t){this.shadowStyleSheets=[],this.addShadowStyles(t)}};z=new WeakMap,N=new WeakMap,V=new WeakMap,O=new WeakMap,W=new WeakMap,G=new WeakMap,R=new WeakMap,y=new WeakMap,X=new WeakMap,L=new WeakMap,m=new WeakMap,q=new WeakSet,pt=function(){var t;h(this,z)||(p(this,z,!0),(t=this.initCallback)==null||t.call(this))},P=new WeakSet,D=function(t,e){var a;let s,o;if(t.startsWith(n.SHARED_CTX_PX))s=e.sharedCtx,o=t.replace(n.SHARED_CTX_PX,"");else if(t.startsWith(n.PARENT_CTX_PX)){o=t.replace(n.PARENT_CTX_PX,"");let l=e;for(;l&&!((a=l==null?void 0:l.has)!=null&&a.call(l,o));)l=l.parentElement||l.parentNode||l.host;s=(l==null?void 0:l.localCtx)||e.localCtx}else if(t.includes(n.NAMED_CTX_SPLTR)){let l=t.split(n.NAMED_CTX_SPLTR);s=C.getCtx(l[0]),o=l[1]}else t.startsWith(n.CSS_DATA_PX)?(s=e.localCtx,o=t,s.has(o)||e.bindCssData(o)):(s=e.localCtx,o=t);return{ctx:s,name:o}},it=new WeakSet,Mt=function(){return this.ctxOwner||this.hasAttribute(n.CTX_OWNER_ATTR)&&this.getAttribute(n.CTX_OWNER_ATTR)!=="false"},st=new WeakSet,Ut=function(){let t=h(this,m).__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(n.SHARED_CTX_PX))this.sharedCtx.add(e.replace(n.SHARED_CTX_PX,""),this.init$[e],h(this,it,Mt));else if(e.startsWith(n.ATTR_BIND_PX))this.localCtx.add(e,this.getAttribute(e.replace(n.ATTR_BIND_PX,""))||this.init$[e]),this.initAttributeObserver();else if(e.includes(n.NAMED_CTX_SPLTR)){let s=e.split(n.NAMED_CTX_SPLTR),o=s[0].trim(),a=s[1].trim();if(o&&a){let l=C.getCtx(o,!1);l||(l=C.registerCtx({},o)),l.add(a,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);p(this,G,!0)},Y=new WeakSet,mt=function(){return!this.isVirtual&&!this.isConnected},rt=new WeakSet,kt=function(){var t;if(!h(this,Y,mt)){if(h(this,R)&&window.clearTimeout(h(this,R)),!this.connectedOnce){let e=(t=this.getAttribute(n.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(n.CSS_CTX_PROP,`'${e}'`),f(this,st,Ut).call(this),this[n.SET_LATER_KEY]){for(let s in this[n.SET_LATER_KEY])H(this,s,this[n.SET_LATER_KEY][s]);delete this[n.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of Nt)this.addTemplateProcessor(s);if(this.pauseRender)f(this,q,pt).call(this);else{if(h(this,m).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,...h(this,m).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},J=new WeakSet,_t=function(t){return t.split("--").map((e,s)=>s===0?"":e).join("--")},u(g,P),E(g,"__tpl"),E(g,"template");var dt=g,Tt=dt;var he="https://ucarecdn.com",Q=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:he},"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 K="--uc-img-",gt="unresolved";var St=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),bt=3e3,Et=5e3,yt=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var jt="blocks",Bt="1.2.0";var Kt=Object.create(null),Wt;for(let r in Q)Kt[K+r]=((Wt=Q[r])==null?void 0:Wt.default)||"";var ot=class extends Tt{constructor(){super(...arguments);E(this,"cssInit$",Kt)}$$(t){return this.$[K+t]}set$$(t){for(let e in t)this.$[K+e]=t[e]}sub$$(t,e){this.sub(K+t,s=>{s===null||s===""||e(s)})}analyticsParams(){return`-/@clib/${jt}/${Bt}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{Q[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(a=>{a.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},s),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),v.deleteCtx(this)}static get observedAttributes(){return Object.keys(Q)}attributeChangedCallback(t,e,s){window.setTimeout(()=>{this.$[K+t]=s})}};var lt=class extends ot{constructor(){super(...arguments);E(this,"_img",new Image);E(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!St&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],s=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Et&&this.hasFormatJPG)return Et+s;if(Number(o)>bt&&!this.hasFormatJPG)return bt+s}return t}_getCdnModifiers(t,e){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return Ct(...Rt(s))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(St&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return M(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(M(ct(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(M(ct(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(M(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(M(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?At(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}_getElSize(t,e=1,s=!0){let o=t.getBoundingClientRect(),a=e*Math.round(o.width),l=s?"":e*Math.round(o.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(t){let e=o=>{o.stopPropagation();let a=new Event(o.type,o);this.dispatchEvent(a)},s=["load","error"];for(let o of s)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:yt.PREVIEW,img:this._imgPreview}:{type:yt.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=$t(this.$$("breakpoints"));return Ot(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let s=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",s),t.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:s}){e&&(t.src=e),s&&(t.srcset=s)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:s}){return new Promise((o,a)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(gt,""),s.addEventListener("load",()=>{s.removeAttribute(gt),o(s)}),s.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:s,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;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((s=this._imgPreview)==null?void 0:s.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((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var ht=class extends lt{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager")})}};ht.reg("uc-img");export{ht as Img};
|
|
26
|
+
var Ht=Object.defineProperty;var Vt=(r,i,t)=>i in r?Ht(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var E=(r,i,t)=>(Vt(r,typeof i!="symbol"?i+"":i,t),t),ct=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var h=(r,i,t)=>(ct(r,i,"read from private field"),t?t.call(r):i.get(r)),u=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},p=(r,i,t,e)=>(ct(r,i,"write to private field"),e?e.call(r,t):i.set(r,t),t);var f=(r,i,t)=>(ct(r,i,"access private method"),t);var zt=r=>r,Gt="{{",qt="}}";function At(r,i,t={}){var a;let{openToken:e=Gt,closeToken:s=qt,transform:o=zt}=t;for(let l in i){let c=(a=i[l])==null?void 0:a.toString();r=r.replaceAll(e+l+s,typeof c=="string"?o(c):c)}return r}var Yt=r=>{if(typeof r!="string"||!r)return"";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Jt=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>Yt(i)).join("/-/"),Ct=(...r)=>{let i=Jt(...r);return i?`-/${i}/`:""};function xt(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):s>=0&&(o=t.slice(s+1)),o}function Qt(r){let i=new URL(r),t=xt(r),e=Pt(t)?wt(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Pt(r){return r.startsWith("http")}function wt(r){let i=new URL(r);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var M=(r,i,t)=>{let e=new URL(Qt(r));if(t=t||xt(r),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Pt(t)){let s=wt(t);e.pathname=e.pathname+(i||"")+(s.pathname||""),e.search=s.search,e.hash=s.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},ft=(r,i)=>{let t=new URL(r);return t.pathname=i+"/",t.toString()};var $t=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Rt=r=>[...new Set(r)];var Ot=r=>Object.entries(r).filter(([,i])=>i!==void 0&&i!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var n={BIND_ATTR:"bind",ATTR_BIND_PX:"@",SHARED_CTX_PX:"*",PARENT_CTX_PX:"^",NAMED_CTX_SPLTR:"/",COMPUTED_PX:"+",CSS_DATA_PX:"--",CTX_NAME_ATTR:"ctx",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx",EL_REF_ATTR:"ref",AUTO_TAG_PX:"sym",LIST_ATTR:"itemize",LIST_ITEM_TAG_ATTR:"item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL_ATTR:"use-template",DEFAULT_SLOT_KEY:"__default__",TEXT_NODE_SKIP_ATTR:"skip-text-nodes",TEXT_NODE_OPEN_TOKEN:"{{",TEXT_NODE_CLOSE_TOKEN:"}}"};function Zt(r){let i=t=>{var e;for(let s in t)((e=t[s])==null?void 0:e.constructor)===Object&&(t[s]=i(t[s]));return{...t}};return i(r)}var k,B,$,R,U,et,It,T=class T{constructor(i){u(this,k,void 0);u(this,B,void 0);u(this,$,void 0);i.constructor===Object?this.store=Zt(i):(p(this,$,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var t,e;if(!h(this,$)&&!this.store.hasOwnProperty(i))return f(t=T,R,U).call(t,"read",i),null;if(typeof i=="string"&&i.startsWith(n.COMPUTED_PX)){let s=this.store[i];if((s==null?void 0:s.constructor)!==Function){f(e=T,R,U).call(e,"compute",i);return}this.__computedMap||(this.__computedMap={});let o=s();return Object.keys(this.__computedMap).includes(i)||(this.__computedMap[i]=o,this.notify(i)),o}else return this.store[i]}has(i){return h(this,$)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,t,e=!1){!e&&Object.keys(this.store).includes(i)||(this.store[i]=t,this.notify(i))}pub(i,t){var e,s;if(!h(this,$)&&!this.store.hasOwnProperty(i)){f(e=T,R,U).call(e,"publish",i);return}if(i!=null&&i.startsWith(n.COMPUTED_PX)&&t.constructor!==Function){f(s=T,R,U).call(s,"publish computed",i);return}!(this.store[i]===null||t===null)&&typeof this.store[i]!=typeof t&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof t}]`),this.store[i]=t,this.notify(i)}get proxy(){if(!h(this,B)){let i=Object.create(null);p(this,B,new Proxy(i,{set:(t,e,s)=>(this.pub(e,s),!0),get:(t,e)=>{this.read(e)}}))}return h(this,B)}multiPub(i){for(let t in i)this.pub(t,i[t])}notify(i){var e;let t=i==null?void 0:i.startsWith(n.COMPUTED_PX);if(this.callbackMap[i]){let s=this.read(i);this.callbackMap[i].forEach(o=>{o(s)}),t&&(this.__computedMap[i]=s)}!t&&f(e=T,et,It).call(e,this,i)}sub(i,t,e=!0){var s;return!h(this,$)&&!this.store.hasOwnProperty(i)?(f(s=T,R,U).call(s,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(t),e&&t(this.read(i)),{remove:()=>{this.callbackMap[i].delete(t),this.callbackMap[i].size||delete this.callbackMap[i]},callback:t})}set uid(i){!h(this,k)&&p(this,k,i)}get uid(){return h(this,k)}static registerCtx(i,t=Symbol()){let e=T.globalStore.get(t);return e?console.warn('PubSub: context UID "'+t+'" is already in use'):(e=new T(i),e.uid=t,T.globalStore.set(t,e)),e}static deleteCtx(i){T.globalStore.delete(i)}static getCtx(i,t=!0){return T.globalStore.get(i)||(t&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};k=new WeakMap,B=new WeakMap,$=new WeakMap,R=new WeakSet,U=function(i,t){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+t)},et=new WeakSet,It=function(i,t){this.globalStore.forEach(e=>{e.__computedMap&&Object.keys(e.__computedMap).forEach(s=>{if(e===i&&t===s)return;let o=`__${s}_timeout`;e[o]&&window.clearTimeout(e[o]),e[o]=window.setTimeout(()=>{let a=e.read(s);a!==e.__computedMap[s]&&(e.__computedMap[s]=a,e.notify(s))})})})},u(T,R),u(T,et);var C=T;C.globalStore=new Map;var x=C;var Dt="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",te=Dt.length-1,K=class{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:Dt.charAt(Math.random()*te);return t}};function H(r,i,t){let e=!0,s,o=i.split(".");return o.forEach((a,l)=>{l<o.length-1?r=r[a]:s=a}),r?r[s]=t:e=!1,e}function dt(r){let i;return r.constructor===CSSStyleSheet?i=r:r.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(r)),i}function Nt(r,i){[...r.querySelectorAll(`[${n.LIST_ATTR}]`)].filter(t=>!t.matches(`[${n.LIST_ATTR}] [${n.LIST_ATTR}]`)).forEach(t=>{var a;let e=t.getAttribute(n.LIST_ITEM_TAG_ATTR),s;for(e&&(s=window.customElements.get(e)),s||(s=class extends i.Symbiote{constructor(){super(),e||(this.style.display="contents")}},s.template=((a=t.querySelector("template"))==null?void 0:a.innerHTML)||t.innerHTML,s.reg(e));t.firstChild;)t.firstChild.remove();let o=t.getAttribute(n.LIST_ATTR);i.sub(o,l=>{if(!l){for(;t.firstChild;)t.firstChild.remove();return}let c=[...t.children],D,d=b=>{b.forEach((A,tt)=>{if(c[tt])if(c[tt].set$)c[tt].set$(A);else for(let w in A)c[tt][w]=A[w];else{D||(D=new DocumentFragment);let w=new s;Object.assign((w==null?void 0:w.init$)||w,A),D.appendChild(w)}}),D&&t.appendChild(D);let _=c.slice(b.length,c.length);for(let A of _)A.remove()};if(l.constructor===Array)d(l);else if(l.constructor===Object){let b=[];for(let _ in l){let A=l[_];Object.defineProperty(A,"_KEY_",{value:_,enumerable:!0}),b.push(A)}d(b)}else console.warn("Symbiote list data type error:"),console.log(l)}),t.removeAttribute(n.LIST_ATTR),t.removeAttribute(n.LIST_ITEM_TAG_ATTR)})}function ee(r,i){[...r.querySelectorAll(`[${n.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(n.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(n.EL_REF_ATTR)})}function ie(r,i){[...r.querySelectorAll(`[${n.BIND_ATTR}]`)].forEach(t=>{t.getAttribute(n.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let a=o.split(":").map(d=>d.trim()),l=a[0],c;l.indexOf(n.ATTR_BIND_PX)===0&&(c=!0,l=l.replace(n.ATTR_BIND_PX,""));let D=a[1].split(",").map(d=>d.trim());for(let d of D){let b;d.startsWith("!!")?(b="double",d=d.replace("!!","")):d.startsWith("!")&&(b="single",d=d.replace("!","")),!i.has(d)&&i.allowTemplateInits&&(d.startsWith(n.ATTR_BIND_PX)?i.add(d,i.getAttribute(d.replace(n.ATTR_BIND_PX,""))):i.add(d,null)),i.sub(d,_=>{b==="double"?_=!!_:b==="single"&&(_=!_),c?(_==null?void 0:_.constructor)===Boolean?_?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,_):H(t,l,_)||(t[n.SET_LATER_KEY]||(t[n.SET_LATER_KEY]=Object.create(null)),t[n.SET_LATER_KEY][l]=_)},!(i.ssrMode&&(l==="textContent"||c)))}}),t.removeAttribute(n.BIND_ATTR)})}function se(r){let i,t=[],e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(n.TEXT_NODE_SKIP_ATTR))&&s.textContent.includes(n.TEXT_NODE_OPEN_TOKEN)&&s.textContent.includes(n.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=e.nextNode();)t.push(i);return t}var re=function(r,i){se(r).forEach(e=>{let s=[],o;for(;e.textContent.includes(n.TEXT_NODE_CLOSE_TOKEN);)e.textContent.startsWith(n.TEXT_NODE_OPEN_TOKEN)?(o=e.textContent.indexOf(n.TEXT_NODE_CLOSE_TOKEN)+n.TEXT_NODE_CLOSE_TOKEN.length,e.splitText(o),s.push(e)):(o=e.textContent.indexOf(n.TEXT_NODE_OPEN_TOKEN),e.splitText(o)),e=e.nextSibling;s.forEach(a=>{let l=a.textContent.replace(n.TEXT_NODE_OPEN_TOKEN,"").replace(n.TEXT_NODE_CLOSE_TOKEN,"");a.textContent="",!i.has(l)&&i.allowTemplateInits&&(l.startsWith(n.ATTR_BIND_PX)?(i.add(l,i.getAttribute(l.replace(n.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(l,null)),i.sub(l,c=>{a.textContent=c})})})},vt=[Nt,ee,ie,re];var it="'",W='"',oe=/\\([0-9a-fA-F]{1,6} ?)/g;function ne(r){return(r[0]===W||r[0]===it)&&(r[r.length-1]===W||r[r.length-1]===it)}function ae(r){return(r[0]===W||r[0]===it)&&(r=r.slice(1)),(r[r.length-1]===W||r[r.length-1]===it)&&(r=r.slice(0,-1)),r}function le(r){let i="",t="";for(var e=0;e<r.length;e++){let s=r[e+1];r[e]==="\\"&&s==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]}return i}function Xt(r){let i=r;ne(r)&&(i=ae(i),i=i.replace(oe,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
|
|
27
|
+
`,"\\n"),i=le(i),i=W+i+W);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${r}`)}}var ve=[n.LIST_ATTR,n.LIST_ITEM_TAG_ATTR,n.EL_REF_ATTR,n.USE_TPL_ATTR,n.CTX_NAME_ATTR,n.CTX_OWNER_ATTR];function S(r,...i){let t="",e=new CSSStyleSheet;return r.forEach((s,o)=>{t+=s+i[o]}),S.processors.forEach(s=>{t=s(t)}),S.clearProcessors(),e.replaceSync(t),e}S.processors=[];S.clearProcessors=function(){S.processors=[]};S.useProcessor=function(...r){return S.processors=[...S.processors,...r],S};var Lt=0,V,v,z,O,j,G,I,y,X,L,m,q,mt,P,N,st,Ut,rt,kt,Y,_t,ot,Bt,J,Tt,g=class g extends HTMLElement{constructor(){super();u(this,q);u(this,st);u(this,rt);u(this,Y);u(this,ot);u(this,J);u(this,V,void 0);u(this,v,void 0);u(this,z,void 0);u(this,O,void 0);u(this,j,void 0);u(this,G,void 0);u(this,I,void 0);u(this,y,void 0);u(this,X,void 0);u(this,L,void 0);u(this,m,this.constructor);E(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=h(this,L))==null||t.forEach(e=>{let s=this.getCssData(f(this,J,Tt).call(this,e),!0);s!==null&&this.$[e]!==s&&(this.$[e]=s)})});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.ssrMode=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1,this.isVirtual=!1,this.allowTemplateInits=!0}get Symbiote(){return g}initCallback(){}renderCallback(){}render(t,e=this.renderShadow){let s;if((e||h(this,m).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let a=this.getAttribute(n.USE_TPL_ATTR);if(a){let l=this.getRootNode(),c=(l==null?void 0:l.querySelector(a))||document.querySelector(a);c?t=c.content.cloneNode(!0):console.warn(`Symbiote template "${a}" is not found...`)}}if(this.processInnerHtml||this.ssrMode)for(let a of this.tplProcessors)a(this,this);if(t||h(this,m).template){if(h(this,m).template&&!h(this,m).__tpl&&(h(this,m).__tpl=document.createElement("template"),h(this,m).__tpl.innerHTML=h(this,m).template),(t==null?void 0:t.constructor)===DocumentFragment)s=t;else if((t==null?void 0:t.constructor)===String){let a=document.createElement("template");a.innerHTML=t,s=a.content.cloneNode(!0)}else h(this,m).__tpl&&(s=h(this,m).__tpl.content.cloneNode(!0));for(let a of this.tplProcessors)a(s,this)}let o=()=>{var a;s&&this.isVirtual?this.replaceWith(s):s&&(e&&this.shadowRoot.appendChild(s)||this.appendChild(s)),f(this,q,mt).call(this),(a=this.renderCallback)==null||a.call(this)};h(this,m).shadowStyleSheets&&(e=!0,this.shadowRoot.adoptedStyleSheets=[...h(this,m).shadowStyleSheets]),o()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return h(this,v)||(p(this,v,K.generate()),this.style.setProperty(n.CSS_CTX_PROP,`'${h(this,v)}'`)),h(this,v)}get cssCtxName(){return this.getCssData(n.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(n.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||h(this,z)||this.autoCtxName;return p(this,z,t),t}get localCtx(){return h(this,O)||p(this,O,x.registerCtx({})),h(this,O)}get sharedCtx(){return x.getCtx(this.ctxName,!1)||x.registerCtx({},this.ctxName)}sub(t,e,s=!0){var l;let o=c=>{h(this,Y,_t)||e(c)},a=f(l=g,P,N).call(l,t,this);a.ctx.has(a.name)?this.allSubs.add(a.ctx.sub(a.name,o,s)):window.setTimeout(()=>{this.allSubs.add(a.ctx.sub(a.name,o,s))})}notify(t){var s;let e=f(s=g,P,N).call(s,t,this);e.ctx.notify(e.name)}has(t){var s;let e=f(s=g,P,N).call(s,t,this);return e.ctx.has(e.name)}add(t,e,s=!1){var a;let o=f(a=g,P,N).call(a,t,this);o.ctx.add(o.name,e,s)}add$(t,e=!1){for(let s in t)this.add(s,t[s],e)}get $(){if(!h(this,j)){let t=Object.create(null);p(this,j,new Proxy(t,{set:(e,s,o)=>{var l;let a=f(l=g,P,N).call(l,s,this);return a.ctx.pub(a.name,o),!0},get:(e,s)=>{var a;let o=f(a=g,P,N).call(a,s,this);return o.ctx.read(o.name)}}))}return h(this,j)}set$(t,e=!1){for(let s in t){let o=t[s];e||![String,Number,Boolean].includes(o==null?void 0:o.constructor)?this.$[s]=o:this.$[s]!==o&&(this.$[s]=o)}}initAttributeObserver(){this.attributeMutationObserver||(this.attributeMutationObserver=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"){let s=n.ATTR_BIND_PX+e.attributeName;this.has(s)&&(this.$[s]=this.getAttribute(e.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){f(this,ot,Bt).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(h(this,I)&&window.clearTimeout(h(this,I)),p(this,I,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);h(this,O)&&x.deleteCtx(h(this,O).uid);for(let t of this.tplProcessors)this.tplProcessors.delete(t)},100))))}static reg(t,e=!1){t||(Lt++,t=`${n.AUTO_TAG_PX}-${Lt}`),this.__tag=t;let s=window.customElements.get(t);if(s){!e&&s!==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,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,s){var a;if(e===s)return;let o=(a=h(this,m).__attrDesc)==null?void 0:a[t];o?h(this,G)?this.$[o]=s:this.init$[o]=s:this[t]=s}getCssData(t,e=!1){if(h(this,y)||p(this,y,Object.create(null)),!Object.keys(h(this,y)).includes(t)){h(this,X)||p(this,X,window.getComputedStyle(this));let s=h(this,X).getPropertyValue(t).trim();try{h(this,y)[t]=Xt(s)}catch{!e&&console.warn(`CSS Data error: ${t}`),h(this,y)[t]=null}}return h(this,y)[t]}bindCssData(t,e=""){h(this,L)||p(this,L,new Set),h(this,L).add(t);let s=this.getCssData(f(this,J,Tt).call(this,t),!0);s===null&&(s=e),t.startsWith(n.CSS_DATA_PX)?this.localCtx.add(t,s):this.add(t,s)}dropCssDataCache(){p(this,y,null),p(this,X,null)}defineAccessor(t,e,s){let o="#"+t;this[o]=this[t],Object.defineProperty(this,t,{set:a=>{this[o]=a,s?window.setTimeout(()=>{e==null||e(a)}):e==null||e(a)},get:()=>this[o]}),this[t]=this[o]}static addRootStyles(t){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(dt(t))}static addShadowStyles(t){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(dt(t))}static set rootStyles(t){this.rootStyleSheets=[],this.addRootStyles(t)}static set shadowStyles(t){this.shadowStyleSheets=[],this.addShadowStyles(t)}};V=new WeakMap,v=new WeakMap,z=new WeakMap,O=new WeakMap,j=new WeakMap,G=new WeakMap,I=new WeakMap,y=new WeakMap,X=new WeakMap,L=new WeakMap,m=new WeakMap,q=new WeakSet,mt=function(){var t;h(this,V)||(p(this,V,!0),(t=this.initCallback)==null||t.call(this))},P=new WeakSet,N=function(t,e){var a;let s,o;if(t.startsWith(n.SHARED_CTX_PX))s=e.sharedCtx,o=t.replace(n.SHARED_CTX_PX,"");else if(t.startsWith(n.PARENT_CTX_PX)){o=t.replace(n.PARENT_CTX_PX,"");let l=e;for(;l&&!((a=l==null?void 0:l.has)!=null&&a.call(l,o));)l=l.parentElement||l.parentNode||l.host;s=(l==null?void 0:l.localCtx)||e.localCtx}else if(t.includes(n.NAMED_CTX_SPLTR)){let l=t.split(n.NAMED_CTX_SPLTR);s=x.getCtx(l[0]),o=l[1]}else t.startsWith(n.CSS_DATA_PX)?(s=e.localCtx,o=t,s.has(o)||e.bindCssData(o)):(s=e.localCtx,o=t);return{ctx:s,name:o}},st=new WeakSet,Ut=function(){return this.ctxOwner||this.hasAttribute(n.CTX_OWNER_ATTR)&&this.getAttribute(n.CTX_OWNER_ATTR)!=="false"},rt=new WeakSet,kt=function(){let t=h(this,m).__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(n.SHARED_CTX_PX))this.sharedCtx.add(e.replace(n.SHARED_CTX_PX,""),this.init$[e],h(this,st,Ut));else if(e.startsWith(n.ATTR_BIND_PX))this.localCtx.add(e,this.getAttribute(e.replace(n.ATTR_BIND_PX,""))||this.init$[e]),this.initAttributeObserver();else if(e.includes(n.NAMED_CTX_SPLTR)){let s=e.split(n.NAMED_CTX_SPLTR),o=s[0].trim(),a=s[1].trim();if(o&&a){let l=x.getCtx(o,!1);l||(l=x.registerCtx({},o)),l.add(a,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);p(this,G,!0)},Y=new WeakSet,_t=function(){return!this.isVirtual&&!this.isConnected},ot=new WeakSet,Bt=function(){var t;if(!h(this,Y,_t)){if(h(this,I)&&window.clearTimeout(h(this,I)),!this.connectedOnce){let e=(t=this.getAttribute(n.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(n.CSS_CTX_PROP,`'${e}'`),f(this,rt,kt).call(this),this[n.SET_LATER_KEY]){for(let s in this[n.SET_LATER_KEY])H(this,s,this[n.SET_LATER_KEY][s]);delete this[n.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of vt)this.addTemplateProcessor(s);if(this.pauseRender)f(this,q,mt).call(this);else{if(h(this,m).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,...h(this,m).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},J=new WeakSet,Tt=function(t){return t.split("--").map((e,s)=>s===0?"":e).join("--")},u(g,P),E(g,"__tpl"),E(g,"template");var pt=g,Q=pt;Object.assign(n,{CTX_NAME_ATTR:"ctx-name",BIND_ATTR:"set"});var ce="https://ucarecdn.com",Z=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ce},"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 F="--uc-img-",gt="unresolved";var St=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),bt=3e3,Et=5e3,yt=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Kt="blocks",Wt="1.3.0";var Ft=Object.create(null),jt;for(let r in Z)Ft[F+r]=((jt=Z[r])==null?void 0:jt.default)||"";var nt=class extends Q{constructor(){super(...arguments);E(this,"cssInit$",Ft)}$$(t){return this.$[F+t]}set$$(t){for(let e in t)this.$[F+e]=t[e]}sub$$(t,e){this.sub(F+t,s=>{s===null||s===""||e(s)})}analyticsParams(){return`-/@clib/${Kt}/${Wt}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{Z[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(a=>{a.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},s),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),C.deleteCtx(this)}static get observedAttributes(){return Object.keys(Z)}attributeChangedCallback(t,e,s){window.setTimeout(()=>{this.$[F+t]=s})}};var ht=class extends nt{constructor(){super(...arguments);E(this,"_img",new Image);E(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!St&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],s=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Et&&this.hasFormatJPG)return Et+s;if(Number(o)>bt&&!this.hasFormatJPG)return bt+s}return t}_getCdnModifiers(t,e){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return Ct(...Ot(s))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(St&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return M(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(M(ft(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(M(ft(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(M(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(M(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?At(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}_getElSize(t,e=1,s=!0){let o=t.getBoundingClientRect(),a=e*Math.round(o.width),l=s?"":e*Math.round(o.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(t){let e=o=>{o.stopPropagation();let a=new Event(o.type,o);this.dispatchEvent(a)},s=["load","error"];for(let o of s)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:yt.PREVIEW,img:this._imgPreview}:{type:yt.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=$t(this.$$("breakpoints"));return Rt(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let s=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",s),t.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:s}){e&&(t.src=e),s&&(t.srcset=s)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:s}){return new Promise((o,a)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(gt,""),s.addEventListener("load",()=>{s.removeAttribute(gt),o(s)}),s.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:s,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;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((s=this._imgPreview)==null?void 0:s.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((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var ut=class extends ht{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager")})}};ut.reg("uc-img");export{ut as Img};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** @param {DocumentFragment | import('@symbiotejs/symbiote').Symbiote<any>} fr */
|
|
2
|
-
export function bindCompatibilityFallbackProcessor(fr: DocumentFragment | import("@symbiotejs/symbiote").Symbiote<any>): void;
|
|
3
|
-
//# sourceMappingURL=bindCompatibilityFallbackProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindCompatibilityFallbackProcessor.d.ts","sourceRoot":"","sources":["bindCompatibilityFallbackProcessor.js"],"names":[],"mappings":"AAMA,kFAAkF;AAClF,uDADY,gBAAgB,GAAG,OAAO,sBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,QAS1E"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { DICT } from '@symbiotejs/symbiote';
|
|
4
|
-
|
|
5
|
-
const FALLBACK_BIND_ATTR = 'set';
|
|
6
|
-
|
|
7
|
-
/** @param {DocumentFragment | import('@symbiotejs/symbiote').Symbiote<any>} fr */
|
|
8
|
-
export function bindCompatibilityFallbackProcessor(fr) {
|
|
9
|
-
[...fr.querySelectorAll(`[${FALLBACK_BIND_ATTR}]`)].forEach((el) => {
|
|
10
|
-
const setAttrValue = el.getAttribute(FALLBACK_BIND_ATTR);
|
|
11
|
-
if (setAttrValue) {
|
|
12
|
-
el.removeAttribute(FALLBACK_BIND_ATTR);
|
|
13
|
-
el.setAttribute(DICT.BIND_ATTR, setAttrValue);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|