@uploadcare/file-uploader 1.5.3-alpha.6 → 1.6.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.
Files changed (217) hide show
  1. package/README.md +4 -4
  2. package/abstract/ActivityBlock.d.ts +3 -3
  3. package/abstract/ActivityBlock.d.ts.map +1 -1
  4. package/abstract/Block.d.ts +11 -4
  5. package/abstract/Block.d.ts.map +1 -1
  6. package/abstract/Block.js +16 -16
  7. package/abstract/CTX.d.ts +7 -7
  8. package/abstract/CTX.d.ts.map +1 -1
  9. package/abstract/CTX.js +1 -1
  10. package/abstract/LocaleManager.d.ts +3 -3
  11. package/abstract/SecureUploadsManager.d.ts +2 -2
  12. package/abstract/SecureUploadsManager.d.ts.map +1 -1
  13. package/abstract/SolutionBlock.d.ts +2 -2
  14. package/abstract/SolutionBlock.d.ts.map +1 -1
  15. package/abstract/TypedCollection.d.ts +1 -1
  16. package/abstract/TypedCollection.d.ts.map +1 -1
  17. package/abstract/TypedCollection.js +4 -4
  18. package/abstract/TypedData.d.ts +2 -2
  19. package/abstract/TypedData.d.ts.map +1 -1
  20. package/abstract/TypedData.js +4 -4
  21. package/abstract/UploaderBlock.d.ts +9 -6
  22. package/abstract/UploaderBlock.d.ts.map +1 -1
  23. package/abstract/UploaderBlock.js +16 -23
  24. package/abstract/UploaderPublicApi.d.ts +21 -22
  25. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  26. package/abstract/UploaderPublicApi.js +4 -3
  27. package/abstract/ValidationManager.d.ts +3 -3
  28. package/abstract/ValidationManager.d.ts.map +1 -1
  29. package/abstract/a11y.d.ts +2 -2
  30. package/abstract/a11y.d.ts.map +1 -1
  31. package/abstract/buildOutputCollectionState.d.ts +1 -1
  32. package/abstract/buildOutputCollectionState.d.ts.map +1 -1
  33. package/abstract/defineComponents.d.ts.map +1 -1
  34. package/abstract/defineComponents.js +0 -5
  35. package/abstract/l10nProcessor.d.ts.map +1 -1
  36. package/abstract/l10nProcessor.js +3 -3
  37. package/abstract/loadFileUploaderFrom.d.ts.map +1 -1
  38. package/abstract/localeRegistry.d.ts.map +1 -1
  39. package/abstract/sharedConfigKey.d.ts.map +1 -1
  40. package/abstract/uploadEntrySchema.d.ts +4 -2
  41. package/abstract/uploadEntrySchema.d.ts.map +1 -1
  42. package/abstract/uploadEntrySchema.js +2 -1
  43. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  44. package/blocks/CameraSource/CameraSource.js +4 -5
  45. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
  46. package/blocks/CloudImageEditor/src/CropFrame.d.ts +11 -11
  47. package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
  48. package/blocks/CloudImageEditor/src/CropFrame.js +1 -2
  49. package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +1 -1
  50. package/blocks/CloudImageEditor/src/EditorButtonControl.js +1 -2
  51. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
  52. package/blocks/CloudImageEditor/src/EditorFilterControl.js +7 -3
  53. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +3 -3
  54. package/blocks/CloudImageEditor/src/EditorImageCropper.js +2 -2
  55. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +1 -1
  56. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -1
  57. package/blocks/CloudImageEditor/src/EditorOperationControl.js +1 -1
  58. package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +1 -1
  59. package/blocks/CloudImageEditor/src/EditorScroller.js +1 -2
  60. package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -1
  61. package/blocks/CloudImageEditor/src/EditorSlider.js +1 -2
  62. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +1 -1
  63. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
  64. package/blocks/CloudImageEditor/src/EditorToolbar.js +3 -4
  65. package/blocks/CloudImageEditor/src/crop-utils.d.ts +14 -14
  66. package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -1
  67. package/blocks/CloudImageEditor/src/css/common.css +2 -2
  68. package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +1 -1
  69. package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +3 -3
  70. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +1 -1
  71. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +1 -2
  72. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +1 -1
  73. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +2 -3
  74. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +1 -1
  75. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +1 -2
  76. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +15 -0
  77. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +1 -0
  78. package/blocks/CloudImageEditor/src/lib/FocusVisible.js +33 -0
  79. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +10 -0
  80. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +1 -0
  81. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +256 -0
  82. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +1 -1
  83. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +3 -3
  84. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -1
  85. package/blocks/CloudImageEditor/src/state.d.ts +4 -4
  86. package/blocks/CloudImageEditor/src/template.d.ts.map +1 -1
  87. package/blocks/CloudImageEditor/src/template.js +1 -2
  88. package/blocks/CloudImageEditor/src/types.d.ts +2 -2
  89. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
  90. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +1 -1
  91. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
  92. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +1 -2
  93. package/blocks/Config/Config.d.ts +11 -3
  94. package/blocks/Config/Config.d.ts.map +1 -1
  95. package/blocks/Config/initialConfig.d.ts +1 -1
  96. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  97. package/blocks/Copyright/Copyright.d.ts.map +1 -1
  98. package/blocks/Copyright/Copyright.js +1 -2
  99. package/blocks/DropArea/DropArea.d.ts +2 -2
  100. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  101. package/blocks/DropArea/DropArea.js +4 -4
  102. package/blocks/DropArea/addDropzone.d.ts.map +1 -1
  103. package/blocks/DropArea/getDropItems.d.ts +2 -2
  104. package/blocks/DropArea/getDropItems.d.ts.map +1 -1
  105. package/blocks/ExternalSource/ExternalSource.d.ts +5 -5
  106. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  107. package/blocks/ExternalSource/ExternalSource.js +3 -3
  108. package/blocks/ExternalSource/buildStyles.js +2 -2
  109. package/blocks/ExternalSource/query-string.d.ts.map +1 -1
  110. package/blocks/FileItem/FileItem.d.ts +2 -2
  111. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  112. package/blocks/FileItem/FileItem.js +3 -3
  113. package/blocks/FormInput/FormInput.js +1 -1
  114. package/blocks/Icon/Icon.d.ts +1 -0
  115. package/blocks/Icon/Icon.d.ts.map +1 -1
  116. package/blocks/Icon/Icon.js +4 -2
  117. package/blocks/Img/ImgBase.js +9 -9
  118. package/blocks/Img/ImgConfig.d.ts +2 -2
  119. package/blocks/Img/ImgConfig.d.ts.map +1 -1
  120. package/blocks/Img/ImgConfig.js +3 -3
  121. package/blocks/Img/utils/parseObjectToString.js +1 -1
  122. package/blocks/Modal/Modal.d.ts.map +1 -1
  123. package/blocks/Modal/Modal.js +1 -2
  124. package/blocks/ProgressBar/ProgressBar.d.ts.map +1 -1
  125. package/blocks/ProgressBar/ProgressBar.js +1 -2
  126. package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +1 -1
  127. package/blocks/ProgressBarCommon/ProgressBarCommon.js +1 -2
  128. package/blocks/Range/Range.d.ts +16 -0
  129. package/blocks/Range/Range.d.ts.map +1 -0
  130. package/blocks/Range/Range.js +44 -0
  131. package/blocks/Range/range.css +65 -0
  132. package/blocks/Select/Select.d.ts.map +1 -1
  133. package/blocks/Select/Select.js +9 -14
  134. package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
  135. package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -1
  136. package/blocks/SimpleBtn/SimpleBtn.js +1 -2
  137. package/blocks/SourceBtn/SourceBtn.d.ts +2 -2
  138. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
  139. package/blocks/SourceBtn/SourceBtn.js +8 -7
  140. package/blocks/SourceList/SourceList.d.ts.map +1 -1
  141. package/blocks/SourceList/SourceList.js +4 -5
  142. package/blocks/StartFrom/StartFrom.d.ts.map +1 -1
  143. package/blocks/StartFrom/StartFrom.js +1 -2
  144. package/blocks/UploadCtxProvider/EventEmitter.d.ts +19 -19
  145. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  146. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +4 -4
  147. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
  148. package/blocks/UploadList/UploadList.d.ts +2 -2
  149. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  150. package/blocks/UploadList/UploadList.js +4 -3
  151. package/blocks/UrlSource/UrlSource.d.ts.map +1 -1
  152. package/blocks/UrlSource/UrlSource.js +3 -4
  153. package/blocks/themes/uc-basic/index.css +1 -0
  154. package/blocks/utils/UploadSource.d.ts +27 -1
  155. package/blocks/utils/UploadSource.d.ts.map +1 -1
  156. package/blocks/utils/UploadSource.js +20 -1
  157. package/blocks/utils/debounce.d.ts +1 -3
  158. package/blocks/utils/debounce.d.ts.map +1 -1
  159. package/blocks/utils/throttle.d.ts +1 -3
  160. package/blocks/utils/throttle.d.ts.map +1 -1
  161. package/blocks/utils/userAgent.d.ts +1 -1
  162. package/blocks/utils/userAgent.d.ts.map +1 -1
  163. package/env.d.ts +1 -1
  164. package/env.js +1 -1
  165. package/index.d.ts +2 -1
  166. package/index.js +2 -1
  167. package/index.ssr.d.ts +98 -129
  168. package/index.ssr.d.ts.map +1 -1
  169. package/index.ssr.js +93 -132
  170. package/package.json +8 -12
  171. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +2 -2
  172. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  173. package/solutions/file-uploader/inline/FileUploaderInline.js +4 -3
  174. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  175. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +1 -2
  176. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +3 -3
  177. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  178. package/solutions/file-uploader/regular/FileUploaderRegular.js +1 -2
  179. package/types/exported.d.ts +2 -0
  180. package/types/jsx.d.ts +3 -9
  181. package/utils/getPluralForm.d.ts.map +1 -1
  182. package/utils/isSecureTokenExpired.d.ts +1 -1
  183. package/utils/memoize.d.ts.map +1 -1
  184. package/utils/mixinClass.d.ts +1 -3
  185. package/utils/mixinClass.d.ts.map +1 -1
  186. package/utils/prettyBytes.d.ts.map +1 -1
  187. package/utils/template-utils.d.ts.map +1 -1
  188. package/utils/toKebabCase.d.ts.map +1 -1
  189. package/utils/uniqueArray.d.ts.map +1 -1
  190. package/utils/validators/collection/validateCollectionUploadError.d.ts +1 -1
  191. package/utils/validators/collection/validateMultiple.d.ts +1 -1
  192. package/utils/validators/file/validateFileType.d.ts +1 -1
  193. package/utils/validators/file/validateIsImage.d.ts +1 -1
  194. package/utils/validators/file/validateMaxSizeLimit.d.ts +1 -1
  195. package/utils/validators/file/validateUploadError.d.ts +1 -1
  196. package/utils/waitForAttribute.d.ts +6 -12
  197. package/utils/waitForAttribute.d.ts.map +1 -1
  198. package/utils/waitForAttribute.js +8 -38
  199. package/utils/waitForAttribute.test.js +47 -10
  200. package/web/file-uploader.iife.min.js +4 -5
  201. package/web/file-uploader.min.js +4 -5
  202. package/web/uc-basic.min.css +1 -1
  203. package/web/uc-cloud-image-editor.min.css +1 -1
  204. package/web/uc-cloud-image-editor.min.js +4 -5
  205. package/web/uc-file-uploader-inline.min.css +1 -1
  206. package/web/uc-file-uploader-inline.min.js +4 -5
  207. package/web/uc-file-uploader-minimal.min.js +3 -4
  208. package/web/uc-file-uploader-regular.min.css +1 -1
  209. package/web/uc-file-uploader-regular.min.js +4 -5
  210. package/web/uc-img.min.js +3 -4
  211. package/symbiote.js +0 -18
  212. package/utils/withResolvers.d.ts +0 -7
  213. package/utils/withResolvers.d.ts.map +0 -1
  214. package/utils/withResolvers.js +0 -17
  215. package/utils/withResolvers.test.d.ts +0 -2
  216. package/utils/withResolvers.test.d.ts.map +0 -1
  217. package/utils/withResolvers.test.js +0 -27
package/web/uc-img.min.js CHANGED
@@ -1,5 +1,4 @@
1
1
  /**
2
- * @version v1.5.2
3
2
  * @license
4
3
  * MIT License
5
4
  *
@@ -24,6 +23,6 @@
24
23
  * SOFTWARE.
25
24
  *
26
25
  */
27
- var Vt=Object.defineProperty;var zt=(r,i,t)=>i in r?Vt(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var E=(r,i,t)=>(zt(r,typeof i!="symbol"?i+"":i,t),t),ut=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var h=(r,i,t)=>(ut(r,i,"read from private field"),t?t.call(r):i.get(r)),c=(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)=>(ut(r,i,"write to private field"),e?e.call(r,t):i.set(r,t),t);var f=(r,i,t)=>(ut(r,i,"access private method"),t);var Gt=r=>r,qt="{{",Yt="}}";function Ct(r,i,t={}){var a;let{openToken:e=qt,closeToken:s=Yt,transform:o=Gt}=t;for(let l in i){let u=(a=i[l])==null?void 0:a.toString();r=r.replaceAll(e+l+s,typeof u=="string"?o(u):u)}return r}var Jt=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},Qt=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>Jt(i)).join("/-/"),xt=(...r)=>{let i=Qt(...r);return i?`-/${i}/`:""};function Pt(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 Zt(r){let i=new URL(r),t=Pt(r),e=wt(t)?$t(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function wt(r){return r.startsWith("http")}function $t(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(Zt(r));if(t=t||Pt(r),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),wt(t)){let s=$t(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 Rt=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Ot=r=>[...new Set(r)];var It=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 te(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,Dt,T=class T{constructor(i){c(this,k,void 0);c(this,B,void 0);c(this,$,void 0);i.constructor===Object?this.store=te(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,Dt).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,Dt=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))})})})},c(T,R),c(T,et);var C=T;C.globalStore=new Map;var x=C;var Nt="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",ee=Nt.length-1,K=class{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:Nt.charAt(Math.random()*ee);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 vt(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 u=[...t.children],D,d=b=>{b.forEach((A,tt)=>{if(u[tt])if(u[tt].set$)u[tt].set$(A);else for(let w in A)u[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 _=u.slice(b.length,u.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 ie(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 se(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],u;l.indexOf(n.ATTR_BIND_PX)===0&&(u=!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"&&(_=!_),u?(_==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"||u)))}}),t.removeAttribute(n.BIND_ATTR)})}function re(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 oe=function(r,i){re(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,u=>{a.textContent=u})})})},Xt=[vt,ie,se,oe];var it="'",W='"',ne=/\\([0-9a-fA-F]{1,6} ?)/g;function ae(r){return(r[0]===W||r[0]===it)&&(r[r.length-1]===W||r[r.length-1]===it)}function le(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 he(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 Lt(r){let i=r;ae(r)&&(i=le(i),i=i.replace(ne,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
28
- `,"\\n"),i=he(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 Xe=[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 Mt=0,V,v,z,O,j,G,I,y,X,L,m,q,mt,P,N,st,kt,rt,Bt,Y,_t,ot,Kt,J,Tt,g=class g extends HTMLElement{constructor(){super();c(this,q);c(this,st);c(this,rt);c(this,Y);c(this,ot);c(this,J);c(this,V,void 0);c(this,v,void 0);c(this,z,void 0);c(this,O,void 0);c(this,j,void 0);c(this,G,void 0);c(this,I,void 0);c(this,y,void 0);c(this,X,void 0);c(this,L,void 0);c(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(),u=(l==null?void 0:l.querySelector(a))||document.querySelector(a);u?t=u.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=u=>{h(this,Y,_t)||e(u)},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,Kt).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||(Mt++,t=`${n.AUTO_TAG_PX}-${Mt}`),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(`
29
- `));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]=Lt(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,kt=function(){return this.ctxOwner||this.hasAttribute(n.CTX_OWNER_ATTR)&&this.getAttribute(n.CTX_OWNER_ATTR)!=="false"},rt=new WeakSet,Bt=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,kt));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,Kt=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,Bt).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 Xt)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("--")},c(g,P),E(g,"__tpl"),E(g,"template");var pt=g,Q=pt;function gt(r){return Object.assign(n,r),n}var Ci=gt({BIND_ATTR:"set",CTX_NAME_ATTR:"ctx-name",CSS_CTX_PROP:"--ctx-name"});var fe="https://ucarecdn.com",Z=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:fe},"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-",St="unresolved";var bt=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Et=3e3,yt=5e3,At=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Wt="blocks",jt="1.5.2";var Ht=Object.create(null),Ft;for(let r in Z)Ht[F+r]=((Ft=Z[r])==null?void 0:Ft.default)||"";var nt=class extends Q{constructor(){super(...arguments);E(this,"cssInit$",Ht)}$$(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/${Wt}/${jt}/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("//")&&!bt&&(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)>yt&&this.hasFormatJPG)return yt+s;if(Number(o)>Et&&!this.hasFormatJPG)return Et+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 xt(...It(s))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(bt&&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")?Ct(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:At.PREVIEW,img:this._imgPreview}:{type:At.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=Rt(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(St,""),s.addEventListener("load",()=>{s.removeAttribute(St),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 ct=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")})}};ct.reg("uc-img");export{ct as Img};
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),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
+ `,"\\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.6.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};
package/symbiote.js DELETED
@@ -1,18 +0,0 @@
1
- import { assignDict } from '@symbiotejs/symbiote';
2
- export {
3
- Symbiote,
4
- Symbiote as BaseComponent,
5
- PubSub,
6
- PubSub as Data,
7
- UID,
8
- html,
9
- create,
10
- applyStyles,
11
- } from '@symbiotejs/symbiote';
12
- export { slotProcessor } from '@symbiotejs/symbiote/core/slotProcessor.js';
13
-
14
- export const DICT = assignDict({
15
- BIND_ATTR: 'set',
16
- CTX_NAME_ATTR: 'ctx-name',
17
- CSS_CTX_PROP: '--ctx-name',
18
- });
@@ -1,7 +0,0 @@
1
- /** @template T */
2
- export function withResolvers<T>(): {
3
- resolve: (value: T | PromiseLike<T>) => void;
4
- reject: (value?: unknown) => void;
5
- promise: Promise<T>;
6
- };
7
- //# sourceMappingURL=withResolvers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withResolvers.d.ts","sourceRoot":"","sources":["withResolvers.js"],"names":[],"mappings":"AAEA,kBAAkB;AAClB,8BADc,CAAC;aAUS,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;YACpC,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI;;EAG/C"}
@@ -1,17 +0,0 @@
1
- // @ts-check
2
-
3
- /** @template T */
4
- export function withResolvers() {
5
- let resolve;
6
- let reject;
7
- /** @type {Promise<T>} */
8
- const promise = new Promise((_resolve, _reject) => {
9
- resolve = _resolve;
10
- reject = _reject;
11
- });
12
- return {
13
- resolve: /** @type {(value: T | PromiseLike<T>) => void} */ (/** @type {unknown} */ (resolve)),
14
- reject: /** @type {(value?: unknown) => void} */ (/** @type {unknown} */ (reject)),
15
- promise,
16
- };
17
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=withResolvers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"withResolvers.test.d.ts","sourceRoot":"","sources":["withResolvers.test.js"],"names":[],"mappings":""}
@@ -1,27 +0,0 @@
1
- import { expect } from '@esm-bundle/chai';
2
- import { withResolvers } from './withResolvers';
3
-
4
- describe('withResolvers', () => {
5
- it('should return resolve, reject and promise', () => {
6
- const { resolve, reject, promise } = withResolvers();
7
- expect(resolve).to.be.a('function');
8
- expect(reject).to.be.a('function');
9
- expect(promise).to.be.instanceOf(Promise);
10
- });
11
-
12
- it('should resolve promise', async () => {
13
- const { resolve, promise } = withResolvers();
14
- resolve('resolved');
15
- expect(await promise).to.equal('resolved');
16
- });
17
-
18
- it('should reject promise', async () => {
19
- const { reject, promise } = withResolvers();
20
- reject(new Error('rejected'));
21
- try {
22
- await promise;
23
- } catch (error) {
24
- expect(error.message).to.equal('rejected');
25
- }
26
- });
27
- });